linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3] usb: host: xhci-plat: Iterate over parent nodes for finding quirks
@ 2018-08-06 13:04 Anurag Kumar Vulisha
  0 siblings, 0 replies; 3+ messages in thread
From: Anurag Kumar Vulisha @ 2018-08-06 13:04 UTC (permalink / raw)
  To: mathias.nyman, gregkh
  Cc: v.anuragkumar, linux-usb, linux-kernel, Anurag Kumar Vulisha

In xhci_plat_probe() both sysdev and pdev->dev are being used
for finding quirks. There are some drivers(like dwc3 host.c)
which adds quirks(like usb3-lpm-capable) into pdev and the logic
present in xhci_plat_probe() checks for quirks in either sysdev
or pdev for finding the quirks. Because of this logic, some of
the quirks are getting missed(usb3-lpm-capable quirk added by dwc3
host.c driver is getting missed).This patch fixes this by iterating
over all the available parents for finding the quirks. In this way
all the quirks which are present in child or parent are correctly
updated.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
---
 Changes in v3:
	1. As Mathias suggested, moved the position of reading devicetree
	   property "imod-interval-ns" into for loop

 Changes in v2:
	1. As suggested by Mathias, restoring immod_interval changes to
	   default
---
 drivers/usb/host/xhci-plat.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c1b22fc..b5a14ca 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -152,7 +152,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 {
 	const struct xhci_plat_priv *priv_match;
 	const struct hc_driver	*driver;
-	struct device		*sysdev;
+	struct device		*sysdev, *tmpdev;
 	struct xhci_hcd		*xhci;
 	struct resource         *res;
 	struct usb_hcd		*hcd;
@@ -272,19 +272,24 @@ static int xhci_plat_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	if (device_property_read_bool(sysdev, "usb2-lpm-disable"))
-		xhci->quirks |= XHCI_HW_LPM_DISABLE;
+	/* imod_interval is the interrupt moderation value in nanoseconds. */
+	xhci->imod_interval = 40000;
 
-	if (device_property_read_bool(sysdev, "usb3-lpm-capable"))
-		xhci->quirks |= XHCI_LPM_SUPPORT;
+	/* Iterate over all parent nodes for finding quirks */
+	for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) {
 
-	if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
-		xhci->quirks |= XHCI_BROKEN_PORT_PED;
+		if (device_property_read_bool(tmpdev, "usb2-lpm-disable"))
+			xhci->quirks |= XHCI_HW_LPM_DISABLE;
 
-	/* imod_interval is the interrupt moderation value in nanoseconds. */
-	xhci->imod_interval = 40000;
-	device_property_read_u32(sysdev, "imod-interval-ns",
-				 &xhci->imod_interval);
+		if (device_property_read_bool(tmpdev, "usb3-lpm-capable"))
+			xhci->quirks |= XHCI_LPM_SUPPORT;
+
+		if (device_property_read_bool(tmpdev, "quirk-broken-port-ped"))
+			xhci->quirks |= XHCI_BROKEN_PORT_PED;
+
+		device_property_read_u32(tmpdev, "imod-interval-ns",
+					 &xhci->imod_interval);
+	}
 
 	hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
 	if (IS_ERR(hcd->usb_phy)) {

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

* [v3] usb: host: xhci-plat: Iterate over parent nodes for finding quirks
@ 2018-08-06 13:58 Mathias Nyman
  0 siblings, 0 replies; 3+ messages in thread
From: Mathias Nyman @ 2018-08-06 13:58 UTC (permalink / raw)
  To: Anurag Kumar Vulisha, mathias.nyman, gregkh
  Cc: v.anuragkumar, linux-usb, linux-kernel

On 06.08.2018 16:04, Anurag Kumar Vulisha wrote:
> In xhci_plat_probe() both sysdev and pdev->dev are being used
> for finding quirks. There are some drivers(like dwc3 host.c)
> which adds quirks(like usb3-lpm-capable) into pdev and the logic
> present in xhci_plat_probe() checks for quirks in either sysdev
> or pdev for finding the quirks. Because of this logic, some of
> the quirks are getting missed(usb3-lpm-capable quirk added by dwc3
> host.c driver is getting missed).This patch fixes this by iterating
> over all the available parents for finding the quirks. In this way
> all the quirks which are present in child or parent are correctly
> updated.
> 
> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
> ---
>   Changes in v3:
> 	1. As Mathias suggested, moved the position of reading devicetree
> 	   property "imod-interval-ns" into for loop
> 
>   Changes in v2:
> 	1. As suggested by Mathias, restoring immod_interval changes to
> 	   default
> ---

Thanks, adding to queue

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

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

* [v3] usb: host: xhci-plat: Iterate over parent nodes for finding quirks
@ 2018-08-06 14:05 Anurag Kumar Vulisha
  0 siblings, 0 replies; 3+ messages in thread
From: Anurag Kumar Vulisha @ 2018-08-06 14:05 UTC (permalink / raw)
  To: Mathias Nyman, mathias.nyman@intel.com,
	gregkh@linuxfoundation.org
  Cc: v.anuragkumar@gmail.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

DQo+PiBTaWduZWQtb2ZmLWJ5OiBBbnVyYWcgS3VtYXIgVnVsaXNoYSA8YW51cmFnLmt1bWFyLnZ1
bGlzaGFAeGlsaW54LmNvbT4NCj4+IC0tLQ0KPj4gICBDaGFuZ2VzIGluIHYzOg0KPj4gCTEuIEFz
IE1hdGhpYXMgc3VnZ2VzdGVkLCBtb3ZlZCB0aGUgcG9zaXRpb24gb2YgcmVhZGluZyBkZXZpY2V0
cmVlDQo+PiAJICAgcHJvcGVydHkgImltb2QtaW50ZXJ2YWwtbnMiIGludG8gZm9yIGxvb3ANCj4+
DQo+PiAgIENoYW5nZXMgaW4gdjI6DQo+PiAJMS4gQXMgc3VnZ2VzdGVkIGJ5IE1hdGhpYXMsIHJl
c3RvcmluZyBpbW1vZF9pbnRlcnZhbCBjaGFuZ2VzIHRvDQo+PiAJICAgZGVmYXVsdA0KPj4gLS0t
DQo+DQoNCkhpIE1hdGhpYXMsDQoNClRoYW5rcyBhIG1pbGxpb24gZm9yIHlvdXIgaGVscCBpbiBj
b3JyZWN0aW5nIHRoZSBwYXRjaC4NCg0KUmVnYXJkcywNCkFudXJhZyBLdW1hciBWdWxpc2hhDQoN
Cj5UaGFua3MsIGFkZGluZyB0byBxdWV1ZQ0KPg0K
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-08-06 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-06 13:58 [v3] usb: host: xhci-plat: Iterate over parent nodes for finding quirks Mathias Nyman
  -- strict thread matches above, loose matches on Subject: below --
2018-08-06 14:05 Anurag Kumar Vulisha
2018-08-06 13:04 Anurag Kumar Vulisha

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).