Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1199206 > unrolled thread

[PATCH] usb: ehci-platform: Fix using multiple controllers from OF

Started byAlban Bedel <albeu@free.fr>
First post2015-08-03 21:20 +0200
Last post2015-08-03 21:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: ehci-platform: Fix using multiple controllers from OF Alban Bedel <albeu@free.fr> - 2015-08-03 21:20 +0200
    Re: [PATCH] usb: ehci-platform: Fix using multiple controllers from  OF Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-08-03 21:30 +0200
    Re: [PATCH] usb: ehci-platform: Fix using multiple controllers from  OF Alan Stern <stern@rowland.harvard.edu> - 2015-08-03 21:40 +0200

#1199206 — [PATCH] usb: ehci-platform: Fix using multiple controllers from OF

FromAlban Bedel <albeu@free.fr>
Date2015-08-03 21:20 +0200
Subject[PATCH] usb: ehci-platform: Fix using multiple controllers from OF
Message-ID<pTtrc-3P6-11@gated-at.bofh.it>
When using OF defined controllers the platform data struct is shared
between all devices, so it can't be used for device specific settings.
However it is currently used for the OF properties
needs-reset-on-resume and has-transaction-translator.

To fix this issue move setting hcd->has_tt to the probe and
move pdata->reset_on_resume to the private data.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
 drivers/usb/host/ehci-platform.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 2593def..40d029e 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -45,6 +45,7 @@ struct ehci_platform_priv {
 	struct reset_control *rst;
 	struct phy **phys;
 	int num_phys;
+	bool reset_on_resume;
 };
 
 static const char hcd_name[] = "ehci-platform";
@@ -56,7 +57,6 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 	int retval;
 
-	hcd->has_tt = pdata->has_tt;
 	ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
 
 	if (pdata->pre_setup) {
@@ -193,11 +193,11 @@ static int ehci_platform_probe(struct platform_device *dev)
 
 		if (of_property_read_bool(dev->dev.of_node,
 					  "needs-reset-on-resume"))
-			pdata->reset_on_resume = 1;
+			priv->reset_on_resume = 1;
 
 		if (of_property_read_bool(dev->dev.of_node,
 					  "has-transaction-translator"))
-			pdata->has_tt = 1;
+			hcd->has_tt = 1;
 
 		priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
 				"phys", "#phy-cells");
@@ -247,6 +247,10 @@ static int ehci_platform_probe(struct platform_device *dev)
 		ehci->big_endian_desc = 1;
 	if (pdata->big_endian_mmio)
 		ehci->big_endian_mmio = 1;
+	if (pdata->has_tt)
+		hcd->has_tt = 1;
+	if (pdata->reset_on_resume)
+		priv->reset_on_resume = true;
 
 #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
 	if (ehci->big_endian_mmio) {
@@ -359,6 +363,7 @@ static int ehci_platform_resume(struct device *dev)
 	struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
 	struct platform_device *pdev =
 		container_of(dev, struct platform_device, dev);
+	struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
 
 	if (pdata->power_on) {
 		int err = pdata->power_on(pdev);
@@ -366,7 +371,7 @@ static int ehci_platform_resume(struct device *dev)
 			return err;
 	}
 
-	ehci_resume(hcd, pdata->reset_on_resume);
+	ehci_resume(hcd, priv->reset_on_resume);
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1199211 — Re: [PATCH] usb: ehci-platform: Fix using multiple controllers from OF

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-08-03 21:30 +0200
SubjectRe: [PATCH] usb: ehci-platform: Fix using multiple controllers from OF
Message-ID<pTtAS-40w-3@gated-at.bofh.it>
In reply to#1199206
On 08/03/2015 10:12 PM, Alban Bedel wrote:

> When using OF defined controllers the platform data struct is shared
> between all devices, so it can't be used for device specific settings.
> However it is currently used for the OF properties
> needs-reset-on-resume and has-transaction-translator.

> To fix this issue move setting hcd->has_tt to the probe and
> move pdata->reset_on_resume to the private data.

> Signed-off-by: Alban Bedel <albeu@free.fr>
> ---
>   drivers/usb/host/ehci-platform.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)

> diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
> index 2593def..40d029e 100644
> --- a/drivers/usb/host/ehci-platform.c
> +++ b/drivers/usb/host/ehci-platform.c
> @@ -45,6 +45,7 @@ struct ehci_platform_priv {
>   	struct reset_control *rst;
>   	struct phy **phys;
>   	int num_phys;
> +	bool reset_on_resume;
>   };
>
>   static const char hcd_name[] = "ehci-platform";
[...]
> @@ -193,11 +193,11 @@ static int ehci_platform_probe(struct platform_device *dev)
>
>   		if (of_property_read_bool(dev->dev.of_node,
>   					  "needs-reset-on-resume"))
> -			pdata->reset_on_resume = 1;
> +			priv->reset_on_resume = 1;

    'true' since the typi is 'bool'.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1199221 — Re: [PATCH] usb: ehci-platform: Fix using multiple controllers from OF

FromAlan Stern <stern@rowland.harvard.edu>
Date2015-08-03 21:40 +0200
SubjectRe: [PATCH] usb: ehci-platform: Fix using multiple controllers from OF
Message-ID<pTtKx-4bA-5@gated-at.bofh.it>
In reply to#1199206
On Mon, 3 Aug 2015, Alban Bedel wrote:

> When using OF defined controllers the platform data struct is shared
> between all devices, so it can't be used for device specific settings.
> However it is currently used for the OF properties
> needs-reset-on-resume and has-transaction-translator.
> 
> To fix this issue move setting hcd->has_tt to the probe and
> move pdata->reset_on_resume to the private data.
> 
> Signed-off-by: Alban Bedel <albeu@free.fr>

That's a subtle problem and a good call on your part.

Acked-by: Alan Stern <stern@rowland.harvard.edu>

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web