diff options
233 files changed, 11389 insertions, 5145 deletions
diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt index 1608a54e90e1..68ac65f82a1c 100644 --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt | |||
@@ -9,6 +9,7 @@ Required properties: | |||
9 | - compatible : Should contain "nvidia,tegra<chip>-pmc". | 9 | - compatible : Should contain "nvidia,tegra<chip>-pmc". |
10 | - reg : Offset and length of the register set for the device | 10 | - reg : Offset and length of the register set for the device |
11 | - clocks : Must contain an entry for each entry in clock-names. | 11 | - clocks : Must contain an entry for each entry in clock-names. |
12 | See ../clocks/clock-bindings.txt for details. | ||
12 | - clock-names : Must include the following entries: | 13 | - clock-names : Must include the following entries: |
13 | "pclk" (The Tegra clock of that name), | 14 | "pclk" (The Tegra clock of that name), |
14 | "clk32k_in" (The 32KHz clock input to Tegra). | 15 | "clk32k_in" (The 32KHz clock input to Tegra). |
diff --git a/Documentation/devicetree/bindings/clock/at91-clock.txt b/Documentation/devicetree/bindings/clock/at91-clock.txt new file mode 100644 index 000000000000..cd5e23912888 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/at91-clock.txt | |||
@@ -0,0 +1,339 @@ | |||
1 | Device Tree Clock bindings for arch-at91 | ||
2 | |||
3 | This binding uses the common clock binding[1]. | ||
4 | |||
5 | [1] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
6 | |||
7 | Required properties: | ||
8 | - compatible : shall be one of the following: | ||
9 | "atmel,at91rm9200-pmc" or | ||
10 | "atmel,at91sam9g45-pmc" or | ||
11 | "atmel,at91sam9n12-pmc" or | ||
12 | "atmel,at91sam9x5-pmc" or | ||
13 | "atmel,sama5d3-pmc": | ||
14 | at91 PMC (Power Management Controller) | ||
15 | All at91 specific clocks (clocks defined below) must be child | ||
16 | node of the PMC node. | ||
17 | |||
18 | "atmel,at91rm9200-clk-main": | ||
19 | at91 main oscillator | ||
20 | |||
21 | "atmel,at91rm9200-clk-master" or | ||
22 | "atmel,at91sam9x5-clk-master": | ||
23 | at91 master clock | ||
24 | |||
25 | "atmel,at91sam9x5-clk-peripheral" or | ||
26 | "atmel,at91rm9200-clk-peripheral": | ||
27 | at91 peripheral clocks | ||
28 | |||
29 | "atmel,at91rm9200-clk-pll" or | ||
30 | "atmel,at91sam9g45-clk-pll" or | ||
31 | "atmel,at91sam9g20-clk-pllb" or | ||
32 | "atmel,sama5d3-clk-pll": | ||
33 | at91 pll clocks | ||
34 | |||
35 | "atmel,at91sam9x5-clk-plldiv": | ||
36 | at91 plla divisor | ||
37 | |||
38 | "atmel,at91rm9200-clk-programmable" or | ||
39 | "atmel,at91sam9g45-clk-programmable" or | ||
40 | "atmel,at91sam9x5-clk-programmable": | ||
41 | at91 programmable clocks | ||
42 | |||
43 | "atmel,at91sam9x5-clk-smd": | ||
44 | at91 SMD (Soft Modem) clock | ||
45 | |||
46 | "atmel,at91rm9200-clk-system": | ||
47 | at91 system clocks | ||
48 | |||
49 | "atmel,at91rm9200-clk-usb" or | ||
50 | "atmel,at91sam9x5-clk-usb" or | ||
51 | "atmel,at91sam9n12-clk-usb": | ||
52 | at91 usb clock | ||
53 | |||
54 | "atmel,at91sam9x5-clk-utmi": | ||
55 | at91 utmi clock | ||
56 | |||
57 | Required properties for PMC node: | ||
58 | - reg : defines the IO memory reserved for the PMC. | ||
59 | - #size-cells : shall be 0 (reg is used to encode clk id). | ||
60 | - #address-cells : shall be 1 (reg is used to encode clk id). | ||
61 | - interrupts : shall be set to PMC interrupt line. | ||
62 | - interrupt-controller : tell that the PMC is an interrupt controller. | ||
63 | - #interrupt-cells : must be set to 1. The first cell encodes the interrupt id, | ||
64 | and reflect the bit position in the PMC_ER/DR/SR registers. | ||
65 | You can use the dt macros defined in dt-bindings/clk/at91.h. | ||
66 | 0 (AT91_PMC_MOSCS) -> main oscillator ready | ||
67 | 1 (AT91_PMC_LOCKA) -> PLL A ready | ||
68 | 2 (AT91_PMC_LOCKB) -> PLL B ready | ||
69 | 3 (AT91_PMC_MCKRDY) -> master clock ready | ||
70 | 6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready | ||
71 | 8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready | ||
72 | 16 (AT91_PMC_MOSCSELS) -> main oscillator selected | ||
73 | 17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized | ||
74 | 18 (AT91_PMC_CFDEV) -> clock failure detected | ||
75 | |||
76 | For example: | ||
77 | pmc: pmc@fffffc00 { | ||
78 | compatible = "atmel,sama5d3-pmc"; | ||
79 | interrupts = <1 4 7>; | ||
80 | interrupt-controller; | ||
81 | #interrupt-cells = <2>; | ||
82 | #size-cells = <0>; | ||
83 | #address-cells = <1>; | ||
84 | |||
85 | /* put at91 clocks here */ | ||
86 | }; | ||
87 | |||
88 | Required properties for main clock: | ||
89 | - interrupt-parent : must reference the PMC node. | ||
90 | - interrupts : shall be set to "<0>". | ||
91 | - #clock-cells : from common clock binding; shall be set to 0. | ||
92 | - clocks (optional if clock-frequency is provided) : shall be the slow clock | ||
93 | phandle. This clock is used to calculate the main clock rate if | ||
94 | "clock-frequency" is not provided. | ||
95 | - clock-frequency : the main oscillator frequency.Prefer the use of | ||
96 | "clock-frequency" over automatic clock rate calculation. | ||
97 | |||
98 | For example: | ||
99 | main: mainck { | ||
100 | compatible = "atmel,at91rm9200-clk-main"; | ||
101 | interrupt-parent = <&pmc>; | ||
102 | interrupts = <0>; | ||
103 | #clock-cells = <0>; | ||
104 | clocks = <&ck32k>; | ||
105 | clock-frequency = <18432000>; | ||
106 | }; | ||
107 | |||
108 | Required properties for master clock: | ||
109 | - interrupt-parent : must reference the PMC node. | ||
110 | - interrupts : shall be set to "<3>". | ||
111 | - #clock-cells : from common clock binding; shall be set to 0. | ||
112 | - clocks : shall be the master clock sources (see atmel datasheet) phandles. | ||
113 | e.g. "<&ck32k>, <&main>, <&plla>, <&pllb>". | ||
114 | - atmel,clk-output-range : minimum and maximum clock frequency (two u32 | ||
115 | fields). | ||
116 | e.g. output = <0 133000000>; <=> 0 to 133MHz. | ||
117 | - atmel,clk-divisors : master clock divisors table (four u32 fields). | ||
118 | 0 <=> reserved value. | ||
119 | e.g. divisors = <1 2 4 6>; | ||
120 | - atmel,master-clk-have-div3-pres : some SoC use the reserved value 7 in the | ||
121 | PRES field as CLOCK_DIV3 (e.g sam9x5). | ||
122 | |||
123 | For example: | ||
124 | mck: mck { | ||
125 | compatible = "atmel,at91rm9200-clk-master"; | ||
126 | interrupt-parent = <&pmc>; | ||
127 | interrupts = <3>; | ||
128 | #clock-cells = <0>; | ||
129 | atmel,clk-output-range = <0 133000000>; | ||
130 | atmel,clk-divisors = <1 2 4 0>; | ||
131 | }; | ||
132 | |||
133 | Required properties for peripheral clocks: | ||
134 | - #size-cells : shall be 0 (reg is used to encode clk id). | ||
135 | - #address-cells : shall be 1 (reg is used to encode clk id). | ||
136 | - clocks : shall be the master clock phandle. | ||
137 | e.g. clocks = <&mck>; | ||
138 | - name: device tree node describing a specific system clock. | ||
139 | * #clock-cells : from common clock binding; shall be set to 0. | ||
140 | * reg: peripheral id. See Atmel's datasheets to get a full | ||
141 | list of peripheral ids. | ||
142 | * atmel,clk-output-range : minimum and maximum clock frequency | ||
143 | (two u32 fields). Only valid on at91sam9x5-clk-peripheral | ||
144 | compatible IPs. | ||
145 | |||
146 | For example: | ||
147 | periph: periphck { | ||
148 | compatible = "atmel,at91sam9x5-clk-peripheral"; | ||
149 | #size-cells = <0>; | ||
150 | #address-cells = <1>; | ||
151 | clocks = <&mck>; | ||
152 | |||
153 | ssc0_clk { | ||
154 | #clock-cells = <0>; | ||
155 | reg = <2>; | ||
156 | atmel,clk-output-range = <0 133000000>; | ||
157 | }; | ||
158 | |||
159 | usart0_clk { | ||
160 | #clock-cells = <0>; | ||
161 | reg = <3>; | ||
162 | atmel,clk-output-range = <0 66000000>; | ||
163 | }; | ||
164 | }; | ||
165 | |||
166 | |||
167 | Required properties for pll clocks: | ||
168 | - interrupt-parent : must reference the PMC node. | ||
169 | - interrupts : shall be set to "<1>". | ||
170 | - #clock-cells : from common clock binding; shall be set to 0. | ||
171 | - clocks : shall be the main clock phandle. | ||
172 | - reg : pll id. | ||
173 | 0 -> PLL A | ||
174 | 1 -> PLL B | ||
175 | - atmel,clk-input-range : minimum and maximum source clock frequency (two u32 | ||
176 | fields). | ||
177 | e.g. input = <1 32000000>; <=> 1 to 32MHz. | ||
178 | - #atmel,pll-clk-output-range-cells : number of cells reserved for pll output | ||
179 | range description. Sould be set to 2, 3 | ||
180 | or 4. | ||
181 | * 1st and 2nd cells represent the frequency range (min-max). | ||
182 | * 3rd cell is optional and represents the OUT field value for the given | ||
183 | range. | ||
184 | * 4th cell is optional and represents the ICPLL field (PLLICPR | ||
185 | register) | ||
186 | - atmel,pll-clk-output-ranges : pll output frequency ranges + optional parameter | ||
187 | depending on #atmel,pll-output-range-cells | ||
188 | property value. | ||
189 | |||
190 | For example: | ||
191 | plla: pllack { | ||
192 | compatible = "atmel,at91sam9g45-clk-pll"; | ||
193 | interrupt-parent = <&pmc>; | ||
194 | interrupts = <1>; | ||
195 | #clock-cells = <0>; | ||
196 | clocks = <&main>; | ||
197 | reg = <0>; | ||
198 | atmel,clk-input-range = <2000000 32000000>; | ||
199 | #atmel,pll-clk-output-range-cells = <4>; | ||
200 | atmel,pll-clk-output-ranges = <74500000 800000000 0 0 | ||
201 | 69500000 750000000 1 0 | ||
202 | 64500000 700000000 2 0 | ||
203 | 59500000 650000000 3 0 | ||
204 | 54500000 600000000 0 1 | ||
205 | 49500000 550000000 1 1 | ||
206 | 44500000 500000000 2 1 | ||
207 | 40000000 450000000 3 1>; | ||
208 | }; | ||
209 | |||
210 | Required properties for plldiv clocks (plldiv = pll / 2): | ||
211 | - #clock-cells : from common clock binding; shall be set to 0. | ||
212 | - clocks : shall be the plla clock phandle. | ||
213 | |||
214 | The pll divisor is equal to 2 and cannot be changed. | ||
215 | |||
216 | For example: | ||
217 | plladiv: plladivck { | ||
218 | compatible = "atmel,at91sam9x5-clk-plldiv"; | ||
219 | #clock-cells = <0>; | ||
220 | clocks = <&plla>; | ||
221 | }; | ||
222 | |||
223 | Required properties for programmable clocks: | ||
224 | - interrupt-parent : must reference the PMC node. | ||
225 | - #size-cells : shall be 0 (reg is used to encode clk id). | ||
226 | - #address-cells : shall be 1 (reg is used to encode clk id). | ||
227 | - clocks : shall be the programmable clock source phandles. | ||
228 | e.g. clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; | ||
229 | - name: device tree node describing a specific prog clock. | ||
230 | * #clock-cells : from common clock binding; shall be set to 0. | ||
231 | * reg : programmable clock id (register offset from PCKx | ||
232 | register). | ||
233 | * interrupts : shall be set to "<(8 + id)>". | ||
234 | |||
235 | For example: | ||
236 | prog: progck { | ||
237 | compatible = "atmel,at91sam9g45-clk-programmable"; | ||
238 | #size-cells = <0>; | ||
239 | #address-cells = <1>; | ||
240 | interrupt-parent = <&pmc>; | ||
241 | clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>; | ||
242 | |||
243 | prog0 { | ||
244 | #clock-cells = <0>; | ||
245 | reg = <0>; | ||
246 | interrupts = <8>; | ||
247 | }; | ||
248 | |||
249 | prog1 { | ||
250 | #clock-cells = <0>; | ||
251 | reg = <1>; | ||
252 | interrupts = <9>; | ||
253 | }; | ||
254 | }; | ||
255 | |||
256 | |||
257 | Required properties for smd clock: | ||
258 | - #clock-cells : from common clock binding; shall be set to 0. | ||
259 | - clocks : shall be the smd clock source phandles. | ||
260 | e.g. clocks = <&plladiv>, <&utmi>; | ||
261 | |||
262 | For example: | ||
263 | smd: smdck { | ||
264 | compatible = "atmel,at91sam9x5-clk-smd"; | ||
265 | #clock-cells = <0>; | ||
266 | clocks = <&plladiv>, <&utmi>; | ||
267 | }; | ||
268 | |||
269 | Required properties for system clocks: | ||
270 | - #size-cells : shall be 0 (reg is used to encode clk id). | ||
271 | - #address-cells : shall be 1 (reg is used to encode clk id). | ||
272 | - name: device tree node describing a specific system clock. | ||
273 | * #clock-cells : from common clock binding; shall be set to 0. | ||
274 | * reg: system clock id (bit position in SCER/SCDR/SCSR registers). | ||
275 | See Atmel's datasheet to get a full list of system clock ids. | ||
276 | |||
277 | For example: | ||
278 | system: systemck { | ||
279 | compatible = "atmel,at91rm9200-clk-system"; | ||
280 | #address-cells = <1>; | ||
281 | #size-cells = <0>; | ||
282 | |||
283 | ddrck { | ||
284 | #clock-cells = <0>; | ||
285 | reg = <2>; | ||
286 | clocks = <&mck>; | ||
287 | }; | ||
288 | |||
289 | uhpck { | ||
290 | #clock-cells = <0>; | ||
291 | reg = <6>; | ||
292 | clocks = <&usb>; | ||
293 | }; | ||
294 | |||
295 | udpck { | ||
296 | #clock-cells = <0>; | ||
297 | reg = <7>; | ||
298 | clocks = <&usb>; | ||
299 | }; | ||
300 | }; | ||
301 | |||
302 | |||
303 | Required properties for usb clock: | ||
304 | - #clock-cells : from common clock binding; shall be set to 0. | ||
305 | - clocks : shall be the smd clock source phandles. | ||
306 | e.g. clocks = <&pllb>; | ||
307 | - atmel,clk-divisors (only available for "atmel,at91rm9200-clk-usb"): | ||
308 | usb clock divisor table. | ||
309 | e.g. divisors = <1 2 4 0>; | ||
310 | |||
311 | For example: | ||
312 | usb: usbck { | ||
313 | compatible = "atmel,at91sam9x5-clk-usb"; | ||
314 | #clock-cells = <0>; | ||
315 | clocks = <&plladiv>, <&utmi>; | ||
316 | }; | ||
317 | |||
318 | usb: usbck { | ||
319 | compatible = "atmel,at91rm9200-clk-usb"; | ||
320 | #clock-cells = <0>; | ||
321 | clocks = <&pllb>; | ||
322 | atmel,clk-divisors = <1 2 4 0>; | ||
323 | }; | ||
324 | |||
325 | |||
326 | Required properties for utmi clock: | ||
327 | - interrupt-parent : must reference the PMC node. | ||
328 | - interrupts : shall be set to "<AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>". | ||
329 | - #clock-cells : from common clock binding; shall be set to 0. | ||
330 | - clocks : shall be the main clock source phandle. | ||
331 | |||
332 | For example: | ||
333 | utmi: utmick { | ||
334 | compatible = "atmel,at91sam9x5-clk-utmi"; | ||
335 | interrupt-parent = <&pmc>; | ||
336 | interrupts = <AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>; | ||
337 | #clock-cells = <0>; | ||
338 | clocks = <&main>; | ||
339 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt index 0c80c2677104..9acea9d93160 100644 --- a/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt | |||
@@ -15,6 +15,9 @@ Required properties : | |||
15 | In clock consumers, this cell represents the clock ID exposed by the | 15 | In clock consumers, this cell represents the clock ID exposed by the |
16 | CAR. The assignments may be found in header file | 16 | CAR. The assignments may be found in header file |
17 | <dt-bindings/clock/tegra114-car.h>. | 17 | <dt-bindings/clock/tegra114-car.h>. |
18 | - #reset-cells : Should be 1. | ||
19 | In clock consumers, this cell represents the bit number in the CAR's | ||
20 | array of CLK_RST_CONTROLLER_RST_DEVICES_* registers. | ||
18 | 21 | ||
19 | Example SoC include file: | 22 | Example SoC include file: |
20 | 23 | ||
@@ -23,6 +26,7 @@ Example SoC include file: | |||
23 | compatible = "nvidia,tegra114-car"; | 26 | compatible = "nvidia,tegra114-car"; |
24 | reg = <0x60006000 0x1000>; | 27 | reg = <0x60006000 0x1000>; |
25 | #clock-cells = <1>; | 28 | #clock-cells = <1>; |
29 | #reset-cells = <1>; | ||
26 | }; | 30 | }; |
27 | 31 | ||
28 | usb@c5004000 { | 32 | usb@c5004000 { |
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt new file mode 100644 index 000000000000..ded5d6212c84 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt | |||
@@ -0,0 +1,63 @@ | |||
1 | NVIDIA Tegra124 Clock And Reset Controller | ||
2 | |||
3 | This binding uses the common clock binding: | ||
4 | Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
5 | |||
6 | The CAR (Clock And Reset) Controller on Tegra is the HW module responsible | ||
7 | for muxing and gating Tegra's clocks, and setting their rates. | ||
8 | |||
9 | Required properties : | ||
10 | - compatible : Should be "nvidia,tegra124-car" | ||
11 | - reg : Should contain CAR registers location and length | ||
12 | - clocks : Should contain phandle and clock specifiers for two clocks: | ||
13 | the 32 KHz "32k_in", and the board-specific oscillator "osc". | ||
14 | - #clock-cells : Should be 1. | ||
15 | In clock consumers, this cell represents the clock ID exposed by the | ||
16 | CAR. The assignments may be found in header file | ||
17 | <dt-bindings/clock/tegra124-car.h>. | ||
18 | - #reset-cells : Should be 1. | ||
19 | In clock consumers, this cell represents the bit number in the CAR's | ||
20 | array of CLK_RST_CONTROLLER_RST_DEVICES_* registers. | ||
21 | |||
22 | Example SoC include file: | ||
23 | |||
24 | / { | ||
25 | tegra_car: clock { | ||
26 | compatible = "nvidia,tegra124-car"; | ||
27 | reg = <0x60006000 0x1000>; | ||
28 | #clock-cells = <1>; | ||
29 | #reset-cells = <1>; | ||
30 | }; | ||
31 | |||
32 | usb@c5004000 { | ||
33 | clocks = <&tegra_car TEGRA124_CLK_USB2>; | ||
34 | }; | ||
35 | }; | ||
36 | |||
37 | Example board file: | ||
38 | |||
39 | / { | ||
40 | clocks { | ||
41 | compatible = "simple-bus"; | ||
42 | #address-cells = <1>; | ||
43 | #size-cells = <0>; | ||
44 | |||
45 | osc: clock@0 { | ||
46 | compatible = "fixed-clock"; | ||
47 | reg = <0>; | ||
48 | #clock-cells = <0>; | ||
49 | clock-frequency = <112400000>; | ||
50 | }; | ||
51 | |||
52 | clk_32k: clock@1 { | ||
53 | compatible = "fixed-clock"; | ||
54 | reg = <1>; | ||
55 | #clock-cells = <0>; | ||
56 | clock-frequency = <32768>; | ||
57 | }; | ||
58 | }; | ||
59 | |||
60 | &tegra_car { | ||
61 | clocks = <&clk_32k> <&osc>; | ||
62 | }; | ||
63 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt index fcfed5bf73fb..6c5901b503d0 100644 --- a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt | |||
@@ -15,6 +15,9 @@ Required properties : | |||
15 | In clock consumers, this cell represents the clock ID exposed by the | 15 | In clock consumers, this cell represents the clock ID exposed by the |
16 | CAR. The assignments may be found in header file | 16 | CAR. The assignments may be found in header file |
17 | <dt-bindings/clock/tegra20-car.h>. | 17 | <dt-bindings/clock/tegra20-car.h>. |
18 | - #reset-cells : Should be 1. | ||
19 | In clock consumers, this cell represents the bit number in the CAR's | ||
20 | array of CLK_RST_CONTROLLER_RST_DEVICES_* registers. | ||
18 | 21 | ||
19 | Example SoC include file: | 22 | Example SoC include file: |
20 | 23 | ||
@@ -23,6 +26,7 @@ Example SoC include file: | |||
23 | compatible = "nvidia,tegra20-car"; | 26 | compatible = "nvidia,tegra20-car"; |
24 | reg = <0x60006000 0x1000>; | 27 | reg = <0x60006000 0x1000>; |
25 | #clock-cells = <1>; | 28 | #clock-cells = <1>; |
29 | #reset-cells = <1>; | ||
26 | }; | 30 | }; |
27 | 31 | ||
28 | usb@c5004000 { | 32 | usb@c5004000 { |
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt index 0f714081e986..63618cde12df 100644 --- a/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt | |||
@@ -15,6 +15,9 @@ Required properties : | |||
15 | In clock consumers, this cell represents the clock ID exposed by the | 15 | In clock consumers, this cell represents the clock ID exposed by the |
16 | CAR. The assignments may be found in header file | 16 | CAR. The assignments may be found in header file |
17 | <dt-bindings/clock/tegra30-car.h>. | 17 | <dt-bindings/clock/tegra30-car.h>. |
18 | - #reset-cells : Should be 1. | ||
19 | In clock consumers, this cell represents the bit number in the CAR's | ||
20 | array of CLK_RST_CONTROLLER_RST_DEVICES_* registers. | ||
18 | 21 | ||
19 | Example SoC include file: | 22 | Example SoC include file: |
20 | 23 | ||
@@ -23,6 +26,7 @@ Example SoC include file: | |||
23 | compatible = "nvidia,tegra30-car"; | 26 | compatible = "nvidia,tegra30-car"; |
24 | reg = <0x60006000 0x1000>; | 27 | reg = <0x60006000 0x1000>; |
25 | #clock-cells = <1>; | 28 | #clock-cells = <1>; |
29 | #reset-cells = <1>; | ||
26 | }; | 30 | }; |
27 | 31 | ||
28 | usb@c5004000 { | 32 | usb@c5004000 { |
diff --git a/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt index 90fa7da525b8..c6908e7c42cc 100644 --- a/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt +++ b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt | |||
@@ -5,6 +5,16 @@ Required properties: | |||
5 | - reg: Should contain DMA registers location and length. This shuld include | 5 | - reg: Should contain DMA registers location and length. This shuld include |
6 | all of the per-channel registers. | 6 | all of the per-channel registers. |
7 | - interrupts: Should contain all of the per-channel DMA interrupts. | 7 | - interrupts: Should contain all of the per-channel DMA interrupts. |
8 | - clocks: Must contain one entry, for the module clock. | ||
9 | See ../clocks/clock-bindings.txt for details. | ||
10 | - resets : Must contain an entry for each entry in reset-names. | ||
11 | See ../reset/reset.txt for details. | ||
12 | - reset-names : Must include the following entries: | ||
13 | - dma | ||
14 | - #dma-cells : Must be <1>. This dictates the length of DMA specifiers in | ||
15 | client nodes' dmas properties. The specifier represents the DMA request | ||
16 | select value for the peripheral. For more details, consult the Tegra TRM's | ||
17 | documentation of the APB DMA channel control register REQ_SEL field. | ||
8 | 18 | ||
9 | Examples: | 19 | Examples: |
10 | 20 | ||
@@ -27,4 +37,8 @@ apbdma: dma@6000a000 { | |||
27 | 0 149 0x04 | 37 | 0 149 0x04 |
28 | 0 150 0x04 | 38 | 0 150 0x04 |
29 | 0 151 0x04 >; | 39 | 0 151 0x04 >; |
40 | clocks = <&tegra_car 34>; | ||
41 | resets = <&tegra_car 34>; | ||
42 | reset-names = "dma"; | ||
43 | #dma-cells = <1>; | ||
30 | }; | 44 | }; |
diff --git a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt index b4fa934ae3a2..ab45c02aa658 100644 --- a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt +++ b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt | |||
@@ -9,6 +9,12 @@ Required properties: | |||
9 | - #size-cells: The number of cells used to represent the size of an address | 9 | - #size-cells: The number of cells used to represent the size of an address |
10 | range in the host1x address space. Should be 1. | 10 | range in the host1x address space. Should be 1. |
11 | - ranges: The mapping of the host1x address space to the CPU address space. | 11 | - ranges: The mapping of the host1x address space to the CPU address space. |
12 | - clocks: Must contain one entry, for the module clock. | ||
13 | See ../clocks/clock-bindings.txt for details. | ||
14 | - resets: Must contain an entry for each entry in reset-names. | ||
15 | See ../reset/reset.txt for details. | ||
16 | - reset-names: Must include the following entries: | ||
17 | - host1x | ||
12 | 18 | ||
13 | The host1x top-level node defines a number of children, each representing one | 19 | The host1x top-level node defines a number of children, each representing one |
14 | of the following host1x client modules: | 20 | of the following host1x client modules: |
@@ -19,6 +25,12 @@ of the following host1x client modules: | |||
19 | - compatible: "nvidia,tegra<chip>-mpe" | 25 | - compatible: "nvidia,tegra<chip>-mpe" |
20 | - reg: Physical base address and length of the controller's registers. | 26 | - reg: Physical base address and length of the controller's registers. |
21 | - interrupts: The interrupt outputs from the controller. | 27 | - interrupts: The interrupt outputs from the controller. |
28 | - clocks: Must contain one entry, for the module clock. | ||
29 | See ../clocks/clock-bindings.txt for details. | ||
30 | - resets: Must contain an entry for each entry in reset-names. | ||
31 | See ../reset/reset.txt for details. | ||
32 | - reset-names: Must include the following entries: | ||
33 | - mpe | ||
22 | 34 | ||
23 | - vi: video input | 35 | - vi: video input |
24 | 36 | ||
@@ -26,6 +38,12 @@ of the following host1x client modules: | |||
26 | - compatible: "nvidia,tegra<chip>-vi" | 38 | - compatible: "nvidia,tegra<chip>-vi" |
27 | - reg: Physical base address and length of the controller's registers. | 39 | - reg: Physical base address and length of the controller's registers. |
28 | - interrupts: The interrupt outputs from the controller. | 40 | - interrupts: The interrupt outputs from the controller. |
41 | - clocks: Must contain one entry, for the module clock. | ||
42 | See ../clocks/clock-bindings.txt for details. | ||
43 | - resets: Must contain an entry for each entry in reset-names. | ||
44 | See ../reset/reset.txt for details. | ||
45 | - reset-names: Must include the following entries: | ||
46 | - vi | ||
29 | 47 | ||
30 | - epp: encoder pre-processor | 48 | - epp: encoder pre-processor |
31 | 49 | ||
@@ -33,6 +51,12 @@ of the following host1x client modules: | |||
33 | - compatible: "nvidia,tegra<chip>-epp" | 51 | - compatible: "nvidia,tegra<chip>-epp" |
34 | - reg: Physical base address and length of the controller's registers. | 52 | - reg: Physical base address and length of the controller's registers. |
35 | - interrupts: The interrupt outputs from the controller. | 53 | - interrupts: The interrupt outputs from the controller. |
54 | - clocks: Must contain one entry, for the module clock. | ||
55 | See ../clocks/clock-bindings.txt for details. | ||
56 | - resets: Must contain an entry for each entry in reset-names. | ||
57 | See ../reset/reset.txt for details. | ||
58 | - reset-names: Must include the following entries: | ||
59 | - epp | ||
36 | 60 | ||
37 | - isp: image signal processor | 61 | - isp: image signal processor |
38 | 62 | ||
@@ -40,6 +64,12 @@ of the following host1x client modules: | |||
40 | - compatible: "nvidia,tegra<chip>-isp" | 64 | - compatible: "nvidia,tegra<chip>-isp" |
41 | - reg: Physical base address and length of the controller's registers. | 65 | - reg: Physical base address and length of the controller's registers. |
42 | - interrupts: The interrupt outputs from the controller. | 66 | - interrupts: The interrupt outputs from the controller. |
67 | - clocks: Must contain one entry, for the module clock. | ||
68 | See ../clocks/clock-bindings.txt for details. | ||
69 | - resets: Must contain an entry for each entry in reset-names. | ||
70 | See ../reset/reset.txt for details. | ||
71 | - reset-names: Must include the following entries: | ||
72 | - isp | ||
43 | 73 | ||
44 | - gr2d: 2D graphics engine | 74 | - gr2d: 2D graphics engine |
45 | 75 | ||
@@ -47,12 +77,30 @@ of the following host1x client modules: | |||
47 | - compatible: "nvidia,tegra<chip>-gr2d" | 77 | - compatible: "nvidia,tegra<chip>-gr2d" |
48 | - reg: Physical base address and length of the controller's registers. | 78 | - reg: Physical base address and length of the controller's registers. |
49 | - interrupts: The interrupt outputs from the controller. | 79 | - interrupts: The interrupt outputs from the controller. |
80 | - clocks: Must contain one entry, for the module clock. | ||
81 | See ../clocks/clock-bindings.txt for details. | ||
82 | - resets: Must contain an entry for each entry in reset-names. | ||
83 | See ../reset/reset.txt for details. | ||
84 | - reset-names: Must include the following entries: | ||
85 | - 2d | ||
50 | 86 | ||
51 | - gr3d: 3D graphics engine | 87 | - gr3d: 3D graphics engine |
52 | 88 | ||
53 | Required properties: | 89 | Required properties: |
54 | - compatible: "nvidia,tegra<chip>-gr3d" | 90 | - compatible: "nvidia,tegra<chip>-gr3d" |
55 | - reg: Physical base address and length of the controller's registers. | 91 | - reg: Physical base address and length of the controller's registers. |
92 | - clocks: Must contain an entry for each entry in clock-names. | ||
93 | See ../clocks/clock-bindings.txt for details. | ||
94 | - clock-names: Must include the following entries: | ||
95 | (This property may be omitted if the only clock in the list is "3d") | ||
96 | - 3d | ||
97 | This MUST be the first entry. | ||
98 | - 3d2 (Only required on SoCs with two 3D clocks) | ||
99 | - resets: Must contain an entry for each entry in reset-names. | ||
100 | See ../reset/reset.txt for details. | ||
101 | - reset-names: Must include the following entries: | ||
102 | - 3d | ||
103 | - 3d2 (Only required on SoCs with two 3D clocks) | ||
56 | 104 | ||
57 | - dc: display controller | 105 | - dc: display controller |
58 | 106 | ||
@@ -60,6 +108,16 @@ of the following host1x client modules: | |||
60 | - compatible: "nvidia,tegra<chip>-dc" | 108 | - compatible: "nvidia,tegra<chip>-dc" |
61 | - reg: Physical base address and length of the controller's registers. | 109 | - reg: Physical base address and length of the controller's registers. |
62 | - interrupts: The interrupt outputs from the controller. | 110 | - interrupts: The interrupt outputs from the controller. |
111 | - clocks: Must contain an entry for each entry in clock-names. | ||
112 | See ../clocks/clock-bindings.txt for details. | ||
113 | - clock-names: Must include the following entries: | ||
114 | - dc | ||
115 | This MUST be the first entry. | ||
116 | - parent | ||
117 | - resets: Must contain an entry for each entry in reset-names. | ||
118 | See ../reset/reset.txt for details. | ||
119 | - reset-names: Must include the following entries: | ||
120 | - dc | ||
63 | 121 | ||
64 | Each display controller node has a child node, named "rgb", that represents | 122 | Each display controller node has a child node, named "rgb", that represents |
65 | the RGB output associated with the controller. It can take the following | 123 | the RGB output associated with the controller. It can take the following |
@@ -76,6 +134,16 @@ of the following host1x client modules: | |||
76 | - interrupts: The interrupt outputs from the controller. | 134 | - interrupts: The interrupt outputs from the controller. |
77 | - vdd-supply: regulator for supply voltage | 135 | - vdd-supply: regulator for supply voltage |
78 | - pll-supply: regulator for PLL | 136 | - pll-supply: regulator for PLL |
137 | - clocks: Must contain an entry for each entry in clock-names. | ||
138 | See ../clocks/clock-bindings.txt for details. | ||
139 | - clock-names: Must include the following entries: | ||
140 | - hdmi | ||
141 | This MUST be the first entry. | ||
142 | - parent | ||
143 | - resets: Must contain an entry for each entry in reset-names. | ||
144 | See ../reset/reset.txt for details. | ||
145 | - reset-names: Must include the following entries: | ||
146 | - hdmi | ||
79 | 147 | ||
80 | Optional properties: | 148 | Optional properties: |
81 | - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing | 149 | - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing |
@@ -88,12 +156,24 @@ of the following host1x client modules: | |||
88 | - compatible: "nvidia,tegra<chip>-tvo" | 156 | - compatible: "nvidia,tegra<chip>-tvo" |
89 | - reg: Physical base address and length of the controller's registers. | 157 | - reg: Physical base address and length of the controller's registers. |
90 | - interrupts: The interrupt outputs from the controller. | 158 | - interrupts: The interrupt outputs from the controller. |
159 | - clocks: Must contain one entry, for the module clock. | ||
160 | See ../clocks/clock-bindings.txt for details. | ||
91 | 161 | ||
92 | - dsi: display serial interface | 162 | - dsi: display serial interface |
93 | 163 | ||
94 | Required properties: | 164 | Required properties: |
95 | - compatible: "nvidia,tegra<chip>-dsi" | 165 | - compatible: "nvidia,tegra<chip>-dsi" |
96 | - reg: Physical base address and length of the controller's registers. | 166 | - reg: Physical base address and length of the controller's registers. |
167 | - clocks: Must contain an entry for each entry in clock-names. | ||
168 | See ../clocks/clock-bindings.txt for details. | ||
169 | - clock-names: Must include the following entries: | ||
170 | - dsi | ||
171 | This MUST be the first entry. | ||
172 | - parent | ||
173 | - resets: Must contain an entry for each entry in reset-names. | ||
174 | See ../reset/reset.txt for details. | ||
175 | - reset-names: Must include the following entries: | ||
176 | - dsi | ||
97 | 177 | ||
98 | Example: | 178 | Example: |
99 | 179 | ||
@@ -105,6 +185,9 @@ Example: | |||
105 | reg = <0x50000000 0x00024000>; | 185 | reg = <0x50000000 0x00024000>; |
106 | interrupts = <0 65 0x04 /* mpcore syncpt */ | 186 | interrupts = <0 65 0x04 /* mpcore syncpt */ |
107 | 0 67 0x04>; /* mpcore general */ | 187 | 0 67 0x04>; /* mpcore general */ |
188 | clocks = <&tegra_car TEGRA20_CLK_HOST1X>; | ||
189 | resets = <&tegra_car 28>; | ||
190 | reset-names = "host1x"; | ||
108 | 191 | ||
109 | #address-cells = <1>; | 192 | #address-cells = <1>; |
110 | #size-cells = <1>; | 193 | #size-cells = <1>; |
@@ -115,41 +198,64 @@ Example: | |||
115 | compatible = "nvidia,tegra20-mpe"; | 198 | compatible = "nvidia,tegra20-mpe"; |
116 | reg = <0x54040000 0x00040000>; | 199 | reg = <0x54040000 0x00040000>; |
117 | interrupts = <0 68 0x04>; | 200 | interrupts = <0 68 0x04>; |
201 | clocks = <&tegra_car TEGRA20_CLK_MPE>; | ||
202 | resets = <&tegra_car 60>; | ||
203 | reset-names = "mpe"; | ||
118 | }; | 204 | }; |
119 | 205 | ||
120 | vi { | 206 | vi { |
121 | compatible = "nvidia,tegra20-vi"; | 207 | compatible = "nvidia,tegra20-vi"; |
122 | reg = <0x54080000 0x00040000>; | 208 | reg = <0x54080000 0x00040000>; |
123 | interrupts = <0 69 0x04>; | 209 | interrupts = <0 69 0x04>; |
210 | clocks = <&tegra_car TEGRA20_CLK_VI>; | ||
211 | resets = <&tegra_car 100>; | ||
212 | reset-names = "vi"; | ||
124 | }; | 213 | }; |
125 | 214 | ||
126 | epp { | 215 | epp { |
127 | compatible = "nvidia,tegra20-epp"; | 216 | compatible = "nvidia,tegra20-epp"; |
128 | reg = <0x540c0000 0x00040000>; | 217 | reg = <0x540c0000 0x00040000>; |
129 | interrupts = <0 70 0x04>; | 218 | interrupts = <0 70 0x04>; |
219 | clocks = <&tegra_car TEGRA20_CLK_EPP>; | ||
220 | resets = <&tegra_car 19>; | ||
221 | reset-names = "epp"; | ||
130 | }; | 222 | }; |
131 | 223 | ||
132 | isp { | 224 | isp { |
133 | compatible = "nvidia,tegra20-isp"; | 225 | compatible = "nvidia,tegra20-isp"; |
134 | reg = <0x54100000 0x00040000>; | 226 | reg = <0x54100000 0x00040000>; |
135 | interrupts = <0 71 0x04>; | 227 | interrupts = <0 71 0x04>; |
228 | clocks = <&tegra_car TEGRA20_CLK_ISP>; | ||
229 | resets = <&tegra_car 23>; | ||
230 | reset-names = "isp"; | ||
136 | }; | 231 | }; |
137 | 232 | ||
138 | gr2d { | 233 | gr2d { |
139 | compatible = "nvidia,tegra20-gr2d"; | 234 | compatible = "nvidia,tegra20-gr2d"; |
140 | reg = <0x54140000 0x00040000>; | 235 | reg = <0x54140000 0x00040000>; |
141 | interrupts = <0 72 0x04>; | 236 | interrupts = <0 72 0x04>; |
237 | clocks = <&tegra_car TEGRA20_CLK_GR2D>; | ||
238 | resets = <&tegra_car 21>; | ||
239 | reset-names = "2d"; | ||
142 | }; | 240 | }; |
143 | 241 | ||
144 | gr3d { | 242 | gr3d { |
145 | compatible = "nvidia,tegra20-gr3d"; | 243 | compatible = "nvidia,tegra20-gr3d"; |
146 | reg = <0x54180000 0x00040000>; | 244 | reg = <0x54180000 0x00040000>; |
245 | clocks = <&tegra_car TEGRA20_CLK_GR3D>; | ||
246 | resets = <&tegra_car 24>; | ||
247 | reset-names = "3d"; | ||
147 | }; | 248 | }; |
148 | 249 | ||
149 | dc@54200000 { | 250 | dc@54200000 { |
150 | compatible = "nvidia,tegra20-dc"; | 251 | compatible = "nvidia,tegra20-dc"; |
151 | reg = <0x54200000 0x00040000>; | 252 | reg = <0x54200000 0x00040000>; |
152 | interrupts = <0 73 0x04>; | 253 | interrupts = <0 73 0x04>; |
254 | clocks = <&tegra_car TEGRA20_CLK_DISP1>, | ||
255 | <&tegra_car TEGRA20_CLK_PLL_P>; | ||
256 | clock-names = "disp1", "parent"; | ||
257 | resets = <&tegra_car 27>; | ||
258 | reset-names = "dc"; | ||
153 | 259 | ||
154 | rgb { | 260 | rgb { |
155 | status = "disabled"; | 261 | status = "disabled"; |
@@ -160,6 +266,11 @@ Example: | |||
160 | compatible = "nvidia,tegra20-dc"; | 266 | compatible = "nvidia,tegra20-dc"; |
161 | reg = <0x54240000 0x00040000>; | 267 | reg = <0x54240000 0x00040000>; |
162 | interrupts = <0 74 0x04>; | 268 | interrupts = <0 74 0x04>; |
269 | clocks = <&tegra_car TEGRA20_CLK_DISP2>, | ||
270 | <&tegra_car TEGRA20_CLK_PLL_P>; | ||
271 | clock-names = "disp2", "parent"; | ||
272 | resets = <&tegra_car 26>; | ||
273 | reset-names = "dc"; | ||
163 | 274 | ||
164 | rgb { | 275 | rgb { |
165 | status = "disabled"; | 276 | status = "disabled"; |
@@ -170,6 +281,11 @@ Example: | |||
170 | compatible = "nvidia,tegra20-hdmi"; | 281 | compatible = "nvidia,tegra20-hdmi"; |
171 | reg = <0x54280000 0x00040000>; | 282 | reg = <0x54280000 0x00040000>; |
172 | interrupts = <0 75 0x04>; | 283 | interrupts = <0 75 0x04>; |
284 | clocks = <&tegra_car TEGRA20_CLK_HDMI>, | ||
285 | <&tegra_car TEGRA20_CLK_PLL_D_OUT0>; | ||
286 | clock-names = "hdmi", "parent"; | ||
287 | resets = <&tegra_car 51>; | ||
288 | reset-names = "hdmi"; | ||
173 | status = "disabled"; | 289 | status = "disabled"; |
174 | }; | 290 | }; |
175 | 291 | ||
@@ -177,12 +293,18 @@ Example: | |||
177 | compatible = "nvidia,tegra20-tvo"; | 293 | compatible = "nvidia,tegra20-tvo"; |
178 | reg = <0x542c0000 0x00040000>; | 294 | reg = <0x542c0000 0x00040000>; |
179 | interrupts = <0 76 0x04>; | 295 | interrupts = <0 76 0x04>; |
296 | clocks = <&tegra_car TEGRA20_CLK_TVO>; | ||
180 | status = "disabled"; | 297 | status = "disabled"; |
181 | }; | 298 | }; |
182 | 299 | ||
183 | dsi { | 300 | dsi { |
184 | compatible = "nvidia,tegra20-dsi"; | 301 | compatible = "nvidia,tegra20-dsi"; |
185 | reg = <0x54300000 0x00040000>; | 302 | reg = <0x54300000 0x00040000>; |
303 | clocks = <&tegra_car TEGRA20_CLK_DSI>, | ||
304 | <&tegra_car TEGRA20_CLK_PLL_D_OUT0>; | ||
305 | clock-names = "dsi", "parent"; | ||
306 | resets = <&tegra_car 48>; | ||
307 | reset-names = "dsi"; | ||
186 | status = "disabled"; | 308 | status = "disabled"; |
187 | }; | 309 | }; |
188 | }; | 310 | }; |
diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt index ef77cc7a0e46..87507e9ce6db 100644 --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt | |||
@@ -39,12 +39,23 @@ Required properties: | |||
39 | - interrupts: Should contain I2C controller interrupts. | 39 | - interrupts: Should contain I2C controller interrupts. |
40 | - address-cells: Address cells for I2C device address. | 40 | - address-cells: Address cells for I2C device address. |
41 | - size-cells: Size of the I2C device address. | 41 | - size-cells: Size of the I2C device address. |
42 | - clocks: Clock ID as per | 42 | - clocks: Must contain an entry for each entry in clock-names. |
43 | Documentation/devicetree/bindings/clock/tegra<chip-id>.txt | 43 | See ../clocks/clock-bindings.txt for details. |
44 | for I2C controller. | 44 | - clock-names: Must include the following entries: |
45 | - clock-names: Name of the clock: | 45 | Tegra20/Tegra30: |
46 | Tegra20/Tegra30 I2C controller: "div-clk and "fast-clk". | 46 | - div-clk |
47 | Tegra114 I2C controller: "div-clk". | 47 | - fast-clk |
48 | Tegra114: | ||
49 | - div-clk | ||
50 | - resets: Must contain an entry for each entry in reset-names. | ||
51 | See ../reset/reset.txt for details. | ||
52 | - reset-names: Must include the following entries: | ||
53 | - i2c | ||
54 | - dmas: Must contain an entry for each entry in clock-names. | ||
55 | See ../dma/dma.txt for details. | ||
56 | - dma-names: Must include the following entries: | ||
57 | - rx | ||
58 | - tx | ||
48 | 59 | ||
49 | Example: | 60 | Example: |
50 | 61 | ||
@@ -56,5 +67,9 @@ Example: | |||
56 | #size-cells = <0>; | 67 | #size-cells = <0>; |
57 | clocks = <&tegra_car 12>, <&tegra_car 124>; | 68 | clocks = <&tegra_car 12>, <&tegra_car 124>; |
58 | clock-names = "div-clk", "fast-clk"; | 69 | clock-names = "div-clk", "fast-clk"; |
70 | resets = <&tegra_car 12>; | ||
71 | reset-names = "i2c"; | ||
72 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
73 | dma-names = "rx", "tx"; | ||
59 | status = "disabled"; | 74 | status = "disabled"; |
60 | }; | 75 | }; |
diff --git a/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt b/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt index 2995fae7ee47..0382b8bd69c6 100644 --- a/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt +++ b/Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt | |||
@@ -13,6 +13,12 @@ Required properties: | |||
13 | array of pin numbers which is used as column. | 13 | array of pin numbers which is used as column. |
14 | - linux,keymap: The keymap for keys as described in the binding document | 14 | - linux,keymap: The keymap for keys as described in the binding document |
15 | devicetree/bindings/input/matrix-keymap.txt. | 15 | devicetree/bindings/input/matrix-keymap.txt. |
16 | - clocks: Must contain one entry, for the module clock. | ||
17 | See ../clocks/clock-bindings.txt for details. | ||
18 | - resets: Must contain an entry for each entry in reset-names. | ||
19 | See ../reset/reset.txt for details. | ||
20 | - reset-names: Must include the following entries: | ||
21 | - kbc | ||
16 | 22 | ||
17 | Optional properties, in addition to those specified by the shared | 23 | Optional properties, in addition to those specified by the shared |
18 | matrix-keyboard bindings: | 24 | matrix-keyboard bindings: |
@@ -31,6 +37,9 @@ keyboard: keyboard { | |||
31 | compatible = "nvidia,tegra20-kbc"; | 37 | compatible = "nvidia,tegra20-kbc"; |
32 | reg = <0x7000e200 0x100>; | 38 | reg = <0x7000e200 0x100>; |
33 | interrupts = <0 85 0x04>; | 39 | interrupts = <0 85 0x04>; |
40 | clocks = <&tegra_car 36>; | ||
41 | resets = <&tegra_car 36>; | ||
42 | reset-names = "kbc"; | ||
34 | nvidia,ghost-filter; | 43 | nvidia,ghost-filter; |
35 | nvidia,debounce-delay-ms = <640>; | 44 | nvidia,debounce-delay-ms = <640>; |
36 | nvidia,kbc-row-pins = <0 1 2>; /* pin 0, 1, 2 as rows */ | 45 | nvidia,kbc-row-pins = <0 1 2>; /* pin 0, 1, 2 as rows */ |
diff --git a/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt index c6d7b11db9eb..f357c16ea815 100644 --- a/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt +++ b/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt | |||
@@ -8,6 +8,12 @@ by mmc.txt and the properties used by the sdhci-tegra driver. | |||
8 | 8 | ||
9 | Required properties: | 9 | Required properties: |
10 | - compatible : Should be "nvidia,<chip>-sdhci" | 10 | - compatible : Should be "nvidia,<chip>-sdhci" |
11 | - clocks : Must contain one entry, for the module clock. | ||
12 | See ../clocks/clock-bindings.txt for details. | ||
13 | - resets : Must contain an entry for each entry in reset-names. | ||
14 | See ../reset/reset.txt for details. | ||
15 | - reset-names : Must include the following entries: | ||
16 | - sdhci | ||
11 | 17 | ||
12 | Optional properties: | 18 | Optional properties: |
13 | - power-gpios : Specify GPIOs for power control | 19 | - power-gpios : Specify GPIOs for power control |
@@ -18,6 +24,9 @@ sdhci@c8000200 { | |||
18 | compatible = "nvidia,tegra20-sdhci"; | 24 | compatible = "nvidia,tegra20-sdhci"; |
19 | reg = <0xc8000200 0x200>; | 25 | reg = <0xc8000200 0x200>; |
20 | interrupts = <47>; | 26 | interrupts = <47>; |
27 | clocks = <&tegra_car 14>; | ||
28 | resets = <&tegra_car 14>; | ||
29 | reset-names = "sdhci"; | ||
21 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 30 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ |
22 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ | 31 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
23 | power-gpios = <&gpio 155 0>; /* gpio PT3 */ | 32 | power-gpios = <&gpio 155 0>; /* gpio PT3 */ |
diff --git a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt index 5aeee53ff9f4..5ae601e7f51f 100644 --- a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt +++ b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt | |||
@@ -7,3 +7,15 @@ Required properties: | |||
7 | - clock-frequency : the frequency of the i2c bus | 7 | - clock-frequency : the frequency of the i2c bus |
8 | - gpios : the gpio used for ec request | 8 | - gpios : the gpio used for ec request |
9 | - slave-addr: the i2c address of the slave controller | 9 | - slave-addr: the i2c address of the slave controller |
10 | - clocks : Must contain an entry for each entry in clock-names. | ||
11 | See ../clocks/clock-bindings.txt for details. | ||
12 | - clock-names : Must include the following entries: | ||
13 | Tegra20/Tegra30: | ||
14 | - div-clk | ||
15 | - fast-clk | ||
16 | Tegra114: | ||
17 | - div-clk | ||
18 | - resets : Must contain an entry for each entry in reset-names. | ||
19 | See ../reset/reset.txt for details. | ||
20 | - reset-names : Must include the following entries: | ||
21 | - i2c | ||
diff --git a/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt b/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt index 6b7510775c50..24cee06915c9 100644 --- a/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +++ b/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | |||
@@ -42,14 +42,19 @@ Required properties: | |||
42 | - 0xc2000000: prefetchable memory region | 42 | - 0xc2000000: prefetchable memory region |
43 | Please refer to the standard PCI bus binding document for a more detailed | 43 | Please refer to the standard PCI bus binding document for a more detailed |
44 | explanation. | 44 | explanation. |
45 | - clocks: List of clock inputs of the controller. Must contain an entry for | 45 | - clocks: Must contain an entry for each entry in clock-names. |
46 | each entry in the clock-names property. | 46 | See ../clocks/clock-bindings.txt for details. |
47 | - clock-names: Must include the following entries: | 47 | - clock-names: Must include the following entries: |
48 | "pex": The Tegra clock of that name | 48 | - pex |
49 | "afi": The Tegra clock of that name | 49 | - afi |
50 | "pcie_xclk": The Tegra clock of that name | 50 | - pll_e |
51 | "pll_e": The Tegra clock of that name | 51 | - cml (not required for Tegra20) |
52 | "cml": The Tegra clock of that name (not required for Tegra20) | 52 | - resets: Must contain an entry for each entry in reset-names. |
53 | See ../reset/reset.txt for details. | ||
54 | - reset-names: Must include the following entries: | ||
55 | - pex | ||
56 | - afi | ||
57 | - pcie_x | ||
53 | 58 | ||
54 | Root ports are defined as subnodes of the PCIe controller node. | 59 | Root ports are defined as subnodes of the PCIe controller node. |
55 | 60 | ||
@@ -91,9 +96,10 @@ SoC DTSI: | |||
91 | 0x82000000 0 0xa0000000 0xa0000000 0 0x10000000 /* non-prefetchable memory */ | 96 | 0x82000000 0 0xa0000000 0xa0000000 0 0x10000000 /* non-prefetchable memory */ |
92 | 0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */ | 97 | 0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */ |
93 | 98 | ||
94 | clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>, | 99 | clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 118>; |
95 | <&tegra_car 118>; | 100 | clock-names = "pex", "afi", "pll_e"; |
96 | clock-names = "pex", "afi", "pcie_xclk", "pll_e"; | 101 | resets = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>; |
102 | reset-names = "pex", "afi", "pcie_x"; | ||
97 | status = "disabled"; | 103 | status = "disabled"; |
98 | 104 | ||
99 | pci@1,0 { | 105 | pci@1,0 { |
diff --git a/Documentation/devicetree/bindings/pwm/nvidia,tegra20-pwm.txt b/Documentation/devicetree/bindings/pwm/nvidia,tegra20-pwm.txt index c3fc57af8772..c7ea9d4a988b 100644 --- a/Documentation/devicetree/bindings/pwm/nvidia,tegra20-pwm.txt +++ b/Documentation/devicetree/bindings/pwm/nvidia,tegra20-pwm.txt | |||
@@ -7,6 +7,12 @@ Required properties: | |||
7 | - reg: physical base address and length of the controller's registers | 7 | - reg: physical base address and length of the controller's registers |
8 | - #pwm-cells: should be 2. See pwm.txt in this directory for a description of | 8 | - #pwm-cells: should be 2. See pwm.txt in this directory for a description of |
9 | the cells format. | 9 | the cells format. |
10 | - clocks: Must contain one entry, for the module clock. | ||
11 | See ../clocks/clock-bindings.txt for details. | ||
12 | - resets: Must contain an entry for each entry in reset-names. | ||
13 | See ../reset/reset.txt for details. | ||
14 | - reset-names: Must include the following entries: | ||
15 | - pwm | ||
10 | 16 | ||
11 | Example: | 17 | Example: |
12 | 18 | ||
@@ -14,4 +20,7 @@ Example: | |||
14 | compatible = "nvidia,tegra20-pwm"; | 20 | compatible = "nvidia,tegra20-pwm"; |
15 | reg = <0x7000a000 0x100>; | 21 | reg = <0x7000a000 0x100>; |
16 | #pwm-cells = <2>; | 22 | #pwm-cells = <2>; |
23 | clocks = <&tegra_car 17>; | ||
24 | resets = <&tegra_car 17>; | ||
25 | reset-names = "pwm"; | ||
17 | }; | 26 | }; |
diff --git a/Documentation/devicetree/bindings/rtc/nvidia,tegra20-rtc.txt b/Documentation/devicetree/bindings/rtc/nvidia,tegra20-rtc.txt index 93f45e9dce7c..652d1ff2e8be 100644 --- a/Documentation/devicetree/bindings/rtc/nvidia,tegra20-rtc.txt +++ b/Documentation/devicetree/bindings/rtc/nvidia,tegra20-rtc.txt | |||
@@ -9,6 +9,8 @@ Required properties: | |||
9 | - compatible : should be "nvidia,tegra20-rtc". | 9 | - compatible : should be "nvidia,tegra20-rtc". |
10 | - reg : Specifies base physical address and size of the registers. | 10 | - reg : Specifies base physical address and size of the registers. |
11 | - interrupts : A single interrupt specifier. | 11 | - interrupts : A single interrupt specifier. |
12 | - clocks : Must contain one entry, for the module clock. | ||
13 | See ../clocks/clock-bindings.txt for details. | ||
12 | 14 | ||
13 | Example: | 15 | Example: |
14 | 16 | ||
@@ -16,4 +18,5 @@ timer { | |||
16 | compatible = "nvidia,tegra20-rtc"; | 18 | compatible = "nvidia,tegra20-rtc"; |
17 | reg = <0x7000e000 0x100>; | 19 | reg = <0x7000e000 0x100>; |
18 | interrupts = <0 2 0x04>; | 20 | interrupts = <0 2 0x04>; |
21 | clocks = <&tegra_car 4>; | ||
19 | }; | 22 | }; |
diff --git a/Documentation/devicetree/bindings/serial/nvidia,tegra20-hsuart.txt b/Documentation/devicetree/bindings/serial/nvidia,tegra20-hsuart.txt index 392a4493eebd..845850caf088 100644 --- a/Documentation/devicetree/bindings/serial/nvidia,tegra20-hsuart.txt +++ b/Documentation/devicetree/bindings/serial/nvidia,tegra20-hsuart.txt | |||
@@ -4,8 +4,17 @@ Required properties: | |||
4 | - compatible : should be "nvidia,tegra30-hsuart", "nvidia,tegra20-hsuart". | 4 | - compatible : should be "nvidia,tegra30-hsuart", "nvidia,tegra20-hsuart". |
5 | - reg: Should contain UART controller registers location and length. | 5 | - reg: Should contain UART controller registers location and length. |
6 | - interrupts: Should contain UART controller interrupts. | 6 | - interrupts: Should contain UART controller interrupts. |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - clocks: Must contain one entry, for the module clock. |
8 | request selector for this UART controller. | 8 | See ../clocks/clock-bindings.txt for details. |
9 | - resets : Must contain an entry for each entry in reset-names. | ||
10 | See ../reset/reset.txt for details. | ||
11 | - reset-names : Must include the following entries: | ||
12 | - serial | ||
13 | - dmas : Must contain an entry for each entry in clock-names. | ||
14 | See ../dma/dma.txt for details. | ||
15 | - dma-names : Must include the following entries: | ||
16 | - rx | ||
17 | - tx | ||
9 | 18 | ||
10 | Optional properties: | 19 | Optional properties: |
11 | - nvidia,enable-modem-interrupt: Enable modem interrupts. Should be enable | 20 | - nvidia,enable-modem-interrupt: Enable modem interrupts. Should be enable |
@@ -18,7 +27,11 @@ serial@70006000 { | |||
18 | reg = <0x70006000 0x40>; | 27 | reg = <0x70006000 0x40>; |
19 | reg-shift = <2>; | 28 | reg-shift = <2>; |
20 | interrupts = <0 36 0x04>; | 29 | interrupts = <0 36 0x04>; |
21 | nvidia,dma-request-selector = <&apbdma 8>; | ||
22 | nvidia,enable-modem-interrupt; | 30 | nvidia,enable-modem-interrupt; |
31 | clocks = <&tegra_car 6>; | ||
32 | resets = <&tegra_car 6>; | ||
33 | reset-names = "serial"; | ||
34 | dmas = <&apbdma 8>, <&apbdma 8>; | ||
35 | dma-names = "rx", "tx"; | ||
23 | status = "disabled"; | 36 | status = "disabled"; |
24 | }; | 37 | }; |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt index 8b8903ef0800..57f40f93453e 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt | |||
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra-audio-alc5632" | 4 | - compatible : "nvidia,tegra-audio-alc5632" |
5 | - clocks : Must contain an entry for each entry in clock-names. | 5 | - clocks : Must contain an entry for each entry in clock-names. |
6 | See ../clocks/clock-bindings.txt for details. | ||
6 | - clock-names : Must include the following entries: | 7 | - clock-names : Must include the following entries: |
7 | "pll_a" (The Tegra clock of that name), | 8 | - pll_a |
8 | "pll_a_out0" (The Tegra clock of that name), | 9 | - pll_a_out0 |
9 | "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) |
10 | - nvidia,model : The user-visible name of this sound complex. | 11 | - nvidia,model : The user-visible name of this sound complex. |
11 | - nvidia,audio-routing : A list of the connections between audio components. | 12 | - nvidia,audio-routing : A list of the connections between audio components. |
12 | Each entry is a pair of strings, the first being the connection's sink, | 13 | Each entry is a pair of strings, the first being the connection's sink, |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt index dc6224994d69..7788808dcd0b 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt | |||
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex, with RT5640 CODEC | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra-audio-rt5640" | 4 | - compatible : "nvidia,tegra-audio-rt5640" |
5 | - clocks : Must contain an entry for each entry in clock-names. | 5 | - clocks : Must contain an entry for each entry in clock-names. |
6 | See ../clocks/clock-bindings.txt for details. | ||
6 | - clock-names : Must include the following entries: | 7 | - clock-names : Must include the following entries: |
7 | "pll_a" (The Tegra clock of that name), | 8 | - pll_a |
8 | "pll_a_out0" (The Tegra clock of that name), | 9 | - pll_a_out0 |
9 | "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) |
10 | - nvidia,model : The user-visible name of this sound complex. | 11 | - nvidia,model : The user-visible name of this sound complex. |
11 | - nvidia,audio-routing : A list of the connections between audio components. | 12 | - nvidia,audio-routing : A list of the connections between audio components. |
12 | Each entry is a pair of strings, the first being the connection's sink, | 13 | Each entry is a pair of strings, the first being the connection's sink, |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt index aab6ce0ad2fc..96f6a57dd6b4 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt | |||
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra-audio-wm8753" | 4 | - compatible : "nvidia,tegra-audio-wm8753" |
5 | - clocks : Must contain an entry for each entry in clock-names. | 5 | - clocks : Must contain an entry for each entry in clock-names. |
6 | See ../clocks/clock-bindings.txt for details. | ||
6 | - clock-names : Must include the following entries: | 7 | - clock-names : Must include the following entries: |
7 | "pll_a" (The Tegra clock of that name), | 8 | - pll_a |
8 | "pll_a_out0" (The Tegra clock of that name), | 9 | - pll_a_out0 |
9 | "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) |
10 | - nvidia,model : The user-visible name of this sound complex. | 11 | - nvidia,model : The user-visible name of this sound complex. |
11 | - nvidia,audio-routing : A list of the connections between audio components. | 12 | - nvidia,audio-routing : A list of the connections between audio components. |
12 | Each entry is a pair of strings, the first being the connection's sink, | 13 | Each entry is a pair of strings, the first being the connection's sink, |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt index 4b44dfb6ca0d..b795d282818d 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | |||
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra-audio-wm8903" | 4 | - compatible : "nvidia,tegra-audio-wm8903" |
5 | - clocks : Must contain an entry for each entry in clock-names. | 5 | - clocks : Must contain an entry for each entry in clock-names. |
6 | See ../clocks/clock-bindings.txt for details. | ||
6 | - clock-names : Must include the following entries: | 7 | - clock-names : Must include the following entries: |
7 | "pll_a" (The Tegra clock of that name), | 8 | - pll_a |
8 | "pll_a_out0" (The Tegra clock of that name), | 9 | - pll_a_out0 |
9 | "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) |
10 | - nvidia,model : The user-visible name of this sound complex. | 11 | - nvidia,model : The user-visible name of this sound complex. |
11 | - nvidia,audio-routing : A list of the connections between audio components. | 12 | - nvidia,audio-routing : A list of the connections between audio components. |
12 | Each entry is a pair of strings, the first being the connection's sink, | 13 | Each entry is a pair of strings, the first being the connection's sink, |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt index ad589b163639..436f6cd9d07c 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt | |||
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra-audio-wm9712" | 4 | - compatible : "nvidia,tegra-audio-wm9712" |
5 | - clocks : Must contain an entry for each entry in clock-names. | 5 | - clocks : Must contain an entry for each entry in clock-names. |
6 | See ../clocks/clock-bindings.txt for details. | ||
6 | - clock-names : Must include the following entries: | 7 | - clock-names : Must include the following entries: |
7 | "pll_a" (The Tegra clock of that name), | 8 | - pll_a |
8 | "pll_a_out0" (The Tegra clock of that name), | 9 | - pll_a_out0 |
9 | "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) |
10 | - nvidia,model : The user-visible name of this sound complex. | 11 | - nvidia,model : The user-visible name of this sound complex. |
11 | - nvidia,audio-routing : A list of the connections between audio components. | 12 | - nvidia,audio-routing : A list of the connections between audio components. |
12 | Each entry is a pair of strings, the first being the connection's sink, | 13 | Each entry is a pair of strings, the first being the connection's sink, |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt index c1454979c1ef..eaf00102d92c 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt | |||
@@ -4,19 +4,33 @@ Required properties: | |||
4 | - compatible : "nvidia,tegra20-ac97" | 4 | - compatible : "nvidia,tegra20-ac97" |
5 | - reg : Should contain AC97 controller registers location and length | 5 | - reg : Should contain AC97 controller registers location and length |
6 | - interrupts : Should contain AC97 interrupt | 6 | - interrupts : Should contain AC97 interrupt |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - resets : Must contain an entry for each entry in reset-names. |
8 | request selector for the AC97 controller | 8 | See ../reset/reset.txt for details. |
9 | - reset-names : Must include the following entries: | ||
10 | - ac97 | ||
11 | - dmas : Must contain an entry for each entry in clock-names. | ||
12 | See ../dma/dma.txt for details. | ||
13 | - dma-names : Must include the following entries: | ||
14 | - rx | ||
15 | - tx | ||
16 | - clocks : Must contain one entry, for the module clock. | ||
17 | See ../clocks/clock-bindings.txt for details. | ||
9 | - nvidia,codec-reset-gpio : The Tegra GPIO controller's phandle and the number | 18 | - nvidia,codec-reset-gpio : The Tegra GPIO controller's phandle and the number |
10 | of the GPIO used to reset the external AC97 codec | 19 | of the GPIO used to reset the external AC97 codec |
11 | - nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number | 20 | - nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number |
12 | of the GPIO corresponding with the AC97 DAP _FS line | 21 | of the GPIO corresponding with the AC97 DAP _FS line |
22 | |||
13 | Example: | 23 | Example: |
14 | 24 | ||
15 | ac97@70002000 { | 25 | ac97@70002000 { |
16 | compatible = "nvidia,tegra20-ac97"; | 26 | compatible = "nvidia,tegra20-ac97"; |
17 | reg = <0x70002000 0x200>; | 27 | reg = <0x70002000 0x200>; |
18 | interrupts = <0 81 0x04>; | 28 | interrupts = <0 81 0x04>; |
19 | nvidia,dma-request-selector = <&apbdma 12>; | ||
20 | nvidia,codec-reset-gpio = <&gpio 170 0>; | 29 | nvidia,codec-reset-gpio = <&gpio 170 0>; |
21 | nvidia,codec-sync-gpio = <&gpio 120 0>; | 30 | nvidia,codec-sync-gpio = <&gpio 120 0>; |
31 | clocks = <&tegra_car 3>; | ||
32 | resets = <&tegra_car 3>; | ||
33 | reset-names = "ac97"; | ||
34 | dmas = <&apbdma 12>, <&apbdma 12>; | ||
35 | dma-names = "rx", "tx"; | ||
22 | }; | 36 | }; |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt index 0df2b5c816e3..dc30c6bfbe95 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt | |||
@@ -4,8 +4,17 @@ Required properties: | |||
4 | - compatible : "nvidia,tegra20-i2s" | 4 | - compatible : "nvidia,tegra20-i2s" |
5 | - reg : Should contain I2S registers location and length | 5 | - reg : Should contain I2S registers location and length |
6 | - interrupts : Should contain I2S interrupt | 6 | - interrupts : Should contain I2S interrupt |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - resets : Must contain an entry for each entry in reset-names. |
8 | request selector for this I2S controller | 8 | See ../reset/reset.txt for details. |
9 | - reset-names : Must include the following entries: | ||
10 | - i2s | ||
11 | - dmas : Must contain an entry for each entry in clock-names. | ||
12 | See ../dma/dma.txt for details. | ||
13 | - dma-names : Must include the following entries: | ||
14 | - rx | ||
15 | - tx | ||
16 | - clocks : Must contain one entry, for the module clock. | ||
17 | See ../clocks/clock-bindings.txt for details. | ||
9 | 18 | ||
10 | Example: | 19 | Example: |
11 | 20 | ||
@@ -13,5 +22,9 @@ i2s@70002800 { | |||
13 | compatible = "nvidia,tegra20-i2s"; | 22 | compatible = "nvidia,tegra20-i2s"; |
14 | reg = <0x70002800 0x200>; | 23 | reg = <0x70002800 0x200>; |
15 | interrupts = < 45 >; | 24 | interrupts = < 45 >; |
16 | nvidia,dma-request-selector = < &apbdma 2 >; | 25 | clocks = <&tegra_car 11>; |
26 | resets = <&tegra_car 11>; | ||
27 | reset-names = "i2s"; | ||
28 | dmas = <&apbdma 21>, <&apbdma 21>; | ||
29 | dma-names = "rx", "tx"; | ||
17 | }; | 30 | }; |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt index 0e5c12c66523..946e2ac46091 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt | |||
@@ -7,18 +7,48 @@ Required properties: | |||
7 | - Tegra30 requires 2 entries, for the APBIF and AHUB/AUDIO register blocks. | 7 | - Tegra30 requires 2 entries, for the APBIF and AHUB/AUDIO register blocks. |
8 | - Tegra114 requires an additional entry, for the APBIF2 register block. | 8 | - Tegra114 requires an additional entry, for the APBIF2 register block. |
9 | - interrupts : Should contain AHUB interrupt | 9 | - interrupts : Should contain AHUB interrupt |
10 | - nvidia,dma-request-selector : A list of the DMA channel specifiers. Each | 10 | - clocks : Must contain an entry for each entry in clock-names. |
11 | entry contains the Tegra DMA controller's phandle and request selector. | 11 | See ../clocks/clock-bindings.txt for details. |
12 | If a single entry is present, the request selectors for the channels are | ||
13 | assumed to be contiguous, and increment from this value. | ||
14 | If multiple values are given, one value must be given per channel. | ||
15 | - clocks : Must contain an entry for each required entry in clock-names. | ||
16 | - clock-names : Must include the following entries: | 12 | - clock-names : Must include the following entries: |
17 | - Tegra30: Requires d_audio, apbif, i2s0, i2s1, i2s2, i2s3, i2s4, dam0, | 13 | - d_audio |
18 | dam1, dam2, spdif_in. | 14 | - apbif |
19 | - Tegra114: Additionally requires amx, adx. | 15 | - resets : Must contain an entry for each entry in reset-names. |
16 | See ../reset/reset.txt for details. | ||
17 | - reset-names : Must include the following entries: | ||
18 | Tegra30 and later: | ||
19 | - d_audio | ||
20 | - apbif | ||
21 | - i2s0 | ||
22 | - i2s1 | ||
23 | - i2s2 | ||
24 | - i2s3 | ||
25 | - i2s4 | ||
26 | - dam0 | ||
27 | - dam1 | ||
28 | - dam2 | ||
29 | - spdif | ||
30 | Tegra114 and later additionally require: | ||
31 | - amx | ||
32 | - adx | ||
33 | Tegra124 and later additionally require: | ||
34 | - amx1 | ||
35 | - adx1 | ||
36 | - afc0 | ||
37 | - afc1 | ||
38 | - afc2 | ||
39 | - afc3 | ||
40 | - afc4 | ||
41 | - afc5 | ||
20 | - ranges : The bus address mapping for the configlink register bus. | 42 | - ranges : The bus address mapping for the configlink register bus. |
21 | Can be empty since the mapping is 1:1. | 43 | Can be empty since the mapping is 1:1. |
44 | - dmas : Must contain an entry for each entry in clock-names. | ||
45 | See ../dma/dma.txt for details. | ||
46 | - dma-names : Must include the following entries: | ||
47 | - rx0 .. rx<n> | ||
48 | - tx0 .. tx<n> | ||
49 | ... where n is: | ||
50 | Tegra30: 3 | ||
51 | Tegra114, Tegra124: 9 | ||
22 | - #address-cells : For the configlink bus. Should be <1>; | 52 | - #address-cells : For the configlink bus. Should be <1>; |
23 | - #size-cells : For the configlink bus. Should be <1>. | 53 | - #size-cells : For the configlink bus. Should be <1>. |
24 | 54 | ||
@@ -35,13 +65,20 @@ ahub@70080000 { | |||
35 | reg = <0x70080000 0x200 0x70080200 0x100>; | 65 | reg = <0x70080000 0x200 0x70080200 0x100>; |
36 | interrupts = < 0 103 0x04 >; | 66 | interrupts = < 0 103 0x04 >; |
37 | nvidia,dma-request-selector = <&apbdma 1>; | 67 | nvidia,dma-request-selector = <&apbdma 1>; |
38 | clocks = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>, | 68 | clocks = <&tegra_car 106>, <&tegra_car 107>; |
69 | clock-names = "d_audio", "apbif"; | ||
70 | resets = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>, | ||
39 | <&tegra_car 11>, <&tegra_car 18>, <&tegra_car 101>, | 71 | <&tegra_car 11>, <&tegra_car 18>, <&tegra_car 101>, |
40 | <&tegra_car 102>, <&tegra_car 108>, <&tegra_car 109>, | 72 | <&tegra_car 102>, <&tegra_car 108>, <&tegra_car 109>, |
41 | <&tegra_car 110>, <&tegra_car 162>; | 73 | <&tegra_car 110>, <&tegra_car 10>; |
42 | clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | 74 | reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", |
43 | "i2s3", "i2s4", "dam0", "dam1", "dam2", | 75 | "i2s3", "i2s4", "dam0", "dam1", "dam2", |
44 | "spdif_in"; | 76 | "spdif"; |
77 | dmas = <&apbdma 1>, <&apbdma 1>; | ||
78 | <&apbdma 2>, <&apbdma 2>; | ||
79 | <&apbdma 3>, <&apbdma 3>; | ||
80 | <&apbdma 4>, <&apbdma 4>; | ||
81 | dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2", "rx3", "tx3"; | ||
45 | ranges; | 82 | ranges; |
46 | #address-cells = <1>; | 83 | #address-cells = <1>; |
47 | #size-cells = <1>; | 84 | #size-cells = <1>; |
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-i2s.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra30-i2s.txt index dfa6c037124a..0c113ffe3814 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-i2s.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-i2s.txt | |||
@@ -3,13 +3,22 @@ NVIDIA Tegra30 I2S controller | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra30-i2s" | 4 | - compatible : "nvidia,tegra30-i2s" |
5 | - reg : Should contain I2S registers location and length | 5 | - reg : Should contain I2S registers location and length |
6 | - clocks : Must contain one entry, for the module clock. | ||
7 | See ../clocks/clock-bindings.txt for details. | ||
8 | - resets : Must contain an entry for each entry in reset-names. | ||
9 | See ../reset/reset.txt for details. | ||
10 | - reset-names : Must include the following entries: | ||
11 | - i2s | ||
6 | - nvidia,ahub-cif-ids : The list of AHUB CIF IDs for this port, rx (playback) | 12 | - nvidia,ahub-cif-ids : The list of AHUB CIF IDs for this port, rx (playback) |
7 | first, tx (capture) second. See nvidia,tegra30-ahub.txt for values. | 13 | first, tx (capture) second. See nvidia,tegra30-ahub.txt for values. |
8 | 14 | ||
9 | Example: | 15 | Example: |
10 | 16 | ||
11 | i2s@70002800 { | 17 | i2s@70080300 { |
12 | compatible = "nvidia,tegra30-i2s"; | 18 | compatible = "nvidia,tegra30-i2s"; |
13 | reg = <0x70080300 0x100>; | 19 | reg = <0x70080300 0x100>; |
14 | nvidia,ahub-cif-ids = <4 4>; | 20 | nvidia,ahub-cif-ids = <4 4>; |
21 | clocks = <&tegra_car 11>; | ||
22 | resets = <&tegra_car 11>; | ||
23 | reset-names = "i2s"; | ||
15 | }; | 24 | }; |
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt index 91ff771c7e77..7ea701e07dc2 100644 --- a/Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt +++ b/Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt | |||
@@ -4,10 +4,19 @@ Required properties: | |||
4 | - compatible : should be "nvidia,tegra114-spi". | 4 | - compatible : should be "nvidia,tegra114-spi". |
5 | - reg: Should contain SPI registers location and length. | 5 | - reg: Should contain SPI registers location and length. |
6 | - interrupts: Should contain SPI interrupts. | 6 | - interrupts: Should contain SPI interrupts. |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - clock-names : Must include the following entries: |
8 | request selector for this SPI controller. | 8 | - spi |
9 | - This is also require clock named "spi" as per binding document | 9 | - resets : Must contain an entry for each entry in reset-names. |
10 | Documentation/devicetree/bindings/clock/clock-bindings.txt | 10 | See ../reset/reset.txt for details. |
11 | - reset-names : Must include the following entries: | ||
12 | - spi | ||
13 | - dmas : Must contain an entry for each entry in clock-names. | ||
14 | See ../dma/dma.txt for details. | ||
15 | - dma-names : Must include the following entries: | ||
16 | - rx | ||
17 | - tx | ||
18 | - clocks : Must contain an entry for each entry in clock-names. | ||
19 | See ../clocks/clock-bindings.txt for details. | ||
11 | 20 | ||
12 | Recommended properties: | 21 | Recommended properties: |
13 | - spi-max-frequency: Definition as per | 22 | - spi-max-frequency: Definition as per |
@@ -18,9 +27,14 @@ spi@7000d600 { | |||
18 | compatible = "nvidia,tegra114-spi"; | 27 | compatible = "nvidia,tegra114-spi"; |
19 | reg = <0x7000d600 0x200>; | 28 | reg = <0x7000d600 0x200>; |
20 | interrupts = <0 82 0x04>; | 29 | interrupts = <0 82 0x04>; |
21 | nvidia,dma-request-selector = <&apbdma 16>; | ||
22 | spi-max-frequency = <25000000>; | 30 | spi-max-frequency = <25000000>; |
23 | #address-cells = <1>; | 31 | #address-cells = <1>; |
24 | #size-cells = <0>; | 32 | #size-cells = <0>; |
33 | clocks = <&tegra_car 44>; | ||
34 | clock-names = "spi"; | ||
35 | resets = <&tegra_car 44>; | ||
36 | reset-names = "spi"; | ||
37 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
38 | dma-names = "rx", "tx"; | ||
25 | status = "disabled"; | 39 | status = "disabled"; |
26 | }; | 40 | }; |
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt index 7b53da5cb75b..bdf08e6dec9b 100644 --- a/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt +++ b/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt | |||
@@ -4,8 +4,17 @@ Required properties: | |||
4 | - compatible : should be "nvidia,tegra20-sflash". | 4 | - compatible : should be "nvidia,tegra20-sflash". |
5 | - reg: Should contain SFLASH registers location and length. | 5 | - reg: Should contain SFLASH registers location and length. |
6 | - interrupts: Should contain SFLASH interrupts. | 6 | - interrupts: Should contain SFLASH interrupts. |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - clocks : Must contain one entry, for the module clock. |
8 | request selector for this SFLASH controller. | 8 | See ../clocks/clock-bindings.txt for details. |
9 | - resets : Must contain an entry for each entry in reset-names. | ||
10 | See ../reset/reset.txt for details. | ||
11 | - reset-names : Must include the following entries: | ||
12 | - spi | ||
13 | - dmas : Must contain an entry for each entry in clock-names. | ||
14 | See ../dma/dma.txt for details. | ||
15 | - dma-names : Must include the following entries: | ||
16 | - rx | ||
17 | - tx | ||
9 | 18 | ||
10 | Recommended properties: | 19 | Recommended properties: |
11 | - spi-max-frequency: Definition as per | 20 | - spi-max-frequency: Definition as per |
@@ -17,10 +26,13 @@ spi@7000c380 { | |||
17 | compatible = "nvidia,tegra20-sflash"; | 26 | compatible = "nvidia,tegra20-sflash"; |
18 | reg = <0x7000c380 0x80>; | 27 | reg = <0x7000c380 0x80>; |
19 | interrupts = <0 39 0x04>; | 28 | interrupts = <0 39 0x04>; |
20 | nvidia,dma-request-selector = <&apbdma 16>; | ||
21 | spi-max-frequency = <25000000>; | 29 | spi-max-frequency = <25000000>; |
22 | #address-cells = <1>; | 30 | #address-cells = <1>; |
23 | #size-cells = <0>; | 31 | #size-cells = <0>; |
32 | clocks = <&tegra_car 43>; | ||
33 | resets = <&tegra_car 43>; | ||
34 | reset-names = "spi"; | ||
35 | dmas = <&apbdma 11>, <&apbdma 11>; | ||
36 | dma-names = "rx", "tx"; | ||
24 | status = "disabled"; | 37 | status = "disabled"; |
25 | }; | 38 | }; |
26 | |||
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt index eefe15e3d95e..5db9144a33c8 100644 --- a/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt +++ b/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt | |||
@@ -4,8 +4,17 @@ Required properties: | |||
4 | - compatible : should be "nvidia,tegra20-slink", "nvidia,tegra30-slink". | 4 | - compatible : should be "nvidia,tegra20-slink", "nvidia,tegra30-slink". |
5 | - reg: Should contain SLINK registers location and length. | 5 | - reg: Should contain SLINK registers location and length. |
6 | - interrupts: Should contain SLINK interrupts. | 6 | - interrupts: Should contain SLINK interrupts. |
7 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 7 | - clocks : Must contain one entry, for the module clock. |
8 | request selector for this SLINK controller. | 8 | See ../clocks/clock-bindings.txt for details. |
9 | - resets : Must contain an entry for each entry in reset-names. | ||
10 | See ../reset/reset.txt for details. | ||
11 | - reset-names : Must include the following entries: | ||
12 | - spi | ||
13 | - dmas : Must contain an entry for each entry in clock-names. | ||
14 | See ../dma/dma.txt for details. | ||
15 | - dma-names : Must include the following entries: | ||
16 | - rx | ||
17 | - tx | ||
9 | 18 | ||
10 | Recommended properties: | 19 | Recommended properties: |
11 | - spi-max-frequency: Definition as per | 20 | - spi-max-frequency: Definition as per |
@@ -17,10 +26,13 @@ spi@7000d600 { | |||
17 | compatible = "nvidia,tegra20-slink"; | 26 | compatible = "nvidia,tegra20-slink"; |
18 | reg = <0x7000d600 0x200>; | 27 | reg = <0x7000d600 0x200>; |
19 | interrupts = <0 82 0x04>; | 28 | interrupts = <0 82 0x04>; |
20 | nvidia,dma-request-selector = <&apbdma 16>; | ||
21 | spi-max-frequency = <25000000>; | 29 | spi-max-frequency = <25000000>; |
22 | #address-cells = <1>; | 30 | #address-cells = <1>; |
23 | #size-cells = <0>; | 31 | #size-cells = <0>; |
32 | clocks = <&tegra_car 44>; | ||
33 | resets = <&tegra_car 44>; | ||
34 | reset-names = "spi"; | ||
35 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
36 | dma-names = "rx", "tx"; | ||
24 | status = "disabled"; | 37 | status = "disabled"; |
25 | }; | 38 | }; |
26 | |||
diff --git a/Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt b/Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt index e019fdc38773..4a864bd10d3d 100644 --- a/Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt +++ b/Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt | |||
@@ -8,6 +8,8 @@ Required properties: | |||
8 | - compatible : should be "nvidia,tegra20-timer". | 8 | - compatible : should be "nvidia,tegra20-timer". |
9 | - reg : Specifies base physical address and size of the registers. | 9 | - reg : Specifies base physical address and size of the registers. |
10 | - interrupts : A list of 4 interrupts; one per timer channel. | 10 | - interrupts : A list of 4 interrupts; one per timer channel. |
11 | - clocks : Must contain one entry, for the module clock. | ||
12 | See ../clocks/clock-bindings.txt for details. | ||
11 | 13 | ||
12 | Example: | 14 | Example: |
13 | 15 | ||
@@ -18,4 +20,5 @@ timer { | |||
18 | 0 1 0x04 | 20 | 0 1 0x04 |
19 | 0 41 0x04 | 21 | 0 41 0x04 |
20 | 0 42 0x04>; | 22 | 0 42 0x04>; |
23 | clocks = <&tegra_car 132>; | ||
21 | }; | 24 | }; |
diff --git a/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt b/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt index 906109d4c593..b5082a1cf461 100644 --- a/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +++ b/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt | |||
@@ -10,6 +10,8 @@ Required properties: | |||
10 | - reg : Specifies base physical address and size of the registers. | 10 | - reg : Specifies base physical address and size of the registers. |
11 | - interrupts : A list of 6 interrupts; one per each of timer channels 1 | 11 | - interrupts : A list of 6 interrupts; one per each of timer channels 1 |
12 | through 5, and one for the shared interrupt for the remaining channels. | 12 | through 5, and one for the shared interrupt for the remaining channels. |
13 | - clocks : Must contain one entry, for the module clock. | ||
14 | See ../clocks/clock-bindings.txt for details. | ||
13 | 15 | ||
14 | timer { | 16 | timer { |
15 | compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer"; | 17 | compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer"; |
@@ -20,4 +22,5 @@ timer { | |||
20 | 0 42 0x04 | 22 | 0 42 0x04 |
21 | 0 121 0x04 | 23 | 0 121 0x04 |
22 | 0 122 0x04>; | 24 | 0 122 0x04>; |
25 | clocks = <&tegra_car 214>; | ||
23 | }; | 26 | }; |
diff --git a/Documentation/devicetree/bindings/usb/nvidia,tegra20-ehci.txt b/Documentation/devicetree/bindings/usb/nvidia,tegra20-ehci.txt index df0933043a5b..3dc9140e3dfb 100644 --- a/Documentation/devicetree/bindings/usb/nvidia,tegra20-ehci.txt +++ b/Documentation/devicetree/bindings/usb/nvidia,tegra20-ehci.txt | |||
@@ -8,7 +8,12 @@ and additions : | |||
8 | Required properties : | 8 | Required properties : |
9 | - compatible : Should be "nvidia,tegra20-ehci". | 9 | - compatible : Should be "nvidia,tegra20-ehci". |
10 | - nvidia,phy : phandle of the PHY that the controller is connected to. | 10 | - nvidia,phy : phandle of the PHY that the controller is connected to. |
11 | - clocks : Contains a single entry which defines the USB controller's clock. | 11 | - clocks : Must contain one entry, for the module clock. |
12 | See ../clocks/clock-bindings.txt for details. | ||
13 | - resets : Must contain an entry for each entry in reset-names. | ||
14 | See ../reset/reset.txt for details. | ||
15 | - reset-names : Must include the following entries: | ||
16 | - usb | ||
12 | 17 | ||
13 | Optional properties: | 18 | Optional properties: |
14 | - nvidia,needs-double-reset : boolean is to be set for some of the Tegra20 | 19 | - nvidia,needs-double-reset : boolean is to be set for some of the Tegra20 |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0b6d8bf1bc34..dbe173dfa4ae 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -743,7 +743,6 @@ config ARCH_S3C64XX | |||
743 | select S3C_DEV_NAND | 743 | select S3C_DEV_NAND |
744 | select S3C_GPIO_TRACK | 744 | select S3C_GPIO_TRACK |
745 | select SAMSUNG_ATAGS | 745 | select SAMSUNG_ATAGS |
746 | select SAMSUNG_GPIOLIB_4BIT | ||
747 | select SAMSUNG_WAKEMASK | 746 | select SAMSUNG_WAKEMASK |
748 | select SAMSUNG_WDT_RESET | 747 | select SAMSUNG_WDT_RESET |
749 | select USB_ARCH_HAS_OHCI | 748 | select USB_ARCH_HAS_OHCI |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d57c1a65b24f..36e0d06d3efa 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb | |||
6 | dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb | 6 | dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb |
7 | # sam9260 | 7 | # sam9260 |
8 | dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb | 8 | dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb |
9 | dtb-$(CONFIG_ARCH_AT91) += at91-qil_a9260.dtb | ||
9 | dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb | 10 | dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb |
10 | dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb | 11 | dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb |
11 | dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb | 12 | dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb |
diff --git a/arch/arm/boot/dts/at91-qil_a9260.dts b/arch/arm/boot/dts/at91-qil_a9260.dts new file mode 100644 index 000000000000..5576ae8786c0 --- /dev/null +++ b/arch/arm/boot/dts/at91-qil_a9260.dts | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * at91-qil_a9260.dts - Device Tree file for Calao QIL A9260 board | ||
3 | * | ||
4 | * Copyright (C) 2011-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
5 | * | ||
6 | * Licensed under GPLv2. | ||
7 | */ | ||
8 | /dts-v1/; | ||
9 | #include "at91sam9260.dtsi" | ||
10 | / { | ||
11 | model = "Calao QIL A9260"; | ||
12 | compatible = "calao,qil-a9260", "atmel,at91sam9260", "atmel,at91sam9"; | ||
13 | |||
14 | chosen { | ||
15 | bootargs = "console=ttyS0,115200"; | ||
16 | }; | ||
17 | |||
18 | memory { | ||
19 | reg = <0x20000000 0x4000000>; | ||
20 | }; | ||
21 | |||
22 | clocks { | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <1>; | ||
25 | ranges; | ||
26 | |||
27 | main_clock: clock@0 { | ||
28 | compatible = "atmel,osc", "fixed-clock"; | ||
29 | clock-frequency = <12000000>; | ||
30 | }; | ||
31 | }; | ||
32 | |||
33 | ahb { | ||
34 | apb { | ||
35 | usb1: gadget@fffa4000 { | ||
36 | atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>; | ||
37 | status = "okay"; | ||
38 | }; | ||
39 | |||
40 | mmc0: mmc@fffa8000 { | ||
41 | pinctrl-0 = < | ||
42 | &pinctrl_mmc0_clk | ||
43 | &pinctrl_mmc0_slot0_cmd_dat0 | ||
44 | &pinctrl_mmc0_slot0_dat1_3>; | ||
45 | status = "okay"; | ||
46 | slot@0 { | ||
47 | reg = <0>; | ||
48 | bus-width = <4>; | ||
49 | }; | ||
50 | }; | ||
51 | |||
52 | usart0: serial@fffb0000 { | ||
53 | pinctrl-0 = | ||
54 | <&pinctrl_usart0 | ||
55 | &pinctrl_usart0_rts | ||
56 | &pinctrl_usart0_cts | ||
57 | &pinctrl_usart0_dtr_dsr | ||
58 | &pinctrl_usart0_dcd | ||
59 | &pinctrl_usart0_ri>; | ||
60 | status = "okay"; | ||
61 | }; | ||
62 | |||
63 | usart1: serial@fffb4000 { | ||
64 | pinctrl-0 = | ||
65 | <&pinctrl_usart1 | ||
66 | &pinctrl_usart1_rts | ||
67 | &pinctrl_usart1_cts>; | ||
68 | status = "okay"; | ||
69 | }; | ||
70 | |||
71 | usart2: serial@fffb8000 { | ||
72 | pinctrl-0 = | ||
73 | <&pinctrl_usart2 | ||
74 | &pinctrl_usart2_rts | ||
75 | &pinctrl_usart2_cts>; | ||
76 | status = "okay"; | ||
77 | }; | ||
78 | |||
79 | macb0: ethernet@fffc4000 { | ||
80 | phy-mode = "rmii"; | ||
81 | status = "okay"; | ||
82 | }; | ||
83 | |||
84 | spi0: spi@fffc8000 { | ||
85 | status = "okay"; | ||
86 | cs-gpios = <&pioA 3 GPIO_ACTIVE_HIGH>; | ||
87 | |||
88 | m41t94@0 { | ||
89 | compatible = "st,m41t94"; | ||
90 | reg = <0>; | ||
91 | spi-max-frequency = <1000000>; | ||
92 | }; | ||
93 | |||
94 | }; | ||
95 | |||
96 | dbgu: serial@fffff200 { | ||
97 | status = "okay"; | ||
98 | }; | ||
99 | |||
100 | shdwc@fffffd10 { | ||
101 | atmel,wakeup-counter = <10>; | ||
102 | atmel,wakeup-rtt-timer; | ||
103 | }; | ||
104 | }; | ||
105 | |||
106 | usb0: ohci@00500000 { | ||
107 | num-ports = <2>; | ||
108 | status = "okay"; | ||
109 | }; | ||
110 | |||
111 | nand0: nand@40000000 { | ||
112 | nand-bus-width = <8>; | ||
113 | nand-ecc-mode = "soft"; | ||
114 | nand-on-flash-bbt; | ||
115 | status = "okay"; | ||
116 | |||
117 | at91bootstrap@0 { | ||
118 | label = "at91bootstrap"; | ||
119 | reg = <0x0 0x20000>; | ||
120 | }; | ||
121 | |||
122 | barebox@20000 { | ||
123 | label = "barebox"; | ||
124 | reg = <0x20000 0x40000>; | ||
125 | }; | ||
126 | |||
127 | bareboxenv@60000 { | ||
128 | label = "bareboxenv"; | ||
129 | reg = <0x60000 0x20000>; | ||
130 | }; | ||
131 | |||
132 | bareboxenv2@80000 { | ||
133 | label = "bareboxenv2"; | ||
134 | reg = <0x80000 0x20000>; | ||
135 | }; | ||
136 | |||
137 | oftree@a0000 { | ||
138 | label = "oftree"; | ||
139 | reg = <0xa0000 0x20000>; | ||
140 | }; | ||
141 | |||
142 | kernel@c0000 { | ||
143 | label = "kernel"; | ||
144 | reg = <0xc0000 0x400000>; | ||
145 | }; | ||
146 | |||
147 | rootfs@4c0000 { | ||
148 | label = "rootfs"; | ||
149 | reg = <0x4c0000 0x7800000>; | ||
150 | }; | ||
151 | |||
152 | data@7cc0000 { | ||
153 | label = "data"; | ||
154 | reg = <0x7cc0000 0x8340000>; | ||
155 | }; | ||
156 | }; | ||
157 | }; | ||
158 | |||
159 | leds { | ||
160 | compatible = "gpio-leds"; | ||
161 | |||
162 | user_led { | ||
163 | label = "user_led"; | ||
164 | gpios = <&pioB 21 GPIO_ACTIVE_HIGH>; | ||
165 | linux,default-trigger = "heartbeat"; | ||
166 | }; | ||
167 | }; | ||
168 | |||
169 | gpio_keys { | ||
170 | compatible = "gpio-keys"; | ||
171 | #address-cells = <1>; | ||
172 | #size-cells = <0>; | ||
173 | |||
174 | user_pb { | ||
175 | label = "user_pb"; | ||
176 | gpios = <&pioB 10 GPIO_ACTIVE_LOW>; | ||
177 | linux,code = <28>; | ||
178 | gpio-key,wakeup; | ||
179 | }; | ||
180 | }; | ||
181 | |||
182 | i2c@0 { | ||
183 | status = "okay"; | ||
184 | }; | ||
185 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 5cdaba4cea86..de9feced9935 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <dt-bindings/pinctrl/at91.h> | 13 | #include <dt-bindings/pinctrl/at91.h> |
14 | #include <dt-bindings/interrupt-controller/irq.h> | 14 | #include <dt-bindings/interrupt-controller/irq.h> |
15 | #include <dt-bindings/gpio/gpio.h> | 15 | #include <dt-bindings/gpio/gpio.h> |
16 | #include <dt-bindings/clk/at91.h> | ||
16 | 17 | ||
17 | / { | 18 | / { |
18 | model = "Atmel SAMA5D3 family SoC"; | 19 | model = "Atmel SAMA5D3 family SoC"; |
@@ -56,6 +57,14 @@ | |||
56 | reg = <0x20000000 0x8000000>; | 57 | reg = <0x20000000 0x8000000>; |
57 | }; | 58 | }; |
58 | 59 | ||
60 | clocks { | ||
61 | adc_op_clk: adc_op_clk{ | ||
62 | compatible = "fixed-clock"; | ||
63 | #clock-cells = <0>; | ||
64 | clock-frequency = <20000000>; | ||
65 | }; | ||
66 | }; | ||
67 | |||
59 | ahb { | 68 | ahb { |
60 | compatible = "simple-bus"; | 69 | compatible = "simple-bus"; |
61 | #address-cells = <1>; | 70 | #address-cells = <1>; |
@@ -79,6 +88,8 @@ | |||
79 | status = "disabled"; | 88 | status = "disabled"; |
80 | #address-cells = <1>; | 89 | #address-cells = <1>; |
81 | #size-cells = <0>; | 90 | #size-cells = <0>; |
91 | clocks = <&mci0_clk>; | ||
92 | clock-names = "mci_clk"; | ||
82 | }; | 93 | }; |
83 | 94 | ||
84 | spi0: spi@f0004000 { | 95 | spi0: spi@f0004000 { |
@@ -92,6 +103,8 @@ | |||
92 | dma-names = "tx", "rx"; | 103 | dma-names = "tx", "rx"; |
93 | pinctrl-names = "default"; | 104 | pinctrl-names = "default"; |
94 | pinctrl-0 = <&pinctrl_spi0>; | 105 | pinctrl-0 = <&pinctrl_spi0>; |
106 | clocks = <&spi0_clk>; | ||
107 | clock-names = "spi_clk"; | ||
95 | status = "disabled"; | 108 | status = "disabled"; |
96 | }; | 109 | }; |
97 | 110 | ||
@@ -101,6 +114,8 @@ | |||
101 | interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>; | 114 | interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>; |
102 | pinctrl-names = "default"; | 115 | pinctrl-names = "default"; |
103 | pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; | 116 | pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; |
117 | clocks = <&ssc0_clk>; | ||
118 | clock-names = "pclk"; | ||
104 | status = "disabled"; | 119 | status = "disabled"; |
105 | }; | 120 | }; |
106 | 121 | ||
@@ -108,6 +123,8 @@ | |||
108 | compatible = "atmel,at91sam9x5-tcb"; | 123 | compatible = "atmel,at91sam9x5-tcb"; |
109 | reg = <0xf0010000 0x100>; | 124 | reg = <0xf0010000 0x100>; |
110 | interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>; | 125 | interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>; |
126 | clocks = <&tcb0_clk>; | ||
127 | clock-names = "t0_clk"; | ||
111 | }; | 128 | }; |
112 | 129 | ||
113 | i2c0: i2c@f0014000 { | 130 | i2c0: i2c@f0014000 { |
@@ -121,6 +138,7 @@ | |||
121 | pinctrl-0 = <&pinctrl_i2c0>; | 138 | pinctrl-0 = <&pinctrl_i2c0>; |
122 | #address-cells = <1>; | 139 | #address-cells = <1>; |
123 | #size-cells = <0>; | 140 | #size-cells = <0>; |
141 | clocks = <&twi0_clk>; | ||
124 | status = "disabled"; | 142 | status = "disabled"; |
125 | }; | 143 | }; |
126 | 144 | ||
@@ -135,6 +153,7 @@ | |||
135 | pinctrl-0 = <&pinctrl_i2c1>; | 153 | pinctrl-0 = <&pinctrl_i2c1>; |
136 | #address-cells = <1>; | 154 | #address-cells = <1>; |
137 | #size-cells = <0>; | 155 | #size-cells = <0>; |
156 | clocks = <&twi1_clk>; | ||
138 | status = "disabled"; | 157 | status = "disabled"; |
139 | }; | 158 | }; |
140 | 159 | ||
@@ -144,6 +163,8 @@ | |||
144 | interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; | 163 | interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; |
145 | pinctrl-names = "default"; | 164 | pinctrl-names = "default"; |
146 | pinctrl-0 = <&pinctrl_usart0>; | 165 | pinctrl-0 = <&pinctrl_usart0>; |
166 | clocks = <&usart0_clk>; | ||
167 | clock-names = "usart"; | ||
147 | status = "disabled"; | 168 | status = "disabled"; |
148 | }; | 169 | }; |
149 | 170 | ||
@@ -153,6 +174,8 @@ | |||
153 | interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>; | 174 | interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>; |
154 | pinctrl-names = "default"; | 175 | pinctrl-names = "default"; |
155 | pinctrl-0 = <&pinctrl_usart1>; | 176 | pinctrl-0 = <&pinctrl_usart1>; |
177 | clocks = <&usart1_clk>; | ||
178 | clock-names = "usart"; | ||
156 | status = "disabled"; | 179 | status = "disabled"; |
157 | }; | 180 | }; |
158 | 181 | ||
@@ -174,6 +197,8 @@ | |||
174 | status = "disabled"; | 197 | status = "disabled"; |
175 | #address-cells = <1>; | 198 | #address-cells = <1>; |
176 | #size-cells = <0>; | 199 | #size-cells = <0>; |
200 | clocks = <&mci1_clk>; | ||
201 | clock-names = "mci_clk"; | ||
177 | }; | 202 | }; |
178 | 203 | ||
179 | spi1: spi@f8008000 { | 204 | spi1: spi@f8008000 { |
@@ -187,6 +212,8 @@ | |||
187 | dma-names = "tx", "rx"; | 212 | dma-names = "tx", "rx"; |
188 | pinctrl-names = "default"; | 213 | pinctrl-names = "default"; |
189 | pinctrl-0 = <&pinctrl_spi1>; | 214 | pinctrl-0 = <&pinctrl_spi1>; |
215 | clocks = <&spi1_clk>; | ||
216 | clock-names = "spi_clk"; | ||
190 | status = "disabled"; | 217 | status = "disabled"; |
191 | }; | 218 | }; |
192 | 219 | ||
@@ -196,6 +223,8 @@ | |||
196 | interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>; | 223 | interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>; |
197 | pinctrl-names = "default"; | 224 | pinctrl-names = "default"; |
198 | pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; | 225 | pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; |
226 | clocks = <&ssc1_clk>; | ||
227 | clock-names = "pclk"; | ||
199 | status = "disabled"; | 228 | status = "disabled"; |
200 | }; | 229 | }; |
201 | 230 | ||
@@ -219,6 +248,9 @@ | |||
219 | &pinctrl_adc0_ad10 | 248 | &pinctrl_adc0_ad10 |
220 | &pinctrl_adc0_ad11 | 249 | &pinctrl_adc0_ad11 |
221 | >; | 250 | >; |
251 | clocks = <&adc_clk>, | ||
252 | <&adc_op_clk>; | ||
253 | clock-names = "adc_clk", "adc_op_clk"; | ||
222 | atmel,adc-channel-base = <0x50>; | 254 | atmel,adc-channel-base = <0x50>; |
223 | atmel,adc-channels-used = <0xfff>; | 255 | atmel,adc-channels-used = <0xfff>; |
224 | atmel,adc-drdy-mask = <0x1000000>; | 256 | atmel,adc-drdy-mask = <0x1000000>; |
@@ -274,6 +306,7 @@ | |||
274 | dma-names = "tx", "rx"; | 306 | dma-names = "tx", "rx"; |
275 | #address-cells = <1>; | 307 | #address-cells = <1>; |
276 | #size-cells = <0>; | 308 | #size-cells = <0>; |
309 | clocks = <&twi2_clk>; | ||
277 | status = "disabled"; | 310 | status = "disabled"; |
278 | }; | 311 | }; |
279 | 312 | ||
@@ -283,6 +316,8 @@ | |||
283 | interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; | 316 | interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; |
284 | pinctrl-names = "default"; | 317 | pinctrl-names = "default"; |
285 | pinctrl-0 = <&pinctrl_usart2>; | 318 | pinctrl-0 = <&pinctrl_usart2>; |
319 | clocks = <&usart2_clk>; | ||
320 | clock-names = "usart"; | ||
286 | status = "disabled"; | 321 | status = "disabled"; |
287 | }; | 322 | }; |
288 | 323 | ||
@@ -292,6 +327,8 @@ | |||
292 | interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; | 327 | interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; |
293 | pinctrl-names = "default"; | 328 | pinctrl-names = "default"; |
294 | pinctrl-0 = <&pinctrl_usart3>; | 329 | pinctrl-0 = <&pinctrl_usart3>; |
330 | clocks = <&usart3_clk>; | ||
331 | clock-names = "usart"; | ||
295 | status = "disabled"; | 332 | status = "disabled"; |
296 | }; | 333 | }; |
297 | 334 | ||
@@ -318,6 +355,8 @@ | |||
318 | reg = <0xffffe600 0x200>; | 355 | reg = <0xffffe600 0x200>; |
319 | interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>; | 356 | interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>; |
320 | #dma-cells = <2>; | 357 | #dma-cells = <2>; |
358 | clocks = <&dma0_clk>; | ||
359 | clock-names = "dma_clk"; | ||
321 | }; | 360 | }; |
322 | 361 | ||
323 | dma1: dma-controller@ffffe800 { | 362 | dma1: dma-controller@ffffe800 { |
@@ -325,6 +364,8 @@ | |||
325 | reg = <0xffffe800 0x200>; | 364 | reg = <0xffffe800 0x200>; |
326 | interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>; | 365 | interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>; |
327 | #dma-cells = <2>; | 366 | #dma-cells = <2>; |
367 | clocks = <&dma1_clk>; | ||
368 | clock-names = "dma_clk"; | ||
328 | }; | 369 | }; |
329 | 370 | ||
330 | ramc0: ramc@ffffea00 { | 371 | ramc0: ramc@ffffea00 { |
@@ -338,6 +379,8 @@ | |||
338 | interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; | 379 | interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; |
339 | pinctrl-names = "default"; | 380 | pinctrl-names = "default"; |
340 | pinctrl-0 = <&pinctrl_dbgu>; | 381 | pinctrl-0 = <&pinctrl_dbgu>; |
382 | clocks = <&dbgu_clk>; | ||
383 | clock-names = "usart"; | ||
341 | status = "disabled"; | 384 | status = "disabled"; |
342 | }; | 385 | }; |
343 | 386 | ||
@@ -626,6 +669,7 @@ | |||
626 | gpio-controller; | 669 | gpio-controller; |
627 | interrupt-controller; | 670 | interrupt-controller; |
628 | #interrupt-cells = <2>; | 671 | #interrupt-cells = <2>; |
672 | clocks = <&pioA_clk>; | ||
629 | }; | 673 | }; |
630 | 674 | ||
631 | pioB: gpio@fffff400 { | 675 | pioB: gpio@fffff400 { |
@@ -636,6 +680,7 @@ | |||
636 | gpio-controller; | 680 | gpio-controller; |
637 | interrupt-controller; | 681 | interrupt-controller; |
638 | #interrupt-cells = <2>; | 682 | #interrupt-cells = <2>; |
683 | clocks = <&pioB_clk>; | ||
639 | }; | 684 | }; |
640 | 685 | ||
641 | pioC: gpio@fffff600 { | 686 | pioC: gpio@fffff600 { |
@@ -646,6 +691,7 @@ | |||
646 | gpio-controller; | 691 | gpio-controller; |
647 | interrupt-controller; | 692 | interrupt-controller; |
648 | #interrupt-cells = <2>; | 693 | #interrupt-cells = <2>; |
694 | clocks = <&pioC_clk>; | ||
649 | }; | 695 | }; |
650 | 696 | ||
651 | pioD: gpio@fffff800 { | 697 | pioD: gpio@fffff800 { |
@@ -656,6 +702,7 @@ | |||
656 | gpio-controller; | 702 | gpio-controller; |
657 | interrupt-controller; | 703 | interrupt-controller; |
658 | #interrupt-cells = <2>; | 704 | #interrupt-cells = <2>; |
705 | clocks = <&pioD_clk>; | ||
659 | }; | 706 | }; |
660 | 707 | ||
661 | pioE: gpio@fffffa00 { | 708 | pioE: gpio@fffffa00 { |
@@ -666,12 +713,334 @@ | |||
666 | gpio-controller; | 713 | gpio-controller; |
667 | interrupt-controller; | 714 | interrupt-controller; |
668 | #interrupt-cells = <2>; | 715 | #interrupt-cells = <2>; |
716 | clocks = <&pioE_clk>; | ||
669 | }; | 717 | }; |
670 | }; | 718 | }; |
671 | 719 | ||
672 | pmc: pmc@fffffc00 { | 720 | pmc: pmc@fffffc00 { |
673 | compatible = "atmel,at91rm9200-pmc"; | 721 | compatible = "atmel,sama5d3-pmc"; |
674 | reg = <0xfffffc00 0x120>; | 722 | reg = <0xfffffc00 0x120>; |
723 | interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; | ||
724 | interrupt-controller; | ||
725 | #address-cells = <1>; | ||
726 | #size-cells = <0>; | ||
727 | #interrupt-cells = <1>; | ||
728 | |||
729 | clk32k: slck { | ||
730 | compatible = "fixed-clock"; | ||
731 | #clock-cells = <0>; | ||
732 | clock-frequency = <32768>; | ||
733 | }; | ||
734 | |||
735 | main: mainck { | ||
736 | compatible = "atmel,at91rm9200-clk-main"; | ||
737 | #clock-cells = <0>; | ||
738 | interrupt-parent = <&pmc>; | ||
739 | interrupts = <AT91_PMC_MOSCS>; | ||
740 | clocks = <&clk32k>; | ||
741 | }; | ||
742 | |||
743 | plla: pllack { | ||
744 | compatible = "atmel,sama5d3-clk-pll"; | ||
745 | #clock-cells = <0>; | ||
746 | interrupt-parent = <&pmc>; | ||
747 | interrupts = <AT91_PMC_LOCKA>; | ||
748 | clocks = <&main>; | ||
749 | reg = <0>; | ||
750 | atmel,clk-input-range = <8000000 50000000>; | ||
751 | #atmel,pll-clk-output-range-cells = <4>; | ||
752 | atmel,pll-clk-output-ranges = <400000000 1000000000 0 0>; | ||
753 | }; | ||
754 | |||
755 | plladiv: plladivck { | ||
756 | compatible = "atmel,at91sam9x5-clk-plldiv"; | ||
757 | #clock-cells = <0>; | ||
758 | clocks = <&plla>; | ||
759 | }; | ||
760 | |||
761 | utmi: utmick { | ||
762 | compatible = "atmel,at91sam9x5-clk-utmi"; | ||
763 | #clock-cells = <0>; | ||
764 | interrupt-parent = <&pmc>; | ||
765 | interrupts = <AT91_PMC_LOCKU>; | ||
766 | clocks = <&main>; | ||
767 | }; | ||
768 | |||
769 | mck: masterck { | ||
770 | compatible = "atmel,at91sam9x5-clk-master"; | ||
771 | #clock-cells = <0>; | ||
772 | interrupt-parent = <&pmc>; | ||
773 | interrupts = <AT91_PMC_MCKRDY>; | ||
774 | clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>; | ||
775 | atmel,clk-output-range = <0 166000000>; | ||
776 | atmel,clk-divisors = <1 2 4 3>; | ||
777 | }; | ||
778 | |||
779 | usb: usbck { | ||
780 | compatible = "atmel,at91sam9x5-clk-usb"; | ||
781 | #clock-cells = <0>; | ||
782 | clocks = <&plladiv>, <&utmi>; | ||
783 | }; | ||
784 | |||
785 | prog: progck { | ||
786 | compatible = "atmel,at91sam9x5-clk-programmable"; | ||
787 | #address-cells = <1>; | ||
788 | #size-cells = <0>; | ||
789 | interrupt-parent = <&pmc>; | ||
790 | clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>; | ||
791 | |||
792 | prog0: prog0 { | ||
793 | #clock-cells = <0>; | ||
794 | reg = <0>; | ||
795 | interrupts = <AT91_PMC_PCKRDY(0)>; | ||
796 | }; | ||
797 | |||
798 | prog1: prog1 { | ||
799 | #clock-cells = <0>; | ||
800 | reg = <1>; | ||
801 | interrupts = <AT91_PMC_PCKRDY(1)>; | ||
802 | }; | ||
803 | |||
804 | prog2: prog2 { | ||
805 | #clock-cells = <0>; | ||
806 | reg = <2>; | ||
807 | interrupts = <AT91_PMC_PCKRDY(2)>; | ||
808 | }; | ||
809 | }; | ||
810 | |||
811 | smd: smdclk { | ||
812 | compatible = "atmel,at91sam9x5-clk-smd"; | ||
813 | #clock-cells = <0>; | ||
814 | clocks = <&plladiv>, <&utmi>; | ||
815 | }; | ||
816 | |||
817 | systemck { | ||
818 | compatible = "atmel,at91rm9200-clk-system"; | ||
819 | #address-cells = <1>; | ||
820 | #size-cells = <0>; | ||
821 | |||
822 | ddrck: ddrck { | ||
823 | #clock-cells = <0>; | ||
824 | reg = <2>; | ||
825 | clocks = <&mck>; | ||
826 | }; | ||
827 | |||
828 | smdck: smdck { | ||
829 | #clock-cells = <0>; | ||
830 | reg = <4>; | ||
831 | clocks = <&smd>; | ||
832 | }; | ||
833 | |||
834 | uhpck: uhpck { | ||
835 | #clock-cells = <0>; | ||
836 | reg = <6>; | ||
837 | clocks = <&usb>; | ||
838 | }; | ||
839 | |||
840 | udpck: udpck { | ||
841 | #clock-cells = <0>; | ||
842 | reg = <7>; | ||
843 | clocks = <&usb>; | ||
844 | }; | ||
845 | |||
846 | pck0: pck0 { | ||
847 | #clock-cells = <0>; | ||
848 | reg = <8>; | ||
849 | clocks = <&prog0>; | ||
850 | }; | ||
851 | |||
852 | pck1: pck1 { | ||
853 | #clock-cells = <0>; | ||
854 | reg = <9>; | ||
855 | clocks = <&prog1>; | ||
856 | }; | ||
857 | |||
858 | pck2: pck2 { | ||
859 | #clock-cells = <0>; | ||
860 | reg = <10>; | ||
861 | clocks = <&prog2>; | ||
862 | }; | ||
863 | }; | ||
864 | |||
865 | periphck { | ||
866 | compatible = "atmel,at91sam9x5-clk-peripheral"; | ||
867 | #address-cells = <1>; | ||
868 | #size-cells = <0>; | ||
869 | clocks = <&mck>; | ||
870 | |||
871 | dbgu_clk: dbgu_clk { | ||
872 | #clock-cells = <0>; | ||
873 | reg = <2>; | ||
874 | }; | ||
875 | |||
876 | pioA_clk: pioA_clk { | ||
877 | #clock-cells = <0>; | ||
878 | reg = <6>; | ||
879 | }; | ||
880 | |||
881 | pioB_clk: pioB_clk { | ||
882 | #clock-cells = <0>; | ||
883 | reg = <7>; | ||
884 | }; | ||
885 | |||
886 | pioC_clk: pioC_clk { | ||
887 | #clock-cells = <0>; | ||
888 | reg = <8>; | ||
889 | }; | ||
890 | |||
891 | pioD_clk: pioD_clk { | ||
892 | #clock-cells = <0>; | ||
893 | reg = <9>; | ||
894 | }; | ||
895 | |||
896 | pioE_clk: pioE_clk { | ||
897 | #clock-cells = <0>; | ||
898 | reg = <10>; | ||
899 | }; | ||
900 | |||
901 | usart0_clk: usart0_clk { | ||
902 | #clock-cells = <0>; | ||
903 | reg = <12>; | ||
904 | atmel,clk-output-range = <0 66000000>; | ||
905 | }; | ||
906 | |||
907 | usart1_clk: usart1_clk { | ||
908 | #clock-cells = <0>; | ||
909 | reg = <13>; | ||
910 | atmel,clk-output-range = <0 66000000>; | ||
911 | }; | ||
912 | |||
913 | usart2_clk: usart2_clk { | ||
914 | #clock-cells = <0>; | ||
915 | reg = <14>; | ||
916 | atmel,clk-output-range = <0 66000000>; | ||
917 | }; | ||
918 | |||
919 | usart3_clk: usart3_clk { | ||
920 | #clock-cells = <0>; | ||
921 | reg = <15>; | ||
922 | atmel,clk-output-range = <0 66000000>; | ||
923 | }; | ||
924 | |||
925 | twi0_clk: twi0_clk { | ||
926 | reg = <18>; | ||
927 | #clock-cells = <0>; | ||
928 | atmel,clk-output-range = <0 16625000>; | ||
929 | }; | ||
930 | |||
931 | twi1_clk: twi1_clk { | ||
932 | #clock-cells = <0>; | ||
933 | reg = <19>; | ||
934 | atmel,clk-output-range = <0 16625000>; | ||
935 | }; | ||
936 | |||
937 | twi2_clk: twi2_clk { | ||
938 | #clock-cells = <0>; | ||
939 | reg = <20>; | ||
940 | atmel,clk-output-range = <0 16625000>; | ||
941 | }; | ||
942 | |||
943 | mci0_clk: mci0_clk { | ||
944 | #clock-cells = <0>; | ||
945 | reg = <21>; | ||
946 | }; | ||
947 | |||
948 | mci1_clk: mci1_clk { | ||
949 | #clock-cells = <0>; | ||
950 | reg = <22>; | ||
951 | }; | ||
952 | |||
953 | spi0_clk: spi0_clk { | ||
954 | #clock-cells = <0>; | ||
955 | reg = <24>; | ||
956 | atmel,clk-output-range = <0 133000000>; | ||
957 | }; | ||
958 | |||
959 | spi1_clk: spi1_clk { | ||
960 | #clock-cells = <0>; | ||
961 | reg = <25>; | ||
962 | atmel,clk-output-range = <0 133000000>; | ||
963 | }; | ||
964 | |||
965 | tcb0_clk: tcb0_clk { | ||
966 | #clock-cells = <0>; | ||
967 | reg = <26>; | ||
968 | atmel,clk-output-range = <0 133000000>; | ||
969 | }; | ||
970 | |||
971 | pwm_clk: pwm_clk { | ||
972 | #clock-cells = <0>; | ||
973 | reg = <28>; | ||
974 | }; | ||
975 | |||
976 | adc_clk: adc_clk { | ||
977 | #clock-cells = <0>; | ||
978 | reg = <29>; | ||
979 | atmel,clk-output-range = <0 66000000>; | ||
980 | }; | ||
981 | |||
982 | dma0_clk: dma0_clk { | ||
983 | #clock-cells = <0>; | ||
984 | reg = <30>; | ||
985 | }; | ||
986 | |||
987 | dma1_clk: dma1_clk { | ||
988 | #clock-cells = <0>; | ||
989 | reg = <31>; | ||
990 | }; | ||
991 | |||
992 | uhphs_clk: uhphs_clk { | ||
993 | #clock-cells = <0>; | ||
994 | reg = <32>; | ||
995 | }; | ||
996 | |||
997 | udphs_clk: udphs_clk { | ||
998 | #clock-cells = <0>; | ||
999 | reg = <33>; | ||
1000 | }; | ||
1001 | |||
1002 | isi_clk: isi_clk { | ||
1003 | #clock-cells = <0>; | ||
1004 | reg = <37>; | ||
1005 | }; | ||
1006 | |||
1007 | ssc0_clk: ssc0_clk { | ||
1008 | #clock-cells = <0>; | ||
1009 | reg = <38>; | ||
1010 | atmel,clk-output-range = <0 66000000>; | ||
1011 | }; | ||
1012 | |||
1013 | ssc1_clk: ssc1_clk { | ||
1014 | #clock-cells = <0>; | ||
1015 | reg = <39>; | ||
1016 | atmel,clk-output-range = <0 66000000>; | ||
1017 | }; | ||
1018 | |||
1019 | sha_clk: sha_clk { | ||
1020 | #clock-cells = <0>; | ||
1021 | reg = <42>; | ||
1022 | }; | ||
1023 | |||
1024 | aes_clk: aes_clk { | ||
1025 | #clock-cells = <0>; | ||
1026 | reg = <43>; | ||
1027 | }; | ||
1028 | |||
1029 | tdes_clk: tdes_clk { | ||
1030 | #clock-cells = <0>; | ||
1031 | reg = <44>; | ||
1032 | }; | ||
1033 | |||
1034 | trng_clk: trng_clk { | ||
1035 | #clock-cells = <0>; | ||
1036 | reg = <45>; | ||
1037 | }; | ||
1038 | |||
1039 | fuse_clk: fuse_clk { | ||
1040 | #clock-cells = <0>; | ||
1041 | reg = <48>; | ||
1042 | }; | ||
1043 | }; | ||
675 | }; | 1044 | }; |
676 | 1045 | ||
677 | rstc@fffffe00 { | 1046 | rstc@fffffe00 { |
@@ -683,6 +1052,7 @@ | |||
683 | compatible = "atmel,at91sam9260-pit"; | 1052 | compatible = "atmel,at91sam9260-pit"; |
684 | reg = <0xfffffe30 0xf>; | 1053 | reg = <0xfffffe30 0xf>; |
685 | interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; | 1054 | interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; |
1055 | clocks = <&mck>; | ||
686 | }; | 1056 | }; |
687 | 1057 | ||
688 | watchdog@fffffe40 { | 1058 | watchdog@fffffe40 { |
@@ -705,6 +1075,8 @@ | |||
705 | reg = <0x00500000 0x100000 | 1075 | reg = <0x00500000 0x100000 |
706 | 0xf8030000 0x4000>; | 1076 | 0xf8030000 0x4000>; |
707 | interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>; | 1077 | interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>; |
1078 | clocks = <&udphs_clk>, <&utmi>; | ||
1079 | clock-names = "pclk", "hclk"; | ||
708 | status = "disabled"; | 1080 | status = "disabled"; |
709 | 1081 | ||
710 | ep0 { | 1082 | ep0 { |
@@ -817,6 +1189,9 @@ | |||
817 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 1189 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
818 | reg = <0x00600000 0x100000>; | 1190 | reg = <0x00600000 0x100000>; |
819 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; | 1191 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; |
1192 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | ||
1193 | <&uhpck>; | ||
1194 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | ||
820 | status = "disabled"; | 1195 | status = "disabled"; |
821 | }; | 1196 | }; |
822 | 1197 | ||
@@ -824,6 +1199,8 @@ | |||
824 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | 1199 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; |
825 | reg = <0x00700000 0x100000>; | 1200 | reg = <0x00700000 0x100000>; |
826 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; | 1201 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; |
1202 | clocks = <&usb>, <&uhphs_clk>, <&uhpck>; | ||
1203 | clock-names = "usb_clk", "ehci_clk", "uhpck"; | ||
827 | status = "disabled"; | 1204 | status = "disabled"; |
828 | }; | 1205 | }; |
829 | 1206 | ||
diff --git a/arch/arm/boot/dts/sama5d3_can.dtsi b/arch/arm/boot/dts/sama5d3_can.dtsi index 8ed3260cef66..a0775851cce5 100644 --- a/arch/arm/boot/dts/sama5d3_can.dtsi +++ b/arch/arm/boot/dts/sama5d3_can.dtsi | |||
@@ -32,12 +32,30 @@ | |||
32 | 32 | ||
33 | }; | 33 | }; |
34 | 34 | ||
35 | pmc: pmc@fffffc00 { | ||
36 | periphck { | ||
37 | can0_clk: can0_clk { | ||
38 | #clock-cells = <0>; | ||
39 | reg = <40>; | ||
40 | atmel,clk-output-range = <0 66000000>; | ||
41 | }; | ||
42 | |||
43 | can1_clk: can0_clk { | ||
44 | #clock-cells = <0>; | ||
45 | reg = <41>; | ||
46 | atmel,clk-output-range = <0 66000000>; | ||
47 | }; | ||
48 | }; | ||
49 | }; | ||
50 | |||
35 | can0: can@f000c000 { | 51 | can0: can@f000c000 { |
36 | compatible = "atmel,at91sam9x5-can"; | 52 | compatible = "atmel,at91sam9x5-can"; |
37 | reg = <0xf000c000 0x300>; | 53 | reg = <0xf000c000 0x300>; |
38 | interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>; | 54 | interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>; |
39 | pinctrl-names = "default"; | 55 | pinctrl-names = "default"; |
40 | pinctrl-0 = <&pinctrl_can0_rx_tx>; | 56 | pinctrl-0 = <&pinctrl_can0_rx_tx>; |
57 | clocks = <&can0_clk>; | ||
58 | clock-names = "can_clk"; | ||
41 | status = "disabled"; | 59 | status = "disabled"; |
42 | }; | 60 | }; |
43 | 61 | ||
@@ -47,6 +65,8 @@ | |||
47 | interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>; | 65 | interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>; |
48 | pinctrl-names = "default"; | 66 | pinctrl-names = "default"; |
49 | pinctrl-0 = <&pinctrl_can1_rx_tx>; | 67 | pinctrl-0 = <&pinctrl_can1_rx_tx>; |
68 | clocks = <&can1_clk>; | ||
69 | clock-names = "can_clk"; | ||
50 | status = "disabled"; | 70 | status = "disabled"; |
51 | }; | 71 | }; |
52 | }; | 72 | }; |
diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi index 4d4f351f1f9f..fe2af9276312 100644 --- a/arch/arm/boot/dts/sama5d3_emac.dtsi +++ b/arch/arm/boot/dts/sama5d3_emac.dtsi | |||
@@ -31,12 +31,23 @@ | |||
31 | }; | 31 | }; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | pmc: pmc@fffffc00 { | ||
35 | periphck { | ||
36 | macb1_clk: macb1_clk { | ||
37 | #clock-cells = <0>; | ||
38 | reg = <35>; | ||
39 | }; | ||
40 | }; | ||
41 | }; | ||
42 | |||
34 | macb1: ethernet@f802c000 { | 43 | macb1: ethernet@f802c000 { |
35 | compatible = "cdns,at32ap7000-macb", "cdns,macb"; | 44 | compatible = "cdns,at32ap7000-macb", "cdns,macb"; |
36 | reg = <0xf802c000 0x100>; | 45 | reg = <0xf802c000 0x100>; |
37 | interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; | 46 | interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; |
38 | pinctrl-names = "default"; | 47 | pinctrl-names = "default"; |
39 | pinctrl-0 = <&pinctrl_macb1_rmii>; | 48 | pinctrl-0 = <&pinctrl_macb1_rmii>; |
49 | clocks = <&macb1_clk>, <&macb1_clk>; | ||
50 | clock-names = "hclk", "pclk"; | ||
40 | status = "disabled"; | 51 | status = "disabled"; |
41 | }; | 52 | }; |
42 | }; | 53 | }; |
diff --git a/arch/arm/boot/dts/sama5d3_gmac.dtsi b/arch/arm/boot/dts/sama5d3_gmac.dtsi index 0ba8be30ccd8..a6cb0508762f 100644 --- a/arch/arm/boot/dts/sama5d3_gmac.dtsi +++ b/arch/arm/boot/dts/sama5d3_gmac.dtsi | |||
@@ -64,12 +64,23 @@ | |||
64 | }; | 64 | }; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | pmc: pmc@fffffc00 { | ||
68 | periphck { | ||
69 | macb0_clk: macb0_clk { | ||
70 | #clock-cells = <0>; | ||
71 | reg = <34>; | ||
72 | }; | ||
73 | }; | ||
74 | }; | ||
75 | |||
67 | macb0: ethernet@f0028000 { | 76 | macb0: ethernet@f0028000 { |
68 | compatible = "cdns,pc302-gem", "cdns,gem"; | 77 | compatible = "cdns,pc302-gem", "cdns,gem"; |
69 | reg = <0xf0028000 0x100>; | 78 | reg = <0xf0028000 0x100>; |
70 | interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>; | 79 | interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>; |
71 | pinctrl-names = "default"; | 80 | pinctrl-names = "default"; |
72 | pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; | 81 | pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; |
82 | clocks = <&macb0_clk>, <&macb0_clk>; | ||
83 | clock-names = "hclk", "pclk"; | ||
73 | status = "disabled"; | 84 | status = "disabled"; |
74 | }; | 85 | }; |
75 | }; | 86 | }; |
diff --git a/arch/arm/boot/dts/sama5d3_lcd.dtsi b/arch/arm/boot/dts/sama5d3_lcd.dtsi index 01f52a79f8ba..85d302701565 100644 --- a/arch/arm/boot/dts/sama5d3_lcd.dtsi +++ b/arch/arm/boot/dts/sama5d3_lcd.dtsi | |||
@@ -50,6 +50,23 @@ | |||
50 | }; | 50 | }; |
51 | }; | 51 | }; |
52 | }; | 52 | }; |
53 | |||
54 | pmc: pmc@fffffc00 { | ||
55 | periphck { | ||
56 | lcdc_clk: lcdc_clk { | ||
57 | #clock-cells = <0>; | ||
58 | reg = <36>; | ||
59 | }; | ||
60 | }; | ||
61 | |||
62 | systemck { | ||
63 | lcdck: lcdck { | ||
64 | #clock-cells = <0>; | ||
65 | reg = <3>; | ||
66 | clocks = <&mck>; | ||
67 | }; | ||
68 | }; | ||
69 | }; | ||
53 | }; | 70 | }; |
54 | }; | 71 | }; |
55 | }; | 72 | }; |
diff --git a/arch/arm/boot/dts/sama5d3_mci2.dtsi b/arch/arm/boot/dts/sama5d3_mci2.dtsi index 38e88e39e551..b029fe7ef17a 100644 --- a/arch/arm/boot/dts/sama5d3_mci2.dtsi +++ b/arch/arm/boot/dts/sama5d3_mci2.dtsi | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <dt-bindings/pinctrl/at91.h> | 10 | #include <dt-bindings/pinctrl/at91.h> |
11 | #include <dt-bindings/interrupt-controller/irq.h> | 11 | #include <dt-bindings/interrupt-controller/irq.h> |
12 | #include <dt-bindings/clk/at91.h> | ||
12 | 13 | ||
13 | / { | 14 | / { |
14 | ahb { | 15 | ahb { |
@@ -30,6 +31,15 @@ | |||
30 | }; | 31 | }; |
31 | }; | 32 | }; |
32 | 33 | ||
34 | pmc: pmc@fffffc00 { | ||
35 | periphck { | ||
36 | mci2_clk: mci2_clk { | ||
37 | #clock-cells = <0>; | ||
38 | reg = <23>; | ||
39 | }; | ||
40 | }; | ||
41 | }; | ||
42 | |||
33 | mmc2: mmc@f8004000 { | 43 | mmc2: mmc@f8004000 { |
34 | compatible = "atmel,hsmci"; | 44 | compatible = "atmel,hsmci"; |
35 | reg = <0xf8004000 0x600>; | 45 | reg = <0xf8004000 0x600>; |
@@ -38,6 +48,8 @@ | |||
38 | dma-names = "rxtx"; | 48 | dma-names = "rxtx"; |
39 | pinctrl-names = "default"; | 49 | pinctrl-names = "default"; |
40 | pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; | 50 | pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; |
51 | clocks = <&mci2_clk>; | ||
52 | clock-names = "mci_clk"; | ||
41 | status = "disabled"; | 53 | status = "disabled"; |
42 | #address-cells = <1>; | 54 | #address-cells = <1>; |
43 | #size-cells = <0>; | 55 | #size-cells = <0>; |
diff --git a/arch/arm/boot/dts/sama5d3_tcb1.dtsi b/arch/arm/boot/dts/sama5d3_tcb1.dtsi index 5264bb4a6998..382b04431f66 100644 --- a/arch/arm/boot/dts/sama5d3_tcb1.dtsi +++ b/arch/arm/boot/dts/sama5d3_tcb1.dtsi | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <dt-bindings/pinctrl/at91.h> | 10 | #include <dt-bindings/pinctrl/at91.h> |
11 | #include <dt-bindings/interrupt-controller/irq.h> | 11 | #include <dt-bindings/interrupt-controller/irq.h> |
12 | #include <dt-bindings/clk/at91.h> | ||
12 | 13 | ||
13 | / { | 14 | / { |
14 | aliases { | 15 | aliases { |
@@ -17,10 +18,21 @@ | |||
17 | 18 | ||
18 | ahb { | 19 | ahb { |
19 | apb { | 20 | apb { |
21 | pmc: pmc@fffffc00 { | ||
22 | periphck { | ||
23 | tcb1_clk: tcb1_clk { | ||
24 | #clock-cells = <0>; | ||
25 | reg = <27>; | ||
26 | }; | ||
27 | }; | ||
28 | }; | ||
29 | |||
20 | tcb1: timer@f8014000 { | 30 | tcb1: timer@f8014000 { |
21 | compatible = "atmel,at91sam9x5-tcb"; | 31 | compatible = "atmel,at91sam9x5-tcb"; |
22 | reg = <0xf8014000 0x100>; | 32 | reg = <0xf8014000 0x100>; |
23 | interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; | 33 | interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; |
34 | clocks = <&tcb1_clk>; | ||
35 | clock-names = "t0_clk"; | ||
24 | }; | 36 | }; |
25 | }; | 37 | }; |
26 | }; | 38 | }; |
diff --git a/arch/arm/boot/dts/sama5d3_uart.dtsi b/arch/arm/boot/dts/sama5d3_uart.dtsi index 98fcb2d57446..49d4d76ca6f4 100644 --- a/arch/arm/boot/dts/sama5d3_uart.dtsi +++ b/arch/arm/boot/dts/sama5d3_uart.dtsi | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <dt-bindings/pinctrl/at91.h> | 10 | #include <dt-bindings/pinctrl/at91.h> |
11 | #include <dt-bindings/interrupt-controller/irq.h> | 11 | #include <dt-bindings/interrupt-controller/irq.h> |
12 | #include <dt-bindings/clk/at91.h> | ||
12 | 13 | ||
13 | / { | 14 | / { |
14 | ahb { | 15 | ahb { |
@@ -31,12 +32,30 @@ | |||
31 | }; | 32 | }; |
32 | }; | 33 | }; |
33 | 34 | ||
35 | pmc: pmc@fffffc00 { | ||
36 | periphck { | ||
37 | uart0_clk: uart0_clk { | ||
38 | #clock-cells = <0>; | ||
39 | reg = <16>; | ||
40 | atmel,clk-output-range = <0 66000000>; | ||
41 | }; | ||
42 | |||
43 | uart1_clk: uart1_clk { | ||
44 | #clock-cells = <0>; | ||
45 | reg = <17>; | ||
46 | atmel,clk-output-range = <0 66000000>; | ||
47 | }; | ||
48 | }; | ||
49 | }; | ||
50 | |||
34 | uart0: serial@f0024000 { | 51 | uart0: serial@f0024000 { |
35 | compatible = "atmel,at91sam9260-usart"; | 52 | compatible = "atmel,at91sam9260-usart"; |
36 | reg = <0xf0024000 0x200>; | 53 | reg = <0xf0024000 0x200>; |
37 | interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; | 54 | interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; |
38 | pinctrl-names = "default"; | 55 | pinctrl-names = "default"; |
39 | pinctrl-0 = <&pinctrl_uart0>; | 56 | pinctrl-0 = <&pinctrl_uart0>; |
57 | clocks = <&uart0_clk>; | ||
58 | clock-names = "usart"; | ||
40 | status = "disabled"; | 59 | status = "disabled"; |
41 | }; | 60 | }; |
42 | 61 | ||
@@ -46,6 +65,8 @@ | |||
46 | interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; | 65 | interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; |
47 | pinctrl-names = "default"; | 66 | pinctrl-names = "default"; |
48 | pinctrl-0 = <&pinctrl_uart1>; | 67 | pinctrl-0 = <&pinctrl_uart1>; |
68 | clocks = <&uart1_clk>; | ||
69 | clock-names = "usart"; | ||
49 | status = "disabled"; | 70 | status = "disabled"; |
50 | }; | 71 | }; |
51 | }; | 72 | }; |
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi index 726a0f35100c..f55ed072c8e6 100644 --- a/arch/arm/boot/dts/sama5d3xcm.dtsi +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi | |||
@@ -18,17 +18,6 @@ | |||
18 | reg = <0x20000000 0x20000000>; | 18 | reg = <0x20000000 0x20000000>; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | clocks { | ||
22 | #address-cells = <1>; | ||
23 | #size-cells = <1>; | ||
24 | ranges; | ||
25 | |||
26 | main_clock: clock@0 { | ||
27 | compatible = "atmel,osc", "fixed-clock"; | ||
28 | clock-frequency = <12000000>; | ||
29 | }; | ||
30 | }; | ||
31 | |||
32 | ahb { | 21 | ahb { |
33 | apb { | 22 | apb { |
34 | spi0: spi@f0004000 { | 23 | spi0: spi@f0004000 { |
@@ -38,6 +27,12 @@ | |||
38 | macb0: ethernet@f0028000 { | 27 | macb0: ethernet@f0028000 { |
39 | phy-mode = "rgmii"; | 28 | phy-mode = "rgmii"; |
40 | }; | 29 | }; |
30 | |||
31 | pmc: pmc@fffffc00 { | ||
32 | main: mainck { | ||
33 | clock-frequency = <12000000>; | ||
34 | }; | ||
35 | }; | ||
41 | }; | 36 | }; |
42 | 37 | ||
43 | nand0: nand@60000000 { | 38 | nand0: nand@60000000 { |
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi index 8d42787c8ff1..731249fbe206 100644 --- a/arch/arm/boot/dts/tegra114.dtsi +++ b/arch/arm/boot/dts/tegra114.dtsi | |||
@@ -43,6 +43,7 @@ | |||
43 | compatible = "nvidia,tegra114-car"; | 43 | compatible = "nvidia,tegra114-car"; |
44 | reg = <0x60006000 0x1000>; | 44 | reg = <0x60006000 0x1000>; |
45 | #clock-cells = <1>; | 45 | #clock-cells = <1>; |
46 | #reset-cells = <1>; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | apbdma: dma { | 49 | apbdma: dma { |
@@ -81,6 +82,9 @@ | |||
81 | <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, | 82 | <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, |
82 | <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; | 83 | <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; |
83 | clocks = <&tegra_car TEGRA114_CLK_APBDMA>; | 84 | clocks = <&tegra_car TEGRA114_CLK_APBDMA>; |
85 | resets = <&tegra_car 34>; | ||
86 | reset-names = "dma"; | ||
87 | #dma-cells = <1>; | ||
84 | }; | 88 | }; |
85 | 89 | ||
86 | ahb: ahb { | 90 | ahb: ahb { |
@@ -124,9 +128,12 @@ | |||
124 | reg = <0x70006000 0x40>; | 128 | reg = <0x70006000 0x40>; |
125 | reg-shift = <2>; | 129 | reg-shift = <2>; |
126 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; | 130 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; |
127 | nvidia,dma-request-selector = <&apbdma 8>; | ||
128 | status = "disabled"; | ||
129 | clocks = <&tegra_car TEGRA114_CLK_UARTA>; | 131 | clocks = <&tegra_car TEGRA114_CLK_UARTA>; |
132 | resets = <&tegra_car 6>; | ||
133 | reset-names = "serial"; | ||
134 | dmas = <&apbdma 8>, <&apbdma 8>; | ||
135 | dma-names = "rx", "tx"; | ||
136 | status = "disabled"; | ||
130 | }; | 137 | }; |
131 | 138 | ||
132 | uartb: serial@70006040 { | 139 | uartb: serial@70006040 { |
@@ -134,9 +141,12 @@ | |||
134 | reg = <0x70006040 0x40>; | 141 | reg = <0x70006040 0x40>; |
135 | reg-shift = <2>; | 142 | reg-shift = <2>; |
136 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; | 143 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; |
137 | nvidia,dma-request-selector = <&apbdma 9>; | ||
138 | status = "disabled"; | ||
139 | clocks = <&tegra_car TEGRA114_CLK_UARTB>; | 144 | clocks = <&tegra_car TEGRA114_CLK_UARTB>; |
145 | resets = <&tegra_car 7>; | ||
146 | reset-names = "serial"; | ||
147 | dmas = <&apbdma 9>, <&apbdma 9>; | ||
148 | dma-names = "rx", "tx"; | ||
149 | status = "disabled"; | ||
140 | }; | 150 | }; |
141 | 151 | ||
142 | uartc: serial@70006200 { | 152 | uartc: serial@70006200 { |
@@ -144,9 +154,12 @@ | |||
144 | reg = <0x70006200 0x100>; | 154 | reg = <0x70006200 0x100>; |
145 | reg-shift = <2>; | 155 | reg-shift = <2>; |
146 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; | 156 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; |
147 | nvidia,dma-request-selector = <&apbdma 10>; | ||
148 | status = "disabled"; | ||
149 | clocks = <&tegra_car TEGRA114_CLK_UARTC>; | 157 | clocks = <&tegra_car TEGRA114_CLK_UARTC>; |
158 | resets = <&tegra_car 55>; | ||
159 | reset-names = "serial"; | ||
160 | dmas = <&apbdma 10>, <&apbdma 10>; | ||
161 | dma-names = "rx", "tx"; | ||
162 | status = "disabled"; | ||
150 | }; | 163 | }; |
151 | 164 | ||
152 | uartd: serial@70006300 { | 165 | uartd: serial@70006300 { |
@@ -154,9 +167,12 @@ | |||
154 | reg = <0x70006300 0x100>; | 167 | reg = <0x70006300 0x100>; |
155 | reg-shift = <2>; | 168 | reg-shift = <2>; |
156 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; | 169 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; |
157 | nvidia,dma-request-selector = <&apbdma 19>; | ||
158 | status = "disabled"; | ||
159 | clocks = <&tegra_car TEGRA114_CLK_UARTD>; | 170 | clocks = <&tegra_car TEGRA114_CLK_UARTD>; |
171 | resets = <&tegra_car 65>; | ||
172 | reset-names = "serial"; | ||
173 | dmas = <&apbdma 19>, <&apbdma 19>; | ||
174 | dma-names = "rx", "tx"; | ||
175 | status = "disabled"; | ||
160 | }; | 176 | }; |
161 | 177 | ||
162 | pwm: pwm { | 178 | pwm: pwm { |
@@ -164,6 +180,8 @@ | |||
164 | reg = <0x7000a000 0x100>; | 180 | reg = <0x7000a000 0x100>; |
165 | #pwm-cells = <2>; | 181 | #pwm-cells = <2>; |
166 | clocks = <&tegra_car TEGRA114_CLK_PWM>; | 182 | clocks = <&tegra_car TEGRA114_CLK_PWM>; |
183 | resets = <&tegra_car 17>; | ||
184 | reset-names = "pwm"; | ||
167 | status = "disabled"; | 185 | status = "disabled"; |
168 | }; | 186 | }; |
169 | 187 | ||
@@ -175,6 +193,10 @@ | |||
175 | #size-cells = <0>; | 193 | #size-cells = <0>; |
176 | clocks = <&tegra_car TEGRA114_CLK_I2C1>; | 194 | clocks = <&tegra_car TEGRA114_CLK_I2C1>; |
177 | clock-names = "div-clk"; | 195 | clock-names = "div-clk"; |
196 | resets = <&tegra_car 12>; | ||
197 | reset-names = "i2c"; | ||
198 | dmas = <&apbdma 21>, <&apbdma 21>; | ||
199 | dma-names = "rx", "tx"; | ||
178 | status = "disabled"; | 200 | status = "disabled"; |
179 | }; | 201 | }; |
180 | 202 | ||
@@ -186,6 +208,10 @@ | |||
186 | #size-cells = <0>; | 208 | #size-cells = <0>; |
187 | clocks = <&tegra_car TEGRA114_CLK_I2C2>; | 209 | clocks = <&tegra_car TEGRA114_CLK_I2C2>; |
188 | clock-names = "div-clk"; | 210 | clock-names = "div-clk"; |
211 | resets = <&tegra_car 54>; | ||
212 | reset-names = "i2c"; | ||
213 | dmas = <&apbdma 22>, <&apbdma 22>; | ||
214 | dma-names = "rx", "tx"; | ||
189 | status = "disabled"; | 215 | status = "disabled"; |
190 | }; | 216 | }; |
191 | 217 | ||
@@ -197,6 +223,10 @@ | |||
197 | #size-cells = <0>; | 223 | #size-cells = <0>; |
198 | clocks = <&tegra_car TEGRA114_CLK_I2C3>; | 224 | clocks = <&tegra_car TEGRA114_CLK_I2C3>; |
199 | clock-names = "div-clk"; | 225 | clock-names = "div-clk"; |
226 | resets = <&tegra_car 67>; | ||
227 | reset-names = "i2c"; | ||
228 | dmas = <&apbdma 23>, <&apbdma 23>; | ||
229 | dma-names = "rx", "tx"; | ||
200 | status = "disabled"; | 230 | status = "disabled"; |
201 | }; | 231 | }; |
202 | 232 | ||
@@ -208,6 +238,10 @@ | |||
208 | #size-cells = <0>; | 238 | #size-cells = <0>; |
209 | clocks = <&tegra_car TEGRA114_CLK_I2C4>; | 239 | clocks = <&tegra_car TEGRA114_CLK_I2C4>; |
210 | clock-names = "div-clk"; | 240 | clock-names = "div-clk"; |
241 | resets = <&tegra_car 103>; | ||
242 | reset-names = "i2c"; | ||
243 | dmas = <&apbdma 26>, <&apbdma 26>; | ||
244 | dma-names = "rx", "tx"; | ||
211 | status = "disabled"; | 245 | status = "disabled"; |
212 | }; | 246 | }; |
213 | 247 | ||
@@ -219,6 +253,10 @@ | |||
219 | #size-cells = <0>; | 253 | #size-cells = <0>; |
220 | clocks = <&tegra_car TEGRA114_CLK_I2C5>; | 254 | clocks = <&tegra_car TEGRA114_CLK_I2C5>; |
221 | clock-names = "div-clk"; | 255 | clock-names = "div-clk"; |
256 | resets = <&tegra_car 47>; | ||
257 | reset-names = "i2c"; | ||
258 | dmas = <&apbdma 24>, <&apbdma 24>; | ||
259 | dma-names = "rx", "tx"; | ||
222 | status = "disabled"; | 260 | status = "disabled"; |
223 | }; | 261 | }; |
224 | 262 | ||
@@ -226,11 +264,14 @@ | |||
226 | compatible = "nvidia,tegra114-spi"; | 264 | compatible = "nvidia,tegra114-spi"; |
227 | reg = <0x7000d400 0x200>; | 265 | reg = <0x7000d400 0x200>; |
228 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; | 266 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; |
229 | nvidia,dma-request-selector = <&apbdma 15>; | ||
230 | #address-cells = <1>; | 267 | #address-cells = <1>; |
231 | #size-cells = <0>; | 268 | #size-cells = <0>; |
232 | clocks = <&tegra_car TEGRA114_CLK_SBC1>; | 269 | clocks = <&tegra_car TEGRA114_CLK_SBC1>; |
233 | clock-names = "spi"; | 270 | clock-names = "spi"; |
271 | resets = <&tegra_car 41>; | ||
272 | reset-names = "spi"; | ||
273 | dmas = <&apbdma 15>, <&apbdma 15>; | ||
274 | dma-names = "rx", "tx"; | ||
234 | status = "disabled"; | 275 | status = "disabled"; |
235 | }; | 276 | }; |
236 | 277 | ||
@@ -238,11 +279,14 @@ | |||
238 | compatible = "nvidia,tegra114-spi"; | 279 | compatible = "nvidia,tegra114-spi"; |
239 | reg = <0x7000d600 0x200>; | 280 | reg = <0x7000d600 0x200>; |
240 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; | 281 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; |
241 | nvidia,dma-request-selector = <&apbdma 16>; | ||
242 | #address-cells = <1>; | 282 | #address-cells = <1>; |
243 | #size-cells = <0>; | 283 | #size-cells = <0>; |
244 | clocks = <&tegra_car TEGRA114_CLK_SBC2>; | 284 | clocks = <&tegra_car TEGRA114_CLK_SBC2>; |
245 | clock-names = "spi"; | 285 | clock-names = "spi"; |
286 | resets = <&tegra_car 44>; | ||
287 | reset-names = "spi"; | ||
288 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
289 | dma-names = "rx", "tx"; | ||
246 | status = "disabled"; | 290 | status = "disabled"; |
247 | }; | 291 | }; |
248 | 292 | ||
@@ -250,11 +294,14 @@ | |||
250 | compatible = "nvidia,tegra114-spi"; | 294 | compatible = "nvidia,tegra114-spi"; |
251 | reg = <0x7000d800 0x200>; | 295 | reg = <0x7000d800 0x200>; |
252 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; | 296 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; |
253 | nvidia,dma-request-selector = <&apbdma 17>; | ||
254 | #address-cells = <1>; | 297 | #address-cells = <1>; |
255 | #size-cells = <0>; | 298 | #size-cells = <0>; |
256 | clocks = <&tegra_car TEGRA114_CLK_SBC3>; | 299 | clocks = <&tegra_car TEGRA114_CLK_SBC3>; |
257 | clock-names = "spi"; | 300 | clock-names = "spi"; |
301 | resets = <&tegra_car 46>; | ||
302 | reset-names = "spi"; | ||
303 | dmas = <&apbdma 17>, <&apbdma 17>; | ||
304 | dma-names = "rx", "tx"; | ||
258 | status = "disabled"; | 305 | status = "disabled"; |
259 | }; | 306 | }; |
260 | 307 | ||
@@ -262,11 +309,14 @@ | |||
262 | compatible = "nvidia,tegra114-spi"; | 309 | compatible = "nvidia,tegra114-spi"; |
263 | reg = <0x7000da00 0x200>; | 310 | reg = <0x7000da00 0x200>; |
264 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; | 311 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; |
265 | nvidia,dma-request-selector = <&apbdma 18>; | ||
266 | #address-cells = <1>; | 312 | #address-cells = <1>; |
267 | #size-cells = <0>; | 313 | #size-cells = <0>; |
268 | clocks = <&tegra_car TEGRA114_CLK_SBC4>; | 314 | clocks = <&tegra_car TEGRA114_CLK_SBC4>; |
269 | clock-names = "spi"; | 315 | clock-names = "spi"; |
316 | resets = <&tegra_car 68>; | ||
317 | reset-names = "spi"; | ||
318 | dmas = <&apbdma 18>, <&apbdma 18>; | ||
319 | dma-names = "rx", "tx"; | ||
270 | status = "disabled"; | 320 | status = "disabled"; |
271 | }; | 321 | }; |
272 | 322 | ||
@@ -274,11 +324,14 @@ | |||
274 | compatible = "nvidia,tegra114-spi"; | 324 | compatible = "nvidia,tegra114-spi"; |
275 | reg = <0x7000dc00 0x200>; | 325 | reg = <0x7000dc00 0x200>; |
276 | interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; | 326 | interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; |
277 | nvidia,dma-request-selector = <&apbdma 27>; | ||
278 | #address-cells = <1>; | 327 | #address-cells = <1>; |
279 | #size-cells = <0>; | 328 | #size-cells = <0>; |
280 | clocks = <&tegra_car TEGRA114_CLK_SBC5>; | 329 | clocks = <&tegra_car TEGRA114_CLK_SBC5>; |
281 | clock-names = "spi"; | 330 | clock-names = "spi"; |
331 | resets = <&tegra_car 104>; | ||
332 | reset-names = "spi"; | ||
333 | dmas = <&apbdma 27>, <&apbdma 27>; | ||
334 | dma-names = "rx", "tx"; | ||
282 | status = "disabled"; | 335 | status = "disabled"; |
283 | }; | 336 | }; |
284 | 337 | ||
@@ -286,11 +339,14 @@ | |||
286 | compatible = "nvidia,tegra114-spi"; | 339 | compatible = "nvidia,tegra114-spi"; |
287 | reg = <0x7000de00 0x200>; | 340 | reg = <0x7000de00 0x200>; |
288 | interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; | 341 | interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; |
289 | nvidia,dma-request-selector = <&apbdma 28>; | ||
290 | #address-cells = <1>; | 342 | #address-cells = <1>; |
291 | #size-cells = <0>; | 343 | #size-cells = <0>; |
292 | clocks = <&tegra_car TEGRA114_CLK_SBC6>; | 344 | clocks = <&tegra_car TEGRA114_CLK_SBC6>; |
293 | clock-names = "spi"; | 345 | clock-names = "spi"; |
346 | resets = <&tegra_car 105>; | ||
347 | reset-names = "spi"; | ||
348 | dmas = <&apbdma 28>, <&apbdma 28>; | ||
349 | dma-names = "rx", "tx"; | ||
294 | status = "disabled"; | 350 | status = "disabled"; |
295 | }; | 351 | }; |
296 | 352 | ||
@@ -306,6 +362,8 @@ | |||
306 | reg = <0x7000e200 0x100>; | 362 | reg = <0x7000e200 0x100>; |
307 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; | 363 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; |
308 | clocks = <&tegra_car TEGRA114_CLK_KBC>; | 364 | clocks = <&tegra_car TEGRA114_CLK_KBC>; |
365 | resets = <&tegra_car 36>; | ||
366 | reset-names = "kbc"; | ||
309 | status = "disabled"; | 367 | status = "disabled"; |
310 | }; | 368 | }; |
311 | 369 | ||
@@ -333,26 +391,39 @@ | |||
333 | <0x70080200 0x100>, | 391 | <0x70080200 0x100>, |
334 | <0x70081000 0x200>; | 392 | <0x70081000 0x200>; |
335 | interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; | 393 | interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; |
336 | nvidia,dma-request-selector = <&apbdma 1>, <&apbdma 2>, | ||
337 | <&apbdma 3>, <&apbdma 4>, <&apbdma 6>, <&apbdma 7>, | ||
338 | <&apbdma 12>, <&apbdma 13>, <&apbdma 14>, | ||
339 | <&apbdma 29>; | ||
340 | clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>, | 394 | clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>, |
341 | <&tegra_car TEGRA114_CLK_APBIF>, | 395 | <&tegra_car TEGRA114_CLK_APBIF>; |
342 | <&tegra_car TEGRA114_CLK_I2S0>, | 396 | clock-names = "d_audio", "apbif"; |
343 | <&tegra_car TEGRA114_CLK_I2S1>, | 397 | resets = <&tegra_car 106>, /* d_audio */ |
344 | <&tegra_car TEGRA114_CLK_I2S2>, | 398 | <&tegra_car 107>, /* apbif */ |
345 | <&tegra_car TEGRA114_CLK_I2S3>, | 399 | <&tegra_car 30>, /* i2s0 */ |
346 | <&tegra_car TEGRA114_CLK_I2S4>, | 400 | <&tegra_car 11>, /* i2s1 */ |
347 | <&tegra_car TEGRA114_CLK_DAM0>, | 401 | <&tegra_car 18>, /* i2s2 */ |
348 | <&tegra_car TEGRA114_CLK_DAM1>, | 402 | <&tegra_car 101>, /* i2s3 */ |
349 | <&tegra_car TEGRA114_CLK_DAM2>, | 403 | <&tegra_car 102>, /* i2s4 */ |
350 | <&tegra_car TEGRA114_CLK_SPDIF_IN>, | 404 | <&tegra_car 108>, /* dam0 */ |
351 | <&tegra_car TEGRA114_CLK_AMX>, | 405 | <&tegra_car 109>, /* dam1 */ |
352 | <&tegra_car TEGRA114_CLK_ADX>; | 406 | <&tegra_car 110>, /* dam2 */ |
353 | clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | 407 | <&tegra_car 10>, /* spdif */ |
408 | <&tegra_car 153>, /* amx */ | ||
409 | <&tegra_car 154>; /* adx */ | ||
410 | reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | ||
354 | "i2s3", "i2s4", "dam0", "dam1", "dam2", | 411 | "i2s3", "i2s4", "dam0", "dam1", "dam2", |
355 | "spdif_in", "amx", "adx"; | 412 | "spdif", "amx", "adx"; |
413 | dmas = <&apbdma 1>, <&apbdma 1>, | ||
414 | <&apbdma 2>, <&apbdma 2>, | ||
415 | <&apbdma 3>, <&apbdma 3>, | ||
416 | <&apbdma 4>, <&apbdma 4>, | ||
417 | <&apbdma 6>, <&apbdma 6>, | ||
418 | <&apbdma 7>, <&apbdma 7>, | ||
419 | <&apbdma 12>, <&apbdma 12>, | ||
420 | <&apbdma 13>, <&apbdma 13>, | ||
421 | <&apbdma 14>, <&apbdma 14>, | ||
422 | <&apbdma 29>, <&apbdma 29>; | ||
423 | dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2", | ||
424 | "rx3", "tx3", "rx4", "tx4", "rx5", "tx5", | ||
425 | "rx6", "tx6", "rx7", "tx7", "rx8", "tx8", | ||
426 | "rx9", "tx9"; | ||
356 | ranges; | 427 | ranges; |
357 | #address-cells = <1>; | 428 | #address-cells = <1>; |
358 | #size-cells = <1>; | 429 | #size-cells = <1>; |
@@ -362,6 +433,8 @@ | |||
362 | reg = <0x70080300 0x100>; | 433 | reg = <0x70080300 0x100>; |
363 | nvidia,ahub-cif-ids = <4 4>; | 434 | nvidia,ahub-cif-ids = <4 4>; |
364 | clocks = <&tegra_car TEGRA114_CLK_I2S0>; | 435 | clocks = <&tegra_car TEGRA114_CLK_I2S0>; |
436 | resets = <&tegra_car 30>; | ||
437 | reset-names = "i2s"; | ||
365 | status = "disabled"; | 438 | status = "disabled"; |
366 | }; | 439 | }; |
367 | 440 | ||
@@ -370,6 +443,8 @@ | |||
370 | reg = <0x70080400 0x100>; | 443 | reg = <0x70080400 0x100>; |
371 | nvidia,ahub-cif-ids = <5 5>; | 444 | nvidia,ahub-cif-ids = <5 5>; |
372 | clocks = <&tegra_car TEGRA114_CLK_I2S1>; | 445 | clocks = <&tegra_car TEGRA114_CLK_I2S1>; |
446 | resets = <&tegra_car 11>; | ||
447 | reset-names = "i2s"; | ||
373 | status = "disabled"; | 448 | status = "disabled"; |
374 | }; | 449 | }; |
375 | 450 | ||
@@ -378,6 +453,8 @@ | |||
378 | reg = <0x70080500 0x100>; | 453 | reg = <0x70080500 0x100>; |
379 | nvidia,ahub-cif-ids = <6 6>; | 454 | nvidia,ahub-cif-ids = <6 6>; |
380 | clocks = <&tegra_car TEGRA114_CLK_I2S2>; | 455 | clocks = <&tegra_car TEGRA114_CLK_I2S2>; |
456 | resets = <&tegra_car 18>; | ||
457 | reset-names = "i2s"; | ||
381 | status = "disabled"; | 458 | status = "disabled"; |
382 | }; | 459 | }; |
383 | 460 | ||
@@ -386,6 +463,8 @@ | |||
386 | reg = <0x70080600 0x100>; | 463 | reg = <0x70080600 0x100>; |
387 | nvidia,ahub-cif-ids = <7 7>; | 464 | nvidia,ahub-cif-ids = <7 7>; |
388 | clocks = <&tegra_car TEGRA114_CLK_I2S3>; | 465 | clocks = <&tegra_car TEGRA114_CLK_I2S3>; |
466 | resets = <&tegra_car 101>; | ||
467 | reset-names = "i2s"; | ||
389 | status = "disabled"; | 468 | status = "disabled"; |
390 | }; | 469 | }; |
391 | 470 | ||
@@ -394,6 +473,8 @@ | |||
394 | reg = <0x70080700 0x100>; | 473 | reg = <0x70080700 0x100>; |
395 | nvidia,ahub-cif-ids = <8 8>; | 474 | nvidia,ahub-cif-ids = <8 8>; |
396 | clocks = <&tegra_car TEGRA114_CLK_I2S4>; | 475 | clocks = <&tegra_car TEGRA114_CLK_I2S4>; |
476 | resets = <&tegra_car 102>; | ||
477 | reset-names = "i2s"; | ||
397 | status = "disabled"; | 478 | status = "disabled"; |
398 | }; | 479 | }; |
399 | }; | 480 | }; |
@@ -403,6 +484,8 @@ | |||
403 | reg = <0x78000000 0x200>; | 484 | reg = <0x78000000 0x200>; |
404 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 485 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
405 | clocks = <&tegra_car TEGRA114_CLK_SDMMC1>; | 486 | clocks = <&tegra_car TEGRA114_CLK_SDMMC1>; |
487 | resets = <&tegra_car 14>; | ||
488 | reset-names = "sdhci"; | ||
406 | status = "disable"; | 489 | status = "disable"; |
407 | }; | 490 | }; |
408 | 491 | ||
@@ -411,6 +494,8 @@ | |||
411 | reg = <0x78000200 0x200>; | 494 | reg = <0x78000200 0x200>; |
412 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 495 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
413 | clocks = <&tegra_car TEGRA114_CLK_SDMMC2>; | 496 | clocks = <&tegra_car TEGRA114_CLK_SDMMC2>; |
497 | resets = <&tegra_car 9>; | ||
498 | reset-names = "sdhci"; | ||
414 | status = "disable"; | 499 | status = "disable"; |
415 | }; | 500 | }; |
416 | 501 | ||
@@ -419,6 +504,8 @@ | |||
419 | reg = <0x78000400 0x200>; | 504 | reg = <0x78000400 0x200>; |
420 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; | 505 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; |
421 | clocks = <&tegra_car TEGRA114_CLK_SDMMC3>; | 506 | clocks = <&tegra_car TEGRA114_CLK_SDMMC3>; |
507 | resets = <&tegra_car 69>; | ||
508 | reset-names = "sdhci"; | ||
422 | status = "disable"; | 509 | status = "disable"; |
423 | }; | 510 | }; |
424 | 511 | ||
@@ -427,6 +514,8 @@ | |||
427 | reg = <0x78000600 0x200>; | 514 | reg = <0x78000600 0x200>; |
428 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; | 515 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; |
429 | clocks = <&tegra_car TEGRA114_CLK_SDMMC4>; | 516 | clocks = <&tegra_car TEGRA114_CLK_SDMMC4>; |
517 | resets = <&tegra_car 15>; | ||
518 | reset-names = "sdhci"; | ||
430 | status = "disable"; | 519 | status = "disable"; |
431 | }; | 520 | }; |
432 | 521 | ||
@@ -436,6 +525,8 @@ | |||
436 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; | 525 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; |
437 | phy_type = "utmi"; | 526 | phy_type = "utmi"; |
438 | clocks = <&tegra_car TEGRA114_CLK_USBD>; | 527 | clocks = <&tegra_car TEGRA114_CLK_USBD>; |
528 | resets = <&tegra_car 22>; | ||
529 | reset-names = "usb"; | ||
439 | nvidia,phy = <&phy1>; | 530 | nvidia,phy = <&phy1>; |
440 | status = "disabled"; | 531 | status = "disabled"; |
441 | }; | 532 | }; |
@@ -467,6 +558,8 @@ | |||
467 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; | 558 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; |
468 | phy_type = "utmi"; | 559 | phy_type = "utmi"; |
469 | clocks = <&tegra_car TEGRA114_CLK_USB3>; | 560 | clocks = <&tegra_car TEGRA114_CLK_USB3>; |
561 | resets = <&tegra_car 59>; | ||
562 | reset-names = "usb"; | ||
470 | nvidia,phy = <&phy3>; | 563 | nvidia,phy = <&phy3>; |
471 | status = "disabled"; | 564 | status = "disabled"; |
472 | }; | 565 | }; |
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index 8d71fc9d8a2f..e57fb3aefc2a 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts | |||
@@ -280,6 +280,8 @@ | |||
280 | clocks = <&tegra_car TEGRA20_CLK_I2C3>, | 280 | clocks = <&tegra_car TEGRA20_CLK_I2C3>, |
281 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; | 281 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; |
282 | clock-names = "div-clk", "fast-clk"; | 282 | clock-names = "div-clk", "fast-clk"; |
283 | resets = <&tegra_car 67>; | ||
284 | reset-names = "i2c"; | ||
283 | }; | 285 | }; |
284 | 286 | ||
285 | i2c@7000d000 { | 287 | i2c@7000d000 { |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index df40b54fd8bc..c90d0aac3afe 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -22,6 +22,8 @@ | |||
22 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ | 22 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ |
23 | <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ | 23 | <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ |
24 | clocks = <&tegra_car TEGRA20_CLK_HOST1X>; | 24 | clocks = <&tegra_car TEGRA20_CLK_HOST1X>; |
25 | resets = <&tegra_car 28>; | ||
26 | reset-names = "host1x"; | ||
25 | 27 | ||
26 | #address-cells = <1>; | 28 | #address-cells = <1>; |
27 | #size-cells = <1>; | 29 | #size-cells = <1>; |
@@ -33,6 +35,8 @@ | |||
33 | reg = <0x54040000 0x00040000>; | 35 | reg = <0x54040000 0x00040000>; |
34 | interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; | 36 | interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; |
35 | clocks = <&tegra_car TEGRA20_CLK_MPE>; | 37 | clocks = <&tegra_car TEGRA20_CLK_MPE>; |
38 | resets = <&tegra_car 60>; | ||
39 | reset-names = "mpe"; | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | vi { | 42 | vi { |
@@ -40,6 +44,8 @@ | |||
40 | reg = <0x54080000 0x00040000>; | 44 | reg = <0x54080000 0x00040000>; |
41 | interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; | 45 | interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; |
42 | clocks = <&tegra_car TEGRA20_CLK_VI>; | 46 | clocks = <&tegra_car TEGRA20_CLK_VI>; |
47 | resets = <&tegra_car 20>; | ||
48 | reset-names = "vi"; | ||
43 | }; | 49 | }; |
44 | 50 | ||
45 | epp { | 51 | epp { |
@@ -47,6 +53,8 @@ | |||
47 | reg = <0x540c0000 0x00040000>; | 53 | reg = <0x540c0000 0x00040000>; |
48 | interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; | 54 | interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; |
49 | clocks = <&tegra_car TEGRA20_CLK_EPP>; | 55 | clocks = <&tegra_car TEGRA20_CLK_EPP>; |
56 | resets = <&tegra_car 19>; | ||
57 | reset-names = "epp"; | ||
50 | }; | 58 | }; |
51 | 59 | ||
52 | isp { | 60 | isp { |
@@ -54,6 +62,8 @@ | |||
54 | reg = <0x54100000 0x00040000>; | 62 | reg = <0x54100000 0x00040000>; |
55 | interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; | 63 | interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; |
56 | clocks = <&tegra_car TEGRA20_CLK_ISP>; | 64 | clocks = <&tegra_car TEGRA20_CLK_ISP>; |
65 | resets = <&tegra_car 23>; | ||
66 | reset-names = "isp"; | ||
57 | }; | 67 | }; |
58 | 68 | ||
59 | gr2d { | 69 | gr2d { |
@@ -61,12 +71,16 @@ | |||
61 | reg = <0x54140000 0x00040000>; | 71 | reg = <0x54140000 0x00040000>; |
62 | interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; | 72 | interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; |
63 | clocks = <&tegra_car TEGRA20_CLK_GR2D>; | 73 | clocks = <&tegra_car TEGRA20_CLK_GR2D>; |
74 | resets = <&tegra_car 21>; | ||
75 | reset-names = "2d"; | ||
64 | }; | 76 | }; |
65 | 77 | ||
66 | gr3d { | 78 | gr3d { |
67 | compatible = "nvidia,tegra20-gr3d"; | 79 | compatible = "nvidia,tegra20-gr3d"; |
68 | reg = <0x54180000 0x00040000>; | 80 | reg = <0x54180000 0x00040000>; |
69 | clocks = <&tegra_car TEGRA20_CLK_GR3D>; | 81 | clocks = <&tegra_car TEGRA20_CLK_GR3D>; |
82 | resets = <&tegra_car 24>; | ||
83 | reset-names = "3d"; | ||
70 | }; | 84 | }; |
71 | 85 | ||
72 | dc@54200000 { | 86 | dc@54200000 { |
@@ -75,7 +89,9 @@ | |||
75 | interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; | 89 | interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; |
76 | clocks = <&tegra_car TEGRA20_CLK_DISP1>, | 90 | clocks = <&tegra_car TEGRA20_CLK_DISP1>, |
77 | <&tegra_car TEGRA20_CLK_PLL_P>; | 91 | <&tegra_car TEGRA20_CLK_PLL_P>; |
78 | clock-names = "disp1", "parent"; | 92 | clock-names = "dc", "parent"; |
93 | resets = <&tegra_car 27>; | ||
94 | reset-names = "dc"; | ||
79 | 95 | ||
80 | rgb { | 96 | rgb { |
81 | status = "disabled"; | 97 | status = "disabled"; |
@@ -88,7 +104,9 @@ | |||
88 | interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; | 104 | interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; |
89 | clocks = <&tegra_car TEGRA20_CLK_DISP2>, | 105 | clocks = <&tegra_car TEGRA20_CLK_DISP2>, |
90 | <&tegra_car TEGRA20_CLK_PLL_P>; | 106 | <&tegra_car TEGRA20_CLK_PLL_P>; |
91 | clock-names = "disp2", "parent"; | 107 | clock-names = "dc", "parent"; |
108 | resets = <&tegra_car 26>; | ||
109 | reset-names = "dc"; | ||
92 | 110 | ||
93 | rgb { | 111 | rgb { |
94 | status = "disabled"; | 112 | status = "disabled"; |
@@ -102,6 +120,8 @@ | |||
102 | clocks = <&tegra_car TEGRA20_CLK_HDMI>, | 120 | clocks = <&tegra_car TEGRA20_CLK_HDMI>, |
103 | <&tegra_car TEGRA20_CLK_PLL_D_OUT0>; | 121 | <&tegra_car TEGRA20_CLK_PLL_D_OUT0>; |
104 | clock-names = "hdmi", "parent"; | 122 | clock-names = "hdmi", "parent"; |
123 | resets = <&tegra_car 51>; | ||
124 | reset-names = "hdmi"; | ||
105 | status = "disabled"; | 125 | status = "disabled"; |
106 | }; | 126 | }; |
107 | 127 | ||
@@ -117,6 +137,8 @@ | |||
117 | compatible = "nvidia,tegra20-dsi"; | 137 | compatible = "nvidia,tegra20-dsi"; |
118 | reg = <0x54300000 0x00040000>; | 138 | reg = <0x54300000 0x00040000>; |
119 | clocks = <&tegra_car TEGRA20_CLK_DSI>; | 139 | clocks = <&tegra_car TEGRA20_CLK_DSI>; |
140 | resets = <&tegra_car 48>; | ||
141 | reset-names = "dsi"; | ||
120 | status = "disabled"; | 142 | status = "disabled"; |
121 | }; | 143 | }; |
122 | }; | 144 | }; |
@@ -160,6 +182,7 @@ | |||
160 | compatible = "nvidia,tegra20-car"; | 182 | compatible = "nvidia,tegra20-car"; |
161 | reg = <0x60006000 0x1000>; | 183 | reg = <0x60006000 0x1000>; |
162 | #clock-cells = <1>; | 184 | #clock-cells = <1>; |
185 | #reset-cells = <1>; | ||
163 | }; | 186 | }; |
164 | 187 | ||
165 | apbdma: dma { | 188 | apbdma: dma { |
@@ -182,6 +205,9 @@ | |||
182 | <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>, | 205 | <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>, |
183 | <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; | 206 | <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; |
184 | clocks = <&tegra_car TEGRA20_CLK_APBDMA>; | 207 | clocks = <&tegra_car TEGRA20_CLK_APBDMA>; |
208 | resets = <&tegra_car 34>; | ||
209 | reset-names = "dma"; | ||
210 | #dma-cells = <1>; | ||
185 | }; | 211 | }; |
186 | 212 | ||
187 | ahb { | 213 | ahb { |
@@ -222,8 +248,11 @@ | |||
222 | compatible = "nvidia,tegra20-ac97"; | 248 | compatible = "nvidia,tegra20-ac97"; |
223 | reg = <0x70002000 0x200>; | 249 | reg = <0x70002000 0x200>; |
224 | interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; | 250 | interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; |
225 | nvidia,dma-request-selector = <&apbdma 12>; | ||
226 | clocks = <&tegra_car TEGRA20_CLK_AC97>; | 251 | clocks = <&tegra_car TEGRA20_CLK_AC97>; |
252 | resets = <&tegra_car 3>; | ||
253 | reset-names = "ac97"; | ||
254 | dmas = <&apbdma 12>, <&apbdma 12>; | ||
255 | dma-names = "rx", "tx"; | ||
227 | status = "disabled"; | 256 | status = "disabled"; |
228 | }; | 257 | }; |
229 | 258 | ||
@@ -231,8 +260,11 @@ | |||
231 | compatible = "nvidia,tegra20-i2s"; | 260 | compatible = "nvidia,tegra20-i2s"; |
232 | reg = <0x70002800 0x200>; | 261 | reg = <0x70002800 0x200>; |
233 | interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; | 262 | interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; |
234 | nvidia,dma-request-selector = <&apbdma 2>; | ||
235 | clocks = <&tegra_car TEGRA20_CLK_I2S1>; | 263 | clocks = <&tegra_car TEGRA20_CLK_I2S1>; |
264 | resets = <&tegra_car 11>; | ||
265 | reset-names = "i2s"; | ||
266 | dmas = <&apbdma 2>, <&apbdma 2>; | ||
267 | dma-names = "rx", "tx"; | ||
236 | status = "disabled"; | 268 | status = "disabled"; |
237 | }; | 269 | }; |
238 | 270 | ||
@@ -240,8 +272,11 @@ | |||
240 | compatible = "nvidia,tegra20-i2s"; | 272 | compatible = "nvidia,tegra20-i2s"; |
241 | reg = <0x70002a00 0x200>; | 273 | reg = <0x70002a00 0x200>; |
242 | interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; | 274 | interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; |
243 | nvidia,dma-request-selector = <&apbdma 1>; | ||
244 | clocks = <&tegra_car TEGRA20_CLK_I2S2>; | 275 | clocks = <&tegra_car TEGRA20_CLK_I2S2>; |
276 | resets = <&tegra_car 18>; | ||
277 | reset-names = "i2s"; | ||
278 | dmas = <&apbdma 1>, <&apbdma 1>; | ||
279 | dma-names = "rx", "tx"; | ||
245 | status = "disabled"; | 280 | status = "disabled"; |
246 | }; | 281 | }; |
247 | 282 | ||
@@ -257,8 +292,11 @@ | |||
257 | reg = <0x70006000 0x40>; | 292 | reg = <0x70006000 0x40>; |
258 | reg-shift = <2>; | 293 | reg-shift = <2>; |
259 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; | 294 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; |
260 | nvidia,dma-request-selector = <&apbdma 8>; | ||
261 | clocks = <&tegra_car TEGRA20_CLK_UARTA>; | 295 | clocks = <&tegra_car TEGRA20_CLK_UARTA>; |
296 | resets = <&tegra_car 6>; | ||
297 | reset-names = "serial"; | ||
298 | dmas = <&apbdma 8>, <&apbdma 8>; | ||
299 | dma-names = "rx", "tx"; | ||
262 | status = "disabled"; | 300 | status = "disabled"; |
263 | }; | 301 | }; |
264 | 302 | ||
@@ -267,8 +305,11 @@ | |||
267 | reg = <0x70006040 0x40>; | 305 | reg = <0x70006040 0x40>; |
268 | reg-shift = <2>; | 306 | reg-shift = <2>; |
269 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; | 307 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; |
270 | nvidia,dma-request-selector = <&apbdma 9>; | ||
271 | clocks = <&tegra_car TEGRA20_CLK_UARTB>; | 308 | clocks = <&tegra_car TEGRA20_CLK_UARTB>; |
309 | resets = <&tegra_car 7>; | ||
310 | reset-names = "serial"; | ||
311 | dmas = <&apbdma 9>, <&apbdma 9>; | ||
312 | dma-names = "rx", "tx"; | ||
272 | status = "disabled"; | 313 | status = "disabled"; |
273 | }; | 314 | }; |
274 | 315 | ||
@@ -277,8 +318,11 @@ | |||
277 | reg = <0x70006200 0x100>; | 318 | reg = <0x70006200 0x100>; |
278 | reg-shift = <2>; | 319 | reg-shift = <2>; |
279 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; | 320 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; |
280 | nvidia,dma-request-selector = <&apbdma 10>; | ||
281 | clocks = <&tegra_car TEGRA20_CLK_UARTC>; | 321 | clocks = <&tegra_car TEGRA20_CLK_UARTC>; |
322 | resets = <&tegra_car 55>; | ||
323 | reset-names = "serial"; | ||
324 | dmas = <&apbdma 10>, <&apbdma 10>; | ||
325 | dma-names = "rx", "tx"; | ||
282 | status = "disabled"; | 326 | status = "disabled"; |
283 | }; | 327 | }; |
284 | 328 | ||
@@ -287,8 +331,11 @@ | |||
287 | reg = <0x70006300 0x100>; | 331 | reg = <0x70006300 0x100>; |
288 | reg-shift = <2>; | 332 | reg-shift = <2>; |
289 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; | 333 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; |
290 | nvidia,dma-request-selector = <&apbdma 19>; | ||
291 | clocks = <&tegra_car TEGRA20_CLK_UARTD>; | 334 | clocks = <&tegra_car TEGRA20_CLK_UARTD>; |
335 | resets = <&tegra_car 65>; | ||
336 | reset-names = "serial"; | ||
337 | dmas = <&apbdma 19>, <&apbdma 19>; | ||
338 | dma-names = "rx", "tx"; | ||
292 | status = "disabled"; | 339 | status = "disabled"; |
293 | }; | 340 | }; |
294 | 341 | ||
@@ -297,8 +344,11 @@ | |||
297 | reg = <0x70006400 0x100>; | 344 | reg = <0x70006400 0x100>; |
298 | reg-shift = <2>; | 345 | reg-shift = <2>; |
299 | interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; | 346 | interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; |
300 | nvidia,dma-request-selector = <&apbdma 20>; | ||
301 | clocks = <&tegra_car TEGRA20_CLK_UARTE>; | 347 | clocks = <&tegra_car TEGRA20_CLK_UARTE>; |
348 | resets = <&tegra_car 66>; | ||
349 | reset-names = "serial"; | ||
350 | dmas = <&apbdma 20>, <&apbdma 20>; | ||
351 | dma-names = "rx", "tx"; | ||
302 | status = "disabled"; | 352 | status = "disabled"; |
303 | }; | 353 | }; |
304 | 354 | ||
@@ -307,6 +357,8 @@ | |||
307 | reg = <0x7000a000 0x100>; | 357 | reg = <0x7000a000 0x100>; |
308 | #pwm-cells = <2>; | 358 | #pwm-cells = <2>; |
309 | clocks = <&tegra_car TEGRA20_CLK_PWM>; | 359 | clocks = <&tegra_car TEGRA20_CLK_PWM>; |
360 | resets = <&tegra_car 17>; | ||
361 | reset-names = "pwm"; | ||
310 | status = "disabled"; | 362 | status = "disabled"; |
311 | }; | 363 | }; |
312 | 364 | ||
@@ -326,6 +378,10 @@ | |||
326 | clocks = <&tegra_car TEGRA20_CLK_I2C1>, | 378 | clocks = <&tegra_car TEGRA20_CLK_I2C1>, |
327 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; | 379 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; |
328 | clock-names = "div-clk", "fast-clk"; | 380 | clock-names = "div-clk", "fast-clk"; |
381 | resets = <&tegra_car 12>; | ||
382 | reset-names = "i2c"; | ||
383 | dmas = <&apbdma 21>, <&apbdma 21>; | ||
384 | dma-names = "rx", "tx"; | ||
329 | status = "disabled"; | 385 | status = "disabled"; |
330 | }; | 386 | }; |
331 | 387 | ||
@@ -333,10 +389,13 @@ | |||
333 | compatible = "nvidia,tegra20-sflash"; | 389 | compatible = "nvidia,tegra20-sflash"; |
334 | reg = <0x7000c380 0x80>; | 390 | reg = <0x7000c380 0x80>; |
335 | interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; | 391 | interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; |
336 | nvidia,dma-request-selector = <&apbdma 11>; | ||
337 | #address-cells = <1>; | 392 | #address-cells = <1>; |
338 | #size-cells = <0>; | 393 | #size-cells = <0>; |
339 | clocks = <&tegra_car TEGRA20_CLK_SPI>; | 394 | clocks = <&tegra_car TEGRA20_CLK_SPI>; |
395 | resets = <&tegra_car 43>; | ||
396 | reset-names = "spi"; | ||
397 | dmas = <&apbdma 11>, <&apbdma 11>; | ||
398 | dma-names = "rx", "tx"; | ||
340 | status = "disabled"; | 399 | status = "disabled"; |
341 | }; | 400 | }; |
342 | 401 | ||
@@ -349,6 +408,10 @@ | |||
349 | clocks = <&tegra_car TEGRA20_CLK_I2C2>, | 408 | clocks = <&tegra_car TEGRA20_CLK_I2C2>, |
350 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; | 409 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; |
351 | clock-names = "div-clk", "fast-clk"; | 410 | clock-names = "div-clk", "fast-clk"; |
411 | resets = <&tegra_car 54>; | ||
412 | reset-names = "i2c"; | ||
413 | dmas = <&apbdma 22>, <&apbdma 22>; | ||
414 | dma-names = "rx", "tx"; | ||
352 | status = "disabled"; | 415 | status = "disabled"; |
353 | }; | 416 | }; |
354 | 417 | ||
@@ -361,6 +424,10 @@ | |||
361 | clocks = <&tegra_car TEGRA20_CLK_I2C3>, | 424 | clocks = <&tegra_car TEGRA20_CLK_I2C3>, |
362 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; | 425 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; |
363 | clock-names = "div-clk", "fast-clk"; | 426 | clock-names = "div-clk", "fast-clk"; |
427 | resets = <&tegra_car 67>; | ||
428 | reset-names = "i2c"; | ||
429 | dmas = <&apbdma 23>, <&apbdma 23>; | ||
430 | dma-names = "rx", "tx"; | ||
364 | status = "disabled"; | 431 | status = "disabled"; |
365 | }; | 432 | }; |
366 | 433 | ||
@@ -373,6 +440,10 @@ | |||
373 | clocks = <&tegra_car TEGRA20_CLK_DVC>, | 440 | clocks = <&tegra_car TEGRA20_CLK_DVC>, |
374 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; | 441 | <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; |
375 | clock-names = "div-clk", "fast-clk"; | 442 | clock-names = "div-clk", "fast-clk"; |
443 | resets = <&tegra_car 47>; | ||
444 | reset-names = "i2c"; | ||
445 | dmas = <&apbdma 24>, <&apbdma 24>; | ||
446 | dma-names = "rx", "tx"; | ||
376 | status = "disabled"; | 447 | status = "disabled"; |
377 | }; | 448 | }; |
378 | 449 | ||
@@ -380,10 +451,13 @@ | |||
380 | compatible = "nvidia,tegra20-slink"; | 451 | compatible = "nvidia,tegra20-slink"; |
381 | reg = <0x7000d400 0x200>; | 452 | reg = <0x7000d400 0x200>; |
382 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; | 453 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; |
383 | nvidia,dma-request-selector = <&apbdma 15>; | ||
384 | #address-cells = <1>; | 454 | #address-cells = <1>; |
385 | #size-cells = <0>; | 455 | #size-cells = <0>; |
386 | clocks = <&tegra_car TEGRA20_CLK_SBC1>; | 456 | clocks = <&tegra_car TEGRA20_CLK_SBC1>; |
457 | resets = <&tegra_car 41>; | ||
458 | reset-names = "spi"; | ||
459 | dmas = <&apbdma 15>, <&apbdma 15>; | ||
460 | dma-names = "rx", "tx"; | ||
387 | status = "disabled"; | 461 | status = "disabled"; |
388 | }; | 462 | }; |
389 | 463 | ||
@@ -391,10 +465,13 @@ | |||
391 | compatible = "nvidia,tegra20-slink"; | 465 | compatible = "nvidia,tegra20-slink"; |
392 | reg = <0x7000d600 0x200>; | 466 | reg = <0x7000d600 0x200>; |
393 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; | 467 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; |
394 | nvidia,dma-request-selector = <&apbdma 16>; | ||
395 | #address-cells = <1>; | 468 | #address-cells = <1>; |
396 | #size-cells = <0>; | 469 | #size-cells = <0>; |
397 | clocks = <&tegra_car TEGRA20_CLK_SBC2>; | 470 | clocks = <&tegra_car TEGRA20_CLK_SBC2>; |
471 | resets = <&tegra_car 44>; | ||
472 | reset-names = "spi"; | ||
473 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
474 | dma-names = "rx", "tx"; | ||
398 | status = "disabled"; | 475 | status = "disabled"; |
399 | }; | 476 | }; |
400 | 477 | ||
@@ -402,10 +479,13 @@ | |||
402 | compatible = "nvidia,tegra20-slink"; | 479 | compatible = "nvidia,tegra20-slink"; |
403 | reg = <0x7000d800 0x200>; | 480 | reg = <0x7000d800 0x200>; |
404 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; | 481 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; |
405 | nvidia,dma-request-selector = <&apbdma 17>; | ||
406 | #address-cells = <1>; | 482 | #address-cells = <1>; |
407 | #size-cells = <0>; | 483 | #size-cells = <0>; |
408 | clocks = <&tegra_car TEGRA20_CLK_SBC3>; | 484 | clocks = <&tegra_car TEGRA20_CLK_SBC3>; |
485 | resets = <&tegra_car 46>; | ||
486 | reset-names = "spi"; | ||
487 | dmas = <&apbdma 17>, <&apbdma 17>; | ||
488 | dma-names = "rx", "tx"; | ||
409 | status = "disabled"; | 489 | status = "disabled"; |
410 | }; | 490 | }; |
411 | 491 | ||
@@ -413,10 +493,13 @@ | |||
413 | compatible = "nvidia,tegra20-slink"; | 493 | compatible = "nvidia,tegra20-slink"; |
414 | reg = <0x7000da00 0x200>; | 494 | reg = <0x7000da00 0x200>; |
415 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; | 495 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; |
416 | nvidia,dma-request-selector = <&apbdma 18>; | ||
417 | #address-cells = <1>; | 496 | #address-cells = <1>; |
418 | #size-cells = <0>; | 497 | #size-cells = <0>; |
419 | clocks = <&tegra_car TEGRA20_CLK_SBC4>; | 498 | clocks = <&tegra_car TEGRA20_CLK_SBC4>; |
499 | resets = <&tegra_car 68>; | ||
500 | reset-names = "spi"; | ||
501 | dmas = <&apbdma 18>, <&apbdma 18>; | ||
502 | dma-names = "rx", "tx"; | ||
420 | status = "disabled"; | 503 | status = "disabled"; |
421 | }; | 504 | }; |
422 | 505 | ||
@@ -425,6 +508,8 @@ | |||
425 | reg = <0x7000e200 0x100>; | 508 | reg = <0x7000e200 0x100>; |
426 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; | 509 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; |
427 | clocks = <&tegra_car TEGRA20_CLK_KBC>; | 510 | clocks = <&tegra_car TEGRA20_CLK_KBC>; |
511 | resets = <&tegra_car 36>; | ||
512 | reset-names = "kbc"; | ||
428 | status = "disabled"; | 513 | status = "disabled"; |
429 | }; | 514 | }; |
430 | 515 | ||
@@ -478,9 +563,12 @@ | |||
478 | 563 | ||
479 | clocks = <&tegra_car TEGRA20_CLK_PEX>, | 564 | clocks = <&tegra_car TEGRA20_CLK_PEX>, |
480 | <&tegra_car TEGRA20_CLK_AFI>, | 565 | <&tegra_car TEGRA20_CLK_AFI>, |
481 | <&tegra_car TEGRA20_CLK_PCIE_XCLK>, | ||
482 | <&tegra_car TEGRA20_CLK_PLL_E>; | 566 | <&tegra_car TEGRA20_CLK_PLL_E>; |
483 | clock-names = "pex", "afi", "pcie_xclk", "pll_e"; | 567 | clock-names = "pex", "afi", "pll_e"; |
568 | resets = <&tegra_car 70>, | ||
569 | <&tegra_car 72>, | ||
570 | <&tegra_car 74>; | ||
571 | reset-names = "pex", "afi", "pcie_x"; | ||
484 | status = "disabled"; | 572 | status = "disabled"; |
485 | 573 | ||
486 | pci@1,0 { | 574 | pci@1,0 { |
@@ -517,6 +605,8 @@ | |||
517 | phy_type = "utmi"; | 605 | phy_type = "utmi"; |
518 | nvidia,has-legacy-mode; | 606 | nvidia,has-legacy-mode; |
519 | clocks = <&tegra_car TEGRA20_CLK_USBD>; | 607 | clocks = <&tegra_car TEGRA20_CLK_USBD>; |
608 | resets = <&tegra_car 22>; | ||
609 | reset-names = "usb"; | ||
520 | nvidia,needs-double-reset; | 610 | nvidia,needs-double-reset; |
521 | nvidia,phy = <&phy1>; | 611 | nvidia,phy = <&phy1>; |
522 | status = "disabled"; | 612 | status = "disabled"; |
@@ -548,6 +638,8 @@ | |||
548 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; | 638 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; |
549 | phy_type = "ulpi"; | 639 | phy_type = "ulpi"; |
550 | clocks = <&tegra_car TEGRA20_CLK_USB2>; | 640 | clocks = <&tegra_car TEGRA20_CLK_USB2>; |
641 | resets = <&tegra_car 58>; | ||
642 | reset-names = "usb"; | ||
551 | nvidia,phy = <&phy2>; | 643 | nvidia,phy = <&phy2>; |
552 | status = "disabled"; | 644 | status = "disabled"; |
553 | }; | 645 | }; |
@@ -569,6 +661,8 @@ | |||
569 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; | 661 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; |
570 | phy_type = "utmi"; | 662 | phy_type = "utmi"; |
571 | clocks = <&tegra_car TEGRA20_CLK_USB3>; | 663 | clocks = <&tegra_car TEGRA20_CLK_USB3>; |
664 | resets = <&tegra_car 59>; | ||
665 | reset-names = "usb"; | ||
572 | nvidia,phy = <&phy3>; | 666 | nvidia,phy = <&phy3>; |
573 | status = "disabled"; | 667 | status = "disabled"; |
574 | }; | 668 | }; |
@@ -597,6 +691,8 @@ | |||
597 | reg = <0xc8000000 0x200>; | 691 | reg = <0xc8000000 0x200>; |
598 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 692 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
599 | clocks = <&tegra_car TEGRA20_CLK_SDMMC1>; | 693 | clocks = <&tegra_car TEGRA20_CLK_SDMMC1>; |
694 | resets = <&tegra_car 14>; | ||
695 | reset-names = "sdhci"; | ||
600 | status = "disabled"; | 696 | status = "disabled"; |
601 | }; | 697 | }; |
602 | 698 | ||
@@ -605,6 +701,8 @@ | |||
605 | reg = <0xc8000200 0x200>; | 701 | reg = <0xc8000200 0x200>; |
606 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 702 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
607 | clocks = <&tegra_car TEGRA20_CLK_SDMMC2>; | 703 | clocks = <&tegra_car TEGRA20_CLK_SDMMC2>; |
704 | resets = <&tegra_car 9>; | ||
705 | reset-names = "sdhci"; | ||
608 | status = "disabled"; | 706 | status = "disabled"; |
609 | }; | 707 | }; |
610 | 708 | ||
@@ -613,6 +711,8 @@ | |||
613 | reg = <0xc8000400 0x200>; | 711 | reg = <0xc8000400 0x200>; |
614 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; | 712 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; |
615 | clocks = <&tegra_car TEGRA20_CLK_SDMMC3>; | 713 | clocks = <&tegra_car TEGRA20_CLK_SDMMC3>; |
714 | resets = <&tegra_car 69>; | ||
715 | reset-names = "sdhci"; | ||
616 | status = "disabled"; | 716 | status = "disabled"; |
617 | }; | 717 | }; |
618 | 718 | ||
@@ -621,6 +721,8 @@ | |||
621 | reg = <0xc8000600 0x200>; | 721 | reg = <0xc8000600 0x200>; |
622 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; | 722 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; |
623 | clocks = <&tegra_car TEGRA20_CLK_SDMMC4>; | 723 | clocks = <&tegra_car TEGRA20_CLK_SDMMC4>; |
724 | resets = <&tegra_car 15>; | ||
725 | reset-names = "sdhci"; | ||
624 | status = "disabled"; | 726 | status = "disabled"; |
625 | }; | 727 | }; |
626 | 728 | ||
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index 2bd55cfd88ad..31259b09e7cc 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -40,10 +40,13 @@ | |||
40 | 40 | ||
41 | clocks = <&tegra_car TEGRA30_CLK_PCIE>, | 41 | clocks = <&tegra_car TEGRA30_CLK_PCIE>, |
42 | <&tegra_car TEGRA30_CLK_AFI>, | 42 | <&tegra_car TEGRA30_CLK_AFI>, |
43 | <&tegra_car TEGRA30_CLK_PCIEX>, | ||
44 | <&tegra_car TEGRA30_CLK_PLL_E>, | 43 | <&tegra_car TEGRA30_CLK_PLL_E>, |
45 | <&tegra_car TEGRA30_CLK_CML0>; | 44 | <&tegra_car TEGRA30_CLK_CML0>; |
46 | clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml"; | 45 | clock-names = "pex", "afi", "pll_e", "cml"; |
46 | resets = <&tegra_car 70>, | ||
47 | <&tegra_car 72>, | ||
48 | <&tegra_car 74>; | ||
49 | reset-names = "pex", "afi", "pcie_x"; | ||
47 | status = "disabled"; | 50 | status = "disabled"; |
48 | 51 | ||
49 | pci@1,0 { | 52 | pci@1,0 { |
@@ -92,6 +95,8 @@ | |||
92 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ | 95 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ |
93 | <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ | 96 | <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ |
94 | clocks = <&tegra_car TEGRA30_CLK_HOST1X>; | 97 | clocks = <&tegra_car TEGRA30_CLK_HOST1X>; |
98 | resets = <&tegra_car 28>; | ||
99 | reset-names = "host1x"; | ||
95 | 100 | ||
96 | #address-cells = <1>; | 101 | #address-cells = <1>; |
97 | #size-cells = <1>; | 102 | #size-cells = <1>; |
@@ -103,6 +108,8 @@ | |||
103 | reg = <0x54040000 0x00040000>; | 108 | reg = <0x54040000 0x00040000>; |
104 | interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; | 109 | interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; |
105 | clocks = <&tegra_car TEGRA30_CLK_MPE>; | 110 | clocks = <&tegra_car TEGRA30_CLK_MPE>; |
111 | resets = <&tegra_car 60>; | ||
112 | reset-names = "mpe"; | ||
106 | }; | 113 | }; |
107 | 114 | ||
108 | vi { | 115 | vi { |
@@ -110,6 +117,8 @@ | |||
110 | reg = <0x54080000 0x00040000>; | 117 | reg = <0x54080000 0x00040000>; |
111 | interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; | 118 | interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; |
112 | clocks = <&tegra_car TEGRA30_CLK_VI>; | 119 | clocks = <&tegra_car TEGRA30_CLK_VI>; |
120 | resets = <&tegra_car 20>; | ||
121 | reset-names = "vi"; | ||
113 | }; | 122 | }; |
114 | 123 | ||
115 | epp { | 124 | epp { |
@@ -117,6 +126,8 @@ | |||
117 | reg = <0x540c0000 0x00040000>; | 126 | reg = <0x540c0000 0x00040000>; |
118 | interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; | 127 | interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; |
119 | clocks = <&tegra_car TEGRA30_CLK_EPP>; | 128 | clocks = <&tegra_car TEGRA30_CLK_EPP>; |
129 | resets = <&tegra_car 19>; | ||
130 | reset-names = "epp"; | ||
120 | }; | 131 | }; |
121 | 132 | ||
122 | isp { | 133 | isp { |
@@ -124,12 +135,16 @@ | |||
124 | reg = <0x54100000 0x00040000>; | 135 | reg = <0x54100000 0x00040000>; |
125 | interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; | 136 | interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; |
126 | clocks = <&tegra_car TEGRA30_CLK_ISP>; | 137 | clocks = <&tegra_car TEGRA30_CLK_ISP>; |
138 | resets = <&tegra_car 23>; | ||
139 | reset-names = "isp"; | ||
127 | }; | 140 | }; |
128 | 141 | ||
129 | gr2d { | 142 | gr2d { |
130 | compatible = "nvidia,tegra30-gr2d"; | 143 | compatible = "nvidia,tegra30-gr2d"; |
131 | reg = <0x54140000 0x00040000>; | 144 | reg = <0x54140000 0x00040000>; |
132 | interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; | 145 | interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; |
146 | resets = <&tegra_car 21>; | ||
147 | reset-names = "2d"; | ||
133 | clocks = <&tegra_car TEGRA30_CLK_GR2D>; | 148 | clocks = <&tegra_car TEGRA30_CLK_GR2D>; |
134 | }; | 149 | }; |
135 | 150 | ||
@@ -139,6 +154,9 @@ | |||
139 | clocks = <&tegra_car TEGRA30_CLK_GR3D | 154 | clocks = <&tegra_car TEGRA30_CLK_GR3D |
140 | &tegra_car TEGRA30_CLK_GR3D2>; | 155 | &tegra_car TEGRA30_CLK_GR3D2>; |
141 | clock-names = "3d", "3d2"; | 156 | clock-names = "3d", "3d2"; |
157 | resets = <&tegra_car 24>, | ||
158 | <&tegra_car 98>; | ||
159 | reset-names = "3d", "3d2"; | ||
142 | }; | 160 | }; |
143 | 161 | ||
144 | dc@54200000 { | 162 | dc@54200000 { |
@@ -147,7 +165,9 @@ | |||
147 | interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; | 165 | interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; |
148 | clocks = <&tegra_car TEGRA30_CLK_DISP1>, | 166 | clocks = <&tegra_car TEGRA30_CLK_DISP1>, |
149 | <&tegra_car TEGRA30_CLK_PLL_P>; | 167 | <&tegra_car TEGRA30_CLK_PLL_P>; |
150 | clock-names = "disp1", "parent"; | 168 | clock-names = "dc", "parent"; |
169 | resets = <&tegra_car 27>; | ||
170 | reset-names = "dc"; | ||
151 | 171 | ||
152 | rgb { | 172 | rgb { |
153 | status = "disabled"; | 173 | status = "disabled"; |
@@ -160,7 +180,9 @@ | |||
160 | interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; | 180 | interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; |
161 | clocks = <&tegra_car TEGRA30_CLK_DISP2>, | 181 | clocks = <&tegra_car TEGRA30_CLK_DISP2>, |
162 | <&tegra_car TEGRA30_CLK_PLL_P>; | 182 | <&tegra_car TEGRA30_CLK_PLL_P>; |
163 | clock-names = "disp2", "parent"; | 183 | clock-names = "dc", "parent"; |
184 | resets = <&tegra_car 26>; | ||
185 | reset-names = "dc"; | ||
164 | 186 | ||
165 | rgb { | 187 | rgb { |
166 | status = "disabled"; | 188 | status = "disabled"; |
@@ -174,6 +196,8 @@ | |||
174 | clocks = <&tegra_car TEGRA30_CLK_HDMI>, | 196 | clocks = <&tegra_car TEGRA30_CLK_HDMI>, |
175 | <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>; | 197 | <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>; |
176 | clock-names = "hdmi", "parent"; | 198 | clock-names = "hdmi", "parent"; |
199 | resets = <&tegra_car 51>; | ||
200 | reset-names = "hdmi"; | ||
177 | status = "disabled"; | 201 | status = "disabled"; |
178 | }; | 202 | }; |
179 | 203 | ||
@@ -189,6 +213,8 @@ | |||
189 | compatible = "nvidia,tegra30-dsi"; | 213 | compatible = "nvidia,tegra30-dsi"; |
190 | reg = <0x54300000 0x00040000>; | 214 | reg = <0x54300000 0x00040000>; |
191 | clocks = <&tegra_car TEGRA30_CLK_DSIA>; | 215 | clocks = <&tegra_car TEGRA30_CLK_DSIA>; |
216 | resets = <&tegra_car 48>; | ||
217 | reset-names = "dsi"; | ||
192 | status = "disabled"; | 218 | status = "disabled"; |
193 | }; | 219 | }; |
194 | }; | 220 | }; |
@@ -234,6 +260,7 @@ | |||
234 | compatible = "nvidia,tegra30-car"; | 260 | compatible = "nvidia,tegra30-car"; |
235 | reg = <0x60006000 0x1000>; | 261 | reg = <0x60006000 0x1000>; |
236 | #clock-cells = <1>; | 262 | #clock-cells = <1>; |
263 | #reset-cells = <1>; | ||
237 | }; | 264 | }; |
238 | 265 | ||
239 | apbdma: dma { | 266 | apbdma: dma { |
@@ -272,6 +299,9 @@ | |||
272 | <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, | 299 | <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, |
273 | <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; | 300 | <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; |
274 | clocks = <&tegra_car TEGRA30_CLK_APBDMA>; | 301 | clocks = <&tegra_car TEGRA30_CLK_APBDMA>; |
302 | resets = <&tegra_car 34>; | ||
303 | reset-names = "dma"; | ||
304 | #dma-cells = <1>; | ||
275 | }; | 305 | }; |
276 | 306 | ||
277 | ahb: ahb { | 307 | ahb: ahb { |
@@ -315,8 +345,11 @@ | |||
315 | reg = <0x70006000 0x40>; | 345 | reg = <0x70006000 0x40>; |
316 | reg-shift = <2>; | 346 | reg-shift = <2>; |
317 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; | 347 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; |
318 | nvidia,dma-request-selector = <&apbdma 8>; | ||
319 | clocks = <&tegra_car TEGRA30_CLK_UARTA>; | 348 | clocks = <&tegra_car TEGRA30_CLK_UARTA>; |
349 | resets = <&tegra_car 6>; | ||
350 | reset-names = "serial"; | ||
351 | dmas = <&apbdma 8>, <&apbdma 8>; | ||
352 | dma-names = "rx", "tx"; | ||
320 | status = "disabled"; | 353 | status = "disabled"; |
321 | }; | 354 | }; |
322 | 355 | ||
@@ -325,8 +358,11 @@ | |||
325 | reg = <0x70006040 0x40>; | 358 | reg = <0x70006040 0x40>; |
326 | reg-shift = <2>; | 359 | reg-shift = <2>; |
327 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; | 360 | interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; |
328 | nvidia,dma-request-selector = <&apbdma 9>; | ||
329 | clocks = <&tegra_car TEGRA30_CLK_UARTB>; | 361 | clocks = <&tegra_car TEGRA30_CLK_UARTB>; |
362 | resets = <&tegra_car 7>; | ||
363 | reset-names = "serial"; | ||
364 | dmas = <&apbdma 9>, <&apbdma 9>; | ||
365 | dma-names = "rx", "tx"; | ||
330 | status = "disabled"; | 366 | status = "disabled"; |
331 | }; | 367 | }; |
332 | 368 | ||
@@ -335,8 +371,11 @@ | |||
335 | reg = <0x70006200 0x100>; | 371 | reg = <0x70006200 0x100>; |
336 | reg-shift = <2>; | 372 | reg-shift = <2>; |
337 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; | 373 | interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; |
338 | nvidia,dma-request-selector = <&apbdma 10>; | ||
339 | clocks = <&tegra_car TEGRA30_CLK_UARTC>; | 374 | clocks = <&tegra_car TEGRA30_CLK_UARTC>; |
375 | resets = <&tegra_car 55>; | ||
376 | reset-names = "serial"; | ||
377 | dmas = <&apbdma 10>, <&apbdma 10>; | ||
378 | dma-names = "rx", "tx"; | ||
340 | status = "disabled"; | 379 | status = "disabled"; |
341 | }; | 380 | }; |
342 | 381 | ||
@@ -345,8 +384,11 @@ | |||
345 | reg = <0x70006300 0x100>; | 384 | reg = <0x70006300 0x100>; |
346 | reg-shift = <2>; | 385 | reg-shift = <2>; |
347 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; | 386 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; |
348 | nvidia,dma-request-selector = <&apbdma 19>; | ||
349 | clocks = <&tegra_car TEGRA30_CLK_UARTD>; | 387 | clocks = <&tegra_car TEGRA30_CLK_UARTD>; |
388 | resets = <&tegra_car 65>; | ||
389 | reset-names = "serial"; | ||
390 | dmas = <&apbdma 19>, <&apbdma 19>; | ||
391 | dma-names = "rx", "tx"; | ||
350 | status = "disabled"; | 392 | status = "disabled"; |
351 | }; | 393 | }; |
352 | 394 | ||
@@ -355,8 +397,11 @@ | |||
355 | reg = <0x70006400 0x100>; | 397 | reg = <0x70006400 0x100>; |
356 | reg-shift = <2>; | 398 | reg-shift = <2>; |
357 | interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; | 399 | interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; |
358 | nvidia,dma-request-selector = <&apbdma 20>; | ||
359 | clocks = <&tegra_car TEGRA30_CLK_UARTE>; | 400 | clocks = <&tegra_car TEGRA30_CLK_UARTE>; |
401 | resets = <&tegra_car 66>; | ||
402 | reset-names = "serial"; | ||
403 | dmas = <&apbdma 20>, <&apbdma 20>; | ||
404 | dma-names = "rx", "tx"; | ||
360 | status = "disabled"; | 405 | status = "disabled"; |
361 | }; | 406 | }; |
362 | 407 | ||
@@ -365,6 +410,8 @@ | |||
365 | reg = <0x7000a000 0x100>; | 410 | reg = <0x7000a000 0x100>; |
366 | #pwm-cells = <2>; | 411 | #pwm-cells = <2>; |
367 | clocks = <&tegra_car TEGRA30_CLK_PWM>; | 412 | clocks = <&tegra_car TEGRA30_CLK_PWM>; |
413 | resets = <&tegra_car 17>; | ||
414 | reset-names = "pwm"; | ||
368 | status = "disabled"; | 415 | status = "disabled"; |
369 | }; | 416 | }; |
370 | 417 | ||
@@ -384,6 +431,10 @@ | |||
384 | clocks = <&tegra_car TEGRA30_CLK_I2C1>, | 431 | clocks = <&tegra_car TEGRA30_CLK_I2C1>, |
385 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; | 432 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; |
386 | clock-names = "div-clk", "fast-clk"; | 433 | clock-names = "div-clk", "fast-clk"; |
434 | resets = <&tegra_car 12>; | ||
435 | reset-names = "i2c"; | ||
436 | dmas = <&apbdma 21>, <&apbdma 21>; | ||
437 | dma-names = "rx", "tx"; | ||
387 | status = "disabled"; | 438 | status = "disabled"; |
388 | }; | 439 | }; |
389 | 440 | ||
@@ -396,6 +447,10 @@ | |||
396 | clocks = <&tegra_car TEGRA30_CLK_I2C2>, | 447 | clocks = <&tegra_car TEGRA30_CLK_I2C2>, |
397 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; | 448 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; |
398 | clock-names = "div-clk", "fast-clk"; | 449 | clock-names = "div-clk", "fast-clk"; |
450 | resets = <&tegra_car 54>; | ||
451 | reset-names = "i2c"; | ||
452 | dmas = <&apbdma 22>, <&apbdma 22>; | ||
453 | dma-names = "rx", "tx"; | ||
399 | status = "disabled"; | 454 | status = "disabled"; |
400 | }; | 455 | }; |
401 | 456 | ||
@@ -408,6 +463,10 @@ | |||
408 | clocks = <&tegra_car TEGRA30_CLK_I2C3>, | 463 | clocks = <&tegra_car TEGRA30_CLK_I2C3>, |
409 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; | 464 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; |
410 | clock-names = "div-clk", "fast-clk"; | 465 | clock-names = "div-clk", "fast-clk"; |
466 | resets = <&tegra_car 67>; | ||
467 | reset-names = "i2c"; | ||
468 | dmas = <&apbdma 23>, <&apbdma 23>; | ||
469 | dma-names = "rx", "tx"; | ||
411 | status = "disabled"; | 470 | status = "disabled"; |
412 | }; | 471 | }; |
413 | 472 | ||
@@ -419,7 +478,11 @@ | |||
419 | #size-cells = <0>; | 478 | #size-cells = <0>; |
420 | clocks = <&tegra_car TEGRA30_CLK_I2C4>, | 479 | clocks = <&tegra_car TEGRA30_CLK_I2C4>, |
421 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; | 480 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; |
481 | resets = <&tegra_car 103>; | ||
482 | reset-names = "i2c"; | ||
422 | clock-names = "div-clk", "fast-clk"; | 483 | clock-names = "div-clk", "fast-clk"; |
484 | dmas = <&apbdma 26>, <&apbdma 26>; | ||
485 | dma-names = "rx", "tx"; | ||
423 | status = "disabled"; | 486 | status = "disabled"; |
424 | }; | 487 | }; |
425 | 488 | ||
@@ -432,6 +495,10 @@ | |||
432 | clocks = <&tegra_car TEGRA30_CLK_I2C5>, | 495 | clocks = <&tegra_car TEGRA30_CLK_I2C5>, |
433 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; | 496 | <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; |
434 | clock-names = "div-clk", "fast-clk"; | 497 | clock-names = "div-clk", "fast-clk"; |
498 | resets = <&tegra_car 47>; | ||
499 | reset-names = "i2c"; | ||
500 | dmas = <&apbdma 24>, <&apbdma 24>; | ||
501 | dma-names = "rx", "tx"; | ||
435 | status = "disabled"; | 502 | status = "disabled"; |
436 | }; | 503 | }; |
437 | 504 | ||
@@ -439,10 +506,13 @@ | |||
439 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 506 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
440 | reg = <0x7000d400 0x200>; | 507 | reg = <0x7000d400 0x200>; |
441 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; | 508 | interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; |
442 | nvidia,dma-request-selector = <&apbdma 15>; | ||
443 | #address-cells = <1>; | 509 | #address-cells = <1>; |
444 | #size-cells = <0>; | 510 | #size-cells = <0>; |
445 | clocks = <&tegra_car TEGRA30_CLK_SBC1>; | 511 | clocks = <&tegra_car TEGRA30_CLK_SBC1>; |
512 | resets = <&tegra_car 41>; | ||
513 | reset-names = "spi"; | ||
514 | dmas = <&apbdma 15>, <&apbdma 15>; | ||
515 | dma-names = "rx", "tx"; | ||
446 | status = "disabled"; | 516 | status = "disabled"; |
447 | }; | 517 | }; |
448 | 518 | ||
@@ -450,10 +520,13 @@ | |||
450 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 520 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
451 | reg = <0x7000d600 0x200>; | 521 | reg = <0x7000d600 0x200>; |
452 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; | 522 | interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; |
453 | nvidia,dma-request-selector = <&apbdma 16>; | ||
454 | #address-cells = <1>; | 523 | #address-cells = <1>; |
455 | #size-cells = <0>; | 524 | #size-cells = <0>; |
456 | clocks = <&tegra_car TEGRA30_CLK_SBC2>; | 525 | clocks = <&tegra_car TEGRA30_CLK_SBC2>; |
526 | resets = <&tegra_car 44>; | ||
527 | reset-names = "spi"; | ||
528 | dmas = <&apbdma 16>, <&apbdma 16>; | ||
529 | dma-names = "rx", "tx"; | ||
457 | status = "disabled"; | 530 | status = "disabled"; |
458 | }; | 531 | }; |
459 | 532 | ||
@@ -461,10 +534,13 @@ | |||
461 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 534 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
462 | reg = <0x7000d800 0x200>; | 535 | reg = <0x7000d800 0x200>; |
463 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; | 536 | interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; |
464 | nvidia,dma-request-selector = <&apbdma 17>; | ||
465 | #address-cells = <1>; | 537 | #address-cells = <1>; |
466 | #size-cells = <0>; | 538 | #size-cells = <0>; |
467 | clocks = <&tegra_car TEGRA30_CLK_SBC3>; | 539 | clocks = <&tegra_car TEGRA30_CLK_SBC3>; |
540 | resets = <&tegra_car 46>; | ||
541 | reset-names = "spi"; | ||
542 | dmas = <&apbdma 17>, <&apbdma 17>; | ||
543 | dma-names = "rx", "tx"; | ||
468 | status = "disabled"; | 544 | status = "disabled"; |
469 | }; | 545 | }; |
470 | 546 | ||
@@ -472,10 +548,13 @@ | |||
472 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 548 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
473 | reg = <0x7000da00 0x200>; | 549 | reg = <0x7000da00 0x200>; |
474 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; | 550 | interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; |
475 | nvidia,dma-request-selector = <&apbdma 18>; | ||
476 | #address-cells = <1>; | 551 | #address-cells = <1>; |
477 | #size-cells = <0>; | 552 | #size-cells = <0>; |
478 | clocks = <&tegra_car TEGRA30_CLK_SBC4>; | 553 | clocks = <&tegra_car TEGRA30_CLK_SBC4>; |
554 | resets = <&tegra_car 68>; | ||
555 | reset-names = "spi"; | ||
556 | dmas = <&apbdma 18>, <&apbdma 18>; | ||
557 | dma-names = "rx", "tx"; | ||
479 | status = "disabled"; | 558 | status = "disabled"; |
480 | }; | 559 | }; |
481 | 560 | ||
@@ -483,10 +562,13 @@ | |||
483 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 562 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
484 | reg = <0x7000dc00 0x200>; | 563 | reg = <0x7000dc00 0x200>; |
485 | interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; | 564 | interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; |
486 | nvidia,dma-request-selector = <&apbdma 27>; | ||
487 | #address-cells = <1>; | 565 | #address-cells = <1>; |
488 | #size-cells = <0>; | 566 | #size-cells = <0>; |
489 | clocks = <&tegra_car TEGRA30_CLK_SBC5>; | 567 | clocks = <&tegra_car TEGRA30_CLK_SBC5>; |
568 | resets = <&tegra_car 104>; | ||
569 | reset-names = "spi"; | ||
570 | dmas = <&apbdma 27>, <&apbdma 27>; | ||
571 | dma-names = "rx", "tx"; | ||
490 | status = "disabled"; | 572 | status = "disabled"; |
491 | }; | 573 | }; |
492 | 574 | ||
@@ -494,10 +576,13 @@ | |||
494 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; | 576 | compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; |
495 | reg = <0x7000de00 0x200>; | 577 | reg = <0x7000de00 0x200>; |
496 | interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; | 578 | interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; |
497 | nvidia,dma-request-selector = <&apbdma 28>; | ||
498 | #address-cells = <1>; | 579 | #address-cells = <1>; |
499 | #size-cells = <0>; | 580 | #size-cells = <0>; |
500 | clocks = <&tegra_car TEGRA30_CLK_SBC6>; | 581 | clocks = <&tegra_car TEGRA30_CLK_SBC6>; |
582 | resets = <&tegra_car 106>; | ||
583 | reset-names = "spi"; | ||
584 | dmas = <&apbdma 28>, <&apbdma 28>; | ||
585 | dma-names = "rx", "tx"; | ||
501 | status = "disabled"; | 586 | status = "disabled"; |
502 | }; | 587 | }; |
503 | 588 | ||
@@ -506,6 +591,8 @@ | |||
506 | reg = <0x7000e200 0x100>; | 591 | reg = <0x7000e200 0x100>; |
507 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; | 592 | interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; |
508 | clocks = <&tegra_car TEGRA30_CLK_KBC>; | 593 | clocks = <&tegra_car TEGRA30_CLK_KBC>; |
594 | resets = <&tegra_car 36>; | ||
595 | reset-names = "kbc"; | ||
509 | status = "disabled"; | 596 | status = "disabled"; |
510 | }; | 597 | }; |
511 | 598 | ||
@@ -540,21 +627,29 @@ | |||
540 | reg = <0x70080000 0x200 | 627 | reg = <0x70080000 0x200 |
541 | 0x70080200 0x100>; | 628 | 0x70080200 0x100>; |
542 | interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; | 629 | interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; |
543 | nvidia,dma-request-selector = <&apbdma 1>; | ||
544 | clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>, | 630 | clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>, |
545 | <&tegra_car TEGRA30_CLK_APBIF>, | 631 | <&tegra_car TEGRA30_CLK_APBIF>; |
546 | <&tegra_car TEGRA30_CLK_I2S0>, | 632 | clock-names = "d_audio", "apbif"; |
547 | <&tegra_car TEGRA30_CLK_I2S1>, | 633 | resets = <&tegra_car 106>, /* d_audio */ |
548 | <&tegra_car TEGRA30_CLK_I2S2>, | 634 | <&tegra_car 107>, /* apbif */ |
549 | <&tegra_car TEGRA30_CLK_I2S3>, | 635 | <&tegra_car 30>, /* i2s0 */ |
550 | <&tegra_car TEGRA30_CLK_I2S4>, | 636 | <&tegra_car 11>, /* i2s1 */ |
551 | <&tegra_car TEGRA30_CLK_DAM0>, | 637 | <&tegra_car 18>, /* i2s2 */ |
552 | <&tegra_car TEGRA30_CLK_DAM1>, | 638 | <&tegra_car 101>, /* i2s3 */ |
553 | <&tegra_car TEGRA30_CLK_DAM2>, | 639 | <&tegra_car 102>, /* i2s4 */ |
554 | <&tegra_car TEGRA30_CLK_SPDIF_IN>; | 640 | <&tegra_car 108>, /* dam0 */ |
555 | clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | 641 | <&tegra_car 109>, /* dam1 */ |
642 | <&tegra_car 110>, /* dam2 */ | ||
643 | <&tegra_car 10>; /* spdif */ | ||
644 | reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | ||
556 | "i2s3", "i2s4", "dam0", "dam1", "dam2", | 645 | "i2s3", "i2s4", "dam0", "dam1", "dam2", |
557 | "spdif_in"; | 646 | "spdif"; |
647 | dmas = <&apbdma 1>, <&apbdma 1>, | ||
648 | <&apbdma 2>, <&apbdma 2>, | ||
649 | <&apbdma 3>, <&apbdma 3>, | ||
650 | <&apbdma 4>, <&apbdma 4>; | ||
651 | dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2", | ||
652 | "rx3", "tx3"; | ||
558 | ranges; | 653 | ranges; |
559 | #address-cells = <1>; | 654 | #address-cells = <1>; |
560 | #size-cells = <1>; | 655 | #size-cells = <1>; |
@@ -564,6 +659,8 @@ | |||
564 | reg = <0x70080300 0x100>; | 659 | reg = <0x70080300 0x100>; |
565 | nvidia,ahub-cif-ids = <4 4>; | 660 | nvidia,ahub-cif-ids = <4 4>; |
566 | clocks = <&tegra_car TEGRA30_CLK_I2S0>; | 661 | clocks = <&tegra_car TEGRA30_CLK_I2S0>; |
662 | resets = <&tegra_car 30>; | ||
663 | reset-names = "i2s"; | ||
567 | status = "disabled"; | 664 | status = "disabled"; |
568 | }; | 665 | }; |
569 | 666 | ||
@@ -572,6 +669,8 @@ | |||
572 | reg = <0x70080400 0x100>; | 669 | reg = <0x70080400 0x100>; |
573 | nvidia,ahub-cif-ids = <5 5>; | 670 | nvidia,ahub-cif-ids = <5 5>; |
574 | clocks = <&tegra_car TEGRA30_CLK_I2S1>; | 671 | clocks = <&tegra_car TEGRA30_CLK_I2S1>; |
672 | resets = <&tegra_car 11>; | ||
673 | reset-names = "i2s"; | ||
575 | status = "disabled"; | 674 | status = "disabled"; |
576 | }; | 675 | }; |
577 | 676 | ||
@@ -580,6 +679,8 @@ | |||
580 | reg = <0x70080500 0x100>; | 679 | reg = <0x70080500 0x100>; |
581 | nvidia,ahub-cif-ids = <6 6>; | 680 | nvidia,ahub-cif-ids = <6 6>; |
582 | clocks = <&tegra_car TEGRA30_CLK_I2S2>; | 681 | clocks = <&tegra_car TEGRA30_CLK_I2S2>; |
682 | resets = <&tegra_car 18>; | ||
683 | reset-names = "i2s"; | ||
583 | status = "disabled"; | 684 | status = "disabled"; |
584 | }; | 685 | }; |
585 | 686 | ||
@@ -588,6 +689,8 @@ | |||
588 | reg = <0x70080600 0x100>; | 689 | reg = <0x70080600 0x100>; |
589 | nvidia,ahub-cif-ids = <7 7>; | 690 | nvidia,ahub-cif-ids = <7 7>; |
590 | clocks = <&tegra_car TEGRA30_CLK_I2S3>; | 691 | clocks = <&tegra_car TEGRA30_CLK_I2S3>; |
692 | resets = <&tegra_car 101>; | ||
693 | reset-names = "i2s"; | ||
591 | status = "disabled"; | 694 | status = "disabled"; |
592 | }; | 695 | }; |
593 | 696 | ||
@@ -596,6 +699,8 @@ | |||
596 | reg = <0x70080700 0x100>; | 699 | reg = <0x70080700 0x100>; |
597 | nvidia,ahub-cif-ids = <8 8>; | 700 | nvidia,ahub-cif-ids = <8 8>; |
598 | clocks = <&tegra_car TEGRA30_CLK_I2S4>; | 701 | clocks = <&tegra_car TEGRA30_CLK_I2S4>; |
702 | resets = <&tegra_car 102>; | ||
703 | reset-names = "i2s"; | ||
599 | status = "disabled"; | 704 | status = "disabled"; |
600 | }; | 705 | }; |
601 | }; | 706 | }; |
@@ -605,6 +710,8 @@ | |||
605 | reg = <0x78000000 0x200>; | 710 | reg = <0x78000000 0x200>; |
606 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 711 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
607 | clocks = <&tegra_car TEGRA30_CLK_SDMMC1>; | 712 | clocks = <&tegra_car TEGRA30_CLK_SDMMC1>; |
713 | resets = <&tegra_car 14>; | ||
714 | reset-names = "sdhci"; | ||
608 | status = "disabled"; | 715 | status = "disabled"; |
609 | }; | 716 | }; |
610 | 717 | ||
@@ -613,6 +720,8 @@ | |||
613 | reg = <0x78000200 0x200>; | 720 | reg = <0x78000200 0x200>; |
614 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 721 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
615 | clocks = <&tegra_car TEGRA30_CLK_SDMMC2>; | 722 | clocks = <&tegra_car TEGRA30_CLK_SDMMC2>; |
723 | resets = <&tegra_car 9>; | ||
724 | reset-names = "sdhci"; | ||
616 | status = "disabled"; | 725 | status = "disabled"; |
617 | }; | 726 | }; |
618 | 727 | ||
@@ -621,6 +730,8 @@ | |||
621 | reg = <0x78000400 0x200>; | 730 | reg = <0x78000400 0x200>; |
622 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; | 731 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; |
623 | clocks = <&tegra_car TEGRA30_CLK_SDMMC3>; | 732 | clocks = <&tegra_car TEGRA30_CLK_SDMMC3>; |
733 | resets = <&tegra_car 69>; | ||
734 | reset-names = "sdhci"; | ||
624 | status = "disabled"; | 735 | status = "disabled"; |
625 | }; | 736 | }; |
626 | 737 | ||
@@ -629,6 +740,8 @@ | |||
629 | reg = <0x78000600 0x200>; | 740 | reg = <0x78000600 0x200>; |
630 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; | 741 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; |
631 | clocks = <&tegra_car TEGRA30_CLK_SDMMC4>; | 742 | clocks = <&tegra_car TEGRA30_CLK_SDMMC4>; |
743 | resets = <&tegra_car 15>; | ||
744 | reset-names = "sdhci"; | ||
632 | status = "disabled"; | 745 | status = "disabled"; |
633 | }; | 746 | }; |
634 | 747 | ||
@@ -638,6 +751,8 @@ | |||
638 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; | 751 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; |
639 | phy_type = "utmi"; | 752 | phy_type = "utmi"; |
640 | clocks = <&tegra_car TEGRA30_CLK_USBD>; | 753 | clocks = <&tegra_car TEGRA30_CLK_USBD>; |
754 | resets = <&tegra_car 22>; | ||
755 | reset-names = "usb"; | ||
641 | nvidia,needs-double-reset; | 756 | nvidia,needs-double-reset; |
642 | nvidia,phy = <&phy1>; | 757 | nvidia,phy = <&phy1>; |
643 | status = "disabled"; | 758 | status = "disabled"; |
@@ -671,6 +786,8 @@ | |||
671 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; | 786 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; |
672 | phy_type = "ulpi"; | 787 | phy_type = "ulpi"; |
673 | clocks = <&tegra_car TEGRA30_CLK_USB2>; | 788 | clocks = <&tegra_car TEGRA30_CLK_USB2>; |
789 | resets = <&tegra_car 58>; | ||
790 | reset-names = "usb"; | ||
674 | nvidia,phy = <&phy2>; | 791 | nvidia,phy = <&phy2>; |
675 | status = "disabled"; | 792 | status = "disabled"; |
676 | }; | 793 | }; |
@@ -692,6 +809,8 @@ | |||
692 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; | 809 | interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; |
693 | phy_type = "utmi"; | 810 | phy_type = "utmi"; |
694 | clocks = <&tegra_car TEGRA30_CLK_USB3>; | 811 | clocks = <&tegra_car TEGRA30_CLK_USB3>; |
812 | resets = <&tegra_car 59>; | ||
813 | reset-names = "usb"; | ||
695 | nvidia,phy = <&phy3>; | 814 | nvidia,phy = <&phy3>; |
696 | status = "disabled"; | 815 | status = "disabled"; |
697 | }; | 816 | }; |
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index 690e89273230..0b4e9b5210d8 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig | |||
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y | |||
22 | CONFIG_SOC_AT91SAM9N12=y | 22 | CONFIG_SOC_AT91SAM9N12=y |
23 | CONFIG_MACH_AT91RM9200_DT=y | 23 | CONFIG_MACH_AT91RM9200_DT=y |
24 | CONFIG_MACH_AT91SAM9_DT=y | 24 | CONFIG_MACH_AT91SAM9_DT=y |
25 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
26 | CONFIG_AT91_TIMER_HZ=128 | 25 | CONFIG_AT91_TIMER_HZ=128 |
27 | CONFIG_AEABI=y | 26 | CONFIG_AEABI=y |
28 | # CONFIG_OABI_COMPAT is not set | 27 | # CONFIG_OABI_COMPAT is not set |
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig index 75502c4d222c..bf057719dab0 100644 --- a/arch/arm/configs/at91rm9200_defconfig +++ b/arch/arm/configs/at91rm9200_defconfig | |||
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y | |||
31 | CONFIG_MACH_CPUAT91=y | 31 | CONFIG_MACH_CPUAT91=y |
32 | CONFIG_MACH_ECO920=y | 32 | CONFIG_MACH_ECO920=y |
33 | CONFIG_MTD_AT91_DATAFLASH_CARD=y | 33 | CONFIG_MTD_AT91_DATAFLASH_CARD=y |
34 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
35 | CONFIG_AT91_TIMER_HZ=100 | 34 | CONFIG_AT91_TIMER_HZ=100 |
36 | # CONFIG_ARM_THUMB is not set | 35 | # CONFIG_ARM_THUMB is not set |
37 | CONFIG_PCCARD=y | 36 | CONFIG_PCCARD=y |
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig index 69b6928d3d9d..2cd832918e9c 100644 --- a/arch/arm/configs/at91sam9260_9g20_defconfig +++ b/arch/arm/configs/at91sam9260_9g20_defconfig | |||
@@ -15,7 +15,6 @@ CONFIG_MACH_AT91SAM9260EK=y | |||
15 | CONFIG_MACH_CAM60=y | 15 | CONFIG_MACH_CAM60=y |
16 | CONFIG_MACH_SAM9_L9260=y | 16 | CONFIG_MACH_SAM9_L9260=y |
17 | CONFIG_MACH_AFEB9260=y | 17 | CONFIG_MACH_AFEB9260=y |
18 | CONFIG_MACH_QIL_A9260=y | ||
19 | CONFIG_MACH_CPU9260=y | 18 | CONFIG_MACH_CPU9260=y |
20 | CONFIG_MACH_FLEXIBITY=y | 19 | CONFIG_MACH_FLEXIBITY=y |
21 | CONFIG_MACH_AT91SAM9G20EK=y | 20 | CONFIG_MACH_AT91SAM9G20EK=y |
@@ -28,7 +27,6 @@ CONFIG_MACH_PCONTROL_G20=y | |||
28 | CONFIG_MACH_GSIA18S=y | 27 | CONFIG_MACH_GSIA18S=y |
29 | CONFIG_MACH_SNAPPER_9260=y | 28 | CONFIG_MACH_SNAPPER_9260=y |
30 | CONFIG_MACH_AT91SAM9_DT=y | 29 | CONFIG_MACH_AT91SAM9_DT=y |
31 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
32 | CONFIG_AT91_SLOW_CLOCK=y | 30 | CONFIG_AT91_SLOW_CLOCK=y |
33 | # CONFIG_ARM_THUMB is not set | 31 | # CONFIG_ARM_THUMB is not set |
34 | CONFIG_AEABI=y | 32 | CONFIG_AEABI=y |
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig index 9d35cd81c611..f80e993b04ce 100644 --- a/arch/arm/configs/at91sam9261_9g10_defconfig +++ b/arch/arm/configs/at91sam9261_9g10_defconfig | |||
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y | |||
18 | CONFIG_ARCH_AT91SAM9261=y | 18 | CONFIG_ARCH_AT91SAM9261=y |
19 | CONFIG_MACH_AT91SAM9261EK=y | 19 | CONFIG_MACH_AT91SAM9261EK=y |
20 | CONFIG_MACH_AT91SAM9G10EK=y | 20 | CONFIG_MACH_AT91SAM9G10EK=y |
21 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
22 | # CONFIG_ARM_THUMB is not set | 21 | # CONFIG_ARM_THUMB is not set |
23 | CONFIG_AEABI=y | 22 | CONFIG_AEABI=y |
24 | # CONFIG_OABI_COMPAT is not set | 23 | # CONFIG_OABI_COMPAT is not set |
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig index 08166cd4e7d6..e181a50fd65a 100644 --- a/arch/arm/configs/at91sam9g45_defconfig +++ b/arch/arm/configs/at91sam9g45_defconfig | |||
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y | |||
18 | CONFIG_ARCH_AT91SAM9G45=y | 18 | CONFIG_ARCH_AT91SAM9G45=y |
19 | CONFIG_MACH_AT91SAM9M10G45EK=y | 19 | CONFIG_MACH_AT91SAM9M10G45EK=y |
20 | CONFIG_MACH_AT91SAM9_DT=y | 20 | CONFIG_MACH_AT91SAM9_DT=y |
21 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
22 | CONFIG_AT91_SLOW_CLOCK=y | 21 | CONFIG_AT91_SLOW_CLOCK=y |
23 | CONFIG_AEABI=y | 22 | CONFIG_AEABI=y |
24 | # CONFIG_OABI_COMPAT is not set | 23 | # CONFIG_OABI_COMPAT is not set |
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig index 7cf87856d63c..7b6f131cecd6 100644 --- a/arch/arm/configs/at91sam9rl_defconfig +++ b/arch/arm/configs/at91sam9rl_defconfig | |||
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y | |||
13 | CONFIG_ARCH_AT91=y | 13 | CONFIG_ARCH_AT91=y |
14 | CONFIG_ARCH_AT91SAM9RL=y | 14 | CONFIG_ARCH_AT91SAM9RL=y |
15 | CONFIG_MACH_AT91SAM9RLEK=y | 15 | CONFIG_MACH_AT91SAM9RLEK=y |
16 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
17 | # CONFIG_ARM_THUMB is not set | 16 | # CONFIG_ARM_THUMB is not set |
18 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 17 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
19 | CONFIG_ZBOOT_ROM_BSS=0x0 | 18 | CONFIG_ZBOOT_ROM_BSS=0x0 |
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig index f6e78f83c3c3..dc3881e07630 100644 --- a/arch/arm/configs/sama5_defconfig +++ b/arch/arm/configs/sama5_defconfig | |||
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y | |||
20 | CONFIG_SOC_SAM_V7=y | 20 | CONFIG_SOC_SAM_V7=y |
21 | CONFIG_SOC_SAMA5D3=y | 21 | CONFIG_SOC_SAMA5D3=y |
22 | CONFIG_MACH_SAMA5_DT=y | 22 | CONFIG_MACH_SAMA5_DT=y |
23 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
24 | CONFIG_AEABI=y | 23 | CONFIG_AEABI=y |
25 | # CONFIG_OABI_COMPAT is not set | 24 | # CONFIG_OABI_COMPAT is not set |
26 | CONFIG_UACCESS_WITH_MEMCPY=y | 25 | CONFIG_UACCESS_WITH_MEMCPY=y |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 699b71e7f7ec..f1bf952da747 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -1,15 +1,33 @@ | |||
1 | if ARCH_AT91 | 1 | if ARCH_AT91 |
2 | 2 | ||
3 | config HAVE_AT91_UTMI | ||
4 | bool | ||
5 | |||
6 | config HAVE_AT91_USB_CLK | ||
7 | bool | ||
8 | |||
3 | config HAVE_AT91_DBGU0 | 9 | config HAVE_AT91_DBGU0 |
4 | bool | 10 | bool |
5 | 11 | ||
6 | config HAVE_AT91_DBGU1 | 12 | config HAVE_AT91_DBGU1 |
7 | bool | 13 | bool |
8 | 14 | ||
15 | config AT91_USE_OLD_CLK | ||
16 | bool | ||
17 | |||
9 | config AT91_PMC_UNIT | 18 | config AT91_PMC_UNIT |
10 | bool | 19 | bool |
11 | default !ARCH_AT91X40 | 20 | default !ARCH_AT91X40 |
12 | 21 | ||
22 | config COMMON_CLK_AT91 | ||
23 | bool | ||
24 | default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK | ||
25 | select COMMON_CLK | ||
26 | |||
27 | config OLD_CLK_AT91 | ||
28 | bool | ||
29 | default AT91_PMC_UNIT && AT91_USE_OLD_CLK | ||
30 | |||
13 | config AT91_SAM9_ALT_RESET | 31 | config AT91_SAM9_ALT_RESET |
14 | bool | 32 | bool |
15 | default !ARCH_AT91X40 | 33 | default !ARCH_AT91X40 |
@@ -21,6 +39,9 @@ config AT91_SAM9G45_RESET | |||
21 | config AT91_SAM9_TIME | 39 | config AT91_SAM9_TIME |
22 | bool | 40 | bool |
23 | 41 | ||
42 | config HAVE_AT91_SMD | ||
43 | bool | ||
44 | |||
24 | config SOC_AT91SAM9 | 45 | config SOC_AT91SAM9 |
25 | bool | 46 | bool |
26 | select AT91_SAM9_TIME | 47 | select AT91_SAM9_TIME |
@@ -61,10 +82,12 @@ comment "Atmel AT91 Processor" | |||
61 | if SOC_SAM_V7 | 82 | if SOC_SAM_V7 |
62 | config SOC_SAMA5D3 | 83 | config SOC_SAMA5D3 |
63 | bool "SAMA5D3 family" | 84 | bool "SAMA5D3 family" |
64 | depends on SOC_SAM_V7 | ||
65 | select SOC_SAMA5 | 85 | select SOC_SAMA5 |
66 | select HAVE_FB_ATMEL | 86 | select HAVE_FB_ATMEL |
67 | select HAVE_AT91_DBGU1 | 87 | select HAVE_AT91_DBGU1 |
88 | select HAVE_AT91_UTMI | ||
89 | select HAVE_AT91_SMD | ||
90 | select HAVE_AT91_USB_CLK | ||
68 | help | 91 | help |
69 | Select this if you are using one of Atmel's SAMA5D3 family SoC. | 92 | Select this if you are using one of Atmel's SAMA5D3 family SoC. |
70 | This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. | 93 | This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. |
@@ -78,11 +101,15 @@ config SOC_AT91RM9200 | |||
78 | select HAVE_AT91_DBGU0 | 101 | select HAVE_AT91_DBGU0 |
79 | select MULTI_IRQ_HANDLER | 102 | select MULTI_IRQ_HANDLER |
80 | select SPARSE_IRQ | 103 | select SPARSE_IRQ |
104 | select AT91_USE_OLD_CLK | ||
105 | select HAVE_AT91_USB_CLK | ||
81 | 106 | ||
82 | config SOC_AT91SAM9260 | 107 | config SOC_AT91SAM9260 |
83 | bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" | 108 | bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" |
84 | select HAVE_AT91_DBGU0 | 109 | select HAVE_AT91_DBGU0 |
85 | select SOC_AT91SAM9 | 110 | select SOC_AT91SAM9 |
111 | select AT91_USE_OLD_CLK | ||
112 | select HAVE_AT91_USB_CLK | ||
86 | help | 113 | help |
87 | Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE | 114 | Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE |
88 | or AT91SAM9G20 SoC. | 115 | or AT91SAM9G20 SoC. |
@@ -92,6 +119,8 @@ config SOC_AT91SAM9261 | |||
92 | select HAVE_AT91_DBGU0 | 119 | select HAVE_AT91_DBGU0 |
93 | select HAVE_FB_ATMEL | 120 | select HAVE_FB_ATMEL |
94 | select SOC_AT91SAM9 | 121 | select SOC_AT91SAM9 |
122 | select AT91_USE_OLD_CLK | ||
123 | select HAVE_AT91_USB_CLK | ||
95 | help | 124 | help |
96 | Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. | 125 | Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. |
97 | 126 | ||
@@ -100,18 +129,25 @@ config SOC_AT91SAM9263 | |||
100 | select HAVE_AT91_DBGU1 | 129 | select HAVE_AT91_DBGU1 |
101 | select HAVE_FB_ATMEL | 130 | select HAVE_FB_ATMEL |
102 | select SOC_AT91SAM9 | 131 | select SOC_AT91SAM9 |
132 | select AT91_USE_OLD_CLK | ||
133 | select HAVE_AT91_USB_CLK | ||
103 | 134 | ||
104 | config SOC_AT91SAM9RL | 135 | config SOC_AT91SAM9RL |
105 | bool "AT91SAM9RL" | 136 | bool "AT91SAM9RL" |
106 | select HAVE_AT91_DBGU0 | 137 | select HAVE_AT91_DBGU0 |
107 | select HAVE_FB_ATMEL | 138 | select HAVE_FB_ATMEL |
108 | select SOC_AT91SAM9 | 139 | select SOC_AT91SAM9 |
140 | select AT91_USE_OLD_CLK | ||
141 | select HAVE_AT91_UTMI | ||
109 | 142 | ||
110 | config SOC_AT91SAM9G45 | 143 | config SOC_AT91SAM9G45 |
111 | bool "AT91SAM9G45 or AT91SAM9M10 families" | 144 | bool "AT91SAM9G45 or AT91SAM9M10 families" |
112 | select HAVE_AT91_DBGU1 | 145 | select HAVE_AT91_DBGU1 |
113 | select HAVE_FB_ATMEL | 146 | select HAVE_FB_ATMEL |
114 | select SOC_AT91SAM9 | 147 | select SOC_AT91SAM9 |
148 | select AT91_USE_OLD_CLK | ||
149 | select HAVE_AT91_UTMI | ||
150 | select HAVE_AT91_USB_CLK | ||
115 | help | 151 | help |
116 | Select this if you are using one of Atmel's AT91SAM9G45 family SoC. | 152 | Select this if you are using one of Atmel's AT91SAM9G45 family SoC. |
117 | This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. | 153 | This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. |
@@ -121,6 +157,10 @@ config SOC_AT91SAM9X5 | |||
121 | select HAVE_AT91_DBGU0 | 157 | select HAVE_AT91_DBGU0 |
122 | select HAVE_FB_ATMEL | 158 | select HAVE_FB_ATMEL |
123 | select SOC_AT91SAM9 | 159 | select SOC_AT91SAM9 |
160 | select AT91_USE_OLD_CLK | ||
161 | select HAVE_AT91_UTMI | ||
162 | select HAVE_AT91_SMD | ||
163 | select HAVE_AT91_USB_CLK | ||
124 | help | 164 | help |
125 | Select this if you are using one of Atmel's AT91SAM9x5 family SoC. | 165 | Select this if you are using one of Atmel's AT91SAM9x5 family SoC. |
126 | This means that your SAM9 name finishes with a '5' (except if it is | 166 | This means that your SAM9 name finishes with a '5' (except if it is |
@@ -133,6 +173,8 @@ config SOC_AT91SAM9N12 | |||
133 | select HAVE_AT91_DBGU0 | 173 | select HAVE_AT91_DBGU0 |
134 | select HAVE_FB_ATMEL | 174 | select HAVE_FB_ATMEL |
135 | select SOC_AT91SAM9 | 175 | select SOC_AT91SAM9 |
176 | select AT91_USE_OLD_CLK | ||
177 | select HAVE_AT91_USB_CLK | ||
136 | help | 178 | help |
137 | Select this if you are using Atmel's AT91SAM9N12 SoC. | 179 | Select this if you are using Atmel's AT91SAM9N12 SoC. |
138 | 180 | ||
@@ -172,12 +214,6 @@ config MACH_SAMA5_DT | |||
172 | 214 | ||
173 | comment "AT91 Feature Selections" | 215 | comment "AT91 Feature Selections" |
174 | 216 | ||
175 | config AT91_PROGRAMMABLE_CLOCKS | ||
176 | bool "Programmable Clocks" | ||
177 | help | ||
178 | Select this if you need to program one or more of the PCK0..PCK3 | ||
179 | programmable clock outputs. | ||
180 | |||
181 | config AT91_SLOW_CLOCK | 217 | config AT91_SLOW_CLOCK |
182 | bool "Suspend-to-RAM disables main oscillator" | 218 | bool "Suspend-to-RAM disables main oscillator" |
183 | depends on SUSPEND | 219 | depends on SUSPEND |
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt index 0363dba7d3f6..1f73e9b527da 100644 --- a/arch/arm/mach-at91/Kconfig.non_dt +++ b/arch/arm/mach-at91/Kconfig.non_dt | |||
@@ -12,26 +12,32 @@ config ARCH_AT91_NONE | |||
12 | config ARCH_AT91RM9200 | 12 | config ARCH_AT91RM9200 |
13 | bool "AT91RM9200" | 13 | bool "AT91RM9200" |
14 | select SOC_AT91RM9200 | 14 | select SOC_AT91RM9200 |
15 | select AT91_USE_OLD_CLK | ||
15 | 16 | ||
16 | config ARCH_AT91SAM9260 | 17 | config ARCH_AT91SAM9260 |
17 | bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" | 18 | bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" |
18 | select SOC_AT91SAM9260 | 19 | select SOC_AT91SAM9260 |
20 | select AT91_USE_OLD_CLK | ||
19 | 21 | ||
20 | config ARCH_AT91SAM9261 | 22 | config ARCH_AT91SAM9261 |
21 | bool "AT91SAM9261 or AT91SAM9G10" | 23 | bool "AT91SAM9261 or AT91SAM9G10" |
22 | select SOC_AT91SAM9261 | 24 | select SOC_AT91SAM9261 |
25 | select AT91_USE_OLD_CLK | ||
23 | 26 | ||
24 | config ARCH_AT91SAM9263 | 27 | config ARCH_AT91SAM9263 |
25 | bool "AT91SAM9263" | 28 | bool "AT91SAM9263" |
26 | select SOC_AT91SAM9263 | 29 | select SOC_AT91SAM9263 |
30 | select AT91_USE_OLD_CLK | ||
27 | 31 | ||
28 | config ARCH_AT91SAM9RL | 32 | config ARCH_AT91SAM9RL |
29 | bool "AT91SAM9RL" | 33 | bool "AT91SAM9RL" |
30 | select SOC_AT91SAM9RL | 34 | select SOC_AT91SAM9RL |
35 | select AT91_USE_OLD_CLK | ||
31 | 36 | ||
32 | config ARCH_AT91SAM9G45 | 37 | config ARCH_AT91SAM9G45 |
33 | bool "AT91SAM9G45" | 38 | bool "AT91SAM9G45" |
34 | select SOC_AT91SAM9G45 | 39 | select SOC_AT91SAM9G45 |
40 | select AT91_USE_OLD_CLK | ||
35 | 41 | ||
36 | config ARCH_AT91X40 | 42 | config ARCH_AT91X40 |
37 | bool "AT91x40" | 43 | bool "AT91x40" |
@@ -176,12 +182,6 @@ config MACH_AFEB9260 | |||
176 | <svn://194.85.238.22/home/users/george/svn/arm9eb> | 182 | <svn://194.85.238.22/home/users/george/svn/arm9eb> |
177 | <http://groups.google.com/group/arm9fpga-evolution-board> | 183 | <http://groups.google.com/group/arm9fpga-evolution-board> |
178 | 184 | ||
179 | config MACH_QIL_A9260 | ||
180 | bool "CALAO QIL-A9260 board" | ||
181 | help | ||
182 | Select this if you are using a Calao Systems QIL-A9260 Board. | ||
183 | <http://www.calao-systems.com> | ||
184 | |||
185 | config MACH_CPU9260 | 185 | config MACH_CPU9260 |
186 | bool "Eukrea CPU9260 board" | 186 | bool "Eukrea CPU9260 board" |
187 | help | 187 | help |
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 90aab2d5a07f..78e9cec282f4 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -7,7 +7,7 @@ obj-m := | |||
7 | obj-n := | 7 | obj-n := |
8 | obj- := | 8 | obj- := |
9 | 9 | ||
10 | obj-$(CONFIG_AT91_PMC_UNIT) += clock.o | 10 | obj-$(CONFIG_OLD_CLK_AT91) += clock.o |
11 | obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o | 11 | obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o |
12 | obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o | 12 | obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o |
13 | obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o | 13 | obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o |
@@ -52,7 +52,6 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o | |||
52 | obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o | 52 | obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o |
53 | obj-$(CONFIG_MACH_CAM60) += board-cam60.o | 53 | obj-$(CONFIG_MACH_CAM60) += board-cam60.o |
54 | obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o | 54 | obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o |
55 | obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o | ||
56 | obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o | 55 | obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o |
57 | obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o | 56 | obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o |
58 | obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o | 57 | obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o |
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 25805f2f6010..e47f5fd232f5 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -12,13 +12,13 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/reboot.h> | 14 | #include <linux/reboot.h> |
15 | #include <linux/clk/at91_pmc.h> | ||
15 | 16 | ||
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
18 | #include <asm/mach/map.h> | 19 | #include <asm/mach/map.h> |
19 | #include <asm/system_misc.h> | 20 | #include <asm/system_misc.h> |
20 | #include <mach/at91rm9200.h> | 21 | #include <mach/at91rm9200.h> |
21 | #include <mach/at91_pmc.h> | ||
22 | #include <mach/at91_st.h> | 22 | #include <mach/at91_st.h> |
23 | #include <mach/cpu.h> | 23 | #include <mach/cpu.h> |
24 | 24 | ||
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index d6a1fa85371d..6c821e562159 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/clk/at91_pmc.h> | ||
14 | 15 | ||
15 | #include <asm/proc-fns.h> | 16 | #include <asm/proc-fns.h> |
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
@@ -20,7 +21,6 @@ | |||
20 | #include <mach/cpu.h> | 21 | #include <mach/cpu.h> |
21 | #include <mach/at91_dbgu.h> | 22 | #include <mach/at91_dbgu.h> |
22 | #include <mach/at91sam9260.h> | 23 | #include <mach/at91sam9260.h> |
23 | #include <mach/at91_pmc.h> | ||
24 | 24 | ||
25 | #include "at91_aic.h" | 25 | #include "at91_aic.h" |
26 | #include "at91_rstc.h" | 26 | #include "at91_rstc.h" |
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 23ba1d8a1531..6276b4c1acfe 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/clk/at91_pmc.h> | ||
14 | 15 | ||
15 | #include <asm/proc-fns.h> | 16 | #include <asm/proc-fns.h> |
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
@@ -19,7 +20,6 @@ | |||
19 | #include <asm/system_misc.h> | 20 | #include <asm/system_misc.h> |
20 | #include <mach/cpu.h> | 21 | #include <mach/cpu.h> |
21 | #include <mach/at91sam9261.h> | 22 | #include <mach/at91sam9261.h> |
22 | #include <mach/at91_pmc.h> | ||
23 | 23 | ||
24 | #include "at91_aic.h" | 24 | #include "at91_aic.h" |
25 | #include "at91_rstc.h" | 25 | #include "at91_rstc.h" |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 7eccb0fc57bc..37b90f4b990c 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/clk/at91_pmc.h> | ||
14 | 15 | ||
15 | #include <asm/proc-fns.h> | 16 | #include <asm/proc-fns.h> |
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
@@ -18,7 +19,6 @@ | |||
18 | #include <asm/mach/map.h> | 19 | #include <asm/mach/map.h> |
19 | #include <asm/system_misc.h> | 20 | #include <asm/system_misc.h> |
20 | #include <mach/at91sam9263.h> | 21 | #include <mach/at91sam9263.h> |
21 | #include <mach/at91_pmc.h> | ||
22 | 22 | ||
23 | #include "at91_aic.h" | 23 | #include "at91_aic.h" |
24 | #include "at91_rstc.h" | 24 | #include "at91_rstc.h" |
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c index bb392320a0dd..0f04ffe9c5a8 100644 --- a/arch/arm/mach-at91/at91sam926x_time.c +++ b/arch/arm/mach-at91/at91sam926x_time.c | |||
@@ -39,6 +39,7 @@ | |||
39 | static u32 pit_cycle; /* write-once */ | 39 | static u32 pit_cycle; /* write-once */ |
40 | static u32 pit_cnt; /* access only w/system irq blocked */ | 40 | static u32 pit_cnt; /* access only w/system irq blocked */ |
41 | static void __iomem *pit_base_addr __read_mostly; | 41 | static void __iomem *pit_base_addr __read_mostly; |
42 | static struct clk *mck; | ||
42 | 43 | ||
43 | static inline unsigned int pit_read(unsigned int reg_offset) | 44 | static inline unsigned int pit_read(unsigned int reg_offset) |
44 | { | 45 | { |
@@ -195,10 +196,14 @@ static int __init of_at91sam926x_pit_init(void) | |||
195 | if (!pit_base_addr) | 196 | if (!pit_base_addr) |
196 | goto node_err; | 197 | goto node_err; |
197 | 198 | ||
199 | mck = of_clk_get(np, 0); | ||
200 | |||
198 | /* Get the interrupts property */ | 201 | /* Get the interrupts property */ |
199 | ret = irq_of_parse_and_map(np, 0); | 202 | ret = irq_of_parse_and_map(np, 0); |
200 | if (!ret) { | 203 | if (!ret) { |
201 | pr_crit("AT91: PIT: Unable to get IRQ from DT\n"); | 204 | pr_crit("AT91: PIT: Unable to get IRQ from DT\n"); |
205 | if (!IS_ERR(mck)) | ||
206 | clk_put(mck); | ||
202 | goto ioremap_err; | 207 | goto ioremap_err; |
203 | } | 208 | } |
204 | at91sam926x_pit_irq.irq = ret; | 209 | at91sam926x_pit_irq.irq = ret; |
@@ -230,6 +235,8 @@ void __init at91sam926x_pit_init(void) | |||
230 | unsigned bits; | 235 | unsigned bits; |
231 | int ret; | 236 | int ret; |
232 | 237 | ||
238 | mck = ERR_PTR(-ENOENT); | ||
239 | |||
233 | /* For device tree enabled device: initialize here */ | 240 | /* For device tree enabled device: initialize here */ |
234 | of_at91sam926x_pit_init(); | 241 | of_at91sam926x_pit_init(); |
235 | 242 | ||
@@ -237,7 +244,12 @@ void __init at91sam926x_pit_init(void) | |||
237 | * Use our actual MCK to figure out how many MCK/16 ticks per | 244 | * Use our actual MCK to figure out how many MCK/16 ticks per |
238 | * 1/HZ period (instead of a compile-time constant LATCH). | 245 | * 1/HZ period (instead of a compile-time constant LATCH). |
239 | */ | 246 | */ |
240 | pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16; | 247 | if (IS_ERR(mck)) |
248 | mck = clk_get(NULL, "mck"); | ||
249 | |||
250 | if (IS_ERR(mck)) | ||
251 | panic("AT91: PIT: Unable to get mck clk\n"); | ||
252 | pit_rate = clk_get_rate(mck) / 16; | ||
241 | pit_cycle = (pit_rate + HZ/2) / HZ; | 253 | pit_cycle = (pit_rate + HZ/2) / HZ; |
242 | WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); | 254 | WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); |
243 | 255 | ||
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 9405aa08b104..2f455ce35268 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -12,13 +12,13 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/clk/at91_pmc.h> | ||
15 | 16 | ||
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
18 | #include <asm/mach/map.h> | 19 | #include <asm/mach/map.h> |
19 | #include <asm/system_misc.h> | 20 | #include <asm/system_misc.h> |
20 | #include <mach/at91sam9g45.h> | 21 | #include <mach/at91sam9g45.h> |
21 | #include <mach/at91_pmc.h> | ||
22 | #include <mach/cpu.h> | 22 | #include <mach/cpu.h> |
23 | 23 | ||
24 | #include "at91_aic.h" | 24 | #include "at91_aic.h" |
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index 388ec3aec4b9..4ef088c62eab 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c | |||
@@ -8,12 +8,12 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/dma-mapping.h> | 10 | #include <linux/dma-mapping.h> |
11 | #include <linux/clk/at91_pmc.h> | ||
11 | 12 | ||
12 | #include <asm/irq.h> | 13 | #include <asm/irq.h> |
13 | #include <asm/mach/arch.h> | 14 | #include <asm/mach/arch.h> |
14 | #include <asm/mach/map.h> | 15 | #include <asm/mach/map.h> |
15 | #include <mach/at91sam9n12.h> | 16 | #include <mach/at91sam9n12.h> |
16 | #include <mach/at91_pmc.h> | ||
17 | #include <mach/cpu.h> | 17 | #include <mach/cpu.h> |
18 | 18 | ||
19 | #include "board.h" | 19 | #include "board.h" |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index 0750ffb7e6b1..3651517abedf 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/clk/at91_pmc.h> | ||
13 | 14 | ||
14 | #include <asm/proc-fns.h> | 15 | #include <asm/proc-fns.h> |
15 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
@@ -19,7 +20,6 @@ | |||
19 | #include <mach/cpu.h> | 20 | #include <mach/cpu.h> |
20 | #include <mach/at91_dbgu.h> | 21 | #include <mach/at91_dbgu.h> |
21 | #include <mach/at91sam9rl.h> | 22 | #include <mach/at91sam9rl.h> |
22 | #include <mach/at91_pmc.h> | ||
23 | 23 | ||
24 | #include "at91_aic.h" | 24 | #include "at91_aic.h" |
25 | #include "at91_rstc.h" | 25 | #include "at91_rstc.h" |
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index e8a2e075a1b8..3e8ec26e39dc 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c | |||
@@ -8,12 +8,12 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/dma-mapping.h> | 10 | #include <linux/dma-mapping.h> |
11 | #include <linux/clk/at91_pmc.h> | ||
11 | 12 | ||
12 | #include <asm/irq.h> | 13 | #include <asm/irq.h> |
13 | #include <asm/mach/arch.h> | 14 | #include <asm/mach/arch.h> |
14 | #include <asm/mach/map.h> | 15 | #include <asm/mach/map.h> |
15 | #include <mach/at91sam9x5.h> | 16 | #include <mach/at91sam9x5.h> |
16 | #include <mach/at91_pmc.h> | ||
17 | #include <mach/cpu.h> | 17 | #include <mach/cpu.h> |
18 | 18 | ||
19 | #include "board.h" | 19 | #include "board.h" |
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c index bf00d15d954d..075ec0576ada 100644 --- a/arch/arm/mach-at91/board-dt-sama5.c +++ b/arch/arm/mach-at91/board-dt-sama5.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/of_irq.h> | 16 | #include <linux/of_irq.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #include <linux/phy.h> | 18 | #include <linux/phy.h> |
19 | #include <linux/clk-provider.h> | ||
19 | 20 | ||
20 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
21 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
@@ -26,6 +27,13 @@ | |||
26 | #include "at91_aic.h" | 27 | #include "at91_aic.h" |
27 | #include "generic.h" | 28 | #include "generic.h" |
28 | 29 | ||
30 | static void __init sama5_dt_timer_init(void) | ||
31 | { | ||
32 | #if defined(CONFIG_COMMON_CLK) | ||
33 | of_clk_init(NULL); | ||
34 | #endif | ||
35 | at91sam926x_pit_init(); | ||
36 | } | ||
29 | 37 | ||
30 | static const struct of_device_id irq_of_match[] __initconst = { | 38 | static const struct of_device_id irq_of_match[] __initconst = { |
31 | 39 | ||
@@ -72,7 +80,7 @@ static const char *sama5_dt_board_compat[] __initdata = { | |||
72 | 80 | ||
73 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") | 81 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") |
74 | /* Maintainer: Atmel */ | 82 | /* Maintainer: Atmel */ |
75 | .init_time = at91sam926x_pit_init, | 83 | .init_time = sama5_dt_timer_init, |
76 | .map_io = at91_map_io, | 84 | .map_io = at91_map_io, |
77 | .handle_irq = at91_aic5_handle_irq, | 85 | .handle_irq = at91_aic5_handle_irq, |
78 | .init_early = at91_dt_initialize, | 86 | .init_early = at91_dt_initialize, |
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c deleted file mode 100644 index aa3bc9b0f150..000000000000 --- a/arch/arm/mach-at91/board-qil-a9260.c +++ /dev/null | |||
@@ -1,266 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91/board-qil-a9260.c | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * Copyright (C) 2006 Atmel | ||
6 | * Copyright (C) 2007 Calao-systems | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/mm.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/spi/spi.h> | ||
30 | #include <linux/gpio_keys.h> | ||
31 | #include <linux/input.h> | ||
32 | #include <linux/clk.h> | ||
33 | |||
34 | #include <asm/setup.h> | ||
35 | #include <asm/mach-types.h> | ||
36 | #include <asm/irq.h> | ||
37 | |||
38 | #include <asm/mach/arch.h> | ||
39 | #include <asm/mach/map.h> | ||
40 | #include <asm/mach/irq.h> | ||
41 | |||
42 | #include <mach/hardware.h> | ||
43 | #include <mach/at91sam9_smc.h> | ||
44 | |||
45 | #include "at91_aic.h" | ||
46 | #include "at91_shdwc.h" | ||
47 | #include "board.h" | ||
48 | #include "sam9_smc.h" | ||
49 | #include "generic.h" | ||
50 | |||
51 | |||
52 | static void __init ek_init_early(void) | ||
53 | { | ||
54 | /* Initialize processor: 12.000 MHz crystal */ | ||
55 | at91_initialize(12000000); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * USB Host port | ||
60 | */ | ||
61 | static struct at91_usbh_data __initdata ek_usbh_data = { | ||
62 | .ports = 2, | ||
63 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
64 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | * USB Device port | ||
69 | */ | ||
70 | static struct at91_udc_data __initdata ek_udc_data = { | ||
71 | .vbus_pin = AT91_PIN_PC5, | ||
72 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * SPI devices. | ||
77 | */ | ||
78 | static struct spi_board_info ek_spi_devices[] = { | ||
79 | #if defined(CONFIG_RTC_DRV_M41T94) | ||
80 | { /* M41T94 RTC */ | ||
81 | .modalias = "m41t94", | ||
82 | .chip_select = 0, | ||
83 | .max_speed_hz = 1 * 1000 * 1000, | ||
84 | .bus_num = 0, | ||
85 | } | ||
86 | #endif | ||
87 | }; | ||
88 | |||
89 | /* | ||
90 | * MACB Ethernet device | ||
91 | */ | ||
92 | static struct macb_platform_data __initdata ek_macb_data = { | ||
93 | .phy_irq_pin = AT91_PIN_PA31, | ||
94 | .is_rmii = 1, | ||
95 | }; | ||
96 | |||
97 | /* | ||
98 | * NAND flash | ||
99 | */ | ||
100 | static struct mtd_partition __initdata ek_nand_partition[] = { | ||
101 | { | ||
102 | .name = "Uboot & Kernel", | ||
103 | .offset = 0, | ||
104 | .size = SZ_16M, | ||
105 | }, | ||
106 | { | ||
107 | .name = "Root FS", | ||
108 | .offset = MTDPART_OFS_NXTBLK, | ||
109 | .size = 120 * SZ_1M, | ||
110 | }, | ||
111 | { | ||
112 | .name = "FS", | ||
113 | .offset = MTDPART_OFS_NXTBLK, | ||
114 | .size = 120 * SZ_1M, | ||
115 | }, | ||
116 | }; | ||
117 | |||
118 | static struct atmel_nand_data __initdata ek_nand_data = { | ||
119 | .ale = 21, | ||
120 | .cle = 22, | ||
121 | .det_pin = -EINVAL, | ||
122 | .rdy_pin = AT91_PIN_PC13, | ||
123 | .enable_pin = AT91_PIN_PC14, | ||
124 | .ecc_mode = NAND_ECC_SOFT, | ||
125 | .on_flash_bbt = 1, | ||
126 | .parts = ek_nand_partition, | ||
127 | .num_parts = ARRAY_SIZE(ek_nand_partition), | ||
128 | }; | ||
129 | |||
130 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
131 | .ncs_read_setup = 0, | ||
132 | .nrd_setup = 1, | ||
133 | .ncs_write_setup = 0, | ||
134 | .nwe_setup = 1, | ||
135 | |||
136 | .ncs_read_pulse = 3, | ||
137 | .nrd_pulse = 3, | ||
138 | .ncs_write_pulse = 3, | ||
139 | .nwe_pulse = 3, | ||
140 | |||
141 | .read_cycle = 5, | ||
142 | .write_cycle = 5, | ||
143 | |||
144 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
145 | .tdf_cycles = 2, | ||
146 | }; | ||
147 | |||
148 | static void __init ek_add_device_nand(void) | ||
149 | { | ||
150 | /* configure chip-select 3 (NAND) */ | ||
151 | sam9_smc_configure(0, 3, &ek_nand_smc_config); | ||
152 | |||
153 | at91_add_device_nand(&ek_nand_data); | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | * MCI (SD/MMC) | ||
158 | */ | ||
159 | static struct mci_platform_data __initdata ek_mci0_data = { | ||
160 | .slot[0] = { | ||
161 | .bus_width = 4, | ||
162 | .detect_pin = -EINVAL, | ||
163 | .wp_pin = -EINVAL, | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | /* | ||
168 | * GPIO Buttons | ||
169 | */ | ||
170 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
171 | static struct gpio_keys_button ek_buttons[] = { | ||
172 | { /* USER PUSH BUTTON */ | ||
173 | .code = KEY_ENTER, | ||
174 | .gpio = AT91_PIN_PB10, | ||
175 | .active_low = 1, | ||
176 | .desc = "user_pb", | ||
177 | .wakeup = 1, | ||
178 | } | ||
179 | }; | ||
180 | |||
181 | static struct gpio_keys_platform_data ek_button_data = { | ||
182 | .buttons = ek_buttons, | ||
183 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
184 | }; | ||
185 | |||
186 | static struct platform_device ek_button_device = { | ||
187 | .name = "gpio-keys", | ||
188 | .id = -1, | ||
189 | .num_resources = 0, | ||
190 | .dev = { | ||
191 | .platform_data = &ek_button_data, | ||
192 | } | ||
193 | }; | ||
194 | |||
195 | static void __init ek_add_device_buttons(void) | ||
196 | { | ||
197 | at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */ | ||
198 | at91_set_deglitch(AT91_PIN_PB10, 1); | ||
199 | |||
200 | platform_device_register(&ek_button_device); | ||
201 | } | ||
202 | #else | ||
203 | static void __init ek_add_device_buttons(void) {} | ||
204 | #endif | ||
205 | |||
206 | /* | ||
207 | * LEDs | ||
208 | */ | ||
209 | static struct gpio_led ek_leds[] = { | ||
210 | { /* user_led (green) */ | ||
211 | .name = "user_led", | ||
212 | .gpio = AT91_PIN_PB21, | ||
213 | .active_low = 0, | ||
214 | .default_trigger = "heartbeat", | ||
215 | } | ||
216 | }; | ||
217 | |||
218 | static void __init ek_board_init(void) | ||
219 | { | ||
220 | /* Serial */ | ||
221 | /* DBGU on ttyS0. (Rx & Tx only) */ | ||
222 | at91_register_uart(0, 0, 0); | ||
223 | |||
224 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | ||
225 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ||
226 | | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD | ||
227 | | ATMEL_UART_RI); | ||
228 | |||
229 | /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */ | ||
230 | at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); | ||
231 | |||
232 | /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */ | ||
233 | at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS); | ||
234 | at91_add_device_serial(); | ||
235 | /* USB Host */ | ||
236 | at91_add_device_usbh(&ek_usbh_data); | ||
237 | /* USB Device */ | ||
238 | at91_add_device_udc(&ek_udc_data); | ||
239 | /* SPI */ | ||
240 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | ||
241 | /* NAND */ | ||
242 | ek_add_device_nand(); | ||
243 | /* I2C */ | ||
244 | at91_add_device_i2c(NULL, 0); | ||
245 | /* Ethernet */ | ||
246 | at91_add_device_eth(&ek_macb_data); | ||
247 | /* MMC */ | ||
248 | at91_add_device_mci(0, &ek_mci0_data); | ||
249 | /* Push Buttons */ | ||
250 | ek_add_device_buttons(); | ||
251 | /* LEDs */ | ||
252 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
253 | /* shutdown controller, wakeup button (5 msec low) */ | ||
254 | at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW | ||
255 | | AT91_SHDW_RTTWKEN); | ||
256 | } | ||
257 | |||
258 | MACHINE_START(QIL_A9260, "CALAO QIL_A9260") | ||
259 | /* Maintainer: calao-systems */ | ||
260 | .init_time = at91sam926x_pit_init, | ||
261 | .map_io = at91_map_io, | ||
262 | .handle_irq = at91_aic_handle_irq, | ||
263 | .init_early = ek_init_early, | ||
264 | .init_irq = at91_init_irq_default, | ||
265 | .init_machine = ek_board_init, | ||
266 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 6b2630a92f71..034529d801b2 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -24,9 +24,9 @@ | |||
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/of_address.h> | 26 | #include <linux/of_address.h> |
27 | #include <linux/clk/at91_pmc.h> | ||
27 | 28 | ||
28 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
29 | #include <mach/at91_pmc.h> | ||
30 | #include <mach/cpu.h> | 30 | #include <mach/cpu.h> |
31 | 31 | ||
32 | #include <asm/proc-fns.h> | 32 | #include <asm/proc-fns.h> |
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate); | |||
330 | 330 | ||
331 | /*------------------------------------------------------------------------*/ | 331 | /*------------------------------------------------------------------------*/ |
332 | 332 | ||
333 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS | ||
334 | |||
335 | /* | 333 | /* |
336 | * For now, only the programmable clocks support reparenting (MCK could | 334 | * For now, only the programmable clocks support reparenting (MCK could |
337 | * do this too, with care) or rate changing (the PLLs could do this too, | 335 | * do this too, with care) or rate changing (the PLLs could do this too, |
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk) | |||
459 | clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); | 457 | clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); |
460 | } | 458 | } |
461 | 459 | ||
462 | #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ | ||
463 | |||
464 | /*------------------------------------------------------------------------*/ | 460 | /*------------------------------------------------------------------------*/ |
465 | 461 | ||
466 | #ifdef CONFIG_DEBUG_FS | 462 | #ifdef CONFIG_DEBUG_FS |
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk) | |||
577 | clk->parent = &mck; | 573 | clk->parent = &mck; |
578 | clk->mode = pmc_sys_mode; | 574 | clk->mode = pmc_sys_mode; |
579 | } | 575 | } |
580 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS | ||
581 | else if (clk_is_programmable(clk)) { | 576 | else if (clk_is_programmable(clk)) { |
582 | clk->mode = pmc_sys_mode; | 577 | clk->mode = pmc_sys_mode; |
583 | init_programmable_clock(clk); | 578 | init_programmable_clock(clk); |
584 | } | 579 | } |
585 | #endif | ||
586 | 580 | ||
587 | at91_clk_add(clk); | 581 | at91_clk_add(clk); |
588 | 582 | ||
@@ -884,6 +878,11 @@ static int __init at91_pmc_init(unsigned long main_clock) | |||
884 | #if defined(CONFIG_OF) | 878 | #if defined(CONFIG_OF) |
885 | static struct of_device_id pmc_ids[] = { | 879 | static struct of_device_id pmc_ids[] = { |
886 | { .compatible = "atmel,at91rm9200-pmc" }, | 880 | { .compatible = "atmel,at91rm9200-pmc" }, |
881 | { .compatible = "atmel,at91sam9260-pmc" }, | ||
882 | { .compatible = "atmel,at91sam9g45-pmc" }, | ||
883 | { .compatible = "atmel,at91sam9n12-pmc" }, | ||
884 | { .compatible = "atmel,at91sam9x5-pmc" }, | ||
885 | { .compatible = "atmel,sama5d3-pmc" }, | ||
887 | { /*sentinel*/ } | 886 | { /*sentinel*/ } |
888 | }; | 887 | }; |
889 | 888 | ||
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 26dee3ce9397..631fa3b8c16d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -46,11 +46,12 @@ extern void at91sam926x_pit_init(void); | |||
46 | extern void at91x40_timer_init(void); | 46 | extern void at91x40_timer_init(void); |
47 | 47 | ||
48 | /* Clocks */ | 48 | /* Clocks */ |
49 | #ifdef CONFIG_AT91_PMC_UNIT | 49 | #ifdef CONFIG_OLD_CLK_AT91 |
50 | extern int __init at91_clock_init(unsigned long main_clock); | 50 | extern int __init at91_clock_init(unsigned long main_clock); |
51 | extern int __init at91_dt_clock_init(void); | 51 | extern int __init at91_dt_clock_init(void); |
52 | #else | 52 | #else |
53 | static int inline at91_clock_init(unsigned long main_clock) { return 0; } | 53 | static int inline at91_clock_init(unsigned long main_clock) { return 0; } |
54 | static int inline at91_dt_clock_init(void) { return 0; } | ||
54 | #endif | 55 | #endif |
55 | struct device; | 56 | struct device; |
56 | 57 | ||
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 9986542e8060..590b52dea9f7 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -19,13 +19,13 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/clk/at91_pmc.h> | ||
22 | 23 | ||
23 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
24 | #include <linux/atomic.h> | 25 | #include <linux/atomic.h> |
25 | #include <asm/mach/time.h> | 26 | #include <asm/mach/time.h> |
26 | #include <asm/mach/irq.h> | 27 | #include <asm/mach/irq.h> |
27 | 28 | ||
28 | #include <mach/at91_pmc.h> | ||
29 | #include <mach/cpu.h> | 29 | #include <mach/cpu.h> |
30 | 30 | ||
31 | #include "at91_aic.h" | 31 | #include "at91_aic.h" |
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void) | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS)) | ||
159 | return 1; | ||
160 | |||
161 | /* PCK0..PCK3 must be disabled, or configured to use clk32k */ | 158 | /* PCK0..PCK3 must be disabled, or configured to use clk32k */ |
162 | for (i = 0; i < 4; i++) { | 159 | for (i = 0; i < 4; i++) { |
163 | u32 css; | 160 | u32 css; |
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S index 098c28ddf025..20018779bae7 100644 --- a/arch/arm/mach-at91/pm_slowclock.S +++ b/arch/arm/mach-at91/pm_slowclock.S | |||
@@ -13,8 +13,8 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/clk/at91_pmc.h> | ||
16 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
17 | #include <mach/at91_pmc.h> | ||
18 | #include <mach/at91_ramc.h> | 18 | #include <mach/at91_ramc.h> |
19 | 19 | ||
20 | 20 | ||
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c index a28873fe3049..3d775d08de08 100644 --- a/arch/arm/mach-at91/sama5d3.c +++ b/arch/arm/mach-at91/sama5d3.c | |||
@@ -9,360 +9,19 @@ | |||
9 | 9 | ||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/dma-mapping.h> | 11 | #include <linux/dma-mapping.h> |
12 | #include <linux/clk/at91_pmc.h> | ||
12 | 13 | ||
13 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
14 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
15 | #include <asm/mach/map.h> | 16 | #include <asm/mach/map.h> |
16 | #include <mach/sama5d3.h> | 17 | #include <mach/sama5d3.h> |
17 | #include <mach/at91_pmc.h> | ||
18 | #include <mach/cpu.h> | 18 | #include <mach/cpu.h> |
19 | 19 | ||
20 | #include "soc.h" | 20 | #include "soc.h" |
21 | #include "generic.h" | 21 | #include "generic.h" |
22 | #include "clock.h" | ||
23 | #include "sam9_smc.h" | 22 | #include "sam9_smc.h" |
24 | 23 | ||
25 | /* -------------------------------------------------------------------- | 24 | /* -------------------------------------------------------------------- |
26 | * Clocks | ||
27 | * -------------------------------------------------------------------- */ | ||
28 | |||
29 | /* | ||
30 | * The peripheral clocks. | ||
31 | */ | ||
32 | |||
33 | static struct clk pioA_clk = { | ||
34 | .name = "pioA_clk", | ||
35 | .pid = SAMA5D3_ID_PIOA, | ||
36 | .type = CLK_TYPE_PERIPHERAL, | ||
37 | }; | ||
38 | static struct clk pioB_clk = { | ||
39 | .name = "pioB_clk", | ||
40 | .pid = SAMA5D3_ID_PIOB, | ||
41 | .type = CLK_TYPE_PERIPHERAL, | ||
42 | }; | ||
43 | static struct clk pioC_clk = { | ||
44 | .name = "pioC_clk", | ||
45 | .pid = SAMA5D3_ID_PIOC, | ||
46 | .type = CLK_TYPE_PERIPHERAL, | ||
47 | }; | ||
48 | static struct clk pioD_clk = { | ||
49 | .name = "pioD_clk", | ||
50 | .pid = SAMA5D3_ID_PIOD, | ||
51 | .type = CLK_TYPE_PERIPHERAL, | ||
52 | }; | ||
53 | static struct clk pioE_clk = { | ||
54 | .name = "pioE_clk", | ||
55 | .pid = SAMA5D3_ID_PIOE, | ||
56 | .type = CLK_TYPE_PERIPHERAL, | ||
57 | }; | ||
58 | static struct clk usart0_clk = { | ||
59 | .name = "usart0_clk", | ||
60 | .pid = SAMA5D3_ID_USART0, | ||
61 | .type = CLK_TYPE_PERIPHERAL, | ||
62 | .div = AT91_PMC_PCR_DIV2, | ||
63 | }; | ||
64 | static struct clk usart1_clk = { | ||
65 | .name = "usart1_clk", | ||
66 | .pid = SAMA5D3_ID_USART1, | ||
67 | .type = CLK_TYPE_PERIPHERAL, | ||
68 | .div = AT91_PMC_PCR_DIV2, | ||
69 | }; | ||
70 | static struct clk usart2_clk = { | ||
71 | .name = "usart2_clk", | ||
72 | .pid = SAMA5D3_ID_USART2, | ||
73 | .type = CLK_TYPE_PERIPHERAL, | ||
74 | .div = AT91_PMC_PCR_DIV2, | ||
75 | }; | ||
76 | static struct clk usart3_clk = { | ||
77 | .name = "usart3_clk", | ||
78 | .pid = SAMA5D3_ID_USART3, | ||
79 | .type = CLK_TYPE_PERIPHERAL, | ||
80 | .div = AT91_PMC_PCR_DIV2, | ||
81 | }; | ||
82 | static struct clk uart0_clk = { | ||
83 | .name = "uart0_clk", | ||
84 | .pid = SAMA5D3_ID_UART0, | ||
85 | .type = CLK_TYPE_PERIPHERAL, | ||
86 | .div = AT91_PMC_PCR_DIV2, | ||
87 | }; | ||
88 | static struct clk uart1_clk = { | ||
89 | .name = "uart1_clk", | ||
90 | .pid = SAMA5D3_ID_UART1, | ||
91 | .type = CLK_TYPE_PERIPHERAL, | ||
92 | .div = AT91_PMC_PCR_DIV2, | ||
93 | }; | ||
94 | static struct clk twi0_clk = { | ||
95 | .name = "twi0_clk", | ||
96 | .pid = SAMA5D3_ID_TWI0, | ||
97 | .type = CLK_TYPE_PERIPHERAL, | ||
98 | .div = AT91_PMC_PCR_DIV8, | ||
99 | }; | ||
100 | static struct clk twi1_clk = { | ||
101 | .name = "twi1_clk", | ||
102 | .pid = SAMA5D3_ID_TWI1, | ||
103 | .type = CLK_TYPE_PERIPHERAL, | ||
104 | .div = AT91_PMC_PCR_DIV8, | ||
105 | }; | ||
106 | static struct clk twi2_clk = { | ||
107 | .name = "twi2_clk", | ||
108 | .pid = SAMA5D3_ID_TWI2, | ||
109 | .type = CLK_TYPE_PERIPHERAL, | ||
110 | .div = AT91_PMC_PCR_DIV8, | ||
111 | }; | ||
112 | static struct clk mmc0_clk = { | ||
113 | .name = "mci0_clk", | ||
114 | .pid = SAMA5D3_ID_HSMCI0, | ||
115 | .type = CLK_TYPE_PERIPHERAL, | ||
116 | }; | ||
117 | static struct clk mmc1_clk = { | ||
118 | .name = "mci1_clk", | ||
119 | .pid = SAMA5D3_ID_HSMCI1, | ||
120 | .type = CLK_TYPE_PERIPHERAL, | ||
121 | }; | ||
122 | static struct clk mmc2_clk = { | ||
123 | .name = "mci2_clk", | ||
124 | .pid = SAMA5D3_ID_HSMCI2, | ||
125 | .type = CLK_TYPE_PERIPHERAL, | ||
126 | }; | ||
127 | static struct clk spi0_clk = { | ||
128 | .name = "spi0_clk", | ||
129 | .pid = SAMA5D3_ID_SPI0, | ||
130 | .type = CLK_TYPE_PERIPHERAL, | ||
131 | }; | ||
132 | static struct clk spi1_clk = { | ||
133 | .name = "spi1_clk", | ||
134 | .pid = SAMA5D3_ID_SPI1, | ||
135 | .type = CLK_TYPE_PERIPHERAL, | ||
136 | }; | ||
137 | static struct clk tcb0_clk = { | ||
138 | .name = "tcb0_clk", | ||
139 | .pid = SAMA5D3_ID_TC0, | ||
140 | .type = CLK_TYPE_PERIPHERAL, | ||
141 | .div = AT91_PMC_PCR_DIV2, | ||
142 | }; | ||
143 | static struct clk tcb1_clk = { | ||
144 | .name = "tcb1_clk", | ||
145 | .pid = SAMA5D3_ID_TC1, | ||
146 | .type = CLK_TYPE_PERIPHERAL, | ||
147 | .div = AT91_PMC_PCR_DIV2, | ||
148 | }; | ||
149 | static struct clk adc_clk = { | ||
150 | .name = "adc_clk", | ||
151 | .pid = SAMA5D3_ID_ADC, | ||
152 | .type = CLK_TYPE_PERIPHERAL, | ||
153 | .div = AT91_PMC_PCR_DIV2, | ||
154 | }; | ||
155 | static struct clk adc_op_clk = { | ||
156 | .name = "adc_op_clk", | ||
157 | .type = CLK_TYPE_PERIPHERAL, | ||
158 | .rate_hz = 5000000, | ||
159 | }; | ||
160 | static struct clk dma0_clk = { | ||
161 | .name = "dma0_clk", | ||
162 | .pid = SAMA5D3_ID_DMA0, | ||
163 | .type = CLK_TYPE_PERIPHERAL, | ||
164 | }; | ||
165 | static struct clk dma1_clk = { | ||
166 | .name = "dma1_clk", | ||
167 | .pid = SAMA5D3_ID_DMA1, | ||
168 | .type = CLK_TYPE_PERIPHERAL, | ||
169 | }; | ||
170 | static struct clk uhphs_clk = { | ||
171 | .name = "uhphs", | ||
172 | .pid = SAMA5D3_ID_UHPHS, | ||
173 | .type = CLK_TYPE_PERIPHERAL, | ||
174 | }; | ||
175 | static struct clk udphs_clk = { | ||
176 | .name = "udphs_clk", | ||
177 | .pid = SAMA5D3_ID_UDPHS, | ||
178 | .type = CLK_TYPE_PERIPHERAL, | ||
179 | }; | ||
180 | /* gmac only for sama5d33, sama5d34, sama5d35 */ | ||
181 | static struct clk macb0_clk = { | ||
182 | .name = "macb0_clk", | ||
183 | .pid = SAMA5D3_ID_GMAC, | ||
184 | .type = CLK_TYPE_PERIPHERAL, | ||
185 | }; | ||
186 | /* emac only for sama5d31, sama5d35 */ | ||
187 | static struct clk macb1_clk = { | ||
188 | .name = "macb1_clk", | ||
189 | .pid = SAMA5D3_ID_EMAC, | ||
190 | .type = CLK_TYPE_PERIPHERAL, | ||
191 | }; | ||
192 | /* lcd only for sama5d31, sama5d33, sama5d34 */ | ||
193 | static struct clk lcdc_clk = { | ||
194 | .name = "lcdc_clk", | ||
195 | .pid = SAMA5D3_ID_LCDC, | ||
196 | .type = CLK_TYPE_PERIPHERAL, | ||
197 | }; | ||
198 | /* isi only for sama5d33, sama5d35 */ | ||
199 | static struct clk isi_clk = { | ||
200 | .name = "isi_clk", | ||
201 | .pid = SAMA5D3_ID_ISI, | ||
202 | .type = CLK_TYPE_PERIPHERAL, | ||
203 | }; | ||
204 | static struct clk can0_clk = { | ||
205 | .name = "can0_clk", | ||
206 | .pid = SAMA5D3_ID_CAN0, | ||
207 | .type = CLK_TYPE_PERIPHERAL, | ||
208 | .div = AT91_PMC_PCR_DIV2, | ||
209 | }; | ||
210 | static struct clk can1_clk = { | ||
211 | .name = "can1_clk", | ||
212 | .pid = SAMA5D3_ID_CAN1, | ||
213 | .type = CLK_TYPE_PERIPHERAL, | ||
214 | .div = AT91_PMC_PCR_DIV2, | ||
215 | }; | ||
216 | static struct clk ssc0_clk = { | ||
217 | .name = "ssc0_clk", | ||
218 | .pid = SAMA5D3_ID_SSC0, | ||
219 | .type = CLK_TYPE_PERIPHERAL, | ||
220 | .div = AT91_PMC_PCR_DIV2, | ||
221 | }; | ||
222 | static struct clk ssc1_clk = { | ||
223 | .name = "ssc1_clk", | ||
224 | .pid = SAMA5D3_ID_SSC1, | ||
225 | .type = CLK_TYPE_PERIPHERAL, | ||
226 | .div = AT91_PMC_PCR_DIV2, | ||
227 | }; | ||
228 | static struct clk sha_clk = { | ||
229 | .name = "sha_clk", | ||
230 | .pid = SAMA5D3_ID_SHA, | ||
231 | .type = CLK_TYPE_PERIPHERAL, | ||
232 | .div = AT91_PMC_PCR_DIV8, | ||
233 | }; | ||
234 | static struct clk aes_clk = { | ||
235 | .name = "aes_clk", | ||
236 | .pid = SAMA5D3_ID_AES, | ||
237 | .type = CLK_TYPE_PERIPHERAL, | ||
238 | }; | ||
239 | static struct clk tdes_clk = { | ||
240 | .name = "tdes_clk", | ||
241 | .pid = SAMA5D3_ID_TDES, | ||
242 | .type = CLK_TYPE_PERIPHERAL, | ||
243 | }; | ||
244 | |||
245 | static struct clk *periph_clocks[] __initdata = { | ||
246 | &pioA_clk, | ||
247 | &pioB_clk, | ||
248 | &pioC_clk, | ||
249 | &pioD_clk, | ||
250 | &pioE_clk, | ||
251 | &usart0_clk, | ||
252 | &usart1_clk, | ||
253 | &usart2_clk, | ||
254 | &usart3_clk, | ||
255 | &uart0_clk, | ||
256 | &uart1_clk, | ||
257 | &twi0_clk, | ||
258 | &twi1_clk, | ||
259 | &twi2_clk, | ||
260 | &mmc0_clk, | ||
261 | &mmc1_clk, | ||
262 | &mmc2_clk, | ||
263 | &spi0_clk, | ||
264 | &spi1_clk, | ||
265 | &tcb0_clk, | ||
266 | &tcb1_clk, | ||
267 | &adc_clk, | ||
268 | &adc_op_clk, | ||
269 | &dma0_clk, | ||
270 | &dma1_clk, | ||
271 | &uhphs_clk, | ||
272 | &udphs_clk, | ||
273 | &macb0_clk, | ||
274 | &macb1_clk, | ||
275 | &lcdc_clk, | ||
276 | &isi_clk, | ||
277 | &can0_clk, | ||
278 | &can1_clk, | ||
279 | &ssc0_clk, | ||
280 | &ssc1_clk, | ||
281 | &sha_clk, | ||
282 | &aes_clk, | ||
283 | &tdes_clk, | ||
284 | }; | ||
285 | |||
286 | static struct clk pck0 = { | ||
287 | .name = "pck0", | ||
288 | .pmc_mask = AT91_PMC_PCK0, | ||
289 | .type = CLK_TYPE_PROGRAMMABLE, | ||
290 | .id = 0, | ||
291 | }; | ||
292 | |||
293 | static struct clk pck1 = { | ||
294 | .name = "pck1", | ||
295 | .pmc_mask = AT91_PMC_PCK1, | ||
296 | .type = CLK_TYPE_PROGRAMMABLE, | ||
297 | .id = 1, | ||
298 | }; | ||
299 | |||
300 | static struct clk pck2 = { | ||
301 | .name = "pck2", | ||
302 | .pmc_mask = AT91_PMC_PCK2, | ||
303 | .type = CLK_TYPE_PROGRAMMABLE, | ||
304 | .id = 2, | ||
305 | }; | ||
306 | |||
307 | static struct clk_lookup periph_clocks_lookups[] = { | ||
308 | /* lookup table for DT entries */ | ||
309 | CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), | ||
310 | CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk), | ||
311 | CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk), | ||
312 | CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk), | ||
313 | CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk), | ||
314 | CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk), | ||
315 | CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk), | ||
316 | CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk), | ||
317 | CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk), | ||
318 | CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk), | ||
319 | CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk), | ||
320 | CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk), | ||
321 | CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk), | ||
322 | CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk), | ||
323 | CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk), | ||
324 | CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk), | ||
325 | CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk), | ||
326 | CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk), | ||
327 | CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk), | ||
328 | CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk), | ||
329 | CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk), | ||
330 | CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk), | ||
331 | CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk), | ||
332 | CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk), | ||
333 | CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk), | ||
334 | CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk), | ||
335 | CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk), | ||
336 | CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk), | ||
337 | CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk), | ||
338 | CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk), | ||
339 | CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk), | ||
340 | CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk), | ||
341 | CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk), | ||
342 | CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk), | ||
343 | CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk), | ||
344 | CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk), | ||
345 | CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk), | ||
346 | CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk), | ||
347 | CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk), | ||
348 | }; | ||
349 | |||
350 | static void __init sama5d3_register_clocks(void) | ||
351 | { | ||
352 | int i; | ||
353 | |||
354 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) | ||
355 | clk_register(periph_clocks[i]); | ||
356 | |||
357 | clkdev_add_table(periph_clocks_lookups, | ||
358 | ARRAY_SIZE(periph_clocks_lookups)); | ||
359 | |||
360 | clk_register(&pck0); | ||
361 | clk_register(&pck1); | ||
362 | clk_register(&pck2); | ||
363 | } | ||
364 | |||
365 | /* -------------------------------------------------------------------- | ||
366 | * AT91SAM9x5 processor initialization | 25 | * AT91SAM9x5 processor initialization |
367 | * -------------------------------------------------------------------- */ | 26 | * -------------------------------------------------------------------- */ |
368 | 27 | ||
@@ -378,6 +37,5 @@ static void __init sama5d3_initialize(void) | |||
378 | 37 | ||
379 | AT91_SOC_START(sama5d3) | 38 | AT91_SOC_START(sama5d3) |
380 | .map_io = sama5d3_map_io, | 39 | .map_io = sama5d3_map_io, |
381 | .register_clocks = sama5d3_register_clocks, | ||
382 | .init = sama5d3_initialize, | 40 | .init = sama5d3_initialize, |
383 | AT91_SOC_END | 41 | AT91_SOC_END |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 2742e00ec5d6..9dc8894c5623 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/pm.h> | 11 | #include <linux/pm.h> |
12 | #include <linux/of_address.h> | 12 | #include <linux/of_address.h> |
13 | #include <linux/pinctrl/machine.h> | 13 | #include <linux/pinctrl/machine.h> |
14 | #include <linux/clk/at91_pmc.h> | ||
14 | 15 | ||
15 | #include <asm/system_misc.h> | 16 | #include <asm/system_misc.h> |
16 | #include <asm/mach/map.h> | 17 | #include <asm/mach/map.h> |
@@ -18,7 +19,6 @@ | |||
18 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
19 | #include <mach/cpu.h> | 20 | #include <mach/cpu.h> |
20 | #include <mach/at91_dbgu.h> | 21 | #include <mach/at91_dbgu.h> |
21 | #include <mach/at91_pmc.h> | ||
22 | 22 | ||
23 | #include "at91_shdwc.h" | 23 | #include "at91_shdwc.h" |
24 | #include "soc.h" | 24 | #include "soc.h" |
@@ -491,7 +491,8 @@ void __init at91rm9200_dt_initialize(void) | |||
491 | at91_dt_clock_init(); | 491 | at91_dt_clock_init(); |
492 | 492 | ||
493 | /* Register the processor-specific clocks */ | 493 | /* Register the processor-specific clocks */ |
494 | at91_boot_soc.register_clocks(); | 494 | if (at91_boot_soc.register_clocks) |
495 | at91_boot_soc.register_clocks(); | ||
495 | 496 | ||
496 | at91_boot_soc.init(); | 497 | at91_boot_soc.init(); |
497 | } | 498 | } |
@@ -506,7 +507,8 @@ void __init at91_dt_initialize(void) | |||
506 | at91_dt_clock_init(); | 507 | at91_dt_clock_init(); |
507 | 508 | ||
508 | /* Register the processor-specific clocks */ | 509 | /* Register the processor-specific clocks */ |
509 | at91_boot_soc.register_clocks(); | 510 | if (at91_boot_soc.register_clocks) |
511 | at91_boot_soc.register_clocks(); | ||
510 | 512 | ||
511 | if (at91_boot_soc.init) | 513 | if (at91_boot_soc.init) |
512 | at91_boot_soc.init(); | 514 | at91_boot_soc.init(); |
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index c122bcff9f7c..0d1a89298ece 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -162,7 +162,7 @@ void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) | |||
162 | /***************************************************************************** | 162 | /***************************************************************************** |
163 | * SoC RTC | 163 | * SoC RTC |
164 | ****************************************************************************/ | 164 | ****************************************************************************/ |
165 | void __init dove_rtc_init(void) | 165 | static void __init dove_rtc_init(void) |
166 | { | 166 | { |
167 | orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC); | 167 | orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC); |
168 | } | 168 | } |
@@ -257,18 +257,9 @@ void __init dove_timer_init(void) | |||
257 | } | 257 | } |
258 | 258 | ||
259 | /***************************************************************************** | 259 | /***************************************************************************** |
260 | * Cryptographic Engines and Security Accelerator (CESA) | ||
261 | ****************************************************************************/ | ||
262 | void __init dove_crypto_init(void) | ||
263 | { | ||
264 | orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE, | ||
265 | DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO); | ||
266 | } | ||
267 | |||
268 | /***************************************************************************** | ||
269 | * XOR 0 | 260 | * XOR 0 |
270 | ****************************************************************************/ | 261 | ****************************************************************************/ |
271 | void __init dove_xor0_init(void) | 262 | static void __init dove_xor0_init(void) |
272 | { | 263 | { |
273 | orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE, | 264 | orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE, |
274 | IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01); | 265 | IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01); |
@@ -277,7 +268,7 @@ void __init dove_xor0_init(void) | |||
277 | /***************************************************************************** | 268 | /***************************************************************************** |
278 | * XOR 1 | 269 | * XOR 1 |
279 | ****************************************************************************/ | 270 | ****************************************************************************/ |
280 | void __init dove_xor1_init(void) | 271 | static void __init dove_xor1_init(void) |
281 | { | 272 | { |
282 | orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE, | 273 | orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE, |
283 | IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11); | 274 | IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11); |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index f9d67a0acb2a..4c414af75ef0 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -24,6 +24,7 @@ config ARCH_EXYNOS4 | |||
24 | select HAVE_SMP | 24 | select HAVE_SMP |
25 | select MIGHT_HAVE_CACHE_L2X0 | 25 | select MIGHT_HAVE_CACHE_L2X0 |
26 | select PINCTRL | 26 | select PINCTRL |
27 | select PM_GENERIC_DOMAINS if PM | ||
27 | select S5P_DEV_MFC | 28 | select S5P_DEV_MFC |
28 | help | 29 | help |
29 | Samsung EXYNOS4 SoCs based systems | 30 | Samsung EXYNOS4 SoCs based systems |
@@ -48,7 +49,6 @@ config CPU_EXYNOS4210 | |||
48 | select ARCH_HAS_BANDGAP | 49 | select ARCH_HAS_BANDGAP |
49 | select ARM_CPU_SUSPEND if PM | 50 | select ARM_CPU_SUSPEND if PM |
50 | select PINCTRL_EXYNOS | 51 | select PINCTRL_EXYNOS |
51 | select PM_GENERIC_DOMAINS if PM | ||
52 | select S5P_PM if PM | 52 | select S5P_PM if PM |
53 | select S5P_SLEEP if PM | 53 | select S5P_SLEEP if PM |
54 | select SAMSUNG_DMADEV | 54 | select SAMSUNG_DMADEV |
@@ -61,7 +61,6 @@ config SOC_EXYNOS4212 | |||
61 | depends on ARCH_EXYNOS4 | 61 | depends on ARCH_EXYNOS4 |
62 | select ARCH_HAS_BANDGAP | 62 | select ARCH_HAS_BANDGAP |
63 | select PINCTRL_EXYNOS | 63 | select PINCTRL_EXYNOS |
64 | select PM_GENERIC_DOMAINS if PM | ||
65 | select S5P_PM if PM | 64 | select S5P_PM if PM |
66 | select S5P_SLEEP if PM | 65 | select S5P_SLEEP if PM |
67 | select SAMSUNG_DMADEV | 66 | select SAMSUNG_DMADEV |
@@ -74,7 +73,6 @@ config SOC_EXYNOS4412 | |||
74 | depends on ARCH_EXYNOS4 | 73 | depends on ARCH_EXYNOS4 |
75 | select ARCH_HAS_BANDGAP | 74 | select ARCH_HAS_BANDGAP |
76 | select PINCTRL_EXYNOS | 75 | select PINCTRL_EXYNOS |
77 | select PM_GENERIC_DOMAINS if PM | ||
78 | select SAMSUNG_DMADEV | 76 | select SAMSUNG_DMADEV |
79 | help | 77 | help |
80 | Enable EXYNOS4412 SoC support | 78 | Enable EXYNOS4412 SoC support |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 61d2906ccefb..72ae5d3a87d2 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/of_fdt.h> | 24 | #include <linux/of_fdt.h> |
25 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
26 | #include <linux/pm_domain.h> | ||
26 | #include <linux/export.h> | 27 | #include <linux/export.h> |
27 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
28 | #include <linux/of_address.h> | 29 | #include <linux/of_address.h> |
@@ -37,14 +38,13 @@ | |||
37 | #include <asm/mach/irq.h> | 38 | #include <asm/mach/irq.h> |
38 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
39 | 40 | ||
40 | #include <mach/regs-irq.h> | ||
41 | #include <mach/regs-pmu.h> | ||
42 | |||
43 | #include <plat/cpu.h> | 41 | #include <plat/cpu.h> |
44 | #include <plat/pm.h> | 42 | #include <plat/pm.h> |
45 | #include <plat/regs-serial.h> | 43 | #include <plat/regs-serial.h> |
46 | 44 | ||
47 | #include "common.h" | 45 | #include "common.h" |
46 | #include "regs-pmu.h" | ||
47 | |||
48 | #define L2_AUX_VAL 0x7C470001 | 48 | #define L2_AUX_VAL 0x7C470001 |
49 | #define L2_AUX_MASK 0xC200ffff | 49 | #define L2_AUX_MASK 0xC200ffff |
50 | 50 | ||
@@ -309,7 +309,7 @@ void __init exynos_init_late(void) | |||
309 | /* to be supported later */ | 309 | /* to be supported later */ |
310 | return; | 310 | return; |
311 | 311 | ||
312 | exynos_pm_late_initcall(); | 312 | pm_genpd_poweroff_unused(); |
313 | } | 313 | } |
314 | 314 | ||
315 | static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, | 315 | static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, |
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index ff9b6a9419b0..0c31b34f0de5 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -26,12 +26,6 @@ void exynos_init_late(void); | |||
26 | 26 | ||
27 | void exynos_firmware_init(void); | 27 | void exynos_firmware_init(void); |
28 | 28 | ||
29 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
30 | int exynos_pm_late_initcall(void); | ||
31 | #else | ||
32 | static inline int exynos_pm_late_initcall(void) { return 0; } | ||
33 | #endif | ||
34 | |||
35 | extern struct smp_operations exynos_smp_ops; | 29 | extern struct smp_operations exynos_smp_ops; |
36 | 30 | ||
37 | extern void exynos_cpu_die(unsigned int cpu); | 31 | extern void exynos_cpu_die(unsigned int cpu); |
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index ddbfe8709fe7..da65b036af2b 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c | |||
@@ -22,13 +22,15 @@ | |||
22 | #include <asm/suspend.h> | 22 | #include <asm/suspend.h> |
23 | #include <asm/unified.h> | 23 | #include <asm/unified.h> |
24 | #include <asm/cpuidle.h> | 24 | #include <asm/cpuidle.h> |
25 | #include <mach/regs-clock.h> | ||
26 | #include <mach/regs-pmu.h> | ||
27 | 25 | ||
28 | #include <plat/cpu.h> | 26 | #include <plat/cpu.h> |
29 | #include <plat/pm.h> | 27 | #include <plat/pm.h> |
30 | 28 | ||
29 | #include <mach/pm-core.h> | ||
30 | #include <mach/map.h> | ||
31 | |||
31 | #include "common.h" | 32 | #include "common.h" |
33 | #include "regs-pmu.h" | ||
32 | 34 | ||
33 | #define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \ | 35 | #define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \ |
34 | S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \ | 36 | S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \ |
@@ -39,6 +41,25 @@ | |||
39 | 41 | ||
40 | #define S5P_CHECK_AFTR 0xFCBA0D10 | 42 | #define S5P_CHECK_AFTR 0xFCBA0D10 |
41 | 43 | ||
44 | #define EXYNOS5_PWR_CTRL1 (S5P_VA_CMU + 0x01020) | ||
45 | #define EXYNOS5_PWR_CTRL2 (S5P_VA_CMU + 0x01024) | ||
46 | |||
47 | #define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28) | ||
48 | #define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16) | ||
49 | #define PWR_CTRL1_DIV2_DOWN_EN (1 << 9) | ||
50 | #define PWR_CTRL1_DIV1_DOWN_EN (1 << 8) | ||
51 | #define PWR_CTRL1_USE_CORE1_WFE (1 << 5) | ||
52 | #define PWR_CTRL1_USE_CORE0_WFE (1 << 4) | ||
53 | #define PWR_CTRL1_USE_CORE1_WFI (1 << 1) | ||
54 | #define PWR_CTRL1_USE_CORE0_WFI (1 << 0) | ||
55 | |||
56 | #define PWR_CTRL2_DIV2_UP_EN (1 << 25) | ||
57 | #define PWR_CTRL2_DIV1_UP_EN (1 << 24) | ||
58 | #define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16) | ||
59 | #define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8) | ||
60 | #define PWR_CTRL2_CORE2_UP_RATIO (1 << 4) | ||
61 | #define PWR_CTRL2_CORE1_UP_RATIO (1 << 0) | ||
62 | |||
42 | static int exynos4_enter_lowpower(struct cpuidle_device *dev, | 63 | static int exynos4_enter_lowpower(struct cpuidle_device *dev, |
43 | struct cpuidle_driver *drv, | 64 | struct cpuidle_driver *drv, |
44 | int index); | 65 | int index); |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index af90cfa2f826..5eead530c6f8 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <asm/cp15.h> | 19 | #include <asm/cp15.h> |
20 | #include <asm/smp_plat.h> | 20 | #include <asm/smp_plat.h> |
21 | 21 | ||
22 | #include <mach/regs-pmu.h> | ||
23 | #include <plat/cpu.h> | 22 | #include <plat/cpu.h> |
24 | 23 | ||
25 | #include "common.h" | 24 | #include "common.h" |
25 | #include "regs-pmu.h" | ||
26 | 26 | ||
27 | static inline void cpu_enter_lowpower_a9(void) | 27 | static inline void cpu_enter_lowpower_a9(void) |
28 | { | 28 | { |
diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h index 2b00833b6641..dc0697c2fa92 100644 --- a/arch/arm/mach-exynos/include/mach/pm-core.h +++ b/arch/arm/mach-exynos/include/mach/pm-core.h | |||
@@ -19,7 +19,10 @@ | |||
19 | #define __ASM_ARCH_PM_CORE_H __FILE__ | 19 | #define __ASM_ARCH_PM_CORE_H __FILE__ |
20 | 20 | ||
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <mach/regs-pmu.h> | 22 | #include <mach/map.h> |
23 | |||
24 | #define S5P_EINT_WAKEUP_MASK (S5P_VA_PMU + 0x0604) | ||
25 | #define S5P_WAKEUP_MASK (S5P_VA_PMU + 0x0608) | ||
23 | 26 | ||
24 | #ifdef CONFIG_PINCTRL_EXYNOS | 27 | #ifdef CONFIG_PINCTRL_EXYNOS |
25 | extern u32 exynos_get_eint_wake_mask(void); | 28 | extern u32 exynos_get_eint_wake_mask(void); |
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h deleted file mode 100644 index d36ad76ad6a4..000000000000 --- a/arch/arm/mach-exynos/include/mach/regs-clock.h +++ /dev/null | |||
@@ -1,372 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - Clock register definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_CLOCK_H | ||
14 | #define __ASM_ARCH_REGS_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <plat/cpu.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #define EXYNOS_CLKREG(x) (S5P_VA_CMU + (x)) | ||
20 | |||
21 | #define EXYNOS4_CLKDIV_LEFTBUS EXYNOS_CLKREG(0x04500) | ||
22 | #define EXYNOS4_CLKDIV_STAT_LEFTBUS EXYNOS_CLKREG(0x04600) | ||
23 | #define EXYNOS4_CLKGATE_IP_LEFTBUS EXYNOS_CLKREG(0x04800) | ||
24 | |||
25 | #define EXYNOS4_CLKDIV_RIGHTBUS EXYNOS_CLKREG(0x08500) | ||
26 | #define EXYNOS4_CLKDIV_STAT_RIGHTBUS EXYNOS_CLKREG(0x08600) | ||
27 | #define EXYNOS4_CLKGATE_IP_RIGHTBUS EXYNOS_CLKREG(0x08800) | ||
28 | |||
29 | #define EXYNOS4_EPLL_LOCK EXYNOS_CLKREG(0x0C010) | ||
30 | #define EXYNOS4_VPLL_LOCK EXYNOS_CLKREG(0x0C020) | ||
31 | |||
32 | #define EXYNOS4_EPLL_CON0 EXYNOS_CLKREG(0x0C110) | ||
33 | #define EXYNOS4_EPLL_CON1 EXYNOS_CLKREG(0x0C114) | ||
34 | #define EXYNOS4_VPLL_CON0 EXYNOS_CLKREG(0x0C120) | ||
35 | #define EXYNOS4_VPLL_CON1 EXYNOS_CLKREG(0x0C124) | ||
36 | |||
37 | #define EXYNOS4_CLKSRC_TOP0 EXYNOS_CLKREG(0x0C210) | ||
38 | #define EXYNOS4_CLKSRC_TOP1 EXYNOS_CLKREG(0x0C214) | ||
39 | #define EXYNOS4_CLKSRC_CAM EXYNOS_CLKREG(0x0C220) | ||
40 | #define EXYNOS4_CLKSRC_TV EXYNOS_CLKREG(0x0C224) | ||
41 | #define EXYNOS4_CLKSRC_MFC EXYNOS_CLKREG(0x0C228) | ||
42 | #define EXYNOS4_CLKSRC_G3D EXYNOS_CLKREG(0x0C22C) | ||
43 | #define EXYNOS4_CLKSRC_IMAGE EXYNOS_CLKREG(0x0C230) | ||
44 | #define EXYNOS4_CLKSRC_LCD0 EXYNOS_CLKREG(0x0C234) | ||
45 | #define EXYNOS4_CLKSRC_MAUDIO EXYNOS_CLKREG(0x0C23C) | ||
46 | #define EXYNOS4_CLKSRC_FSYS EXYNOS_CLKREG(0x0C240) | ||
47 | #define EXYNOS4_CLKSRC_PERIL0 EXYNOS_CLKREG(0x0C250) | ||
48 | #define EXYNOS4_CLKSRC_PERIL1 EXYNOS_CLKREG(0x0C254) | ||
49 | |||
50 | #define EXYNOS4_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x0C310) | ||
51 | #define EXYNOS4_CLKSRC_MASK_CAM EXYNOS_CLKREG(0x0C320) | ||
52 | #define EXYNOS4_CLKSRC_MASK_TV EXYNOS_CLKREG(0x0C324) | ||
53 | #define EXYNOS4_CLKSRC_MASK_LCD0 EXYNOS_CLKREG(0x0C334) | ||
54 | #define EXYNOS4_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x0C33C) | ||
55 | #define EXYNOS4_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x0C340) | ||
56 | #define EXYNOS4_CLKSRC_MASK_PERIL0 EXYNOS_CLKREG(0x0C350) | ||
57 | #define EXYNOS4_CLKSRC_MASK_PERIL1 EXYNOS_CLKREG(0x0C354) | ||
58 | |||
59 | #define EXYNOS4_CLKDIV_TOP EXYNOS_CLKREG(0x0C510) | ||
60 | #define EXYNOS4_CLKDIV_CAM EXYNOS_CLKREG(0x0C520) | ||
61 | #define EXYNOS4_CLKDIV_TV EXYNOS_CLKREG(0x0C524) | ||
62 | #define EXYNOS4_CLKDIV_MFC EXYNOS_CLKREG(0x0C528) | ||
63 | #define EXYNOS4_CLKDIV_G3D EXYNOS_CLKREG(0x0C52C) | ||
64 | #define EXYNOS4_CLKDIV_IMAGE EXYNOS_CLKREG(0x0C530) | ||
65 | #define EXYNOS4_CLKDIV_LCD0 EXYNOS_CLKREG(0x0C534) | ||
66 | #define EXYNOS4_CLKDIV_MAUDIO EXYNOS_CLKREG(0x0C53C) | ||
67 | #define EXYNOS4_CLKDIV_FSYS0 EXYNOS_CLKREG(0x0C540) | ||
68 | #define EXYNOS4_CLKDIV_FSYS1 EXYNOS_CLKREG(0x0C544) | ||
69 | #define EXYNOS4_CLKDIV_FSYS2 EXYNOS_CLKREG(0x0C548) | ||
70 | #define EXYNOS4_CLKDIV_FSYS3 EXYNOS_CLKREG(0x0C54C) | ||
71 | #define EXYNOS4_CLKDIV_PERIL0 EXYNOS_CLKREG(0x0C550) | ||
72 | #define EXYNOS4_CLKDIV_PERIL1 EXYNOS_CLKREG(0x0C554) | ||
73 | #define EXYNOS4_CLKDIV_PERIL2 EXYNOS_CLKREG(0x0C558) | ||
74 | #define EXYNOS4_CLKDIV_PERIL3 EXYNOS_CLKREG(0x0C55C) | ||
75 | #define EXYNOS4_CLKDIV_PERIL4 EXYNOS_CLKREG(0x0C560) | ||
76 | #define EXYNOS4_CLKDIV_PERIL5 EXYNOS_CLKREG(0x0C564) | ||
77 | #define EXYNOS4_CLKDIV2_RATIO EXYNOS_CLKREG(0x0C580) | ||
78 | |||
79 | #define EXYNOS4_CLKDIV_STAT_TOP EXYNOS_CLKREG(0x0C610) | ||
80 | #define EXYNOS4_CLKDIV_STAT_MFC EXYNOS_CLKREG(0x0C628) | ||
81 | |||
82 | #define EXYNOS4_CLKGATE_SCLKCAM EXYNOS_CLKREG(0x0C820) | ||
83 | #define EXYNOS4_CLKGATE_IP_CAM EXYNOS_CLKREG(0x0C920) | ||
84 | #define EXYNOS4_CLKGATE_IP_TV EXYNOS_CLKREG(0x0C924) | ||
85 | #define EXYNOS4_CLKGATE_IP_MFC EXYNOS_CLKREG(0x0C928) | ||
86 | #define EXYNOS4_CLKGATE_IP_G3D EXYNOS_CLKREG(0x0C92C) | ||
87 | #define EXYNOS4_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \ | ||
88 | EXYNOS_CLKREG(0x0C930) : \ | ||
89 | EXYNOS_CLKREG(0x04930)) | ||
90 | #define EXYNOS4210_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x0C930) | ||
91 | #define EXYNOS4212_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x04930) | ||
92 | #define EXYNOS4_CLKGATE_IP_LCD0 EXYNOS_CLKREG(0x0C934) | ||
93 | #define EXYNOS4_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x0C940) | ||
94 | #define EXYNOS4_CLKGATE_IP_GPS EXYNOS_CLKREG(0x0C94C) | ||
95 | #define EXYNOS4_CLKGATE_IP_PERIL EXYNOS_CLKREG(0x0C950) | ||
96 | #define EXYNOS4_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \ | ||
97 | EXYNOS_CLKREG(0x0C960) : \ | ||
98 | EXYNOS_CLKREG(0x08960)) | ||
99 | #define EXYNOS4210_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x0C960) | ||
100 | #define EXYNOS4212_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x08960) | ||
101 | #define EXYNOS4_CLKGATE_BLOCK EXYNOS_CLKREG(0x0C970) | ||
102 | |||
103 | #define EXYNOS4_CLKSRC_MASK_DMC EXYNOS_CLKREG(0x10300) | ||
104 | #define EXYNOS4_CLKSRC_DMC EXYNOS_CLKREG(0x10200) | ||
105 | #define EXYNOS4_CLKDIV_DMC0 EXYNOS_CLKREG(0x10500) | ||
106 | #define EXYNOS4_CLKDIV_DMC1 EXYNOS_CLKREG(0x10504) | ||
107 | #define EXYNOS4_CLKDIV_STAT_DMC0 EXYNOS_CLKREG(0x10600) | ||
108 | #define EXYNOS4_CLKDIV_STAT_DMC1 EXYNOS_CLKREG(0x10604) | ||
109 | #define EXYNOS4_CLKGATE_IP_DMC EXYNOS_CLKREG(0x10900) | ||
110 | |||
111 | #define EXYNOS4_DMC_PAUSE_CTRL EXYNOS_CLKREG(0x11094) | ||
112 | #define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0) | ||
113 | |||
114 | #define EXYNOS4_APLL_LOCK EXYNOS_CLKREG(0x14000) | ||
115 | #define EXYNOS4_MPLL_LOCK (soc_is_exynos4210() ? \ | ||
116 | EXYNOS_CLKREG(0x14004) : \ | ||
117 | EXYNOS_CLKREG(0x10008)) | ||
118 | #define EXYNOS4_APLL_CON0 EXYNOS_CLKREG(0x14100) | ||
119 | #define EXYNOS4_APLL_CON1 EXYNOS_CLKREG(0x14104) | ||
120 | #define EXYNOS4_MPLL_CON0 (soc_is_exynos4210() ? \ | ||
121 | EXYNOS_CLKREG(0x14108) : \ | ||
122 | EXYNOS_CLKREG(0x10108)) | ||
123 | #define EXYNOS4_MPLL_CON1 (soc_is_exynos4210() ? \ | ||
124 | EXYNOS_CLKREG(0x1410C) : \ | ||
125 | EXYNOS_CLKREG(0x1010C)) | ||
126 | |||
127 | #define EXYNOS4_CLKSRC_CPU EXYNOS_CLKREG(0x14200) | ||
128 | #define EXYNOS4_CLKMUX_STATCPU EXYNOS_CLKREG(0x14400) | ||
129 | |||
130 | #define EXYNOS4_CLKDIV_CPU EXYNOS_CLKREG(0x14500) | ||
131 | #define EXYNOS4_CLKDIV_CPU1 EXYNOS_CLKREG(0x14504) | ||
132 | #define EXYNOS4_CLKDIV_STATCPU EXYNOS_CLKREG(0x14600) | ||
133 | #define EXYNOS4_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x14604) | ||
134 | |||
135 | #define EXYNOS4_CLKGATE_SCLKCPU EXYNOS_CLKREG(0x14800) | ||
136 | #define EXYNOS4_CLKGATE_IP_CPU EXYNOS_CLKREG(0x14900) | ||
137 | |||
138 | #define EXYNOS4_CLKGATE_IP_ISP0 EXYNOS_CLKREG(0x18800) | ||
139 | #define EXYNOS4_CLKGATE_IP_ISP1 EXYNOS_CLKREG(0x18804) | ||
140 | |||
141 | #define EXYNOS4_APLL_LOCKTIME (0x1C20) /* 300us */ | ||
142 | |||
143 | #define EXYNOS4_APLLCON0_ENABLE_SHIFT (31) | ||
144 | #define EXYNOS4_APLLCON0_LOCKED_SHIFT (29) | ||
145 | #define EXYNOS4_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) | ||
146 | #define EXYNOS4_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) | ||
147 | |||
148 | #define EXYNOS4_EPLLCON0_ENABLE_SHIFT (31) | ||
149 | #define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29) | ||
150 | |||
151 | #define EXYNOS4_VPLLCON0_ENABLE_SHIFT (31) | ||
152 | #define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29) | ||
153 | |||
154 | #define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16) | ||
155 | #define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT) | ||
156 | |||
157 | #define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT (0) | ||
158 | #define EXYNOS4_CLKDIV_CPU0_CORE_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT) | ||
159 | #define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT (4) | ||
160 | #define EXYNOS4_CLKDIV_CPU0_COREM0_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT) | ||
161 | #define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT (8) | ||
162 | #define EXYNOS4_CLKDIV_CPU0_COREM1_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT) | ||
163 | #define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT (12) | ||
164 | #define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT) | ||
165 | #define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT (16) | ||
166 | #define EXYNOS4_CLKDIV_CPU0_ATB_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT) | ||
167 | #define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT (20) | ||
168 | #define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT) | ||
169 | #define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT (24) | ||
170 | #define EXYNOS4_CLKDIV_CPU0_APLL_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT) | ||
171 | #define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT 28 | ||
172 | #define EXYNOS4_CLKDIV_CPU0_CORE2_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT) | ||
173 | |||
174 | #define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT 0 | ||
175 | #define EXYNOS4_CLKDIV_CPU1_COPY_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT) | ||
176 | #define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT 4 | ||
177 | #define EXYNOS4_CLKDIV_CPU1_HPM_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT) | ||
178 | #define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT 8 | ||
179 | #define EXYNOS4_CLKDIV_CPU1_CORES_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT) | ||
180 | |||
181 | #define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0) | ||
182 | #define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) | ||
183 | #define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4) | ||
184 | #define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) | ||
185 | #define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8) | ||
186 | #define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) | ||
187 | #define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12) | ||
188 | #define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) | ||
189 | #define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16) | ||
190 | #define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) | ||
191 | #define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20) | ||
192 | #define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT) | ||
193 | #define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24) | ||
194 | #define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT) | ||
195 | #define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28) | ||
196 | #define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT) | ||
197 | |||
198 | #define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0) | ||
199 | #define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT) | ||
200 | #define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4) | ||
201 | #define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT) | ||
202 | #define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8) | ||
203 | #define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT) | ||
204 | #define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12) | ||
205 | #define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT) | ||
206 | #define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16) | ||
207 | #define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT) | ||
208 | #define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24) | ||
209 | #define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT) | ||
210 | |||
211 | #define EXYNOS4_CLKDIV_MFC_SHIFT (0) | ||
212 | #define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT) | ||
213 | |||
214 | #define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0) | ||
215 | #define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT) | ||
216 | #define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4) | ||
217 | #define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) | ||
218 | #define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8) | ||
219 | #define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) | ||
220 | #define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12) | ||
221 | #define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) | ||
222 | #define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16) | ||
223 | #define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT) | ||
224 | #define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20) | ||
225 | #define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT) | ||
226 | #define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24) | ||
227 | #define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT) | ||
228 | |||
229 | #define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0) | ||
230 | #define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) | ||
231 | #define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4) | ||
232 | #define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT) | ||
233 | |||
234 | #define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0) | ||
235 | #define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT) | ||
236 | #define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4) | ||
237 | #define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT) | ||
238 | #define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8) | ||
239 | #define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT) | ||
240 | #define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12) | ||
241 | #define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT) | ||
242 | |||
243 | /* Only for EXYNOS4210 */ | ||
244 | |||
245 | #define EXYNOS4210_CLKSRC_LCD1 EXYNOS_CLKREG(0x0C238) | ||
246 | #define EXYNOS4210_CLKSRC_MASK_LCD1 EXYNOS_CLKREG(0x0C338) | ||
247 | #define EXYNOS4210_CLKDIV_LCD1 EXYNOS_CLKREG(0x0C538) | ||
248 | #define EXYNOS4210_CLKGATE_IP_LCD1 EXYNOS_CLKREG(0x0C938) | ||
249 | |||
250 | /* Only for EXYNOS4212 */ | ||
251 | |||
252 | #define EXYNOS4_CLKDIV_CAM1 EXYNOS_CLKREG(0x0C568) | ||
253 | |||
254 | #define EXYNOS4_CLKDIV_STAT_CAM1 EXYNOS_CLKREG(0x0C668) | ||
255 | |||
256 | #define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0) | ||
257 | #define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT) | ||
258 | |||
259 | /* For EXYNOS5250 */ | ||
260 | |||
261 | #define EXYNOS5_APLL_LOCK EXYNOS_CLKREG(0x00000) | ||
262 | #define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100) | ||
263 | #define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200) | ||
264 | #define EXYNOS5_CLKMUX_STATCPU EXYNOS_CLKREG(0x00400) | ||
265 | #define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500) | ||
266 | #define EXYNOS5_CLKDIV_CPU1 EXYNOS_CLKREG(0x00504) | ||
267 | #define EXYNOS5_CLKDIV_STATCPU0 EXYNOS_CLKREG(0x00600) | ||
268 | #define EXYNOS5_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x00604) | ||
269 | |||
270 | #define EXYNOS5_PWR_CTRL1 EXYNOS_CLKREG(0x01020) | ||
271 | #define EXYNOS5_PWR_CTRL2 EXYNOS_CLKREG(0x01024) | ||
272 | |||
273 | #define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100) | ||
274 | #define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204) | ||
275 | |||
276 | #define EXYNOS5_CLKGATE_IP_CORE EXYNOS_CLKREG(0x04900) | ||
277 | |||
278 | #define EXYNOS5_CLKDIV_ACP EXYNOS_CLKREG(0x08500) | ||
279 | |||
280 | #define EXYNOS5_EPLL_CON0 EXYNOS_CLKREG(0x10130) | ||
281 | #define EXYNOS5_EPLL_CON1 EXYNOS_CLKREG(0x10134) | ||
282 | #define EXYNOS5_EPLL_CON2 EXYNOS_CLKREG(0x10138) | ||
283 | #define EXYNOS5_VPLL_CON0 EXYNOS_CLKREG(0x10140) | ||
284 | #define EXYNOS5_VPLL_CON1 EXYNOS_CLKREG(0x10144) | ||
285 | #define EXYNOS5_VPLL_CON2 EXYNOS_CLKREG(0x10148) | ||
286 | #define EXYNOS5_CPLL_CON0 EXYNOS_CLKREG(0x10120) | ||
287 | |||
288 | #define EXYNOS5_CLKSRC_TOP0 EXYNOS_CLKREG(0x10210) | ||
289 | #define EXYNOS5_CLKSRC_TOP1 EXYNOS_CLKREG(0x10214) | ||
290 | #define EXYNOS5_CLKSRC_TOP2 EXYNOS_CLKREG(0x10218) | ||
291 | #define EXYNOS5_CLKSRC_TOP3 EXYNOS_CLKREG(0x1021C) | ||
292 | #define EXYNOS5_CLKSRC_GSCL EXYNOS_CLKREG(0x10220) | ||
293 | #define EXYNOS5_CLKSRC_DISP1_0 EXYNOS_CLKREG(0x1022C) | ||
294 | #define EXYNOS5_CLKSRC_MAUDIO EXYNOS_CLKREG(0x10240) | ||
295 | #define EXYNOS5_CLKSRC_FSYS EXYNOS_CLKREG(0x10244) | ||
296 | #define EXYNOS5_CLKSRC_PERIC0 EXYNOS_CLKREG(0x10250) | ||
297 | #define EXYNOS5_CLKSRC_PERIC1 EXYNOS_CLKREG(0x10254) | ||
298 | #define EXYNOS5_SCLK_SRC_ISP EXYNOS_CLKREG(0x10270) | ||
299 | |||
300 | #define EXYNOS5_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x10310) | ||
301 | #define EXYNOS5_CLKSRC_MASK_GSCL EXYNOS_CLKREG(0x10320) | ||
302 | #define EXYNOS5_CLKSRC_MASK_DISP1_0 EXYNOS_CLKREG(0x1032C) | ||
303 | #define EXYNOS5_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x10334) | ||
304 | #define EXYNOS5_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x10340) | ||
305 | #define EXYNOS5_CLKSRC_MASK_PERIC0 EXYNOS_CLKREG(0x10350) | ||
306 | #define EXYNOS5_CLKSRC_MASK_PERIC1 EXYNOS_CLKREG(0x10354) | ||
307 | |||
308 | #define EXYNOS5_CLKDIV_TOP0 EXYNOS_CLKREG(0x10510) | ||
309 | #define EXYNOS5_CLKDIV_TOP1 EXYNOS_CLKREG(0x10514) | ||
310 | #define EXYNOS5_CLKDIV_GSCL EXYNOS_CLKREG(0x10520) | ||
311 | #define EXYNOS5_CLKDIV_DISP1_0 EXYNOS_CLKREG(0x1052C) | ||
312 | #define EXYNOS5_CLKDIV_GEN EXYNOS_CLKREG(0x1053C) | ||
313 | #define EXYNOS5_CLKDIV_MAUDIO EXYNOS_CLKREG(0x10544) | ||
314 | #define EXYNOS5_CLKDIV_FSYS0 EXYNOS_CLKREG(0x10548) | ||
315 | #define EXYNOS5_CLKDIV_FSYS1 EXYNOS_CLKREG(0x1054C) | ||
316 | #define EXYNOS5_CLKDIV_FSYS2 EXYNOS_CLKREG(0x10550) | ||
317 | #define EXYNOS5_CLKDIV_FSYS3 EXYNOS_CLKREG(0x10554) | ||
318 | #define EXYNOS5_CLKDIV_PERIC0 EXYNOS_CLKREG(0x10558) | ||
319 | #define EXYNOS5_CLKDIV_PERIC1 EXYNOS_CLKREG(0x1055C) | ||
320 | #define EXYNOS5_CLKDIV_PERIC2 EXYNOS_CLKREG(0x10560) | ||
321 | #define EXYNOS5_CLKDIV_PERIC3 EXYNOS_CLKREG(0x10564) | ||
322 | #define EXYNOS5_CLKDIV_PERIC4 EXYNOS_CLKREG(0x10568) | ||
323 | #define EXYNOS5_CLKDIV_PERIC5 EXYNOS_CLKREG(0x1056C) | ||
324 | #define EXYNOS5_SCLK_DIV_ISP EXYNOS_CLKREG(0x10580) | ||
325 | |||
326 | #define EXYNOS5_CLKGATE_IP_ACP EXYNOS_CLKREG(0x08800) | ||
327 | #define EXYNOS5_CLKGATE_IP_ISP0 EXYNOS_CLKREG(0x0C800) | ||
328 | #define EXYNOS5_CLKGATE_IP_ISP1 EXYNOS_CLKREG(0x0C804) | ||
329 | #define EXYNOS5_CLKGATE_IP_GSCL EXYNOS_CLKREG(0x10920) | ||
330 | #define EXYNOS5_CLKGATE_IP_DISP1 EXYNOS_CLKREG(0x10928) | ||
331 | #define EXYNOS5_CLKGATE_IP_MFC EXYNOS_CLKREG(0x1092C) | ||
332 | #define EXYNOS5_CLKGATE_IP_G3D EXYNOS_CLKREG(0x10930) | ||
333 | #define EXYNOS5_CLKGATE_IP_GEN EXYNOS_CLKREG(0x10934) | ||
334 | #define EXYNOS5_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x10944) | ||
335 | #define EXYNOS5_CLKGATE_IP_GPS EXYNOS_CLKREG(0x1094C) | ||
336 | #define EXYNOS5_CLKGATE_IP_PERIC EXYNOS_CLKREG(0x10950) | ||
337 | #define EXYNOS5_CLKGATE_IP_PERIS EXYNOS_CLKREG(0x10960) | ||
338 | #define EXYNOS5_CLKGATE_BLOCK EXYNOS_CLKREG(0x10980) | ||
339 | |||
340 | #define EXYNOS5_BPLL_CON0 EXYNOS_CLKREG(0x20110) | ||
341 | #define EXYNOS5_CLKSRC_CDREX EXYNOS_CLKREG(0x20200) | ||
342 | #define EXYNOS5_CLKDIV_CDREX EXYNOS_CLKREG(0x20500) | ||
343 | |||
344 | #define EXYNOS5_PLL_DIV2_SEL EXYNOS_CLKREG(0x20A24) | ||
345 | |||
346 | #define EXYNOS5_EPLL_LOCK EXYNOS_CLKREG(0x10030) | ||
347 | |||
348 | #define EXYNOS5_EPLLCON0_LOCKED_SHIFT (29) | ||
349 | |||
350 | #define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28) | ||
351 | #define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16) | ||
352 | #define PWR_CTRL1_DIV2_DOWN_EN (1 << 9) | ||
353 | #define PWR_CTRL1_DIV1_DOWN_EN (1 << 8) | ||
354 | #define PWR_CTRL1_USE_CORE1_WFE (1 << 5) | ||
355 | #define PWR_CTRL1_USE_CORE0_WFE (1 << 4) | ||
356 | #define PWR_CTRL1_USE_CORE1_WFI (1 << 1) | ||
357 | #define PWR_CTRL1_USE_CORE0_WFI (1 << 0) | ||
358 | |||
359 | #define PWR_CTRL2_DIV2_UP_EN (1 << 25) | ||
360 | #define PWR_CTRL2_DIV1_UP_EN (1 << 24) | ||
361 | #define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16) | ||
362 | #define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8) | ||
363 | #define PWR_CTRL2_CORE2_UP_RATIO (1 << 4) | ||
364 | #define PWR_CTRL2_CORE1_UP_RATIO (1 << 0) | ||
365 | |||
366 | /* Compatibility defines and inclusion */ | ||
367 | |||
368 | #include <mach/regs-pmu.h> | ||
369 | |||
370 | #define S5P_EPLL_CON EXYNOS4_EPLL_CON0 | ||
371 | |||
372 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/regs-irq.h b/arch/arm/mach-exynos/include/mach/regs-irq.h deleted file mode 100644 index f2b50506b9f6..000000000000 --- a/arch/arm/mach-exynos/include/mach/regs-irq.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/regs-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 - IRQ register definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_IRQ_H | ||
14 | #define __ASM_ARCH_REGS_IRQ_H __FILE__ | ||
15 | |||
16 | #include <linux/irqchip/arm-gic.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #endif /* __ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index 1fe075a70c1e..65a46465ac5e 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -14,10 +14,10 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | 15 | ||
16 | #include <asm/mach/arch.h> | 16 | #include <asm/mach/arch.h> |
17 | #include <mach/regs-pmu.h> | ||
18 | #include <plat/mfc.h> | 17 | #include <plat/mfc.h> |
19 | 18 | ||
20 | #include "common.h" | 19 | #include "common.h" |
20 | #include "regs-pmu.h" | ||
21 | 21 | ||
22 | static void __init exynos5_dt_machine_init(void) | 22 | static void __init exynos5_dt_machine_init(void) |
23 | { | 23 | { |
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 58b43e6f9262..8ea02f63fed9 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -27,12 +27,11 @@ | |||
27 | #include <asm/firmware.h> | 27 | #include <asm/firmware.h> |
28 | 28 | ||
29 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
30 | #include <mach/regs-clock.h> | ||
31 | #include <mach/regs-pmu.h> | ||
32 | 30 | ||
33 | #include <plat/cpu.h> | 31 | #include <plat/cpu.h> |
34 | 32 | ||
35 | #include "common.h" | 33 | #include "common.h" |
34 | #include "regs-pmu.h" | ||
36 | 35 | ||
37 | extern void exynos4_secondary_startup(void); | 36 | extern void exynos4_secondary_startup(void); |
38 | 37 | ||
@@ -64,8 +63,7 @@ static void write_pen_release(int val) | |||
64 | { | 63 | { |
65 | pen_release = val; | 64 | pen_release = val; |
66 | smp_wmb(); | 65 | smp_wmb(); |
67 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 66 | sync_cache_w(&pen_release); |
68 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
69 | } | 67 | } |
70 | 68 | ||
71 | static void __iomem *scu_base_addr(void) | 69 | static void __iomem *scu_base_addr(void) |
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index c679db577269..e00025bbbe89 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c | |||
@@ -29,14 +29,37 @@ | |||
29 | #include <plat/pll.h> | 29 | #include <plat/pll.h> |
30 | #include <plat/regs-srom.h> | 30 | #include <plat/regs-srom.h> |
31 | 31 | ||
32 | #include <mach/regs-irq.h> | 32 | #include <mach/map.h> |
33 | #include <mach/regs-clock.h> | ||
34 | #include <mach/regs-pmu.h> | ||
35 | #include <mach/pm-core.h> | 33 | #include <mach/pm-core.h> |
36 | 34 | ||
37 | #include "common.h" | 35 | #include "common.h" |
36 | #include "regs-pmu.h" | ||
38 | 37 | ||
39 | static struct sleep_save exynos4_set_clksrc[] = { | 38 | #define EXYNOS4_EPLL_LOCK (S5P_VA_CMU + 0x0C010) |
39 | #define EXYNOS4_VPLL_LOCK (S5P_VA_CMU + 0x0C020) | ||
40 | |||
41 | #define EXYNOS4_EPLL_CON0 (S5P_VA_CMU + 0x0C110) | ||
42 | #define EXYNOS4_EPLL_CON1 (S5P_VA_CMU + 0x0C114) | ||
43 | #define EXYNOS4_VPLL_CON0 (S5P_VA_CMU + 0x0C120) | ||
44 | #define EXYNOS4_VPLL_CON1 (S5P_VA_CMU + 0x0C124) | ||
45 | |||
46 | #define EXYNOS4_CLKSRC_MASK_TOP (S5P_VA_CMU + 0x0C310) | ||
47 | #define EXYNOS4_CLKSRC_MASK_CAM (S5P_VA_CMU + 0x0C320) | ||
48 | #define EXYNOS4_CLKSRC_MASK_TV (S5P_VA_CMU + 0x0C324) | ||
49 | #define EXYNOS4_CLKSRC_MASK_LCD0 (S5P_VA_CMU + 0x0C334) | ||
50 | #define EXYNOS4_CLKSRC_MASK_MAUDIO (S5P_VA_CMU + 0x0C33C) | ||
51 | #define EXYNOS4_CLKSRC_MASK_FSYS (S5P_VA_CMU + 0x0C340) | ||
52 | #define EXYNOS4_CLKSRC_MASK_PERIL0 (S5P_VA_CMU + 0x0C350) | ||
53 | #define EXYNOS4_CLKSRC_MASK_PERIL1 (S5P_VA_CMU + 0x0C354) | ||
54 | |||
55 | #define EXYNOS4_CLKSRC_MASK_DMC (S5P_VA_CMU + 0x10300) | ||
56 | |||
57 | #define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29) | ||
58 | #define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29) | ||
59 | |||
60 | #define EXYNOS4210_CLKSRC_MASK_LCD1 (S5P_VA_CMU + 0x0C338) | ||
61 | |||
62 | static const struct sleep_save exynos4_set_clksrc[] = { | ||
40 | { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, }, | 63 | { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, }, |
41 | { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, }, | 64 | { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, }, |
42 | { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, }, | 65 | { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, }, |
@@ -48,7 +71,7 @@ static struct sleep_save exynos4_set_clksrc[] = { | |||
48 | { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, }, | 71 | { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, }, |
49 | }; | 72 | }; |
50 | 73 | ||
51 | static struct sleep_save exynos4210_set_clksrc[] = { | 74 | static const struct sleep_save exynos4210_set_clksrc[] = { |
52 | { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, | 75 | { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, |
53 | }; | 76 | }; |
54 | 77 | ||
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 1703593e366c..8fd24882f0b1 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c | |||
@@ -22,9 +22,10 @@ | |||
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | 24 | ||
25 | #include <mach/regs-pmu.h> | ||
26 | #include <plat/devs.h> | 25 | #include <plat/devs.h> |
27 | 26 | ||
27 | #include "regs-pmu.h" | ||
28 | |||
28 | /* | 29 | /* |
29 | * Exynos specific wrapper around the generic power domain | 30 | * Exynos specific wrapper around the generic power domain |
30 | */ | 31 | */ |
@@ -183,9 +184,3 @@ static __init int exynos4_pm_init_power_domain(void) | |||
183 | return 0; | 184 | return 0; |
184 | } | 185 | } |
185 | arch_initcall(exynos4_pm_init_power_domain); | 186 | arch_initcall(exynos4_pm_init_power_domain); |
186 | |||
187 | int __init exynos_pm_late_initcall(void) | ||
188 | { | ||
189 | pm_genpd_poweroff_unused(); | ||
190 | return 0; | ||
191 | } | ||
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 97d688526258..05c7ce15322a 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c | |||
@@ -13,13 +13,14 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/bug.h> | 14 | #include <linux/bug.h> |
15 | 15 | ||
16 | #include <mach/regs-clock.h> | 16 | #include <plat/cpu.h> |
17 | 17 | ||
18 | #include "common.h" | 18 | #include "common.h" |
19 | #include "regs-pmu.h" | ||
19 | 20 | ||
20 | static struct exynos_pmu_conf *exynos_pmu_config; | 21 | static const struct exynos_pmu_conf *exynos_pmu_config; |
21 | 22 | ||
22 | static struct exynos_pmu_conf exynos4210_pmu_config[] = { | 23 | static const struct exynos_pmu_conf exynos4210_pmu_config[] = { |
23 | /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ | 24 | /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ |
24 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, | 25 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, |
25 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, | 26 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, |
@@ -95,7 +96,7 @@ static struct exynos_pmu_conf exynos4210_pmu_config[] = { | |||
95 | { PMU_TABLE_END,}, | 96 | { PMU_TABLE_END,}, |
96 | }; | 97 | }; |
97 | 98 | ||
98 | static struct exynos_pmu_conf exynos4x12_pmu_config[] = { | 99 | static const struct exynos_pmu_conf exynos4x12_pmu_config[] = { |
99 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, | 100 | { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, |
100 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, | 101 | { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, |
101 | { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, | 102 | { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, |
@@ -203,7 +204,7 @@ static struct exynos_pmu_conf exynos4x12_pmu_config[] = { | |||
203 | { PMU_TABLE_END,}, | 204 | { PMU_TABLE_END,}, |
204 | }; | 205 | }; |
205 | 206 | ||
206 | static struct exynos_pmu_conf exynos4412_pmu_config[] = { | 207 | static const struct exynos_pmu_conf exynos4412_pmu_config[] = { |
207 | { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } }, | 208 | { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } }, |
208 | { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } }, | 209 | { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } }, |
209 | { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } }, | 210 | { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } }, |
@@ -213,7 +214,7 @@ static struct exynos_pmu_conf exynos4412_pmu_config[] = { | |||
213 | { PMU_TABLE_END,}, | 214 | { PMU_TABLE_END,}, |
214 | }; | 215 | }; |
215 | 216 | ||
216 | static struct exynos_pmu_conf exynos5250_pmu_config[] = { | 217 | static const struct exynos_pmu_conf exynos5250_pmu_config[] = { |
217 | /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ | 218 | /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ |
218 | { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, | 219 | { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, |
219 | { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, | 220 | { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, |
@@ -317,7 +318,7 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = { | |||
317 | { PMU_TABLE_END,}, | 318 | { PMU_TABLE_END,}, |
318 | }; | 319 | }; |
319 | 320 | ||
320 | static void __iomem *exynos5_list_both_cnt_feed[] = { | 321 | static void __iomem * const exynos5_list_both_cnt_feed[] = { |
321 | EXYNOS5_ARM_CORE0_OPTION, | 322 | EXYNOS5_ARM_CORE0_OPTION, |
322 | EXYNOS5_ARM_CORE1_OPTION, | 323 | EXYNOS5_ARM_CORE1_OPTION, |
323 | EXYNOS5_ARM_COMMON_OPTION, | 324 | EXYNOS5_ARM_COMMON_OPTION, |
@@ -331,7 +332,7 @@ static void __iomem *exynos5_list_both_cnt_feed[] = { | |||
331 | EXYNOS5_TOP_PWR_SYSMEM_OPTION, | 332 | EXYNOS5_TOP_PWR_SYSMEM_OPTION, |
332 | }; | 333 | }; |
333 | 334 | ||
334 | static void __iomem *exynos5_list_diable_wfi_wfe[] = { | 335 | static void __iomem * const exynos5_list_diable_wfi_wfe[] = { |
335 | EXYNOS5_ARM_CORE1_OPTION, | 336 | EXYNOS5_ARM_CORE1_OPTION, |
336 | EXYNOS5_FSYS_ARM_OPTION, | 337 | EXYNOS5_FSYS_ARM_OPTION, |
337 | EXYNOS5_ISP_ARM_OPTION, | 338 | EXYNOS5_ISP_ARM_OPTION, |
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 2cdb63e8ce5c..7c029ce27711 100644 --- a/arch/arm/mach-exynos/include/mach/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h | |||
@@ -24,31 +24,16 @@ | |||
24 | #define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208) | 24 | #define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208) |
25 | 25 | ||
26 | #define S5P_USE_STANDBY_WFI0 (1 << 16) | 26 | #define S5P_USE_STANDBY_WFI0 (1 << 16) |
27 | #define S5P_USE_STANDBY_WFI1 (1 << 17) | ||
28 | #define S5P_USE_STANDBYWFI_ISP_ARM (1 << 18) | ||
29 | #define S5P_USE_STANDBY_WFE0 (1 << 24) | 27 | #define S5P_USE_STANDBY_WFE0 (1 << 24) |
30 | #define S5P_USE_STANDBY_WFE1 (1 << 25) | ||
31 | #define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26) | ||
32 | 28 | ||
33 | #define S5P_SWRESET S5P_PMUREG(0x0400) | 29 | #define S5P_SWRESET S5P_PMUREG(0x0400) |
34 | #define EXYNOS_SWRESET S5P_PMUREG(0x0400) | 30 | #define EXYNOS_SWRESET S5P_PMUREG(0x0400) |
35 | #define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4) | 31 | #define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4) |
36 | 32 | ||
37 | #define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) | 33 | #define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) |
38 | #define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) | ||
39 | #define S5P_WAKEUP_MASK S5P_PMUREG(0x0608) | ||
40 | |||
41 | #define S5P_HDMI_PHY_CONTROL S5P_PMUREG(0x0700) | ||
42 | #define S5P_HDMI_PHY_ENABLE (1 << 0) | ||
43 | |||
44 | #define S5P_DAC_PHY_CONTROL S5P_PMUREG(0x070C) | ||
45 | #define S5P_DAC_PHY_ENABLE (1 << 0) | ||
46 | 34 | ||
47 | #define S5P_INFORM0 S5P_PMUREG(0x0800) | 35 | #define S5P_INFORM0 S5P_PMUREG(0x0800) |
48 | #define S5P_INFORM1 S5P_PMUREG(0x0804) | 36 | #define S5P_INFORM1 S5P_PMUREG(0x0804) |
49 | #define S5P_INFORM2 S5P_PMUREG(0x0808) | ||
50 | #define S5P_INFORM3 S5P_PMUREG(0x080C) | ||
51 | #define S5P_INFORM4 S5P_PMUREG(0x0810) | ||
52 | #define S5P_INFORM5 S5P_PMUREG(0x0814) | 37 | #define S5P_INFORM5 S5P_PMUREG(0x0814) |
53 | #define S5P_INFORM6 S5P_PMUREG(0x0818) | 38 | #define S5P_INFORM6 S5P_PMUREG(0x0818) |
54 | #define S5P_INFORM7 S5P_PMUREG(0x081C) | 39 | #define S5P_INFORM7 S5P_PMUREG(0x081C) |
@@ -119,23 +104,8 @@ | |||
119 | #define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) | 104 | #define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) |
120 | #define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) | 105 | #define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) |
121 | 106 | ||
122 | #define S5P_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) | ||
123 | #define S5P_ARM_CORE0_OPTION S5P_PMUREG(0x2008) | ||
124 | #define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) | 107 | #define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) |
125 | #define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) | 108 | #define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) |
126 | #define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088) | ||
127 | |||
128 | #define S5P_ARM_COMMON_OPTION S5P_PMUREG(0x2408) | ||
129 | #define S5P_TOP_PWR_OPTION S5P_PMUREG(0x2C48) | ||
130 | #define S5P_CAM_OPTION S5P_PMUREG(0x3C08) | ||
131 | #define S5P_TV_OPTION S5P_PMUREG(0x3C28) | ||
132 | #define S5P_MFC_OPTION S5P_PMUREG(0x3C48) | ||
133 | #define S5P_G3D_OPTION S5P_PMUREG(0x3C68) | ||
134 | #define S5P_LCD0_OPTION S5P_PMUREG(0x3C88) | ||
135 | #define S5P_LCD1_OPTION S5P_PMUREG(0x3CA8) | ||
136 | #define S5P_MAUDIO_OPTION S5P_PMUREG(0x3CC8) | ||
137 | #define S5P_GPS_OPTION S5P_PMUREG(0x3CE8) | ||
138 | #define S5P_GPS_ALIVE_OPTION S5P_PMUREG(0x3D08) | ||
139 | 109 | ||
140 | #define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) | 110 | #define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) |
141 | #define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) | 111 | #define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) |
@@ -145,28 +115,12 @@ | |||
145 | #define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) | 115 | #define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) |
146 | #define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) | 116 | #define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) |
147 | 117 | ||
148 | #define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00) | ||
149 | #define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20) | ||
150 | #define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40) | ||
151 | #define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60) | ||
152 | #define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80) | ||
153 | #define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0) | ||
154 | |||
155 | #define S5P_PMU_SATA_PHY_CONTROL_EN 0x1 | ||
156 | #define S5P_CORE_LOCAL_PWR_EN 0x3 | 118 | #define S5P_CORE_LOCAL_PWR_EN 0x3 |
157 | #define S5P_INT_LOCAL_PWR_EN 0x7 | 119 | #define S5P_INT_LOCAL_PWR_EN 0x7 |
158 | 120 | ||
159 | #define S5P_CHECK_SLEEP 0x00000BAD | 121 | #define S5P_CHECK_SLEEP 0x00000BAD |
160 | 122 | ||
161 | /* Only for EXYNOS4210 */ | 123 | /* Only for EXYNOS4210 */ |
162 | #define S5P_USBDEVICE_PHY_CONTROL S5P_PMUREG(0x0704) | ||
163 | #define S5P_USBDEVICE_PHY_ENABLE (1 << 0) | ||
164 | |||
165 | #define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708) | ||
166 | #define S5P_USBHOST_PHY_ENABLE (1 << 0) | ||
167 | |||
168 | #define S5P_PMU_SATA_PHY_CONTROL S5P_PMUREG(0x0720) | ||
169 | |||
170 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) | 124 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) |
171 | #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) | 125 | #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) |
172 | #define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) | 126 | #define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) |
@@ -174,8 +128,6 @@ | |||
174 | #define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) | 128 | #define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) |
175 | #define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) | 129 | #define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) |
176 | 130 | ||
177 | #define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0) | ||
178 | |||
179 | /* Only for EXYNOS4x12 */ | 131 | /* Only for EXYNOS4x12 */ |
180 | #define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050) | 132 | #define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050) |
181 | #define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054) | 133 | #define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054) |
@@ -343,13 +295,9 @@ | |||
343 | #define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48) | 295 | #define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48) |
344 | #define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8) | 296 | #define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8) |
345 | #define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48) | 297 | #define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48) |
346 | #define EXYNOS5_GSCL_STATUS S5P_PMUREG(0x4004) | ||
347 | #define EXYNOS5_ISP_STATUS S5P_PMUREG(0x4024) | ||
348 | #define EXYNOS5_GSCL_OPTION S5P_PMUREG(0x4008) | 298 | #define EXYNOS5_GSCL_OPTION S5P_PMUREG(0x4008) |
349 | #define EXYNOS5_ISP_OPTION S5P_PMUREG(0x4028) | 299 | #define EXYNOS5_ISP_OPTION S5P_PMUREG(0x4028) |
350 | #define EXYNOS5_MFC_OPTION S5P_PMUREG(0x4048) | 300 | #define EXYNOS5_MFC_OPTION S5P_PMUREG(0x4048) |
351 | #define EXYNOS5_G3D_CONFIGURATION S5P_PMUREG(0x4060) | ||
352 | #define EXYNOS5_G3D_STATUS S5P_PMUREG(0x4064) | ||
353 | #define EXYNOS5_G3D_OPTION S5P_PMUREG(0x4068) | 301 | #define EXYNOS5_G3D_OPTION S5P_PMUREG(0x4068) |
354 | #define EXYNOS5_DISP1_OPTION S5P_PMUREG(0x40A8) | 302 | #define EXYNOS5_DISP1_OPTION S5P_PMUREG(0x40A8) |
355 | #define EXYNOS5_MAU_OPTION S5P_PMUREG(0x40C8) | 303 | #define EXYNOS5_MAU_OPTION S5P_PMUREG(0x40C8) |
@@ -357,7 +305,6 @@ | |||
357 | #define EXYNOS5_USE_SC_FEEDBACK (1 << 1) | 305 | #define EXYNOS5_USE_SC_FEEDBACK (1 << 1) |
358 | #define EXYNOS5_USE_SC_COUNTER (1 << 0) | 306 | #define EXYNOS5_USE_SC_COUNTER (1 << 0) |
359 | 307 | ||
360 | #define EXYNOS5_MANUAL_L2RSTDISABLE_CONTROL (1 << 2) | ||
361 | #define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN (1 << 7) | 308 | #define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN (1 << 7) |
362 | 309 | ||
363 | #define EXYNOS5_OPTION_USE_STANDBYWFE (1 << 24) | 310 | #define EXYNOS5_OPTION_USE_STANDBYWFE (1 << 24) |
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c index 1f24c1fdfea4..5b57c17c06bd 100644 --- a/arch/arm/mach-imx/platsmp.c +++ b/arch/arm/mach-imx/platsmp.c | |||
@@ -92,8 +92,7 @@ static void __init imx_smp_prepare_cpus(unsigned int max_cpus) | |||
92 | * secondary cores when booting them. | 92 | * secondary cores when booting them. |
93 | */ | 93 | */ |
94 | asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (g_diag_reg) : : "cc"); | 94 | asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (g_diag_reg) : : "cc"); |
95 | __cpuc_flush_dcache_area(&g_diag_reg, sizeof(g_diag_reg)); | 95 | sync_cache_w(&g_diag_reg); |
96 | outer_clean_range(__pa(&g_diag_reg), __pa(&g_diag_reg + 1)); | ||
97 | } | 96 | } |
98 | 97 | ||
99 | struct smp_operations imx_smp_ops __initdata = { | 98 | struct smp_operations imx_smp_ops __initdata = { |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 9caa4fe95913..78188159484d 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -10,55 +10,21 @@ | |||
10 | * warranty of any kind, whether express or implied. | 10 | * warranty of any kind, whether express or implied. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/clk.h> | ||
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/of.h> | 16 | #include <linux/of.h> |
16 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
17 | #include <linux/of_net.h> | 18 | #include <linux/of_net.h> |
18 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
21 | #include <linux/irqchip.h> | 21 | #include <linux/irqchip.h> |
22 | #include <linux/kexec.h> | 22 | #include <linux/kexec.h> |
23 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/map.h> | ||
25 | #include <mach/bridge-regs.h> | 24 | #include <mach/bridge-regs.h> |
26 | #include <linux/platform_data/usb-ehci-orion.h> | ||
27 | #include <plat/irq.h> | ||
28 | #include <plat/common.h> | 25 | #include <plat/common.h> |
29 | #include "common.h" | 26 | #include "common.h" |
30 | 27 | ||
31 | /* | ||
32 | * There are still devices that doesn't know about DT yet. Get clock | ||
33 | * gates here and add a clock lookup alias, so that old platform | ||
34 | * devices still work. | ||
35 | */ | ||
36 | |||
37 | static void __init kirkwood_legacy_clk_init(void) | ||
38 | { | ||
39 | |||
40 | struct device_node *np = of_find_compatible_node( | ||
41 | NULL, NULL, "marvell,kirkwood-gating-clock"); | ||
42 | struct of_phandle_args clkspec; | ||
43 | struct clk *clk; | ||
44 | |||
45 | clkspec.np = np; | ||
46 | clkspec.args_count = 1; | ||
47 | |||
48 | /* | ||
49 | * The ethernet interfaces forget the MAC address assigned by | ||
50 | * u-boot if the clocks are turned off. Until proper DT support | ||
51 | * is available we always enable them for now. | ||
52 | */ | ||
53 | clkspec.args[0] = CGC_BIT_GE0; | ||
54 | clk = of_clk_get_from_provider(&clkspec); | ||
55 | clk_prepare_enable(clk); | ||
56 | |||
57 | clkspec.args[0] = CGC_BIT_GE1; | ||
58 | clk = of_clk_get_from_provider(&clkspec); | ||
59 | clk_prepare_enable(clk); | ||
60 | } | ||
61 | |||
62 | #define MV643XX_ETH_MAC_ADDR_LOW 0x0414 | 28 | #define MV643XX_ETH_MAC_ADDR_LOW 0x0414 |
63 | #define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 | 29 | #define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 |
64 | 30 | ||
@@ -140,7 +106,7 @@ eth_fixup_skip: | |||
140 | 106 | ||
141 | static void __init kirkwood_dt_init(void) | 107 | static void __init kirkwood_dt_init(void) |
142 | { | 108 | { |
143 | pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); | 109 | pr_info("Kirkwood: %s.\n", kirkwood_id()); |
144 | 110 | ||
145 | /* | 111 | /* |
146 | * Disable propagation of mbus errors to the CPU local bus, | 112 | * Disable propagation of mbus errors to the CPU local bus, |
@@ -156,8 +122,6 @@ static void __init kirkwood_dt_init(void) | |||
156 | 122 | ||
157 | kirkwood_cpufreq_init(); | 123 | kirkwood_cpufreq_init(); |
158 | kirkwood_cpuidle_init(); | 124 | kirkwood_cpuidle_init(); |
159 | /* Setup clocks for legacy devices */ | ||
160 | kirkwood_legacy_clk_init(); | ||
161 | 125 | ||
162 | kirkwood_pm_init(); | 126 | kirkwood_pm_init(); |
163 | kirkwood_dt_eth_fixup(); | 127 | kirkwood_dt_eth_fixup(); |
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig index ebdda8346a26..ebdba87b9671 100644 --- a/arch/arm/mach-mmp/Kconfig +++ b/arch/arm/mach-mmp/Kconfig | |||
@@ -136,4 +136,7 @@ config USB_EHCI_MV_U2O | |||
136 | help | 136 | help |
137 | Enables support for OTG controller which can be switched to host mode. | 137 | Enables support for OTG controller which can be switched to host mode. |
138 | 138 | ||
139 | config MMP_SRAM | ||
140 | bool | ||
141 | |||
139 | endif | 142 | endif |
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile index 9b702a1dc7b0..98f0f6388e44 100644 --- a/arch/arm/mach-mmp/Makefile +++ b/arch/arm/mach-mmp/Makefile | |||
@@ -7,7 +7,8 @@ obj-y += common.o devices.o time.o | |||
7 | # SoC support | 7 | # SoC support |
8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o | 8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o |
9 | obj-$(CONFIG_CPU_PXA910) += pxa910.o | 9 | obj-$(CONFIG_CPU_PXA910) += pxa910.o |
10 | obj-$(CONFIG_CPU_MMP2) += mmp2.o sram.o | 10 | obj-$(CONFIG_CPU_MMP2) += mmp2.o |
11 | obj-$(CONFIG_MMP_SRAM) += sram.o | ||
11 | 12 | ||
12 | ifeq ($(CONFIG_COMMON_CLK), ) | 13 | ifeq ($(CONFIG_COMMON_CLK), ) |
13 | obj-y += clock.o | 14 | obj-y += clock.o |
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c index 3f06edcdd0ce..f10a1f58fde9 100644 --- a/arch/arm/mach-msm/platsmp.c +++ b/arch/arm/mach-msm/platsmp.c | |||
@@ -99,8 +99,7 @@ static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
99 | * "cpu" is Linux's internal ID. | 99 | * "cpu" is Linux's internal ID. |
100 | */ | 100 | */ |
101 | pen_release = cpu_logical_map(cpu); | 101 | pen_release = cpu_logical_map(cpu); |
102 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 102 | sync_cache_w(&pen_release); |
103 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
104 | 103 | ||
105 | /* | 104 | /* |
106 | * Send the secondary CPU a soft interrupt, thereby causing | 105 | * Send the secondary CPU a soft interrupt, thereby causing |
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h index c612b2c4ed6c..237c86b83390 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.h +++ b/arch/arm/mach-mvebu/armada-370-xp.h | |||
@@ -18,8 +18,12 @@ | |||
18 | #ifdef CONFIG_SMP | 18 | #ifdef CONFIG_SMP |
19 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
20 | 20 | ||
21 | #define ARMADA_XP_MAX_CPUS 4 | ||
22 | |||
21 | void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq); | 23 | void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq); |
22 | void armada_xp_mpic_smp_cpu_init(void); | 24 | void armada_xp_mpic_smp_cpu_init(void); |
25 | void armada_xp_secondary_startup(void); | ||
26 | extern struct smp_operations armada_xp_smp_ops; | ||
23 | #endif | 27 | #endif |
24 | 28 | ||
25 | #endif /* __MACH_ARMADA_370_XP_H */ | 29 | #endif /* __MACH_ARMADA_370_XP_H */ |
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 58adf2fd9cfc..4e9d58148ca7 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/smp_plat.h> | 27 | #include <asm/smp_plat.h> |
28 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
29 | #include "armada-370-xp.h" | 29 | #include "armada-370-xp.h" |
30 | #include "coherency.h" | ||
30 | 31 | ||
31 | unsigned long coherency_phys_base; | 32 | unsigned long coherency_phys_base; |
32 | static void __iomem *coherency_base; | 33 | static void __iomem *coherency_base; |
diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h index df33ad8a6c08..760226c41353 100644 --- a/arch/arm/mach-mvebu/coherency.h +++ b/arch/arm/mach-mvebu/coherency.h | |||
@@ -14,7 +14,9 @@ | |||
14 | #ifndef __MACH_370_XP_COHERENCY_H | 14 | #ifndef __MACH_370_XP_COHERENCY_H |
15 | #define __MACH_370_XP_COHERENCY_H | 15 | #define __MACH_370_XP_COHERENCY_H |
16 | 16 | ||
17 | int set_cpu_coherent(int cpu_id, int smp_group_id); | 17 | extern unsigned long coherency_phys_base; |
18 | |||
19 | int set_cpu_coherent(unsigned int cpu_id, int smp_group_id); | ||
18 | int coherency_init(void); | 20 | int coherency_init(void); |
19 | 21 | ||
20 | #endif /* __MACH_370_XP_COHERENCY_H */ | 22 | #endif /* __MACH_370_XP_COHERENCY_H */ |
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h index e366010e1d91..55449c487c9e 100644 --- a/arch/arm/mach-mvebu/common.h +++ b/arch/arm/mach-mvebu/common.h | |||
@@ -15,18 +15,10 @@ | |||
15 | #ifndef __ARCH_MVEBU_COMMON_H | 15 | #ifndef __ARCH_MVEBU_COMMON_H |
16 | #define __ARCH_MVEBU_COMMON_H | 16 | #define __ARCH_MVEBU_COMMON_H |
17 | 17 | ||
18 | #define ARMADA_XP_MAX_CPUS 4 | ||
19 | |||
20 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
21 | 19 | ||
22 | void mvebu_restart(enum reboot_mode mode, const char *cmd); | 20 | void mvebu_restart(enum reboot_mode mode, const char *cmd); |
23 | 21 | ||
24 | void armada_370_xp_init_irq(void); | ||
25 | void armada_370_xp_handle_irq(struct pt_regs *regs); | ||
26 | |||
27 | void armada_xp_cpu_die(unsigned int cpu); | 22 | void armada_xp_cpu_die(unsigned int cpu); |
28 | int armada_370_xp_coherency_init(void); | 23 | |
29 | int armada_370_xp_pmsu_init(void); | ||
30 | void armada_xp_secondary_startup(void); | ||
31 | extern struct smp_operations armada_xp_smp_ops; | ||
32 | #endif | 24 | #endif |
diff --git a/arch/arm/mach-mvebu/hotplug.c b/arch/arm/mach-mvebu/hotplug.c index b228b6a80c85..d95e91047168 100644 --- a/arch/arm/mach-mvebu/hotplug.c +++ b/arch/arm/mach-mvebu/hotplug.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/smp.h> | 16 | #include <linux/smp.h> |
17 | #include <asm/proc-fns.h> | 17 | #include <asm/proc-fns.h> |
18 | #include "common.h" | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * platform-specific code to shutdown a CPU | 21 | * platform-specific code to shutdown a CPU |
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c index ff69c2df298b..a6da03f5b24e 100644 --- a/arch/arm/mach-mvebu/platsmp.c +++ b/arch/arm/mach-mvebu/platsmp.c | |||
@@ -46,7 +46,7 @@ static struct clk *__init get_cpu_clk(int cpu) | |||
46 | return cpu_clk; | 46 | return cpu_clk; |
47 | } | 47 | } |
48 | 48 | ||
49 | void __init set_secondary_cpus_clock(void) | 49 | static void __init set_secondary_cpus_clock(void) |
50 | { | 50 | { |
51 | int thiscpu, cpu; | 51 | int thiscpu, cpu; |
52 | unsigned long rate; | 52 | unsigned long rate; |
@@ -94,7 +94,7 @@ static void __init armada_xp_smp_init_cpus(void) | |||
94 | set_smp_cross_call(armada_mpic_send_doorbell); | 94 | set_smp_cross_call(armada_mpic_send_doorbell); |
95 | } | 95 | } |
96 | 96 | ||
97 | void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) | 97 | static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) |
98 | { | 98 | { |
99 | struct device_node *node; | 99 | struct device_node *node; |
100 | struct resource res; | 100 | struct resource res; |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index 27fc4f049474..d71ef53107c4 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <asm/smp_plat.h> | 24 | #include <asm/smp_plat.h> |
25 | #include "pmsu.h" | ||
25 | 26 | ||
26 | static void __iomem *pmsu_mp_base; | 27 | static void __iomem *pmsu_mp_base; |
27 | static void __iomem *pmsu_reset_base; | 28 | static void __iomem *pmsu_reset_base; |
@@ -58,7 +59,7 @@ int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr) | |||
58 | } | 59 | } |
59 | #endif | 60 | #endif |
60 | 61 | ||
61 | int __init armada_370_xp_pmsu_init(void) | 62 | static int __init armada_370_xp_pmsu_init(void) |
62 | { | 63 | { |
63 | struct device_node *np; | 64 | struct device_node *np; |
64 | 65 | ||
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c index 5175083cdb34..a7fb89a5b5d9 100644 --- a/arch/arm/mach-mvebu/system-controller.c +++ b/arch/arm/mach-mvebu/system-controller.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/of_address.h> | 27 | #include <linux/of_address.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/reboot.h> | 29 | #include <linux/reboot.h> |
30 | #include "common.h" | ||
30 | 31 | ||
31 | static void __iomem *system_controller_base; | 32 | static void __iomem *system_controller_base; |
32 | 33 | ||
@@ -39,14 +40,14 @@ struct mvebu_system_controller { | |||
39 | }; | 40 | }; |
40 | static struct mvebu_system_controller *mvebu_sc; | 41 | static struct mvebu_system_controller *mvebu_sc; |
41 | 42 | ||
42 | const struct mvebu_system_controller armada_370_xp_system_controller = { | 43 | static const struct mvebu_system_controller armada_370_xp_system_controller = { |
43 | .rstoutn_mask_offset = 0x60, | 44 | .rstoutn_mask_offset = 0x60, |
44 | .system_soft_reset_offset = 0x64, | 45 | .system_soft_reset_offset = 0x64, |
45 | .rstoutn_mask_reset_out_en = 0x1, | 46 | .rstoutn_mask_reset_out_en = 0x1, |
46 | .system_soft_reset = 0x1, | 47 | .system_soft_reset = 0x1, |
47 | }; | 48 | }; |
48 | 49 | ||
49 | const struct mvebu_system_controller orion_system_controller = { | 50 | static const struct mvebu_system_controller orion_system_controller = { |
50 | .rstoutn_mask_offset = 0x108, | 51 | .rstoutn_mask_offset = 0x108, |
51 | .system_soft_reset_offset = 0x10c, | 52 | .system_soft_reset_offset = 0x10c, |
52 | .rstoutn_mask_reset_out_en = 0x4, | 53 | .rstoutn_mask_reset_out_en = 0x4, |
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c index b91002ca92f3..c134a826070a 100644 --- a/arch/arm/mach-orion5x/board-dt.c +++ b/arch/arm/mach-orion5x/board-dt.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <plat/irq.h> | 21 | #include <plat/irq.h> |
22 | #include "common.h" | 22 | #include "common.h" |
23 | 23 | ||
24 | struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { | 24 | static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { |
25 | OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), | 25 | OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), |
26 | OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", | 26 | OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", |
27 | NULL), | 27 | NULL), |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 91a5852b44f3..3f1de1111e0f 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <asm/page.h> | 24 | #include <asm/page.h> |
25 | #include <asm/setup.h> | 25 | #include <asm/setup.h> |
26 | #include <asm/system_misc.h> | 26 | #include <asm/system_misc.h> |
27 | #include <asm/timex.h> | ||
28 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
29 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
30 | #include <asm/mach/time.h> | 29 | #include <asm/mach/time.h> |
@@ -135,7 +134,7 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) | |||
135 | /***************************************************************************** | 134 | /***************************************************************************** |
136 | * SPI | 135 | * SPI |
137 | ****************************************************************************/ | 136 | ****************************************************************************/ |
138 | void __init orion5x_spi_init() | 137 | void __init orion5x_spi_init(void) |
139 | { | 138 | { |
140 | orion_spi_init(SPI_PHYS_BASE); | 139 | orion_spi_init(SPI_PHYS_BASE); |
141 | } | 140 | } |
@@ -185,7 +184,7 @@ static void __init orion5x_crypto_init(void) | |||
185 | /***************************************************************************** | 184 | /***************************************************************************** |
186 | * Watchdog | 185 | * Watchdog |
187 | ****************************************************************************/ | 186 | ****************************************************************************/ |
188 | void __init orion5x_wdt_init(void) | 187 | static void __init orion5x_wdt_init(void) |
189 | { | 188 | { |
190 | orion_wdt_init(); | 189 | orion_wdt_init(); |
191 | } | 190 | } |
@@ -246,7 +245,7 @@ void orion5x_setup_wins(void) | |||
246 | 245 | ||
247 | int orion5x_tclk; | 246 | int orion5x_tclk; |
248 | 247 | ||
249 | int __init orion5x_find_tclk(void) | 248 | static int __init orion5x_find_tclk(void) |
250 | { | 249 | { |
251 | u32 dev, rev; | 250 | u32 dev, rev; |
252 | 251 | ||
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c index 4b2aefd1d961..dc01c4ffc9a8 100644 --- a/arch/arm/mach-orion5x/db88f5281-setup.c +++ b/arch/arm/mach-orion5x/db88f5281-setup.c | |||
@@ -202,7 +202,7 @@ __initcall(db88f5281_7seg_init); | |||
202 | * PCI | 202 | * PCI |
203 | ****************************************************************************/ | 203 | ****************************************************************************/ |
204 | 204 | ||
205 | void __init db88f5281_pci_preinit(void) | 205 | static void __init db88f5281_pci_preinit(void) |
206 | { | 206 | { |
207 | int pin; | 207 | int pin; |
208 | 208 | ||
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c index 30a192b9c517..9654b0cc5892 100644 --- a/arch/arm/mach-orion5x/irq.c +++ b/arch/arm/mach-orion5x/irq.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <mach/bridge-regs.h> | 16 | #include <mach/bridge-regs.h> |
17 | #include <plat/orion-gpio.h> | 17 | #include <plat/orion-gpio.h> |
18 | #include <plat/irq.h> | 18 | #include <plat/irq.h> |
19 | #include "common.h" | ||
19 | 20 | ||
20 | static int __initdata gpio0_irqs[4] = { | 21 | static int __initdata gpio0_irqs[4] = { |
21 | IRQ_ORION5X_GPIO_0_7, | 22 | IRQ_ORION5X_GPIO_0_7, |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 7fab67053030..87a12d6930ff 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -240,11 +240,11 @@ static int __init pcie_setup(struct pci_sys_data *sys) | |||
240 | #define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ | 240 | #define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ |
241 | ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ | 241 | ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ |
242 | ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ | 242 | ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ |
243 | ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0) | 243 | ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : NULL) |
244 | #define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \ | 244 | #define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \ |
245 | ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ | 245 | ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ |
246 | ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ | 246 | ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ |
247 | ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0) | 247 | ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : NULL) |
248 | #define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) | 248 | #define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) |
249 | #define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) | 249 | #define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) |
250 | 250 | ||
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index b1cf68493ffc..b576ef5f18a1 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -108,7 +108,7 @@ static struct platform_device rd88f5182_gpio_leds = { | |||
108 | * PCI | 108 | * PCI |
109 | ****************************************************************************/ | 109 | ****************************************************************************/ |
110 | 110 | ||
111 | void __init rd88f5182_pci_preinit(void) | 111 | static void __init rd88f5182_pci_preinit(void) |
112 | { | 112 | { |
113 | int pin; | 113 | int pin; |
114 | 114 | ||
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c index 7e9064844698..6208d125c1b9 100644 --- a/arch/arm/mach-orion5x/terastation_pro2-setup.c +++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c | |||
@@ -77,7 +77,7 @@ static struct platform_device tsp2_nor_flash = { | |||
77 | #define TSP2_PCI_SLOT0_OFFS 7 | 77 | #define TSP2_PCI_SLOT0_OFFS 7 |
78 | #define TSP2_PCI_SLOT0_IRQ_PIN 11 | 78 | #define TSP2_PCI_SLOT0_IRQ_PIN 11 |
79 | 79 | ||
80 | void __init tsp2_pci_preinit(void) | 80 | static void __init tsp2_pci_preinit(void) |
81 | { | 81 | { |
82 | int pin; | 82 | int pin; |
83 | 83 | ||
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c index e90c0618fdad..9136797addb2 100644 --- a/arch/arm/mach-orion5x/ts209-setup.c +++ b/arch/arm/mach-orion5x/ts209-setup.c | |||
@@ -106,7 +106,7 @@ static struct platform_device qnap_ts209_nor_flash = { | |||
106 | #define QNAP_TS209_PCI_SLOT0_IRQ_PIN 6 | 106 | #define QNAP_TS209_PCI_SLOT0_IRQ_PIN 6 |
107 | #define QNAP_TS209_PCI_SLOT1_IRQ_PIN 7 | 107 | #define QNAP_TS209_PCI_SLOT1_IRQ_PIN 7 |
108 | 108 | ||
109 | void __init qnap_ts209_pci_preinit(void) | 109 | static void __init qnap_ts209_pci_preinit(void) |
110 | { | 110 | { |
111 | int pin; | 111 | int pin; |
112 | 112 | ||
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c index e960855d32ac..db16dae441e2 100644 --- a/arch/arm/mach-orion5x/ts78xx-setup.c +++ b/arch/arm/mach-orion5x/ts78xx-setup.c | |||
@@ -57,7 +57,7 @@ static struct map_desc ts78xx_io_desc[] __initdata = { | |||
57 | }, | 57 | }, |
58 | }; | 58 | }; |
59 | 59 | ||
60 | void __init ts78xx_map_io(void) | 60 | static void __init ts78xx_map_io(void) |
61 | { | 61 | { |
62 | orion5x_map_io(); | 62 | orion5x_map_io(); |
63 | iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc)); | 63 | iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc)); |
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c index 3dbcb1ab6e37..e358b0736dea 100644 --- a/arch/arm/mach-prima2/platsmp.c +++ b/arch/arm/mach-prima2/platsmp.c | |||
@@ -106,8 +106,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
106 | * "cpu" is Linux's internal ID. | 106 | * "cpu" is Linux's internal ID. |
107 | */ | 107 | */ |
108 | pen_release = cpu_logical_map(cpu); | 108 | pen_release = cpu_logical_map(cpu); |
109 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 109 | sync_cache_w(&pen_release); |
110 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
111 | 110 | ||
112 | /* | 111 | /* |
113 | * Send the secondary CPU SEV, thereby causing the boot monitor to read | 112 | * Send the secondary CPU SEV, thereby causing the boot monitor to read |
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c index ffa6d811aad8..12fb0f4ae359 100644 --- a/arch/arm/mach-pxa/am200epd.c +++ b/arch/arm/mach-pxa/am200epd.c | |||
@@ -293,8 +293,7 @@ static int am200_setup_irq(struct fb_info *info) | |||
293 | int ret; | 293 | int ret; |
294 | 294 | ||
295 | ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq, | 295 | ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq, |
296 | IRQF_DISABLED|IRQF_TRIGGER_FALLING, | 296 | IRQF_TRIGGER_FALLING, "AM200", info->par); |
297 | "AM200", info->par); | ||
298 | if (ret) | 297 | if (ret) |
299 | dev_err(&am200_device->dev, "request_irq failed: %d\n", ret); | 298 | dev_err(&am200_device->dev, "request_irq failed: %d\n", ret); |
300 | 299 | ||
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c index 3dfec1ec462d..c9f309ae88c5 100644 --- a/arch/arm/mach-pxa/am300epd.c +++ b/arch/arm/mach-pxa/am300epd.c | |||
@@ -241,8 +241,7 @@ static int am300_setup_irq(struct fb_info *info) | |||
241 | struct broadsheetfb_par *par = info->par; | 241 | struct broadsheetfb_par *par = info->par; |
242 | 242 | ||
243 | ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq, | 243 | ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq, |
244 | IRQF_DISABLED|IRQF_TRIGGER_RISING, | 244 | IRQF_TRIGGER_RISING, "AM300", par); |
245 | "AM300", par); | ||
246 | if (ret) | 245 | if (ret) |
247 | dev_err(&am300_device->dev, "request_irq failed: %d\n", ret); | 246 | dev_err(&am300_device->dev, "request_irq failed: %d\n", ret); |
248 | 247 | ||
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 8eb4e23c561d..6915a9f6b3a3 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -564,8 +564,7 @@ static int em_x270_mci_init(struct device *dev, | |||
564 | } | 564 | } |
565 | 565 | ||
566 | err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int, | 566 | err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int, |
567 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | 567 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
568 | IRQF_TRIGGER_FALLING, | ||
569 | "MMC card detect", data); | 568 | "MMC card detect", data); |
570 | if (err) { | 569 | if (err) { |
571 | dev_err(dev, "can't request MMC card detect IRQ: %d\n", err); | 570 | dev_err(dev, "can't request MMC card detect IRQ: %d\n", err); |
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index b6cc1816463e..0eecd83c624e 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c | |||
@@ -235,8 +235,6 @@ static const struct of_device_id intc_ids[] __initconst = { | |||
235 | void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)) | 235 | void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)) |
236 | { | 236 | { |
237 | struct device_node *node; | 237 | struct device_node *node; |
238 | const struct of_device_id *of_id; | ||
239 | struct pxa_intc_conf *conf; | ||
240 | struct resource res; | 238 | struct resource res; |
241 | int n, ret; | 239 | int n, ret; |
242 | 240 | ||
@@ -245,8 +243,6 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)) | |||
245 | pr_err("Failed to find interrupt controller in arch-pxa\n"); | 243 | pr_err("Failed to find interrupt controller in arch-pxa\n"); |
246 | return; | 244 | return; |
247 | } | 245 | } |
248 | of_id = of_match_node(intc_ids, node); | ||
249 | conf = of_id->data; | ||
250 | 246 | ||
251 | ret = of_property_read_u32(node, "marvell,intc-nr-irqs", | 247 | ret = of_property_read_u32(node, "marvell,intc-nr-irqs", |
252 | &pxa_internal_irq_nr); | 248 | &pxa_internal_irq_nr); |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index fab30d666cc7..a9761c293028 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -634,7 +634,7 @@ static struct platform_device bq24022 = { | |||
634 | static int magician_mci_init(struct device *dev, | 634 | static int magician_mci_init(struct device *dev, |
635 | irq_handler_t detect_irq, void *data) | 635 | irq_handler_t detect_irq, void *data) |
636 | { | 636 | { |
637 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, IRQF_DISABLED, | 637 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0, |
638 | "mmc card detect", data); | 638 | "mmc card detect", data); |
639 | } | 639 | } |
640 | 640 | ||
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 08ccc0718f31..78b84c0dfc79 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -401,7 +401,7 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in | |||
401 | */ | 401 | */ |
402 | MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL; | 402 | MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL; |
403 | 403 | ||
404 | err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED, | 404 | err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, 0, |
405 | "MMC card detect", data); | 405 | "MMC card detect", data); |
406 | if (err) | 406 | if (err) |
407 | printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 407 | printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 9a4e470f162b..2897da2a5df6 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -327,7 +327,7 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int, | |||
327 | { | 327 | { |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED, | 330 | err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, 0, |
331 | "MMC card detect", data); | 331 | "MMC card detect", data); |
332 | if (err) | 332 | if (err) |
333 | printk(KERN_ERR "pcm990_mci_init: MMC/SD: can't request MMC " | 333 | printk(KERN_ERR "pcm990_mci_init: MMC/SD: can't request MMC " |
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 0a36d3585f26..051a6555cbf9 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -860,18 +860,18 @@ static int sharpsl_pm_probe(struct platform_device *pdev) | |||
860 | 860 | ||
861 | /* Register interrupt handlers */ | 861 | /* Register interrupt handlers */ |
862 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_acin); | 862 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_acin); |
863 | if (request_irq(irq, sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) { | 863 | if (request_irq(irq, sharpsl_ac_isr, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) { |
864 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); | 864 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); |
865 | } | 865 | } |
866 | 866 | ||
867 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock); | 867 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock); |
868 | if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) { | 868 | if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) { |
869 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); | 869 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); |
870 | } | 870 | } |
871 | 871 | ||
872 | if (sharpsl_pm.machinfo->gpio_fatal) { | 872 | if (sharpsl_pm.machinfo->gpio_fatal) { |
873 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal); | 873 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal); |
874 | if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) { | 874 | if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) { |
875 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); | 875 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); |
876 | } | 876 | } |
877 | } | 877 | } |
@@ -879,7 +879,7 @@ static int sharpsl_pm_probe(struct platform_device *pdev) | |||
879 | if (sharpsl_pm.machinfo->batfull_irq) { | 879 | if (sharpsl_pm.machinfo->batfull_irq) { |
880 | /* Register interrupt handler. */ | 880 | /* Register interrupt handler. */ |
881 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull); | 881 | irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull); |
882 | if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { | 882 | if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { |
883 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); | 883 | dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); |
884 | } | 884 | } |
885 | } | 885 | } |
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index 9aa852a8fab9..5fdc9c4f05be 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c | |||
@@ -137,7 +137,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = { | |||
137 | 137 | ||
138 | static struct irqaction pxa_ost0_irq = { | 138 | static struct irqaction pxa_ost0_irq = { |
139 | .name = "ost0", | 139 | .name = "ost0", |
140 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 140 | .flags = IRQF_TIMER | IRQF_IRQPOLL, |
141 | .handler = pxa_ost0_interrupt, | 141 | .handler = pxa_ost0_interrupt, |
142 | .dev_id = &ckevt_pxa_osmr0, | 142 | .dev_id = &ckevt_pxa_osmr0, |
143 | }; | 143 | }; |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index c58043462acd..872dcb20e757 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -332,8 +332,7 @@ static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int, | |||
332 | int err; | 332 | int err; |
333 | 333 | ||
334 | err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int, | 334 | err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int, |
335 | IRQF_DISABLED | IRQF_TRIGGER_RISING, | 335 | IRQF_TRIGGER_RISING, "MMC card detect", data); |
336 | "MMC card detect", data); | ||
337 | if (err) { | 336 | if (err) { |
338 | printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request" | 337 | printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request" |
339 | "MMC card detect IRQ\n"); | 338 | "MMC card detect IRQ\n"); |
diff --git a/arch/arm/mach-s3c24xx/dma.c b/arch/arm/mach-s3c24xx/dma.c index 4a65cba3295d..a8dafc174fe3 100644 --- a/arch/arm/mach-s3c24xx/dma.c +++ b/arch/arm/mach-s3c24xx/dma.c | |||
@@ -742,7 +742,7 @@ int s3c2410_dma_request(enum dma_ch channel, | |||
742 | chan->irq_claimed = 1; | 742 | chan->irq_claimed = 1; |
743 | local_irq_restore(flags); | 743 | local_irq_restore(flags); |
744 | 744 | ||
745 | err = request_irq(chan->irq, s3c2410_dma_irq, IRQF_DISABLED, | 745 | err = request_irq(chan->irq, s3c2410_dma_irq, 0, |
746 | client->name, (void *)chan); | 746 | client->name, (void *)chan); |
747 | 747 | ||
748 | local_irq_save(flags); | 748 | local_irq_save(flags); |
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c index 8dea917e954b..b70aa66efebe 100644 --- a/arch/arm/mach-s3c24xx/simtec-usb.c +++ b/arch/arm/mach-s3c24xx/simtec-usb.c | |||
@@ -79,8 +79,7 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on) | |||
79 | 79 | ||
80 | if (on) { | 80 | if (on) { |
81 | ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq, | 81 | ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq, |
82 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | 82 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
83 | IRQF_TRIGGER_FALLING, | ||
84 | "USB Over-current", info); | 83 | "USB Over-current", info); |
85 | if (ret != 0) { | 84 | if (ret != 0) { |
86 | printk(KERN_ERR "failed to request usb oc irq\n"); | 85 | printk(KERN_ERR "failed to request usb oc irq\n"); |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index 5629df905fcd..6e72bd5c1d0c 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c | |||
@@ -107,7 +107,7 @@ static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on) | |||
107 | 107 | ||
108 | if (on) { | 108 | if (on) { |
109 | ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)), | 109 | ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)), |
110 | smartq_usb_host_ocirq, IRQF_DISABLED | | 110 | smartq_usb_host_ocirq, |
111 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 111 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
112 | "USB host overcurrent", info); | 112 | "USB host overcurrent", info); |
113 | if (ret != 0) | 113 | if (ret != 0) |
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c index 0fa068e30a30..fe071a9130b7 100644 --- a/arch/arm/mach-shmobile/board-ape6evm.c +++ b/arch/arm/mach-shmobile/board-ape6evm.c | |||
@@ -168,7 +168,7 @@ static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = { | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | static const struct resource mmcif0_resources[] __initconst = { | 170 | static const struct resource mmcif0_resources[] __initconst = { |
171 | DEFINE_RES_MEM_NAMED(0xee200000, 0x100, "MMCIF0"), | 171 | DEFINE_RES_MEM(0xee200000, 0x100), |
172 | DEFINE_RES_IRQ(gic_spi(169)), | 172 | DEFINE_RES_IRQ(gic_spi(169)), |
173 | }; | 173 | }; |
174 | 174 | ||
@@ -179,7 +179,7 @@ static const struct sh_mobile_sdhi_info sdhi0_pdata __initconst = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static const struct resource sdhi0_resources[] __initconst = { | 181 | static const struct resource sdhi0_resources[] __initconst = { |
182 | DEFINE_RES_MEM_NAMED(0xee100000, 0x100, "SDHI0"), | 182 | DEFINE_RES_MEM(0xee100000, 0x100), |
183 | DEFINE_RES_IRQ(gic_spi(165)), | 183 | DEFINE_RES_IRQ(gic_spi(165)), |
184 | }; | 184 | }; |
185 | 185 | ||
@@ -191,7 +191,7 @@ static const struct sh_mobile_sdhi_info sdhi1_pdata __initconst = { | |||
191 | }; | 191 | }; |
192 | 192 | ||
193 | static const struct resource sdhi1_resources[] __initconst = { | 193 | static const struct resource sdhi1_resources[] __initconst = { |
194 | DEFINE_RES_MEM_NAMED(0xee120000, 0x100, "SDHI1"), | 194 | DEFINE_RES_MEM(0xee120000, 0x100), |
195 | DEFINE_RES_IRQ(gic_spi(166)), | 195 | DEFINE_RES_IRQ(gic_spi(166)), |
196 | }; | 196 | }; |
197 | 197 | ||
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c index ae88fdad4b3a..1687df9b267f 100644 --- a/arch/arm/mach-shmobile/board-bockw-reference.c +++ b/arch/arm/mach-shmobile/board-bockw-reference.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
22 | #include <linux/pinctrl/machine.h> | ||
23 | #include <mach/common.h> | 22 | #include <mach/common.h> |
24 | #include <mach/r8a7778.h> | 23 | #include <mach/r8a7778.h> |
25 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c index 1a1a4a888632..7df9ea0839db 100644 --- a/arch/arm/mach-shmobile/board-lager-reference.c +++ b/arch/arm/mach-shmobile/board-lager-reference.c | |||
@@ -20,16 +20,15 @@ | |||
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <mach/rcar-gen2.h> | ||
23 | #include <mach/r8a7790.h> | 24 | #include <mach/r8a7790.h> |
24 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
25 | 26 | ||
26 | static void __init lager_add_standard_devices(void) | 27 | static void __init lager_add_standard_devices(void) |
27 | { | 28 | { |
28 | /* clocks are setup late during boot in the case of DT */ | ||
29 | r8a7790_clock_init(); | 29 | r8a7790_clock_init(); |
30 | |||
31 | r8a7790_add_dt_devices(); | 30 | r8a7790_add_dt_devices(); |
32 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 31 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
33 | } | 32 | } |
34 | 33 | ||
35 | static const char *lager_boards_compat_dt[] __initdata = { | 34 | static const char *lager_boards_compat_dt[] __initdata = { |
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index e0406fd37390..d1a8dddecfc8 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c | |||
@@ -148,7 +148,7 @@ static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = { | |||
148 | }; | 148 | }; |
149 | 149 | ||
150 | static const struct resource mmcif1_resources[] __initconst = { | 150 | static const struct resource mmcif1_resources[] __initconst = { |
151 | DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"), | 151 | DEFINE_RES_MEM(0xee220000, 0x80), |
152 | DEFINE_RES_IRQ(gic_spi(170)), | 152 | DEFINE_RES_IRQ(gic_spi(170)), |
153 | }; | 153 | }; |
154 | 154 | ||
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index da1352f5f71b..4f9e3ec42ddc 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/leds.h> | 29 | #include <linux/leds.h> |
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/pinctrl/machine.h> | 31 | #include <linux/pinctrl/machine.h> |
32 | #include <linux/platform_data/camera-rcar.h> | ||
32 | #include <linux/platform_data/gpio-rcar.h> | 33 | #include <linux/platform_data/gpio-rcar.h> |
33 | #include <linux/platform_data/rcar-du.h> | 34 | #include <linux/platform_data/rcar-du.h> |
34 | #include <linux/platform_data/usb-rcar-phy.h> | 35 | #include <linux/platform_data/usb-rcar-phy.h> |
@@ -259,10 +260,30 @@ static struct platform_device leds_device = { | |||
259 | }, | 260 | }, |
260 | }; | 261 | }; |
261 | 262 | ||
263 | /* VIN */ | ||
262 | static struct rcar_vin_platform_data vin_platform_data __initdata = { | 264 | static struct rcar_vin_platform_data vin_platform_data __initdata = { |
263 | .flags = RCAR_VIN_BT656, | 265 | .flags = RCAR_VIN_BT656, |
264 | }; | 266 | }; |
265 | 267 | ||
268 | #define MARZEN_VIN(idx) \ | ||
269 | static struct resource vin##idx##_resources[] __initdata = { \ | ||
270 | DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ | ||
271 | DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \ | ||
272 | }; \ | ||
273 | \ | ||
274 | static struct platform_device_info vin##idx##_info __initdata = { \ | ||
275 | .parent = &platform_bus, \ | ||
276 | .name = "r8a7779-vin", \ | ||
277 | .id = idx, \ | ||
278 | .res = vin##idx##_resources, \ | ||
279 | .num_res = ARRAY_SIZE(vin##idx##_resources), \ | ||
280 | .dma_mask = DMA_BIT_MASK(32), \ | ||
281 | .data = &vin_platform_data, \ | ||
282 | .size_data = sizeof(vin_platform_data), \ | ||
283 | } | ||
284 | MARZEN_VIN(1); | ||
285 | MARZEN_VIN(3); | ||
286 | |||
266 | #define MARZEN_CAMERA(idx) \ | 287 | #define MARZEN_CAMERA(idx) \ |
267 | static struct i2c_board_info camera##idx##_info = { \ | 288 | static struct i2c_board_info camera##idx##_info = { \ |
268 | I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \ | 289 | I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \ |
@@ -367,8 +388,8 @@ static void __init marzen_init(void) | |||
367 | r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ | 388 | r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ |
368 | 389 | ||
369 | r8a7779_add_standard_devices(); | 390 | r8a7779_add_standard_devices(); |
370 | r8a7779_add_vin_device(1, &vin_platform_data); | 391 | platform_device_register_full(&vin1_info); |
371 | r8a7779_add_vin_device(3, &vin_platform_data); | 392 | platform_device_register_full(&vin3_info); |
372 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); | 393 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); |
373 | marzen_add_du_device(); | 394 | marzen_add_du_device(); |
374 | } | 395 | } |
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c index 4aba20ca127e..0814a508fd61 100644 --- a/arch/arm/mach-shmobile/clock-r7s72100.c +++ b/arch/arm/mach-shmobile/clock-r7s72100.c | |||
@@ -170,6 +170,9 @@ static struct clk_lookup lookups[] = { | |||
170 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), | 170 | CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), |
171 | 171 | ||
172 | /* MSTP clocks */ | 172 | /* MSTP clocks */ |
173 | CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), | ||
174 | |||
175 | /* ICK */ | ||
173 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]), | 176 | CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]), |
174 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]), | 177 | CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]), |
175 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]), | 178 | CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]), |
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index a64f965c7da1..fa1b4773677a 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -77,7 +77,7 @@ static struct sh_clk_ops followparent_clk_ops = { | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | static struct clk main_clk = { | 79 | static struct clk main_clk = { |
80 | /* .parent will be set r8a73a4_clock_init */ | 80 | /* .parent will be set r8a7790_clock_init */ |
81 | .ops = &followparent_clk_ops, | 81 | .ops = &followparent_clk_ops, |
82 | }; | 82 | }; |
83 | 83 | ||
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 5390c6bbbc02..28489978b09c 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -504,10 +504,6 @@ static struct clk_lookup lookups[] = { | |||
504 | CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), | 504 | CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), |
505 | CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), | 505 | CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), |
506 | CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]), | 506 | CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]), |
507 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | ||
508 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | ||
509 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | ||
510 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), | ||
511 | 507 | ||
512 | /* MSTP32 clocks */ | 508 | /* MSTP32 clocks */ |
513 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ | 509 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ |
@@ -574,6 +570,11 @@ static struct clk_lookup lookups[] = { | |||
574 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 570 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
575 | CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */ | 571 | CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */ |
576 | 572 | ||
573 | /* ICK */ | ||
574 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | ||
575 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | ||
576 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | ||
577 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), | ||
577 | CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1", | 578 | CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1", |
578 | &div6_reparent_clks[DIV6_HDMI]), | 579 | &div6_reparent_clks[DIV6_HDMI]), |
579 | CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), | 580 | CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index c92c023f0d27..2aeec468cf7c 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -625,12 +625,6 @@ static struct clk_lookup lookups[] = { | |||
625 | CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), | 625 | CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), |
626 | CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), | 626 | CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), |
627 | CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), | 627 | CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), |
628 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | ||
629 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | ||
630 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | ||
631 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), | ||
632 | CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), | ||
633 | CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), | ||
634 | 628 | ||
635 | /* MSTP32 clocks */ | 629 | /* MSTP32 clocks */ |
636 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ | 630 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ |
@@ -680,6 +674,14 @@ static struct clk_lookup lookups[] = { | |||
680 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ | 674 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ |
681 | CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */ | 675 | CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */ |
682 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 676 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
677 | |||
678 | /* ICK */ | ||
679 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | ||
680 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | ||
681 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | ||
682 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), | ||
683 | CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), | ||
684 | CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), | ||
683 | }; | 685 | }; |
684 | 686 | ||
685 | void __init sh73a0_clock_init(void) | 687 | void __init sh73a0_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h index 17af34ed89c8..b40e13631f6a 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/sh_clk.h> | 4 | #include <linux/sh_clk.h> |
5 | #include <linux/pm_domain.h> | 5 | #include <linux/pm_domain.h> |
6 | #include <linux/sh_eth.h> | ||
7 | #include <linux/platform_data/camera-rcar.h> | ||
8 | 6 | ||
9 | /* HPB-DMA slave IDs */ | 7 | /* HPB-DMA slave IDs */ |
10 | enum { | 8 | enum { |
@@ -13,8 +11,6 @@ enum { | |||
13 | HPBDMA_SLAVE_SDHI0_RX, | 11 | HPBDMA_SLAVE_SDHI0_RX, |
14 | }; | 12 | }; |
15 | 13 | ||
16 | struct platform_device; | ||
17 | |||
18 | struct r8a7779_pm_ch { | 14 | struct r8a7779_pm_ch { |
19 | unsigned long chan_offs; | 15 | unsigned long chan_offs; |
20 | unsigned int chan_bit; | 16 | unsigned int chan_bit; |
@@ -40,9 +36,6 @@ extern void r8a7779_earlytimer_init(void); | |||
40 | extern void r8a7779_add_early_devices(void); | 36 | extern void r8a7779_add_early_devices(void); |
41 | extern void r8a7779_add_standard_devices(void); | 37 | extern void r8a7779_add_standard_devices(void); |
42 | extern void r8a7779_add_standard_devices_dt(void); | 38 | extern void r8a7779_add_standard_devices_dt(void); |
43 | extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); | ||
44 | extern void r8a7779_add_vin_device(int idx, | ||
45 | struct rcar_vin_platform_data *pdata); | ||
46 | extern void r8a7779_init_late(void); | 39 | extern void r8a7779_init_late(void); |
47 | extern void r8a7779_clock_init(void); | 40 | extern void r8a7779_clock_init(void); |
48 | extern void r8a7779_pinmux_init(void); | 41 | extern void r8a7779_pinmux_init(void); |
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index 13049e9d691c..8f9453152fb9 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -598,45 +598,6 @@ static struct platform_device ohci1_device = { | |||
598 | .resource = ohci1_resources, | 598 | .resource = ohci1_resources, |
599 | }; | 599 | }; |
600 | 600 | ||
601 | /* Ether */ | ||
602 | static struct resource ether_resources[] __initdata = { | ||
603 | { | ||
604 | .start = 0xfde00000, | ||
605 | .end = 0xfde003ff, | ||
606 | .flags = IORESOURCE_MEM, | ||
607 | }, { | ||
608 | .start = gic_iid(0xb4), | ||
609 | .flags = IORESOURCE_IRQ, | ||
610 | }, | ||
611 | }; | ||
612 | |||
613 | #define R8A7779_VIN(idx) \ | ||
614 | static struct resource vin##idx##_resources[] __initdata = { \ | ||
615 | DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ | ||
616 | DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \ | ||
617 | }; \ | ||
618 | \ | ||
619 | static struct platform_device_info vin##idx##_info __initdata = { \ | ||
620 | .parent = &platform_bus, \ | ||
621 | .name = "r8a7779-vin", \ | ||
622 | .id = idx, \ | ||
623 | .res = vin##idx##_resources, \ | ||
624 | .num_res = ARRAY_SIZE(vin##idx##_resources), \ | ||
625 | .dma_mask = DMA_BIT_MASK(32), \ | ||
626 | } | ||
627 | |||
628 | R8A7779_VIN(0); | ||
629 | R8A7779_VIN(1); | ||
630 | R8A7779_VIN(2); | ||
631 | R8A7779_VIN(3); | ||
632 | |||
633 | static struct platform_device_info *vin_info_table[] __initdata = { | ||
634 | &vin0_info, | ||
635 | &vin1_info, | ||
636 | &vin2_info, | ||
637 | &vin3_info, | ||
638 | }; | ||
639 | |||
640 | /* HPB-DMA */ | 601 | /* HPB-DMA */ |
641 | 602 | ||
642 | /* Asynchronous mode register bits */ | 603 | /* Asynchronous mode register bits */ |
@@ -825,24 +786,6 @@ void __init r8a7779_add_standard_devices(void) | |||
825 | r8a7779_register_hpb_dmae(); | 786 | r8a7779_register_hpb_dmae(); |
826 | } | 787 | } |
827 | 788 | ||
828 | void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) | ||
829 | { | ||
830 | platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1, | ||
831 | ether_resources, | ||
832 | ARRAY_SIZE(ether_resources), | ||
833 | pdata, sizeof(*pdata)); | ||
834 | } | ||
835 | |||
836 | void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata) | ||
837 | { | ||
838 | BUG_ON(id < 0 || id > 3); | ||
839 | |||
840 | vin_info_table[id]->data = pdata; | ||
841 | vin_info_table[id]->size_data = sizeof(*pdata); | ||
842 | |||
843 | platform_device_register_full(vin_info_table[id]); | ||
844 | } | ||
845 | |||
846 | /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ | 789 | /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ |
847 | void __init __weak r8a7779_register_twd(void) { } | 790 | void __init __weak r8a7779_register_twd(void) { } |
848 | 791 | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index c47bcebbcb00..3543c3bacb75 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c | |||
@@ -34,6 +34,10 @@ static const struct resource pfc_resources[] __initconst = { | |||
34 | DEFINE_RES_MEM(0xe6060000, 0x250), | 34 | DEFINE_RES_MEM(0xe6060000, 0x250), |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define r8a7790_register_pfc() \ | ||
38 | platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, \ | ||
39 | ARRAY_SIZE(pfc_resources)) | ||
40 | |||
37 | #define R8A7790_GPIO(idx) \ | 41 | #define R8A7790_GPIO(idx) \ |
38 | static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \ | 42 | static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \ |
39 | DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \ | 43 | DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \ |
@@ -65,8 +69,7 @@ R8A7790_GPIO(5); | |||
65 | 69 | ||
66 | void __init r8a7790_pinmux_init(void) | 70 | void __init r8a7790_pinmux_init(void) |
67 | { | 71 | { |
68 | platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, | 72 | r8a7790_register_pfc(); |
69 | ARRAY_SIZE(pfc_resources)); | ||
70 | r8a7790_register_gpio(0); | 73 | r8a7790_register_gpio(0); |
71 | r8a7790_register_gpio(1); | 74 | r8a7790_register_gpio(1); |
72 | r8a7790_register_gpio(2); | 75 | r8a7790_register_gpio(2); |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 22de17417fd7..65151c48cbd4 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -273,7 +273,7 @@ static struct sh_timer_config tmu00_platform_data = { | |||
273 | }; | 273 | }; |
274 | 274 | ||
275 | static struct resource tmu00_resources[] = { | 275 | static struct resource tmu00_resources[] = { |
276 | [0] = DEFINE_RES_MEM_NAMED(0xfff60008, 0xc, "TMU00"), | 276 | [0] = DEFINE_RES_MEM(0xfff60008, 0xc), |
277 | [1] = { | 277 | [1] = { |
278 | .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ | 278 | .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ |
279 | .flags = IORESOURCE_IRQ, | 279 | .flags = IORESOURCE_IRQ, |
@@ -298,7 +298,7 @@ static struct sh_timer_config tmu01_platform_data = { | |||
298 | }; | 298 | }; |
299 | 299 | ||
300 | static struct resource tmu01_resources[] = { | 300 | static struct resource tmu01_resources[] = { |
301 | [0] = DEFINE_RES_MEM_NAMED(0xfff60014, 0xc, "TMU00"), | 301 | [0] = DEFINE_RES_MEM(0xfff60014, 0xc), |
302 | [1] = { | 302 | [1] = { |
303 | .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */ | 303 | .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */ |
304 | .flags = IORESOURCE_IRQ, | 304 | .flags = IORESOURCE_IRQ, |
@@ -316,7 +316,7 @@ static struct platform_device tmu01_device = { | |||
316 | }; | 316 | }; |
317 | 317 | ||
318 | static struct resource i2c0_resources[] = { | 318 | static struct resource i2c0_resources[] = { |
319 | [0] = DEFINE_RES_MEM_NAMED(0xe6820000, 0x426, "IIC0"), | 319 | [0] = DEFINE_RES_MEM(0xe6820000, 0x426), |
320 | [1] = { | 320 | [1] = { |
321 | .start = gic_spi(167), | 321 | .start = gic_spi(167), |
322 | .end = gic_spi(170), | 322 | .end = gic_spi(170), |
@@ -325,7 +325,7 @@ static struct resource i2c0_resources[] = { | |||
325 | }; | 325 | }; |
326 | 326 | ||
327 | static struct resource i2c1_resources[] = { | 327 | static struct resource i2c1_resources[] = { |
328 | [0] = DEFINE_RES_MEM_NAMED(0xe6822000, 0x426, "IIC1"), | 328 | [0] = DEFINE_RES_MEM(0xe6822000, 0x426), |
329 | [1] = { | 329 | [1] = { |
330 | .start = gic_spi(51), | 330 | .start = gic_spi(51), |
331 | .end = gic_spi(54), | 331 | .end = gic_spi(54), |
@@ -334,7 +334,7 @@ static struct resource i2c1_resources[] = { | |||
334 | }; | 334 | }; |
335 | 335 | ||
336 | static struct resource i2c2_resources[] = { | 336 | static struct resource i2c2_resources[] = { |
337 | [0] = DEFINE_RES_MEM_NAMED(0xe6824000, 0x426, "IIC2"), | 337 | [0] = DEFINE_RES_MEM(0xe6824000, 0x426), |
338 | [1] = { | 338 | [1] = { |
339 | .start = gic_spi(171), | 339 | .start = gic_spi(171), |
340 | .end = gic_spi(174), | 340 | .end = gic_spi(174), |
@@ -343,7 +343,7 @@ static struct resource i2c2_resources[] = { | |||
343 | }; | 343 | }; |
344 | 344 | ||
345 | static struct resource i2c3_resources[] = { | 345 | static struct resource i2c3_resources[] = { |
346 | [0] = DEFINE_RES_MEM_NAMED(0xe6826000, 0x426, "IIC3"), | 346 | [0] = DEFINE_RES_MEM(0xe6826000, 0x426), |
347 | [1] = { | 347 | [1] = { |
348 | .start = gic_spi(183), | 348 | .start = gic_spi(183), |
349 | .end = gic_spi(186), | 349 | .end = gic_spi(186), |
@@ -352,7 +352,7 @@ static struct resource i2c3_resources[] = { | |||
352 | }; | 352 | }; |
353 | 353 | ||
354 | static struct resource i2c4_resources[] = { | 354 | static struct resource i2c4_resources[] = { |
355 | [0] = DEFINE_RES_MEM_NAMED(0xe6828000, 0x426, "IIC4"), | 355 | [0] = DEFINE_RES_MEM(0xe6828000, 0x426), |
356 | [1] = { | 356 | [1] = { |
357 | .start = gic_spi(187), | 357 | .start = gic_spi(187), |
358 | .end = gic_spi(190), | 358 | .end = gic_spi(190), |
@@ -722,7 +722,7 @@ static struct platform_device pmu_device = { | |||
722 | 722 | ||
723 | /* an IPMMU module for ICB */ | 723 | /* an IPMMU module for ICB */ |
724 | static struct resource ipmmu_resources[] = { | 724 | static struct resource ipmmu_resources[] = { |
725 | DEFINE_RES_MEM_NAMED(0xfe951000, 0x100, "IPMMU"), | 725 | DEFINE_RES_MEM(0xfe951000, 0x100), |
726 | }; | 726 | }; |
727 | 727 | ||
728 | static const char * const ipmmu_dev_names[] = { | 728 | static const char * const ipmmu_dev_names[] = { |
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c index dce50d983a8e..fa2c33ffac04 100644 --- a/arch/arm/mach-sti/platsmp.c +++ b/arch/arm/mach-sti/platsmp.c | |||
@@ -31,8 +31,7 @@ static void write_pen_release(int val) | |||
31 | { | 31 | { |
32 | pen_release = val; | 32 | pen_release = val; |
33 | smp_wmb(); | 33 | smp_wmb(); |
34 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 34 | sync_cache_w(&pen_release); |
35 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
36 | } | 35 | } |
37 | 36 | ||
38 | static DEFINE_SPINLOCK(boot_lock); | 37 | static DEFINE_SPINLOCK(boot_lock); |
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 09e740f58b27..15c09294effa 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -14,6 +14,8 @@ config ARCH_TEGRA | |||
14 | select MIGHT_HAVE_CACHE_L2X0 | 14 | select MIGHT_HAVE_CACHE_L2X0 |
15 | select MIGHT_HAVE_PCI | 15 | select MIGHT_HAVE_PCI |
16 | select PINCTRL | 16 | select PINCTRL |
17 | select ARCH_HAS_RESET_CONTROLLER | ||
18 | select RESET_CONTROLLER | ||
17 | select SOC_BUS | 19 | select SOC_BUS |
18 | select SPARSE_IRQ | 20 | select SPARSE_IRQ |
19 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 21 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c index 85d28e756bb7..f6f5b54ff95e 100644 --- a/arch/arm/mach-tegra/powergate.c +++ b/arch/arm/mach-tegra/powergate.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/export.h> | 25 | #include <linux/export.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/reset.h> | ||
28 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
30 | #include <linux/clk/tegra.h> | 31 | #include <linux/clk/tegra.h> |
@@ -144,11 +145,12 @@ int tegra_powergate_remove_clamping(int id) | |||
144 | } | 145 | } |
145 | 146 | ||
146 | /* Must be called with clk disabled, and returns with clk enabled */ | 147 | /* Must be called with clk disabled, and returns with clk enabled */ |
147 | int tegra_powergate_sequence_power_up(int id, struct clk *clk) | 148 | int tegra_powergate_sequence_power_up(int id, struct clk *clk, |
149 | struct reset_control *rst) | ||
148 | { | 150 | { |
149 | int ret; | 151 | int ret; |
150 | 152 | ||
151 | tegra_periph_reset_assert(clk); | 153 | reset_control_assert(rst); |
152 | 154 | ||
153 | ret = tegra_powergate_power_on(id); | 155 | ret = tegra_powergate_power_on(id); |
154 | if (ret) | 156 | if (ret) |
@@ -165,7 +167,7 @@ int tegra_powergate_sequence_power_up(int id, struct clk *clk) | |||
165 | goto err_clamp; | 167 | goto err_clamp; |
166 | 168 | ||
167 | udelay(10); | 169 | udelay(10); |
168 | tegra_periph_reset_deassert(clk); | 170 | reset_control_deassert(rst); |
169 | 171 | ||
170 | return 0; | 172 | return 0; |
171 | 173 | ||
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index 1f296e796a4f..a44967f3168c 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -38,8 +38,7 @@ static void write_pen_release(int val) | |||
38 | { | 38 | { |
39 | pen_release = val; | 39 | pen_release = val; |
40 | smp_wmb(); | 40 | smp_wmb(); |
41 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 41 | sync_cache_w(&pen_release); |
42 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
43 | } | 42 | } |
44 | 43 | ||
45 | static void __iomem *scu_base_addr(void) | 44 | static void __iomem *scu_base_addr(void) |
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 9a7bd137c8fd..1db2a5ca9ab8 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
27 | #include <linux/of.h> | 27 | #include <linux/of.h> |
28 | #include <linux/irqchip.h> | ||
29 | #include <linux/irqchip/arm-gic.h> | ||
28 | 30 | ||
29 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
30 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
@@ -39,11 +41,6 @@ | |||
39 | 41 | ||
40 | void __iomem *zynq_scu_base; | 42 | void __iomem *zynq_scu_base; |
41 | 43 | ||
42 | static struct of_device_id zynq_of_bus_ids[] __initdata = { | ||
43 | { .compatible = "simple-bus", }, | ||
44 | {} | ||
45 | }; | ||
46 | |||
47 | static struct platform_device zynq_cpuidle_device = { | 44 | static struct platform_device zynq_cpuidle_device = { |
48 | .name = "cpuidle-zynq", | 45 | .name = "cpuidle-zynq", |
49 | }; | 46 | }; |
@@ -59,7 +56,7 @@ static void __init zynq_init_machine(void) | |||
59 | */ | 56 | */ |
60 | l2x0_of_init(0x02060000, 0xF0F0FFFF); | 57 | l2x0_of_init(0x02060000, 0xF0F0FFFF); |
61 | 58 | ||
62 | of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL); | 59 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
63 | 60 | ||
64 | platform_device_register(&zynq_cpuidle_device); | 61 | platform_device_register(&zynq_cpuidle_device); |
65 | } | 62 | } |
@@ -97,6 +94,12 @@ static void __init zynq_map_io(void) | |||
97 | zynq_scu_map_io(); | 94 | zynq_scu_map_io(); |
98 | } | 95 | } |
99 | 96 | ||
97 | static void __init zynq_irq_init(void) | ||
98 | { | ||
99 | gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; | ||
100 | irqchip_init(); | ||
101 | } | ||
102 | |||
100 | static void zynq_system_reset(enum reboot_mode mode, const char *cmd) | 103 | static void zynq_system_reset(enum reboot_mode mode, const char *cmd) |
101 | { | 104 | { |
102 | zynq_slcr_system_reset(); | 105 | zynq_slcr_system_reset(); |
@@ -110,6 +113,7 @@ static const char * const zynq_dt_match[] = { | |||
110 | DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") | 113 | DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") |
111 | .smp = smp_ops(zynq_smp_ops), | 114 | .smp = smp_ops(zynq_smp_ops), |
112 | .map_io = zynq_map_io, | 115 | .map_io = zynq_map_io, |
116 | .init_irq = zynq_irq_init, | ||
113 | .init_machine = zynq_init_machine, | 117 | .init_machine = zynq_init_machine, |
114 | .init_time = zynq_timer_init, | 118 | .init_time = zynq_timer_init, |
115 | .dt_compat = zynq_dt_match, | 119 | .dt_compat = zynq_dt_match, |
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 3040d219570f..c22c92cea8cb 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef __MACH_ZYNQ_COMMON_H__ | 17 | #ifndef __MACH_ZYNQ_COMMON_H__ |
18 | #define __MACH_ZYNQ_COMMON_H__ | 18 | #define __MACH_ZYNQ_COMMON_H__ |
19 | 19 | ||
20 | void zynq_secondary_startup(void); | ||
21 | |||
20 | extern int zynq_slcr_init(void); | 22 | extern int zynq_slcr_init(void); |
21 | extern void zynq_slcr_system_reset(void); | 23 | extern void zynq_slcr_system_reset(void); |
22 | extern void zynq_slcr_cpu_stop(int cpu); | 24 | extern void zynq_slcr_cpu_stop(int cpu); |
diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S index d4cd5f34fe5c..57a32869f0aa 100644 --- a/arch/arm/mach-zynq/headsmp.S +++ b/arch/arm/mach-zynq/headsmp.S | |||
@@ -18,5 +18,9 @@ zynq_secondary_trampoline_jump: | |||
18 | .word /* cpu 1 */ | 18 | .word /* cpu 1 */ |
19 | .globl zynq_secondary_trampoline_end | 19 | .globl zynq_secondary_trampoline_end |
20 | zynq_secondary_trampoline_end: | 20 | zynq_secondary_trampoline_end: |
21 | |||
22 | ENDPROC(zynq_secondary_trampoline) | 21 | ENDPROC(zynq_secondary_trampoline) |
22 | |||
23 | ENTRY(zynq_secondary_startup) | ||
24 | bl v7_invalidate_l1 | ||
25 | b secondary_startup | ||
26 | ENDPROC(zynq_secondary_startup) | ||
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c index 689fbbc3d9c8..abc82ef085c1 100644 --- a/arch/arm/mach-zynq/platsmp.c +++ b/arch/arm/mach-zynq/platsmp.c | |||
@@ -39,11 +39,6 @@ int zynq_cpun_start(u32 address, int cpu) | |||
39 | u32 trampoline_code_size = &zynq_secondary_trampoline_end - | 39 | u32 trampoline_code_size = &zynq_secondary_trampoline_end - |
40 | &zynq_secondary_trampoline; | 40 | &zynq_secondary_trampoline; |
41 | 41 | ||
42 | if (cpu > ncores) { | ||
43 | pr_warn("CPU No. is not available in the system\n"); | ||
44 | return -1; | ||
45 | } | ||
46 | |||
47 | /* MS: Expectation that SLCR are directly map and accessible */ | 42 | /* MS: Expectation that SLCR are directly map and accessible */ |
48 | /* Not possible to jump to non aligned address */ | 43 | /* Not possible to jump to non aligned address */ |
49 | if (!(address & 3) && (!address || (address >= trampoline_code_size))) { | 44 | if (!(address & 3) && (!address || (address >= trampoline_code_size))) { |
@@ -95,7 +90,7 @@ EXPORT_SYMBOL(zynq_cpun_start); | |||
95 | static int zynq_boot_secondary(unsigned int cpu, | 90 | static int zynq_boot_secondary(unsigned int cpu, |
96 | struct task_struct *idle) | 91 | struct task_struct *idle) |
97 | { | 92 | { |
98 | return zynq_cpun_start(virt_to_phys(secondary_startup), cpu); | 93 | return zynq_cpun_start(virt_to_phys(zynq_secondary_startup), cpu); |
99 | } | 94 | } |
100 | 95 | ||
101 | /* | 96 | /* |
@@ -114,23 +109,23 @@ static void __init zynq_smp_init_cpus(void) | |||
114 | 109 | ||
115 | static void __init zynq_smp_prepare_cpus(unsigned int max_cpus) | 110 | static void __init zynq_smp_prepare_cpus(unsigned int max_cpus) |
116 | { | 111 | { |
117 | int i; | ||
118 | |||
119 | /* | ||
120 | * Initialise the present map, which describes the set of CPUs | ||
121 | * actually populated at the present time. | ||
122 | */ | ||
123 | for (i = 0; i < max_cpus; i++) | ||
124 | set_cpu_present(i, true); | ||
125 | |||
126 | scu_enable(zynq_scu_base); | 112 | scu_enable(zynq_scu_base); |
127 | } | 113 | } |
128 | 114 | ||
115 | #ifdef CONFIG_HOTPLUG_CPU | ||
116 | static int zynq_cpu_kill(unsigned cpu) | ||
117 | { | ||
118 | zynq_slcr_cpu_stop(cpu); | ||
119 | return 1; | ||
120 | } | ||
121 | #endif | ||
122 | |||
129 | struct smp_operations zynq_smp_ops __initdata = { | 123 | struct smp_operations zynq_smp_ops __initdata = { |
130 | .smp_init_cpus = zynq_smp_init_cpus, | 124 | .smp_init_cpus = zynq_smp_init_cpus, |
131 | .smp_prepare_cpus = zynq_smp_prepare_cpus, | 125 | .smp_prepare_cpus = zynq_smp_prepare_cpus, |
132 | .smp_boot_secondary = zynq_boot_secondary, | 126 | .smp_boot_secondary = zynq_boot_secondary, |
133 | #ifdef CONFIG_HOTPLUG_CPU | 127 | #ifdef CONFIG_HOTPLUG_CPU |
134 | .cpu_die = zynq_platform_cpu_die, | 128 | .cpu_die = zynq_platform_cpu_die, |
129 | .cpu_kill = zynq_cpu_kill, | ||
135 | #endif | 130 | #endif |
136 | }; | 131 | }; |
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index c66d163d7a2a..830ff07f3385 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/platform_data/dma-mv_xor.h> | 22 | #include <linux/platform_data/dma-mv_xor.h> |
23 | #include <linux/platform_data/usb-ehci-orion.h> | 23 | #include <linux/platform_data/usb-ehci-orion.h> |
24 | #include <mach/bridge-regs.h> | 24 | #include <mach/bridge-regs.h> |
25 | #include <plat/common.h> | ||
25 | 26 | ||
26 | /* Create a clkdev entry for a given device/clk */ | 27 | /* Create a clkdev entry for a given device/clk */ |
27 | void __init orion_clkdev_add(const char *con_id, const char *dev_id, | 28 | void __init orion_clkdev_add(const char *con_id, const char *dev_id, |
@@ -256,7 +257,7 @@ static __init void ge_complete( | |||
256 | /***************************************************************************** | 257 | /***************************************************************************** |
257 | * GE00 | 258 | * GE00 |
258 | ****************************************************************************/ | 259 | ****************************************************************************/ |
259 | struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; | 260 | static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; |
260 | 261 | ||
261 | static struct resource orion_ge00_shared_resources[] = { | 262 | static struct resource orion_ge00_shared_resources[] = { |
262 | { | 263 | { |
@@ -322,7 +323,7 @@ void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data, | |||
322 | /***************************************************************************** | 323 | /***************************************************************************** |
323 | * GE01 | 324 | * GE01 |
324 | ****************************************************************************/ | 325 | ****************************************************************************/ |
325 | struct mv643xx_eth_shared_platform_data orion_ge01_shared_data; | 326 | static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data; |
326 | 327 | ||
327 | static struct resource orion_ge01_shared_resources[] = { | 328 | static struct resource orion_ge01_shared_resources[] = { |
328 | { | 329 | { |
@@ -373,7 +374,7 @@ void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data, | |||
373 | /***************************************************************************** | 374 | /***************************************************************************** |
374 | * GE10 | 375 | * GE10 |
375 | ****************************************************************************/ | 376 | ****************************************************************************/ |
376 | struct mv643xx_eth_shared_platform_data orion_ge10_shared_data; | 377 | static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data; |
377 | 378 | ||
378 | static struct resource orion_ge10_shared_resources[] = { | 379 | static struct resource orion_ge10_shared_resources[] = { |
379 | { | 380 | { |
@@ -422,7 +423,7 @@ void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data, | |||
422 | /***************************************************************************** | 423 | /***************************************************************************** |
423 | * GE11 | 424 | * GE11 |
424 | ****************************************************************************/ | 425 | ****************************************************************************/ |
425 | struct mv643xx_eth_shared_platform_data orion_ge11_shared_data; | 426 | static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data; |
426 | 427 | ||
427 | static struct resource orion_ge11_shared_resources[] = { | 428 | static struct resource orion_ge11_shared_resources[] = { |
428 | { | 429 | { |
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c index 9d2b2ac74938..15921a1839d7 100644 --- a/arch/arm/plat-orion/time.c +++ b/arch/arm/plat-orion/time.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/sched_clock.h> | 19 | #include <linux/sched_clock.h> |
20 | #include <plat/time.h> | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * MBus bridge block registers. | 23 | * MBus bridge block registers. |
@@ -174,7 +175,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id) | |||
174 | 175 | ||
175 | static struct irqaction orion_timer_irq = { | 176 | static struct irqaction orion_timer_irq = { |
176 | .name = "orion_tick", | 177 | .name = "orion_tick", |
177 | .flags = IRQF_DISABLED | IRQF_TIMER, | 178 | .flags = IRQF_TIMER, |
178 | .handler = orion_timer_interrupt | 179 | .handler = orion_timer_interrupt |
179 | }; | 180 | }; |
180 | 181 | ||
diff --git a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c index 79ef102e3b2b..054fc5a1a11c 100644 --- a/arch/arm/plat-pxa/dma.c +++ b/arch/arm/plat-pxa/dma.c | |||
@@ -377,7 +377,7 @@ int __init pxa_init_dma(int irq, int num_ch) | |||
377 | spin_lock_init(&dma_channels[i].lock); | 377 | spin_lock_init(&dma_channels[i].lock); |
378 | } | 378 | } |
379 | 379 | ||
380 | ret = request_irq(irq, dma_irq_handler, IRQF_DISABLED, "DMA", NULL); | 380 | ret = request_irq(irq, dma_irq_handler, 0, "DMA", NULL); |
381 | if (ret) { | 381 | if (ret) { |
382 | printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); | 382 | printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); |
383 | kfree(dma_channels); | 383 | kfree(dma_channels); |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 6d95d60276d6..58645a58d0d8 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -24,7 +24,6 @@ config PLAT_S5P | |||
24 | select S3C_GPIO_TRACK | 24 | select S3C_GPIO_TRACK |
25 | select S5P_GPIO_DRVSTR | 25 | select S5P_GPIO_DRVSTR |
26 | select SAMSUNG_CLKSRC if !COMMON_CLK | 26 | select SAMSUNG_CLKSRC if !COMMON_CLK |
27 | select SAMSUNG_GPIOLIB_4BIT | ||
28 | help | 27 | help |
29 | Base platform code for Samsung's S5P series SoC. | 28 | Base platform code for Samsung's S5P series SoC. |
30 | 29 | ||
@@ -115,13 +114,6 @@ config S5P_GPIO_INT | |||
115 | 114 | ||
116 | # options for gpio configuration support | 115 | # options for gpio configuration support |
117 | 116 | ||
118 | config SAMSUNG_GPIOLIB_4BIT | ||
119 | bool | ||
120 | help | ||
121 | GPIOlib file contains the 4 bit modification functions for gpio | ||
122 | configuration. GPIOlib shall be compiled only for S3C64XX and S5P | ||
123 | series of processors. | ||
124 | |||
125 | config S5P_GPIO_DRVSTR | 117 | config S5P_GPIO_DRVSTR |
126 | bool | 118 | bool |
127 | help | 119 | help |
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h index 6bc1a8f471e3..ff6063f0d5ea 100644 --- a/arch/arm/plat-samsung/include/plat/pm.h +++ b/arch/arm/plat-samsung/include/plat/pm.h | |||
@@ -101,8 +101,8 @@ struct pm_uart_save { | |||
101 | /* helper functions to save/restore lists of registers. */ | 101 | /* helper functions to save/restore lists of registers. */ |
102 | 102 | ||
103 | extern void s3c_pm_do_save(struct sleep_save *ptr, int count); | 103 | extern void s3c_pm_do_save(struct sleep_save *ptr, int count); |
104 | extern void s3c_pm_do_restore(struct sleep_save *ptr, int count); | 104 | extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count); |
105 | extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); | 105 | extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count); |
106 | 106 | ||
107 | #ifdef CONFIG_SAMSUNG_PM | 107 | #ifdef CONFIG_SAMSUNG_PM |
108 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); | 108 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); |
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index d0c23010b693..e5b0f2c2d884 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c | |||
@@ -28,8 +28,10 @@ | |||
28 | #ifdef CONFIG_SAMSUNG_ATAGS | 28 | #ifdef CONFIG_SAMSUNG_ATAGS |
29 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
30 | #include <mach/map.h> | 30 | #include <mach/map.h> |
31 | #ifndef CONFIG_ARCH_EXYNOS | ||
31 | #include <mach/regs-clock.h> | 32 | #include <mach/regs-clock.h> |
32 | #include <mach/regs-irq.h> | 33 | #include <mach/regs-irq.h> |
34 | #endif | ||
33 | #include <mach/irqs.h> | 35 | #include <mach/irqs.h> |
34 | #endif | 36 | #endif |
35 | 37 | ||
@@ -182,7 +184,7 @@ void s3c_pm_do_save(struct sleep_save *ptr, int count) | |||
182 | * restore the UARTs state yet | 184 | * restore the UARTs state yet |
183 | */ | 185 | */ |
184 | 186 | ||
185 | void s3c_pm_do_restore(struct sleep_save *ptr, int count) | 187 | void s3c_pm_do_restore(const struct sleep_save *ptr, int count) |
186 | { | 188 | { |
187 | for (; count > 0; count--, ptr++) { | 189 | for (; count > 0; count--, ptr++) { |
188 | printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n", | 190 | printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n", |
@@ -203,7 +205,7 @@ void s3c_pm_do_restore(struct sleep_save *ptr, int count) | |||
203 | * peripherals, as things may be changing! | 205 | * peripherals, as things may be changing! |
204 | */ | 206 | */ |
205 | 207 | ||
206 | void s3c_pm_do_restore_core(struct sleep_save *ptr, int count) | 208 | void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count) |
207 | { | 209 | { |
208 | for (; count > 0; count--, ptr++) | 210 | for (; count > 0; count--, ptr++) |
209 | __raw_writel(ptr->val, ptr->reg); | 211 | __raw_writel(ptr->val, ptr->reg); |
diff --git a/arch/arm/plat-samsung/s5p-irq-pm.c b/arch/arm/plat-samsung/s5p-irq-pm.c index 7c1e3b7072fc..591498035916 100644 --- a/arch/arm/plat-samsung/s5p-irq-pm.c +++ b/arch/arm/plat-samsung/s5p-irq-pm.c | |||
@@ -22,7 +22,10 @@ | |||
22 | #include <mach/map.h> | 22 | #include <mach/map.h> |
23 | 23 | ||
24 | #include <mach/regs-gpio.h> | 24 | #include <mach/regs-gpio.h> |
25 | |||
26 | #ifndef CONFIG_ARCH_EXYNOS | ||
25 | #include <mach/regs-irq.h> | 27 | #include <mach/regs-irq.h> |
28 | #endif | ||
26 | 29 | ||
27 | /* state for IRQs over sleep */ | 30 | /* state for IRQs over sleep */ |
28 | 31 | ||
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c index 39895d892c3b..53feb90c840c 100644 --- a/arch/arm/plat-versatile/platsmp.c +++ b/arch/arm/plat-versatile/platsmp.c | |||
@@ -27,8 +27,7 @@ static void write_pen_release(int val) | |||
27 | { | 27 | { |
28 | pen_release = val; | 28 | pen_release = val; |
29 | smp_wmb(); | 29 | smp_wmb(); |
30 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | 30 | sync_cache_w(&pen_release); |
31 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
32 | } | 31 | } |
33 | 32 | ||
34 | static DEFINE_SPINLOCK(boot_lock); | 33 | static DEFINE_SPINLOCK(boot_lock); |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 7a10bc9a23e7..ace7309c4369 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -35,6 +35,7 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/ | |||
35 | obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ | 35 | obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ |
36 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o | 36 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o |
37 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ | 37 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ |
38 | obj-$(CONFIG_COMMON_CLK_AT91) += at91/ | ||
38 | 39 | ||
39 | obj-$(CONFIG_X86) += x86/ | 40 | obj-$(CONFIG_X86) += x86/ |
40 | 41 | ||
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile new file mode 100644 index 000000000000..46c1d3d0d66b --- /dev/null +++ b/drivers/clk/at91/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for at91 specific clk | ||
3 | # | ||
4 | |||
5 | obj-y += pmc.o | ||
6 | obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o | ||
7 | obj-y += clk-system.o clk-peripheral.o clk-programmable.o | ||
8 | |||
9 | obj-$(CONFIG_HAVE_AT91_UTMI) += clk-utmi.o | ||
10 | obj-$(CONFIG_HAVE_AT91_USB_CLK) += clk-usb.o | ||
11 | obj-$(CONFIG_HAVE_AT91_SMD) += clk-smd.o | ||
diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c new file mode 100644 index 000000000000..8e9e8cc0412d --- /dev/null +++ b/drivers/clk/at91/clk-main.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_address.h> | ||
17 | #include <linux/of_irq.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/wait.h> | ||
23 | |||
24 | #include "pmc.h" | ||
25 | |||
26 | #define SLOW_CLOCK_FREQ 32768 | ||
27 | #define MAINF_DIV 16 | ||
28 | #define MAINFRDY_TIMEOUT (((MAINF_DIV + 1) * USEC_PER_SEC) / \ | ||
29 | SLOW_CLOCK_FREQ) | ||
30 | #define MAINF_LOOP_MIN_WAIT (USEC_PER_SEC / SLOW_CLOCK_FREQ) | ||
31 | #define MAINF_LOOP_MAX_WAIT MAINFRDY_TIMEOUT | ||
32 | |||
33 | struct clk_main { | ||
34 | struct clk_hw hw; | ||
35 | struct at91_pmc *pmc; | ||
36 | unsigned long rate; | ||
37 | unsigned int irq; | ||
38 | wait_queue_head_t wait; | ||
39 | }; | ||
40 | |||
41 | #define to_clk_main(hw) container_of(hw, struct clk_main, hw) | ||
42 | |||
43 | static irqreturn_t clk_main_irq_handler(int irq, void *dev_id) | ||
44 | { | ||
45 | struct clk_main *clkmain = (struct clk_main *)dev_id; | ||
46 | |||
47 | wake_up(&clkmain->wait); | ||
48 | disable_irq_nosync(clkmain->irq); | ||
49 | |||
50 | return IRQ_HANDLED; | ||
51 | } | ||
52 | |||
53 | static int clk_main_prepare(struct clk_hw *hw) | ||
54 | { | ||
55 | struct clk_main *clkmain = to_clk_main(hw); | ||
56 | struct at91_pmc *pmc = clkmain->pmc; | ||
57 | unsigned long halt_time, timeout; | ||
58 | u32 tmp; | ||
59 | |||
60 | while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS)) { | ||
61 | enable_irq(clkmain->irq); | ||
62 | wait_event(clkmain->wait, | ||
63 | pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); | ||
64 | } | ||
65 | |||
66 | if (clkmain->rate) | ||
67 | return 0; | ||
68 | |||
69 | timeout = jiffies + usecs_to_jiffies(MAINFRDY_TIMEOUT); | ||
70 | do { | ||
71 | halt_time = jiffies; | ||
72 | tmp = pmc_read(pmc, AT91_CKGR_MCFR); | ||
73 | if (tmp & AT91_PMC_MAINRDY) | ||
74 | return 0; | ||
75 | usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT); | ||
76 | } while (time_before(halt_time, timeout)); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static int clk_main_is_prepared(struct clk_hw *hw) | ||
82 | { | ||
83 | struct clk_main *clkmain = to_clk_main(hw); | ||
84 | |||
85 | return !!(pmc_read(clkmain->pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); | ||
86 | } | ||
87 | |||
88 | static unsigned long clk_main_recalc_rate(struct clk_hw *hw, | ||
89 | unsigned long parent_rate) | ||
90 | { | ||
91 | u32 tmp; | ||
92 | struct clk_main *clkmain = to_clk_main(hw); | ||
93 | struct at91_pmc *pmc = clkmain->pmc; | ||
94 | |||
95 | if (clkmain->rate) | ||
96 | return clkmain->rate; | ||
97 | |||
98 | tmp = pmc_read(pmc, AT91_CKGR_MCFR) & AT91_PMC_MAINF; | ||
99 | clkmain->rate = (tmp * parent_rate) / MAINF_DIV; | ||
100 | |||
101 | return clkmain->rate; | ||
102 | } | ||
103 | |||
104 | static const struct clk_ops main_ops = { | ||
105 | .prepare = clk_main_prepare, | ||
106 | .is_prepared = clk_main_is_prepared, | ||
107 | .recalc_rate = clk_main_recalc_rate, | ||
108 | }; | ||
109 | |||
110 | static struct clk * __init | ||
111 | at91_clk_register_main(struct at91_pmc *pmc, | ||
112 | unsigned int irq, | ||
113 | const char *name, | ||
114 | const char *parent_name, | ||
115 | unsigned long rate) | ||
116 | { | ||
117 | int ret; | ||
118 | struct clk_main *clkmain; | ||
119 | struct clk *clk = NULL; | ||
120 | struct clk_init_data init; | ||
121 | |||
122 | if (!pmc || !irq || !name) | ||
123 | return ERR_PTR(-EINVAL); | ||
124 | |||
125 | if (!rate && !parent_name) | ||
126 | return ERR_PTR(-EINVAL); | ||
127 | |||
128 | clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); | ||
129 | if (!clkmain) | ||
130 | return ERR_PTR(-ENOMEM); | ||
131 | |||
132 | init.name = name; | ||
133 | init.ops = &main_ops; | ||
134 | init.parent_names = parent_name ? &parent_name : NULL; | ||
135 | init.num_parents = parent_name ? 1 : 0; | ||
136 | init.flags = parent_name ? 0 : CLK_IS_ROOT; | ||
137 | |||
138 | clkmain->hw.init = &init; | ||
139 | clkmain->rate = rate; | ||
140 | clkmain->pmc = pmc; | ||
141 | clkmain->irq = irq; | ||
142 | init_waitqueue_head(&clkmain->wait); | ||
143 | irq_set_status_flags(clkmain->irq, IRQ_NOAUTOEN); | ||
144 | ret = request_irq(clkmain->irq, clk_main_irq_handler, | ||
145 | IRQF_TRIGGER_HIGH, "clk-main", clkmain); | ||
146 | if (ret) | ||
147 | return ERR_PTR(ret); | ||
148 | |||
149 | clk = clk_register(NULL, &clkmain->hw); | ||
150 | if (IS_ERR(clk)) { | ||
151 | free_irq(clkmain->irq, clkmain); | ||
152 | kfree(clkmain); | ||
153 | } | ||
154 | |||
155 | return clk; | ||
156 | } | ||
157 | |||
158 | |||
159 | |||
160 | static void __init | ||
161 | of_at91_clk_main_setup(struct device_node *np, struct at91_pmc *pmc) | ||
162 | { | ||
163 | struct clk *clk; | ||
164 | unsigned int irq; | ||
165 | const char *parent_name; | ||
166 | const char *name = np->name; | ||
167 | u32 rate = 0; | ||
168 | |||
169 | parent_name = of_clk_get_parent_name(np, 0); | ||
170 | of_property_read_string(np, "clock-output-names", &name); | ||
171 | of_property_read_u32(np, "clock-frequency", &rate); | ||
172 | irq = irq_of_parse_and_map(np, 0); | ||
173 | if (!irq) | ||
174 | return; | ||
175 | |||
176 | clk = at91_clk_register_main(pmc, irq, name, parent_name, rate); | ||
177 | if (IS_ERR(clk)) | ||
178 | return; | ||
179 | |||
180 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
181 | } | ||
182 | |||
183 | void __init of_at91rm9200_clk_main_setup(struct device_node *np, | ||
184 | struct at91_pmc *pmc) | ||
185 | { | ||
186 | of_at91_clk_main_setup(np, pmc); | ||
187 | } | ||
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c new file mode 100644 index 000000000000..bd313f7816a8 --- /dev/null +++ b/drivers/clk/at91/clk-master.c | |||
@@ -0,0 +1,270 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/of_irq.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/wait.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/irq.h> | ||
22 | |||
23 | #include "pmc.h" | ||
24 | |||
25 | #define MASTER_SOURCE_MAX 4 | ||
26 | |||
27 | #define MASTER_PRES_MASK 0x7 | ||
28 | #define MASTER_PRES_MAX MASTER_PRES_MASK | ||
29 | #define MASTER_DIV_SHIFT 8 | ||
30 | #define MASTER_DIV_MASK 0x3 | ||
31 | |||
32 | struct clk_master_characteristics { | ||
33 | struct clk_range output; | ||
34 | u32 divisors[4]; | ||
35 | u8 have_div3_pres; | ||
36 | }; | ||
37 | |||
38 | struct clk_master_layout { | ||
39 | u32 mask; | ||
40 | u8 pres_shift; | ||
41 | }; | ||
42 | |||
43 | #define to_clk_master(hw) container_of(hw, struct clk_master, hw) | ||
44 | |||
45 | struct clk_master { | ||
46 | struct clk_hw hw; | ||
47 | struct at91_pmc *pmc; | ||
48 | unsigned int irq; | ||
49 | wait_queue_head_t wait; | ||
50 | const struct clk_master_layout *layout; | ||
51 | const struct clk_master_characteristics *characteristics; | ||
52 | }; | ||
53 | |||
54 | static irqreturn_t clk_master_irq_handler(int irq, void *dev_id) | ||
55 | { | ||
56 | struct clk_master *master = (struct clk_master *)dev_id; | ||
57 | |||
58 | wake_up(&master->wait); | ||
59 | disable_irq_nosync(master->irq); | ||
60 | |||
61 | return IRQ_HANDLED; | ||
62 | } | ||
63 | static int clk_master_prepare(struct clk_hw *hw) | ||
64 | { | ||
65 | struct clk_master *master = to_clk_master(hw); | ||
66 | struct at91_pmc *pmc = master->pmc; | ||
67 | |||
68 | while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY)) { | ||
69 | enable_irq(master->irq); | ||
70 | wait_event(master->wait, | ||
71 | pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); | ||
72 | } | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int clk_master_is_prepared(struct clk_hw *hw) | ||
78 | { | ||
79 | struct clk_master *master = to_clk_master(hw); | ||
80 | |||
81 | return !!(pmc_read(master->pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); | ||
82 | } | ||
83 | |||
84 | static unsigned long clk_master_recalc_rate(struct clk_hw *hw, | ||
85 | unsigned long parent_rate) | ||
86 | { | ||
87 | u8 pres; | ||
88 | u8 div; | ||
89 | unsigned long rate = parent_rate; | ||
90 | struct clk_master *master = to_clk_master(hw); | ||
91 | struct at91_pmc *pmc = master->pmc; | ||
92 | const struct clk_master_layout *layout = master->layout; | ||
93 | const struct clk_master_characteristics *characteristics = | ||
94 | master->characteristics; | ||
95 | u32 tmp; | ||
96 | |||
97 | pmc_lock(pmc); | ||
98 | tmp = pmc_read(pmc, AT91_PMC_MCKR) & layout->mask; | ||
99 | pmc_unlock(pmc); | ||
100 | |||
101 | pres = (tmp >> layout->pres_shift) & MASTER_PRES_MASK; | ||
102 | div = (tmp >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK; | ||
103 | |||
104 | if (characteristics->have_div3_pres && pres == MASTER_PRES_MAX) | ||
105 | rate /= 3; | ||
106 | else | ||
107 | rate >>= pres; | ||
108 | |||
109 | rate /= characteristics->divisors[div]; | ||
110 | |||
111 | if (rate < characteristics->output.min) | ||
112 | pr_warn("master clk is underclocked"); | ||
113 | else if (rate > characteristics->output.max) | ||
114 | pr_warn("master clk is overclocked"); | ||
115 | |||
116 | return rate; | ||
117 | } | ||
118 | |||
119 | static u8 clk_master_get_parent(struct clk_hw *hw) | ||
120 | { | ||
121 | struct clk_master *master = to_clk_master(hw); | ||
122 | struct at91_pmc *pmc = master->pmc; | ||
123 | |||
124 | return pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_CSS; | ||
125 | } | ||
126 | |||
127 | static const struct clk_ops master_ops = { | ||
128 | .prepare = clk_master_prepare, | ||
129 | .is_prepared = clk_master_is_prepared, | ||
130 | .recalc_rate = clk_master_recalc_rate, | ||
131 | .get_parent = clk_master_get_parent, | ||
132 | }; | ||
133 | |||
134 | static struct clk * __init | ||
135 | at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, | ||
136 | const char *name, int num_parents, | ||
137 | const char **parent_names, | ||
138 | const struct clk_master_layout *layout, | ||
139 | const struct clk_master_characteristics *characteristics) | ||
140 | { | ||
141 | int ret; | ||
142 | struct clk_master *master; | ||
143 | struct clk *clk = NULL; | ||
144 | struct clk_init_data init; | ||
145 | |||
146 | if (!pmc || !irq || !name || !num_parents || !parent_names) | ||
147 | return ERR_PTR(-EINVAL); | ||
148 | |||
149 | master = kzalloc(sizeof(*master), GFP_KERNEL); | ||
150 | if (!master) | ||
151 | return ERR_PTR(-ENOMEM); | ||
152 | |||
153 | init.name = name; | ||
154 | init.ops = &master_ops; | ||
155 | init.parent_names = parent_names; | ||
156 | init.num_parents = num_parents; | ||
157 | init.flags = 0; | ||
158 | |||
159 | master->hw.init = &init; | ||
160 | master->layout = layout; | ||
161 | master->characteristics = characteristics; | ||
162 | master->pmc = pmc; | ||
163 | master->irq = irq; | ||
164 | init_waitqueue_head(&master->wait); | ||
165 | irq_set_status_flags(master->irq, IRQ_NOAUTOEN); | ||
166 | ret = request_irq(master->irq, clk_master_irq_handler, | ||
167 | IRQF_TRIGGER_HIGH, "clk-master", master); | ||
168 | if (ret) | ||
169 | return ERR_PTR(ret); | ||
170 | |||
171 | clk = clk_register(NULL, &master->hw); | ||
172 | if (IS_ERR(clk)) | ||
173 | kfree(master); | ||
174 | |||
175 | return clk; | ||
176 | } | ||
177 | |||
178 | |||
179 | static const struct clk_master_layout at91rm9200_master_layout = { | ||
180 | .mask = 0x31F, | ||
181 | .pres_shift = 2, | ||
182 | }; | ||
183 | |||
184 | static const struct clk_master_layout at91sam9x5_master_layout = { | ||
185 | .mask = 0x373, | ||
186 | .pres_shift = 4, | ||
187 | }; | ||
188 | |||
189 | |||
190 | static struct clk_master_characteristics * __init | ||
191 | of_at91_clk_master_get_characteristics(struct device_node *np) | ||
192 | { | ||
193 | struct clk_master_characteristics *characteristics; | ||
194 | |||
195 | characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); | ||
196 | if (!characteristics) | ||
197 | return NULL; | ||
198 | |||
199 | if (of_at91_get_clk_range(np, "atmel,clk-output-range", &characteristics->output)) | ||
200 | goto out_free_characteristics; | ||
201 | |||
202 | of_property_read_u32_array(np, "atmel,clk-divisors", | ||
203 | characteristics->divisors, 4); | ||
204 | |||
205 | characteristics->have_div3_pres = | ||
206 | of_property_read_bool(np, "atmel,master-clk-have-div3-pres"); | ||
207 | |||
208 | return characteristics; | ||
209 | |||
210 | out_free_characteristics: | ||
211 | kfree(characteristics); | ||
212 | return NULL; | ||
213 | } | ||
214 | |||
215 | static void __init | ||
216 | of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, | ||
217 | const struct clk_master_layout *layout) | ||
218 | { | ||
219 | struct clk *clk; | ||
220 | int num_parents; | ||
221 | int i; | ||
222 | unsigned int irq; | ||
223 | const char *parent_names[MASTER_SOURCE_MAX]; | ||
224 | const char *name = np->name; | ||
225 | struct clk_master_characteristics *characteristics; | ||
226 | |||
227 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | ||
228 | if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX) | ||
229 | return; | ||
230 | |||
231 | for (i = 0; i < num_parents; ++i) { | ||
232 | parent_names[i] = of_clk_get_parent_name(np, i); | ||
233 | if (!parent_names[i]) | ||
234 | return; | ||
235 | } | ||
236 | |||
237 | of_property_read_string(np, "clock-output-names", &name); | ||
238 | |||
239 | characteristics = of_at91_clk_master_get_characteristics(np); | ||
240 | if (!characteristics) | ||
241 | return; | ||
242 | |||
243 | irq = irq_of_parse_and_map(np, 0); | ||
244 | if (!irq) | ||
245 | return; | ||
246 | |||
247 | clk = at91_clk_register_master(pmc, irq, name, num_parents, | ||
248 | parent_names, layout, | ||
249 | characteristics); | ||
250 | if (IS_ERR(clk)) | ||
251 | goto out_free_characteristics; | ||
252 | |||
253 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
254 | return; | ||
255 | |||
256 | out_free_characteristics: | ||
257 | kfree(characteristics); | ||
258 | } | ||
259 | |||
260 | void __init of_at91rm9200_clk_master_setup(struct device_node *np, | ||
261 | struct at91_pmc *pmc) | ||
262 | { | ||
263 | of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout); | ||
264 | } | ||
265 | |||
266 | void __init of_at91sam9x5_clk_master_setup(struct device_node *np, | ||
267 | struct at91_pmc *pmc) | ||
268 | { | ||
269 | of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout); | ||
270 | } | ||
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c new file mode 100644 index 000000000000..597fed423d7d --- /dev/null +++ b/drivers/clk/at91/clk-peripheral.c | |||
@@ -0,0 +1,410 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include "pmc.h" | ||
19 | |||
20 | #define PERIPHERAL_MAX 64 | ||
21 | |||
22 | #define PERIPHERAL_AT91RM9200 0 | ||
23 | #define PERIPHERAL_AT91SAM9X5 1 | ||
24 | |||
25 | #define PERIPHERAL_ID_MIN 2 | ||
26 | #define PERIPHERAL_ID_MAX 31 | ||
27 | #define PERIPHERAL_MASK(id) (1 << ((id) & PERIPHERAL_ID_MAX)) | ||
28 | |||
29 | #define PERIPHERAL_RSHIFT_MASK 0x3 | ||
30 | #define PERIPHERAL_RSHIFT(val) (((val) >> 16) & PERIPHERAL_RSHIFT_MASK) | ||
31 | |||
32 | #define PERIPHERAL_MAX_SHIFT 4 | ||
33 | |||
34 | struct clk_peripheral { | ||
35 | struct clk_hw hw; | ||
36 | struct at91_pmc *pmc; | ||
37 | u32 id; | ||
38 | }; | ||
39 | |||
40 | #define to_clk_peripheral(hw) container_of(hw, struct clk_peripheral, hw) | ||
41 | |||
42 | struct clk_sam9x5_peripheral { | ||
43 | struct clk_hw hw; | ||
44 | struct at91_pmc *pmc; | ||
45 | struct clk_range range; | ||
46 | u32 id; | ||
47 | u32 div; | ||
48 | bool auto_div; | ||
49 | }; | ||
50 | |||
51 | #define to_clk_sam9x5_peripheral(hw) \ | ||
52 | container_of(hw, struct clk_sam9x5_peripheral, hw) | ||
53 | |||
54 | static int clk_peripheral_enable(struct clk_hw *hw) | ||
55 | { | ||
56 | struct clk_peripheral *periph = to_clk_peripheral(hw); | ||
57 | struct at91_pmc *pmc = periph->pmc; | ||
58 | int offset = AT91_PMC_PCER; | ||
59 | u32 id = periph->id; | ||
60 | |||
61 | if (id < PERIPHERAL_ID_MIN) | ||
62 | return 0; | ||
63 | if (id > PERIPHERAL_ID_MAX) | ||
64 | offset = AT91_PMC_PCER1; | ||
65 | pmc_write(pmc, offset, PERIPHERAL_MASK(id)); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static void clk_peripheral_disable(struct clk_hw *hw) | ||
70 | { | ||
71 | struct clk_peripheral *periph = to_clk_peripheral(hw); | ||
72 | struct at91_pmc *pmc = periph->pmc; | ||
73 | int offset = AT91_PMC_PCDR; | ||
74 | u32 id = periph->id; | ||
75 | |||
76 | if (id < PERIPHERAL_ID_MIN) | ||
77 | return; | ||
78 | if (id > PERIPHERAL_ID_MAX) | ||
79 | offset = AT91_PMC_PCDR1; | ||
80 | pmc_write(pmc, offset, PERIPHERAL_MASK(id)); | ||
81 | } | ||
82 | |||
83 | static int clk_peripheral_is_enabled(struct clk_hw *hw) | ||
84 | { | ||
85 | struct clk_peripheral *periph = to_clk_peripheral(hw); | ||
86 | struct at91_pmc *pmc = periph->pmc; | ||
87 | int offset = AT91_PMC_PCSR; | ||
88 | u32 id = periph->id; | ||
89 | |||
90 | if (id < PERIPHERAL_ID_MIN) | ||
91 | return 1; | ||
92 | if (id > PERIPHERAL_ID_MAX) | ||
93 | offset = AT91_PMC_PCSR1; | ||
94 | return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id)); | ||
95 | } | ||
96 | |||
97 | static const struct clk_ops peripheral_ops = { | ||
98 | .enable = clk_peripheral_enable, | ||
99 | .disable = clk_peripheral_disable, | ||
100 | .is_enabled = clk_peripheral_is_enabled, | ||
101 | }; | ||
102 | |||
103 | static struct clk * __init | ||
104 | at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name, | ||
105 | const char *parent_name, u32 id) | ||
106 | { | ||
107 | struct clk_peripheral *periph; | ||
108 | struct clk *clk = NULL; | ||
109 | struct clk_init_data init; | ||
110 | |||
111 | if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX) | ||
112 | return ERR_PTR(-EINVAL); | ||
113 | |||
114 | periph = kzalloc(sizeof(*periph), GFP_KERNEL); | ||
115 | if (!periph) | ||
116 | return ERR_PTR(-ENOMEM); | ||
117 | |||
118 | init.name = name; | ||
119 | init.ops = &peripheral_ops; | ||
120 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
121 | init.num_parents = (parent_name ? 1 : 0); | ||
122 | init.flags = 0; | ||
123 | |||
124 | periph->id = id; | ||
125 | periph->hw.init = &init; | ||
126 | periph->pmc = pmc; | ||
127 | |||
128 | clk = clk_register(NULL, &periph->hw); | ||
129 | if (IS_ERR(clk)) | ||
130 | kfree(periph); | ||
131 | |||
132 | return clk; | ||
133 | } | ||
134 | |||
135 | static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph) | ||
136 | { | ||
137 | struct clk *parent; | ||
138 | unsigned long parent_rate; | ||
139 | int shift = 0; | ||
140 | |||
141 | if (!periph->auto_div) | ||
142 | return; | ||
143 | |||
144 | if (periph->range.max) { | ||
145 | parent = clk_get_parent_by_index(periph->hw.clk, 0); | ||
146 | parent_rate = __clk_get_rate(parent); | ||
147 | if (!parent_rate) | ||
148 | return; | ||
149 | |||
150 | for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { | ||
151 | if (parent_rate >> shift <= periph->range.max) | ||
152 | break; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | periph->auto_div = false; | ||
157 | periph->div = shift; | ||
158 | } | ||
159 | |||
160 | static int clk_sam9x5_peripheral_enable(struct clk_hw *hw) | ||
161 | { | ||
162 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
163 | struct at91_pmc *pmc = periph->pmc; | ||
164 | |||
165 | if (periph->id < PERIPHERAL_ID_MIN) | ||
166 | return 0; | ||
167 | |||
168 | pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | | ||
169 | AT91_PMC_PCR_CMD | | ||
170 | AT91_PMC_PCR_DIV(periph->div) | | ||
171 | AT91_PMC_PCR_EN); | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static void clk_sam9x5_peripheral_disable(struct clk_hw *hw) | ||
176 | { | ||
177 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
178 | struct at91_pmc *pmc = periph->pmc; | ||
179 | |||
180 | if (periph->id < PERIPHERAL_ID_MIN) | ||
181 | return; | ||
182 | |||
183 | pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | | ||
184 | AT91_PMC_PCR_CMD); | ||
185 | } | ||
186 | |||
187 | static int clk_sam9x5_peripheral_is_enabled(struct clk_hw *hw) | ||
188 | { | ||
189 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
190 | struct at91_pmc *pmc = periph->pmc; | ||
191 | int ret; | ||
192 | |||
193 | if (periph->id < PERIPHERAL_ID_MIN) | ||
194 | return 1; | ||
195 | |||
196 | pmc_lock(pmc); | ||
197 | pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); | ||
198 | ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_EN); | ||
199 | pmc_unlock(pmc); | ||
200 | |||
201 | return ret; | ||
202 | } | ||
203 | |||
204 | static unsigned long | ||
205 | clk_sam9x5_peripheral_recalc_rate(struct clk_hw *hw, | ||
206 | unsigned long parent_rate) | ||
207 | { | ||
208 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
209 | struct at91_pmc *pmc = periph->pmc; | ||
210 | u32 tmp; | ||
211 | |||
212 | if (periph->id < PERIPHERAL_ID_MIN) | ||
213 | return parent_rate; | ||
214 | |||
215 | pmc_lock(pmc); | ||
216 | pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); | ||
217 | tmp = pmc_read(pmc, AT91_PMC_PCR); | ||
218 | pmc_unlock(pmc); | ||
219 | |||
220 | if (tmp & AT91_PMC_PCR_EN) { | ||
221 | periph->div = PERIPHERAL_RSHIFT(tmp); | ||
222 | periph->auto_div = false; | ||
223 | } else { | ||
224 | clk_sam9x5_peripheral_autodiv(periph); | ||
225 | } | ||
226 | |||
227 | return parent_rate >> periph->div; | ||
228 | } | ||
229 | |||
230 | static long clk_sam9x5_peripheral_round_rate(struct clk_hw *hw, | ||
231 | unsigned long rate, | ||
232 | unsigned long *parent_rate) | ||
233 | { | ||
234 | int shift = 0; | ||
235 | unsigned long best_rate; | ||
236 | unsigned long best_diff; | ||
237 | unsigned long cur_rate = *parent_rate; | ||
238 | unsigned long cur_diff; | ||
239 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
240 | |||
241 | if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) | ||
242 | return *parent_rate; | ||
243 | |||
244 | if (periph->range.max) { | ||
245 | for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { | ||
246 | cur_rate = *parent_rate >> shift; | ||
247 | if (cur_rate <= periph->range.max) | ||
248 | break; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | if (rate >= cur_rate) | ||
253 | return cur_rate; | ||
254 | |||
255 | best_diff = cur_rate - rate; | ||
256 | best_rate = cur_rate; | ||
257 | for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { | ||
258 | cur_rate = *parent_rate >> shift; | ||
259 | if (cur_rate < rate) | ||
260 | cur_diff = rate - cur_rate; | ||
261 | else | ||
262 | cur_diff = cur_rate - rate; | ||
263 | |||
264 | if (cur_diff < best_diff) { | ||
265 | best_diff = cur_diff; | ||
266 | best_rate = cur_rate; | ||
267 | } | ||
268 | |||
269 | if (!best_diff || cur_rate < rate) | ||
270 | break; | ||
271 | } | ||
272 | |||
273 | return best_rate; | ||
274 | } | ||
275 | |||
276 | static int clk_sam9x5_peripheral_set_rate(struct clk_hw *hw, | ||
277 | unsigned long rate, | ||
278 | unsigned long parent_rate) | ||
279 | { | ||
280 | int shift; | ||
281 | struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); | ||
282 | if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) { | ||
283 | if (parent_rate == rate) | ||
284 | return 0; | ||
285 | else | ||
286 | return -EINVAL; | ||
287 | } | ||
288 | |||
289 | if (periph->range.max && rate > periph->range.max) | ||
290 | return -EINVAL; | ||
291 | |||
292 | for (shift = 0; shift < PERIPHERAL_MAX_SHIFT; shift++) { | ||
293 | if (parent_rate >> shift == rate) { | ||
294 | periph->auto_div = false; | ||
295 | periph->div = shift; | ||
296 | return 0; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | return -EINVAL; | ||
301 | } | ||
302 | |||
303 | static const struct clk_ops sam9x5_peripheral_ops = { | ||
304 | .enable = clk_sam9x5_peripheral_enable, | ||
305 | .disable = clk_sam9x5_peripheral_disable, | ||
306 | .is_enabled = clk_sam9x5_peripheral_is_enabled, | ||
307 | .recalc_rate = clk_sam9x5_peripheral_recalc_rate, | ||
308 | .round_rate = clk_sam9x5_peripheral_round_rate, | ||
309 | .set_rate = clk_sam9x5_peripheral_set_rate, | ||
310 | }; | ||
311 | |||
312 | static struct clk * __init | ||
313 | at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, | ||
314 | const char *parent_name, u32 id, | ||
315 | const struct clk_range *range) | ||
316 | { | ||
317 | struct clk_sam9x5_peripheral *periph; | ||
318 | struct clk *clk = NULL; | ||
319 | struct clk_init_data init; | ||
320 | |||
321 | if (!pmc || !name || !parent_name) | ||
322 | return ERR_PTR(-EINVAL); | ||
323 | |||
324 | periph = kzalloc(sizeof(*periph), GFP_KERNEL); | ||
325 | if (!periph) | ||
326 | return ERR_PTR(-ENOMEM); | ||
327 | |||
328 | init.name = name; | ||
329 | init.ops = &sam9x5_peripheral_ops; | ||
330 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
331 | init.num_parents = (parent_name ? 1 : 0); | ||
332 | init.flags = 0; | ||
333 | |||
334 | periph->id = id; | ||
335 | periph->hw.init = &init; | ||
336 | periph->div = 0; | ||
337 | periph->pmc = pmc; | ||
338 | periph->auto_div = true; | ||
339 | periph->range = *range; | ||
340 | |||
341 | clk = clk_register(NULL, &periph->hw); | ||
342 | if (IS_ERR(clk)) | ||
343 | kfree(periph); | ||
344 | else | ||
345 | clk_sam9x5_peripheral_autodiv(periph); | ||
346 | |||
347 | return clk; | ||
348 | } | ||
349 | |||
350 | static void __init | ||
351 | of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) | ||
352 | { | ||
353 | int num; | ||
354 | u32 id; | ||
355 | struct clk *clk; | ||
356 | const char *parent_name; | ||
357 | const char *name; | ||
358 | struct device_node *periphclknp; | ||
359 | |||
360 | parent_name = of_clk_get_parent_name(np, 0); | ||
361 | if (!parent_name) | ||
362 | return; | ||
363 | |||
364 | num = of_get_child_count(np); | ||
365 | if (!num || num > PERIPHERAL_MAX) | ||
366 | return; | ||
367 | |||
368 | for_each_child_of_node(np, periphclknp) { | ||
369 | if (of_property_read_u32(periphclknp, "reg", &id)) | ||
370 | continue; | ||
371 | |||
372 | if (id >= PERIPHERAL_MAX) | ||
373 | continue; | ||
374 | |||
375 | if (of_property_read_string(np, "clock-output-names", &name)) | ||
376 | name = periphclknp->name; | ||
377 | |||
378 | if (type == PERIPHERAL_AT91RM9200) { | ||
379 | clk = at91_clk_register_peripheral(pmc, name, | ||
380 | parent_name, id); | ||
381 | } else { | ||
382 | struct clk_range range = CLK_RANGE(0, 0); | ||
383 | |||
384 | of_at91_get_clk_range(periphclknp, | ||
385 | "atmel,clk-output-range", | ||
386 | &range); | ||
387 | |||
388 | clk = at91_clk_register_sam9x5_peripheral(pmc, name, | ||
389 | parent_name, | ||
390 | id, &range); | ||
391 | } | ||
392 | |||
393 | if (IS_ERR(clk)) | ||
394 | continue; | ||
395 | |||
396 | of_clk_add_provider(periphclknp, of_clk_src_simple_get, clk); | ||
397 | } | ||
398 | } | ||
399 | |||
400 | void __init of_at91rm9200_clk_periph_setup(struct device_node *np, | ||
401 | struct at91_pmc *pmc) | ||
402 | { | ||
403 | of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91RM9200); | ||
404 | } | ||
405 | |||
406 | void __init of_at91sam9x5_clk_periph_setup(struct device_node *np, | ||
407 | struct at91_pmc *pmc) | ||
408 | { | ||
409 | of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91SAM9X5); | ||
410 | } | ||
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c new file mode 100644 index 000000000000..cf6ed023504c --- /dev/null +++ b/drivers/clk/at91/clk-pll.c | |||
@@ -0,0 +1,531 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/of_irq.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/wait.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/irq.h> | ||
22 | |||
23 | #include "pmc.h" | ||
24 | |||
25 | #define PLL_STATUS_MASK(id) (1 << (1 + (id))) | ||
26 | #define PLL_REG(id) (AT91_CKGR_PLLAR + ((id) * 4)) | ||
27 | #define PLL_DIV_MASK 0xff | ||
28 | #define PLL_DIV_MAX PLL_DIV_MASK | ||
29 | #define PLL_DIV(reg) ((reg) & PLL_DIV_MASK) | ||
30 | #define PLL_MUL(reg, layout) (((reg) >> (layout)->mul_shift) & \ | ||
31 | (layout)->mul_mask) | ||
32 | #define PLL_ICPR_SHIFT(id) ((id) * 16) | ||
33 | #define PLL_ICPR_MASK(id) (0xffff << PLL_ICPR_SHIFT(id)) | ||
34 | #define PLL_MAX_COUNT 0x3ff | ||
35 | #define PLL_COUNT_SHIFT 8 | ||
36 | #define PLL_OUT_SHIFT 14 | ||
37 | #define PLL_MAX_ID 1 | ||
38 | |||
39 | struct clk_pll_characteristics { | ||
40 | struct clk_range input; | ||
41 | int num_output; | ||
42 | struct clk_range *output; | ||
43 | u16 *icpll; | ||
44 | u8 *out; | ||
45 | }; | ||
46 | |||
47 | struct clk_pll_layout { | ||
48 | u32 pllr_mask; | ||
49 | u16 mul_mask; | ||
50 | u8 mul_shift; | ||
51 | }; | ||
52 | |||
53 | #define to_clk_pll(hw) container_of(hw, struct clk_pll, hw) | ||
54 | |||
55 | struct clk_pll { | ||
56 | struct clk_hw hw; | ||
57 | struct at91_pmc *pmc; | ||
58 | unsigned int irq; | ||
59 | wait_queue_head_t wait; | ||
60 | u8 id; | ||
61 | u8 div; | ||
62 | u8 range; | ||
63 | u16 mul; | ||
64 | const struct clk_pll_layout *layout; | ||
65 | const struct clk_pll_characteristics *characteristics; | ||
66 | }; | ||
67 | |||
68 | static irqreturn_t clk_pll_irq_handler(int irq, void *dev_id) | ||
69 | { | ||
70 | struct clk_pll *pll = (struct clk_pll *)dev_id; | ||
71 | |||
72 | wake_up(&pll->wait); | ||
73 | disable_irq_nosync(pll->irq); | ||
74 | |||
75 | return IRQ_HANDLED; | ||
76 | } | ||
77 | |||
78 | static int clk_pll_prepare(struct clk_hw *hw) | ||
79 | { | ||
80 | struct clk_pll *pll = to_clk_pll(hw); | ||
81 | struct at91_pmc *pmc = pll->pmc; | ||
82 | const struct clk_pll_layout *layout = pll->layout; | ||
83 | const struct clk_pll_characteristics *characteristics = | ||
84 | pll->characteristics; | ||
85 | u8 id = pll->id; | ||
86 | u32 mask = PLL_STATUS_MASK(id); | ||
87 | int offset = PLL_REG(id); | ||
88 | u8 out = 0; | ||
89 | u32 pllr, icpr; | ||
90 | u8 div; | ||
91 | u16 mul; | ||
92 | |||
93 | pllr = pmc_read(pmc, offset); | ||
94 | div = PLL_DIV(pllr); | ||
95 | mul = PLL_MUL(pllr, layout); | ||
96 | |||
97 | if ((pmc_read(pmc, AT91_PMC_SR) & mask) && | ||
98 | (div == pll->div && mul == pll->mul)) | ||
99 | return 0; | ||
100 | |||
101 | if (characteristics->out) | ||
102 | out = characteristics->out[pll->range]; | ||
103 | if (characteristics->icpll) { | ||
104 | icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id); | ||
105 | icpr |= (characteristics->icpll[pll->range] << | ||
106 | PLL_ICPR_SHIFT(id)); | ||
107 | pmc_write(pmc, AT91_PMC_PLLICPR, icpr); | ||
108 | } | ||
109 | |||
110 | pllr &= ~layout->pllr_mask; | ||
111 | pllr |= layout->pllr_mask & | ||
112 | (pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) | | ||
113 | (out << PLL_OUT_SHIFT) | | ||
114 | ((pll->mul & layout->mul_mask) << layout->mul_shift)); | ||
115 | pmc_write(pmc, offset, pllr); | ||
116 | |||
117 | while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { | ||
118 | enable_irq(pll->irq); | ||
119 | wait_event(pll->wait, | ||
120 | pmc_read(pmc, AT91_PMC_SR) & mask); | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static int clk_pll_is_prepared(struct clk_hw *hw) | ||
127 | { | ||
128 | struct clk_pll *pll = to_clk_pll(hw); | ||
129 | struct at91_pmc *pmc = pll->pmc; | ||
130 | |||
131 | return !!(pmc_read(pmc, AT91_PMC_SR) & | ||
132 | PLL_STATUS_MASK(pll->id)); | ||
133 | } | ||
134 | |||
135 | static void clk_pll_unprepare(struct clk_hw *hw) | ||
136 | { | ||
137 | struct clk_pll *pll = to_clk_pll(hw); | ||
138 | struct at91_pmc *pmc = pll->pmc; | ||
139 | const struct clk_pll_layout *layout = pll->layout; | ||
140 | int offset = PLL_REG(pll->id); | ||
141 | u32 tmp = pmc_read(pmc, offset) & ~(layout->pllr_mask); | ||
142 | |||
143 | pmc_write(pmc, offset, tmp); | ||
144 | } | ||
145 | |||
146 | static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | ||
147 | unsigned long parent_rate) | ||
148 | { | ||
149 | struct clk_pll *pll = to_clk_pll(hw); | ||
150 | const struct clk_pll_layout *layout = pll->layout; | ||
151 | struct at91_pmc *pmc = pll->pmc; | ||
152 | int offset = PLL_REG(pll->id); | ||
153 | u32 tmp = pmc_read(pmc, offset) & layout->pllr_mask; | ||
154 | u8 div = PLL_DIV(tmp); | ||
155 | u16 mul = PLL_MUL(tmp, layout); | ||
156 | if (!div || !mul) | ||
157 | return 0; | ||
158 | |||
159 | return (parent_rate * (mul + 1)) / div; | ||
160 | } | ||
161 | |||
162 | static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate, | ||
163 | unsigned long parent_rate, | ||
164 | u32 *div, u32 *mul, | ||
165 | u32 *index) { | ||
166 | unsigned long maxrate; | ||
167 | unsigned long minrate; | ||
168 | unsigned long divrate; | ||
169 | unsigned long bestdiv = 1; | ||
170 | unsigned long bestmul; | ||
171 | unsigned long tmpdiv; | ||
172 | unsigned long roundup; | ||
173 | unsigned long rounddown; | ||
174 | unsigned long remainder; | ||
175 | unsigned long bestremainder; | ||
176 | unsigned long maxmul; | ||
177 | unsigned long maxdiv; | ||
178 | unsigned long mindiv; | ||
179 | int i = 0; | ||
180 | const struct clk_pll_layout *layout = pll->layout; | ||
181 | const struct clk_pll_characteristics *characteristics = | ||
182 | pll->characteristics; | ||
183 | |||
184 | /* Minimum divider = 1 */ | ||
185 | /* Maximum multiplier = max_mul */ | ||
186 | maxmul = layout->mul_mask + 1; | ||
187 | maxrate = (parent_rate * maxmul) / 1; | ||
188 | |||
189 | /* Maximum divider = max_div */ | ||
190 | /* Minimum multiplier = 2 */ | ||
191 | maxdiv = PLL_DIV_MAX; | ||
192 | minrate = (parent_rate * 2) / maxdiv; | ||
193 | |||
194 | if (parent_rate < characteristics->input.min || | ||
195 | parent_rate < characteristics->input.max) | ||
196 | return -ERANGE; | ||
197 | |||
198 | if (parent_rate < minrate || parent_rate > maxrate) | ||
199 | return -ERANGE; | ||
200 | |||
201 | for (i = 0; i < characteristics->num_output; i++) { | ||
202 | if (parent_rate >= characteristics->output[i].min && | ||
203 | parent_rate <= characteristics->output[i].max) | ||
204 | break; | ||
205 | } | ||
206 | |||
207 | if (i >= characteristics->num_output) | ||
208 | return -ERANGE; | ||
209 | |||
210 | bestmul = rate / parent_rate; | ||
211 | rounddown = parent_rate % rate; | ||
212 | roundup = rate - rounddown; | ||
213 | bestremainder = roundup < rounddown ? roundup : rounddown; | ||
214 | |||
215 | if (!bestremainder) { | ||
216 | if (div) | ||
217 | *div = bestdiv; | ||
218 | if (mul) | ||
219 | *mul = bestmul; | ||
220 | if (index) | ||
221 | *index = i; | ||
222 | return rate; | ||
223 | } | ||
224 | |||
225 | maxdiv = 255 / (bestmul + 1); | ||
226 | if (parent_rate / maxdiv < characteristics->input.min) | ||
227 | maxdiv = parent_rate / characteristics->input.min; | ||
228 | mindiv = parent_rate / characteristics->input.max; | ||
229 | if (parent_rate % characteristics->input.max) | ||
230 | mindiv++; | ||
231 | |||
232 | for (tmpdiv = mindiv; tmpdiv < maxdiv; tmpdiv++) { | ||
233 | divrate = parent_rate / tmpdiv; | ||
234 | |||
235 | rounddown = rate % divrate; | ||
236 | roundup = divrate - rounddown; | ||
237 | remainder = roundup < rounddown ? roundup : rounddown; | ||
238 | |||
239 | if (remainder < bestremainder) { | ||
240 | bestremainder = remainder; | ||
241 | bestmul = rate / divrate; | ||
242 | bestdiv = tmpdiv; | ||
243 | } | ||
244 | |||
245 | if (!remainder) | ||
246 | break; | ||
247 | } | ||
248 | |||
249 | rate = (parent_rate / bestdiv) * bestmul; | ||
250 | |||
251 | if (div) | ||
252 | *div = bestdiv; | ||
253 | if (mul) | ||
254 | *mul = bestmul; | ||
255 | if (index) | ||
256 | *index = i; | ||
257 | |||
258 | return rate; | ||
259 | } | ||
260 | |||
261 | static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
262 | unsigned long *parent_rate) | ||
263 | { | ||
264 | struct clk_pll *pll = to_clk_pll(hw); | ||
265 | |||
266 | return clk_pll_get_best_div_mul(pll, rate, *parent_rate, | ||
267 | NULL, NULL, NULL); | ||
268 | } | ||
269 | |||
270 | static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | ||
271 | unsigned long parent_rate) | ||
272 | { | ||
273 | struct clk_pll *pll = to_clk_pll(hw); | ||
274 | long ret; | ||
275 | u32 div; | ||
276 | u32 mul; | ||
277 | u32 index; | ||
278 | |||
279 | ret = clk_pll_get_best_div_mul(pll, rate, parent_rate, | ||
280 | &div, &mul, &index); | ||
281 | if (ret < 0) | ||
282 | return ret; | ||
283 | |||
284 | pll->range = index; | ||
285 | pll->div = div; | ||
286 | pll->mul = mul; | ||
287 | |||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | static const struct clk_ops pll_ops = { | ||
292 | .prepare = clk_pll_prepare, | ||
293 | .unprepare = clk_pll_unprepare, | ||
294 | .is_prepared = clk_pll_is_prepared, | ||
295 | .recalc_rate = clk_pll_recalc_rate, | ||
296 | .round_rate = clk_pll_round_rate, | ||
297 | .set_rate = clk_pll_set_rate, | ||
298 | }; | ||
299 | |||
300 | static struct clk * __init | ||
301 | at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, | ||
302 | const char *parent_name, u8 id, | ||
303 | const struct clk_pll_layout *layout, | ||
304 | const struct clk_pll_characteristics *characteristics) | ||
305 | { | ||
306 | struct clk_pll *pll; | ||
307 | struct clk *clk = NULL; | ||
308 | struct clk_init_data init; | ||
309 | int ret; | ||
310 | int offset = PLL_REG(id); | ||
311 | u32 tmp; | ||
312 | |||
313 | if (id > PLL_MAX_ID) | ||
314 | return ERR_PTR(-EINVAL); | ||
315 | |||
316 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
317 | if (!pll) | ||
318 | return ERR_PTR(-ENOMEM); | ||
319 | |||
320 | init.name = name; | ||
321 | init.ops = &pll_ops; | ||
322 | init.parent_names = &parent_name; | ||
323 | init.num_parents = 1; | ||
324 | init.flags = CLK_SET_RATE_GATE; | ||
325 | |||
326 | pll->id = id; | ||
327 | pll->hw.init = &init; | ||
328 | pll->layout = layout; | ||
329 | pll->characteristics = characteristics; | ||
330 | pll->pmc = pmc; | ||
331 | pll->irq = irq; | ||
332 | tmp = pmc_read(pmc, offset) & layout->pllr_mask; | ||
333 | pll->div = PLL_DIV(tmp); | ||
334 | pll->mul = PLL_MUL(tmp, layout); | ||
335 | init_waitqueue_head(&pll->wait); | ||
336 | irq_set_status_flags(pll->irq, IRQ_NOAUTOEN); | ||
337 | ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH, | ||
338 | id ? "clk-pllb" : "clk-plla", pll); | ||
339 | if (ret) | ||
340 | return ERR_PTR(ret); | ||
341 | |||
342 | clk = clk_register(NULL, &pll->hw); | ||
343 | if (IS_ERR(clk)) | ||
344 | kfree(pll); | ||
345 | |||
346 | return clk; | ||
347 | } | ||
348 | |||
349 | |||
350 | static const struct clk_pll_layout at91rm9200_pll_layout = { | ||
351 | .pllr_mask = 0x7FFFFFF, | ||
352 | .mul_shift = 16, | ||
353 | .mul_mask = 0x7FF, | ||
354 | }; | ||
355 | |||
356 | static const struct clk_pll_layout at91sam9g45_pll_layout = { | ||
357 | .pllr_mask = 0xFFFFFF, | ||
358 | .mul_shift = 16, | ||
359 | .mul_mask = 0xFF, | ||
360 | }; | ||
361 | |||
362 | static const struct clk_pll_layout at91sam9g20_pllb_layout = { | ||
363 | .pllr_mask = 0x3FFFFF, | ||
364 | .mul_shift = 16, | ||
365 | .mul_mask = 0x3F, | ||
366 | }; | ||
367 | |||
368 | static const struct clk_pll_layout sama5d3_pll_layout = { | ||
369 | .pllr_mask = 0x1FFFFFF, | ||
370 | .mul_shift = 18, | ||
371 | .mul_mask = 0x7F, | ||
372 | }; | ||
373 | |||
374 | |||
375 | static struct clk_pll_characteristics * __init | ||
376 | of_at91_clk_pll_get_characteristics(struct device_node *np) | ||
377 | { | ||
378 | int i; | ||
379 | int offset; | ||
380 | u32 tmp; | ||
381 | int num_output; | ||
382 | u32 num_cells; | ||
383 | struct clk_range input; | ||
384 | struct clk_range *output; | ||
385 | u8 *out = NULL; | ||
386 | u16 *icpll = NULL; | ||
387 | struct clk_pll_characteristics *characteristics; | ||
388 | |||
389 | if (of_at91_get_clk_range(np, "atmel,clk-input-range", &input)) | ||
390 | return NULL; | ||
391 | |||
392 | if (of_property_read_u32(np, "#atmel,pll-clk-output-range-cells", | ||
393 | &num_cells)) | ||
394 | return NULL; | ||
395 | |||
396 | if (num_cells < 2 || num_cells > 4) | ||
397 | return NULL; | ||
398 | |||
399 | if (!of_get_property(np, "atmel,pll-clk-output-ranges", &tmp)) | ||
400 | return NULL; | ||
401 | num_output = tmp / (sizeof(u32) * num_cells); | ||
402 | |||
403 | characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); | ||
404 | if (!characteristics) | ||
405 | return NULL; | ||
406 | |||
407 | output = kzalloc(sizeof(*output) * num_output, GFP_KERNEL); | ||
408 | if (!output) | ||
409 | goto out_free_characteristics; | ||
410 | |||
411 | if (num_cells > 2) { | ||
412 | out = kzalloc(sizeof(*out) * num_output, GFP_KERNEL); | ||
413 | if (!out) | ||
414 | goto out_free_output; | ||
415 | } | ||
416 | |||
417 | if (num_cells > 3) { | ||
418 | icpll = kzalloc(sizeof(*icpll) * num_output, GFP_KERNEL); | ||
419 | if (!icpll) | ||
420 | goto out_free_output; | ||
421 | } | ||
422 | |||
423 | for (i = 0; i < num_output; i++) { | ||
424 | offset = i * num_cells; | ||
425 | if (of_property_read_u32_index(np, | ||
426 | "atmel,pll-clk-output-ranges", | ||
427 | offset, &tmp)) | ||
428 | goto out_free_output; | ||
429 | output[i].min = tmp; | ||
430 | if (of_property_read_u32_index(np, | ||
431 | "atmel,pll-clk-output-ranges", | ||
432 | offset + 1, &tmp)) | ||
433 | goto out_free_output; | ||
434 | output[i].max = tmp; | ||
435 | |||
436 | if (num_cells == 2) | ||
437 | continue; | ||
438 | |||
439 | if (of_property_read_u32_index(np, | ||
440 | "atmel,pll-clk-output-ranges", | ||
441 | offset + 2, &tmp)) | ||
442 | goto out_free_output; | ||
443 | out[i] = tmp; | ||
444 | |||
445 | if (num_cells == 3) | ||
446 | continue; | ||
447 | |||
448 | if (of_property_read_u32_index(np, | ||
449 | "atmel,pll-clk-output-ranges", | ||
450 | offset + 3, &tmp)) | ||
451 | goto out_free_output; | ||
452 | icpll[i] = tmp; | ||
453 | } | ||
454 | |||
455 | characteristics->input = input; | ||
456 | characteristics->num_output = num_output; | ||
457 | characteristics->output = output; | ||
458 | characteristics->out = out; | ||
459 | characteristics->icpll = icpll; | ||
460 | return characteristics; | ||
461 | |||
462 | out_free_output: | ||
463 | kfree(icpll); | ||
464 | kfree(out); | ||
465 | kfree(output); | ||
466 | out_free_characteristics: | ||
467 | kfree(characteristics); | ||
468 | return NULL; | ||
469 | } | ||
470 | |||
471 | static void __init | ||
472 | of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, | ||
473 | const struct clk_pll_layout *layout) | ||
474 | { | ||
475 | u32 id; | ||
476 | unsigned int irq; | ||
477 | struct clk *clk; | ||
478 | const char *parent_name; | ||
479 | const char *name = np->name; | ||
480 | struct clk_pll_characteristics *characteristics; | ||
481 | |||
482 | if (of_property_read_u32(np, "reg", &id)) | ||
483 | return; | ||
484 | |||
485 | parent_name = of_clk_get_parent_name(np, 0); | ||
486 | |||
487 | of_property_read_string(np, "clock-output-names", &name); | ||
488 | |||
489 | characteristics = of_at91_clk_pll_get_characteristics(np); | ||
490 | if (!characteristics) | ||
491 | return; | ||
492 | |||
493 | irq = irq_of_parse_and_map(np, 0); | ||
494 | if (!irq) | ||
495 | return; | ||
496 | |||
497 | clk = at91_clk_register_pll(pmc, irq, name, parent_name, id, layout, | ||
498 | characteristics); | ||
499 | if (IS_ERR(clk)) | ||
500 | goto out_free_characteristics; | ||
501 | |||
502 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
503 | return; | ||
504 | |||
505 | out_free_characteristics: | ||
506 | kfree(characteristics); | ||
507 | } | ||
508 | |||
509 | void __init of_at91rm9200_clk_pll_setup(struct device_node *np, | ||
510 | struct at91_pmc *pmc) | ||
511 | { | ||
512 | of_at91_clk_pll_setup(np, pmc, &at91rm9200_pll_layout); | ||
513 | } | ||
514 | |||
515 | void __init of_at91sam9g45_clk_pll_setup(struct device_node *np, | ||
516 | struct at91_pmc *pmc) | ||
517 | { | ||
518 | of_at91_clk_pll_setup(np, pmc, &at91sam9g45_pll_layout); | ||
519 | } | ||
520 | |||
521 | void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np, | ||
522 | struct at91_pmc *pmc) | ||
523 | { | ||
524 | of_at91_clk_pll_setup(np, pmc, &at91sam9g20_pllb_layout); | ||
525 | } | ||
526 | |||
527 | void __init of_sama5d3_clk_pll_setup(struct device_node *np, | ||
528 | struct at91_pmc *pmc) | ||
529 | { | ||
530 | of_at91_clk_pll_setup(np, pmc, &sama5d3_pll_layout); | ||
531 | } | ||
diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c new file mode 100644 index 000000000000..ea226562bb40 --- /dev/null +++ b/drivers/clk/at91/clk-plldiv.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include "pmc.h" | ||
19 | |||
20 | #define to_clk_plldiv(hw) container_of(hw, struct clk_plldiv, hw) | ||
21 | |||
22 | struct clk_plldiv { | ||
23 | struct clk_hw hw; | ||
24 | struct at91_pmc *pmc; | ||
25 | }; | ||
26 | |||
27 | static unsigned long clk_plldiv_recalc_rate(struct clk_hw *hw, | ||
28 | unsigned long parent_rate) | ||
29 | { | ||
30 | struct clk_plldiv *plldiv = to_clk_plldiv(hw); | ||
31 | struct at91_pmc *pmc = plldiv->pmc; | ||
32 | |||
33 | if (pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_PLLADIV2) | ||
34 | return parent_rate / 2; | ||
35 | |||
36 | return parent_rate; | ||
37 | } | ||
38 | |||
39 | static long clk_plldiv_round_rate(struct clk_hw *hw, unsigned long rate, | ||
40 | unsigned long *parent_rate) | ||
41 | { | ||
42 | unsigned long div; | ||
43 | |||
44 | if (rate > *parent_rate) | ||
45 | return *parent_rate; | ||
46 | div = *parent_rate / 2; | ||
47 | if (rate < div) | ||
48 | return div; | ||
49 | |||
50 | if (rate - div < *parent_rate - rate) | ||
51 | return div; | ||
52 | |||
53 | return *parent_rate; | ||
54 | } | ||
55 | |||
56 | static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate, | ||
57 | unsigned long parent_rate) | ||
58 | { | ||
59 | struct clk_plldiv *plldiv = to_clk_plldiv(hw); | ||
60 | struct at91_pmc *pmc = plldiv->pmc; | ||
61 | u32 tmp; | ||
62 | |||
63 | if (parent_rate != rate && (parent_rate / 2) != rate) | ||
64 | return -EINVAL; | ||
65 | |||
66 | pmc_lock(pmc); | ||
67 | tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_PLLADIV2; | ||
68 | if ((parent_rate / 2) == rate) | ||
69 | tmp |= AT91_PMC_PLLADIV2; | ||
70 | pmc_write(pmc, AT91_PMC_MCKR, tmp); | ||
71 | pmc_unlock(pmc); | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static const struct clk_ops plldiv_ops = { | ||
77 | .recalc_rate = clk_plldiv_recalc_rate, | ||
78 | .round_rate = clk_plldiv_round_rate, | ||
79 | .set_rate = clk_plldiv_set_rate, | ||
80 | }; | ||
81 | |||
82 | static struct clk * __init | ||
83 | at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, | ||
84 | const char *parent_name) | ||
85 | { | ||
86 | struct clk_plldiv *plldiv; | ||
87 | struct clk *clk = NULL; | ||
88 | struct clk_init_data init; | ||
89 | |||
90 | plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL); | ||
91 | if (!plldiv) | ||
92 | return ERR_PTR(-ENOMEM); | ||
93 | |||
94 | init.name = name; | ||
95 | init.ops = &plldiv_ops; | ||
96 | init.parent_names = parent_name ? &parent_name : NULL; | ||
97 | init.num_parents = parent_name ? 1 : 0; | ||
98 | init.flags = CLK_SET_RATE_GATE; | ||
99 | |||
100 | plldiv->hw.init = &init; | ||
101 | plldiv->pmc = pmc; | ||
102 | |||
103 | clk = clk_register(NULL, &plldiv->hw); | ||
104 | |||
105 | if (IS_ERR(clk)) | ||
106 | kfree(plldiv); | ||
107 | |||
108 | return clk; | ||
109 | } | ||
110 | |||
111 | static void __init | ||
112 | of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) | ||
113 | { | ||
114 | struct clk *clk; | ||
115 | const char *parent_name; | ||
116 | const char *name = np->name; | ||
117 | |||
118 | parent_name = of_clk_get_parent_name(np, 0); | ||
119 | |||
120 | of_property_read_string(np, "clock-output-names", &name); | ||
121 | |||
122 | clk = at91_clk_register_plldiv(pmc, name, parent_name); | ||
123 | |||
124 | if (IS_ERR(clk)) | ||
125 | return; | ||
126 | |||
127 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, | ||
132 | struct at91_pmc *pmc) | ||
133 | { | ||
134 | of_at91_clk_plldiv_setup(np, pmc); | ||
135 | } | ||
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c new file mode 100644 index 000000000000..fd792b203eaf --- /dev/null +++ b/drivers/clk/at91/clk-programmable.c | |||
@@ -0,0 +1,366 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/of_irq.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/wait.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/irq.h> | ||
22 | |||
23 | #include "pmc.h" | ||
24 | |||
25 | #define PROG_SOURCE_MAX 5 | ||
26 | #define PROG_ID_MAX 7 | ||
27 | |||
28 | #define PROG_STATUS_MASK(id) (1 << ((id) + 8)) | ||
29 | #define PROG_PRES_MASK 0x7 | ||
30 | #define PROG_MAX_RM9200_CSS 3 | ||
31 | |||
32 | struct clk_programmable_layout { | ||
33 | u8 pres_shift; | ||
34 | u8 css_mask; | ||
35 | u8 have_slck_mck; | ||
36 | }; | ||
37 | |||
38 | struct clk_programmable { | ||
39 | struct clk_hw hw; | ||
40 | struct at91_pmc *pmc; | ||
41 | unsigned int irq; | ||
42 | wait_queue_head_t wait; | ||
43 | u8 id; | ||
44 | u8 css; | ||
45 | u8 pres; | ||
46 | u8 slckmck; | ||
47 | const struct clk_programmable_layout *layout; | ||
48 | }; | ||
49 | |||
50 | #define to_clk_programmable(hw) container_of(hw, struct clk_programmable, hw) | ||
51 | |||
52 | |||
53 | static irqreturn_t clk_programmable_irq_handler(int irq, void *dev_id) | ||
54 | { | ||
55 | struct clk_programmable *prog = (struct clk_programmable *)dev_id; | ||
56 | |||
57 | wake_up(&prog->wait); | ||
58 | |||
59 | return IRQ_HANDLED; | ||
60 | } | ||
61 | |||
62 | static int clk_programmable_prepare(struct clk_hw *hw) | ||
63 | { | ||
64 | u32 tmp; | ||
65 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
66 | struct at91_pmc *pmc = prog->pmc; | ||
67 | const struct clk_programmable_layout *layout = prog->layout; | ||
68 | u8 id = prog->id; | ||
69 | u32 mask = PROG_STATUS_MASK(id); | ||
70 | |||
71 | tmp = prog->css | (prog->pres << layout->pres_shift); | ||
72 | if (layout->have_slck_mck && prog->slckmck) | ||
73 | tmp |= AT91_PMC_CSSMCK_MCK; | ||
74 | |||
75 | pmc_write(pmc, AT91_PMC_PCKR(id), tmp); | ||
76 | |||
77 | while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) | ||
78 | wait_event(prog->wait, pmc_read(pmc, AT91_PMC_SR) & mask); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static int clk_programmable_is_ready(struct clk_hw *hw) | ||
84 | { | ||
85 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
86 | struct at91_pmc *pmc = prog->pmc; | ||
87 | |||
88 | return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_PCKR(prog->id)); | ||
89 | } | ||
90 | |||
91 | static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw, | ||
92 | unsigned long parent_rate) | ||
93 | { | ||
94 | u32 tmp; | ||
95 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
96 | struct at91_pmc *pmc = prog->pmc; | ||
97 | const struct clk_programmable_layout *layout = prog->layout; | ||
98 | |||
99 | tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); | ||
100 | prog->pres = (tmp >> layout->pres_shift) & PROG_PRES_MASK; | ||
101 | |||
102 | return parent_rate >> prog->pres; | ||
103 | } | ||
104 | |||
105 | static long clk_programmable_round_rate(struct clk_hw *hw, unsigned long rate, | ||
106 | unsigned long *parent_rate) | ||
107 | { | ||
108 | unsigned long best_rate = *parent_rate; | ||
109 | unsigned long best_diff; | ||
110 | unsigned long new_diff; | ||
111 | unsigned long cur_rate; | ||
112 | int shift = shift; | ||
113 | |||
114 | if (rate > *parent_rate) | ||
115 | return *parent_rate; | ||
116 | else | ||
117 | best_diff = *parent_rate - rate; | ||
118 | |||
119 | if (!best_diff) | ||
120 | return best_rate; | ||
121 | |||
122 | for (shift = 1; shift < PROG_PRES_MASK; shift++) { | ||
123 | cur_rate = *parent_rate >> shift; | ||
124 | |||
125 | if (cur_rate > rate) | ||
126 | new_diff = cur_rate - rate; | ||
127 | else | ||
128 | new_diff = rate - cur_rate; | ||
129 | |||
130 | if (!new_diff) | ||
131 | return cur_rate; | ||
132 | |||
133 | if (new_diff < best_diff) { | ||
134 | best_diff = new_diff; | ||
135 | best_rate = cur_rate; | ||
136 | } | ||
137 | |||
138 | if (rate > cur_rate) | ||
139 | break; | ||
140 | } | ||
141 | |||
142 | return best_rate; | ||
143 | } | ||
144 | |||
145 | static int clk_programmable_set_parent(struct clk_hw *hw, u8 index) | ||
146 | { | ||
147 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
148 | const struct clk_programmable_layout *layout = prog->layout; | ||
149 | if (index > layout->css_mask) { | ||
150 | if (index > PROG_MAX_RM9200_CSS && layout->have_slck_mck) { | ||
151 | prog->css = 0; | ||
152 | prog->slckmck = 1; | ||
153 | return 0; | ||
154 | } else { | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | prog->css = index; | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static u8 clk_programmable_get_parent(struct clk_hw *hw) | ||
164 | { | ||
165 | u32 tmp; | ||
166 | u8 ret; | ||
167 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
168 | struct at91_pmc *pmc = prog->pmc; | ||
169 | const struct clk_programmable_layout *layout = prog->layout; | ||
170 | |||
171 | tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); | ||
172 | prog->css = tmp & layout->css_mask; | ||
173 | ret = prog->css; | ||
174 | if (layout->have_slck_mck) { | ||
175 | prog->slckmck = !!(tmp & AT91_PMC_CSSMCK_MCK); | ||
176 | if (prog->slckmck && !ret) | ||
177 | ret = PROG_MAX_RM9200_CSS + 1; | ||
178 | } | ||
179 | |||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate, | ||
184 | unsigned long parent_rate) | ||
185 | { | ||
186 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
187 | unsigned long best_rate = parent_rate; | ||
188 | unsigned long best_diff; | ||
189 | unsigned long new_diff; | ||
190 | unsigned long cur_rate; | ||
191 | int shift = 0; | ||
192 | |||
193 | if (rate > parent_rate) | ||
194 | return parent_rate; | ||
195 | else | ||
196 | best_diff = parent_rate - rate; | ||
197 | |||
198 | if (!best_diff) { | ||
199 | prog->pres = shift; | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | for (shift = 1; shift < PROG_PRES_MASK; shift++) { | ||
204 | cur_rate = parent_rate >> shift; | ||
205 | |||
206 | if (cur_rate > rate) | ||
207 | new_diff = cur_rate - rate; | ||
208 | else | ||
209 | new_diff = rate - cur_rate; | ||
210 | |||
211 | if (!new_diff) | ||
212 | break; | ||
213 | |||
214 | if (new_diff < best_diff) { | ||
215 | best_diff = new_diff; | ||
216 | best_rate = cur_rate; | ||
217 | } | ||
218 | |||
219 | if (rate > cur_rate) | ||
220 | break; | ||
221 | } | ||
222 | |||
223 | prog->pres = shift; | ||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static const struct clk_ops programmable_ops = { | ||
228 | .prepare = clk_programmable_prepare, | ||
229 | .is_prepared = clk_programmable_is_ready, | ||
230 | .recalc_rate = clk_programmable_recalc_rate, | ||
231 | .round_rate = clk_programmable_round_rate, | ||
232 | .get_parent = clk_programmable_get_parent, | ||
233 | .set_parent = clk_programmable_set_parent, | ||
234 | .set_rate = clk_programmable_set_rate, | ||
235 | }; | ||
236 | |||
237 | static struct clk * __init | ||
238 | at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq, | ||
239 | const char *name, const char **parent_names, | ||
240 | u8 num_parents, u8 id, | ||
241 | const struct clk_programmable_layout *layout) | ||
242 | { | ||
243 | int ret; | ||
244 | struct clk_programmable *prog; | ||
245 | struct clk *clk = NULL; | ||
246 | struct clk_init_data init; | ||
247 | char irq_name[11]; | ||
248 | |||
249 | if (id > PROG_ID_MAX) | ||
250 | return ERR_PTR(-EINVAL); | ||
251 | |||
252 | prog = kzalloc(sizeof(*prog), GFP_KERNEL); | ||
253 | if (!prog) | ||
254 | return ERR_PTR(-ENOMEM); | ||
255 | |||
256 | init.name = name; | ||
257 | init.ops = &programmable_ops; | ||
258 | init.parent_names = parent_names; | ||
259 | init.num_parents = num_parents; | ||
260 | init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; | ||
261 | |||
262 | prog->id = id; | ||
263 | prog->layout = layout; | ||
264 | prog->hw.init = &init; | ||
265 | prog->pmc = pmc; | ||
266 | prog->irq = irq; | ||
267 | init_waitqueue_head(&prog->wait); | ||
268 | irq_set_status_flags(prog->irq, IRQ_NOAUTOEN); | ||
269 | snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id); | ||
270 | ret = request_irq(prog->irq, clk_programmable_irq_handler, | ||
271 | IRQF_TRIGGER_HIGH, irq_name, prog); | ||
272 | if (ret) | ||
273 | return ERR_PTR(ret); | ||
274 | |||
275 | clk = clk_register(NULL, &prog->hw); | ||
276 | if (IS_ERR(clk)) | ||
277 | kfree(prog); | ||
278 | |||
279 | return clk; | ||
280 | } | ||
281 | |||
282 | static const struct clk_programmable_layout at91rm9200_programmable_layout = { | ||
283 | .pres_shift = 2, | ||
284 | .css_mask = 0x3, | ||
285 | .have_slck_mck = 0, | ||
286 | }; | ||
287 | |||
288 | static const struct clk_programmable_layout at91sam9g45_programmable_layout = { | ||
289 | .pres_shift = 2, | ||
290 | .css_mask = 0x3, | ||
291 | .have_slck_mck = 1, | ||
292 | }; | ||
293 | |||
294 | static const struct clk_programmable_layout at91sam9x5_programmable_layout = { | ||
295 | .pres_shift = 4, | ||
296 | .css_mask = 0x7, | ||
297 | .have_slck_mck = 0, | ||
298 | }; | ||
299 | |||
300 | static void __init | ||
301 | of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, | ||
302 | const struct clk_programmable_layout *layout) | ||
303 | { | ||
304 | int num; | ||
305 | u32 id; | ||
306 | int i; | ||
307 | unsigned int irq; | ||
308 | struct clk *clk; | ||
309 | int num_parents; | ||
310 | const char *parent_names[PROG_SOURCE_MAX]; | ||
311 | const char *name; | ||
312 | struct device_node *progclknp; | ||
313 | |||
314 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | ||
315 | if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX) | ||
316 | return; | ||
317 | |||
318 | for (i = 0; i < num_parents; ++i) { | ||
319 | parent_names[i] = of_clk_get_parent_name(np, i); | ||
320 | if (!parent_names[i]) | ||
321 | return; | ||
322 | } | ||
323 | |||
324 | num = of_get_child_count(np); | ||
325 | if (!num || num > (PROG_ID_MAX + 1)) | ||
326 | return; | ||
327 | |||
328 | for_each_child_of_node(np, progclknp) { | ||
329 | if (of_property_read_u32(progclknp, "reg", &id)) | ||
330 | continue; | ||
331 | |||
332 | if (of_property_read_string(np, "clock-output-names", &name)) | ||
333 | name = progclknp->name; | ||
334 | |||
335 | irq = irq_of_parse_and_map(progclknp, 0); | ||
336 | if (!irq) | ||
337 | continue; | ||
338 | |||
339 | clk = at91_clk_register_programmable(pmc, irq, name, | ||
340 | parent_names, num_parents, | ||
341 | id, layout); | ||
342 | if (IS_ERR(clk)) | ||
343 | continue; | ||
344 | |||
345 | of_clk_add_provider(progclknp, of_clk_src_simple_get, clk); | ||
346 | } | ||
347 | } | ||
348 | |||
349 | |||
350 | void __init of_at91rm9200_clk_prog_setup(struct device_node *np, | ||
351 | struct at91_pmc *pmc) | ||
352 | { | ||
353 | of_at91_clk_prog_setup(np, pmc, &at91rm9200_programmable_layout); | ||
354 | } | ||
355 | |||
356 | void __init of_at91sam9g45_clk_prog_setup(struct device_node *np, | ||
357 | struct at91_pmc *pmc) | ||
358 | { | ||
359 | of_at91_clk_prog_setup(np, pmc, &at91sam9g45_programmable_layout); | ||
360 | } | ||
361 | |||
362 | void __init of_at91sam9x5_clk_prog_setup(struct device_node *np, | ||
363 | struct at91_pmc *pmc) | ||
364 | { | ||
365 | of_at91_clk_prog_setup(np, pmc, &at91sam9x5_programmable_layout); | ||
366 | } | ||
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c new file mode 100644 index 000000000000..144d47ecfe63 --- /dev/null +++ b/drivers/clk/at91/clk-smd.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include "pmc.h" | ||
19 | |||
20 | #define SMD_SOURCE_MAX 2 | ||
21 | |||
22 | #define SMD_DIV_SHIFT 8 | ||
23 | #define SMD_MAX_DIV 0xf | ||
24 | |||
25 | struct at91sam9x5_clk_smd { | ||
26 | struct clk_hw hw; | ||
27 | struct at91_pmc *pmc; | ||
28 | }; | ||
29 | |||
30 | #define to_at91sam9x5_clk_smd(hw) \ | ||
31 | container_of(hw, struct at91sam9x5_clk_smd, hw) | ||
32 | |||
33 | static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw, | ||
34 | unsigned long parent_rate) | ||
35 | { | ||
36 | u32 tmp; | ||
37 | u8 smddiv; | ||
38 | struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); | ||
39 | struct at91_pmc *pmc = smd->pmc; | ||
40 | |||
41 | tmp = pmc_read(pmc, AT91_PMC_SMD); | ||
42 | smddiv = (tmp & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT; | ||
43 | return parent_rate / (smddiv + 1); | ||
44 | } | ||
45 | |||
46 | static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate, | ||
47 | unsigned long *parent_rate) | ||
48 | { | ||
49 | unsigned long div; | ||
50 | unsigned long bestrate; | ||
51 | unsigned long tmp; | ||
52 | |||
53 | if (rate >= *parent_rate) | ||
54 | return *parent_rate; | ||
55 | |||
56 | div = *parent_rate / rate; | ||
57 | if (div > SMD_MAX_DIV) | ||
58 | return *parent_rate / (SMD_MAX_DIV + 1); | ||
59 | |||
60 | bestrate = *parent_rate / div; | ||
61 | tmp = *parent_rate / (div + 1); | ||
62 | if (bestrate - rate > rate - tmp) | ||
63 | bestrate = tmp; | ||
64 | |||
65 | return bestrate; | ||
66 | } | ||
67 | |||
68 | static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index) | ||
69 | { | ||
70 | u32 tmp; | ||
71 | struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); | ||
72 | struct at91_pmc *pmc = smd->pmc; | ||
73 | |||
74 | if (index > 1) | ||
75 | return -EINVAL; | ||
76 | tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS; | ||
77 | if (index) | ||
78 | tmp |= AT91_PMC_SMDS; | ||
79 | pmc_write(pmc, AT91_PMC_SMD, tmp); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static u8 at91sam9x5_clk_smd_get_parent(struct clk_hw *hw) | ||
84 | { | ||
85 | struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); | ||
86 | struct at91_pmc *pmc = smd->pmc; | ||
87 | |||
88 | return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS; | ||
89 | } | ||
90 | |||
91 | static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate, | ||
92 | unsigned long parent_rate) | ||
93 | { | ||
94 | u32 tmp; | ||
95 | struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); | ||
96 | struct at91_pmc *pmc = smd->pmc; | ||
97 | unsigned long div = parent_rate / rate; | ||
98 | |||
99 | if (parent_rate % rate || div < 1 || div > (SMD_MAX_DIV + 1)) | ||
100 | return -EINVAL; | ||
101 | tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMD_DIV; | ||
102 | tmp |= (div - 1) << SMD_DIV_SHIFT; | ||
103 | pmc_write(pmc, AT91_PMC_SMD, tmp); | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static const struct clk_ops at91sam9x5_smd_ops = { | ||
109 | .recalc_rate = at91sam9x5_clk_smd_recalc_rate, | ||
110 | .round_rate = at91sam9x5_clk_smd_round_rate, | ||
111 | .get_parent = at91sam9x5_clk_smd_get_parent, | ||
112 | .set_parent = at91sam9x5_clk_smd_set_parent, | ||
113 | .set_rate = at91sam9x5_clk_smd_set_rate, | ||
114 | }; | ||
115 | |||
116 | static struct clk * __init | ||
117 | at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, | ||
118 | const char **parent_names, u8 num_parents) | ||
119 | { | ||
120 | struct at91sam9x5_clk_smd *smd; | ||
121 | struct clk *clk = NULL; | ||
122 | struct clk_init_data init; | ||
123 | |||
124 | smd = kzalloc(sizeof(*smd), GFP_KERNEL); | ||
125 | if (!smd) | ||
126 | return ERR_PTR(-ENOMEM); | ||
127 | |||
128 | init.name = name; | ||
129 | init.ops = &at91sam9x5_smd_ops; | ||
130 | init.parent_names = parent_names; | ||
131 | init.num_parents = num_parents; | ||
132 | init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; | ||
133 | |||
134 | smd->hw.init = &init; | ||
135 | smd->pmc = pmc; | ||
136 | |||
137 | clk = clk_register(NULL, &smd->hw); | ||
138 | if (IS_ERR(clk)) | ||
139 | kfree(smd); | ||
140 | |||
141 | return clk; | ||
142 | } | ||
143 | |||
144 | void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, | ||
145 | struct at91_pmc *pmc) | ||
146 | { | ||
147 | struct clk *clk; | ||
148 | int i; | ||
149 | int num_parents; | ||
150 | const char *parent_names[SMD_SOURCE_MAX]; | ||
151 | const char *name = np->name; | ||
152 | |||
153 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | ||
154 | if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX) | ||
155 | return; | ||
156 | |||
157 | for (i = 0; i < num_parents; i++) { | ||
158 | parent_names[i] = of_clk_get_parent_name(np, i); | ||
159 | if (!parent_names[i]) | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | of_property_read_string(np, "clock-output-names", &name); | ||
164 | |||
165 | clk = at91sam9x5_clk_register_smd(pmc, name, parent_names, | ||
166 | num_parents); | ||
167 | if (IS_ERR(clk)) | ||
168 | return; | ||
169 | |||
170 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
171 | } | ||
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c new file mode 100644 index 000000000000..8f7c0434a09f --- /dev/null +++ b/drivers/clk/at91/clk-system.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include "pmc.h" | ||
19 | |||
20 | #define SYSTEM_MAX_ID 31 | ||
21 | |||
22 | #define SYSTEM_MAX_NAME_SZ 32 | ||
23 | |||
24 | #define to_clk_system(hw) container_of(hw, struct clk_system, hw) | ||
25 | struct clk_system { | ||
26 | struct clk_hw hw; | ||
27 | struct at91_pmc *pmc; | ||
28 | u8 id; | ||
29 | }; | ||
30 | |||
31 | static int clk_system_enable(struct clk_hw *hw) | ||
32 | { | ||
33 | struct clk_system *sys = to_clk_system(hw); | ||
34 | struct at91_pmc *pmc = sys->pmc; | ||
35 | |||
36 | pmc_write(pmc, AT91_PMC_SCER, 1 << sys->id); | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static void clk_system_disable(struct clk_hw *hw) | ||
41 | { | ||
42 | struct clk_system *sys = to_clk_system(hw); | ||
43 | struct at91_pmc *pmc = sys->pmc; | ||
44 | |||
45 | pmc_write(pmc, AT91_PMC_SCDR, 1 << sys->id); | ||
46 | } | ||
47 | |||
48 | static int clk_system_is_enabled(struct clk_hw *hw) | ||
49 | { | ||
50 | struct clk_system *sys = to_clk_system(hw); | ||
51 | struct at91_pmc *pmc = sys->pmc; | ||
52 | |||
53 | return !!(pmc_read(pmc, AT91_PMC_SCSR) & (1 << sys->id)); | ||
54 | } | ||
55 | |||
56 | static const struct clk_ops system_ops = { | ||
57 | .enable = clk_system_enable, | ||
58 | .disable = clk_system_disable, | ||
59 | .is_enabled = clk_system_is_enabled, | ||
60 | }; | ||
61 | |||
62 | static struct clk * __init | ||
63 | at91_clk_register_system(struct at91_pmc *pmc, const char *name, | ||
64 | const char *parent_name, u8 id) | ||
65 | { | ||
66 | struct clk_system *sys; | ||
67 | struct clk *clk = NULL; | ||
68 | struct clk_init_data init; | ||
69 | |||
70 | if (!parent_name || id > SYSTEM_MAX_ID) | ||
71 | return ERR_PTR(-EINVAL); | ||
72 | |||
73 | sys = kzalloc(sizeof(*sys), GFP_KERNEL); | ||
74 | if (!sys) | ||
75 | return ERR_PTR(-ENOMEM); | ||
76 | |||
77 | init.name = name; | ||
78 | init.ops = &system_ops; | ||
79 | init.parent_names = &parent_name; | ||
80 | init.num_parents = 1; | ||
81 | /* | ||
82 | * CLK_IGNORE_UNUSED is used to avoid ddrck switch off. | ||
83 | * TODO : we should implement a driver supporting at91 ddr controller | ||
84 | * (see drivers/memory) which would request and enable the ddrck clock. | ||
85 | * When this is done we will be able to remove CLK_IGNORE_UNUSED flag. | ||
86 | */ | ||
87 | init.flags = CLK_IGNORE_UNUSED; | ||
88 | |||
89 | sys->id = id; | ||
90 | sys->hw.init = &init; | ||
91 | sys->pmc = pmc; | ||
92 | |||
93 | clk = clk_register(NULL, &sys->hw); | ||
94 | if (IS_ERR(clk)) | ||
95 | kfree(sys); | ||
96 | |||
97 | return clk; | ||
98 | } | ||
99 | |||
100 | static void __init | ||
101 | of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) | ||
102 | { | ||
103 | int num; | ||
104 | u32 id; | ||
105 | struct clk *clk; | ||
106 | const char *name; | ||
107 | struct device_node *sysclknp; | ||
108 | const char *parent_name; | ||
109 | |||
110 | num = of_get_child_count(np); | ||
111 | if (num > (SYSTEM_MAX_ID + 1)) | ||
112 | return; | ||
113 | |||
114 | for_each_child_of_node(np, sysclknp) { | ||
115 | if (of_property_read_u32(sysclknp, "reg", &id)) | ||
116 | continue; | ||
117 | |||
118 | if (of_property_read_string(np, "clock-output-names", &name)) | ||
119 | name = sysclknp->name; | ||
120 | |||
121 | parent_name = of_clk_get_parent_name(sysclknp, 0); | ||
122 | |||
123 | clk = at91_clk_register_system(pmc, name, parent_name, id); | ||
124 | if (IS_ERR(clk)) | ||
125 | continue; | ||
126 | |||
127 | of_clk_add_provider(sysclknp, of_clk_src_simple_get, clk); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | void __init of_at91rm9200_clk_sys_setup(struct device_node *np, | ||
132 | struct at91_pmc *pmc) | ||
133 | { | ||
134 | of_at91_clk_sys_setup(np, pmc); | ||
135 | } | ||
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c new file mode 100644 index 000000000000..7d1d26a4bd04 --- /dev/null +++ b/drivers/clk/at91/clk-usb.c | |||
@@ -0,0 +1,398 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include "pmc.h" | ||
19 | |||
20 | #define USB_SOURCE_MAX 2 | ||
21 | |||
22 | #define SAM9X5_USB_DIV_SHIFT 8 | ||
23 | #define SAM9X5_USB_MAX_DIV 0xf | ||
24 | |||
25 | #define RM9200_USB_DIV_SHIFT 28 | ||
26 | #define RM9200_USB_DIV_TAB_SIZE 4 | ||
27 | |||
28 | struct at91sam9x5_clk_usb { | ||
29 | struct clk_hw hw; | ||
30 | struct at91_pmc *pmc; | ||
31 | }; | ||
32 | |||
33 | #define to_at91sam9x5_clk_usb(hw) \ | ||
34 | container_of(hw, struct at91sam9x5_clk_usb, hw) | ||
35 | |||
36 | struct at91rm9200_clk_usb { | ||
37 | struct clk_hw hw; | ||
38 | struct at91_pmc *pmc; | ||
39 | u32 divisors[4]; | ||
40 | }; | ||
41 | |||
42 | #define to_at91rm9200_clk_usb(hw) \ | ||
43 | container_of(hw, struct at91rm9200_clk_usb, hw) | ||
44 | |||
45 | static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, | ||
46 | unsigned long parent_rate) | ||
47 | { | ||
48 | u32 tmp; | ||
49 | u8 usbdiv; | ||
50 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
51 | struct at91_pmc *pmc = usb->pmc; | ||
52 | |||
53 | tmp = pmc_read(pmc, AT91_PMC_USB); | ||
54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; | ||
55 | return parent_rate / (usbdiv + 1); | ||
56 | } | ||
57 | |||
58 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | ||
59 | unsigned long *parent_rate) | ||
60 | { | ||
61 | unsigned long div; | ||
62 | unsigned long bestrate; | ||
63 | unsigned long tmp; | ||
64 | |||
65 | if (rate >= *parent_rate) | ||
66 | return *parent_rate; | ||
67 | |||
68 | div = *parent_rate / rate; | ||
69 | if (div >= SAM9X5_USB_MAX_DIV) | ||
70 | return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); | ||
71 | |||
72 | bestrate = *parent_rate / div; | ||
73 | tmp = *parent_rate / (div + 1); | ||
74 | if (bestrate - rate > rate - tmp) | ||
75 | bestrate = tmp; | ||
76 | |||
77 | return bestrate; | ||
78 | } | ||
79 | |||
80 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) | ||
81 | { | ||
82 | u32 tmp; | ||
83 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
84 | struct at91_pmc *pmc = usb->pmc; | ||
85 | |||
86 | if (index > 1) | ||
87 | return -EINVAL; | ||
88 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS; | ||
89 | if (index) | ||
90 | tmp |= AT91_PMC_USBS; | ||
91 | pmc_write(pmc, AT91_PMC_USB, tmp); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static u8 at91sam9x5_clk_usb_get_parent(struct clk_hw *hw) | ||
96 | { | ||
97 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
98 | struct at91_pmc *pmc = usb->pmc; | ||
99 | |||
100 | return pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS; | ||
101 | } | ||
102 | |||
103 | static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | ||
104 | unsigned long parent_rate) | ||
105 | { | ||
106 | u32 tmp; | ||
107 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
108 | struct at91_pmc *pmc = usb->pmc; | ||
109 | unsigned long div = parent_rate / rate; | ||
110 | |||
111 | if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) | ||
112 | return -EINVAL; | ||
113 | |||
114 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; | ||
115 | tmp |= (div - 1) << SAM9X5_USB_DIV_SHIFT; | ||
116 | pmc_write(pmc, AT91_PMC_USB, tmp); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static const struct clk_ops at91sam9x5_usb_ops = { | ||
122 | .recalc_rate = at91sam9x5_clk_usb_recalc_rate, | ||
123 | .round_rate = at91sam9x5_clk_usb_round_rate, | ||
124 | .get_parent = at91sam9x5_clk_usb_get_parent, | ||
125 | .set_parent = at91sam9x5_clk_usb_set_parent, | ||
126 | .set_rate = at91sam9x5_clk_usb_set_rate, | ||
127 | }; | ||
128 | |||
129 | static int at91sam9n12_clk_usb_enable(struct clk_hw *hw) | ||
130 | { | ||
131 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
132 | struct at91_pmc *pmc = usb->pmc; | ||
133 | |||
134 | pmc_write(pmc, AT91_PMC_USB, | ||
135 | pmc_read(pmc, AT91_PMC_USB) | AT91_PMC_USBS); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static void at91sam9n12_clk_usb_disable(struct clk_hw *hw) | ||
140 | { | ||
141 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
142 | struct at91_pmc *pmc = usb->pmc; | ||
143 | |||
144 | pmc_write(pmc, AT91_PMC_USB, | ||
145 | pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS); | ||
146 | } | ||
147 | |||
148 | static int at91sam9n12_clk_usb_is_enabled(struct clk_hw *hw) | ||
149 | { | ||
150 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | ||
151 | struct at91_pmc *pmc = usb->pmc; | ||
152 | |||
153 | return !!(pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS); | ||
154 | } | ||
155 | |||
156 | static const struct clk_ops at91sam9n12_usb_ops = { | ||
157 | .enable = at91sam9n12_clk_usb_enable, | ||
158 | .disable = at91sam9n12_clk_usb_disable, | ||
159 | .is_enabled = at91sam9n12_clk_usb_is_enabled, | ||
160 | .recalc_rate = at91sam9x5_clk_usb_recalc_rate, | ||
161 | .round_rate = at91sam9x5_clk_usb_round_rate, | ||
162 | .set_rate = at91sam9x5_clk_usb_set_rate, | ||
163 | }; | ||
164 | |||
165 | static struct clk * __init | ||
166 | at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, | ||
167 | const char **parent_names, u8 num_parents) | ||
168 | { | ||
169 | struct at91sam9x5_clk_usb *usb; | ||
170 | struct clk *clk = NULL; | ||
171 | struct clk_init_data init; | ||
172 | |||
173 | usb = kzalloc(sizeof(*usb), GFP_KERNEL); | ||
174 | if (!usb) | ||
175 | return ERR_PTR(-ENOMEM); | ||
176 | |||
177 | init.name = name; | ||
178 | init.ops = &at91sam9x5_usb_ops; | ||
179 | init.parent_names = parent_names; | ||
180 | init.num_parents = num_parents; | ||
181 | init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; | ||
182 | |||
183 | usb->hw.init = &init; | ||
184 | usb->pmc = pmc; | ||
185 | |||
186 | clk = clk_register(NULL, &usb->hw); | ||
187 | if (IS_ERR(clk)) | ||
188 | kfree(usb); | ||
189 | |||
190 | return clk; | ||
191 | } | ||
192 | |||
193 | static struct clk * __init | ||
194 | at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name, | ||
195 | const char *parent_name) | ||
196 | { | ||
197 | struct at91sam9x5_clk_usb *usb; | ||
198 | struct clk *clk = NULL; | ||
199 | struct clk_init_data init; | ||
200 | |||
201 | usb = kzalloc(sizeof(*usb), GFP_KERNEL); | ||
202 | if (!usb) | ||
203 | return ERR_PTR(-ENOMEM); | ||
204 | |||
205 | init.name = name; | ||
206 | init.ops = &at91sam9n12_usb_ops; | ||
207 | init.parent_names = &parent_name; | ||
208 | init.num_parents = 1; | ||
209 | init.flags = CLK_SET_RATE_GATE; | ||
210 | |||
211 | usb->hw.init = &init; | ||
212 | usb->pmc = pmc; | ||
213 | |||
214 | clk = clk_register(NULL, &usb->hw); | ||
215 | if (IS_ERR(clk)) | ||
216 | kfree(usb); | ||
217 | |||
218 | return clk; | ||
219 | } | ||
220 | |||
221 | static unsigned long at91rm9200_clk_usb_recalc_rate(struct clk_hw *hw, | ||
222 | unsigned long parent_rate) | ||
223 | { | ||
224 | struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); | ||
225 | struct at91_pmc *pmc = usb->pmc; | ||
226 | u32 tmp; | ||
227 | u8 usbdiv; | ||
228 | |||
229 | tmp = pmc_read(pmc, AT91_CKGR_PLLBR); | ||
230 | usbdiv = (tmp & AT91_PMC_USBDIV) >> RM9200_USB_DIV_SHIFT; | ||
231 | if (usb->divisors[usbdiv]) | ||
232 | return parent_rate / usb->divisors[usbdiv]; | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | ||
238 | unsigned long *parent_rate) | ||
239 | { | ||
240 | struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); | ||
241 | unsigned long bestrate = 0; | ||
242 | int bestdiff = -1; | ||
243 | unsigned long tmprate; | ||
244 | int tmpdiff; | ||
245 | int i = 0; | ||
246 | |||
247 | for (i = 0; i < 4; i++) { | ||
248 | if (!usb->divisors[i]) | ||
249 | continue; | ||
250 | tmprate = *parent_rate / usb->divisors[i]; | ||
251 | if (tmprate < rate) | ||
252 | tmpdiff = rate - tmprate; | ||
253 | else | ||
254 | tmpdiff = tmprate - rate; | ||
255 | |||
256 | if (bestdiff < 0 || bestdiff > tmpdiff) { | ||
257 | bestrate = tmprate; | ||
258 | bestdiff = tmpdiff; | ||
259 | } | ||
260 | |||
261 | if (!bestdiff) | ||
262 | break; | ||
263 | } | ||
264 | |||
265 | return bestrate; | ||
266 | } | ||
267 | |||
268 | static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | ||
269 | unsigned long parent_rate) | ||
270 | { | ||
271 | u32 tmp; | ||
272 | int i; | ||
273 | struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); | ||
274 | struct at91_pmc *pmc = usb->pmc; | ||
275 | unsigned long div = parent_rate / rate; | ||
276 | |||
277 | if (parent_rate % rate) | ||
278 | return -EINVAL; | ||
279 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { | ||
280 | if (usb->divisors[i] == div) { | ||
281 | tmp = pmc_read(pmc, AT91_CKGR_PLLBR) & | ||
282 | ~AT91_PMC_USBDIV; | ||
283 | tmp |= i << RM9200_USB_DIV_SHIFT; | ||
284 | pmc_write(pmc, AT91_CKGR_PLLBR, tmp); | ||
285 | return 0; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return -EINVAL; | ||
290 | } | ||
291 | |||
292 | static const struct clk_ops at91rm9200_usb_ops = { | ||
293 | .recalc_rate = at91rm9200_clk_usb_recalc_rate, | ||
294 | .round_rate = at91rm9200_clk_usb_round_rate, | ||
295 | .set_rate = at91rm9200_clk_usb_set_rate, | ||
296 | }; | ||
297 | |||
298 | static struct clk * __init | ||
299 | at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, | ||
300 | const char *parent_name, const u32 *divisors) | ||
301 | { | ||
302 | struct at91rm9200_clk_usb *usb; | ||
303 | struct clk *clk = NULL; | ||
304 | struct clk_init_data init; | ||
305 | |||
306 | usb = kzalloc(sizeof(*usb), GFP_KERNEL); | ||
307 | if (!usb) | ||
308 | return ERR_PTR(-ENOMEM); | ||
309 | |||
310 | init.name = name; | ||
311 | init.ops = &at91rm9200_usb_ops; | ||
312 | init.parent_names = &parent_name; | ||
313 | init.num_parents = 1; | ||
314 | init.flags = 0; | ||
315 | |||
316 | usb->hw.init = &init; | ||
317 | usb->pmc = pmc; | ||
318 | memcpy(usb->divisors, divisors, sizeof(usb->divisors)); | ||
319 | |||
320 | clk = clk_register(NULL, &usb->hw); | ||
321 | if (IS_ERR(clk)) | ||
322 | kfree(usb); | ||
323 | |||
324 | return clk; | ||
325 | } | ||
326 | |||
327 | void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, | ||
328 | struct at91_pmc *pmc) | ||
329 | { | ||
330 | struct clk *clk; | ||
331 | int i; | ||
332 | int num_parents; | ||
333 | const char *parent_names[USB_SOURCE_MAX]; | ||
334 | const char *name = np->name; | ||
335 | |||
336 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | ||
337 | if (num_parents <= 0 || num_parents > USB_SOURCE_MAX) | ||
338 | return; | ||
339 | |||
340 | for (i = 0; i < num_parents; i++) { | ||
341 | parent_names[i] = of_clk_get_parent_name(np, i); | ||
342 | if (!parent_names[i]) | ||
343 | return; | ||
344 | } | ||
345 | |||
346 | of_property_read_string(np, "clock-output-names", &name); | ||
347 | |||
348 | clk = at91sam9x5_clk_register_usb(pmc, name, parent_names, num_parents); | ||
349 | if (IS_ERR(clk)) | ||
350 | return; | ||
351 | |||
352 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
353 | } | ||
354 | |||
355 | void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, | ||
356 | struct at91_pmc *pmc) | ||
357 | { | ||
358 | struct clk *clk; | ||
359 | const char *parent_name; | ||
360 | const char *name = np->name; | ||
361 | |||
362 | parent_name = of_clk_get_parent_name(np, 0); | ||
363 | if (!parent_name) | ||
364 | return; | ||
365 | |||
366 | of_property_read_string(np, "clock-output-names", &name); | ||
367 | |||
368 | clk = at91sam9n12_clk_register_usb(pmc, name, parent_name); | ||
369 | if (IS_ERR(clk)) | ||
370 | return; | ||
371 | |||
372 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
373 | } | ||
374 | |||
375 | void __init of_at91rm9200_clk_usb_setup(struct device_node *np, | ||
376 | struct at91_pmc *pmc) | ||
377 | { | ||
378 | struct clk *clk; | ||
379 | const char *parent_name; | ||
380 | const char *name = np->name; | ||
381 | u32 divisors[4] = {0, 0, 0, 0}; | ||
382 | |||
383 | parent_name = of_clk_get_parent_name(np, 0); | ||
384 | if (!parent_name) | ||
385 | return; | ||
386 | |||
387 | of_property_read_u32_array(np, "atmel,clk-divisors", divisors, 4); | ||
388 | if (!divisors[0]) | ||
389 | return; | ||
390 | |||
391 | of_property_read_string(np, "clock-output-names", &name); | ||
392 | |||
393 | clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors); | ||
394 | if (IS_ERR(clk)) | ||
395 | return; | ||
396 | |||
397 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
398 | } | ||
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c new file mode 100644 index 000000000000..ae3263bc1476 --- /dev/null +++ b/drivers/clk/at91/clk-utmi.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
18 | #include <linux/of_irq.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/sched.h> | ||
21 | #include <linux/wait.h> | ||
22 | |||
23 | #include "pmc.h" | ||
24 | |||
25 | #define UTMI_FIXED_MUL 40 | ||
26 | |||
27 | struct clk_utmi { | ||
28 | struct clk_hw hw; | ||
29 | struct at91_pmc *pmc; | ||
30 | unsigned int irq; | ||
31 | wait_queue_head_t wait; | ||
32 | }; | ||
33 | |||
34 | #define to_clk_utmi(hw) container_of(hw, struct clk_utmi, hw) | ||
35 | |||
36 | static irqreturn_t clk_utmi_irq_handler(int irq, void *dev_id) | ||
37 | { | ||
38 | struct clk_utmi *utmi = (struct clk_utmi *)dev_id; | ||
39 | |||
40 | wake_up(&utmi->wait); | ||
41 | disable_irq_nosync(utmi->irq); | ||
42 | |||
43 | return IRQ_HANDLED; | ||
44 | } | ||
45 | |||
46 | static int clk_utmi_prepare(struct clk_hw *hw) | ||
47 | { | ||
48 | struct clk_utmi *utmi = to_clk_utmi(hw); | ||
49 | struct at91_pmc *pmc = utmi->pmc; | ||
50 | u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN | | ||
51 | AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN; | ||
52 | |||
53 | pmc_write(pmc, AT91_CKGR_UCKR, tmp); | ||
54 | |||
55 | while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) { | ||
56 | enable_irq(utmi->irq); | ||
57 | wait_event(utmi->wait, | ||
58 | pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int clk_utmi_is_prepared(struct clk_hw *hw) | ||
65 | { | ||
66 | struct clk_utmi *utmi = to_clk_utmi(hw); | ||
67 | struct at91_pmc *pmc = utmi->pmc; | ||
68 | |||
69 | return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); | ||
70 | } | ||
71 | |||
72 | static void clk_utmi_unprepare(struct clk_hw *hw) | ||
73 | { | ||
74 | struct clk_utmi *utmi = to_clk_utmi(hw); | ||
75 | struct at91_pmc *pmc = utmi->pmc; | ||
76 | u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN; | ||
77 | |||
78 | pmc_write(pmc, AT91_CKGR_UCKR, tmp); | ||
79 | } | ||
80 | |||
81 | static unsigned long clk_utmi_recalc_rate(struct clk_hw *hw, | ||
82 | unsigned long parent_rate) | ||
83 | { | ||
84 | /* UTMI clk is a fixed clk multiplier */ | ||
85 | return parent_rate * UTMI_FIXED_MUL; | ||
86 | } | ||
87 | |||
88 | static const struct clk_ops utmi_ops = { | ||
89 | .prepare = clk_utmi_prepare, | ||
90 | .unprepare = clk_utmi_unprepare, | ||
91 | .is_prepared = clk_utmi_is_prepared, | ||
92 | .recalc_rate = clk_utmi_recalc_rate, | ||
93 | }; | ||
94 | |||
95 | static struct clk * __init | ||
96 | at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, | ||
97 | const char *name, const char *parent_name) | ||
98 | { | ||
99 | int ret; | ||
100 | struct clk_utmi *utmi; | ||
101 | struct clk *clk = NULL; | ||
102 | struct clk_init_data init; | ||
103 | |||
104 | utmi = kzalloc(sizeof(*utmi), GFP_KERNEL); | ||
105 | if (!utmi) | ||
106 | return ERR_PTR(-ENOMEM); | ||
107 | |||
108 | init.name = name; | ||
109 | init.ops = &utmi_ops; | ||
110 | init.parent_names = parent_name ? &parent_name : NULL; | ||
111 | init.num_parents = parent_name ? 1 : 0; | ||
112 | init.flags = CLK_SET_RATE_GATE; | ||
113 | |||
114 | utmi->hw.init = &init; | ||
115 | utmi->pmc = pmc; | ||
116 | utmi->irq = irq; | ||
117 | init_waitqueue_head(&utmi->wait); | ||
118 | irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN); | ||
119 | ret = request_irq(utmi->irq, clk_utmi_irq_handler, | ||
120 | IRQF_TRIGGER_HIGH, "clk-utmi", utmi); | ||
121 | if (ret) | ||
122 | return ERR_PTR(ret); | ||
123 | |||
124 | clk = clk_register(NULL, &utmi->hw); | ||
125 | if (IS_ERR(clk)) | ||
126 | kfree(utmi); | ||
127 | |||
128 | return clk; | ||
129 | } | ||
130 | |||
131 | static void __init | ||
132 | of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) | ||
133 | { | ||
134 | unsigned int irq; | ||
135 | struct clk *clk; | ||
136 | const char *parent_name; | ||
137 | const char *name = np->name; | ||
138 | |||
139 | parent_name = of_clk_get_parent_name(np, 0); | ||
140 | |||
141 | of_property_read_string(np, "clock-output-names", &name); | ||
142 | |||
143 | irq = irq_of_parse_and_map(np, 0); | ||
144 | if (!irq) | ||
145 | return; | ||
146 | |||
147 | clk = at91_clk_register_utmi(pmc, irq, name, parent_name); | ||
148 | if (IS_ERR(clk)) | ||
149 | return; | ||
150 | |||
151 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, | ||
156 | struct at91_pmc *pmc) | ||
157 | { | ||
158 | of_at91_clk_utmi_setup(np, pmc); | ||
159 | } | ||
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c new file mode 100644 index 000000000000..6a61477a57e0 --- /dev/null +++ b/drivers/clk/at91/pmc.c | |||
@@ -0,0 +1,395 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/clkdev.h> | ||
13 | #include <linux/clk/at91_pmc.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/irqchip/chained_irq.h> | ||
20 | #include <linux/irqdomain.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | |||
23 | #include <asm/proc-fns.h> | ||
24 | |||
25 | #include "pmc.h" | ||
26 | |||
27 | void __iomem *at91_pmc_base; | ||
28 | EXPORT_SYMBOL_GPL(at91_pmc_base); | ||
29 | |||
30 | void at91sam9_idle(void) | ||
31 | { | ||
32 | at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); | ||
33 | cpu_do_idle(); | ||
34 | } | ||
35 | |||
36 | int of_at91_get_clk_range(struct device_node *np, const char *propname, | ||
37 | struct clk_range *range) | ||
38 | { | ||
39 | u32 min, max; | ||
40 | int ret; | ||
41 | |||
42 | ret = of_property_read_u32_index(np, propname, 0, &min); | ||
43 | if (ret) | ||
44 | return ret; | ||
45 | |||
46 | ret = of_property_read_u32_index(np, propname, 1, &max); | ||
47 | if (ret) | ||
48 | return ret; | ||
49 | |||
50 | if (range) { | ||
51 | range->min = min; | ||
52 | range->max = max; | ||
53 | } | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(of_at91_get_clk_range); | ||
58 | |||
59 | static void pmc_irq_mask(struct irq_data *d) | ||
60 | { | ||
61 | struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); | ||
62 | |||
63 | pmc_write(pmc, AT91_PMC_IDR, 1 << d->hwirq); | ||
64 | } | ||
65 | |||
66 | static void pmc_irq_unmask(struct irq_data *d) | ||
67 | { | ||
68 | struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); | ||
69 | |||
70 | pmc_write(pmc, AT91_PMC_IER, 1 << d->hwirq); | ||
71 | } | ||
72 | |||
73 | static int pmc_irq_set_type(struct irq_data *d, unsigned type) | ||
74 | { | ||
75 | if (type != IRQ_TYPE_LEVEL_HIGH) { | ||
76 | pr_warn("PMC: type not supported (support only IRQ_TYPE_LEVEL_HIGH type)\n"); | ||
77 | return -EINVAL; | ||
78 | } | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static struct irq_chip pmc_irq = { | ||
84 | .name = "PMC", | ||
85 | .irq_disable = pmc_irq_mask, | ||
86 | .irq_mask = pmc_irq_mask, | ||
87 | .irq_unmask = pmc_irq_unmask, | ||
88 | .irq_set_type = pmc_irq_set_type, | ||
89 | }; | ||
90 | |||
91 | static struct lock_class_key pmc_lock_class; | ||
92 | |||
93 | static int pmc_irq_map(struct irq_domain *h, unsigned int virq, | ||
94 | irq_hw_number_t hw) | ||
95 | { | ||
96 | struct at91_pmc *pmc = h->host_data; | ||
97 | |||
98 | irq_set_lockdep_class(virq, &pmc_lock_class); | ||
99 | |||
100 | irq_set_chip_and_handler(virq, &pmc_irq, | ||
101 | handle_level_irq); | ||
102 | set_irq_flags(virq, IRQF_VALID); | ||
103 | irq_set_chip_data(virq, pmc); | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static int pmc_irq_domain_xlate(struct irq_domain *d, | ||
109 | struct device_node *ctrlr, | ||
110 | const u32 *intspec, unsigned int intsize, | ||
111 | irq_hw_number_t *out_hwirq, | ||
112 | unsigned int *out_type) | ||
113 | { | ||
114 | struct at91_pmc *pmc = d->host_data; | ||
115 | const struct at91_pmc_caps *caps = pmc->caps; | ||
116 | |||
117 | if (WARN_ON(intsize < 1)) | ||
118 | return -EINVAL; | ||
119 | |||
120 | *out_hwirq = intspec[0]; | ||
121 | |||
122 | if (!(caps->available_irqs & (1 << *out_hwirq))) | ||
123 | return -EINVAL; | ||
124 | |||
125 | *out_type = IRQ_TYPE_LEVEL_HIGH; | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static struct irq_domain_ops pmc_irq_ops = { | ||
131 | .map = pmc_irq_map, | ||
132 | .xlate = pmc_irq_domain_xlate, | ||
133 | }; | ||
134 | |||
135 | static irqreturn_t pmc_irq_handler(int irq, void *data) | ||
136 | { | ||
137 | struct at91_pmc *pmc = (struct at91_pmc *)data; | ||
138 | unsigned long sr; | ||
139 | int n; | ||
140 | |||
141 | sr = pmc_read(pmc, AT91_PMC_SR) & pmc_read(pmc, AT91_PMC_IMR); | ||
142 | if (!sr) | ||
143 | return IRQ_NONE; | ||
144 | |||
145 | for_each_set_bit(n, &sr, BITS_PER_LONG) | ||
146 | generic_handle_irq(irq_find_mapping(pmc->irqdomain, n)); | ||
147 | |||
148 | return IRQ_HANDLED; | ||
149 | } | ||
150 | |||
151 | static const struct at91_pmc_caps at91rm9200_caps = { | ||
152 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | | ||
153 | AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | | ||
154 | AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | | ||
155 | AT91_PMC_PCK3RDY, | ||
156 | }; | ||
157 | |||
158 | static const struct at91_pmc_caps at91sam9260_caps = { | ||
159 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | | ||
160 | AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | | ||
161 | AT91_PMC_PCK1RDY, | ||
162 | }; | ||
163 | |||
164 | static const struct at91_pmc_caps at91sam9g45_caps = { | ||
165 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | | ||
166 | AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | | ||
167 | AT91_PMC_PCK1RDY, | ||
168 | }; | ||
169 | |||
170 | static const struct at91_pmc_caps at91sam9n12_caps = { | ||
171 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | | ||
172 | AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | | ||
173 | AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | | ||
174 | AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, | ||
175 | }; | ||
176 | |||
177 | static const struct at91_pmc_caps at91sam9x5_caps = { | ||
178 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | | ||
179 | AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | | ||
180 | AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | | ||
181 | AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, | ||
182 | }; | ||
183 | |||
184 | static const struct at91_pmc_caps sama5d3_caps = { | ||
185 | .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | | ||
186 | AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | | ||
187 | AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | | ||
188 | AT91_PMC_MOSCSELS | AT91_PMC_MOSCRCS | | ||
189 | AT91_PMC_CFDEV, | ||
190 | }; | ||
191 | |||
192 | static struct at91_pmc *__init at91_pmc_init(struct device_node *np, | ||
193 | void __iomem *regbase, int virq, | ||
194 | const struct at91_pmc_caps *caps) | ||
195 | { | ||
196 | struct at91_pmc *pmc; | ||
197 | |||
198 | if (!regbase || !virq || !caps) | ||
199 | return NULL; | ||
200 | |||
201 | at91_pmc_base = regbase; | ||
202 | |||
203 | pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); | ||
204 | if (!pmc) | ||
205 | return NULL; | ||
206 | |||
207 | spin_lock_init(&pmc->lock); | ||
208 | pmc->regbase = regbase; | ||
209 | pmc->virq = virq; | ||
210 | pmc->caps = caps; | ||
211 | |||
212 | pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc); | ||
213 | |||
214 | if (!pmc->irqdomain) | ||
215 | goto out_free_pmc; | ||
216 | |||
217 | pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); | ||
218 | if (request_irq(pmc->virq, pmc_irq_handler, IRQF_SHARED, "pmc", pmc)) | ||
219 | goto out_remove_irqdomain; | ||
220 | |||
221 | return pmc; | ||
222 | |||
223 | out_remove_irqdomain: | ||
224 | irq_domain_remove(pmc->irqdomain); | ||
225 | out_free_pmc: | ||
226 | kfree(pmc); | ||
227 | |||
228 | return NULL; | ||
229 | } | ||
230 | |||
231 | static const struct of_device_id pmc_clk_ids[] __initconst = { | ||
232 | /* Main clock */ | ||
233 | { | ||
234 | .compatible = "atmel,at91rm9200-clk-main", | ||
235 | .data = of_at91rm9200_clk_main_setup, | ||
236 | }, | ||
237 | /* PLL clocks */ | ||
238 | { | ||
239 | .compatible = "atmel,at91rm9200-clk-pll", | ||
240 | .data = of_at91rm9200_clk_pll_setup, | ||
241 | }, | ||
242 | { | ||
243 | .compatible = "atmel,at91sam9g45-clk-pll", | ||
244 | .data = of_at91sam9g45_clk_pll_setup, | ||
245 | }, | ||
246 | { | ||
247 | .compatible = "atmel,at91sam9g20-clk-pllb", | ||
248 | .data = of_at91sam9g20_clk_pllb_setup, | ||
249 | }, | ||
250 | { | ||
251 | .compatible = "atmel,sama5d3-clk-pll", | ||
252 | .data = of_sama5d3_clk_pll_setup, | ||
253 | }, | ||
254 | { | ||
255 | .compatible = "atmel,at91sam9x5-clk-plldiv", | ||
256 | .data = of_at91sam9x5_clk_plldiv_setup, | ||
257 | }, | ||
258 | /* Master clock */ | ||
259 | { | ||
260 | .compatible = "atmel,at91rm9200-clk-master", | ||
261 | .data = of_at91rm9200_clk_master_setup, | ||
262 | }, | ||
263 | { | ||
264 | .compatible = "atmel,at91sam9x5-clk-master", | ||
265 | .data = of_at91sam9x5_clk_master_setup, | ||
266 | }, | ||
267 | /* System clocks */ | ||
268 | { | ||
269 | .compatible = "atmel,at91rm9200-clk-system", | ||
270 | .data = of_at91rm9200_clk_sys_setup, | ||
271 | }, | ||
272 | /* Peripheral clocks */ | ||
273 | { | ||
274 | .compatible = "atmel,at91rm9200-clk-peripheral", | ||
275 | .data = of_at91rm9200_clk_periph_setup, | ||
276 | }, | ||
277 | { | ||
278 | .compatible = "atmel,at91sam9x5-clk-peripheral", | ||
279 | .data = of_at91sam9x5_clk_periph_setup, | ||
280 | }, | ||
281 | /* Programmable clocks */ | ||
282 | { | ||
283 | .compatible = "atmel,at91rm9200-clk-programmable", | ||
284 | .data = of_at91rm9200_clk_prog_setup, | ||
285 | }, | ||
286 | { | ||
287 | .compatible = "atmel,at91sam9g45-clk-programmable", | ||
288 | .data = of_at91sam9g45_clk_prog_setup, | ||
289 | }, | ||
290 | { | ||
291 | .compatible = "atmel,at91sam9x5-clk-programmable", | ||
292 | .data = of_at91sam9x5_clk_prog_setup, | ||
293 | }, | ||
294 | /* UTMI clock */ | ||
295 | #if defined(CONFIG_HAVE_AT91_UTMI) | ||
296 | { | ||
297 | .compatible = "atmel,at91sam9x5-clk-utmi", | ||
298 | .data = of_at91sam9x5_clk_utmi_setup, | ||
299 | }, | ||
300 | #endif | ||
301 | /* USB clock */ | ||
302 | #if defined(CONFIG_HAVE_AT91_USB_CLK) | ||
303 | { | ||
304 | .compatible = "atmel,at91rm9200-clk-usb", | ||
305 | .data = of_at91rm9200_clk_usb_setup, | ||
306 | }, | ||
307 | { | ||
308 | .compatible = "atmel,at91sam9x5-clk-usb", | ||
309 | .data = of_at91sam9x5_clk_usb_setup, | ||
310 | }, | ||
311 | { | ||
312 | .compatible = "atmel,at91sam9n12-clk-usb", | ||
313 | .data = of_at91sam9n12_clk_usb_setup, | ||
314 | }, | ||
315 | #endif | ||
316 | /* SMD clock */ | ||
317 | #if defined(CONFIG_HAVE_AT91_SMD) | ||
318 | { | ||
319 | .compatible = "atmel,at91sam9x5-clk-smd", | ||
320 | .data = of_at91sam9x5_clk_smd_setup, | ||
321 | }, | ||
322 | #endif | ||
323 | { /*sentinel*/ } | ||
324 | }; | ||
325 | |||
326 | static void __init of_at91_pmc_setup(struct device_node *np, | ||
327 | const struct at91_pmc_caps *caps) | ||
328 | { | ||
329 | struct at91_pmc *pmc; | ||
330 | struct device_node *childnp; | ||
331 | void (*clk_setup)(struct device_node *, struct at91_pmc *); | ||
332 | const struct of_device_id *clk_id; | ||
333 | void __iomem *regbase = of_iomap(np, 0); | ||
334 | int virq; | ||
335 | |||
336 | if (!regbase) | ||
337 | return; | ||
338 | |||
339 | virq = irq_of_parse_and_map(np, 0); | ||
340 | if (!virq) | ||
341 | return; | ||
342 | |||
343 | pmc = at91_pmc_init(np, regbase, virq, caps); | ||
344 | if (!pmc) | ||
345 | return; | ||
346 | for_each_child_of_node(np, childnp) { | ||
347 | clk_id = of_match_node(pmc_clk_ids, childnp); | ||
348 | if (!clk_id) | ||
349 | continue; | ||
350 | clk_setup = clk_id->data; | ||
351 | clk_setup(childnp, pmc); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | static void __init of_at91rm9200_pmc_setup(struct device_node *np) | ||
356 | { | ||
357 | of_at91_pmc_setup(np, &at91rm9200_caps); | ||
358 | } | ||
359 | CLK_OF_DECLARE(at91rm9200_clk_pmc, "atmel,at91rm9200-pmc", | ||
360 | of_at91rm9200_pmc_setup); | ||
361 | |||
362 | static void __init of_at91sam9260_pmc_setup(struct device_node *np) | ||
363 | { | ||
364 | of_at91_pmc_setup(np, &at91sam9260_caps); | ||
365 | } | ||
366 | CLK_OF_DECLARE(at91sam9260_clk_pmc, "atmel,at91sam9260-pmc", | ||
367 | of_at91sam9260_pmc_setup); | ||
368 | |||
369 | static void __init of_at91sam9g45_pmc_setup(struct device_node *np) | ||
370 | { | ||
371 | of_at91_pmc_setup(np, &at91sam9g45_caps); | ||
372 | } | ||
373 | CLK_OF_DECLARE(at91sam9g45_clk_pmc, "atmel,at91sam9g45-pmc", | ||
374 | of_at91sam9g45_pmc_setup); | ||
375 | |||
376 | static void __init of_at91sam9n12_pmc_setup(struct device_node *np) | ||
377 | { | ||
378 | of_at91_pmc_setup(np, &at91sam9n12_caps); | ||
379 | } | ||
380 | CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc", | ||
381 | of_at91sam9n12_pmc_setup); | ||
382 | |||
383 | static void __init of_at91sam9x5_pmc_setup(struct device_node *np) | ||
384 | { | ||
385 | of_at91_pmc_setup(np, &at91sam9x5_caps); | ||
386 | } | ||
387 | CLK_OF_DECLARE(at91sam9x5_clk_pmc, "atmel,at91sam9x5-pmc", | ||
388 | of_at91sam9x5_pmc_setup); | ||
389 | |||
390 | static void __init of_sama5d3_pmc_setup(struct device_node *np) | ||
391 | { | ||
392 | of_at91_pmc_setup(np, &sama5d3_caps); | ||
393 | } | ||
394 | CLK_OF_DECLARE(sama5d3_clk_pmc, "atmel,sama5d3-pmc", | ||
395 | of_sama5d3_pmc_setup); | ||
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h new file mode 100644 index 000000000000..441350983ccb --- /dev/null +++ b/drivers/clk/at91/pmc.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * drivers/clk/at91/pmc.h | ||
3 | * | ||
4 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __PMC_H_ | ||
13 | #define __PMC_H_ | ||
14 | |||
15 | #include <linux/io.h> | ||
16 | #include <linux/irqdomain.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | |||
19 | struct clk_range { | ||
20 | unsigned long min; | ||
21 | unsigned long max; | ||
22 | }; | ||
23 | |||
24 | #define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,} | ||
25 | |||
26 | struct at91_pmc_caps { | ||
27 | u32 available_irqs; | ||
28 | }; | ||
29 | |||
30 | struct at91_pmc { | ||
31 | void __iomem *regbase; | ||
32 | int virq; | ||
33 | spinlock_t lock; | ||
34 | const struct at91_pmc_caps *caps; | ||
35 | struct irq_domain *irqdomain; | ||
36 | }; | ||
37 | |||
38 | static inline void pmc_lock(struct at91_pmc *pmc) | ||
39 | { | ||
40 | spin_lock(&pmc->lock); | ||
41 | } | ||
42 | |||
43 | static inline void pmc_unlock(struct at91_pmc *pmc) | ||
44 | { | ||
45 | spin_unlock(&pmc->lock); | ||
46 | } | ||
47 | |||
48 | static inline u32 pmc_read(struct at91_pmc *pmc, int offset) | ||
49 | { | ||
50 | return readl(pmc->regbase + offset); | ||
51 | } | ||
52 | |||
53 | static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value) | ||
54 | { | ||
55 | writel(value, pmc->regbase + offset); | ||
56 | } | ||
57 | |||
58 | int of_at91_get_clk_range(struct device_node *np, const char *propname, | ||
59 | struct clk_range *range); | ||
60 | |||
61 | extern void __init of_at91rm9200_clk_main_setup(struct device_node *np, | ||
62 | struct at91_pmc *pmc); | ||
63 | |||
64 | extern void __init of_at91rm9200_clk_pll_setup(struct device_node *np, | ||
65 | struct at91_pmc *pmc); | ||
66 | extern void __init of_at91sam9g45_clk_pll_setup(struct device_node *np, | ||
67 | struct at91_pmc *pmc); | ||
68 | extern void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np, | ||
69 | struct at91_pmc *pmc); | ||
70 | extern void __init of_sama5d3_clk_pll_setup(struct device_node *np, | ||
71 | struct at91_pmc *pmc); | ||
72 | extern void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, | ||
73 | struct at91_pmc *pmc); | ||
74 | |||
75 | extern void __init of_at91rm9200_clk_master_setup(struct device_node *np, | ||
76 | struct at91_pmc *pmc); | ||
77 | extern void __init of_at91sam9x5_clk_master_setup(struct device_node *np, | ||
78 | struct at91_pmc *pmc); | ||
79 | |||
80 | extern void __init of_at91rm9200_clk_sys_setup(struct device_node *np, | ||
81 | struct at91_pmc *pmc); | ||
82 | |||
83 | extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np, | ||
84 | struct at91_pmc *pmc); | ||
85 | extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np, | ||
86 | struct at91_pmc *pmc); | ||
87 | |||
88 | extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np, | ||
89 | struct at91_pmc *pmc); | ||
90 | extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np, | ||
91 | struct at91_pmc *pmc); | ||
92 | extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np, | ||
93 | struct at91_pmc *pmc); | ||
94 | |||
95 | #if defined(CONFIG_HAVE_AT91_UTMI) | ||
96 | extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, | ||
97 | struct at91_pmc *pmc); | ||
98 | #endif | ||
99 | |||
100 | #if defined(CONFIG_HAVE_AT91_USB_CLK) | ||
101 | extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np, | ||
102 | struct at91_pmc *pmc); | ||
103 | extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, | ||
104 | struct at91_pmc *pmc); | ||
105 | extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, | ||
106 | struct at91_pmc *pmc); | ||
107 | #endif | ||
108 | |||
109 | #if defined(CONFIG_HAVE_AT91_SMD) | ||
110 | extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, | ||
111 | struct at91_pmc *pmc); | ||
112 | #endif | ||
113 | |||
114 | #endif /* __PMC_H_ */ | ||
diff --git a/drivers/clk/tegra/Makefile b/drivers/clk/tegra/Makefile index f49fac2d193a..f7dfb72884a4 100644 --- a/drivers/clk/tegra/Makefile +++ b/drivers/clk/tegra/Makefile | |||
@@ -6,7 +6,12 @@ obj-y += clk-periph-gate.o | |||
6 | obj-y += clk-pll.o | 6 | obj-y += clk-pll.o |
7 | obj-y += clk-pll-out.o | 7 | obj-y += clk-pll-out.o |
8 | obj-y += clk-super.o | 8 | obj-y += clk-super.o |
9 | 9 | obj-y += clk-tegra-audio.o | |
10 | obj-y += clk-tegra-periph.o | ||
11 | obj-y += clk-tegra-pmc.o | ||
12 | obj-y += clk-tegra-fixed.o | ||
13 | obj-y += clk-tegra-super-gen4.o | ||
10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o | 14 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o |
11 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o | 15 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o |
12 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o | 16 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o |
17 | obj-$(CONFIG_ARCH_TEGRA_124_SOC) += clk-tegra124.o | ||
diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h new file mode 100644 index 000000000000..cf0c323f2c36 --- /dev/null +++ b/drivers/clk/tegra/clk-id.h | |||
@@ -0,0 +1,235 @@ | |||
1 | /* | ||
2 | * This header provides IDs for clocks common between several Tegra SoCs | ||
3 | */ | ||
4 | #ifndef _TEGRA_CLK_ID_H | ||
5 | #define _TEGRA_CLK_ID_H | ||
6 | |||
7 | enum clk_id { | ||
8 | tegra_clk_actmon, | ||
9 | tegra_clk_adx, | ||
10 | tegra_clk_adx1, | ||
11 | tegra_clk_afi, | ||
12 | tegra_clk_amx, | ||
13 | tegra_clk_amx1, | ||
14 | tegra_clk_apbdma, | ||
15 | tegra_clk_apbif, | ||
16 | tegra_clk_audio0, | ||
17 | tegra_clk_audio0_2x, | ||
18 | tegra_clk_audio0_mux, | ||
19 | tegra_clk_audio1, | ||
20 | tegra_clk_audio1_2x, | ||
21 | tegra_clk_audio1_mux, | ||
22 | tegra_clk_audio2, | ||
23 | tegra_clk_audio2_2x, | ||
24 | tegra_clk_audio2_mux, | ||
25 | tegra_clk_audio3, | ||
26 | tegra_clk_audio3_2x, | ||
27 | tegra_clk_audio3_mux, | ||
28 | tegra_clk_audio4, | ||
29 | tegra_clk_audio4_2x, | ||
30 | tegra_clk_audio4_mux, | ||
31 | tegra_clk_blink, | ||
32 | tegra_clk_bsea, | ||
33 | tegra_clk_bsev, | ||
34 | tegra_clk_cclk_g, | ||
35 | tegra_clk_cclk_lp, | ||
36 | tegra_clk_cilab, | ||
37 | tegra_clk_cilcd, | ||
38 | tegra_clk_cile, | ||
39 | tegra_clk_clk_32k, | ||
40 | tegra_clk_clk72Mhz, | ||
41 | tegra_clk_clk_m, | ||
42 | tegra_clk_clk_m_div2, | ||
43 | tegra_clk_clk_m_div4, | ||
44 | tegra_clk_clk_out_1, | ||
45 | tegra_clk_clk_out_1_mux, | ||
46 | tegra_clk_clk_out_2, | ||
47 | tegra_clk_clk_out_2_mux, | ||
48 | tegra_clk_clk_out_3, | ||
49 | tegra_clk_clk_out_3_mux, | ||
50 | tegra_clk_cml0, | ||
51 | tegra_clk_cml1, | ||
52 | tegra_clk_csi, | ||
53 | tegra_clk_csite, | ||
54 | tegra_clk_csus, | ||
55 | tegra_clk_cve, | ||
56 | tegra_clk_dam0, | ||
57 | tegra_clk_dam1, | ||
58 | tegra_clk_dam2, | ||
59 | tegra_clk_d_audio, | ||
60 | tegra_clk_dds, | ||
61 | tegra_clk_dfll_ref, | ||
62 | tegra_clk_dfll_soc, | ||
63 | tegra_clk_disp1, | ||
64 | tegra_clk_disp2, | ||
65 | tegra_clk_dp2, | ||
66 | tegra_clk_dpaux, | ||
67 | tegra_clk_dsia, | ||
68 | tegra_clk_dsialp, | ||
69 | tegra_clk_dsia_mux, | ||
70 | tegra_clk_dsib, | ||
71 | tegra_clk_dsiblp, | ||
72 | tegra_clk_dsib_mux, | ||
73 | tegra_clk_dtv, | ||
74 | tegra_clk_emc, | ||
75 | tegra_clk_entropy, | ||
76 | tegra_clk_epp, | ||
77 | tegra_clk_epp_8, | ||
78 | tegra_clk_extern1, | ||
79 | tegra_clk_extern2, | ||
80 | tegra_clk_extern3, | ||
81 | tegra_clk_fuse, | ||
82 | tegra_clk_fuse_burn, | ||
83 | tegra_clk_gpu, | ||
84 | tegra_clk_gr2d, | ||
85 | tegra_clk_gr2d_8, | ||
86 | tegra_clk_gr3d, | ||
87 | tegra_clk_gr3d_8, | ||
88 | tegra_clk_hclk, | ||
89 | tegra_clk_hda, | ||
90 | tegra_clk_hda2codec_2x, | ||
91 | tegra_clk_hda2hdmi, | ||
92 | tegra_clk_hdmi, | ||
93 | tegra_clk_hdmi_audio, | ||
94 | tegra_clk_host1x, | ||
95 | tegra_clk_host1x_8, | ||
96 | tegra_clk_i2c1, | ||
97 | tegra_clk_i2c2, | ||
98 | tegra_clk_i2c3, | ||
99 | tegra_clk_i2c4, | ||
100 | tegra_clk_i2c5, | ||
101 | tegra_clk_i2c6, | ||
102 | tegra_clk_i2cslow, | ||
103 | tegra_clk_i2s0, | ||
104 | tegra_clk_i2s0_sync, | ||
105 | tegra_clk_i2s1, | ||
106 | tegra_clk_i2s1_sync, | ||
107 | tegra_clk_i2s2, | ||
108 | tegra_clk_i2s2_sync, | ||
109 | tegra_clk_i2s3, | ||
110 | tegra_clk_i2s3_sync, | ||
111 | tegra_clk_i2s4, | ||
112 | tegra_clk_i2s4_sync, | ||
113 | tegra_clk_isp, | ||
114 | tegra_clk_isp_8, | ||
115 | tegra_clk_ispb, | ||
116 | tegra_clk_kbc, | ||
117 | tegra_clk_kfuse, | ||
118 | tegra_clk_la, | ||
119 | tegra_clk_mipi, | ||
120 | tegra_clk_mipi_cal, | ||
121 | tegra_clk_mpe, | ||
122 | tegra_clk_mselect, | ||
123 | tegra_clk_msenc, | ||
124 | tegra_clk_ndflash, | ||
125 | tegra_clk_ndflash_8, | ||
126 | tegra_clk_ndspeed, | ||
127 | tegra_clk_ndspeed_8, | ||
128 | tegra_clk_nor, | ||
129 | tegra_clk_owr, | ||
130 | tegra_clk_pcie, | ||
131 | tegra_clk_pclk, | ||
132 | tegra_clk_pll_a, | ||
133 | tegra_clk_pll_a_out0, | ||
134 | tegra_clk_pll_c, | ||
135 | tegra_clk_pll_c2, | ||
136 | tegra_clk_pll_c3, | ||
137 | tegra_clk_pll_c4, | ||
138 | tegra_clk_pll_c_out1, | ||
139 | tegra_clk_pll_d, | ||
140 | tegra_clk_pll_d2, | ||
141 | tegra_clk_pll_d2_out0, | ||
142 | tegra_clk_pll_d_out0, | ||
143 | tegra_clk_pll_dp, | ||
144 | tegra_clk_pll_e_out0, | ||
145 | tegra_clk_pll_m, | ||
146 | tegra_clk_pll_m_out1, | ||
147 | tegra_clk_pll_p, | ||
148 | tegra_clk_pll_p_out1, | ||
149 | tegra_clk_pll_p_out2, | ||
150 | tegra_clk_pll_p_out2_int, | ||
151 | tegra_clk_pll_p_out3, | ||
152 | tegra_clk_pll_p_out4, | ||
153 | tegra_clk_pll_p_out5, | ||
154 | tegra_clk_pll_ref, | ||
155 | tegra_clk_pll_re_out, | ||
156 | tegra_clk_pll_re_vco, | ||
157 | tegra_clk_pll_u, | ||
158 | tegra_clk_pll_u_12m, | ||
159 | tegra_clk_pll_u_480m, | ||
160 | tegra_clk_pll_u_48m, | ||
161 | tegra_clk_pll_u_60m, | ||
162 | tegra_clk_pll_x, | ||
163 | tegra_clk_pll_x_out0, | ||
164 | tegra_clk_pwm, | ||
165 | tegra_clk_rtc, | ||
166 | tegra_clk_sata, | ||
167 | tegra_clk_sata_cold, | ||
168 | tegra_clk_sata_oob, | ||
169 | tegra_clk_sbc1, | ||
170 | tegra_clk_sbc1_8, | ||
171 | tegra_clk_sbc2, | ||
172 | tegra_clk_sbc2_8, | ||
173 | tegra_clk_sbc3, | ||
174 | tegra_clk_sbc3_8, | ||
175 | tegra_clk_sbc4, | ||
176 | tegra_clk_sbc4_8, | ||
177 | tegra_clk_sbc5, | ||
178 | tegra_clk_sbc5_8, | ||
179 | tegra_clk_sbc6, | ||
180 | tegra_clk_sbc6_8, | ||
181 | tegra_clk_sclk, | ||
182 | tegra_clk_sdmmc1, | ||
183 | tegra_clk_sdmmc2, | ||
184 | tegra_clk_sdmmc3, | ||
185 | tegra_clk_sdmmc4, | ||
186 | tegra_clk_se, | ||
187 | tegra_clk_soc_therm, | ||
188 | tegra_clk_sor0, | ||
189 | tegra_clk_sor0_lvds, | ||
190 | tegra_clk_spdif, | ||
191 | tegra_clk_spdif_2x, | ||
192 | tegra_clk_spdif_in, | ||
193 | tegra_clk_spdif_in_sync, | ||
194 | tegra_clk_spdif_mux, | ||
195 | tegra_clk_spdif_out, | ||
196 | tegra_clk_timer, | ||
197 | tegra_clk_trace, | ||
198 | tegra_clk_tsec, | ||
199 | tegra_clk_tsensor, | ||
200 | tegra_clk_tvdac, | ||
201 | tegra_clk_tvo, | ||
202 | tegra_clk_uarta, | ||
203 | tegra_clk_uartb, | ||
204 | tegra_clk_uartc, | ||
205 | tegra_clk_uartd, | ||
206 | tegra_clk_uarte, | ||
207 | tegra_clk_usb2, | ||
208 | tegra_clk_usb3, | ||
209 | tegra_clk_usbd, | ||
210 | tegra_clk_vcp, | ||
211 | tegra_clk_vde, | ||
212 | tegra_clk_vde_8, | ||
213 | tegra_clk_vfir, | ||
214 | tegra_clk_vi, | ||
215 | tegra_clk_vi_8, | ||
216 | tegra_clk_vi_9, | ||
217 | tegra_clk_vic03, | ||
218 | tegra_clk_vim2_clk, | ||
219 | tegra_clk_vimclk_sync, | ||
220 | tegra_clk_vi_sensor, | ||
221 | tegra_clk_vi_sensor2, | ||
222 | tegra_clk_vi_sensor_8, | ||
223 | tegra_clk_xusb_dev, | ||
224 | tegra_clk_xusb_dev_src, | ||
225 | tegra_clk_xusb_falcon_src, | ||
226 | tegra_clk_xusb_fs_src, | ||
227 | tegra_clk_xusb_host, | ||
228 | tegra_clk_xusb_host_src, | ||
229 | tegra_clk_xusb_hs_src, | ||
230 | tegra_clk_xusb_ss, | ||
231 | tegra_clk_xusb_ss_src, | ||
232 | tegra_clk_max, | ||
233 | }; | ||
234 | |||
235 | #endif /* _TEGRA_CLK_ID_H */ | ||
diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c index bafee9895a24..507015314827 100644 --- a/drivers/clk/tegra/clk-periph-gate.c +++ b/drivers/clk/tegra/clk-periph-gate.c | |||
@@ -36,8 +36,6 @@ static DEFINE_SPINLOCK(periph_ref_lock); | |||
36 | 36 | ||
37 | #define read_rst(gate) \ | 37 | #define read_rst(gate) \ |
38 | readl_relaxed(gate->clk_base + (gate->regs->rst_reg)) | 38 | readl_relaxed(gate->clk_base + (gate->regs->rst_reg)) |
39 | #define write_rst_set(val, gate) \ | ||
40 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_set_reg)) | ||
41 | #define write_rst_clr(val, gate) \ | 39 | #define write_rst_clr(val, gate) \ |
42 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) | 40 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) |
43 | 41 | ||
@@ -123,26 +121,6 @@ static void clk_periph_disable(struct clk_hw *hw) | |||
123 | spin_unlock_irqrestore(&periph_ref_lock, flags); | 121 | spin_unlock_irqrestore(&periph_ref_lock, flags); |
124 | } | 122 | } |
125 | 123 | ||
126 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert) | ||
127 | { | ||
128 | if (gate->flags & TEGRA_PERIPH_NO_RESET) | ||
129 | return; | ||
130 | |||
131 | if (assert) { | ||
132 | /* | ||
133 | * If peripheral is in the APB bus then read the APB bus to | ||
134 | * flush the write operation in apb bus. This will avoid the | ||
135 | * peripheral access after disabling clock | ||
136 | */ | ||
137 | if (gate->flags & TEGRA_PERIPH_ON_APB) | ||
138 | tegra_read_chipid(); | ||
139 | |||
140 | write_rst_set(periph_clk_to_bit(gate), gate); | ||
141 | } else { | ||
142 | write_rst_clr(periph_clk_to_bit(gate), gate); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | const struct clk_ops tegra_clk_periph_gate_ops = { | 124 | const struct clk_ops tegra_clk_periph_gate_ops = { |
147 | .is_enabled = clk_periph_is_enabled, | 125 | .is_enabled = clk_periph_is_enabled, |
148 | .enable = clk_periph_enable, | 126 | .enable = clk_periph_enable, |
@@ -151,12 +129,16 @@ const struct clk_ops tegra_clk_periph_gate_ops = { | |||
151 | 129 | ||
152 | struct clk *tegra_clk_register_periph_gate(const char *name, | 130 | struct clk *tegra_clk_register_periph_gate(const char *name, |
153 | const char *parent_name, u8 gate_flags, void __iomem *clk_base, | 131 | const char *parent_name, u8 gate_flags, void __iomem *clk_base, |
154 | unsigned long flags, int clk_num, | 132 | unsigned long flags, int clk_num, int *enable_refcnt) |
155 | struct tegra_clk_periph_regs *pregs, int *enable_refcnt) | ||
156 | { | 133 | { |
157 | struct tegra_clk_periph_gate *gate; | 134 | struct tegra_clk_periph_gate *gate; |
158 | struct clk *clk; | 135 | struct clk *clk; |
159 | struct clk_init_data init; | 136 | struct clk_init_data init; |
137 | struct tegra_clk_periph_regs *pregs; | ||
138 | |||
139 | pregs = get_reg_bank(clk_num); | ||
140 | if (!pregs) | ||
141 | return ERR_PTR(-EINVAL); | ||
160 | 142 | ||
161 | gate = kzalloc(sizeof(*gate), GFP_KERNEL); | 143 | gate = kzalloc(sizeof(*gate), GFP_KERNEL); |
162 | if (!gate) { | 144 | if (!gate) { |
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index b2309d37a963..c534043c0481 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c | |||
@@ -111,46 +111,6 @@ static void clk_periph_disable(struct clk_hw *hw) | |||
111 | gate_ops->disable(gate_hw); | 111 | gate_ops->disable(gate_hw); |
112 | } | 112 | } |
113 | 113 | ||
114 | void tegra_periph_reset_deassert(struct clk *c) | ||
115 | { | ||
116 | struct clk_hw *hw = __clk_get_hw(c); | ||
117 | struct tegra_clk_periph *periph = to_clk_periph(hw); | ||
118 | struct tegra_clk_periph_gate *gate; | ||
119 | |||
120 | if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) { | ||
121 | gate = to_clk_periph_gate(hw); | ||
122 | if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) { | ||
123 | WARN_ON(1); | ||
124 | return; | ||
125 | } | ||
126 | } else { | ||
127 | gate = &periph->gate; | ||
128 | } | ||
129 | |||
130 | tegra_periph_reset(gate, 0); | ||
131 | } | ||
132 | EXPORT_SYMBOL(tegra_periph_reset_deassert); | ||
133 | |||
134 | void tegra_periph_reset_assert(struct clk *c) | ||
135 | { | ||
136 | struct clk_hw *hw = __clk_get_hw(c); | ||
137 | struct tegra_clk_periph *periph = to_clk_periph(hw); | ||
138 | struct tegra_clk_periph_gate *gate; | ||
139 | |||
140 | if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) { | ||
141 | gate = to_clk_periph_gate(hw); | ||
142 | if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) { | ||
143 | WARN_ON(1); | ||
144 | return; | ||
145 | } | ||
146 | } else { | ||
147 | gate = &periph->gate; | ||
148 | } | ||
149 | |||
150 | tegra_periph_reset(gate, 1); | ||
151 | } | ||
152 | EXPORT_SYMBOL(tegra_periph_reset_assert); | ||
153 | |||
154 | const struct clk_ops tegra_clk_periph_ops = { | 114 | const struct clk_ops tegra_clk_periph_ops = { |
155 | .get_parent = clk_periph_get_parent, | 115 | .get_parent = clk_periph_get_parent, |
156 | .set_parent = clk_periph_set_parent, | 116 | .set_parent = clk_periph_set_parent, |
@@ -170,27 +130,50 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = { | |||
170 | .disable = clk_periph_disable, | 130 | .disable = clk_periph_disable, |
171 | }; | 131 | }; |
172 | 132 | ||
133 | const struct clk_ops tegra_clk_periph_no_gate_ops = { | ||
134 | .get_parent = clk_periph_get_parent, | ||
135 | .set_parent = clk_periph_set_parent, | ||
136 | .recalc_rate = clk_periph_recalc_rate, | ||
137 | .round_rate = clk_periph_round_rate, | ||
138 | .set_rate = clk_periph_set_rate, | ||
139 | }; | ||
140 | |||
173 | static struct clk *_tegra_clk_register_periph(const char *name, | 141 | static struct clk *_tegra_clk_register_periph(const char *name, |
174 | const char **parent_names, int num_parents, | 142 | const char **parent_names, int num_parents, |
175 | struct tegra_clk_periph *periph, | 143 | struct tegra_clk_periph *periph, |
176 | void __iomem *clk_base, u32 offset, bool div, | 144 | void __iomem *clk_base, u32 offset, |
177 | unsigned long flags) | 145 | unsigned long flags) |
178 | { | 146 | { |
179 | struct clk *clk; | 147 | struct clk *clk; |
180 | struct clk_init_data init; | 148 | struct clk_init_data init; |
149 | struct tegra_clk_periph_regs *bank; | ||
150 | bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV); | ||
151 | |||
152 | if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) { | ||
153 | flags |= CLK_SET_RATE_PARENT; | ||
154 | init.ops = &tegra_clk_periph_nodiv_ops; | ||
155 | } else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE) | ||
156 | init.ops = &tegra_clk_periph_no_gate_ops; | ||
157 | else | ||
158 | init.ops = &tegra_clk_periph_ops; | ||
181 | 159 | ||
182 | init.name = name; | 160 | init.name = name; |
183 | init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; | ||
184 | init.flags = flags; | 161 | init.flags = flags; |
185 | init.parent_names = parent_names; | 162 | init.parent_names = parent_names; |
186 | init.num_parents = num_parents; | 163 | init.num_parents = num_parents; |
187 | 164 | ||
165 | bank = get_reg_bank(periph->gate.clk_num); | ||
166 | if (!bank) | ||
167 | return ERR_PTR(-EINVAL); | ||
168 | |||
188 | /* Data in .init is copied by clk_register(), so stack variable OK */ | 169 | /* Data in .init is copied by clk_register(), so stack variable OK */ |
189 | periph->hw.init = &init; | 170 | periph->hw.init = &init; |
190 | periph->magic = TEGRA_CLK_PERIPH_MAGIC; | 171 | periph->magic = TEGRA_CLK_PERIPH_MAGIC; |
191 | periph->mux.reg = clk_base + offset; | 172 | periph->mux.reg = clk_base + offset; |
192 | periph->divider.reg = div ? (clk_base + offset) : NULL; | 173 | periph->divider.reg = div ? (clk_base + offset) : NULL; |
193 | periph->gate.clk_base = clk_base; | 174 | periph->gate.clk_base = clk_base; |
175 | periph->gate.regs = bank; | ||
176 | periph->gate.enable_refcnt = periph_clk_enb_refcnt; | ||
194 | 177 | ||
195 | clk = clk_register(NULL, &periph->hw); | 178 | clk = clk_register(NULL, &periph->hw); |
196 | if (IS_ERR(clk)) | 179 | if (IS_ERR(clk)) |
@@ -209,7 +192,7 @@ struct clk *tegra_clk_register_periph(const char *name, | |||
209 | u32 offset, unsigned long flags) | 192 | u32 offset, unsigned long flags) |
210 | { | 193 | { |
211 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 194 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
212 | periph, clk_base, offset, true, flags); | 195 | periph, clk_base, offset, flags); |
213 | } | 196 | } |
214 | 197 | ||
215 | struct clk *tegra_clk_register_periph_nodiv(const char *name, | 198 | struct clk *tegra_clk_register_periph_nodiv(const char *name, |
@@ -217,6 +200,7 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, | |||
217 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 200 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
218 | u32 offset) | 201 | u32 offset) |
219 | { | 202 | { |
203 | periph->gate.flags |= TEGRA_PERIPH_NO_DIV; | ||
220 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 204 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
221 | periph, clk_base, offset, false, CLK_SET_RATE_PARENT); | 205 | periph, clk_base, offset, CLK_SET_RATE_PARENT); |
222 | } | 206 | } |
diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index 197074a57754..2dd432266ef6 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c | |||
@@ -77,7 +77,23 @@ | |||
77 | #define PLLE_MISC_SETUP_VALUE (7 << PLLE_MISC_SETUP_BASE_SHIFT) | 77 | #define PLLE_MISC_SETUP_VALUE (7 << PLLE_MISC_SETUP_BASE_SHIFT) |
78 | 78 | ||
79 | #define PLLE_SS_CTRL 0x68 | 79 | #define PLLE_SS_CTRL 0x68 |
80 | #define PLLE_SS_DISABLE (7 << 10) | 80 | #define PLLE_SS_CNTL_BYPASS_SS BIT(10) |
81 | #define PLLE_SS_CNTL_INTERP_RESET BIT(11) | ||
82 | #define PLLE_SS_CNTL_SSC_BYP BIT(12) | ||
83 | #define PLLE_SS_CNTL_CENTER BIT(14) | ||
84 | #define PLLE_SS_CNTL_INVERT BIT(15) | ||
85 | #define PLLE_SS_DISABLE (PLLE_SS_CNTL_BYPASS_SS | PLLE_SS_CNTL_INTERP_RESET |\ | ||
86 | PLLE_SS_CNTL_SSC_BYP) | ||
87 | #define PLLE_SS_MAX_MASK 0x1ff | ||
88 | #define PLLE_SS_MAX_VAL 0x25 | ||
89 | #define PLLE_SS_INC_MASK (0xff << 16) | ||
90 | #define PLLE_SS_INC_VAL (0x1 << 16) | ||
91 | #define PLLE_SS_INCINTRV_MASK (0x3f << 24) | ||
92 | #define PLLE_SS_INCINTRV_VAL (0x20 << 24) | ||
93 | #define PLLE_SS_COEFFICIENTS_MASK \ | ||
94 | (PLLE_SS_MAX_MASK | PLLE_SS_INC_MASK | PLLE_SS_INCINTRV_MASK) | ||
95 | #define PLLE_SS_COEFFICIENTS_VAL \ | ||
96 | (PLLE_SS_MAX_VAL | PLLE_SS_INC_VAL | PLLE_SS_INCINTRV_VAL) | ||
81 | 97 | ||
82 | #define PLLE_AUX_PLLP_SEL BIT(2) | 98 | #define PLLE_AUX_PLLP_SEL BIT(2) |
83 | #define PLLE_AUX_ENABLE_SWCTL BIT(4) | 99 | #define PLLE_AUX_ENABLE_SWCTL BIT(4) |
@@ -121,6 +137,36 @@ | |||
121 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) | 137 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) |
122 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) | 138 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) |
123 | 139 | ||
140 | #define PLLSS_MISC_KCP 0 | ||
141 | #define PLLSS_MISC_KVCO 0 | ||
142 | #define PLLSS_MISC_SETUP 0 | ||
143 | #define PLLSS_EN_SDM 0 | ||
144 | #define PLLSS_EN_SSC 0 | ||
145 | #define PLLSS_EN_DITHER2 0 | ||
146 | #define PLLSS_EN_DITHER 1 | ||
147 | #define PLLSS_SDM_RESET 0 | ||
148 | #define PLLSS_CLAMP 0 | ||
149 | #define PLLSS_SDM_SSC_MAX 0 | ||
150 | #define PLLSS_SDM_SSC_MIN 0 | ||
151 | #define PLLSS_SDM_SSC_STEP 0 | ||
152 | #define PLLSS_SDM_DIN 0 | ||
153 | #define PLLSS_MISC_DEFAULT ((PLLSS_MISC_KCP << 25) | \ | ||
154 | (PLLSS_MISC_KVCO << 24) | \ | ||
155 | PLLSS_MISC_SETUP) | ||
156 | #define PLLSS_CFG_DEFAULT ((PLLSS_EN_SDM << 31) | \ | ||
157 | (PLLSS_EN_SSC << 30) | \ | ||
158 | (PLLSS_EN_DITHER2 << 29) | \ | ||
159 | (PLLSS_EN_DITHER << 28) | \ | ||
160 | (PLLSS_SDM_RESET) << 27 | \ | ||
161 | (PLLSS_CLAMP << 22)) | ||
162 | #define PLLSS_CTRL1_DEFAULT \ | ||
163 | ((PLLSS_SDM_SSC_MAX << 16) | PLLSS_SDM_SSC_MIN) | ||
164 | #define PLLSS_CTRL2_DEFAULT \ | ||
165 | ((PLLSS_SDM_SSC_STEP << 16) | PLLSS_SDM_DIN) | ||
166 | #define PLLSS_LOCK_OVERRIDE BIT(24) | ||
167 | #define PLLSS_REF_SRC_SEL_SHIFT 25 | ||
168 | #define PLLSS_REF_SRC_SEL_MASK (3 << PLLSS_REF_SRC_SEL_SHIFT) | ||
169 | |||
124 | #define pll_readl(offset, p) readl_relaxed(p->clk_base + offset) | 170 | #define pll_readl(offset, p) readl_relaxed(p->clk_base + offset) |
125 | #define pll_readl_base(p) pll_readl(p->params->base_reg, p) | 171 | #define pll_readl_base(p) pll_readl(p->params->base_reg, p) |
126 | #define pll_readl_misc(p) pll_readl(p->params->misc_reg, p) | 172 | #define pll_readl_misc(p) pll_readl(p->params->misc_reg, p) |
@@ -134,7 +180,7 @@ | |||
134 | #define mask(w) ((1 << (w)) - 1) | 180 | #define mask(w) ((1 << (w)) - 1) |
135 | #define divm_mask(p) mask(p->params->div_nmp->divm_width) | 181 | #define divm_mask(p) mask(p->params->div_nmp->divm_width) |
136 | #define divn_mask(p) mask(p->params->div_nmp->divn_width) | 182 | #define divn_mask(p) mask(p->params->div_nmp->divn_width) |
137 | #define divp_mask(p) (p->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK : \ | 183 | #define divp_mask(p) (p->params->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :\ |
138 | mask(p->params->div_nmp->divp_width)) | 184 | mask(p->params->div_nmp->divp_width)) |
139 | 185 | ||
140 | #define divm_max(p) (divm_mask(p)) | 186 | #define divm_max(p) (divm_mask(p)) |
@@ -154,10 +200,10 @@ static void clk_pll_enable_lock(struct tegra_clk_pll *pll) | |||
154 | { | 200 | { |
155 | u32 val; | 201 | u32 val; |
156 | 202 | ||
157 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) | 203 | if (!(pll->params->flags & TEGRA_PLL_USE_LOCK)) |
158 | return; | 204 | return; |
159 | 205 | ||
160 | if (!(pll->flags & TEGRA_PLL_HAS_LOCK_ENABLE)) | 206 | if (!(pll->params->flags & TEGRA_PLL_HAS_LOCK_ENABLE)) |
161 | return; | 207 | return; |
162 | 208 | ||
163 | val = pll_readl_misc(pll); | 209 | val = pll_readl_misc(pll); |
@@ -171,13 +217,13 @@ static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll) | |||
171 | u32 val, lock_mask; | 217 | u32 val, lock_mask; |
172 | void __iomem *lock_addr; | 218 | void __iomem *lock_addr; |
173 | 219 | ||
174 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { | 220 | if (!(pll->params->flags & TEGRA_PLL_USE_LOCK)) { |
175 | udelay(pll->params->lock_delay); | 221 | udelay(pll->params->lock_delay); |
176 | return 0; | 222 | return 0; |
177 | } | 223 | } |
178 | 224 | ||
179 | lock_addr = pll->clk_base; | 225 | lock_addr = pll->clk_base; |
180 | if (pll->flags & TEGRA_PLL_LOCK_MISC) | 226 | if (pll->params->flags & TEGRA_PLL_LOCK_MISC) |
181 | lock_addr += pll->params->misc_reg; | 227 | lock_addr += pll->params->misc_reg; |
182 | else | 228 | else |
183 | lock_addr += pll->params->base_reg; | 229 | lock_addr += pll->params->base_reg; |
@@ -204,7 +250,7 @@ static int clk_pll_is_enabled(struct clk_hw *hw) | |||
204 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 250 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
205 | u32 val; | 251 | u32 val; |
206 | 252 | ||
207 | if (pll->flags & TEGRA_PLLM) { | 253 | if (pll->params->flags & TEGRA_PLLM) { |
208 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 254 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
209 | if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE) | 255 | if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE) |
210 | return val & PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE ? 1 : 0; | 256 | return val & PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE ? 1 : 0; |
@@ -223,12 +269,12 @@ static void _clk_pll_enable(struct clk_hw *hw) | |||
223 | clk_pll_enable_lock(pll); | 269 | clk_pll_enable_lock(pll); |
224 | 270 | ||
225 | val = pll_readl_base(pll); | 271 | val = pll_readl_base(pll); |
226 | if (pll->flags & TEGRA_PLL_BYPASS) | 272 | if (pll->params->flags & TEGRA_PLL_BYPASS) |
227 | val &= ~PLL_BASE_BYPASS; | 273 | val &= ~PLL_BASE_BYPASS; |
228 | val |= PLL_BASE_ENABLE; | 274 | val |= PLL_BASE_ENABLE; |
229 | pll_writel_base(val, pll); | 275 | pll_writel_base(val, pll); |
230 | 276 | ||
231 | if (pll->flags & TEGRA_PLLM) { | 277 | if (pll->params->flags & TEGRA_PLLM) { |
232 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 278 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
233 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; | 279 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; |
234 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 280 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
@@ -241,12 +287,12 @@ static void _clk_pll_disable(struct clk_hw *hw) | |||
241 | u32 val; | 287 | u32 val; |
242 | 288 | ||
243 | val = pll_readl_base(pll); | 289 | val = pll_readl_base(pll); |
244 | if (pll->flags & TEGRA_PLL_BYPASS) | 290 | if (pll->params->flags & TEGRA_PLL_BYPASS) |
245 | val &= ~PLL_BASE_BYPASS; | 291 | val &= ~PLL_BASE_BYPASS; |
246 | val &= ~PLL_BASE_ENABLE; | 292 | val &= ~PLL_BASE_ENABLE; |
247 | pll_writel_base(val, pll); | 293 | pll_writel_base(val, pll); |
248 | 294 | ||
249 | if (pll->flags & TEGRA_PLLM) { | 295 | if (pll->params->flags & TEGRA_PLLM) { |
250 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 296 | val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
251 | val &= ~PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; | 297 | val &= ~PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; |
252 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 298 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
@@ -326,7 +372,7 @@ static int _get_table_rate(struct clk_hw *hw, | |||
326 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 372 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
327 | struct tegra_clk_pll_freq_table *sel; | 373 | struct tegra_clk_pll_freq_table *sel; |
328 | 374 | ||
329 | for (sel = pll->freq_table; sel->input_rate != 0; sel++) | 375 | for (sel = pll->params->freq_table; sel->input_rate != 0; sel++) |
330 | if (sel->input_rate == parent_rate && | 376 | if (sel->input_rate == parent_rate && |
331 | sel->output_rate == rate) | 377 | sel->output_rate == rate) |
332 | break; | 378 | break; |
@@ -389,12 +435,11 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
389 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || | 435 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || |
390 | (1 << p_div) > divp_max(pll) | 436 | (1 << p_div) > divp_max(pll) |
391 | || cfg->output_rate > pll->params->vco_max) { | 437 | || cfg->output_rate > pll->params->vco_max) { |
392 | pr_err("%s: Failed to set %s rate %lu\n", | ||
393 | __func__, __clk_get_name(hw->clk), rate); | ||
394 | WARN_ON(1); | ||
395 | return -EINVAL; | 438 | return -EINVAL; |
396 | } | 439 | } |
397 | 440 | ||
441 | cfg->output_rate >>= p_div; | ||
442 | |||
398 | if (pll->params->pdiv_tohw) { | 443 | if (pll->params->pdiv_tohw) { |
399 | ret = _p_div_to_hw(hw, 1 << p_div); | 444 | ret = _p_div_to_hw(hw, 1 << p_div); |
400 | if (ret < 0) | 445 | if (ret < 0) |
@@ -414,7 +459,7 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll, | |||
414 | struct tegra_clk_pll_params *params = pll->params; | 459 | struct tegra_clk_pll_params *params = pll->params; |
415 | struct div_nmp *div_nmp = params->div_nmp; | 460 | struct div_nmp *div_nmp = params->div_nmp; |
416 | 461 | ||
417 | if ((pll->flags & TEGRA_PLLM) && | 462 | if ((params->flags & TEGRA_PLLM) && |
418 | (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) & | 463 | (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) & |
419 | PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) { | 464 | PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) { |
420 | val = pll_override_readl(params->pmc_divp_reg, pll); | 465 | val = pll_override_readl(params->pmc_divp_reg, pll); |
@@ -450,7 +495,7 @@ static void _get_pll_mnp(struct tegra_clk_pll *pll, | |||
450 | struct tegra_clk_pll_params *params = pll->params; | 495 | struct tegra_clk_pll_params *params = pll->params; |
451 | struct div_nmp *div_nmp = params->div_nmp; | 496 | struct div_nmp *div_nmp = params->div_nmp; |
452 | 497 | ||
453 | if ((pll->flags & TEGRA_PLLM) && | 498 | if ((params->flags & TEGRA_PLLM) && |
454 | (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) & | 499 | (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) & |
455 | PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) { | 500 | PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) { |
456 | val = pll_override_readl(params->pmc_divp_reg, pll); | 501 | val = pll_override_readl(params->pmc_divp_reg, pll); |
@@ -479,11 +524,11 @@ static void _update_pll_cpcon(struct tegra_clk_pll *pll, | |||
479 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); | 524 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); |
480 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; | 525 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; |
481 | 526 | ||
482 | if (pll->flags & TEGRA_PLL_SET_LFCON) { | 527 | if (pll->params->flags & TEGRA_PLL_SET_LFCON) { |
483 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); | 528 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); |
484 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) | 529 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) |
485 | val |= 1 << PLL_MISC_LFCON_SHIFT; | 530 | val |= 1 << PLL_MISC_LFCON_SHIFT; |
486 | } else if (pll->flags & TEGRA_PLL_SET_DCCON) { | 531 | } else if (pll->params->flags & TEGRA_PLL_SET_DCCON) { |
487 | val &= ~(1 << PLL_MISC_DCCON_SHIFT); | 532 | val &= ~(1 << PLL_MISC_DCCON_SHIFT); |
488 | if (rate >= (pll->params->vco_max >> 1)) | 533 | if (rate >= (pll->params->vco_max >> 1)) |
489 | val |= 1 << PLL_MISC_DCCON_SHIFT; | 534 | val |= 1 << PLL_MISC_DCCON_SHIFT; |
@@ -505,7 +550,7 @@ static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
505 | 550 | ||
506 | _update_pll_mnp(pll, cfg); | 551 | _update_pll_mnp(pll, cfg); |
507 | 552 | ||
508 | if (pll->flags & TEGRA_PLL_HAS_CPCON) | 553 | if (pll->params->flags & TEGRA_PLL_HAS_CPCON) |
509 | _update_pll_cpcon(pll, cfg, rate); | 554 | _update_pll_cpcon(pll, cfg, rate); |
510 | 555 | ||
511 | if (state) { | 556 | if (state) { |
@@ -524,11 +569,11 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
524 | unsigned long flags = 0; | 569 | unsigned long flags = 0; |
525 | int ret = 0; | 570 | int ret = 0; |
526 | 571 | ||
527 | if (pll->flags & TEGRA_PLL_FIXED) { | 572 | if (pll->params->flags & TEGRA_PLL_FIXED) { |
528 | if (rate != pll->fixed_rate) { | 573 | if (rate != pll->params->fixed_rate) { |
529 | pr_err("%s: Can not change %s fixed rate %lu to %lu\n", | 574 | pr_err("%s: Can not change %s fixed rate %lu to %lu\n", |
530 | __func__, __clk_get_name(hw->clk), | 575 | __func__, __clk_get_name(hw->clk), |
531 | pll->fixed_rate, rate); | 576 | pll->params->fixed_rate, rate); |
532 | return -EINVAL; | 577 | return -EINVAL; |
533 | } | 578 | } |
534 | return 0; | 579 | return 0; |
@@ -536,6 +581,8 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
536 | 581 | ||
537 | if (_get_table_rate(hw, &cfg, rate, parent_rate) && | 582 | if (_get_table_rate(hw, &cfg, rate, parent_rate) && |
538 | _calc_rate(hw, &cfg, rate, parent_rate)) { | 583 | _calc_rate(hw, &cfg, rate, parent_rate)) { |
584 | pr_err("%s: Failed to set %s rate %lu\n", __func__, | ||
585 | __clk_get_name(hw->clk), rate); | ||
539 | WARN_ON(1); | 586 | WARN_ON(1); |
540 | return -EINVAL; | 587 | return -EINVAL; |
541 | } | 588 | } |
@@ -559,18 +606,16 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | |||
559 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 606 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
560 | struct tegra_clk_pll_freq_table cfg; | 607 | struct tegra_clk_pll_freq_table cfg; |
561 | 608 | ||
562 | if (pll->flags & TEGRA_PLL_FIXED) | 609 | if (pll->params->flags & TEGRA_PLL_FIXED) |
563 | return pll->fixed_rate; | 610 | return pll->params->fixed_rate; |
564 | 611 | ||
565 | /* PLLM is used for memory; we do not change rate */ | 612 | /* PLLM is used for memory; we do not change rate */ |
566 | if (pll->flags & TEGRA_PLLM) | 613 | if (pll->params->flags & TEGRA_PLLM) |
567 | return __clk_get_rate(hw->clk); | 614 | return __clk_get_rate(hw->clk); |
568 | 615 | ||
569 | if (_get_table_rate(hw, &cfg, rate, *prate) && | 616 | if (_get_table_rate(hw, &cfg, rate, *prate) && |
570 | _calc_rate(hw, &cfg, rate, *prate)) { | 617 | _calc_rate(hw, &cfg, rate, *prate)) |
571 | WARN_ON(1); | ||
572 | return -EINVAL; | 618 | return -EINVAL; |
573 | } | ||
574 | 619 | ||
575 | return cfg.output_rate; | 620 | return cfg.output_rate; |
576 | } | 621 | } |
@@ -586,17 +631,19 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | |||
586 | 631 | ||
587 | val = pll_readl_base(pll); | 632 | val = pll_readl_base(pll); |
588 | 633 | ||
589 | if ((pll->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS)) | 634 | if ((pll->params->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS)) |
590 | return parent_rate; | 635 | return parent_rate; |
591 | 636 | ||
592 | if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { | 637 | if ((pll->params->flags & TEGRA_PLL_FIXED) && |
638 | !(val & PLL_BASE_OVERRIDE)) { | ||
593 | struct tegra_clk_pll_freq_table sel; | 639 | struct tegra_clk_pll_freq_table sel; |
594 | if (_get_table_rate(hw, &sel, pll->fixed_rate, parent_rate)) { | 640 | if (_get_table_rate(hw, &sel, pll->params->fixed_rate, |
641 | parent_rate)) { | ||
595 | pr_err("Clock %s has unknown fixed frequency\n", | 642 | pr_err("Clock %s has unknown fixed frequency\n", |
596 | __clk_get_name(hw->clk)); | 643 | __clk_get_name(hw->clk)); |
597 | BUG(); | 644 | BUG(); |
598 | } | 645 | } |
599 | return pll->fixed_rate; | 646 | return pll->params->fixed_rate; |
600 | } | 647 | } |
601 | 648 | ||
602 | _get_pll_mnp(pll, &cfg); | 649 | _get_pll_mnp(pll, &cfg); |
@@ -664,7 +711,7 @@ static int clk_plle_enable(struct clk_hw *hw) | |||
664 | u32 val; | 711 | u32 val; |
665 | int err; | 712 | int err; |
666 | 713 | ||
667 | if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate)) | 714 | if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate)) |
668 | return -EINVAL; | 715 | return -EINVAL; |
669 | 716 | ||
670 | clk_pll_disable(hw); | 717 | clk_pll_disable(hw); |
@@ -680,7 +727,7 @@ static int clk_plle_enable(struct clk_hw *hw) | |||
680 | return err; | 727 | return err; |
681 | } | 728 | } |
682 | 729 | ||
683 | if (pll->flags & TEGRA_PLLE_CONFIGURE) { | 730 | if (pll->params->flags & TEGRA_PLLE_CONFIGURE) { |
684 | /* configure dividers */ | 731 | /* configure dividers */ |
685 | val = pll_readl_base(pll); | 732 | val = pll_readl_base(pll); |
686 | val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll)); | 733 | val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll)); |
@@ -744,7 +791,7 @@ const struct clk_ops tegra_clk_plle_ops = { | |||
744 | .enable = clk_plle_enable, | 791 | .enable = clk_plle_enable, |
745 | }; | 792 | }; |
746 | 793 | ||
747 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | 794 | #if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC) |
748 | 795 | ||
749 | static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, | 796 | static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, |
750 | unsigned long parent_rate) | 797 | unsigned long parent_rate) |
@@ -755,6 +802,48 @@ static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, | |||
755 | return 1; | 802 | return 1; |
756 | } | 803 | } |
757 | 804 | ||
805 | static unsigned long _clip_vco_min(unsigned long vco_min, | ||
806 | unsigned long parent_rate) | ||
807 | { | ||
808 | return DIV_ROUND_UP(vco_min, parent_rate) * parent_rate; | ||
809 | } | ||
810 | |||
811 | static int _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params, | ||
812 | void __iomem *clk_base, | ||
813 | unsigned long parent_rate) | ||
814 | { | ||
815 | u32 val; | ||
816 | u32 step_a, step_b; | ||
817 | |||
818 | switch (parent_rate) { | ||
819 | case 12000000: | ||
820 | case 13000000: | ||
821 | case 26000000: | ||
822 | step_a = 0x2B; | ||
823 | step_b = 0x0B; | ||
824 | break; | ||
825 | case 16800000: | ||
826 | step_a = 0x1A; | ||
827 | step_b = 0x09; | ||
828 | break; | ||
829 | case 19200000: | ||
830 | step_a = 0x12; | ||
831 | step_b = 0x08; | ||
832 | break; | ||
833 | default: | ||
834 | pr_err("%s: Unexpected reference rate %lu\n", | ||
835 | __func__, parent_rate); | ||
836 | WARN_ON(1); | ||
837 | return -EINVAL; | ||
838 | } | ||
839 | |||
840 | val = step_a << pll_params->stepa_shift; | ||
841 | val |= step_b << pll_params->stepb_shift; | ||
842 | writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg); | ||
843 | |||
844 | return 0; | ||
845 | } | ||
846 | |||
758 | static int clk_pll_iddq_enable(struct clk_hw *hw) | 847 | static int clk_pll_iddq_enable(struct clk_hw *hw) |
759 | { | 848 | { |
760 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 849 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
@@ -1173,7 +1262,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw) | |||
1173 | unsigned long flags = 0; | 1262 | unsigned long flags = 0; |
1174 | unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk)); | 1263 | unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk)); |
1175 | 1264 | ||
1176 | if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate)) | 1265 | if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate)) |
1177 | return -EINVAL; | 1266 | return -EINVAL; |
1178 | 1267 | ||
1179 | if (pll->lock) | 1268 | if (pll->lock) |
@@ -1217,6 +1306,18 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw) | |||
1217 | if (ret < 0) | 1306 | if (ret < 0) |
1218 | goto out; | 1307 | goto out; |
1219 | 1308 | ||
1309 | val = pll_readl(PLLE_SS_CTRL, pll); | ||
1310 | val &= ~(PLLE_SS_CNTL_CENTER | PLLE_SS_CNTL_INVERT); | ||
1311 | val &= ~PLLE_SS_COEFFICIENTS_MASK; | ||
1312 | val |= PLLE_SS_COEFFICIENTS_VAL; | ||
1313 | pll_writel(val, PLLE_SS_CTRL, pll); | ||
1314 | val &= ~(PLLE_SS_CNTL_SSC_BYP | PLLE_SS_CNTL_BYPASS_SS); | ||
1315 | pll_writel(val, PLLE_SS_CTRL, pll); | ||
1316 | udelay(1); | ||
1317 | val &= ~PLLE_SS_CNTL_INTERP_RESET; | ||
1318 | pll_writel(val, PLLE_SS_CTRL, pll); | ||
1319 | udelay(1); | ||
1320 | |||
1220 | /* TODO: enable hw control of xusb brick pll */ | 1321 | /* TODO: enable hw control of xusb brick pll */ |
1221 | 1322 | ||
1222 | out: | 1323 | out: |
@@ -1248,9 +1349,8 @@ static void clk_plle_tegra114_disable(struct clk_hw *hw) | |||
1248 | #endif | 1349 | #endif |
1249 | 1350 | ||
1250 | static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, | 1351 | static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, |
1251 | void __iomem *pmc, unsigned long fixed_rate, | 1352 | void __iomem *pmc, struct tegra_clk_pll_params *pll_params, |
1252 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | 1353 | spinlock_t *lock) |
1253 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | ||
1254 | { | 1354 | { |
1255 | struct tegra_clk_pll *pll; | 1355 | struct tegra_clk_pll *pll; |
1256 | 1356 | ||
@@ -1261,10 +1361,7 @@ static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, | |||
1261 | pll->clk_base = clk_base; | 1361 | pll->clk_base = clk_base; |
1262 | pll->pmc = pmc; | 1362 | pll->pmc = pmc; |
1263 | 1363 | ||
1264 | pll->freq_table = freq_table; | ||
1265 | pll->params = pll_params; | 1364 | pll->params = pll_params; |
1266 | pll->fixed_rate = fixed_rate; | ||
1267 | pll->flags = pll_flags; | ||
1268 | pll->lock = lock; | 1365 | pll->lock = lock; |
1269 | 1366 | ||
1270 | if (!pll_params->div_nmp) | 1367 | if (!pll_params->div_nmp) |
@@ -1293,17 +1390,15 @@ static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll, | |||
1293 | 1390 | ||
1294 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 1391 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
1295 | void __iomem *clk_base, void __iomem *pmc, | 1392 | void __iomem *clk_base, void __iomem *pmc, |
1296 | unsigned long flags, unsigned long fixed_rate, | 1393 | unsigned long flags, struct tegra_clk_pll_params *pll_params, |
1297 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | 1394 | spinlock_t *lock) |
1298 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | ||
1299 | { | 1395 | { |
1300 | struct tegra_clk_pll *pll; | 1396 | struct tegra_clk_pll *pll; |
1301 | struct clk *clk; | 1397 | struct clk *clk; |
1302 | 1398 | ||
1303 | pll_flags |= TEGRA_PLL_BYPASS; | 1399 | pll_params->flags |= TEGRA_PLL_BYPASS; |
1304 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | 1400 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE; |
1305 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1401 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); |
1306 | freq_table, lock); | ||
1307 | if (IS_ERR(pll)) | 1402 | if (IS_ERR(pll)) |
1308 | return ERR_CAST(pll); | 1403 | return ERR_CAST(pll); |
1309 | 1404 | ||
@@ -1317,17 +1412,15 @@ struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | |||
1317 | 1412 | ||
1318 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 1413 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
1319 | void __iomem *clk_base, void __iomem *pmc, | 1414 | void __iomem *clk_base, void __iomem *pmc, |
1320 | unsigned long flags, unsigned long fixed_rate, | 1415 | unsigned long flags, struct tegra_clk_pll_params *pll_params, |
1321 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | 1416 | spinlock_t *lock) |
1322 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | ||
1323 | { | 1417 | { |
1324 | struct tegra_clk_pll *pll; | 1418 | struct tegra_clk_pll *pll; |
1325 | struct clk *clk; | 1419 | struct clk *clk; |
1326 | 1420 | ||
1327 | pll_flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS; | 1421 | pll_params->flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS; |
1328 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | 1422 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE; |
1329 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1423 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); |
1330 | freq_table, lock); | ||
1331 | if (IS_ERR(pll)) | 1424 | if (IS_ERR(pll)) |
1332 | return ERR_CAST(pll); | 1425 | return ERR_CAST(pll); |
1333 | 1426 | ||
@@ -1339,7 +1432,7 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | |||
1339 | return clk; | 1432 | return clk; |
1340 | } | 1433 | } |
1341 | 1434 | ||
1342 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | 1435 | #if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC) |
1343 | const struct clk_ops tegra_clk_pllxc_ops = { | 1436 | const struct clk_ops tegra_clk_pllxc_ops = { |
1344 | .is_enabled = clk_pll_is_enabled, | 1437 | .is_enabled = clk_pll_is_enabled, |
1345 | .enable = clk_pll_iddq_enable, | 1438 | .enable = clk_pll_iddq_enable, |
@@ -1386,21 +1479,46 @@ const struct clk_ops tegra_clk_plle_tegra114_ops = { | |||
1386 | 1479 | ||
1387 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | 1480 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, |
1388 | void __iomem *clk_base, void __iomem *pmc, | 1481 | void __iomem *clk_base, void __iomem *pmc, |
1389 | unsigned long flags, unsigned long fixed_rate, | 1482 | unsigned long flags, |
1390 | struct tegra_clk_pll_params *pll_params, | 1483 | struct tegra_clk_pll_params *pll_params, |
1391 | u32 pll_flags, | ||
1392 | struct tegra_clk_pll_freq_table *freq_table, | ||
1393 | spinlock_t *lock) | 1484 | spinlock_t *lock) |
1394 | { | 1485 | { |
1395 | struct tegra_clk_pll *pll; | 1486 | struct tegra_clk_pll *pll; |
1396 | struct clk *clk; | 1487 | struct clk *clk, *parent; |
1488 | unsigned long parent_rate; | ||
1489 | int err; | ||
1490 | u32 val, val_iddq; | ||
1491 | |||
1492 | parent = __clk_lookup(parent_name); | ||
1493 | if (!parent) { | ||
1494 | WARN(1, "parent clk %s of %s must be registered first\n", | ||
1495 | name, parent_name); | ||
1496 | return ERR_PTR(-EINVAL); | ||
1497 | } | ||
1397 | 1498 | ||
1398 | if (!pll_params->pdiv_tohw) | 1499 | if (!pll_params->pdiv_tohw) |
1399 | return ERR_PTR(-EINVAL); | 1500 | return ERR_PTR(-EINVAL); |
1400 | 1501 | ||
1401 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | 1502 | parent_rate = __clk_get_rate(parent); |
1402 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1503 | |
1403 | freq_table, lock); | 1504 | pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate); |
1505 | |||
1506 | err = _setup_dynamic_ramp(pll_params, clk_base, parent_rate); | ||
1507 | if (err) | ||
1508 | return ERR_PTR(err); | ||
1509 | |||
1510 | val = readl_relaxed(clk_base + pll_params->base_reg); | ||
1511 | val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg); | ||
1512 | |||
1513 | if (val & PLL_BASE_ENABLE) | ||
1514 | WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx)); | ||
1515 | else { | ||
1516 | val_iddq |= BIT(pll_params->iddq_bit_idx); | ||
1517 | writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg); | ||
1518 | } | ||
1519 | |||
1520 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1521 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); | ||
1404 | if (IS_ERR(pll)) | 1522 | if (IS_ERR(pll)) |
1405 | return ERR_CAST(pll); | 1523 | return ERR_CAST(pll); |
1406 | 1524 | ||
@@ -1414,19 +1532,19 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | |||
1414 | 1532 | ||
1415 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | 1533 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, |
1416 | void __iomem *clk_base, void __iomem *pmc, | 1534 | void __iomem *clk_base, void __iomem *pmc, |
1417 | unsigned long flags, unsigned long fixed_rate, | 1535 | unsigned long flags, |
1418 | struct tegra_clk_pll_params *pll_params, | 1536 | struct tegra_clk_pll_params *pll_params, |
1419 | u32 pll_flags, | ||
1420 | struct tegra_clk_pll_freq_table *freq_table, | ||
1421 | spinlock_t *lock, unsigned long parent_rate) | 1537 | spinlock_t *lock, unsigned long parent_rate) |
1422 | { | 1538 | { |
1423 | u32 val; | 1539 | u32 val; |
1424 | struct tegra_clk_pll *pll; | 1540 | struct tegra_clk_pll *pll; |
1425 | struct clk *clk; | 1541 | struct clk *clk; |
1426 | 1542 | ||
1427 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC; | 1543 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC; |
1428 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1544 | |
1429 | freq_table, lock); | 1545 | pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate); |
1546 | |||
1547 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); | ||
1430 | if (IS_ERR(pll)) | 1548 | if (IS_ERR(pll)) |
1431 | return ERR_CAST(pll); | 1549 | return ERR_CAST(pll); |
1432 | 1550 | ||
@@ -1461,23 +1579,32 @@ struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | |||
1461 | 1579 | ||
1462 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | 1580 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, |
1463 | void __iomem *clk_base, void __iomem *pmc, | 1581 | void __iomem *clk_base, void __iomem *pmc, |
1464 | unsigned long flags, unsigned long fixed_rate, | 1582 | unsigned long flags, |
1465 | struct tegra_clk_pll_params *pll_params, | 1583 | struct tegra_clk_pll_params *pll_params, |
1466 | u32 pll_flags, | ||
1467 | struct tegra_clk_pll_freq_table *freq_table, | ||
1468 | spinlock_t *lock) | 1584 | spinlock_t *lock) |
1469 | { | 1585 | { |
1470 | struct tegra_clk_pll *pll; | 1586 | struct tegra_clk_pll *pll; |
1471 | struct clk *clk; | 1587 | struct clk *clk, *parent; |
1588 | unsigned long parent_rate; | ||
1472 | 1589 | ||
1473 | if (!pll_params->pdiv_tohw) | 1590 | if (!pll_params->pdiv_tohw) |
1474 | return ERR_PTR(-EINVAL); | 1591 | return ERR_PTR(-EINVAL); |
1475 | 1592 | ||
1476 | pll_flags |= TEGRA_PLL_BYPASS; | 1593 | parent = __clk_lookup(parent_name); |
1477 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | 1594 | if (!parent) { |
1478 | pll_flags |= TEGRA_PLLM; | 1595 | WARN(1, "parent clk %s of %s must be registered first\n", |
1479 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1596 | name, parent_name); |
1480 | freq_table, lock); | 1597 | return ERR_PTR(-EINVAL); |
1598 | } | ||
1599 | |||
1600 | parent_rate = __clk_get_rate(parent); | ||
1601 | |||
1602 | pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate); | ||
1603 | |||
1604 | pll_params->flags |= TEGRA_PLL_BYPASS; | ||
1605 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1606 | pll_params->flags |= TEGRA_PLLM; | ||
1607 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); | ||
1481 | if (IS_ERR(pll)) | 1608 | if (IS_ERR(pll)) |
1482 | return ERR_CAST(pll); | 1609 | return ERR_CAST(pll); |
1483 | 1610 | ||
@@ -1491,10 +1618,8 @@ struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | |||
1491 | 1618 | ||
1492 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | 1619 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, |
1493 | void __iomem *clk_base, void __iomem *pmc, | 1620 | void __iomem *clk_base, void __iomem *pmc, |
1494 | unsigned long flags, unsigned long fixed_rate, | 1621 | unsigned long flags, |
1495 | struct tegra_clk_pll_params *pll_params, | 1622 | struct tegra_clk_pll_params *pll_params, |
1496 | u32 pll_flags, | ||
1497 | struct tegra_clk_pll_freq_table *freq_table, | ||
1498 | spinlock_t *lock) | 1623 | spinlock_t *lock) |
1499 | { | 1624 | { |
1500 | struct clk *parent, *clk; | 1625 | struct clk *parent, *clk; |
@@ -1507,20 +1632,21 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | |||
1507 | return ERR_PTR(-EINVAL); | 1632 | return ERR_PTR(-EINVAL); |
1508 | 1633 | ||
1509 | parent = __clk_lookup(parent_name); | 1634 | parent = __clk_lookup(parent_name); |
1510 | if (IS_ERR(parent)) { | 1635 | if (!parent) { |
1511 | WARN(1, "parent clk %s of %s must be registered first\n", | 1636 | WARN(1, "parent clk %s of %s must be registered first\n", |
1512 | name, parent_name); | 1637 | name, parent_name); |
1513 | return ERR_PTR(-EINVAL); | 1638 | return ERR_PTR(-EINVAL); |
1514 | } | 1639 | } |
1515 | 1640 | ||
1516 | pll_flags |= TEGRA_PLL_BYPASS; | 1641 | parent_rate = __clk_get_rate(parent); |
1517 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | 1642 | |
1518 | freq_table, lock); | 1643 | pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate); |
1644 | |||
1645 | pll_params->flags |= TEGRA_PLL_BYPASS; | ||
1646 | pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); | ||
1519 | if (IS_ERR(pll)) | 1647 | if (IS_ERR(pll)) |
1520 | return ERR_CAST(pll); | 1648 | return ERR_CAST(pll); |
1521 | 1649 | ||
1522 | parent_rate = __clk_get_rate(parent); | ||
1523 | |||
1524 | /* | 1650 | /* |
1525 | * Most of PLLC register fields are shadowed, and can not be read | 1651 | * Most of PLLC register fields are shadowed, and can not be read |
1526 | * directly from PLL h/w. Hence, actual PLLC boot state is unknown. | 1652 | * directly from PLL h/w. Hence, actual PLLC boot state is unknown. |
@@ -1567,17 +1693,15 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | |||
1567 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | 1693 | struct clk *tegra_clk_register_plle_tegra114(const char *name, |
1568 | const char *parent_name, | 1694 | const char *parent_name, |
1569 | void __iomem *clk_base, unsigned long flags, | 1695 | void __iomem *clk_base, unsigned long flags, |
1570 | unsigned long fixed_rate, | ||
1571 | struct tegra_clk_pll_params *pll_params, | 1696 | struct tegra_clk_pll_params *pll_params, |
1572 | struct tegra_clk_pll_freq_table *freq_table, | ||
1573 | spinlock_t *lock) | 1697 | spinlock_t *lock) |
1574 | { | 1698 | { |
1575 | struct tegra_clk_pll *pll; | 1699 | struct tegra_clk_pll *pll; |
1576 | struct clk *clk; | 1700 | struct clk *clk; |
1577 | u32 val, val_aux; | 1701 | u32 val, val_aux; |
1578 | 1702 | ||
1579 | pll = _tegra_init_pll(clk_base, NULL, fixed_rate, pll_params, | 1703 | pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE; |
1580 | TEGRA_PLL_HAS_LOCK_ENABLE, freq_table, lock); | 1704 | pll = _tegra_init_pll(clk_base, NULL, pll_params, lock); |
1581 | if (IS_ERR(pll)) | 1705 | if (IS_ERR(pll)) |
1582 | return ERR_CAST(pll); | 1706 | return ERR_CAST(pll); |
1583 | 1707 | ||
@@ -1587,11 +1711,13 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name, | |||
1587 | val_aux = pll_readl(pll_params->aux_reg, pll); | 1711 | val_aux = pll_readl(pll_params->aux_reg, pll); |
1588 | 1712 | ||
1589 | if (val & PLL_BASE_ENABLE) { | 1713 | if (val & PLL_BASE_ENABLE) { |
1590 | if (!(val_aux & PLLE_AUX_PLLRE_SEL)) | 1714 | if ((val_aux & PLLE_AUX_PLLRE_SEL) || |
1715 | (val_aux & PLLE_AUX_PLLP_SEL)) | ||
1591 | WARN(1, "pll_e enabled with unsupported parent %s\n", | 1716 | WARN(1, "pll_e enabled with unsupported parent %s\n", |
1592 | (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref"); | 1717 | (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : |
1718 | "pll_re_vco"); | ||
1593 | } else { | 1719 | } else { |
1594 | val_aux |= PLLE_AUX_PLLRE_SEL; | 1720 | val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL); |
1595 | pll_writel(val, pll_params->aux_reg, pll); | 1721 | pll_writel(val, pll_params->aux_reg, pll); |
1596 | } | 1722 | } |
1597 | 1723 | ||
@@ -1603,3 +1729,92 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name, | |||
1603 | return clk; | 1729 | return clk; |
1604 | } | 1730 | } |
1605 | #endif | 1731 | #endif |
1732 | |||
1733 | #ifdef CONFIG_ARCH_TEGRA_124_SOC | ||
1734 | const struct clk_ops tegra_clk_pllss_ops = { | ||
1735 | .is_enabled = clk_pll_is_enabled, | ||
1736 | .enable = clk_pll_iddq_enable, | ||
1737 | .disable = clk_pll_iddq_disable, | ||
1738 | .recalc_rate = clk_pll_recalc_rate, | ||
1739 | .round_rate = clk_pll_ramp_round_rate, | ||
1740 | .set_rate = clk_pllxc_set_rate, | ||
1741 | }; | ||
1742 | |||
1743 | struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name, | ||
1744 | void __iomem *clk_base, unsigned long flags, | ||
1745 | struct tegra_clk_pll_params *pll_params, | ||
1746 | spinlock_t *lock) | ||
1747 | { | ||
1748 | struct tegra_clk_pll *pll; | ||
1749 | struct clk *clk, *parent; | ||
1750 | struct tegra_clk_pll_freq_table cfg; | ||
1751 | unsigned long parent_rate; | ||
1752 | u32 val; | ||
1753 | int i; | ||
1754 | |||
1755 | if (!pll_params->div_nmp) | ||
1756 | return ERR_PTR(-EINVAL); | ||
1757 | |||
1758 | parent = __clk_lookup(parent_name); | ||
1759 | if (!parent) { | ||
1760 | WARN(1, "parent clk %s of %s must be registered first\n", | ||
1761 | name, parent_name); | ||
1762 | return ERR_PTR(-EINVAL); | ||
1763 | } | ||
1764 | |||
1765 | pll_params->flags = TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_USE_LOCK; | ||
1766 | pll = _tegra_init_pll(clk_base, NULL, pll_params, lock); | ||
1767 | if (IS_ERR(pll)) | ||
1768 | return ERR_CAST(pll); | ||
1769 | |||
1770 | val = pll_readl_base(pll); | ||
1771 | val &= ~PLLSS_REF_SRC_SEL_MASK; | ||
1772 | pll_writel_base(val, pll); | ||
1773 | |||
1774 | parent_rate = __clk_get_rate(parent); | ||
1775 | |||
1776 | pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate); | ||
1777 | |||
1778 | /* initialize PLL to minimum rate */ | ||
1779 | |||
1780 | cfg.m = _pll_fixed_mdiv(pll_params, parent_rate); | ||
1781 | cfg.n = cfg.m * pll_params->vco_min / parent_rate; | ||
1782 | |||
1783 | for (i = 0; pll_params->pdiv_tohw[i].pdiv; i++) | ||
1784 | ; | ||
1785 | if (!i) { | ||
1786 | kfree(pll); | ||
1787 | return ERR_PTR(-EINVAL); | ||
1788 | } | ||
1789 | |||
1790 | cfg.p = pll_params->pdiv_tohw[i-1].hw_val; | ||
1791 | |||
1792 | _update_pll_mnp(pll, &cfg); | ||
1793 | |||
1794 | pll_writel_misc(PLLSS_MISC_DEFAULT, pll); | ||
1795 | pll_writel(PLLSS_CFG_DEFAULT, pll_params->ext_misc_reg[0], pll); | ||
1796 | pll_writel(PLLSS_CTRL1_DEFAULT, pll_params->ext_misc_reg[1], pll); | ||
1797 | pll_writel(PLLSS_CTRL1_DEFAULT, pll_params->ext_misc_reg[2], pll); | ||
1798 | |||
1799 | val = pll_readl_base(pll); | ||
1800 | if (val & PLL_BASE_ENABLE) { | ||
1801 | if (val & BIT(pll_params->iddq_bit_idx)) { | ||
1802 | WARN(1, "%s is on but IDDQ set\n", name); | ||
1803 | kfree(pll); | ||
1804 | return ERR_PTR(-EINVAL); | ||
1805 | } | ||
1806 | } else | ||
1807 | val |= BIT(pll_params->iddq_bit_idx); | ||
1808 | |||
1809 | val &= ~PLLSS_LOCK_OVERRIDE; | ||
1810 | pll_writel_base(val, pll); | ||
1811 | |||
1812 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1813 | &tegra_clk_pllss_ops); | ||
1814 | |||
1815 | if (IS_ERR(clk)) | ||
1816 | kfree(pll); | ||
1817 | |||
1818 | return clk; | ||
1819 | } | ||
1820 | #endif | ||
diff --git a/drivers/clk/tegra/clk-tegra-audio.c b/drivers/clk/tegra/clk-tegra-audio.c new file mode 100644 index 000000000000..5c38aab2c5b8 --- /dev/null +++ b/drivers/clk/tegra/clk-tegra-audio.c | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/export.h> | ||
24 | #include <linux/clk/tegra.h> | ||
25 | |||
26 | #include "clk.h" | ||
27 | #include "clk-id.h" | ||
28 | |||
29 | #define AUDIO_SYNC_CLK_I2S0 0x4a0 | ||
30 | #define AUDIO_SYNC_CLK_I2S1 0x4a4 | ||
31 | #define AUDIO_SYNC_CLK_I2S2 0x4a8 | ||
32 | #define AUDIO_SYNC_CLK_I2S3 0x4ac | ||
33 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 | ||
34 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 | ||
35 | |||
36 | #define AUDIO_SYNC_DOUBLER 0x49c | ||
37 | |||
38 | #define PLLA_OUT 0xb4 | ||
39 | |||
40 | struct tegra_sync_source_initdata { | ||
41 | char *name; | ||
42 | unsigned long rate; | ||
43 | unsigned long max_rate; | ||
44 | int clk_id; | ||
45 | }; | ||
46 | |||
47 | #define SYNC(_name) \ | ||
48 | {\ | ||
49 | .name = #_name,\ | ||
50 | .rate = 24000000,\ | ||
51 | .max_rate = 24000000,\ | ||
52 | .clk_id = tegra_clk_ ## _name,\ | ||
53 | } | ||
54 | |||
55 | struct tegra_audio_clk_initdata { | ||
56 | char *gate_name; | ||
57 | char *mux_name; | ||
58 | u32 offset; | ||
59 | int gate_clk_id; | ||
60 | int mux_clk_id; | ||
61 | }; | ||
62 | |||
63 | #define AUDIO(_name, _offset) \ | ||
64 | {\ | ||
65 | .gate_name = #_name,\ | ||
66 | .mux_name = #_name"_mux",\ | ||
67 | .offset = _offset,\ | ||
68 | .gate_clk_id = tegra_clk_ ## _name,\ | ||
69 | .mux_clk_id = tegra_clk_ ## _name ## _mux,\ | ||
70 | } | ||
71 | |||
72 | struct tegra_audio2x_clk_initdata { | ||
73 | char *parent; | ||
74 | char *gate_name; | ||
75 | char *name_2x; | ||
76 | char *div_name; | ||
77 | int clk_id; | ||
78 | int clk_num; | ||
79 | u8 div_offset; | ||
80 | }; | ||
81 | |||
82 | #define AUDIO2X(_name, _num, _offset) \ | ||
83 | {\ | ||
84 | .parent = #_name,\ | ||
85 | .gate_name = #_name"_2x",\ | ||
86 | .name_2x = #_name"_doubler",\ | ||
87 | .div_name = #_name"_div",\ | ||
88 | .clk_id = tegra_clk_ ## _name ## _2x,\ | ||
89 | .clk_num = _num,\ | ||
90 | .div_offset = _offset,\ | ||
91 | } | ||
92 | |||
93 | static DEFINE_SPINLOCK(clk_doubler_lock); | ||
94 | |||
95 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", | ||
96 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
97 | }; | ||
98 | |||
99 | static struct tegra_sync_source_initdata sync_source_clks[] __initdata = { | ||
100 | SYNC(spdif_in_sync), | ||
101 | SYNC(i2s0_sync), | ||
102 | SYNC(i2s1_sync), | ||
103 | SYNC(i2s2_sync), | ||
104 | SYNC(i2s3_sync), | ||
105 | SYNC(i2s4_sync), | ||
106 | SYNC(vimclk_sync), | ||
107 | }; | ||
108 | |||
109 | static struct tegra_audio_clk_initdata audio_clks[] = { | ||
110 | AUDIO(audio0, AUDIO_SYNC_CLK_I2S0), | ||
111 | AUDIO(audio1, AUDIO_SYNC_CLK_I2S1), | ||
112 | AUDIO(audio2, AUDIO_SYNC_CLK_I2S2), | ||
113 | AUDIO(audio3, AUDIO_SYNC_CLK_I2S3), | ||
114 | AUDIO(audio4, AUDIO_SYNC_CLK_I2S4), | ||
115 | AUDIO(spdif, AUDIO_SYNC_CLK_SPDIF), | ||
116 | }; | ||
117 | |||
118 | static struct tegra_audio2x_clk_initdata audio2x_clks[] = { | ||
119 | AUDIO2X(audio0, 113, 24), | ||
120 | AUDIO2X(audio1, 114, 25), | ||
121 | AUDIO2X(audio2, 115, 26), | ||
122 | AUDIO2X(audio3, 116, 27), | ||
123 | AUDIO2X(audio4, 117, 28), | ||
124 | AUDIO2X(spdif, 118, 29), | ||
125 | }; | ||
126 | |||
127 | void __init tegra_audio_clk_init(void __iomem *clk_base, | ||
128 | void __iomem *pmc_base, struct tegra_clk *tegra_clks, | ||
129 | struct tegra_clk_pll_params *pll_a_params) | ||
130 | { | ||
131 | struct clk *clk; | ||
132 | struct clk **dt_clk; | ||
133 | int i; | ||
134 | |||
135 | /* PLLA */ | ||
136 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_a, tegra_clks); | ||
137 | if (dt_clk) { | ||
138 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, | ||
139 | pmc_base, 0, pll_a_params, NULL); | ||
140 | *dt_clk = clk; | ||
141 | } | ||
142 | |||
143 | /* PLLA_OUT0 */ | ||
144 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_a_out0, tegra_clks); | ||
145 | if (dt_clk) { | ||
146 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | ||
147 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
148 | 8, 8, 1, NULL); | ||
149 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | ||
150 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
151 | CLK_SET_RATE_PARENT, 0, NULL); | ||
152 | *dt_clk = clk; | ||
153 | } | ||
154 | |||
155 | for (i = 0; i < ARRAY_SIZE(sync_source_clks); i++) { | ||
156 | struct tegra_sync_source_initdata *data; | ||
157 | |||
158 | data = &sync_source_clks[i]; | ||
159 | |||
160 | dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks); | ||
161 | if (!dt_clk) | ||
162 | continue; | ||
163 | |||
164 | clk = tegra_clk_register_sync_source(data->name, | ||
165 | data->rate, data->max_rate); | ||
166 | *dt_clk = clk; | ||
167 | } | ||
168 | |||
169 | for (i = 0; i < ARRAY_SIZE(audio_clks); i++) { | ||
170 | struct tegra_audio_clk_initdata *data; | ||
171 | |||
172 | data = &audio_clks[i]; | ||
173 | dt_clk = tegra_lookup_dt_id(data->mux_clk_id, tegra_clks); | ||
174 | |||
175 | if (!dt_clk) | ||
176 | continue; | ||
177 | clk = clk_register_mux(NULL, data->mux_name, mux_audio_sync_clk, | ||
178 | ARRAY_SIZE(mux_audio_sync_clk), | ||
179 | CLK_SET_RATE_NO_REPARENT, | ||
180 | clk_base + data->offset, 0, 3, 0, | ||
181 | NULL); | ||
182 | *dt_clk = clk; | ||
183 | |||
184 | dt_clk = tegra_lookup_dt_id(data->gate_clk_id, tegra_clks); | ||
185 | if (!dt_clk) | ||
186 | continue; | ||
187 | |||
188 | clk = clk_register_gate(NULL, data->gate_name, data->mux_name, | ||
189 | 0, clk_base + data->offset, 4, | ||
190 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
191 | *dt_clk = clk; | ||
192 | } | ||
193 | |||
194 | for (i = 0; i < ARRAY_SIZE(audio2x_clks); i++) { | ||
195 | struct tegra_audio2x_clk_initdata *data; | ||
196 | |||
197 | data = &audio2x_clks[i]; | ||
198 | dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks); | ||
199 | if (!dt_clk) | ||
200 | continue; | ||
201 | |||
202 | clk = clk_register_fixed_factor(NULL, data->name_2x, | ||
203 | data->parent, CLK_SET_RATE_PARENT, 2, 1); | ||
204 | clk = tegra_clk_register_divider(data->div_name, | ||
205 | data->name_2x, clk_base + AUDIO_SYNC_DOUBLER, | ||
206 | 0, 0, data->div_offset, 1, 0, | ||
207 | &clk_doubler_lock); | ||
208 | clk = tegra_clk_register_periph_gate(data->gate_name, | ||
209 | data->div_name, TEGRA_PERIPH_NO_RESET, | ||
210 | clk_base, CLK_SET_RATE_PARENT, data->clk_num, | ||
211 | periph_clk_enb_refcnt); | ||
212 | *dt_clk = clk; | ||
213 | } | ||
214 | } | ||
215 | |||
diff --git a/drivers/clk/tegra/clk-tegra-fixed.c b/drivers/clk/tegra/clk-tegra-fixed.c new file mode 100644 index 000000000000..f3b773833429 --- /dev/null +++ b/drivers/clk/tegra/clk-tegra-fixed.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/export.h> | ||
24 | #include <linux/clk/tegra.h> | ||
25 | |||
26 | #include "clk.h" | ||
27 | #include "clk-id.h" | ||
28 | |||
29 | #define OSC_CTRL 0x50 | ||
30 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 | ||
31 | #define OSC_CTRL_PLL_REF_DIV_SHIFT 26 | ||
32 | |||
33 | int __init tegra_osc_clk_init(void __iomem *clk_base, | ||
34 | struct tegra_clk *tegra_clks, | ||
35 | unsigned long *input_freqs, int num, | ||
36 | unsigned long *osc_freq, | ||
37 | unsigned long *pll_ref_freq) | ||
38 | { | ||
39 | struct clk *clk; | ||
40 | struct clk **dt_clk; | ||
41 | u32 val, pll_ref_div; | ||
42 | unsigned osc_idx; | ||
43 | |||
44 | val = readl_relaxed(clk_base + OSC_CTRL); | ||
45 | osc_idx = val >> OSC_CTRL_OSC_FREQ_SHIFT; | ||
46 | |||
47 | if (osc_idx < num) | ||
48 | *osc_freq = input_freqs[osc_idx]; | ||
49 | else | ||
50 | *osc_freq = 0; | ||
51 | |||
52 | if (!*osc_freq) { | ||
53 | WARN_ON(1); | ||
54 | return -EINVAL; | ||
55 | } | ||
56 | |||
57 | dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m, tegra_clks); | ||
58 | if (!dt_clk) | ||
59 | return 0; | ||
60 | |||
61 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, | ||
62 | *osc_freq); | ||
63 | *dt_clk = clk; | ||
64 | |||
65 | /* pll_ref */ | ||
66 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; | ||
67 | pll_ref_div = 1 << val; | ||
68 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_ref, tegra_clks); | ||
69 | if (!dt_clk) | ||
70 | return 0; | ||
71 | |||
72 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | ||
73 | 0, 1, pll_ref_div); | ||
74 | *dt_clk = clk; | ||
75 | |||
76 | if (pll_ref_freq) | ||
77 | *pll_ref_freq = *osc_freq / pll_ref_div; | ||
78 | |||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | void __init tegra_fixed_clk_init(struct tegra_clk *tegra_clks) | ||
83 | { | ||
84 | struct clk *clk; | ||
85 | struct clk **dt_clk; | ||
86 | |||
87 | /* clk_32k */ | ||
88 | dt_clk = tegra_lookup_dt_id(tegra_clk_clk_32k, tegra_clks); | ||
89 | if (dt_clk) { | ||
90 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, | ||
91 | CLK_IS_ROOT, 32768); | ||
92 | *dt_clk = clk; | ||
93 | } | ||
94 | |||
95 | /* clk_m_div2 */ | ||
96 | dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div2, tegra_clks); | ||
97 | if (dt_clk) { | ||
98 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", | ||
99 | CLK_SET_RATE_PARENT, 1, 2); | ||
100 | *dt_clk = clk; | ||
101 | } | ||
102 | |||
103 | /* clk_m_div4 */ | ||
104 | dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div4, tegra_clks); | ||
105 | if (dt_clk) { | ||
106 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", | ||
107 | CLK_SET_RATE_PARENT, 1, 4); | ||
108 | *dt_clk = clk; | ||
109 | } | ||
110 | } | ||
111 | |||
diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c new file mode 100644 index 000000000000..5c35885f4a7c --- /dev/null +++ b/drivers/clk/tegra/clk-tegra-periph.c | |||
@@ -0,0 +1,674 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/clkdev.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_address.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/export.h> | ||
25 | #include <linux/clk/tegra.h> | ||
26 | |||
27 | #include "clk.h" | ||
28 | #include "clk-id.h" | ||
29 | |||
30 | #define CLK_SOURCE_I2S0 0x1d8 | ||
31 | #define CLK_SOURCE_I2S1 0x100 | ||
32 | #define CLK_SOURCE_I2S2 0x104 | ||
33 | #define CLK_SOURCE_NDFLASH 0x160 | ||
34 | #define CLK_SOURCE_I2S3 0x3bc | ||
35 | #define CLK_SOURCE_I2S4 0x3c0 | ||
36 | #define CLK_SOURCE_SPDIF_OUT 0x108 | ||
37 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
38 | #define CLK_SOURCE_PWM 0x110 | ||
39 | #define CLK_SOURCE_ADX 0x638 | ||
40 | #define CLK_SOURCE_ADX1 0x670 | ||
41 | #define CLK_SOURCE_AMX 0x63c | ||
42 | #define CLK_SOURCE_AMX1 0x674 | ||
43 | #define CLK_SOURCE_HDA 0x428 | ||
44 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 | ||
45 | #define CLK_SOURCE_SBC1 0x134 | ||
46 | #define CLK_SOURCE_SBC2 0x118 | ||
47 | #define CLK_SOURCE_SBC3 0x11c | ||
48 | #define CLK_SOURCE_SBC4 0x1b4 | ||
49 | #define CLK_SOURCE_SBC5 0x3c8 | ||
50 | #define CLK_SOURCE_SBC6 0x3cc | ||
51 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
52 | #define CLK_SOURCE_SATA 0x424 | ||
53 | #define CLK_SOURCE_NDSPEED 0x3f8 | ||
54 | #define CLK_SOURCE_VFIR 0x168 | ||
55 | #define CLK_SOURCE_SDMMC1 0x150 | ||
56 | #define CLK_SOURCE_SDMMC2 0x154 | ||
57 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
58 | #define CLK_SOURCE_SDMMC4 0x164 | ||
59 | #define CLK_SOURCE_CVE 0x140 | ||
60 | #define CLK_SOURCE_TVO 0x188 | ||
61 | #define CLK_SOURCE_TVDAC 0x194 | ||
62 | #define CLK_SOURCE_VDE 0x1c8 | ||
63 | #define CLK_SOURCE_CSITE 0x1d4 | ||
64 | #define CLK_SOURCE_LA 0x1f8 | ||
65 | #define CLK_SOURCE_TRACE 0x634 | ||
66 | #define CLK_SOURCE_OWR 0x1cc | ||
67 | #define CLK_SOURCE_NOR 0x1d0 | ||
68 | #define CLK_SOURCE_MIPI 0x174 | ||
69 | #define CLK_SOURCE_I2C1 0x124 | ||
70 | #define CLK_SOURCE_I2C2 0x198 | ||
71 | #define CLK_SOURCE_I2C3 0x1b8 | ||
72 | #define CLK_SOURCE_I2C4 0x3c4 | ||
73 | #define CLK_SOURCE_I2C5 0x128 | ||
74 | #define CLK_SOURCE_I2C6 0x65c | ||
75 | #define CLK_SOURCE_UARTA 0x178 | ||
76 | #define CLK_SOURCE_UARTB 0x17c | ||
77 | #define CLK_SOURCE_UARTC 0x1a0 | ||
78 | #define CLK_SOURCE_UARTD 0x1c0 | ||
79 | #define CLK_SOURCE_UARTE 0x1c4 | ||
80 | #define CLK_SOURCE_3D 0x158 | ||
81 | #define CLK_SOURCE_2D 0x15c | ||
82 | #define CLK_SOURCE_MPE 0x170 | ||
83 | #define CLK_SOURCE_UARTE 0x1c4 | ||
84 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
85 | #define CLK_SOURCE_VI 0x148 | ||
86 | #define CLK_SOURCE_EPP 0x16c | ||
87 | #define CLK_SOURCE_MSENC 0x1f0 | ||
88 | #define CLK_SOURCE_TSEC 0x1f4 | ||
89 | #define CLK_SOURCE_HOST1X 0x180 | ||
90 | #define CLK_SOURCE_HDMI 0x18c | ||
91 | #define CLK_SOURCE_DISP1 0x138 | ||
92 | #define CLK_SOURCE_DISP2 0x13c | ||
93 | #define CLK_SOURCE_CILAB 0x614 | ||
94 | #define CLK_SOURCE_CILCD 0x618 | ||
95 | #define CLK_SOURCE_CILE 0x61c | ||
96 | #define CLK_SOURCE_DSIALP 0x620 | ||
97 | #define CLK_SOURCE_DSIBLP 0x624 | ||
98 | #define CLK_SOURCE_TSENSOR 0x3b8 | ||
99 | #define CLK_SOURCE_D_AUDIO 0x3d0 | ||
100 | #define CLK_SOURCE_DAM0 0x3d8 | ||
101 | #define CLK_SOURCE_DAM1 0x3dc | ||
102 | #define CLK_SOURCE_DAM2 0x3e0 | ||
103 | #define CLK_SOURCE_ACTMON 0x3e8 | ||
104 | #define CLK_SOURCE_EXTERN1 0x3ec | ||
105 | #define CLK_SOURCE_EXTERN2 0x3f0 | ||
106 | #define CLK_SOURCE_EXTERN3 0x3f4 | ||
107 | #define CLK_SOURCE_I2CSLOW 0x3fc | ||
108 | #define CLK_SOURCE_SE 0x42c | ||
109 | #define CLK_SOURCE_MSELECT 0x3b4 | ||
110 | #define CLK_SOURCE_DFLL_REF 0x62c | ||
111 | #define CLK_SOURCE_DFLL_SOC 0x630 | ||
112 | #define CLK_SOURCE_SOC_THERM 0x644 | ||
113 | #define CLK_SOURCE_XUSB_HOST_SRC 0x600 | ||
114 | #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 | ||
115 | #define CLK_SOURCE_XUSB_FS_SRC 0x608 | ||
116 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 | ||
117 | #define CLK_SOURCE_XUSB_DEV_SRC 0x60c | ||
118 | #define CLK_SOURCE_ISP 0x144 | ||
119 | #define CLK_SOURCE_SOR0 0x414 | ||
120 | #define CLK_SOURCE_DPAUX 0x418 | ||
121 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
122 | #define CLK_SOURCE_SATA 0x424 | ||
123 | #define CLK_SOURCE_ENTROPY 0x628 | ||
124 | #define CLK_SOURCE_VI_SENSOR2 0x658 | ||
125 | #define CLK_SOURCE_HDMI_AUDIO 0x668 | ||
126 | #define CLK_SOURCE_VIC03 0x678 | ||
127 | #define CLK_SOURCE_CLK72MHZ 0x66c | ||
128 | |||
129 | #define MASK(x) (BIT(x) - 1) | ||
130 | |||
131 | #define MUX(_name, _parents, _offset, \ | ||
132 | _clk_num, _gate_flags, _clk_id) \ | ||
133 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
134 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ | ||
135 | _clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\ | ||
136 | NULL) | ||
137 | |||
138 | #define MUX_FLAGS(_name, _parents, _offset,\ | ||
139 | _clk_num, _gate_flags, _clk_id, flags)\ | ||
140 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
141 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\ | ||
142 | _clk_num, _gate_flags, _clk_id, _parents##_idx, flags,\ | ||
143 | NULL) | ||
144 | |||
145 | #define MUX8(_name, _parents, _offset, \ | ||
146 | _clk_num, _gate_flags, _clk_id) \ | ||
147 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
148 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\ | ||
149 | _clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\ | ||
150 | NULL) | ||
151 | |||
152 | #define MUX8_NOGATE_LOCK(_name, _parents, _offset, _clk_id, _lock) \ | ||
153 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \ | ||
154 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\ | ||
155 | 0, TEGRA_PERIPH_NO_GATE, _clk_id,\ | ||
156 | _parents##_idx, 0, _lock) | ||
157 | |||
158 | #define INT(_name, _parents, _offset, \ | ||
159 | _clk_num, _gate_flags, _clk_id) \ | ||
160 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
161 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \ | ||
162 | TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\ | ||
163 | _clk_id, _parents##_idx, 0, NULL) | ||
164 | |||
165 | #define INT_FLAGS(_name, _parents, _offset,\ | ||
166 | _clk_num, _gate_flags, _clk_id, flags)\ | ||
167 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
168 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \ | ||
169 | TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\ | ||
170 | _clk_id, _parents##_idx, flags, NULL) | ||
171 | |||
172 | #define INT8(_name, _parents, _offset,\ | ||
173 | _clk_num, _gate_flags, _clk_id) \ | ||
174 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
175 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \ | ||
176 | TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\ | ||
177 | _clk_id, _parents##_idx, 0, NULL) | ||
178 | |||
179 | #define UART(_name, _parents, _offset,\ | ||
180 | _clk_num, _clk_id) \ | ||
181 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
182 | 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART| \ | ||
183 | TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\ | ||
184 | _parents##_idx, 0, NULL) | ||
185 | |||
186 | #define I2C(_name, _parents, _offset,\ | ||
187 | _clk_num, _clk_id) \ | ||
188 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
189 | 30, MASK(2), 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP,\ | ||
190 | _clk_num, 0, _clk_id, _parents##_idx, 0, NULL) | ||
191 | |||
192 | #define XUSB(_name, _parents, _offset, \ | ||
193 | _clk_num, _gate_flags, _clk_id) \ | ||
194 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \ | ||
195 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \ | ||
196 | TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\ | ||
197 | _clk_id, _parents##_idx, 0, NULL) | ||
198 | |||
199 | #define AUDIO(_name, _offset, _clk_num,\ | ||
200 | _gate_flags, _clk_id) \ | ||
201 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, mux_d_audio_clk, \ | ||
202 | _offset, 16, 0xE01F, 0, 0, 8, 1, \ | ||
203 | TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags, \ | ||
204 | _clk_id, mux_d_audio_clk_idx, 0, NULL) | ||
205 | |||
206 | #define NODIV(_name, _parents, _offset, \ | ||
207 | _mux_shift, _mux_mask, _clk_num, \ | ||
208 | _gate_flags, _clk_id, _lock) \ | ||
209 | TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\ | ||
210 | _mux_shift, _mux_mask, 0, 0, 0, 0, 0,\ | ||
211 | _clk_num, (_gate_flags) | TEGRA_PERIPH_NO_DIV,\ | ||
212 | _clk_id, _parents##_idx, 0, _lock) | ||
213 | |||
214 | #define GATE(_name, _parent_name, \ | ||
215 | _clk_num, _gate_flags, _clk_id, _flags) \ | ||
216 | { \ | ||
217 | .name = _name, \ | ||
218 | .clk_id = _clk_id, \ | ||
219 | .p.parent_name = _parent_name, \ | ||
220 | .periph = TEGRA_CLK_PERIPH(0, 0, 0, 0, 0, 0, 0, \ | ||
221 | _clk_num, _gate_flags, 0, NULL), \ | ||
222 | .flags = _flags \ | ||
223 | } | ||
224 | |||
225 | #define PLLP_BASE 0xa0 | ||
226 | #define PLLP_MISC 0xac | ||
227 | #define PLLP_OUTA 0xa4 | ||
228 | #define PLLP_OUTB 0xa8 | ||
229 | #define PLLP_OUTC 0x67c | ||
230 | |||
231 | #define PLL_BASE_LOCK BIT(27) | ||
232 | #define PLL_MISC_LOCK_ENABLE 18 | ||
233 | |||
234 | static DEFINE_SPINLOCK(PLLP_OUTA_lock); | ||
235 | static DEFINE_SPINLOCK(PLLP_OUTB_lock); | ||
236 | static DEFINE_SPINLOCK(PLLP_OUTC_lock); | ||
237 | static DEFINE_SPINLOCK(sor0_lock); | ||
238 | |||
239 | #define MUX_I2S_SPDIF(_id) \ | ||
240 | static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ | ||
241 | #_id, "pll_p",\ | ||
242 | "clk_m"}; | ||
243 | MUX_I2S_SPDIF(audio0) | ||
244 | MUX_I2S_SPDIF(audio1) | ||
245 | MUX_I2S_SPDIF(audio2) | ||
246 | MUX_I2S_SPDIF(audio3) | ||
247 | MUX_I2S_SPDIF(audio4) | ||
248 | MUX_I2S_SPDIF(audio) | ||
249 | |||
250 | #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL | ||
251 | #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL | ||
252 | #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL | ||
253 | #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL | ||
254 | #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL | ||
255 | #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL | ||
256 | |||
257 | static const char *mux_pllp_pllc_pllm_clkm[] = { | ||
258 | "pll_p", "pll_c", "pll_m", "clk_m" | ||
259 | }; | ||
260 | #define mux_pllp_pllc_pllm_clkm_idx NULL | ||
261 | |||
262 | static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; | ||
263 | #define mux_pllp_pllc_pllm_idx NULL | ||
264 | |||
265 | static const char *mux_pllp_pllc_clk32_clkm[] = { | ||
266 | "pll_p", "pll_c", "clk_32k", "clk_m" | ||
267 | }; | ||
268 | #define mux_pllp_pllc_clk32_clkm_idx NULL | ||
269 | |||
270 | static const char *mux_plla_pllc_pllp_clkm[] = { | ||
271 | "pll_a_out0", "pll_c", "pll_p", "clk_m" | ||
272 | }; | ||
273 | #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx | ||
274 | |||
275 | static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { | ||
276 | "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" | ||
277 | }; | ||
278 | static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { | ||
279 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
280 | }; | ||
281 | |||
282 | static const char *mux_pllp_clkm[] = { | ||
283 | "pll_p", "clk_m" | ||
284 | }; | ||
285 | static u32 mux_pllp_clkm_idx[] = { | ||
286 | [0] = 0, [1] = 3, | ||
287 | }; | ||
288 | |||
289 | static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { | ||
290 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" | ||
291 | }; | ||
292 | #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx | ||
293 | |||
294 | static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { | ||
295 | "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", | ||
296 | "pll_d2_out0", "clk_m" | ||
297 | }; | ||
298 | #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL | ||
299 | |||
300 | static const char *mux_pllm_pllc_pllp_plla[] = { | ||
301 | "pll_m", "pll_c", "pll_p", "pll_a_out0" | ||
302 | }; | ||
303 | #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx | ||
304 | |||
305 | static const char *mux_pllp_pllc_clkm[] = { | ||
306 | "pll_p", "pll_c", "pll_m" | ||
307 | }; | ||
308 | static u32 mux_pllp_pllc_clkm_idx[] = { | ||
309 | [0] = 0, [1] = 1, [2] = 3, | ||
310 | }; | ||
311 | |||
312 | static const char *mux_pllp_pllc_clkm_clk32[] = { | ||
313 | "pll_p", "pll_c", "clk_m", "clk_32k" | ||
314 | }; | ||
315 | #define mux_pllp_pllc_clkm_clk32_idx NULL | ||
316 | |||
317 | static const char *mux_plla_clk32_pllp_clkm_plle[] = { | ||
318 | "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" | ||
319 | }; | ||
320 | #define mux_plla_clk32_pllp_clkm_plle_idx NULL | ||
321 | |||
322 | static const char *mux_clkm_pllp_pllc_pllre[] = { | ||
323 | "clk_m", "pll_p", "pll_c", "pll_re_out" | ||
324 | }; | ||
325 | static u32 mux_clkm_pllp_pllc_pllre_idx[] = { | ||
326 | [0] = 0, [1] = 1, [2] = 3, [3] = 5, | ||
327 | }; | ||
328 | |||
329 | static const char *mux_clkm_48M_pllp_480M[] = { | ||
330 | "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" | ||
331 | }; | ||
332 | #define mux_clkm_48M_pllp_480M_idx NULL | ||
333 | |||
334 | static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { | ||
335 | "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" | ||
336 | }; | ||
337 | static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { | ||
338 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, | ||
339 | }; | ||
340 | |||
341 | static const char *mux_d_audio_clk[] = { | ||
342 | "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", | ||
343 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
344 | }; | ||
345 | static u32 mux_d_audio_clk_idx[] = { | ||
346 | [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, | ||
347 | [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, | ||
348 | }; | ||
349 | |||
350 | static const char *mux_pllp_plld_pllc_clkm[] = { | ||
351 | "pll_p", "pll_d_out0", "pll_c", "clk_m" | ||
352 | }; | ||
353 | #define mux_pllp_plld_pllc_clkm_idx NULL | ||
354 | static const char *mux_pllm_pllc_pllp_plla_clkm_pllc4[] = { | ||
355 | "pll_m", "pll_c", "pll_p", "pll_a_out0", "clk_m", "pll_c4", | ||
356 | }; | ||
357 | static u32 mux_pllm_pllc_pllp_plla_clkm_pllc4_idx[] = { | ||
358 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 6, [5] = 7, | ||
359 | }; | ||
360 | |||
361 | static const char *mux_pllp_clkm1[] = { | ||
362 | "pll_p", "clk_m", | ||
363 | }; | ||
364 | #define mux_pllp_clkm1_idx NULL | ||
365 | |||
366 | static const char *mux_pllp3_pllc_clkm[] = { | ||
367 | "pll_p_out3", "pll_c", "pll_c2", "clk_m", | ||
368 | }; | ||
369 | #define mux_pllp3_pllc_clkm_idx NULL | ||
370 | |||
371 | static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { | ||
372 | "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m" | ||
373 | }; | ||
374 | static u32 mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx[] = { | ||
375 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
376 | }; | ||
377 | |||
378 | static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = { | ||
379 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4", | ||
380 | }; | ||
381 | static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = { | ||
382 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, [6] = 7, | ||
383 | }; | ||
384 | |||
385 | static const char *mux_clkm_plldp_sor0lvds[] = { | ||
386 | "clk_m", "pll_dp", "sor0_lvds", | ||
387 | }; | ||
388 | #define mux_clkm_plldp_sor0lvds_idx NULL | ||
389 | |||
390 | static struct tegra_periph_init_data periph_clks[] = { | ||
391 | AUDIO("d_audio", CLK_SOURCE_D_AUDIO, 106, TEGRA_PERIPH_ON_APB, tegra_clk_d_audio), | ||
392 | AUDIO("dam0", CLK_SOURCE_DAM0, 108, TEGRA_PERIPH_ON_APB, tegra_clk_dam0), | ||
393 | AUDIO("dam1", CLK_SOURCE_DAM1, 109, TEGRA_PERIPH_ON_APB, tegra_clk_dam1), | ||
394 | AUDIO("dam2", CLK_SOURCE_DAM2, 110, TEGRA_PERIPH_ON_APB, tegra_clk_dam2), | ||
395 | I2C("i2c1", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, tegra_clk_i2c1), | ||
396 | I2C("i2c2", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, tegra_clk_i2c2), | ||
397 | I2C("i2c3", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, tegra_clk_i2c3), | ||
398 | I2C("i2c4", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, tegra_clk_i2c4), | ||
399 | I2C("i2c5", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, tegra_clk_i2c5), | ||
400 | INT("vde", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde), | ||
401 | INT("vi", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi), | ||
402 | INT("epp", mux_pllm_pllc_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp), | ||
403 | INT("host1x", mux_pllm_pllc_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x), | ||
404 | INT("mpe", mux_pllm_pllc_pllp_plla, CLK_SOURCE_MPE, 60, 0, tegra_clk_mpe), | ||
405 | INT("2d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d), | ||
406 | INT("3d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d), | ||
407 | INT8("vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde_8), | ||
408 | INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_8), | ||
409 | INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_9), | ||
410 | INT8("epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp_8), | ||
411 | INT8("msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, TEGRA_PERIPH_WAR_1005168, tegra_clk_msenc), | ||
412 | INT8("tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec), | ||
413 | INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8), | ||
414 | INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se), | ||
415 | INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8), | ||
416 | INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8), | ||
417 | INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03), | ||
418 | INT_FLAGS("mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, 0, tegra_clk_mselect, CLK_IGNORE_UNUSED), | ||
419 | MUX("i2s0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, TEGRA_PERIPH_ON_APB, tegra_clk_i2s0), | ||
420 | MUX("i2s1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, tegra_clk_i2s1), | ||
421 | MUX("i2s2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, TEGRA_PERIPH_ON_APB, tegra_clk_i2s2), | ||
422 | MUX("i2s3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, TEGRA_PERIPH_ON_APB, tegra_clk_i2s3), | ||
423 | MUX("i2s4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, TEGRA_PERIPH_ON_APB, tegra_clk_i2s4), | ||
424 | MUX("spdif_out", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_out), | ||
425 | MUX("spdif_in", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in), | ||
426 | MUX("pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, TEGRA_PERIPH_ON_APB, tegra_clk_pwm), | ||
427 | MUX("adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, TEGRA_PERIPH_ON_APB, tegra_clk_adx), | ||
428 | MUX("amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, TEGRA_PERIPH_ON_APB, tegra_clk_amx), | ||
429 | MUX("hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda), | ||
430 | MUX("hda2codec_2x", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x), | ||
431 | MUX("vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, tegra_clk_vfir), | ||
432 | MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1), | ||
433 | MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2), | ||
434 | MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3), | ||
435 | MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4), | ||
436 | MUX("la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, tegra_clk_la), | ||
437 | MUX("trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, tegra_clk_trace), | ||
438 | MUX("owr", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr), | ||
439 | MUX("nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, 0, tegra_clk_nor), | ||
440 | MUX("mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, TEGRA_PERIPH_ON_APB, tegra_clk_mipi), | ||
441 | MUX("vi_sensor", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor), | ||
442 | MUX("cilab", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, 0, tegra_clk_cilab), | ||
443 | MUX("cilcd", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, 0, tegra_clk_cilcd), | ||
444 | MUX("cile", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, 0, tegra_clk_cile), | ||
445 | MUX("dsialp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, 0, tegra_clk_dsialp), | ||
446 | MUX("dsiblp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, 0, tegra_clk_dsiblp), | ||
447 | MUX("tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, TEGRA_PERIPH_ON_APB, tegra_clk_tsensor), | ||
448 | MUX("actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, 0, tegra_clk_actmon), | ||
449 | MUX("dfll_ref", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_ref), | ||
450 | MUX("dfll_soc", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_soc), | ||
451 | MUX("i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, TEGRA_PERIPH_ON_APB, tegra_clk_i2cslow), | ||
452 | MUX("sbc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1), | ||
453 | MUX("sbc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2), | ||
454 | MUX("sbc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3), | ||
455 | MUX("sbc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4), | ||
456 | MUX("sbc5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5), | ||
457 | MUX("sbc6", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6), | ||
458 | MUX("cve", mux_pllp_plld_pllc_clkm, CLK_SOURCE_CVE, 49, 0, tegra_clk_cve), | ||
459 | MUX("tvo", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVO, 49, 0, tegra_clk_tvo), | ||
460 | MUX("tvdac", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVDAC, 53, 0, tegra_clk_tvdac), | ||
461 | MUX("ndflash", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash), | ||
462 | MUX("ndspeed", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed), | ||
463 | MUX("sata_oob", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob), | ||
464 | MUX("sata", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata), | ||
465 | MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), | ||
466 | MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), | ||
467 | MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), | ||
468 | MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), | ||
469 | MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), | ||
470 | MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), | ||
471 | MUX8("sbc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_8), | ||
472 | MUX8("sbc5", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5_8), | ||
473 | MUX8("sbc6", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6_8), | ||
474 | MUX8("ndflash", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash_8), | ||
475 | MUX8("ndspeed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed_8), | ||
476 | MUX8("hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, 0, tegra_clk_hdmi), | ||
477 | MUX8("extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, 0, tegra_clk_extern1), | ||
478 | MUX8("extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, tegra_clk_extern2), | ||
479 | MUX8("extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, tegra_clk_extern3), | ||
480 | MUX8("soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm), | ||
481 | MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8), | ||
482 | MUX8("isp", mux_pllm_pllc_pllp_plla_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_8), | ||
483 | MUX8("entropy", mux_pllp_clkm1, CLK_SOURCE_ENTROPY, 149, 0, tegra_clk_entropy), | ||
484 | MUX8("hdmi_audio", mux_pllp3_pllc_clkm, CLK_SOURCE_HDMI_AUDIO, 176, TEGRA_PERIPH_NO_RESET, tegra_clk_hdmi_audio), | ||
485 | MUX8("clk72mhz", mux_pllp3_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz), | ||
486 | MUX8_NOGATE_LOCK("sor0_lvds", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_SOR0, tegra_clk_sor0_lvds, &sor0_lock), | ||
487 | MUX_FLAGS("csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite, CLK_IGNORE_UNUSED), | ||
488 | NODIV("disp1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1, NULL), | ||
489 | NODIV("disp2", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2, NULL), | ||
490 | NODIV("sor0", mux_clkm_plldp_sor0lvds, CLK_SOURCE_SOR0, 14, 3, 182, 0, tegra_clk_sor0, &sor0_lock), | ||
491 | UART("uarta", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, tegra_clk_uarta), | ||
492 | UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), | ||
493 | UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), | ||
494 | UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), | ||
495 | UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 65, tegra_clk_uarte), | ||
496 | XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), | ||
497 | XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), | ||
498 | XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), | ||
499 | XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src), | ||
500 | XUSB("xusb_dev_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src), | ||
501 | }; | ||
502 | |||
503 | static struct tegra_periph_init_data gate_clks[] = { | ||
504 | GATE("rtc", "clk_32k", 4, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_rtc, 0), | ||
505 | GATE("timer", "clk_m", 5, 0, tegra_clk_timer, 0), | ||
506 | GATE("isp", "clk_m", 23, 0, tegra_clk_isp, 0), | ||
507 | GATE("vcp", "clk_m", 29, 0, tegra_clk_vcp, 0), | ||
508 | GATE("apbdma", "clk_m", 34, 0, tegra_clk_apbdma, 0), | ||
509 | GATE("kbc", "clk_32k", 36, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_kbc, 0), | ||
510 | GATE("fuse", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse, 0), | ||
511 | GATE("fuse_burn", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse_burn, 0), | ||
512 | GATE("kfuse", "clk_m", 40, TEGRA_PERIPH_ON_APB, tegra_clk_kfuse, 0), | ||
513 | GATE("apbif", "clk_m", 107, TEGRA_PERIPH_ON_APB, tegra_clk_apbif, 0), | ||
514 | GATE("hda2hdmi", "clk_m", 128, TEGRA_PERIPH_ON_APB, tegra_clk_hda2hdmi, 0), | ||
515 | GATE("bsea", "clk_m", 62, 0, tegra_clk_bsea, 0), | ||
516 | GATE("bsev", "clk_m", 63, 0, tegra_clk_bsev, 0), | ||
517 | GATE("mipi-cal", "clk_m", 56, 0, tegra_clk_mipi_cal, 0), | ||
518 | GATE("usbd", "clk_m", 22, 0, tegra_clk_usbd, 0), | ||
519 | GATE("usb2", "clk_m", 58, 0, tegra_clk_usb2, 0), | ||
520 | GATE("usb3", "clk_m", 59, 0, tegra_clk_usb3, 0), | ||
521 | GATE("csi", "pll_p_out3", 52, 0, tegra_clk_csi, 0), | ||
522 | GATE("afi", "clk_m", 72, 0, tegra_clk_afi, 0), | ||
523 | GATE("csus", "clk_m", 92, TEGRA_PERIPH_NO_RESET, tegra_clk_csus, 0), | ||
524 | GATE("dds", "clk_m", 150, TEGRA_PERIPH_ON_APB, tegra_clk_dds, 0), | ||
525 | GATE("dp2", "clk_m", 152, TEGRA_PERIPH_ON_APB, tegra_clk_dp2, 0), | ||
526 | GATE("dtv", "clk_m", 79, TEGRA_PERIPH_ON_APB, tegra_clk_dtv, 0), | ||
527 | GATE("xusb_host", "xusb_host_src", 89, 0, tegra_clk_xusb_host, 0), | ||
528 | GATE("xusb_ss", "xusb_ss_src", 156, 0, tegra_clk_xusb_ss, 0), | ||
529 | GATE("xusb_dev", "xusb_dev_src", 95, 0, tegra_clk_xusb_dev, 0), | ||
530 | GATE("dsia", "dsia_mux", 48, 0, tegra_clk_dsia, 0), | ||
531 | GATE("dsib", "dsib_mux", 82, 0, tegra_clk_dsib, 0), | ||
532 | GATE("emc", "emc_mux", 57, 0, tegra_clk_emc, CLK_IGNORE_UNUSED), | ||
533 | GATE("sata_cold", "clk_m", 129, TEGRA_PERIPH_ON_APB, tegra_clk_sata_cold, 0), | ||
534 | GATE("ispb", "clk_m", 3, 0, tegra_clk_ispb, 0), | ||
535 | GATE("vim2_clk", "clk_m", 11, 0, tegra_clk_vim2_clk, 0), | ||
536 | GATE("pcie", "clk_m", 70, 0, tegra_clk_pcie, 0), | ||
537 | GATE("dpaux", "clk_m", 181, 0, tegra_clk_dpaux, 0), | ||
538 | GATE("gpu", "pll_ref", 184, 0, tegra_clk_gpu, 0), | ||
539 | }; | ||
540 | |||
541 | struct pll_out_data { | ||
542 | char *div_name; | ||
543 | char *pll_out_name; | ||
544 | u32 offset; | ||
545 | int clk_id; | ||
546 | u8 div_shift; | ||
547 | u8 div_flags; | ||
548 | u8 rst_shift; | ||
549 | spinlock_t *lock; | ||
550 | }; | ||
551 | |||
552 | #define PLL_OUT(_num, _offset, _div_shift, _div_flags, _rst_shift, _id) \ | ||
553 | {\ | ||
554 | .div_name = "pll_p_out" #_num "_div",\ | ||
555 | .pll_out_name = "pll_p_out" #_num,\ | ||
556 | .offset = _offset,\ | ||
557 | .div_shift = _div_shift,\ | ||
558 | .div_flags = _div_flags | TEGRA_DIVIDER_FIXED |\ | ||
559 | TEGRA_DIVIDER_ROUND_UP,\ | ||
560 | .rst_shift = _rst_shift,\ | ||
561 | .clk_id = tegra_clk_ ## _id,\ | ||
562 | .lock = &_offset ##_lock,\ | ||
563 | } | ||
564 | |||
565 | static struct pll_out_data pllp_out_clks[] = { | ||
566 | PLL_OUT(1, PLLP_OUTA, 8, 0, 0, pll_p_out1), | ||
567 | PLL_OUT(2, PLLP_OUTA, 24, 0, 16, pll_p_out2), | ||
568 | PLL_OUT(2, PLLP_OUTA, 24, TEGRA_DIVIDER_INT, 16, pll_p_out2_int), | ||
569 | PLL_OUT(3, PLLP_OUTB, 8, 0, 0, pll_p_out3), | ||
570 | PLL_OUT(4, PLLP_OUTB, 24, 0, 16, pll_p_out4), | ||
571 | PLL_OUT(5, PLLP_OUTC, 24, 0, 16, pll_p_out5), | ||
572 | }; | ||
573 | |||
574 | static void __init periph_clk_init(void __iomem *clk_base, | ||
575 | struct tegra_clk *tegra_clks) | ||
576 | { | ||
577 | int i; | ||
578 | struct clk *clk; | ||
579 | struct clk **dt_clk; | ||
580 | |||
581 | for (i = 0; i < ARRAY_SIZE(periph_clks); i++) { | ||
582 | struct tegra_clk_periph_regs *bank; | ||
583 | struct tegra_periph_init_data *data; | ||
584 | |||
585 | data = periph_clks + i; | ||
586 | |||
587 | dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks); | ||
588 | if (!dt_clk) | ||
589 | continue; | ||
590 | |||
591 | bank = get_reg_bank(data->periph.gate.clk_num); | ||
592 | if (!bank) | ||
593 | continue; | ||
594 | |||
595 | data->periph.gate.regs = bank; | ||
596 | clk = tegra_clk_register_periph(data->name, | ||
597 | data->p.parent_names, data->num_parents, | ||
598 | &data->periph, clk_base, data->offset, | ||
599 | data->flags); | ||
600 | *dt_clk = clk; | ||
601 | } | ||
602 | } | ||
603 | |||
604 | static void __init gate_clk_init(void __iomem *clk_base, | ||
605 | struct tegra_clk *tegra_clks) | ||
606 | { | ||
607 | int i; | ||
608 | struct clk *clk; | ||
609 | struct clk **dt_clk; | ||
610 | |||
611 | for (i = 0; i < ARRAY_SIZE(gate_clks); i++) { | ||
612 | struct tegra_periph_init_data *data; | ||
613 | |||
614 | data = gate_clks + i; | ||
615 | |||
616 | dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks); | ||
617 | if (!dt_clk) | ||
618 | continue; | ||
619 | |||
620 | clk = tegra_clk_register_periph_gate(data->name, | ||
621 | data->p.parent_name, data->periph.gate.flags, | ||
622 | clk_base, data->flags, | ||
623 | data->periph.gate.clk_num, | ||
624 | periph_clk_enb_refcnt); | ||
625 | *dt_clk = clk; | ||
626 | } | ||
627 | } | ||
628 | |||
629 | static void __init init_pllp(void __iomem *clk_base, void __iomem *pmc_base, | ||
630 | struct tegra_clk *tegra_clks, | ||
631 | struct tegra_clk_pll_params *pll_params) | ||
632 | { | ||
633 | struct clk *clk; | ||
634 | struct clk **dt_clk; | ||
635 | int i; | ||
636 | |||
637 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p, tegra_clks); | ||
638 | if (dt_clk) { | ||
639 | /* PLLP */ | ||
640 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, | ||
641 | pmc_base, 0, pll_params, NULL); | ||
642 | clk_register_clkdev(clk, "pll_p", NULL); | ||
643 | *dt_clk = clk; | ||
644 | } | ||
645 | |||
646 | for (i = 0; i < ARRAY_SIZE(pllp_out_clks); i++) { | ||
647 | struct pll_out_data *data; | ||
648 | |||
649 | data = pllp_out_clks + i; | ||
650 | |||
651 | dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks); | ||
652 | if (!dt_clk) | ||
653 | continue; | ||
654 | |||
655 | clk = tegra_clk_register_divider(data->div_name, "pll_p", | ||
656 | clk_base + data->offset, 0, data->div_flags, | ||
657 | data->div_shift, 8, 1, data->lock); | ||
658 | clk = tegra_clk_register_pll_out(data->pll_out_name, | ||
659 | data->div_name, clk_base + data->offset, | ||
660 | data->rst_shift + 1, data->rst_shift, | ||
661 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
662 | data->lock); | ||
663 | *dt_clk = clk; | ||
664 | } | ||
665 | } | ||
666 | |||
667 | void __init tegra_periph_clk_init(void __iomem *clk_base, | ||
668 | void __iomem *pmc_base, struct tegra_clk *tegra_clks, | ||
669 | struct tegra_clk_pll_params *pll_params) | ||
670 | { | ||
671 | init_pllp(clk_base, pmc_base, tegra_clks, pll_params); | ||
672 | periph_clk_init(clk_base, tegra_clks); | ||
673 | gate_clk_init(clk_base, tegra_clks); | ||
674 | } | ||
diff --git a/drivers/clk/tegra/clk-tegra-pmc.c b/drivers/clk/tegra/clk-tegra-pmc.c new file mode 100644 index 000000000000..08b21c1ee867 --- /dev/null +++ b/drivers/clk/tegra/clk-tegra-pmc.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/clkdev.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_address.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/export.h> | ||
25 | #include <linux/clk/tegra.h> | ||
26 | |||
27 | #include "clk.h" | ||
28 | #include "clk-id.h" | ||
29 | |||
30 | #define PMC_CLK_OUT_CNTRL 0x1a8 | ||
31 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
32 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
33 | #define PMC_CTRL 0 | ||
34 | #define PMC_CTRL_BLINK_ENB 7 | ||
35 | #define PMC_BLINK_TIMER 0x40 | ||
36 | |||
37 | struct pmc_clk_init_data { | ||
38 | char *mux_name; | ||
39 | char *gate_name; | ||
40 | const char **parents; | ||
41 | int num_parents; | ||
42 | int mux_id; | ||
43 | int gate_id; | ||
44 | char *dev_name; | ||
45 | u8 mux_shift; | ||
46 | u8 gate_shift; | ||
47 | }; | ||
48 | |||
49 | #define PMC_CLK(_num, _mux_shift, _gate_shift)\ | ||
50 | {\ | ||
51 | .mux_name = "clk_out_" #_num "_mux",\ | ||
52 | .gate_name = "clk_out_" #_num,\ | ||
53 | .parents = clk_out ##_num ##_parents,\ | ||
54 | .num_parents = ARRAY_SIZE(clk_out ##_num ##_parents),\ | ||
55 | .mux_id = tegra_clk_clk_out_ ##_num ##_mux,\ | ||
56 | .gate_id = tegra_clk_clk_out_ ##_num,\ | ||
57 | .dev_name = "extern" #_num,\ | ||
58 | .mux_shift = _mux_shift,\ | ||
59 | .gate_shift = _gate_shift,\ | ||
60 | } | ||
61 | |||
62 | static DEFINE_SPINLOCK(clk_out_lock); | ||
63 | |||
64 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", | ||
65 | "clk_m_div4", "extern1", | ||
66 | }; | ||
67 | |||
68 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", | ||
69 | "clk_m_div4", "extern2", | ||
70 | }; | ||
71 | |||
72 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", | ||
73 | "clk_m_div4", "extern3", | ||
74 | }; | ||
75 | |||
76 | static struct pmc_clk_init_data pmc_clks[] = { | ||
77 | PMC_CLK(1, 6, 2), | ||
78 | PMC_CLK(2, 14, 10), | ||
79 | PMC_CLK(3, 22, 18), | ||
80 | }; | ||
81 | |||
82 | void __init tegra_pmc_clk_init(void __iomem *pmc_base, | ||
83 | struct tegra_clk *tegra_clks) | ||
84 | { | ||
85 | struct clk *clk; | ||
86 | struct clk **dt_clk; | ||
87 | int i; | ||
88 | |||
89 | for (i = 0; i < ARRAY_SIZE(pmc_clks); i++) { | ||
90 | struct pmc_clk_init_data *data; | ||
91 | |||
92 | data = pmc_clks + i; | ||
93 | |||
94 | dt_clk = tegra_lookup_dt_id(data->mux_id, tegra_clks); | ||
95 | if (!dt_clk) | ||
96 | continue; | ||
97 | |||
98 | clk = clk_register_mux(NULL, data->mux_name, data->parents, | ||
99 | data->num_parents, CLK_SET_RATE_NO_REPARENT, | ||
100 | pmc_base + PMC_CLK_OUT_CNTRL, data->mux_shift, | ||
101 | 3, 0, &clk_out_lock); | ||
102 | *dt_clk = clk; | ||
103 | |||
104 | |||
105 | dt_clk = tegra_lookup_dt_id(data->gate_id, tegra_clks); | ||
106 | if (!dt_clk) | ||
107 | continue; | ||
108 | |||
109 | clk = clk_register_gate(NULL, data->gate_name, data->mux_name, | ||
110 | 0, pmc_base + PMC_CLK_OUT_CNTRL, | ||
111 | data->gate_shift, 0, &clk_out_lock); | ||
112 | *dt_clk = clk; | ||
113 | clk_register_clkdev(clk, data->dev_name, data->gate_name); | ||
114 | } | ||
115 | |||
116 | /* blink */ | ||
117 | writel_relaxed(0, pmc_base + PMC_BLINK_TIMER); | ||
118 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
119 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
120 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
121 | |||
122 | dt_clk = tegra_lookup_dt_id(tegra_clk_blink, tegra_clks); | ||
123 | if (!dt_clk) | ||
124 | return; | ||
125 | |||
126 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
127 | pmc_base + PMC_CTRL, | ||
128 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
129 | clk_register_clkdev(clk, "blink", NULL); | ||
130 | *dt_clk = clk; | ||
131 | } | ||
132 | |||
diff --git a/drivers/clk/tegra/clk-tegra-super-gen4.c b/drivers/clk/tegra/clk-tegra-super-gen4.c new file mode 100644 index 000000000000..05dce4aa2c11 --- /dev/null +++ b/drivers/clk/tegra/clk-tegra-super-gen4.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/export.h> | ||
24 | #include <linux/clk/tegra.h> | ||
25 | |||
26 | #include "clk.h" | ||
27 | #include "clk-id.h" | ||
28 | |||
29 | #define PLLX_BASE 0xe0 | ||
30 | #define PLLX_MISC 0xe4 | ||
31 | #define PLLX_MISC2 0x514 | ||
32 | #define PLLX_MISC3 0x518 | ||
33 | |||
34 | #define CCLKG_BURST_POLICY 0x368 | ||
35 | #define CCLKLP_BURST_POLICY 0x370 | ||
36 | #define SCLK_BURST_POLICY 0x028 | ||
37 | #define SYSTEM_CLK_RATE 0x030 | ||
38 | |||
39 | static DEFINE_SPINLOCK(sysrate_lock); | ||
40 | |||
41 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", | ||
42 | "pll_p", "pll_p_out2", "unused", | ||
43 | "clk_32k", "pll_m_out1" }; | ||
44 | |||
45 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
46 | "pll_p", "pll_p_out4", "unused", | ||
47 | "unused", "pll_x" }; | ||
48 | |||
49 | static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
50 | "pll_p", "pll_p_out4", "unused", | ||
51 | "unused", "pll_x", "pll_x_out0" }; | ||
52 | |||
53 | static void __init tegra_sclk_init(void __iomem *clk_base, | ||
54 | struct tegra_clk *tegra_clks) | ||
55 | { | ||
56 | struct clk *clk; | ||
57 | struct clk **dt_clk; | ||
58 | |||
59 | /* SCLK */ | ||
60 | dt_clk = tegra_lookup_dt_id(tegra_clk_sclk, tegra_clks); | ||
61 | if (dt_clk) { | ||
62 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | ||
63 | ARRAY_SIZE(sclk_parents), | ||
64 | CLK_SET_RATE_PARENT, | ||
65 | clk_base + SCLK_BURST_POLICY, | ||
66 | 0, 4, 0, 0, NULL); | ||
67 | *dt_clk = clk; | ||
68 | } | ||
69 | |||
70 | /* HCLK */ | ||
71 | dt_clk = tegra_lookup_dt_id(tegra_clk_hclk, tegra_clks); | ||
72 | if (dt_clk) { | ||
73 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
74 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, | ||
75 | &sysrate_lock); | ||
76 | clk = clk_register_gate(NULL, "hclk", "hclk_div", | ||
77 | CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, | ||
78 | clk_base + SYSTEM_CLK_RATE, | ||
79 | 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
80 | *dt_clk = clk; | ||
81 | } | ||
82 | |||
83 | /* PCLK */ | ||
84 | dt_clk = tegra_lookup_dt_id(tegra_clk_pclk, tegra_clks); | ||
85 | if (!dt_clk) | ||
86 | return; | ||
87 | |||
88 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
89 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, | ||
90 | &sysrate_lock); | ||
91 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | | ||
92 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
93 | 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
94 | *dt_clk = clk; | ||
95 | } | ||
96 | |||
97 | void __init tegra_super_clk_gen4_init(void __iomem *clk_base, | ||
98 | void __iomem *pmc_base, | ||
99 | struct tegra_clk *tegra_clks, | ||
100 | struct tegra_clk_pll_params *params) | ||
101 | { | ||
102 | struct clk *clk; | ||
103 | struct clk **dt_clk; | ||
104 | |||
105 | /* CCLKG */ | ||
106 | dt_clk = tegra_lookup_dt_id(tegra_clk_cclk_g, tegra_clks); | ||
107 | if (dt_clk) { | ||
108 | clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, | ||
109 | ARRAY_SIZE(cclk_g_parents), | ||
110 | CLK_SET_RATE_PARENT, | ||
111 | clk_base + CCLKG_BURST_POLICY, | ||
112 | 0, 4, 0, 0, NULL); | ||
113 | *dt_clk = clk; | ||
114 | } | ||
115 | |||
116 | /* CCLKLP */ | ||
117 | dt_clk = tegra_lookup_dt_id(tegra_clk_cclk_lp, tegra_clks); | ||
118 | if (dt_clk) { | ||
119 | clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, | ||
120 | ARRAY_SIZE(cclk_lp_parents), | ||
121 | CLK_SET_RATE_PARENT, | ||
122 | clk_base + CCLKLP_BURST_POLICY, | ||
123 | 0, 4, 8, 9, NULL); | ||
124 | *dt_clk = clk; | ||
125 | } | ||
126 | |||
127 | tegra_sclk_init(clk_base, tegra_clks); | ||
128 | |||
129 | #if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC) | ||
130 | /* PLLX */ | ||
131 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_x, tegra_clks); | ||
132 | if (!dt_clk) | ||
133 | return; | ||
134 | |||
135 | clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, | ||
136 | pmc_base, CLK_IGNORE_UNUSED, params, NULL); | ||
137 | *dt_clk = clk; | ||
138 | |||
139 | /* PLLX_OUT0 */ | ||
140 | |||
141 | dt_clk = tegra_lookup_dt_id(tegra_clk_pll_x_out0, tegra_clks); | ||
142 | if (!dt_clk) | ||
143 | return; | ||
144 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", | ||
145 | CLK_SET_RATE_PARENT, 1, 2); | ||
146 | *dt_clk = clk; | ||
147 | #endif | ||
148 | } | ||
149 | |||
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index 9467da7dee49..90d9d25f2228 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c | |||
@@ -23,30 +23,15 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/export.h> | 24 | #include <linux/export.h> |
25 | #include <linux/clk/tegra.h> | 25 | #include <linux/clk/tegra.h> |
26 | #include <dt-bindings/clock/tegra114-car.h> | ||
26 | 27 | ||
27 | #include "clk.h" | 28 | #include "clk.h" |
29 | #include "clk-id.h" | ||
28 | 30 | ||
29 | #define RST_DEVICES_L 0x004 | ||
30 | #define RST_DEVICES_H 0x008 | ||
31 | #define RST_DEVICES_U 0x00C | ||
32 | #define RST_DFLL_DVCO 0x2F4 | 31 | #define RST_DFLL_DVCO 0x2F4 |
33 | #define RST_DEVICES_V 0x358 | ||
34 | #define RST_DEVICES_W 0x35C | ||
35 | #define RST_DEVICES_X 0x28C | ||
36 | #define RST_DEVICES_SET_L 0x300 | ||
37 | #define RST_DEVICES_CLR_L 0x304 | ||
38 | #define RST_DEVICES_SET_H 0x308 | ||
39 | #define RST_DEVICES_CLR_H 0x30c | ||
40 | #define RST_DEVICES_SET_U 0x310 | ||
41 | #define RST_DEVICES_CLR_U 0x314 | ||
42 | #define RST_DEVICES_SET_V 0x430 | ||
43 | #define RST_DEVICES_CLR_V 0x434 | ||
44 | #define RST_DEVICES_SET_W 0x438 | ||
45 | #define RST_DEVICES_CLR_W 0x43c | ||
46 | #define CPU_FINETRIM_SELECT 0x4d4 /* override default prop dlys */ | 32 | #define CPU_FINETRIM_SELECT 0x4d4 /* override default prop dlys */ |
47 | #define CPU_FINETRIM_DR 0x4d8 /* rise->rise prop dly A */ | 33 | #define CPU_FINETRIM_DR 0x4d8 /* rise->rise prop dly A */ |
48 | #define CPU_FINETRIM_R 0x4e4 /* rise->rise prop dly inc A */ | 34 | #define CPU_FINETRIM_R 0x4e4 /* rise->rise prop dly inc A */ |
49 | #define RST_DEVICES_NUM 5 | ||
50 | 35 | ||
51 | /* RST_DFLL_DVCO bitfields */ | 36 | /* RST_DFLL_DVCO bitfields */ |
52 | #define DVFS_DFLL_RESET_SHIFT 0 | 37 | #define DVFS_DFLL_RESET_SHIFT 0 |
@@ -73,25 +58,7 @@ | |||
73 | #define CPU_FINETRIM_R_FCPU_6_SHIFT 10 /* ftop */ | 58 | #define CPU_FINETRIM_R_FCPU_6_SHIFT 10 /* ftop */ |
74 | #define CPU_FINETRIM_R_FCPU_6_MASK (0x3 << CPU_FINETRIM_R_FCPU_6_SHIFT) | 59 | #define CPU_FINETRIM_R_FCPU_6_MASK (0x3 << CPU_FINETRIM_R_FCPU_6_SHIFT) |
75 | 60 | ||
76 | #define CLK_OUT_ENB_L 0x010 | 61 | #define TEGRA114_CLK_PERIPH_BANKS 5 |
77 | #define CLK_OUT_ENB_H 0x014 | ||
78 | #define CLK_OUT_ENB_U 0x018 | ||
79 | #define CLK_OUT_ENB_V 0x360 | ||
80 | #define CLK_OUT_ENB_W 0x364 | ||
81 | #define CLK_OUT_ENB_X 0x280 | ||
82 | #define CLK_OUT_ENB_SET_L 0x320 | ||
83 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
84 | #define CLK_OUT_ENB_SET_H 0x328 | ||
85 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
86 | #define CLK_OUT_ENB_SET_U 0x330 | ||
87 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
88 | #define CLK_OUT_ENB_SET_V 0x440 | ||
89 | #define CLK_OUT_ENB_CLR_V 0x444 | ||
90 | #define CLK_OUT_ENB_SET_W 0x448 | ||
91 | #define CLK_OUT_ENB_CLR_W 0x44c | ||
92 | #define CLK_OUT_ENB_SET_X 0x284 | ||
93 | #define CLK_OUT_ENB_CLR_X 0x288 | ||
94 | #define CLK_OUT_ENB_NUM 6 | ||
95 | 62 | ||
96 | #define PLLC_BASE 0x80 | 63 | #define PLLC_BASE 0x80 |
97 | #define PLLC_MISC2 0x88 | 64 | #define PLLC_MISC2 0x88 |
@@ -139,25 +106,6 @@ | |||
139 | #define PLLE_AUX 0x48c | 106 | #define PLLE_AUX 0x48c |
140 | #define PLLC_OUT 0x84 | 107 | #define PLLC_OUT 0x84 |
141 | #define PLLM_OUT 0x94 | 108 | #define PLLM_OUT 0x94 |
142 | #define PLLP_OUTA 0xa4 | ||
143 | #define PLLP_OUTB 0xa8 | ||
144 | #define PLLA_OUT 0xb4 | ||
145 | |||
146 | #define AUDIO_SYNC_CLK_I2S0 0x4a0 | ||
147 | #define AUDIO_SYNC_CLK_I2S1 0x4a4 | ||
148 | #define AUDIO_SYNC_CLK_I2S2 0x4a8 | ||
149 | #define AUDIO_SYNC_CLK_I2S3 0x4ac | ||
150 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 | ||
151 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 | ||
152 | |||
153 | #define AUDIO_SYNC_DOUBLER 0x49c | ||
154 | |||
155 | #define PMC_CLK_OUT_CNTRL 0x1a8 | ||
156 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
157 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
158 | #define PMC_CTRL 0 | ||
159 | #define PMC_CTRL_BLINK_ENB 7 | ||
160 | #define PMC_BLINK_TIMER 0x40 | ||
161 | 109 | ||
162 | #define OSC_CTRL 0x50 | 110 | #define OSC_CTRL 0x50 |
163 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 | 111 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 |
@@ -166,9 +114,6 @@ | |||
166 | #define PLLXC_SW_MAX_P 6 | 114 | #define PLLXC_SW_MAX_P 6 |
167 | 115 | ||
168 | #define CCLKG_BURST_POLICY 0x368 | 116 | #define CCLKG_BURST_POLICY 0x368 |
169 | #define CCLKLP_BURST_POLICY 0x370 | ||
170 | #define SCLK_BURST_POLICY 0x028 | ||
171 | #define SYSTEM_CLK_RATE 0x030 | ||
172 | 117 | ||
173 | #define UTMIP_PLL_CFG2 0x488 | 118 | #define UTMIP_PLL_CFG2 0x488 |
174 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) | 119 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) |
@@ -196,91 +141,8 @@ | |||
196 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) | 141 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) |
197 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) | 142 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) |
198 | 143 | ||
199 | #define CLK_SOURCE_I2S0 0x1d8 | ||
200 | #define CLK_SOURCE_I2S1 0x100 | ||
201 | #define CLK_SOURCE_I2S2 0x104 | ||
202 | #define CLK_SOURCE_NDFLASH 0x160 | ||
203 | #define CLK_SOURCE_I2S3 0x3bc | ||
204 | #define CLK_SOURCE_I2S4 0x3c0 | ||
205 | #define CLK_SOURCE_SPDIF_OUT 0x108 | ||
206 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
207 | #define CLK_SOURCE_PWM 0x110 | ||
208 | #define CLK_SOURCE_ADX 0x638 | ||
209 | #define CLK_SOURCE_AMX 0x63c | ||
210 | #define CLK_SOURCE_HDA 0x428 | ||
211 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 | ||
212 | #define CLK_SOURCE_SBC1 0x134 | ||
213 | #define CLK_SOURCE_SBC2 0x118 | ||
214 | #define CLK_SOURCE_SBC3 0x11c | ||
215 | #define CLK_SOURCE_SBC4 0x1b4 | ||
216 | #define CLK_SOURCE_SBC5 0x3c8 | ||
217 | #define CLK_SOURCE_SBC6 0x3cc | ||
218 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
219 | #define CLK_SOURCE_SATA 0x424 | ||
220 | #define CLK_SOURCE_NDSPEED 0x3f8 | ||
221 | #define CLK_SOURCE_VFIR 0x168 | ||
222 | #define CLK_SOURCE_SDMMC1 0x150 | ||
223 | #define CLK_SOURCE_SDMMC2 0x154 | ||
224 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
225 | #define CLK_SOURCE_SDMMC4 0x164 | ||
226 | #define CLK_SOURCE_VDE 0x1c8 | ||
227 | #define CLK_SOURCE_CSITE 0x1d4 | 144 | #define CLK_SOURCE_CSITE 0x1d4 |
228 | #define CLK_SOURCE_LA 0x1f8 | ||
229 | #define CLK_SOURCE_TRACE 0x634 | ||
230 | #define CLK_SOURCE_OWR 0x1cc | ||
231 | #define CLK_SOURCE_NOR 0x1d0 | ||
232 | #define CLK_SOURCE_MIPI 0x174 | ||
233 | #define CLK_SOURCE_I2C1 0x124 | ||
234 | #define CLK_SOURCE_I2C2 0x198 | ||
235 | #define CLK_SOURCE_I2C3 0x1b8 | ||
236 | #define CLK_SOURCE_I2C4 0x3c4 | ||
237 | #define CLK_SOURCE_I2C5 0x128 | ||
238 | #define CLK_SOURCE_UARTA 0x178 | ||
239 | #define CLK_SOURCE_UARTB 0x17c | ||
240 | #define CLK_SOURCE_UARTC 0x1a0 | ||
241 | #define CLK_SOURCE_UARTD 0x1c0 | ||
242 | #define CLK_SOURCE_UARTE 0x1c4 | ||
243 | #define CLK_SOURCE_UARTA_DBG 0x178 | ||
244 | #define CLK_SOURCE_UARTB_DBG 0x17c | ||
245 | #define CLK_SOURCE_UARTC_DBG 0x1a0 | ||
246 | #define CLK_SOURCE_UARTD_DBG 0x1c0 | ||
247 | #define CLK_SOURCE_UARTE_DBG 0x1c4 | ||
248 | #define CLK_SOURCE_3D 0x158 | ||
249 | #define CLK_SOURCE_2D 0x15c | ||
250 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
251 | #define CLK_SOURCE_VI 0x148 | ||
252 | #define CLK_SOURCE_EPP 0x16c | ||
253 | #define CLK_SOURCE_MSENC 0x1f0 | ||
254 | #define CLK_SOURCE_TSEC 0x1f4 | ||
255 | #define CLK_SOURCE_HOST1X 0x180 | ||
256 | #define CLK_SOURCE_HDMI 0x18c | ||
257 | #define CLK_SOURCE_DISP1 0x138 | ||
258 | #define CLK_SOURCE_DISP2 0x13c | ||
259 | #define CLK_SOURCE_CILAB 0x614 | ||
260 | #define CLK_SOURCE_CILCD 0x618 | ||
261 | #define CLK_SOURCE_CILE 0x61c | ||
262 | #define CLK_SOURCE_DSIALP 0x620 | ||
263 | #define CLK_SOURCE_DSIBLP 0x624 | ||
264 | #define CLK_SOURCE_TSENSOR 0x3b8 | ||
265 | #define CLK_SOURCE_D_AUDIO 0x3d0 | ||
266 | #define CLK_SOURCE_DAM0 0x3d8 | ||
267 | #define CLK_SOURCE_DAM1 0x3dc | ||
268 | #define CLK_SOURCE_DAM2 0x3e0 | ||
269 | #define CLK_SOURCE_ACTMON 0x3e8 | ||
270 | #define CLK_SOURCE_EXTERN1 0x3ec | ||
271 | #define CLK_SOURCE_EXTERN2 0x3f0 | ||
272 | #define CLK_SOURCE_EXTERN3 0x3f4 | ||
273 | #define CLK_SOURCE_I2CSLOW 0x3fc | ||
274 | #define CLK_SOURCE_SE 0x42c | ||
275 | #define CLK_SOURCE_MSELECT 0x3b4 | ||
276 | #define CLK_SOURCE_DFLL_REF 0x62c | ||
277 | #define CLK_SOURCE_DFLL_SOC 0x630 | ||
278 | #define CLK_SOURCE_SOC_THERM 0x644 | ||
279 | #define CLK_SOURCE_XUSB_HOST_SRC 0x600 | ||
280 | #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 | ||
281 | #define CLK_SOURCE_XUSB_FS_SRC 0x608 | ||
282 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 | 145 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 |
283 | #define CLK_SOURCE_XUSB_DEV_SRC 0x60c | ||
284 | #define CLK_SOURCE_EMC 0x19c | 146 | #define CLK_SOURCE_EMC 0x19c |
285 | 147 | ||
286 | /* PLLM override registers */ | 148 | /* PLLM override registers */ |
@@ -298,19 +160,13 @@ static struct cpu_clk_suspend_context { | |||
298 | } tegra114_cpu_clk_sctx; | 160 | } tegra114_cpu_clk_sctx; |
299 | #endif | 161 | #endif |
300 | 162 | ||
301 | static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; | ||
302 | |||
303 | static void __iomem *clk_base; | 163 | static void __iomem *clk_base; |
304 | static void __iomem *pmc_base; | 164 | static void __iomem *pmc_base; |
305 | 165 | ||
306 | static DEFINE_SPINLOCK(pll_d_lock); | 166 | static DEFINE_SPINLOCK(pll_d_lock); |
307 | static DEFINE_SPINLOCK(pll_d2_lock); | 167 | static DEFINE_SPINLOCK(pll_d2_lock); |
308 | static DEFINE_SPINLOCK(pll_u_lock); | 168 | static DEFINE_SPINLOCK(pll_u_lock); |
309 | static DEFINE_SPINLOCK(pll_div_lock); | ||
310 | static DEFINE_SPINLOCK(pll_re_lock); | 169 | static DEFINE_SPINLOCK(pll_re_lock); |
311 | static DEFINE_SPINLOCK(clk_doubler_lock); | ||
312 | static DEFINE_SPINLOCK(clk_out_lock); | ||
313 | static DEFINE_SPINLOCK(sysrate_lock); | ||
314 | 170 | ||
315 | static struct div_nmp pllxc_nmp = { | 171 | static struct div_nmp pllxc_nmp = { |
316 | .divm_shift = 0, | 172 | .divm_shift = 0, |
@@ -370,6 +226,8 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
370 | .stepb_shift = 9, | 226 | .stepb_shift = 9, |
371 | .pdiv_tohw = pllxc_p, | 227 | .pdiv_tohw = pllxc_p, |
372 | .div_nmp = &pllxc_nmp, | 228 | .div_nmp = &pllxc_nmp, |
229 | .freq_table = pll_c_freq_table, | ||
230 | .flags = TEGRA_PLL_USE_LOCK, | ||
373 | }; | 231 | }; |
374 | 232 | ||
375 | static struct div_nmp pllcx_nmp = { | 233 | static struct div_nmp pllcx_nmp = { |
@@ -417,6 +275,8 @@ static struct tegra_clk_pll_params pll_c2_params = { | |||
417 | .ext_misc_reg[0] = 0x4f0, | 275 | .ext_misc_reg[0] = 0x4f0, |
418 | .ext_misc_reg[1] = 0x4f4, | 276 | .ext_misc_reg[1] = 0x4f4, |
419 | .ext_misc_reg[2] = 0x4f8, | 277 | .ext_misc_reg[2] = 0x4f8, |
278 | .freq_table = pll_cx_freq_table, | ||
279 | .flags = TEGRA_PLL_USE_LOCK, | ||
420 | }; | 280 | }; |
421 | 281 | ||
422 | static struct tegra_clk_pll_params pll_c3_params = { | 282 | static struct tegra_clk_pll_params pll_c3_params = { |
@@ -437,6 +297,8 @@ static struct tegra_clk_pll_params pll_c3_params = { | |||
437 | .ext_misc_reg[0] = 0x504, | 297 | .ext_misc_reg[0] = 0x504, |
438 | .ext_misc_reg[1] = 0x508, | 298 | .ext_misc_reg[1] = 0x508, |
439 | .ext_misc_reg[2] = 0x50c, | 299 | .ext_misc_reg[2] = 0x50c, |
300 | .freq_table = pll_cx_freq_table, | ||
301 | .flags = TEGRA_PLL_USE_LOCK, | ||
440 | }; | 302 | }; |
441 | 303 | ||
442 | static struct div_nmp pllm_nmp = { | 304 | static struct div_nmp pllm_nmp = { |
@@ -483,6 +345,8 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
483 | .div_nmp = &pllm_nmp, | 345 | .div_nmp = &pllm_nmp, |
484 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, | 346 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, |
485 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2, | 347 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2, |
348 | .freq_table = pll_m_freq_table, | ||
349 | .flags = TEGRA_PLL_USE_LOCK, | ||
486 | }; | 350 | }; |
487 | 351 | ||
488 | static struct div_nmp pllp_nmp = { | 352 | static struct div_nmp pllp_nmp = { |
@@ -516,6 +380,9 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
516 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 380 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
517 | .lock_delay = 300, | 381 | .lock_delay = 300, |
518 | .div_nmp = &pllp_nmp, | 382 | .div_nmp = &pllp_nmp, |
383 | .freq_table = pll_p_freq_table, | ||
384 | .flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, | ||
385 | .fixed_rate = 408000000, | ||
519 | }; | 386 | }; |
520 | 387 | ||
521 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | 388 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
@@ -543,6 +410,8 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
543 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 410 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
544 | .lock_delay = 300, | 411 | .lock_delay = 300, |
545 | .div_nmp = &pllp_nmp, | 412 | .div_nmp = &pllp_nmp, |
413 | .freq_table = pll_a_freq_table, | ||
414 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | ||
546 | }; | 415 | }; |
547 | 416 | ||
548 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 417 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
@@ -579,6 +448,9 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
579 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 448 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
580 | .lock_delay = 1000, | 449 | .lock_delay = 1000, |
581 | .div_nmp = &pllp_nmp, | 450 | .div_nmp = &pllp_nmp, |
451 | .freq_table = pll_d_freq_table, | ||
452 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
453 | TEGRA_PLL_USE_LOCK, | ||
582 | }; | 454 | }; |
583 | 455 | ||
584 | static struct tegra_clk_pll_params pll_d2_params = { | 456 | static struct tegra_clk_pll_params pll_d2_params = { |
@@ -594,6 +466,9 @@ static struct tegra_clk_pll_params pll_d2_params = { | |||
594 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 466 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
595 | .lock_delay = 1000, | 467 | .lock_delay = 1000, |
596 | .div_nmp = &pllp_nmp, | 468 | .div_nmp = &pllp_nmp, |
469 | .freq_table = pll_d_freq_table, | ||
470 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
471 | TEGRA_PLL_USE_LOCK, | ||
597 | }; | 472 | }; |
598 | 473 | ||
599 | static struct pdiv_map pllu_p[] = { | 474 | static struct pdiv_map pllu_p[] = { |
@@ -634,6 +509,9 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
634 | .lock_delay = 1000, | 509 | .lock_delay = 1000, |
635 | .pdiv_tohw = pllu_p, | 510 | .pdiv_tohw = pllu_p, |
636 | .div_nmp = &pllu_nmp, | 511 | .div_nmp = &pllu_nmp, |
512 | .freq_table = pll_u_freq_table, | ||
513 | .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
514 | TEGRA_PLL_USE_LOCK, | ||
637 | }; | 515 | }; |
638 | 516 | ||
639 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | 517 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
@@ -667,12 +545,15 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
667 | .stepb_shift = 24, | 545 | .stepb_shift = 24, |
668 | .pdiv_tohw = pllxc_p, | 546 | .pdiv_tohw = pllxc_p, |
669 | .div_nmp = &pllxc_nmp, | 547 | .div_nmp = &pllxc_nmp, |
548 | .freq_table = pll_x_freq_table, | ||
549 | .flags = TEGRA_PLL_USE_LOCK, | ||
670 | }; | 550 | }; |
671 | 551 | ||
672 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | 552 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { |
673 | /* PLLE special case: use cpcon field to store cml divider value */ | 553 | /* PLLE special case: use cpcon field to store cml divider value */ |
674 | {336000000, 100000000, 100, 21, 16, 11}, | 554 | {336000000, 100000000, 100, 21, 16, 11}, |
675 | {312000000, 100000000, 200, 26, 24, 13}, | 555 | {312000000, 100000000, 200, 26, 24, 13}, |
556 | {12000000, 100000000, 200, 1, 24, 13}, | ||
676 | {0, 0, 0, 0, 0, 0}, | 557 | {0, 0, 0, 0, 0, 0}, |
677 | }; | 558 | }; |
678 | 559 | ||
@@ -699,6 +580,9 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
699 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 580 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
700 | .lock_delay = 300, | 581 | .lock_delay = 300, |
701 | .div_nmp = &plle_nmp, | 582 | .div_nmp = &plle_nmp, |
583 | .freq_table = pll_e_freq_table, | ||
584 | .flags = TEGRA_PLL_FIXED, | ||
585 | .fixed_rate = 100000000, | ||
702 | }; | 586 | }; |
703 | 587 | ||
704 | static struct div_nmp pllre_nmp = { | 588 | static struct div_nmp pllre_nmp = { |
@@ -725,53 +609,7 @@ static struct tegra_clk_pll_params pll_re_vco_params = { | |||
725 | .iddq_reg = PLLRE_MISC, | 609 | .iddq_reg = PLLRE_MISC, |
726 | .iddq_bit_idx = PLLRE_IDDQ_BIT, | 610 | .iddq_bit_idx = PLLRE_IDDQ_BIT, |
727 | .div_nmp = &pllre_nmp, | 611 | .div_nmp = &pllre_nmp, |
728 | }; | 612 | .flags = TEGRA_PLL_USE_LOCK, |
729 | |||
730 | /* Peripheral clock registers */ | ||
731 | |||
732 | static struct tegra_clk_periph_regs periph_l_regs = { | ||
733 | .enb_reg = CLK_OUT_ENB_L, | ||
734 | .enb_set_reg = CLK_OUT_ENB_SET_L, | ||
735 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | ||
736 | .rst_reg = RST_DEVICES_L, | ||
737 | .rst_set_reg = RST_DEVICES_SET_L, | ||
738 | .rst_clr_reg = RST_DEVICES_CLR_L, | ||
739 | }; | ||
740 | |||
741 | static struct tegra_clk_periph_regs periph_h_regs = { | ||
742 | .enb_reg = CLK_OUT_ENB_H, | ||
743 | .enb_set_reg = CLK_OUT_ENB_SET_H, | ||
744 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | ||
745 | .rst_reg = RST_DEVICES_H, | ||
746 | .rst_set_reg = RST_DEVICES_SET_H, | ||
747 | .rst_clr_reg = RST_DEVICES_CLR_H, | ||
748 | }; | ||
749 | |||
750 | static struct tegra_clk_periph_regs periph_u_regs = { | ||
751 | .enb_reg = CLK_OUT_ENB_U, | ||
752 | .enb_set_reg = CLK_OUT_ENB_SET_U, | ||
753 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | ||
754 | .rst_reg = RST_DEVICES_U, | ||
755 | .rst_set_reg = RST_DEVICES_SET_U, | ||
756 | .rst_clr_reg = RST_DEVICES_CLR_U, | ||
757 | }; | ||
758 | |||
759 | static struct tegra_clk_periph_regs periph_v_regs = { | ||
760 | .enb_reg = CLK_OUT_ENB_V, | ||
761 | .enb_set_reg = CLK_OUT_ENB_SET_V, | ||
762 | .enb_clr_reg = CLK_OUT_ENB_CLR_V, | ||
763 | .rst_reg = RST_DEVICES_V, | ||
764 | .rst_set_reg = RST_DEVICES_SET_V, | ||
765 | .rst_clr_reg = RST_DEVICES_CLR_V, | ||
766 | }; | ||
767 | |||
768 | static struct tegra_clk_periph_regs periph_w_regs = { | ||
769 | .enb_reg = CLK_OUT_ENB_W, | ||
770 | .enb_set_reg = CLK_OUT_ENB_SET_W, | ||
771 | .enb_clr_reg = CLK_OUT_ENB_CLR_W, | ||
772 | .rst_reg = RST_DEVICES_W, | ||
773 | .rst_set_reg = RST_DEVICES_SET_W, | ||
774 | .rst_clr_reg = RST_DEVICES_CLR_W, | ||
775 | }; | 613 | }; |
776 | 614 | ||
777 | /* possible OSC frequencies in Hz */ | 615 | /* possible OSC frequencies in Hz */ |
@@ -787,120 +625,6 @@ static unsigned long tegra114_input_freq[] = { | |||
787 | 625 | ||
788 | #define MASK(x) (BIT(x) - 1) | 626 | #define MASK(x) (BIT(x) - 1) |
789 | 627 | ||
790 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ | ||
791 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
792 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
793 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
794 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
795 | _parents##_idx, 0) | ||
796 | |||
797 | #define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
798 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
799 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
800 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
801 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
802 | _parents##_idx, flags) | ||
803 | |||
804 | #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ | ||
805 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
806 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
807 | 29, MASK(3), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
808 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
809 | _parents##_idx, 0) | ||
810 | |||
811 | #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ | ||
812 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
813 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
814 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
815 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
816 | _clk_id, _parents##_idx, 0) | ||
817 | |||
818 | #define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
819 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
820 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
821 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
822 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
823 | _clk_id, _parents##_idx, flags) | ||
824 | |||
825 | #define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\ | ||
826 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
827 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
828 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
829 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
830 | _clk_id, _parents##_idx, 0) | ||
831 | |||
832 | #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ | ||
833 | _clk_num, _regs, _clk_id) \ | ||
834 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
835 | 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,\ | ||
836 | _clk_num, periph_clk_enb_refcnt, 0, _clk_id, \ | ||
837 | _parents##_idx, 0) | ||
838 | |||
839 | #define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\ | ||
840 | _clk_num, _regs, _clk_id) \ | ||
841 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
842 | 30, MASK(2), 0, 0, 16, 0, 0, _regs, _clk_num, \ | ||
843 | periph_clk_enb_refcnt, 0, _clk_id, _parents##_idx, 0) | ||
844 | |||
845 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ | ||
846 | _mux_shift, _mux_mask, _clk_num, _regs, \ | ||
847 | _gate_flags, _clk_id) \ | ||
848 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
849 | _mux_shift, _mux_mask, 0, 0, 0, 0, 0, _regs, \ | ||
850 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
851 | _clk_id, _parents##_idx, 0) | ||
852 | |||
853 | #define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \ | ||
854 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
855 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \ | ||
856 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ | ||
857 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
858 | _clk_id, _parents##_idx, 0) | ||
859 | |||
860 | #define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset, _clk_num,\ | ||
861 | _regs, _gate_flags, _clk_id) \ | ||
862 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \ | ||
863 | _offset, 16, 0xE01F, 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
864 | periph_clk_enb_refcnt, _gate_flags , _clk_id, \ | ||
865 | mux_d_audio_clk_idx, 0) | ||
866 | |||
867 | enum tegra114_clk { | ||
868 | rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12, | ||
869 | ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19, | ||
870 | gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27, | ||
871 | host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40, | ||
872 | sbc1 = 41, nor = 42, sbc2 = 44, sbc3 = 46, i2c5 = 47, dsia = 48, | ||
873 | mipi = 50, hdmi = 51, csi = 52, i2c2 = 54, uartc = 55, mipi_cal = 56, | ||
874 | emc, usb2, usb3, vde = 61, bsea = 62, bsev = 63, uartd = 65, | ||
875 | i2c3 = 67, sbc4 = 68, sdmmc3 = 69, owr = 71, csite = 73, | ||
876 | la = 76, trace = 77, soc_therm = 78, dtv = 79, ndspeed = 80, | ||
877 | i2cslow = 81, dsib = 82, tsec = 83, xusb_host = 89, msenc = 91, | ||
878 | csus = 92, mselect = 99, tsensor = 100, i2s3 = 101, i2s4 = 102, | ||
879 | i2c4 = 103, sbc5 = 104, sbc6 = 105, d_audio, apbif = 107, dam0, dam1, | ||
880 | dam2, hda2codec_2x = 111, audio0_2x = 113, audio1_2x, audio2_2x, | ||
881 | audio3_2x, audio4_2x, spdif_2x, actmon = 119, extern1 = 120, | ||
882 | extern2 = 121, extern3 = 122, hda = 125, se = 127, hda2hdmi = 128, | ||
883 | cilab = 144, cilcd = 145, cile = 146, dsialp = 147, dsiblp = 148, | ||
884 | dds = 150, dp2 = 152, amx = 153, adx = 154, xusb_ss = 156, uartb = 192, | ||
885 | vfir, spdif_in, spdif_out, vi, vi_sensor, fuse, fuse_burn, clk_32k, | ||
886 | clk_m, clk_m_div2, clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_c2, | ||
887 | pll_c3, pll_m, pll_m_out1, pll_p, pll_p_out1, pll_p_out2, pll_p_out3, | ||
888 | pll_p_out4, pll_a, pll_a_out0, pll_d, pll_d_out0, pll_d2, pll_d2_out0, | ||
889 | pll_u, pll_u_480M, pll_u_60M, pll_u_48M, pll_u_12M, pll_x, pll_x_out0, | ||
890 | pll_re_vco, pll_re_out, pll_e_out0, spdif_in_sync, i2s0_sync, | ||
891 | i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, vimclk_sync, audio0, | ||
892 | audio1, audio2, audio3, audio4, spdif, clk_out_1, clk_out_2, clk_out_3, | ||
893 | blink, xusb_host_src = 252, xusb_falcon_src, xusb_fs_src, xusb_ss_src, | ||
894 | xusb_dev_src, xusb_dev, xusb_hs_src, sclk, hclk, pclk, cclk_g, cclk_lp, | ||
895 | dfll_ref = 264, dfll_soc, | ||
896 | |||
897 | /* Mux clocks */ | ||
898 | |||
899 | audio0_mux = 300, audio1_mux, audio2_mux, audio3_mux, audio4_mux, | ||
900 | spdif_mux, clk_out_1_mux, clk_out_2_mux, clk_out_3_mux, dsia_mux, | ||
901 | dsib_mux, clk_max, | ||
902 | }; | ||
903 | |||
904 | struct utmi_clk_param { | 628 | struct utmi_clk_param { |
905 | /* Oscillator Frequency in KHz */ | 629 | /* Oscillator Frequency in KHz */ |
906 | u32 osc_frequency; | 630 | u32 osc_frequency; |
@@ -934,122 +658,11 @@ static const struct utmi_clk_param utmi_parameters[] = { | |||
934 | 658 | ||
935 | /* peripheral mux definitions */ | 659 | /* peripheral mux definitions */ |
936 | 660 | ||
937 | #define MUX_I2S_SPDIF(_id) \ | ||
938 | static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ | ||
939 | #_id, "pll_p",\ | ||
940 | "clk_m"}; | ||
941 | MUX_I2S_SPDIF(audio0) | ||
942 | MUX_I2S_SPDIF(audio1) | ||
943 | MUX_I2S_SPDIF(audio2) | ||
944 | MUX_I2S_SPDIF(audio3) | ||
945 | MUX_I2S_SPDIF(audio4) | ||
946 | MUX_I2S_SPDIF(audio) | ||
947 | |||
948 | #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL | ||
949 | #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL | ||
950 | #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL | ||
951 | #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL | ||
952 | #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL | ||
953 | #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL | ||
954 | |||
955 | static const char *mux_pllp_pllc_pllm_clkm[] = { | ||
956 | "pll_p", "pll_c", "pll_m", "clk_m" | ||
957 | }; | ||
958 | #define mux_pllp_pllc_pllm_clkm_idx NULL | ||
959 | |||
960 | static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; | ||
961 | #define mux_pllp_pllc_pllm_idx NULL | ||
962 | |||
963 | static const char *mux_pllp_pllc_clk32_clkm[] = { | ||
964 | "pll_p", "pll_c", "clk_32k", "clk_m" | ||
965 | }; | ||
966 | #define mux_pllp_pllc_clk32_clkm_idx NULL | ||
967 | |||
968 | static const char *mux_plla_pllc_pllp_clkm[] = { | ||
969 | "pll_a_out0", "pll_c", "pll_p", "clk_m" | ||
970 | }; | ||
971 | #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx | ||
972 | |||
973 | static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { | ||
974 | "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" | ||
975 | }; | ||
976 | static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { | ||
977 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
978 | }; | ||
979 | |||
980 | static const char *mux_pllp_clkm[] = { | ||
981 | "pll_p", "clk_m" | ||
982 | }; | ||
983 | static u32 mux_pllp_clkm_idx[] = { | ||
984 | [0] = 0, [1] = 3, | ||
985 | }; | ||
986 | |||
987 | static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { | ||
988 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" | ||
989 | }; | ||
990 | #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx | ||
991 | |||
992 | static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { | ||
993 | "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", | ||
994 | "pll_d2_out0", "clk_m" | ||
995 | }; | ||
996 | #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL | ||
997 | |||
998 | static const char *mux_pllm_pllc_pllp_plla[] = { | ||
999 | "pll_m", "pll_c", "pll_p", "pll_a_out0" | ||
1000 | }; | ||
1001 | #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx | ||
1002 | |||
1003 | static const char *mux_pllp_pllc_clkm[] = { | ||
1004 | "pll_p", "pll_c", "pll_m" | ||
1005 | }; | ||
1006 | static u32 mux_pllp_pllc_clkm_idx[] = { | ||
1007 | [0] = 0, [1] = 1, [2] = 3, | ||
1008 | }; | ||
1009 | |||
1010 | static const char *mux_pllp_pllc_clkm_clk32[] = { | ||
1011 | "pll_p", "pll_c", "clk_m", "clk_32k" | ||
1012 | }; | ||
1013 | #define mux_pllp_pllc_clkm_clk32_idx NULL | ||
1014 | |||
1015 | static const char *mux_plla_clk32_pllp_clkm_plle[] = { | ||
1016 | "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" | ||
1017 | }; | ||
1018 | #define mux_plla_clk32_pllp_clkm_plle_idx NULL | ||
1019 | |||
1020 | static const char *mux_clkm_pllp_pllc_pllre[] = { | ||
1021 | "clk_m", "pll_p", "pll_c", "pll_re_out" | ||
1022 | }; | ||
1023 | static u32 mux_clkm_pllp_pllc_pllre_idx[] = { | ||
1024 | [0] = 0, [1] = 1, [2] = 3, [3] = 5, | ||
1025 | }; | ||
1026 | |||
1027 | static const char *mux_clkm_48M_pllp_480M[] = { | ||
1028 | "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" | ||
1029 | }; | ||
1030 | #define mux_clkm_48M_pllp_480M_idx NULL | ||
1031 | |||
1032 | static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { | ||
1033 | "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" | ||
1034 | }; | ||
1035 | static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { | ||
1036 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, | ||
1037 | }; | ||
1038 | |||
1039 | static const char *mux_plld_out0_plld2_out0[] = { | 661 | static const char *mux_plld_out0_plld2_out0[] = { |
1040 | "pll_d_out0", "pll_d2_out0", | 662 | "pll_d_out0", "pll_d2_out0", |
1041 | }; | 663 | }; |
1042 | #define mux_plld_out0_plld2_out0_idx NULL | 664 | #define mux_plld_out0_plld2_out0_idx NULL |
1043 | 665 | ||
1044 | static const char *mux_d_audio_clk[] = { | ||
1045 | "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", | ||
1046 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
1047 | }; | ||
1048 | static u32 mux_d_audio_clk_idx[] = { | ||
1049 | [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, | ||
1050 | [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, | ||
1051 | }; | ||
1052 | |||
1053 | static const char *mux_pllmcp_clkm[] = { | 666 | static const char *mux_pllmcp_clkm[] = { |
1054 | "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", | 667 | "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", |
1055 | }; | 668 | }; |
@@ -1064,8 +677,253 @@ static const struct clk_div_table pll_re_div_table[] = { | |||
1064 | { .val = 0, .div = 0 }, | 677 | { .val = 0, .div = 0 }, |
1065 | }; | 678 | }; |
1066 | 679 | ||
1067 | static struct clk *clks[clk_max]; | 680 | static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { |
1068 | static struct clk_onecell_data clk_data; | 681 | [tegra_clk_rtc] = { .dt_id = TEGRA114_CLK_RTC, .present = true }, |
682 | [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true }, | ||
683 | [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true }, | ||
684 | [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true }, | ||
685 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true }, | ||
686 | [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true }, | ||
687 | [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true }, | ||
688 | [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true }, | ||
689 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true }, | ||
690 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true }, | ||
691 | [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true }, | ||
692 | [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true }, | ||
693 | [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true }, | ||
694 | [tegra_clk_epp_8] = { .dt_id = TEGRA114_CLK_EPP, .present = true }, | ||
695 | [tegra_clk_gr2d_8] = { .dt_id = TEGRA114_CLK_GR2D, .present = true }, | ||
696 | [tegra_clk_usbd] = { .dt_id = TEGRA114_CLK_USBD, .present = true }, | ||
697 | [tegra_clk_isp] = { .dt_id = TEGRA114_CLK_ISP, .present = true }, | ||
698 | [tegra_clk_gr3d_8] = { .dt_id = TEGRA114_CLK_GR3D, .present = true }, | ||
699 | [tegra_clk_disp2] = { .dt_id = TEGRA114_CLK_DISP2, .present = true }, | ||
700 | [tegra_clk_disp1] = { .dt_id = TEGRA114_CLK_DISP1, .present = true }, | ||
701 | [tegra_clk_host1x_8] = { .dt_id = TEGRA114_CLK_HOST1X, .present = true }, | ||
702 | [tegra_clk_vcp] = { .dt_id = TEGRA114_CLK_VCP, .present = true }, | ||
703 | [tegra_clk_apbdma] = { .dt_id = TEGRA114_CLK_APBDMA, .present = true }, | ||
704 | [tegra_clk_kbc] = { .dt_id = TEGRA114_CLK_KBC, .present = true }, | ||
705 | [tegra_clk_kfuse] = { .dt_id = TEGRA114_CLK_KFUSE, .present = true }, | ||
706 | [tegra_clk_sbc1_8] = { .dt_id = TEGRA114_CLK_SBC1, .present = true }, | ||
707 | [tegra_clk_nor] = { .dt_id = TEGRA114_CLK_NOR, .present = true }, | ||
708 | [tegra_clk_sbc2_8] = { .dt_id = TEGRA114_CLK_SBC2, .present = true }, | ||
709 | [tegra_clk_sbc3_8] = { .dt_id = TEGRA114_CLK_SBC3, .present = true }, | ||
710 | [tegra_clk_i2c5] = { .dt_id = TEGRA114_CLK_I2C5, .present = true }, | ||
711 | [tegra_clk_dsia] = { .dt_id = TEGRA114_CLK_DSIA, .present = true }, | ||
712 | [tegra_clk_mipi] = { .dt_id = TEGRA114_CLK_MIPI, .present = true }, | ||
713 | [tegra_clk_hdmi] = { .dt_id = TEGRA114_CLK_HDMI, .present = true }, | ||
714 | [tegra_clk_csi] = { .dt_id = TEGRA114_CLK_CSI, .present = true }, | ||
715 | [tegra_clk_i2c2] = { .dt_id = TEGRA114_CLK_I2C2, .present = true }, | ||
716 | [tegra_clk_uartc] = { .dt_id = TEGRA114_CLK_UARTC, .present = true }, | ||
717 | [tegra_clk_mipi_cal] = { .dt_id = TEGRA114_CLK_MIPI_CAL, .present = true }, | ||
718 | [tegra_clk_emc] = { .dt_id = TEGRA114_CLK_EMC, .present = true }, | ||
719 | [tegra_clk_usb2] = { .dt_id = TEGRA114_CLK_USB2, .present = true }, | ||
720 | [tegra_clk_usb3] = { .dt_id = TEGRA114_CLK_USB3, .present = true }, | ||
721 | [tegra_clk_vde_8] = { .dt_id = TEGRA114_CLK_VDE, .present = true }, | ||
722 | [tegra_clk_bsea] = { .dt_id = TEGRA114_CLK_BSEA, .present = true }, | ||
723 | [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true }, | ||
724 | [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true }, | ||
725 | [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true }, | ||
726 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true }, | ||
727 | [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true }, | ||
728 | [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true }, | ||
729 | [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true }, | ||
730 | [tegra_clk_trace] = { .dt_id = TEGRA114_CLK_TRACE, .present = true }, | ||
731 | [tegra_clk_soc_therm] = { .dt_id = TEGRA114_CLK_SOC_THERM, .present = true }, | ||
732 | [tegra_clk_dtv] = { .dt_id = TEGRA114_CLK_DTV, .present = true }, | ||
733 | [tegra_clk_ndspeed] = { .dt_id = TEGRA114_CLK_NDSPEED, .present = true }, | ||
734 | [tegra_clk_i2cslow] = { .dt_id = TEGRA114_CLK_I2CSLOW, .present = true }, | ||
735 | [tegra_clk_dsib] = { .dt_id = TEGRA114_CLK_DSIB, .present = true }, | ||
736 | [tegra_clk_tsec] = { .dt_id = TEGRA114_CLK_TSEC, .present = true }, | ||
737 | [tegra_clk_xusb_host] = { .dt_id = TEGRA114_CLK_XUSB_HOST, .present = true }, | ||
738 | [tegra_clk_msenc] = { .dt_id = TEGRA114_CLK_MSENC, .present = true }, | ||
739 | [tegra_clk_csus] = { .dt_id = TEGRA114_CLK_CSUS, .present = true }, | ||
740 | [tegra_clk_mselect] = { .dt_id = TEGRA114_CLK_MSELECT, .present = true }, | ||
741 | [tegra_clk_tsensor] = { .dt_id = TEGRA114_CLK_TSENSOR, .present = true }, | ||
742 | [tegra_clk_i2s3] = { .dt_id = TEGRA114_CLK_I2S3, .present = true }, | ||
743 | [tegra_clk_i2s4] = { .dt_id = TEGRA114_CLK_I2S4, .present = true }, | ||
744 | [tegra_clk_i2c4] = { .dt_id = TEGRA114_CLK_I2C4, .present = true }, | ||
745 | [tegra_clk_sbc5_8] = { .dt_id = TEGRA114_CLK_SBC5, .present = true }, | ||
746 | [tegra_clk_sbc6_8] = { .dt_id = TEGRA114_CLK_SBC6, .present = true }, | ||
747 | [tegra_clk_d_audio] = { .dt_id = TEGRA114_CLK_D_AUDIO, .present = true }, | ||
748 | [tegra_clk_apbif] = { .dt_id = TEGRA114_CLK_APBIF, .present = true }, | ||
749 | [tegra_clk_dam0] = { .dt_id = TEGRA114_CLK_DAM0, .present = true }, | ||
750 | [tegra_clk_dam1] = { .dt_id = TEGRA114_CLK_DAM1, .present = true }, | ||
751 | [tegra_clk_dam2] = { .dt_id = TEGRA114_CLK_DAM2, .present = true }, | ||
752 | [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA114_CLK_HDA2CODEC_2X, .present = true }, | ||
753 | [tegra_clk_audio0_2x] = { .dt_id = TEGRA114_CLK_AUDIO0_2X, .present = true }, | ||
754 | [tegra_clk_audio1_2x] = { .dt_id = TEGRA114_CLK_AUDIO1_2X, .present = true }, | ||
755 | [tegra_clk_audio2_2x] = { .dt_id = TEGRA114_CLK_AUDIO2_2X, .present = true }, | ||
756 | [tegra_clk_audio3_2x] = { .dt_id = TEGRA114_CLK_AUDIO3_2X, .present = true }, | ||
757 | [tegra_clk_audio4_2x] = { .dt_id = TEGRA114_CLK_AUDIO4_2X, .present = true }, | ||
758 | [tegra_clk_spdif_2x] = { .dt_id = TEGRA114_CLK_SPDIF_2X, .present = true }, | ||
759 | [tegra_clk_actmon] = { .dt_id = TEGRA114_CLK_ACTMON, .present = true }, | ||
760 | [tegra_clk_extern1] = { .dt_id = TEGRA114_CLK_EXTERN1, .present = true }, | ||
761 | [tegra_clk_extern2] = { .dt_id = TEGRA114_CLK_EXTERN2, .present = true }, | ||
762 | [tegra_clk_extern3] = { .dt_id = TEGRA114_CLK_EXTERN3, .present = true }, | ||
763 | [tegra_clk_hda] = { .dt_id = TEGRA114_CLK_HDA, .present = true }, | ||
764 | [tegra_clk_se] = { .dt_id = TEGRA114_CLK_SE, .present = true }, | ||
765 | [tegra_clk_hda2hdmi] = { .dt_id = TEGRA114_CLK_HDA2HDMI, .present = true }, | ||
766 | [tegra_clk_cilab] = { .dt_id = TEGRA114_CLK_CILAB, .present = true }, | ||
767 | [tegra_clk_cilcd] = { .dt_id = TEGRA114_CLK_CILCD, .present = true }, | ||
768 | [tegra_clk_cile] = { .dt_id = TEGRA114_CLK_CILE, .present = true }, | ||
769 | [tegra_clk_dsialp] = { .dt_id = TEGRA114_CLK_DSIALP, .present = true }, | ||
770 | [tegra_clk_dsiblp] = { .dt_id = TEGRA114_CLK_DSIBLP, .present = true }, | ||
771 | [tegra_clk_dds] = { .dt_id = TEGRA114_CLK_DDS, .present = true }, | ||
772 | [tegra_clk_dp2] = { .dt_id = TEGRA114_CLK_DP2, .present = true }, | ||
773 | [tegra_clk_amx] = { .dt_id = TEGRA114_CLK_AMX, .present = true }, | ||
774 | [tegra_clk_adx] = { .dt_id = TEGRA114_CLK_ADX, .present = true }, | ||
775 | [tegra_clk_xusb_ss] = { .dt_id = TEGRA114_CLK_XUSB_SS, .present = true }, | ||
776 | [tegra_clk_uartb] = { .dt_id = TEGRA114_CLK_UARTB, .present = true }, | ||
777 | [tegra_clk_vfir] = { .dt_id = TEGRA114_CLK_VFIR, .present = true }, | ||
778 | [tegra_clk_spdif_in] = { .dt_id = TEGRA114_CLK_SPDIF_IN, .present = true }, | ||
779 | [tegra_clk_spdif_out] = { .dt_id = TEGRA114_CLK_SPDIF_OUT, .present = true }, | ||
780 | [tegra_clk_vi_8] = { .dt_id = TEGRA114_CLK_VI, .present = true }, | ||
781 | [tegra_clk_vi_sensor_8] = { .dt_id = TEGRA114_CLK_VI_SENSOR, .present = true }, | ||
782 | [tegra_clk_fuse] = { .dt_id = TEGRA114_CLK_FUSE, .present = true }, | ||
783 | [tegra_clk_fuse_burn] = { .dt_id = TEGRA114_CLK_FUSE_BURN, .present = true }, | ||
784 | [tegra_clk_clk_32k] = { .dt_id = TEGRA114_CLK_CLK_32K, .present = true }, | ||
785 | [tegra_clk_clk_m] = { .dt_id = TEGRA114_CLK_CLK_M, .present = true }, | ||
786 | [tegra_clk_clk_m_div2] = { .dt_id = TEGRA114_CLK_CLK_M_DIV2, .present = true }, | ||
787 | [tegra_clk_clk_m_div4] = { .dt_id = TEGRA114_CLK_CLK_M_DIV4, .present = true }, | ||
788 | [tegra_clk_pll_ref] = { .dt_id = TEGRA114_CLK_PLL_REF, .present = true }, | ||
789 | [tegra_clk_pll_c] = { .dt_id = TEGRA114_CLK_PLL_C, .present = true }, | ||
790 | [tegra_clk_pll_c_out1] = { .dt_id = TEGRA114_CLK_PLL_C_OUT1, .present = true }, | ||
791 | [tegra_clk_pll_c2] = { .dt_id = TEGRA114_CLK_PLL_C2, .present = true }, | ||
792 | [tegra_clk_pll_c3] = { .dt_id = TEGRA114_CLK_PLL_C3, .present = true }, | ||
793 | [tegra_clk_pll_m] = { .dt_id = TEGRA114_CLK_PLL_M, .present = true }, | ||
794 | [tegra_clk_pll_m_out1] = { .dt_id = TEGRA114_CLK_PLL_M_OUT1, .present = true }, | ||
795 | [tegra_clk_pll_p] = { .dt_id = TEGRA114_CLK_PLL_P, .present = true }, | ||
796 | [tegra_clk_pll_p_out1] = { .dt_id = TEGRA114_CLK_PLL_P_OUT1, .present = true }, | ||
797 | [tegra_clk_pll_p_out2_int] = { .dt_id = TEGRA114_CLK_PLL_P_OUT2, .present = true }, | ||
798 | [tegra_clk_pll_p_out3] = { .dt_id = TEGRA114_CLK_PLL_P_OUT3, .present = true }, | ||
799 | [tegra_clk_pll_p_out4] = { .dt_id = TEGRA114_CLK_PLL_P_OUT4, .present = true }, | ||
800 | [tegra_clk_pll_a] = { .dt_id = TEGRA114_CLK_PLL_A, .present = true }, | ||
801 | [tegra_clk_pll_a_out0] = { .dt_id = TEGRA114_CLK_PLL_A_OUT0, .present = true }, | ||
802 | [tegra_clk_pll_d] = { .dt_id = TEGRA114_CLK_PLL_D, .present = true }, | ||
803 | [tegra_clk_pll_d_out0] = { .dt_id = TEGRA114_CLK_PLL_D_OUT0, .present = true }, | ||
804 | [tegra_clk_pll_d2] = { .dt_id = TEGRA114_CLK_PLL_D2, .present = true }, | ||
805 | [tegra_clk_pll_d2_out0] = { .dt_id = TEGRA114_CLK_PLL_D2_OUT0, .present = true }, | ||
806 | [tegra_clk_pll_u] = { .dt_id = TEGRA114_CLK_PLL_U, .present = true }, | ||
807 | [tegra_clk_pll_u_480m] = { .dt_id = TEGRA114_CLK_PLL_U_480M, .present = true }, | ||
808 | [tegra_clk_pll_u_60m] = { .dt_id = TEGRA114_CLK_PLL_U_60M, .present = true }, | ||
809 | [tegra_clk_pll_u_48m] = { .dt_id = TEGRA114_CLK_PLL_U_48M, .present = true }, | ||
810 | [tegra_clk_pll_u_12m] = { .dt_id = TEGRA114_CLK_PLL_U_12M, .present = true }, | ||
811 | [tegra_clk_pll_x] = { .dt_id = TEGRA114_CLK_PLL_X, .present = true }, | ||
812 | [tegra_clk_pll_x_out0] = { .dt_id = TEGRA114_CLK_PLL_X_OUT0, .present = true }, | ||
813 | [tegra_clk_pll_re_vco] = { .dt_id = TEGRA114_CLK_PLL_RE_VCO, .present = true }, | ||
814 | [tegra_clk_pll_re_out] = { .dt_id = TEGRA114_CLK_PLL_RE_OUT, .present = true }, | ||
815 | [tegra_clk_pll_e_out0] = { .dt_id = TEGRA114_CLK_PLL_E_OUT0, .present = true }, | ||
816 | [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA114_CLK_SPDIF_IN_SYNC, .present = true }, | ||
817 | [tegra_clk_i2s0_sync] = { .dt_id = TEGRA114_CLK_I2S0_SYNC, .present = true }, | ||
818 | [tegra_clk_i2s1_sync] = { .dt_id = TEGRA114_CLK_I2S1_SYNC, .present = true }, | ||
819 | [tegra_clk_i2s2_sync] = { .dt_id = TEGRA114_CLK_I2S2_SYNC, .present = true }, | ||
820 | [tegra_clk_i2s3_sync] = { .dt_id = TEGRA114_CLK_I2S3_SYNC, .present = true }, | ||
821 | [tegra_clk_i2s4_sync] = { .dt_id = TEGRA114_CLK_I2S4_SYNC, .present = true }, | ||
822 | [tegra_clk_vimclk_sync] = { .dt_id = TEGRA114_CLK_VIMCLK_SYNC, .present = true }, | ||
823 | [tegra_clk_audio0] = { .dt_id = TEGRA114_CLK_AUDIO0, .present = true }, | ||
824 | [tegra_clk_audio1] = { .dt_id = TEGRA114_CLK_AUDIO1, .present = true }, | ||
825 | [tegra_clk_audio2] = { .dt_id = TEGRA114_CLK_AUDIO2, .present = true }, | ||
826 | [tegra_clk_audio3] = { .dt_id = TEGRA114_CLK_AUDIO3, .present = true }, | ||
827 | [tegra_clk_audio4] = { .dt_id = TEGRA114_CLK_AUDIO4, .present = true }, | ||
828 | [tegra_clk_spdif] = { .dt_id = TEGRA114_CLK_SPDIF, .present = true }, | ||
829 | [tegra_clk_clk_out_1] = { .dt_id = TEGRA114_CLK_CLK_OUT_1, .present = true }, | ||
830 | [tegra_clk_clk_out_2] = { .dt_id = TEGRA114_CLK_CLK_OUT_2, .present = true }, | ||
831 | [tegra_clk_clk_out_3] = { .dt_id = TEGRA114_CLK_CLK_OUT_3, .present = true }, | ||
832 | [tegra_clk_blink] = { .dt_id = TEGRA114_CLK_BLINK, .present = true }, | ||
833 | [tegra_clk_xusb_host_src] = { .dt_id = TEGRA114_CLK_XUSB_HOST_SRC, .present = true }, | ||
834 | [tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA114_CLK_XUSB_FALCON_SRC, .present = true }, | ||
835 | [tegra_clk_xusb_fs_src] = { .dt_id = TEGRA114_CLK_XUSB_FS_SRC, .present = true }, | ||
836 | [tegra_clk_xusb_ss_src] = { .dt_id = TEGRA114_CLK_XUSB_SS_SRC, .present = true }, | ||
837 | [tegra_clk_xusb_dev_src] = { .dt_id = TEGRA114_CLK_XUSB_DEV_SRC, .present = true }, | ||
838 | [tegra_clk_xusb_dev] = { .dt_id = TEGRA114_CLK_XUSB_DEV, .present = true }, | ||
839 | [tegra_clk_xusb_hs_src] = { .dt_id = TEGRA114_CLK_XUSB_HS_SRC, .present = true }, | ||
840 | [tegra_clk_sclk] = { .dt_id = TEGRA114_CLK_SCLK, .present = true }, | ||
841 | [tegra_clk_hclk] = { .dt_id = TEGRA114_CLK_HCLK, .present = true }, | ||
842 | [tegra_clk_pclk] = { .dt_id = TEGRA114_CLK_PCLK, .present = true }, | ||
843 | [tegra_clk_cclk_g] = { .dt_id = TEGRA114_CLK_CCLK_G, .present = true }, | ||
844 | [tegra_clk_cclk_lp] = { .dt_id = TEGRA114_CLK_CCLK_LP, .present = true }, | ||
845 | [tegra_clk_dfll_ref] = { .dt_id = TEGRA114_CLK_DFLL_REF, .present = true }, | ||
846 | [tegra_clk_dfll_soc] = { .dt_id = TEGRA114_CLK_DFLL_SOC, .present = true }, | ||
847 | [tegra_clk_audio0_mux] = { .dt_id = TEGRA114_CLK_AUDIO0_MUX, .present = true }, | ||
848 | [tegra_clk_audio1_mux] = { .dt_id = TEGRA114_CLK_AUDIO1_MUX, .present = true }, | ||
849 | [tegra_clk_audio2_mux] = { .dt_id = TEGRA114_CLK_AUDIO2_MUX, .present = true }, | ||
850 | [tegra_clk_audio3_mux] = { .dt_id = TEGRA114_CLK_AUDIO3_MUX, .present = true }, | ||
851 | [tegra_clk_audio4_mux] = { .dt_id = TEGRA114_CLK_AUDIO4_MUX, .present = true }, | ||
852 | [tegra_clk_spdif_mux] = { .dt_id = TEGRA114_CLK_SPDIF_MUX, .present = true }, | ||
853 | [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_1_MUX, .present = true }, | ||
854 | [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_2_MUX, .present = true }, | ||
855 | [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_3_MUX, .present = true }, | ||
856 | [tegra_clk_dsia_mux] = { .dt_id = TEGRA114_CLK_DSIA_MUX, .present = true }, | ||
857 | [tegra_clk_dsib_mux] = { .dt_id = TEGRA114_CLK_DSIB_MUX, .present = true }, | ||
858 | }; | ||
859 | |||
860 | static struct tegra_devclk devclks[] __initdata = { | ||
861 | { .con_id = "clk_m", .dt_id = TEGRA114_CLK_CLK_M }, | ||
862 | { .con_id = "pll_ref", .dt_id = TEGRA114_CLK_PLL_REF }, | ||
863 | { .con_id = "clk_32k", .dt_id = TEGRA114_CLK_CLK_32K }, | ||
864 | { .con_id = "clk_m_div2", .dt_id = TEGRA114_CLK_CLK_M_DIV2 }, | ||
865 | { .con_id = "clk_m_div4", .dt_id = TEGRA114_CLK_CLK_M_DIV4 }, | ||
866 | { .con_id = "pll_c", .dt_id = TEGRA114_CLK_PLL_C }, | ||
867 | { .con_id = "pll_c_out1", .dt_id = TEGRA114_CLK_PLL_C_OUT1 }, | ||
868 | { .con_id = "pll_c2", .dt_id = TEGRA114_CLK_PLL_C2 }, | ||
869 | { .con_id = "pll_c3", .dt_id = TEGRA114_CLK_PLL_C3 }, | ||
870 | { .con_id = "pll_p", .dt_id = TEGRA114_CLK_PLL_P }, | ||
871 | { .con_id = "pll_p_out1", .dt_id = TEGRA114_CLK_PLL_P_OUT1 }, | ||
872 | { .con_id = "pll_p_out2", .dt_id = TEGRA114_CLK_PLL_P_OUT2 }, | ||
873 | { .con_id = "pll_p_out3", .dt_id = TEGRA114_CLK_PLL_P_OUT3 }, | ||
874 | { .con_id = "pll_p_out4", .dt_id = TEGRA114_CLK_PLL_P_OUT4 }, | ||
875 | { .con_id = "pll_m", .dt_id = TEGRA114_CLK_PLL_M }, | ||
876 | { .con_id = "pll_m_out1", .dt_id = TEGRA114_CLK_PLL_M_OUT1 }, | ||
877 | { .con_id = "pll_x", .dt_id = TEGRA114_CLK_PLL_X }, | ||
878 | { .con_id = "pll_x_out0", .dt_id = TEGRA114_CLK_PLL_X_OUT0 }, | ||
879 | { .con_id = "pll_u", .dt_id = TEGRA114_CLK_PLL_U }, | ||
880 | { .con_id = "pll_u_480M", .dt_id = TEGRA114_CLK_PLL_U_480M }, | ||
881 | { .con_id = "pll_u_60M", .dt_id = TEGRA114_CLK_PLL_U_60M }, | ||
882 | { .con_id = "pll_u_48M", .dt_id = TEGRA114_CLK_PLL_U_48M }, | ||
883 | { .con_id = "pll_u_12M", .dt_id = TEGRA114_CLK_PLL_U_12M }, | ||
884 | { .con_id = "pll_d", .dt_id = TEGRA114_CLK_PLL_D }, | ||
885 | { .con_id = "pll_d_out0", .dt_id = TEGRA114_CLK_PLL_D_OUT0 }, | ||
886 | { .con_id = "pll_d2", .dt_id = TEGRA114_CLK_PLL_D2 }, | ||
887 | { .con_id = "pll_d2_out0", .dt_id = TEGRA114_CLK_PLL_D2_OUT0 }, | ||
888 | { .con_id = "pll_a", .dt_id = TEGRA114_CLK_PLL_A }, | ||
889 | { .con_id = "pll_a_out0", .dt_id = TEGRA114_CLK_PLL_A_OUT0 }, | ||
890 | { .con_id = "pll_re_vco", .dt_id = TEGRA114_CLK_PLL_RE_VCO }, | ||
891 | { .con_id = "pll_re_out", .dt_id = TEGRA114_CLK_PLL_RE_OUT }, | ||
892 | { .con_id = "pll_e_out0", .dt_id = TEGRA114_CLK_PLL_E_OUT0 }, | ||
893 | { .con_id = "spdif_in_sync", .dt_id = TEGRA114_CLK_SPDIF_IN_SYNC }, | ||
894 | { .con_id = "i2s0_sync", .dt_id = TEGRA114_CLK_I2S0_SYNC }, | ||
895 | { .con_id = "i2s1_sync", .dt_id = TEGRA114_CLK_I2S1_SYNC }, | ||
896 | { .con_id = "i2s2_sync", .dt_id = TEGRA114_CLK_I2S2_SYNC }, | ||
897 | { .con_id = "i2s3_sync", .dt_id = TEGRA114_CLK_I2S3_SYNC }, | ||
898 | { .con_id = "i2s4_sync", .dt_id = TEGRA114_CLK_I2S4_SYNC }, | ||
899 | { .con_id = "vimclk_sync", .dt_id = TEGRA114_CLK_VIMCLK_SYNC }, | ||
900 | { .con_id = "audio0", .dt_id = TEGRA114_CLK_AUDIO0 }, | ||
901 | { .con_id = "audio1", .dt_id = TEGRA114_CLK_AUDIO1 }, | ||
902 | { .con_id = "audio2", .dt_id = TEGRA114_CLK_AUDIO2 }, | ||
903 | { .con_id = "audio3", .dt_id = TEGRA114_CLK_AUDIO3 }, | ||
904 | { .con_id = "audio4", .dt_id = TEGRA114_CLK_AUDIO4 }, | ||
905 | { .con_id = "spdif", .dt_id = TEGRA114_CLK_SPDIF }, | ||
906 | { .con_id = "audio0_2x", .dt_id = TEGRA114_CLK_AUDIO0_2X }, | ||
907 | { .con_id = "audio1_2x", .dt_id = TEGRA114_CLK_AUDIO1_2X }, | ||
908 | { .con_id = "audio2_2x", .dt_id = TEGRA114_CLK_AUDIO2_2X }, | ||
909 | { .con_id = "audio3_2x", .dt_id = TEGRA114_CLK_AUDIO3_2X }, | ||
910 | { .con_id = "audio4_2x", .dt_id = TEGRA114_CLK_AUDIO4_2X }, | ||
911 | { .con_id = "spdif_2x", .dt_id = TEGRA114_CLK_SPDIF_2X }, | ||
912 | { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA114_CLK_EXTERN1 }, | ||
913 | { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA114_CLK_EXTERN2 }, | ||
914 | { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA114_CLK_EXTERN3 }, | ||
915 | { .con_id = "blink", .dt_id = TEGRA114_CLK_BLINK }, | ||
916 | { .con_id = "cclk_g", .dt_id = TEGRA114_CLK_CCLK_G }, | ||
917 | { .con_id = "cclk_lp", .dt_id = TEGRA114_CLK_CCLK_LP }, | ||
918 | { .con_id = "sclk", .dt_id = TEGRA114_CLK_SCLK }, | ||
919 | { .con_id = "hclk", .dt_id = TEGRA114_CLK_HCLK }, | ||
920 | { .con_id = "pclk", .dt_id = TEGRA114_CLK_PCLK }, | ||
921 | { .con_id = "fuse", .dt_id = TEGRA114_CLK_FUSE }, | ||
922 | { .dev_id = "rtc-tegra", .dt_id = TEGRA114_CLK_RTC }, | ||
923 | { .dev_id = "timer", .dt_id = TEGRA114_CLK_TIMER }, | ||
924 | }; | ||
925 | |||
926 | static struct clk **clks; | ||
1069 | 927 | ||
1070 | static unsigned long osc_freq; | 928 | static unsigned long osc_freq; |
1071 | static unsigned long pll_ref_freq; | 929 | static unsigned long pll_ref_freq; |
@@ -1086,16 +944,14 @@ static int __init tegra114_osc_clk_init(void __iomem *clk_base) | |||
1086 | /* clk_m */ | 944 | /* clk_m */ |
1087 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, | 945 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, |
1088 | osc_freq); | 946 | osc_freq); |
1089 | clk_register_clkdev(clk, "clk_m", NULL); | 947 | clks[TEGRA114_CLK_CLK_M] = clk; |
1090 | clks[clk_m] = clk; | ||
1091 | 948 | ||
1092 | /* pll_ref */ | 949 | /* pll_ref */ |
1093 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; | 950 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; |
1094 | pll_ref_div = 1 << val; | 951 | pll_ref_div = 1 << val; |
1095 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | 952 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", |
1096 | CLK_SET_RATE_PARENT, 1, pll_ref_div); | 953 | CLK_SET_RATE_PARENT, 1, pll_ref_div); |
1097 | clk_register_clkdev(clk, "pll_ref", NULL); | 954 | clks[TEGRA114_CLK_PLL_REF] = clk; |
1098 | clks[pll_ref] = clk; | ||
1099 | 955 | ||
1100 | pll_ref_freq = osc_freq / pll_ref_div; | 956 | pll_ref_freq = osc_freq / pll_ref_div; |
1101 | 957 | ||
@@ -1109,20 +965,17 @@ static void __init tegra114_fixed_clk_init(void __iomem *clk_base) | |||
1109 | /* clk_32k */ | 965 | /* clk_32k */ |
1110 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, | 966 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, |
1111 | 32768); | 967 | 32768); |
1112 | clk_register_clkdev(clk, "clk_32k", NULL); | 968 | clks[TEGRA114_CLK_CLK_32K] = clk; |
1113 | clks[clk_32k] = clk; | ||
1114 | 969 | ||
1115 | /* clk_m_div2 */ | 970 | /* clk_m_div2 */ |
1116 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", | 971 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", |
1117 | CLK_SET_RATE_PARENT, 1, 2); | 972 | CLK_SET_RATE_PARENT, 1, 2); |
1118 | clk_register_clkdev(clk, "clk_m_div2", NULL); | 973 | clks[TEGRA114_CLK_CLK_M_DIV2] = clk; |
1119 | clks[clk_m_div2] = clk; | ||
1120 | 974 | ||
1121 | /* clk_m_div4 */ | 975 | /* clk_m_div4 */ |
1122 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", | 976 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", |
1123 | CLK_SET_RATE_PARENT, 1, 4); | 977 | CLK_SET_RATE_PARENT, 1, 4); |
1124 | clk_register_clkdev(clk, "clk_m_div4", NULL); | 978 | clks[TEGRA114_CLK_CLK_M_DIV4] = clk; |
1125 | clks[clk_m_div4] = clk; | ||
1126 | 979 | ||
1127 | } | 980 | } |
1128 | 981 | ||
@@ -1208,63 +1061,6 @@ static __init void tegra114_utmi_param_configure(void __iomem *clk_base) | |||
1208 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | 1061 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); |
1209 | } | 1062 | } |
1210 | 1063 | ||
1211 | static void __init _clip_vco_min(struct tegra_clk_pll_params *pll_params) | ||
1212 | { | ||
1213 | pll_params->vco_min = | ||
1214 | DIV_ROUND_UP(pll_params->vco_min, pll_ref_freq) * pll_ref_freq; | ||
1215 | } | ||
1216 | |||
1217 | static int __init _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params, | ||
1218 | void __iomem *clk_base) | ||
1219 | { | ||
1220 | u32 val; | ||
1221 | u32 step_a, step_b; | ||
1222 | |||
1223 | switch (pll_ref_freq) { | ||
1224 | case 12000000: | ||
1225 | case 13000000: | ||
1226 | case 26000000: | ||
1227 | step_a = 0x2B; | ||
1228 | step_b = 0x0B; | ||
1229 | break; | ||
1230 | case 16800000: | ||
1231 | step_a = 0x1A; | ||
1232 | step_b = 0x09; | ||
1233 | break; | ||
1234 | case 19200000: | ||
1235 | step_a = 0x12; | ||
1236 | step_b = 0x08; | ||
1237 | break; | ||
1238 | default: | ||
1239 | pr_err("%s: Unexpected reference rate %lu\n", | ||
1240 | __func__, pll_ref_freq); | ||
1241 | WARN_ON(1); | ||
1242 | return -EINVAL; | ||
1243 | } | ||
1244 | |||
1245 | val = step_a << pll_params->stepa_shift; | ||
1246 | val |= step_b << pll_params->stepb_shift; | ||
1247 | writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg); | ||
1248 | |||
1249 | return 0; | ||
1250 | } | ||
1251 | |||
1252 | static void __init _init_iddq(struct tegra_clk_pll_params *pll_params, | ||
1253 | void __iomem *clk_base) | ||
1254 | { | ||
1255 | u32 val, val_iddq; | ||
1256 | |||
1257 | val = readl_relaxed(clk_base + pll_params->base_reg); | ||
1258 | val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg); | ||
1259 | |||
1260 | if (val & BIT(30)) | ||
1261 | WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx)); | ||
1262 | else { | ||
1263 | val_iddq |= BIT(pll_params->iddq_bit_idx); | ||
1264 | writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg); | ||
1265 | } | ||
1266 | } | ||
1267 | |||
1268 | static void __init tegra114_pll_init(void __iomem *clk_base, | 1064 | static void __init tegra114_pll_init(void __iomem *clk_base, |
1269 | void __iomem *pmc) | 1065 | void __iomem *pmc) |
1270 | { | 1066 | { |
@@ -1272,104 +1068,34 @@ static void __init tegra114_pll_init(void __iomem *clk_base, | |||
1272 | struct clk *clk; | 1068 | struct clk *clk; |
1273 | 1069 | ||
1274 | /* PLLC */ | 1070 | /* PLLC */ |
1275 | _clip_vco_min(&pll_c_params); | 1071 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, |
1276 | if (_setup_dynamic_ramp(&pll_c_params, clk_base) >= 0) { | 1072 | pmc, 0, &pll_c_params, NULL); |
1277 | _init_iddq(&pll_c_params, clk_base); | 1073 | clks[TEGRA114_CLK_PLL_C] = clk; |
1278 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, | 1074 | |
1279 | pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK, | 1075 | /* PLLC_OUT1 */ |
1280 | pll_c_freq_table, NULL); | 1076 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", |
1281 | clk_register_clkdev(clk, "pll_c", NULL); | 1077 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, |
1282 | clks[pll_c] = clk; | 1078 | 8, 8, 1, NULL); |
1283 | 1079 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | |
1284 | /* PLLC_OUT1 */ | 1080 | clk_base + PLLC_OUT, 1, 0, |
1285 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | 1081 | CLK_SET_RATE_PARENT, 0, NULL); |
1286 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | 1082 | clks[TEGRA114_CLK_PLL_C_OUT1] = clk; |
1287 | 8, 8, 1, NULL); | ||
1288 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | ||
1289 | clk_base + PLLC_OUT, 1, 0, | ||
1290 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1291 | clk_register_clkdev(clk, "pll_c_out1", NULL); | ||
1292 | clks[pll_c_out1] = clk; | ||
1293 | } | ||
1294 | 1083 | ||
1295 | /* PLLC2 */ | 1084 | /* PLLC2 */ |
1296 | _clip_vco_min(&pll_c2_params); | 1085 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, |
1297 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0, | 1086 | &pll_c2_params, NULL); |
1298 | &pll_c2_params, TEGRA_PLL_USE_LOCK, | 1087 | clks[TEGRA114_CLK_PLL_C2] = clk; |
1299 | pll_cx_freq_table, NULL); | ||
1300 | clk_register_clkdev(clk, "pll_c2", NULL); | ||
1301 | clks[pll_c2] = clk; | ||
1302 | 1088 | ||
1303 | /* PLLC3 */ | 1089 | /* PLLC3 */ |
1304 | _clip_vco_min(&pll_c3_params); | 1090 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, |
1305 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0, | 1091 | &pll_c3_params, NULL); |
1306 | &pll_c3_params, TEGRA_PLL_USE_LOCK, | 1092 | clks[TEGRA114_CLK_PLL_C3] = clk; |
1307 | pll_cx_freq_table, NULL); | ||
1308 | clk_register_clkdev(clk, "pll_c3", NULL); | ||
1309 | clks[pll_c3] = clk; | ||
1310 | |||
1311 | /* PLLP */ | ||
1312 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0, | ||
1313 | 408000000, &pll_p_params, | ||
1314 | TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, | ||
1315 | pll_p_freq_table, NULL); | ||
1316 | clk_register_clkdev(clk, "pll_p", NULL); | ||
1317 | clks[pll_p] = clk; | ||
1318 | |||
1319 | /* PLLP_OUT1 */ | ||
1320 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", | ||
1321 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1322 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1323 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", | ||
1324 | clk_base + PLLP_OUTA, 1, 0, | ||
1325 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1326 | &pll_div_lock); | ||
1327 | clk_register_clkdev(clk, "pll_p_out1", NULL); | ||
1328 | clks[pll_p_out1] = clk; | ||
1329 | |||
1330 | /* PLLP_OUT2 */ | ||
1331 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", | ||
1332 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1333 | TEGRA_DIVIDER_ROUND_UP | TEGRA_DIVIDER_INT, 24, | ||
1334 | 8, 1, &pll_div_lock); | ||
1335 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", | ||
1336 | clk_base + PLLP_OUTA, 17, 16, | ||
1337 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1338 | &pll_div_lock); | ||
1339 | clk_register_clkdev(clk, "pll_p_out2", NULL); | ||
1340 | clks[pll_p_out2] = clk; | ||
1341 | |||
1342 | /* PLLP_OUT3 */ | ||
1343 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", | ||
1344 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1345 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1346 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", | ||
1347 | clk_base + PLLP_OUTB, 1, 0, | ||
1348 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1349 | &pll_div_lock); | ||
1350 | clk_register_clkdev(clk, "pll_p_out3", NULL); | ||
1351 | clks[pll_p_out3] = clk; | ||
1352 | |||
1353 | /* PLLP_OUT4 */ | ||
1354 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", | ||
1355 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1356 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
1357 | &pll_div_lock); | ||
1358 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", | ||
1359 | clk_base + PLLP_OUTB, 17, 16, | ||
1360 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1361 | &pll_div_lock); | ||
1362 | clk_register_clkdev(clk, "pll_p_out4", NULL); | ||
1363 | clks[pll_p_out4] = clk; | ||
1364 | 1093 | ||
1365 | /* PLLM */ | 1094 | /* PLLM */ |
1366 | _clip_vco_min(&pll_m_params); | ||
1367 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, | 1095 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, |
1368 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, | 1096 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
1369 | &pll_m_params, TEGRA_PLL_USE_LOCK, | 1097 | &pll_m_params, NULL); |
1370 | pll_m_freq_table, NULL); | 1098 | clks[TEGRA114_CLK_PLL_M] = clk; |
1371 | clk_register_clkdev(clk, "pll_m", NULL); | ||
1372 | clks[pll_m] = clk; | ||
1373 | 1099 | ||
1374 | /* PLLM_OUT1 */ | 1100 | /* PLLM_OUT1 */ |
1375 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | 1101 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", |
@@ -1378,41 +1104,20 @@ static void __init tegra114_pll_init(void __iomem *clk_base, | |||
1378 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | 1104 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", |
1379 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | 1105 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | |
1380 | CLK_SET_RATE_PARENT, 0, NULL); | 1106 | CLK_SET_RATE_PARENT, 0, NULL); |
1381 | clk_register_clkdev(clk, "pll_m_out1", NULL); | 1107 | clks[TEGRA114_CLK_PLL_M_OUT1] = clk; |
1382 | clks[pll_m_out1] = clk; | ||
1383 | 1108 | ||
1384 | /* PLLM_UD */ | 1109 | /* PLLM_UD */ |
1385 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", | 1110 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", |
1386 | CLK_SET_RATE_PARENT, 1, 1); | 1111 | CLK_SET_RATE_PARENT, 1, 1); |
1387 | 1112 | ||
1388 | /* PLLX */ | ||
1389 | _clip_vco_min(&pll_x_params); | ||
1390 | if (_setup_dynamic_ramp(&pll_x_params, clk_base) >= 0) { | ||
1391 | _init_iddq(&pll_x_params, clk_base); | ||
1392 | clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, | ||
1393 | pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params, | ||
1394 | TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL); | ||
1395 | clk_register_clkdev(clk, "pll_x", NULL); | ||
1396 | clks[pll_x] = clk; | ||
1397 | } | ||
1398 | |||
1399 | /* PLLX_OUT0 */ | ||
1400 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", | ||
1401 | CLK_SET_RATE_PARENT, 1, 2); | ||
1402 | clk_register_clkdev(clk, "pll_x_out0", NULL); | ||
1403 | clks[pll_x_out0] = clk; | ||
1404 | |||
1405 | /* PLLU */ | 1113 | /* PLLU */ |
1406 | val = readl(clk_base + pll_u_params.base_reg); | 1114 | val = readl(clk_base + pll_u_params.base_reg); |
1407 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ | 1115 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ |
1408 | writel(val, clk_base + pll_u_params.base_reg); | 1116 | writel(val, clk_base + pll_u_params.base_reg); |
1409 | 1117 | ||
1410 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, | 1118 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, |
1411 | 0, &pll_u_params, TEGRA_PLLU | | 1119 | &pll_u_params, &pll_u_lock); |
1412 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 1120 | clks[TEGRA114_CLK_PLL_U] = clk; |
1413 | TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock); | ||
1414 | clk_register_clkdev(clk, "pll_u", NULL); | ||
1415 | clks[pll_u] = clk; | ||
1416 | 1121 | ||
1417 | tegra114_utmi_param_configure(clk_base); | 1122 | tegra114_utmi_param_configure(clk_base); |
1418 | 1123 | ||
@@ -1420,731 +1125,97 @@ static void __init tegra114_pll_init(void __iomem *clk_base, | |||
1420 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", | 1125 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", |
1421 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, | 1126 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, |
1422 | 22, 0, &pll_u_lock); | 1127 | 22, 0, &pll_u_lock); |
1423 | clk_register_clkdev(clk, "pll_u_480M", NULL); | 1128 | clks[TEGRA114_CLK_PLL_U_480M] = clk; |
1424 | clks[pll_u_480M] = clk; | ||
1425 | 1129 | ||
1426 | /* PLLU_60M */ | 1130 | /* PLLU_60M */ |
1427 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", | 1131 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", |
1428 | CLK_SET_RATE_PARENT, 1, 8); | 1132 | CLK_SET_RATE_PARENT, 1, 8); |
1429 | clk_register_clkdev(clk, "pll_u_60M", NULL); | 1133 | clks[TEGRA114_CLK_PLL_U_60M] = clk; |
1430 | clks[pll_u_60M] = clk; | ||
1431 | 1134 | ||
1432 | /* PLLU_48M */ | 1135 | /* PLLU_48M */ |
1433 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", | 1136 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", |
1434 | CLK_SET_RATE_PARENT, 1, 10); | 1137 | CLK_SET_RATE_PARENT, 1, 10); |
1435 | clk_register_clkdev(clk, "pll_u_48M", NULL); | 1138 | clks[TEGRA114_CLK_PLL_U_48M] = clk; |
1436 | clks[pll_u_48M] = clk; | ||
1437 | 1139 | ||
1438 | /* PLLU_12M */ | 1140 | /* PLLU_12M */ |
1439 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", | 1141 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", |
1440 | CLK_SET_RATE_PARENT, 1, 40); | 1142 | CLK_SET_RATE_PARENT, 1, 40); |
1441 | clk_register_clkdev(clk, "pll_u_12M", NULL); | 1143 | clks[TEGRA114_CLK_PLL_U_12M] = clk; |
1442 | clks[pll_u_12M] = clk; | ||
1443 | 1144 | ||
1444 | /* PLLD */ | 1145 | /* PLLD */ |
1445 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, | 1146 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, |
1446 | 0, &pll_d_params, | 1147 | &pll_d_params, &pll_d_lock); |
1447 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 1148 | clks[TEGRA114_CLK_PLL_D] = clk; |
1448 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock); | ||
1449 | clk_register_clkdev(clk, "pll_d", NULL); | ||
1450 | clks[pll_d] = clk; | ||
1451 | 1149 | ||
1452 | /* PLLD_OUT0 */ | 1150 | /* PLLD_OUT0 */ |
1453 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | 1151 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", |
1454 | CLK_SET_RATE_PARENT, 1, 2); | 1152 | CLK_SET_RATE_PARENT, 1, 2); |
1455 | clk_register_clkdev(clk, "pll_d_out0", NULL); | 1153 | clks[TEGRA114_CLK_PLL_D_OUT0] = clk; |
1456 | clks[pll_d_out0] = clk; | ||
1457 | 1154 | ||
1458 | /* PLLD2 */ | 1155 | /* PLLD2 */ |
1459 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, | 1156 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, |
1460 | 0, &pll_d2_params, | 1157 | &pll_d2_params, &pll_d2_lock); |
1461 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 1158 | clks[TEGRA114_CLK_PLL_D2] = clk; |
1462 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock); | ||
1463 | clk_register_clkdev(clk, "pll_d2", NULL); | ||
1464 | clks[pll_d2] = clk; | ||
1465 | 1159 | ||
1466 | /* PLLD2_OUT0 */ | 1160 | /* PLLD2_OUT0 */ |
1467 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | 1161 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", |
1468 | CLK_SET_RATE_PARENT, 1, 2); | 1162 | CLK_SET_RATE_PARENT, 1, 2); |
1469 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | 1163 | clks[TEGRA114_CLK_PLL_D2_OUT0] = clk; |
1470 | clks[pll_d2_out0] = clk; | ||
1471 | |||
1472 | /* PLLA */ | ||
1473 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0, | ||
1474 | 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | | ||
1475 | TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); | ||
1476 | clk_register_clkdev(clk, "pll_a", NULL); | ||
1477 | clks[pll_a] = clk; | ||
1478 | |||
1479 | /* PLLA_OUT0 */ | ||
1480 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | ||
1481 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1482 | 8, 8, 1, NULL); | ||
1483 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | ||
1484 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1485 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1486 | clk_register_clkdev(clk, "pll_a_out0", NULL); | ||
1487 | clks[pll_a_out0] = clk; | ||
1488 | 1164 | ||
1489 | /* PLLRE */ | 1165 | /* PLLRE */ |
1490 | _clip_vco_min(&pll_re_vco_params); | ||
1491 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, | 1166 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, |
1492 | 0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK, | 1167 | 0, &pll_re_vco_params, &pll_re_lock, pll_ref_freq); |
1493 | NULL, &pll_re_lock, pll_ref_freq); | 1168 | clks[TEGRA114_CLK_PLL_RE_VCO] = clk; |
1494 | clk_register_clkdev(clk, "pll_re_vco", NULL); | ||
1495 | clks[pll_re_vco] = clk; | ||
1496 | 1169 | ||
1497 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, | 1170 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, |
1498 | clk_base + PLLRE_BASE, 16, 4, 0, | 1171 | clk_base + PLLRE_BASE, 16, 4, 0, |
1499 | pll_re_div_table, &pll_re_lock); | 1172 | pll_re_div_table, &pll_re_lock); |
1500 | clk_register_clkdev(clk, "pll_re_out", NULL); | 1173 | clks[TEGRA114_CLK_PLL_RE_OUT] = clk; |
1501 | clks[pll_re_out] = clk; | ||
1502 | 1174 | ||
1503 | /* PLLE */ | 1175 | /* PLLE */ |
1504 | clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco", | 1176 | clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_ref", |
1505 | clk_base, 0, 100000000, &pll_e_params, | 1177 | clk_base, 0, &pll_e_params, NULL); |
1506 | pll_e_freq_table, NULL); | 1178 | clks[TEGRA114_CLK_PLL_E_OUT0] = clk; |
1507 | clk_register_clkdev(clk, "pll_e_out0", NULL); | ||
1508 | clks[pll_e_out0] = clk; | ||
1509 | } | ||
1510 | |||
1511 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", | ||
1512 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
1513 | }; | ||
1514 | |||
1515 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", | ||
1516 | "clk_m_div4", "extern1", | ||
1517 | }; | ||
1518 | |||
1519 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", | ||
1520 | "clk_m_div4", "extern2", | ||
1521 | }; | ||
1522 | |||
1523 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", | ||
1524 | "clk_m_div4", "extern3", | ||
1525 | }; | ||
1526 | |||
1527 | static void __init tegra114_audio_clk_init(void __iomem *clk_base) | ||
1528 | { | ||
1529 | struct clk *clk; | ||
1530 | |||
1531 | /* spdif_in_sync */ | ||
1532 | clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, | ||
1533 | 24000000); | ||
1534 | clk_register_clkdev(clk, "spdif_in_sync", NULL); | ||
1535 | clks[spdif_in_sync] = clk; | ||
1536 | |||
1537 | /* i2s0_sync */ | ||
1538 | clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); | ||
1539 | clk_register_clkdev(clk, "i2s0_sync", NULL); | ||
1540 | clks[i2s0_sync] = clk; | ||
1541 | |||
1542 | /* i2s1_sync */ | ||
1543 | clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); | ||
1544 | clk_register_clkdev(clk, "i2s1_sync", NULL); | ||
1545 | clks[i2s1_sync] = clk; | ||
1546 | |||
1547 | /* i2s2_sync */ | ||
1548 | clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); | ||
1549 | clk_register_clkdev(clk, "i2s2_sync", NULL); | ||
1550 | clks[i2s2_sync] = clk; | ||
1551 | |||
1552 | /* i2s3_sync */ | ||
1553 | clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); | ||
1554 | clk_register_clkdev(clk, "i2s3_sync", NULL); | ||
1555 | clks[i2s3_sync] = clk; | ||
1556 | |||
1557 | /* i2s4_sync */ | ||
1558 | clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); | ||
1559 | clk_register_clkdev(clk, "i2s4_sync", NULL); | ||
1560 | clks[i2s4_sync] = clk; | ||
1561 | |||
1562 | /* vimclk_sync */ | ||
1563 | clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); | ||
1564 | clk_register_clkdev(clk, "vimclk_sync", NULL); | ||
1565 | clks[vimclk_sync] = clk; | ||
1566 | |||
1567 | /* audio0 */ | ||
1568 | clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, | ||
1569 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1570 | CLK_SET_RATE_NO_REPARENT, | ||
1571 | clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, | ||
1572 | NULL); | ||
1573 | clks[audio0_mux] = clk; | ||
1574 | clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, | ||
1575 | clk_base + AUDIO_SYNC_CLK_I2S0, 4, | ||
1576 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1577 | clk_register_clkdev(clk, "audio0", NULL); | ||
1578 | clks[audio0] = clk; | ||
1579 | |||
1580 | /* audio1 */ | ||
1581 | clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, | ||
1582 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1583 | CLK_SET_RATE_NO_REPARENT, | ||
1584 | clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, | ||
1585 | NULL); | ||
1586 | clks[audio1_mux] = clk; | ||
1587 | clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, | ||
1588 | clk_base + AUDIO_SYNC_CLK_I2S1, 4, | ||
1589 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1590 | clk_register_clkdev(clk, "audio1", NULL); | ||
1591 | clks[audio1] = clk; | ||
1592 | |||
1593 | /* audio2 */ | ||
1594 | clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, | ||
1595 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1596 | CLK_SET_RATE_NO_REPARENT, | ||
1597 | clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, | ||
1598 | NULL); | ||
1599 | clks[audio2_mux] = clk; | ||
1600 | clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, | ||
1601 | clk_base + AUDIO_SYNC_CLK_I2S2, 4, | ||
1602 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1603 | clk_register_clkdev(clk, "audio2", NULL); | ||
1604 | clks[audio2] = clk; | ||
1605 | |||
1606 | /* audio3 */ | ||
1607 | clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, | ||
1608 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1609 | CLK_SET_RATE_NO_REPARENT, | ||
1610 | clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, | ||
1611 | NULL); | ||
1612 | clks[audio3_mux] = clk; | ||
1613 | clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, | ||
1614 | clk_base + AUDIO_SYNC_CLK_I2S3, 4, | ||
1615 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1616 | clk_register_clkdev(clk, "audio3", NULL); | ||
1617 | clks[audio3] = clk; | ||
1618 | |||
1619 | /* audio4 */ | ||
1620 | clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, | ||
1621 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1622 | CLK_SET_RATE_NO_REPARENT, | ||
1623 | clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, | ||
1624 | NULL); | ||
1625 | clks[audio4_mux] = clk; | ||
1626 | clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, | ||
1627 | clk_base + AUDIO_SYNC_CLK_I2S4, 4, | ||
1628 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1629 | clk_register_clkdev(clk, "audio4", NULL); | ||
1630 | clks[audio4] = clk; | ||
1631 | |||
1632 | /* spdif */ | ||
1633 | clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, | ||
1634 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1635 | CLK_SET_RATE_NO_REPARENT, | ||
1636 | clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, | ||
1637 | NULL); | ||
1638 | clks[spdif_mux] = clk; | ||
1639 | clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, | ||
1640 | clk_base + AUDIO_SYNC_CLK_SPDIF, 4, | ||
1641 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1642 | clk_register_clkdev(clk, "spdif", NULL); | ||
1643 | clks[spdif] = clk; | ||
1644 | |||
1645 | /* audio0_2x */ | ||
1646 | clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", | ||
1647 | CLK_SET_RATE_PARENT, 2, 1); | ||
1648 | clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", | ||
1649 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, | ||
1650 | 0, &clk_doubler_lock); | ||
1651 | clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", | ||
1652 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1653 | CLK_SET_RATE_PARENT, 113, &periph_v_regs, | ||
1654 | periph_clk_enb_refcnt); | ||
1655 | clk_register_clkdev(clk, "audio0_2x", NULL); | ||
1656 | clks[audio0_2x] = clk; | ||
1657 | |||
1658 | /* audio1_2x */ | ||
1659 | clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", | ||
1660 | CLK_SET_RATE_PARENT, 2, 1); | ||
1661 | clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", | ||
1662 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, | ||
1663 | 0, &clk_doubler_lock); | ||
1664 | clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", | ||
1665 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1666 | CLK_SET_RATE_PARENT, 114, &periph_v_regs, | ||
1667 | periph_clk_enb_refcnt); | ||
1668 | clk_register_clkdev(clk, "audio1_2x", NULL); | ||
1669 | clks[audio1_2x] = clk; | ||
1670 | |||
1671 | /* audio2_2x */ | ||
1672 | clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", | ||
1673 | CLK_SET_RATE_PARENT, 2, 1); | ||
1674 | clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", | ||
1675 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, | ||
1676 | 0, &clk_doubler_lock); | ||
1677 | clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", | ||
1678 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1679 | CLK_SET_RATE_PARENT, 115, &periph_v_regs, | ||
1680 | periph_clk_enb_refcnt); | ||
1681 | clk_register_clkdev(clk, "audio2_2x", NULL); | ||
1682 | clks[audio2_2x] = clk; | ||
1683 | |||
1684 | /* audio3_2x */ | ||
1685 | clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", | ||
1686 | CLK_SET_RATE_PARENT, 2, 1); | ||
1687 | clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", | ||
1688 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, | ||
1689 | 0, &clk_doubler_lock); | ||
1690 | clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", | ||
1691 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1692 | CLK_SET_RATE_PARENT, 116, &periph_v_regs, | ||
1693 | periph_clk_enb_refcnt); | ||
1694 | clk_register_clkdev(clk, "audio3_2x", NULL); | ||
1695 | clks[audio3_2x] = clk; | ||
1696 | |||
1697 | /* audio4_2x */ | ||
1698 | clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", | ||
1699 | CLK_SET_RATE_PARENT, 2, 1); | ||
1700 | clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", | ||
1701 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, | ||
1702 | 0, &clk_doubler_lock); | ||
1703 | clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", | ||
1704 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1705 | CLK_SET_RATE_PARENT, 117, &periph_v_regs, | ||
1706 | periph_clk_enb_refcnt); | ||
1707 | clk_register_clkdev(clk, "audio4_2x", NULL); | ||
1708 | clks[audio4_2x] = clk; | ||
1709 | |||
1710 | /* spdif_2x */ | ||
1711 | clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", | ||
1712 | CLK_SET_RATE_PARENT, 2, 1); | ||
1713 | clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", | ||
1714 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, | ||
1715 | 0, &clk_doubler_lock); | ||
1716 | clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", | ||
1717 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1718 | CLK_SET_RATE_PARENT, 118, | ||
1719 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1720 | clk_register_clkdev(clk, "spdif_2x", NULL); | ||
1721 | clks[spdif_2x] = clk; | ||
1722 | } | ||
1723 | |||
1724 | static void __init tegra114_pmc_clk_init(void __iomem *pmc_base) | ||
1725 | { | ||
1726 | struct clk *clk; | ||
1727 | |||
1728 | /* clk_out_1 */ | ||
1729 | clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, | ||
1730 | ARRAY_SIZE(clk_out1_parents), | ||
1731 | CLK_SET_RATE_NO_REPARENT, | ||
1732 | pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, | ||
1733 | &clk_out_lock); | ||
1734 | clks[clk_out_1_mux] = clk; | ||
1735 | clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, | ||
1736 | pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, | ||
1737 | &clk_out_lock); | ||
1738 | clk_register_clkdev(clk, "extern1", "clk_out_1"); | ||
1739 | clks[clk_out_1] = clk; | ||
1740 | |||
1741 | /* clk_out_2 */ | ||
1742 | clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, | ||
1743 | ARRAY_SIZE(clk_out2_parents), | ||
1744 | CLK_SET_RATE_NO_REPARENT, | ||
1745 | pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, | ||
1746 | &clk_out_lock); | ||
1747 | clks[clk_out_2_mux] = clk; | ||
1748 | clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, | ||
1749 | pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, | ||
1750 | &clk_out_lock); | ||
1751 | clk_register_clkdev(clk, "extern2", "clk_out_2"); | ||
1752 | clks[clk_out_2] = clk; | ||
1753 | |||
1754 | /* clk_out_3 */ | ||
1755 | clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, | ||
1756 | ARRAY_SIZE(clk_out3_parents), | ||
1757 | CLK_SET_RATE_NO_REPARENT, | ||
1758 | pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, | ||
1759 | &clk_out_lock); | ||
1760 | clks[clk_out_3_mux] = clk; | ||
1761 | clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, | ||
1762 | pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, | ||
1763 | &clk_out_lock); | ||
1764 | clk_register_clkdev(clk, "extern3", "clk_out_3"); | ||
1765 | clks[clk_out_3] = clk; | ||
1766 | |||
1767 | /* blink */ | ||
1768 | /* clear the blink timer register to directly output clk_32k */ | ||
1769 | writel_relaxed(0, pmc_base + PMC_BLINK_TIMER); | ||
1770 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
1771 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
1772 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
1773 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
1774 | pmc_base + PMC_CTRL, | ||
1775 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
1776 | clk_register_clkdev(clk, "blink", NULL); | ||
1777 | clks[blink] = clk; | ||
1778 | |||
1779 | } | 1179 | } |
1780 | 1180 | ||
1781 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", | 1181 | static __init void tegra114_periph_clk_init(void __iomem *clk_base, |
1782 | "pll_p", "pll_p_out2", "unused", | 1182 | void __iomem *pmc_base) |
1783 | "clk_32k", "pll_m_out1" }; | ||
1784 | |||
1785 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1786 | "pll_p", "pll_p_out4", "unused", | ||
1787 | "unused", "pll_x" }; | ||
1788 | |||
1789 | static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1790 | "pll_p", "pll_p_out4", "unused", | ||
1791 | "unused", "pll_x", "pll_x_out0" }; | ||
1792 | |||
1793 | static void __init tegra114_super_clk_init(void __iomem *clk_base) | ||
1794 | { | 1183 | { |
1795 | struct clk *clk; | 1184 | struct clk *clk; |
1185 | u32 val; | ||
1796 | 1186 | ||
1797 | /* CCLKG */ | 1187 | /* xusb_hs_src */ |
1798 | clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, | 1188 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); |
1799 | ARRAY_SIZE(cclk_g_parents), | 1189 | val |= BIT(25); /* always select PLLU_60M */ |
1800 | CLK_SET_RATE_PARENT, | 1190 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); |
1801 | clk_base + CCLKG_BURST_POLICY, | ||
1802 | 0, 4, 0, 0, NULL); | ||
1803 | clk_register_clkdev(clk, "cclk_g", NULL); | ||
1804 | clks[cclk_g] = clk; | ||
1805 | |||
1806 | /* CCLKLP */ | ||
1807 | clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, | ||
1808 | ARRAY_SIZE(cclk_lp_parents), | ||
1809 | CLK_SET_RATE_PARENT, | ||
1810 | clk_base + CCLKLP_BURST_POLICY, | ||
1811 | 0, 4, 8, 9, NULL); | ||
1812 | clk_register_clkdev(clk, "cclk_lp", NULL); | ||
1813 | clks[cclk_lp] = clk; | ||
1814 | |||
1815 | /* SCLK */ | ||
1816 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | ||
1817 | ARRAY_SIZE(sclk_parents), | ||
1818 | CLK_SET_RATE_PARENT, | ||
1819 | clk_base + SCLK_BURST_POLICY, | ||
1820 | 0, 4, 0, 0, NULL); | ||
1821 | clk_register_clkdev(clk, "sclk", NULL); | ||
1822 | clks[sclk] = clk; | ||
1823 | |||
1824 | /* HCLK */ | ||
1825 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
1826 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, | ||
1827 | &sysrate_lock); | ||
1828 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT | | ||
1829 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1830 | 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1831 | clk_register_clkdev(clk, "hclk", NULL); | ||
1832 | clks[hclk] = clk; | ||
1833 | |||
1834 | /* PCLK */ | ||
1835 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
1836 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, | ||
1837 | &sysrate_lock); | ||
1838 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | | ||
1839 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1840 | 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1841 | clk_register_clkdev(clk, "pclk", NULL); | ||
1842 | clks[pclk] = clk; | ||
1843 | } | ||
1844 | |||
1845 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { | ||
1846 | TEGRA_INIT_DATA_MUX("i2s0", NULL, "tegra30-i2s.0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s0), | ||
1847 | TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra30-i2s.1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1), | ||
1848 | TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra30-i2s.2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2), | ||
1849 | TEGRA_INIT_DATA_MUX("i2s3", NULL, "tegra30-i2s.3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s3), | ||
1850 | TEGRA_INIT_DATA_MUX("i2s4", NULL, "tegra30-i2s.4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s4), | ||
1851 | TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra30-spdif", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out), | ||
1852 | TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra30-spdif", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in), | ||
1853 | TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, &periph_l_regs, TEGRA_PERIPH_ON_APB, pwm), | ||
1854 | TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, &periph_w_regs, TEGRA_PERIPH_ON_APB, adx), | ||
1855 | TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, &periph_w_regs, TEGRA_PERIPH_ON_APB, amx), | ||
1856 | TEGRA_INIT_DATA_MUX("hda", "hda", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda), | ||
1857 | TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda2codec_2x), | ||
1858 | TEGRA_INIT_DATA_MUX("sbc1", NULL, "tegra11-spi.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1), | ||
1859 | TEGRA_INIT_DATA_MUX("sbc2", NULL, "tegra11-spi.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2), | ||
1860 | TEGRA_INIT_DATA_MUX("sbc3", NULL, "tegra11-spi.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3), | ||
1861 | TEGRA_INIT_DATA_MUX("sbc4", NULL, "tegra11-spi.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4), | ||
1862 | TEGRA_INIT_DATA_MUX("sbc5", NULL, "tegra11-spi.4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc5), | ||
1863 | TEGRA_INIT_DATA_MUX("sbc6", NULL, "tegra11-spi.5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc6), | ||
1864 | TEGRA_INIT_DATA_MUX8("ndflash", NULL, "tegra_nand", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), | ||
1865 | TEGRA_INIT_DATA_MUX8("ndspeed", NULL, "tegra_nand_speed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), | ||
1866 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), | ||
1867 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), | ||
1868 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), | ||
1869 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), | ||
1870 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), | ||
1871 | TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), | ||
1872 | TEGRA_INIT_DATA_MUX_FLAGS("csite", NULL, "csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, &periph_u_regs, TEGRA_PERIPH_ON_APB, csite, CLK_IGNORE_UNUSED), | ||
1873 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la), | ||
1874 | TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, &periph_u_regs, TEGRA_PERIPH_ON_APB, trace), | ||
1875 | TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, &periph_u_regs, TEGRA_PERIPH_ON_APB, owr), | ||
1876 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), | ||
1877 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), | ||
1878 | TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, i2c1), | ||
1879 | TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, i2c2), | ||
1880 | TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, i2c3), | ||
1881 | TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, i2c4), | ||
1882 | TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, i2c5), | ||
1883 | TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta), | ||
1884 | TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb), | ||
1885 | TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc), | ||
1886 | TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd), | ||
1887 | TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, &periph_l_regs, 0, gr_3d), | ||
1888 | TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr_2d), | ||
1889 | TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor), | ||
1890 | TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), | ||
1891 | TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), | ||
1892 | TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, &periph_u_regs, TEGRA_PERIPH_WAR_1005168, msenc), | ||
1893 | TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, &periph_u_regs, 0, tsec), | ||
1894 | TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), | ||
1895 | TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), | ||
1896 | TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, &periph_w_regs, 0, cilab), | ||
1897 | TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, &periph_w_regs, 0, cilcd), | ||
1898 | TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, &periph_w_regs, 0, cile), | ||
1899 | TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, &periph_w_regs, 0, dsialp), | ||
1900 | TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, &periph_w_regs, 0, dsiblp), | ||
1901 | TEGRA_INIT_DATA_MUX("tsensor", NULL, "tegra-tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, &periph_v_regs, TEGRA_PERIPH_ON_APB, tsensor), | ||
1902 | TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon), | ||
1903 | TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1), | ||
1904 | TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2), | ||
1905 | TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3), | ||
1906 | TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow), | ||
1907 | TEGRA_INIT_DATA_INT8("se", NULL, "se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, &periph_v_regs, TEGRA_PERIPH_ON_APB, se), | ||
1908 | TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect, CLK_IGNORE_UNUSED), | ||
1909 | TEGRA_INIT_DATA_MUX("dfll_ref", "ref", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, &periph_w_regs, TEGRA_PERIPH_ON_APB, dfll_ref), | ||
1910 | TEGRA_INIT_DATA_MUX("dfll_soc", "soc", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, &periph_w_regs, TEGRA_PERIPH_ON_APB, dfll_soc), | ||
1911 | TEGRA_INIT_DATA_MUX8("soc_therm", NULL, "soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, &periph_u_regs, TEGRA_PERIPH_ON_APB, soc_therm), | ||
1912 | TEGRA_INIT_DATA_XUSB("xusb_host_src", "host_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, &periph_w_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_host_src), | ||
1913 | TEGRA_INIT_DATA_XUSB("xusb_falcon_src", "falcon_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_falcon_src), | ||
1914 | TEGRA_INIT_DATA_XUSB("xusb_fs_src", "fs_src", "tegra_xhci", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_fs_src), | ||
1915 | TEGRA_INIT_DATA_XUSB("xusb_ss_src", "ss_src", "tegra_xhci", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_ss_src), | ||
1916 | TEGRA_INIT_DATA_XUSB("xusb_dev_src", "dev_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, &periph_u_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_dev_src), | ||
1917 | TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, TEGRA_PERIPH_ON_APB, d_audio), | ||
1918 | TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam0), | ||
1919 | TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam1), | ||
1920 | TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam2), | ||
1921 | }; | ||
1922 | |||
1923 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { | ||
1924 | TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, &periph_l_regs, 0, disp1), | ||
1925 | TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, &periph_l_regs, 0, disp2), | ||
1926 | }; | ||
1927 | 1191 | ||
1928 | static __init void tegra114_periph_clk_init(void __iomem *clk_base) | 1192 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, |
1929 | { | 1193 | 1, 1); |
1930 | struct tegra_periph_init_data *data; | 1194 | clks[TEGRA114_CLK_XUSB_HS_SRC] = clk; |
1931 | struct clk *clk; | ||
1932 | int i; | ||
1933 | u32 val; | ||
1934 | 1195 | ||
1935 | /* apbdma */ | 1196 | /* dsia mux */ |
1936 | clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, | ||
1937 | 0, 34, &periph_h_regs, | ||
1938 | periph_clk_enb_refcnt); | ||
1939 | clks[apbdma] = clk; | ||
1940 | |||
1941 | /* rtc */ | ||
1942 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", | ||
1943 | TEGRA_PERIPH_ON_APB | | ||
1944 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1945 | 0, 4, &periph_l_regs, | ||
1946 | periph_clk_enb_refcnt); | ||
1947 | clk_register_clkdev(clk, NULL, "rtc-tegra"); | ||
1948 | clks[rtc] = clk; | ||
1949 | |||
1950 | /* kbc */ | ||
1951 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", | ||
1952 | TEGRA_PERIPH_ON_APB | | ||
1953 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1954 | 0, 36, &periph_h_regs, | ||
1955 | periph_clk_enb_refcnt); | ||
1956 | clks[kbc] = clk; | ||
1957 | |||
1958 | /* timer */ | ||
1959 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, | ||
1960 | 0, 5, &periph_l_regs, | ||
1961 | periph_clk_enb_refcnt); | ||
1962 | clk_register_clkdev(clk, NULL, "timer"); | ||
1963 | clks[timer] = clk; | ||
1964 | |||
1965 | /* kfuse */ | ||
1966 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | ||
1967 | TEGRA_PERIPH_ON_APB, clk_base, 0, 40, | ||
1968 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1969 | clks[kfuse] = clk; | ||
1970 | |||
1971 | /* fuse */ | ||
1972 | clk = tegra_clk_register_periph_gate("fuse", "clk_m", | ||
1973 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1974 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1975 | clks[fuse] = clk; | ||
1976 | |||
1977 | /* fuse_burn */ | ||
1978 | clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", | ||
1979 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1980 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1981 | clks[fuse_burn] = clk; | ||
1982 | |||
1983 | /* apbif */ | ||
1984 | clk = tegra_clk_register_periph_gate("apbif", "clk_m", | ||
1985 | TEGRA_PERIPH_ON_APB, clk_base, 0, 107, | ||
1986 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1987 | clks[apbif] = clk; | ||
1988 | |||
1989 | /* hda2hdmi */ | ||
1990 | clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", | ||
1991 | TEGRA_PERIPH_ON_APB, clk_base, 0, 128, | ||
1992 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1993 | clks[hda2hdmi] = clk; | ||
1994 | |||
1995 | /* vcp */ | ||
1996 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, | ||
1997 | 29, &periph_l_regs, | ||
1998 | periph_clk_enb_refcnt); | ||
1999 | clks[vcp] = clk; | ||
2000 | |||
2001 | /* bsea */ | ||
2002 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, | ||
2003 | 0, 62, &periph_h_regs, | ||
2004 | periph_clk_enb_refcnt); | ||
2005 | clks[bsea] = clk; | ||
2006 | |||
2007 | /* bsev */ | ||
2008 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, | ||
2009 | 0, 63, &periph_h_regs, | ||
2010 | periph_clk_enb_refcnt); | ||
2011 | clks[bsev] = clk; | ||
2012 | |||
2013 | /* mipi-cal */ | ||
2014 | clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base, | ||
2015 | 0, 56, &periph_h_regs, | ||
2016 | periph_clk_enb_refcnt); | ||
2017 | clks[mipi_cal] = clk; | ||
2018 | |||
2019 | /* usbd */ | ||
2020 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, | ||
2021 | 0, 22, &periph_l_regs, | ||
2022 | periph_clk_enb_refcnt); | ||
2023 | clks[usbd] = clk; | ||
2024 | |||
2025 | /* usb2 */ | ||
2026 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, | ||
2027 | 0, 58, &periph_h_regs, | ||
2028 | periph_clk_enb_refcnt); | ||
2029 | clks[usb2] = clk; | ||
2030 | |||
2031 | /* usb3 */ | ||
2032 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, | ||
2033 | 0, 59, &periph_h_regs, | ||
2034 | periph_clk_enb_refcnt); | ||
2035 | clks[usb3] = clk; | ||
2036 | |||
2037 | /* csi */ | ||
2038 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, | ||
2039 | 0, 52, &periph_h_regs, | ||
2040 | periph_clk_enb_refcnt); | ||
2041 | clks[csi] = clk; | ||
2042 | |||
2043 | /* isp */ | ||
2044 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, | ||
2045 | 23, &periph_l_regs, | ||
2046 | periph_clk_enb_refcnt); | ||
2047 | clks[isp] = clk; | ||
2048 | |||
2049 | /* csus */ | ||
2050 | clk = tegra_clk_register_periph_gate("csus", "clk_m", | ||
2051 | TEGRA_PERIPH_NO_RESET, clk_base, 0, 92, | ||
2052 | &periph_u_regs, periph_clk_enb_refcnt); | ||
2053 | clks[csus] = clk; | ||
2054 | |||
2055 | /* dds */ | ||
2056 | clk = tegra_clk_register_periph_gate("dds", "clk_m", | ||
2057 | TEGRA_PERIPH_ON_APB, clk_base, 0, 150, | ||
2058 | &periph_w_regs, periph_clk_enb_refcnt); | ||
2059 | clks[dds] = clk; | ||
2060 | |||
2061 | /* dp2 */ | ||
2062 | clk = tegra_clk_register_periph_gate("dp2", "clk_m", | ||
2063 | TEGRA_PERIPH_ON_APB, clk_base, 0, 152, | ||
2064 | &periph_w_regs, periph_clk_enb_refcnt); | ||
2065 | clks[dp2] = clk; | ||
2066 | |||
2067 | /* dtv */ | ||
2068 | clk = tegra_clk_register_periph_gate("dtv", "clk_m", | ||
2069 | TEGRA_PERIPH_ON_APB, clk_base, 0, 79, | ||
2070 | &periph_u_regs, periph_clk_enb_refcnt); | ||
2071 | clks[dtv] = clk; | ||
2072 | |||
2073 | /* dsia */ | ||
2074 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, | 1197 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, |
2075 | ARRAY_SIZE(mux_plld_out0_plld2_out0), | 1198 | ARRAY_SIZE(mux_plld_out0_plld2_out0), |
2076 | CLK_SET_RATE_NO_REPARENT, | 1199 | CLK_SET_RATE_NO_REPARENT, |
2077 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); | 1200 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); |
2078 | clks[dsia_mux] = clk; | 1201 | clks[TEGRA114_CLK_DSIA_MUX] = clk; |
2079 | clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, | ||
2080 | 0, 48, &periph_h_regs, | ||
2081 | periph_clk_enb_refcnt); | ||
2082 | clks[dsia] = clk; | ||
2083 | 1202 | ||
2084 | /* dsib */ | 1203 | /* dsib mux */ |
2085 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, | 1204 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, |
2086 | ARRAY_SIZE(mux_plld_out0_plld2_out0), | 1205 | ARRAY_SIZE(mux_plld_out0_plld2_out0), |
2087 | CLK_SET_RATE_NO_REPARENT, | 1206 | CLK_SET_RATE_NO_REPARENT, |
2088 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); | 1207 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); |
2089 | clks[dsib_mux] = clk; | 1208 | clks[TEGRA114_CLK_DSIB_MUX] = clk; |
2090 | clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, | ||
2091 | 0, 82, &periph_u_regs, | ||
2092 | periph_clk_enb_refcnt); | ||
2093 | clks[dsib] = clk; | ||
2094 | 1209 | ||
2095 | /* xusb_hs_src */ | 1210 | /* emc mux */ |
2096 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
2097 | val |= BIT(25); /* always select PLLU_60M */ | ||
2098 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
2099 | |||
2100 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, | ||
2101 | 1, 1); | ||
2102 | clks[xusb_hs_src] = clk; | ||
2103 | |||
2104 | /* xusb_host */ | ||
2105 | clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0, | ||
2106 | clk_base, 0, 89, &periph_u_regs, | ||
2107 | periph_clk_enb_refcnt); | ||
2108 | clks[xusb_host] = clk; | ||
2109 | |||
2110 | /* xusb_ss */ | ||
2111 | clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0, | ||
2112 | clk_base, 0, 156, &periph_w_regs, | ||
2113 | periph_clk_enb_refcnt); | ||
2114 | clks[xusb_host] = clk; | ||
2115 | |||
2116 | /* xusb_dev */ | ||
2117 | clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0, | ||
2118 | clk_base, 0, 95, &periph_u_regs, | ||
2119 | periph_clk_enb_refcnt); | ||
2120 | clks[xusb_dev] = clk; | ||
2121 | |||
2122 | /* emc */ | ||
2123 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | 1211 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, |
2124 | ARRAY_SIZE(mux_pllmcp_clkm), | 1212 | ARRAY_SIZE(mux_pllmcp_clkm), |
2125 | CLK_SET_RATE_NO_REPARENT, | 1213 | CLK_SET_RATE_NO_REPARENT, |
2126 | clk_base + CLK_SOURCE_EMC, | 1214 | clk_base + CLK_SOURCE_EMC, |
2127 | 29, 3, 0, NULL); | 1215 | 29, 3, 0, NULL); |
2128 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, | ||
2129 | CLK_IGNORE_UNUSED, 57, &periph_h_regs, | ||
2130 | periph_clk_enb_refcnt); | ||
2131 | clks[emc] = clk; | ||
2132 | |||
2133 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { | ||
2134 | data = &tegra_periph_clk_list[i]; | ||
2135 | clk = tegra_clk_register_periph(data->name, data->parent_names, | ||
2136 | data->num_parents, &data->periph, | ||
2137 | clk_base, data->offset, data->flags); | ||
2138 | clks[data->clk_id] = clk; | ||
2139 | } | ||
2140 | 1216 | ||
2141 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { | 1217 | tegra_periph_clk_init(clk_base, pmc_base, tegra114_clks, |
2142 | data = &tegra_periph_nodiv_clk_list[i]; | 1218 | &pll_p_params); |
2143 | clk = tegra_clk_register_periph_nodiv(data->name, | ||
2144 | data->parent_names, data->num_parents, | ||
2145 | &data->periph, clk_base, data->offset); | ||
2146 | clks[data->clk_id] = clk; | ||
2147 | } | ||
2148 | } | 1219 | } |
2149 | 1220 | ||
2150 | /* Tegra114 CPU clock and reset control functions */ | 1221 | /* Tegra114 CPU clock and reset control functions */ |
@@ -2207,28 +1278,37 @@ static const struct of_device_id pmc_match[] __initconst = { | |||
2207 | * breaks | 1278 | * breaks |
2208 | */ | 1279 | */ |
2209 | static struct tegra_clk_init_table init_table[] __initdata = { | 1280 | static struct tegra_clk_init_table init_table[] __initdata = { |
2210 | {uarta, pll_p, 408000000, 0}, | 1281 | {TEGRA114_CLK_UARTA, TEGRA114_CLK_PLL_P, 408000000, 0}, |
2211 | {uartb, pll_p, 408000000, 0}, | 1282 | {TEGRA114_CLK_UARTB, TEGRA114_CLK_PLL_P, 408000000, 0}, |
2212 | {uartc, pll_p, 408000000, 0}, | 1283 | {TEGRA114_CLK_UARTC, TEGRA114_CLK_PLL_P, 408000000, 0}, |
2213 | {uartd, pll_p, 408000000, 0}, | 1284 | {TEGRA114_CLK_UARTD, TEGRA114_CLK_PLL_P, 408000000, 0}, |
2214 | {pll_a, clk_max, 564480000, 1}, | 1285 | {TEGRA114_CLK_PLL_A, TEGRA114_CLK_CLK_MAX, 564480000, 1}, |
2215 | {pll_a_out0, clk_max, 11289600, 1}, | 1286 | {TEGRA114_CLK_PLL_A_OUT0, TEGRA114_CLK_CLK_MAX, 11289600, 1}, |
2216 | {extern1, pll_a_out0, 0, 1}, | 1287 | {TEGRA114_CLK_EXTERN1, TEGRA114_CLK_PLL_A_OUT0, 0, 1}, |
2217 | {clk_out_1_mux, extern1, 0, 1}, | 1288 | {TEGRA114_CLK_CLK_OUT_1_MUX, TEGRA114_CLK_EXTERN1, 0, 1}, |
2218 | {clk_out_1, clk_max, 0, 1}, | 1289 | {TEGRA114_CLK_CLK_OUT_1, TEGRA114_CLK_CLK_MAX, 0, 1}, |
2219 | {i2s0, pll_a_out0, 11289600, 0}, | 1290 | {TEGRA114_CLK_I2S0, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
2220 | {i2s1, pll_a_out0, 11289600, 0}, | 1291 | {TEGRA114_CLK_I2S1, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
2221 | {i2s2, pll_a_out0, 11289600, 0}, | 1292 | {TEGRA114_CLK_I2S2, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
2222 | {i2s3, pll_a_out0, 11289600, 0}, | 1293 | {TEGRA114_CLK_I2S3, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
2223 | {i2s4, pll_a_out0, 11289600, 0}, | 1294 | {TEGRA114_CLK_I2S4, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0}, |
2224 | {dfll_soc, pll_p, 51000000, 1}, | 1295 | {TEGRA114_CLK_HOST1X, TEGRA114_CLK_PLL_P, 136000000, 0}, |
2225 | {dfll_ref, pll_p, 51000000, 1}, | 1296 | {TEGRA114_CLK_DFLL_SOC, TEGRA114_CLK_PLL_P, 51000000, 1}, |
2226 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | 1297 | {TEGRA114_CLK_DFLL_REF, TEGRA114_CLK_PLL_P, 51000000, 1}, |
1298 | {TEGRA114_CLK_DISP1, TEGRA114_CLK_PLL_P, 0, 0}, | ||
1299 | {TEGRA114_CLK_DISP2, TEGRA114_CLK_PLL_P, 0, 0}, | ||
1300 | {TEGRA114_CLK_GR2D, TEGRA114_CLK_PLL_C2, 300000000, 0}, | ||
1301 | {TEGRA114_CLK_GR3D, TEGRA114_CLK_PLL_C2, 300000000, 0}, | ||
1302 | {TEGRA114_CLK_DSIALP, TEGRA114_CLK_PLL_P, 68000000, 0}, | ||
1303 | {TEGRA114_CLK_DSIBLP, TEGRA114_CLK_PLL_P, 68000000, 0}, | ||
1304 | |||
1305 | /* This MUST be the last entry. */ | ||
1306 | {TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0}, | ||
2227 | }; | 1307 | }; |
2228 | 1308 | ||
2229 | static void __init tegra114_clock_apply_init_table(void) | 1309 | static void __init tegra114_clock_apply_init_table(void) |
2230 | { | 1310 | { |
2231 | tegra_init_from_table(init_table, clks, clk_max); | 1311 | tegra_init_from_table(init_table, clks, TEGRA114_CLK_CLK_MAX); |
2232 | } | 1312 | } |
2233 | 1313 | ||
2234 | 1314 | ||
@@ -2359,7 +1439,6 @@ EXPORT_SYMBOL(tegra114_clock_deassert_dfll_dvco_reset); | |||
2359 | static void __init tegra114_clock_init(struct device_node *np) | 1439 | static void __init tegra114_clock_init(struct device_node *np) |
2360 | { | 1440 | { |
2361 | struct device_node *node; | 1441 | struct device_node *node; |
2362 | int i; | ||
2363 | 1442 | ||
2364 | clk_base = of_iomap(np, 0); | 1443 | clk_base = of_iomap(np, 0); |
2365 | if (!clk_base) { | 1444 | if (!clk_base) { |
@@ -2381,29 +1460,24 @@ static void __init tegra114_clock_init(struct device_node *np) | |||
2381 | return; | 1460 | return; |
2382 | } | 1461 | } |
2383 | 1462 | ||
1463 | clks = tegra_clk_init(clk_base, TEGRA114_CLK_CLK_MAX, | ||
1464 | TEGRA114_CLK_PERIPH_BANKS); | ||
1465 | if (!clks) | ||
1466 | return; | ||
1467 | |||
2384 | if (tegra114_osc_clk_init(clk_base) < 0) | 1468 | if (tegra114_osc_clk_init(clk_base) < 0) |
2385 | return; | 1469 | return; |
2386 | 1470 | ||
2387 | tegra114_fixed_clk_init(clk_base); | 1471 | tegra114_fixed_clk_init(clk_base); |
2388 | tegra114_pll_init(clk_base, pmc_base); | 1472 | tegra114_pll_init(clk_base, pmc_base); |
2389 | tegra114_periph_clk_init(clk_base); | 1473 | tegra114_periph_clk_init(clk_base, pmc_base); |
2390 | tegra114_audio_clk_init(clk_base); | 1474 | tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, &pll_a_params); |
2391 | tegra114_pmc_clk_init(pmc_base); | 1475 | tegra_pmc_clk_init(pmc_base, tegra114_clks); |
2392 | tegra114_super_clk_init(clk_base); | 1476 | tegra_super_clk_gen4_init(clk_base, pmc_base, tegra114_clks, |
2393 | 1477 | &pll_x_params); | |
2394 | for (i = 0; i < ARRAY_SIZE(clks); i++) { | 1478 | |
2395 | if (IS_ERR(clks[i])) { | 1479 | tegra_add_of_provider(np); |
2396 | pr_err | 1480 | tegra_register_devclks(devclks, ARRAY_SIZE(devclks)); |
2397 | ("Tegra114 clk %d: register failed with %ld\n", | ||
2398 | i, PTR_ERR(clks[i])); | ||
2399 | } | ||
2400 | if (!clks[i]) | ||
2401 | clks[i] = ERR_PTR(-EINVAL); | ||
2402 | } | ||
2403 | |||
2404 | clk_data.clks = clks; | ||
2405 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
2406 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
2407 | 1481 | ||
2408 | tegra_clk_apply_init_table = tegra114_clock_apply_init_table; | 1482 | tegra_clk_apply_init_table = tegra114_clock_apply_init_table; |
2409 | 1483 | ||
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c new file mode 100644 index 000000000000..aff86b5bc745 --- /dev/null +++ b/drivers/clk/tegra/clk-tegra124.c | |||
@@ -0,0 +1,1424 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/clkdev.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_address.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/export.h> | ||
25 | #include <linux/clk/tegra.h> | ||
26 | #include <dt-bindings/clock/tegra124-car.h> | ||
27 | |||
28 | #include "clk.h" | ||
29 | #include "clk-id.h" | ||
30 | |||
31 | #define CLK_SOURCE_CSITE 0x1d4 | ||
32 | #define CLK_SOURCE_EMC 0x19c | ||
33 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 | ||
34 | |||
35 | #define PLLC_BASE 0x80 | ||
36 | #define PLLC_OUT 0x84 | ||
37 | #define PLLC_MISC2 0x88 | ||
38 | #define PLLC_MISC 0x8c | ||
39 | #define PLLC2_BASE 0x4e8 | ||
40 | #define PLLC2_MISC 0x4ec | ||
41 | #define PLLC3_BASE 0x4fc | ||
42 | #define PLLC3_MISC 0x500 | ||
43 | #define PLLM_BASE 0x90 | ||
44 | #define PLLM_OUT 0x94 | ||
45 | #define PLLM_MISC 0x9c | ||
46 | #define PLLP_BASE 0xa0 | ||
47 | #define PLLP_MISC 0xac | ||
48 | #define PLLA_BASE 0xb0 | ||
49 | #define PLLA_MISC 0xbc | ||
50 | #define PLLD_BASE 0xd0 | ||
51 | #define PLLD_MISC 0xdc | ||
52 | #define PLLU_BASE 0xc0 | ||
53 | #define PLLU_MISC 0xcc | ||
54 | #define PLLX_BASE 0xe0 | ||
55 | #define PLLX_MISC 0xe4 | ||
56 | #define PLLX_MISC2 0x514 | ||
57 | #define PLLX_MISC3 0x518 | ||
58 | #define PLLE_BASE 0xe8 | ||
59 | #define PLLE_MISC 0xec | ||
60 | #define PLLD2_BASE 0x4b8 | ||
61 | #define PLLD2_MISC 0x4bc | ||
62 | #define PLLE_AUX 0x48c | ||
63 | #define PLLRE_BASE 0x4c4 | ||
64 | #define PLLRE_MISC 0x4c8 | ||
65 | #define PLLDP_BASE 0x590 | ||
66 | #define PLLDP_MISC 0x594 | ||
67 | #define PLLC4_BASE 0x5a4 | ||
68 | #define PLLC4_MISC 0x5a8 | ||
69 | |||
70 | #define PLLC_IDDQ_BIT 26 | ||
71 | #define PLLRE_IDDQ_BIT 16 | ||
72 | #define PLLSS_IDDQ_BIT 19 | ||
73 | |||
74 | #define PLL_BASE_LOCK BIT(27) | ||
75 | #define PLLE_MISC_LOCK BIT(11) | ||
76 | #define PLLRE_MISC_LOCK BIT(24) | ||
77 | |||
78 | #define PLL_MISC_LOCK_ENABLE 18 | ||
79 | #define PLLC_MISC_LOCK_ENABLE 24 | ||
80 | #define PLLDU_MISC_LOCK_ENABLE 22 | ||
81 | #define PLLE_MISC_LOCK_ENABLE 9 | ||
82 | #define PLLRE_MISC_LOCK_ENABLE 30 | ||
83 | #define PLLSS_MISC_LOCK_ENABLE 30 | ||
84 | |||
85 | #define PLLXC_SW_MAX_P 6 | ||
86 | |||
87 | #define PMC_PLLM_WB0_OVERRIDE 0x1dc | ||
88 | #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 | ||
89 | |||
90 | #define UTMIP_PLL_CFG2 0x488 | ||
91 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) | ||
92 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) | ||
93 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0) | ||
94 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2) | ||
95 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4) | ||
96 | |||
97 | #define UTMIP_PLL_CFG1 0x484 | ||
98 | #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6) | ||
99 | #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) | ||
100 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17) | ||
101 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16) | ||
102 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15) | ||
103 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14) | ||
104 | #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12) | ||
105 | |||
106 | #define UTMIPLL_HW_PWRDN_CFG0 0x52c | ||
107 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25) | ||
108 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24) | ||
109 | #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6) | ||
110 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5) | ||
111 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4) | ||
112 | #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2) | ||
113 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) | ||
114 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) | ||
115 | |||
116 | /* Tegra CPU clock and reset control regs */ | ||
117 | #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 | ||
118 | |||
119 | #ifdef CONFIG_PM_SLEEP | ||
120 | static struct cpu_clk_suspend_context { | ||
121 | u32 clk_csite_src; | ||
122 | } tegra124_cpu_clk_sctx; | ||
123 | #endif | ||
124 | |||
125 | static void __iomem *clk_base; | ||
126 | static void __iomem *pmc_base; | ||
127 | |||
128 | static unsigned long osc_freq; | ||
129 | static unsigned long pll_ref_freq; | ||
130 | |||
131 | static DEFINE_SPINLOCK(pll_d_lock); | ||
132 | static DEFINE_SPINLOCK(pll_d2_lock); | ||
133 | static DEFINE_SPINLOCK(pll_e_lock); | ||
134 | static DEFINE_SPINLOCK(pll_re_lock); | ||
135 | static DEFINE_SPINLOCK(pll_u_lock); | ||
136 | |||
137 | /* possible OSC frequencies in Hz */ | ||
138 | static unsigned long tegra124_input_freq[] = { | ||
139 | [0] = 13000000, | ||
140 | [1] = 16800000, | ||
141 | [4] = 19200000, | ||
142 | [5] = 38400000, | ||
143 | [8] = 12000000, | ||
144 | [9] = 48000000, | ||
145 | [12] = 260000000, | ||
146 | }; | ||
147 | |||
148 | static const char *mux_plld_out0_plld2_out0[] = { | ||
149 | "pll_d_out0", "pll_d2_out0", | ||
150 | }; | ||
151 | #define mux_plld_out0_plld2_out0_idx NULL | ||
152 | |||
153 | static const char *mux_pllmcp_clkm[] = { | ||
154 | "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_c2", "pll_c3", | ||
155 | }; | ||
156 | #define mux_pllmcp_clkm_idx NULL | ||
157 | |||
158 | static struct div_nmp pllxc_nmp = { | ||
159 | .divm_shift = 0, | ||
160 | .divm_width = 8, | ||
161 | .divn_shift = 8, | ||
162 | .divn_width = 8, | ||
163 | .divp_shift = 20, | ||
164 | .divp_width = 4, | ||
165 | }; | ||
166 | |||
167 | static struct pdiv_map pllxc_p[] = { | ||
168 | { .pdiv = 1, .hw_val = 0 }, | ||
169 | { .pdiv = 2, .hw_val = 1 }, | ||
170 | { .pdiv = 3, .hw_val = 2 }, | ||
171 | { .pdiv = 4, .hw_val = 3 }, | ||
172 | { .pdiv = 5, .hw_val = 4 }, | ||
173 | { .pdiv = 6, .hw_val = 5 }, | ||
174 | { .pdiv = 8, .hw_val = 6 }, | ||
175 | { .pdiv = 10, .hw_val = 7 }, | ||
176 | { .pdiv = 12, .hw_val = 8 }, | ||
177 | { .pdiv = 16, .hw_val = 9 }, | ||
178 | { .pdiv = 12, .hw_val = 10 }, | ||
179 | { .pdiv = 16, .hw_val = 11 }, | ||
180 | { .pdiv = 20, .hw_val = 12 }, | ||
181 | { .pdiv = 24, .hw_val = 13 }, | ||
182 | { .pdiv = 32, .hw_val = 14 }, | ||
183 | { .pdiv = 0, .hw_val = 0 }, | ||
184 | }; | ||
185 | |||
186 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | ||
187 | /* 1 GHz */ | ||
188 | {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */ | ||
189 | {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */ | ||
190 | {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */ | ||
191 | {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */ | ||
192 | {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */ | ||
193 | {0, 0, 0, 0, 0, 0}, | ||
194 | }; | ||
195 | |||
196 | static struct tegra_clk_pll_params pll_x_params = { | ||
197 | .input_min = 12000000, | ||
198 | .input_max = 800000000, | ||
199 | .cf_min = 12000000, | ||
200 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
201 | .vco_min = 700000000, | ||
202 | .vco_max = 3000000000UL, | ||
203 | .base_reg = PLLX_BASE, | ||
204 | .misc_reg = PLLX_MISC, | ||
205 | .lock_mask = PLL_BASE_LOCK, | ||
206 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
207 | .lock_delay = 300, | ||
208 | .iddq_reg = PLLX_MISC3, | ||
209 | .iddq_bit_idx = 3, | ||
210 | .max_p = 6, | ||
211 | .dyn_ramp_reg = PLLX_MISC2, | ||
212 | .stepa_shift = 16, | ||
213 | .stepb_shift = 24, | ||
214 | .pdiv_tohw = pllxc_p, | ||
215 | .div_nmp = &pllxc_nmp, | ||
216 | .freq_table = pll_x_freq_table, | ||
217 | .flags = TEGRA_PLL_USE_LOCK, | ||
218 | }; | ||
219 | |||
220 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | ||
221 | { 12000000, 624000000, 104, 1, 2}, | ||
222 | { 12000000, 600000000, 100, 1, 2}, | ||
223 | { 13000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
224 | { 16800000, 600000000, 71, 1, 2}, /* actual: 596.4 MHz */ | ||
225 | { 19200000, 600000000, 62, 1, 2}, /* actual: 595.2 MHz */ | ||
226 | { 26000000, 600000000, 92, 2, 2}, /* actual: 598.0 MHz */ | ||
227 | { 0, 0, 0, 0, 0, 0 }, | ||
228 | }; | ||
229 | |||
230 | static struct tegra_clk_pll_params pll_c_params = { | ||
231 | .input_min = 12000000, | ||
232 | .input_max = 800000000, | ||
233 | .cf_min = 12000000, | ||
234 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
235 | .vco_min = 600000000, | ||
236 | .vco_max = 1400000000, | ||
237 | .base_reg = PLLC_BASE, | ||
238 | .misc_reg = PLLC_MISC, | ||
239 | .lock_mask = PLL_BASE_LOCK, | ||
240 | .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE, | ||
241 | .lock_delay = 300, | ||
242 | .iddq_reg = PLLC_MISC, | ||
243 | .iddq_bit_idx = PLLC_IDDQ_BIT, | ||
244 | .max_p = PLLXC_SW_MAX_P, | ||
245 | .dyn_ramp_reg = PLLC_MISC2, | ||
246 | .stepa_shift = 17, | ||
247 | .stepb_shift = 9, | ||
248 | .pdiv_tohw = pllxc_p, | ||
249 | .div_nmp = &pllxc_nmp, | ||
250 | .freq_table = pll_c_freq_table, | ||
251 | .flags = TEGRA_PLL_USE_LOCK, | ||
252 | }; | ||
253 | |||
254 | static struct div_nmp pllcx_nmp = { | ||
255 | .divm_shift = 0, | ||
256 | .divm_width = 2, | ||
257 | .divn_shift = 8, | ||
258 | .divn_width = 8, | ||
259 | .divp_shift = 20, | ||
260 | .divp_width = 3, | ||
261 | }; | ||
262 | |||
263 | static struct pdiv_map pllc_p[] = { | ||
264 | { .pdiv = 1, .hw_val = 0 }, | ||
265 | { .pdiv = 2, .hw_val = 1 }, | ||
266 | { .pdiv = 3, .hw_val = 2 }, | ||
267 | { .pdiv = 4, .hw_val = 3 }, | ||
268 | { .pdiv = 6, .hw_val = 4 }, | ||
269 | { .pdiv = 8, .hw_val = 5 }, | ||
270 | { .pdiv = 12, .hw_val = 6 }, | ||
271 | { .pdiv = 16, .hw_val = 7 }, | ||
272 | { .pdiv = 0, .hw_val = 0 }, | ||
273 | }; | ||
274 | |||
275 | static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = { | ||
276 | {12000000, 600000000, 100, 1, 2}, | ||
277 | {13000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
278 | {16800000, 600000000, 71, 1, 2}, /* actual: 596.4 MHz */ | ||
279 | {19200000, 600000000, 62, 1, 2}, /* actual: 595.2 MHz */ | ||
280 | {26000000, 600000000, 92, 2, 2}, /* actual: 598.0 MHz */ | ||
281 | {0, 0, 0, 0, 0, 0}, | ||
282 | }; | ||
283 | |||
284 | static struct tegra_clk_pll_params pll_c2_params = { | ||
285 | .input_min = 12000000, | ||
286 | .input_max = 48000000, | ||
287 | .cf_min = 12000000, | ||
288 | .cf_max = 19200000, | ||
289 | .vco_min = 600000000, | ||
290 | .vco_max = 1200000000, | ||
291 | .base_reg = PLLC2_BASE, | ||
292 | .misc_reg = PLLC2_MISC, | ||
293 | .lock_mask = PLL_BASE_LOCK, | ||
294 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
295 | .lock_delay = 300, | ||
296 | .pdiv_tohw = pllc_p, | ||
297 | .div_nmp = &pllcx_nmp, | ||
298 | .max_p = 7, | ||
299 | .ext_misc_reg[0] = 0x4f0, | ||
300 | .ext_misc_reg[1] = 0x4f4, | ||
301 | .ext_misc_reg[2] = 0x4f8, | ||
302 | .freq_table = pll_cx_freq_table, | ||
303 | .flags = TEGRA_PLL_USE_LOCK, | ||
304 | }; | ||
305 | |||
306 | static struct tegra_clk_pll_params pll_c3_params = { | ||
307 | .input_min = 12000000, | ||
308 | .input_max = 48000000, | ||
309 | .cf_min = 12000000, | ||
310 | .cf_max = 19200000, | ||
311 | .vco_min = 600000000, | ||
312 | .vco_max = 1200000000, | ||
313 | .base_reg = PLLC3_BASE, | ||
314 | .misc_reg = PLLC3_MISC, | ||
315 | .lock_mask = PLL_BASE_LOCK, | ||
316 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
317 | .lock_delay = 300, | ||
318 | .pdiv_tohw = pllc_p, | ||
319 | .div_nmp = &pllcx_nmp, | ||
320 | .max_p = 7, | ||
321 | .ext_misc_reg[0] = 0x504, | ||
322 | .ext_misc_reg[1] = 0x508, | ||
323 | .ext_misc_reg[2] = 0x50c, | ||
324 | .freq_table = pll_cx_freq_table, | ||
325 | .flags = TEGRA_PLL_USE_LOCK, | ||
326 | }; | ||
327 | |||
328 | static struct div_nmp pllss_nmp = { | ||
329 | .divm_shift = 0, | ||
330 | .divm_width = 8, | ||
331 | .divn_shift = 8, | ||
332 | .divn_width = 8, | ||
333 | .divp_shift = 20, | ||
334 | .divp_width = 4, | ||
335 | }; | ||
336 | |||
337 | static struct pdiv_map pll12g_ssd_esd_p[] = { | ||
338 | { .pdiv = 1, .hw_val = 0 }, | ||
339 | { .pdiv = 2, .hw_val = 1 }, | ||
340 | { .pdiv = 3, .hw_val = 2 }, | ||
341 | { .pdiv = 4, .hw_val = 3 }, | ||
342 | { .pdiv = 5, .hw_val = 4 }, | ||
343 | { .pdiv = 6, .hw_val = 5 }, | ||
344 | { .pdiv = 8, .hw_val = 6 }, | ||
345 | { .pdiv = 10, .hw_val = 7 }, | ||
346 | { .pdiv = 12, .hw_val = 8 }, | ||
347 | { .pdiv = 16, .hw_val = 9 }, | ||
348 | { .pdiv = 12, .hw_val = 10 }, | ||
349 | { .pdiv = 16, .hw_val = 11 }, | ||
350 | { .pdiv = 20, .hw_val = 12 }, | ||
351 | { .pdiv = 24, .hw_val = 13 }, | ||
352 | { .pdiv = 32, .hw_val = 14 }, | ||
353 | { .pdiv = 0, .hw_val = 0 }, | ||
354 | }; | ||
355 | |||
356 | static struct tegra_clk_pll_freq_table pll_c4_freq_table[] = { | ||
357 | { 12000000, 600000000, 100, 1, 1}, | ||
358 | { 13000000, 600000000, 92, 1, 1}, /* actual: 598.0 MHz */ | ||
359 | { 16800000, 600000000, 71, 1, 1}, /* actual: 596.4 MHz */ | ||
360 | { 19200000, 600000000, 62, 1, 1}, /* actual: 595.2 MHz */ | ||
361 | { 26000000, 600000000, 92, 2, 1}, /* actual: 598.0 MHz */ | ||
362 | { 0, 0, 0, 0, 0, 0 }, | ||
363 | }; | ||
364 | |||
365 | static struct tegra_clk_pll_params pll_c4_params = { | ||
366 | .input_min = 12000000, | ||
367 | .input_max = 1000000000, | ||
368 | .cf_min = 12000000, | ||
369 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
370 | .vco_min = 600000000, | ||
371 | .vco_max = 1200000000, | ||
372 | .base_reg = PLLC4_BASE, | ||
373 | .misc_reg = PLLC4_MISC, | ||
374 | .lock_mask = PLL_BASE_LOCK, | ||
375 | .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE, | ||
376 | .lock_delay = 300, | ||
377 | .iddq_reg = PLLC4_BASE, | ||
378 | .iddq_bit_idx = PLLSS_IDDQ_BIT, | ||
379 | .pdiv_tohw = pll12g_ssd_esd_p, | ||
380 | .div_nmp = &pllss_nmp, | ||
381 | .ext_misc_reg[0] = 0x5ac, | ||
382 | .ext_misc_reg[1] = 0x5b0, | ||
383 | .ext_misc_reg[2] = 0x5b4, | ||
384 | .freq_table = pll_c4_freq_table, | ||
385 | }; | ||
386 | |||
387 | static struct pdiv_map pllm_p[] = { | ||
388 | { .pdiv = 1, .hw_val = 0 }, | ||
389 | { .pdiv = 2, .hw_val = 1 }, | ||
390 | { .pdiv = 0, .hw_val = 0 }, | ||
391 | }; | ||
392 | |||
393 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | ||
394 | {12000000, 800000000, 66, 1, 1}, /* actual: 792.0 MHz */ | ||
395 | {13000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */ | ||
396 | {16800000, 800000000, 47, 1, 1}, /* actual: 789.6 MHz */ | ||
397 | {19200000, 800000000, 41, 1, 1}, /* actual: 787.2 MHz */ | ||
398 | {26000000, 800000000, 61, 2, 1}, /* actual: 793.0 MHz */ | ||
399 | {0, 0, 0, 0, 0, 0}, | ||
400 | }; | ||
401 | |||
402 | static struct div_nmp pllm_nmp = { | ||
403 | .divm_shift = 0, | ||
404 | .divm_width = 8, | ||
405 | .override_divm_shift = 0, | ||
406 | .divn_shift = 8, | ||
407 | .divn_width = 8, | ||
408 | .override_divn_shift = 8, | ||
409 | .divp_shift = 20, | ||
410 | .divp_width = 1, | ||
411 | .override_divp_shift = 27, | ||
412 | }; | ||
413 | |||
414 | static struct tegra_clk_pll_params pll_m_params = { | ||
415 | .input_min = 12000000, | ||
416 | .input_max = 500000000, | ||
417 | .cf_min = 12000000, | ||
418 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
419 | .vco_min = 400000000, | ||
420 | .vco_max = 1066000000, | ||
421 | .base_reg = PLLM_BASE, | ||
422 | .misc_reg = PLLM_MISC, | ||
423 | .lock_mask = PLL_BASE_LOCK, | ||
424 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
425 | .lock_delay = 300, | ||
426 | .max_p = 2, | ||
427 | .pdiv_tohw = pllm_p, | ||
428 | .div_nmp = &pllm_nmp, | ||
429 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, | ||
430 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2, | ||
431 | .freq_table = pll_m_freq_table, | ||
432 | .flags = TEGRA_PLL_USE_LOCK, | ||
433 | }; | ||
434 | |||
435 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | ||
436 | /* PLLE special case: use cpcon field to store cml divider value */ | ||
437 | {336000000, 100000000, 100, 21, 16, 11}, | ||
438 | {312000000, 100000000, 200, 26, 24, 13}, | ||
439 | {13000000, 100000000, 200, 1, 26, 13}, | ||
440 | {12000000, 100000000, 200, 1, 24, 13}, | ||
441 | {0, 0, 0, 0, 0, 0}, | ||
442 | }; | ||
443 | |||
444 | static struct div_nmp plle_nmp = { | ||
445 | .divm_shift = 0, | ||
446 | .divm_width = 8, | ||
447 | .divn_shift = 8, | ||
448 | .divn_width = 8, | ||
449 | .divp_shift = 24, | ||
450 | .divp_width = 4, | ||
451 | }; | ||
452 | |||
453 | static struct tegra_clk_pll_params pll_e_params = { | ||
454 | .input_min = 12000000, | ||
455 | .input_max = 1000000000, | ||
456 | .cf_min = 12000000, | ||
457 | .cf_max = 75000000, | ||
458 | .vco_min = 1600000000, | ||
459 | .vco_max = 2400000000U, | ||
460 | .base_reg = PLLE_BASE, | ||
461 | .misc_reg = PLLE_MISC, | ||
462 | .aux_reg = PLLE_AUX, | ||
463 | .lock_mask = PLLE_MISC_LOCK, | ||
464 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | ||
465 | .lock_delay = 300, | ||
466 | .div_nmp = &plle_nmp, | ||
467 | .freq_table = pll_e_freq_table, | ||
468 | .flags = TEGRA_PLL_FIXED, | ||
469 | .fixed_rate = 100000000, | ||
470 | }; | ||
471 | |||
472 | static const struct clk_div_table pll_re_div_table[] = { | ||
473 | { .val = 0, .div = 1 }, | ||
474 | { .val = 1, .div = 2 }, | ||
475 | { .val = 2, .div = 3 }, | ||
476 | { .val = 3, .div = 4 }, | ||
477 | { .val = 4, .div = 5 }, | ||
478 | { .val = 5, .div = 6 }, | ||
479 | { .val = 0, .div = 0 }, | ||
480 | }; | ||
481 | |||
482 | static struct div_nmp pllre_nmp = { | ||
483 | .divm_shift = 0, | ||
484 | .divm_width = 8, | ||
485 | .divn_shift = 8, | ||
486 | .divn_width = 8, | ||
487 | .divp_shift = 16, | ||
488 | .divp_width = 4, | ||
489 | }; | ||
490 | |||
491 | static struct tegra_clk_pll_params pll_re_vco_params = { | ||
492 | .input_min = 12000000, | ||
493 | .input_max = 1000000000, | ||
494 | .cf_min = 12000000, | ||
495 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
496 | .vco_min = 300000000, | ||
497 | .vco_max = 600000000, | ||
498 | .base_reg = PLLRE_BASE, | ||
499 | .misc_reg = PLLRE_MISC, | ||
500 | .lock_mask = PLLRE_MISC_LOCK, | ||
501 | .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE, | ||
502 | .lock_delay = 300, | ||
503 | .iddq_reg = PLLRE_MISC, | ||
504 | .iddq_bit_idx = PLLRE_IDDQ_BIT, | ||
505 | .div_nmp = &pllre_nmp, | ||
506 | .flags = TEGRA_PLL_USE_LOCK, | ||
507 | }; | ||
508 | |||
509 | static struct div_nmp pllp_nmp = { | ||
510 | .divm_shift = 0, | ||
511 | .divm_width = 5, | ||
512 | .divn_shift = 8, | ||
513 | .divn_width = 10, | ||
514 | .divp_shift = 20, | ||
515 | .divp_width = 3, | ||
516 | }; | ||
517 | |||
518 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | ||
519 | {12000000, 216000000, 432, 12, 1, 8}, | ||
520 | {13000000, 216000000, 432, 13, 1, 8}, | ||
521 | {16800000, 216000000, 360, 14, 1, 8}, | ||
522 | {19200000, 216000000, 360, 16, 1, 8}, | ||
523 | {26000000, 216000000, 432, 26, 1, 8}, | ||
524 | {0, 0, 0, 0, 0, 0}, | ||
525 | }; | ||
526 | |||
527 | static struct tegra_clk_pll_params pll_p_params = { | ||
528 | .input_min = 2000000, | ||
529 | .input_max = 31000000, | ||
530 | .cf_min = 1000000, | ||
531 | .cf_max = 6000000, | ||
532 | .vco_min = 200000000, | ||
533 | .vco_max = 700000000, | ||
534 | .base_reg = PLLP_BASE, | ||
535 | .misc_reg = PLLP_MISC, | ||
536 | .lock_mask = PLL_BASE_LOCK, | ||
537 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
538 | .lock_delay = 300, | ||
539 | .div_nmp = &pllp_nmp, | ||
540 | .freq_table = pll_p_freq_table, | ||
541 | .fixed_rate = 408000000, | ||
542 | .flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, | ||
543 | }; | ||
544 | |||
545 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | ||
546 | {9600000, 282240000, 147, 5, 0, 4}, | ||
547 | {9600000, 368640000, 192, 5, 0, 4}, | ||
548 | {9600000, 240000000, 200, 8, 0, 8}, | ||
549 | |||
550 | {28800000, 282240000, 245, 25, 0, 8}, | ||
551 | {28800000, 368640000, 320, 25, 0, 8}, | ||
552 | {28800000, 240000000, 200, 24, 0, 8}, | ||
553 | {0, 0, 0, 0, 0, 0}, | ||
554 | }; | ||
555 | |||
556 | static struct tegra_clk_pll_params pll_a_params = { | ||
557 | .input_min = 2000000, | ||
558 | .input_max = 31000000, | ||
559 | .cf_min = 1000000, | ||
560 | .cf_max = 6000000, | ||
561 | .vco_min = 200000000, | ||
562 | .vco_max = 700000000, | ||
563 | .base_reg = PLLA_BASE, | ||
564 | .misc_reg = PLLA_MISC, | ||
565 | .lock_mask = PLL_BASE_LOCK, | ||
566 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
567 | .lock_delay = 300, | ||
568 | .div_nmp = &pllp_nmp, | ||
569 | .freq_table = pll_a_freq_table, | ||
570 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | ||
571 | }; | ||
572 | |||
573 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | ||
574 | {12000000, 216000000, 864, 12, 4, 12}, | ||
575 | {13000000, 216000000, 864, 13, 4, 12}, | ||
576 | {16800000, 216000000, 720, 14, 4, 12}, | ||
577 | {19200000, 216000000, 720, 16, 4, 12}, | ||
578 | {26000000, 216000000, 864, 26, 4, 12}, | ||
579 | |||
580 | {12000000, 594000000, 594, 12, 1, 12}, | ||
581 | {13000000, 594000000, 594, 13, 1, 12}, | ||
582 | {16800000, 594000000, 495, 14, 1, 12}, | ||
583 | {19200000, 594000000, 495, 16, 1, 12}, | ||
584 | {26000000, 594000000, 594, 26, 1, 12}, | ||
585 | |||
586 | {12000000, 1000000000, 1000, 12, 1, 12}, | ||
587 | {13000000, 1000000000, 1000, 13, 1, 12}, | ||
588 | {19200000, 1000000000, 625, 12, 1, 12}, | ||
589 | {26000000, 1000000000, 1000, 26, 1, 12}, | ||
590 | |||
591 | {0, 0, 0, 0, 0, 0}, | ||
592 | }; | ||
593 | |||
594 | static struct tegra_clk_pll_params pll_d_params = { | ||
595 | .input_min = 2000000, | ||
596 | .input_max = 40000000, | ||
597 | .cf_min = 1000000, | ||
598 | .cf_max = 6000000, | ||
599 | .vco_min = 500000000, | ||
600 | .vco_max = 1000000000, | ||
601 | .base_reg = PLLD_BASE, | ||
602 | .misc_reg = PLLD_MISC, | ||
603 | .lock_mask = PLL_BASE_LOCK, | ||
604 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
605 | .lock_delay = 1000, | ||
606 | .div_nmp = &pllp_nmp, | ||
607 | .freq_table = pll_d_freq_table, | ||
608 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
609 | TEGRA_PLL_USE_LOCK, | ||
610 | }; | ||
611 | |||
612 | static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = { | ||
613 | { 12000000, 148500000, 99, 1, 8}, | ||
614 | { 12000000, 594000000, 99, 1, 1}, | ||
615 | { 13000000, 594000000, 91, 1, 1}, /* actual: 591.5 MHz */ | ||
616 | { 16800000, 594000000, 71, 1, 1}, /* actual: 596.4 MHz */ | ||
617 | { 19200000, 594000000, 62, 1, 1}, /* actual: 595.2 MHz */ | ||
618 | { 26000000, 594000000, 91, 2, 1}, /* actual: 591.5 MHz */ | ||
619 | { 0, 0, 0, 0, 0, 0 }, | ||
620 | }; | ||
621 | |||
622 | static struct tegra_clk_pll_params tegra124_pll_d2_params = { | ||
623 | .input_min = 12000000, | ||
624 | .input_max = 1000000000, | ||
625 | .cf_min = 12000000, | ||
626 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
627 | .vco_min = 600000000, | ||
628 | .vco_max = 1200000000, | ||
629 | .base_reg = PLLD2_BASE, | ||
630 | .misc_reg = PLLD2_MISC, | ||
631 | .lock_mask = PLL_BASE_LOCK, | ||
632 | .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE, | ||
633 | .lock_delay = 300, | ||
634 | .iddq_reg = PLLD2_BASE, | ||
635 | .iddq_bit_idx = PLLSS_IDDQ_BIT, | ||
636 | .pdiv_tohw = pll12g_ssd_esd_p, | ||
637 | .div_nmp = &pllss_nmp, | ||
638 | .ext_misc_reg[0] = 0x570, | ||
639 | .ext_misc_reg[1] = 0x574, | ||
640 | .ext_misc_reg[2] = 0x578, | ||
641 | .max_p = 15, | ||
642 | .freq_table = tegra124_pll_d2_freq_table, | ||
643 | }; | ||
644 | |||
645 | static struct tegra_clk_pll_freq_table pll_dp_freq_table[] = { | ||
646 | { 12000000, 600000000, 100, 1, 1}, | ||
647 | { 13000000, 600000000, 92, 1, 1}, /* actual: 598.0 MHz */ | ||
648 | { 16800000, 600000000, 71, 1, 1}, /* actual: 596.4 MHz */ | ||
649 | { 19200000, 600000000, 62, 1, 1}, /* actual: 595.2 MHz */ | ||
650 | { 26000000, 600000000, 92, 2, 1}, /* actual: 598.0 MHz */ | ||
651 | { 0, 0, 0, 0, 0, 0 }, | ||
652 | }; | ||
653 | |||
654 | static struct tegra_clk_pll_params pll_dp_params = { | ||
655 | .input_min = 12000000, | ||
656 | .input_max = 1000000000, | ||
657 | .cf_min = 12000000, | ||
658 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
659 | .vco_min = 600000000, | ||
660 | .vco_max = 1200000000, | ||
661 | .base_reg = PLLDP_BASE, | ||
662 | .misc_reg = PLLDP_MISC, | ||
663 | .lock_mask = PLL_BASE_LOCK, | ||
664 | .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE, | ||
665 | .lock_delay = 300, | ||
666 | .iddq_reg = PLLDP_BASE, | ||
667 | .iddq_bit_idx = PLLSS_IDDQ_BIT, | ||
668 | .pdiv_tohw = pll12g_ssd_esd_p, | ||
669 | .div_nmp = &pllss_nmp, | ||
670 | .ext_misc_reg[0] = 0x598, | ||
671 | .ext_misc_reg[1] = 0x59c, | ||
672 | .ext_misc_reg[2] = 0x5a0, | ||
673 | .max_p = 5, | ||
674 | .freq_table = pll_dp_freq_table, | ||
675 | }; | ||
676 | |||
677 | static struct pdiv_map pllu_p[] = { | ||
678 | { .pdiv = 1, .hw_val = 1 }, | ||
679 | { .pdiv = 2, .hw_val = 0 }, | ||
680 | { .pdiv = 0, .hw_val = 0 }, | ||
681 | }; | ||
682 | |||
683 | static struct div_nmp pllu_nmp = { | ||
684 | .divm_shift = 0, | ||
685 | .divm_width = 5, | ||
686 | .divn_shift = 8, | ||
687 | .divn_width = 10, | ||
688 | .divp_shift = 20, | ||
689 | .divp_width = 1, | ||
690 | }; | ||
691 | |||
692 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | ||
693 | {12000000, 480000000, 960, 12, 2, 12}, | ||
694 | {13000000, 480000000, 960, 13, 2, 12}, | ||
695 | {16800000, 480000000, 400, 7, 2, 5}, | ||
696 | {19200000, 480000000, 200, 4, 2, 3}, | ||
697 | {26000000, 480000000, 960, 26, 2, 12}, | ||
698 | {0, 0, 0, 0, 0, 0}, | ||
699 | }; | ||
700 | |||
701 | static struct tegra_clk_pll_params pll_u_params = { | ||
702 | .input_min = 2000000, | ||
703 | .input_max = 40000000, | ||
704 | .cf_min = 1000000, | ||
705 | .cf_max = 6000000, | ||
706 | .vco_min = 480000000, | ||
707 | .vco_max = 960000000, | ||
708 | .base_reg = PLLU_BASE, | ||
709 | .misc_reg = PLLU_MISC, | ||
710 | .lock_mask = PLL_BASE_LOCK, | ||
711 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
712 | .lock_delay = 1000, | ||
713 | .pdiv_tohw = pllu_p, | ||
714 | .div_nmp = &pllu_nmp, | ||
715 | .freq_table = pll_u_freq_table, | ||
716 | .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
717 | TEGRA_PLL_USE_LOCK, | ||
718 | }; | ||
719 | |||
720 | struct utmi_clk_param { | ||
721 | /* Oscillator Frequency in KHz */ | ||
722 | u32 osc_frequency; | ||
723 | /* UTMIP PLL Enable Delay Count */ | ||
724 | u8 enable_delay_count; | ||
725 | /* UTMIP PLL Stable count */ | ||
726 | u8 stable_count; | ||
727 | /* UTMIP PLL Active delay count */ | ||
728 | u8 active_delay_count; | ||
729 | /* UTMIP PLL Xtal frequency count */ | ||
730 | u8 xtal_freq_count; | ||
731 | }; | ||
732 | |||
733 | static const struct utmi_clk_param utmi_parameters[] = { | ||
734 | {.osc_frequency = 13000000, .enable_delay_count = 0x02, | ||
735 | .stable_count = 0x33, .active_delay_count = 0x05, | ||
736 | .xtal_freq_count = 0x7F}, | ||
737 | {.osc_frequency = 19200000, .enable_delay_count = 0x03, | ||
738 | .stable_count = 0x4B, .active_delay_count = 0x06, | ||
739 | .xtal_freq_count = 0xBB}, | ||
740 | {.osc_frequency = 12000000, .enable_delay_count = 0x02, | ||
741 | .stable_count = 0x2F, .active_delay_count = 0x04, | ||
742 | .xtal_freq_count = 0x76}, | ||
743 | {.osc_frequency = 26000000, .enable_delay_count = 0x04, | ||
744 | .stable_count = 0x66, .active_delay_count = 0x09, | ||
745 | .xtal_freq_count = 0xFE}, | ||
746 | {.osc_frequency = 16800000, .enable_delay_count = 0x03, | ||
747 | .stable_count = 0x41, .active_delay_count = 0x0A, | ||
748 | .xtal_freq_count = 0xA4}, | ||
749 | }; | ||
750 | |||
751 | static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | ||
752 | [tegra_clk_ispb] = { .dt_id = TEGRA124_CLK_ISPB, .present = true }, | ||
753 | [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true }, | ||
754 | [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true }, | ||
755 | [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true }, | ||
756 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, | ||
757 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, | ||
758 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, | ||
759 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, | ||
760 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, | ||
761 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, | ||
762 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, | ||
763 | [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true }, | ||
764 | [tegra_clk_gr2d] = { .dt_id = TEGRA124_CLK_GR_2D, .present = true }, | ||
765 | [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true }, | ||
766 | [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true }, | ||
767 | [tegra_clk_gr3d] = { .dt_id = TEGRA124_CLK_GR_3D, .present = true }, | ||
768 | [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true }, | ||
769 | [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true }, | ||
770 | [tegra_clk_host1x] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true }, | ||
771 | [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true }, | ||
772 | [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true }, | ||
773 | [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true }, | ||
774 | [tegra_clk_kbc] = { .dt_id = TEGRA124_CLK_KBC, .present = true }, | ||
775 | [tegra_clk_kfuse] = { .dt_id = TEGRA124_CLK_KFUSE, .present = true }, | ||
776 | [tegra_clk_sbc1] = { .dt_id = TEGRA124_CLK_SBC1, .present = true }, | ||
777 | [tegra_clk_nor] = { .dt_id = TEGRA124_CLK_NOR, .present = true }, | ||
778 | [tegra_clk_sbc2] = { .dt_id = TEGRA124_CLK_SBC2, .present = true }, | ||
779 | [tegra_clk_sbc3] = { .dt_id = TEGRA124_CLK_SBC3, .present = true }, | ||
780 | [tegra_clk_i2c5] = { .dt_id = TEGRA124_CLK_I2C5, .present = true }, | ||
781 | [tegra_clk_dsia] = { .dt_id = TEGRA124_CLK_DSIA, .present = true }, | ||
782 | [tegra_clk_mipi] = { .dt_id = TEGRA124_CLK_MIPI, .present = true }, | ||
783 | [tegra_clk_hdmi] = { .dt_id = TEGRA124_CLK_HDMI, .present = true }, | ||
784 | [tegra_clk_csi] = { .dt_id = TEGRA124_CLK_CSI, .present = true }, | ||
785 | [tegra_clk_i2c2] = { .dt_id = TEGRA124_CLK_I2C2, .present = true }, | ||
786 | [tegra_clk_uartc] = { .dt_id = TEGRA124_CLK_UARTC, .present = true }, | ||
787 | [tegra_clk_mipi_cal] = { .dt_id = TEGRA124_CLK_MIPI_CAL, .present = true }, | ||
788 | [tegra_clk_emc] = { .dt_id = TEGRA124_CLK_EMC, .present = true }, | ||
789 | [tegra_clk_usb2] = { .dt_id = TEGRA124_CLK_USB2, .present = true }, | ||
790 | [tegra_clk_usb3] = { .dt_id = TEGRA124_CLK_USB3, .present = true }, | ||
791 | [tegra_clk_vde_8] = { .dt_id = TEGRA124_CLK_VDE, .present = true }, | ||
792 | [tegra_clk_bsea] = { .dt_id = TEGRA124_CLK_BSEA, .present = true }, | ||
793 | [tegra_clk_bsev] = { .dt_id = TEGRA124_CLK_BSEV, .present = true }, | ||
794 | [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true }, | ||
795 | [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true }, | ||
796 | [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true }, | ||
797 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true }, | ||
798 | [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true }, | ||
799 | [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true }, | ||
800 | [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true }, | ||
801 | [tegra_clk_csite] = { .dt_id = TEGRA124_CLK_CSITE, .present = true }, | ||
802 | [tegra_clk_la] = { .dt_id = TEGRA124_CLK_LA, .present = true }, | ||
803 | [tegra_clk_trace] = { .dt_id = TEGRA124_CLK_TRACE, .present = true }, | ||
804 | [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true }, | ||
805 | [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true }, | ||
806 | [tegra_clk_ndspeed] = { .dt_id = TEGRA124_CLK_NDSPEED, .present = true }, | ||
807 | [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true }, | ||
808 | [tegra_clk_dsib] = { .dt_id = TEGRA124_CLK_DSIB, .present = true }, | ||
809 | [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true }, | ||
810 | [tegra_clk_xusb_host] = { .dt_id = TEGRA124_CLK_XUSB_HOST, .present = true }, | ||
811 | [tegra_clk_msenc] = { .dt_id = TEGRA124_CLK_MSENC, .present = true }, | ||
812 | [tegra_clk_csus] = { .dt_id = TEGRA124_CLK_CSUS, .present = true }, | ||
813 | [tegra_clk_mselect] = { .dt_id = TEGRA124_CLK_MSELECT, .present = true }, | ||
814 | [tegra_clk_tsensor] = { .dt_id = TEGRA124_CLK_TSENSOR, .present = true }, | ||
815 | [tegra_clk_i2s3] = { .dt_id = TEGRA124_CLK_I2S3, .present = true }, | ||
816 | [tegra_clk_i2s4] = { .dt_id = TEGRA124_CLK_I2S4, .present = true }, | ||
817 | [tegra_clk_i2c4] = { .dt_id = TEGRA124_CLK_I2C4, .present = true }, | ||
818 | [tegra_clk_sbc5] = { .dt_id = TEGRA124_CLK_SBC5, .present = true }, | ||
819 | [tegra_clk_sbc6] = { .dt_id = TEGRA124_CLK_SBC6, .present = true }, | ||
820 | [tegra_clk_d_audio] = { .dt_id = TEGRA124_CLK_D_AUDIO, .present = true }, | ||
821 | [tegra_clk_apbif] = { .dt_id = TEGRA124_CLK_APBIF, .present = true }, | ||
822 | [tegra_clk_dam0] = { .dt_id = TEGRA124_CLK_DAM0, .present = true }, | ||
823 | [tegra_clk_dam1] = { .dt_id = TEGRA124_CLK_DAM1, .present = true }, | ||
824 | [tegra_clk_dam2] = { .dt_id = TEGRA124_CLK_DAM2, .present = true }, | ||
825 | [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA124_CLK_HDA2CODEC_2X, .present = true }, | ||
826 | [tegra_clk_audio0_2x] = { .dt_id = TEGRA124_CLK_AUDIO0_2X, .present = true }, | ||
827 | [tegra_clk_audio1_2x] = { .dt_id = TEGRA124_CLK_AUDIO1_2X, .present = true }, | ||
828 | [tegra_clk_audio2_2x] = { .dt_id = TEGRA124_CLK_AUDIO2_2X, .present = true }, | ||
829 | [tegra_clk_audio3_2x] = { .dt_id = TEGRA124_CLK_AUDIO3_2X, .present = true }, | ||
830 | [tegra_clk_audio4_2x] = { .dt_id = TEGRA124_CLK_AUDIO4_2X, .present = true }, | ||
831 | [tegra_clk_spdif_2x] = { .dt_id = TEGRA124_CLK_SPDIF_2X, .present = true }, | ||
832 | [tegra_clk_actmon] = { .dt_id = TEGRA124_CLK_ACTMON, .present = true }, | ||
833 | [tegra_clk_extern1] = { .dt_id = TEGRA124_CLK_EXTERN1, .present = true }, | ||
834 | [tegra_clk_extern2] = { .dt_id = TEGRA124_CLK_EXTERN2, .present = true }, | ||
835 | [tegra_clk_extern3] = { .dt_id = TEGRA124_CLK_EXTERN3, .present = true }, | ||
836 | [tegra_clk_sata_oob] = { .dt_id = TEGRA124_CLK_SATA_OOB, .present = true }, | ||
837 | [tegra_clk_sata] = { .dt_id = TEGRA124_CLK_SATA, .present = true }, | ||
838 | [tegra_clk_hda] = { .dt_id = TEGRA124_CLK_HDA, .present = true }, | ||
839 | [tegra_clk_se] = { .dt_id = TEGRA124_CLK_SE, .present = true }, | ||
840 | [tegra_clk_hda2hdmi] = { .dt_id = TEGRA124_CLK_HDA2HDMI, .present = true }, | ||
841 | [tegra_clk_sata_cold] = { .dt_id = TEGRA124_CLK_SATA_COLD, .present = true }, | ||
842 | [tegra_clk_cilab] = { .dt_id = TEGRA124_CLK_CILAB, .present = true }, | ||
843 | [tegra_clk_cilcd] = { .dt_id = TEGRA124_CLK_CILCD, .present = true }, | ||
844 | [tegra_clk_cile] = { .dt_id = TEGRA124_CLK_CILE, .present = true }, | ||
845 | [tegra_clk_dsialp] = { .dt_id = TEGRA124_CLK_DSIALP, .present = true }, | ||
846 | [tegra_clk_dsiblp] = { .dt_id = TEGRA124_CLK_DSIBLP, .present = true }, | ||
847 | [tegra_clk_entropy] = { .dt_id = TEGRA124_CLK_ENTROPY, .present = true }, | ||
848 | [tegra_clk_dds] = { .dt_id = TEGRA124_CLK_DDS, .present = true }, | ||
849 | [tegra_clk_dp2] = { .dt_id = TEGRA124_CLK_DP2, .present = true }, | ||
850 | [tegra_clk_amx] = { .dt_id = TEGRA124_CLK_AMX, .present = true }, | ||
851 | [tegra_clk_adx] = { .dt_id = TEGRA124_CLK_ADX, .present = true }, | ||
852 | [tegra_clk_xusb_ss] = { .dt_id = TEGRA124_CLK_XUSB_SS, .present = true }, | ||
853 | [tegra_clk_i2c6] = { .dt_id = TEGRA124_CLK_I2C6, .present = true }, | ||
854 | [tegra_clk_vim2_clk] = { .dt_id = TEGRA124_CLK_VIM2_CLK, .present = true }, | ||
855 | [tegra_clk_hdmi_audio] = { .dt_id = TEGRA124_CLK_HDMI_AUDIO, .present = true }, | ||
856 | [tegra_clk_clk72Mhz] = { .dt_id = TEGRA124_CLK_CLK72MHZ, .present = true }, | ||
857 | [tegra_clk_vic03] = { .dt_id = TEGRA124_CLK_VIC03, .present = true }, | ||
858 | [tegra_clk_adx1] = { .dt_id = TEGRA124_CLK_ADX1, .present = true }, | ||
859 | [tegra_clk_dpaux] = { .dt_id = TEGRA124_CLK_DPAUX, .present = true }, | ||
860 | [tegra_clk_sor0] = { .dt_id = TEGRA124_CLK_SOR0, .present = true }, | ||
861 | [tegra_clk_sor0_lvds] = { .dt_id = TEGRA124_CLK_SOR0_LVDS, .present = true }, | ||
862 | [tegra_clk_gpu] = { .dt_id = TEGRA124_CLK_GPU, .present = true }, | ||
863 | [tegra_clk_amx1] = { .dt_id = TEGRA124_CLK_AMX1, .present = true }, | ||
864 | [tegra_clk_uartb] = { .dt_id = TEGRA124_CLK_UARTB, .present = true }, | ||
865 | [tegra_clk_vfir] = { .dt_id = TEGRA124_CLK_VFIR, .present = true }, | ||
866 | [tegra_clk_spdif_in] = { .dt_id = TEGRA124_CLK_SPDIF_IN, .present = true }, | ||
867 | [tegra_clk_spdif_out] = { .dt_id = TEGRA124_CLK_SPDIF_OUT, .present = true }, | ||
868 | [tegra_clk_vi_9] = { .dt_id = TEGRA124_CLK_VI, .present = true }, | ||
869 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA124_CLK_VI_SENSOR, .present = true }, | ||
870 | [tegra_clk_fuse] = { .dt_id = TEGRA124_CLK_FUSE, .present = true }, | ||
871 | [tegra_clk_fuse_burn] = { .dt_id = TEGRA124_CLK_FUSE_BURN, .present = true }, | ||
872 | [tegra_clk_clk_32k] = { .dt_id = TEGRA124_CLK_CLK_32K, .present = true }, | ||
873 | [tegra_clk_clk_m] = { .dt_id = TEGRA124_CLK_CLK_M, .present = true }, | ||
874 | [tegra_clk_clk_m_div2] = { .dt_id = TEGRA124_CLK_CLK_M_DIV2, .present = true }, | ||
875 | [tegra_clk_clk_m_div4] = { .dt_id = TEGRA124_CLK_CLK_M_DIV4, .present = true }, | ||
876 | [tegra_clk_pll_ref] = { .dt_id = TEGRA124_CLK_PLL_REF, .present = true }, | ||
877 | [tegra_clk_pll_c] = { .dt_id = TEGRA124_CLK_PLL_C, .present = true }, | ||
878 | [tegra_clk_pll_c_out1] = { .dt_id = TEGRA124_CLK_PLL_C_OUT1, .present = true }, | ||
879 | [tegra_clk_pll_c2] = { .dt_id = TEGRA124_CLK_PLL_C2, .present = true }, | ||
880 | [tegra_clk_pll_c3] = { .dt_id = TEGRA124_CLK_PLL_C3, .present = true }, | ||
881 | [tegra_clk_pll_m] = { .dt_id = TEGRA124_CLK_PLL_M, .present = true }, | ||
882 | [tegra_clk_pll_m_out1] = { .dt_id = TEGRA124_CLK_PLL_M_OUT1, .present = true }, | ||
883 | [tegra_clk_pll_p] = { .dt_id = TEGRA124_CLK_PLL_P, .present = true }, | ||
884 | [tegra_clk_pll_p_out1] = { .dt_id = TEGRA124_CLK_PLL_P_OUT1, .present = true }, | ||
885 | [tegra_clk_pll_p_out2] = { .dt_id = TEGRA124_CLK_PLL_P_OUT2, .present = true }, | ||
886 | [tegra_clk_pll_p_out3] = { .dt_id = TEGRA124_CLK_PLL_P_OUT3, .present = true }, | ||
887 | [tegra_clk_pll_p_out4] = { .dt_id = TEGRA124_CLK_PLL_P_OUT4, .present = true }, | ||
888 | [tegra_clk_pll_a] = { .dt_id = TEGRA124_CLK_PLL_A, .present = true }, | ||
889 | [tegra_clk_pll_a_out0] = { .dt_id = TEGRA124_CLK_PLL_A_OUT0, .present = true }, | ||
890 | [tegra_clk_pll_d] = { .dt_id = TEGRA124_CLK_PLL_D, .present = true }, | ||
891 | [tegra_clk_pll_d_out0] = { .dt_id = TEGRA124_CLK_PLL_D_OUT0, .present = true }, | ||
892 | [tegra_clk_pll_d2] = { .dt_id = TEGRA124_CLK_PLL_D2, .present = true }, | ||
893 | [tegra_clk_pll_d2_out0] = { .dt_id = TEGRA124_CLK_PLL_D2_OUT0, .present = true }, | ||
894 | [tegra_clk_pll_u] = { .dt_id = TEGRA124_CLK_PLL_U, .present = true }, | ||
895 | [tegra_clk_pll_u_480m] = { .dt_id = TEGRA124_CLK_PLL_U_480M, .present = true }, | ||
896 | [tegra_clk_pll_u_60m] = { .dt_id = TEGRA124_CLK_PLL_U_60M, .present = true }, | ||
897 | [tegra_clk_pll_u_48m] = { .dt_id = TEGRA124_CLK_PLL_U_48M, .present = true }, | ||
898 | [tegra_clk_pll_u_12m] = { .dt_id = TEGRA124_CLK_PLL_U_12M, .present = true }, | ||
899 | [tegra_clk_pll_x] = { .dt_id = TEGRA124_CLK_PLL_X, .present = true }, | ||
900 | [tegra_clk_pll_x_out0] = { .dt_id = TEGRA124_CLK_PLL_X_OUT0, .present = true }, | ||
901 | [tegra_clk_pll_re_vco] = { .dt_id = TEGRA124_CLK_PLL_RE_VCO, .present = true }, | ||
902 | [tegra_clk_pll_re_out] = { .dt_id = TEGRA124_CLK_PLL_RE_OUT, .present = true }, | ||
903 | [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC, .present = true }, | ||
904 | [tegra_clk_i2s0_sync] = { .dt_id = TEGRA124_CLK_I2S0_SYNC, .present = true }, | ||
905 | [tegra_clk_i2s1_sync] = { .dt_id = TEGRA124_CLK_I2S1_SYNC, .present = true }, | ||
906 | [tegra_clk_i2s2_sync] = { .dt_id = TEGRA124_CLK_I2S2_SYNC, .present = true }, | ||
907 | [tegra_clk_i2s3_sync] = { .dt_id = TEGRA124_CLK_I2S3_SYNC, .present = true }, | ||
908 | [tegra_clk_i2s4_sync] = { .dt_id = TEGRA124_CLK_I2S4_SYNC, .present = true }, | ||
909 | [tegra_clk_vimclk_sync] = { .dt_id = TEGRA124_CLK_VIMCLK_SYNC, .present = true }, | ||
910 | [tegra_clk_audio0] = { .dt_id = TEGRA124_CLK_AUDIO0, .present = true }, | ||
911 | [tegra_clk_audio1] = { .dt_id = TEGRA124_CLK_AUDIO1, .present = true }, | ||
912 | [tegra_clk_audio2] = { .dt_id = TEGRA124_CLK_AUDIO2, .present = true }, | ||
913 | [tegra_clk_audio3] = { .dt_id = TEGRA124_CLK_AUDIO3, .present = true }, | ||
914 | [tegra_clk_audio4] = { .dt_id = TEGRA124_CLK_AUDIO4, .present = true }, | ||
915 | [tegra_clk_spdif] = { .dt_id = TEGRA124_CLK_SPDIF, .present = true }, | ||
916 | [tegra_clk_clk_out_1] = { .dt_id = TEGRA124_CLK_CLK_OUT_1, .present = true }, | ||
917 | [tegra_clk_clk_out_2] = { .dt_id = TEGRA124_CLK_CLK_OUT_2, .present = true }, | ||
918 | [tegra_clk_clk_out_3] = { .dt_id = TEGRA124_CLK_CLK_OUT_3, .present = true }, | ||
919 | [tegra_clk_blink] = { .dt_id = TEGRA124_CLK_BLINK, .present = true }, | ||
920 | [tegra_clk_xusb_host_src] = { .dt_id = TEGRA124_CLK_XUSB_HOST_SRC, .present = true }, | ||
921 | [tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA124_CLK_XUSB_FALCON_SRC, .present = true }, | ||
922 | [tegra_clk_xusb_fs_src] = { .dt_id = TEGRA124_CLK_XUSB_FS_SRC, .present = true }, | ||
923 | [tegra_clk_xusb_ss_src] = { .dt_id = TEGRA124_CLK_XUSB_SS_SRC, .present = true }, | ||
924 | [tegra_clk_xusb_dev_src] = { .dt_id = TEGRA124_CLK_XUSB_DEV_SRC, .present = true }, | ||
925 | [tegra_clk_xusb_dev] = { .dt_id = TEGRA124_CLK_XUSB_DEV, .present = true }, | ||
926 | [tegra_clk_xusb_hs_src] = { .dt_id = TEGRA124_CLK_XUSB_HS_SRC, .present = true }, | ||
927 | [tegra_clk_sclk] = { .dt_id = TEGRA124_CLK_SCLK, .present = true }, | ||
928 | [tegra_clk_hclk] = { .dt_id = TEGRA124_CLK_HCLK, .present = true }, | ||
929 | [tegra_clk_pclk] = { .dt_id = TEGRA124_CLK_PCLK, .present = true }, | ||
930 | [tegra_clk_cclk_g] = { .dt_id = TEGRA124_CLK_CCLK_G, .present = true }, | ||
931 | [tegra_clk_cclk_lp] = { .dt_id = TEGRA124_CLK_CCLK_LP, .present = true }, | ||
932 | [tegra_clk_dfll_ref] = { .dt_id = TEGRA124_CLK_DFLL_REF, .present = true }, | ||
933 | [tegra_clk_dfll_soc] = { .dt_id = TEGRA124_CLK_DFLL_SOC, .present = true }, | ||
934 | [tegra_clk_vi_sensor2] = { .dt_id = TEGRA124_CLK_VI_SENSOR2, .present = true }, | ||
935 | [tegra_clk_pll_p_out5] = { .dt_id = TEGRA124_CLK_PLL_P_OUT5, .present = true }, | ||
936 | [tegra_clk_pll_c4] = { .dt_id = TEGRA124_CLK_PLL_C4, .present = true }, | ||
937 | [tegra_clk_pll_dp] = { .dt_id = TEGRA124_CLK_PLL_DP, .present = true }, | ||
938 | [tegra_clk_audio0_mux] = { .dt_id = TEGRA124_CLK_AUDIO0_MUX, .present = true }, | ||
939 | [tegra_clk_audio1_mux] = { .dt_id = TEGRA124_CLK_AUDIO1_MUX, .present = true }, | ||
940 | [tegra_clk_audio2_mux] = { .dt_id = TEGRA124_CLK_AUDIO2_MUX, .present = true }, | ||
941 | [tegra_clk_audio3_mux] = { .dt_id = TEGRA124_CLK_AUDIO3_MUX, .present = true }, | ||
942 | [tegra_clk_audio4_mux] = { .dt_id = TEGRA124_CLK_AUDIO4_MUX, .present = true }, | ||
943 | [tegra_clk_spdif_mux] = { .dt_id = TEGRA124_CLK_SPDIF_MUX, .present = true }, | ||
944 | [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_1_MUX, .present = true }, | ||
945 | [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_2_MUX, .present = true }, | ||
946 | [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true }, | ||
947 | [tegra_clk_dsia_mux] = { .dt_id = TEGRA124_CLK_DSIA_MUX, .present = true }, | ||
948 | [tegra_clk_dsib_mux] = { .dt_id = TEGRA124_CLK_DSIB_MUX, .present = true }, | ||
949 | [tegra_clk_uarte] = { .dt_id = TEGRA124_CLK_UARTE, .present = true }, | ||
950 | }; | ||
951 | |||
952 | static struct tegra_devclk devclks[] __initdata = { | ||
953 | { .con_id = "clk_m", .dt_id = TEGRA124_CLK_CLK_M }, | ||
954 | { .con_id = "pll_ref", .dt_id = TEGRA124_CLK_PLL_REF }, | ||
955 | { .con_id = "clk_32k", .dt_id = TEGRA124_CLK_CLK_32K }, | ||
956 | { .con_id = "clk_m_div2", .dt_id = TEGRA124_CLK_CLK_M_DIV2 }, | ||
957 | { .con_id = "clk_m_div4", .dt_id = TEGRA124_CLK_CLK_M_DIV4 }, | ||
958 | { .con_id = "pll_c", .dt_id = TEGRA124_CLK_PLL_C }, | ||
959 | { .con_id = "pll_c_out1", .dt_id = TEGRA124_CLK_PLL_C_OUT1 }, | ||
960 | { .con_id = "pll_c2", .dt_id = TEGRA124_CLK_PLL_C2 }, | ||
961 | { .con_id = "pll_c3", .dt_id = TEGRA124_CLK_PLL_C3 }, | ||
962 | { .con_id = "pll_p", .dt_id = TEGRA124_CLK_PLL_P }, | ||
963 | { .con_id = "pll_p_out1", .dt_id = TEGRA124_CLK_PLL_P_OUT1 }, | ||
964 | { .con_id = "pll_p_out2", .dt_id = TEGRA124_CLK_PLL_P_OUT2 }, | ||
965 | { .con_id = "pll_p_out3", .dt_id = TEGRA124_CLK_PLL_P_OUT3 }, | ||
966 | { .con_id = "pll_p_out4", .dt_id = TEGRA124_CLK_PLL_P_OUT4 }, | ||
967 | { .con_id = "pll_m", .dt_id = TEGRA124_CLK_PLL_M }, | ||
968 | { .con_id = "pll_m_out1", .dt_id = TEGRA124_CLK_PLL_M_OUT1 }, | ||
969 | { .con_id = "pll_x", .dt_id = TEGRA124_CLK_PLL_X }, | ||
970 | { .con_id = "pll_x_out0", .dt_id = TEGRA124_CLK_PLL_X_OUT0 }, | ||
971 | { .con_id = "pll_u", .dt_id = TEGRA124_CLK_PLL_U }, | ||
972 | { .con_id = "pll_u_480M", .dt_id = TEGRA124_CLK_PLL_U_480M }, | ||
973 | { .con_id = "pll_u_60M", .dt_id = TEGRA124_CLK_PLL_U_60M }, | ||
974 | { .con_id = "pll_u_48M", .dt_id = TEGRA124_CLK_PLL_U_48M }, | ||
975 | { .con_id = "pll_u_12M", .dt_id = TEGRA124_CLK_PLL_U_12M }, | ||
976 | { .con_id = "pll_d", .dt_id = TEGRA124_CLK_PLL_D }, | ||
977 | { .con_id = "pll_d_out0", .dt_id = TEGRA124_CLK_PLL_D_OUT0 }, | ||
978 | { .con_id = "pll_d2", .dt_id = TEGRA124_CLK_PLL_D2 }, | ||
979 | { .con_id = "pll_d2_out0", .dt_id = TEGRA124_CLK_PLL_D2_OUT0 }, | ||
980 | { .con_id = "pll_a", .dt_id = TEGRA124_CLK_PLL_A }, | ||
981 | { .con_id = "pll_a_out0", .dt_id = TEGRA124_CLK_PLL_A_OUT0 }, | ||
982 | { .con_id = "pll_re_vco", .dt_id = TEGRA124_CLK_PLL_RE_VCO }, | ||
983 | { .con_id = "pll_re_out", .dt_id = TEGRA124_CLK_PLL_RE_OUT }, | ||
984 | { .con_id = "spdif_in_sync", .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC }, | ||
985 | { .con_id = "i2s0_sync", .dt_id = TEGRA124_CLK_I2S0_SYNC }, | ||
986 | { .con_id = "i2s1_sync", .dt_id = TEGRA124_CLK_I2S1_SYNC }, | ||
987 | { .con_id = "i2s2_sync", .dt_id = TEGRA124_CLK_I2S2_SYNC }, | ||
988 | { .con_id = "i2s3_sync", .dt_id = TEGRA124_CLK_I2S3_SYNC }, | ||
989 | { .con_id = "i2s4_sync", .dt_id = TEGRA124_CLK_I2S4_SYNC }, | ||
990 | { .con_id = "vimclk_sync", .dt_id = TEGRA124_CLK_VIMCLK_SYNC }, | ||
991 | { .con_id = "audio0", .dt_id = TEGRA124_CLK_AUDIO0 }, | ||
992 | { .con_id = "audio1", .dt_id = TEGRA124_CLK_AUDIO1 }, | ||
993 | { .con_id = "audio2", .dt_id = TEGRA124_CLK_AUDIO2 }, | ||
994 | { .con_id = "audio3", .dt_id = TEGRA124_CLK_AUDIO3 }, | ||
995 | { .con_id = "audio4", .dt_id = TEGRA124_CLK_AUDIO4 }, | ||
996 | { .con_id = "spdif", .dt_id = TEGRA124_CLK_SPDIF }, | ||
997 | { .con_id = "audio0_2x", .dt_id = TEGRA124_CLK_AUDIO0_2X }, | ||
998 | { .con_id = "audio1_2x", .dt_id = TEGRA124_CLK_AUDIO1_2X }, | ||
999 | { .con_id = "audio2_2x", .dt_id = TEGRA124_CLK_AUDIO2_2X }, | ||
1000 | { .con_id = "audio3_2x", .dt_id = TEGRA124_CLK_AUDIO3_2X }, | ||
1001 | { .con_id = "audio4_2x", .dt_id = TEGRA124_CLK_AUDIO4_2X }, | ||
1002 | { .con_id = "spdif_2x", .dt_id = TEGRA124_CLK_SPDIF_2X }, | ||
1003 | { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA124_CLK_EXTERN1 }, | ||
1004 | { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA124_CLK_EXTERN2 }, | ||
1005 | { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA124_CLK_EXTERN3 }, | ||
1006 | { .con_id = "blink", .dt_id = TEGRA124_CLK_BLINK }, | ||
1007 | { .con_id = "cclk_g", .dt_id = TEGRA124_CLK_CCLK_G }, | ||
1008 | { .con_id = "cclk_lp", .dt_id = TEGRA124_CLK_CCLK_LP }, | ||
1009 | { .con_id = "sclk", .dt_id = TEGRA124_CLK_SCLK }, | ||
1010 | { .con_id = "hclk", .dt_id = TEGRA124_CLK_HCLK }, | ||
1011 | { .con_id = "pclk", .dt_id = TEGRA124_CLK_PCLK }, | ||
1012 | { .con_id = "fuse", .dt_id = TEGRA124_CLK_FUSE }, | ||
1013 | { .dev_id = "rtc-tegra", .dt_id = TEGRA124_CLK_RTC }, | ||
1014 | { .dev_id = "timer", .dt_id = TEGRA124_CLK_TIMER }, | ||
1015 | }; | ||
1016 | |||
1017 | static struct clk **clks; | ||
1018 | |||
1019 | static void tegra124_utmi_param_configure(void __iomem *clk_base) | ||
1020 | { | ||
1021 | u32 reg; | ||
1022 | int i; | ||
1023 | |||
1024 | for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) { | ||
1025 | if (osc_freq == utmi_parameters[i].osc_frequency) | ||
1026 | break; | ||
1027 | } | ||
1028 | |||
1029 | if (i >= ARRAY_SIZE(utmi_parameters)) { | ||
1030 | pr_err("%s: Unexpected oscillator freq %lu\n", __func__, | ||
1031 | osc_freq); | ||
1032 | return; | ||
1033 | } | ||
1034 | |||
1035 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2); | ||
1036 | |||
1037 | /* Program UTMIP PLL stable and active counts */ | ||
1038 | /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */ | ||
1039 | reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0); | ||
1040 | reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count); | ||
1041 | |||
1042 | reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0); | ||
1043 | |||
1044 | reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i]. | ||
1045 | active_delay_count); | ||
1046 | |||
1047 | /* Remove power downs from UTMIP PLL control bits */ | ||
1048 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN; | ||
1049 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN; | ||
1050 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN; | ||
1051 | |||
1052 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2); | ||
1053 | |||
1054 | /* Program UTMIP PLL delay and oscillator frequency counts */ | ||
1055 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1056 | reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0); | ||
1057 | |||
1058 | reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i]. | ||
1059 | enable_delay_count); | ||
1060 | |||
1061 | reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0); | ||
1062 | reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i]. | ||
1063 | xtal_freq_count); | ||
1064 | |||
1065 | /* Remove power downs from UTMIP PLL control bits */ | ||
1066 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1067 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN; | ||
1068 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP; | ||
1069 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN; | ||
1070 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1071 | |||
1072 | /* Setup HW control of UTMIPLL */ | ||
1073 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1074 | reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET; | ||
1075 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL; | ||
1076 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE; | ||
1077 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1078 | |||
1079 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1080 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP; | ||
1081 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1082 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1083 | |||
1084 | udelay(1); | ||
1085 | |||
1086 | /* Setup SW override of UTMIPLL assuming USB2.0 | ||
1087 | ports are assigned to USB2 */ | ||
1088 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1089 | reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL; | ||
1090 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE; | ||
1091 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1092 | |||
1093 | udelay(1); | ||
1094 | |||
1095 | /* Enable HW control UTMIPLL */ | ||
1096 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1097 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE; | ||
1098 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1099 | } | ||
1100 | |||
1101 | static __init void tegra124_periph_clk_init(void __iomem *clk_base, | ||
1102 | void __iomem *pmc_base) | ||
1103 | { | ||
1104 | struct clk *clk; | ||
1105 | u32 val; | ||
1106 | |||
1107 | /* xusb_hs_src */ | ||
1108 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1109 | val |= BIT(25); /* always select PLLU_60M */ | ||
1110 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1111 | |||
1112 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, | ||
1113 | 1, 1); | ||
1114 | clks[TEGRA124_CLK_XUSB_HS_SRC] = clk; | ||
1115 | |||
1116 | /* dsia mux */ | ||
1117 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, | ||
1118 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1119 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); | ||
1120 | clks[TEGRA124_CLK_DSIA_MUX] = clk; | ||
1121 | |||
1122 | /* dsib mux */ | ||
1123 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, | ||
1124 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1125 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); | ||
1126 | clks[TEGRA124_CLK_DSIB_MUX] = clk; | ||
1127 | |||
1128 | /* emc mux */ | ||
1129 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | ||
1130 | ARRAY_SIZE(mux_pllmcp_clkm), 0, | ||
1131 | clk_base + CLK_SOURCE_EMC, | ||
1132 | 29, 3, 0, NULL); | ||
1133 | |||
1134 | /* cml0 */ | ||
1135 | clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX, | ||
1136 | 0, 0, &pll_e_lock); | ||
1137 | clk_register_clkdev(clk, "cml0", NULL); | ||
1138 | clks[TEGRA124_CLK_CML0] = clk; | ||
1139 | |||
1140 | /* cml1 */ | ||
1141 | clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX, | ||
1142 | 1, 0, &pll_e_lock); | ||
1143 | clk_register_clkdev(clk, "cml1", NULL); | ||
1144 | clks[TEGRA124_CLK_CML1] = clk; | ||
1145 | |||
1146 | tegra_periph_clk_init(clk_base, pmc_base, tegra124_clks, &pll_p_params); | ||
1147 | } | ||
1148 | |||
1149 | static void __init tegra124_pll_init(void __iomem *clk_base, | ||
1150 | void __iomem *pmc) | ||
1151 | { | ||
1152 | u32 val; | ||
1153 | struct clk *clk; | ||
1154 | |||
1155 | /* PLLC */ | ||
1156 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, | ||
1157 | pmc, 0, &pll_c_params, NULL); | ||
1158 | clk_register_clkdev(clk, "pll_c", NULL); | ||
1159 | clks[TEGRA124_CLK_PLL_C] = clk; | ||
1160 | |||
1161 | /* PLLC_OUT1 */ | ||
1162 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | ||
1163 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1164 | 8, 8, 1, NULL); | ||
1165 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | ||
1166 | clk_base + PLLC_OUT, 1, 0, | ||
1167 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1168 | clk_register_clkdev(clk, "pll_c_out1", NULL); | ||
1169 | clks[TEGRA124_CLK_PLL_C_OUT1] = clk; | ||
1170 | |||
1171 | /* PLLC2 */ | ||
1172 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, | ||
1173 | &pll_c2_params, NULL); | ||
1174 | clk_register_clkdev(clk, "pll_c2", NULL); | ||
1175 | clks[TEGRA124_CLK_PLL_C2] = clk; | ||
1176 | |||
1177 | /* PLLC3 */ | ||
1178 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, | ||
1179 | &pll_c3_params, NULL); | ||
1180 | clk_register_clkdev(clk, "pll_c3", NULL); | ||
1181 | clks[TEGRA124_CLK_PLL_C3] = clk; | ||
1182 | |||
1183 | /* PLLM */ | ||
1184 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, | ||
1185 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, | ||
1186 | &pll_m_params, NULL); | ||
1187 | clk_register_clkdev(clk, "pll_m", NULL); | ||
1188 | clks[TEGRA124_CLK_PLL_M] = clk; | ||
1189 | |||
1190 | /* PLLM_OUT1 */ | ||
1191 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | ||
1192 | clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1193 | 8, 8, 1, NULL); | ||
1194 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | ||
1195 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1196 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1197 | clk_register_clkdev(clk, "pll_m_out1", NULL); | ||
1198 | clks[TEGRA124_CLK_PLL_M_OUT1] = clk; | ||
1199 | |||
1200 | /* PLLM_UD */ | ||
1201 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", | ||
1202 | CLK_SET_RATE_PARENT, 1, 1); | ||
1203 | |||
1204 | /* PLLU */ | ||
1205 | val = readl(clk_base + pll_u_params.base_reg); | ||
1206 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ | ||
1207 | writel(val, clk_base + pll_u_params.base_reg); | ||
1208 | |||
1209 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, | ||
1210 | &pll_u_params, &pll_u_lock); | ||
1211 | clk_register_clkdev(clk, "pll_u", NULL); | ||
1212 | clks[TEGRA124_CLK_PLL_U] = clk; | ||
1213 | |||
1214 | tegra124_utmi_param_configure(clk_base); | ||
1215 | |||
1216 | /* PLLU_480M */ | ||
1217 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", | ||
1218 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, | ||
1219 | 22, 0, &pll_u_lock); | ||
1220 | clk_register_clkdev(clk, "pll_u_480M", NULL); | ||
1221 | clks[TEGRA124_CLK_PLL_U_480M] = clk; | ||
1222 | |||
1223 | /* PLLU_60M */ | ||
1224 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", | ||
1225 | CLK_SET_RATE_PARENT, 1, 8); | ||
1226 | clk_register_clkdev(clk, "pll_u_60M", NULL); | ||
1227 | clks[TEGRA124_CLK_PLL_U_60M] = clk; | ||
1228 | |||
1229 | /* PLLU_48M */ | ||
1230 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", | ||
1231 | CLK_SET_RATE_PARENT, 1, 10); | ||
1232 | clk_register_clkdev(clk, "pll_u_48M", NULL); | ||
1233 | clks[TEGRA124_CLK_PLL_U_48M] = clk; | ||
1234 | |||
1235 | /* PLLU_12M */ | ||
1236 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", | ||
1237 | CLK_SET_RATE_PARENT, 1, 40); | ||
1238 | clk_register_clkdev(clk, "pll_u_12M", NULL); | ||
1239 | clks[TEGRA124_CLK_PLL_U_12M] = clk; | ||
1240 | |||
1241 | /* PLLD */ | ||
1242 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, | ||
1243 | &pll_d_params, &pll_d_lock); | ||
1244 | clk_register_clkdev(clk, "pll_d", NULL); | ||
1245 | clks[TEGRA124_CLK_PLL_D] = clk; | ||
1246 | |||
1247 | /* PLLD_OUT0 */ | ||
1248 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | ||
1249 | CLK_SET_RATE_PARENT, 1, 2); | ||
1250 | clk_register_clkdev(clk, "pll_d_out0", NULL); | ||
1251 | clks[TEGRA124_CLK_PLL_D_OUT0] = clk; | ||
1252 | |||
1253 | /* PLLRE */ | ||
1254 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, | ||
1255 | 0, &pll_re_vco_params, &pll_re_lock, pll_ref_freq); | ||
1256 | clk_register_clkdev(clk, "pll_re_vco", NULL); | ||
1257 | clks[TEGRA124_CLK_PLL_RE_VCO] = clk; | ||
1258 | |||
1259 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, | ||
1260 | clk_base + PLLRE_BASE, 16, 4, 0, | ||
1261 | pll_re_div_table, &pll_re_lock); | ||
1262 | clk_register_clkdev(clk, "pll_re_out", NULL); | ||
1263 | clks[TEGRA124_CLK_PLL_RE_OUT] = clk; | ||
1264 | |||
1265 | /* PLLE */ | ||
1266 | clk = tegra_clk_register_plle_tegra114("pll_e", "pll_ref", | ||
1267 | clk_base, 0, &pll_e_params, NULL); | ||
1268 | clk_register_clkdev(clk, "pll_e", NULL); | ||
1269 | clks[TEGRA124_CLK_PLL_E] = clk; | ||
1270 | |||
1271 | /* PLLC4 */ | ||
1272 | clk = tegra_clk_register_pllss("pll_c4", "pll_ref", clk_base, 0, | ||
1273 | &pll_c4_params, NULL); | ||
1274 | clk_register_clkdev(clk, "pll_c4", NULL); | ||
1275 | clks[TEGRA124_CLK_PLL_C4] = clk; | ||
1276 | |||
1277 | /* PLLDP */ | ||
1278 | clk = tegra_clk_register_pllss("pll_dp", "pll_ref", clk_base, 0, | ||
1279 | &pll_dp_params, NULL); | ||
1280 | clk_register_clkdev(clk, "pll_dp", NULL); | ||
1281 | clks[TEGRA124_CLK_PLL_DP] = clk; | ||
1282 | |||
1283 | /* PLLD2 */ | ||
1284 | clk = tegra_clk_register_pllss("pll_d2", "pll_ref", clk_base, 0, | ||
1285 | &tegra124_pll_d2_params, NULL); | ||
1286 | clk_register_clkdev(clk, "pll_d2", NULL); | ||
1287 | clks[TEGRA124_CLK_PLL_D2] = clk; | ||
1288 | |||
1289 | /* PLLD2_OUT0 ?? */ | ||
1290 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | ||
1291 | CLK_SET_RATE_PARENT, 1, 2); | ||
1292 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | ||
1293 | clks[TEGRA124_CLK_PLL_D2_OUT0] = clk; | ||
1294 | |||
1295 | } | ||
1296 | |||
1297 | /* Tegra124 CPU clock and reset control functions */ | ||
1298 | static void tegra124_wait_cpu_in_reset(u32 cpu) | ||
1299 | { | ||
1300 | unsigned int reg; | ||
1301 | |||
1302 | do { | ||
1303 | reg = readl(clk_base + CLK_RST_CONTROLLER_CPU_CMPLX_STATUS); | ||
1304 | cpu_relax(); | ||
1305 | } while (!(reg & (1 << cpu))); /* check CPU been reset or not */ | ||
1306 | } | ||
1307 | |||
1308 | static void tegra124_disable_cpu_clock(u32 cpu) | ||
1309 | { | ||
1310 | /* flow controller would take care in the power sequence. */ | ||
1311 | } | ||
1312 | |||
1313 | #ifdef CONFIG_PM_SLEEP | ||
1314 | static void tegra124_cpu_clock_suspend(void) | ||
1315 | { | ||
1316 | /* switch coresite to clk_m, save off original source */ | ||
1317 | tegra124_cpu_clk_sctx.clk_csite_src = | ||
1318 | readl(clk_base + CLK_SOURCE_CSITE); | ||
1319 | writel(3 << 30, clk_base + CLK_SOURCE_CSITE); | ||
1320 | } | ||
1321 | |||
1322 | static void tegra124_cpu_clock_resume(void) | ||
1323 | { | ||
1324 | writel(tegra124_cpu_clk_sctx.clk_csite_src, | ||
1325 | clk_base + CLK_SOURCE_CSITE); | ||
1326 | } | ||
1327 | #endif | ||
1328 | |||
1329 | static struct tegra_cpu_car_ops tegra124_cpu_car_ops = { | ||
1330 | .wait_for_reset = tegra124_wait_cpu_in_reset, | ||
1331 | .disable_clock = tegra124_disable_cpu_clock, | ||
1332 | #ifdef CONFIG_PM_SLEEP | ||
1333 | .suspend = tegra124_cpu_clock_suspend, | ||
1334 | .resume = tegra124_cpu_clock_resume, | ||
1335 | #endif | ||
1336 | }; | ||
1337 | |||
1338 | static const struct of_device_id pmc_match[] __initconst = { | ||
1339 | { .compatible = "nvidia,tegra124-pmc" }, | ||
1340 | {}, | ||
1341 | }; | ||
1342 | |||
1343 | static struct tegra_clk_init_table init_table[] __initdata = { | ||
1344 | {TEGRA124_CLK_UARTA, TEGRA124_CLK_PLL_P, 408000000, 0}, | ||
1345 | {TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0}, | ||
1346 | {TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0}, | ||
1347 | {TEGRA124_CLK_UARTD, TEGRA124_CLK_PLL_P, 408000000, 0}, | ||
1348 | {TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 564480000, 1}, | ||
1349 | {TEGRA124_CLK_PLL_A_OUT0, TEGRA124_CLK_CLK_MAX, 11289600, 1}, | ||
1350 | {TEGRA124_CLK_EXTERN1, TEGRA124_CLK_PLL_A_OUT0, 0, 1}, | ||
1351 | {TEGRA124_CLK_CLK_OUT_1_MUX, TEGRA124_CLK_EXTERN1, 0, 1}, | ||
1352 | {TEGRA124_CLK_CLK_OUT_1, TEGRA124_CLK_CLK_MAX, 0, 1}, | ||
1353 | {TEGRA124_CLK_I2S0, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, | ||
1354 | {TEGRA124_CLK_I2S1, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, | ||
1355 | {TEGRA124_CLK_I2S2, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, | ||
1356 | {TEGRA124_CLK_I2S3, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, | ||
1357 | {TEGRA124_CLK_I2S4, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, | ||
1358 | {TEGRA124_CLK_VDE, TEGRA124_CLK_PLL_P, 0, 0}, | ||
1359 | {TEGRA124_CLK_HOST1X, TEGRA124_CLK_PLL_P, 136000000, 1}, | ||
1360 | {TEGRA124_CLK_SCLK, TEGRA124_CLK_PLL_P_OUT2, 102000000, 1}, | ||
1361 | {TEGRA124_CLK_DFLL_SOC, TEGRA124_CLK_PLL_P, 51000000, 1}, | ||
1362 | {TEGRA124_CLK_DFLL_REF, TEGRA124_CLK_PLL_P, 51000000, 1}, | ||
1363 | {TEGRA124_CLK_PLL_C, TEGRA124_CLK_CLK_MAX, 768000000, 0}, | ||
1364 | {TEGRA124_CLK_PLL_C_OUT1, TEGRA124_CLK_CLK_MAX, 100000000, 0}, | ||
1365 | {TEGRA124_CLK_SBC4, TEGRA124_CLK_PLL_P, 12000000, 1}, | ||
1366 | {TEGRA124_CLK_TSEC, TEGRA124_CLK_PLL_C3, 0, 0}, | ||
1367 | {TEGRA124_CLK_MSENC, TEGRA124_CLK_PLL_C3, 0, 0}, | ||
1368 | /* This MUST be the last entry. */ | ||
1369 | {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0}, | ||
1370 | }; | ||
1371 | |||
1372 | static void __init tegra124_clock_apply_init_table(void) | ||
1373 | { | ||
1374 | tegra_init_from_table(init_table, clks, TEGRA124_CLK_CLK_MAX); | ||
1375 | } | ||
1376 | |||
1377 | static void __init tegra124_clock_init(struct device_node *np) | ||
1378 | { | ||
1379 | struct device_node *node; | ||
1380 | |||
1381 | clk_base = of_iomap(np, 0); | ||
1382 | if (!clk_base) { | ||
1383 | pr_err("ioremap tegra124 CAR failed\n"); | ||
1384 | return; | ||
1385 | } | ||
1386 | |||
1387 | node = of_find_matching_node(NULL, pmc_match); | ||
1388 | if (!node) { | ||
1389 | pr_err("Failed to find pmc node\n"); | ||
1390 | WARN_ON(1); | ||
1391 | return; | ||
1392 | } | ||
1393 | |||
1394 | pmc_base = of_iomap(node, 0); | ||
1395 | if (!pmc_base) { | ||
1396 | pr_err("Can't map pmc registers\n"); | ||
1397 | WARN_ON(1); | ||
1398 | return; | ||
1399 | } | ||
1400 | |||
1401 | clks = tegra_clk_init(clk_base, TEGRA124_CLK_CLK_MAX, 6); | ||
1402 | if (!clks) | ||
1403 | return; | ||
1404 | |||
1405 | if (tegra_osc_clk_init(clk_base, tegra124_clks, tegra124_input_freq, | ||
1406 | ARRAY_SIZE(tegra124_input_freq), &osc_freq, &pll_ref_freq) < 0) | ||
1407 | return; | ||
1408 | |||
1409 | tegra_fixed_clk_init(tegra124_clks); | ||
1410 | tegra124_pll_init(clk_base, pmc_base); | ||
1411 | tegra124_periph_clk_init(clk_base, pmc_base); | ||
1412 | tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params); | ||
1413 | tegra_pmc_clk_init(pmc_base, tegra124_clks); | ||
1414 | |||
1415 | tegra_super_clk_gen4_init(clk_base, pmc_base, tegra124_clks, | ||
1416 | &pll_x_params); | ||
1417 | tegra_add_of_provider(np); | ||
1418 | tegra_register_devclks(devclks, ARRAY_SIZE(devclks)); | ||
1419 | |||
1420 | tegra_clk_apply_init_table = tegra124_clock_apply_init_table; | ||
1421 | |||
1422 | tegra_cpu_car_ops = &tegra124_cpu_car_ops; | ||
1423 | } | ||
1424 | CLK_OF_DECLARE(tegra124, "nvidia,tegra124-car", tegra124_clock_init); | ||
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 056f649d0d89..dbace152b2fa 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -22,30 +22,10 @@ | |||
22 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
23 | #include <linux/clk/tegra.h> | 23 | #include <linux/clk/tegra.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <dt-bindings/clock/tegra20-car.h> | ||
25 | 26 | ||
26 | #include "clk.h" | 27 | #include "clk.h" |
27 | 28 | #include "clk-id.h" | |
28 | #define RST_DEVICES_L 0x004 | ||
29 | #define RST_DEVICES_H 0x008 | ||
30 | #define RST_DEVICES_U 0x00c | ||
31 | #define RST_DEVICES_SET_L 0x300 | ||
32 | #define RST_DEVICES_CLR_L 0x304 | ||
33 | #define RST_DEVICES_SET_H 0x308 | ||
34 | #define RST_DEVICES_CLR_H 0x30c | ||
35 | #define RST_DEVICES_SET_U 0x310 | ||
36 | #define RST_DEVICES_CLR_U 0x314 | ||
37 | #define RST_DEVICES_NUM 3 | ||
38 | |||
39 | #define CLK_OUT_ENB_L 0x010 | ||
40 | #define CLK_OUT_ENB_H 0x014 | ||
41 | #define CLK_OUT_ENB_U 0x018 | ||
42 | #define CLK_OUT_ENB_SET_L 0x320 | ||
43 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
44 | #define CLK_OUT_ENB_SET_H 0x328 | ||
45 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
46 | #define CLK_OUT_ENB_SET_U 0x330 | ||
47 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
48 | #define CLK_OUT_ENB_NUM 3 | ||
49 | 29 | ||
50 | #define OSC_CTRL 0x50 | 30 | #define OSC_CTRL 0x50 |
51 | #define OSC_CTRL_OSC_FREQ_MASK (3<<30) | 31 | #define OSC_CTRL_OSC_FREQ_MASK (3<<30) |
@@ -67,6 +47,8 @@ | |||
67 | #define OSC_FREQ_DET_BUSY (1<<31) | 47 | #define OSC_FREQ_DET_BUSY (1<<31) |
68 | #define OSC_FREQ_DET_CNT_MASK 0xFFFF | 48 | #define OSC_FREQ_DET_CNT_MASK 0xFFFF |
69 | 49 | ||
50 | #define TEGRA20_CLK_PERIPH_BANKS 3 | ||
51 | |||
70 | #define PLLS_BASE 0xf0 | 52 | #define PLLS_BASE 0xf0 |
71 | #define PLLS_MISC 0xf4 | 53 | #define PLLS_MISC 0xf4 |
72 | #define PLLC_BASE 0x80 | 54 | #define PLLC_BASE 0x80 |
@@ -114,34 +96,15 @@ | |||
114 | 96 | ||
115 | #define CLK_SOURCE_I2S1 0x100 | 97 | #define CLK_SOURCE_I2S1 0x100 |
116 | #define CLK_SOURCE_I2S2 0x104 | 98 | #define CLK_SOURCE_I2S2 0x104 |
117 | #define CLK_SOURCE_SPDIF_OUT 0x108 | ||
118 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
119 | #define CLK_SOURCE_PWM 0x110 | 99 | #define CLK_SOURCE_PWM 0x110 |
120 | #define CLK_SOURCE_SPI 0x114 | 100 | #define CLK_SOURCE_SPI 0x114 |
121 | #define CLK_SOURCE_SBC1 0x134 | ||
122 | #define CLK_SOURCE_SBC2 0x118 | ||
123 | #define CLK_SOURCE_SBC3 0x11c | ||
124 | #define CLK_SOURCE_SBC4 0x1b4 | ||
125 | #define CLK_SOURCE_XIO 0x120 | 101 | #define CLK_SOURCE_XIO 0x120 |
126 | #define CLK_SOURCE_TWC 0x12c | 102 | #define CLK_SOURCE_TWC 0x12c |
127 | #define CLK_SOURCE_IDE 0x144 | 103 | #define CLK_SOURCE_IDE 0x144 |
128 | #define CLK_SOURCE_NDFLASH 0x160 | ||
129 | #define CLK_SOURCE_VFIR 0x168 | ||
130 | #define CLK_SOURCE_SDMMC1 0x150 | ||
131 | #define CLK_SOURCE_SDMMC2 0x154 | ||
132 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
133 | #define CLK_SOURCE_SDMMC4 0x164 | ||
134 | #define CLK_SOURCE_CVE 0x140 | ||
135 | #define CLK_SOURCE_TVO 0x188 | ||
136 | #define CLK_SOURCE_TVDAC 0x194 | ||
137 | #define CLK_SOURCE_HDMI 0x18c | 104 | #define CLK_SOURCE_HDMI 0x18c |
138 | #define CLK_SOURCE_DISP1 0x138 | 105 | #define CLK_SOURCE_DISP1 0x138 |
139 | #define CLK_SOURCE_DISP2 0x13c | 106 | #define CLK_SOURCE_DISP2 0x13c |
140 | #define CLK_SOURCE_CSITE 0x1d4 | 107 | #define CLK_SOURCE_CSITE 0x1d4 |
141 | #define CLK_SOURCE_LA 0x1f8 | ||
142 | #define CLK_SOURCE_OWR 0x1cc | ||
143 | #define CLK_SOURCE_NOR 0x1d0 | ||
144 | #define CLK_SOURCE_MIPI 0x174 | ||
145 | #define CLK_SOURCE_I2C1 0x124 | 108 | #define CLK_SOURCE_I2C1 0x124 |
146 | #define CLK_SOURCE_I2C2 0x198 | 109 | #define CLK_SOURCE_I2C2 0x198 |
147 | #define CLK_SOURCE_I2C3 0x1b8 | 110 | #define CLK_SOURCE_I2C3 0x1b8 |
@@ -151,24 +114,10 @@ | |||
151 | #define CLK_SOURCE_UARTC 0x1a0 | 114 | #define CLK_SOURCE_UARTC 0x1a0 |
152 | #define CLK_SOURCE_UARTD 0x1c0 | 115 | #define CLK_SOURCE_UARTD 0x1c0 |
153 | #define CLK_SOURCE_UARTE 0x1c4 | 116 | #define CLK_SOURCE_UARTE 0x1c4 |
154 | #define CLK_SOURCE_3D 0x158 | ||
155 | #define CLK_SOURCE_2D 0x15c | ||
156 | #define CLK_SOURCE_MPE 0x170 | ||
157 | #define CLK_SOURCE_EPP 0x16c | ||
158 | #define CLK_SOURCE_HOST1X 0x180 | ||
159 | #define CLK_SOURCE_VDE 0x1c8 | ||
160 | #define CLK_SOURCE_VI 0x148 | ||
161 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
162 | #define CLK_SOURCE_EMC 0x19c | 117 | #define CLK_SOURCE_EMC 0x19c |
163 | 118 | ||
164 | #define AUDIO_SYNC_CLK 0x38 | 119 | #define AUDIO_SYNC_CLK 0x38 |
165 | 120 | ||
166 | #define PMC_CTRL 0x0 | ||
167 | #define PMC_CTRL_BLINK_ENB 7 | ||
168 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
169 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
170 | #define PMC_BLINK_TIMER 0x40 | ||
171 | |||
172 | /* Tegra CPU clock and reset control regs */ | 121 | /* Tegra CPU clock and reset control regs */ |
173 | #define TEGRA_CLK_RST_CONTROLLER_CLK_CPU_CMPLX 0x4c | 122 | #define TEGRA_CLK_RST_CONTROLLER_CLK_CPU_CMPLX 0x4c |
174 | #define TEGRA_CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET 0x340 | 123 | #define TEGRA_CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET 0x340 |
@@ -188,64 +137,32 @@ static struct cpu_clk_suspend_context { | |||
188 | } tegra20_cpu_clk_sctx; | 137 | } tegra20_cpu_clk_sctx; |
189 | #endif | 138 | #endif |
190 | 139 | ||
191 | static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; | ||
192 | |||
193 | static void __iomem *clk_base; | 140 | static void __iomem *clk_base; |
194 | static void __iomem *pmc_base; | 141 | static void __iomem *pmc_base; |
195 | 142 | ||
196 | static DEFINE_SPINLOCK(pll_div_lock); | 143 | #define TEGRA_INIT_DATA_MUX(_name, _parents, _offset, \ |
197 | static DEFINE_SPINLOCK(sysrate_lock); | 144 | _clk_num, _gate_flags, _clk_id) \ |
198 | 145 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ | |
199 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ | ||
200 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
201 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
202 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ | 146 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ |
203 | _regs, _clk_num, periph_clk_enb_refcnt, \ | 147 | _clk_num, \ |
204 | _gate_flags, _clk_id) | 148 | _gate_flags, _clk_id) |
205 | 149 | ||
206 | #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ | 150 | #define TEGRA_INIT_DATA_DIV16(_name, _parents, _offset, \ |
207 | _clk_num, _regs, _gate_flags, _clk_id) \ | 151 | _clk_num, _gate_flags, _clk_id) \ |
208 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | 152 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ |
209 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ | 153 | 30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP, \ |
210 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | 154 | _clk_num, _gate_flags, \ |
211 | _clk_id) | ||
212 | |||
213 | #define TEGRA_INIT_DATA_DIV16(_name, _con_id, _dev_id, _parents, _offset, \ | ||
214 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
215 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
216 | 30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP, _regs, \ | ||
217 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
218 | _clk_id) | 155 | _clk_id) |
219 | 156 | ||
220 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ | 157 | #define TEGRA_INIT_DATA_NODIV(_name, _parents, _offset, \ |
221 | _mux_shift, _mux_width, _clk_num, _regs, \ | 158 | _mux_shift, _mux_width, _clk_num, \ |
222 | _gate_flags, _clk_id) \ | 159 | _gate_flags, _clk_id) \ |
223 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | 160 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ |
224 | _mux_shift, _mux_width, 0, 0, 0, 0, 0, _regs, \ | 161 | _mux_shift, _mux_width, 0, 0, 0, 0, 0, \ |
225 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | 162 | _clk_num, _gate_flags, \ |
226 | _clk_id) | 163 | _clk_id) |
227 | 164 | ||
228 | /* IDs assigned here must be in sync with DT bindings definition | 165 | static struct clk **clks; |
229 | * for Tegra20 clocks . | ||
230 | */ | ||
231 | enum tegra20_clk { | ||
232 | cpu, ac97 = 3, rtc, timer, uarta, gpio = 8, sdmmc2, i2s1 = 11, i2c1, | ||
233 | ndflash, sdmmc1, sdmmc4, twc, pwm, i2s2, epp, gr2d = 21, usbd, isp, | ||
234 | gr3d, ide, disp2, disp1, host1x, vcp, cache2 = 31, mem, ahbdma, apbdma, | ||
235 | kbc = 36, stat_mon, pmc, fuse, kfuse, sbc1, nor, spi, sbc2, xio, sbc3, | ||
236 | dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, | ||
237 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, | ||
238 | pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb, | ||
239 | iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev2, cdev1, | ||
240 | uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve, | ||
241 | osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0, | ||
242 | pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, | ||
243 | pll_p, pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_s, pll_u, | ||
244 | pll_x, cop, audio, pll_ref, twd, clk_max, | ||
245 | }; | ||
246 | |||
247 | static struct clk *clks[clk_max]; | ||
248 | static struct clk_onecell_data clk_data; | ||
249 | 166 | ||
250 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | 167 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
251 | { 12000000, 600000000, 600, 12, 0, 8 }, | 168 | { 12000000, 600000000, 600, 12, 0, 8 }, |
@@ -383,6 +300,8 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
383 | .lock_mask = PLL_BASE_LOCK, | 300 | .lock_mask = PLL_BASE_LOCK, |
384 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 301 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
385 | .lock_delay = 300, | 302 | .lock_delay = 300, |
303 | .freq_table = pll_c_freq_table, | ||
304 | .flags = TEGRA_PLL_HAS_CPCON, | ||
386 | }; | 305 | }; |
387 | 306 | ||
388 | static struct tegra_clk_pll_params pll_m_params = { | 307 | static struct tegra_clk_pll_params pll_m_params = { |
@@ -397,6 +316,8 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
397 | .lock_mask = PLL_BASE_LOCK, | 316 | .lock_mask = PLL_BASE_LOCK, |
398 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 317 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
399 | .lock_delay = 300, | 318 | .lock_delay = 300, |
319 | .freq_table = pll_m_freq_table, | ||
320 | .flags = TEGRA_PLL_HAS_CPCON, | ||
400 | }; | 321 | }; |
401 | 322 | ||
402 | static struct tegra_clk_pll_params pll_p_params = { | 323 | static struct tegra_clk_pll_params pll_p_params = { |
@@ -411,6 +332,9 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
411 | .lock_mask = PLL_BASE_LOCK, | 332 | .lock_mask = PLL_BASE_LOCK, |
412 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 333 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
413 | .lock_delay = 300, | 334 | .lock_delay = 300, |
335 | .freq_table = pll_p_freq_table, | ||
336 | .flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON, | ||
337 | .fixed_rate = 216000000, | ||
414 | }; | 338 | }; |
415 | 339 | ||
416 | static struct tegra_clk_pll_params pll_a_params = { | 340 | static struct tegra_clk_pll_params pll_a_params = { |
@@ -425,6 +349,8 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
425 | .lock_mask = PLL_BASE_LOCK, | 349 | .lock_mask = PLL_BASE_LOCK, |
426 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 350 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
427 | .lock_delay = 300, | 351 | .lock_delay = 300, |
352 | .freq_table = pll_a_freq_table, | ||
353 | .flags = TEGRA_PLL_HAS_CPCON, | ||
428 | }; | 354 | }; |
429 | 355 | ||
430 | static struct tegra_clk_pll_params pll_d_params = { | 356 | static struct tegra_clk_pll_params pll_d_params = { |
@@ -439,6 +365,8 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
439 | .lock_mask = PLL_BASE_LOCK, | 365 | .lock_mask = PLL_BASE_LOCK, |
440 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 366 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
441 | .lock_delay = 1000, | 367 | .lock_delay = 1000, |
368 | .freq_table = pll_d_freq_table, | ||
369 | .flags = TEGRA_PLL_HAS_CPCON, | ||
442 | }; | 370 | }; |
443 | 371 | ||
444 | static struct pdiv_map pllu_p[] = { | 372 | static struct pdiv_map pllu_p[] = { |
@@ -460,6 +388,8 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
460 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 388 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
461 | .lock_delay = 1000, | 389 | .lock_delay = 1000, |
462 | .pdiv_tohw = pllu_p, | 390 | .pdiv_tohw = pllu_p, |
391 | .freq_table = pll_u_freq_table, | ||
392 | .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON, | ||
463 | }; | 393 | }; |
464 | 394 | ||
465 | static struct tegra_clk_pll_params pll_x_params = { | 395 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -474,6 +404,8 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
474 | .lock_mask = PLL_BASE_LOCK, | 404 | .lock_mask = PLL_BASE_LOCK, |
475 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 405 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
476 | .lock_delay = 300, | 406 | .lock_delay = 300, |
407 | .freq_table = pll_x_freq_table, | ||
408 | .flags = TEGRA_PLL_HAS_CPCON, | ||
477 | }; | 409 | }; |
478 | 410 | ||
479 | static struct tegra_clk_pll_params pll_e_params = { | 411 | static struct tegra_clk_pll_params pll_e_params = { |
@@ -488,34 +420,160 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
488 | .lock_mask = PLLE_MISC_LOCK, | 420 | .lock_mask = PLLE_MISC_LOCK, |
489 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 421 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
490 | .lock_delay = 0, | 422 | .lock_delay = 0, |
423 | .freq_table = pll_e_freq_table, | ||
424 | .flags = TEGRA_PLL_FIXED, | ||
425 | .fixed_rate = 100000000, | ||
491 | }; | 426 | }; |
492 | 427 | ||
493 | /* Peripheral clock registers */ | 428 | static struct tegra_devclk devclks[] __initdata = { |
494 | static struct tegra_clk_periph_regs periph_l_regs = { | 429 | { .con_id = "pll_c", .dt_id = TEGRA20_CLK_PLL_C }, |
495 | .enb_reg = CLK_OUT_ENB_L, | 430 | { .con_id = "pll_c_out1", .dt_id = TEGRA20_CLK_PLL_C_OUT1 }, |
496 | .enb_set_reg = CLK_OUT_ENB_SET_L, | 431 | { .con_id = "pll_p", .dt_id = TEGRA20_CLK_PLL_P }, |
497 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | 432 | { .con_id = "pll_p_out1", .dt_id = TEGRA20_CLK_PLL_P_OUT1 }, |
498 | .rst_reg = RST_DEVICES_L, | 433 | { .con_id = "pll_p_out2", .dt_id = TEGRA20_CLK_PLL_P_OUT2 }, |
499 | .rst_set_reg = RST_DEVICES_SET_L, | 434 | { .con_id = "pll_p_out3", .dt_id = TEGRA20_CLK_PLL_P_OUT3 }, |
500 | .rst_clr_reg = RST_DEVICES_CLR_L, | 435 | { .con_id = "pll_p_out4", .dt_id = TEGRA20_CLK_PLL_P_OUT4 }, |
501 | }; | 436 | { .con_id = "pll_m", .dt_id = TEGRA20_CLK_PLL_M }, |
502 | 437 | { .con_id = "pll_m_out1", .dt_id = TEGRA20_CLK_PLL_M_OUT1 }, | |
503 | static struct tegra_clk_periph_regs periph_h_regs = { | 438 | { .con_id = "pll_x", .dt_id = TEGRA20_CLK_PLL_X }, |
504 | .enb_reg = CLK_OUT_ENB_H, | 439 | { .con_id = "pll_u", .dt_id = TEGRA20_CLK_PLL_U }, |
505 | .enb_set_reg = CLK_OUT_ENB_SET_H, | 440 | { .con_id = "pll_d", .dt_id = TEGRA20_CLK_PLL_D }, |
506 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | 441 | { .con_id = "pll_d_out0", .dt_id = TEGRA20_CLK_PLL_D_OUT0 }, |
507 | .rst_reg = RST_DEVICES_H, | 442 | { .con_id = "pll_a", .dt_id = TEGRA20_CLK_PLL_A }, |
508 | .rst_set_reg = RST_DEVICES_SET_H, | 443 | { .con_id = "pll_a_out0", .dt_id = TEGRA20_CLK_PLL_A_OUT0 }, |
509 | .rst_clr_reg = RST_DEVICES_CLR_H, | 444 | { .con_id = "pll_e", .dt_id = TEGRA20_CLK_PLL_E }, |
445 | { .con_id = "cclk", .dt_id = TEGRA20_CLK_CCLK }, | ||
446 | { .con_id = "sclk", .dt_id = TEGRA20_CLK_SCLK }, | ||
447 | { .con_id = "hclk", .dt_id = TEGRA20_CLK_HCLK }, | ||
448 | { .con_id = "pclk", .dt_id = TEGRA20_CLK_PCLK }, | ||
449 | { .con_id = "fuse", .dt_id = TEGRA20_CLK_FUSE }, | ||
450 | { .con_id = "twd", .dt_id = TEGRA20_CLK_TWD }, | ||
451 | { .con_id = "audio", .dt_id = TEGRA20_CLK_AUDIO }, | ||
452 | { .con_id = "audio_2x", .dt_id = TEGRA20_CLK_AUDIO_2X }, | ||
453 | { .dev_id = "tegra20-ac97", .dt_id = TEGRA20_CLK_AC97 }, | ||
454 | { .dev_id = "tegra-apbdma", .dt_id = TEGRA20_CLK_APBDMA }, | ||
455 | { .dev_id = "rtc-tegra", .dt_id = TEGRA20_CLK_RTC }, | ||
456 | { .dev_id = "timer", .dt_id = TEGRA20_CLK_TIMER }, | ||
457 | { .dev_id = "tegra-kbc", .dt_id = TEGRA20_CLK_KBC }, | ||
458 | { .con_id = "csus", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_CSUS }, | ||
459 | { .con_id = "vcp", .dev_id = "tegra-avp", .dt_id = TEGRA20_CLK_VCP }, | ||
460 | { .con_id = "bsea", .dev_id = "tegra-avp", .dt_id = TEGRA20_CLK_BSEA }, | ||
461 | { .con_id = "bsev", .dev_id = "tegra-aes", .dt_id = TEGRA20_CLK_BSEV }, | ||
462 | { .con_id = "emc", .dt_id = TEGRA20_CLK_EMC }, | ||
463 | { .dev_id = "fsl-tegra-udc", .dt_id = TEGRA20_CLK_USBD }, | ||
464 | { .dev_id = "tegra-ehci.1", .dt_id = TEGRA20_CLK_USB2 }, | ||
465 | { .dev_id = "tegra-ehci.2", .dt_id = TEGRA20_CLK_USB3 }, | ||
466 | { .dev_id = "dsi", .dt_id = TEGRA20_CLK_DSI }, | ||
467 | { .con_id = "csi", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_CSI }, | ||
468 | { .con_id = "isp", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_ISP }, | ||
469 | { .con_id = "pex", .dt_id = TEGRA20_CLK_PEX }, | ||
470 | { .con_id = "afi", .dt_id = TEGRA20_CLK_AFI }, | ||
471 | { .con_id = "cdev1", .dt_id = TEGRA20_CLK_CDEV1 }, | ||
472 | { .con_id = "cdev2", .dt_id = TEGRA20_CLK_CDEV2 }, | ||
473 | { .con_id = "clk_32k", .dt_id = TEGRA20_CLK_CLK_32K }, | ||
474 | { .con_id = "blink", .dt_id = TEGRA20_CLK_BLINK }, | ||
475 | { .con_id = "clk_m", .dt_id = TEGRA20_CLK_CLK_M }, | ||
476 | { .con_id = "pll_ref", .dt_id = TEGRA20_CLK_PLL_REF }, | ||
477 | { .dev_id = "tegra20-i2s.0", .dt_id = TEGRA20_CLK_I2S1 }, | ||
478 | { .dev_id = "tegra20-i2s.1", .dt_id = TEGRA20_CLK_I2S2 }, | ||
479 | { .con_id = "spdif_out", .dev_id = "tegra20-spdif", .dt_id = TEGRA20_CLK_SPDIF_OUT }, | ||
480 | { .con_id = "spdif_in", .dev_id = "tegra20-spdif", .dt_id = TEGRA20_CLK_SPDIF_IN }, | ||
481 | { .dev_id = "spi_tegra.0", .dt_id = TEGRA20_CLK_SBC1 }, | ||
482 | { .dev_id = "spi_tegra.1", .dt_id = TEGRA20_CLK_SBC2 }, | ||
483 | { .dev_id = "spi_tegra.2", .dt_id = TEGRA20_CLK_SBC3 }, | ||
484 | { .dev_id = "spi_tegra.3", .dt_id = TEGRA20_CLK_SBC4 }, | ||
485 | { .dev_id = "spi", .dt_id = TEGRA20_CLK_SPI }, | ||
486 | { .dev_id = "xio", .dt_id = TEGRA20_CLK_XIO }, | ||
487 | { .dev_id = "twc", .dt_id = TEGRA20_CLK_TWC }, | ||
488 | { .dev_id = "ide", .dt_id = TEGRA20_CLK_IDE }, | ||
489 | { .dev_id = "tegra_nand", .dt_id = TEGRA20_CLK_NDFLASH }, | ||
490 | { .dev_id = "vfir", .dt_id = TEGRA20_CLK_VFIR }, | ||
491 | { .dev_id = "csite", .dt_id = TEGRA20_CLK_CSITE }, | ||
492 | { .dev_id = "la", .dt_id = TEGRA20_CLK_LA }, | ||
493 | { .dev_id = "tegra_w1", .dt_id = TEGRA20_CLK_OWR }, | ||
494 | { .dev_id = "mipi", .dt_id = TEGRA20_CLK_MIPI }, | ||
495 | { .dev_id = "vde", .dt_id = TEGRA20_CLK_VDE }, | ||
496 | { .con_id = "vi", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_VI }, | ||
497 | { .dev_id = "epp", .dt_id = TEGRA20_CLK_EPP }, | ||
498 | { .dev_id = "mpe", .dt_id = TEGRA20_CLK_MPE }, | ||
499 | { .dev_id = "host1x", .dt_id = TEGRA20_CLK_HOST1X }, | ||
500 | { .dev_id = "3d", .dt_id = TEGRA20_CLK_GR3D }, | ||
501 | { .dev_id = "2d", .dt_id = TEGRA20_CLK_GR2D }, | ||
502 | { .dev_id = "tegra-nor", .dt_id = TEGRA20_CLK_NOR }, | ||
503 | { .dev_id = "sdhci-tegra.0", .dt_id = TEGRA20_CLK_SDMMC1 }, | ||
504 | { .dev_id = "sdhci-tegra.1", .dt_id = TEGRA20_CLK_SDMMC2 }, | ||
505 | { .dev_id = "sdhci-tegra.2", .dt_id = TEGRA20_CLK_SDMMC3 }, | ||
506 | { .dev_id = "sdhci-tegra.3", .dt_id = TEGRA20_CLK_SDMMC4 }, | ||
507 | { .dev_id = "cve", .dt_id = TEGRA20_CLK_CVE }, | ||
508 | { .dev_id = "tvo", .dt_id = TEGRA20_CLK_TVO }, | ||
509 | { .dev_id = "tvdac", .dt_id = TEGRA20_CLK_TVDAC }, | ||
510 | { .con_id = "vi_sensor", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_VI_SENSOR }, | ||
511 | { .dev_id = "hdmi", .dt_id = TEGRA20_CLK_HDMI }, | ||
512 | { .con_id = "div-clk", .dev_id = "tegra-i2c.0", .dt_id = TEGRA20_CLK_I2C1 }, | ||
513 | { .con_id = "div-clk", .dev_id = "tegra-i2c.1", .dt_id = TEGRA20_CLK_I2C2 }, | ||
514 | { .con_id = "div-clk", .dev_id = "tegra-i2c.2", .dt_id = TEGRA20_CLK_I2C3 }, | ||
515 | { .con_id = "div-clk", .dev_id = "tegra-i2c.3", .dt_id = TEGRA20_CLK_DVC }, | ||
516 | { .dev_id = "tegra-pwm", .dt_id = TEGRA20_CLK_PWM }, | ||
517 | { .dev_id = "tegra_uart.0", .dt_id = TEGRA20_CLK_UARTA }, | ||
518 | { .dev_id = "tegra_uart.1", .dt_id = TEGRA20_CLK_UARTB }, | ||
519 | { .dev_id = "tegra_uart.2", .dt_id = TEGRA20_CLK_UARTC }, | ||
520 | { .dev_id = "tegra_uart.3", .dt_id = TEGRA20_CLK_UARTD }, | ||
521 | { .dev_id = "tegra_uart.4", .dt_id = TEGRA20_CLK_UARTE }, | ||
522 | { .dev_id = "tegradc.0", .dt_id = TEGRA20_CLK_DISP1 }, | ||
523 | { .dev_id = "tegradc.1", .dt_id = TEGRA20_CLK_DISP2 }, | ||
510 | }; | 524 | }; |
511 | 525 | ||
512 | static struct tegra_clk_periph_regs periph_u_regs = { | 526 | static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = { |
513 | .enb_reg = CLK_OUT_ENB_U, | 527 | [tegra_clk_spdif_out] = { .dt_id = TEGRA20_CLK_SPDIF_OUT, .present = true }, |
514 | .enb_set_reg = CLK_OUT_ENB_SET_U, | 528 | [tegra_clk_spdif_in] = { .dt_id = TEGRA20_CLK_SPDIF_IN, .present = true }, |
515 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | 529 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA20_CLK_SDMMC1, .present = true }, |
516 | .rst_reg = RST_DEVICES_U, | 530 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA20_CLK_SDMMC2, .present = true }, |
517 | .rst_set_reg = RST_DEVICES_SET_U, | 531 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA20_CLK_SDMMC3, .present = true }, |
518 | .rst_clr_reg = RST_DEVICES_CLR_U, | 532 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA20_CLK_SDMMC4, .present = true }, |
533 | [tegra_clk_la] = { .dt_id = TEGRA20_CLK_LA, .present = true }, | ||
534 | [tegra_clk_csite] = { .dt_id = TEGRA20_CLK_CSITE, .present = true }, | ||
535 | [tegra_clk_vfir] = { .dt_id = TEGRA20_CLK_VFIR, .present = true }, | ||
536 | [tegra_clk_mipi] = { .dt_id = TEGRA20_CLK_MIPI, .present = true }, | ||
537 | [tegra_clk_nor] = { .dt_id = TEGRA20_CLK_NOR, .present = true }, | ||
538 | [tegra_clk_rtc] = { .dt_id = TEGRA20_CLK_RTC, .present = true }, | ||
539 | [tegra_clk_timer] = { .dt_id = TEGRA20_CLK_TIMER, .present = true }, | ||
540 | [tegra_clk_kbc] = { .dt_id = TEGRA20_CLK_KBC, .present = true }, | ||
541 | [tegra_clk_csus] = { .dt_id = TEGRA20_CLK_CSUS, .present = true }, | ||
542 | [tegra_clk_vcp] = { .dt_id = TEGRA20_CLK_VCP, .present = true }, | ||
543 | [tegra_clk_bsea] = { .dt_id = TEGRA20_CLK_BSEA, .present = true }, | ||
544 | [tegra_clk_bsev] = { .dt_id = TEGRA20_CLK_BSEV, .present = true }, | ||
545 | [tegra_clk_usbd] = { .dt_id = TEGRA20_CLK_USBD, .present = true }, | ||
546 | [tegra_clk_usb2] = { .dt_id = TEGRA20_CLK_USB2, .present = true }, | ||
547 | [tegra_clk_usb3] = { .dt_id = TEGRA20_CLK_USB3, .present = true }, | ||
548 | [tegra_clk_csi] = { .dt_id = TEGRA20_CLK_CSI, .present = true }, | ||
549 | [tegra_clk_isp] = { .dt_id = TEGRA20_CLK_ISP, .present = true }, | ||
550 | [tegra_clk_clk_32k] = { .dt_id = TEGRA20_CLK_CLK_32K, .present = true }, | ||
551 | [tegra_clk_blink] = { .dt_id = TEGRA20_CLK_BLINK, .present = true }, | ||
552 | [tegra_clk_hclk] = { .dt_id = TEGRA20_CLK_HCLK, .present = true }, | ||
553 | [tegra_clk_pclk] = { .dt_id = TEGRA20_CLK_PCLK, .present = true }, | ||
554 | [tegra_clk_pll_p_out1] = { .dt_id = TEGRA20_CLK_PLL_P_OUT1, .present = true }, | ||
555 | [tegra_clk_pll_p_out2] = { .dt_id = TEGRA20_CLK_PLL_P_OUT2, .present = true }, | ||
556 | [tegra_clk_pll_p_out3] = { .dt_id = TEGRA20_CLK_PLL_P_OUT3, .present = true }, | ||
557 | [tegra_clk_pll_p_out4] = { .dt_id = TEGRA20_CLK_PLL_P_OUT4, .present = true }, | ||
558 | [tegra_clk_pll_p] = { .dt_id = TEGRA20_CLK_PLL_P, .present = true }, | ||
559 | [tegra_clk_owr] = { .dt_id = TEGRA20_CLK_OWR, .present = true }, | ||
560 | [tegra_clk_sbc1] = { .dt_id = TEGRA20_CLK_SBC1, .present = true }, | ||
561 | [tegra_clk_sbc2] = { .dt_id = TEGRA20_CLK_SBC2, .present = true }, | ||
562 | [tegra_clk_sbc3] = { .dt_id = TEGRA20_CLK_SBC3, .present = true }, | ||
563 | [tegra_clk_sbc4] = { .dt_id = TEGRA20_CLK_SBC4, .present = true }, | ||
564 | [tegra_clk_vde] = { .dt_id = TEGRA20_CLK_VDE, .present = true }, | ||
565 | [tegra_clk_vi] = { .dt_id = TEGRA20_CLK_VI, .present = true }, | ||
566 | [tegra_clk_epp] = { .dt_id = TEGRA20_CLK_EPP, .present = true }, | ||
567 | [tegra_clk_mpe] = { .dt_id = TEGRA20_CLK_MPE, .present = true }, | ||
568 | [tegra_clk_host1x] = { .dt_id = TEGRA20_CLK_HOST1X, .present = true }, | ||
569 | [tegra_clk_gr2d] = { .dt_id = TEGRA20_CLK_GR2D, .present = true }, | ||
570 | [tegra_clk_gr3d] = { .dt_id = TEGRA20_CLK_GR3D, .present = true }, | ||
571 | [tegra_clk_ndflash] = { .dt_id = TEGRA20_CLK_NDFLASH, .present = true }, | ||
572 | [tegra_clk_cve] = { .dt_id = TEGRA20_CLK_CVE, .present = true }, | ||
573 | [tegra_clk_tvo] = { .dt_id = TEGRA20_CLK_TVO, .present = true }, | ||
574 | [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true }, | ||
575 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true }, | ||
576 | [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true }, | ||
519 | }; | 577 | }; |
520 | 578 | ||
521 | static unsigned long tegra20_clk_measure_input_freq(void) | 579 | static unsigned long tegra20_clk_measure_input_freq(void) |
@@ -577,10 +635,8 @@ static void tegra20_pll_init(void) | |||
577 | 635 | ||
578 | /* PLLC */ | 636 | /* PLLC */ |
579 | clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, NULL, 0, | 637 | clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, NULL, 0, |
580 | 0, &pll_c_params, TEGRA_PLL_HAS_CPCON, | 638 | &pll_c_params, NULL); |
581 | pll_c_freq_table, NULL); | 639 | clks[TEGRA20_CLK_PLL_C] = clk; |
582 | clk_register_clkdev(clk, "pll_c", NULL); | ||
583 | clks[pll_c] = clk; | ||
584 | 640 | ||
585 | /* PLLC_OUT1 */ | 641 | /* PLLC_OUT1 */ |
586 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | 642 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", |
@@ -589,71 +645,13 @@ static void tegra20_pll_init(void) | |||
589 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | 645 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", |
590 | clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT, | 646 | clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT, |
591 | 0, NULL); | 647 | 0, NULL); |
592 | clk_register_clkdev(clk, "pll_c_out1", NULL); | 648 | clks[TEGRA20_CLK_PLL_C_OUT1] = clk; |
593 | clks[pll_c_out1] = clk; | ||
594 | |||
595 | /* PLLP */ | ||
596 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, NULL, 0, | ||
597 | 216000000, &pll_p_params, TEGRA_PLL_FIXED | | ||
598 | TEGRA_PLL_HAS_CPCON, pll_p_freq_table, NULL); | ||
599 | clk_register_clkdev(clk, "pll_p", NULL); | ||
600 | clks[pll_p] = clk; | ||
601 | |||
602 | /* PLLP_OUT1 */ | ||
603 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", | ||
604 | clk_base + PLLP_OUTA, 0, | ||
605 | TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP, | ||
606 | 8, 8, 1, &pll_div_lock); | ||
607 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", | ||
608 | clk_base + PLLP_OUTA, 1, 0, | ||
609 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
610 | &pll_div_lock); | ||
611 | clk_register_clkdev(clk, "pll_p_out1", NULL); | ||
612 | clks[pll_p_out1] = clk; | ||
613 | |||
614 | /* PLLP_OUT2 */ | ||
615 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", | ||
616 | clk_base + PLLP_OUTA, 0, | ||
617 | TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP, | ||
618 | 24, 8, 1, &pll_div_lock); | ||
619 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", | ||
620 | clk_base + PLLP_OUTA, 17, 16, | ||
621 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
622 | &pll_div_lock); | ||
623 | clk_register_clkdev(clk, "pll_p_out2", NULL); | ||
624 | clks[pll_p_out2] = clk; | ||
625 | |||
626 | /* PLLP_OUT3 */ | ||
627 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", | ||
628 | clk_base + PLLP_OUTB, 0, | ||
629 | TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP, | ||
630 | 8, 8, 1, &pll_div_lock); | ||
631 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", | ||
632 | clk_base + PLLP_OUTB, 1, 0, | ||
633 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
634 | &pll_div_lock); | ||
635 | clk_register_clkdev(clk, "pll_p_out3", NULL); | ||
636 | clks[pll_p_out3] = clk; | ||
637 | |||
638 | /* PLLP_OUT4 */ | ||
639 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", | ||
640 | clk_base + PLLP_OUTB, 0, | ||
641 | TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP, | ||
642 | 24, 8, 1, &pll_div_lock); | ||
643 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", | ||
644 | clk_base + PLLP_OUTB, 17, 16, | ||
645 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
646 | &pll_div_lock); | ||
647 | clk_register_clkdev(clk, "pll_p_out4", NULL); | ||
648 | clks[pll_p_out4] = clk; | ||
649 | 649 | ||
650 | /* PLLM */ | 650 | /* PLLM */ |
651 | clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, NULL, | 651 | clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, NULL, |
652 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, | 652 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
653 | &pll_m_params, TEGRA_PLL_HAS_CPCON, | 653 | &pll_m_params, NULL); |
654 | pll_m_freq_table, NULL); | 654 | clks[TEGRA20_CLK_PLL_M] = clk; |
655 | clk_register_clkdev(clk, "pll_m", NULL); | ||
656 | clks[pll_m] = clk; | ||
657 | 655 | ||
658 | /* PLLM_OUT1 */ | 656 | /* PLLM_OUT1 */ |
659 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | 657 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", |
@@ -662,42 +660,32 @@ static void tegra20_pll_init(void) | |||
662 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | 660 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", |
663 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | 661 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | |
664 | CLK_SET_RATE_PARENT, 0, NULL); | 662 | CLK_SET_RATE_PARENT, 0, NULL); |
665 | clk_register_clkdev(clk, "pll_m_out1", NULL); | 663 | clks[TEGRA20_CLK_PLL_M_OUT1] = clk; |
666 | clks[pll_m_out1] = clk; | ||
667 | 664 | ||
668 | /* PLLX */ | 665 | /* PLLX */ |
669 | clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, NULL, 0, | 666 | clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, NULL, 0, |
670 | 0, &pll_x_params, TEGRA_PLL_HAS_CPCON, | 667 | &pll_x_params, NULL); |
671 | pll_x_freq_table, NULL); | 668 | clks[TEGRA20_CLK_PLL_X] = clk; |
672 | clk_register_clkdev(clk, "pll_x", NULL); | ||
673 | clks[pll_x] = clk; | ||
674 | 669 | ||
675 | /* PLLU */ | 670 | /* PLLU */ |
676 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, NULL, 0, | 671 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, NULL, 0, |
677 | 0, &pll_u_params, TEGRA_PLLU | TEGRA_PLL_HAS_CPCON, | 672 | &pll_u_params, NULL); |
678 | pll_u_freq_table, NULL); | 673 | clks[TEGRA20_CLK_PLL_U] = clk; |
679 | clk_register_clkdev(clk, "pll_u", NULL); | ||
680 | clks[pll_u] = clk; | ||
681 | 674 | ||
682 | /* PLLD */ | 675 | /* PLLD */ |
683 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, NULL, 0, | 676 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, NULL, 0, |
684 | 0, &pll_d_params, TEGRA_PLL_HAS_CPCON, | 677 | &pll_d_params, NULL); |
685 | pll_d_freq_table, NULL); | 678 | clks[TEGRA20_CLK_PLL_D] = clk; |
686 | clk_register_clkdev(clk, "pll_d", NULL); | ||
687 | clks[pll_d] = clk; | ||
688 | 679 | ||
689 | /* PLLD_OUT0 */ | 680 | /* PLLD_OUT0 */ |
690 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | 681 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", |
691 | CLK_SET_RATE_PARENT, 1, 2); | 682 | CLK_SET_RATE_PARENT, 1, 2); |
692 | clk_register_clkdev(clk, "pll_d_out0", NULL); | 683 | clks[TEGRA20_CLK_PLL_D_OUT0] = clk; |
693 | clks[pll_d_out0] = clk; | ||
694 | 684 | ||
695 | /* PLLA */ | 685 | /* PLLA */ |
696 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, NULL, 0, | 686 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, NULL, 0, |
697 | 0, &pll_a_params, TEGRA_PLL_HAS_CPCON, | 687 | &pll_a_params, NULL); |
698 | pll_a_freq_table, NULL); | 688 | clks[TEGRA20_CLK_PLL_A] = clk; |
699 | clk_register_clkdev(clk, "pll_a", NULL); | ||
700 | clks[pll_a] = clk; | ||
701 | 689 | ||
702 | /* PLLA_OUT0 */ | 690 | /* PLLA_OUT0 */ |
703 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | 691 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", |
@@ -706,15 +694,12 @@ static void tegra20_pll_init(void) | |||
706 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | 694 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", |
707 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | 695 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | |
708 | CLK_SET_RATE_PARENT, 0, NULL); | 696 | CLK_SET_RATE_PARENT, 0, NULL); |
709 | clk_register_clkdev(clk, "pll_a_out0", NULL); | 697 | clks[TEGRA20_CLK_PLL_A_OUT0] = clk; |
710 | clks[pll_a_out0] = clk; | ||
711 | 698 | ||
712 | /* PLLE */ | 699 | /* PLLE */ |
713 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base, | 700 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base, |
714 | 0, 100000000, &pll_e_params, | 701 | 0, &pll_e_params, NULL); |
715 | 0, pll_e_freq_table, NULL); | 702 | clks[TEGRA20_CLK_PLL_E] = clk; |
716 | clk_register_clkdev(clk, "pll_e", NULL); | ||
717 | clks[pll_e] = clk; | ||
718 | } | 703 | } |
719 | 704 | ||
720 | static const char *cclk_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | 705 | static const char *cclk_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", |
@@ -732,40 +717,17 @@ static void tegra20_super_clk_init(void) | |||
732 | clk = tegra_clk_register_super_mux("cclk", cclk_parents, | 717 | clk = tegra_clk_register_super_mux("cclk", cclk_parents, |
733 | ARRAY_SIZE(cclk_parents), CLK_SET_RATE_PARENT, | 718 | ARRAY_SIZE(cclk_parents), CLK_SET_RATE_PARENT, |
734 | clk_base + CCLK_BURST_POLICY, 0, 4, 0, 0, NULL); | 719 | clk_base + CCLK_BURST_POLICY, 0, 4, 0, 0, NULL); |
735 | clk_register_clkdev(clk, "cclk", NULL); | 720 | clks[TEGRA20_CLK_CCLK] = clk; |
736 | clks[cclk] = clk; | ||
737 | 721 | ||
738 | /* SCLK */ | 722 | /* SCLK */ |
739 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | 723 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, |
740 | ARRAY_SIZE(sclk_parents), CLK_SET_RATE_PARENT, | 724 | ARRAY_SIZE(sclk_parents), CLK_SET_RATE_PARENT, |
741 | clk_base + SCLK_BURST_POLICY, 0, 4, 0, 0, NULL); | 725 | clk_base + SCLK_BURST_POLICY, 0, 4, 0, 0, NULL); |
742 | clk_register_clkdev(clk, "sclk", NULL); | 726 | clks[TEGRA20_CLK_SCLK] = clk; |
743 | clks[sclk] = clk; | ||
744 | |||
745 | /* HCLK */ | ||
746 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
747 | clk_base + CLK_SYSTEM_RATE, 4, 2, 0, | ||
748 | &sysrate_lock); | ||
749 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT, | ||
750 | clk_base + CLK_SYSTEM_RATE, 7, | ||
751 | CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
752 | clk_register_clkdev(clk, "hclk", NULL); | ||
753 | clks[hclk] = clk; | ||
754 | |||
755 | /* PCLK */ | ||
756 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
757 | clk_base + CLK_SYSTEM_RATE, 0, 2, 0, | ||
758 | &sysrate_lock); | ||
759 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT, | ||
760 | clk_base + CLK_SYSTEM_RATE, 3, | ||
761 | CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
762 | clk_register_clkdev(clk, "pclk", NULL); | ||
763 | clks[pclk] = clk; | ||
764 | 727 | ||
765 | /* twd */ | 728 | /* twd */ |
766 | clk = clk_register_fixed_factor(NULL, "twd", "cclk", 0, 1, 4); | 729 | clk = clk_register_fixed_factor(NULL, "twd", "cclk", 0, 1, 4); |
767 | clk_register_clkdev(clk, "twd", NULL); | 730 | clks[TEGRA20_CLK_TWD] = clk; |
768 | clks[twd] = clk; | ||
769 | } | 731 | } |
770 | 732 | ||
771 | static const char *audio_parents[] = {"spdif_in", "i2s1", "i2s2", "unused", | 733 | static const char *audio_parents[] = {"spdif_in", "i2s1", "i2s2", "unused", |
@@ -784,18 +746,16 @@ static void __init tegra20_audio_clk_init(void) | |||
784 | clk = clk_register_gate(NULL, "audio", "audio_mux", 0, | 746 | clk = clk_register_gate(NULL, "audio", "audio_mux", 0, |
785 | clk_base + AUDIO_SYNC_CLK, 4, | 747 | clk_base + AUDIO_SYNC_CLK, 4, |
786 | CLK_GATE_SET_TO_DISABLE, NULL); | 748 | CLK_GATE_SET_TO_DISABLE, NULL); |
787 | clk_register_clkdev(clk, "audio", NULL); | 749 | clks[TEGRA20_CLK_AUDIO] = clk; |
788 | clks[audio] = clk; | ||
789 | 750 | ||
790 | /* audio_2x */ | 751 | /* audio_2x */ |
791 | clk = clk_register_fixed_factor(NULL, "audio_doubler", "audio", | 752 | clk = clk_register_fixed_factor(NULL, "audio_doubler", "audio", |
792 | CLK_SET_RATE_PARENT, 2, 1); | 753 | CLK_SET_RATE_PARENT, 2, 1); |
793 | clk = tegra_clk_register_periph_gate("audio_2x", "audio_doubler", | 754 | clk = tegra_clk_register_periph_gate("audio_2x", "audio_doubler", |
794 | TEGRA_PERIPH_NO_RESET, clk_base, | 755 | TEGRA_PERIPH_NO_RESET, clk_base, |
795 | CLK_SET_RATE_PARENT, 89, &periph_u_regs, | 756 | CLK_SET_RATE_PARENT, 89, |
796 | periph_clk_enb_refcnt); | 757 | periph_clk_enb_refcnt); |
797 | clk_register_clkdev(clk, "audio_2x", NULL); | 758 | clks[TEGRA20_CLK_AUDIO_2X] = clk; |
798 | clks[audio_2x] = clk; | ||
799 | 759 | ||
800 | } | 760 | } |
801 | 761 | ||
@@ -803,68 +763,36 @@ static const char *i2s1_parents[] = {"pll_a_out0", "audio_2x", "pll_p", | |||
803 | "clk_m"}; | 763 | "clk_m"}; |
804 | static const char *i2s2_parents[] = {"pll_a_out0", "audio_2x", "pll_p", | 764 | static const char *i2s2_parents[] = {"pll_a_out0", "audio_2x", "pll_p", |
805 | "clk_m"}; | 765 | "clk_m"}; |
806 | static const char *spdif_out_parents[] = {"pll_a_out0", "audio_2x", "pll_p", | ||
807 | "clk_m"}; | ||
808 | static const char *spdif_in_parents[] = {"pll_p", "pll_c", "pll_m"}; | ||
809 | static const char *pwm_parents[] = {"pll_p", "pll_c", "audio", "clk_m", | 766 | static const char *pwm_parents[] = {"pll_p", "pll_c", "audio", "clk_m", |
810 | "clk_32k"}; | 767 | "clk_32k"}; |
811 | static const char *mux_pllpcm_clkm[] = {"pll_p", "pll_c", "pll_m", "clk_m"}; | 768 | static const char *mux_pllpcm_clkm[] = {"pll_p", "pll_c", "pll_m", "clk_m"}; |
812 | static const char *mux_pllmcpa[] = {"pll_m", "pll_c", "pll_c", "pll_a"}; | ||
813 | static const char *mux_pllpdc_clkm[] = {"pll_p", "pll_d_out0", "pll_c", | 769 | static const char *mux_pllpdc_clkm[] = {"pll_p", "pll_d_out0", "pll_c", |
814 | "clk_m"}; | 770 | "clk_m"}; |
815 | static const char *mux_pllmcp_clkm[] = {"pll_m", "pll_c", "pll_p", "clk_m"}; | 771 | static const char *mux_pllmcp_clkm[] = {"pll_m", "pll_c", "pll_p", "clk_m"}; |
816 | 772 | ||
817 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { | 773 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { |
818 | TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra20-i2s.0", i2s1_parents, CLK_SOURCE_I2S1, 11, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1), | 774 | TEGRA_INIT_DATA_MUX("i2s1", i2s1_parents, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2S1), |
819 | TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra20-i2s.1", i2s2_parents, CLK_SOURCE_I2S2, 18, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2), | 775 | TEGRA_INIT_DATA_MUX("i2s2", i2s2_parents, CLK_SOURCE_I2S2, 18, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2S2), |
820 | TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra20-spdif", spdif_out_parents, CLK_SOURCE_SPDIF_OUT, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out), | 776 | TEGRA_INIT_DATA_MUX("spi", mux_pllpcm_clkm, CLK_SOURCE_SPI, 43, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_SPI), |
821 | TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra20-spdif", spdif_in_parents, CLK_SOURCE_SPDIF_IN, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in), | 777 | TEGRA_INIT_DATA_MUX("xio", mux_pllpcm_clkm, CLK_SOURCE_XIO, 45, 0, TEGRA20_CLK_XIO), |
822 | TEGRA_INIT_DATA_MUX("sbc1", NULL, "spi_tegra.0", mux_pllpcm_clkm, CLK_SOURCE_SBC1, 41, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1), | 778 | TEGRA_INIT_DATA_MUX("twc", mux_pllpcm_clkm, CLK_SOURCE_TWC, 16, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_TWC), |
823 | TEGRA_INIT_DATA_MUX("sbc2", NULL, "spi_tegra.1", mux_pllpcm_clkm, CLK_SOURCE_SBC2, 44, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2), | 779 | TEGRA_INIT_DATA_MUX("ide", mux_pllpcm_clkm, CLK_SOURCE_XIO, 25, 0, TEGRA20_CLK_IDE), |
824 | TEGRA_INIT_DATA_MUX("sbc3", NULL, "spi_tegra.2", mux_pllpcm_clkm, CLK_SOURCE_SBC3, 46, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3), | 780 | TEGRA_INIT_DATA_DIV16("dvc", mux_pllpcm_clkm, CLK_SOURCE_DVC, 47, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_DVC), |
825 | TEGRA_INIT_DATA_MUX("sbc4", NULL, "spi_tegra.3", mux_pllpcm_clkm, CLK_SOURCE_SBC4, 68, &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4), | 781 | TEGRA_INIT_DATA_DIV16("i2c1", mux_pllpcm_clkm, CLK_SOURCE_I2C1, 12, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C1), |
826 | TEGRA_INIT_DATA_MUX("spi", NULL, "spi", mux_pllpcm_clkm, CLK_SOURCE_SPI, 43, &periph_h_regs, TEGRA_PERIPH_ON_APB, spi), | 782 | TEGRA_INIT_DATA_DIV16("i2c2", mux_pllpcm_clkm, CLK_SOURCE_I2C2, 54, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C2), |
827 | TEGRA_INIT_DATA_MUX("xio", NULL, "xio", mux_pllpcm_clkm, CLK_SOURCE_XIO, 45, &periph_h_regs, 0, xio), | 783 | TEGRA_INIT_DATA_DIV16("i2c3", mux_pllpcm_clkm, CLK_SOURCE_I2C3, 67, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C3), |
828 | TEGRA_INIT_DATA_MUX("twc", NULL, "twc", mux_pllpcm_clkm, CLK_SOURCE_TWC, 16, &periph_l_regs, TEGRA_PERIPH_ON_APB, twc), | 784 | TEGRA_INIT_DATA_MUX("hdmi", mux_pllpdc_clkm, CLK_SOURCE_HDMI, 51, 0, TEGRA20_CLK_HDMI), |
829 | TEGRA_INIT_DATA_MUX("ide", NULL, "ide", mux_pllpcm_clkm, CLK_SOURCE_XIO, 25, &periph_l_regs, 0, ide), | 785 | TEGRA_INIT_DATA("pwm", NULL, NULL, pwm_parents, CLK_SOURCE_PWM, 28, 3, 0, 0, 8, 1, 0, 17, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_PWM), |
830 | TEGRA_INIT_DATA_MUX("ndflash", NULL, "tegra_nand", mux_pllpcm_clkm, CLK_SOURCE_NDFLASH, 13, &periph_l_regs, 0, ndflash), | ||
831 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllpcm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), | ||
832 | TEGRA_INIT_DATA_MUX("csite", NULL, "csite", mux_pllpcm_clkm, CLK_SOURCE_CSITE, 73, &periph_u_regs, 0, csite), | ||
833 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllpcm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, 0, la), | ||
834 | TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllpcm_clkm, CLK_SOURCE_OWR, 71, &periph_u_regs, TEGRA_PERIPH_ON_APB, owr), | ||
835 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllpcm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), | ||
836 | TEGRA_INIT_DATA_MUX("vde", NULL, "vde", mux_pllpcm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), | ||
837 | TEGRA_INIT_DATA_MUX("vi", "vi", "tegra_camera", mux_pllmcpa, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), | ||
838 | TEGRA_INIT_DATA_MUX("epp", NULL, "epp", mux_pllmcpa, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), | ||
839 | TEGRA_INIT_DATA_MUX("mpe", NULL, "mpe", mux_pllmcpa, CLK_SOURCE_MPE, 60, &periph_h_regs, 0, mpe), | ||
840 | TEGRA_INIT_DATA_MUX("host1x", NULL, "host1x", mux_pllmcpa, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), | ||
841 | TEGRA_INIT_DATA_MUX("3d", NULL, "3d", mux_pllmcpa, CLK_SOURCE_3D, 24, &periph_l_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d), | ||
842 | TEGRA_INIT_DATA_MUX("2d", NULL, "2d", mux_pllmcpa, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr2d), | ||
843 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllpcm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), | ||
844 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllpcm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), | ||
845 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllpcm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), | ||
846 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllpcm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), | ||
847 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllpcm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), | ||
848 | TEGRA_INIT_DATA_MUX("cve", NULL, "cve", mux_pllpdc_clkm, CLK_SOURCE_CVE, 49, &periph_h_regs, 0, cve), | ||
849 | TEGRA_INIT_DATA_MUX("tvo", NULL, "tvo", mux_pllpdc_clkm, CLK_SOURCE_TVO, 49, &periph_h_regs, 0, tvo), | ||
850 | TEGRA_INIT_DATA_MUX("tvdac", NULL, "tvdac", mux_pllpdc_clkm, CLK_SOURCE_TVDAC, 53, &periph_h_regs, 0, tvdac), | ||
851 | TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllmcpa, CLK_SOURCE_VI_SENSOR, 20, &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor), | ||
852 | TEGRA_INIT_DATA_DIV16("i2c1", "div-clk", "tegra-i2c.0", mux_pllpcm_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2c1), | ||
853 | TEGRA_INIT_DATA_DIV16("i2c2", "div-clk", "tegra-i2c.1", mux_pllpcm_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c2), | ||
854 | TEGRA_INIT_DATA_DIV16("i2c3", "div-clk", "tegra-i2c.2", mux_pllpcm_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2c3), | ||
855 | TEGRA_INIT_DATA_DIV16("dvc", "div-clk", "tegra-i2c.3", mux_pllpcm_clkm, CLK_SOURCE_DVC, 47, &periph_h_regs, TEGRA_PERIPH_ON_APB, dvc), | ||
856 | TEGRA_INIT_DATA_MUX("hdmi", NULL, "hdmi", mux_pllpdc_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), | ||
857 | TEGRA_INIT_DATA("pwm", NULL, "tegra-pwm", pwm_parents, CLK_SOURCE_PWM, 28, 3, 0, 0, 8, 1, 0, &periph_l_regs, 17, periph_clk_enb_refcnt, TEGRA_PERIPH_ON_APB, pwm), | ||
858 | }; | 786 | }; |
859 | 787 | ||
860 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { | 788 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { |
861 | TEGRA_INIT_DATA_NODIV("uarta", NULL, "tegra_uart.0", mux_pllpcm_clkm, CLK_SOURCE_UARTA, 30, 2, 6, &periph_l_regs, TEGRA_PERIPH_ON_APB, uarta), | 789 | TEGRA_INIT_DATA_NODIV("uarta", mux_pllpcm_clkm, CLK_SOURCE_UARTA, 30, 2, 6, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTA), |
862 | TEGRA_INIT_DATA_NODIV("uartb", NULL, "tegra_uart.1", mux_pllpcm_clkm, CLK_SOURCE_UARTB, 30, 2, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, uartb), | 790 | TEGRA_INIT_DATA_NODIV("uartb", mux_pllpcm_clkm, CLK_SOURCE_UARTB, 30, 2, 7, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTB), |
863 | TEGRA_INIT_DATA_NODIV("uartc", NULL, "tegra_uart.2", mux_pllpcm_clkm, CLK_SOURCE_UARTC, 30, 2, 55, &periph_h_regs, TEGRA_PERIPH_ON_APB, uartc), | 791 | TEGRA_INIT_DATA_NODIV("uartc", mux_pllpcm_clkm, CLK_SOURCE_UARTC, 30, 2, 55, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTC), |
864 | TEGRA_INIT_DATA_NODIV("uartd", NULL, "tegra_uart.3", mux_pllpcm_clkm, CLK_SOURCE_UARTD, 30, 2, 65, &periph_u_regs, TEGRA_PERIPH_ON_APB, uartd), | 792 | TEGRA_INIT_DATA_NODIV("uartd", mux_pllpcm_clkm, CLK_SOURCE_UARTD, 30, 2, 65, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTD), |
865 | TEGRA_INIT_DATA_NODIV("uarte", NULL, "tegra_uart.4", mux_pllpcm_clkm, CLK_SOURCE_UARTE, 30, 2, 66, &periph_u_regs, TEGRA_PERIPH_ON_APB, uarte), | 793 | TEGRA_INIT_DATA_NODIV("uarte", mux_pllpcm_clkm, CLK_SOURCE_UARTE, 30, 2, 66, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTE), |
866 | TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllpdc_clkm, CLK_SOURCE_DISP1, 30, 2, 27, &periph_l_regs, 0, disp1), | 794 | TEGRA_INIT_DATA_NODIV("disp1", mux_pllpdc_clkm, CLK_SOURCE_DISP1, 30, 2, 27, 0, TEGRA20_CLK_DISP1), |
867 | TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllpdc_clkm, CLK_SOURCE_DISP2, 30, 2, 26, &periph_l_regs, 0, disp2), | 795 | TEGRA_INIT_DATA_NODIV("disp2", mux_pllpdc_clkm, CLK_SOURCE_DISP2, 30, 2, 26, 0, TEGRA20_CLK_DISP2), |
868 | }; | 796 | }; |
869 | 797 | ||
870 | static void __init tegra20_periph_clk_init(void) | 798 | static void __init tegra20_periph_clk_init(void) |
@@ -876,69 +804,13 @@ static void __init tegra20_periph_clk_init(void) | |||
876 | /* ac97 */ | 804 | /* ac97 */ |
877 | clk = tegra_clk_register_periph_gate("ac97", "pll_a_out0", | 805 | clk = tegra_clk_register_periph_gate("ac97", "pll_a_out0", |
878 | TEGRA_PERIPH_ON_APB, | 806 | TEGRA_PERIPH_ON_APB, |
879 | clk_base, 0, 3, &periph_l_regs, | 807 | clk_base, 0, 3, periph_clk_enb_refcnt); |
880 | periph_clk_enb_refcnt); | 808 | clks[TEGRA20_CLK_AC97] = clk; |
881 | clk_register_clkdev(clk, NULL, "tegra20-ac97"); | ||
882 | clks[ac97] = clk; | ||
883 | 809 | ||
884 | /* apbdma */ | 810 | /* apbdma */ |
885 | clk = tegra_clk_register_periph_gate("apbdma", "pclk", 0, clk_base, | 811 | clk = tegra_clk_register_periph_gate("apbdma", "pclk", 0, clk_base, |
886 | 0, 34, &periph_h_regs, | 812 | 0, 34, periph_clk_enb_refcnt); |
887 | periph_clk_enb_refcnt); | 813 | clks[TEGRA20_CLK_APBDMA] = clk; |
888 | clk_register_clkdev(clk, NULL, "tegra-apbdma"); | ||
889 | clks[apbdma] = clk; | ||
890 | |||
891 | /* rtc */ | ||
892 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", | ||
893 | TEGRA_PERIPH_NO_RESET, | ||
894 | clk_base, 0, 4, &periph_l_regs, | ||
895 | periph_clk_enb_refcnt); | ||
896 | clk_register_clkdev(clk, NULL, "rtc-tegra"); | ||
897 | clks[rtc] = clk; | ||
898 | |||
899 | /* timer */ | ||
900 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, | ||
901 | 0, 5, &periph_l_regs, | ||
902 | periph_clk_enb_refcnt); | ||
903 | clk_register_clkdev(clk, NULL, "timer"); | ||
904 | clks[timer] = clk; | ||
905 | |||
906 | /* kbc */ | ||
907 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", | ||
908 | TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB, | ||
909 | clk_base, 0, 36, &periph_h_regs, | ||
910 | periph_clk_enb_refcnt); | ||
911 | clk_register_clkdev(clk, NULL, "tegra-kbc"); | ||
912 | clks[kbc] = clk; | ||
913 | |||
914 | /* csus */ | ||
915 | clk = tegra_clk_register_periph_gate("csus", "clk_m", | ||
916 | TEGRA_PERIPH_NO_RESET, | ||
917 | clk_base, 0, 92, &periph_u_regs, | ||
918 | periph_clk_enb_refcnt); | ||
919 | clk_register_clkdev(clk, "csus", "tengra_camera"); | ||
920 | clks[csus] = clk; | ||
921 | |||
922 | /* vcp */ | ||
923 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, | ||
924 | clk_base, 0, 29, &periph_l_regs, | ||
925 | periph_clk_enb_refcnt); | ||
926 | clk_register_clkdev(clk, "vcp", "tegra-avp"); | ||
927 | clks[vcp] = clk; | ||
928 | |||
929 | /* bsea */ | ||
930 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, | ||
931 | clk_base, 0, 62, &periph_h_regs, | ||
932 | periph_clk_enb_refcnt); | ||
933 | clk_register_clkdev(clk, "bsea", "tegra-avp"); | ||
934 | clks[bsea] = clk; | ||
935 | |||
936 | /* bsev */ | ||
937 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, | ||
938 | clk_base, 0, 63, &periph_h_regs, | ||
939 | periph_clk_enb_refcnt); | ||
940 | clk_register_clkdev(clk, "bsev", "tegra-aes"); | ||
941 | clks[bsev] = clk; | ||
942 | 814 | ||
943 | /* emc */ | 815 | /* emc */ |
944 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | 816 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, |
@@ -947,130 +819,52 @@ static void __init tegra20_periph_clk_init(void) | |||
947 | clk_base + CLK_SOURCE_EMC, | 819 | clk_base + CLK_SOURCE_EMC, |
948 | 30, 2, 0, NULL); | 820 | 30, 2, 0, NULL); |
949 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0, | 821 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0, |
950 | 57, &periph_h_regs, periph_clk_enb_refcnt); | 822 | 57, periph_clk_enb_refcnt); |
951 | clk_register_clkdev(clk, "emc", NULL); | 823 | clks[TEGRA20_CLK_EMC] = clk; |
952 | clks[emc] = clk; | ||
953 | |||
954 | /* usbd */ | ||
955 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, 0, | ||
956 | 22, &periph_l_regs, periph_clk_enb_refcnt); | ||
957 | clk_register_clkdev(clk, NULL, "fsl-tegra-udc"); | ||
958 | clks[usbd] = clk; | ||
959 | |||
960 | /* usb2 */ | ||
961 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, 0, | ||
962 | 58, &periph_h_regs, periph_clk_enb_refcnt); | ||
963 | clk_register_clkdev(clk, NULL, "tegra-ehci.1"); | ||
964 | clks[usb2] = clk; | ||
965 | |||
966 | /* usb3 */ | ||
967 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, 0, | ||
968 | 59, &periph_h_regs, periph_clk_enb_refcnt); | ||
969 | clk_register_clkdev(clk, NULL, "tegra-ehci.2"); | ||
970 | clks[usb3] = clk; | ||
971 | 824 | ||
972 | /* dsi */ | 825 | /* dsi */ |
973 | clk = tegra_clk_register_periph_gate("dsi", "pll_d", 0, clk_base, 0, | 826 | clk = tegra_clk_register_periph_gate("dsi", "pll_d", 0, clk_base, 0, |
974 | 48, &periph_h_regs, periph_clk_enb_refcnt); | 827 | 48, periph_clk_enb_refcnt); |
975 | clk_register_clkdev(clk, NULL, "dsi"); | 828 | clk_register_clkdev(clk, NULL, "dsi"); |
976 | clks[dsi] = clk; | 829 | clks[TEGRA20_CLK_DSI] = clk; |
977 | |||
978 | /* csi */ | ||
979 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, | ||
980 | 0, 52, &periph_h_regs, | ||
981 | periph_clk_enb_refcnt); | ||
982 | clk_register_clkdev(clk, "csi", "tegra_camera"); | ||
983 | clks[csi] = clk; | ||
984 | |||
985 | /* isp */ | ||
986 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, 23, | ||
987 | &periph_l_regs, periph_clk_enb_refcnt); | ||
988 | clk_register_clkdev(clk, "isp", "tegra_camera"); | ||
989 | clks[isp] = clk; | ||
990 | 830 | ||
991 | /* pex */ | 831 | /* pex */ |
992 | clk = tegra_clk_register_periph_gate("pex", "clk_m", 0, clk_base, 0, 70, | 832 | clk = tegra_clk_register_periph_gate("pex", "clk_m", 0, clk_base, 0, 70, |
993 | &periph_u_regs, periph_clk_enb_refcnt); | ||
994 | clk_register_clkdev(clk, "pex", NULL); | ||
995 | clks[pex] = clk; | ||
996 | |||
997 | /* afi */ | ||
998 | clk = tegra_clk_register_periph_gate("afi", "clk_m", 0, clk_base, 0, 72, | ||
999 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1000 | clk_register_clkdev(clk, "afi", NULL); | ||
1001 | clks[afi] = clk; | ||
1002 | |||
1003 | /* pcie_xclk */ | ||
1004 | clk = tegra_clk_register_periph_gate("pcie_xclk", "clk_m", 0, clk_base, | ||
1005 | 0, 74, &periph_u_regs, | ||
1006 | periph_clk_enb_refcnt); | 833 | periph_clk_enb_refcnt); |
1007 | clk_register_clkdev(clk, "pcie_xclk", NULL); | 834 | clks[TEGRA20_CLK_PEX] = clk; |
1008 | clks[pcie_xclk] = clk; | ||
1009 | 835 | ||
1010 | /* cdev1 */ | 836 | /* cdev1 */ |
1011 | clk = clk_register_fixed_rate(NULL, "cdev1_fixed", NULL, CLK_IS_ROOT, | 837 | clk = clk_register_fixed_rate(NULL, "cdev1_fixed", NULL, CLK_IS_ROOT, |
1012 | 26000000); | 838 | 26000000); |
1013 | clk = tegra_clk_register_periph_gate("cdev1", "cdev1_fixed", 0, | 839 | clk = tegra_clk_register_periph_gate("cdev1", "cdev1_fixed", 0, |
1014 | clk_base, 0, 94, &periph_u_regs, | 840 | clk_base, 0, 94, periph_clk_enb_refcnt); |
1015 | periph_clk_enb_refcnt); | 841 | clks[TEGRA20_CLK_CDEV1] = clk; |
1016 | clk_register_clkdev(clk, "cdev1", NULL); | ||
1017 | clks[cdev1] = clk; | ||
1018 | 842 | ||
1019 | /* cdev2 */ | 843 | /* cdev2 */ |
1020 | clk = clk_register_fixed_rate(NULL, "cdev2_fixed", NULL, CLK_IS_ROOT, | 844 | clk = clk_register_fixed_rate(NULL, "cdev2_fixed", NULL, CLK_IS_ROOT, |
1021 | 26000000); | 845 | 26000000); |
1022 | clk = tegra_clk_register_periph_gate("cdev2", "cdev2_fixed", 0, | 846 | clk = tegra_clk_register_periph_gate("cdev2", "cdev2_fixed", 0, |
1023 | clk_base, 0, 93, &periph_u_regs, | 847 | clk_base, 0, 93, periph_clk_enb_refcnt); |
1024 | periph_clk_enb_refcnt); | 848 | clks[TEGRA20_CLK_CDEV2] = clk; |
1025 | clk_register_clkdev(clk, "cdev2", NULL); | ||
1026 | clks[cdev2] = clk; | ||
1027 | 849 | ||
1028 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { | 850 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { |
1029 | data = &tegra_periph_clk_list[i]; | 851 | data = &tegra_periph_clk_list[i]; |
1030 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 852 | clk = tegra_clk_register_periph(data->name, data->p.parent_names, |
1031 | data->num_parents, &data->periph, | 853 | data->num_parents, &data->periph, |
1032 | clk_base, data->offset, data->flags); | 854 | clk_base, data->offset, data->flags); |
1033 | clk_register_clkdev(clk, data->con_id, data->dev_id); | ||
1034 | clks[data->clk_id] = clk; | 855 | clks[data->clk_id] = clk; |
1035 | } | 856 | } |
1036 | 857 | ||
1037 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { | 858 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { |
1038 | data = &tegra_periph_nodiv_clk_list[i]; | 859 | data = &tegra_periph_nodiv_clk_list[i]; |
1039 | clk = tegra_clk_register_periph_nodiv(data->name, | 860 | clk = tegra_clk_register_periph_nodiv(data->name, |
1040 | data->parent_names, | 861 | data->p.parent_names, |
1041 | data->num_parents, &data->periph, | 862 | data->num_parents, &data->periph, |
1042 | clk_base, data->offset); | 863 | clk_base, data->offset); |
1043 | clk_register_clkdev(clk, data->con_id, data->dev_id); | ||
1044 | clks[data->clk_id] = clk; | 864 | clks[data->clk_id] = clk; |
1045 | } | 865 | } |
1046 | } | ||
1047 | |||
1048 | |||
1049 | static void __init tegra20_fixed_clk_init(void) | ||
1050 | { | ||
1051 | struct clk *clk; | ||
1052 | |||
1053 | /* clk_32k */ | ||
1054 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, | ||
1055 | 32768); | ||
1056 | clk_register_clkdev(clk, "clk_32k", NULL); | ||
1057 | clks[clk_32k] = clk; | ||
1058 | } | ||
1059 | |||
1060 | static void __init tegra20_pmc_clk_init(void) | ||
1061 | { | ||
1062 | struct clk *clk; | ||
1063 | 866 | ||
1064 | /* blink */ | 867 | tegra_periph_clk_init(clk_base, pmc_base, tegra20_clks, &pll_p_params); |
1065 | writel_relaxed(0, pmc_base + PMC_BLINK_TIMER); | ||
1066 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
1067 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
1068 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
1069 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
1070 | pmc_base + PMC_CTRL, | ||
1071 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
1072 | clk_register_clkdev(clk, "blink", NULL); | ||
1073 | clks[blink] = clk; | ||
1074 | } | 868 | } |
1075 | 869 | ||
1076 | static void __init tegra20_osc_clk_init(void) | 870 | static void __init tegra20_osc_clk_init(void) |
@@ -1084,15 +878,13 @@ static void __init tegra20_osc_clk_init(void) | |||
1084 | /* clk_m */ | 878 | /* clk_m */ |
1085 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT | | 879 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT | |
1086 | CLK_IGNORE_UNUSED, input_freq); | 880 | CLK_IGNORE_UNUSED, input_freq); |
1087 | clk_register_clkdev(clk, "clk_m", NULL); | 881 | clks[TEGRA20_CLK_CLK_M] = clk; |
1088 | clks[clk_m] = clk; | ||
1089 | 882 | ||
1090 | /* pll_ref */ | 883 | /* pll_ref */ |
1091 | pll_ref_div = tegra20_get_pll_ref_div(); | 884 | pll_ref_div = tegra20_get_pll_ref_div(); |
1092 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | 885 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", |
1093 | CLK_SET_RATE_PARENT, 1, pll_ref_div); | 886 | CLK_SET_RATE_PARENT, 1, pll_ref_div); |
1094 | clk_register_clkdev(clk, "pll_ref", NULL); | 887 | clks[TEGRA20_CLK_PLL_REF] = clk; |
1095 | clks[pll_ref] = clk; | ||
1096 | } | 888 | } |
1097 | 889 | ||
1098 | /* Tegra20 CPU clock and reset control functions */ | 890 | /* Tegra20 CPU clock and reset control functions */ |
@@ -1226,49 +1018,49 @@ static struct tegra_cpu_car_ops tegra20_cpu_car_ops = { | |||
1226 | }; | 1018 | }; |
1227 | 1019 | ||
1228 | static struct tegra_clk_init_table init_table[] __initdata = { | 1020 | static struct tegra_clk_init_table init_table[] __initdata = { |
1229 | {pll_p, clk_max, 216000000, 1}, | 1021 | {TEGRA20_CLK_PLL_P, TEGRA20_CLK_CLK_MAX, 216000000, 1}, |
1230 | {pll_p_out1, clk_max, 28800000, 1}, | 1022 | {TEGRA20_CLK_PLL_P_OUT1, TEGRA20_CLK_CLK_MAX, 28800000, 1}, |
1231 | {pll_p_out2, clk_max, 48000000, 1}, | 1023 | {TEGRA20_CLK_PLL_P_OUT2, TEGRA20_CLK_CLK_MAX, 48000000, 1}, |
1232 | {pll_p_out3, clk_max, 72000000, 1}, | 1024 | {TEGRA20_CLK_PLL_P_OUT3, TEGRA20_CLK_CLK_MAX, 72000000, 1}, |
1233 | {pll_p_out4, clk_max, 24000000, 1}, | 1025 | {TEGRA20_CLK_PLL_P_OUT4, TEGRA20_CLK_CLK_MAX, 24000000, 1}, |
1234 | {pll_c, clk_max, 600000000, 1}, | 1026 | {TEGRA20_CLK_PLL_C, TEGRA20_CLK_CLK_MAX, 600000000, 1}, |
1235 | {pll_c_out1, clk_max, 120000000, 1}, | 1027 | {TEGRA20_CLK_PLL_C_OUT1, TEGRA20_CLK_CLK_MAX, 120000000, 1}, |
1236 | {sclk, pll_c_out1, 0, 1}, | 1028 | {TEGRA20_CLK_SCLK, TEGRA20_CLK_PLL_C_OUT1, 0, 1}, |
1237 | {hclk, clk_max, 0, 1}, | 1029 | {TEGRA20_CLK_HCLK, TEGRA20_CLK_CLK_MAX, 0, 1}, |
1238 | {pclk, clk_max, 60000000, 1}, | 1030 | {TEGRA20_CLK_PCLK, TEGRA20_CLK_CLK_MAX, 60000000, 1}, |
1239 | {csite, clk_max, 0, 1}, | 1031 | {TEGRA20_CLK_CSITE, TEGRA20_CLK_CLK_MAX, 0, 1}, |
1240 | {emc, clk_max, 0, 1}, | 1032 | {TEGRA20_CLK_EMC, TEGRA20_CLK_CLK_MAX, 0, 1}, |
1241 | {cclk, clk_max, 0, 1}, | 1033 | {TEGRA20_CLK_CCLK, TEGRA20_CLK_CLK_MAX, 0, 1}, |
1242 | {uarta, pll_p, 0, 0}, | 1034 | {TEGRA20_CLK_UARTA, TEGRA20_CLK_PLL_P, 0, 0}, |
1243 | {uartb, pll_p, 0, 0}, | 1035 | {TEGRA20_CLK_UARTB, TEGRA20_CLK_PLL_P, 0, 0}, |
1244 | {uartc, pll_p, 0, 0}, | 1036 | {TEGRA20_CLK_UARTC, TEGRA20_CLK_PLL_P, 0, 0}, |
1245 | {uartd, pll_p, 0, 0}, | 1037 | {TEGRA20_CLK_UARTD, TEGRA20_CLK_PLL_P, 0, 0}, |
1246 | {uarte, pll_p, 0, 0}, | 1038 | {TEGRA20_CLK_UARTE, TEGRA20_CLK_PLL_P, 0, 0}, |
1247 | {pll_a, clk_max, 56448000, 1}, | 1039 | {TEGRA20_CLK_PLL_A, TEGRA20_CLK_CLK_MAX, 56448000, 1}, |
1248 | {pll_a_out0, clk_max, 11289600, 1}, | 1040 | {TEGRA20_CLK_PLL_A_OUT0, TEGRA20_CLK_CLK_MAX, 11289600, 1}, |
1249 | {cdev1, clk_max, 0, 1}, | 1041 | {TEGRA20_CLK_CDEV1, TEGRA20_CLK_CLK_MAX, 0, 1}, |
1250 | {blink, clk_max, 32768, 1}, | 1042 | {TEGRA20_CLK_BLINK, TEGRA20_CLK_CLK_MAX, 32768, 1}, |
1251 | {i2s1, pll_a_out0, 11289600, 0}, | 1043 | {TEGRA20_CLK_I2S1, TEGRA20_CLK_PLL_A_OUT0, 11289600, 0}, |
1252 | {i2s2, pll_a_out0, 11289600, 0}, | 1044 | {TEGRA20_CLK_I2S2, TEGRA20_CLK_PLL_A_OUT0, 11289600, 0}, |
1253 | {sdmmc1, pll_p, 48000000, 0}, | 1045 | {TEGRA20_CLK_SDMMC1, TEGRA20_CLK_PLL_P, 48000000, 0}, |
1254 | {sdmmc3, pll_p, 48000000, 0}, | 1046 | {TEGRA20_CLK_SDMMC3, TEGRA20_CLK_PLL_P, 48000000, 0}, |
1255 | {sdmmc4, pll_p, 48000000, 0}, | 1047 | {TEGRA20_CLK_SDMMC4, TEGRA20_CLK_PLL_P, 48000000, 0}, |
1256 | {spi, pll_p, 20000000, 0}, | 1048 | {TEGRA20_CLK_SPI, TEGRA20_CLK_PLL_P, 20000000, 0}, |
1257 | {sbc1, pll_p, 100000000, 0}, | 1049 | {TEGRA20_CLK_SBC1, TEGRA20_CLK_PLL_P, 100000000, 0}, |
1258 | {sbc2, pll_p, 100000000, 0}, | 1050 | {TEGRA20_CLK_SBC2, TEGRA20_CLK_PLL_P, 100000000, 0}, |
1259 | {sbc3, pll_p, 100000000, 0}, | 1051 | {TEGRA20_CLK_SBC3, TEGRA20_CLK_PLL_P, 100000000, 0}, |
1260 | {sbc4, pll_p, 100000000, 0}, | 1052 | {TEGRA20_CLK_SBC4, TEGRA20_CLK_PLL_P, 100000000, 0}, |
1261 | {host1x, pll_c, 150000000, 0}, | 1053 | {TEGRA20_CLK_HOST1X, TEGRA20_CLK_PLL_C, 150000000, 0}, |
1262 | {disp1, pll_p, 600000000, 0}, | 1054 | {TEGRA20_CLK_DISP1, TEGRA20_CLK_PLL_P, 600000000, 0}, |
1263 | {disp2, pll_p, 600000000, 0}, | 1055 | {TEGRA20_CLK_DISP2, TEGRA20_CLK_PLL_P, 600000000, 0}, |
1264 | {gr2d, pll_c, 300000000, 0}, | 1056 | {TEGRA20_CLK_GR2D, TEGRA20_CLK_PLL_C, 300000000, 0}, |
1265 | {gr3d, pll_c, 300000000, 0}, | 1057 | {TEGRA20_CLK_GR3D, TEGRA20_CLK_PLL_C, 300000000, 0}, |
1266 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ | 1058 | {TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0}, /* This MUST be the last entry */ |
1267 | }; | 1059 | }; |
1268 | 1060 | ||
1269 | static void __init tegra20_clock_apply_init_table(void) | 1061 | static void __init tegra20_clock_apply_init_table(void) |
1270 | { | 1062 | { |
1271 | tegra_init_from_table(init_table, clks, clk_max); | 1063 | tegra_init_from_table(init_table, clks, TEGRA20_CLK_CLK_MAX); |
1272 | } | 1064 | } |
1273 | 1065 | ||
1274 | /* | 1066 | /* |
@@ -1277,11 +1069,11 @@ static void __init tegra20_clock_apply_init_table(void) | |||
1277 | * table under two names. | 1069 | * table under two names. |
1278 | */ | 1070 | */ |
1279 | static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | 1071 | static struct tegra_clk_duplicate tegra_clk_duplicates[] = { |
1280 | TEGRA_CLK_DUPLICATE(usbd, "utmip-pad", NULL), | 1072 | TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD, "utmip-pad", NULL), |
1281 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), | 1073 | TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD, "tegra-ehci.0", NULL), |
1282 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), | 1074 | TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD, "tegra-otg", NULL), |
1283 | TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), | 1075 | TEGRA_CLK_DUPLICATE(TEGRA20_CLK_CCLK, NULL, "cpu"), |
1284 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ | 1076 | TEGRA_CLK_DUPLICATE(TEGRA20_CLK_CLK_MAX, NULL, NULL), /* Must be the last entry */ |
1285 | }; | 1077 | }; |
1286 | 1078 | ||
1287 | static const struct of_device_id pmc_match[] __initconst = { | 1079 | static const struct of_device_id pmc_match[] __initconst = { |
@@ -1291,7 +1083,6 @@ static const struct of_device_id pmc_match[] __initconst = { | |||
1291 | 1083 | ||
1292 | static void __init tegra20_clock_init(struct device_node *np) | 1084 | static void __init tegra20_clock_init(struct device_node *np) |
1293 | { | 1085 | { |
1294 | int i; | ||
1295 | struct device_node *node; | 1086 | struct device_node *node; |
1296 | 1087 | ||
1297 | clk_base = of_iomap(np, 0); | 1088 | clk_base = of_iomap(np, 0); |
@@ -1312,30 +1103,24 @@ static void __init tegra20_clock_init(struct device_node *np) | |||
1312 | BUG(); | 1103 | BUG(); |
1313 | } | 1104 | } |
1314 | 1105 | ||
1106 | clks = tegra_clk_init(clk_base, TEGRA20_CLK_CLK_MAX, | ||
1107 | TEGRA20_CLK_PERIPH_BANKS); | ||
1108 | if (!clks) | ||
1109 | return; | ||
1110 | |||
1315 | tegra20_osc_clk_init(); | 1111 | tegra20_osc_clk_init(); |
1316 | tegra20_pmc_clk_init(); | 1112 | tegra_fixed_clk_init(tegra20_clks); |
1317 | tegra20_fixed_clk_init(); | ||
1318 | tegra20_pll_init(); | 1113 | tegra20_pll_init(); |
1319 | tegra20_super_clk_init(); | 1114 | tegra20_super_clk_init(); |
1115 | tegra_super_clk_gen4_init(clk_base, pmc_base, tegra20_clks, NULL); | ||
1320 | tegra20_periph_clk_init(); | 1116 | tegra20_periph_clk_init(); |
1321 | tegra20_audio_clk_init(); | 1117 | tegra20_audio_clk_init(); |
1118 | tegra_pmc_clk_init(pmc_base, tegra20_clks); | ||
1322 | 1119 | ||
1120 | tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA20_CLK_CLK_MAX); | ||
1323 | 1121 | ||
1324 | for (i = 0; i < ARRAY_SIZE(clks); i++) { | 1122 | tegra_add_of_provider(np); |
1325 | if (IS_ERR(clks[i])) { | 1123 | tegra_register_devclks(devclks, ARRAY_SIZE(devclks)); |
1326 | pr_err("Tegra20 clk %d: register failed with %ld\n", | ||
1327 | i, PTR_ERR(clks[i])); | ||
1328 | BUG(); | ||
1329 | } | ||
1330 | if (!clks[i]) | ||
1331 | clks[i] = ERR_PTR(-EINVAL); | ||
1332 | } | ||
1333 | |||
1334 | tegra_init_dup_clks(tegra_clk_duplicates, clks, clk_max); | ||
1335 | |||
1336 | clk_data.clks = clks; | ||
1337 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
1338 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
1339 | 1124 | ||
1340 | tegra_clk_apply_init_table = tegra20_clock_apply_init_table; | 1125 | tegra_clk_apply_init_table = tegra20_clock_apply_init_table; |
1341 | 1126 | ||
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index dbe7c8003c5c..8b10c38b6e3c 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -23,42 +23,9 @@ | |||
23 | #include <linux/of_address.h> | 23 | #include <linux/of_address.h> |
24 | #include <linux/clk/tegra.h> | 24 | #include <linux/clk/tegra.h> |
25 | #include <linux/tegra-powergate.h> | 25 | #include <linux/tegra-powergate.h> |
26 | 26 | #include <dt-bindings/clock/tegra30-car.h> | |
27 | #include "clk.h" | 27 | #include "clk.h" |
28 | 28 | #include "clk-id.h" | |
29 | #define RST_DEVICES_L 0x004 | ||
30 | #define RST_DEVICES_H 0x008 | ||
31 | #define RST_DEVICES_U 0x00c | ||
32 | #define RST_DEVICES_V 0x358 | ||
33 | #define RST_DEVICES_W 0x35c | ||
34 | #define RST_DEVICES_SET_L 0x300 | ||
35 | #define RST_DEVICES_CLR_L 0x304 | ||
36 | #define RST_DEVICES_SET_H 0x308 | ||
37 | #define RST_DEVICES_CLR_H 0x30c | ||
38 | #define RST_DEVICES_SET_U 0x310 | ||
39 | #define RST_DEVICES_CLR_U 0x314 | ||
40 | #define RST_DEVICES_SET_V 0x430 | ||
41 | #define RST_DEVICES_CLR_V 0x434 | ||
42 | #define RST_DEVICES_SET_W 0x438 | ||
43 | #define RST_DEVICES_CLR_W 0x43c | ||
44 | #define RST_DEVICES_NUM 5 | ||
45 | |||
46 | #define CLK_OUT_ENB_L 0x010 | ||
47 | #define CLK_OUT_ENB_H 0x014 | ||
48 | #define CLK_OUT_ENB_U 0x018 | ||
49 | #define CLK_OUT_ENB_V 0x360 | ||
50 | #define CLK_OUT_ENB_W 0x364 | ||
51 | #define CLK_OUT_ENB_SET_L 0x320 | ||
52 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
53 | #define CLK_OUT_ENB_SET_H 0x328 | ||
54 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
55 | #define CLK_OUT_ENB_SET_U 0x330 | ||
56 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
57 | #define CLK_OUT_ENB_SET_V 0x440 | ||
58 | #define CLK_OUT_ENB_CLR_V 0x444 | ||
59 | #define CLK_OUT_ENB_SET_W 0x448 | ||
60 | #define CLK_OUT_ENB_CLR_W 0x44c | ||
61 | #define CLK_OUT_ENB_NUM 5 | ||
62 | 29 | ||
63 | #define OSC_CTRL 0x50 | 30 | #define OSC_CTRL 0x50 |
64 | #define OSC_CTRL_OSC_FREQ_MASK (0xF<<28) | 31 | #define OSC_CTRL_OSC_FREQ_MASK (0xF<<28) |
@@ -92,6 +59,8 @@ | |||
92 | 59 | ||
93 | #define SYSTEM_CLK_RATE 0x030 | 60 | #define SYSTEM_CLK_RATE 0x030 |
94 | 61 | ||
62 | #define TEGRA30_CLK_PERIPH_BANKS 5 | ||
63 | |||
95 | #define PLLC_BASE 0x80 | 64 | #define PLLC_BASE 0x80 |
96 | #define PLLC_MISC 0x8c | 65 | #define PLLC_MISC 0x8c |
97 | #define PLLM_BASE 0x90 | 66 | #define PLLM_BASE 0x90 |
@@ -132,88 +101,21 @@ | |||
132 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 | 101 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 |
133 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 | 102 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 |
134 | 103 | ||
135 | #define PMC_CLK_OUT_CNTRL 0x1a8 | ||
136 | |||
137 | #define CLK_SOURCE_I2S0 0x1d8 | ||
138 | #define CLK_SOURCE_I2S1 0x100 | ||
139 | #define CLK_SOURCE_I2S2 0x104 | ||
140 | #define CLK_SOURCE_I2S3 0x3bc | ||
141 | #define CLK_SOURCE_I2S4 0x3c0 | ||
142 | #define CLK_SOURCE_SPDIF_OUT 0x108 | 104 | #define CLK_SOURCE_SPDIF_OUT 0x108 |
143 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
144 | #define CLK_SOURCE_PWM 0x110 | 105 | #define CLK_SOURCE_PWM 0x110 |
145 | #define CLK_SOURCE_D_AUDIO 0x3d0 | 106 | #define CLK_SOURCE_D_AUDIO 0x3d0 |
146 | #define CLK_SOURCE_DAM0 0x3d8 | 107 | #define CLK_SOURCE_DAM0 0x3d8 |
147 | #define CLK_SOURCE_DAM1 0x3dc | 108 | #define CLK_SOURCE_DAM1 0x3dc |
148 | #define CLK_SOURCE_DAM2 0x3e0 | 109 | #define CLK_SOURCE_DAM2 0x3e0 |
149 | #define CLK_SOURCE_HDA 0x428 | ||
150 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 | ||
151 | #define CLK_SOURCE_SBC1 0x134 | ||
152 | #define CLK_SOURCE_SBC2 0x118 | ||
153 | #define CLK_SOURCE_SBC3 0x11c | ||
154 | #define CLK_SOURCE_SBC4 0x1b4 | ||
155 | #define CLK_SOURCE_SBC5 0x3c8 | ||
156 | #define CLK_SOURCE_SBC6 0x3cc | ||
157 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
158 | #define CLK_SOURCE_SATA 0x424 | ||
159 | #define CLK_SOURCE_NDFLASH 0x160 | ||
160 | #define CLK_SOURCE_NDSPEED 0x3f8 | ||
161 | #define CLK_SOURCE_VFIR 0x168 | ||
162 | #define CLK_SOURCE_SDMMC1 0x150 | ||
163 | #define CLK_SOURCE_SDMMC2 0x154 | ||
164 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
165 | #define CLK_SOURCE_SDMMC4 0x164 | ||
166 | #define CLK_SOURCE_VDE 0x1c8 | ||
167 | #define CLK_SOURCE_CSITE 0x1d4 | ||
168 | #define CLK_SOURCE_LA 0x1f8 | ||
169 | #define CLK_SOURCE_OWR 0x1cc | ||
170 | #define CLK_SOURCE_NOR 0x1d0 | ||
171 | #define CLK_SOURCE_MIPI 0x174 | ||
172 | #define CLK_SOURCE_I2C1 0x124 | ||
173 | #define CLK_SOURCE_I2C2 0x198 | ||
174 | #define CLK_SOURCE_I2C3 0x1b8 | ||
175 | #define CLK_SOURCE_I2C4 0x3c4 | ||
176 | #define CLK_SOURCE_I2C5 0x128 | ||
177 | #define CLK_SOURCE_UARTA 0x178 | ||
178 | #define CLK_SOURCE_UARTB 0x17c | ||
179 | #define CLK_SOURCE_UARTC 0x1a0 | ||
180 | #define CLK_SOURCE_UARTD 0x1c0 | ||
181 | #define CLK_SOURCE_UARTE 0x1c4 | ||
182 | #define CLK_SOURCE_VI 0x148 | ||
183 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
184 | #define CLK_SOURCE_3D 0x158 | ||
185 | #define CLK_SOURCE_3D2 0x3b0 | 110 | #define CLK_SOURCE_3D2 0x3b0 |
186 | #define CLK_SOURCE_2D 0x15c | 111 | #define CLK_SOURCE_2D 0x15c |
187 | #define CLK_SOURCE_EPP 0x16c | ||
188 | #define CLK_SOURCE_MPE 0x170 | ||
189 | #define CLK_SOURCE_HOST1X 0x180 | ||
190 | #define CLK_SOURCE_CVE 0x140 | ||
191 | #define CLK_SOURCE_TVO 0x188 | ||
192 | #define CLK_SOURCE_DTV 0x1dc | ||
193 | #define CLK_SOURCE_HDMI 0x18c | 112 | #define CLK_SOURCE_HDMI 0x18c |
194 | #define CLK_SOURCE_TVDAC 0x194 | ||
195 | #define CLK_SOURCE_DISP1 0x138 | ||
196 | #define CLK_SOURCE_DISP2 0x13c | ||
197 | #define CLK_SOURCE_DSIB 0xd0 | 113 | #define CLK_SOURCE_DSIB 0xd0 |
198 | #define CLK_SOURCE_TSENSOR 0x3b8 | ||
199 | #define CLK_SOURCE_ACTMON 0x3e8 | ||
200 | #define CLK_SOURCE_EXTERN1 0x3ec | ||
201 | #define CLK_SOURCE_EXTERN2 0x3f0 | ||
202 | #define CLK_SOURCE_EXTERN3 0x3f4 | ||
203 | #define CLK_SOURCE_I2CSLOW 0x3fc | ||
204 | #define CLK_SOURCE_SE 0x42c | 114 | #define CLK_SOURCE_SE 0x42c |
205 | #define CLK_SOURCE_MSELECT 0x3b4 | ||
206 | #define CLK_SOURCE_EMC 0x19c | 115 | #define CLK_SOURCE_EMC 0x19c |
207 | 116 | ||
208 | #define AUDIO_SYNC_DOUBLER 0x49c | 117 | #define AUDIO_SYNC_DOUBLER 0x49c |
209 | 118 | ||
210 | #define PMC_CTRL 0 | ||
211 | #define PMC_CTRL_BLINK_ENB 7 | ||
212 | |||
213 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
214 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
215 | #define PMC_BLINK_TIMER 0x40 | ||
216 | |||
217 | #define UTMIP_PLL_CFG2 0x488 | 119 | #define UTMIP_PLL_CFG2 0x488 |
218 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) | 120 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) |
219 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) | 121 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) |
@@ -266,89 +168,41 @@ static struct cpu_clk_suspend_context { | |||
266 | } tegra30_cpu_clk_sctx; | 168 | } tegra30_cpu_clk_sctx; |
267 | #endif | 169 | #endif |
268 | 170 | ||
269 | static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; | ||
270 | |||
271 | static void __iomem *clk_base; | 171 | static void __iomem *clk_base; |
272 | static void __iomem *pmc_base; | 172 | static void __iomem *pmc_base; |
273 | static unsigned long input_freq; | 173 | static unsigned long input_freq; |
274 | 174 | ||
275 | static DEFINE_SPINLOCK(clk_doubler_lock); | ||
276 | static DEFINE_SPINLOCK(clk_out_lock); | ||
277 | static DEFINE_SPINLOCK(pll_div_lock); | ||
278 | static DEFINE_SPINLOCK(cml_lock); | 175 | static DEFINE_SPINLOCK(cml_lock); |
279 | static DEFINE_SPINLOCK(pll_d_lock); | 176 | static DEFINE_SPINLOCK(pll_d_lock); |
280 | static DEFINE_SPINLOCK(sysrate_lock); | ||
281 | |||
282 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ | ||
283 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
284 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
285 | 30, 2, 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
286 | periph_clk_enb_refcnt, _gate_flags, _clk_id) | ||
287 | |||
288 | #define TEGRA_INIT_DATA_DIV16(_name, _con_id, _dev_id, _parents, _offset, \ | ||
289 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
290 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
291 | 30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP, \ | ||
292 | _regs, _clk_num, periph_clk_enb_refcnt, \ | ||
293 | _gate_flags, _clk_id) | ||
294 | |||
295 | #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ | ||
296 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
297 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
298 | 29, 3, 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
299 | periph_clk_enb_refcnt, _gate_flags, _clk_id) | ||
300 | |||
301 | #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ | ||
302 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
303 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | ||
304 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ | ||
305 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
306 | _clk_id) | ||
307 | 177 | ||
308 | #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ | 178 | #define TEGRA_INIT_DATA_MUX(_name, _parents, _offset, \ |
309 | _clk_num, _regs, _clk_id) \ | 179 | _clk_num, _gate_flags, _clk_id) \ |
310 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | 180 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ |
311 | 30, 2, 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs, \ | 181 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ |
312 | _clk_num, periph_clk_enb_refcnt, 0, _clk_id) | 182 | _clk_num, _gate_flags, _clk_id) |
183 | |||
184 | #define TEGRA_INIT_DATA_MUX8(_name, _parents, _offset, \ | ||
185 | _clk_num, _gate_flags, _clk_id) \ | ||
186 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ | ||
187 | 29, 3, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \ | ||
188 | _clk_num, _gate_flags, _clk_id) | ||
189 | |||
190 | #define TEGRA_INIT_DATA_INT(_name, _parents, _offset, \ | ||
191 | _clk_num, _gate_flags, _clk_id) \ | ||
192 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ | ||
193 | 30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT | \ | ||
194 | TEGRA_DIVIDER_ROUND_UP, _clk_num, \ | ||
195 | _gate_flags, _clk_id) | ||
313 | 196 | ||
314 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ | 197 | #define TEGRA_INIT_DATA_NODIV(_name, _parents, _offset, \ |
315 | _mux_shift, _mux_width, _clk_num, _regs, \ | 198 | _mux_shift, _mux_width, _clk_num, \ |
316 | _gate_flags, _clk_id) \ | 199 | _gate_flags, _clk_id) \ |
317 | TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset, \ | 200 | TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset, \ |
318 | _mux_shift, _mux_width, 0, 0, 0, 0, 0, _regs, \ | 201 | _mux_shift, _mux_width, 0, 0, 0, 0, 0,\ |
319 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | 202 | _clk_num, _gate_flags, \ |
320 | _clk_id) | 203 | _clk_id) |
321 | 204 | ||
322 | /* | 205 | static struct clk **clks; |
323 | * IDs assigned here must be in sync with DT bindings definition | ||
324 | * for Tegra30 clocks. | ||
325 | */ | ||
326 | enum tegra30_clk { | ||
327 | cpu, rtc = 4, timer, uarta, gpio = 8, sdmmc2, i2s1 = 11, i2c1, ndflash, | ||
328 | sdmmc1, sdmmc4, pwm = 17, i2s2, epp, gr2d = 21, usbd, isp, gr3d, | ||
329 | disp2 = 26, disp1, host1x, vcp, i2s0, cop_cache, mc, ahbdma, apbdma, | ||
330 | kbc = 36, statmon, pmc, kfuse = 40, sbc1, nor, sbc2 = 44, sbc3 = 46, | ||
331 | i2c5, dsia, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, | ||
332 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, | ||
333 | pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, | ||
334 | dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, | ||
335 | cdev2, cdev1, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, | ||
336 | i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, | ||
337 | atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, | ||
338 | spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, | ||
339 | se = 127, hda2hdmi, sata_cold, uartb = 160, vfir, spdif_in, spdif_out, | ||
340 | vi, vi_sensor, fuse, fuse_burn, cve, tvo, clk_32k, clk_m, clk_m_div2, | ||
341 | clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_m, pll_m_out1, pll_p, | ||
342 | pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_a, pll_a_out0, | ||
343 | pll_d, pll_d_out0, pll_d2, pll_d2_out0, pll_u, pll_x, pll_x_out0, pll_e, | ||
344 | spdif_in_sync, i2s0_sync, i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, | ||
345 | vimclk_sync, audio0, audio1, audio2, audio3, audio4, spdif, clk_out_1, | ||
346 | clk_out_2, clk_out_3, sclk, blink, cclk_g, cclk_lp, twd, cml0, cml1, | ||
347 | hclk, pclk, clk_out_1_mux = 300, clk_max | ||
348 | }; | ||
349 | |||
350 | static struct clk *clks[clk_max]; | ||
351 | static struct clk_onecell_data clk_data; | ||
352 | 206 | ||
353 | /* | 207 | /* |
354 | * Structure defining the fields for USB UTMI clocks Parameters. | 208 | * Structure defining the fields for USB UTMI clocks Parameters. |
@@ -564,6 +418,8 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
564 | .lock_mask = PLL_BASE_LOCK, | 418 | .lock_mask = PLL_BASE_LOCK, |
565 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 419 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
566 | .lock_delay = 300, | 420 | .lock_delay = 300, |
421 | .freq_table = pll_c_freq_table, | ||
422 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | ||
567 | }; | 423 | }; |
568 | 424 | ||
569 | static struct div_nmp pllm_nmp = { | 425 | static struct div_nmp pllm_nmp = { |
@@ -593,6 +449,9 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
593 | .div_nmp = &pllm_nmp, | 449 | .div_nmp = &pllm_nmp, |
594 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, | 450 | .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE, |
595 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE, | 451 | .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE, |
452 | .freq_table = pll_m_freq_table, | ||
453 | .flags = TEGRA_PLLM | TEGRA_PLL_HAS_CPCON | | ||
454 | TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK, | ||
596 | }; | 455 | }; |
597 | 456 | ||
598 | static struct tegra_clk_pll_params pll_p_params = { | 457 | static struct tegra_clk_pll_params pll_p_params = { |
@@ -607,6 +466,9 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
607 | .lock_mask = PLL_BASE_LOCK, | 466 | .lock_mask = PLL_BASE_LOCK, |
608 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 467 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
609 | .lock_delay = 300, | 468 | .lock_delay = 300, |
469 | .freq_table = pll_p_freq_table, | ||
470 | .flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | ||
471 | .fixed_rate = 408000000, | ||
610 | }; | 472 | }; |
611 | 473 | ||
612 | static struct tegra_clk_pll_params pll_a_params = { | 474 | static struct tegra_clk_pll_params pll_a_params = { |
@@ -621,6 +483,8 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
621 | .lock_mask = PLL_BASE_LOCK, | 483 | .lock_mask = PLL_BASE_LOCK, |
622 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 484 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
623 | .lock_delay = 300, | 485 | .lock_delay = 300, |
486 | .freq_table = pll_a_freq_table, | ||
487 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | ||
624 | }; | 488 | }; |
625 | 489 | ||
626 | static struct tegra_clk_pll_params pll_d_params = { | 490 | static struct tegra_clk_pll_params pll_d_params = { |
@@ -635,6 +499,10 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
635 | .lock_mask = PLL_BASE_LOCK, | 499 | .lock_mask = PLL_BASE_LOCK, |
636 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 500 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
637 | .lock_delay = 1000, | 501 | .lock_delay = 1000, |
502 | .freq_table = pll_d_freq_table, | ||
503 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
504 | TEGRA_PLL_USE_LOCK, | ||
505 | |||
638 | }; | 506 | }; |
639 | 507 | ||
640 | static struct tegra_clk_pll_params pll_d2_params = { | 508 | static struct tegra_clk_pll_params pll_d2_params = { |
@@ -649,6 +517,9 @@ static struct tegra_clk_pll_params pll_d2_params = { | |||
649 | .lock_mask = PLL_BASE_LOCK, | 517 | .lock_mask = PLL_BASE_LOCK, |
650 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 518 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
651 | .lock_delay = 1000, | 519 | .lock_delay = 1000, |
520 | .freq_table = pll_d_freq_table, | ||
521 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
522 | TEGRA_PLL_USE_LOCK, | ||
652 | }; | 523 | }; |
653 | 524 | ||
654 | static struct tegra_clk_pll_params pll_u_params = { | 525 | static struct tegra_clk_pll_params pll_u_params = { |
@@ -664,6 +535,8 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
664 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 535 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
665 | .lock_delay = 1000, | 536 | .lock_delay = 1000, |
666 | .pdiv_tohw = pllu_p, | 537 | .pdiv_tohw = pllu_p, |
538 | .freq_table = pll_u_freq_table, | ||
539 | .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON, | ||
667 | }; | 540 | }; |
668 | 541 | ||
669 | static struct tegra_clk_pll_params pll_x_params = { | 542 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -678,6 +551,9 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
678 | .lock_mask = PLL_BASE_LOCK, | 551 | .lock_mask = PLL_BASE_LOCK, |
679 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 552 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
680 | .lock_delay = 300, | 553 | .lock_delay = 300, |
554 | .freq_table = pll_x_freq_table, | ||
555 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_DCCON | | ||
556 | TEGRA_PLL_USE_LOCK, | ||
681 | }; | 557 | }; |
682 | 558 | ||
683 | static struct tegra_clk_pll_params pll_e_params = { | 559 | static struct tegra_clk_pll_params pll_e_params = { |
@@ -692,116 +568,299 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
692 | .lock_mask = PLLE_MISC_LOCK, | 568 | .lock_mask = PLLE_MISC_LOCK, |
693 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 569 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
694 | .lock_delay = 300, | 570 | .lock_delay = 300, |
571 | .freq_table = pll_e_freq_table, | ||
572 | .flags = TEGRA_PLLE_CONFIGURE | TEGRA_PLL_FIXED, | ||
573 | .fixed_rate = 100000000, | ||
695 | }; | 574 | }; |
696 | 575 | ||
697 | /* Peripheral clock registers */ | 576 | static unsigned long tegra30_input_freq[] = { |
698 | static struct tegra_clk_periph_regs periph_l_regs = { | 577 | [0] = 13000000, |
699 | .enb_reg = CLK_OUT_ENB_L, | 578 | [1] = 16800000, |
700 | .enb_set_reg = CLK_OUT_ENB_SET_L, | 579 | [4] = 19200000, |
701 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | 580 | [5] = 38400000, |
702 | .rst_reg = RST_DEVICES_L, | 581 | [8] = 12000000, |
703 | .rst_set_reg = RST_DEVICES_SET_L, | 582 | [9] = 48000000, |
704 | .rst_clr_reg = RST_DEVICES_CLR_L, | 583 | [12] = 260000000, |
705 | }; | 584 | }; |
706 | 585 | ||
707 | static struct tegra_clk_periph_regs periph_h_regs = { | 586 | static struct tegra_devclk devclks[] __initdata = { |
708 | .enb_reg = CLK_OUT_ENB_H, | 587 | { .con_id = "pll_c", .dt_id = TEGRA30_CLK_PLL_C }, |
709 | .enb_set_reg = CLK_OUT_ENB_SET_H, | 588 | { .con_id = "pll_c_out1", .dt_id = TEGRA30_CLK_PLL_C_OUT1 }, |
710 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | 589 | { .con_id = "pll_p", .dt_id = TEGRA30_CLK_PLL_P }, |
711 | .rst_reg = RST_DEVICES_H, | 590 | { .con_id = "pll_p_out1", .dt_id = TEGRA30_CLK_PLL_P_OUT1 }, |
712 | .rst_set_reg = RST_DEVICES_SET_H, | 591 | { .con_id = "pll_p_out2", .dt_id = TEGRA30_CLK_PLL_P_OUT2 }, |
713 | .rst_clr_reg = RST_DEVICES_CLR_H, | 592 | { .con_id = "pll_p_out3", .dt_id = TEGRA30_CLK_PLL_P_OUT3 }, |
593 | { .con_id = "pll_p_out4", .dt_id = TEGRA30_CLK_PLL_P_OUT4 }, | ||
594 | { .con_id = "pll_m", .dt_id = TEGRA30_CLK_PLL_M }, | ||
595 | { .con_id = "pll_m_out1", .dt_id = TEGRA30_CLK_PLL_M_OUT1 }, | ||
596 | { .con_id = "pll_x", .dt_id = TEGRA30_CLK_PLL_X }, | ||
597 | { .con_id = "pll_x_out0", .dt_id = TEGRA30_CLK_PLL_X_OUT0 }, | ||
598 | { .con_id = "pll_u", .dt_id = TEGRA30_CLK_PLL_U }, | ||
599 | { .con_id = "pll_d", .dt_id = TEGRA30_CLK_PLL_D }, | ||
600 | { .con_id = "pll_d_out0", .dt_id = TEGRA30_CLK_PLL_D_OUT0 }, | ||
601 | { .con_id = "pll_d2", .dt_id = TEGRA30_CLK_PLL_D2 }, | ||
602 | { .con_id = "pll_d2_out0", .dt_id = TEGRA30_CLK_PLL_D2_OUT0 }, | ||
603 | { .con_id = "pll_a", .dt_id = TEGRA30_CLK_PLL_A }, | ||
604 | { .con_id = "pll_a_out0", .dt_id = TEGRA30_CLK_PLL_A_OUT0 }, | ||
605 | { .con_id = "pll_e", .dt_id = TEGRA30_CLK_PLL_E }, | ||
606 | { .con_id = "spdif_in_sync", .dt_id = TEGRA30_CLK_SPDIF_IN_SYNC }, | ||
607 | { .con_id = "i2s0_sync", .dt_id = TEGRA30_CLK_I2S0_SYNC }, | ||
608 | { .con_id = "i2s1_sync", .dt_id = TEGRA30_CLK_I2S1_SYNC }, | ||
609 | { .con_id = "i2s2_sync", .dt_id = TEGRA30_CLK_I2S2_SYNC }, | ||
610 | { .con_id = "i2s3_sync", .dt_id = TEGRA30_CLK_I2S3_SYNC }, | ||
611 | { .con_id = "i2s4_sync", .dt_id = TEGRA30_CLK_I2S4_SYNC }, | ||
612 | { .con_id = "vimclk_sync", .dt_id = TEGRA30_CLK_VIMCLK_SYNC }, | ||
613 | { .con_id = "audio0", .dt_id = TEGRA30_CLK_AUDIO0 }, | ||
614 | { .con_id = "audio1", .dt_id = TEGRA30_CLK_AUDIO1 }, | ||
615 | { .con_id = "audio2", .dt_id = TEGRA30_CLK_AUDIO2 }, | ||
616 | { .con_id = "audio3", .dt_id = TEGRA30_CLK_AUDIO3 }, | ||
617 | { .con_id = "audio4", .dt_id = TEGRA30_CLK_AUDIO4 }, | ||
618 | { .con_id = "spdif", .dt_id = TEGRA30_CLK_SPDIF }, | ||
619 | { .con_id = "audio0_2x", .dt_id = TEGRA30_CLK_AUDIO0_2X }, | ||
620 | { .con_id = "audio1_2x", .dt_id = TEGRA30_CLK_AUDIO1_2X }, | ||
621 | { .con_id = "audio2_2x", .dt_id = TEGRA30_CLK_AUDIO2_2X }, | ||
622 | { .con_id = "audio3_2x", .dt_id = TEGRA30_CLK_AUDIO3_2X }, | ||
623 | { .con_id = "audio4_2x", .dt_id = TEGRA30_CLK_AUDIO4_2X }, | ||
624 | { .con_id = "spdif_2x", .dt_id = TEGRA30_CLK_SPDIF_2X }, | ||
625 | { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA30_CLK_EXTERN1 }, | ||
626 | { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA30_CLK_EXTERN2 }, | ||
627 | { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA30_CLK_EXTERN3 }, | ||
628 | { .con_id = "blink", .dt_id = TEGRA30_CLK_BLINK }, | ||
629 | { .con_id = "cclk_g", .dt_id = TEGRA30_CLK_CCLK_G }, | ||
630 | { .con_id = "cclk_lp", .dt_id = TEGRA30_CLK_CCLK_LP }, | ||
631 | { .con_id = "sclk", .dt_id = TEGRA30_CLK_SCLK }, | ||
632 | { .con_id = "hclk", .dt_id = TEGRA30_CLK_HCLK }, | ||
633 | { .con_id = "pclk", .dt_id = TEGRA30_CLK_PCLK }, | ||
634 | { .con_id = "twd", .dt_id = TEGRA30_CLK_TWD }, | ||
635 | { .con_id = "emc", .dt_id = TEGRA30_CLK_EMC }, | ||
636 | { .con_id = "clk_32k", .dt_id = TEGRA30_CLK_CLK_32K }, | ||
637 | { .con_id = "clk_m_div2", .dt_id = TEGRA30_CLK_CLK_M_DIV2 }, | ||
638 | { .con_id = "clk_m_div4", .dt_id = TEGRA30_CLK_CLK_M_DIV4 }, | ||
639 | { .con_id = "cml0", .dt_id = TEGRA30_CLK_CML0 }, | ||
640 | { .con_id = "cml1", .dt_id = TEGRA30_CLK_CML1 }, | ||
641 | { .con_id = "clk_m", .dt_id = TEGRA30_CLK_CLK_M }, | ||
642 | { .con_id = "pll_ref", .dt_id = TEGRA30_CLK_PLL_REF }, | ||
643 | { .con_id = "csus", .dev_id = "tengra_camera", .dt_id = TEGRA30_CLK_CSUS }, | ||
644 | { .con_id = "vcp", .dev_id = "tegra-avp", .dt_id = TEGRA30_CLK_VCP }, | ||
645 | { .con_id = "bsea", .dev_id = "tegra-avp", .dt_id = TEGRA30_CLK_BSEA }, | ||
646 | { .con_id = "bsev", .dev_id = "tegra-aes", .dt_id = TEGRA30_CLK_BSEV }, | ||
647 | { .con_id = "dsia", .dev_id = "tegradc.0", .dt_id = TEGRA30_CLK_DSIA }, | ||
648 | { .con_id = "csi", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_CSI }, | ||
649 | { .con_id = "isp", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_ISP }, | ||
650 | { .con_id = "pcie", .dev_id = "tegra-pcie", .dt_id = TEGRA30_CLK_PCIE }, | ||
651 | { .con_id = "afi", .dev_id = "tegra-pcie", .dt_id = TEGRA30_CLK_AFI }, | ||
652 | { .con_id = "fuse", .dt_id = TEGRA30_CLK_FUSE }, | ||
653 | { .con_id = "fuse_burn", .dev_id = "fuse-tegra", .dt_id = TEGRA30_CLK_FUSE_BURN }, | ||
654 | { .con_id = "apbif", .dev_id = "tegra30-ahub", .dt_id = TEGRA30_CLK_APBIF }, | ||
655 | { .con_id = "hda2hdmi", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA2HDMI }, | ||
656 | { .dev_id = "tegra-apbdma", .dt_id = TEGRA30_CLK_APBDMA }, | ||
657 | { .dev_id = "rtc-tegra", .dt_id = TEGRA30_CLK_RTC }, | ||
658 | { .dev_id = "timer", .dt_id = TEGRA30_CLK_TIMER }, | ||
659 | { .dev_id = "tegra-kbc", .dt_id = TEGRA30_CLK_KBC }, | ||
660 | { .dev_id = "fsl-tegra-udc", .dt_id = TEGRA30_CLK_USBD }, | ||
661 | { .dev_id = "tegra-ehci.1", .dt_id = TEGRA30_CLK_USB2 }, | ||
662 | { .dev_id = "tegra-ehci.2", .dt_id = TEGRA30_CLK_USB2 }, | ||
663 | { .dev_id = "kfuse-tegra", .dt_id = TEGRA30_CLK_KFUSE }, | ||
664 | { .dev_id = "tegra_sata_cold", .dt_id = TEGRA30_CLK_SATA_COLD }, | ||
665 | { .dev_id = "dtv", .dt_id = TEGRA30_CLK_DTV }, | ||
666 | { .dev_id = "tegra30-i2s.0", .dt_id = TEGRA30_CLK_I2S0 }, | ||
667 | { .dev_id = "tegra30-i2s.1", .dt_id = TEGRA30_CLK_I2S1 }, | ||
668 | { .dev_id = "tegra30-i2s.2", .dt_id = TEGRA30_CLK_I2S2 }, | ||
669 | { .dev_id = "tegra30-i2s.3", .dt_id = TEGRA30_CLK_I2S3 }, | ||
670 | { .dev_id = "tegra30-i2s.4", .dt_id = TEGRA30_CLK_I2S4 }, | ||
671 | { .con_id = "spdif_out", .dev_id = "tegra30-spdif", .dt_id = TEGRA30_CLK_SPDIF_OUT }, | ||
672 | { .con_id = "spdif_in", .dev_id = "tegra30-spdif", .dt_id = TEGRA30_CLK_SPDIF_IN }, | ||
673 | { .con_id = "d_audio", .dev_id = "tegra30-ahub", .dt_id = TEGRA30_CLK_D_AUDIO }, | ||
674 | { .dev_id = "tegra30-dam.0", .dt_id = TEGRA30_CLK_DAM0 }, | ||
675 | { .dev_id = "tegra30-dam.1", .dt_id = TEGRA30_CLK_DAM1 }, | ||
676 | { .dev_id = "tegra30-dam.2", .dt_id = TEGRA30_CLK_DAM2 }, | ||
677 | { .con_id = "hda", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA }, | ||
678 | { .con_id = "hda2codec", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA2CODEC_2X }, | ||
679 | { .dev_id = "spi_tegra.0", .dt_id = TEGRA30_CLK_SBC1 }, | ||
680 | { .dev_id = "spi_tegra.1", .dt_id = TEGRA30_CLK_SBC2 }, | ||
681 | { .dev_id = "spi_tegra.2", .dt_id = TEGRA30_CLK_SBC3 }, | ||
682 | { .dev_id = "spi_tegra.3", .dt_id = TEGRA30_CLK_SBC4 }, | ||
683 | { .dev_id = "spi_tegra.4", .dt_id = TEGRA30_CLK_SBC5 }, | ||
684 | { .dev_id = "spi_tegra.5", .dt_id = TEGRA30_CLK_SBC6 }, | ||
685 | { .dev_id = "tegra_sata_oob", .dt_id = TEGRA30_CLK_SATA_OOB }, | ||
686 | { .dev_id = "tegra_sata", .dt_id = TEGRA30_CLK_SATA }, | ||
687 | { .dev_id = "tegra_nand", .dt_id = TEGRA30_CLK_NDFLASH }, | ||
688 | { .dev_id = "tegra_nand_speed", .dt_id = TEGRA30_CLK_NDSPEED }, | ||
689 | { .dev_id = "vfir", .dt_id = TEGRA30_CLK_VFIR }, | ||
690 | { .dev_id = "csite", .dt_id = TEGRA30_CLK_CSITE }, | ||
691 | { .dev_id = "la", .dt_id = TEGRA30_CLK_LA }, | ||
692 | { .dev_id = "tegra_w1", .dt_id = TEGRA30_CLK_OWR }, | ||
693 | { .dev_id = "mipi", .dt_id = TEGRA30_CLK_MIPI }, | ||
694 | { .dev_id = "tegra-tsensor", .dt_id = TEGRA30_CLK_TSENSOR }, | ||
695 | { .dev_id = "i2cslow", .dt_id = TEGRA30_CLK_I2CSLOW }, | ||
696 | { .dev_id = "vde", .dt_id = TEGRA30_CLK_VDE }, | ||
697 | { .con_id = "vi", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_VI }, | ||
698 | { .dev_id = "epp", .dt_id = TEGRA30_CLK_EPP }, | ||
699 | { .dev_id = "mpe", .dt_id = TEGRA30_CLK_MPE }, | ||
700 | { .dev_id = "host1x", .dt_id = TEGRA30_CLK_HOST1X }, | ||
701 | { .dev_id = "3d", .dt_id = TEGRA30_CLK_GR3D }, | ||
702 | { .dev_id = "3d2", .dt_id = TEGRA30_CLK_GR3D2 }, | ||
703 | { .dev_id = "2d", .dt_id = TEGRA30_CLK_GR2D }, | ||
704 | { .dev_id = "se", .dt_id = TEGRA30_CLK_SE }, | ||
705 | { .dev_id = "mselect", .dt_id = TEGRA30_CLK_MSELECT }, | ||
706 | { .dev_id = "tegra-nor", .dt_id = TEGRA30_CLK_NOR }, | ||
707 | { .dev_id = "sdhci-tegra.0", .dt_id = TEGRA30_CLK_SDMMC1 }, | ||
708 | { .dev_id = "sdhci-tegra.1", .dt_id = TEGRA30_CLK_SDMMC2 }, | ||
709 | { .dev_id = "sdhci-tegra.2", .dt_id = TEGRA30_CLK_SDMMC3 }, | ||
710 | { .dev_id = "sdhci-tegra.3", .dt_id = TEGRA30_CLK_SDMMC4 }, | ||
711 | { .dev_id = "cve", .dt_id = TEGRA30_CLK_CVE }, | ||
712 | { .dev_id = "tvo", .dt_id = TEGRA30_CLK_TVO }, | ||
713 | { .dev_id = "tvdac", .dt_id = TEGRA30_CLK_TVDAC }, | ||
714 | { .dev_id = "actmon", .dt_id = TEGRA30_CLK_ACTMON }, | ||
715 | { .con_id = "vi_sensor", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_VI_SENSOR }, | ||
716 | { .con_id = "div-clk", .dev_id = "tegra-i2c.0", .dt_id = TEGRA30_CLK_I2C1 }, | ||
717 | { .con_id = "div-clk", .dev_id = "tegra-i2c.1", .dt_id = TEGRA30_CLK_I2C2 }, | ||
718 | { .con_id = "div-clk", .dev_id = "tegra-i2c.2", .dt_id = TEGRA30_CLK_I2C3 }, | ||
719 | { .con_id = "div-clk", .dev_id = "tegra-i2c.3", .dt_id = TEGRA30_CLK_I2C4 }, | ||
720 | { .con_id = "div-clk", .dev_id = "tegra-i2c.4", .dt_id = TEGRA30_CLK_I2C5 }, | ||
721 | { .dev_id = "tegra_uart.0", .dt_id = TEGRA30_CLK_UARTA }, | ||
722 | { .dev_id = "tegra_uart.1", .dt_id = TEGRA30_CLK_UARTB }, | ||
723 | { .dev_id = "tegra_uart.2", .dt_id = TEGRA30_CLK_UARTC }, | ||
724 | { .dev_id = "tegra_uart.3", .dt_id = TEGRA30_CLK_UARTD }, | ||
725 | { .dev_id = "tegra_uart.4", .dt_id = TEGRA30_CLK_UARTE }, | ||
726 | { .dev_id = "hdmi", .dt_id = TEGRA30_CLK_HDMI }, | ||
727 | { .dev_id = "extern1", .dt_id = TEGRA30_CLK_EXTERN1 }, | ||
728 | { .dev_id = "extern2", .dt_id = TEGRA30_CLK_EXTERN2 }, | ||
729 | { .dev_id = "extern3", .dt_id = TEGRA30_CLK_EXTERN3 }, | ||
730 | { .dev_id = "pwm", .dt_id = TEGRA30_CLK_PWM }, | ||
731 | { .dev_id = "tegradc.0", .dt_id = TEGRA30_CLK_DISP1 }, | ||
732 | { .dev_id = "tegradc.1", .dt_id = TEGRA30_CLK_DISP2 }, | ||
733 | { .dev_id = "tegradc.1", .dt_id = TEGRA30_CLK_DSIB }, | ||
714 | }; | 734 | }; |
715 | 735 | ||
716 | static struct tegra_clk_periph_regs periph_u_regs = { | 736 | static struct tegra_clk tegra30_clks[tegra_clk_max] __initdata = { |
717 | .enb_reg = CLK_OUT_ENB_U, | 737 | [tegra_clk_clk_32k] = { .dt_id = TEGRA30_CLK_CLK_32K, .present = true }, |
718 | .enb_set_reg = CLK_OUT_ENB_SET_U, | 738 | [tegra_clk_clk_m] = { .dt_id = TEGRA30_CLK_CLK_M, .present = true }, |
719 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | 739 | [tegra_clk_clk_m_div2] = { .dt_id = TEGRA30_CLK_CLK_M_DIV2, .present = true }, |
720 | .rst_reg = RST_DEVICES_U, | 740 | [tegra_clk_clk_m_div4] = { .dt_id = TEGRA30_CLK_CLK_M_DIV4, .present = true }, |
721 | .rst_set_reg = RST_DEVICES_SET_U, | 741 | [tegra_clk_pll_ref] = { .dt_id = TEGRA30_CLK_PLL_REF, .present = true }, |
722 | .rst_clr_reg = RST_DEVICES_CLR_U, | 742 | [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA30_CLK_SPDIF_IN_SYNC, .present = true }, |
723 | }; | 743 | [tegra_clk_i2s0_sync] = { .dt_id = TEGRA30_CLK_I2S0_SYNC, .present = true }, |
744 | [tegra_clk_i2s1_sync] = { .dt_id = TEGRA30_CLK_I2S1_SYNC, .present = true }, | ||
745 | [tegra_clk_i2s2_sync] = { .dt_id = TEGRA30_CLK_I2S2_SYNC, .present = true }, | ||
746 | [tegra_clk_i2s3_sync] = { .dt_id = TEGRA30_CLK_I2S3_SYNC, .present = true }, | ||
747 | [tegra_clk_i2s4_sync] = { .dt_id = TEGRA30_CLK_I2S4_SYNC, .present = true }, | ||
748 | [tegra_clk_vimclk_sync] = { .dt_id = TEGRA30_CLK_VIMCLK_SYNC, .present = true }, | ||
749 | [tegra_clk_audio0] = { .dt_id = TEGRA30_CLK_AUDIO0, .present = true }, | ||
750 | [tegra_clk_audio1] = { .dt_id = TEGRA30_CLK_AUDIO1, .present = true }, | ||
751 | [tegra_clk_audio2] = { .dt_id = TEGRA30_CLK_AUDIO2, .present = true }, | ||
752 | [tegra_clk_audio3] = { .dt_id = TEGRA30_CLK_AUDIO3, .present = true }, | ||
753 | [tegra_clk_audio4] = { .dt_id = TEGRA30_CLK_AUDIO4, .present = true }, | ||
754 | [tegra_clk_spdif] = { .dt_id = TEGRA30_CLK_SPDIF, .present = true }, | ||
755 | [tegra_clk_audio0_mux] = { .dt_id = TEGRA30_CLK_AUDIO0_MUX, .present = true }, | ||
756 | [tegra_clk_audio1_mux] = { .dt_id = TEGRA30_CLK_AUDIO1_MUX, .present = true }, | ||
757 | [tegra_clk_audio2_mux] = { .dt_id = TEGRA30_CLK_AUDIO2_MUX, .present = true }, | ||
758 | [tegra_clk_audio3_mux] = { .dt_id = TEGRA30_CLK_AUDIO3_MUX, .present = true }, | ||
759 | [tegra_clk_audio4_mux] = { .dt_id = TEGRA30_CLK_AUDIO4_MUX, .present = true }, | ||
760 | [tegra_clk_spdif_mux] = { .dt_id = TEGRA30_CLK_SPDIF_MUX, .present = true }, | ||
761 | [tegra_clk_audio0_2x] = { .dt_id = TEGRA30_CLK_AUDIO0_2X, .present = true }, | ||
762 | [tegra_clk_audio1_2x] = { .dt_id = TEGRA30_CLK_AUDIO1_2X, .present = true }, | ||
763 | [tegra_clk_audio2_2x] = { .dt_id = TEGRA30_CLK_AUDIO2_2X, .present = true }, | ||
764 | [tegra_clk_audio3_2x] = { .dt_id = TEGRA30_CLK_AUDIO3_2X, .present = true }, | ||
765 | [tegra_clk_audio4_2x] = { .dt_id = TEGRA30_CLK_AUDIO4_2X, .present = true }, | ||
766 | [tegra_clk_spdif_2x] = { .dt_id = TEGRA30_CLK_SPDIF_2X, .present = true }, | ||
767 | [tegra_clk_clk_out_1] = { .dt_id = TEGRA30_CLK_CLK_OUT_1, .present = true }, | ||
768 | [tegra_clk_clk_out_2] = { .dt_id = TEGRA30_CLK_CLK_OUT_2, .present = true }, | ||
769 | [tegra_clk_clk_out_3] = { .dt_id = TEGRA30_CLK_CLK_OUT_3, .present = true }, | ||
770 | [tegra_clk_blink] = { .dt_id = TEGRA30_CLK_BLINK, .present = true }, | ||
771 | [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_1_MUX, .present = true }, | ||
772 | [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_2_MUX, .present = true }, | ||
773 | [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_3_MUX, .present = true }, | ||
774 | [tegra_clk_hclk] = { .dt_id = TEGRA30_CLK_HCLK, .present = true }, | ||
775 | [tegra_clk_pclk] = { .dt_id = TEGRA30_CLK_PCLK, .present = true }, | ||
776 | [tegra_clk_i2s0] = { .dt_id = TEGRA30_CLK_I2S0, .present = true }, | ||
777 | [tegra_clk_i2s1] = { .dt_id = TEGRA30_CLK_I2S1, .present = true }, | ||
778 | [tegra_clk_i2s2] = { .dt_id = TEGRA30_CLK_I2S2, .present = true }, | ||
779 | [tegra_clk_i2s3] = { .dt_id = TEGRA30_CLK_I2S3, .present = true }, | ||
780 | [tegra_clk_i2s4] = { .dt_id = TEGRA30_CLK_I2S4, .present = true }, | ||
781 | [tegra_clk_spdif_in] = { .dt_id = TEGRA30_CLK_SPDIF_IN, .present = true }, | ||
782 | [tegra_clk_hda] = { .dt_id = TEGRA30_CLK_HDA, .present = true }, | ||
783 | [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA30_CLK_HDA2CODEC_2X, .present = true }, | ||
784 | [tegra_clk_sbc1] = { .dt_id = TEGRA30_CLK_SBC1, .present = true }, | ||
785 | [tegra_clk_sbc2] = { .dt_id = TEGRA30_CLK_SBC2, .present = true }, | ||
786 | [tegra_clk_sbc3] = { .dt_id = TEGRA30_CLK_SBC3, .present = true }, | ||
787 | [tegra_clk_sbc4] = { .dt_id = TEGRA30_CLK_SBC4, .present = true }, | ||
788 | [tegra_clk_sbc5] = { .dt_id = TEGRA30_CLK_SBC5, .present = true }, | ||
789 | [tegra_clk_sbc6] = { .dt_id = TEGRA30_CLK_SBC6, .present = true }, | ||
790 | [tegra_clk_ndflash] = { .dt_id = TEGRA30_CLK_NDFLASH, .present = true }, | ||
791 | [tegra_clk_ndspeed] = { .dt_id = TEGRA30_CLK_NDSPEED, .present = true }, | ||
792 | [tegra_clk_vfir] = { .dt_id = TEGRA30_CLK_VFIR, .present = true }, | ||
793 | [tegra_clk_la] = { .dt_id = TEGRA30_CLK_LA, .present = true }, | ||
794 | [tegra_clk_csite] = { .dt_id = TEGRA30_CLK_CSITE, .present = true }, | ||
795 | [tegra_clk_owr] = { .dt_id = TEGRA30_CLK_OWR, .present = true }, | ||
796 | [tegra_clk_mipi] = { .dt_id = TEGRA30_CLK_MIPI, .present = true }, | ||
797 | [tegra_clk_tsensor] = { .dt_id = TEGRA30_CLK_TSENSOR, .present = true }, | ||
798 | [tegra_clk_i2cslow] = { .dt_id = TEGRA30_CLK_I2CSLOW, .present = true }, | ||
799 | [tegra_clk_vde] = { .dt_id = TEGRA30_CLK_VDE, .present = true }, | ||
800 | [tegra_clk_vi] = { .dt_id = TEGRA30_CLK_VI, .present = true }, | ||
801 | [tegra_clk_epp] = { .dt_id = TEGRA30_CLK_EPP, .present = true }, | ||
802 | [tegra_clk_mpe] = { .dt_id = TEGRA30_CLK_MPE, .present = true }, | ||
803 | [tegra_clk_host1x] = { .dt_id = TEGRA30_CLK_HOST1X, .present = true }, | ||
804 | [tegra_clk_gr2d] = { .dt_id = TEGRA30_CLK_GR2D, .present = true }, | ||
805 | [tegra_clk_gr3d] = { .dt_id = TEGRA30_CLK_GR3D, .present = true }, | ||
806 | [tegra_clk_mselect] = { .dt_id = TEGRA30_CLK_MSELECT, .present = true }, | ||
807 | [tegra_clk_nor] = { .dt_id = TEGRA30_CLK_NOR, .present = true }, | ||
808 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA30_CLK_SDMMC1, .present = true }, | ||
809 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA30_CLK_SDMMC2, .present = true }, | ||
810 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA30_CLK_SDMMC3, .present = true }, | ||
811 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA30_CLK_SDMMC4, .present = true }, | ||
812 | [tegra_clk_cve] = { .dt_id = TEGRA30_CLK_CVE, .present = true }, | ||
813 | [tegra_clk_tvo] = { .dt_id = TEGRA30_CLK_TVO, .present = true }, | ||
814 | [tegra_clk_tvdac] = { .dt_id = TEGRA30_CLK_TVDAC, .present = true }, | ||
815 | [tegra_clk_actmon] = { .dt_id = TEGRA30_CLK_ACTMON, .present = true }, | ||
816 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA30_CLK_VI_SENSOR, .present = true }, | ||
817 | [tegra_clk_i2c1] = { .dt_id = TEGRA30_CLK_I2C1, .present = true }, | ||
818 | [tegra_clk_i2c2] = { .dt_id = TEGRA30_CLK_I2C2, .present = true }, | ||
819 | [tegra_clk_i2c3] = { .dt_id = TEGRA30_CLK_I2C3, .present = true }, | ||
820 | [tegra_clk_i2c4] = { .dt_id = TEGRA30_CLK_I2C4, .present = true }, | ||
821 | [tegra_clk_i2c5] = { .dt_id = TEGRA30_CLK_I2C5, .present = true }, | ||
822 | [tegra_clk_uarta] = { .dt_id = TEGRA30_CLK_UARTA, .present = true }, | ||
823 | [tegra_clk_uartb] = { .dt_id = TEGRA30_CLK_UARTB, .present = true }, | ||
824 | [tegra_clk_uartc] = { .dt_id = TEGRA30_CLK_UARTC, .present = true }, | ||
825 | [tegra_clk_uartd] = { .dt_id = TEGRA30_CLK_UARTD, .present = true }, | ||
826 | [tegra_clk_uarte] = { .dt_id = TEGRA30_CLK_UARTE, .present = true }, | ||
827 | [tegra_clk_extern1] = { .dt_id = TEGRA30_CLK_EXTERN1, .present = true }, | ||
828 | [tegra_clk_extern2] = { .dt_id = TEGRA30_CLK_EXTERN2, .present = true }, | ||
829 | [tegra_clk_extern3] = { .dt_id = TEGRA30_CLK_EXTERN3, .present = true }, | ||
830 | [tegra_clk_disp1] = { .dt_id = TEGRA30_CLK_DISP1, .present = true }, | ||
831 | [tegra_clk_disp2] = { .dt_id = TEGRA30_CLK_DISP2, .present = true }, | ||
832 | [tegra_clk_apbdma] = { .dt_id = TEGRA30_CLK_APBDMA, .present = true }, | ||
833 | [tegra_clk_rtc] = { .dt_id = TEGRA30_CLK_RTC, .present = true }, | ||
834 | [tegra_clk_timer] = { .dt_id = TEGRA30_CLK_TIMER, .present = true }, | ||
835 | [tegra_clk_kbc] = { .dt_id = TEGRA30_CLK_KBC, .present = true }, | ||
836 | [tegra_clk_csus] = { .dt_id = TEGRA30_CLK_CSUS, .present = true }, | ||
837 | [tegra_clk_vcp] = { .dt_id = TEGRA30_CLK_VCP, .present = true }, | ||
838 | [tegra_clk_bsea] = { .dt_id = TEGRA30_CLK_BSEA, .present = true }, | ||
839 | [tegra_clk_bsev] = { .dt_id = TEGRA30_CLK_BSEV, .present = true }, | ||
840 | [tegra_clk_usbd] = { .dt_id = TEGRA30_CLK_USBD, .present = true }, | ||
841 | [tegra_clk_usb2] = { .dt_id = TEGRA30_CLK_USB2, .present = true }, | ||
842 | [tegra_clk_usb3] = { .dt_id = TEGRA30_CLK_USB3, .present = true }, | ||
843 | [tegra_clk_csi] = { .dt_id = TEGRA30_CLK_CSI, .present = true }, | ||
844 | [tegra_clk_isp] = { .dt_id = TEGRA30_CLK_ISP, .present = true }, | ||
845 | [tegra_clk_kfuse] = { .dt_id = TEGRA30_CLK_KFUSE, .present = true }, | ||
846 | [tegra_clk_fuse] = { .dt_id = TEGRA30_CLK_FUSE, .present = true }, | ||
847 | [tegra_clk_fuse_burn] = { .dt_id = TEGRA30_CLK_FUSE_BURN, .present = true }, | ||
848 | [tegra_clk_apbif] = { .dt_id = TEGRA30_CLK_APBIF, .present = true }, | ||
849 | [tegra_clk_hda2hdmi] = { .dt_id = TEGRA30_CLK_HDA2HDMI, .present = true }, | ||
850 | [tegra_clk_sata_cold] = { .dt_id = TEGRA30_CLK_SATA_COLD, .present = true }, | ||
851 | [tegra_clk_sata_oob] = { .dt_id = TEGRA30_CLK_SATA_OOB, .present = true }, | ||
852 | [tegra_clk_sata] = { .dt_id = TEGRA30_CLK_SATA, .present = true }, | ||
853 | [tegra_clk_dtv] = { .dt_id = TEGRA30_CLK_DTV, .present = true }, | ||
854 | [tegra_clk_pll_p] = { .dt_id = TEGRA30_CLK_PLL_P, .present = true }, | ||
855 | [tegra_clk_pll_p_out1] = { .dt_id = TEGRA30_CLK_PLL_P_OUT1, .present = true }, | ||
856 | [tegra_clk_pll_p_out2] = { .dt_id = TEGRA30_CLK_PLL_P_OUT2, .present = true }, | ||
857 | [tegra_clk_pll_p_out3] = { .dt_id = TEGRA30_CLK_PLL_P_OUT3, .present = true }, | ||
858 | [tegra_clk_pll_p_out4] = { .dt_id = TEGRA30_CLK_PLL_P_OUT4, .present = true }, | ||
859 | [tegra_clk_pll_a] = { .dt_id = TEGRA30_CLK_PLL_A, .present = true }, | ||
860 | [tegra_clk_pll_a_out0] = { .dt_id = TEGRA30_CLK_PLL_A_OUT0, .present = true }, | ||
724 | 861 | ||
725 | static struct tegra_clk_periph_regs periph_v_regs = { | ||
726 | .enb_reg = CLK_OUT_ENB_V, | ||
727 | .enb_set_reg = CLK_OUT_ENB_SET_V, | ||
728 | .enb_clr_reg = CLK_OUT_ENB_CLR_V, | ||
729 | .rst_reg = RST_DEVICES_V, | ||
730 | .rst_set_reg = RST_DEVICES_SET_V, | ||
731 | .rst_clr_reg = RST_DEVICES_CLR_V, | ||
732 | }; | 862 | }; |
733 | 863 | ||
734 | static struct tegra_clk_periph_regs periph_w_regs = { | ||
735 | .enb_reg = CLK_OUT_ENB_W, | ||
736 | .enb_set_reg = CLK_OUT_ENB_SET_W, | ||
737 | .enb_clr_reg = CLK_OUT_ENB_CLR_W, | ||
738 | .rst_reg = RST_DEVICES_W, | ||
739 | .rst_set_reg = RST_DEVICES_SET_W, | ||
740 | .rst_clr_reg = RST_DEVICES_CLR_W, | ||
741 | }; | ||
742 | |||
743 | static void tegra30_clk_measure_input_freq(void) | ||
744 | { | ||
745 | u32 osc_ctrl = readl_relaxed(clk_base + OSC_CTRL); | ||
746 | u32 auto_clk_control = osc_ctrl & OSC_CTRL_OSC_FREQ_MASK; | ||
747 | u32 pll_ref_div = osc_ctrl & OSC_CTRL_PLL_REF_DIV_MASK; | ||
748 | |||
749 | switch (auto_clk_control) { | ||
750 | case OSC_CTRL_OSC_FREQ_12MHZ: | ||
751 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1); | ||
752 | input_freq = 12000000; | ||
753 | break; | ||
754 | case OSC_CTRL_OSC_FREQ_13MHZ: | ||
755 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1); | ||
756 | input_freq = 13000000; | ||
757 | break; | ||
758 | case OSC_CTRL_OSC_FREQ_19_2MHZ: | ||
759 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1); | ||
760 | input_freq = 19200000; | ||
761 | break; | ||
762 | case OSC_CTRL_OSC_FREQ_26MHZ: | ||
763 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1); | ||
764 | input_freq = 26000000; | ||
765 | break; | ||
766 | case OSC_CTRL_OSC_FREQ_16_8MHZ: | ||
767 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1); | ||
768 | input_freq = 16800000; | ||
769 | break; | ||
770 | case OSC_CTRL_OSC_FREQ_38_4MHZ: | ||
771 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_2); | ||
772 | input_freq = 38400000; | ||
773 | break; | ||
774 | case OSC_CTRL_OSC_FREQ_48MHZ: | ||
775 | BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_4); | ||
776 | input_freq = 48000000; | ||
777 | break; | ||
778 | default: | ||
779 | pr_err("Unexpected auto clock control value %d", | ||
780 | auto_clk_control); | ||
781 | BUG(); | ||
782 | return; | ||
783 | } | ||
784 | } | ||
785 | |||
786 | static unsigned int tegra30_get_pll_ref_div(void) | ||
787 | { | ||
788 | u32 pll_ref_div = readl_relaxed(clk_base + OSC_CTRL) & | ||
789 | OSC_CTRL_PLL_REF_DIV_MASK; | ||
790 | |||
791 | switch (pll_ref_div) { | ||
792 | case OSC_CTRL_PLL_REF_DIV_1: | ||
793 | return 1; | ||
794 | case OSC_CTRL_PLL_REF_DIV_2: | ||
795 | return 2; | ||
796 | case OSC_CTRL_PLL_REF_DIV_4: | ||
797 | return 4; | ||
798 | default: | ||
799 | pr_err("Invalid pll ref divider %d", pll_ref_div); | ||
800 | BUG(); | ||
801 | } | ||
802 | return 0; | ||
803 | } | ||
804 | |||
805 | static void tegra30_utmi_param_configure(void) | 864 | static void tegra30_utmi_param_configure(void) |
806 | { | 865 | { |
807 | u32 reg; | 866 | u32 reg; |
@@ -863,11 +922,8 @@ static void __init tegra30_pll_init(void) | |||
863 | 922 | ||
864 | /* PLLC */ | 923 | /* PLLC */ |
865 | clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, pmc_base, 0, | 924 | clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, pmc_base, 0, |
866 | 0, &pll_c_params, | 925 | &pll_c_params, NULL); |
867 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | 926 | clks[TEGRA30_CLK_PLL_C] = clk; |
868 | pll_c_freq_table, NULL); | ||
869 | clk_register_clkdev(clk, "pll_c", NULL); | ||
870 | clks[pll_c] = clk; | ||
871 | 927 | ||
872 | /* PLLC_OUT1 */ | 928 | /* PLLC_OUT1 */ |
873 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | 929 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", |
@@ -876,73 +932,13 @@ static void __init tegra30_pll_init(void) | |||
876 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | 932 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", |
877 | clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT, | 933 | clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT, |
878 | 0, NULL); | 934 | 0, NULL); |
879 | clk_register_clkdev(clk, "pll_c_out1", NULL); | 935 | clks[TEGRA30_CLK_PLL_C_OUT1] = clk; |
880 | clks[pll_c_out1] = clk; | ||
881 | |||
882 | /* PLLP */ | ||
883 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc_base, 0, | ||
884 | 408000000, &pll_p_params, | ||
885 | TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON | | ||
886 | TEGRA_PLL_USE_LOCK, pll_p_freq_table, NULL); | ||
887 | clk_register_clkdev(clk, "pll_p", NULL); | ||
888 | clks[pll_p] = clk; | ||
889 | |||
890 | /* PLLP_OUT1 */ | ||
891 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", | ||
892 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
893 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, | ||
894 | &pll_div_lock); | ||
895 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", | ||
896 | clk_base + PLLP_OUTA, 1, 0, | ||
897 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
898 | &pll_div_lock); | ||
899 | clk_register_clkdev(clk, "pll_p_out1", NULL); | ||
900 | clks[pll_p_out1] = clk; | ||
901 | |||
902 | /* PLLP_OUT2 */ | ||
903 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", | ||
904 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
905 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
906 | &pll_div_lock); | ||
907 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", | ||
908 | clk_base + PLLP_OUTA, 17, 16, | ||
909 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
910 | &pll_div_lock); | ||
911 | clk_register_clkdev(clk, "pll_p_out2", NULL); | ||
912 | clks[pll_p_out2] = clk; | ||
913 | |||
914 | /* PLLP_OUT3 */ | ||
915 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", | ||
916 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
917 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, | ||
918 | &pll_div_lock); | ||
919 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", | ||
920 | clk_base + PLLP_OUTB, 1, 0, | ||
921 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
922 | &pll_div_lock); | ||
923 | clk_register_clkdev(clk, "pll_p_out3", NULL); | ||
924 | clks[pll_p_out3] = clk; | ||
925 | |||
926 | /* PLLP_OUT4 */ | ||
927 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", | ||
928 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
929 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
930 | &pll_div_lock); | ||
931 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", | ||
932 | clk_base + PLLP_OUTB, 17, 16, | ||
933 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
934 | &pll_div_lock); | ||
935 | clk_register_clkdev(clk, "pll_p_out4", NULL); | ||
936 | clks[pll_p_out4] = clk; | ||
937 | 936 | ||
938 | /* PLLM */ | 937 | /* PLLM */ |
939 | clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, pmc_base, | 938 | clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, pmc_base, |
940 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, | 939 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
941 | &pll_m_params, TEGRA_PLLM | TEGRA_PLL_HAS_CPCON | | 940 | &pll_m_params, NULL); |
942 | TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK, | 941 | clks[TEGRA30_CLK_PLL_M] = clk; |
943 | pll_m_freq_table, NULL); | ||
944 | clk_register_clkdev(clk, "pll_m", NULL); | ||
945 | clks[pll_m] = clk; | ||
946 | 942 | ||
947 | /* PLLM_OUT1 */ | 943 | /* PLLM_OUT1 */ |
948 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | 944 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", |
@@ -951,78 +947,44 @@ static void __init tegra30_pll_init(void) | |||
951 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | 947 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", |
952 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | 948 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | |
953 | CLK_SET_RATE_PARENT, 0, NULL); | 949 | CLK_SET_RATE_PARENT, 0, NULL); |
954 | clk_register_clkdev(clk, "pll_m_out1", NULL); | 950 | clks[TEGRA30_CLK_PLL_M_OUT1] = clk; |
955 | clks[pll_m_out1] = clk; | ||
956 | 951 | ||
957 | /* PLLX */ | 952 | /* PLLX */ |
958 | clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, pmc_base, 0, | 953 | clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, pmc_base, 0, |
959 | 0, &pll_x_params, TEGRA_PLL_HAS_CPCON | | 954 | &pll_x_params, NULL); |
960 | TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK, | 955 | clks[TEGRA30_CLK_PLL_X] = clk; |
961 | pll_x_freq_table, NULL); | ||
962 | clk_register_clkdev(clk, "pll_x", NULL); | ||
963 | clks[pll_x] = clk; | ||
964 | 956 | ||
965 | /* PLLX_OUT0 */ | 957 | /* PLLX_OUT0 */ |
966 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", | 958 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", |
967 | CLK_SET_RATE_PARENT, 1, 2); | 959 | CLK_SET_RATE_PARENT, 1, 2); |
968 | clk_register_clkdev(clk, "pll_x_out0", NULL); | 960 | clks[TEGRA30_CLK_PLL_X_OUT0] = clk; |
969 | clks[pll_x_out0] = clk; | ||
970 | 961 | ||
971 | /* PLLU */ | 962 | /* PLLU */ |
972 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc_base, 0, | 963 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc_base, 0, |
973 | 0, &pll_u_params, TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | | 964 | &pll_u_params, NULL); |
974 | TEGRA_PLL_SET_LFCON, | 965 | clks[TEGRA30_CLK_PLL_U] = clk; |
975 | pll_u_freq_table, | ||
976 | NULL); | ||
977 | clk_register_clkdev(clk, "pll_u", NULL); | ||
978 | clks[pll_u] = clk; | ||
979 | 966 | ||
980 | tegra30_utmi_param_configure(); | 967 | tegra30_utmi_param_configure(); |
981 | 968 | ||
982 | /* PLLD */ | 969 | /* PLLD */ |
983 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc_base, 0, | 970 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc_base, 0, |
984 | 0, &pll_d_params, TEGRA_PLL_HAS_CPCON | | 971 | &pll_d_params, &pll_d_lock); |
985 | TEGRA_PLL_SET_LFCON | TEGRA_PLL_USE_LOCK, | 972 | clks[TEGRA30_CLK_PLL_D] = clk; |
986 | pll_d_freq_table, &pll_d_lock); | ||
987 | clk_register_clkdev(clk, "pll_d", NULL); | ||
988 | clks[pll_d] = clk; | ||
989 | 973 | ||
990 | /* PLLD_OUT0 */ | 974 | /* PLLD_OUT0 */ |
991 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | 975 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", |
992 | CLK_SET_RATE_PARENT, 1, 2); | 976 | CLK_SET_RATE_PARENT, 1, 2); |
993 | clk_register_clkdev(clk, "pll_d_out0", NULL); | 977 | clks[TEGRA30_CLK_PLL_D_OUT0] = clk; |
994 | clks[pll_d_out0] = clk; | ||
995 | 978 | ||
996 | /* PLLD2 */ | 979 | /* PLLD2 */ |
997 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc_base, 0, | 980 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc_base, 0, |
998 | 0, &pll_d2_params, TEGRA_PLL_HAS_CPCON | | 981 | &pll_d2_params, NULL); |
999 | TEGRA_PLL_SET_LFCON | TEGRA_PLL_USE_LOCK, | 982 | clks[TEGRA30_CLK_PLL_D2] = clk; |
1000 | pll_d_freq_table, NULL); | ||
1001 | clk_register_clkdev(clk, "pll_d2", NULL); | ||
1002 | clks[pll_d2] = clk; | ||
1003 | 983 | ||
1004 | /* PLLD2_OUT0 */ | 984 | /* PLLD2_OUT0 */ |
1005 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | 985 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", |
1006 | CLK_SET_RATE_PARENT, 1, 2); | 986 | CLK_SET_RATE_PARENT, 1, 2); |
1007 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | 987 | clks[TEGRA30_CLK_PLL_D2_OUT0] = clk; |
1008 | clks[pll_d2_out0] = clk; | ||
1009 | |||
1010 | /* PLLA */ | ||
1011 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc_base, | ||
1012 | 0, 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | | ||
1013 | TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); | ||
1014 | clk_register_clkdev(clk, "pll_a", NULL); | ||
1015 | clks[pll_a] = clk; | ||
1016 | |||
1017 | /* PLLA_OUT0 */ | ||
1018 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | ||
1019 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1020 | 8, 8, 1, NULL); | ||
1021 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | ||
1022 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1023 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1024 | clk_register_clkdev(clk, "pll_a_out0", NULL); | ||
1025 | clks[pll_a_out0] = clk; | ||
1026 | 988 | ||
1027 | /* PLLE */ | 989 | /* PLLE */ |
1028 | clk = clk_register_mux(NULL, "pll_e_mux", pll_e_parents, | 990 | clk = clk_register_mux(NULL, "pll_e_mux", pll_e_parents, |
@@ -1030,258 +992,8 @@ static void __init tegra30_pll_init(void) | |||
1030 | CLK_SET_RATE_NO_REPARENT, | 992 | CLK_SET_RATE_NO_REPARENT, |
1031 | clk_base + PLLE_AUX, 2, 1, 0, NULL); | 993 | clk_base + PLLE_AUX, 2, 1, 0, NULL); |
1032 | clk = tegra_clk_register_plle("pll_e", "pll_e_mux", clk_base, pmc_base, | 994 | clk = tegra_clk_register_plle("pll_e", "pll_e_mux", clk_base, pmc_base, |
1033 | CLK_GET_RATE_NOCACHE, 100000000, &pll_e_params, | 995 | CLK_GET_RATE_NOCACHE, &pll_e_params, NULL); |
1034 | TEGRA_PLLE_CONFIGURE, pll_e_freq_table, NULL); | 996 | clks[TEGRA30_CLK_PLL_E] = clk; |
1035 | clk_register_clkdev(clk, "pll_e", NULL); | ||
1036 | clks[pll_e] = clk; | ||
1037 | } | ||
1038 | |||
1039 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", | ||
1040 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",}; | ||
1041 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", | ||
1042 | "clk_m_div4", "extern1", }; | ||
1043 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", | ||
1044 | "clk_m_div4", "extern2", }; | ||
1045 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", | ||
1046 | "clk_m_div4", "extern3", }; | ||
1047 | |||
1048 | static void __init tegra30_audio_clk_init(void) | ||
1049 | { | ||
1050 | struct clk *clk; | ||
1051 | |||
1052 | /* spdif_in_sync */ | ||
1053 | clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, | ||
1054 | 24000000); | ||
1055 | clk_register_clkdev(clk, "spdif_in_sync", NULL); | ||
1056 | clks[spdif_in_sync] = clk; | ||
1057 | |||
1058 | /* i2s0_sync */ | ||
1059 | clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); | ||
1060 | clk_register_clkdev(clk, "i2s0_sync", NULL); | ||
1061 | clks[i2s0_sync] = clk; | ||
1062 | |||
1063 | /* i2s1_sync */ | ||
1064 | clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); | ||
1065 | clk_register_clkdev(clk, "i2s1_sync", NULL); | ||
1066 | clks[i2s1_sync] = clk; | ||
1067 | |||
1068 | /* i2s2_sync */ | ||
1069 | clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); | ||
1070 | clk_register_clkdev(clk, "i2s2_sync", NULL); | ||
1071 | clks[i2s2_sync] = clk; | ||
1072 | |||
1073 | /* i2s3_sync */ | ||
1074 | clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); | ||
1075 | clk_register_clkdev(clk, "i2s3_sync", NULL); | ||
1076 | clks[i2s3_sync] = clk; | ||
1077 | |||
1078 | /* i2s4_sync */ | ||
1079 | clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); | ||
1080 | clk_register_clkdev(clk, "i2s4_sync", NULL); | ||
1081 | clks[i2s4_sync] = clk; | ||
1082 | |||
1083 | /* vimclk_sync */ | ||
1084 | clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); | ||
1085 | clk_register_clkdev(clk, "vimclk_sync", NULL); | ||
1086 | clks[vimclk_sync] = clk; | ||
1087 | |||
1088 | /* audio0 */ | ||
1089 | clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, | ||
1090 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1091 | CLK_SET_RATE_NO_REPARENT, | ||
1092 | clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, NULL); | ||
1093 | clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, | ||
1094 | clk_base + AUDIO_SYNC_CLK_I2S0, 4, | ||
1095 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1096 | clk_register_clkdev(clk, "audio0", NULL); | ||
1097 | clks[audio0] = clk; | ||
1098 | |||
1099 | /* audio1 */ | ||
1100 | clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, | ||
1101 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1102 | CLK_SET_RATE_NO_REPARENT, | ||
1103 | clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, NULL); | ||
1104 | clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, | ||
1105 | clk_base + AUDIO_SYNC_CLK_I2S1, 4, | ||
1106 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1107 | clk_register_clkdev(clk, "audio1", NULL); | ||
1108 | clks[audio1] = clk; | ||
1109 | |||
1110 | /* audio2 */ | ||
1111 | clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, | ||
1112 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1113 | CLK_SET_RATE_NO_REPARENT, | ||
1114 | clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, NULL); | ||
1115 | clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, | ||
1116 | clk_base + AUDIO_SYNC_CLK_I2S2, 4, | ||
1117 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1118 | clk_register_clkdev(clk, "audio2", NULL); | ||
1119 | clks[audio2] = clk; | ||
1120 | |||
1121 | /* audio3 */ | ||
1122 | clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, | ||
1123 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1124 | CLK_SET_RATE_NO_REPARENT, | ||
1125 | clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, NULL); | ||
1126 | clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, | ||
1127 | clk_base + AUDIO_SYNC_CLK_I2S3, 4, | ||
1128 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1129 | clk_register_clkdev(clk, "audio3", NULL); | ||
1130 | clks[audio3] = clk; | ||
1131 | |||
1132 | /* audio4 */ | ||
1133 | clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, | ||
1134 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1135 | CLK_SET_RATE_NO_REPARENT, | ||
1136 | clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, NULL); | ||
1137 | clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, | ||
1138 | clk_base + AUDIO_SYNC_CLK_I2S4, 4, | ||
1139 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1140 | clk_register_clkdev(clk, "audio4", NULL); | ||
1141 | clks[audio4] = clk; | ||
1142 | |||
1143 | /* spdif */ | ||
1144 | clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, | ||
1145 | ARRAY_SIZE(mux_audio_sync_clk), | ||
1146 | CLK_SET_RATE_NO_REPARENT, | ||
1147 | clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, NULL); | ||
1148 | clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, | ||
1149 | clk_base + AUDIO_SYNC_CLK_SPDIF, 4, | ||
1150 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1151 | clk_register_clkdev(clk, "spdif", NULL); | ||
1152 | clks[spdif] = clk; | ||
1153 | |||
1154 | /* audio0_2x */ | ||
1155 | clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", | ||
1156 | CLK_SET_RATE_PARENT, 2, 1); | ||
1157 | clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", | ||
1158 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, 0, | ||
1159 | &clk_doubler_lock); | ||
1160 | clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", | ||
1161 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1162 | CLK_SET_RATE_PARENT, 113, &periph_v_regs, | ||
1163 | periph_clk_enb_refcnt); | ||
1164 | clk_register_clkdev(clk, "audio0_2x", NULL); | ||
1165 | clks[audio0_2x] = clk; | ||
1166 | |||
1167 | /* audio1_2x */ | ||
1168 | clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", | ||
1169 | CLK_SET_RATE_PARENT, 2, 1); | ||
1170 | clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", | ||
1171 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, 0, | ||
1172 | &clk_doubler_lock); | ||
1173 | clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", | ||
1174 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1175 | CLK_SET_RATE_PARENT, 114, &periph_v_regs, | ||
1176 | periph_clk_enb_refcnt); | ||
1177 | clk_register_clkdev(clk, "audio1_2x", NULL); | ||
1178 | clks[audio1_2x] = clk; | ||
1179 | |||
1180 | /* audio2_2x */ | ||
1181 | clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", | ||
1182 | CLK_SET_RATE_PARENT, 2, 1); | ||
1183 | clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", | ||
1184 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, 0, | ||
1185 | &clk_doubler_lock); | ||
1186 | clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", | ||
1187 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1188 | CLK_SET_RATE_PARENT, 115, &periph_v_regs, | ||
1189 | periph_clk_enb_refcnt); | ||
1190 | clk_register_clkdev(clk, "audio2_2x", NULL); | ||
1191 | clks[audio2_2x] = clk; | ||
1192 | |||
1193 | /* audio3_2x */ | ||
1194 | clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", | ||
1195 | CLK_SET_RATE_PARENT, 2, 1); | ||
1196 | clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", | ||
1197 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, 0, | ||
1198 | &clk_doubler_lock); | ||
1199 | clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", | ||
1200 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1201 | CLK_SET_RATE_PARENT, 116, &periph_v_regs, | ||
1202 | periph_clk_enb_refcnt); | ||
1203 | clk_register_clkdev(clk, "audio3_2x", NULL); | ||
1204 | clks[audio3_2x] = clk; | ||
1205 | |||
1206 | /* audio4_2x */ | ||
1207 | clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", | ||
1208 | CLK_SET_RATE_PARENT, 2, 1); | ||
1209 | clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", | ||
1210 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, 0, | ||
1211 | &clk_doubler_lock); | ||
1212 | clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", | ||
1213 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1214 | CLK_SET_RATE_PARENT, 117, &periph_v_regs, | ||
1215 | periph_clk_enb_refcnt); | ||
1216 | clk_register_clkdev(clk, "audio4_2x", NULL); | ||
1217 | clks[audio4_2x] = clk; | ||
1218 | |||
1219 | /* spdif_2x */ | ||
1220 | clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", | ||
1221 | CLK_SET_RATE_PARENT, 2, 1); | ||
1222 | clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", | ||
1223 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, 0, | ||
1224 | &clk_doubler_lock); | ||
1225 | clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", | ||
1226 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1227 | CLK_SET_RATE_PARENT, 118, &periph_v_regs, | ||
1228 | periph_clk_enb_refcnt); | ||
1229 | clk_register_clkdev(clk, "spdif_2x", NULL); | ||
1230 | clks[spdif_2x] = clk; | ||
1231 | } | ||
1232 | |||
1233 | static void __init tegra30_pmc_clk_init(void) | ||
1234 | { | ||
1235 | struct clk *clk; | ||
1236 | |||
1237 | /* clk_out_1 */ | ||
1238 | clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, | ||
1239 | ARRAY_SIZE(clk_out1_parents), | ||
1240 | CLK_SET_RATE_NO_REPARENT, | ||
1241 | pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, | ||
1242 | &clk_out_lock); | ||
1243 | clks[clk_out_1_mux] = clk; | ||
1244 | clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, | ||
1245 | pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, | ||
1246 | &clk_out_lock); | ||
1247 | clk_register_clkdev(clk, "extern1", "clk_out_1"); | ||
1248 | clks[clk_out_1] = clk; | ||
1249 | |||
1250 | /* clk_out_2 */ | ||
1251 | clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, | ||
1252 | ARRAY_SIZE(clk_out2_parents), | ||
1253 | CLK_SET_RATE_NO_REPARENT, | ||
1254 | pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, | ||
1255 | &clk_out_lock); | ||
1256 | clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, | ||
1257 | pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, | ||
1258 | &clk_out_lock); | ||
1259 | clk_register_clkdev(clk, "extern2", "clk_out_2"); | ||
1260 | clks[clk_out_2] = clk; | ||
1261 | |||
1262 | /* clk_out_3 */ | ||
1263 | clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, | ||
1264 | ARRAY_SIZE(clk_out3_parents), | ||
1265 | CLK_SET_RATE_NO_REPARENT, | ||
1266 | pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, | ||
1267 | &clk_out_lock); | ||
1268 | clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, | ||
1269 | pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, | ||
1270 | &clk_out_lock); | ||
1271 | clk_register_clkdev(clk, "extern3", "clk_out_3"); | ||
1272 | clks[clk_out_3] = clk; | ||
1273 | |||
1274 | /* blink */ | ||
1275 | writel_relaxed(0, pmc_base + PMC_BLINK_TIMER); | ||
1276 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
1277 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
1278 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
1279 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
1280 | pmc_base + PMC_CTRL, | ||
1281 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
1282 | clk_register_clkdev(clk, "blink", NULL); | ||
1283 | clks[blink] = clk; | ||
1284 | |||
1285 | } | 997 | } |
1286 | 998 | ||
1287 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | 999 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", |
@@ -1332,8 +1044,7 @@ static void __init tegra30_super_clk_init(void) | |||
1332 | CLK_SET_RATE_PARENT, | 1044 | CLK_SET_RATE_PARENT, |
1333 | clk_base + CCLKG_BURST_POLICY, | 1045 | clk_base + CCLKG_BURST_POLICY, |
1334 | 0, 4, 0, 0, NULL); | 1046 | 0, 4, 0, 0, NULL); |
1335 | clk_register_clkdev(clk, "cclk_g", NULL); | 1047 | clks[TEGRA30_CLK_CCLK_G] = clk; |
1336 | clks[cclk_g] = clk; | ||
1337 | 1048 | ||
1338 | /* | 1049 | /* |
1339 | * Clock input to cclk_lp divided from pll_p using | 1050 | * Clock input to cclk_lp divided from pll_p using |
@@ -1369,8 +1080,7 @@ static void __init tegra30_super_clk_init(void) | |||
1369 | clk_base + CCLKLP_BURST_POLICY, | 1080 | clk_base + CCLKLP_BURST_POLICY, |
1370 | TEGRA_DIVIDER_2, 4, 8, 9, | 1081 | TEGRA_DIVIDER_2, 4, 8, 9, |
1371 | NULL); | 1082 | NULL); |
1372 | clk_register_clkdev(clk, "cclk_lp", NULL); | 1083 | clks[TEGRA30_CLK_CCLK_LP] = clk; |
1373 | clks[cclk_lp] = clk; | ||
1374 | 1084 | ||
1375 | /* SCLK */ | 1085 | /* SCLK */ |
1376 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | 1086 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, |
@@ -1378,142 +1088,44 @@ static void __init tegra30_super_clk_init(void) | |||
1378 | CLK_SET_RATE_PARENT, | 1088 | CLK_SET_RATE_PARENT, |
1379 | clk_base + SCLK_BURST_POLICY, | 1089 | clk_base + SCLK_BURST_POLICY, |
1380 | 0, 4, 0, 0, NULL); | 1090 | 0, 4, 0, 0, NULL); |
1381 | clk_register_clkdev(clk, "sclk", NULL); | 1091 | clks[TEGRA30_CLK_SCLK] = clk; |
1382 | clks[sclk] = clk; | ||
1383 | |||
1384 | /* HCLK */ | ||
1385 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
1386 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, | ||
1387 | &sysrate_lock); | ||
1388 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT, | ||
1389 | clk_base + SYSTEM_CLK_RATE, 7, | ||
1390 | CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1391 | clk_register_clkdev(clk, "hclk", NULL); | ||
1392 | clks[hclk] = clk; | ||
1393 | |||
1394 | /* PCLK */ | ||
1395 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
1396 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, | ||
1397 | &sysrate_lock); | ||
1398 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT, | ||
1399 | clk_base + SYSTEM_CLK_RATE, 3, | ||
1400 | CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1401 | clk_register_clkdev(clk, "pclk", NULL); | ||
1402 | clks[pclk] = clk; | ||
1403 | 1092 | ||
1404 | /* twd */ | 1093 | /* twd */ |
1405 | clk = clk_register_fixed_factor(NULL, "twd", "cclk_g", | 1094 | clk = clk_register_fixed_factor(NULL, "twd", "cclk_g", |
1406 | CLK_SET_RATE_PARENT, 1, 2); | 1095 | CLK_SET_RATE_PARENT, 1, 2); |
1407 | clk_register_clkdev(clk, "twd", NULL); | 1096 | clks[TEGRA30_CLK_TWD] = clk; |
1408 | clks[twd] = clk; | 1097 | |
1098 | tegra_super_clk_gen4_init(clk_base, pmc_base, tegra30_clks, NULL); | ||
1409 | } | 1099 | } |
1410 | 1100 | ||
1411 | static const char *mux_pllacp_clkm[] = { "pll_a_out0", "unused", "pll_p", | 1101 | static const char *mux_pllacp_clkm[] = { "pll_a_out0", "unused", "pll_p", |
1412 | "clk_m" }; | 1102 | "clk_m" }; |
1413 | static const char *mux_pllpcm_clkm[] = { "pll_p", "pll_c", "pll_m", "clk_m" }; | 1103 | static const char *mux_pllpcm_clkm[] = { "pll_p", "pll_c", "pll_m", "clk_m" }; |
1414 | static const char *mux_pllmcp_clkm[] = { "pll_m", "pll_c", "pll_p", "clk_m" }; | 1104 | static const char *mux_pllmcp_clkm[] = { "pll_m", "pll_c", "pll_p", "clk_m" }; |
1415 | static const char *i2s0_parents[] = { "pll_a_out0", "audio0_2x", "pll_p", | ||
1416 | "clk_m" }; | ||
1417 | static const char *i2s1_parents[] = { "pll_a_out0", "audio1_2x", "pll_p", | ||
1418 | "clk_m" }; | ||
1419 | static const char *i2s2_parents[] = { "pll_a_out0", "audio2_2x", "pll_p", | ||
1420 | "clk_m" }; | ||
1421 | static const char *i2s3_parents[] = { "pll_a_out0", "audio3_2x", "pll_p", | ||
1422 | "clk_m" }; | ||
1423 | static const char *i2s4_parents[] = { "pll_a_out0", "audio4_2x", "pll_p", | ||
1424 | "clk_m" }; | ||
1425 | static const char *spdif_out_parents[] = { "pll_a_out0", "spdif_2x", "pll_p", | 1105 | static const char *spdif_out_parents[] = { "pll_a_out0", "spdif_2x", "pll_p", |
1426 | "clk_m" }; | 1106 | "clk_m" }; |
1427 | static const char *spdif_in_parents[] = { "pll_p", "pll_c", "pll_m" }; | ||
1428 | static const char *mux_pllpc_clk32k_clkm[] = { "pll_p", "pll_c", "clk_32k", | ||
1429 | "clk_m" }; | ||
1430 | static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m", | ||
1431 | "clk_32k" }; | ||
1432 | static const char *mux_pllmcpa[] = { "pll_m", "pll_c", "pll_p", "pll_a_out0" }; | 1107 | static const char *mux_pllmcpa[] = { "pll_m", "pll_c", "pll_p", "pll_a_out0" }; |
1433 | static const char *mux_pllpdc_clkm[] = { "pll_p", "pll_d_out0", "pll_c", | ||
1434 | "clk_m" }; | ||
1435 | static const char *mux_pllp_clkm[] = { "pll_p", "unused", "unused", "clk_m" }; | ||
1436 | static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d_out0", | 1108 | static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d_out0", |
1437 | "pll_a_out0", "pll_c", | 1109 | "pll_a_out0", "pll_c", |
1438 | "pll_d2_out0", "clk_m" }; | 1110 | "pll_d2_out0", "clk_m" }; |
1439 | static const char *mux_plla_clk32k_pllp_clkm_plle[] = { "pll_a_out0", | ||
1440 | "clk_32k", "pll_p", | ||
1441 | "clk_m", "pll_e" }; | ||
1442 | static const char *mux_plld_out0_plld2_out0[] = { "pll_d_out0", | 1111 | static const char *mux_plld_out0_plld2_out0[] = { "pll_d_out0", |
1443 | "pll_d2_out0" }; | 1112 | "pll_d2_out0" }; |
1113 | static const char *pwm_parents[] = { "pll_p", "pll_c", "clk_32k", "clk_m" }; | ||
1444 | 1114 | ||
1445 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { | 1115 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { |
1446 | TEGRA_INIT_DATA_MUX("i2s0", NULL, "tegra30-i2s.0", i2s0_parents, CLK_SOURCE_I2S0, 30, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s0), | 1116 | TEGRA_INIT_DATA_MUX("spdif_out", spdif_out_parents, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, TEGRA30_CLK_SPDIF_OUT), |
1447 | TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra30-i2s.1", i2s1_parents, CLK_SOURCE_I2S1, 11, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1), | 1117 | TEGRA_INIT_DATA_MUX("d_audio", mux_pllacp_clkm, CLK_SOURCE_D_AUDIO, 106, 0, TEGRA30_CLK_D_AUDIO), |
1448 | TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra30-i2s.2", i2s2_parents, CLK_SOURCE_I2S2, 18, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2), | 1118 | TEGRA_INIT_DATA_MUX("dam0", mux_pllacp_clkm, CLK_SOURCE_DAM0, 108, 0, TEGRA30_CLK_DAM0), |
1449 | TEGRA_INIT_DATA_MUX("i2s3", NULL, "tegra30-i2s.3", i2s3_parents, CLK_SOURCE_I2S3, 101, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s3), | 1119 | TEGRA_INIT_DATA_MUX("dam1", mux_pllacp_clkm, CLK_SOURCE_DAM1, 109, 0, TEGRA30_CLK_DAM1), |
1450 | TEGRA_INIT_DATA_MUX("i2s4", NULL, "tegra30-i2s.4", i2s4_parents, CLK_SOURCE_I2S4, 102, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s4), | 1120 | TEGRA_INIT_DATA_MUX("dam2", mux_pllacp_clkm, CLK_SOURCE_DAM2, 110, 0, TEGRA30_CLK_DAM2), |
1451 | TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra30-spdif", spdif_out_parents, CLK_SOURCE_SPDIF_OUT, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out), | 1121 | TEGRA_INIT_DATA_INT("3d2", mux_pllmcpa, CLK_SOURCE_3D2, 98, TEGRA_PERIPH_MANUAL_RESET, TEGRA30_CLK_GR3D2), |
1452 | TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra30-spdif", spdif_in_parents, CLK_SOURCE_SPDIF_IN, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in), | 1122 | TEGRA_INIT_DATA_INT("se", mux_pllpcm_clkm, CLK_SOURCE_SE, 127, 0, TEGRA30_CLK_SE), |
1453 | TEGRA_INIT_DATA_MUX("d_audio", "d_audio", "tegra30-ahub", mux_pllacp_clkm, CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, 0, d_audio), | 1123 | TEGRA_INIT_DATA_MUX8("hdmi", mux_pllpmdacd2_clkm, CLK_SOURCE_HDMI, 51, 0, TEGRA30_CLK_HDMI), |
1454 | TEGRA_INIT_DATA_MUX("dam0", NULL, "tegra30-dam.0", mux_pllacp_clkm, CLK_SOURCE_DAM0, 108, &periph_v_regs, 0, dam0), | 1124 | TEGRA_INIT_DATA("pwm", NULL, NULL, pwm_parents, CLK_SOURCE_PWM, 28, 2, 0, 0, 8, 1, 0, 17, TEGRA_PERIPH_ON_APB, TEGRA30_CLK_PWM), |
1455 | TEGRA_INIT_DATA_MUX("dam1", NULL, "tegra30-dam.1", mux_pllacp_clkm, CLK_SOURCE_DAM1, 109, &periph_v_regs, 0, dam1), | ||
1456 | TEGRA_INIT_DATA_MUX("dam2", NULL, "tegra30-dam.2", mux_pllacp_clkm, CLK_SOURCE_DAM2, 110, &periph_v_regs, 0, dam2), | ||
1457 | TEGRA_INIT_DATA_MUX("hda", "hda", "tegra30-hda", mux_pllpcm_clkm, CLK_SOURCE_HDA, 125, &periph_v_regs, 0, hda), | ||
1458 | TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda", mux_pllpcm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, &periph_v_regs, 0, hda2codec_2x), | ||
1459 | TEGRA_INIT_DATA_MUX("sbc1", NULL, "spi_tegra.0", mux_pllpcm_clkm, CLK_SOURCE_SBC1, 41, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1), | ||
1460 | TEGRA_INIT_DATA_MUX("sbc2", NULL, "spi_tegra.1", mux_pllpcm_clkm, CLK_SOURCE_SBC2, 44, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2), | ||
1461 | TEGRA_INIT_DATA_MUX("sbc3", NULL, "spi_tegra.2", mux_pllpcm_clkm, CLK_SOURCE_SBC3, 46, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3), | ||
1462 | TEGRA_INIT_DATA_MUX("sbc4", NULL, "spi_tegra.3", mux_pllpcm_clkm, CLK_SOURCE_SBC4, 68, &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4), | ||
1463 | TEGRA_INIT_DATA_MUX("sbc5", NULL, "spi_tegra.4", mux_pllpcm_clkm, CLK_SOURCE_SBC5, 104, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc5), | ||
1464 | TEGRA_INIT_DATA_MUX("sbc6", NULL, "spi_tegra.5", mux_pllpcm_clkm, CLK_SOURCE_SBC6, 105, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc6), | ||
1465 | TEGRA_INIT_DATA_MUX("sata_oob", NULL, "tegra_sata_oob", mux_pllpcm_clkm, CLK_SOURCE_SATA_OOB, 123, &periph_v_regs, TEGRA_PERIPH_ON_APB, sata_oob), | ||
1466 | TEGRA_INIT_DATA_MUX("sata", NULL, "tegra_sata", mux_pllpcm_clkm, CLK_SOURCE_SATA, 124, &periph_v_regs, TEGRA_PERIPH_ON_APB, sata), | ||
1467 | TEGRA_INIT_DATA_MUX("ndflash", NULL, "tegra_nand", mux_pllpcm_clkm, CLK_SOURCE_NDFLASH, 13, &periph_l_regs, TEGRA_PERIPH_ON_APB, ndflash), | ||
1468 | TEGRA_INIT_DATA_MUX("ndspeed", NULL, "tegra_nand_speed", mux_pllpcm_clkm, CLK_SOURCE_NDSPEED, 80, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), | ||
1469 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllpcm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), | ||
1470 | TEGRA_INIT_DATA_MUX("csite", NULL, "csite", mux_pllpcm_clkm, CLK_SOURCE_CSITE, 73, &periph_u_regs, TEGRA_PERIPH_ON_APB, csite), | ||
1471 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllpcm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la), | ||
1472 | TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllpcm_clkm, CLK_SOURCE_OWR, 71, &periph_u_regs, TEGRA_PERIPH_ON_APB, owr), | ||
1473 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllpcm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), | ||
1474 | TEGRA_INIT_DATA_MUX("tsensor", NULL, "tegra-tsensor", mux_pllpc_clkm_clk32k, CLK_SOURCE_TSENSOR, 100, &periph_v_regs, TEGRA_PERIPH_ON_APB, tsensor), | ||
1475 | TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllpc_clk32k_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow), | ||
1476 | TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllpcm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), | ||
1477 | TEGRA_INIT_DATA_INT("vi", "vi", "tegra_camera", mux_pllmcpa, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), | ||
1478 | TEGRA_INIT_DATA_INT("epp", NULL, "epp", mux_pllmcpa, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), | ||
1479 | TEGRA_INIT_DATA_INT("mpe", NULL, "mpe", mux_pllmcpa, CLK_SOURCE_MPE, 60, &periph_h_regs, 0, mpe), | ||
1480 | TEGRA_INIT_DATA_INT("host1x", NULL, "host1x", mux_pllmcpa, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), | ||
1481 | TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllmcpa, CLK_SOURCE_3D, 24, &periph_l_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d), | ||
1482 | TEGRA_INIT_DATA_INT("3d2", NULL, "3d2", mux_pllmcpa, CLK_SOURCE_3D2, 98, &periph_v_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d2), | ||
1483 | TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllmcpa, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr2d), | ||
1484 | TEGRA_INIT_DATA_INT("se", NULL, "se", mux_pllpcm_clkm, CLK_SOURCE_SE, 127, &periph_v_regs, 0, se), | ||
1485 | TEGRA_INIT_DATA_MUX("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect), | ||
1486 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllpcm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), | ||
1487 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllpcm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), | ||
1488 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllpcm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), | ||
1489 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllpcm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), | ||
1490 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllpcm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), | ||
1491 | TEGRA_INIT_DATA_MUX("cve", NULL, "cve", mux_pllpdc_clkm, CLK_SOURCE_CVE, 49, &periph_h_regs, 0, cve), | ||
1492 | TEGRA_INIT_DATA_MUX("tvo", NULL, "tvo", mux_pllpdc_clkm, CLK_SOURCE_TVO, 49, &periph_h_regs, 0, tvo), | ||
1493 | TEGRA_INIT_DATA_MUX("tvdac", NULL, "tvdac", mux_pllpdc_clkm, CLK_SOURCE_TVDAC, 53, &periph_h_regs, 0, tvdac), | ||
1494 | TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllpc_clk32k_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon), | ||
1495 | TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllmcpa, CLK_SOURCE_VI_SENSOR, 20, &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor), | ||
1496 | TEGRA_INIT_DATA_DIV16("i2c1", "div-clk", "tegra-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2c1), | ||
1497 | TEGRA_INIT_DATA_DIV16("i2c2", "div-clk", "tegra-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c2), | ||
1498 | TEGRA_INIT_DATA_DIV16("i2c3", "div-clk", "tegra-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2c3), | ||
1499 | TEGRA_INIT_DATA_DIV16("i2c4", "div-clk", "tegra-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2c4), | ||
1500 | TEGRA_INIT_DATA_DIV16("i2c5", "div-clk", "tegra-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c5), | ||
1501 | TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllpcm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta), | ||
1502 | TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllpcm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb), | ||
1503 | TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllpcm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc), | ||
1504 | TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllpcm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd), | ||
1505 | TEGRA_INIT_DATA_UART("uarte", NULL, "tegra_uart.4", mux_pllpcm_clkm, CLK_SOURCE_UARTE, 66, &periph_u_regs, uarte), | ||
1506 | TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllpmdacd2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), | ||
1507 | TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1), | ||
1508 | TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2), | ||
1509 | TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3), | ||
1510 | TEGRA_INIT_DATA("pwm", NULL, "pwm", mux_pllpc_clk32k_clkm, CLK_SOURCE_PWM, 28, 2, 0, 0, 8, 1, 0, &periph_l_regs, 17, periph_clk_enb_refcnt, 0, pwm), | ||
1511 | }; | 1125 | }; |
1512 | 1126 | ||
1513 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { | 1127 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { |
1514 | TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllpmdacd2_clkm, CLK_SOURCE_DISP1, 29, 3, 27, &periph_l_regs, 0, disp1), | 1128 | TEGRA_INIT_DATA_NODIV("dsib", mux_plld_out0_plld2_out0, CLK_SOURCE_DSIB, 25, 1, 82, 0, TEGRA30_CLK_DSIB), |
1515 | TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllpmdacd2_clkm, CLK_SOURCE_DISP2, 29, 3, 26, &periph_l_regs, 0, disp2), | ||
1516 | TEGRA_INIT_DATA_NODIV("dsib", NULL, "tegradc.1", mux_plld_out0_plld2_out0, CLK_SOURCE_DSIB, 25, 1, 82, &periph_u_regs, 0, dsib), | ||
1517 | }; | 1129 | }; |
1518 | 1130 | ||
1519 | static void __init tegra30_periph_clk_init(void) | 1131 | static void __init tegra30_periph_clk_init(void) |
@@ -1522,170 +1134,20 @@ static void __init tegra30_periph_clk_init(void) | |||
1522 | struct clk *clk; | 1134 | struct clk *clk; |
1523 | int i; | 1135 | int i; |
1524 | 1136 | ||
1525 | /* apbdma */ | ||
1526 | clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, 0, 34, | ||
1527 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1528 | clk_register_clkdev(clk, NULL, "tegra-apbdma"); | ||
1529 | clks[apbdma] = clk; | ||
1530 | |||
1531 | /* rtc */ | ||
1532 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", | ||
1533 | TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB, | ||
1534 | clk_base, 0, 4, &periph_l_regs, | ||
1535 | periph_clk_enb_refcnt); | ||
1536 | clk_register_clkdev(clk, NULL, "rtc-tegra"); | ||
1537 | clks[rtc] = clk; | ||
1538 | |||
1539 | /* timer */ | ||
1540 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, 0, | ||
1541 | 5, &periph_l_regs, periph_clk_enb_refcnt); | ||
1542 | clk_register_clkdev(clk, NULL, "timer"); | ||
1543 | clks[timer] = clk; | ||
1544 | |||
1545 | /* kbc */ | ||
1546 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", | ||
1547 | TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB, | ||
1548 | clk_base, 0, 36, &periph_h_regs, | ||
1549 | periph_clk_enb_refcnt); | ||
1550 | clk_register_clkdev(clk, NULL, "tegra-kbc"); | ||
1551 | clks[kbc] = clk; | ||
1552 | |||
1553 | /* csus */ | ||
1554 | clk = tegra_clk_register_periph_gate("csus", "clk_m", | ||
1555 | TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB, | ||
1556 | clk_base, 0, 92, &periph_u_regs, | ||
1557 | periph_clk_enb_refcnt); | ||
1558 | clk_register_clkdev(clk, "csus", "tengra_camera"); | ||
1559 | clks[csus] = clk; | ||
1560 | |||
1561 | /* vcp */ | ||
1562 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, 29, | ||
1563 | &periph_l_regs, periph_clk_enb_refcnt); | ||
1564 | clk_register_clkdev(clk, "vcp", "tegra-avp"); | ||
1565 | clks[vcp] = clk; | ||
1566 | |||
1567 | /* bsea */ | ||
1568 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, 0, | ||
1569 | 62, &periph_h_regs, periph_clk_enb_refcnt); | ||
1570 | clk_register_clkdev(clk, "bsea", "tegra-avp"); | ||
1571 | clks[bsea] = clk; | ||
1572 | |||
1573 | /* bsev */ | ||
1574 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, 0, | ||
1575 | 63, &periph_h_regs, periph_clk_enb_refcnt); | ||
1576 | clk_register_clkdev(clk, "bsev", "tegra-aes"); | ||
1577 | clks[bsev] = clk; | ||
1578 | |||
1579 | /* usbd */ | ||
1580 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, 0, | ||
1581 | 22, &periph_l_regs, periph_clk_enb_refcnt); | ||
1582 | clk_register_clkdev(clk, NULL, "fsl-tegra-udc"); | ||
1583 | clks[usbd] = clk; | ||
1584 | |||
1585 | /* usb2 */ | ||
1586 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, 0, | ||
1587 | 58, &periph_h_regs, periph_clk_enb_refcnt); | ||
1588 | clk_register_clkdev(clk, NULL, "tegra-ehci.1"); | ||
1589 | clks[usb2] = clk; | ||
1590 | |||
1591 | /* usb3 */ | ||
1592 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, 0, | ||
1593 | 59, &periph_h_regs, periph_clk_enb_refcnt); | ||
1594 | clk_register_clkdev(clk, NULL, "tegra-ehci.2"); | ||
1595 | clks[usb3] = clk; | ||
1596 | |||
1597 | /* dsia */ | 1137 | /* dsia */ |
1598 | clk = tegra_clk_register_periph_gate("dsia", "pll_d_out0", 0, clk_base, | 1138 | clk = tegra_clk_register_periph_gate("dsia", "pll_d_out0", 0, clk_base, |
1599 | 0, 48, &periph_h_regs, | 1139 | 0, 48, periph_clk_enb_refcnt); |
1600 | periph_clk_enb_refcnt); | 1140 | clks[TEGRA30_CLK_DSIA] = clk; |
1601 | clk_register_clkdev(clk, "dsia", "tegradc.0"); | ||
1602 | clks[dsia] = clk; | ||
1603 | |||
1604 | /* csi */ | ||
1605 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, | ||
1606 | 0, 52, &periph_h_regs, | ||
1607 | periph_clk_enb_refcnt); | ||
1608 | clk_register_clkdev(clk, "csi", "tegra_camera"); | ||
1609 | clks[csi] = clk; | ||
1610 | |||
1611 | /* isp */ | ||
1612 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, 23, | ||
1613 | &periph_l_regs, periph_clk_enb_refcnt); | ||
1614 | clk_register_clkdev(clk, "isp", "tegra_camera"); | ||
1615 | clks[isp] = clk; | ||
1616 | 1141 | ||
1617 | /* pcie */ | 1142 | /* pcie */ |
1618 | clk = tegra_clk_register_periph_gate("pcie", "clk_m", 0, clk_base, 0, | 1143 | clk = tegra_clk_register_periph_gate("pcie", "clk_m", 0, clk_base, 0, |
1619 | 70, &periph_u_regs, periph_clk_enb_refcnt); | 1144 | 70, periph_clk_enb_refcnt); |
1620 | clk_register_clkdev(clk, "pcie", "tegra-pcie"); | 1145 | clks[TEGRA30_CLK_PCIE] = clk; |
1621 | clks[pcie] = clk; | ||
1622 | 1146 | ||
1623 | /* afi */ | 1147 | /* afi */ |
1624 | clk = tegra_clk_register_periph_gate("afi", "clk_m", 0, clk_base, 0, 72, | 1148 | clk = tegra_clk_register_periph_gate("afi", "clk_m", 0, clk_base, 0, 72, |
1625 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1626 | clk_register_clkdev(clk, "afi", "tegra-pcie"); | ||
1627 | clks[afi] = clk; | ||
1628 | |||
1629 | /* pciex */ | ||
1630 | clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0, | ||
1631 | 74, &periph_u_regs, periph_clk_enb_refcnt); | ||
1632 | clk_register_clkdev(clk, "pciex", "tegra-pcie"); | ||
1633 | clks[pciex] = clk; | ||
1634 | |||
1635 | /* kfuse */ | ||
1636 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | ||
1637 | TEGRA_PERIPH_ON_APB, | ||
1638 | clk_base, 0, 40, &periph_h_regs, | ||
1639 | periph_clk_enb_refcnt); | ||
1640 | clk_register_clkdev(clk, NULL, "kfuse-tegra"); | ||
1641 | clks[kfuse] = clk; | ||
1642 | |||
1643 | /* fuse */ | ||
1644 | clk = tegra_clk_register_periph_gate("fuse", "clk_m", | ||
1645 | TEGRA_PERIPH_ON_APB, | ||
1646 | clk_base, 0, 39, &periph_h_regs, | ||
1647 | periph_clk_enb_refcnt); | ||
1648 | clk_register_clkdev(clk, "fuse", "fuse-tegra"); | ||
1649 | clks[fuse] = clk; | ||
1650 | |||
1651 | /* fuse_burn */ | ||
1652 | clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", | ||
1653 | TEGRA_PERIPH_ON_APB, | ||
1654 | clk_base, 0, 39, &periph_h_regs, | ||
1655 | periph_clk_enb_refcnt); | 1149 | periph_clk_enb_refcnt); |
1656 | clk_register_clkdev(clk, "fuse_burn", "fuse-tegra"); | 1150 | clks[TEGRA30_CLK_AFI] = clk; |
1657 | clks[fuse_burn] = clk; | ||
1658 | |||
1659 | /* apbif */ | ||
1660 | clk = tegra_clk_register_periph_gate("apbif", "clk_m", 0, | ||
1661 | clk_base, 0, 107, &periph_v_regs, | ||
1662 | periph_clk_enb_refcnt); | ||
1663 | clk_register_clkdev(clk, "apbif", "tegra30-ahub"); | ||
1664 | clks[apbif] = clk; | ||
1665 | |||
1666 | /* hda2hdmi */ | ||
1667 | clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", | ||
1668 | TEGRA_PERIPH_ON_APB, | ||
1669 | clk_base, 0, 128, &periph_w_regs, | ||
1670 | periph_clk_enb_refcnt); | ||
1671 | clk_register_clkdev(clk, "hda2hdmi", "tegra30-hda"); | ||
1672 | clks[hda2hdmi] = clk; | ||
1673 | |||
1674 | /* sata_cold */ | ||
1675 | clk = tegra_clk_register_periph_gate("sata_cold", "clk_m", | ||
1676 | TEGRA_PERIPH_ON_APB, | ||
1677 | clk_base, 0, 129, &periph_w_regs, | ||
1678 | periph_clk_enb_refcnt); | ||
1679 | clk_register_clkdev(clk, NULL, "tegra_sata_cold"); | ||
1680 | clks[sata_cold] = clk; | ||
1681 | |||
1682 | /* dtv */ | ||
1683 | clk = tegra_clk_register_periph_gate("dtv", "clk_m", | ||
1684 | TEGRA_PERIPH_ON_APB, | ||
1685 | clk_base, 0, 79, &periph_u_regs, | ||
1686 | periph_clk_enb_refcnt); | ||
1687 | clk_register_clkdev(clk, NULL, "dtv"); | ||
1688 | clks[dtv] = clk; | ||
1689 | 1151 | ||
1690 | /* emc */ | 1152 | /* emc */ |
1691 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | 1153 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, |
@@ -1694,84 +1156,37 @@ static void __init tegra30_periph_clk_init(void) | |||
1694 | clk_base + CLK_SOURCE_EMC, | 1156 | clk_base + CLK_SOURCE_EMC, |
1695 | 30, 2, 0, NULL); | 1157 | 30, 2, 0, NULL); |
1696 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0, | 1158 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0, |
1697 | 57, &periph_h_regs, periph_clk_enb_refcnt); | 1159 | 57, periph_clk_enb_refcnt); |
1698 | clk_register_clkdev(clk, "emc", NULL); | 1160 | clks[TEGRA30_CLK_EMC] = clk; |
1699 | clks[emc] = clk; | 1161 | |
1162 | /* cml0 */ | ||
1163 | clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX, | ||
1164 | 0, 0, &cml_lock); | ||
1165 | clks[TEGRA30_CLK_CML0] = clk; | ||
1166 | |||
1167 | /* cml1 */ | ||
1168 | clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX, | ||
1169 | 1, 0, &cml_lock); | ||
1170 | clks[TEGRA30_CLK_CML1] = clk; | ||
1700 | 1171 | ||
1701 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { | 1172 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { |
1702 | data = &tegra_periph_clk_list[i]; | 1173 | data = &tegra_periph_clk_list[i]; |
1703 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 1174 | clk = tegra_clk_register_periph(data->name, data->p.parent_names, |
1704 | data->num_parents, &data->periph, | 1175 | data->num_parents, &data->periph, |
1705 | clk_base, data->offset, data->flags); | 1176 | clk_base, data->offset, data->flags); |
1706 | clk_register_clkdev(clk, data->con_id, data->dev_id); | ||
1707 | clks[data->clk_id] = clk; | 1177 | clks[data->clk_id] = clk; |
1708 | } | 1178 | } |
1709 | 1179 | ||
1710 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { | 1180 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { |
1711 | data = &tegra_periph_nodiv_clk_list[i]; | 1181 | data = &tegra_periph_nodiv_clk_list[i]; |
1712 | clk = tegra_clk_register_periph_nodiv(data->name, | 1182 | clk = tegra_clk_register_periph_nodiv(data->name, |
1713 | data->parent_names, | 1183 | data->p.parent_names, |
1714 | data->num_parents, &data->periph, | 1184 | data->num_parents, &data->periph, |
1715 | clk_base, data->offset); | 1185 | clk_base, data->offset); |
1716 | clk_register_clkdev(clk, data->con_id, data->dev_id); | ||
1717 | clks[data->clk_id] = clk; | 1186 | clks[data->clk_id] = clk; |
1718 | } | 1187 | } |
1719 | } | ||
1720 | |||
1721 | static void __init tegra30_fixed_clk_init(void) | ||
1722 | { | ||
1723 | struct clk *clk; | ||
1724 | |||
1725 | /* clk_32k */ | ||
1726 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, | ||
1727 | 32768); | ||
1728 | clk_register_clkdev(clk, "clk_32k", NULL); | ||
1729 | clks[clk_32k] = clk; | ||
1730 | 1188 | ||
1731 | /* clk_m_div2 */ | 1189 | tegra_periph_clk_init(clk_base, pmc_base, tegra30_clks, &pll_p_params); |
1732 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", | ||
1733 | CLK_SET_RATE_PARENT, 1, 2); | ||
1734 | clk_register_clkdev(clk, "clk_m_div2", NULL); | ||
1735 | clks[clk_m_div2] = clk; | ||
1736 | |||
1737 | /* clk_m_div4 */ | ||
1738 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", | ||
1739 | CLK_SET_RATE_PARENT, 1, 4); | ||
1740 | clk_register_clkdev(clk, "clk_m_div4", NULL); | ||
1741 | clks[clk_m_div4] = clk; | ||
1742 | |||
1743 | /* cml0 */ | ||
1744 | clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX, | ||
1745 | 0, 0, &cml_lock); | ||
1746 | clk_register_clkdev(clk, "cml0", NULL); | ||
1747 | clks[cml0] = clk; | ||
1748 | |||
1749 | /* cml1 */ | ||
1750 | clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX, | ||
1751 | 1, 0, &cml_lock); | ||
1752 | clk_register_clkdev(clk, "cml1", NULL); | ||
1753 | clks[cml1] = clk; | ||
1754 | } | ||
1755 | |||
1756 | static void __init tegra30_osc_clk_init(void) | ||
1757 | { | ||
1758 | struct clk *clk; | ||
1759 | unsigned int pll_ref_div; | ||
1760 | |||
1761 | tegra30_clk_measure_input_freq(); | ||
1762 | |||
1763 | /* clk_m */ | ||
1764 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, | ||
1765 | input_freq); | ||
1766 | clk_register_clkdev(clk, "clk_m", NULL); | ||
1767 | clks[clk_m] = clk; | ||
1768 | |||
1769 | /* pll_ref */ | ||
1770 | pll_ref_div = tegra30_get_pll_ref_div(); | ||
1771 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | ||
1772 | CLK_SET_RATE_PARENT, 1, pll_ref_div); | ||
1773 | clk_register_clkdev(clk, "pll_ref", NULL); | ||
1774 | clks[pll_ref] = clk; | ||
1775 | } | 1190 | } |
1776 | 1191 | ||
1777 | /* Tegra30 CPU clock and reset control functions */ | 1192 | /* Tegra30 CPU clock and reset control functions */ |
@@ -1913,48 +1328,49 @@ static struct tegra_cpu_car_ops tegra30_cpu_car_ops = { | |||
1913 | }; | 1328 | }; |
1914 | 1329 | ||
1915 | static struct tegra_clk_init_table init_table[] __initdata = { | 1330 | static struct tegra_clk_init_table init_table[] __initdata = { |
1916 | {uarta, pll_p, 408000000, 0}, | 1331 | {TEGRA30_CLK_UARTA, TEGRA30_CLK_PLL_P, 408000000, 0}, |
1917 | {uartb, pll_p, 408000000, 0}, | 1332 | {TEGRA30_CLK_UARTB, TEGRA30_CLK_PLL_P, 408000000, 0}, |
1918 | {uartc, pll_p, 408000000, 0}, | 1333 | {TEGRA30_CLK_UARTC, TEGRA30_CLK_PLL_P, 408000000, 0}, |
1919 | {uartd, pll_p, 408000000, 0}, | 1334 | {TEGRA30_CLK_UARTD, TEGRA30_CLK_PLL_P, 408000000, 0}, |
1920 | {uarte, pll_p, 408000000, 0}, | 1335 | {TEGRA30_CLK_UARTE, TEGRA30_CLK_PLL_P, 408000000, 0}, |
1921 | {pll_a, clk_max, 564480000, 1}, | 1336 | {TEGRA30_CLK_PLL_A, TEGRA30_CLK_CLK_MAX, 564480000, 1}, |
1922 | {pll_a_out0, clk_max, 11289600, 1}, | 1337 | {TEGRA30_CLK_PLL_A_OUT0, TEGRA30_CLK_CLK_MAX, 11289600, 1}, |
1923 | {extern1, pll_a_out0, 0, 1}, | 1338 | {TEGRA30_CLK_EXTERN1, TEGRA30_CLK_PLL_A_OUT0, 0, 1}, |
1924 | {clk_out_1_mux, extern1, 0, 0}, | 1339 | {TEGRA30_CLK_CLK_OUT_1_MUX, TEGRA30_CLK_EXTERN1, 0, 0}, |
1925 | {clk_out_1, clk_max, 0, 1}, | 1340 | {TEGRA30_CLK_CLK_OUT_1, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1926 | {blink, clk_max, 0, 1}, | 1341 | {TEGRA30_CLK_BLINK, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1927 | {i2s0, pll_a_out0, 11289600, 0}, | 1342 | {TEGRA30_CLK_I2S0, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0}, |
1928 | {i2s1, pll_a_out0, 11289600, 0}, | 1343 | {TEGRA30_CLK_I2S1, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0}, |
1929 | {i2s2, pll_a_out0, 11289600, 0}, | 1344 | {TEGRA30_CLK_I2S2, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0}, |
1930 | {i2s3, pll_a_out0, 11289600, 0}, | 1345 | {TEGRA30_CLK_I2S3, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0}, |
1931 | {i2s4, pll_a_out0, 11289600, 0}, | 1346 | {TEGRA30_CLK_I2S4, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0}, |
1932 | {sdmmc1, pll_p, 48000000, 0}, | 1347 | {TEGRA30_CLK_SDMMC1, TEGRA30_CLK_PLL_P, 48000000, 0}, |
1933 | {sdmmc2, pll_p, 48000000, 0}, | 1348 | {TEGRA30_CLK_SDMMC2, TEGRA30_CLK_PLL_P, 48000000, 0}, |
1934 | {sdmmc3, pll_p, 48000000, 0}, | 1349 | {TEGRA30_CLK_SDMMC3, TEGRA30_CLK_PLL_P, 48000000, 0}, |
1935 | {pll_m, clk_max, 0, 1}, | 1350 | {TEGRA30_CLK_PLL_M, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1936 | {pclk, clk_max, 0, 1}, | 1351 | {TEGRA30_CLK_PCLK, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1937 | {csite, clk_max, 0, 1}, | 1352 | {TEGRA30_CLK_CSITE, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1938 | {emc, clk_max, 0, 1}, | 1353 | {TEGRA30_CLK_EMC, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1939 | {mselect, clk_max, 0, 1}, | 1354 | {TEGRA30_CLK_MSELECT, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1940 | {sbc1, pll_p, 100000000, 0}, | 1355 | {TEGRA30_CLK_SBC1, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1941 | {sbc2, pll_p, 100000000, 0}, | 1356 | {TEGRA30_CLK_SBC2, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1942 | {sbc3, pll_p, 100000000, 0}, | 1357 | {TEGRA30_CLK_SBC3, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1943 | {sbc4, pll_p, 100000000, 0}, | 1358 | {TEGRA30_CLK_SBC4, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1944 | {sbc5, pll_p, 100000000, 0}, | 1359 | {TEGRA30_CLK_SBC5, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1945 | {sbc6, pll_p, 100000000, 0}, | 1360 | {TEGRA30_CLK_SBC6, TEGRA30_CLK_PLL_P, 100000000, 0}, |
1946 | {host1x, pll_c, 150000000, 0}, | 1361 | {TEGRA30_CLK_HOST1X, TEGRA30_CLK_PLL_C, 150000000, 0}, |
1947 | {disp1, pll_p, 600000000, 0}, | 1362 | {TEGRA30_CLK_DISP1, TEGRA30_CLK_PLL_P, 600000000, 0}, |
1948 | {disp2, pll_p, 600000000, 0}, | 1363 | {TEGRA30_CLK_DISP2, TEGRA30_CLK_PLL_P, 600000000, 0}, |
1949 | {twd, clk_max, 0, 1}, | 1364 | {TEGRA30_CLK_TWD, TEGRA30_CLK_CLK_MAX, 0, 1}, |
1950 | {gr2d, pll_c, 300000000, 0}, | 1365 | {TEGRA30_CLK_GR2D, TEGRA30_CLK_PLL_C, 300000000, 0}, |
1951 | {gr3d, pll_c, 300000000, 0}, | 1366 | {TEGRA30_CLK_GR3D, TEGRA30_CLK_PLL_C, 300000000, 0}, |
1952 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | 1367 | {TEGRA30_CLK_GR3D2, TEGRA30_CLK_PLL_C, 300000000, 0}, |
1368 | {TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0}, /* This MUST be the last entry. */ | ||
1953 | }; | 1369 | }; |
1954 | 1370 | ||
1955 | static void __init tegra30_clock_apply_init_table(void) | 1371 | static void __init tegra30_clock_apply_init_table(void) |
1956 | { | 1372 | { |
1957 | tegra_init_from_table(init_table, clks, clk_max); | 1373 | tegra_init_from_table(init_table, clks, TEGRA30_CLK_CLK_MAX); |
1958 | } | 1374 | } |
1959 | 1375 | ||
1960 | /* | 1376 | /* |
@@ -1963,19 +1379,18 @@ static void __init tegra30_clock_apply_init_table(void) | |||
1963 | * table under two names. | 1379 | * table under two names. |
1964 | */ | 1380 | */ |
1965 | static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | 1381 | static struct tegra_clk_duplicate tegra_clk_duplicates[] = { |
1966 | TEGRA_CLK_DUPLICATE(usbd, "utmip-pad", NULL), | 1382 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "utmip-pad", NULL), |
1967 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), | 1383 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "tegra-ehci.0", NULL), |
1968 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), | 1384 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "tegra-otg", NULL), |
1969 | TEGRA_CLK_DUPLICATE(bsev, "tegra-avp", "bsev"), | 1385 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEV, "tegra-avp", "bsev"), |
1970 | TEGRA_CLK_DUPLICATE(bsev, "nvavp", "bsev"), | 1386 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEV, "nvavp", "bsev"), |
1971 | TEGRA_CLK_DUPLICATE(vde, "tegra-aes", "vde"), | 1387 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_VDE, "tegra-aes", "vde"), |
1972 | TEGRA_CLK_DUPLICATE(bsea, "tegra-aes", "bsea"), | 1388 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEA, "tegra-aes", "bsea"), |
1973 | TEGRA_CLK_DUPLICATE(bsea, "nvavp", "bsea"), | 1389 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEA, "nvavp", "bsea"), |
1974 | TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), | 1390 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CML1, "tegra_sata_cml", NULL), |
1975 | TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), | 1391 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CML0, "tegra_pcie", "cml"), |
1976 | TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), | 1392 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_VCP, "nvavp", "vcp"), |
1977 | TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), | 1393 | TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CLK_MAX, NULL, NULL), /* MUST be the last entry */ |
1978 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ | ||
1979 | }; | 1394 | }; |
1980 | 1395 | ||
1981 | static const struct of_device_id pmc_match[] __initconst = { | 1396 | static const struct of_device_id pmc_match[] __initconst = { |
@@ -1986,7 +1401,6 @@ static const struct of_device_id pmc_match[] __initconst = { | |||
1986 | static void __init tegra30_clock_init(struct device_node *np) | 1401 | static void __init tegra30_clock_init(struct device_node *np) |
1987 | { | 1402 | { |
1988 | struct device_node *node; | 1403 | struct device_node *node; |
1989 | int i; | ||
1990 | 1404 | ||
1991 | clk_base = of_iomap(np, 0); | 1405 | clk_base = of_iomap(np, 0); |
1992 | if (!clk_base) { | 1406 | if (!clk_base) { |
@@ -2006,29 +1420,27 @@ static void __init tegra30_clock_init(struct device_node *np) | |||
2006 | BUG(); | 1420 | BUG(); |
2007 | } | 1421 | } |
2008 | 1422 | ||
2009 | tegra30_osc_clk_init(); | 1423 | clks = tegra_clk_init(clk_base, TEGRA30_CLK_CLK_MAX, |
2010 | tegra30_fixed_clk_init(); | 1424 | TEGRA30_CLK_PERIPH_BANKS); |
1425 | if (!clks) | ||
1426 | return; | ||
1427 | |||
1428 | if (tegra_osc_clk_init(clk_base, tegra30_clks, tegra30_input_freq, | ||
1429 | ARRAY_SIZE(tegra30_input_freq), &input_freq, NULL) < 0) | ||
1430 | return; | ||
1431 | |||
1432 | |||
1433 | tegra_fixed_clk_init(tegra30_clks); | ||
2011 | tegra30_pll_init(); | 1434 | tegra30_pll_init(); |
2012 | tegra30_super_clk_init(); | 1435 | tegra30_super_clk_init(); |
2013 | tegra30_periph_clk_init(); | 1436 | tegra30_periph_clk_init(); |
2014 | tegra30_audio_clk_init(); | 1437 | tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks, &pll_a_params); |
2015 | tegra30_pmc_clk_init(); | 1438 | tegra_pmc_clk_init(pmc_base, tegra30_clks); |
2016 | |||
2017 | for (i = 0; i < ARRAY_SIZE(clks); i++) { | ||
2018 | if (IS_ERR(clks[i])) { | ||
2019 | pr_err("Tegra30 clk %d: register failed with %ld\n", | ||
2020 | i, PTR_ERR(clks[i])); | ||
2021 | BUG(); | ||
2022 | } | ||
2023 | if (!clks[i]) | ||
2024 | clks[i] = ERR_PTR(-EINVAL); | ||
2025 | } | ||
2026 | 1439 | ||
2027 | tegra_init_dup_clks(tegra_clk_duplicates, clks, clk_max); | 1440 | tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA30_CLK_CLK_MAX); |
2028 | 1441 | ||
2029 | clk_data.clks = clks; | 1442 | tegra_add_of_provider(np); |
2030 | clk_data.clk_num = ARRAY_SIZE(clks); | 1443 | tegra_register_devclks(devclks, ARRAY_SIZE(devclks)); |
2031 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
2032 | 1444 | ||
2033 | tegra_clk_apply_init_table = tegra30_clock_apply_init_table; | 1445 | tegra_clk_apply_init_table = tegra30_clock_apply_init_table; |
2034 | 1446 | ||
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index 86581ac1fd69..c0a7d7723510 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c | |||
@@ -18,13 +18,175 @@ | |||
18 | #include <linux/clk-provider.h> | 18 | #include <linux/clk-provider.h> |
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/clk/tegra.h> | 20 | #include <linux/clk/tegra.h> |
21 | #include <linux/reset-controller.h> | ||
22 | #include <linux/tegra-soc.h> | ||
21 | 23 | ||
22 | #include "clk.h" | 24 | #include "clk.h" |
23 | 25 | ||
26 | #define CLK_OUT_ENB_L 0x010 | ||
27 | #define CLK_OUT_ENB_H 0x014 | ||
28 | #define CLK_OUT_ENB_U 0x018 | ||
29 | #define CLK_OUT_ENB_V 0x360 | ||
30 | #define CLK_OUT_ENB_W 0x364 | ||
31 | #define CLK_OUT_ENB_X 0x280 | ||
32 | #define CLK_OUT_ENB_SET_L 0x320 | ||
33 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
34 | #define CLK_OUT_ENB_SET_H 0x328 | ||
35 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
36 | #define CLK_OUT_ENB_SET_U 0x330 | ||
37 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
38 | #define CLK_OUT_ENB_SET_V 0x440 | ||
39 | #define CLK_OUT_ENB_CLR_V 0x444 | ||
40 | #define CLK_OUT_ENB_SET_W 0x448 | ||
41 | #define CLK_OUT_ENB_CLR_W 0x44c | ||
42 | #define CLK_OUT_ENB_SET_X 0x284 | ||
43 | #define CLK_OUT_ENB_CLR_X 0x288 | ||
44 | |||
45 | #define RST_DEVICES_L 0x004 | ||
46 | #define RST_DEVICES_H 0x008 | ||
47 | #define RST_DEVICES_U 0x00C | ||
48 | #define RST_DFLL_DVCO 0x2F4 | ||
49 | #define RST_DEVICES_V 0x358 | ||
50 | #define RST_DEVICES_W 0x35C | ||
51 | #define RST_DEVICES_X 0x28C | ||
52 | #define RST_DEVICES_SET_L 0x300 | ||
53 | #define RST_DEVICES_CLR_L 0x304 | ||
54 | #define RST_DEVICES_SET_H 0x308 | ||
55 | #define RST_DEVICES_CLR_H 0x30c | ||
56 | #define RST_DEVICES_SET_U 0x310 | ||
57 | #define RST_DEVICES_CLR_U 0x314 | ||
58 | #define RST_DEVICES_SET_V 0x430 | ||
59 | #define RST_DEVICES_CLR_V 0x434 | ||
60 | #define RST_DEVICES_SET_W 0x438 | ||
61 | #define RST_DEVICES_CLR_W 0x43c | ||
62 | #define RST_DEVICES_SET_X 0x290 | ||
63 | #define RST_DEVICES_CLR_X 0x294 | ||
64 | |||
24 | /* Global data of Tegra CPU CAR ops */ | 65 | /* Global data of Tegra CPU CAR ops */ |
25 | static struct tegra_cpu_car_ops dummy_car_ops; | 66 | static struct tegra_cpu_car_ops dummy_car_ops; |
26 | struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; | 67 | struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; |
27 | 68 | ||
69 | int *periph_clk_enb_refcnt; | ||
70 | static int periph_banks; | ||
71 | static struct clk **clks; | ||
72 | static int clk_num; | ||
73 | static struct clk_onecell_data clk_data; | ||
74 | |||
75 | static struct tegra_clk_periph_regs periph_regs[] = { | ||
76 | [0] = { | ||
77 | .enb_reg = CLK_OUT_ENB_L, | ||
78 | .enb_set_reg = CLK_OUT_ENB_SET_L, | ||
79 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | ||
80 | .rst_reg = RST_DEVICES_L, | ||
81 | .rst_set_reg = RST_DEVICES_SET_L, | ||
82 | .rst_clr_reg = RST_DEVICES_CLR_L, | ||
83 | }, | ||
84 | [1] = { | ||
85 | .enb_reg = CLK_OUT_ENB_H, | ||
86 | .enb_set_reg = CLK_OUT_ENB_SET_H, | ||
87 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | ||
88 | .rst_reg = RST_DEVICES_H, | ||
89 | .rst_set_reg = RST_DEVICES_SET_H, | ||
90 | .rst_clr_reg = RST_DEVICES_CLR_H, | ||
91 | }, | ||
92 | [2] = { | ||
93 | .enb_reg = CLK_OUT_ENB_U, | ||
94 | .enb_set_reg = CLK_OUT_ENB_SET_U, | ||
95 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | ||
96 | .rst_reg = RST_DEVICES_U, | ||
97 | .rst_set_reg = RST_DEVICES_SET_U, | ||
98 | .rst_clr_reg = RST_DEVICES_CLR_U, | ||
99 | }, | ||
100 | [3] = { | ||
101 | .enb_reg = CLK_OUT_ENB_V, | ||
102 | .enb_set_reg = CLK_OUT_ENB_SET_V, | ||
103 | .enb_clr_reg = CLK_OUT_ENB_CLR_V, | ||
104 | .rst_reg = RST_DEVICES_V, | ||
105 | .rst_set_reg = RST_DEVICES_SET_V, | ||
106 | .rst_clr_reg = RST_DEVICES_CLR_V, | ||
107 | }, | ||
108 | [4] = { | ||
109 | .enb_reg = CLK_OUT_ENB_W, | ||
110 | .enb_set_reg = CLK_OUT_ENB_SET_W, | ||
111 | .enb_clr_reg = CLK_OUT_ENB_CLR_W, | ||
112 | .rst_reg = RST_DEVICES_W, | ||
113 | .rst_set_reg = RST_DEVICES_SET_W, | ||
114 | .rst_clr_reg = RST_DEVICES_CLR_W, | ||
115 | }, | ||
116 | [5] = { | ||
117 | .enb_reg = CLK_OUT_ENB_X, | ||
118 | .enb_set_reg = CLK_OUT_ENB_SET_X, | ||
119 | .enb_clr_reg = CLK_OUT_ENB_CLR_X, | ||
120 | .rst_reg = RST_DEVICES_X, | ||
121 | .rst_set_reg = RST_DEVICES_SET_X, | ||
122 | .rst_clr_reg = RST_DEVICES_CLR_X, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | static void __iomem *clk_base; | ||
127 | |||
128 | static int tegra_clk_rst_assert(struct reset_controller_dev *rcdev, | ||
129 | unsigned long id) | ||
130 | { | ||
131 | /* | ||
132 | * If peripheral is on the APB bus then we must read the APB bus to | ||
133 | * flush the write operation in apb bus. This will avoid peripheral | ||
134 | * access after disabling clock. Since the reset driver has no | ||
135 | * knowledge of which reset IDs represent which devices, simply do | ||
136 | * this all the time. | ||
137 | */ | ||
138 | tegra_read_chipid(); | ||
139 | |||
140 | writel_relaxed(BIT(id % 32), | ||
141 | clk_base + periph_regs[id / 32].rst_set_reg); | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static int tegra_clk_rst_deassert(struct reset_controller_dev *rcdev, | ||
147 | unsigned long id) | ||
148 | { | ||
149 | writel_relaxed(BIT(id % 32), | ||
150 | clk_base + periph_regs[id / 32].rst_clr_reg); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | struct tegra_clk_periph_regs *get_reg_bank(int clkid) | ||
156 | { | ||
157 | int reg_bank = clkid / 32; | ||
158 | |||
159 | if (reg_bank < periph_banks) | ||
160 | return &periph_regs[reg_bank]; | ||
161 | else { | ||
162 | WARN_ON(1); | ||
163 | return NULL; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks) | ||
168 | { | ||
169 | clk_base = regs; | ||
170 | |||
171 | if (WARN_ON(banks > ARRAY_SIZE(periph_regs))) | ||
172 | return NULL; | ||
173 | |||
174 | periph_clk_enb_refcnt = kzalloc(32 * banks * | ||
175 | sizeof(*periph_clk_enb_refcnt), GFP_KERNEL); | ||
176 | if (!periph_clk_enb_refcnt) | ||
177 | return NULL; | ||
178 | |||
179 | periph_banks = banks; | ||
180 | |||
181 | clks = kzalloc(num * sizeof(struct clk *), GFP_KERNEL); | ||
182 | if (!clks) | ||
183 | kfree(periph_clk_enb_refcnt); | ||
184 | |||
185 | clk_num = num; | ||
186 | |||
187 | return clks; | ||
188 | } | ||
189 | |||
28 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, | 190 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, |
29 | struct clk *clks[], int clk_max) | 191 | struct clk *clks[], int clk_max) |
30 | { | 192 | { |
@@ -74,6 +236,58 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, | |||
74 | } | 236 | } |
75 | } | 237 | } |
76 | 238 | ||
239 | static struct reset_control_ops rst_ops = { | ||
240 | .assert = tegra_clk_rst_assert, | ||
241 | .deassert = tegra_clk_rst_deassert, | ||
242 | }; | ||
243 | |||
244 | static struct reset_controller_dev rst_ctlr = { | ||
245 | .ops = &rst_ops, | ||
246 | .owner = THIS_MODULE, | ||
247 | .of_reset_n_cells = 1, | ||
248 | }; | ||
249 | |||
250 | void __init tegra_add_of_provider(struct device_node *np) | ||
251 | { | ||
252 | int i; | ||
253 | |||
254 | for (i = 0; i < clk_num; i++) { | ||
255 | if (IS_ERR(clks[i])) { | ||
256 | pr_err | ||
257 | ("Tegra clk %d: register failed with %ld\n", | ||
258 | i, PTR_ERR(clks[i])); | ||
259 | } | ||
260 | if (!clks[i]) | ||
261 | clks[i] = ERR_PTR(-EINVAL); | ||
262 | } | ||
263 | |||
264 | clk_data.clks = clks; | ||
265 | clk_data.clk_num = clk_num; | ||
266 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
267 | |||
268 | rst_ctlr.of_node = np; | ||
269 | rst_ctlr.nr_resets = clk_num * 32; | ||
270 | reset_controller_register(&rst_ctlr); | ||
271 | } | ||
272 | |||
273 | void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num) | ||
274 | { | ||
275 | int i; | ||
276 | |||
277 | for (i = 0; i < num; i++, dev_clks++) | ||
278 | clk_register_clkdev(clks[dev_clks->dt_id], dev_clks->con_id, | ||
279 | dev_clks->dev_id); | ||
280 | } | ||
281 | |||
282 | struct clk ** __init tegra_lookup_dt_id(int clk_id, | ||
283 | struct tegra_clk *tegra_clk) | ||
284 | { | ||
285 | if (tegra_clk[clk_id].present) | ||
286 | return &clks[tegra_clk[clk_id].dt_id]; | ||
287 | else | ||
288 | return NULL; | ||
289 | } | ||
290 | |||
77 | tegra_clk_apply_init_table_func tegra_clk_apply_init_table; | 291 | tegra_clk_apply_init_table_func tegra_clk_apply_init_table; |
78 | 292 | ||
79 | void __init tegra_clocks_apply_init_table(void) | 293 | void __init tegra_clocks_apply_init_table(void) |
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h index 07cfacd91686..16ec8d6bb87f 100644 --- a/drivers/clk/tegra/clk.h +++ b/drivers/clk/tegra/clk.h | |||
@@ -37,6 +37,8 @@ struct tegra_clk_sync_source { | |||
37 | container_of(_hw, struct tegra_clk_sync_source, hw) | 37 | container_of(_hw, struct tegra_clk_sync_source, hw) |
38 | 38 | ||
39 | extern const struct clk_ops tegra_clk_sync_source_ops; | 39 | extern const struct clk_ops tegra_clk_sync_source_ops; |
40 | extern int *periph_clk_enb_refcnt; | ||
41 | |||
40 | struct clk *tegra_clk_register_sync_source(const char *name, | 42 | struct clk *tegra_clk_register_sync_source(const char *name, |
41 | unsigned long fixed_rate, unsigned long max_rate); | 43 | unsigned long fixed_rate, unsigned long max_rate); |
42 | 44 | ||
@@ -188,12 +190,15 @@ struct tegra_clk_pll_params { | |||
188 | u32 ext_misc_reg[3]; | 190 | u32 ext_misc_reg[3]; |
189 | u32 pmc_divnm_reg; | 191 | u32 pmc_divnm_reg; |
190 | u32 pmc_divp_reg; | 192 | u32 pmc_divp_reg; |
193 | u32 flags; | ||
191 | int stepa_shift; | 194 | int stepa_shift; |
192 | int stepb_shift; | 195 | int stepb_shift; |
193 | int lock_delay; | 196 | int lock_delay; |
194 | int max_p; | 197 | int max_p; |
195 | struct pdiv_map *pdiv_tohw; | 198 | struct pdiv_map *pdiv_tohw; |
196 | struct div_nmp *div_nmp; | 199 | struct div_nmp *div_nmp; |
200 | struct tegra_clk_pll_freq_table *freq_table; | ||
201 | unsigned long fixed_rate; | ||
197 | }; | 202 | }; |
198 | 203 | ||
199 | /** | 204 | /** |
@@ -233,10 +238,7 @@ struct tegra_clk_pll { | |||
233 | struct clk_hw hw; | 238 | struct clk_hw hw; |
234 | void __iomem *clk_base; | 239 | void __iomem *clk_base; |
235 | void __iomem *pmc; | 240 | void __iomem *pmc; |
236 | u32 flags; | ||
237 | unsigned long fixed_rate; | ||
238 | spinlock_t *lock; | 241 | spinlock_t *lock; |
239 | struct tegra_clk_pll_freq_table *freq_table; | ||
240 | struct tegra_clk_pll_params *params; | 242 | struct tegra_clk_pll_params *params; |
241 | }; | 243 | }; |
242 | 244 | ||
@@ -258,56 +260,49 @@ extern const struct clk_ops tegra_clk_pll_ops; | |||
258 | extern const struct clk_ops tegra_clk_plle_ops; | 260 | extern const struct clk_ops tegra_clk_plle_ops; |
259 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 261 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
260 | void __iomem *clk_base, void __iomem *pmc, | 262 | void __iomem *clk_base, void __iomem *pmc, |
261 | unsigned long flags, unsigned long fixed_rate, | 263 | unsigned long flags, struct tegra_clk_pll_params *pll_params, |
262 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | 264 | spinlock_t *lock); |
263 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | ||
264 | 265 | ||
265 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 266 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
266 | void __iomem *clk_base, void __iomem *pmc, | 267 | void __iomem *clk_base, void __iomem *pmc, |
267 | unsigned long flags, unsigned long fixed_rate, | 268 | unsigned long flags, struct tegra_clk_pll_params *pll_params, |
268 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | 269 | spinlock_t *lock); |
269 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | ||
270 | 270 | ||
271 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | 271 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, |
272 | void __iomem *clk_base, void __iomem *pmc, | 272 | void __iomem *clk_base, void __iomem *pmc, |
273 | unsigned long flags, unsigned long fixed_rate, | 273 | unsigned long flags, |
274 | struct tegra_clk_pll_params *pll_params, | 274 | struct tegra_clk_pll_params *pll_params, |
275 | u32 pll_flags, | ||
276 | struct tegra_clk_pll_freq_table *freq_table, | ||
277 | spinlock_t *lock); | 275 | spinlock_t *lock); |
278 | 276 | ||
279 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | 277 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, |
280 | void __iomem *clk_base, void __iomem *pmc, | 278 | void __iomem *clk_base, void __iomem *pmc, |
281 | unsigned long flags, unsigned long fixed_rate, | 279 | unsigned long flags, |
282 | struct tegra_clk_pll_params *pll_params, | 280 | struct tegra_clk_pll_params *pll_params, |
283 | u32 pll_flags, | ||
284 | struct tegra_clk_pll_freq_table *freq_table, | ||
285 | spinlock_t *lock); | 281 | spinlock_t *lock); |
286 | 282 | ||
287 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | 283 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, |
288 | void __iomem *clk_base, void __iomem *pmc, | 284 | void __iomem *clk_base, void __iomem *pmc, |
289 | unsigned long flags, unsigned long fixed_rate, | 285 | unsigned long flags, |
290 | struct tegra_clk_pll_params *pll_params, | 286 | struct tegra_clk_pll_params *pll_params, |
291 | u32 pll_flags, | ||
292 | struct tegra_clk_pll_freq_table *freq_table, | ||
293 | spinlock_t *lock); | 287 | spinlock_t *lock); |
294 | 288 | ||
295 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | 289 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, |
296 | void __iomem *clk_base, void __iomem *pmc, | 290 | void __iomem *clk_base, void __iomem *pmc, |
297 | unsigned long flags, unsigned long fixed_rate, | 291 | unsigned long flags, |
298 | struct tegra_clk_pll_params *pll_params, | 292 | struct tegra_clk_pll_params *pll_params, |
299 | u32 pll_flags, | ||
300 | struct tegra_clk_pll_freq_table *freq_table, | ||
301 | spinlock_t *lock, unsigned long parent_rate); | 293 | spinlock_t *lock, unsigned long parent_rate); |
302 | 294 | ||
303 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | 295 | struct clk *tegra_clk_register_plle_tegra114(const char *name, |
304 | const char *parent_name, | 296 | const char *parent_name, |
305 | void __iomem *clk_base, unsigned long flags, | 297 | void __iomem *clk_base, unsigned long flags, |
306 | unsigned long fixed_rate, | ||
307 | struct tegra_clk_pll_params *pll_params, | 298 | struct tegra_clk_pll_params *pll_params, |
308 | struct tegra_clk_pll_freq_table *freq_table, | ||
309 | spinlock_t *lock); | 299 | spinlock_t *lock); |
310 | 300 | ||
301 | struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name, | ||
302 | void __iomem *clk_base, unsigned long flags, | ||
303 | struct tegra_clk_pll_params *pll_params, | ||
304 | spinlock_t *lock); | ||
305 | |||
311 | /** | 306 | /** |
312 | * struct tegra_clk_pll_out - PLL divider down clock | 307 | * struct tegra_clk_pll_out - PLL divider down clock |
313 | * | 308 | * |
@@ -395,13 +390,13 @@ struct tegra_clk_periph_gate { | |||
395 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) | 390 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) |
396 | #define TEGRA_PERIPH_ON_APB BIT(2) | 391 | #define TEGRA_PERIPH_ON_APB BIT(2) |
397 | #define TEGRA_PERIPH_WAR_1005168 BIT(3) | 392 | #define TEGRA_PERIPH_WAR_1005168 BIT(3) |
393 | #define TEGRA_PERIPH_NO_DIV BIT(4) | ||
394 | #define TEGRA_PERIPH_NO_GATE BIT(5) | ||
398 | 395 | ||
399 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); | ||
400 | extern const struct clk_ops tegra_clk_periph_gate_ops; | 396 | extern const struct clk_ops tegra_clk_periph_gate_ops; |
401 | struct clk *tegra_clk_register_periph_gate(const char *name, | 397 | struct clk *tegra_clk_register_periph_gate(const char *name, |
402 | const char *parent_name, u8 gate_flags, void __iomem *clk_base, | 398 | const char *parent_name, u8 gate_flags, void __iomem *clk_base, |
403 | unsigned long flags, int clk_num, | 399 | unsigned long flags, int clk_num, int *enable_refcnt); |
404 | struct tegra_clk_periph_regs *pregs, int *enable_refcnt); | ||
405 | 400 | ||
406 | /** | 401 | /** |
407 | * struct clk-periph - peripheral clock | 402 | * struct clk-periph - peripheral clock |
@@ -443,26 +438,26 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, | |||
443 | 438 | ||
444 | #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags, \ | 439 | #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags, \ |
445 | _div_shift, _div_width, _div_frac_width, \ | 440 | _div_shift, _div_width, _div_frac_width, \ |
446 | _div_flags, _clk_num, _enb_refcnt, _regs, \ | 441 | _div_flags, _clk_num,\ |
447 | _gate_flags, _table) \ | 442 | _gate_flags, _table, _lock) \ |
448 | { \ | 443 | { \ |
449 | .mux = { \ | 444 | .mux = { \ |
450 | .flags = _mux_flags, \ | 445 | .flags = _mux_flags, \ |
451 | .shift = _mux_shift, \ | 446 | .shift = _mux_shift, \ |
452 | .mask = _mux_mask, \ | 447 | .mask = _mux_mask, \ |
453 | .table = _table, \ | 448 | .table = _table, \ |
449 | .lock = _lock, \ | ||
454 | }, \ | 450 | }, \ |
455 | .divider = { \ | 451 | .divider = { \ |
456 | .flags = _div_flags, \ | 452 | .flags = _div_flags, \ |
457 | .shift = _div_shift, \ | 453 | .shift = _div_shift, \ |
458 | .width = _div_width, \ | 454 | .width = _div_width, \ |
459 | .frac_width = _div_frac_width, \ | 455 | .frac_width = _div_frac_width, \ |
456 | .lock = _lock, \ | ||
460 | }, \ | 457 | }, \ |
461 | .gate = { \ | 458 | .gate = { \ |
462 | .flags = _gate_flags, \ | 459 | .flags = _gate_flags, \ |
463 | .clk_num = _clk_num, \ | 460 | .clk_num = _clk_num, \ |
464 | .enable_refcnt = _enb_refcnt, \ | ||
465 | .regs = _regs, \ | ||
466 | }, \ | 461 | }, \ |
467 | .mux_ops = &clk_mux_ops, \ | 462 | .mux_ops = &clk_mux_ops, \ |
468 | .div_ops = &tegra_clk_frac_div_ops, \ | 463 | .div_ops = &tegra_clk_frac_div_ops, \ |
@@ -472,7 +467,10 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, | |||
472 | struct tegra_periph_init_data { | 467 | struct tegra_periph_init_data { |
473 | const char *name; | 468 | const char *name; |
474 | int clk_id; | 469 | int clk_id; |
475 | const char **parent_names; | 470 | union { |
471 | const char **parent_names; | ||
472 | const char *parent_name; | ||
473 | } p; | ||
476 | int num_parents; | 474 | int num_parents; |
477 | struct tegra_clk_periph periph; | 475 | struct tegra_clk_periph periph; |
478 | u32 offset; | 476 | u32 offset; |
@@ -483,20 +481,19 @@ struct tegra_periph_init_data { | |||
483 | 481 | ||
484 | #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ | 482 | #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ |
485 | _mux_shift, _mux_mask, _mux_flags, _div_shift, \ | 483 | _mux_shift, _mux_mask, _mux_flags, _div_shift, \ |
486 | _div_width, _div_frac_width, _div_flags, _regs, \ | 484 | _div_width, _div_frac_width, _div_flags, \ |
487 | _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\ | 485 | _clk_num, _gate_flags, _clk_id, _table, \ |
488 | _flags) \ | 486 | _flags, _lock) \ |
489 | { \ | 487 | { \ |
490 | .name = _name, \ | 488 | .name = _name, \ |
491 | .clk_id = _clk_id, \ | 489 | .clk_id = _clk_id, \ |
492 | .parent_names = _parent_names, \ | 490 | .p.parent_names = _parent_names, \ |
493 | .num_parents = ARRAY_SIZE(_parent_names), \ | 491 | .num_parents = ARRAY_SIZE(_parent_names), \ |
494 | .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, \ | 492 | .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, \ |
495 | _mux_flags, _div_shift, \ | 493 | _mux_flags, _div_shift, \ |
496 | _div_width, _div_frac_width, \ | 494 | _div_width, _div_frac_width, \ |
497 | _div_flags, _clk_num, \ | 495 | _div_flags, _clk_num, \ |
498 | _enb_refcnt, _regs, \ | 496 | _gate_flags, _table, _lock), \ |
499 | _gate_flags, _table), \ | ||
500 | .offset = _offset, \ | 497 | .offset = _offset, \ |
501 | .con_id = _con_id, \ | 498 | .con_id = _con_id, \ |
502 | .dev_id = _dev_id, \ | 499 | .dev_id = _dev_id, \ |
@@ -505,13 +502,13 @@ struct tegra_periph_init_data { | |||
505 | 502 | ||
506 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ | 503 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ |
507 | _mux_shift, _mux_width, _mux_flags, _div_shift, \ | 504 | _mux_shift, _mux_width, _mux_flags, _div_shift, \ |
508 | _div_width, _div_frac_width, _div_flags, _regs, \ | 505 | _div_width, _div_frac_width, _div_flags, \ |
509 | _clk_num, _enb_refcnt, _gate_flags, _clk_id) \ | 506 | _clk_num, _gate_flags, _clk_id) \ |
510 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ | 507 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ |
511 | _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ | 508 | _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ |
512 | _div_shift, _div_width, _div_frac_width, _div_flags, \ | 509 | _div_shift, _div_width, _div_frac_width, _div_flags, \ |
513 | _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ | 510 | _clk_num, _gate_flags, _clk_id,\ |
514 | NULL, 0) | 511 | NULL, 0, NULL) |
515 | 512 | ||
516 | /** | 513 | /** |
517 | * struct clk_super_mux - super clock | 514 | * struct clk_super_mux - super clock |
@@ -581,12 +578,49 @@ struct tegra_clk_duplicate { | |||
581 | }, \ | 578 | }, \ |
582 | } | 579 | } |
583 | 580 | ||
581 | struct tegra_clk { | ||
582 | int dt_id; | ||
583 | bool present; | ||
584 | }; | ||
585 | |||
586 | struct tegra_devclk { | ||
587 | int dt_id; | ||
588 | char *dev_id; | ||
589 | char *con_id; | ||
590 | }; | ||
591 | |||
584 | void tegra_init_from_table(struct tegra_clk_init_table *tbl, | 592 | void tegra_init_from_table(struct tegra_clk_init_table *tbl, |
585 | struct clk *clks[], int clk_max); | 593 | struct clk *clks[], int clk_max); |
586 | 594 | ||
587 | void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, | 595 | void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, |
588 | struct clk *clks[], int clk_max); | 596 | struct clk *clks[], int clk_max); |
589 | 597 | ||
598 | struct tegra_clk_periph_regs *get_reg_bank(int clkid); | ||
599 | struct clk **tegra_clk_init(void __iomem *clk_base, int num, int periph_banks); | ||
600 | |||
601 | struct clk **tegra_lookup_dt_id(int clk_id, struct tegra_clk *tegra_clk); | ||
602 | |||
603 | void tegra_add_of_provider(struct device_node *np); | ||
604 | void tegra_register_devclks(struct tegra_devclk *dev_clks, int num); | ||
605 | |||
606 | void tegra_audio_clk_init(void __iomem *clk_base, | ||
607 | void __iomem *pmc_base, struct tegra_clk *tegra_clks, | ||
608 | struct tegra_clk_pll_params *pll_params); | ||
609 | |||
610 | void tegra_periph_clk_init(void __iomem *clk_base, void __iomem *pmc_base, | ||
611 | struct tegra_clk *tegra_clks, | ||
612 | struct tegra_clk_pll_params *pll_params); | ||
613 | |||
614 | void tegra_pmc_clk_init(void __iomem *pmc_base, struct tegra_clk *tegra_clks); | ||
615 | void tegra_fixed_clk_init(struct tegra_clk *tegra_clks); | ||
616 | int tegra_osc_clk_init(void __iomem *clk_base, struct tegra_clk *tegra_clks, | ||
617 | unsigned long *input_freqs, int num, | ||
618 | unsigned long *osc_freq, | ||
619 | unsigned long *pll_ref_freq); | ||
620 | void tegra_super_clk_gen4_init(void __iomem *clk_base, | ||
621 | void __iomem *pmc_base, struct tegra_clk *tegra_clks, | ||
622 | struct tegra_clk_pll_params *pll_params); | ||
623 | |||
590 | void tegra114_clock_tune_cpu_trimmers_high(void); | 624 | void tegra114_clock_tune_cpu_trimmers_high(void); |
591 | void tegra114_clock_tune_cpu_trimmers_low(void); | 625 | void tegra114_clock_tune_cpu_trimmers_low(void); |
592 | void tegra114_clock_tune_cpu_trimmers_init(void); | 626 | void tegra114_clock_tune_cpu_trimmers_init(void); |
diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h index 7f25cee8cec2..3ddade8a5125 100644 --- a/drivers/cpufreq/exynos-cpufreq.h +++ b/drivers/cpufreq/exynos-cpufreq.h | |||
@@ -67,3 +67,25 @@ static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info) | |||
67 | return -EOPNOTSUPP; | 67 | return -EOPNOTSUPP; |
68 | } | 68 | } |
69 | #endif | 69 | #endif |
70 | |||
71 | #include <plat/cpu.h> | ||
72 | #include <mach/map.h> | ||
73 | |||
74 | #define EXYNOS4_CLKSRC_CPU (S5P_VA_CMU + 0x14200) | ||
75 | #define EXYNOS4_CLKMUX_STATCPU (S5P_VA_CMU + 0x14400) | ||
76 | |||
77 | #define EXYNOS4_CLKDIV_CPU (S5P_VA_CMU + 0x14500) | ||
78 | #define EXYNOS4_CLKDIV_CPU1 (S5P_VA_CMU + 0x14504) | ||
79 | #define EXYNOS4_CLKDIV_STATCPU (S5P_VA_CMU + 0x14600) | ||
80 | #define EXYNOS4_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x14604) | ||
81 | |||
82 | #define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16) | ||
83 | #define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT) | ||
84 | |||
85 | #define EXYNOS5_APLL_LOCK (S5P_VA_CMU + 0x00000) | ||
86 | #define EXYNOS5_APLL_CON0 (S5P_VA_CMU + 0x00100) | ||
87 | #define EXYNOS5_CLKMUX_STATCPU (S5P_VA_CMU + 0x00400) | ||
88 | #define EXYNOS5_CLKDIV_CPU0 (S5P_VA_CMU + 0x00500) | ||
89 | #define EXYNOS5_CLKDIV_CPU1 (S5P_VA_CMU + 0x00504) | ||
90 | #define EXYNOS5_CLKDIV_STATCPU0 (S5P_VA_CMU + 0x00600) | ||
91 | #define EXYNOS5_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x00604) | ||
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c b/drivers/cpufreq/exynos4210-cpufreq.c index dfd1643b0b2f..40d84c43d8f4 100644 --- a/drivers/cpufreq/exynos4210-cpufreq.c +++ b/drivers/cpufreq/exynos4210-cpufreq.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
19 | 19 | ||
20 | #include <mach/regs-clock.h> | ||
21 | |||
22 | #include "exynos-cpufreq.h" | 20 | #include "exynos-cpufreq.h" |
23 | 21 | ||
24 | static struct clk *cpu_clk; | 22 | static struct clk *cpu_clk; |
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index efad5e657f6f..869e48297e28 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
19 | 19 | ||
20 | #include <mach/regs-clock.h> | ||
21 | |||
22 | #include "exynos-cpufreq.h" | 20 | #include "exynos-cpufreq.h" |
23 | 21 | ||
24 | static struct clk *cpu_clk; | 22 | static struct clk *cpu_clk; |
diff --git a/drivers/cpufreq/exynos5250-cpufreq.c b/drivers/cpufreq/exynos5250-cpufreq.c index 8feda86fe42c..5ee2ce1ad424 100644 --- a/drivers/cpufreq/exynos5250-cpufreq.c +++ b/drivers/cpufreq/exynos5250-cpufreq.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
19 | 19 | ||
20 | #include <mach/map.h> | 20 | #include <mach/map.h> |
21 | #include <mach/regs-clock.h> | ||
22 | 21 | ||
23 | #include "exynos-cpufreq.h" | 22 | #include "exynos-cpufreq.h" |
24 | 23 | ||
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c index bbbfe6853b18..e07b0c68c715 100644 --- a/drivers/devfreq/exynos/exynos4_bus.c +++ b/drivers/devfreq/exynos/exynos4_bus.c | |||
@@ -30,9 +30,9 @@ | |||
30 | extern unsigned int exynos_result_of_asv; | 30 | extern unsigned int exynos_result_of_asv; |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #include <mach/regs-clock.h> | 33 | #include <mach/map.h> |
34 | 34 | ||
35 | #include <plat/map-s5p.h> | 35 | #include "exynos4_bus.h" |
36 | 36 | ||
37 | #define MAX_SAFEVOLT 1200000 /* 1.2V */ | 37 | #define MAX_SAFEVOLT 1200000 /* 1.2V */ |
38 | 38 | ||
diff --git a/drivers/devfreq/exynos/exynos4_bus.h b/drivers/devfreq/exynos/exynos4_bus.h new file mode 100644 index 000000000000..94c73c18d28c --- /dev/null +++ b/drivers/devfreq/exynos/exynos4_bus.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com/ | ||
4 | * | ||
5 | * EXYNOS4 BUS header | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __DEVFREQ_EXYNOS4_BUS_H | ||
13 | #define __DEVFREQ_EXYNOS4_BUS_H __FILE__ | ||
14 | |||
15 | #include <mach/map.h> | ||
16 | |||
17 | #define EXYNOS4_CLKDIV_LEFTBUS (S5P_VA_CMU + 0x04500) | ||
18 | #define EXYNOS4_CLKDIV_STAT_LEFTBUS (S5P_VA_CMU + 0x04600) | ||
19 | |||
20 | #define EXYNOS4_CLKDIV_RIGHTBUS (S5P_VA_CMU + 0x08500) | ||
21 | #define EXYNOS4_CLKDIV_STAT_RIGHTBUS (S5P_VA_CMU + 0x08600) | ||
22 | |||
23 | #define EXYNOS4_CLKDIV_TOP (S5P_VA_CMU + 0x0C510) | ||
24 | #define EXYNOS4_CLKDIV_CAM (S5P_VA_CMU + 0x0C520) | ||
25 | #define EXYNOS4_CLKDIV_MFC (S5P_VA_CMU + 0x0C528) | ||
26 | |||
27 | #define EXYNOS4_CLKDIV_STAT_TOP (S5P_VA_CMU + 0x0C610) | ||
28 | #define EXYNOS4_CLKDIV_STAT_MFC (S5P_VA_CMU + 0x0C628) | ||
29 | |||
30 | #define EXYNOS4210_CLKGATE_IP_IMAGE (S5P_VA_CMU + 0x0C930) | ||
31 | #define EXYNOS4212_CLKGATE_IP_IMAGE (S5P_VA_CMU + 0x04930) | ||
32 | |||
33 | #define EXYNOS4_CLKDIV_DMC0 (S5P_VA_CMU + 0x10500) | ||
34 | #define EXYNOS4_CLKDIV_DMC1 (S5P_VA_CMU + 0x10504) | ||
35 | #define EXYNOS4_CLKDIV_STAT_DMC0 (S5P_VA_CMU + 0x10600) | ||
36 | #define EXYNOS4_CLKDIV_STAT_DMC1 (S5P_VA_CMU + 0x10604) | ||
37 | |||
38 | #define EXYNOS4_DMC_PAUSE_CTRL (S5P_VA_CMU + 0x11094) | ||
39 | #define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0) | ||
40 | |||
41 | #define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0) | ||
42 | #define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) | ||
43 | #define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4) | ||
44 | #define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) | ||
45 | #define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8) | ||
46 | #define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) | ||
47 | #define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12) | ||
48 | #define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) | ||
49 | #define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16) | ||
50 | #define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) | ||
51 | #define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20) | ||
52 | #define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT) | ||
53 | #define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24) | ||
54 | #define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT) | ||
55 | #define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28) | ||
56 | #define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT) | ||
57 | |||
58 | #define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0) | ||
59 | #define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT) | ||
60 | #define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4) | ||
61 | #define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT) | ||
62 | #define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8) | ||
63 | #define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT) | ||
64 | #define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12) | ||
65 | #define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT) | ||
66 | #define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16) | ||
67 | #define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT) | ||
68 | #define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24) | ||
69 | #define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT) | ||
70 | |||
71 | #define EXYNOS4_CLKDIV_MFC_SHIFT (0) | ||
72 | #define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT) | ||
73 | |||
74 | #define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0) | ||
75 | #define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT) | ||
76 | #define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4) | ||
77 | #define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) | ||
78 | #define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8) | ||
79 | #define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) | ||
80 | #define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12) | ||
81 | #define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) | ||
82 | #define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16) | ||
83 | #define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT) | ||
84 | #define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20) | ||
85 | #define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT) | ||
86 | #define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24) | ||
87 | #define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT) | ||
88 | |||
89 | #define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0) | ||
90 | #define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) | ||
91 | #define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4) | ||
92 | #define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT) | ||
93 | |||
94 | #define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0) | ||
95 | #define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT) | ||
96 | #define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4) | ||
97 | #define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT) | ||
98 | #define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8) | ||
99 | #define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT) | ||
100 | #define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12) | ||
101 | #define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT) | ||
102 | |||
103 | #define EXYNOS4_CLKDIV_CAM1 (S5P_VA_CMU + 0x0C568) | ||
104 | |||
105 | #define EXYNOS4_CLKDIV_STAT_CAM1 (S5P_VA_CMU + 0x0C668) | ||
106 | |||
107 | #define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0) | ||
108 | #define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT) | ||
109 | |||
110 | #endif /* __DEVFREQ_EXYNOS4_BUS_H */ | ||
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index c823daaf9043..c10eb89a3c1b 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -292,9 +292,11 @@ config MMP_TDMA | |||
292 | bool "MMP Two-Channel DMA support" | 292 | bool "MMP Two-Channel DMA support" |
293 | depends on ARCH_MMP | 293 | depends on ARCH_MMP |
294 | select DMA_ENGINE | 294 | select DMA_ENGINE |
295 | select MMP_SRAM | ||
295 | help | 296 | help |
296 | Support the MMP Two-Channel DMA engine. | 297 | Support the MMP Two-Channel DMA engine. |
297 | This engine used for MMP Audio DMA and pxa910 SQU. | 298 | This engine used for MMP Audio DMA and pxa910 SQU. |
299 | It needs sram driver under mach-mmp. | ||
298 | 300 | ||
299 | Say Y here if you enabled MMP ADMA, otherwise say N. | 301 | Say Y here if you enabled MMP ADMA, otherwise say N. |
300 | 302 | ||
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 92caad629d99..ed610b497518 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -535,6 +535,34 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan) | |||
535 | } | 535 | } |
536 | EXPORT_SYMBOL_GPL(dma_get_slave_channel); | 536 | EXPORT_SYMBOL_GPL(dma_get_slave_channel); |
537 | 537 | ||
538 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device) | ||
539 | { | ||
540 | dma_cap_mask_t mask; | ||
541 | struct dma_chan *chan; | ||
542 | int err; | ||
543 | |||
544 | dma_cap_zero(mask); | ||
545 | dma_cap_set(DMA_SLAVE, mask); | ||
546 | |||
547 | /* lock against __dma_request_channel */ | ||
548 | mutex_lock(&dma_list_mutex); | ||
549 | |||
550 | chan = private_candidate(&mask, device, NULL, NULL); | ||
551 | if (chan) { | ||
552 | err = dma_chan_get(chan); | ||
553 | if (err) { | ||
554 | pr_debug("%s: failed to get %s: (%d)\n", | ||
555 | __func__, dma_chan_name(chan), err); | ||
556 | chan = NULL; | ||
557 | } | ||
558 | } | ||
559 | |||
560 | mutex_unlock(&dma_list_mutex); | ||
561 | |||
562 | return chan; | ||
563 | } | ||
564 | EXPORT_SYMBOL_GPL(dma_get_any_slave_channel); | ||
565 | |||
538 | /** | 566 | /** |
539 | * __dma_request_channel - try to allocate an exclusive channel | 567 | * __dma_request_channel - try to allocate an exclusive channel |
540 | * @mask: capabilities that the channel must satisfy | 568 | * @mask: capabilities that the channel must satisfy |
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 8869500ab92b..c6a01ea8bc59 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -893,33 +893,17 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec, | |||
893 | struct of_dma *ofdma) | 893 | struct of_dma *ofdma) |
894 | { | 894 | { |
895 | struct mmp_pdma_device *d = ofdma->of_dma_data; | 895 | struct mmp_pdma_device *d = ofdma->of_dma_data; |
896 | struct dma_chan *chan, *candidate; | 896 | struct dma_chan *chan; |
897 | struct mmp_pdma_chan *c; | ||
897 | 898 | ||
898 | retry: | 899 | chan = dma_get_any_slave_channel(&d->device); |
899 | candidate = NULL; | 900 | if (!chan) |
900 | |||
901 | /* walk the list of channels registered with the current instance and | ||
902 | * find one that is currently unused */ | ||
903 | list_for_each_entry(chan, &d->device.channels, device_node) | ||
904 | if (chan->client_count == 0) { | ||
905 | candidate = chan; | ||
906 | break; | ||
907 | } | ||
908 | |||
909 | if (!candidate) | ||
910 | return NULL; | 901 | return NULL; |
911 | 902 | ||
912 | /* dma_get_slave_channel will return NULL if we lost a race between | 903 | c = to_mmp_pdma_chan(chan); |
913 | * the lookup and the reservation */ | 904 | c->drcmr = dma_spec->args[0]; |
914 | chan = dma_get_slave_channel(candidate); | ||
915 | |||
916 | if (chan) { | ||
917 | struct mmp_pdma_chan *c = to_mmp_pdma_chan(chan); | ||
918 | c->drcmr = dma_spec->args[0]; | ||
919 | return chan; | ||
920 | } | ||
921 | 905 | ||
922 | goto retry; | 906 | return chan; |
923 | } | 907 | } |
924 | 908 | ||
925 | static int mmp_pdma_probe(struct platform_device *op) | 909 | static int mmp_pdma_probe(struct platform_device *op) |
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 73654e33f13b..d11bb3620f27 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DMA driver for Nvidia's Tegra20 APB DMA controller. | 2 | * DMA driver for Nvidia's Tegra20 APB DMA controller. |
3 | * | 3 | * |
4 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -29,11 +29,12 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
31 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
32 | #include <linux/of_dma.h> | ||
32 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
33 | #include <linux/pm.h> | 34 | #include <linux/pm.h> |
34 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | #include <linux/reset.h> | ||
35 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
36 | #include <linux/clk/tegra.h> | ||
37 | 38 | ||
38 | #include "dmaengine.h" | 39 | #include "dmaengine.h" |
39 | 40 | ||
@@ -199,6 +200,7 @@ struct tegra_dma_channel { | |||
199 | void *callback_param; | 200 | void *callback_param; |
200 | 201 | ||
201 | /* Channel-slave specific configuration */ | 202 | /* Channel-slave specific configuration */ |
203 | unsigned int slave_id; | ||
202 | struct dma_slave_config dma_sconfig; | 204 | struct dma_slave_config dma_sconfig; |
203 | struct tegra_dma_channel_regs channel_reg; | 205 | struct tegra_dma_channel_regs channel_reg; |
204 | }; | 206 | }; |
@@ -208,6 +210,7 @@ struct tegra_dma { | |||
208 | struct dma_device dma_dev; | 210 | struct dma_device dma_dev; |
209 | struct device *dev; | 211 | struct device *dev; |
210 | struct clk *dma_clk; | 212 | struct clk *dma_clk; |
213 | struct reset_control *rst; | ||
211 | spinlock_t global_lock; | 214 | spinlock_t global_lock; |
212 | void __iomem *base_addr; | 215 | void __iomem *base_addr; |
213 | const struct tegra_dma_chip_data *chip_data; | 216 | const struct tegra_dma_chip_data *chip_data; |
@@ -339,6 +342,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc, | |||
339 | } | 342 | } |
340 | 343 | ||
341 | memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig)); | 344 | memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig)); |
345 | if (!tdc->slave_id) | ||
346 | tdc->slave_id = sconfig->slave_id; | ||
342 | tdc->config_init = true; | 347 | tdc->config_init = true; |
343 | return 0; | 348 | return 0; |
344 | } | 349 | } |
@@ -941,7 +946,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( | |||
941 | ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32; | 946 | ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32; |
942 | 947 | ||
943 | csr |= TEGRA_APBDMA_CSR_ONCE | TEGRA_APBDMA_CSR_FLOW; | 948 | csr |= TEGRA_APBDMA_CSR_ONCE | TEGRA_APBDMA_CSR_FLOW; |
944 | csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; | 949 | csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; |
945 | if (flags & DMA_PREP_INTERRUPT) | 950 | if (flags & DMA_PREP_INTERRUPT) |
946 | csr |= TEGRA_APBDMA_CSR_IE_EOC; | 951 | csr |= TEGRA_APBDMA_CSR_IE_EOC; |
947 | 952 | ||
@@ -1085,7 +1090,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( | |||
1085 | csr |= TEGRA_APBDMA_CSR_FLOW; | 1090 | csr |= TEGRA_APBDMA_CSR_FLOW; |
1086 | if (flags & DMA_PREP_INTERRUPT) | 1091 | if (flags & DMA_PREP_INTERRUPT) |
1087 | csr |= TEGRA_APBDMA_CSR_IE_EOC; | 1092 | csr |= TEGRA_APBDMA_CSR_IE_EOC; |
1088 | csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; | 1093 | csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; |
1089 | 1094 | ||
1090 | apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1; | 1095 | apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1; |
1091 | 1096 | ||
@@ -1205,6 +1210,25 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) | |||
1205 | kfree(sg_req); | 1210 | kfree(sg_req); |
1206 | } | 1211 | } |
1207 | clk_disable_unprepare(tdma->dma_clk); | 1212 | clk_disable_unprepare(tdma->dma_clk); |
1213 | |||
1214 | tdc->slave_id = 0; | ||
1215 | } | ||
1216 | |||
1217 | static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec, | ||
1218 | struct of_dma *ofdma) | ||
1219 | { | ||
1220 | struct tegra_dma *tdma = ofdma->of_dma_data; | ||
1221 | struct dma_chan *chan; | ||
1222 | struct tegra_dma_channel *tdc; | ||
1223 | |||
1224 | chan = dma_get_any_slave_channel(&tdma->dma_dev); | ||
1225 | if (!chan) | ||
1226 | return NULL; | ||
1227 | |||
1228 | tdc = to_tegra_dma_chan(chan); | ||
1229 | tdc->slave_id = dma_spec->args[0]; | ||
1230 | |||
1231 | return chan; | ||
1208 | } | 1232 | } |
1209 | 1233 | ||
1210 | /* Tegra20 specific DMA controller information */ | 1234 | /* Tegra20 specific DMA controller information */ |
@@ -1282,6 +1306,12 @@ static int tegra_dma_probe(struct platform_device *pdev) | |||
1282 | return PTR_ERR(tdma->dma_clk); | 1306 | return PTR_ERR(tdma->dma_clk); |
1283 | } | 1307 | } |
1284 | 1308 | ||
1309 | tdma->rst = devm_reset_control_get(&pdev->dev, "dma"); | ||
1310 | if (IS_ERR(tdma->rst)) { | ||
1311 | dev_err(&pdev->dev, "Error: Missing reset\n"); | ||
1312 | return PTR_ERR(tdma->rst); | ||
1313 | } | ||
1314 | |||
1285 | spin_lock_init(&tdma->global_lock); | 1315 | spin_lock_init(&tdma->global_lock); |
1286 | 1316 | ||
1287 | pm_runtime_enable(&pdev->dev); | 1317 | pm_runtime_enable(&pdev->dev); |
@@ -1302,9 +1332,9 @@ static int tegra_dma_probe(struct platform_device *pdev) | |||
1302 | } | 1332 | } |
1303 | 1333 | ||
1304 | /* Reset DMA controller */ | 1334 | /* Reset DMA controller */ |
1305 | tegra_periph_reset_assert(tdma->dma_clk); | 1335 | reset_control_assert(tdma->rst); |
1306 | udelay(2); | 1336 | udelay(2); |
1307 | tegra_periph_reset_deassert(tdma->dma_clk); | 1337 | reset_control_deassert(tdma->rst); |
1308 | 1338 | ||
1309 | /* Enable global DMA registers */ | 1339 | /* Enable global DMA registers */ |
1310 | tdma_write(tdma, TEGRA_APBDMA_GENERAL, TEGRA_APBDMA_GENERAL_ENABLE); | 1340 | tdma_write(tdma, TEGRA_APBDMA_GENERAL, TEGRA_APBDMA_GENERAL_ENABLE); |
@@ -1376,10 +1406,20 @@ static int tegra_dma_probe(struct platform_device *pdev) | |||
1376 | goto err_irq; | 1406 | goto err_irq; |
1377 | } | 1407 | } |
1378 | 1408 | ||
1409 | ret = of_dma_controller_register(pdev->dev.of_node, | ||
1410 | tegra_dma_of_xlate, tdma); | ||
1411 | if (ret < 0) { | ||
1412 | dev_err(&pdev->dev, | ||
1413 | "Tegra20 APB DMA OF registration failed %d\n", ret); | ||
1414 | goto err_unregister_dma_dev; | ||
1415 | } | ||
1416 | |||
1379 | dev_info(&pdev->dev, "Tegra20 APB DMA driver register %d channels\n", | 1417 | dev_info(&pdev->dev, "Tegra20 APB DMA driver register %d channels\n", |
1380 | cdata->nr_channels); | 1418 | cdata->nr_channels); |
1381 | return 0; | 1419 | return 0; |
1382 | 1420 | ||
1421 | err_unregister_dma_dev: | ||
1422 | dma_async_device_unregister(&tdma->dma_dev); | ||
1383 | err_irq: | 1423 | err_irq: |
1384 | while (--i >= 0) { | 1424 | while (--i >= 0) { |
1385 | struct tegra_dma_channel *tdc = &tdma->channels[i]; | 1425 | struct tegra_dma_channel *tdc = &tdma->channels[i]; |
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig index 8961ba6a34b8..8db9b3bce001 100644 --- a/drivers/gpu/drm/tegra/Kconfig +++ b/drivers/gpu/drm/tegra/Kconfig | |||
@@ -2,6 +2,7 @@ config DRM_TEGRA | |||
2 | bool "NVIDIA Tegra DRM" | 2 | bool "NVIDIA Tegra DRM" |
3 | depends on ARCH_TEGRA || ARCH_MULTIPLATFORM | 3 | depends on ARCH_TEGRA || ARCH_MULTIPLATFORM |
4 | depends on DRM | 4 | depends on DRM |
5 | depends on RESET_CONTROLLER | ||
5 | select TEGRA_HOST1X | 6 | select TEGRA_HOST1X |
6 | select DRM_KMS_HELPER | 7 | select DRM_KMS_HELPER |
7 | select DRM_KMS_FB_HELPER | 8 | select DRM_KMS_FB_HELPER |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index ae1cb31ead7e..cd7f1e499616 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/clk/tegra.h> | ||
12 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
12 | #include <linux/reset.h> | ||
13 | 13 | ||
14 | #include "dc.h" | 14 | #include "dc.h" |
15 | #include "drm.h" | 15 | #include "drm.h" |
@@ -712,7 +712,7 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) | |||
712 | unsigned long value; | 712 | unsigned long value; |
713 | 713 | ||
714 | /* hardware initialization */ | 714 | /* hardware initialization */ |
715 | tegra_periph_reset_deassert(dc->clk); | 715 | reset_control_deassert(dc->rst); |
716 | usleep_range(10000, 20000); | 716 | usleep_range(10000, 20000); |
717 | 717 | ||
718 | if (dc->pipe) | 718 | if (dc->pipe) |
@@ -1187,6 +1187,12 @@ static int tegra_dc_probe(struct platform_device *pdev) | |||
1187 | return PTR_ERR(dc->clk); | 1187 | return PTR_ERR(dc->clk); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | dc->rst = devm_reset_control_get(&pdev->dev, "dc"); | ||
1191 | if (IS_ERR(dc->rst)) { | ||
1192 | dev_err(&pdev->dev, "failed to get reset\n"); | ||
1193 | return PTR_ERR(dc->rst); | ||
1194 | } | ||
1195 | |||
1190 | err = clk_prepare_enable(dc->clk); | 1196 | err = clk_prepare_enable(dc->clk); |
1191 | if (err < 0) | 1197 | if (err < 0) |
1192 | return err; | 1198 | return err; |
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 7da0b923131f..266aae08a3bd 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <drm/drm_fb_helper.h> | 19 | #include <drm/drm_fb_helper.h> |
20 | #include <drm/drm_fixed.h> | 20 | #include <drm/drm_fixed.h> |
21 | 21 | ||
22 | struct reset_control; | ||
23 | |||
22 | struct tegra_fb { | 24 | struct tegra_fb { |
23 | struct drm_framebuffer base; | 25 | struct drm_framebuffer base; |
24 | struct tegra_bo **planes; | 26 | struct tegra_bo **planes; |
@@ -93,6 +95,7 @@ struct tegra_dc { | |||
93 | int pipe; | 95 | int pipe; |
94 | 96 | ||
95 | struct clk *clk; | 97 | struct clk *clk; |
98 | struct reset_control *rst; | ||
96 | void __iomem *regs; | 99 | void __iomem *regs; |
97 | int irq; | 100 | int irq; |
98 | 101 | ||
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 4cec8f526af7..0cbb24b1ae04 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/host1x.h> | 11 | #include <linux/host1x.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/reset.h> | ||
14 | #include <linux/tegra-powergate.h> | 15 | #include <linux/tegra-powergate.h> |
15 | 16 | ||
16 | #include "drm.h" | 17 | #include "drm.h" |
@@ -22,6 +23,8 @@ struct gr3d { | |||
22 | struct host1x_channel *channel; | 23 | struct host1x_channel *channel; |
23 | struct clk *clk_secondary; | 24 | struct clk *clk_secondary; |
24 | struct clk *clk; | 25 | struct clk *clk; |
26 | struct reset_control *rst_secondary; | ||
27 | struct reset_control *rst; | ||
25 | 28 | ||
26 | DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); | 29 | DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); |
27 | }; | 30 | }; |
@@ -255,15 +258,29 @@ static int gr3d_probe(struct platform_device *pdev) | |||
255 | return PTR_ERR(gr3d->clk); | 258 | return PTR_ERR(gr3d->clk); |
256 | } | 259 | } |
257 | 260 | ||
261 | gr3d->rst = devm_reset_control_get(&pdev->dev, "3d"); | ||
262 | if (IS_ERR(gr3d->rst)) { | ||
263 | dev_err(&pdev->dev, "cannot get reset\n"); | ||
264 | return PTR_ERR(gr3d->rst); | ||
265 | } | ||
266 | |||
258 | if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { | 267 | if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { |
259 | gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); | 268 | gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); |
260 | if (IS_ERR(gr3d->clk)) { | 269 | if (IS_ERR(gr3d->clk)) { |
261 | dev_err(&pdev->dev, "cannot get secondary clock\n"); | 270 | dev_err(&pdev->dev, "cannot get secondary clock\n"); |
262 | return PTR_ERR(gr3d->clk); | 271 | return PTR_ERR(gr3d->clk); |
263 | } | 272 | } |
273 | |||
274 | gr3d->rst_secondary = devm_reset_control_get(&pdev->dev, | ||
275 | "3d2"); | ||
276 | if (IS_ERR(gr3d->rst_secondary)) { | ||
277 | dev_err(&pdev->dev, "cannot get secondary reset\n"); | ||
278 | return PTR_ERR(gr3d->rst_secondary); | ||
279 | } | ||
264 | } | 280 | } |
265 | 281 | ||
266 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk); | 282 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk, |
283 | gr3d->rst); | ||
267 | if (err < 0) { | 284 | if (err < 0) { |
268 | dev_err(&pdev->dev, "failed to power up 3D unit\n"); | 285 | dev_err(&pdev->dev, "failed to power up 3D unit\n"); |
269 | return err; | 286 | return err; |
@@ -271,7 +288,8 @@ static int gr3d_probe(struct platform_device *pdev) | |||
271 | 288 | ||
272 | if (gr3d->clk_secondary) { | 289 | if (gr3d->clk_secondary) { |
273 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D1, | 290 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D1, |
274 | gr3d->clk_secondary); | 291 | gr3d->clk_secondary, |
292 | gr3d->rst_secondary); | ||
275 | if (err < 0) { | 293 | if (err < 0) { |
276 | dev_err(&pdev->dev, | 294 | dev_err(&pdev->dev, |
277 | "failed to power up secondary 3D unit\n"); | 295 | "failed to power up secondary 3D unit\n"); |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 0cd9bc2056e8..7f6253ea5cb5 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
@@ -8,10 +8,10 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/clk/tegra.h> | ||
12 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
13 | #include <linux/hdmi.h> | 12 | #include <linux/hdmi.h> |
14 | #include <linux/regulator/consumer.h> | 13 | #include <linux/regulator/consumer.h> |
14 | #include <linux/reset.h> | ||
15 | 15 | ||
16 | #include "hdmi.h" | 16 | #include "hdmi.h" |
17 | #include "drm.h" | 17 | #include "drm.h" |
@@ -49,6 +49,7 @@ struct tegra_hdmi { | |||
49 | 49 | ||
50 | struct clk *clk_parent; | 50 | struct clk *clk_parent; |
51 | struct clk *clk; | 51 | struct clk *clk; |
52 | struct reset_control *rst; | ||
52 | 53 | ||
53 | const struct tegra_hdmi_config *config; | 54 | const struct tegra_hdmi_config *config; |
54 | 55 | ||
@@ -731,9 +732,9 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) | |||
731 | return err; | 732 | return err; |
732 | } | 733 | } |
733 | 734 | ||
734 | tegra_periph_reset_assert(hdmi->clk); | 735 | reset_control_assert(hdmi->rst); |
735 | usleep_range(1000, 2000); | 736 | usleep_range(1000, 2000); |
736 | tegra_periph_reset_deassert(hdmi->clk); | 737 | reset_control_deassert(hdmi->rst); |
737 | 738 | ||
738 | tegra_dc_writel(dc, VSYNC_H_POSITION(1), | 739 | tegra_dc_writel(dc, VSYNC_H_POSITION(1), |
739 | DC_DISP_DISP_TIMING_OPTIONS); | 740 | DC_DISP_DISP_TIMING_OPTIONS); |
@@ -912,7 +913,7 @@ static int tegra_output_hdmi_disable(struct tegra_output *output) | |||
912 | { | 913 | { |
913 | struct tegra_hdmi *hdmi = to_hdmi(output); | 914 | struct tegra_hdmi *hdmi = to_hdmi(output); |
914 | 915 | ||
915 | tegra_periph_reset_assert(hdmi->clk); | 916 | reset_control_assert(hdmi->rst); |
916 | clk_disable(hdmi->clk); | 917 | clk_disable(hdmi->clk); |
917 | regulator_disable(hdmi->pll); | 918 | regulator_disable(hdmi->pll); |
918 | 919 | ||
@@ -1338,6 +1339,12 @@ static int tegra_hdmi_probe(struct platform_device *pdev) | |||
1338 | return PTR_ERR(hdmi->clk); | 1339 | return PTR_ERR(hdmi->clk); |
1339 | } | 1340 | } |
1340 | 1341 | ||
1342 | hdmi->rst = devm_reset_control_get(&pdev->dev, "hdmi"); | ||
1343 | if (IS_ERR(hdmi->rst)) { | ||
1344 | dev_err(&pdev->dev, "failed to get reset\n"); | ||
1345 | return PTR_ERR(hdmi->rst); | ||
1346 | } | ||
1347 | |||
1341 | err = clk_prepare(hdmi->clk); | 1348 | err = clk_prepare(hdmi->clk); |
1342 | if (err < 0) | 1349 | if (err < 0) |
1343 | return err; | 1350 | return err; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e661edee4d0c..9704537aee3c 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/of_device.h> | 28 | #include <linux/of_device.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/clk/tegra.h> | 30 | #include <linux/reset.h> |
31 | 31 | ||
32 | #include <asm/unaligned.h> | 32 | #include <asm/unaligned.h> |
33 | 33 | ||
@@ -160,6 +160,7 @@ struct tegra_i2c_dev { | |||
160 | struct i2c_adapter adapter; | 160 | struct i2c_adapter adapter; |
161 | struct clk *div_clk; | 161 | struct clk *div_clk; |
162 | struct clk *fast_clk; | 162 | struct clk *fast_clk; |
163 | struct reset_control *rst; | ||
163 | void __iomem *base; | 164 | void __iomem *base; |
164 | int cont_id; | 165 | int cont_id; |
165 | int irq; | 166 | int irq; |
@@ -415,9 +416,9 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
415 | return err; | 416 | return err; |
416 | } | 417 | } |
417 | 418 | ||
418 | tegra_periph_reset_assert(i2c_dev->div_clk); | 419 | reset_control_assert(i2c_dev->rst); |
419 | udelay(2); | 420 | udelay(2); |
420 | tegra_periph_reset_deassert(i2c_dev->div_clk); | 421 | reset_control_deassert(i2c_dev->rst); |
421 | 422 | ||
422 | if (i2c_dev->is_dvc) | 423 | if (i2c_dev->is_dvc) |
423 | tegra_dvc_init(i2c_dev); | 424 | tegra_dvc_init(i2c_dev); |
@@ -743,6 +744,12 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
743 | i2c_dev->cont_id = pdev->id; | 744 | i2c_dev->cont_id = pdev->id; |
744 | i2c_dev->dev = &pdev->dev; | 745 | i2c_dev->dev = &pdev->dev; |
745 | 746 | ||
747 | i2c_dev->rst = devm_reset_control_get(&pdev->dev, "i2c"); | ||
748 | if (IS_ERR(i2c_dev->rst)) { | ||
749 | dev_err(&pdev->dev, "missing controller reset"); | ||
750 | return PTR_ERR(i2c_dev->rst); | ||
751 | } | ||
752 | |||
746 | ret = of_property_read_u32(i2c_dev->dev->of_node, "clock-frequency", | 753 | ret = of_property_read_u32(i2c_dev->dev->of_node, "clock-frequency", |
747 | &i2c_dev->bus_clk_rate); | 754 | &i2c_dev->bus_clk_rate); |
748 | if (ret) | 755 | if (ret) |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 8508879f6faf..9757a58bc897 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/input/matrix_keypad.h> | 33 | #include <linux/input/matrix_keypad.h> |
34 | #include <linux/clk/tegra.h> | 34 | #include <linux/reset.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | 36 | ||
37 | #define KBC_MAX_KPENT 8 | 37 | #define KBC_MAX_KPENT 8 |
@@ -116,6 +116,7 @@ struct tegra_kbc { | |||
116 | u32 wakeup_key; | 116 | u32 wakeup_key; |
117 | struct timer_list timer; | 117 | struct timer_list timer; |
118 | struct clk *clk; | 118 | struct clk *clk; |
119 | struct reset_control *rst; | ||
119 | const struct tegra_kbc_hw_support *hw_support; | 120 | const struct tegra_kbc_hw_support *hw_support; |
120 | int max_keys; | 121 | int max_keys; |
121 | int num_rows_and_columns; | 122 | int num_rows_and_columns; |
@@ -373,9 +374,9 @@ static int tegra_kbc_start(struct tegra_kbc *kbc) | |||
373 | clk_prepare_enable(kbc->clk); | 374 | clk_prepare_enable(kbc->clk); |
374 | 375 | ||
375 | /* Reset the KBC controller to clear all previous status.*/ | 376 | /* Reset the KBC controller to clear all previous status.*/ |
376 | tegra_periph_reset_assert(kbc->clk); | 377 | reset_control_assert(kbc->rst); |
377 | udelay(100); | 378 | udelay(100); |
378 | tegra_periph_reset_deassert(kbc->clk); | 379 | reset_control_assert(kbc->rst); |
379 | udelay(100); | 380 | udelay(100); |
380 | 381 | ||
381 | tegra_kbc_config_pins(kbc); | 382 | tegra_kbc_config_pins(kbc); |
@@ -663,6 +664,12 @@ static int tegra_kbc_probe(struct platform_device *pdev) | |||
663 | return PTR_ERR(kbc->clk); | 664 | return PTR_ERR(kbc->clk); |
664 | } | 665 | } |
665 | 666 | ||
667 | kbc->rst = devm_reset_control_get(&pdev->dev, "kbc"); | ||
668 | if (IS_ERR(kbc->rst)) { | ||
669 | dev_err(&pdev->dev, "failed to get keyboard reset\n"); | ||
670 | return PTR_ERR(kbc->rst); | ||
671 | } | ||
672 | |||
666 | /* | 673 | /* |
667 | * The time delay between two consecutive reads of the FIFO is | 674 | * The time delay between two consecutive reads of the FIFO is |
668 | * the sum of the repeat time and the time taken for scanning | 675 | * the sum of the repeat time and the time taken for scanning |
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index b8ba2f794559..330f7e3a32dd 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/clk/tegra.h> | ||
29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
30 | #include <linux/export.h> | 29 | #include <linux/export.h> |
31 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
@@ -39,6 +38,7 @@ | |||
39 | #include <linux/of_platform.h> | 38 | #include <linux/of_platform.h> |
40 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
41 | #include <linux/platform_device.h> | 40 | #include <linux/platform_device.h> |
41 | #include <linux/reset.h> | ||
42 | #include <linux/sizes.h> | 42 | #include <linux/sizes.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/tegra-cpuidle.h> | 44 | #include <linux/tegra-cpuidle.h> |
@@ -259,10 +259,13 @@ struct tegra_pcie { | |||
259 | 259 | ||
260 | struct clk *pex_clk; | 260 | struct clk *pex_clk; |
261 | struct clk *afi_clk; | 261 | struct clk *afi_clk; |
262 | struct clk *pcie_xclk; | ||
263 | struct clk *pll_e; | 262 | struct clk *pll_e; |
264 | struct clk *cml_clk; | 263 | struct clk *cml_clk; |
265 | 264 | ||
265 | struct reset_control *pex_rst; | ||
266 | struct reset_control *afi_rst; | ||
267 | struct reset_control *pcie_xrst; | ||
268 | |||
266 | struct tegra_msi msi; | 269 | struct tegra_msi msi; |
267 | 270 | ||
268 | struct list_head ports; | 271 | struct list_head ports; |
@@ -858,7 +861,7 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie) | |||
858 | pads_writel(pcie, value, PADS_CTL); | 861 | pads_writel(pcie, value, PADS_CTL); |
859 | 862 | ||
860 | /* take the PCIe interface module out of reset */ | 863 | /* take the PCIe interface module out of reset */ |
861 | tegra_periph_reset_deassert(pcie->pcie_xclk); | 864 | reset_control_deassert(pcie->pcie_xrst); |
862 | 865 | ||
863 | /* finally enable PCIe */ | 866 | /* finally enable PCIe */ |
864 | value = afi_readl(pcie, AFI_CONFIGURATION); | 867 | value = afi_readl(pcie, AFI_CONFIGURATION); |
@@ -891,9 +894,9 @@ static void tegra_pcie_power_off(struct tegra_pcie *pcie) | |||
891 | 894 | ||
892 | /* TODO: disable and unprepare clocks? */ | 895 | /* TODO: disable and unprepare clocks? */ |
893 | 896 | ||
894 | tegra_periph_reset_assert(pcie->pcie_xclk); | 897 | reset_control_assert(pcie->pcie_xrst); |
895 | tegra_periph_reset_assert(pcie->afi_clk); | 898 | reset_control_assert(pcie->afi_rst); |
896 | tegra_periph_reset_assert(pcie->pex_clk); | 899 | reset_control_assert(pcie->pex_rst); |
897 | 900 | ||
898 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | 901 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); |
899 | 902 | ||
@@ -921,9 +924,9 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie) | |||
921 | const struct tegra_pcie_soc_data *soc = pcie->soc_data; | 924 | const struct tegra_pcie_soc_data *soc = pcie->soc_data; |
922 | int err; | 925 | int err; |
923 | 926 | ||
924 | tegra_periph_reset_assert(pcie->pcie_xclk); | 927 | reset_control_assert(pcie->pcie_xrst); |
925 | tegra_periph_reset_assert(pcie->afi_clk); | 928 | reset_control_assert(pcie->afi_rst); |
926 | tegra_periph_reset_assert(pcie->pex_clk); | 929 | reset_control_assert(pcie->pex_rst); |
927 | 930 | ||
928 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | 931 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); |
929 | 932 | ||
@@ -952,13 +955,14 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie) | |||
952 | } | 955 | } |
953 | 956 | ||
954 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE, | 957 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE, |
955 | pcie->pex_clk); | 958 | pcie->pex_clk, |
959 | pcie->pex_rst); | ||
956 | if (err) { | 960 | if (err) { |
957 | dev_err(pcie->dev, "powerup sequence failed: %d\n", err); | 961 | dev_err(pcie->dev, "powerup sequence failed: %d\n", err); |
958 | return err; | 962 | return err; |
959 | } | 963 | } |
960 | 964 | ||
961 | tegra_periph_reset_deassert(pcie->afi_clk); | 965 | reset_control_deassert(pcie->afi_rst); |
962 | 966 | ||
963 | err = clk_prepare_enable(pcie->afi_clk); | 967 | err = clk_prepare_enable(pcie->afi_clk); |
964 | if (err < 0) { | 968 | if (err < 0) { |
@@ -996,10 +1000,6 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie) | |||
996 | if (IS_ERR(pcie->afi_clk)) | 1000 | if (IS_ERR(pcie->afi_clk)) |
997 | return PTR_ERR(pcie->afi_clk); | 1001 | return PTR_ERR(pcie->afi_clk); |
998 | 1002 | ||
999 | pcie->pcie_xclk = devm_clk_get(pcie->dev, "pcie_xclk"); | ||
1000 | if (IS_ERR(pcie->pcie_xclk)) | ||
1001 | return PTR_ERR(pcie->pcie_xclk); | ||
1002 | |||
1003 | pcie->pll_e = devm_clk_get(pcie->dev, "pll_e"); | 1003 | pcie->pll_e = devm_clk_get(pcie->dev, "pll_e"); |
1004 | if (IS_ERR(pcie->pll_e)) | 1004 | if (IS_ERR(pcie->pll_e)) |
1005 | return PTR_ERR(pcie->pll_e); | 1005 | return PTR_ERR(pcie->pll_e); |
@@ -1013,6 +1013,23 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie) | |||
1013 | return 0; | 1013 | return 0; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static int tegra_pcie_resets_get(struct tegra_pcie *pcie) | ||
1017 | { | ||
1018 | pcie->pex_rst = devm_reset_control_get(pcie->dev, "pex"); | ||
1019 | if (IS_ERR(pcie->pex_rst)) | ||
1020 | return PTR_ERR(pcie->pex_rst); | ||
1021 | |||
1022 | pcie->afi_rst = devm_reset_control_get(pcie->dev, "afi"); | ||
1023 | if (IS_ERR(pcie->afi_rst)) | ||
1024 | return PTR_ERR(pcie->afi_rst); | ||
1025 | |||
1026 | pcie->pcie_xrst = devm_reset_control_get(pcie->dev, "pcie_x"); | ||
1027 | if (IS_ERR(pcie->pcie_xrst)) | ||
1028 | return PTR_ERR(pcie->pcie_xrst); | ||
1029 | |||
1030 | return 0; | ||
1031 | } | ||
1032 | |||
1016 | static int tegra_pcie_get_resources(struct tegra_pcie *pcie) | 1033 | static int tegra_pcie_get_resources(struct tegra_pcie *pcie) |
1017 | { | 1034 | { |
1018 | struct platform_device *pdev = to_platform_device(pcie->dev); | 1035 | struct platform_device *pdev = to_platform_device(pcie->dev); |
@@ -1025,6 +1042,12 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie) | |||
1025 | return err; | 1042 | return err; |
1026 | } | 1043 | } |
1027 | 1044 | ||
1045 | err = tegra_pcie_resets_get(pcie); | ||
1046 | if (err) { | ||
1047 | dev_err(&pdev->dev, "failed to get resets: %d\n", err); | ||
1048 | return err; | ||
1049 | } | ||
1050 | |||
1028 | err = tegra_pcie_power_on(pcie); | 1051 | err = tegra_pcie_power_on(pcie); |
1029 | if (err) { | 1052 | if (err) { |
1030 | dev_err(&pdev->dev, "failed to power up: %d\n", err); | 1053 | dev_err(&pdev->dev, "failed to power up: %d\n", err); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index e2dd2fbec5ee..385602f77cad 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -448,6 +448,7 @@ config SPI_MXS | |||
448 | config SPI_TEGRA114 | 448 | config SPI_TEGRA114 |
449 | tristate "NVIDIA Tegra114 SPI Controller" | 449 | tristate "NVIDIA Tegra114 SPI Controller" |
450 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST | 450 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST |
451 | depends on RESET_CONTROLLER | ||
451 | help | 452 | help |
452 | SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller | 453 | SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller |
453 | is different than the older SoCs SPI controller and also register interface | 454 | is different than the older SoCs SPI controller and also register interface |
@@ -456,6 +457,7 @@ config SPI_TEGRA114 | |||
456 | config SPI_TEGRA20_SFLASH | 457 | config SPI_TEGRA20_SFLASH |
457 | tristate "Nvidia Tegra20 Serial flash Controller" | 458 | tristate "Nvidia Tegra20 Serial flash Controller" |
458 | depends on ARCH_TEGRA || COMPILE_TEST | 459 | depends on ARCH_TEGRA || COMPILE_TEST |
460 | depends on RESET_CONTROLLER | ||
459 | help | 461 | help |
460 | SPI driver for Nvidia Tegra20 Serial flash Controller interface. | 462 | SPI driver for Nvidia Tegra20 Serial flash Controller interface. |
461 | The main usecase of this controller is to use spi flash as boot | 463 | The main usecase of this controller is to use spi flash as boot |
@@ -464,6 +466,7 @@ config SPI_TEGRA20_SFLASH | |||
464 | config SPI_TEGRA20_SLINK | 466 | config SPI_TEGRA20_SLINK |
465 | tristate "Nvidia Tegra20/Tegra30 SLINK Controller" | 467 | tristate "Nvidia Tegra20/Tegra30 SLINK Controller" |
466 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST | 468 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST |
469 | depends on RESET_CONTROLLER | ||
467 | help | 470 | help |
468 | SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface. | 471 | SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface. |
469 | 472 | ||
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index aaecfb3ebf58..c8604981a058 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c | |||
@@ -17,7 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/clk/tegra.h> | ||
21 | #include <linux/completion.h> | 20 | #include <linux/completion.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/dmaengine.h> | 22 | #include <linux/dmaengine.h> |
@@ -34,6 +33,7 @@ | |||
34 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
35 | #include <linux/of.h> | 34 | #include <linux/of.h> |
36 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
36 | #include <linux/reset.h> | ||
37 | #include <linux/spi/spi.h> | 37 | #include <linux/spi/spi.h> |
38 | 38 | ||
39 | #define SPI_COMMAND1 0x000 | 39 | #define SPI_COMMAND1 0x000 |
@@ -174,10 +174,10 @@ struct tegra_spi_data { | |||
174 | spinlock_t lock; | 174 | spinlock_t lock; |
175 | 175 | ||
176 | struct clk *clk; | 176 | struct clk *clk; |
177 | struct reset_control *rst; | ||
177 | void __iomem *base; | 178 | void __iomem *base; |
178 | phys_addr_t phys; | 179 | phys_addr_t phys; |
179 | unsigned irq; | 180 | unsigned irq; |
180 | int dma_req_sel; | ||
181 | u32 spi_max_frequency; | 181 | u32 spi_max_frequency; |
182 | u32 cur_speed; | 182 | u32 cur_speed; |
183 | 183 | ||
@@ -600,15 +600,15 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, | |||
600 | dma_addr_t dma_phys; | 600 | dma_addr_t dma_phys; |
601 | int ret; | 601 | int ret; |
602 | struct dma_slave_config dma_sconfig; | 602 | struct dma_slave_config dma_sconfig; |
603 | dma_cap_mask_t mask; | ||
604 | 603 | ||
605 | dma_cap_zero(mask); | 604 | dma_chan = dma_request_slave_channel_reason(tspi->dev, |
606 | dma_cap_set(DMA_SLAVE, mask); | 605 | dma_to_memory ? "rx" : "tx"); |
607 | dma_chan = dma_request_channel(mask, NULL, NULL); | 606 | if (IS_ERR(dma_chan)) { |
608 | if (!dma_chan) { | 607 | ret = PTR_ERR(dma_chan); |
609 | dev_err(tspi->dev, | 608 | if (ret != -EPROBE_DEFER) |
610 | "Dma channel is not available, will try later\n"); | 609 | dev_err(tspi->dev, |
611 | return -EPROBE_DEFER; | 610 | "Dma channel is not available: %d\n", ret); |
611 | return ret; | ||
612 | } | 612 | } |
613 | 613 | ||
614 | dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size, | 614 | dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size, |
@@ -619,7 +619,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, | |||
619 | return -ENOMEM; | 619 | return -ENOMEM; |
620 | } | 620 | } |
621 | 621 | ||
622 | dma_sconfig.slave_id = tspi->dma_req_sel; | ||
623 | if (dma_to_memory) { | 622 | if (dma_to_memory) { |
624 | dma_sconfig.src_addr = tspi->phys + SPI_RX_FIFO; | 623 | dma_sconfig.src_addr = tspi->phys + SPI_RX_FIFO; |
625 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 624 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
@@ -918,9 +917,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_spi_data *tspi) | |||
918 | tspi->status_reg); | 917 | tspi->status_reg); |
919 | dev_err(tspi->dev, "CpuXfer 0x%08x:0x%08x\n", | 918 | dev_err(tspi->dev, "CpuXfer 0x%08x:0x%08x\n", |
920 | tspi->command1_reg, tspi->dma_control_reg); | 919 | tspi->command1_reg, tspi->dma_control_reg); |
921 | tegra_periph_reset_assert(tspi->clk); | 920 | reset_control_assert(tspi->rst); |
922 | udelay(2); | 921 | udelay(2); |
923 | tegra_periph_reset_deassert(tspi->clk); | 922 | reset_control_deassert(tspi->rst); |
924 | complete(&tspi->xfer_completion); | 923 | complete(&tspi->xfer_completion); |
925 | goto exit; | 924 | goto exit; |
926 | } | 925 | } |
@@ -990,9 +989,9 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_spi_data *tspi) | |||
990 | tspi->status_reg); | 989 | tspi->status_reg); |
991 | dev_err(tspi->dev, "DmaXfer 0x%08x:0x%08x\n", | 990 | dev_err(tspi->dev, "DmaXfer 0x%08x:0x%08x\n", |
992 | tspi->command1_reg, tspi->dma_control_reg); | 991 | tspi->command1_reg, tspi->dma_control_reg); |
993 | tegra_periph_reset_assert(tspi->clk); | 992 | reset_control_assert(tspi->rst); |
994 | udelay(2); | 993 | udelay(2); |
995 | tegra_periph_reset_deassert(tspi->clk); | 994 | reset_control_deassert(tspi->rst); |
996 | complete(&tspi->xfer_completion); | 995 | complete(&tspi->xfer_completion); |
997 | spin_unlock_irqrestore(&tspi->lock, flags); | 996 | spin_unlock_irqrestore(&tspi->lock, flags); |
998 | return IRQ_HANDLED; | 997 | return IRQ_HANDLED; |
@@ -1054,11 +1053,6 @@ static void tegra_spi_parse_dt(struct platform_device *pdev, | |||
1054 | struct tegra_spi_data *tspi) | 1053 | struct tegra_spi_data *tspi) |
1055 | { | 1054 | { |
1056 | struct device_node *np = pdev->dev.of_node; | 1055 | struct device_node *np = pdev->dev.of_node; |
1057 | u32 of_dma[2]; | ||
1058 | |||
1059 | if (of_property_read_u32_array(np, "nvidia,dma-request-selector", | ||
1060 | of_dma, 2) >= 0) | ||
1061 | tspi->dma_req_sel = of_dma[1]; | ||
1062 | 1056 | ||
1063 | if (of_property_read_u32(np, "spi-max-frequency", | 1057 | if (of_property_read_u32(np, "spi-max-frequency", |
1064 | &tspi->spi_max_frequency)) | 1058 | &tspi->spi_max_frequency)) |
@@ -1127,25 +1121,25 @@ static int tegra_spi_probe(struct platform_device *pdev) | |||
1127 | goto exit_free_irq; | 1121 | goto exit_free_irq; |
1128 | } | 1122 | } |
1129 | 1123 | ||
1124 | tspi->rst = devm_reset_control_get(&pdev->dev, "spi"); | ||
1125 | if (IS_ERR(tspi->rst)) { | ||
1126 | dev_err(&pdev->dev, "can not get reset\n"); | ||
1127 | ret = PTR_ERR(tspi->rst); | ||
1128 | goto exit_free_irq; | ||
1129 | } | ||
1130 | |||
1130 | tspi->max_buf_size = SPI_FIFO_DEPTH << 2; | 1131 | tspi->max_buf_size = SPI_FIFO_DEPTH << 2; |
1131 | tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN; | 1132 | tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN; |
1132 | 1133 | ||
1133 | if (tspi->dma_req_sel) { | 1134 | ret = tegra_spi_init_dma_param(tspi, true); |
1134 | ret = tegra_spi_init_dma_param(tspi, true); | 1135 | if (ret < 0) |
1135 | if (ret < 0) { | 1136 | goto exit_free_irq; |
1136 | dev_err(&pdev->dev, "RxDma Init failed, err %d\n", ret); | 1137 | ret = tegra_spi_init_dma_param(tspi, false); |
1137 | goto exit_free_irq; | 1138 | if (ret < 0) |
1138 | } | 1139 | goto exit_rx_dma_free; |
1139 | 1140 | tspi->max_buf_size = tspi->dma_buf_size; | |
1140 | ret = tegra_spi_init_dma_param(tspi, false); | 1141 | init_completion(&tspi->tx_dma_complete); |
1141 | if (ret < 0) { | 1142 | init_completion(&tspi->rx_dma_complete); |
1142 | dev_err(&pdev->dev, "TxDma Init failed, err %d\n", ret); | ||
1143 | goto exit_rx_dma_free; | ||
1144 | } | ||
1145 | tspi->max_buf_size = tspi->dma_buf_size; | ||
1146 | init_completion(&tspi->tx_dma_complete); | ||
1147 | init_completion(&tspi->rx_dma_complete); | ||
1148 | } | ||
1149 | 1143 | ||
1150 | init_completion(&tspi->xfer_completion); | 1144 | init_completion(&tspi->xfer_completion); |
1151 | 1145 | ||
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 4dc8e8129459..e6f382b33818 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
33 | #include <linux/of.h> | 33 | #include <linux/of.h> |
34 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
35 | #include <linux/reset.h> | ||
35 | #include <linux/spi/spi.h> | 36 | #include <linux/spi/spi.h> |
36 | #include <linux/clk/tegra.h> | ||
37 | 37 | ||
38 | #define SPI_COMMAND 0x000 | 38 | #define SPI_COMMAND 0x000 |
39 | #define SPI_GO BIT(30) | 39 | #define SPI_GO BIT(30) |
@@ -118,6 +118,7 @@ struct tegra_sflash_data { | |||
118 | spinlock_t lock; | 118 | spinlock_t lock; |
119 | 119 | ||
120 | struct clk *clk; | 120 | struct clk *clk; |
121 | struct reset_control *rst; | ||
121 | void __iomem *base; | 122 | void __iomem *base; |
122 | unsigned irq; | 123 | unsigned irq; |
123 | u32 spi_max_frequency; | 124 | u32 spi_max_frequency; |
@@ -389,9 +390,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd) | |||
389 | dev_err(tsd->dev, | 390 | dev_err(tsd->dev, |
390 | "CpuXfer 0x%08x:0x%08x\n", tsd->command_reg, | 391 | "CpuXfer 0x%08x:0x%08x\n", tsd->command_reg, |
391 | tsd->dma_control_reg); | 392 | tsd->dma_control_reg); |
392 | tegra_periph_reset_assert(tsd->clk); | 393 | reset_control_assert(tsd->rst); |
393 | udelay(2); | 394 | udelay(2); |
394 | tegra_periph_reset_deassert(tsd->clk); | 395 | reset_control_deassert(tsd->rst); |
395 | complete(&tsd->xfer_completion); | 396 | complete(&tsd->xfer_completion); |
396 | goto exit; | 397 | goto exit; |
397 | } | 398 | } |
@@ -505,6 +506,13 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
505 | goto exit_free_irq; | 506 | goto exit_free_irq; |
506 | } | 507 | } |
507 | 508 | ||
509 | tsd->rst = devm_reset_control_get(&pdev->dev, "spi"); | ||
510 | if (IS_ERR(tsd->rst)) { | ||
511 | dev_err(&pdev->dev, "can not get reset\n"); | ||
512 | ret = PTR_ERR(tsd->rst); | ||
513 | goto exit_free_irq; | ||
514 | } | ||
515 | |||
508 | init_completion(&tsd->xfer_completion); | 516 | init_completion(&tsd->xfer_completion); |
509 | pm_runtime_enable(&pdev->dev); | 517 | pm_runtime_enable(&pdev->dev); |
510 | if (!pm_runtime_enabled(&pdev->dev)) { | 518 | if (!pm_runtime_enabled(&pdev->dev)) { |
@@ -520,9 +528,9 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
520 | } | 528 | } |
521 | 529 | ||
522 | /* Reset controller */ | 530 | /* Reset controller */ |
523 | tegra_periph_reset_assert(tsd->clk); | 531 | reset_control_assert(tsd->rst); |
524 | udelay(2); | 532 | udelay(2); |
525 | tegra_periph_reset_deassert(tsd->clk); | 533 | reset_control_deassert(tsd->rst); |
526 | 534 | ||
527 | tsd->def_command_reg = SPI_M_S | SPI_CS_SW; | 535 | tsd->def_command_reg = SPI_M_S | SPI_CS_SW; |
528 | tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); | 536 | tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); |
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index e66715ba37ed..a728bb82090f 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
34 | #include <linux/of.h> | 34 | #include <linux/of.h> |
35 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
36 | #include <linux/reset.h> | ||
36 | #include <linux/spi/spi.h> | 37 | #include <linux/spi/spi.h> |
37 | #include <linux/clk/tegra.h> | ||
38 | 38 | ||
39 | #define SLINK_COMMAND 0x000 | 39 | #define SLINK_COMMAND 0x000 |
40 | #define SLINK_BIT_LENGTH(x) (((x) & 0x1f) << 0) | 40 | #define SLINK_BIT_LENGTH(x) (((x) & 0x1f) << 0) |
@@ -167,10 +167,10 @@ struct tegra_slink_data { | |||
167 | spinlock_t lock; | 167 | spinlock_t lock; |
168 | 168 | ||
169 | struct clk *clk; | 169 | struct clk *clk; |
170 | struct reset_control *rst; | ||
170 | void __iomem *base; | 171 | void __iomem *base; |
171 | phys_addr_t phys; | 172 | phys_addr_t phys; |
172 | unsigned irq; | 173 | unsigned irq; |
173 | int dma_req_sel; | ||
174 | u32 spi_max_frequency; | 174 | u32 spi_max_frequency; |
175 | u32 cur_speed; | 175 | u32 cur_speed; |
176 | 176 | ||
@@ -629,15 +629,15 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi, | |||
629 | dma_addr_t dma_phys; | 629 | dma_addr_t dma_phys; |
630 | int ret; | 630 | int ret; |
631 | struct dma_slave_config dma_sconfig; | 631 | struct dma_slave_config dma_sconfig; |
632 | dma_cap_mask_t mask; | ||
633 | 632 | ||
634 | dma_cap_zero(mask); | 633 | dma_chan = dma_request_slave_channel_reason(tspi->dev, |
635 | dma_cap_set(DMA_SLAVE, mask); | 634 | dma_to_memory ? "rx" : "tx"); |
636 | dma_chan = dma_request_channel(mask, NULL, NULL); | 635 | if (IS_ERR(dma_chan)) { |
637 | if (!dma_chan) { | 636 | ret = PTR_ERR(dma_chan); |
638 | dev_err(tspi->dev, | 637 | if (ret != -EPROBE_DEFER) |
639 | "Dma channel is not available, will try later\n"); | 638 | dev_err(tspi->dev, |
640 | return -EPROBE_DEFER; | 639 | "Dma channel is not available: %d\n", ret); |
640 | return ret; | ||
641 | } | 641 | } |
642 | 642 | ||
643 | dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size, | 643 | dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size, |
@@ -648,7 +648,6 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi, | |||
648 | return -ENOMEM; | 648 | return -ENOMEM; |
649 | } | 649 | } |
650 | 650 | ||
651 | dma_sconfig.slave_id = tspi->dma_req_sel; | ||
652 | if (dma_to_memory) { | 651 | if (dma_to_memory) { |
653 | dma_sconfig.src_addr = tspi->phys + SLINK_RX_FIFO; | 652 | dma_sconfig.src_addr = tspi->phys + SLINK_RX_FIFO; |
654 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 653 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
@@ -884,9 +883,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_slink_data *tspi) | |||
884 | dev_err(tspi->dev, | 883 | dev_err(tspi->dev, |
885 | "CpuXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg, | 884 | "CpuXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg, |
886 | tspi->command2_reg, tspi->dma_control_reg); | 885 | tspi->command2_reg, tspi->dma_control_reg); |
887 | tegra_periph_reset_assert(tspi->clk); | 886 | reset_control_assert(tspi->rst); |
888 | udelay(2); | 887 | udelay(2); |
889 | tegra_periph_reset_deassert(tspi->clk); | 888 | reset_control_deassert(tspi->rst); |
890 | complete(&tspi->xfer_completion); | 889 | complete(&tspi->xfer_completion); |
891 | goto exit; | 890 | goto exit; |
892 | } | 891 | } |
@@ -957,9 +956,9 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_slink_data *tspi) | |||
957 | dev_err(tspi->dev, | 956 | dev_err(tspi->dev, |
958 | "DmaXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg, | 957 | "DmaXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg, |
959 | tspi->command2_reg, tspi->dma_control_reg); | 958 | tspi->command2_reg, tspi->dma_control_reg); |
960 | tegra_periph_reset_assert(tspi->clk); | 959 | reset_control_assert(tspi->rst); |
961 | udelay(2); | 960 | udelay(2); |
962 | tegra_periph_reset_deassert(tspi->clk); | 961 | reset_control_assert(tspi->rst); |
963 | complete(&tspi->xfer_completion); | 962 | complete(&tspi->xfer_completion); |
964 | spin_unlock_irqrestore(&tspi->lock, flags); | 963 | spin_unlock_irqrestore(&tspi->lock, flags); |
965 | return IRQ_HANDLED; | 964 | return IRQ_HANDLED; |
@@ -1020,11 +1019,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data) | |||
1020 | static void tegra_slink_parse_dt(struct tegra_slink_data *tspi) | 1019 | static void tegra_slink_parse_dt(struct tegra_slink_data *tspi) |
1021 | { | 1020 | { |
1022 | struct device_node *np = tspi->dev->of_node; | 1021 | struct device_node *np = tspi->dev->of_node; |
1023 | u32 of_dma[2]; | ||
1024 | |||
1025 | if (of_property_read_u32_array(np, "nvidia,dma-request-selector", | ||
1026 | of_dma, 2) >= 0) | ||
1027 | tspi->dma_req_sel = of_dma[1]; | ||
1028 | 1022 | ||
1029 | if (of_property_read_u32(np, "spi-max-frequency", | 1023 | if (of_property_read_u32(np, "spi-max-frequency", |
1030 | &tspi->spi_max_frequency)) | 1024 | &tspi->spi_max_frequency)) |
@@ -1118,25 +1112,25 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
1118 | goto exit_free_irq; | 1112 | goto exit_free_irq; |
1119 | } | 1113 | } |
1120 | 1114 | ||
1115 | tspi->rst = devm_reset_control_get(&pdev->dev, "spi"); | ||
1116 | if (IS_ERR(tspi->rst)) { | ||
1117 | dev_err(&pdev->dev, "can not get reset\n"); | ||
1118 | ret = PTR_ERR(tspi->rst); | ||
1119 | goto exit_free_irq; | ||
1120 | } | ||
1121 | |||
1121 | tspi->max_buf_size = SLINK_FIFO_DEPTH << 2; | 1122 | tspi->max_buf_size = SLINK_FIFO_DEPTH << 2; |
1122 | tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN; | 1123 | tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN; |
1123 | 1124 | ||
1124 | if (tspi->dma_req_sel) { | 1125 | ret = tegra_slink_init_dma_param(tspi, true); |
1125 | ret = tegra_slink_init_dma_param(tspi, true); | 1126 | if (ret < 0) |
1126 | if (ret < 0) { | 1127 | goto exit_free_irq; |
1127 | dev_err(&pdev->dev, "RxDma Init failed, err %d\n", ret); | 1128 | ret = tegra_slink_init_dma_param(tspi, false); |
1128 | goto exit_free_irq; | 1129 | if (ret < 0) |
1129 | } | 1130 | goto exit_rx_dma_free; |
1130 | 1131 | tspi->max_buf_size = tspi->dma_buf_size; | |
1131 | ret = tegra_slink_init_dma_param(tspi, false); | 1132 | init_completion(&tspi->tx_dma_complete); |
1132 | if (ret < 0) { | 1133 | init_completion(&tspi->rx_dma_complete); |
1133 | dev_err(&pdev->dev, "TxDma Init failed, err %d\n", ret); | ||
1134 | goto exit_rx_dma_free; | ||
1135 | } | ||
1136 | tspi->max_buf_size = tspi->dma_buf_size; | ||
1137 | init_completion(&tspi->tx_dma_complete); | ||
1138 | init_completion(&tspi->rx_dma_complete); | ||
1139 | } | ||
1140 | 1134 | ||
1141 | init_completion(&tspi->xfer_completion); | 1135 | init_completion(&tspi->xfer_completion); |
1142 | 1136 | ||
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index bb152201e93d..3ee0b1887a54 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/clk/tegra.h> | ||
40 | 39 | ||
41 | #include "nvec.h" | 40 | #include "nvec.h" |
42 | 41 | ||
@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec) | |||
734 | 733 | ||
735 | clk_prepare_enable(nvec->i2c_clk); | 734 | clk_prepare_enable(nvec->i2c_clk); |
736 | 735 | ||
737 | tegra_periph_reset_assert(nvec->i2c_clk); | 736 | reset_control_assert(nvec->rst); |
738 | udelay(2); | 737 | udelay(2); |
739 | tegra_periph_reset_deassert(nvec->i2c_clk); | 738 | reset_control_deassert(nvec->rst); |
740 | 739 | ||
741 | val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN | | 740 | val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN | |
742 | (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); | 741 | (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); |
@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev) | |||
837 | return -ENODEV; | 836 | return -ENODEV; |
838 | } | 837 | } |
839 | 838 | ||
839 | nvec->rst = devm_reset_control_get(&pdev->dev, "i2c"); | ||
840 | if (IS_ERR(nvec->rst)) { | ||
841 | dev_err(nvec->dev, "failed to get controller reset\n"); | ||
842 | return PTR_ERR(nvec->rst); | ||
843 | } | ||
844 | |||
840 | nvec->base = base; | 845 | nvec->base = base; |
841 | nvec->irq = res->start; | 846 | nvec->irq = res->start; |
842 | nvec->i2c_clk = i2c_clk; | 847 | nvec->i2c_clk = i2c_clk; |
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index e880518935fb..e271375053fa 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/notifier.h> | 25 | #include <linux/notifier.h> |
26 | #include <linux/reset.h> | ||
26 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
27 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
28 | 29 | ||
@@ -109,7 +110,8 @@ struct nvec_msg { | |||
109 | * @irq: The IRQ of the I2C device | 110 | * @irq: The IRQ of the I2C device |
110 | * @i2c_addr: The address of the I2C slave | 111 | * @i2c_addr: The address of the I2C slave |
111 | * @base: The base of the memory mapped region of the I2C device | 112 | * @base: The base of the memory mapped region of the I2C device |
112 | * @clk: The clock of the I2C device | 113 | * @i2c_clk: The clock of the I2C device |
114 | * @rst: The reset of the I2C device | ||
113 | * @notifier_list: Notifiers to be called on received messages, see | 115 | * @notifier_list: Notifiers to be called on received messages, see |
114 | * nvec_register_notifier() | 116 | * nvec_register_notifier() |
115 | * @rx_data: Received messages that have to be processed | 117 | * @rx_data: Received messages that have to be processed |
@@ -139,6 +141,7 @@ struct nvec_chip { | |||
139 | int i2c_addr; | 141 | int i2c_addr; |
140 | void __iomem *base; | 142 | void __iomem *base; |
141 | struct clk *i2c_clk; | 143 | struct clk *i2c_clk; |
144 | struct reset_control *rst; | ||
142 | struct atomic_notifier_head notifier_list; | 145 | struct atomic_notifier_head notifier_list; |
143 | struct list_head rx_data, tx_data; | 146 | struct list_head rx_data, tx_data; |
144 | struct notifier_block nvec_status_notifier; | 147 | struct notifier_block nvec_status_notifier; |
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index dfe79ccc4fb3..d5c2a287b7e7 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/reset.h> | ||
37 | #include <linux/serial.h> | 38 | #include <linux/serial.h> |
38 | #include <linux/serial_8250.h> | 39 | #include <linux/serial_8250.h> |
39 | #include <linux/serial_core.h> | 40 | #include <linux/serial_core.h> |
@@ -44,8 +45,6 @@ | |||
44 | #include <linux/tty.h> | 45 | #include <linux/tty.h> |
45 | #include <linux/tty_flip.h> | 46 | #include <linux/tty_flip.h> |
46 | 47 | ||
47 | #include <linux/clk/tegra.h> | ||
48 | |||
49 | #define TEGRA_UART_TYPE "TEGRA_UART" | 48 | #define TEGRA_UART_TYPE "TEGRA_UART" |
50 | #define TX_EMPTY_STATUS (UART_LSR_TEMT | UART_LSR_THRE) | 49 | #define TX_EMPTY_STATUS (UART_LSR_TEMT | UART_LSR_THRE) |
51 | #define BYTES_TO_ALIGN(x) ((unsigned long)(x) & 0x3) | 50 | #define BYTES_TO_ALIGN(x) ((unsigned long)(x) & 0x3) |
@@ -103,6 +102,7 @@ struct tegra_uart_port { | |||
103 | const struct tegra_uart_chip_data *cdata; | 102 | const struct tegra_uart_chip_data *cdata; |
104 | 103 | ||
105 | struct clk *uart_clk; | 104 | struct clk *uart_clk; |
105 | struct reset_control *rst; | ||
106 | unsigned int current_baud; | 106 | unsigned int current_baud; |
107 | 107 | ||
108 | /* Register shadow */ | 108 | /* Register shadow */ |
@@ -120,7 +120,6 @@ struct tegra_uart_port { | |||
120 | bool rx_timeout; | 120 | bool rx_timeout; |
121 | int rx_in_progress; | 121 | int rx_in_progress; |
122 | int symb_bit; | 122 | int symb_bit; |
123 | int dma_req_sel; | ||
124 | 123 | ||
125 | struct dma_chan *rx_dma_chan; | 124 | struct dma_chan *rx_dma_chan; |
126 | struct dma_chan *tx_dma_chan; | 125 | struct dma_chan *tx_dma_chan; |
@@ -832,9 +831,9 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) | |||
832 | clk_prepare_enable(tup->uart_clk); | 831 | clk_prepare_enable(tup->uart_clk); |
833 | 832 | ||
834 | /* Reset the UART controller to clear all previous status.*/ | 833 | /* Reset the UART controller to clear all previous status.*/ |
835 | tegra_periph_reset_assert(tup->uart_clk); | 834 | reset_control_assert(tup->rst); |
836 | udelay(10); | 835 | udelay(10); |
837 | tegra_periph_reset_deassert(tup->uart_clk); | 836 | reset_control_deassert(tup->rst); |
838 | 837 | ||
839 | tup->rx_in_progress = 0; | 838 | tup->rx_in_progress = 0; |
840 | tup->tx_in_progress = 0; | 839 | tup->tx_in_progress = 0; |
@@ -910,15 +909,14 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, | |||
910 | dma_addr_t dma_phys; | 909 | dma_addr_t dma_phys; |
911 | int ret; | 910 | int ret; |
912 | struct dma_slave_config dma_sconfig; | 911 | struct dma_slave_config dma_sconfig; |
913 | dma_cap_mask_t mask; | ||
914 | 912 | ||
915 | dma_cap_zero(mask); | 913 | dma_chan = dma_request_slave_channel_reason(tup->uport.dev, |
916 | dma_cap_set(DMA_SLAVE, mask); | 914 | dma_to_memory ? "rx" : "tx"); |
917 | dma_chan = dma_request_channel(mask, NULL, NULL); | 915 | if (IS_ERR(dma_chan)) { |
918 | if (!dma_chan) { | 916 | ret = PTR_ERR(dma_chan); |
919 | dev_err(tup->uport.dev, | 917 | dev_err(tup->uport.dev, |
920 | "Dma channel is not available, will try later\n"); | 918 | "DMA channel alloc failed: %d\n", ret); |
921 | return -EPROBE_DEFER; | 919 | return ret; |
922 | } | 920 | } |
923 | 921 | ||
924 | if (dma_to_memory) { | 922 | if (dma_to_memory) { |
@@ -938,7 +936,6 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, | |||
938 | dma_buf = tup->uport.state->xmit.buf; | 936 | dma_buf = tup->uport.state->xmit.buf; |
939 | } | 937 | } |
940 | 938 | ||
941 | dma_sconfig.slave_id = tup->dma_req_sel; | ||
942 | if (dma_to_memory) { | 939 | if (dma_to_memory) { |
943 | dma_sconfig.src_addr = tup->uport.mapbase; | 940 | dma_sconfig.src_addr = tup->uport.mapbase; |
944 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | 941 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; |
@@ -1222,17 +1219,8 @@ static int tegra_uart_parse_dt(struct platform_device *pdev, | |||
1222 | struct tegra_uart_port *tup) | 1219 | struct tegra_uart_port *tup) |
1223 | { | 1220 | { |
1224 | struct device_node *np = pdev->dev.of_node; | 1221 | struct device_node *np = pdev->dev.of_node; |
1225 | u32 of_dma[2]; | ||
1226 | int port; | 1222 | int port; |
1227 | 1223 | ||
1228 | if (of_property_read_u32_array(np, "nvidia,dma-request-selector", | ||
1229 | of_dma, 2) >= 0) { | ||
1230 | tup->dma_req_sel = of_dma[1]; | ||
1231 | } else { | ||
1232 | dev_err(&pdev->dev, "missing dma requestor in device tree\n"); | ||
1233 | return -EINVAL; | ||
1234 | } | ||
1235 | |||
1236 | port = of_alias_get_id(np, "serial"); | 1224 | port = of_alias_get_id(np, "serial"); |
1237 | if (port < 0) { | 1225 | if (port < 0) { |
1238 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port); | 1226 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port); |
@@ -1320,6 +1308,12 @@ static int tegra_uart_probe(struct platform_device *pdev) | |||
1320 | return PTR_ERR(tup->uart_clk); | 1308 | return PTR_ERR(tup->uart_clk); |
1321 | } | 1309 | } |
1322 | 1310 | ||
1311 | tup->rst = devm_reset_control_get(&pdev->dev, "serial"); | ||
1312 | if (IS_ERR(tup->rst)) { | ||
1313 | dev_err(&pdev->dev, "Couldn't get the reset\n"); | ||
1314 | return PTR_ERR(tup->rst); | ||
1315 | } | ||
1316 | |||
1323 | u->iotype = UPIO_MEM32; | 1317 | u->iotype = UPIO_MEM32; |
1324 | u->irq = platform_get_irq(pdev, 0); | 1318 | u->irq = platform_get_irq(pdev, 0); |
1325 | u->regshift = 2; | 1319 | u->regshift = 2; |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7d8103cd3e2e..e4bf0e435af6 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -23,35 +23,34 @@ | |||
23 | 23 | ||
24 | #undef DEBUG | 24 | #undef DEBUG |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/console.h> | ||
28 | #include <linux/ctype.h> | ||
29 | #include <linux/cpufreq.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/dmaengine.h> | ||
32 | #include <linux/dma-mapping.h> | ||
33 | #include <linux/err.h> | ||
27 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
28 | #include <linux/sh_dma.h> | 35 | #include <linux/init.h> |
29 | #include <linux/timer.h> | ||
30 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
31 | #include <linux/tty.h> | ||
32 | #include <linux/tty_flip.h> | ||
33 | #include <linux/serial.h> | ||
34 | #include <linux/major.h> | ||
35 | #include <linux/string.h> | ||
36 | #include <linux/sysrq.h> | ||
37 | #include <linux/ioport.h> | 37 | #include <linux/ioport.h> |
38 | #include <linux/major.h> | ||
39 | #include <linux/module.h> | ||
38 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
39 | #include <linux/init.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/console.h> | ||
42 | #include <linux/platform_device.h> | ||
43 | #include <linux/serial_sci.h> | ||
44 | #include <linux/notifier.h> | 41 | #include <linux/notifier.h> |
42 | #include <linux/platform_device.h> | ||
45 | #include <linux/pm_runtime.h> | 43 | #include <linux/pm_runtime.h> |
46 | #include <linux/cpufreq.h> | ||
47 | #include <linux/clk.h> | ||
48 | #include <linux/ctype.h> | ||
49 | #include <linux/err.h> | ||
50 | #include <linux/dmaengine.h> | ||
51 | #include <linux/dma-mapping.h> | ||
52 | #include <linux/scatterlist.h> | 44 | #include <linux/scatterlist.h> |
45 | #include <linux/serial.h> | ||
46 | #include <linux/serial_sci.h> | ||
47 | #include <linux/sh_dma.h> | ||
53 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
54 | #include <linux/gpio.h> | 49 | #include <linux/string.h> |
50 | #include <linux/sysrq.h> | ||
51 | #include <linux/timer.h> | ||
52 | #include <linux/tty.h> | ||
53 | #include <linux/tty_flip.h> | ||
55 | 54 | ||
56 | #ifdef CONFIG_SUPERH | 55 | #ifdef CONFIG_SUPERH |
57 | #include <asm/sh_bios.h> | 56 | #include <asm/sh_bios.h> |
@@ -64,6 +63,10 @@ struct sci_port { | |||
64 | 63 | ||
65 | /* Platform configuration */ | 64 | /* Platform configuration */ |
66 | struct plat_sci_port *cfg; | 65 | struct plat_sci_port *cfg; |
66 | int overrun_bit; | ||
67 | unsigned int error_mask; | ||
68 | unsigned int sampling_rate; | ||
69 | |||
67 | 70 | ||
68 | /* Break timer */ | 71 | /* Break timer */ |
69 | struct timer_list break_timer; | 72 | struct timer_list break_timer; |
@@ -74,8 +77,8 @@ struct sci_port { | |||
74 | /* Function clock */ | 77 | /* Function clock */ |
75 | struct clk *fclk; | 78 | struct clk *fclk; |
76 | 79 | ||
80 | int irqs[SCIx_NR_IRQS]; | ||
77 | char *irqstr[SCIx_NR_IRQS]; | 81 | char *irqstr[SCIx_NR_IRQS]; |
78 | char *gpiostr[SCIx_NR_FNS]; | ||
79 | 82 | ||
80 | struct dma_chan *chan_tx; | 83 | struct dma_chan *chan_tx; |
81 | struct dma_chan *chan_rx; | 84 | struct dma_chan *chan_rx; |
@@ -421,9 +424,9 @@ static void sci_port_enable(struct sci_port *sci_port) | |||
421 | 424 | ||
422 | pm_runtime_get_sync(sci_port->port.dev); | 425 | pm_runtime_get_sync(sci_port->port.dev); |
423 | 426 | ||
424 | clk_enable(sci_port->iclk); | 427 | clk_prepare_enable(sci_port->iclk); |
425 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | 428 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); |
426 | clk_enable(sci_port->fclk); | 429 | clk_prepare_enable(sci_port->fclk); |
427 | } | 430 | } |
428 | 431 | ||
429 | static void sci_port_disable(struct sci_port *sci_port) | 432 | static void sci_port_disable(struct sci_port *sci_port) |
@@ -431,8 +434,16 @@ static void sci_port_disable(struct sci_port *sci_port) | |||
431 | if (!sci_port->port.dev) | 434 | if (!sci_port->port.dev) |
432 | return; | 435 | return; |
433 | 436 | ||
434 | clk_disable(sci_port->fclk); | 437 | /* Cancel the break timer to ensure that the timer handler will not try |
435 | clk_disable(sci_port->iclk); | 438 | * to access the hardware with clocks and power disabled. Reset the |
439 | * break flag to make the break debouncing state machine ready for the | ||
440 | * next break. | ||
441 | */ | ||
442 | del_timer_sync(&sci_port->break_timer); | ||
443 | sci_port->break_flag = 0; | ||
444 | |||
445 | clk_disable_unprepare(sci_port->fclk); | ||
446 | clk_disable_unprepare(sci_port->iclk); | ||
436 | 447 | ||
437 | pm_runtime_put_sync(sci_port->port.dev); | 448 | pm_runtime_put_sync(sci_port->port.dev); |
438 | } | 449 | } |
@@ -557,7 +568,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
557 | return 1; | 568 | return 1; |
558 | 569 | ||
559 | /* Cast for ARM damage */ | 570 | /* Cast for ARM damage */ |
560 | return !!__raw_readb((void __iomem *)s->cfg->port_reg); | 571 | return !!__raw_readb((void __iomem *)(uintptr_t)s->cfg->port_reg); |
561 | } | 572 | } |
562 | 573 | ||
563 | /* ********************************************************************** * | 574 | /* ********************************************************************** * |
@@ -733,8 +744,6 @@ static void sci_break_timer(unsigned long data) | |||
733 | { | 744 | { |
734 | struct sci_port *port = (struct sci_port *)data; | 745 | struct sci_port *port = (struct sci_port *)data; |
735 | 746 | ||
736 | sci_port_enable(port); | ||
737 | |||
738 | if (sci_rxd_in(&port->port) == 0) { | 747 | if (sci_rxd_in(&port->port) == 0) { |
739 | port->break_flag = 1; | 748 | port->break_flag = 1; |
740 | sci_schedule_break_timer(port); | 749 | sci_schedule_break_timer(port); |
@@ -744,8 +753,6 @@ static void sci_break_timer(unsigned long data) | |||
744 | sci_schedule_break_timer(port); | 753 | sci_schedule_break_timer(port); |
745 | } else | 754 | } else |
746 | port->break_flag = 0; | 755 | port->break_flag = 0; |
747 | |||
748 | sci_port_disable(port); | ||
749 | } | 756 | } |
750 | 757 | ||
751 | static int sci_handle_errors(struct uart_port *port) | 758 | static int sci_handle_errors(struct uart_port *port) |
@@ -755,19 +762,15 @@ static int sci_handle_errors(struct uart_port *port) | |||
755 | struct tty_port *tport = &port->state->port; | 762 | struct tty_port *tport = &port->state->port; |
756 | struct sci_port *s = to_sci_port(port); | 763 | struct sci_port *s = to_sci_port(port); |
757 | 764 | ||
758 | /* | 765 | /* Handle overruns */ |
759 | * Handle overruns, if supported. | 766 | if (status & (1 << s->overrun_bit)) { |
760 | */ | 767 | port->icount.overrun++; |
761 | if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) { | ||
762 | if (status & (1 << s->cfg->overrun_bit)) { | ||
763 | port->icount.overrun++; | ||
764 | 768 | ||
765 | /* overrun error */ | 769 | /* overrun error */ |
766 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) | 770 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) |
767 | copied++; | 771 | copied++; |
768 | 772 | ||
769 | dev_notice(port->dev, "overrun error"); | 773 | dev_notice(port->dev, "overrun error"); |
770 | } | ||
771 | } | 774 | } |
772 | 775 | ||
773 | if (status & SCxSR_FER(port)) { | 776 | if (status & SCxSR_FER(port)) { |
@@ -829,7 +832,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
829 | if (!reg->size) | 832 | if (!reg->size) |
830 | return 0; | 833 | return 0; |
831 | 834 | ||
832 | if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { | 835 | if ((serial_port_in(port, SCLSR) & (1 << s->overrun_bit))) { |
833 | serial_port_out(port, SCLSR, 0); | 836 | serial_port_out(port, SCLSR, 0); |
834 | 837 | ||
835 | port->icount.overrun++; | 838 | port->icount.overrun++; |
@@ -1075,19 +1078,19 @@ static int sci_request_irq(struct sci_port *port) | |||
1075 | 1078 | ||
1076 | for (i = j = 0; i < SCIx_NR_IRQS; i++, j++) { | 1079 | for (i = j = 0; i < SCIx_NR_IRQS; i++, j++) { |
1077 | struct sci_irq_desc *desc; | 1080 | struct sci_irq_desc *desc; |
1078 | unsigned int irq; | 1081 | int irq; |
1079 | 1082 | ||
1080 | if (SCIx_IRQ_IS_MUXED(port)) { | 1083 | if (SCIx_IRQ_IS_MUXED(port)) { |
1081 | i = SCIx_MUX_IRQ; | 1084 | i = SCIx_MUX_IRQ; |
1082 | irq = up->irq; | 1085 | irq = up->irq; |
1083 | } else { | 1086 | } else { |
1084 | irq = port->cfg->irqs[i]; | 1087 | irq = port->irqs[i]; |
1085 | 1088 | ||
1086 | /* | 1089 | /* |
1087 | * Certain port types won't support all of the | 1090 | * Certain port types won't support all of the |
1088 | * available interrupt sources. | 1091 | * available interrupt sources. |
1089 | */ | 1092 | */ |
1090 | if (unlikely(!irq)) | 1093 | if (unlikely(irq < 0)) |
1091 | continue; | 1094 | continue; |
1092 | } | 1095 | } |
1093 | 1096 | ||
@@ -1112,7 +1115,7 @@ static int sci_request_irq(struct sci_port *port) | |||
1112 | 1115 | ||
1113 | out_noirq: | 1116 | out_noirq: |
1114 | while (--i >= 0) | 1117 | while (--i >= 0) |
1115 | free_irq(port->cfg->irqs[i], port); | 1118 | free_irq(port->irqs[i], port); |
1116 | 1119 | ||
1117 | out_nomem: | 1120 | out_nomem: |
1118 | while (--j >= 0) | 1121 | while (--j >= 0) |
@@ -1130,16 +1133,16 @@ static void sci_free_irq(struct sci_port *port) | |||
1130 | * IRQ first. | 1133 | * IRQ first. |
1131 | */ | 1134 | */ |
1132 | for (i = 0; i < SCIx_NR_IRQS; i++) { | 1135 | for (i = 0; i < SCIx_NR_IRQS; i++) { |
1133 | unsigned int irq = port->cfg->irqs[i]; | 1136 | int irq = port->irqs[i]; |
1134 | 1137 | ||
1135 | /* | 1138 | /* |
1136 | * Certain port types won't support all of the available | 1139 | * Certain port types won't support all of the available |
1137 | * interrupt sources. | 1140 | * interrupt sources. |
1138 | */ | 1141 | */ |
1139 | if (unlikely(!irq)) | 1142 | if (unlikely(irq < 0)) |
1140 | continue; | 1143 | continue; |
1141 | 1144 | ||
1142 | free_irq(port->cfg->irqs[i], port); | 1145 | free_irq(port->irqs[i], port); |
1143 | kfree(port->irqstr[i]); | 1146 | kfree(port->irqstr[i]); |
1144 | 1147 | ||
1145 | if (SCIx_IRQ_IS_MUXED(port)) { | 1148 | if (SCIx_IRQ_IS_MUXED(port)) { |
@@ -1149,67 +1152,6 @@ static void sci_free_irq(struct sci_port *port) | |||
1149 | } | 1152 | } |
1150 | } | 1153 | } |
1151 | 1154 | ||
1152 | static const char *sci_gpio_names[SCIx_NR_FNS] = { | ||
1153 | "sck", "rxd", "txd", "cts", "rts", | ||
1154 | }; | ||
1155 | |||
1156 | static const char *sci_gpio_str(unsigned int index) | ||
1157 | { | ||
1158 | return sci_gpio_names[index]; | ||
1159 | } | ||
1160 | |||
1161 | static void sci_init_gpios(struct sci_port *port) | ||
1162 | { | ||
1163 | struct uart_port *up = &port->port; | ||
1164 | int i; | ||
1165 | |||
1166 | if (!port->cfg) | ||
1167 | return; | ||
1168 | |||
1169 | for (i = 0; i < SCIx_NR_FNS; i++) { | ||
1170 | const char *desc; | ||
1171 | int ret; | ||
1172 | |||
1173 | if (!port->cfg->gpios[i]) | ||
1174 | continue; | ||
1175 | |||
1176 | desc = sci_gpio_str(i); | ||
1177 | |||
1178 | port->gpiostr[i] = kasprintf(GFP_KERNEL, "%s:%s", | ||
1179 | dev_name(up->dev), desc); | ||
1180 | |||
1181 | /* | ||
1182 | * If we've failed the allocation, we can still continue | ||
1183 | * on with a NULL string. | ||
1184 | */ | ||
1185 | if (!port->gpiostr[i]) | ||
1186 | dev_notice(up->dev, "%s string allocation failure\n", | ||
1187 | desc); | ||
1188 | |||
1189 | ret = gpio_request(port->cfg->gpios[i], port->gpiostr[i]); | ||
1190 | if (unlikely(ret != 0)) { | ||
1191 | dev_notice(up->dev, "failed %s gpio request\n", desc); | ||
1192 | |||
1193 | /* | ||
1194 | * If we can't get the GPIO for whatever reason, | ||
1195 | * no point in keeping the verbose string around. | ||
1196 | */ | ||
1197 | kfree(port->gpiostr[i]); | ||
1198 | } | ||
1199 | } | ||
1200 | } | ||
1201 | |||
1202 | static void sci_free_gpios(struct sci_port *port) | ||
1203 | { | ||
1204 | int i; | ||
1205 | |||
1206 | for (i = 0; i < SCIx_NR_FNS; i++) | ||
1207 | if (port->cfg->gpios[i]) { | ||
1208 | gpio_free(port->cfg->gpios[i]); | ||
1209 | kfree(port->gpiostr[i]); | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1213 | static unsigned int sci_tx_empty(struct uart_port *port) | 1155 | static unsigned int sci_tx_empty(struct uart_port *port) |
1214 | { | 1156 | { |
1215 | unsigned short status = serial_port_in(port, SCxSR); | 1157 | unsigned short status = serial_port_in(port, SCxSR); |
@@ -1309,7 +1251,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count) | |||
1309 | } | 1251 | } |
1310 | 1252 | ||
1311 | if (room < count) | 1253 | if (room < count) |
1312 | dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", | 1254 | dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n", |
1313 | count - room); | 1255 | count - room); |
1314 | if (!room) | 1256 | if (!room) |
1315 | return room; | 1257 | return room; |
@@ -1442,7 +1384,7 @@ static void work_fn_rx(struct work_struct *work) | |||
1442 | int count; | 1384 | int count; |
1443 | 1385 | ||
1444 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); | 1386 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); |
1445 | dev_dbg(port->dev, "Read %u bytes with cookie %d\n", | 1387 | dev_dbg(port->dev, "Read %zu bytes with cookie %d\n", |
1446 | sh_desc->partial, sh_desc->cookie); | 1388 | sh_desc->partial, sh_desc->cookie); |
1447 | 1389 | ||
1448 | spin_lock_irqsave(&port->lock, flags); | 1390 | spin_lock_irqsave(&port->lock, flags); |
@@ -1655,7 +1597,7 @@ static void rx_timer_fn(unsigned long arg) | |||
1655 | 1597 | ||
1656 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1598 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1657 | scr &= ~0x4000; | 1599 | scr &= ~0x4000; |
1658 | enable_irq(s->cfg->irqs[1]); | 1600 | enable_irq(s->irqs[SCIx_RXI_IRQ]); |
1659 | } | 1601 | } |
1660 | serial_port_out(port, SCSCR, scr | SCSCR_RIE); | 1602 | serial_port_out(port, SCSCR, scr | SCSCR_RIE); |
1661 | dev_dbg(port->dev, "DMA Rx timed out\n"); | 1603 | dev_dbg(port->dev, "DMA Rx timed out\n"); |
@@ -1691,16 +1633,17 @@ static void sci_request_dma(struct uart_port *port) | |||
1691 | s->chan_tx = chan; | 1633 | s->chan_tx = chan; |
1692 | sg_init_table(&s->sg_tx, 1); | 1634 | sg_init_table(&s->sg_tx, 1); |
1693 | /* UART circular tx buffer is an aligned page. */ | 1635 | /* UART circular tx buffer is an aligned page. */ |
1694 | BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK); | 1636 | BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK); |
1695 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), | 1637 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), |
1696 | UART_XMIT_SIZE, (int)port->state->xmit.buf & ~PAGE_MASK); | 1638 | UART_XMIT_SIZE, |
1639 | (uintptr_t)port->state->xmit.buf & ~PAGE_MASK); | ||
1697 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); | 1640 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); |
1698 | if (!nent) | 1641 | if (!nent) |
1699 | sci_tx_dma_release(s, false); | 1642 | sci_tx_dma_release(s, false); |
1700 | else | 1643 | else |
1701 | dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__, | 1644 | dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__, |
1702 | sg_dma_len(&s->sg_tx), | 1645 | sg_dma_len(&s->sg_tx), port->state->xmit.buf, |
1703 | port->state->xmit.buf, sg_dma_address(&s->sg_tx)); | 1646 | &sg_dma_address(&s->sg_tx)); |
1704 | 1647 | ||
1705 | s->sg_len_tx = nent; | 1648 | s->sg_len_tx = nent; |
1706 | 1649 | ||
@@ -1740,7 +1683,7 @@ static void sci_request_dma(struct uart_port *port) | |||
1740 | 1683 | ||
1741 | sg_init_table(sg, 1); | 1684 | sg_init_table(sg, 1); |
1742 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, | 1685 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, |
1743 | (int)buf[i] & ~PAGE_MASK); | 1686 | (uintptr_t)buf[i] & ~PAGE_MASK); |
1744 | sg_dma_address(sg) = dma[i]; | 1687 | sg_dma_address(sg) = dma[i]; |
1745 | } | 1688 | } |
1746 | 1689 | ||
@@ -1808,20 +1751,21 @@ static void sci_shutdown(struct uart_port *port) | |||
1808 | sci_free_irq(s); | 1751 | sci_free_irq(s); |
1809 | } | 1752 | } |
1810 | 1753 | ||
1811 | static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, | 1754 | static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps, |
1812 | unsigned long freq) | 1755 | unsigned long freq) |
1813 | { | 1756 | { |
1814 | switch (algo_id) { | 1757 | if (s->sampling_rate) |
1758 | return DIV_ROUND_CLOSEST(freq, s->sampling_rate * bps) - 1; | ||
1759 | |||
1760 | switch (s->cfg->scbrr_algo_id) { | ||
1815 | case SCBRR_ALGO_1: | 1761 | case SCBRR_ALGO_1: |
1816 | return ((freq + 16 * bps) / (16 * bps) - 1); | 1762 | return freq / (16 * bps); |
1817 | case SCBRR_ALGO_2: | 1763 | case SCBRR_ALGO_2: |
1818 | return ((freq + 16 * bps) / (32 * bps) - 1); | 1764 | return DIV_ROUND_CLOSEST(freq, 32 * bps) - 1; |
1819 | case SCBRR_ALGO_3: | 1765 | case SCBRR_ALGO_3: |
1820 | return (((freq * 2) + 16 * bps) / (16 * bps) - 1); | 1766 | return freq / (8 * bps); |
1821 | case SCBRR_ALGO_4: | 1767 | case SCBRR_ALGO_4: |
1822 | return (((freq * 2) + 16 * bps) / (32 * bps) - 1); | 1768 | return DIV_ROUND_CLOSEST(freq, 16 * bps) - 1; |
1823 | case SCBRR_ALGO_5: | ||
1824 | return (((freq * 1000 / 32) / bps) - 1); | ||
1825 | } | 1769 | } |
1826 | 1770 | ||
1827 | /* Warn, but use a safe default */ | 1771 | /* Warn, but use a safe default */ |
@@ -1903,12 +1847,11 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1903 | 1847 | ||
1904 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); | 1848 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); |
1905 | if (likely(baud && port->uartclk)) { | 1849 | if (likely(baud && port->uartclk)) { |
1906 | if (s->cfg->scbrr_algo_id == SCBRR_ALGO_6) { | 1850 | if (s->cfg->type == PORT_HSCIF) { |
1907 | sci_baud_calc_hscif(baud, port->uartclk, &t, &srr, | 1851 | sci_baud_calc_hscif(baud, port->uartclk, &t, &srr, |
1908 | &cks); | 1852 | &cks); |
1909 | } else { | 1853 | } else { |
1910 | t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, | 1854 | t = sci_scbrr_calc(s, baud, port->uartclk); |
1911 | port->uartclk); | ||
1912 | for (cks = 0; t >= 256 && cks <= 3; cks++) | 1855 | for (cks = 0; t >= 256 && cks <= 3; cks++) |
1913 | t >>= 2; | 1856 | t >>= 2; |
1914 | } | 1857 | } |
@@ -2115,10 +2058,6 @@ static void sci_config_port(struct uart_port *port, int flags) | |||
2115 | 2058 | ||
2116 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) | 2059 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) |
2117 | { | 2060 | { |
2118 | struct sci_port *s = to_sci_port(port); | ||
2119 | |||
2120 | if (ser->irq != s->cfg->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs) | ||
2121 | return -EINVAL; | ||
2122 | if (ser->baud_base < 2400) | 2061 | if (ser->baud_base < 2400) |
2123 | /* No paper tape reader for Mitch.. */ | 2062 | /* No paper tape reader for Mitch.. */ |
2124 | return -EINVAL; | 2063 | return -EINVAL; |
@@ -2151,11 +2090,13 @@ static struct uart_ops sci_uart_ops = { | |||
2151 | }; | 2090 | }; |
2152 | 2091 | ||
2153 | static int sci_init_single(struct platform_device *dev, | 2092 | static int sci_init_single(struct platform_device *dev, |
2154 | struct sci_port *sci_port, | 2093 | struct sci_port *sci_port, unsigned int index, |
2155 | unsigned int index, | 2094 | struct plat_sci_port *p, bool early) |
2156 | struct plat_sci_port *p) | ||
2157 | { | 2095 | { |
2158 | struct uart_port *port = &sci_port->port; | 2096 | struct uart_port *port = &sci_port->port; |
2097 | const struct resource *res; | ||
2098 | unsigned int sampling_rate; | ||
2099 | unsigned int i; | ||
2159 | int ret; | 2100 | int ret; |
2160 | 2101 | ||
2161 | sci_port->cfg = p; | 2102 | sci_port->cfg = p; |
@@ -2164,31 +2105,90 @@ static int sci_init_single(struct platform_device *dev, | |||
2164 | port->iotype = UPIO_MEM; | 2105 | port->iotype = UPIO_MEM; |
2165 | port->line = index; | 2106 | port->line = index; |
2166 | 2107 | ||
2108 | if (dev->num_resources) { | ||
2109 | /* Device has resources, use them. */ | ||
2110 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
2111 | if (res == NULL) | ||
2112 | return -ENOMEM; | ||
2113 | |||
2114 | port->mapbase = res->start; | ||
2115 | |||
2116 | for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) | ||
2117 | sci_port->irqs[i] = platform_get_irq(dev, i); | ||
2118 | |||
2119 | /* The SCI generates several interrupts. They can be muxed | ||
2120 | * together or connected to different interrupt lines. In the | ||
2121 | * muxed case only one interrupt resource is specified. In the | ||
2122 | * non-muxed case three or four interrupt resources are | ||
2123 | * specified, as the BRI interrupt is optional. | ||
2124 | */ | ||
2125 | if (sci_port->irqs[0] < 0) | ||
2126 | return -ENXIO; | ||
2127 | |||
2128 | if (sci_port->irqs[1] < 0) { | ||
2129 | sci_port->irqs[1] = sci_port->irqs[0]; | ||
2130 | sci_port->irqs[2] = sci_port->irqs[0]; | ||
2131 | sci_port->irqs[3] = sci_port->irqs[0]; | ||
2132 | } | ||
2133 | } else { | ||
2134 | /* No resources, use old-style platform data. */ | ||
2135 | port->mapbase = p->mapbase; | ||
2136 | for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) | ||
2137 | sci_port->irqs[i] = p->irqs[i] ? p->irqs[i] : -ENXIO; | ||
2138 | } | ||
2139 | |||
2140 | if (p->regtype == SCIx_PROBE_REGTYPE) { | ||
2141 | ret = sci_probe_regmap(p); | ||
2142 | if (unlikely(ret)) | ||
2143 | return ret; | ||
2144 | } | ||
2145 | |||
2167 | switch (p->type) { | 2146 | switch (p->type) { |
2168 | case PORT_SCIFB: | 2147 | case PORT_SCIFB: |
2169 | port->fifosize = 256; | 2148 | port->fifosize = 256; |
2149 | sci_port->overrun_bit = 9; | ||
2150 | sampling_rate = 16; | ||
2170 | break; | 2151 | break; |
2171 | case PORT_HSCIF: | 2152 | case PORT_HSCIF: |
2172 | port->fifosize = 128; | 2153 | port->fifosize = 128; |
2154 | sampling_rate = 0; | ||
2155 | sci_port->overrun_bit = 0; | ||
2173 | break; | 2156 | break; |
2174 | case PORT_SCIFA: | 2157 | case PORT_SCIFA: |
2175 | port->fifosize = 64; | 2158 | port->fifosize = 64; |
2159 | sci_port->overrun_bit = 9; | ||
2160 | sampling_rate = 16; | ||
2176 | break; | 2161 | break; |
2177 | case PORT_SCIF: | 2162 | case PORT_SCIF: |
2178 | port->fifosize = 16; | 2163 | port->fifosize = 16; |
2164 | if (p->regtype == SCIx_SH7705_SCIF_REGTYPE) { | ||
2165 | sci_port->overrun_bit = 9; | ||
2166 | sampling_rate = 16; | ||
2167 | } else { | ||
2168 | sci_port->overrun_bit = 0; | ||
2169 | sampling_rate = 32; | ||
2170 | } | ||
2179 | break; | 2171 | break; |
2180 | default: | 2172 | default: |
2181 | port->fifosize = 1; | 2173 | port->fifosize = 1; |
2174 | sci_port->overrun_bit = 5; | ||
2175 | sampling_rate = 32; | ||
2182 | break; | 2176 | break; |
2183 | } | 2177 | } |
2184 | 2178 | ||
2185 | if (p->regtype == SCIx_PROBE_REGTYPE) { | 2179 | /* Set the sampling rate if the baud rate calculation algorithm isn't |
2186 | ret = sci_probe_regmap(p); | 2180 | * specified. |
2187 | if (unlikely(ret)) | 2181 | */ |
2188 | return ret; | 2182 | if (p->scbrr_algo_id == SCBRR_ALGO_NONE) { |
2183 | /* SCIFA on sh7723 and sh7724 need a custom sampling rate that | ||
2184 | * doesn't match the SoC datasheet, this should be investigated. | ||
2185 | * Let platform data override the sampling rate for now. | ||
2186 | */ | ||
2187 | sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate | ||
2188 | : sampling_rate; | ||
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | if (dev) { | 2191 | if (!early) { |
2192 | sci_port->iclk = clk_get(&dev->dev, "sci_ick"); | 2192 | sci_port->iclk = clk_get(&dev->dev, "sci_ick"); |
2193 | if (IS_ERR(sci_port->iclk)) { | 2193 | if (IS_ERR(sci_port->iclk)) { |
2194 | sci_port->iclk = clk_get(&dev->dev, "peripheral_clk"); | 2194 | sci_port->iclk = clk_get(&dev->dev, "peripheral_clk"); |
@@ -2208,8 +2208,6 @@ static int sci_init_single(struct platform_device *dev, | |||
2208 | 2208 | ||
2209 | port->dev = &dev->dev; | 2209 | port->dev = &dev->dev; |
2210 | 2210 | ||
2211 | sci_init_gpios(sci_port); | ||
2212 | |||
2213 | pm_runtime_enable(&dev->dev); | 2211 | pm_runtime_enable(&dev->dev); |
2214 | } | 2212 | } |
2215 | 2213 | ||
@@ -2220,32 +2218,22 @@ static int sci_init_single(struct platform_device *dev, | |||
2220 | /* | 2218 | /* |
2221 | * Establish some sensible defaults for the error detection. | 2219 | * Establish some sensible defaults for the error detection. |
2222 | */ | 2220 | */ |
2223 | if (!p->error_mask) | 2221 | sci_port->error_mask = (p->type == PORT_SCI) ? |
2224 | p->error_mask = (p->type == PORT_SCI) ? | ||
2225 | SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK; | 2222 | SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK; |
2226 | 2223 | ||
2227 | /* | 2224 | /* |
2228 | * Establish sensible defaults for the overrun detection, unless | 2225 | * Establish sensible defaults for the overrun detection, unless |
2229 | * the part has explicitly disabled support for it. | 2226 | * the part has explicitly disabled support for it. |
2230 | */ | 2227 | */ |
2231 | if (p->overrun_bit != SCIx_NOT_SUPPORTED) { | ||
2232 | if (p->type == PORT_SCI) | ||
2233 | p->overrun_bit = 5; | ||
2234 | else if (p->scbrr_algo_id == SCBRR_ALGO_4) | ||
2235 | p->overrun_bit = 9; | ||
2236 | else | ||
2237 | p->overrun_bit = 0; | ||
2238 | 2228 | ||
2239 | /* | 2229 | /* |
2240 | * Make the error mask inclusive of overrun detection, if | 2230 | * Make the error mask inclusive of overrun detection, if |
2241 | * supported. | 2231 | * supported. |
2242 | */ | 2232 | */ |
2243 | p->error_mask |= (1 << p->overrun_bit); | 2233 | sci_port->error_mask |= 1 << sci_port->overrun_bit; |
2244 | } | ||
2245 | 2234 | ||
2246 | port->mapbase = p->mapbase; | ||
2247 | port->type = p->type; | 2235 | port->type = p->type; |
2248 | port->flags = p->flags; | 2236 | port->flags = UPF_FIXED_PORT | p->flags; |
2249 | port->regshift = p->regshift; | 2237 | port->regshift = p->regshift; |
2250 | 2238 | ||
2251 | /* | 2239 | /* |
@@ -2255,7 +2243,7 @@ static int sci_init_single(struct platform_device *dev, | |||
2255 | * | 2243 | * |
2256 | * For the muxed case there's nothing more to do. | 2244 | * For the muxed case there's nothing more to do. |
2257 | */ | 2245 | */ |
2258 | port->irq = p->irqs[SCIx_RXI_IRQ]; | 2246 | port->irq = sci_port->irqs[SCIx_RXI_IRQ]; |
2259 | port->irqflags = 0; | 2247 | port->irqflags = 0; |
2260 | 2248 | ||
2261 | port->serial_in = sci_serial_in; | 2249 | port->serial_in = sci_serial_in; |
@@ -2270,8 +2258,6 @@ static int sci_init_single(struct platform_device *dev, | |||
2270 | 2258 | ||
2271 | static void sci_cleanup_single(struct sci_port *port) | 2259 | static void sci_cleanup_single(struct sci_port *port) |
2272 | { | 2260 | { |
2273 | sci_free_gpios(port); | ||
2274 | |||
2275 | clk_put(port->iclk); | 2261 | clk_put(port->iclk); |
2276 | clk_put(port->fclk); | 2262 | clk_put(port->fclk); |
2277 | 2263 | ||
@@ -2387,7 +2373,7 @@ static int sci_probe_earlyprintk(struct platform_device *pdev) | |||
2387 | 2373 | ||
2388 | early_serial_console.index = pdev->id; | 2374 | early_serial_console.index = pdev->id; |
2389 | 2375 | ||
2390 | sci_init_single(NULL, &sci_ports[pdev->id], pdev->id, cfg); | 2376 | sci_init_single(pdev, &sci_ports[pdev->id], pdev->id, cfg, true); |
2391 | 2377 | ||
2392 | serial_console_setup(&early_serial_console, early_serial_buf); | 2378 | serial_console_setup(&early_serial_console, early_serial_buf); |
2393 | 2379 | ||
@@ -2454,7 +2440,7 @@ static int sci_probe_single(struct platform_device *dev, | |||
2454 | return -EINVAL; | 2440 | return -EINVAL; |
2455 | } | 2441 | } |
2456 | 2442 | ||
2457 | ret = sci_init_single(dev, sciport, index, p); | 2443 | ret = sci_init_single(dev, sciport, index, p, false); |
2458 | if (ret) | 2444 | if (ret) |
2459 | return ret; | 2445 | return ret; |
2460 | 2446 | ||
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h index 5aca7364634c..d5db81a0a430 100644 --- a/drivers/tty/serial/sh-sci.h +++ b/drivers/tty/serial/sh-sci.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER) | 9 | #define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER) |
10 | #define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK) | 10 | #define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK) |
11 | 11 | ||
12 | #define SCxSR_ERRORS(port) (to_sci_port(port)->cfg->error_mask) | 12 | #define SCxSR_ERRORS(port) (to_sci_port(port)->error_mask) |
13 | 13 | ||
14 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 14 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
15 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 15 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 38bf67b1a97d..52771d4c44bc 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -326,7 +326,7 @@ static int vbus_is_present(struct usba_udc *udc) | |||
326 | 326 | ||
327 | #if defined(CONFIG_ARCH_AT91SAM9RL) | 327 | #if defined(CONFIG_ARCH_AT91SAM9RL) |
328 | 328 | ||
329 | #include <mach/at91_pmc.h> | 329 | #include <linux/clk/at91_pmc.h> |
330 | 330 | ||
331 | static void toggle_bias(int is_on) | 331 | static void toggle_bias(int is_on) |
332 | { | 332 | { |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index a8f4471dae7b..af28b748e87a 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -17,7 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/clk/tegra.h> | ||
21 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
22 | #include <linux/err.h> | 21 | #include <linux/err.h> |
23 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
@@ -29,6 +28,7 @@ | |||
29 | #include <linux/of_gpio.h> | 28 | #include <linux/of_gpio.h> |
30 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
31 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
31 | #include <linux/reset.h> | ||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/usb/ehci_def.h> | 33 | #include <linux/usb/ehci_def.h> |
34 | #include <linux/usb/tegra_usb_phy.h> | 34 | #include <linux/usb/tegra_usb_phy.h> |
@@ -62,6 +62,7 @@ static int (*orig_hub_control)(struct usb_hcd *hcd, | |||
62 | struct tegra_ehci_hcd { | 62 | struct tegra_ehci_hcd { |
63 | struct tegra_usb_phy *phy; | 63 | struct tegra_usb_phy *phy; |
64 | struct clk *clk; | 64 | struct clk *clk; |
65 | struct reset_control *rst; | ||
65 | int port_resuming; | 66 | int port_resuming; |
66 | bool needs_double_reset; | 67 | bool needs_double_reset; |
67 | enum tegra_usb_phy_port_speed port_speed; | 68 | enum tegra_usb_phy_port_speed port_speed; |
@@ -385,13 +386,20 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
385 | goto cleanup_hcd_create; | 386 | goto cleanup_hcd_create; |
386 | } | 387 | } |
387 | 388 | ||
389 | tegra->rst = devm_reset_control_get(&pdev->dev, "usb"); | ||
390 | if (IS_ERR(tegra->rst)) { | ||
391 | dev_err(&pdev->dev, "Can't get ehci reset\n"); | ||
392 | err = PTR_ERR(tegra->rst); | ||
393 | goto cleanup_hcd_create; | ||
394 | } | ||
395 | |||
388 | err = clk_prepare_enable(tegra->clk); | 396 | err = clk_prepare_enable(tegra->clk); |
389 | if (err) | 397 | if (err) |
390 | goto cleanup_hcd_create; | 398 | goto cleanup_hcd_create; |
391 | 399 | ||
392 | tegra_periph_reset_assert(tegra->clk); | 400 | reset_control_assert(tegra->rst); |
393 | udelay(1); | 401 | udelay(1); |
394 | tegra_periph_reset_deassert(tegra->clk); | 402 | reset_control_deassert(tegra->rst); |
395 | 403 | ||
396 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); | 404 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); |
397 | if (IS_ERR(u_phy)) { | 405 | if (IS_ERR(u_phy)) { |
diff --git a/include/dt-bindings/clk/at91.h b/include/dt-bindings/clk/at91.h new file mode 100644 index 000000000000..0b4cb999a3f7 --- /dev/null +++ b/include/dt-bindings/clk/at91.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * This header provides constants for AT91 pmc status. | ||
3 | * | ||
4 | * The constants defined in this header are being used in dts. | ||
5 | * | ||
6 | * Licensed under GPLv2 or later. | ||
7 | */ | ||
8 | |||
9 | #ifndef _DT_BINDINGS_CLK_AT91_H | ||
10 | #define _DT_BINDINGS_CLK_AT91_H | ||
11 | |||
12 | #define AT91_PMC_MOSCS 0 /* MOSCS Flag */ | ||
13 | #define AT91_PMC_LOCKA 1 /* PLLA Lock */ | ||
14 | #define AT91_PMC_LOCKB 2 /* PLLB Lock */ | ||
15 | #define AT91_PMC_MCKRDY 3 /* Master Clock */ | ||
16 | #define AT91_PMC_LOCKU 6 /* UPLL Lock */ | ||
17 | #define AT91_PMC_PCKRDY(id) (8 + (id)) /* Programmable Clock */ | ||
18 | #define AT91_PMC_MOSCSELS 16 /* Main Oscillator Selection */ | ||
19 | #define AT91_PMC_MOSCRCS 17 /* Main On-Chip RC */ | ||
20 | #define AT91_PMC_CFDEV 18 /* Clock Failure Detector Event */ | ||
21 | |||
22 | #endif | ||
diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h index 614aec417902..6d0d8d8ef31e 100644 --- a/include/dt-bindings/clock/tegra114-car.h +++ b/include/dt-bindings/clock/tegra114-car.h | |||
@@ -37,10 +37,10 @@ | |||
37 | #define TEGRA114_CLK_I2S2 18 | 37 | #define TEGRA114_CLK_I2S2 18 |
38 | #define TEGRA114_CLK_EPP 19 | 38 | #define TEGRA114_CLK_EPP 19 |
39 | /* 20 (register bit affects vi and vi_sensor) */ | 39 | /* 20 (register bit affects vi and vi_sensor) */ |
40 | #define TEGRA114_CLK_GR_2D 21 | 40 | #define TEGRA114_CLK_GR2D 21 |
41 | #define TEGRA114_CLK_USBD 22 | 41 | #define TEGRA114_CLK_USBD 22 |
42 | #define TEGRA114_CLK_ISP 23 | 42 | #define TEGRA114_CLK_ISP 23 |
43 | #define TEGRA114_CLK_GR_3D 24 | 43 | #define TEGRA114_CLK_GR3D 24 |
44 | /* 25 */ | 44 | /* 25 */ |
45 | #define TEGRA114_CLK_DISP2 26 | 45 | #define TEGRA114_CLK_DISP2 26 |
46 | #define TEGRA114_CLK_DISP1 27 | 46 | #define TEGRA114_CLK_DISP1 27 |
@@ -289,8 +289,8 @@ | |||
289 | #define TEGRA114_CLK_PCLK 261 | 289 | #define TEGRA114_CLK_PCLK 261 |
290 | #define TEGRA114_CLK_CCLK_G 262 | 290 | #define TEGRA114_CLK_CCLK_G 262 |
291 | #define TEGRA114_CLK_CCLK_LP 263 | 291 | #define TEGRA114_CLK_CCLK_LP 263 |
292 | /* 264 */ | 292 | #define TEGRA114_CLK_DFLL_REF 264 |
293 | /* 265 */ | 293 | #define TEGRA114_CLK_DFLL_SOC 265 |
294 | /* 266 */ | 294 | /* 266 */ |
295 | /* 267 */ | 295 | /* 267 */ |
296 | /* 268 */ | 296 | /* 268 */ |
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h new file mode 100644 index 000000000000..a1116a3b54ef --- /dev/null +++ b/include/dt-bindings/clock/tegra124-car.h | |||
@@ -0,0 +1,341 @@ | |||
1 | /* | ||
2 | * This header provides constants for binding nvidia,tegra124-car. | ||
3 | * | ||
4 | * The first 192 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB | ||
5 | * registers. These IDs often match those in the CAR's RST_DEVICES registers, | ||
6 | * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In | ||
7 | * this case, those clocks are assigned IDs above 185 in order to highlight | ||
8 | * this issue. Implementations that interpret these clock IDs as bit values | ||
9 | * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to | ||
10 | * explicitly handle these special cases. | ||
11 | * | ||
12 | * The balance of the clocks controlled by the CAR are assigned IDs of 185 and | ||
13 | * above. | ||
14 | */ | ||
15 | |||
16 | #ifndef _DT_BINDINGS_CLOCK_TEGRA124_CAR_H | ||
17 | #define _DT_BINDINGS_CLOCK_TEGRA124_CAR_H | ||
18 | |||
19 | /* 0 */ | ||
20 | /* 1 */ | ||
21 | /* 2 */ | ||
22 | #define TEGRA124_CLK_ISPB 3 | ||
23 | #define TEGRA124_CLK_RTC 4 | ||
24 | #define TEGRA124_CLK_TIMER 5 | ||
25 | #define TEGRA124_CLK_UARTA 6 | ||
26 | /* 7 (register bit affects uartb and vfir) */ | ||
27 | /* 8 */ | ||
28 | #define TEGRA124_CLK_SDMMC2 9 | ||
29 | /* 10 (register bit affects spdif_in and spdif_out) */ | ||
30 | #define TEGRA124_CLK_I2S1 11 | ||
31 | #define TEGRA124_CLK_I2C1 12 | ||
32 | #define TEGRA124_CLK_NDFLASH 13 | ||
33 | #define TEGRA124_CLK_SDMMC1 14 | ||
34 | #define TEGRA124_CLK_SDMMC4 15 | ||
35 | /* 16 */ | ||
36 | #define TEGRA124_CLK_PWM 17 | ||
37 | #define TEGRA124_CLK_I2S2 18 | ||
38 | /* 20 (register bit affects vi and vi_sensor) */ | ||
39 | #define TEGRA124_CLK_GR_2D 21 | ||
40 | #define TEGRA124_CLK_USBD 22 | ||
41 | #define TEGRA124_CLK_ISP 23 | ||
42 | #define TEGRA124_CLK_GR_3D 24 | ||
43 | /* 25 */ | ||
44 | #define TEGRA124_CLK_DISP2 26 | ||
45 | #define TEGRA124_CLK_DISP1 27 | ||
46 | #define TEGRA124_CLK_HOST1X 28 | ||
47 | #define TEGRA124_CLK_VCP 29 | ||
48 | #define TEGRA124_CLK_I2S0 30 | ||
49 | /* 31 */ | ||
50 | |||
51 | /* 32 */ | ||
52 | /* 33 */ | ||
53 | #define TEGRA124_CLK_APBDMA 34 | ||
54 | /* 35 */ | ||
55 | #define TEGRA124_CLK_KBC 36 | ||
56 | /* 37 */ | ||
57 | /* 38 */ | ||
58 | /* 39 (register bit affects fuse and fuse_burn) */ | ||
59 | #define TEGRA124_CLK_KFUSE 40 | ||
60 | #define TEGRA124_CLK_SBC1 41 | ||
61 | #define TEGRA124_CLK_NOR 42 | ||
62 | /* 43 */ | ||
63 | #define TEGRA124_CLK_SBC2 44 | ||
64 | /* 45 */ | ||
65 | #define TEGRA124_CLK_SBC3 46 | ||
66 | #define TEGRA124_CLK_I2C5 47 | ||
67 | #define TEGRA124_CLK_DSIA 48 | ||
68 | /* 49 */ | ||
69 | #define TEGRA124_CLK_MIPI 50 | ||
70 | #define TEGRA124_CLK_HDMI 51 | ||
71 | #define TEGRA124_CLK_CSI 52 | ||
72 | /* 53 */ | ||
73 | #define TEGRA124_CLK_I2C2 54 | ||
74 | #define TEGRA124_CLK_UARTC 55 | ||
75 | #define TEGRA124_CLK_MIPI_CAL 56 | ||
76 | #define TEGRA124_CLK_EMC 57 | ||
77 | #define TEGRA124_CLK_USB2 58 | ||
78 | #define TEGRA124_CLK_USB3 59 | ||
79 | /* 60 */ | ||
80 | #define TEGRA124_CLK_VDE 61 | ||
81 | #define TEGRA124_CLK_BSEA 62 | ||
82 | #define TEGRA124_CLK_BSEV 63 | ||
83 | |||
84 | /* 64 */ | ||
85 | #define TEGRA124_CLK_UARTD 65 | ||
86 | #define TEGRA124_CLK_UARTE 66 | ||
87 | #define TEGRA124_CLK_I2C3 67 | ||
88 | #define TEGRA124_CLK_SBC4 68 | ||
89 | #define TEGRA124_CLK_SDMMC3 69 | ||
90 | #define TEGRA124_CLK_PCIE 70 | ||
91 | #define TEGRA124_CLK_OWR 71 | ||
92 | #define TEGRA124_CLK_AFI 72 | ||
93 | #define TEGRA124_CLK_CSITE 73 | ||
94 | /* 74 */ | ||
95 | /* 75 */ | ||
96 | #define TEGRA124_CLK_LA 76 | ||
97 | #define TEGRA124_CLK_TRACE 77 | ||
98 | #define TEGRA124_CLK_SOC_THERM 78 | ||
99 | #define TEGRA124_CLK_DTV 79 | ||
100 | #define TEGRA124_CLK_NDSPEED 80 | ||
101 | #define TEGRA124_CLK_I2CSLOW 81 | ||
102 | #define TEGRA124_CLK_DSIB 82 | ||
103 | #define TEGRA124_CLK_TSEC 83 | ||
104 | /* 84 */ | ||
105 | /* 85 */ | ||
106 | /* 86 */ | ||
107 | /* 87 */ | ||
108 | /* 88 */ | ||
109 | #define TEGRA124_CLK_XUSB_HOST 89 | ||
110 | /* 90 */ | ||
111 | #define TEGRA124_CLK_MSENC 91 | ||
112 | #define TEGRA124_CLK_CSUS 92 | ||
113 | /* 93 */ | ||
114 | /* 94 */ | ||
115 | /* 95 (bit affects xusb_dev and xusb_dev_src) */ | ||
116 | |||
117 | /* 96 */ | ||
118 | /* 97 */ | ||
119 | /* 98 */ | ||
120 | #define TEGRA124_CLK_MSELECT 99 | ||
121 | #define TEGRA124_CLK_TSENSOR 100 | ||
122 | #define TEGRA124_CLK_I2S3 101 | ||
123 | #define TEGRA124_CLK_I2S4 102 | ||
124 | #define TEGRA124_CLK_I2C4 103 | ||
125 | #define TEGRA124_CLK_SBC5 104 | ||
126 | #define TEGRA124_CLK_SBC6 105 | ||
127 | #define TEGRA124_CLK_D_AUDIO 106 | ||
128 | #define TEGRA124_CLK_APBIF 107 | ||
129 | #define TEGRA124_CLK_DAM0 108 | ||
130 | #define TEGRA124_CLK_DAM1 109 | ||
131 | #define TEGRA124_CLK_DAM2 110 | ||
132 | #define TEGRA124_CLK_HDA2CODEC_2X 111 | ||
133 | /* 112 */ | ||
134 | #define TEGRA124_CLK_AUDIO0_2X 113 | ||
135 | #define TEGRA124_CLK_AUDIO1_2X 114 | ||
136 | #define TEGRA124_CLK_AUDIO2_2X 115 | ||
137 | #define TEGRA124_CLK_AUDIO3_2X 116 | ||
138 | #define TEGRA124_CLK_AUDIO4_2X 117 | ||
139 | #define TEGRA124_CLK_SPDIF_2X 118 | ||
140 | #define TEGRA124_CLK_ACTMON 119 | ||
141 | #define TEGRA124_CLK_EXTERN1 120 | ||
142 | #define TEGRA124_CLK_EXTERN2 121 | ||
143 | #define TEGRA124_CLK_EXTERN3 122 | ||
144 | #define TEGRA124_CLK_SATA_OOB 123 | ||
145 | #define TEGRA124_CLK_SATA 124 | ||
146 | #define TEGRA124_CLK_HDA 125 | ||
147 | /* 126 */ | ||
148 | #define TEGRA124_CLK_SE 127 | ||
149 | |||
150 | #define TEGRA124_CLK_HDA2HDMI 128 | ||
151 | #define TEGRA124_CLK_SATA_COLD 129 | ||
152 | /* 130 */ | ||
153 | /* 131 */ | ||
154 | /* 132 */ | ||
155 | /* 133 */ | ||
156 | /* 134 */ | ||
157 | /* 135 */ | ||
158 | /* 136 */ | ||
159 | /* 137 */ | ||
160 | /* 138 */ | ||
161 | /* 139 */ | ||
162 | /* 140 */ | ||
163 | /* 141 */ | ||
164 | /* 142 */ | ||
165 | /* 143 (bit affects xusb_falcon_src, xusb_fs_src, */ | ||
166 | /* xusb_host_src and xusb_ss_src) */ | ||
167 | #define TEGRA124_CLK_CILAB 144 | ||
168 | #define TEGRA124_CLK_CILCD 145 | ||
169 | #define TEGRA124_CLK_CILE 146 | ||
170 | #define TEGRA124_CLK_DSIALP 147 | ||
171 | #define TEGRA124_CLK_DSIBLP 148 | ||
172 | #define TEGRA124_CLK_ENTROPY 149 | ||
173 | #define TEGRA124_CLK_DDS 150 | ||
174 | /* 151 */ | ||
175 | #define TEGRA124_CLK_DP2 152 | ||
176 | #define TEGRA124_CLK_AMX 153 | ||
177 | #define TEGRA124_CLK_ADX 154 | ||
178 | /* 155 (bit affects dfll_ref and dfll_soc) */ | ||
179 | #define TEGRA124_CLK_XUSB_SS 156 | ||
180 | /* 157 */ | ||
181 | /* 158 */ | ||
182 | /* 159 */ | ||
183 | |||
184 | /* 160 */ | ||
185 | /* 161 */ | ||
186 | /* 162 */ | ||
187 | /* 163 */ | ||
188 | /* 164 */ | ||
189 | /* 165 */ | ||
190 | #define TEGRA124_CLK_I2C6 166 | ||
191 | /* 167 */ | ||
192 | /* 168 */ | ||
193 | /* 169 */ | ||
194 | /* 170 */ | ||
195 | #define TEGRA124_CLK_VIM2_CLK 171 | ||
196 | /* 172 */ | ||
197 | /* 173 */ | ||
198 | /* 174 */ | ||
199 | /* 175 */ | ||
200 | #define TEGRA124_CLK_HDMI_AUDIO 176 | ||
201 | #define TEGRA124_CLK_CLK72MHZ 177 | ||
202 | #define TEGRA124_CLK_VIC03 178 | ||
203 | /* 179 */ | ||
204 | #define TEGRA124_CLK_ADX1 180 | ||
205 | #define TEGRA124_CLK_DPAUX 181 | ||
206 | #define TEGRA124_CLK_SOR0 182 | ||
207 | /* 183 */ | ||
208 | #define TEGRA124_CLK_GPU 184 | ||
209 | #define TEGRA124_CLK_AMX1 185 | ||
210 | /* 186 */ | ||
211 | /* 187 */ | ||
212 | /* 188 */ | ||
213 | /* 189 */ | ||
214 | /* 190 */ | ||
215 | /* 191 */ | ||
216 | #define TEGRA124_CLK_UARTB 192 | ||
217 | #define TEGRA124_CLK_VFIR 193 | ||
218 | #define TEGRA124_CLK_SPDIF_IN 194 | ||
219 | #define TEGRA124_CLK_SPDIF_OUT 195 | ||
220 | #define TEGRA124_CLK_VI 196 | ||
221 | #define TEGRA124_CLK_VI_SENSOR 197 | ||
222 | #define TEGRA124_CLK_FUSE 198 | ||
223 | #define TEGRA124_CLK_FUSE_BURN 199 | ||
224 | #define TEGRA124_CLK_CLK_32K 200 | ||
225 | #define TEGRA124_CLK_CLK_M 201 | ||
226 | #define TEGRA124_CLK_CLK_M_DIV2 202 | ||
227 | #define TEGRA124_CLK_CLK_M_DIV4 203 | ||
228 | #define TEGRA124_CLK_PLL_REF 204 | ||
229 | #define TEGRA124_CLK_PLL_C 205 | ||
230 | #define TEGRA124_CLK_PLL_C_OUT1 206 | ||
231 | #define TEGRA124_CLK_PLL_C2 207 | ||
232 | #define TEGRA124_CLK_PLL_C3 208 | ||
233 | #define TEGRA124_CLK_PLL_M 209 | ||
234 | #define TEGRA124_CLK_PLL_M_OUT1 210 | ||
235 | #define TEGRA124_CLK_PLL_P 211 | ||
236 | #define TEGRA124_CLK_PLL_P_OUT1 212 | ||
237 | #define TEGRA124_CLK_PLL_P_OUT2 213 | ||
238 | #define TEGRA124_CLK_PLL_P_OUT3 214 | ||
239 | #define TEGRA124_CLK_PLL_P_OUT4 215 | ||
240 | #define TEGRA124_CLK_PLL_A 216 | ||
241 | #define TEGRA124_CLK_PLL_A_OUT0 217 | ||
242 | #define TEGRA124_CLK_PLL_D 218 | ||
243 | #define TEGRA124_CLK_PLL_D_OUT0 219 | ||
244 | #define TEGRA124_CLK_PLL_D2 220 | ||
245 | #define TEGRA124_CLK_PLL_D2_OUT0 221 | ||
246 | #define TEGRA124_CLK_PLL_U 222 | ||
247 | #define TEGRA124_CLK_PLL_U_480M 223 | ||
248 | |||
249 | #define TEGRA124_CLK_PLL_U_60M 224 | ||
250 | #define TEGRA124_CLK_PLL_U_48M 225 | ||
251 | #define TEGRA124_CLK_PLL_U_12M 226 | ||
252 | #define TEGRA124_CLK_PLL_X 227 | ||
253 | #define TEGRA124_CLK_PLL_X_OUT0 228 | ||
254 | #define TEGRA124_CLK_PLL_RE_VCO 229 | ||
255 | #define TEGRA124_CLK_PLL_RE_OUT 230 | ||
256 | #define TEGRA124_CLK_PLL_E 231 | ||
257 | #define TEGRA124_CLK_SPDIF_IN_SYNC 232 | ||
258 | #define TEGRA124_CLK_I2S0_SYNC 233 | ||
259 | #define TEGRA124_CLK_I2S1_SYNC 234 | ||
260 | #define TEGRA124_CLK_I2S2_SYNC 235 | ||
261 | #define TEGRA124_CLK_I2S3_SYNC 236 | ||
262 | #define TEGRA124_CLK_I2S4_SYNC 237 | ||
263 | #define TEGRA124_CLK_VIMCLK_SYNC 238 | ||
264 | #define TEGRA124_CLK_AUDIO0 239 | ||
265 | #define TEGRA124_CLK_AUDIO1 240 | ||
266 | #define TEGRA124_CLK_AUDIO2 241 | ||
267 | #define TEGRA124_CLK_AUDIO3 242 | ||
268 | #define TEGRA124_CLK_AUDIO4 243 | ||
269 | #define TEGRA124_CLK_SPDIF 244 | ||
270 | #define TEGRA124_CLK_CLK_OUT_1 245 | ||
271 | #define TEGRA124_CLK_CLK_OUT_2 246 | ||
272 | #define TEGRA124_CLK_CLK_OUT_3 247 | ||
273 | #define TEGRA124_CLK_BLINK 248 | ||
274 | /* 249 */ | ||
275 | /* 250 */ | ||
276 | /* 251 */ | ||
277 | #define TEGRA124_CLK_XUSB_HOST_SRC 252 | ||
278 | #define TEGRA124_CLK_XUSB_FALCON_SRC 253 | ||
279 | #define TEGRA124_CLK_XUSB_FS_SRC 254 | ||
280 | #define TEGRA124_CLK_XUSB_SS_SRC 255 | ||
281 | |||
282 | #define TEGRA124_CLK_XUSB_DEV_SRC 256 | ||
283 | #define TEGRA124_CLK_XUSB_DEV 257 | ||
284 | #define TEGRA124_CLK_XUSB_HS_SRC 258 | ||
285 | #define TEGRA124_CLK_SCLK 259 | ||
286 | #define TEGRA124_CLK_HCLK 260 | ||
287 | #define TEGRA124_CLK_PCLK 261 | ||
288 | #define TEGRA124_CLK_CCLK_G 262 | ||
289 | #define TEGRA124_CLK_CCLK_LP 263 | ||
290 | #define TEGRA124_CLK_DFLL_REF 264 | ||
291 | #define TEGRA124_CLK_DFLL_SOC 265 | ||
292 | #define TEGRA124_CLK_VI_SENSOR2 266 | ||
293 | #define TEGRA124_CLK_PLL_P_OUT5 267 | ||
294 | #define TEGRA124_CLK_CML0 268 | ||
295 | #define TEGRA124_CLK_CML1 269 | ||
296 | #define TEGRA124_CLK_PLL_C4 270 | ||
297 | #define TEGRA124_CLK_PLL_DP 271 | ||
298 | #define TEGRA124_CLK_PLL_E_MUX 272 | ||
299 | /* 273 */ | ||
300 | /* 274 */ | ||
301 | /* 275 */ | ||
302 | /* 276 */ | ||
303 | /* 277 */ | ||
304 | /* 278 */ | ||
305 | /* 279 */ | ||
306 | /* 280 */ | ||
307 | /* 281 */ | ||
308 | /* 282 */ | ||
309 | /* 283 */ | ||
310 | /* 284 */ | ||
311 | /* 285 */ | ||
312 | /* 286 */ | ||
313 | /* 287 */ | ||
314 | |||
315 | /* 288 */ | ||
316 | /* 289 */ | ||
317 | /* 290 */ | ||
318 | /* 291 */ | ||
319 | /* 292 */ | ||
320 | /* 293 */ | ||
321 | /* 294 */ | ||
322 | /* 295 */ | ||
323 | /* 296 */ | ||
324 | /* 297 */ | ||
325 | /* 298 */ | ||
326 | /* 299 */ | ||
327 | #define TEGRA124_CLK_AUDIO0_MUX 300 | ||
328 | #define TEGRA124_CLK_AUDIO1_MUX 301 | ||
329 | #define TEGRA124_CLK_AUDIO2_MUX 302 | ||
330 | #define TEGRA124_CLK_AUDIO3_MUX 303 | ||
331 | #define TEGRA124_CLK_AUDIO4_MUX 304 | ||
332 | #define TEGRA124_CLK_SPDIF_MUX 305 | ||
333 | #define TEGRA124_CLK_CLK_OUT_1_MUX 306 | ||
334 | #define TEGRA124_CLK_CLK_OUT_2_MUX 307 | ||
335 | #define TEGRA124_CLK_CLK_OUT_3_MUX 308 | ||
336 | #define TEGRA124_CLK_DSIA_MUX 309 | ||
337 | #define TEGRA124_CLK_DSIB_MUX 310 | ||
338 | #define TEGRA124_CLK_SOR0_LVDS 311 | ||
339 | #define TEGRA124_CLK_CLK_MAX 312 | ||
340 | |||
341 | #endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */ | ||
diff --git a/include/dt-bindings/clock/tegra20-car.h b/include/dt-bindings/clock/tegra20-car.h index a1ae9a8fdd6c..9406207cfac8 100644 --- a/include/dt-bindings/clock/tegra20-car.h +++ b/include/dt-bindings/clock/tegra20-car.h | |||
@@ -92,7 +92,7 @@ | |||
92 | #define TEGRA20_CLK_OWR 71 | 92 | #define TEGRA20_CLK_OWR 71 |
93 | #define TEGRA20_CLK_AFI 72 | 93 | #define TEGRA20_CLK_AFI 72 |
94 | #define TEGRA20_CLK_CSITE 73 | 94 | #define TEGRA20_CLK_CSITE 73 |
95 | #define TEGRA20_CLK_PCIE_XCLK 74 | 95 | /* 74 */ |
96 | #define TEGRA20_CLK_AVPUCQ 75 | 96 | #define TEGRA20_CLK_AVPUCQ 75 |
97 | #define TEGRA20_CLK_LA 76 | 97 | #define TEGRA20_CLK_LA 76 |
98 | /* 77 */ | 98 | /* 77 */ |
diff --git a/include/dt-bindings/clock/tegra30-car.h b/include/dt-bindings/clock/tegra30-car.h index e40fae8f9a8d..889e49ba0aa3 100644 --- a/include/dt-bindings/clock/tegra30-car.h +++ b/include/dt-bindings/clock/tegra30-car.h | |||
@@ -92,7 +92,7 @@ | |||
92 | #define TEGRA30_CLK_OWR 71 | 92 | #define TEGRA30_CLK_OWR 71 |
93 | #define TEGRA30_CLK_AFI 72 | 93 | #define TEGRA30_CLK_AFI 72 |
94 | #define TEGRA30_CLK_CSITE 73 | 94 | #define TEGRA30_CLK_CSITE 73 |
95 | #define TEGRA30_CLK_PCIEX 74 | 95 | /* 74 */ |
96 | #define TEGRA30_CLK_AVPUCQ 75 | 96 | #define TEGRA30_CLK_AVPUCQ 75 |
97 | #define TEGRA30_CLK_LA 76 | 97 | #define TEGRA30_CLK_LA 76 |
98 | /* 77 */ | 98 | /* 77 */ |
@@ -260,6 +260,14 @@ | |||
260 | /* 298 */ | 260 | /* 298 */ |
261 | /* 299 */ | 261 | /* 299 */ |
262 | #define TEGRA30_CLK_CLK_OUT_1_MUX 300 | 262 | #define TEGRA30_CLK_CLK_OUT_1_MUX 300 |
263 | #define TEGRA30_CLK_CLK_MAX 301 | 263 | #define TEGRA30_CLK_CLK_OUT_2_MUX 301 |
264 | #define TEGRA30_CLK_CLK_OUT_3_MUX 302 | ||
265 | #define TEGRA30_CLK_AUDIO0_MUX 303 | ||
266 | #define TEGRA30_CLK_AUDIO1_MUX 304 | ||
267 | #define TEGRA30_CLK_AUDIO2_MUX 305 | ||
268 | #define TEGRA30_CLK_AUDIO3_MUX 306 | ||
269 | #define TEGRA30_CLK_AUDIO4_MUX 307 | ||
270 | #define TEGRA30_CLK_SPDIF_MUX 308 | ||
271 | #define TEGRA30_CLK_CLK_MAX 309 | ||
264 | 272 | ||
265 | #endif /* _DT_BINDINGS_CLOCK_TEGRA30_CAR_H */ | 273 | #endif /* _DT_BINDINGS_CLOCK_TEGRA30_CAR_H */ |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/include/linux/clk/at91_pmc.h index c604cc69acb5..a6911ebbd02a 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/include/linux/clk/at91_pmc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-at91/include/mach/at91_pmc.h | 2 | * include/linux/clk/at91_pmc.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Ivan Kokshaysky | 4 | * Copyright (C) 2005 Ivan Kokshaysky |
5 | * Copyright (C) SAN People | 5 | * Copyright (C) SAN People |
@@ -164,6 +164,8 @@ extern void __iomem *at91_pmc_base; | |||
164 | #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ | 164 | #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ |
165 | #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ | 165 | #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ |
166 | 166 | ||
167 | #define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ | ||
168 | |||
167 | #define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */ | 169 | #define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */ |
168 | #define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */ | 170 | #define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */ |
169 | #define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */ | 171 | #define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */ |
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 23a0ceee831f..3ca9fca827a2 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h | |||
@@ -120,13 +120,6 @@ static inline void tegra_cpu_clock_resume(void) | |||
120 | } | 120 | } |
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | #ifdef CONFIG_ARCH_TEGRA | ||
124 | void tegra_periph_reset_deassert(struct clk *c); | ||
125 | void tegra_periph_reset_assert(struct clk *c); | ||
126 | #else | ||
127 | static inline void tegra_periph_reset_deassert(struct clk *c) {} | ||
128 | static inline void tegra_periph_reset_assert(struct clk *c) {} | ||
129 | #endif | ||
130 | void tegra_clocks_apply_init_table(void); | 123 | void tegra_clocks_apply_init_table(void); |
131 | 124 | ||
132 | #endif /* __LINUX_CLK_TEGRA_H_ */ | 125 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index ba5f96db0754..6fd9390ccf91 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -1115,6 +1115,7 @@ int dma_async_device_register(struct dma_device *device); | |||
1115 | void dma_async_device_unregister(struct dma_device *device); | 1115 | void dma_async_device_unregister(struct dma_device *device); |
1116 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 1116 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
1117 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); | 1117 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); |
1118 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); | ||
1118 | struct dma_chan *net_dma_find_channel(void); | 1119 | struct dma_chan *net_dma_find_channel(void); |
1119 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 1120 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
1120 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ | 1121 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ |
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index 50fe651da965..af414e1895a5 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h | |||
@@ -11,11 +11,11 @@ | |||
11 | #define SCIx_NOT_SUPPORTED (-1) | 11 | #define SCIx_NOT_SUPPORTED (-1) |
12 | 12 | ||
13 | enum { | 13 | enum { |
14 | SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */ | 14 | SCBRR_ALGO_NONE, /* Compute sampling rate in the driver */ |
15 | SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */ | 15 | SCBRR_ALGO_1, /* clk / (16 * bps) */ |
16 | SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */ | 16 | SCBRR_ALGO_2, /* DIV_ROUND_CLOSEST(clk, 32 * bps) - 1 */ |
17 | SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */ | 17 | SCBRR_ALGO_3, /* clk / (8 * bps) */ |
18 | SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */ | 18 | SCBRR_ALGO_4, /* DIV_ROUND_CLOSEST(clk, 16 * bps) - 1 */ |
19 | SCBRR_ALGO_6, /* HSCIF variable sample rate algorithm */ | 19 | SCBRR_ALGO_6, /* HSCIF variable sample rate algorithm */ |
20 | }; | 20 | }; |
21 | 21 | ||
@@ -70,17 +70,6 @@ enum { | |||
70 | SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ | 70 | SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ |
71 | }; | 71 | }; |
72 | 72 | ||
73 | /* Offsets into the sci_port->gpios array */ | ||
74 | enum { | ||
75 | SCIx_SCK, | ||
76 | SCIx_RXD, | ||
77 | SCIx_TXD, | ||
78 | SCIx_CTS, | ||
79 | SCIx_RTS, | ||
80 | |||
81 | SCIx_NR_FNS, | ||
82 | }; | ||
83 | |||
84 | enum { | 73 | enum { |
85 | SCIx_PROBE_REGTYPE, | 74 | SCIx_PROBE_REGTYPE, |
86 | 75 | ||
@@ -108,10 +97,10 @@ enum { | |||
108 | } | 97 | } |
109 | 98 | ||
110 | #define SCIx_IRQ_IS_MUXED(port) \ | 99 | #define SCIx_IRQ_IS_MUXED(port) \ |
111 | ((port)->cfg->irqs[SCIx_ERI_IRQ] == \ | 100 | ((port)->irqs[SCIx_ERI_IRQ] == \ |
112 | (port)->cfg->irqs[SCIx_RXI_IRQ]) || \ | 101 | (port)->irqs[SCIx_RXI_IRQ]) || \ |
113 | ((port)->cfg->irqs[SCIx_ERI_IRQ] && \ | 102 | ((port)->irqs[SCIx_ERI_IRQ] && \ |
114 | !(port)->cfg->irqs[SCIx_RXI_IRQ]) | 103 | ((port)->irqs[SCIx_RXI_IRQ] < 0)) |
115 | /* | 104 | /* |
116 | * SCI register subset common for all port types. | 105 | * SCI register subset common for all port types. |
117 | * Not all registers will exist on all parts. | 106 | * Not all registers will exist on all parts. |
@@ -142,20 +131,17 @@ struct plat_sci_port_ops { | |||
142 | struct plat_sci_port { | 131 | struct plat_sci_port { |
143 | unsigned long mapbase; /* resource base */ | 132 | unsigned long mapbase; /* resource base */ |
144 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ | 133 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ |
145 | unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */ | ||
146 | unsigned int type; /* SCI / SCIF / IRDA / HSCIF */ | 134 | unsigned int type; /* SCI / SCIF / IRDA / HSCIF */ |
147 | upf_t flags; /* UPF_* flags */ | 135 | upf_t flags; /* UPF_* flags */ |
148 | unsigned long capabilities; /* Port features/capabilities */ | 136 | unsigned long capabilities; /* Port features/capabilities */ |
149 | 137 | ||
138 | unsigned int sampling_rate; | ||
150 | unsigned int scbrr_algo_id; /* SCBRR calculation algo */ | 139 | unsigned int scbrr_algo_id; /* SCBRR calculation algo */ |
151 | unsigned int scscr; /* SCSCR initialization */ | 140 | unsigned int scscr; /* SCSCR initialization */ |
152 | 141 | ||
153 | /* | 142 | /* |
154 | * Platform overrides if necessary, defaults otherwise. | 143 | * Platform overrides if necessary, defaults otherwise. |
155 | */ | 144 | */ |
156 | int overrun_bit; | ||
157 | unsigned int error_mask; | ||
158 | |||
159 | int port_reg; | 145 | int port_reg; |
160 | unsigned char regshift; | 146 | unsigned char regshift; |
161 | unsigned char regtype; | 147 | unsigned char regtype; |
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h index fd4498329c7c..afe442d2629a 100644 --- a/include/linux/tegra-powergate.h +++ b/include/linux/tegra-powergate.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define _MACH_TEGRA_POWERGATE_H_ | 19 | #define _MACH_TEGRA_POWERGATE_H_ |
20 | 20 | ||
21 | struct clk; | 21 | struct clk; |
22 | struct reset_control; | ||
22 | 23 | ||
23 | #define TEGRA_POWERGATE_CPU 0 | 24 | #define TEGRA_POWERGATE_CPU 0 |
24 | #define TEGRA_POWERGATE_3D 1 | 25 | #define TEGRA_POWERGATE_3D 1 |
@@ -52,7 +53,8 @@ int tegra_powergate_power_off(int id); | |||
52 | int tegra_powergate_remove_clamping(int id); | 53 | int tegra_powergate_remove_clamping(int id); |
53 | 54 | ||
54 | /* Must be called with clk disabled, and returns with clk enabled */ | 55 | /* Must be called with clk disabled, and returns with clk enabled */ |
55 | int tegra_powergate_sequence_power_up(int id, struct clk *clk); | 56 | int tegra_powergate_sequence_power_up(int id, struct clk *clk, |
57 | struct reset_control *rst); | ||
56 | #else | 58 | #else |
57 | static inline int tegra_powergate_is_powered(int id) | 59 | static inline int tegra_powergate_is_powered(int id) |
58 | { | 60 | { |
@@ -74,7 +76,8 @@ static inline int tegra_powergate_remove_clamping(int id) | |||
74 | return -ENOSYS; | 76 | return -ENOSYS; |
75 | } | 77 | } |
76 | 78 | ||
77 | static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk) | 79 | static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk, |
80 | struct reset_control *rst); | ||
78 | { | 81 | { |
79 | return -ENOSYS; | 82 | return -ENOSYS; |
80 | } | 83 | } |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index e48d38a1b95c..e634eb78ed03 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
@@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC | |||
25 | 25 | ||
26 | config SND_AT91_SOC_SAM9G20_WM8731 | 26 | config SND_AT91_SOC_SAM9G20_WM8731 |
27 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" | 27 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" |
28 | depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS | 28 | depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC |
29 | select SND_ATMEL_SOC_PDC | 29 | select SND_ATMEL_SOC_PDC |
30 | select SND_ATMEL_SOC_SSC | 30 | select SND_ATMEL_SOC_SSC |
31 | select SND_SOC_WM8731 | 31 | select SND_SOC_WM8731 |
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig index 65a85f542521..9f9c1856f822 100644 --- a/sound/soc/tegra/Kconfig +++ b/sound/soc/tegra/Kconfig | |||
@@ -1,6 +1,8 @@ | |||
1 | config SND_SOC_TEGRA | 1 | config SND_SOC_TEGRA |
2 | tristate "SoC Audio for the Tegra System-on-Chip" | 2 | tristate "SoC Audio for the Tegra System-on-Chip" |
3 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST | 3 | depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST |
4 | depends on COMMON_CLK | ||
5 | depends on RESET_CONTROLLER | ||
4 | select REGMAP_MMIO | 6 | select REGMAP_MMIO |
5 | select SND_SOC_GENERIC_DMAENGINE_PCM | 7 | select SND_SOC_GENERIC_DMAENGINE_PCM |
6 | help | 8 | help |
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 088518d7694a..cf5e1cfe818d 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c | |||
@@ -313,7 +313,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
313 | { | 313 | { |
314 | struct tegra20_ac97 *ac97; | 314 | struct tegra20_ac97 *ac97; |
315 | struct resource *mem; | 315 | struct resource *mem; |
316 | u32 of_dma[2]; | ||
317 | void __iomem *regs; | 316 | void __iomem *regs; |
318 | int ret = 0; | 317 | int ret = 0; |
319 | 318 | ||
@@ -348,14 +347,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
348 | goto err_clk_put; | 347 | goto err_clk_put; |
349 | } | 348 | } |
350 | 349 | ||
351 | if (of_property_read_u32_array(pdev->dev.of_node, | ||
352 | "nvidia,dma-request-selector", | ||
353 | of_dma, 2) < 0) { | ||
354 | dev_err(&pdev->dev, "No DMA resource\n"); | ||
355 | ret = -ENODEV; | ||
356 | goto err_clk_put; | ||
357 | } | ||
358 | |||
359 | ac97->reset_gpio = of_get_named_gpio(pdev->dev.of_node, | 350 | ac97->reset_gpio = of_get_named_gpio(pdev->dev.of_node, |
360 | "nvidia,codec-reset-gpio", 0); | 351 | "nvidia,codec-reset-gpio", 0); |
361 | if (gpio_is_valid(ac97->reset_gpio)) { | 352 | if (gpio_is_valid(ac97->reset_gpio)) { |
@@ -380,12 +371,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
380 | ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1; | 371 | ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1; |
381 | ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 372 | ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
382 | ac97->capture_dma_data.maxburst = 4; | 373 | ac97->capture_dma_data.maxburst = 4; |
383 | ac97->capture_dma_data.slave_id = of_dma[1]; | ||
384 | 374 | ||
385 | ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1; | 375 | ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1; |
386 | ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 376 | ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
387 | ac97->playback_dma_data.maxburst = 4; | 377 | ac97->playback_dma_data.maxburst = 4; |
388 | ac97->playback_dma_data.slave_id = of_dma[1]; | ||
389 | 378 | ||
390 | ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); | 379 | ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); |
391 | if (ret) | 380 | if (ret) |
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index 8c819f811470..42c1f6bfaf2e 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c | |||
@@ -339,9 +339,7 @@ static const struct regmap_config tegra20_i2s_regmap_config = { | |||
339 | static int tegra20_i2s_platform_probe(struct platform_device *pdev) | 339 | static int tegra20_i2s_platform_probe(struct platform_device *pdev) |
340 | { | 340 | { |
341 | struct tegra20_i2s *i2s; | 341 | struct tegra20_i2s *i2s; |
342 | struct resource *mem, *memregion, *dmareq; | 342 | struct resource *mem, *memregion; |
343 | u32 of_dma[2]; | ||
344 | u32 dma_ch; | ||
345 | void __iomem *regs; | 343 | void __iomem *regs; |
346 | int ret; | 344 | int ret; |
347 | 345 | ||
@@ -370,20 +368,6 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) | |||
370 | goto err_clk_put; | 368 | goto err_clk_put; |
371 | } | 369 | } |
372 | 370 | ||
373 | dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
374 | if (!dmareq) { | ||
375 | if (of_property_read_u32_array(pdev->dev.of_node, | ||
376 | "nvidia,dma-request-selector", | ||
377 | of_dma, 2) < 0) { | ||
378 | dev_err(&pdev->dev, "No DMA resource\n"); | ||
379 | ret = -ENODEV; | ||
380 | goto err_clk_put; | ||
381 | } | ||
382 | dma_ch = of_dma[1]; | ||
383 | } else { | ||
384 | dma_ch = dmareq->start; | ||
385 | } | ||
386 | |||
387 | memregion = devm_request_mem_region(&pdev->dev, mem->start, | 371 | memregion = devm_request_mem_region(&pdev->dev, mem->start, |
388 | resource_size(mem), DRV_NAME); | 372 | resource_size(mem), DRV_NAME); |
389 | if (!memregion) { | 373 | if (!memregion) { |
@@ -410,12 +394,10 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) | |||
410 | i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2; | 394 | i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2; |
411 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 395 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
412 | i2s->capture_dma_data.maxburst = 4; | 396 | i2s->capture_dma_data.maxburst = 4; |
413 | i2s->capture_dma_data.slave_id = dma_ch; | ||
414 | 397 | ||
415 | i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1; | 398 | i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1; |
416 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 399 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
417 | i2s->playback_dma_data.maxburst = 4; | 400 | i2s->playback_dma_data.maxburst = 4; |
418 | i2s->playback_dma_data.slave_id = dma_ch; | ||
419 | 401 | ||
420 | pm_runtime_enable(&pdev->dev); | 402 | pm_runtime_enable(&pdev->dev); |
421 | if (!pm_runtime_enabled(&pdev->dev)) { | 403 | if (!pm_runtime_enabled(&pdev->dev)) { |
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 31154338c1eb..d6f4c9940e0c 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c | |||
@@ -24,8 +24,8 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/pm_runtime.h> | 25 | #include <linux/pm_runtime.h> |
26 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
27 | #include <linux/reset.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/clk/tegra.h> | ||
29 | #include <sound/soc.h> | 29 | #include <sound/soc.h> |
30 | #include "tegra30_ahub.h" | 30 | #include "tegra30_ahub.h" |
31 | 31 | ||
@@ -95,8 +95,8 @@ static int tegra30_ahub_runtime_resume(struct device *dev) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, | 97 | int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, |
98 | dma_addr_t *fiforeg, | 98 | char *dmachan, int dmachan_len, |
99 | unsigned int *reqsel) | 99 | dma_addr_t *fiforeg) |
100 | { | 100 | { |
101 | int channel; | 101 | int channel; |
102 | u32 reg, val; | 102 | u32 reg, val; |
@@ -110,9 +110,11 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, | |||
110 | __set_bit(channel, ahub->rx_usage); | 110 | __set_bit(channel, ahub->rx_usage); |
111 | 111 | ||
112 | *rxcif = TEGRA30_AHUB_RXCIF_APBIF_RX0 + channel; | 112 | *rxcif = TEGRA30_AHUB_RXCIF_APBIF_RX0 + channel; |
113 | snprintf(dmachan, dmachan_len, "rx%d", channel); | ||
113 | *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + | 114 | *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + |
114 | (channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE); | 115 | (channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE); |
115 | *reqsel = ahub->dma_sel + channel; | 116 | |
117 | pm_runtime_get_sync(ahub->dev); | ||
116 | 118 | ||
117 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 119 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
118 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 120 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
@@ -140,6 +142,8 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, | |||
140 | (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE); | 142 | (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE); |
141 | ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); | 143 | ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); |
142 | 144 | ||
145 | pm_runtime_put(ahub->dev); | ||
146 | |||
143 | return 0; | 147 | return 0; |
144 | } | 148 | } |
145 | EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_rx_fifo); | 149 | EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_rx_fifo); |
@@ -149,12 +153,16 @@ int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif) | |||
149 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; | 153 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; |
150 | int reg, val; | 154 | int reg, val; |
151 | 155 | ||
156 | pm_runtime_get_sync(ahub->dev); | ||
157 | |||
152 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 158 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
153 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 159 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
154 | val = tegra30_apbif_read(reg); | 160 | val = tegra30_apbif_read(reg); |
155 | val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_EN; | 161 | val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_EN; |
156 | tegra30_apbif_write(reg, val); | 162 | tegra30_apbif_write(reg, val); |
157 | 163 | ||
164 | pm_runtime_put(ahub->dev); | ||
165 | |||
158 | return 0; | 166 | return 0; |
159 | } | 167 | } |
160 | EXPORT_SYMBOL_GPL(tegra30_ahub_enable_rx_fifo); | 168 | EXPORT_SYMBOL_GPL(tegra30_ahub_enable_rx_fifo); |
@@ -164,12 +172,16 @@ int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif) | |||
164 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; | 172 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; |
165 | int reg, val; | 173 | int reg, val; |
166 | 174 | ||
175 | pm_runtime_get_sync(ahub->dev); | ||
176 | |||
167 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 177 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
168 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 178 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
169 | val = tegra30_apbif_read(reg); | 179 | val = tegra30_apbif_read(reg); |
170 | val &= ~TEGRA30_AHUB_CHANNEL_CTRL_RX_EN; | 180 | val &= ~TEGRA30_AHUB_CHANNEL_CTRL_RX_EN; |
171 | tegra30_apbif_write(reg, val); | 181 | tegra30_apbif_write(reg, val); |
172 | 182 | ||
183 | pm_runtime_put(ahub->dev); | ||
184 | |||
173 | return 0; | 185 | return 0; |
174 | } | 186 | } |
175 | EXPORT_SYMBOL_GPL(tegra30_ahub_disable_rx_fifo); | 187 | EXPORT_SYMBOL_GPL(tegra30_ahub_disable_rx_fifo); |
@@ -185,8 +197,8 @@ int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif) | |||
185 | EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo); | 197 | EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo); |
186 | 198 | ||
187 | int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, | 199 | int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, |
188 | dma_addr_t *fiforeg, | 200 | char *dmachan, int dmachan_len, |
189 | unsigned int *reqsel) | 201 | dma_addr_t *fiforeg) |
190 | { | 202 | { |
191 | int channel; | 203 | int channel; |
192 | u32 reg, val; | 204 | u32 reg, val; |
@@ -200,9 +212,11 @@ int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, | |||
200 | __set_bit(channel, ahub->tx_usage); | 212 | __set_bit(channel, ahub->tx_usage); |
201 | 213 | ||
202 | *txcif = TEGRA30_AHUB_TXCIF_APBIF_TX0 + channel; | 214 | *txcif = TEGRA30_AHUB_TXCIF_APBIF_TX0 + channel; |
215 | snprintf(dmachan, dmachan_len, "tx%d", channel); | ||
203 | *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO + | 216 | *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO + |
204 | (channel * TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE); | 217 | (channel * TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE); |
205 | *reqsel = ahub->dma_sel + channel; | 218 | |
219 | pm_runtime_get_sync(ahub->dev); | ||
206 | 220 | ||
207 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 221 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
208 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 222 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
@@ -230,6 +244,8 @@ int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, | |||
230 | (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE); | 244 | (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE); |
231 | ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); | 245 | ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); |
232 | 246 | ||
247 | pm_runtime_put(ahub->dev); | ||
248 | |||
233 | return 0; | 249 | return 0; |
234 | } | 250 | } |
235 | EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_tx_fifo); | 251 | EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_tx_fifo); |
@@ -239,12 +255,16 @@ int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif) | |||
239 | int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0; | 255 | int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0; |
240 | int reg, val; | 256 | int reg, val; |
241 | 257 | ||
258 | pm_runtime_get_sync(ahub->dev); | ||
259 | |||
242 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 260 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
243 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 261 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
244 | val = tegra30_apbif_read(reg); | 262 | val = tegra30_apbif_read(reg); |
245 | val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_EN; | 263 | val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_EN; |
246 | tegra30_apbif_write(reg, val); | 264 | tegra30_apbif_write(reg, val); |
247 | 265 | ||
266 | pm_runtime_put(ahub->dev); | ||
267 | |||
248 | return 0; | 268 | return 0; |
249 | } | 269 | } |
250 | EXPORT_SYMBOL_GPL(tegra30_ahub_enable_tx_fifo); | 270 | EXPORT_SYMBOL_GPL(tegra30_ahub_enable_tx_fifo); |
@@ -254,12 +274,16 @@ int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif) | |||
254 | int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0; | 274 | int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0; |
255 | int reg, val; | 275 | int reg, val; |
256 | 276 | ||
277 | pm_runtime_get_sync(ahub->dev); | ||
278 | |||
257 | reg = TEGRA30_AHUB_CHANNEL_CTRL + | 279 | reg = TEGRA30_AHUB_CHANNEL_CTRL + |
258 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); | 280 | (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); |
259 | val = tegra30_apbif_read(reg); | 281 | val = tegra30_apbif_read(reg); |
260 | val &= ~TEGRA30_AHUB_CHANNEL_CTRL_TX_EN; | 282 | val &= ~TEGRA30_AHUB_CHANNEL_CTRL_TX_EN; |
261 | tegra30_apbif_write(reg, val); | 283 | tegra30_apbif_write(reg, val); |
262 | 284 | ||
285 | pm_runtime_put(ahub->dev); | ||
286 | |||
263 | return 0; | 287 | return 0; |
264 | } | 288 | } |
265 | EXPORT_SYMBOL_GPL(tegra30_ahub_disable_tx_fifo); | 289 | EXPORT_SYMBOL_GPL(tegra30_ahub_disable_tx_fifo); |
@@ -280,10 +304,14 @@ int tegra30_ahub_set_rx_cif_source(enum tegra30_ahub_rxcif rxcif, | |||
280 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; | 304 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; |
281 | int reg; | 305 | int reg; |
282 | 306 | ||
307 | pm_runtime_get_sync(ahub->dev); | ||
308 | |||
283 | reg = TEGRA30_AHUB_AUDIO_RX + | 309 | reg = TEGRA30_AHUB_AUDIO_RX + |
284 | (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE); | 310 | (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE); |
285 | tegra30_audio_write(reg, 1 << txcif); | 311 | tegra30_audio_write(reg, 1 << txcif); |
286 | 312 | ||
313 | pm_runtime_put(ahub->dev); | ||
314 | |||
287 | return 0; | 315 | return 0; |
288 | } | 316 | } |
289 | EXPORT_SYMBOL_GPL(tegra30_ahub_set_rx_cif_source); | 317 | EXPORT_SYMBOL_GPL(tegra30_ahub_set_rx_cif_source); |
@@ -293,35 +321,51 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif) | |||
293 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; | 321 | int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; |
294 | int reg; | 322 | int reg; |
295 | 323 | ||
324 | pm_runtime_get_sync(ahub->dev); | ||
325 | |||
296 | reg = TEGRA30_AHUB_AUDIO_RX + | 326 | reg = TEGRA30_AHUB_AUDIO_RX + |
297 | (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE); | 327 | (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE); |
298 | tegra30_audio_write(reg, 0); | 328 | tegra30_audio_write(reg, 0); |
299 | 329 | ||
330 | pm_runtime_put(ahub->dev); | ||
331 | |||
300 | return 0; | 332 | return 0; |
301 | } | 333 | } |
302 | EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); | 334 | EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); |
303 | 335 | ||
304 | #define CLK_LIST_MASK_TEGRA30 BIT(0) | 336 | #define MOD_LIST_MASK_TEGRA30 BIT(0) |
305 | #define CLK_LIST_MASK_TEGRA114 BIT(1) | 337 | #define MOD_LIST_MASK_TEGRA114 BIT(1) |
338 | #define MOD_LIST_MASK_TEGRA124 BIT(2) | ||
306 | 339 | ||
307 | #define CLK_LIST_MASK_TEGRA30_OR_LATER \ | 340 | #define MOD_LIST_MASK_TEGRA30_OR_LATER \ |
308 | (CLK_LIST_MASK_TEGRA30 | CLK_LIST_MASK_TEGRA114) | 341 | (MOD_LIST_MASK_TEGRA30 | MOD_LIST_MASK_TEGRA114 | \ |
342 | MOD_LIST_MASK_TEGRA124) | ||
343 | #define MOD_LIST_MASK_TEGRA114_OR_LATER \ | ||
344 | (MOD_LIST_MASK_TEGRA114 | MOD_LIST_MASK_TEGRA124) | ||
309 | 345 | ||
310 | static const struct { | 346 | static const struct { |
311 | const char *clk_name; | 347 | const char *rst_name; |
312 | u32 clk_list_mask; | 348 | u32 mod_list_mask; |
313 | } configlink_clocks[] = { | 349 | } configlink_mods[] = { |
314 | { "i2s0", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 350 | { "i2s0", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
315 | { "i2s1", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 351 | { "i2s1", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
316 | { "i2s2", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 352 | { "i2s2", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
317 | { "i2s3", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 353 | { "i2s3", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
318 | { "i2s4", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 354 | { "i2s4", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
319 | { "dam0", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 355 | { "dam0", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
320 | { "dam1", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 356 | { "dam1", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
321 | { "dam2", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 357 | { "dam2", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
322 | { "spdif_in", CLK_LIST_MASK_TEGRA30_OR_LATER }, | 358 | { "spdif", MOD_LIST_MASK_TEGRA30_OR_LATER }, |
323 | { "amx", CLK_LIST_MASK_TEGRA114 }, | 359 | { "amx", MOD_LIST_MASK_TEGRA114_OR_LATER }, |
324 | { "adx", CLK_LIST_MASK_TEGRA114 }, | 360 | { "adx", MOD_LIST_MASK_TEGRA114_OR_LATER }, |
361 | { "amx1", MOD_LIST_MASK_TEGRA124 }, | ||
362 | { "adx1", MOD_LIST_MASK_TEGRA124 }, | ||
363 | { "afc0", MOD_LIST_MASK_TEGRA124 }, | ||
364 | { "afc1", MOD_LIST_MASK_TEGRA124 }, | ||
365 | { "afc2", MOD_LIST_MASK_TEGRA124 }, | ||
366 | { "afc3", MOD_LIST_MASK_TEGRA124 }, | ||
367 | { "afc4", MOD_LIST_MASK_TEGRA124 }, | ||
368 | { "afc5", MOD_LIST_MASK_TEGRA124 }, | ||
325 | }; | 369 | }; |
326 | 370 | ||
327 | #define LAST_REG(name) \ | 371 | #define LAST_REG(name) \ |
@@ -450,17 +494,17 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = { | |||
450 | }; | 494 | }; |
451 | 495 | ||
452 | static struct tegra30_ahub_soc_data soc_data_tegra30 = { | 496 | static struct tegra30_ahub_soc_data soc_data_tegra30 = { |
453 | .clk_list_mask = CLK_LIST_MASK_TEGRA30, | 497 | .mod_list_mask = MOD_LIST_MASK_TEGRA30, |
454 | .set_audio_cif = tegra30_ahub_set_cif, | 498 | .set_audio_cif = tegra30_ahub_set_cif, |
455 | }; | 499 | }; |
456 | 500 | ||
457 | static struct tegra30_ahub_soc_data soc_data_tegra114 = { | 501 | static struct tegra30_ahub_soc_data soc_data_tegra114 = { |
458 | .clk_list_mask = CLK_LIST_MASK_TEGRA114, | 502 | .mod_list_mask = MOD_LIST_MASK_TEGRA114, |
459 | .set_audio_cif = tegra30_ahub_set_cif, | 503 | .set_audio_cif = tegra30_ahub_set_cif, |
460 | }; | 504 | }; |
461 | 505 | ||
462 | static struct tegra30_ahub_soc_data soc_data_tegra124 = { | 506 | static struct tegra30_ahub_soc_data soc_data_tegra124 = { |
463 | .clk_list_mask = CLK_LIST_MASK_TEGRA114, | 507 | .mod_list_mask = MOD_LIST_MASK_TEGRA124, |
464 | .set_audio_cif = tegra124_ahub_set_cif, | 508 | .set_audio_cif = tegra124_ahub_set_cif, |
465 | }; | 509 | }; |
466 | 510 | ||
@@ -475,10 +519,9 @@ static int tegra30_ahub_probe(struct platform_device *pdev) | |||
475 | { | 519 | { |
476 | const struct of_device_id *match; | 520 | const struct of_device_id *match; |
477 | const struct tegra30_ahub_soc_data *soc_data; | 521 | const struct tegra30_ahub_soc_data *soc_data; |
478 | struct clk *clk; | 522 | struct reset_control *rst; |
479 | int i; | 523 | int i; |
480 | struct resource *res0, *res1, *region; | 524 | struct resource *res0, *res1, *region; |
481 | u32 of_dma[2]; | ||
482 | void __iomem *regs_apbif, *regs_ahub; | 525 | void __iomem *regs_apbif, *regs_ahub; |
483 | int ret = 0; | 526 | int ret = 0; |
484 | 527 | ||
@@ -495,19 +538,24 @@ static int tegra30_ahub_probe(struct platform_device *pdev) | |||
495 | * operate correctly, all devices on this bus must be out of reset. | 538 | * operate correctly, all devices on this bus must be out of reset. |
496 | * Ensure that here. | 539 | * Ensure that here. |
497 | */ | 540 | */ |
498 | for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) { | 541 | for (i = 0; i < ARRAY_SIZE(configlink_mods); i++) { |
499 | if (!(configlink_clocks[i].clk_list_mask & | 542 | if (!(configlink_mods[i].mod_list_mask & |
500 | soc_data->clk_list_mask)) | 543 | soc_data->mod_list_mask)) |
501 | continue; | 544 | continue; |
502 | clk = clk_get(&pdev->dev, configlink_clocks[i].clk_name); | 545 | |
503 | if (IS_ERR(clk)) { | 546 | rst = reset_control_get(&pdev->dev, |
504 | dev_err(&pdev->dev, "Can't get clock %s\n", | 547 | configlink_mods[i].rst_name); |
505 | configlink_clocks[i].clk_name); | 548 | if (IS_ERR(rst)) { |
506 | ret = PTR_ERR(clk); | 549 | dev_err(&pdev->dev, "Can't get reset %s\n", |
550 | configlink_mods[i].rst_name); | ||
551 | ret = PTR_ERR(rst); | ||
507 | goto err; | 552 | goto err; |
508 | } | 553 | } |
509 | tegra_periph_reset_deassert(clk); | 554 | |
510 | clk_put(clk); | 555 | ret = reset_control_deassert(rst); |
556 | reset_control_put(rst); | ||
557 | if (ret) | ||
558 | goto err; | ||
511 | } | 559 | } |
512 | 560 | ||
513 | ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), | 561 | ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), |
@@ -536,16 +584,6 @@ static int tegra30_ahub_probe(struct platform_device *pdev) | |||
536 | goto err_clk_put_d_audio; | 584 | goto err_clk_put_d_audio; |
537 | } | 585 | } |
538 | 586 | ||
539 | if (of_property_read_u32_array(pdev->dev.of_node, | ||
540 | "nvidia,dma-request-selector", | ||
541 | of_dma, 2) < 0) { | ||
542 | dev_err(&pdev->dev, | ||
543 | "Missing property nvidia,dma-request-selector\n"); | ||
544 | ret = -ENODEV; | ||
545 | goto err_clk_put_d_audio; | ||
546 | } | ||
547 | ahub->dma_sel = of_dma[1]; | ||
548 | |||
549 | res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 587 | res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
550 | if (!res0) { | 588 | if (!res0) { |
551 | dev_err(&pdev->dev, "No apbif memory resource\n"); | 589 | dev_err(&pdev->dev, "No apbif memory resource\n"); |
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h index d67321d90faa..fd7ba75ed814 100644 --- a/sound/soc/tegra/tegra30_ahub.h +++ b/sound/soc/tegra/tegra30_ahub.h | |||
@@ -465,15 +465,15 @@ enum tegra30_ahub_rxcif { | |||
465 | }; | 465 | }; |
466 | 466 | ||
467 | extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, | 467 | extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, |
468 | dma_addr_t *fiforeg, | 468 | char *dmachan, int dmachan_len, |
469 | unsigned int *reqsel); | 469 | dma_addr_t *fiforeg); |
470 | extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif); | 470 | extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif); |
471 | extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif); | 471 | extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif); |
472 | extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif); | 472 | extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif); |
473 | 473 | ||
474 | extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, | 474 | extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, |
475 | dma_addr_t *fiforeg, | 475 | char *dmachan, int dmachan_len, |
476 | unsigned int *reqsel); | 476 | dma_addr_t *fiforeg); |
477 | extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif); | 477 | extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif); |
478 | extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif); | 478 | extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif); |
479 | extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif); | 479 | extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif); |
@@ -502,7 +502,7 @@ void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg, | |||
502 | struct tegra30_ahub_cif_conf *conf); | 502 | struct tegra30_ahub_cif_conf *conf); |
503 | 503 | ||
504 | struct tegra30_ahub_soc_data { | 504 | struct tegra30_ahub_soc_data { |
505 | u32 clk_list_mask; | 505 | u32 mod_list_mask; |
506 | void (*set_audio_cif)(struct regmap *regmap, | 506 | void (*set_audio_cif)(struct regmap *regmap, |
507 | unsigned int reg, | 507 | unsigned int reg, |
508 | struct tegra30_ahub_cif_conf *conf); | 508 | struct tegra30_ahub_cif_conf *conf); |
@@ -524,7 +524,6 @@ struct tegra30_ahub { | |||
524 | struct device *dev; | 524 | struct device *dev; |
525 | struct clk *clk_d_audio; | 525 | struct clk *clk_d_audio; |
526 | struct clk *clk_apbif; | 526 | struct clk *clk_apbif; |
527 | int dma_sel; | ||
528 | resource_size_t apbif_addr; | 527 | resource_size_t apbif_addr; |
529 | struct regmap *regmap_apbif; | 528 | struct regmap *regmap_apbif; |
530 | struct regmap *regmap_ahub; | 529 | struct regmap *regmap_ahub; |
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 02247fee1cf7..49ad9366add8 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c | |||
@@ -73,47 +73,6 @@ static int tegra30_i2s_runtime_resume(struct device *dev) | |||
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int tegra30_i2s_startup(struct snd_pcm_substream *substream, | ||
77 | struct snd_soc_dai *dai) | ||
78 | { | ||
79 | struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); | ||
80 | int ret; | ||
81 | |||
82 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
83 | ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif, | ||
84 | &i2s->playback_dma_data.addr, | ||
85 | &i2s->playback_dma_data.slave_id); | ||
86 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
87 | i2s->playback_dma_data.maxburst = 4; | ||
88 | tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif, | ||
89 | i2s->playback_fifo_cif); | ||
90 | } else { | ||
91 | ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif, | ||
92 | &i2s->capture_dma_data.addr, | ||
93 | &i2s->capture_dma_data.slave_id); | ||
94 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
95 | i2s->capture_dma_data.maxburst = 4; | ||
96 | tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif, | ||
97 | i2s->capture_i2s_cif); | ||
98 | } | ||
99 | |||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | static void tegra30_i2s_shutdown(struct snd_pcm_substream *substream, | ||
104 | struct snd_soc_dai *dai) | ||
105 | { | ||
106 | struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); | ||
107 | |||
108 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
109 | tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif); | ||
110 | tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); | ||
111 | } else { | ||
112 | tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif); | ||
113 | tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, | 76 | static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, |
118 | unsigned int fmt) | 77 | unsigned int fmt) |
119 | { | 78 | { |
@@ -317,8 +276,6 @@ static int tegra30_i2s_probe(struct snd_soc_dai *dai) | |||
317 | } | 276 | } |
318 | 277 | ||
319 | static struct snd_soc_dai_ops tegra30_i2s_dai_ops = { | 278 | static struct snd_soc_dai_ops tegra30_i2s_dai_ops = { |
320 | .startup = tegra30_i2s_startup, | ||
321 | .shutdown = tegra30_i2s_shutdown, | ||
322 | .set_fmt = tegra30_i2s_set_fmt, | 279 | .set_fmt = tegra30_i2s_set_fmt, |
323 | .hw_params = tegra30_i2s_hw_params, | 280 | .hw_params = tegra30_i2s_hw_params, |
324 | .trigger = tegra30_i2s_trigger, | 281 | .trigger = tegra30_i2s_trigger, |
@@ -499,15 +456,51 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) | |||
499 | goto err_pm_disable; | 456 | goto err_pm_disable; |
500 | } | 457 | } |
501 | 458 | ||
459 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
460 | i2s->playback_dma_data.maxburst = 4; | ||
461 | ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif, | ||
462 | i2s->playback_dma_chan, | ||
463 | sizeof(i2s->playback_dma_chan), | ||
464 | &i2s->playback_dma_data.addr); | ||
465 | if (ret) { | ||
466 | dev_err(&pdev->dev, "Could not alloc TX FIFO: %d\n", ret); | ||
467 | goto err_suspend; | ||
468 | } | ||
469 | ret = tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif, | ||
470 | i2s->playback_fifo_cif); | ||
471 | if (ret) { | ||
472 | dev_err(&pdev->dev, "Could not route TX FIFO: %d\n", ret); | ||
473 | goto err_free_tx_fifo; | ||
474 | } | ||
475 | |||
476 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
477 | i2s->capture_dma_data.maxburst = 4; | ||
478 | ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif, | ||
479 | i2s->capture_dma_chan, | ||
480 | sizeof(i2s->capture_dma_chan), | ||
481 | &i2s->capture_dma_data.addr); | ||
482 | if (ret) { | ||
483 | dev_err(&pdev->dev, "Could not alloc RX FIFO: %d\n", ret); | ||
484 | goto err_unroute_tx_fifo; | ||
485 | } | ||
486 | ret = tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif, | ||
487 | i2s->capture_i2s_cif); | ||
488 | if (ret) { | ||
489 | dev_err(&pdev->dev, "Could not route TX FIFO: %d\n", ret); | ||
490 | goto err_free_rx_fifo; | ||
491 | } | ||
492 | |||
502 | ret = snd_soc_register_component(&pdev->dev, &tegra30_i2s_component, | 493 | ret = snd_soc_register_component(&pdev->dev, &tegra30_i2s_component, |
503 | &i2s->dai, 1); | 494 | &i2s->dai, 1); |
504 | if (ret) { | 495 | if (ret) { |
505 | dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); | 496 | dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); |
506 | ret = -ENOMEM; | 497 | ret = -ENOMEM; |
507 | goto err_suspend; | 498 | goto err_unroute_rx_fifo; |
508 | } | 499 | } |
509 | 500 | ||
510 | ret = tegra_pcm_platform_register(&pdev->dev); | 501 | ret = tegra_pcm_platform_register_with_chan_names(&pdev->dev, |
502 | &i2s->dma_config, i2s->playback_dma_chan, | ||
503 | i2s->capture_dma_chan); | ||
511 | if (ret) { | 504 | if (ret) { |
512 | dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); | 505 | dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); |
513 | goto err_unregister_component; | 506 | goto err_unregister_component; |
@@ -517,6 +510,14 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) | |||
517 | 510 | ||
518 | err_unregister_component: | 511 | err_unregister_component: |
519 | snd_soc_unregister_component(&pdev->dev); | 512 | snd_soc_unregister_component(&pdev->dev); |
513 | err_unroute_rx_fifo: | ||
514 | tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif); | ||
515 | err_free_rx_fifo: | ||
516 | tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif); | ||
517 | err_unroute_tx_fifo: | ||
518 | tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif); | ||
519 | err_free_tx_fifo: | ||
520 | tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); | ||
520 | err_suspend: | 521 | err_suspend: |
521 | if (!pm_runtime_status_suspended(&pdev->dev)) | 522 | if (!pm_runtime_status_suspended(&pdev->dev)) |
522 | tegra30_i2s_runtime_suspend(&pdev->dev); | 523 | tegra30_i2s_runtime_suspend(&pdev->dev); |
@@ -539,6 +540,12 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) | |||
539 | tegra_pcm_platform_unregister(&pdev->dev); | 540 | tegra_pcm_platform_unregister(&pdev->dev); |
540 | snd_soc_unregister_component(&pdev->dev); | 541 | snd_soc_unregister_component(&pdev->dev); |
541 | 542 | ||
543 | tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif); | ||
544 | tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif); | ||
545 | |||
546 | tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif); | ||
547 | tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); | ||
548 | |||
542 | clk_put(i2s->clk_i2s); | 549 | clk_put(i2s->clk_i2s); |
543 | 550 | ||
544 | return 0; | 551 | return 0; |
diff --git a/sound/soc/tegra/tegra30_i2s.h b/sound/soc/tegra/tegra30_i2s.h index 4d0b0a30dbfb..774fc6ad2026 100644 --- a/sound/soc/tegra/tegra30_i2s.h +++ b/sound/soc/tegra/tegra30_i2s.h | |||
@@ -238,11 +238,14 @@ struct tegra30_i2s { | |||
238 | struct clk *clk_i2s; | 238 | struct clk *clk_i2s; |
239 | enum tegra30_ahub_txcif capture_i2s_cif; | 239 | enum tegra30_ahub_txcif capture_i2s_cif; |
240 | enum tegra30_ahub_rxcif capture_fifo_cif; | 240 | enum tegra30_ahub_rxcif capture_fifo_cif; |
241 | char capture_dma_chan[8]; | ||
241 | struct snd_dmaengine_dai_dma_data capture_dma_data; | 242 | struct snd_dmaengine_dai_dma_data capture_dma_data; |
242 | enum tegra30_ahub_rxcif playback_i2s_cif; | 243 | enum tegra30_ahub_rxcif playback_i2s_cif; |
243 | enum tegra30_ahub_txcif playback_fifo_cif; | 244 | enum tegra30_ahub_txcif playback_fifo_cif; |
245 | char playback_dma_chan[8]; | ||
244 | struct snd_dmaengine_dai_dma_data playback_dma_data; | 246 | struct snd_dmaengine_dai_dma_data playback_dma_data; |
245 | struct regmap *regmap; | 247 | struct regmap *regmap; |
248 | struct snd_dmaengine_pcm_config dma_config; | ||
246 | }; | 249 | }; |
247 | 250 | ||
248 | #endif | 251 | #endif |
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index c09ffd18791b..93caed500565 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c | |||
@@ -58,12 +58,23 @@ static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = { | |||
58 | 58 | ||
59 | int tegra_pcm_platform_register(struct device *dev) | 59 | int tegra_pcm_platform_register(struct device *dev) |
60 | { | 60 | { |
61 | return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, | 61 | return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, 0); |
62 | SND_DMAENGINE_PCM_FLAG_NO_DT | | ||
63 | SND_DMAENGINE_PCM_FLAG_COMPAT); | ||
64 | } | 62 | } |
65 | EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); | 63 | EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); |
66 | 64 | ||
65 | int tegra_pcm_platform_register_with_chan_names(struct device *dev, | ||
66 | struct snd_dmaengine_pcm_config *config, | ||
67 | char *txdmachan, char *rxdmachan) | ||
68 | { | ||
69 | *config = tegra_dmaengine_pcm_config; | ||
70 | config->dma_dev = dev->parent; | ||
71 | config->chan_names[0] = txdmachan; | ||
72 | config->chan_names[1] = rxdmachan; | ||
73 | |||
74 | return snd_dmaengine_pcm_register(dev, config, 0); | ||
75 | } | ||
76 | EXPORT_SYMBOL_GPL(tegra_pcm_platform_register_with_chan_names); | ||
77 | |||
67 | void tegra_pcm_platform_unregister(struct device *dev) | 78 | void tegra_pcm_platform_unregister(struct device *dev) |
68 | { | 79 | { |
69 | return snd_dmaengine_pcm_unregister(dev); | 80 | return snd_dmaengine_pcm_unregister(dev); |
diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h index 68ad901714a9..7883dec748a3 100644 --- a/sound/soc/tegra/tegra_pcm.h +++ b/sound/soc/tegra/tegra_pcm.h | |||
@@ -31,7 +31,12 @@ | |||
31 | #ifndef __TEGRA_PCM_H__ | 31 | #ifndef __TEGRA_PCM_H__ |
32 | #define __TEGRA_PCM_H__ | 32 | #define __TEGRA_PCM_H__ |
33 | 33 | ||
34 | struct snd_dmaengine_pcm_config; | ||
35 | |||
34 | int tegra_pcm_platform_register(struct device *dev); | 36 | int tegra_pcm_platform_register(struct device *dev); |
37 | int tegra_pcm_platform_register_with_chan_names(struct device *dev, | ||
38 | struct snd_dmaengine_pcm_config *config, | ||
39 | char *txdmachan, char *rxdmachan); | ||
35 | void tegra_pcm_platform_unregister(struct device *dev); | 40 | void tegra_pcm_platform_unregister(struct device *dev); |
36 | 41 | ||
37 | #endif | 42 | #endif |