mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 17:14:21 +00:00
feat(nxp-clk): add get_rate for s32cc_fixed_div
The get rate callback is needed for s32cc_fixed_div to allow the frequency compilation for modules attached to a fixed divider like LINFLEXD_CLK. Change-Id: Ibc3e52f7f1127bba0dd793be0a26bdff15260824 Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
This commit is contained in:
parent
8f23e76fa5
commit
7c298ebcbf
1 changed files with 20 additions and 0 deletions
|
@ -1365,6 +1365,23 @@ static int set_fixed_div_freq(const struct s32cc_clk_obj *module, unsigned long
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int get_fixed_div_freq(const struct s32cc_clk_obj *module,
|
||||
const struct s32cc_clk_drv *drv,
|
||||
unsigned long *rate, unsigned int depth)
|
||||
{
|
||||
const struct s32cc_fixed_div *fdiv = s32cc_obj2fixeddiv(module);
|
||||
unsigned long pfreq;
|
||||
int ret;
|
||||
|
||||
ret = get_module_rate(fdiv->parent, drv, &pfreq, depth);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
*rate = (pfreq * FP_PRECISION / fdiv->rate_div) / FP_PRECISION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_mux_freq(const struct s32cc_clk_obj *module, unsigned long rate,
|
||||
unsigned long *orate, unsigned int *depth)
|
||||
{
|
||||
|
@ -1564,6 +1581,9 @@ static int get_module_rate(const struct s32cc_clk_obj *module,
|
|||
case s32cc_dfs_div_t:
|
||||
ret = get_dfs_div_freq(module, drv, rate, ldepth);
|
||||
break;
|
||||
case s32cc_fixed_div_t:
|
||||
ret = get_fixed_div_freq(module, drv, rate, ldepth);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue