[linux-yocto] [PATCH 03/22] valleyisland-io: enable/disable ulpi phy refclk in usb

boon.leong.ong at intel.com boon.leong.ong at intel.com
Wed Jan 29 10:41:28 PST 2014


From: Ong Boon Leong <boon.leong.ong at intel.com>

Due to power saving purpose, BIOS disabled ulpi phy refclk by default.
Hence, the refclk will only be enabled during device/driver probing.
and disabled during driver removal.

Signed-off-by: Ong Boon Leong <boon.leong.ong at intel.com>
---
 ...b-dwc3-pci-Enable-disable-ulpi-phy-refclk.patch |   73 ++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 meta/cfg/kernel-cache/features/valleyisland-io/0001-usb-dwc3-pci-Enable-disable-ulpi-phy-refclk.patch

diff --git a/meta/cfg/kernel-cache/features/valleyisland-io/0001-usb-dwc3-pci-Enable-disable-ulpi-phy-refclk.patch b/meta/cfg/kernel-cache/features/valleyisland-io/0001-usb-dwc3-pci-Enable-disable-ulpi-phy-refclk.patch
new file mode 100644
index 0000000..ed8c02a
--- /dev/null
+++ b/meta/cfg/kernel-cache/features/valleyisland-io/0001-usb-dwc3-pci-Enable-disable-ulpi-phy-refclk.patch
@@ -0,0 +1,73 @@
+From 9068004eb49c9a166c25716d46f65c973d314273 Mon Sep 17 00:00:00 2001
+From: Maurice Petallo <mauricex.r.petallo at intel.com>
+Date: Wed, 6 Nov 2013 13:47:55 +0800
+Subject: [PATCH 01/19] usb: dwc3: pci: Enable/disable ulpi phy refclk
+
+Due to power saving purpose, BIOS disabled ulpi phy refclk by default.
+Hence, the refclk will only be enabled during device/driver probing.
+and disabled during driver removal.
+
+Signed-off-by: Maurice Petallo <mauricex.r.petallo at intel.com>
+Signed-off-by: Chew, Chiau Ee <chiau.ee.chew at intel.com>
+---
+ drivers/usb/dwc3/dwc3-pci.c |   23 +++++++++++++++++++++++
+ 1 files changed, 23 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
+index 1046dfc..23ee760 100644
+--- a/drivers/usb/dwc3/dwc3-pci.c
++++ b/drivers/usb/dwc3/dwc3-pci.c
+@@ -52,6 +52,10 @@
+ #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3	0xabcd
+ #define PCI_DEVICE_ID_INTEL_BYT		0x0f37
+
++#define DWC3_PCI_GEN_REGRW1		0xa0
++#define DWC3_PCI_GEN_REGRW1_REFCLK_EN(n)  (n & 0xfffdffff)
++#define DWC3_PCI_GEN_REGRW1_REFCLK_DIS(n) (n | 0x020000)
++
+ struct dwc3_pci {
+ 	struct device		*dev;
+ 	struct platform_device	*dwc3;
+@@ -113,6 +117,19 @@ err1:
+ 	return ret;
+ }
+
++static void dwc3_pci_ulpiphy_refclk(struct pci_dev *pci, int enable)
++{
++	u32 val;
++
++	pci_read_config_dword(pci, DWC3_PCI_GEN_REGRW1, &val);
++	if (enable)
++		val = DWC3_PCI_GEN_REGRW1_REFCLK_EN(val);
++	else
++		val = DWC3_PCI_GEN_REGRW1_REFCLK_DIS(val);
++
++	pci_write_config_dword(pci, DWC3_PCI_GEN_REGRW1, val);
++}
++
+ static int dwc3_pci_probe(struct pci_dev *pci,
+ 		const struct pci_device_id *id)
+ {
+@@ -184,6 +201,9 @@ static int dwc3_pci_probe(struct pci_dev *pci,
+ 		goto err3;
+ 	}
+
++	/* enable ulpi phy refclk */
++	dwc3_pci_ulpiphy_refclk(pci, 1);
++
+ 	return 0;
+
+ err3:
+@@ -199,6 +219,9 @@ static void dwc3_pci_remove(struct pci_dev *pci)
+ {
+ 	struct dwc3_pci	*glue = pci_get_drvdata(pci);
+
++	/* disable ulpi phy refclk */
++	dwc3_pci_ulpiphy_refclk(pci, 0);
++
+ 	platform_device_unregister(glue->usb2_phy);
+ 	platform_device_unregister(glue->usb3_phy);
+ 	platform_device_unregister(glue->dwc3);
+--
+1.7.4.4
+
-- 
1.7.10.4



More information about the linux-yocto mailing list