Platform device model drawback
Grant Likely
glikely at gmail.com
Sat Nov 19 13:37:01 EST 2005
On 11/18/05, Greg KH <greg at kroah.com> wrote:
> On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
> > Does this help? (We also discussed this a bit at the PPC BoF at OLS this year)
> >
> > For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
> > - 6 PSC devices on chip;
> > - (struct platform_device) for each device has: .name='mpc52xx-psc';
> > - However, SCC1 may be driven by the Ethernet driver but PSC2 and
> > PSC6 may be serial
> > - problem then is: How do you get only PSC1 bound to the
> > psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?
>
> I really do not know, sorry.
>
> >
> > Possible solution; Modify the naming scheme slightly from what is
> > currently used.
> > 1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
> > 2. Make the serial driver register the name "mpc52xx-psc:uart"
> > 3. In the board-specific platform code, modify the .name field in
> > struct platform_device *before* the device is registered with the
> > platform device. (possibly by extending ppc_sys_device_fixup callback)
> > - The board specific code would set PSC1 to "mpc52xx-psc:eth",
> > PSC2&6 to "mpc52xx-psc:uart". PSC3-5 would stick with "mpc52xx-psc"
> > and so would not get bound to anything.
Ignoring the question below, do you see any problem with the above solution?
> >
> > Q: Can the .name field be modified *after* platform_device is
> > registered w/ the platform bus?
>
> No, it can not, sorry.
Not a big deal, that question was a bit of an aside. If the name
could be changed, then the device function could change at runtime by
unbinding one function driver, changing the name and rebind
another.... But now that I think about it for more that 2ms, a
solution to this would be to just unregister, change .name, and
reregister the struct platform_device.
g.
More information about the Linuxppc-embedded
mailing list