[U-Boot] [PATCH v3 14/30] sunxi: usb_phy: Fix phy_config to handle all SOC's

Jagan Teki jagannadh.teki at gmail.com
Sun Jan 28 16:19:35 UTC 2018


- enable_pmu_unk1 for V3S/H3/H5/A64
- enable usb 45 Ohm calibration for all non A83T SOC's
- adjust PHY's magnitude for all non A83T SOC's

Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
 arch/arm/mach-sunxi/usb_phy.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c
index 32ee0d4..a81425d 100644
--- a/arch/arm/mach-sunxi/usb_phy.c
+++ b/arch/arm/mach-sunxi/usb_phy.c
@@ -153,41 +153,32 @@ __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr,
 	}
 }
 
-#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
+#ifndef CONFIG_MACH_SUN8I_A83T
 static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy)
 {
 #if defined CONFIG_MACH_SUNXI_H3_H5
 	if (phy->id == 0)
 		clrbits_le32(SUNXI_USBPHY_BASE + REG_PHY_UNK_H3, 0x01);
 #endif
+
+# if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) || \
+	defined(CONFIG_MACH_SUN8I_V3S)
 	clrbits_le32(phy->base + REG_PMU_UNK_H3, 0x02);
-}
-#elif defined CONFIG_MACH_SUN8I_A83T
-static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy)
-{
-}
-#else
-static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy)
-{
-	/* The following comments are machine
-	 * translated from Chinese, you have been warned!
-	 */
+# endif
 
-	/* Regulation 45 ohms */
+	/* Enable USB 45 Ohm resistor calibration */
 	if (phy->id == 0)
 		usb_phy_write(phy, 0x0c, 0x01, 1);
 
-	/* adjust PHY's magnitude and rate */
+	/* Adjust PHY's magnitude and rate */
 	usb_phy_write(phy, 0x20, 0x14, 5);
 
-	/* threshold adjustment disconnect */
-#if defined CONFIG_MACH_SUN5I || defined CONFIG_MACH_SUN7I
+	/* Disconnect threshold adjustment */
+# if defined CONFIG_MACH_SUN5I || defined CONFIG_MACH_SUN7I
 	usb_phy_write(phy, 0x2a, 2, 2);
-#else
+# else
 	usb_phy_write(phy, 0x2a, 3, 2);
-#endif
-
-	return;
+# endif
 }
 #endif
 
-- 
2.7.4



More information about the U-Boot mailing list