[PATCH 2/3] add soc setup code for USB DR OTG mode
Li Yang-r58472
LeoLi at freescale.com
Tue Feb 6 14:25:01 EST 2007
> -----Original Message-----
> From: Kumar Gala [mailto:galak at kernel.crashing.org]
> Sent: Monday, February 05, 2007 11:16 PM
> To: Li Yang-r58472
> Cc: Paul; linuxppc-dev at ozlabs.org
> Subject: Re: [PATCH 2/3] add soc setup code for USB DR OTG mode
>
>
> On Feb 5, 2007, at 3:10 AM, Li Yang wrote:
>
> You have no description about what this patch does and why its needed.
>
Add platform_device setup code for OTG/client mode of 834x DR. It is
needed for USB client driver to work.
> Nack. See comments inline.
>
> > Signed-off-by: Li Yang <leoli at freescale.com>
> > ---
> > arch/powerpc/sysdev/fsl_soc.c | 76 +++++++++++++++++++++++++++++
> > +----------
> > 1 files changed, 57 insertions(+), 19 deletions(-)
> >
> > diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/
> > fsl_soc.c
> > index ad31e56..d9541aa 100644
> > --- a/arch/powerpc/sysdev/fsl_soc.c
> > +++ b/arch/powerpc/sysdev/fsl_soc.c
> > @@ -440,7 +440,8 @@ static int __init fsl_usb_of_init(void)
> > {
> > struct device_node *np;
> > unsigned int i;
> > - struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL;
> > + struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host =
NULL,
> > + *usb_dev_dr_client = NULL;
> > int ret;
> > for (np = NULL, i = 0;
> > @@ -506,33 +507,70 @@ static int __init fsl_usb_of_init(void)
> > of_irq_to_resource(np, 0, &r[1]);
> > - usb_dev_dr =
> > - platform_device_register_simple("fsl-ehci", i, r,
2);
> > - if (IS_ERR(usb_dev_dr)) {
> > - ret = PTR_ERR(usb_dev_dr);
> > - goto err;
> > - }
> > -
> > - usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL;
> > - usb_dev_dr->dev.dma_mask =
&usb_dev_dr->dev.coherent_dma_mask;
> > + prop = get_property(np, "dr_mode", NULL);
> > - usb_data.operating_mode = FSL_USB2_DR_HOST;
> > + if (prop && !strcmp(prop, "host")) {
> > + usb_data.operating_mode = FSL_USB2_DR_HOST;
> > + usb_dev_dr_host =
platform_device_register_simple(
> > + "fsl-ehci", i, r, 2);
> > + if (IS_ERR(usb_dev_dr_host)) {
> > + ret = PTR_ERR(usb_dev_dr_host);
> > + goto err;
> > + }
> > +
> > + } else if (prop && !strcmp(prop, "peripheral")) {
> > + usb_data.operating_mode = FSL_USB2_DR_DEVICE;
> > + usb_dev_dr_client =
platform_device_register_simple(
> > + "fsl-usb2-udc", i, r, 2);
> > + if (IS_ERR(usb_dev_dr_client)) {
> > + ret = PTR_ERR(usb_dev_dr_client);
> > + goto err;
> > + }
> > + } else if (!prop || (prop && !strcmp(prop, "otg"))) {
>
> Why do we assume if the prop is not defined we are OTG? This will
> break existing users and is not acceptable. If the prop doesn't
> exist we have to assume 'host' support to maintain compatibility.
No, it doesn't break existing users. In otg mode, it supports both host
and client feature. The specific mode to use can be easily selected by
loading the needed driver.
- Leo
More information about the Linuxppc-dev
mailing list