Platform device model drawback

Greg KH greg at kroah.com
Sat Nov 19 10:47:11 EST 2005


On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
> On 11/15/05, Greg KH <greg at kroah.com> wrote:
> > On Tue, Nov 15, 2005 at 01:34:47PM -0600, Kumar Gala wrote:
> > > This is where the confusion is.  We have two instances of device A.  We
> > > want instance 1 of device A bound to driver "enet" and instance 2 of
> > > device A bound to "serial".
> >
> > That's different from what was described earlier :)
> >
> > In this case, you need two different struct devices.
> Which is what we have.
> 
> >
> > > Today both instances are called "deviceA".  However we can't register two
> > > different drivers as "deviceA".
> >
> > Nor would you want to.
> >
> > > Not sure if that clarifies the issue any.
> >
> > A bit.  I think it still sounds messy...
> 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.
> 
> Q: Can the .name field be modified *after* platform_device is
> registered w/ the platform bus?

No, it can not, sorry.

Good luck,

greg k-h



More information about the Linuxppc-embedded mailing list