linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
@ 2016-03-25 14:46 Peter Griffin
  2016-03-25 16:58 ` Felipe Balbi
  2016-04-11 15:44 ` Peter Griffin
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Griffin @ 2016-03-25 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Otherwise generic-xhci and xhci-platform which have no data get wrongly
detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().

This fixes a regression in v4.5 for STiH407 family SoC's which use the
synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
gets added.

I suspect this will also fix other dwc3 DT platforms such as Exynos,
although I've only tested on STih410 SoC.

Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
Cc: stable at vger.kernel.org
Cc: gregory.clement at free-electrons.com
Cc: yoshihiro.shimoda.uh at renesas.com
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 drivers/usb/host/xhci-plat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 5a2e2e3..529c3c4 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -14,7 +14,7 @@
 #include "xhci.h"	/* for hcd_to_xhci() */
 
 enum xhci_plat_type {
-	XHCI_PLAT_TYPE_MARVELL_ARMADA,
+	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
 	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
 	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-25 14:46 [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value Peter Griffin
@ 2016-03-25 16:58 ` Felipe Balbi
  2016-03-25 17:07   ` Gregory CLEMENT
  2016-04-11 15:44 ` Peter Griffin
  1 sibling, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2016-03-25 16:58 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Peter Griffin <peter.griffin@linaro.org> writes:
> Otherwise generic-xhci and xhci-platform which have no data get wrongly
> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
>
> This fixes a regression in v4.5 for STiH407 family SoC's which use the
> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
> gets added.
>
> I suspect this will also fix other dwc3 DT platforms such as Exynos,
> although I've only tested on STih410 SoC.
>
> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
> Cc: stable at vger.kernel.org
> Cc: gregory.clement at free-electrons.com
> Cc: yoshihiro.shimoda.uh at renesas.com
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
>  drivers/usb/host/xhci-plat.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> index 5a2e2e3..529c3c4 100644
> --- a/drivers/usb/host/xhci-plat.h
> +++ b/drivers/usb/host/xhci-plat.h
> @@ -14,7 +14,7 @@
>  #include "xhci.h"	/* for hcd_to_xhci() */
>  
>  enum xhci_plat_type {
> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,

aren't these platforms using device tree ? Why aren't these just
different compatible strings ?

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160325/9b85bf18/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-25 16:58 ` Felipe Balbi
@ 2016-03-25 17:07   ` Gregory CLEMENT
  2016-03-25 17:44     ` Felipe Balbi
  0 siblings, 1 reply; 12+ messages in thread
From: Gregory CLEMENT @ 2016-03-25 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Felipe,
 
 On ven., mars 25 2016, Felipe Balbi <balbi@kernel.org> wrote:

> Hi,
>
> Peter Griffin <peter.griffin@linaro.org> writes:
>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
>>
>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
>> gets added.
>>
>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
>> although I've only tested on STih410 SoC.
>>
>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
>> Cc: stable at vger.kernel.org
>> Cc: gregory.clement at free-electrons.com
>> Cc: yoshihiro.shimoda.uh at renesas.com
>> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
>> ---
>>  drivers/usb/host/xhci-plat.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
>> index 5a2e2e3..529c3c4 100644
>> --- a/drivers/usb/host/xhci-plat.h
>> +++ b/drivers/usb/host/xhci-plat.h
>> @@ -14,7 +14,7 @@
>>  #include "xhci.h"	/* for hcd_to_xhci() */
>>  
>>  enum xhci_plat_type {
>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
>> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>
> aren't these platforms using device tree ? Why aren't these just
> different compatible strings ?

According to 4efb2f69411456d35051e9047c15157c9a5ba217 "usb: host:
xhci-plat: add struct xhci_plat_priv" :

This patch adds struct xhci_plat_priv to simplify the code to match
platform specific variables. For now, this patch adds a member "type" in
the structure

Gregory


>
> -- 
> balbi

-- 
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] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-25 17:07   ` Gregory CLEMENT
@ 2016-03-25 17:44     ` Felipe Balbi
  2016-03-26  9:10       ` Peter Griffin
  0 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2016-03-25 17:44 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Gregory CLEMENT <gregory.clement@free-electrons.com> writes:
>> Peter Griffin <peter.griffin@linaro.org> writes:
>>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
>>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
>>>
>>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
>>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
>>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
>>> gets added.
>>>
>>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
>>> although I've only tested on STih410 SoC.
>>>
>>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
>>> Cc: stable at vger.kernel.org
>>> Cc: gregory.clement at free-electrons.com
>>> Cc: yoshihiro.shimoda.uh at renesas.com
>>> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
>>> ---
>>>  drivers/usb/host/xhci-plat.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
>>> index 5a2e2e3..529c3c4 100644
>>> --- a/drivers/usb/host/xhci-plat.h
>>> +++ b/drivers/usb/host/xhci-plat.h
>>> @@ -14,7 +14,7 @@
>>>  #include "xhci.h"	/* for hcd_to_xhci() */
>>>  
>>>  enum xhci_plat_type {
>>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
>>> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
>>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>>
>> aren't these platforms using device tree ? Why aren't these just
>> different compatible strings ?
>
> According to 4efb2f69411456d35051e9047c15157c9a5ba217 "usb: host:
> xhci-plat: add struct xhci_plat_priv" :
>
> This patch adds struct xhci_plat_priv to simplify the code to match
> platform specific variables. For now, this patch adds a member "type" in
> the structure

that's fine but the answer doesn't exactly match my question ;-)

My point is that this enum shouldn't be necessary at all. We have
compatible flags to make these checks instead. How about below ?
(untested, uncompiled, yada yada yada). Note that we DON'T need this
xhci_plat_type trickery, just need to be a little bit smarter about how
we use driver_data:

diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 1eefc988192d..1ea6c18b74f3 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -41,8 +41,9 @@ static void xhci_mvebu_mbus_config(void __iomem *base,
 	}
 }
 
-int xhci_mvebu_mbus_init_quirk(struct platform_device *pdev)
+int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
 {
+	struct platform_device *pdev = to_platform_device(hcd->self.controller);
 	struct resource	*res;
 	void __iomem *base;
 	const struct mbus_dram_target_info *dram;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 5c15e9bc5f7a..adb77c60a9ae 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -47,43 +47,56 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
 	xhci->quirks |= XHCI_PLAT;
 }
 
+static void xhci_priv_plat_start(struct usb_hcd *hcd)
+{
+	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+	if (priv->plat_start)
+		priv->plat_start(hcd);
+}
+
+static int xhci_priv_init_quirk(struct usb_hcd *hcd)
+{
+	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+	if (!priv->init_quirk)
+		return 0;
+
+	return priv->init_quirk(hcd);
+}
+
 /* called during probe() after chip reset completes */
 static int xhci_plat_setup(struct usb_hcd *hcd)
 {
 	int ret;
 
-	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
-	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) {
-		ret = xhci_rcar_init_quirk(hcd);
-		if (ret)
-			return ret;
-	}
+	ret = xhci_priv_init_quirk(hcd);
+	if (ret)
+		return ret;
 
 	return xhci_gen_setup(hcd, xhci_plat_quirks);
 }
 
 static int xhci_plat_start(struct usb_hcd *hcd)
 {
-	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
-	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
-		xhci_rcar_start(hcd);
-
+	xhci_priv_plat_start(hcd);
 	return xhci_run(hcd);
 }
 
 #ifdef CONFIG_OF
 static const struct xhci_plat_priv xhci_plat_marvell_armada = {
-	.type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
+	.init_quirk = xhci_mvebu_mbus_init_quirk,
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
-	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
 	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
+	.init_quirk = xhci_rcar_init_quirk,
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
-	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
 	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
+	.init_quirk = xhci_rcar_init_quirk,
+	.plat_start = xhci_rcar_start,
 };
 
 static const struct of_device_id usb_xhci_of_match[] = {
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 5a2e2e3936c4..c4d565980832 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -13,27 +13,13 @@
 
 #include "xhci.h"	/* for hcd_to_xhci() */
 
-enum xhci_plat_type {
-	XHCI_PLAT_TYPE_MARVELL_ARMADA,
-	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
-	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
-};
-
 struct xhci_plat_priv {
 	enum xhci_plat_type type;
 	const char *firmware_name;
+	void (*plat_start)(struct usb_hcd *);
+	int (*init_quirk)(struct usb_hcd *);
 };
 
 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
 
-static inline bool xhci_plat_type_is(struct usb_hcd *hcd,
-				     enum xhci_plat_type type)
-{
-	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
-
-	if (priv && priv->type == type)
-		return true;
-	else
-		return false;
-}
 #endif	/* _XHCI_PLAT_H */

ps: there might be bugs there, but it's a holiday and I really shouldn't
be spending time on this right now ;-)

Anyway, have fun testing. Let me know if it doesn't work.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160325/08411d5c/attachment.sig>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-25 17:44     ` Felipe Balbi
@ 2016-03-26  9:10       ` Peter Griffin
  2016-03-26 10:10         ` Felipe Balbi
  2016-03-28  6:55         ` Yoshihiro Shimoda
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Griffin @ 2016-03-26  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Felipe,

On Fri, 25 Mar 2016, Felipe Balbi wrote:

> 
> Hi,
> 
> Gregory CLEMENT <gregory.clement@free-electrons.com> writes:
> >> Peter Griffin <peter.griffin@linaro.org> writes:
> >>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
> >>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
> >>>
> >>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
> >>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
> >>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
> >>> gets added.
> >>>
> >>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
> >>> although I've only tested on STih410 SoC.
> >>>
> >>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
> >>> Cc: stable at vger.kernel.org
> >>> Cc: gregory.clement at free-electrons.com
> >>> Cc: yoshihiro.shimoda.uh at renesas.com
> >>> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> >>> ---
> >>>  drivers/usb/host/xhci-plat.h | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> >>> index 5a2e2e3..529c3c4 100644
> >>> --- a/drivers/usb/host/xhci-plat.h
> >>> +++ b/drivers/usb/host/xhci-plat.h
> >>> @@ -14,7 +14,7 @@
> >>>  #include "xhci.h"	/* for hcd_to_xhci() */
> >>>  
> >>>  enum xhci_plat_type {
> >>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
> >>> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
> >>
> >> aren't these platforms using device tree ? Why aren't these just
> >> different compatible strings ?
> >
> > According to 4efb2f69411456d35051e9047c15157c9a5ba217 "usb: host:
> > xhci-plat: add struct xhci_plat_priv" :
> >
> > This patch adds struct xhci_plat_priv to simplify the code to match
> > platform specific variables. For now, this patch adds a member "type" in
> > the structure
> 
> that's fine but the answer doesn't exactly match my question ;-)
> 
> My point is that this enum shouldn't be necessary at all. We have
> compatible flags to make these checks instead. How about below ?
> (untested, uncompiled, yada yada yada). Note that we DON'T need this
> xhci_plat_type trickery, just need to be a little bit smarter about how
> we use driver_data:

Your solution certainly looks more elegant.

> 
> diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
> index 1eefc988192d..1ea6c18b74f3 100644
> --- a/drivers/usb/host/xhci-mvebu.c
> +++ b/drivers/usb/host/xhci-mvebu.c
> @@ -41,8 +41,9 @@ static void xhci_mvebu_mbus_config(void __iomem *base,
>  	}
>  }
>  
> -int xhci_mvebu_mbus_init_quirk(struct platform_device *pdev)
> +int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
>  {
> +	struct platform_device *pdev = to_platform_device(hcd->self.controller);
>  	struct resource	*res;
>  	void __iomem *base;
>  	const struct mbus_dram_target_info *dram;
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 5c15e9bc5f7a..adb77c60a9ae 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -47,43 +47,56 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
>  	xhci->quirks |= XHCI_PLAT;
>  }
>  
> +static void xhci_priv_plat_start(struct usb_hcd *hcd)
> +{
> +	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
> +
> +	if (priv->plat_start)
> +		priv->plat_start(hcd);
> +}
> +
> +static int xhci_priv_init_quirk(struct usb_hcd *hcd)
> +{
> +	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
> +
> +	if (!priv->init_quirk)
> +		return 0;
> +
> +	return priv->init_quirk(hcd);
> +}
> +
>  /* called during probe() after chip reset completes */
>  static int xhci_plat_setup(struct usb_hcd *hcd)
>  {
>  	int ret;
>  
> -	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
> -	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) {
> -		ret = xhci_rcar_init_quirk(hcd);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = xhci_priv_init_quirk(hcd);
> +	if (ret)
> +		return ret;
>  
>  	return xhci_gen_setup(hcd, xhci_plat_quirks);
>  }
>  
>  static int xhci_plat_start(struct usb_hcd *hcd)
>  {
> -	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
> -	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
> -		xhci_rcar_start(hcd);
> -
> +	xhci_priv_plat_start(hcd);
>  	return xhci_run(hcd);
>  }
>  
>  #ifdef CONFIG_OF
>  static const struct xhci_plat_priv xhci_plat_marvell_armada = {
> -	.type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
> +	.init_quirk = xhci_mvebu_mbus_init_quirk,
>  };
>  
>  static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
> -	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>  	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
> +	.init_quirk = xhci_rcar_init_quirk,
>  };
>  
>  static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
> -	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>  	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
> +	.init_quirk = xhci_rcar_init_quirk,
> +	.plat_start = xhci_rcar_start,
>  };
>  
>  static const struct of_device_id usb_xhci_of_match[] = {
> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> index 5a2e2e3936c4..c4d565980832 100644
> --- a/drivers/usb/host/xhci-plat.h
> +++ b/drivers/usb/host/xhci-plat.h
> @@ -13,27 +13,13 @@
>  
>  #include "xhci.h"	/* for hcd_to_xhci() */
>  
> -enum xhci_plat_type {
> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
> -	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
> -	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
> -};
> -
>  struct xhci_plat_priv {
>  	enum xhci_plat_type type;
>  	const char *firmware_name;
> +	void (*plat_start)(struct usb_hcd *);
> +	int (*init_quirk)(struct usb_hcd *);
>  };
>  
>  #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
>  
> -static inline bool xhci_plat_type_is(struct usb_hcd *hcd,
> -				     enum xhci_plat_type type)
> -{
> -	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
> -
> -	if (priv && priv->type == type)
> -		return true;
> -	else
> -		return false;
> -}
>  #endif	/* _XHCI_PLAT_H */
> 
> ps: there might be bugs there, but it's a holiday and I really shouldn't
> be spending time on this right now ;-)

I'm also off on holiday now until Sunday 10th April... yay :-)
> 
> Anyway, have fun testing. Let me know if it doesn't work.

I only have access to STi platforms which were broken by this change.
Not any of the platforms which rely on the functionality which
was introduced (although I can't see any reason why your patch wouldn't work).

Maybe Yoshihiro (on CC) could test this on the Renesas platforms and confirm?

regards,

Peter.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-26  9:10       ` Peter Griffin
@ 2016-03-26 10:10         ` Felipe Balbi
  2016-03-29  9:04           ` Lee Jones
  2016-03-28  6:55         ` Yoshihiro Shimoda
  1 sibling, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2016-03-26 10:10 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Peter Griffin <peter.griffin@linaro.org> writes:
> Hi Felipe,
>
> On Fri, 25 Mar 2016, Felipe Balbi wrote:
>
>> 
>> Hi,
>> 
>> Gregory CLEMENT <gregory.clement@free-electrons.com> writes:
>> >> Peter Griffin <peter.griffin@linaro.org> writes:
>> >>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
>> >>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
>> >>>
>> >>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
>> >>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
>> >>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
>> >>> gets added.
>> >>>
>> >>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
>> >>> although I've only tested on STih410 SoC.
>> >>>
>> >>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
>> >>> Cc: stable at vger.kernel.org
>> >>> Cc: gregory.clement at free-electrons.com
>> >>> Cc: yoshihiro.shimoda.uh at renesas.com
>> >>> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
>> >>> ---
>> >>>  drivers/usb/host/xhci-plat.h | 2 +-
>> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>>
>> >>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
>> >>> index 5a2e2e3..529c3c4 100644
>> >>> --- a/drivers/usb/host/xhci-plat.h
>> >>> +++ b/drivers/usb/host/xhci-plat.h
>> >>> @@ -14,7 +14,7 @@
>> >>>  #include "xhci.h"	/* for hcd_to_xhci() */
>> >>>  
>> >>>  enum xhci_plat_type {
>> >>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
>> >>> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
>> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>> >>
>> >> aren't these platforms using device tree ? Why aren't these just
>> >> different compatible strings ?
>> >
>> > According to 4efb2f69411456d35051e9047c15157c9a5ba217 "usb: host:
>> > xhci-plat: add struct xhci_plat_priv" :
>> >
>> > This patch adds struct xhci_plat_priv to simplify the code to match
>> > platform specific variables. For now, this patch adds a member "type" in
>> > the structure
>> 
>> that's fine but the answer doesn't exactly match my question ;-)
>> 
>> My point is that this enum shouldn't be necessary at all. We have
>> compatible flags to make these checks instead. How about below ?
>> (untested, uncompiled, yada yada yada). Note that we DON'T need this
>> xhci_plat_type trickery, just need to be a little bit smarter about how
>> we use driver_data:
>
> Your solution certainly looks more elegant.

cool thanks. Now that I think about this more carefully, we might wanna
take $subject anyway for the -rc and get my version applied for v4.7
merge window. What do you think ?

>> diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
>> index 1eefc988192d..1ea6c18b74f3 100644
>> --- a/drivers/usb/host/xhci-mvebu.c
>> +++ b/drivers/usb/host/xhci-mvebu.c
>> @@ -41,8 +41,9 @@ static void xhci_mvebu_mbus_config(void __iomem *base,
>>  	}
>>  }
>>  
>> -int xhci_mvebu_mbus_init_quirk(struct platform_device *pdev)
>> +int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
>>  {
>> +	struct platform_device *pdev = to_platform_device(hcd->self.controller);
>>  	struct resource	*res;
>>  	void __iomem *base;
>>  	const struct mbus_dram_target_info *dram;
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index 5c15e9bc5f7a..adb77c60a9ae 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -47,43 +47,56 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
>>  	xhci->quirks |= XHCI_PLAT;
>>  }
>>  
>> +static void xhci_priv_plat_start(struct usb_hcd *hcd)
>> +{
>> +	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
>> +
>> +	if (priv->plat_start)
>> +		priv->plat_start(hcd);
>> +}
>> +
>> +static int xhci_priv_init_quirk(struct usb_hcd *hcd)
>> +{
>> +	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
>> +
>> +	if (!priv->init_quirk)
>> +		return 0;
>> +
>> +	return priv->init_quirk(hcd);
>> +}
>> +
>>  /* called during probe() after chip reset completes */
>>  static int xhci_plat_setup(struct usb_hcd *hcd)
>>  {
>>  	int ret;
>>  
>> -	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
>> -	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) {
>> -		ret = xhci_rcar_init_quirk(hcd);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = xhci_priv_init_quirk(hcd);
>> +	if (ret)
>> +		return ret;
>>  
>>  	return xhci_gen_setup(hcd, xhci_plat_quirks);
>>  }
>>  
>>  static int xhci_plat_start(struct usb_hcd *hcd)
>>  {
>> -	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
>> -	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
>> -		xhci_rcar_start(hcd);
>> -
>> +	xhci_priv_plat_start(hcd);
>>  	return xhci_run(hcd);
>>  }
>>  
>>  #ifdef CONFIG_OF
>>  static const struct xhci_plat_priv xhci_plat_marvell_armada = {
>> -	.type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
>> +	.init_quirk = xhci_mvebu_mbus_init_quirk,
>>  };
>>  
>>  static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
>> -	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>>  	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
>> +	.init_quirk = xhci_rcar_init_quirk,
>>  };
>>  
>>  static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
>> -	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>>  	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
>> +	.init_quirk = xhci_rcar_init_quirk,
>> +	.plat_start = xhci_rcar_start,
>>  };
>>  
>>  static const struct of_device_id usb_xhci_of_match[] = {
>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
>> index 5a2e2e3936c4..c4d565980832 100644
>> --- a/drivers/usb/host/xhci-plat.h
>> +++ b/drivers/usb/host/xhci-plat.h
>> @@ -13,27 +13,13 @@
>>  
>>  #include "xhci.h"	/* for hcd_to_xhci() */
>>  
>> -enum xhci_plat_type {
>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
>> -	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
>> -	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
>> -};
>> -
>>  struct xhci_plat_priv {
>>  	enum xhci_plat_type type;
>>  	const char *firmware_name;
>> +	void (*plat_start)(struct usb_hcd *);
>> +	int (*init_quirk)(struct usb_hcd *);
>>  };
>>  
>>  #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
>>  
>> -static inline bool xhci_plat_type_is(struct usb_hcd *hcd,
>> -				     enum xhci_plat_type type)
>> -{
>> -	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
>> -
>> -	if (priv && priv->type == type)
>> -		return true;
>> -	else
>> -		return false;
>> -}
>>  #endif	/* _XHCI_PLAT_H */
>> 
>> ps: there might be bugs there, but it's a holiday and I really shouldn't
>> be spending time on this right now ;-)
>
> I'm also off on holiday now until Sunday 10th April... yay :-)

heh, cool :-)

>> Anyway, have fun testing. Let me know if it doesn't work.
>
> I only have access to STi platforms which were broken by this change.
> Not any of the platforms which rely on the functionality which
> was introduced (although I can't see any reason why your patch wouldn't work).
>
> Maybe Yoshihiro (on CC) could test this on the Renesas platforms and
> confirm?

sure, that would be great; then we avoid further regressions ;-)

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160326/5f3fc385/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-26  9:10       ` Peter Griffin
  2016-03-26 10:10         ` Felipe Balbi
@ 2016-03-28  6:55         ` Yoshihiro Shimoda
  2016-03-28  8:30           ` Felipe Balbi
  1 sibling, 1 reply; 12+ messages in thread
From: Yoshihiro Shimoda @ 2016-03-28  6:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

> Sent: Saturday, March 26, 2016 6:11 PM
< snip >
> > ps: there might be bugs there, but it's a holiday and I really shouldn't
> > be spending time on this right now ;-)
> 
> I'm also off on holiday now until Sunday 10th April... yay :-)
> >
> > Anyway, have fun testing. Let me know if it doesn't work.
> 
> I only have access to STi platforms which were broken by this change.
> Not any of the platforms which rely on the functionality which
> was introduced (although I can't see any reason why your patch wouldn't work).
> 
> Maybe Yoshihiro (on CC) could test this on the Renesas platforms and confirm?

Thank you for sending the email to me on CC.
I tested Felipe's patch on Renesas platfroms (R-Car Gen2 and Gen3) and I fixed the patch like the following.
However, my fixes patch might need to clean the code up more.

Changes from Felipe's patch:
- Change function names of xhci_rcar_init_quirk() to xhci_rcar_setup_quirk()
- Add setup_quirk() member and use it for rcar's function.
- Some minor fixes.

---
diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 1eefc98..1ea6c18 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -41,8 +41,9 @@ static void xhci_mvebu_mbus_config(void __iomem *base,
 	}
 }
 
-int xhci_mvebu_mbus_init_quirk(struct platform_device *pdev)
+int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
 {
+	struct platform_device *pdev = to_platform_device(hcd->self.controller);
 	struct resource	*res;
 	void __iomem *base;
 	const struct mbus_dram_target_info *dram;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index d39d6bf..d28513a 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -47,43 +47,57 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
 	xhci->quirks |= XHCI_PLAT;
 }
 
+static void xhci_priv_plat_start(struct usb_hcd *hcd)
+{
+	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+	if (priv->plat_start)
+		priv->plat_start(hcd);
+}
+
+static int xhci_priv_setup_quirk(struct usb_hcd *hcd)
+{
+	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+	if (!priv->setup_quirk)
+		return 0;
+
+	return priv->setup_quirk(hcd);
+}
+
 /* called during probe() after chip reset completes */
 static int xhci_plat_setup(struct usb_hcd *hcd)
 {
 	int ret;
 
-	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
-	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) {
-		ret = xhci_rcar_init_quirk(hcd);
-		if (ret)
-			return ret;
-	}
+	ret = xhci_priv_setup_quirk(hcd);
+	if (ret)
+		return ret;
 
 	return xhci_gen_setup(hcd, xhci_plat_quirks);
 }
 
 static int xhci_plat_start(struct usb_hcd *hcd)
 {
-	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
-	    xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
-		xhci_rcar_start(hcd);
-
+	xhci_priv_plat_start(hcd);
 	return xhci_run(hcd);
 }
 
 #ifdef CONFIG_OF
 static const struct xhci_plat_priv xhci_plat_marvell_armada = {
-	.type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
+	.init_quirk = xhci_mvebu_mbus_init_quirk,
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
-	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
 	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
+	.setup_quirk = xhci_rcar_setup_quirk,
+	.plat_start = xhci_rcar_start,
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
-	.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
 	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
+	.setup_quirk = xhci_rcar_setup_quirk,
+	.plat_start = xhci_rcar_start,
 };
 
 static const struct of_device_id usb_xhci_of_match[] = {
@@ -119,6 +133,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 {
 	struct device_node	*node = pdev->dev.of_node;
 	struct usb_xhci_pdata	*pdata = dev_get_platdata(&pdev->dev);
+	struct xhci_plat_priv	*priv;
 	const struct of_device_id *match;
 	const struct hc_driver	*driver;
 	struct xhci_hcd		*xhci;
@@ -178,18 +193,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	}
 
 	xhci = hcd_to_xhci(hcd);
+	priv = hcd_to_xhci_priv(hcd);
 	match = of_match_node(usb_xhci_of_match, node);
 	if (match) {
 		const struct xhci_plat_priv *priv_match = match->data;
-		struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
 
 		/* Just copy data for now */
 		if (priv_match)
 			*priv = *priv_match;
 	}
 
-	if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) {
-		ret = xhci_mvebu_mbus_init_quirk(pdev);
+	if (priv->init_quirk) {
+		ret = priv->init_quirk(pdev);
 		if (ret)
 			goto disable_clk;
 	}
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 5a2e2e3..1d86d6d 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -13,27 +13,13 @@
 
 #include "xhci.h"	/* for hcd_to_xhci() */
 
-enum xhci_plat_type {
-	XHCI_PLAT_TYPE_MARVELL_ARMADA,
-	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
-	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
-};
-
 struct xhci_plat_priv {
-	enum xhci_plat_type type;
 	const char *firmware_name;
+	void (*plat_start)(struct usb_hcd *);
+	int (*init_quirk)(struct platform_device *pdev);
+	int (*setup_quirk)(struct usb_hcd *);
 };
 
 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
 
-static inline bool xhci_plat_type_is(struct usb_hcd *hcd,
-				     enum xhci_plat_type type)
-{
-	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
-
-	if (priv && priv->type == type)
-		return true;
-	else
-		return false;
-}
 #endif	/* _XHCI_PLAT_H */
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 623100e..7b2800c 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -81,11 +81,13 @@ void xhci_rcar_start(struct usb_hcd *hcd)
 	u32 temp;
 
 	if (hcd->regs != NULL) {
+		struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
 		/* Interrupt Enable */
 		temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
 		temp |= RCAR_USB3_INT_ENA_VAL;
 		writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
-		if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2))
+		if (!strcmp(priv->firmware_name, XHCI_RCAR_FIRMWARE_NAME_V1))
 			xhci_rcar_start_gen2(hcd);
 	}
 }
@@ -154,7 +156,7 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
 }
 
 /* This function needs to initialize a "phy" of usb before */
-int xhci_rcar_init_quirk(struct usb_hcd *hcd)
+int xhci_rcar_setup_quirk(struct usb_hcd *hcd)
 {
 	/* If hcd->regs is NULL, we don't just call the following function */
 	if (!hcd->regs)
diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h
index 2941a25..05cd539 100644
--- a/drivers/usb/host/xhci-rcar.h
+++ b/drivers/usb/host/xhci-rcar.h
@@ -16,13 +16,13 @@
 
 #if IS_ENABLED(CONFIG_USB_XHCI_RCAR)
 void xhci_rcar_start(struct usb_hcd *hcd);
-int xhci_rcar_init_quirk(struct usb_hcd *hcd);
+int xhci_rcar_setup_quirk(struct usb_hcd *hcd);
 #else
 static inline void xhci_rcar_start(struct usb_hcd *hcd)
 {
 }
 
-static inline int xhci_rcar_init_quirk(struct usb_hcd *hcd)
+static inline int xhci_rcar_setup_quirk(struct usb_hcd *hcd)
 {
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-28  6:55         ` Yoshihiro Shimoda
@ 2016-03-28  8:30           ` Felipe Balbi
  2016-03-28 10:01             ` Yoshihiro Shimoda
  0 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2016-03-28  8:30 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> writes:
>> > ps: there might be bugs there, but it's a holiday and I really shouldn't
>> > be spending time on this right now ;-)
>> 
>> I'm also off on holiday now until Sunday 10th April... yay :-)
>> >
>> > Anyway, have fun testing. Let me know if it doesn't work.
>> 
>> I only have access to STi platforms which were broken by this change.
>> Not any of the platforms which rely on the functionality which
>> was introduced (although I can't see any reason why your patch wouldn't work).
>> 
>> Maybe Yoshihiro (on CC) could test this on the Renesas platforms and confirm?
>
> Thank you for sending the email to me on CC.
>
> I tested Felipe's patch on Renesas platfroms (R-Car Gen2 and Gen3) and
> I fixed the patch like the following.
>
> However, my fixes patch might need to clean the code up more.
>
> Changes from Felipe's patch:
> - Change function names of xhci_rcar_init_quirk() to xhci_rcar_setup_quirk()

I'm not sure renaming that function fits on the same patch ;-) Sounds
like it should be a separate patch altogether. I'll work on this
tomorrow if it's okay for you guys to test on your respective platforms :-)

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160328/a0b9b24b/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-28  8:30           ` Felipe Balbi
@ 2016-03-28 10:01             ` Yoshihiro Shimoda
  0 siblings, 0 replies; 12+ messages in thread
From: Yoshihiro Shimoda @ 2016-03-28 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

> Sent: Monday, March 28, 2016 5:30 PM
> 
> Hi,
> 
> Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> writes:
> >> > ps: there might be bugs there, but it's a holiday and I really shouldn't
> >> > be spending time on this right now ;-)
> >>
> >> I'm also off on holiday now until Sunday 10th April... yay :-)
> >> >
> >> > Anyway, have fun testing. Let me know if it doesn't work.
> >>
> >> I only have access to STi platforms which were broken by this change.
> >> Not any of the platforms which rely on the functionality which
> >> was introduced (although I can't see any reason why your patch wouldn't work).
> >>
> >> Maybe Yoshihiro (on CC) could test this on the Renesas platforms and confirm?
> >
> > Thank you for sending the email to me on CC.
> >
> > I tested Felipe's patch on Renesas platfroms (R-Car Gen2 and Gen3) and
> > I fixed the patch like the following.
> >
> > However, my fixes patch might need to clean the code up more.
> >
> > Changes from Felipe's patch:
> > - Change function names of xhci_rcar_init_quirk() to xhci_rcar_setup_quirk()
> 
> I'm not sure renaming that function fits on the same patch ;-) Sounds
> like it should be a separate patch altogether. I'll work on this
> tomorrow if it's okay for you guys to test on your respective platforms :-)

