Skip to content

Commit d4b4f1b

Browse files
mripardbebarino
authored andcommitted
clk: bcm: rpi: Add DT provider for the clocks
For the upcoming registration of the clocks provided by the firmware, make sure it's exposed to the device tree providers. 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/4d8dbe4aaae98b3d3812ad7c3dba53d645cadbaf.1592210452.git-series.maxime@cerno.tech Signed-off-by: Stephen Boyd <[email protected]>
1 parent 23e114b commit d4b4f1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#define A2W_PLL_FRAC_BITS 20
3333

34+
#define NUM_FW_CLKS 16
35+
3436
struct raspberrypi_clk {
3537
struct device *dev;
3638
struct rpi_firmware *firmware;
@@ -282,11 +284,13 @@ static struct clk_hw *raspberrypi_register_pllb_arm(struct raspberrypi_clk *rpi)
282284

283285
static int raspberrypi_clk_probe(struct platform_device *pdev)
284286
{
287+
struct clk_hw_onecell_data *clk_data;
285288
struct device_node *firmware_node;
286289
struct device *dev = &pdev->dev;
287290
struct rpi_firmware *firmware;
288291
struct raspberrypi_clk *rpi;
289292
struct clk_hw *hw;
293+
int ret;
290294

291295
/*
292296
* We can be probed either through the an old-fashioned
@@ -316,6 +320,11 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
316320
rpi->firmware = firmware;
317321
platform_set_drvdata(pdev, rpi);
318322

323+
clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, NUM_FW_CLKS),
324+
GFP_KERNEL);
325+
if (!clk_data)
326+
return -ENOMEM;
327+
319328
hw = raspberrypi_register_pllb(rpi);
320329
if (IS_ERR(hw)) {
321330
dev_err(dev, "Failed to initialize pllb, %ld\n", PTR_ERR(hw));
@@ -325,6 +334,13 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
325334
hw = raspberrypi_register_pllb_arm(rpi);
326335
if (IS_ERR(hw))
327336
return PTR_ERR(hw);
337+
clk_data->hws[RPI_FIRMWARE_ARM_CLK_ID] = hw;
338+
clk_data->num = RPI_FIRMWARE_ARM_CLK_ID + 1;
339+
340+
ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
341+
clk_data);
342+
if (ret)
343+
return ret;
328344

329345
rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
330346
-1, NULL, 0);

0 commit comments

Comments
 (0)