[OpenWrt-Devel] b53 switch platform_data vs. device tree

Hauke Mehrtens hauke at hauke-m.de
Sun Feb 8 09:08:03 EST 2015

On 02/06/2015 08:16 PM, Daniel Golle wrote:
> Hi!
> I started using Jonas' b53 driver for the Lamobo R1 board in OpenWrt.
> To make things more convenient, I'd like to have the port mapping
> inside the device-tree, so port enumeration would be consistent.
> swconfig supports that (of_switch_load_portmap), apparently FONERA20N
> is the only board making use of that feature for now.
> Given the absurdity of the port mapping on the Lamobo R1 board, I'd
> love to use the feature there as well:
>     LAN    WAN
>  (4 0 1 2) (3)
strange mapping. ;-)

> However, b53 doesn't implement OF support but rather still makes use of
> platform_data.
> Thus dev->of_node is unset for the b53 switches, and therefore
> of_switch_load_portmap can't do the job right now :(
> Are you planning on migrating from platform_data to device-tree any time
> soon? Doing that for b53 doesn't look hard to me, however, from what I
> can see, the only users of b53_platform_data are brcm63xx boards
> VR-3025u, VR-3025un and WAP5813n. I never touched that platform
> (nor any other broadcom target), thus it's hard for me to tell how far
> away OpenWrt is from the pressumed goal of deprecating b53_platform_data.
> Hacks such as assigning ethX aliases via platform_data could then be
> replaced by semantically more pleasing ways to assign non-MDIO connected
> b53 to a specific NIC.

At least on BCM47xx and BCM53xx we assigned the port mapping from user
space with some bash scripts.

> I'm not interested in brcm63xx and don't have any such hardware flying
> around. I can implement minimal OF support and make sure at least
> dev->of_node is set. This shoudn't do any harm and would allow a
> graceful migration path.
> What do you think?

I think you are right we should fill sw_dev->of_node with the device
tree data for the switch if possible. I think adding this should not
break anything else.

I am waiting for a patch. ;-)

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list