Skip to content

Commit 8a1f3eb

Browse files
mripardbebarino
authored andcommitted
clk: bcm: rpi: Add clock id to data
The driver has really only supported one clock so far and has hardcoded the ID used in communications with the firmware in all the functions implementing the clock framework hooks. Let's store that in the clock data structure so that we can support more clocks later on. 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/e23c37961b97b027e21efa3b818578970f88527a.1592210452.git-series.maxime@cerno.tech Signed-off-by: Stephen Boyd <[email protected]>
1 parent f922c56 commit 8a1f3eb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ struct raspberrypi_clk {
3939

4040
struct raspberrypi_clk_data {
4141
struct clk_hw hw;
42+
43+
unsigned int id;
44+
4245
struct raspberrypi_clk *rpi;
4346
};
4447

@@ -91,7 +94,7 @@ static int raspberrypi_fw_pll_is_on(struct clk_hw *hw)
9194

9295
ret = raspberrypi_clock_property(rpi->firmware,
9396
RPI_FIRMWARE_GET_CLOCK_STATE,
94-
RPI_FIRMWARE_ARM_CLK_ID, &val);
97+
data->id, &val);
9598
if (ret)
9699
return 0;
97100

@@ -110,8 +113,7 @@ static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw,
110113

111114
ret = raspberrypi_clock_property(rpi->firmware,
112115
RPI_FIRMWARE_GET_CLOCK_RATE,
113-
RPI_FIRMWARE_ARM_CLK_ID,
114-
&val);
116+
data->id, &val);
115117
if (ret)
116118
return ret;
117119

@@ -129,8 +131,7 @@ static int raspberrypi_fw_pll_set_rate(struct clk_hw *hw, unsigned long rate,
129131

130132
ret = raspberrypi_clock_property(rpi->firmware,
131133
RPI_FIRMWARE_SET_CLOCK_RATE,
132-
RPI_FIRMWARE_ARM_CLK_ID,
133-
&new_rate);
134+
data->id, &new_rate);
134135
if (ret)
135136
dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d",
136137
clk_hw_get_name(hw), ret);
@@ -183,6 +184,7 @@ static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi)
183184
if (!data)
184185
return -ENOMEM;
185186
data->rpi = rpi;
187+
data->id = RPI_FIRMWARE_ARM_CLK_ID;
186188

187189
/* All of the PLLs derive from the external oscillator. */
188190
init.parent_names = (const char *[]){ "osc" };
@@ -194,8 +196,7 @@ static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi)
194196
/* Get min & max rates set by the firmware */
195197
ret = raspberrypi_clock_property(rpi->firmware,
196198
RPI_FIRMWARE_GET_MIN_CLOCK_RATE,
197-
RPI_FIRMWARE_ARM_CLK_ID,
198-
&min_rate);
199+
data->id, &min_rate);
199200
if (ret) {
200201
dev_err(rpi->dev, "Failed to get %s min freq: %d\n",
201202
init.name, ret);
@@ -204,8 +205,7 @@ static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi)
204205

205206
ret = raspberrypi_clock_property(rpi->firmware,
206207
RPI_FIRMWARE_GET_MAX_CLOCK_RATE,
207-
RPI_FIRMWARE_ARM_CLK_ID,
208-
&max_rate);
208+
data->id, &max_rate);
209209
if (ret) {
210210
dev_err(rpi->dev, "Failed to get %s max freq: %d\n",
211211
init.name, ret);

0 commit comments

Comments
 (0)