]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x
authorFelipe Balbi <balbi@ti.com>
Mon, 23 Jun 2014 22:18:24 +0000 (17:18 -0500)
committerMarek Vasut <marex@denx.de>
Wed, 9 Jul 2014 20:11:51 +0000 (22:11 +0200)
Newer AM437x silicon requires us to explicitly power up
the USB2 PHY. By implementing usb_phy_power() we can
achieve that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
drivers/usb/phy/omap_usb_phy.c

index b4703192499018bb4a184ab125d97a2a1c822c17..efdecf4613687b363d95e7884d178ab87e2828d9 100644 (file)
 #define VTP0_CTRL_ADDR                 0x44E10E0C
 #define VTP1_CTRL_ADDR                 0x48140E10
 
+/* USB CTRL Base Address */
+#define USB1_CTRL                      0x44e10628
+#define USB1_CTRL_CM_PWRDN             BIT(0)
+#define USB1_CTRL_OTG_PWRDN            BIT(1)
+
 /* DDR Base address */
 #define DDR_PHY_CMD_ADDR               0x44E12000
 #define DDR_PHY_DATA_ADDR              0x44E120C8
index af46db2eddd7353a0c46ed22fd23aac93d6d8abe..f78d53296685e49b6c7b51cb950ba76385bdf501 100644 (file)
@@ -222,7 +222,22 @@ static void am437x_enable_usb2_phy2(struct omap_xhci *omap)
 
 void usb_phy_power(int on)
 {
-       return;
+       u32 val;
+
+       /* USB1_CTRL */
+       val = readl(USB1_CTRL);
+       if (on) {
+               /*
+                * these bits are re-used on AM437x to power up/down the USB
+                * CM and OTG PHYs, if we don't toggle them, USB will not be
+                * functional on newer silicon revisions
+                */
+               val &= ~(USB1_CTRL_CM_PWRDN | USB1_CTRL_OTG_PWRDN);
+       } else {
+               val |= USB1_CTRL_CM_PWRDN | USB1_CTRL_OTG_PWRDN;
+       }
+
+       writel(val, USB1_CTRL);
 }
 #endif /* CONFIG_AM437X_USB2PHY2_HOST */