Thank you for the comment!
I also think it should be separate patch ;)
Also I'm okay to test your patch(es) on my platforms :)

Best regards,
Yoshihiro Shimoda

> --
> balbi

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-26 10:10         ` Felipe Balbi
@ 2016-03-29  9:04           ` Lee Jones
  0 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2016-03-29  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 26 Mar 2016, Felipe Balbi wrote:
> Peter Griffin <peter.griffin@linaro.org> writes:
> > On Fri, 25 Mar 2016, Felipe Balbi wrote:
> >> Gregory CLEMENT <gregory.clement@free-electrons.com> writes:
> >> >> Peter Griffin <peter.griffin@linaro.org> writes:
> >> >>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
> >> >>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
> >> >>>
> >> >>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
> >> >>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
> >> >>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
> >> >>> gets added.
> >> >>>
> >> >>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
> >> >>> although I've only tested on STih410 SoC.
> >> >>>
> >> >>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
> >> >>> Cc: stable at vger.kernel.org
> >> >>> Cc: gregory.clement at free-electrons.com
> >> >>> Cc: yoshihiro.shimoda.uh at renesas.com
> >> >>> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> >> >>> ---
> >> >>>  drivers/usb/host/xhci-plat.h | 2 +-
> >> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >>>
> >> >>> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> >> >>> index 5a2e2e3..529c3c4 100644
> >> >>> --- a/drivers/usb/host/xhci-plat.h
> >> >>> +++ b/drivers/usb/host/xhci-plat.h
> >> >>> @@ -14,7 +14,7 @@
> >> >>>  #include "xhci.h"	/* for hcd_to_xhci() */
> >> >>>  
> >> >>>  enum xhci_plat_type {
> >> >>> -	XHCI_PLAT_TYPE_MARVELL_ARMADA,
> >> >>> +	XHCI_PLAT_TYPE_MARVELL_ARMADA = 1,
> >> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
> >> >>>  	XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
> >> >>
> >> >> aren't these platforms using device tree ? Why aren't these just
> >> >> different compatible strings ?
> >> >
> >> > According to 4efb2f69411456d35051e9047c15157c9a5ba217 "usb: host:
> >> > xhci-plat: add struct xhci_plat_priv" :
> >> >
> >> > This patch adds struct xhci_plat_priv to simplify the code to match
> >> > platform specific variables. For now, this patch adds a member "type" in
> >> > the structure
> >> 
> >> that's fine but the answer doesn't exactly match my question ;-)
> >> 
> >> My point is that this enum shouldn't be necessary at all. We have
> >> compatible flags to make these checks instead. How about below ?
> >> (untested, uncompiled, yada yada yada). Note that we DON'T need this
> >> xhci_plat_type trickery, just need to be a little bit smarter about how
> >> we use driver_data:
> >
> > Your solution certainly looks more elegant.
> 
> cool thanks. Now that I think about this more carefully, we might wanna
> take $subject anyway for the -rc and get my version applied for v4.7
> merge window. What do you think ?

