[PATCH 2/3 v6] arm: omap: am335x: enable phy controls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Switch on the phy for am335x.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@xxxxxx>
---
Updated the uses of cpu_is_xxx based on Tony's comment.

 arch/arm/mach-omap2/omap_phy_internal.c |   34 ++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 4c90477..7d7b3a2 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -265,8 +265,21 @@ void ti81xx_musb_phy_power(u8 on)
 {
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
+	static u8 ti816x, ti814x, ti81xx, am33xx, once;
+
+	if (!once) {
+		ti816x = cpu_is_ti816x();
+		ti814x = cpu_is_ti814x();
+		ti81xx = cpu_is_ti81xx();
+		am33xx = cpu_is_am33xx();
+		once = 1;
+	}
+
+	if (ti81xx)
+		scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	else if (am33xx)
+		scm_base = ioremap(AM33XX_SCM_BASE, SZ_2K);
 
-	scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
 	if (!scm_base) {
 		pr_err("system control module ioremap failed\n");
 		return;
@@ -275,19 +288,22 @@ void ti81xx_musb_phy_power(u8 on)
 	usbphycfg = __raw_readl(scm_base + USBCTRL0);
 
 	if (on) {
-		if (cpu_is_ti816x()) {
+		if (ti816x) {
 			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
-		} else if (cpu_is_ti814x()) {
-			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-				| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+		} else if (ti814x || am33xx) {
+			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+			usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+			if (ti814x) {
+				usbphycfg &= ~(USBPHY_DPINPUT | USBPHY_DMINPUT);
+				usbphycfg |= USBPHY_DPOPBUFCTL
+					| USBPHY_DMOPBUFCTL;
+			}
 		}
 	} else {
-		if (cpu_is_ti816x())
+		if (ti816x)
 			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-		else if (cpu_is_ti814x())
+		else if (ti814x || am33xx)
 			usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 
 	}
-- 
1.7.0.4

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux