* [patch] ARM: mvebu: fix usb on Linksys Caiman @ 2016-03-29 13:56 Patrick Uiterwijk 2016-03-29 13:56 ` [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ Patrick Uiterwijk 2016-03-29 13:56 ` [PATCH 2/2] ARM: mvebu: Correct unit address for linksys Patrick Uiterwijk 0 siblings, 2 replies; 9+ messages in thread From: Patrick Uiterwijk @ 2016-03-29 13:56 UTC (permalink / raw) To: linux-arm-kernel Hi, These patches fix the USB ports on Linksys Caiman (WRT1200AC) on 4.6rc1. After a lot of trial and error, I found out that if there's any unit with name "usb at 58000" defined, none of the USB ports work, but if I change it to anything else, the USB3 port comes up. And if I then also bring the linksys.dtsi unit name in sync (and different from USB at 58000), the USB2 port also comes up. I can change it to literally anything else: nonsense at 58000 and usb at 58001 work, it's only usb at 58000 that doesn't work as far as I have found. Since the ehci-orion documentation gives the example of ehci at 50000, I just brought all of the Orion EHCI device tree definitions in sync with this. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 13:56 [patch] ARM: mvebu: fix usb on Linksys Caiman Patrick Uiterwijk @ 2016-03-29 13:56 ` Patrick Uiterwijk 2016-03-29 14:05 ` Arnd Bergmann 2016-03-29 13:56 ` [PATCH 2/2] ARM: mvebu: Correct unit address for linksys Patrick Uiterwijk 1 sibling, 1 reply; 9+ messages in thread From: Patrick Uiterwijk @ 2016-03-29 13:56 UTC (permalink / raw) To: linux-arm-kernel According to Documentation/devicetree/bindings/usb/ehci-orion.txt, the Orion Marvell variant of EHCI controllers should have names ehci at 50000 for example. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> --- arch/arm/boot/dts/armada-370-db.dts | 4 ++-- arch/arm/boot/dts/armada-370-dlink-dns327l.dts | 2 +- arch/arm/boot/dts/armada-370-mirabox.dts | 4 ++-- arch/arm/boot/dts/armada-370-netgear-rn102.dts | 2 +- arch/arm/boot/dts/armada-370-netgear-rn104.dts | 2 +- arch/arm/boot/dts/armada-370-rd.dts | 4 ++-- arch/arm/boot/dts/armada-370-seagate-personal-cloud.dtsi | 2 +- arch/arm/boot/dts/armada-370-synology-ds213j.dts | 4 ++-- arch/arm/boot/dts/armada-370-xp.dtsi | 4 ++-- arch/arm/boot/dts/armada-370.dtsi | 4 ++-- arch/arm/boot/dts/armada-375-db.dts | 2 +- arch/arm/boot/dts/armada-375.dtsi | 4 ++-- arch/arm/boot/dts/armada-385-linksys.dtsi | 2 +- arch/arm/boot/dts/armada-388-clearfog.dts | 2 +- arch/arm/boot/dts/armada-388-db.dts | 2 +- arch/arm/boot/dts/armada-388-gp.dts | 2 +- arch/arm/boot/dts/armada-38x.dtsi | 2 +- arch/arm/boot/dts/armada-xp-db.dts | 6 +++--- arch/arm/boot/dts/armada-xp-gp.dts | 4 ++-- arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts | 4 ++-- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 2 +- arch/arm/boot/dts/armada-xp-matrix.dts | 2 +- arch/arm/boot/dts/armada-xp-netgear-rn2120.dts | 2 +- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 4 ++-- arch/arm/boot/dts/armada-xp-synology-ds414.dts | 2 +- arch/arm/boot/dts/armada-xp.dtsi | 2 +- 26 files changed, 38 insertions(+), 38 deletions(-) diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts index 2364fc5..4d50030 100644 --- a/arch/arm/boot/dts/armada-370-db.dts +++ b/arch/arm/boot/dts/armada-370-db.dts @@ -147,11 +147,11 @@ broken-cd; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-dlink-dns327l.dts b/arch/arm/boot/dts/armada-370-dlink-dns327l.dts index e2a363b..6695653 100644 --- a/arch/arm/boot/dts/armada-370-dlink-dns327l.dts +++ b/arch/arm/boot/dts/armada-370-dlink-dns327l.dts @@ -92,7 +92,7 @@ status = "okay"; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts index d5e19cd..3fbbc13 100644 --- a/arch/arm/boot/dts/armada-370-mirabox.dts +++ b/arch/arm/boot/dts/armada-370-mirabox.dts @@ -154,11 +154,11 @@ broken-cd; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts index 39181b3..a368e0e 100644 --- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts +++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts @@ -115,7 +115,7 @@ phy-mode = "rgmii-id"; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts index 1156575..99c87ea 100644 --- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts +++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts @@ -121,7 +121,7 @@ phy-mode = "rgmii-id"; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts index fbef730..86f4fa8 100644 --- a/arch/arm/boot/dts/armada-370-rd.dts +++ b/arch/arm/boot/dts/armada-370-rd.dts @@ -134,11 +134,11 @@ broken-cd; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-seagate-personal-cloud.dtsi b/arch/arm/boot/dts/armada-370-seagate-personal-cloud.dtsi index 1aba08e..344fe32 100644 --- a/arch/arm/boot/dts/armada-370-seagate-personal-cloud.dtsi +++ b/arch/arm/boot/dts/armada-370-seagate-personal-cloud.dtsi @@ -88,7 +88,7 @@ }; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; }; diff --git a/arch/arm/boot/dts/armada-370-synology-ds213j.dts b/arch/arm/boot/dts/armada-370-synology-ds213j.dts index 8ca7a43..f5e8950 100644 --- a/arch/arm/boot/dts/armada-370-synology-ds213j.dts +++ b/arch/arm/boot/dts/armada-370-synology-ds213j.dts @@ -174,12 +174,12 @@ }; /* rear USB port, near reset button */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; /* rear USB port, near RJ45 port */ - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi index a718866..90a6eba 100644 --- a/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/arch/arm/boot/dts/armada-370-xp.dtsi @@ -253,14 +253,14 @@ reg = <0x22000 0x1000>; }; - usb at 50000 { + ehci at 50000 { compatible = "marvell,orion-ehci"; reg = <0x50000 0x500>; interrupts = <45>; status = "disabled"; }; - usb at 51000 { + ehci at 51000 { compatible = "marvell,orion-ehci"; reg = <0x51000 0x500>; interrupts = <46>; diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi index 3b06aa8..47579c4 100644 --- a/arch/arm/boot/dts/armada-370.dtsi +++ b/arch/arm/boot/dts/armada-370.dtsi @@ -271,11 +271,11 @@ status = "disabled"; }; - usb at 50000 { + ehci at 50000 { clocks = <&coreclk 0>; }; - usb at 51000 { + ehci at 51000 { clocks = <&coreclk 0>; }; diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts index cded5f0..d2a19a1 100644 --- a/arch/arm/boot/dts/armada-375-db.dts +++ b/arch/arm/boot/dts/armada-375-db.dts @@ -144,7 +144,7 @@ }; }; - usb at 54000 { + ehci at 54000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi index cc952cf..1d61dff 100644 --- a/arch/arm/boot/dts/armada-375.dtsi +++ b/arch/arm/boot/dts/armada-375.dtsi @@ -445,7 +445,7 @@ reg = <0x21010 0x1c>; }; - usb at 50000 { + ehci at 50000 { compatible = "marvell,orion-ehci"; reg = <0x50000 0x500>; interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; @@ -455,7 +455,7 @@ status = "disabled"; }; - usb at 54000 { + ehci at 54000 { compatible = "marvell,orion-ehci"; reg = <0x54000 0x500>; interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi b/arch/arm/boot/dts/armada-385-linksys.dtsi index 3710755..b328d94 100644 --- a/arch/arm/boot/dts/armada-385-linksys.dtsi +++ b/arch/arm/boot/dts/armada-385-linksys.dtsi @@ -117,7 +117,7 @@ }; /* USB part of the eSATA/USB 2.0 port */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts index c60206e..5ea8c67 100644 --- a/arch/arm/boot/dts/armada-388-clearfog.dts +++ b/arch/arm/boot/dts/armada-388-clearfog.dts @@ -355,7 +355,7 @@ }; }; - usb at 58000 { + ehci at 58000 { /* CON3, nearest power. */ status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-388-db.dts b/arch/arm/boot/dts/armada-388-db.dts index ea93ed7..e25bead 100644 --- a/arch/arm/boot/dts/armada-388-db.dts +++ b/arch/arm/boot/dts/armada-388-db.dts @@ -105,7 +105,7 @@ bm,pool-short = <3>; }; - usb at 58000 { + ehci at 58000 { status = "ok"; }; diff --git a/arch/arm/boot/dts/armada-388-gp.dts b/arch/arm/boot/dts/armada-388-gp.dts index fd75e5e..cafe2b2 100644 --- a/arch/arm/boot/dts/armada-388-gp.dts +++ b/arch/arm/boot/dts/armada-388-gp.dts @@ -140,7 +140,7 @@ }; /* CON4 */ - usb at 58000 { + ehci at 58000 { vcc-supply = <®_usb2_0_vbus>; status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index 3312be6..7e881c0 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -466,7 +466,7 @@ status = "disabled"; }; - usb at 58000 { + ehci at 58000 { compatible = "marvell,orion-ehci"; reg = <0x58000 0x500>; interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts index 62422a9..0adc619 100644 --- a/arch/arm/boot/dts/armada-xp-db.dts +++ b/arch/arm/boot/dts/armada-xp-db.dts @@ -219,15 +219,15 @@ broken-cd; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; - usb at 51000 { + ehci at 51000 { status = "okay"; }; - usb at 52000 { + ehci at 52000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts index 061f423..776de1f 100644 --- a/arch/arm/boot/dts/armada-xp-gp.dts +++ b/arch/arm/boot/dts/armada-xp-gp.dts @@ -223,12 +223,12 @@ }; /* Front-side USB slot */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; /* Back-side USB slot */ - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts index 8af463f..42b9000 100644 --- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts +++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts @@ -115,11 +115,11 @@ phy-mode = "rgmii-id"; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts index b89e6cf..f19f2fe 100644 --- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts +++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts @@ -135,7 +135,7 @@ }; /* USB part of the eSATA/USB 2.0 port */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-matrix.dts b/arch/arm/boot/dts/armada-xp-matrix.dts index 6522b04..dedd100 100644 --- a/arch/arm/boot/dts/armada-xp-matrix.dts +++ b/arch/arm/boot/dts/armada-xp-matrix.dts @@ -108,7 +108,7 @@ }; }; - usb at 50000 { + ehci at 50000 { status = "okay"; }; }; diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts index d19f44c..2d7160e 100644 --- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts +++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts @@ -150,7 +150,7 @@ }; /* Front USB 2.0 port */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts index ed3b889d..586c880 100644 --- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts @@ -220,12 +220,12 @@ }; /* Front side USB 0 */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; /* Front side USB 1 */ - usb at 51000 { + ehci at 51000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp-synology-ds414.dts b/arch/arm/boot/dts/armada-xp-synology-ds414.dts index d17dab0..2707a96 100644 --- a/arch/arm/boot/dts/armada-xp-synology-ds414.dts +++ b/arch/arm/boot/dts/armada-xp-synology-ds414.dts @@ -202,7 +202,7 @@ }; /* Front USB 2.0 port */ - usb at 50000 { + ehci at 50000 { status = "okay"; }; diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi index 553349c..593682b 100644 --- a/arch/arm/boot/dts/armada-xp.dtsi +++ b/arch/arm/boot/dts/armada-xp.dtsi @@ -205,7 +205,7 @@ clocks = <&gateclk 19>; }; - usb at 52000 { + ehci at 52000 { compatible = "marvell,orion-ehci"; reg = <0x52000 0x500>; interrupts = <47>; -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 13:56 ` [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ Patrick Uiterwijk @ 2016-03-29 14:05 ` Arnd Bergmann 2016-03-29 16:37 ` Gregory CLEMENT 0 siblings, 1 reply; 9+ messages in thread From: Arnd Bergmann @ 2016-03-29 14:05 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 29 March 2016 13:56:52 Patrick Uiterwijk wrote: > According to Documentation/devicetree/bindings/usb/ehci-orion.txt, > the Orion Marvell variant of EHCI controllers should have names > ehci at 50000 for example. > > Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> > I think it's better to follow the generic USB binding that suggests the name of 'usb', unless we understand what the specific bug is you run into. Do you think it is the boot loader that messes up the hardware, or something in the kernel that goes wrong? Did it work on earlier kernels? We had a regression based on the USB device probing, but that should be fixed now with the patch below. Do you have that? Arnd commit 7222c832254a75dcd67d683df75753d4a4e125bb Author: Nicolai Stange <nicstange@gmail.com> Date: Thu Mar 17 23:53:02 2016 +0100 usb/core: usb_alloc_dev(): fix setting of ->portnum With commit 69bec7259853 ("USB: core: let USB device know device node"), the port1 argument of usb_alloc_dev() gets overwritten as follows: ... usb_alloc_dev(..., unsigned port1) { ... if (!parent->parent) { port1 = usb_hcd_find_raw_port_number(..., port1); } ... } Later on, this now overwritten port1 gets assigned to ->portnum: dev->portnum = port1; However, since xhci_find_raw_port_number() isn't idempotent, the aforementioned commit causes a number of KASAN splats like the following: BUG: KASAN: slab-out-of-bounds in xhci_find_raw_port_number+0x98/0x170 at addr ffff8801d9311670 Read of size 8 by task kworker/2:1/87 [...] Workqueue: usb_hub_wq hub_event 0000000000000188 000000005814b877 ffff8800cba17588 ffffffff8191447e 0000000041b58ab3 ffffffff82a03209 ffffffff819143a2 ffffffff82a252f4 ffff8801d93115e0 0000000000000188 ffff8801d9311628 ffff8800cba17588 Call Trace: [<ffffffff8191447e>] dump_stack+0xdc/0x15e [<ffffffff819143a2>] ? _atomic_dec_and_lock+0xa2/0xa2 [<ffffffff814e2cd1>] ? print_section+0x61/0xb0 [<ffffffff814e4939>] print_trailer+0x179/0x2c0 [<ffffffff814f0d84>] object_err+0x34/0x40 [<ffffffff814f4388>] kasan_report_error+0x2f8/0x8b0 [<ffffffff814eb91e>] ? __slab_alloc+0x5e/0x90 [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 [<ffffffff814f5091>] kasan_report+0x71/0xa0 [<ffffffff814ec082>] ? kmem_cache_alloc_trace+0x212/0x560 [<ffffffff81d99468>] ? xhci_find_raw_port_number+0x98/0x170 [<ffffffff814f33d4>] __asan_load8+0x64/0x70 [<ffffffff81d99468>] xhci_find_raw_port_number+0x98/0x170 [<ffffffff81db0105>] xhci_setup_addressable_virt_dev+0x235/0xa10 [<ffffffff81d9ea51>] xhci_setup_device+0x3c1/0x1430 [<ffffffff8121cddd>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff81d9fac0>] ? xhci_setup_device+0x1430/0x1430 [<ffffffff81d9fad3>] xhci_address_device+0x13/0x20 [<ffffffff81d2081a>] hub_port_init+0x55a/0x1550 [<ffffffff81d28705>] hub_event+0xef5/0x24d0 [<ffffffff81d27810>] ? hub_port_debounce+0x2f0/0x2f0 [<ffffffff8195e1ee>] ? debug_object_deactivate+0x1be/0x270 [<ffffffff81210203>] ? print_rt_rq+0x53/0x2d0 [<ffffffff8121657d>] ? trace_hardirqs_off+0xd/0x10 [<ffffffff8226acfb>] ? _raw_spin_unlock_irqrestore+0x5b/0x60 [<ffffffff81250000>] ? irq_domain_set_hwirq_and_chip+0x30/0xb0 [<ffffffff81256339>] ? debug_lockdep_rcu_enabled+0x39/0x40 [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 [<ffffffff81196877>] process_one_work+0x567/0xec0 [...] Afterwards, xhci reports some functional errors: xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion code 0x11. xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion code 0x11. usb 4-3: device not accepting address 2, error -22 Fix this by not overwriting the port1 argument in usb_alloc_dev(), but storing the raw port number as required by OF in an additional variable, raw_port. Fixes: 69bec7259853 ("USB: core: let USB device know device node") Signed-off-by: Nicolai Stange <nicstange@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index ffa5cf13ffe1..dcb85e3cd5a7 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -424,6 +424,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_device *dev; struct usb_hcd *usb_hcd = bus_to_hcd(bus); unsigned root_hub = 0; + unsigned raw_port = port1; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) @@ -498,11 +499,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, if (!parent->parent) { /* device under root hub's port */ - port1 = usb_hcd_find_raw_port_number(usb_hcd, + raw_port = usb_hcd_find_raw_port_number(usb_hcd, port1); } dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, - port1); + raw_port); /* hub driver sets up TT records */ } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 14:05 ` Arnd Bergmann @ 2016-03-29 16:37 ` Gregory CLEMENT 2016-03-29 16:49 ` Patrick Uiterwijk 0 siblings, 1 reply; 9+ messages in thread From: Gregory CLEMENT @ 2016-03-29 16:37 UTC (permalink / raw) To: linux-arm-kernel Hi Arnd, On mar., mars 29 2016, Arnd Bergmann <arnd@arndb.de> wrote: > On Tuesday 29 March 2016 13:56:52 Patrick Uiterwijk wrote: >> According to Documentation/devicetree/bindings/usb/ehci-orion.txt, >> the Orion Marvell variant of EHCI controllers should have names >> ehci at 50000 for example. >> >> Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> >> > > I think it's better to follow the generic USB binding that suggests > the name of 'usb', unless we understand what the specific bug is > you run into. Do you think it is the boot loader that messes > up the hardware, or something in the kernel that goes wrong? Did > it work on earlier kernels? > I am pretty sure that this issue is caused by the Marvell U-Boot which tries to modify the dts on the fly. But the device tree reference of this U-boot is not the one we use in mainline, so at end it mess up the dtb! There is an option to ask Marvell bootloader to not modify the dts, I think it is something like ftd_skip. Gregory > We had a regression based on the USB device probing, but that > should be fixed now with the patch below. Do you have that? > > Arnd > > > commit 7222c832254a75dcd67d683df75753d4a4e125bb > Author: Nicolai Stange <nicstange@gmail.com> > Date: Thu Mar 17 23:53:02 2016 +0100 > > usb/core: usb_alloc_dev(): fix setting of ->portnum > > With commit 69bec7259853 ("USB: core: let USB device know device node"), > the port1 argument of usb_alloc_dev() gets overwritten as follows: > > ... usb_alloc_dev(..., unsigned port1) > { > ... > if (!parent->parent) { > port1 = usb_hcd_find_raw_port_number(..., port1); > } > ... > } > > Later on, this now overwritten port1 gets assigned to ->portnum: > > dev->portnum = port1; > > However, since xhci_find_raw_port_number() isn't idempotent, the > aforementioned commit causes a number of KASAN splats like the following: > > BUG: KASAN: slab-out-of-bounds in xhci_find_raw_port_number+0x98/0x170 > at addr ffff8801d9311670 > Read of size 8 by task kworker/2:1/87 > [...] > Workqueue: usb_hub_wq hub_event > 0000000000000188 000000005814b877 ffff8800cba17588 ffffffff8191447e > 0000000041b58ab3 ffffffff82a03209 ffffffff819143a2 ffffffff82a252f4 > ffff8801d93115e0 0000000000000188 ffff8801d9311628 ffff8800cba17588 > Call Trace: > [<ffffffff8191447e>] dump_stack+0xdc/0x15e > [<ffffffff819143a2>] ? _atomic_dec_and_lock+0xa2/0xa2 > [<ffffffff814e2cd1>] ? print_section+0x61/0xb0 > [<ffffffff814e4939>] print_trailer+0x179/0x2c0 > [<ffffffff814f0d84>] object_err+0x34/0x40 > [<ffffffff814f4388>] kasan_report_error+0x2f8/0x8b0 > [<ffffffff814eb91e>] ? __slab_alloc+0x5e/0x90 > [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 > [<ffffffff814f5091>] kasan_report+0x71/0xa0 > [<ffffffff814ec082>] ? kmem_cache_alloc_trace+0x212/0x560 > [<ffffffff81d99468>] ? xhci_find_raw_port_number+0x98/0x170 > [<ffffffff814f33d4>] __asan_load8+0x64/0x70 > [<ffffffff81d99468>] xhci_find_raw_port_number+0x98/0x170 > [<ffffffff81db0105>] xhci_setup_addressable_virt_dev+0x235/0xa10 > [<ffffffff81d9ea51>] xhci_setup_device+0x3c1/0x1430 > [<ffffffff8121cddd>] ? trace_hardirqs_on+0xd/0x10 > [<ffffffff81d9fac0>] ? xhci_setup_device+0x1430/0x1430 > [<ffffffff81d9fad3>] xhci_address_device+0x13/0x20 > [<ffffffff81d2081a>] hub_port_init+0x55a/0x1550 > [<ffffffff81d28705>] hub_event+0xef5/0x24d0 > [<ffffffff81d27810>] ? hub_port_debounce+0x2f0/0x2f0 > [<ffffffff8195e1ee>] ? debug_object_deactivate+0x1be/0x270 > [<ffffffff81210203>] ? print_rt_rq+0x53/0x2d0 > [<ffffffff8121657d>] ? trace_hardirqs_off+0xd/0x10 > [<ffffffff8226acfb>] ? _raw_spin_unlock_irqrestore+0x5b/0x60 > [<ffffffff81250000>] ? irq_domain_set_hwirq_and_chip+0x30/0xb0 > [<ffffffff81256339>] ? debug_lockdep_rcu_enabled+0x39/0x40 > [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 > [<ffffffff81196877>] process_one_work+0x567/0xec0 > [...] > > Afterwards, xhci reports some functional errors: > > xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion > code 0x11. > xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion > code 0x11. > usb 4-3: device not accepting address 2, error -22 > > Fix this by not overwriting the port1 argument in usb_alloc_dev(), but > storing the raw port number as required by OF in an additional variable, > raw_port. > > Fixes: 69bec7259853 ("USB: core: let USB device know device node") > Signed-off-by: Nicolai Stange <nicstange@gmail.com> > Acked-by: Alan Stern <stern@rowland.harvard.edu> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c > index ffa5cf13ffe1..dcb85e3cd5a7 100644 > --- a/drivers/usb/core/usb.c > +++ b/drivers/usb/core/usb.c > @@ -424,6 +424,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, > struct usb_device *dev; > struct usb_hcd *usb_hcd = bus_to_hcd(bus); > unsigned root_hub = 0; > + unsigned raw_port = port1; > > dev = kzalloc(sizeof(*dev), GFP_KERNEL); > if (!dev) > @@ -498,11 +499,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, > > if (!parent->parent) { > /* device under root hub's port */ > - port1 = usb_hcd_find_raw_port_number(usb_hcd, > + raw_port = usb_hcd_find_raw_port_number(usb_hcd, > port1); > } > dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, > - port1); > + raw_port); > > /* hub driver sets up TT records */ > } > -- Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 16:37 ` Gregory CLEMENT @ 2016-03-29 16:49 ` Patrick Uiterwijk 2016-03-29 17:06 ` Thomas Petazzoni 0 siblings, 1 reply; 9+ messages in thread From: Patrick Uiterwijk @ 2016-03-29 16:49 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 29, 2016 at 4:37 PM, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote: > Hi Arnd, > > On mar., mars 29 2016, Arnd Bergmann <arnd@arndb.de> wrote: > >> On Tuesday 29 March 2016 13:56:52 Patrick Uiterwijk wrote: >>> According to Documentation/devicetree/bindings/usb/ehci-orion.txt, >>> the Orion Marvell variant of EHCI controllers should have names >>> ehci at 50000 for example. >>> >>> Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> >>> >> >> I think it's better to follow the generic USB binding that suggests >> the name of 'usb', unless we understand what the specific bug is >> you run into. Do you think it is the boot loader that messes >> up the hardware, or something in the kernel that goes wrong? Did >> it work on earlier kernels? >> > > I am pretty sure that this issue is caused by the Marvell U-Boot which > tries to modify the dts on the fly. But the device tree reference of > this U-boot is not the one we use in mainline, so at end it mess up the > dtb! > > There is an option to ask Marvell bootloader to not modify the dts, I > think it is something like ftd_skip. Thank you for this pointer, setting fdt_skip_update no did fix this issue indeed. That only leaves my second patch as needed, so I'll submit just that separately. Patrick > > Gregory > >> We had a regression based on the USB device probing, but that >> should be fixed now with the patch below. Do you have that? >> >> Arnd >> >> >> commit 7222c832254a75dcd67d683df75753d4a4e125bb >> Author: Nicolai Stange <nicstange@gmail.com> >> Date: Thu Mar 17 23:53:02 2016 +0100 >> >> usb/core: usb_alloc_dev(): fix setting of ->portnum >> >> With commit 69bec7259853 ("USB: core: let USB device know device node"), >> the port1 argument of usb_alloc_dev() gets overwritten as follows: >> >> ... usb_alloc_dev(..., unsigned port1) >> { >> ... >> if (!parent->parent) { >> port1 = usb_hcd_find_raw_port_number(..., port1); >> } >> ... >> } >> >> Later on, this now overwritten port1 gets assigned to ->portnum: >> >> dev->portnum = port1; >> >> However, since xhci_find_raw_port_number() isn't idempotent, the >> aforementioned commit causes a number of KASAN splats like the following: >> >> BUG: KASAN: slab-out-of-bounds in xhci_find_raw_port_number+0x98/0x170 >> at addr ffff8801d9311670 >> Read of size 8 by task kworker/2:1/87 >> [...] >> Workqueue: usb_hub_wq hub_event >> 0000000000000188 000000005814b877 ffff8800cba17588 ffffffff8191447e >> 0000000041b58ab3 ffffffff82a03209 ffffffff819143a2 ffffffff82a252f4 >> ffff8801d93115e0 0000000000000188 ffff8801d9311628 ffff8800cba17588 >> Call Trace: >> [<ffffffff8191447e>] dump_stack+0xdc/0x15e >> [<ffffffff819143a2>] ? _atomic_dec_and_lock+0xa2/0xa2 >> [<ffffffff814e2cd1>] ? print_section+0x61/0xb0 >> [<ffffffff814e4939>] print_trailer+0x179/0x2c0 >> [<ffffffff814f0d84>] object_err+0x34/0x40 >> [<ffffffff814f4388>] kasan_report_error+0x2f8/0x8b0 >> [<ffffffff814eb91e>] ? __slab_alloc+0x5e/0x90 >> [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 >> [<ffffffff814f5091>] kasan_report+0x71/0xa0 >> [<ffffffff814ec082>] ? kmem_cache_alloc_trace+0x212/0x560 >> [<ffffffff81d99468>] ? xhci_find_raw_port_number+0x98/0x170 >> [<ffffffff814f33d4>] __asan_load8+0x64/0x70 >> [<ffffffff81d99468>] xhci_find_raw_port_number+0x98/0x170 >> [<ffffffff81db0105>] xhci_setup_addressable_virt_dev+0x235/0xa10 >> [<ffffffff81d9ea51>] xhci_setup_device+0x3c1/0x1430 >> [<ffffffff8121cddd>] ? trace_hardirqs_on+0xd/0x10 >> [<ffffffff81d9fac0>] ? xhci_setup_device+0x1430/0x1430 >> [<ffffffff81d9fad3>] xhci_address_device+0x13/0x20 >> [<ffffffff81d2081a>] hub_port_init+0x55a/0x1550 >> [<ffffffff81d28705>] hub_event+0xef5/0x24d0 >> [<ffffffff81d27810>] ? hub_port_debounce+0x2f0/0x2f0 >> [<ffffffff8195e1ee>] ? debug_object_deactivate+0x1be/0x270 >> [<ffffffff81210203>] ? print_rt_rq+0x53/0x2d0 >> [<ffffffff8121657d>] ? trace_hardirqs_off+0xd/0x10 >> [<ffffffff8226acfb>] ? _raw_spin_unlock_irqrestore+0x5b/0x60 >> [<ffffffff81250000>] ? irq_domain_set_hwirq_and_chip+0x30/0xb0 >> [<ffffffff81256339>] ? debug_lockdep_rcu_enabled+0x39/0x40 >> [<ffffffff812178c0>] ? __lock_is_held+0x90/0x130 >> [<ffffffff81196877>] process_one_work+0x567/0xec0 >> [...] >> >> Afterwards, xhci reports some functional errors: >> >> xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion >> code 0x11. >> xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion >> code 0x11. >> usb 4-3: device not accepting address 2, error -22 >> >> Fix this by not overwriting the port1 argument in usb_alloc_dev(), but >> storing the raw port number as required by OF in an additional variable, >> raw_port. >> >> Fixes: 69bec7259853 ("USB: core: let USB device know device node") >> Signed-off-by: Nicolai Stange <nicstange@gmail.com> >> Acked-by: Alan Stern <stern@rowland.harvard.edu> >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> >> >> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c >> index ffa5cf13ffe1..dcb85e3cd5a7 100644 >> --- a/drivers/usb/core/usb.c >> +++ b/drivers/usb/core/usb.c >> @@ -424,6 +424,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, >> struct usb_device *dev; >> struct usb_hcd *usb_hcd = bus_to_hcd(bus); >> unsigned root_hub = 0; >> + unsigned raw_port = port1; >> >> dev = kzalloc(sizeof(*dev), GFP_KERNEL); >> if (!dev) >> @@ -498,11 +499,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, >> >> if (!parent->parent) { >> /* device under root hub's port */ >> - port1 = usb_hcd_find_raw_port_number(usb_hcd, >> + raw_port = usb_hcd_find_raw_port_number(usb_hcd, >> port1); >> } >> dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, >> - port1); >> + raw_port); >> >> /* hub driver sets up TT records */ >> } >> > > -- > Gregory Clement, Free Electrons > Kernel, drivers, real-time and embedded Linux > development, consulting, training and support. > http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 16:49 ` Patrick Uiterwijk @ 2016-03-29 17:06 ` Thomas Petazzoni 2016-03-29 17:09 ` Patrick Uiterwijk 0 siblings, 1 reply; 9+ messages in thread From: Thomas Petazzoni @ 2016-03-29 17:06 UTC (permalink / raw) To: linux-arm-kernel Hello, On Tue, 29 Mar 2016 16:49:43 +0000, Patrick Uiterwijk wrote: > Thank you for this pointer, setting fdt_skip_update no did fix this > issue indeed. Hum, what should fix the problem is to set fdt_skip_update to "yes". If you set it to "no", then the Marvell U-Boot will do its funky DTB tweaks which are not necessarily compatible with the mainline kernel DT bindings. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 17:06 ` Thomas Petazzoni @ 2016-03-29 17:09 ` Patrick Uiterwijk 2016-03-29 17:11 ` Thomas Petazzoni 0 siblings, 1 reply; 9+ messages in thread From: Patrick Uiterwijk @ 2016-03-29 17:09 UTC (permalink / raw) To: linux-arm-kernel Hi, On Tue, Mar 29, 2016 at 5:06 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Hello, > > On Tue, 29 Mar 2016 16:49:43 +0000, Patrick Uiterwijk wrote: > >> Thank you for this pointer, setting fdt_skip_update no did fix this >> issue indeed. > > Hum, what should fix the problem is to set fdt_skip_update to "yes". If > you set it to "no", then the Marvell U-Boot will do its funky DTB > tweaks which are not necessarily compatible with the mainline kernel > DT bindings. Correct, I meant setting it to "yes" fixed the problem, sorry for the confusion. Patrick ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ 2016-03-29 17:09 ` Patrick Uiterwijk @ 2016-03-29 17:11 ` Thomas Petazzoni 0 siblings, 0 replies; 9+ messages in thread From: Thomas Petazzoni @ 2016-03-29 17:11 UTC (permalink / raw) To: linux-arm-kernel Hello, On Tue, 29 Mar 2016 17:09:11 +0000, Patrick Uiterwijk wrote: > > On Tue, 29 Mar 2016 16:49:43 +0000, Patrick Uiterwijk wrote: > > > >> Thank you for this pointer, setting fdt_skip_update no did fix this > >> issue indeed. > > > > Hum, what should fix the problem is to set fdt_skip_update to "yes". If > > you set it to "no", then the Marvell U-Boot will do its funky DTB > > tweaks which are not necessarily compatible with the mainline kernel > > DT bindings. > > Correct, I meant setting it to "yes" fixed the problem, sorry for the confusion. Ok, then it makes sense. It's amazing how much weird issues this Marvell U-Boot behavior has caused :-/ Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: mvebu: Correct unit address for linksys 2016-03-29 13:56 [patch] ARM: mvebu: fix usb on Linksys Caiman Patrick Uiterwijk 2016-03-29 13:56 ` [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ Patrick Uiterwijk @ 2016-03-29 13:56 ` Patrick Uiterwijk 1 sibling, 0 replies; 9+ messages in thread From: Patrick Uiterwijk @ 2016-03-29 13:56 UTC (permalink / raw) To: linux-arm-kernel The USB2 port for Armada 38x is defined to be at 58000, not at 50000. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> --- arch/arm/boot/dts/armada-385-linksys.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi b/arch/arm/boot/dts/armada-385-linksys.dtsi index b328d94..94b8b0b 100644 --- a/arch/arm/boot/dts/armada-385-linksys.dtsi +++ b/arch/arm/boot/dts/armada-385-linksys.dtsi @@ -117,7 +117,7 @@ }; /* USB part of the eSATA/USB 2.0 port */ - ehci at 50000 { + ehci at 58000 { status = "okay"; }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-03-29 17:11 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-29 13:56 [patch] ARM: mvebu: fix usb on Linksys Caiman Patrick Uiterwijk 2016-03-29 13:56 ` [PATCH 1/2] ARM: mvebu: correct the usb node name from usb@ to ehci@ Patrick Uiterwijk 2016-03-29 14:05 ` Arnd Bergmann 2016-03-29 16:37 ` Gregory CLEMENT 2016-03-29 16:49 ` Patrick Uiterwijk 2016-03-29 17:06 ` Thomas Petazzoni 2016-03-29 17:09 ` Patrick Uiterwijk 2016-03-29 17:11 ` Thomas Petazzoni 2016-03-29 13:56 ` [PATCH 2/2] ARM: mvebu: Correct unit address for linksys Patrick Uiterwijk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox