Browse Source

usb: ehci-platform: Fix using multiple controllers from OF

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alban Bedel 10 năm trước cách đây
mục cha
commit
b4629a7bdf
1 tập tin đã thay đổi với 9 bổ sung4 xóa
  1. 9 4
      drivers/usb/host/ehci-platform.c

+ 9 - 4
drivers/usb/host/ehci-platform.c

@@ -45,6 +45,7 @@ struct ehci_platform_priv {
 	struct reset_control *rst;
 	struct reset_control *rst;
 	struct phy **phys;
 	struct phy **phys;
 	int num_phys;
 	int num_phys;
+	bool reset_on_resume;
 };
 };
 
 
 static const char hcd_name[] = "ehci-platform";
 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);
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 	int retval;
 	int retval;
 
 
-	hcd->has_tt = pdata->has_tt;
 	ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
 	ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
 
 
 	if (pdata->pre_setup) {
 	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,
 		if (of_property_read_bool(dev->dev.of_node,
 					  "needs-reset-on-resume"))
 					  "needs-reset-on-resume"))
-			pdata->reset_on_resume = 1;
+			priv->reset_on_resume = true;
 
 
 		if (of_property_read_bool(dev->dev.of_node,
 		if (of_property_read_bool(dev->dev.of_node,
 					  "has-transaction-translator"))
 					  "has-transaction-translator"))
-			pdata->has_tt = 1;
+			hcd->has_tt = 1;
 
 
 		priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
 		priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
 				"phys", "#phy-cells");
 				"phys", "#phy-cells");
@@ -247,6 +247,10 @@ static int ehci_platform_probe(struct platform_device *dev)
 		ehci->big_endian_desc = 1;
 		ehci->big_endian_desc = 1;
 	if (pdata->big_endian_mmio)
 	if (pdata->big_endian_mmio)
 		ehci->big_endian_mmio = 1;
 		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
 #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
 	if (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 usb_ehci_pdata *pdata = dev_get_platdata(dev);
 	struct platform_device *pdev =
 	struct platform_device *pdev =
 		container_of(dev, struct platform_device, dev);
 		container_of(dev, struct platform_device, dev);
+	struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
 
 
 	if (pdata->power_on) {
 	if (pdata->power_on) {
 		int err = pdata->power_on(pdev);
 		int err = pdata->power_on(pdev);
@@ -366,7 +371,7 @@ static int ehci_platform_resume(struct device *dev)
 			return err;
 			return err;
 	}
 	}
 
 
-	ehci_resume(hcd, pdata->reset_on_resume);
+	ehci_resume(hcd, priv->reset_on_resume);
 	return 0;
 	return 0;
 }
 }
 #endif /* CONFIG_PM_SLEEP */
 #endif /* CONFIG_PM_SLEEP */