Skip to content

Commit 81df015

Browse files
mripardbebarino
authored andcommitted
clk: bcm: rpi: Pass the clocks data to the firmware function
The raspberry_clock_property only takes the clock ID as an argument, but now that we have a clock data structure it makes more sense to just pass that structure instead. Cc: Michael Turquette <[email protected]> Cc: Stephen Boyd <[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/d7a3b4df3ca23feb6e0d9c7ae2d232bfb913f926.1592210452.git-series.maxime@cerno.tech Signed-off-by: Stephen Boyd <[email protected]>
1 parent 8a1f3eb commit 81df015

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ struct raspberrypi_firmware_prop {
6565
__le32 disable_turbo;
6666
} __packed;
6767

68-
static int raspberrypi_clock_property(struct rpi_firmware *firmware, u32 tag,
69-
u32 clk, u32 *val)
68+
static int raspberrypi_clock_property(struct rpi_firmware *firmware,
69+
const struct raspberrypi_clk_data *data,
70+
u32 tag, u32 *val)
7071
{
7172
struct raspberrypi_firmware_prop msg = {
72-
.id = cpu_to_le32(clk),
73+
.id = cpu_to_le32(data->id),
7374
.val = cpu_to_le32(*val),
7475
.disable_turbo = cpu_to_le32(1),
7576
};
@@ -92,9 +93,8 @@ static int raspberrypi_fw_pll_is_on(struct clk_hw *hw)
9293
u32 val = 0;
9394
int ret;
9495

95-
ret = raspberrypi_clock_property(rpi->firmware,
96-
RPI_FIRMWARE_GET_CLOCK_STATE,
97-
data->id, &val);
96+
ret = raspberrypi_clock_property(rpi->firmware, data,
97+
RPI_FIRMWARE_GET_CLOCK_STATE, &val);
9898
if (ret)
9999
return 0;
100100

@@ -111,9 +111,8 @@ static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw,
111111
u32 val = 0;
112112
int ret;
113113

114-
ret = raspberrypi_clock_property(rpi->firmware,
115-
RPI_FIRMWARE_GET_CLOCK_RATE,
116-
data->id, &val);
114+
ret = raspberrypi_clock_property(rpi->firmware, data,
115+
RPI_FIRMWARE_GET_CLOCK_RATE, &val);
117116
if (ret)
118117
return ret;
119118

@@ -129,9 +128,9 @@ static int raspberrypi_fw_pll_set_rate(struct clk_hw *hw, unsigned long rate,
129128
u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE;
130129
int ret;
131130

132-
ret = raspberrypi_clock_property(rpi->firmware,
131+
ret = raspberrypi_clock_property(rpi->firmware, data,
133132
RPI_FIRMWARE_SET_CLOCK_RATE,
134-
data->id, &new_rate);
133+
&new_rate);
135134
if (ret)
136135
dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d",
137136
clk_hw_get_name(hw), ret);
@@ -194,18 +193,18 @@ static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi)
194193
init.flags = CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED;
195194

196195
/* Get min & max rates set by the firmware */
197-
ret = raspberrypi_clock_property(rpi->firmware,
196+
ret = raspberrypi_clock_property(rpi->firmware, data,
198197
RPI_FIRMWARE_GET_MIN_CLOCK_RATE,
199-
data->id, &min_rate);
198+
&min_rate);
200199
if (ret) {
201200
dev_err(rpi->dev, "Failed to get %s min freq: %d\n",
202201
init.name, ret);
203202
return ret;
204203
}
205204

206-
ret = raspberrypi_clock_property(rpi->firmware,
205+
ret = raspberrypi_clock_property(rpi->firmware, data,
207206
RPI_FIRMWARE_GET_MAX_CLOCK_RATE,
208-
data->id, &max_rate);
207+
&max_rate);
209208
if (ret) {
210209
dev_err(rpi->dev, "Failed to get %s max freq: %d\n",
211210
init.name, ret);

0 commit comments

Comments
 (0)