From: Matthew L. Creech <hidden> Date: 2011-02-18 22:03:17
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
Hi,
On Fri, 18 Feb 2011 17:03:12 -0500
"Matthew L. Creech" [off-list ref] 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
From: Matthew L. Creech <hidden> Date: 2011-02-19 18:02:03
On Sat, Feb 19, 2011 at 3:52 AM, Anatolij Gustschin [off-list ref] 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
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
=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
Hi Matthew,
On Thu, 10 Mar 2011 13:46:29 -0500
"Matthew L. Creech" [off-list ref] 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
From: Matthew L. Creech <hidden> Date: 2011-03-14 15:47:40
On Sat, Mar 12, 2011 at 3:00 AM, Anatolij Gustschin [off-list ref] 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 [off-list ref]
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