imx233: Fix clkctrl for STMP3600 variants (creativezenv)

Change-Id: Ia8f0ce13cdf7dcbf1339bb7648f7a99822f74017
This commit is contained in:
Solomon Peachy 2025-01-08 08:03:17 -05:00
parent 4cd0c35150
commit f1173e07ec

View file

@ -88,8 +88,12 @@ void imx233_clkctrl_set_div(enum imx233_clock_t clk, int div)
#endif
case CLK_SSP: BF_WR(CLKCTRL_SSP, DIV(div)); break;
case CLK_HBUS:
#if IMX233_SUBTARGET >= 3700
/* make sure to switch to integer divide mode simulteanously */
BF_WR(CLKCTRL_HBUS, DIV_FRAC_EN(0), DIV(div)); break;
#else
BF_WR(CLKCTRL_HBUS, DIV(div)); break;
#endif
case CLK_XBUS: BF_WR(CLKCTRL_XBUS, DIV(div)); break;
default: return;
}
@ -111,9 +115,11 @@ int imx233_clkctrl_get_div(enum imx233_clock_t clk)
case CLK_SSP: return BF_RD(CLKCTRL_SSP, DIV);
case CLK_HBUS:
/* since fractional and integer divider share the same field, clain it is disabled in frac mode */
#if IMX233_SUBTARGET >= 3700
if(BF_RD(CLKCTRL_HBUS, DIV_FRAC_EN))
return 0;
else
#endif
return BF_RD(CLKCTRL_HBUS, DIV);
case CLK_XBUS: return BF_RD(CLKCTRL_XBUS, DIV);
default: return 0;
@ -143,7 +149,11 @@ void imx233_clkctrl_set_frac_div(enum imx233_clock_t clk, int fracdiv)
/* value 0 is forbidden because we can't simply disabble the divider, it's always
* active but either in integer or fractional mode
* make sure we write both the value and frac_en bit at the same time */
#if IMX233_SUBTARGET >= 3700
BF_WR(CLKCTRL_HBUS, DIV_FRAC_EN(1), DIV(fracdiv));
#else
BF_WR(CLKCTRL_HBUS, DIV(fracdiv));
#endif
break;
default: break;
}