]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: imx8ulp: clock: Add clock support for i3c controller
authorClark Wang <xiaoning.wang@nxp.com>
Wed, 6 Apr 2022 06:30:09 +0000 (14:30 +0800)
committerStefano Babic <sbabic@denx.de>
Tue, 12 Apr 2022 15:33:56 +0000 (17:33 +0200)
Add i3c controller clock enable/disable function for imx8ulp.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8ulp/clock.c

index 91580b2c29ccdce90c71cc2ce77b6b63d6a2ce55..a2b3ce78cc181424c019d56c902d9204ca7ac76d 100644 (file)
@@ -237,6 +237,26 @@ u32 imx_get_i2cclk(u32 i2c_num)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_SYS_I2C_IMX_I3C)
+int enable_i3c_clk(unsigned char enable, u32 i3c_num)
+{
+       if (enable) {
+               pcc_clock_enable(3, I3C2_PCC3_SLOT, false);
+               pcc_clock_sel(3, I3C2_PCC3_SLOT, SOSC_DIV2);
+               pcc_clock_enable(3, I3C2_PCC3_SLOT, true);
+               pcc_reset_peripheral(3, I3C2_PCC3_SLOT, false);
+       } else {
+               pcc_clock_enable(3, I3C2_PCC3_SLOT, false);
+       }
+       return 0;
+}
+
+u32 imx_get_i3cclk(u32 i3c_num)
+{
+       return pcc_clock_get_rate(3, I3C2_PCC3_SLOT);
+}
+#endif
+
 void enable_usboh3_clk(unsigned char enable)
 {
        if (enable) {