Commit 42d158c
FROMLIST: i2c: ls2x: Add clocks property parsing and adjust bus speed
The i2c-ls2x driver supports dts and acpi parameter passing.
In dts, uses clock framework, by parsing clocks property to
get i2c bus reference clock, and define the div of reference
clock by device data.
In acpi, by passing clocks property to describe i2c bus reference
clock and clock-div property to describe the div of reference clock.
Based on i2c bus reference clock(clock_a), i2c bus speed(clock_s)
and div, calculate the prcescale of i2c divider register. The
calculation formula is
prcescale = (clock_a*10)/(div*clock_s)-1
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
Link: https://lore.kernel.org/loongarch/20260608024533.32419-1-wanghongliang@loongson.cn/
Signed-off-by: Mingcong Bai <jeffbai@aosc.io>1 parent 91be652 commit 42d158c
1 file changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| |||
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| 107 | + | |
| 108 | + | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
| |||
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
110 | 139 | | |
111 | 140 | | |
112 | 141 | | |
113 | 142 | | |
114 | 143 | | |
115 | | - | |
116 | 144 | | |
117 | 145 | | |
118 | 146 | | |
| |||
295 | 323 | | |
296 | 324 | | |
297 | 325 | | |
| 326 | + | |
| 327 | + | |
298 | 328 | | |
299 | 329 | | |
300 | 330 | | |
| |||
349 | 379 | | |
350 | 380 | | |
351 | 381 | | |
352 | | - | |
353 | | - | |
| 382 | + | |
| 383 | + | |
354 | 384 | | |
355 | 385 | | |
356 | 386 | | |
| |||
0 commit comments