[PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-24 Thread Mathias Nyman
From: Maxime Ripard maxime.rip...@free-electrons.com

The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
375/38x XHCI controllers) extended the xhci-plat driver to support the Armada
375/38x SoCs, mostly by adding a quirk configuring the MBUS window.

However, that quirk was run before the clock the controllers needs has been
enabled. This usually worked because the clock was first enabled by the
bootloader, and left as such until the driver is probe, where it tries to
access the MBUS configuration registers before enabling the clock.

Things get messy when EPROBE_DEFER is involved during the probe, since as part
of its error path, the driver will rightfully disable the clock. When the
driver will be reprobed, it will retry to access the MBUS registers, but this
time with the clock disabled, which hangs forever.

Fix this by running the quirks after the clock has been enabled by the driver.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
Cc: sta...@vger.kernel.org # v3.16+
Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
---
 drivers/usb/host/xhci-plat.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 08d402b..0e11d61 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -83,16 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (irq  0)
return -ENODEV;
 
-
-   if (of_device_is_compatible(pdev-dev.of_node,
-   marvell,armada-375-xhci) ||
-   of_device_is_compatible(pdev-dev.of_node,
-   marvell,armada-380-xhci)) {
-   ret = xhci_mvebu_mbus_init_quirk(pdev);
-   if (ret)
-   return ret;
-   }
-
/* Initialize dma_mask and coherent_dma_mask to 32-bits */
ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
if (ret)
@@ -127,6 +117,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_hcd;
}
 
+   if (of_device_is_compatible(pdev-dev.of_node,
+   marvell,armada-375-xhci) ||
+   of_device_is_compatible(pdev-dev.of_node,
+   marvell,armada-380-xhci)) {
+   ret = xhci_mvebu_mbus_init_quirk(pdev);
+   if (ret)
+   goto disable_clk;
+   }
+
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret)
goto disable_clk;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-16 Thread Mathias Nyman
On 09.02.2015 10:31, Greg Kroah-Hartman wrote:
 On Mon, Feb 09, 2015 at 09:22:50AM +0100, Maxime Ripard wrote:
 On Wed, Feb 04, 2015 at 05:04:18AM -0800, Greg Kroah-Hartman wrote:
 On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote:
 Hi Mathias, Greg,

 On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote:
 The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
 375/38x XHCI controllers) extended the xhci-plat driver to support the 
 Armada
 375/38x SoCs, mostly by adding a quirk configuring the MBUS window.

 However, that quirk was run before the clock the controllers needs has 
 been
 enabled. This usually worked because the clock was first enabled by the
 bootloader, and left as such until the driver is probe, where it tries to
 access the MBUS configuration registers before enabling the clock.

 Things get messy when EPROBE_DEFER is involved during the probe, since as 
 part
 of its error path, the driver will rightfully disable the clock. When the
 driver will be reprobed, it will retry to access the MBUS registers, but 
 this
 time with the clock disabled, which hangs forever.

 Fix this by running the quirks after the clock has been enabled by the 
 driver.

 Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
 Cc: sta...@vger.kernel.org # v3.16+

 Any chance for this to go in 3.19?

 For 3.19?  It's too late, I'm not sending anything else to Linus as 3.19
 will be out in a few days.

 Ok. I'll resend it when 3.20-rc1 is out then.
 
 Why resend?  Mathias should be queueing this up properly.  Mathias?
 

Yep, I'll send it forward to Greg once 3.20-rc1 is tagged

-Mathias

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-09 Thread Maxime Ripard
On Wed, Feb 04, 2015 at 05:04:18AM -0800, Greg Kroah-Hartman wrote:
 On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote:
  Hi Mathias, Greg,
  
  On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote:
   The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
   375/38x XHCI controllers) extended the xhci-plat driver to support the 
   Armada
   375/38x SoCs, mostly by adding a quirk configuring the MBUS window.
   
   However, that quirk was run before the clock the controllers needs has 
   been
   enabled. This usually worked because the clock was first enabled by the
   bootloader, and left as such until the driver is probe, where it tries to
   access the MBUS configuration registers before enabling the clock.
   
   Things get messy when EPROBE_DEFER is involved during the probe, since as 
   part
   of its error path, the driver will rightfully disable the clock. When the
   driver will be reprobed, it will retry to access the MBUS registers, but 
   this
   time with the clock disabled, which hangs forever.
   
   Fix this by running the quirks after the clock has been enabled by the 
   driver.
   
   Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
   Cc: sta...@vger.kernel.org # v3.16+
  
  Any chance for this to go in 3.19?
 
 For 3.19?  It's too late, I'm not sending anything else to Linus as 3.19
 will be out in a few days.

Ok. I'll resend it when 3.20-rc1 is out then.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-09 Thread Greg Kroah-Hartman
On Mon, Feb 09, 2015 at 09:22:50AM +0100, Maxime Ripard wrote:
 On Wed, Feb 04, 2015 at 05:04:18AM -0800, Greg Kroah-Hartman wrote:
  On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote:
   Hi Mathias, Greg,
   
   On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote:
