From fec7e1e4e6e49c1937505ce0f18405826a0ed825 Mon Sep 17 00:00:00 2001
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: Fri, 22 Apr 2016 11:17:37 +0300
Subject: [PATCH] UPSTREAM: usb: dwc3: pci: make build-in device properties
 available

Setting the ACPI companion before calling dwc3_pci_quirks.
The ACPI companion will be set unconditionally as the
primary fwnode, overriding any previously set primary
fwnode. This will make sure that any build-in properties
added to the platform device will be added as the secondary
fwnode in cases where also ACPI companion exists.

Change-Id: Ib1a5ff15cc644f8c42e6dccf7c5cf0368857e9c8
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 474799f073763b868e158b04b74f8ddd1da38da2)
---
 drivers/usb/dwc3/dwc3-pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index adc1e8a624cb..e444e9a1a0c8 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -170,13 +170,14 @@ static int dwc3_pci_probe(struct pci_dev *pci,
 	}
 
 	pci_set_drvdata(pci, dwc3);
-	ret = dwc3_pci_quirks(pci);
-	if (ret)
-		goto err;
 
 	dwc3->dev.parent = dev;
 	ACPI_COMPANION_SET(&dwc3->dev, ACPI_COMPANION(dev));
 
+	ret = dwc3_pci_quirks(pci);
+	if (ret)
+		goto err;
+
 	ret = platform_device_add(dwc3);
 	if (ret) {
 		dev_err(dev, "failed to register dwc3 device\n");
-- 
2.34.1