@@ -102,8 +102,8 @@ static int raspberrypi_fw_is_prepared(struct clk_hw *hw)
102
102
}
103
103
104
104
105
- static unsigned long raspberrypi_fw_pll_get_rate (struct clk_hw * hw ,
106
- unsigned long parent_rate )
105
+ static unsigned long raspberrypi_fw_get_rate (struct clk_hw * hw ,
106
+ unsigned long parent_rate )
107
107
{
108
108
struct raspberrypi_clk_data * data =
109
109
container_of (hw , struct raspberrypi_clk_data , hw );
@@ -116,28 +116,42 @@ static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw,
116
116
if (ret )
117
117
return ret ;
118
118
119
- return val * RPI_FIRMWARE_PLLB_ARM_DIV_RATE ;
119
+ return val ;
120
120
}
121
121
122
- static int raspberrypi_fw_pll_set_rate (struct clk_hw * hw , unsigned long rate ,
123
- unsigned long parent_rate )
122
+ static unsigned long raspberrypi_fw_pll_get_rate (struct clk_hw * hw ,
123
+ unsigned long parent_rate )
124
+ {
125
+ return raspberrypi_fw_get_rate (hw , parent_rate ) *
126
+ RPI_FIRMWARE_PLLB_ARM_DIV_RATE ;
127
+ }
128
+
129
+ static int raspberrypi_fw_set_rate (struct clk_hw * hw , unsigned long rate ,
130
+ unsigned long parent_rate )
124
131
{
125
132
struct raspberrypi_clk_data * data =
126
133
container_of (hw , struct raspberrypi_clk_data , hw );
127
134
struct raspberrypi_clk * rpi = data -> rpi ;
128
- u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE ;
135
+ u32 _rate = rate ;
129
136
int ret ;
130
137
131
138
ret = raspberrypi_clock_property (rpi -> firmware , data ,
132
- RPI_FIRMWARE_SET_CLOCK_RATE ,
133
- & new_rate );
139
+ RPI_FIRMWARE_SET_CLOCK_RATE , & _rate );
134
140
if (ret )
135
141
dev_err_ratelimited (rpi -> dev , "Failed to change %s frequency: %d" ,
136
142
clk_hw_get_name (hw ), ret );
137
143
138
144
return ret ;
139
145
}
140
146
147
+ static int raspberrypi_fw_pll_set_rate (struct clk_hw * hw , unsigned long rate ,
148
+ unsigned long parent_rate )
149
+ {
150
+ u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE ;
151
+
152
+ return raspberrypi_fw_set_rate (hw , new_rate , parent_rate );
153
+ }
154
+
141
155
/*
142
156
* Sadly there is no firmware rate rounding interface. We borrowed it from
143
157
* clk-bcm2835.
0 commit comments