* fsl_udc_core not initializing properly?
@ 2011-02-18 22:03 Matthew L. Creech
2011-02-19 8:52 ` Anatolij Gustschin
0 siblings, 1 reply; 7+ messages in thread
From: Matthew L. Creech @ 2011-02-18 22:03 UTC (permalink / raw)
To: linuxppc-dev
Hi,
I'm upgrading from 2.6.36 to 2.6.37 on a MPC8313 ERDB-like board. On
the new kernel, it seems like the USB gadget driver (fsl_usb2_udc) is
never initialized, so USB no longer works.
Adding some printks to the code shows that udc_init() is being run,
which calls platform_driver_probe(). However, fsl_udc_probe() is
never actually called afterward. As a result, 'udc_controller' is
left NULL, and the subsequent call to usb_gadget_probe_driver()
returns -ENODEV.
I'm not familiar with the USB driver model, and tracing backward
through the call chains didn't reveal much, so I was hoping someone
here would have a better idea what could've changed between 2.6.36 and
2.6.37 that broke fsl_udc_core/fsl_usb2_udc. Thanks!
--
Matthew L. Creech
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-02-18 22:03 fsl_udc_core not initializing properly? Matthew L. Creech
@ 2011-02-19 8:52 ` Anatolij Gustschin
2011-02-19 18:01 ` Matthew L. Creech
0 siblings, 1 reply; 7+ messages in thread
From: Anatolij Gustschin @ 2011-02-19 8:52 UTC (permalink / raw)
To: Matthew L. Creech; +Cc: linuxppc-dev
Hi,
On Fri, 18 Feb 2011 17:03:12 -0500
"Matthew L. Creech" <mlcreech@gmail.com> wrote:
...
> I'm upgrading from 2.6.36 to 2.6.37 on a MPC8313 ERDB-like board. On
> the new kernel, it seems like the USB gadget driver (fsl_usb2_udc) is
> never initialized, so USB no longer works.
>
> Adding some printks to the code shows that udc_init() is being run,
> which calls platform_driver_probe(). However, fsl_udc_probe() is
> never actually called afterward. As a result, 'udc_controller' is
> left NULL, and the subsequent call to usb_gadget_probe_driver()
> returns -ENODEV.
Look at the USB node in the device tree for your board. Does it
contain the "dr_mode" property? For USB gadget the value of this
property should be "peripheral".
The device tree for MPC8313 ERDB in mainline tree doesn't specify
this property, so the host mode is the default operation mode here.
Therefore the platform device "fsl-usb2-udc" won't be created
while booting and since there is no appropriate platform device,
the probing is not done. This might be the case on your board,
too. Try with dr_mode = "peripheral"; in the usb node in your
device tree.
Anatolij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-02-19 8:52 ` Anatolij Gustschin
@ 2011-02-19 18:01 ` Matthew L. Creech
2011-03-10 18:46 ` Matthew L. Creech
0 siblings, 1 reply; 7+ messages in thread
From: Matthew L. Creech @ 2011-02-19 18:01 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linuxppc-dev
On Sat, Feb 19, 2011 at 3:52 AM, Anatolij Gustschin <agust@denx.de> wrote:
>
> Look at the USB node in the device tree for your board. Does it
> contain the "dr_mode" property? For USB gadget the value of this
> property should be "peripheral".
> The device tree for MPC8313 ERDB in mainline tree doesn't specify
> this property, so the host mode is the default operation mode here.
> Therefore the platform device "fsl-usb2-udc" won't be created
> while booting and since there is no appropriate platform device,
> the probing is not done. This might be the case on your board,
> too. Try with dr_mode = "peripheral"; in the usb node in your
> device tree.
>
Yes, it's there. Here's the DTS entry in case anything else sticks out:
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
phy_type = "utmi_wide";
dr_mode = "peripheral";
sleep = <&pmc 0x00300000>;
};
I think dr_mode was required in past kernel versions as well (since I
seem to recall bumping in to the problem you describe a long time ago
when we first tried to get device-mode USB working). :)
Thanks
--
Matthew L. Creech
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-02-19 18:01 ` Matthew L. Creech
@ 2011-03-10 18:46 ` Matthew L. Creech
2011-03-11 13:27 ` Anatolij Gustschin
2011-03-12 8:00 ` Anatolij Gustschin
0 siblings, 2 replies; 7+ messages in thread
From: Matthew L. Creech @ 2011-03-10 18:46 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linuxppc-dev
On Sat, Feb 19, 2011 at 1:01 PM, Matthew L. Creech <mlcreech@gmail.com> wro=
te:
>
> Yes, it's there. =A0Here's the DTS entry in case anything else sticks out=
:
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0usb@23000 {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compatible =3D "fsl-usb2-d=
r";
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0reg =3D <0x23000 0x1000>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#address-cells =3D <1>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#size-cells =3D <0>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupt-parent =3D <&ipi=
c>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupts =3D <38 0x8>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0phy_type =3D "utmi_wide";
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dr_mode =3D "peripheral";
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sleep =3D <&pmc 0x00300000=
>;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0};
>
Hi Anatolij,
I tracked the problem down to a change made in September, which
happens to be yours:
http://git.kernel.org/?p=3Dlinux/kernel/git/torvalds/linux-2.6.git;a=3Dcomm=
itdiff;h=3D126512e3f274802ca65ebeca8660237f0361ad48
When I roll this back, everything works fine again.
First of all, I noticed that fsl-mph-dr-of.c isn't even compiling for
me (even though I have the option enabled in my .config), because it's
been placed in "usb/host/", and I'm only using device/gadget-mode USB.
I edited the top-level Makefile to just force it into "usb/host/", and
that makes sure that your driver gets built (and it's probed just fine
at runtime). But that still didn't solve the problem - as before,
fsl_udc_probe() is never being called.
Did you test this change in device mode? I'm wondering if there's
something different about my configuration that prevents it from
working. My config is uploaded here if it helps:
http://mcreech.com/work/linux.config
Thanks!
--=20
Matthew L. Creech
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-03-10 18:46 ` Matthew L. Creech
@ 2011-03-11 13:27 ` Anatolij Gustschin
2011-03-12 8:00 ` Anatolij Gustschin
1 sibling, 0 replies; 7+ messages in thread
From: Anatolij Gustschin @ 2011-03-11 13:27 UTC (permalink / raw)
To: Matthew L. Creech; +Cc: linuxppc-dev
On Thu, 10 Mar 2011 13:46:29 -0500
"Matthew L. Creech" <mlcreech@gmail.com> wrote:
> On Sat, Feb 19, 2011 at 1:01 PM, Matthew L. Creech <mlcreech@gmail.com> w=
rote:
> >
> > Yes, it's there. =C2=A0Here's the DTS entry in case anything else stick=
s out:
> >
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0usb@23000 {
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0compatible =3D "fsl-usb2-dr";
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0reg =3D <0x23000 0x1000>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0#address-cells =3D <1>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0#size-cells =3D <0>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0interrupt-parent =3D <&ipic>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0interrupts =3D <38 0x8>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0phy_type =3D "utmi_wide";
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0dr_mode =3D "peripheral";
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0sleep =3D <&pmc 0x00300000>;
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0};
> >
>=20
> Hi Anatolij,
Hi Matthew,
> I tracked the problem down to a change made in September, which
> happens to be yours:
>=20
> http://git.kernel.org/?p=3Dlinux/kernel/git/torvalds/linux-2.6.git;a=3Dco=
mmitdiff;h=3D126512e3f274802ca65ebeca8660237f0361ad48
>=20
> When I roll this back, everything works fine again.
>=20
> First of all, I noticed that fsl-mph-dr-of.c isn't even compiling for
> me (even though I have the option enabled in my .config), because it's
> been placed in "usb/host/", and I'm only using device/gadget-mode USB.
>=20
> I edited the top-level Makefile to just force it into "usb/host/", and
> that makes sure that your driver gets built (and it's probed just fine
> at runtime). But that still didn't solve the problem - as before,
> fsl_udc_probe() is never being called.
Thanks for reporting this bug.
> Did you test this change in device mode? I'm wondering if there's
> something different about my configuration that prevents it from
> working. My config is uploaded here if it helps:
>=20
> http://mcreech.com/work/linux.config
I did test in device mode with additional Patches for USB Device/OTG
support for MPC5121e, these patches still need rework to be acceptable in
mainline. Thanks for your config, I'll look at the issue this weekend
and will report the result.
Anatolij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-03-10 18:46 ` Matthew L. Creech
2011-03-11 13:27 ` Anatolij Gustschin
@ 2011-03-12 8:00 ` Anatolij Gustschin
2011-03-14 15:47 ` Matthew L. Creech
1 sibling, 1 reply; 7+ messages in thread
From: Anatolij Gustschin @ 2011-03-12 8:00 UTC (permalink / raw)
To: Matthew L. Creech; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]
Hi Matthew,
On Thu, 10 Mar 2011 13:46:29 -0500
"Matthew L. Creech" <mlcreech@gmail.com> wrote:
...
> I tracked the problem down to a change made in September, which
> happens to be yours:
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=126512e3f274802ca65ebeca8660237f0361ad48
>
> When I roll this back, everything works fine again.
>
> First of all, I noticed that fsl-mph-dr-of.c isn't even compiling for
> me (even though I have the option enabled in my .config), because it's
> been placed in "usb/host/", and I'm only using device/gadget-mode USB.
>
> I edited the top-level Makefile to just force it into "usb/host/", and
> that makes sure that your driver gets built (and it's probed just fine
> at runtime). But that still didn't solve the problem - as before,
> fsl_udc_probe() is never being called.
>
> Did you test this change in device mode? I'm wondering if there's
> something different about my configuration that prevents it from
> working. My config is uploaded here if it helps:
>
> http://mcreech.com/work/linux.config
Can you please apply the attached patch, then build with your
linux.config and send me the kernel boot log? It will help to
fix the issue.
Thanks,
Anatolij
[-- Attachment #2: usb-mph-dr-cfg.diff --]
[-- Type: text/x-patch, Size: 1269 bytes --]
diff --git a/drivers/Makefile b/drivers/Makefile
index f3ebb30..bf1ad90 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_UWB) += uwb/
obj-$(CONFIG_USB_OTG_UTILS) += usb/otg/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/
+obj-$(CONFIG_USB_FSL_MPH_DR_OF) += usb/host/
obj-$(CONFIG_PCI) += usb/
obj-$(CONFIG_USB_GADGET) += usb/gadget/
obj-$(CONFIG_SERIO) += input/serio/
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 4c55eda..a3ba374 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2240,6 +2240,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
unsigned int i;
u32 dccparams;
+ printk("%s\n", __func__);
if (strcmp(pdev->name, driver_name)) {
VDBG("Wrong device");
return -ENODEV;
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 574b99e..b8b3070 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -130,6 +130,7 @@ static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
static unsigned int idx;
int i;
+ printk("%s\n", __func__);
if (!of_device_is_available(np))
return -ENODEV;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: fsl_udc_core not initializing properly?
2011-03-12 8:00 ` Anatolij Gustschin
@ 2011-03-14 15:47 ` Matthew L. Creech
0 siblings, 0 replies; 7+ messages in thread
From: Matthew L. Creech @ 2011-03-14 15:47 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linuxppc-dev
On Sat, Mar 12, 2011 at 3:00 AM, Anatolij Gustschin <agust@denx.de> wrote:
>
> Can you please apply the attached patch, then build with your
> linux.config and send me the kernel boot log? It will help to
> fix the issue.
>
Actually, this kernel seems to work:
...
Freescale PowerQUICC MII Bus: probed
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
fsl_usb2_mph_dr_of_probe
Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)
fsl_udc_probe
g_ether gadget: using random self ethernet address
...
Oddly enough, the kernel I tried last week did the same thing (I
hard-coded "obj-y += usb/host/" into drivers/Makefile), but I had a
printk() at the top of fsl_udc_probe() that never got called.
Oh, I see the difference now: you added the usb/host/ entry before
usb/gadget/, while I added it afterward... I forgot that link order
determines initialization order in the kernel.
Anyway, seems to work fine. :) Thanks Antolij!
--
Matthew L. Creech
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-14 15:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 22:03 fsl_udc_core not initializing properly? Matthew L. Creech
2011-02-19 8:52 ` Anatolij Gustschin
2011-02-19 18:01 ` Matthew L. Creech
2011-03-10 18:46 ` Matthew L. Creech
2011-03-11 13:27 ` Anatolij Gustschin
2011-03-12 8:00 ` Anatolij Gustschin
2011-03-14 15:47 ` Matthew L. Creech
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).