The commit 973747928514 (usb: host: xhci-plat: add support for the 
Armada
375/38x XHCI controllers) extended the xhci-plat driver to support the 
Armada
375/38x SoCs, mostly by adding a quirk configuring the MBUS window.

However, that quirk was run before the clock the controllers needs has 
been
enabled. This usually worked because the clock was first enabled by the
bootloader, and left as such until the driver is probe, where it tries 
to
access the MBUS configuration registers before enabling the clock.

Things get messy when EPROBE_DEFER is involved during the probe, since 
as part
of its error path, the driver will rightfully disable the clock. When 
the
driver will be reprobed, it will retry to access the MBUS registers, 
but this
time with the clock disabled, which hangs forever.

Fix this by running the quirks after the clock has been enabled by the 
driver.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
Cc: sta...@vger.kernel.org # v3.16+
   
   Any chance for this to go in 3.19?
  
  For 3.19?  It's too late, I'm not sending anything else to Linus as 3.19
  will be out in a few days.
 
 Ok. I'll resend it when 3.20-rc1 is out then.

Why resend?  Mathias should be queueing this up properly.  Mathias?

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-04 Thread Maxime Ripard
Hi Mathias, Greg,

On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote:
 The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
 375/38x XHCI controllers) extended the xhci-plat driver to support the Armada
 375/38x SoCs, mostly by adding a quirk configuring the MBUS window.
 
 However, that quirk was run before the clock the controllers needs has been
 enabled. This usually worked because the clock was first enabled by the
 bootloader, and left as such until the driver is probe, where it tries to
 access the MBUS configuration registers before enabling the clock.
 
 Things get messy when EPROBE_DEFER is involved during the probe, since as part
 of its error path, the driver will rightfully disable the clock. When the
 driver will be reprobed, it will retry to access the MBUS registers, but this
 time with the clock disabled, which hangs forever.
 
 Fix this by running the quirks after the clock has been enabled by the driver.
 
 Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
 Cc: sta...@vger.kernel.org # v3.16+

Any chance for this to go in 3.19?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-02-04 Thread Greg Kroah-Hartman
On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote:
 Hi Mathias, Greg,
 
 On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote:
  The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
  375/38x XHCI controllers) extended the xhci-plat driver to support the 
  Armada
  375/38x SoCs, mostly by adding a quirk configuring the MBUS window.
  
  However, that quirk was run before the clock the controllers needs has been
  enabled. This usually worked because the clock was first enabled by the
  bootloader, and left as such until the driver is probe, where it tries to
  access the MBUS configuration registers before enabling the clock.
  
  Things get messy when EPROBE_DEFER is involved during the probe, since as 
  part
  of its error path, the driver will rightfully disable the clock. When the
  driver will be reprobed, it will retry to access the MBUS registers, but 
  this
  time with the clock disabled, which hangs forever.
  
  Fix this by running the quirks after the clock has been enabled by the 
  driver.
  
  Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
  Cc: sta...@vger.kernel.org # v3.16+
 
 Any chance for this to go in 3.19?

For 3.19?  It's too late, I'm not sending anything else to Linus as 3.19
will be out in a few days.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

2015-01-19 Thread Maxime Ripard
The commit 973747928514 (usb: host: xhci-plat: add support for the Armada
375/38x XHCI controllers) extended the xhci-plat driver to support the Armada
375/38x SoCs, mostly by adding a quirk configuring the MBUS window.

However, that quirk was run before the clock the controllers needs has been
enabled. This usually worked because the clock was first enabled by the
bootloader, and left as such until the driver is probe, where it tries to
access the MBUS configuration registers before enabling the clock.

Things get messy when EPROBE_DEFER is involved during the probe, since as part
of its error path, the driver will rightfully disable the clock. When the
driver will be reprobed, it will retry to access the MBUS registers, but this
time with the clock disabled, which hangs forever.

Fix this by running the quirks after the clock has been enabled by the driver.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
Cc: sta...@vger.kernel.org # v3.16+
---
 drivers/usb/host/xhci-plat.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 08d402b15482..0e11d61408ff 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -83,16 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (irq  0)
return -ENODEV;
 
-
-   if (of_device_is_compatible(pdev-dev.of_node,
-   marvell,armada-375-xhci) ||
-   of_device_is_compatible(pdev-dev.of_node,
-   marvell,armada-380-xhci)) {
-   ret = xhci_mvebu_mbus_init_quirk(pdev);
-   if (ret)
-   return ret;
-   }
-
/* Initialize dma_mask and coherent_dma_mask to 32-bits */
ret = dma_set_coherent_mask(pdev-dev, DMA_BIT_MASK(32));
if (ret)
@@ -127,6 +117,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_hcd;
}
 
+   if (of_device_is_compatible(pdev-dev.of_node,
+   marvell,armada-375-xhci) ||
+   of_device_is_compatible(pdev-dev.of_node,
+   marvell,armada-380-xhci)) {
+   ret = xhci_mvebu_mbus_init_quirk(pdev);
+   if (ret)
+   goto disable_clk;
+   }
+
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret)
goto disable_clk;
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html