+1
-1
Documentation/devicetree/bindings/clock/at91-clock.txt
+1
-1
Documentation/devicetree/bindings/clock/at91-clock.txt
···
248
248
- #address-cells : shall be 1 (reg is used to encode clk id).
249
249
- clocks : shall be the master clock phandle.
250
250
e.g. clocks = <&mck>;
251
-
- name: device tree node describing a specific system clock.
251
+
- name: device tree node describing a specific peripheral clock.
252
252
* #clock-cells : from common clock binding; shall be set to 0.
253
253
* reg: peripheral id. See Atmel's datasheets to get a full
254
254
list of peripheral ids.
+4
-4
drivers/clk/at91/clk-peripheral.c
+4
-4
drivers/clk/at91/clk-peripheral.c
···
29
29
#define PERIPHERAL_RSHIFT_MASK 0x3
30
30
#define PERIPHERAL_RSHIFT(val) (((val) >> 16) & PERIPHERAL_RSHIFT_MASK)
31
31
32
-
#define PERIPHERAL_MAX_SHIFT 4
32
+
#define PERIPHERAL_MAX_SHIFT 3
33
33
34
34
struct clk_peripheral {
35
35
struct clk_hw hw;
···
242
242
return *parent_rate;
243
243
244
244
if (periph->range.max) {
245
-
for (; shift < PERIPHERAL_MAX_SHIFT; shift++) {
245
+
for (; shift <= PERIPHERAL_MAX_SHIFT; shift++) {
246
246
cur_rate = *parent_rate >> shift;
247
247
if (cur_rate <= periph->range.max)
248
248
break;
···
254
254
255
255
best_diff = cur_rate - rate;
256
256
best_rate = cur_rate;
257
-
for (; shift < PERIPHERAL_MAX_SHIFT; shift++) {
257
+
for (; shift <= PERIPHERAL_MAX_SHIFT; shift++) {
258
258
cur_rate = *parent_rate >> shift;
259
259
if (cur_rate < rate)
260
260
cur_diff = rate - cur_rate;
···
289
289
if (periph->range.max && rate > periph->range.max)
290
290
return -EINVAL;
291
291
292
-
for (shift = 0; shift < PERIPHERAL_MAX_SHIFT; shift++) {
292
+
for (shift = 0; shift <= PERIPHERAL_MAX_SHIFT; shift++) {
293
293
if (parent_rate >> shift == rate) {
294
294
periph->auto_div = false;
295
295
periph->div = shift;
+10
-2
drivers/clk/at91/clk-pll.c
+10
-2
drivers/clk/at91/clk-pll.c
···
173
173
int i = 0;
174
174
175
175
/* Check if parent_rate is a valid input rate */
176
-
if (parent_rate < characteristics->input.min ||
177
-
parent_rate > characteristics->input.max)
176
+
if (parent_rate < characteristics->input.min)
178
177
return -ERANGE;
179
178
180
179
/*
···
185
186
mindiv = (parent_rate * PLL_MUL_MIN) / rate;
186
187
if (!mindiv)
187
188
mindiv = 1;
189
+
190
+
if (parent_rate > characteristics->input.max) {
191
+
tmpdiv = DIV_ROUND_UP(parent_rate, characteristics->input.max);
192
+
if (tmpdiv > PLL_DIV_MAX)
193
+
return -ERANGE;
194
+
195
+
if (tmpdiv > mindiv)
196
+
mindiv = tmpdiv;
197
+
}
188
198
189
199
/*
190
200
* Calculate the maximum divider which is limited by PLL register