1 From 19f7515528fbd1dc0d45e4b5ce6531c1406fc8d8 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 7 Feb 2020 17:03:46 +0100
4 Subject: [PATCH] clk: bcm: rpi: Add DT provider for the clocks
6 For the upcoming registration of the clocks provided by the firmware, make
7 sure it's exposed to the device tree providers.
9 Cc: Michael Turquette <mturquette@baylibre.com>
10 Cc: linux-clk@vger.kernel.org
11 Reviewed-by: Stephen Boyd <sboyd@kernel.org>
12 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 drivers/clk/bcm/clk-raspberrypi.c | 16 ++++++++++++++++
15 1 file changed, 16 insertions(+)
17 --- a/drivers/clk/bcm/clk-raspberrypi.c
18 +++ b/drivers/clk/bcm/clk-raspberrypi.c
21 #define A2W_PLL_FRAC_BITS 20
23 +#define NUM_FW_CLKS 16
25 struct raspberrypi_clk {
27 struct rpi_firmware *firmware;
28 @@ -285,11 +287,13 @@ static struct clk_hw *raspberrypi_regist
30 static int raspberrypi_clk_probe(struct platform_device *pdev)
32 + struct clk_hw_onecell_data *clk_data;
33 struct device_node *firmware_node;
34 struct device *dev = &pdev->dev;
35 struct rpi_firmware *firmware;
36 struct raspberrypi_clk *rpi;
40 firmware_node = of_parse_phandle(dev->of_node, "raspberrypi,firmware", 0);
42 @@ -309,6 +313,11 @@ static int raspberrypi_clk_probe(struct
43 rpi->firmware = firmware;
44 platform_set_drvdata(pdev, rpi);
46 + clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, NUM_FW_CLKS),
51 hw = raspberrypi_register_pllb(rpi);
53 dev_err(dev, "Failed to initialize pllb, %ld\n", PTR_ERR(hw));
54 @@ -318,6 +327,13 @@ static int raspberrypi_clk_probe(struct
55 hw = raspberrypi_register_pllb_arm(rpi);
58 + clk_data->hws[RPI_FIRMWARE_ARM_CLK_ID] = hw;
59 + clk_data->num = RPI_FIRMWARE_ARM_CLK_ID + 1;
61 + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
66 rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",