+1 for a simple/quick fix.

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-03-25 14:46 [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value Peter Griffin
  2016-03-25 16:58 ` Felipe Balbi
@ 2016-04-11 15:44 ` Peter Griffin
  2016-04-13 17:00   ` Mathias Nyman
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Griffin @ 2016-04-11 15:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mathias,

On Fri, 25 Mar 2016, Peter Griffin wrote:

> Otherwise generic-xhci and xhci-platform which have no data get wrongly
> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
> 
> This fixes a regression in v4.5 for STiH407 family SoC's which use the
> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
> gets added.
> 
> I suspect this will also fix other dwc3 DT platforms such as Exynos,
> although I've only tested on STih410 SoC.
> 
> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")

Can you take this 1 charcter fix for the next -rc?

It fixes a regression introduced in commit 4efb2f694114 for usb3 for some
DT platforms.

Then Felipes series which re-works this code will hopefully be merged in the
next merge window.

regards,

Peter.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
  2016-04-11 15:44 ` Peter Griffin
@ 2016-04-13 17:00   ` Mathias Nyman
  0 siblings, 0 replies; 12+ messages in thread
From: Mathias Nyman @ 2016-04-13 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 11.04.2016 18:44, Peter Griffin wrote:
> Hi Mathias,
>
> On Fri, 25 Mar 2016, Peter Griffin wrote:
>
>> Otherwise generic-xhci and xhci-platform which have no data get wrongly
>> detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().
>>
>> This fixes a regression in v4.5 for STiH407 family SoC's which use the
>> synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
>> wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
>> gets added.
>>
>> I suspect this will also fix other dwc3 DT platforms such as Exynos,
>> although I've only tested on STih410 SoC.
>>
>> Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
>
> Can you take this 1 charcter fix for the next -rc?
>

added to my tree and sent forward to Greg

-Mathias

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-13 17:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 14:46 [PATCH] usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value Peter Griffin
2016-03-25 16:58 ` Felipe Balbi
2016-03-25 17:07   ` Gregory CLEMENT
2016-03-25 17:44     ` Felipe Balbi
2016-03-26  9:10       ` Peter Griffin
2016-03-26 10:10         ` Felipe Balbi
2016-03-29  9:04           ` Lee Jones
2016-03-28  6:55         ` Yoshihiro Shimoda
2016-03-28  8:30           ` Felipe Balbi
2016-03-28 10:01             ` Yoshihiro Shimoda
2016-04-11 15:44 ` Peter Griffin
2016-04-13 17:00   ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).