Skip to content

Commit fc9fb8f

Browse files
rajanv-xilinxgregkh
authored andcommitted
firmware: xilinx: Remove eemi ops for clock_setdivider
Use direct function call instead of using eemi ops for clock_setdivider. Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Link: https://lore.kernel.org/r/1587761887-4279-8-git-send-email-jolly.shah@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5e76731 commit fc9fb8f

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎drivers/clk/zynqmp/divider.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ static int zynqmp_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
219219
u32 div_type = divider->div_type;
220220
u32 value, div;
221221
int ret;
222-
const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
223222

224223
value = zynqmp_divider_get_val(parent_rate, rate, divider->flags);
225224
if (div_type == TYPE_DIV1) {
@@ -233,7 +232,7 @@ static int zynqmp_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
233232
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
234233
div = __ffs(div);
235234

236-
ret = eemi_ops->clock_setdivider(clk_id, div);
235+
ret = zynqmp_pm_clock_setdivider(clk_id, div);
237236

238237
if (ret)
239238
pr_warn_once("%s() set divider failed for %s, ret = %d\n",

‎drivers/clk/zynqmp/pll.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
187187
rate = parent_rate * m;
188188
frac = (parent_rate * f) / FRAC_DIV;
189189

190-
ret = eemi_ops->clock_setdivider(clk_id, m);
190+
ret = zynqmp_pm_clock_setdivider(clk_id, m);
191191
if (ret == -EUSERS)
192192
WARN(1, "More than allowed devices are using the %s, which is forbidden\n",
193193
clk_name);
@@ -201,7 +201,7 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
201201

202202
fbdiv = DIV_ROUND_CLOSEST(rate, parent_rate);
203203
fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX);
204-
ret = eemi_ops->clock_setdivider(clk_id, fbdiv);
204+
ret = zynqmp_pm_clock_setdivider(clk_id, fbdiv);
205205
if (ret)
206206
pr_warn_once("%s() set divider failed for %s, ret = %d\n",
207207
__func__, clk_name, ret);

‎drivers/firmware/xilinx/zynqmp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,12 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_clock_getstate);
405405
*
406406
* Return: Returns status, either success or error+reason
407407
*/
408-
static int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider)
408+
int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider)
409409
{
410410
return zynqmp_pm_invoke_fn(PM_CLOCK_SETDIVIDER, clock_id, divider,
411411
0, 0, NULL);
412412
}
413+
EXPORT_SYMBOL_GPL(zynqmp_pm_clock_setdivider);
413414

414415
/**
415416
* zynqmp_pm_clock_getdivider() - Get the clock divider for given id
@@ -740,7 +741,6 @@ static int zynqmp_pm_aes_engine(const u64 address, u32 *out)
740741
}
741742

742743
static const struct zynqmp_eemi_ops eemi_ops = {
743-
.clock_setdivider = zynqmp_pm_clock_setdivider,
744744
.clock_getdivider = zynqmp_pm_clock_getdivider,
745745
.clock_setrate = zynqmp_pm_clock_setrate,
746746
.clock_getrate = zynqmp_pm_clock_getrate,

‎include/linux/firmware/xlnx-zynqmp.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ struct zynqmp_pm_query_data {
296296
struct zynqmp_eemi_ops {
297297
int (*fpga_load)(const u64 address, const u32 size, const u32 flags);
298298
int (*fpga_get_status)(u32 *value);
299-
int (*clock_setdivider)(u32 clock_id, u32 divider);
300299
int (*clock_getdivider)(u32 clock_id, u32 *divider);
301300
int (*clock_setrate)(u32 clock_id, u64 rate);
302301
int (*clock_getrate)(u32 clock_id, u64 *rate);
@@ -331,6 +330,7 @@ int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata, u32 *out);
331330
int zynqmp_pm_clock_enable(u32 clock_id);
332331
int zynqmp_pm_clock_disable(u32 clock_id);
333332
int zynqmp_pm_clock_getstate(u32 clock_id, u32 *state);
333+
int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider);
334334
#else
335335
static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
336336
{
@@ -361,6 +361,10 @@ static inline int zynqmp_pm_clock_getstate(u32 clock_id, u32 *state)
361361
{
362362
return -ENODEV;
363363
}
364+
static inline int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider)
365+
{
366+
return -ENODEV;
367+
}
364368
#endif
365369

366370
#endif /* __FIRMWARE_ZYNQMP_H__ */

0 commit comments

Comments
 (0)