Skip to content

Commit 72856a4

Browse files
mripardbebarino
authored andcommitted
clk: bcm: rpi: Use clk_hw_register for pllb_arm
The pllb_arm clock is defined as a fixed factor clock with the pllb clock as a parent. However, all its configuration is entirely static, and thus we don't really need to call clk_hw_register_fixed_factor() but can simply call clk_hw_register() with a static clk_fixed_factor structure. Cc: Michael Turquette <[email protected]> Cc: [email protected] Acked-by: Nicolas Saenz Julienne <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Tested-by: Nicolas Saenz Julienne <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/1146177664999eeda65856d28ce94025021dd85e.1592210452.git-series.maxime@cerno.tech Signed-off-by: Stephen Boyd <[email protected]>
1 parent 869bd27 commit 72856a4

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,28 @@ static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi)
225225
return devm_clk_hw_register(rpi->dev, &rpi->pllb);
226226
}
227227

228+
static struct clk_fixed_factor raspberrypi_clk_pllb_arm = {
229+
.mult = 1,
230+
.div = 2,
231+
.hw.init = &(struct clk_init_data) {
232+
.name = "pllb_arm",
233+
.parent_names = (const char *[]){ "pllb" },
234+
.num_parents = 1,
235+
.ops = &clk_fixed_factor_ops,
236+
.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
237+
},
238+
};
239+
228240
static int raspberrypi_register_pllb_arm(struct raspberrypi_clk *rpi)
229241
{
230-
rpi->pllb_arm = clk_hw_register_fixed_factor(rpi->dev,
231-
"pllb_arm", "pllb",
232-
CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
233-
1, 2);
234-
if (IS_ERR(rpi->pllb_arm)) {
242+
int ret;
243+
244+
ret = clk_hw_register(rpi->dev, &raspberrypi_clk_pllb_arm.hw);
245+
if (ret) {
235246
dev_err(rpi->dev, "Failed to initialize pllb_arm\n");
236-
return PTR_ERR(rpi->pllb_arm);
247+
return ret;
237248
}
249+
rpi->pllb_arm = &raspberrypi_clk_pllb_arm.hw;
238250

239251
rpi->pllb_arm_lookup = clkdev_hw_create(rpi->pllb_arm, NULL, "cpu0");
240252
if (!rpi->pllb_arm_lookup) {

0 commit comments

Comments
 (0)