]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ARM: AM43xx: Add functions to enable and disable USB clocks
authorKishon Vijay Abraham I <kishon@ti.com>
Wed, 19 Aug 2015 10:46:26 +0000 (16:16 +0530)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 09:29:51 +0000 (11:29 +0200)
Added functions to enable and disable USB clocks which can be invoked
during USB init and USB exit respectively.

Cc: Roger Quadros <rogerq@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/cpu/armv7/am33xx/clock_am43xx.c
arch/arm/include/asm/arch-am33xx/sys_proto.h

index 35c431eb292d63299948e30f08bc25adaedce7d3..cad8d4649c1360b44fd0d1495b2d2821604c15df 100644 (file)
@@ -171,3 +171,73 @@ void disable_edma3_clocks(void)
                          1);
 }
 #endif
                          1);
 }
 #endif
+
+#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
index 91b614ad20751f2feb1e308be3d668c719ed919e..8f573d2d02a4f5a7ac4ca361a1f5362d932f7253 100644 (file)
@@ -42,3 +42,6 @@ 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
 int am335x_get_efuse_mpu_max_freq(struct ctrl_dev *cdev);
 int am335x_get_tps65910_mpu_vdd(int sil_rev, int frequency);
 #endif
+
+void enable_usb_clocks(int index);
+void disable_usb_clocks(int index);