[U-Boot] [PATCH 11/21] ARM: AM43xx: Add functions to enable and disable USB clocks
Kishon Vijay Abraham I
kishon at ti.com
Thu Aug 6 18:16:01 CEST 2015
Added functions to enable and disable USB clocks which can be invoked
during USB init and USB exit respectively.
Cc: Roger Quadros <rogerq at ti.com>
Cc: Tero Kristo <t-kristo at ti.com>
Cc: Nishanth Menon <nm at ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon at ti.com>
---
arch/arm/cpu/armv7/am33xx/clock_am43xx.c | 70 ++++++++++++++++++++++++++
arch/arm/include/asm/arch-am33xx/sys_proto.h | 5 ++
2 files changed, 75 insertions(+)
diff --git a/arch/arm/cpu/armv7/am33xx/clock_am43xx.c b/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
index b1c0025..cd8931e 100644
--- a/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
+++ b/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
@@ -134,3 +134,73 @@ void enable_basic_clocks(void)
/* For OPP100 the mac clock should be /5. */
writel(0x4, &cmdpll->clkselmacclk);
}
+
+#ifdef CONFIG_USB_DWC3
+void enable_usb_clocks(int index)
+{
+ u32 *usbclkctrl = 0;
+ u32 *usbphyocp2scpclkctrl = 0;
+
+ if (index == 0) {
+ usbclkctrl = &cmper->usb0clkctrl;
+ usbphyocp2scpclkctrl = &cmper->usbphyocp2scp0clkctrl;
+ setbits_le32(&cmper->usb0clkctrl,
+ USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+ setbits_le32(&cmwkup->usbphy0clkctrl,
+ USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
+ } else if (index == 1) {
+ usbclkctrl = &cmper->usb1clkctrl;
+ usbphyocp2scpclkctrl = &cmper->usbphyocp2scp1clkctrl;
+ setbits_le32(&cmper->usb1clkctrl,
+ USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+ setbits_le32(&cmwkup->usbphy1clkctrl,
+ USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
+ }
+
+ u32 *const clk_domains_usb[] = {
+ 0
+ };
+
+ u32 *const clk_modules_explicit_en_usb[] = {
+ usbclkctrl,
+ usbphyocp2scpclkctrl,
+ 0
+ };
+
+ do_enable_clocks(clk_domains_usb, clk_modules_explicit_en_usb, 1);
+}
+
+void disable_usb_clocks(int index)
+{
+ u32 *usbclkctrl = 0;
+ u32 *usbphyocp2scpclkctrl = 0;
+
+ if (index == 0) {
+ usbclkctrl = &cmper->usb0clkctrl;
+ usbphyocp2scpclkctrl = &cmper->usbphyocp2scp0clkctrl;
+ clrbits_le32(&cmper->usb0clkctrl,
+ USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+ clrbits_le32(&cmwkup->usbphy0clkctrl,
+ USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
+ } else if (index == 1) {
+ usbclkctrl = &cmper->usb1clkctrl;
+ usbphyocp2scpclkctrl = &cmper->usbphyocp2scp1clkctrl;
+ clrbits_le32(&cmper->usb1clkctrl,
+ USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+ clrbits_le32(&cmwkup->usbphy1clkctrl,
+ USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
+ }
+
+ u32 *const clk_domains_usb[] = {
+ 0
+ };
+
+ u32 *const clk_modules_disable_usb[] = {
+ usbclkctrl,
+ usbphyocp2scpclkctrl,
+ 0
+ };
+
+ do_disable_clocks(clk_domains_usb, clk_modules_disable_usb, 1);
+}
+#endif
diff --git a/arch/arm/include/asm/arch-am33xx/sys_proto.h b/arch/arm/include/asm/arch-am33xx/sys_proto.h
index 91b614a..275cf7b 100644
--- a/arch/arm/include/asm/arch-am33xx/sys_proto.h
+++ b/arch/arm/include/asm/arch-am33xx/sys_proto.h
@@ -42,3 +42,8 @@ void am33xx_spl_board_init(void);
int am335x_get_efuse_mpu_max_freq(struct ctrl_dev *cdev);
int am335x_get_tps65910_mpu_vdd(int sil_rev, int frequency);
#endif
+
+#ifdef CONFIG_USB_DWC3
+void enable_usb_clocks(int index);
+void disable_usb_clocks(int index);
+#endif
--
1.7.9.5
More information about the U-Boot
mailing list