[LEDE-DEV] [PATCH 3/3] lantiq: add device tree binding for dwc2 on danube
Christian Lamparter
chunkeey at googlemail.com
Sat Oct 29 11:44:27 PDT 2016
On Friday, October 28, 2016 11:22:12 PM CEST Ben Mulvihill wrote:
> On Fri, 2016-10-28 at 18:28 +0200, Christian Lamparter wrote:
> > Hello,
> >
> > On Friday, October 28, 2016 4:30:56 PM CEST Ben Mulvihill wrote:
> > > Add device tree binding for dwc2 usb driver on lantiq danube
> > >
> > > Signed-off-by: Ben Mulvihill <ben.mulvihill at gmail.com>
> > > ---
> > > diff -uprN a/target/linux/lantiq/dts/danube.dtsi b/target/linux/lantiq/dts/danube.dtsi
> > > --- a/target/linux/lantiq/dts/danube.dtsi 2016-10-27 19:56:07.090392399 +0200
> > > +++ b/target/linux/lantiq/dts/danube.dtsi 2016-10-27 20:47:34.387511522 +0200
> > > @@ -140,7 +140,7 @@
> > > };
> > >
> > > ifxhcd at E101000 {
> > > - compatible = "lantiq,ifxhcd-danube";
> > > + compatible = "lantiq,ifxhcd-danube", "lantiq,ifxhcd-danube-dwc2";
> > Usually for device tree, the first compatible string is reserved for the
> > "exact device" that the node represents [0]. So wouldn't switching around
> > the strings (i.e.: "lantiq,ifxhcd-danube-dwc2", "lantiq,ifxhcd-danube")
> > make more sense? After all, the dwc2 is the "more exact device" in this case?
> >
>
> Thanks for reviewing.
>
> Are they not equally "exact"? They are two alternative, and completely
> separate, drivers. (The names chosen for the bindings are perhaps a
> little misleading in that regard.) I Left "lantiq,ifxhcd-danube" in
> first position simply because it has been the default driver until
> now, and I didn't want to change the default at this stage. Not that
> it will make any difference to which driver is actually used unless
> for some strange reason someone decides to include both drivers in
> the same build.
>
> Once we're sure that dwc2 works properly on danube, the old
> ifxhcd-danube driver can be ditched from the source tree completely.
> But I thought it was better to get an ack from John on
> these first.
Ok, Thanks, I guess this should work fine if you follow through with
phasing out the old driver too (Yay for that!). The
"lantiq,ifxhcd-danube" will take preference as it is the first entry,
but that's fine.
I tested the patch on my EasyBox 802 (Arcadyan ARV752DPW).
[ 6.291426] dwc2 1e101000.ifxhcd: requested GPIO 464
[ 6.294998] dwc2 1e101000.ifxhcd: Configuration mismatch. Forcing host mode
^^
This can be fixed by setting dr_mode to host in the DTS.
---
diff --git a/target/linux/lantiq/dts/danube.dtsi b/target/linux/lantiq/dts/danube.dtsi
index 009696a..538ec19 100644
--- a/target/linux/lantiq/dts/danube.dtsi
+++ b/target/linux/lantiq/dts/danube.dtsi
@@ -146,6 +146,7 @@
interrupt-parent = <&icu0>;
interrupts = <62>;
status = "disabled";
+ dr_mode = "host";
};
deu at E103100 {
---
The generic dwc2 defaults to OTG mode (as per generic.txt) [0].
(Well, technically, it's UNKNOWN at first but here's the logic [1]).
[ 7.159262] dwc2 1e101000.ifxhcd: DWC OTG Controller
[ 7.162832] dwc2 1e101000.ifxhcd: new USB bus registered, assigned bus number 1
[ 7.169959] dwc2 1e101000.ifxhcd: irq 62, io mem 0x00000000
[ 7.177488] hub 1-0:1.0: USB hub found
[ 7.180650] hub 1-0:1.0: 1 port detected
[ 7.196214] init: - preinit -
[ 7.849577] dwc2 1e101000.ifxhcd: Mode Mismatch Interrupt: currently in Host mode
[ 7.855582] dwc2 1e101000.ifxhcd: Mode Mismatch Interrupt: currently in Host mode
[ 7.862820] dwc2 1e101000.ifxhcd: Mode Mismatch Interrupt: currently in Host mode
[ 8.051083] usb 1-1: new high-speed USB device number 2 using dwc2
[ 8.055952] dwc2 1e101000.ifxhcd: Mode Mismatch Interrupt: currently in Host mode
[ 8.063064] dwc2 1e101000.ifxhcd: Mode Mismatch Interrupt: currently in Host mode
I don't think these are much of an issue. At least for this device the ifxhcd driver
also produces the same messages. For example, this is an extract bootlog from the
opernwrt wiki [2].
| [ 6.980000] IFXUSB: ifxusb_hcd: version 3.2 B110801
| [ 7.484000] IFXUSB: USB core #0 soft-reset
| [ 7.688000] IFXUSB: USB core #0 soft-reset
| [ 7.692000] ifxusb_hcd ifxusb_hcd: IFX USB Controller
| [ 7.696000] ifxusb_hcd ifxusb_hcd: new USB bus registered, assigned bus number 1
| [ 7.704000] ifxusb_hcd ifxusb_hcd: irq 62, io mem 0xbe101000
| [ 7.712000] IFXUSB: Mode Mismatch Interrupt: currently in Host mode
| [ 7.716000] IFXUSB: Mode Mismatch Interrupt: currently in Host mode
Now, there has been recent changes to dwc2 which might fix these pesky
errors. The discussion can be found on the LKML [3] and three patches
were committed to 4.9-rc.
usb: dwc2: Properly account for the force mode delays [4]
usb: dwc2: Add delay to core soft reset [5]
usb: dwc2: gadget: Only initialize device if in device mode [6]
I'll give then a try and see test if they help. Otherwise:
Tested-by: Christian Lamparter <chunkeey at gmail.com>
Regards,
Christian
[0] <https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/generic.txt>
[1] <http://lxr.free-electrons.com/source/drivers/usb/dwc2/platform.c#L213>
[2] <https://wiki.openwrt.org/toh/arcadyan/arv752dpw>
[3] <https://lkml.org/lkml/2016/4/7/690>
[4] <https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/dwc2?id=2938fc63e0c26bf694436ac81bc776c8b7eced0c>
[5] <https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/dwc2?id=fef6bc37dbafe0d6d71c808c8867a8c5ab4b9816>
[6] <https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/dwc2?id=d0f0ac56b34b28e80223d7086b4decdf027c27ed>
More information about the Lede-dev
mailing list