Subject: Re: [PATCH 1/4] powerpc/fsl_soc.c: prepare for addition of mpc5121 USB code

From: Anatolij Gustschin <[email-masked]>
Date: Thu, 6 May 2010 21:18:00 +0200

Hi Grant,

On Tue, 27 Apr 2010 10:51:21 -0600
Grant Likely <[email-masked]> wrote:

> On Tue, Apr 27, 2010 at 10:11 AM, Anatolij Gustschin <[email-masked]> wrote:
> > Factor out common code for registering a FSL EHCI platform
> > device into new fsl_usb2_register_device() function. This
> > is done to avoid code duplication while adding code for
> > instantiating of MPC5121 dual role USB platform devices.
> > Then, the subsequent patch can use
> > for_each_compatible_node(np, NULL, "fsl,mpc5121-usb2-dr") {
> >        ...
> >        fsl_usb2_register_device();
> > }
> >
> > Signed-off-by: Anatolij Gustschin <[email-masked]>
> > Cc: Kumar Gala <[email-masked]>
> > Cc: Grant Likely <[email-masked]>
> > ---
> >  arch/powerpc/sysdev/fsl_soc.c |  231 +++++++++++++++++++---------------------
> 
> Hi Anatolij,
> 
> Thanks for this work.  However, I've got concerns.
> 
> Forgive me for ragging on code that you didn't write, but this
> fsl_soc.c code for registering the USB device really doesn't belong
> here anymore.  It should be part of the drivers/usb/host/ehci-fsl.c
> and the driver should do of-style binding (Which should be a lot
> easier if I manage to get the merge of platform bus and of_platform
> bus into 2.6.35).

Now I moved the USB devices registration code to
drivers/usb/host/ehci-fsl.c and added of-style binding there. It
works for one platform driver based on your test-devicetree branch.
It seems I can't bind more than one driver to the device described
in the tree. But I need to bind at least 2 drivers, ehci-hcd and
fsl-usb2-udc. For USB OTG support I need additional one to be bound
to the same USB dual role device (also tree different drivers
simultaneously).
I also can't register UDC device in the ehci-fsl.c since registering
of the UDC device should also be possible independent of the EHCI-HDC
driver (for USB device support we do not need host controller driver).
Is it possible to bind more than one driver to the same device
simultaneously? If so, how can I implement this?

> This patch series makes the fsl_soc.c code even more complicated, and
> scatters what is essentially driver code over even more places in the
> arch/powerpc tree.  I'm really not keen on it being merged in this
> form.

Now I see one reason why it has been originally implemented
this way.

Thanks,
Anatolij