1 From 1231dbeb8bfeda68c53854cc68016acd74665079 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 7 Feb 2020 16:08:17 +0100
4 Subject: [PATCH] clk: bcm: rpi: Pass the clocks data to the firmware
7 The raspberry_clock_property only takes the clock ID as an argument, but
8 now that we have a clock data structure it makes more sense to just pass
9 that structure instead.
11 Cc: Michael Turquette <mturquette@baylibre.com>
12 Cc: Stephen Boyd <sboyd@kernel.org>
13 Cc: linux-clk@vger.kernel.org
14 Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
15 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
17 drivers/clk/bcm/clk-raspberrypi.c | 29 ++++++++++++++---------------
18 1 file changed, 14 insertions(+), 15 deletions(-)
20 --- a/drivers/clk/bcm/clk-raspberrypi.c
21 +++ b/drivers/clk/bcm/clk-raspberrypi.c
22 @@ -67,11 +67,12 @@ struct raspberrypi_firmware_prop {
26 -static int raspberrypi_clock_property(struct rpi_firmware *firmware, u32 tag,
28 +static int raspberrypi_clock_property(struct rpi_firmware *firmware,
29 + const struct raspberrypi_clk_data *data,
32 struct raspberrypi_firmware_prop msg = {
33 - .id = cpu_to_le32(clk),
34 + .id = cpu_to_le32(data->id),
35 .val = cpu_to_le32(*val),
36 .disable_turbo = cpu_to_le32(1),
38 @@ -94,9 +95,8 @@ static int raspberrypi_fw_pll_is_on(stru
42 - ret = raspberrypi_clock_property(rpi->firmware,
43 - RPI_FIRMWARE_GET_CLOCK_STATE,
45 + ret = raspberrypi_clock_property(rpi->firmware, data,
46 + RPI_FIRMWARE_GET_CLOCK_STATE, &val);
50 @@ -113,9 +113,8 @@ static unsigned long raspberrypi_fw_pll_
54 - ret = raspberrypi_clock_property(rpi->firmware,
55 - RPI_FIRMWARE_GET_CLOCK_RATE,
57 + ret = raspberrypi_clock_property(rpi->firmware, data,
58 + RPI_FIRMWARE_GET_CLOCK_RATE, &val);
62 @@ -131,9 +130,9 @@ static int raspberrypi_fw_pll_set_rate(s
63 u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE;
66 - ret = raspberrypi_clock_property(rpi->firmware,
67 + ret = raspberrypi_clock_property(rpi->firmware, data,
68 RPI_FIRMWARE_SET_CLOCK_RATE,
69 - data->id, &new_rate);
72 dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d",
73 clk_hw_get_name(hw), ret);
74 @@ -198,18 +197,18 @@ static int raspberrypi_register_pllb(str
75 init.flags = CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED;
77 /* Get min & max rates set by the firmware */
78 - ret = raspberrypi_clock_property(rpi->firmware,
79 + ret = raspberrypi_clock_property(rpi->firmware, data,
80 RPI_FIRMWARE_GET_MIN_CLOCK_RATE,
81 - data->id, &min_rate);
84 dev_err(rpi->dev, "Failed to get %s min freq: %d\n",
89 - ret = raspberrypi_clock_property(rpi->firmware,
90 + ret = raspberrypi_clock_property(rpi->firmware, data,
91 RPI_FIRMWARE_GET_MAX_CLOCK_RATE,
92 - data->id, &max_rate);
95 dev_err(rpi->dev, "Failed to get %s max freq: %d\n",