openwrtv4/target/linux/ipq806x/files-4.9/arch/arm/boot/dts
Thomas Reifferscheid 17f60b1cd2 ipq8064: fix dwc3-of-simple module unloading
Without patch unloading the dwc3-of-simple module went stuck after
successfully removing hcd.1 during the hcd.0 removal:

root@LEDE:/# rmmod dwc3-of-simple
[   21.391846] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   21.391931] usb usb4: USB disconnect, device number 1
[   21.397038] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
[   21.401111] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   21.406685] usb usb3: USB disconnect, device number 1
[   21.412848] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
[   21.417248] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   21.422521] usb usb2: USB disconnect, device number 1
followed by nothing.

Sometimes a stall CPU was detected, or a kernel panic,
or a reboot occurred after a couple of minutes.

At the same time unloading the dwc3 module followed by dwc3-of-simple
module was working repeatedly.

root@LEDE:/# rmmod dwc3
[   53.827328] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   53.827412] usb usb4: USB disconnect, device number 1
[   53.832630] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
[   53.836452] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   53.842314] usb usb3: USB disconnect, device number 1
[   53.848412] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
[   53.852542] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   53.857882] usb usb2: USB disconnect, device number 1
[   53.863956] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
[   53.867875] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   53.873696] usb usb1: USB disconnect, device number 1
[   53.879742] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
root@LEDE:/# rmmod dwc3-of-simple
root@LEDE:/#

For the non-working case, the code was stuck in a readl() in
http://lxr.free-electrons.com/source/drivers/usb/host/xhci.c#L91
because
http://lxr.free-electrons.com/source/drivers/usb/dwc3/dwc3-of-simple.c#L126
was disabling the wrong clocks when removing hcd.1 (it was disabling
the clock of hcd.0). That's why the readl() went stuck when removing
hcd.0

The patch however addresses the clock assignment from the .dtsi
file. Most probably it went into openwrt here:
https://dev.openwrt.org/browser/trunk/target/linux/ipq806x/patches-3.18/101-ARM-qcom-add-USB-nodes-to-ipq806x-ap148.patch?rev=45261
copied from Qualcomms attempt here: https://lkml.org/lkml/2015/11/20/116

Now unloading and repeated module loading is working just fine,
no matter if you'd remove dwc3-of-simple or dwc3.

root@LEDE:/# rmmod dwc3-of-simple
[   24.089679] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   24.089765] usb usb4: USB disconnect, device number 1
[   24.094856] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
[   24.098963] xhci-hcd xhci-hcd.1.auto: remove, state 1
[   24.104522] usb usb3: USB disconnect, device number 1
[   24.111194] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered
[   24.115086] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   24.120396] usb usb2: USB disconnect, device number 1
[   24.126503] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
[   24.130347] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   24.135948] usb usb1: USB disconnect, device number 1
[   24.142085] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
root@LEDE:/#

Fixes: dwc3-of-simple module unloading

Signed-off-by: Thomas Reifferscheid <thomas@reifferscheid.org>
2017-03-28 09:03:55 +02:00
..
qcom-ipq4019-bus.dtsi ipq806x: add ipq4019 support 2017-03-22 09:45:18 +01:00
qcom-ipq4019-fritz4040.dts ipq806x: add ipq4019 fritz4040 support 2017-03-22 09:45:18 +01:00
qcom-ipq4019-nbg6617.dts ipq806x: add ipq4019 support 2017-03-22 09:45:18 +01:00
qcom-ipq4019-rt-ac58u.dts ipq806x: add ipq4019 support 2017-03-22 09:45:18 +01:00
qcom-ipq8064-ap148.dts ipq806x: fix NAND support for linux 4.9 2017-03-13 13:40:56 +01:00
qcom-ipq8064-c2600.dts ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00
qcom-ipq8064-d7800.dts ipq806x: fix NAND support for linux 4.9 2017-03-13 13:40:56 +01:00
qcom-ipq8064-db149.dts ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00
qcom-ipq8064-ea8500.dts ipq806x: fix NAND support for linux 4.9 2017-03-13 13:40:56 +01:00
qcom-ipq8064-r7500.dts ipq8064: enable 2nd USB port on R7500 2017-03-27 08:15:37 +02:00
qcom-ipq8064-r7500v2.dts ipq806x: fix NAND support for linux 4.9 2017-03-13 13:40:56 +01:00
qcom-ipq8064-vr2600v.dts ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00
qcom-ipq8064.dtsi ipq8064: fix dwc3-of-simple module unloading 2017-03-28 09:03:55 +02:00
qcom-ipq8065-nbg6817.dts ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00
qcom-ipq8065-r7800.dts ipq806x: fix NAND support for linux 4.9 2017-03-13 13:40:56 +01:00
qcom-ipq8065-v1.0.dtsi ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00
qcom-ipq8065.dtsi ipq806x: clean up dts patch 2017-03-08 14:38:22 +01:00