[U-Boot] [PATCH v3 05/30] sunxi: musb: Enable OTG device clock for H3
Jagan Teki
jagannadh.teki at gmail.com
Sun Jan 28 16:19:26 UTC 2018
From: Jun Nie <jun.nie at linaro.org>
Enable OTG clock and deassert reset
Signed-off-by: Jun Nie <jun.nie at linaro.org>
[jagan: fixed AHB_GATE_OFFSET_OTG_DEVICE to use H3/H5/A64]
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan at openedev.com>
Cc: Marek Vasut <marex at denx.de>
---
arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 +
drivers/usb/musb-new/sunxi.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
index 2c82d0a..624d624 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
@@ -279,6 +279,7 @@ struct sunxi_ccm_reg {
#define AHB_GATE_OFFSET_USB_EHCI2 26
#define AHB_GATE_OFFSET_USB_EHCI1 25
#define AHB_GATE_OFFSET_USB_EHCI0 24
+#define AHB_GATE_OFFSET_OTG_DEVICE 23
#else
#define AHB_GATE_OFFSET_USB_OHCI1 30
#define AHB_GATE_OFFSET_USB_OHCI0 29
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 46c8bd2..c3b8fa4 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -266,6 +266,11 @@ static int sunxi_musb_init(struct musb *musb)
#ifdef CONFIG_SUNXI_GEN_SUN6I
setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
#endif
+#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
+ setbits_le32(&ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_OTG_DEVICE));
+ setbits_le32(&ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_OTG_DEVICE));
+#endif
+
sunxi_usb_phy_init(0);
USBC_ConfigFIFO_Base();
@@ -380,6 +385,9 @@ static int musb_usb_remove(struct udevice *dev)
#ifdef CONFIG_SUNXI_GEN_SUN6I
clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
#endif
+#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
+ clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_DEVICE);
+#endif
clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);
free(host->host);
--
2.7.4
More information about the U-Boot
mailing list