Re: [PATCH 6/7 v2] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
From: Scott Wood <hidden>
Date: 2007-08-22 21:16:21
Also in:
linuxppc-dev
Vitaly Bordug wrote:
yes, wrong snippet what aboutquoted
#ifdef CONFIG_CPM2 + r = fs_enet_mdio_bb_init(); + if (r != 0) + goto out_mdio_bb; +#endif +#ifdef CONFIG_8xx + r = fs_enet_mdio_fec_init(); + if (r != 0) + goto out_mdio_fec; +#endifWe had to pray and hope that 8xx would only have fec, and cpm2 has some bitbanged stuff. now we can inquire dts and know for sure, at least it seems so.
Yeah, that sucks. We should add kconfig options for each mii type, and let them have their own init functions. That only affects the initcalls (and kernel size), though; it still uses the phy-handle to decide what mdio controller to actually talk to.
quoted
How is that different from the old code, where you're hosed without fep->fpi->bus_id?I wasn't defending old code, and consider "old code is POS, new one is just great" game meaningless. I am just stating the problem, that we'll have to address later. On 8xx even reference boards may be without phy at all.
OK -- would it suffice to just never call any phylib functions and always assume the link is up if the phy-handle property is undefined?
ok, agreed, size is most serious judge here. we'll definitely have to revisit pin problem later too (because custom designs sometimes switch contradictory devices on-the-fly, disable soc parts for alternative function, etc.)
If it's really on-the-fly (and not jumpered/once-per-boot), then board code should expose some kind of API to switch the functions, acting like a hotplug bus. Associating it with open/close of the device won't work if one of the devices is something like USB which needs to start working without any internal open()-like action. -Scott