2296900e318123005229fa1f248eb08edaa5350c
[openwrt/staging/yousong.git] / target / linux / mvebu / patches-3.18 / 210-xhci_move_marvell_quirks.patch
1 From 1e7e4fb66489cc84366656ca5318f1cb61afd4ba Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime.ripard@free-electrons.com>
3 Date: Tue, 24 Feb 2015 18:27:00 +0200
4 Subject: usb: XHCI: platform: Move the Marvell quirks after the enabling the
5 clocks
6
7 The commit 973747928514 ("usb: host: xhci-plat: add support for the Armada
8 375/38x XHCI controllers") extended the xhci-plat driver to support the Armada
9 375/38x SoCs, mostly by adding a quirk configuring the MBUS window.
10
11 However, that quirk was run before the clock the controllers needs has been
12 enabled. This usually worked because the clock was first enabled by the
13 bootloader, and left as such until the driver is probe, where it tries to
14 access the MBUS configuration registers before enabling the clock.
15
16 Things get messy when EPROBE_DEFER is involved during the probe, since as part
17 of its error path, the driver will rightfully disable the clock. When the
18 driver will be reprobed, it will retry to access the MBUS registers, but this
19 time with the clock disabled, which hangs forever.
20
21 Fix this by running the quirks after the clock has been enabled by the driver.
22
23 Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
24 Cc: <stable@vger.kernel.org> # v3.16+
25 Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 --- a/drivers/usb/host/xhci-plat.c
29 +++ b/drivers/usb/host/xhci-plat.c
30 @@ -87,15 +87,6 @@ static int xhci_plat_probe(struct platfo
31 if (!res)
32 return -ENODEV;
33
34 - if (of_device_is_compatible(pdev->dev.of_node,
35 - "marvell,armada-375-xhci") ||
36 - of_device_is_compatible(pdev->dev.of_node,
37 - "marvell,armada-380-xhci")) {
38 - ret = xhci_mvebu_mbus_init_quirk(pdev);
39 - if (ret)
40 - return ret;
41 - }
42 -
43 /* Initialize dma_mask and coherent_dma_mask to 32-bits */
44 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
45 if (ret)
46 @@ -129,6 +120,15 @@ static int xhci_plat_probe(struct platfo
47 goto put_hcd;
48 }
49
50 + if (of_device_is_compatible(pdev->dev.of_node,
51 + "marvell,armada-375-xhci") ||
52 + of_device_is_compatible(pdev->dev.of_node,
53 + "marvell,armada-380-xhci")) {
54 + ret = xhci_mvebu_mbus_init_quirk(pdev);
55 + if (ret)
56 + return ret;
57 + }
58 +
59 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
60 if (ret)
61 goto disable_clk;