7822ff0d11948a1e4f101c8136a86fedb43f8eef
[openwrt/staging/adrian.git] /
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
5 function
6
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.
10
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>
16 ---
17 drivers/clk/bcm/clk-raspberrypi.c | 29 ++++++++++++++---------------
18 1 file changed, 14 insertions(+), 15 deletions(-)
19
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 {
23 __le32 disable_turbo;
24 } __packed;
25
26 -static int raspberrypi_clock_property(struct rpi_firmware *firmware, u32 tag,
27 - u32 clk, u32 *val)
28 +static int raspberrypi_clock_property(struct rpi_firmware *firmware,
29 + const struct raspberrypi_clk_data *data,
30 + u32 tag, u32 *val)
31 {
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),
37 };
38 @@ -94,9 +95,8 @@ static int raspberrypi_fw_pll_is_on(stru
39 u32 val = 0;
40 int ret;
41
42 - ret = raspberrypi_clock_property(rpi->firmware,
43 - RPI_FIRMWARE_GET_CLOCK_STATE,
44 - data->id, &val);
45 + ret = raspberrypi_clock_property(rpi->firmware, data,
46 + RPI_FIRMWARE_GET_CLOCK_STATE, &val);
47 if (ret)
48 return 0;
49
50 @@ -113,9 +113,8 @@ static unsigned long raspberrypi_fw_pll_
51 u32 val = 0;
52 int ret;
53
54 - ret = raspberrypi_clock_property(rpi->firmware,
55 - RPI_FIRMWARE_GET_CLOCK_RATE,
56 - data->id, &val);
57 + ret = raspberrypi_clock_property(rpi->firmware, data,
58 + RPI_FIRMWARE_GET_CLOCK_RATE, &val);
59 if (ret)
60 return ret;
61
62 @@ -131,9 +130,9 @@ static int raspberrypi_fw_pll_set_rate(s
63 u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE;
64 int ret;
65
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);
70 + &new_rate);
71 if (ret)
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;
76
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);
82 + &min_rate);
83 if (ret) {
84 dev_err(rpi->dev, "Failed to get %s min freq: %d\n",
85 init.name, ret);
86 return ret;
87 }
88
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);
93 + &max_rate);
94 if (ret) {
95 dev_err(rpi->dev, "Failed to get %s max freq: %d\n",
96 init.name, ret);