diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 15:31:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 15:31:18 -0400 |
commit | 6fa52ed33bea997374a88dbacbba5bf8c7ac4fef (patch) | |
tree | a0904b78d66c9b99d6acf944cf58bcaa0cffc511 | |
parent | 1db772216f48978d5146b858586f6178433aad38 (diff) | |
parent | bc8fd900c4d460b4e4bf785bb48bfced0ac9941b (diff) |
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver changes from Olof Johansson:
"This is a rather large set of patches for device drivers that for one
reason or another the subsystem maintainer preferred to get merged
through the arm-soc tree. There are both new drivers as well as
existing drivers that are getting converted from platform-specific
code into standalone drivers using the appropriate subsystem specific
interfaces.
In particular, we can now have pinctrl, clk, clksource and irqchip
drivers in one file per driver, without the need to call into platform
specific interface, or to get called from platform specific code, as
long as all information about the hardware is provided through a
device tree.
Most of the drivers we touch this time are for clocksource. Since now
most of them are part of drivers/clocksource, I expect that we won't
have to touch these again from arm-soc and can let the clocksource
maintainers take care of these in the future.
Another larger part of this series is specific to the exynos platform,
which is seeing some significant effort in upstreaming and
modernization of its device drivers this time around, which
unfortunately is also the cause for the churn and a lot of the merge
conflicts.
There is one new subsystem that gets merged as part of this series:
the reset controller interface, which is a very simple interface for
taking devices on the SoC out of reset or back into reset. Patches to
use this interface on i.MX follow later in this merge window, and we
are going to have other platforms (at least tegra and sirf) get
converted in 3.11. This will let us get rid of platform specific
callbacks in a number of platform independent device drivers."
* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (256 commits)
irqchip: s3c24xx: add missing __init annotations
ARM: dts: Disable the RTC by default on exynos5
clk: exynos5250: Fix parent clock for sclk_mmc{0,1,2,3}
ARM: exynos: restore mach/regs-clock.h for exynos5
clocksource: exynos_mct: fix build error on non-DT
pinctrl: vt8500: wmt: Fix checking return value of pinctrl_register()
irqchip: vt8500: Convert arch-vt8500 to new irqchip infrastructure
reset: NULL deref on allocation failure
reset: Add reset controller API
dt: describe base reset signal binding
ARM: EXYNOS: Add arm-pmu DT binding for exynos421x
ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
ARM: EXYNOS: Enable PMUs for exynos4
irqchip: exynos-combiner: Correct combined IRQs for exynos4
irqchip: exynos-combiner: Add set_irq_affinity function for combiner_irq
ARM: EXYNOS: fix compilation error introduced due to common clock migration
clk: exynos5250: Fix divider values for sclk_mmc{0,1,2,3}
clk: exynos4: export clocks required for fimc-is
clk: samsung: Fix compilation error
clk: tegra: fix enum tegra114_clk to match binding
...
253 files changed, 16905 insertions, 7306 deletions
diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt index 5ddb2e9efaaa..4b87ea1194e3 100644 --- a/Documentation/devicetree/bindings/bus/ti-gpmc.txt +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt | |||
@@ -35,36 +35,83 @@ Required properties: | |||
35 | 35 | ||
36 | Timing properties for child nodes. All are optional and default to 0. | 36 | Timing properties for child nodes. All are optional and default to 0. |
37 | 37 | ||
38 | - gpmc,sync-clk: Minimum clock period for synchronous mode, in picoseconds | 38 | - gpmc,sync-clk-ps: Minimum clock period for synchronous mode, in picoseconds |
39 | 39 | ||
40 | Chip-select signal timings corresponding to GPMC_CONFIG2: | 40 | Chip-select signal timings (in nanoseconds) corresponding to GPMC_CONFIG2: |
41 | - gpmc,cs-on: Assertion time | 41 | - gpmc,cs-on-ns: Assertion time |
42 | - gpmc,cs-rd-off: Read deassertion time | 42 | - gpmc,cs-rd-off-ns: Read deassertion time |
43 | - gpmc,cs-wr-off: Write deassertion time | 43 | - gpmc,cs-wr-off-ns: Write deassertion time |
44 | 44 | ||
45 | ADV signal timings corresponding to GPMC_CONFIG3: | 45 | ADV signal timings (in nanoseconds) corresponding to GPMC_CONFIG3: |
46 | - gpmc,adv-on: Assertion time | 46 | - gpmc,adv-on-ns: Assertion time |
47 | - gpmc,adv-rd-off: Read deassertion time | 47 | - gpmc,adv-rd-off-ns: Read deassertion time |
48 | - gpmc,adv-wr-off: Write deassertion time | 48 | - gpmc,adv-wr-off-ns: Write deassertion time |
49 | 49 | ||
50 | WE signals timings corresponding to GPMC_CONFIG4: | 50 | WE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: |
51 | - gpmc,we-on: Assertion time | 51 | - gpmc,we-on-ns Assertion time |
52 | - gpmc,we-off: Deassertion time | 52 | - gpmc,we-off-ns: Deassertion time |
53 | 53 | ||
54 | OE signals timings corresponding to GPMC_CONFIG4: | 54 | OE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: |
55 | - gpmc,oe-on: Assertion time | 55 | - gpmc,oe-on-ns: Assertion time |
56 | - gpmc,oe-off: Deassertion time | 56 | - gpmc,oe-off-ns: Deassertion time |
57 | 57 | ||
58 | Access time and cycle time timings corresponding to GPMC_CONFIG5: | 58 | Access time and cycle time timings (in nanoseconds) corresponding to |
59 | - gpmc,page-burst-access: Multiple access word delay | 59 | GPMC_CONFIG5: |
60 | - gpmc,access: Start-cycle to first data valid delay | 60 | - gpmc,page-burst-access-ns: Multiple access word delay |
61 | - gpmc,rd-cycle: Total read cycle time | 61 | - gpmc,access-ns: Start-cycle to first data valid delay |
62 | - gpmc,wr-cycle: Total write cycle time | 62 | - gpmc,rd-cycle-ns: Total read cycle time |
63 | - gpmc,wr-cycle-ns: Total write cycle time | ||
64 | - gpmc,bus-turnaround-ns: Turn-around time between successive accesses | ||
65 | - gpmc,cycle2cycle-delay-ns: Delay between chip-select pulses | ||
66 | - gpmc,clk-activation-ns: GPMC clock activation time | ||
67 | - gpmc,wait-monitoring-ns: Start of wait monitoring with regard to valid | ||
68 | data | ||
69 | |||
70 | Boolean timing parameters. If property is present parameter enabled and | ||
71 | disabled if omitted: | ||
72 | - gpmc,adv-extra-delay: ADV signal is delayed by half GPMC clock | ||
73 | - gpmc,cs-extra-delay: CS signal is delayed by half GPMC clock | ||
74 | - gpmc,cycle2cycle-diffcsen: Add "cycle2cycle-delay" between successive | ||
75 | accesses to a different CS | ||
76 | - gpmc,cycle2cycle-samecsen: Add "cycle2cycle-delay" between successive | ||
77 | accesses to the same CS | ||
78 | - gpmc,oe-extra-delay: OE signal is delayed by half GPMC clock | ||
79 | - gpmc,we-extra-delay: WE signal is delayed by half GPMC clock | ||
80 | - gpmc,time-para-granularity: Multiply all access times by 2 | ||
63 | 81 | ||
64 | The following are only applicable to OMAP3+ and AM335x: | 82 | The following are only applicable to OMAP3+ and AM335x: |
65 | - gpmc,wr-access | 83 | - gpmc,wr-access-ns: In synchronous write mode, for single or |
66 | - gpmc,wr-data-mux-bus | 84 | burst accesses, defines the number of |
67 | 85 | GPMC_FCLK cycles from start access time | |
86 | to the GPMC_CLK rising edge used by the | ||
87 | memory device for the first data capture. | ||
88 | - gpmc,wr-data-mux-bus-ns: In address-data multiplex mode, specifies | ||
89 | the time when the first data is driven on | ||
90 | the address-data bus. | ||
91 | |||
92 | GPMC chip-select settings properties for child nodes. All are optional. | ||
93 | |||
94 | - gpmc,burst-length Page/burst length. Must be 4, 8 or 16. | ||
95 | - gpmc,burst-wrap Enables wrap bursting | ||
96 | - gpmc,burst-read Enables read page/burst mode | ||
97 | - gpmc,burst-write Enables write page/burst mode | ||
98 | - gpmc,device-nand Device is NAND | ||
99 | - gpmc,device-width Total width of device(s) connected to a GPMC | ||
100 | chip-select in bytes. The GPMC supports 8-bit | ||
101 | and 16-bit devices and so this property must be | ||
102 | 1 or 2. | ||
103 | - gpmc,mux-add-data Address and data multiplexing configuration. | ||
104 | Valid values are 1 for address-address-data | ||
105 | multiplexing mode and 2 for address-data | ||
106 | multiplexing mode. | ||
107 | - gpmc,sync-read Enables synchronous read. Defaults to asynchronous | ||
108 | is this is not set. | ||
109 | - gpmc,sync-write Enables synchronous writes. Defaults to asynchronous | ||
110 | is this is not set. | ||
111 | - gpmc,wait-pin Wait-pin used by client. Must be less than | ||
112 | "gpmc,num-waitpins". | ||
113 | - gpmc,wait-on-read Enables wait monitoring on reads. | ||
114 | - gpmc,wait-on-write Enables wait monitoring on writes. | ||
68 | 115 | ||
69 | Example for an AM33xx board: | 116 | Example for an AM33xx board: |
70 | 117 | ||
diff --git a/Documentation/devicetree/bindings/clock/exynos4-clock.txt b/Documentation/devicetree/bindings/clock/exynos4-clock.txt new file mode 100644 index 000000000000..ea5e26f16aec --- /dev/null +++ b/Documentation/devicetree/bindings/clock/exynos4-clock.txt | |||
@@ -0,0 +1,288 @@ | |||
1 | * Samsung Exynos4 Clock Controller | ||
2 | |||
3 | The Exynos4 clock controller generates and supplies clock to various controllers | ||
4 | within the Exynos4 SoC. The clock binding described here is applicable to all | ||
5 | SoC's in the Exynos4 family. | ||
6 | |||
7 | Required Properties: | ||
8 | |||
9 | - comptible: should be one of the following. | ||
10 | - "samsung,exynos4210-clock" - controller compatible with Exynos4210 SoC. | ||
11 | - "samsung,exynos4412-clock" - controller compatible with Exynos4412 SoC. | ||
12 | |||
13 | - reg: physical base address of the controller and length of memory mapped | ||
14 | region. | ||
15 | |||
16 | - #clock-cells: should be 1. | ||
17 | |||
18 | The following is the list of clocks generated by the controller. Each clock is | ||
19 | assigned an identifier and client nodes use this identifier to specify the | ||
20 | clock which they consume. Some of the clocks are available only on a particular | ||
21 | Exynos4 SoC and this is specified where applicable. | ||
22 | |||
23 | |||
24 | [Core Clocks] | ||
25 | |||
26 | Clock ID SoC (if specific) | ||
27 | ----------------------------------------------- | ||
28 | |||
29 | xxti 1 | ||
30 | xusbxti 2 | ||
31 | fin_pll 3 | ||
32 | fout_apll 4 | ||
33 | fout_mpll 5 | ||
34 | fout_epll 6 | ||
35 | fout_vpll 7 | ||
36 | sclk_apll 8 | ||
37 | sclk_mpll 9 | ||
38 | sclk_epll 10 | ||
39 | sclk_vpll 11 | ||
40 | arm_clk 12 | ||
41 | aclk200 13 | ||
42 | aclk100 14 | ||
43 | aclk160 15 | ||
44 | aclk133 16 | ||
45 | mout_mpll_user_t 17 Exynos4x12 | ||
46 | mout_mpll_user_c 18 Exynos4x12 | ||
47 | mout_core 19 | ||
48 | mout_apll 20 | ||
49 | |||
50 | |||
51 | [Clock Gate for Special Clocks] | ||
52 | |||
53 | Clock ID SoC (if specific) | ||
54 | ----------------------------------------------- | ||
55 | |||
56 | sclk_fimc0 128 | ||
57 | sclk_fimc1 129 | ||
58 | sclk_fimc2 130 | ||
59 | sclk_fimc3 131 | ||
60 | sclk_cam0 132 | ||
61 | sclk_cam1 133 | ||
62 | sclk_csis0 134 | ||
63 | sclk_csis1 135 | ||
64 | sclk_hdmi 136 | ||
65 | sclk_mixer 137 | ||
66 | sclk_dac 138 | ||
67 | sclk_pixel 139 | ||
68 | sclk_fimd0 140 | ||
69 | sclk_mdnie0 141 Exynos4412 | ||
70 | sclk_mdnie_pwm0 12 142 Exynos4412 | ||
71 | sclk_mipi0 143 | ||
72 | sclk_audio0 144 | ||
73 | sclk_mmc0 145 | ||
74 | sclk_mmc1 146 | ||
75 | sclk_mmc2 147 | ||
76 | sclk_mmc3 148 | ||
77 | sclk_mmc4 149 | ||
78 | sclk_sata 150 Exynos4210 | ||
79 | sclk_uart0 151 | ||
80 | sclk_uart1 152 | ||
81 | sclk_uart2 153 | ||
82 | sclk_uart3 154 | ||
83 | sclk_uart4 155 | ||
84 | sclk_audio1 156 | ||
85 | sclk_audio2 157 | ||
86 | sclk_spdif 158 | ||
87 | sclk_spi0 159 | ||
88 | sclk_spi1 160 | ||
89 | sclk_spi2 161 | ||
90 | sclk_slimbus 162 | ||
91 | sclk_fimd1 163 Exynos4210 | ||
92 | sclk_mipi1 164 Exynos4210 | ||
93 | sclk_pcm1 165 | ||
94 | sclk_pcm2 166 | ||
95 | sclk_i2s1 167 | ||
96 | sclk_i2s2 168 | ||
97 | sclk_mipihsi 169 Exynos4412 | ||
98 | sclk_mfc 170 | ||
99 | sclk_pcm0 171 | ||
100 | sclk_g3d 172 | ||
101 | sclk_pwm_isp 173 Exynos4x12 | ||
102 | sclk_spi0_isp 174 Exynos4x12 | ||
103 | sclk_spi1_isp 175 Exynos4x12 | ||
104 | sclk_uart_isp 176 Exynos4x12 | ||
105 | |||
106 | [Peripheral Clock Gates] | ||
107 | |||
108 | Clock ID SoC (if specific) | ||
109 | ----------------------------------------------- | ||
110 | |||
111 | fimc0 256 | ||
112 | fimc1 257 | ||
113 | fimc2 258 | ||
114 | fimc3 259 | ||
115 | csis0 260 | ||
116 | csis1 261 | ||
117 | jpeg 262 | ||
118 | smmu_fimc0 263 | ||
119 | smmu_fimc1 264 | ||
120 | smmu_fimc2 265 | ||
121 | smmu_fimc3 266 | ||
122 | smmu_jpeg 267 | ||
123 | vp 268 | ||
124 | mixer 269 | ||
125 | tvenc 270 Exynos4210 | ||
126 | hdmi 271 | ||
127 | smmu_tv 272 | ||
128 | mfc 273 | ||
129 | smmu_mfcl 274 | ||
130 | smmu_mfcr 275 | ||
131 | g3d 276 | ||
132 | g2d 277 Exynos4210 | ||
133 | rotator 278 Exynos4210 | ||
134 | mdma 279 Exynos4210 | ||
135 | smmu_g2d 280 Exynos4210 | ||
136 | smmu_rotator 281 Exynos4210 | ||
137 | smmu_mdma 282 Exynos4210 | ||
138 | fimd0 283 | ||
139 | mie0 284 | ||
140 | mdnie0 285 Exynos4412 | ||
141 | dsim0 286 | ||
142 | smmu_fimd0 287 | ||
143 | fimd1 288 Exynos4210 | ||
144 | mie1 289 Exynos4210 | ||
145 | dsim1 290 Exynos4210 | ||
146 | smmu_fimd1 291 Exynos4210 | ||
147 | pdma0 292 | ||
148 | pdma1 293 | ||
149 | pcie_phy 294 | ||
150 | sata_phy 295 Exynos4210 | ||
151 | tsi 296 | ||
152 | sdmmc0 297 | ||
153 | sdmmc1 298 | ||
154 | sdmmc2 299 | ||
155 | sdmmc3 300 | ||
156 | sdmmc4 301 | ||
157 | sata 302 Exynos4210 | ||
158 | sromc 303 | ||
159 | usb_host 304 | ||
160 | usb_device 305 | ||
161 | pcie 306 | ||
162 | onenand 307 | ||
163 | nfcon 308 | ||
164 | smmu_pcie 309 | ||
165 | gps 310 | ||
166 | smmu_gps 311 | ||
167 | uart0 312 | ||
168 | uart1 313 | ||
169 | uart2 314 | ||
170 | uart3 315 | ||
171 | uart4 316 | ||
172 | i2c0 317 | ||
173 | i2c1 318 | ||
174 | i2c2 319 | ||
175 | i2c3 320 | ||
176 | i2c4 321 | ||
177 | i2c5 322 | ||
178 | i2c6 323 | ||
179 | i2c7 324 | ||
180 | i2c_hdmi 325 | ||
181 | tsadc 326 | ||
182 | spi0 327 | ||
183 | spi1 328 | ||
184 | spi2 329 | ||
185 | i2s1 330 | ||
186 | i2s2 331 | ||
187 | pcm0 332 | ||
188 | i2s0 333 | ||
189 | pcm1 334 | ||
190 | pcm2 335 | ||
191 | pwm 336 | ||
192 | slimbus 337 | ||
193 | spdif 338 | ||
194 | ac97 339 | ||
195 | modemif 340 | ||
196 | chipid 341 | ||
197 | sysreg 342 | ||
198 | hdmi_cec 343 | ||
199 | mct 344 | ||
200 | wdt 345 | ||
201 | rtc 346 | ||
202 | keyif 347 | ||
203 | audss 348 | ||
204 | mipi_hsi 349 Exynos4210 | ||
205 | mdma2 350 Exynos4210 | ||
206 | pixelasyncm0 351 | ||
207 | pixelasyncm1 352 | ||
208 | fimc_lite0 353 Exynos4x12 | ||
209 | fimc_lite1 354 Exynos4x12 | ||
210 | ppmuispx 355 Exynos4x12 | ||
211 | ppmuispmx 356 Exynos4x12 | ||
212 | fimc_isp 357 Exynos4x12 | ||
213 | fimc_drc 358 Exynos4x12 | ||
214 | fimc_fd 359 Exynos4x12 | ||
215 | mcuisp 360 Exynos4x12 | ||
216 | gicisp 361 Exynos4x12 | ||
217 | smmu_isp 362 Exynos4x12 | ||
218 | smmu_drc 363 Exynos4x12 | ||
219 | smmu_fd 364 Exynos4x12 | ||
220 | smmu_lite0 365 Exynos4x12 | ||
221 | smmu_lite1 366 Exynos4x12 | ||
222 | mcuctl_isp 367 Exynos4x12 | ||
223 | mpwm_isp 368 Exynos4x12 | ||
224 | i2c0_isp 369 Exynos4x12 | ||
225 | i2c1_isp 370 Exynos4x12 | ||
226 | mtcadc_isp 371 Exynos4x12 | ||
227 | pwm_isp 372 Exynos4x12 | ||
228 | wdt_isp 373 Exynos4x12 | ||
229 | uart_isp 374 Exynos4x12 | ||
230 | asyncaxim 375 Exynos4x12 | ||
231 | smmu_ispcx 376 Exynos4x12 | ||
232 | spi0_isp 377 Exynos4x12 | ||
233 | spi1_isp 378 Exynos4x12 | ||
234 | pwm_isp_sclk 379 Exynos4x12 | ||
235 | spi0_isp_sclk 380 Exynos4x12 | ||
236 | spi1_isp_sclk 381 Exynos4x12 | ||
237 | uart_isp_sclk 382 Exynos4x12 | ||
238 | |||
239 | [Mux Clocks] | ||
240 | |||
241 | Clock ID SoC (if specific) | ||
242 | ----------------------------------------------- | ||
243 | |||
244 | mout_fimc0 384 | ||
245 | mout_fimc1 385 | ||
246 | mout_fimc2 386 | ||
247 | mout_fimc3 387 | ||
248 | mout_cam0 388 | ||
249 | mout_cam1 389 | ||
250 | mout_csis0 390 | ||
251 | mout_csis1 391 | ||
252 | mout_g3d0 392 | ||
253 | mout_g3d1 393 | ||
254 | mout_g3d 394 | ||
255 | aclk400_mcuisp 395 Exynos4x12 | ||
256 | |||
257 | [Div Clocks] | ||
258 | |||
259 | Clock ID SoC (if specific) | ||
260 | ----------------------------------------------- | ||
261 | |||
262 | div_isp0 450 Exynos4x12 | ||
263 | div_isp1 451 Exynos4x12 | ||
264 | div_mcuisp0 452 Exynos4x12 | ||
265 | div_mcuisp1 453 Exynos4x12 | ||
266 | div_aclk200 454 Exynos4x12 | ||
267 | div_aclk400_mcuisp 455 Exynos4x12 | ||
268 | |||
269 | |||
270 | Example 1: An example of a clock controller node is listed below. | ||
271 | |||
272 | clock: clock-controller@0x10030000 { | ||
273 | compatible = "samsung,exynos4210-clock"; | ||
274 | reg = <0x10030000 0x20000>; | ||
275 | #clock-cells = <1>; | ||
276 | }; | ||
277 | |||
278 | Example 2: UART controller node that consumes the clock generated by the clock | ||
279 | controller. Refer to the standard clock bindings for information | ||
280 | about 'clocks' and 'clock-names' property. | ||
281 | |||
282 | serial@13820000 { | ||
283 | compatible = "samsung,exynos4210-uart"; | ||
284 | reg = <0x13820000 0x100>; | ||
285 | interrupts = <0 54 0>; | ||
286 | clocks = <&clock 314>, <&clock 153>; | ||
287 | clock-names = "uart", "clk_uart_baud0"; | ||
288 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt new file mode 100644 index 000000000000..781a6276adf7 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt | |||
@@ -0,0 +1,177 @@ | |||
1 | * Samsung Exynos5250 Clock Controller | ||
2 | |||
3 | The Exynos5250 clock controller generates and supplies clock to various | ||
4 | controllers within the Exynos5250 SoC. | ||
5 | |||
6 | Required Properties: | ||
7 | |||
8 | - comptible: should be one of the following. | ||
9 | - "samsung,exynos5250-clock" - controller compatible with Exynos5250 SoC. | ||
10 | |||
11 | - reg: physical base address of the controller and length of memory mapped | ||
12 | region. | ||
13 | |||
14 | - #clock-cells: should be 1. | ||
15 | |||
16 | The following is the list of clocks generated by the controller. Each clock is | ||
17 | assigned an identifier and client nodes use this identifier to specify the | ||
18 | clock which they consume. | ||
19 | |||
20 | |||
21 | [Core Clocks] | ||
22 | |||
23 | Clock ID | ||
24 | ---------------------------- | ||
25 | |||
26 | fin_pll 1 | ||
27 | |||
28 | [Clock Gate for Special Clocks] | ||
29 | |||
30 | Clock ID | ||
31 | ---------------------------- | ||
32 | |||
33 | sclk_cam_bayer 128 | ||
34 | sclk_cam0 129 | ||
35 | sclk_cam1 130 | ||
36 | sclk_gscl_wa 131 | ||
37 | sclk_gscl_wb 132 | ||
38 | sclk_fimd1 133 | ||
39 | sclk_mipi1 134 | ||
40 | sclk_dp 135 | ||
41 | sclk_hdmi 136 | ||
42 | sclk_pixel 137 | ||
43 | sclk_audio0 138 | ||
44 | sclk_mmc0 139 | ||
45 | sclk_mmc1 140 | ||
46 | sclk_mmc2 141 | ||
47 | sclk_mmc3 142 | ||
48 | sclk_sata 143 | ||
49 | sclk_usb3 144 | ||
50 | sclk_jpeg 145 | ||
51 | sclk_uart0 146 | ||
52 | sclk_uart1 147 | ||
53 | sclk_uart2 148 | ||
54 | sclk_uart3 149 | ||
55 | sclk_pwm 150 | ||
56 | sclk_audio1 151 | ||
57 | sclk_audio2 152 | ||
58 | sclk_spdif 153 | ||
59 | sclk_spi0 154 | ||
60 | sclk_spi1 155 | ||
61 | sclk_spi2 156 | ||
62 | |||
63 | |||
64 | [Peripheral Clock Gates] | ||
65 | |||
66 | Clock ID | ||
67 | ---------------------------- | ||
68 | |||
69 | gscl0 256 | ||
70 | gscl1 257 | ||
71 | gscl2 258 | ||
72 | gscl3 259 | ||
73 | gscl_wa 260 | ||
74 | gscl_wb 261 | ||
75 | smmu_gscl0 262 | ||
76 | smmu_gscl1 263 | ||
77 | smmu_gscl2 264 | ||
78 | smmu_gscl3 265 | ||
79 | mfc 266 | ||
80 | smmu_mfcl 267 | ||
81 | smmu_mfcr 268 | ||
82 | rotator 269 | ||
83 | jpeg 270 | ||
84 | mdma1 271 | ||
85 | smmu_rotator 272 | ||
86 | smmu_jpeg 273 | ||
87 | smmu_mdma1 274 | ||
88 | pdma0 275 | ||
89 | pdma1 276 | ||
90 | sata 277 | ||
91 | usbotg 278 | ||
92 | mipi_hsi 279 | ||
93 | sdmmc0 280 | ||
94 | sdmmc1 281 | ||
95 | sdmmc2 282 | ||
96 | sdmmc3 283 | ||
97 | sromc 284 | ||
98 | usb2 285 | ||
99 | usb3 286 | ||
100 | sata_phyctrl 287 | ||
101 | sata_phyi2c 288 | ||
102 | uart0 289 | ||
103 | uart1 290 | ||
104 | uart2 291 | ||
105 | uart3 292 | ||
106 | uart4 293 | ||
107 | i2c0 294 | ||
108 | i2c1 295 | ||
109 | i2c2 296 | ||
110 | i2c3 297 | ||
111 | i2c4 298 | ||
112 | i2c5 299 | ||
113 | i2c6 300 | ||
114 | i2c7 301 | ||
115 | i2c_hdmi 302 | ||
116 | adc 303 | ||
117 | spi0 304 | ||
118 | spi1 305 | ||
119 | spi2 306 | ||
120 | i2s1 307 | ||
121 | i2s2 308 | ||
122 | pcm1 309 | ||
123 | pcm2 310 | ||
124 | pwm 311 | ||
125 | spdif 312 | ||
126 | ac97 313 | ||
127 | hsi2c0 314 | ||
128 | hsi2c1 315 | ||
129 | hs12c2 316 | ||
130 | hs12c3 317 | ||
131 | chipid 318 | ||
132 | sysreg 319 | ||
133 | pmu 320 | ||
134 | cmu_top 321 | ||
135 | cmu_core 322 | ||
136 | cmu_mem 323 | ||
137 | tzpc0 324 | ||
138 | tzpc1 325 | ||
139 | tzpc2 326 | ||
140 | tzpc3 327 | ||
141 | tzpc4 328 | ||
142 | tzpc5 329 | ||
143 | tzpc6 330 | ||
144 | tzpc7 331 | ||
145 | tzpc8 332 | ||
146 | tzpc9 333 | ||
147 | hdmi_cec 334 | ||
148 | mct 335 | ||
149 | wdt 336 | ||
150 | rtc 337 | ||
151 | tmu 338 | ||
152 | fimd1 339 | ||
153 | mie1 340 | ||
154 | dsim0 341 | ||
155 | dp 342 | ||
156 | mixer 343 | ||
157 | hdmi 345 | ||
158 | |||
159 | Example 1: An example of a clock controller node is listed below. | ||
160 | |||
161 | clock: clock-controller@0x10010000 { | ||
162 | compatible = "samsung,exynos5250-clock"; | ||
163 | reg = <0x10010000 0x30000>; | ||
164 | #clock-cells = <1>; | ||
165 | }; | ||
166 | |||
167 | Example 2: UART controller node that consumes the clock generated by the clock | ||
168 | controller. Refer to the standard clock bindings for information | ||
169 | about 'clocks' and 'clock-names' property. | ||
170 | |||
171 | serial@13820000 { | ||
172 | compatible = "samsung,exynos4210-uart"; | ||
173 | reg = <0x13820000 0x100>; | ||
174 | interrupts = <0 54 0>; | ||
175 | clocks = <&clock 314>, <&clock 153>; | ||
176 | clock-names = "uart", "clk_uart_baud0"; | ||
177 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/exynos5440-clock.txt b/Documentation/devicetree/bindings/clock/exynos5440-clock.txt new file mode 100644 index 000000000000..4499e9966bc9 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/exynos5440-clock.txt | |||
@@ -0,0 +1,61 @@ | |||
1 | * Samsung Exynos5440 Clock Controller | ||
2 | |||
3 | The Exynos5440 clock controller generates and supplies clock to various | ||
4 | controllers within the Exynos5440 SoC. | ||
5 | |||
6 | Required Properties: | ||
7 | |||
8 | - comptible: should be "samsung,exynos5440-clock". | ||
9 | |||
10 | - reg: physical base address of the controller and length of memory mapped | ||
11 | region. | ||
12 | |||
13 | - #clock-cells: should be 1. | ||
14 | |||
15 | The following is the list of clocks generated by the controller. Each clock is | ||
16 | assigned an identifier and client nodes use this identifier to specify the | ||
17 | clock which they consume. | ||
18 | |||
19 | |||
20 | [Core Clocks] | ||
21 | |||
22 | Clock ID | ||
23 | ---------------------------- | ||
24 | |||
25 | xtal 1 | ||
26 | arm_clk 2 | ||
27 | |||
28 | [Peripheral Clock Gates] | ||
29 | |||
30 | Clock ID | ||
31 | ---------------------------- | ||
32 | |||
33 | spi_baud 16 | ||
34 | pb0_250 17 | ||
35 | pr0_250 18 | ||
36 | pr1_250 19 | ||
37 | b_250 20 | ||
38 | b_125 21 | ||
39 | b_200 22 | ||
40 | sata 23 | ||
41 | usb 24 | ||
42 | gmac0 25 | ||
43 | cs250 26 | ||
44 | pb0_250_o 27 | ||
45 | pr0_250_o 28 | ||
46 | pr1_250_o 29 | ||
47 | b_250_o 30 | ||
48 | b_125_o 31 | ||
49 | b_200_o 32 | ||
50 | sata_o 33 | ||
51 | usb_o 34 | ||
52 | gmac0_o 35 | ||
53 | cs250_o 36 | ||
54 | |||
55 | Example: An example of a clock controller node is listed below. | ||
56 | |||
57 | clock: clock-controller@0x10010000 { | ||
58 | compatible = "samsung,exynos5440-clock"; | ||
59 | reg = <0x160000 0x10000>; | ||
60 | #clock-cells = <1>; | ||
61 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt new file mode 100644 index 000000000000..d6cb083b90a2 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt | |||
@@ -0,0 +1,303 @@ | |||
1 | NVIDIA Tegra114 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,tegra114-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 CAR. | ||
16 | |||
17 | The first 160 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB | ||
18 | registers. These IDs often match those in the CAR's RST_DEVICES registers, | ||
19 | but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In | ||
20 | this case, those clocks are assigned IDs above 160 in order to highlight | ||
21 | this issue. Implementations that interpret these clock IDs as bit values | ||
22 | within the CLK_OUT_ENB or RST_DEVICES registers should be careful to | ||
23 | explicitly handle these special cases. | ||
24 | |||
25 | The balance of the clocks controlled by the CAR are assigned IDs of 160 and | ||
26 | above. | ||
27 | |||
28 | 0 unassigned | ||
29 | 1 unassigned | ||
30 | 2 unassigned | ||
31 | 3 unassigned | ||
32 | 4 rtc | ||
33 | 5 timer | ||
34 | 6 uarta | ||
35 | 7 unassigned (register bit affects uartb and vfir) | ||
36 | 8 unassigned | ||
37 | 9 sdmmc2 | ||
38 | 10 unassigned (register bit affects spdif_in and spdif_out) | ||
39 | 11 i2s1 | ||
40 | 12 i2c1 | ||
41 | 13 ndflash | ||
42 | 14 sdmmc1 | ||
43 | 15 sdmmc4 | ||
44 | 16 unassigned | ||
45 | 17 pwm | ||
46 | 18 i2s2 | ||
47 | 19 epp | ||
48 | 20 unassigned (register bit affects vi and vi_sensor) | ||
49 | 21 2d | ||
50 | 22 usbd | ||
51 | 23 isp | ||
52 | 24 3d | ||
53 | 25 unassigned | ||
54 | 26 disp2 | ||
55 | 27 disp1 | ||
56 | 28 host1x | ||
57 | 29 vcp | ||
58 | 30 i2s0 | ||
59 | 31 unassigned | ||
60 | |||
61 | 32 unassigned | ||
62 | 33 unassigned | ||
63 | 34 apbdma | ||
64 | 35 unassigned | ||
65 | 36 kbc | ||
66 | 37 unassigned | ||
67 | 38 unassigned | ||
68 | 39 unassigned (register bit affects fuse and fuse_burn) | ||
69 | 40 kfuse | ||
70 | 41 sbc1 | ||
71 | 42 nor | ||
72 | 43 unassigned | ||
73 | 44 sbc2 | ||
74 | 45 unassigned | ||
75 | 46 sbc3 | ||
76 | 47 i2c5 | ||
77 | 48 dsia | ||
78 | 49 unassigned | ||
79 | 50 mipi | ||
80 | 51 hdmi | ||
81 | 52 csi | ||
82 | 53 unassigned | ||
83 | 54 i2c2 | ||
84 | 55 uartc | ||
85 | 56 mipi-cal | ||
86 | 57 emc | ||
87 | 58 usb2 | ||
88 | 59 usb3 | ||
89 | 60 msenc | ||
90 | 61 vde | ||
91 | 62 bsea | ||
92 | 63 bsev | ||
93 | |||
94 | 64 unassigned | ||
95 | 65 uartd | ||
96 | 66 unassigned | ||
97 | 67 i2c3 | ||
98 | 68 sbc4 | ||
99 | 69 sdmmc3 | ||
100 | 70 unassigned | ||
101 | 71 owr | ||
102 | 72 afi | ||
103 | 73 csite | ||
104 | 74 unassigned | ||
105 | 75 unassigned | ||
106 | 76 la | ||
107 | 77 trace | ||
108 | 78 soc_therm | ||
109 | 79 dtv | ||
110 | 80 ndspeed | ||
111 | 81 i2cslow | ||
112 | 82 dsib | ||
113 | 83 tsec | ||
114 | 84 unassigned | ||
115 | 85 unassigned | ||
116 | 86 unassigned | ||
117 | 87 unassigned | ||
118 | 88 unassigned | ||
119 | 89 xusb_host | ||
120 | 90 unassigned | ||
121 | 91 msenc | ||
122 | 92 csus | ||
123 | 93 unassigned | ||
124 | 94 unassigned | ||
125 | 95 unassigned (bit affects xusb_dev and xusb_dev_src) | ||
126 | |||
127 | 96 unassigned | ||
128 | 97 unassigned | ||
129 | 98 unassigned | ||
130 | 99 mselect | ||
131 | 100 tsensor | ||
132 | 101 i2s3 | ||
133 | 102 i2s4 | ||
134 | 103 i2c4 | ||
135 | 104 sbc5 | ||
136 | 105 sbc6 | ||
137 | 106 d_audio | ||
138 | 107 apbif | ||
139 | 108 dam0 | ||
140 | 109 dam1 | ||
141 | 110 dam2 | ||
142 | 111 hda2codec_2x | ||
143 | 112 unassigned | ||
144 | 113 audio0_2x | ||
145 | 114 audio1_2x | ||
146 | 115 audio2_2x | ||
147 | 116 audio3_2x | ||
148 | 117 audio4_2x | ||
149 | 118 spdif_2x | ||
150 | 119 actmon | ||
151 | 120 extern1 | ||
152 | 121 extern2 | ||
153 | 122 extern3 | ||
154 | 123 unassigned | ||
155 | 124 unassigned | ||
156 | 125 hda | ||
157 | 126 unassigned | ||
158 | 127 se | ||
159 | |||
160 | 128 hda2hdmi | ||
161 | 129 unassigned | ||
162 | 130 unassigned | ||
163 | 131 unassigned | ||
164 | 132 unassigned | ||
165 | 133 unassigned | ||
166 | 134 unassigned | ||
167 | 135 unassigned | ||
168 | 136 unassigned | ||
169 | 137 unassigned | ||
170 | 138 unassigned | ||
171 | 139 unassigned | ||
172 | 140 unassigned | ||
173 | 141 unassigned | ||
174 | 142 unassigned | ||
175 | 143 unassigned (bit affects xusb_falcon_src, xusb_fs_src, | ||
176 | xusb_host_src and xusb_ss_src) | ||
177 | 144 cilab | ||
178 | 145 cilcd | ||
179 | 146 cile | ||
180 | 147 dsialp | ||
181 | 148 dsiblp | ||
182 | 149 unassigned | ||
183 | 150 dds | ||
184 | 151 unassigned | ||
185 | 152 dp2 | ||
186 | 153 amx | ||
187 | 154 adx | ||
188 | 155 unassigned (bit affects dfll_ref and dfll_soc) | ||
189 | 156 xusb_ss | ||
190 | |||
191 | 192 uartb | ||
192 | 193 vfir | ||
193 | 194 spdif_in | ||
194 | 195 spdif_out | ||
195 | 196 vi | ||
196 | 197 vi_sensor | ||
197 | 198 fuse | ||
198 | 199 fuse_burn | ||
199 | 200 clk_32k | ||
200 | 201 clk_m | ||
201 | 202 clk_m_div2 | ||
202 | 203 clk_m_div4 | ||
203 | 204 pll_ref | ||
204 | 205 pll_c | ||
205 | 206 pll_c_out1 | ||
206 | 207 pll_c2 | ||
207 | 208 pll_c3 | ||
208 | 209 pll_m | ||
209 | 210 pll_m_out1 | ||
210 | 211 pll_p | ||
211 | 212 pll_p_out1 | ||
212 | 213 pll_p_out2 | ||
213 | 214 pll_p_out3 | ||
214 | 215 pll_p_out4 | ||
215 | 216 pll_a | ||
216 | 217 pll_a_out0 | ||
217 | 218 pll_d | ||
218 | 219 pll_d_out0 | ||
219 | 220 pll_d2 | ||
220 | 221 pll_d2_out0 | ||
221 | 222 pll_u | ||
222 | 223 pll_u_480M | ||
223 | 224 pll_u_60M | ||
224 | 225 pll_u_48M | ||
225 | 226 pll_u_12M | ||
226 | 227 pll_x | ||
227 | 228 pll_x_out0 | ||
228 | 229 pll_re_vco | ||
229 | 230 pll_re_out | ||
230 | 231 pll_e_out0 | ||
231 | 232 spdif_in_sync | ||
232 | 233 i2s0_sync | ||
233 | 234 i2s1_sync | ||
234 | 235 i2s2_sync | ||
235 | 236 i2s3_sync | ||
236 | 237 i2s4_sync | ||
237 | 238 vimclk_sync | ||
238 | 239 audio0 | ||
239 | 240 audio1 | ||
240 | 241 audio2 | ||
241 | 242 audio3 | ||
242 | 243 audio4 | ||
243 | 244 spdif | ||
244 | 245 clk_out_1 | ||
245 | 246 clk_out_2 | ||
246 | 247 clk_out_3 | ||
247 | 248 blink | ||
248 | 252 xusb_host_src | ||
249 | 253 xusb_falcon_src | ||
250 | 254 xusb_fs_src | ||
251 | 255 xusb_ss_src | ||
252 | 256 xusb_dev_src | ||
253 | 257 xusb_dev | ||
254 | 258 xusb_hs_src | ||
255 | 259 sclk | ||
256 | 260 hclk | ||
257 | 261 pclk | ||
258 | 262 cclk_g | ||
259 | 263 cclk_lp | ||
260 | 264 dfll_ref | ||
261 | 265 dfll_soc | ||
262 | |||
263 | Example SoC include file: | ||
264 | |||
265 | / { | ||
266 | tegra_car: clock { | ||
267 | compatible = "nvidia,tegra114-car"; | ||
268 | reg = <0x60006000 0x1000>; | ||
269 | #clock-cells = <1>; | ||
270 | }; | ||
271 | |||
272 | usb@c5004000 { | ||
273 | clocks = <&tegra_car 58>; /* usb2 */ | ||
274 | }; | ||
275 | }; | ||
276 | |||
277 | Example board file: | ||
278 | |||
279 | / { | ||
280 | clocks { | ||
281 | compatible = "simple-bus"; | ||
282 | #address-cells = <1>; | ||
283 | #size-cells = <0>; | ||
284 | |||
285 | osc: clock@0 { | ||
286 | compatible = "fixed-clock"; | ||
287 | reg = <0>; | ||
288 | #clock-cells = <0>; | ||
289 | clock-frequency = <12000000>; | ||
290 | }; | ||
291 | |||
292 | clk_32k: clock@1 { | ||
293 | compatible = "fixed-clock"; | ||
294 | reg = <1>; | ||
295 | #clock-cells = <0>; | ||
296 | clock-frequency = <32768>; | ||
297 | }; | ||
298 | }; | ||
299 | |||
300 | &tegra_car { | ||
301 | clocks = <&clk_32k> <&osc>; | ||
302 | }; | ||
303 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt index 0921fac73528..e885680f6b45 100644 --- a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt | |||
@@ -120,8 +120,8 @@ Required properties : | |||
120 | 90 clk_d | 120 | 90 clk_d |
121 | 91 unassigned | 121 | 91 unassigned |
122 | 92 sus | 122 | 92 sus |
123 | 93 cdev1 | 123 | 93 cdev2 |
124 | 94 cdev2 | 124 | 94 cdev1 |
125 | 95 unassigned | 125 | 95 unassigned |
126 | 126 | ||
127 | 96 uart2 | 127 | 96 uart2 |
diff --git a/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt b/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt deleted file mode 100644 index f4dc5233167e..000000000000 --- a/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | VIA/Wondermedia VT8500 GPIO Controller | ||
2 | ----------------------------------------------------- | ||
3 | |||
4 | Required properties: | ||
5 | - compatible : "via,vt8500-gpio", "wm,wm8505-gpio" | ||
6 | or "wm,wm8650-gpio" depending on your SoC | ||
7 | - reg : Should contain 1 register range (address and length) | ||
8 | - #gpio-cells : should be <3>. | ||
9 | 1) bank | ||
10 | 2) pin number | ||
11 | 3) flags - should be 0 | ||
12 | |||
13 | Example: | ||
14 | |||
15 | gpio: gpio-controller@d8110000 { | ||
16 | compatible = "via,vt8500-gpio"; | ||
17 | gpio-controller; | ||
18 | reg = <0xd8110000 0x10000>; | ||
19 | #gpio-cells = <3>; | ||
20 | }; | ||
21 | |||
22 | vibrate { | ||
23 | gpios = <&gpio 0 1 0>; /* Bank 0, Pin 1, No flags */ | ||
24 | }; | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt b/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt new file mode 100644 index 000000000000..c54c5a9a2a90 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt | |||
@@ -0,0 +1,53 @@ | |||
1 | Samsung S3C24XX Interrupt Controllers | ||
2 | |||
3 | The S3C24XX SoCs contain a custom set of interrupt controllers providing a | ||
4 | varying number of interrupt sources. The set consists of a main- and sub- | ||
5 | controller and on newer SoCs even a second main controller. | ||
6 | |||
7 | Required properties: | ||
8 | - compatible: Compatible property value should be "samsung,s3c2410-irq" | ||
9 | for machines before s3c2416 and "samsung,s3c2416-irq" for s3c2416 and later. | ||
10 | |||
11 | - reg: Physical base address of the controller and length of memory mapped | ||
12 | region. | ||
13 | |||
14 | - interrupt-controller : Identifies the node as an interrupt controller | ||
15 | |||
16 | - #interrupt-cells : Specifies the number of cells needed to encode an | ||
17 | interrupt source. The value shall be 4 and interrupt descriptor shall | ||
18 | have the following format: | ||
19 | <ctrl_num parent_irq ctrl_irq type> | ||
20 | |||
21 | ctrl_num contains the controller to use: | ||
22 | - 0 ... main controller | ||
23 | - 1 ... sub controller | ||
24 | - 2 ... second main controller on s3c2416 and s3c2450 | ||
25 | parent_irq contains the parent bit in the main controller and will be | ||
26 | ignored in main controllers | ||
27 | ctrl_irq contains the interrupt bit of the controller | ||
28 | type contains the trigger type to use | ||
29 | |||
30 | Example: | ||
31 | |||
32 | interrupt-controller@4a000000 { | ||
33 | compatible = "samsung,s3c2410-irq"; | ||
34 | reg = <0x4a000000 0x100>; | ||
35 | interrupt-controller; | ||
36 | #interrupt-cells=<4>; | ||
37 | }; | ||
38 | |||
39 | [...] | ||
40 | |||
41 | serial@50000000 { | ||
42 | compatible = "samsung,s3c2410-uart"; | ||
43 | reg = <0x50000000 0x4000>; | ||
44 | interrupt-parent = <&subintc>; | ||
45 | interrupts = <1 28 0 4>, <1 28 1 4>; | ||
46 | }; | ||
47 | |||
48 | rtc@57000000 { | ||
49 | compatible = "samsung,s3c2410-rtc"; | ||
50 | reg = <0x57000000 0x100>; | ||
51 | interrupt-parent = <&intc>; | ||
52 | interrupts = <0 30 0 3>, <0 8 0 3>; | ||
53 | }; | ||
diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt b/Documentation/devicetree/bindings/media/s5p-mfc.txt index 67ec3d4ccc7f..bf0182d8da25 100644 --- a/Documentation/devicetree/bindings/media/s5p-mfc.txt +++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt | |||
@@ -21,3 +21,24 @@ Required properties: | |||
21 | 21 | ||
22 | - samsung,mfc-l : Base address of the second memory bank used by MFC | 22 | - samsung,mfc-l : Base address of the second memory bank used by MFC |
23 | for DMA contiguous memory allocation and its size. | 23 | for DMA contiguous memory allocation and its size. |
24 | |||
25 | Optional properties: | ||
26 | - samsung,power-domain : power-domain property defined with a phandle | ||
27 | to respective power domain. | ||
28 | |||
29 | Example: | ||
30 | SoC specific DT entry: | ||
31 | |||
32 | mfc: codec@13400000 { | ||
33 | compatible = "samsung,mfc-v5"; | ||
34 | reg = <0x13400000 0x10000>; | ||
35 | interrupts = <0 94 0>; | ||
36 | samsung,power-domain = <&pd_mfc>; | ||
37 | }; | ||
38 | |||
39 | Board specific DT entry: | ||
40 | |||
41 | codec@13400000 { | ||
42 | samsung,mfc-r = <0x43000000 0x800000>; | ||
43 | samsung,mfc-l = <0x51000000 0x800000>; | ||
44 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nor.txt b/Documentation/devicetree/bindings/mtd/gpmc-nor.txt new file mode 100644 index 000000000000..420b3ab18890 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/gpmc-nor.txt | |||
@@ -0,0 +1,98 @@ | |||
1 | Device tree bindings for NOR flash connect to TI GPMC | ||
2 | |||
3 | NOR flash connected to the TI GPMC (found on OMAP boards) are represented as | ||
4 | child nodes of the GPMC controller with a name of "nor". | ||
5 | |||
6 | All timing relevant properties as well as generic GPMC child properties are | ||
7 | explained in a separate documents. Please refer to | ||
8 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
9 | |||
10 | Required properties: | ||
11 | - bank-width: Width of NOR flash in bytes. GPMC supports 8-bit and | ||
12 | 16-bit devices and so must be either 1 or 2 bytes. | ||
13 | - compatible: Documentation/devicetree/bindings/mtd/mtd-physmap.txt | ||
14 | - gpmc,cs-on-ns: Chip-select assertion time | ||
15 | - gpmc,cs-rd-off-ns: Chip-select de-assertion time for reads | ||
16 | - gpmc,cs-wr-off-ns: Chip-select de-assertion time for writes | ||
17 | - gpmc,oe-on-ns: Output-enable assertion time | ||
18 | - gpmc,oe-off-ns: Output-enable de-assertion time | ||
19 | - gpmc,we-on-ns Write-enable assertion time | ||
20 | - gpmc,we-off-ns: Write-enable de-assertion time | ||
21 | - gpmc,access-ns: Start cycle to first data capture (read access) | ||
22 | - gpmc,rd-cycle-ns: Total read cycle time | ||
23 | - gpmc,wr-cycle-ns: Total write cycle time | ||
24 | - linux,mtd-name: Documentation/devicetree/bindings/mtd/mtd-physmap.txt | ||
25 | - reg: Chip-select, base address (relative to chip-select) | ||
26 | and size of NOR flash. Note that base address will be | ||
27 | typically 0 as this is the start of the chip-select. | ||
28 | |||
29 | Optional properties: | ||
30 | - gpmc,XXX Additional GPMC timings and settings parameters. See | ||
31 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
32 | |||
33 | Optional properties for partiton table parsing: | ||
34 | - #address-cells: should be set to 1 | ||
35 | - #size-cells: should be set to 1 | ||
36 | |||
37 | Example: | ||
38 | |||
39 | gpmc: gpmc@6e000000 { | ||
40 | compatible = "ti,omap3430-gpmc", "simple-bus"; | ||
41 | ti,hwmods = "gpmc"; | ||
42 | reg = <0x6e000000 0x1000>; | ||
43 | interrupts = <20>; | ||
44 | gpmc,num-cs = <8>; | ||
45 | gpmc,num-waitpins = <4>; | ||
46 | #address-cells = <2>; | ||
47 | #size-cells = <1>; | ||
48 | |||
49 | ranges = <0 0 0x10000000 0x08000000>; | ||
50 | |||
51 | nor@0,0 { | ||
52 | compatible = "cfi-flash"; | ||
53 | linux,mtd-name= "intel,pf48f6000m0y1be"; | ||
54 | #address-cells = <1>; | ||
55 | #size-cells = <1>; | ||
56 | reg = <0 0 0x08000000>; | ||
57 | bank-width = <2>; | ||
58 | |||
59 | gpmc,mux-add-data; | ||
60 | gpmc,cs-on-ns = <0>; | ||
61 | gpmc,cs-rd-off-ns = <186>; | ||
62 | gpmc,cs-wr-off-ns = <186>; | ||
63 | gpmc,adv-on-ns = <12>; | ||
64 | gpmc,adv-rd-off-ns = <48>; | ||
65 | gpmc,adv-wr-off-ns = <48>; | ||
66 | gpmc,oe-on-ns = <54>; | ||
67 | gpmc,oe-off-ns = <168>; | ||
68 | gpmc,we-on-ns = <54>; | ||
69 | gpmc,we-off-ns = <168>; | ||
70 | gpmc,rd-cycle-ns = <186>; | ||
71 | gpmc,wr-cycle-ns = <186>; | ||
72 | gpmc,access-ns = <114>; | ||
73 | gpmc,page-burst-access-ns = <6>; | ||
74 | gpmc,bus-turnaround-ns = <12>; | ||
75 | gpmc,cycle2cycle-delay-ns = <18>; | ||
76 | gpmc,wr-data-mux-bus-ns = <90>; | ||
77 | gpmc,wr-access-ns = <186>; | ||
78 | gpmc,cycle2cycle-samecsen; | ||
79 | gpmc,cycle2cycle-diffcsen; | ||
80 | |||
81 | partition@0 { | ||
82 | label = "bootloader-nor"; | ||
83 | reg = <0 0x40000>; | ||
84 | }; | ||
85 | partition@0x40000 { | ||
86 | label = "params-nor"; | ||
87 | reg = <0x40000 0x40000>; | ||
88 | }; | ||
89 | partition@0x80000 { | ||
90 | label = "kernel-nor"; | ||
91 | reg = <0x80000 0x200000>; | ||
92 | }; | ||
93 | partition@0x280000 { | ||
94 | label = "filesystem-nor"; | ||
95 | reg = <0x240000 0x7d80000>; | ||
96 | }; | ||
97 | }; | ||
98 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt b/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt index deec9da224a2..b7529424ac88 100644 --- a/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt | |||
@@ -10,6 +10,8 @@ Documentation/devicetree/bindings/bus/ti-gpmc.txt | |||
10 | Required properties: | 10 | Required properties: |
11 | 11 | ||
12 | - reg: The CS line the peripheral is connected to | 12 | - reg: The CS line the peripheral is connected to |
13 | - gpmc,device-width Width of the ONENAND device connected to the GPMC | ||
14 | in bytes. Must be 1 or 2. | ||
13 | 15 | ||
14 | Optional properties: | 16 | Optional properties: |
15 | 17 | ||
@@ -34,6 +36,7 @@ Example for an OMAP3430 board: | |||
34 | 36 | ||
35 | onenand@0 { | 37 | onenand@0 { |
36 | reg = <0 0 0>; /* CS0, offset 0 */ | 38 | reg = <0 0 0>; /* CS0, offset 0 */ |
39 | gpmc,device-width = <2>; | ||
37 | 40 | ||
38 | #address-cells = <1>; | 41 | #address-cells = <1>; |
39 | #size-cells = <1>; | 42 | #size-cells = <1>; |
diff --git a/Documentation/devicetree/bindings/net/gpmc-eth.txt b/Documentation/devicetree/bindings/net/gpmc-eth.txt new file mode 100644 index 000000000000..24cb4e46f675 --- /dev/null +++ b/Documentation/devicetree/bindings/net/gpmc-eth.txt | |||
@@ -0,0 +1,97 @@ | |||
1 | Device tree bindings for Ethernet chip connected to TI GPMC | ||
2 | |||
3 | Besides being used to interface with external memory devices, the | ||
4 | General-Purpose Memory Controller can be used to connect Pseudo-SRAM devices | ||
5 | such as ethernet controllers to processors using the TI GPMC as a data bus. | ||
6 | |||
7 | Ethernet controllers connected to TI GPMC are represented as child nodes of | ||
8 | the GPMC controller with an "ethernet" name. | ||
9 | |||
10 | All timing relevant properties as well as generic GPMC child properties are | ||
11 | explained in a separate documents. Please refer to | ||
12 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
13 | |||
14 | For the properties relevant to the ethernet controller connected to the GPMC | ||
15 | refer to the binding documentation of the device. For example, the documentation | ||
16 | for the SMSC 911x is Documentation/devicetree/bindings/net/smsc911x.txt | ||
17 | |||
18 | Child nodes need to specify the GPMC bus address width using the "bank-width" | ||
19 | property but is possible that an ethernet controller also has a property to | ||
20 | specify the I/O registers address width. Even when the GPMC has a maximum 16-bit | ||
21 | address width, it supports devices with 32-bit word registers. | ||
22 | For example with an SMSC LAN911x/912x controller connected to the TI GPMC on an | ||
23 | OMAP2+ board, "bank-width = <2>;" and "reg-io-width = <4>;". | ||
24 | |||
25 | Required properties: | ||
26 | - bank-width: Address width of the device in bytes. GPMC supports 8-bit | ||
27 | and 16-bit devices and so must be either 1 or 2 bytes. | ||
28 | - compatible: Compatible string property for the ethernet child device. | ||
29 | - gpmc,cs-on: Chip-select assertion time | ||
30 | - gpmc,cs-rd-off: Chip-select de-assertion time for reads | ||
31 | - gpmc,cs-wr-off: Chip-select de-assertion time for writes | ||
32 | - gpmc,oe-on: Output-enable assertion time | ||
33 | - gpmc,oe-off Output-enable de-assertion time | ||
34 | - gpmc,we-on: Write-enable assertion time | ||
35 | - gpmc,we-off: Write-enable de-assertion time | ||
36 | - gpmc,access: Start cycle to first data capture (read access) | ||
37 | - gpmc,rd-cycle: Total read cycle time | ||
38 | - gpmc,wr-cycle: Total write cycle time | ||
39 | - reg: Chip-select, base address (relative to chip-select) | ||
40 | and size of the memory mapped for the device. | ||
41 | Note that base address will be typically 0 as this | ||
42 | is the start of the chip-select. | ||
43 | |||
44 | Optional properties: | ||
45 | - gpmc,XXX Additional GPMC timings and settings parameters. See | ||
46 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
47 | |||
48 | Example: | ||
49 | |||
50 | gpmc: gpmc@6e000000 { | ||
51 | compatible = "ti,omap3430-gpmc"; | ||
52 | ti,hwmods = "gpmc"; | ||
53 | reg = <0x6e000000 0x1000>; | ||
54 | interrupts = <20>; | ||
55 | gpmc,num-cs = <8>; | ||
56 | gpmc,num-waitpins = <4>; | ||
57 | #address-cells = <2>; | ||
58 | #size-cells = <1>; | ||
59 | |||
60 | ranges = <5 0 0x2c000000 0x1000000>; | ||
61 | |||
62 | ethernet@5,0 { | ||
63 | compatible = "smsc,lan9221", "smsc,lan9115"; | ||
64 | reg = <5 0 0xff>; | ||
65 | bank-width = <2>; | ||
66 | |||
67 | gpmc,mux-add-data; | ||
68 | gpmc,cs-on = <0>; | ||
69 | gpmc,cs-rd-off = <186>; | ||
70 | gpmc,cs-wr-off = <186>; | ||
71 | gpmc,adv-on = <12>; | ||
72 | gpmc,adv-rd-off = <48>; | ||
73 | gpmc,adv-wr-off = <48>; | ||
74 | gpmc,oe-on = <54>; | ||
75 | gpmc,oe-off = <168>; | ||
76 | gpmc,we-on = <54>; | ||
77 | gpmc,we-off = <168>; | ||
78 | gpmc,rd-cycle = <186>; | ||
79 | gpmc,wr-cycle = <186>; | ||
80 | gpmc,access = <114>; | ||
81 | gpmc,page-burst-access = <6>; | ||
82 | gpmc,bus-turnaround = <12>; | ||
83 | gpmc,cycle2cycle-delay = <18>; | ||
84 | gpmc,wr-data-mux-bus = <90>; | ||
85 | gpmc,wr-access = <186>; | ||
86 | gpmc,cycle2cycle-samecsen; | ||
87 | gpmc,cycle2cycle-diffcsen; | ||
88 | |||
89 | interrupt-parent = <&gpio6>; | ||
90 | interrupts = <16>; | ||
91 | vmmc-supply = <&vddvario>; | ||
92 | vmmc_aux-supply = <&vdd33a>; | ||
93 | reg-io-width = <4>; | ||
94 | |||
95 | smsc,save-mac-address; | ||
96 | }; | ||
97 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt new file mode 100644 index 000000000000..b3aa90f0ce44 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt | |||
@@ -0,0 +1,57 @@ | |||
1 | VIA VT8500 and Wondermedia WM8xxx-series pinmux/gpio controller | ||
2 | |||
3 | These SoCs contain a combined Pinmux/GPIO module. Each pin may operate as | ||
4 | either a GPIO in, GPIO out or as an alternate function (I2C, SPI etc). | ||
5 | |||
6 | Required properties: | ||
7 | - compatible: "via,vt8500-pinctrl", "wm,wm8505-pinctrl", "wm,wm8650-pinctrl", | ||
8 | "wm8750-pinctrl" or "wm,wm8850-pinctrl" | ||
9 | - reg: Should contain the physical address of the module's registers. | ||
10 | - interrupt-controller: Marks the device node as an interrupt controller. | ||
11 | - #interrupt-cells: Should be two. | ||
12 | - gpio-controller: Marks the device node as a GPIO controller. | ||
13 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
14 | second cell is used to specify optional parameters. | ||
15 | bit 0 - active low | ||
16 | |||
17 | Please refer to ../gpio/gpio.txt for a general description of GPIO bindings. | ||
18 | |||
19 | Please refer to pinctrl-bindings.txt in this directory for details of the | ||
20 | common pinctrl bindings used by client devices, including the meaning of the | ||
21 | phrase "pin configuration node". | ||
22 | |||
23 | Each pin configuration node lists the pin(s) to which it applies, and one or | ||
24 | more of the mux functions to select on those pin(s), and pull-up/down | ||
25 | configuration. Each subnode only affects those parameters that are explicitly | ||
26 | listed. In other words, a subnode that lists only a mux function implies no | ||
27 | information about any pull configuration. Similarly, a subnode that lists only | ||
28 | a pull parameter implies no information about the mux function. | ||
29 | |||
30 | Required subnode-properties: | ||
31 | - wm,pins: An array of cells. Each cell contains the ID of a pin. | ||
32 | |||
33 | Optional subnode-properties: | ||
34 | - wm,function: Integer, containing the function to mux to the pin(s): | ||
35 | 0: GPIO in | ||
36 | 1: GPIO out | ||
37 | 2: alternate | ||
38 | |||
39 | - wm,pull: Integer, representing the pull-down/up to apply to the pin(s): | ||
40 | 0: none | ||
41 | 1: down | ||
42 | 2: up | ||
43 | |||
44 | Each of wm,function and wm,pull may contain either a single value which | ||
45 | will be applied to all pins in wm,pins, or one value for each entry in | ||
46 | wm,pins. | ||
47 | |||
48 | Example: | ||
49 | |||
50 | pinctrl: pinctrl { | ||
51 | compatible = "wm,wm8505-pinctrl"; | ||
52 | reg = <0xD8110000 0x10000>; | ||
53 | interrupt-controller; | ||
54 | #interrupt-cells = <2>; | ||
55 | gpio-controller; | ||
56 | #gpio-cells = <2>; | ||
57 | }; | ||
diff --git a/Documentation/devicetree/bindings/reset/reset.txt b/Documentation/devicetree/bindings/reset/reset.txt new file mode 100644 index 000000000000..31db6ff84908 --- /dev/null +++ b/Documentation/devicetree/bindings/reset/reset.txt | |||
@@ -0,0 +1,75 @@ | |||
1 | = Reset Signal Device Tree Bindings = | ||
2 | |||
3 | This binding is intended to represent the hardware reset signals present | ||
4 | internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole | ||
5 | standalone chips are most likely better represented as GPIOs, although there | ||
6 | are likely to be exceptions to this rule. | ||
7 | |||
8 | Hardware blocks typically receive a reset signal. This signal is generated by | ||
9 | a reset provider (e.g. power management or clock module) and received by a | ||
10 | reset consumer (the module being reset, or a module managing when a sub- | ||
11 | ordinate module is reset). This binding exists to represent the provider and | ||
12 | consumer, and provide a way to couple the two together. | ||
13 | |||
14 | A reset signal is represented by the phandle of the provider, plus a reset | ||
15 | specifier - a list of DT cells that represents the reset signal within the | ||
16 | provider. The length (number of cells) and semantics of the reset specifier | ||
17 | are dictated by the binding of the reset provider, although common schemes | ||
18 | are described below. | ||
19 | |||
20 | A word on where to place reset signal consumers in device tree: It is possible | ||
21 | in hardware for a reset signal to affect multiple logically separate HW blocks | ||
22 | at once. In this case, it would be unwise to represent this reset signal in | ||
23 | the DT node of each affected HW block, since if activated, an unrelated block | ||
24 | may be reset. Instead, reset signals should be represented in the DT node | ||
25 | where it makes most sense to control it; this may be a bus node if all | ||
26 | children of the bus are affected by the reset signal, or an individual HW | ||
27 | block node for dedicated reset signals. The intent of this binding is to give | ||
28 | appropriate software access to the reset signals in order to manage the HW, | ||
29 | rather than to slavishly enumerate the reset signal that affects each HW | ||
30 | block. | ||
31 | |||
32 | = Reset providers = | ||
33 | |||
34 | Required properties: | ||
35 | #reset-cells: Number of cells in a reset specifier; Typically 0 for nodes | ||
36 | with a single reset output and 1 for nodes with multiple | ||
37 | reset outputs. | ||
38 | |||
39 | For example: | ||
40 | |||
41 | rst: reset-controller { | ||
42 | #reset-cells = <1>; | ||
43 | }; | ||
44 | |||
45 | = Reset consumers = | ||
46 | |||
47 | Required properties: | ||
48 | resets: List of phandle and reset specifier pairs, one pair | ||
49 | for each reset signal that affects the device, or that the | ||
50 | device manages. Note: if the reset provider specifies '0' for | ||
51 | #reset-cells, then only the phandle portion of the pair will | ||
52 | appear. | ||
53 | |||
54 | Optional properties: | ||
55 | reset-names: List of reset signal name strings sorted in the same order as | ||
56 | the resets property. Consumers drivers will use reset-names to | ||
57 | match reset signal names with reset specifiers. | ||
58 | |||
59 | For example: | ||
60 | |||
61 | device { | ||
62 | resets = <&rst 20>; | ||
63 | reset-names = "reset"; | ||
64 | }; | ||
65 | |||
66 | This represents a device with a single reset signal named "reset". | ||
67 | |||
68 | bus { | ||
69 | resets = <&rst 10> <&rst 11> <&rst 12> <&rst 11>; | ||
70 | reset-names = "i2s1", "i2s2", "dma", "mixer"; | ||
71 | }; | ||
72 | |||
73 | This represents a bus that controls the reset signal of each of four sub- | ||
74 | ordinate devices. Consider for example a bus that fails to operate unless no | ||
75 | child device has reset asserted. | ||
diff --git a/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt b/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt new file mode 100644 index 000000000000..993695c659e1 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | Cadence TTC - Triple Timer Counter | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Should be "cdns,ttc". | ||
5 | - reg : Specifies base physical address and size of the registers. | ||
6 | - interrupts : A list of 3 interrupts; one per timer channel. | ||
7 | - clocks: phandle to the source clock | ||
8 | |||
9 | Example: | ||
10 | |||
11 | ttc0: ttc0@f8001000 { | ||
12 | interrupt-parent = <&intc>; | ||
13 | interrupts = < 0 10 4 0 11 4 0 12 4 >; | ||
14 | compatible = "cdns,ttc"; | ||
15 | reg = <0xF8001000 0x1000>; | ||
16 | clocks = <&cpu_clk 3>; | ||
17 | }; | ||
diff --git a/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt b/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt new file mode 100644 index 000000000000..cb47bfbcaeea --- /dev/null +++ b/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt | |||
@@ -0,0 +1,68 @@ | |||
1 | Samsung's Multi Core Timer (MCT) | ||
2 | |||
3 | The Samsung's Multi Core Timer (MCT) module includes two main blocks, the | ||
4 | global timer and CPU local timers. The global timer is a 64-bit free running | ||
5 | up-counter and can generate 4 interrupts when the counter reaches one of the | ||
6 | four preset counter values. The CPU local timers are 32-bit free running | ||
7 | down-counters and generate an interrupt when the counter expires. There is | ||
8 | one CPU local timer instantiated in MCT for every CPU in the system. | ||
9 | |||
10 | Required properties: | ||
11 | |||
12 | - compatible: should be "samsung,exynos4210-mct". | ||
13 | (a) "samsung,exynos4210-mct", for mct compatible with Exynos4210 mct. | ||
14 | (b) "samsung,exynos4412-mct", for mct compatible with Exynos4412 mct. | ||
15 | |||
16 | - reg: base address of the mct controller and length of the address space | ||
17 | it occupies. | ||
18 | |||
19 | - interrupts: the list of interrupts generated by the controller. The following | ||
20 | should be the order of the interrupts specified. The local timer interrupts | ||
21 | should be specified after the four global timer interrupts have been | ||
22 | specified. | ||
23 | |||
24 | 0: Global Timer Interrupt 0 | ||
25 | 1: Global Timer Interrupt 1 | ||
26 | 2: Global Timer Interrupt 2 | ||
27 | 3: Global Timer Interrupt 3 | ||
28 | 4: Local Timer Interrupt 0 | ||
29 | 5: Local Timer Interrupt 1 | ||
30 | 6: .. | ||
31 | 7: .. | ||
32 | i: Local Timer Interrupt n | ||
33 | |||
34 | Example 1: In this example, the system uses only the first global timer | ||
35 | interrupt generated by MCT and the remaining three global timer | ||
36 | interrupts are unused. Two local timer interrupts have been | ||
37 | specified. | ||
38 | |||
39 | mct@10050000 { | ||
40 | compatible = "samsung,exynos4210-mct"; | ||
41 | reg = <0x10050000 0x800>; | ||
42 | interrupts = <0 57 0>, <0 0 0>, <0 0 0>, <0 0 0>, | ||
43 | <0 42 0>, <0 48 0>; | ||
44 | }; | ||
45 | |||
46 | Example 2: In this example, the MCT global and local timer interrupts are | ||
47 | connected to two seperate interrupt controllers. Hence, an | ||
48 | interrupt-map is created to map the interrupts to the respective | ||
49 | interrupt controllers. | ||
50 | |||
51 | mct@101C0000 { | ||
52 | compatible = "samsung,exynos4210-mct"; | ||
53 | reg = <0x101C0000 0x800>; | ||
54 | interrupt-controller; | ||
55 | #interrups-cells = <2>; | ||
56 | interrupt-parent = <&mct_map>; | ||
57 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
58 | <4 0>, <5 0>; | ||
59 | |||
60 | mct_map: mct-map { | ||
61 | #interrupt-cells = <2>; | ||
62 | #address-cells = <0>; | ||
63 | #size-cells = <0>; | ||
64 | interrupt-map = <0x0 0 &combiner 23 3>, | ||
65 | <0x4 0 &gic 0 120 0>, | ||
66 | <0x5 0 &gic 0 121 0>; | ||
67 | }; | ||
68 | }; | ||
diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt b/Documentation/devicetree/bindings/usb/exynos-usb.txt new file mode 100644 index 000000000000..f66fcddba46f --- /dev/null +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | Samsung Exynos SoC USB controller | ||
2 | |||
3 | The USB devices interface with USB controllers on Exynos SOCs. | ||
4 | The device node has following properties. | ||
5 | |||
6 | EHCI | ||
7 | Required properties: | ||
8 | - compatible: should be "samsung,exynos4210-ehci" for USB 2.0 | ||
9 | EHCI controller in host mode. | ||
10 | - reg: physical base address of the controller and length of memory mapped | ||
11 | region. | ||
12 | - interrupts: interrupt number to the cpu. | ||
13 | |||
14 | Optional properties: | ||
15 | - samsung,vbus-gpio: if present, specifies the GPIO that | ||
16 | needs to be pulled up for the bus to be powered. | ||
17 | |||
18 | Example: | ||
19 | |||
20 | usb@12110000 { | ||
21 | compatible = "samsung,exynos4210-ehci"; | ||
22 | reg = <0x12110000 0x100>; | ||
23 | interrupts = <0 71 0>; | ||
24 | samsung,vbus-gpio = <&gpx2 6 1 3 3>; | ||
25 | }; | ||
26 | |||
27 | OHCI | ||
28 | Required properties: | ||
29 | - compatible: should be "samsung,exynos4210-ohci" for USB 2.0 | ||
30 | OHCI companion controller in host mode. | ||
31 | - reg: physical base address of the controller and length of memory mapped | ||
32 | region. | ||
33 | - interrupts: interrupt number to the cpu. | ||
34 | |||
35 | Example: | ||
36 | usb@12120000 { | ||
37 | compatible = "samsung,exynos4210-ohci"; | ||
38 | reg = <0x12120000 0x100>; | ||
39 | interrupts = <0 71 0>; | ||
40 | }; | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 62079d434581..1e31dac36a5f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -689,12 +689,15 @@ config ARCH_SA1100 | |||
689 | config ARCH_S3C24XX | 689 | config ARCH_S3C24XX |
690 | bool "Samsung S3C24XX SoCs" | 690 | bool "Samsung S3C24XX SoCs" |
691 | select ARCH_HAS_CPUFREQ | 691 | select ARCH_HAS_CPUFREQ |
692 | select ARCH_USES_GETTIMEOFFSET | 692 | select ARCH_REQUIRE_GPIOLIB |
693 | select CLKDEV_LOOKUP | 693 | select CLKDEV_LOOKUP |
694 | select CLKSRC_MMIO | ||
695 | select GENERIC_CLOCKEVENTS | ||
694 | select HAVE_CLK | 696 | select HAVE_CLK |
695 | select HAVE_S3C2410_I2C if I2C | 697 | select HAVE_S3C2410_I2C if I2C |
696 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 698 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
697 | select HAVE_S3C_RTC if RTC_CLASS | 699 | select HAVE_S3C_RTC if RTC_CLASS |
700 | select MULTI_IRQ_HANDLER | ||
698 | select NEED_MACH_GPIO_H | 701 | select NEED_MACH_GPIO_H |
699 | select NEED_MACH_IO_H | 702 | select NEED_MACH_IO_H |
700 | help | 703 | help |
@@ -707,10 +710,11 @@ config ARCH_S3C64XX | |||
707 | bool "Samsung S3C64XX" | 710 | bool "Samsung S3C64XX" |
708 | select ARCH_HAS_CPUFREQ | 711 | select ARCH_HAS_CPUFREQ |
709 | select ARCH_REQUIRE_GPIOLIB | 712 | select ARCH_REQUIRE_GPIOLIB |
710 | select ARCH_USES_GETTIMEOFFSET | ||
711 | select ARM_VIC | 713 | select ARM_VIC |
712 | select CLKDEV_LOOKUP | 714 | select CLKDEV_LOOKUP |
715 | select CLKSRC_MMIO | ||
713 | select CPU_V6 | 716 | select CPU_V6 |
717 | select GENERIC_CLOCKEVENTS | ||
714 | select HAVE_CLK | 718 | select HAVE_CLK |
715 | select HAVE_S3C2410_I2C if I2C | 719 | select HAVE_S3C2410_I2C if I2C |
716 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 720 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
@@ -744,9 +748,11 @@ config ARCH_S5P64X0 | |||
744 | 748 | ||
745 | config ARCH_S5PC100 | 749 | config ARCH_S5PC100 |
746 | bool "Samsung S5PC100" | 750 | bool "Samsung S5PC100" |
747 | select ARCH_USES_GETTIMEOFFSET | 751 | select ARCH_REQUIRE_GPIOLIB |
748 | select CLKDEV_LOOKUP | 752 | select CLKDEV_LOOKUP |
753 | select CLKSRC_MMIO | ||
749 | select CPU_V7 | 754 | select CPU_V7 |
755 | select GENERIC_CLOCKEVENTS | ||
750 | select HAVE_CLK | 756 | select HAVE_CLK |
751 | select HAVE_S3C2410_I2C if I2C | 757 | select HAVE_S3C2410_I2C if I2C |
752 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 758 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
@@ -779,6 +785,7 @@ config ARCH_EXYNOS | |||
779 | select ARCH_HAS_HOLES_MEMORYMODEL | 785 | select ARCH_HAS_HOLES_MEMORYMODEL |
780 | select ARCH_SPARSEMEM_ENABLE | 786 | select ARCH_SPARSEMEM_ENABLE |
781 | select CLKDEV_LOOKUP | 787 | select CLKDEV_LOOKUP |
788 | select COMMON_CLK | ||
782 | select CPU_V7 | 789 | select CPU_V7 |
783 | select GENERIC_CLOCKEVENTS | 790 | select GENERIC_CLOCKEVENTS |
784 | select HAVE_CLK | 791 | select HAVE_CLK |
@@ -1552,7 +1559,8 @@ config ARCH_NR_GPIO | |||
1552 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA | 1559 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA |
1553 | default 512 if SOC_OMAP5 | 1560 | default 512 if SOC_OMAP5 |
1554 | default 392 if ARCH_U8500 | 1561 | default 392 if ARCH_U8500 |
1555 | default 288 if ARCH_VT8500 || ARCH_SUNXI | 1562 | default 352 if ARCH_VT8500 |
1563 | default 288 if ARCH_SUNXI | ||
1556 | default 264 if MACH_H4700 | 1564 | default 264 if MACH_H4700 |
1557 | default 0 | 1565 | default 0 |
1558 | help | 1566 | help |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 20358fb43450..55196639211d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -49,7 +49,10 @@ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ | |||
49 | dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ | 49 | dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ |
50 | exynos4210-smdkv310.dtb \ | 50 | exynos4210-smdkv310.dtb \ |
51 | exynos4210-trats.dtb \ | 51 | exynos4210-trats.dtb \ |
52 | exynos4412-odroidx.dtb \ | ||
52 | exynos4412-smdk4412.dtb \ | 53 | exynos4412-smdk4412.dtb \ |
54 | exynos4412-origen.dtb \ | ||
55 | exynos5250-arndale.dtb \ | ||
53 | exynos5250-smdk5250.dtb \ | 56 | exynos5250-smdk5250.dtb \ |
54 | exynos5250-snow.dtb \ | 57 | exynos5250-snow.dtb \ |
55 | exynos5440-ssdk5440.dtb | 58 | exynos5440-ssdk5440.dtb |
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi index 46c098017036..62eceb4f0d3f 100644 --- a/arch/arm/boot/dts/cros5250-common.dtsi +++ b/arch/arm/boot/dts/cros5250-common.dtsi | |||
@@ -24,6 +24,144 @@ | |||
24 | samsung,i2c-max-bus-freq = <378000>; | 24 | samsung,i2c-max-bus-freq = <378000>; |
25 | gpios = <&gpb3 0 2 3 0>, | 25 | gpios = <&gpb3 0 2 3 0>, |
26 | <&gpb3 1 2 3 0>; | 26 | <&gpb3 1 2 3 0>; |
27 | |||
28 | max77686@09 { | ||
29 | compatible = "maxim,max77686"; | ||
30 | reg = <0x09>; | ||
31 | |||
32 | voltage-regulators { | ||
33 | ldo1_reg: LDO1 { | ||
34 | regulator-name = "P1.0V_LDO_OUT1"; | ||
35 | regulator-min-microvolt = <1000000>; | ||
36 | regulator-max-microvolt = <1000000>; | ||
37 | regulator-always-on; | ||
38 | }; | ||
39 | |||
40 | ldo2_reg: LDO2 { | ||
41 | regulator-name = "P1.8V_LDO_OUT2"; | ||
42 | regulator-min-microvolt = <1800000>; | ||
43 | regulator-max-microvolt = <1800000>; | ||
44 | regulator-always-on; | ||
45 | }; | ||
46 | |||
47 | ldo3_reg: LDO3 { | ||
48 | regulator-name = "P1.8V_LDO_OUT3"; | ||
49 | regulator-min-microvolt = <1800000>; | ||
50 | regulator-max-microvolt = <1800000>; | ||
51 | regulator-always-on; | ||
52 | }; | ||
53 | |||
54 | ldo7_reg: LDO7 { | ||
55 | regulator-name = "P1.1V_LDO_OUT7"; | ||
56 | regulator-min-microvolt = <1100000>; | ||
57 | regulator-max-microvolt = <1100000>; | ||
58 | regulator-always-on; | ||
59 | }; | ||
60 | |||
61 | ldo8_reg: LDO8 { | ||
62 | regulator-name = "P1.0V_LDO_OUT8"; | ||
63 | regulator-min-microvolt = <1000000>; | ||
64 | regulator-max-microvolt = <1000000>; | ||
65 | regulator-always-on; | ||
66 | }; | ||
67 | |||
68 | ldo10_reg: LDO10 { | ||
69 | regulator-name = "P1.8V_LDO_OUT10"; | ||
70 | regulator-min-microvolt = <1800000>; | ||
71 | regulator-max-microvolt = <1800000>; | ||
72 | regulator-always-on; | ||
73 | }; | ||
74 | |||
75 | ldo12_reg: LDO12 { | ||
76 | regulator-name = "P3.0V_LDO_OUT12"; | ||
77 | regulator-min-microvolt = <3000000>; | ||
78 | regulator-max-microvolt = <3000000>; | ||
79 | regulator-always-on; | ||
80 | }; | ||
81 | |||
82 | ldo14_reg: LDO14 { | ||
83 | regulator-name = "P1.8V_LDO_OUT14"; | ||
84 | regulator-min-microvolt = <1800000>; | ||
85 | regulator-max-microvolt = <1800000>; | ||
86 | regulator-always-on; | ||
87 | }; | ||
88 | |||
89 | ldo15_reg: LDO15 { | ||
90 | regulator-name = "P1.0V_LDO_OUT15"; | ||
91 | regulator-min-microvolt = <1000000>; | ||
92 | regulator-max-microvolt = <1000000>; | ||
93 | regulator-always-on; | ||
94 | }; | ||
95 | |||
96 | ldo16_reg: LDO16 { | ||
97 | regulator-name = "P1.8V_LDO_OUT16"; | ||
98 | regulator-min-microvolt = <1800000>; | ||
99 | regulator-max-microvolt = <1800000>; | ||
100 | regulator-always-on; | ||
101 | }; | ||
102 | |||
103 | buck1_reg: BUCK1 { | ||
104 | regulator-name = "vdd_mif"; | ||
105 | regulator-min-microvolt = <950000>; | ||
106 | regulator-max-microvolt = <1300000>; | ||
107 | regulator-always-on; | ||
108 | regulator-boot-on; | ||
109 | }; | ||
110 | |||
111 | buck2_reg: BUCK2 { | ||
112 | regulator-name = "vdd_arm"; | ||
113 | regulator-min-microvolt = <850000>; | ||
114 | regulator-max-microvolt = <1350000>; | ||
115 | regulator-always-on; | ||
116 | regulator-boot-on; | ||
117 | }; | ||
118 | |||
119 | buck3_reg: BUCK3 { | ||
120 | regulator-name = "vdd_int"; | ||
121 | regulator-min-microvolt = <900000>; | ||
122 | regulator-max-microvolt = <1200000>; | ||
123 | regulator-always-on; | ||
124 | regulator-boot-on; | ||
125 | }; | ||
126 | |||
127 | buck4_reg: BUCK4 { | ||
128 | regulator-name = "vdd_g3d"; | ||
129 | regulator-min-microvolt = <850000>; | ||
130 | regulator-max-microvolt = <1300000>; | ||
131 | regulator-always-on; | ||
132 | regulator-boot-on; | ||
133 | }; | ||
134 | |||
135 | buck5_reg: BUCK5 { | ||
136 | regulator-name = "P1.8V_BUCK_OUT5"; | ||
137 | regulator-min-microvolt = <1800000>; | ||
138 | regulator-max-microvolt = <1800000>; | ||
139 | regulator-always-on; | ||
140 | regulator-boot-on; | ||
141 | }; | ||
142 | |||
143 | buck6_reg: BUCK6 { | ||
144 | regulator-name = "P1.35V_BUCK_OUT6"; | ||
145 | regulator-min-microvolt = <1350000>; | ||
146 | regulator-max-microvolt = <1350000>; | ||
147 | regulator-always-on; | ||
148 | }; | ||
149 | |||
150 | buck7_reg: BUCK7 { | ||
151 | regulator-name = "P2.0V_BUCK_OUT7"; | ||
152 | regulator-min-microvolt = <2000000>; | ||
153 | regulator-max-microvolt = <2000000>; | ||
154 | regulator-always-on; | ||
155 | }; | ||
156 | |||
157 | buck8_reg: BUCK8 { | ||
158 | regulator-name = "P2.85V_BUCK_OUT8"; | ||
159 | regulator-min-microvolt = <2850000>; | ||
160 | regulator-max-microvolt = <2850000>; | ||
161 | regulator-always-on; | ||
162 | }; | ||
163 | }; | ||
164 | }; | ||
27 | }; | 165 | }; |
28 | 166 | ||
29 | i2c@12C70000 { | 167 | i2c@12C70000 { |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index 1a62bcf18aa3..9ac47d51c407 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
@@ -86,6 +86,8 @@ | |||
86 | compatible = "samsung,s3c2410-wdt"; | 86 | compatible = "samsung,s3c2410-wdt"; |
87 | reg = <0x10060000 0x100>; | 87 | reg = <0x10060000 0x100>; |
88 | interrupts = <0 43 0>; | 88 | interrupts = <0 43 0>; |
89 | clocks = <&clock 345>; | ||
90 | clock-names = "watchdog"; | ||
89 | status = "disabled"; | 91 | status = "disabled"; |
90 | }; | 92 | }; |
91 | 93 | ||
@@ -93,6 +95,8 @@ | |||
93 | compatible = "samsung,s3c6410-rtc"; | 95 | compatible = "samsung,s3c6410-rtc"; |
94 | reg = <0x10070000 0x100>; | 96 | reg = <0x10070000 0x100>; |
95 | interrupts = <0 44 0>, <0 45 0>; | 97 | interrupts = <0 44 0>, <0 45 0>; |
98 | clocks = <&clock 346>; | ||
99 | clock-names = "rtc"; | ||
96 | status = "disabled"; | 100 | status = "disabled"; |
97 | }; | 101 | }; |
98 | 102 | ||
@@ -100,6 +104,8 @@ | |||
100 | compatible = "samsung,s5pv210-keypad"; | 104 | compatible = "samsung,s5pv210-keypad"; |
101 | reg = <0x100A0000 0x100>; | 105 | reg = <0x100A0000 0x100>; |
102 | interrupts = <0 109 0>; | 106 | interrupts = <0 109 0>; |
107 | clocks = <&clock 347>; | ||
108 | clock-names = "keypad"; | ||
103 | status = "disabled"; | 109 | status = "disabled"; |
104 | }; | 110 | }; |
105 | 111 | ||
@@ -107,6 +113,8 @@ | |||
107 | compatible = "samsung,exynos4210-sdhci"; | 113 | compatible = "samsung,exynos4210-sdhci"; |
108 | reg = <0x12510000 0x100>; | 114 | reg = <0x12510000 0x100>; |
109 | interrupts = <0 73 0>; | 115 | interrupts = <0 73 0>; |
116 | clocks = <&clock 297>, <&clock 145>; | ||
117 | clock-names = "hsmmc", "mmc_busclk.2"; | ||
110 | status = "disabled"; | 118 | status = "disabled"; |
111 | }; | 119 | }; |
112 | 120 | ||
@@ -114,6 +122,8 @@ | |||
114 | compatible = "samsung,exynos4210-sdhci"; | 122 | compatible = "samsung,exynos4210-sdhci"; |
115 | reg = <0x12520000 0x100>; | 123 | reg = <0x12520000 0x100>; |
116 | interrupts = <0 74 0>; | 124 | interrupts = <0 74 0>; |
125 | clocks = <&clock 298>, <&clock 146>; | ||
126 | clock-names = "hsmmc", "mmc_busclk.2"; | ||
117 | status = "disabled"; | 127 | status = "disabled"; |
118 | }; | 128 | }; |
119 | 129 | ||
@@ -121,6 +131,8 @@ | |||
121 | compatible = "samsung,exynos4210-sdhci"; | 131 | compatible = "samsung,exynos4210-sdhci"; |
122 | reg = <0x12530000 0x100>; | 132 | reg = <0x12530000 0x100>; |
123 | interrupts = <0 75 0>; | 133 | interrupts = <0 75 0>; |
134 | clocks = <&clock 299>, <&clock 147>; | ||
135 | clock-names = "hsmmc", "mmc_busclk.2"; | ||
124 | status = "disabled"; | 136 | status = "disabled"; |
125 | }; | 137 | }; |
126 | 138 | ||
@@ -128,6 +140,16 @@ | |||
128 | compatible = "samsung,exynos4210-sdhci"; | 140 | compatible = "samsung,exynos4210-sdhci"; |
129 | reg = <0x12540000 0x100>; | 141 | reg = <0x12540000 0x100>; |
130 | interrupts = <0 76 0>; | 142 | interrupts = <0 76 0>; |
143 | clocks = <&clock 300>, <&clock 148>; | ||
144 | clock-names = "hsmmc", "mmc_busclk.2"; | ||
145 | status = "disabled"; | ||
146 | }; | ||
147 | |||
148 | mfc: codec@13400000 { | ||
149 | compatible = "samsung,mfc-v5"; | ||
150 | reg = <0x13400000 0x10000>; | ||
151 | interrupts = <0 94 0>; | ||
152 | samsung,power-domain = <&pd_mfc>; | ||
131 | status = "disabled"; | 153 | status = "disabled"; |
132 | }; | 154 | }; |
133 | 155 | ||
@@ -135,6 +157,8 @@ | |||
135 | compatible = "samsung,exynos4210-uart"; | 157 | compatible = "samsung,exynos4210-uart"; |
136 | reg = <0x13800000 0x100>; | 158 | reg = <0x13800000 0x100>; |
137 | interrupts = <0 52 0>; | 159 | interrupts = <0 52 0>; |
160 | clocks = <&clock 312>, <&clock 151>; | ||
161 | clock-names = "uart", "clk_uart_baud0"; | ||
138 | status = "disabled"; | 162 | status = "disabled"; |
139 | }; | 163 | }; |
140 | 164 | ||
@@ -142,6 +166,8 @@ | |||
142 | compatible = "samsung,exynos4210-uart"; | 166 | compatible = "samsung,exynos4210-uart"; |
143 | reg = <0x13810000 0x100>; | 167 | reg = <0x13810000 0x100>; |
144 | interrupts = <0 53 0>; | 168 | interrupts = <0 53 0>; |
169 | clocks = <&clock 313>, <&clock 152>; | ||
170 | clock-names = "uart", "clk_uart_baud0"; | ||
145 | status = "disabled"; | 171 | status = "disabled"; |
146 | }; | 172 | }; |
147 | 173 | ||
@@ -149,6 +175,8 @@ | |||
149 | compatible = "samsung,exynos4210-uart"; | 175 | compatible = "samsung,exynos4210-uart"; |
150 | reg = <0x13820000 0x100>; | 176 | reg = <0x13820000 0x100>; |
151 | interrupts = <0 54 0>; | 177 | interrupts = <0 54 0>; |
178 | clocks = <&clock 314>, <&clock 153>; | ||
179 | clock-names = "uart", "clk_uart_baud0"; | ||
152 | status = "disabled"; | 180 | status = "disabled"; |
153 | }; | 181 | }; |
154 | 182 | ||
@@ -156,6 +184,8 @@ | |||
156 | compatible = "samsung,exynos4210-uart"; | 184 | compatible = "samsung,exynos4210-uart"; |
157 | reg = <0x13830000 0x100>; | 185 | reg = <0x13830000 0x100>; |
158 | interrupts = <0 55 0>; | 186 | interrupts = <0 55 0>; |
187 | clocks = <&clock 315>, <&clock 154>; | ||
188 | clock-names = "uart", "clk_uart_baud0"; | ||
159 | status = "disabled"; | 189 | status = "disabled"; |
160 | }; | 190 | }; |
161 | 191 | ||
@@ -165,6 +195,8 @@ | |||
165 | compatible = "samsung,s3c2440-i2c"; | 195 | compatible = "samsung,s3c2440-i2c"; |
166 | reg = <0x13860000 0x100>; | 196 | reg = <0x13860000 0x100>; |
167 | interrupts = <0 58 0>; | 197 | interrupts = <0 58 0>; |
198 | clocks = <&clock 317>; | ||
199 | clock-names = "i2c"; | ||
168 | status = "disabled"; | 200 | status = "disabled"; |
169 | }; | 201 | }; |
170 | 202 | ||
@@ -174,6 +206,8 @@ | |||
174 | compatible = "samsung,s3c2440-i2c"; | 206 | compatible = "samsung,s3c2440-i2c"; |
175 | reg = <0x13870000 0x100>; | 207 | reg = <0x13870000 0x100>; |
176 | interrupts = <0 59 0>; | 208 | interrupts = <0 59 0>; |
209 | clocks = <&clock 318>; | ||
210 | clock-names = "i2c"; | ||
177 | status = "disabled"; | 211 | status = "disabled"; |
178 | }; | 212 | }; |
179 | 213 | ||
@@ -183,6 +217,8 @@ | |||
183 | compatible = "samsung,s3c2440-i2c"; | 217 | compatible = "samsung,s3c2440-i2c"; |
184 | reg = <0x13880000 0x100>; | 218 | reg = <0x13880000 0x100>; |
185 | interrupts = <0 60 0>; | 219 | interrupts = <0 60 0>; |
220 | clocks = <&clock 319>; | ||
221 | clock-names = "i2c"; | ||
186 | status = "disabled"; | 222 | status = "disabled"; |
187 | }; | 223 | }; |
188 | 224 | ||
@@ -192,6 +228,8 @@ | |||
192 | compatible = "samsung,s3c2440-i2c"; | 228 | compatible = "samsung,s3c2440-i2c"; |
193 | reg = <0x13890000 0x100>; | 229 | reg = <0x13890000 0x100>; |
194 | interrupts = <0 61 0>; | 230 | interrupts = <0 61 0>; |
231 | clocks = <&clock 320>; | ||
232 | clock-names = "i2c"; | ||
195 | status = "disabled"; | 233 | status = "disabled"; |
196 | }; | 234 | }; |
197 | 235 | ||
@@ -201,6 +239,8 @@ | |||
201 | compatible = "samsung,s3c2440-i2c"; | 239 | compatible = "samsung,s3c2440-i2c"; |
202 | reg = <0x138A0000 0x100>; | 240 | reg = <0x138A0000 0x100>; |
203 | interrupts = <0 62 0>; | 241 | interrupts = <0 62 0>; |
242 | clocks = <&clock 321>; | ||
243 | clock-names = "i2c"; | ||
204 | status = "disabled"; | 244 | status = "disabled"; |
205 | }; | 245 | }; |
206 | 246 | ||
@@ -210,6 +250,8 @@ | |||
210 | compatible = "samsung,s3c2440-i2c"; | 250 | compatible = "samsung,s3c2440-i2c"; |
211 | reg = <0x138B0000 0x100>; | 251 | reg = <0x138B0000 0x100>; |
212 | interrupts = <0 63 0>; | 252 | interrupts = <0 63 0>; |
253 | clocks = <&clock 322>; | ||
254 | clock-names = "i2c"; | ||
213 | status = "disabled"; | 255 | status = "disabled"; |
214 | }; | 256 | }; |
215 | 257 | ||
@@ -219,6 +261,8 @@ | |||
219 | compatible = "samsung,s3c2440-i2c"; | 261 | compatible = "samsung,s3c2440-i2c"; |
220 | reg = <0x138C0000 0x100>; | 262 | reg = <0x138C0000 0x100>; |
221 | interrupts = <0 64 0>; | 263 | interrupts = <0 64 0>; |
264 | clocks = <&clock 323>; | ||
265 | clock-names = "i2c"; | ||
222 | status = "disabled"; | 266 | status = "disabled"; |
223 | }; | 267 | }; |
224 | 268 | ||
@@ -228,6 +272,8 @@ | |||
228 | compatible = "samsung,s3c2440-i2c"; | 272 | compatible = "samsung,s3c2440-i2c"; |
229 | reg = <0x138D0000 0x100>; | 273 | reg = <0x138D0000 0x100>; |
230 | interrupts = <0 65 0>; | 274 | interrupts = <0 65 0>; |
275 | clocks = <&clock 324>; | ||
276 | clock-names = "i2c"; | ||
231 | status = "disabled"; | 277 | status = "disabled"; |
232 | }; | 278 | }; |
233 | 279 | ||
@@ -239,6 +285,8 @@ | |||
239 | rx-dma-channel = <&pdma0 6>; /* preliminary */ | 285 | rx-dma-channel = <&pdma0 6>; /* preliminary */ |
240 | #address-cells = <1>; | 286 | #address-cells = <1>; |
241 | #size-cells = <0>; | 287 | #size-cells = <0>; |
288 | clocks = <&clock 327>, <&clock 159>; | ||
289 | clock-names = "spi", "spi_busclk0"; | ||
242 | status = "disabled"; | 290 | status = "disabled"; |
243 | }; | 291 | }; |
244 | 292 | ||
@@ -250,6 +298,8 @@ | |||
250 | rx-dma-channel = <&pdma1 6>; /* preliminary */ | 298 | rx-dma-channel = <&pdma1 6>; /* preliminary */ |
251 | #address-cells = <1>; | 299 | #address-cells = <1>; |
252 | #size-cells = <0>; | 300 | #size-cells = <0>; |
301 | clocks = <&clock 328>, <&clock 160>; | ||
302 | clock-names = "spi", "spi_busclk0"; | ||
253 | status = "disabled"; | 303 | status = "disabled"; |
254 | }; | 304 | }; |
255 | 305 | ||
@@ -261,6 +311,8 @@ | |||
261 | rx-dma-channel = <&pdma0 8>; /* preliminary */ | 311 | rx-dma-channel = <&pdma0 8>; /* preliminary */ |
262 | #address-cells = <1>; | 312 | #address-cells = <1>; |
263 | #size-cells = <0>; | 313 | #size-cells = <0>; |
314 | clocks = <&clock 329>, <&clock 161>; | ||
315 | clock-names = "spi", "spi_busclk0"; | ||
264 | status = "disabled"; | 316 | status = "disabled"; |
265 | }; | 317 | }; |
266 | 318 | ||
@@ -275,6 +327,8 @@ | |||
275 | compatible = "arm,pl330", "arm,primecell"; | 327 | compatible = "arm,pl330", "arm,primecell"; |
276 | reg = <0x12680000 0x1000>; | 328 | reg = <0x12680000 0x1000>; |
277 | interrupts = <0 35 0>; | 329 | interrupts = <0 35 0>; |
330 | clocks = <&clock 292>; | ||
331 | clock-names = "apb_pclk"; | ||
278 | #dma-cells = <1>; | 332 | #dma-cells = <1>; |
279 | #dma-channels = <8>; | 333 | #dma-channels = <8>; |
280 | #dma-requests = <32>; | 334 | #dma-requests = <32>; |
@@ -284,6 +338,8 @@ | |||
284 | compatible = "arm,pl330", "arm,primecell"; | 338 | compatible = "arm,pl330", "arm,primecell"; |
285 | reg = <0x12690000 0x1000>; | 339 | reg = <0x12690000 0x1000>; |
286 | interrupts = <0 36 0>; | 340 | interrupts = <0 36 0>; |
341 | clocks = <&clock 293>; | ||
342 | clock-names = "apb_pclk"; | ||
287 | #dma-cells = <1>; | 343 | #dma-cells = <1>; |
288 | #dma-channels = <8>; | 344 | #dma-channels = <8>; |
289 | #dma-requests = <32>; | 345 | #dma-requests = <32>; |
@@ -293,6 +349,8 @@ | |||
293 | compatible = "arm,pl330", "arm,primecell"; | 349 | compatible = "arm,pl330", "arm,primecell"; |
294 | reg = <0x12850000 0x1000>; | 350 | reg = <0x12850000 0x1000>; |
295 | interrupts = <0 34 0>; | 351 | interrupts = <0 34 0>; |
352 | clocks = <&clock 279>; | ||
353 | clock-names = "apb_pclk"; | ||
296 | #dma-cells = <1>; | 354 | #dma-cells = <1>; |
297 | #dma-channels = <8>; | 355 | #dma-channels = <8>; |
298 | #dma-requests = <1>; | 356 | #dma-requests = <1>; |
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts index f2710018e84e..1b30bc8e2654 100644 --- a/arch/arm/boot/dts/exynos4210-origen.dts +++ b/arch/arm/boot/dts/exynos4210-origen.dts | |||
@@ -57,6 +57,12 @@ | |||
57 | status = "okay"; | 57 | status = "okay"; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | codec@13400000 { | ||
61 | samsung,mfc-r = <0x43000000 0x800000>; | ||
62 | samsung,mfc-l = <0x51000000 0x800000>; | ||
63 | status = "okay"; | ||
64 | }; | ||
65 | |||
60 | serial@13800000 { | 66 | serial@13800000 { |
61 | status = "okay"; | 67 | status = "okay"; |
62 | }; | 68 | }; |
@@ -121,4 +127,16 @@ | |||
121 | linux,default-trigger = "heartbeat"; | 127 | linux,default-trigger = "heartbeat"; |
122 | }; | 128 | }; |
123 | }; | 129 | }; |
130 | |||
131 | fixed-rate-clocks { | ||
132 | xxti { | ||
133 | compatible = "samsung,clock-xxti"; | ||
134 | clock-frequency = <0>; | ||
135 | }; | ||
136 | |||
137 | xusbxti { | ||
138 | compatible = "samsung,clock-xusbxti"; | ||
139 | clock-frequency = <24000000>; | ||
140 | }; | ||
141 | }; | ||
124 | }; | 142 | }; |
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index f63490707f3a..f52c86e2d424 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts | |||
@@ -43,6 +43,12 @@ | |||
43 | status = "okay"; | 43 | status = "okay"; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | codec@13400000 { | ||
47 | samsung,mfc-r = <0x43000000 0x800000>; | ||
48 | samsung,mfc-l = <0x51000000 0x800000>; | ||
49 | status = "okay"; | ||
50 | }; | ||
51 | |||
46 | serial@13800000 { | 52 | serial@13800000 { |
47 | status = "okay"; | 53 | status = "okay"; |
48 | }; | 54 | }; |
@@ -189,4 +195,16 @@ | |||
189 | }; | 195 | }; |
190 | }; | 196 | }; |
191 | }; | 197 | }; |
198 | |||
199 | fixed-rate-clocks { | ||
200 | xxti { | ||
201 | compatible = "samsung,clock-xxti"; | ||
202 | clock-frequency = <12000000>; | ||
203 | }; | ||
204 | |||
205 | xusbxti { | ||
206 | compatible = "samsung,clock-xusbxti"; | ||
207 | clock-frequency = <24000000>; | ||
208 | }; | ||
209 | }; | ||
192 | }; | 210 | }; |
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts index c346b64dff55..9a14484c7bb1 100644 --- a/arch/arm/boot/dts/exynos4210-trats.dts +++ b/arch/arm/boot/dts/exynos4210-trats.dts | |||
@@ -289,4 +289,16 @@ | |||
289 | }; | 289 | }; |
290 | }; | 290 | }; |
291 | }; | 291 | }; |
292 | |||
293 | fixed-rate-clocks { | ||
294 | xxti { | ||
295 | compatible = "samsung,clock-xxti"; | ||
296 | clock-frequency = <0>; | ||
297 | }; | ||
298 | |||
299 | xusbxti { | ||
300 | compatible = "samsung,clock-xusbxti"; | ||
301 | clock-frequency = <24000000>; | ||
302 | }; | ||
303 | }; | ||
292 | }; | 304 | }; |
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi index 2feffc70814c..15143bdbafb8 100644 --- a/arch/arm/boot/dts/exynos4210.dtsi +++ b/arch/arm/boot/dts/exynos4210.dtsi | |||
@@ -47,6 +47,42 @@ | |||
47 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; | 47 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | mct@10050000 { | ||
51 | compatible = "samsung,exynos4210-mct"; | ||
52 | reg = <0x10050000 0x800>; | ||
53 | interrupt-controller; | ||
54 | #interrups-cells = <2>; | ||
55 | interrupt-parent = <&mct_map>; | ||
56 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
57 | <4 0>, <5 0>; | ||
58 | clocks = <&clock 3>, <&clock 344>; | ||
59 | clock-names = "fin_pll", "mct"; | ||
60 | |||
61 | mct_map: mct-map { | ||
62 | #interrupt-cells = <2>; | ||
63 | #address-cells = <0>; | ||
64 | #size-cells = <0>; | ||
65 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
66 | <0x1 0 &gic 0 69 0>, | ||
67 | <0x2 0 &combiner 12 6>, | ||
68 | <0x3 0 &combiner 12 7>, | ||
69 | <0x4 0 &gic 0 42 0>, | ||
70 | <0x5 0 &gic 0 48 0>; | ||
71 | }; | ||
72 | }; | ||
73 | |||
74 | clock: clock-controller@0x10030000 { | ||
75 | compatible = "samsung,exynos4210-clock"; | ||
76 | reg = <0x10030000 0x20000>; | ||
77 | #clock-cells = <1>; | ||
78 | }; | ||
79 | |||
80 | pmu { | ||
81 | compatible = "arm,cortex-a9-pmu"; | ||
82 | interrupt-parent = <&combiner>; | ||
83 | interrupts = <2 2>, <3 2>; | ||
84 | }; | ||
85 | |||
50 | pinctrl_0: pinctrl@11400000 { | 86 | pinctrl_0: pinctrl@11400000 { |
51 | compatible = "samsung,exynos4210-pinctrl"; | 87 | compatible = "samsung,exynos4210-pinctrl"; |
52 | reg = <0x11400000 0x1000>; | 88 | reg = <0x11400000 0x1000>; |
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi index c6ae2005961f..36d4299789ef 100644 --- a/arch/arm/boot/dts/exynos4212.dtsi +++ b/arch/arm/boot/dts/exynos4212.dtsi | |||
@@ -25,4 +25,26 @@ | |||
25 | gic:interrupt-controller@10490000 { | 25 | gic:interrupt-controller@10490000 { |
26 | cpu-offset = <0x8000>; | 26 | cpu-offset = <0x8000>; |
27 | }; | 27 | }; |
28 | |||
29 | mct@10050000 { | ||
30 | compatible = "samsung,exynos4412-mct"; | ||
31 | reg = <0x10050000 0x800>; | ||
32 | interrupt-controller; | ||
33 | #interrups-cells = <2>; | ||
34 | interrupt-parent = <&mct_map>; | ||
35 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
36 | <4 0>, <5 0>; | ||
37 | |||
38 | mct_map: mct-map { | ||
39 | #interrupt-cells = <2>; | ||
40 | #address-cells = <0>; | ||
41 | #size-cells = <0>; | ||
42 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
43 | <0x1 0 &combiner 12 5>, | ||
44 | <0x2 0 &combiner 12 6>, | ||
45 | <0x3 0 &combiner 12 7>, | ||
46 | <0x4 0 &gic 1 12 0>, | ||
47 | <0x5 0 &gic 1 12 0>; | ||
48 | }; | ||
49 | }; | ||
28 | }; | 50 | }; |
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts new file mode 100644 index 000000000000..53bc8bf77984 --- /dev/null +++ b/arch/arm/boot/dts/exynos4412-odroidx.dts | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Hardkernel's Exynos4412 based ODROID-X board device tree source | ||
3 | * | ||
4 | * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com> | ||
5 | * | ||
6 | * Device tree source file for Hardkernel's ODROID-X board which is based on | ||
7 | * Samsung's Exynos4412 SoC. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | /dts-v1/; | ||
15 | /include/ "exynos4412.dtsi" | ||
16 | |||
17 | / { | ||
18 | model = "Hardkernel ODROID-X board based on Exynos4412"; | ||
19 | compatible = "hardkernel,odroid-x", "samsung,exynos4412"; | ||
20 | |||
21 | memory { | ||
22 | reg = <0x40000000 0x40000000>; | ||
23 | }; | ||
24 | |||
25 | leds { | ||
26 | compatible = "gpio-leds"; | ||
27 | led1 { | ||
28 | label = "led1:heart"; | ||
29 | gpios = <&gpc1 0 1>; | ||
30 | default-state = "on"; | ||
31 | linux,default-trigger = "heartbeat"; | ||
32 | }; | ||
33 | led2 { | ||
34 | label = "led2:mmc0"; | ||
35 | gpios = <&gpc1 2 1>; | ||
36 | default-state = "on"; | ||
37 | linux,default-trigger = "mmc0"; | ||
38 | }; | ||
39 | }; | ||
40 | |||
41 | mshc@12550000 { | ||
42 | #address-cells = <1>; | ||
43 | #size-cells = <0>; | ||
44 | pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; | ||
45 | pinctrl-names = "default"; | ||
46 | status = "okay"; | ||
47 | |||
48 | num-slots = <1>; | ||
49 | supports-highspeed; | ||
50 | broken-cd; | ||
51 | fifo-depth = <0x80>; | ||
52 | card-detect-delay = <200>; | ||
53 | samsung,dw-mshc-ciu-div = <3>; | ||
54 | samsung,dw-mshc-sdr-timing = <2 3>; | ||
55 | samsung,dw-mshc-ddr-timing = <1 2>; | ||
56 | |||
57 | slot@0 { | ||
58 | reg = <0>; | ||
59 | bus-width = <8>; | ||
60 | }; | ||
61 | }; | ||
62 | |||
63 | regulator_p3v3 { | ||
64 | compatible = "regulator-fixed"; | ||
65 | regulator-name = "p3v3_en"; | ||
66 | regulator-min-microvolt = <3300000>; | ||
67 | regulator-max-microvolt = <3300000>; | ||
68 | gpio = <&gpa1 1 1>; | ||
69 | enable-active-high; | ||
70 | regulator-boot-on; | ||
71 | }; | ||
72 | |||
73 | rtc@10070000 { | ||
74 | status = "okay"; | ||
75 | }; | ||
76 | |||
77 | sdhci@12530000 { | ||
78 | bus-width = <4>; | ||
79 | pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; | ||
80 | pinctrl-names = "default"; | ||
81 | status = "okay"; | ||
82 | }; | ||
83 | |||
84 | serial@13800000 { | ||
85 | status = "okay"; | ||
86 | }; | ||
87 | |||
88 | serial@13810000 { | ||
89 | status = "okay"; | ||
90 | }; | ||
91 | |||
92 | serial@13820000 { | ||
93 | status = "okay"; | ||
94 | }; | ||
95 | |||
96 | serial@13830000 { | ||
97 | status = "okay"; | ||
98 | }; | ||
99 | |||
100 | fixed-rate-clocks { | ||
101 | xxti { | ||
102 | compatible = "samsung,clock-xxti"; | ||
103 | clock-frequency = <0>; | ||
104 | }; | ||
105 | |||
106 | xusbxti { | ||
107 | compatible = "samsung,clock-xusbxti"; | ||
108 | clock-frequency = <24000000>; | ||
109 | }; | ||
110 | }; | ||
111 | }; | ||
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts new file mode 100644 index 000000000000..1fecf7666dc0 --- /dev/null +++ b/arch/arm/boot/dts/exynos4412-origen.dts | |||
@@ -0,0 +1,432 @@ | |||
1 | /* | ||
2 | * Insignal's Exynos4412 based Origen board device tree source | ||
3 | * | ||
4 | * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * Device tree source file for Insignal's Origen board which is based on | ||
8 | * Samsung's Exynos4412 SoC. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | /dts-v1/; | ||
16 | /include/ "exynos4412.dtsi" | ||
17 | |||
18 | / { | ||
19 | model = "Insignal Origen evaluation board based on Exynos4412"; | ||
20 | compatible = "insignal,origen4412", "samsung,exynos4412"; | ||
21 | |||
22 | memory { | ||
23 | reg = <0x40000000 0x40000000>; | ||
24 | }; | ||
25 | |||
26 | chosen { | ||
27 | bootargs ="console=ttySAC2,115200"; | ||
28 | }; | ||
29 | |||
30 | mmc_reg: voltage-regulator { | ||
31 | compatible = "regulator-fixed"; | ||
32 | regulator-name = "VMEM_VDD_2.8V"; | ||
33 | regulator-min-microvolt = <2800000>; | ||
34 | regulator-max-microvolt = <2800000>; | ||
35 | gpio = <&gpx1 1 0>; | ||
36 | enable-active-high; | ||
37 | }; | ||
38 | |||
39 | sdhci@12530000 { | ||
40 | bus-width = <4>; | ||
41 | pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; | ||
42 | pinctrl-names = "default"; | ||
43 | vmmc-supply = <&mmc_reg>; | ||
44 | status = "okay"; | ||
45 | }; | ||
46 | |||
47 | mshc@12550000 { | ||
48 | #address-cells = <1>; | ||
49 | #size-cells = <0>; | ||
50 | pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; | ||
51 | pinctrl-names = "default"; | ||
52 | status = "okay"; | ||
53 | |||
54 | num-slots = <1>; | ||
55 | supports-highspeed; | ||
56 | broken-cd; | ||
57 | fifo-depth = <0x80>; | ||
58 | card-detect-delay = <200>; | ||
59 | samsung,dw-mshc-ciu-div = <3>; | ||
60 | samsung,dw-mshc-sdr-timing = <2 3>; | ||
61 | samsung,dw-mshc-ddr-timing = <1 2>; | ||
62 | |||
63 | slot@0 { | ||
64 | reg = <0>; | ||
65 | bus-width = <8>; | ||
66 | }; | ||
67 | }; | ||
68 | |||
69 | codec@13400000 { | ||
70 | samsung,mfc-r = <0x43000000 0x800000>; | ||
71 | samsung,mfc-l = <0x51000000 0x800000>; | ||
72 | status = "okay"; | ||
73 | }; | ||
74 | |||
75 | serial@13800000 { | ||
76 | status = "okay"; | ||
77 | }; | ||
78 | |||
79 | serial@13810000 { | ||
80 | status = "okay"; | ||
81 | }; | ||
82 | |||
83 | serial@13820000 { | ||
84 | status = "okay"; | ||
85 | }; | ||
86 | |||
87 | serial@13830000 { | ||
88 | status = "okay"; | ||
89 | }; | ||
90 | |||
91 | i2c@13860000 { | ||
92 | #address-cells = <1>; | ||
93 | #size-cells = <0>; | ||
94 | samsung,i2c-sda-delay = <100>; | ||
95 | samsung,i2c-max-bus-freq = <20000>; | ||
96 | pinctrl-0 = <&i2c0_bus>; | ||
97 | pinctrl-names = "default"; | ||
98 | status = "okay"; | ||
99 | |||
100 | s5m8767_pmic@66 { | ||
101 | compatible = "samsung,s5m8767-pmic"; | ||
102 | reg = <0x66>; | ||
103 | |||
104 | s5m8767,pmic-buck-default-dvs-idx = <3>; | ||
105 | |||
106 | s5m8767,pmic-buck-dvs-gpios = <&gpx2 3 0>, | ||
107 | <&gpx2 4 0>, | ||
108 | <&gpx2 5 0>; | ||
109 | |||
110 | s5m8767,pmic-buck-ds-gpios = <&gpm3 5 0>, | ||
111 | <&gpm3 6 0>, | ||
112 | <&gpm3 7 0>; | ||
113 | |||
114 | s5m8767,pmic-buck2-dvs-voltage = <1250000>, <1200000>, | ||
115 | <1200000>, <1200000>, | ||
116 | <1200000>, <1200000>, | ||
117 | <1200000>, <1200000>; | ||
118 | |||
119 | s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>, | ||
120 | <1100000>, <1100000>, | ||
121 | <1100000>, <1100000>, | ||
122 | <1100000>, <1100000>; | ||
123 | |||
124 | s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>, | ||
125 | <1200000>, <1200000>, | ||
126 | <1200000>, <1200000>, | ||
127 | <1200000>, <1200000>; | ||
128 | |||
129 | regulators { | ||
130 | ldo1_reg: LDO1 { | ||
131 | regulator-name = "VDD_ALIVE"; | ||
132 | regulator-min-microvolt = <1100000>; | ||
133 | regulator-max-microvolt = <1100000>; | ||
134 | regulator-always-on; | ||
135 | regulator-boot-on; | ||
136 | op_mode = <1>; /* Normal Mode */ | ||
137 | }; | ||
138 | |||
139 | ldo2_reg: LDO2 { | ||
140 | regulator-name = "VDDQ_M12"; | ||
141 | regulator-min-microvolt = <1200000>; | ||
142 | regulator-max-microvolt = <1200000>; | ||
143 | regulator-always-on; | ||
144 | op_mode = <1>; /* Normal Mode */ | ||
145 | }; | ||
146 | |||
147 | ldo3_reg: LDO3 { | ||
148 | regulator-name = "VDDIOAP_18"; | ||
149 | regulator-min-microvolt = <1800000>; | ||
150 | regulator-max-microvolt = <1800000>; | ||
151 | regulator-always-on; | ||
152 | op_mode = <1>; /* Normal Mode */ | ||
153 | }; | ||
154 | |||
155 | ldo4_reg: LDO4 { | ||
156 | regulator-name = "VDDQ_PRE"; | ||
157 | regulator-min-microvolt = <1800000>; | ||
158 | regulator-max-microvolt = <1800000>; | ||
159 | regulator-always-on; | ||
160 | op_mode = <1>; /* Normal Mode */ | ||
161 | }; | ||
162 | |||
163 | ldo5_reg: LDO5 { | ||
164 | regulator-name = "VDD18_2M"; | ||
165 | regulator-min-microvolt = <1800000>; | ||
166 | regulator-max-microvolt = <1800000>; | ||
167 | regulator-always-on; | ||
168 | op_mode = <1>; /* Normal Mode */ | ||
169 | }; | ||
170 | |||
171 | ldo6_reg: LDO6 { | ||
172 | regulator-name = "VDD10_MPLL"; | ||
173 | regulator-min-microvolt = <1000000>; | ||
174 | regulator-max-microvolt = <1000000>; | ||
175 | regulator-always-on; | ||
176 | op_mode = <1>; /* Normal Mode */ | ||
177 | }; | ||
178 | |||
179 | ldo7_reg: LDO7 { | ||
180 | regulator-name = "VDD10_XPLL"; | ||
181 | regulator-min-microvolt = <1000000>; | ||
182 | regulator-max-microvolt = <1000000>; | ||
183 | regulator-always-on; | ||
184 | op_mode = <1>; /* Normal Mode */ | ||
185 | }; | ||
186 | |||
187 | ldo8_reg: LDO8 { | ||
188 | regulator-name = "VDD10_MIPI"; | ||
189 | regulator-min-microvolt = <1000000>; | ||
190 | regulator-max-microvolt = <1000000>; | ||
191 | regulator-always-on; | ||
192 | op_mode = <1>; /* Normal Mode */ | ||
193 | }; | ||
194 | |||
195 | ldo9_reg: LDO9 { | ||
196 | regulator-name = "VDD33_LCD"; | ||
197 | regulator-min-microvolt = <3300000>; | ||
198 | regulator-max-microvolt = <3300000>; | ||
199 | regulator-always-on; | ||
200 | op_mode = <1>; /* Normal Mode */ | ||
201 | }; | ||
202 | |||
203 | ldo10_reg: LDO10 { | ||
204 | regulator-name = "VDD18_MIPI"; | ||
205 | regulator-min-microvolt = <1800000>; | ||
206 | regulator-max-microvolt = <1800000>; | ||
207 | regulator-always-on; | ||
208 | op_mode = <1>; /* Normal Mode */ | ||
209 | }; | ||
210 | |||
211 | ldo11_reg: LDO11 { | ||
212 | regulator-name = "VDD18_ABB1"; | ||
213 | regulator-min-microvolt = <1800000>; | ||
214 | regulator-max-microvolt = <1800000>; | ||
215 | regulator-always-on; | ||
216 | op_mode = <1>; /* Normal Mode */ | ||
217 | }; | ||
218 | |||
219 | ldo12_reg: LDO12 { | ||
220 | regulator-name = "VDD33_UOTG"; | ||
221 | regulator-min-microvolt = <3300000>; | ||
222 | regulator-max-microvolt = <3300000>; | ||
223 | regulator-always-on; | ||
224 | op_mode = <1>; /* Normal Mode */ | ||
225 | }; | ||
226 | |||
227 | ldo13_reg: LDO13 { | ||
228 | regulator-name = "VDDIOPERI_18"; | ||
229 | regulator-min-microvolt = <1800000>; | ||
230 | regulator-max-microvolt = <1800000>; | ||
231 | regulator-always-on; | ||
232 | op_mode = <1>; /* Normal Mode */ | ||
233 | }; | ||
234 | |||
235 | ldo14_reg: LDO14 { | ||
236 | regulator-name = "VDD18_ABB02"; | ||
237 | regulator-min-microvolt = <1800000>; | ||
238 | regulator-max-microvolt = <1800000>; | ||
239 | regulator-always-on; | ||
240 | op_mode = <1>; /* Normal Mode */ | ||
241 | }; | ||
242 | |||
243 | ldo15_reg: LDO15 { | ||
244 | regulator-name = "VDD10_USH"; | ||
245 | regulator-min-microvolt = <1000000>; | ||
246 | regulator-max-microvolt = <1000000>; | ||
247 | regulator-always-on; | ||
248 | op_mode = <1>; /* Normal Mode */ | ||
249 | }; | ||
250 | |||
251 | ldo16_reg: LDO16 { | ||
252 | regulator-name = "VDD18_HSIC"; | ||
253 | regulator-min-microvolt = <1800000>; | ||
254 | regulator-max-microvolt = <1800000>; | ||
255 | regulator-always-on; | ||
256 | op_mode = <1>; /* Normal Mode */ | ||
257 | }; | ||
258 | |||
259 | ldo17_reg: LDO17 { | ||
260 | regulator-name = "VDDIOAP_MMC012_28"; | ||
261 | regulator-min-microvolt = <2800000>; | ||
262 | regulator-max-microvolt = <2800000>; | ||
263 | regulator-always-on; | ||
264 | op_mode = <1>; /* Normal Mode */ | ||
265 | }; | ||
266 | |||
267 | ldo18_reg: LDO18 { | ||
268 | regulator-name = "VDDIOPERI_28"; | ||
269 | regulator-min-microvolt = <2800000>; | ||
270 | regulator-max-microvolt = <2800000>; | ||
271 | regulator-always-on; | ||
272 | op_mode = <1>; /* Normal Mode */ | ||
273 | }; | ||
274 | |||
275 | ldo19_reg: LDO19 { | ||
276 | regulator-name = "DVDD25"; | ||
277 | regulator-min-microvolt = <2500000>; | ||
278 | regulator-max-microvolt = <2500000>; | ||
279 | regulator-always-on; | ||
280 | op_mode = <1>; /* Normal Mode */ | ||
281 | }; | ||
282 | |||
283 | ldo20_reg: LDO20 { | ||
284 | regulator-name = "VDD28_CAM"; | ||
285 | regulator-min-microvolt = <2800000>; | ||
286 | regulator-max-microvolt = <2800000>; | ||
287 | regulator-always-on; | ||
288 | op_mode = <1>; /* Normal Mode */ | ||
289 | }; | ||
290 | |||
291 | ldo21_reg: LDO21 { | ||
292 | regulator-name = "VDD28_AF"; | ||
293 | regulator-min-microvolt = <2800000>; | ||
294 | regulator-max-microvolt = <2800000>; | ||
295 | regulator-always-on; | ||
296 | op_mode = <1>; /* Normal Mode */ | ||
297 | }; | ||
298 | |||
299 | ldo22_reg: LDO22 { | ||
300 | regulator-name = "VDDA28_2M"; | ||
301 | regulator-min-microvolt = <2800000>; | ||
302 | regulator-max-microvolt = <2800000>; | ||
303 | regulator-always-on; | ||
304 | op_mode = <1>; /* Normal Mode */ | ||
305 | }; | ||
306 | |||
307 | ldo23_reg: LDO23 { | ||
308 | regulator-name = "VDD28_TF"; | ||
309 | regulator-min-microvolt = <2800000>; | ||
310 | regulator-max-microvolt = <2800000>; | ||
311 | regulator-always-on; | ||
312 | op_mode = <1>; /* Normal Mode */ | ||
313 | }; | ||
314 | |||
315 | ldo24_reg: LDO24 { | ||
316 | regulator-name = "VDD33_A31"; | ||
317 | regulator-min-microvolt = <3300000>; | ||
318 | regulator-max-microvolt = <3300000>; | ||
319 | regulator-always-on; | ||
320 | op_mode = <1>; /* Normal Mode */ | ||
321 | }; | ||
322 | |||
323 | ldo25_reg: LDO25 { | ||
324 | regulator-name = "VDD18_CAM"; | ||
325 | regulator-min-microvolt = <1800000>; | ||
326 | regulator-max-microvolt = <1800000>; | ||
327 | regulator-always-on; | ||
328 | op_mode = <1>; /* Normal Mode */ | ||
329 | }; | ||
330 | |||
331 | ldo26_reg: LDO26 { | ||
332 | regulator-name = "VDD18_A31"; | ||
333 | regulator-min-microvolt = <1800000>; | ||
334 | regulator-max-microvolt = <1800000>; | ||
335 | regulator-always-on; | ||
336 | op_mode = <1>; /* Normal Mode */ | ||
337 | }; | ||
338 | |||
339 | ldo27_reg: LDO27 { | ||
340 | regulator-name = "GPS_1V8"; | ||
341 | regulator-min-microvolt = <1800000>; | ||
342 | regulator-max-microvolt = <1800000>; | ||
343 | regulator-always-on; | ||
344 | op_mode = <1>; /* Normal Mode */ | ||
345 | }; | ||
346 | |||
347 | ldo28_reg: LDO28 { | ||
348 | regulator-name = "DVDD12"; | ||
349 | regulator-min-microvolt = <1200000>; | ||
350 | regulator-max-microvolt = <1200000>; | ||
351 | regulator-always-on; | ||
352 | op_mode = <1>; /* Normal Mode */ | ||
353 | }; | ||
354 | |||
355 | buck1_reg: BUCK1 { | ||
356 | regulator-name = "vdd_mif"; | ||
357 | regulator-min-microvolt = <950000>; | ||
358 | regulator-max-microvolt = <1100000>; | ||
359 | regulator-always-on; | ||
360 | regulator-boot-on; | ||
361 | op_mode = <1>; /* Normal Mode */ | ||
362 | }; | ||
363 | |||
364 | buck2_reg: BUCK2 { | ||
365 | regulator-name = "vdd_arm"; | ||
366 | regulator-min-microvolt = <925000>; | ||
367 | regulator-max-microvolt = <1300000>; | ||
368 | regulator-always-on; | ||
369 | regulator-boot-on; | ||
370 | op_mode = <1>; /* Normal Mode */ | ||
371 | }; | ||
372 | |||
373 | buck3_reg: BUCK3 { | ||
374 | regulator-name = "vdd_int"; | ||
375 | regulator-min-microvolt = <900000>; | ||
376 | regulator-max-microvolt = <1200000>; | ||
377 | regulator-always-on; | ||
378 | regulator-boot-on; | ||
379 | op_mode = <1>; /* Normal Mode */ | ||
380 | }; | ||
381 | |||
382 | buck4_reg: BUCK4 { | ||
383 | regulator-name = "vdd_g3d"; | ||
384 | regulator-min-microvolt = <750000>; | ||
385 | regulator-max-microvolt = <1500000>; | ||
386 | regulator-always-on; | ||
387 | regulator-boot-on; | ||
388 | op_mode = <1>; /* Normal Mode */ | ||
389 | }; | ||
390 | |||
391 | buck5_reg: BUCK5 { | ||
392 | regulator-name = "vdd_m12"; | ||
393 | regulator-min-microvolt = <750000>; | ||
394 | regulator-max-microvolt = <1500000>; | ||
395 | regulator-always-on; | ||
396 | regulator-boot-on; | ||
397 | op_mode = <1>; /* Normal Mode */ | ||
398 | }; | ||
399 | |||
400 | buck6_reg: BUCK6 { | ||
401 | regulator-name = "vdd12_5m"; | ||
402 | regulator-min-microvolt = <750000>; | ||
403 | regulator-max-microvolt = <1500000>; | ||
404 | regulator-always-on; | ||
405 | regulator-boot-on; | ||
406 | op_mode = <1>; /* Normal Mode */ | ||
407 | }; | ||
408 | |||
409 | buck9_reg: BUCK9 { | ||
410 | regulator-name = "vddf28_emmc"; | ||
411 | regulator-min-microvolt = <750000>; | ||
412 | regulator-max-microvolt = <3000000>; | ||
413 | regulator-always-on; | ||
414 | regulator-boot-on; | ||
415 | op_mode = <1>; /* Normal Mode */ | ||
416 | }; | ||
417 | }; | ||
418 | }; | ||
419 | }; | ||
420 | |||
421 | fixed-rate-clocks { | ||
422 | xxti { | ||
423 | compatible = "samsung,clock-xxti"; | ||
424 | clock-frequency = <0>; | ||
425 | }; | ||
426 | |||
427 | xusbxti { | ||
428 | compatible = "samsung,clock-xusbxti"; | ||
429 | clock-frequency = <24000000>; | ||
430 | }; | ||
431 | }; | ||
432 | }; | ||
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts index f05bf575cc45..874beeaef99d 100644 --- a/arch/arm/boot/dts/exynos4412-smdk4412.dts +++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts | |||
@@ -27,6 +27,19 @@ | |||
27 | bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; | 27 | bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | sdhci@12530000 { | ||
31 | bus-width = <4>; | ||
32 | pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; | ||
33 | pinctrl-names = "default"; | ||
34 | status = "okay"; | ||
35 | }; | ||
36 | |||
37 | codec@13400000 { | ||
38 | samsung,mfc-r = <0x43000000 0x800000>; | ||
39 | samsung,mfc-l = <0x51000000 0x800000>; | ||
40 | status = "okay"; | ||
41 | }; | ||
42 | |||
30 | serial@13800000 { | 43 | serial@13800000 { |
31 | status = "okay"; | 44 | status = "okay"; |
32 | }; | 45 | }; |
@@ -42,4 +55,16 @@ | |||
42 | serial@13830000 { | 55 | serial@13830000 { |
43 | status = "okay"; | 56 | status = "okay"; |
44 | }; | 57 | }; |
58 | |||
59 | fixed-rate-clocks { | ||
60 | xxti { | ||
61 | compatible = "samsung,clock-xxti"; | ||
62 | clock-frequency = <0>; | ||
63 | }; | ||
64 | |||
65 | xusbxti { | ||
66 | compatible = "samsung,clock-xusbxti"; | ||
67 | clock-frequency = <24000000>; | ||
68 | }; | ||
69 | }; | ||
45 | }; | 70 | }; |
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi index d7dfe312772a..d75c047e80a9 100644 --- a/arch/arm/boot/dts/exynos4412.dtsi +++ b/arch/arm/boot/dts/exynos4412.dtsi | |||
@@ -25,4 +25,30 @@ | |||
25 | gic:interrupt-controller@10490000 { | 25 | gic:interrupt-controller@10490000 { |
26 | cpu-offset = <0x4000>; | 26 | cpu-offset = <0x4000>; |
27 | }; | 27 | }; |
28 | |||
29 | mct@10050000 { | ||
30 | compatible = "samsung,exynos4412-mct"; | ||
31 | reg = <0x10050000 0x800>; | ||
32 | interrupt-controller; | ||
33 | #interrups-cells = <2>; | ||
34 | interrupt-parent = <&mct_map>; | ||
35 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
36 | <4 0>, <5 0>, <6 0>, <7 0>; | ||
37 | clocks = <&clock 3>, <&clock 344>; | ||
38 | clock-names = "fin_pll", "mct"; | ||
39 | |||
40 | mct_map: mct-map { | ||
41 | #interrupt-cells = <2>; | ||
42 | #address-cells = <0>; | ||
43 | #size-cells = <0>; | ||
44 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
45 | <0x1 0 &combiner 12 5>, | ||
46 | <0x2 0 &combiner 12 6>, | ||
47 | <0x3 0 &combiner 12 7>, | ||
48 | <0x4 0 &gic 1 12 0>, | ||
49 | <0x5 0 &gic 1 12 0>, | ||
50 | <0x6 0 &gic 1 12 0>, | ||
51 | <0x7 0 &gic 1 12 0>; | ||
52 | }; | ||
53 | }; | ||
28 | }; | 54 | }; |
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi index 9a8780694909..7496b8d633ea 100644 --- a/arch/arm/boot/dts/exynos4x12.dtsi +++ b/arch/arm/boot/dts/exynos4x12.dtsi | |||
@@ -36,6 +36,12 @@ | |||
36 | <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>; | 36 | <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | clock: clock-controller@0x10030000 { | ||
40 | compatible = "samsung,exynos4412-clock"; | ||
41 | reg = <0x10030000 0x20000>; | ||
42 | #clock-cells = <1>; | ||
43 | }; | ||
44 | |||
39 | pinctrl_0: pinctrl@11400000 { | 45 | pinctrl_0: pinctrl@11400000 { |
40 | compatible = "samsung,exynos4x12-pinctrl"; | 46 | compatible = "samsung,exynos4x12-pinctrl"; |
41 | reg = <0x11400000 0x1000>; | 47 | reg = <0x11400000 0x1000>; |
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts new file mode 100644 index 000000000000..5de019cb0e58 --- /dev/null +++ b/arch/arm/boot/dts/exynos5250-arndale.dts | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Samsung's Exynos5250 based Arndale board device tree source | ||
3 | * | ||
4 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
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 | /dts-v1/; | ||
13 | /include/ "exynos5250.dtsi" | ||
14 | |||
15 | / { | ||
16 | model = "Insignal Arndale evaluation board based on EXYNOS5250"; | ||
17 | compatible = "insignal,arndale", "samsung,exynos5250"; | ||
18 | |||
19 | memory { | ||
20 | reg = <0x40000000 0x80000000>; | ||
21 | }; | ||
22 | |||
23 | chosen { | ||
24 | bootargs = "console=ttySAC2,115200"; | ||
25 | }; | ||
26 | |||
27 | i2c@12C60000 { | ||
28 | status = "disabled"; | ||
29 | }; | ||
30 | |||
31 | i2c@12C70000 { | ||
32 | status = "disabled"; | ||
33 | }; | ||
34 | |||
35 | i2c@12C80000 { | ||
36 | status = "disabled"; | ||
37 | }; | ||
38 | |||
39 | i2c@12C90000 { | ||
40 | status = "disabled"; | ||
41 | }; | ||
42 | |||
43 | i2c@12CA0000 { | ||
44 | status = "disabled"; | ||
45 | }; | ||
46 | |||
47 | i2c@12CB0000 { | ||
48 | status = "disabled"; | ||
49 | }; | ||
50 | |||
51 | i2c@12CC0000 { | ||
52 | status = "disabled"; | ||
53 | }; | ||
54 | |||
55 | i2c@12CD0000 { | ||
56 | status = "disabled"; | ||
57 | }; | ||
58 | |||
59 | i2c@121D0000 { | ||
60 | status = "disabled"; | ||
61 | }; | ||
62 | |||
63 | dwmmc_0: dwmmc0@12200000 { | ||
64 | num-slots = <1>; | ||
65 | supports-highspeed; | ||
66 | broken-cd; | ||
67 | fifo-depth = <0x80>; | ||
68 | card-detect-delay = <200>; | ||
69 | samsung,dw-mshc-ciu-div = <3>; | ||
70 | samsung,dw-mshc-sdr-timing = <2 3>; | ||
71 | samsung,dw-mshc-ddr-timing = <1 2>; | ||
72 | |||
73 | slot@0 { | ||
74 | reg = <0>; | ||
75 | bus-width = <8>; | ||
76 | gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>, | ||
77 | <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>, | ||
78 | <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>, | ||
79 | <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>, | ||
80 | <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>; | ||
81 | }; | ||
82 | }; | ||
83 | |||
84 | dwmmc_1: dwmmc1@12210000 { | ||
85 | status = "disabled"; | ||
86 | }; | ||
87 | |||
88 | dwmmc_2: dwmmc2@12220000 { | ||
89 | num-slots = <1>; | ||
90 | supports-highspeed; | ||
91 | fifo-depth = <0x80>; | ||
92 | card-detect-delay = <200>; | ||
93 | samsung,dw-mshc-ciu-div = <3>; | ||
94 | samsung,dw-mshc-sdr-timing = <2 3>; | ||
95 | samsung,dw-mshc-ddr-timing = <1 2>; | ||
96 | |||
97 | slot@0 { | ||
98 | reg = <0>; | ||
99 | bus-width = <4>; | ||
100 | samsung,cd-pinmux-gpio = <&gpc3 2 2 3 3>; | ||
101 | gpios = <&gpc3 0 2 0 3>, <&gpc3 1 2 0 3>, | ||
102 | <&gpc3 3 2 3 3>, <&gpc3 4 2 3 3>, | ||
103 | <&gpc3 5 2 3 3>, <&gpc3 6 2 3 3>; | ||
104 | }; | ||
105 | }; | ||
106 | |||
107 | dwmmc_3: dwmmc3@12230000 { | ||
108 | status = "disabled"; | ||
109 | }; | ||
110 | |||
111 | spi_0: spi@12d20000 { | ||
112 | status = "disabled"; | ||
113 | }; | ||
114 | |||
115 | spi_1: spi@12d30000 { | ||
116 | status = "disabled"; | ||
117 | }; | ||
118 | |||
119 | spi_2: spi@12d40000 { | ||
120 | status = "disabled"; | ||
121 | }; | ||
122 | |||
123 | fixed-rate-clocks { | ||
124 | xxti { | ||
125 | compatible = "samsung,clock-xxti"; | ||
126 | clock-frequency = <24000000>; | ||
127 | }; | ||
128 | }; | ||
129 | }; | ||
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 1b8d4106d338..872ae1f93c75 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts | |||
@@ -231,4 +231,24 @@ | |||
231 | samsung,i2s-controller = <&i2s0>; | 231 | samsung,i2s-controller = <&i2s0>; |
232 | samsung,audio-codec = <&wm8994>; | 232 | samsung,audio-codec = <&wm8994>; |
233 | }; | 233 | }; |
234 | |||
235 | usb@12110000 { | ||
236 | samsung,vbus-gpio = <&gpx2 6 1 3 3>; | ||
237 | }; | ||
238 | |||
239 | dp-controller { | ||
240 | samsung,color-space = <0>; | ||
241 | samsung,dynamic-range = <0>; | ||
242 | samsung,ycbcr-coeff = <0>; | ||
243 | samsung,color-depth = <1>; | ||
244 | samsung,link-rate = <0x0a>; | ||
245 | samsung,lane-count = <4>; | ||
246 | }; | ||
247 | |||
248 | fixed-rate-clocks { | ||
249 | xxti { | ||
250 | compatible = "samsung,clock-xxti"; | ||
251 | clock-frequency = <24000000>; | ||
252 | }; | ||
253 | }; | ||
234 | }; | 254 | }; |
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index 17dd951c1cd2..babd9f9b1bf9 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts | |||
@@ -40,4 +40,15 @@ | |||
40 | <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>; | 40 | <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>; |
41 | }; | 41 | }; |
42 | }; | 42 | }; |
43 | |||
44 | usb@12110000 { | ||
45 | samsung,vbus-gpio = <&gpx1 1 1 3 3>; | ||
46 | }; | ||
47 | |||
48 | fixed-rate-clocks { | ||
49 | xxti { | ||
50 | compatible = "samsung,clock-xxti"; | ||
51 | clock-frequency = <24000000>; | ||
52 | }; | ||
53 | }; | ||
43 | }; | 54 | }; |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index b1ac73e21c80..28758e5dd15c 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -46,6 +46,22 @@ | |||
46 | i2c8 = &i2c_8; | 46 | i2c8 = &i2c_8; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | pd_gsc: gsc-power-domain@0x10044000 { | ||
50 | compatible = "samsung,exynos4210-pd"; | ||
51 | reg = <0x10044000 0x20>; | ||
52 | }; | ||
53 | |||
54 | pd_mfc: mfc-power-domain@0x10044040 { | ||
55 | compatible = "samsung,exynos4210-pd"; | ||
56 | reg = <0x10044040 0x20>; | ||
57 | }; | ||
58 | |||
59 | clock: clock-controller@0x10010000 { | ||
60 | compatible = "samsung,exynos5250-clock"; | ||
61 | reg = <0x10010000 0x30000>; | ||
62 | #clock-cells = <1>; | ||
63 | }; | ||
64 | |||
49 | gic:interrupt-controller@10481000 { | 65 | gic:interrupt-controller@10481000 { |
50 | compatible = "arm,cortex-a9-gic"; | 66 | compatible = "arm,cortex-a9-gic"; |
51 | #interrupt-cells = <3>; | 67 | #interrupt-cells = <3>; |
@@ -69,58 +85,106 @@ | |||
69 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; | 85 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; |
70 | }; | 86 | }; |
71 | 87 | ||
88 | mct@101C0000 { | ||
89 | compatible = "samsung,exynos4210-mct"; | ||
90 | reg = <0x101C0000 0x800>; | ||
91 | interrupt-controller; | ||
92 | #interrups-cells = <2>; | ||
93 | interrupt-parent = <&mct_map>; | ||
94 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
95 | <4 0>, <5 0>; | ||
96 | clocks = <&clock 1>, <&clock 335>; | ||
97 | clock-names = "fin_pll", "mct"; | ||
98 | |||
99 | mct_map: mct-map { | ||
100 | #interrupt-cells = <2>; | ||
101 | #address-cells = <0>; | ||
102 | #size-cells = <0>; | ||
103 | interrupt-map = <0x0 0 &combiner 23 3>, | ||
104 | <0x1 0 &combiner 23 4>, | ||
105 | <0x2 0 &combiner 25 2>, | ||
106 | <0x3 0 &combiner 25 3>, | ||
107 | <0x4 0 &gic 0 120 0>, | ||
108 | <0x5 0 &gic 0 121 0>; | ||
109 | }; | ||
110 | }; | ||
111 | |||
112 | pmu { | ||
113 | compatible = "arm,cortex-a15-pmu"; | ||
114 | interrupt-parent = <&combiner>; | ||
115 | interrupts = <1 2>, <22 4>; | ||
116 | }; | ||
117 | |||
72 | watchdog { | 118 | watchdog { |
73 | compatible = "samsung,s3c2410-wdt"; | 119 | compatible = "samsung,s3c2410-wdt"; |
74 | reg = <0x101D0000 0x100>; | 120 | reg = <0x101D0000 0x100>; |
75 | interrupts = <0 42 0>; | 121 | interrupts = <0 42 0>; |
122 | clocks = <&clock 336>; | ||
123 | clock-names = "watchdog"; | ||
76 | }; | 124 | }; |
77 | 125 | ||
78 | codec@11000000 { | 126 | codec@11000000 { |
79 | compatible = "samsung,mfc-v6"; | 127 | compatible = "samsung,mfc-v6"; |
80 | reg = <0x11000000 0x10000>; | 128 | reg = <0x11000000 0x10000>; |
81 | interrupts = <0 96 0>; | 129 | interrupts = <0 96 0>; |
130 | samsung,power-domain = <&pd_mfc>; | ||
82 | }; | 131 | }; |
83 | 132 | ||
84 | rtc { | 133 | rtc { |
85 | compatible = "samsung,s3c6410-rtc"; | 134 | compatible = "samsung,s3c6410-rtc"; |
86 | reg = <0x101E0000 0x100>; | 135 | reg = <0x101E0000 0x100>; |
87 | interrupts = <0 43 0>, <0 44 0>; | 136 | interrupts = <0 43 0>, <0 44 0>; |
137 | clocks = <&clock 337>; | ||
138 | clock-names = "rtc"; | ||
139 | status = "disabled"; | ||
88 | }; | 140 | }; |
89 | 141 | ||
90 | tmu@10060000 { | 142 | tmu@10060000 { |
91 | compatible = "samsung,exynos5250-tmu"; | 143 | compatible = "samsung,exynos5250-tmu"; |
92 | reg = <0x10060000 0x100>; | 144 | reg = <0x10060000 0x100>; |
93 | interrupts = <0 65 0>; | 145 | interrupts = <0 65 0>; |
146 | clocks = <&clock 338>; | ||
147 | clock-names = "tmu_apbif"; | ||
94 | }; | 148 | }; |
95 | 149 | ||
96 | serial@12C00000 { | 150 | serial@12C00000 { |
97 | compatible = "samsung,exynos4210-uart"; | 151 | compatible = "samsung,exynos4210-uart"; |
98 | reg = <0x12C00000 0x100>; | 152 | reg = <0x12C00000 0x100>; |
99 | interrupts = <0 51 0>; | 153 | interrupts = <0 51 0>; |
154 | clocks = <&clock 289>, <&clock 146>; | ||
155 | clock-names = "uart", "clk_uart_baud0"; | ||
100 | }; | 156 | }; |
101 | 157 | ||
102 | serial@12C10000 { | 158 | serial@12C10000 { |
103 | compatible = "samsung,exynos4210-uart"; | 159 | compatible = "samsung,exynos4210-uart"; |
104 | reg = <0x12C10000 0x100>; | 160 | reg = <0x12C10000 0x100>; |
105 | interrupts = <0 52 0>; | 161 | interrupts = <0 52 0>; |
162 | clocks = <&clock 290>, <&clock 147>; | ||
163 | clock-names = "uart", "clk_uart_baud0"; | ||
106 | }; | 164 | }; |
107 | 165 | ||
108 | serial@12C20000 { | 166 | serial@12C20000 { |
109 | compatible = "samsung,exynos4210-uart"; | 167 | compatible = "samsung,exynos4210-uart"; |
110 | reg = <0x12C20000 0x100>; | 168 | reg = <0x12C20000 0x100>; |
111 | interrupts = <0 53 0>; | 169 | interrupts = <0 53 0>; |
170 | clocks = <&clock 291>, <&clock 148>; | ||
171 | clock-names = "uart", "clk_uart_baud0"; | ||
112 | }; | 172 | }; |
113 | 173 | ||
114 | serial@12C30000 { | 174 | serial@12C30000 { |
115 | compatible = "samsung,exynos4210-uart"; | 175 | compatible = "samsung,exynos4210-uart"; |
116 | reg = <0x12C30000 0x100>; | 176 | reg = <0x12C30000 0x100>; |
117 | interrupts = <0 54 0>; | 177 | interrupts = <0 54 0>; |
178 | clocks = <&clock 292>, <&clock 149>; | ||
179 | clock-names = "uart", "clk_uart_baud0"; | ||
118 | }; | 180 | }; |
119 | 181 | ||
120 | sata@122F0000 { | 182 | sata@122F0000 { |
121 | compatible = "samsung,exynos5-sata-ahci"; | 183 | compatible = "samsung,exynos5-sata-ahci"; |
122 | reg = <0x122F0000 0x1ff>; | 184 | reg = <0x122F0000 0x1ff>; |
123 | interrupts = <0 115 0>; | 185 | interrupts = <0 115 0>; |
186 | clocks = <&clock 277>, <&clock 143>; | ||
187 | clock-names = "sata", "sclk_sata"; | ||
124 | }; | 188 | }; |
125 | 189 | ||
126 | sata-phy@12170000 { | 190 | sata-phy@12170000 { |
@@ -134,6 +198,8 @@ | |||
134 | interrupts = <0 56 0>; | 198 | interrupts = <0 56 0>; |
135 | #address-cells = <1>; | 199 | #address-cells = <1>; |
136 | #size-cells = <0>; | 200 | #size-cells = <0>; |
201 | clocks = <&clock 294>; | ||
202 | clock-names = "i2c"; | ||
137 | }; | 203 | }; |
138 | 204 | ||
139 | i2c_1: i2c@12C70000 { | 205 | i2c_1: i2c@12C70000 { |
@@ -142,6 +208,8 @@ | |||
142 | interrupts = <0 57 0>; | 208 | interrupts = <0 57 0>; |
143 | #address-cells = <1>; | 209 | #address-cells = <1>; |
144 | #size-cells = <0>; | 210 | #size-cells = <0>; |
211 | clocks = <&clock 295>; | ||
212 | clock-names = "i2c"; | ||
145 | }; | 213 | }; |
146 | 214 | ||
147 | i2c_2: i2c@12C80000 { | 215 | i2c_2: i2c@12C80000 { |
@@ -150,6 +218,8 @@ | |||
150 | interrupts = <0 58 0>; | 218 | interrupts = <0 58 0>; |
151 | #address-cells = <1>; | 219 | #address-cells = <1>; |
152 | #size-cells = <0>; | 220 | #size-cells = <0>; |
221 | clocks = <&clock 296>; | ||
222 | clock-names = "i2c"; | ||
153 | }; | 223 | }; |
154 | 224 | ||
155 | i2c_3: i2c@12C90000 { | 225 | i2c_3: i2c@12C90000 { |
@@ -158,6 +228,8 @@ | |||
158 | interrupts = <0 59 0>; | 228 | interrupts = <0 59 0>; |
159 | #address-cells = <1>; | 229 | #address-cells = <1>; |
160 | #size-cells = <0>; | 230 | #size-cells = <0>; |
231 | clocks = <&clock 297>; | ||
232 | clock-names = "i2c"; | ||
161 | }; | 233 | }; |
162 | 234 | ||
163 | i2c_4: i2c@12CA0000 { | 235 | i2c_4: i2c@12CA0000 { |
@@ -166,6 +238,8 @@ | |||
166 | interrupts = <0 60 0>; | 238 | interrupts = <0 60 0>; |
167 | #address-cells = <1>; | 239 | #address-cells = <1>; |
168 | #size-cells = <0>; | 240 | #size-cells = <0>; |
241 | clocks = <&clock 298>; | ||
242 | clock-names = "i2c"; | ||
169 | }; | 243 | }; |
170 | 244 | ||
171 | i2c_5: i2c@12CB0000 { | 245 | i2c_5: i2c@12CB0000 { |
@@ -174,6 +248,8 @@ | |||
174 | interrupts = <0 61 0>; | 248 | interrupts = <0 61 0>; |
175 | #address-cells = <1>; | 249 | #address-cells = <1>; |
176 | #size-cells = <0>; | 250 | #size-cells = <0>; |
251 | clocks = <&clock 299>; | ||
252 | clock-names = "i2c"; | ||
177 | }; | 253 | }; |
178 | 254 | ||
179 | i2c_6: i2c@12CC0000 { | 255 | i2c_6: i2c@12CC0000 { |
@@ -182,6 +258,8 @@ | |||
182 | interrupts = <0 62 0>; | 258 | interrupts = <0 62 0>; |
183 | #address-cells = <1>; | 259 | #address-cells = <1>; |
184 | #size-cells = <0>; | 260 | #size-cells = <0>; |
261 | clocks = <&clock 300>; | ||
262 | clock-names = "i2c"; | ||
185 | }; | 263 | }; |
186 | 264 | ||
187 | i2c_7: i2c@12CD0000 { | 265 | i2c_7: i2c@12CD0000 { |
@@ -190,6 +268,8 @@ | |||
190 | interrupts = <0 63 0>; | 268 | interrupts = <0 63 0>; |
191 | #address-cells = <1>; | 269 | #address-cells = <1>; |
192 | #size-cells = <0>; | 270 | #size-cells = <0>; |
271 | clocks = <&clock 301>; | ||
272 | clock-names = "i2c"; | ||
193 | }; | 273 | }; |
194 | 274 | ||
195 | i2c_8: i2c@12CE0000 { | 275 | i2c_8: i2c@12CE0000 { |
@@ -198,6 +278,8 @@ | |||
198 | interrupts = <0 64 0>; | 278 | interrupts = <0 64 0>; |
199 | #address-cells = <1>; | 279 | #address-cells = <1>; |
200 | #size-cells = <0>; | 280 | #size-cells = <0>; |
281 | clocks = <&clock 302>; | ||
282 | clock-names = "i2c"; | ||
201 | }; | 283 | }; |
202 | 284 | ||
203 | i2c@121D0000 { | 285 | i2c@121D0000 { |
@@ -205,6 +287,8 @@ | |||
205 | reg = <0x121D0000 0x100>; | 287 | reg = <0x121D0000 0x100>; |
206 | #address-cells = <1>; | 288 | #address-cells = <1>; |
207 | #size-cells = <0>; | 289 | #size-cells = <0>; |
290 | clocks = <&clock 288>; | ||
291 | clock-names = "i2c"; | ||
208 | }; | 292 | }; |
209 | 293 | ||
210 | spi_0: spi@12d20000 { | 294 | spi_0: spi@12d20000 { |
@@ -216,6 +300,8 @@ | |||
216 | dma-names = "tx", "rx"; | 300 | dma-names = "tx", "rx"; |
217 | #address-cells = <1>; | 301 | #address-cells = <1>; |
218 | #size-cells = <0>; | 302 | #size-cells = <0>; |
303 | clocks = <&clock 304>, <&clock 154>; | ||
304 | clock-names = "spi", "spi_busclk0"; | ||
219 | }; | 305 | }; |
220 | 306 | ||
221 | spi_1: spi@12d30000 { | 307 | spi_1: spi@12d30000 { |
@@ -227,6 +313,8 @@ | |||
227 | dma-names = "tx", "rx"; | 313 | dma-names = "tx", "rx"; |
228 | #address-cells = <1>; | 314 | #address-cells = <1>; |
229 | #size-cells = <0>; | 315 | #size-cells = <0>; |
316 | clocks = <&clock 305>, <&clock 155>; | ||
317 | clock-names = "spi", "spi_busclk0"; | ||
230 | }; | 318 | }; |
231 | 319 | ||
232 | spi_2: spi@12d40000 { | 320 | spi_2: spi@12d40000 { |
@@ -238,6 +326,8 @@ | |||
238 | dma-names = "tx", "rx"; | 326 | dma-names = "tx", "rx"; |
239 | #address-cells = <1>; | 327 | #address-cells = <1>; |
240 | #size-cells = <0>; | 328 | #size-cells = <0>; |
329 | clocks = <&clock 306>, <&clock 156>; | ||
330 | clock-names = "spi", "spi_busclk0"; | ||
241 | }; | 331 | }; |
242 | 332 | ||
243 | dwmmc_0: dwmmc0@12200000 { | 333 | dwmmc_0: dwmmc0@12200000 { |
@@ -246,6 +336,8 @@ | |||
246 | interrupts = <0 75 0>; | 336 | interrupts = <0 75 0>; |
247 | #address-cells = <1>; | 337 | #address-cells = <1>; |
248 | #size-cells = <0>; | 338 | #size-cells = <0>; |
339 | clocks = <&clock 280>, <&clock 139>; | ||
340 | clock-names = "biu", "ciu"; | ||
249 | }; | 341 | }; |
250 | 342 | ||
251 | dwmmc_1: dwmmc1@12210000 { | 343 | dwmmc_1: dwmmc1@12210000 { |
@@ -254,6 +346,8 @@ | |||
254 | interrupts = <0 76 0>; | 346 | interrupts = <0 76 0>; |
255 | #address-cells = <1>; | 347 | #address-cells = <1>; |
256 | #size-cells = <0>; | 348 | #size-cells = <0>; |
349 | clocks = <&clock 281>, <&clock 140>; | ||
350 | clock-names = "biu", "ciu"; | ||
257 | }; | 351 | }; |
258 | 352 | ||
259 | dwmmc_2: dwmmc2@12220000 { | 353 | dwmmc_2: dwmmc2@12220000 { |
@@ -262,6 +356,8 @@ | |||
262 | interrupts = <0 77 0>; | 356 | interrupts = <0 77 0>; |
263 | #address-cells = <1>; | 357 | #address-cells = <1>; |
264 | #size-cells = <0>; | 358 | #size-cells = <0>; |
359 | clocks = <&clock 282>, <&clock 141>; | ||
360 | clock-names = "biu", "ciu"; | ||
265 | }; | 361 | }; |
266 | 362 | ||
267 | dwmmc_3: dwmmc3@12230000 { | 363 | dwmmc_3: dwmmc3@12230000 { |
@@ -270,6 +366,8 @@ | |||
270 | interrupts = <0 78 0>; | 366 | interrupts = <0 78 0>; |
271 | #address-cells = <1>; | 367 | #address-cells = <1>; |
272 | #size-cells = <0>; | 368 | #size-cells = <0>; |
369 | clocks = <&clock 283>, <&clock 142>; | ||
370 | clock-names = "biu", "ciu"; | ||
273 | }; | 371 | }; |
274 | 372 | ||
275 | i2s0: i2s@03830000 { | 373 | i2s0: i2s@03830000 { |
@@ -301,6 +399,18 @@ | |||
301 | dma-names = "tx", "rx"; | 399 | dma-names = "tx", "rx"; |
302 | }; | 400 | }; |
303 | 401 | ||
402 | usb@12110000 { | ||
403 | compatible = "samsung,exynos4210-ehci"; | ||
404 | reg = <0x12110000 0x100>; | ||
405 | interrupts = <0 71 0>; | ||
406 | }; | ||
407 | |||
408 | usb@12120000 { | ||
409 | compatible = "samsung,exynos4210-ohci"; | ||
410 | reg = <0x12120000 0x100>; | ||
411 | interrupts = <0 71 0>; | ||
412 | }; | ||
413 | |||
304 | amba { | 414 | amba { |
305 | #address-cells = <1>; | 415 | #address-cells = <1>; |
306 | #size-cells = <1>; | 416 | #size-cells = <1>; |
@@ -312,6 +422,8 @@ | |||
312 | compatible = "arm,pl330", "arm,primecell"; | 422 | compatible = "arm,pl330", "arm,primecell"; |
313 | reg = <0x121A0000 0x1000>; | 423 | reg = <0x121A0000 0x1000>; |
314 | interrupts = <0 34 0>; | 424 | interrupts = <0 34 0>; |
425 | clocks = <&clock 275>; | ||
426 | clock-names = "apb_pclk"; | ||
315 | #dma-cells = <1>; | 427 | #dma-cells = <1>; |
316 | #dma-channels = <8>; | 428 | #dma-channels = <8>; |
317 | #dma-requests = <32>; | 429 | #dma-requests = <32>; |
@@ -321,6 +433,8 @@ | |||
321 | compatible = "arm,pl330", "arm,primecell"; | 433 | compatible = "arm,pl330", "arm,primecell"; |
322 | reg = <0x121B0000 0x1000>; | 434 | reg = <0x121B0000 0x1000>; |
323 | interrupts = <0 35 0>; | 435 | interrupts = <0 35 0>; |
436 | clocks = <&clock 276>; | ||
437 | clock-names = "apb_pclk"; | ||
324 | #dma-cells = <1>; | 438 | #dma-cells = <1>; |
325 | #dma-channels = <8>; | 439 | #dma-channels = <8>; |
326 | #dma-requests = <32>; | 440 | #dma-requests = <32>; |
@@ -330,6 +444,8 @@ | |||
330 | compatible = "arm,pl330", "arm,primecell"; | 444 | compatible = "arm,pl330", "arm,primecell"; |
331 | reg = <0x10800000 0x1000>; | 445 | reg = <0x10800000 0x1000>; |
332 | interrupts = <0 33 0>; | 446 | interrupts = <0 33 0>; |
447 | clocks = <&clock 271>; | ||
448 | clock-names = "apb_pclk"; | ||
333 | #dma-cells = <1>; | 449 | #dma-cells = <1>; |
334 | #dma-channels = <8>; | 450 | #dma-channels = <8>; |
335 | #dma-requests = <1>; | 451 | #dma-requests = <1>; |
@@ -339,6 +455,8 @@ | |||
339 | compatible = "arm,pl330", "arm,primecell"; | 455 | compatible = "arm,pl330", "arm,primecell"; |
340 | reg = <0x11C10000 0x1000>; | 456 | reg = <0x11C10000 0x1000>; |
341 | interrupts = <0 124 0>; | 457 | interrupts = <0 124 0>; |
458 | clocks = <&clock 271>; | ||
459 | clock-names = "apb_pclk"; | ||
342 | #dma-cells = <1>; | 460 | #dma-cells = <1>; |
343 | #dma-channels = <8>; | 461 | #dma-channels = <8>; |
344 | #dma-requests = <1>; | 462 | #dma-requests = <1>; |
@@ -592,34 +710,51 @@ | |||
592 | }; | 710 | }; |
593 | }; | 711 | }; |
594 | 712 | ||
713 | |||
595 | gsc_0: gsc@0x13e00000 { | 714 | gsc_0: gsc@0x13e00000 { |
596 | compatible = "samsung,exynos5-gsc"; | 715 | compatible = "samsung,exynos5-gsc"; |
597 | reg = <0x13e00000 0x1000>; | 716 | reg = <0x13e00000 0x1000>; |
598 | interrupts = <0 85 0>; | 717 | interrupts = <0 85 0>; |
718 | samsung,power-domain = <&pd_gsc>; | ||
719 | clocks = <&clock 256>; | ||
720 | clock-names = "gscl"; | ||
599 | }; | 721 | }; |
600 | 722 | ||
601 | gsc_1: gsc@0x13e10000 { | 723 | gsc_1: gsc@0x13e10000 { |
602 | compatible = "samsung,exynos5-gsc"; | 724 | compatible = "samsung,exynos5-gsc"; |
603 | reg = <0x13e10000 0x1000>; | 725 | reg = <0x13e10000 0x1000>; |
604 | interrupts = <0 86 0>; | 726 | interrupts = <0 86 0>; |
727 | samsung,power-domain = <&pd_gsc>; | ||
728 | clocks = <&clock 257>; | ||
729 | clock-names = "gscl"; | ||
605 | }; | 730 | }; |
606 | 731 | ||
607 | gsc_2: gsc@0x13e20000 { | 732 | gsc_2: gsc@0x13e20000 { |
608 | compatible = "samsung,exynos5-gsc"; | 733 | compatible = "samsung,exynos5-gsc"; |
609 | reg = <0x13e20000 0x1000>; | 734 | reg = <0x13e20000 0x1000>; |
610 | interrupts = <0 87 0>; | 735 | interrupts = <0 87 0>; |
736 | samsung,power-domain = <&pd_gsc>; | ||
737 | clocks = <&clock 258>; | ||
738 | clock-names = "gscl"; | ||
611 | }; | 739 | }; |
612 | 740 | ||
613 | gsc_3: gsc@0x13e30000 { | 741 | gsc_3: gsc@0x13e30000 { |
614 | compatible = "samsung,exynos5-gsc"; | 742 | compatible = "samsung,exynos5-gsc"; |
615 | reg = <0x13e30000 0x1000>; | 743 | reg = <0x13e30000 0x1000>; |
616 | interrupts = <0 88 0>; | 744 | interrupts = <0 88 0>; |
745 | samsung,power-domain = <&pd_gsc>; | ||
746 | clocks = <&clock 259>; | ||
747 | clock-names = "gscl"; | ||
617 | }; | 748 | }; |
618 | 749 | ||
619 | hdmi { | 750 | hdmi { |
620 | compatible = "samsung,exynos5-hdmi"; | 751 | compatible = "samsung,exynos5-hdmi"; |
621 | reg = <0x14530000 0x70000>; | 752 | reg = <0x14530000 0x70000>; |
622 | interrupts = <0 95 0>; | 753 | interrupts = <0 95 0>; |
754 | clocks = <&clock 333>, <&clock 136>, <&clock 137>, | ||
755 | <&clock 333>, <&clock 333>; | ||
756 | clock-names = "hdmi", "sclk_hdmi", "sclk_pixel", | ||
757 | "sclk_hdmiphy", "hdmiphy"; | ||
623 | }; | 758 | }; |
624 | 759 | ||
625 | mixer { | 760 | mixer { |
@@ -627,4 +762,18 @@ | |||
627 | reg = <0x14450000 0x10000>; | 762 | reg = <0x14450000 0x10000>; |
628 | interrupts = <0 94 0>; | 763 | interrupts = <0 94 0>; |
629 | }; | 764 | }; |
765 | |||
766 | dp-controller { | ||
767 | compatible = "samsung,exynos5-dp"; | ||
768 | reg = <0x145b0000 0x1000>; | ||
769 | interrupts = <10 3>; | ||
770 | interrupt-parent = <&combiner>; | ||
771 | #address-cells = <1>; | ||
772 | #size-cells = <0>; | ||
773 | |||
774 | dptx-phy { | ||
775 | reg = <0x10040720>; | ||
776 | samsung,enable-mask = <1>; | ||
777 | }; | ||
778 | }; | ||
630 | }; | 779 | }; |
diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts index 81e2c964a900..a21eb4cbe893 100644 --- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts +++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts | |||
@@ -28,19 +28,10 @@ | |||
28 | status = "disabled"; | 28 | status = "disabled"; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | i2c@F0000 { | 31 | fixed-rate-clocks { |
32 | status = "disabled"; | 32 | xtal { |
33 | }; | 33 | compatible = "samsung,clock-xtal"; |
34 | 34 | clock-frequency = <50000000>; | |
35 | i2c@100000 { | 35 | }; |
36 | status = "disabled"; | ||
37 | }; | ||
38 | |||
39 | watchdog { | ||
40 | status = "disabled"; | ||
41 | }; | ||
42 | |||
43 | rtc { | ||
44 | status = "disabled"; | ||
45 | }; | 36 | }; |
46 | }; | 37 | }; |
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index 9a99755920c0..48cc96aa0b5f 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi | |||
@@ -16,6 +16,12 @@ | |||
16 | 16 | ||
17 | interrupt-parent = <&gic>; | 17 | interrupt-parent = <&gic>; |
18 | 18 | ||
19 | clock: clock-controller@0x160000 { | ||
20 | compatible = "samsung,exynos5440-clock"; | ||
21 | reg = <0x160000 0x1000>; | ||
22 | #clock-cells = <1>; | ||
23 | }; | ||
24 | |||
19 | gic:interrupt-controller@2E0000 { | 25 | gic:interrupt-controller@2E0000 { |
20 | compatible = "arm,cortex-a15-gic"; | 26 | compatible = "arm,cortex-a15-gic"; |
21 | #interrupt-cells = <3>; | 27 | #interrupt-cells = <3>; |
@@ -24,55 +30,51 @@ | |||
24 | }; | 30 | }; |
25 | 31 | ||
26 | cpus { | 32 | cpus { |
33 | #address-cells = <1>; | ||
34 | #size-cells = <0>; | ||
35 | |||
27 | cpu@0 { | 36 | cpu@0 { |
28 | compatible = "arm,cortex-a15"; | 37 | compatible = "arm,cortex-a15"; |
29 | timer { | 38 | reg = <0>; |
30 | compatible = "arm,armv7-timer"; | ||
31 | interrupts = <1 13 0xf08>; | ||
32 | clock-frequency = <1000000>; | ||
33 | }; | ||
34 | }; | 39 | }; |
35 | cpu@1 { | 40 | cpu@1 { |
36 | compatible = "arm,cortex-a15"; | 41 | compatible = "arm,cortex-a15"; |
37 | timer { | 42 | reg = <1>; |
38 | compatible = "arm,armv7-timer"; | ||
39 | interrupts = <1 14 0xf08>; | ||
40 | clock-frequency = <1000000>; | ||
41 | }; | ||
42 | }; | 43 | }; |
43 | cpu@2 { | 44 | cpu@2 { |
44 | compatible = "arm,cortex-a15"; | 45 | compatible = "arm,cortex-a15"; |
45 | timer { | 46 | reg = <2>; |
46 | compatible = "arm,armv7-timer"; | ||
47 | interrupts = <1 14 0xf08>; | ||
48 | clock-frequency = <1000000>; | ||
49 | }; | ||
50 | }; | 47 | }; |
51 | cpu@3 { | 48 | cpu@3 { |
52 | compatible = "arm,cortex-a15"; | 49 | compatible = "arm,cortex-a15"; |
53 | timer { | 50 | reg = <3>; |
54 | compatible = "arm,armv7-timer"; | ||
55 | interrupts = <1 14 0xf08>; | ||
56 | clock-frequency = <1000000>; | ||
57 | }; | ||
58 | }; | 51 | }; |
59 | }; | 52 | }; |
60 | 53 | ||
61 | common { | 54 | timer { |
62 | compatible = "samsung,exynos5440"; | 55 | compatible = "arm,cortex-a15-timer", |
63 | 56 | "arm,armv7-timer"; | |
57 | interrupts = <1 13 0xf08>, | ||
58 | <1 14 0xf08>, | ||
59 | <1 11 0xf08>, | ||
60 | <1 10 0xf08>; | ||
61 | clock-frequency = <50000000>; | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | serial@B0000 { | 64 | serial@B0000 { |
67 | compatible = "samsung,exynos4210-uart"; | 65 | compatible = "samsung,exynos4210-uart"; |
68 | reg = <0xB0000 0x1000>; | 66 | reg = <0xB0000 0x1000>; |
69 | interrupts = <0 2 0>; | 67 | interrupts = <0 2 0>; |
68 | clocks = <&clock 21>, <&clock 21>; | ||
69 | clock-names = "uart", "clk_uart_baud0"; | ||
70 | }; | 70 | }; |
71 | 71 | ||
72 | serial@C0000 { | 72 | serial@C0000 { |
73 | compatible = "samsung,exynos4210-uart"; | 73 | compatible = "samsung,exynos4210-uart"; |
74 | reg = <0xC0000 0x1000>; | 74 | reg = <0xC0000 0x1000>; |
75 | interrupts = <0 3 0>; | 75 | interrupts = <0 3 0>; |
76 | clocks = <&clock 21>, <&clock 21>; | ||
77 | clock-names = "uart", "clk_uart_baud0"; | ||
76 | }; | 78 | }; |
77 | 79 | ||
78 | spi { | 80 | spi { |
@@ -83,6 +85,8 @@ | |||
83 | rx-dma-channel = <&pdma0 4>; /* preliminary */ | 85 | rx-dma-channel = <&pdma0 4>; /* preliminary */ |
84 | #address-cells = <1>; | 86 | #address-cells = <1>; |
85 | #size-cells = <0>; | 87 | #size-cells = <0>; |
88 | clocks = <&clock 21>, <&clock 16>; | ||
89 | clock-names = "spi", "spi_busclk0"; | ||
86 | }; | 90 | }; |
87 | 91 | ||
88 | pinctrl { | 92 | pinctrl { |
@@ -110,25 +114,31 @@ | |||
110 | }; | 114 | }; |
111 | 115 | ||
112 | i2c@F0000 { | 116 | i2c@F0000 { |
113 | compatible = "samsung,s3c2440-i2c"; | 117 | compatible = "samsung,exynos5440-i2c"; |
114 | reg = <0xF0000 0x1000>; | 118 | reg = <0xF0000 0x1000>; |
115 | interrupts = <0 5 0>; | 119 | interrupts = <0 5 0>; |
116 | #address-cells = <1>; | 120 | #address-cells = <1>; |
117 | #size-cells = <0>; | 121 | #size-cells = <0>; |
122 | clocks = <&clock 21>; | ||
123 | clock-names = "i2c"; | ||
118 | }; | 124 | }; |
119 | 125 | ||
120 | i2c@100000 { | 126 | i2c@100000 { |
121 | compatible = "samsung,s3c2440-i2c"; | 127 | compatible = "samsung,exynos5440-i2c"; |
122 | reg = <0x100000 0x1000>; | 128 | reg = <0x100000 0x1000>; |
123 | interrupts = <0 6 0>; | 129 | interrupts = <0 6 0>; |
124 | #address-cells = <1>; | 130 | #address-cells = <1>; |
125 | #size-cells = <0>; | 131 | #size-cells = <0>; |
132 | clocks = <&clock 21>; | ||
133 | clock-names = "i2c"; | ||
126 | }; | 134 | }; |
127 | 135 | ||
128 | watchdog { | 136 | watchdog { |
129 | compatible = "samsung,s3c2410-wdt"; | 137 | compatible = "samsung,s3c2410-wdt"; |
130 | reg = <0x110000 0x1000>; | 138 | reg = <0x110000 0x1000>; |
131 | interrupts = <0 1 0>; | 139 | interrupts = <0 1 0>; |
140 | clocks = <&clock 21>; | ||
141 | clock-names = "watchdog"; | ||
132 | }; | 142 | }; |
133 | 143 | ||
134 | amba { | 144 | amba { |
@@ -142,6 +152,8 @@ | |||
142 | compatible = "arm,pl330", "arm,primecell"; | 152 | compatible = "arm,pl330", "arm,primecell"; |
143 | reg = <0x120000 0x1000>; | 153 | reg = <0x120000 0x1000>; |
144 | interrupts = <0 34 0>; | 154 | interrupts = <0 34 0>; |
155 | clocks = <&clock 21>; | ||
156 | clock-names = "apb_pclk"; | ||
145 | #dma-cells = <1>; | 157 | #dma-cells = <1>; |
146 | #dma-channels = <8>; | 158 | #dma-channels = <8>; |
147 | #dma-requests = <32>; | 159 | #dma-requests = <32>; |
@@ -151,6 +163,8 @@ | |||
151 | compatible = "arm,pl330", "arm,primecell"; | 163 | compatible = "arm,pl330", "arm,primecell"; |
152 | reg = <0x121000 0x1000>; | 164 | reg = <0x121000 0x1000>; |
153 | interrupts = <0 35 0>; | 165 | interrupts = <0 35 0>; |
166 | clocks = <&clock 21>; | ||
167 | clock-names = "apb_pclk"; | ||
154 | #dma-cells = <1>; | 168 | #dma-cells = <1>; |
155 | #dma-channels = <8>; | 169 | #dma-channels = <8>; |
156 | #dma-requests = <32>; | 170 | #dma-requests = <32>; |
@@ -161,5 +175,8 @@ | |||
161 | compatible = "samsung,s3c6410-rtc"; | 175 | compatible = "samsung,s3c6410-rtc"; |
162 | reg = <0x130000 0x1000>; | 176 | reg = <0x130000 0x1000>; |
163 | interrupts = <0 17 0>, <0 16 0>; | 177 | interrupts = <0 17 0>, <0 16 0>; |
178 | clocks = <&clock 21>; | ||
179 | clock-names = "rtc"; | ||
180 | status = "disabled"; | ||
164 | }; | 181 | }; |
165 | }; | 182 | }; |
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index f624dc85d441..02d23f15fd86 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts | |||
@@ -38,6 +38,57 @@ | |||
38 | }; | 38 | }; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* HS USB Port 2 RESET */ | ||
42 | hsusb2_reset: hsusb2_reset_reg { | ||
43 | compatible = "regulator-fixed"; | ||
44 | regulator-name = "hsusb2_reset"; | ||
45 | regulator-min-microvolt = <3300000>; | ||
46 | regulator-max-microvolt = <3300000>; | ||
47 | gpio = <&gpio5 19 0>; /* gpio_147 */ | ||
48 | startup-delay-us = <70000>; | ||
49 | enable-active-high; | ||
50 | }; | ||
51 | |||
52 | /* HS USB Port 2 Power */ | ||
53 | hsusb2_power: hsusb2_power_reg { | ||
54 | compatible = "regulator-fixed"; | ||
55 | regulator-name = "hsusb2_vbus"; | ||
56 | regulator-min-microvolt = <3300000>; | ||
57 | regulator-max-microvolt = <3300000>; | ||
58 | gpio = <&twl_gpio 18 0>; /* GPIO LEDA */ | ||
59 | startup-delay-us = <70000>; | ||
60 | }; | ||
61 | |||
62 | /* HS USB Host PHY on PORT 2 */ | ||
63 | hsusb2_phy: hsusb2_phy { | ||
64 | compatible = "usb-nop-xceiv"; | ||
65 | reset-supply = <&hsusb2_reset>; | ||
66 | vcc-supply = <&hsusb2_power>; | ||
67 | }; | ||
68 | }; | ||
69 | |||
70 | &omap3_pmx_core { | ||
71 | pinctrl-names = "default"; | ||
72 | pinctrl-0 = < | ||
73 | &hsusbb2_pins | ||
74 | >; | ||
75 | |||
76 | hsusbb2_pins: pinmux_hsusbb2_pins { | ||
77 | pinctrl-single,pins = < | ||
78 | 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ | ||
79 | 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ | ||
80 | 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ | ||
81 | 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ | ||
82 | 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ | ||
83 | 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ | ||
84 | 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ | ||
85 | 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ | ||
86 | 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */ | ||
87 | 0x1aa 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */ | ||
88 | 0x1ac 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */ | ||
89 | 0x1ae 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */ | ||
90 | >; | ||
91 | }; | ||
41 | }; | 92 | }; |
42 | 93 | ||
43 | &i2c1 { | 94 | &i2c1 { |
@@ -65,3 +116,23 @@ | |||
65 | &mmc3 { | 116 | &mmc3 { |
66 | status = "disabled"; | 117 | status = "disabled"; |
67 | }; | 118 | }; |
119 | |||
120 | &usbhshost { | ||
121 | port2-mode = "ehci-phy"; | ||
122 | }; | ||
123 | |||
124 | &usbhsehci { | ||
125 | phys = <0 &hsusb2_phy>; | ||
126 | }; | ||
127 | |||
128 | &twl_gpio { | ||
129 | ti,use-leds; | ||
130 | /* pullups: BIT(1) */ | ||
131 | ti,pullups = <0x000002>; | ||
132 | /* | ||
133 | * pulldowns: | ||
134 | * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13) | ||
135 | * BIT(15), BIT(16), BIT(17) | ||
136 | */ | ||
137 | ti,pulldowns = <0x03a1c4>; | ||
138 | }; | ||
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 1acc26148ffc..a14f74bbce7c 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -397,5 +397,36 @@ | |||
397 | ti,timer-alwon; | 397 | ti,timer-alwon; |
398 | ti,timer-secure; | 398 | ti,timer-secure; |
399 | }; | 399 | }; |
400 | |||
401 | usbhstll: usbhstll@48062000 { | ||
402 | compatible = "ti,usbhs-tll"; | ||
403 | reg = <0x48062000 0x1000>; | ||
404 | interrupts = <78>; | ||
405 | ti,hwmods = "usb_tll_hs"; | ||
406 | }; | ||
407 | |||
408 | usbhshost: usbhshost@48064000 { | ||
409 | compatible = "ti,usbhs-host"; | ||
410 | reg = <0x48064000 0x400>; | ||
411 | ti,hwmods = "usb_host_hs"; | ||
412 | #address-cells = <1>; | ||
413 | #size-cells = <1>; | ||
414 | ranges; | ||
415 | |||
416 | usbhsohci: ohci@48064400 { | ||
417 | compatible = "ti,ohci-omap3", "usb-ohci"; | ||
418 | reg = <0x48064400 0x400>; | ||
419 | interrupt-parent = <&intc>; | ||
420 | interrupts = <76>; | ||
421 | }; | ||
422 | |||
423 | usbhsehci: ehci@48064800 { | ||
424 | compatible = "ti,ehci-omap", "usb-ehci"; | ||
425 | reg = <0x48064800 0x400>; | ||
426 | interrupt-parent = <&intc>; | ||
427 | interrupts = <77>; | ||
428 | }; | ||
429 | }; | ||
430 | |||
400 | }; | 431 | }; |
401 | }; | 432 | }; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 739bb79e410e..b7db1a2b6ca7 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -529,5 +529,35 @@ | |||
529 | ti,hwmods = "timer11"; | 529 | ti,hwmods = "timer11"; |
530 | ti,timer-pwm; | 530 | ti,timer-pwm; |
531 | }; | 531 | }; |
532 | |||
533 | usbhstll: usbhstll@4a062000 { | ||
534 | compatible = "ti,usbhs-tll"; | ||
535 | reg = <0x4a062000 0x1000>; | ||
536 | interrupts = <0 78 0x4>; | ||
537 | ti,hwmods = "usb_tll_hs"; | ||
538 | }; | ||
539 | |||
540 | usbhshost: usbhshost@4a064000 { | ||
541 | compatible = "ti,usbhs-host"; | ||
542 | reg = <0x4a064000 0x800>; | ||
543 | ti,hwmods = "usb_host_hs"; | ||
544 | #address-cells = <1>; | ||
545 | #size-cells = <1>; | ||
546 | ranges; | ||
547 | |||
548 | usbhsohci: ohci@4a064800 { | ||
549 | compatible = "ti,ohci-omap3", "usb-ohci"; | ||
550 | reg = <0x4a064800 0x400>; | ||
551 | interrupt-parent = <&gic>; | ||
552 | interrupts = <0 76 0x4>; | ||
553 | }; | ||
554 | |||
555 | usbhsehci: ehci@4a064c00 { | ||
556 | compatible = "ti,ehci-omap", "usb-ehci"; | ||
557 | reg = <0x4a064c00 0x400>; | ||
558 | interrupt-parent = <&gic>; | ||
559 | interrupts = <0 77 0x4>; | ||
560 | }; | ||
561 | }; | ||
532 | }; | 562 | }; |
533 | }; | 563 | }; |
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 6ebc1b704190..616990dc92db 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | serial@70006300 { | 13 | serial@70006300 { |
14 | status = "okay"; | 14 | status = "okay"; |
15 | clock-frequency = <408000000>; | ||
16 | }; | 15 | }; |
17 | 16 | ||
18 | pmc { | 17 | pmc { |
diff --git a/arch/arm/boot/dts/tegra114-pluto.dts b/arch/arm/boot/dts/tegra114-pluto.dts index 5deb8692b350..6bbc8efae9c0 100644 --- a/arch/arm/boot/dts/tegra114-pluto.dts +++ b/arch/arm/boot/dts/tegra114-pluto.dts | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | serial@70006300 { | 13 | serial@70006300 { |
14 | status = "okay"; | 14 | status = "okay"; |
15 | clock-frequency = <408000000>; | ||
16 | }; | 15 | }; |
17 | 16 | ||
18 | pmc { | 17 | pmc { |
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi index c0b527d15fda..c1110a9b2a91 100644 --- a/arch/arm/boot/dts/tegra114.dtsi +++ b/arch/arm/boot/dts/tegra114.dtsi | |||
@@ -24,10 +24,11 @@ | |||
24 | 0 42 0x04 | 24 | 0 42 0x04 |
25 | 0 121 0x04 | 25 | 0 121 0x04 |
26 | 0 122 0x04>; | 26 | 0 122 0x04>; |
27 | clocks = <&tegra_car 5>; | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | tegra_car: clock { | 30 | tegra_car: clock { |
30 | compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; | 31 | compatible = "nvidia,tegra114-car"; |
31 | reg = <0x60006000 0x1000>; | 32 | reg = <0x60006000 0x1000>; |
32 | #clock-cells = <1>; | 33 | #clock-cells = <1>; |
33 | }; | 34 | }; |
@@ -66,6 +67,7 @@ | |||
66 | reg-shift = <2>; | 67 | reg-shift = <2>; |
67 | interrupts = <0 36 0x04>; | 68 | interrupts = <0 36 0x04>; |
68 | status = "disabled"; | 69 | status = "disabled"; |
70 | clocks = <&tegra_car 6>; | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | serial@70006040 { | 73 | serial@70006040 { |
@@ -74,6 +76,7 @@ | |||
74 | reg-shift = <2>; | 76 | reg-shift = <2>; |
75 | interrupts = <0 37 0x04>; | 77 | interrupts = <0 37 0x04>; |
76 | status = "disabled"; | 78 | status = "disabled"; |
79 | clocks = <&tegra_car 192>; | ||
77 | }; | 80 | }; |
78 | 81 | ||
79 | serial@70006200 { | 82 | serial@70006200 { |
@@ -82,6 +85,7 @@ | |||
82 | reg-shift = <2>; | 85 | reg-shift = <2>; |
83 | interrupts = <0 46 0x04>; | 86 | interrupts = <0 46 0x04>; |
84 | status = "disabled"; | 87 | status = "disabled"; |
88 | clocks = <&tegra_car 55>; | ||
85 | }; | 89 | }; |
86 | 90 | ||
87 | serial@70006300 { | 91 | serial@70006300 { |
@@ -90,12 +94,14 @@ | |||
90 | reg-shift = <2>; | 94 | reg-shift = <2>; |
91 | interrupts = <0 90 0x04>; | 95 | interrupts = <0 90 0x04>; |
92 | status = "disabled"; | 96 | status = "disabled"; |
97 | clocks = <&tegra_car 65>; | ||
93 | }; | 98 | }; |
94 | 99 | ||
95 | rtc { | 100 | rtc { |
96 | compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; | 101 | compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; |
97 | reg = <0x7000e000 0x100>; | 102 | reg = <0x7000e000 0x100>; |
98 | interrupts = <0 2 0x04>; | 103 | interrupts = <0 2 0x04>; |
104 | clocks = <&tegra_car 4>; | ||
99 | }; | 105 | }; |
100 | 106 | ||
101 | pmc { | 107 | pmc { |
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi index 68c8dc644383..4a4b96f6827e 100644 --- a/arch/arm/boot/dts/vt8500.dtsi +++ b/arch/arm/boot/dts/vt8500.dtsi | |||
@@ -25,11 +25,13 @@ | |||
25 | #interrupt-cells = <1>; | 25 | #interrupt-cells = <1>; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | gpio: gpio-controller@d8110000 { | 28 | pinctrl: pinctrl@d8110000 { |
29 | compatible = "via,vt8500-gpio"; | 29 | compatible = "via,vt8500-pinctrl"; |
30 | gpio-controller; | ||
31 | reg = <0xd8110000 0x10000>; | 30 | reg = <0xd8110000 0x10000>; |
32 | #gpio-cells = <3>; | 31 | interrupt-controller; |
32 | #interrupt-cells = <2>; | ||
33 | gpio-controller; | ||
34 | #gpio-cells = <2>; | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | pmc@d8130000 { | 37 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi index 398b8bca791e..b2bf359e852f 100644 --- a/arch/arm/boot/dts/wm8505.dtsi +++ b/arch/arm/boot/dts/wm8505.dtsi | |||
@@ -40,11 +40,13 @@ | |||
40 | interrupts = <56 57 58 59 60 61 62 63>; | 40 | interrupts = <56 57 58 59 60 61 62 63>; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | gpio: gpio-controller@d8110000 { | 43 | pinctrl: pinctrl@d8110000 { |
44 | compatible = "wm,wm8505-gpio"; | 44 | compatible = "wm,wm8505-pinctrl"; |
45 | gpio-controller; | ||
46 | reg = <0xd8110000 0x10000>; | 45 | reg = <0xd8110000 0x10000>; |
47 | #gpio-cells = <3>; | 46 | interrupt-controller; |
47 | #interrupt-cells = <2>; | ||
48 | gpio-controller; | ||
49 | #gpio-cells = <2>; | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | pmc@d8130000 { | 52 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi index 9313407bbc30..dd8464eeb40d 100644 --- a/arch/arm/boot/dts/wm8650.dtsi +++ b/arch/arm/boot/dts/wm8650.dtsi | |||
@@ -34,11 +34,13 @@ | |||
34 | interrupts = <56 57 58 59 60 61 62 63>; | 34 | interrupts = <56 57 58 59 60 61 62 63>; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | gpio: gpio-controller@d8110000 { | 37 | pinctrl: pinctrl@d8110000 { |
38 | compatible = "wm,wm8650-gpio"; | 38 | compatible = "wm,wm8650-pinctrl"; |
39 | gpio-controller; | ||
40 | reg = <0xd8110000 0x10000>; | 39 | reg = <0xd8110000 0x10000>; |
41 | #gpio-cells = <3>; | 40 | interrupt-controller; |
41 | #interrupt-cells = <2>; | ||
42 | gpio-controller; | ||
43 | #gpio-cells = <2>; | ||
42 | }; | 44 | }; |
43 | 45 | ||
44 | pmc@d8130000 { | 46 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi index 7149cd13e3b9..fc790d0aee66 100644 --- a/arch/arm/boot/dts/wm8850.dtsi +++ b/arch/arm/boot/dts/wm8850.dtsi | |||
@@ -41,11 +41,13 @@ | |||
41 | interrupts = <56 57 58 59 60 61 62 63>; | 41 | interrupts = <56 57 58 59 60 61 62 63>; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | gpio: gpio-controller@d8110000 { | 44 | pinctrl: pinctrl@d8110000 { |
45 | compatible = "wm,wm8650-gpio"; | 45 | compatible = "wm,wm8850-pinctrl"; |
46 | gpio-controller; | ||
47 | reg = <0xd8110000 0x10000>; | 46 | reg = <0xd8110000 0x10000>; |
48 | #gpio-cells = <3>; | 47 | interrupt-controller; |
48 | #interrupt-cells = <2>; | ||
49 | gpio-controller; | ||
50 | #gpio-cells = <2>; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | pmc@d8130000 { | 53 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 9e1c339c4491..748fc347ed18 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi | |||
@@ -118,56 +118,23 @@ | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | ttc0: ttc0@f8001000 { | 120 | ttc0: ttc0@f8001000 { |
121 | #address-cells = <1>; | 121 | interrupt-parent = <&intc>; |
122 | #size-cells = <0>; | 122 | interrupts = < 0 10 4 0 11 4 0 12 4 >; |
123 | compatible = "xlnx,ttc"; | 123 | compatible = "cdns,ttc"; |
124 | reg = <0xF8001000 0x1000>; | 124 | reg = <0xF8001000 0x1000>; |
125 | clocks = <&cpu_clk 3>; | 125 | clocks = <&cpu_clk 3>; |
126 | clock-names = "cpu_1x"; | 126 | clock-names = "cpu_1x"; |
127 | clock-ranges; | 127 | clock-ranges; |
128 | |||
129 | ttc0_0: ttc0.0 { | ||
130 | status = "disabled"; | ||
131 | reg = <0>; | ||
132 | interrupts = <0 10 4>; | ||
133 | }; | ||
134 | ttc0_1: ttc0.1 { | ||
135 | status = "disabled"; | ||
136 | reg = <1>; | ||
137 | interrupts = <0 11 4>; | ||
138 | }; | ||
139 | ttc0_2: ttc0.2 { | ||
140 | status = "disabled"; | ||
141 | reg = <2>; | ||
142 | interrupts = <0 12 4>; | ||
143 | }; | ||
144 | }; | 128 | }; |
145 | 129 | ||
146 | ttc1: ttc1@f8002000 { | 130 | ttc1: ttc1@f8002000 { |
147 | #interrupt-parent = <&intc>; | 131 | interrupt-parent = <&intc>; |
148 | #address-cells = <1>; | 132 | interrupts = < 0 37 4 0 38 4 0 39 4 >; |
149 | #size-cells = <0>; | 133 | compatible = "cdns,ttc"; |
150 | compatible = "xlnx,ttc"; | ||
151 | reg = <0xF8002000 0x1000>; | 134 | reg = <0xF8002000 0x1000>; |
152 | clocks = <&cpu_clk 3>; | 135 | clocks = <&cpu_clk 3>; |
153 | clock-names = "cpu_1x"; | 136 | clock-names = "cpu_1x"; |
154 | clock-ranges; | 137 | clock-ranges; |
155 | |||
156 | ttc1_0: ttc1.0 { | ||
157 | status = "disabled"; | ||
158 | reg = <0>; | ||
159 | interrupts = <0 37 4>; | ||
160 | }; | ||
161 | ttc1_1: ttc1.1 { | ||
162 | status = "disabled"; | ||
163 | reg = <1>; | ||
164 | interrupts = <0 38 4>; | ||
165 | }; | ||
166 | ttc1_2: ttc1.2 { | ||
167 | status = "disabled"; | ||
168 | reg = <2>; | ||
169 | interrupts = <0 39 4>; | ||
170 | }; | ||
171 | }; | 138 | }; |
172 | }; | 139 | }; |
173 | }; | 140 | }; |
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts index c772942a399a..86f44d5b0265 100644 --- a/arch/arm/boot/dts/zynq-zc702.dts +++ b/arch/arm/boot/dts/zynq-zc702.dts | |||
@@ -32,13 +32,3 @@ | |||
32 | &ps_clk { | 32 | &ps_clk { |
33 | clock-frequency = <33333330>; | 33 | clock-frequency = <33333330>; |
34 | }; | 34 | }; |
35 | |||
36 | &ttc0_0 { | ||
37 | status = "ok"; | ||
38 | compatible = "xlnx,ttc-counter-clocksource"; | ||
39 | }; | ||
40 | |||
41 | &ttc0_1 { | ||
42 | status = "ok"; | ||
43 | compatible = "xlnx,ttc-counter-clockevent"; | ||
44 | }; | ||
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index ac7a341bd0ff..25efb5ac30f1 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -169,6 +169,8 @@ static struct clk *periph_clocks[] __initdata = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct clk_lookup periph_clocks_lookups[] = { | 171 | static struct clk_lookup periph_clocks_lookups[] = { |
172 | CLKDEV_CON_DEV_ID("hclk", "at91sam9261-lcdfb.0", &hck1), | ||
173 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g10-lcdfb.0", &hck1), | ||
172 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 174 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
173 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 175 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
174 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 176 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 92e0f861084a..629ea5fc95cf 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -488,7 +488,6 @@ static struct resource lcdc_resources[] = { | |||
488 | }; | 488 | }; |
489 | 489 | ||
490 | static struct platform_device at91_lcdc_device = { | 490 | static struct platform_device at91_lcdc_device = { |
491 | .name = "atmel_lcdfb", | ||
492 | .id = 0, | 491 | .id = 0, |
493 | .dev = { | 492 | .dev = { |
494 | .dma_mask = &lcdc_dmamask, | 493 | .dma_mask = &lcdc_dmamask, |
@@ -505,6 +504,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
505 | return; | 504 | return; |
506 | } | 505 | } |
507 | 506 | ||
507 | if (cpu_is_at91sam9g10()) | ||
508 | at91_lcdc_device.name = "at91sam9g10-lcdfb"; | ||
509 | else | ||
510 | at91_lcdc_device.name = "at91sam9261-lcdfb"; | ||
511 | |||
508 | #if defined(CONFIG_FB_ATMEL_STN) | 512 | #if defined(CONFIG_FB_ATMEL_STN) |
509 | at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ | 513 | at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ |
510 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ | 514 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 8e2d9f4a9a45..f44ffd2105a7 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -190,6 +190,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), | 190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), |
191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), | 191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), |
192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), | 192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), |
193 | CLKDEV_CON_DEV_ID("hclk", "at91sam9263-lcdfb.0", &lcdc_clk), | ||
193 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), | 194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), |
194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), | 195 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), |
195 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 196 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ed666f5cb01d..858c8aac2daf 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -848,7 +848,7 @@ static struct resource lcdc_resources[] = { | |||
848 | }; | 848 | }; |
849 | 849 | ||
850 | static struct platform_device at91_lcdc_device = { | 850 | static struct platform_device at91_lcdc_device = { |
851 | .name = "atmel_lcdfb", | 851 | .name = "at91sam9263-lcdfb", |
852 | .id = 0, | 852 | .id = 0, |
853 | .dev = { | 853 | .dev = { |
854 | .dma_mask = &lcdc_dmamask, | 854 | .dma_mask = &lcdc_dmamask, |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index a6c224fc9542..8b7fce067652 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -228,6 +228,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
228 | CLKDEV_CON_ID("hclk", &macb_clk), | 228 | CLKDEV_CON_ID("hclk", &macb_clk), |
229 | /* One additional fake clock for ohci */ | 229 | /* One additional fake clock for ohci */ |
230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), | 230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), |
231 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g45-lcdfb.0", &lcdc_clk), | ||
232 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g45es-lcdfb.0", &lcdc_clk), | ||
231 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), | 233 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), |
232 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 234 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
233 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 235 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index f0bf68268ca2..acb703e13331 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -981,7 +981,6 @@ static struct resource lcdc_resources[] = { | |||
981 | }; | 981 | }; |
982 | 982 | ||
983 | static struct platform_device at91_lcdc_device = { | 983 | static struct platform_device at91_lcdc_device = { |
984 | .name = "atmel_lcdfb", | ||
985 | .id = 0, | 984 | .id = 0, |
986 | .dev = { | 985 | .dev = { |
987 | .dma_mask = &lcdc_dmamask, | 986 | .dma_mask = &lcdc_dmamask, |
@@ -997,6 +996,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
997 | if (!data) | 996 | if (!data) |
998 | return; | 997 | return; |
999 | 998 | ||
999 | if (cpu_is_at91sam9g45es()) | ||
1000 | at91_lcdc_device.name = "at91sam9g45es-lcdfb"; | ||
1001 | else | ||
1002 | at91_lcdc_device.name = "at91sam9g45-lcdfb"; | ||
1003 | |||
1000 | at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ | 1004 | at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ |
1001 | 1005 | ||
1002 | at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */ | 1006 | at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */ |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index c39600764236..f77fae5591bc 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -179,6 +179,7 @@ static struct clk *periph_clocks[] __initdata = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct clk_lookup periph_clocks_lookups[] = { | 181 | static struct clk_lookup periph_clocks_lookups[] = { |
182 | CLKDEV_CON_DEV_ID("hclk", "at91sam9rl-lcdfb.0", &lcdc_clk), | ||
182 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 183 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
183 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 184 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
184 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 185 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index ddf223ff35c4..352468f265a9 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -514,7 +514,7 @@ static struct resource lcdc_resources[] = { | |||
514 | }; | 514 | }; |
515 | 515 | ||
516 | static struct platform_device at91_lcdc_device = { | 516 | static struct platform_device at91_lcdc_device = { |
517 | .name = "atmel_lcdfb", | 517 | .name = "at91sam9rl-lcdfb", |
518 | .id = 0, | 518 | .id = 0, |
519 | .dev = { | 519 | .dev = { |
520 | .dma_mask = &lcdc_dmamask, | 520 | .dma_mask = &lcdc_dmamask, |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index f22f69e2d081..d19edff0ea6e 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -63,6 +63,7 @@ config SOC_EXYNOS5250 | |||
63 | bool "SAMSUNG EXYNOS5250" | 63 | bool "SAMSUNG EXYNOS5250" |
64 | default y | 64 | default y |
65 | depends on ARCH_EXYNOS5 | 65 | depends on ARCH_EXYNOS5 |
66 | select PM_GENERIC_DOMAINS if PM | ||
66 | select S5P_PM if PM | 67 | select S5P_PM if PM |
67 | select S5P_SLEEP if PM | 68 | select S5P_SLEEP if PM |
68 | select S5P_DEV_MFC | 69 | select S5P_DEV_MFC |
@@ -83,12 +84,6 @@ config SOC_EXYNOS5440 | |||
83 | help | 84 | help |
84 | Enable EXYNOS5440 SoC support | 85 | Enable EXYNOS5440 SoC support |
85 | 86 | ||
86 | config EXYNOS4_MCT | ||
87 | bool | ||
88 | default y | ||
89 | help | ||
90 | Use MCT (Multi Core Timer) as kernel timers | ||
91 | |||
92 | config EXYNOS_ATAGS | 87 | config EXYNOS_ATAGS |
93 | bool "ATAGS based boot for EXYNOS (deprecated)" | 88 | bool "ATAGS based boot for EXYNOS (deprecated)" |
94 | depends on !ARCH_MULTIPLATFORM | 89 | depends on !ARCH_MULTIPLATFORM |
@@ -285,8 +280,8 @@ config MACH_UNIVERSAL_C210 | |||
285 | select S5P_DEV_ONENAND | 280 | select S5P_DEV_ONENAND |
286 | select S5P_DEV_TV | 281 | select S5P_DEV_TV |
287 | select S5P_GPIO_INT | 282 | select S5P_GPIO_INT |
288 | select S5P_HRT | ||
289 | select S5P_SETUP_MIPIPHY | 283 | select S5P_SETUP_MIPIPHY |
284 | select SAMSUNG_HRT | ||
290 | help | 285 | help |
291 | Machine support for Samsung Mobile Universal S5PC210 Reference | 286 | Machine support for Samsung Mobile Universal S5PC210 Reference |
292 | Board. | 287 | Board. |
@@ -414,10 +409,12 @@ config MACH_EXYNOS4_DT | |||
414 | bool "Samsung Exynos4 Machine using device tree" | 409 | bool "Samsung Exynos4 Machine using device tree" |
415 | depends on ARCH_EXYNOS4 | 410 | depends on ARCH_EXYNOS4 |
416 | select ARM_AMBA | 411 | select ARM_AMBA |
412 | select CLKSRC_OF | ||
417 | select CPU_EXYNOS4210 | 413 | select CPU_EXYNOS4210 |
418 | select KEYBOARD_SAMSUNG if INPUT_KEYBOARD | 414 | select KEYBOARD_SAMSUNG if INPUT_KEYBOARD |
419 | select PINCTRL | 415 | select PINCTRL |
420 | select PINCTRL_EXYNOS | 416 | select PINCTRL_EXYNOS |
417 | select S5P_DEV_MFC | ||
421 | select USE_OF | 418 | select USE_OF |
422 | help | 419 | help |
423 | Machine support for Samsung Exynos4 machine with device tree enabled. | 420 | Machine support for Samsung Exynos4 machine with device tree enabled. |
@@ -430,6 +427,7 @@ config MACH_EXYNOS5_DT | |||
430 | default y | 427 | default y |
431 | depends on ARCH_EXYNOS5 | 428 | depends on ARCH_EXYNOS5 |
432 | select ARM_AMBA | 429 | select ARM_AMBA |
430 | select CLKSRC_OF | ||
433 | select USE_OF | 431 | select USE_OF |
434 | help | 432 | help |
435 | Machine support for Samsung EXYNOS5 machine with device tree enabled. | 433 | Machine support for Samsung EXYNOS5 machine with device tree enabled. |
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index 435757e57bb4..d2f6b362b6dd 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile | |||
@@ -13,10 +13,6 @@ obj- := | |||
13 | # Core | 13 | # Core |
14 | 14 | ||
15 | obj-$(CONFIG_ARCH_EXYNOS) += common.o | 15 | obj-$(CONFIG_ARCH_EXYNOS) += common.o |
16 | obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o | ||
17 | obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o | ||
18 | obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o | ||
19 | obj-$(CONFIG_SOC_EXYNOS5250) += clock-exynos5.o | ||
20 | 16 | ||
21 | obj-$(CONFIG_PM) += pm.o | 17 | obj-$(CONFIG_PM) += pm.o |
22 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o | 18 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o |
@@ -26,8 +22,6 @@ obj-$(CONFIG_ARCH_EXYNOS) += pmu.o | |||
26 | 22 | ||
27 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 23 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
28 | 24 | ||
29 | obj-$(CONFIG_EXYNOS4_MCT) += mct.o | ||
30 | |||
31 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 25 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
32 | 26 | ||
33 | # machine support | 27 | # machine support |
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c deleted file mode 100644 index 8a8468d83c8c..000000000000 --- a/arch/arm/mach-exynos/clock-exynos4.c +++ /dev/null | |||
@@ -1,1601 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * EXYNOS4 - Clock support | ||
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 | #include <linux/kernel.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/syscore_ops.h> | ||
16 | |||
17 | #include <plat/cpu-freq.h> | ||
18 | #include <plat/clock.h> | ||
19 | #include <plat/cpu.h> | ||
20 | #include <plat/pll.h> | ||
21 | #include <plat/s5p-clock.h> | ||
22 | #include <plat/clock-clksrc.h> | ||
23 | #include <plat/pm.h> | ||
24 | |||
25 | #include <mach/map.h> | ||
26 | #include <mach/regs-clock.h> | ||
27 | |||
28 | #include "common.h" | ||
29 | #include "clock-exynos4.h" | ||
30 | |||
31 | #ifdef CONFIG_PM_SLEEP | ||
32 | static struct sleep_save exynos4_clock_save[] = { | ||
33 | SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS), | ||
34 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS), | ||
35 | SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS), | ||
36 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS), | ||
37 | SAVE_ITEM(EXYNOS4_CLKSRC_TOP0), | ||
38 | SAVE_ITEM(EXYNOS4_CLKSRC_TOP1), | ||
39 | SAVE_ITEM(EXYNOS4_CLKSRC_CAM), | ||
40 | SAVE_ITEM(EXYNOS4_CLKSRC_TV), | ||
41 | SAVE_ITEM(EXYNOS4_CLKSRC_MFC), | ||
42 | SAVE_ITEM(EXYNOS4_CLKSRC_G3D), | ||
43 | SAVE_ITEM(EXYNOS4_CLKSRC_LCD0), | ||
44 | SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO), | ||
45 | SAVE_ITEM(EXYNOS4_CLKSRC_FSYS), | ||
46 | SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0), | ||
47 | SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1), | ||
48 | SAVE_ITEM(EXYNOS4_CLKDIV_CAM), | ||
49 | SAVE_ITEM(EXYNOS4_CLKDIV_TV), | ||
50 | SAVE_ITEM(EXYNOS4_CLKDIV_MFC), | ||
51 | SAVE_ITEM(EXYNOS4_CLKDIV_G3D), | ||
52 | SAVE_ITEM(EXYNOS4_CLKDIV_LCD0), | ||
53 | SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO), | ||
54 | SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0), | ||
55 | SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1), | ||
56 | SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2), | ||
57 | SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3), | ||
58 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0), | ||
59 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1), | ||
60 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2), | ||
61 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3), | ||
62 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4), | ||
63 | SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5), | ||
64 | SAVE_ITEM(EXYNOS4_CLKDIV_TOP), | ||
65 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP), | ||
66 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM), | ||
67 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV), | ||
68 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0), | ||
69 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO), | ||
70 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS), | ||
71 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0), | ||
72 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1), | ||
73 | SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO), | ||
74 | SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM), | ||
75 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM), | ||
76 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV), | ||
77 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC), | ||
78 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D), | ||
79 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0), | ||
80 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS), | ||
81 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS), | ||
82 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL), | ||
83 | SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK), | ||
84 | SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC), | ||
85 | SAVE_ITEM(EXYNOS4_CLKSRC_DMC), | ||
86 | SAVE_ITEM(EXYNOS4_CLKDIV_DMC0), | ||
87 | SAVE_ITEM(EXYNOS4_CLKDIV_DMC1), | ||
88 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC), | ||
89 | SAVE_ITEM(EXYNOS4_CLKSRC_CPU), | ||
90 | SAVE_ITEM(EXYNOS4_CLKDIV_CPU), | ||
91 | SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4), | ||
92 | SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU), | ||
93 | SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU), | ||
94 | }; | ||
95 | #endif | ||
96 | |||
97 | static struct clk exynos4_clk_sclk_hdmi27m = { | ||
98 | .name = "sclk_hdmi27m", | ||
99 | .rate = 27000000, | ||
100 | }; | ||
101 | |||
102 | static struct clk exynos4_clk_sclk_hdmiphy = { | ||
103 | .name = "sclk_hdmiphy", | ||
104 | }; | ||
105 | |||
106 | static struct clk exynos4_clk_sclk_usbphy0 = { | ||
107 | .name = "sclk_usbphy0", | ||
108 | .rate = 27000000, | ||
109 | }; | ||
110 | |||
111 | static struct clk exynos4_clk_sclk_usbphy1 = { | ||
112 | .name = "sclk_usbphy1", | ||
113 | }; | ||
114 | |||
115 | static struct clk dummy_apb_pclk = { | ||
116 | .name = "apb_pclk", | ||
117 | .id = -1, | ||
118 | }; | ||
119 | |||
120 | static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable) | ||
121 | { | ||
122 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable); | ||
123 | } | ||
124 | |||
125 | static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable) | ||
126 | { | ||
127 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable); | ||
128 | } | ||
129 | |||
130 | static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable) | ||
131 | { | ||
132 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable); | ||
133 | } | ||
134 | |||
135 | int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) | ||
136 | { | ||
137 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable); | ||
138 | } | ||
139 | |||
140 | static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) | ||
141 | { | ||
142 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable); | ||
143 | } | ||
144 | |||
145 | static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable) | ||
146 | { | ||
147 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable); | ||
148 | } | ||
149 | |||
150 | static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable) | ||
151 | { | ||
152 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable); | ||
153 | } | ||
154 | |||
155 | static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable) | ||
156 | { | ||
157 | return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable); | ||
158 | } | ||
159 | |||
160 | static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable) | ||
161 | { | ||
162 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable); | ||
163 | } | ||
164 | |||
165 | static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable) | ||
166 | { | ||
167 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable); | ||
168 | } | ||
169 | |||
170 | int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable) | ||
171 | { | ||
172 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable); | ||
173 | } | ||
174 | |||
175 | static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable) | ||
176 | { | ||
177 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable); | ||
178 | } | ||
179 | |||
180 | int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) | ||
181 | { | ||
182 | return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable); | ||
183 | } | ||
184 | |||
185 | int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) | ||
186 | { | ||
187 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable); | ||
188 | } | ||
189 | |||
190 | static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable) | ||
191 | { | ||
192 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable); | ||
193 | } | ||
194 | |||
195 | static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable) | ||
196 | { | ||
197 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable); | ||
198 | } | ||
199 | |||
200 | int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable) | ||
201 | { | ||
202 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_DMC, clk, enable); | ||
203 | } | ||
204 | |||
205 | static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable) | ||
206 | { | ||
207 | return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); | ||
208 | } | ||
209 | |||
210 | static int exynos4_clk_dac_ctrl(struct clk *clk, int enable) | ||
211 | { | ||
212 | return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable); | ||
213 | } | ||
214 | |||
215 | /* Core list of CMU_CPU side */ | ||
216 | |||
217 | static struct clksrc_clk exynos4_clk_mout_apll = { | ||
218 | .clk = { | ||
219 | .name = "mout_apll", | ||
220 | }, | ||
221 | .sources = &clk_src_apll, | ||
222 | .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 }, | ||
223 | }; | ||
224 | |||
225 | static struct clksrc_clk exynos4_clk_sclk_apll = { | ||
226 | .clk = { | ||
227 | .name = "sclk_apll", | ||
228 | .parent = &exynos4_clk_mout_apll.clk, | ||
229 | }, | ||
230 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 }, | ||
231 | }; | ||
232 | |||
233 | static struct clksrc_clk exynos4_clk_mout_epll = { | ||
234 | .clk = { | ||
235 | .name = "mout_epll", | ||
236 | }, | ||
237 | .sources = &clk_src_epll, | ||
238 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 }, | ||
239 | }; | ||
240 | |||
241 | struct clksrc_clk exynos4_clk_mout_mpll = { | ||
242 | .clk = { | ||
243 | .name = "mout_mpll", | ||
244 | }, | ||
245 | .sources = &clk_src_mpll, | ||
246 | |||
247 | /* reg_src will be added in each SoCs' clock */ | ||
248 | }; | ||
249 | |||
250 | static struct clk *exynos4_clkset_moutcore_list[] = { | ||
251 | [0] = &exynos4_clk_mout_apll.clk, | ||
252 | [1] = &exynos4_clk_mout_mpll.clk, | ||
253 | }; | ||
254 | |||
255 | static struct clksrc_sources exynos4_clkset_moutcore = { | ||
256 | .sources = exynos4_clkset_moutcore_list, | ||
257 | .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list), | ||
258 | }; | ||
259 | |||
260 | static struct clksrc_clk exynos4_clk_moutcore = { | ||
261 | .clk = { | ||
262 | .name = "moutcore", | ||
263 | }, | ||
264 | .sources = &exynos4_clkset_moutcore, | ||
265 | .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 }, | ||
266 | }; | ||
267 | |||
268 | static struct clksrc_clk exynos4_clk_coreclk = { | ||
269 | .clk = { | ||
270 | .name = "core_clk", | ||
271 | .parent = &exynos4_clk_moutcore.clk, | ||
272 | }, | ||
273 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 }, | ||
274 | }; | ||
275 | |||
276 | static struct clksrc_clk exynos4_clk_armclk = { | ||
277 | .clk = { | ||
278 | .name = "armclk", | ||
279 | .parent = &exynos4_clk_coreclk.clk, | ||
280 | }, | ||
281 | }; | ||
282 | |||
283 | static struct clksrc_clk exynos4_clk_aclk_corem0 = { | ||
284 | .clk = { | ||
285 | .name = "aclk_corem0", | ||
286 | .parent = &exynos4_clk_coreclk.clk, | ||
287 | }, | ||
288 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
289 | }; | ||
290 | |||
291 | static struct clksrc_clk exynos4_clk_aclk_cores = { | ||
292 | .clk = { | ||
293 | .name = "aclk_cores", | ||
294 | .parent = &exynos4_clk_coreclk.clk, | ||
295 | }, | ||
296 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 }, | ||
297 | }; | ||
298 | |||
299 | static struct clksrc_clk exynos4_clk_aclk_corem1 = { | ||
300 | .clk = { | ||
301 | .name = "aclk_corem1", | ||
302 | .parent = &exynos4_clk_coreclk.clk, | ||
303 | }, | ||
304 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 }, | ||
305 | }; | ||
306 | |||
307 | static struct clksrc_clk exynos4_clk_periphclk = { | ||
308 | .clk = { | ||
309 | .name = "periphclk", | ||
310 | .parent = &exynos4_clk_coreclk.clk, | ||
311 | }, | ||
312 | .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 }, | ||
313 | }; | ||
314 | |||
315 | /* Core list of CMU_CORE side */ | ||
316 | |||
317 | static struct clk *exynos4_clkset_corebus_list[] = { | ||
318 | [0] = &exynos4_clk_mout_mpll.clk, | ||
319 | [1] = &exynos4_clk_sclk_apll.clk, | ||
320 | }; | ||
321 | |||
322 | struct clksrc_sources exynos4_clkset_mout_corebus = { | ||
323 | .sources = exynos4_clkset_corebus_list, | ||
324 | .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list), | ||
325 | }; | ||
326 | |||
327 | static struct clksrc_clk exynos4_clk_mout_corebus = { | ||
328 | .clk = { | ||
329 | .name = "mout_corebus", | ||
330 | }, | ||
331 | .sources = &exynos4_clkset_mout_corebus, | ||
332 | .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 }, | ||
333 | }; | ||
334 | |||
335 | static struct clksrc_clk exynos4_clk_sclk_dmc = { | ||
336 | .clk = { | ||
337 | .name = "sclk_dmc", | ||
338 | .parent = &exynos4_clk_mout_corebus.clk, | ||
339 | }, | ||
340 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 }, | ||
341 | }; | ||
342 | |||
343 | static struct clksrc_clk exynos4_clk_aclk_cored = { | ||
344 | .clk = { | ||
345 | .name = "aclk_cored", | ||
346 | .parent = &exynos4_clk_sclk_dmc.clk, | ||
347 | }, | ||
348 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 }, | ||
349 | }; | ||
350 | |||
351 | static struct clksrc_clk exynos4_clk_aclk_corep = { | ||
352 | .clk = { | ||
353 | .name = "aclk_corep", | ||
354 | .parent = &exynos4_clk_aclk_cored.clk, | ||
355 | }, | ||
356 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 }, | ||
357 | }; | ||
358 | |||
359 | static struct clksrc_clk exynos4_clk_aclk_acp = { | ||
360 | .clk = { | ||
361 | .name = "aclk_acp", | ||
362 | .parent = &exynos4_clk_mout_corebus.clk, | ||
363 | }, | ||
364 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 }, | ||
365 | }; | ||
366 | |||
367 | static struct clksrc_clk exynos4_clk_pclk_acp = { | ||
368 | .clk = { | ||
369 | .name = "pclk_acp", | ||
370 | .parent = &exynos4_clk_aclk_acp.clk, | ||
371 | }, | ||
372 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 }, | ||
373 | }; | ||
374 | |||
375 | /* Core list of CMU_TOP side */ | ||
376 | |||
377 | struct clk *exynos4_clkset_aclk_top_list[] = { | ||
378 | [0] = &exynos4_clk_mout_mpll.clk, | ||
379 | [1] = &exynos4_clk_sclk_apll.clk, | ||
380 | }; | ||
381 | |||
382 | static struct clksrc_sources exynos4_clkset_aclk = { | ||
383 | .sources = exynos4_clkset_aclk_top_list, | ||
384 | .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list), | ||
385 | }; | ||
386 | |||
387 | static struct clksrc_clk exynos4_clk_aclk_200 = { | ||
388 | .clk = { | ||
389 | .name = "aclk_200", | ||
390 | }, | ||
391 | .sources = &exynos4_clkset_aclk, | ||
392 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 }, | ||
393 | .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 }, | ||
394 | }; | ||
395 | |||
396 | static struct clksrc_clk exynos4_clk_aclk_100 = { | ||
397 | .clk = { | ||
398 | .name = "aclk_100", | ||
399 | }, | ||
400 | .sources = &exynos4_clkset_aclk, | ||
401 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 }, | ||
402 | .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 }, | ||
403 | }; | ||
404 | |||
405 | static struct clksrc_clk exynos4_clk_aclk_160 = { | ||
406 | .clk = { | ||
407 | .name = "aclk_160", | ||
408 | }, | ||
409 | .sources = &exynos4_clkset_aclk, | ||
410 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 }, | ||
411 | .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 }, | ||
412 | }; | ||
413 | |||
414 | struct clksrc_clk exynos4_clk_aclk_133 = { | ||
415 | .clk = { | ||
416 | .name = "aclk_133", | ||
417 | }, | ||
418 | .sources = &exynos4_clkset_aclk, | ||
419 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 }, | ||
420 | .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 }, | ||
421 | }; | ||
422 | |||
423 | static struct clk *exynos4_clkset_vpllsrc_list[] = { | ||
424 | [0] = &clk_fin_vpll, | ||
425 | [1] = &exynos4_clk_sclk_hdmi27m, | ||
426 | }; | ||
427 | |||
428 | static struct clksrc_sources exynos4_clkset_vpllsrc = { | ||
429 | .sources = exynos4_clkset_vpllsrc_list, | ||
430 | .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list), | ||
431 | }; | ||
432 | |||
433 | static struct clksrc_clk exynos4_clk_vpllsrc = { | ||
434 | .clk = { | ||
435 | .name = "vpll_src", | ||
436 | .enable = exynos4_clksrc_mask_top_ctrl, | ||
437 | .ctrlbit = (1 << 0), | ||
438 | }, | ||
439 | .sources = &exynos4_clkset_vpllsrc, | ||
440 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 }, | ||
441 | }; | ||
442 | |||
443 | static struct clk *exynos4_clkset_sclk_vpll_list[] = { | ||
444 | [0] = &exynos4_clk_vpllsrc.clk, | ||
445 | [1] = &clk_fout_vpll, | ||
446 | }; | ||
447 | |||
448 | static struct clksrc_sources exynos4_clkset_sclk_vpll = { | ||
449 | .sources = exynos4_clkset_sclk_vpll_list, | ||
450 | .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list), | ||
451 | }; | ||
452 | |||
453 | static struct clksrc_clk exynos4_clk_sclk_vpll = { | ||
454 | .clk = { | ||
455 | .name = "sclk_vpll", | ||
456 | }, | ||
457 | .sources = &exynos4_clkset_sclk_vpll, | ||
458 | .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 }, | ||
459 | }; | ||
460 | |||
461 | static struct clk exynos4_init_clocks_off[] = { | ||
462 | { | ||
463 | .name = "timers", | ||
464 | .parent = &exynos4_clk_aclk_100.clk, | ||
465 | .enable = exynos4_clk_ip_peril_ctrl, | ||
466 | .ctrlbit = (1<<24), | ||
467 | }, { | ||
468 | .name = "csis", | ||
469 | .devname = "s5p-mipi-csis.0", | ||
470 | .enable = exynos4_clk_ip_cam_ctrl, | ||
471 | .ctrlbit = (1 << 4), | ||
472 | }, { | ||
473 | .name = "csis", | ||
474 | .devname = "s5p-mipi-csis.1", | ||
475 | .enable = exynos4_clk_ip_cam_ctrl, | ||
476 | .ctrlbit = (1 << 5), | ||
477 | }, { | ||
478 | .name = "jpeg", | ||
479 | .id = 0, | ||
480 | .enable = exynos4_clk_ip_cam_ctrl, | ||
481 | .ctrlbit = (1 << 6), | ||
482 | }, { | ||
483 | .name = "fimc", | ||
484 | .devname = "exynos4-fimc.0", | ||
485 | .enable = exynos4_clk_ip_cam_ctrl, | ||
486 | .ctrlbit = (1 << 0), | ||
487 | }, { | ||
488 | .name = "fimc", | ||
489 | .devname = "exynos4-fimc.1", | ||
490 | .enable = exynos4_clk_ip_cam_ctrl, | ||
491 | .ctrlbit = (1 << 1), | ||
492 | }, { | ||
493 | .name = "fimc", | ||
494 | .devname = "exynos4-fimc.2", | ||
495 | .enable = exynos4_clk_ip_cam_ctrl, | ||
496 | .ctrlbit = (1 << 2), | ||
497 | }, { | ||
498 | .name = "fimc", | ||
499 | .devname = "exynos4-fimc.3", | ||
500 | .enable = exynos4_clk_ip_cam_ctrl, | ||
501 | .ctrlbit = (1 << 3), | ||
502 | }, { | ||
503 | .name = "tsi", | ||
504 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
505 | .ctrlbit = (1 << 4), | ||
506 | }, { | ||
507 | .name = "hsmmc", | ||
508 | .devname = "exynos4-sdhci.0", | ||
509 | .parent = &exynos4_clk_aclk_133.clk, | ||
510 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
511 | .ctrlbit = (1 << 5), | ||
512 | }, { | ||
513 | .name = "hsmmc", | ||
514 | .devname = "exynos4-sdhci.1", | ||
515 | .parent = &exynos4_clk_aclk_133.clk, | ||
516 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
517 | .ctrlbit = (1 << 6), | ||
518 | }, { | ||
519 | .name = "hsmmc", | ||
520 | .devname = "exynos4-sdhci.2", | ||
521 | .parent = &exynos4_clk_aclk_133.clk, | ||
522 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
523 | .ctrlbit = (1 << 7), | ||
524 | }, { | ||
525 | .name = "hsmmc", | ||
526 | .devname = "exynos4-sdhci.3", | ||
527 | .parent = &exynos4_clk_aclk_133.clk, | ||
528 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
529 | .ctrlbit = (1 << 8), | ||
530 | }, { | ||
531 | .name = "biu", | ||
532 | .parent = &exynos4_clk_aclk_133.clk, | ||
533 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
534 | .ctrlbit = (1 << 9), | ||
535 | }, { | ||
536 | .name = "onenand", | ||
537 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
538 | .ctrlbit = (1 << 15), | ||
539 | }, { | ||
540 | .name = "nfcon", | ||
541 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
542 | .ctrlbit = (1 << 16), | ||
543 | }, { | ||
544 | .name = "dac", | ||
545 | .devname = "s5p-sdo", | ||
546 | .enable = exynos4_clk_ip_tv_ctrl, | ||
547 | .ctrlbit = (1 << 2), | ||
548 | }, { | ||
549 | .name = "mixer", | ||
550 | .devname = "s5p-mixer", | ||
551 | .enable = exynos4_clk_ip_tv_ctrl, | ||
552 | .ctrlbit = (1 << 1), | ||
553 | }, { | ||
554 | .name = "vp", | ||
555 | .devname = "s5p-mixer", | ||
556 | .enable = exynos4_clk_ip_tv_ctrl, | ||
557 | .ctrlbit = (1 << 0), | ||
558 | }, { | ||
559 | .name = "hdmi", | ||
560 | .devname = "exynos4-hdmi", | ||
561 | .enable = exynos4_clk_ip_tv_ctrl, | ||
562 | .ctrlbit = (1 << 3), | ||
563 | }, { | ||
564 | .name = "hdmiphy", | ||
565 | .devname = "exynos4-hdmi", | ||
566 | .enable = exynos4_clk_hdmiphy_ctrl, | ||
567 | .ctrlbit = (1 << 0), | ||
568 | }, { | ||
569 | .name = "dacphy", | ||
570 | .devname = "s5p-sdo", | ||
571 | .enable = exynos4_clk_dac_ctrl, | ||
572 | .ctrlbit = (1 << 0), | ||
573 | }, { | ||
574 | .name = "adc", | ||
575 | .enable = exynos4_clk_ip_peril_ctrl, | ||
576 | .ctrlbit = (1 << 15), | ||
577 | }, { | ||
578 | .name = "tmu_apbif", | ||
579 | .enable = exynos4_clk_ip_perir_ctrl, | ||
580 | .ctrlbit = (1 << 17), | ||
581 | }, { | ||
582 | .name = "keypad", | ||
583 | .enable = exynos4_clk_ip_perir_ctrl, | ||
584 | .ctrlbit = (1 << 16), | ||
585 | }, { | ||
586 | .name = "rtc", | ||
587 | .enable = exynos4_clk_ip_perir_ctrl, | ||
588 | .ctrlbit = (1 << 15), | ||
589 | }, { | ||
590 | .name = "watchdog", | ||
591 | .parent = &exynos4_clk_aclk_100.clk, | ||
592 | .enable = exynos4_clk_ip_perir_ctrl, | ||
593 | .ctrlbit = (1 << 14), | ||
594 | }, { | ||
595 | .name = "usbhost", | ||
596 | .enable = exynos4_clk_ip_fsys_ctrl , | ||
597 | .ctrlbit = (1 << 12), | ||
598 | }, { | ||
599 | .name = "otg", | ||
600 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
601 | .ctrlbit = (1 << 13), | ||
602 | }, { | ||
603 | .name = "spi", | ||
604 | .devname = "exynos4210-spi.0", | ||
605 | .enable = exynos4_clk_ip_peril_ctrl, | ||
606 | .ctrlbit = (1 << 16), | ||
607 | }, { | ||
608 | .name = "spi", | ||
609 | .devname = "exynos4210-spi.1", | ||
610 | .enable = exynos4_clk_ip_peril_ctrl, | ||
611 | .ctrlbit = (1 << 17), | ||
612 | }, { | ||
613 | .name = "spi", | ||
614 | .devname = "exynos4210-spi.2", | ||
615 | .enable = exynos4_clk_ip_peril_ctrl, | ||
616 | .ctrlbit = (1 << 18), | ||
617 | }, { | ||
618 | .name = "iis", | ||
619 | .devname = "samsung-i2s.1", | ||
620 | .enable = exynos4_clk_ip_peril_ctrl, | ||
621 | .ctrlbit = (1 << 20), | ||
622 | }, { | ||
623 | .name = "iis", | ||
624 | .devname = "samsung-i2s.2", | ||
625 | .enable = exynos4_clk_ip_peril_ctrl, | ||
626 | .ctrlbit = (1 << 21), | ||
627 | }, { | ||
628 | .name = "pcm", | ||
629 | .devname = "samsung-pcm.1", | ||
630 | .enable = exynos4_clk_ip_peril_ctrl, | ||
631 | .ctrlbit = (1 << 22), | ||
632 | }, { | ||
633 | .name = "pcm", | ||
634 | .devname = "samsung-pcm.2", | ||
635 | .enable = exynos4_clk_ip_peril_ctrl, | ||
636 | .ctrlbit = (1 << 23), | ||
637 | }, { | ||
638 | .name = "slimbus", | ||
639 | .enable = exynos4_clk_ip_peril_ctrl, | ||
640 | .ctrlbit = (1 << 25), | ||
641 | }, { | ||
642 | .name = "spdif", | ||
643 | .devname = "samsung-spdif", | ||
644 | .enable = exynos4_clk_ip_peril_ctrl, | ||
645 | .ctrlbit = (1 << 26), | ||
646 | }, { | ||
647 | .name = "ac97", | ||
648 | .devname = "samsung-ac97", | ||
649 | .enable = exynos4_clk_ip_peril_ctrl, | ||
650 | .ctrlbit = (1 << 27), | ||
651 | }, { | ||
652 | .name = "mfc", | ||
653 | .devname = "s5p-mfc", | ||
654 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
655 | .ctrlbit = (1 << 0), | ||
656 | }, { | ||
657 | .name = "i2c", | ||
658 | .devname = "s3c2440-i2c.0", | ||
659 | .parent = &exynos4_clk_aclk_100.clk, | ||
660 | .enable = exynos4_clk_ip_peril_ctrl, | ||
661 | .ctrlbit = (1 << 6), | ||
662 | }, { | ||
663 | .name = "i2c", | ||
664 | .devname = "s3c2440-i2c.1", | ||
665 | .parent = &exynos4_clk_aclk_100.clk, | ||
666 | .enable = exynos4_clk_ip_peril_ctrl, | ||
667 | .ctrlbit = (1 << 7), | ||
668 | }, { | ||
669 | .name = "i2c", | ||
670 | .devname = "s3c2440-i2c.2", | ||
671 | .parent = &exynos4_clk_aclk_100.clk, | ||
672 | .enable = exynos4_clk_ip_peril_ctrl, | ||
673 | .ctrlbit = (1 << 8), | ||
674 | }, { | ||
675 | .name = "i2c", | ||
676 | .devname = "s3c2440-i2c.3", | ||
677 | .parent = &exynos4_clk_aclk_100.clk, | ||
678 | .enable = exynos4_clk_ip_peril_ctrl, | ||
679 | .ctrlbit = (1 << 9), | ||
680 | }, { | ||
681 | .name = "i2c", | ||
682 | .devname = "s3c2440-i2c.4", | ||
683 | .parent = &exynos4_clk_aclk_100.clk, | ||
684 | .enable = exynos4_clk_ip_peril_ctrl, | ||
685 | .ctrlbit = (1 << 10), | ||
686 | }, { | ||
687 | .name = "i2c", | ||
688 | .devname = "s3c2440-i2c.5", | ||
689 | .parent = &exynos4_clk_aclk_100.clk, | ||
690 | .enable = exynos4_clk_ip_peril_ctrl, | ||
691 | .ctrlbit = (1 << 11), | ||
692 | }, { | ||
693 | .name = "i2c", | ||
694 | .devname = "s3c2440-i2c.6", | ||
695 | .parent = &exynos4_clk_aclk_100.clk, | ||
696 | .enable = exynos4_clk_ip_peril_ctrl, | ||
697 | .ctrlbit = (1 << 12), | ||
698 | }, { | ||
699 | .name = "i2c", | ||
700 | .devname = "s3c2440-i2c.7", | ||
701 | .parent = &exynos4_clk_aclk_100.clk, | ||
702 | .enable = exynos4_clk_ip_peril_ctrl, | ||
703 | .ctrlbit = (1 << 13), | ||
704 | }, { | ||
705 | .name = "i2c", | ||
706 | .devname = "s3c2440-hdmiphy-i2c", | ||
707 | .parent = &exynos4_clk_aclk_100.clk, | ||
708 | .enable = exynos4_clk_ip_peril_ctrl, | ||
709 | .ctrlbit = (1 << 14), | ||
710 | }, { | ||
711 | .name = "sysmmu", | ||
712 | .devname = "exynos-sysmmu.0", | ||
713 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
714 | .ctrlbit = (1 << 1), | ||
715 | }, { | ||
716 | .name = "sysmmu", | ||
717 | .devname = "exynos-sysmmu.1", | ||
718 | .enable = exynos4_clk_ip_mfc_ctrl, | ||
719 | .ctrlbit = (1 << 2), | ||
720 | }, { | ||
721 | .name = "sysmmu", | ||
722 | .devname = "exynos-sysmmu.2", | ||
723 | .enable = exynos4_clk_ip_tv_ctrl, | ||
724 | .ctrlbit = (1 << 4), | ||
725 | }, { | ||
726 | .name = "sysmmu", | ||
727 | .devname = "exynos-sysmmu.3", | ||
728 | .enable = exynos4_clk_ip_cam_ctrl, | ||
729 | .ctrlbit = (1 << 11), | ||
730 | }, { | ||
731 | .name = "sysmmu", | ||
732 | .devname = "exynos-sysmmu.4", | ||
733 | .enable = exynos4_clk_ip_image_ctrl, | ||
734 | .ctrlbit = (1 << 4), | ||
735 | }, { | ||
736 | .name = "sysmmu", | ||
737 | .devname = "exynos-sysmmu.5", | ||
738 | .enable = exynos4_clk_ip_cam_ctrl, | ||
739 | .ctrlbit = (1 << 7), | ||
740 | }, { | ||
741 | .name = "sysmmu", | ||
742 | .devname = "exynos-sysmmu.6", | ||
743 | .enable = exynos4_clk_ip_cam_ctrl, | ||
744 | .ctrlbit = (1 << 8), | ||
745 | }, { | ||
746 | .name = "sysmmu", | ||
747 | .devname = "exynos-sysmmu.7", | ||
748 | .enable = exynos4_clk_ip_cam_ctrl, | ||
749 | .ctrlbit = (1 << 9), | ||
750 | }, { | ||
751 | .name = "sysmmu", | ||
752 | .devname = "exynos-sysmmu.8", | ||
753 | .enable = exynos4_clk_ip_cam_ctrl, | ||
754 | .ctrlbit = (1 << 10), | ||
755 | }, { | ||
756 | .name = "sysmmu", | ||
757 | .devname = "exynos-sysmmu.10", | ||
758 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
759 | .ctrlbit = (1 << 4), | ||
760 | } | ||
761 | }; | ||
762 | |||
763 | static struct clk exynos4_init_clocks_on[] = { | ||
764 | { | ||
765 | .name = "uart", | ||
766 | .devname = "s5pv210-uart.0", | ||
767 | .enable = exynos4_clk_ip_peril_ctrl, | ||
768 | .ctrlbit = (1 << 0), | ||
769 | }, { | ||
770 | .name = "uart", | ||
771 | .devname = "s5pv210-uart.1", | ||
772 | .enable = exynos4_clk_ip_peril_ctrl, | ||
773 | .ctrlbit = (1 << 1), | ||
774 | }, { | ||
775 | .name = "uart", | ||
776 | .devname = "s5pv210-uart.2", | ||
777 | .enable = exynos4_clk_ip_peril_ctrl, | ||
778 | .ctrlbit = (1 << 2), | ||
779 | }, { | ||
780 | .name = "uart", | ||
781 | .devname = "s5pv210-uart.3", | ||
782 | .enable = exynos4_clk_ip_peril_ctrl, | ||
783 | .ctrlbit = (1 << 3), | ||
784 | }, { | ||
785 | .name = "uart", | ||
786 | .devname = "s5pv210-uart.4", | ||
787 | .enable = exynos4_clk_ip_peril_ctrl, | ||
788 | .ctrlbit = (1 << 4), | ||
789 | }, { | ||
790 | .name = "uart", | ||
791 | .devname = "s5pv210-uart.5", | ||
792 | .enable = exynos4_clk_ip_peril_ctrl, | ||
793 | .ctrlbit = (1 << 5), | ||
794 | } | ||
795 | }; | ||
796 | |||
797 | static struct clk exynos4_clk_pdma0 = { | ||
798 | .name = "dma", | ||
799 | .devname = "dma-pl330.0", | ||
800 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
801 | .ctrlbit = (1 << 0), | ||
802 | }; | ||
803 | |||
804 | static struct clk exynos4_clk_pdma1 = { | ||
805 | .name = "dma", | ||
806 | .devname = "dma-pl330.1", | ||
807 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
808 | .ctrlbit = (1 << 1), | ||
809 | }; | ||
810 | |||
811 | static struct clk exynos4_clk_mdma1 = { | ||
812 | .name = "dma", | ||
813 | .devname = "dma-pl330.2", | ||
814 | .enable = exynos4_clk_ip_image_ctrl, | ||
815 | .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)), | ||
816 | }; | ||
817 | |||
818 | static struct clk exynos4_clk_fimd0 = { | ||
819 | .name = "fimd", | ||
820 | .devname = "exynos4-fb.0", | ||
821 | .enable = exynos4_clk_ip_lcd0_ctrl, | ||
822 | .ctrlbit = (1 << 0), | ||
823 | }; | ||
824 | |||
825 | struct clk *exynos4_clkset_group_list[] = { | ||
826 | [0] = &clk_ext_xtal_mux, | ||
827 | [1] = &clk_xusbxti, | ||
828 | [2] = &exynos4_clk_sclk_hdmi27m, | ||
829 | [3] = &exynos4_clk_sclk_usbphy0, | ||
830 | [4] = &exynos4_clk_sclk_usbphy1, | ||
831 | [5] = &exynos4_clk_sclk_hdmiphy, | ||
832 | [6] = &exynos4_clk_mout_mpll.clk, | ||
833 | [7] = &exynos4_clk_mout_epll.clk, | ||
834 | [8] = &exynos4_clk_sclk_vpll.clk, | ||
835 | }; | ||
836 | |||
837 | struct clksrc_sources exynos4_clkset_group = { | ||
838 | .sources = exynos4_clkset_group_list, | ||
839 | .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list), | ||
840 | }; | ||
841 | |||
842 | static struct clk *exynos4_clkset_mout_g2d0_list[] = { | ||
843 | [0] = &exynos4_clk_mout_mpll.clk, | ||
844 | [1] = &exynos4_clk_sclk_apll.clk, | ||
845 | }; | ||
846 | |||
847 | struct clksrc_sources exynos4_clkset_mout_g2d0 = { | ||
848 | .sources = exynos4_clkset_mout_g2d0_list, | ||
849 | .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list), | ||
850 | }; | ||
851 | |||
852 | static struct clk *exynos4_clkset_mout_g2d1_list[] = { | ||
853 | [0] = &exynos4_clk_mout_epll.clk, | ||
854 | [1] = &exynos4_clk_sclk_vpll.clk, | ||
855 | }; | ||
856 | |||
857 | struct clksrc_sources exynos4_clkset_mout_g2d1 = { | ||
858 | .sources = exynos4_clkset_mout_g2d1_list, | ||
859 | .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list), | ||
860 | }; | ||
861 | |||
862 | static struct clk *exynos4_clkset_mout_mfc0_list[] = { | ||
863 | [0] = &exynos4_clk_mout_mpll.clk, | ||
864 | [1] = &exynos4_clk_sclk_apll.clk, | ||
865 | }; | ||
866 | |||
867 | static struct clksrc_sources exynos4_clkset_mout_mfc0 = { | ||
868 | .sources = exynos4_clkset_mout_mfc0_list, | ||
869 | .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list), | ||
870 | }; | ||
871 | |||
872 | static struct clksrc_clk exynos4_clk_mout_mfc0 = { | ||
873 | .clk = { | ||
874 | .name = "mout_mfc0", | ||
875 | }, | ||
876 | .sources = &exynos4_clkset_mout_mfc0, | ||
877 | .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 }, | ||
878 | }; | ||
879 | |||
880 | static struct clk *exynos4_clkset_mout_mfc1_list[] = { | ||
881 | [0] = &exynos4_clk_mout_epll.clk, | ||
882 | [1] = &exynos4_clk_sclk_vpll.clk, | ||
883 | }; | ||
884 | |||
885 | static struct clksrc_sources exynos4_clkset_mout_mfc1 = { | ||
886 | .sources = exynos4_clkset_mout_mfc1_list, | ||
887 | .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list), | ||
888 | }; | ||
889 | |||
890 | static struct clksrc_clk exynos4_clk_mout_mfc1 = { | ||
891 | .clk = { | ||
892 | .name = "mout_mfc1", | ||
893 | }, | ||
894 | .sources = &exynos4_clkset_mout_mfc1, | ||
895 | .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 }, | ||
896 | }; | ||
897 | |||
898 | static struct clk *exynos4_clkset_mout_mfc_list[] = { | ||
899 | [0] = &exynos4_clk_mout_mfc0.clk, | ||
900 | [1] = &exynos4_clk_mout_mfc1.clk, | ||
901 | }; | ||
902 | |||
903 | static struct clksrc_sources exynos4_clkset_mout_mfc = { | ||
904 | .sources = exynos4_clkset_mout_mfc_list, | ||
905 | .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list), | ||
906 | }; | ||
907 | |||
908 | static struct clk *exynos4_clkset_sclk_dac_list[] = { | ||
909 | [0] = &exynos4_clk_sclk_vpll.clk, | ||
910 | [1] = &exynos4_clk_sclk_hdmiphy, | ||
911 | }; | ||
912 | |||
913 | static struct clksrc_sources exynos4_clkset_sclk_dac = { | ||
914 | .sources = exynos4_clkset_sclk_dac_list, | ||
915 | .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list), | ||
916 | }; | ||
917 | |||
918 | static struct clksrc_clk exynos4_clk_sclk_dac = { | ||
919 | .clk = { | ||
920 | .name = "sclk_dac", | ||
921 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
922 | .ctrlbit = (1 << 8), | ||
923 | }, | ||
924 | .sources = &exynos4_clkset_sclk_dac, | ||
925 | .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 }, | ||
926 | }; | ||
927 | |||
928 | static struct clksrc_clk exynos4_clk_sclk_pixel = { | ||
929 | .clk = { | ||
930 | .name = "sclk_pixel", | ||
931 | .parent = &exynos4_clk_sclk_vpll.clk, | ||
932 | }, | ||
933 | .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 }, | ||
934 | }; | ||
935 | |||
936 | static struct clk *exynos4_clkset_sclk_hdmi_list[] = { | ||
937 | [0] = &exynos4_clk_sclk_pixel.clk, | ||
938 | [1] = &exynos4_clk_sclk_hdmiphy, | ||
939 | }; | ||
940 | |||
941 | static struct clksrc_sources exynos4_clkset_sclk_hdmi = { | ||
942 | .sources = exynos4_clkset_sclk_hdmi_list, | ||
943 | .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list), | ||
944 | }; | ||
945 | |||
946 | static struct clksrc_clk exynos4_clk_sclk_hdmi = { | ||
947 | .clk = { | ||
948 | .name = "sclk_hdmi", | ||
949 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
950 | .ctrlbit = (1 << 0), | ||
951 | }, | ||
952 | .sources = &exynos4_clkset_sclk_hdmi, | ||
953 | .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 }, | ||
954 | }; | ||
955 | |||
956 | static struct clk *exynos4_clkset_sclk_mixer_list[] = { | ||
957 | [0] = &exynos4_clk_sclk_dac.clk, | ||
958 | [1] = &exynos4_clk_sclk_hdmi.clk, | ||
959 | }; | ||
960 | |||
961 | static struct clksrc_sources exynos4_clkset_sclk_mixer = { | ||
962 | .sources = exynos4_clkset_sclk_mixer_list, | ||
963 | .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list), | ||
964 | }; | ||
965 | |||
966 | static struct clksrc_clk exynos4_clk_sclk_mixer = { | ||
967 | .clk = { | ||
968 | .name = "sclk_mixer", | ||
969 | .enable = exynos4_clksrc_mask_tv_ctrl, | ||
970 | .ctrlbit = (1 << 4), | ||
971 | }, | ||
972 | .sources = &exynos4_clkset_sclk_mixer, | ||
973 | .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 }, | ||
974 | }; | ||
975 | |||
976 | static struct clksrc_clk *exynos4_sclk_tv[] = { | ||
977 | &exynos4_clk_sclk_dac, | ||
978 | &exynos4_clk_sclk_pixel, | ||
979 | &exynos4_clk_sclk_hdmi, | ||
980 | &exynos4_clk_sclk_mixer, | ||
981 | }; | ||
982 | |||
983 | static struct clksrc_clk exynos4_clk_dout_mmc0 = { | ||
984 | .clk = { | ||
985 | .name = "dout_mmc0", | ||
986 | }, | ||
987 | .sources = &exynos4_clkset_group, | ||
988 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 }, | ||
989 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 }, | ||
990 | }; | ||
991 | |||
992 | static struct clksrc_clk exynos4_clk_dout_mmc1 = { | ||
993 | .clk = { | ||
994 | .name = "dout_mmc1", | ||
995 | }, | ||
996 | .sources = &exynos4_clkset_group, | ||
997 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 }, | ||
998 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 }, | ||
999 | }; | ||
1000 | |||
1001 | static struct clksrc_clk exynos4_clk_dout_mmc2 = { | ||
1002 | .clk = { | ||
1003 | .name = "dout_mmc2", | ||
1004 | }, | ||
1005 | .sources = &exynos4_clkset_group, | ||
1006 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 }, | ||
1007 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 }, | ||
1008 | }; | ||
1009 | |||
1010 | static struct clksrc_clk exynos4_clk_dout_mmc3 = { | ||
1011 | .clk = { | ||
1012 | .name = "dout_mmc3", | ||
1013 | }, | ||
1014 | .sources = &exynos4_clkset_group, | ||
1015 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 }, | ||
1016 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 }, | ||
1017 | }; | ||
1018 | |||
1019 | static struct clksrc_clk exynos4_clk_dout_mmc4 = { | ||
1020 | .clk = { | ||
1021 | .name = "dout_mmc4", | ||
1022 | }, | ||
1023 | .sources = &exynos4_clkset_group, | ||
1024 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 }, | ||
1025 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 }, | ||
1026 | }; | ||
1027 | |||
1028 | static struct clksrc_clk exynos4_clksrcs[] = { | ||
1029 | { | ||
1030 | .clk = { | ||
1031 | .name = "sclk_pwm", | ||
1032 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1033 | .ctrlbit = (1 << 24), | ||
1034 | }, | ||
1035 | .sources = &exynos4_clkset_group, | ||
1036 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 }, | ||
1037 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 }, | ||
1038 | }, { | ||
1039 | .clk = { | ||
1040 | .name = "sclk_csis", | ||
1041 | .devname = "s5p-mipi-csis.0", | ||
1042 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1043 | .ctrlbit = (1 << 24), | ||
1044 | }, | ||
1045 | .sources = &exynos4_clkset_group, | ||
1046 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 }, | ||
1047 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 }, | ||
1048 | }, { | ||
1049 | .clk = { | ||
1050 | .name = "sclk_csis", | ||
1051 | .devname = "s5p-mipi-csis.1", | ||
1052 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1053 | .ctrlbit = (1 << 28), | ||
1054 | }, | ||
1055 | .sources = &exynos4_clkset_group, | ||
1056 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 }, | ||
1057 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 }, | ||
1058 | }, { | ||
1059 | .clk = { | ||
1060 | .name = "sclk_cam0", | ||
1061 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1062 | .ctrlbit = (1 << 16), | ||
1063 | }, | ||
1064 | .sources = &exynos4_clkset_group, | ||
1065 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 }, | ||
1066 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 }, | ||
1067 | }, { | ||
1068 | .clk = { | ||
1069 | .name = "sclk_cam1", | ||
1070 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1071 | .ctrlbit = (1 << 20), | ||
1072 | }, | ||
1073 | .sources = &exynos4_clkset_group, | ||
1074 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 }, | ||
1075 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 }, | ||
1076 | }, { | ||
1077 | .clk = { | ||
1078 | .name = "sclk_fimc", | ||
1079 | .devname = "exynos4-fimc.0", | ||
1080 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1081 | .ctrlbit = (1 << 0), | ||
1082 | }, | ||
1083 | .sources = &exynos4_clkset_group, | ||
1084 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 }, | ||
1085 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 }, | ||
1086 | }, { | ||
1087 | .clk = { | ||
1088 | .name = "sclk_fimc", | ||
1089 | .devname = "exynos4-fimc.1", | ||
1090 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1091 | .ctrlbit = (1 << 4), | ||
1092 | }, | ||
1093 | .sources = &exynos4_clkset_group, | ||
1094 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 }, | ||
1095 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 }, | ||
1096 | }, { | ||
1097 | .clk = { | ||
1098 | .name = "sclk_fimc", | ||
1099 | .devname = "exynos4-fimc.2", | ||
1100 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1101 | .ctrlbit = (1 << 8), | ||
1102 | }, | ||
1103 | .sources = &exynos4_clkset_group, | ||
1104 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 }, | ||
1105 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 }, | ||
1106 | }, { | ||
1107 | .clk = { | ||
1108 | .name = "sclk_fimc", | ||
1109 | .devname = "exynos4-fimc.3", | ||
1110 | .enable = exynos4_clksrc_mask_cam_ctrl, | ||
1111 | .ctrlbit = (1 << 12), | ||
1112 | }, | ||
1113 | .sources = &exynos4_clkset_group, | ||
1114 | .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 }, | ||
1115 | .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 }, | ||
1116 | }, { | ||
1117 | .clk = { | ||
1118 | .name = "sclk_fimd", | ||
1119 | .devname = "exynos4-fb.0", | ||
1120 | .enable = exynos4_clksrc_mask_lcd0_ctrl, | ||
1121 | .ctrlbit = (1 << 0), | ||
1122 | }, | ||
1123 | .sources = &exynos4_clkset_group, | ||
1124 | .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 }, | ||
1125 | .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 }, | ||
1126 | }, { | ||
1127 | .clk = { | ||
1128 | .name = "sclk_mfc", | ||
1129 | .devname = "s5p-mfc", | ||
1130 | }, | ||
1131 | .sources = &exynos4_clkset_mout_mfc, | ||
1132 | .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 }, | ||
1133 | .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 }, | ||
1134 | }, { | ||
1135 | .clk = { | ||
1136 | .name = "ciu", | ||
1137 | .parent = &exynos4_clk_dout_mmc4.clk, | ||
1138 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1139 | .ctrlbit = (1 << 16), | ||
1140 | }, | ||
1141 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 }, | ||
1142 | } | ||
1143 | }; | ||
1144 | |||
1145 | static struct clksrc_clk exynos4_clk_sclk_uart0 = { | ||
1146 | .clk = { | ||
1147 | .name = "uclk1", | ||
1148 | .devname = "exynos4210-uart.0", | ||
1149 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1150 | .ctrlbit = (1 << 0), | ||
1151 | }, | ||
1152 | .sources = &exynos4_clkset_group, | ||
1153 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 }, | ||
1154 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 }, | ||
1155 | }; | ||
1156 | |||
1157 | static struct clksrc_clk exynos4_clk_sclk_uart1 = { | ||
1158 | .clk = { | ||
1159 | .name = "uclk1", | ||
1160 | .devname = "exynos4210-uart.1", | ||
1161 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1162 | .ctrlbit = (1 << 4), | ||
1163 | }, | ||
1164 | .sources = &exynos4_clkset_group, | ||
1165 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 }, | ||
1166 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 }, | ||
1167 | }; | ||
1168 | |||
1169 | static struct clksrc_clk exynos4_clk_sclk_uart2 = { | ||
1170 | .clk = { | ||
1171 | .name = "uclk1", | ||
1172 | .devname = "exynos4210-uart.2", | ||
1173 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1174 | .ctrlbit = (1 << 8), | ||
1175 | }, | ||
1176 | .sources = &exynos4_clkset_group, | ||
1177 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 }, | ||
1178 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 }, | ||
1179 | }; | ||
1180 | |||
1181 | static struct clksrc_clk exynos4_clk_sclk_uart3 = { | ||
1182 | .clk = { | ||
1183 | .name = "uclk1", | ||
1184 | .devname = "exynos4210-uart.3", | ||
1185 | .enable = exynos4_clksrc_mask_peril0_ctrl, | ||
1186 | .ctrlbit = (1 << 12), | ||
1187 | }, | ||
1188 | .sources = &exynos4_clkset_group, | ||
1189 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 }, | ||
1190 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 }, | ||
1191 | }; | ||
1192 | |||
1193 | static struct clksrc_clk exynos4_clk_sclk_mmc0 = { | ||
1194 | .clk = { | ||
1195 | .name = "sclk_mmc", | ||
1196 | .devname = "exynos4-sdhci.0", | ||
1197 | .parent = &exynos4_clk_dout_mmc0.clk, | ||
1198 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1199 | .ctrlbit = (1 << 0), | ||
1200 | }, | ||
1201 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 }, | ||
1202 | }; | ||
1203 | |||
1204 | static struct clksrc_clk exynos4_clk_sclk_mmc1 = { | ||
1205 | .clk = { | ||
1206 | .name = "sclk_mmc", | ||
1207 | .devname = "exynos4-sdhci.1", | ||
1208 | .parent = &exynos4_clk_dout_mmc1.clk, | ||
1209 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1210 | .ctrlbit = (1 << 4), | ||
1211 | }, | ||
1212 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 }, | ||
1213 | }; | ||
1214 | |||
1215 | static struct clksrc_clk exynos4_clk_sclk_mmc2 = { | ||
1216 | .clk = { | ||
1217 | .name = "sclk_mmc", | ||
1218 | .devname = "exynos4-sdhci.2", | ||
1219 | .parent = &exynos4_clk_dout_mmc2.clk, | ||
1220 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1221 | .ctrlbit = (1 << 8), | ||
1222 | }, | ||
1223 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 }, | ||
1224 | }; | ||
1225 | |||
1226 | static struct clksrc_clk exynos4_clk_sclk_mmc3 = { | ||
1227 | .clk = { | ||
1228 | .name = "sclk_mmc", | ||
1229 | .devname = "exynos4-sdhci.3", | ||
1230 | .parent = &exynos4_clk_dout_mmc3.clk, | ||
1231 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
1232 | .ctrlbit = (1 << 12), | ||
1233 | }, | ||
1234 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 }, | ||
1235 | }; | ||
1236 | |||
1237 | static struct clksrc_clk exynos4_clk_mdout_spi0 = { | ||
1238 | .clk = { | ||
1239 | .name = "mdout_spi", | ||
1240 | .devname = "exynos4210-spi.0", | ||
1241 | }, | ||
1242 | .sources = &exynos4_clkset_group, | ||
1243 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 }, | ||
1244 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 }, | ||
1245 | }; | ||
1246 | |||
1247 | static struct clksrc_clk exynos4_clk_mdout_spi1 = { | ||
1248 | .clk = { | ||
1249 | .name = "mdout_spi", | ||
1250 | .devname = "exynos4210-spi.1", | ||
1251 | }, | ||
1252 | .sources = &exynos4_clkset_group, | ||
1253 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 }, | ||
1254 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 }, | ||
1255 | }; | ||
1256 | |||
1257 | static struct clksrc_clk exynos4_clk_mdout_spi2 = { | ||
1258 | .clk = { | ||
1259 | .name = "mdout_spi", | ||
1260 | .devname = "exynos4210-spi.2", | ||
1261 | }, | ||
1262 | .sources = &exynos4_clkset_group, | ||
1263 | .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 }, | ||
1264 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 }, | ||
1265 | }; | ||
1266 | |||
1267 | static struct clksrc_clk exynos4_clk_sclk_spi0 = { | ||
1268 | .clk = { | ||
1269 | .name = "sclk_spi", | ||
1270 | .devname = "exynos4210-spi.0", | ||
1271 | .parent = &exynos4_clk_mdout_spi0.clk, | ||
1272 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1273 | .ctrlbit = (1 << 16), | ||
1274 | }, | ||
1275 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 8, .size = 8 }, | ||
1276 | }; | ||
1277 | |||
1278 | static struct clksrc_clk exynos4_clk_sclk_spi1 = { | ||
1279 | .clk = { | ||
1280 | .name = "sclk_spi", | ||
1281 | .devname = "exynos4210-spi.1", | ||
1282 | .parent = &exynos4_clk_mdout_spi1.clk, | ||
1283 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1284 | .ctrlbit = (1 << 20), | ||
1285 | }, | ||
1286 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 24, .size = 8 }, | ||
1287 | }; | ||
1288 | |||
1289 | static struct clksrc_clk exynos4_clk_sclk_spi2 = { | ||
1290 | .clk = { | ||
1291 | .name = "sclk_spi", | ||
1292 | .devname = "exynos4210-spi.2", | ||
1293 | .parent = &exynos4_clk_mdout_spi2.clk, | ||
1294 | .enable = exynos4_clksrc_mask_peril1_ctrl, | ||
1295 | .ctrlbit = (1 << 24), | ||
1296 | }, | ||
1297 | .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 8, .size = 8 }, | ||
1298 | }; | ||
1299 | |||
1300 | /* Clock initialization code */ | ||
1301 | static struct clksrc_clk *exynos4_sysclks[] = { | ||
1302 | &exynos4_clk_mout_apll, | ||
1303 | &exynos4_clk_sclk_apll, | ||
1304 | &exynos4_clk_mout_epll, | ||
1305 | &exynos4_clk_mout_mpll, | ||
1306 | &exynos4_clk_moutcore, | ||
1307 | &exynos4_clk_coreclk, | ||
1308 | &exynos4_clk_armclk, | ||
1309 | &exynos4_clk_aclk_corem0, | ||
1310 | &exynos4_clk_aclk_cores, | ||
1311 | &exynos4_clk_aclk_corem1, | ||
1312 | &exynos4_clk_periphclk, | ||
1313 | &exynos4_clk_mout_corebus, | ||
1314 | &exynos4_clk_sclk_dmc, | ||
1315 | &exynos4_clk_aclk_cored, | ||
1316 | &exynos4_clk_aclk_corep, | ||
1317 | &exynos4_clk_aclk_acp, | ||
1318 | &exynos4_clk_pclk_acp, | ||
1319 | &exynos4_clk_vpllsrc, | ||
1320 | &exynos4_clk_sclk_vpll, | ||
1321 | &exynos4_clk_aclk_200, | ||
1322 | &exynos4_clk_aclk_100, | ||
1323 | &exynos4_clk_aclk_160, | ||
1324 | &exynos4_clk_aclk_133, | ||
1325 | &exynos4_clk_dout_mmc0, | ||
1326 | &exynos4_clk_dout_mmc1, | ||
1327 | &exynos4_clk_dout_mmc2, | ||
1328 | &exynos4_clk_dout_mmc3, | ||
1329 | &exynos4_clk_dout_mmc4, | ||
1330 | &exynos4_clk_mout_mfc0, | ||
1331 | &exynos4_clk_mout_mfc1, | ||
1332 | }; | ||
1333 | |||
1334 | static struct clk *exynos4_clk_cdev[] = { | ||
1335 | &exynos4_clk_pdma0, | ||
1336 | &exynos4_clk_pdma1, | ||
1337 | &exynos4_clk_mdma1, | ||
1338 | &exynos4_clk_fimd0, | ||
1339 | }; | ||
1340 | |||
1341 | static struct clksrc_clk *exynos4_clksrc_cdev[] = { | ||
1342 | &exynos4_clk_sclk_uart0, | ||
1343 | &exynos4_clk_sclk_uart1, | ||
1344 | &exynos4_clk_sclk_uart2, | ||
1345 | &exynos4_clk_sclk_uart3, | ||
1346 | &exynos4_clk_sclk_mmc0, | ||
1347 | &exynos4_clk_sclk_mmc1, | ||
1348 | &exynos4_clk_sclk_mmc2, | ||
1349 | &exynos4_clk_sclk_mmc3, | ||
1350 | &exynos4_clk_sclk_spi0, | ||
1351 | &exynos4_clk_sclk_spi1, | ||
1352 | &exynos4_clk_sclk_spi2, | ||
1353 | &exynos4_clk_mdout_spi0, | ||
1354 | &exynos4_clk_mdout_spi1, | ||
1355 | &exynos4_clk_mdout_spi2, | ||
1356 | }; | ||
1357 | |||
1358 | static struct clk_lookup exynos4_clk_lookup[] = { | ||
1359 | CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk), | ||
1360 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk), | ||
1361 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk), | ||
1362 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk), | ||
1363 | CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk), | ||
1364 | CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), | ||
1365 | CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), | ||
1366 | CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), | ||
1367 | CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0), | ||
1368 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), | ||
1369 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), | ||
1370 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), | ||
1371 | CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), | ||
1372 | CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), | ||
1373 | CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), | ||
1374 | }; | ||
1375 | |||
1376 | static int xtal_rate; | ||
1377 | |||
1378 | static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) | ||
1379 | { | ||
1380 | if (soc_is_exynos4210()) | ||
1381 | return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0), | ||
1382 | pll_4508); | ||
1383 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
1384 | return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0)); | ||
1385 | else | ||
1386 | return 0; | ||
1387 | } | ||
1388 | |||
1389 | static struct clk_ops exynos4_fout_apll_ops = { | ||
1390 | .get_rate = exynos4_fout_apll_get_rate, | ||
1391 | }; | ||
1392 | |||
1393 | static u32 exynos4_vpll_div[][8] = { | ||
1394 | { 54000000, 3, 53, 3, 1024, 0, 17, 0 }, | ||
1395 | { 108000000, 3, 53, 2, 1024, 0, 17, 0 }, | ||
1396 | }; | ||
1397 | |||
1398 | static unsigned long exynos4_vpll_get_rate(struct clk *clk) | ||
1399 | { | ||
1400 | return clk->rate; | ||
1401 | } | ||
1402 | |||
1403 | static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate) | ||
1404 | { | ||
1405 | unsigned int vpll_con0, vpll_con1 = 0; | ||
1406 | unsigned int i; | ||
1407 | |||
1408 | /* Return if nothing changed */ | ||
1409 | if (clk->rate == rate) | ||
1410 | return 0; | ||
1411 | |||
1412 | vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0); | ||
1413 | vpll_con0 &= ~(0x1 << 27 | \ | ||
1414 | PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \ | ||
1415 | PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \ | ||
1416 | PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); | ||
1417 | |||
1418 | vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1); | ||
1419 | vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \ | ||
1420 | PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \ | ||
1421 | PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT); | ||
1422 | |||
1423 | for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) { | ||
1424 | if (exynos4_vpll_div[i][0] == rate) { | ||
1425 | vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT; | ||
1426 | vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT; | ||
1427 | vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT; | ||
1428 | vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT; | ||
1429 | vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT; | ||
1430 | vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT; | ||
1431 | vpll_con0 |= exynos4_vpll_div[i][7] << 27; | ||
1432 | break; | ||
1433 | } | ||
1434 | } | ||
1435 | |||
1436 | if (i == ARRAY_SIZE(exynos4_vpll_div)) { | ||
1437 | printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n", | ||
1438 | __func__); | ||
1439 | return -EINVAL; | ||
1440 | } | ||
1441 | |||
1442 | __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0); | ||
1443 | __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1); | ||
1444 | |||
1445 | /* Wait for VPLL lock */ | ||
1446 | while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT))) | ||
1447 | continue; | ||
1448 | |||
1449 | clk->rate = rate; | ||
1450 | return 0; | ||
1451 | } | ||
1452 | |||
1453 | static struct clk_ops exynos4_vpll_ops = { | ||
1454 | .get_rate = exynos4_vpll_get_rate, | ||
1455 | .set_rate = exynos4_vpll_set_rate, | ||
1456 | }; | ||
1457 | |||
1458 | void __init_or_cpufreq exynos4_setup_clocks(void) | ||
1459 | { | ||
1460 | struct clk *xtal_clk; | ||
1461 | unsigned long apll = 0; | ||
1462 | unsigned long mpll = 0; | ||
1463 | unsigned long epll = 0; | ||
1464 | unsigned long vpll = 0; | ||
1465 | unsigned long vpllsrc; | ||
1466 | unsigned long xtal; | ||
1467 | unsigned long armclk; | ||
1468 | unsigned long sclk_dmc; | ||
1469 | unsigned long aclk_200; | ||
1470 | unsigned long aclk_100; | ||
1471 | unsigned long aclk_160; | ||
1472 | unsigned long aclk_133; | ||
1473 | unsigned int ptr; | ||
1474 | |||
1475 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); | ||
1476 | |||
1477 | xtal_clk = clk_get(NULL, "xtal"); | ||
1478 | BUG_ON(IS_ERR(xtal_clk)); | ||
1479 | |||
1480 | xtal = clk_get_rate(xtal_clk); | ||
1481 | |||
1482 | xtal_rate = xtal; | ||
1483 | |||
1484 | clk_put(xtal_clk); | ||
1485 | |||
1486 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | ||
1487 | |||
1488 | if (soc_is_exynos4210()) { | ||
1489 | apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0), | ||
1490 | pll_4508); | ||
1491 | mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0), | ||
1492 | pll_4508); | ||
1493 | epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0), | ||
1494 | __raw_readl(EXYNOS4_EPLL_CON1), pll_4600); | ||
1495 | |||
1496 | vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk); | ||
1497 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0), | ||
1498 | __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c); | ||
1499 | } else if (soc_is_exynos4212() || soc_is_exynos4412()) { | ||
1500 | apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0)); | ||
1501 | mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0)); | ||
1502 | epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0), | ||
1503 | __raw_readl(EXYNOS4_EPLL_CON1)); | ||
1504 | |||
1505 | vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk); | ||
1506 | vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0), | ||
1507 | __raw_readl(EXYNOS4_VPLL_CON1)); | ||
1508 | } else { | ||
1509 | /* nothing */ | ||
1510 | } | ||
1511 | |||
1512 | clk_fout_apll.ops = &exynos4_fout_apll_ops; | ||
1513 | clk_fout_mpll.rate = mpll; | ||
1514 | clk_fout_epll.rate = epll; | ||
1515 | clk_fout_vpll.ops = &exynos4_vpll_ops; | ||
1516 | clk_fout_vpll.rate = vpll; | ||
1517 | |||
1518 | printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld", | ||
1519 | apll, mpll, epll, vpll); | ||
1520 | |||
1521 | armclk = clk_get_rate(&exynos4_clk_armclk.clk); | ||
1522 | sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk); | ||
1523 | |||
1524 | aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk); | ||
1525 | aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk); | ||
1526 | aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk); | ||
1527 | aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk); | ||
1528 | |||
1529 | printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n" | ||
1530 | "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n", | ||
1531 | armclk, sclk_dmc, aclk_200, | ||
1532 | aclk_100, aclk_160, aclk_133); | ||
1533 | |||
1534 | clk_f.rate = armclk; | ||
1535 | clk_h.rate = sclk_dmc; | ||
1536 | clk_p.rate = aclk_100; | ||
1537 | |||
1538 | for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++) | ||
1539 | s3c_set_clksrc(&exynos4_clksrcs[ptr], true); | ||
1540 | } | ||
1541 | |||
1542 | static struct clk *exynos4_clks[] __initdata = { | ||
1543 | &exynos4_clk_sclk_hdmi27m, | ||
1544 | &exynos4_clk_sclk_hdmiphy, | ||
1545 | &exynos4_clk_sclk_usbphy0, | ||
1546 | &exynos4_clk_sclk_usbphy1, | ||
1547 | }; | ||
1548 | |||
1549 | #ifdef CONFIG_PM_SLEEP | ||
1550 | static int exynos4_clock_suspend(void) | ||
1551 | { | ||
1552 | s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1553 | return 0; | ||
1554 | } | ||
1555 | |||
1556 | static void exynos4_clock_resume(void) | ||
1557 | { | ||
1558 | s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1559 | } | ||
1560 | |||
1561 | #else | ||
1562 | #define exynos4_clock_suspend NULL | ||
1563 | #define exynos4_clock_resume NULL | ||
1564 | #endif | ||
1565 | |||
1566 | static struct syscore_ops exynos4_clock_syscore_ops = { | ||
1567 | .suspend = exynos4_clock_suspend, | ||
1568 | .resume = exynos4_clock_resume, | ||
1569 | }; | ||
1570 | |||
1571 | void __init exynos4_register_clocks(void) | ||
1572 | { | ||
1573 | int ptr; | ||
1574 | |||
1575 | s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks)); | ||
1576 | |||
1577 | for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++) | ||
1578 | s3c_register_clksrc(exynos4_sysclks[ptr], 1); | ||
1579 | |||
1580 | for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++) | ||
1581 | s3c_register_clksrc(exynos4_sclk_tv[ptr], 1); | ||
1582 | |||
1583 | for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++) | ||
1584 | s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1); | ||
1585 | |||
1586 | s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs)); | ||
1587 | s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on)); | ||
1588 | |||
1589 | s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev)); | ||
1590 | for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++) | ||
1591 | s3c_disable_clocks(exynos4_clk_cdev[ptr], 1); | ||
1592 | |||
1593 | s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off)); | ||
1594 | s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off)); | ||
1595 | clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup)); | ||
1596 | |||
1597 | register_syscore_ops(&exynos4_clock_syscore_ops); | ||
1598 | s3c24xx_register_clock(&dummy_apb_pclk); | ||
1599 | |||
1600 | s3c_pwmclk_init(); | ||
1601 | } | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4.h b/arch/arm/mach-exynos/clock-exynos4.h deleted file mode 100644 index bd12d5f8b63d..000000000000 --- a/arch/arm/mach-exynos/clock-exynos4.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * Header file for exynos4 clock support | ||
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 __ASM_ARCH_CLOCK_H | ||
13 | #define __ASM_ARCH_CLOCK_H __FILE__ | ||
14 | |||
15 | #include <linux/clk.h> | ||
16 | |||
17 | extern struct clksrc_clk exynos4_clk_aclk_133; | ||
18 | extern struct clksrc_clk exynos4_clk_mout_mpll; | ||
19 | |||
20 | extern struct clksrc_sources exynos4_clkset_mout_corebus; | ||
21 | extern struct clksrc_sources exynos4_clkset_group; | ||
22 | |||
23 | extern struct clk *exynos4_clkset_aclk_top_list[]; | ||
24 | extern struct clk *exynos4_clkset_group_list[]; | ||
25 | |||
26 | extern struct clksrc_sources exynos4_clkset_mout_g2d0; | ||
27 | extern struct clksrc_sources exynos4_clkset_mout_g2d1; | ||
28 | |||
29 | extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable); | ||
30 | extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable); | ||
31 | extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable); | ||
32 | extern int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable); | ||
33 | extern int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable); | ||
34 | |||
35 | #endif /* __ASM_ARCH_CLOCK_H */ | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c deleted file mode 100644 index 19af9f783c56..000000000000 --- a/arch/arm/mach-exynos/clock-exynos4210.c +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * EXYNOS4210 - Clock support | ||
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 | #include <linux/kernel.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/syscore_ops.h> | ||
17 | |||
18 | #include <plat/cpu-freq.h> | ||
19 | #include <plat/clock.h> | ||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/pll.h> | ||
22 | #include <plat/s5p-clock.h> | ||
23 | #include <plat/clock-clksrc.h> | ||
24 | #include <plat/pm.h> | ||
25 | |||
26 | #include <mach/hardware.h> | ||
27 | #include <mach/map.h> | ||
28 | #include <mach/regs-clock.h> | ||
29 | |||
30 | #include "common.h" | ||
31 | #include "clock-exynos4.h" | ||
32 | |||
33 | #ifdef CONFIG_PM_SLEEP | ||
34 | static struct sleep_save exynos4210_clock_save[] = { | ||
35 | SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE), | ||
36 | SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE), | ||
37 | SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1), | ||
38 | SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1), | ||
39 | SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1), | ||
40 | SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE), | ||
41 | SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1), | ||
42 | SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR), | ||
43 | }; | ||
44 | #endif | ||
45 | |||
46 | static struct clksrc_clk *sysclks[] = { | ||
47 | /* nothing here yet */ | ||
48 | }; | ||
49 | |||
50 | static struct clksrc_clk exynos4210_clk_mout_g2d0 = { | ||
51 | .clk = { | ||
52 | .name = "mout_g2d0", | ||
53 | }, | ||
54 | .sources = &exynos4_clkset_mout_g2d0, | ||
55 | .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 }, | ||
56 | }; | ||
57 | |||
58 | static struct clksrc_clk exynos4210_clk_mout_g2d1 = { | ||
59 | .clk = { | ||
60 | .name = "mout_g2d1", | ||
61 | }, | ||
62 | .sources = &exynos4_clkset_mout_g2d1, | ||
63 | .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 }, | ||
64 | }; | ||
65 | |||
66 | static struct clk *exynos4210_clkset_mout_g2d_list[] = { | ||
67 | [0] = &exynos4210_clk_mout_g2d0.clk, | ||
68 | [1] = &exynos4210_clk_mout_g2d1.clk, | ||
69 | }; | ||
70 | |||
71 | static struct clksrc_sources exynos4210_clkset_mout_g2d = { | ||
72 | .sources = exynos4210_clkset_mout_g2d_list, | ||
73 | .nr_sources = ARRAY_SIZE(exynos4210_clkset_mout_g2d_list), | ||
74 | }; | ||
75 | |||
76 | static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) | ||
77 | { | ||
78 | return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable); | ||
79 | } | ||
80 | |||
81 | static struct clksrc_clk clksrcs[] = { | ||
82 | { | ||
83 | .clk = { | ||
84 | .name = "sclk_sata", | ||
85 | .id = -1, | ||
86 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
87 | .ctrlbit = (1 << 24), | ||
88 | }, | ||
89 | .sources = &exynos4_clkset_mout_corebus, | ||
90 | .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 }, | ||
91 | .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 }, | ||
92 | }, { | ||
93 | .clk = { | ||
94 | .name = "sclk_fimd", | ||
95 | .devname = "exynos4-fb.1", | ||
96 | .enable = exynos4_clksrc_mask_lcd1_ctrl, | ||
97 | .ctrlbit = (1 << 0), | ||
98 | }, | ||
99 | .sources = &exynos4_clkset_group, | ||
100 | .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 }, | ||
101 | .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 }, | ||
102 | }, { | ||
103 | .clk = { | ||
104 | .name = "sclk_fimg2d", | ||
105 | }, | ||
106 | .sources = &exynos4210_clkset_mout_g2d, | ||
107 | .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 }, | ||
108 | .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 }, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | static struct clk init_clocks_off[] = { | ||
113 | { | ||
114 | .name = "sataphy", | ||
115 | .id = -1, | ||
116 | .parent = &exynos4_clk_aclk_133.clk, | ||
117 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
118 | .ctrlbit = (1 << 3), | ||
119 | }, { | ||
120 | .name = "sata", | ||
121 | .id = -1, | ||
122 | .parent = &exynos4_clk_aclk_133.clk, | ||
123 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
124 | .ctrlbit = (1 << 10), | ||
125 | }, { | ||
126 | .name = "fimd", | ||
127 | .devname = "exynos4-fb.1", | ||
128 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
129 | .ctrlbit = (1 << 0), | ||
130 | }, { | ||
131 | .name = "sysmmu", | ||
132 | .devname = "exynos-sysmmu.9", | ||
133 | .enable = exynos4_clk_ip_image_ctrl, | ||
134 | .ctrlbit = (1 << 3), | ||
135 | }, { | ||
136 | .name = "sysmmu", | ||
137 | .devname = "exynos-sysmmu.11", | ||
138 | .enable = exynos4_clk_ip_lcd1_ctrl, | ||
139 | .ctrlbit = (1 << 4), | ||
140 | }, { | ||
141 | .name = "fimg2d", | ||
142 | .enable = exynos4_clk_ip_image_ctrl, | ||
143 | .ctrlbit = (1 << 0), | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | #ifdef CONFIG_PM_SLEEP | ||
148 | static int exynos4210_clock_suspend(void) | ||
149 | { | ||
150 | s3c_pm_do_save(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static void exynos4210_clock_resume(void) | ||
156 | { | ||
157 | s3c_pm_do_restore_core(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); | ||
158 | } | ||
159 | |||
160 | #else | ||
161 | #define exynos4210_clock_suspend NULL | ||
162 | #define exynos4210_clock_resume NULL | ||
163 | #endif | ||
164 | |||
165 | static struct syscore_ops exynos4210_clock_syscore_ops = { | ||
166 | .suspend = exynos4210_clock_suspend, | ||
167 | .resume = exynos4210_clock_resume, | ||
168 | }; | ||
169 | |||
170 | void __init exynos4210_register_clocks(void) | ||
171 | { | ||
172 | int ptr; | ||
173 | |||
174 | exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU; | ||
175 | exynos4_clk_mout_mpll.reg_src.shift = 8; | ||
176 | exynos4_clk_mout_mpll.reg_src.size = 1; | ||
177 | |||
178 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
179 | s3c_register_clksrc(sysclks[ptr], 1); | ||
180 | |||
181 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
182 | |||
183 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
184 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
185 | |||
186 | register_syscore_ops(&exynos4210_clock_syscore_ops); | ||
187 | } | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c deleted file mode 100644 index 529476f8ec71..000000000000 --- a/arch/arm/mach-exynos/clock-exynos4212.c +++ /dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * EXYNOS4212 - Clock support | ||
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 | #include <linux/kernel.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/syscore_ops.h> | ||
17 | |||
18 | #include <plat/cpu-freq.h> | ||
19 | #include <plat/clock.h> | ||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/pll.h> | ||
22 | #include <plat/s5p-clock.h> | ||
23 | #include <plat/clock-clksrc.h> | ||
24 | #include <plat/pm.h> | ||
25 | |||
26 | #include <mach/hardware.h> | ||
27 | #include <mach/map.h> | ||
28 | #include <mach/regs-clock.h> | ||
29 | |||
30 | #include "common.h" | ||
31 | #include "clock-exynos4.h" | ||
32 | |||
33 | #ifdef CONFIG_PM_SLEEP | ||
34 | static struct sleep_save exynos4212_clock_save[] = { | ||
35 | SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE), | ||
36 | SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE), | ||
37 | SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE), | ||
38 | SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR), | ||
39 | }; | ||
40 | #endif | ||
41 | |||
42 | static int exynos4212_clk_ip_isp0_ctrl(struct clk *clk, int enable) | ||
43 | { | ||
44 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP0, clk, enable); | ||
45 | } | ||
46 | |||
47 | static int exynos4212_clk_ip_isp1_ctrl(struct clk *clk, int enable) | ||
48 | { | ||
49 | return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP1, clk, enable); | ||
50 | } | ||
51 | |||
52 | static struct clk *clk_src_mpll_user_list[] = { | ||
53 | [0] = &clk_fin_mpll, | ||
54 | [1] = &exynos4_clk_mout_mpll.clk, | ||
55 | }; | ||
56 | |||
57 | static struct clksrc_sources clk_src_mpll_user = { | ||
58 | .sources = clk_src_mpll_user_list, | ||
59 | .nr_sources = ARRAY_SIZE(clk_src_mpll_user_list), | ||
60 | }; | ||
61 | |||
62 | static struct clksrc_clk clk_mout_mpll_user = { | ||
63 | .clk = { | ||
64 | .name = "mout_mpll_user", | ||
65 | }, | ||
66 | .sources = &clk_src_mpll_user, | ||
67 | .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 }, | ||
68 | }; | ||
69 | |||
70 | static struct clksrc_clk exynos4x12_clk_mout_g2d0 = { | ||
71 | .clk = { | ||
72 | .name = "mout_g2d0", | ||
73 | }, | ||
74 | .sources = &exynos4_clkset_mout_g2d0, | ||
75 | .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 20, .size = 1 }, | ||
76 | }; | ||
77 | |||
78 | static struct clksrc_clk exynos4x12_clk_mout_g2d1 = { | ||
79 | .clk = { | ||
80 | .name = "mout_g2d1", | ||
81 | }, | ||
82 | .sources = &exynos4_clkset_mout_g2d1, | ||
83 | .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 24, .size = 1 }, | ||
84 | }; | ||
85 | |||
86 | static struct clk *exynos4x12_clkset_mout_g2d_list[] = { | ||
87 | [0] = &exynos4x12_clk_mout_g2d0.clk, | ||
88 | [1] = &exynos4x12_clk_mout_g2d1.clk, | ||
89 | }; | ||
90 | |||
91 | static struct clksrc_sources exynos4x12_clkset_mout_g2d = { | ||
92 | .sources = exynos4x12_clkset_mout_g2d_list, | ||
93 | .nr_sources = ARRAY_SIZE(exynos4x12_clkset_mout_g2d_list), | ||
94 | }; | ||
95 | |||
96 | static struct clksrc_clk *sysclks[] = { | ||
97 | &clk_mout_mpll_user, | ||
98 | }; | ||
99 | |||
100 | static struct clksrc_clk clksrcs[] = { | ||
101 | { | ||
102 | .clk = { | ||
103 | .name = "sclk_fimg2d", | ||
104 | }, | ||
105 | .sources = &exynos4x12_clkset_mout_g2d, | ||
106 | .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 28, .size = 1 }, | ||
107 | .reg_div = { .reg = EXYNOS4_CLKDIV_DMC1, .shift = 0, .size = 4 }, | ||
108 | }, | ||
109 | }; | ||
110 | |||
111 | static struct clk init_clocks_off[] = { | ||
112 | { | ||
113 | .name = "sysmmu", | ||
114 | .devname = "exynos-sysmmu.9", | ||
115 | .enable = exynos4_clk_ip_dmc_ctrl, | ||
116 | .ctrlbit = (1 << 24), | ||
117 | }, { | ||
118 | .name = "sysmmu", | ||
119 | .devname = "exynos-sysmmu.12", | ||
120 | .enable = exynos4212_clk_ip_isp0_ctrl, | ||
121 | .ctrlbit = (7 << 8), | ||
122 | }, { | ||
123 | .name = "sysmmu", | ||
124 | .devname = "exynos-sysmmu.13", | ||
125 | .enable = exynos4212_clk_ip_isp1_ctrl, | ||
126 | .ctrlbit = (1 << 4), | ||
127 | }, { | ||
128 | .name = "sysmmu", | ||
129 | .devname = "exynos-sysmmu.14", | ||
130 | .enable = exynos4212_clk_ip_isp0_ctrl, | ||
131 | .ctrlbit = (1 << 11), | ||
132 | }, { | ||
133 | .name = "sysmmu", | ||
134 | .devname = "exynos-sysmmu.15", | ||
135 | .enable = exynos4212_clk_ip_isp0_ctrl, | ||
136 | .ctrlbit = (1 << 12), | ||
137 | }, { | ||
138 | .name = "flite", | ||
139 | .devname = "exynos-fimc-lite.0", | ||
140 | .enable = exynos4212_clk_ip_isp0_ctrl, | ||
141 | .ctrlbit = (1 << 4), | ||
142 | }, { | ||
143 | .name = "flite", | ||
144 | .devname = "exynos-fimc-lite.1", | ||
145 | .enable = exynos4212_clk_ip_isp0_ctrl, | ||
146 | .ctrlbit = (1 << 3), | ||
147 | }, { | ||
148 | .name = "fimg2d", | ||
149 | .enable = exynos4_clk_ip_dmc_ctrl, | ||
150 | .ctrlbit = (1 << 23), | ||
151 | }, | ||
152 | }; | ||
153 | |||
154 | #ifdef CONFIG_PM_SLEEP | ||
155 | static int exynos4212_clock_suspend(void) | ||
156 | { | ||
157 | s3c_pm_do_save(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static void exynos4212_clock_resume(void) | ||
163 | { | ||
164 | s3c_pm_do_restore_core(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); | ||
165 | } | ||
166 | |||
167 | #else | ||
168 | #define exynos4212_clock_suspend NULL | ||
169 | #define exynos4212_clock_resume NULL | ||
170 | #endif | ||
171 | |||
172 | static struct syscore_ops exynos4212_clock_syscore_ops = { | ||
173 | .suspend = exynos4212_clock_suspend, | ||
174 | .resume = exynos4212_clock_resume, | ||
175 | }; | ||
176 | |||
177 | void __init exynos4212_register_clocks(void) | ||
178 | { | ||
179 | int ptr; | ||
180 | |||
181 | /* usbphy1 is removed */ | ||
182 | exynos4_clkset_group_list[4] = NULL; | ||
183 | |||
184 | /* mout_mpll_user is used */ | ||
185 | exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk; | ||
186 | exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; | ||
187 | |||
188 | exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC; | ||
189 | exynos4_clk_mout_mpll.reg_src.shift = 12; | ||
190 | exynos4_clk_mout_mpll.reg_src.size = 1; | ||
191 | |||
192 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
193 | s3c_register_clksrc(sysclks[ptr], 1); | ||
194 | |||
195 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
196 | |||
197 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
198 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
199 | |||
200 | register_syscore_ops(&exynos4212_clock_syscore_ops); | ||
201 | } | ||
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c deleted file mode 100644 index b0ea31fc9fb8..000000000000 --- a/arch/arm/mach-exynos/clock-exynos5.c +++ /dev/null | |||
@@ -1,1645 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * Clock support for EXYNOS5 SoCs | ||
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 | #include <linux/kernel.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/syscore_ops.h> | ||
16 | |||
17 | #include <plat/cpu-freq.h> | ||
18 | #include <plat/clock.h> | ||
19 | #include <plat/cpu.h> | ||
20 | #include <plat/pll.h> | ||
21 | #include <plat/s5p-clock.h> | ||
22 | #include <plat/clock-clksrc.h> | ||
23 | #include <plat/pm.h> | ||
24 | |||
25 | #include <mach/map.h> | ||
26 | #include <mach/regs-clock.h> | ||
27 | |||
28 | #include "common.h" | ||
29 | |||
30 | #ifdef CONFIG_PM_SLEEP | ||
31 | static struct sleep_save exynos5_clock_save[] = { | ||
32 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_TOP), | ||
33 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_GSCL), | ||
34 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_DISP1_0), | ||
35 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_FSYS), | ||
36 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_MAUDIO), | ||
37 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC0), | ||
38 | SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC1), | ||
39 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_GSCL), | ||
40 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_DISP1), | ||
41 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_MFC), | ||
42 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_G3D), | ||
43 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_GEN), | ||
44 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_FSYS), | ||
45 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIC), | ||
46 | SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIS), | ||
47 | SAVE_ITEM(EXYNOS5_CLKGATE_BLOCK), | ||
48 | SAVE_ITEM(EXYNOS5_CLKDIV_TOP0), | ||
49 | SAVE_ITEM(EXYNOS5_CLKDIV_TOP1), | ||
50 | SAVE_ITEM(EXYNOS5_CLKDIV_GSCL), | ||
51 | SAVE_ITEM(EXYNOS5_CLKDIV_DISP1_0), | ||
52 | SAVE_ITEM(EXYNOS5_CLKDIV_GEN), | ||
53 | SAVE_ITEM(EXYNOS5_CLKDIV_MAUDIO), | ||
54 | SAVE_ITEM(EXYNOS5_CLKDIV_FSYS0), | ||
55 | SAVE_ITEM(EXYNOS5_CLKDIV_FSYS1), | ||
56 | SAVE_ITEM(EXYNOS5_CLKDIV_FSYS2), | ||
57 | SAVE_ITEM(EXYNOS5_CLKDIV_FSYS3), | ||
58 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC0), | ||
59 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC1), | ||
60 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC2), | ||
61 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC3), | ||
62 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC4), | ||
63 | SAVE_ITEM(EXYNOS5_CLKDIV_PERIC5), | ||
64 | SAVE_ITEM(EXYNOS5_SCLK_DIV_ISP), | ||
65 | SAVE_ITEM(EXYNOS5_CLKSRC_TOP0), | ||
66 | SAVE_ITEM(EXYNOS5_CLKSRC_TOP1), | ||
67 | SAVE_ITEM(EXYNOS5_CLKSRC_TOP2), | ||
68 | SAVE_ITEM(EXYNOS5_CLKSRC_TOP3), | ||
69 | SAVE_ITEM(EXYNOS5_CLKSRC_GSCL), | ||
70 | SAVE_ITEM(EXYNOS5_CLKSRC_DISP1_0), | ||
71 | SAVE_ITEM(EXYNOS5_CLKSRC_MAUDIO), | ||
72 | SAVE_ITEM(EXYNOS5_CLKSRC_FSYS), | ||
73 | SAVE_ITEM(EXYNOS5_CLKSRC_PERIC0), | ||
74 | SAVE_ITEM(EXYNOS5_CLKSRC_PERIC1), | ||
75 | SAVE_ITEM(EXYNOS5_SCLK_SRC_ISP), | ||
76 | SAVE_ITEM(EXYNOS5_EPLL_CON0), | ||
77 | SAVE_ITEM(EXYNOS5_EPLL_CON1), | ||
78 | SAVE_ITEM(EXYNOS5_EPLL_CON2), | ||
79 | SAVE_ITEM(EXYNOS5_VPLL_CON0), | ||
80 | SAVE_ITEM(EXYNOS5_VPLL_CON1), | ||
81 | SAVE_ITEM(EXYNOS5_VPLL_CON2), | ||
82 | SAVE_ITEM(EXYNOS5_PWR_CTRL1), | ||
83 | SAVE_ITEM(EXYNOS5_PWR_CTRL2), | ||
84 | }; | ||
85 | #endif | ||
86 | |||
87 | static struct clk exynos5_clk_sclk_dptxphy = { | ||
88 | .name = "sclk_dptx", | ||
89 | }; | ||
90 | |||
91 | static struct clk exynos5_clk_sclk_hdmi24m = { | ||
92 | .name = "sclk_hdmi24m", | ||
93 | .rate = 24000000, | ||
94 | }; | ||
95 | |||
96 | static struct clk exynos5_clk_sclk_hdmi27m = { | ||
97 | .name = "sclk_hdmi27m", | ||
98 | .rate = 27000000, | ||
99 | }; | ||
100 | |||
101 | static struct clk exynos5_clk_sclk_hdmiphy = { | ||
102 | .name = "sclk_hdmiphy", | ||
103 | }; | ||
104 | |||
105 | static struct clk exynos5_clk_sclk_usbphy = { | ||
106 | .name = "sclk_usbphy", | ||
107 | .rate = 48000000, | ||
108 | }; | ||
109 | |||
110 | static int exynos5_clksrc_mask_top_ctrl(struct clk *clk, int enable) | ||
111 | { | ||
112 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP, clk, enable); | ||
113 | } | ||
114 | |||
115 | static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk *clk, int enable) | ||
116 | { | ||
117 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0, clk, enable); | ||
118 | } | ||
119 | |||
120 | static int exynos5_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) | ||
121 | { | ||
122 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS, clk, enable); | ||
123 | } | ||
124 | |||
125 | static int exynos5_clksrc_mask_gscl_ctrl(struct clk *clk, int enable) | ||
126 | { | ||
127 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL, clk, enable); | ||
128 | } | ||
129 | |||
130 | static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable) | ||
131 | { | ||
132 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable); | ||
133 | } | ||
134 | |||
135 | static int exynos5_clksrc_mask_peric1_ctrl(struct clk *clk, int enable) | ||
136 | { | ||
137 | return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC1, clk, enable); | ||
138 | } | ||
139 | |||
140 | static int exynos5_clk_ip_acp_ctrl(struct clk *clk, int enable) | ||
141 | { | ||
142 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP, clk, enable); | ||
143 | } | ||
144 | |||
145 | static int exynos5_clk_ip_core_ctrl(struct clk *clk, int enable) | ||
146 | { | ||
147 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE, clk, enable); | ||
148 | } | ||
149 | |||
150 | static int exynos5_clk_ip_disp1_ctrl(struct clk *clk, int enable) | ||
151 | { | ||
152 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1, clk, enable); | ||
153 | } | ||
154 | |||
155 | static int exynos5_clk_ip_fsys_ctrl(struct clk *clk, int enable) | ||
156 | { | ||
157 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS, clk, enable); | ||
158 | } | ||
159 | |||
160 | static int exynos5_clk_block_ctrl(struct clk *clk, int enable) | ||
161 | { | ||
162 | return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK, clk, enable); | ||
163 | } | ||
164 | |||
165 | static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable) | ||
166 | { | ||
167 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable); | ||
168 | } | ||
169 | |||
170 | static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable) | ||
171 | { | ||
172 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable); | ||
173 | } | ||
174 | |||
175 | static int exynos5_clk_ip_peric_ctrl(struct clk *clk, int enable) | ||
176 | { | ||
177 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC, clk, enable); | ||
178 | } | ||
179 | |||
180 | static int exynos5_clk_ip_peris_ctrl(struct clk *clk, int enable) | ||
181 | { | ||
182 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS, clk, enable); | ||
183 | } | ||
184 | |||
185 | static int exynos5_clk_ip_gscl_ctrl(struct clk *clk, int enable) | ||
186 | { | ||
187 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GSCL, clk, enable); | ||
188 | } | ||
189 | |||
190 | static int exynos5_clk_ip_isp0_ctrl(struct clk *clk, int enable) | ||
191 | { | ||
192 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP0, clk, enable); | ||
193 | } | ||
194 | |||
195 | static int exynos5_clk_ip_isp1_ctrl(struct clk *clk, int enable) | ||
196 | { | ||
197 | return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1, clk, enable); | ||
198 | } | ||
199 | |||
200 | static int exynos5_clk_hdmiphy_ctrl(struct clk *clk, int enable) | ||
201 | { | ||
202 | return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); | ||
203 | } | ||
204 | |||
205 | /* Core list of CMU_CPU side */ | ||
206 | |||
207 | static struct clksrc_clk exynos5_clk_mout_apll = { | ||
208 | .clk = { | ||
209 | .name = "mout_apll", | ||
210 | }, | ||
211 | .sources = &clk_src_apll, | ||
212 | .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 0, .size = 1 }, | ||
213 | }; | ||
214 | |||
215 | static struct clksrc_clk exynos5_clk_sclk_apll = { | ||
216 | .clk = { | ||
217 | .name = "sclk_apll", | ||
218 | .parent = &exynos5_clk_mout_apll.clk, | ||
219 | }, | ||
220 | .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 24, .size = 3 }, | ||
221 | }; | ||
222 | |||
223 | static struct clksrc_clk exynos5_clk_mout_bpll_fout = { | ||
224 | .clk = { | ||
225 | .name = "mout_bpll_fout", | ||
226 | }, | ||
227 | .sources = &clk_src_bpll_fout, | ||
228 | .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 0, .size = 1 }, | ||
229 | }; | ||
230 | |||
231 | static struct clk *exynos5_clk_src_bpll_list[] = { | ||
232 | [0] = &clk_fin_bpll, | ||
233 | [1] = &exynos5_clk_mout_bpll_fout.clk, | ||
234 | }; | ||
235 | |||
236 | static struct clksrc_sources exynos5_clk_src_bpll = { | ||
237 | .sources = exynos5_clk_src_bpll_list, | ||
238 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_list), | ||
239 | }; | ||
240 | |||
241 | static struct clksrc_clk exynos5_clk_mout_bpll = { | ||
242 | .clk = { | ||
243 | .name = "mout_bpll", | ||
244 | }, | ||
245 | .sources = &exynos5_clk_src_bpll, | ||
246 | .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 0, .size = 1 }, | ||
247 | }; | ||
248 | |||
249 | static struct clk *exynos5_clk_src_bpll_user_list[] = { | ||
250 | [0] = &clk_fin_mpll, | ||
251 | [1] = &exynos5_clk_mout_bpll.clk, | ||
252 | }; | ||
253 | |||
254 | static struct clksrc_sources exynos5_clk_src_bpll_user = { | ||
255 | .sources = exynos5_clk_src_bpll_user_list, | ||
256 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_user_list), | ||
257 | }; | ||
258 | |||
259 | static struct clksrc_clk exynos5_clk_mout_bpll_user = { | ||
260 | .clk = { | ||
261 | .name = "mout_bpll_user", | ||
262 | }, | ||
263 | .sources = &exynos5_clk_src_bpll_user, | ||
264 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 24, .size = 1 }, | ||
265 | }; | ||
266 | |||
267 | static struct clksrc_clk exynos5_clk_mout_cpll = { | ||
268 | .clk = { | ||
269 | .name = "mout_cpll", | ||
270 | }, | ||
271 | .sources = &clk_src_cpll, | ||
272 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 8, .size = 1 }, | ||
273 | }; | ||
274 | |||
275 | static struct clksrc_clk exynos5_clk_mout_epll = { | ||
276 | .clk = { | ||
277 | .name = "mout_epll", | ||
278 | }, | ||
279 | .sources = &clk_src_epll, | ||
280 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 12, .size = 1 }, | ||
281 | }; | ||
282 | |||
283 | static struct clksrc_clk exynos5_clk_mout_mpll_fout = { | ||
284 | .clk = { | ||
285 | .name = "mout_mpll_fout", | ||
286 | }, | ||
287 | .sources = &clk_src_mpll_fout, | ||
288 | .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 4, .size = 1 }, | ||
289 | }; | ||
290 | |||
291 | static struct clk *exynos5_clk_src_mpll_list[] = { | ||
292 | [0] = &clk_fin_mpll, | ||
293 | [1] = &exynos5_clk_mout_mpll_fout.clk, | ||
294 | }; | ||
295 | |||
296 | static struct clksrc_sources exynos5_clk_src_mpll = { | ||
297 | .sources = exynos5_clk_src_mpll_list, | ||
298 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_list), | ||
299 | }; | ||
300 | |||
301 | static struct clksrc_clk exynos5_clk_mout_mpll = { | ||
302 | .clk = { | ||
303 | .name = "mout_mpll", | ||
304 | }, | ||
305 | .sources = &exynos5_clk_src_mpll, | ||
306 | .reg_src = { .reg = EXYNOS5_CLKSRC_CORE1, .shift = 8, .size = 1 }, | ||
307 | }; | ||
308 | |||
309 | static struct clk *exynos_clkset_vpllsrc_list[] = { | ||
310 | [0] = &clk_fin_vpll, | ||
311 | [1] = &exynos5_clk_sclk_hdmi27m, | ||
312 | }; | ||
313 | |||
314 | static struct clksrc_sources exynos5_clkset_vpllsrc = { | ||
315 | .sources = exynos_clkset_vpllsrc_list, | ||
316 | .nr_sources = ARRAY_SIZE(exynos_clkset_vpllsrc_list), | ||
317 | }; | ||
318 | |||
319 | static struct clksrc_clk exynos5_clk_vpllsrc = { | ||
320 | .clk = { | ||
321 | .name = "vpll_src", | ||
322 | .enable = exynos5_clksrc_mask_top_ctrl, | ||
323 | .ctrlbit = (1 << 0), | ||
324 | }, | ||
325 | .sources = &exynos5_clkset_vpllsrc, | ||
326 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 0, .size = 1 }, | ||
327 | }; | ||
328 | |||
329 | static struct clk *exynos5_clkset_sclk_vpll_list[] = { | ||
330 | [0] = &exynos5_clk_vpllsrc.clk, | ||
331 | [1] = &clk_fout_vpll, | ||
332 | }; | ||
333 | |||
334 | static struct clksrc_sources exynos5_clkset_sclk_vpll = { | ||
335 | .sources = exynos5_clkset_sclk_vpll_list, | ||
336 | .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_vpll_list), | ||
337 | }; | ||
338 | |||
339 | static struct clksrc_clk exynos5_clk_sclk_vpll = { | ||
340 | .clk = { | ||
341 | .name = "sclk_vpll", | ||
342 | }, | ||
343 | .sources = &exynos5_clkset_sclk_vpll, | ||
344 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 16, .size = 1 }, | ||
345 | }; | ||
346 | |||
347 | static struct clksrc_clk exynos5_clk_sclk_pixel = { | ||
348 | .clk = { | ||
349 | .name = "sclk_pixel", | ||
350 | .parent = &exynos5_clk_sclk_vpll.clk, | ||
351 | }, | ||
352 | .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 28, .size = 4 }, | ||
353 | }; | ||
354 | |||
355 | static struct clk *exynos5_clkset_sclk_hdmi_list[] = { | ||
356 | [0] = &exynos5_clk_sclk_pixel.clk, | ||
357 | [1] = &exynos5_clk_sclk_hdmiphy, | ||
358 | }; | ||
359 | |||
360 | static struct clksrc_sources exynos5_clkset_sclk_hdmi = { | ||
361 | .sources = exynos5_clkset_sclk_hdmi_list, | ||
362 | .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list), | ||
363 | }; | ||
364 | |||
365 | static struct clksrc_clk exynos5_clk_sclk_hdmi = { | ||
366 | .clk = { | ||
367 | .name = "sclk_hdmi", | ||
368 | .enable = exynos5_clksrc_mask_disp1_0_ctrl, | ||
369 | .ctrlbit = (1 << 20), | ||
370 | }, | ||
371 | .sources = &exynos5_clkset_sclk_hdmi, | ||
372 | .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 20, .size = 1 }, | ||
373 | }; | ||
374 | |||
375 | static struct clksrc_clk *exynos5_sclk_tv[] = { | ||
376 | &exynos5_clk_sclk_pixel, | ||
377 | &exynos5_clk_sclk_hdmi, | ||
378 | }; | ||
379 | |||
380 | static struct clk *exynos5_clk_src_mpll_user_list[] = { | ||
381 | [0] = &clk_fin_mpll, | ||
382 | [1] = &exynos5_clk_mout_mpll.clk, | ||
383 | }; | ||
384 | |||
385 | static struct clksrc_sources exynos5_clk_src_mpll_user = { | ||
386 | .sources = exynos5_clk_src_mpll_user_list, | ||
387 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_user_list), | ||
388 | }; | ||
389 | |||
390 | static struct clksrc_clk exynos5_clk_mout_mpll_user = { | ||
391 | .clk = { | ||
392 | .name = "mout_mpll_user", | ||
393 | }, | ||
394 | .sources = &exynos5_clk_src_mpll_user, | ||
395 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 20, .size = 1 }, | ||
396 | }; | ||
397 | |||
398 | static struct clk *exynos5_clkset_mout_cpu_list[] = { | ||
399 | [0] = &exynos5_clk_mout_apll.clk, | ||
400 | [1] = &exynos5_clk_mout_mpll.clk, | ||
401 | }; | ||
402 | |||
403 | static struct clksrc_sources exynos5_clkset_mout_cpu = { | ||
404 | .sources = exynos5_clkset_mout_cpu_list, | ||
405 | .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_cpu_list), | ||
406 | }; | ||
407 | |||
408 | static struct clksrc_clk exynos5_clk_mout_cpu = { | ||
409 | .clk = { | ||
410 | .name = "mout_cpu", | ||
411 | }, | ||
412 | .sources = &exynos5_clkset_mout_cpu, | ||
413 | .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 16, .size = 1 }, | ||
414 | }; | ||
415 | |||
416 | static struct clksrc_clk exynos5_clk_dout_armclk = { | ||
417 | .clk = { | ||
418 | .name = "dout_armclk", | ||
419 | .parent = &exynos5_clk_mout_cpu.clk, | ||
420 | }, | ||
421 | .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 0, .size = 3 }, | ||
422 | }; | ||
423 | |||
424 | static struct clksrc_clk exynos5_clk_dout_arm2clk = { | ||
425 | .clk = { | ||
426 | .name = "dout_arm2clk", | ||
427 | .parent = &exynos5_clk_dout_armclk.clk, | ||
428 | }, | ||
429 | .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 28, .size = 3 }, | ||
430 | }; | ||
431 | |||
432 | static struct clk exynos5_clk_armclk = { | ||
433 | .name = "armclk", | ||
434 | .parent = &exynos5_clk_dout_arm2clk.clk, | ||
435 | }; | ||
436 | |||
437 | /* Core list of CMU_CDREX side */ | ||
438 | |||
439 | static struct clk *exynos5_clkset_cdrex_list[] = { | ||
440 | [0] = &exynos5_clk_mout_mpll.clk, | ||
441 | [1] = &exynos5_clk_mout_bpll.clk, | ||
442 | }; | ||
443 | |||
444 | static struct clksrc_sources exynos5_clkset_cdrex = { | ||
445 | .sources = exynos5_clkset_cdrex_list, | ||
446 | .nr_sources = ARRAY_SIZE(exynos5_clkset_cdrex_list), | ||
447 | }; | ||
448 | |||
449 | static struct clksrc_clk exynos5_clk_cdrex = { | ||
450 | .clk = { | ||
451 | .name = "clk_cdrex", | ||
452 | }, | ||
453 | .sources = &exynos5_clkset_cdrex, | ||
454 | .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 4, .size = 1 }, | ||
455 | .reg_div = { .reg = EXYNOS5_CLKDIV_CDREX, .shift = 16, .size = 3 }, | ||
456 | }; | ||
457 | |||
458 | static struct clksrc_clk exynos5_clk_aclk_acp = { | ||
459 | .clk = { | ||
460 | .name = "aclk_acp", | ||
461 | .parent = &exynos5_clk_mout_mpll.clk, | ||
462 | }, | ||
463 | .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 0, .size = 3 }, | ||
464 | }; | ||
465 | |||
466 | static struct clksrc_clk exynos5_clk_pclk_acp = { | ||
467 | .clk = { | ||
468 | .name = "pclk_acp", | ||
469 | .parent = &exynos5_clk_aclk_acp.clk, | ||
470 | }, | ||
471 | .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 4, .size = 3 }, | ||
472 | }; | ||
473 | |||
474 | /* Core list of CMU_TOP side */ | ||
475 | |||
476 | static struct clk *exynos5_clkset_aclk_top_list[] = { | ||
477 | [0] = &exynos5_clk_mout_mpll_user.clk, | ||
478 | [1] = &exynos5_clk_mout_bpll_user.clk, | ||
479 | }; | ||
480 | |||
481 | static struct clksrc_sources exynos5_clkset_aclk = { | ||
482 | .sources = exynos5_clkset_aclk_top_list, | ||
483 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list), | ||
484 | }; | ||
485 | |||
486 | static struct clksrc_clk exynos5_clk_aclk_400 = { | ||
487 | .clk = { | ||
488 | .name = "aclk_400", | ||
489 | }, | ||
490 | .sources = &exynos5_clkset_aclk, | ||
491 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 }, | ||
492 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 }, | ||
493 | }; | ||
494 | |||
495 | static struct clk *exynos5_clkset_aclk_333_166_list[] = { | ||
496 | [0] = &exynos5_clk_mout_cpll.clk, | ||
497 | [1] = &exynos5_clk_mout_mpll_user.clk, | ||
498 | }; | ||
499 | |||
500 | static struct clksrc_sources exynos5_clkset_aclk_333_166 = { | ||
501 | .sources = exynos5_clkset_aclk_333_166_list, | ||
502 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list), | ||
503 | }; | ||
504 | |||
505 | static struct clksrc_clk exynos5_clk_aclk_333 = { | ||
506 | .clk = { | ||
507 | .name = "aclk_333", | ||
508 | }, | ||
509 | .sources = &exynos5_clkset_aclk_333_166, | ||
510 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 16, .size = 1 }, | ||
511 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 20, .size = 3 }, | ||
512 | }; | ||
513 | |||
514 | static struct clksrc_clk exynos5_clk_aclk_166 = { | ||
515 | .clk = { | ||
516 | .name = "aclk_166", | ||
517 | }, | ||
518 | .sources = &exynos5_clkset_aclk_333_166, | ||
519 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 8, .size = 1 }, | ||
520 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 8, .size = 3 }, | ||
521 | }; | ||
522 | |||
523 | static struct clksrc_clk exynos5_clk_aclk_266 = { | ||
524 | .clk = { | ||
525 | .name = "aclk_266", | ||
526 | .parent = &exynos5_clk_mout_mpll_user.clk, | ||
527 | }, | ||
528 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 16, .size = 3 }, | ||
529 | }; | ||
530 | |||
531 | static struct clksrc_clk exynos5_clk_aclk_200 = { | ||
532 | .clk = { | ||
533 | .name = "aclk_200", | ||
534 | }, | ||
535 | .sources = &exynos5_clkset_aclk, | ||
536 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 12, .size = 1 }, | ||
537 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 12, .size = 3 }, | ||
538 | }; | ||
539 | |||
540 | static struct clksrc_clk exynos5_clk_aclk_66_pre = { | ||
541 | .clk = { | ||
542 | .name = "aclk_66_pre", | ||
543 | .parent = &exynos5_clk_mout_mpll_user.clk, | ||
544 | }, | ||
545 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP1, .shift = 24, .size = 3 }, | ||
546 | }; | ||
547 | |||
548 | static struct clksrc_clk exynos5_clk_aclk_66 = { | ||
549 | .clk = { | ||
550 | .name = "aclk_66", | ||
551 | .parent = &exynos5_clk_aclk_66_pre.clk, | ||
552 | }, | ||
553 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 }, | ||
554 | }; | ||
555 | |||
556 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid = { | ||
557 | .clk = { | ||
558 | .name = "mout_aclk_300_gscl_mid", | ||
559 | }, | ||
560 | .sources = &exynos5_clkset_aclk, | ||
561 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 24, .size = 1 }, | ||
562 | }; | ||
563 | |||
564 | static struct clk *exynos5_clkset_aclk_300_mid1_list[] = { | ||
565 | [0] = &exynos5_clk_sclk_vpll.clk, | ||
566 | [1] = &exynos5_clk_mout_cpll.clk, | ||
567 | }; | ||
568 | |||
569 | static struct clksrc_sources exynos5_clkset_aclk_300_gscl_mid1 = { | ||
570 | .sources = exynos5_clkset_aclk_300_mid1_list, | ||
571 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_mid1_list), | ||
572 | }; | ||
573 | |||
574 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid1 = { | ||
575 | .clk = { | ||
576 | .name = "mout_aclk_300_gscl_mid1", | ||
577 | }, | ||
578 | .sources = &exynos5_clkset_aclk_300_gscl_mid1, | ||
579 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP1, .shift = 12, .size = 1 }, | ||
580 | }; | ||
581 | |||
582 | static struct clk *exynos5_clkset_aclk_300_gscl_list[] = { | ||
583 | [0] = &exynos5_clk_mout_aclk_300_gscl_mid.clk, | ||
584 | [1] = &exynos5_clk_mout_aclk_300_gscl_mid1.clk, | ||
585 | }; | ||
586 | |||
587 | static struct clksrc_sources exynos5_clkset_aclk_300_gscl = { | ||
588 | .sources = exynos5_clkset_aclk_300_gscl_list, | ||
589 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_gscl_list), | ||
590 | }; | ||
591 | |||
592 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl = { | ||
593 | .clk = { | ||
594 | .name = "mout_aclk_300_gscl", | ||
595 | }, | ||
596 | .sources = &exynos5_clkset_aclk_300_gscl, | ||
597 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 25, .size = 1 }, | ||
598 | }; | ||
599 | |||
600 | static struct clk *exynos5_clk_src_gscl_300_list[] = { | ||
601 | [0] = &clk_ext_xtal_mux, | ||
602 | [1] = &exynos5_clk_mout_aclk_300_gscl.clk, | ||
603 | }; | ||
604 | |||
605 | static struct clksrc_sources exynos5_clk_src_gscl_300 = { | ||
606 | .sources = exynos5_clk_src_gscl_300_list, | ||
607 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_gscl_300_list), | ||
608 | }; | ||
609 | |||
610 | static struct clksrc_clk exynos5_clk_aclk_300_gscl = { | ||
611 | .clk = { | ||
612 | .name = "aclk_300_gscl", | ||
613 | }, | ||
614 | .sources = &exynos5_clk_src_gscl_300, | ||
615 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 10, .size = 1 }, | ||
616 | }; | ||
617 | |||
618 | static struct clk exynos5_init_clocks_off[] = { | ||
619 | { | ||
620 | .name = "timers", | ||
621 | .parent = &exynos5_clk_aclk_66.clk, | ||
622 | .enable = exynos5_clk_ip_peric_ctrl, | ||
623 | .ctrlbit = (1 << 24), | ||
624 | }, { | ||
625 | .name = "tmu_apbif", | ||
626 | .parent = &exynos5_clk_aclk_66.clk, | ||
627 | .enable = exynos5_clk_ip_peris_ctrl, | ||
628 | .ctrlbit = (1 << 21), | ||
629 | }, { | ||
630 | .name = "rtc", | ||
631 | .parent = &exynos5_clk_aclk_66.clk, | ||
632 | .enable = exynos5_clk_ip_peris_ctrl, | ||
633 | .ctrlbit = (1 << 20), | ||
634 | }, { | ||
635 | .name = "watchdog", | ||
636 | .parent = &exynos5_clk_aclk_66.clk, | ||
637 | .enable = exynos5_clk_ip_peris_ctrl, | ||
638 | .ctrlbit = (1 << 19), | ||
639 | }, { | ||
640 | .name = "biu", /* bus interface unit clock */ | ||
641 | .devname = "dw_mmc.0", | ||
642 | .parent = &exynos5_clk_aclk_200.clk, | ||
643 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
644 | .ctrlbit = (1 << 12), | ||
645 | }, { | ||
646 | .name = "biu", | ||
647 | .devname = "dw_mmc.1", | ||
648 | .parent = &exynos5_clk_aclk_200.clk, | ||
649 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
650 | .ctrlbit = (1 << 13), | ||
651 | }, { | ||
652 | .name = "biu", | ||
653 | .devname = "dw_mmc.2", | ||
654 | .parent = &exynos5_clk_aclk_200.clk, | ||
655 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
656 | .ctrlbit = (1 << 14), | ||
657 | }, { | ||
658 | .name = "biu", | ||
659 | .devname = "dw_mmc.3", | ||
660 | .parent = &exynos5_clk_aclk_200.clk, | ||
661 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
662 | .ctrlbit = (1 << 15), | ||
663 | }, { | ||
664 | .name = "sata", | ||
665 | .devname = "exynos5-sata", | ||
666 | .parent = &exynos5_clk_aclk_200.clk, | ||
667 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
668 | .ctrlbit = (1 << 6), | ||
669 | }, { | ||
670 | .name = "sata-phy", | ||
671 | .devname = "exynos5-sata-phy", | ||
672 | .parent = &exynos5_clk_aclk_200.clk, | ||
673 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
674 | .ctrlbit = (1 << 24), | ||
675 | }, { | ||
676 | .name = "i2c", | ||
677 | .devname = "exynos5-sata-phy-i2c", | ||
678 | .parent = &exynos5_clk_aclk_200.clk, | ||
679 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
680 | .ctrlbit = (1 << 25), | ||
681 | }, { | ||
682 | .name = "mfc", | ||
683 | .devname = "s5p-mfc-v6", | ||
684 | .enable = exynos5_clk_ip_mfc_ctrl, | ||
685 | .ctrlbit = (1 << 0), | ||
686 | }, { | ||
687 | .name = "hdmi", | ||
688 | .devname = "exynos5-hdmi", | ||
689 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
690 | .ctrlbit = (1 << 6), | ||
691 | }, { | ||
692 | .name = "hdmiphy", | ||
693 | .devname = "exynos5-hdmi", | ||
694 | .enable = exynos5_clk_hdmiphy_ctrl, | ||
695 | .ctrlbit = (1 << 0), | ||
696 | }, { | ||
697 | .name = "mixer", | ||
698 | .devname = "exynos5-mixer", | ||
699 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
700 | .ctrlbit = (1 << 5), | ||
701 | }, { | ||
702 | .name = "dp", | ||
703 | .devname = "exynos-dp", | ||
704 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
705 | .ctrlbit = (1 << 4), | ||
706 | }, { | ||
707 | .name = "jpeg", | ||
708 | .enable = exynos5_clk_ip_gen_ctrl, | ||
709 | .ctrlbit = (1 << 2), | ||
710 | }, { | ||
711 | .name = "dsim0", | ||
712 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
713 | .ctrlbit = (1 << 3), | ||
714 | }, { | ||
715 | .name = "iis", | ||
716 | .devname = "samsung-i2s.1", | ||
717 | .enable = exynos5_clk_ip_peric_ctrl, | ||
718 | .ctrlbit = (1 << 20), | ||
719 | }, { | ||
720 | .name = "iis", | ||
721 | .devname = "samsung-i2s.2", | ||
722 | .enable = exynos5_clk_ip_peric_ctrl, | ||
723 | .ctrlbit = (1 << 21), | ||
724 | }, { | ||
725 | .name = "pcm", | ||
726 | .devname = "samsung-pcm.1", | ||
727 | .enable = exynos5_clk_ip_peric_ctrl, | ||
728 | .ctrlbit = (1 << 22), | ||
729 | }, { | ||
730 | .name = "pcm", | ||
731 | .devname = "samsung-pcm.2", | ||
732 | .enable = exynos5_clk_ip_peric_ctrl, | ||
733 | .ctrlbit = (1 << 23), | ||
734 | }, { | ||
735 | .name = "spdif", | ||
736 | .devname = "samsung-spdif", | ||
737 | .enable = exynos5_clk_ip_peric_ctrl, | ||
738 | .ctrlbit = (1 << 26), | ||
739 | }, { | ||
740 | .name = "ac97", | ||
741 | .devname = "samsung-ac97", | ||
742 | .enable = exynos5_clk_ip_peric_ctrl, | ||
743 | .ctrlbit = (1 << 27), | ||
744 | }, { | ||
745 | .name = "usbhost", | ||
746 | .enable = exynos5_clk_ip_fsys_ctrl , | ||
747 | .ctrlbit = (1 << 18), | ||
748 | }, { | ||
749 | .name = "usbotg", | ||
750 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
751 | .ctrlbit = (1 << 7), | ||
752 | }, { | ||
753 | .name = "nfcon", | ||
754 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
755 | .ctrlbit = (1 << 22), | ||
756 | }, { | ||
757 | .name = "iop", | ||
758 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
759 | .ctrlbit = ((1 << 30) | (1 << 26) | (1 << 23)), | ||
760 | }, { | ||
761 | .name = "core_iop", | ||
762 | .enable = exynos5_clk_ip_core_ctrl, | ||
763 | .ctrlbit = ((1 << 21) | (1 << 3)), | ||
764 | }, { | ||
765 | .name = "mcu_iop", | ||
766 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
767 | .ctrlbit = (1 << 0), | ||
768 | }, { | ||
769 | .name = "i2c", | ||
770 | .devname = "s3c2440-i2c.0", | ||
771 | .parent = &exynos5_clk_aclk_66.clk, | ||
772 | .enable = exynos5_clk_ip_peric_ctrl, | ||
773 | .ctrlbit = (1 << 6), | ||
774 | }, { | ||
775 | .name = "i2c", | ||
776 | .devname = "s3c2440-i2c.1", | ||
777 | .parent = &exynos5_clk_aclk_66.clk, | ||
778 | .enable = exynos5_clk_ip_peric_ctrl, | ||
779 | .ctrlbit = (1 << 7), | ||
780 | }, { | ||
781 | .name = "i2c", | ||
782 | .devname = "s3c2440-i2c.2", | ||
783 | .parent = &exynos5_clk_aclk_66.clk, | ||
784 | .enable = exynos5_clk_ip_peric_ctrl, | ||
785 | .ctrlbit = (1 << 8), | ||
786 | }, { | ||
787 | .name = "i2c", | ||
788 | .devname = "s3c2440-i2c.3", | ||
789 | .parent = &exynos5_clk_aclk_66.clk, | ||
790 | .enable = exynos5_clk_ip_peric_ctrl, | ||
791 | .ctrlbit = (1 << 9), | ||
792 | }, { | ||
793 | .name = "i2c", | ||
794 | .devname = "s3c2440-i2c.4", | ||
795 | .parent = &exynos5_clk_aclk_66.clk, | ||
796 | .enable = exynos5_clk_ip_peric_ctrl, | ||
797 | .ctrlbit = (1 << 10), | ||
798 | }, { | ||
799 | .name = "i2c", | ||
800 | .devname = "s3c2440-i2c.5", | ||
801 | .parent = &exynos5_clk_aclk_66.clk, | ||
802 | .enable = exynos5_clk_ip_peric_ctrl, | ||
803 | .ctrlbit = (1 << 11), | ||
804 | }, { | ||
805 | .name = "i2c", | ||
806 | .devname = "s3c2440-i2c.6", | ||
807 | .parent = &exynos5_clk_aclk_66.clk, | ||
808 | .enable = exynos5_clk_ip_peric_ctrl, | ||
809 | .ctrlbit = (1 << 12), | ||
810 | }, { | ||
811 | .name = "i2c", | ||
812 | .devname = "s3c2440-i2c.7", | ||
813 | .parent = &exynos5_clk_aclk_66.clk, | ||
814 | .enable = exynos5_clk_ip_peric_ctrl, | ||
815 | .ctrlbit = (1 << 13), | ||
816 | }, { | ||
817 | .name = "i2c", | ||
818 | .devname = "s3c2440-hdmiphy-i2c", | ||
819 | .parent = &exynos5_clk_aclk_66.clk, | ||
820 | .enable = exynos5_clk_ip_peric_ctrl, | ||
821 | .ctrlbit = (1 << 14), | ||
822 | }, { | ||
823 | .name = "spi", | ||
824 | .devname = "exynos4210-spi.0", | ||
825 | .parent = &exynos5_clk_aclk_66.clk, | ||
826 | .enable = exynos5_clk_ip_peric_ctrl, | ||
827 | .ctrlbit = (1 << 16), | ||
828 | }, { | ||
829 | .name = "spi", | ||
830 | .devname = "exynos4210-spi.1", | ||
831 | .parent = &exynos5_clk_aclk_66.clk, | ||
832 | .enable = exynos5_clk_ip_peric_ctrl, | ||
833 | .ctrlbit = (1 << 17), | ||
834 | }, { | ||
835 | .name = "spi", | ||
836 | .devname = "exynos4210-spi.2", | ||
837 | .parent = &exynos5_clk_aclk_66.clk, | ||
838 | .enable = exynos5_clk_ip_peric_ctrl, | ||
839 | .ctrlbit = (1 << 18), | ||
840 | }, { | ||
841 | .name = "gscl", | ||
842 | .devname = "exynos-gsc.0", | ||
843 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
844 | .ctrlbit = (1 << 0), | ||
845 | }, { | ||
846 | .name = "gscl", | ||
847 | .devname = "exynos-gsc.1", | ||
848 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
849 | .ctrlbit = (1 << 1), | ||
850 | }, { | ||
851 | .name = "gscl", | ||
852 | .devname = "exynos-gsc.2", | ||
853 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
854 | .ctrlbit = (1 << 2), | ||
855 | }, { | ||
856 | .name = "gscl", | ||
857 | .devname = "exynos-gsc.3", | ||
858 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
859 | .ctrlbit = (1 << 3), | ||
860 | }, { | ||
861 | .name = "sysmmu", | ||
862 | .devname = "exynos-sysmmu.1", | ||
863 | .enable = &exynos5_clk_ip_mfc_ctrl, | ||
864 | .ctrlbit = (1 << 1), | ||
865 | }, { | ||
866 | .name = "sysmmu", | ||
867 | .devname = "exynos-sysmmu.0", | ||
868 | .enable = &exynos5_clk_ip_mfc_ctrl, | ||
869 | .ctrlbit = (1 << 2), | ||
870 | }, { | ||
871 | .name = "sysmmu", | ||
872 | .devname = "exynos-sysmmu.2", | ||
873 | .enable = &exynos5_clk_ip_disp1_ctrl, | ||
874 | .ctrlbit = (1 << 9) | ||
875 | }, { | ||
876 | .name = "sysmmu", | ||
877 | .devname = "exynos-sysmmu.3", | ||
878 | .enable = &exynos5_clk_ip_gen_ctrl, | ||
879 | .ctrlbit = (1 << 7), | ||
880 | }, { | ||
881 | .name = "sysmmu", | ||
882 | .devname = "exynos-sysmmu.4", | ||
883 | .enable = &exynos5_clk_ip_gen_ctrl, | ||
884 | .ctrlbit = (1 << 6) | ||
885 | }, { | ||
886 | .name = "sysmmu", | ||
887 | .devname = "exynos-sysmmu.5", | ||
888 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
889 | .ctrlbit = (1 << 7), | ||
890 | }, { | ||
891 | .name = "sysmmu", | ||
892 | .devname = "exynos-sysmmu.6", | ||
893 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
894 | .ctrlbit = (1 << 8), | ||
895 | }, { | ||
896 | .name = "sysmmu", | ||
897 | .devname = "exynos-sysmmu.7", | ||
898 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
899 | .ctrlbit = (1 << 9), | ||
900 | }, { | ||
901 | .name = "sysmmu", | ||
902 | .devname = "exynos-sysmmu.8", | ||
903 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
904 | .ctrlbit = (1 << 10), | ||
905 | }, { | ||
906 | .name = "sysmmu", | ||
907 | .devname = "exynos-sysmmu.9", | ||
908 | .enable = &exynos5_clk_ip_isp0_ctrl, | ||
909 | .ctrlbit = (0x3F << 8), | ||
910 | }, { | ||
911 | .name = "sysmmu", | ||
912 | .devname = "exynos-sysmmu.10", | ||
913 | .enable = &exynos5_clk_ip_isp1_ctrl, | ||
914 | .ctrlbit = (0xF << 4), | ||
915 | }, { | ||
916 | .name = "sysmmu", | ||
917 | .devname = "exynos-sysmmu.11", | ||
918 | .enable = &exynos5_clk_ip_disp1_ctrl, | ||
919 | .ctrlbit = (1 << 8) | ||
920 | }, { | ||
921 | .name = "sysmmu", | ||
922 | .devname = "exynos-sysmmu.12", | ||
923 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
924 | .ctrlbit = (1 << 11), | ||
925 | }, { | ||
926 | .name = "sysmmu", | ||
927 | .devname = "exynos-sysmmu.13", | ||
928 | .enable = &exynos5_clk_ip_gscl_ctrl, | ||
929 | .ctrlbit = (1 << 12), | ||
930 | }, { | ||
931 | .name = "sysmmu", | ||
932 | .devname = "exynos-sysmmu.14", | ||
933 | .enable = &exynos5_clk_ip_acp_ctrl, | ||
934 | .ctrlbit = (1 << 7) | ||
935 | } | ||
936 | }; | ||
937 | |||
938 | static struct clk exynos5_init_clocks_on[] = { | ||
939 | { | ||
940 | .name = "uart", | ||
941 | .devname = "s5pv210-uart.0", | ||
942 | .enable = exynos5_clk_ip_peric_ctrl, | ||
943 | .ctrlbit = (1 << 0), | ||
944 | }, { | ||
945 | .name = "uart", | ||
946 | .devname = "s5pv210-uart.1", | ||
947 | .enable = exynos5_clk_ip_peric_ctrl, | ||
948 | .ctrlbit = (1 << 1), | ||
949 | }, { | ||
950 | .name = "uart", | ||
951 | .devname = "s5pv210-uart.2", | ||
952 | .enable = exynos5_clk_ip_peric_ctrl, | ||
953 | .ctrlbit = (1 << 2), | ||
954 | }, { | ||
955 | .name = "uart", | ||
956 | .devname = "s5pv210-uart.3", | ||
957 | .enable = exynos5_clk_ip_peric_ctrl, | ||
958 | .ctrlbit = (1 << 3), | ||
959 | }, { | ||
960 | .name = "uart", | ||
961 | .devname = "s5pv210-uart.4", | ||
962 | .enable = exynos5_clk_ip_peric_ctrl, | ||
963 | .ctrlbit = (1 << 4), | ||
964 | }, { | ||
965 | .name = "uart", | ||
966 | .devname = "s5pv210-uart.5", | ||
967 | .enable = exynos5_clk_ip_peric_ctrl, | ||
968 | .ctrlbit = (1 << 5), | ||
969 | } | ||
970 | }; | ||
971 | |||
972 | static struct clk exynos5_clk_pdma0 = { | ||
973 | .name = "dma", | ||
974 | .devname = "dma-pl330.0", | ||
975 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
976 | .ctrlbit = (1 << 1), | ||
977 | }; | ||
978 | |||
979 | static struct clk exynos5_clk_pdma1 = { | ||
980 | .name = "dma", | ||
981 | .devname = "dma-pl330.1", | ||
982 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
983 | .ctrlbit = (1 << 2), | ||
984 | }; | ||
985 | |||
986 | static struct clk exynos5_clk_mdma1 = { | ||
987 | .name = "dma", | ||
988 | .devname = "dma-pl330.2", | ||
989 | .enable = exynos5_clk_ip_gen_ctrl, | ||
990 | .ctrlbit = (1 << 4), | ||
991 | }; | ||
992 | |||
993 | static struct clk exynos5_clk_fimd1 = { | ||
994 | .name = "fimd", | ||
995 | .devname = "exynos5-fb.1", | ||
996 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
997 | .ctrlbit = (1 << 0), | ||
998 | }; | ||
999 | |||
1000 | static struct clk *exynos5_clkset_group_list[] = { | ||
1001 | [0] = &clk_ext_xtal_mux, | ||
1002 | [1] = NULL, | ||
1003 | [2] = &exynos5_clk_sclk_hdmi24m, | ||
1004 | [3] = &exynos5_clk_sclk_dptxphy, | ||
1005 | [4] = &exynos5_clk_sclk_usbphy, | ||
1006 | [5] = &exynos5_clk_sclk_hdmiphy, | ||
1007 | [6] = &exynos5_clk_mout_mpll_user.clk, | ||
1008 | [7] = &exynos5_clk_mout_epll.clk, | ||
1009 | [8] = &exynos5_clk_sclk_vpll.clk, | ||
1010 | [9] = &exynos5_clk_mout_cpll.clk, | ||
1011 | }; | ||
1012 | |||
1013 | static struct clksrc_sources exynos5_clkset_group = { | ||
1014 | .sources = exynos5_clkset_group_list, | ||
1015 | .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list), | ||
1016 | }; | ||
1017 | |||
1018 | /* Possible clock sources for aclk_266_gscl_sub Mux */ | ||
1019 | static struct clk *clk_src_gscl_266_list[] = { | ||
1020 | [0] = &clk_ext_xtal_mux, | ||
1021 | [1] = &exynos5_clk_aclk_266.clk, | ||
1022 | }; | ||
1023 | |||
1024 | static struct clksrc_sources clk_src_gscl_266 = { | ||
1025 | .sources = clk_src_gscl_266_list, | ||
1026 | .nr_sources = ARRAY_SIZE(clk_src_gscl_266_list), | ||
1027 | }; | ||
1028 | |||
1029 | static struct clksrc_clk exynos5_clk_dout_mmc0 = { | ||
1030 | .clk = { | ||
1031 | .name = "dout_mmc0", | ||
1032 | }, | ||
1033 | .sources = &exynos5_clkset_group, | ||
1034 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 0, .size = 4 }, | ||
1035 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 0, .size = 4 }, | ||
1036 | }; | ||
1037 | |||
1038 | static struct clksrc_clk exynos5_clk_dout_mmc1 = { | ||
1039 | .clk = { | ||
1040 | .name = "dout_mmc1", | ||
1041 | }, | ||
1042 | .sources = &exynos5_clkset_group, | ||
1043 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 4, .size = 4 }, | ||
1044 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 16, .size = 4 }, | ||
1045 | }; | ||
1046 | |||
1047 | static struct clksrc_clk exynos5_clk_dout_mmc2 = { | ||
1048 | .clk = { | ||
1049 | .name = "dout_mmc2", | ||
1050 | }, | ||
1051 | .sources = &exynos5_clkset_group, | ||
1052 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 8, .size = 4 }, | ||
1053 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 0, .size = 4 }, | ||
1054 | }; | ||
1055 | |||
1056 | static struct clksrc_clk exynos5_clk_dout_mmc3 = { | ||
1057 | .clk = { | ||
1058 | .name = "dout_mmc3", | ||
1059 | }, | ||
1060 | .sources = &exynos5_clkset_group, | ||
1061 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 12, .size = 4 }, | ||
1062 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 16, .size = 4 }, | ||
1063 | }; | ||
1064 | |||
1065 | static struct clksrc_clk exynos5_clk_dout_mmc4 = { | ||
1066 | .clk = { | ||
1067 | .name = "dout_mmc4", | ||
1068 | }, | ||
1069 | .sources = &exynos5_clkset_group, | ||
1070 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 16, .size = 4 }, | ||
1071 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 0, .size = 4 }, | ||
1072 | }; | ||
1073 | |||
1074 | static struct clksrc_clk exynos5_clk_sclk_uart0 = { | ||
1075 | .clk = { | ||
1076 | .name = "uclk1", | ||
1077 | .devname = "exynos4210-uart.0", | ||
1078 | .enable = exynos5_clksrc_mask_peric0_ctrl, | ||
1079 | .ctrlbit = (1 << 0), | ||
1080 | }, | ||
1081 | .sources = &exynos5_clkset_group, | ||
1082 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 0, .size = 4 }, | ||
1083 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 0, .size = 4 }, | ||
1084 | }; | ||
1085 | |||
1086 | static struct clksrc_clk exynos5_clk_sclk_uart1 = { | ||
1087 | .clk = { | ||
1088 | .name = "uclk1", | ||
1089 | .devname = "exynos4210-uart.1", | ||
1090 | .enable = exynos5_clksrc_mask_peric0_ctrl, | ||
1091 | .ctrlbit = (1 << 4), | ||
1092 | }, | ||
1093 | .sources = &exynos5_clkset_group, | ||
1094 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 4, .size = 4 }, | ||
1095 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 4, .size = 4 }, | ||
1096 | }; | ||
1097 | |||
1098 | static struct clksrc_clk exynos5_clk_sclk_uart2 = { | ||
1099 | .clk = { | ||
1100 | .name = "uclk1", | ||
1101 | .devname = "exynos4210-uart.2", | ||
1102 | .enable = exynos5_clksrc_mask_peric0_ctrl, | ||
1103 | .ctrlbit = (1 << 8), | ||
1104 | }, | ||
1105 | .sources = &exynos5_clkset_group, | ||
1106 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 8, .size = 4 }, | ||
1107 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 8, .size = 4 }, | ||
1108 | }; | ||
1109 | |||
1110 | static struct clksrc_clk exynos5_clk_sclk_uart3 = { | ||
1111 | .clk = { | ||
1112 | .name = "uclk1", | ||
1113 | .devname = "exynos4210-uart.3", | ||
1114 | .enable = exynos5_clksrc_mask_peric0_ctrl, | ||
1115 | .ctrlbit = (1 << 12), | ||
1116 | }, | ||
1117 | .sources = &exynos5_clkset_group, | ||
1118 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 12, .size = 4 }, | ||
1119 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 12, .size = 4 }, | ||
1120 | }; | ||
1121 | |||
1122 | static struct clksrc_clk exynos5_clk_sclk_mmc0 = { | ||
1123 | .clk = { | ||
1124 | .name = "ciu", /* card interface unit clock */ | ||
1125 | .devname = "dw_mmc.0", | ||
1126 | .parent = &exynos5_clk_dout_mmc0.clk, | ||
1127 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1128 | .ctrlbit = (1 << 0), | ||
1129 | }, | ||
1130 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 8, .size = 8 }, | ||
1131 | }; | ||
1132 | |||
1133 | static struct clksrc_clk exynos5_clk_sclk_mmc1 = { | ||
1134 | .clk = { | ||
1135 | .name = "ciu", | ||
1136 | .devname = "dw_mmc.1", | ||
1137 | .parent = &exynos5_clk_dout_mmc1.clk, | ||
1138 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1139 | .ctrlbit = (1 << 4), | ||
1140 | }, | ||
1141 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 24, .size = 8 }, | ||
1142 | }; | ||
1143 | |||
1144 | static struct clksrc_clk exynos5_clk_sclk_mmc2 = { | ||
1145 | .clk = { | ||
1146 | .name = "ciu", | ||
1147 | .devname = "dw_mmc.2", | ||
1148 | .parent = &exynos5_clk_dout_mmc2.clk, | ||
1149 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1150 | .ctrlbit = (1 << 8), | ||
1151 | }, | ||
1152 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 8, .size = 8 }, | ||
1153 | }; | ||
1154 | |||
1155 | static struct clksrc_clk exynos5_clk_sclk_mmc3 = { | ||
1156 | .clk = { | ||
1157 | .name = "ciu", | ||
1158 | .devname = "dw_mmc.3", | ||
1159 | .parent = &exynos5_clk_dout_mmc3.clk, | ||
1160 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1161 | .ctrlbit = (1 << 12), | ||
1162 | }, | ||
1163 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 }, | ||
1164 | }; | ||
1165 | |||
1166 | static struct clksrc_clk exynos5_clk_mdout_spi0 = { | ||
1167 | .clk = { | ||
1168 | .name = "mdout_spi", | ||
1169 | .devname = "exynos4210-spi.0", | ||
1170 | }, | ||
1171 | .sources = &exynos5_clkset_group, | ||
1172 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 16, .size = 4 }, | ||
1173 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 0, .size = 4 }, | ||
1174 | }; | ||
1175 | |||
1176 | static struct clksrc_clk exynos5_clk_mdout_spi1 = { | ||
1177 | .clk = { | ||
1178 | .name = "mdout_spi", | ||
1179 | .devname = "exynos4210-spi.1", | ||
1180 | }, | ||
1181 | .sources = &exynos5_clkset_group, | ||
1182 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 20, .size = 4 }, | ||
1183 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 16, .size = 4 }, | ||
1184 | }; | ||
1185 | |||
1186 | static struct clksrc_clk exynos5_clk_mdout_spi2 = { | ||
1187 | .clk = { | ||
1188 | .name = "mdout_spi", | ||
1189 | .devname = "exynos4210-spi.2", | ||
1190 | }, | ||
1191 | .sources = &exynos5_clkset_group, | ||
1192 | .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 24, .size = 4 }, | ||
1193 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 0, .size = 4 }, | ||
1194 | }; | ||
1195 | |||
1196 | static struct clksrc_clk exynos5_clk_sclk_spi0 = { | ||
1197 | .clk = { | ||
1198 | .name = "sclk_spi", | ||
1199 | .devname = "exynos4210-spi.0", | ||
1200 | .parent = &exynos5_clk_mdout_spi0.clk, | ||
1201 | .enable = exynos5_clksrc_mask_peric1_ctrl, | ||
1202 | .ctrlbit = (1 << 16), | ||
1203 | }, | ||
1204 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 8, .size = 8 }, | ||
1205 | }; | ||
1206 | |||
1207 | static struct clksrc_clk exynos5_clk_sclk_spi1 = { | ||
1208 | .clk = { | ||
1209 | .name = "sclk_spi", | ||
1210 | .devname = "exynos4210-spi.1", | ||
1211 | .parent = &exynos5_clk_mdout_spi1.clk, | ||
1212 | .enable = exynos5_clksrc_mask_peric1_ctrl, | ||
1213 | .ctrlbit = (1 << 20), | ||
1214 | }, | ||
1215 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 24, .size = 8 }, | ||
1216 | }; | ||
1217 | |||
1218 | static struct clksrc_clk exynos5_clk_sclk_spi2 = { | ||
1219 | .clk = { | ||
1220 | .name = "sclk_spi", | ||
1221 | .devname = "exynos4210-spi.2", | ||
1222 | .parent = &exynos5_clk_mdout_spi2.clk, | ||
1223 | .enable = exynos5_clksrc_mask_peric1_ctrl, | ||
1224 | .ctrlbit = (1 << 24), | ||
1225 | }, | ||
1226 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 }, | ||
1227 | }; | ||
1228 | |||
1229 | static struct clksrc_clk exynos5_clk_sclk_fimd1 = { | ||
1230 | .clk = { | ||
1231 | .name = "sclk_fimd", | ||
1232 | .devname = "exynos5-fb.1", | ||
1233 | .enable = exynos5_clksrc_mask_disp1_0_ctrl, | ||
1234 | .ctrlbit = (1 << 0), | ||
1235 | }, | ||
1236 | .sources = &exynos5_clkset_group, | ||
1237 | .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 }, | ||
1238 | .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 }, | ||
1239 | }; | ||
1240 | |||
1241 | static struct clksrc_clk exynos5_clksrcs[] = { | ||
1242 | { | ||
1243 | .clk = { | ||
1244 | .name = "aclk_266_gscl", | ||
1245 | }, | ||
1246 | .sources = &clk_src_gscl_266, | ||
1247 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 8, .size = 1 }, | ||
1248 | }, { | ||
1249 | .clk = { | ||
1250 | .name = "sclk_g3d", | ||
1251 | .devname = "mali-t604.0", | ||
1252 | .enable = exynos5_clk_block_ctrl, | ||
1253 | .ctrlbit = (1 << 1), | ||
1254 | }, | ||
1255 | .sources = &exynos5_clkset_aclk, | ||
1256 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 }, | ||
1257 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 }, | ||
1258 | }, { | ||
1259 | .clk = { | ||
1260 | .name = "sclk_sata", | ||
1261 | .devname = "exynos5-sata", | ||
1262 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1263 | .ctrlbit = (1 << 24), | ||
1264 | }, | ||
1265 | .sources = &exynos5_clkset_aclk, | ||
1266 | .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 24, .size = 1 }, | ||
1267 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 20, .size = 4 }, | ||
1268 | }, { | ||
1269 | .clk = { | ||
1270 | .name = "sclk_gscl_wrap", | ||
1271 | .devname = "s5p-mipi-csis.0", | ||
1272 | .enable = exynos5_clksrc_mask_gscl_ctrl, | ||
1273 | .ctrlbit = (1 << 24), | ||
1274 | }, | ||
1275 | .sources = &exynos5_clkset_group, | ||
1276 | .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 24, .size = 4 }, | ||
1277 | .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 24, .size = 4 }, | ||
1278 | }, { | ||
1279 | .clk = { | ||
1280 | .name = "sclk_gscl_wrap", | ||
1281 | .devname = "s5p-mipi-csis.1", | ||
1282 | .enable = exynos5_clksrc_mask_gscl_ctrl, | ||
1283 | .ctrlbit = (1 << 28), | ||
1284 | }, | ||
1285 | .sources = &exynos5_clkset_group, | ||
1286 | .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 28, .size = 4 }, | ||
1287 | .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 28, .size = 4 }, | ||
1288 | }, { | ||
1289 | .clk = { | ||
1290 | .name = "sclk_cam0", | ||
1291 | .enable = exynos5_clksrc_mask_gscl_ctrl, | ||
1292 | .ctrlbit = (1 << 16), | ||
1293 | }, | ||
1294 | .sources = &exynos5_clkset_group, | ||
1295 | .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 16, .size = 4 }, | ||
1296 | .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 16, .size = 4 }, | ||
1297 | }, { | ||
1298 | .clk = { | ||
1299 | .name = "sclk_cam1", | ||
1300 | .enable = exynos5_clksrc_mask_gscl_ctrl, | ||
1301 | .ctrlbit = (1 << 20), | ||
1302 | }, | ||
1303 | .sources = &exynos5_clkset_group, | ||
1304 | .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 20, .size = 4 }, | ||
1305 | .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 20, .size = 4 }, | ||
1306 | }, { | ||
1307 | .clk = { | ||
1308 | .name = "sclk_jpeg", | ||
1309 | .parent = &exynos5_clk_mout_cpll.clk, | ||
1310 | }, | ||
1311 | .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 }, | ||
1312 | }, | ||
1313 | }; | ||
1314 | |||
1315 | /* Clock initialization code */ | ||
1316 | static struct clksrc_clk *exynos5_sysclks[] = { | ||
1317 | &exynos5_clk_mout_apll, | ||
1318 | &exynos5_clk_sclk_apll, | ||
1319 | &exynos5_clk_mout_bpll, | ||
1320 | &exynos5_clk_mout_bpll_fout, | ||
1321 | &exynos5_clk_mout_bpll_user, | ||
1322 | &exynos5_clk_mout_cpll, | ||
1323 | &exynos5_clk_mout_epll, | ||
1324 | &exynos5_clk_mout_mpll, | ||
1325 | &exynos5_clk_mout_mpll_fout, | ||
1326 | &exynos5_clk_mout_mpll_user, | ||
1327 | &exynos5_clk_vpllsrc, | ||
1328 | &exynos5_clk_sclk_vpll, | ||
1329 | &exynos5_clk_mout_cpu, | ||
1330 | &exynos5_clk_dout_armclk, | ||
1331 | &exynos5_clk_dout_arm2clk, | ||
1332 | &exynos5_clk_cdrex, | ||
1333 | &exynos5_clk_aclk_400, | ||
1334 | &exynos5_clk_aclk_333, | ||
1335 | &exynos5_clk_aclk_266, | ||
1336 | &exynos5_clk_aclk_200, | ||
1337 | &exynos5_clk_aclk_166, | ||
1338 | &exynos5_clk_aclk_300_gscl, | ||
1339 | &exynos5_clk_mout_aclk_300_gscl, | ||
1340 | &exynos5_clk_mout_aclk_300_gscl_mid, | ||
1341 | &exynos5_clk_mout_aclk_300_gscl_mid1, | ||
1342 | &exynos5_clk_aclk_66_pre, | ||
1343 | &exynos5_clk_aclk_66, | ||
1344 | &exynos5_clk_dout_mmc0, | ||
1345 | &exynos5_clk_dout_mmc1, | ||
1346 | &exynos5_clk_dout_mmc2, | ||
1347 | &exynos5_clk_dout_mmc3, | ||
1348 | &exynos5_clk_dout_mmc4, | ||
1349 | &exynos5_clk_aclk_acp, | ||
1350 | &exynos5_clk_pclk_acp, | ||
1351 | &exynos5_clk_sclk_spi0, | ||
1352 | &exynos5_clk_sclk_spi1, | ||
1353 | &exynos5_clk_sclk_spi2, | ||
1354 | &exynos5_clk_mdout_spi0, | ||
1355 | &exynos5_clk_mdout_spi1, | ||
1356 | &exynos5_clk_mdout_spi2, | ||
1357 | &exynos5_clk_sclk_fimd1, | ||
1358 | }; | ||
1359 | |||
1360 | static struct clk *exynos5_clk_cdev[] = { | ||
1361 | &exynos5_clk_pdma0, | ||
1362 | &exynos5_clk_pdma1, | ||
1363 | &exynos5_clk_mdma1, | ||
1364 | &exynos5_clk_fimd1, | ||
1365 | }; | ||
1366 | |||
1367 | static struct clksrc_clk *exynos5_clksrc_cdev[] = { | ||
1368 | &exynos5_clk_sclk_uart0, | ||
1369 | &exynos5_clk_sclk_uart1, | ||
1370 | &exynos5_clk_sclk_uart2, | ||
1371 | &exynos5_clk_sclk_uart3, | ||
1372 | &exynos5_clk_sclk_mmc0, | ||
1373 | &exynos5_clk_sclk_mmc1, | ||
1374 | &exynos5_clk_sclk_mmc2, | ||
1375 | &exynos5_clk_sclk_mmc3, | ||
1376 | }; | ||
1377 | |||
1378 | static struct clk_lookup exynos5_clk_lookup[] = { | ||
1379 | CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0.clk), | ||
1380 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk), | ||
1381 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk), | ||
1382 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk), | ||
1383 | CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk), | ||
1384 | CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), | ||
1385 | CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), | ||
1386 | CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), | ||
1387 | CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos5_clk_sclk_spi0.clk), | ||
1388 | CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos5_clk_sclk_spi1.clk), | ||
1389 | CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos5_clk_sclk_spi2.clk), | ||
1390 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), | ||
1391 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), | ||
1392 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), | ||
1393 | CLKDEV_INIT("exynos5-fb.1", "lcd", &exynos5_clk_fimd1), | ||
1394 | }; | ||
1395 | |||
1396 | static unsigned long exynos5_epll_get_rate(struct clk *clk) | ||
1397 | { | ||
1398 | return clk->rate; | ||
1399 | } | ||
1400 | |||
1401 | static struct clk *exynos5_clks[] __initdata = { | ||
1402 | &exynos5_clk_sclk_hdmi27m, | ||
1403 | &exynos5_clk_sclk_hdmiphy, | ||
1404 | &clk_fout_bpll, | ||
1405 | &clk_fout_bpll_div2, | ||
1406 | &clk_fout_cpll, | ||
1407 | &clk_fout_mpll_div2, | ||
1408 | &exynos5_clk_armclk, | ||
1409 | }; | ||
1410 | |||
1411 | static u32 epll_div[][6] = { | ||
1412 | { 192000000, 0, 48, 3, 1, 0 }, | ||
1413 | { 180000000, 0, 45, 3, 1, 0 }, | ||
1414 | { 73728000, 1, 73, 3, 3, 47710 }, | ||
1415 | { 67737600, 1, 90, 4, 3, 20762 }, | ||
1416 | { 49152000, 0, 49, 3, 3, 9961 }, | ||
1417 | { 45158400, 0, 45, 3, 3, 10381 }, | ||
1418 | { 180633600, 0, 45, 3, 1, 10381 }, | ||
1419 | }; | ||
1420 | |||
1421 | static int exynos5_epll_set_rate(struct clk *clk, unsigned long rate) | ||
1422 | { | ||
1423 | unsigned int epll_con, epll_con_k; | ||
1424 | unsigned int i; | ||
1425 | unsigned int tmp; | ||
1426 | unsigned int epll_rate; | ||
1427 | unsigned int locktime; | ||
1428 | unsigned int lockcnt; | ||
1429 | |||
1430 | /* Return if nothing changed */ | ||
1431 | if (clk->rate == rate) | ||
1432 | return 0; | ||
1433 | |||
1434 | if (clk->parent) | ||
1435 | epll_rate = clk_get_rate(clk->parent); | ||
1436 | else | ||
1437 | epll_rate = clk_ext_xtal_mux.rate; | ||
1438 | |||
1439 | if (epll_rate != 24000000) { | ||
1440 | pr_err("Invalid Clock : recommended clock is 24MHz.\n"); | ||
1441 | return -EINVAL; | ||
1442 | } | ||
1443 | |||
1444 | epll_con = __raw_readl(EXYNOS5_EPLL_CON0); | ||
1445 | epll_con &= ~(0x1 << 27 | \ | ||
1446 | PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \ | ||
1447 | PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \ | ||
1448 | PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); | ||
1449 | |||
1450 | for (i = 0; i < ARRAY_SIZE(epll_div); i++) { | ||
1451 | if (epll_div[i][0] == rate) { | ||
1452 | epll_con_k = epll_div[i][5] << 0; | ||
1453 | epll_con |= epll_div[i][1] << 27; | ||
1454 | epll_con |= epll_div[i][2] << PLL46XX_MDIV_SHIFT; | ||
1455 | epll_con |= epll_div[i][3] << PLL46XX_PDIV_SHIFT; | ||
1456 | epll_con |= epll_div[i][4] << PLL46XX_SDIV_SHIFT; | ||
1457 | break; | ||
1458 | } | ||
1459 | } | ||
1460 | |||
1461 | if (i == ARRAY_SIZE(epll_div)) { | ||
1462 | printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", | ||
1463 | __func__); | ||
1464 | return -EINVAL; | ||
1465 | } | ||
1466 | |||
1467 | epll_rate /= 1000000; | ||
1468 | |||
1469 | /* 3000 max_cycls : specification data */ | ||
1470 | locktime = 3000 / epll_rate * epll_div[i][3]; | ||
1471 | lockcnt = locktime * 10000 / (10000 / epll_rate); | ||
1472 | |||
1473 | __raw_writel(lockcnt, EXYNOS5_EPLL_LOCK); | ||
1474 | |||
1475 | __raw_writel(epll_con, EXYNOS5_EPLL_CON0); | ||
1476 | __raw_writel(epll_con_k, EXYNOS5_EPLL_CON1); | ||
1477 | |||
1478 | do { | ||
1479 | tmp = __raw_readl(EXYNOS5_EPLL_CON0); | ||
1480 | } while (!(tmp & 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT)); | ||
1481 | |||
1482 | clk->rate = rate; | ||
1483 | |||
1484 | return 0; | ||
1485 | } | ||
1486 | |||
1487 | static struct clk_ops exynos5_epll_ops = { | ||
1488 | .get_rate = exynos5_epll_get_rate, | ||
1489 | .set_rate = exynos5_epll_set_rate, | ||
1490 | }; | ||
1491 | |||
1492 | static int xtal_rate; | ||
1493 | |||
1494 | static unsigned long exynos5_fout_apll_get_rate(struct clk *clk) | ||
1495 | { | ||
1496 | return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS5_APLL_CON0)); | ||
1497 | } | ||
1498 | |||
1499 | static struct clk_ops exynos5_fout_apll_ops = { | ||
1500 | .get_rate = exynos5_fout_apll_get_rate, | ||
1501 | }; | ||
1502 | |||
1503 | #ifdef CONFIG_PM | ||
1504 | static int exynos5_clock_suspend(void) | ||
1505 | { | ||
1506 | s3c_pm_do_save(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save)); | ||
1507 | |||
1508 | return 0; | ||
1509 | } | ||
1510 | |||
1511 | static void exynos5_clock_resume(void) | ||
1512 | { | ||
1513 | s3c_pm_do_restore_core(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save)); | ||
1514 | } | ||
1515 | #else | ||
1516 | #define exynos5_clock_suspend NULL | ||
1517 | #define exynos5_clock_resume NULL | ||
1518 | #endif | ||
1519 | |||
1520 | static struct syscore_ops exynos5_clock_syscore_ops = { | ||
1521 | .suspend = exynos5_clock_suspend, | ||
1522 | .resume = exynos5_clock_resume, | ||
1523 | }; | ||
1524 | |||
1525 | void __init_or_cpufreq exynos5_setup_clocks(void) | ||
1526 | { | ||
1527 | struct clk *xtal_clk; | ||
1528 | unsigned long apll; | ||
1529 | unsigned long bpll; | ||
1530 | unsigned long cpll; | ||
1531 | unsigned long mpll; | ||
1532 | unsigned long epll; | ||
1533 | unsigned long vpll; | ||
1534 | unsigned long vpllsrc; | ||
1535 | unsigned long xtal; | ||
1536 | unsigned long armclk; | ||
1537 | unsigned long mout_cdrex; | ||
1538 | unsigned long aclk_400; | ||
1539 | unsigned long aclk_333; | ||
1540 | unsigned long aclk_266; | ||
1541 | unsigned long aclk_200; | ||
1542 | unsigned long aclk_166; | ||
1543 | unsigned long aclk_66; | ||
1544 | unsigned int ptr; | ||
1545 | |||
1546 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); | ||
1547 | |||
1548 | xtal_clk = clk_get(NULL, "xtal"); | ||
1549 | BUG_ON(IS_ERR(xtal_clk)); | ||
1550 | |||
1551 | xtal = clk_get_rate(xtal_clk); | ||
1552 | |||
1553 | xtal_rate = xtal; | ||
1554 | |||
1555 | clk_put(xtal_clk); | ||
1556 | |||
1557 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | ||
1558 | |||
1559 | apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_APLL_CON0)); | ||
1560 | bpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_BPLL_CON0)); | ||
1561 | cpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_CPLL_CON0)); | ||
1562 | mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_MPLL_CON0)); | ||
1563 | epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS5_EPLL_CON0), | ||
1564 | __raw_readl(EXYNOS5_EPLL_CON1)); | ||
1565 | |||
1566 | vpllsrc = clk_get_rate(&exynos5_clk_vpllsrc.clk); | ||
1567 | vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS5_VPLL_CON0), | ||
1568 | __raw_readl(EXYNOS5_VPLL_CON1)); | ||
1569 | |||
1570 | clk_fout_apll.ops = &exynos5_fout_apll_ops; | ||
1571 | clk_fout_bpll.rate = bpll; | ||
1572 | clk_fout_bpll_div2.rate = bpll >> 1; | ||
1573 | clk_fout_cpll.rate = cpll; | ||
1574 | clk_fout_mpll.rate = mpll; | ||
1575 | clk_fout_mpll_div2.rate = mpll >> 1; | ||
1576 | clk_fout_epll.rate = epll; | ||
1577 | clk_fout_vpll.rate = vpll; | ||
1578 | |||
1579 | printk(KERN_INFO "EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n" | ||
1580 | "M=%ld, E=%ld V=%ld", | ||
1581 | apll, bpll, cpll, mpll, epll, vpll); | ||
1582 | |||
1583 | armclk = clk_get_rate(&exynos5_clk_armclk); | ||
1584 | mout_cdrex = clk_get_rate(&exynos5_clk_cdrex.clk); | ||
1585 | |||
1586 | aclk_400 = clk_get_rate(&exynos5_clk_aclk_400.clk); | ||
1587 | aclk_333 = clk_get_rate(&exynos5_clk_aclk_333.clk); | ||
1588 | aclk_266 = clk_get_rate(&exynos5_clk_aclk_266.clk); | ||
1589 | aclk_200 = clk_get_rate(&exynos5_clk_aclk_200.clk); | ||
1590 | aclk_166 = clk_get_rate(&exynos5_clk_aclk_166.clk); | ||
1591 | aclk_66 = clk_get_rate(&exynos5_clk_aclk_66.clk); | ||
1592 | |||
1593 | printk(KERN_INFO "EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n" | ||
1594 | "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n" | ||
1595 | "ACLK166=%ld, ACLK66=%ld\n", | ||
1596 | armclk, mout_cdrex, aclk_400, | ||
1597 | aclk_333, aclk_266, aclk_200, | ||
1598 | aclk_166, aclk_66); | ||
1599 | |||
1600 | |||
1601 | clk_fout_epll.ops = &exynos5_epll_ops; | ||
1602 | |||
1603 | if (clk_set_parent(&exynos5_clk_mout_epll.clk, &clk_fout_epll)) | ||
1604 | printk(KERN_ERR "Unable to set parent %s of clock %s.\n", | ||
1605 | clk_fout_epll.name, exynos5_clk_mout_epll.clk.name); | ||
1606 | |||
1607 | clk_set_rate(&exynos5_clk_sclk_apll.clk, 100000000); | ||
1608 | clk_set_rate(&exynos5_clk_aclk_266.clk, 300000000); | ||
1609 | |||
1610 | clk_set_rate(&exynos5_clk_aclk_acp.clk, 267000000); | ||
1611 | clk_set_rate(&exynos5_clk_pclk_acp.clk, 134000000); | ||
1612 | |||
1613 | for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrcs); ptr++) | ||
1614 | s3c_set_clksrc(&exynos5_clksrcs[ptr], true); | ||
1615 | } | ||
1616 | |||
1617 | void __init exynos5_register_clocks(void) | ||
1618 | { | ||
1619 | int ptr; | ||
1620 | |||
1621 | s3c24xx_register_clocks(exynos5_clks, ARRAY_SIZE(exynos5_clks)); | ||
1622 | |||
1623 | for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sysclks); ptr++) | ||
1624 | s3c_register_clksrc(exynos5_sysclks[ptr], 1); | ||
1625 | |||
1626 | for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sclk_tv); ptr++) | ||
1627 | s3c_register_clksrc(exynos5_sclk_tv[ptr], 1); | ||
1628 | |||
1629 | for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrc_cdev); ptr++) | ||
1630 | s3c_register_clksrc(exynos5_clksrc_cdev[ptr], 1); | ||
1631 | |||
1632 | s3c_register_clksrc(exynos5_clksrcs, ARRAY_SIZE(exynos5_clksrcs)); | ||
1633 | s3c_register_clocks(exynos5_init_clocks_on, ARRAY_SIZE(exynos5_init_clocks_on)); | ||
1634 | |||
1635 | s3c24xx_register_clocks(exynos5_clk_cdev, ARRAY_SIZE(exynos5_clk_cdev)); | ||
1636 | for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clk_cdev); ptr++) | ||
1637 | s3c_disable_clocks(exynos5_clk_cdev[ptr], 1); | ||
1638 | |||
1639 | s3c_register_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off)); | ||
1640 | s3c_disable_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off)); | ||
1641 | clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup)); | ||
1642 | |||
1643 | register_syscore_ops(&exynos5_clock_syscore_ops); | ||
1644 | s3c_pwmclk_init(); | ||
1645 | } | ||
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 15718da30c45..b35c60059bb8 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/export.h> | 24 | #include <linux/export.h> |
25 | #include <linux/irqdomain.h> | 25 | #include <linux/irqdomain.h> |
26 | #include <linux/of_address.h> | 26 | #include <linux/of_address.h> |
27 | #include <linux/clocksource.h> | ||
28 | #include <linux/clk-provider.h> | ||
27 | #include <linux/irqchip/arm-gic.h> | 29 | #include <linux/irqchip/arm-gic.h> |
28 | #include <linux/irqchip/chained_irq.h> | 30 | #include <linux/irqchip/chained_irq.h> |
29 | 31 | ||
@@ -37,9 +39,9 @@ | |||
37 | #include <mach/regs-irq.h> | 39 | #include <mach/regs-irq.h> |
38 | #include <mach/regs-pmu.h> | 40 | #include <mach/regs-pmu.h> |
39 | #include <mach/regs-gpio.h> | 41 | #include <mach/regs-gpio.h> |
42 | #include <mach/irqs.h> | ||
40 | 43 | ||
41 | #include <plat/cpu.h> | 44 | #include <plat/cpu.h> |
42 | #include <plat/clock.h> | ||
43 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
44 | #include <plat/pm.h> | 46 | #include <plat/pm.h> |
45 | #include <plat/sdhci.h> | 47 | #include <plat/sdhci.h> |
@@ -65,17 +67,16 @@ static const char name_exynos5440[] = "EXYNOS5440"; | |||
65 | static void exynos4_map_io(void); | 67 | static void exynos4_map_io(void); |
66 | static void exynos5_map_io(void); | 68 | static void exynos5_map_io(void); |
67 | static void exynos5440_map_io(void); | 69 | static void exynos5440_map_io(void); |
68 | static void exynos4_init_clocks(int xtal); | ||
69 | static void exynos5_init_clocks(int xtal); | ||
70 | static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no); | 70 | static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
71 | static int exynos_init(void); | 71 | static int exynos_init(void); |
72 | 72 | ||
73 | unsigned long xxti_f = 0, xusbxti_f = 0; | ||
74 | |||
73 | static struct cpu_table cpu_ids[] __initdata = { | 75 | static struct cpu_table cpu_ids[] __initdata = { |
74 | { | 76 | { |
75 | .idcode = EXYNOS4210_CPU_ID, | 77 | .idcode = EXYNOS4210_CPU_ID, |
76 | .idmask = EXYNOS4_CPU_MASK, | 78 | .idmask = EXYNOS4_CPU_MASK, |
77 | .map_io = exynos4_map_io, | 79 | .map_io = exynos4_map_io, |
78 | .init_clocks = exynos4_init_clocks, | ||
79 | .init_uarts = exynos4_init_uarts, | 80 | .init_uarts = exynos4_init_uarts, |
80 | .init = exynos_init, | 81 | .init = exynos_init, |
81 | .name = name_exynos4210, | 82 | .name = name_exynos4210, |
@@ -83,7 +84,6 @@ static struct cpu_table cpu_ids[] __initdata = { | |||
83 | .idcode = EXYNOS4212_CPU_ID, | 84 | .idcode = EXYNOS4212_CPU_ID, |
84 | .idmask = EXYNOS4_CPU_MASK, | 85 | .idmask = EXYNOS4_CPU_MASK, |
85 | .map_io = exynos4_map_io, | 86 | .map_io = exynos4_map_io, |
86 | .init_clocks = exynos4_init_clocks, | ||
87 | .init_uarts = exynos4_init_uarts, | 87 | .init_uarts = exynos4_init_uarts, |
88 | .init = exynos_init, | 88 | .init = exynos_init, |
89 | .name = name_exynos4212, | 89 | .name = name_exynos4212, |
@@ -91,7 +91,6 @@ static struct cpu_table cpu_ids[] __initdata = { | |||
91 | .idcode = EXYNOS4412_CPU_ID, | 91 | .idcode = EXYNOS4412_CPU_ID, |
92 | .idmask = EXYNOS4_CPU_MASK, | 92 | .idmask = EXYNOS4_CPU_MASK, |
93 | .map_io = exynos4_map_io, | 93 | .map_io = exynos4_map_io, |
94 | .init_clocks = exynos4_init_clocks, | ||
95 | .init_uarts = exynos4_init_uarts, | 94 | .init_uarts = exynos4_init_uarts, |
96 | .init = exynos_init, | 95 | .init = exynos_init, |
97 | .name = name_exynos4412, | 96 | .name = name_exynos4412, |
@@ -99,7 +98,6 @@ static struct cpu_table cpu_ids[] __initdata = { | |||
99 | .idcode = EXYNOS5250_SOC_ID, | 98 | .idcode = EXYNOS5250_SOC_ID, |
100 | .idmask = EXYNOS5_SOC_MASK, | 99 | .idmask = EXYNOS5_SOC_MASK, |
101 | .map_io = exynos5_map_io, | 100 | .map_io = exynos5_map_io, |
102 | .init_clocks = exynos5_init_clocks, | ||
103 | .init = exynos_init, | 101 | .init = exynos_init, |
104 | .name = name_exynos5250, | 102 | .name = name_exynos5250, |
105 | }, { | 103 | }, { |
@@ -257,11 +255,6 @@ static struct map_desc exynos5_iodesc[] __initdata = { | |||
257 | .length = SZ_4K, | 255 | .length = SZ_4K, |
258 | .type = MT_DEVICE, | 256 | .type = MT_DEVICE, |
259 | }, { | 257 | }, { |
260 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
261 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER), | ||
262 | .length = SZ_4K, | ||
263 | .type = MT_DEVICE, | ||
264 | }, { | ||
265 | .virtual = (unsigned long)S5P_VA_SYSRAM, | 258 | .virtual = (unsigned long)S5P_VA_SYSRAM, |
266 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), | 259 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), |
267 | .length = SZ_4K, | 260 | .length = SZ_4K, |
@@ -402,43 +395,26 @@ static void __init exynos5_map_io(void) | |||
402 | iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); | 395 | iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); |
403 | } | 396 | } |
404 | 397 | ||
405 | static void __init exynos4_init_clocks(int xtal) | ||
406 | { | ||
407 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
408 | |||
409 | s3c24xx_register_baseclocks(xtal); | ||
410 | s5p_register_clocks(xtal); | ||
411 | |||
412 | if (soc_is_exynos4210()) | ||
413 | exynos4210_register_clocks(); | ||
414 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
415 | exynos4212_register_clocks(); | ||
416 | |||
417 | exynos4_register_clocks(); | ||
418 | exynos4_setup_clocks(); | ||
419 | } | ||
420 | |||
421 | static void __init exynos5440_map_io(void) | 398 | static void __init exynos5440_map_io(void) |
422 | { | 399 | { |
423 | iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); | 400 | iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); |
424 | } | 401 | } |
425 | 402 | ||
426 | static void __init exynos5_init_clocks(int xtal) | 403 | void __init exynos_init_time(void) |
427 | { | 404 | { |
428 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | 405 | if (of_have_populated_dt()) { |
429 | 406 | #ifdef CONFIG_OF | |
430 | /* EXYNOS5440 can support only common clock framework */ | 407 | of_clk_init(NULL); |
431 | 408 | clocksource_of_init(); | |
432 | if (soc_is_exynos5440()) | 409 | #endif |
433 | return; | 410 | } else { |
434 | 411 | /* todo: remove after migrating legacy E4 platforms to dt */ | |
435 | #ifdef CONFIG_SOC_EXYNOS5250 | 412 | #ifdef CONFIG_ARCH_EXYNOS4 |
436 | s3c24xx_register_baseclocks(xtal); | 413 | exynos4_clk_init(NULL); |
437 | s5p_register_clocks(xtal); | 414 | exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f); |
438 | |||
439 | exynos5_register_clocks(); | ||
440 | exynos5_setup_clocks(); | ||
441 | #endif | 415 | #endif |
416 | mct_init(); | ||
417 | } | ||
442 | } | 418 | } |
443 | 419 | ||
444 | void __init exynos4_init_irq(void) | 420 | void __init exynos4_init_irq(void) |
@@ -824,6 +800,7 @@ static int __init exynos_init_irq_eint(void) | |||
824 | static const struct of_device_id exynos_pinctrl_ids[] = { | 800 | static const struct of_device_id exynos_pinctrl_ids[] = { |
825 | { .compatible = "samsung,exynos4210-pinctrl", }, | 801 | { .compatible = "samsung,exynos4210-pinctrl", }, |
826 | { .compatible = "samsung,exynos4x12-pinctrl", }, | 802 | { .compatible = "samsung,exynos4x12-pinctrl", }, |
803 | { .compatible = "samsung,exynos5250-pinctrl", }, | ||
827 | }; | 804 | }; |
828 | struct device_node *pctrl_np, *wkup_np; | 805 | struct device_node *pctrl_np, *wkup_np; |
829 | const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; | 806 | const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; |
@@ -877,3 +854,30 @@ static int __init exynos_init_irq_eint(void) | |||
877 | return 0; | 854 | return 0; |
878 | } | 855 | } |
879 | arch_initcall(exynos_init_irq_eint); | 856 | arch_initcall(exynos_init_irq_eint); |
857 | |||
858 | static struct resource exynos4_pmu_resource[] = { | ||
859 | DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU), | ||
860 | DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1), | ||
861 | #if defined(CONFIG_SOC_EXYNOS4412) | ||
862 | DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2), | ||
863 | DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3), | ||
864 | #endif | ||
865 | }; | ||
866 | |||
867 | static struct platform_device exynos4_device_pmu = { | ||
868 | .name = "arm-pmu", | ||
869 | .num_resources = ARRAY_SIZE(exynos4_pmu_resource), | ||
870 | .resource = exynos4_pmu_resource, | ||
871 | }; | ||
872 | |||
873 | static int __init exynos_armpmu_init(void) | ||
874 | { | ||
875 | if (!of_have_populated_dt()) { | ||
876 | if (soc_is_exynos4210() || soc_is_exynos4212()) | ||
877 | exynos4_device_pmu.num_resources = 2; | ||
878 | platform_device_register(&exynos4_device_pmu); | ||
879 | } | ||
880 | |||
881 | return 0; | ||
882 | } | ||
883 | arch_initcall(exynos_armpmu_init); | ||
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 9339bb8954be..cb89ab886950 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -12,7 +12,11 @@ | |||
12 | #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H | 12 | #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H |
13 | #define __ARCH_ARM_MACH_EXYNOS_COMMON_H | 13 | #define __ARCH_ARM_MACH_EXYNOS_COMMON_H |
14 | 14 | ||
15 | extern void exynos4_timer_init(void); | 15 | #include <linux/of.h> |
16 | |||
17 | extern void mct_init(void); | ||
18 | void exynos_init_time(void); | ||
19 | extern unsigned long xxti_f, xusbxti_f; | ||
16 | 20 | ||
17 | struct map_desc; | 21 | struct map_desc; |
18 | void exynos_init_io(struct map_desc *mach_desc, int size); | 22 | void exynos_init_io(struct map_desc *mach_desc, int size); |
@@ -22,6 +26,10 @@ void exynos4_restart(char mode, const char *cmd); | |||
22 | void exynos5_restart(char mode, const char *cmd); | 26 | void exynos5_restart(char mode, const char *cmd); |
23 | void exynos_init_late(void); | 27 | void exynos_init_late(void); |
24 | 28 | ||
29 | /* ToDo: remove these after migrating legacy exynos4 platforms to dt */ | ||
30 | void exynos4_clk_init(struct device_node *np); | ||
31 | void exynos4_clk_register_fixed_ext(unsigned long, unsigned long); | ||
32 | |||
25 | #ifdef CONFIG_PM_GENERIC_DOMAINS | 33 | #ifdef CONFIG_PM_GENERIC_DOMAINS |
26 | int exynos_pm_late_initcall(void); | 34 | int exynos_pm_late_initcall(void); |
27 | #else | 35 | #else |
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h index 8bd5dde5fc78..c72f59d91fce 100644 --- a/arch/arm/mach-exynos/include/mach/irqs.h +++ b/arch/arm/mach-exynos/include/mach/irqs.h | |||
@@ -30,8 +30,6 @@ | |||
30 | 30 | ||
31 | /* For EXYNOS4 and EXYNOS5 */ | 31 | /* For EXYNOS4 and EXYNOS5 */ |
32 | 32 | ||
33 | #define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12) | ||
34 | |||
35 | #define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) | 33 | #define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) |
36 | 34 | ||
37 | /* For EXYNOS4 SoCs */ | 35 | /* For EXYNOS4 SoCs */ |
@@ -128,7 +126,7 @@ | |||
128 | #define EXYNOS4_IRQ_ADC1 IRQ_SPI(107) | 126 | #define EXYNOS4_IRQ_ADC1 IRQ_SPI(107) |
129 | #define EXYNOS4_IRQ_PEN1 IRQ_SPI(108) | 127 | #define EXYNOS4_IRQ_PEN1 IRQ_SPI(108) |
130 | #define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) | 128 | #define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) |
131 | #define EXYNOS4_IRQ_PMU IRQ_SPI(110) | 129 | #define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110) |
132 | #define EXYNOS4_IRQ_GPS IRQ_SPI(111) | 130 | #define EXYNOS4_IRQ_GPS IRQ_SPI(111) |
133 | #define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) | 131 | #define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) |
134 | #define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113) | 132 | #define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113) |
@@ -136,6 +134,11 @@ | |||
136 | #define EXYNOS4_IRQ_TSI IRQ_SPI(115) | 134 | #define EXYNOS4_IRQ_TSI IRQ_SPI(115) |
137 | #define EXYNOS4_IRQ_SATA IRQ_SPI(116) | 135 | #define EXYNOS4_IRQ_SATA IRQ_SPI(116) |
138 | 136 | ||
137 | #define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2) | ||
138 | #define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2) | ||
139 | #define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2) | ||
140 | #define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2) | ||
141 | |||
139 | #define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4) | 142 | #define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4) |
140 | #define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4) | 143 | #define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4) |
141 | 144 | ||
@@ -168,7 +171,10 @@ | |||
168 | #define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) | 171 | #define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) |
169 | #define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) | 172 | #define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) |
170 | 173 | ||
171 | #define EXYNOS4_MAX_COMBINER_NR 16 | 174 | #define EXYNOS4210_MAX_COMBINER_NR 16 |
175 | #define EXYNOS4212_MAX_COMBINER_NR 18 | ||
176 | #define EXYNOS4412_MAX_COMBINER_NR 20 | ||
177 | #define EXYNOS4_MAX_COMBINER_NR EXYNOS4412_MAX_COMBINER_NR | ||
172 | 178 | ||
173 | #define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16 | 179 | #define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16 |
174 | #define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 | 180 | #define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 |
@@ -233,7 +239,6 @@ | |||
233 | #define IRQ_TC EXYNOS4_IRQ_PEN0 | 239 | #define IRQ_TC EXYNOS4_IRQ_PEN0 |
234 | 240 | ||
235 | #define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD | 241 | #define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD |
236 | #define IRQ_PMU EXYNOS4_IRQ_PMU | ||
237 | 242 | ||
238 | #define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO | 243 | #define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO |
239 | #define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC | 244 | #define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC |
@@ -323,8 +328,6 @@ | |||
323 | #define EXYNOS5_IRQ_CEC IRQ_SPI(114) | 328 | #define EXYNOS5_IRQ_CEC IRQ_SPI(114) |
324 | #define EXYNOS5_IRQ_SATA IRQ_SPI(115) | 329 | #define EXYNOS5_IRQ_SATA IRQ_SPI(115) |
325 | 330 | ||
326 | #define EXYNOS5_IRQ_MCT_L0 IRQ_SPI(120) | ||
327 | #define EXYNOS5_IRQ_MCT_L1 IRQ_SPI(121) | ||
328 | #define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) | 331 | #define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) |
329 | #define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) | 332 | #define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) |
330 | #define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) | 333 | #define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) |
@@ -419,8 +422,6 @@ | |||
419 | #define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) | 422 | #define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) |
420 | 423 | ||
421 | #define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) | 424 | #define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) |
422 | #define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3) | ||
423 | #define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4) | ||
424 | 425 | ||
425 | #define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) | 426 | #define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) |
426 | #define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1) | 427 | #define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1) |
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 1df6abbf53b8..7f99b7b187d6 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -65,7 +65,6 @@ | |||
65 | #define EXYNOS5_PA_CMU 0x10010000 | 65 | #define EXYNOS5_PA_CMU 0x10010000 |
66 | 66 | ||
67 | #define EXYNOS4_PA_SYSTIMER 0x10050000 | 67 | #define EXYNOS4_PA_SYSTIMER 0x10050000 |
68 | #define EXYNOS5_PA_SYSTIMER 0x101C0000 | ||
69 | 68 | ||
70 | #define EXYNOS4_PA_WATCHDOG 0x10060000 | 69 | #define EXYNOS4_PA_WATCHDOG 0x10060000 |
71 | #define EXYNOS5_PA_WATCHDOG 0x101D0000 | 70 | #define EXYNOS5_PA_WATCHDOG 0x101D0000 |
diff --git a/arch/arm/mach-exynos/include/mach/regs-mct.h b/arch/arm/mach-exynos/include/mach/regs-mct.h deleted file mode 100644 index 80dd02ad6d61..000000000000 --- a/arch/arm/mach-exynos/include/mach/regs-mct.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* arch/arm/mach-exynos4/include/mach/regs-mct.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 MCT configutation | ||
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_MCT_H | ||
14 | #define __ASM_ARCH_REGS_MCT_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define EXYNOS4_MCTREG(x) (S5P_VA_SYSTIMER + (x)) | ||
19 | |||
20 | #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) | ||
21 | #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) | ||
22 | #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) | ||
23 | |||
24 | #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) | ||
25 | #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) | ||
26 | #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) | ||
27 | |||
28 | #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) | ||
29 | |||
30 | #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) | ||
31 | #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) | ||
32 | #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) | ||
33 | |||
34 | #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) | ||
35 | #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) | ||
36 | #define EXYNOS4_MCT_L_MASK (0xffffff00) | ||
37 | |||
38 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
39 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
40 | #define MCT_L_TCON_OFFSET (0x20) | ||
41 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
42 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
43 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
44 | |||
45 | #define MCT_G_TCON_START (1 << 8) | ||
46 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
47 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
48 | |||
49 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
50 | #define MCT_L_TCON_INT_START (1 << 1) | ||
51 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
52 | |||
53 | #endif /* __ASM_ARCH_REGS_MCT_H */ | ||
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c index 2126f3503a3f..5f0f55701374 100644 --- a/arch/arm/mach-exynos/mach-armlex4210.c +++ b/arch/arm/mach-exynos/mach-armlex4210.c | |||
@@ -178,7 +178,6 @@ static void __init armlex4210_smsc911x_init(void) | |||
178 | static void __init armlex4210_map_io(void) | 178 | static void __init armlex4210_map_io(void) |
179 | { | 179 | { |
180 | exynos_init_io(NULL, 0); | 180 | exynos_init_io(NULL, 0); |
181 | s3c24xx_init_clocks(24000000); | ||
182 | s3c24xx_init_uarts(armlex4210_uartcfgs, | 181 | s3c24xx_init_uarts(armlex4210_uartcfgs, |
183 | ARRAY_SIZE(armlex4210_uartcfgs)); | 182 | ARRAY_SIZE(armlex4210_uartcfgs)); |
184 | } | 183 | } |
@@ -203,6 +202,6 @@ MACHINE_START(ARMLEX4210, "ARMLEX4210") | |||
203 | .map_io = armlex4210_map_io, | 202 | .map_io = armlex4210_map_io, |
204 | .init_machine = armlex4210_machine_init, | 203 | .init_machine = armlex4210_machine_init, |
205 | .init_late = exynos_init_late, | 204 | .init_late = exynos_init_late, |
206 | .init_time = exynos4_timer_init, | 205 | .init_time = exynos_init_time, |
207 | .restart = exynos4_restart, | 206 | .restart = exynos4_restart, |
208 | MACHINE_END | 207 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c index 3358088c822a..ac27f3cd121f 100644 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c | |||
@@ -11,121 +11,26 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/kernel.h> | ||
14 | #include <linux/of_platform.h> | 15 | #include <linux/of_platform.h> |
16 | #include <linux/of_fdt.h> | ||
15 | #include <linux/serial_core.h> | 17 | #include <linux/serial_core.h> |
18 | #include <linux/memblock.h> | ||
19 | #include <linux/clocksource.h> | ||
16 | 20 | ||
17 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
18 | #include <mach/map.h> | 22 | #include <plat/mfc.h> |
19 | |||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/regs-serial.h> | ||
22 | 23 | ||
23 | #include "common.h" | 24 | #include "common.h" |
24 | 25 | ||
25 | /* | ||
26 | * The following lookup table is used to override device names when devices | ||
27 | * are registered from device tree. This is temporarily added to enable | ||
28 | * device tree support addition for the Exynos4 architecture. | ||
29 | * | ||
30 | * For drivers that require platform data to be provided from the machine | ||
31 | * file, a platform data pointer can also be supplied along with the | ||
32 | * devices names. Usually, the platform data elements that cannot be parsed | ||
33 | * from the device tree by the drivers (example: function pointers) are | ||
34 | * supplied. But it should be noted that this is a temporary mechanism and | ||
35 | * at some point, the drivers should be capable of parsing all the platform | ||
36 | * data from the device tree. | ||
37 | */ | ||
38 | static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = { | ||
39 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0, | ||
40 | "exynos4210-uart.0", NULL), | ||
41 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1, | ||
42 | "exynos4210-uart.1", NULL), | ||
43 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2, | ||
44 | "exynos4210-uart.2", NULL), | ||
45 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3, | ||
46 | "exynos4210-uart.3", NULL), | ||
47 | OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0), | ||
48 | "exynos4-sdhci.0", NULL), | ||
49 | OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(1), | ||
50 | "exynos4-sdhci.1", NULL), | ||
51 | OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(2), | ||
52 | "exynos4-sdhci.2", NULL), | ||
53 | OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(3), | ||
54 | "exynos4-sdhci.3", NULL), | ||
55 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0), | ||
56 | "s3c2440-i2c.0", NULL), | ||
57 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(1), | ||
58 | "s3c2440-i2c.1", NULL), | ||
59 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(2), | ||
60 | "s3c2440-i2c.2", NULL), | ||
61 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(3), | ||
62 | "s3c2440-i2c.3", NULL), | ||
63 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(4), | ||
64 | "s3c2440-i2c.4", NULL), | ||
65 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(5), | ||
66 | "s3c2440-i2c.5", NULL), | ||
67 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(6), | ||
68 | "s3c2440-i2c.6", NULL), | ||
69 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(7), | ||
70 | "s3c2440-i2c.7", NULL), | ||
71 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0, | ||
72 | "exynos4210-spi.0", NULL), | ||
73 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1, | ||
74 | "exynos4210-spi.1", NULL), | ||
75 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI2, | ||
76 | "exynos4210-spi.2", NULL), | ||
77 | OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL), | ||
78 | OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL), | ||
79 | OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL), | ||
80 | OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU, | ||
81 | "exynos-tmu", NULL), | ||
82 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13620000, | ||
83 | "exynos-sysmmu.0", NULL), /* MFC_L */ | ||
84 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13630000, | ||
85 | "exynos-sysmmu.1", NULL), /* MFC_R */ | ||
86 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E20000, | ||
87 | "exynos-sysmmu.2", NULL), /* TV */ | ||
88 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A60000, | ||
89 | "exynos-sysmmu.3", NULL), /* JPEG */ | ||
90 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A30000, | ||
91 | "exynos-sysmmu.4", NULL), /* ROTATOR */ | ||
92 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A20000, | ||
93 | "exynos-sysmmu.5", NULL), /* FIMC0 */ | ||
94 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A30000, | ||
95 | "exynos-sysmmu.6", NULL), /* FIMC1 */ | ||
96 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A40000, | ||
97 | "exynos-sysmmu.7", NULL), /* FIMC2 */ | ||
98 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A50000, | ||
99 | "exynos-sysmmu.8", NULL), /* FIMC3 */ | ||
100 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A20000, | ||
101 | "exynos-sysmmu.9", NULL), /* G2D(4210) */ | ||
102 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A40000, | ||
103 | "exynos-sysmmu.9", NULL), /* G2D(4x12) */ | ||
104 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11E20000, | ||
105 | "exynos-sysmmu.10", NULL), /* FIMD0 */ | ||
106 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12220000, | ||
107 | "exynos-sysmmu.11", NULL), /* FIMD1(4210) */ | ||
108 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12260000, | ||
109 | "exynos-sysmmu.12", NULL), /* IS0(4x12) */ | ||
110 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x122B0000, | ||
111 | "exynos-sysmmu.13", NULL), /* IS1(4x12) */ | ||
112 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123B0000, | ||
113 | "exynos-sysmmu.14", NULL), /* FIMC-LITE0(4x12) */ | ||
114 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123C0000, | ||
115 | "exynos-sysmmu.15", NULL), /* FIMC-LITE1(4x12) */ | ||
116 | {}, | ||
117 | }; | ||
118 | |||
119 | static void __init exynos4_dt_map_io(void) | 26 | static void __init exynos4_dt_map_io(void) |
120 | { | 27 | { |
121 | exynos_init_io(NULL, 0); | 28 | exynos_init_io(NULL, 0); |
122 | s3c24xx_init_clocks(24000000); | ||
123 | } | 29 | } |
124 | 30 | ||
125 | static void __init exynos4_dt_machine_init(void) | 31 | static void __init exynos4_dt_machine_init(void) |
126 | { | 32 | { |
127 | of_platform_populate(NULL, of_default_bus_match_table, | 33 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
128 | exynos4_auxdata_lookup, NULL); | ||
129 | } | 34 | } |
130 | 35 | ||
131 | static char const *exynos4_dt_compat[] __initdata = { | 36 | static char const *exynos4_dt_compat[] __initdata = { |
@@ -135,6 +40,18 @@ static char const *exynos4_dt_compat[] __initdata = { | |||
135 | NULL | 40 | NULL |
136 | }; | 41 | }; |
137 | 42 | ||
43 | static void __init exynos4_reserve(void) | ||
44 | { | ||
45 | #ifdef CONFIG_S5P_DEV_MFC | ||
46 | struct s5p_mfc_dt_meminfo mfc_mem; | ||
47 | |||
48 | /* Reserve memory for MFC only if it's available */ | ||
49 | mfc_mem.compatible = "samsung,mfc-v5"; | ||
50 | if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem)) | ||
51 | s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff, | ||
52 | mfc_mem.lsize); | ||
53 | #endif | ||
54 | } | ||
138 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") | 55 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") |
139 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ | 56 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ |
140 | .smp = smp_ops(exynos_smp_ops), | 57 | .smp = smp_ops(exynos_smp_ops), |
@@ -142,7 +59,8 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") | |||
142 | .map_io = exynos4_dt_map_io, | 59 | .map_io = exynos4_dt_map_io, |
143 | .init_machine = exynos4_dt_machine_init, | 60 | .init_machine = exynos4_dt_machine_init, |
144 | .init_late = exynos_init_late, | 61 | .init_late = exynos_init_late, |
145 | .init_time = exynos4_timer_init, | 62 | .init_time = exynos_init_time, |
146 | .dt_compat = exynos4_dt_compat, | 63 | .dt_compat = exynos4_dt_compat, |
147 | .restart = exynos4_restart, | 64 | .restart = exynos4_restart, |
65 | .reserve = exynos4_reserve, | ||
148 | MACHINE_END | 66 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index acaeb14db54b..753b94f3fca7 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -11,151 +11,21 @@ | |||
11 | 11 | ||
12 | #include <linux/of_platform.h> | 12 | #include <linux/of_platform.h> |
13 | #include <linux/of_fdt.h> | 13 | #include <linux/of_fdt.h> |
14 | #include <linux/serial_core.h> | ||
15 | #include <linux/memblock.h> | 14 | #include <linux/memblock.h> |
16 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/clocksource.h> | ||
17 | 17 | ||
18 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
19 | #include <mach/map.h> | ||
20 | #include <mach/regs-pmu.h> | 19 | #include <mach/regs-pmu.h> |
21 | 20 | ||
22 | #include <plat/cpu.h> | 21 | #include <plat/cpu.h> |
23 | #include <plat/regs-serial.h> | ||
24 | #include <plat/mfc.h> | 22 | #include <plat/mfc.h> |
25 | 23 | ||
26 | #include "common.h" | 24 | #include "common.h" |
27 | 25 | ||
28 | /* | ||
29 | * The following lookup table is used to override device names when devices | ||
30 | * are registered from device tree. This is temporarily added to enable | ||
31 | * device tree support addition for the EXYNOS5 architecture. | ||
32 | * | ||
33 | * For drivers that require platform data to be provided from the machine | ||
34 | * file, a platform data pointer can also be supplied along with the | ||
35 | * devices names. Usually, the platform data elements that cannot be parsed | ||
36 | * from the device tree by the drivers (example: function pointers) are | ||
37 | * supplied. But it should be noted that this is a temporary mechanism and | ||
38 | * at some point, the drivers should be capable of parsing all the platform | ||
39 | * data from the device tree. | ||
40 | */ | ||
41 | static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { | ||
42 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0, | ||
43 | "exynos4210-uart.0", NULL), | ||
44 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1, | ||
45 | "exynos4210-uart.1", NULL), | ||
46 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2, | ||
47 | "exynos4210-uart.2", NULL), | ||
48 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3, | ||
49 | "exynos4210-uart.3", NULL), | ||
50 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0), | ||
51 | "s3c2440-i2c.0", NULL), | ||
52 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), | ||
53 | "s3c2440-i2c.1", NULL), | ||
54 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2), | ||
55 | "s3c2440-i2c.2", NULL), | ||
56 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3), | ||
57 | "s3c2440-i2c.3", NULL), | ||
58 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4), | ||
59 | "s3c2440-i2c.4", NULL), | ||
60 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5), | ||
61 | "s3c2440-i2c.5", NULL), | ||
62 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6), | ||
63 | "s3c2440-i2c.6", NULL), | ||
64 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7), | ||
65 | "s3c2440-i2c.7", NULL), | ||
66 | OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8), | ||
67 | "s3c2440-hdmiphy-i2c", NULL), | ||
68 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0, | ||
69 | "dw_mmc.0", NULL), | ||
70 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1, | ||
71 | "dw_mmc.1", NULL), | ||
72 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2, | ||
73 | "dw_mmc.2", NULL), | ||
74 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3, | ||
75 | "dw_mmc.3", NULL), | ||
76 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0, | ||
77 | "exynos4210-spi.0", NULL), | ||
78 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1, | ||
79 | "exynos4210-spi.1", NULL), | ||
80 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2, | ||
81 | "exynos4210-spi.2", NULL), | ||
82 | OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000, | ||
83 | "exynos5-sata", NULL), | ||
84 | OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000, | ||
85 | "exynos5-sata-phy", NULL), | ||
86 | OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000, | ||
87 | "exynos5-sata-phy-i2c", NULL), | ||
88 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), | ||
89 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), | ||
90 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), | ||
91 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0, | ||
92 | "exynos-gsc.0", NULL), | ||
93 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1, | ||
94 | "exynos-gsc.1", NULL), | ||
95 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2, | ||
96 | "exynos-gsc.2", NULL), | ||
97 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, | ||
98 | "exynos-gsc.3", NULL), | ||
99 | OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000, | ||
100 | "exynos5-hdmi", NULL), | ||
101 | OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000, | ||
102 | "exynos5-mixer", NULL), | ||
103 | OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL), | ||
104 | OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000, | ||
105 | "exynos-tmu", NULL), | ||
106 | OF_DEV_AUXDATA("samsung,i2s-v5", 0x03830000, | ||
107 | "samsung-i2s.0", NULL), | ||
108 | OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D60000, | ||
109 | "samsung-i2s.1", NULL), | ||
110 | OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D70000, | ||
111 | "samsung-i2s.2", NULL), | ||
112 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11210000, | ||
113 | "exynos-sysmmu.0", "mfc"), /* MFC_L */ | ||
114 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11200000, | ||
115 | "exynos-sysmmu.1", "mfc"), /* MFC_R */ | ||
116 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14650000, | ||
117 | "exynos-sysmmu.2", NULL), /* TV */ | ||
118 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11F20000, | ||
119 | "exynos-sysmmu.3", "jpeg"), /* JPEG */ | ||
120 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11D40000, | ||
121 | "exynos-sysmmu.4", NULL), /* ROTATOR */ | ||
122 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E80000, | ||
123 | "exynos-sysmmu.5", "gscl"), /* GSCL0 */ | ||
124 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E90000, | ||
125 | "exynos-sysmmu.6", "gscl"), /* GSCL1 */ | ||
126 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EA0000, | ||
127 | "exynos-sysmmu.7", "gscl"), /* GSCL2 */ | ||
128 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EB0000, | ||
129 | "exynos-sysmmu.8", "gscl"), /* GSCL3 */ | ||
130 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13260000, | ||
131 | "exynos-sysmmu.9", NULL), /* FIMC-IS0 */ | ||
132 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x132C0000, | ||
133 | "exynos-sysmmu.10", NULL), /* FIMC-IS1 */ | ||
134 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14640000, | ||
135 | "exynos-sysmmu.11", NULL), /* FIMD1 */ | ||
136 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C40000, | ||
137 | "exynos-sysmmu.12", NULL), /* FIMC-LITE0 */ | ||
138 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C50000, | ||
139 | "exynos-sysmmu.13", NULL), /* FIMC-LITE1 */ | ||
140 | OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A60000, | ||
141 | "exynos-sysmmu.14", NULL), /* G2D */ | ||
142 | {}, | ||
143 | }; | ||
144 | |||
145 | static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = { | ||
146 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0, | ||
147 | "exynos4210-uart.0", NULL), | ||
148 | {}, | ||
149 | }; | ||
150 | |||
151 | static void __init exynos5_dt_map_io(void) | 26 | static void __init exynos5_dt_map_io(void) |
152 | { | 27 | { |
153 | unsigned long root = of_get_flat_dt_root(); | ||
154 | |||
155 | exynos_init_io(NULL, 0); | 28 | exynos_init_io(NULL, 0); |
156 | |||
157 | if (of_flat_dt_is_compatible(root, "samsung,exynos5250")) | ||
158 | s3c24xx_init_clocks(24000000); | ||
159 | } | 29 | } |
160 | 30 | ||
161 | static void __init exynos5_dt_machine_init(void) | 31 | static void __init exynos5_dt_machine_init(void) |
@@ -182,12 +52,7 @@ static void __init exynos5_dt_machine_init(void) | |||
182 | } | 52 | } |
183 | } | 53 | } |
184 | 54 | ||
185 | if (of_machine_is_compatible("samsung,exynos5250")) | 55 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
186 | of_platform_populate(NULL, of_default_bus_match_table, | ||
187 | exynos5250_auxdata_lookup, NULL); | ||
188 | else if (of_machine_is_compatible("samsung,exynos5440")) | ||
189 | of_platform_populate(NULL, of_default_bus_match_table, | ||
190 | exynos5440_auxdata_lookup, NULL); | ||
191 | } | 56 | } |
192 | 57 | ||
193 | static char const *exynos5_dt_compat[] __initdata = { | 58 | static char const *exynos5_dt_compat[] __initdata = { |
@@ -216,7 +81,7 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") | |||
216 | .map_io = exynos5_dt_map_io, | 81 | .map_io = exynos5_dt_map_io, |
217 | .init_machine = exynos5_dt_machine_init, | 82 | .init_machine = exynos5_dt_machine_init, |
218 | .init_late = exynos_init_late, | 83 | .init_late = exynos_init_late, |
219 | .init_time = exynos4_timer_init, | 84 | .init_time = exynos_init_time, |
220 | .dt_compat = exynos5_dt_compat, | 85 | .dt_compat = exynos5_dt_compat, |
221 | .restart = exynos5_restart, | 86 | .restart = exynos5_restart, |
222 | .reserve = exynos5_reserve, | 87 | .reserve = exynos5_reserve, |
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 2517406e7f56..5c8b2878dbbd 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -1331,8 +1331,9 @@ static struct platform_device *nuri_devices[] __initdata = { | |||
1331 | static void __init nuri_map_io(void) | 1331 | static void __init nuri_map_io(void) |
1332 | { | 1332 | { |
1333 | exynos_init_io(NULL, 0); | 1333 | exynos_init_io(NULL, 0); |
1334 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
1335 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); | 1334 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); |
1335 | xxti_f = 0; | ||
1336 | xusbxti_f = 24000000; | ||
1336 | } | 1337 | } |
1337 | 1338 | ||
1338 | static void __init nuri_reserve(void) | 1339 | static void __init nuri_reserve(void) |
@@ -1381,7 +1382,7 @@ MACHINE_START(NURI, "NURI") | |||
1381 | .map_io = nuri_map_io, | 1382 | .map_io = nuri_map_io, |
1382 | .init_machine = nuri_machine_init, | 1383 | .init_machine = nuri_machine_init, |
1383 | .init_late = exynos_init_late, | 1384 | .init_late = exynos_init_late, |
1384 | .init_time = exynos4_timer_init, | 1385 | .init_time = exynos_init_time, |
1385 | .reserve = &nuri_reserve, | 1386 | .reserve = &nuri_reserve, |
1386 | .restart = exynos4_restart, | 1387 | .restart = exynos4_restart, |
1387 | MACHINE_END | 1388 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c index ec42024dd13f..27f03ed5d067 100644 --- a/arch/arm/mach-exynos/mach-origen.c +++ b/arch/arm/mach-exynos/mach-origen.c | |||
@@ -755,8 +755,9 @@ static void s5p_tv_setup(void) | |||
755 | static void __init origen_map_io(void) | 755 | static void __init origen_map_io(void) |
756 | { | 756 | { |
757 | exynos_init_io(NULL, 0); | 757 | exynos_init_io(NULL, 0); |
758 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
759 | s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs)); | 758 | s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs)); |
759 | xxti_f = 0; | ||
760 | xusbxti_f = 24000000; | ||
760 | } | 761 | } |
761 | 762 | ||
762 | static void __init origen_power_init(void) | 763 | static void __init origen_power_init(void) |
@@ -816,7 +817,7 @@ MACHINE_START(ORIGEN, "ORIGEN") | |||
816 | .map_io = origen_map_io, | 817 | .map_io = origen_map_io, |
817 | .init_machine = origen_machine_init, | 818 | .init_machine = origen_machine_init, |
818 | .init_late = exynos_init_late, | 819 | .init_late = exynos_init_late, |
819 | .init_time = exynos4_timer_init, | 820 | .init_time = exynos_init_time, |
820 | .reserve = &origen_reserve, | 821 | .reserve = &origen_reserve, |
821 | .restart = exynos4_restart, | 822 | .restart = exynos4_restart, |
822 | MACHINE_END | 823 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c index 5df91236dbb4..2c8af9617920 100644 --- a/arch/arm/mach-exynos/mach-smdk4x12.c +++ b/arch/arm/mach-exynos/mach-smdk4x12.c | |||
@@ -323,7 +323,6 @@ static struct platform_device *smdk4x12_devices[] __initdata = { | |||
323 | static void __init smdk4x12_map_io(void) | 323 | static void __init smdk4x12_map_io(void) |
324 | { | 324 | { |
325 | exynos_init_io(NULL, 0); | 325 | exynos_init_io(NULL, 0); |
326 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
327 | s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); | 326 | s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); |
328 | } | 327 | } |
329 | 328 | ||
@@ -377,7 +376,7 @@ MACHINE_START(SMDK4212, "SMDK4212") | |||
377 | .init_irq = exynos4_init_irq, | 376 | .init_irq = exynos4_init_irq, |
378 | .map_io = smdk4x12_map_io, | 377 | .map_io = smdk4x12_map_io, |
379 | .init_machine = smdk4x12_machine_init, | 378 | .init_machine = smdk4x12_machine_init, |
380 | .init_time = exynos4_timer_init, | 379 | .init_time = exynos_init_time, |
381 | .restart = exynos4_restart, | 380 | .restart = exynos4_restart, |
382 | .reserve = &smdk4x12_reserve, | 381 | .reserve = &smdk4x12_reserve, |
383 | MACHINE_END | 382 | MACHINE_END |
@@ -391,7 +390,7 @@ MACHINE_START(SMDK4412, "SMDK4412") | |||
391 | .map_io = smdk4x12_map_io, | 390 | .map_io = smdk4x12_map_io, |
392 | .init_machine = smdk4x12_machine_init, | 391 | .init_machine = smdk4x12_machine_init, |
393 | .init_late = exynos_init_late, | 392 | .init_late = exynos_init_late, |
394 | .init_time = exynos4_timer_init, | 393 | .init_time = exynos_init_time, |
395 | .restart = exynos4_restart, | 394 | .restart = exynos4_restart, |
396 | .reserve = &smdk4x12_reserve, | 395 | .reserve = &smdk4x12_reserve, |
397 | MACHINE_END | 396 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c index 9680e1291065..d95b8cf85253 100644 --- a/arch/arm/mach-exynos/mach-smdkv310.c +++ b/arch/arm/mach-exynos/mach-smdkv310.c | |||
@@ -372,8 +372,9 @@ static void s5p_tv_setup(void) | |||
372 | static void __init smdkv310_map_io(void) | 372 | static void __init smdkv310_map_io(void) |
373 | { | 373 | { |
374 | exynos_init_io(NULL, 0); | 374 | exynos_init_io(NULL, 0); |
375 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
376 | s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); | 375 | s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); |
376 | xxti_f = 12000000; | ||
377 | xusbxti_f = 24000000; | ||
377 | } | 378 | } |
378 | 379 | ||
379 | static void __init smdkv310_reserve(void) | 380 | static void __init smdkv310_reserve(void) |
@@ -424,7 +425,7 @@ MACHINE_START(SMDKV310, "SMDKV310") | |||
424 | .init_irq = exynos4_init_irq, | 425 | .init_irq = exynos4_init_irq, |
425 | .map_io = smdkv310_map_io, | 426 | .map_io = smdkv310_map_io, |
426 | .init_machine = smdkv310_machine_init, | 427 | .init_machine = smdkv310_machine_init, |
427 | .init_time = exynos4_timer_init, | 428 | .init_time = exynos_init_time, |
428 | .reserve = &smdkv310_reserve, | 429 | .reserve = &smdkv310_reserve, |
429 | .restart = exynos4_restart, | 430 | .restart = exynos4_restart, |
430 | MACHINE_END | 431 | MACHINE_END |
@@ -437,7 +438,7 @@ MACHINE_START(SMDKC210, "SMDKC210") | |||
437 | .map_io = smdkv310_map_io, | 438 | .map_io = smdkv310_map_io, |
438 | .init_machine = smdkv310_machine_init, | 439 | .init_machine = smdkv310_machine_init, |
439 | .init_late = exynos_init_late, | 440 | .init_late = exynos_init_late, |
440 | .init_time = exynos4_timer_init, | 441 | .init_time = exynos_init_time, |
441 | .reserve = &smdkv310_reserve, | 442 | .reserve = &smdkv310_reserve, |
442 | .restart = exynos4_restart, | 443 | .restart = exynos4_restart, |
443 | MACHINE_END | 444 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index d28c7fbaba2d..327d50d4681d 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <plat/mfc.h> | 41 | #include <plat/mfc.h> |
42 | #include <plat/sdhci.h> | 42 | #include <plat/sdhci.h> |
43 | #include <plat/fimc-core.h> | 43 | #include <plat/fimc-core.h> |
44 | #include <plat/s5p-time.h> | 44 | #include <plat/samsung-time.h> |
45 | #include <plat/camport.h> | 45 | #include <plat/camport.h> |
46 | 46 | ||
47 | #include <mach/map.h> | 47 | #include <mach/map.h> |
@@ -1093,9 +1093,10 @@ static struct platform_device *universal_devices[] __initdata = { | |||
1093 | static void __init universal_map_io(void) | 1093 | static void __init universal_map_io(void) |
1094 | { | 1094 | { |
1095 | exynos_init_io(NULL, 0); | 1095 | exynos_init_io(NULL, 0); |
1096 | s3c24xx_init_clocks(clk_xusbxti.rate); | ||
1097 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | 1096 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
1098 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | 1097 | samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); |
1098 | xxti_f = 0; | ||
1099 | xusbxti_f = 24000000; | ||
1099 | } | 1100 | } |
1100 | 1101 | ||
1101 | static void s5p_tv_setup(void) | 1102 | static void s5p_tv_setup(void) |
@@ -1153,7 +1154,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") | |||
1153 | .map_io = universal_map_io, | 1154 | .map_io = universal_map_io, |
1154 | .init_machine = universal_machine_init, | 1155 | .init_machine = universal_machine_init, |
1155 | .init_late = exynos_init_late, | 1156 | .init_late = exynos_init_late, |
1156 | .init_time = s5p_timer_init, | 1157 | .init_time = samsung_timer_init, |
1157 | .reserve = &universal_reserve, | 1158 | .reserve = &universal_reserve, |
1158 | .restart = exynos4_restart, | 1159 | .restart = exynos4_restart, |
1159 | MACHINE_END | 1160 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 2612eeaa5889..a4d4664894e1 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -445,16 +445,23 @@ static void enable_board_wakeup_source(void) | |||
445 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); | 445 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); |
446 | } | 446 | } |
447 | 447 | ||
448 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
449 | { | ||
450 | .port = 1, | ||
451 | .reset_gpio = 57, | ||
452 | .vcc_gpio = -EINVAL, | ||
453 | }, | ||
454 | { | ||
455 | .port = 2, | ||
456 | .reset_gpio = 61, | ||
457 | .vcc_gpio = -EINVAL, | ||
458 | }, | ||
459 | }; | ||
460 | |||
448 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 461 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
449 | 462 | ||
450 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 463 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
451 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 464 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
452 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
453 | |||
454 | .phy_reset = true, | ||
455 | .reset_gpio_port[0] = 57, | ||
456 | .reset_gpio_port[1] = 61, | ||
457 | .reset_gpio_port[2] = -EINVAL | ||
458 | }; | 465 | }; |
459 | 466 | ||
460 | #ifdef CONFIG_OMAP_MUX | 467 | #ifdef CONFIG_OMAP_MUX |
@@ -606,6 +613,8 @@ static void __init omap_3430sdp_init(void) | |||
606 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); | 613 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); |
607 | sdp3430_display_init(); | 614 | sdp3430_display_init(); |
608 | enable_board_wakeup_source(); | 615 | enable_board_wakeup_source(); |
616 | |||
617 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
609 | usbhs_init(&usbhs_bdata); | 618 | usbhs_init(&usbhs_bdata); |
610 | } | 619 | } |
611 | 620 | ||
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c index 67447bd4564f..20d6d8189240 100644 --- a/arch/arm/mach-omap2/board-3630sdp.c +++ b/arch/arm/mach-omap2/board-3630sdp.c | |||
@@ -53,16 +53,23 @@ static void enable_board_wakeup_source(void) | |||
53 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); | 53 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); |
54 | } | 54 | } |
55 | 55 | ||
56 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
57 | { | ||
58 | .port = 1, | ||
59 | .reset_gpio = 126, | ||
60 | .vcc_gpio = -EINVAL, | ||
61 | }, | ||
62 | { | ||
63 | .port = 2, | ||
64 | .reset_gpio = 61, | ||
65 | .vcc_gpio = -EINVAL, | ||
66 | }, | ||
67 | }; | ||
68 | |||
56 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 69 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
57 | 70 | ||
58 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 71 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
59 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 72 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
60 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
61 | |||
62 | .phy_reset = true, | ||
63 | .reset_gpio_port[0] = 126, | ||
64 | .reset_gpio_port[1] = 61, | ||
65 | .reset_gpio_port[2] = -EINVAL | ||
66 | }; | 73 | }; |
67 | 74 | ||
68 | #ifdef CONFIG_OMAP_MUX | 75 | #ifdef CONFIG_OMAP_MUX |
@@ -199,6 +206,8 @@ static void __init omap_sdp_init(void) | |||
199 | board_smc91x_init(); | 206 | board_smc91x_init(); |
200 | board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); | 207 | board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); |
201 | enable_board_wakeup_source(); | 208 | enable_board_wakeup_source(); |
209 | |||
210 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
202 | usbhs_init(&usbhs_bdata); | 211 | usbhs_init(&usbhs_bdata); |
203 | } | 212 | } |
204 | 213 | ||
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c index 7d3358b2e593..fc53911d0d13 100644 --- a/arch/arm/mach-omap2/board-am3517crane.c +++ b/arch/arm/mach-omap2/board-am3517crane.c | |||
@@ -47,15 +47,17 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
47 | }; | 47 | }; |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
51 | { | ||
52 | .port = 1, | ||
53 | .reset_gpio = GPIO_USB_NRESET, | ||
54 | .vcc_gpio = GPIO_USB_POWER, | ||
55 | .vcc_polarity = 1, | ||
56 | }, | ||
57 | }; | ||
58 | |||
50 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 59 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
51 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 60 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
52 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
53 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
54 | |||
55 | .phy_reset = true, | ||
56 | .reset_gpio_port[0] = GPIO_USB_NRESET, | ||
57 | .reset_gpio_port[1] = -EINVAL, | ||
58 | .reset_gpio_port[2] = -EINVAL | ||
59 | }; | 61 | }; |
60 | 62 | ||
61 | static struct mtd_partition crane_nand_partitions[] = { | 63 | static struct mtd_partition crane_nand_partitions[] = { |
@@ -131,13 +133,7 @@ static void __init am3517_crane_init(void) | |||
131 | return; | 133 | return; |
132 | } | 134 | } |
133 | 135 | ||
134 | ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, | 136 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); |
135 | "usb_ehci_enable"); | ||
136 | if (ret < 0) { | ||
137 | pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | usbhs_init(&usbhs_bdata); | 137 | usbhs_init(&usbhs_bdata); |
142 | am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); | 138 | am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); |
143 | } | 139 | } |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 1d6c28872505..c29d2e743688 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -273,6 +273,14 @@ static __init void am3517_evm_mcbsp1_init(void) | |||
273 | omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); | 273 | omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); |
274 | } | 274 | } |
275 | 275 | ||
276 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
277 | { | ||
278 | .port = 1, | ||
279 | .reset_gpio = 57, | ||
280 | .vcc_gpio = -EINVAL, | ||
281 | }, | ||
282 | }; | ||
283 | |||
276 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 284 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
277 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 285 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
278 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | 286 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ |
@@ -281,12 +289,6 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | |||
281 | #else | 289 | #else |
282 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 290 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
283 | #endif | 291 | #endif |
284 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
285 | |||
286 | .phy_reset = true, | ||
287 | .reset_gpio_port[0] = 57, | ||
288 | .reset_gpio_port[1] = -EINVAL, | ||
289 | .reset_gpio_port[2] = -EINVAL | ||
290 | }; | 292 | }; |
291 | 293 | ||
292 | #ifdef CONFIG_OMAP_MUX | 294 | #ifdef CONFIG_OMAP_MUX |
@@ -348,7 +350,6 @@ static struct omap2_hsmmc_info mmc[] = { | |||
348 | {} /* Terminator */ | 350 | {} /* Terminator */ |
349 | }; | 351 | }; |
350 | 352 | ||
351 | |||
352 | static void __init am3517_evm_init(void) | 353 | static void __init am3517_evm_init(void) |
353 | { | 354 | { |
354 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 355 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
@@ -360,6 +361,8 @@ static void __init am3517_evm_init(void) | |||
360 | 361 | ||
361 | /* Configure GPIO for EHCI port */ | 362 | /* Configure GPIO for EHCI port */ |
362 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); | 363 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); |
364 | |||
365 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
363 | usbhs_init(&usbhs_bdata); | 366 | usbhs_init(&usbhs_bdata); |
364 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); | 367 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); |
365 | /* DSS */ | 368 | /* DSS */ |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index bccd3e51fecb..e0ed8c07fc54 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -418,15 +418,22 @@ static struct omap2_hsmmc_info mmc[] = { | |||
418 | {} /* Terminator */ | 418 | {} /* Terminator */ |
419 | }; | 419 | }; |
420 | 420 | ||
421 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
422 | { | ||
423 | .port = 1, | ||
424 | .reset_gpio = OMAP_MAX_GPIO_LINES + 6, | ||
425 | .vcc_gpio = -EINVAL, | ||
426 | }, | ||
427 | { | ||
428 | .port = 2, | ||
429 | .reset_gpio = OMAP_MAX_GPIO_LINES + 7, | ||
430 | .vcc_gpio = -EINVAL, | ||
431 | }, | ||
432 | }; | ||
433 | |||
421 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 434 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
422 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 435 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
423 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 436 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
424 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
425 | |||
426 | .phy_reset = true, | ||
427 | .reset_gpio_port[0] = OMAP_MAX_GPIO_LINES + 6, | ||
428 | .reset_gpio_port[1] = OMAP_MAX_GPIO_LINES + 7, | ||
429 | .reset_gpio_port[2] = -EINVAL | ||
430 | }; | 437 | }; |
431 | 438 | ||
432 | static void __init cm_t35_init_usbh(void) | 439 | static void __init cm_t35_init_usbh(void) |
@@ -443,6 +450,7 @@ static void __init cm_t35_init_usbh(void) | |||
443 | msleep(1); | 450 | msleep(1); |
444 | } | 451 | } |
445 | 452 | ||
453 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
446 | usbhs_init(&usbhs_bdata); | 454 | usbhs_init(&usbhs_bdata); |
447 | } | 455 | } |
448 | 456 | ||
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c index a66da808cc4a..4eb5e6f2f7f5 100644 --- a/arch/arm/mach-omap2/board-cm-t3517.c +++ b/arch/arm/mach-omap2/board-cm-t3517.c | |||
@@ -188,15 +188,22 @@ static inline void cm_t3517_init_rtc(void) {} | |||
188 | #define HSUSB2_RESET_GPIO (147) | 188 | #define HSUSB2_RESET_GPIO (147) |
189 | #define USB_HUB_RESET_GPIO (152) | 189 | #define USB_HUB_RESET_GPIO (152) |
190 | 190 | ||
191 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
192 | { | ||
193 | .port = 1, | ||
194 | .reset_gpio = HSUSB1_RESET_GPIO, | ||
195 | .vcc_gpio = -EINVAL, | ||
196 | }, | ||
197 | { | ||
198 | .port = 2, | ||
199 | .reset_gpio = HSUSB2_RESET_GPIO, | ||
200 | .vcc_gpio = -EINVAL, | ||
201 | }, | ||
202 | }; | ||
203 | |||
191 | static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { | 204 | static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { |
192 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 205 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
193 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 206 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
194 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
195 | |||
196 | .phy_reset = true, | ||
197 | .reset_gpio_port[0] = HSUSB1_RESET_GPIO, | ||
198 | .reset_gpio_port[1] = HSUSB2_RESET_GPIO, | ||
199 | .reset_gpio_port[2] = -EINVAL, | ||
200 | }; | 207 | }; |
201 | 208 | ||
202 | static int __init cm_t3517_init_usbh(void) | 209 | static int __init cm_t3517_init_usbh(void) |
@@ -213,6 +220,7 @@ static int __init cm_t3517_init_usbh(void) | |||
213 | msleep(1); | 220 | msleep(1); |
214 | } | 221 | } |
215 | 222 | ||
223 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
216 | usbhs_init(&cm_t3517_ehci_pdata); | 224 | usbhs_init(&cm_t3517_ehci_pdata); |
217 | 225 | ||
218 | return 0; | 226 | return 0; |
@@ -324,6 +332,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517") | |||
324 | .handle_irq = omap3_intc_handle_irq, | 332 | .handle_irq = omap3_intc_handle_irq, |
325 | .init_machine = cm_t3517_init, | 333 | .init_machine = cm_t3517_init, |
326 | .init_late = am35xx_init_late, | 334 | .init_late = am35xx_init_late, |
327 | .init_time = omap3_gp_gptimer_timer_init, | 335 | .init_time = omap3_gptimer_timer_init, |
328 | .restart = omap3xxx_restart, | 336 | .restart = omap3xxx_restart, |
329 | MACHINE_END | 337 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 12d2126a2382..e44b804f75ae 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -436,15 +436,7 @@ static struct platform_device *devkit8000_devices[] __initdata = { | |||
436 | }; | 436 | }; |
437 | 437 | ||
438 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 438 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
439 | |||
440 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 439 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
441 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
442 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
443 | |||
444 | .phy_reset = true, | ||
445 | .reset_gpio_port[0] = -EINVAL, | ||
446 | .reset_gpio_port[1] = -EINVAL, | ||
447 | .reset_gpio_port[2] = -EINVAL | ||
448 | }; | 440 | }; |
449 | 441 | ||
450 | #ifdef CONFIG_OMAP_MUX | 442 | #ifdef CONFIG_OMAP_MUX |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index e54a48060198..78813b397209 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -140,7 +140,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)") | |||
140 | .init_irq = omap_intc_of_init, | 140 | .init_irq = omap_intc_of_init, |
141 | .handle_irq = omap3_intc_handle_irq, | 141 | .handle_irq = omap3_intc_handle_irq, |
142 | .init_machine = omap_generic_init, | 142 | .init_machine = omap_generic_init, |
143 | .init_time = omap3_am33xx_gptimer_timer_init, | 143 | .init_time = omap3_gptimer_timer_init, |
144 | .dt_compat = am33xx_boards_compat, | 144 | .dt_compat = am33xx_boards_compat, |
145 | .restart = am33xx_restart, | 145 | .restart = am33xx_restart, |
146 | MACHINE_END | 146 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index e979d48270c9..b54562d1235e 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -527,26 +527,28 @@ static void __init igep_i2c_init(void) | |||
527 | omap3_pmic_init("twl4030", &igep_twldata); | 527 | omap3_pmic_init("twl4030", &igep_twldata); |
528 | } | 528 | } |
529 | 529 | ||
530 | static struct usbhs_phy_data igep2_phy_data[] __initdata = { | ||
531 | { | ||
532 | .port = 1, | ||
533 | .reset_gpio = IGEP2_GPIO_USBH_NRESET, | ||
534 | .vcc_gpio = -EINVAL, | ||
535 | }, | ||
536 | }; | ||
537 | |||
538 | static struct usbhs_phy_data igep3_phy_data[] __initdata = { | ||
539 | { | ||
540 | .port = 2, | ||
541 | .reset_gpio = IGEP3_GPIO_USBH_NRESET, | ||
542 | .vcc_gpio = -EINVAL, | ||
543 | }, | ||
544 | }; | ||
545 | |||
530 | static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { | 546 | static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { |
531 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 547 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
532 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
533 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
534 | |||
535 | .phy_reset = true, | ||
536 | .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, | ||
537 | .reset_gpio_port[1] = -EINVAL, | ||
538 | .reset_gpio_port[2] = -EINVAL, | ||
539 | }; | 548 | }; |
540 | 549 | ||
541 | static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { | 550 | static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { |
542 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
543 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 551 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
544 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
545 | |||
546 | .phy_reset = true, | ||
547 | .reset_gpio_port[0] = -EINVAL, | ||
548 | .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, | ||
549 | .reset_gpio_port[2] = -EINVAL, | ||
550 | }; | 552 | }; |
551 | 553 | ||
552 | #ifdef CONFIG_OMAP_MUX | 554 | #ifdef CONFIG_OMAP_MUX |
@@ -642,8 +644,10 @@ static void __init igep_init(void) | |||
642 | if (machine_is_igep0020()) { | 644 | if (machine_is_igep0020()) { |
643 | omap_display_init(&igep2_dss_data); | 645 | omap_display_init(&igep2_dss_data); |
644 | igep2_init_smsc911x(); | 646 | igep2_init_smsc911x(); |
647 | usbhs_init_phys(igep2_phy_data, ARRAY_SIZE(igep2_phy_data)); | ||
645 | usbhs_init(&igep2_usbhs_bdata); | 648 | usbhs_init(&igep2_usbhs_bdata); |
646 | } else { | 649 | } else { |
650 | usbhs_init_phys(igep3_phy_data, ARRAY_SIZE(igep3_phy_data)); | ||
647 | usbhs_init(&igep3_usbhs_bdata); | 651 | usbhs_init(&igep3_usbhs_bdata); |
648 | } | 652 | } |
649 | } | 653 | } |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index fff141330a63..6de78605c0af 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mtd/nand.h> | 33 | #include <linux/mtd/nand.h> |
34 | #include <linux/mmc/host.h> | 34 | #include <linux/mmc/host.h> |
35 | #include <linux/usb/phy.h> | 35 | #include <linux/usb/phy.h> |
36 | #include <linux/usb/nop-usb-xceiv.h> | ||
36 | 37 | ||
37 | #include <linux/regulator/machine.h> | 38 | #include <linux/regulator/machine.h> |
38 | #include <linux/i2c/twl.h> | 39 | #include <linux/i2c/twl.h> |
@@ -277,6 +278,21 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = { | |||
277 | 278 | ||
278 | static struct gpio_led gpio_leds[]; | 279 | static struct gpio_led gpio_leds[]; |
279 | 280 | ||
281 | /* PHY's VCC regulator might be added later, so flag that we need it */ | ||
282 | static struct nop_usb_xceiv_platform_data hsusb2_phy_data = { | ||
283 | .needs_vcc = true, | ||
284 | }; | ||
285 | |||
286 | static struct usbhs_phy_data phy_data[] = { | ||
287 | { | ||
288 | .port = 2, | ||
289 | .reset_gpio = 147, | ||
290 | .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */ | ||
291 | .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */ | ||
292 | .platform_data = &hsusb2_phy_data, | ||
293 | }, | ||
294 | }; | ||
295 | |||
280 | static int beagle_twl_gpio_setup(struct device *dev, | 296 | static int beagle_twl_gpio_setup(struct device *dev, |
281 | unsigned gpio, unsigned ngpio) | 297 | unsigned gpio, unsigned ngpio) |
282 | { | 298 | { |
@@ -318,9 +334,11 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
318 | } | 334 | } |
319 | dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; | 335 | dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; |
320 | 336 | ||
321 | gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, | 337 | /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */ |
322 | "nEN_USB_PWR"); | 338 | phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX; |
339 | phy_data[0].vcc_polarity = beagle_config.usb_pwr_level; | ||
323 | 340 | ||
341 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
324 | return 0; | 342 | return 0; |
325 | } | 343 | } |
326 | 344 | ||
@@ -453,15 +471,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = { | |||
453 | }; | 471 | }; |
454 | 472 | ||
455 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 473 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
456 | |||
457 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
458 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 474 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
459 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
460 | |||
461 | .phy_reset = true, | ||
462 | .reset_gpio_port[0] = -EINVAL, | ||
463 | .reset_gpio_port[1] = 147, | ||
464 | .reset_gpio_port[2] = -EINVAL | ||
465 | }; | 475 | }; |
466 | 476 | ||
467 | #ifdef CONFIG_OMAP_MUX | 477 | #ifdef CONFIG_OMAP_MUX |
@@ -543,7 +553,9 @@ static void __init omap3_beagle_init(void) | |||
543 | 553 | ||
544 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 554 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
545 | usb_musb_init(NULL); | 555 | usb_musb_init(NULL); |
556 | |||
546 | usbhs_init(&usbhs_bdata); | 557 | usbhs_init(&usbhs_bdata); |
558 | |||
547 | board_nand_init(omap3beagle_nand_partitions, | 559 | board_nand_init(omap3beagle_nand_partitions, |
548 | ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, | 560 | ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, |
549 | NAND_BUSWIDTH_16, NULL); | 561 | NAND_BUSWIDTH_16, NULL); |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 233a0d528fcf..4f1bbc3cc29b 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -496,7 +496,7 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = { | |||
496 | static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { | 496 | static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { |
497 | REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ | 497 | REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ |
498 | REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ | 498 | REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ |
499 | REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), | 499 | REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ |
500 | REGULATOR_SUPPLY("vaux2", NULL), | 500 | REGULATOR_SUPPLY("vaux2", NULL), |
501 | }; | 501 | }; |
502 | 502 | ||
@@ -539,17 +539,16 @@ static int __init omap3_evm_i2c_init(void) | |||
539 | return 0; | 539 | return 0; |
540 | } | 540 | } |
541 | 541 | ||
542 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 542 | static struct usbhs_phy_data phy_data[] __initdata = { |
543 | { | ||
544 | .port = 2, | ||
545 | .reset_gpio = -1, /* set at runtime */ | ||
546 | .vcc_gpio = -EINVAL, | ||
547 | }, | ||
548 | }; | ||
543 | 549 | ||
544 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | 550 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
545 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 551 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
546 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
547 | |||
548 | .phy_reset = true, | ||
549 | /* PHY reset GPIO will be runtime programmed based on EVM version */ | ||
550 | .reset_gpio_port[0] = -EINVAL, | ||
551 | .reset_gpio_port[1] = -EINVAL, | ||
552 | .reset_gpio_port[2] = -EINVAL | ||
553 | }; | 552 | }; |
554 | 553 | ||
555 | #ifdef CONFIG_OMAP_MUX | 554 | #ifdef CONFIG_OMAP_MUX |
@@ -725,7 +724,7 @@ static void __init omap3_evm_init(void) | |||
725 | 724 | ||
726 | /* setup EHCI phy reset config */ | 725 | /* setup EHCI phy reset config */ |
727 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); | 726 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
728 | usbhs_bdata.reset_gpio_port[1] = 21; | 727 | phy_data[0].reset_gpio = 21; |
729 | 728 | ||
730 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ | 729 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ |
731 | musb_board_data.power = 500; | 730 | musb_board_data.power = 500; |
@@ -733,10 +732,12 @@ static void __init omap3_evm_init(void) | |||
733 | } else { | 732 | } else { |
734 | /* setup EHCI phy reset on MDC */ | 733 | /* setup EHCI phy reset on MDC */ |
735 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); | 734 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); |
736 | usbhs_bdata.reset_gpio_port[1] = 135; | 735 | phy_data[0].reset_gpio = 135; |
737 | } | 736 | } |
738 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 737 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
739 | usb_musb_init(&musb_board_data); | 738 | usb_musb_init(&musb_board_data); |
739 | |||
740 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
740 | usbhs_init(&usbhs_bdata); | 741 | usbhs_init(&usbhs_bdata); |
741 | board_nand_init(omap3evm_nand_partitions, | 742 | board_nand_init(omap3evm_nand_partitions, |
742 | ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS, | 743 | ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS, |
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 2bba362148a0..1004d2aaa68f 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -346,7 +346,7 @@ static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = { | |||
346 | }; | 346 | }; |
347 | 347 | ||
348 | static struct regulator_consumer_supply pandora_usb_phy_supply[] = { | 348 | static struct regulator_consumer_supply pandora_usb_phy_supply[] = { |
349 | REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), | 349 | REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ |
350 | }; | 350 | }; |
351 | 351 | ||
352 | /* ads7846 on SPI and 2 nub controllers on I2C */ | 352 | /* ads7846 on SPI and 2 nub controllers on I2C */ |
@@ -561,6 +561,14 @@ fail: | |||
561 | printk(KERN_ERR "wl1251 board initialisation failed\n"); | 561 | printk(KERN_ERR "wl1251 board initialisation failed\n"); |
562 | } | 562 | } |
563 | 563 | ||
564 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
565 | { | ||
566 | .port = 2, | ||
567 | .reset_gpio = 16, | ||
568 | .vcc_gpio = -EINVAL, | ||
569 | }, | ||
570 | }; | ||
571 | |||
564 | static struct platform_device *omap3pandora_devices[] __initdata = { | 572 | static struct platform_device *omap3pandora_devices[] __initdata = { |
565 | &pandora_leds_gpio, | 573 | &pandora_leds_gpio, |
566 | &pandora_keys_gpio, | 574 | &pandora_keys_gpio, |
@@ -569,15 +577,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = { | |||
569 | }; | 577 | }; |
570 | 578 | ||
571 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 579 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
572 | |||
573 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
574 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 580 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
575 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
576 | |||
577 | .phy_reset = true, | ||
578 | .reset_gpio_port[0] = -EINVAL, | ||
579 | .reset_gpio_port[1] = 16, | ||
580 | .reset_gpio_port[2] = -EINVAL | ||
581 | }; | 581 | }; |
582 | 582 | ||
583 | #ifdef CONFIG_OMAP_MUX | 583 | #ifdef CONFIG_OMAP_MUX |
@@ -601,7 +601,10 @@ static void __init omap3pandora_init(void) | |||
601 | spi_register_board_info(omap3pandora_spi_board_info, | 601 | spi_register_board_info(omap3pandora_spi_board_info, |
602 | ARRAY_SIZE(omap3pandora_spi_board_info)); | 602 | ARRAY_SIZE(omap3pandora_spi_board_info)); |
603 | omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); | 603 | omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); |
604 | |||
605 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
604 | usbhs_init(&usbhs_bdata); | 606 | usbhs_init(&usbhs_bdata); |
607 | |||
605 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 608 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
606 | usb_musb_init(NULL); | 609 | usb_musb_init(NULL); |
607 | gpmc_nand_init(&pandora_nand_data, NULL); | 610 | gpmc_nand_init(&pandora_nand_data, NULL); |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 495b989f9040..8afbba0923d6 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -357,19 +357,20 @@ static int __init omap3_stalker_i2c_init(void) | |||
357 | 357 | ||
358 | #define OMAP3_STALKER_TS_GPIO 175 | 358 | #define OMAP3_STALKER_TS_GPIO 175 |
359 | 359 | ||
360 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
361 | { | ||
362 | .port = 2, | ||
363 | .reset_gpio = 21, | ||
364 | .vcc_gpio = -EINVAL, | ||
365 | }, | ||
366 | }; | ||
367 | |||
360 | static struct platform_device *omap3_stalker_devices[] __initdata = { | 368 | static struct platform_device *omap3_stalker_devices[] __initdata = { |
361 | &keys_gpio, | 369 | &keys_gpio, |
362 | }; | 370 | }; |
363 | 371 | ||
364 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 372 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
365 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
366 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 373 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
367 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
368 | |||
369 | .phy_reset = true, | ||
370 | .reset_gpio_port[0] = -EINVAL, | ||
371 | .reset_gpio_port[1] = 21, | ||
372 | .reset_gpio_port[2] = -EINVAL, | ||
373 | }; | 374 | }; |
374 | 375 | ||
375 | #ifdef CONFIG_OMAP_MUX | 376 | #ifdef CONFIG_OMAP_MUX |
@@ -406,6 +407,8 @@ static void __init omap3_stalker_init(void) | |||
406 | omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); | 407 | omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); |
407 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 408 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
408 | usb_musb_init(NULL); | 409 | usb_musb_init(NULL); |
410 | |||
411 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
409 | usbhs_init(&usbhs_bdata); | 412 | usbhs_init(&usbhs_bdata); |
410 | omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); | 413 | omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); |
411 | 414 | ||
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index bcd44fbcd877..7da48bc42bbf 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -305,21 +305,22 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
305 | }; | 305 | }; |
306 | #endif | 306 | #endif |
307 | 307 | ||
308 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
309 | { | ||
310 | .port = 2, | ||
311 | .reset_gpio = 147, | ||
312 | .vcc_gpio = -EINVAL, | ||
313 | }, | ||
314 | }; | ||
315 | |||
308 | static struct platform_device *omap3_touchbook_devices[] __initdata = { | 316 | static struct platform_device *omap3_touchbook_devices[] __initdata = { |
309 | &leds_gpio, | 317 | &leds_gpio, |
310 | &keys_gpio, | 318 | &keys_gpio, |
311 | }; | 319 | }; |
312 | 320 | ||
313 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 321 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
314 | |||
315 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 322 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
316 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 323 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
317 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
318 | |||
319 | .phy_reset = true, | ||
320 | .reset_gpio_port[0] = -EINVAL, | ||
321 | .reset_gpio_port[1] = 147, | ||
322 | .reset_gpio_port[2] = -EINVAL | ||
323 | }; | 324 | }; |
324 | 325 | ||
325 | static void omap3_touchbook_poweroff(void) | 326 | static void omap3_touchbook_poweroff(void) |
@@ -368,6 +369,8 @@ static void __init omap3_touchbook_init(void) | |||
368 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); | 369 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); |
369 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 370 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
370 | usb_musb_init(NULL); | 371 | usb_musb_init(NULL); |
372 | |||
373 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
371 | usbhs_init(&usbhs_bdata); | 374 | usbhs_init(&usbhs_bdata); |
372 | board_nand_init(omap3touchbook_nand_partitions, | 375 | board_nand_init(omap3touchbook_nand_partitions, |
373 | ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, | 376 | ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index b02c2f00609b..a71ad345f20d 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/ti_wilink_st.h> | 31 | #include <linux/ti_wilink_st.h> |
32 | #include <linux/usb/musb.h> | 32 | #include <linux/usb/musb.h> |
33 | #include <linux/usb/phy.h> | 33 | #include <linux/usb/phy.h> |
34 | #include <linux/usb/nop-usb-xceiv.h> | ||
34 | #include <linux/wl12xx.h> | 35 | #include <linux/wl12xx.h> |
35 | #include <linux/irqchip/arm-gic.h> | 36 | #include <linux/irqchip/arm-gic.h> |
36 | #include <linux/platform_data/omap-abe-twl6040.h> | 37 | #include <linux/platform_data/omap-abe-twl6040.h> |
@@ -132,6 +133,22 @@ static struct platform_device btwilink_device = { | |||
132 | .id = -1, | 133 | .id = -1, |
133 | }; | 134 | }; |
134 | 135 | ||
136 | /* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */ | ||
137 | static struct nop_usb_xceiv_platform_data hsusb1_phy_data = { | ||
138 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ | ||
139 | .clk_rate = 19200000, | ||
140 | }; | ||
141 | |||
142 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
143 | { | ||
144 | .port = 1, | ||
145 | .reset_gpio = GPIO_HUB_NRESET, | ||
146 | .vcc_gpio = GPIO_HUB_POWER, | ||
147 | .vcc_polarity = 1, | ||
148 | .platform_data = &hsusb1_phy_data, | ||
149 | }, | ||
150 | }; | ||
151 | |||
135 | static struct platform_device *panda_devices[] __initdata = { | 152 | static struct platform_device *panda_devices[] __initdata = { |
136 | &leds_gpio, | 153 | &leds_gpio, |
137 | &wl1271_device, | 154 | &wl1271_device, |
@@ -142,49 +159,19 @@ static struct platform_device *panda_devices[] __initdata = { | |||
142 | 159 | ||
143 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 160 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
144 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 161 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
145 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
146 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
147 | .phy_reset = false, | ||
148 | .reset_gpio_port[0] = -EINVAL, | ||
149 | .reset_gpio_port[1] = -EINVAL, | ||
150 | .reset_gpio_port[2] = -EINVAL | ||
151 | }; | ||
152 | |||
153 | static struct gpio panda_ehci_gpios[] __initdata = { | ||
154 | { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, | ||
155 | { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, | ||
156 | }; | 162 | }; |
157 | 163 | ||
158 | static void __init omap4_ehci_init(void) | 164 | static void __init omap4_ehci_init(void) |
159 | { | 165 | { |
160 | int ret; | 166 | int ret; |
161 | struct clk *phy_ref_clk; | ||
162 | 167 | ||
163 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ | 168 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ |
164 | phy_ref_clk = clk_get(NULL, "auxclk3_ck"); | 169 | ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL); |
165 | if (IS_ERR(phy_ref_clk)) { | 170 | if (ret) |
166 | pr_err("Cannot request auxclk3\n"); | 171 | pr_err("Failed to add main_clk alias to auxclk3_ck\n"); |
167 | return; | ||
168 | } | ||
169 | clk_set_rate(phy_ref_clk, 19200000); | ||
170 | clk_prepare_enable(phy_ref_clk); | ||
171 | |||
172 | /* disable the power to the usb hub prior to init and reset phy+hub */ | ||
173 | ret = gpio_request_array(panda_ehci_gpios, | ||
174 | ARRAY_SIZE(panda_ehci_gpios)); | ||
175 | if (ret) { | ||
176 | pr_err("Unable to initialize EHCI power/reset\n"); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | gpio_export(GPIO_HUB_POWER, 0); | ||
181 | gpio_export(GPIO_HUB_NRESET, 0); | ||
182 | gpio_set_value(GPIO_HUB_NRESET, 1); | ||
183 | 172 | ||
173 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
184 | usbhs_init(&usbhs_bdata); | 174 | usbhs_init(&usbhs_bdata); |
185 | |||
186 | /* enable power to hub */ | ||
187 | gpio_set_value(GPIO_HUB_POWER, 1); | ||
188 | } | 175 | } |
189 | 176 | ||
190 | static struct omap_musb_board_data musb_board_data = { | 177 | static struct omap_musb_board_data musb_board_data = { |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 630833235cbc..f9101407cd56 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -457,14 +457,16 @@ static int __init overo_spi_init(void) | |||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
460 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
461 | { | ||
462 | .port = 2, | ||
463 | .reset_gpio = OVERO_GPIO_USBH_NRESET, | ||
464 | .vcc_gpio = -EINVAL, | ||
465 | }, | ||
466 | }; | ||
467 | |||
460 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 468 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
461 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
462 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 469 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
463 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
464 | .phy_reset = true, | ||
465 | .reset_gpio_port[0] = -EINVAL, | ||
466 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, | ||
467 | .reset_gpio_port[2] = -EINVAL | ||
468 | }; | 470 | }; |
469 | 471 | ||
470 | #ifdef CONFIG_OMAP_MUX | 472 | #ifdef CONFIG_OMAP_MUX |
@@ -501,6 +503,8 @@ static void __init overo_init(void) | |||
501 | ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); | 503 | ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); |
502 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 504 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
503 | usb_musb_init(NULL); | 505 | usb_musb_init(NULL); |
506 | |||
507 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
504 | usbhs_init(&usbhs_bdata); | 508 | usbhs_init(&usbhs_bdata); |
505 | overo_spi_init(); | 509 | overo_spi_init(); |
506 | overo_init_smsc911x(); | 510 | overo_init_smsc911x(); |
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c index 5e4d4c9fe61a..1a3dd865d8eb 100644 --- a/arch/arm/mach-omap2/board-zoom.c +++ b/arch/arm/mach-omap2/board-zoom.c | |||
@@ -92,14 +92,16 @@ static struct mtd_partition zoom_nand_partitions[] = { | |||
92 | }, | 92 | }, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
96 | { | ||
97 | .port = 2, | ||
98 | .reset_gpio = ZOOM3_EHCI_RESET_GPIO, | ||
99 | .vcc_gpio = -EINVAL, | ||
100 | }, | ||
101 | }; | ||
102 | |||
95 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 103 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
96 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
97 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 104 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
98 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
99 | .phy_reset = true, | ||
100 | .reset_gpio_port[0] = -EINVAL, | ||
101 | .reset_gpio_port[1] = ZOOM3_EHCI_RESET_GPIO, | ||
102 | .reset_gpio_port[2] = -EINVAL, | ||
103 | }; | 105 | }; |
104 | 106 | ||
105 | static void __init omap_zoom_init(void) | 107 | static void __init omap_zoom_init(void) |
@@ -109,6 +111,8 @@ static void __init omap_zoom_init(void) | |||
109 | } else if (machine_is_omap_zoom3()) { | 111 | } else if (machine_is_omap_zoom3()) { |
110 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); | 112 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); |
111 | omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); | 113 | omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); |
114 | |||
115 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
112 | usbhs_init(&usbhs_bdata); | 116 | usbhs_init(&usbhs_bdata); |
113 | } | 117 | } |
114 | 118 | ||
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index df00e7580aa7..d555cf2459e1 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -82,8 +82,7 @@ extern void omap2_init_common_infrastructure(void); | |||
82 | extern void omap2_sync32k_timer_init(void); | 82 | extern void omap2_sync32k_timer_init(void); |
83 | extern void omap3_sync32k_timer_init(void); | 83 | extern void omap3_sync32k_timer_init(void); |
84 | extern void omap3_secure_sync32k_timer_init(void); | 84 | extern void omap3_secure_sync32k_timer_init(void); |
85 | extern void omap3_gp_gptimer_timer_init(void); | 85 | extern void omap3_gptimer_timer_init(void); |
86 | extern void omap3_am33xx_gptimer_timer_init(void); | ||
87 | extern void omap4_local_timer_init(void); | 86 | extern void omap4_local_timer_init(void); |
88 | extern void omap5_realtime_timer_init(void); | 87 | extern void omap5_realtime_timer_init(void); |
89 | 88 | ||
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index afc1e8c32d6c..d9c27195caf0 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c | |||
@@ -74,14 +74,6 @@ static int omap2_nand_gpmc_retime( | |||
74 | t.cs_wr_off = gpmc_t->cs_wr_off; | 74 | t.cs_wr_off = gpmc_t->cs_wr_off; |
75 | t.wr_cycle = gpmc_t->wr_cycle; | 75 | t.wr_cycle = gpmc_t->wr_cycle; |
76 | 76 | ||
77 | /* Configure GPMC */ | ||
78 | if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) | ||
79 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 1); | ||
80 | else | ||
81 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 0); | ||
82 | gpmc_cs_configure(gpmc_nand_data->cs, | ||
83 | GPMC_CONFIG_DEV_TYPE, GPMC_DEVICETYPE_NAND); | ||
84 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_WP, 0); | ||
85 | err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); | 77 | err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); |
86 | if (err) | 78 | if (err) |
87 | return err; | 79 | return err; |
@@ -115,14 +107,18 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, | |||
115 | struct gpmc_timings *gpmc_t) | 107 | struct gpmc_timings *gpmc_t) |
116 | { | 108 | { |
117 | int err = 0; | 109 | int err = 0; |
110 | struct gpmc_settings s; | ||
118 | struct device *dev = &gpmc_nand_device.dev; | 111 | struct device *dev = &gpmc_nand_device.dev; |
119 | 112 | ||
113 | memset(&s, 0, sizeof(struct gpmc_settings)); | ||
114 | |||
120 | gpmc_nand_device.dev.platform_data = gpmc_nand_data; | 115 | gpmc_nand_device.dev.platform_data = gpmc_nand_data; |
121 | 116 | ||
122 | err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, | 117 | err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, |
123 | (unsigned long *)&gpmc_nand_resource[0].start); | 118 | (unsigned long *)&gpmc_nand_resource[0].start); |
124 | if (err < 0) { | 119 | if (err < 0) { |
125 | dev_err(dev, "Cannot request GPMC CS\n"); | 120 | dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
121 | gpmc_nand_data->cs, err); | ||
126 | return err; | 122 | return err; |
127 | } | 123 | } |
128 | 124 | ||
@@ -140,11 +136,31 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, | |||
140 | dev_err(dev, "Unable to set gpmc timings: %d\n", err); | 136 | dev_err(dev, "Unable to set gpmc timings: %d\n", err); |
141 | return err; | 137 | return err; |
142 | } | 138 | } |
143 | } | ||
144 | 139 | ||
145 | /* Enable RD PIN Monitoring Reg */ | 140 | if (gpmc_nand_data->of_node) { |
146 | if (gpmc_nand_data->dev_ready) { | 141 | gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); |
147 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_RDY_BSY, 1); | 142 | } else { |
143 | s.device_nand = true; | ||
144 | |||
145 | /* Enable RD PIN Monitoring Reg */ | ||
146 | if (gpmc_nand_data->dev_ready) { | ||
147 | s.wait_on_read = true; | ||
148 | s.wait_on_write = true; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) | ||
153 | s.device_width = GPMC_DEVWIDTH_16BIT; | ||
154 | else | ||
155 | s.device_width = GPMC_DEVWIDTH_8BIT; | ||
156 | |||
157 | err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); | ||
158 | if (err < 0) | ||
159 | goto out_free_cs; | ||
160 | |||
161 | err = gpmc_configure(GPMC_CONFIG_WP, 0); | ||
162 | if (err < 0) | ||
163 | goto out_free_cs; | ||
148 | } | 164 | } |
149 | 165 | ||
150 | gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); | 166 | gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); |
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 0d75889c0a6f..64b5a8346982 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c | |||
@@ -47,11 +47,23 @@ static struct platform_device gpmc_onenand_device = { | |||
47 | .resource = &gpmc_onenand_resource, | 47 | .resource = &gpmc_onenand_resource, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static struct gpmc_timings omap2_onenand_calc_async_timings(void) | 50 | static struct gpmc_settings onenand_async = { |
51 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
52 | .mux_add_data = GPMC_MUX_AD, | ||
53 | }; | ||
54 | |||
55 | static struct gpmc_settings onenand_sync = { | ||
56 | .burst_read = true, | ||
57 | .burst_wrap = true, | ||
58 | .burst_len = GPMC_BURST_16, | ||
59 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
60 | .mux_add_data = GPMC_MUX_AD, | ||
61 | .wait_pin = 0, | ||
62 | }; | ||
63 | |||
64 | static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) | ||
51 | { | 65 | { |
52 | struct gpmc_device_timings dev_t; | 66 | struct gpmc_device_timings dev_t; |
53 | struct gpmc_timings t; | ||
54 | |||
55 | const int t_cer = 15; | 67 | const int t_cer = 15; |
56 | const int t_avdp = 12; | 68 | const int t_avdp = 12; |
57 | const int t_aavdh = 7; | 69 | const int t_aavdh = 7; |
@@ -64,7 +76,6 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void) | |||
64 | 76 | ||
65 | memset(&dev_t, 0, sizeof(dev_t)); | 77 | memset(&dev_t, 0, sizeof(dev_t)); |
66 | 78 | ||
67 | dev_t.mux = true; | ||
68 | dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; | 79 | dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; |
69 | dev_t.t_avdp_w = dev_t.t_avdp_r; | 80 | dev_t.t_avdp_w = dev_t.t_avdp_r; |
70 | dev_t.t_aavdh = t_aavdh * 1000; | 81 | dev_t.t_aavdh = t_aavdh * 1000; |
@@ -76,19 +87,7 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void) | |||
76 | dev_t.t_wpl = t_wpl * 1000; | 87 | dev_t.t_wpl = t_wpl * 1000; |
77 | dev_t.t_wph = t_wph * 1000; | 88 | dev_t.t_wph = t_wph * 1000; |
78 | 89 | ||
79 | gpmc_calc_timings(&t, &dev_t); | 90 | gpmc_calc_timings(t, &onenand_async, &dev_t); |
80 | |||
81 | return t; | ||
82 | } | ||
83 | |||
84 | static int gpmc_set_async_mode(int cs, struct gpmc_timings *t) | ||
85 | { | ||
86 | /* Configure GPMC for asynchronous read */ | ||
87 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, | ||
88 | GPMC_CONFIG1_DEVICESIZE_16 | | ||
89 | GPMC_CONFIG1_MUXADDDATA); | ||
90 | |||
91 | return gpmc_cs_set_timings(cs, t); | ||
92 | } | 91 | } |
93 | 92 | ||
94 | static void omap2_onenand_set_async_mode(void __iomem *onenand_base) | 93 | static void omap2_onenand_set_async_mode(void __iomem *onenand_base) |
@@ -158,12 +157,11 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, | |||
158 | return freq; | 157 | return freq; |
159 | } | 158 | } |
160 | 159 | ||
161 | static struct gpmc_timings | 160 | static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, |
162 | omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | 161 | unsigned int flags, |
163 | int freq) | 162 | int freq) |
164 | { | 163 | { |
165 | struct gpmc_device_timings dev_t; | 164 | struct gpmc_device_timings dev_t; |
166 | struct gpmc_timings t; | ||
167 | const int t_cer = 15; | 165 | const int t_cer = 15; |
168 | const int t_avdp = 12; | 166 | const int t_avdp = 12; |
169 | const int t_cez = 20; /* max of t_cez, t_oez */ | 167 | const int t_cez = 20; /* max of t_cez, t_oez */ |
@@ -172,9 +170,9 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
172 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; | 170 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; |
173 | int div, gpmc_clk_ns; | 171 | int div, gpmc_clk_ns; |
174 | 172 | ||
175 | if (cfg->flags & ONENAND_SYNC_READ) | 173 | if (flags & ONENAND_SYNC_READ) |
176 | onenand_flags = ONENAND_FLAG_SYNCREAD; | 174 | onenand_flags = ONENAND_FLAG_SYNCREAD; |
177 | else if (cfg->flags & ONENAND_SYNC_READWRITE) | 175 | else if (flags & ONENAND_SYNC_READWRITE) |
178 | onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; | 176 | onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; |
179 | 177 | ||
180 | switch (freq) { | 178 | switch (freq) { |
@@ -239,10 +237,11 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
239 | /* Set synchronous read timings */ | 237 | /* Set synchronous read timings */ |
240 | memset(&dev_t, 0, sizeof(dev_t)); | 238 | memset(&dev_t, 0, sizeof(dev_t)); |
241 | 239 | ||
242 | dev_t.mux = true; | 240 | if (onenand_flags & ONENAND_FLAG_SYNCREAD) |
243 | dev_t.sync_read = true; | 241 | onenand_sync.sync_read = true; |
244 | if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { | 242 | if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { |
245 | dev_t.sync_write = true; | 243 | onenand_sync.sync_write = true; |
244 | onenand_sync.burst_write = true; | ||
246 | } else { | 245 | } else { |
247 | dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; | 246 | dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; |
248 | dev_t.t_wpl = t_wpl * 1000; | 247 | dev_t.t_wpl = t_wpl * 1000; |
@@ -265,32 +264,7 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
265 | dev_t.cyc_aavdh_oe = 1; | 264 | dev_t.cyc_aavdh_oe = 1; |
266 | dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; | 265 | dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; |
267 | 266 | ||
268 | gpmc_calc_timings(&t, &dev_t); | 267 | gpmc_calc_timings(t, &onenand_sync, &dev_t); |
269 | |||
270 | return t; | ||
271 | } | ||
272 | |||
273 | static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t) | ||
274 | { | ||
275 | unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD; | ||
276 | unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE; | ||
277 | |||
278 | /* Configure GPMC for synchronous read */ | ||
279 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, | ||
280 | GPMC_CONFIG1_WRAPBURST_SUPP | | ||
281 | GPMC_CONFIG1_READMULTIPLE_SUPP | | ||
282 | (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) | | ||
283 | (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) | | ||
284 | (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) | | ||
285 | GPMC_CONFIG1_PAGE_LEN(2) | | ||
286 | (cpu_is_omap34xx() ? 0 : | ||
287 | (GPMC_CONFIG1_WAIT_READ_MON | | ||
288 | GPMC_CONFIG1_WAIT_PIN_SEL(0))) | | ||
289 | GPMC_CONFIG1_DEVICESIZE_16 | | ||
290 | GPMC_CONFIG1_DEVICETYPE_NOR | | ||
291 | GPMC_CONFIG1_MUXADDDATA); | ||
292 | |||
293 | return gpmc_cs_set_timings(cs, t); | ||
294 | } | 268 | } |
295 | 269 | ||
296 | static int omap2_onenand_setup_async(void __iomem *onenand_base) | 270 | static int omap2_onenand_setup_async(void __iomem *onenand_base) |
@@ -298,11 +272,19 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) | |||
298 | struct gpmc_timings t; | 272 | struct gpmc_timings t; |
299 | int ret; | 273 | int ret; |
300 | 274 | ||
275 | if (gpmc_onenand_data->of_node) | ||
276 | gpmc_read_settings_dt(gpmc_onenand_data->of_node, | ||
277 | &onenand_async); | ||
278 | |||
301 | omap2_onenand_set_async_mode(onenand_base); | 279 | omap2_onenand_set_async_mode(onenand_base); |
302 | 280 | ||
303 | t = omap2_onenand_calc_async_timings(); | 281 | omap2_onenand_calc_async_timings(&t); |
282 | |||
283 | ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); | ||
284 | if (ret < 0) | ||
285 | return ret; | ||
304 | 286 | ||
305 | ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); | 287 | ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); |
306 | if (ret < 0) | 288 | if (ret < 0) |
307 | return ret; | 289 | return ret; |
308 | 290 | ||
@@ -322,9 +304,25 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) | |||
322 | set_onenand_cfg(onenand_base); | 304 | set_onenand_cfg(onenand_base); |
323 | } | 305 | } |
324 | 306 | ||
325 | t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); | 307 | if (gpmc_onenand_data->of_node) { |
308 | gpmc_read_settings_dt(gpmc_onenand_data->of_node, | ||
309 | &onenand_sync); | ||
310 | } else { | ||
311 | /* | ||
312 | * FIXME: Appears to be legacy code from initial ONENAND commit. | ||
313 | * Unclear what boards this is for and if this can be removed. | ||
314 | */ | ||
315 | if (!cpu_is_omap34xx()) | ||
316 | onenand_sync.wait_on_read = true; | ||
317 | } | ||
326 | 318 | ||
327 | ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); | 319 | omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq); |
320 | |||
321 | ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync); | ||
322 | if (ret < 0) | ||
323 | return ret; | ||
324 | |||
325 | ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); | ||
328 | if (ret < 0) | 326 | if (ret < 0) |
329 | return ret; | 327 | return ret; |
330 | 328 | ||
@@ -359,6 +357,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) | |||
359 | void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | 357 | void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
360 | { | 358 | { |
361 | int err; | 359 | int err; |
360 | struct device *dev = &gpmc_onenand_device.dev; | ||
362 | 361 | ||
363 | gpmc_onenand_data = _onenand_data; | 362 | gpmc_onenand_data = _onenand_data; |
364 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; | 363 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; |
@@ -366,7 +365,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
366 | 365 | ||
367 | if (cpu_is_omap24xx() && | 366 | if (cpu_is_omap24xx() && |
368 | (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { | 367 | (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { |
369 | printk(KERN_ERR "Onenand using only SYNC_READ on 24xx\n"); | 368 | dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n"); |
370 | gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; | 369 | gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; |
371 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; | 370 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; |
372 | } | 371 | } |
@@ -379,7 +378,8 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
379 | err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, | 378 | err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, |
380 | (unsigned long *)&gpmc_onenand_resource.start); | 379 | (unsigned long *)&gpmc_onenand_resource.start); |
381 | if (err < 0) { | 380 | if (err < 0) { |
382 | pr_err("%s: Cannot request GPMC CS\n", __func__); | 381 | dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
382 | gpmc_onenand_data->cs, err); | ||
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | 385 | ||
@@ -387,7 +387,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
387 | ONENAND_IO_SIZE - 1; | 387 | ONENAND_IO_SIZE - 1; |
388 | 388 | ||
389 | if (platform_device_register(&gpmc_onenand_device) < 0) { | 389 | if (platform_device_register(&gpmc_onenand_device) < 0) { |
390 | pr_err("%s: Unable to register OneNAND device\n", __func__); | 390 | dev_err(dev, "Unable to register OneNAND device\n"); |
391 | gpmc_cs_free(gpmc_onenand_data->cs); | 391 | gpmc_cs_free(gpmc_onenand_data->cs); |
392 | return; | 392 | return; |
393 | } | 393 | } |
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c index 11d0b756f098..61a063595e66 100644 --- a/arch/arm/mach-omap2/gpmc-smc91x.c +++ b/arch/arm/mach-omap2/gpmc-smc91x.c | |||
@@ -49,6 +49,10 @@ static struct platform_device gpmc_smc91x_device = { | |||
49 | .resource = gpmc_smc91x_resources, | 49 | .resource = gpmc_smc91x_resources, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct gpmc_settings smc91x_settings = { | ||
53 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
54 | }; | ||
55 | |||
52 | /* | 56 | /* |
53 | * Set the gpmc timings for smc91c96. The timings are taken | 57 | * Set the gpmc timings for smc91c96. The timings are taken |
54 | * from the data sheet available at: | 58 | * from the data sheet available at: |
@@ -67,18 +71,6 @@ static int smc91c96_gpmc_retime(void) | |||
67 | const int t7 = 5; /* Figure 12.4 write */ | 71 | const int t7 = 5; /* Figure 12.4 write */ |
68 | const int t8 = 5; /* Figure 12.4 write */ | 72 | const int t8 = 5; /* Figure 12.4 write */ |
69 | const int t20 = 185; /* Figure 12.2 read and 12.4 write */ | 73 | const int t20 = 185; /* Figure 12.2 read and 12.4 write */ |
70 | u32 l; | ||
71 | |||
72 | l = GPMC_CONFIG1_DEVICESIZE_16; | ||
73 | if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) | ||
74 | l |= GPMC_CONFIG1_MUXADDDATA; | ||
75 | if (gpmc_cfg->flags & GPMC_READ_MON) | ||
76 | l |= GPMC_CONFIG1_WAIT_READ_MON; | ||
77 | if (gpmc_cfg->flags & GPMC_WRITE_MON) | ||
78 | l |= GPMC_CONFIG1_WAIT_WRITE_MON; | ||
79 | if (gpmc_cfg->wait_pin) | ||
80 | l |= GPMC_CONFIG1_WAIT_PIN_SEL(gpmc_cfg->wait_pin); | ||
81 | gpmc_cs_write_reg(gpmc_cfg->cs, GPMC_CS_CONFIG1, l); | ||
82 | 74 | ||
83 | /* | 75 | /* |
84 | * FIXME: Calculate the address and data bus muxed timings. | 76 | * FIXME: Calculate the address and data bus muxed timings. |
@@ -104,7 +96,7 @@ static int smc91c96_gpmc_retime(void) | |||
104 | dev_t.t_cez_w = t4_w * 1000; | 96 | dev_t.t_cez_w = t4_w * 1000; |
105 | dev_t.t_wr_cycle = (t20 - t3) * 1000; | 97 | dev_t.t_wr_cycle = (t20 - t3) * 1000; |
106 | 98 | ||
107 | gpmc_calc_timings(&t, &dev_t); | 99 | gpmc_calc_timings(&t, &smc91x_settings, &dev_t); |
108 | 100 | ||
109 | return gpmc_cs_set_timings(gpmc_cfg->cs, &t); | 101 | return gpmc_cs_set_timings(gpmc_cfg->cs, &t); |
110 | } | 102 | } |
@@ -133,6 +125,18 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) | |||
133 | gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; | 125 | gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; |
134 | gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); | 126 | gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); |
135 | 127 | ||
128 | if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) | ||
129 | smc91x_settings.mux_add_data = GPMC_MUX_AD; | ||
130 | if (gpmc_cfg->flags & GPMC_READ_MON) | ||
131 | smc91x_settings.wait_on_read = true; | ||
132 | if (gpmc_cfg->flags & GPMC_WRITE_MON) | ||
133 | smc91x_settings.wait_on_write = true; | ||
134 | if (gpmc_cfg->wait_pin) | ||
135 | smc91x_settings.wait_pin = gpmc_cfg->wait_pin; | ||
136 | ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings); | ||
137 | if (ret < 0) | ||
138 | goto free1; | ||
139 | |||
136 | if (gpmc_cfg->retime) { | 140 | if (gpmc_cfg->retime) { |
137 | ret = gpmc_cfg->retime(); | 141 | ret = gpmc_cfg->retime(); |
138 | if (ret != 0) | 142 | if (ret != 0) |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 6de31739b45c..ed946df5ad8a 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/of.h> | 28 | #include <linux/of.h> |
29 | #include <linux/of_address.h> | ||
29 | #include <linux/of_mtd.h> | 30 | #include <linux/of_mtd.h> |
30 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
31 | #include <linux/mtd/nand.h> | 32 | #include <linux/mtd/nand.h> |
@@ -91,9 +92,7 @@ | |||
91 | #define GPMC_CS_SIZE 0x30 | 92 | #define GPMC_CS_SIZE 0x30 |
92 | #define GPMC_BCH_SIZE 0x10 | 93 | #define GPMC_BCH_SIZE 0x10 |
93 | 94 | ||
94 | #define GPMC_MEM_START 0x00000000 | ||
95 | #define GPMC_MEM_END 0x3FFFFFFF | 95 | #define GPMC_MEM_END 0x3FFFFFFF |
96 | #define BOOT_ROM_SPACE 0x100000 /* 1MB */ | ||
97 | 96 | ||
98 | #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ | 97 | #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ |
99 | #define GPMC_SECTION_SHIFT 28 /* 128 MB */ | 98 | #define GPMC_SECTION_SHIFT 28 /* 128 MB */ |
@@ -107,6 +106,9 @@ | |||
107 | 106 | ||
108 | #define GPMC_HAS_WR_ACCESS 0x1 | 107 | #define GPMC_HAS_WR_ACCESS 0x1 |
109 | #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 | 108 | #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 |
109 | #define GPMC_HAS_MUX_AAD 0x4 | ||
110 | |||
111 | #define GPMC_NR_WAITPINS 4 | ||
110 | 112 | ||
111 | /* XXX: Only NAND irq has been considered,currently these are the only ones used | 113 | /* XXX: Only NAND irq has been considered,currently these are the only ones used |
112 | */ | 114 | */ |
@@ -153,6 +155,7 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM]; | |||
153 | static DEFINE_SPINLOCK(gpmc_mem_lock); | 155 | static DEFINE_SPINLOCK(gpmc_mem_lock); |
154 | /* Define chip-selects as reserved by default until probe completes */ | 156 | /* Define chip-selects as reserved by default until probe completes */ |
155 | static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); | 157 | static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); |
158 | static unsigned int gpmc_nr_waitpins; | ||
156 | static struct device *gpmc_dev; | 159 | static struct device *gpmc_dev; |
157 | static int gpmc_irq; | 160 | static int gpmc_irq; |
158 | static resource_size_t phys_base, mem_size; | 161 | static resource_size_t phys_base, mem_size; |
@@ -181,7 +184,7 @@ void gpmc_cs_write_reg(int cs, int idx, u32 val) | |||
181 | __raw_writel(val, reg_addr); | 184 | __raw_writel(val, reg_addr); |
182 | } | 185 | } |
183 | 186 | ||
184 | u32 gpmc_cs_read_reg(int cs, int idx) | 187 | static u32 gpmc_cs_read_reg(int cs, int idx) |
185 | { | 188 | { |
186 | void __iomem *reg_addr; | 189 | void __iomem *reg_addr; |
187 | 190 | ||
@@ -190,7 +193,7 @@ u32 gpmc_cs_read_reg(int cs, int idx) | |||
190 | } | 193 | } |
191 | 194 | ||
192 | /* TODO: Add support for gpmc_fck to clock framework and use it */ | 195 | /* TODO: Add support for gpmc_fck to clock framework and use it */ |
193 | unsigned long gpmc_get_fclk_period(void) | 196 | static unsigned long gpmc_get_fclk_period(void) |
194 | { | 197 | { |
195 | unsigned long rate = clk_get_rate(gpmc_l3_clk); | 198 | unsigned long rate = clk_get_rate(gpmc_l3_clk); |
196 | 199 | ||
@@ -205,7 +208,7 @@ unsigned long gpmc_get_fclk_period(void) | |||
205 | return rate; | 208 | return rate; |
206 | } | 209 | } |
207 | 210 | ||
208 | unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | 211 | static unsigned int gpmc_ns_to_ticks(unsigned int time_ns) |
209 | { | 212 | { |
210 | unsigned long tick_ps; | 213 | unsigned long tick_ps; |
211 | 214 | ||
@@ -215,7 +218,7 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | |||
215 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; | 218 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; |
216 | } | 219 | } |
217 | 220 | ||
218 | unsigned int gpmc_ps_to_ticks(unsigned int time_ps) | 221 | static unsigned int gpmc_ps_to_ticks(unsigned int time_ps) |
219 | { | 222 | { |
220 | unsigned long tick_ps; | 223 | unsigned long tick_ps; |
221 | 224 | ||
@@ -230,13 +233,6 @@ unsigned int gpmc_ticks_to_ns(unsigned int ticks) | |||
230 | return ticks * gpmc_get_fclk_period() / 1000; | 233 | return ticks * gpmc_get_fclk_period() / 1000; |
231 | } | 234 | } |
232 | 235 | ||
233 | unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns) | ||
234 | { | ||
235 | unsigned long ticks = gpmc_ns_to_ticks(time_ns); | ||
236 | |||
237 | return ticks * gpmc_get_fclk_period() / 1000; | ||
238 | } | ||
239 | |||
240 | static unsigned int gpmc_ticks_to_ps(unsigned int ticks) | 236 | static unsigned int gpmc_ticks_to_ps(unsigned int ticks) |
241 | { | 237 | { |
242 | return ticks * gpmc_get_fclk_period(); | 238 | return ticks * gpmc_get_fclk_period(); |
@@ -405,11 +401,18 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t) | |||
405 | return 0; | 401 | return 0; |
406 | } | 402 | } |
407 | 403 | ||
408 | static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) | 404 | static int gpmc_cs_enable_mem(int cs, u32 base, u32 size) |
409 | { | 405 | { |
410 | u32 l; | 406 | u32 l; |
411 | u32 mask; | 407 | u32 mask; |
412 | 408 | ||
409 | /* | ||
410 | * Ensure that base address is aligned on a | ||
411 | * boundary equal to or greater than size. | ||
412 | */ | ||
413 | if (base & (size - 1)) | ||
414 | return -EINVAL; | ||
415 | |||
413 | mask = (1 << GPMC_SECTION_SHIFT) - size; | 416 | mask = (1 << GPMC_SECTION_SHIFT) - size; |
414 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); | 417 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); |
415 | l &= ~0x3f; | 418 | l &= ~0x3f; |
@@ -418,6 +421,8 @@ static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) | |||
418 | l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; | 421 | l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; |
419 | l |= GPMC_CONFIG7_CSVALID; | 422 | l |= GPMC_CONFIG7_CSVALID; |
420 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); | 423 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); |
424 | |||
425 | return 0; | ||
421 | } | 426 | } |
422 | 427 | ||
423 | static void gpmc_cs_disable_mem(int cs) | 428 | static void gpmc_cs_disable_mem(int cs) |
@@ -448,22 +453,14 @@ static int gpmc_cs_mem_enabled(int cs) | |||
448 | return l & GPMC_CONFIG7_CSVALID; | 453 | return l & GPMC_CONFIG7_CSVALID; |
449 | } | 454 | } |
450 | 455 | ||
451 | int gpmc_cs_set_reserved(int cs, int reserved) | 456 | static void gpmc_cs_set_reserved(int cs, int reserved) |
452 | { | 457 | { |
453 | if (cs > GPMC_CS_NUM) | ||
454 | return -ENODEV; | ||
455 | |||
456 | gpmc_cs_map &= ~(1 << cs); | 458 | gpmc_cs_map &= ~(1 << cs); |
457 | gpmc_cs_map |= (reserved ? 1 : 0) << cs; | 459 | gpmc_cs_map |= (reserved ? 1 : 0) << cs; |
458 | |||
459 | return 0; | ||
460 | } | 460 | } |
461 | 461 | ||
462 | int gpmc_cs_reserved(int cs) | 462 | static bool gpmc_cs_reserved(int cs) |
463 | { | 463 | { |
464 | if (cs > GPMC_CS_NUM) | ||
465 | return -ENODEV; | ||
466 | |||
467 | return gpmc_cs_map & (1 << cs); | 464 | return gpmc_cs_map & (1 << cs); |
468 | } | 465 | } |
469 | 466 | ||
@@ -510,6 +507,39 @@ static int gpmc_cs_delete_mem(int cs) | |||
510 | return r; | 507 | return r; |
511 | } | 508 | } |
512 | 509 | ||
510 | /** | ||
511 | * gpmc_cs_remap - remaps a chip-select physical base address | ||
512 | * @cs: chip-select to remap | ||
513 | * @base: physical base address to re-map chip-select to | ||
514 | * | ||
515 | * Re-maps a chip-select to a new physical base address specified by | ||
516 | * "base". Returns 0 on success and appropriate negative error code | ||
517 | * on failure. | ||
518 | */ | ||
519 | static int gpmc_cs_remap(int cs, u32 base) | ||
520 | { | ||
521 | int ret; | ||
522 | u32 old_base, size; | ||
523 | |||
524 | if (cs > GPMC_CS_NUM) | ||
525 | return -ENODEV; | ||
526 | gpmc_cs_get_memconf(cs, &old_base, &size); | ||
527 | if (base == old_base) | ||
528 | return 0; | ||
529 | gpmc_cs_disable_mem(cs); | ||
530 | ret = gpmc_cs_delete_mem(cs); | ||
531 | if (ret < 0) | ||
532 | return ret; | ||
533 | ret = gpmc_cs_insert_mem(cs, base, size); | ||
534 | if (ret < 0) | ||
535 | return ret; | ||
536 | ret = gpmc_cs_enable_mem(cs, base, size); | ||
537 | if (ret < 0) | ||
538 | return ret; | ||
539 | |||
540 | return 0; | ||
541 | } | ||
542 | |||
513 | int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) | 543 | int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) |
514 | { | 544 | { |
515 | struct resource *res = &gpmc_cs_mem[cs]; | 545 | struct resource *res = &gpmc_cs_mem[cs]; |
@@ -535,7 +565,12 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) | |||
535 | if (r < 0) | 565 | if (r < 0) |
536 | goto out; | 566 | goto out; |
537 | 567 | ||
538 | gpmc_cs_enable_mem(cs, res->start, resource_size(res)); | 568 | r = gpmc_cs_enable_mem(cs, res->start, resource_size(res)); |
569 | if (r < 0) { | ||
570 | release_resource(res); | ||
571 | goto out; | ||
572 | } | ||
573 | |||
539 | *base = res->start; | 574 | *base = res->start; |
540 | gpmc_cs_set_reserved(cs, 1); | 575 | gpmc_cs_set_reserved(cs, 1); |
541 | out: | 576 | out: |
@@ -561,16 +596,14 @@ void gpmc_cs_free(int cs) | |||
561 | EXPORT_SYMBOL(gpmc_cs_free); | 596 | EXPORT_SYMBOL(gpmc_cs_free); |
562 | 597 | ||
563 | /** | 598 | /** |
564 | * gpmc_cs_configure - write request to configure gpmc | 599 | * gpmc_configure - write request to configure gpmc |
565 | * @cs: chip select number | ||
566 | * @cmd: command type | 600 | * @cmd: command type |
567 | * @wval: value to write | 601 | * @wval: value to write |
568 | * @return status of the operation | 602 | * @return status of the operation |
569 | */ | 603 | */ |
570 | int gpmc_cs_configure(int cs, int cmd, int wval) | 604 | int gpmc_configure(int cmd, int wval) |
571 | { | 605 | { |
572 | int err = 0; | 606 | u32 regval; |
573 | u32 regval = 0; | ||
574 | 607 | ||
575 | switch (cmd) { | 608 | switch (cmd) { |
576 | case GPMC_ENABLE_IRQ: | 609 | case GPMC_ENABLE_IRQ: |
@@ -590,43 +623,14 @@ int gpmc_cs_configure(int cs, int cmd, int wval) | |||
590 | gpmc_write_reg(GPMC_CONFIG, regval); | 623 | gpmc_write_reg(GPMC_CONFIG, regval); |
591 | break; | 624 | break; |
592 | 625 | ||
593 | case GPMC_CONFIG_RDY_BSY: | ||
594 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
595 | if (wval) | ||
596 | regval |= WR_RD_PIN_MONITORING; | ||
597 | else | ||
598 | regval &= ~WR_RD_PIN_MONITORING; | ||
599 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
600 | break; | ||
601 | |||
602 | case GPMC_CONFIG_DEV_SIZE: | ||
603 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
604 | |||
605 | /* clear 2 target bits */ | ||
606 | regval &= ~GPMC_CONFIG1_DEVICESIZE(3); | ||
607 | |||
608 | /* set the proper value */ | ||
609 | regval |= GPMC_CONFIG1_DEVICESIZE(wval); | ||
610 | |||
611 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
612 | break; | ||
613 | |||
614 | case GPMC_CONFIG_DEV_TYPE: | ||
615 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
616 | regval |= GPMC_CONFIG1_DEVICETYPE(wval); | ||
617 | if (wval == GPMC_DEVICETYPE_NOR) | ||
618 | regval |= GPMC_CONFIG1_MUXADDDATA; | ||
619 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
620 | break; | ||
621 | |||
622 | default: | 626 | default: |
623 | printk(KERN_ERR "gpmc_configure_cs: Not supported\n"); | 627 | pr_err("%s: command not supported\n", __func__); |
624 | err = -EINVAL; | 628 | return -EINVAL; |
625 | } | 629 | } |
626 | 630 | ||
627 | return err; | 631 | return 0; |
628 | } | 632 | } |
629 | EXPORT_SYMBOL(gpmc_cs_configure); | 633 | EXPORT_SYMBOL(gpmc_configure); |
630 | 634 | ||
631 | void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) | 635 | void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) |
632 | { | 636 | { |
@@ -781,16 +785,16 @@ static void gpmc_mem_exit(void) | |||
781 | 785 | ||
782 | } | 786 | } |
783 | 787 | ||
784 | static int gpmc_mem_init(void) | 788 | static void gpmc_mem_init(void) |
785 | { | 789 | { |
786 | int cs, rc; | 790 | int cs; |
787 | unsigned long boot_rom_space = 0; | ||
788 | 791 | ||
789 | /* never allocate the first page, to facilitate bug detection; | 792 | /* |
790 | * even if we didn't boot from ROM. | 793 | * The first 1MB of GPMC address space is typically mapped to |
794 | * the internal ROM. Never allocate the first page, to | ||
795 | * facilitate bug detection; even if we didn't boot from ROM. | ||
791 | */ | 796 | */ |
792 | boot_rom_space = BOOT_ROM_SPACE; | 797 | gpmc_mem_root.start = SZ_1M; |
793 | gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space; | ||
794 | gpmc_mem_root.end = GPMC_MEM_END; | 798 | gpmc_mem_root.end = GPMC_MEM_END; |
795 | 799 | ||
796 | /* Reserve all regions that has been set up by bootloader */ | 800 | /* Reserve all regions that has been set up by bootloader */ |
@@ -800,16 +804,12 @@ static int gpmc_mem_init(void) | |||
800 | if (!gpmc_cs_mem_enabled(cs)) | 804 | if (!gpmc_cs_mem_enabled(cs)) |
801 | continue; | 805 | continue; |
802 | gpmc_cs_get_memconf(cs, &base, &size); | 806 | gpmc_cs_get_memconf(cs, &base, &size); |
803 | rc = gpmc_cs_insert_mem(cs, base, size); | 807 | if (gpmc_cs_insert_mem(cs, base, size)) { |
804 | if (rc < 0) { | 808 | pr_warn("%s: disabling cs %d mapped at 0x%x-0x%x\n", |
805 | while (--cs >= 0) | 809 | __func__, cs, base, base + size); |
806 | if (gpmc_cs_mem_enabled(cs)) | 810 | gpmc_cs_disable_mem(cs); |
807 | gpmc_cs_delete_mem(cs); | ||
808 | return rc; | ||
809 | } | 811 | } |
810 | } | 812 | } |
811 | |||
812 | return 0; | ||
813 | } | 813 | } |
814 | 814 | ||
815 | static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) | 815 | static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) |
@@ -825,9 +825,9 @@ static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) | |||
825 | 825 | ||
826 | /* XXX: can the cycles be avoided ? */ | 826 | /* XXX: can the cycles be avoided ? */ |
827 | static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, | 827 | static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, |
828 | struct gpmc_device_timings *dev_t) | 828 | struct gpmc_device_timings *dev_t, |
829 | bool mux) | ||
829 | { | 830 | { |
830 | bool mux = dev_t->mux; | ||
831 | u32 temp; | 831 | u32 temp; |
832 | 832 | ||
833 | /* adv_rd_off */ | 833 | /* adv_rd_off */ |
@@ -880,9 +880,9 @@ static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, | |||
880 | } | 880 | } |
881 | 881 | ||
882 | static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, | 882 | static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, |
883 | struct gpmc_device_timings *dev_t) | 883 | struct gpmc_device_timings *dev_t, |
884 | bool mux) | ||
884 | { | 885 | { |
885 | bool mux = dev_t->mux; | ||
886 | u32 temp; | 886 | u32 temp; |
887 | 887 | ||
888 | /* adv_wr_off */ | 888 | /* adv_wr_off */ |
@@ -942,9 +942,9 @@ static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, | |||
942 | } | 942 | } |
943 | 943 | ||
944 | static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, | 944 | static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, |
945 | struct gpmc_device_timings *dev_t) | 945 | struct gpmc_device_timings *dev_t, |
946 | bool mux) | ||
946 | { | 947 | { |
947 | bool mux = dev_t->mux; | ||
948 | u32 temp; | 948 | u32 temp; |
949 | 949 | ||
950 | /* adv_rd_off */ | 950 | /* adv_rd_off */ |
@@ -982,9 +982,9 @@ static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, | |||
982 | } | 982 | } |
983 | 983 | ||
984 | static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, | 984 | static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, |
985 | struct gpmc_device_timings *dev_t) | 985 | struct gpmc_device_timings *dev_t, |
986 | bool mux) | ||
986 | { | 987 | { |
987 | bool mux = dev_t->mux; | ||
988 | u32 temp; | 988 | u32 temp; |
989 | 989 | ||
990 | /* adv_wr_off */ | 990 | /* adv_wr_off */ |
@@ -1054,7 +1054,8 @@ static int gpmc_calc_sync_common_timings(struct gpmc_timings *gpmc_t, | |||
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, | 1056 | static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, |
1057 | struct gpmc_device_timings *dev_t) | 1057 | struct gpmc_device_timings *dev_t, |
1058 | bool sync) | ||
1058 | { | 1059 | { |
1059 | u32 temp; | 1060 | u32 temp; |
1060 | 1061 | ||
@@ -1068,7 +1069,7 @@ static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, | |||
1068 | gpmc_t->cs_on + dev_t->t_ce_avd); | 1069 | gpmc_t->cs_on + dev_t->t_ce_avd); |
1069 | gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); | 1070 | gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); |
1070 | 1071 | ||
1071 | if (dev_t->sync_write || dev_t->sync_read) | 1072 | if (sync) |
1072 | gpmc_calc_sync_common_timings(gpmc_t, dev_t); | 1073 | gpmc_calc_sync_common_timings(gpmc_t, dev_t); |
1073 | 1074 | ||
1074 | return 0; | 1075 | return 0; |
@@ -1103,21 +1104,29 @@ static void gpmc_convert_ps_to_ns(struct gpmc_timings *t) | |||
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | 1106 | int gpmc_calc_timings(struct gpmc_timings *gpmc_t, |
1106 | struct gpmc_device_timings *dev_t) | 1107 | struct gpmc_settings *gpmc_s, |
1108 | struct gpmc_device_timings *dev_t) | ||
1107 | { | 1109 | { |
1110 | bool mux = false, sync = false; | ||
1111 | |||
1112 | if (gpmc_s) { | ||
1113 | mux = gpmc_s->mux_add_data ? true : false; | ||
1114 | sync = (gpmc_s->sync_read || gpmc_s->sync_write); | ||
1115 | } | ||
1116 | |||
1108 | memset(gpmc_t, 0, sizeof(*gpmc_t)); | 1117 | memset(gpmc_t, 0, sizeof(*gpmc_t)); |
1109 | 1118 | ||
1110 | gpmc_calc_common_timings(gpmc_t, dev_t); | 1119 | gpmc_calc_common_timings(gpmc_t, dev_t, sync); |
1111 | 1120 | ||
1112 | if (dev_t->sync_read) | 1121 | if (gpmc_s && gpmc_s->sync_read) |
1113 | gpmc_calc_sync_read_timings(gpmc_t, dev_t); | 1122 | gpmc_calc_sync_read_timings(gpmc_t, dev_t, mux); |
1114 | else | 1123 | else |
1115 | gpmc_calc_async_read_timings(gpmc_t, dev_t); | 1124 | gpmc_calc_async_read_timings(gpmc_t, dev_t, mux); |
1116 | 1125 | ||
1117 | if (dev_t->sync_write) | 1126 | if (gpmc_s && gpmc_s->sync_write) |
1118 | gpmc_calc_sync_write_timings(gpmc_t, dev_t); | 1127 | gpmc_calc_sync_write_timings(gpmc_t, dev_t, mux); |
1119 | else | 1128 | else |
1120 | gpmc_calc_async_write_timings(gpmc_t, dev_t); | 1129 | gpmc_calc_async_write_timings(gpmc_t, dev_t, mux); |
1121 | 1130 | ||
1122 | /* TODO: remove, see function definition */ | 1131 | /* TODO: remove, see function definition */ |
1123 | gpmc_convert_ps_to_ns(gpmc_t); | 1132 | gpmc_convert_ps_to_ns(gpmc_t); |
@@ -1125,6 +1134,90 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | |||
1125 | return 0; | 1134 | return 0; |
1126 | } | 1135 | } |
1127 | 1136 | ||
1137 | /** | ||
1138 | * gpmc_cs_program_settings - programs non-timing related settings | ||
1139 | * @cs: GPMC chip-select to program | ||
1140 | * @p: pointer to GPMC settings structure | ||
1141 | * | ||
1142 | * Programs non-timing related settings for a GPMC chip-select, such as | ||
1143 | * bus-width, burst configuration, etc. Function should be called once | ||
1144 | * for each chip-select that is being used and must be called before | ||
1145 | * calling gpmc_cs_set_timings() as timing parameters in the CONFIG1 | ||
1146 | * register will be initialised to zero by this function. Returns 0 on | ||
1147 | * success and appropriate negative error code on failure. | ||
1148 | */ | ||
1149 | int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) | ||
1150 | { | ||
1151 | u32 config1; | ||
1152 | |||
1153 | if ((!p->device_width) || (p->device_width > GPMC_DEVWIDTH_16BIT)) { | ||
1154 | pr_err("%s: invalid width %d!", __func__, p->device_width); | ||
1155 | return -EINVAL; | ||
1156 | } | ||
1157 | |||
1158 | /* Address-data multiplexing not supported for NAND devices */ | ||
1159 | if (p->device_nand && p->mux_add_data) { | ||
1160 | pr_err("%s: invalid configuration!\n", __func__); | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1163 | |||
1164 | if ((p->mux_add_data > GPMC_MUX_AD) || | ||
1165 | ((p->mux_add_data == GPMC_MUX_AAD) && | ||
1166 | !(gpmc_capability & GPMC_HAS_MUX_AAD))) { | ||
1167 | pr_err("%s: invalid multiplex configuration!\n", __func__); | ||
1168 | return -EINVAL; | ||
1169 | } | ||
1170 | |||
1171 | /* Page/burst mode supports lengths of 4, 8 and 16 bytes */ | ||
1172 | if (p->burst_read || p->burst_write) { | ||
1173 | switch (p->burst_len) { | ||
1174 | case GPMC_BURST_4: | ||
1175 | case GPMC_BURST_8: | ||
1176 | case GPMC_BURST_16: | ||
1177 | break; | ||
1178 | default: | ||
1179 | pr_err("%s: invalid page/burst-length (%d)\n", | ||
1180 | __func__, p->burst_len); | ||
1181 | return -EINVAL; | ||
1182 | } | ||
1183 | } | ||
1184 | |||
1185 | if ((p->wait_on_read || p->wait_on_write) && | ||
1186 | (p->wait_pin > gpmc_nr_waitpins)) { | ||
1187 | pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); | ||
1188 | return -EINVAL; | ||
1189 | } | ||
1190 | |||
1191 | config1 = GPMC_CONFIG1_DEVICESIZE((p->device_width - 1)); | ||
1192 | |||
1193 | if (p->sync_read) | ||
1194 | config1 |= GPMC_CONFIG1_READTYPE_SYNC; | ||
1195 | if (p->sync_write) | ||
1196 | config1 |= GPMC_CONFIG1_WRITETYPE_SYNC; | ||
1197 | if (p->wait_on_read) | ||
1198 | config1 |= GPMC_CONFIG1_WAIT_READ_MON; | ||
1199 | if (p->wait_on_write) | ||
1200 | config1 |= GPMC_CONFIG1_WAIT_WRITE_MON; | ||
1201 | if (p->wait_on_read || p->wait_on_write) | ||
1202 | config1 |= GPMC_CONFIG1_WAIT_PIN_SEL(p->wait_pin); | ||
1203 | if (p->device_nand) | ||
1204 | config1 |= GPMC_CONFIG1_DEVICETYPE(GPMC_DEVICETYPE_NAND); | ||
1205 | if (p->mux_add_data) | ||
1206 | config1 |= GPMC_CONFIG1_MUXTYPE(p->mux_add_data); | ||
1207 | if (p->burst_read) | ||
1208 | config1 |= GPMC_CONFIG1_READMULTIPLE_SUPP; | ||
1209 | if (p->burst_write) | ||
1210 | config1 |= GPMC_CONFIG1_WRITEMULTIPLE_SUPP; | ||
1211 | if (p->burst_read || p->burst_write) { | ||
1212 | config1 |= GPMC_CONFIG1_PAGE_LEN(p->burst_len >> 3); | ||
1213 | config1 |= p->burst_wrap ? GPMC_CONFIG1_WRAPBURST_SUPP : 0; | ||
1214 | } | ||
1215 | |||
1216 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, config1); | ||
1217 | |||
1218 | return 0; | ||
1219 | } | ||
1220 | |||
1128 | #ifdef CONFIG_OF | 1221 | #ifdef CONFIG_OF |
1129 | static struct of_device_id gpmc_dt_ids[] = { | 1222 | static struct of_device_id gpmc_dt_ids[] = { |
1130 | { .compatible = "ti,omap2420-gpmc" }, | 1223 | { .compatible = "ti,omap2420-gpmc" }, |
@@ -1136,70 +1229,110 @@ static struct of_device_id gpmc_dt_ids[] = { | |||
1136 | }; | 1229 | }; |
1137 | MODULE_DEVICE_TABLE(of, gpmc_dt_ids); | 1230 | MODULE_DEVICE_TABLE(of, gpmc_dt_ids); |
1138 | 1231 | ||
1232 | /** | ||
1233 | * gpmc_read_settings_dt - read gpmc settings from device-tree | ||
1234 | * @np: pointer to device-tree node for a gpmc child device | ||
1235 | * @p: pointer to gpmc settings structure | ||
1236 | * | ||
1237 | * Reads the GPMC settings for a GPMC child device from device-tree and | ||
1238 | * stores them in the GPMC settings structure passed. The GPMC settings | ||
1239 | * structure is initialised to zero by this function and so any | ||
1240 | * previously stored settings will be cleared. | ||
1241 | */ | ||
1242 | void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) | ||
1243 | { | ||
1244 | memset(p, 0, sizeof(struct gpmc_settings)); | ||
1245 | |||
1246 | p->sync_read = of_property_read_bool(np, "gpmc,sync-read"); | ||
1247 | p->sync_write = of_property_read_bool(np, "gpmc,sync-write"); | ||
1248 | p->device_nand = of_property_read_bool(np, "gpmc,device-nand"); | ||
1249 | of_property_read_u32(np, "gpmc,device-width", &p->device_width); | ||
1250 | of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data); | ||
1251 | |||
1252 | if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) { | ||
1253 | p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap"); | ||
1254 | p->burst_read = of_property_read_bool(np, "gpmc,burst-read"); | ||
1255 | p->burst_write = of_property_read_bool(np, "gpmc,burst-write"); | ||
1256 | if (!p->burst_read && !p->burst_write) | ||
1257 | pr_warn("%s: page/burst-length set but not used!\n", | ||
1258 | __func__); | ||
1259 | } | ||
1260 | |||
1261 | if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) { | ||
1262 | p->wait_on_read = of_property_read_bool(np, | ||
1263 | "gpmc,wait-on-read"); | ||
1264 | p->wait_on_write = of_property_read_bool(np, | ||
1265 | "gpmc,wait-on-write"); | ||
1266 | if (!p->wait_on_read && !p->wait_on_write) | ||
1267 | pr_warn("%s: read/write wait monitoring not enabled!\n", | ||
1268 | __func__); | ||
1269 | } | ||
1270 | } | ||
1271 | |||
1139 | static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, | 1272 | static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, |
1140 | struct gpmc_timings *gpmc_t) | 1273 | struct gpmc_timings *gpmc_t) |
1141 | { | 1274 | { |
1142 | u32 val; | 1275 | struct gpmc_bool_timings *p; |
1276 | |||
1277 | if (!np || !gpmc_t) | ||
1278 | return; | ||
1143 | 1279 | ||
1144 | memset(gpmc_t, 0, sizeof(*gpmc_t)); | 1280 | memset(gpmc_t, 0, sizeof(*gpmc_t)); |
1145 | 1281 | ||
1146 | /* minimum clock period for syncronous mode */ | 1282 | /* minimum clock period for syncronous mode */ |
1147 | if (!of_property_read_u32(np, "gpmc,sync-clk", &val)) | 1283 | of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk); |
1148 | gpmc_t->sync_clk = val; | ||
1149 | 1284 | ||
1150 | /* chip select timtings */ | 1285 | /* chip select timtings */ |
1151 | if (!of_property_read_u32(np, "gpmc,cs-on", &val)) | 1286 | of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on); |
1152 | gpmc_t->cs_on = val; | 1287 | of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off); |
1153 | 1288 | of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off); | |
1154 | if (!of_property_read_u32(np, "gpmc,cs-rd-off", &val)) | ||
1155 | gpmc_t->cs_rd_off = val; | ||
1156 | |||
1157 | if (!of_property_read_u32(np, "gpmc,cs-wr-off", &val)) | ||
1158 | gpmc_t->cs_wr_off = val; | ||
1159 | 1289 | ||
1160 | /* ADV signal timings */ | 1290 | /* ADV signal timings */ |
1161 | if (!of_property_read_u32(np, "gpmc,adv-on", &val)) | 1291 | of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on); |
1162 | gpmc_t->adv_on = val; | 1292 | of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off); |
1163 | 1293 | of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off); | |
1164 | if (!of_property_read_u32(np, "gpmc,adv-rd-off", &val)) | ||
1165 | gpmc_t->adv_rd_off = val; | ||
1166 | |||
1167 | if (!of_property_read_u32(np, "gpmc,adv-wr-off", &val)) | ||
1168 | gpmc_t->adv_wr_off = val; | ||
1169 | 1294 | ||
1170 | /* WE signal timings */ | 1295 | /* WE signal timings */ |
1171 | if (!of_property_read_u32(np, "gpmc,we-on", &val)) | 1296 | of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on); |
1172 | gpmc_t->we_on = val; | 1297 | of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off); |
1173 | |||
1174 | if (!of_property_read_u32(np, "gpmc,we-off", &val)) | ||
1175 | gpmc_t->we_off = val; | ||
1176 | 1298 | ||
1177 | /* OE signal timings */ | 1299 | /* OE signal timings */ |
1178 | if (!of_property_read_u32(np, "gpmc,oe-on", &val)) | 1300 | of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on); |
1179 | gpmc_t->oe_on = val; | 1301 | of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off); |
1180 | |||
1181 | if (!of_property_read_u32(np, "gpmc,oe-off", &val)) | ||
1182 | gpmc_t->oe_off = val; | ||
1183 | 1302 | ||
1184 | /* access and cycle timings */ | 1303 | /* access and cycle timings */ |
1185 | if (!of_property_read_u32(np, "gpmc,page-burst-access", &val)) | 1304 | of_property_read_u32(np, "gpmc,page-burst-access-ns", |
1186 | gpmc_t->page_burst_access = val; | 1305 | &gpmc_t->page_burst_access); |
1187 | 1306 | of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access); | |
1188 | if (!of_property_read_u32(np, "gpmc,access", &val)) | 1307 | of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle); |
1189 | gpmc_t->access = val; | 1308 | of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle); |
1190 | 1309 | of_property_read_u32(np, "gpmc,bus-turnaround-ns", | |
1191 | if (!of_property_read_u32(np, "gpmc,rd-cycle", &val)) | 1310 | &gpmc_t->bus_turnaround); |
1192 | gpmc_t->rd_cycle = val; | 1311 | of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns", |
1193 | 1312 | &gpmc_t->cycle2cycle_delay); | |
1194 | if (!of_property_read_u32(np, "gpmc,wr-cycle", &val)) | 1313 | of_property_read_u32(np, "gpmc,wait-monitoring-ns", |
1195 | gpmc_t->wr_cycle = val; | 1314 | &gpmc_t->wait_monitoring); |
1196 | 1315 | of_property_read_u32(np, "gpmc,clk-activation-ns", | |
1197 | /* only for OMAP3430 */ | 1316 | &gpmc_t->clk_activation); |
1198 | if (!of_property_read_u32(np, "gpmc,wr-access", &val)) | 1317 | |
1199 | gpmc_t->wr_access = val; | 1318 | /* only applicable to OMAP3+ */ |
1200 | 1319 | of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access); | |
1201 | if (!of_property_read_u32(np, "gpmc,wr-data-mux-bus", &val)) | 1320 | of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns", |
1202 | gpmc_t->wr_data_mux_bus = val; | 1321 | &gpmc_t->wr_data_mux_bus); |
1322 | |||
1323 | /* bool timing parameters */ | ||
1324 | p = &gpmc_t->bool_timings; | ||
1325 | |||
1326 | p->cycle2cyclediffcsen = | ||
1327 | of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen"); | ||
1328 | p->cycle2cyclesamecsen = | ||
1329 | of_property_read_bool(np, "gpmc,cycle2cycle-samecsen"); | ||
1330 | p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay"); | ||
1331 | p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay"); | ||
1332 | p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay"); | ||
1333 | p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay"); | ||
1334 | p->time_para_granularity = | ||
1335 | of_property_read_bool(np, "gpmc,time-para-granularity"); | ||
1203 | } | 1336 | } |
1204 | 1337 | ||
1205 | #ifdef CONFIG_MTD_NAND | 1338 | #ifdef CONFIG_MTD_NAND |
@@ -1295,6 +1428,81 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, | |||
1295 | } | 1428 | } |
1296 | #endif | 1429 | #endif |
1297 | 1430 | ||
1431 | /** | ||
1432 | * gpmc_probe_generic_child - configures the gpmc for a child device | ||
1433 | * @pdev: pointer to gpmc platform device | ||
1434 | * @child: pointer to device-tree node for child device | ||
1435 | * | ||
1436 | * Allocates and configures a GPMC chip-select for a child device. | ||
1437 | * Returns 0 on success and appropriate negative error code on failure. | ||
1438 | */ | ||
1439 | static int gpmc_probe_generic_child(struct platform_device *pdev, | ||
1440 | struct device_node *child) | ||
1441 | { | ||
1442 | struct gpmc_settings gpmc_s; | ||
1443 | struct gpmc_timings gpmc_t; | ||
1444 | struct resource res; | ||
1445 | unsigned long base; | ||
1446 | int ret, cs; | ||
1447 | |||
1448 | if (of_property_read_u32(child, "reg", &cs) < 0) { | ||
1449 | dev_err(&pdev->dev, "%s has no 'reg' property\n", | ||
1450 | child->full_name); | ||
1451 | return -ENODEV; | ||
1452 | } | ||
1453 | |||
1454 | if (of_address_to_resource(child, 0, &res) < 0) { | ||
1455 | dev_err(&pdev->dev, "%s has malformed 'reg' property\n", | ||
1456 | child->full_name); | ||
1457 | return -ENODEV; | ||
1458 | } | ||
1459 | |||
1460 | ret = gpmc_cs_request(cs, resource_size(&res), &base); | ||
1461 | if (ret < 0) { | ||
1462 | dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs); | ||
1463 | return ret; | ||
1464 | } | ||
1465 | |||
1466 | /* | ||
1467 | * FIXME: gpmc_cs_request() will map the CS to an arbitary | ||
1468 | * location in the gpmc address space. When booting with | ||
1469 | * device-tree we want the NOR flash to be mapped to the | ||
1470 | * location specified in the device-tree blob. So remap the | ||
1471 | * CS to this location. Once DT migration is complete should | ||
1472 | * just make gpmc_cs_request() map a specific address. | ||
1473 | */ | ||
1474 | ret = gpmc_cs_remap(cs, res.start); | ||
1475 | if (ret < 0) { | ||
1476 | dev_err(&pdev->dev, "cannot remap GPMC CS %d to 0x%x\n", | ||
1477 | cs, res.start); | ||
1478 | goto err; | ||
1479 | } | ||
1480 | |||
1481 | gpmc_read_settings_dt(child, &gpmc_s); | ||
1482 | |||
1483 | ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width); | ||
1484 | if (ret < 0) | ||
1485 | goto err; | ||
1486 | |||
1487 | ret = gpmc_cs_program_settings(cs, &gpmc_s); | ||
1488 | if (ret < 0) | ||
1489 | goto err; | ||
1490 | |||
1491 | gpmc_read_timings_dt(child, &gpmc_t); | ||
1492 | gpmc_cs_set_timings(cs, &gpmc_t); | ||
1493 | |||
1494 | if (of_platform_device_create(child, NULL, &pdev->dev)) | ||
1495 | return 0; | ||
1496 | |||
1497 | dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name); | ||
1498 | ret = -ENODEV; | ||
1499 | |||
1500 | err: | ||
1501 | gpmc_cs_free(cs); | ||
1502 | |||
1503 | return ret; | ||
1504 | } | ||
1505 | |||
1298 | static int gpmc_probe_dt(struct platform_device *pdev) | 1506 | static int gpmc_probe_dt(struct platform_device *pdev) |
1299 | { | 1507 | { |
1300 | int ret; | 1508 | int ret; |
@@ -1305,6 +1513,13 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1305 | if (!of_id) | 1513 | if (!of_id) |
1306 | return 0; | 1514 | return 0; |
1307 | 1515 | ||
1516 | ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins", | ||
1517 | &gpmc_nr_waitpins); | ||
1518 | if (ret < 0) { | ||
1519 | pr_err("%s: number of wait pins not found!\n", __func__); | ||
1520 | return ret; | ||
1521 | } | ||
1522 | |||
1308 | for_each_node_by_name(child, "nand") { | 1523 | for_each_node_by_name(child, "nand") { |
1309 | ret = gpmc_probe_nand_child(pdev, child); | 1524 | ret = gpmc_probe_nand_child(pdev, child); |
1310 | if (ret < 0) { | 1525 | if (ret < 0) { |
@@ -1320,6 +1535,23 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1320 | return ret; | 1535 | return ret; |
1321 | } | 1536 | } |
1322 | } | 1537 | } |
1538 | |||
1539 | for_each_node_by_name(child, "nor") { | ||
1540 | ret = gpmc_probe_generic_child(pdev, child); | ||
1541 | if (ret < 0) { | ||
1542 | of_node_put(child); | ||
1543 | return ret; | ||
1544 | } | ||
1545 | } | ||
1546 | |||
1547 | for_each_node_by_name(child, "ethernet") { | ||
1548 | ret = gpmc_probe_generic_child(pdev, child); | ||
1549 | if (ret < 0) { | ||
1550 | of_node_put(child); | ||
1551 | return ret; | ||
1552 | } | ||
1553 | } | ||
1554 | |||
1323 | return 0; | 1555 | return 0; |
1324 | } | 1556 | } |
1325 | #else | 1557 | #else |
@@ -1364,18 +1596,27 @@ static int gpmc_probe(struct platform_device *pdev) | |||
1364 | gpmc_dev = &pdev->dev; | 1596 | gpmc_dev = &pdev->dev; |
1365 | 1597 | ||
1366 | l = gpmc_read_reg(GPMC_REVISION); | 1598 | l = gpmc_read_reg(GPMC_REVISION); |
1599 | |||
1600 | /* | ||
1601 | * FIXME: Once device-tree migration is complete the below flags | ||
1602 | * should be populated based upon the device-tree compatible | ||
1603 | * string. For now just use the IP revision. OMAP3+ devices have | ||
1604 | * the wr_access and wr_data_mux_bus register fields. OMAP4+ | ||
1605 | * devices support the addr-addr-data multiplex protocol. | ||
1606 | * | ||
1607 | * GPMC IP revisions: | ||
1608 | * - OMAP24xx = 2.0 | ||
1609 | * - OMAP3xxx = 5.0 | ||
1610 | * - OMAP44xx/54xx/AM335x = 6.0 | ||
1611 | */ | ||
1367 | if (GPMC_REVISION_MAJOR(l) > 0x4) | 1612 | if (GPMC_REVISION_MAJOR(l) > 0x4) |
1368 | gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; | 1613 | gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; |
1614 | if (GPMC_REVISION_MAJOR(l) > 0x5) | ||
1615 | gpmc_capability |= GPMC_HAS_MUX_AAD; | ||
1369 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), | 1616 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), |
1370 | GPMC_REVISION_MINOR(l)); | 1617 | GPMC_REVISION_MINOR(l)); |
1371 | 1618 | ||
1372 | rc = gpmc_mem_init(); | 1619 | gpmc_mem_init(); |
1373 | if (rc < 0) { | ||
1374 | clk_disable_unprepare(gpmc_l3_clk); | ||
1375 | clk_put(gpmc_l3_clk); | ||
1376 | dev_err(gpmc_dev, "failed to reserve memory\n"); | ||
1377 | return rc; | ||
1378 | } | ||
1379 | 1620 | ||
1380 | if (gpmc_setup_irq() < 0) | 1621 | if (gpmc_setup_irq() < 0) |
1381 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); | 1622 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); |
@@ -1383,6 +1624,9 @@ static int gpmc_probe(struct platform_device *pdev) | |||
1383 | /* Now the GPMC is initialised, unreserve the chip-selects */ | 1624 | /* Now the GPMC is initialised, unreserve the chip-selects */ |
1384 | gpmc_cs_map = 0; | 1625 | gpmc_cs_map = 0; |
1385 | 1626 | ||
1627 | if (!pdev->dev.of_node) | ||
1628 | gpmc_nr_waitpins = GPMC_NR_WAITPINS; | ||
1629 | |||
1386 | rc = gpmc_probe_dt(pdev); | 1630 | rc = gpmc_probe_dt(pdev); |
1387 | if (rc < 0) { | 1631 | if (rc < 0) { |
1388 | clk_disable_unprepare(gpmc_l3_clk); | 1632 | clk_disable_unprepare(gpmc_l3_clk); |
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h index fe0a844d5007..707f6d58edd5 100644 --- a/arch/arm/mach-omap2/gpmc.h +++ b/arch/arm/mach-omap2/gpmc.h | |||
@@ -58,7 +58,7 @@ | |||
58 | #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) | 58 | #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) |
59 | #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) | 59 | #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) |
60 | #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) | 60 | #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) |
61 | #define GPMC_CONFIG1_MUXADDDATA (1 << 9) | 61 | #define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8) |
62 | #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) | 62 | #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) |
63 | #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) | 63 | #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) |
64 | #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) | 64 | #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) |
@@ -73,6 +73,13 @@ | |||
73 | #define GPMC_IRQ_FIFOEVENTENABLE 0x01 | 73 | #define GPMC_IRQ_FIFOEVENTENABLE 0x01 |
74 | #define GPMC_IRQ_COUNT_EVENT 0x02 | 74 | #define GPMC_IRQ_COUNT_EVENT 0x02 |
75 | 75 | ||
76 | #define GPMC_BURST_4 4 /* 4 word burst */ | ||
77 | #define GPMC_BURST_8 8 /* 8 word burst */ | ||
78 | #define GPMC_BURST_16 16 /* 16 word burst */ | ||
79 | #define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */ | ||
80 | #define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */ | ||
81 | #define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */ | ||
82 | #define GPMC_MUX_AD 2 /* Addr-Data multiplex */ | ||
76 | 83 | ||
77 | /* bool type time settings */ | 84 | /* bool type time settings */ |
78 | struct gpmc_bool_timings { | 85 | struct gpmc_bool_timings { |
@@ -178,10 +185,6 @@ struct gpmc_device_timings { | |||
178 | u8 cyc_wpl; /* write deassertion time in cycles */ | 185 | u8 cyc_wpl; /* write deassertion time in cycles */ |
179 | u32 cyc_iaa; /* initial access time in cycles */ | 186 | u32 cyc_iaa; /* initial access time in cycles */ |
180 | 187 | ||
181 | bool mux; /* address & data muxed */ | ||
182 | bool sync_write;/* synchronous write */ | ||
183 | bool sync_read; /* synchronous read */ | ||
184 | |||
185 | /* extra delays */ | 188 | /* extra delays */ |
186 | bool ce_xdelay; | 189 | bool ce_xdelay; |
187 | bool avd_xdelay; | 190 | bool avd_xdelay; |
@@ -189,28 +192,40 @@ struct gpmc_device_timings { | |||
189 | bool we_xdelay; | 192 | bool we_xdelay; |
190 | }; | 193 | }; |
191 | 194 | ||
195 | struct gpmc_settings { | ||
196 | bool burst_wrap; /* enables wrap bursting */ | ||
197 | bool burst_read; /* enables read page/burst mode */ | ||
198 | bool burst_write; /* enables write page/burst mode */ | ||
199 | bool device_nand; /* device is NAND */ | ||
200 | bool sync_read; /* enables synchronous reads */ | ||
201 | bool sync_write; /* enables synchronous writes */ | ||
202 | bool wait_on_read; /* monitor wait on reads */ | ||
203 | bool wait_on_write; /* monitor wait on writes */ | ||
204 | u32 burst_len; /* page/burst length */ | ||
205 | u32 device_width; /* device bus width (8 or 16 bit) */ | ||
206 | u32 mux_add_data; /* multiplex address & data */ | ||
207 | u32 wait_pin; /* wait-pin to be used */ | ||
208 | }; | ||
209 | |||
192 | extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | 210 | extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, |
193 | struct gpmc_device_timings *dev_t); | 211 | struct gpmc_settings *gpmc_s, |
212 | struct gpmc_device_timings *dev_t); | ||
194 | 213 | ||
195 | extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); | 214 | extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); |
196 | extern int gpmc_get_client_irq(unsigned irq_config); | 215 | extern int gpmc_get_client_irq(unsigned irq_config); |
197 | 216 | ||
198 | extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns); | ||
199 | extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps); | ||
200 | extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); | 217 | extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); |
201 | extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns); | ||
202 | extern unsigned long gpmc_get_fclk_period(void); | ||
203 | 218 | ||
204 | extern void gpmc_cs_write_reg(int cs, int idx, u32 val); | 219 | extern void gpmc_cs_write_reg(int cs, int idx, u32 val); |
205 | extern u32 gpmc_cs_read_reg(int cs, int idx); | ||
206 | extern int gpmc_calc_divider(unsigned int sync_clk); | 220 | extern int gpmc_calc_divider(unsigned int sync_clk); |
207 | extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); | 221 | extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); |
222 | extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p); | ||
208 | extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); | 223 | extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); |
209 | extern void gpmc_cs_free(int cs); | 224 | extern void gpmc_cs_free(int cs); |
210 | extern int gpmc_cs_set_reserved(int cs, int reserved); | ||
211 | extern int gpmc_cs_reserved(int cs); | ||
212 | extern void omap3_gpmc_save_context(void); | 225 | extern void omap3_gpmc_save_context(void); |
213 | extern void omap3_gpmc_restore_context(void); | 226 | extern void omap3_gpmc_restore_context(void); |
214 | extern int gpmc_cs_configure(int cs, int cmd, int wval); | 227 | extern int gpmc_configure(int cmd, int wval); |
228 | extern void gpmc_read_settings_dt(struct device_node *np, | ||
229 | struct gpmc_settings *p); | ||
215 | 230 | ||
216 | #endif | 231 | #endif |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 63e6384fa72e..f12aa6c15da4 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -57,16 +57,6 @@ | |||
57 | #include "common.h" | 57 | #include "common.h" |
58 | #include "powerdomain.h" | 58 | #include "powerdomain.h" |
59 | 59 | ||
60 | /* Parent clocks, eventually these will come from the clock framework */ | ||
61 | |||
62 | #define OMAP2_MPU_SOURCE "sys_ck" | ||
63 | #define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE | ||
64 | #define OMAP4_MPU_SOURCE "sys_clkin_ck" | ||
65 | #define OMAP5_MPU_SOURCE "sys_clkin" | ||
66 | #define OMAP2_32K_SOURCE "func_32k_ck" | ||
67 | #define OMAP3_32K_SOURCE "omap_32k_fck" | ||
68 | #define OMAP4_32K_SOURCE "sys_32k_ck" | ||
69 | |||
70 | #define REALTIME_COUNTER_BASE 0x48243200 | 60 | #define REALTIME_COUNTER_BASE 0x48243200 |
71 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 | 61 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 |
72 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 | 62 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 |
@@ -130,7 +120,6 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode, | |||
130 | } | 120 | } |
131 | 121 | ||
132 | static struct clock_event_device clockevent_gpt = { | 122 | static struct clock_event_device clockevent_gpt = { |
133 | .name = "gp_timer", | ||
134 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 123 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
135 | .rating = 300, | 124 | .rating = 300, |
136 | .set_next_event = omap2_gp_timer_set_next_event, | 125 | .set_next_event = omap2_gp_timer_set_next_event, |
@@ -171,6 +160,12 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, | |||
171 | if (property && !of_get_property(np, property, NULL)) | 160 | if (property && !of_get_property(np, property, NULL)) |
172 | continue; | 161 | continue; |
173 | 162 | ||
163 | if (!property && (of_get_property(np, "ti,timer-alwon", NULL) || | ||
164 | of_get_property(np, "ti,timer-dsp", NULL) || | ||
165 | of_get_property(np, "ti,timer-pwm", NULL) || | ||
166 | of_get_property(np, "ti,timer-secure", NULL))) | ||
167 | continue; | ||
168 | |||
174 | of_add_property(np, &device_disabled); | 169 | of_add_property(np, &device_disabled); |
175 | return np; | 170 | return np; |
176 | } | 171 | } |
@@ -215,16 +210,17 @@ static u32 __init omap_dm_timer_get_errata(void) | |||
215 | } | 210 | } |
216 | 211 | ||
217 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | 212 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, |
218 | int gptimer_id, | 213 | const char *fck_source, |
219 | const char *fck_source, | 214 | const char *property, |
220 | const char *property, | 215 | const char **timer_name, |
221 | int posted) | 216 | int posted) |
222 | { | 217 | { |
223 | char name[10]; /* 10 = sizeof("gptXX_Xck0") */ | 218 | char name[10]; /* 10 = sizeof("gptXX_Xck0") */ |
224 | const char *oh_name; | 219 | const char *oh_name; |
225 | struct device_node *np; | 220 | struct device_node *np; |
226 | struct omap_hwmod *oh; | 221 | struct omap_hwmod *oh; |
227 | struct resource irq, mem; | 222 | struct resource irq, mem; |
223 | struct clk *src; | ||
228 | int r = 0; | 224 | int r = 0; |
229 | 225 | ||
230 | if (of_have_populated_dt()) { | 226 | if (of_have_populated_dt()) { |
@@ -244,10 +240,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
244 | 240 | ||
245 | of_node_put(np); | 241 | of_node_put(np); |
246 | } else { | 242 | } else { |
247 | if (omap_dm_timer_reserve_systimer(gptimer_id)) | 243 | if (omap_dm_timer_reserve_systimer(timer->id)) |
248 | return -ENODEV; | 244 | return -ENODEV; |
249 | 245 | ||
250 | sprintf(name, "timer%d", gptimer_id); | 246 | sprintf(name, "timer%d", timer->id); |
251 | oh_name = name; | 247 | oh_name = name; |
252 | } | 248 | } |
253 | 249 | ||
@@ -255,6 +251,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
255 | if (!oh) | 251 | if (!oh) |
256 | return -ENODEV; | 252 | return -ENODEV; |
257 | 253 | ||
254 | *timer_name = oh->name; | ||
255 | |||
258 | if (!of_have_populated_dt()) { | 256 | if (!of_have_populated_dt()) { |
259 | r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, | 257 | r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, |
260 | &irq); | 258 | &irq); |
@@ -277,24 +275,24 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
277 | /* After the dmtimer is using hwmod these clocks won't be needed */ | 275 | /* After the dmtimer is using hwmod these clocks won't be needed */ |
278 | timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); | 276 | timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); |
279 | if (IS_ERR(timer->fclk)) | 277 | if (IS_ERR(timer->fclk)) |
280 | return -ENODEV; | 278 | return PTR_ERR(timer->fclk); |
281 | 279 | ||
282 | /* FIXME: Need to remove hard-coded test on timer ID */ | 280 | src = clk_get(NULL, fck_source); |
283 | if (gptimer_id != 12) { | 281 | if (IS_ERR(src)) |
284 | struct clk *src; | 282 | return PTR_ERR(src); |
285 | 283 | ||
286 | src = clk_get(NULL, fck_source); | 284 | if (clk_get_parent(timer->fclk) != src) { |
287 | if (IS_ERR(src)) { | 285 | r = clk_set_parent(timer->fclk, src); |
288 | r = -EINVAL; | 286 | if (r < 0) { |
289 | } else { | 287 | pr_warn("%s: %s cannot set source\n", __func__, |
290 | r = clk_set_parent(timer->fclk, src); | 288 | oh->name); |
291 | if (r < 0) | ||
292 | pr_warn("%s: %s cannot set source\n", | ||
293 | __func__, oh->name); | ||
294 | clk_put(src); | 289 | clk_put(src); |
290 | return r; | ||
295 | } | 291 | } |
296 | } | 292 | } |
297 | 293 | ||
294 | clk_put(src); | ||
295 | |||
298 | omap_hwmod_setup_one(oh_name); | 296 | omap_hwmod_setup_one(oh_name); |
299 | omap_hwmod_enable(oh); | 297 | omap_hwmod_enable(oh); |
300 | __omap_dm_timer_init_regs(timer); | 298 | __omap_dm_timer_init_regs(timer); |
@@ -318,6 +316,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
318 | { | 316 | { |
319 | int res; | 317 | int res; |
320 | 318 | ||
319 | clkev.id = gptimer_id; | ||
321 | clkev.errata = omap_dm_timer_get_errata(); | 320 | clkev.errata = omap_dm_timer_get_errata(); |
322 | 321 | ||
323 | /* | 322 | /* |
@@ -327,8 +326,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
327 | */ | 326 | */ |
328 | __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); | 327 | __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); |
329 | 328 | ||
330 | res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property, | 329 | res = omap_dm_timer_init_one(&clkev, fck_source, property, |
331 | OMAP_TIMER_POSTED); | 330 | &clockevent_gpt.name, OMAP_TIMER_POSTED); |
332 | BUG_ON(res); | 331 | BUG_ON(res); |
333 | 332 | ||
334 | omap2_gp_timer_irq.dev_id = &clkev; | 333 | omap2_gp_timer_irq.dev_id = &clkev; |
@@ -342,8 +341,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
342 | 3, /* Timer internal resynch latency */ | 341 | 3, /* Timer internal resynch latency */ |
343 | 0xffffffff); | 342 | 0xffffffff); |
344 | 343 | ||
345 | pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", | 344 | pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, |
346 | gptimer_id, clkev.rate); | 345 | clkev.rate); |
347 | } | 346 | } |
348 | 347 | ||
349 | /* Clocksource code */ | 348 | /* Clocksource code */ |
@@ -360,7 +359,6 @@ static cycle_t clocksource_read_cycles(struct clocksource *cs) | |||
360 | } | 359 | } |
361 | 360 | ||
362 | static struct clocksource clocksource_gpt = { | 361 | static struct clocksource clocksource_gpt = { |
363 | .name = "gp_timer", | ||
364 | .rating = 300, | 362 | .rating = 300, |
365 | .read = clocksource_read_cycles, | 363 | .read = clocksource_read_cycles, |
366 | .mask = CLOCKSOURCE_MASK(32), | 364 | .mask = CLOCKSOURCE_MASK(32), |
@@ -443,13 +441,16 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) | |||
443 | } | 441 | } |
444 | 442 | ||
445 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, | 443 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, |
446 | const char *fck_source) | 444 | const char *fck_source, |
445 | const char *property) | ||
447 | { | 446 | { |
448 | int res; | 447 | int res; |
449 | 448 | ||
449 | clksrc.id = gptimer_id; | ||
450 | clksrc.errata = omap_dm_timer_get_errata(); | 450 | clksrc.errata = omap_dm_timer_get_errata(); |
451 | 451 | ||
452 | res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL, | 452 | res = omap_dm_timer_init_one(&clksrc, fck_source, property, |
453 | &clocksource_gpt.name, | ||
453 | OMAP_TIMER_NONPOSTED); | 454 | OMAP_TIMER_NONPOSTED); |
454 | BUG_ON(res); | 455 | BUG_ON(res); |
455 | 456 | ||
@@ -462,8 +463,8 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id, | |||
462 | pr_err("Could not register clocksource %s\n", | 463 | pr_err("Could not register clocksource %s\n", |
463 | clocksource_gpt.name); | 464 | clocksource_gpt.name); |
464 | else | 465 | else |
465 | pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", | 466 | pr_info("OMAP clocksource: %s at %lu Hz\n", |
466 | gptimer_id, clksrc.rate); | 467 | clocksource_gpt.name, clksrc.rate); |
467 | } | 468 | } |
468 | 469 | ||
469 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER | 470 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER |
@@ -488,7 +489,7 @@ static void __init realtime_counter_init(void) | |||
488 | pr_err("%s: ioremap failed\n", __func__); | 489 | pr_err("%s: ioremap failed\n", __func__); |
489 | return; | 490 | return; |
490 | } | 491 | } |
491 | sys_clk = clk_get(NULL, OMAP5_MPU_SOURCE); | 492 | sys_clk = clk_get(NULL, "sys_clkin"); |
492 | if (IS_ERR(sys_clk)) { | 493 | if (IS_ERR(sys_clk)) { |
493 | pr_err("%s: failed to get system clock handle\n", __func__); | 494 | pr_err("%s: failed to get system clock handle\n", __func__); |
494 | iounmap(base); | 495 | iounmap(base); |
@@ -545,53 +546,52 @@ static inline void __init realtime_counter_init(void) | |||
545 | #endif | 546 | #endif |
546 | 547 | ||
547 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 548 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
548 | clksrc_nr, clksrc_src) \ | 549 | clksrc_nr, clksrc_src, clksrc_prop) \ |
549 | void __init omap##name##_gptimer_timer_init(void) \ | 550 | void __init omap##name##_gptimer_timer_init(void) \ |
550 | { \ | 551 | { \ |
551 | if (omap_clk_init) \ | ||
552 | omap_clk_init(); \ | ||
553 | omap_dmtimer_init(); \ | 552 | omap_dmtimer_init(); \ |
554 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 553 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
555 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ | 554 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ |
555 | clksrc_prop); \ | ||
556 | } | 556 | } |
557 | 557 | ||
558 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 558 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
559 | clksrc_nr, clksrc_src) \ | 559 | clksrc_nr, clksrc_src, clksrc_prop) \ |
560 | void __init omap##name##_sync32k_timer_init(void) \ | 560 | void __init omap##name##_sync32k_timer_init(void) \ |
561 | { \ | 561 | { \ |
562 | if (omap_clk_init) \ | ||
563 | omap_clk_init(); \ | ||
564 | omap_dmtimer_init(); \ | 562 | omap_dmtimer_init(); \ |
565 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 563 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
566 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ | 564 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ |
567 | if (use_gptimer_clksrc) \ | 565 | if (use_gptimer_clksrc) \ |
568 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\ | 566 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ |
567 | clksrc_prop); \ | ||
569 | else \ | 568 | else \ |
570 | omap2_sync32k_clocksource_init(); \ | 569 | omap2_sync32k_clocksource_init(); \ |
571 | } | 570 | } |
572 | 571 | ||
573 | #ifdef CONFIG_ARCH_OMAP2 | 572 | #ifdef CONFIG_ARCH_OMAP2 |
574 | OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", | 573 | OMAP_SYS_32K_TIMER_INIT(2, 1, "timer_32k_ck", "ti,timer-alwon", |
575 | 2, OMAP2_MPU_SOURCE); | 574 | 2, "timer_sys_ck", NULL); |
576 | #endif /* CONFIG_ARCH_OMAP2 */ | 575 | #endif /* CONFIG_ARCH_OMAP2 */ |
577 | 576 | ||
578 | #ifdef CONFIG_ARCH_OMAP3 | 577 | #ifdef CONFIG_ARCH_OMAP3 |
579 | OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", | 578 | OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon", |
580 | 2, OMAP3_MPU_SOURCE); | 579 | 2, "timer_sys_ck", NULL); |
581 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", | 580 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure", |
582 | 2, OMAP3_MPU_SOURCE); | 581 | 2, "timer_sys_ck", NULL); |
583 | OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon", | ||
584 | 2, OMAP3_MPU_SOURCE); | ||
585 | #endif /* CONFIG_ARCH_OMAP3 */ | 582 | #endif /* CONFIG_ARCH_OMAP3 */ |
586 | 583 | ||
587 | #ifdef CONFIG_SOC_AM33XX | 584 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) |
588 | OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", | 585 | OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL, |
589 | 2, OMAP4_MPU_SOURCE); | 586 | 1, "timer_sys_ck", "ti,timer-alwon"); |
590 | #endif /* CONFIG_SOC_AM33XX */ | 587 | #endif |
588 | |||
589 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | ||
590 | static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon", | ||
591 | 2, "sys_clkin_ck", NULL); | ||
592 | #endif | ||
591 | 593 | ||
592 | #ifdef CONFIG_ARCH_OMAP4 | 594 | #ifdef CONFIG_ARCH_OMAP4 |
593 | OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | ||
594 | 2, OMAP4_MPU_SOURCE); | ||
595 | #ifdef CONFIG_LOCAL_TIMERS | 595 | #ifdef CONFIG_LOCAL_TIMERS |
596 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); | 596 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); |
597 | void __init omap4_local_timer_init(void) | 597 | void __init omap4_local_timer_init(void) |
@@ -620,13 +620,11 @@ void __init omap4_local_timer_init(void) | |||
620 | #endif /* CONFIG_ARCH_OMAP4 */ | 620 | #endif /* CONFIG_ARCH_OMAP4 */ |
621 | 621 | ||
622 | #ifdef CONFIG_SOC_OMAP5 | 622 | #ifdef CONFIG_SOC_OMAP5 |
623 | OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | ||
624 | 2, OMAP5_MPU_SOURCE); | ||
625 | void __init omap5_realtime_timer_init(void) | 623 | void __init omap5_realtime_timer_init(void) |
626 | { | 624 | { |
627 | int err; | 625 | int err; |
628 | 626 | ||
629 | omap5_sync32k_timer_init(); | 627 | omap4_sync32k_timer_init(); |
630 | realtime_counter_init(); | 628 | realtime_counter_init(); |
631 | 629 | ||
632 | err = arch_timer_of_register(); | 630 | err = arch_timer_of_register(); |
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index 5706bdccf45e..aa27d7f5cbb7 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -22,8 +22,12 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | 25 | #include <linux/regulator/machine.h> | |
26 | #include <asm/io.h> | 26 | #include <linux/regulator/fixed.h> |
27 | #include <linux/string.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/usb/phy.h> | ||
27 | 31 | ||
28 | #include "soc.h" | 32 | #include "soc.h" |
29 | #include "omap_device.h" | 33 | #include "omap_device.h" |
@@ -526,3 +530,155 @@ void __init usbhs_init(struct usbhs_omap_platform_data *pdata) | |||
526 | } | 530 | } |
527 | 531 | ||
528 | #endif | 532 | #endif |
533 | |||
534 | /* Template for PHY regulators */ | ||
535 | static struct fixed_voltage_config hsusb_reg_config = { | ||
536 | /* .supply_name filled later */ | ||
537 | .microvolts = 3300000, | ||
538 | .gpio = -1, /* updated later */ | ||
539 | .startup_delay = 70000, /* 70msec */ | ||
540 | .enable_high = 1, /* updated later */ | ||
541 | .enabled_at_boot = 0, /* keep in RESET */ | ||
542 | /* .init_data filled later */ | ||
543 | }; | ||
544 | |||
545 | static const char *nop_name = "nop_usb_xceiv"; /* NOP PHY driver */ | ||
546 | static const char *reg_name = "reg-fixed-voltage"; /* Regulator driver */ | ||
547 | |||
548 | /** | ||
549 | * usbhs_add_regulator - Add a gpio based fixed voltage regulator device | ||
550 | * @name: name for the regulator | ||
551 | * @dev_id: device id of the device this regulator supplies power to | ||
552 | * @dev_supply: supply name that the device expects | ||
553 | * @gpio: GPIO number | ||
554 | * @polarity: 1 - Active high, 0 - Active low | ||
555 | */ | ||
556 | static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, | ||
557 | int gpio, int polarity) | ||
558 | { | ||
559 | struct regulator_consumer_supply *supplies; | ||
560 | struct regulator_init_data *reg_data; | ||
561 | struct fixed_voltage_config *config; | ||
562 | struct platform_device *pdev; | ||
563 | int ret; | ||
564 | |||
565 | supplies = kzalloc(sizeof(*supplies), GFP_KERNEL); | ||
566 | if (!supplies) | ||
567 | return -ENOMEM; | ||
568 | |||
569 | supplies->supply = dev_supply; | ||
570 | supplies->dev_name = dev_id; | ||
571 | |||
572 | reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); | ||
573 | if (!reg_data) | ||
574 | return -ENOMEM; | ||
575 | |||
576 | reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; | ||
577 | reg_data->consumer_supplies = supplies; | ||
578 | reg_data->num_consumer_supplies = 1; | ||
579 | |||
580 | config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config), | ||
581 | GFP_KERNEL); | ||
582 | if (!config) | ||
583 | return -ENOMEM; | ||
584 | |||
585 | config->supply_name = name; | ||
586 | config->gpio = gpio; | ||
587 | config->enable_high = polarity; | ||
588 | config->init_data = reg_data; | ||
589 | |||
590 | /* create a regulator device */ | ||
591 | pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); | ||
592 | if (!pdev) | ||
593 | return -ENOMEM; | ||
594 | |||
595 | pdev->id = PLATFORM_DEVID_AUTO; | ||
596 | pdev->name = reg_name; | ||
597 | pdev->dev.platform_data = config; | ||
598 | |||
599 | ret = platform_device_register(pdev); | ||
600 | if (ret) | ||
601 | pr_err("%s: Failed registering regulator %s for %s\n", | ||
602 | __func__, name, dev_id); | ||
603 | |||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys) | ||
608 | { | ||
609 | char *rail_name; | ||
610 | int i, len; | ||
611 | struct platform_device *pdev; | ||
612 | char *phy_id; | ||
613 | |||
614 | /* the phy_id will be something like "nop_usb_xceiv.1" */ | ||
615 | len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */ | ||
616 | |||
617 | for (i = 0; i < num_phys; i++) { | ||
618 | |||
619 | if (!phy->port) { | ||
620 | pr_err("%s: Invalid port 0. Must start from 1\n", | ||
621 | __func__); | ||
622 | continue; | ||
623 | } | ||
624 | |||
625 | /* do we need a NOP PHY device ? */ | ||
626 | if (!gpio_is_valid(phy->reset_gpio) && | ||
627 | !gpio_is_valid(phy->vcc_gpio)) | ||
628 | continue; | ||
629 | |||
630 | /* create a NOP PHY device */ | ||
631 | pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); | ||
632 | if (!pdev) | ||
633 | return -ENOMEM; | ||
634 | |||
635 | pdev->id = phy->port; | ||
636 | pdev->name = nop_name; | ||
637 | pdev->dev.platform_data = phy->platform_data; | ||
638 | |||
639 | phy_id = kmalloc(len, GFP_KERNEL); | ||
640 | if (!phy_id) | ||
641 | return -ENOMEM; | ||
642 | |||
643 | scnprintf(phy_id, len, "nop_usb_xceiv.%d\n", | ||
644 | pdev->id); | ||
645 | |||
646 | if (platform_device_register(pdev)) { | ||
647 | pr_err("%s: Failed to register device %s\n", | ||
648 | __func__, phy_id); | ||
649 | continue; | ||
650 | } | ||
651 | |||
652 | usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id); | ||
653 | |||
654 | /* Do we need RESET regulator ? */ | ||
655 | if (gpio_is_valid(phy->reset_gpio)) { | ||
656 | |||
657 | rail_name = kmalloc(13, GFP_KERNEL); | ||
658 | if (!rail_name) | ||
659 | return -ENOMEM; | ||
660 | |||
661 | scnprintf(rail_name, 13, "hsusb%d_reset", phy->port); | ||
662 | |||
663 | usbhs_add_regulator(rail_name, phy_id, "reset", | ||
664 | phy->reset_gpio, 1); | ||
665 | } | ||
666 | |||
667 | /* Do we need VCC regulator ? */ | ||
668 | if (gpio_is_valid(phy->vcc_gpio)) { | ||
669 | |||
670 | rail_name = kmalloc(13, GFP_KERNEL); | ||
671 | if (!rail_name) | ||
672 | return -ENOMEM; | ||
673 | |||
674 | scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port); | ||
675 | |||
676 | usbhs_add_regulator(rail_name, phy_id, "vcc", | ||
677 | phy->vcc_gpio, phy->vcc_polarity); | ||
678 | } | ||
679 | |||
680 | phy++; | ||
681 | } | ||
682 | |||
683 | return 0; | ||
684 | } | ||
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index c5a3c6f9504e..e832bc7b8e2d 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/err.h> | ||
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
@@ -26,6 +27,24 @@ | |||
26 | static u8 async_cs, sync_cs; | 27 | static u8 async_cs, sync_cs; |
27 | static unsigned refclk_psec; | 28 | static unsigned refclk_psec; |
28 | 29 | ||
30 | static struct gpmc_settings tusb_async = { | ||
31 | .wait_on_read = true, | ||
32 | .wait_on_write = true, | ||
33 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
34 | .mux_add_data = GPMC_MUX_AD, | ||
35 | }; | ||
36 | |||
37 | static struct gpmc_settings tusb_sync = { | ||
38 | .burst_read = true, | ||
39 | .burst_write = true, | ||
40 | .sync_read = true, | ||
41 | .sync_write = true, | ||
42 | .wait_on_read = true, | ||
43 | .wait_on_write = true, | ||
44 | .burst_len = GPMC_BURST_16, | ||
45 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
46 | .mux_add_data = GPMC_MUX_AD, | ||
47 | }; | ||
29 | 48 | ||
30 | /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ | 49 | /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ |
31 | 50 | ||
@@ -37,8 +56,6 @@ static int tusb_set_async_mode(unsigned sysclk_ps) | |||
37 | 56 | ||
38 | memset(&dev_t, 0, sizeof(dev_t)); | 57 | memset(&dev_t, 0, sizeof(dev_t)); |
39 | 58 | ||
40 | dev_t.mux = true; | ||
41 | |||
42 | dev_t.t_ceasu = 8 * 1000; | 59 | dev_t.t_ceasu = 8 * 1000; |
43 | dev_t.t_avdasu = t_acsnh_advnh - 7000; | 60 | dev_t.t_avdasu = t_acsnh_advnh - 7000; |
44 | dev_t.t_ce_avd = 1000; | 61 | dev_t.t_ce_avd = 1000; |
@@ -52,7 +69,7 @@ static int tusb_set_async_mode(unsigned sysclk_ps) | |||
52 | dev_t.t_wpl = 300; | 69 | dev_t.t_wpl = 300; |
53 | dev_t.cyc_aavdh_we = 1; | 70 | dev_t.cyc_aavdh_we = 1; |
54 | 71 | ||
55 | gpmc_calc_timings(&t, &dev_t); | 72 | gpmc_calc_timings(&t, &tusb_async, &dev_t); |
56 | 73 | ||
57 | return gpmc_cs_set_timings(async_cs, &t); | 74 | return gpmc_cs_set_timings(async_cs, &t); |
58 | } | 75 | } |
@@ -65,10 +82,6 @@ static int tusb_set_sync_mode(unsigned sysclk_ps) | |||
65 | 82 | ||
66 | memset(&dev_t, 0, sizeof(dev_t)); | 83 | memset(&dev_t, 0, sizeof(dev_t)); |
67 | 84 | ||
68 | dev_t.mux = true; | ||
69 | dev_t.sync_read = true; | ||
70 | dev_t.sync_write = true; | ||
71 | |||
72 | dev_t.clk = 11100; | 85 | dev_t.clk = 11100; |
73 | dev_t.t_bacc = 1000; | 86 | dev_t.t_bacc = 1000; |
74 | dev_t.t_ces = 1000; | 87 | dev_t.t_ces = 1000; |
@@ -84,7 +97,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps) | |||
84 | dev_t.cyc_wpl = 6; | 97 | dev_t.cyc_wpl = 6; |
85 | dev_t.t_ce_rdyz = 7000; | 98 | dev_t.t_ce_rdyz = 7000; |
86 | 99 | ||
87 | gpmc_calc_timings(&t, &dev_t); | 100 | gpmc_calc_timings(&t, &tusb_sync, &dev_t); |
88 | 101 | ||
89 | return gpmc_cs_set_timings(sync_cs, &t); | 102 | return gpmc_cs_set_timings(sync_cs, &t); |
90 | } | 103 | } |
@@ -165,18 +178,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
165 | return status; | 178 | return status; |
166 | } | 179 | } |
167 | tusb_resources[0].end = tusb_resources[0].start + 0x9ff; | 180 | tusb_resources[0].end = tusb_resources[0].start + 0x9ff; |
181 | tusb_async.wait_pin = waitpin; | ||
168 | async_cs = async; | 182 | async_cs = async; |
169 | gpmc_cs_write_reg(async, GPMC_CS_CONFIG1, | ||
170 | GPMC_CONFIG1_PAGE_LEN(2) | ||
171 | | GPMC_CONFIG1_WAIT_READ_MON | ||
172 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
173 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
174 | | GPMC_CONFIG1_READTYPE_ASYNC | ||
175 | | GPMC_CONFIG1_WRITETYPE_ASYNC | ||
176 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
177 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
178 | | GPMC_CONFIG1_MUXADDDATA); | ||
179 | 183 | ||
184 | status = gpmc_cs_program_settings(async_cs, &tusb_async); | ||
185 | if (status < 0) | ||
186 | return status; | ||
180 | 187 | ||
181 | /* SYNC region, primarily for DMA */ | 188 | /* SYNC region, primarily for DMA */ |
182 | status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) | 189 | status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) |
@@ -186,21 +193,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
186 | return status; | 193 | return status; |
187 | } | 194 | } |
188 | tusb_resources[1].end = tusb_resources[1].start + 0x9ff; | 195 | tusb_resources[1].end = tusb_resources[1].start + 0x9ff; |
196 | tusb_sync.wait_pin = waitpin; | ||
189 | sync_cs = sync; | 197 | sync_cs = sync; |
190 | gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1, | 198 | |
191 | GPMC_CONFIG1_READMULTIPLE_SUPP | 199 | status = gpmc_cs_program_settings(sync_cs, &tusb_sync); |
192 | | GPMC_CONFIG1_READTYPE_SYNC | 200 | if (status < 0) |
193 | | GPMC_CONFIG1_WRITEMULTIPLE_SUPP | 201 | return status; |
194 | | GPMC_CONFIG1_WRITETYPE_SYNC | ||
195 | | GPMC_CONFIG1_PAGE_LEN(2) | ||
196 | | GPMC_CONFIG1_WAIT_READ_MON | ||
197 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
198 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
199 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
200 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
201 | | GPMC_CONFIG1_MUXADDDATA | ||
202 | /* fclk divider gets set later */ | ||
203 | ); | ||
204 | 202 | ||
205 | /* IRQ */ | 203 | /* IRQ */ |
206 | status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); | 204 | status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); |
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h index 3319f5cf47a3..e7261ebcf7b0 100644 --- a/arch/arm/mach-omap2/usb.h +++ b/arch/arm/mach-omap2/usb.h | |||
@@ -53,8 +53,17 @@ | |||
53 | #define USBPHY_OTGSESSEND_EN (1 << 20) | 53 | #define USBPHY_OTGSESSEND_EN (1 << 20) |
54 | #define USBPHY_DATA_POLARITY (1 << 23) | 54 | #define USBPHY_DATA_POLARITY (1 << 23) |
55 | 55 | ||
56 | struct usbhs_phy_data { | ||
57 | int port; /* 1 indexed port number */ | ||
58 | int reset_gpio; | ||
59 | int vcc_gpio; | ||
60 | bool vcc_polarity; /* 1 active high, 0 active low */ | ||
61 | void *platform_data; | ||
62 | }; | ||
63 | |||
56 | extern void usb_musb_init(struct omap_musb_board_data *board_data); | 64 | extern void usb_musb_init(struct omap_musb_board_data *board_data); |
57 | extern void usbhs_init(struct usbhs_omap_platform_data *pdata); | 65 | extern void usbhs_init(struct usbhs_omap_platform_data *pdata); |
66 | extern int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys); | ||
58 | 67 | ||
59 | extern void am35x_musb_reset(void); | 68 | extern void am35x_musb_reset(void); |
60 | extern void am35x_musb_phy_power(u8 on); | 69 | extern void am35x_musb_phy_power(u8 on); |
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 8d5fa6ece014..f2f7088bfd22 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -30,6 +30,7 @@ config CPU_S3C2410 | |||
30 | select S3C2410_CLOCK | 30 | select S3C2410_CLOCK |
31 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX | 31 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX |
32 | select S3C2410_PM if PM | 32 | select S3C2410_PM if PM |
33 | select SAMSUNG_HRT | ||
33 | help | 34 | help |
34 | Support for S3C2410 and S3C2410A family from the S3C24XX line | 35 | Support for S3C2410 and S3C2410A family from the S3C24XX line |
35 | of Samsung Mobile CPUs. | 36 | of Samsung Mobile CPUs. |
@@ -40,6 +41,7 @@ config CPU_S3C2412 | |||
40 | select CPU_LLSERIAL_S3C2440 | 41 | select CPU_LLSERIAL_S3C2440 |
41 | select S3C2412_DMA if S3C24XX_DMA | 42 | select S3C2412_DMA if S3C24XX_DMA |
42 | select S3C2412_PM if PM | 43 | select S3C2412_PM if PM |
44 | select SAMSUNG_HRT | ||
43 | help | 45 | help |
44 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line | 46 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line |
45 | 47 | ||
@@ -51,6 +53,7 @@ config CPU_S3C2416 | |||
51 | select S3C2443_COMMON | 53 | select S3C2443_COMMON |
52 | select S3C2443_DMA if S3C24XX_DMA | 54 | select S3C2443_DMA if S3C24XX_DMA |
53 | select SAMSUNG_CLKSRC | 55 | select SAMSUNG_CLKSRC |
56 | select SAMSUNG_HRT | ||
54 | help | 57 | help |
55 | Support for the S3C2416 SoC from the S3C24XX line | 58 | Support for the S3C2416 SoC from the S3C24XX line |
56 | 59 | ||
@@ -61,6 +64,7 @@ config CPU_S3C2440 | |||
61 | select S3C2410_CLOCK | 64 | select S3C2410_CLOCK |
62 | select S3C2410_PM if PM | 65 | select S3C2410_PM if PM |
63 | select S3C2440_DMA if S3C24XX_DMA | 66 | select S3C2440_DMA if S3C24XX_DMA |
67 | select SAMSUNG_HRT | ||
64 | help | 68 | help |
65 | Support for S3C2440 Samsung Mobile CPU based systems. | 69 | Support for S3C2440 Samsung Mobile CPU based systems. |
66 | 70 | ||
@@ -70,6 +74,7 @@ config CPU_S3C2442 | |||
70 | select CPU_LLSERIAL_S3C2440 | 74 | select CPU_LLSERIAL_S3C2440 |
71 | select S3C2410_CLOCK | 75 | select S3C2410_CLOCK |
72 | select S3C2410_PM if PM | 76 | select S3C2410_PM if PM |
77 | select SAMSUNG_HRT | ||
73 | help | 78 | help |
74 | Support for S3C2442 Samsung Mobile CPU based systems. | 79 | Support for S3C2442 Samsung Mobile CPU based systems. |
75 | 80 | ||
@@ -84,6 +89,7 @@ config CPU_S3C2443 | |||
84 | select S3C2443_COMMON | 89 | select S3C2443_COMMON |
85 | select S3C2443_DMA if S3C24XX_DMA | 90 | select S3C2443_DMA if S3C24XX_DMA |
86 | select SAMSUNG_CLKSRC | 91 | select SAMSUNG_CLKSRC |
92 | select SAMSUNG_HRT | ||
87 | help | 93 | help |
88 | Support for the S3C2443 SoC from the S3C24XX line | 94 | Support for the S3C2443 SoC from the S3C24XX line |
89 | 95 | ||
@@ -395,6 +401,7 @@ config S3C2412_DMA | |||
395 | config S3C2412_PM | 401 | config S3C2412_PM |
396 | bool | 402 | bool |
397 | select S3C2412_PM_SLEEP | 403 | select S3C2412_PM_SLEEP |
404 | select SAMSUNG_WAKEMASK | ||
398 | help | 405 | help |
399 | Internal config node to apply S3C2412 power management | 406 | Internal config node to apply S3C2412 power management |
400 | 407 | ||
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile index af53d27d5c36..6f46ecfc8396 100644 --- a/arch/arm/mach-s3c24xx/Makefile +++ b/arch/arm/mach-s3c24xx/Makefile | |||
@@ -14,7 +14,7 @@ obj- := | |||
14 | 14 | ||
15 | # core | 15 | # core |
16 | 16 | ||
17 | obj-y += common.o irq.o | 17 | obj-y += common.o |
18 | 18 | ||
19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o | 19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o |
20 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o | 20 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o |
@@ -22,7 +22,7 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o | |||
22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o | 22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o |
23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o | 23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o |
24 | 24 | ||
25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o | 25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o |
26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o | 26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o |
27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o | 27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o |
28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o | 28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o |
@@ -31,9 +31,9 @@ obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o | |||
31 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o | 31 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o |
32 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o | 32 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o |
33 | 33 | ||
34 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o | 34 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o |
35 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o | 35 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o |
36 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o | 36 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o |
37 | obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o | 37 | obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o |
38 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o | 38 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o |
39 | obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o | 39 | obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o |
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h index 8a2b4137ddb6..307c3714be55 100644 --- a/arch/arm/mach-s3c24xx/common.h +++ b/arch/arm/mach-s3c24xx/common.h | |||
@@ -21,6 +21,7 @@ extern void s3c2410_map_io(void); | |||
21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); | 21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
22 | extern void s3c2410_init_clocks(int xtal); | 22 | extern void s3c2410_init_clocks(int xtal); |
23 | extern void s3c2410_restart(char mode, const char *cmd); | 23 | extern void s3c2410_restart(char mode, const char *cmd); |
24 | extern void s3c2410_init_irq(void); | ||
24 | #else | 25 | #else |
25 | #define s3c2410_init_clocks NULL | 26 | #define s3c2410_init_clocks NULL |
26 | #define s3c2410_init_uarts NULL | 27 | #define s3c2410_init_uarts NULL |
@@ -36,6 +37,7 @@ extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); | |||
36 | extern void s3c2412_init_clocks(int xtal); | 37 | extern void s3c2412_init_clocks(int xtal); |
37 | extern int s3c2412_baseclk_add(void); | 38 | extern int s3c2412_baseclk_add(void); |
38 | extern void s3c2412_restart(char mode, const char *cmd); | 39 | extern void s3c2412_restart(char mode, const char *cmd); |
40 | extern void s3c2412_init_irq(void); | ||
39 | #else | 41 | #else |
40 | #define s3c2412_init_clocks NULL | 42 | #define s3c2412_init_clocks NULL |
41 | #define s3c2412_init_uarts NULL | 43 | #define s3c2412_init_uarts NULL |
@@ -73,6 +75,7 @@ extern void s3c244x_restart(char mode, const char *cmd); | |||
73 | #ifdef CONFIG_CPU_S3C2440 | 75 | #ifdef CONFIG_CPU_S3C2440 |
74 | extern int s3c2440_init(void); | 76 | extern int s3c2440_init(void); |
75 | extern void s3c2440_map_io(void); | 77 | extern void s3c2440_map_io(void); |
78 | extern void s3c2440_init_irq(void); | ||
76 | #else | 79 | #else |
77 | #define s3c2440_init NULL | 80 | #define s3c2440_init NULL |
78 | #define s3c2440_map_io NULL | 81 | #define s3c2440_map_io NULL |
@@ -81,6 +84,7 @@ extern void s3c2440_map_io(void); | |||
81 | #ifdef CONFIG_CPU_S3C2442 | 84 | #ifdef CONFIG_CPU_S3C2442 |
82 | extern int s3c2442_init(void); | 85 | extern int s3c2442_init(void); |
83 | extern void s3c2442_map_io(void); | 86 | extern void s3c2442_map_io(void); |
87 | extern void s3c2442_init_irq(void); | ||
84 | #else | 88 | #else |
85 | #define s3c2442_init NULL | 89 | #define s3c2442_init NULL |
86 | #define s3c2442_map_io NULL | 90 | #define s3c2442_map_io NULL |
diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S deleted file mode 100644 index 6a21beeba1da..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-s3c2410/include/mach/entry-macro.S | ||
3 | * | ||
4 | * Low-level IRQ helper macros for S3C2410-based platforms | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | /* We have a problem that the INTOFFSET register does not always | ||
12 | * show one interrupt. Occasionally we get two interrupts through | ||
13 | * the prioritiser, and this causes the INTOFFSET register to show | ||
14 | * what looks like the logical-or of the two interrupt numbers. | ||
15 | * | ||
16 | * Thanks to Klaus, Shannon, et al for helping to debug this problem | ||
17 | */ | ||
18 | |||
19 | #define INTPND (0x10) | ||
20 | #define INTOFFSET (0x14) | ||
21 | |||
22 | #include <mach/hardware.h> | ||
23 | #include <asm/irq.h> | ||
24 | |||
25 | .macro get_irqnr_preamble, base, tmp | ||
26 | .endm | ||
27 | |||
28 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
29 | |||
30 | mov \base, #S3C24XX_VA_IRQ | ||
31 | |||
32 | @@ try the interrupt offset register, since it is there | ||
33 | |||
34 | ldr \irqstat, [\base, #INTPND ] | ||
35 | teq \irqstat, #0 | ||
36 | beq 1002f | ||
37 | ldr \irqnr, [\base, #INTOFFSET ] | ||
38 | mov \tmp, #1 | ||
39 | tst \irqstat, \tmp, lsl \irqnr | ||
40 | bne 1001f | ||
41 | |||
42 | @@ the number specified is not a valid irq, so try | ||
43 | @@ and work it out for ourselves | ||
44 | |||
45 | mov \irqnr, #0 @@ start here | ||
46 | |||
47 | @@ work out which irq (if any) we got | ||
48 | |||
49 | movs \tmp, \irqstat, lsl#16 | ||
50 | addeq \irqnr, \irqnr, #16 | ||
51 | moveq \irqstat, \irqstat, lsr#16 | ||
52 | tst \irqstat, #0xff | ||
53 | addeq \irqnr, \irqnr, #8 | ||
54 | moveq \irqstat, \irqstat, lsr#8 | ||
55 | tst \irqstat, #0xf | ||
56 | addeq \irqnr, \irqnr, #4 | ||
57 | moveq \irqstat, \irqstat, lsr#4 | ||
58 | tst \irqstat, #0x3 | ||
59 | addeq \irqnr, \irqnr, #2 | ||
60 | moveq \irqstat, \irqstat, lsr#2 | ||
61 | tst \irqstat, #0x1 | ||
62 | addeq \irqnr, \irqnr, #1 | ||
63 | |||
64 | @@ we have the value | ||
65 | 1001: | ||
66 | adds \irqnr, \irqnr, #IRQ_EINT0 | ||
67 | 1002: | ||
68 | @@ exit here, Z flag unset if IRQ | ||
69 | |||
70 | .endm | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h index 1e73f5fa8659..b6dd4cb5a2ec 100644 --- a/arch/arm/mach-s3c24xx/include/mach/irqs.h +++ b/arch/arm/mach-s3c24xx/include/mach/irqs.h | |||
@@ -59,49 +59,53 @@ | |||
59 | #define IRQ_ADCPARENT S3C2410_IRQ(31) | 59 | #define IRQ_ADCPARENT S3C2410_IRQ(31) |
60 | 60 | ||
61 | /* interrupts generated from the external interrupts sources */ | 61 | /* interrupts generated from the external interrupts sources */ |
62 | #define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */ | 62 | #define IRQ_EINT0_2412 S3C2410_IRQ(32) |
63 | #define IRQ_EINT5 S3C2410_IRQ(33) | 63 | #define IRQ_EINT1_2412 S3C2410_IRQ(33) |
64 | #define IRQ_EINT6 S3C2410_IRQ(34) | 64 | #define IRQ_EINT2_2412 S3C2410_IRQ(34) |
65 | #define IRQ_EINT7 S3C2410_IRQ(35) | 65 | #define IRQ_EINT3_2412 S3C2410_IRQ(35) |
66 | #define IRQ_EINT8 S3C2410_IRQ(36) | 66 | #define IRQ_EINT4 S3C2410_IRQ(36) /* 52 */ |
67 | #define IRQ_EINT9 S3C2410_IRQ(37) | 67 | #define IRQ_EINT5 S3C2410_IRQ(37) |
68 | #define IRQ_EINT10 S3C2410_IRQ(38) | 68 | #define IRQ_EINT6 S3C2410_IRQ(38) |
69 | #define IRQ_EINT11 S3C2410_IRQ(39) | 69 | #define IRQ_EINT7 S3C2410_IRQ(39) |
70 | #define IRQ_EINT12 S3C2410_IRQ(40) | 70 | #define IRQ_EINT8 S3C2410_IRQ(40) |
71 | #define IRQ_EINT13 S3C2410_IRQ(41) | 71 | #define IRQ_EINT9 S3C2410_IRQ(41) |
72 | #define IRQ_EINT14 S3C2410_IRQ(42) | 72 | #define IRQ_EINT10 S3C2410_IRQ(42) |
73 | #define IRQ_EINT15 S3C2410_IRQ(43) | 73 | #define IRQ_EINT11 S3C2410_IRQ(43) |
74 | #define IRQ_EINT16 S3C2410_IRQ(44) | 74 | #define IRQ_EINT12 S3C2410_IRQ(44) |
75 | #define IRQ_EINT17 S3C2410_IRQ(45) | 75 | #define IRQ_EINT13 S3C2410_IRQ(45) |
76 | #define IRQ_EINT18 S3C2410_IRQ(46) | 76 | #define IRQ_EINT14 S3C2410_IRQ(46) |
77 | #define IRQ_EINT19 S3C2410_IRQ(47) | 77 | #define IRQ_EINT15 S3C2410_IRQ(47) |
78 | #define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */ | 78 | #define IRQ_EINT16 S3C2410_IRQ(48) |
79 | #define IRQ_EINT21 S3C2410_IRQ(49) | 79 | #define IRQ_EINT17 S3C2410_IRQ(49) |
80 | #define IRQ_EINT22 S3C2410_IRQ(50) | 80 | #define IRQ_EINT18 S3C2410_IRQ(50) |
81 | #define IRQ_EINT23 S3C2410_IRQ(51) | 81 | #define IRQ_EINT19 S3C2410_IRQ(51) |
82 | #define IRQ_EINT20 S3C2410_IRQ(52) /* 68 */ | ||
83 | #define IRQ_EINT21 S3C2410_IRQ(53) | ||
84 | #define IRQ_EINT22 S3C2410_IRQ(54) | ||
85 | #define IRQ_EINT23 S3C2410_IRQ(55) | ||
82 | 86 | ||
83 | #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) | 87 | #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) |
84 | #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) | 88 | #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) |
85 | 89 | ||
86 | #define IRQ_LCD_FIFO S3C2410_IRQ(52) | 90 | #define IRQ_LCD_FIFO S3C2410_IRQ(56) |
87 | #define IRQ_LCD_FRAME S3C2410_IRQ(53) | 91 | #define IRQ_LCD_FRAME S3C2410_IRQ(57) |
88 | 92 | ||
89 | /* IRQs for the interal UARTs, and ADC | 93 | /* IRQs for the interal UARTs, and ADC |
90 | * these need to be ordered in number of appearance in the | 94 | * these need to be ordered in number of appearance in the |
91 | * SUBSRC mask register | 95 | * SUBSRC mask register |
92 | */ | 96 | */ |
93 | 97 | ||
94 | #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54) | 98 | #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+58) |
95 | 99 | ||
96 | #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */ | 100 | #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 74 */ |
97 | #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) | 101 | #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) |
98 | #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) | 102 | #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) |
99 | 103 | ||
100 | #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */ | 104 | #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 77 */ |
101 | #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) | 105 | #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) |
102 | #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) | 106 | #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) |
103 | 107 | ||
104 | #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */ | 108 | #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 80 */ |
105 | #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) | 109 | #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) |
106 | #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) | 110 | #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) |
107 | 111 | ||
@@ -136,7 +140,7 @@ | |||
136 | 140 | ||
137 | /* second interrupt-register of s3c2416/s3c2450 */ | 141 | /* second interrupt-register of s3c2416/s3c2450 */ |
138 | 142 | ||
139 | #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 54 + 29) | 143 | #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 58 + 29) |
140 | #define IRQ_S3C2416_2D S3C2416_IRQ(0) | 144 | #define IRQ_S3C2416_2D S3C2416_IRQ(0) |
141 | #define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) | 145 | #define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) |
142 | #define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2) | 146 | #define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2) |
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c deleted file mode 100644 index 67d763178d3f..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2412.c +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/irq.h> | ||
39 | #include <plat/pm.h> | ||
40 | |||
41 | #include "s3c2412-power.h" | ||
42 | |||
43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
44 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | ||
45 | |||
46 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
47 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
48 | * both show the status, they both now need to be acked when the IRQs | ||
49 | * go off. | ||
50 | */ | ||
51 | |||
52 | static void | ||
53 | s3c2412_irq_mask(struct irq_data *data) | ||
54 | { | ||
55 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
56 | unsigned long mask; | ||
57 | |||
58 | mask = __raw_readl(S3C2410_INTMSK); | ||
59 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
60 | |||
61 | mask = __raw_readl(S3C2412_EINTMASK); | ||
62 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
63 | } | ||
64 | |||
65 | static inline void | ||
66 | s3c2412_irq_ack(struct irq_data *data) | ||
67 | { | ||
68 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
69 | |||
70 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
71 | __raw_writel(bitval, S3C2410_SRCPND); | ||
72 | __raw_writel(bitval, S3C2410_INTPND); | ||
73 | } | ||
74 | |||
75 | static inline void | ||
76 | s3c2412_irq_maskack(struct irq_data *data) | ||
77 | { | ||
78 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
79 | unsigned long mask; | ||
80 | |||
81 | mask = __raw_readl(S3C2410_INTMSK); | ||
82 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
83 | |||
84 | mask = __raw_readl(S3C2412_EINTMASK); | ||
85 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
86 | |||
87 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
88 | __raw_writel(bitval, S3C2410_SRCPND); | ||
89 | __raw_writel(bitval, S3C2410_INTPND); | ||
90 | } | ||
91 | |||
92 | static void | ||
93 | s3c2412_irq_unmask(struct irq_data *data) | ||
94 | { | ||
95 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
96 | unsigned long mask; | ||
97 | |||
98 | mask = __raw_readl(S3C2412_EINTMASK); | ||
99 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
100 | |||
101 | mask = __raw_readl(S3C2410_INTMSK); | ||
102 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
103 | } | ||
104 | |||
105 | static struct irq_chip s3c2412_irq_eint0t4 = { | ||
106 | .irq_ack = s3c2412_irq_ack, | ||
107 | .irq_mask = s3c2412_irq_mask, | ||
108 | .irq_unmask = s3c2412_irq_unmask, | ||
109 | .irq_set_wake = s3c_irq_wake, | ||
110 | .irq_set_type = s3c_irqext_type, | ||
111 | }; | ||
112 | |||
113 | #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) | ||
114 | |||
115 | /* CF and SDI sub interrupts */ | ||
116 | |||
117 | static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) | ||
118 | { | ||
119 | unsigned int subsrc, submsk; | ||
120 | |||
121 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
122 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
123 | |||
124 | subsrc &= ~submsk; | ||
125 | |||
126 | if (subsrc & INTBIT(IRQ_S3C2412_SDI)) | ||
127 | generic_handle_irq(IRQ_S3C2412_SDI); | ||
128 | |||
129 | if (subsrc & INTBIT(IRQ_S3C2412_CF)) | ||
130 | generic_handle_irq(IRQ_S3C2412_CF); | ||
131 | } | ||
132 | |||
133 | #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) | ||
134 | #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) | ||
135 | |||
136 | static void s3c2412_irq_cfsdi_mask(struct irq_data *data) | ||
137 | { | ||
138 | s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
139 | } | ||
140 | |||
141 | static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) | ||
142 | { | ||
143 | s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); | ||
144 | } | ||
145 | |||
146 | static void s3c2412_irq_cfsdi_ack(struct irq_data *data) | ||
147 | { | ||
148 | s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
149 | } | ||
150 | |||
151 | static struct irq_chip s3c2412_irq_cfsdi = { | ||
152 | .name = "s3c2412-cfsdi", | ||
153 | .irq_ack = s3c2412_irq_cfsdi_ack, | ||
154 | .irq_mask = s3c2412_irq_cfsdi_mask, | ||
155 | .irq_unmask = s3c2412_irq_cfsdi_unmask, | ||
156 | }; | ||
157 | |||
158 | static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state) | ||
159 | { | ||
160 | unsigned long pwrcfg; | ||
161 | |||
162 | pwrcfg = __raw_readl(S3C2412_PWRCFG); | ||
163 | if (state) | ||
164 | pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ; | ||
165 | else | ||
166 | pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ; | ||
167 | __raw_writel(pwrcfg, S3C2412_PWRCFG); | ||
168 | |||
169 | return s3c_irq_chip.irq_set_wake(data, state); | ||
170 | } | ||
171 | |||
172 | static struct irq_chip s3c2412_irq_rtc_chip; | ||
173 | |||
174 | static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | ||
175 | { | ||
176 | unsigned int irqno; | ||
177 | |||
178 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
179 | irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, | ||
180 | handle_edge_irq); | ||
181 | set_irq_flags(irqno, IRQF_VALID); | ||
182 | } | ||
183 | |||
184 | /* add demux support for CF/SDI */ | ||
185 | |||
186 | irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); | ||
187 | |||
188 | for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { | ||
189 | irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, | ||
190 | handle_level_irq); | ||
191 | set_irq_flags(irqno, IRQF_VALID); | ||
192 | } | ||
193 | |||
194 | /* change RTC IRQ's set wake method */ | ||
195 | |||
196 | s3c2412_irq_rtc_chip = s3c_irq_chip; | ||
197 | s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake; | ||
198 | |||
199 | irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct subsys_interface s3c2412_irq_interface = { | ||
205 | .name = "s3c2412_irq", | ||
206 | .subsys = &s3c2412_subsys, | ||
207 | .add_dev = s3c2412_irq_add, | ||
208 | }; | ||
209 | |||
210 | static int s3c2412_irq_init(void) | ||
211 | { | ||
212 | return subsys_interface_register(&s3c2412_irq_interface); | ||
213 | } | ||
214 | |||
215 | arch_initcall(s3c2412_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2440.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c deleted file mode 100644 index 4a18cde439cc..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2440.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/pm.h> | ||
39 | #include <plat/irq.h> | ||
40 | |||
41 | /* WDT/AC97 */ | ||
42 | |||
43 | static void s3c_irq_demux_wdtac97(unsigned int irq, | ||
44 | struct irq_desc *desc) | ||
45 | { | ||
46 | unsigned int subsrc, submsk; | ||
47 | |||
48 | /* read the current pending interrupts, and the mask | ||
49 | * for what it is available */ | ||
50 | |||
51 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
52 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
53 | |||
54 | subsrc &= ~submsk; | ||
55 | subsrc >>= 13; | ||
56 | subsrc &= 3; | ||
57 | |||
58 | if (subsrc != 0) { | ||
59 | if (subsrc & 1) { | ||
60 | generic_handle_irq(IRQ_S3C2440_WDT); | ||
61 | } | ||
62 | if (subsrc & 2) { | ||
63 | generic_handle_irq(IRQ_S3C2440_AC97); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | |||
69 | #define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
70 | |||
71 | static void | ||
72 | s3c_irq_wdtac97_mask(struct irq_data *data) | ||
73 | { | ||
74 | s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13); | ||
75 | } | ||
76 | |||
77 | static void | ||
78 | s3c_irq_wdtac97_unmask(struct irq_data *data) | ||
79 | { | ||
80 | s3c_irqsub_unmask(data->irq, INTMSK_WDT); | ||
81 | } | ||
82 | |||
83 | static void | ||
84 | s3c_irq_wdtac97_ack(struct irq_data *data) | ||
85 | { | ||
86 | s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13); | ||
87 | } | ||
88 | |||
89 | static struct irq_chip s3c_irq_wdtac97 = { | ||
90 | .irq_mask = s3c_irq_wdtac97_mask, | ||
91 | .irq_unmask = s3c_irq_wdtac97_unmask, | ||
92 | .irq_ack = s3c_irq_wdtac97_ack, | ||
93 | }; | ||
94 | |||
95 | static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif) | ||
96 | { | ||
97 | unsigned int irqno; | ||
98 | |||
99 | printk("S3C2440: IRQ Support\n"); | ||
100 | |||
101 | /* add new chained handler for wdt, ac7 */ | ||
102 | |||
103 | irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip, | ||
104 | handle_level_irq); | ||
105 | irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97); | ||
106 | |||
107 | for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) { | ||
108 | irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97, | ||
109 | handle_level_irq); | ||
110 | set_irq_flags(irqno, IRQF_VALID); | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static struct subsys_interface s3c2440_irq_interface = { | ||
117 | .name = "s3c2440_irq", | ||
118 | .subsys = &s3c2440_subsys, | ||
119 | .add_dev = s3c2440_irq_add, | ||
120 | }; | ||
121 | |||
122 | static int s3c2440_irq_init(void) | ||
123 | { | ||
124 | return subsys_interface_register(&s3c2440_irq_interface); | ||
125 | } | ||
126 | |||
127 | arch_initcall(s3c2440_irq_init); | ||
128 | |||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c244x.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c deleted file mode 100644 index 5fe8e58d3afd..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c244x.c +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/pm.h> | ||
39 | #include <plat/irq.h> | ||
40 | |||
41 | /* camera irq */ | ||
42 | |||
43 | static void s3c_irq_demux_cam(unsigned int irq, | ||
44 | struct irq_desc *desc) | ||
45 | { | ||
46 | unsigned int subsrc, submsk; | ||
47 | |||
48 | /* read the current pending interrupts, and the mask | ||
49 | * for what it is available */ | ||
50 | |||
51 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
52 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
53 | |||
54 | subsrc &= ~submsk; | ||
55 | subsrc >>= 11; | ||
56 | subsrc &= 3; | ||
57 | |||
58 | if (subsrc != 0) { | ||
59 | if (subsrc & 1) { | ||
60 | generic_handle_irq(IRQ_S3C2440_CAM_C); | ||
61 | } | ||
62 | if (subsrc & 2) { | ||
63 | generic_handle_irq(IRQ_S3C2440_CAM_P); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) | ||
69 | |||
70 | static void | ||
71 | s3c_irq_cam_mask(struct irq_data *data) | ||
72 | { | ||
73 | s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11); | ||
74 | } | ||
75 | |||
76 | static void | ||
77 | s3c_irq_cam_unmask(struct irq_data *data) | ||
78 | { | ||
79 | s3c_irqsub_unmask(data->irq, INTMSK_CAM); | ||
80 | } | ||
81 | |||
82 | static void | ||
83 | s3c_irq_cam_ack(struct irq_data *data) | ||
84 | { | ||
85 | s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11); | ||
86 | } | ||
87 | |||
88 | static struct irq_chip s3c_irq_cam = { | ||
89 | .irq_mask = s3c_irq_cam_mask, | ||
90 | .irq_unmask = s3c_irq_cam_unmask, | ||
91 | .irq_ack = s3c_irq_cam_ack, | ||
92 | }; | ||
93 | |||
94 | static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif) | ||
95 | { | ||
96 | unsigned int irqno; | ||
97 | |||
98 | irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip, | ||
99 | handle_level_irq); | ||
100 | set_irq_flags(IRQ_NFCON, IRQF_VALID); | ||
101 | |||
102 | /* add chained handler for camera */ | ||
103 | |||
104 | irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip, | ||
105 | handle_level_irq); | ||
106 | irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam); | ||
107 | |||
108 | for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) { | ||
109 | irq_set_chip_and_handler(irqno, &s3c_irq_cam, | ||
110 | handle_level_irq); | ||
111 | set_irq_flags(irqno, IRQF_VALID); | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static struct subsys_interface s3c2440_irq_interface = { | ||
118 | .name = "s3c2440_irq", | ||
119 | .subsys = &s3c2440_subsys, | ||
120 | .add_dev = s3c244x_irq_add, | ||
121 | }; | ||
122 | |||
123 | static int s3c2440_irq_init(void) | ||
124 | { | ||
125 | return subsys_interface_register(&s3c2440_irq_interface); | ||
126 | } | ||
127 | |||
128 | arch_initcall(s3c2440_irq_init); | ||
129 | |||
130 | static struct subsys_interface s3c2442_irq_interface = { | ||
131 | .name = "s3c2442_irq", | ||
132 | .subsys = &s3c2442_subsys, | ||
133 | .add_dev = s3c244x_irq_add, | ||
134 | }; | ||
135 | |||
136 | |||
137 | static int s3c2442_irq_init(void) | ||
138 | { | ||
139 | return subsys_interface_register(&s3c2442_irq_interface); | ||
140 | } | ||
141 | |||
142 | arch_initcall(s3c2442_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c index 0e0279e79150..e27b5c91b3db 100644 --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #include <linux/mtd/map.h> | 63 | #include <linux/mtd/map.h> |
64 | #include <linux/mtd/physmap.h> | 64 | #include <linux/mtd/physmap.h> |
65 | 65 | ||
66 | #include <plat/samsung-time.h> | ||
67 | |||
66 | #include "common.h" | 68 | #include "common.h" |
67 | 69 | ||
68 | static struct resource amlm5900_nor_resource = | 70 | static struct resource amlm5900_nor_resource = |
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void) | |||
160 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); | 162 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); |
161 | s3c24xx_init_clocks(0); | 163 | s3c24xx_init_clocks(0); |
162 | s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); | 164 | s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); |
165 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
163 | } | 166 | } |
164 | 167 | ||
165 | #ifdef CONFIG_FB_S3C2410 | 168 | #ifdef CONFIG_FB_S3C2410 |
@@ -235,8 +238,8 @@ static void __init amlm5900_init(void) | |||
235 | MACHINE_START(AML_M5900, "AML_M5900") | 238 | MACHINE_START(AML_M5900, "AML_M5900") |
236 | .atag_offset = 0x100, | 239 | .atag_offset = 0x100, |
237 | .map_io = amlm5900_map_io, | 240 | .map_io = amlm5900_map_io, |
238 | .init_irq = s3c24xx_init_irq, | 241 | .init_irq = s3c2410_init_irq, |
239 | .init_machine = amlm5900_init, | 242 | .init_machine = amlm5900_init, |
240 | .init_time = s3c24xx_timer_init, | 243 | .init_time = samsung_timer_init, |
241 | .restart = s3c2410_restart, | 244 | .restart = s3c2410_restart, |
242 | MACHINE_END | 245 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c index bb595f15ce36..c1fb6c37867f 100644 --- a/arch/arm/mach-s3c24xx/mach-anubis.c +++ b/arch/arm/mach-s3c24xx/mach-anubis.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
51 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 51 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "anubis.h" | 54 | #include "anubis.h" |
54 | #include "common.h" | 55 | #include "common.h" |
@@ -410,6 +411,7 @@ static void __init anubis_map_io(void) | |||
410 | s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); | 411 | s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); |
411 | s3c24xx_init_clocks(0); | 412 | s3c24xx_init_clocks(0); |
412 | s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); | 413 | s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); |
414 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
413 | 415 | ||
414 | /* check for the newer revision boards with large page nand */ | 416 | /* check for the newer revision boards with large page nand */ |
415 | 417 | ||
@@ -443,7 +445,7 @@ MACHINE_START(ANUBIS, "Simtec-Anubis") | |||
443 | .atag_offset = 0x100, | 445 | .atag_offset = 0x100, |
444 | .map_io = anubis_map_io, | 446 | .map_io = anubis_map_io, |
445 | .init_machine = anubis_init, | 447 | .init_machine = anubis_init, |
446 | .init_irq = s3c24xx_init_irq, | 448 | .init_irq = s3c2440_init_irq, |
447 | .init_time = s3c24xx_timer_init, | 449 | .init_time = samsung_timer_init, |
448 | .restart = s3c244x_restart, | 450 | .restart = s3c244x_restart, |
449 | MACHINE_END | 451 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c index b4bc60c78ebb..6dfeeb7ef469 100644 --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <plat/devs.h> | 48 | #include <plat/devs.h> |
49 | #include <plat/cpu.h> | 49 | #include <plat/cpu.h> |
50 | #include <linux/platform_data/mmc-s3cmci.h> | 50 | #include <linux/platform_data/mmc-s3cmci.h> |
51 | #include <plat/samsung-time.h> | ||
51 | 52 | ||
52 | #include "common.h" | 53 | #include "common.h" |
53 | 54 | ||
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void) | |||
192 | s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); | 193 | s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); |
193 | s3c24xx_init_clocks(16934400); | 194 | s3c24xx_init_clocks(16934400); |
194 | s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); | 195 | s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); |
196 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
195 | } | 197 | } |
196 | 198 | ||
197 | static void __init at2440evb_init(void) | 199 | static void __init at2440evb_init(void) |
@@ -209,7 +211,7 @@ MACHINE_START(AT2440EVB, "AT2440EVB") | |||
209 | .atag_offset = 0x100, | 211 | .atag_offset = 0x100, |
210 | .map_io = at2440evb_map_io, | 212 | .map_io = at2440evb_map_io, |
211 | .init_machine = at2440evb_init, | 213 | .init_machine = at2440evb_init, |
212 | .init_irq = s3c24xx_init_irq, | 214 | .init_irq = s3c2440_init_irq, |
213 | .init_time = s3c24xx_timer_init, | 215 | .init_time = samsung_timer_init, |
214 | .restart = s3c244x_restart, | 216 | .restart = s3c244x_restart, |
215 | MACHINE_END | 217 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c index ca6618081041..22d6ae926d91 100644 --- a/arch/arm/mach-s3c24xx/mach-bast.c +++ b/arch/arm/mach-s3c24xx/mach-bast.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <plat/devs.h> | 55 | #include <plat/devs.h> |
56 | #include <plat/gpio-cfg.h> | 56 | #include <plat/gpio-cfg.h> |
57 | #include <plat/regs-serial.h> | 57 | #include <plat/regs-serial.h> |
58 | #include <plat/samsung-time.h> | ||
58 | 59 | ||
59 | #include "bast.h" | 60 | #include "bast.h" |
60 | #include "common.h" | 61 | #include "common.h" |
@@ -576,6 +577,7 @@ static void __init bast_map_io(void) | |||
576 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); | 577 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); |
577 | s3c24xx_init_clocks(0); | 578 | s3c24xx_init_clocks(0); |
578 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); | 579 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); |
580 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
579 | } | 581 | } |
580 | 582 | ||
581 | static void __init bast_init(void) | 583 | static void __init bast_init(void) |
@@ -603,8 +605,8 @@ MACHINE_START(BAST, "Simtec-BAST") | |||
603 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 605 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
604 | .atag_offset = 0x100, | 606 | .atag_offset = 0x100, |
605 | .map_io = bast_map_io, | 607 | .map_io = bast_map_io, |
606 | .init_irq = s3c24xx_init_irq, | 608 | .init_irq = s3c2410_init_irq, |
607 | .init_machine = bast_init, | 609 | .init_machine = bast_init, |
608 | .init_time = s3c24xx_timer_init, | 610 | .init_time = samsung_timer_init, |
609 | .restart = s3c2410_restart, | 611 | .restart = s3c2410_restart, |
610 | MACHINE_END | 612 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c index a25e8c5a7b4c..13d8d073675a 100644 --- a/arch/arm/mach-s3c24xx/mach-gta02.c +++ b/arch/arm/mach-s3c24xx/mach-gta02.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <plat/gpio-cfg.h> | 81 | #include <plat/gpio-cfg.h> |
82 | #include <plat/pm.h> | 82 | #include <plat/pm.h> |
83 | #include <plat/regs-serial.h> | 83 | #include <plat/regs-serial.h> |
84 | #include <plat/samsung-time.h> | ||
84 | 85 | ||
85 | #include "common.h" | 86 | #include "common.h" |
86 | #include "gta02.h" | 87 | #include "gta02.h" |
@@ -501,6 +502,7 @@ static void __init gta02_map_io(void) | |||
501 | s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); | 502 | s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); |
502 | s3c24xx_init_clocks(12000000); | 503 | s3c24xx_init_clocks(12000000); |
503 | s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); | 504 | s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); |
505 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
504 | } | 506 | } |
505 | 507 | ||
506 | 508 | ||
@@ -587,8 +589,8 @@ MACHINE_START(NEO1973_GTA02, "GTA02") | |||
587 | /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ | 589 | /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ |
588 | .atag_offset = 0x100, | 590 | .atag_offset = 0x100, |
589 | .map_io = gta02_map_io, | 591 | .map_io = gta02_map_io, |
590 | .init_irq = s3c24xx_init_irq, | 592 | .init_irq = s3c2442_init_irq, |
591 | .init_machine = gta02_machine_init, | 593 | .init_machine = gta02_machine_init, |
592 | .init_time = s3c24xx_timer_init, | 594 | .init_time = samsung_timer_init, |
593 | .restart = s3c244x_restart, | 595 | .restart = s3c244x_restart, |
594 | MACHINE_END | 596 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index 79bc0830d740..af4334d6b4d5 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <plat/pll.h> | 62 | #include <plat/pll.h> |
63 | #include <plat/pm.h> | 63 | #include <plat/pm.h> |
64 | #include <plat/regs-serial.h> | 64 | #include <plat/regs-serial.h> |
65 | 65 | #include <plat/samsung-time.h> | |
66 | 66 | ||
67 | #include "common.h" | 67 | #include "common.h" |
68 | #include "h1940.h" | 68 | #include "h1940.h" |
@@ -646,6 +646,7 @@ static void __init h1940_map_io(void) | |||
646 | s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); | 646 | s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); |
647 | s3c24xx_init_clocks(0); | 647 | s3c24xx_init_clocks(0); |
648 | s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); | 648 | s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); |
649 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
649 | 650 | ||
650 | /* setup PM */ | 651 | /* setup PM */ |
651 | 652 | ||
@@ -666,11 +667,6 @@ static void __init h1940_reserve(void) | |||
666 | memblock_reserve(0x30081000, 0x1000); | 667 | memblock_reserve(0x30081000, 0x1000); |
667 | } | 668 | } |
668 | 669 | ||
669 | static void __init h1940_init_irq(void) | ||
670 | { | ||
671 | s3c24xx_init_irq(); | ||
672 | } | ||
673 | |||
674 | static void __init h1940_init(void) | 670 | static void __init h1940_init(void) |
675 | { | 671 | { |
676 | u32 tmp; | 672 | u32 tmp; |
@@ -739,8 +735,8 @@ MACHINE_START(H1940, "IPAQ-H1940") | |||
739 | .atag_offset = 0x100, | 735 | .atag_offset = 0x100, |
740 | .map_io = h1940_map_io, | 736 | .map_io = h1940_map_io, |
741 | .reserve = h1940_reserve, | 737 | .reserve = h1940_reserve, |
742 | .init_irq = h1940_init_irq, | 738 | .init_irq = s3c2410_init_irq, |
743 | .init_machine = h1940_init, | 739 | .init_machine = h1940_init, |
744 | .init_time = s3c24xx_timer_init, | 740 | .init_time = samsung_timer_init, |
745 | .restart = s3c2410_restart, | 741 | .restart = s3c2410_restart, |
746 | MACHINE_END | 742 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c index ca08d7df07f7..a45fcd8ccf79 100644 --- a/arch/arm/mach-s3c24xx/mach-jive.c +++ b/arch/arm/mach-s3c24xx/mach-jive.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <plat/cpu.h> | 52 | #include <plat/cpu.h> |
53 | #include <plat/pm.h> | 53 | #include <plat/pm.h> |
54 | #include <linux/platform_data/usb-s3c2410_udc.h> | 54 | #include <linux/platform_data/usb-s3c2410_udc.h> |
55 | #include <plat/samsung-time.h> | ||
55 | 56 | ||
56 | #include "common.h" | 57 | #include "common.h" |
57 | #include "s3c2412-power.h" | 58 | #include "s3c2412-power.h" |
@@ -506,6 +507,7 @@ static void __init jive_map_io(void) | |||
506 | s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); | 507 | s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); |
507 | s3c24xx_init_clocks(12000000); | 508 | s3c24xx_init_clocks(12000000); |
508 | s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); | 509 | s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); |
510 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
509 | } | 511 | } |
510 | 512 | ||
511 | static void jive_power_off(void) | 513 | static void jive_power_off(void) |
@@ -658,9 +660,9 @@ MACHINE_START(JIVE, "JIVE") | |||
658 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | 660 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
659 | .atag_offset = 0x100, | 661 | .atag_offset = 0x100, |
660 | 662 | ||
661 | .init_irq = s3c24xx_init_irq, | 663 | .init_irq = s3c2412_init_irq, |
662 | .map_io = jive_map_io, | 664 | .map_io = jive_map_io, |
663 | .init_machine = jive_machine_init, | 665 | .init_machine = jive_machine_init, |
664 | .init_time = s3c24xx_timer_init, | 666 | .init_time = samsung_timer_init, |
665 | .restart = s3c2412_restart, | 667 | .restart = s3c2412_restart, |
666 | MACHINE_END | 668 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c index 2865e5919f2c..a83db46320bc 100644 --- a/arch/arm/mach-s3c24xx/mach-mini2440.c +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <plat/clock.h> | 56 | #include <plat/clock.h> |
57 | #include <plat/devs.h> | 57 | #include <plat/devs.h> |
58 | #include <plat/cpu.h> | 58 | #include <plat/cpu.h> |
59 | #include <plat/samsung-time.h> | ||
59 | 60 | ||
60 | #include <sound/s3c24xx_uda134x.h> | 61 | #include <sound/s3c24xx_uda134x.h> |
61 | 62 | ||
@@ -525,6 +526,7 @@ static void __init mini2440_map_io(void) | |||
525 | s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); | 526 | s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); |
526 | s3c24xx_init_clocks(12000000); | 527 | s3c24xx_init_clocks(12000000); |
527 | s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); | 528 | s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); |
529 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
528 | } | 530 | } |
529 | 531 | ||
530 | /* | 532 | /* |
@@ -686,7 +688,7 @@ MACHINE_START(MINI2440, "MINI2440") | |||
686 | .atag_offset = 0x100, | 688 | .atag_offset = 0x100, |
687 | .map_io = mini2440_map_io, | 689 | .map_io = mini2440_map_io, |
688 | .init_machine = mini2440_init, | 690 | .init_machine = mini2440_init, |
689 | .init_irq = s3c24xx_init_irq, | 691 | .init_irq = s3c2440_init_irq, |
690 | .init_time = s3c24xx_timer_init, | 692 | .init_time = samsung_timer_init, |
691 | .restart = s3c244x_restart, | 693 | .restart = s3c244x_restart, |
692 | MACHINE_END | 694 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c index 8017c0fc1729..2cb46c37c920 100644 --- a/arch/arm/mach-s3c24xx/mach-n30.c +++ b/arch/arm/mach-s3c24xx/mach-n30.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <linux/platform_data/mmc-s3cmci.h> | 50 | #include <linux/platform_data/mmc-s3cmci.h> |
51 | #include <linux/platform_data/usb-s3c2410_udc.h> | 51 | #include <linux/platform_data/usb-s3c2410_udc.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "common.h" | 54 | #include "common.h" |
54 | 55 | ||
@@ -535,6 +536,7 @@ static void __init n30_map_io(void) | |||
535 | n30_hwinit(); | 536 | n30_hwinit(); |
536 | s3c24xx_init_clocks(0); | 537 | s3c24xx_init_clocks(0); |
537 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); | 538 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); |
539 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
538 | } | 540 | } |
539 | 541 | ||
540 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ | 542 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ |
@@ -588,9 +590,9 @@ MACHINE_START(N30, "Acer-N30") | |||
588 | Ben Dooks <ben-linux@fluff.org> | 590 | Ben Dooks <ben-linux@fluff.org> |
589 | */ | 591 | */ |
590 | .atag_offset = 0x100, | 592 | .atag_offset = 0x100, |
591 | .init_time = s3c24xx_timer_init, | 593 | .init_time = samsung_timer_init, |
592 | .init_machine = n30_init, | 594 | .init_machine = n30_init, |
593 | .init_irq = s3c24xx_init_irq, | 595 | .init_irq = s3c2410_init_irq, |
594 | .map_io = n30_map_io, | 596 | .map_io = n30_map_io, |
595 | .restart = s3c2410_restart, | 597 | .restart = s3c2410_restart, |
596 | MACHINE_END | 598 | MACHINE_END |
@@ -599,9 +601,9 @@ MACHINE_START(N35, "Acer-N35") | |||
599 | /* Maintainer: Christer Weinigel <christer@weinigel.se> | 601 | /* Maintainer: Christer Weinigel <christer@weinigel.se> |
600 | */ | 602 | */ |
601 | .atag_offset = 0x100, | 603 | .atag_offset = 0x100, |
602 | .init_time = s3c24xx_timer_init, | 604 | .init_time = samsung_timer_init, |
603 | .init_machine = n30_init, | 605 | .init_machine = n30_init, |
604 | .init_irq = s3c24xx_init_irq, | 606 | .init_irq = s3c2410_init_irq, |
605 | .map_io = n30_map_io, | 607 | .map_io = n30_map_io, |
606 | .restart = s3c2410_restart, | 608 | .restart = s3c2410_restart, |
607 | MACHINE_END | 609 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c index 144b9f80c4a5..01f4354206f9 100644 --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
45 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
46 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
47 | 48 | ||
48 | #include "common.h" | 49 | #include "common.h" |
49 | 50 | ||
@@ -135,6 +136,7 @@ static void __init nexcoder_map_io(void) | |||
135 | s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); | 136 | s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); |
136 | s3c24xx_init_clocks(0); | 137 | s3c24xx_init_clocks(0); |
137 | s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); | 138 | s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); |
139 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
138 | 140 | ||
139 | nexcoder_sensorboard_init(); | 141 | nexcoder_sensorboard_init(); |
140 | } | 142 | } |
@@ -150,7 +152,7 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | |||
150 | .atag_offset = 0x100, | 152 | .atag_offset = 0x100, |
151 | .map_io = nexcoder_map_io, | 153 | .map_io = nexcoder_map_io, |
152 | .init_machine = nexcoder_init, | 154 | .init_machine = nexcoder_init, |
153 | .init_irq = s3c24xx_init_irq, | 155 | .init_irq = s3c2440_init_irq, |
154 | .init_time = s3c24xx_timer_init, | 156 | .init_time = samsung_timer_init, |
155 | .restart = s3c244x_restart, | 157 | .restart = s3c244x_restart, |
156 | MACHINE_END | 158 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c index ae2cbdf3e3ca..58d6fbe5bf1f 100644 --- a/arch/arm/mach-s3c24xx/mach-osiris.c +++ b/arch/arm/mach-s3c24xx/mach-osiris.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
46 | #include <plat/gpio-cfg.h> | 46 | #include <plat/gpio-cfg.h> |
47 | #include <plat/regs-serial.h> | 47 | #include <plat/regs-serial.h> |
48 | #include <plat/samsung-time.h> | ||
48 | 49 | ||
49 | #include <mach/hardware.h> | 50 | #include <mach/hardware.h> |
50 | #include <mach/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
@@ -384,6 +385,7 @@ static void __init osiris_map_io(void) | |||
384 | s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); | 385 | s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); |
385 | s3c24xx_init_clocks(0); | 386 | s3c24xx_init_clocks(0); |
386 | s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); | 387 | s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); |
388 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
387 | 389 | ||
388 | /* check for the newer revision boards with large page nand */ | 390 | /* check for the newer revision boards with large page nand */ |
389 | 391 | ||
@@ -424,8 +426,8 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS") | |||
424 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 426 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
425 | .atag_offset = 0x100, | 427 | .atag_offset = 0x100, |
426 | .map_io = osiris_map_io, | 428 | .map_io = osiris_map_io, |
427 | .init_irq = s3c24xx_init_irq, | 429 | .init_irq = s3c2440_init_irq, |
428 | .init_machine = osiris_init, | 430 | .init_machine = osiris_init, |
429 | .init_time = s3c24xx_timer_init, | 431 | .init_time = samsung_timer_init, |
430 | .restart = s3c244x_restart, | 432 | .restart = s3c244x_restart, |
431 | MACHINE_END | 433 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c index deb0ace585b0..7e16b0740ec1 100644 --- a/arch/arm/mach-s3c24xx/mach-otom.c +++ b/arch/arm/mach-s3c24xx/mach-otom.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
34 | #include <plat/devs.h> | 34 | #include <plat/devs.h> |
35 | #include <plat/regs-serial.h> | 35 | #include <plat/regs-serial.h> |
36 | #include <plat/samsung-time.h> | ||
36 | 37 | ||
37 | #include "common.h" | 38 | #include "common.h" |
38 | #include "otom.h" | 39 | #include "otom.h" |
@@ -101,6 +102,7 @@ static void __init otom11_map_io(void) | |||
101 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); | 102 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); |
102 | s3c24xx_init_clocks(0); | 103 | s3c24xx_init_clocks(0); |
103 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); | 104 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); |
105 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
104 | } | 106 | } |
105 | 107 | ||
106 | static void __init otom11_init(void) | 108 | static void __init otom11_init(void) |
@@ -114,7 +116,7 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | |||
114 | .atag_offset = 0x100, | 116 | .atag_offset = 0x100, |
115 | .map_io = otom11_map_io, | 117 | .map_io = otom11_map_io, |
116 | .init_machine = otom11_init, | 118 | .init_machine = otom11_init, |
117 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
118 | .init_time = s3c24xx_timer_init, | 120 | .init_time = samsung_timer_init, |
119 | .restart = s3c2410_restart, | 121 | .restart = s3c2410_restart, |
120 | MACHINE_END | 122 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c index 84c541602661..f8feaeadb55a 100644 --- a/arch/arm/mach-s3c24xx/mach-qt2410.c +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <plat/devs.h> | 59 | #include <plat/devs.h> |
60 | #include <plat/cpu.h> | 60 | #include <plat/cpu.h> |
61 | #include <plat/pm.h> | 61 | #include <plat/pm.h> |
62 | #include <plat/samsung-time.h> | ||
62 | 63 | ||
63 | #include "common.h" | 64 | #include "common.h" |
64 | #include "common-smdk.h" | 65 | #include "common-smdk.h" |
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void) | |||
304 | s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); | 305 | s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); |
305 | s3c24xx_init_clocks(12*1000*1000); | 306 | s3c24xx_init_clocks(12*1000*1000); |
306 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | 307 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); |
308 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
307 | } | 309 | } |
308 | 310 | ||
309 | static void __init qt2410_machine_init(void) | 311 | static void __init qt2410_machine_init(void) |
@@ -341,8 +343,8 @@ static void __init qt2410_machine_init(void) | |||
341 | MACHINE_START(QT2410, "QT2410") | 343 | MACHINE_START(QT2410, "QT2410") |
342 | .atag_offset = 0x100, | 344 | .atag_offset = 0x100, |
343 | .map_io = qt2410_map_io, | 345 | .map_io = qt2410_map_io, |
344 | .init_irq = s3c24xx_init_irq, | 346 | .init_irq = s3c2410_init_irq, |
345 | .init_machine = qt2410_machine_init, | 347 | .init_machine = qt2410_machine_init, |
346 | .init_time = s3c24xx_timer_init, | 348 | .init_time = samsung_timer_init, |
347 | .restart = s3c2410_restart, | 349 | .restart = s3c2410_restart, |
348 | MACHINE_END | 350 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index 43f3ac5a1c7a..44ca018e1f96 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <plat/devs.h> | 57 | #include <plat/devs.h> |
58 | #include <plat/pm.h> | 58 | #include <plat/pm.h> |
59 | #include <plat/regs-serial.h> | 59 | #include <plat/regs-serial.h> |
60 | #include <plat/samsung-time.h> | ||
60 | 61 | ||
61 | #include "common.h" | 62 | #include "common.h" |
62 | #include "h1940.h" | 63 | #include "h1940.h" |
@@ -740,6 +741,7 @@ static void __init rx1950_map_io(void) | |||
740 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); | 741 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); |
741 | s3c24xx_init_clocks(16934000); | 742 | s3c24xx_init_clocks(16934000); |
742 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); | 743 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); |
744 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
743 | 745 | ||
744 | /* setup PM */ | 746 | /* setup PM */ |
745 | 747 | ||
@@ -810,8 +812,8 @@ MACHINE_START(RX1950, "HP iPAQ RX1950") | |||
810 | .atag_offset = 0x100, | 812 | .atag_offset = 0x100, |
811 | .map_io = rx1950_map_io, | 813 | .map_io = rx1950_map_io, |
812 | .reserve = rx1950_reserve, | 814 | .reserve = rx1950_reserve, |
813 | .init_irq = s3c24xx_init_irq, | 815 | .init_irq = s3c2442_init_irq, |
814 | .init_machine = rx1950_init_machine, | 816 | .init_machine = rx1950_init_machine, |
815 | .init_time = s3c24xx_timer_init, | 817 | .init_time = samsung_timer_init, |
816 | .restart = s3c244x_restart, | 818 | .restart = s3c244x_restart, |
817 | MACHINE_END | 819 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c index f20418a2fb1b..3bc6231d0a1f 100644 --- a/arch/arm/mach-s3c24xx/mach-rx3715.c +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/pm.h> | 50 | #include <plat/pm.h> |
51 | #include <plat/regs-serial.h> | 51 | #include <plat/regs-serial.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "common.h" | 54 | #include "common.h" |
54 | #include "h1940.h" | 55 | #include "h1940.h" |
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void) | |||
179 | s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); | 180 | s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); |
180 | s3c24xx_init_clocks(16934000); | 181 | s3c24xx_init_clocks(16934000); |
181 | s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); | 182 | s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); |
183 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
182 | } | 184 | } |
183 | 185 | ||
184 | /* H1940 and RX3715 need to reserve this for suspend */ | 186 | /* H1940 and RX3715 need to reserve this for suspend */ |
@@ -188,11 +190,6 @@ static void __init rx3715_reserve(void) | |||
188 | memblock_reserve(0x30081000, 0x1000); | 190 | memblock_reserve(0x30081000, 0x1000); |
189 | } | 191 | } |
190 | 192 | ||
191 | static void __init rx3715_init_irq(void) | ||
192 | { | ||
193 | s3c24xx_init_irq(); | ||
194 | } | ||
195 | |||
196 | static void __init rx3715_init_machine(void) | 193 | static void __init rx3715_init_machine(void) |
197 | { | 194 | { |
198 | #ifdef CONFIG_PM_H1940 | 195 | #ifdef CONFIG_PM_H1940 |
@@ -210,8 +207,8 @@ MACHINE_START(RX3715, "IPAQ-RX3715") | |||
210 | .atag_offset = 0x100, | 207 | .atag_offset = 0x100, |
211 | .map_io = rx3715_map_io, | 208 | .map_io = rx3715_map_io, |
212 | .reserve = rx3715_reserve, | 209 | .reserve = rx3715_reserve, |
213 | .init_irq = rx3715_init_irq, | 210 | .init_irq = s3c2440_init_irq, |
214 | .init_machine = rx3715_init_machine, | 211 | .init_machine = rx3715_init_machine, |
215 | .init_time = s3c24xx_timer_init, | 212 | .init_time = samsung_timer_init, |
216 | .restart = s3c244x_restart, | 213 | .restart = s3c244x_restart, |
217 | MACHINE_END | 214 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c index cd0b1635c47e..a773789e4f38 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | #include <plat/devs.h> | 52 | #include <plat/devs.h> |
53 | #include <plat/cpu.h> | 53 | #include <plat/cpu.h> |
54 | #include <plat/samsung-time.h> | ||
54 | 55 | ||
55 | #include "common.h" | 56 | #include "common.h" |
56 | #include "common-smdk.h" | 57 | #include "common-smdk.h" |
@@ -100,6 +101,7 @@ static void __init smdk2410_map_io(void) | |||
100 | s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); | 101 | s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); |
101 | s3c24xx_init_clocks(0); | 102 | s3c24xx_init_clocks(0); |
102 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | 103 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); |
104 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
103 | } | 105 | } |
104 | 106 | ||
105 | static void __init smdk2410_init(void) | 107 | static void __init smdk2410_init(void) |
@@ -114,8 +116,8 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc | |||
114 | /* Maintainer: Jonas Dietsche */ | 116 | /* Maintainer: Jonas Dietsche */ |
115 | .atag_offset = 0x100, | 117 | .atag_offset = 0x100, |
116 | .map_io = smdk2410_map_io, | 118 | .map_io = smdk2410_map_io, |
117 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
118 | .init_machine = smdk2410_init, | 120 | .init_machine = smdk2410_init, |
119 | .init_time = s3c24xx_timer_init, | 121 | .init_time = samsung_timer_init, |
120 | .restart = s3c2410_restart, | 122 | .restart = s3c2410_restart, |
121 | MACHINE_END | 123 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c index 79485907950f..8146e920f10d 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
45 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
46 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
47 | 48 | ||
48 | #include "common.h" | 49 | #include "common.h" |
49 | #include "common-smdk.h" | 50 | #include "common-smdk.h" |
@@ -105,6 +106,7 @@ static void __init smdk2413_map_io(void) | |||
105 | s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); | 106 | s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); |
106 | s3c24xx_init_clocks(12000000); | 107 | s3c24xx_init_clocks(12000000); |
107 | s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); | 108 | s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); |
109 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
108 | } | 110 | } |
109 | 111 | ||
110 | static void __init smdk2413_machine_init(void) | 112 | static void __init smdk2413_machine_init(void) |
@@ -128,10 +130,10 @@ MACHINE_START(S3C2413, "S3C2413") | |||
128 | .atag_offset = 0x100, | 130 | .atag_offset = 0x100, |
129 | 131 | ||
130 | .fixup = smdk2413_fixup, | 132 | .fixup = smdk2413_fixup, |
131 | .init_irq = s3c24xx_init_irq, | 133 | .init_irq = s3c2412_init_irq, |
132 | .map_io = smdk2413_map_io, | 134 | .map_io = smdk2413_map_io, |
133 | .init_machine = smdk2413_machine_init, | 135 | .init_machine = smdk2413_machine_init, |
134 | .init_time = s3c24xx_timer_init, | 136 | .init_time = samsung_timer_init, |
135 | .restart = s3c2412_restart, | 137 | .restart = s3c2412_restart, |
136 | MACHINE_END | 138 | MACHINE_END |
137 | 139 | ||
@@ -140,10 +142,10 @@ MACHINE_START(SMDK2412, "SMDK2412") | |||
140 | .atag_offset = 0x100, | 142 | .atag_offset = 0x100, |
141 | 143 | ||
142 | .fixup = smdk2413_fixup, | 144 | .fixup = smdk2413_fixup, |
143 | .init_irq = s3c24xx_init_irq, | 145 | .init_irq = s3c2412_init_irq, |
144 | .map_io = smdk2413_map_io, | 146 | .map_io = smdk2413_map_io, |
145 | .init_machine = smdk2413_machine_init, | 147 | .init_machine = smdk2413_machine_init, |
146 | .init_time = s3c24xx_timer_init, | 148 | .init_time = samsung_timer_init, |
147 | .restart = s3c2412_restart, | 149 | .restart = s3c2412_restart, |
148 | MACHINE_END | 150 | MACHINE_END |
149 | 151 | ||
@@ -152,9 +154,9 @@ MACHINE_START(SMDK2413, "SMDK2413") | |||
152 | .atag_offset = 0x100, | 154 | .atag_offset = 0x100, |
153 | 155 | ||
154 | .fixup = smdk2413_fixup, | 156 | .fixup = smdk2413_fixup, |
155 | .init_irq = s3c24xx_init_irq, | 157 | .init_irq = s3c2412_init_irq, |
156 | .map_io = smdk2413_map_io, | 158 | .map_io = smdk2413_map_io, |
157 | .init_machine = smdk2413_machine_init, | 159 | .init_machine = smdk2413_machine_init, |
158 | .init_time = s3c24xx_timer_init, | 160 | .init_time = samsung_timer_init, |
159 | .restart = s3c2412_restart, | 161 | .restart = s3c2412_restart, |
160 | MACHINE_END | 162 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c index 037a5da343bd..cb46847c66b4 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <plat/sdhci.h> | 50 | #include <plat/sdhci.h> |
51 | #include <linux/platform_data/usb-s3c2410_udc.h> | 51 | #include <linux/platform_data/usb-s3c2410_udc.h> |
52 | #include <linux/platform_data/s3c-hsudc.h> | 52 | #include <linux/platform_data/s3c-hsudc.h> |
53 | #include <plat/samsung-time.h> | ||
53 | 54 | ||
54 | #include <plat/fb.h> | 55 | #include <plat/fb.h> |
55 | 56 | ||
@@ -221,6 +222,7 @@ static void __init smdk2416_map_io(void) | |||
221 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); | 222 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); |
222 | s3c24xx_init_clocks(12000000); | 223 | s3c24xx_init_clocks(12000000); |
223 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); | 224 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); |
225 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
224 | } | 226 | } |
225 | 227 | ||
226 | static void __init smdk2416_machine_init(void) | 228 | static void __init smdk2416_machine_init(void) |
@@ -253,6 +255,6 @@ MACHINE_START(SMDK2416, "SMDK2416") | |||
253 | .init_irq = s3c2416_init_irq, | 255 | .init_irq = s3c2416_init_irq, |
254 | .map_io = smdk2416_map_io, | 256 | .map_io = smdk2416_map_io, |
255 | .init_machine = smdk2416_machine_init, | 257 | .init_machine = smdk2416_machine_init, |
256 | .init_time = s3c24xx_timer_init, | 258 | .init_time = samsung_timer_init, |
257 | .restart = s3c2416_restart, | 259 | .restart = s3c2416_restart, |
258 | MACHINE_END | 260 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c index 29d31314e23c..de2e5d39a847 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
42 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
43 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | #include "common-smdk.h" | 47 | #include "common-smdk.h" |
@@ -160,6 +161,7 @@ static void __init smdk2440_map_io(void) | |||
160 | s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); | 161 | s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); |
161 | s3c24xx_init_clocks(16934400); | 162 | s3c24xx_init_clocks(16934400); |
162 | s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); | 163 | s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); |
164 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
163 | } | 165 | } |
164 | 166 | ||
165 | static void __init smdk2440_machine_init(void) | 167 | static void __init smdk2440_machine_init(void) |
@@ -175,9 +177,9 @@ MACHINE_START(S3C2440, "SMDK2440") | |||
175 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | 177 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
176 | .atag_offset = 0x100, | 178 | .atag_offset = 0x100, |
177 | 179 | ||
178 | .init_irq = s3c24xx_init_irq, | 180 | .init_irq = s3c2440_init_irq, |
179 | .map_io = smdk2440_map_io, | 181 | .map_io = smdk2440_map_io, |
180 | .init_machine = smdk2440_machine_init, | 182 | .init_machine = smdk2440_machine_init, |
181 | .init_time = s3c24xx_timer_init, | 183 | .init_time = samsung_timer_init, |
182 | .restart = s3c244x_restart, | 184 | .restart = s3c244x_restart, |
183 | MACHINE_END | 185 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c index b3be4c4dc7bc..9435c3bef18a 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
42 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
43 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | #include "common-smdk.h" | 47 | #include "common-smdk.h" |
@@ -121,6 +122,7 @@ static void __init smdk2443_map_io(void) | |||
121 | s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); | 122 | s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); |
122 | s3c24xx_init_clocks(12000000); | 123 | s3c24xx_init_clocks(12000000); |
123 | s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); | 124 | s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); |
125 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
124 | } | 126 | } |
125 | 127 | ||
126 | static void __init smdk2443_machine_init(void) | 128 | static void __init smdk2443_machine_init(void) |
@@ -142,6 +144,6 @@ MACHINE_START(SMDK2443, "SMDK2443") | |||
142 | .init_irq = s3c2443_init_irq, | 144 | .init_irq = s3c2443_init_irq, |
143 | .map_io = smdk2443_map_io, | 145 | .map_io = smdk2443_map_io, |
144 | .init_machine = smdk2443_machine_init, | 146 | .init_machine = smdk2443_machine_init, |
145 | .init_time = s3c24xx_timer_init, | 147 | .init_time = samsung_timer_init, |
146 | .restart = s3c2443_restart, | 148 | .restart = s3c2443_restart, |
147 | MACHINE_END | 149 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 24b3d79e7b2c..7fad8f055cab 100644 --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/mtd/partitions.h> | 53 | #include <linux/mtd/partitions.h> |
54 | #include <linux/mtd/map.h> | 54 | #include <linux/mtd/map.h> |
55 | #include <linux/mtd/physmap.h> | 55 | #include <linux/mtd/physmap.h> |
56 | #include <plat/samsung-time.h> | ||
56 | 57 | ||
57 | #include "common.h" | 58 | #include "common.h" |
58 | 59 | ||
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void) | |||
136 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); | 137 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); |
137 | s3c24xx_init_clocks(0); | 138 | s3c24xx_init_clocks(0); |
138 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); | 139 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); |
140 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
139 | } | 141 | } |
140 | 142 | ||
141 | static void __init tct_hammer_init(void) | 143 | static void __init tct_hammer_init(void) |
@@ -147,8 +149,8 @@ static void __init tct_hammer_init(void) | |||
147 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") | 149 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") |
148 | .atag_offset = 0x100, | 150 | .atag_offset = 0x100, |
149 | .map_io = tct_hammer_map_io, | 151 | .map_io = tct_hammer_map_io, |
150 | .init_irq = s3c24xx_init_irq, | 152 | .init_irq = s3c2410_init_irq, |
151 | .init_machine = tct_hammer_init, | 153 | .init_machine = tct_hammer_init, |
152 | .init_time = s3c24xx_timer_init, | 154 | .init_time = samsung_timer_init, |
153 | .restart = s3c2410_restart, | 155 | .restart = s3c2410_restart, |
154 | MACHINE_END | 156 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c index ec42d1e4e465..42e7187fed60 100644 --- a/arch/arm/mach-s3c24xx/mach-vr1000.c +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
46 | #include <plat/devs.h> | 46 | #include <plat/devs.h> |
47 | #include <plat/regs-serial.h> | 47 | #include <plat/regs-serial.h> |
48 | #include <plat/samsung-time.h> | ||
48 | 49 | ||
49 | #include "bast.h" | 50 | #include "bast.h" |
50 | #include "common.h" | 51 | #include "common.h" |
@@ -332,6 +333,7 @@ static void __init vr1000_map_io(void) | |||
332 | s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); | 333 | s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); |
333 | s3c24xx_init_clocks(0); | 334 | s3c24xx_init_clocks(0); |
334 | s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); | 335 | s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); |
336 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
335 | } | 337 | } |
336 | 338 | ||
337 | static void __init vr1000_init(void) | 339 | static void __init vr1000_init(void) |
@@ -353,7 +355,7 @@ MACHINE_START(VR1000, "Thorcom-VR1000") | |||
353 | .atag_offset = 0x100, | 355 | .atag_offset = 0x100, |
354 | .map_io = vr1000_map_io, | 356 | .map_io = vr1000_map_io, |
355 | .init_machine = vr1000_init, | 357 | .init_machine = vr1000_init, |
356 | .init_irq = s3c24xx_init_irq, | 358 | .init_irq = s3c2410_init_irq, |
357 | .init_time = s3c24xx_timer_init, | 359 | .init_time = samsung_timer_init, |
358 | .restart = s3c2410_restart, | 360 | .restart = s3c2410_restart, |
359 | MACHINE_END | 361 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c index 239129c2d8bc..b66588428ec9 100644 --- a/arch/arm/mach-s3c24xx/mach-vstms.c +++ b/arch/arm/mach-s3c24xx/mach-vstms.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
45 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
46 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
47 | 48 | ||
48 | #include "common.h" | 49 | #include "common.h" |
49 | 50 | ||
@@ -142,6 +143,7 @@ static void __init vstms_map_io(void) | |||
142 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); | 143 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); |
143 | s3c24xx_init_clocks(12000000); | 144 | s3c24xx_init_clocks(12000000); |
144 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); | 145 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); |
146 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
145 | } | 147 | } |
146 | 148 | ||
147 | static void __init vstms_init(void) | 149 | static void __init vstms_init(void) |
@@ -156,9 +158,9 @@ MACHINE_START(VSTMS, "VSTMS") | |||
156 | .atag_offset = 0x100, | 158 | .atag_offset = 0x100, |
157 | 159 | ||
158 | .fixup = vstms_fixup, | 160 | .fixup = vstms_fixup, |
159 | .init_irq = s3c24xx_init_irq, | 161 | .init_irq = s3c2412_init_irq, |
160 | .init_machine = vstms_init, | 162 | .init_machine = vstms_init, |
161 | .map_io = vstms_map_io, | 163 | .map_io = vstms_map_io, |
162 | .init_time = s3c24xx_timer_init, | 164 | .init_time = samsung_timer_init, |
163 | .restart = s3c2412_restart, | 165 | .restart = s3c2412_restart, |
164 | MACHINE_END | 166 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c index 4c4bc1c83b77..d75f95e487ee 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2412.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <plat/cpu.h> | 30 | #include <plat/cpu.h> |
31 | #include <plat/pm.h> | 31 | #include <plat/pm.h> |
32 | #include <plat/wakeup-mask.h> | ||
32 | 33 | ||
33 | #include "regs-dsc.h" | 34 | #include "regs-dsc.h" |
34 | #include "s3c2412-power.h" | 35 | #include "s3c2412-power.h" |
@@ -51,8 +52,15 @@ static int s3c2412_cpu_suspend(unsigned long arg) | |||
51 | return 1; /* Aborting suspend */ | 52 | return 1; /* Aborting suspend */ |
52 | } | 53 | } |
53 | 54 | ||
55 | /* mapping of interrupts to parts of the wakeup mask */ | ||
56 | static struct samsung_wakeup_mask wake_irqs[] = { | ||
57 | { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, }, | ||
58 | }; | ||
59 | |||
54 | static void s3c2412_pm_prepare(void) | 60 | static void s3c2412_pm_prepare(void) |
55 | { | 61 | { |
62 | samsung_sync_wakemask(S3C2412_PWRCFG, | ||
63 | wake_irqs, ARRAY_SIZE(wake_irqs)); | ||
56 | } | 64 | } |
57 | 65 | ||
58 | static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) | 66 | static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) |
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 131c86284711..283cb77d4721 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -17,11 +17,13 @@ config PLAT_S3C64XX | |||
17 | # Configuration options for the S3C6410 CPU | 17 | # Configuration options for the S3C6410 CPU |
18 | 18 | ||
19 | config CPU_S3C6400 | 19 | config CPU_S3C6400 |
20 | select SAMSUNG_HRT | ||
20 | bool | 21 | bool |
21 | help | 22 | help |
22 | Enable S3C6400 CPU support | 23 | Enable S3C6400 CPU support |
23 | 24 | ||
24 | config CPU_S3C6410 | 25 | config CPU_S3C6410 |
26 | select SAMSUNG_HRT | ||
25 | bool | 27 | bool |
26 | help | 28 | help |
27 | Enable S3C6410 CPU support | 29 | Enable S3C6410 CPU support |
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c index 728eef3296b2..35e3f54574ef 100644 --- a/arch/arm/mach-s3c64xx/mach-anw6410.c +++ b/arch/arm/mach-s3c64xx/mach-anw6410.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
51 | #include <mach/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "common.h" | 54 | #include "common.h" |
54 | #include "regs-modem.h" | 55 | #include "regs-modem.h" |
@@ -208,6 +209,7 @@ static void __init anw6410_map_io(void) | |||
208 | s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); | 209 | s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); |
209 | s3c24xx_init_clocks(12000000); | 210 | s3c24xx_init_clocks(12000000); |
210 | s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); | 211 | s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); |
212 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
211 | 213 | ||
212 | anw6410_lcd_mode_set(); | 214 | anw6410_lcd_mode_set(); |
213 | } | 215 | } |
@@ -232,6 +234,6 @@ MACHINE_START(ANW6410, "A&W6410") | |||
232 | .map_io = anw6410_map_io, | 234 | .map_io = anw6410_map_io, |
233 | .init_machine = anw6410_machine_init, | 235 | .init_machine = anw6410_machine_init, |
234 | .init_late = s3c64xx_init_late, | 236 | .init_late = s3c64xx_init_late, |
235 | .init_time = s3c24xx_timer_init, | 237 | .init_time = samsung_timer_init, |
236 | .restart = s3c64xx_restart, | 238 | .restart = s3c64xx_restart, |
237 | MACHINE_END | 239 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index 1acf02bace57..8ad88ace795a 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <plat/adc.h> | 64 | #include <plat/adc.h> |
65 | #include <linux/platform_data/i2c-s3c2410.h> | 65 | #include <linux/platform_data/i2c-s3c2410.h> |
66 | #include <plat/pm.h> | 66 | #include <plat/pm.h> |
67 | #include <plat/samsung-time.h> | ||
67 | 68 | ||
68 | #include "common.h" | 69 | #include "common.h" |
69 | #include "crag6410.h" | 70 | #include "crag6410.h" |
@@ -744,6 +745,7 @@ static void __init crag6410_map_io(void) | |||
744 | s3c64xx_init_io(NULL, 0); | 745 | s3c64xx_init_io(NULL, 0); |
745 | s3c24xx_init_clocks(12000000); | 746 | s3c24xx_init_clocks(12000000); |
746 | s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); | 747 | s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); |
748 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
747 | 749 | ||
748 | /* LCD type and Bypass set by bootloader */ | 750 | /* LCD type and Bypass set by bootloader */ |
749 | } | 751 | } |
@@ -868,6 +870,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410") | |||
868 | .map_io = crag6410_map_io, | 870 | .map_io = crag6410_map_io, |
869 | .init_machine = crag6410_machine_init, | 871 | .init_machine = crag6410_machine_init, |
870 | .init_late = s3c64xx_init_late, | 872 | .init_late = s3c64xx_init_late, |
871 | .init_time = s3c24xx_timer_init, | 873 | .init_time = samsung_timer_init, |
872 | .restart = s3c64xx_restart, | 874 | .restart = s3c64xx_restart, |
873 | MACHINE_END | 875 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c index 7212eb9cfeb9..5b7f357d8c22 100644 --- a/arch/arm/mach-s3c64xx/mach-hmt.c +++ b/arch/arm/mach-s3c64xx/mach-hmt.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
42 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
43 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | 47 | ||
@@ -248,6 +249,7 @@ static void __init hmt_map_io(void) | |||
248 | s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); | 249 | s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); |
249 | s3c24xx_init_clocks(12000000); | 250 | s3c24xx_init_clocks(12000000); |
250 | s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); | 251 | s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); |
252 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
251 | } | 253 | } |
252 | 254 | ||
253 | static void __init hmt_machine_init(void) | 255 | static void __init hmt_machine_init(void) |
@@ -275,6 +277,6 @@ MACHINE_START(HMT, "Airgoo-HMT") | |||
275 | .map_io = hmt_map_io, | 277 | .map_io = hmt_map_io, |
276 | .init_machine = hmt_machine_init, | 278 | .init_machine = hmt_machine_init, |
277 | .init_late = s3c64xx_init_late, | 279 | .init_late = s3c64xx_init_late, |
278 | .init_time = s3c24xx_timer_init, | 280 | .init_time = samsung_timer_init, |
279 | .restart = s3c64xx_restart, | 281 | .restart = s3c64xx_restart, |
280 | MACHINE_END | 282 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c index 4b41fcdaa7b6..fc043e3ecdf8 100644 --- a/arch/arm/mach-s3c64xx/mach-mini6410.c +++ b/arch/arm/mach-s3c64xx/mach-mini6410.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include <video/platform_lcd.h> | 42 | #include <video/platform_lcd.h> |
43 | #include <video/samsung_fimd.h> | 43 | #include <video/samsung_fimd.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | #include "regs-modem.h" | 47 | #include "regs-modem.h" |
@@ -232,6 +233,7 @@ static void __init mini6410_map_io(void) | |||
232 | s3c64xx_init_io(NULL, 0); | 233 | s3c64xx_init_io(NULL, 0); |
233 | s3c24xx_init_clocks(12000000); | 234 | s3c24xx_init_clocks(12000000); |
234 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); | 235 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); |
236 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
235 | 237 | ||
236 | /* set the LCD type */ | 238 | /* set the LCD type */ |
237 | tmp = __raw_readl(S3C64XX_SPCON); | 239 | tmp = __raw_readl(S3C64XX_SPCON); |
@@ -354,6 +356,6 @@ MACHINE_START(MINI6410, "MINI6410") | |||
354 | .map_io = mini6410_map_io, | 356 | .map_io = mini6410_map_io, |
355 | .init_machine = mini6410_machine_init, | 357 | .init_machine = mini6410_machine_init, |
356 | .init_late = s3c64xx_init_late, | 358 | .init_late = s3c64xx_init_late, |
357 | .init_time = s3c24xx_timer_init, | 359 | .init_time = samsung_timer_init, |
358 | .restart = s3c64xx_restart, | 360 | .restart = s3c64xx_restart, |
359 | MACHINE_END | 361 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c index 8d3cedd995ff..7e2c3908f1f8 100644 --- a/arch/arm/mach-s3c64xx/mach-ncp.c +++ b/arch/arm/mach-s3c64xx/mach-ncp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <plat/clock.h> | 43 | #include <plat/clock.h> |
44 | #include <plat/devs.h> | 44 | #include <plat/devs.h> |
45 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
46 | #include <plat/samsung-time.h> | ||
46 | 47 | ||
47 | #include "common.h" | 48 | #include "common.h" |
48 | 49 | ||
@@ -87,6 +88,7 @@ static void __init ncp_map_io(void) | |||
87 | s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); | 88 | s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); |
88 | s3c24xx_init_clocks(12000000); | 89 | s3c24xx_init_clocks(12000000); |
89 | s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); | 90 | s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); |
91 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | static void __init ncp_machine_init(void) | 94 | static void __init ncp_machine_init(void) |
@@ -103,6 +105,6 @@ MACHINE_START(NCP, "NCP") | |||
103 | .map_io = ncp_map_io, | 105 | .map_io = ncp_map_io, |
104 | .init_machine = ncp_machine_init, | 106 | .init_machine = ncp_machine_init, |
105 | .init_late = s3c64xx_init_late, | 107 | .init_late = s3c64xx_init_late, |
106 | .init_time = s3c24xx_timer_init, | 108 | .init_time = samsung_timer_init, |
107 | .restart = s3c64xx_restart, | 109 | .restart = s3c64xx_restart, |
108 | MACHINE_END | 110 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c index fa12bd21ad82..8bed37b3d5ac 100644 --- a/arch/arm/mach-s3c64xx/mach-real6410.c +++ b/arch/arm/mach-s3c64xx/mach-real6410.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #include <video/platform_lcd.h> | 43 | #include <video/platform_lcd.h> |
44 | #include <video/samsung_fimd.h> | 44 | #include <video/samsung_fimd.h> |
45 | #include <plat/samsung-time.h> | ||
45 | 46 | ||
46 | #include "common.h" | 47 | #include "common.h" |
47 | #include "regs-modem.h" | 48 | #include "regs-modem.h" |
@@ -211,6 +212,7 @@ static void __init real6410_map_io(void) | |||
211 | s3c64xx_init_io(NULL, 0); | 212 | s3c64xx_init_io(NULL, 0); |
212 | s3c24xx_init_clocks(12000000); | 213 | s3c24xx_init_clocks(12000000); |
213 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); | 214 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); |
215 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
214 | 216 | ||
215 | /* set the LCD type */ | 217 | /* set the LCD type */ |
216 | tmp = __raw_readl(S3C64XX_SPCON); | 218 | tmp = __raw_readl(S3C64XX_SPCON); |
@@ -333,6 +335,6 @@ MACHINE_START(REAL6410, "REAL6410") | |||
333 | .map_io = real6410_map_io, | 335 | .map_io = real6410_map_io, |
334 | .init_machine = real6410_machine_init, | 336 | .init_machine = real6410_machine_init, |
335 | .init_late = s3c64xx_init_late, | 337 | .init_late = s3c64xx_init_late, |
336 | .init_time = s3c24xx_timer_init, | 338 | .init_time = samsung_timer_init, |
337 | .restart = s3c64xx_restart, | 339 | .restart = s3c64xx_restart, |
338 | MACHINE_END | 340 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index fc3e9b32e26f..58ac99041274 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/platform_data/touchscreen-s3c2410.h> | 38 | #include <linux/platform_data/touchscreen-s3c2410.h> |
39 | 39 | ||
40 | #include <video/platform_lcd.h> | 40 | #include <video/platform_lcd.h> |
41 | #include <plat/samsung-time.h> | ||
41 | 42 | ||
42 | #include "common.h" | 43 | #include "common.h" |
43 | #include "regs-modem.h" | 44 | #include "regs-modem.h" |
@@ -378,6 +379,7 @@ void __init smartq_map_io(void) | |||
378 | s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); | 379 | s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); |
379 | s3c24xx_init_clocks(12000000); | 380 | s3c24xx_init_clocks(12000000); |
380 | s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); | 381 | s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); |
382 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
381 | 383 | ||
382 | smartq_lcd_mode_set(); | 384 | smartq_lcd_mode_set(); |
383 | } | 385 | } |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c index ca2afcfce573..8aca5daf3d05 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq5.c +++ b/arch/arm/mach-s3c64xx/mach-smartq5.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <plat/devs.h> | 28 | #include <plat/devs.h> |
29 | #include <plat/fb.h> | 29 | #include <plat/fb.h> |
30 | #include <plat/gpio-cfg.h> | 30 | #include <plat/gpio-cfg.h> |
31 | #include <plat/samsung-time.h> | ||
31 | 32 | ||
32 | #include "common.h" | 33 | #include "common.h" |
33 | #include "mach-smartq.h" | 34 | #include "mach-smartq.h" |
@@ -155,6 +156,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5") | |||
155 | .map_io = smartq_map_io, | 156 | .map_io = smartq_map_io, |
156 | .init_machine = smartq5_machine_init, | 157 | .init_machine = smartq5_machine_init, |
157 | .init_late = s3c64xx_init_late, | 158 | .init_late = s3c64xx_init_late, |
158 | .init_time = s3c24xx_timer_init, | 159 | .init_time = samsung_timer_init, |
159 | .restart = s3c64xx_restart, | 160 | .restart = s3c64xx_restart, |
160 | MACHINE_END | 161 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c index 37bb0c632a5e..a052e107c0b4 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq7.c +++ b/arch/arm/mach-s3c64xx/mach-smartq7.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <plat/devs.h> | 28 | #include <plat/devs.h> |
29 | #include <plat/fb.h> | 29 | #include <plat/fb.h> |
30 | #include <plat/gpio-cfg.h> | 30 | #include <plat/gpio-cfg.h> |
31 | #include <plat/samsung-time.h> | ||
31 | 32 | ||
32 | #include "common.h" | 33 | #include "common.h" |
33 | #include "mach-smartq.h" | 34 | #include "mach-smartq.h" |
@@ -171,6 +172,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7") | |||
171 | .map_io = smartq_map_io, | 172 | .map_io = smartq_map_io, |
172 | .init_machine = smartq7_machine_init, | 173 | .init_machine = smartq7_machine_init, |
173 | .init_late = s3c64xx_init_late, | 174 | .init_late = s3c64xx_init_late, |
174 | .init_time = s3c24xx_timer_init, | 175 | .init_time = samsung_timer_init, |
175 | .restart = s3c64xx_restart, | 176 | .restart = s3c64xx_restart, |
176 | MACHINE_END | 177 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c index a392869c8342..d70c0843aea2 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6400.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <plat/devs.h> | 35 | #include <plat/devs.h> |
36 | #include <plat/cpu.h> | 36 | #include <plat/cpu.h> |
37 | #include <linux/platform_data/i2c-s3c2410.h> | 37 | #include <linux/platform_data/i2c-s3c2410.h> |
38 | #include <plat/samsung-time.h> | ||
38 | 39 | ||
39 | #include "common.h" | 40 | #include "common.h" |
40 | 41 | ||
@@ -66,6 +67,7 @@ static void __init smdk6400_map_io(void) | |||
66 | s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); | 67 | s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); |
67 | s3c24xx_init_clocks(12000000); | 68 | s3c24xx_init_clocks(12000000); |
68 | s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); | 69 | s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); |
70 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
69 | } | 71 | } |
70 | 72 | ||
71 | static struct platform_device *smdk6400_devices[] __initdata = { | 73 | static struct platform_device *smdk6400_devices[] __initdata = { |
@@ -92,6 +94,6 @@ MACHINE_START(SMDK6400, "SMDK6400") | |||
92 | .map_io = smdk6400_map_io, | 94 | .map_io = smdk6400_map_io, |
93 | .init_machine = smdk6400_machine_init, | 95 | .init_machine = smdk6400_machine_init, |
94 | .init_late = s3c64xx_init_late, | 96 | .init_late = s3c64xx_init_late, |
95 | .init_time = s3c24xx_timer_init, | 97 | .init_time = samsung_timer_init, |
96 | .restart = s3c64xx_restart, | 98 | .restart = s3c64xx_restart, |
97 | MACHINE_END | 99 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index ba7544e2d04d..bd3295a19ad7 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/platform_data/touchscreen-s3c2410.h> | 69 | #include <linux/platform_data/touchscreen-s3c2410.h> |
70 | #include <plat/keypad.h> | 70 | #include <plat/keypad.h> |
71 | #include <plat/backlight.h> | 71 | #include <plat/backlight.h> |
72 | #include <plat/samsung-time.h> | ||
72 | 73 | ||
73 | #include "common.h" | 74 | #include "common.h" |
74 | #include "regs-modem.h" | 75 | #include "regs-modem.h" |
@@ -634,6 +635,7 @@ static void __init smdk6410_map_io(void) | |||
634 | s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); | 635 | s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); |
635 | s3c24xx_init_clocks(12000000); | 636 | s3c24xx_init_clocks(12000000); |
636 | s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); | 637 | s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); |
638 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
637 | 639 | ||
638 | /* set the LCD type */ | 640 | /* set the LCD type */ |
639 | 641 | ||
@@ -702,6 +704,6 @@ MACHINE_START(SMDK6410, "SMDK6410") | |||
702 | .map_io = smdk6410_map_io, | 704 | .map_io = smdk6410_map_io, |
703 | .init_machine = smdk6410_machine_init, | 705 | .init_machine = smdk6410_machine_init, |
704 | .init_late = s3c64xx_init_late, | 706 | .init_late = s3c64xx_init_late, |
705 | .init_time = s3c24xx_timer_init, | 707 | .init_time = samsung_timer_init, |
706 | .restart = s3c64xx_restart, | 708 | .restart = s3c64xx_restart, |
707 | MACHINE_END | 709 | MACHINE_END |
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index e8742cb7ddd9..5a707bdb9ea0 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -9,16 +9,16 @@ if ARCH_S5P64X0 | |||
9 | 9 | ||
10 | config CPU_S5P6440 | 10 | config CPU_S5P6440 |
11 | bool | 11 | bool |
12 | select S5P_HRT | ||
13 | select S5P_SLEEP if PM | 12 | select S5P_SLEEP if PM |
14 | select SAMSUNG_DMADEV | 13 | select SAMSUNG_DMADEV |
14 | select SAMSUNG_HRT | ||
15 | select SAMSUNG_WAKEMASK if PM | 15 | select SAMSUNG_WAKEMASK if PM |
16 | help | 16 | help |
17 | Enable S5P6440 CPU support | 17 | Enable S5P6440 CPU support |
18 | 18 | ||
19 | config CPU_S5P6450 | 19 | config CPU_S5P6450 |
20 | bool | 20 | bool |
21 | select S5P_HRT | 21 | select SAMSUNG_HRT |
22 | select S5P_SLEEP if PM | 22 | select S5P_SLEEP if PM |
23 | select SAMSUNG_DMADEV | 23 | select SAMSUNG_DMADEV |
24 | select SAMSUNG_WAKEMASK if PM | 24 | select SAMSUNG_WAKEMASK if PM |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index e23723a5a214..73f71a698a34 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <plat/pll.h> | 48 | #include <plat/pll.h> |
49 | #include <plat/adc.h> | 49 | #include <plat/adc.h> |
50 | #include <linux/platform_data/touchscreen-s3c2410.h> | 50 | #include <linux/platform_data/touchscreen-s3c2410.h> |
51 | #include <plat/s5p-time.h> | 51 | #include <plat/samsung-time.h> |
52 | #include <plat/backlight.h> | 52 | #include <plat/backlight.h> |
53 | #include <plat/fb.h> | 53 | #include <plat/fb.h> |
54 | #include <plat/sdhci.h> | 54 | #include <plat/sdhci.h> |
@@ -229,7 +229,7 @@ static void __init smdk6440_map_io(void) | |||
229 | s5p64x0_init_io(NULL, 0); | 229 | s5p64x0_init_io(NULL, 0); |
230 | s3c24xx_init_clocks(12000000); | 230 | s3c24xx_init_clocks(12000000); |
231 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); | 231 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); |
232 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 232 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
233 | } | 233 | } |
234 | 234 | ||
235 | static void s5p6440_set_lcd_interface(void) | 235 | static void s5p6440_set_lcd_interface(void) |
@@ -273,6 +273,6 @@ MACHINE_START(SMDK6440, "SMDK6440") | |||
273 | .init_irq = s5p6440_init_irq, | 273 | .init_irq = s5p6440_init_irq, |
274 | .map_io = smdk6440_map_io, | 274 | .map_io = smdk6440_map_io, |
275 | .init_machine = smdk6440_machine_init, | 275 | .init_machine = smdk6440_machine_init, |
276 | .init_time = s5p_timer_init, | 276 | .init_time = samsung_timer_init, |
277 | .restart = s5p64x0_restart, | 277 | .restart = s5p64x0_restart, |
278 | MACHINE_END | 278 | MACHINE_END |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index ca10963a959e..18303e12019f 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <plat/pll.h> | 48 | #include <plat/pll.h> |
49 | #include <plat/adc.h> | 49 | #include <plat/adc.h> |
50 | #include <linux/platform_data/touchscreen-s3c2410.h> | 50 | #include <linux/platform_data/touchscreen-s3c2410.h> |
51 | #include <plat/s5p-time.h> | 51 | #include <plat/samsung-time.h> |
52 | #include <plat/backlight.h> | 52 | #include <plat/backlight.h> |
53 | #include <plat/fb.h> | 53 | #include <plat/fb.h> |
54 | #include <plat/sdhci.h> | 54 | #include <plat/sdhci.h> |
@@ -248,7 +248,7 @@ static void __init smdk6450_map_io(void) | |||
248 | s5p64x0_init_io(NULL, 0); | 248 | s5p64x0_init_io(NULL, 0); |
249 | s3c24xx_init_clocks(19200000); | 249 | s3c24xx_init_clocks(19200000); |
250 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); | 250 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); |
251 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 251 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
252 | } | 252 | } |
253 | 253 | ||
254 | static void s5p6450_set_lcd_interface(void) | 254 | static void s5p6450_set_lcd_interface(void) |
@@ -292,6 +292,6 @@ MACHINE_START(SMDK6450, "SMDK6450") | |||
292 | .init_irq = s5p6450_init_irq, | 292 | .init_irq = s5p6450_init_irq, |
293 | .map_io = smdk6450_map_io, | 293 | .map_io = smdk6450_map_io, |
294 | .init_machine = smdk6450_machine_init, | 294 | .init_machine = smdk6450_machine_init, |
295 | .init_time = s5p_timer_init, | 295 | .init_time = samsung_timer_init, |
296 | .restart = s5p64x0_restart, | 296 | .restart = s5p64x0_restart, |
297 | MACHINE_END | 297 | MACHINE_END |
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index 15170be97a74..2f456a4533ba 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -11,6 +11,7 @@ config CPU_S5PC100 | |||
11 | bool | 11 | bool |
12 | select S5P_EXT_INT | 12 | select S5P_EXT_INT |
13 | select SAMSUNG_DMADEV | 13 | select SAMSUNG_DMADEV |
14 | select SAMSUNG_HRT | ||
14 | help | 15 | help |
15 | Enable S5PC100 CPU support | 16 | Enable S5PC100 CPU support |
16 | 17 | ||
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c index 185a19583898..8c880f76f274 100644 --- a/arch/arm/mach-s5pc100/mach-smdkc100.c +++ b/arch/arm/mach-s5pc100/mach-smdkc100.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/platform_data/touchscreen-s3c2410.h> | 51 | #include <linux/platform_data/touchscreen-s3c2410.h> |
52 | #include <linux/platform_data/asoc-s3c.h> | 52 | #include <linux/platform_data/asoc-s3c.h> |
53 | #include <plat/backlight.h> | 53 | #include <plat/backlight.h> |
54 | #include <plat/samsung-time.h> | ||
54 | 55 | ||
55 | #include "common.h" | 56 | #include "common.h" |
56 | 57 | ||
@@ -221,6 +222,7 @@ static void __init smdkc100_map_io(void) | |||
221 | s5pc100_init_io(NULL, 0); | 222 | s5pc100_init_io(NULL, 0); |
222 | s3c24xx_init_clocks(12000000); | 223 | s3c24xx_init_clocks(12000000); |
223 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); | 224 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); |
225 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
224 | } | 226 | } |
225 | 227 | ||
226 | static void __init smdkc100_machine_init(void) | 228 | static void __init smdkc100_machine_init(void) |
@@ -255,6 +257,6 @@ MACHINE_START(SMDKC100, "SMDKC100") | |||
255 | .init_irq = s5pc100_init_irq, | 257 | .init_irq = s5pc100_init_irq, |
256 | .map_io = smdkc100_map_io, | 258 | .map_io = smdkc100_map_io, |
257 | .init_machine = smdkc100_machine_init, | 259 | .init_machine = smdkc100_machine_init, |
258 | .init_time = s3c24xx_timer_init, | 260 | .init_time = samsung_timer_init, |
259 | .restart = s5pc100_restart, | 261 | .restart = s5pc100_restart, |
260 | MACHINE_END | 262 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 92ad72f0ef98..0963283a7c5d 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig | |||
@@ -12,10 +12,10 @@ if ARCH_S5PV210 | |||
12 | config CPU_S5PV210 | 12 | config CPU_S5PV210 |
13 | bool | 13 | bool |
14 | select S5P_EXT_INT | 14 | select S5P_EXT_INT |
15 | select S5P_HRT | ||
16 | select S5P_PM if PM | 15 | select S5P_PM if PM |
17 | select S5P_SLEEP if PM | 16 | select S5P_SLEEP if PM |
18 | select SAMSUNG_DMADEV | 17 | select SAMSUNG_DMADEV |
18 | select SAMSUNG_HRT | ||
19 | help | 19 | help |
20 | Enable S5PV210 CPU support | 20 | Enable S5PV210 CPU support |
21 | 21 | ||
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 11900a8e88a3..ed2b85485b9d 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <plat/fb.h> | 38 | #include <plat/fb.h> |
39 | #include <plat/fimc-core.h> | 39 | #include <plat/fimc-core.h> |
40 | #include <plat/sdhci.h> | 40 | #include <plat/sdhci.h> |
41 | #include <plat/s5p-time.h> | 41 | #include <plat/samsung-time.h> |
42 | 42 | ||
43 | #include "common.h" | 43 | #include "common.h" |
44 | 44 | ||
@@ -651,7 +651,7 @@ static void __init aquila_map_io(void) | |||
651 | s5pv210_init_io(NULL, 0); | 651 | s5pv210_init_io(NULL, 0); |
652 | s3c24xx_init_clocks(24000000); | 652 | s3c24xx_init_clocks(24000000); |
653 | s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); | 653 | s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); |
654 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 654 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
655 | } | 655 | } |
656 | 656 | ||
657 | static void __init aquila_machine_init(void) | 657 | static void __init aquila_machine_init(void) |
@@ -686,6 +686,6 @@ MACHINE_START(AQUILA, "Aquila") | |||
686 | .init_irq = s5pv210_init_irq, | 686 | .init_irq = s5pv210_init_irq, |
687 | .map_io = aquila_map_io, | 687 | .map_io = aquila_map_io, |
688 | .init_machine = aquila_machine_init, | 688 | .init_machine = aquila_machine_init, |
689 | .init_time = s5p_timer_init, | 689 | .init_time = samsung_timer_init, |
690 | .restart = s5pv210_restart, | 690 | .restart = s5pv210_restart, |
691 | MACHINE_END | 691 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index e373de44a8b6..30b24ad84f49 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <plat/keypad.h> | 47 | #include <plat/keypad.h> |
48 | #include <plat/sdhci.h> | 48 | #include <plat/sdhci.h> |
49 | #include <plat/clock.h> | 49 | #include <plat/clock.h> |
50 | #include <plat/s5p-time.h> | 50 | #include <plat/samsung-time.h> |
51 | #include <plat/mfc.h> | 51 | #include <plat/mfc.h> |
52 | #include <plat/camport.h> | 52 | #include <plat/camport.h> |
53 | 53 | ||
@@ -908,7 +908,7 @@ static void __init goni_map_io(void) | |||
908 | s5pv210_init_io(NULL, 0); | 908 | s5pv210_init_io(NULL, 0); |
909 | s3c24xx_init_clocks(clk_xusbxti.rate); | 909 | s3c24xx_init_clocks(clk_xusbxti.rate); |
910 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); | 910 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); |
911 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 911 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
912 | } | 912 | } |
913 | 913 | ||
914 | static void __init goni_reserve(void) | 914 | static void __init goni_reserve(void) |
@@ -973,7 +973,7 @@ MACHINE_START(GONI, "GONI") | |||
973 | .init_irq = s5pv210_init_irq, | 973 | .init_irq = s5pv210_init_irq, |
974 | .map_io = goni_map_io, | 974 | .map_io = goni_map_io, |
975 | .init_machine = goni_machine_init, | 975 | .init_machine = goni_machine_init, |
976 | .init_time = s5p_timer_init, | 976 | .init_time = samsung_timer_init, |
977 | .reserve = &goni_reserve, | 977 | .reserve = &goni_reserve, |
978 | .restart = s5pv210_restart, | 978 | .restart = s5pv210_restart, |
979 | MACHINE_END | 979 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c index 28bd0248a3e2..7c0ed07a78a3 100644 --- a/arch/arm/mach-s5pv210/mach-smdkc110.c +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/platform_data/ata-samsung_cf.h> | 29 | #include <linux/platform_data/ata-samsung_cf.h> |
30 | #include <linux/platform_data/i2c-s3c2410.h> | 30 | #include <linux/platform_data/i2c-s3c2410.h> |
31 | #include <plat/pm.h> | 31 | #include <plat/pm.h> |
32 | #include <plat/s5p-time.h> | 32 | #include <plat/samsung-time.h> |
33 | #include <plat/mfc.h> | 33 | #include <plat/mfc.h> |
34 | 34 | ||
35 | #include "common.h" | 35 | #include "common.h" |
@@ -120,7 +120,7 @@ static void __init smdkc110_map_io(void) | |||
120 | s5pv210_init_io(NULL, 0); | 120 | s5pv210_init_io(NULL, 0); |
121 | s3c24xx_init_clocks(24000000); | 121 | s3c24xx_init_clocks(24000000); |
122 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); | 122 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); |
123 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 123 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void __init smdkc110_reserve(void) | 126 | static void __init smdkc110_reserve(void) |
@@ -153,7 +153,7 @@ MACHINE_START(SMDKC110, "SMDKC110") | |||
153 | .init_irq = s5pv210_init_irq, | 153 | .init_irq = s5pv210_init_irq, |
154 | .map_io = smdkc110_map_io, | 154 | .map_io = smdkc110_map_io, |
155 | .init_machine = smdkc110_machine_init, | 155 | .init_machine = smdkc110_machine_init, |
156 | .init_time = s5p_timer_init, | 156 | .init_time = samsung_timer_init, |
157 | .restart = s5pv210_restart, | 157 | .restart = s5pv210_restart, |
158 | .reserve = &smdkc110_reserve, | 158 | .reserve = &smdkc110_reserve, |
159 | MACHINE_END | 159 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index 3c73f36869bb..d50b6f124465 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <plat/keypad.h> | 44 | #include <plat/keypad.h> |
45 | #include <plat/pm.h> | 45 | #include <plat/pm.h> |
46 | #include <plat/fb.h> | 46 | #include <plat/fb.h> |
47 | #include <plat/s5p-time.h> | 47 | #include <plat/samsung-time.h> |
48 | #include <plat/backlight.h> | 48 | #include <plat/backlight.h> |
49 | #include <plat/mfc.h> | 49 | #include <plat/mfc.h> |
50 | #include <plat/clock.h> | 50 | #include <plat/clock.h> |
@@ -285,7 +285,7 @@ static void __init smdkv210_map_io(void) | |||
285 | s5pv210_init_io(NULL, 0); | 285 | s5pv210_init_io(NULL, 0); |
286 | s3c24xx_init_clocks(clk_xusbxti.rate); | 286 | s3c24xx_init_clocks(clk_xusbxti.rate); |
287 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); | 287 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); |
288 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | 288 | samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void __init smdkv210_reserve(void) | 291 | static void __init smdkv210_reserve(void) |
@@ -329,7 +329,7 @@ MACHINE_START(SMDKV210, "SMDKV210") | |||
329 | .init_irq = s5pv210_init_irq, | 329 | .init_irq = s5pv210_init_irq, |
330 | .map_io = smdkv210_map_io, | 330 | .map_io = smdkv210_map_io, |
331 | .init_machine = smdkv210_machine_init, | 331 | .init_machine = smdkv210_machine_init, |
332 | .init_time = s5p_timer_init, | 332 | .init_time = samsung_timer_init, |
333 | .restart = s5pv210_restart, | 333 | .restart = s5pv210_restart, |
334 | .reserve = &smdkv210_reserve, | 334 | .reserve = &smdkv210_reserve, |
335 | MACHINE_END | 335 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c index 2d4c5531819c..579afe89842a 100644 --- a/arch/arm/mach-s5pv210/mach-torbreck.c +++ b/arch/arm/mach-s5pv210/mach-torbreck.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <plat/devs.h> | 26 | #include <plat/devs.h> |
27 | #include <plat/cpu.h> | 27 | #include <plat/cpu.h> |
28 | #include <linux/platform_data/i2c-s3c2410.h> | 28 | #include <linux/platform_data/i2c-s3c2410.h> |
29 | #include <plat/s5p-time.h> | 29 | #include <plat/samsung-time.h> |
30 | 30 | ||
31 | #include "common.h" | 31 | #include "common.h" |
32 | 32 | ||
@@ -106,7 +106,7 @@ static void __init torbreck_map_io(void) | |||
106 | s5pv210_init_io(NULL, 0); | 106 | s5pv210_init_io(NULL, 0); |
107 | s3c24xx_init_clocks(24000000); | 107 | s3c24xx_init_clocks(24000000); |
108 | s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); | 108 | s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); |
109 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 109 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void __init torbreck_machine_init(void) | 112 | static void __init torbreck_machine_init(void) |
@@ -130,6 +130,6 @@ MACHINE_START(TORBRECK, "TORBRECK") | |||
130 | .init_irq = s5pv210_init_irq, | 130 | .init_irq = s5pv210_init_irq, |
131 | .map_io = torbreck_map_io, | 131 | .map_io = torbreck_map_io, |
132 | .init_machine = torbreck_machine_init, | 132 | .init_machine = torbreck_machine_init, |
133 | .init_time = s5p_timer_init, | 133 | .init_time = samsung_timer_init, |
134 | .restart = s5pv210_restart, | 134 | .restart = s5pv210_restart, |
135 | MACHINE_END | 135 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 9255546e7bf6..75d413c004b6 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -16,6 +16,7 @@ config ARCH_SH73A0 | |||
16 | select CPU_V7 | 16 | select CPU_V7 |
17 | select I2C | 17 | select I2C |
18 | select SH_CLK_CPG | 18 | select SH_CLK_CPG |
19 | select RENESAS_INTC_IRQPIN | ||
19 | 20 | ||
20 | config ARCH_R8A7740 | 21 | config ARCH_R8A7740 |
21 | bool "R-Mobile A1 (R8A77400)" | 22 | bool "R-Mobile A1 (R8A77400)" |
@@ -31,6 +32,7 @@ config ARCH_R8A7779 | |||
31 | select SH_CLK_CPG | 32 | select SH_CLK_CPG |
32 | select USB_ARCH_HAS_EHCI | 33 | select USB_ARCH_HAS_EHCI |
33 | select USB_ARCH_HAS_OHCI | 34 | select USB_ARCH_HAS_OHCI |
35 | select RENESAS_INTC_IRQPIN | ||
34 | 36 | ||
35 | config ARCH_EMEV2 | 37 | config ARCH_EMEV2 |
36 | bool "Emma Mobile EV2" | 38 | bool "Emma Mobile EV2" |
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index a385f570bbfc..95fe396f9604 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -81,7 +81,7 @@ static struct resource smsc9221_resources[] = { | |||
81 | .flags = IORESOURCE_MEM, | 81 | .flags = IORESOURCE_MEM, |
82 | }, | 82 | }, |
83 | [1] = { | 83 | [1] = { |
84 | .start = intcs_evt2irq(0x260), /* IRQ3 */ | 84 | .start = irq_pin(3), /* IRQ3 */ |
85 | .flags = IORESOURCE_IRQ, | 85 | .flags = IORESOURCE_IRQ, |
86 | }, | 86 | }, |
87 | }; | 87 | }; |
@@ -115,7 +115,7 @@ static struct resource usb_resources[] = { | |||
115 | .flags = IORESOURCE_MEM, | 115 | .flags = IORESOURCE_MEM, |
116 | }, | 116 | }, |
117 | [1] = { | 117 | [1] = { |
118 | .start = intcs_evt2irq(0x220), /* IRQ1 */ | 118 | .start = irq_pin(1), /* IRQ1 */ |
119 | .flags = IORESOURCE_IRQ, | 119 | .flags = IORESOURCE_IRQ, |
120 | }, | 120 | }, |
121 | }; | 121 | }; |
@@ -138,7 +138,7 @@ struct usbhs_private { | |||
138 | struct renesas_usbhs_platform_info info; | 138 | struct renesas_usbhs_platform_info info; |
139 | }; | 139 | }; |
140 | 140 | ||
141 | #define IRQ15 intcs_evt2irq(0x03e0) | 141 | #define IRQ15 irq_pin(15) |
142 | #define USB_PHY_MODE (1 << 4) | 142 | #define USB_PHY_MODE (1 << 4) |
143 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) | 143 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) |
144 | #define USB_PHY_ON (1 << 1) | 144 | #define USB_PHY_ON (1 << 1) |
@@ -567,25 +567,25 @@ static struct i2c_board_info i2c0_devices[] = { | |||
567 | }, | 567 | }, |
568 | { | 568 | { |
569 | I2C_BOARD_INFO("ak8975", 0x0c), | 569 | I2C_BOARD_INFO("ak8975", 0x0c), |
570 | .irq = intcs_evt2irq(0x3380), /* IRQ28 */ | 570 | .irq = irq_pin(28), /* IRQ28 */ |
571 | }, | 571 | }, |
572 | { | 572 | { |
573 | I2C_BOARD_INFO("adxl34x", 0x1d), | 573 | I2C_BOARD_INFO("adxl34x", 0x1d), |
574 | .irq = intcs_evt2irq(0x3340), /* IRQ26 */ | 574 | .irq = irq_pin(26), /* IRQ26 */ |
575 | }, | 575 | }, |
576 | }; | 576 | }; |
577 | 577 | ||
578 | static struct i2c_board_info i2c1_devices[] = { | 578 | static struct i2c_board_info i2c1_devices[] = { |
579 | { | 579 | { |
580 | I2C_BOARD_INFO("st1232-ts", 0x55), | 580 | I2C_BOARD_INFO("st1232-ts", 0x55), |
581 | .irq = intcs_evt2irq(0x300), /* IRQ8 */ | 581 | .irq = irq_pin(8), /* IRQ8 */ |
582 | }, | 582 | }, |
583 | }; | 583 | }; |
584 | 584 | ||
585 | static struct i2c_board_info i2c3_devices[] = { | 585 | static struct i2c_board_info i2c3_devices[] = { |
586 | { | 586 | { |
587 | I2C_BOARD_INFO("pcf8575", 0x20), | 587 | I2C_BOARD_INFO("pcf8575", 0x20), |
588 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ | 588 | .irq = irq_pin(19), /* IRQ19 */ |
589 | .platform_data = &pcf8575_pdata, | 589 | .platform_data = &pcf8575_pdata, |
590 | }, | 590 | }, |
591 | }; | 591 | }; |
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 62c04c252418..1fef737a4c1a 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -58,6 +58,7 @@ extern void r8a7740_pm_init(void); | |||
58 | 58 | ||
59 | extern void r8a7779_init_delay(void); | 59 | extern void r8a7779_init_delay(void); |
60 | extern void r8a7779_init_irq(void); | 60 | extern void r8a7779_init_irq(void); |
61 | extern void r8a7779_init_irq_extpin(int irlm); | ||
61 | extern void r8a7779_init_irq_dt(void); | 62 | extern void r8a7779_init_irq_dt(void); |
62 | extern void r8a7779_map_io(void); | 63 | extern void r8a7779_map_io(void); |
63 | extern void r8a7779_earlytimer_init(void); | 64 | extern void r8a7779_earlytimer_init(void); |
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h index 992ed213cec1..b2074e2acb15 100644 --- a/arch/arm/mach-shmobile/include/mach/irqs.h +++ b/arch/arm/mach-shmobile/include/mach/irqs.h | |||
@@ -12,4 +12,8 @@ | |||
12 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) | 12 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) |
13 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) | 13 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) |
14 | 14 | ||
15 | /* External IRQ pins */ | ||
16 | #define IRQPIN_BASE 2000 | ||
17 | #define irq_pin(nr) ((nr) + IRQPIN_BASE) | ||
18 | |||
15 | #endif /* __ASM_MACH_IRQS_H */ | 19 | #endif /* __ASM_MACH_IRQS_H */ |
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c index f9cc4bc9c798..b86dc8908724 100644 --- a/arch/arm/mach-shmobile/intc-r8a7779.c +++ b/arch/arm/mach-shmobile/intc-r8a7779.c | |||
@@ -19,13 +19,16 @@ | |||
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/platform_device.h> | ||
22 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
25 | #include <linux/irqchip/arm-gic.h> | 26 | #include <linux/irqchip/arm-gic.h> |
26 | #include <mach/common.h> | 27 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> |
27 | #include <linux/irqchip.h> | 28 | #include <linux/irqchip.h> |
29 | #include <mach/common.h> | ||
28 | #include <mach/intc.h> | 30 | #include <mach/intc.h> |
31 | #include <mach/irqs.h> | ||
29 | #include <mach/r8a7779.h> | 32 | #include <mach/r8a7779.h> |
30 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
31 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
@@ -39,6 +42,54 @@ | |||
39 | #define INT2NTSR0 IOMEM(0xfe700060) | 42 | #define INT2NTSR0 IOMEM(0xfe700060) |
40 | #define INT2NTSR1 IOMEM(0xfe700064) | 43 | #define INT2NTSR1 IOMEM(0xfe700064) |
41 | 44 | ||
45 | static struct renesas_intc_irqpin_config irqpin0_platform_data = { | ||
46 | .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ | ||
47 | .sense_bitfield_width = 2, | ||
48 | }; | ||
49 | |||
50 | static struct resource irqpin0_resources[] = { | ||
51 | DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */ | ||
52 | DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */ | ||
53 | DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */ | ||
54 | DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */ | ||
55 | DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */ | ||
56 | DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */ | ||
57 | DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */ | ||
58 | DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */ | ||
59 | DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */ | ||
60 | }; | ||
61 | |||
62 | static struct platform_device irqpin0_device = { | ||
63 | .name = "renesas_intc_irqpin", | ||
64 | .id = 0, | ||
65 | .resource = irqpin0_resources, | ||
66 | .num_resources = ARRAY_SIZE(irqpin0_resources), | ||
67 | .dev = { | ||
68 | .platform_data = &irqpin0_platform_data, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | void __init r8a7779_init_irq_extpin(int irlm) | ||
73 | { | ||
74 | void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); | ||
75 | unsigned long tmp; | ||
76 | |||
77 | if (icr0) { | ||
78 | tmp = ioread32(icr0); | ||
79 | if (irlm) | ||
80 | tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */ | ||
81 | else | ||
82 | tmp &= ~(1 << 23); /* IRL mode - not supported */ | ||
83 | tmp |= (1 << 21); /* LVLMODE = 1 */ | ||
84 | iowrite32(tmp, icr0); | ||
85 | iounmap(icr0); | ||
86 | |||
87 | if (irlm) | ||
88 | platform_device_register(&irqpin0_device); | ||
89 | } else | ||
90 | pr_warn("r8a7779: unable to setup external irq pin mode\n"); | ||
91 | } | ||
92 | |||
42 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) | 93 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) |
43 | { | 94 | { |
44 | return 0; /* always allow wakeup */ | 95 | return 0; /* always allow wakeup */ |
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c index a81a1d804e2e..19a26f4579b3 100644 --- a/arch/arm/mach-shmobile/intc-sh73a0.c +++ b/arch/arm/mach-shmobile/intc-sh73a0.c | |||
@@ -260,108 +260,6 @@ static int sh73a0_set_wake(struct irq_data *data, unsigned int on) | |||
260 | return 0; /* always allow wakeup */ | 260 | return 0; /* always allow wakeup */ |
261 | } | 261 | } |
262 | 262 | ||
263 | #define RELOC_BASE 0x1200 | ||
264 | |||
265 | /* INTCA IRQ pins at INTCS + RELOC_BASE to make space for GIC+INTC handling */ | ||
266 | #define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE) | ||
267 | |||
268 | INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, | ||
269 | INTCS_VECT_RELOC, "sh73a0-intca-irq-pins"); | ||
270 | |||
271 | static int to_gic_irq(struct irq_data *data) | ||
272 | { | ||
273 | unsigned int vect = irq2evt(data->irq) - INTCS_VECT_BASE; | ||
274 | |||
275 | if (vect >= 0x3200) | ||
276 | vect -= 0x3000; | ||
277 | else | ||
278 | vect -= 0x0200; | ||
279 | |||
280 | return gic_spi((vect >> 5) + 1); | ||
281 | } | ||
282 | |||
283 | static int to_intca_reloc_irq(struct irq_data *data) | ||
284 | { | ||
285 | return data->irq + (RELOC_BASE >> 5); | ||
286 | } | ||
287 | |||
288 | #define irq_cb(cb, irq) irq_get_chip(irq)->cb(irq_get_irq_data(irq)) | ||
289 | #define irq_cbp(cb, irq, p...) irq_get_chip(irq)->cb(irq_get_irq_data(irq), p) | ||
290 | |||
291 | static void intca_gic_enable(struct irq_data *data) | ||
292 | { | ||
293 | irq_cb(irq_unmask, to_intca_reloc_irq(data)); | ||
294 | irq_cb(irq_unmask, to_gic_irq(data)); | ||
295 | } | ||
296 | |||
297 | static void intca_gic_disable(struct irq_data *data) | ||
298 | { | ||
299 | irq_cb(irq_mask, to_gic_irq(data)); | ||
300 | irq_cb(irq_mask, to_intca_reloc_irq(data)); | ||
301 | } | ||
302 | |||
303 | static void intca_gic_mask_ack(struct irq_data *data) | ||
304 | { | ||
305 | irq_cb(irq_mask, to_gic_irq(data)); | ||
306 | irq_cb(irq_mask_ack, to_intca_reloc_irq(data)); | ||
307 | } | ||
308 | |||
309 | static void intca_gic_eoi(struct irq_data *data) | ||
310 | { | ||
311 | irq_cb(irq_eoi, to_gic_irq(data)); | ||
312 | } | ||
313 | |||
314 | static int intca_gic_set_type(struct irq_data *data, unsigned int type) | ||
315 | { | ||
316 | return irq_cbp(irq_set_type, to_intca_reloc_irq(data), type); | ||
317 | } | ||
318 | |||
319 | #ifdef CONFIG_SMP | ||
320 | static int intca_gic_set_affinity(struct irq_data *data, | ||
321 | const struct cpumask *cpumask, | ||
322 | bool force) | ||
323 | { | ||
324 | return irq_cbp(irq_set_affinity, to_gic_irq(data), cpumask, force); | ||
325 | } | ||
326 | #endif | ||
327 | |||
328 | struct irq_chip intca_gic_irq_chip = { | ||
329 | .name = "INTCA-GIC", | ||
330 | .irq_mask = intca_gic_disable, | ||
331 | .irq_unmask = intca_gic_enable, | ||
332 | .irq_mask_ack = intca_gic_mask_ack, | ||
333 | .irq_eoi = intca_gic_eoi, | ||
334 | .irq_enable = intca_gic_enable, | ||
335 | .irq_disable = intca_gic_disable, | ||
336 | .irq_shutdown = intca_gic_disable, | ||
337 | .irq_set_type = intca_gic_set_type, | ||
338 | .irq_set_wake = sh73a0_set_wake, | ||
339 | #ifdef CONFIG_SMP | ||
340 | .irq_set_affinity = intca_gic_set_affinity, | ||
341 | #endif | ||
342 | }; | ||
343 | |||
344 | static int to_intc_vect(int irq) | ||
345 | { | ||
346 | unsigned int irq_pin = irq - gic_spi(1); | ||
347 | unsigned int offs; | ||
348 | |||
349 | if (irq_pin < 16) | ||
350 | offs = 0x0200; | ||
351 | else | ||
352 | offs = 0x3000; | ||
353 | |||
354 | return offs + (irq_pin << 5); | ||
355 | } | ||
356 | |||
357 | static irqreturn_t sh73a0_irq_pin_demux(int irq, void *dev_id) | ||
358 | { | ||
359 | generic_handle_irq(intcs_evt2irq(to_intc_vect(irq))); | ||
360 | return IRQ_HANDLED; | ||
361 | } | ||
362 | |||
363 | static struct irqaction sh73a0_irq_pin_cascade[32]; | ||
364 | |||
365 | #define PINTER0_PHYS 0xe69000a0 | 263 | #define PINTER0_PHYS 0xe69000a0 |
366 | #define PINTER1_PHYS 0xe69000a4 | 264 | #define PINTER1_PHYS 0xe69000a4 |
367 | #define PINTER0_VIRT IOMEM(0xe69000a0) | 265 | #define PINTER0_VIRT IOMEM(0xe69000a0) |
@@ -422,13 +320,11 @@ void __init sh73a0_init_irq(void) | |||
422 | void __iomem *gic_dist_base = IOMEM(0xf0001000); | 320 | void __iomem *gic_dist_base = IOMEM(0xf0001000); |
423 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); | 321 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); |
424 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); | 322 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); |
425 | int k, n; | ||
426 | 323 | ||
427 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | 324 | gic_init(0, 29, gic_dist_base, gic_cpu_base); |
428 | gic_arch_extn.irq_set_wake = sh73a0_set_wake; | 325 | gic_arch_extn.irq_set_wake = sh73a0_set_wake; |
429 | 326 | ||
430 | register_intc_controller(&intcs_desc); | 327 | register_intc_controller(&intcs_desc); |
431 | register_intc_controller(&intca_irq_pins_desc); | ||
432 | register_intc_controller(&intc_pint0_desc); | 328 | register_intc_controller(&intc_pint0_desc); |
433 | register_intc_controller(&intc_pint1_desc); | 329 | register_intc_controller(&intc_pint1_desc); |
434 | 330 | ||
@@ -438,19 +334,6 @@ void __init sh73a0_init_irq(void) | |||
438 | sh73a0_intcs_cascade.dev_id = intevtsa; | 334 | sh73a0_intcs_cascade.dev_id = intevtsa; |
439 | setup_irq(gic_spi(50), &sh73a0_intcs_cascade); | 335 | setup_irq(gic_spi(50), &sh73a0_intcs_cascade); |
440 | 336 | ||
441 | /* IRQ pins require special handling through INTCA and GIC */ | ||
442 | for (k = 0; k < 32; k++) { | ||
443 | sh73a0_irq_pin_cascade[k].name = "INTCA-GIC cascade"; | ||
444 | sh73a0_irq_pin_cascade[k].handler = sh73a0_irq_pin_demux; | ||
445 | setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]); | ||
446 | |||
447 | n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k))); | ||
448 | WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n); | ||
449 | irq_set_chip_and_handler_name(n, &intca_gic_irq_chip, | ||
450 | handle_level_irq, "level"); | ||
451 | set_irq_flags(n, IRQF_VALID); /* yuck */ | ||
452 | } | ||
453 | |||
454 | /* PINT pins are sanely tied to the GIC as SPI */ | 337 | /* PINT pins are sanely tied to the GIC as SPI */ |
455 | sh73a0_pint0_cascade.name = "PINT0 cascade"; | 338 | sh73a0_pint0_cascade.name = "PINT0 cascade"; |
456 | sh73a0_pint0_cascade.handler = sh73a0_pint0_demux; | 339 | sh73a0_pint0_cascade.handler = sh73a0_pint0_demux; |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 2257a915746d..e8cd93a5c550 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/sh_intc.h> | 33 | #include <linux/sh_intc.h> |
34 | #include <linux/sh_timer.h> | 34 | #include <linux/sh_timer.h> |
35 | #include <linux/platform_data/sh_ipmmu.h> | 35 | #include <linux/platform_data/sh_ipmmu.h> |
36 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | ||
36 | #include <mach/dma-register.h> | 37 | #include <mach/dma-register.h> |
37 | #include <mach/hardware.h> | 38 | #include <mach/hardware.h> |
38 | #include <mach/irqs.h> | 39 | #include <mach/irqs.h> |
@@ -811,6 +812,127 @@ static struct platform_device ipmmu_device = { | |||
811 | .num_resources = ARRAY_SIZE(ipmmu_resources), | 812 | .num_resources = ARRAY_SIZE(ipmmu_resources), |
812 | }; | 813 | }; |
813 | 814 | ||
815 | static struct renesas_intc_irqpin_config irqpin0_platform_data = { | ||
816 | .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */ | ||
817 | }; | ||
818 | |||
819 | static struct resource irqpin0_resources[] = { | ||
820 | DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */ | ||
821 | DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */ | ||
822 | DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */ | ||
823 | DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */ | ||
824 | DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */ | ||
825 | DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */ | ||
826 | DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */ | ||
827 | DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */ | ||
828 | DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */ | ||
829 | DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */ | ||
830 | DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */ | ||
831 | DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */ | ||
832 | DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */ | ||
833 | }; | ||
834 | |||
835 | static struct platform_device irqpin0_device = { | ||
836 | .name = "renesas_intc_irqpin", | ||
837 | .id = 0, | ||
838 | .resource = irqpin0_resources, | ||
839 | .num_resources = ARRAY_SIZE(irqpin0_resources), | ||
840 | .dev = { | ||
841 | .platform_data = &irqpin0_platform_data, | ||
842 | }, | ||
843 | }; | ||
844 | |||
845 | static struct renesas_intc_irqpin_config irqpin1_platform_data = { | ||
846 | .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */ | ||
847 | .control_parent = true, /* Disable spurious IRQ10 */ | ||
848 | }; | ||
849 | |||
850 | static struct resource irqpin1_resources[] = { | ||
851 | DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */ | ||
852 | DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */ | ||
853 | DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */ | ||
854 | DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */ | ||
855 | DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */ | ||
856 | DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */ | ||
857 | DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */ | ||
858 | DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */ | ||
859 | DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */ | ||
860 | DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */ | ||
861 | DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */ | ||
862 | DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */ | ||
863 | DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */ | ||
864 | }; | ||
865 | |||
866 | static struct platform_device irqpin1_device = { | ||
867 | .name = "renesas_intc_irqpin", | ||
868 | .id = 1, | ||
869 | .resource = irqpin1_resources, | ||
870 | .num_resources = ARRAY_SIZE(irqpin1_resources), | ||
871 | .dev = { | ||
872 | .platform_data = &irqpin1_platform_data, | ||
873 | }, | ||
874 | }; | ||
875 | |||
876 | static struct renesas_intc_irqpin_config irqpin2_platform_data = { | ||
877 | .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */ | ||
878 | }; | ||
879 | |||
880 | static struct resource irqpin2_resources[] = { | ||
881 | DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */ | ||
882 | DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */ | ||
883 | DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */ | ||
884 | DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */ | ||
885 | DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */ | ||
886 | DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */ | ||
887 | DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */ | ||
888 | DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */ | ||
889 | DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */ | ||
890 | DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */ | ||
891 | DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */ | ||
892 | DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */ | ||
893 | DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */ | ||
894 | }; | ||
895 | |||
896 | static struct platform_device irqpin2_device = { | ||
897 | .name = "renesas_intc_irqpin", | ||
898 | .id = 2, | ||
899 | .resource = irqpin2_resources, | ||
900 | .num_resources = ARRAY_SIZE(irqpin2_resources), | ||
901 | .dev = { | ||
902 | .platform_data = &irqpin2_platform_data, | ||
903 | }, | ||
904 | }; | ||
905 | |||
906 | static struct renesas_intc_irqpin_config irqpin3_platform_data = { | ||
907 | .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */ | ||
908 | }; | ||
909 | |||
910 | static struct resource irqpin3_resources[] = { | ||
911 | DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */ | ||
912 | DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */ | ||
913 | DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */ | ||
914 | DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */ | ||
915 | DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */ | ||
916 | DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */ | ||
917 | DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */ | ||
918 | DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */ | ||
919 | DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */ | ||
920 | DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */ | ||
921 | DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */ | ||
922 | DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */ | ||
923 | DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */ | ||
924 | }; | ||
925 | |||
926 | static struct platform_device irqpin3_device = { | ||
927 | .name = "renesas_intc_irqpin", | ||
928 | .id = 3, | ||
929 | .resource = irqpin3_resources, | ||
930 | .num_resources = ARRAY_SIZE(irqpin3_resources), | ||
931 | .dev = { | ||
932 | .platform_data = &irqpin3_platform_data, | ||
933 | }, | ||
934 | }; | ||
935 | |||
814 | static struct platform_device *sh73a0_devices_dt[] __initdata = { | 936 | static struct platform_device *sh73a0_devices_dt[] __initdata = { |
815 | &scif0_device, | 937 | &scif0_device, |
816 | &scif1_device, | 938 | &scif1_device, |
@@ -839,6 +961,10 @@ static struct platform_device *sh73a0_late_devices[] __initdata = { | |||
839 | &dma0_device, | 961 | &dma0_device, |
840 | &mpdma0_device, | 962 | &mpdma0_device, |
841 | &pmu_device, | 963 | &pmu_device, |
964 | &irqpin0_device, | ||
965 | &irqpin1_device, | ||
966 | &irqpin2_device, | ||
967 | &irqpin3_device, | ||
842 | }; | 968 | }; |
843 | 969 | ||
844 | #define SRCR2 IOMEM(0xe61580b0) | 970 | #define SRCR2 IOMEM(0xe61580b0) |
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 9cf1ab17afeb..0d1e4128d460 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/sys_soc.h> | 35 | #include <linux/sys_soc.h> |
36 | #include <linux/usb/tegra_usb_phy.h> | 36 | #include <linux/usb/tegra_usb_phy.h> |
37 | #include <linux/clk/tegra.h> | ||
37 | 38 | ||
38 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
@@ -85,6 +86,8 @@ static void __init tegra_dt_init(void) | |||
85 | struct soc_device *soc_dev; | 86 | struct soc_device *soc_dev; |
86 | struct device *parent = NULL; | 87 | struct device *parent = NULL; |
87 | 88 | ||
89 | tegra_clocks_apply_init_table(); | ||
90 | |||
88 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | 91 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); |
89 | if (!soc_dev_attr) | 92 | if (!soc_dev_attr) |
90 | goto out; | 93 | goto out; |
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c index f3976f9c404a..947bd9eca079 100644 --- a/arch/arm/mach-ux500/board-mop500-pins.c +++ b/arch/arm/mach-ux500/board-mop500-pins.c | |||
@@ -46,8 +46,12 @@ BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED| | |||
46 | PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); | 46 | PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); |
47 | BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| | 47 | BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| |
48 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 48 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
49 | BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| | ||
50 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); | ||
49 | BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| | 51 | BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| |
50 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 52 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
53 | BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| | ||
54 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); | ||
51 | BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| | 55 | BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| |
52 | PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); | 56 | PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); |
53 | BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| | 57 | BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| |
@@ -76,9 +80,6 @@ BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE| | |||
76 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) | 80 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) |
77 | #define DB8500_PIN_HOG(pin,conf) \ | 81 | #define DB8500_PIN_HOG(pin,conf) \ |
78 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) | 82 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) |
79 | #define DB8500_PIN_SLEEP(pin, conf, dev) \ | ||
80 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ | ||
81 | pin, conf) | ||
82 | 83 | ||
83 | /* These are default states associated with device and changed runtime */ | 84 | /* These are default states associated with device and changed runtime */ |
84 | #define DB8500_MUX(group,func,dev) \ | 85 | #define DB8500_MUX(group,func,dev) \ |
@@ -307,8 +308,23 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
307 | DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ | 308 | DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ |
308 | 309 | ||
309 | /* Mux in USB pins, drive STP high */ | 310 | /* Mux in USB pins, drive STP high */ |
310 | DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), | 311 | /* USB default state */ |
311 | DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ | 312 | DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"), |
313 | DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */ | ||
314 | /* USB sleep state */ | ||
315 | DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */ | ||
316 | DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */ | ||
317 | DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */ | ||
318 | DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */ | ||
319 | DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */ | ||
320 | DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */ | ||
321 | DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */ | ||
322 | DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */ | ||
323 | DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */ | ||
324 | DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */ | ||
325 | DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */ | ||
326 | DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */ | ||
327 | |||
312 | /* Mux in SPI2 pins on the "other C1" altfunction */ | 328 | /* Mux in SPI2 pins on the "other C1" altfunction */ |
313 | DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), | 329 | DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), |
314 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ | 330 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ |
@@ -316,9 +332,9 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
316 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ | 332 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ |
317 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ | 333 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ |
318 | /* SPI2 idle state */ | 334 | /* SPI2 idle state */ |
319 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ | 335 | DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ |
320 | DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ | 336 | DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ |
321 | DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ | 337 | DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ |
322 | /* SPI2 sleep state */ | 338 | /* SPI2 sleep state */ |
323 | DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ | 339 | DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ |
324 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ | 340 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ |
@@ -745,6 +761,8 @@ static struct pinctrl_map __initdata snowball_pinmap[] = { | |||
745 | DB8500_PIN_HOG("GPIO21_AB3", out_hi), | 761 | DB8500_PIN_HOG("GPIO21_AB3", out_hi), |
746 | /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ | 762 | /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ |
747 | DB8500_MUX_HOG("sm_b_1", "sm"), | 763 | DB8500_MUX_HOG("sm_b_1", "sm"), |
764 | /* User LED */ | ||
765 | DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi), | ||
748 | /* Drive RSTn_LAN high */ | 766 | /* Drive RSTn_LAN high */ |
749 | DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), | 767 | DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), |
750 | /* Accelerometer/Magnetometer */ | 768 | /* Accelerometer/Magnetometer */ |
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig index e3e94b2fa145..9b252934b206 100644 --- a/arch/arm/mach-vt8500/Kconfig +++ b/arch/arm/mach-vt8500/Kconfig | |||
@@ -7,6 +7,7 @@ config ARCH_VT8500 | |||
7 | select GENERIC_CLOCKEVENTS | 7 | select GENERIC_CLOCKEVENTS |
8 | select HAVE_CLK | 8 | select HAVE_CLK |
9 | select VT8500_TIMER | 9 | select VT8500_TIMER |
10 | select PINCTRL | ||
10 | help | 11 | help |
11 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. | 12 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. |
12 | 13 | ||
diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile index 92ceb2436b60..4c8a84637594 100644 --- a/arch/arm/mach-vt8500/Makefile +++ b/arch/arm/mach-vt8500/Makefile | |||
@@ -1 +1 @@ | |||
obj-$(CONFIG_ARCH_VT8500) += irq.o vt8500.o | obj-$(CONFIG_ARCH_VT8500) += vt8500.o | ||
diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h index 77611a6968d6..087787af62f1 100644 --- a/arch/arm/mach-vt8500/common.h +++ b/arch/arm/mach-vt8500/common.h | |||
@@ -18,13 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | 20 | ||
21 | int __init vt8500_irq_init(struct device_node *node, | ||
22 | struct device_node *parent); | ||
23 | |||
24 | /* defined in drivers/clk/clk-vt8500.c */ | 21 | /* defined in drivers/clk/clk-vt8500.c */ |
25 | void __init vtwm_clk_init(void __iomem *pmc_base); | 22 | void __init vtwm_clk_init(void __iomem *pmc_base); |
26 | 23 | ||
27 | /* defined in irq.c */ | ||
28 | asmlinkage void vt8500_handle_irq(struct pt_regs *regs); | ||
29 | |||
30 | #endif | 24 | #endif |
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 49e80053d828..1dd281efc020 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/clocksource.h> | 21 | #include <linux/clocksource.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/irqchip.h> | ||
23 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
24 | 25 | ||
25 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
@@ -166,16 +167,6 @@ void __init vt8500_init(void) | |||
166 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 167 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
167 | } | 168 | } |
168 | 169 | ||
169 | static const struct of_device_id vt8500_irq_match[] __initconst = { | ||
170 | { .compatible = "via,vt8500-intc", .data = vt8500_irq_init, }, | ||
171 | { /* sentinel */ }, | ||
172 | }; | ||
173 | |||
174 | static void __init vt8500_init_irq(void) | ||
175 | { | ||
176 | of_irq_init(vt8500_irq_match); | ||
177 | }; | ||
178 | |||
179 | static const char * const vt8500_dt_compat[] = { | 170 | static const char * const vt8500_dt_compat[] = { |
180 | "via,vt8500", | 171 | "via,vt8500", |
181 | "wm,wm8650", | 172 | "wm,wm8650", |
@@ -187,10 +178,9 @@ static const char * const vt8500_dt_compat[] = { | |||
187 | DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") | 178 | DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") |
188 | .dt_compat = vt8500_dt_compat, | 179 | .dt_compat = vt8500_dt_compat, |
189 | .map_io = vt8500_map_io, | 180 | .map_io = vt8500_map_io, |
190 | .init_irq = vt8500_init_irq, | 181 | .init_irq = irqchip_init, |
191 | .init_machine = vt8500_init, | 182 | .init_machine = vt8500_init, |
192 | .init_time = clocksource_of_init, | 183 | .init_time = clocksource_of_init, |
193 | .restart = vt8500_restart, | 184 | .restart = vt8500_restart, |
194 | .handle_irq = vt8500_handle_irq, | ||
195 | MACHINE_END | 185 | MACHINE_END |
196 | 186 | ||
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index 138b5891f4ef..cf3226b041f5 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig | |||
@@ -11,5 +11,6 @@ config ARCH_ZYNQ | |||
11 | select MIGHT_HAVE_CACHE_L2X0 | 11 | select MIGHT_HAVE_CACHE_L2X0 |
12 | select USE_OF | 12 | select USE_OF |
13 | select SPARSE_IRQ | 13 | select SPARSE_IRQ |
14 | select CADENCE_TTC_TIMER | ||
14 | help | 15 | help |
15 | Support for Xilinx Zynq ARM Cortex A9 Platform | 16 | Support for Xilinx Zynq ARM Cortex A9 Platform |
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile index 397268c1b250..320faedeb484 100644 --- a/arch/arm/mach-zynq/Makefile +++ b/arch/arm/mach-zynq/Makefile | |||
@@ -3,4 +3,4 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := common.o timer.o | 6 | obj-y := common.o |
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 5c8983218183..68e0907de5d0 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/clk/zynq.h> | 22 | #include <linux/clk/zynq.h> |
23 | #include <linux/clocksource.h> | ||
23 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
24 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
25 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
@@ -77,7 +78,7 @@ static void __init xilinx_zynq_timer_init(void) | |||
77 | 78 | ||
78 | xilinx_zynq_clocks_init(slcr); | 79 | xilinx_zynq_clocks_init(slcr); |
79 | 80 | ||
80 | xttcps_timer_init(); | 81 | clocksource_of_init(); |
81 | } | 82 | } |
82 | 83 | ||
83 | /** | 84 | /** |
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 8b4dbbaa01cf..5050bb10bb12 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h | |||
@@ -17,6 +17,4 @@ | |||
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 __init xttcps_timer_init(void); | ||
21 | |||
22 | #endif | 20 | #endif |
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c deleted file mode 100644 index f9fbc9c1e7a6..000000000000 --- a/arch/arm/mach-zynq/timer.c +++ /dev/null | |||
@@ -1,324 +0,0 @@ | |||
1 | /* | ||
2 | * This file contains driver for the Xilinx PS Timer Counter IP. | ||
3 | * | ||
4 | * Copyright (C) 2011 Xilinx | ||
5 | * | ||
6 | * based on arch/mips/kernel/time.c timer driver | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/clockchips.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/clk-provider.h> | ||
24 | #include "common.h" | ||
25 | |||
26 | /* | ||
27 | * Timer Register Offset Definitions of Timer 1, Increment base address by 4 | ||
28 | * and use same offsets for Timer 2 | ||
29 | */ | ||
30 | #define XTTCPS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ | ||
31 | #define XTTCPS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ | ||
32 | #define XTTCPS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ | ||
33 | #define XTTCPS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ | ||
34 | #define XTTCPS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ | ||
35 | #define XTTCPS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ | ||
36 | |||
37 | #define XTTCPS_CNT_CNTRL_DISABLE_MASK 0x1 | ||
38 | |||
39 | /* | ||
40 | * Setup the timers to use pre-scaling, using a fixed value for now that will | ||
41 | * work across most input frequency, but it may need to be more dynamic | ||
42 | */ | ||
43 | #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ | ||
44 | #define PRESCALE 2048 /* The exponent must match this */ | ||
45 | #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) | ||
46 | #define CLK_CNTRL_PRESCALE_EN 1 | ||
47 | #define CNT_CNTRL_RESET (1<<4) | ||
48 | |||
49 | /** | ||
50 | * struct xttcps_timer - This definition defines local timer structure | ||
51 | * | ||
52 | * @base_addr: Base address of timer | ||
53 | **/ | ||
54 | struct xttcps_timer { | ||
55 | void __iomem *base_addr; | ||
56 | }; | ||
57 | |||
58 | struct xttcps_timer_clocksource { | ||
59 | struct xttcps_timer xttc; | ||
60 | struct clocksource cs; | ||
61 | }; | ||
62 | |||
63 | #define to_xttcps_timer_clksrc(x) \ | ||
64 | container_of(x, struct xttcps_timer_clocksource, cs) | ||
65 | |||
66 | struct xttcps_timer_clockevent { | ||
67 | struct xttcps_timer xttc; | ||
68 | struct clock_event_device ce; | ||
69 | struct clk *clk; | ||
70 | }; | ||
71 | |||
72 | #define to_xttcps_timer_clkevent(x) \ | ||
73 | container_of(x, struct xttcps_timer_clockevent, ce) | ||
74 | |||
75 | /** | ||
76 | * xttcps_set_interval - Set the timer interval value | ||
77 | * | ||
78 | * @timer: Pointer to the timer instance | ||
79 | * @cycles: Timer interval ticks | ||
80 | **/ | ||
81 | static void xttcps_set_interval(struct xttcps_timer *timer, | ||
82 | unsigned long cycles) | ||
83 | { | ||
84 | u32 ctrl_reg; | ||
85 | |||
86 | /* Disable the counter, set the counter value and re-enable counter */ | ||
87 | ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
88 | ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
89 | __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
90 | |||
91 | __raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET); | ||
92 | |||
93 | /* | ||
94 | * Reset the counter (0x10) so that it starts from 0, one-shot | ||
95 | * mode makes this needed for timing to be right. | ||
96 | */ | ||
97 | ctrl_reg |= CNT_CNTRL_RESET; | ||
98 | ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
99 | __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * xttcps_clock_event_interrupt - Clock event timer interrupt handler | ||
104 | * | ||
105 | * @irq: IRQ number of the Timer | ||
106 | * @dev_id: void pointer to the xttcps_timer instance | ||
107 | * | ||
108 | * returns: Always IRQ_HANDLED - success | ||
109 | **/ | ||
110 | static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id) | ||
111 | { | ||
112 | struct xttcps_timer_clockevent *xttce = dev_id; | ||
113 | struct xttcps_timer *timer = &xttce->xttc; | ||
114 | |||
115 | /* Acknowledge the interrupt and call event handler */ | ||
116 | __raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET); | ||
117 | |||
118 | xttce->ce.event_handler(&xttce->ce); | ||
119 | |||
120 | return IRQ_HANDLED; | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * __xttc_clocksource_read - Reads the timer counter register | ||
125 | * | ||
126 | * returns: Current timer counter register value | ||
127 | **/ | ||
128 | static cycle_t __xttc_clocksource_read(struct clocksource *cs) | ||
129 | { | ||
130 | struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc; | ||
131 | |||
132 | return (cycle_t)__raw_readl(timer->base_addr + | ||
133 | XTTCPS_COUNT_VAL_OFFSET); | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * xttcps_set_next_event - Sets the time interval for next event | ||
138 | * | ||
139 | * @cycles: Timer interval ticks | ||
140 | * @evt: Address of clock event instance | ||
141 | * | ||
142 | * returns: Always 0 - success | ||
143 | **/ | ||
144 | static int xttcps_set_next_event(unsigned long cycles, | ||
145 | struct clock_event_device *evt) | ||
146 | { | ||
147 | struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); | ||
148 | struct xttcps_timer *timer = &xttce->xttc; | ||
149 | |||
150 | xttcps_set_interval(timer, cycles); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * xttcps_set_mode - Sets the mode of timer | ||
156 | * | ||
157 | * @mode: Mode to be set | ||
158 | * @evt: Address of clock event instance | ||
159 | **/ | ||
160 | static void xttcps_set_mode(enum clock_event_mode mode, | ||
161 | struct clock_event_device *evt) | ||
162 | { | ||
163 | struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); | ||
164 | struct xttcps_timer *timer = &xttce->xttc; | ||
165 | u32 ctrl_reg; | ||
166 | |||
167 | switch (mode) { | ||
168 | case CLOCK_EVT_MODE_PERIODIC: | ||
169 | xttcps_set_interval(timer, | ||
170 | DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk), | ||
171 | PRESCALE * HZ)); | ||
172 | break; | ||
173 | case CLOCK_EVT_MODE_ONESHOT: | ||
174 | case CLOCK_EVT_MODE_UNUSED: | ||
175 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
176 | ctrl_reg = __raw_readl(timer->base_addr + | ||
177 | XTTCPS_CNT_CNTRL_OFFSET); | ||
178 | ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
179 | __raw_writel(ctrl_reg, | ||
180 | timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
181 | break; | ||
182 | case CLOCK_EVT_MODE_RESUME: | ||
183 | ctrl_reg = __raw_readl(timer->base_addr + | ||
184 | XTTCPS_CNT_CNTRL_OFFSET); | ||
185 | ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
186 | __raw_writel(ctrl_reg, | ||
187 | timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | static void __init zynq_ttc_setup_clocksource(struct device_node *np, | ||
193 | void __iomem *base) | ||
194 | { | ||
195 | struct xttcps_timer_clocksource *ttccs; | ||
196 | struct clk *clk; | ||
197 | int err; | ||
198 | u32 reg; | ||
199 | |||
200 | ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); | ||
201 | if (WARN_ON(!ttccs)) | ||
202 | return; | ||
203 | |||
204 | err = of_property_read_u32(np, "reg", ®); | ||
205 | if (WARN_ON(err)) | ||
206 | return; | ||
207 | |||
208 | clk = of_clk_get_by_name(np, "cpu_1x"); | ||
209 | if (WARN_ON(IS_ERR(clk))) | ||
210 | return; | ||
211 | |||
212 | err = clk_prepare_enable(clk); | ||
213 | if (WARN_ON(err)) | ||
214 | return; | ||
215 | |||
216 | ttccs->xttc.base_addr = base + reg * 4; | ||
217 | |||
218 | ttccs->cs.name = np->name; | ||
219 | ttccs->cs.rating = 200; | ||
220 | ttccs->cs.read = __xttc_clocksource_read; | ||
221 | ttccs->cs.mask = CLOCKSOURCE_MASK(16); | ||
222 | ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; | ||
223 | |||
224 | __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPS_IER_OFFSET); | ||
225 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
226 | ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); | ||
227 | __raw_writel(CNT_CNTRL_RESET, | ||
228 | ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
229 | |||
230 | err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE); | ||
231 | if (WARN_ON(err)) | ||
232 | return; | ||
233 | } | ||
234 | |||
235 | static void __init zynq_ttc_setup_clockevent(struct device_node *np, | ||
236 | void __iomem *base) | ||
237 | { | ||
238 | struct xttcps_timer_clockevent *ttcce; | ||
239 | int err, irq; | ||
240 | u32 reg; | ||
241 | |||
242 | ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); | ||
243 | if (WARN_ON(!ttcce)) | ||
244 | return; | ||
245 | |||
246 | err = of_property_read_u32(np, "reg", ®); | ||
247 | if (WARN_ON(err)) | ||
248 | return; | ||
249 | |||
250 | ttcce->xttc.base_addr = base + reg * 4; | ||
251 | |||
252 | ttcce->clk = of_clk_get_by_name(np, "cpu_1x"); | ||
253 | if (WARN_ON(IS_ERR(ttcce->clk))) | ||
254 | return; | ||
255 | |||
256 | err = clk_prepare_enable(ttcce->clk); | ||
257 | if (WARN_ON(err)) | ||
258 | return; | ||
259 | |||
260 | irq = irq_of_parse_and_map(np, 0); | ||
261 | if (WARN_ON(!irq)) | ||
262 | return; | ||
263 | |||
264 | ttcce->ce.name = np->name; | ||
265 | ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
266 | ttcce->ce.set_next_event = xttcps_set_next_event; | ||
267 | ttcce->ce.set_mode = xttcps_set_mode; | ||
268 | ttcce->ce.rating = 200; | ||
269 | ttcce->ce.irq = irq; | ||
270 | ttcce->ce.cpumask = cpu_possible_mask; | ||
271 | |||
272 | __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
273 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
274 | ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); | ||
275 | __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPS_IER_OFFSET); | ||
276 | |||
277 | err = request_irq(irq, xttcps_clock_event_interrupt, IRQF_TIMER, | ||
278 | np->name, ttcce); | ||
279 | if (WARN_ON(err)) | ||
280 | return; | ||
281 | |||
282 | clockevents_config_and_register(&ttcce->ce, | ||
283 | clk_get_rate(ttcce->clk) / PRESCALE, | ||
284 | 1, 0xfffe); | ||
285 | } | ||
286 | |||
287 | static const __initconst struct of_device_id zynq_ttc_match[] = { | ||
288 | { .compatible = "xlnx,ttc-counter-clocksource", | ||
289 | .data = zynq_ttc_setup_clocksource, }, | ||
290 | { .compatible = "xlnx,ttc-counter-clockevent", | ||
291 | .data = zynq_ttc_setup_clockevent, }, | ||
292 | {} | ||
293 | }; | ||
294 | |||
295 | /** | ||
296 | * xttcps_timer_init - Initialize the timer | ||
297 | * | ||
298 | * Initializes the timer hardware and register the clock source and clock event | ||
299 | * timers with Linux kernal timer framework | ||
300 | **/ | ||
301 | void __init xttcps_timer_init(void) | ||
302 | { | ||
303 | struct device_node *np; | ||
304 | |||
305 | for_each_compatible_node(np, NULL, "xlnx,ttc") { | ||
306 | struct device_node *np_chld; | ||
307 | void __iomem *base; | ||
308 | |||
309 | base = of_iomap(np, 0); | ||
310 | if (WARN_ON(!base)) | ||
311 | return; | ||
312 | |||
313 | for_each_available_child_of_node(np, np_chld) { | ||
314 | int (*cb)(struct device_node *np, void __iomem *base); | ||
315 | const struct of_device_id *match; | ||
316 | |||
317 | match = of_match_node(zynq_ttc_match, np_chld); | ||
318 | if (match) { | ||
319 | cb = match->data; | ||
320 | cb(np_chld, base); | ||
321 | } | ||
322 | } | ||
323 | } | ||
324 | } | ||
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 91c2d72e689b..54d186106f9f 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -25,7 +25,7 @@ config PLAT_S5P | |||
25 | select PLAT_SAMSUNG | 25 | select PLAT_SAMSUNG |
26 | select S3C_GPIO_TRACK | 26 | select S3C_GPIO_TRACK |
27 | select S5P_GPIO_DRVSTR | 27 | select S5P_GPIO_DRVSTR |
28 | select SAMSUNG_CLKSRC | 28 | select SAMSUNG_CLKSRC if !COMMON_CLK |
29 | select SAMSUNG_GPIOLIB_4BIT | 29 | select SAMSUNG_GPIOLIB_4BIT |
30 | select SAMSUNG_IRQ_VIC_TIMER | 30 | select SAMSUNG_IRQ_VIC_TIMER |
31 | help | 31 | help |
@@ -62,7 +62,7 @@ config S3C_LOWLEVEL_UART_PORT | |||
62 | 62 | ||
63 | # timer options | 63 | # timer options |
64 | 64 | ||
65 | config S5P_HRT | 65 | config SAMSUNG_HRT |
66 | bool | 66 | bool |
67 | select SAMSUNG_DEV_PWM | 67 | select SAMSUNG_DEV_PWM |
68 | help | 68 | help |
@@ -81,7 +81,7 @@ config SAMSUNG_CLKSRC | |||
81 | used by newer systems such as the S3C64XX. | 81 | used by newer systems such as the S3C64XX. |
82 | 82 | ||
83 | config S5P_CLOCK | 83 | config S5P_CLOCK |
84 | def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) | 84 | def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) |
85 | help | 85 | help |
86 | Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs | 86 | Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs |
87 | 87 | ||
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 3a7c64d1814a..a23c460299a1 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -12,8 +12,7 @@ obj- := | |||
12 | # Objects we always build independent of SoC choice | 12 | # Objects we always build independent of SoC choice |
13 | 13 | ||
14 | obj-y += init.o cpu.o | 14 | obj-y += init.o cpu.o |
15 | obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o | 15 | obj-$(CONFIG_SAMSUNG_HRT) += samsung-time.o |
16 | obj-$(CONFIG_S5P_HRT) += s5p-time.o | ||
17 | 16 | ||
18 | obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o | 17 | obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o |
19 | obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o | 18 | obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o |
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 33ad3f32c2b9..30c2fe243f76 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -1074,7 +1074,7 @@ struct platform_device s5p_device_onenand = { | |||
1074 | 1074 | ||
1075 | /* PMU */ | 1075 | /* PMU */ |
1076 | 1076 | ||
1077 | #ifdef CONFIG_PLAT_S5P | 1077 | #if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS) |
1078 | static struct resource s5p_pmu_resource[] = { | 1078 | static struct resource s5p_pmu_resource[] = { |
1079 | DEFINE_RES_IRQ(IRQ_PMU) | 1079 | DEFINE_RES_IRQ(IRQ_PMU) |
1080 | }; | 1080 | }; |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 37703ef6dfc7..989fefe18be6 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -23,6 +23,9 @@ extern unsigned long samsung_cpu_id; | |||
23 | #define S3C24XX_CPU_ID 0x32400000 | 23 | #define S3C24XX_CPU_ID 0x32400000 |
24 | #define S3C24XX_CPU_MASK 0xFFF00000 | 24 | #define S3C24XX_CPU_MASK 0xFFF00000 |
25 | 25 | ||
26 | #define S3C2412_CPU_ID 0x32412000 | ||
27 | #define S3C2412_CPU_MASK 0xFFFFF000 | ||
28 | |||
26 | #define S3C6400_CPU_ID 0x36400000 | 29 | #define S3C6400_CPU_ID 0x36400000 |
27 | #define S3C6410_CPU_ID 0x36410000 | 30 | #define S3C6410_CPU_ID 0x36410000 |
28 | #define S3C64XX_CPU_MASK 0xFFFFF000 | 31 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
@@ -53,6 +56,7 @@ static inline int is_samsung_##name(void) \ | |||
53 | } | 56 | } |
54 | 57 | ||
55 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | 58 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
59 | IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) | ||
56 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) | 60 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
57 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | 61 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) |
58 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) | 62 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
@@ -74,6 +78,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) | |||
74 | # define soc_is_s3c24xx() 0 | 78 | # define soc_is_s3c24xx() 0 |
75 | #endif | 79 | #endif |
76 | 80 | ||
81 | #if defined(CONFIG_CPU_S3C2412) | ||
82 | # define soc_is_s3c2412() is_samsung_s3c2412() | ||
83 | #else | ||
84 | # define soc_is_s3c2412() 0 | ||
85 | #endif | ||
86 | |||
77 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) | 87 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
78 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) | 88 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
79 | #else | 89 | #else |
@@ -173,7 +183,6 @@ extern void s3c_init_cpu(unsigned long idcode, | |||
173 | 183 | ||
174 | /* core initialisation functions */ | 184 | /* core initialisation functions */ |
175 | 185 | ||
176 | extern void s3c24xx_init_irq(void); | ||
177 | extern void s5p_init_irq(u32 *vic, u32 num_vic); | 186 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
178 | 187 | ||
179 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); | 188 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); |
@@ -192,10 +201,6 @@ extern void s3c24xx_init_uartdevs(char *name, | |||
192 | struct s3c24xx_uart_resources *res, | 201 | struct s3c24xx_uart_resources *res, |
193 | struct s3c2410_uartcfg *cfg, int no); | 202 | struct s3c2410_uartcfg *cfg, int no); |
194 | 203 | ||
195 | /* timer for 2410/2440 */ | ||
196 | |||
197 | extern void s3c24xx_timer_init(void); | ||
198 | |||
199 | extern struct syscore_ops s3c2410_pm_syscore_ops; | 204 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
200 | extern struct syscore_ops s3c2412_pm_syscore_ops; | 205 | extern struct syscore_ops s3c2412_pm_syscore_ops; |
201 | extern struct syscore_ops s3c2416_pm_syscore_ops; | 206 | extern struct syscore_ops s3c2416_pm_syscore_ops; |
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644 index 9c96f3586ce0..000000000000 --- a/arch/arm/plat-samsung/include/plat/s5p-time.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p-time.h | ||
2 | * | ||
3 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p time support | ||
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_PLAT_S5P_TIME_H | ||
14 | #define __ASM_PLAT_S5P_TIME_H __FILE__ | ||
15 | |||
16 | /* S5P HR-Timer Clock mode */ | ||
17 | enum s5p_timer_mode { | ||
18 | S5P_PWM0, | ||
19 | S5P_PWM1, | ||
20 | S5P_PWM2, | ||
21 | S5P_PWM3, | ||
22 | S5P_PWM4, | ||
23 | }; | ||
24 | |||
25 | struct s5p_timer_source { | ||
26 | unsigned int event_id; | ||
27 | unsigned int source_id; | ||
28 | }; | ||
29 | |||
30 | /* Be able to sleep for atleast 4 seconds (usually more) */ | ||
31 | #define S5PTIMER_MIN_RANGE 4 | ||
32 | |||
33 | #define TCNT_MAX 0xffffffff | ||
34 | #define NON_PERIODIC 0 | ||
35 | #define PERIODIC 1 | ||
36 | |||
37 | extern void __init s5p_set_timer_source(enum s5p_timer_mode event, | ||
38 | enum s5p_timer_mode source); | ||
39 | extern void s5p_timer_init(void); | ||
40 | #endif /* __ASM_PLAT_S5P_TIME_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644 index 000000000000..4cc99bb1f176 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/samsung-time.h | ||
2 | * | ||
3 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for samsung s3c and s5p time support | ||
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_PLAT_SAMSUNG_TIME_H | ||
14 | #define __ASM_PLAT_SAMSUNG_TIME_H __FILE__ | ||
15 | |||
16 | /* SAMSUNG HR-Timer Clock mode */ | ||
17 | enum samsung_timer_mode { | ||
18 | SAMSUNG_PWM0, | ||
19 | SAMSUNG_PWM1, | ||
20 | SAMSUNG_PWM2, | ||
21 | SAMSUNG_PWM3, | ||
22 | SAMSUNG_PWM4, | ||
23 | }; | ||
24 | |||
25 | struct samsung_timer_source { | ||
26 | unsigned int event_id; | ||
27 | unsigned int source_id; | ||
28 | }; | ||
29 | |||
30 | /* Be able to sleep for atleast 4 seconds (usually more) */ | ||
31 | #define SAMSUNG_TIMER_MIN_RANGE 4 | ||
32 | |||
33 | #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100) | ||
34 | #define TCNT_MAX 0xffff | ||
35 | #define TSCALER_DIV 25 | ||
36 | #define TDIV 50 | ||
37 | #define TSIZE 16 | ||
38 | #else | ||
39 | #define TCNT_MAX 0xffffffff | ||
40 | #define TSCALER_DIV 2 | ||
41 | #define TDIV 2 | ||
42 | #define TSIZE 32 | ||
43 | #endif | ||
44 | |||
45 | #define NON_PERIODIC 0 | ||
46 | #define PERIODIC 1 | ||
47 | |||
48 | extern void __init samsung_set_timer_source(enum samsung_timer_mode event, | ||
49 | enum samsung_timer_mode source); | ||
50 | |||
51 | extern void __init samsung_timer_init(void); | ||
52 | |||
53 | #endif /* __ASM_PLAT_SAMSUNG_TIME_H */ | ||
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/samsung-time.c index e92510cf82ee..f899cbc9b288 100644 --- a/arch/arm/plat-samsung/s5p-time.c +++ b/arch/arm/plat-samsung/samsung-time.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | 2 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
3 | * http://www.samsung.com/ | 3 | * http://www.samsung.com/ |
4 | * | 4 | * |
5 | * S5P - Common hr-timer support | 5 | * samsung - Common hr-timer support (s3c and s5p) |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 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 | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -25,41 +25,41 @@ | |||
25 | #include <mach/map.h> | 25 | #include <mach/map.h> |
26 | #include <plat/devs.h> | 26 | #include <plat/devs.h> |
27 | #include <plat/regs-timer.h> | 27 | #include <plat/regs-timer.h> |
28 | #include <plat/s5p-time.h> | 28 | #include <plat/samsung-time.h> |
29 | 29 | ||
30 | static struct clk *tin_event; | 30 | static struct clk *tin_event; |
31 | static struct clk *tin_source; | 31 | static struct clk *tin_source; |
32 | static struct clk *tdiv_event; | 32 | static struct clk *tdiv_event; |
33 | static struct clk *tdiv_source; | 33 | static struct clk *tdiv_source; |
34 | static struct clk *timerclk; | 34 | static struct clk *timerclk; |
35 | static struct s5p_timer_source timer_source; | 35 | static struct samsung_timer_source timer_source; |
36 | static unsigned long clock_count_per_tick; | 36 | static unsigned long clock_count_per_tick; |
37 | static void s5p_timer_resume(void); | 37 | static void samsung_timer_resume(void); |
38 | 38 | ||
39 | static void s5p_time_stop(enum s5p_timer_mode mode) | 39 | static void samsung_time_stop(enum samsung_timer_mode mode) |
40 | { | 40 | { |
41 | unsigned long tcon; | 41 | unsigned long tcon; |
42 | 42 | ||
43 | tcon = __raw_readl(S3C2410_TCON); | 43 | tcon = __raw_readl(S3C2410_TCON); |
44 | 44 | ||
45 | switch (mode) { | 45 | switch (mode) { |
46 | case S5P_PWM0: | 46 | case SAMSUNG_PWM0: |
47 | tcon &= ~S3C2410_TCON_T0START; | 47 | tcon &= ~S3C2410_TCON_T0START; |
48 | break; | 48 | break; |
49 | 49 | ||
50 | case S5P_PWM1: | 50 | case SAMSUNG_PWM1: |
51 | tcon &= ~S3C2410_TCON_T1START; | 51 | tcon &= ~S3C2410_TCON_T1START; |
52 | break; | 52 | break; |
53 | 53 | ||
54 | case S5P_PWM2: | 54 | case SAMSUNG_PWM2: |
55 | tcon &= ~S3C2410_TCON_T2START; | 55 | tcon &= ~S3C2410_TCON_T2START; |
56 | break; | 56 | break; |
57 | 57 | ||
58 | case S5P_PWM3: | 58 | case SAMSUNG_PWM3: |
59 | tcon &= ~S3C2410_TCON_T3START; | 59 | tcon &= ~S3C2410_TCON_T3START; |
60 | break; | 60 | break; |
61 | 61 | ||
62 | case S5P_PWM4: | 62 | case SAMSUNG_PWM4: |
63 | tcon &= ~S3C2410_TCON_T4START; | 63 | tcon &= ~S3C2410_TCON_T4START; |
64 | break; | 64 | break; |
65 | 65 | ||
@@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode) | |||
70 | __raw_writel(tcon, S3C2410_TCON); | 70 | __raw_writel(tcon, S3C2410_TCON); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | 73 | static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt) |
74 | { | 74 | { |
75 | unsigned long tcon; | 75 | unsigned long tcon; |
76 | 76 | ||
@@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | |||
79 | tcnt--; | 79 | tcnt--; |
80 | 80 | ||
81 | switch (mode) { | 81 | switch (mode) { |
82 | case S5P_PWM0: | 82 | case SAMSUNG_PWM0: |
83 | tcon &= ~(0x0f << 0); | 83 | tcon &= ~(0x0f << 0); |
84 | tcon |= S3C2410_TCON_T0MANUALUPD; | 84 | tcon |= S3C2410_TCON_T0MANUALUPD; |
85 | break; | 85 | break; |
86 | 86 | ||
87 | case S5P_PWM1: | 87 | case SAMSUNG_PWM1: |
88 | tcon &= ~(0x0f << 8); | 88 | tcon &= ~(0x0f << 8); |
89 | tcon |= S3C2410_TCON_T1MANUALUPD; | 89 | tcon |= S3C2410_TCON_T1MANUALUPD; |
90 | break; | 90 | break; |
91 | 91 | ||
92 | case S5P_PWM2: | 92 | case SAMSUNG_PWM2: |
93 | tcon &= ~(0x0f << 12); | 93 | tcon &= ~(0x0f << 12); |
94 | tcon |= S3C2410_TCON_T2MANUALUPD; | 94 | tcon |= S3C2410_TCON_T2MANUALUPD; |
95 | break; | 95 | break; |
96 | 96 | ||
97 | case S5P_PWM3: | 97 | case SAMSUNG_PWM3: |
98 | tcon &= ~(0x0f << 16); | 98 | tcon &= ~(0x0f << 16); |
99 | tcon |= S3C2410_TCON_T3MANUALUPD; | 99 | tcon |= S3C2410_TCON_T3MANUALUPD; |
100 | break; | 100 | break; |
101 | 101 | ||
102 | case S5P_PWM4: | 102 | case SAMSUNG_PWM4: |
103 | tcon &= ~(0x07 << 20); | 103 | tcon &= ~(0x07 << 20); |
104 | tcon |= S3C2410_TCON_T4MANUALUPD; | 104 | tcon |= S3C2410_TCON_T4MANUALUPD; |
105 | break; | 105 | break; |
@@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | |||
114 | __raw_writel(tcon, S3C2410_TCON); | 114 | __raw_writel(tcon, S3C2410_TCON); |
115 | } | 115 | } |
116 | 116 | ||
117 | static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | 117 | static void samsung_time_start(enum samsung_timer_mode mode, bool periodic) |
118 | { | 118 | { |
119 | unsigned long tcon; | 119 | unsigned long tcon; |
120 | 120 | ||
121 | tcon = __raw_readl(S3C2410_TCON); | 121 | tcon = __raw_readl(S3C2410_TCON); |
122 | 122 | ||
123 | switch (mode) { | 123 | switch (mode) { |
124 | case S5P_PWM0: | 124 | case SAMSUNG_PWM0: |
125 | tcon |= S3C2410_TCON_T0START; | 125 | tcon |= S3C2410_TCON_T0START; |
126 | tcon &= ~S3C2410_TCON_T0MANUALUPD; | 126 | tcon &= ~S3C2410_TCON_T0MANUALUPD; |
127 | 127 | ||
@@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
131 | tcon &= ~S3C2410_TCON_T0RELOAD; | 131 | tcon &= ~S3C2410_TCON_T0RELOAD; |
132 | break; | 132 | break; |
133 | 133 | ||
134 | case S5P_PWM1: | 134 | case SAMSUNG_PWM1: |
135 | tcon |= S3C2410_TCON_T1START; | 135 | tcon |= S3C2410_TCON_T1START; |
136 | tcon &= ~S3C2410_TCON_T1MANUALUPD; | 136 | tcon &= ~S3C2410_TCON_T1MANUALUPD; |
137 | 137 | ||
@@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
141 | tcon &= ~S3C2410_TCON_T1RELOAD; | 141 | tcon &= ~S3C2410_TCON_T1RELOAD; |
142 | break; | 142 | break; |
143 | 143 | ||
144 | case S5P_PWM2: | 144 | case SAMSUNG_PWM2: |
145 | tcon |= S3C2410_TCON_T2START; | 145 | tcon |= S3C2410_TCON_T2START; |
146 | tcon &= ~S3C2410_TCON_T2MANUALUPD; | 146 | tcon &= ~S3C2410_TCON_T2MANUALUPD; |
147 | 147 | ||
@@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
151 | tcon &= ~S3C2410_TCON_T2RELOAD; | 151 | tcon &= ~S3C2410_TCON_T2RELOAD; |
152 | break; | 152 | break; |
153 | 153 | ||
154 | case S5P_PWM3: | 154 | case SAMSUNG_PWM3: |
155 | tcon |= S3C2410_TCON_T3START; | 155 | tcon |= S3C2410_TCON_T3START; |
156 | tcon &= ~S3C2410_TCON_T3MANUALUPD; | 156 | tcon &= ~S3C2410_TCON_T3MANUALUPD; |
157 | 157 | ||
@@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
161 | tcon &= ~S3C2410_TCON_T3RELOAD; | 161 | tcon &= ~S3C2410_TCON_T3RELOAD; |
162 | break; | 162 | break; |
163 | 163 | ||
164 | case S5P_PWM4: | 164 | case SAMSUNG_PWM4: |
165 | tcon |= S3C2410_TCON_T4START; | 165 | tcon |= S3C2410_TCON_T4START; |
166 | tcon &= ~S3C2410_TCON_T4MANUALUPD; | 166 | tcon &= ~S3C2410_TCON_T4MANUALUPD; |
167 | 167 | ||
@@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
178 | __raw_writel(tcon, S3C2410_TCON); | 178 | __raw_writel(tcon, S3C2410_TCON); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int s5p_set_next_event(unsigned long cycles, | 181 | static int samsung_set_next_event(unsigned long cycles, |
182 | struct clock_event_device *evt) | 182 | struct clock_event_device *evt) |
183 | { | 183 | { |
184 | s5p_time_setup(timer_source.event_id, cycles); | 184 | samsung_time_setup(timer_source.event_id, cycles); |
185 | s5p_time_start(timer_source.event_id, NON_PERIODIC); | 185 | samsung_time_start(timer_source.event_id, NON_PERIODIC); |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static void s5p_set_mode(enum clock_event_mode mode, | 190 | static void samsung_set_mode(enum clock_event_mode mode, |
191 | struct clock_event_device *evt) | 191 | struct clock_event_device *evt) |
192 | { | 192 | { |
193 | s5p_time_stop(timer_source.event_id); | 193 | samsung_time_stop(timer_source.event_id); |
194 | 194 | ||
195 | switch (mode) { | 195 | switch (mode) { |
196 | case CLOCK_EVT_MODE_PERIODIC: | 196 | case CLOCK_EVT_MODE_PERIODIC: |
197 | s5p_time_setup(timer_source.event_id, clock_count_per_tick); | 197 | samsung_time_setup(timer_source.event_id, clock_count_per_tick); |
198 | s5p_time_start(timer_source.event_id, PERIODIC); | 198 | samsung_time_start(timer_source.event_id, PERIODIC); |
199 | break; | 199 | break; |
200 | 200 | ||
201 | case CLOCK_EVT_MODE_ONESHOT: | 201 | case CLOCK_EVT_MODE_ONESHOT: |
@@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode, | |||
206 | break; | 206 | break; |
207 | 207 | ||
208 | case CLOCK_EVT_MODE_RESUME: | 208 | case CLOCK_EVT_MODE_RESUME: |
209 | s5p_timer_resume(); | 209 | samsung_timer_resume(); |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | static void s5p_timer_resume(void) | 214 | static void samsung_timer_resume(void) |
215 | { | 215 | { |
216 | /* event timer restart */ | 216 | /* event timer restart */ |
217 | s5p_time_setup(timer_source.event_id, clock_count_per_tick); | 217 | samsung_time_setup(timer_source.event_id, clock_count_per_tick); |
218 | s5p_time_start(timer_source.event_id, PERIODIC); | 218 | samsung_time_start(timer_source.event_id, PERIODIC); |
219 | 219 | ||
220 | /* source timer restart */ | 220 | /* source timer restart */ |
221 | s5p_time_setup(timer_source.source_id, TCNT_MAX); | 221 | samsung_time_setup(timer_source.source_id, TCNT_MAX); |
222 | s5p_time_start(timer_source.source_id, PERIODIC); | 222 | samsung_time_start(timer_source.source_id, PERIODIC); |
223 | } | 223 | } |
224 | 224 | ||
225 | void __init s5p_set_timer_source(enum s5p_timer_mode event, | 225 | void __init samsung_set_timer_source(enum samsung_timer_mode event, |
226 | enum s5p_timer_mode source) | 226 | enum samsung_timer_mode source) |
227 | { | 227 | { |
228 | s3c_device_timer[event].dev.bus = &platform_bus_type; | 228 | s3c_device_timer[event].dev.bus = &platform_bus_type; |
229 | s3c_device_timer[source].dev.bus = &platform_bus_type; | 229 | s3c_device_timer[source].dev.bus = &platform_bus_type; |
@@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode event, | |||
233 | } | 233 | } |
234 | 234 | ||
235 | static struct clock_event_device time_event_device = { | 235 | static struct clock_event_device time_event_device = { |
236 | .name = "s5p_event_timer", | 236 | .name = "samsung_event_timer", |
237 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 237 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
238 | .rating = 200, | 238 | .rating = 200, |
239 | .set_next_event = s5p_set_next_event, | 239 | .set_next_event = samsung_set_next_event, |
240 | .set_mode = s5p_set_mode, | 240 | .set_mode = samsung_set_mode, |
241 | }; | 241 | }; |
242 | 242 | ||
243 | static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) | 243 | static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id) |
244 | { | 244 | { |
245 | struct clock_event_device *evt = dev_id; | 245 | struct clock_event_device *evt = dev_id; |
246 | 246 | ||
@@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) | |||
249 | return IRQ_HANDLED; | 249 | return IRQ_HANDLED; |
250 | } | 250 | } |
251 | 251 | ||
252 | static struct irqaction s5p_clock_event_irq = { | 252 | static struct irqaction samsung_clock_event_irq = { |
253 | .name = "s5p_time_irq", | 253 | .name = "samsung_time_irq", |
254 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 254 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
255 | .handler = s5p_clock_event_isr, | 255 | .handler = samsung_clock_event_isr, |
256 | .dev_id = &time_event_device, | 256 | .dev_id = &time_event_device, |
257 | }; | 257 | }; |
258 | 258 | ||
259 | static void __init s5p_clockevent_init(void) | 259 | static void __init samsung_clockevent_init(void) |
260 | { | 260 | { |
261 | unsigned long pclk; | 261 | unsigned long pclk; |
262 | unsigned long clock_rate; | 262 | unsigned long clock_rate; |
@@ -267,8 +267,8 @@ static void __init s5p_clockevent_init(void) | |||
267 | 267 | ||
268 | tscaler = clk_get_parent(tdiv_event); | 268 | tscaler = clk_get_parent(tdiv_event); |
269 | 269 | ||
270 | clk_set_rate(tscaler, pclk / 2); | 270 | clk_set_rate(tscaler, pclk / TSCALER_DIV); |
271 | clk_set_rate(tdiv_event, pclk / 2); | 271 | clk_set_rate(tdiv_event, pclk / TDIV); |
272 | clk_set_parent(tin_event, tdiv_event); | 272 | clk_set_parent(tin_event, tdiv_event); |
273 | 273 | ||
274 | clock_rate = clk_get_rate(tin_event); | 274 | clock_rate = clk_get_rate(tin_event); |
@@ -278,22 +278,22 @@ static void __init s5p_clockevent_init(void) | |||
278 | clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); | 278 | clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); |
279 | 279 | ||
280 | irq_number = timer_source.event_id + IRQ_TIMER0; | 280 | irq_number = timer_source.event_id + IRQ_TIMER0; |
281 | setup_irq(irq_number, &s5p_clock_event_irq); | 281 | setup_irq(irq_number, &samsung_clock_event_irq); |
282 | } | 282 | } |
283 | 283 | ||
284 | static void __iomem *s5p_timer_reg(void) | 284 | static void __iomem *samsung_timer_reg(void) |
285 | { | 285 | { |
286 | unsigned long offset = 0; | 286 | unsigned long offset = 0; |
287 | 287 | ||
288 | switch (timer_source.source_id) { | 288 | switch (timer_source.source_id) { |
289 | case S5P_PWM0: | 289 | case SAMSUNG_PWM0: |
290 | case S5P_PWM1: | 290 | case SAMSUNG_PWM1: |
291 | case S5P_PWM2: | 291 | case SAMSUNG_PWM2: |
292 | case S5P_PWM3: | 292 | case SAMSUNG_PWM3: |
293 | offset = (timer_source.source_id * 0x0c) + 0x14; | 293 | offset = (timer_source.source_id * 0x0c) + 0x14; |
294 | break; | 294 | break; |
295 | 295 | ||
296 | case S5P_PWM4: | 296 | case SAMSUNG_PWM4: |
297 | offset = 0x40; | 297 | offset = 0x40; |
298 | break; | 298 | break; |
299 | 299 | ||
@@ -312,9 +312,9 @@ static void __iomem *s5p_timer_reg(void) | |||
312 | * this wraps around for now, since it is just a relative time | 312 | * this wraps around for now, since it is just a relative time |
313 | * stamp. (Inspired by U300 implementation.) | 313 | * stamp. (Inspired by U300 implementation.) |
314 | */ | 314 | */ |
315 | static u32 notrace s5p_read_sched_clock(void) | 315 | static u32 notrace samsung_read_sched_clock(void) |
316 | { | 316 | { |
317 | void __iomem *reg = s5p_timer_reg(); | 317 | void __iomem *reg = samsung_timer_reg(); |
318 | 318 | ||
319 | if (!reg) | 319 | if (!reg) |
320 | return 0; | 320 | return 0; |
@@ -322,29 +322,29 @@ static u32 notrace s5p_read_sched_clock(void) | |||
322 | return ~__raw_readl(reg); | 322 | return ~__raw_readl(reg); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void __init s5p_clocksource_init(void) | 325 | static void __init samsung_clocksource_init(void) |
326 | { | 326 | { |
327 | unsigned long pclk; | 327 | unsigned long pclk; |
328 | unsigned long clock_rate; | 328 | unsigned long clock_rate; |
329 | 329 | ||
330 | pclk = clk_get_rate(timerclk); | 330 | pclk = clk_get_rate(timerclk); |
331 | 331 | ||
332 | clk_set_rate(tdiv_source, pclk / 2); | 332 | clk_set_rate(tdiv_source, pclk / TDIV); |
333 | clk_set_parent(tin_source, tdiv_source); | 333 | clk_set_parent(tin_source, tdiv_source); |
334 | 334 | ||
335 | clock_rate = clk_get_rate(tin_source); | 335 | clock_rate = clk_get_rate(tin_source); |
336 | 336 | ||
337 | s5p_time_setup(timer_source.source_id, TCNT_MAX); | 337 | samsung_time_setup(timer_source.source_id, TCNT_MAX); |
338 | s5p_time_start(timer_source.source_id, PERIODIC); | 338 | samsung_time_start(timer_source.source_id, PERIODIC); |
339 | 339 | ||
340 | setup_sched_clock(s5p_read_sched_clock, 32, clock_rate); | 340 | setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate); |
341 | 341 | ||
342 | if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer", | 342 | if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer", |
343 | clock_rate, 250, 32, clocksource_mmio_readl_down)) | 343 | clock_rate, 250, TSIZE, clocksource_mmio_readl_down)) |
344 | panic("s5p_clocksource_timer: can't register clocksource\n"); | 344 | panic("samsung_clocksource_timer: can't register clocksource\n"); |
345 | } | 345 | } |
346 | 346 | ||
347 | static void __init s5p_timer_resources(void) | 347 | static void __init samsung_timer_resources(void) |
348 | { | 348 | { |
349 | 349 | ||
350 | unsigned long event_id = timer_source.event_id; | 350 | unsigned long event_id = timer_source.event_id; |
@@ -386,9 +386,9 @@ static void __init s5p_timer_resources(void) | |||
386 | clk_enable(tin_source); | 386 | clk_enable(tin_source); |
387 | } | 387 | } |
388 | 388 | ||
389 | void __init s5p_timer_init(void) | 389 | void __init samsung_timer_init(void) |
390 | { | 390 | { |
391 | s5p_timer_resources(); | 391 | samsung_timer_resources(); |
392 | s5p_clockevent_init(); | 392 | samsung_clockevent_init(); |
393 | s5p_clocksource_init(); | 393 | samsung_clocksource_init(); |
394 | } | 394 | } |
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c deleted file mode 100644 index 73defd00c3e4..000000000000 --- a/arch/arm/plat-samsung/time.c +++ /dev/null | |||
@@ -1,287 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/time.c | ||
2 | * | ||
3 | * Copyright (C) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks, <ben@simtec.co.uk> | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/err.h> | ||
27 | #include <linux/clk.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/syscore_ops.h> | ||
31 | |||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <asm/irq.h> | ||
35 | #include <mach/map.h> | ||
36 | #include <plat/regs-timer.h> | ||
37 | #include <mach/regs-irq.h> | ||
38 | #include <asm/mach/time.h> | ||
39 | #include <mach/tick.h> | ||
40 | |||
41 | #include <plat/clock.h> | ||
42 | #include <plat/cpu.h> | ||
43 | |||
44 | static unsigned long timer_startval; | ||
45 | static unsigned long timer_usec_ticks; | ||
46 | |||
47 | #ifndef TICK_MAX | ||
48 | #define TICK_MAX (0xffff) | ||
49 | #endif | ||
50 | |||
51 | #define TIMER_USEC_SHIFT 16 | ||
52 | |||
53 | /* we use the shifted arithmetic to work out the ratio of timer ticks | ||
54 | * to usecs, as often the peripheral clock is not a nice even multiple | ||
55 | * of 1MHz. | ||
56 | * | ||
57 | * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok | ||
58 | * for the current HZ value of 200 without producing overflows. | ||
59 | * | ||
60 | * Original patch by Dimitry Andric, updated by Ben Dooks | ||
61 | */ | ||
62 | |||
63 | |||
64 | /* timer_mask_usec_ticks | ||
65 | * | ||
66 | * given a clock and divisor, make the value to pass into timer_ticks_to_usec | ||
67 | * to scale the ticks into usecs | ||
68 | */ | ||
69 | |||
70 | static inline unsigned long | ||
71 | timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk) | ||
72 | { | ||
73 | unsigned long den = pclk / 1000; | ||
74 | |||
75 | return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den; | ||
76 | } | ||
77 | |||
78 | /* timer_ticks_to_usec | ||
79 | * | ||
80 | * convert timer ticks to usec. | ||
81 | */ | ||
82 | |||
83 | static inline unsigned long timer_ticks_to_usec(unsigned long ticks) | ||
84 | { | ||
85 | unsigned long res; | ||
86 | |||
87 | res = ticks * timer_usec_ticks; | ||
88 | res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */ | ||
89 | |||
90 | return res >> TIMER_USEC_SHIFT; | ||
91 | } | ||
92 | |||
93 | /*** | ||
94 | * Returns microsecond since last clock interrupt. Note that interrupts | ||
95 | * will have been disabled by do_gettimeoffset() | ||
96 | * IRQs are disabled before entering here from do_gettimeofday() | ||
97 | */ | ||
98 | |||
99 | static u32 s3c2410_gettimeoffset(void) | ||
100 | { | ||
101 | unsigned long tdone; | ||
102 | unsigned long tval; | ||
103 | |||
104 | /* work out how many ticks have gone since last timer interrupt */ | ||
105 | |||
106 | tval = __raw_readl(S3C2410_TCNTO(4)); | ||
107 | tdone = timer_startval - tval; | ||
108 | |||
109 | /* check to see if there is an interrupt pending */ | ||
110 | |||
111 | if (s3c24xx_ostimer_pending()) { | ||
112 | /* re-read the timer, and try and fix up for the missed | ||
113 | * interrupt. Note, the interrupt may go off before the | ||
114 | * timer has re-loaded from wrapping. | ||
115 | */ | ||
116 | |||
117 | tval = __raw_readl(S3C2410_TCNTO(4)); | ||
118 | tdone = timer_startval - tval; | ||
119 | |||
120 | if (tval != 0) | ||
121 | tdone += timer_startval; | ||
122 | } | ||
123 | |||
124 | return timer_ticks_to_usec(tdone) * 1000; | ||
125 | } | ||
126 | |||
127 | |||
128 | /* | ||
129 | * IRQ handler for the timer | ||
130 | */ | ||
131 | static irqreturn_t | ||
132 | s3c2410_timer_interrupt(int irq, void *dev_id) | ||
133 | { | ||
134 | timer_tick(); | ||
135 | return IRQ_HANDLED; | ||
136 | } | ||
137 | |||
138 | static struct irqaction s3c2410_timer_irq = { | ||
139 | .name = "S3C2410 Timer Tick", | ||
140 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | ||
141 | .handler = s3c2410_timer_interrupt, | ||
142 | }; | ||
143 | |||
144 | #define use_tclk1_12() ( \ | ||
145 | machine_is_bast() || \ | ||
146 | machine_is_vr1000() || \ | ||
147 | machine_is_anubis() || \ | ||
148 | machine_is_osiris()) | ||
149 | |||
150 | static struct clk *tin; | ||
151 | static struct clk *tdiv; | ||
152 | static struct clk *timerclk; | ||
153 | |||
154 | /* | ||
155 | * Set up timer interrupt, and return the current time in seconds. | ||
156 | * | ||
157 | * Currently we only use timer4, as it is the only timer which has no | ||
158 | * other function that can be exploited externally | ||
159 | */ | ||
160 | static void s3c2410_timer_setup (void) | ||
161 | { | ||
162 | unsigned long tcon; | ||
163 | unsigned long tcnt; | ||
164 | unsigned long tcfg1; | ||
165 | unsigned long tcfg0; | ||
166 | |||
167 | tcnt = TICK_MAX; /* default value for tcnt */ | ||
168 | |||
169 | /* configure the system for whichever machine is in use */ | ||
170 | |||
171 | if (use_tclk1_12()) { | ||
172 | /* timer is at 12MHz, scaler is 1 */ | ||
173 | timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); | ||
174 | tcnt = 12000000 / HZ; | ||
175 | |||
176 | tcfg1 = __raw_readl(S3C2410_TCFG1); | ||
177 | tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; | ||
178 | tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; | ||
179 | __raw_writel(tcfg1, S3C2410_TCFG1); | ||
180 | } else { | ||
181 | unsigned long pclk; | ||
182 | struct clk *tscaler; | ||
183 | |||
184 | /* for the h1940 (and others), we use the pclk from the core | ||
185 | * to generate the timer values. since values around 50 to | ||
186 | * 70MHz are not values we can directly generate the timer | ||
187 | * value from, we need to pre-scale and divide before using it. | ||
188 | * | ||
189 | * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz | ||
190 | * (8.45 ticks per usec) | ||
191 | */ | ||
192 | |||
193 | pclk = clk_get_rate(timerclk); | ||
194 | |||
195 | /* configure clock tick */ | ||
196 | |||
197 | timer_usec_ticks = timer_mask_usec_ticks(6, pclk); | ||
198 | |||
199 | tscaler = clk_get_parent(tdiv); | ||
200 | |||
201 | clk_set_rate(tscaler, pclk / 3); | ||
202 | clk_set_rate(tdiv, pclk / 6); | ||
203 | clk_set_parent(tin, tdiv); | ||
204 | |||
205 | tcnt = clk_get_rate(tin) / HZ; | ||
206 | } | ||
207 | |||
208 | tcon = __raw_readl(S3C2410_TCON); | ||
209 | tcfg0 = __raw_readl(S3C2410_TCFG0); | ||
210 | tcfg1 = __raw_readl(S3C2410_TCFG1); | ||
211 | |||
212 | /* timers reload after counting zero, so reduce the count by 1 */ | ||
213 | |||
214 | tcnt--; | ||
215 | |||
216 | printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n", | ||
217 | tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks); | ||
218 | |||
219 | /* check to see if timer is within 16bit range... */ | ||
220 | if (tcnt > TICK_MAX) { | ||
221 | panic("setup_timer: HZ is too small, cannot configure timer!"); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | __raw_writel(tcfg1, S3C2410_TCFG1); | ||
226 | __raw_writel(tcfg0, S3C2410_TCFG0); | ||
227 | |||
228 | timer_startval = tcnt; | ||
229 | __raw_writel(tcnt, S3C2410_TCNTB(4)); | ||
230 | |||
231 | /* ensure timer is stopped... */ | ||
232 | |||
233 | tcon &= ~(7<<20); | ||
234 | tcon |= S3C2410_TCON_T4RELOAD; | ||
235 | tcon |= S3C2410_TCON_T4MANUALUPD; | ||
236 | |||
237 | __raw_writel(tcon, S3C2410_TCON); | ||
238 | __raw_writel(tcnt, S3C2410_TCNTB(4)); | ||
239 | __raw_writel(tcnt, S3C2410_TCMPB(4)); | ||
240 | |||
241 | /* start the timer running */ | ||
242 | tcon |= S3C2410_TCON_T4START; | ||
243 | tcon &= ~S3C2410_TCON_T4MANUALUPD; | ||
244 | __raw_writel(tcon, S3C2410_TCON); | ||
245 | } | ||
246 | |||
247 | static void __init s3c2410_timer_resources(void) | ||
248 | { | ||
249 | struct platform_device tmpdev; | ||
250 | |||
251 | tmpdev.dev.bus = &platform_bus_type; | ||
252 | tmpdev.id = 4; | ||
253 | |||
254 | timerclk = clk_get(NULL, "timers"); | ||
255 | if (IS_ERR(timerclk)) | ||
256 | panic("failed to get clock for system timer"); | ||
257 | |||
258 | clk_enable(timerclk); | ||
259 | |||
260 | if (!use_tclk1_12()) { | ||
261 | tmpdev.id = 4; | ||
262 | tmpdev.dev.init_name = "s3c24xx-pwm.4"; | ||
263 | tin = clk_get(&tmpdev.dev, "pwm-tin"); | ||
264 | if (IS_ERR(tin)) | ||
265 | panic("failed to get pwm-tin clock for system timer"); | ||
266 | |||
267 | tdiv = clk_get(&tmpdev.dev, "pwm-tdiv"); | ||
268 | if (IS_ERR(tdiv)) | ||
269 | panic("failed to get pwm-tdiv clock for system timer"); | ||
270 | } | ||
271 | |||
272 | clk_enable(tin); | ||
273 | } | ||
274 | |||
275 | static struct syscore_ops s3c24xx_syscore_ops = { | ||
276 | .resume = s3c2410_timer_setup, | ||
277 | }; | ||
278 | |||
279 | void __init s3c24xx_timer_init(void) | ||
280 | { | ||
281 | arch_gettimeoffset = s3c2410_gettimeoffset; | ||
282 | |||
283 | s3c2410_timer_resources(); | ||
284 | s3c2410_timer_setup(); | ||
285 | setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); | ||
286 | register_syscore_ops(&s3c24xx_syscore_ops); | ||
287 | } | ||
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index b323d8d3185b..7c2f6685bf43 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1453,7 +1453,7 @@ static struct resource atmel_lcdfb0_resource[] = { | |||
1453 | }, | 1453 | }, |
1454 | }; | 1454 | }; |
1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); | 1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); |
1456 | DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); | 1456 | DEV_CLK(hclk, atmel_lcdfb0, hsb, 7); |
1457 | static struct clk atmel_lcdfb0_pixclk = { | 1457 | static struct clk atmel_lcdfb0_pixclk = { |
1458 | .name = "lcdc_clk", | 1458 | .name = "lcdc_clk", |
1459 | .dev = &atmel_lcdfb0_device.dev, | 1459 | .dev = &atmel_lcdfb0_device.dev, |
@@ -1530,6 +1530,8 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, | |||
1530 | memcpy(info, data, sizeof(struct atmel_lcdfb_info)); | 1530 | memcpy(info, data, sizeof(struct atmel_lcdfb_info)); |
1531 | info->default_monspecs = monspecs; | 1531 | info->default_monspecs = monspecs; |
1532 | 1532 | ||
1533 | pdev->name = "at32ap-lcdfb"; | ||
1534 | |||
1533 | platform_device_register(pdev); | 1535 | platform_device_register(pdev); |
1534 | return pdev; | 1536 | return pdev; |
1535 | 1537 | ||
@@ -2246,7 +2248,7 @@ static __initdata struct clk *init_clocks[] = { | |||
2246 | &atmel_twi0_pclk, | 2248 | &atmel_twi0_pclk, |
2247 | &atmel_mci0_pclk, | 2249 | &atmel_mci0_pclk, |
2248 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) | 2250 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) |
2249 | &atmel_lcdfb0_hck1, | 2251 | &atmel_lcdfb0_hclk, |
2250 | &atmel_lcdfb0_pixclk, | 2252 | &atmel_lcdfb0_pixclk, |
2251 | #endif | 2253 | #endif |
2252 | &ssc0_pclk, | 2254 | &ssc0_pclk, |
diff --git a/drivers/Kconfig b/drivers/Kconfig index 8d96238549fa..9953a42809ec 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -164,4 +164,6 @@ source "drivers/irqchip/Kconfig" | |||
164 | 164 | ||
165 | source "drivers/ipack/Kconfig" | 165 | source "drivers/ipack/Kconfig" |
166 | 166 | ||
167 | source "drivers/reset/Kconfig" | ||
168 | |||
167 | endmenu | 169 | endmenu |
diff --git a/drivers/Makefile b/drivers/Makefile index 8e57688ebd95..130abc1dfd65 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -37,6 +37,9 @@ obj-$(CONFIG_XEN) += xen/ | |||
37 | # regulators early, since some subsystems rely on them to initialize | 37 | # regulators early, since some subsystems rely on them to initialize |
38 | obj-$(CONFIG_REGULATOR) += regulator/ | 38 | obj-$(CONFIG_REGULATOR) += regulator/ |
39 | 39 | ||
40 | # reset controllers early, since gpu drivers might rely on them to initialize | ||
41 | obj-$(CONFIG_RESET_CONTROLLER) += reset/ | ||
42 | |||
40 | # tty/ comes before char/ so that the VT console is the boot-time | 43 | # tty/ comes before char/ so that the VT console is the boot-time |
41 | # default. | 44 | # default. |
42 | obj-y += tty/ | 45 | obj-y += tty/ |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index e7f7fe9b2f09..137d3e730f86 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_ARCH_U8500) += ux500/ | |||
29 | obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o | 29 | obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o |
30 | obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o | 30 | obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o |
31 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ | 31 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ |
32 | obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ | ||
32 | 33 | ||
33 | obj-$(CONFIG_X86) += x86/ | 34 | obj-$(CONFIG_X86) += x86/ |
34 | 35 | ||
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile new file mode 100644 index 000000000000..b7c232e67425 --- /dev/null +++ b/drivers/clk/samsung/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Samsung Clock specific Makefile | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-pll.o | ||
6 | obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o | ||
7 | obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o | ||
8 | obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o | ||
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c new file mode 100644 index 000000000000..71046694d9dd --- /dev/null +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -0,0 +1,1091 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Common Clock Framework support for all Exynos4 SoCs. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk.h> | ||
14 | #include <linux/clkdev.h> | ||
15 | #include <linux/clk-provider.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
18 | |||
19 | #include <plat/cpu.h> | ||
20 | #include "clk.h" | ||
21 | #include "clk-pll.h" | ||
22 | |||
23 | /* Exynos4 clock controller register offsets */ | ||
24 | #define SRC_LEFTBUS 0x4200 | ||
25 | #define DIV_LEFTBUS 0x4500 | ||
26 | #define GATE_IP_LEFTBUS 0x4800 | ||
27 | #define E4X12_GATE_IP_IMAGE 0x4930 | ||
28 | #define SRC_RIGHTBUS 0x8200 | ||
29 | #define DIV_RIGHTBUS 0x8500 | ||
30 | #define GATE_IP_RIGHTBUS 0x8800 | ||
31 | #define E4X12_GATE_IP_PERIR 0x8960 | ||
32 | #define EPLL_LOCK 0xc010 | ||
33 | #define VPLL_LOCK 0xc020 | ||
34 | #define EPLL_CON0 0xc110 | ||
35 | #define EPLL_CON1 0xc114 | ||
36 | #define EPLL_CON2 0xc118 | ||
37 | #define VPLL_CON0 0xc120 | ||
38 | #define VPLL_CON1 0xc124 | ||
39 | #define VPLL_CON2 0xc128 | ||
40 | #define SRC_TOP0 0xc210 | ||
41 | #define SRC_TOP1 0xc214 | ||
42 | #define SRC_CAM 0xc220 | ||
43 | #define SRC_TV 0xc224 | ||
44 | #define SRC_MFC 0xcc28 | ||
45 | #define SRC_G3D 0xc22c | ||
46 | #define E4210_SRC_IMAGE 0xc230 | ||
47 | #define SRC_LCD0 0xc234 | ||
48 | #define E4210_SRC_LCD1 0xc238 | ||
49 | #define E4X12_SRC_ISP 0xc238 | ||
50 | #define SRC_MAUDIO 0xc23c | ||
51 | #define SRC_FSYS 0xc240 | ||
52 | #define SRC_PERIL0 0xc250 | ||
53 | #define SRC_PERIL1 0xc254 | ||
54 | #define E4X12_SRC_CAM1 0xc258 | ||
55 | #define SRC_MASK_TOP 0xc310 | ||
56 | #define SRC_MASK_CAM 0xc320 | ||
57 | #define SRC_MASK_TV 0xc324 | ||
58 | #define SRC_MASK_LCD0 0xc334 | ||
59 | #define E4210_SRC_MASK_LCD1 0xc338 | ||
60 | #define E4X12_SRC_MASK_ISP 0xc338 | ||
61 | #define SRC_MASK_MAUDIO 0xc33c | ||
62 | #define SRC_MASK_FSYS 0xc340 | ||
63 | #define SRC_MASK_PERIL0 0xc350 | ||
64 | #define SRC_MASK_PERIL1 0xc354 | ||
65 | #define DIV_TOP 0xc510 | ||
66 | #define DIV_CAM 0xc520 | ||
67 | #define DIV_TV 0xc524 | ||
68 | #define DIV_MFC 0xc528 | ||
69 | #define DIV_G3D 0xc52c | ||
70 | #define DIV_IMAGE 0xc530 | ||
71 | #define DIV_LCD0 0xc534 | ||
72 | #define E4210_DIV_LCD1 0xc538 | ||
73 | #define E4X12_DIV_ISP 0xc538 | ||
74 | #define DIV_MAUDIO 0xc53c | ||
75 | #define DIV_FSYS0 0xc540 | ||
76 | #define DIV_FSYS1 0xc544 | ||
77 | #define DIV_FSYS2 0xc548 | ||
78 | #define DIV_FSYS3 0xc54c | ||
79 | #define DIV_PERIL0 0xc550 | ||
80 | #define DIV_PERIL1 0xc554 | ||
81 | #define DIV_PERIL2 0xc558 | ||
82 | #define DIV_PERIL3 0xc55c | ||
83 | #define DIV_PERIL4 0xc560 | ||
84 | #define DIV_PERIL5 0xc564 | ||
85 | #define E4X12_DIV_CAM1 0xc568 | ||
86 | #define GATE_SCLK_CAM 0xc820 | ||
87 | #define GATE_IP_CAM 0xc920 | ||
88 | #define GATE_IP_TV 0xc924 | ||
89 | #define GATE_IP_MFC 0xc928 | ||
90 | #define GATE_IP_G3D 0xc92c | ||
91 | #define E4210_GATE_IP_IMAGE 0xc930 | ||
92 | #define GATE_IP_LCD0 0xc934 | ||
93 | #define E4210_GATE_IP_LCD1 0xc938 | ||
94 | #define E4X12_GATE_IP_ISP 0xc938 | ||
95 | #define E4X12_GATE_IP_MAUDIO 0xc93c | ||
96 | #define GATE_IP_FSYS 0xc940 | ||
97 | #define GATE_IP_GPS 0xc94c | ||
98 | #define GATE_IP_PERIL 0xc950 | ||
99 | #define E4210_GATE_IP_PERIR 0xc960 | ||
100 | #define GATE_BLOCK 0xc970 | ||
101 | #define E4X12_MPLL_CON0 0x10108 | ||
102 | #define SRC_DMC 0x10200 | ||
103 | #define SRC_MASK_DMC 0x10300 | ||
104 | #define DIV_DMC0 0x10500 | ||
105 | #define DIV_DMC1 0x10504 | ||
106 | #define GATE_IP_DMC 0x10900 | ||
107 | #define APLL_CON0 0x14100 | ||
108 | #define E4210_MPLL_CON0 0x14108 | ||
109 | #define SRC_CPU 0x14200 | ||
110 | #define DIV_CPU0 0x14500 | ||
111 | #define DIV_CPU1 0x14504 | ||
112 | #define GATE_SCLK_CPU 0x14800 | ||
113 | #define GATE_IP_CPU 0x14900 | ||
114 | #define E4X12_DIV_ISP0 0x18300 | ||
115 | #define E4X12_DIV_ISP1 0x18304 | ||
116 | #define E4X12_GATE_ISP0 0x18800 | ||
117 | #define E4X12_GATE_ISP1 0x18804 | ||
118 | |||
119 | /* the exynos4 soc type */ | ||
120 | enum exynos4_soc { | ||
121 | EXYNOS4210, | ||
122 | EXYNOS4X12, | ||
123 | }; | ||
124 | |||
125 | /* | ||
126 | * Let each supported clock get a unique id. This id is used to lookup the clock | ||
127 | * for device tree based platforms. The clocks are categorized into three | ||
128 | * sections: core, sclk gate and bus interface gate clocks. | ||
129 | * | ||
130 | * When adding a new clock to this list, it is advised to choose a clock | ||
131 | * category and add it to the end of that category. That is because the the | ||
132 | * device tree source file is referring to these ids and any change in the | ||
133 | * sequence number of existing clocks will require corresponding change in the | ||
134 | * device tree files. This limitation would go away when pre-processor support | ||
135 | * for dtc would be available. | ||
136 | */ | ||
137 | enum exynos4_clks { | ||
138 | none, | ||
139 | |||
140 | /* core clocks */ | ||
141 | xxti, xusbxti, fin_pll, fout_apll, fout_mpll, fout_epll, fout_vpll, | ||
142 | sclk_apll, sclk_mpll, sclk_epll, sclk_vpll, arm_clk, aclk200, aclk100, | ||
143 | aclk160, aclk133, mout_mpll_user_t, mout_mpll_user_c, mout_core, | ||
144 | mout_apll, /* 20 */ | ||
145 | |||
146 | /* gate for special clocks (sclk) */ | ||
147 | sclk_fimc0 = 128, sclk_fimc1, sclk_fimc2, sclk_fimc3, sclk_cam0, | ||
148 | sclk_cam1, sclk_csis0, sclk_csis1, sclk_hdmi, sclk_mixer, sclk_dac, | ||
149 | sclk_pixel, sclk_fimd0, sclk_mdnie0, sclk_mdnie_pwm0, sclk_mipi0, | ||
150 | sclk_audio0, sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_mmc4, | ||
151 | sclk_sata, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_uart4, | ||
152 | sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2, | ||
153 | sclk_slimbus, sclk_fimd1, sclk_mipi1, sclk_pcm1, sclk_pcm2, sclk_i2s1, | ||
154 | sclk_i2s2, sclk_mipihsi, sclk_mfc, sclk_pcm0, sclk_g3d, sclk_pwm_isp, | ||
155 | sclk_spi0_isp, sclk_spi1_isp, sclk_uart_isp, | ||
156 | |||
157 | /* gate clocks */ | ||
158 | fimc0 = 256, fimc1, fimc2, fimc3, csis0, csis1, jpeg, smmu_fimc0, | ||
159 | smmu_fimc1, smmu_fimc2, smmu_fimc3, smmu_jpeg, vp, mixer, tvenc, hdmi, | ||
160 | smmu_tv, mfc, smmu_mfcl, smmu_mfcr, g3d, g2d, rotator, mdma, smmu_g2d, | ||
161 | smmu_rotator, smmu_mdma, fimd0, mie0, mdnie0, dsim0, smmu_fimd0, fimd1, | ||
162 | mie1, dsim1, smmu_fimd1, pdma0, pdma1, pcie_phy, sata_phy, tsi, sdmmc0, | ||
163 | sdmmc1, sdmmc2, sdmmc3, sdmmc4, sata, sromc, usb_host, usb_device, pcie, | ||
164 | onenand, nfcon, smmu_pcie, gps, smmu_gps, uart0, uart1, uart2, uart3, | ||
165 | uart4, i2c0, i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, tsadc, | ||
166 | spi0, spi1, spi2, i2s1, i2s2, pcm0, i2s0, pcm1, pcm2, pwm, slimbus, | ||
167 | spdif, ac97, modemif, chipid, sysreg, hdmi_cec, mct, wdt, rtc, keyif, | ||
168 | audss, mipi_hsi, mdma2, pixelasyncm0, pixelasyncm1, fimc_lite0, | ||
169 | fimc_lite1, ppmuispx, ppmuispmx, fimc_isp, fimc_drc, fimc_fd, mcuisp, | ||
170 | gicisp, smmu_isp, smmu_drc, smmu_fd, smmu_lite0, smmu_lite1, mcuctl_isp, | ||
171 | mpwm_isp, i2c0_isp, i2c1_isp, mtcadc_isp, pwm_isp, wdt_isp, uart_isp, | ||
172 | asyncaxim, smmu_ispcx, spi0_isp, spi1_isp, pwm_isp_sclk, spi0_isp_sclk, | ||
173 | spi1_isp_sclk, uart_isp_sclk, | ||
174 | |||
175 | /* mux clocks */ | ||
176 | mout_fimc0 = 384, mout_fimc1, mout_fimc2, mout_fimc3, mout_cam0, | ||
177 | mout_cam1, mout_csis0, mout_csis1, mout_g3d0, mout_g3d1, mout_g3d, | ||
178 | aclk400_mcuisp, | ||
179 | |||
180 | /* div clocks */ | ||
181 | div_isp0 = 450, div_isp1, div_mcuisp0, div_mcuisp1, div_aclk200, | ||
182 | div_aclk400_mcuisp, | ||
183 | |||
184 | nr_clks, | ||
185 | }; | ||
186 | |||
187 | /* | ||
188 | * list of controller registers to be saved and restored during a | ||
189 | * suspend/resume cycle. | ||
190 | */ | ||
191 | static __initdata unsigned long exynos4210_clk_save[] = { | ||
192 | E4210_SRC_IMAGE, | ||
193 | E4210_SRC_LCD1, | ||
194 | E4210_SRC_MASK_LCD1, | ||
195 | E4210_DIV_LCD1, | ||
196 | E4210_GATE_IP_IMAGE, | ||
197 | E4210_GATE_IP_LCD1, | ||
198 | E4210_GATE_IP_PERIR, | ||
199 | E4210_MPLL_CON0, | ||
200 | }; | ||
201 | |||
202 | static __initdata unsigned long exynos4x12_clk_save[] = { | ||
203 | E4X12_GATE_IP_IMAGE, | ||
204 | E4X12_GATE_IP_PERIR, | ||
205 | E4X12_SRC_CAM1, | ||
206 | E4X12_DIV_ISP, | ||
207 | E4X12_DIV_CAM1, | ||
208 | E4X12_MPLL_CON0, | ||
209 | }; | ||
210 | |||
211 | static __initdata unsigned long exynos4_clk_regs[] = { | ||
212 | SRC_LEFTBUS, | ||
213 | DIV_LEFTBUS, | ||
214 | GATE_IP_LEFTBUS, | ||
215 | SRC_RIGHTBUS, | ||
216 | DIV_RIGHTBUS, | ||
217 | GATE_IP_RIGHTBUS, | ||
218 | EPLL_CON0, | ||
219 | EPLL_CON1, | ||
220 | EPLL_CON2, | ||
221 | VPLL_CON0, | ||
222 | VPLL_CON1, | ||
223 | VPLL_CON2, | ||
224 | SRC_TOP0, | ||
225 | SRC_TOP1, | ||
226 | SRC_CAM, | ||
227 | SRC_TV, | ||
228 | SRC_MFC, | ||
229 | SRC_G3D, | ||
230 | SRC_LCD0, | ||
231 | SRC_MAUDIO, | ||
232 | SRC_FSYS, | ||
233 | SRC_PERIL0, | ||
234 | SRC_PERIL1, | ||
235 | SRC_MASK_TOP, | ||
236 | SRC_MASK_CAM, | ||
237 | SRC_MASK_TV, | ||
238 | SRC_MASK_LCD0, | ||
239 | SRC_MASK_MAUDIO, | ||
240 | SRC_MASK_FSYS, | ||
241 | SRC_MASK_PERIL0, | ||
242 | SRC_MASK_PERIL1, | ||
243 | DIV_TOP, | ||
244 | DIV_CAM, | ||
245 | DIV_TV, | ||
246 | DIV_MFC, | ||
247 | DIV_G3D, | ||
248 | DIV_IMAGE, | ||
249 | DIV_LCD0, | ||
250 | DIV_MAUDIO, | ||
251 | DIV_FSYS0, | ||
252 | DIV_FSYS1, | ||
253 | DIV_FSYS2, | ||
254 | DIV_FSYS3, | ||
255 | DIV_PERIL0, | ||
256 | DIV_PERIL1, | ||
257 | DIV_PERIL2, | ||
258 | DIV_PERIL3, | ||
259 | DIV_PERIL4, | ||
260 | DIV_PERIL5, | ||
261 | GATE_SCLK_CAM, | ||
262 | GATE_IP_CAM, | ||
263 | GATE_IP_TV, | ||
264 | GATE_IP_MFC, | ||
265 | GATE_IP_G3D, | ||
266 | GATE_IP_LCD0, | ||
267 | GATE_IP_FSYS, | ||
268 | GATE_IP_GPS, | ||
269 | GATE_IP_PERIL, | ||
270 | GATE_BLOCK, | ||
271 | SRC_MASK_DMC, | ||
272 | SRC_DMC, | ||
273 | DIV_DMC0, | ||
274 | DIV_DMC1, | ||
275 | GATE_IP_DMC, | ||
276 | APLL_CON0, | ||
277 | SRC_CPU, | ||
278 | DIV_CPU0, | ||
279 | DIV_CPU1, | ||
280 | GATE_SCLK_CPU, | ||
281 | GATE_IP_CPU, | ||
282 | }; | ||
283 | |||
284 | /* list of all parent clock list */ | ||
285 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; | ||
286 | PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", }; | ||
287 | PNAME(mout_epll_p) = { "fin_pll", "fout_epll", }; | ||
288 | PNAME(mout_vpllsrc_p) = { "fin_pll", "sclk_hdmi24m", }; | ||
289 | PNAME(mout_vpll_p) = { "fin_pll", "fout_vpll", }; | ||
290 | PNAME(sclk_evpll_p) = { "sclk_epll", "sclk_vpll", }; | ||
291 | PNAME(mout_mfc_p) = { "mout_mfc0", "mout_mfc1", }; | ||
292 | PNAME(mout_g3d_p) = { "mout_g3d0", "mout_g3d1", }; | ||
293 | PNAME(mout_g2d_p) = { "mout_g2d0", "mout_g2d1", }; | ||
294 | PNAME(mout_hdmi_p) = { "sclk_pixel", "sclk_hdmiphy", }; | ||
295 | PNAME(mout_jpeg_p) = { "mout_jpeg0", "mout_jpeg1", }; | ||
296 | PNAME(mout_spdif_p) = { "sclk_audio0", "sclk_audio1", "sclk_audio2", | ||
297 | "spdif_extclk", }; | ||
298 | PNAME(mout_onenand_p) = {"aclk133", "aclk160", }; | ||
299 | PNAME(mout_onenand1_p) = {"mout_onenand", "sclk_vpll", }; | ||
300 | |||
301 | /* Exynos 4210-specific parent groups */ | ||
302 | PNAME(sclk_vpll_p4210) = { "mout_vpllsrc", "fout_vpll", }; | ||
303 | PNAME(mout_core_p4210) = { "mout_apll", "sclk_mpll", }; | ||
304 | PNAME(sclk_ampll_p4210) = { "sclk_mpll", "sclk_apll", }; | ||
305 | PNAME(group1_p4210) = { "xxti", "xusbxti", "sclk_hdmi24m", | ||
306 | "sclk_usbphy0", "none", "sclk_hdmiphy", | ||
307 | "sclk_mpll", "sclk_epll", "sclk_vpll", }; | ||
308 | PNAME(mout_audio0_p4210) = { "cdclk0", "none", "sclk_hdmi24m", | ||
309 | "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", | ||
310 | "sclk_epll", "sclk_vpll" }; | ||
311 | PNAME(mout_audio1_p4210) = { "cdclk1", "none", "sclk_hdmi24m", | ||
312 | "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", | ||
313 | "sclk_epll", "sclk_vpll", }; | ||
314 | PNAME(mout_audio2_p4210) = { "cdclk2", "none", "sclk_hdmi24m", | ||
315 | "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", | ||
316 | "sclk_epll", "sclk_vpll", }; | ||
317 | PNAME(mout_mixer_p4210) = { "sclk_dac", "sclk_hdmi", }; | ||
318 | PNAME(mout_dac_p4210) = { "sclk_vpll", "sclk_hdmiphy", }; | ||
319 | |||
320 | /* Exynos 4x12-specific parent groups */ | ||
321 | PNAME(mout_mpll_user_p4x12) = { "fin_pll", "sclk_mpll", }; | ||
322 | PNAME(mout_core_p4x12) = { "mout_apll", "mout_mpll_user_c", }; | ||
323 | PNAME(sclk_ampll_p4x12) = { "mout_mpll_user_t", "sclk_apll", }; | ||
324 | PNAME(group1_p4x12) = { "xxti", "xusbxti", "sclk_hdmi24m", "sclk_usbphy0", | ||
325 | "none", "sclk_hdmiphy", "mout_mpll_user_t", | ||
326 | "sclk_epll", "sclk_vpll", }; | ||
327 | PNAME(mout_audio0_p4x12) = { "cdclk0", "none", "sclk_hdmi24m", | ||
328 | "sclk_usbphy0", "xxti", "xusbxti", | ||
329 | "mout_mpll_user_t", "sclk_epll", "sclk_vpll" }; | ||
330 | PNAME(mout_audio1_p4x12) = { "cdclk1", "none", "sclk_hdmi24m", | ||
331 | "sclk_usbphy0", "xxti", "xusbxti", | ||
332 | "mout_mpll_user_t", "sclk_epll", "sclk_vpll", }; | ||
333 | PNAME(mout_audio2_p4x12) = { "cdclk2", "none", "sclk_hdmi24m", | ||
334 | "sclk_usbphy0", "xxti", "xusbxti", | ||
335 | "mout_mpll_user_t", "sclk_epll", "sclk_vpll", }; | ||
336 | PNAME(aclk_p4412) = { "mout_mpll_user_t", "sclk_apll", }; | ||
337 | PNAME(mout_user_aclk400_mcuisp_p4x12) = {"fin_pll", "div_aclk400_mcuisp", }; | ||
338 | PNAME(mout_user_aclk200_p4x12) = {"fin_pll", "div_aclk200", }; | ||
339 | PNAME(mout_user_aclk266_gps_p4x12) = {"fin_pll", "div_aclk266_gps", }; | ||
340 | |||
341 | /* fixed rate clocks generated outside the soc */ | ||
342 | struct samsung_fixed_rate_clock exynos4_fixed_rate_ext_clks[] __initdata = { | ||
343 | FRATE(xxti, "xxti", NULL, CLK_IS_ROOT, 0), | ||
344 | FRATE(xusbxti, "xusbxti", NULL, CLK_IS_ROOT, 0), | ||
345 | }; | ||
346 | |||
347 | /* fixed rate clocks generated inside the soc */ | ||
348 | struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = { | ||
349 | FRATE(none, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 24000000), | ||
350 | FRATE(none, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000), | ||
351 | FRATE(none, "sclk_usbphy0", NULL, CLK_IS_ROOT, 48000000), | ||
352 | }; | ||
353 | |||
354 | struct samsung_fixed_rate_clock exynos4210_fixed_rate_clks[] __initdata = { | ||
355 | FRATE(none, "sclk_usbphy1", NULL, CLK_IS_ROOT, 48000000), | ||
356 | }; | ||
357 | |||
358 | /* list of mux clocks supported in all exynos4 soc's */ | ||
359 | struct samsung_mux_clock exynos4_mux_clks[] __initdata = { | ||
360 | MUX_F(mout_apll, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, | ||
361 | CLK_SET_RATE_PARENT, 0), | ||
362 | MUX(none, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1), | ||
363 | MUX(none, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1), | ||
364 | MUX(none, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1), | ||
365 | MUX_F(mout_g3d1, "mout_g3d1", sclk_evpll_p, SRC_G3D, 4, 1, | ||
366 | CLK_SET_RATE_PARENT, 0), | ||
367 | MUX_F(mout_g3d, "mout_g3d", mout_g3d_p, SRC_G3D, 8, 1, | ||
368 | CLK_SET_RATE_PARENT, 0), | ||
369 | MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIL1, 8, 2), | ||
370 | MUX(none, "mout_onenand1", mout_onenand1_p, SRC_TOP0, 0, 1), | ||
371 | MUX_A(sclk_epll, "sclk_epll", mout_epll_p, SRC_TOP0, 4, 1, "sclk_epll"), | ||
372 | MUX(none, "mout_onenand", mout_onenand_p, SRC_TOP0, 28, 1), | ||
373 | }; | ||
374 | |||
375 | /* list of mux clocks supported in exynos4210 soc */ | ||
376 | struct samsung_mux_clock exynos4210_mux_clks[] __initdata = { | ||
377 | MUX(none, "mout_aclk200", sclk_ampll_p4210, SRC_TOP0, 12, 1), | ||
378 | MUX(none, "mout_aclk100", sclk_ampll_p4210, SRC_TOP0, 16, 1), | ||
379 | MUX(none, "mout_aclk160", sclk_ampll_p4210, SRC_TOP0, 20, 1), | ||
380 | MUX(none, "mout_aclk133", sclk_ampll_p4210, SRC_TOP0, 24, 1), | ||
381 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1), | ||
382 | MUX(none, "mout_mixer", mout_mixer_p4210, SRC_TV, 4, 1), | ||
383 | MUX(none, "mout_dac", mout_dac_p4210, SRC_TV, 8, 1), | ||
384 | MUX(none, "mout_g2d0", sclk_ampll_p4210, E4210_SRC_IMAGE, 0, 1), | ||
385 | MUX(none, "mout_g2d1", sclk_evpll_p, E4210_SRC_IMAGE, 4, 1), | ||
386 | MUX(none, "mout_g2d", mout_g2d_p, E4210_SRC_IMAGE, 8, 1), | ||
387 | MUX(none, "mout_fimd1", group1_p4210, E4210_SRC_LCD1, 0, 4), | ||
388 | MUX(none, "mout_mipi1", group1_p4210, E4210_SRC_LCD1, 12, 4), | ||
389 | MUX_A(sclk_mpll, "sclk_mpll", mout_mpll_p, SRC_CPU, 8, 1, "sclk_mpll"), | ||
390 | MUX_A(mout_core, "mout_core", mout_core_p4210, | ||
391 | SRC_CPU, 16, 1, "mout_core"), | ||
392 | MUX_A(sclk_vpll, "sclk_vpll", sclk_vpll_p4210, | ||
393 | SRC_TOP0, 8, 1, "sclk_vpll"), | ||
394 | MUX(mout_fimc0, "mout_fimc0", group1_p4210, SRC_CAM, 0, 4), | ||
395 | MUX(mout_fimc1, "mout_fimc1", group1_p4210, SRC_CAM, 4, 4), | ||
396 | MUX(mout_fimc2, "mout_fimc2", group1_p4210, SRC_CAM, 8, 4), | ||
397 | MUX(mout_fimc3, "mout_fimc3", group1_p4210, SRC_CAM, 12, 4), | ||
398 | MUX(mout_cam0, "mout_cam0", group1_p4210, SRC_CAM, 16, 4), | ||
399 | MUX(mout_cam1, "mout_cam1", group1_p4210, SRC_CAM, 20, 4), | ||
400 | MUX(mout_csis0, "mout_csis0", group1_p4210, SRC_CAM, 24, 4), | ||
401 | MUX(mout_csis1, "mout_csis1", group1_p4210, SRC_CAM, 28, 4), | ||
402 | MUX(none, "mout_mfc0", sclk_ampll_p4210, SRC_MFC, 0, 1), | ||
403 | MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4210, SRC_G3D, 0, 1, | ||
404 | CLK_SET_RATE_PARENT, 0), | ||
405 | MUX(none, "mout_fimd0", group1_p4210, SRC_LCD0, 0, 4), | ||
406 | MUX(none, "mout_mipi0", group1_p4210, SRC_LCD0, 12, 4), | ||
407 | MUX(none, "mout_audio0", mout_audio0_p4210, SRC_MAUDIO, 0, 4), | ||
408 | MUX(none, "mout_mmc0", group1_p4210, SRC_FSYS, 0, 4), | ||
409 | MUX(none, "mout_mmc1", group1_p4210, SRC_FSYS, 4, 4), | ||
410 | MUX(none, "mout_mmc2", group1_p4210, SRC_FSYS, 8, 4), | ||
411 | MUX(none, "mout_mmc3", group1_p4210, SRC_FSYS, 12, 4), | ||
412 | MUX(none, "mout_mmc4", group1_p4210, SRC_FSYS, 16, 4), | ||
413 | MUX(none, "mout_sata", sclk_ampll_p4210, SRC_FSYS, 24, 1), | ||
414 | MUX(none, "mout_uart0", group1_p4210, SRC_PERIL0, 0, 4), | ||
415 | MUX(none, "mout_uart1", group1_p4210, SRC_PERIL0, 4, 4), | ||
416 | MUX(none, "mout_uart2", group1_p4210, SRC_PERIL0, 8, 4), | ||
417 | MUX(none, "mout_uart3", group1_p4210, SRC_PERIL0, 12, 4), | ||
418 | MUX(none, "mout_uart4", group1_p4210, SRC_PERIL0, 16, 4), | ||
419 | MUX(none, "mout_audio1", mout_audio1_p4210, SRC_PERIL1, 0, 4), | ||
420 | MUX(none, "mout_audio2", mout_audio2_p4210, SRC_PERIL1, 4, 4), | ||
421 | MUX(none, "mout_spi0", group1_p4210, SRC_PERIL1, 16, 4), | ||
422 | MUX(none, "mout_spi1", group1_p4210, SRC_PERIL1, 20, 4), | ||
423 | MUX(none, "mout_spi2", group1_p4210, SRC_PERIL1, 24, 4), | ||
424 | }; | ||
425 | |||
426 | /* list of mux clocks supported in exynos4x12 soc */ | ||
427 | struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = { | ||
428 | MUX(mout_mpll_user_c, "mout_mpll_user_c", mout_mpll_user_p4x12, | ||
429 | SRC_CPU, 24, 1), | ||
430 | MUX(none, "mout_aclk266_gps", aclk_p4412, SRC_TOP1, 4, 1), | ||
431 | MUX(none, "mout_aclk400_mcuisp", aclk_p4412, SRC_TOP1, 8, 1), | ||
432 | MUX(mout_mpll_user_t, "mout_mpll_user_t", mout_mpll_user_p4x12, | ||
433 | SRC_TOP1, 12, 1), | ||
434 | MUX(none, "mout_user_aclk266_gps", mout_user_aclk266_gps_p4x12, | ||
435 | SRC_TOP1, 16, 1), | ||
436 | MUX(aclk200, "aclk200", mout_user_aclk200_p4x12, SRC_TOP1, 20, 1), | ||
437 | MUX(aclk400_mcuisp, "aclk400_mcuisp", mout_user_aclk400_mcuisp_p4x12, | ||
438 | SRC_TOP1, 24, 1), | ||
439 | MUX(none, "mout_aclk200", aclk_p4412, SRC_TOP0, 12, 1), | ||
440 | MUX(none, "mout_aclk100", aclk_p4412, SRC_TOP0, 16, 1), | ||
441 | MUX(none, "mout_aclk160", aclk_p4412, SRC_TOP0, 20, 1), | ||
442 | MUX(none, "mout_aclk133", aclk_p4412, SRC_TOP0, 24, 1), | ||
443 | MUX(none, "mout_mdnie0", group1_p4x12, SRC_LCD0, 4, 4), | ||
444 | MUX(none, "mout_mdnie_pwm0", group1_p4x12, SRC_LCD0, 8, 4), | ||
445 | MUX(none, "mout_sata", sclk_ampll_p4x12, SRC_FSYS, 24, 1), | ||
446 | MUX(none, "mout_jpeg0", sclk_ampll_p4x12, E4X12_SRC_CAM1, 0, 1), | ||
447 | MUX(none, "mout_jpeg1", sclk_evpll_p, E4X12_SRC_CAM1, 4, 1), | ||
448 | MUX(none, "mout_jpeg", mout_jpeg_p, E4X12_SRC_CAM1, 8, 1), | ||
449 | MUX_A(sclk_mpll, "sclk_mpll", mout_mpll_p, | ||
450 | SRC_DMC, 12, 1, "sclk_mpll"), | ||
451 | MUX_A(sclk_vpll, "sclk_vpll", mout_vpll_p, | ||
452 | SRC_TOP0, 8, 1, "sclk_vpll"), | ||
453 | MUX(mout_core, "mout_core", mout_core_p4x12, SRC_CPU, 16, 1), | ||
454 | MUX(mout_fimc0, "mout_fimc0", group1_p4x12, SRC_CAM, 0, 4), | ||
455 | MUX(mout_fimc1, "mout_fimc1", group1_p4x12, SRC_CAM, 4, 4), | ||
456 | MUX(mout_fimc2, "mout_fimc2", group1_p4x12, SRC_CAM, 8, 4), | ||
457 | MUX(mout_fimc3, "mout_fimc3", group1_p4x12, SRC_CAM, 12, 4), | ||
458 | MUX(mout_cam0, "mout_cam0", group1_p4x12, SRC_CAM, 16, 4), | ||
459 | MUX(mout_cam1, "mout_cam1", group1_p4x12, SRC_CAM, 20, 4), | ||
460 | MUX(mout_csis0, "mout_csis0", group1_p4x12, SRC_CAM, 24, 4), | ||
461 | MUX(mout_csis1, "mout_csis1", group1_p4x12, SRC_CAM, 28, 4), | ||
462 | MUX(none, "mout_mfc0", sclk_ampll_p4x12, SRC_MFC, 0, 1), | ||
463 | MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4x12, SRC_G3D, 0, 1, | ||
464 | CLK_SET_RATE_PARENT, 0), | ||
465 | MUX(none, "mout_fimd0", group1_p4x12, SRC_LCD0, 0, 4), | ||
466 | MUX(none, "mout_mipi0", group1_p4x12, SRC_LCD0, 12, 4), | ||
467 | MUX(none, "mout_audio0", mout_audio0_p4x12, SRC_MAUDIO, 0, 4), | ||
468 | MUX(none, "mout_mmc0", group1_p4x12, SRC_FSYS, 0, 4), | ||
469 | MUX(none, "mout_mmc1", group1_p4x12, SRC_FSYS, 4, 4), | ||
470 | MUX(none, "mout_mmc2", group1_p4x12, SRC_FSYS, 8, 4), | ||
471 | MUX(none, "mout_mmc3", group1_p4x12, SRC_FSYS, 12, 4), | ||
472 | MUX(none, "mout_mmc4", group1_p4x12, SRC_FSYS, 16, 4), | ||
473 | MUX(none, "mout_mipihsi", aclk_p4412, SRC_FSYS, 24, 1), | ||
474 | MUX(none, "mout_uart0", group1_p4x12, SRC_PERIL0, 0, 4), | ||
475 | MUX(none, "mout_uart1", group1_p4x12, SRC_PERIL0, 4, 4), | ||
476 | MUX(none, "mout_uart2", group1_p4x12, SRC_PERIL0, 8, 4), | ||
477 | MUX(none, "mout_uart3", group1_p4x12, SRC_PERIL0, 12, 4), | ||
478 | MUX(none, "mout_uart4", group1_p4x12, SRC_PERIL0, 16, 4), | ||
479 | MUX(none, "mout_audio1", mout_audio1_p4x12, SRC_PERIL1, 0, 4), | ||
480 | MUX(none, "mout_audio2", mout_audio2_p4x12, SRC_PERIL1, 4, 4), | ||
481 | MUX(none, "mout_spi0", group1_p4x12, SRC_PERIL1, 16, 4), | ||
482 | MUX(none, "mout_spi1", group1_p4x12, SRC_PERIL1, 20, 4), | ||
483 | MUX(none, "mout_spi2", group1_p4x12, SRC_PERIL1, 24, 4), | ||
484 | MUX(none, "mout_pwm_isp", group1_p4x12, E4X12_SRC_ISP, 0, 4), | ||
485 | MUX(none, "mout_spi0_isp", group1_p4x12, E4X12_SRC_ISP, 4, 4), | ||
486 | MUX(none, "mout_spi1_isp", group1_p4x12, E4X12_SRC_ISP, 8, 4), | ||
487 | MUX(none, "mout_uart_isp", group1_p4x12, E4X12_SRC_ISP, 12, 4), | ||
488 | }; | ||
489 | |||
490 | /* list of divider clocks supported in all exynos4 soc's */ | ||
491 | struct samsung_div_clock exynos4_div_clks[] __initdata = { | ||
492 | DIV(none, "div_core", "mout_core", DIV_CPU0, 0, 3), | ||
493 | DIV(none, "div_core2", "div_core", DIV_CPU0, 28, 3), | ||
494 | DIV(none, "div_fimc0", "mout_fimc0", DIV_CAM, 0, 4), | ||
495 | DIV(none, "div_fimc1", "mout_fimc1", DIV_CAM, 4, 4), | ||
496 | DIV(none, "div_fimc2", "mout_fimc2", DIV_CAM, 8, 4), | ||
497 | DIV(none, "div_fimc3", "mout_fimc3", DIV_CAM, 12, 4), | ||
498 | DIV(none, "div_cam0", "mout_cam0", DIV_CAM, 16, 4), | ||
499 | DIV(none, "div_cam1", "mout_cam1", DIV_CAM, 20, 4), | ||
500 | DIV(none, "div_csis0", "mout_csis0", DIV_CAM, 24, 4), | ||
501 | DIV(none, "div_csis1", "mout_csis1", DIV_CAM, 28, 4), | ||
502 | DIV(sclk_mfc, "sclk_mfc", "mout_mfc", DIV_MFC, 0, 4), | ||
503 | DIV_F(none, "div_g3d", "mout_g3d", DIV_G3D, 0, 4, | ||
504 | CLK_SET_RATE_PARENT, 0), | ||
505 | DIV(none, "div_fimd0", "mout_fimd0", DIV_LCD0, 0, 4), | ||
506 | DIV(none, "div_mipi0", "mout_mipi0", DIV_LCD0, 16, 4), | ||
507 | DIV(none, "div_audio0", "mout_audio0", DIV_MAUDIO, 0, 4), | ||
508 | DIV(sclk_pcm0, "sclk_pcm0", "sclk_audio0", DIV_MAUDIO, 4, 8), | ||
509 | DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4), | ||
510 | DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4), | ||
511 | DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4), | ||
512 | DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4), | ||
513 | DIV(sclk_pixel, "sclk_pixel", "sclk_vpll", DIV_TV, 0, 4), | ||
514 | DIV(aclk100, "aclk100", "mout_aclk100", DIV_TOP, 4, 4), | ||
515 | DIV(aclk160, "aclk160", "mout_aclk160", DIV_TOP, 8, 3), | ||
516 | DIV(aclk133, "aclk133", "mout_aclk133", DIV_TOP, 12, 3), | ||
517 | DIV(none, "div_onenand", "mout_onenand1", DIV_TOP, 16, 3), | ||
518 | DIV(sclk_slimbus, "sclk_slimbus", "sclk_epll", DIV_PERIL3, 4, 4), | ||
519 | DIV(sclk_pcm1, "sclk_pcm1", "sclk_audio1", DIV_PERIL4, 4, 8), | ||
520 | DIV(sclk_pcm2, "sclk_pcm2", "sclk_audio2", DIV_PERIL4, 20, 8), | ||
521 | DIV(sclk_i2s1, "sclk_i2s1", "sclk_audio1", DIV_PERIL5, 0, 6), | ||
522 | DIV(sclk_i2s2, "sclk_i2s2", "sclk_audio2", DIV_PERIL5, 8, 6), | ||
523 | DIV(none, "div_mmc4", "mout_mmc4", DIV_FSYS3, 0, 4), | ||
524 | DIV(none, "div_mmc_pre4", "div_mmc4", DIV_FSYS3, 8, 8), | ||
525 | DIV(none, "div_uart0", "mout_uart0", DIV_PERIL0, 0, 4), | ||
526 | DIV(none, "div_uart1", "mout_uart1", DIV_PERIL0, 4, 4), | ||
527 | DIV(none, "div_uart2", "mout_uart2", DIV_PERIL0, 8, 4), | ||
528 | DIV(none, "div_uart3", "mout_uart3", DIV_PERIL0, 12, 4), | ||
529 | DIV(none, "div_uart4", "mout_uart4", DIV_PERIL0, 16, 4), | ||
530 | DIV(none, "div_spi0", "mout_spi0", DIV_PERIL1, 0, 4), | ||
531 | DIV(none, "div_spi_pre0", "div_spi0", DIV_PERIL1, 8, 8), | ||
532 | DIV(none, "div_spi1", "mout_spi1", DIV_PERIL1, 16, 4), | ||
533 | DIV(none, "div_spi_pre1", "div_spi1", DIV_PERIL1, 24, 8), | ||
534 | DIV(none, "div_spi2", "mout_spi2", DIV_PERIL2, 0, 4), | ||
535 | DIV(none, "div_spi_pre2", "div_spi2", DIV_PERIL2, 8, 8), | ||
536 | DIV(none, "div_audio1", "mout_audio1", DIV_PERIL4, 0, 4), | ||
537 | DIV(none, "div_audio2", "mout_audio2", DIV_PERIL4, 16, 4), | ||
538 | DIV_A(arm_clk, "arm_clk", "div_core2", DIV_CPU0, 28, 3, "arm_clk"), | ||
539 | DIV_A(sclk_apll, "sclk_apll", "mout_apll", | ||
540 | DIV_CPU0, 24, 3, "sclk_apll"), | ||
541 | DIV_F(none, "div_mipi_pre0", "div_mipi0", DIV_LCD0, 20, 4, | ||
542 | CLK_SET_RATE_PARENT, 0), | ||
543 | DIV_F(none, "div_mmc_pre0", "div_mmc0", DIV_FSYS1, 8, 8, | ||
544 | CLK_SET_RATE_PARENT, 0), | ||
545 | DIV_F(none, "div_mmc_pre1", "div_mmc1", DIV_FSYS1, 24, 8, | ||
546 | CLK_SET_RATE_PARENT, 0), | ||
547 | DIV_F(none, "div_mmc_pre2", "div_mmc2", DIV_FSYS2, 8, 8, | ||
548 | CLK_SET_RATE_PARENT, 0), | ||
549 | DIV_F(none, "div_mmc_pre3", "div_mmc3", DIV_FSYS2, 24, 8, | ||
550 | CLK_SET_RATE_PARENT, 0), | ||
551 | }; | ||
552 | |||
553 | /* list of divider clocks supported in exynos4210 soc */ | ||
554 | struct samsung_div_clock exynos4210_div_clks[] __initdata = { | ||
555 | DIV(aclk200, "aclk200", "mout_aclk200", DIV_TOP, 0, 3), | ||
556 | DIV(none, "div_g2d", "mout_g2d", DIV_IMAGE, 0, 4), | ||
557 | DIV(none, "div_fimd1", "mout_fimd1", E4210_DIV_LCD1, 0, 4), | ||
558 | DIV(none, "div_mipi1", "mout_mipi1", E4210_DIV_LCD1, 16, 4), | ||
559 | DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4), | ||
560 | DIV_F(none, "div_mipi_pre1", "div_mipi1", E4210_DIV_LCD1, 20, 4, | ||
561 | CLK_SET_RATE_PARENT, 0), | ||
562 | }; | ||
563 | |||
564 | /* list of divider clocks supported in exynos4x12 soc */ | ||
565 | struct samsung_div_clock exynos4x12_div_clks[] __initdata = { | ||
566 | DIV(none, "div_mdnie0", "mout_mdnie0", DIV_LCD0, 4, 4), | ||
567 | DIV(none, "div_mdnie_pwm0", "mout_mdnie_pwm0", DIV_LCD0, 8, 4), | ||
568 | DIV(none, "div_mdnie_pwm_pre0", "div_mdnie_pwm0", DIV_LCD0, 12, 4), | ||
569 | DIV(none, "div_mipihsi", "mout_mipihsi", DIV_FSYS0, 20, 4), | ||
570 | DIV(none, "div_jpeg", "mout_jpeg", E4X12_DIV_CAM1, 0, 4), | ||
571 | DIV(div_aclk200, "div_aclk200", "mout_aclk200", DIV_TOP, 0, 3), | ||
572 | DIV(none, "div_aclk266_gps", "mout_aclk266_gps", DIV_TOP, 20, 3), | ||
573 | DIV(div_aclk400_mcuisp, "div_aclk400_mcuisp", "mout_aclk400_mcuisp", | ||
574 | DIV_TOP, 24, 3), | ||
575 | DIV(none, "div_pwm_isp", "mout_pwm_isp", E4X12_DIV_ISP, 0, 4), | ||
576 | DIV(none, "div_spi0_isp", "mout_spi0_isp", E4X12_DIV_ISP, 4, 4), | ||
577 | DIV(none, "div_spi0_isp_pre", "div_spi0_isp", E4X12_DIV_ISP, 8, 8), | ||
578 | DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4), | ||
579 | DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8), | ||
580 | DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4), | ||
581 | DIV(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3), | ||
582 | DIV(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3), | ||
583 | DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3), | ||
584 | DIV(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 4, 3), | ||
585 | DIV(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 8, 3), | ||
586 | }; | ||
587 | |||
588 | /* list of gate clocks supported in all exynos4 soc's */ | ||
589 | struct samsung_gate_clock exynos4_gate_clks[] __initdata = { | ||
590 | /* | ||
591 | * After all Exynos4 based platforms are migrated to use device tree, | ||
592 | * the device name and clock alias names specified below for some | ||
593 | * of the clocks can be removed. | ||
594 | */ | ||
595 | GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0), | ||
596 | GATE(sclk_spdif, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0, 0), | ||
597 | GATE(jpeg, "jpeg", "aclk160", GATE_IP_CAM, 6, 0, 0), | ||
598 | GATE(mie0, "mie0", "aclk160", GATE_IP_LCD0, 1, 0, 0), | ||
599 | GATE(dsim0, "dsim0", "aclk160", GATE_IP_LCD0, 3, 0, 0), | ||
600 | GATE(fimd1, "fimd1", "aclk160", E4210_GATE_IP_LCD1, 0, 0, 0), | ||
601 | GATE(mie1, "mie1", "aclk160", E4210_GATE_IP_LCD1, 1, 0, 0), | ||
602 | GATE(dsim1, "dsim1", "aclk160", E4210_GATE_IP_LCD1, 3, 0, 0), | ||
603 | GATE(smmu_fimd1, "smmu_fimd1", "aclk160", E4210_GATE_IP_LCD1, 4, 0, 0), | ||
604 | GATE(tsi, "tsi", "aclk133", GATE_IP_FSYS, 4, 0, 0), | ||
605 | GATE(sromc, "sromc", "aclk133", GATE_IP_FSYS, 11, 0, 0), | ||
606 | GATE(sclk_g3d, "sclk_g3d", "div_g3d", GATE_IP_G3D, 0, | ||
607 | CLK_SET_RATE_PARENT, 0), | ||
608 | GATE(usb_device, "usb_device", "aclk133", GATE_IP_FSYS, 13, 0, 0), | ||
609 | GATE(onenand, "onenand", "aclk133", GATE_IP_FSYS, 15, 0, 0), | ||
610 | GATE(nfcon, "nfcon", "aclk133", GATE_IP_FSYS, 16, 0, 0), | ||
611 | GATE(gps, "gps", "aclk133", GATE_IP_GPS, 0, 0, 0), | ||
612 | GATE(smmu_gps, "smmu_gps", "aclk133", GATE_IP_GPS, 1, 0, 0), | ||
613 | GATE(slimbus, "slimbus", "aclk100", GATE_IP_PERIL, 25, 0, 0), | ||
614 | GATE(sclk_cam0, "sclk_cam0", "div_cam0", GATE_SCLK_CAM, 4, | ||
615 | CLK_SET_RATE_PARENT, 0), | ||
616 | GATE(sclk_cam1, "sclk_cam1", "div_cam1", GATE_SCLK_CAM, 5, | ||
617 | CLK_SET_RATE_PARENT, 0), | ||
618 | GATE(sclk_mipi0, "sclk_mipi0", "div_mipi_pre0", | ||
619 | SRC_MASK_LCD0, 12, CLK_SET_RATE_PARENT, 0), | ||
620 | GATE(sclk_audio0, "sclk_audio0", "div_audio0", SRC_MASK_MAUDIO, 0, | ||
621 | CLK_SET_RATE_PARENT, 0), | ||
622 | GATE(sclk_audio1, "sclk_audio1", "div_audio1", SRC_MASK_PERIL1, 0, | ||
623 | CLK_SET_RATE_PARENT, 0), | ||
624 | GATE_D(vp, "s5p-mixer", "vp", "aclk160", GATE_IP_TV, 0, 0, 0), | ||
625 | GATE_D(mixer, "s5p-mixer", "mixer", "aclk160", GATE_IP_TV, 1, 0, 0), | ||
626 | GATE_D(hdmi, "exynos4-hdmi", "hdmi", "aclk160", GATE_IP_TV, 3, 0, 0), | ||
627 | GATE_A(pwm, "pwm", "aclk100", GATE_IP_PERIL, 24, 0, 0, "timers"), | ||
628 | GATE_A(sdmmc4, "sdmmc4", "aclk133", GATE_IP_FSYS, 9, 0, 0, "biu"), | ||
629 | GATE_A(usb_host, "usb_host", "aclk133", | ||
630 | GATE_IP_FSYS, 12, 0, 0, "usbhost"), | ||
631 | GATE_DA(sclk_fimc0, "exynos4-fimc.0", "sclk_fimc0", "div_fimc0", | ||
632 | SRC_MASK_CAM, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), | ||
633 | GATE_DA(sclk_fimc1, "exynos4-fimc.1", "sclk_fimc1", "div_fimc1", | ||
634 | SRC_MASK_CAM, 4, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), | ||
635 | GATE_DA(sclk_fimc2, "exynos4-fimc.2", "sclk_fimc2", "div_fimc2", | ||
636 | SRC_MASK_CAM, 8, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), | ||
637 | GATE_DA(sclk_fimc3, "exynos4-fimc.3", "sclk_fimc3", "div_fimc3", | ||
638 | SRC_MASK_CAM, 12, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), | ||
639 | GATE_DA(sclk_csis0, "s5p-mipi-csis.0", "sclk_csis0", "div_csis0", | ||
640 | SRC_MASK_CAM, 24, CLK_SET_RATE_PARENT, 0, "sclk_csis"), | ||
641 | GATE_DA(sclk_csis1, "s5p-mipi-csis.1", "sclk_csis1", "div_csis1", | ||
642 | SRC_MASK_CAM, 28, CLK_SET_RATE_PARENT, 0, "sclk_csis"), | ||
643 | GATE_DA(sclk_fimd0, "exynos4-fb.0", "sclk_fimd0", "div_fimd0", | ||
644 | SRC_MASK_LCD0, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimd"), | ||
645 | GATE_DA(sclk_mmc0, "exynos4-sdhci.0", "sclk_mmc0", "div_mmc_pre0", | ||
646 | SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0, | ||
647 | "mmc_busclk.2"), | ||
648 | GATE_DA(sclk_mmc1, "exynos4-sdhci.1", "sclk_mmc1", "div_mmc_pre1", | ||
649 | SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0, | ||
650 | "mmc_busclk.2"), | ||
651 | GATE_DA(sclk_mmc2, "exynos4-sdhci.2", "sclk_mmc2", "div_mmc_pre2", | ||
652 | SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0, | ||
653 | "mmc_busclk.2"), | ||
654 | GATE_DA(sclk_mmc3, "exynos4-sdhci.3", "sclk_mmc3", "div_mmc_pre3", | ||
655 | SRC_MASK_FSYS, 12, CLK_SET_RATE_PARENT, 0, | ||
656 | "mmc_busclk.2"), | ||
657 | GATE_DA(sclk_mmc4, NULL, "sclk_mmc4", "div_mmc_pre4", | ||
658 | SRC_MASK_FSYS, 16, CLK_SET_RATE_PARENT, 0, "ciu"), | ||
659 | GATE_DA(sclk_uart0, "exynos4210-uart.0", "uclk0", "div_uart0", | ||
660 | SRC_MASK_PERIL0, 0, CLK_SET_RATE_PARENT, | ||
661 | 0, "clk_uart_baud0"), | ||
662 | GATE_DA(sclk_uart1, "exynos4210-uart.1", "uclk1", "div_uart1", | ||
663 | SRC_MASK_PERIL0, 4, CLK_SET_RATE_PARENT, | ||
664 | 0, "clk_uart_baud0"), | ||
665 | GATE_DA(sclk_uart2, "exynos4210-uart.2", "uclk2", "div_uart2", | ||
666 | SRC_MASK_PERIL0, 8, CLK_SET_RATE_PARENT, | ||
667 | 0, "clk_uart_baud0"), | ||
668 | GATE_DA(sclk_uart3, "exynos4210-uart.3", "uclk3", "div_uart3", | ||
669 | SRC_MASK_PERIL0, 12, CLK_SET_RATE_PARENT, | ||
670 | 0, "clk_uart_baud0"), | ||
671 | GATE_DA(sclk_uart4, "exynos4210-uart.4", "uclk4", "div_uart4", | ||
672 | SRC_MASK_PERIL0, 16, CLK_SET_RATE_PARENT, | ||
673 | 0, "clk_uart_baud0"), | ||
674 | GATE(sclk_audio2, "sclk_audio2", "div_audio2", SRC_MASK_PERIL1, 4, | ||
675 | CLK_SET_RATE_PARENT, 0), | ||
676 | GATE_DA(sclk_spi0, "exynos4210-spi.0", "sclk_spi0", "div_spi_pre0", | ||
677 | SRC_MASK_PERIL1, 16, CLK_SET_RATE_PARENT, | ||
678 | 0, "spi_busclk0"), | ||
679 | GATE_DA(sclk_spi1, "exynos4210-spi.1", "sclk_spi1", "div_spi_pre1", | ||
680 | SRC_MASK_PERIL1, 20, CLK_SET_RATE_PARENT, | ||
681 | 0, "spi_busclk0"), | ||
682 | GATE_DA(sclk_spi2, "exynos4210-spi.2", "sclk_spi2", "div_spi_pre2", | ||
683 | SRC_MASK_PERIL1, 24, CLK_SET_RATE_PARENT, | ||
684 | 0, "spi_busclk0"), | ||
685 | GATE_DA(fimc0, "exynos4-fimc.0", "fimc0", "aclk160", | ||
686 | GATE_IP_CAM, 0, 0, 0, "fimc"), | ||
687 | GATE_DA(fimc1, "exynos4-fimc.1", "fimc1", "aclk160", | ||
688 | GATE_IP_CAM, 1, 0, 0, "fimc"), | ||
689 | GATE_DA(fimc2, "exynos4-fimc.2", "fimc2", "aclk160", | ||
690 | GATE_IP_CAM, 2, 0, 0, "fimc"), | ||
691 | GATE_DA(fimc3, "exynos4-fimc.3", "fimc3", "aclk160", | ||
692 | GATE_IP_CAM, 3, 0, 0, "fimc"), | ||
693 | GATE_DA(csis0, "s5p-mipi-csis.0", "csis0", "aclk160", | ||
694 | GATE_IP_CAM, 4, 0, 0, "fimc"), | ||
695 | GATE_DA(csis1, "s5p-mipi-csis.1", "csis1", "aclk160", | ||
696 | GATE_IP_CAM, 5, 0, 0, "fimc"), | ||
697 | GATE_DA(smmu_fimc0, "exynos-sysmmu.5", "smmu_fimc0", "aclk160", | ||
698 | GATE_IP_CAM, 7, 0, 0, "sysmmu"), | ||
699 | GATE_DA(smmu_fimc1, "exynos-sysmmu.6", "smmu_fimc1", "aclk160", | ||
700 | GATE_IP_CAM, 8, 0, 0, "sysmmu"), | ||
701 | GATE_DA(smmu_fimc2, "exynos-sysmmu.7", "smmu_fimc2", "aclk160", | ||
702 | GATE_IP_CAM, 9, 0, 0, "sysmmu"), | ||
703 | GATE_DA(smmu_fimc3, "exynos-sysmmu.8", "smmu_fimc3", "aclk160", | ||
704 | GATE_IP_CAM, 10, 0, 0, "sysmmu"), | ||
705 | GATE_DA(smmu_jpeg, "exynos-sysmmu.3", "smmu_jpeg", "aclk160", | ||
706 | GATE_IP_CAM, 11, 0, 0, "sysmmu"), | ||
707 | GATE(pixelasyncm0, "pxl_async0", "aclk160", GATE_IP_CAM, 17, 0, 0), | ||
708 | GATE(pixelasyncm1, "pxl_async1", "aclk160", GATE_IP_CAM, 18, 0, 0), | ||
709 | GATE_DA(smmu_tv, "exynos-sysmmu.2", "smmu_tv", "aclk160", | ||
710 | GATE_IP_TV, 4, 0, 0, "sysmmu"), | ||
711 | GATE_DA(mfc, "s5p-mfc", "mfc", "aclk100", GATE_IP_MFC, 0, 0, 0, "mfc"), | ||
712 | GATE_DA(smmu_mfcl, "exynos-sysmmu.0", "smmu_mfcl", "aclk100", | ||
713 | GATE_IP_MFC, 1, 0, 0, "sysmmu"), | ||
714 | GATE_DA(smmu_mfcr, "exynos-sysmmu.1", "smmu_mfcr", "aclk100", | ||
715 | GATE_IP_MFC, 2, 0, 0, "sysmmu"), | ||
716 | GATE_DA(fimd0, "exynos4-fb.0", "fimd0", "aclk160", | ||
717 | GATE_IP_LCD0, 0, 0, 0, "fimd"), | ||
718 | GATE_DA(smmu_fimd0, "exynos-sysmmu.10", "smmu_fimd0", "aclk160", | ||
719 | GATE_IP_LCD0, 4, 0, 0, "sysmmu"), | ||
720 | GATE_DA(pdma0, "dma-pl330.0", "pdma0", "aclk133", | ||
721 | GATE_IP_FSYS, 0, 0, 0, "dma"), | ||
722 | GATE_DA(pdma1, "dma-pl330.1", "pdma1", "aclk133", | ||
723 | GATE_IP_FSYS, 1, 0, 0, "dma"), | ||
724 | GATE_DA(sdmmc0, "exynos4-sdhci.0", "sdmmc0", "aclk133", | ||
725 | GATE_IP_FSYS, 5, 0, 0, "hsmmc"), | ||
726 | GATE_DA(sdmmc1, "exynos4-sdhci.1", "sdmmc1", "aclk133", | ||
727 | GATE_IP_FSYS, 6, 0, 0, "hsmmc"), | ||
728 | GATE_DA(sdmmc2, "exynos4-sdhci.2", "sdmmc2", "aclk133", | ||
729 | GATE_IP_FSYS, 7, 0, 0, "hsmmc"), | ||
730 | GATE_DA(sdmmc3, "exynos4-sdhci.3", "sdmmc3", "aclk133", | ||
731 | GATE_IP_FSYS, 8, 0, 0, "hsmmc"), | ||
732 | GATE_DA(uart0, "exynos4210-uart.0", "uart0", "aclk100", | ||
733 | GATE_IP_PERIL, 0, 0, 0, "uart"), | ||
734 | GATE_DA(uart1, "exynos4210-uart.1", "uart1", "aclk100", | ||
735 | GATE_IP_PERIL, 1, 0, 0, "uart"), | ||
736 | GATE_DA(uart2, "exynos4210-uart.2", "uart2", "aclk100", | ||
737 | GATE_IP_PERIL, 2, 0, 0, "uart"), | ||
738 | GATE_DA(uart3, "exynos4210-uart.3", "uart3", "aclk100", | ||
739 | GATE_IP_PERIL, 3, 0, 0, "uart"), | ||
740 | GATE_DA(uart4, "exynos4210-uart.4", "uart4", "aclk100", | ||
741 | GATE_IP_PERIL, 4, 0, 0, "uart"), | ||
742 | GATE_DA(i2c0, "s3c2440-i2c.0", "i2c0", "aclk100", | ||
743 | GATE_IP_PERIL, 6, 0, 0, "i2c"), | ||
744 | GATE_DA(i2c1, "s3c2440-i2c.1", "i2c1", "aclk100", | ||
745 | GATE_IP_PERIL, 7, 0, 0, "i2c"), | ||
746 | GATE_DA(i2c2, "s3c2440-i2c.2", "i2c2", "aclk100", | ||
747 | GATE_IP_PERIL, 8, 0, 0, "i2c"), | ||
748 | GATE_DA(i2c3, "s3c2440-i2c.3", "i2c3", "aclk100", | ||
749 | GATE_IP_PERIL, 9, 0, 0, "i2c"), | ||
750 | GATE_DA(i2c4, "s3c2440-i2c.4", "i2c4", "aclk100", | ||
751 | GATE_IP_PERIL, 10, 0, 0, "i2c"), | ||
752 | GATE_DA(i2c5, "s3c2440-i2c.5", "i2c5", "aclk100", | ||
753 | GATE_IP_PERIL, 11, 0, 0, "i2c"), | ||
754 | GATE_DA(i2c6, "s3c2440-i2c.6", "i2c6", "aclk100", | ||
755 | GATE_IP_PERIL, 12, 0, 0, "i2c"), | ||
756 | GATE_DA(i2c7, "s3c2440-i2c.7", "i2c7", "aclk100", | ||
757 | GATE_IP_PERIL, 13, 0, 0, "i2c"), | ||
758 | GATE_DA(i2c_hdmi, "s3c2440-hdmiphy-i2c", "i2c-hdmi", "aclk100", | ||
759 | GATE_IP_PERIL, 14, 0, 0, "i2c"), | ||
760 | GATE_DA(spi0, "exynos4210-spi.0", "spi0", "aclk100", | ||
761 | GATE_IP_PERIL, 16, 0, 0, "spi"), | ||
762 | GATE_DA(spi1, "exynos4210-spi.1", "spi1", "aclk100", | ||
763 | GATE_IP_PERIL, 17, 0, 0, "spi"), | ||
764 | GATE_DA(spi2, "exynos4210-spi.2", "spi2", "aclk100", | ||
765 | GATE_IP_PERIL, 18, 0, 0, "spi"), | ||
766 | GATE_DA(i2s1, "samsung-i2s.1", "i2s1", "aclk100", | ||
767 | GATE_IP_PERIL, 20, 0, 0, "iis"), | ||
768 | GATE_DA(i2s2, "samsung-i2s.2", "i2s2", "aclk100", | ||
769 | GATE_IP_PERIL, 21, 0, 0, "iis"), | ||
770 | GATE_DA(pcm1, "samsung-pcm.1", "pcm1", "aclk100", | ||
771 | GATE_IP_PERIL, 22, 0, 0, "pcm"), | ||
772 | GATE_DA(pcm2, "samsung-pcm.2", "pcm2", "aclk100", | ||
773 | GATE_IP_PERIL, 23, 0, 0, "pcm"), | ||
774 | GATE_DA(spdif, "samsung-spdif", "spdif", "aclk100", | ||
775 | GATE_IP_PERIL, 26, 0, 0, "spdif"), | ||
776 | GATE_DA(ac97, "samsung-ac97", "ac97", "aclk100", | ||
777 | GATE_IP_PERIL, 27, 0, 0, "ac97"), | ||
778 | }; | ||
779 | |||
780 | /* list of gate clocks supported in exynos4210 soc */ | ||
781 | struct samsung_gate_clock exynos4210_gate_clks[] __initdata = { | ||
782 | GATE(tvenc, "tvenc", "aclk160", GATE_IP_TV, 2, 0, 0), | ||
783 | GATE(g2d, "g2d", "aclk200", E4210_GATE_IP_IMAGE, 0, 0, 0), | ||
784 | GATE(rotator, "rotator", "aclk200", E4210_GATE_IP_IMAGE, 1, 0, 0), | ||
785 | GATE(mdma, "mdma", "aclk200", E4210_GATE_IP_IMAGE, 2, 0, 0), | ||
786 | GATE(smmu_g2d, "smmu_g2d", "aclk200", E4210_GATE_IP_IMAGE, 3, 0, 0), | ||
787 | GATE(smmu_mdma, "smmu_mdma", "aclk200", E4210_GATE_IP_IMAGE, 5, 0, 0), | ||
788 | GATE(pcie_phy, "pcie_phy", "aclk133", GATE_IP_FSYS, 2, 0, 0), | ||
789 | GATE(sata_phy, "sata_phy", "aclk133", GATE_IP_FSYS, 3, 0, 0), | ||
790 | GATE(sata, "sata", "aclk133", GATE_IP_FSYS, 10, 0, 0), | ||
791 | GATE(pcie, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0), | ||
792 | GATE(smmu_pcie, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0), | ||
793 | GATE(modemif, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0), | ||
794 | GATE(chipid, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), | ||
795 | GATE(sysreg, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), | ||
796 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, 0), | ||
797 | GATE(smmu_rotator, "smmu_rotator", "aclk200", | ||
798 | E4210_GATE_IP_IMAGE, 4, 0, 0), | ||
799 | GATE(sclk_mipi1, "sclk_mipi1", "div_mipi_pre1", | ||
800 | E4210_SRC_MASK_LCD1, 12, CLK_SET_RATE_PARENT, 0), | ||
801 | GATE(sclk_sata, "sclk_sata", "div_sata", | ||
802 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), | ||
803 | GATE(sclk_mixer, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4, 0, 0), | ||
804 | GATE(sclk_dac, "sclk_dac", "mout_dac", SRC_MASK_TV, 8, 0, 0), | ||
805 | GATE_A(tsadc, "tsadc", "aclk100", GATE_IP_PERIL, 15, 0, 0, "adc"), | ||
806 | GATE_A(mct, "mct", "aclk100", E4210_GATE_IP_PERIR, 13, 0, 0, "mct"), | ||
807 | GATE_A(wdt, "watchdog", "aclk100", E4210_GATE_IP_PERIR, 14, 0, 0, "watchdog"), | ||
808 | GATE_A(rtc, "rtc", "aclk100", E4210_GATE_IP_PERIR, 15, 0, 0, "rtc"), | ||
809 | GATE_A(keyif, "keyif", "aclk100", E4210_GATE_IP_PERIR, 16, 0, 0, "keypad"), | ||
810 | GATE_DA(sclk_fimd1, "exynos4-fb.1", "sclk_fimd1", "div_fimd1", | ||
811 | E4210_SRC_MASK_LCD1, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimd"), | ||
812 | }; | ||
813 | |||
814 | /* list of gate clocks supported in exynos4x12 soc */ | ||
815 | struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | ||
816 | GATE(audss, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0), | ||
817 | GATE(mdnie0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0), | ||
818 | GATE(rotator, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0), | ||
819 | GATE(mdma2, "mdma2", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0), | ||
820 | GATE(smmu_mdma, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0, 0), | ||
821 | GATE(mipi_hsi, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0), | ||
822 | GATE(chipid, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0), | ||
823 | GATE(sysreg, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1, 0, 0), | ||
824 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, 0), | ||
825 | GATE(sclk_mdnie0, "sclk_mdnie0", "div_mdnie0", | ||
826 | SRC_MASK_LCD0, 4, CLK_SET_RATE_PARENT, 0), | ||
827 | GATE(sclk_mdnie_pwm0, "sclk_mdnie_pwm0", "div_mdnie_pwm_pre0", | ||
828 | SRC_MASK_LCD0, 8, CLK_SET_RATE_PARENT, 0), | ||
829 | GATE(sclk_mipihsi, "sclk_mipihsi", "div_mipihsi", | ||
830 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), | ||
831 | GATE(smmu_rotator, "smmu_rotator", "aclk200", | ||
832 | E4X12_GATE_IP_IMAGE, 4, 0, 0), | ||
833 | GATE_A(mct, "mct", "aclk100", E4X12_GATE_IP_PERIR, 13, 0, 0, "mct"), | ||
834 | GATE_A(rtc, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, 0, 0, "rtc"), | ||
835 | GATE_A(keyif, "keyif", "aclk100", | ||
836 | E4X12_GATE_IP_PERIR, 16, 0, 0, "keypad"), | ||
837 | GATE(sclk_pwm_isp, "sclk_pwm_isp", "div_pwm_isp", | ||
838 | E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0), | ||
839 | GATE(sclk_spi0_isp, "sclk_spi0_isp", "div_spi0_isp_pre", | ||
840 | E4X12_SRC_MASK_ISP, 4, CLK_SET_RATE_PARENT, 0), | ||
841 | GATE(sclk_spi1_isp, "sclk_spi1_isp", "div_spi1_isp_pre", | ||
842 | E4X12_SRC_MASK_ISP, 8, CLK_SET_RATE_PARENT, 0), | ||
843 | GATE(sclk_uart_isp, "sclk_uart_isp", "div_uart_isp", | ||
844 | E4X12_SRC_MASK_ISP, 12, CLK_SET_RATE_PARENT, 0), | ||
845 | GATE(pwm_isp_sclk, "pwm_isp_sclk", "sclk_pwm_isp", | ||
846 | E4X12_GATE_IP_ISP, 0, 0, 0), | ||
847 | GATE(spi0_isp_sclk, "spi0_isp_sclk", "sclk_spi0_isp", | ||
848 | E4X12_GATE_IP_ISP, 1, 0, 0), | ||
849 | GATE(spi1_isp_sclk, "spi1_isp_sclk", "sclk_spi1_isp", | ||
850 | E4X12_GATE_IP_ISP, 2, 0, 0), | ||
851 | GATE(uart_isp_sclk, "uart_isp_sclk", "sclk_uart_isp", | ||
852 | E4X12_GATE_IP_ISP, 3, 0, 0), | ||
853 | GATE_A(wdt, "watchdog", "aclk100", | ||
854 | E4X12_GATE_IP_PERIR, 14, 0, 0, "watchdog"), | ||
855 | GATE_DA(pcm0, "samsung-pcm.0", "pcm0", "aclk100", | ||
856 | E4X12_GATE_IP_MAUDIO, 2, 0, 0, "pcm"), | ||
857 | GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100", | ||
858 | E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"), | ||
859 | GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0, | ||
860 | CLK_IGNORE_UNUSED, 0), | ||
861 | GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1, | ||
862 | CLK_IGNORE_UNUSED, 0), | ||
863 | GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2, | ||
864 | CLK_IGNORE_UNUSED, 0), | ||
865 | GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3, | ||
866 | CLK_IGNORE_UNUSED, 0), | ||
867 | GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4, | ||
868 | CLK_IGNORE_UNUSED, 0), | ||
869 | GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5, | ||
870 | CLK_IGNORE_UNUSED, 0), | ||
871 | GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7, | ||
872 | CLK_IGNORE_UNUSED, 0), | ||
873 | GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8, | ||
874 | CLK_IGNORE_UNUSED, 0), | ||
875 | GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9, | ||
876 | CLK_IGNORE_UNUSED, 0), | ||
877 | GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10, | ||
878 | CLK_IGNORE_UNUSED, 0), | ||
879 | GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11, | ||
880 | CLK_IGNORE_UNUSED, 0), | ||
881 | GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12, | ||
882 | CLK_IGNORE_UNUSED, 0), | ||
883 | GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20, | ||
884 | CLK_IGNORE_UNUSED, 0), | ||
885 | GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21, | ||
886 | CLK_IGNORE_UNUSED, 0), | ||
887 | GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23, | ||
888 | CLK_IGNORE_UNUSED, 0), | ||
889 | GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24, | ||
890 | CLK_IGNORE_UNUSED, 0), | ||
891 | GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25, | ||
892 | CLK_IGNORE_UNUSED, 0), | ||
893 | GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26, | ||
894 | CLK_IGNORE_UNUSED, 0), | ||
895 | GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27, | ||
896 | CLK_IGNORE_UNUSED, 0), | ||
897 | GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28, | ||
898 | CLK_IGNORE_UNUSED, 0), | ||
899 | GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30, | ||
900 | CLK_IGNORE_UNUSED, 0), | ||
901 | GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31, | ||
902 | CLK_IGNORE_UNUSED, 0), | ||
903 | GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0, | ||
904 | CLK_IGNORE_UNUSED, 0), | ||
905 | GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4, | ||
906 | CLK_IGNORE_UNUSED, 0), | ||
907 | GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12, | ||
908 | CLK_IGNORE_UNUSED, 0), | ||
909 | GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13, | ||
910 | CLK_IGNORE_UNUSED, 0), | ||
911 | }; | ||
912 | |||
913 | #ifdef CONFIG_OF | ||
914 | static struct of_device_id exynos4_clk_ids[] __initdata = { | ||
915 | { .compatible = "samsung,exynos4210-clock", | ||
916 | .data = (void *)EXYNOS4210, }, | ||
917 | { .compatible = "samsung,exynos4412-clock", | ||
918 | .data = (void *)EXYNOS4X12, }, | ||
919 | { }, | ||
920 | }; | ||
921 | #endif | ||
922 | |||
923 | /* | ||
924 | * The parent of the fin_pll clock is selected by the XOM[0] bit. This bit | ||
925 | * resides in chipid register space, outside of the clock controller memory | ||
926 | * mapped space. So to determine the parent of fin_pll clock, the chipid | ||
927 | * controller is first remapped and the value of XOM[0] bit is read to | ||
928 | * determine the parent clock. | ||
929 | */ | ||
930 | static void __init exynos4_clk_register_finpll(void) | ||
931 | { | ||
932 | struct samsung_fixed_rate_clock fclk; | ||
933 | struct device_node *np; | ||
934 | struct clk *clk; | ||
935 | void __iomem *chipid_base = S5P_VA_CHIPID; | ||
936 | unsigned long xom, finpll_f = 24000000; | ||
937 | char *parent_name; | ||
938 | |||
939 | np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid"); | ||
940 | if (np) | ||
941 | chipid_base = of_iomap(np, 0); | ||
942 | |||
943 | if (chipid_base) { | ||
944 | xom = readl(chipid_base + 8); | ||
945 | parent_name = xom & 1 ? "xusbxti" : "xxti"; | ||
946 | clk = clk_get(NULL, parent_name); | ||
947 | if (IS_ERR(clk)) { | ||
948 | pr_err("%s: failed to lookup parent clock %s, assuming " | ||
949 | "fin_pll clock frequency is 24MHz\n", __func__, | ||
950 | parent_name); | ||
951 | } else { | ||
952 | finpll_f = clk_get_rate(clk); | ||
953 | } | ||
954 | } else { | ||
955 | pr_err("%s: failed to map chipid registers, assuming " | ||
956 | "fin_pll clock frequency is 24MHz\n", __func__); | ||
957 | } | ||
958 | |||
959 | fclk.id = fin_pll; | ||
960 | fclk.name = "fin_pll"; | ||
961 | fclk.parent_name = NULL; | ||
962 | fclk.flags = CLK_IS_ROOT; | ||
963 | fclk.fixed_rate = finpll_f; | ||
964 | samsung_clk_register_fixed_rate(&fclk, 1); | ||
965 | |||
966 | if (np) | ||
967 | iounmap(chipid_base); | ||
968 | } | ||
969 | |||
970 | /* | ||
971 | * This function allows non-dt platforms to specify the clock speed of the | ||
972 | * xxti and xusbxti clocks. These clocks are then registered with the specified | ||
973 | * clock speed. | ||
974 | */ | ||
975 | void __init exynos4_clk_register_fixed_ext(unsigned long xxti_f, | ||
976 | unsigned long xusbxti_f) | ||
977 | { | ||
978 | exynos4_fixed_rate_ext_clks[0].fixed_rate = xxti_f; | ||
979 | exynos4_fixed_rate_ext_clks[1].fixed_rate = xusbxti_f; | ||
980 | samsung_clk_register_fixed_rate(exynos4_fixed_rate_ext_clks, | ||
981 | ARRAY_SIZE(exynos4_fixed_rate_ext_clks)); | ||
982 | } | ||
983 | |||
984 | static __initdata struct of_device_id ext_clk_match[] = { | ||
985 | { .compatible = "samsung,clock-xxti", .data = (void *)0, }, | ||
986 | { .compatible = "samsung,clock-xusbxti", .data = (void *)1, }, | ||
987 | {}, | ||
988 | }; | ||
989 | |||
990 | /* register exynos4 clocks */ | ||
991 | void __init exynos4_clk_init(struct device_node *np) | ||
992 | { | ||
993 | void __iomem *reg_base; | ||
994 | struct clk *apll, *mpll, *epll, *vpll; | ||
995 | u32 exynos4_soc; | ||
996 | |||
997 | if (np) { | ||
998 | const struct of_device_id *match; | ||
999 | match = of_match_node(exynos4_clk_ids, np); | ||
1000 | exynos4_soc = (u32)match->data; | ||
1001 | |||
1002 | reg_base = of_iomap(np, 0); | ||
1003 | if (!reg_base) | ||
1004 | panic("%s: failed to map registers\n", __func__); | ||
1005 | } else { | ||
1006 | reg_base = S5P_VA_CMU; | ||
1007 | if (soc_is_exynos4210()) | ||
1008 | exynos4_soc = EXYNOS4210; | ||
1009 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
1010 | exynos4_soc = EXYNOS4X12; | ||
1011 | else | ||
1012 | panic("%s: unable to determine soc\n", __func__); | ||
1013 | } | ||
1014 | |||
1015 | if (exynos4_soc == EXYNOS4210) | ||
1016 | samsung_clk_init(np, reg_base, nr_clks, | ||
1017 | exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), | ||
1018 | exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save)); | ||
1019 | else | ||
1020 | samsung_clk_init(np, reg_base, nr_clks, | ||
1021 | exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), | ||
1022 | exynos4x12_clk_save, ARRAY_SIZE(exynos4x12_clk_save)); | ||
1023 | |||
1024 | if (np) | ||
1025 | samsung_clk_of_register_fixed_ext(exynos4_fixed_rate_ext_clks, | ||
1026 | ARRAY_SIZE(exynos4_fixed_rate_ext_clks), | ||
1027 | ext_clk_match); | ||
1028 | |||
1029 | exynos4_clk_register_finpll(); | ||
1030 | |||
1031 | if (exynos4_soc == EXYNOS4210) { | ||
1032 | apll = samsung_clk_register_pll45xx("fout_apll", "fin_pll", | ||
1033 | reg_base + APLL_CON0, pll_4508); | ||
1034 | mpll = samsung_clk_register_pll45xx("fout_mpll", "fin_pll", | ||
1035 | reg_base + E4210_MPLL_CON0, pll_4508); | ||
1036 | epll = samsung_clk_register_pll46xx("fout_epll", "fin_pll", | ||
1037 | reg_base + EPLL_CON0, pll_4600); | ||
1038 | vpll = samsung_clk_register_pll46xx("fout_vpll", "mout_vpllsrc", | ||
1039 | reg_base + VPLL_CON0, pll_4650c); | ||
1040 | } else { | ||
1041 | apll = samsung_clk_register_pll35xx("fout_apll", "fin_pll", | ||
1042 | reg_base + APLL_CON0); | ||
1043 | mpll = samsung_clk_register_pll35xx("fout_mpll", "fin_pll", | ||
1044 | reg_base + E4X12_MPLL_CON0); | ||
1045 | epll = samsung_clk_register_pll36xx("fout_epll", "fin_pll", | ||
1046 | reg_base + EPLL_CON0); | ||
1047 | vpll = samsung_clk_register_pll36xx("fout_vpll", "fin_pll", | ||
1048 | reg_base + VPLL_CON0); | ||
1049 | } | ||
1050 | |||
1051 | samsung_clk_add_lookup(apll, fout_apll); | ||
1052 | samsung_clk_add_lookup(mpll, fout_mpll); | ||
1053 | samsung_clk_add_lookup(epll, fout_epll); | ||
1054 | samsung_clk_add_lookup(vpll, fout_vpll); | ||
1055 | |||
1056 | samsung_clk_register_fixed_rate(exynos4_fixed_rate_clks, | ||
1057 | ARRAY_SIZE(exynos4_fixed_rate_clks)); | ||
1058 | samsung_clk_register_mux(exynos4_mux_clks, | ||
1059 | ARRAY_SIZE(exynos4_mux_clks)); | ||
1060 | samsung_clk_register_div(exynos4_div_clks, | ||
1061 | ARRAY_SIZE(exynos4_div_clks)); | ||
1062 | samsung_clk_register_gate(exynos4_gate_clks, | ||
1063 | ARRAY_SIZE(exynos4_gate_clks)); | ||
1064 | |||
1065 | if (exynos4_soc == EXYNOS4210) { | ||
1066 | samsung_clk_register_fixed_rate(exynos4210_fixed_rate_clks, | ||
1067 | ARRAY_SIZE(exynos4210_fixed_rate_clks)); | ||
1068 | samsung_clk_register_mux(exynos4210_mux_clks, | ||
1069 | ARRAY_SIZE(exynos4210_mux_clks)); | ||
1070 | samsung_clk_register_div(exynos4210_div_clks, | ||
1071 | ARRAY_SIZE(exynos4210_div_clks)); | ||
1072 | samsung_clk_register_gate(exynos4210_gate_clks, | ||
1073 | ARRAY_SIZE(exynos4210_gate_clks)); | ||
1074 | } else { | ||
1075 | samsung_clk_register_mux(exynos4x12_mux_clks, | ||
1076 | ARRAY_SIZE(exynos4x12_mux_clks)); | ||
1077 | samsung_clk_register_div(exynos4x12_div_clks, | ||
1078 | ARRAY_SIZE(exynos4x12_div_clks)); | ||
1079 | samsung_clk_register_gate(exynos4x12_gate_clks, | ||
1080 | ARRAY_SIZE(exynos4x12_gate_clks)); | ||
1081 | } | ||
1082 | |||
1083 | pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n" | ||
1084 | "\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n", | ||
1085 | exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12", | ||
1086 | _get_rate("sclk_apll"), _get_rate("sclk_mpll"), | ||
1087 | _get_rate("sclk_epll"), _get_rate("sclk_vpll"), | ||
1088 | _get_rate("arm_clk")); | ||
1089 | } | ||
1090 | CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4_clk_init); | ||
1091 | CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4_clk_init); | ||
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c new file mode 100644 index 000000000000..bb54606ff035 --- /dev/null +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -0,0 +1,523 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Common Clock Framework support for Exynos5250 SoC. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk.h> | ||
14 | #include <linux/clkdev.h> | ||
15 | #include <linux/clk-provider.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
18 | |||
19 | #include <plat/cpu.h> | ||
20 | #include "clk.h" | ||
21 | #include "clk-pll.h" | ||
22 | |||
23 | #define SRC_CPU 0x200 | ||
24 | #define DIV_CPU0 0x500 | ||
25 | #define SRC_CORE1 0x4204 | ||
26 | #define SRC_TOP0 0x10210 | ||
27 | #define SRC_TOP2 0x10218 | ||
28 | #define SRC_GSCL 0x10220 | ||
29 | #define SRC_DISP1_0 0x1022c | ||
30 | #define SRC_MAU 0x10240 | ||
31 | #define SRC_FSYS 0x10244 | ||
32 | #define SRC_GEN 0x10248 | ||
33 | #define SRC_PERIC0 0x10250 | ||
34 | #define SRC_PERIC1 0x10254 | ||
35 | #define SRC_MASK_GSCL 0x10320 | ||
36 | #define SRC_MASK_DISP1_0 0x1032c | ||
37 | #define SRC_MASK_MAU 0x10334 | ||
38 | #define SRC_MASK_FSYS 0x10340 | ||
39 | #define SRC_MASK_GEN 0x10344 | ||
40 | #define SRC_MASK_PERIC0 0x10350 | ||
41 | #define SRC_MASK_PERIC1 0x10354 | ||
42 | #define DIV_TOP0 0x10510 | ||
43 | #define DIV_TOP1 0x10514 | ||
44 | #define DIV_GSCL 0x10520 | ||
45 | #define DIV_DISP1_0 0x1052c | ||
46 | #define DIV_GEN 0x1053c | ||
47 | #define DIV_MAU 0x10544 | ||
48 | #define DIV_FSYS0 0x10548 | ||
49 | #define DIV_FSYS1 0x1054c | ||
50 | #define DIV_FSYS2 0x10550 | ||
51 | #define DIV_PERIC0 0x10558 | ||
52 | #define DIV_PERIC1 0x1055c | ||
53 | #define DIV_PERIC2 0x10560 | ||
54 | #define DIV_PERIC3 0x10564 | ||
55 | #define DIV_PERIC4 0x10568 | ||
56 | #define DIV_PERIC5 0x1056c | ||
57 | #define GATE_IP_GSCL 0x10920 | ||
58 | #define GATE_IP_MFC 0x1092c | ||
59 | #define GATE_IP_GEN 0x10934 | ||
60 | #define GATE_IP_FSYS 0x10944 | ||
61 | #define GATE_IP_PERIC 0x10950 | ||
62 | #define GATE_IP_PERIS 0x10960 | ||
63 | #define SRC_CDREX 0x20200 | ||
64 | #define PLL_DIV2_SEL 0x20a24 | ||
65 | #define GATE_IP_DISP1 0x10928 | ||
66 | |||
67 | /* | ||
68 | * Let each supported clock get a unique id. This id is used to lookup the clock | ||
69 | * for device tree based platforms. The clocks are categorized into three | ||
70 | * sections: core, sclk gate and bus interface gate clocks. | ||
71 | * | ||
72 | * When adding a new clock to this list, it is advised to choose a clock | ||
73 | * category and add it to the end of that category. That is because the the | ||
74 | * device tree source file is referring to these ids and any change in the | ||
75 | * sequence number of existing clocks will require corresponding change in the | ||
76 | * device tree files. This limitation would go away when pre-processor support | ||
77 | * for dtc would be available. | ||
78 | */ | ||
79 | enum exynos5250_clks { | ||
80 | none, | ||
81 | |||
82 | /* core clocks */ | ||
83 | fin_pll, | ||
84 | |||
85 | /* gate for special clocks (sclk) */ | ||
86 | sclk_cam_bayer = 128, sclk_cam0, sclk_cam1, sclk_gscl_wa, sclk_gscl_wb, | ||
87 | sclk_fimd1, sclk_mipi1, sclk_dp, sclk_hdmi, sclk_pixel, sclk_audio0, | ||
88 | sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_sata, sclk_usb3, | ||
89 | sclk_jpeg, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_pwm, | ||
90 | sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2, | ||
91 | |||
92 | /* gate clocks */ | ||
93 | gscl0 = 256, gscl1, gscl2, gscl3, gscl_wa, gscl_wb, smmu_gscl0, | ||
94 | smmu_gscl1, smmu_gscl2, smmu_gscl3, mfc, smmu_mfcl, smmu_mfcr, rotator, | ||
95 | jpeg, mdma1, smmu_rotator, smmu_jpeg, smmu_mdma1, pdma0, pdma1, sata, | ||
96 | usbotg, mipi_hsi, sdmmc0, sdmmc1, sdmmc2, sdmmc3, sromc, usb2, usb3, | ||
97 | sata_phyctrl, sata_phyi2c, uart0, uart1, uart2, uart3, uart4, i2c0, | ||
98 | i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, adc, spi0, spi1, | ||
99 | spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2, | ||
100 | hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1, | ||
101 | tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct, | ||
102 | wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, | ||
103 | |||
104 | nr_clks, | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * list of controller registers to be saved and restored during a | ||
109 | * suspend/resume cycle. | ||
110 | */ | ||
111 | static __initdata unsigned long exynos5250_clk_regs[] = { | ||
112 | SRC_CPU, | ||
113 | DIV_CPU0, | ||
114 | SRC_CORE1, | ||
115 | SRC_TOP0, | ||
116 | SRC_TOP2, | ||
117 | SRC_GSCL, | ||
118 | SRC_DISP1_0, | ||
119 | SRC_MAU, | ||
120 | SRC_FSYS, | ||
121 | SRC_GEN, | ||
122 | SRC_PERIC0, | ||
123 | SRC_PERIC1, | ||
124 | SRC_MASK_GSCL, | ||
125 | SRC_MASK_DISP1_0, | ||
126 | SRC_MASK_MAU, | ||
127 | SRC_MASK_FSYS, | ||
128 | SRC_MASK_GEN, | ||
129 | SRC_MASK_PERIC0, | ||
130 | SRC_MASK_PERIC1, | ||
131 | DIV_TOP0, | ||
132 | DIV_TOP1, | ||
133 | DIV_GSCL, | ||
134 | DIV_DISP1_0, | ||
135 | DIV_GEN, | ||
136 | DIV_MAU, | ||
137 | DIV_FSYS0, | ||
138 | DIV_FSYS1, | ||
139 | DIV_FSYS2, | ||
140 | DIV_PERIC0, | ||
141 | DIV_PERIC1, | ||
142 | DIV_PERIC2, | ||
143 | DIV_PERIC3, | ||
144 | DIV_PERIC4, | ||
145 | DIV_PERIC5, | ||
146 | GATE_IP_GSCL, | ||
147 | GATE_IP_MFC, | ||
148 | GATE_IP_GEN, | ||
149 | GATE_IP_FSYS, | ||
150 | GATE_IP_PERIC, | ||
151 | GATE_IP_PERIS, | ||
152 | SRC_CDREX, | ||
153 | PLL_DIV2_SEL, | ||
154 | GATE_IP_DISP1, | ||
155 | }; | ||
156 | |||
157 | /* list of all parent clock list */ | ||
158 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; | ||
159 | PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; | ||
160 | PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; | ||
161 | PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; | ||
162 | PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; | ||
163 | PNAME(mout_bpll_p) = { "fin_pll", "mout_bpll_fout" }; | ||
164 | PNAME(mout_vpllsrc_p) = { "fin_pll", "sclk_hdmi27m" }; | ||
165 | PNAME(mout_vpll_p) = { "mout_vpllsrc", "fout_vpll" }; | ||
166 | PNAME(mout_cpll_p) = { "fin_pll", "fout_cpll" }; | ||
167 | PNAME(mout_epll_p) = { "fin_pll", "fout_epll" }; | ||
168 | PNAME(mout_mpll_user_p) = { "fin_pll", "sclk_mpll" }; | ||
169 | PNAME(mout_bpll_user_p) = { "fin_pll", "sclk_bpll" }; | ||
170 | PNAME(mout_aclk166_p) = { "sclk_cpll", "sclk_mpll_user" }; | ||
171 | PNAME(mout_aclk200_p) = { "sclk_mpll_user", "sclk_bpll_user" }; | ||
172 | PNAME(mout_hdmi_p) = { "div_hdmi_pixel", "sclk_hdmiphy" }; | ||
173 | PNAME(mout_usb3_p) = { "sclk_mpll_user", "sclk_cpll" }; | ||
174 | PNAME(mout_group1_p) = { "fin_pll", "fin_pll", "sclk_hdmi27m", | ||
175 | "sclk_dptxphy", "sclk_uhostphy", "sclk_hdmiphy", | ||
176 | "sclk_mpll_user", "sclk_epll", "sclk_vpll", | ||
177 | "sclk_cpll" }; | ||
178 | PNAME(mout_audio0_p) = { "cdclk0", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", | ||
179 | "sclk_uhostphy", "sclk_hdmiphy", | ||
180 | "sclk_mpll_user", "sclk_epll", "sclk_vpll", | ||
181 | "sclk_cpll" }; | ||
182 | PNAME(mout_audio1_p) = { "cdclk1", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", | ||
183 | "sclk_uhostphy", "sclk_hdmiphy", | ||
184 | "sclk_mpll_user", "sclk_epll", "sclk_vpll", | ||
185 | "sclk_cpll" }; | ||
186 | PNAME(mout_audio2_p) = { "cdclk2", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", | ||
187 | "sclk_uhostphy", "sclk_hdmiphy", | ||
188 | "sclk_mpll_user", "sclk_epll", "sclk_vpll", | ||
189 | "sclk_cpll" }; | ||
190 | PNAME(mout_spdif_p) = { "sclk_audio0", "sclk_audio1", "sclk_audio2", | ||
191 | "spdif_extclk" }; | ||
192 | |||
193 | /* fixed rate clocks generated outside the soc */ | ||
194 | struct samsung_fixed_rate_clock exynos5250_fixed_rate_ext_clks[] __initdata = { | ||
195 | FRATE(fin_pll, "fin_pll", NULL, CLK_IS_ROOT, 0), | ||
196 | }; | ||
197 | |||
198 | /* fixed rate clocks generated inside the soc */ | ||
199 | struct samsung_fixed_rate_clock exynos5250_fixed_rate_clks[] __initdata = { | ||
200 | FRATE(none, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000), | ||
201 | FRATE(none, "sclk_hdmi27m", NULL, CLK_IS_ROOT, 27000000), | ||
202 | FRATE(none, "sclk_dptxphy", NULL, CLK_IS_ROOT, 24000000), | ||
203 | FRATE(none, "sclk_uhostphy", NULL, CLK_IS_ROOT, 48000000), | ||
204 | }; | ||
205 | |||
206 | struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = { | ||
207 | FFACTOR(none, "fout_mplldiv2", "fout_mpll", 1, 2, 0), | ||
208 | FFACTOR(none, "fout_bplldiv2", "fout_bpll", 1, 2, 0), | ||
209 | }; | ||
210 | |||
211 | struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { | ||
212 | MUX(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1), | ||
213 | MUX(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), | ||
214 | MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), | ||
215 | MUX(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1), | ||
216 | MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), | ||
217 | MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), | ||
218 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), | ||
219 | MUX(none, "sclk_vpll", mout_vpll_p, SRC_TOP2, 16, 1), | ||
220 | MUX(none, "sclk_epll", mout_epll_p, SRC_TOP2, 12, 1), | ||
221 | MUX(none, "sclk_cpll", mout_cpll_p, SRC_TOP2, 8, 1), | ||
222 | MUX(none, "sclk_mpll_user", mout_mpll_user_p, SRC_TOP2, 20, 1), | ||
223 | MUX(none, "sclk_bpll_user", mout_bpll_user_p, SRC_TOP2, 24, 1), | ||
224 | MUX(none, "mout_aclk166", mout_aclk166_p, SRC_TOP0, 8, 1), | ||
225 | MUX(none, "mout_aclk333", mout_aclk166_p, SRC_TOP0, 16, 1), | ||
226 | MUX(none, "mout_aclk200", mout_aclk200_p, SRC_TOP0, 12, 1), | ||
227 | MUX(none, "mout_cam_bayer", mout_group1_p, SRC_GSCL, 12, 4), | ||
228 | MUX(none, "mout_cam0", mout_group1_p, SRC_GSCL, 16, 4), | ||
229 | MUX(none, "mout_cam1", mout_group1_p, SRC_GSCL, 20, 4), | ||
230 | MUX(none, "mout_gscl_wa", mout_group1_p, SRC_GSCL, 24, 4), | ||
231 | MUX(none, "mout_gscl_wb", mout_group1_p, SRC_GSCL, 28, 4), | ||
232 | MUX(none, "mout_fimd1", mout_group1_p, SRC_DISP1_0, 0, 4), | ||
233 | MUX(none, "mout_mipi1", mout_group1_p, SRC_DISP1_0, 12, 4), | ||
234 | MUX(none, "mout_dp", mout_group1_p, SRC_DISP1_0, 16, 4), | ||
235 | MUX(none, "mout_hdmi", mout_hdmi_p, SRC_DISP1_0, 20, 1), | ||
236 | MUX(none, "mout_audio0", mout_audio0_p, SRC_MAU, 0, 4), | ||
237 | MUX(none, "mout_mmc0", mout_group1_p, SRC_FSYS, 0, 4), | ||
238 | MUX(none, "mout_mmc1", mout_group1_p, SRC_FSYS, 4, 4), | ||
239 | MUX(none, "mout_mmc2", mout_group1_p, SRC_FSYS, 8, 4), | ||
240 | MUX(none, "mout_mmc3", mout_group1_p, SRC_FSYS, 12, 4), | ||
241 | MUX(none, "mout_sata", mout_aclk200_p, SRC_FSYS, 24, 1), | ||
242 | MUX(none, "mout_usb3", mout_usb3_p, SRC_FSYS, 28, 1), | ||
243 | MUX(none, "mout_jpeg", mout_group1_p, SRC_GEN, 0, 4), | ||
244 | MUX(none, "mout_uart0", mout_group1_p, SRC_PERIC0, 0, 4), | ||
245 | MUX(none, "mout_uart1", mout_group1_p, SRC_PERIC0, 4, 4), | ||
246 | MUX(none, "mout_uart2", mout_group1_p, SRC_PERIC0, 8, 4), | ||
247 | MUX(none, "mout_uart3", mout_group1_p, SRC_PERIC0, 12, 4), | ||
248 | MUX(none, "mout_pwm", mout_group1_p, SRC_PERIC0, 24, 4), | ||
249 | MUX(none, "mout_audio1", mout_audio1_p, SRC_PERIC1, 0, 4), | ||
250 | MUX(none, "mout_audio2", mout_audio2_p, SRC_PERIC1, 4, 4), | ||
251 | MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIC1, 8, 2), | ||
252 | MUX(none, "mout_spi0", mout_group1_p, SRC_PERIC1, 16, 4), | ||
253 | MUX(none, "mout_spi1", mout_group1_p, SRC_PERIC1, 20, 4), | ||
254 | MUX(none, "mout_spi2", mout_group1_p, SRC_PERIC1, 24, 4), | ||
255 | }; | ||
256 | |||
257 | struct samsung_div_clock exynos5250_div_clks[] __initdata = { | ||
258 | DIV(none, "div_arm", "mout_cpu", DIV_CPU0, 0, 3), | ||
259 | DIV(none, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3), | ||
260 | DIV(none, "aclk66_pre", "sclk_mpll_user", DIV_TOP1, 24, 3), | ||
261 | DIV(none, "aclk66", "aclk66_pre", DIV_TOP0, 0, 3), | ||
262 | DIV(none, "aclk266", "sclk_mpll_user", DIV_TOP0, 16, 3), | ||
263 | DIV(none, "aclk166", "mout_aclk166", DIV_TOP0, 8, 3), | ||
264 | DIV(none, "aclk333", "mout_aclk333", DIV_TOP0, 20, 3), | ||
265 | DIV(none, "aclk200", "mout_aclk200", DIV_TOP0, 12, 3), | ||
266 | DIV(none, "div_cam_bayer", "mout_cam_bayer", DIV_GSCL, 12, 4), | ||
267 | DIV(none, "div_cam0", "mout_cam0", DIV_GSCL, 16, 4), | ||
268 | DIV(none, "div_cam1", "mout_cam1", DIV_GSCL, 20, 4), | ||
269 | DIV(none, "div_gscl_wa", "mout_gscl_wa", DIV_GSCL, 24, 4), | ||
270 | DIV(none, "div_gscl_wb", "mout_gscl_wb", DIV_GSCL, 28, 4), | ||
271 | DIV(none, "div_fimd1", "mout_fimd1", DIV_DISP1_0, 0, 4), | ||
272 | DIV(none, "div_mipi1", "mout_mipi1", DIV_DISP1_0, 16, 4), | ||
273 | DIV(none, "div_dp", "mout_dp", DIV_DISP1_0, 24, 4), | ||
274 | DIV(none, "div_jpeg", "mout_jpeg", DIV_GEN, 4, 4), | ||
275 | DIV(none, "div_audio0", "mout_audio0", DIV_MAU, 0, 4), | ||
276 | DIV(none, "div_pcm0", "sclk_audio0", DIV_MAU, 4, 8), | ||
277 | DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4), | ||
278 | DIV(none, "div_usb3", "mout_usb3", DIV_FSYS0, 24, 4), | ||
279 | DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4), | ||
280 | DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4), | ||
281 | DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4), | ||
282 | DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4), | ||
283 | DIV(none, "div_uart0", "mout_uart0", DIV_PERIC0, 0, 4), | ||
284 | DIV(none, "div_uart1", "mout_uart1", DIV_PERIC0, 4, 4), | ||
285 | DIV(none, "div_uart2", "mout_uart2", DIV_PERIC0, 8, 4), | ||
286 | DIV(none, "div_uart3", "mout_uart3", DIV_PERIC0, 12, 4), | ||
287 | DIV(none, "div_spi0", "mout_spi0", DIV_PERIC1, 0, 4), | ||
288 | DIV(none, "div_spi1", "mout_spi1", DIV_PERIC1, 16, 4), | ||
289 | DIV(none, "div_spi2", "mout_spi2", DIV_PERIC2, 0, 4), | ||
290 | DIV(none, "div_pwm", "mout_pwm", DIV_PERIC3, 0, 4), | ||
291 | DIV(none, "div_audio1", "mout_audio1", DIV_PERIC4, 0, 4), | ||
292 | DIV(none, "div_pcm1", "sclk_audio1", DIV_PERIC4, 4, 8), | ||
293 | DIV(none, "div_audio2", "mout_audio2", DIV_PERIC4, 16, 4), | ||
294 | DIV(none, "div_pcm2", "sclk_audio2", DIV_PERIC4, 20, 8), | ||
295 | DIV(none, "div_i2s1", "sclk_audio1", DIV_PERIC5, 0, 6), | ||
296 | DIV(none, "div_i2s2", "sclk_audio2", DIV_PERIC5, 8, 6), | ||
297 | DIV(sclk_pixel, "div_hdmi_pixel", "sclk_vpll", DIV_DISP1_0, 28, 4), | ||
298 | DIV_A(none, "armclk", "div_arm", DIV_CPU0, 28, 3, "armclk"), | ||
299 | DIV_F(none, "div_mipi1_pre", "div_mipi1", | ||
300 | DIV_DISP1_0, 20, 4, CLK_SET_RATE_PARENT, 0), | ||
301 | DIV_F(none, "div_mmc_pre0", "div_mmc0", | ||
302 | DIV_FSYS1, 8, 8, CLK_SET_RATE_PARENT, 0), | ||
303 | DIV_F(none, "div_mmc_pre1", "div_mmc1", | ||
304 | DIV_FSYS1, 24, 8, CLK_SET_RATE_PARENT, 0), | ||
305 | DIV_F(none, "div_mmc_pre2", "div_mmc2", | ||
306 | DIV_FSYS2, 8, 8, CLK_SET_RATE_PARENT, 0), | ||
307 | DIV_F(none, "div_mmc_pre3", "div_mmc3", | ||
308 | DIV_FSYS2, 24, 8, CLK_SET_RATE_PARENT, 0), | ||
309 | DIV_F(none, "div_spi_pre0", "div_spi0", | ||
310 | DIV_PERIC1, 8, 8, CLK_SET_RATE_PARENT, 0), | ||
311 | DIV_F(none, "div_spi_pre1", "div_spi1", | ||
312 | DIV_PERIC1, 24, 8, CLK_SET_RATE_PARENT, 0), | ||
313 | DIV_F(none, "div_spi_pre2", "div_spi2", | ||
314 | DIV_PERIC2, 8, 8, CLK_SET_RATE_PARENT, 0), | ||
315 | }; | ||
316 | |||
317 | struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { | ||
318 | GATE(gscl0, "gscl0", "none", GATE_IP_GSCL, 0, 0, 0), | ||
319 | GATE(gscl1, "gscl1", "none", GATE_IP_GSCL, 1, 0, 0), | ||
320 | GATE(gscl2, "gscl2", "aclk266", GATE_IP_GSCL, 2, 0, 0), | ||
321 | GATE(gscl3, "gscl3", "aclk266", GATE_IP_GSCL, 3, 0, 0), | ||
322 | GATE(gscl_wa, "gscl_wa", "div_gscl_wa", GATE_IP_GSCL, 5, 0, 0), | ||
323 | GATE(gscl_wb, "gscl_wb", "div_gscl_wb", GATE_IP_GSCL, 6, 0, 0), | ||
324 | GATE(smmu_gscl0, "smmu_gscl0", "aclk266", GATE_IP_GSCL, 7, 0, 0), | ||
325 | GATE(smmu_gscl1, "smmu_gscl1", "aclk266", GATE_IP_GSCL, 8, 0, 0), | ||
326 | GATE(smmu_gscl2, "smmu_gscl2", "aclk266", GATE_IP_GSCL, 9, 0, 0), | ||
327 | GATE(smmu_gscl3, "smmu_gscl3", "aclk266", GATE_IP_GSCL, 10, 0, 0), | ||
328 | GATE(mfc, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0), | ||
329 | GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 1, 0, 0), | ||
330 | GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 2, 0, 0), | ||
331 | GATE(rotator, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0), | ||
332 | GATE(jpeg, "jpeg", "aclk166", GATE_IP_GEN, 2, 0, 0), | ||
333 | GATE(mdma1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0), | ||
334 | GATE(smmu_rotator, "smmu_rotator", "aclk266", GATE_IP_GEN, 6, 0, 0), | ||
335 | GATE(smmu_jpeg, "smmu_jpeg", "aclk166", GATE_IP_GEN, 7, 0, 0), | ||
336 | GATE(smmu_mdma1, "smmu_mdma1", "aclk266", GATE_IP_GEN, 9, 0, 0), | ||
337 | GATE(pdma0, "pdma0", "aclk200", GATE_IP_FSYS, 1, 0, 0), | ||
338 | GATE(pdma1, "pdma1", "aclk200", GATE_IP_FSYS, 2, 0, 0), | ||
339 | GATE(sata, "sata", "aclk200", GATE_IP_FSYS, 6, 0, 0), | ||
340 | GATE(usbotg, "usbotg", "aclk200", GATE_IP_FSYS, 7, 0, 0), | ||
341 | GATE(mipi_hsi, "mipi_hsi", "aclk200", GATE_IP_FSYS, 8, 0, 0), | ||
342 | GATE(sdmmc0, "sdmmc0", "aclk200", GATE_IP_FSYS, 12, 0, 0), | ||
343 | GATE(sdmmc1, "sdmmc1", "aclk200", GATE_IP_FSYS, 13, 0, 0), | ||
344 | GATE(sdmmc2, "sdmmc2", "aclk200", GATE_IP_FSYS, 14, 0, 0), | ||
345 | GATE(sdmmc3, "sdmmc3", "aclk200", GATE_IP_FSYS, 15, 0, 0), | ||
346 | GATE(sromc, "sromc", "aclk200", GATE_IP_FSYS, 17, 0, 0), | ||
347 | GATE(usb2, "usb2", "aclk200", GATE_IP_FSYS, 18, 0, 0), | ||
348 | GATE(usb3, "usb3", "aclk200", GATE_IP_FSYS, 19, 0, 0), | ||
349 | GATE(sata_phyctrl, "sata_phyctrl", "aclk200", GATE_IP_FSYS, 24, 0, 0), | ||
350 | GATE(sata_phyi2c, "sata_phyi2c", "aclk200", GATE_IP_FSYS, 25, 0, 0), | ||
351 | GATE(uart0, "uart0", "aclk66", GATE_IP_PERIC, 0, 0, 0), | ||
352 | GATE(uart1, "uart1", "aclk66", GATE_IP_PERIC, 1, 0, 0), | ||
353 | GATE(uart2, "uart2", "aclk66", GATE_IP_PERIC, 2, 0, 0), | ||
354 | GATE(uart3, "uart3", "aclk66", GATE_IP_PERIC, 3, 0, 0), | ||
355 | GATE(uart4, "uart4", "aclk66", GATE_IP_PERIC, 4, 0, 0), | ||
356 | GATE(i2c0, "i2c0", "aclk66", GATE_IP_PERIC, 6, 0, 0), | ||
357 | GATE(i2c1, "i2c1", "aclk66", GATE_IP_PERIC, 7, 0, 0), | ||
358 | GATE(i2c2, "i2c2", "aclk66", GATE_IP_PERIC, 8, 0, 0), | ||
359 | GATE(i2c3, "i2c3", "aclk66", GATE_IP_PERIC, 9, 0, 0), | ||
360 | GATE(i2c4, "i2c4", "aclk66", GATE_IP_PERIC, 10, 0, 0), | ||
361 | GATE(i2c5, "i2c5", "aclk66", GATE_IP_PERIC, 11, 0, 0), | ||
362 | GATE(i2c6, "i2c6", "aclk66", GATE_IP_PERIC, 12, 0, 0), | ||
363 | GATE(i2c7, "i2c7", "aclk66", GATE_IP_PERIC, 13, 0, 0), | ||
364 | GATE(i2c_hdmi, "i2c_hdmi", "aclk66", GATE_IP_PERIC, 14, 0, 0), | ||
365 | GATE(adc, "adc", "aclk66", GATE_IP_PERIC, 15, 0, 0), | ||
366 | GATE(spi0, "spi0", "aclk66", GATE_IP_PERIC, 16, 0, 0), | ||
367 | GATE(spi1, "spi1", "aclk66", GATE_IP_PERIC, 17, 0, 0), | ||
368 | GATE(spi2, "spi2", "aclk66", GATE_IP_PERIC, 18, 0, 0), | ||
369 | GATE(i2s1, "i2s1", "aclk66", GATE_IP_PERIC, 20, 0, 0), | ||
370 | GATE(i2s2, "i2s2", "aclk66", GATE_IP_PERIC, 21, 0, 0), | ||
371 | GATE(pcm1, "pcm1", "aclk66", GATE_IP_PERIC, 22, 0, 0), | ||
372 | GATE(pcm2, "pcm2", "aclk66", GATE_IP_PERIC, 23, 0, 0), | ||
373 | GATE(pwm, "pwm", "aclk66", GATE_IP_PERIC, 24, 0, 0), | ||
374 | GATE(spdif, "spdif", "aclk66", GATE_IP_PERIC, 26, 0, 0), | ||
375 | GATE(ac97, "ac97", "aclk66", GATE_IP_PERIC, 27, 0, 0), | ||
376 | GATE(hsi2c0, "hsi2c0", "aclk66", GATE_IP_PERIC, 28, 0, 0), | ||
377 | GATE(hsi2c1, "hsi2c1", "aclk66", GATE_IP_PERIC, 29, 0, 0), | ||
378 | GATE(hsi2c2, "hsi2c2", "aclk66", GATE_IP_PERIC, 30, 0, 0), | ||
379 | GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), | ||
380 | GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), | ||
381 | GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), | ||
382 | GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, 0, 0), | ||
383 | GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), | ||
384 | GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), | ||
385 | GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), | ||
386 | GATE(tzpc3, "tzpc3", "aclk66", GATE_IP_PERIS, 9, 0, 0), | ||
387 | GATE(tzpc4, "tzpc4", "aclk66", GATE_IP_PERIS, 10, 0, 0), | ||
388 | GATE(tzpc5, "tzpc5", "aclk66", GATE_IP_PERIS, 11, 0, 0), | ||
389 | GATE(tzpc6, "tzpc6", "aclk66", GATE_IP_PERIS, 12, 0, 0), | ||
390 | GATE(tzpc7, "tzpc7", "aclk66", GATE_IP_PERIS, 13, 0, 0), | ||
391 | GATE(tzpc8, "tzpc8", "aclk66", GATE_IP_PERIS, 14, 0, 0), | ||
392 | GATE(tzpc9, "tzpc9", "aclk66", GATE_IP_PERIS, 15, 0, 0), | ||
393 | GATE(hdmi_cec, "hdmi_cec", "aclk66", GATE_IP_PERIS, 16, 0, 0), | ||
394 | GATE(mct, "mct", "aclk66", GATE_IP_PERIS, 18, 0, 0), | ||
395 | GATE(wdt, "wdt", "aclk66", GATE_IP_PERIS, 19, 0, 0), | ||
396 | GATE(rtc, "rtc", "aclk66", GATE_IP_PERIS, 20, 0, 0), | ||
397 | GATE(tmu, "tmu", "aclk66", GATE_IP_PERIS, 21, 0, 0), | ||
398 | GATE(cmu_top, "cmu_top", "aclk66", | ||
399 | GATE_IP_PERIS, 3, CLK_IGNORE_UNUSED, 0), | ||
400 | GATE(cmu_core, "cmu_core", "aclk66", | ||
401 | GATE_IP_PERIS, 4, CLK_IGNORE_UNUSED, 0), | ||
402 | GATE(cmu_mem, "cmu_mem", "aclk66", | ||
403 | GATE_IP_PERIS, 5, CLK_IGNORE_UNUSED, 0), | ||
404 | GATE(sclk_cam_bayer, "sclk_cam_bayer", "div_cam_bayer", | ||
405 | SRC_MASK_GSCL, 12, CLK_SET_RATE_PARENT, 0), | ||
406 | GATE(sclk_cam0, "sclk_cam0", "div_cam0", | ||
407 | SRC_MASK_GSCL, 16, CLK_SET_RATE_PARENT, 0), | ||
408 | GATE(sclk_cam1, "sclk_cam1", "div_cam1", | ||
409 | SRC_MASK_GSCL, 20, CLK_SET_RATE_PARENT, 0), | ||
410 | GATE(sclk_gscl_wa, "sclk_gscl_wa", "div_gscl_wa", | ||
411 | SRC_MASK_GSCL, 24, CLK_SET_RATE_PARENT, 0), | ||
412 | GATE(sclk_gscl_wb, "sclk_gscl_wb", "div_gscl_wb", | ||
413 | SRC_MASK_GSCL, 28, CLK_SET_RATE_PARENT, 0), | ||
414 | GATE(sclk_fimd1, "sclk_fimd1", "div_fimd1", | ||
415 | SRC_MASK_DISP1_0, 0, CLK_SET_RATE_PARENT, 0), | ||
416 | GATE(sclk_mipi1, "sclk_mipi1", "div_mipi1", | ||
417 | SRC_MASK_DISP1_0, 12, CLK_SET_RATE_PARENT, 0), | ||
418 | GATE(sclk_dp, "sclk_dp", "div_dp", | ||
419 | SRC_MASK_DISP1_0, 16, CLK_SET_RATE_PARENT, 0), | ||
420 | GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi", | ||
421 | SRC_MASK_DISP1_0, 20, 0, 0), | ||
422 | GATE(sclk_audio0, "sclk_audio0", "div_audio0", | ||
423 | SRC_MASK_MAU, 0, CLK_SET_RATE_PARENT, 0), | ||
424 | GATE(sclk_mmc0, "sclk_mmc0", "div_mmc_pre0", | ||
425 | SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0), | ||
426 | GATE(sclk_mmc1, "sclk_mmc1", "div_mmc_pre1", | ||
427 | SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0), | ||
428 | GATE(sclk_mmc2, "sclk_mmc2", "div_mmc_pre2", | ||
429 | SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0), | ||
430 | GATE(sclk_mmc3, "sclk_mmc3", "div_mmc_pre3", | ||
431 | SRC_MASK_FSYS, 12, CLK_SET_RATE_PARENT, 0), | ||
432 | GATE(sclk_sata, "sclk_sata", "div_sata", | ||
433 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), | ||
434 | GATE(sclk_usb3, "sclk_usb3", "div_usb3", | ||
435 | SRC_MASK_FSYS, 28, CLK_SET_RATE_PARENT, 0), | ||
436 | GATE(sclk_jpeg, "sclk_jpeg", "div_jpeg", | ||
437 | SRC_MASK_GEN, 0, CLK_SET_RATE_PARENT, 0), | ||
438 | GATE(sclk_uart0, "sclk_uart0", "div_uart0", | ||
439 | SRC_MASK_PERIC0, 0, CLK_SET_RATE_PARENT, 0), | ||
440 | GATE(sclk_uart1, "sclk_uart1", "div_uart1", | ||
441 | SRC_MASK_PERIC0, 4, CLK_SET_RATE_PARENT, 0), | ||
442 | GATE(sclk_uart2, "sclk_uart2", "div_uart2", | ||
443 | SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0), | ||
444 | GATE(sclk_uart3, "sclk_uart3", "div_uart3", | ||
445 | SRC_MASK_PERIC0, 12, CLK_SET_RATE_PARENT, 0), | ||
446 | GATE(sclk_pwm, "sclk_pwm", "div_pwm", | ||
447 | SRC_MASK_PERIC0, 24, CLK_SET_RATE_PARENT, 0), | ||
448 | GATE(sclk_audio1, "sclk_audio1", "div_audio1", | ||
449 | SRC_MASK_PERIC1, 0, CLK_SET_RATE_PARENT, 0), | ||
450 | GATE(sclk_audio2, "sclk_audio2", "div_audio2", | ||
451 | SRC_MASK_PERIC1, 4, CLK_SET_RATE_PARENT, 0), | ||
452 | GATE(sclk_spdif, "sclk_spdif", "mout_spdif", | ||
453 | SRC_MASK_PERIC1, 4, 0, 0), | ||
454 | GATE(sclk_spi0, "sclk_spi0", "div_spi_pre0", | ||
455 | SRC_MASK_PERIC1, 16, CLK_SET_RATE_PARENT, 0), | ||
456 | GATE(sclk_spi1, "sclk_spi1", "div_spi_pre1", | ||
457 | SRC_MASK_PERIC1, 20, CLK_SET_RATE_PARENT, 0), | ||
458 | GATE(sclk_spi2, "sclk_spi2", "div_spi_pre2", | ||
459 | SRC_MASK_PERIC1, 24, CLK_SET_RATE_PARENT, 0), | ||
460 | GATE(fimd1, "fimd1", "aclk200", GATE_IP_DISP1, 0, 0, 0), | ||
461 | GATE(mie1, "mie1", "aclk200", GATE_IP_DISP1, 1, 0, 0), | ||
462 | GATE(dsim0, "dsim0", "aclk200", GATE_IP_DISP1, 3, 0, 0), | ||
463 | GATE(dp, "dp", "aclk200", GATE_IP_DISP1, 4, 0, 0), | ||
464 | GATE(mixer, "mixer", "aclk200", GATE_IP_DISP1, 5, 0, 0), | ||
465 | GATE(hdmi, "hdmi", "aclk200", GATE_IP_DISP1, 6, 0, 0), | ||
466 | }; | ||
467 | |||
468 | static __initdata struct of_device_id ext_clk_match[] = { | ||
469 | { .compatible = "samsung,clock-xxti", .data = (void *)0, }, | ||
470 | { }, | ||
471 | }; | ||
472 | |||
473 | /* register exynox5250 clocks */ | ||
474 | void __init exynos5250_clk_init(struct device_node *np) | ||
475 | { | ||
476 | void __iomem *reg_base; | ||
477 | struct clk *apll, *mpll, *epll, *vpll, *bpll, *gpll, *cpll; | ||
478 | |||
479 | if (np) { | ||
480 | reg_base = of_iomap(np, 0); | ||
481 | if (!reg_base) | ||
482 | panic("%s: failed to map registers\n", __func__); | ||
483 | } else { | ||
484 | panic("%s: unable to determine soc\n", __func__); | ||
485 | } | ||
486 | |||
487 | samsung_clk_init(np, reg_base, nr_clks, | ||
488 | exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs), | ||
489 | NULL, 0); | ||
490 | samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks, | ||
491 | ARRAY_SIZE(exynos5250_fixed_rate_ext_clks), | ||
492 | ext_clk_match); | ||
493 | |||
494 | apll = samsung_clk_register_pll35xx("fout_apll", "fin_pll", | ||
495 | reg_base + 0x100); | ||
496 | mpll = samsung_clk_register_pll35xx("fout_mpll", "fin_pll", | ||
497 | reg_base + 0x4100); | ||
498 | bpll = samsung_clk_register_pll35xx("fout_bpll", "fin_pll", | ||
499 | reg_base + 0x20110); | ||
500 | gpll = samsung_clk_register_pll35xx("fout_gpll", "fin_pll", | ||
501 | reg_base + 0x10150); | ||
502 | cpll = samsung_clk_register_pll35xx("fout_cpll", "fin_pll", | ||
503 | reg_base + 0x10120); | ||
504 | epll = samsung_clk_register_pll36xx("fout_epll", "fin_pll", | ||
505 | reg_base + 0x10130); | ||
506 | vpll = samsung_clk_register_pll36xx("fout_vpll", "mout_vpllsrc", | ||
507 | reg_base + 0x10140); | ||
508 | |||
509 | samsung_clk_register_fixed_rate(exynos5250_fixed_rate_clks, | ||
510 | ARRAY_SIZE(exynos5250_fixed_rate_clks)); | ||
511 | samsung_clk_register_fixed_factor(exynos5250_fixed_factor_clks, | ||
512 | ARRAY_SIZE(exynos5250_fixed_factor_clks)); | ||
513 | samsung_clk_register_mux(exynos5250_mux_clks, | ||
514 | ARRAY_SIZE(exynos5250_mux_clks)); | ||
515 | samsung_clk_register_div(exynos5250_div_clks, | ||
516 | ARRAY_SIZE(exynos5250_div_clks)); | ||
517 | samsung_clk_register_gate(exynos5250_gate_clks, | ||
518 | ARRAY_SIZE(exynos5250_gate_clks)); | ||
519 | |||
520 | pr_info("Exynos5250: clock setup completed, armclk=%ld\n", | ||
521 | _get_rate("armclk")); | ||
522 | } | ||
523 | CLK_OF_DECLARE(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init); | ||
diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c new file mode 100644 index 000000000000..a0a094c06f19 --- /dev/null +++ b/drivers/clk/samsung/clk-exynos5440.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Author: Thomas Abraham <thomas.ab@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * Common Clock Framework support for Exynos5440 SoC. | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clkdev.h> | ||
14 | #include <linux/clk-provider.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_address.h> | ||
17 | |||
18 | #include <plat/cpu.h> | ||
19 | #include "clk.h" | ||
20 | #include "clk-pll.h" | ||
21 | |||
22 | #define CLKEN_OV_VAL 0xf8 | ||
23 | #define CPU_CLK_STATUS 0xfc | ||
24 | #define MISC_DOUT1 0x558 | ||
25 | |||
26 | /* | ||
27 | * Let each supported clock get a unique id. This id is used to lookup the clock | ||
28 | * for device tree based platforms. | ||
29 | */ | ||
30 | enum exynos5440_clks { | ||
31 | none, xtal, arm_clk, | ||
32 | |||
33 | spi_baud = 16, pb0_250, pr0_250, pr1_250, b_250, b_125, b_200, sata, | ||
34 | usb, gmac0, cs250, pb0_250_o, pr0_250_o, pr1_250_o, b_250_o, b_125_o, | ||
35 | b_200_o, sata_o, usb_o, gmac0_o, cs250_o, | ||
36 | |||
37 | nr_clks, | ||
38 | }; | ||
39 | |||
40 | /* parent clock name list */ | ||
41 | PNAME(mout_armclk_p) = { "cplla", "cpllb" }; | ||
42 | PNAME(mout_spi_p) = { "div125", "div200" }; | ||
43 | |||
44 | /* fixed rate clocks generated outside the soc */ | ||
45 | struct samsung_fixed_rate_clock exynos5440_fixed_rate_ext_clks[] __initdata = { | ||
46 | FRATE(none, "xtal", NULL, CLK_IS_ROOT, 0), | ||
47 | }; | ||
48 | |||
49 | /* fixed rate clocks */ | ||
50 | struct samsung_fixed_rate_clock exynos5440_fixed_rate_clks[] __initdata = { | ||
51 | FRATE(none, "ppll", NULL, CLK_IS_ROOT, 1000000000), | ||
52 | FRATE(none, "usb_phy0", NULL, CLK_IS_ROOT, 60000000), | ||
53 | FRATE(none, "usb_phy1", NULL, CLK_IS_ROOT, 60000000), | ||
54 | FRATE(none, "usb_ohci12", NULL, CLK_IS_ROOT, 12000000), | ||
55 | FRATE(none, "usb_ohci48", NULL, CLK_IS_ROOT, 48000000), | ||
56 | }; | ||
57 | |||
58 | /* fixed factor clocks */ | ||
59 | struct samsung_fixed_factor_clock exynos5440_fixed_factor_clks[] __initdata = { | ||
60 | FFACTOR(none, "div250", "ppll", 1, 4, 0), | ||
61 | FFACTOR(none, "div200", "ppll", 1, 5, 0), | ||
62 | FFACTOR(none, "div125", "div250", 1, 2, 0), | ||
63 | }; | ||
64 | |||
65 | /* mux clocks */ | ||
66 | struct samsung_mux_clock exynos5440_mux_clks[] __initdata = { | ||
67 | MUX(none, "mout_spi", mout_spi_p, MISC_DOUT1, 5, 1), | ||
68 | MUX_A(arm_clk, "arm_clk", mout_armclk_p, | ||
69 | CPU_CLK_STATUS, 0, 1, "armclk"), | ||
70 | }; | ||
71 | |||
72 | /* divider clocks */ | ||
73 | struct samsung_div_clock exynos5440_div_clks[] __initdata = { | ||
74 | DIV(spi_baud, "div_spi", "mout_spi", MISC_DOUT1, 3, 2), | ||
75 | }; | ||
76 | |||
77 | /* gate clocks */ | ||
78 | struct samsung_gate_clock exynos5440_gate_clks[] __initdata = { | ||
79 | GATE(pb0_250, "pb0_250", "div250", CLKEN_OV_VAL, 3, 0, 0), | ||
80 | GATE(pr0_250, "pr0_250", "div250", CLKEN_OV_VAL, 4, 0, 0), | ||
81 | GATE(pr1_250, "pr1_250", "div250", CLKEN_OV_VAL, 5, 0, 0), | ||
82 | GATE(b_250, "b_250", "div250", CLKEN_OV_VAL, 9, 0, 0), | ||
83 | GATE(b_125, "b_125", "div125", CLKEN_OV_VAL, 10, 0, 0), | ||
84 | GATE(b_200, "b_200", "div200", CLKEN_OV_VAL, 11, 0, 0), | ||
85 | GATE(sata, "sata", "div200", CLKEN_OV_VAL, 12, 0, 0), | ||
86 | GATE(usb, "usb", "div200", CLKEN_OV_VAL, 13, 0, 0), | ||
87 | GATE(gmac0, "gmac0", "div200", CLKEN_OV_VAL, 14, 0, 0), | ||
88 | GATE(cs250, "cs250", "div250", CLKEN_OV_VAL, 19, 0, 0), | ||
89 | GATE(pb0_250_o, "pb0_250_o", "pb0_250", CLKEN_OV_VAL, 3, 0, 0), | ||
90 | GATE(pr0_250_o, "pr0_250_o", "pr0_250", CLKEN_OV_VAL, 4, 0, 0), | ||
91 | GATE(pr1_250_o, "pr1_250_o", "pr1_250", CLKEN_OV_VAL, 5, 0, 0), | ||
92 | GATE(b_250_o, "b_250_o", "b_250", CLKEN_OV_VAL, 9, 0, 0), | ||
93 | GATE(b_125_o, "b_125_o", "b_125", CLKEN_OV_VAL, 10, 0, 0), | ||
94 | GATE(b_200_o, "b_200_o", "b_200", CLKEN_OV_VAL, 11, 0, 0), | ||
95 | GATE(sata_o, "sata_o", "sata", CLKEN_OV_VAL, 12, 0, 0), | ||
96 | GATE(usb_o, "usb_o", "usb", CLKEN_OV_VAL, 13, 0, 0), | ||
97 | GATE(gmac0_o, "gmac0_o", "gmac", CLKEN_OV_VAL, 14, 0, 0), | ||
98 | GATE(cs250_o, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0), | ||
99 | }; | ||
100 | |||
101 | static __initdata struct of_device_id ext_clk_match[] = { | ||
102 | { .compatible = "samsung,clock-xtal", .data = (void *)0, }, | ||
103 | {}, | ||
104 | }; | ||
105 | |||
106 | /* register exynos5440 clocks */ | ||
107 | void __init exynos5440_clk_init(struct device_node *np) | ||
108 | { | ||
109 | void __iomem *reg_base; | ||
110 | |||
111 | reg_base = of_iomap(np, 0); | ||
112 | if (!reg_base) { | ||
113 | pr_err("%s: failed to map clock controller registers," | ||
114 | " aborting clock initialization\n", __func__); | ||
115 | return; | ||
116 | } | ||
117 | |||
118 | samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0); | ||
119 | samsung_clk_of_register_fixed_ext(exynos5440_fixed_rate_ext_clks, | ||
120 | ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match); | ||
121 | |||
122 | samsung_clk_register_pll2550x("cplla", "xtal", reg_base + 0x1c, 0x10); | ||
123 | samsung_clk_register_pll2550x("cpllb", "xtal", reg_base + 0x20, 0x10); | ||
124 | |||
125 | samsung_clk_register_fixed_rate(exynos5440_fixed_rate_clks, | ||
126 | ARRAY_SIZE(exynos5440_fixed_rate_clks)); | ||
127 | samsung_clk_register_fixed_factor(exynos5440_fixed_factor_clks, | ||
128 | ARRAY_SIZE(exynos5440_fixed_factor_clks)); | ||
129 | samsung_clk_register_mux(exynos5440_mux_clks, | ||
130 | ARRAY_SIZE(exynos5440_mux_clks)); | ||
131 | samsung_clk_register_div(exynos5440_div_clks, | ||
132 | ARRAY_SIZE(exynos5440_div_clks)); | ||
133 | samsung_clk_register_gate(exynos5440_gate_clks, | ||
134 | ARRAY_SIZE(exynos5440_gate_clks)); | ||
135 | |||
136 | pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("armclk")); | ||
137 | pr_info("exynos5440 clock initialization complete\n"); | ||
138 | } | ||
139 | CLK_OF_DECLARE(exynos5440_clk, "samsung,exynos5440-clock", exynos5440_clk_init); | ||
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c new file mode 100644 index 000000000000..89135f6be116 --- /dev/null +++ b/drivers/clk/samsung/clk-pll.c | |||
@@ -0,0 +1,419 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This file contains the utility functions to register the pll clocks. | ||
10 | */ | ||
11 | |||
12 | #include <linux/errno.h> | ||
13 | #include "clk.h" | ||
14 | #include "clk-pll.h" | ||
15 | |||
16 | /* | ||
17 | * PLL35xx Clock Type | ||
18 | */ | ||
19 | |||
20 | #define PLL35XX_MDIV_MASK (0x3FF) | ||
21 | #define PLL35XX_PDIV_MASK (0x3F) | ||
22 | #define PLL35XX_SDIV_MASK (0x7) | ||
23 | #define PLL35XX_MDIV_SHIFT (16) | ||
24 | #define PLL35XX_PDIV_SHIFT (8) | ||
25 | #define PLL35XX_SDIV_SHIFT (0) | ||
26 | |||
27 | struct samsung_clk_pll35xx { | ||
28 | struct clk_hw hw; | ||
29 | const void __iomem *con_reg; | ||
30 | }; | ||
31 | |||
32 | #define to_clk_pll35xx(_hw) container_of(_hw, struct samsung_clk_pll35xx, hw) | ||
33 | |||
34 | static unsigned long samsung_pll35xx_recalc_rate(struct clk_hw *hw, | ||
35 | unsigned long parent_rate) | ||
36 | { | ||
37 | struct samsung_clk_pll35xx *pll = to_clk_pll35xx(hw); | ||
38 | u32 mdiv, pdiv, sdiv, pll_con; | ||
39 | u64 fvco = parent_rate; | ||
40 | |||
41 | pll_con = __raw_readl(pll->con_reg); | ||
42 | mdiv = (pll_con >> PLL35XX_MDIV_SHIFT) & PLL35XX_MDIV_MASK; | ||
43 | pdiv = (pll_con >> PLL35XX_PDIV_SHIFT) & PLL35XX_PDIV_MASK; | ||
44 | sdiv = (pll_con >> PLL35XX_SDIV_SHIFT) & PLL35XX_SDIV_MASK; | ||
45 | |||
46 | fvco *= mdiv; | ||
47 | do_div(fvco, (pdiv << sdiv)); | ||
48 | |||
49 | return (unsigned long)fvco; | ||
50 | } | ||
51 | |||
52 | static const struct clk_ops samsung_pll35xx_clk_ops = { | ||
53 | .recalc_rate = samsung_pll35xx_recalc_rate, | ||
54 | }; | ||
55 | |||
56 | struct clk * __init samsung_clk_register_pll35xx(const char *name, | ||
57 | const char *pname, const void __iomem *con_reg) | ||
58 | { | ||
59 | struct samsung_clk_pll35xx *pll; | ||
60 | struct clk *clk; | ||
61 | struct clk_init_data init; | ||
62 | |||
63 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
64 | if (!pll) { | ||
65 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
66 | return NULL; | ||
67 | } | ||
68 | |||
69 | init.name = name; | ||
70 | init.ops = &samsung_pll35xx_clk_ops; | ||
71 | init.flags = CLK_GET_RATE_NOCACHE; | ||
72 | init.parent_names = &pname; | ||
73 | init.num_parents = 1; | ||
74 | |||
75 | pll->hw.init = &init; | ||
76 | pll->con_reg = con_reg; | ||
77 | |||
78 | clk = clk_register(NULL, &pll->hw); | ||
79 | if (IS_ERR(clk)) { | ||
80 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
81 | name); | ||
82 | kfree(pll); | ||
83 | } | ||
84 | |||
85 | if (clk_register_clkdev(clk, name, NULL)) | ||
86 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
87 | |||
88 | return clk; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * PLL36xx Clock Type | ||
93 | */ | ||
94 | |||
95 | #define PLL36XX_KDIV_MASK (0xFFFF) | ||
96 | #define PLL36XX_MDIV_MASK (0x1FF) | ||
97 | #define PLL36XX_PDIV_MASK (0x3F) | ||
98 | #define PLL36XX_SDIV_MASK (0x7) | ||
99 | #define PLL36XX_MDIV_SHIFT (16) | ||
100 | #define PLL36XX_PDIV_SHIFT (8) | ||
101 | #define PLL36XX_SDIV_SHIFT (0) | ||
102 | |||
103 | struct samsung_clk_pll36xx { | ||
104 | struct clk_hw hw; | ||
105 | const void __iomem *con_reg; | ||
106 | }; | ||
107 | |||
108 | #define to_clk_pll36xx(_hw) container_of(_hw, struct samsung_clk_pll36xx, hw) | ||
109 | |||
110 | static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, | ||
111 | unsigned long parent_rate) | ||
112 | { | ||
113 | struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); | ||
114 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; | ||
115 | u64 fvco = parent_rate; | ||
116 | |||
117 | pll_con0 = __raw_readl(pll->con_reg); | ||
118 | pll_con1 = __raw_readl(pll->con_reg + 4); | ||
119 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; | ||
120 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; | ||
121 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; | ||
122 | kdiv = pll_con1 & PLL36XX_KDIV_MASK; | ||
123 | |||
124 | fvco *= (mdiv << 16) + kdiv; | ||
125 | do_div(fvco, (pdiv << sdiv)); | ||
126 | fvco >>= 16; | ||
127 | |||
128 | return (unsigned long)fvco; | ||
129 | } | ||
130 | |||
131 | static const struct clk_ops samsung_pll36xx_clk_ops = { | ||
132 | .recalc_rate = samsung_pll36xx_recalc_rate, | ||
133 | }; | ||
134 | |||
135 | struct clk * __init samsung_clk_register_pll36xx(const char *name, | ||
136 | const char *pname, const void __iomem *con_reg) | ||
137 | { | ||
138 | struct samsung_clk_pll36xx *pll; | ||
139 | struct clk *clk; | ||
140 | struct clk_init_data init; | ||
141 | |||
142 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
143 | if (!pll) { | ||
144 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
145 | return NULL; | ||
146 | } | ||
147 | |||
148 | init.name = name; | ||
149 | init.ops = &samsung_pll36xx_clk_ops; | ||
150 | init.flags = CLK_GET_RATE_NOCACHE; | ||
151 | init.parent_names = &pname; | ||
152 | init.num_parents = 1; | ||
153 | |||
154 | pll->hw.init = &init; | ||
155 | pll->con_reg = con_reg; | ||
156 | |||
157 | clk = clk_register(NULL, &pll->hw); | ||
158 | if (IS_ERR(clk)) { | ||
159 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
160 | name); | ||
161 | kfree(pll); | ||
162 | } | ||
163 | |||
164 | if (clk_register_clkdev(clk, name, NULL)) | ||
165 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
166 | |||
167 | return clk; | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * PLL45xx Clock Type | ||
172 | */ | ||
173 | |||
174 | #define PLL45XX_MDIV_MASK (0x3FF) | ||
175 | #define PLL45XX_PDIV_MASK (0x3F) | ||
176 | #define PLL45XX_SDIV_MASK (0x7) | ||
177 | #define PLL45XX_MDIV_SHIFT (16) | ||
178 | #define PLL45XX_PDIV_SHIFT (8) | ||
179 | #define PLL45XX_SDIV_SHIFT (0) | ||
180 | |||
181 | struct samsung_clk_pll45xx { | ||
182 | struct clk_hw hw; | ||
183 | enum pll45xx_type type; | ||
184 | const void __iomem *con_reg; | ||
185 | }; | ||
186 | |||
187 | #define to_clk_pll45xx(_hw) container_of(_hw, struct samsung_clk_pll45xx, hw) | ||
188 | |||
189 | static unsigned long samsung_pll45xx_recalc_rate(struct clk_hw *hw, | ||
190 | unsigned long parent_rate) | ||
191 | { | ||
192 | struct samsung_clk_pll45xx *pll = to_clk_pll45xx(hw); | ||
193 | u32 mdiv, pdiv, sdiv, pll_con; | ||
194 | u64 fvco = parent_rate; | ||
195 | |||
196 | pll_con = __raw_readl(pll->con_reg); | ||
197 | mdiv = (pll_con >> PLL45XX_MDIV_SHIFT) & PLL45XX_MDIV_MASK; | ||
198 | pdiv = (pll_con >> PLL45XX_PDIV_SHIFT) & PLL45XX_PDIV_MASK; | ||
199 | sdiv = (pll_con >> PLL45XX_SDIV_SHIFT) & PLL45XX_SDIV_MASK; | ||
200 | |||
201 | if (pll->type == pll_4508) | ||
202 | sdiv = sdiv - 1; | ||
203 | |||
204 | fvco *= mdiv; | ||
205 | do_div(fvco, (pdiv << sdiv)); | ||
206 | |||
207 | return (unsigned long)fvco; | ||
208 | } | ||
209 | |||
210 | static const struct clk_ops samsung_pll45xx_clk_ops = { | ||
211 | .recalc_rate = samsung_pll45xx_recalc_rate, | ||
212 | }; | ||
213 | |||
214 | struct clk * __init samsung_clk_register_pll45xx(const char *name, | ||
215 | const char *pname, const void __iomem *con_reg, | ||
216 | enum pll45xx_type type) | ||
217 | { | ||
218 | struct samsung_clk_pll45xx *pll; | ||
219 | struct clk *clk; | ||
220 | struct clk_init_data init; | ||
221 | |||
222 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
223 | if (!pll) { | ||
224 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
225 | return NULL; | ||
226 | } | ||
227 | |||
228 | init.name = name; | ||
229 | init.ops = &samsung_pll45xx_clk_ops; | ||
230 | init.flags = CLK_GET_RATE_NOCACHE; | ||
231 | init.parent_names = &pname; | ||
232 | init.num_parents = 1; | ||
233 | |||
234 | pll->hw.init = &init; | ||
235 | pll->con_reg = con_reg; | ||
236 | pll->type = type; | ||
237 | |||
238 | clk = clk_register(NULL, &pll->hw); | ||
239 | if (IS_ERR(clk)) { | ||
240 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
241 | name); | ||
242 | kfree(pll); | ||
243 | } | ||
244 | |||
245 | if (clk_register_clkdev(clk, name, NULL)) | ||
246 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
247 | |||
248 | return clk; | ||
249 | } | ||
250 | |||
251 | /* | ||
252 | * PLL46xx Clock Type | ||
253 | */ | ||
254 | |||
255 | #define PLL46XX_MDIV_MASK (0x1FF) | ||
256 | #define PLL46XX_PDIV_MASK (0x3F) | ||
257 | #define PLL46XX_SDIV_MASK (0x7) | ||
258 | #define PLL46XX_MDIV_SHIFT (16) | ||
259 | #define PLL46XX_PDIV_SHIFT (8) | ||
260 | #define PLL46XX_SDIV_SHIFT (0) | ||
261 | |||
262 | #define PLL46XX_KDIV_MASK (0xFFFF) | ||
263 | #define PLL4650C_KDIV_MASK (0xFFF) | ||
264 | #define PLL46XX_KDIV_SHIFT (0) | ||
265 | |||
266 | struct samsung_clk_pll46xx { | ||
267 | struct clk_hw hw; | ||
268 | enum pll46xx_type type; | ||
269 | const void __iomem *con_reg; | ||
270 | }; | ||
271 | |||
272 | #define to_clk_pll46xx(_hw) container_of(_hw, struct samsung_clk_pll46xx, hw) | ||
273 | |||
274 | static unsigned long samsung_pll46xx_recalc_rate(struct clk_hw *hw, | ||
275 | unsigned long parent_rate) | ||
276 | { | ||
277 | struct samsung_clk_pll46xx *pll = to_clk_pll46xx(hw); | ||
278 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1, shift; | ||
279 | u64 fvco = parent_rate; | ||
280 | |||
281 | pll_con0 = __raw_readl(pll->con_reg); | ||
282 | pll_con1 = __raw_readl(pll->con_reg + 4); | ||
283 | mdiv = (pll_con0 >> PLL46XX_MDIV_SHIFT) & PLL46XX_MDIV_MASK; | ||
284 | pdiv = (pll_con0 >> PLL46XX_PDIV_SHIFT) & PLL46XX_PDIV_MASK; | ||
285 | sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK; | ||
286 | kdiv = pll->type == pll_4650c ? pll_con1 & PLL4650C_KDIV_MASK : | ||
287 | pll_con1 & PLL46XX_KDIV_MASK; | ||
288 | |||
289 | shift = pll->type == pll_4600 ? 16 : 10; | ||
290 | fvco *= (mdiv << shift) + kdiv; | ||
291 | do_div(fvco, (pdiv << sdiv)); | ||
292 | fvco >>= shift; | ||
293 | |||
294 | return (unsigned long)fvco; | ||
295 | } | ||
296 | |||
297 | static const struct clk_ops samsung_pll46xx_clk_ops = { | ||
298 | .recalc_rate = samsung_pll46xx_recalc_rate, | ||
299 | }; | ||
300 | |||
301 | struct clk * __init samsung_clk_register_pll46xx(const char *name, | ||
302 | const char *pname, const void __iomem *con_reg, | ||
303 | enum pll46xx_type type) | ||
304 | { | ||
305 | struct samsung_clk_pll46xx *pll; | ||
306 | struct clk *clk; | ||
307 | struct clk_init_data init; | ||
308 | |||
309 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
310 | if (!pll) { | ||
311 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
312 | return NULL; | ||
313 | } | ||
314 | |||
315 | init.name = name; | ||
316 | init.ops = &samsung_pll46xx_clk_ops; | ||
317 | init.flags = CLK_GET_RATE_NOCACHE; | ||
318 | init.parent_names = &pname; | ||
319 | init.num_parents = 1; | ||
320 | |||
321 | pll->hw.init = &init; | ||
322 | pll->con_reg = con_reg; | ||
323 | pll->type = type; | ||
324 | |||
325 | clk = clk_register(NULL, &pll->hw); | ||
326 | if (IS_ERR(clk)) { | ||
327 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
328 | name); | ||
329 | kfree(pll); | ||
330 | } | ||
331 | |||
332 | if (clk_register_clkdev(clk, name, NULL)) | ||
333 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
334 | |||
335 | return clk; | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * PLL2550x Clock Type | ||
340 | */ | ||
341 | |||
342 | #define PLL2550X_R_MASK (0x1) | ||
343 | #define PLL2550X_P_MASK (0x3F) | ||
344 | #define PLL2550X_M_MASK (0x3FF) | ||
345 | #define PLL2550X_S_MASK (0x7) | ||
346 | #define PLL2550X_R_SHIFT (20) | ||
347 | #define PLL2550X_P_SHIFT (14) | ||
348 | #define PLL2550X_M_SHIFT (4) | ||
349 | #define PLL2550X_S_SHIFT (0) | ||
350 | |||
351 | struct samsung_clk_pll2550x { | ||
352 | struct clk_hw hw; | ||
353 | const void __iomem *reg_base; | ||
354 | unsigned long offset; | ||
355 | }; | ||
356 | |||
357 | #define to_clk_pll2550x(_hw) container_of(_hw, struct samsung_clk_pll2550x, hw) | ||
358 | |||
359 | static unsigned long samsung_pll2550x_recalc_rate(struct clk_hw *hw, | ||
360 | unsigned long parent_rate) | ||
361 | { | ||
362 | struct samsung_clk_pll2550x *pll = to_clk_pll2550x(hw); | ||
363 | u32 r, p, m, s, pll_stat; | ||
364 | u64 fvco = parent_rate; | ||
365 | |||
366 | pll_stat = __raw_readl(pll->reg_base + pll->offset * 3); | ||
367 | r = (pll_stat >> PLL2550X_R_SHIFT) & PLL2550X_R_MASK; | ||
368 | if (!r) | ||
369 | return 0; | ||
370 | p = (pll_stat >> PLL2550X_P_SHIFT) & PLL2550X_P_MASK; | ||
371 | m = (pll_stat >> PLL2550X_M_SHIFT) & PLL2550X_M_MASK; | ||
372 | s = (pll_stat >> PLL2550X_S_SHIFT) & PLL2550X_S_MASK; | ||
373 | |||
374 | fvco *= m; | ||
375 | do_div(fvco, (p << s)); | ||
376 | |||
377 | return (unsigned long)fvco; | ||
378 | } | ||
379 | |||
380 | static const struct clk_ops samsung_pll2550x_clk_ops = { | ||
381 | .recalc_rate = samsung_pll2550x_recalc_rate, | ||
382 | }; | ||
383 | |||
384 | struct clk * __init samsung_clk_register_pll2550x(const char *name, | ||
385 | const char *pname, const void __iomem *reg_base, | ||
386 | const unsigned long offset) | ||
387 | { | ||
388 | struct samsung_clk_pll2550x *pll; | ||
389 | struct clk *clk; | ||
390 | struct clk_init_data init; | ||
391 | |||
392 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
393 | if (!pll) { | ||
394 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
395 | return NULL; | ||
396 | } | ||
397 | |||
398 | init.name = name; | ||
399 | init.ops = &samsung_pll2550x_clk_ops; | ||
400 | init.flags = CLK_GET_RATE_NOCACHE; | ||
401 | init.parent_names = &pname; | ||
402 | init.num_parents = 1; | ||
403 | |||
404 | pll->hw.init = &init; | ||
405 | pll->reg_base = reg_base; | ||
406 | pll->offset = offset; | ||
407 | |||
408 | clk = clk_register(NULL, &pll->hw); | ||
409 | if (IS_ERR(clk)) { | ||
410 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
411 | name); | ||
412 | kfree(pll); | ||
413 | } | ||
414 | |||
415 | if (clk_register_clkdev(clk, name, NULL)) | ||
416 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
417 | |||
418 | return clk; | ||
419 | } | ||
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h new file mode 100644 index 000000000000..f33786e9a78b --- /dev/null +++ b/drivers/clk/samsung/clk-pll.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * Common Clock Framework support for all PLL's in Samsung platforms | ||
10 | */ | ||
11 | |||
12 | #ifndef __SAMSUNG_CLK_PLL_H | ||
13 | #define __SAMSUNG_CLK_PLL_H | ||
14 | |||
15 | enum pll45xx_type { | ||
16 | pll_4500, | ||
17 | pll_4502, | ||
18 | pll_4508 | ||
19 | }; | ||
20 | |||
21 | enum pll46xx_type { | ||
22 | pll_4600, | ||
23 | pll_4650, | ||
24 | pll_4650c, | ||
25 | }; | ||
26 | |||
27 | extern struct clk * __init samsung_clk_register_pll35xx(const char *name, | ||
28 | const char *pname, const void __iomem *con_reg); | ||
29 | extern struct clk * __init samsung_clk_register_pll36xx(const char *name, | ||
30 | const char *pname, const void __iomem *con_reg); | ||
31 | extern struct clk * __init samsung_clk_register_pll45xx(const char *name, | ||
32 | const char *pname, const void __iomem *con_reg, | ||
33 | enum pll45xx_type type); | ||
34 | extern struct clk * __init samsung_clk_register_pll46xx(const char *name, | ||
35 | const char *pname, const void __iomem *con_reg, | ||
36 | enum pll46xx_type type); | ||
37 | extern struct clk * __init samsung_clk_register_pll2550x(const char *name, | ||
38 | const char *pname, const void __iomem *reg_base, | ||
39 | const unsigned long offset); | ||
40 | |||
41 | #endif /* __SAMSUNG_CLK_PLL_H */ | ||
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c new file mode 100644 index 000000000000..cd3c40ab50f3 --- /dev/null +++ b/drivers/clk/samsung/clk.c | |||
@@ -0,0 +1,320 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This file includes utility functions to register clocks to common | ||
11 | * clock framework for Samsung platforms. | ||
12 | */ | ||
13 | |||
14 | #include <linux/syscore_ops.h> | ||
15 | #include "clk.h" | ||
16 | |||
17 | static DEFINE_SPINLOCK(lock); | ||
18 | static struct clk **clk_table; | ||
19 | static void __iomem *reg_base; | ||
20 | #ifdef CONFIG_OF | ||
21 | static struct clk_onecell_data clk_data; | ||
22 | #endif | ||
23 | |||
24 | #ifdef CONFIG_PM_SLEEP | ||
25 | static struct samsung_clk_reg_dump *reg_dump; | ||
26 | static unsigned long nr_reg_dump; | ||
27 | |||
28 | static int samsung_clk_suspend(void) | ||
29 | { | ||
30 | struct samsung_clk_reg_dump *rd = reg_dump; | ||
31 | unsigned long i; | ||
32 | |||
33 | for (i = 0; i < nr_reg_dump; i++, rd++) | ||
34 | rd->value = __raw_readl(reg_base + rd->offset); | ||
35 | |||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static void samsung_clk_resume(void) | ||
40 | { | ||
41 | struct samsung_clk_reg_dump *rd = reg_dump; | ||
42 | unsigned long i; | ||
43 | |||
44 | for (i = 0; i < nr_reg_dump; i++, rd++) | ||
45 | __raw_writel(rd->value, reg_base + rd->offset); | ||
46 | } | ||
47 | |||
48 | static struct syscore_ops samsung_clk_syscore_ops = { | ||
49 | .suspend = samsung_clk_suspend, | ||
50 | .resume = samsung_clk_resume, | ||
51 | }; | ||
52 | #endif /* CONFIG_PM_SLEEP */ | ||
53 | |||
54 | /* setup the essentials required to support clock lookup using ccf */ | ||
55 | void __init samsung_clk_init(struct device_node *np, void __iomem *base, | ||
56 | unsigned long nr_clks, unsigned long *rdump, | ||
57 | unsigned long nr_rdump, unsigned long *soc_rdump, | ||
58 | unsigned long nr_soc_rdump) | ||
59 | { | ||
60 | reg_base = base; | ||
61 | |||
62 | #ifdef CONFIG_PM_SLEEP | ||
63 | if (rdump && nr_rdump) { | ||
64 | unsigned int idx; | ||
65 | reg_dump = kzalloc(sizeof(struct samsung_clk_reg_dump) | ||
66 | * (nr_rdump + nr_soc_rdump), GFP_KERNEL); | ||
67 | if (!reg_dump) { | ||
68 | pr_err("%s: memory alloc for register dump failed\n", | ||
69 | __func__); | ||
70 | return; | ||
71 | } | ||
72 | |||
73 | for (idx = 0; idx < nr_rdump; idx++) | ||
74 | reg_dump[idx].offset = rdump[idx]; | ||
75 | for (idx = 0; idx < nr_soc_rdump; idx++) | ||
76 | reg_dump[nr_rdump + idx].offset = soc_rdump[idx]; | ||
77 | nr_reg_dump = nr_rdump + nr_soc_rdump; | ||
78 | register_syscore_ops(&samsung_clk_syscore_ops); | ||
79 | } | ||
80 | #endif | ||
81 | |||
82 | clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); | ||
83 | if (!clk_table) | ||
84 | panic("could not allocate clock lookup table\n"); | ||
85 | |||
86 | if (!np) | ||
87 | return; | ||
88 | |||
89 | #ifdef CONFIG_OF | ||
90 | clk_data.clks = clk_table; | ||
91 | clk_data.clk_num = nr_clks; | ||
92 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
93 | #endif | ||
94 | } | ||
95 | |||
96 | /* add a clock instance to the clock lookup table used for dt based lookup */ | ||
97 | void samsung_clk_add_lookup(struct clk *clk, unsigned int id) | ||
98 | { | ||
99 | if (clk_table && id) | ||
100 | clk_table[id] = clk; | ||
101 | } | ||
102 | |||
103 | /* register a list of aliases */ | ||
104 | void __init samsung_clk_register_alias(struct samsung_clock_alias *list, | ||
105 | unsigned int nr_clk) | ||
106 | { | ||
107 | struct clk *clk; | ||
108 | unsigned int idx, ret; | ||
109 | |||
110 | if (!clk_table) { | ||
111 | pr_err("%s: clock table missing\n", __func__); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
116 | if (!list->id) { | ||
117 | pr_err("%s: clock id missing for index %d\n", __func__, | ||
118 | idx); | ||
119 | continue; | ||
120 | } | ||
121 | |||
122 | clk = clk_table[list->id]; | ||
123 | if (!clk) { | ||
124 | pr_err("%s: failed to find clock %d\n", __func__, | ||
125 | list->id); | ||
126 | continue; | ||
127 | } | ||
128 | |||
129 | ret = clk_register_clkdev(clk, list->alias, list->dev_name); | ||
130 | if (ret) | ||
131 | pr_err("%s: failed to register lookup %s\n", | ||
132 | __func__, list->alias); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | /* register a list of fixed clocks */ | ||
137 | void __init samsung_clk_register_fixed_rate( | ||
138 | struct samsung_fixed_rate_clock *list, unsigned int nr_clk) | ||
139 | { | ||
140 | struct clk *clk; | ||
141 | unsigned int idx, ret; | ||
142 | |||
143 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
144 | clk = clk_register_fixed_rate(NULL, list->name, | ||
145 | list->parent_name, list->flags, list->fixed_rate); | ||
146 | if (IS_ERR(clk)) { | ||
147 | pr_err("%s: failed to register clock %s\n", __func__, | ||
148 | list->name); | ||
149 | continue; | ||
150 | } | ||
151 | |||
152 | samsung_clk_add_lookup(clk, list->id); | ||
153 | |||
154 | /* | ||
155 | * Unconditionally add a clock lookup for the fixed rate clocks. | ||
156 | * There are not many of these on any of Samsung platforms. | ||
157 | */ | ||
158 | ret = clk_register_clkdev(clk, list->name, NULL); | ||
159 | if (ret) | ||
160 | pr_err("%s: failed to register clock lookup for %s", | ||
161 | __func__, list->name); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /* register a list of fixed factor clocks */ | ||
166 | void __init samsung_clk_register_fixed_factor( | ||
167 | struct samsung_fixed_factor_clock *list, unsigned int nr_clk) | ||
168 | { | ||
169 | struct clk *clk; | ||
170 | unsigned int idx; | ||
171 | |||
172 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
173 | clk = clk_register_fixed_factor(NULL, list->name, | ||
174 | list->parent_name, list->flags, list->mult, list->div); | ||
175 | if (IS_ERR(clk)) { | ||
176 | pr_err("%s: failed to register clock %s\n", __func__, | ||
177 | list->name); | ||
178 | continue; | ||
179 | } | ||
180 | |||
181 | samsung_clk_add_lookup(clk, list->id); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /* register a list of mux clocks */ | ||
186 | void __init samsung_clk_register_mux(struct samsung_mux_clock *list, | ||
187 | unsigned int nr_clk) | ||
188 | { | ||
189 | struct clk *clk; | ||
190 | unsigned int idx, ret; | ||
191 | |||
192 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
193 | clk = clk_register_mux(NULL, list->name, list->parent_names, | ||
194 | list->num_parents, list->flags, reg_base + list->offset, | ||
195 | list->shift, list->width, list->mux_flags, &lock); | ||
196 | if (IS_ERR(clk)) { | ||
197 | pr_err("%s: failed to register clock %s\n", __func__, | ||
198 | list->name); | ||
199 | continue; | ||
200 | } | ||
201 | |||
202 | samsung_clk_add_lookup(clk, list->id); | ||
203 | |||
204 | /* register a clock lookup only if a clock alias is specified */ | ||
205 | if (list->alias) { | ||
206 | ret = clk_register_clkdev(clk, list->alias, | ||
207 | list->dev_name); | ||
208 | if (ret) | ||
209 | pr_err("%s: failed to register lookup %s\n", | ||
210 | __func__, list->alias); | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /* register a list of div clocks */ | ||
216 | void __init samsung_clk_register_div(struct samsung_div_clock *list, | ||
217 | unsigned int nr_clk) | ||
218 | { | ||
219 | struct clk *clk; | ||
220 | unsigned int idx, ret; | ||
221 | |||
222 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
223 | if (list->table) | ||
224 | clk = clk_register_divider_table(NULL, list->name, | ||
225 | list->parent_name, list->flags, | ||
226 | reg_base + list->offset, list->shift, | ||
227 | list->width, list->div_flags, | ||
228 | list->table, &lock); | ||
229 | else | ||
230 | clk = clk_register_divider(NULL, list->name, | ||
231 | list->parent_name, list->flags, | ||
232 | reg_base + list->offset, list->shift, | ||
233 | list->width, list->div_flags, &lock); | ||
234 | if (IS_ERR(clk)) { | ||
235 | pr_err("%s: failed to register clock %s\n", __func__, | ||
236 | list->name); | ||
237 | continue; | ||
238 | } | ||
239 | |||
240 | samsung_clk_add_lookup(clk, list->id); | ||
241 | |||
242 | /* register a clock lookup only if a clock alias is specified */ | ||
243 | if (list->alias) { | ||
244 | ret = clk_register_clkdev(clk, list->alias, | ||
245 | list->dev_name); | ||
246 | if (ret) | ||
247 | pr_err("%s: failed to register lookup %s\n", | ||
248 | __func__, list->alias); | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | |||
253 | /* register a list of gate clocks */ | ||
254 | void __init samsung_clk_register_gate(struct samsung_gate_clock *list, | ||
255 | unsigned int nr_clk) | ||
256 | { | ||
257 | struct clk *clk; | ||
258 | unsigned int idx, ret; | ||
259 | |||
260 | for (idx = 0; idx < nr_clk; idx++, list++) { | ||
261 | clk = clk_register_gate(NULL, list->name, list->parent_name, | ||
262 | list->flags, reg_base + list->offset, | ||
263 | list->bit_idx, list->gate_flags, &lock); | ||
264 | if (IS_ERR(clk)) { | ||
265 | pr_err("%s: failed to register clock %s\n", __func__, | ||
266 | list->name); | ||
267 | continue; | ||
268 | } | ||
269 | |||
270 | /* register a clock lookup only if a clock alias is specified */ | ||
271 | if (list->alias) { | ||
272 | ret = clk_register_clkdev(clk, list->alias, | ||
273 | list->dev_name); | ||
274 | if (ret) | ||
275 | pr_err("%s: failed to register lookup %s\n", | ||
276 | __func__, list->alias); | ||
277 | } | ||
278 | |||
279 | samsung_clk_add_lookup(clk, list->id); | ||
280 | } | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | * obtain the clock speed of all external fixed clock sources from device | ||
285 | * tree and register it | ||
286 | */ | ||
287 | #ifdef CONFIG_OF | ||
288 | void __init samsung_clk_of_register_fixed_ext( | ||
289 | struct samsung_fixed_rate_clock *fixed_rate_clk, | ||
290 | unsigned int nr_fixed_rate_clk, | ||
291 | struct of_device_id *clk_matches) | ||
292 | { | ||
293 | const struct of_device_id *match; | ||
294 | struct device_node *np; | ||
295 | u32 freq; | ||
296 | |||
297 | for_each_matching_node_and_match(np, clk_matches, &match) { | ||
298 | if (of_property_read_u32(np, "clock-frequency", &freq)) | ||
299 | continue; | ||
300 | fixed_rate_clk[(u32)match->data].fixed_rate = freq; | ||
301 | } | ||
302 | samsung_clk_register_fixed_rate(fixed_rate_clk, nr_fixed_rate_clk); | ||
303 | } | ||
304 | #endif | ||
305 | |||
306 | /* utility function to get the rate of a specified clock */ | ||
307 | unsigned long _get_rate(const char *clk_name) | ||
308 | { | ||
309 | struct clk *clk; | ||
310 | unsigned long rate; | ||
311 | |||
312 | clk = clk_get(NULL, clk_name); | ||
313 | if (IS_ERR(clk)) { | ||
314 | pr_err("%s: could not find clock %s\n", __func__, clk_name); | ||
315 | return 0; | ||
316 | } | ||
317 | rate = clk_get_rate(clk); | ||
318 | clk_put(clk); | ||
319 | return rate; | ||
320 | } | ||
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h new file mode 100644 index 000000000000..10b2111f0c0f --- /dev/null +++ b/drivers/clk/samsung/clk.h | |||
@@ -0,0 +1,289 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. | ||
3 | * Copyright (c) 2013 Linaro Ltd. | ||
4 | * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Common Clock Framework support for all Samsung platforms | ||
11 | */ | ||
12 | |||
13 | #ifndef __SAMSUNG_CLK_H | ||
14 | #define __SAMSUNG_CLK_H | ||
15 | |||
16 | #include <linux/clk.h> | ||
17 | #include <linux/clkdev.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | |||
23 | #include <mach/map.h> | ||
24 | |||
25 | /** | ||
26 | * struct samsung_clock_alias: information about mux clock | ||
27 | * @id: platform specific id of the clock. | ||
28 | * @dev_name: name of the device to which this clock belongs. | ||
29 | * @alias: optional clock alias name to be assigned to this clock. | ||
30 | */ | ||
31 | struct samsung_clock_alias { | ||
32 | unsigned int id; | ||
33 | const char *dev_name; | ||
34 | const char *alias; | ||
35 | }; | ||
36 | |||
37 | #define ALIAS(_id, dname, a) \ | ||
38 | { \ | ||
39 | .id = _id, \ | ||
40 | .dev_name = dname, \ | ||
41 | .alias = a, \ | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * struct samsung_fixed_rate_clock: information about fixed-rate clock | ||
46 | * @id: platform specific id of the clock. | ||
47 | * @name: name of this fixed-rate clock. | ||
48 | * @parent_name: optional parent clock name. | ||
49 | * @flags: optional fixed-rate clock flags. | ||
50 | * @fixed-rate: fixed clock rate of this clock. | ||
51 | */ | ||
52 | struct samsung_fixed_rate_clock { | ||
53 | unsigned int id; | ||
54 | char *name; | ||
55 | const char *parent_name; | ||
56 | unsigned long flags; | ||
57 | unsigned long fixed_rate; | ||
58 | }; | ||
59 | |||
60 | #define FRATE(_id, cname, pname, f, frate) \ | ||
61 | { \ | ||
62 | .id = _id, \ | ||
63 | .name = cname, \ | ||
64 | .parent_name = pname, \ | ||
65 | .flags = f, \ | ||
66 | .fixed_rate = frate, \ | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * struct samsung_fixed_factor_clock: information about fixed-factor clock | ||
71 | * @id: platform specific id of the clock. | ||
72 | * @name: name of this fixed-factor clock. | ||
73 | * @parent_name: parent clock name. | ||
74 | * @mult: fixed multiplication factor. | ||
75 | * @div: fixed division factor. | ||
76 | * @flags: optional fixed-factor clock flags. | ||
77 | */ | ||
78 | struct samsung_fixed_factor_clock { | ||
79 | unsigned int id; | ||
80 | char *name; | ||
81 | const char *parent_name; | ||
82 | unsigned long mult; | ||
83 | unsigned long div; | ||
84 | unsigned long flags; | ||
85 | }; | ||
86 | |||
87 | #define FFACTOR(_id, cname, pname, m, d, f) \ | ||
88 | { \ | ||
89 | .id = _id, \ | ||
90 | .name = cname, \ | ||
91 | .parent_name = pname, \ | ||
92 | .mult = m, \ | ||
93 | .div = d, \ | ||
94 | .flags = f, \ | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * struct samsung_mux_clock: information about mux clock | ||
99 | * @id: platform specific id of the clock. | ||
100 | * @dev_name: name of the device to which this clock belongs. | ||
101 | * @name: name of this mux clock. | ||
102 | * @parent_names: array of pointer to parent clock names. | ||
103 | * @num_parents: number of parents listed in @parent_names. | ||
104 | * @flags: optional flags for basic clock. | ||
105 | * @offset: offset of the register for configuring the mux. | ||
106 | * @shift: starting bit location of the mux control bit-field in @reg. | ||
107 | * @width: width of the mux control bit-field in @reg. | ||
108 | * @mux_flags: flags for mux-type clock. | ||
109 | * @alias: optional clock alias name to be assigned to this clock. | ||
110 | */ | ||
111 | struct samsung_mux_clock { | ||
112 | unsigned int id; | ||
113 | const char *dev_name; | ||
114 | const char *name; | ||
115 | const char **parent_names; | ||
116 | u8 num_parents; | ||
117 | unsigned long flags; | ||
118 | unsigned long offset; | ||
119 | u8 shift; | ||
120 | u8 width; | ||
121 | u8 mux_flags; | ||
122 | const char *alias; | ||
123 | }; | ||
124 | |||
125 | #define __MUX(_id, dname, cname, pnames, o, s, w, f, mf, a) \ | ||
126 | { \ | ||
127 | .id = _id, \ | ||
128 | .dev_name = dname, \ | ||
129 | .name = cname, \ | ||
130 | .parent_names = pnames, \ | ||
131 | .num_parents = ARRAY_SIZE(pnames), \ | ||
132 | .flags = f, \ | ||
133 | .offset = o, \ | ||
134 | .shift = s, \ | ||
135 | .width = w, \ | ||
136 | .mux_flags = mf, \ | ||
137 | .alias = a, \ | ||
138 | } | ||
139 | |||
140 | #define MUX(_id, cname, pnames, o, s, w) \ | ||
141 | __MUX(_id, NULL, cname, pnames, o, s, w, 0, 0, NULL) | ||
142 | |||
143 | #define MUX_A(_id, cname, pnames, o, s, w, a) \ | ||
144 | __MUX(_id, NULL, cname, pnames, o, s, w, 0, 0, a) | ||
145 | |||
146 | #define MUX_F(_id, cname, pnames, o, s, w, f, mf) \ | ||
147 | __MUX(_id, NULL, cname, pnames, o, s, w, f, mf, NULL) | ||
148 | |||
149 | /** | ||
150 | * @id: platform specific id of the clock. | ||
151 | * struct samsung_div_clock: information about div clock | ||
152 | * @dev_name: name of the device to which this clock belongs. | ||
153 | * @name: name of this div clock. | ||
154 | * @parent_name: name of the parent clock. | ||
155 | * @flags: optional flags for basic clock. | ||
156 | * @offset: offset of the register for configuring the div. | ||
157 | * @shift: starting bit location of the div control bit-field in @reg. | ||
158 | * @div_flags: flags for div-type clock. | ||
159 | * @alias: optional clock alias name to be assigned to this clock. | ||
160 | */ | ||
161 | struct samsung_div_clock { | ||
162 | unsigned int id; | ||
163 | const char *dev_name; | ||
164 | const char *name; | ||
165 | const char *parent_name; | ||
166 | unsigned long flags; | ||
167 | unsigned long offset; | ||
168 | u8 shift; | ||
169 | u8 width; | ||
170 | u8 div_flags; | ||
171 | const char *alias; | ||
172 | struct clk_div_table *table; | ||
173 | }; | ||
174 | |||
175 | #define __DIV(_id, dname, cname, pname, o, s, w, f, df, a, t) \ | ||
176 | { \ | ||
177 | .id = _id, \ | ||
178 | .dev_name = dname, \ | ||
179 | .name = cname, \ | ||
180 | .parent_name = pname, \ | ||
181 | .flags = f, \ | ||
182 | .offset = o, \ | ||
183 | .shift = s, \ | ||
184 | .width = w, \ | ||
185 | .div_flags = df, \ | ||
186 | .alias = a, \ | ||
187 | .table = t, \ | ||
188 | } | ||
189 | |||
190 | #define DIV(_id, cname, pname, o, s, w) \ | ||
191 | __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, NULL) | ||
192 | |||
193 | #define DIV_A(_id, cname, pname, o, s, w, a) \ | ||
194 | __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, a, NULL) | ||
195 | |||
196 | #define DIV_F(_id, cname, pname, o, s, w, f, df) \ | ||
197 | __DIV(_id, NULL, cname, pname, o, s, w, f, df, NULL, NULL) | ||
198 | |||
199 | #define DIV_T(_id, cname, pname, o, s, w, t) \ | ||
200 | __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, t) | ||
201 | |||
202 | /** | ||
203 | * struct samsung_gate_clock: information about gate clock | ||
204 | * @id: platform specific id of the clock. | ||
205 | * @dev_name: name of the device to which this clock belongs. | ||
206 | * @name: name of this gate clock. | ||
207 | * @parent_name: name of the parent clock. | ||
208 | * @flags: optional flags for basic clock. | ||
209 | * @offset: offset of the register for configuring the gate. | ||
210 | * @bit_idx: bit index of the gate control bit-field in @reg. | ||
211 | * @gate_flags: flags for gate-type clock. | ||
212 | * @alias: optional clock alias name to be assigned to this clock. | ||
213 | */ | ||
214 | struct samsung_gate_clock { | ||
215 | unsigned int id; | ||
216 | const char *dev_name; | ||
217 | const char *name; | ||
218 | const char *parent_name; | ||
219 | unsigned long flags; | ||
220 | unsigned long offset; | ||
221 | u8 bit_idx; | ||
222 | u8 gate_flags; | ||
223 | const char *alias; | ||
224 | }; | ||
225 | |||
226 | #define __GATE(_id, dname, cname, pname, o, b, f, gf, a) \ | ||
227 | { \ | ||
228 | .id = _id, \ | ||
229 | .dev_name = dname, \ | ||
230 | .name = cname, \ | ||
231 | .parent_name = pname, \ | ||
232 | .flags = f, \ | ||
233 | .offset = o, \ | ||
234 | .bit_idx = b, \ | ||
235 | .gate_flags = gf, \ | ||
236 | .alias = a, \ | ||
237 | } | ||
238 | |||
239 | #define GATE(_id, cname, pname, o, b, f, gf) \ | ||
240 | __GATE(_id, NULL, cname, pname, o, b, f, gf, NULL) | ||
241 | |||
242 | #define GATE_A(_id, cname, pname, o, b, f, gf, a) \ | ||
243 | __GATE(_id, NULL, cname, pname, o, b, f, gf, a) | ||
244 | |||
245 | #define GATE_D(_id, dname, cname, pname, o, b, f, gf) \ | ||
246 | __GATE(_id, dname, cname, pname, o, b, f, gf, NULL) | ||
247 | |||
248 | #define GATE_DA(_id, dname, cname, pname, o, b, f, gf, a) \ | ||
249 | __GATE(_id, dname, cname, pname, o, b, f, gf, a) | ||
250 | |||
251 | #define PNAME(x) static const char *x[] __initdata | ||
252 | |||
253 | /** | ||
254 | * struct samsung_clk_reg_dump: register dump of clock controller registers. | ||
255 | * @offset: clock register offset from the controller base address. | ||
256 | * @value: the value to be register at offset. | ||
257 | */ | ||
258 | struct samsung_clk_reg_dump { | ||
259 | u32 offset; | ||
260 | u32 value; | ||
261 | }; | ||
262 | |||
263 | extern void __init samsung_clk_init(struct device_node *np, void __iomem *base, | ||
264 | unsigned long nr_clks, unsigned long *rdump, | ||
265 | unsigned long nr_rdump, unsigned long *soc_rdump, | ||
266 | unsigned long nr_soc_rdump); | ||
267 | extern void __init samsung_clk_of_register_fixed_ext( | ||
268 | struct samsung_fixed_rate_clock *fixed_rate_clk, | ||
269 | unsigned int nr_fixed_rate_clk, | ||
270 | struct of_device_id *clk_matches); | ||
271 | |||
272 | extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id); | ||
273 | |||
274 | extern void samsung_clk_register_alias(struct samsung_clock_alias *list, | ||
275 | unsigned int nr_clk); | ||
276 | extern void __init samsung_clk_register_fixed_rate( | ||
277 | struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk); | ||
278 | extern void __init samsung_clk_register_fixed_factor( | ||
279 | struct samsung_fixed_factor_clock *list, unsigned int nr_clk); | ||
280 | extern void __init samsung_clk_register_mux(struct samsung_mux_clock *clk_list, | ||
281 | unsigned int nr_clk); | ||
282 | extern void __init samsung_clk_register_div(struct samsung_div_clock *clk_list, | ||
283 | unsigned int nr_clk); | ||
284 | extern void __init samsung_clk_register_gate( | ||
285 | struct samsung_gate_clock *clk_list, unsigned int nr_clk); | ||
286 | |||
287 | extern unsigned long _get_rate(const char *clk_name); | ||
288 | |||
289 | #endif /* __SAMSUNG_CLK_H */ | ||
diff --git a/drivers/clk/tegra/Makefile b/drivers/clk/tegra/Makefile index 2b41b0f4f731..f49fac2d193a 100644 --- a/drivers/clk/tegra/Makefile +++ b/drivers/clk/tegra/Makefile | |||
@@ -9,3 +9,4 @@ obj-y += clk-super.o | |||
9 | 9 | ||
10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o | 10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o |
11 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o | 11 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o |
12 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o | ||
diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c index 6dd533251e7b..bafee9895a24 100644 --- a/drivers/clk/tegra/clk-periph-gate.c +++ b/drivers/clk/tegra/clk-periph-gate.c | |||
@@ -41,7 +41,9 @@ static DEFINE_SPINLOCK(periph_ref_lock); | |||
41 | #define write_rst_clr(val, gate) \ | 41 | #define write_rst_clr(val, gate) \ |
42 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) | 42 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) |
43 | 43 | ||
44 | #define periph_clk_to_bit(periph) (1 << (gate->clk_num % 32)) | 44 | #define periph_clk_to_bit(gate) (1 << (gate->clk_num % 32)) |
45 | |||
46 | #define LVL2_CLK_GATE_OVRE 0x554 | ||
45 | 47 | ||
46 | /* Peripheral gate clock ops */ | 48 | /* Peripheral gate clock ops */ |
47 | static int clk_periph_is_enabled(struct clk_hw *hw) | 49 | static int clk_periph_is_enabled(struct clk_hw *hw) |
@@ -83,6 +85,13 @@ static int clk_periph_enable(struct clk_hw *hw) | |||
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
88 | if (gate->flags & TEGRA_PERIPH_WAR_1005168) { | ||
89 | writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
90 | writel_relaxed(BIT(22), gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
91 | udelay(1); | ||
92 | writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
93 | } | ||
94 | |||
86 | spin_unlock_irqrestore(&periph_ref_lock, flags); | 95 | spin_unlock_irqrestore(&periph_ref_lock, flags); |
87 | 96 | ||
88 | return 0; | 97 | return 0; |
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index 788486e6331a..b2309d37a963 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/clk-provider.h> | 18 | #include <linux/clk-provider.h> |
19 | #include <linux/export.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | 22 | ||
@@ -128,6 +129,7 @@ void tegra_periph_reset_deassert(struct clk *c) | |||
128 | 129 | ||
129 | tegra_periph_reset(gate, 0); | 130 | tegra_periph_reset(gate, 0); |
130 | } | 131 | } |
132 | EXPORT_SYMBOL(tegra_periph_reset_deassert); | ||
131 | 133 | ||
132 | void tegra_periph_reset_assert(struct clk *c) | 134 | void tegra_periph_reset_assert(struct clk *c) |
133 | { | 135 | { |
@@ -147,6 +149,7 @@ void tegra_periph_reset_assert(struct clk *c) | |||
147 | 149 | ||
148 | tegra_periph_reset(gate, 1); | 150 | tegra_periph_reset(gate, 1); |
149 | } | 151 | } |
152 | EXPORT_SYMBOL(tegra_periph_reset_assert); | ||
150 | 153 | ||
151 | const struct clk_ops tegra_clk_periph_ops = { | 154 | const struct clk_ops tegra_clk_periph_ops = { |
152 | .get_parent = clk_periph_get_parent, | 155 | .get_parent = clk_periph_get_parent, |
@@ -170,14 +173,15 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = { | |||
170 | static struct clk *_tegra_clk_register_periph(const char *name, | 173 | static struct clk *_tegra_clk_register_periph(const char *name, |
171 | const char **parent_names, int num_parents, | 174 | const char **parent_names, int num_parents, |
172 | struct tegra_clk_periph *periph, | 175 | struct tegra_clk_periph *periph, |
173 | void __iomem *clk_base, u32 offset, bool div) | 176 | void __iomem *clk_base, u32 offset, bool div, |
177 | unsigned long flags) | ||
174 | { | 178 | { |
175 | struct clk *clk; | 179 | struct clk *clk; |
176 | struct clk_init_data init; | 180 | struct clk_init_data init; |
177 | 181 | ||
178 | init.name = name; | 182 | init.name = name; |
179 | init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; | 183 | init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; |
180 | init.flags = div ? 0 : CLK_SET_RATE_PARENT; | 184 | init.flags = flags; |
181 | init.parent_names = parent_names; | 185 | init.parent_names = parent_names; |
182 | init.num_parents = num_parents; | 186 | init.num_parents = num_parents; |
183 | 187 | ||
@@ -202,10 +206,10 @@ static struct clk *_tegra_clk_register_periph(const char *name, | |||
202 | struct clk *tegra_clk_register_periph(const char *name, | 206 | struct clk *tegra_clk_register_periph(const char *name, |
203 | const char **parent_names, int num_parents, | 207 | const char **parent_names, int num_parents, |
204 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 208 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
205 | u32 offset) | 209 | u32 offset, unsigned long flags) |
206 | { | 210 | { |
207 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 211 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
208 | periph, clk_base, offset, true); | 212 | periph, clk_base, offset, true, flags); |
209 | } | 213 | } |
210 | 214 | ||
211 | struct clk *tegra_clk_register_periph_nodiv(const char *name, | 215 | struct clk *tegra_clk_register_periph_nodiv(const char *name, |
@@ -214,5 +218,5 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, | |||
214 | u32 offset) | 218 | u32 offset) |
215 | { | 219 | { |
216 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 220 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
217 | periph, clk_base, offset, false); | 221 | periph, clk_base, offset, false, CLK_SET_RATE_PARENT); |
218 | } | 222 | } |
diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index 165f24734c1b..17c2cc086eb4 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -79,6 +79,48 @@ | |||
79 | #define PLLE_SS_CTRL 0x68 | 79 | #define PLLE_SS_CTRL 0x68 |
80 | #define PLLE_SS_DISABLE (7 << 10) | 80 | #define PLLE_SS_DISABLE (7 << 10) |
81 | 81 | ||
82 | #define PLLE_AUX_PLLP_SEL BIT(2) | ||
83 | #define PLLE_AUX_ENABLE_SWCTL BIT(4) | ||
84 | #define PLLE_AUX_SEQ_ENABLE BIT(24) | ||
85 | #define PLLE_AUX_PLLRE_SEL BIT(28) | ||
86 | |||
87 | #define PLLE_MISC_PLLE_PTS BIT(8) | ||
88 | #define PLLE_MISC_IDDQ_SW_VALUE BIT(13) | ||
89 | #define PLLE_MISC_IDDQ_SW_CTRL BIT(14) | ||
90 | #define PLLE_MISC_VREG_BG_CTRL_SHIFT 4 | ||
91 | #define PLLE_MISC_VREG_BG_CTRL_MASK (3 << PLLE_MISC_VREG_BG_CTRL_SHIFT) | ||
92 | #define PLLE_MISC_VREG_CTRL_SHIFT 2 | ||
93 | #define PLLE_MISC_VREG_CTRL_MASK (2 << PLLE_MISC_VREG_CTRL_SHIFT) | ||
94 | |||
95 | #define PLLCX_MISC_STROBE BIT(31) | ||
96 | #define PLLCX_MISC_RESET BIT(30) | ||
97 | #define PLLCX_MISC_SDM_DIV_SHIFT 28 | ||
98 | #define PLLCX_MISC_SDM_DIV_MASK (0x3 << PLLCX_MISC_SDM_DIV_SHIFT) | ||
99 | #define PLLCX_MISC_FILT_DIV_SHIFT 26 | ||
100 | #define PLLCX_MISC_FILT_DIV_MASK (0x3 << PLLCX_MISC_FILT_DIV_SHIFT) | ||
101 | #define PLLCX_MISC_ALPHA_SHIFT 18 | ||
102 | #define PLLCX_MISC_DIV_LOW_RANGE \ | ||
103 | ((0x1 << PLLCX_MISC_SDM_DIV_SHIFT) | \ | ||
104 | (0x1 << PLLCX_MISC_FILT_DIV_SHIFT)) | ||
105 | #define PLLCX_MISC_DIV_HIGH_RANGE \ | ||
106 | ((0x2 << PLLCX_MISC_SDM_DIV_SHIFT) | \ | ||
107 | (0x2 << PLLCX_MISC_FILT_DIV_SHIFT)) | ||
108 | #define PLLCX_MISC_COEF_LOW_RANGE \ | ||
109 | ((0x14 << PLLCX_MISC_KA_SHIFT) | (0x38 << PLLCX_MISC_KB_SHIFT)) | ||
110 | #define PLLCX_MISC_KA_SHIFT 2 | ||
111 | #define PLLCX_MISC_KB_SHIFT 9 | ||
112 | #define PLLCX_MISC_DEFAULT (PLLCX_MISC_COEF_LOW_RANGE | \ | ||
113 | (0x19 << PLLCX_MISC_ALPHA_SHIFT) | \ | ||
114 | PLLCX_MISC_DIV_LOW_RANGE | \ | ||
115 | PLLCX_MISC_RESET) | ||
116 | #define PLLCX_MISC1_DEFAULT 0x000d2308 | ||
117 | #define PLLCX_MISC2_DEFAULT 0x30211200 | ||
118 | #define PLLCX_MISC3_DEFAULT 0x200 | ||
119 | |||
120 | #define PMC_PLLM_WB0_OVERRIDE 0x1dc | ||
121 | #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 | ||
122 | #define PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK BIT(27) | ||
123 | |||
82 | #define PMC_SATA_PWRGT 0x1ac | 124 | #define PMC_SATA_PWRGT 0x1ac |
83 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) | 125 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) |
84 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) | 126 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) |
@@ -101,6 +143,24 @@ | |||
101 | #define divn_max(p) (divn_mask(p)) | 143 | #define divn_max(p) (divn_mask(p)) |
102 | #define divp_max(p) (1 << (divp_mask(p))) | 144 | #define divp_max(p) (1 << (divp_mask(p))) |
103 | 145 | ||
146 | |||
147 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
148 | /* PLLXC has 4-bit PDIV, but entry 15 is not allowed in h/w */ | ||
149 | #define PLLXC_PDIV_MAX 14 | ||
150 | |||
151 | /* non-monotonic mapping below is not a typo */ | ||
152 | static u8 pllxc_p[PLLXC_PDIV_MAX + 1] = { | ||
153 | /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ | ||
154 | /* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32 | ||
155 | }; | ||
156 | |||
157 | #define PLLCX_PDIV_MAX 7 | ||
158 | static u8 pllcx_p[PLLCX_PDIV_MAX + 1] = { | ||
159 | /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7 */ | ||
160 | /* p: */ 1, 2, 3, 4, 6, 8, 12, 16 | ||
161 | }; | ||
162 | #endif | ||
163 | |||
104 | static void clk_pll_enable_lock(struct tegra_clk_pll *pll) | 164 | static void clk_pll_enable_lock(struct tegra_clk_pll *pll) |
105 | { | 165 | { |
106 | u32 val; | 166 | u32 val; |
@@ -108,25 +168,36 @@ static void clk_pll_enable_lock(struct tegra_clk_pll *pll) | |||
108 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) | 168 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) |
109 | return; | 169 | return; |
110 | 170 | ||
171 | if (!(pll->flags & TEGRA_PLL_HAS_LOCK_ENABLE)) | ||
172 | return; | ||
173 | |||
111 | val = pll_readl_misc(pll); | 174 | val = pll_readl_misc(pll); |
112 | val |= BIT(pll->params->lock_enable_bit_idx); | 175 | val |= BIT(pll->params->lock_enable_bit_idx); |
113 | pll_writel_misc(val, pll); | 176 | pll_writel_misc(val, pll); |
114 | } | 177 | } |
115 | 178 | ||
116 | static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll, | 179 | static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll) |
117 | void __iomem *lock_addr, u32 lock_bit_idx) | ||
118 | { | 180 | { |
119 | int i; | 181 | int i; |
120 | u32 val; | 182 | u32 val, lock_mask; |
183 | void __iomem *lock_addr; | ||
121 | 184 | ||
122 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { | 185 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { |
123 | udelay(pll->params->lock_delay); | 186 | udelay(pll->params->lock_delay); |
124 | return 0; | 187 | return 0; |
125 | } | 188 | } |
126 | 189 | ||
190 | lock_addr = pll->clk_base; | ||
191 | if (pll->flags & TEGRA_PLL_LOCK_MISC) | ||
192 | lock_addr += pll->params->misc_reg; | ||
193 | else | ||
194 | lock_addr += pll->params->base_reg; | ||
195 | |||
196 | lock_mask = pll->params->lock_mask; | ||
197 | |||
127 | for (i = 0; i < pll->params->lock_delay; i++) { | 198 | for (i = 0; i < pll->params->lock_delay; i++) { |
128 | val = readl_relaxed(lock_addr); | 199 | val = readl_relaxed(lock_addr); |
129 | if (val & BIT(lock_bit_idx)) { | 200 | if ((val & lock_mask) == lock_mask) { |
130 | udelay(PLL_POST_LOCK_DELAY); | 201 | udelay(PLL_POST_LOCK_DELAY); |
131 | return 0; | 202 | return 0; |
132 | } | 203 | } |
@@ -155,7 +226,7 @@ static int clk_pll_is_enabled(struct clk_hw *hw) | |||
155 | return val & PLL_BASE_ENABLE ? 1 : 0; | 226 | return val & PLL_BASE_ENABLE ? 1 : 0; |
156 | } | 227 | } |
157 | 228 | ||
158 | static int _clk_pll_enable(struct clk_hw *hw) | 229 | static void _clk_pll_enable(struct clk_hw *hw) |
159 | { | 230 | { |
160 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 231 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
161 | u32 val; | 232 | u32 val; |
@@ -163,7 +234,8 @@ static int _clk_pll_enable(struct clk_hw *hw) | |||
163 | clk_pll_enable_lock(pll); | 234 | clk_pll_enable_lock(pll); |
164 | 235 | ||
165 | val = pll_readl_base(pll); | 236 | val = pll_readl_base(pll); |
166 | val &= ~PLL_BASE_BYPASS; | 237 | if (pll->flags & TEGRA_PLL_BYPASS) |
238 | val &= ~PLL_BASE_BYPASS; | ||
167 | val |= PLL_BASE_ENABLE; | 239 | val |= PLL_BASE_ENABLE; |
168 | pll_writel_base(val, pll); | 240 | pll_writel_base(val, pll); |
169 | 241 | ||
@@ -172,11 +244,6 @@ static int _clk_pll_enable(struct clk_hw *hw) | |||
172 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; | 244 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; |
173 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 245 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
174 | } | 246 | } |
175 | |||
176 | clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->base_reg, | ||
177 | pll->params->lock_bit_idx); | ||
178 | |||
179 | return 0; | ||
180 | } | 247 | } |
181 | 248 | ||
182 | static void _clk_pll_disable(struct clk_hw *hw) | 249 | static void _clk_pll_disable(struct clk_hw *hw) |
@@ -185,7 +252,9 @@ static void _clk_pll_disable(struct clk_hw *hw) | |||
185 | u32 val; | 252 | u32 val; |
186 | 253 | ||
187 | val = pll_readl_base(pll); | 254 | val = pll_readl_base(pll); |
188 | val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); | 255 | if (pll->flags & TEGRA_PLL_BYPASS) |
256 | val &= ~PLL_BASE_BYPASS; | ||
257 | val &= ~PLL_BASE_ENABLE; | ||
189 | pll_writel_base(val, pll); | 258 | pll_writel_base(val, pll); |
190 | 259 | ||
191 | if (pll->flags & TEGRA_PLLM) { | 260 | if (pll->flags & TEGRA_PLLM) { |
@@ -204,7 +273,9 @@ static int clk_pll_enable(struct clk_hw *hw) | |||
204 | if (pll->lock) | 273 | if (pll->lock) |
205 | spin_lock_irqsave(pll->lock, flags); | 274 | spin_lock_irqsave(pll->lock, flags); |
206 | 275 | ||
207 | ret = _clk_pll_enable(hw); | 276 | _clk_pll_enable(hw); |
277 | |||
278 | ret = clk_pll_wait_for_lock(pll); | ||
208 | 279 | ||
209 | if (pll->lock) | 280 | if (pll->lock) |
210 | spin_unlock_irqrestore(pll->lock, flags); | 281 | spin_unlock_irqrestore(pll->lock, flags); |
@@ -241,8 +312,6 @@ static int _get_table_rate(struct clk_hw *hw, | |||
241 | if (sel->input_rate == 0) | 312 | if (sel->input_rate == 0) |
242 | return -EINVAL; | 313 | return -EINVAL; |
243 | 314 | ||
244 | BUG_ON(sel->p < 1); | ||
245 | |||
246 | cfg->input_rate = sel->input_rate; | 315 | cfg->input_rate = sel->input_rate; |
247 | cfg->output_rate = sel->output_rate; | 316 | cfg->output_rate = sel->output_rate; |
248 | cfg->m = sel->m; | 317 | cfg->m = sel->m; |
@@ -257,6 +326,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
257 | unsigned long rate, unsigned long parent_rate) | 326 | unsigned long rate, unsigned long parent_rate) |
258 | { | 327 | { |
259 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 328 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
329 | struct pdiv_map *p_tohw = pll->params->pdiv_tohw; | ||
260 | unsigned long cfreq; | 330 | unsigned long cfreq; |
261 | u32 p_div = 0; | 331 | u32 p_div = 0; |
262 | 332 | ||
@@ -290,88 +360,119 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
290 | cfg->output_rate <<= 1) | 360 | cfg->output_rate <<= 1) |
291 | p_div++; | 361 | p_div++; |
292 | 362 | ||
293 | cfg->p = 1 << p_div; | ||
294 | cfg->m = parent_rate / cfreq; | 363 | cfg->m = parent_rate / cfreq; |
295 | cfg->n = cfg->output_rate / cfreq; | 364 | cfg->n = cfg->output_rate / cfreq; |
296 | cfg->cpcon = OUT_OF_TABLE_CPCON; | 365 | cfg->cpcon = OUT_OF_TABLE_CPCON; |
297 | 366 | ||
298 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || | 367 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || |
299 | cfg->p > divp_max(pll) || cfg->output_rate > pll->params->vco_max) { | 368 | (1 << p_div) > divp_max(pll) |
369 | || cfg->output_rate > pll->params->vco_max) { | ||
300 | pr_err("%s: Failed to set %s rate %lu\n", | 370 | pr_err("%s: Failed to set %s rate %lu\n", |
301 | __func__, __clk_get_name(hw->clk), rate); | 371 | __func__, __clk_get_name(hw->clk), rate); |
302 | return -EINVAL; | 372 | return -EINVAL; |
303 | } | 373 | } |
304 | 374 | ||
375 | if (p_tohw) { | ||
376 | p_div = 1 << p_div; | ||
377 | while (p_tohw->pdiv) { | ||
378 | if (p_div <= p_tohw->pdiv) { | ||
379 | cfg->p = p_tohw->hw_val; | ||
380 | break; | ||
381 | } | ||
382 | p_tohw++; | ||
383 | } | ||
384 | if (!p_tohw->pdiv) | ||
385 | return -EINVAL; | ||
386 | } else | ||
387 | cfg->p = p_div; | ||
388 | |||
305 | return 0; | 389 | return 0; |
306 | } | 390 | } |
307 | 391 | ||
308 | static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | 392 | static void _update_pll_mnp(struct tegra_clk_pll *pll, |
309 | unsigned long rate) | 393 | struct tegra_clk_pll_freq_table *cfg) |
310 | { | 394 | { |
311 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 395 | u32 val; |
312 | unsigned long flags = 0; | ||
313 | u32 divp, val, old_base; | ||
314 | int state; | ||
315 | |||
316 | divp = __ffs(cfg->p); | ||
317 | |||
318 | if (pll->flags & TEGRA_PLLU) | ||
319 | divp ^= 1; | ||
320 | 396 | ||
321 | if (pll->lock) | 397 | val = pll_readl_base(pll); |
322 | spin_lock_irqsave(pll->lock, flags); | ||
323 | 398 | ||
324 | old_base = val = pll_readl_base(pll); | ||
325 | val &= ~((divm_mask(pll) << pll->divm_shift) | | 399 | val &= ~((divm_mask(pll) << pll->divm_shift) | |
326 | (divn_mask(pll) << pll->divn_shift) | | 400 | (divn_mask(pll) << pll->divn_shift) | |
327 | (divp_mask(pll) << pll->divp_shift)); | 401 | (divp_mask(pll) << pll->divp_shift)); |
328 | val |= ((cfg->m << pll->divm_shift) | | 402 | val |= ((cfg->m << pll->divm_shift) | |
329 | (cfg->n << pll->divn_shift) | | 403 | (cfg->n << pll->divn_shift) | |
330 | (divp << pll->divp_shift)); | 404 | (cfg->p << pll->divp_shift)); |
331 | if (val == old_base) { | 405 | |
332 | if (pll->lock) | 406 | pll_writel_base(val, pll); |
333 | spin_unlock_irqrestore(pll->lock, flags); | 407 | } |
334 | return 0; | 408 | |
409 | static void _get_pll_mnp(struct tegra_clk_pll *pll, | ||
410 | struct tegra_clk_pll_freq_table *cfg) | ||
411 | { | ||
412 | u32 val; | ||
413 | |||
414 | val = pll_readl_base(pll); | ||
415 | |||
416 | cfg->m = (val >> pll->divm_shift) & (divm_mask(pll)); | ||
417 | cfg->n = (val >> pll->divn_shift) & (divn_mask(pll)); | ||
418 | cfg->p = (val >> pll->divp_shift) & (divp_mask(pll)); | ||
419 | } | ||
420 | |||
421 | static void _update_pll_cpcon(struct tegra_clk_pll *pll, | ||
422 | struct tegra_clk_pll_freq_table *cfg, | ||
423 | unsigned long rate) | ||
424 | { | ||
425 | u32 val; | ||
426 | |||
427 | val = pll_readl_misc(pll); | ||
428 | |||
429 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); | ||
430 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; | ||
431 | |||
432 | if (pll->flags & TEGRA_PLL_SET_LFCON) { | ||
433 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); | ||
434 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) | ||
435 | val |= 1 << PLL_MISC_LFCON_SHIFT; | ||
436 | } else if (pll->flags & TEGRA_PLL_SET_DCCON) { | ||
437 | val &= ~(1 << PLL_MISC_DCCON_SHIFT); | ||
438 | if (rate >= (pll->params->vco_max >> 1)) | ||
439 | val |= 1 << PLL_MISC_DCCON_SHIFT; | ||
335 | } | 440 | } |
336 | 441 | ||
442 | pll_writel_misc(val, pll); | ||
443 | } | ||
444 | |||
445 | static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | ||
446 | unsigned long rate) | ||
447 | { | ||
448 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
449 | int state, ret = 0; | ||
450 | |||
337 | state = clk_pll_is_enabled(hw); | 451 | state = clk_pll_is_enabled(hw); |
338 | 452 | ||
339 | if (state) { | 453 | if (state) |
340 | _clk_pll_disable(hw); | 454 | _clk_pll_disable(hw); |
341 | val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); | ||
342 | } | ||
343 | pll_writel_base(val, pll); | ||
344 | 455 | ||
345 | if (pll->flags & TEGRA_PLL_HAS_CPCON) { | 456 | _update_pll_mnp(pll, cfg); |
346 | val = pll_readl_misc(pll); | ||
347 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); | ||
348 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; | ||
349 | if (pll->flags & TEGRA_PLL_SET_LFCON) { | ||
350 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); | ||
351 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) | ||
352 | val |= 0x1 << PLL_MISC_LFCON_SHIFT; | ||
353 | } else if (pll->flags & TEGRA_PLL_SET_DCCON) { | ||
354 | val &= ~(0x1 << PLL_MISC_DCCON_SHIFT); | ||
355 | if (rate >= (pll->params->vco_max >> 1)) | ||
356 | val |= 0x1 << PLL_MISC_DCCON_SHIFT; | ||
357 | } | ||
358 | pll_writel_misc(val, pll); | ||
359 | } | ||
360 | 457 | ||
361 | if (pll->lock) | 458 | if (pll->flags & TEGRA_PLL_HAS_CPCON) |
362 | spin_unlock_irqrestore(pll->lock, flags); | 459 | _update_pll_cpcon(pll, cfg, rate); |
363 | 460 | ||
364 | if (state) | 461 | if (state) { |
365 | clk_pll_enable(hw); | 462 | _clk_pll_enable(hw); |
463 | ret = clk_pll_wait_for_lock(pll); | ||
464 | } | ||
366 | 465 | ||
367 | return 0; | 466 | return ret; |
368 | } | 467 | } |
369 | 468 | ||
370 | static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | 469 | static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
371 | unsigned long parent_rate) | 470 | unsigned long parent_rate) |
372 | { | 471 | { |
373 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 472 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
374 | struct tegra_clk_pll_freq_table cfg; | 473 | struct tegra_clk_pll_freq_table cfg, old_cfg; |
474 | unsigned long flags = 0; | ||
475 | int ret = 0; | ||
375 | 476 | ||
376 | if (pll->flags & TEGRA_PLL_FIXED) { | 477 | if (pll->flags & TEGRA_PLL_FIXED) { |
377 | if (rate != pll->fixed_rate) { | 478 | if (rate != pll->fixed_rate) { |
@@ -387,7 +488,18 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
387 | _calc_rate(hw, &cfg, rate, parent_rate)) | 488 | _calc_rate(hw, &cfg, rate, parent_rate)) |
388 | return -EINVAL; | 489 | return -EINVAL; |
389 | 490 | ||
390 | return _program_pll(hw, &cfg, rate); | 491 | if (pll->lock) |
492 | spin_lock_irqsave(pll->lock, flags); | ||
493 | |||
494 | _get_pll_mnp(pll, &old_cfg); | ||
495 | |||
496 | if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p) | ||
497 | ret = _program_pll(hw, &cfg, rate); | ||
498 | |||
499 | if (pll->lock) | ||
500 | spin_unlock_irqrestore(pll->lock, flags); | ||
501 | |||
502 | return ret; | ||
391 | } | 503 | } |
392 | 504 | ||
393 | static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | 505 | static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
@@ -409,7 +521,7 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | |||
409 | return -EINVAL; | 521 | return -EINVAL; |
410 | 522 | ||
411 | output_rate *= cfg.n; | 523 | output_rate *= cfg.n; |
412 | do_div(output_rate, cfg.m * cfg.p); | 524 | do_div(output_rate, cfg.m * (1 << cfg.p)); |
413 | 525 | ||
414 | return output_rate; | 526 | return output_rate; |
415 | } | 527 | } |
@@ -418,11 +530,15 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | |||
418 | unsigned long parent_rate) | 530 | unsigned long parent_rate) |
419 | { | 531 | { |
420 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 532 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
421 | u32 val = pll_readl_base(pll); | 533 | struct tegra_clk_pll_freq_table cfg; |
422 | u32 divn = 0, divm = 0, divp = 0; | 534 | struct pdiv_map *p_tohw = pll->params->pdiv_tohw; |
535 | u32 val; | ||
423 | u64 rate = parent_rate; | 536 | u64 rate = parent_rate; |
537 | int pdiv; | ||
538 | |||
539 | val = pll_readl_base(pll); | ||
424 | 540 | ||
425 | if (val & PLL_BASE_BYPASS) | 541 | if ((pll->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS)) |
426 | return parent_rate; | 542 | return parent_rate; |
427 | 543 | ||
428 | if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { | 544 | if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { |
@@ -435,16 +551,29 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | |||
435 | return pll->fixed_rate; | 551 | return pll->fixed_rate; |
436 | } | 552 | } |
437 | 553 | ||
438 | divp = (val >> pll->divp_shift) & (divp_mask(pll)); | 554 | _get_pll_mnp(pll, &cfg); |
439 | if (pll->flags & TEGRA_PLLU) | ||
440 | divp ^= 1; | ||
441 | 555 | ||
442 | divn = (val >> pll->divn_shift) & (divn_mask(pll)); | 556 | if (p_tohw) { |
443 | divm = (val >> pll->divm_shift) & (divm_mask(pll)); | 557 | while (p_tohw->pdiv) { |
444 | divm *= (1 << divp); | 558 | if (cfg.p == p_tohw->hw_val) { |
559 | pdiv = p_tohw->pdiv; | ||
560 | break; | ||
561 | } | ||
562 | p_tohw++; | ||
563 | } | ||
564 | |||
565 | if (!p_tohw->pdiv) { | ||
566 | WARN_ON(1); | ||
567 | pdiv = 1; | ||
568 | } | ||
569 | } else | ||
570 | pdiv = 1 << cfg.p; | ||
571 | |||
572 | cfg.m *= pdiv; | ||
573 | |||
574 | rate *= cfg.n; | ||
575 | do_div(rate, cfg.m); | ||
445 | 576 | ||
446 | rate *= divn; | ||
447 | do_div(rate, divm); | ||
448 | return rate; | 577 | return rate; |
449 | } | 578 | } |
450 | 579 | ||
@@ -538,8 +667,8 @@ static int clk_plle_enable(struct clk_hw *hw) | |||
538 | val |= (PLL_BASE_BYPASS | PLL_BASE_ENABLE); | 667 | val |= (PLL_BASE_BYPASS | PLL_BASE_ENABLE); |
539 | pll_writel_base(val, pll); | 668 | pll_writel_base(val, pll); |
540 | 669 | ||
541 | clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->misc_reg, | 670 | clk_pll_wait_for_lock(pll); |
542 | pll->params->lock_bit_idx); | 671 | |
543 | return 0; | 672 | return 0; |
544 | } | 673 | } |
545 | 674 | ||
@@ -577,28 +706,531 @@ const struct clk_ops tegra_clk_plle_ops = { | |||
577 | .enable = clk_plle_enable, | 706 | .enable = clk_plle_enable, |
578 | }; | 707 | }; |
579 | 708 | ||
580 | static struct clk *_tegra_clk_register_pll(const char *name, | 709 | #ifdef CONFIG_ARCH_TEGRA_114_SOC |
581 | const char *parent_name, void __iomem *clk_base, | 710 | |
582 | void __iomem *pmc, unsigned long flags, | 711 | static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, |
583 | unsigned long fixed_rate, | 712 | unsigned long parent_rate) |
584 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 713 | { |
585 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock, | 714 | if (parent_rate > pll_params->cf_max) |
586 | const struct clk_ops *ops) | 715 | return 2; |
716 | else | ||
717 | return 1; | ||
718 | } | ||
719 | |||
720 | static int clk_pll_iddq_enable(struct clk_hw *hw) | ||
721 | { | ||
722 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
723 | unsigned long flags = 0; | ||
724 | |||
725 | u32 val; | ||
726 | int ret; | ||
727 | |||
728 | if (pll->lock) | ||
729 | spin_lock_irqsave(pll->lock, flags); | ||
730 | |||
731 | val = pll_readl(pll->params->iddq_reg, pll); | ||
732 | val &= ~BIT(pll->params->iddq_bit_idx); | ||
733 | pll_writel(val, pll->params->iddq_reg, pll); | ||
734 | udelay(2); | ||
735 | |||
736 | _clk_pll_enable(hw); | ||
737 | |||
738 | ret = clk_pll_wait_for_lock(pll); | ||
739 | |||
740 | if (pll->lock) | ||
741 | spin_unlock_irqrestore(pll->lock, flags); | ||
742 | |||
743 | return 0; | ||
744 | } | ||
745 | |||
746 | static void clk_pll_iddq_disable(struct clk_hw *hw) | ||
747 | { | ||
748 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
749 | unsigned long flags = 0; | ||
750 | u32 val; | ||
751 | |||
752 | if (pll->lock) | ||
753 | spin_lock_irqsave(pll->lock, flags); | ||
754 | |||
755 | _clk_pll_disable(hw); | ||
756 | |||
757 | val = pll_readl(pll->params->iddq_reg, pll); | ||
758 | val |= BIT(pll->params->iddq_bit_idx); | ||
759 | pll_writel(val, pll->params->iddq_reg, pll); | ||
760 | udelay(2); | ||
761 | |||
762 | if (pll->lock) | ||
763 | spin_unlock_irqrestore(pll->lock, flags); | ||
764 | } | ||
765 | |||
766 | static int _calc_dynamic_ramp_rate(struct clk_hw *hw, | ||
767 | struct tegra_clk_pll_freq_table *cfg, | ||
768 | unsigned long rate, unsigned long parent_rate) | ||
769 | { | ||
770 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
771 | unsigned int p; | ||
772 | |||
773 | if (!rate) | ||
774 | return -EINVAL; | ||
775 | |||
776 | p = DIV_ROUND_UP(pll->params->vco_min, rate); | ||
777 | cfg->m = _pll_fixed_mdiv(pll->params, parent_rate); | ||
778 | cfg->p = p; | ||
779 | cfg->output_rate = rate * cfg->p; | ||
780 | cfg->n = cfg->output_rate * cfg->m / parent_rate; | ||
781 | |||
782 | if (cfg->n > divn_max(pll) || cfg->output_rate > pll->params->vco_max) | ||
783 | return -EINVAL; | ||
784 | |||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static int _pll_ramp_calc_pll(struct clk_hw *hw, | ||
789 | struct tegra_clk_pll_freq_table *cfg, | ||
790 | unsigned long rate, unsigned long parent_rate) | ||
791 | { | ||
792 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
793 | int err = 0; | ||
794 | |||
795 | err = _get_table_rate(hw, cfg, rate, parent_rate); | ||
796 | if (err < 0) | ||
797 | err = _calc_dynamic_ramp_rate(hw, cfg, rate, parent_rate); | ||
798 | else if (cfg->m != _pll_fixed_mdiv(pll->params, parent_rate)) { | ||
799 | WARN_ON(1); | ||
800 | err = -EINVAL; | ||
801 | goto out; | ||
802 | } | ||
803 | |||
804 | if (!cfg->p || (cfg->p > pll->params->max_p)) | ||
805 | err = -EINVAL; | ||
806 | |||
807 | out: | ||
808 | return err; | ||
809 | } | ||
810 | |||
811 | static int clk_pllxc_set_rate(struct clk_hw *hw, unsigned long rate, | ||
812 | unsigned long parent_rate) | ||
813 | { | ||
814 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
815 | struct tegra_clk_pll_freq_table cfg, old_cfg; | ||
816 | unsigned long flags = 0; | ||
817 | int ret = 0; | ||
818 | u8 old_p; | ||
819 | |||
820 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
821 | if (ret < 0) | ||
822 | return ret; | ||
823 | |||
824 | if (pll->lock) | ||
825 | spin_lock_irqsave(pll->lock, flags); | ||
826 | |||
827 | _get_pll_mnp(pll, &old_cfg); | ||
828 | |||
829 | old_p = pllxc_p[old_cfg.p]; | ||
830 | if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_p != cfg.p) { | ||
831 | cfg.p -= 1; | ||
832 | ret = _program_pll(hw, &cfg, rate); | ||
833 | } | ||
834 | |||
835 | if (pll->lock) | ||
836 | spin_unlock_irqrestore(pll->lock, flags); | ||
837 | |||
838 | return ret; | ||
839 | } | ||
840 | |||
841 | static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate, | ||
842 | unsigned long *prate) | ||
843 | { | ||
844 | struct tegra_clk_pll_freq_table cfg; | ||
845 | int ret = 0; | ||
846 | u64 output_rate = *prate; | ||
847 | |||
848 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, *prate); | ||
849 | if (ret < 0) | ||
850 | return ret; | ||
851 | |||
852 | output_rate *= cfg.n; | ||
853 | do_div(output_rate, cfg.m * cfg.p); | ||
854 | |||
855 | return output_rate; | ||
856 | } | ||
857 | |||
858 | static int clk_pllm_set_rate(struct clk_hw *hw, unsigned long rate, | ||
859 | unsigned long parent_rate) | ||
860 | { | ||
861 | struct tegra_clk_pll_freq_table cfg; | ||
862 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
863 | unsigned long flags = 0; | ||
864 | int state, ret = 0; | ||
865 | u32 val; | ||
866 | |||
867 | if (pll->lock) | ||
868 | spin_lock_irqsave(pll->lock, flags); | ||
869 | |||
870 | state = clk_pll_is_enabled(hw); | ||
871 | if (state) { | ||
872 | if (rate != clk_get_rate(hw->clk)) { | ||
873 | pr_err("%s: Cannot change active PLLM\n", __func__); | ||
874 | ret = -EINVAL; | ||
875 | goto out; | ||
876 | } | ||
877 | goto out; | ||
878 | } | ||
879 | |||
880 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
881 | if (ret < 0) | ||
882 | goto out; | ||
883 | |||
884 | cfg.p -= 1; | ||
885 | |||
886 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
887 | if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE) { | ||
888 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); | ||
889 | val = cfg.p ? (val | PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK) : | ||
890 | (val & ~PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK); | ||
891 | writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); | ||
892 | |||
893 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
894 | val &= ~(divn_mask(pll) | divm_mask(pll)); | ||
895 | val |= (cfg.m << pll->divm_shift) | (cfg.n << pll->divn_shift); | ||
896 | writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
897 | } else | ||
898 | _update_pll_mnp(pll, &cfg); | ||
899 | |||
900 | |||
901 | out: | ||
902 | if (pll->lock) | ||
903 | spin_unlock_irqrestore(pll->lock, flags); | ||
904 | |||
905 | return ret; | ||
906 | } | ||
907 | |||
908 | static void _pllcx_strobe(struct tegra_clk_pll *pll) | ||
909 | { | ||
910 | u32 val; | ||
911 | |||
912 | val = pll_readl_misc(pll); | ||
913 | val |= PLLCX_MISC_STROBE; | ||
914 | pll_writel_misc(val, pll); | ||
915 | udelay(2); | ||
916 | |||
917 | val &= ~PLLCX_MISC_STROBE; | ||
918 | pll_writel_misc(val, pll); | ||
919 | } | ||
920 | |||
921 | static int clk_pllc_enable(struct clk_hw *hw) | ||
922 | { | ||
923 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
924 | u32 val; | ||
925 | int ret = 0; | ||
926 | unsigned long flags = 0; | ||
927 | |||
928 | if (pll->lock) | ||
929 | spin_lock_irqsave(pll->lock, flags); | ||
930 | |||
931 | _clk_pll_enable(hw); | ||
932 | udelay(2); | ||
933 | |||
934 | val = pll_readl_misc(pll); | ||
935 | val &= ~PLLCX_MISC_RESET; | ||
936 | pll_writel_misc(val, pll); | ||
937 | udelay(2); | ||
938 | |||
939 | _pllcx_strobe(pll); | ||
940 | |||
941 | ret = clk_pll_wait_for_lock(pll); | ||
942 | |||
943 | if (pll->lock) | ||
944 | spin_unlock_irqrestore(pll->lock, flags); | ||
945 | |||
946 | return ret; | ||
947 | } | ||
948 | |||
949 | static void _clk_pllc_disable(struct clk_hw *hw) | ||
950 | { | ||
951 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
952 | u32 val; | ||
953 | |||
954 | _clk_pll_disable(hw); | ||
955 | |||
956 | val = pll_readl_misc(pll); | ||
957 | val |= PLLCX_MISC_RESET; | ||
958 | pll_writel_misc(val, pll); | ||
959 | udelay(2); | ||
960 | } | ||
961 | |||
962 | static void clk_pllc_disable(struct clk_hw *hw) | ||
963 | { | ||
964 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
965 | unsigned long flags = 0; | ||
966 | |||
967 | if (pll->lock) | ||
968 | spin_lock_irqsave(pll->lock, flags); | ||
969 | |||
970 | _clk_pllc_disable(hw); | ||
971 | |||
972 | if (pll->lock) | ||
973 | spin_unlock_irqrestore(pll->lock, flags); | ||
974 | } | ||
975 | |||
976 | static int _pllcx_update_dynamic_coef(struct tegra_clk_pll *pll, | ||
977 | unsigned long input_rate, u32 n) | ||
978 | { | ||
979 | u32 val, n_threshold; | ||
980 | |||
981 | switch (input_rate) { | ||
982 | case 12000000: | ||
983 | n_threshold = 70; | ||
984 | break; | ||
985 | case 13000000: | ||
986 | case 26000000: | ||
987 | n_threshold = 71; | ||
988 | break; | ||
989 | case 16800000: | ||
990 | n_threshold = 55; | ||
991 | break; | ||
992 | case 19200000: | ||
993 | n_threshold = 48; | ||
994 | break; | ||
995 | default: | ||
996 | pr_err("%s: Unexpected reference rate %lu\n", | ||
997 | __func__, input_rate); | ||
998 | return -EINVAL; | ||
999 | } | ||
1000 | |||
1001 | val = pll_readl_misc(pll); | ||
1002 | val &= ~(PLLCX_MISC_SDM_DIV_MASK | PLLCX_MISC_FILT_DIV_MASK); | ||
1003 | val |= n <= n_threshold ? | ||
1004 | PLLCX_MISC_DIV_LOW_RANGE : PLLCX_MISC_DIV_HIGH_RANGE; | ||
1005 | pll_writel_misc(val, pll); | ||
1006 | |||
1007 | return 0; | ||
1008 | } | ||
1009 | |||
1010 | static int clk_pllc_set_rate(struct clk_hw *hw, unsigned long rate, | ||
1011 | unsigned long parent_rate) | ||
1012 | { | ||
1013 | struct tegra_clk_pll_freq_table cfg; | ||
1014 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1015 | unsigned long flags = 0; | ||
1016 | int state, ret = 0; | ||
1017 | u32 val; | ||
1018 | u16 old_m, old_n; | ||
1019 | u8 old_p; | ||
1020 | |||
1021 | if (pll->lock) | ||
1022 | spin_lock_irqsave(pll->lock, flags); | ||
1023 | |||
1024 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
1025 | if (ret < 0) | ||
1026 | goto out; | ||
1027 | |||
1028 | val = pll_readl_base(pll); | ||
1029 | old_m = (val >> pll->divm_shift) & (divm_mask(pll)); | ||
1030 | old_n = (val >> pll->divn_shift) & (divn_mask(pll)); | ||
1031 | old_p = pllcx_p[(val >> pll->divp_shift) & (divp_mask(pll))]; | ||
1032 | |||
1033 | if (cfg.m != old_m) { | ||
1034 | WARN_ON(1); | ||
1035 | goto out; | ||
1036 | } | ||
1037 | |||
1038 | if (old_n == cfg.n && old_p == cfg.p) | ||
1039 | goto out; | ||
1040 | |||
1041 | cfg.p -= 1; | ||
1042 | |||
1043 | state = clk_pll_is_enabled(hw); | ||
1044 | if (state) | ||
1045 | _clk_pllc_disable(hw); | ||
1046 | |||
1047 | ret = _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); | ||
1048 | if (ret < 0) | ||
1049 | goto out; | ||
1050 | |||
1051 | _update_pll_mnp(pll, &cfg); | ||
1052 | |||
1053 | if (state) | ||
1054 | ret = clk_pllc_enable(hw); | ||
1055 | |||
1056 | out: | ||
1057 | if (pll->lock) | ||
1058 | spin_unlock_irqrestore(pll->lock, flags); | ||
1059 | |||
1060 | return ret; | ||
1061 | } | ||
1062 | |||
1063 | static long _pllre_calc_rate(struct tegra_clk_pll *pll, | ||
1064 | struct tegra_clk_pll_freq_table *cfg, | ||
1065 | unsigned long rate, unsigned long parent_rate) | ||
1066 | { | ||
1067 | u16 m, n; | ||
1068 | u64 output_rate = parent_rate; | ||
1069 | |||
1070 | m = _pll_fixed_mdiv(pll->params, parent_rate); | ||
1071 | n = rate * m / parent_rate; | ||
1072 | |||
1073 | output_rate *= n; | ||
1074 | do_div(output_rate, m); | ||
1075 | |||
1076 | if (cfg) { | ||
1077 | cfg->m = m; | ||
1078 | cfg->n = n; | ||
1079 | } | ||
1080 | |||
1081 | return output_rate; | ||
1082 | } | ||
1083 | static int clk_pllre_set_rate(struct clk_hw *hw, unsigned long rate, | ||
1084 | unsigned long parent_rate) | ||
1085 | { | ||
1086 | struct tegra_clk_pll_freq_table cfg, old_cfg; | ||
1087 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1088 | unsigned long flags = 0; | ||
1089 | int state, ret = 0; | ||
1090 | |||
1091 | if (pll->lock) | ||
1092 | spin_lock_irqsave(pll->lock, flags); | ||
1093 | |||
1094 | _pllre_calc_rate(pll, &cfg, rate, parent_rate); | ||
1095 | _get_pll_mnp(pll, &old_cfg); | ||
1096 | cfg.p = old_cfg.p; | ||
1097 | |||
1098 | if (cfg.m != old_cfg.m || cfg.n != old_cfg.n) { | ||
1099 | state = clk_pll_is_enabled(hw); | ||
1100 | if (state) | ||
1101 | _clk_pll_disable(hw); | ||
1102 | |||
1103 | _update_pll_mnp(pll, &cfg); | ||
1104 | |||
1105 | if (state) { | ||
1106 | _clk_pll_enable(hw); | ||
1107 | ret = clk_pll_wait_for_lock(pll); | ||
1108 | } | ||
1109 | } | ||
1110 | |||
1111 | if (pll->lock) | ||
1112 | spin_unlock_irqrestore(pll->lock, flags); | ||
1113 | |||
1114 | return ret; | ||
1115 | } | ||
1116 | |||
1117 | static unsigned long clk_pllre_recalc_rate(struct clk_hw *hw, | ||
1118 | unsigned long parent_rate) | ||
1119 | { | ||
1120 | struct tegra_clk_pll_freq_table cfg; | ||
1121 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1122 | u64 rate = parent_rate; | ||
1123 | |||
1124 | _get_pll_mnp(pll, &cfg); | ||
1125 | |||
1126 | rate *= cfg.n; | ||
1127 | do_div(rate, cfg.m); | ||
1128 | |||
1129 | return rate; | ||
1130 | } | ||
1131 | |||
1132 | static long clk_pllre_round_rate(struct clk_hw *hw, unsigned long rate, | ||
1133 | unsigned long *prate) | ||
1134 | { | ||
1135 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1136 | |||
1137 | return _pllre_calc_rate(pll, NULL, rate, *prate); | ||
1138 | } | ||
1139 | |||
1140 | static int clk_plle_tegra114_enable(struct clk_hw *hw) | ||
1141 | { | ||
1142 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1143 | struct tegra_clk_pll_freq_table sel; | ||
1144 | u32 val; | ||
1145 | int ret; | ||
1146 | unsigned long flags = 0; | ||
1147 | unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk)); | ||
1148 | |||
1149 | if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate)) | ||
1150 | return -EINVAL; | ||
1151 | |||
1152 | if (pll->lock) | ||
1153 | spin_lock_irqsave(pll->lock, flags); | ||
1154 | |||
1155 | val = pll_readl_base(pll); | ||
1156 | val &= ~BIT(29); /* Disable lock override */ | ||
1157 | pll_writel_base(val, pll); | ||
1158 | |||
1159 | val = pll_readl(pll->params->aux_reg, pll); | ||
1160 | val |= PLLE_AUX_ENABLE_SWCTL; | ||
1161 | val &= ~PLLE_AUX_SEQ_ENABLE; | ||
1162 | pll_writel(val, pll->params->aux_reg, pll); | ||
1163 | udelay(1); | ||
1164 | |||
1165 | val = pll_readl_misc(pll); | ||
1166 | val |= PLLE_MISC_LOCK_ENABLE; | ||
1167 | val |= PLLE_MISC_IDDQ_SW_CTRL; | ||
1168 | val &= ~PLLE_MISC_IDDQ_SW_VALUE; | ||
1169 | val |= PLLE_MISC_PLLE_PTS; | ||
1170 | val |= PLLE_MISC_VREG_BG_CTRL_MASK | PLLE_MISC_VREG_CTRL_MASK; | ||
1171 | pll_writel_misc(val, pll); | ||
1172 | udelay(5); | ||
1173 | |||
1174 | val = pll_readl(PLLE_SS_CTRL, pll); | ||
1175 | val |= PLLE_SS_DISABLE; | ||
1176 | pll_writel(val, PLLE_SS_CTRL, pll); | ||
1177 | |||
1178 | val = pll_readl_base(pll); | ||
1179 | val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll)); | ||
1180 | val &= ~(PLLE_BASE_DIVCML_WIDTH << PLLE_BASE_DIVCML_SHIFT); | ||
1181 | val |= sel.m << pll->divm_shift; | ||
1182 | val |= sel.n << pll->divn_shift; | ||
1183 | val |= sel.cpcon << PLLE_BASE_DIVCML_SHIFT; | ||
1184 | pll_writel_base(val, pll); | ||
1185 | udelay(1); | ||
1186 | |||
1187 | _clk_pll_enable(hw); | ||
1188 | ret = clk_pll_wait_for_lock(pll); | ||
1189 | |||
1190 | if (ret < 0) | ||
1191 | goto out; | ||
1192 | |||
1193 | /* TODO: enable hw control of xusb brick pll */ | ||
1194 | |||
1195 | out: | ||
1196 | if (pll->lock) | ||
1197 | spin_unlock_irqrestore(pll->lock, flags); | ||
1198 | |||
1199 | return ret; | ||
1200 | } | ||
1201 | |||
1202 | static void clk_plle_tegra114_disable(struct clk_hw *hw) | ||
1203 | { | ||
1204 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1205 | unsigned long flags = 0; | ||
1206 | u32 val; | ||
1207 | |||
1208 | if (pll->lock) | ||
1209 | spin_lock_irqsave(pll->lock, flags); | ||
1210 | |||
1211 | _clk_pll_disable(hw); | ||
1212 | |||
1213 | val = pll_readl_misc(pll); | ||
1214 | val |= PLLE_MISC_IDDQ_SW_CTRL | PLLE_MISC_IDDQ_SW_VALUE; | ||
1215 | pll_writel_misc(val, pll); | ||
1216 | udelay(1); | ||
1217 | |||
1218 | if (pll->lock) | ||
1219 | spin_unlock_irqrestore(pll->lock, flags); | ||
1220 | } | ||
1221 | #endif | ||
1222 | |||
1223 | static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, | ||
1224 | void __iomem *pmc, unsigned long fixed_rate, | ||
1225 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | ||
1226 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | ||
587 | { | 1227 | { |
588 | struct tegra_clk_pll *pll; | 1228 | struct tegra_clk_pll *pll; |
589 | struct clk *clk; | ||
590 | struct clk_init_data init; | ||
591 | 1229 | ||
592 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | 1230 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); |
593 | if (!pll) | 1231 | if (!pll) |
594 | return ERR_PTR(-ENOMEM); | 1232 | return ERR_PTR(-ENOMEM); |
595 | 1233 | ||
596 | init.name = name; | ||
597 | init.ops = ops; | ||
598 | init.flags = flags; | ||
599 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
600 | init.num_parents = (parent_name ? 1 : 0); | ||
601 | |||
602 | pll->clk_base = clk_base; | 1234 | pll->clk_base = clk_base; |
603 | pll->pmc = pmc; | 1235 | pll->pmc = pmc; |
604 | 1236 | ||
@@ -615,34 +1247,336 @@ static struct clk *_tegra_clk_register_pll(const char *name, | |||
615 | pll->divm_shift = PLL_BASE_DIVM_SHIFT; | 1247 | pll->divm_shift = PLL_BASE_DIVM_SHIFT; |
616 | pll->divm_width = PLL_BASE_DIVM_WIDTH; | 1248 | pll->divm_width = PLL_BASE_DIVM_WIDTH; |
617 | 1249 | ||
1250 | return pll; | ||
1251 | } | ||
1252 | |||
1253 | static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll, | ||
1254 | const char *name, const char *parent_name, unsigned long flags, | ||
1255 | const struct clk_ops *ops) | ||
1256 | { | ||
1257 | struct clk_init_data init; | ||
1258 | |||
1259 | init.name = name; | ||
1260 | init.ops = ops; | ||
1261 | init.flags = flags; | ||
1262 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
1263 | init.num_parents = (parent_name ? 1 : 0); | ||
1264 | |||
618 | /* Data in .init is copied by clk_register(), so stack variable OK */ | 1265 | /* Data in .init is copied by clk_register(), so stack variable OK */ |
619 | pll->hw.init = &init; | 1266 | pll->hw.init = &init; |
620 | 1267 | ||
621 | clk = clk_register(NULL, &pll->hw); | 1268 | return clk_register(NULL, &pll->hw); |
622 | if (IS_ERR(clk)) | ||
623 | kfree(pll); | ||
624 | |||
625 | return clk; | ||
626 | } | 1269 | } |
627 | 1270 | ||
628 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 1271 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
629 | void __iomem *clk_base, void __iomem *pmc, | 1272 | void __iomem *clk_base, void __iomem *pmc, |
630 | unsigned long flags, unsigned long fixed_rate, | 1273 | unsigned long flags, unsigned long fixed_rate, |
631 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 1274 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
632 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | 1275 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) |
633 | { | 1276 | { |
634 | return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, | 1277 | struct tegra_clk_pll *pll; |
635 | flags, fixed_rate, pll_params, pll_flags, freq_table, | 1278 | struct clk *clk; |
636 | lock, &tegra_clk_pll_ops); | 1279 | |
1280 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1281 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1282 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1283 | freq_table, lock); | ||
1284 | if (IS_ERR(pll)) | ||
1285 | return ERR_CAST(pll); | ||
1286 | |||
1287 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1288 | &tegra_clk_pll_ops); | ||
1289 | if (IS_ERR(clk)) | ||
1290 | kfree(pll); | ||
1291 | |||
1292 | return clk; | ||
637 | } | 1293 | } |
638 | 1294 | ||
639 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 1295 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
640 | void __iomem *clk_base, void __iomem *pmc, | 1296 | void __iomem *clk_base, void __iomem *pmc, |
641 | unsigned long flags, unsigned long fixed_rate, | 1297 | unsigned long flags, unsigned long fixed_rate, |
642 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 1298 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
643 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | 1299 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) |
644 | { | 1300 | { |
645 | return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, | 1301 | struct tegra_clk_pll *pll; |
646 | flags, fixed_rate, pll_params, pll_flags, freq_table, | 1302 | struct clk *clk; |
647 | lock, &tegra_clk_plle_ops); | 1303 | |
1304 | pll_flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS; | ||
1305 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1306 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1307 | freq_table, lock); | ||
1308 | if (IS_ERR(pll)) | ||
1309 | return ERR_CAST(pll); | ||
1310 | |||
1311 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1312 | &tegra_clk_plle_ops); | ||
1313 | if (IS_ERR(clk)) | ||
1314 | kfree(pll); | ||
1315 | |||
1316 | return clk; | ||
1317 | } | ||
1318 | |||
1319 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
1320 | const struct clk_ops tegra_clk_pllxc_ops = { | ||
1321 | .is_enabled = clk_pll_is_enabled, | ||
1322 | .enable = clk_pll_iddq_enable, | ||
1323 | .disable = clk_pll_iddq_disable, | ||
1324 | .recalc_rate = clk_pll_recalc_rate, | ||
1325 | .round_rate = clk_pll_ramp_round_rate, | ||
1326 | .set_rate = clk_pllxc_set_rate, | ||
1327 | }; | ||
1328 | |||
1329 | const struct clk_ops tegra_clk_pllm_ops = { | ||
1330 | .is_enabled = clk_pll_is_enabled, | ||
1331 | .enable = clk_pll_iddq_enable, | ||
1332 | .disable = clk_pll_iddq_disable, | ||
1333 | .recalc_rate = clk_pll_recalc_rate, | ||
1334 | .round_rate = clk_pll_ramp_round_rate, | ||
1335 | .set_rate = clk_pllm_set_rate, | ||
1336 | }; | ||
1337 | |||
1338 | const struct clk_ops tegra_clk_pllc_ops = { | ||
1339 | .is_enabled = clk_pll_is_enabled, | ||
1340 | .enable = clk_pllc_enable, | ||
1341 | .disable = clk_pllc_disable, | ||
1342 | .recalc_rate = clk_pll_recalc_rate, | ||
1343 | .round_rate = clk_pll_ramp_round_rate, | ||
1344 | .set_rate = clk_pllc_set_rate, | ||
1345 | }; | ||
1346 | |||
1347 | const struct clk_ops tegra_clk_pllre_ops = { | ||
1348 | .is_enabled = clk_pll_is_enabled, | ||
1349 | .enable = clk_pll_iddq_enable, | ||
1350 | .disable = clk_pll_iddq_disable, | ||
1351 | .recalc_rate = clk_pllre_recalc_rate, | ||
1352 | .round_rate = clk_pllre_round_rate, | ||
1353 | .set_rate = clk_pllre_set_rate, | ||
1354 | }; | ||
1355 | |||
1356 | const struct clk_ops tegra_clk_plle_tegra114_ops = { | ||
1357 | .is_enabled = clk_pll_is_enabled, | ||
1358 | .enable = clk_plle_tegra114_enable, | ||
1359 | .disable = clk_plle_tegra114_disable, | ||
1360 | .recalc_rate = clk_pll_recalc_rate, | ||
1361 | }; | ||
1362 | |||
1363 | |||
1364 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | ||
1365 | void __iomem *clk_base, void __iomem *pmc, | ||
1366 | unsigned long flags, unsigned long fixed_rate, | ||
1367 | struct tegra_clk_pll_params *pll_params, | ||
1368 | u32 pll_flags, | ||
1369 | struct tegra_clk_pll_freq_table *freq_table, | ||
1370 | spinlock_t *lock) | ||
1371 | { | ||
1372 | struct tegra_clk_pll *pll; | ||
1373 | struct clk *clk; | ||
1374 | |||
1375 | if (!pll_params->pdiv_tohw) | ||
1376 | return ERR_PTR(-EINVAL); | ||
1377 | |||
1378 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1379 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1380 | freq_table, lock); | ||
1381 | if (IS_ERR(pll)) | ||
1382 | return ERR_CAST(pll); | ||
1383 | |||
1384 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1385 | &tegra_clk_pllxc_ops); | ||
1386 | if (IS_ERR(clk)) | ||
1387 | kfree(pll); | ||
1388 | |||
1389 | return clk; | ||
1390 | } | ||
1391 | |||
1392 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | ||
1393 | void __iomem *clk_base, void __iomem *pmc, | ||
1394 | unsigned long flags, unsigned long fixed_rate, | ||
1395 | struct tegra_clk_pll_params *pll_params, | ||
1396 | u32 pll_flags, | ||
1397 | struct tegra_clk_pll_freq_table *freq_table, | ||
1398 | spinlock_t *lock, unsigned long parent_rate) | ||
1399 | { | ||
1400 | u32 val; | ||
1401 | struct tegra_clk_pll *pll; | ||
1402 | struct clk *clk; | ||
1403 | |||
1404 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1405 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1406 | freq_table, lock); | ||
1407 | if (IS_ERR(pll)) | ||
1408 | return ERR_CAST(pll); | ||
1409 | |||
1410 | /* program minimum rate by default */ | ||
1411 | |||
1412 | val = pll_readl_base(pll); | ||
1413 | if (val & PLL_BASE_ENABLE) | ||
1414 | WARN_ON(val & pll_params->iddq_bit_idx); | ||
1415 | else { | ||
1416 | int m; | ||
1417 | |||
1418 | m = _pll_fixed_mdiv(pll_params, parent_rate); | ||
1419 | val = m << PLL_BASE_DIVM_SHIFT; | ||
1420 | val |= (pll_params->vco_min / parent_rate) | ||
1421 | << PLL_BASE_DIVN_SHIFT; | ||
1422 | pll_writel_base(val, pll); | ||
1423 | } | ||
1424 | |||
1425 | /* disable lock override */ | ||
1426 | |||
1427 | val = pll_readl_misc(pll); | ||
1428 | val &= ~BIT(29); | ||
1429 | pll_writel_misc(val, pll); | ||
1430 | |||
1431 | pll_flags |= TEGRA_PLL_LOCK_MISC; | ||
1432 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1433 | &tegra_clk_pllre_ops); | ||
1434 | if (IS_ERR(clk)) | ||
1435 | kfree(pll); | ||
1436 | |||
1437 | return clk; | ||
1438 | } | ||
1439 | |||
1440 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | ||
1441 | void __iomem *clk_base, void __iomem *pmc, | ||
1442 | unsigned long flags, unsigned long fixed_rate, | ||
1443 | struct tegra_clk_pll_params *pll_params, | ||
1444 | u32 pll_flags, | ||
1445 | struct tegra_clk_pll_freq_table *freq_table, | ||
1446 | spinlock_t *lock) | ||
1447 | { | ||
1448 | struct tegra_clk_pll *pll; | ||
1449 | struct clk *clk; | ||
1450 | |||
1451 | if (!pll_params->pdiv_tohw) | ||
1452 | return ERR_PTR(-EINVAL); | ||
1453 | |||
1454 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1455 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1456 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1457 | freq_table, lock); | ||
1458 | if (IS_ERR(pll)) | ||
1459 | return ERR_CAST(pll); | ||
1460 | |||
1461 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1462 | &tegra_clk_pllm_ops); | ||
1463 | if (IS_ERR(clk)) | ||
1464 | kfree(pll); | ||
1465 | |||
1466 | return clk; | ||
1467 | } | ||
1468 | |||
1469 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | ||
1470 | void __iomem *clk_base, void __iomem *pmc, | ||
1471 | unsigned long flags, unsigned long fixed_rate, | ||
1472 | struct tegra_clk_pll_params *pll_params, | ||
1473 | u32 pll_flags, | ||
1474 | struct tegra_clk_pll_freq_table *freq_table, | ||
1475 | spinlock_t *lock) | ||
1476 | { | ||
1477 | struct clk *parent, *clk; | ||
1478 | struct pdiv_map *p_tohw = pll_params->pdiv_tohw; | ||
1479 | struct tegra_clk_pll *pll; | ||
1480 | struct tegra_clk_pll_freq_table cfg; | ||
1481 | unsigned long parent_rate; | ||
1482 | |||
1483 | if (!p_tohw) | ||
1484 | return ERR_PTR(-EINVAL); | ||
1485 | |||
1486 | parent = __clk_lookup(parent_name); | ||
1487 | if (IS_ERR(parent)) { | ||
1488 | WARN(1, "parent clk %s of %s must be registered first\n", | ||
1489 | name, parent_name); | ||
1490 | return ERR_PTR(-EINVAL); | ||
1491 | } | ||
1492 | |||
1493 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1494 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1495 | freq_table, lock); | ||
1496 | if (IS_ERR(pll)) | ||
1497 | return ERR_CAST(pll); | ||
1498 | |||
1499 | parent_rate = __clk_get_rate(parent); | ||
1500 | |||
1501 | /* | ||
1502 | * Most of PLLC register fields are shadowed, and can not be read | ||
1503 | * directly from PLL h/w. Hence, actual PLLC boot state is unknown. | ||
1504 | * Initialize PLL to default state: disabled, reset; shadow registers | ||
1505 | * loaded with default parameters; dividers are preset for half of | ||
1506 | * minimum VCO rate (the latter assured that shadowed divider settings | ||
1507 | * are within supported range). | ||
1508 | */ | ||
1509 | |||
1510 | cfg.m = _pll_fixed_mdiv(pll_params, parent_rate); | ||
1511 | cfg.n = cfg.m * pll_params->vco_min / parent_rate; | ||
1512 | |||
1513 | while (p_tohw->pdiv) { | ||
1514 | if (p_tohw->pdiv == 2) { | ||
1515 | cfg.p = p_tohw->hw_val; | ||
1516 | break; | ||
1517 | } | ||
1518 | p_tohw++; | ||
1519 | } | ||
1520 | |||
1521 | if (!p_tohw->pdiv) { | ||
1522 | WARN_ON(1); | ||
1523 | return ERR_PTR(-EINVAL); | ||
1524 | } | ||
1525 | |||
1526 | pll_writel_base(0, pll); | ||
1527 | _update_pll_mnp(pll, &cfg); | ||
1528 | |||
1529 | pll_writel_misc(PLLCX_MISC_DEFAULT, pll); | ||
1530 | pll_writel(PLLCX_MISC1_DEFAULT, pll_params->ext_misc_reg[0], pll); | ||
1531 | pll_writel(PLLCX_MISC2_DEFAULT, pll_params->ext_misc_reg[1], pll); | ||
1532 | pll_writel(PLLCX_MISC3_DEFAULT, pll_params->ext_misc_reg[2], pll); | ||
1533 | |||
1534 | _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); | ||
1535 | |||
1536 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1537 | &tegra_clk_pllc_ops); | ||
1538 | if (IS_ERR(clk)) | ||
1539 | kfree(pll); | ||
1540 | |||
1541 | return clk; | ||
1542 | } | ||
1543 | |||
1544 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | ||
1545 | const char *parent_name, | ||
1546 | void __iomem *clk_base, unsigned long flags, | ||
1547 | unsigned long fixed_rate, | ||
1548 | struct tegra_clk_pll_params *pll_params, | ||
1549 | struct tegra_clk_pll_freq_table *freq_table, | ||
1550 | spinlock_t *lock) | ||
1551 | { | ||
1552 | struct tegra_clk_pll *pll; | ||
1553 | struct clk *clk; | ||
1554 | u32 val, val_aux; | ||
1555 | |||
1556 | pll = _tegra_init_pll(clk_base, NULL, fixed_rate, pll_params, | ||
1557 | TEGRA_PLL_HAS_LOCK_ENABLE, freq_table, lock); | ||
1558 | if (IS_ERR(pll)) | ||
1559 | return ERR_CAST(pll); | ||
1560 | |||
1561 | /* ensure parent is set to pll_re_vco */ | ||
1562 | |||
1563 | val = pll_readl_base(pll); | ||
1564 | val_aux = pll_readl(pll_params->aux_reg, pll); | ||
1565 | |||
1566 | if (val & PLL_BASE_ENABLE) { | ||
1567 | if (!(val_aux & PLLE_AUX_PLLRE_SEL)) | ||
1568 | WARN(1, "pll_e enabled with unsupported parent %s\n", | ||
1569 | (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref"); | ||
1570 | } else { | ||
1571 | val_aux |= PLLE_AUX_PLLRE_SEL; | ||
1572 | pll_writel(val, pll_params->aux_reg, pll); | ||
1573 | } | ||
1574 | |||
1575 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1576 | &tegra_clk_plle_tegra114_ops); | ||
1577 | if (IS_ERR(clk)) | ||
1578 | kfree(pll); | ||
1579 | |||
1580 | return clk; | ||
648 | } | 1581 | } |
1582 | #endif | ||
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c new file mode 100644 index 000000000000..d78e16ee161c --- /dev/null +++ b/drivers/clk/tegra/clk-tegra114.c | |||
@@ -0,0 +1,2085 @@ | |||
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/clk/tegra.h> | ||
25 | |||
26 | #include "clk.h" | ||
27 | |||
28 | #define RST_DEVICES_L 0x004 | ||
29 | #define RST_DEVICES_H 0x008 | ||
30 | #define RST_DEVICES_U 0x00C | ||
31 | #define RST_DEVICES_V 0x358 | ||
32 | #define RST_DEVICES_W 0x35C | ||
33 | #define RST_DEVICES_X 0x28C | ||
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_X 0x280 | ||
52 | #define CLK_OUT_ENB_SET_L 0x320 | ||
53 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
54 | #define CLK_OUT_ENB_SET_H 0x328 | ||
55 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
56 | #define CLK_OUT_ENB_SET_U 0x330 | ||
57 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
58 | #define CLK_OUT_ENB_SET_V 0x440 | ||
59 | #define CLK_OUT_ENB_CLR_V 0x444 | ||
60 | #define CLK_OUT_ENB_SET_W 0x448 | ||
61 | #define CLK_OUT_ENB_CLR_W 0x44c | ||
62 | #define CLK_OUT_ENB_SET_X 0x284 | ||
63 | #define CLK_OUT_ENB_CLR_X 0x288 | ||
64 | #define CLK_OUT_ENB_NUM 6 | ||
65 | |||
66 | #define PLLC_BASE 0x80 | ||
67 | #define PLLC_MISC2 0x88 | ||
68 | #define PLLC_MISC 0x8c | ||
69 | #define PLLC2_BASE 0x4e8 | ||
70 | #define PLLC2_MISC 0x4ec | ||
71 | #define PLLC3_BASE 0x4fc | ||
72 | #define PLLC3_MISC 0x500 | ||
73 | #define PLLM_BASE 0x90 | ||
74 | #define PLLM_MISC 0x9c | ||
75 | #define PLLP_BASE 0xa0 | ||
76 | #define PLLP_MISC 0xac | ||
77 | #define PLLX_BASE 0xe0 | ||
78 | #define PLLX_MISC 0xe4 | ||
79 | #define PLLX_MISC2 0x514 | ||
80 | #define PLLX_MISC3 0x518 | ||
81 | #define PLLD_BASE 0xd0 | ||
82 | #define PLLD_MISC 0xdc | ||
83 | #define PLLD2_BASE 0x4b8 | ||
84 | #define PLLD2_MISC 0x4bc | ||
85 | #define PLLE_BASE 0xe8 | ||
86 | #define PLLE_MISC 0xec | ||
87 | #define PLLA_BASE 0xb0 | ||
88 | #define PLLA_MISC 0xbc | ||
89 | #define PLLU_BASE 0xc0 | ||
90 | #define PLLU_MISC 0xcc | ||
91 | #define PLLRE_BASE 0x4c4 | ||
92 | #define PLLRE_MISC 0x4c8 | ||
93 | |||
94 | #define PLL_MISC_LOCK_ENABLE 18 | ||
95 | #define PLLC_MISC_LOCK_ENABLE 24 | ||
96 | #define PLLDU_MISC_LOCK_ENABLE 22 | ||
97 | #define PLLE_MISC_LOCK_ENABLE 9 | ||
98 | #define PLLRE_MISC_LOCK_ENABLE 30 | ||
99 | |||
100 | #define PLLC_IDDQ_BIT 26 | ||
101 | #define PLLX_IDDQ_BIT 3 | ||
102 | #define PLLRE_IDDQ_BIT 16 | ||
103 | |||
104 | #define PLL_BASE_LOCK BIT(27) | ||
105 | #define PLLE_MISC_LOCK BIT(11) | ||
106 | #define PLLRE_MISC_LOCK BIT(24) | ||
107 | #define PLLCX_BASE_LOCK (BIT(26)|BIT(27)) | ||
108 | |||
109 | #define PLLE_AUX 0x48c | ||
110 | #define PLLC_OUT 0x84 | ||
111 | #define PLLM_OUT 0x94 | ||
112 | #define PLLP_OUTA 0xa4 | ||
113 | #define PLLP_OUTB 0xa8 | ||
114 | #define PLLA_OUT 0xb4 | ||
115 | |||
116 | #define AUDIO_SYNC_CLK_I2S0 0x4a0 | ||
117 | #define AUDIO_SYNC_CLK_I2S1 0x4a4 | ||
118 | #define AUDIO_SYNC_CLK_I2S2 0x4a8 | ||
119 | #define AUDIO_SYNC_CLK_I2S3 0x4ac | ||
120 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 | ||
121 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 | ||
122 | |||
123 | #define AUDIO_SYNC_DOUBLER 0x49c | ||
124 | |||
125 | #define PMC_CLK_OUT_CNTRL 0x1a8 | ||
126 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
127 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
128 | #define PMC_CTRL 0 | ||
129 | #define PMC_CTRL_BLINK_ENB 7 | ||
130 | |||
131 | #define OSC_CTRL 0x50 | ||
132 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 | ||
133 | #define OSC_CTRL_PLL_REF_DIV_SHIFT 26 | ||
134 | |||
135 | #define PLLXC_SW_MAX_P 6 | ||
136 | |||
137 | #define CCLKG_BURST_POLICY 0x368 | ||
138 | #define CCLKLP_BURST_POLICY 0x370 | ||
139 | #define SCLK_BURST_POLICY 0x028 | ||
140 | #define SYSTEM_CLK_RATE 0x030 | ||
141 | |||
142 | #define UTMIP_PLL_CFG2 0x488 | ||
143 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) | ||
144 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) | ||
145 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0) | ||
146 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2) | ||
147 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4) | ||
148 | |||
149 | #define UTMIP_PLL_CFG1 0x484 | ||
150 | #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6) | ||
151 | #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) | ||
152 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17) | ||
153 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16) | ||
154 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15) | ||
155 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14) | ||
156 | #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12) | ||
157 | |||
158 | #define UTMIPLL_HW_PWRDN_CFG0 0x52c | ||
159 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25) | ||
160 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24) | ||
161 | #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6) | ||
162 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5) | ||
163 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4) | ||
164 | #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2) | ||
165 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) | ||
166 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) | ||
167 | |||
168 | #define CLK_SOURCE_I2S0 0x1d8 | ||
169 | #define CLK_SOURCE_I2S1 0x100 | ||
170 | #define CLK_SOURCE_I2S2 0x104 | ||
171 | #define CLK_SOURCE_NDFLASH 0x160 | ||
172 | #define CLK_SOURCE_I2S3 0x3bc | ||
173 | #define CLK_SOURCE_I2S4 0x3c0 | ||
174 | #define CLK_SOURCE_SPDIF_OUT 0x108 | ||
175 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
176 | #define CLK_SOURCE_PWM 0x110 | ||
177 | #define CLK_SOURCE_ADX 0x638 | ||
178 | #define CLK_SOURCE_AMX 0x63c | ||
179 | #define CLK_SOURCE_HDA 0x428 | ||
180 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 | ||
181 | #define CLK_SOURCE_SBC1 0x134 | ||
182 | #define CLK_SOURCE_SBC2 0x118 | ||
183 | #define CLK_SOURCE_SBC3 0x11c | ||
184 | #define CLK_SOURCE_SBC4 0x1b4 | ||
185 | #define CLK_SOURCE_SBC5 0x3c8 | ||
186 | #define CLK_SOURCE_SBC6 0x3cc | ||
187 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
188 | #define CLK_SOURCE_SATA 0x424 | ||
189 | #define CLK_SOURCE_NDSPEED 0x3f8 | ||
190 | #define CLK_SOURCE_VFIR 0x168 | ||
191 | #define CLK_SOURCE_SDMMC1 0x150 | ||
192 | #define CLK_SOURCE_SDMMC2 0x154 | ||
193 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
194 | #define CLK_SOURCE_SDMMC4 0x164 | ||
195 | #define CLK_SOURCE_VDE 0x1c8 | ||
196 | #define CLK_SOURCE_CSITE 0x1d4 | ||
197 | #define CLK_SOURCE_LA 0x1f8 | ||
198 | #define CLK_SOURCE_TRACE 0x634 | ||
199 | #define CLK_SOURCE_OWR 0x1cc | ||
200 | #define CLK_SOURCE_NOR 0x1d0 | ||
201 | #define CLK_SOURCE_MIPI 0x174 | ||
202 | #define CLK_SOURCE_I2C1 0x124 | ||
203 | #define CLK_SOURCE_I2C2 0x198 | ||
204 | #define CLK_SOURCE_I2C3 0x1b8 | ||
205 | #define CLK_SOURCE_I2C4 0x3c4 | ||
206 | #define CLK_SOURCE_I2C5 0x128 | ||
207 | #define CLK_SOURCE_UARTA 0x178 | ||
208 | #define CLK_SOURCE_UARTB 0x17c | ||
209 | #define CLK_SOURCE_UARTC 0x1a0 | ||
210 | #define CLK_SOURCE_UARTD 0x1c0 | ||
211 | #define CLK_SOURCE_UARTE 0x1c4 | ||
212 | #define CLK_SOURCE_UARTA_DBG 0x178 | ||
213 | #define CLK_SOURCE_UARTB_DBG 0x17c | ||
214 | #define CLK_SOURCE_UARTC_DBG 0x1a0 | ||
215 | #define CLK_SOURCE_UARTD_DBG 0x1c0 | ||
216 | #define CLK_SOURCE_UARTE_DBG 0x1c4 | ||
217 | #define CLK_SOURCE_3D 0x158 | ||
218 | #define CLK_SOURCE_2D 0x15c | ||
219 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
220 | #define CLK_SOURCE_VI 0x148 | ||
221 | #define CLK_SOURCE_EPP 0x16c | ||
222 | #define CLK_SOURCE_MSENC 0x1f0 | ||
223 | #define CLK_SOURCE_TSEC 0x1f4 | ||
224 | #define CLK_SOURCE_HOST1X 0x180 | ||
225 | #define CLK_SOURCE_HDMI 0x18c | ||
226 | #define CLK_SOURCE_DISP1 0x138 | ||
227 | #define CLK_SOURCE_DISP2 0x13c | ||
228 | #define CLK_SOURCE_CILAB 0x614 | ||
229 | #define CLK_SOURCE_CILCD 0x618 | ||
230 | #define CLK_SOURCE_CILE 0x61c | ||
231 | #define CLK_SOURCE_DSIALP 0x620 | ||
232 | #define CLK_SOURCE_DSIBLP 0x624 | ||
233 | #define CLK_SOURCE_TSENSOR 0x3b8 | ||
234 | #define CLK_SOURCE_D_AUDIO 0x3d0 | ||
235 | #define CLK_SOURCE_DAM0 0x3d8 | ||
236 | #define CLK_SOURCE_DAM1 0x3dc | ||
237 | #define CLK_SOURCE_DAM2 0x3e0 | ||
238 | #define CLK_SOURCE_ACTMON 0x3e8 | ||
239 | #define CLK_SOURCE_EXTERN1 0x3ec | ||
240 | #define CLK_SOURCE_EXTERN2 0x3f0 | ||
241 | #define CLK_SOURCE_EXTERN3 0x3f4 | ||
242 | #define CLK_SOURCE_I2CSLOW 0x3fc | ||
243 | #define CLK_SOURCE_SE 0x42c | ||
244 | #define CLK_SOURCE_MSELECT 0x3b4 | ||
245 | #define CLK_SOURCE_SOC_THERM 0x644 | ||
246 | #define CLK_SOURCE_XUSB_HOST_SRC 0x600 | ||
247 | #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 | ||
248 | #define CLK_SOURCE_XUSB_FS_SRC 0x608 | ||
249 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 | ||
250 | #define CLK_SOURCE_XUSB_DEV_SRC 0x60c | ||
251 | #define CLK_SOURCE_EMC 0x19c | ||
252 | |||
253 | static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; | ||
254 | |||
255 | static void __iomem *clk_base; | ||
256 | static void __iomem *pmc_base; | ||
257 | |||
258 | static DEFINE_SPINLOCK(pll_d_lock); | ||
259 | static DEFINE_SPINLOCK(pll_d2_lock); | ||
260 | static DEFINE_SPINLOCK(pll_u_lock); | ||
261 | static DEFINE_SPINLOCK(pll_div_lock); | ||
262 | static DEFINE_SPINLOCK(pll_re_lock); | ||
263 | static DEFINE_SPINLOCK(clk_doubler_lock); | ||
264 | static DEFINE_SPINLOCK(clk_out_lock); | ||
265 | static DEFINE_SPINLOCK(sysrate_lock); | ||
266 | |||
267 | static struct pdiv_map pllxc_p[] = { | ||
268 | { .pdiv = 1, .hw_val = 0 }, | ||
269 | { .pdiv = 2, .hw_val = 1 }, | ||
270 | { .pdiv = 3, .hw_val = 2 }, | ||
271 | { .pdiv = 4, .hw_val = 3 }, | ||
272 | { .pdiv = 5, .hw_val = 4 }, | ||
273 | { .pdiv = 6, .hw_val = 5 }, | ||
274 | { .pdiv = 8, .hw_val = 6 }, | ||
275 | { .pdiv = 10, .hw_val = 7 }, | ||
276 | { .pdiv = 12, .hw_val = 8 }, | ||
277 | { .pdiv = 16, .hw_val = 9 }, | ||
278 | { .pdiv = 12, .hw_val = 10 }, | ||
279 | { .pdiv = 16, .hw_val = 11 }, | ||
280 | { .pdiv = 20, .hw_val = 12 }, | ||
281 | { .pdiv = 24, .hw_val = 13 }, | ||
282 | { .pdiv = 32, .hw_val = 14 }, | ||
283 | { .pdiv = 0, .hw_val = 0 }, | ||
284 | }; | ||
285 | |||
286 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | ||
287 | { 12000000, 624000000, 104, 0, 2}, | ||
288 | { 12000000, 600000000, 100, 0, 2}, | ||
289 | { 13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ | ||
290 | { 16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ | ||
291 | { 19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ | ||
292 | { 26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
293 | { 0, 0, 0, 0, 0, 0 }, | ||
294 | }; | ||
295 | |||
296 | static struct tegra_clk_pll_params pll_c_params = { | ||
297 | .input_min = 12000000, | ||
298 | .input_max = 800000000, | ||
299 | .cf_min = 12000000, | ||
300 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
301 | .vco_min = 600000000, | ||
302 | .vco_max = 1400000000, | ||
303 | .base_reg = PLLC_BASE, | ||
304 | .misc_reg = PLLC_MISC, | ||
305 | .lock_mask = PLL_BASE_LOCK, | ||
306 | .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE, | ||
307 | .lock_delay = 300, | ||
308 | .iddq_reg = PLLC_MISC, | ||
309 | .iddq_bit_idx = PLLC_IDDQ_BIT, | ||
310 | .max_p = PLLXC_SW_MAX_P, | ||
311 | .dyn_ramp_reg = PLLC_MISC2, | ||
312 | .stepa_shift = 17, | ||
313 | .stepb_shift = 9, | ||
314 | .pdiv_tohw = pllxc_p, | ||
315 | }; | ||
316 | |||
317 | static struct pdiv_map pllc_p[] = { | ||
318 | { .pdiv = 1, .hw_val = 0 }, | ||
319 | { .pdiv = 2, .hw_val = 1 }, | ||
320 | { .pdiv = 4, .hw_val = 3 }, | ||
321 | { .pdiv = 8, .hw_val = 5 }, | ||
322 | { .pdiv = 16, .hw_val = 7 }, | ||
323 | { .pdiv = 0, .hw_val = 0 }, | ||
324 | }; | ||
325 | |||
326 | static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = { | ||
327 | {12000000, 600000000, 100, 0, 2}, | ||
328 | {13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ | ||
329 | {16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ | ||
330 | {19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ | ||
331 | {26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
332 | {0, 0, 0, 0, 0, 0}, | ||
333 | }; | ||
334 | |||
335 | static struct tegra_clk_pll_params pll_c2_params = { | ||
336 | .input_min = 12000000, | ||
337 | .input_max = 48000000, | ||
338 | .cf_min = 12000000, | ||
339 | .cf_max = 19200000, | ||
340 | .vco_min = 600000000, | ||
341 | .vco_max = 1200000000, | ||
342 | .base_reg = PLLC2_BASE, | ||
343 | .misc_reg = PLLC2_MISC, | ||
344 | .lock_mask = PLL_BASE_LOCK, | ||
345 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
346 | .lock_delay = 300, | ||
347 | .pdiv_tohw = pllc_p, | ||
348 | .ext_misc_reg[0] = 0x4f0, | ||
349 | .ext_misc_reg[1] = 0x4f4, | ||
350 | .ext_misc_reg[2] = 0x4f8, | ||
351 | }; | ||
352 | |||
353 | static struct tegra_clk_pll_params pll_c3_params = { | ||
354 | .input_min = 12000000, | ||
355 | .input_max = 48000000, | ||
356 | .cf_min = 12000000, | ||
357 | .cf_max = 19200000, | ||
358 | .vco_min = 600000000, | ||
359 | .vco_max = 1200000000, | ||
360 | .base_reg = PLLC3_BASE, | ||
361 | .misc_reg = PLLC3_MISC, | ||
362 | .lock_mask = PLL_BASE_LOCK, | ||
363 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
364 | .lock_delay = 300, | ||
365 | .pdiv_tohw = pllc_p, | ||
366 | .ext_misc_reg[0] = 0x504, | ||
367 | .ext_misc_reg[1] = 0x508, | ||
368 | .ext_misc_reg[2] = 0x50c, | ||
369 | }; | ||
370 | |||
371 | static struct pdiv_map pllm_p[] = { | ||
372 | { .pdiv = 1, .hw_val = 0 }, | ||
373 | { .pdiv = 2, .hw_val = 1 }, | ||
374 | { .pdiv = 0, .hw_val = 0 }, | ||
375 | }; | ||
376 | |||
377 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | ||
378 | {12000000, 800000000, 66, 0, 1}, /* actual: 792.0 MHz */ | ||
379 | {13000000, 800000000, 61, 0, 1}, /* actual: 793.0 MHz */ | ||
380 | {16800000, 800000000, 47, 0, 1}, /* actual: 789.6 MHz */ | ||
381 | {19200000, 800000000, 41, 0, 1}, /* actual: 787.2 MHz */ | ||
382 | {26000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */ | ||
383 | {0, 0, 0, 0, 0, 0}, | ||
384 | }; | ||
385 | |||
386 | static struct tegra_clk_pll_params pll_m_params = { | ||
387 | .input_min = 12000000, | ||
388 | .input_max = 500000000, | ||
389 | .cf_min = 12000000, | ||
390 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
391 | .vco_min = 400000000, | ||
392 | .vco_max = 1066000000, | ||
393 | .base_reg = PLLM_BASE, | ||
394 | .misc_reg = PLLM_MISC, | ||
395 | .lock_mask = PLL_BASE_LOCK, | ||
396 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
397 | .lock_delay = 300, | ||
398 | .max_p = 2, | ||
399 | .pdiv_tohw = pllm_p, | ||
400 | }; | ||
401 | |||
402 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | ||
403 | {12000000, 216000000, 432, 12, 1, 8}, | ||
404 | {13000000, 216000000, 432, 13, 1, 8}, | ||
405 | {16800000, 216000000, 360, 14, 1, 8}, | ||
406 | {19200000, 216000000, 360, 16, 1, 8}, | ||
407 | {26000000, 216000000, 432, 26, 1, 8}, | ||
408 | {0, 0, 0, 0, 0, 0}, | ||
409 | }; | ||
410 | |||
411 | static struct tegra_clk_pll_params pll_p_params = { | ||
412 | .input_min = 2000000, | ||
413 | .input_max = 31000000, | ||
414 | .cf_min = 1000000, | ||
415 | .cf_max = 6000000, | ||
416 | .vco_min = 200000000, | ||
417 | .vco_max = 700000000, | ||
418 | .base_reg = PLLP_BASE, | ||
419 | .misc_reg = PLLP_MISC, | ||
420 | .lock_mask = PLL_BASE_LOCK, | ||
421 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
422 | .lock_delay = 300, | ||
423 | }; | ||
424 | |||
425 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | ||
426 | {9600000, 282240000, 147, 5, 0, 4}, | ||
427 | {9600000, 368640000, 192, 5, 0, 4}, | ||
428 | {9600000, 240000000, 200, 8, 0, 8}, | ||
429 | |||
430 | {28800000, 282240000, 245, 25, 0, 8}, | ||
431 | {28800000, 368640000, 320, 25, 0, 8}, | ||
432 | {28800000, 240000000, 200, 24, 0, 8}, | ||
433 | {0, 0, 0, 0, 0, 0}, | ||
434 | }; | ||
435 | |||
436 | |||
437 | static struct tegra_clk_pll_params pll_a_params = { | ||
438 | .input_min = 2000000, | ||
439 | .input_max = 31000000, | ||
440 | .cf_min = 1000000, | ||
441 | .cf_max = 6000000, | ||
442 | .vco_min = 200000000, | ||
443 | .vco_max = 700000000, | ||
444 | .base_reg = PLLA_BASE, | ||
445 | .misc_reg = PLLA_MISC, | ||
446 | .lock_mask = PLL_BASE_LOCK, | ||
447 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
448 | .lock_delay = 300, | ||
449 | }; | ||
450 | |||
451 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | ||
452 | {12000000, 216000000, 864, 12, 2, 12}, | ||
453 | {13000000, 216000000, 864, 13, 2, 12}, | ||
454 | {16800000, 216000000, 720, 14, 2, 12}, | ||
455 | {19200000, 216000000, 720, 16, 2, 12}, | ||
456 | {26000000, 216000000, 864, 26, 2, 12}, | ||
457 | |||
458 | {12000000, 594000000, 594, 12, 0, 12}, | ||
459 | {13000000, 594000000, 594, 13, 0, 12}, | ||
460 | {16800000, 594000000, 495, 14, 0, 12}, | ||
461 | {19200000, 594000000, 495, 16, 0, 12}, | ||
462 | {26000000, 594000000, 594, 26, 0, 12}, | ||
463 | |||
464 | {12000000, 1000000000, 1000, 12, 0, 12}, | ||
465 | {13000000, 1000000000, 1000, 13, 0, 12}, | ||
466 | {19200000, 1000000000, 625, 12, 0, 12}, | ||
467 | {26000000, 1000000000, 1000, 26, 0, 12}, | ||
468 | |||
469 | {0, 0, 0, 0, 0, 0}, | ||
470 | }; | ||
471 | |||
472 | static struct tegra_clk_pll_params pll_d_params = { | ||
473 | .input_min = 2000000, | ||
474 | .input_max = 40000000, | ||
475 | .cf_min = 1000000, | ||
476 | .cf_max = 6000000, | ||
477 | .vco_min = 500000000, | ||
478 | .vco_max = 1000000000, | ||
479 | .base_reg = PLLD_BASE, | ||
480 | .misc_reg = PLLD_MISC, | ||
481 | .lock_mask = PLL_BASE_LOCK, | ||
482 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
483 | .lock_delay = 1000, | ||
484 | }; | ||
485 | |||
486 | static struct tegra_clk_pll_params pll_d2_params = { | ||
487 | .input_min = 2000000, | ||
488 | .input_max = 40000000, | ||
489 | .cf_min = 1000000, | ||
490 | .cf_max = 6000000, | ||
491 | .vco_min = 500000000, | ||
492 | .vco_max = 1000000000, | ||
493 | .base_reg = PLLD2_BASE, | ||
494 | .misc_reg = PLLD2_MISC, | ||
495 | .lock_mask = PLL_BASE_LOCK, | ||
496 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
497 | .lock_delay = 1000, | ||
498 | }; | ||
499 | |||
500 | static struct pdiv_map pllu_p[] = { | ||
501 | { .pdiv = 1, .hw_val = 1 }, | ||
502 | { .pdiv = 2, .hw_val = 0 }, | ||
503 | { .pdiv = 0, .hw_val = 0 }, | ||
504 | }; | ||
505 | |||
506 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | ||
507 | {12000000, 480000000, 960, 12, 0, 12}, | ||
508 | {13000000, 480000000, 960, 13, 0, 12}, | ||
509 | {16800000, 480000000, 400, 7, 0, 5}, | ||
510 | {19200000, 480000000, 200, 4, 0, 3}, | ||
511 | {26000000, 480000000, 960, 26, 0, 12}, | ||
512 | {0, 0, 0, 0, 0, 0}, | ||
513 | }; | ||
514 | |||
515 | static struct tegra_clk_pll_params pll_u_params = { | ||
516 | .input_min = 2000000, | ||
517 | .input_max = 40000000, | ||
518 | .cf_min = 1000000, | ||
519 | .cf_max = 6000000, | ||
520 | .vco_min = 480000000, | ||
521 | .vco_max = 960000000, | ||
522 | .base_reg = PLLU_BASE, | ||
523 | .misc_reg = PLLU_MISC, | ||
524 | .lock_mask = PLL_BASE_LOCK, | ||
525 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
526 | .lock_delay = 1000, | ||
527 | .pdiv_tohw = pllu_p, | ||
528 | }; | ||
529 | |||
530 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | ||
531 | /* 1 GHz */ | ||
532 | {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */ | ||
533 | {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */ | ||
534 | {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */ | ||
535 | {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */ | ||
536 | {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */ | ||
537 | |||
538 | {0, 0, 0, 0, 0, 0}, | ||
539 | }; | ||
540 | |||
541 | static struct tegra_clk_pll_params pll_x_params = { | ||
542 | .input_min = 12000000, | ||
543 | .input_max = 800000000, | ||
544 | .cf_min = 12000000, | ||
545 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
546 | .vco_min = 700000000, | ||
547 | .vco_max = 2400000000U, | ||
548 | .base_reg = PLLX_BASE, | ||
549 | .misc_reg = PLLX_MISC, | ||
550 | .lock_mask = PLL_BASE_LOCK, | ||
551 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
552 | .lock_delay = 300, | ||
553 | .iddq_reg = PLLX_MISC3, | ||
554 | .iddq_bit_idx = PLLX_IDDQ_BIT, | ||
555 | .max_p = PLLXC_SW_MAX_P, | ||
556 | .dyn_ramp_reg = PLLX_MISC2, | ||
557 | .stepa_shift = 16, | ||
558 | .stepb_shift = 24, | ||
559 | .pdiv_tohw = pllxc_p, | ||
560 | }; | ||
561 | |||
562 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | ||
563 | /* PLLE special case: use cpcon field to store cml divider value */ | ||
564 | {336000000, 100000000, 100, 21, 16, 11}, | ||
565 | {312000000, 100000000, 200, 26, 24, 13}, | ||
566 | {0, 0, 0, 0, 0, 0}, | ||
567 | }; | ||
568 | |||
569 | static struct tegra_clk_pll_params pll_e_params = { | ||
570 | .input_min = 12000000, | ||
571 | .input_max = 1000000000, | ||
572 | .cf_min = 12000000, | ||
573 | .cf_max = 75000000, | ||
574 | .vco_min = 1600000000, | ||
575 | .vco_max = 2400000000U, | ||
576 | .base_reg = PLLE_BASE, | ||
577 | .misc_reg = PLLE_MISC, | ||
578 | .aux_reg = PLLE_AUX, | ||
579 | .lock_mask = PLLE_MISC_LOCK, | ||
580 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | ||
581 | .lock_delay = 300, | ||
582 | }; | ||
583 | |||
584 | static struct tegra_clk_pll_params pll_re_vco_params = { | ||
585 | .input_min = 12000000, | ||
586 | .input_max = 1000000000, | ||
587 | .cf_min = 12000000, | ||
588 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
589 | .vco_min = 300000000, | ||
590 | .vco_max = 600000000, | ||
591 | .base_reg = PLLRE_BASE, | ||
592 | .misc_reg = PLLRE_MISC, | ||
593 | .lock_mask = PLLRE_MISC_LOCK, | ||
594 | .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE, | ||
595 | .lock_delay = 300, | ||
596 | .iddq_reg = PLLRE_MISC, | ||
597 | .iddq_bit_idx = PLLRE_IDDQ_BIT, | ||
598 | }; | ||
599 | |||
600 | /* Peripheral clock registers */ | ||
601 | |||
602 | static struct tegra_clk_periph_regs periph_l_regs = { | ||
603 | .enb_reg = CLK_OUT_ENB_L, | ||
604 | .enb_set_reg = CLK_OUT_ENB_SET_L, | ||
605 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | ||
606 | .rst_reg = RST_DEVICES_L, | ||
607 | .rst_set_reg = RST_DEVICES_SET_L, | ||
608 | .rst_clr_reg = RST_DEVICES_CLR_L, | ||
609 | }; | ||
610 | |||
611 | static struct tegra_clk_periph_regs periph_h_regs = { | ||
612 | .enb_reg = CLK_OUT_ENB_H, | ||
613 | .enb_set_reg = CLK_OUT_ENB_SET_H, | ||
614 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | ||
615 | .rst_reg = RST_DEVICES_H, | ||
616 | .rst_set_reg = RST_DEVICES_SET_H, | ||
617 | .rst_clr_reg = RST_DEVICES_CLR_H, | ||
618 | }; | ||
619 | |||
620 | static struct tegra_clk_periph_regs periph_u_regs = { | ||
621 | .enb_reg = CLK_OUT_ENB_U, | ||
622 | .enb_set_reg = CLK_OUT_ENB_SET_U, | ||
623 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | ||
624 | .rst_reg = RST_DEVICES_U, | ||
625 | .rst_set_reg = RST_DEVICES_SET_U, | ||
626 | .rst_clr_reg = RST_DEVICES_CLR_U, | ||
627 | }; | ||
628 | |||
629 | static struct tegra_clk_periph_regs periph_v_regs = { | ||
630 | .enb_reg = CLK_OUT_ENB_V, | ||
631 | .enb_set_reg = CLK_OUT_ENB_SET_V, | ||
632 | .enb_clr_reg = CLK_OUT_ENB_CLR_V, | ||
633 | .rst_reg = RST_DEVICES_V, | ||
634 | .rst_set_reg = RST_DEVICES_SET_V, | ||
635 | .rst_clr_reg = RST_DEVICES_CLR_V, | ||
636 | }; | ||
637 | |||
638 | static struct tegra_clk_periph_regs periph_w_regs = { | ||
639 | .enb_reg = CLK_OUT_ENB_W, | ||
640 | .enb_set_reg = CLK_OUT_ENB_SET_W, | ||
641 | .enb_clr_reg = CLK_OUT_ENB_CLR_W, | ||
642 | .rst_reg = RST_DEVICES_W, | ||
643 | .rst_set_reg = RST_DEVICES_SET_W, | ||
644 | .rst_clr_reg = RST_DEVICES_CLR_W, | ||
645 | }; | ||
646 | |||
647 | /* possible OSC frequencies in Hz */ | ||
648 | static unsigned long tegra114_input_freq[] = { | ||
649 | [0] = 13000000, | ||
650 | [1] = 16800000, | ||
651 | [4] = 19200000, | ||
652 | [5] = 38400000, | ||
653 | [8] = 12000000, | ||
654 | [9] = 48000000, | ||
655 | [12] = 260000000, | ||
656 | }; | ||
657 | |||
658 | #define MASK(x) (BIT(x) - 1) | ||
659 | |||
660 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ | ||
661 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
662 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
663 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
664 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
665 | _parents##_idx, 0) | ||
666 | |||
667 | #define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
668 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
669 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
670 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
671 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
672 | _parents##_idx, flags) | ||
673 | |||
674 | #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ | ||
675 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
676 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
677 | 29, MASK(3), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
678 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
679 | _parents##_idx, 0) | ||
680 | |||
681 | #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ | ||
682 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
683 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
684 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
685 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
686 | _clk_id, _parents##_idx, 0) | ||
687 | |||
688 | #define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
689 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
690 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
691 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
692 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
693 | _clk_id, _parents##_idx, flags) | ||
694 | |||
695 | #define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\ | ||
696 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
697 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
698 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
699 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
700 | _clk_id, _parents##_idx, 0) | ||
701 | |||
702 | #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ | ||
703 | _clk_num, _regs, _clk_id) \ | ||
704 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
705 | 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,\ | ||
706 | _clk_num, periph_clk_enb_refcnt, 0, _clk_id, \ | ||
707 | _parents##_idx, 0) | ||
708 | |||
709 | #define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\ | ||
710 | _clk_num, _regs, _clk_id) \ | ||
711 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
712 | 30, MASK(2), 0, 0, 16, 0, 0, _regs, _clk_num, \ | ||
713 | periph_clk_enb_refcnt, 0, _clk_id, _parents##_idx, 0) | ||
714 | |||
715 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ | ||
716 | _mux_shift, _mux_mask, _clk_num, _regs, \ | ||
717 | _gate_flags, _clk_id) \ | ||
718 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
719 | _mux_shift, _mux_mask, 0, 0, 0, 0, 0, _regs, \ | ||
720 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
721 | _clk_id, _parents##_idx, 0) | ||
722 | |||
723 | #define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \ | ||
724 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
725 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \ | ||
726 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ | ||
727 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
728 | _clk_id, _parents##_idx, 0) | ||
729 | |||
730 | #define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset, _clk_num,\ | ||
731 | _regs, _gate_flags, _clk_id) \ | ||
732 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \ | ||
733 | _offset, 16, 0xE01F, 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
734 | periph_clk_enb_refcnt, _gate_flags , _clk_id, \ | ||
735 | mux_d_audio_clk_idx, 0) | ||
736 | |||
737 | enum tegra114_clk { | ||
738 | rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12, | ||
739 | ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19, | ||
740 | gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27, | ||
741 | host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40, | ||
742 | sbc1 = 41, nor = 42, sbc2 = 44, sbc3 = 46, i2c5 = 47, dsia = 48, | ||
743 | mipi = 50, hdmi = 51, csi = 52, i2c2 = 54, uartc = 55, mipi_cal = 56, | ||
744 | emc, usb2, usb3, vde = 61, bsea = 62, bsev = 63, uartd = 65, | ||
745 | i2c3 = 67, sbc4 = 68, sdmmc3 = 69, owr = 71, csite = 73, | ||
746 | la = 76, trace = 77, soc_therm = 78, dtv = 79, ndspeed = 80, | ||
747 | i2cslow = 81, dsib = 82, tsec = 83, xusb_host = 89, msenc = 91, | ||
748 | csus = 92, mselect = 99, tsensor = 100, i2s3 = 101, i2s4 = 102, | ||
749 | i2c4 = 103, sbc5 = 104, sbc6 = 105, d_audio, apbif = 107, dam0, dam1, | ||
750 | dam2, hda2codec_2x = 111, audio0_2x = 113, audio1_2x, audio2_2x, | ||
751 | audio3_2x, audio4_2x, spdif_2x, actmon = 119, extern1 = 120, | ||
752 | extern2 = 121, extern3 = 122, hda = 125, se = 127, hda2hdmi = 128, | ||
753 | cilab = 144, cilcd = 145, cile = 146, dsialp = 147, dsiblp = 148, | ||
754 | dds = 150, dp2 = 152, amx = 153, adx = 154, xusb_ss = 156, uartb = 192, | ||
755 | vfir, spdif_in, spdif_out, vi, vi_sensor, fuse, fuse_burn, clk_32k, | ||
756 | clk_m, clk_m_div2, clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_c2, | ||
757 | pll_c3, pll_m, pll_m_out1, pll_p, pll_p_out1, pll_p_out2, pll_p_out3, | ||
758 | pll_p_out4, pll_a, pll_a_out0, pll_d, pll_d_out0, pll_d2, pll_d2_out0, | ||
759 | pll_u, pll_u_480M, pll_u_60M, pll_u_48M, pll_u_12M, pll_x, pll_x_out0, | ||
760 | pll_re_vco, pll_re_out, pll_e_out0, spdif_in_sync, i2s0_sync, | ||
761 | i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, vimclk_sync, audio0, | ||
762 | audio1, audio2, audio3, audio4, spdif, clk_out_1, clk_out_2, clk_out_3, | ||
763 | blink, xusb_host_src = 252, xusb_falcon_src, xusb_fs_src, xusb_ss_src, | ||
764 | xusb_dev_src, xusb_dev, xusb_hs_src, sclk, hclk, pclk, cclk_g, cclk_lp, | ||
765 | |||
766 | /* Mux clocks */ | ||
767 | |||
768 | audio0_mux = 300, audio1_mux, audio2_mux, audio3_mux, audio4_mux, | ||
769 | spdif_mux, clk_out_1_mux, clk_out_2_mux, clk_out_3_mux, dsia_mux, | ||
770 | dsib_mux, clk_max, | ||
771 | }; | ||
772 | |||
773 | struct utmi_clk_param { | ||
774 | /* Oscillator Frequency in KHz */ | ||
775 | u32 osc_frequency; | ||
776 | /* UTMIP PLL Enable Delay Count */ | ||
777 | u8 enable_delay_count; | ||
778 | /* UTMIP PLL Stable count */ | ||
779 | u8 stable_count; | ||
780 | /* UTMIP PLL Active delay count */ | ||
781 | u8 active_delay_count; | ||
782 | /* UTMIP PLL Xtal frequency count */ | ||
783 | u8 xtal_freq_count; | ||
784 | }; | ||
785 | |||
786 | static const struct utmi_clk_param utmi_parameters[] = { | ||
787 | {.osc_frequency = 13000000, .enable_delay_count = 0x02, | ||
788 | .stable_count = 0x33, .active_delay_count = 0x05, | ||
789 | .xtal_freq_count = 0x7F}, | ||
790 | {.osc_frequency = 19200000, .enable_delay_count = 0x03, | ||
791 | .stable_count = 0x4B, .active_delay_count = 0x06, | ||
792 | .xtal_freq_count = 0xBB}, | ||
793 | {.osc_frequency = 12000000, .enable_delay_count = 0x02, | ||
794 | .stable_count = 0x2F, .active_delay_count = 0x04, | ||
795 | .xtal_freq_count = 0x76}, | ||
796 | {.osc_frequency = 26000000, .enable_delay_count = 0x04, | ||
797 | .stable_count = 0x66, .active_delay_count = 0x09, | ||
798 | .xtal_freq_count = 0xFE}, | ||
799 | {.osc_frequency = 16800000, .enable_delay_count = 0x03, | ||
800 | .stable_count = 0x41, .active_delay_count = 0x0A, | ||
801 | .xtal_freq_count = 0xA4}, | ||
802 | }; | ||
803 | |||
804 | /* peripheral mux definitions */ | ||
805 | |||
806 | #define MUX_I2S_SPDIF(_id) \ | ||
807 | static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ | ||
808 | #_id, "pll_p",\ | ||
809 | "clk_m"}; | ||
810 | MUX_I2S_SPDIF(audio0) | ||
811 | MUX_I2S_SPDIF(audio1) | ||
812 | MUX_I2S_SPDIF(audio2) | ||
813 | MUX_I2S_SPDIF(audio3) | ||
814 | MUX_I2S_SPDIF(audio4) | ||
815 | MUX_I2S_SPDIF(audio) | ||
816 | |||
817 | #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL | ||
818 | #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL | ||
819 | #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL | ||
820 | #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL | ||
821 | #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL | ||
822 | #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL | ||
823 | |||
824 | static const char *mux_pllp_pllc_pllm_clkm[] = { | ||
825 | "pll_p", "pll_c", "pll_m", "clk_m" | ||
826 | }; | ||
827 | #define mux_pllp_pllc_pllm_clkm_idx NULL | ||
828 | |||
829 | static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; | ||
830 | #define mux_pllp_pllc_pllm_idx NULL | ||
831 | |||
832 | static const char *mux_pllp_pllc_clk32_clkm[] = { | ||
833 | "pll_p", "pll_c", "clk_32k", "clk_m" | ||
834 | }; | ||
835 | #define mux_pllp_pllc_clk32_clkm_idx NULL | ||
836 | |||
837 | static const char *mux_plla_pllc_pllp_clkm[] = { | ||
838 | "pll_a_out0", "pll_c", "pll_p", "clk_m" | ||
839 | }; | ||
840 | #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx | ||
841 | |||
842 | static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { | ||
843 | "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" | ||
844 | }; | ||
845 | static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { | ||
846 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
847 | }; | ||
848 | |||
849 | static const char *mux_pllp_clkm[] = { | ||
850 | "pll_p", "clk_m" | ||
851 | }; | ||
852 | static u32 mux_pllp_clkm_idx[] = { | ||
853 | [0] = 0, [1] = 3, | ||
854 | }; | ||
855 | |||
856 | static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { | ||
857 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" | ||
858 | }; | ||
859 | #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx | ||
860 | |||
861 | static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { | ||
862 | "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", | ||
863 | "pll_d2_out0", "clk_m" | ||
864 | }; | ||
865 | #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL | ||
866 | |||
867 | static const char *mux_pllm_pllc_pllp_plla[] = { | ||
868 | "pll_m", "pll_c", "pll_p", "pll_a_out0" | ||
869 | }; | ||
870 | #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx | ||
871 | |||
872 | static const char *mux_pllp_pllc_clkm[] = { | ||
873 | "pll_p", "pll_c", "pll_m" | ||
874 | }; | ||
875 | static u32 mux_pllp_pllc_clkm_idx[] = { | ||
876 | [0] = 0, [1] = 1, [2] = 3, | ||
877 | }; | ||
878 | |||
879 | static const char *mux_pllp_pllc_clkm_clk32[] = { | ||
880 | "pll_p", "pll_c", "clk_m", "clk_32k" | ||
881 | }; | ||
882 | #define mux_pllp_pllc_clkm_clk32_idx NULL | ||
883 | |||
884 | static const char *mux_plla_clk32_pllp_clkm_plle[] = { | ||
885 | "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" | ||
886 | }; | ||
887 | #define mux_plla_clk32_pllp_clkm_plle_idx NULL | ||
888 | |||
889 | static const char *mux_clkm_pllp_pllc_pllre[] = { | ||
890 | "clk_m", "pll_p", "pll_c", "pll_re_out" | ||
891 | }; | ||
892 | static u32 mux_clkm_pllp_pllc_pllre_idx[] = { | ||
893 | [0] = 0, [1] = 1, [2] = 3, [3] = 5, | ||
894 | }; | ||
895 | |||
896 | static const char *mux_clkm_48M_pllp_480M[] = { | ||
897 | "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" | ||
898 | }; | ||
899 | #define mux_clkm_48M_pllp_480M_idx NULL | ||
900 | |||
901 | static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { | ||
902 | "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" | ||
903 | }; | ||
904 | static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { | ||
905 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, | ||
906 | }; | ||
907 | |||
908 | static const char *mux_plld_out0_plld2_out0[] = { | ||
909 | "pll_d_out0", "pll_d2_out0", | ||
910 | }; | ||
911 | #define mux_plld_out0_plld2_out0_idx NULL | ||
912 | |||
913 | static const char *mux_d_audio_clk[] = { | ||
914 | "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", | ||
915 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
916 | }; | ||
917 | static u32 mux_d_audio_clk_idx[] = { | ||
918 | [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, | ||
919 | [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, | ||
920 | }; | ||
921 | |||
922 | static const char *mux_pllmcp_clkm[] = { | ||
923 | "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", | ||
924 | }; | ||
925 | |||
926 | static const struct clk_div_table pll_re_div_table[] = { | ||
927 | { .val = 0, .div = 1 }, | ||
928 | { .val = 1, .div = 2 }, | ||
929 | { .val = 2, .div = 3 }, | ||
930 | { .val = 3, .div = 4 }, | ||
931 | { .val = 4, .div = 5 }, | ||
932 | { .val = 5, .div = 6 }, | ||
933 | { .val = 0, .div = 0 }, | ||
934 | }; | ||
935 | |||
936 | static struct clk *clks[clk_max]; | ||
937 | static struct clk_onecell_data clk_data; | ||
938 | |||
939 | static unsigned long osc_freq; | ||
940 | static unsigned long pll_ref_freq; | ||
941 | |||
942 | static int __init tegra114_osc_clk_init(void __iomem *clk_base) | ||
943 | { | ||
944 | struct clk *clk; | ||
945 | u32 val, pll_ref_div; | ||
946 | |||
947 | val = readl_relaxed(clk_base + OSC_CTRL); | ||
948 | |||
949 | osc_freq = tegra114_input_freq[val >> OSC_CTRL_OSC_FREQ_SHIFT]; | ||
950 | if (!osc_freq) { | ||
951 | WARN_ON(1); | ||
952 | return -EINVAL; | ||
953 | } | ||
954 | |||
955 | /* clk_m */ | ||
956 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, | ||
957 | osc_freq); | ||
958 | clk_register_clkdev(clk, "clk_m", NULL); | ||
959 | clks[clk_m] = clk; | ||
960 | |||
961 | /* pll_ref */ | ||
962 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; | ||
963 | pll_ref_div = 1 << val; | ||
964 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | ||
965 | CLK_SET_RATE_PARENT, 1, pll_ref_div); | ||
966 | clk_register_clkdev(clk, "pll_ref", NULL); | ||
967 | clks[pll_ref] = clk; | ||
968 | |||
969 | pll_ref_freq = osc_freq / pll_ref_div; | ||
970 | |||
971 | return 0; | ||
972 | } | ||
973 | |||
974 | static void __init tegra114_fixed_clk_init(void __iomem *clk_base) | ||
975 | { | ||
976 | struct clk *clk; | ||
977 | |||
978 | /* clk_32k */ | ||
979 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, | ||
980 | 32768); | ||
981 | clk_register_clkdev(clk, "clk_32k", NULL); | ||
982 | clks[clk_32k] = clk; | ||
983 | |||
984 | /* clk_m_div2 */ | ||
985 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", | ||
986 | CLK_SET_RATE_PARENT, 1, 2); | ||
987 | clk_register_clkdev(clk, "clk_m_div2", NULL); | ||
988 | clks[clk_m_div2] = clk; | ||
989 | |||
990 | /* clk_m_div4 */ | ||
991 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", | ||
992 | CLK_SET_RATE_PARENT, 1, 4); | ||
993 | clk_register_clkdev(clk, "clk_m_div4", NULL); | ||
994 | clks[clk_m_div4] = clk; | ||
995 | |||
996 | } | ||
997 | |||
998 | static __init void tegra114_utmi_param_configure(void __iomem *clk_base) | ||
999 | { | ||
1000 | u32 reg; | ||
1001 | int i; | ||
1002 | |||
1003 | for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) { | ||
1004 | if (osc_freq == utmi_parameters[i].osc_frequency) | ||
1005 | break; | ||
1006 | } | ||
1007 | |||
1008 | if (i >= ARRAY_SIZE(utmi_parameters)) { | ||
1009 | pr_err("%s: Unexpected oscillator freq %lu\n", __func__, | ||
1010 | osc_freq); | ||
1011 | return; | ||
1012 | } | ||
1013 | |||
1014 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2); | ||
1015 | |||
1016 | /* Program UTMIP PLL stable and active counts */ | ||
1017 | /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */ | ||
1018 | reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0); | ||
1019 | reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count); | ||
1020 | |||
1021 | reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0); | ||
1022 | |||
1023 | reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i]. | ||
1024 | active_delay_count); | ||
1025 | |||
1026 | /* Remove power downs from UTMIP PLL control bits */ | ||
1027 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN; | ||
1028 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN; | ||
1029 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN; | ||
1030 | |||
1031 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2); | ||
1032 | |||
1033 | /* Program UTMIP PLL delay and oscillator frequency counts */ | ||
1034 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1035 | reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0); | ||
1036 | |||
1037 | reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i]. | ||
1038 | enable_delay_count); | ||
1039 | |||
1040 | reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0); | ||
1041 | reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i]. | ||
1042 | xtal_freq_count); | ||
1043 | |||
1044 | /* Remove power downs from UTMIP PLL control bits */ | ||
1045 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1046 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN; | ||
1047 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP; | ||
1048 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN; | ||
1049 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1050 | |||
1051 | /* Setup HW control of UTMIPLL */ | ||
1052 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1053 | reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET; | ||
1054 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL; | ||
1055 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE; | ||
1056 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1057 | |||
1058 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1059 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP; | ||
1060 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1061 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1062 | |||
1063 | udelay(1); | ||
1064 | |||
1065 | /* Setup SW override of UTMIPLL assuming USB2.0 | ||
1066 | ports are assigned to USB2 */ | ||
1067 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1068 | reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL; | ||
1069 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE; | ||
1070 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1071 | |||
1072 | udelay(1); | ||
1073 | |||
1074 | /* Enable HW control UTMIPLL */ | ||
1075 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1076 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE; | ||
1077 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1078 | } | ||
1079 | |||
1080 | static void __init _clip_vco_min(struct tegra_clk_pll_params *pll_params) | ||
1081 | { | ||
1082 | pll_params->vco_min = | ||
1083 | DIV_ROUND_UP(pll_params->vco_min, pll_ref_freq) * pll_ref_freq; | ||
1084 | } | ||
1085 | |||
1086 | static int __init _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params, | ||
1087 | void __iomem *clk_base) | ||
1088 | { | ||
1089 | u32 val; | ||
1090 | u32 step_a, step_b; | ||
1091 | |||
1092 | switch (pll_ref_freq) { | ||
1093 | case 12000000: | ||
1094 | case 13000000: | ||
1095 | case 26000000: | ||
1096 | step_a = 0x2B; | ||
1097 | step_b = 0x0B; | ||
1098 | break; | ||
1099 | case 16800000: | ||
1100 | step_a = 0x1A; | ||
1101 | step_b = 0x09; | ||
1102 | break; | ||
1103 | case 19200000: | ||
1104 | step_a = 0x12; | ||
1105 | step_b = 0x08; | ||
1106 | break; | ||
1107 | default: | ||
1108 | pr_err("%s: Unexpected reference rate %lu\n", | ||
1109 | __func__, pll_ref_freq); | ||
1110 | WARN_ON(1); | ||
1111 | return -EINVAL; | ||
1112 | } | ||
1113 | |||
1114 | val = step_a << pll_params->stepa_shift; | ||
1115 | val |= step_b << pll_params->stepb_shift; | ||
1116 | writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg); | ||
1117 | |||
1118 | return 0; | ||
1119 | } | ||
1120 | |||
1121 | static void __init _init_iddq(struct tegra_clk_pll_params *pll_params, | ||
1122 | void __iomem *clk_base) | ||
1123 | { | ||
1124 | u32 val, val_iddq; | ||
1125 | |||
1126 | val = readl_relaxed(clk_base + pll_params->base_reg); | ||
1127 | val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg); | ||
1128 | |||
1129 | if (val & BIT(30)) | ||
1130 | WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx)); | ||
1131 | else { | ||
1132 | val_iddq |= BIT(pll_params->iddq_bit_idx); | ||
1133 | writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | static void __init tegra114_pll_init(void __iomem *clk_base, | ||
1138 | void __iomem *pmc) | ||
1139 | { | ||
1140 | u32 val; | ||
1141 | struct clk *clk; | ||
1142 | |||
1143 | /* PLLC */ | ||
1144 | _clip_vco_min(&pll_c_params); | ||
1145 | if (_setup_dynamic_ramp(&pll_c_params, clk_base) >= 0) { | ||
1146 | _init_iddq(&pll_c_params, clk_base); | ||
1147 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, | ||
1148 | pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK, | ||
1149 | pll_c_freq_table, NULL); | ||
1150 | clk_register_clkdev(clk, "pll_c", NULL); | ||
1151 | clks[pll_c] = clk; | ||
1152 | |||
1153 | /* PLLC_OUT1 */ | ||
1154 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | ||
1155 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1156 | 8, 8, 1, NULL); | ||
1157 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | ||
1158 | clk_base + PLLC_OUT, 1, 0, | ||
1159 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1160 | clk_register_clkdev(clk, "pll_c_out1", NULL); | ||
1161 | clks[pll_c_out1] = clk; | ||
1162 | } | ||
1163 | |||
1164 | /* PLLC2 */ | ||
1165 | _clip_vco_min(&pll_c2_params); | ||
1166 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0, | ||
1167 | &pll_c2_params, TEGRA_PLL_USE_LOCK, | ||
1168 | pll_cx_freq_table, NULL); | ||
1169 | clk_register_clkdev(clk, "pll_c2", NULL); | ||
1170 | clks[pll_c2] = clk; | ||
1171 | |||
1172 | /* PLLC3 */ | ||
1173 | _clip_vco_min(&pll_c3_params); | ||
1174 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0, | ||
1175 | &pll_c3_params, TEGRA_PLL_USE_LOCK, | ||
1176 | pll_cx_freq_table, NULL); | ||
1177 | clk_register_clkdev(clk, "pll_c3", NULL); | ||
1178 | clks[pll_c3] = clk; | ||
1179 | |||
1180 | /* PLLP */ | ||
1181 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0, | ||
1182 | 408000000, &pll_p_params, | ||
1183 | TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, | ||
1184 | pll_p_freq_table, NULL); | ||
1185 | clk_register_clkdev(clk, "pll_p", NULL); | ||
1186 | clks[pll_p] = clk; | ||
1187 | |||
1188 | /* PLLP_OUT1 */ | ||
1189 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", | ||
1190 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1191 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1192 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", | ||
1193 | clk_base + PLLP_OUTA, 1, 0, | ||
1194 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1195 | &pll_div_lock); | ||
1196 | clk_register_clkdev(clk, "pll_p_out1", NULL); | ||
1197 | clks[pll_p_out1] = clk; | ||
1198 | |||
1199 | /* PLLP_OUT2 */ | ||
1200 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", | ||
1201 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1202 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
1203 | &pll_div_lock); | ||
1204 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", | ||
1205 | clk_base + PLLP_OUTA, 17, 16, | ||
1206 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1207 | &pll_div_lock); | ||
1208 | clk_register_clkdev(clk, "pll_p_out2", NULL); | ||
1209 | clks[pll_p_out2] = clk; | ||
1210 | |||
1211 | /* PLLP_OUT3 */ | ||
1212 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", | ||
1213 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1214 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1215 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", | ||
1216 | clk_base + PLLP_OUTB, 1, 0, | ||
1217 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1218 | &pll_div_lock); | ||
1219 | clk_register_clkdev(clk, "pll_p_out3", NULL); | ||
1220 | clks[pll_p_out3] = clk; | ||
1221 | |||
1222 | /* PLLP_OUT4 */ | ||
1223 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", | ||
1224 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1225 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
1226 | &pll_div_lock); | ||
1227 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", | ||
1228 | clk_base + PLLP_OUTB, 17, 16, | ||
1229 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1230 | &pll_div_lock); | ||
1231 | clk_register_clkdev(clk, "pll_p_out4", NULL); | ||
1232 | clks[pll_p_out4] = clk; | ||
1233 | |||
1234 | /* PLLM */ | ||
1235 | _clip_vco_min(&pll_m_params); | ||
1236 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, | ||
1237 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, | ||
1238 | &pll_m_params, TEGRA_PLL_USE_LOCK, | ||
1239 | pll_m_freq_table, NULL); | ||
1240 | clk_register_clkdev(clk, "pll_m", NULL); | ||
1241 | clks[pll_m] = clk; | ||
1242 | |||
1243 | /* PLLM_OUT1 */ | ||
1244 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | ||
1245 | clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1246 | 8, 8, 1, NULL); | ||
1247 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | ||
1248 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1249 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1250 | clk_register_clkdev(clk, "pll_m_out1", NULL); | ||
1251 | clks[pll_m_out1] = clk; | ||
1252 | |||
1253 | /* PLLM_UD */ | ||
1254 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", | ||
1255 | CLK_SET_RATE_PARENT, 1, 1); | ||
1256 | |||
1257 | /* PLLX */ | ||
1258 | _clip_vco_min(&pll_x_params); | ||
1259 | if (_setup_dynamic_ramp(&pll_x_params, clk_base) >= 0) { | ||
1260 | _init_iddq(&pll_x_params, clk_base); | ||
1261 | clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, | ||
1262 | pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params, | ||
1263 | TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL); | ||
1264 | clk_register_clkdev(clk, "pll_x", NULL); | ||
1265 | clks[pll_x] = clk; | ||
1266 | } | ||
1267 | |||
1268 | /* PLLX_OUT0 */ | ||
1269 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", | ||
1270 | CLK_SET_RATE_PARENT, 1, 2); | ||
1271 | clk_register_clkdev(clk, "pll_x_out0", NULL); | ||
1272 | clks[pll_x_out0] = clk; | ||
1273 | |||
1274 | /* PLLU */ | ||
1275 | val = readl(clk_base + pll_u_params.base_reg); | ||
1276 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ | ||
1277 | writel(val, clk_base + pll_u_params.base_reg); | ||
1278 | |||
1279 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, | ||
1280 | 0, &pll_u_params, TEGRA_PLLU | | ||
1281 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1282 | TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock); | ||
1283 | clk_register_clkdev(clk, "pll_u", NULL); | ||
1284 | clks[pll_u] = clk; | ||
1285 | |||
1286 | tegra114_utmi_param_configure(clk_base); | ||
1287 | |||
1288 | /* PLLU_480M */ | ||
1289 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", | ||
1290 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, | ||
1291 | 22, 0, &pll_u_lock); | ||
1292 | clk_register_clkdev(clk, "pll_u_480M", NULL); | ||
1293 | clks[pll_u_480M] = clk; | ||
1294 | |||
1295 | /* PLLU_60M */ | ||
1296 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", | ||
1297 | CLK_SET_RATE_PARENT, 1, 8); | ||
1298 | clk_register_clkdev(clk, "pll_u_60M", NULL); | ||
1299 | clks[pll_u_60M] = clk; | ||
1300 | |||
1301 | /* PLLU_48M */ | ||
1302 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", | ||
1303 | CLK_SET_RATE_PARENT, 1, 10); | ||
1304 | clk_register_clkdev(clk, "pll_u_48M", NULL); | ||
1305 | clks[pll_u_48M] = clk; | ||
1306 | |||
1307 | /* PLLU_12M */ | ||
1308 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", | ||
1309 | CLK_SET_RATE_PARENT, 1, 40); | ||
1310 | clk_register_clkdev(clk, "pll_u_12M", NULL); | ||
1311 | clks[pll_u_12M] = clk; | ||
1312 | |||
1313 | /* PLLD */ | ||
1314 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, | ||
1315 | 0, &pll_d_params, | ||
1316 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1317 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock); | ||
1318 | clk_register_clkdev(clk, "pll_d", NULL); | ||
1319 | clks[pll_d] = clk; | ||
1320 | |||
1321 | /* PLLD_OUT0 */ | ||
1322 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | ||
1323 | CLK_SET_RATE_PARENT, 1, 2); | ||
1324 | clk_register_clkdev(clk, "pll_d_out0", NULL); | ||
1325 | clks[pll_d_out0] = clk; | ||
1326 | |||
1327 | /* PLLD2 */ | ||
1328 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, | ||
1329 | 0, &pll_d2_params, | ||
1330 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1331 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock); | ||
1332 | clk_register_clkdev(clk, "pll_d2", NULL); | ||
1333 | clks[pll_d2] = clk; | ||
1334 | |||
1335 | /* PLLD2_OUT0 */ | ||
1336 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | ||
1337 | CLK_SET_RATE_PARENT, 1, 2); | ||
1338 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | ||
1339 | clks[pll_d2_out0] = clk; | ||
1340 | |||
1341 | /* PLLA */ | ||
1342 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0, | ||
1343 | 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | | ||
1344 | TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); | ||
1345 | clk_register_clkdev(clk, "pll_a", NULL); | ||
1346 | clks[pll_a] = clk; | ||
1347 | |||
1348 | /* PLLA_OUT0 */ | ||
1349 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | ||
1350 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1351 | 8, 8, 1, NULL); | ||
1352 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | ||
1353 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1354 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1355 | clk_register_clkdev(clk, "pll_a_out0", NULL); | ||
1356 | clks[pll_a_out0] = clk; | ||
1357 | |||
1358 | /* PLLRE */ | ||
1359 | _clip_vco_min(&pll_re_vco_params); | ||
1360 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, | ||
1361 | 0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK, | ||
1362 | NULL, &pll_re_lock, pll_ref_freq); | ||
1363 | clk_register_clkdev(clk, "pll_re_vco", NULL); | ||
1364 | clks[pll_re_vco] = clk; | ||
1365 | |||
1366 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, | ||
1367 | clk_base + PLLRE_BASE, 16, 4, 0, | ||
1368 | pll_re_div_table, &pll_re_lock); | ||
1369 | clk_register_clkdev(clk, "pll_re_out", NULL); | ||
1370 | clks[pll_re_out] = clk; | ||
1371 | |||
1372 | /* PLLE */ | ||
1373 | clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco", | ||
1374 | clk_base, 0, 100000000, &pll_e_params, | ||
1375 | pll_e_freq_table, NULL); | ||
1376 | clk_register_clkdev(clk, "pll_e_out0", NULL); | ||
1377 | clks[pll_e_out0] = clk; | ||
1378 | } | ||
1379 | |||
1380 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", | ||
1381 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
1382 | }; | ||
1383 | |||
1384 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", | ||
1385 | "clk_m_div4", "extern1", | ||
1386 | }; | ||
1387 | |||
1388 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", | ||
1389 | "clk_m_div4", "extern2", | ||
1390 | }; | ||
1391 | |||
1392 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", | ||
1393 | "clk_m_div4", "extern3", | ||
1394 | }; | ||
1395 | |||
1396 | static void __init tegra114_audio_clk_init(void __iomem *clk_base) | ||
1397 | { | ||
1398 | struct clk *clk; | ||
1399 | |||
1400 | /* spdif_in_sync */ | ||
1401 | clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, | ||
1402 | 24000000); | ||
1403 | clk_register_clkdev(clk, "spdif_in_sync", NULL); | ||
1404 | clks[spdif_in_sync] = clk; | ||
1405 | |||
1406 | /* i2s0_sync */ | ||
1407 | clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); | ||
1408 | clk_register_clkdev(clk, "i2s0_sync", NULL); | ||
1409 | clks[i2s0_sync] = clk; | ||
1410 | |||
1411 | /* i2s1_sync */ | ||
1412 | clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); | ||
1413 | clk_register_clkdev(clk, "i2s1_sync", NULL); | ||
1414 | clks[i2s1_sync] = clk; | ||
1415 | |||
1416 | /* i2s2_sync */ | ||
1417 | clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); | ||
1418 | clk_register_clkdev(clk, "i2s2_sync", NULL); | ||
1419 | clks[i2s2_sync] = clk; | ||
1420 | |||
1421 | /* i2s3_sync */ | ||
1422 | clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); | ||
1423 | clk_register_clkdev(clk, "i2s3_sync", NULL); | ||
1424 | clks[i2s3_sync] = clk; | ||
1425 | |||
1426 | /* i2s4_sync */ | ||
1427 | clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); | ||
1428 | clk_register_clkdev(clk, "i2s4_sync", NULL); | ||
1429 | clks[i2s4_sync] = clk; | ||
1430 | |||
1431 | /* vimclk_sync */ | ||
1432 | clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); | ||
1433 | clk_register_clkdev(clk, "vimclk_sync", NULL); | ||
1434 | clks[vimclk_sync] = clk; | ||
1435 | |||
1436 | /* audio0 */ | ||
1437 | clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, | ||
1438 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1439 | clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, | ||
1440 | NULL); | ||
1441 | clks[audio0_mux] = clk; | ||
1442 | clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, | ||
1443 | clk_base + AUDIO_SYNC_CLK_I2S0, 4, | ||
1444 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1445 | clk_register_clkdev(clk, "audio0", NULL); | ||
1446 | clks[audio0] = clk; | ||
1447 | |||
1448 | /* audio1 */ | ||
1449 | clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, | ||
1450 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1451 | clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, | ||
1452 | NULL); | ||
1453 | clks[audio1_mux] = clk; | ||
1454 | clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, | ||
1455 | clk_base + AUDIO_SYNC_CLK_I2S1, 4, | ||
1456 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1457 | clk_register_clkdev(clk, "audio1", NULL); | ||
1458 | clks[audio1] = clk; | ||
1459 | |||
1460 | /* audio2 */ | ||
1461 | clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, | ||
1462 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1463 | clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, | ||
1464 | NULL); | ||
1465 | clks[audio2_mux] = clk; | ||
1466 | clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, | ||
1467 | clk_base + AUDIO_SYNC_CLK_I2S2, 4, | ||
1468 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1469 | clk_register_clkdev(clk, "audio2", NULL); | ||
1470 | clks[audio2] = clk; | ||
1471 | |||
1472 | /* audio3 */ | ||
1473 | clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, | ||
1474 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1475 | clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, | ||
1476 | NULL); | ||
1477 | clks[audio3_mux] = clk; | ||
1478 | clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, | ||
1479 | clk_base + AUDIO_SYNC_CLK_I2S3, 4, | ||
1480 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1481 | clk_register_clkdev(clk, "audio3", NULL); | ||
1482 | clks[audio3] = clk; | ||
1483 | |||
1484 | /* audio4 */ | ||
1485 | clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, | ||
1486 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1487 | clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, | ||
1488 | NULL); | ||
1489 | clks[audio4_mux] = clk; | ||
1490 | clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, | ||
1491 | clk_base + AUDIO_SYNC_CLK_I2S4, 4, | ||
1492 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1493 | clk_register_clkdev(clk, "audio4", NULL); | ||
1494 | clks[audio4] = clk; | ||
1495 | |||
1496 | /* spdif */ | ||
1497 | clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, | ||
1498 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1499 | clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, | ||
1500 | NULL); | ||
1501 | clks[spdif_mux] = clk; | ||
1502 | clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, | ||
1503 | clk_base + AUDIO_SYNC_CLK_SPDIF, 4, | ||
1504 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1505 | clk_register_clkdev(clk, "spdif", NULL); | ||
1506 | clks[spdif] = clk; | ||
1507 | |||
1508 | /* audio0_2x */ | ||
1509 | clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", | ||
1510 | CLK_SET_RATE_PARENT, 2, 1); | ||
1511 | clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", | ||
1512 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, | ||
1513 | 0, &clk_doubler_lock); | ||
1514 | clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", | ||
1515 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1516 | CLK_SET_RATE_PARENT, 113, &periph_v_regs, | ||
1517 | periph_clk_enb_refcnt); | ||
1518 | clk_register_clkdev(clk, "audio0_2x", NULL); | ||
1519 | clks[audio0_2x] = clk; | ||
1520 | |||
1521 | /* audio1_2x */ | ||
1522 | clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", | ||
1523 | CLK_SET_RATE_PARENT, 2, 1); | ||
1524 | clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", | ||
1525 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, | ||
1526 | 0, &clk_doubler_lock); | ||
1527 | clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", | ||
1528 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1529 | CLK_SET_RATE_PARENT, 114, &periph_v_regs, | ||
1530 | periph_clk_enb_refcnt); | ||
1531 | clk_register_clkdev(clk, "audio1_2x", NULL); | ||
1532 | clks[audio1_2x] = clk; | ||
1533 | |||
1534 | /* audio2_2x */ | ||
1535 | clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", | ||
1536 | CLK_SET_RATE_PARENT, 2, 1); | ||
1537 | clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", | ||
1538 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, | ||
1539 | 0, &clk_doubler_lock); | ||
1540 | clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", | ||
1541 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1542 | CLK_SET_RATE_PARENT, 115, &periph_v_regs, | ||
1543 | periph_clk_enb_refcnt); | ||
1544 | clk_register_clkdev(clk, "audio2_2x", NULL); | ||
1545 | clks[audio2_2x] = clk; | ||
1546 | |||
1547 | /* audio3_2x */ | ||
1548 | clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", | ||
1549 | CLK_SET_RATE_PARENT, 2, 1); | ||
1550 | clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", | ||
1551 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, | ||
1552 | 0, &clk_doubler_lock); | ||
1553 | clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", | ||
1554 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1555 | CLK_SET_RATE_PARENT, 116, &periph_v_regs, | ||
1556 | periph_clk_enb_refcnt); | ||
1557 | clk_register_clkdev(clk, "audio3_2x", NULL); | ||
1558 | clks[audio3_2x] = clk; | ||
1559 | |||
1560 | /* audio4_2x */ | ||
1561 | clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", | ||
1562 | CLK_SET_RATE_PARENT, 2, 1); | ||
1563 | clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", | ||
1564 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, | ||
1565 | 0, &clk_doubler_lock); | ||
1566 | clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", | ||
1567 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1568 | CLK_SET_RATE_PARENT, 117, &periph_v_regs, | ||
1569 | periph_clk_enb_refcnt); | ||
1570 | clk_register_clkdev(clk, "audio4_2x", NULL); | ||
1571 | clks[audio4_2x] = clk; | ||
1572 | |||
1573 | /* spdif_2x */ | ||
1574 | clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", | ||
1575 | CLK_SET_RATE_PARENT, 2, 1); | ||
1576 | clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", | ||
1577 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, | ||
1578 | 0, &clk_doubler_lock); | ||
1579 | clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", | ||
1580 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1581 | CLK_SET_RATE_PARENT, 118, | ||
1582 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1583 | clk_register_clkdev(clk, "spdif_2x", NULL); | ||
1584 | clks[spdif_2x] = clk; | ||
1585 | } | ||
1586 | |||
1587 | static void __init tegra114_pmc_clk_init(void __iomem *pmc_base) | ||
1588 | { | ||
1589 | struct clk *clk; | ||
1590 | |||
1591 | /* clk_out_1 */ | ||
1592 | clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, | ||
1593 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1594 | pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, | ||
1595 | &clk_out_lock); | ||
1596 | clks[clk_out_1_mux] = clk; | ||
1597 | clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, | ||
1598 | pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, | ||
1599 | &clk_out_lock); | ||
1600 | clk_register_clkdev(clk, "extern1", "clk_out_1"); | ||
1601 | clks[clk_out_1] = clk; | ||
1602 | |||
1603 | /* clk_out_2 */ | ||
1604 | clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, | ||
1605 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1606 | pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, | ||
1607 | &clk_out_lock); | ||
1608 | clks[clk_out_2_mux] = clk; | ||
1609 | clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, | ||
1610 | pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, | ||
1611 | &clk_out_lock); | ||
1612 | clk_register_clkdev(clk, "extern2", "clk_out_2"); | ||
1613 | clks[clk_out_2] = clk; | ||
1614 | |||
1615 | /* clk_out_3 */ | ||
1616 | clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, | ||
1617 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1618 | pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, | ||
1619 | &clk_out_lock); | ||
1620 | clks[clk_out_3_mux] = clk; | ||
1621 | clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, | ||
1622 | pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, | ||
1623 | &clk_out_lock); | ||
1624 | clk_register_clkdev(clk, "extern3", "clk_out_3"); | ||
1625 | clks[clk_out_3] = clk; | ||
1626 | |||
1627 | /* blink */ | ||
1628 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
1629 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
1630 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
1631 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
1632 | pmc_base + PMC_CTRL, | ||
1633 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
1634 | clk_register_clkdev(clk, "blink", NULL); | ||
1635 | clks[blink] = clk; | ||
1636 | |||
1637 | } | ||
1638 | |||
1639 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", | ||
1640 | "pll_p_out3", "pll_p_out2", "unused", | ||
1641 | "clk_32k", "pll_m_out1" }; | ||
1642 | |||
1643 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1644 | "pll_p", "pll_p_out4", "unused", | ||
1645 | "unused", "pll_x" }; | ||
1646 | |||
1647 | static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1648 | "pll_p", "pll_p_out4", "unused", | ||
1649 | "unused", "pll_x", "pll_x_out0" }; | ||
1650 | |||
1651 | static void __init tegra114_super_clk_init(void __iomem *clk_base) | ||
1652 | { | ||
1653 | struct clk *clk; | ||
1654 | |||
1655 | /* CCLKG */ | ||
1656 | clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, | ||
1657 | ARRAY_SIZE(cclk_g_parents), | ||
1658 | CLK_SET_RATE_PARENT, | ||
1659 | clk_base + CCLKG_BURST_POLICY, | ||
1660 | 0, 4, 0, 0, NULL); | ||
1661 | clk_register_clkdev(clk, "cclk_g", NULL); | ||
1662 | clks[cclk_g] = clk; | ||
1663 | |||
1664 | /* CCLKLP */ | ||
1665 | clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, | ||
1666 | ARRAY_SIZE(cclk_lp_parents), | ||
1667 | CLK_SET_RATE_PARENT, | ||
1668 | clk_base + CCLKLP_BURST_POLICY, | ||
1669 | 0, 4, 8, 9, NULL); | ||
1670 | clk_register_clkdev(clk, "cclk_lp", NULL); | ||
1671 | clks[cclk_lp] = clk; | ||
1672 | |||
1673 | /* SCLK */ | ||
1674 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | ||
1675 | ARRAY_SIZE(sclk_parents), | ||
1676 | CLK_SET_RATE_PARENT, | ||
1677 | clk_base + SCLK_BURST_POLICY, | ||
1678 | 0, 4, 0, 0, NULL); | ||
1679 | clk_register_clkdev(clk, "sclk", NULL); | ||
1680 | clks[sclk] = clk; | ||
1681 | |||
1682 | /* HCLK */ | ||
1683 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
1684 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, | ||
1685 | &sysrate_lock); | ||
1686 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT | | ||
1687 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1688 | 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1689 | clk_register_clkdev(clk, "hclk", NULL); | ||
1690 | clks[hclk] = clk; | ||
1691 | |||
1692 | /* PCLK */ | ||
1693 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
1694 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, | ||
1695 | &sysrate_lock); | ||
1696 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | | ||
1697 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1698 | 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1699 | clk_register_clkdev(clk, "pclk", NULL); | ||
1700 | clks[pclk] = clk; | ||
1701 | } | ||
1702 | |||
1703 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { | ||
1704 | 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), | ||
1705 | 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), | ||
1706 | 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), | ||
1707 | 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), | ||
1708 | 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), | ||
1709 | 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), | ||
1710 | 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), | ||
1711 | TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, &periph_l_regs, TEGRA_PERIPH_ON_APB, pwm), | ||
1712 | TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, &periph_w_regs, TEGRA_PERIPH_ON_APB, adx), | ||
1713 | TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, &periph_w_regs, TEGRA_PERIPH_ON_APB, amx), | ||
1714 | 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), | ||
1715 | 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), | ||
1716 | 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), | ||
1717 | 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), | ||
1718 | 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), | ||
1719 | 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), | ||
1720 | 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), | ||
1721 | 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), | ||
1722 | 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), | ||
1723 | 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), | ||
1724 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), | ||
1725 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), | ||
1726 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), | ||
1727 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), | ||
1728 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), | ||
1729 | TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), | ||
1730 | 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), | ||
1731 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la), | ||
1732 | TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, &periph_u_regs, TEGRA_PERIPH_ON_APB, trace), | ||
1733 | 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), | ||
1734 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), | ||
1735 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), | ||
1736 | TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, i2c1), | ||
1737 | TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, i2c2), | ||
1738 | TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, i2c3), | ||
1739 | TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, i2c4), | ||
1740 | TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, i2c5), | ||
1741 | TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta), | ||
1742 | TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb), | ||
1743 | TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc), | ||
1744 | TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd), | ||
1745 | TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, &periph_l_regs, 0, gr_3d), | ||
1746 | TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr_2d), | ||
1747 | 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), | ||
1748 | TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), | ||
1749 | TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), | ||
1750 | TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, &periph_h_regs, TEGRA_PERIPH_WAR_1005168, msenc), | ||
1751 | TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, &periph_u_regs, 0, tsec), | ||
1752 | TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), | ||
1753 | TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), | ||
1754 | TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, &periph_w_regs, 0, cilab), | ||
1755 | TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, &periph_w_regs, 0, cilcd), | ||
1756 | TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, &periph_w_regs, 0, cile), | ||
1757 | TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, &periph_w_regs, 0, dsialp), | ||
1758 | TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, &periph_w_regs, 0, dsiblp), | ||
1759 | 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), | ||
1760 | TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon), | ||
1761 | TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1), | ||
1762 | TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2), | ||
1763 | TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3), | ||
1764 | TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow), | ||
1765 | 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), | ||
1766 | TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect, CLK_IGNORE_UNUSED), | ||
1767 | 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), | ||
1768 | 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), | ||
1769 | 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), | ||
1770 | 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), | ||
1771 | 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), | ||
1772 | 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), | ||
1773 | TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, TEGRA_PERIPH_ON_APB, d_audio), | ||
1774 | TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam0), | ||
1775 | TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam1), | ||
1776 | TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam2), | ||
1777 | }; | ||
1778 | |||
1779 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { | ||
1780 | 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), | ||
1781 | 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), | ||
1782 | }; | ||
1783 | |||
1784 | static __init void tegra114_periph_clk_init(void __iomem *clk_base) | ||
1785 | { | ||
1786 | struct tegra_periph_init_data *data; | ||
1787 | struct clk *clk; | ||
1788 | int i; | ||
1789 | u32 val; | ||
1790 | |||
1791 | /* apbdma */ | ||
1792 | clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, | ||
1793 | 0, 34, &periph_h_regs, | ||
1794 | periph_clk_enb_refcnt); | ||
1795 | clks[apbdma] = clk; | ||
1796 | |||
1797 | /* rtc */ | ||
1798 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", | ||
1799 | TEGRA_PERIPH_ON_APB | | ||
1800 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1801 | 0, 4, &periph_l_regs, | ||
1802 | periph_clk_enb_refcnt); | ||
1803 | clk_register_clkdev(clk, NULL, "rtc-tegra"); | ||
1804 | clks[rtc] = clk; | ||
1805 | |||
1806 | /* kbc */ | ||
1807 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", | ||
1808 | TEGRA_PERIPH_ON_APB | | ||
1809 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1810 | 0, 36, &periph_h_regs, | ||
1811 | periph_clk_enb_refcnt); | ||
1812 | clks[kbc] = clk; | ||
1813 | |||
1814 | /* timer */ | ||
1815 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, | ||
1816 | 0, 5, &periph_l_regs, | ||
1817 | periph_clk_enb_refcnt); | ||
1818 | clk_register_clkdev(clk, NULL, "timer"); | ||
1819 | clks[timer] = clk; | ||
1820 | |||
1821 | /* kfuse */ | ||
1822 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | ||
1823 | TEGRA_PERIPH_ON_APB, clk_base, 0, 40, | ||
1824 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1825 | clks[kfuse] = clk; | ||
1826 | |||
1827 | /* fuse */ | ||
1828 | clk = tegra_clk_register_periph_gate("fuse", "clk_m", | ||
1829 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1830 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1831 | clks[fuse] = clk; | ||
1832 | |||
1833 | /* fuse_burn */ | ||
1834 | clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", | ||
1835 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1836 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1837 | clks[fuse_burn] = clk; | ||
1838 | |||
1839 | /* apbif */ | ||
1840 | clk = tegra_clk_register_periph_gate("apbif", "clk_m", | ||
1841 | TEGRA_PERIPH_ON_APB, clk_base, 0, 107, | ||
1842 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1843 | clks[apbif] = clk; | ||
1844 | |||
1845 | /* hda2hdmi */ | ||
1846 | clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", | ||
1847 | TEGRA_PERIPH_ON_APB, clk_base, 0, 128, | ||
1848 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1849 | clks[hda2hdmi] = clk; | ||
1850 | |||
1851 | /* vcp */ | ||
1852 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, | ||
1853 | 29, &periph_l_regs, | ||
1854 | periph_clk_enb_refcnt); | ||
1855 | clks[vcp] = clk; | ||
1856 | |||
1857 | /* bsea */ | ||
1858 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, | ||
1859 | 0, 62, &periph_h_regs, | ||
1860 | periph_clk_enb_refcnt); | ||
1861 | clks[bsea] = clk; | ||
1862 | |||
1863 | /* bsev */ | ||
1864 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, | ||
1865 | 0, 63, &periph_h_regs, | ||
1866 | periph_clk_enb_refcnt); | ||
1867 | clks[bsev] = clk; | ||
1868 | |||
1869 | /* mipi-cal */ | ||
1870 | clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base, | ||
1871 | 0, 56, &periph_h_regs, | ||
1872 | periph_clk_enb_refcnt); | ||
1873 | clks[mipi_cal] = clk; | ||
1874 | |||
1875 | /* usbd */ | ||
1876 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, | ||
1877 | 0, 22, &periph_l_regs, | ||
1878 | periph_clk_enb_refcnt); | ||
1879 | clks[usbd] = clk; | ||
1880 | |||
1881 | /* usb2 */ | ||
1882 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, | ||
1883 | 0, 58, &periph_h_regs, | ||
1884 | periph_clk_enb_refcnt); | ||
1885 | clks[usb2] = clk; | ||
1886 | |||
1887 | /* usb3 */ | ||
1888 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, | ||
1889 | 0, 59, &periph_h_regs, | ||
1890 | periph_clk_enb_refcnt); | ||
1891 | clks[usb3] = clk; | ||
1892 | |||
1893 | /* csi */ | ||
1894 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, | ||
1895 | 0, 52, &periph_h_regs, | ||
1896 | periph_clk_enb_refcnt); | ||
1897 | clks[csi] = clk; | ||
1898 | |||
1899 | /* isp */ | ||
1900 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, | ||
1901 | 23, &periph_l_regs, | ||
1902 | periph_clk_enb_refcnt); | ||
1903 | clks[isp] = clk; | ||
1904 | |||
1905 | /* csus */ | ||
1906 | clk = tegra_clk_register_periph_gate("csus", "clk_m", | ||
1907 | TEGRA_PERIPH_NO_RESET, clk_base, 0, 92, | ||
1908 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1909 | clks[csus] = clk; | ||
1910 | |||
1911 | /* dds */ | ||
1912 | clk = tegra_clk_register_periph_gate("dds", "clk_m", | ||
1913 | TEGRA_PERIPH_ON_APB, clk_base, 0, 150, | ||
1914 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1915 | clks[dds] = clk; | ||
1916 | |||
1917 | /* dp2 */ | ||
1918 | clk = tegra_clk_register_periph_gate("dp2", "clk_m", | ||
1919 | TEGRA_PERIPH_ON_APB, clk_base, 0, 152, | ||
1920 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1921 | clks[dp2] = clk; | ||
1922 | |||
1923 | /* dtv */ | ||
1924 | clk = tegra_clk_register_periph_gate("dtv", "clk_m", | ||
1925 | TEGRA_PERIPH_ON_APB, clk_base, 0, 79, | ||
1926 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1927 | clks[dtv] = clk; | ||
1928 | |||
1929 | /* dsia */ | ||
1930 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, | ||
1931 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1932 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); | ||
1933 | clks[dsia_mux] = clk; | ||
1934 | clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, | ||
1935 | 0, 48, &periph_h_regs, | ||
1936 | periph_clk_enb_refcnt); | ||
1937 | clks[dsia] = clk; | ||
1938 | |||
1939 | /* dsib */ | ||
1940 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, | ||
1941 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1942 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); | ||
1943 | clks[dsib_mux] = clk; | ||
1944 | clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, | ||
1945 | 0, 82, &periph_u_regs, | ||
1946 | periph_clk_enb_refcnt); | ||
1947 | clks[dsib] = clk; | ||
1948 | |||
1949 | /* xusb_hs_src */ | ||
1950 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1951 | val |= BIT(25); /* always select PLLU_60M */ | ||
1952 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1953 | |||
1954 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, | ||
1955 | 1, 1); | ||
1956 | clks[xusb_hs_src] = clk; | ||
1957 | |||
1958 | /* xusb_host */ | ||
1959 | clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0, | ||
1960 | clk_base, 0, 89, &periph_u_regs, | ||
1961 | periph_clk_enb_refcnt); | ||
1962 | clks[xusb_host] = clk; | ||
1963 | |||
1964 | /* xusb_ss */ | ||
1965 | clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0, | ||
1966 | clk_base, 0, 156, &periph_w_regs, | ||
1967 | periph_clk_enb_refcnt); | ||
1968 | clks[xusb_host] = clk; | ||
1969 | |||
1970 | /* xusb_dev */ | ||
1971 | clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0, | ||
1972 | clk_base, 0, 95, &periph_u_regs, | ||
1973 | periph_clk_enb_refcnt); | ||
1974 | clks[xusb_dev] = clk; | ||
1975 | |||
1976 | /* emc */ | ||
1977 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | ||
1978 | ARRAY_SIZE(mux_pllmcp_clkm), 0, | ||
1979 | clk_base + CLK_SOURCE_EMC, | ||
1980 | 29, 3, 0, NULL); | ||
1981 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, | ||
1982 | CLK_IGNORE_UNUSED, 57, &periph_h_regs, | ||
1983 | periph_clk_enb_refcnt); | ||
1984 | clks[emc] = clk; | ||
1985 | |||
1986 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { | ||
1987 | data = &tegra_periph_clk_list[i]; | ||
1988 | clk = tegra_clk_register_periph(data->name, data->parent_names, | ||
1989 | data->num_parents, &data->periph, | ||
1990 | clk_base, data->offset, data->flags); | ||
1991 | clks[data->clk_id] = clk; | ||
1992 | } | ||
1993 | |||
1994 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { | ||
1995 | data = &tegra_periph_nodiv_clk_list[i]; | ||
1996 | clk = tegra_clk_register_periph_nodiv(data->name, | ||
1997 | data->parent_names, data->num_parents, | ||
1998 | &data->periph, clk_base, data->offset); | ||
1999 | clks[data->clk_id] = clk; | ||
2000 | } | ||
2001 | } | ||
2002 | |||
2003 | static struct tegra_cpu_car_ops tegra114_cpu_car_ops; | ||
2004 | |||
2005 | static const struct of_device_id pmc_match[] __initconst = { | ||
2006 | { .compatible = "nvidia,tegra114-pmc" }, | ||
2007 | {}, | ||
2008 | }; | ||
2009 | |||
2010 | static __initdata struct tegra_clk_init_table init_table[] = { | ||
2011 | {uarta, pll_p, 408000000, 0}, | ||
2012 | {uartb, pll_p, 408000000, 0}, | ||
2013 | {uartc, pll_p, 408000000, 0}, | ||
2014 | {uartd, pll_p, 408000000, 0}, | ||
2015 | {pll_a, clk_max, 564480000, 1}, | ||
2016 | {pll_a_out0, clk_max, 11289600, 1}, | ||
2017 | {extern1, pll_a_out0, 0, 1}, | ||
2018 | {clk_out_1_mux, extern1, 0, 1}, | ||
2019 | {clk_out_1, clk_max, 0, 1}, | ||
2020 | {i2s0, pll_a_out0, 11289600, 0}, | ||
2021 | {i2s1, pll_a_out0, 11289600, 0}, | ||
2022 | {i2s2, pll_a_out0, 11289600, 0}, | ||
2023 | {i2s3, pll_a_out0, 11289600, 0}, | ||
2024 | {i2s4, pll_a_out0, 11289600, 0}, | ||
2025 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | ||
2026 | }; | ||
2027 | |||
2028 | static void __init tegra114_clock_apply_init_table(void) | ||
2029 | { | ||
2030 | tegra_init_from_table(init_table, clks, clk_max); | ||
2031 | } | ||
2032 | |||
2033 | void __init tegra114_clock_init(struct device_node *np) | ||
2034 | { | ||
2035 | struct device_node *node; | ||
2036 | int i; | ||
2037 | |||
2038 | clk_base = of_iomap(np, 0); | ||
2039 | if (!clk_base) { | ||
2040 | pr_err("ioremap tegra114 CAR failed\n"); | ||
2041 | return; | ||
2042 | } | ||
2043 | |||
2044 | node = of_find_matching_node(NULL, pmc_match); | ||
2045 | if (!node) { | ||
2046 | pr_err("Failed to find pmc node\n"); | ||
2047 | WARN_ON(1); | ||
2048 | return; | ||
2049 | } | ||
2050 | |||
2051 | pmc_base = of_iomap(node, 0); | ||
2052 | if (!pmc_base) { | ||
2053 | pr_err("Can't map pmc registers\n"); | ||
2054 | WARN_ON(1); | ||
2055 | return; | ||
2056 | } | ||
2057 | |||
2058 | if (tegra114_osc_clk_init(clk_base) < 0) | ||
2059 | return; | ||
2060 | |||
2061 | tegra114_fixed_clk_init(clk_base); | ||
2062 | tegra114_pll_init(clk_base, pmc_base); | ||
2063 | tegra114_periph_clk_init(clk_base); | ||
2064 | tegra114_audio_clk_init(clk_base); | ||
2065 | tegra114_pmc_clk_init(pmc_base); | ||
2066 | tegra114_super_clk_init(clk_base); | ||
2067 | |||
2068 | for (i = 0; i < ARRAY_SIZE(clks); i++) { | ||
2069 | if (IS_ERR(clks[i])) { | ||
2070 | pr_err | ||
2071 | ("Tegra114 clk %d: register failed with %ld\n", | ||
2072 | i, PTR_ERR(clks[i])); | ||
2073 | } | ||
2074 | if (!clks[i]) | ||
2075 | clks[i] = ERR_PTR(-EINVAL); | ||
2076 | } | ||
2077 | |||
2078 | clk_data.clks = clks; | ||
2079 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
2080 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
2081 | |||
2082 | tegra_clk_apply_init_table = tegra114_clock_apply_init_table; | ||
2083 | |||
2084 | tegra_cpu_car_ops = &tegra114_cpu_car_ops; | ||
2085 | } | ||
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index bf194009e20f..8292a00c3de9 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -86,8 +86,8 @@ | |||
86 | #define PLLE_BASE 0xe8 | 86 | #define PLLE_BASE 0xe8 |
87 | #define PLLE_MISC 0xec | 87 | #define PLLE_MISC 0xec |
88 | 88 | ||
89 | #define PLL_BASE_LOCK 27 | 89 | #define PLL_BASE_LOCK BIT(27) |
90 | #define PLLE_MISC_LOCK 11 | 90 | #define PLLE_MISC_LOCK BIT(11) |
91 | 91 | ||
92 | #define PLL_MISC_LOCK_ENABLE 18 | 92 | #define PLL_MISC_LOCK_ENABLE 18 |
93 | #define PLLDU_MISC_LOCK_ENABLE 22 | 93 | #define PLLDU_MISC_LOCK_ENABLE 22 |
@@ -236,7 +236,7 @@ enum tegra20_clk { | |||
236 | dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, | 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, | 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, | 238 | pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb, |
239 | iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev1, cdev2, | 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, | 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, | 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, | 242 | pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, |
@@ -248,125 +248,125 @@ static struct clk *clks[clk_max]; | |||
248 | static struct clk_onecell_data clk_data; | 248 | static struct clk_onecell_data clk_data; |
249 | 249 | ||
250 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | 250 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
251 | { 12000000, 600000000, 600, 12, 1, 8 }, | 251 | { 12000000, 600000000, 600, 12, 0, 8 }, |
252 | { 13000000, 600000000, 600, 13, 1, 8 }, | 252 | { 13000000, 600000000, 600, 13, 0, 8 }, |
253 | { 19200000, 600000000, 500, 16, 1, 6 }, | 253 | { 19200000, 600000000, 500, 16, 0, 6 }, |
254 | { 26000000, 600000000, 600, 26, 1, 8 }, | 254 | { 26000000, 600000000, 600, 26, 0, 8 }, |
255 | { 0, 0, 0, 0, 0, 0 }, | 255 | { 0, 0, 0, 0, 0, 0 }, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | 258 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { |
259 | { 12000000, 666000000, 666, 12, 1, 8}, | 259 | { 12000000, 666000000, 666, 12, 0, 8}, |
260 | { 13000000, 666000000, 666, 13, 1, 8}, | 260 | { 13000000, 666000000, 666, 13, 0, 8}, |
261 | { 19200000, 666000000, 555, 16, 1, 8}, | 261 | { 19200000, 666000000, 555, 16, 0, 8}, |
262 | { 26000000, 666000000, 666, 26, 1, 8}, | 262 | { 26000000, 666000000, 666, 26, 0, 8}, |
263 | { 12000000, 600000000, 600, 12, 1, 8}, | 263 | { 12000000, 600000000, 600, 12, 0, 8}, |
264 | { 13000000, 600000000, 600, 13, 1, 8}, | 264 | { 13000000, 600000000, 600, 13, 0, 8}, |
265 | { 19200000, 600000000, 375, 12, 1, 6}, | 265 | { 19200000, 600000000, 375, 12, 0, 6}, |
266 | { 26000000, 600000000, 600, 26, 1, 8}, | 266 | { 26000000, 600000000, 600, 26, 0, 8}, |
267 | { 0, 0, 0, 0, 0, 0 }, | 267 | { 0, 0, 0, 0, 0, 0 }, |
268 | }; | 268 | }; |
269 | 269 | ||
270 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 270 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
271 | { 12000000, 216000000, 432, 12, 2, 8}, | 271 | { 12000000, 216000000, 432, 12, 1, 8}, |
272 | { 13000000, 216000000, 432, 13, 2, 8}, | 272 | { 13000000, 216000000, 432, 13, 1, 8}, |
273 | { 19200000, 216000000, 90, 4, 2, 1}, | 273 | { 19200000, 216000000, 90, 4, 1, 1}, |
274 | { 26000000, 216000000, 432, 26, 2, 8}, | 274 | { 26000000, 216000000, 432, 26, 1, 8}, |
275 | { 12000000, 432000000, 432, 12, 1, 8}, | 275 | { 12000000, 432000000, 432, 12, 0, 8}, |
276 | { 13000000, 432000000, 432, 13, 1, 8}, | 276 | { 13000000, 432000000, 432, 13, 0, 8}, |
277 | { 19200000, 432000000, 90, 4, 1, 1}, | 277 | { 19200000, 432000000, 90, 4, 0, 1}, |
278 | { 26000000, 432000000, 432, 26, 1, 8}, | 278 | { 26000000, 432000000, 432, 26, 0, 8}, |
279 | { 0, 0, 0, 0, 0, 0 }, | 279 | { 0, 0, 0, 0, 0, 0 }, |
280 | }; | 280 | }; |
281 | 281 | ||
282 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | 282 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
283 | { 28800000, 56448000, 49, 25, 1, 1}, | 283 | { 28800000, 56448000, 49, 25, 0, 1}, |
284 | { 28800000, 73728000, 64, 25, 1, 1}, | 284 | { 28800000, 73728000, 64, 25, 0, 1}, |
285 | { 28800000, 24000000, 5, 6, 1, 1}, | 285 | { 28800000, 24000000, 5, 6, 0, 1}, |
286 | { 0, 0, 0, 0, 0, 0 }, | 286 | { 0, 0, 0, 0, 0, 0 }, |
287 | }; | 287 | }; |
288 | 288 | ||
289 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 289 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
290 | { 12000000, 216000000, 216, 12, 1, 4}, | 290 | { 12000000, 216000000, 216, 12, 0, 4}, |
291 | { 13000000, 216000000, 216, 13, 1, 4}, | 291 | { 13000000, 216000000, 216, 13, 0, 4}, |
292 | { 19200000, 216000000, 135, 12, 1, 3}, | 292 | { 19200000, 216000000, 135, 12, 0, 3}, |
293 | { 26000000, 216000000, 216, 26, 1, 4}, | 293 | { 26000000, 216000000, 216, 26, 0, 4}, |
294 | 294 | ||
295 | { 12000000, 594000000, 594, 12, 1, 8}, | 295 | { 12000000, 594000000, 594, 12, 0, 8}, |
296 | { 13000000, 594000000, 594, 13, 1, 8}, | 296 | { 13000000, 594000000, 594, 13, 0, 8}, |
297 | { 19200000, 594000000, 495, 16, 1, 8}, | 297 | { 19200000, 594000000, 495, 16, 0, 8}, |
298 | { 26000000, 594000000, 594, 26, 1, 8}, | 298 | { 26000000, 594000000, 594, 26, 0, 8}, |
299 | 299 | ||
300 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 300 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
301 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 301 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
302 | { 19200000, 1000000000, 625, 12, 1, 8}, | 302 | { 19200000, 1000000000, 625, 12, 0, 8}, |
303 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 303 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
304 | 304 | ||
305 | { 0, 0, 0, 0, 0, 0 }, | 305 | { 0, 0, 0, 0, 0, 0 }, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | 308 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { |
309 | { 12000000, 480000000, 960, 12, 2, 0}, | 309 | { 12000000, 480000000, 960, 12, 0, 0}, |
310 | { 13000000, 480000000, 960, 13, 2, 0}, | 310 | { 13000000, 480000000, 960, 13, 0, 0}, |
311 | { 19200000, 480000000, 200, 4, 2, 0}, | 311 | { 19200000, 480000000, 200, 4, 0, 0}, |
312 | { 26000000, 480000000, 960, 26, 2, 0}, | 312 | { 26000000, 480000000, 960, 26, 0, 0}, |
313 | { 0, 0, 0, 0, 0, 0 }, | 313 | { 0, 0, 0, 0, 0, 0 }, |
314 | }; | 314 | }; |
315 | 315 | ||
316 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | 316 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
317 | /* 1 GHz */ | 317 | /* 1 GHz */ |
318 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 318 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
319 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 319 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
320 | { 19200000, 1000000000, 625, 12, 1, 8}, | 320 | { 19200000, 1000000000, 625, 12, 0, 8}, |
321 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 321 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
322 | 322 | ||
323 | /* 912 MHz */ | 323 | /* 912 MHz */ |
324 | { 12000000, 912000000, 912, 12, 1, 12}, | 324 | { 12000000, 912000000, 912, 12, 0, 12}, |
325 | { 13000000, 912000000, 912, 13, 1, 12}, | 325 | { 13000000, 912000000, 912, 13, 0, 12}, |
326 | { 19200000, 912000000, 760, 16, 1, 8}, | 326 | { 19200000, 912000000, 760, 16, 0, 8}, |
327 | { 26000000, 912000000, 912, 26, 1, 12}, | 327 | { 26000000, 912000000, 912, 26, 0, 12}, |
328 | 328 | ||
329 | /* 816 MHz */ | 329 | /* 816 MHz */ |
330 | { 12000000, 816000000, 816, 12, 1, 12}, | 330 | { 12000000, 816000000, 816, 12, 0, 12}, |
331 | { 13000000, 816000000, 816, 13, 1, 12}, | 331 | { 13000000, 816000000, 816, 13, 0, 12}, |
332 | { 19200000, 816000000, 680, 16, 1, 8}, | 332 | { 19200000, 816000000, 680, 16, 0, 8}, |
333 | { 26000000, 816000000, 816, 26, 1, 12}, | 333 | { 26000000, 816000000, 816, 26, 0, 12}, |
334 | 334 | ||
335 | /* 760 MHz */ | 335 | /* 760 MHz */ |
336 | { 12000000, 760000000, 760, 12, 1, 12}, | 336 | { 12000000, 760000000, 760, 12, 0, 12}, |
337 | { 13000000, 760000000, 760, 13, 1, 12}, | 337 | { 13000000, 760000000, 760, 13, 0, 12}, |
338 | { 19200000, 760000000, 950, 24, 1, 8}, | 338 | { 19200000, 760000000, 950, 24, 0, 8}, |
339 | { 26000000, 760000000, 760, 26, 1, 12}, | 339 | { 26000000, 760000000, 760, 26, 0, 12}, |
340 | 340 | ||
341 | /* 750 MHz */ | 341 | /* 750 MHz */ |
342 | { 12000000, 750000000, 750, 12, 1, 12}, | 342 | { 12000000, 750000000, 750, 12, 0, 12}, |
343 | { 13000000, 750000000, 750, 13, 1, 12}, | 343 | { 13000000, 750000000, 750, 13, 0, 12}, |
344 | { 19200000, 750000000, 625, 16, 1, 8}, | 344 | { 19200000, 750000000, 625, 16, 0, 8}, |
345 | { 26000000, 750000000, 750, 26, 1, 12}, | 345 | { 26000000, 750000000, 750, 26, 0, 12}, |
346 | 346 | ||
347 | /* 608 MHz */ | 347 | /* 608 MHz */ |
348 | { 12000000, 608000000, 608, 12, 1, 12}, | 348 | { 12000000, 608000000, 608, 12, 0, 12}, |
349 | { 13000000, 608000000, 608, 13, 1, 12}, | 349 | { 13000000, 608000000, 608, 13, 0, 12}, |
350 | { 19200000, 608000000, 380, 12, 1, 8}, | 350 | { 19200000, 608000000, 380, 12, 0, 8}, |
351 | { 26000000, 608000000, 608, 26, 1, 12}, | 351 | { 26000000, 608000000, 608, 26, 0, 12}, |
352 | 352 | ||
353 | /* 456 MHz */ | 353 | /* 456 MHz */ |
354 | { 12000000, 456000000, 456, 12, 1, 12}, | 354 | { 12000000, 456000000, 456, 12, 0, 12}, |
355 | { 13000000, 456000000, 456, 13, 1, 12}, | 355 | { 13000000, 456000000, 456, 13, 0, 12}, |
356 | { 19200000, 456000000, 380, 16, 1, 8}, | 356 | { 19200000, 456000000, 380, 16, 0, 8}, |
357 | { 26000000, 456000000, 456, 26, 1, 12}, | 357 | { 26000000, 456000000, 456, 26, 0, 12}, |
358 | 358 | ||
359 | /* 312 MHz */ | 359 | /* 312 MHz */ |
360 | { 12000000, 312000000, 312, 12, 1, 12}, | 360 | { 12000000, 312000000, 312, 12, 0, 12}, |
361 | { 13000000, 312000000, 312, 13, 1, 12}, | 361 | { 13000000, 312000000, 312, 13, 0, 12}, |
362 | { 19200000, 312000000, 260, 16, 1, 8}, | 362 | { 19200000, 312000000, 260, 16, 0, 8}, |
363 | { 26000000, 312000000, 312, 26, 1, 12}, | 363 | { 26000000, 312000000, 312, 26, 0, 12}, |
364 | 364 | ||
365 | { 0, 0, 0, 0, 0, 0 }, | 365 | { 0, 0, 0, 0, 0, 0 }, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | 368 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { |
369 | { 12000000, 100000000, 200, 24, 1, 0 }, | 369 | { 12000000, 100000000, 200, 24, 0, 0 }, |
370 | { 0, 0, 0, 0, 0, 0 }, | 370 | { 0, 0, 0, 0, 0, 0 }, |
371 | }; | 371 | }; |
372 | 372 | ||
@@ -380,7 +380,7 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
380 | .vco_max = 1400000000, | 380 | .vco_max = 1400000000, |
381 | .base_reg = PLLC_BASE, | 381 | .base_reg = PLLC_BASE, |
382 | .misc_reg = PLLC_MISC, | 382 | .misc_reg = PLLC_MISC, |
383 | .lock_bit_idx = PLL_BASE_LOCK, | 383 | .lock_mask = PLL_BASE_LOCK, |
384 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 384 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
385 | .lock_delay = 300, | 385 | .lock_delay = 300, |
386 | }; | 386 | }; |
@@ -394,7 +394,7 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
394 | .vco_max = 1200000000, | 394 | .vco_max = 1200000000, |
395 | .base_reg = PLLM_BASE, | 395 | .base_reg = PLLM_BASE, |
396 | .misc_reg = PLLM_MISC, | 396 | .misc_reg = PLLM_MISC, |
397 | .lock_bit_idx = PLL_BASE_LOCK, | 397 | .lock_mask = PLL_BASE_LOCK, |
398 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 398 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
399 | .lock_delay = 300, | 399 | .lock_delay = 300, |
400 | }; | 400 | }; |
@@ -408,7 +408,7 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
408 | .vco_max = 1400000000, | 408 | .vco_max = 1400000000, |
409 | .base_reg = PLLP_BASE, | 409 | .base_reg = PLLP_BASE, |
410 | .misc_reg = PLLP_MISC, | 410 | .misc_reg = PLLP_MISC, |
411 | .lock_bit_idx = PLL_BASE_LOCK, | 411 | .lock_mask = PLL_BASE_LOCK, |
412 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 412 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
413 | .lock_delay = 300, | 413 | .lock_delay = 300, |
414 | }; | 414 | }; |
@@ -422,7 +422,7 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
422 | .vco_max = 1400000000, | 422 | .vco_max = 1400000000, |
423 | .base_reg = PLLA_BASE, | 423 | .base_reg = PLLA_BASE, |
424 | .misc_reg = PLLA_MISC, | 424 | .misc_reg = PLLA_MISC, |
425 | .lock_bit_idx = PLL_BASE_LOCK, | 425 | .lock_mask = PLL_BASE_LOCK, |
426 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 426 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
427 | .lock_delay = 300, | 427 | .lock_delay = 300, |
428 | }; | 428 | }; |
@@ -436,11 +436,17 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
436 | .vco_max = 1000000000, | 436 | .vco_max = 1000000000, |
437 | .base_reg = PLLD_BASE, | 437 | .base_reg = PLLD_BASE, |
438 | .misc_reg = PLLD_MISC, | 438 | .misc_reg = PLLD_MISC, |
439 | .lock_bit_idx = PLL_BASE_LOCK, | 439 | .lock_mask = PLL_BASE_LOCK, |
440 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 440 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
441 | .lock_delay = 1000, | 441 | .lock_delay = 1000, |
442 | }; | 442 | }; |
443 | 443 | ||
444 | static struct pdiv_map pllu_p[] = { | ||
445 | { .pdiv = 1, .hw_val = 1 }, | ||
446 | { .pdiv = 2, .hw_val = 0 }, | ||
447 | { .pdiv = 0, .hw_val = 0 }, | ||
448 | }; | ||
449 | |||
444 | static struct tegra_clk_pll_params pll_u_params = { | 450 | static struct tegra_clk_pll_params pll_u_params = { |
445 | .input_min = 2000000, | 451 | .input_min = 2000000, |
446 | .input_max = 40000000, | 452 | .input_max = 40000000, |
@@ -450,9 +456,10 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
450 | .vco_max = 960000000, | 456 | .vco_max = 960000000, |
451 | .base_reg = PLLU_BASE, | 457 | .base_reg = PLLU_BASE, |
452 | .misc_reg = PLLU_MISC, | 458 | .misc_reg = PLLU_MISC, |
453 | .lock_bit_idx = PLL_BASE_LOCK, | 459 | .lock_mask = PLL_BASE_LOCK, |
454 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 460 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
455 | .lock_delay = 1000, | 461 | .lock_delay = 1000, |
462 | .pdiv_tohw = pllu_p, | ||
456 | }; | 463 | }; |
457 | 464 | ||
458 | static struct tegra_clk_pll_params pll_x_params = { | 465 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -464,7 +471,7 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
464 | .vco_max = 1200000000, | 471 | .vco_max = 1200000000, |
465 | .base_reg = PLLX_BASE, | 472 | .base_reg = PLLX_BASE, |
466 | .misc_reg = PLLX_MISC, | 473 | .misc_reg = PLLX_MISC, |
467 | .lock_bit_idx = PLL_BASE_LOCK, | 474 | .lock_mask = PLL_BASE_LOCK, |
468 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 475 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
469 | .lock_delay = 300, | 476 | .lock_delay = 300, |
470 | }; | 477 | }; |
@@ -478,7 +485,7 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
478 | .vco_max = 0, | 485 | .vco_max = 0, |
479 | .base_reg = PLLE_BASE, | 486 | .base_reg = PLLE_BASE, |
480 | .misc_reg = PLLE_MISC, | 487 | .misc_reg = PLLE_MISC, |
481 | .lock_bit_idx = PLLE_MISC_LOCK, | 488 | .lock_mask = PLLE_MISC_LOCK, |
482 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 489 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
483 | .lock_delay = 0, | 490 | .lock_delay = 0, |
484 | }; | 491 | }; |
@@ -1012,7 +1019,7 @@ static void __init tegra20_periph_clk_init(void) | |||
1012 | data = &tegra_periph_clk_list[i]; | 1019 | data = &tegra_periph_clk_list[i]; |
1013 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 1020 | clk = tegra_clk_register_periph(data->name, data->parent_names, |
1014 | data->num_parents, &data->periph, | 1021 | data->num_parents, &data->periph, |
1015 | clk_base, data->offset); | 1022 | clk_base, data->offset, data->flags); |
1016 | clk_register_clkdev(clk, data->con_id, data->dev_id); | 1023 | clk_register_clkdev(clk, data->con_id, data->dev_id); |
1017 | clks[data->clk_id] = clk; | 1024 | clks[data->clk_id] = clk; |
1018 | } | 1025 | } |
@@ -1247,9 +1254,16 @@ static __initdata struct tegra_clk_init_table init_table[] = { | |||
1247 | {host1x, pll_c, 150000000, 0}, | 1254 | {host1x, pll_c, 150000000, 0}, |
1248 | {disp1, pll_p, 600000000, 0}, | 1255 | {disp1, pll_p, 600000000, 0}, |
1249 | {disp2, pll_p, 600000000, 0}, | 1256 | {disp2, pll_p, 600000000, 0}, |
1257 | {gr2d, pll_c, 300000000, 0}, | ||
1258 | {gr3d, pll_c, 300000000, 0}, | ||
1250 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ | 1259 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ |
1251 | }; | 1260 | }; |
1252 | 1261 | ||
1262 | static void __init tegra20_clock_apply_init_table(void) | ||
1263 | { | ||
1264 | tegra_init_from_table(init_table, clks, clk_max); | ||
1265 | } | ||
1266 | |||
1253 | /* | 1267 | /* |
1254 | * Some clocks may be used by different drivers depending on the board | 1268 | * Some clocks may be used by different drivers depending on the board |
1255 | * configuration. List those here to register them twice in the clock lookup | 1269 | * configuration. List those here to register them twice in the clock lookup |
@@ -1316,7 +1330,7 @@ void __init tegra20_clock_init(struct device_node *np) | |||
1316 | clk_data.clk_num = ARRAY_SIZE(clks); | 1330 | clk_data.clk_num = ARRAY_SIZE(clks); |
1317 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 1331 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
1318 | 1332 | ||
1319 | tegra_init_from_table(init_table, clks, clk_max); | 1333 | tegra_clk_apply_init_table = tegra20_clock_apply_init_table; |
1320 | 1334 | ||
1321 | tegra_cpu_car_ops = &tegra20_cpu_car_ops; | 1335 | tegra_cpu_car_ops = &tegra20_cpu_car_ops; |
1322 | } | 1336 | } |
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index f15f147d473c..c6921f538e28 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -115,8 +115,8 @@ | |||
115 | #define PLLDU_MISC_LOCK_ENABLE 22 | 115 | #define PLLDU_MISC_LOCK_ENABLE 22 |
116 | #define PLLE_MISC_LOCK_ENABLE 9 | 116 | #define PLLE_MISC_LOCK_ENABLE 9 |
117 | 117 | ||
118 | #define PLL_BASE_LOCK 27 | 118 | #define PLL_BASE_LOCK BIT(27) |
119 | #define PLLE_MISC_LOCK 11 | 119 | #define PLLE_MISC_LOCK BIT(11) |
120 | 120 | ||
121 | #define PLLE_AUX 0x48c | 121 | #define PLLE_AUX 0x48c |
122 | #define PLLC_OUT 0x84 | 122 | #define PLLC_OUT 0x84 |
@@ -329,7 +329,7 @@ enum tegra30_clk { | |||
329 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, | 329 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, |
330 | pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, | 330 | pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, |
331 | dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, | 331 | dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, |
332 | cdev1, cdev2, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, | 332 | cdev2, cdev1, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, |
333 | i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, | 333 | i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, |
334 | atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, | 334 | atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, |
335 | spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, | 335 | spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, |
@@ -373,164 +373,170 @@ static const struct utmi_clk_param utmi_parameters[] = { | |||
373 | }; | 373 | }; |
374 | 374 | ||
375 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | 375 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
376 | { 12000000, 1040000000, 520, 6, 1, 8}, | 376 | { 12000000, 1040000000, 520, 6, 0, 8}, |
377 | { 13000000, 1040000000, 480, 6, 1, 8}, | 377 | { 13000000, 1040000000, 480, 6, 0, 8}, |
378 | { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */ | 378 | { 16800000, 1040000000, 495, 8, 0, 8}, /* actual: 1039.5 MHz */ |
379 | { 19200000, 1040000000, 325, 6, 1, 6}, | 379 | { 19200000, 1040000000, 325, 6, 0, 6}, |
380 | { 26000000, 1040000000, 520, 13, 1, 8}, | 380 | { 26000000, 1040000000, 520, 13, 0, 8}, |
381 | 381 | ||
382 | { 12000000, 832000000, 416, 6, 1, 8}, | 382 | { 12000000, 832000000, 416, 6, 0, 8}, |
383 | { 13000000, 832000000, 832, 13, 1, 8}, | 383 | { 13000000, 832000000, 832, 13, 0, 8}, |
384 | { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */ | 384 | { 16800000, 832000000, 396, 8, 0, 8}, /* actual: 831.6 MHz */ |
385 | { 19200000, 832000000, 260, 6, 1, 8}, | 385 | { 19200000, 832000000, 260, 6, 0, 8}, |
386 | { 26000000, 832000000, 416, 13, 1, 8}, | 386 | { 26000000, 832000000, 416, 13, 0, 8}, |
387 | 387 | ||
388 | { 12000000, 624000000, 624, 12, 1, 8}, | 388 | { 12000000, 624000000, 624, 12, 0, 8}, |
389 | { 13000000, 624000000, 624, 13, 1, 8}, | 389 | { 13000000, 624000000, 624, 13, 0, 8}, |
390 | { 16800000, 600000000, 520, 14, 1, 8}, | 390 | { 16800000, 600000000, 520, 14, 0, 8}, |
391 | { 19200000, 624000000, 520, 16, 1, 8}, | 391 | { 19200000, 624000000, 520, 16, 0, 8}, |
392 | { 26000000, 624000000, 624, 26, 1, 8}, | 392 | { 26000000, 624000000, 624, 26, 0, 8}, |
393 | 393 | ||
394 | { 12000000, 600000000, 600, 12, 1, 8}, | 394 | { 12000000, 600000000, 600, 12, 0, 8}, |
395 | { 13000000, 600000000, 600, 13, 1, 8}, | 395 | { 13000000, 600000000, 600, 13, 0, 8}, |
396 | { 16800000, 600000000, 500, 14, 1, 8}, | 396 | { 16800000, 600000000, 500, 14, 0, 8}, |
397 | { 19200000, 600000000, 375, 12, 1, 6}, | 397 | { 19200000, 600000000, 375, 12, 0, 6}, |
398 | { 26000000, 600000000, 600, 26, 1, 8}, | 398 | { 26000000, 600000000, 600, 26, 0, 8}, |
399 | 399 | ||
400 | { 12000000, 520000000, 520, 12, 1, 8}, | 400 | { 12000000, 520000000, 520, 12, 0, 8}, |
401 | { 13000000, 520000000, 520, 13, 1, 8}, | 401 | { 13000000, 520000000, 520, 13, 0, 8}, |
402 | { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */ | 402 | { 16800000, 520000000, 495, 16, 0, 8}, /* actual: 519.75 MHz */ |
403 | { 19200000, 520000000, 325, 12, 1, 6}, | 403 | { 19200000, 520000000, 325, 12, 0, 6}, |
404 | { 26000000, 520000000, 520, 26, 1, 8}, | 404 | { 26000000, 520000000, 520, 26, 0, 8}, |
405 | 405 | ||
406 | { 12000000, 416000000, 416, 12, 1, 8}, | 406 | { 12000000, 416000000, 416, 12, 0, 8}, |
407 | { 13000000, 416000000, 416, 13, 1, 8}, | 407 | { 13000000, 416000000, 416, 13, 0, 8}, |
408 | { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */ | 408 | { 16800000, 416000000, 396, 16, 0, 8}, /* actual: 415.8 MHz */ |
409 | { 19200000, 416000000, 260, 12, 1, 6}, | 409 | { 19200000, 416000000, 260, 12, 0, 6}, |
410 | { 26000000, 416000000, 416, 26, 1, 8}, | 410 | { 26000000, 416000000, 416, 26, 0, 8}, |
411 | { 0, 0, 0, 0, 0, 0 }, | 411 | { 0, 0, 0, 0, 0, 0 }, |
412 | }; | 412 | }; |
413 | 413 | ||
414 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | 414 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { |
415 | { 12000000, 666000000, 666, 12, 1, 8}, | 415 | { 12000000, 666000000, 666, 12, 0, 8}, |
416 | { 13000000, 666000000, 666, 13, 1, 8}, | 416 | { 13000000, 666000000, 666, 13, 0, 8}, |
417 | { 16800000, 666000000, 555, 14, 1, 8}, | 417 | { 16800000, 666000000, 555, 14, 0, 8}, |
418 | { 19200000, 666000000, 555, 16, 1, 8}, | 418 | { 19200000, 666000000, 555, 16, 0, 8}, |
419 | { 26000000, 666000000, 666, 26, 1, 8}, | 419 | { 26000000, 666000000, 666, 26, 0, 8}, |
420 | { 12000000, 600000000, 600, 12, 1, 8}, | 420 | { 12000000, 600000000, 600, 12, 0, 8}, |
421 | { 13000000, 600000000, 600, 13, 1, 8}, | 421 | { 13000000, 600000000, 600, 13, 0, 8}, |
422 | { 16800000, 600000000, 500, 14, 1, 8}, | 422 | { 16800000, 600000000, 500, 14, 0, 8}, |
423 | { 19200000, 600000000, 375, 12, 1, 6}, | 423 | { 19200000, 600000000, 375, 12, 0, 6}, |
424 | { 26000000, 600000000, 600, 26, 1, 8}, | 424 | { 26000000, 600000000, 600, 26, 0, 8}, |
425 | { 0, 0, 0, 0, 0, 0 }, | 425 | { 0, 0, 0, 0, 0, 0 }, |
426 | }; | 426 | }; |
427 | 427 | ||
428 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 428 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
429 | { 12000000, 216000000, 432, 12, 2, 8}, | 429 | { 12000000, 216000000, 432, 12, 1, 8}, |
430 | { 13000000, 216000000, 432, 13, 2, 8}, | 430 | { 13000000, 216000000, 432, 13, 1, 8}, |
431 | { 16800000, 216000000, 360, 14, 2, 8}, | 431 | { 16800000, 216000000, 360, 14, 1, 8}, |
432 | { 19200000, 216000000, 360, 16, 2, 8}, | 432 | { 19200000, 216000000, 360, 16, 1, 8}, |
433 | { 26000000, 216000000, 432, 26, 2, 8}, | 433 | { 26000000, 216000000, 432, 26, 1, 8}, |
434 | { 0, 0, 0, 0, 0, 0 }, | 434 | { 0, 0, 0, 0, 0, 0 }, |
435 | }; | 435 | }; |
436 | 436 | ||
437 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | 437 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
438 | { 9600000, 564480000, 294, 5, 1, 4}, | 438 | { 9600000, 564480000, 294, 5, 0, 4}, |
439 | { 9600000, 552960000, 288, 5, 1, 4}, | 439 | { 9600000, 552960000, 288, 5, 0, 4}, |
440 | { 9600000, 24000000, 5, 2, 1, 1}, | 440 | { 9600000, 24000000, 5, 2, 0, 1}, |
441 | 441 | ||
442 | { 28800000, 56448000, 49, 25, 1, 1}, | 442 | { 28800000, 56448000, 49, 25, 0, 1}, |
443 | { 28800000, 73728000, 64, 25, 1, 1}, | 443 | { 28800000, 73728000, 64, 25, 0, 1}, |
444 | { 28800000, 24000000, 5, 6, 1, 1}, | 444 | { 28800000, 24000000, 5, 6, 0, 1}, |
445 | { 0, 0, 0, 0, 0, 0 }, | 445 | { 0, 0, 0, 0, 0, 0 }, |
446 | }; | 446 | }; |
447 | 447 | ||
448 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 448 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
449 | { 12000000, 216000000, 216, 12, 1, 4}, | 449 | { 12000000, 216000000, 216, 12, 0, 4}, |
450 | { 13000000, 216000000, 216, 13, 1, 4}, | 450 | { 13000000, 216000000, 216, 13, 0, 4}, |
451 | { 16800000, 216000000, 180, 14, 1, 4}, | 451 | { 16800000, 216000000, 180, 14, 0, 4}, |
452 | { 19200000, 216000000, 180, 16, 1, 4}, | 452 | { 19200000, 216000000, 180, 16, 0, 4}, |
453 | { 26000000, 216000000, 216, 26, 1, 4}, | 453 | { 26000000, 216000000, 216, 26, 0, 4}, |
454 | 454 | ||
455 | { 12000000, 594000000, 594, 12, 1, 8}, | 455 | { 12000000, 594000000, 594, 12, 0, 8}, |
456 | { 13000000, 594000000, 594, 13, 1, 8}, | 456 | { 13000000, 594000000, 594, 13, 0, 8}, |
457 | { 16800000, 594000000, 495, 14, 1, 8}, | 457 | { 16800000, 594000000, 495, 14, 0, 8}, |
458 | { 19200000, 594000000, 495, 16, 1, 8}, | 458 | { 19200000, 594000000, 495, 16, 0, 8}, |
459 | { 26000000, 594000000, 594, 26, 1, 8}, | 459 | { 26000000, 594000000, 594, 26, 0, 8}, |
460 | 460 | ||
461 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 461 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
462 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 462 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
463 | { 19200000, 1000000000, 625, 12, 1, 8}, | 463 | { 19200000, 1000000000, 625, 12, 0, 8}, |
464 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 464 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
465 | 465 | ||
466 | { 0, 0, 0, 0, 0, 0 }, | 466 | { 0, 0, 0, 0, 0, 0 }, |
467 | }; | 467 | }; |
468 | 468 | ||
469 | static struct pdiv_map pllu_p[] = { | ||
470 | { .pdiv = 1, .hw_val = 1 }, | ||
471 | { .pdiv = 2, .hw_val = 0 }, | ||
472 | { .pdiv = 0, .hw_val = 0 }, | ||
473 | }; | ||
474 | |||
469 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | 475 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { |
470 | { 12000000, 480000000, 960, 12, 2, 12}, | 476 | { 12000000, 480000000, 960, 12, 0, 12}, |
471 | { 13000000, 480000000, 960, 13, 2, 12}, | 477 | { 13000000, 480000000, 960, 13, 0, 12}, |
472 | { 16800000, 480000000, 400, 7, 2, 5}, | 478 | { 16800000, 480000000, 400, 7, 0, 5}, |
473 | { 19200000, 480000000, 200, 4, 2, 3}, | 479 | { 19200000, 480000000, 200, 4, 0, 3}, |
474 | { 26000000, 480000000, 960, 26, 2, 12}, | 480 | { 26000000, 480000000, 960, 26, 0, 12}, |
475 | { 0, 0, 0, 0, 0, 0 }, | 481 | { 0, 0, 0, 0, 0, 0 }, |
476 | }; | 482 | }; |
477 | 483 | ||
478 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | 484 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
479 | /* 1.7 GHz */ | 485 | /* 1.7 GHz */ |
480 | { 12000000, 1700000000, 850, 6, 1, 8}, | 486 | { 12000000, 1700000000, 850, 6, 0, 8}, |
481 | { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */ | 487 | { 13000000, 1700000000, 915, 7, 0, 8}, /* actual: 1699.2 MHz */ |
482 | { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */ | 488 | { 16800000, 1700000000, 708, 7, 0, 8}, /* actual: 1699.2 MHz */ |
483 | { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */ | 489 | { 19200000, 1700000000, 885, 10, 0, 8}, /* actual: 1699.2 MHz */ |
484 | { 26000000, 1700000000, 850, 13, 1, 8}, | 490 | { 26000000, 1700000000, 850, 13, 0, 8}, |
485 | 491 | ||
486 | /* 1.6 GHz */ | 492 | /* 1.6 GHz */ |
487 | { 12000000, 1600000000, 800, 6, 1, 8}, | 493 | { 12000000, 1600000000, 800, 6, 0, 8}, |
488 | { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */ | 494 | { 13000000, 1600000000, 738, 6, 0, 8}, /* actual: 1599.0 MHz */ |
489 | { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */ | 495 | { 16800000, 1600000000, 857, 9, 0, 8}, /* actual: 1599.7 MHz */ |
490 | { 19200000, 1600000000, 500, 6, 1, 8}, | 496 | { 19200000, 1600000000, 500, 6, 0, 8}, |
491 | { 26000000, 1600000000, 800, 13, 1, 8}, | 497 | { 26000000, 1600000000, 800, 13, 0, 8}, |
492 | 498 | ||
493 | /* 1.5 GHz */ | 499 | /* 1.5 GHz */ |
494 | { 12000000, 1500000000, 750, 6, 1, 8}, | 500 | { 12000000, 1500000000, 750, 6, 0, 8}, |
495 | { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */ | 501 | { 13000000, 1500000000, 923, 8, 0, 8}, /* actual: 1499.8 MHz */ |
496 | { 16800000, 1500000000, 625, 7, 1, 8}, | 502 | { 16800000, 1500000000, 625, 7, 0, 8}, |
497 | { 19200000, 1500000000, 625, 8, 1, 8}, | 503 | { 19200000, 1500000000, 625, 8, 0, 8}, |
498 | { 26000000, 1500000000, 750, 13, 1, 8}, | 504 | { 26000000, 1500000000, 750, 13, 0, 8}, |
499 | 505 | ||
500 | /* 1.4 GHz */ | 506 | /* 1.4 GHz */ |
501 | { 12000000, 1400000000, 700, 6, 1, 8}, | 507 | { 12000000, 1400000000, 700, 6, 0, 8}, |
502 | { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */ | 508 | { 13000000, 1400000000, 969, 9, 0, 8}, /* actual: 1399.7 MHz */ |
503 | { 16800000, 1400000000, 1000, 12, 1, 8}, | 509 | { 16800000, 1400000000, 1000, 12, 0, 8}, |
504 | { 19200000, 1400000000, 875, 12, 1, 8}, | 510 | { 19200000, 1400000000, 875, 12, 0, 8}, |
505 | { 26000000, 1400000000, 700, 13, 1, 8}, | 511 | { 26000000, 1400000000, 700, 13, 0, 8}, |
506 | 512 | ||
507 | /* 1.3 GHz */ | 513 | /* 1.3 GHz */ |
508 | { 12000000, 1300000000, 975, 9, 1, 8}, | 514 | { 12000000, 1300000000, 975, 9, 0, 8}, |
509 | { 13000000, 1300000000, 1000, 10, 1, 8}, | 515 | { 13000000, 1300000000, 1000, 10, 0, 8}, |
510 | { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */ | 516 | { 16800000, 1300000000, 928, 12, 0, 8}, /* actual: 1299.2 MHz */ |
511 | { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */ | 517 | { 19200000, 1300000000, 812, 12, 0, 8}, /* actual: 1299.2 MHz */ |
512 | { 26000000, 1300000000, 650, 13, 1, 8}, | 518 | { 26000000, 1300000000, 650, 13, 0, 8}, |
513 | 519 | ||
514 | /* 1.2 GHz */ | 520 | /* 1.2 GHz */ |
515 | { 12000000, 1200000000, 1000, 10, 1, 8}, | 521 | { 12000000, 1200000000, 1000, 10, 0, 8}, |
516 | { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */ | 522 | { 13000000, 1200000000, 923, 10, 0, 8}, /* actual: 1199.9 MHz */ |
517 | { 16800000, 1200000000, 1000, 14, 1, 8}, | 523 | { 16800000, 1200000000, 1000, 14, 0, 8}, |
518 | { 19200000, 1200000000, 1000, 16, 1, 8}, | 524 | { 19200000, 1200000000, 1000, 16, 0, 8}, |
519 | { 26000000, 1200000000, 600, 13, 1, 8}, | 525 | { 26000000, 1200000000, 600, 13, 0, 8}, |
520 | 526 | ||
521 | /* 1.1 GHz */ | 527 | /* 1.1 GHz */ |
522 | { 12000000, 1100000000, 825, 9, 1, 8}, | 528 | { 12000000, 1100000000, 825, 9, 0, 8}, |
523 | { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */ | 529 | { 13000000, 1100000000, 846, 10, 0, 8}, /* actual: 1099.8 MHz */ |
524 | { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */ | 530 | { 16800000, 1100000000, 982, 15, 0, 8}, /* actual: 1099.8 MHz */ |
525 | { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */ | 531 | { 19200000, 1100000000, 859, 15, 0, 8}, /* actual: 1099.5 MHz */ |
526 | { 26000000, 1100000000, 550, 13, 1, 8}, | 532 | { 26000000, 1100000000, 550, 13, 0, 8}, |
527 | 533 | ||
528 | /* 1 GHz */ | 534 | /* 1 GHz */ |
529 | { 12000000, 1000000000, 1000, 12, 1, 8}, | 535 | { 12000000, 1000000000, 1000, 12, 0, 8}, |
530 | { 13000000, 1000000000, 1000, 13, 1, 8}, | 536 | { 13000000, 1000000000, 1000, 13, 0, 8}, |
531 | { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */ | 537 | { 16800000, 1000000000, 833, 14, 0, 8}, /* actual: 999.6 MHz */ |
532 | { 19200000, 1000000000, 625, 12, 1, 8}, | 538 | { 19200000, 1000000000, 625, 12, 0, 8}, |
533 | { 26000000, 1000000000, 1000, 26, 1, 8}, | 539 | { 26000000, 1000000000, 1000, 26, 0, 8}, |
534 | 540 | ||
535 | { 0, 0, 0, 0, 0, 0 }, | 541 | { 0, 0, 0, 0, 0, 0 }, |
536 | }; | 542 | }; |
@@ -552,7 +558,7 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
552 | .vco_max = 1400000000, | 558 | .vco_max = 1400000000, |
553 | .base_reg = PLLC_BASE, | 559 | .base_reg = PLLC_BASE, |
554 | .misc_reg = PLLC_MISC, | 560 | .misc_reg = PLLC_MISC, |
555 | .lock_bit_idx = PLL_BASE_LOCK, | 561 | .lock_mask = PLL_BASE_LOCK, |
556 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 562 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
557 | .lock_delay = 300, | 563 | .lock_delay = 300, |
558 | }; | 564 | }; |
@@ -566,7 +572,7 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
566 | .vco_max = 1200000000, | 572 | .vco_max = 1200000000, |
567 | .base_reg = PLLM_BASE, | 573 | .base_reg = PLLM_BASE, |
568 | .misc_reg = PLLM_MISC, | 574 | .misc_reg = PLLM_MISC, |
569 | .lock_bit_idx = PLL_BASE_LOCK, | 575 | .lock_mask = PLL_BASE_LOCK, |
570 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 576 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
571 | .lock_delay = 300, | 577 | .lock_delay = 300, |
572 | }; | 578 | }; |
@@ -580,7 +586,7 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
580 | .vco_max = 1400000000, | 586 | .vco_max = 1400000000, |
581 | .base_reg = PLLP_BASE, | 587 | .base_reg = PLLP_BASE, |
582 | .misc_reg = PLLP_MISC, | 588 | .misc_reg = PLLP_MISC, |
583 | .lock_bit_idx = PLL_BASE_LOCK, | 589 | .lock_mask = PLL_BASE_LOCK, |
584 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 590 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
585 | .lock_delay = 300, | 591 | .lock_delay = 300, |
586 | }; | 592 | }; |
@@ -594,7 +600,7 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
594 | .vco_max = 1400000000, | 600 | .vco_max = 1400000000, |
595 | .base_reg = PLLA_BASE, | 601 | .base_reg = PLLA_BASE, |
596 | .misc_reg = PLLA_MISC, | 602 | .misc_reg = PLLA_MISC, |
597 | .lock_bit_idx = PLL_BASE_LOCK, | 603 | .lock_mask = PLL_BASE_LOCK, |
598 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 604 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
599 | .lock_delay = 300, | 605 | .lock_delay = 300, |
600 | }; | 606 | }; |
@@ -608,7 +614,7 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
608 | .vco_max = 1000000000, | 614 | .vco_max = 1000000000, |
609 | .base_reg = PLLD_BASE, | 615 | .base_reg = PLLD_BASE, |
610 | .misc_reg = PLLD_MISC, | 616 | .misc_reg = PLLD_MISC, |
611 | .lock_bit_idx = PLL_BASE_LOCK, | 617 | .lock_mask = PLL_BASE_LOCK, |
612 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 618 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
613 | .lock_delay = 1000, | 619 | .lock_delay = 1000, |
614 | }; | 620 | }; |
@@ -622,7 +628,7 @@ static struct tegra_clk_pll_params pll_d2_params = { | |||
622 | .vco_max = 1000000000, | 628 | .vco_max = 1000000000, |
623 | .base_reg = PLLD2_BASE, | 629 | .base_reg = PLLD2_BASE, |
624 | .misc_reg = PLLD2_MISC, | 630 | .misc_reg = PLLD2_MISC, |
625 | .lock_bit_idx = PLL_BASE_LOCK, | 631 | .lock_mask = PLL_BASE_LOCK, |
626 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 632 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
627 | .lock_delay = 1000, | 633 | .lock_delay = 1000, |
628 | }; | 634 | }; |
@@ -636,9 +642,10 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
636 | .vco_max = 960000000, | 642 | .vco_max = 960000000, |
637 | .base_reg = PLLU_BASE, | 643 | .base_reg = PLLU_BASE, |
638 | .misc_reg = PLLU_MISC, | 644 | .misc_reg = PLLU_MISC, |
639 | .lock_bit_idx = PLL_BASE_LOCK, | 645 | .lock_mask = PLL_BASE_LOCK, |
640 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 646 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
641 | .lock_delay = 1000, | 647 | .lock_delay = 1000, |
648 | .pdiv_tohw = pllu_p, | ||
642 | }; | 649 | }; |
643 | 650 | ||
644 | static struct tegra_clk_pll_params pll_x_params = { | 651 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -650,7 +657,7 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
650 | .vco_max = 1700000000, | 657 | .vco_max = 1700000000, |
651 | .base_reg = PLLX_BASE, | 658 | .base_reg = PLLX_BASE, |
652 | .misc_reg = PLLX_MISC, | 659 | .misc_reg = PLLX_MISC, |
653 | .lock_bit_idx = PLL_BASE_LOCK, | 660 | .lock_mask = PLL_BASE_LOCK, |
654 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 661 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
655 | .lock_delay = 300, | 662 | .lock_delay = 300, |
656 | }; | 663 | }; |
@@ -664,7 +671,7 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
664 | .vco_max = 2400000000U, | 671 | .vco_max = 2400000000U, |
665 | .base_reg = PLLE_BASE, | 672 | .base_reg = PLLE_BASE, |
666 | .misc_reg = PLLE_MISC, | 673 | .misc_reg = PLLE_MISC, |
667 | .lock_bit_idx = PLLE_MISC_LOCK, | 674 | .lock_mask = PLLE_MISC_LOCK, |
668 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 675 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
669 | .lock_delay = 300, | 676 | .lock_delay = 300, |
670 | }; | 677 | }; |
@@ -1660,7 +1667,7 @@ static void __init tegra30_periph_clk_init(void) | |||
1660 | data = &tegra_periph_clk_list[i]; | 1667 | data = &tegra_periph_clk_list[i]; |
1661 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 1668 | clk = tegra_clk_register_periph(data->name, data->parent_names, |
1662 | data->num_parents, &data->periph, | 1669 | data->num_parents, &data->periph, |
1663 | clk_base, data->offset); | 1670 | clk_base, data->offset, data->flags); |
1664 | clk_register_clkdev(clk, data->con_id, data->dev_id); | 1671 | clk_register_clkdev(clk, data->con_id, data->dev_id); |
1665 | clks[data->clk_id] = clk; | 1672 | clks[data->clk_id] = clk; |
1666 | } | 1673 | } |
@@ -1910,9 +1917,16 @@ static __initdata struct tegra_clk_init_table init_table[] = { | |||
1910 | {disp1, pll_p, 600000000, 0}, | 1917 | {disp1, pll_p, 600000000, 0}, |
1911 | {disp2, pll_p, 600000000, 0}, | 1918 | {disp2, pll_p, 600000000, 0}, |
1912 | {twd, clk_max, 0, 1}, | 1919 | {twd, clk_max, 0, 1}, |
1920 | {gr2d, pll_c, 300000000, 0}, | ||
1921 | {gr3d, pll_c, 300000000, 0}, | ||
1913 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | 1922 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ |
1914 | }; | 1923 | }; |
1915 | 1924 | ||
1925 | static void __init tegra30_clock_apply_init_table(void) | ||
1926 | { | ||
1927 | tegra_init_from_table(init_table, clks, clk_max); | ||
1928 | } | ||
1929 | |||
1916 | /* | 1930 | /* |
1917 | * Some clocks may be used by different drivers depending on the board | 1931 | * Some clocks may be used by different drivers depending on the board |
1918 | * configuration. List those here to register them twice in the clock lookup | 1932 | * configuration. List those here to register them twice in the clock lookup |
@@ -1986,7 +2000,7 @@ void __init tegra30_clock_init(struct device_node *np) | |||
1986 | clk_data.clk_num = ARRAY_SIZE(clks); | 2000 | clk_data.clk_num = ARRAY_SIZE(clks); |
1987 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 2001 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
1988 | 2002 | ||
1989 | tegra_init_from_table(init_table, clks, clk_max); | 2003 | tegra_clk_apply_init_table = tegra30_clock_apply_init_table; |
1990 | 2004 | ||
1991 | tegra_cpu_car_ops = &tegra30_cpu_car_ops; | 2005 | tegra_cpu_car_ops = &tegra30_cpu_car_ops; |
1992 | } | 2006 | } |
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index a603b9af0ad3..923ca7ee4694 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c | |||
@@ -22,7 +22,8 @@ | |||
22 | #include "clk.h" | 22 | #include "clk.h" |
23 | 23 | ||
24 | /* Global data of Tegra CPU CAR ops */ | 24 | /* Global data of Tegra CPU CAR ops */ |
25 | struct tegra_cpu_car_ops *tegra_cpu_car_ops; | 25 | static struct tegra_cpu_car_ops dummy_car_ops; |
26 | struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; | ||
26 | 27 | ||
27 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, | 28 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, |
28 | struct clk *clks[], int clk_max) | 29 | struct clk *clks[], int clk_max) |
@@ -76,6 +77,7 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, | |||
76 | static const struct of_device_id tegra_dt_clk_match[] = { | 77 | static const struct of_device_id tegra_dt_clk_match[] = { |
77 | { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, | 78 | { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, |
78 | { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, | 79 | { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, |
80 | { .compatible = "nvidia,tegra114-car", .data = tegra114_clock_init }, | ||
79 | { } | 81 | { } |
80 | }; | 82 | }; |
81 | 83 | ||
@@ -83,3 +85,13 @@ void __init tegra_clocks_init(void) | |||
83 | { | 85 | { |
84 | of_clk_init(tegra_dt_clk_match); | 86 | of_clk_init(tegra_dt_clk_match); |
85 | } | 87 | } |
88 | |||
89 | tegra_clk_apply_init_table_func tegra_clk_apply_init_table; | ||
90 | |||
91 | void __init tegra_clocks_apply_init_table(void) | ||
92 | { | ||
93 | if (!tegra_clk_apply_init_table) | ||
94 | return; | ||
95 | |||
96 | tegra_clk_apply_init_table(); | ||
97 | } | ||
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h index a09d7dcaf183..e0565620d68e 100644 --- a/drivers/clk/tegra/clk.h +++ b/drivers/clk/tegra/clk.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
@@ -117,6 +117,17 @@ struct tegra_clk_pll_freq_table { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * struct pdiv_map - map post divider to hw value | ||
121 | * | ||
122 | * @pdiv: post divider | ||
123 | * @hw_val: value to be written to the PLL hw | ||
124 | */ | ||
125 | struct pdiv_map { | ||
126 | u8 pdiv; | ||
127 | u8 hw_val; | ||
128 | }; | ||
129 | |||
130 | /** | ||
120 | * struct clk_pll_params - PLL parameters | 131 | * struct clk_pll_params - PLL parameters |
121 | * | 132 | * |
122 | * @input_min: Minimum input frequency | 133 | * @input_min: Minimum input frequency |
@@ -143,9 +154,18 @@ struct tegra_clk_pll_params { | |||
143 | u32 base_reg; | 154 | u32 base_reg; |
144 | u32 misc_reg; | 155 | u32 misc_reg; |
145 | u32 lock_reg; | 156 | u32 lock_reg; |
146 | u32 lock_bit_idx; | 157 | u32 lock_mask; |
147 | u32 lock_enable_bit_idx; | 158 | u32 lock_enable_bit_idx; |
159 | u32 iddq_reg; | ||
160 | u32 iddq_bit_idx; | ||
161 | u32 aux_reg; | ||
162 | u32 dyn_ramp_reg; | ||
163 | u32 ext_misc_reg[3]; | ||
164 | int stepa_shift; | ||
165 | int stepb_shift; | ||
148 | int lock_delay; | 166 | int lock_delay; |
167 | int max_p; | ||
168 | struct pdiv_map *pdiv_tohw; | ||
149 | }; | 169 | }; |
150 | 170 | ||
151 | /** | 171 | /** |
@@ -182,12 +202,16 @@ struct tegra_clk_pll_params { | |||
182 | * TEGRA_PLL_FIXED - We are not supposed to change output frequency | 202 | * TEGRA_PLL_FIXED - We are not supposed to change output frequency |
183 | * of some plls. | 203 | * of some plls. |
184 | * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. | 204 | * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. |
205 | * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the | ||
206 | * base register. | ||
207 | * TEGRA_PLL_BYPASS - PLL has bypass bit | ||
208 | * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring | ||
185 | */ | 209 | */ |
186 | struct tegra_clk_pll { | 210 | struct tegra_clk_pll { |
187 | struct clk_hw hw; | 211 | struct clk_hw hw; |
188 | void __iomem *clk_base; | 212 | void __iomem *clk_base; |
189 | void __iomem *pmc; | 213 | void __iomem *pmc; |
190 | u8 flags; | 214 | u32 flags; |
191 | unsigned long fixed_rate; | 215 | unsigned long fixed_rate; |
192 | spinlock_t *lock; | 216 | spinlock_t *lock; |
193 | u8 divn_shift; | 217 | u8 divn_shift; |
@@ -210,20 +234,64 @@ struct tegra_clk_pll { | |||
210 | #define TEGRA_PLLM BIT(5) | 234 | #define TEGRA_PLLM BIT(5) |
211 | #define TEGRA_PLL_FIXED BIT(6) | 235 | #define TEGRA_PLL_FIXED BIT(6) |
212 | #define TEGRA_PLLE_CONFIGURE BIT(7) | 236 | #define TEGRA_PLLE_CONFIGURE BIT(7) |
237 | #define TEGRA_PLL_LOCK_MISC BIT(8) | ||
238 | #define TEGRA_PLL_BYPASS BIT(9) | ||
239 | #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10) | ||
213 | 240 | ||
214 | extern const struct clk_ops tegra_clk_pll_ops; | 241 | extern const struct clk_ops tegra_clk_pll_ops; |
215 | extern const struct clk_ops tegra_clk_plle_ops; | 242 | extern const struct clk_ops tegra_clk_plle_ops; |
216 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 243 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
217 | void __iomem *clk_base, void __iomem *pmc, | 244 | void __iomem *clk_base, void __iomem *pmc, |
218 | unsigned long flags, unsigned long fixed_rate, | 245 | unsigned long flags, unsigned long fixed_rate, |
219 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 246 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
220 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | 247 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); |
248 | |||
221 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 249 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
222 | void __iomem *clk_base, void __iomem *pmc, | 250 | void __iomem *clk_base, void __iomem *pmc, |
223 | unsigned long flags, unsigned long fixed_rate, | 251 | unsigned long flags, unsigned long fixed_rate, |
224 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 252 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
225 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | 253 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); |
226 | 254 | ||
255 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | ||
256 | void __iomem *clk_base, void __iomem *pmc, | ||
257 | unsigned long flags, unsigned long fixed_rate, | ||
258 | struct tegra_clk_pll_params *pll_params, | ||
259 | u32 pll_flags, | ||
260 | struct tegra_clk_pll_freq_table *freq_table, | ||
261 | spinlock_t *lock); | ||
262 | |||
263 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | ||
264 | void __iomem *clk_base, void __iomem *pmc, | ||
265 | unsigned long flags, unsigned long fixed_rate, | ||
266 | struct tegra_clk_pll_params *pll_params, | ||
267 | u32 pll_flags, | ||
268 | struct tegra_clk_pll_freq_table *freq_table, | ||
269 | spinlock_t *lock); | ||
270 | |||
271 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | ||
272 | void __iomem *clk_base, void __iomem *pmc, | ||
273 | unsigned long flags, unsigned long fixed_rate, | ||
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); | ||
278 | |||
279 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | ||
280 | void __iomem *clk_base, void __iomem *pmc, | ||
281 | unsigned long flags, unsigned long fixed_rate, | ||
282 | struct tegra_clk_pll_params *pll_params, | ||
283 | u32 pll_flags, | ||
284 | struct tegra_clk_pll_freq_table *freq_table, | ||
285 | spinlock_t *lock, unsigned long parent_rate); | ||
286 | |||
287 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | ||
288 | const char *parent_name, | ||
289 | void __iomem *clk_base, unsigned long flags, | ||
290 | unsigned long fixed_rate, | ||
291 | struct tegra_clk_pll_params *pll_params, | ||
292 | struct tegra_clk_pll_freq_table *freq_table, | ||
293 | spinlock_t *lock); | ||
294 | |||
227 | /** | 295 | /** |
228 | * struct tegra_clk_pll_out - PLL divider down clock | 296 | * struct tegra_clk_pll_out - PLL divider down clock |
229 | * | 297 | * |
@@ -290,6 +358,7 @@ struct tegra_clk_periph_regs { | |||
290 | * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the | 358 | * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the |
291 | * bus to flush the write operation in apb bus. This flag indicates | 359 | * bus to flush the write operation in apb bus. This flag indicates |
292 | * that this peripheral is in apb bus. | 360 | * that this peripheral is in apb bus. |
361 | * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug | ||
293 | */ | 362 | */ |
294 | struct tegra_clk_periph_gate { | 363 | struct tegra_clk_periph_gate { |
295 | u32 magic; | 364 | u32 magic; |
@@ -309,6 +378,7 @@ struct tegra_clk_periph_gate { | |||
309 | #define TEGRA_PERIPH_NO_RESET BIT(0) | 378 | #define TEGRA_PERIPH_NO_RESET BIT(0) |
310 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) | 379 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) |
311 | #define TEGRA_PERIPH_ON_APB BIT(2) | 380 | #define TEGRA_PERIPH_ON_APB BIT(2) |
381 | #define TEGRA_PERIPH_WAR_1005168 BIT(3) | ||
312 | 382 | ||
313 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); | 383 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); |
314 | extern const struct clk_ops tegra_clk_periph_gate_ops; | 384 | extern const struct clk_ops tegra_clk_periph_gate_ops; |
@@ -349,7 +419,7 @@ extern const struct clk_ops tegra_clk_periph_ops; | |||
349 | struct clk *tegra_clk_register_periph(const char *name, | 419 | struct clk *tegra_clk_register_periph(const char *name, |
350 | const char **parent_names, int num_parents, | 420 | const char **parent_names, int num_parents, |
351 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 421 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
352 | u32 offset); | 422 | u32 offset, unsigned long flags); |
353 | struct clk *tegra_clk_register_periph_nodiv(const char *name, | 423 | struct clk *tegra_clk_register_periph_nodiv(const char *name, |
354 | const char **parent_names, int num_parents, | 424 | const char **parent_names, int num_parents, |
355 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 425 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
@@ -392,12 +462,14 @@ struct tegra_periph_init_data { | |||
392 | u32 offset; | 462 | u32 offset; |
393 | const char *con_id; | 463 | const char *con_id; |
394 | const char *dev_id; | 464 | const char *dev_id; |
465 | unsigned long flags; | ||
395 | }; | 466 | }; |
396 | 467 | ||
397 | #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ | 468 | #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ |
398 | _mux_shift, _mux_mask, _mux_flags, _div_shift, \ | 469 | _mux_shift, _mux_mask, _mux_flags, _div_shift, \ |
399 | _div_width, _div_frac_width, _div_flags, _regs, \ | 470 | _div_width, _div_frac_width, _div_flags, _regs, \ |
400 | _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table) \ | 471 | _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\ |
472 | _flags) \ | ||
401 | { \ | 473 | { \ |
402 | .name = _name, \ | 474 | .name = _name, \ |
403 | .clk_id = _clk_id, \ | 475 | .clk_id = _clk_id, \ |
@@ -412,6 +484,7 @@ struct tegra_periph_init_data { | |||
412 | .offset = _offset, \ | 484 | .offset = _offset, \ |
413 | .con_id = _con_id, \ | 485 | .con_id = _con_id, \ |
414 | .dev_id = _dev_id, \ | 486 | .dev_id = _dev_id, \ |
487 | .flags = _flags \ | ||
415 | } | 488 | } |
416 | 489 | ||
417 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ | 490 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ |
@@ -422,7 +495,7 @@ struct tegra_periph_init_data { | |||
422 | _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ | 495 | _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ |
423 | _div_shift, _div_width, _div_frac_width, _div_flags, \ | 496 | _div_shift, _div_width, _div_frac_width, _div_flags, \ |
424 | _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ | 497 | _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ |
425 | NULL) | 498 | NULL, 0) |
426 | 499 | ||
427 | /** | 500 | /** |
428 | * struct clk_super_mux - super clock | 501 | * struct clk_super_mux - super clock |
@@ -510,4 +583,13 @@ void tegra30_clock_init(struct device_node *np); | |||
510 | static inline void tegra30_clock_init(struct device_node *np) {} | 583 | static inline void tegra30_clock_init(struct device_node *np) {} |
511 | #endif /* CONFIG_ARCH_TEGRA_3x_SOC */ | 584 | #endif /* CONFIG_ARCH_TEGRA_3x_SOC */ |
512 | 585 | ||
586 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
587 | void tegra114_clock_init(struct device_node *np); | ||
588 | #else | ||
589 | static inline void tegra114_clock_init(struct device_node *np) {} | ||
590 | #endif /* CONFIG_ARCH_TEGRA114_SOC */ | ||
591 | |||
592 | typedef void (*tegra_clk_apply_init_table_func)(void); | ||
593 | extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table; | ||
594 | |||
513 | #endif /* TEGRA_CLK_H */ | 595 | #endif /* TEGRA_CLK_H */ |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 9002185a0a1a..7bc6e51757ee 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -31,6 +31,9 @@ config SUN4I_TIMER | |||
31 | config VT8500_TIMER | 31 | config VT8500_TIMER |
32 | bool | 32 | bool |
33 | 33 | ||
34 | config CADENCE_TTC_TIMER | ||
35 | bool | ||
36 | |||
34 | config CLKSRC_NOMADIK_MTU | 37 | config CLKSRC_NOMADIK_MTU |
35 | bool | 38 | bool |
36 | depends on (ARCH_NOMADIK || ARCH_U8500) | 39 | depends on (ARCH_NOMADIK || ARCH_U8500) |
@@ -67,3 +70,8 @@ config CLKSRC_METAG_GENERIC | |||
67 | def_bool y if METAG | 70 | def_bool y if METAG |
68 | help | 71 | help |
69 | This option enables support for the Meta per-thread timers. | 72 | This option enables support for the Meta per-thread timers. |
73 | |||
74 | config CLKSRC_EXYNOS_MCT | ||
75 | def_bool y if ARCH_EXYNOS | ||
76 | help | ||
77 | Support for Multi Core Timer controller on Exynos SoCs. | ||
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 682d48d08164..caacdb63aff9 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
@@ -23,6 +23,8 @@ obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o | |||
23 | obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o | 23 | obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o |
24 | obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o | 24 | obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o |
25 | obj-$(CONFIG_ARCH_BCM) += bcm_kona_timer.o | 25 | obj-$(CONFIG_ARCH_BCM) += bcm_kona_timer.o |
26 | obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o | ||
27 | obj-$(CONFIG_CLKSRC_EXYNOS_MCT) += exynos_mct.o | ||
26 | 28 | ||
27 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o | 29 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o |
28 | obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o | 30 | obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o |
diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c new file mode 100644 index 000000000000..685bc60e210a --- /dev/null +++ b/drivers/clocksource/cadence_ttc_timer.c | |||
@@ -0,0 +1,436 @@ | |||
1 | /* | ||
2 | * This file contains driver for the Cadence Triple Timer Counter Rev 06 | ||
3 | * | ||
4 | * Copyright (C) 2011-2013 Xilinx | ||
5 | * | ||
6 | * based on arch/mips/kernel/time.c timer driver | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include <linux/clk.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/clockchips.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/of_irq.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/clk-provider.h> | ||
25 | |||
26 | /* | ||
27 | * This driver configures the 2 16-bit count-up timers as follows: | ||
28 | * | ||
29 | * T1: Timer 1, clocksource for generic timekeeping | ||
30 | * T2: Timer 2, clockevent source for hrtimers | ||
31 | * T3: Timer 3, <unused> | ||
32 | * | ||
33 | * The input frequency to the timer module for emulation is 2.5MHz which is | ||
34 | * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32, | ||
35 | * the timers are clocked at 78.125KHz (12.8 us resolution). | ||
36 | |||
37 | * The input frequency to the timer module in silicon is configurable and | ||
38 | * obtained from device tree. The pre-scaler of 32 is used. | ||
39 | */ | ||
40 | |||
41 | /* | ||
42 | * Timer Register Offset Definitions of Timer 1, Increment base address by 4 | ||
43 | * and use same offsets for Timer 2 | ||
44 | */ | ||
45 | #define TTC_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ | ||
46 | #define TTC_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ | ||
47 | #define TTC_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ | ||
48 | #define TTC_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ | ||
49 | #define TTC_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ | ||
50 | #define TTC_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ | ||
51 | |||
52 | #define TTC_CNT_CNTRL_DISABLE_MASK 0x1 | ||
53 | |||
54 | /* | ||
55 | * Setup the timers to use pre-scaling, using a fixed value for now that will | ||
56 | * work across most input frequency, but it may need to be more dynamic | ||
57 | */ | ||
58 | #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ | ||
59 | #define PRESCALE 2048 /* The exponent must match this */ | ||
60 | #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) | ||
61 | #define CLK_CNTRL_PRESCALE_EN 1 | ||
62 | #define CNT_CNTRL_RESET (1 << 4) | ||
63 | |||
64 | /** | ||
65 | * struct ttc_timer - This definition defines local timer structure | ||
66 | * | ||
67 | * @base_addr: Base address of timer | ||
68 | * @clk: Associated clock source | ||
69 | * @clk_rate_change_nb Notifier block for clock rate changes | ||
70 | */ | ||
71 | struct ttc_timer { | ||
72 | void __iomem *base_addr; | ||
73 | struct clk *clk; | ||
74 | struct notifier_block clk_rate_change_nb; | ||
75 | }; | ||
76 | |||
77 | #define to_ttc_timer(x) \ | ||
78 | container_of(x, struct ttc_timer, clk_rate_change_nb) | ||
79 | |||
80 | struct ttc_timer_clocksource { | ||
81 | struct ttc_timer ttc; | ||
82 | struct clocksource cs; | ||
83 | }; | ||
84 | |||
85 | #define to_ttc_timer_clksrc(x) \ | ||
86 | container_of(x, struct ttc_timer_clocksource, cs) | ||
87 | |||
88 | struct ttc_timer_clockevent { | ||
89 | struct ttc_timer ttc; | ||
90 | struct clock_event_device ce; | ||
91 | }; | ||
92 | |||
93 | #define to_ttc_timer_clkevent(x) \ | ||
94 | container_of(x, struct ttc_timer_clockevent, ce) | ||
95 | |||
96 | /** | ||
97 | * ttc_set_interval - Set the timer interval value | ||
98 | * | ||
99 | * @timer: Pointer to the timer instance | ||
100 | * @cycles: Timer interval ticks | ||
101 | **/ | ||
102 | static void ttc_set_interval(struct ttc_timer *timer, | ||
103 | unsigned long cycles) | ||
104 | { | ||
105 | u32 ctrl_reg; | ||
106 | |||
107 | /* Disable the counter, set the counter value and re-enable counter */ | ||
108 | ctrl_reg = __raw_readl(timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
109 | ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; | ||
110 | __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
111 | |||
112 | __raw_writel(cycles, timer->base_addr + TTC_INTR_VAL_OFFSET); | ||
113 | |||
114 | /* | ||
115 | * Reset the counter (0x10) so that it starts from 0, one-shot | ||
116 | * mode makes this needed for timing to be right. | ||
117 | */ | ||
118 | ctrl_reg |= CNT_CNTRL_RESET; | ||
119 | ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; | ||
120 | __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * ttc_clock_event_interrupt - Clock event timer interrupt handler | ||
125 | * | ||
126 | * @irq: IRQ number of the Timer | ||
127 | * @dev_id: void pointer to the ttc_timer instance | ||
128 | * | ||
129 | * returns: Always IRQ_HANDLED - success | ||
130 | **/ | ||
131 | static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id) | ||
132 | { | ||
133 | struct ttc_timer_clockevent *ttce = dev_id; | ||
134 | struct ttc_timer *timer = &ttce->ttc; | ||
135 | |||
136 | /* Acknowledge the interrupt and call event handler */ | ||
137 | __raw_readl(timer->base_addr + TTC_ISR_OFFSET); | ||
138 | |||
139 | ttce->ce.event_handler(&ttce->ce); | ||
140 | |||
141 | return IRQ_HANDLED; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * __ttc_clocksource_read - Reads the timer counter register | ||
146 | * | ||
147 | * returns: Current timer counter register value | ||
148 | **/ | ||
149 | static cycle_t __ttc_clocksource_read(struct clocksource *cs) | ||
150 | { | ||
151 | struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc; | ||
152 | |||
153 | return (cycle_t)__raw_readl(timer->base_addr + | ||
154 | TTC_COUNT_VAL_OFFSET); | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * ttc_set_next_event - Sets the time interval for next event | ||
159 | * | ||
160 | * @cycles: Timer interval ticks | ||
161 | * @evt: Address of clock event instance | ||
162 | * | ||
163 | * returns: Always 0 - success | ||
164 | **/ | ||
165 | static int ttc_set_next_event(unsigned long cycles, | ||
166 | struct clock_event_device *evt) | ||
167 | { | ||
168 | struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); | ||
169 | struct ttc_timer *timer = &ttce->ttc; | ||
170 | |||
171 | ttc_set_interval(timer, cycles); | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * ttc_set_mode - Sets the mode of timer | ||
177 | * | ||
178 | * @mode: Mode to be set | ||
179 | * @evt: Address of clock event instance | ||
180 | **/ | ||
181 | static void ttc_set_mode(enum clock_event_mode mode, | ||
182 | struct clock_event_device *evt) | ||
183 | { | ||
184 | struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); | ||
185 | struct ttc_timer *timer = &ttce->ttc; | ||
186 | u32 ctrl_reg; | ||
187 | |||
188 | switch (mode) { | ||
189 | case CLOCK_EVT_MODE_PERIODIC: | ||
190 | ttc_set_interval(timer, | ||
191 | DIV_ROUND_CLOSEST(clk_get_rate(ttce->ttc.clk), | ||
192 | PRESCALE * HZ)); | ||
193 | break; | ||
194 | case CLOCK_EVT_MODE_ONESHOT: | ||
195 | case CLOCK_EVT_MODE_UNUSED: | ||
196 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
197 | ctrl_reg = __raw_readl(timer->base_addr + | ||
198 | TTC_CNT_CNTRL_OFFSET); | ||
199 | ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; | ||
200 | __raw_writel(ctrl_reg, | ||
201 | timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
202 | break; | ||
203 | case CLOCK_EVT_MODE_RESUME: | ||
204 | ctrl_reg = __raw_readl(timer->base_addr + | ||
205 | TTC_CNT_CNTRL_OFFSET); | ||
206 | ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; | ||
207 | __raw_writel(ctrl_reg, | ||
208 | timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
209 | break; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | static int ttc_rate_change_clocksource_cb(struct notifier_block *nb, | ||
214 | unsigned long event, void *data) | ||
215 | { | ||
216 | struct clk_notifier_data *ndata = data; | ||
217 | struct ttc_timer *ttc = to_ttc_timer(nb); | ||
218 | struct ttc_timer_clocksource *ttccs = container_of(ttc, | ||
219 | struct ttc_timer_clocksource, ttc); | ||
220 | |||
221 | switch (event) { | ||
222 | case POST_RATE_CHANGE: | ||
223 | /* | ||
224 | * Do whatever is necessary to maintain a proper time base | ||
225 | * | ||
226 | * I cannot find a way to adjust the currently used clocksource | ||
227 | * to the new frequency. __clocksource_updatefreq_hz() sounds | ||
228 | * good, but does not work. Not sure what's that missing. | ||
229 | * | ||
230 | * This approach works, but triggers two clocksource switches. | ||
231 | * The first after unregister to clocksource jiffies. And | ||
232 | * another one after the register to the newly registered timer. | ||
233 | * | ||
234 | * Alternatively we could 'waste' another HW timer to ping pong | ||
235 | * between clock sources. That would also use one register and | ||
236 | * one unregister call, but only trigger one clocksource switch | ||
237 | * for the cost of another HW timer used by the OS. | ||
238 | */ | ||
239 | clocksource_unregister(&ttccs->cs); | ||
240 | clocksource_register_hz(&ttccs->cs, | ||
241 | ndata->new_rate / PRESCALE); | ||
242 | /* fall through */ | ||
243 | case PRE_RATE_CHANGE: | ||
244 | case ABORT_RATE_CHANGE: | ||
245 | default: | ||
246 | return NOTIFY_DONE; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) | ||
251 | { | ||
252 | struct ttc_timer_clocksource *ttccs; | ||
253 | int err; | ||
254 | |||
255 | ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); | ||
256 | if (WARN_ON(!ttccs)) | ||
257 | return; | ||
258 | |||
259 | ttccs->ttc.clk = clk; | ||
260 | |||
261 | err = clk_prepare_enable(ttccs->ttc.clk); | ||
262 | if (WARN_ON(err)) { | ||
263 | kfree(ttccs); | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | ttccs->ttc.clk_rate_change_nb.notifier_call = | ||
268 | ttc_rate_change_clocksource_cb; | ||
269 | ttccs->ttc.clk_rate_change_nb.next = NULL; | ||
270 | if (clk_notifier_register(ttccs->ttc.clk, | ||
271 | &ttccs->ttc.clk_rate_change_nb)) | ||
272 | pr_warn("Unable to register clock notifier.\n"); | ||
273 | |||
274 | ttccs->ttc.base_addr = base; | ||
275 | ttccs->cs.name = "ttc_clocksource"; | ||
276 | ttccs->cs.rating = 200; | ||
277 | ttccs->cs.read = __ttc_clocksource_read; | ||
278 | ttccs->cs.mask = CLOCKSOURCE_MASK(16); | ||
279 | ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; | ||
280 | |||
281 | /* | ||
282 | * Setup the clock source counter to be an incrementing counter | ||
283 | * with no interrupt and it rolls over at 0xFFFF. Pre-scale | ||
284 | * it by 32 also. Let it start running now. | ||
285 | */ | ||
286 | __raw_writel(0x0, ttccs->ttc.base_addr + TTC_IER_OFFSET); | ||
287 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
288 | ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); | ||
289 | __raw_writel(CNT_CNTRL_RESET, | ||
290 | ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); | ||
291 | |||
292 | err = clocksource_register_hz(&ttccs->cs, | ||
293 | clk_get_rate(ttccs->ttc.clk) / PRESCALE); | ||
294 | if (WARN_ON(err)) { | ||
295 | kfree(ttccs); | ||
296 | return; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | static int ttc_rate_change_clockevent_cb(struct notifier_block *nb, | ||
301 | unsigned long event, void *data) | ||
302 | { | ||
303 | struct clk_notifier_data *ndata = data; | ||
304 | struct ttc_timer *ttc = to_ttc_timer(nb); | ||
305 | struct ttc_timer_clockevent *ttcce = container_of(ttc, | ||
306 | struct ttc_timer_clockevent, ttc); | ||
307 | |||
308 | switch (event) { | ||
309 | case POST_RATE_CHANGE: | ||
310 | { | ||
311 | unsigned long flags; | ||
312 | |||
313 | /* | ||
314 | * clockevents_update_freq should be called with IRQ disabled on | ||
315 | * the CPU the timer provides events for. The timer we use is | ||
316 | * common to both CPUs, not sure if we need to run on both | ||
317 | * cores. | ||
318 | */ | ||
319 | local_irq_save(flags); | ||
320 | clockevents_update_freq(&ttcce->ce, | ||
321 | ndata->new_rate / PRESCALE); | ||
322 | local_irq_restore(flags); | ||
323 | |||
324 | /* fall through */ | ||
325 | } | ||
326 | case PRE_RATE_CHANGE: | ||
327 | case ABORT_RATE_CHANGE: | ||
328 | default: | ||
329 | return NOTIFY_DONE; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static void __init ttc_setup_clockevent(struct clk *clk, | ||
334 | void __iomem *base, u32 irq) | ||
335 | { | ||
336 | struct ttc_timer_clockevent *ttcce; | ||
337 | int err; | ||
338 | |||
339 | ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); | ||
340 | if (WARN_ON(!ttcce)) | ||
341 | return; | ||
342 | |||
343 | ttcce->ttc.clk = clk; | ||
344 | |||
345 | err = clk_prepare_enable(ttcce->ttc.clk); | ||
346 | if (WARN_ON(err)) { | ||
347 | kfree(ttcce); | ||
348 | return; | ||
349 | } | ||
350 | |||
351 | ttcce->ttc.clk_rate_change_nb.notifier_call = | ||
352 | ttc_rate_change_clockevent_cb; | ||
353 | ttcce->ttc.clk_rate_change_nb.next = NULL; | ||
354 | if (clk_notifier_register(ttcce->ttc.clk, | ||
355 | &ttcce->ttc.clk_rate_change_nb)) | ||
356 | pr_warn("Unable to register clock notifier.\n"); | ||
357 | |||
358 | ttcce->ttc.base_addr = base; | ||
359 | ttcce->ce.name = "ttc_clockevent"; | ||
360 | ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
361 | ttcce->ce.set_next_event = ttc_set_next_event; | ||
362 | ttcce->ce.set_mode = ttc_set_mode; | ||
363 | ttcce->ce.rating = 200; | ||
364 | ttcce->ce.irq = irq; | ||
365 | ttcce->ce.cpumask = cpu_possible_mask; | ||
366 | |||
367 | /* | ||
368 | * Setup the clock event timer to be an interval timer which | ||
369 | * is prescaled by 32 using the interval interrupt. Leave it | ||
370 | * disabled for now. | ||
371 | */ | ||
372 | __raw_writel(0x23, ttcce->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); | ||
373 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
374 | ttcce->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); | ||
375 | __raw_writel(0x1, ttcce->ttc.base_addr + TTC_IER_OFFSET); | ||
376 | |||
377 | err = request_irq(irq, ttc_clock_event_interrupt, | ||
378 | IRQF_DISABLED | IRQF_TIMER, | ||
379 | ttcce->ce.name, ttcce); | ||
380 | if (WARN_ON(err)) { | ||
381 | kfree(ttcce); | ||
382 | return; | ||
383 | } | ||
384 | |||
385 | clockevents_config_and_register(&ttcce->ce, | ||
386 | clk_get_rate(ttcce->ttc.clk) / PRESCALE, 1, 0xfffe); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * ttc_timer_init - Initialize the timer | ||
391 | * | ||
392 | * Initializes the timer hardware and register the clock source and clock event | ||
393 | * timers with Linux kernal timer framework | ||
394 | */ | ||
395 | static void __init ttc_timer_init(struct device_node *timer) | ||
396 | { | ||
397 | unsigned int irq; | ||
398 | void __iomem *timer_baseaddr; | ||
399 | struct clk *clk; | ||
400 | static int initialized; | ||
401 | |||
402 | if (initialized) | ||
403 | return; | ||
404 | |||
405 | initialized = 1; | ||
406 | |||
407 | /* | ||
408 | * Get the 1st Triple Timer Counter (TTC) block from the device tree | ||
409 | * and use it. Note that the event timer uses the interrupt and it's the | ||
410 | * 2nd TTC hence the irq_of_parse_and_map(,1) | ||
411 | */ | ||
412 | timer_baseaddr = of_iomap(timer, 0); | ||
413 | if (!timer_baseaddr) { | ||
414 | pr_err("ERROR: invalid timer base address\n"); | ||
415 | BUG(); | ||
416 | } | ||
417 | |||
418 | irq = irq_of_parse_and_map(timer, 1); | ||
419 | if (irq <= 0) { | ||
420 | pr_err("ERROR: invalid interrupt number\n"); | ||
421 | BUG(); | ||
422 | } | ||
423 | |||
424 | clk = of_clk_get_by_name(timer, "cpu_1x"); | ||
425 | if (IS_ERR(clk)) { | ||
426 | pr_err("ERROR: timer input clock not found\n"); | ||
427 | BUG(); | ||
428 | } | ||
429 | |||
430 | ttc_setup_clocksource(clk, timer_baseaddr); | ||
431 | ttc_setup_clockevent(clk, timer_baseaddr + 4, irq); | ||
432 | |||
433 | pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq); | ||
434 | } | ||
435 | |||
436 | CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init); | ||
diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c index e6a553cb73e8..4329a29a5310 100644 --- a/drivers/clocksource/em_sti.c +++ b/drivers/clocksource/em_sti.c | |||
@@ -399,7 +399,18 @@ static struct platform_driver em_sti_device_driver = { | |||
399 | } | 399 | } |
400 | }; | 400 | }; |
401 | 401 | ||
402 | module_platform_driver(em_sti_device_driver); | 402 | static int __init em_sti_init(void) |
403 | { | ||
404 | return platform_driver_register(&em_sti_device_driver); | ||
405 | } | ||
406 | |||
407 | static void __exit em_sti_exit(void) | ||
408 | { | ||
409 | platform_driver_unregister(&em_sti_device_driver); | ||
410 | } | ||
411 | |||
412 | subsys_initcall(em_sti_init); | ||
413 | module_exit(em_sti_exit); | ||
403 | 414 | ||
404 | MODULE_AUTHOR("Magnus Damm"); | 415 | MODULE_AUTHOR("Magnus Damm"); |
405 | MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver"); | 416 | MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver"); |
diff --git a/arch/arm/mach-exynos/mct.c b/drivers/clocksource/exynos_mct.c index c9d6650f9b5d..661026834b23 100644 --- a/arch/arm/mach-exynos/mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -20,6 +20,9 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/of_address.h> | ||
25 | #include <linux/clocksource.h> | ||
23 | 26 | ||
24 | #include <asm/arch_timer.h> | 27 | #include <asm/arch_timer.h> |
25 | #include <asm/localtimer.h> | 28 | #include <asm/localtimer.h> |
@@ -28,9 +31,36 @@ | |||
28 | 31 | ||
29 | #include <mach/map.h> | 32 | #include <mach/map.h> |
30 | #include <mach/irqs.h> | 33 | #include <mach/irqs.h> |
31 | #include <mach/regs-mct.h> | ||
32 | #include <asm/mach/time.h> | 34 | #include <asm/mach/time.h> |
33 | 35 | ||
36 | #define EXYNOS4_MCTREG(x) (x) | ||
37 | #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) | ||
38 | #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) | ||
39 | #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) | ||
40 | #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) | ||
41 | #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) | ||
42 | #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) | ||
43 | #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) | ||
44 | #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) | ||
45 | #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) | ||
46 | #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) | ||
47 | #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) | ||
48 | #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) | ||
49 | #define EXYNOS4_MCT_L_MASK (0xffffff00) | ||
50 | |||
51 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
52 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
53 | #define MCT_L_TCON_OFFSET (0x20) | ||
54 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
55 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
56 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
57 | #define MCT_G_TCON_START (1 << 8) | ||
58 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
59 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
60 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
61 | #define MCT_L_TCON_INT_START (1 << 1) | ||
62 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
63 | |||
34 | #define TICK_BASE_CNT 1 | 64 | #define TICK_BASE_CNT 1 |
35 | 65 | ||
36 | enum { | 66 | enum { |
@@ -38,64 +68,75 @@ enum { | |||
38 | MCT_INT_PPI | 68 | MCT_INT_PPI |
39 | }; | 69 | }; |
40 | 70 | ||
71 | enum { | ||
72 | MCT_G0_IRQ, | ||
73 | MCT_G1_IRQ, | ||
74 | MCT_G2_IRQ, | ||
75 | MCT_G3_IRQ, | ||
76 | MCT_L0_IRQ, | ||
77 | MCT_L1_IRQ, | ||
78 | MCT_L2_IRQ, | ||
79 | MCT_L3_IRQ, | ||
80 | MCT_NR_IRQS, | ||
81 | }; | ||
82 | |||
83 | static void __iomem *reg_base; | ||
41 | static unsigned long clk_rate; | 84 | static unsigned long clk_rate; |
42 | static unsigned int mct_int_type; | 85 | static unsigned int mct_int_type; |
86 | static int mct_irqs[MCT_NR_IRQS]; | ||
43 | 87 | ||
44 | struct mct_clock_event_device { | 88 | struct mct_clock_event_device { |
45 | struct clock_event_device *evt; | 89 | struct clock_event_device *evt; |
46 | void __iomem *base; | 90 | unsigned long base; |
47 | char name[10]; | 91 | char name[10]; |
48 | }; | 92 | }; |
49 | 93 | ||
50 | static void exynos4_mct_write(unsigned int value, void *addr) | 94 | static void exynos4_mct_write(unsigned int value, unsigned long offset) |
51 | { | 95 | { |
52 | void __iomem *stat_addr; | 96 | unsigned long stat_addr; |
53 | u32 mask; | 97 | u32 mask; |
54 | u32 i; | 98 | u32 i; |
55 | 99 | ||
56 | __raw_writel(value, addr); | 100 | __raw_writel(value, reg_base + offset); |
57 | 101 | ||
58 | if (likely(addr >= EXYNOS4_MCT_L_BASE(0))) { | 102 | if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { |
59 | u32 base = (u32) addr & EXYNOS4_MCT_L_MASK; | 103 | stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; |
60 | switch ((u32) addr & ~EXYNOS4_MCT_L_MASK) { | 104 | switch (offset & EXYNOS4_MCT_L_MASK) { |
61 | case (u32) MCT_L_TCON_OFFSET: | 105 | case MCT_L_TCON_OFFSET: |
62 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
63 | mask = 1 << 3; /* L_TCON write status */ | 106 | mask = 1 << 3; /* L_TCON write status */ |
64 | break; | 107 | break; |
65 | case (u32) MCT_L_ICNTB_OFFSET: | 108 | case MCT_L_ICNTB_OFFSET: |
66 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
67 | mask = 1 << 1; /* L_ICNTB write status */ | 109 | mask = 1 << 1; /* L_ICNTB write status */ |
68 | break; | 110 | break; |
69 | case (u32) MCT_L_TCNTB_OFFSET: | 111 | case MCT_L_TCNTB_OFFSET: |
70 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
71 | mask = 1 << 0; /* L_TCNTB write status */ | 112 | mask = 1 << 0; /* L_TCNTB write status */ |
72 | break; | 113 | break; |
73 | default: | 114 | default: |
74 | return; | 115 | return; |
75 | } | 116 | } |
76 | } else { | 117 | } else { |
77 | switch ((u32) addr) { | 118 | switch (offset) { |
78 | case (u32) EXYNOS4_MCT_G_TCON: | 119 | case EXYNOS4_MCT_G_TCON: |
79 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 120 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
80 | mask = 1 << 16; /* G_TCON write status */ | 121 | mask = 1 << 16; /* G_TCON write status */ |
81 | break; | 122 | break; |
82 | case (u32) EXYNOS4_MCT_G_COMP0_L: | 123 | case EXYNOS4_MCT_G_COMP0_L: |
83 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 124 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
84 | mask = 1 << 0; /* G_COMP0_L write status */ | 125 | mask = 1 << 0; /* G_COMP0_L write status */ |
85 | break; | 126 | break; |
86 | case (u32) EXYNOS4_MCT_G_COMP0_U: | 127 | case EXYNOS4_MCT_G_COMP0_U: |
87 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 128 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
88 | mask = 1 << 1; /* G_COMP0_U write status */ | 129 | mask = 1 << 1; /* G_COMP0_U write status */ |
89 | break; | 130 | break; |
90 | case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR: | 131 | case EXYNOS4_MCT_G_COMP0_ADD_INCR: |
91 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 132 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
92 | mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ | 133 | mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ |
93 | break; | 134 | break; |
94 | case (u32) EXYNOS4_MCT_G_CNT_L: | 135 | case EXYNOS4_MCT_G_CNT_L: |
95 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | 136 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; |
96 | mask = 1 << 0; /* G_CNT_L write status */ | 137 | mask = 1 << 0; /* G_CNT_L write status */ |
97 | break; | 138 | break; |
98 | case (u32) EXYNOS4_MCT_G_CNT_U: | 139 | case EXYNOS4_MCT_G_CNT_U: |
99 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | 140 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; |
100 | mask = 1 << 1; /* G_CNT_U write status */ | 141 | mask = 1 << 1; /* G_CNT_U write status */ |
101 | break; | 142 | break; |
@@ -106,12 +147,12 @@ static void exynos4_mct_write(unsigned int value, void *addr) | |||
106 | 147 | ||
107 | /* Wait maximum 1 ms until written values are applied */ | 148 | /* Wait maximum 1 ms until written values are applied */ |
108 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) | 149 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) |
109 | if (__raw_readl(stat_addr) & mask) { | 150 | if (__raw_readl(reg_base + stat_addr) & mask) { |
110 | __raw_writel(mask, stat_addr); | 151 | __raw_writel(mask, reg_base + stat_addr); |
111 | return; | 152 | return; |
112 | } | 153 | } |
113 | 154 | ||
114 | panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr); | 155 | panic("MCT hangs after writing %d (offset:0x%lx)\n", value, offset); |
115 | } | 156 | } |
116 | 157 | ||
117 | /* Clocksource handling */ | 158 | /* Clocksource handling */ |
@@ -122,7 +163,7 @@ static void exynos4_mct_frc_start(u32 hi, u32 lo) | |||
122 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | 163 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); |
123 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | 164 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); |
124 | 165 | ||
125 | reg = __raw_readl(EXYNOS4_MCT_G_TCON); | 166 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
126 | reg |= MCT_G_TCON_START; | 167 | reg |= MCT_G_TCON_START; |
127 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | 168 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); |
128 | } | 169 | } |
@@ -130,12 +171,12 @@ static void exynos4_mct_frc_start(u32 hi, u32 lo) | |||
130 | static cycle_t exynos4_frc_read(struct clocksource *cs) | 171 | static cycle_t exynos4_frc_read(struct clocksource *cs) |
131 | { | 172 | { |
132 | unsigned int lo, hi; | 173 | unsigned int lo, hi; |
133 | u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | 174 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
134 | 175 | ||
135 | do { | 176 | do { |
136 | hi = hi2; | 177 | hi = hi2; |
137 | lo = __raw_readl(EXYNOS4_MCT_G_CNT_L); | 178 | lo = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_L); |
138 | hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | 179 | hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
139 | } while (hi != hi2); | 180 | } while (hi != hi2); |
140 | 181 | ||
141 | return ((cycle_t)hi << 32) | lo; | 182 | return ((cycle_t)hi << 32) | lo; |
@@ -167,7 +208,7 @@ static void exynos4_mct_comp0_stop(void) | |||
167 | { | 208 | { |
168 | unsigned int tcon; | 209 | unsigned int tcon; |
169 | 210 | ||
170 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | 211 | tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
171 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); | 212 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); |
172 | 213 | ||
173 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); | 214 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); |
@@ -180,7 +221,7 @@ static void exynos4_mct_comp0_start(enum clock_event_mode mode, | |||
180 | unsigned int tcon; | 221 | unsigned int tcon; |
181 | cycle_t comp_cycle; | 222 | cycle_t comp_cycle; |
182 | 223 | ||
183 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | 224 | tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
184 | 225 | ||
185 | if (mode == CLOCK_EVT_MODE_PERIODIC) { | 226 | if (mode == CLOCK_EVT_MODE_PERIODIC) { |
186 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; | 227 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; |
@@ -257,11 +298,7 @@ static void exynos4_clockevent_init(void) | |||
257 | mct_comp_device.cpumask = cpumask_of(0); | 298 | mct_comp_device.cpumask = cpumask_of(0); |
258 | clockevents_config_and_register(&mct_comp_device, clk_rate, | 299 | clockevents_config_and_register(&mct_comp_device, clk_rate, |
259 | 0xf, 0xffffffff); | 300 | 0xf, 0xffffffff); |
260 | 301 | setup_irq(mct_irqs[MCT_G0_IRQ], &mct_comp_event_irq); | |
261 | if (soc_is_exynos5250()) | ||
262 | setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq); | ||
263 | else | ||
264 | setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq); | ||
265 | } | 302 | } |
266 | 303 | ||
267 | #ifdef CONFIG_LOCAL_TIMERS | 304 | #ifdef CONFIG_LOCAL_TIMERS |
@@ -273,12 +310,12 @@ static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | |||
273 | { | 310 | { |
274 | unsigned long tmp; | 311 | unsigned long tmp; |
275 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; | 312 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; |
276 | void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET; | 313 | unsigned long offset = mevt->base + MCT_L_TCON_OFFSET; |
277 | 314 | ||
278 | tmp = __raw_readl(addr); | 315 | tmp = __raw_readl(reg_base + offset); |
279 | if (tmp & mask) { | 316 | if (tmp & mask) { |
280 | tmp &= ~mask; | 317 | tmp &= ~mask; |
281 | exynos4_mct_write(tmp, addr); | 318 | exynos4_mct_write(tmp, offset); |
282 | } | 319 | } |
283 | } | 320 | } |
284 | 321 | ||
@@ -297,7 +334,7 @@ static void exynos4_mct_tick_start(unsigned long cycles, | |||
297 | /* enable MCT tick interrupt */ | 334 | /* enable MCT tick interrupt */ |
298 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); | 335 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); |
299 | 336 | ||
300 | tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); | 337 | tmp = __raw_readl(reg_base + mevt->base + MCT_L_TCON_OFFSET); |
301 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | | 338 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | |
302 | MCT_L_TCON_INTERVAL_MODE; | 339 | MCT_L_TCON_INTERVAL_MODE; |
303 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); | 340 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); |
@@ -349,7 +386,7 @@ static int exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) | |||
349 | exynos4_mct_tick_stop(mevt); | 386 | exynos4_mct_tick_stop(mevt); |
350 | 387 | ||
351 | /* Clear the MCT tick interrupt */ | 388 | /* Clear the MCT tick interrupt */ |
352 | if (__raw_readl(mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { | 389 | if (__raw_readl(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { |
353 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); | 390 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); |
354 | return 1; | 391 | return 1; |
355 | } else { | 392 | } else { |
@@ -385,7 +422,6 @@ static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) | |||
385 | { | 422 | { |
386 | struct mct_clock_event_device *mevt; | 423 | struct mct_clock_event_device *mevt; |
387 | unsigned int cpu = smp_processor_id(); | 424 | unsigned int cpu = smp_processor_id(); |
388 | int mct_lx_irq; | ||
389 | 425 | ||
390 | mevt = this_cpu_ptr(&percpu_mct_tick); | 426 | mevt = this_cpu_ptr(&percpu_mct_tick); |
391 | mevt->evt = evt; | 427 | mevt->evt = evt; |
@@ -406,21 +442,17 @@ static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) | |||
406 | 442 | ||
407 | if (mct_int_type == MCT_INT_SPI) { | 443 | if (mct_int_type == MCT_INT_SPI) { |
408 | if (cpu == 0) { | 444 | if (cpu == 0) { |
409 | mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L0 : | ||
410 | EXYNOS5_IRQ_MCT_L0; | ||
411 | mct_tick0_event_irq.dev_id = mevt; | 445 | mct_tick0_event_irq.dev_id = mevt; |
412 | evt->irq = mct_lx_irq; | 446 | evt->irq = mct_irqs[MCT_L0_IRQ]; |
413 | setup_irq(mct_lx_irq, &mct_tick0_event_irq); | 447 | setup_irq(evt->irq, &mct_tick0_event_irq); |
414 | } else { | 448 | } else { |
415 | mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L1 : | ||
416 | EXYNOS5_IRQ_MCT_L1; | ||
417 | mct_tick1_event_irq.dev_id = mevt; | 449 | mct_tick1_event_irq.dev_id = mevt; |
418 | evt->irq = mct_lx_irq; | 450 | evt->irq = mct_irqs[MCT_L1_IRQ]; |
419 | setup_irq(mct_lx_irq, &mct_tick1_event_irq); | 451 | setup_irq(evt->irq, &mct_tick1_event_irq); |
420 | irq_set_affinity(mct_lx_irq, cpumask_of(1)); | 452 | irq_set_affinity(evt->irq, cpumask_of(1)); |
421 | } | 453 | } |
422 | } else { | 454 | } else { |
423 | enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0); | 455 | enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); |
424 | } | 456 | } |
425 | 457 | ||
426 | return 0; | 458 | return 0; |
@@ -436,7 +468,7 @@ static void exynos4_local_timer_stop(struct clock_event_device *evt) | |||
436 | else | 468 | else |
437 | remove_irq(evt->irq, &mct_tick1_event_irq); | 469 | remove_irq(evt->irq, &mct_tick1_event_irq); |
438 | else | 470 | else |
439 | disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER); | 471 | disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); |
440 | } | 472 | } |
441 | 473 | ||
442 | static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { | 474 | static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { |
@@ -445,41 +477,92 @@ static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { | |||
445 | }; | 477 | }; |
446 | #endif /* CONFIG_LOCAL_TIMERS */ | 478 | #endif /* CONFIG_LOCAL_TIMERS */ |
447 | 479 | ||
448 | static void __init exynos4_timer_resources(void) | 480 | static void __init exynos4_timer_resources(struct device_node *np, void __iomem *base) |
449 | { | 481 | { |
450 | struct clk *mct_clk; | 482 | struct clk *mct_clk, *tick_clk; |
451 | mct_clk = clk_get(NULL, "xtal"); | 483 | |
484 | tick_clk = np ? of_clk_get_by_name(np, "fin_pll") : | ||
485 | clk_get(NULL, "fin_pll"); | ||
486 | if (IS_ERR(tick_clk)) | ||
487 | panic("%s: unable to determine tick clock rate\n", __func__); | ||
488 | clk_rate = clk_get_rate(tick_clk); | ||
452 | 489 | ||
453 | clk_rate = clk_get_rate(mct_clk); | 490 | mct_clk = np ? of_clk_get_by_name(np, "mct") : clk_get(NULL, "mct"); |
491 | if (IS_ERR(mct_clk)) | ||
492 | panic("%s: unable to retrieve mct clock instance\n", __func__); | ||
493 | clk_prepare_enable(mct_clk); | ||
494 | |||
495 | reg_base = base; | ||
496 | if (!reg_base) | ||
497 | panic("%s: unable to ioremap mct address space\n", __func__); | ||
454 | 498 | ||
455 | #ifdef CONFIG_LOCAL_TIMERS | 499 | #ifdef CONFIG_LOCAL_TIMERS |
456 | if (mct_int_type == MCT_INT_PPI) { | 500 | if (mct_int_type == MCT_INT_PPI) { |
457 | int err; | 501 | int err; |
458 | 502 | ||
459 | err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, | 503 | err = request_percpu_irq(mct_irqs[MCT_L0_IRQ], |
460 | exynos4_mct_tick_isr, "MCT", | 504 | exynos4_mct_tick_isr, "MCT", |
461 | &percpu_mct_tick); | 505 | &percpu_mct_tick); |
462 | WARN(err, "MCT: can't request IRQ %d (%d)\n", | 506 | WARN(err, "MCT: can't request IRQ %d (%d)\n", |
463 | EXYNOS_IRQ_MCT_LOCALTIMER, err); | 507 | mct_irqs[MCT_L0_IRQ], err); |
464 | } | 508 | } |
465 | 509 | ||
466 | local_timer_register(&exynos4_mct_tick_ops); | 510 | local_timer_register(&exynos4_mct_tick_ops); |
467 | #endif /* CONFIG_LOCAL_TIMERS */ | 511 | #endif /* CONFIG_LOCAL_TIMERS */ |
468 | } | 512 | } |
469 | 513 | ||
470 | void __init exynos4_timer_init(void) | 514 | void __init mct_init(void) |
471 | { | 515 | { |
472 | if (soc_is_exynos5440()) { | 516 | if (soc_is_exynos4210()) { |
473 | arch_timer_of_register(); | 517 | mct_irqs[MCT_G0_IRQ] = EXYNOS4_IRQ_MCT_G0; |
474 | return; | 518 | mct_irqs[MCT_L0_IRQ] = EXYNOS4_IRQ_MCT_L0; |
519 | mct_irqs[MCT_L1_IRQ] = EXYNOS4_IRQ_MCT_L1; | ||
520 | mct_int_type = MCT_INT_SPI; | ||
521 | } else { | ||
522 | panic("unable to determine mct controller type\n"); | ||
475 | } | 523 | } |
476 | 524 | ||
477 | if ((soc_is_exynos4210()) || (soc_is_exynos5250())) | 525 | exynos4_timer_resources(NULL, S5P_VA_SYSTIMER); |
478 | mct_int_type = MCT_INT_SPI; | 526 | exynos4_clocksource_init(); |
479 | else | 527 | exynos4_clockevent_init(); |
480 | mct_int_type = MCT_INT_PPI; | 528 | } |
529 | |||
530 | static void __init mct_init_dt(struct device_node *np, unsigned int int_type) | ||
531 | { | ||
532 | u32 nr_irqs, i; | ||
533 | |||
534 | mct_int_type = int_type; | ||
481 | 535 | ||
482 | exynos4_timer_resources(); | 536 | /* This driver uses only one global timer interrupt */ |
537 | mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); | ||
538 | |||
539 | /* | ||
540 | * Find out the number of local irqs specified. The local | ||
541 | * timer irqs are specified after the four global timer | ||
542 | * irqs are specified. | ||
543 | */ | ||
544 | #ifdef CONFIG_OF | ||
545 | nr_irqs = of_irq_count(np); | ||
546 | #else | ||
547 | nr_irqs = 0; | ||
548 | #endif | ||
549 | for (i = MCT_L0_IRQ; i < nr_irqs; i++) | ||
550 | mct_irqs[i] = irq_of_parse_and_map(np, i); | ||
551 | |||
552 | exynos4_timer_resources(np, of_iomap(np, 0)); | ||
483 | exynos4_clocksource_init(); | 553 | exynos4_clocksource_init(); |
484 | exynos4_clockevent_init(); | 554 | exynos4_clockevent_init(); |
485 | } | 555 | } |
556 | |||
557 | |||
558 | static void __init mct_init_spi(struct device_node *np) | ||
559 | { | ||
560 | return mct_init_dt(np, MCT_INT_SPI); | ||
561 | } | ||
562 | |||
563 | static void __init mct_init_ppi(struct device_node *np) | ||
564 | { | ||
565 | return mct_init_dt(np, MCT_INT_PPI); | ||
566 | } | ||
567 | CLOCKSOURCE_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init_spi); | ||
568 | CLOCKSOURCE_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init_ppi); | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 488c14cc8dbf..08d0c418c94a 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -54,62 +54,100 @@ struct sh_cmt_priv { | |||
54 | struct clocksource cs; | 54 | struct clocksource cs; |
55 | unsigned long total_cycles; | 55 | unsigned long total_cycles; |
56 | bool cs_enabled; | 56 | bool cs_enabled; |
57 | |||
58 | /* callbacks for CMSTR and CMCSR access */ | ||
59 | unsigned long (*read_control)(void __iomem *base, unsigned long offs); | ||
60 | void (*write_control)(void __iomem *base, unsigned long offs, | ||
61 | unsigned long value); | ||
62 | |||
63 | /* callbacks for CMCNT and CMCOR access */ | ||
64 | unsigned long (*read_count)(void __iomem *base, unsigned long offs); | ||
65 | void (*write_count)(void __iomem *base, unsigned long offs, | ||
66 | unsigned long value); | ||
57 | }; | 67 | }; |
58 | 68 | ||
59 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); | 69 | /* Examples of supported CMT timer register layouts and I/O access widths: |
70 | * | ||
71 | * "16-bit counter and 16-bit control" as found on sh7263: | ||
72 | * CMSTR 0xfffec000 16-bit | ||
73 | * CMCSR 0xfffec002 16-bit | ||
74 | * CMCNT 0xfffec004 16-bit | ||
75 | * CMCOR 0xfffec006 16-bit | ||
76 | * | ||
77 | * "32-bit counter and 16-bit control" as found on sh7372, sh73a0, r8a7740: | ||
78 | * CMSTR 0xffca0000 16-bit | ||
79 | * CMCSR 0xffca0060 16-bit | ||
80 | * CMCNT 0xffca0064 32-bit | ||
81 | * CMCOR 0xffca0068 32-bit | ||
82 | */ | ||
83 | |||
84 | static unsigned long sh_cmt_read16(void __iomem *base, unsigned long offs) | ||
85 | { | ||
86 | return ioread16(base + (offs << 1)); | ||
87 | } | ||
88 | |||
89 | static unsigned long sh_cmt_read32(void __iomem *base, unsigned long offs) | ||
90 | { | ||
91 | return ioread32(base + (offs << 2)); | ||
92 | } | ||
93 | |||
94 | static void sh_cmt_write16(void __iomem *base, unsigned long offs, | ||
95 | unsigned long value) | ||
96 | { | ||
97 | iowrite16(value, base + (offs << 1)); | ||
98 | } | ||
99 | |||
100 | static void sh_cmt_write32(void __iomem *base, unsigned long offs, | ||
101 | unsigned long value) | ||
102 | { | ||
103 | iowrite32(value, base + (offs << 2)); | ||
104 | } | ||
60 | 105 | ||
61 | #define CMSTR -1 /* shared register */ | ||
62 | #define CMCSR 0 /* channel register */ | 106 | #define CMCSR 0 /* channel register */ |
63 | #define CMCNT 1 /* channel register */ | 107 | #define CMCNT 1 /* channel register */ |
64 | #define CMCOR 2 /* channel register */ | 108 | #define CMCOR 2 /* channel register */ |
65 | 109 | ||
66 | static inline unsigned long sh_cmt_read(struct sh_cmt_priv *p, int reg_nr) | 110 | static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_priv *p) |
67 | { | 111 | { |
68 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | 112 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; |
69 | void __iomem *base = p->mapbase; | ||
70 | unsigned long offs; | ||
71 | |||
72 | if (reg_nr == CMSTR) { | ||
73 | offs = 0; | ||
74 | base -= cfg->channel_offset; | ||
75 | } else | ||
76 | offs = reg_nr; | ||
77 | |||
78 | if (p->width == 16) | ||
79 | offs <<= 1; | ||
80 | else { | ||
81 | offs <<= 2; | ||
82 | if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) | ||
83 | return ioread32(base + offs); | ||
84 | } | ||
85 | 113 | ||
86 | return ioread16(base + offs); | 114 | return p->read_control(p->mapbase - cfg->channel_offset, 0); |
87 | } | 115 | } |
88 | 116 | ||
89 | static inline void sh_cmt_write(struct sh_cmt_priv *p, int reg_nr, | 117 | static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_priv *p) |
90 | unsigned long value) | 118 | { |
119 | return p->read_control(p->mapbase, CMCSR); | ||
120 | } | ||
121 | |||
122 | static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_priv *p) | ||
123 | { | ||
124 | return p->read_count(p->mapbase, CMCNT); | ||
125 | } | ||
126 | |||
127 | static inline void sh_cmt_write_cmstr(struct sh_cmt_priv *p, | ||
128 | unsigned long value) | ||
91 | { | 129 | { |
92 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | 130 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; |
93 | void __iomem *base = p->mapbase; | ||
94 | unsigned long offs; | ||
95 | |||
96 | if (reg_nr == CMSTR) { | ||
97 | offs = 0; | ||
98 | base -= cfg->channel_offset; | ||
99 | } else | ||
100 | offs = reg_nr; | ||
101 | |||
102 | if (p->width == 16) | ||
103 | offs <<= 1; | ||
104 | else { | ||
105 | offs <<= 2; | ||
106 | if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) { | ||
107 | iowrite32(value, base + offs); | ||
108 | return; | ||
109 | } | ||
110 | } | ||
111 | 131 | ||
112 | iowrite16(value, base + offs); | 132 | p->write_control(p->mapbase - cfg->channel_offset, 0, value); |
133 | } | ||
134 | |||
135 | static inline void sh_cmt_write_cmcsr(struct sh_cmt_priv *p, | ||
136 | unsigned long value) | ||
137 | { | ||
138 | p->write_control(p->mapbase, CMCSR, value); | ||
139 | } | ||
140 | |||
141 | static inline void sh_cmt_write_cmcnt(struct sh_cmt_priv *p, | ||
142 | unsigned long value) | ||
143 | { | ||
144 | p->write_count(p->mapbase, CMCNT, value); | ||
145 | } | ||
146 | |||
147 | static inline void sh_cmt_write_cmcor(struct sh_cmt_priv *p, | ||
148 | unsigned long value) | ||
149 | { | ||
150 | p->write_count(p->mapbase, CMCOR, value); | ||
113 | } | 151 | } |
114 | 152 | ||
115 | static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | 153 | static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, |
@@ -118,15 +156,15 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | |||
118 | unsigned long v1, v2, v3; | 156 | unsigned long v1, v2, v3; |
119 | int o1, o2; | 157 | int o1, o2; |
120 | 158 | ||
121 | o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; | 159 | o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; |
122 | 160 | ||
123 | /* Make sure the timer value is stable. Stolen from acpi_pm.c */ | 161 | /* Make sure the timer value is stable. Stolen from acpi_pm.c */ |
124 | do { | 162 | do { |
125 | o2 = o1; | 163 | o2 = o1; |
126 | v1 = sh_cmt_read(p, CMCNT); | 164 | v1 = sh_cmt_read_cmcnt(p); |
127 | v2 = sh_cmt_read(p, CMCNT); | 165 | v2 = sh_cmt_read_cmcnt(p); |
128 | v3 = sh_cmt_read(p, CMCNT); | 166 | v3 = sh_cmt_read_cmcnt(p); |
129 | o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; | 167 | o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; |
130 | } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) | 168 | } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) |
131 | || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); | 169 | || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); |
132 | 170 | ||
@@ -134,6 +172,7 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | |||
134 | return v2; | 172 | return v2; |
135 | } | 173 | } |
136 | 174 | ||
175 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); | ||
137 | 176 | ||
138 | static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | 177 | static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) |
139 | { | 178 | { |
@@ -142,14 +181,14 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
142 | 181 | ||
143 | /* start stop register shared by multiple timer channels */ | 182 | /* start stop register shared by multiple timer channels */ |
144 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); | 183 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); |
145 | value = sh_cmt_read(p, CMSTR); | 184 | value = sh_cmt_read_cmstr(p); |
146 | 185 | ||
147 | if (start) | 186 | if (start) |
148 | value |= 1 << cfg->timer_bit; | 187 | value |= 1 << cfg->timer_bit; |
149 | else | 188 | else |
150 | value &= ~(1 << cfg->timer_bit); | 189 | value &= ~(1 << cfg->timer_bit); |
151 | 190 | ||
152 | sh_cmt_write(p, CMSTR, value); | 191 | sh_cmt_write_cmstr(p, value); |
153 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); | 192 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); |
154 | } | 193 | } |
155 | 194 | ||
@@ -173,14 +212,14 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
173 | /* configure channel, periodic mode and maximum timeout */ | 212 | /* configure channel, periodic mode and maximum timeout */ |
174 | if (p->width == 16) { | 213 | if (p->width == 16) { |
175 | *rate = clk_get_rate(p->clk) / 512; | 214 | *rate = clk_get_rate(p->clk) / 512; |
176 | sh_cmt_write(p, CMCSR, 0x43); | 215 | sh_cmt_write_cmcsr(p, 0x43); |
177 | } else { | 216 | } else { |
178 | *rate = clk_get_rate(p->clk) / 8; | 217 | *rate = clk_get_rate(p->clk) / 8; |
179 | sh_cmt_write(p, CMCSR, 0x01a4); | 218 | sh_cmt_write_cmcsr(p, 0x01a4); |
180 | } | 219 | } |
181 | 220 | ||
182 | sh_cmt_write(p, CMCOR, 0xffffffff); | 221 | sh_cmt_write_cmcor(p, 0xffffffff); |
183 | sh_cmt_write(p, CMCNT, 0); | 222 | sh_cmt_write_cmcnt(p, 0); |
184 | 223 | ||
185 | /* | 224 | /* |
186 | * According to the sh73a0 user's manual, as CMCNT can be operated | 225 | * According to the sh73a0 user's manual, as CMCNT can be operated |
@@ -194,12 +233,12 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
194 | * take RCLKx2 at maximum. | 233 | * take RCLKx2 at maximum. |
195 | */ | 234 | */ |
196 | for (k = 0; k < 100; k++) { | 235 | for (k = 0; k < 100; k++) { |
197 | if (!sh_cmt_read(p, CMCNT)) | 236 | if (!sh_cmt_read_cmcnt(p)) |
198 | break; | 237 | break; |
199 | udelay(1); | 238 | udelay(1); |
200 | } | 239 | } |
201 | 240 | ||
202 | if (sh_cmt_read(p, CMCNT)) { | 241 | if (sh_cmt_read_cmcnt(p)) { |
203 | dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); | 242 | dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); |
204 | ret = -ETIMEDOUT; | 243 | ret = -ETIMEDOUT; |
205 | goto err1; | 244 | goto err1; |
@@ -222,7 +261,7 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) | |||
222 | sh_cmt_start_stop_ch(p, 0); | 261 | sh_cmt_start_stop_ch(p, 0); |
223 | 262 | ||
224 | /* disable interrupts in CMT block */ | 263 | /* disable interrupts in CMT block */ |
225 | sh_cmt_write(p, CMCSR, 0); | 264 | sh_cmt_write_cmcsr(p, 0); |
226 | 265 | ||
227 | /* stop clock */ | 266 | /* stop clock */ |
228 | clk_disable(p->clk); | 267 | clk_disable(p->clk); |
@@ -270,7 +309,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, | |||
270 | if (new_match > p->max_match_value) | 309 | if (new_match > p->max_match_value) |
271 | new_match = p->max_match_value; | 310 | new_match = p->max_match_value; |
272 | 311 | ||
273 | sh_cmt_write(p, CMCOR, new_match); | 312 | sh_cmt_write_cmcor(p, new_match); |
274 | 313 | ||
275 | now = sh_cmt_get_counter(p, &has_wrapped); | 314 | now = sh_cmt_get_counter(p, &has_wrapped); |
276 | if (has_wrapped && (new_match > p->match_value)) { | 315 | if (has_wrapped && (new_match > p->match_value)) { |
@@ -346,7 +385,7 @@ static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) | |||
346 | struct sh_cmt_priv *p = dev_id; | 385 | struct sh_cmt_priv *p = dev_id; |
347 | 386 | ||
348 | /* clear flags */ | 387 | /* clear flags */ |
349 | sh_cmt_write(p, CMCSR, sh_cmt_read(p, CMCSR) & p->clear_bits); | 388 | sh_cmt_write_cmcsr(p, sh_cmt_read_cmcsr(p) & p->clear_bits); |
350 | 389 | ||
351 | /* update clock source counter to begin with if enabled | 390 | /* update clock source counter to begin with if enabled |
352 | * the wrap flag should be cleared by the timer specific | 391 | * the wrap flag should be cleared by the timer specific |
@@ -625,14 +664,6 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name, | |||
625 | unsigned long clockevent_rating, | 664 | unsigned long clockevent_rating, |
626 | unsigned long clocksource_rating) | 665 | unsigned long clocksource_rating) |
627 | { | 666 | { |
628 | if (p->width == (sizeof(p->max_match_value) * 8)) | ||
629 | p->max_match_value = ~0; | ||
630 | else | ||
631 | p->max_match_value = (1 << p->width) - 1; | ||
632 | |||
633 | p->match_value = p->max_match_value; | ||
634 | raw_spin_lock_init(&p->lock); | ||
635 | |||
636 | if (clockevent_rating) | 667 | if (clockevent_rating) |
637 | sh_cmt_register_clockevent(p, name, clockevent_rating); | 668 | sh_cmt_register_clockevent(p, name, clockevent_rating); |
638 | 669 | ||
@@ -657,8 +688,6 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
657 | goto err0; | 688 | goto err0; |
658 | } | 689 | } |
659 | 690 | ||
660 | platform_set_drvdata(pdev, p); | ||
661 | |||
662 | res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); | 691 | res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); |
663 | if (!res) { | 692 | if (!res) { |
664 | dev_err(&p->pdev->dev, "failed to get I/O memory\n"); | 693 | dev_err(&p->pdev->dev, "failed to get I/O memory\n"); |
@@ -693,32 +722,51 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
693 | goto err1; | 722 | goto err1; |
694 | } | 723 | } |
695 | 724 | ||
725 | p->read_control = sh_cmt_read16; | ||
726 | p->write_control = sh_cmt_write16; | ||
727 | |||
696 | if (resource_size(res) == 6) { | 728 | if (resource_size(res) == 6) { |
697 | p->width = 16; | 729 | p->width = 16; |
730 | p->read_count = sh_cmt_read16; | ||
731 | p->write_count = sh_cmt_write16; | ||
698 | p->overflow_bit = 0x80; | 732 | p->overflow_bit = 0x80; |
699 | p->clear_bits = ~0x80; | 733 | p->clear_bits = ~0x80; |
700 | } else { | 734 | } else { |
701 | p->width = 32; | 735 | p->width = 32; |
736 | p->read_count = sh_cmt_read32; | ||
737 | p->write_count = sh_cmt_write32; | ||
702 | p->overflow_bit = 0x8000; | 738 | p->overflow_bit = 0x8000; |
703 | p->clear_bits = ~0xc000; | 739 | p->clear_bits = ~0xc000; |
704 | } | 740 | } |
705 | 741 | ||
742 | if (p->width == (sizeof(p->max_match_value) * 8)) | ||
743 | p->max_match_value = ~0; | ||
744 | else | ||
745 | p->max_match_value = (1 << p->width) - 1; | ||
746 | |||
747 | p->match_value = p->max_match_value; | ||
748 | raw_spin_lock_init(&p->lock); | ||
749 | |||
706 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), | 750 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), |
707 | cfg->clockevent_rating, | 751 | cfg->clockevent_rating, |
708 | cfg->clocksource_rating); | 752 | cfg->clocksource_rating); |
709 | if (ret) { | 753 | if (ret) { |
710 | dev_err(&p->pdev->dev, "registration failed\n"); | 754 | dev_err(&p->pdev->dev, "registration failed\n"); |
711 | goto err1; | 755 | goto err2; |
712 | } | 756 | } |
713 | p->cs_enabled = false; | 757 | p->cs_enabled = false; |
714 | 758 | ||
715 | ret = setup_irq(irq, &p->irqaction); | 759 | ret = setup_irq(irq, &p->irqaction); |
716 | if (ret) { | 760 | if (ret) { |
717 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); | 761 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); |
718 | goto err1; | 762 | goto err2; |
719 | } | 763 | } |
720 | 764 | ||
765 | platform_set_drvdata(pdev, p); | ||
766 | |||
721 | return 0; | 767 | return 0; |
768 | err2: | ||
769 | clk_put(p->clk); | ||
722 | 770 | ||
723 | err1: | 771 | err1: |
724 | iounmap(p->mapbase); | 772 | iounmap(p->mapbase); |
@@ -751,7 +799,6 @@ static int sh_cmt_probe(struct platform_device *pdev) | |||
751 | ret = sh_cmt_setup(p, pdev); | 799 | ret = sh_cmt_setup(p, pdev); |
752 | if (ret) { | 800 | if (ret) { |
753 | kfree(p); | 801 | kfree(p); |
754 | platform_set_drvdata(pdev, NULL); | ||
755 | pm_runtime_idle(&pdev->dev); | 802 | pm_runtime_idle(&pdev->dev); |
756 | return ret; | 803 | return ret; |
757 | } | 804 | } |
@@ -791,7 +838,7 @@ static void __exit sh_cmt_exit(void) | |||
791 | } | 838 | } |
792 | 839 | ||
793 | early_platform_init("earlytimer", &sh_cmt_device_driver); | 840 | early_platform_init("earlytimer", &sh_cmt_device_driver); |
794 | module_init(sh_cmt_init); | 841 | subsys_initcall(sh_cmt_init); |
795 | module_exit(sh_cmt_exit); | 842 | module_exit(sh_cmt_exit); |
796 | 843 | ||
797 | MODULE_AUTHOR("Magnus Damm"); | 844 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 83943e27cfac..4aac9ee0d0c0 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -386,7 +386,7 @@ static void __exit sh_mtu2_exit(void) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | early_platform_init("earlytimer", &sh_mtu2_device_driver); | 388 | early_platform_init("earlytimer", &sh_mtu2_device_driver); |
389 | module_init(sh_mtu2_init); | 389 | subsys_initcall(sh_mtu2_init); |
390 | module_exit(sh_mtu2_exit); | 390 | module_exit(sh_mtu2_exit); |
391 | 391 | ||
392 | MODULE_AUTHOR("Magnus Damm"); | 392 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index b4502edce2a1..78b8dae49628 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -549,7 +549,7 @@ static void __exit sh_tmu_exit(void) | |||
549 | } | 549 | } |
550 | 550 | ||
551 | early_platform_init("earlytimer", &sh_tmu_device_driver); | 551 | early_platform_init("earlytimer", &sh_tmu_device_driver); |
552 | module_init(sh_tmu_init); | 552 | subsys_initcall(sh_tmu_init); |
553 | module_exit(sh_tmu_exit); | 553 | module_exit(sh_tmu_exit); |
554 | 554 | ||
555 | MODULE_AUTHOR("Magnus Damm"); | 555 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 93aaadf99f28..b166e30b3bc4 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -227,12 +227,6 @@ config GPIO_TS5500 | |||
227 | blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 | 227 | blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 |
228 | LCD port. | 228 | LCD port. |
229 | 229 | ||
230 | config GPIO_VT8500 | ||
231 | bool "VIA/Wondermedia SoC GPIO Support" | ||
232 | depends on ARCH_VT8500 | ||
233 | help | ||
234 | Say yes here to support the VT8500/WM8505/WM8650 GPIO controller. | ||
235 | |||
236 | config GPIO_XILINX | 230 | config GPIO_XILINX |
237 | bool "Xilinx GPIO support" | 231 | bool "Xilinx GPIO support" |
238 | depends on PPC_OF || MICROBLAZE | 232 | depends on PPC_OF || MICROBLAZE |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 22e07bc9fcb5..a274d7df3c8c 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -80,7 +80,6 @@ obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o | |||
80 | obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o | 80 | obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o |
81 | obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o | 81 | obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o |
82 | obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o | 82 | obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o |
83 | obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o | ||
84 | obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o | 83 | obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o |
85 | obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o | 84 | obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o |
86 | obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o | 85 | obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index b3643ff007e4..99e0fa49fcbd 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -1122,8 +1122,12 @@ int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset) | |||
1122 | #ifdef CONFIG_PLAT_S3C24XX | 1122 | #ifdef CONFIG_PLAT_S3C24XX |
1123 | static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset) | 1123 | static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset) |
1124 | { | 1124 | { |
1125 | if (offset < 4) | 1125 | if (offset < 4) { |
1126 | return IRQ_EINT0 + offset; | 1126 | if (soc_is_s3c2412()) |
1127 | return IRQ_EINT0_2412 + offset; | ||
1128 | else | ||
1129 | return IRQ_EINT0 + offset; | ||
1130 | } | ||
1127 | 1131 | ||
1128 | if (offset < 8) | 1132 | if (offset < 8) |
1129 | return IRQ_EINT4 + offset - 4; | 1133 | return IRQ_EINT4 + offset - 4; |
@@ -3024,6 +3028,7 @@ static __init int samsung_gpiolib_init(void) | |||
3024 | static const struct of_device_id exynos_pinctrl_ids[] = { | 3028 | static const struct of_device_id exynos_pinctrl_ids[] = { |
3025 | { .compatible = "samsung,exynos4210-pinctrl", }, | 3029 | { .compatible = "samsung,exynos4210-pinctrl", }, |
3026 | { .compatible = "samsung,exynos4x12-pinctrl", }, | 3030 | { .compatible = "samsung,exynos4x12-pinctrl", }, |
3031 | { .compatible = "samsung,exynos5250-pinctrl", }, | ||
3027 | { .compatible = "samsung,exynos5440-pinctrl", }, | 3032 | { .compatible = "samsung,exynos5440-pinctrl", }, |
3028 | }; | 3033 | }; |
3029 | for_each_matching_node(pctrl_np, exynos_pinctrl_ids) | 3034 | for_each_matching_node(pctrl_np, exynos_pinctrl_ids) |
diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c deleted file mode 100644 index 81683ca35ac1..000000000000 --- a/drivers/gpio/gpio-vt8500.c +++ /dev/null | |||
@@ -1,355 +0,0 @@ | |||
1 | /* drivers/gpio/gpio-vt8500.c | ||
2 | * | ||
3 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
4 | * Based on arch/arm/mach-vt8500/gpio.c: | ||
5 | * - Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/of.h> | ||
25 | #include <linux/of_address.h> | ||
26 | #include <linux/of_irq.h> | ||
27 | #include <linux/of_device.h> | ||
28 | |||
29 | /* | ||
30 | We handle GPIOs by bank, each bank containing up to 32 GPIOs covered | ||
31 | by one set of registers (although not all may be valid). | ||
32 | |||
33 | Because different SoC's have different register offsets, we pass the | ||
34 | register offsets as data in vt8500_gpio_dt_ids[]. | ||
35 | |||
36 | A value of NO_REG is used to indicate that this register is not | ||
37 | supported. Only used for ->en at the moment. | ||
38 | */ | ||
39 | |||
40 | #define NO_REG 0xFFFF | ||
41 | |||
42 | /* | ||
43 | * struct vt8500_gpio_bank_regoffsets | ||
44 | * @en: offset to enable register of the bank | ||
45 | * @dir: offset to direction register of the bank | ||
46 | * @data_out: offset to the data out register of the bank | ||
47 | * @data_in: offset to the data in register of the bank | ||
48 | * @ngpio: highest valid pin in this bank | ||
49 | */ | ||
50 | |||
51 | struct vt8500_gpio_bank_regoffsets { | ||
52 | unsigned int en; | ||
53 | unsigned int dir; | ||
54 | unsigned int data_out; | ||
55 | unsigned int data_in; | ||
56 | unsigned char ngpio; | ||
57 | }; | ||
58 | |||
59 | struct vt8500_gpio_data { | ||
60 | unsigned int num_banks; | ||
61 | struct vt8500_gpio_bank_regoffsets banks[]; | ||
62 | }; | ||
63 | |||
64 | #define VT8500_BANK(__en, __dir, __out, __in, __ngpio) \ | ||
65 | { \ | ||
66 | .en = __en, \ | ||
67 | .dir = __dir, \ | ||
68 | .data_out = __out, \ | ||
69 | .data_in = __in, \ | ||
70 | .ngpio = __ngpio, \ | ||
71 | } | ||
72 | |||
73 | static struct vt8500_gpio_data vt8500_data = { | ||
74 | .num_banks = 7, | ||
75 | .banks = { | ||
76 | VT8500_BANK(NO_REG, 0x3C, 0x5C, 0x7C, 9), | ||
77 | VT8500_BANK(0x00, 0x20, 0x40, 0x60, 26), | ||
78 | VT8500_BANK(0x04, 0x24, 0x44, 0x64, 28), | ||
79 | VT8500_BANK(0x08, 0x28, 0x48, 0x68, 31), | ||
80 | VT8500_BANK(0x0C, 0x2C, 0x4C, 0x6C, 19), | ||
81 | VT8500_BANK(0x10, 0x30, 0x50, 0x70, 19), | ||
82 | VT8500_BANK(0x14, 0x34, 0x54, 0x74, 23), | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct vt8500_gpio_data wm8505_data = { | ||
87 | .num_banks = 10, | ||
88 | .banks = { | ||
89 | VT8500_BANK(0x64, 0x8C, 0xB4, 0xDC, 22), | ||
90 | VT8500_BANK(0x40, 0x68, 0x90, 0xB8, 8), | ||
91 | VT8500_BANK(0x44, 0x6C, 0x94, 0xBC, 32), | ||
92 | VT8500_BANK(0x48, 0x70, 0x98, 0xC0, 6), | ||
93 | VT8500_BANK(0x4C, 0x74, 0x9C, 0xC4, 16), | ||
94 | VT8500_BANK(0x50, 0x78, 0xA0, 0xC8, 25), | ||
95 | VT8500_BANK(0x54, 0x7C, 0xA4, 0xCC, 5), | ||
96 | VT8500_BANK(0x58, 0x80, 0xA8, 0xD0, 5), | ||
97 | VT8500_BANK(0x5C, 0x84, 0xAC, 0xD4, 12), | ||
98 | VT8500_BANK(0x60, 0x88, 0xB0, 0xD8, 16), | ||
99 | VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), | ||
100 | }, | ||
101 | }; | ||
102 | |||
103 | /* | ||
104 | * No information about which bits are valid so we just make | ||
105 | * them all available until its figured out. | ||
106 | */ | ||
107 | static struct vt8500_gpio_data wm8650_data = { | ||
108 | .num_banks = 9, | ||
109 | .banks = { | ||
110 | VT8500_BANK(0x40, 0x80, 0xC0, 0x00, 32), | ||
111 | VT8500_BANK(0x44, 0x84, 0xC4, 0x04, 32), | ||
112 | VT8500_BANK(0x48, 0x88, 0xC8, 0x08, 32), | ||
113 | VT8500_BANK(0x4C, 0x8C, 0xCC, 0x0C, 32), | ||
114 | VT8500_BANK(0x50, 0x90, 0xD0, 0x10, 32), | ||
115 | VT8500_BANK(0x54, 0x94, 0xD4, 0x14, 32), | ||
116 | VT8500_BANK(0x58, 0x98, 0xD8, 0x18, 32), | ||
117 | VT8500_BANK(0x5C, 0x9C, 0xDC, 0x1C, 32), | ||
118 | VT8500_BANK(0x7C, 0xBC, 0xFC, 0x3C, 32), | ||
119 | VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), | ||
120 | }, | ||
121 | }; | ||
122 | |||
123 | struct vt8500_gpio_chip { | ||
124 | struct gpio_chip chip; | ||
125 | |||
126 | const struct vt8500_gpio_bank_regoffsets *regs; | ||
127 | void __iomem *base; | ||
128 | }; | ||
129 | |||
130 | struct vt8500_data { | ||
131 | struct vt8500_gpio_chip *chip; | ||
132 | void __iomem *iobase; | ||
133 | int num_banks; | ||
134 | }; | ||
135 | |||
136 | |||
137 | #define to_vt8500(__chip) container_of(__chip, struct vt8500_gpio_chip, chip) | ||
138 | |||
139 | static int vt8500_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
140 | { | ||
141 | u32 val; | ||
142 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
143 | |||
144 | if (vt8500_chip->regs->en == NO_REG) | ||
145 | return 0; | ||
146 | |||
147 | val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); | ||
148 | val |= BIT(offset); | ||
149 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); | ||
150 | |||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static void vt8500_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
155 | { | ||
156 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
157 | u32 val; | ||
158 | |||
159 | if (vt8500_chip->regs->en == NO_REG) | ||
160 | return; | ||
161 | |||
162 | val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); | ||
163 | val &= ~BIT(offset); | ||
164 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); | ||
165 | } | ||
166 | |||
167 | static int vt8500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
168 | { | ||
169 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
170 | |||
171 | u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); | ||
172 | val &= ~BIT(offset); | ||
173 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static int vt8500_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | ||
179 | int value) | ||
180 | { | ||
181 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
182 | |||
183 | u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); | ||
184 | val |= BIT(offset); | ||
185 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); | ||
186 | |||
187 | if (value) { | ||
188 | val = readl_relaxed(vt8500_chip->base + | ||
189 | vt8500_chip->regs->data_out); | ||
190 | val |= BIT(offset); | ||
191 | writel_relaxed(val, vt8500_chip->base + | ||
192 | vt8500_chip->regs->data_out); | ||
193 | } | ||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static int vt8500_gpio_get_value(struct gpio_chip *chip, unsigned offset) | ||
198 | { | ||
199 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
200 | |||
201 | return (readl_relaxed(vt8500_chip->base + vt8500_chip->regs->data_in) >> | ||
202 | offset) & 1; | ||
203 | } | ||
204 | |||
205 | static void vt8500_gpio_set_value(struct gpio_chip *chip, unsigned offset, | ||
206 | int value) | ||
207 | { | ||
208 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
209 | |||
210 | u32 val = readl_relaxed(vt8500_chip->base + | ||
211 | vt8500_chip->regs->data_out); | ||
212 | if (value) | ||
213 | val |= BIT(offset); | ||
214 | else | ||
215 | val &= ~BIT(offset); | ||
216 | |||
217 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->data_out); | ||
218 | } | ||
219 | |||
220 | static int vt8500_of_xlate(struct gpio_chip *gc, | ||
221 | const struct of_phandle_args *gpiospec, u32 *flags) | ||
222 | { | ||
223 | /* bank if specificed in gpiospec->args[0] */ | ||
224 | if (flags) | ||
225 | *flags = gpiospec->args[2]; | ||
226 | |||
227 | return gpiospec->args[1]; | ||
228 | } | ||
229 | |||
230 | static int vt8500_add_chips(struct platform_device *pdev, void __iomem *base, | ||
231 | const struct vt8500_gpio_data *data) | ||
232 | { | ||
233 | struct vt8500_data *priv; | ||
234 | struct vt8500_gpio_chip *vtchip; | ||
235 | struct gpio_chip *chip; | ||
236 | int i; | ||
237 | int pin_cnt = 0; | ||
238 | |||
239 | priv = devm_kzalloc(&pdev->dev, sizeof(struct vt8500_data), GFP_KERNEL); | ||
240 | if (!priv) { | ||
241 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
242 | return -ENOMEM; | ||
243 | } | ||
244 | |||
245 | priv->chip = devm_kzalloc(&pdev->dev, | ||
246 | sizeof(struct vt8500_gpio_chip) * data->num_banks, | ||
247 | GFP_KERNEL); | ||
248 | if (!priv->chip) { | ||
249 | dev_err(&pdev->dev, "failed to allocate chip memory\n"); | ||
250 | return -ENOMEM; | ||
251 | } | ||
252 | |||
253 | priv->iobase = base; | ||
254 | priv->num_banks = data->num_banks; | ||
255 | platform_set_drvdata(pdev, priv); | ||
256 | |||
257 | vtchip = priv->chip; | ||
258 | |||
259 | for (i = 0; i < data->num_banks; i++) { | ||
260 | vtchip[i].base = base; | ||
261 | vtchip[i].regs = &data->banks[i]; | ||
262 | |||
263 | chip = &vtchip[i].chip; | ||
264 | |||
265 | chip->of_xlate = vt8500_of_xlate; | ||
266 | chip->of_gpio_n_cells = 3; | ||
267 | chip->of_node = pdev->dev.of_node; | ||
268 | |||
269 | chip->request = vt8500_gpio_request; | ||
270 | chip->free = vt8500_gpio_free; | ||
271 | chip->direction_input = vt8500_gpio_direction_input; | ||
272 | chip->direction_output = vt8500_gpio_direction_output; | ||
273 | chip->get = vt8500_gpio_get_value; | ||
274 | chip->set = vt8500_gpio_set_value; | ||
275 | chip->can_sleep = 0; | ||
276 | chip->base = pin_cnt; | ||
277 | chip->ngpio = data->banks[i].ngpio; | ||
278 | |||
279 | pin_cnt += data->banks[i].ngpio; | ||
280 | |||
281 | gpiochip_add(chip); | ||
282 | } | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static struct of_device_id vt8500_gpio_dt_ids[] = { | ||
287 | { .compatible = "via,vt8500-gpio", .data = &vt8500_data, }, | ||
288 | { .compatible = "wm,wm8505-gpio", .data = &wm8505_data, }, | ||
289 | { .compatible = "wm,wm8650-gpio", .data = &wm8650_data, }, | ||
290 | { /* Sentinel */ }, | ||
291 | }; | ||
292 | |||
293 | static int vt8500_gpio_probe(struct platform_device *pdev) | ||
294 | { | ||
295 | int ret; | ||
296 | void __iomem *gpio_base; | ||
297 | struct resource *res; | ||
298 | const struct of_device_id *of_id = | ||
299 | of_match_device(vt8500_gpio_dt_ids, &pdev->dev); | ||
300 | |||
301 | if (!of_id) { | ||
302 | dev_err(&pdev->dev, "No matching driver data\n"); | ||
303 | return -ENODEV; | ||
304 | } | ||
305 | |||
306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
307 | if (!res) { | ||
308 | dev_err(&pdev->dev, "Unable to get IO resource\n"); | ||
309 | return -ENODEV; | ||
310 | } | ||
311 | |||
312 | gpio_base = devm_request_and_ioremap(&pdev->dev, res); | ||
313 | if (!gpio_base) { | ||
314 | dev_err(&pdev->dev, "Unable to map GPIO registers\n"); | ||
315 | return -ENOMEM; | ||
316 | } | ||
317 | |||
318 | ret = vt8500_add_chips(pdev, gpio_base, of_id->data); | ||
319 | |||
320 | return ret; | ||
321 | } | ||
322 | |||
323 | static int vt8500_gpio_remove(struct platform_device *pdev) | ||
324 | { | ||
325 | int i; | ||
326 | int ret; | ||
327 | struct vt8500_data *priv = platform_get_drvdata(pdev); | ||
328 | struct vt8500_gpio_chip *vtchip = priv->chip; | ||
329 | |||
330 | for (i = 0; i < priv->num_banks; i++) { | ||
331 | ret = gpiochip_remove(&vtchip[i].chip); | ||
332 | if (ret) | ||
333 | dev_warn(&pdev->dev, "gpiochip_remove returned %d\n", | ||
334 | ret); | ||
335 | } | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static struct platform_driver vt8500_gpio_driver = { | ||
341 | .probe = vt8500_gpio_probe, | ||
342 | .remove = vt8500_gpio_remove, | ||
343 | .driver = { | ||
344 | .name = "vt8500-gpio", | ||
345 | .owner = THIS_MODULE, | ||
346 | .of_match_table = vt8500_gpio_dt_ids, | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | module_platform_driver(vt8500_gpio_driver); | ||
351 | |||
352 | MODULE_DESCRIPTION("VT8500 GPIO Driver"); | ||
353 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
354 | MODULE_LICENSE("GPL v2"); | ||
355 | MODULE_DEVICE_TABLE(of, vt8500_gpio_dt_ids); | ||
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index a350969e5efe..4a33351c25dc 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig | |||
@@ -25,6 +25,14 @@ config ARM_VIC_NR | |||
25 | The maximum number of VICs available in the system, for | 25 | The maximum number of VICs available in the system, for |
26 | power management. | 26 | power management. |
27 | 27 | ||
28 | config RENESAS_INTC_IRQPIN | ||
29 | bool | ||
30 | select IRQ_DOMAIN | ||
31 | |||
32 | config RENESAS_IRQC | ||
33 | bool | ||
34 | select IRQ_DOMAIN | ||
35 | |||
28 | config VERSATILE_FPGA_IRQ | 36 | config VERSATILE_FPGA_IRQ |
29 | bool | 37 | bool |
30 | select IRQ_DOMAIN | 38 | select IRQ_DOMAIN |
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 10ef57f35a6e..c28fcccf4a0d 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -3,6 +3,7 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o | |||
3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o | 3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o |
4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o | 4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o |
5 | obj-$(CONFIG_ARCH_MXS) += irq-mxs.o | 5 | obj-$(CONFIG_ARCH_MXS) += irq-mxs.o |
6 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o | ||
6 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 7 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
7 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o | 8 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o |
8 | obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o | 9 | obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o |
@@ -10,4 +11,7 @@ obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o | |||
10 | obj-$(CONFIG_ARM_GIC) += irq-gic.o | 11 | obj-$(CONFIG_ARM_GIC) += irq-gic.o |
11 | obj-$(CONFIG_ARM_VIC) += irq-vic.o | 12 | obj-$(CONFIG_ARM_VIC) += irq-vic.o |
12 | obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o | 13 | obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o |
14 | obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o | ||
15 | obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o | ||
13 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o | 16 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o |
17 | obj-$(CONFIG_ARCH_VT8500) += irq-vt8500.o | ||
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index 6a5201351507..02492ab20d22 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c | |||
@@ -32,6 +32,7 @@ struct combiner_chip_data { | |||
32 | unsigned int irq_offset; | 32 | unsigned int irq_offset; |
33 | unsigned int irq_mask; | 33 | unsigned int irq_mask; |
34 | void __iomem *base; | 34 | void __iomem *base; |
35 | unsigned int parent_irq; | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | static struct irq_domain *combiner_irq_domain; | 38 | static struct irq_domain *combiner_irq_domain; |
@@ -88,22 +89,46 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) | |||
88 | chained_irq_exit(chip, desc); | 89 | chained_irq_exit(chip, desc); |
89 | } | 90 | } |
90 | 91 | ||
92 | #ifdef CONFIG_SMP | ||
93 | static int combiner_set_affinity(struct irq_data *d, | ||
94 | const struct cpumask *mask_val, bool force) | ||
95 | { | ||
96 | struct combiner_chip_data *chip_data = irq_data_get_irq_chip_data(d); | ||
97 | struct irq_chip *chip = irq_get_chip(chip_data->parent_irq); | ||
98 | struct irq_data *data = irq_get_irq_data(chip_data->parent_irq); | ||
99 | |||
100 | if (chip && chip->irq_set_affinity) | ||
101 | return chip->irq_set_affinity(data, mask_val, force); | ||
102 | else | ||
103 | return -EINVAL; | ||
104 | } | ||
105 | #endif | ||
106 | |||
91 | static struct irq_chip combiner_chip = { | 107 | static struct irq_chip combiner_chip = { |
92 | .name = "COMBINER", | 108 | .name = "COMBINER", |
93 | .irq_mask = combiner_mask_irq, | 109 | .irq_mask = combiner_mask_irq, |
94 | .irq_unmask = combiner_unmask_irq, | 110 | .irq_unmask = combiner_unmask_irq, |
111 | #ifdef CONFIG_SMP | ||
112 | .irq_set_affinity = combiner_set_affinity, | ||
113 | #endif | ||
95 | }; | 114 | }; |
96 | 115 | ||
97 | static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) | 116 | static unsigned int max_combiner_nr(void) |
98 | { | 117 | { |
99 | unsigned int max_nr; | ||
100 | |||
101 | if (soc_is_exynos5250()) | 118 | if (soc_is_exynos5250()) |
102 | max_nr = EXYNOS5_MAX_COMBINER_NR; | 119 | return EXYNOS5_MAX_COMBINER_NR; |
120 | else if (soc_is_exynos4412()) | ||
121 | return EXYNOS4412_MAX_COMBINER_NR; | ||
122 | else if (soc_is_exynos4212()) | ||
123 | return EXYNOS4212_MAX_COMBINER_NR; | ||
103 | else | 124 | else |
104 | max_nr = EXYNOS4_MAX_COMBINER_NR; | 125 | return EXYNOS4210_MAX_COMBINER_NR; |
126 | } | ||
105 | 127 | ||
106 | if (combiner_nr >= max_nr) | 128 | static void __init combiner_cascade_irq(unsigned int combiner_nr, |
129 | unsigned int irq) | ||
130 | { | ||
131 | if (combiner_nr >= max_combiner_nr()) | ||
107 | BUG(); | 132 | BUG(); |
108 | if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) | 133 | if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) |
109 | BUG(); | 134 | BUG(); |
@@ -111,12 +136,13 @@ static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int i | |||
111 | } | 136 | } |
112 | 137 | ||
113 | static void __init combiner_init_one(unsigned int combiner_nr, | 138 | static void __init combiner_init_one(unsigned int combiner_nr, |
114 | void __iomem *base) | 139 | void __iomem *base, unsigned int irq) |
115 | { | 140 | { |
116 | combiner_data[combiner_nr].base = base; | 141 | combiner_data[combiner_nr].base = base; |
117 | combiner_data[combiner_nr].irq_offset = irq_find_mapping( | 142 | combiner_data[combiner_nr].irq_offset = irq_find_mapping( |
118 | combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER); | 143 | combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER); |
119 | combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3); | 144 | combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3); |
145 | combiner_data[combiner_nr].parent_irq = irq; | ||
120 | 146 | ||
121 | /* Disable all interrupts */ | 147 | /* Disable all interrupts */ |
122 | __raw_writel(combiner_data[combiner_nr].irq_mask, | 148 | __raw_writel(combiner_data[combiner_nr].irq_mask, |
@@ -167,23 +193,38 @@ static struct irq_domain_ops combiner_irq_domain_ops = { | |||
167 | .map = combiner_irq_domain_map, | 193 | .map = combiner_irq_domain_map, |
168 | }; | 194 | }; |
169 | 195 | ||
196 | static unsigned int exynos4x12_combiner_extra_irq(int group) | ||
197 | { | ||
198 | switch (group) { | ||
199 | case 16: | ||
200 | return IRQ_SPI(107); | ||
201 | case 17: | ||
202 | return IRQ_SPI(108); | ||
203 | case 18: | ||
204 | return IRQ_SPI(48); | ||
205 | case 19: | ||
206 | return IRQ_SPI(42); | ||
207 | default: | ||
208 | return 0; | ||
209 | } | ||
210 | } | ||
211 | |||
170 | void __init combiner_init(void __iomem *combiner_base, | 212 | void __init combiner_init(void __iomem *combiner_base, |
171 | struct device_node *np) | 213 | struct device_node *np) |
172 | { | 214 | { |
173 | int i, irq, irq_base; | 215 | int i, irq, irq_base; |
174 | unsigned int max_nr, nr_irq; | 216 | unsigned int max_nr, nr_irq; |
175 | 217 | ||
218 | max_nr = max_combiner_nr(); | ||
219 | |||
176 | if (np) { | 220 | if (np) { |
177 | if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) { | 221 | if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) { |
178 | pr_warning("%s: number of combiners not specified, " | 222 | pr_info("%s: number of combiners not specified, " |
179 | "setting default as %d.\n", | 223 | "setting default as %d.\n", |
180 | __func__, EXYNOS4_MAX_COMBINER_NR); | 224 | __func__, max_nr); |
181 | max_nr = EXYNOS4_MAX_COMBINER_NR; | ||
182 | } | 225 | } |
183 | } else { | ||
184 | max_nr = soc_is_exynos5250() ? EXYNOS5_MAX_COMBINER_NR : | ||
185 | EXYNOS4_MAX_COMBINER_NR; | ||
186 | } | 226 | } |
227 | |||
187 | nr_irq = max_nr * MAX_IRQ_IN_COMBINER; | 228 | nr_irq = max_nr * MAX_IRQ_IN_COMBINER; |
188 | 229 | ||
189 | irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0); | 230 | irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0); |
@@ -200,12 +241,15 @@ void __init combiner_init(void __iomem *combiner_base, | |||
200 | } | 241 | } |
201 | 242 | ||
202 | for (i = 0; i < max_nr; i++) { | 243 | for (i = 0; i < max_nr; i++) { |
203 | combiner_init_one(i, combiner_base + (i >> 2) * 0x10); | 244 | if (i < EXYNOS4210_MAX_COMBINER_NR || soc_is_exynos5250()) |
204 | irq = IRQ_SPI(i); | 245 | irq = IRQ_SPI(i); |
246 | else | ||
247 | irq = exynos4x12_combiner_extra_irq(i); | ||
205 | #ifdef CONFIG_OF | 248 | #ifdef CONFIG_OF |
206 | if (np) | 249 | if (np) |
207 | irq = irq_of_parse_and_map(np, i); | 250 | irq = irq_of_parse_and_map(np, i); |
208 | #endif | 251 | #endif |
252 | combiner_init_one(i, combiner_base + (i >> 2) * 0x10, irq); | ||
209 | combiner_cascade_irq(i, irq); | 253 | combiner_cascade_irq(i, irq); |
210 | } | 254 | } |
211 | } | 255 | } |
diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c new file mode 100644 index 000000000000..5a68e5accec1 --- /dev/null +++ b/drivers/irqchip/irq-renesas-intc-irqpin.c | |||
@@ -0,0 +1,547 @@ | |||
1 | /* | ||
2 | * Renesas INTC External IRQ Pin Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
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 | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/irqdomain.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | ||
32 | |||
33 | #define INTC_IRQPIN_MAX 8 /* maximum 8 interrupts per driver instance */ | ||
34 | |||
35 | #define INTC_IRQPIN_REG_SENSE 0 /* ICRn */ | ||
36 | #define INTC_IRQPIN_REG_PRIO 1 /* INTPRInn */ | ||
37 | #define INTC_IRQPIN_REG_SOURCE 2 /* INTREQnn */ | ||
38 | #define INTC_IRQPIN_REG_MASK 3 /* INTMSKnn */ | ||
39 | #define INTC_IRQPIN_REG_CLEAR 4 /* INTMSKCLRnn */ | ||
40 | #define INTC_IRQPIN_REG_NR 5 | ||
41 | |||
42 | /* INTC external IRQ PIN hardware register access: | ||
43 | * | ||
44 | * SENSE is read-write 32-bit with 2-bits or 4-bits per IRQ (*) | ||
45 | * PRIO is read-write 32-bit with 4-bits per IRQ (**) | ||
46 | * SOURCE is read-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
47 | * MASK is write-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
48 | * CLEAR is write-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
49 | * | ||
50 | * (*) May be accessed by more than one driver instance - lock needed | ||
51 | * (**) Read-modify-write access by one driver instance - lock needed | ||
52 | * (***) Accessed by one driver instance only - no locking needed | ||
53 | */ | ||
54 | |||
55 | struct intc_irqpin_iomem { | ||
56 | void __iomem *iomem; | ||
57 | unsigned long (*read)(void __iomem *iomem); | ||
58 | void (*write)(void __iomem *iomem, unsigned long data); | ||
59 | int width; | ||
60 | }; | ||
61 | |||
62 | struct intc_irqpin_irq { | ||
63 | int hw_irq; | ||
64 | int requested_irq; | ||
65 | int domain_irq; | ||
66 | struct intc_irqpin_priv *p; | ||
67 | }; | ||
68 | |||
69 | struct intc_irqpin_priv { | ||
70 | struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; | ||
71 | struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; | ||
72 | struct renesas_intc_irqpin_config config; | ||
73 | unsigned int number_of_irqs; | ||
74 | struct platform_device *pdev; | ||
75 | struct irq_chip irq_chip; | ||
76 | struct irq_domain *irq_domain; | ||
77 | bool shared_irqs; | ||
78 | u8 shared_irq_mask; | ||
79 | }; | ||
80 | |||
81 | static unsigned long intc_irqpin_read32(void __iomem *iomem) | ||
82 | { | ||
83 | return ioread32(iomem); | ||
84 | } | ||
85 | |||
86 | static unsigned long intc_irqpin_read8(void __iomem *iomem) | ||
87 | { | ||
88 | return ioread8(iomem); | ||
89 | } | ||
90 | |||
91 | static void intc_irqpin_write32(void __iomem *iomem, unsigned long data) | ||
92 | { | ||
93 | iowrite32(data, iomem); | ||
94 | } | ||
95 | |||
96 | static void intc_irqpin_write8(void __iomem *iomem, unsigned long data) | ||
97 | { | ||
98 | iowrite8(data, iomem); | ||
99 | } | ||
100 | |||
101 | static inline unsigned long intc_irqpin_read(struct intc_irqpin_priv *p, | ||
102 | int reg) | ||
103 | { | ||
104 | struct intc_irqpin_iomem *i = &p->iomem[reg]; | ||
105 | |||
106 | return i->read(i->iomem); | ||
107 | } | ||
108 | |||
109 | static inline void intc_irqpin_write(struct intc_irqpin_priv *p, | ||
110 | int reg, unsigned long data) | ||
111 | { | ||
112 | struct intc_irqpin_iomem *i = &p->iomem[reg]; | ||
113 | |||
114 | i->write(i->iomem, data); | ||
115 | } | ||
116 | |||
117 | static inline unsigned long intc_irqpin_hwirq_mask(struct intc_irqpin_priv *p, | ||
118 | int reg, int hw_irq) | ||
119 | { | ||
120 | return BIT((p->iomem[reg].width - 1) - hw_irq); | ||
121 | } | ||
122 | |||
123 | static inline void intc_irqpin_irq_write_hwirq(struct intc_irqpin_priv *p, | ||
124 | int reg, int hw_irq) | ||
125 | { | ||
126 | intc_irqpin_write(p, reg, intc_irqpin_hwirq_mask(p, reg, hw_irq)); | ||
127 | } | ||
128 | |||
129 | static DEFINE_RAW_SPINLOCK(intc_irqpin_lock); /* only used by slow path */ | ||
130 | |||
131 | static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, | ||
132 | int reg, int shift, | ||
133 | int width, int value) | ||
134 | { | ||
135 | unsigned long flags; | ||
136 | unsigned long tmp; | ||
137 | |||
138 | raw_spin_lock_irqsave(&intc_irqpin_lock, flags); | ||
139 | |||
140 | tmp = intc_irqpin_read(p, reg); | ||
141 | tmp &= ~(((1 << width) - 1) << shift); | ||
142 | tmp |= value << shift; | ||
143 | intc_irqpin_write(p, reg, tmp); | ||
144 | |||
145 | raw_spin_unlock_irqrestore(&intc_irqpin_lock, flags); | ||
146 | } | ||
147 | |||
148 | static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, | ||
149 | int irq, int do_mask) | ||
150 | { | ||
151 | int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */ | ||
152 | int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */ | ||
153 | |||
154 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO, | ||
155 | shift, bitfield_width, | ||
156 | do_mask ? 0 : (1 << bitfield_width) - 1); | ||
157 | } | ||
158 | |||
159 | static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) | ||
160 | { | ||
161 | int bitfield_width = p->config.sense_bitfield_width; | ||
162 | int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */ | ||
163 | |||
164 | dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); | ||
165 | |||
166 | if (value >= (1 << bitfield_width)) | ||
167 | return -EINVAL; | ||
168 | |||
169 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_SENSE, shift, | ||
170 | bitfield_width, value); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static void intc_irqpin_dbg(struct intc_irqpin_irq *i, char *str) | ||
175 | { | ||
176 | dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", | ||
177 | str, i->requested_irq, i->hw_irq, i->domain_irq); | ||
178 | } | ||
179 | |||
180 | static void intc_irqpin_irq_enable(struct irq_data *d) | ||
181 | { | ||
182 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
183 | int hw_irq = irqd_to_hwirq(d); | ||
184 | |||
185 | intc_irqpin_dbg(&p->irq[hw_irq], "enable"); | ||
186 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); | ||
187 | } | ||
188 | |||
189 | static void intc_irqpin_irq_disable(struct irq_data *d) | ||
190 | { | ||
191 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
192 | int hw_irq = irqd_to_hwirq(d); | ||
193 | |||
194 | intc_irqpin_dbg(&p->irq[hw_irq], "disable"); | ||
195 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); | ||
196 | } | ||
197 | |||
198 | static void intc_irqpin_shared_irq_enable(struct irq_data *d) | ||
199 | { | ||
200 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
201 | int hw_irq = irqd_to_hwirq(d); | ||
202 | |||
203 | intc_irqpin_dbg(&p->irq[hw_irq], "shared enable"); | ||
204 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); | ||
205 | |||
206 | p->shared_irq_mask &= ~BIT(hw_irq); | ||
207 | } | ||
208 | |||
209 | static void intc_irqpin_shared_irq_disable(struct irq_data *d) | ||
210 | { | ||
211 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
212 | int hw_irq = irqd_to_hwirq(d); | ||
213 | |||
214 | intc_irqpin_dbg(&p->irq[hw_irq], "shared disable"); | ||
215 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); | ||
216 | |||
217 | p->shared_irq_mask |= BIT(hw_irq); | ||
218 | } | ||
219 | |||
220 | static void intc_irqpin_irq_enable_force(struct irq_data *d) | ||
221 | { | ||
222 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
223 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; | ||
224 | |||
225 | intc_irqpin_irq_enable(d); | ||
226 | |||
227 | /* enable interrupt through parent interrupt controller, | ||
228 | * assumes non-shared interrupt with 1:1 mapping | ||
229 | * needed for busted IRQs on some SoCs like sh73a0 | ||
230 | */ | ||
231 | irq_get_chip(irq)->irq_unmask(irq_get_irq_data(irq)); | ||
232 | } | ||
233 | |||
234 | static void intc_irqpin_irq_disable_force(struct irq_data *d) | ||
235 | { | ||
236 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
237 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; | ||
238 | |||
239 | /* disable interrupt through parent interrupt controller, | ||
240 | * assumes non-shared interrupt with 1:1 mapping | ||
241 | * needed for busted IRQs on some SoCs like sh73a0 | ||
242 | */ | ||
243 | irq_get_chip(irq)->irq_mask(irq_get_irq_data(irq)); | ||
244 | intc_irqpin_irq_disable(d); | ||
245 | } | ||
246 | |||
247 | #define INTC_IRQ_SENSE_VALID 0x10 | ||
248 | #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) | ||
249 | |||
250 | static unsigned char intc_irqpin_sense[IRQ_TYPE_SENSE_MASK + 1] = { | ||
251 | [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x00), | ||
252 | [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x01), | ||
253 | [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x02), | ||
254 | [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x03), | ||
255 | [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x04), | ||
256 | }; | ||
257 | |||
258 | static int intc_irqpin_irq_set_type(struct irq_data *d, unsigned int type) | ||
259 | { | ||
260 | unsigned char value = intc_irqpin_sense[type & IRQ_TYPE_SENSE_MASK]; | ||
261 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
262 | |||
263 | if (!(value & INTC_IRQ_SENSE_VALID)) | ||
264 | return -EINVAL; | ||
265 | |||
266 | return intc_irqpin_set_sense(p, irqd_to_hwirq(d), | ||
267 | value ^ INTC_IRQ_SENSE_VALID); | ||
268 | } | ||
269 | |||
270 | static irqreturn_t intc_irqpin_irq_handler(int irq, void *dev_id) | ||
271 | { | ||
272 | struct intc_irqpin_irq *i = dev_id; | ||
273 | struct intc_irqpin_priv *p = i->p; | ||
274 | unsigned long bit; | ||
275 | |||
276 | intc_irqpin_dbg(i, "demux1"); | ||
277 | bit = intc_irqpin_hwirq_mask(p, INTC_IRQPIN_REG_SOURCE, i->hw_irq); | ||
278 | |||
279 | if (intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE) & bit) { | ||
280 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, ~bit); | ||
281 | intc_irqpin_dbg(i, "demux2"); | ||
282 | generic_handle_irq(i->domain_irq); | ||
283 | return IRQ_HANDLED; | ||
284 | } | ||
285 | return IRQ_NONE; | ||
286 | } | ||
287 | |||
288 | static irqreturn_t intc_irqpin_shared_irq_handler(int irq, void *dev_id) | ||
289 | { | ||
290 | struct intc_irqpin_priv *p = dev_id; | ||
291 | unsigned int reg_source = intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE); | ||
292 | irqreturn_t status = IRQ_NONE; | ||
293 | int k; | ||
294 | |||
295 | for (k = 0; k < 8; k++) { | ||
296 | if (reg_source & BIT(7 - k)) { | ||
297 | if (BIT(k) & p->shared_irq_mask) | ||
298 | continue; | ||
299 | |||
300 | status |= intc_irqpin_irq_handler(irq, &p->irq[k]); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | return status; | ||
305 | } | ||
306 | |||
307 | static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq, | ||
308 | irq_hw_number_t hw) | ||
309 | { | ||
310 | struct intc_irqpin_priv *p = h->host_data; | ||
311 | |||
312 | p->irq[hw].domain_irq = virq; | ||
313 | p->irq[hw].hw_irq = hw; | ||
314 | |||
315 | intc_irqpin_dbg(&p->irq[hw], "map"); | ||
316 | irq_set_chip_data(virq, h->host_data); | ||
317 | irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); | ||
318 | set_irq_flags(virq, IRQF_VALID); /* kill me now */ | ||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static struct irq_domain_ops intc_irqpin_irq_domain_ops = { | ||
323 | .map = intc_irqpin_irq_domain_map, | ||
324 | .xlate = irq_domain_xlate_twocell, | ||
325 | }; | ||
326 | |||
327 | static int intc_irqpin_probe(struct platform_device *pdev) | ||
328 | { | ||
329 | struct renesas_intc_irqpin_config *pdata = pdev->dev.platform_data; | ||
330 | struct intc_irqpin_priv *p; | ||
331 | struct intc_irqpin_iomem *i; | ||
332 | struct resource *io[INTC_IRQPIN_REG_NR]; | ||
333 | struct resource *irq; | ||
334 | struct irq_chip *irq_chip; | ||
335 | void (*enable_fn)(struct irq_data *d); | ||
336 | void (*disable_fn)(struct irq_data *d); | ||
337 | const char *name = dev_name(&pdev->dev); | ||
338 | int ref_irq; | ||
339 | int ret; | ||
340 | int k; | ||
341 | |||
342 | p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); | ||
343 | if (!p) { | ||
344 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
345 | ret = -ENOMEM; | ||
346 | goto err0; | ||
347 | } | ||
348 | |||
349 | /* deal with driver instance configuration */ | ||
350 | if (pdata) | ||
351 | memcpy(&p->config, pdata, sizeof(*pdata)); | ||
352 | if (!p->config.sense_bitfield_width) | ||
353 | p->config.sense_bitfield_width = 4; /* default to 4 bits */ | ||
354 | |||
355 | p->pdev = pdev; | ||
356 | platform_set_drvdata(pdev, p); | ||
357 | |||
358 | /* get hold of manadatory IOMEM */ | ||
359 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { | ||
360 | io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); | ||
361 | if (!io[k]) { | ||
362 | dev_err(&pdev->dev, "not enough IOMEM resources\n"); | ||
363 | ret = -EINVAL; | ||
364 | goto err0; | ||
365 | } | ||
366 | } | ||
367 | |||
368 | /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */ | ||
369 | for (k = 0; k < INTC_IRQPIN_MAX; k++) { | ||
370 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); | ||
371 | if (!irq) | ||
372 | break; | ||
373 | |||
374 | p->irq[k].p = p; | ||
375 | p->irq[k].requested_irq = irq->start; | ||
376 | } | ||
377 | |||
378 | p->number_of_irqs = k; | ||
379 | if (p->number_of_irqs < 1) { | ||
380 | dev_err(&pdev->dev, "not enough IRQ resources\n"); | ||
381 | ret = -EINVAL; | ||
382 | goto err0; | ||
383 | } | ||
384 | |||
385 | /* ioremap IOMEM and setup read/write callbacks */ | ||
386 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { | ||
387 | i = &p->iomem[k]; | ||
388 | |||
389 | switch (resource_size(io[k])) { | ||
390 | case 1: | ||
391 | i->width = 8; | ||
392 | i->read = intc_irqpin_read8; | ||
393 | i->write = intc_irqpin_write8; | ||
394 | break; | ||
395 | case 4: | ||
396 | i->width = 32; | ||
397 | i->read = intc_irqpin_read32; | ||
398 | i->write = intc_irqpin_write32; | ||
399 | break; | ||
400 | default: | ||
401 | dev_err(&pdev->dev, "IOMEM size mismatch\n"); | ||
402 | ret = -EINVAL; | ||
403 | goto err0; | ||
404 | } | ||
405 | |||
406 | i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start, | ||
407 | resource_size(io[k])); | ||
408 | if (!i->iomem) { | ||
409 | dev_err(&pdev->dev, "failed to remap IOMEM\n"); | ||
410 | ret = -ENXIO; | ||
411 | goto err0; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | /* mask all interrupts using priority */ | ||
416 | for (k = 0; k < p->number_of_irqs; k++) | ||
417 | intc_irqpin_mask_unmask_prio(p, k, 1); | ||
418 | |||
419 | /* clear all pending interrupts */ | ||
420 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, 0x0); | ||
421 | |||
422 | /* scan for shared interrupt lines */ | ||
423 | ref_irq = p->irq[0].requested_irq; | ||
424 | p->shared_irqs = true; | ||
425 | for (k = 1; k < p->number_of_irqs; k++) { | ||
426 | if (ref_irq != p->irq[k].requested_irq) { | ||
427 | p->shared_irqs = false; | ||
428 | break; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | /* use more severe masking method if requested */ | ||
433 | if (p->config.control_parent) { | ||
434 | enable_fn = intc_irqpin_irq_enable_force; | ||
435 | disable_fn = intc_irqpin_irq_disable_force; | ||
436 | } else if (!p->shared_irqs) { | ||
437 | enable_fn = intc_irqpin_irq_enable; | ||
438 | disable_fn = intc_irqpin_irq_disable; | ||
439 | } else { | ||
440 | enable_fn = intc_irqpin_shared_irq_enable; | ||
441 | disable_fn = intc_irqpin_shared_irq_disable; | ||
442 | } | ||
443 | |||
444 | irq_chip = &p->irq_chip; | ||
445 | irq_chip->name = name; | ||
446 | irq_chip->irq_mask = disable_fn; | ||
447 | irq_chip->irq_unmask = enable_fn; | ||
448 | irq_chip->irq_enable = enable_fn; | ||
449 | irq_chip->irq_disable = disable_fn; | ||
450 | irq_chip->irq_set_type = intc_irqpin_irq_set_type; | ||
451 | irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; | ||
452 | |||
453 | p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, | ||
454 | p->number_of_irqs, | ||
455 | p->config.irq_base, | ||
456 | &intc_irqpin_irq_domain_ops, p); | ||
457 | if (!p->irq_domain) { | ||
458 | ret = -ENXIO; | ||
459 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | ||
460 | goto err0; | ||
461 | } | ||
462 | |||
463 | if (p->shared_irqs) { | ||
464 | /* request one shared interrupt */ | ||
465 | if (devm_request_irq(&pdev->dev, p->irq[0].requested_irq, | ||
466 | intc_irqpin_shared_irq_handler, | ||
467 | IRQF_SHARED, name, p)) { | ||
468 | dev_err(&pdev->dev, "failed to request low IRQ\n"); | ||
469 | ret = -ENOENT; | ||
470 | goto err1; | ||
471 | } | ||
472 | } else { | ||
473 | /* request interrupts one by one */ | ||
474 | for (k = 0; k < p->number_of_irqs; k++) { | ||
475 | if (devm_request_irq(&pdev->dev, | ||
476 | p->irq[k].requested_irq, | ||
477 | intc_irqpin_irq_handler, | ||
478 | 0, name, &p->irq[k])) { | ||
479 | dev_err(&pdev->dev, | ||
480 | "failed to request low IRQ\n"); | ||
481 | ret = -ENOENT; | ||
482 | goto err1; | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | |||
487 | /* unmask all interrupts on prio level */ | ||
488 | for (k = 0; k < p->number_of_irqs; k++) | ||
489 | intc_irqpin_mask_unmask_prio(p, k, 0); | ||
490 | |||
491 | dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); | ||
492 | |||
493 | /* warn in case of mismatch if irq base is specified */ | ||
494 | if (p->config.irq_base) { | ||
495 | if (p->config.irq_base != p->irq[0].domain_irq) | ||
496 | dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", | ||
497 | p->config.irq_base, p->irq[0].domain_irq); | ||
498 | } | ||
499 | |||
500 | return 0; | ||
501 | |||
502 | err1: | ||
503 | irq_domain_remove(p->irq_domain); | ||
504 | err0: | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | static int intc_irqpin_remove(struct platform_device *pdev) | ||
509 | { | ||
510 | struct intc_irqpin_priv *p = platform_get_drvdata(pdev); | ||
511 | |||
512 | irq_domain_remove(p->irq_domain); | ||
513 | |||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static const struct of_device_id intc_irqpin_dt_ids[] = { | ||
518 | { .compatible = "renesas,intc-irqpin", }, | ||
519 | {}, | ||
520 | }; | ||
521 | MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids); | ||
522 | |||
523 | static struct platform_driver intc_irqpin_device_driver = { | ||
524 | .probe = intc_irqpin_probe, | ||
525 | .remove = intc_irqpin_remove, | ||
526 | .driver = { | ||
527 | .name = "renesas_intc_irqpin", | ||
528 | .of_match_table = intc_irqpin_dt_ids, | ||
529 | .owner = THIS_MODULE, | ||
530 | } | ||
531 | }; | ||
532 | |||
533 | static int __init intc_irqpin_init(void) | ||
534 | { | ||
535 | return platform_driver_register(&intc_irqpin_device_driver); | ||
536 | } | ||
537 | postcore_initcall(intc_irqpin_init); | ||
538 | |||
539 | static void __exit intc_irqpin_exit(void) | ||
540 | { | ||
541 | platform_driver_unregister(&intc_irqpin_device_driver); | ||
542 | } | ||
543 | module_exit(intc_irqpin_exit); | ||
544 | |||
545 | MODULE_AUTHOR("Magnus Damm"); | ||
546 | MODULE_DESCRIPTION("Renesas INTC External IRQ Pin Driver"); | ||
547 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c new file mode 100644 index 000000000000..927bff373aac --- /dev/null +++ b/drivers/irqchip/irq-renesas-irqc.c | |||
@@ -0,0 +1,307 @@ | |||
1 | /* | ||
2 | * Renesas IRQC Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
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 | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/irqdomain.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/platform_data/irq-renesas-irqc.h> | ||
32 | |||
33 | #define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */ | ||
34 | |||
35 | #define IRQC_REQ_STS 0x00 | ||
36 | #define IRQC_EN_STS 0x04 | ||
37 | #define IRQC_EN_SET 0x08 | ||
38 | #define IRQC_INT_CPU_BASE(n) (0x000 + ((n) * 0x10)) | ||
39 | #define DETECT_STATUS 0x100 | ||
40 | #define IRQC_CONFIG(n) (0x180 + ((n) * 0x04)) | ||
41 | |||
42 | struct irqc_irq { | ||
43 | int hw_irq; | ||
44 | int requested_irq; | ||
45 | int domain_irq; | ||
46 | struct irqc_priv *p; | ||
47 | }; | ||
48 | |||
49 | struct irqc_priv { | ||
50 | void __iomem *iomem; | ||
51 | void __iomem *cpu_int_base; | ||
52 | struct irqc_irq irq[IRQC_IRQ_MAX]; | ||
53 | struct renesas_irqc_config config; | ||
54 | unsigned int number_of_irqs; | ||
55 | struct platform_device *pdev; | ||
56 | struct irq_chip irq_chip; | ||
57 | struct irq_domain *irq_domain; | ||
58 | }; | ||
59 | |||
60 | static void irqc_dbg(struct irqc_irq *i, char *str) | ||
61 | { | ||
62 | dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", | ||
63 | str, i->requested_irq, i->hw_irq, i->domain_irq); | ||
64 | } | ||
65 | |||
66 | static void irqc_irq_enable(struct irq_data *d) | ||
67 | { | ||
68 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
69 | int hw_irq = irqd_to_hwirq(d); | ||
70 | |||
71 | irqc_dbg(&p->irq[hw_irq], "enable"); | ||
72 | iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_SET); | ||
73 | } | ||
74 | |||
75 | static void irqc_irq_disable(struct irq_data *d) | ||
76 | { | ||
77 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
78 | int hw_irq = irqd_to_hwirq(d); | ||
79 | |||
80 | irqc_dbg(&p->irq[hw_irq], "disable"); | ||
81 | iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS); | ||
82 | } | ||
83 | |||
84 | #define INTC_IRQ_SENSE_VALID 0x10 | ||
85 | #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) | ||
86 | |||
87 | static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = { | ||
88 | [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01), | ||
89 | [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02), | ||
90 | [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */ | ||
91 | [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */ | ||
92 | [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c), /* Synchronous */ | ||
93 | }; | ||
94 | |||
95 | static int irqc_irq_set_type(struct irq_data *d, unsigned int type) | ||
96 | { | ||
97 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
98 | int hw_irq = irqd_to_hwirq(d); | ||
99 | unsigned char value = irqc_sense[type & IRQ_TYPE_SENSE_MASK]; | ||
100 | unsigned long tmp; | ||
101 | |||
102 | irqc_dbg(&p->irq[hw_irq], "sense"); | ||
103 | |||
104 | if (!(value & INTC_IRQ_SENSE_VALID)) | ||
105 | return -EINVAL; | ||
106 | |||
107 | tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq)); | ||
108 | tmp &= ~0x3f; | ||
109 | tmp |= value ^ INTC_IRQ_SENSE_VALID; | ||
110 | iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq)); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static irqreturn_t irqc_irq_handler(int irq, void *dev_id) | ||
115 | { | ||
116 | struct irqc_irq *i = dev_id; | ||
117 | struct irqc_priv *p = i->p; | ||
118 | unsigned long bit = BIT(i->hw_irq); | ||
119 | |||
120 | irqc_dbg(i, "demux1"); | ||
121 | |||
122 | if (ioread32(p->iomem + DETECT_STATUS) & bit) { | ||
123 | iowrite32(bit, p->iomem + DETECT_STATUS); | ||
124 | irqc_dbg(i, "demux2"); | ||
125 | generic_handle_irq(i->domain_irq); | ||
126 | return IRQ_HANDLED; | ||
127 | } | ||
128 | return IRQ_NONE; | ||
129 | } | ||
130 | |||
131 | static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq, | ||
132 | irq_hw_number_t hw) | ||
133 | { | ||
134 | struct irqc_priv *p = h->host_data; | ||
135 | |||
136 | p->irq[hw].domain_irq = virq; | ||
137 | p->irq[hw].hw_irq = hw; | ||
138 | |||
139 | irqc_dbg(&p->irq[hw], "map"); | ||
140 | irq_set_chip_data(virq, h->host_data); | ||
141 | irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); | ||
142 | set_irq_flags(virq, IRQF_VALID); /* kill me now */ | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static struct irq_domain_ops irqc_irq_domain_ops = { | ||
147 | .map = irqc_irq_domain_map, | ||
148 | .xlate = irq_domain_xlate_twocell, | ||
149 | }; | ||
150 | |||
151 | static int irqc_probe(struct platform_device *pdev) | ||
152 | { | ||
153 | struct renesas_irqc_config *pdata = pdev->dev.platform_data; | ||
154 | struct irqc_priv *p; | ||
155 | struct resource *io; | ||
156 | struct resource *irq; | ||
157 | struct irq_chip *irq_chip; | ||
158 | const char *name = dev_name(&pdev->dev); | ||
159 | int ret; | ||
160 | int k; | ||
161 | |||
162 | p = kzalloc(sizeof(*p), GFP_KERNEL); | ||
163 | if (!p) { | ||
164 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
165 | ret = -ENOMEM; | ||
166 | goto err0; | ||
167 | } | ||
168 | |||
169 | /* deal with driver instance configuration */ | ||
170 | if (pdata) | ||
171 | memcpy(&p->config, pdata, sizeof(*pdata)); | ||
172 | |||
173 | p->pdev = pdev; | ||
174 | platform_set_drvdata(pdev, p); | ||
175 | |||
176 | /* get hold of manadatory IOMEM */ | ||
177 | io = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
178 | if (!io) { | ||
179 | dev_err(&pdev->dev, "not enough IOMEM resources\n"); | ||
180 | ret = -EINVAL; | ||
181 | goto err1; | ||
182 | } | ||
183 | |||
184 | /* allow any number of IRQs between 1 and IRQC_IRQ_MAX */ | ||
185 | for (k = 0; k < IRQC_IRQ_MAX; k++) { | ||
186 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); | ||
187 | if (!irq) | ||
188 | break; | ||
189 | |||
190 | p->irq[k].p = p; | ||
191 | p->irq[k].requested_irq = irq->start; | ||
192 | } | ||
193 | |||
194 | p->number_of_irqs = k; | ||
195 | if (p->number_of_irqs < 1) { | ||
196 | dev_err(&pdev->dev, "not enough IRQ resources\n"); | ||
197 | ret = -EINVAL; | ||
198 | goto err1; | ||
199 | } | ||
200 | |||
201 | /* ioremap IOMEM and setup read/write callbacks */ | ||
202 | p->iomem = ioremap_nocache(io->start, resource_size(io)); | ||
203 | if (!p->iomem) { | ||
204 | dev_err(&pdev->dev, "failed to remap IOMEM\n"); | ||
205 | ret = -ENXIO; | ||
206 | goto err2; | ||
207 | } | ||
208 | |||
209 | p->cpu_int_base = p->iomem + IRQC_INT_CPU_BASE(0); /* SYS-SPI */ | ||
210 | |||
211 | irq_chip = &p->irq_chip; | ||
212 | irq_chip->name = name; | ||
213 | irq_chip->irq_mask = irqc_irq_disable; | ||
214 | irq_chip->irq_unmask = irqc_irq_enable; | ||
215 | irq_chip->irq_enable = irqc_irq_enable; | ||
216 | irq_chip->irq_disable = irqc_irq_disable; | ||
217 | irq_chip->irq_set_type = irqc_irq_set_type; | ||
218 | irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; | ||
219 | |||
220 | p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, | ||
221 | p->number_of_irqs, | ||
222 | p->config.irq_base, | ||
223 | &irqc_irq_domain_ops, p); | ||
224 | if (!p->irq_domain) { | ||
225 | ret = -ENXIO; | ||
226 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | ||
227 | goto err2; | ||
228 | } | ||
229 | |||
230 | /* request interrupts one by one */ | ||
231 | for (k = 0; k < p->number_of_irqs; k++) { | ||
232 | if (request_irq(p->irq[k].requested_irq, irqc_irq_handler, | ||
233 | 0, name, &p->irq[k])) { | ||
234 | dev_err(&pdev->dev, "failed to request IRQ\n"); | ||
235 | ret = -ENOENT; | ||
236 | goto err3; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); | ||
241 | |||
242 | /* warn in case of mismatch if irq base is specified */ | ||
243 | if (p->config.irq_base) { | ||
244 | if (p->config.irq_base != p->irq[0].domain_irq) | ||
245 | dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", | ||
246 | p->config.irq_base, p->irq[0].domain_irq); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | err3: | ||
251 | for (; k >= 0; k--) | ||
252 | free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]); | ||
253 | |||
254 | irq_domain_remove(p->irq_domain); | ||
255 | err2: | ||
256 | iounmap(p->iomem); | ||
257 | err1: | ||
258 | kfree(p); | ||
259 | err0: | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | static int irqc_remove(struct platform_device *pdev) | ||
264 | { | ||
265 | struct irqc_priv *p = platform_get_drvdata(pdev); | ||
266 | int k; | ||
267 | |||
268 | for (k = 0; k < p->number_of_irqs; k++) | ||
269 | free_irq(p->irq[k].requested_irq, &p->irq[k]); | ||
270 | |||
271 | irq_domain_remove(p->irq_domain); | ||
272 | iounmap(p->iomem); | ||
273 | kfree(p); | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static const struct of_device_id irqc_dt_ids[] = { | ||
278 | { .compatible = "renesas,irqc", }, | ||
279 | {}, | ||
280 | }; | ||
281 | MODULE_DEVICE_TABLE(of, irqc_dt_ids); | ||
282 | |||
283 | static struct platform_driver irqc_device_driver = { | ||
284 | .probe = irqc_probe, | ||
285 | .remove = irqc_remove, | ||
286 | .driver = { | ||
287 | .name = "renesas_irqc", | ||
288 | .of_match_table = irqc_dt_ids, | ||
289 | .owner = THIS_MODULE, | ||
290 | } | ||
291 | }; | ||
292 | |||
293 | static int __init irqc_init(void) | ||
294 | { | ||
295 | return platform_driver_register(&irqc_device_driver); | ||
296 | } | ||
297 | postcore_initcall(irqc_init); | ||
298 | |||
299 | static void __exit irqc_exit(void) | ||
300 | { | ||
301 | platform_driver_unregister(&irqc_device_driver); | ||
302 | } | ||
303 | module_exit(irqc_exit); | ||
304 | |||
305 | MODULE_AUTHOR("Magnus Damm"); | ||
306 | MODULE_DESCRIPTION("Renesas IRQC Driver"); | ||
307 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/arm/mach-s3c24xx/irq.c b/drivers/irqchip/irq-s3c24xx.c index b41c2cb7af4a..bbcc944ed94f 100644 --- a/arch/arm/mach-s3c24xx/irq.c +++ b/drivers/irqchip/irq-s3c24xx.c | |||
@@ -26,7 +26,11 @@ | |||
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/irqdomain.h> | 27 | #include <linux/irqdomain.h> |
28 | #include <linux/irqchip/chained_irq.h> | 28 | #include <linux/irqchip/chained_irq.h> |
29 | #include <linux/of.h> | ||
30 | #include <linux/of_irq.h> | ||
31 | #include <linux/of_address.h> | ||
29 | 32 | ||
33 | #include <asm/exception.h> | ||
30 | #include <asm/mach/irq.h> | 34 | #include <asm/mach/irq.h> |
31 | 35 | ||
32 | #include <mach/regs-irq.h> | 36 | #include <mach/regs-irq.h> |
@@ -36,6 +40,8 @@ | |||
36 | #include <plat/regs-irqtype.h> | 40 | #include <plat/regs-irqtype.h> |
37 | #include <plat/pm.h> | 41 | #include <plat/pm.h> |
38 | 42 | ||
43 | #include "irqchip.h" | ||
44 | |||
39 | #define S3C_IRQTYPE_NONE 0 | 45 | #define S3C_IRQTYPE_NONE 0 |
40 | #define S3C_IRQTYPE_EINT 1 | 46 | #define S3C_IRQTYPE_EINT 1 |
41 | #define S3C_IRQTYPE_EDGE 2 | 47 | #define S3C_IRQTYPE_EDGE 2 |
@@ -43,6 +49,7 @@ | |||
43 | 49 | ||
44 | struct s3c_irq_data { | 50 | struct s3c_irq_data { |
45 | unsigned int type; | 51 | unsigned int type; |
52 | unsigned long offset; | ||
46 | unsigned long parent_irq; | 53 | unsigned long parent_irq; |
47 | 54 | ||
48 | /* data gets filled during init */ | 55 | /* data gets filled during init */ |
@@ -69,23 +76,34 @@ struct s3c_irq_intc { | |||
69 | struct s3c_irq_data *irqs; | 76 | struct s3c_irq_data *irqs; |
70 | }; | 77 | }; |
71 | 78 | ||
79 | /* | ||
80 | * Array holding pointers to the global controller structs | ||
81 | * [0] ... main_intc | ||
82 | * [1] ... sub_intc | ||
83 | * [2] ... main_intc2 on s3c2416 | ||
84 | */ | ||
85 | static struct s3c_irq_intc *s3c_intc[3]; | ||
86 | |||
72 | static void s3c_irq_mask(struct irq_data *data) | 87 | static void s3c_irq_mask(struct irq_data *data) |
73 | { | 88 | { |
74 | struct s3c_irq_intc *intc = data->domain->host_data; | 89 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
90 | struct s3c_irq_intc *intc = irq_data->intc; | ||
75 | struct s3c_irq_intc *parent_intc = intc->parent; | 91 | struct s3c_irq_intc *parent_intc = intc->parent; |
76 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
77 | struct s3c_irq_data *parent_data; | 92 | struct s3c_irq_data *parent_data; |
78 | unsigned long mask; | 93 | unsigned long mask; |
79 | unsigned int irqno; | 94 | unsigned int irqno; |
80 | 95 | ||
81 | mask = __raw_readl(intc->reg_mask); | 96 | mask = __raw_readl(intc->reg_mask); |
82 | mask |= (1UL << data->hwirq); | 97 | mask |= (1UL << irq_data->offset); |
83 | __raw_writel(mask, intc->reg_mask); | 98 | __raw_writel(mask, intc->reg_mask); |
84 | 99 | ||
85 | if (parent_intc && irq_data->parent_irq) { | 100 | if (parent_intc) { |
86 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; | 101 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; |
87 | 102 | ||
88 | /* check to see if we need to mask the parent IRQ */ | 103 | /* check to see if we need to mask the parent IRQ |
104 | * The parent_irq is always in main_intc, so the hwirq | ||
105 | * for find_mapping does not need an offset in any case. | ||
106 | */ | ||
89 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { | 107 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { |
90 | irqno = irq_find_mapping(parent_intc->domain, | 108 | irqno = irq_find_mapping(parent_intc->domain, |
91 | irq_data->parent_irq); | 109 | irq_data->parent_irq); |
@@ -96,17 +114,17 @@ static void s3c_irq_mask(struct irq_data *data) | |||
96 | 114 | ||
97 | static void s3c_irq_unmask(struct irq_data *data) | 115 | static void s3c_irq_unmask(struct irq_data *data) |
98 | { | 116 | { |
99 | struct s3c_irq_intc *intc = data->domain->host_data; | 117 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
118 | struct s3c_irq_intc *intc = irq_data->intc; | ||
100 | struct s3c_irq_intc *parent_intc = intc->parent; | 119 | struct s3c_irq_intc *parent_intc = intc->parent; |
101 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
102 | unsigned long mask; | 120 | unsigned long mask; |
103 | unsigned int irqno; | 121 | unsigned int irqno; |
104 | 122 | ||
105 | mask = __raw_readl(intc->reg_mask); | 123 | mask = __raw_readl(intc->reg_mask); |
106 | mask &= ~(1UL << data->hwirq); | 124 | mask &= ~(1UL << irq_data->offset); |
107 | __raw_writel(mask, intc->reg_mask); | 125 | __raw_writel(mask, intc->reg_mask); |
108 | 126 | ||
109 | if (parent_intc && irq_data->parent_irq) { | 127 | if (parent_intc) { |
110 | irqno = irq_find_mapping(parent_intc->domain, | 128 | irqno = irq_find_mapping(parent_intc->domain, |
111 | irq_data->parent_irq); | 129 | irq_data->parent_irq); |
112 | s3c_irq_unmask(irq_get_irq_data(irqno)); | 130 | s3c_irq_unmask(irq_get_irq_data(irqno)); |
@@ -115,14 +133,37 @@ static void s3c_irq_unmask(struct irq_data *data) | |||
115 | 133 | ||
116 | static inline void s3c_irq_ack(struct irq_data *data) | 134 | static inline void s3c_irq_ack(struct irq_data *data) |
117 | { | 135 | { |
118 | struct s3c_irq_intc *intc = data->domain->host_data; | 136 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
119 | unsigned long bitval = 1UL << data->hwirq; | 137 | struct s3c_irq_intc *intc = irq_data->intc; |
138 | unsigned long bitval = 1UL << irq_data->offset; | ||
120 | 139 | ||
121 | __raw_writel(bitval, intc->reg_pending); | 140 | __raw_writel(bitval, intc->reg_pending); |
122 | if (intc->reg_intpnd) | 141 | if (intc->reg_intpnd) |
123 | __raw_writel(bitval, intc->reg_intpnd); | 142 | __raw_writel(bitval, intc->reg_intpnd); |
124 | } | 143 | } |
125 | 144 | ||
145 | static int s3c_irq_type(struct irq_data *data, unsigned int type) | ||
146 | { | ||
147 | switch (type) { | ||
148 | case IRQ_TYPE_NONE: | ||
149 | break; | ||
150 | case IRQ_TYPE_EDGE_RISING: | ||
151 | case IRQ_TYPE_EDGE_FALLING: | ||
152 | case IRQ_TYPE_EDGE_BOTH: | ||
153 | irq_set_handler(data->irq, handle_edge_irq); | ||
154 | break; | ||
155 | case IRQ_TYPE_LEVEL_LOW: | ||
156 | case IRQ_TYPE_LEVEL_HIGH: | ||
157 | irq_set_handler(data->irq, handle_level_irq); | ||
158 | break; | ||
159 | default: | ||
160 | pr_err("No such irq type %d", type); | ||
161 | return -EINVAL; | ||
162 | } | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
126 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, | 167 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, |
127 | void __iomem *extint_reg, | 168 | void __iomem *extint_reg, |
128 | unsigned long gpcon_offset, | 169 | unsigned long gpcon_offset, |
@@ -228,6 +269,7 @@ static struct irq_chip s3c_irq_chip = { | |||
228 | .irq_ack = s3c_irq_ack, | 269 | .irq_ack = s3c_irq_ack, |
229 | .irq_mask = s3c_irq_mask, | 270 | .irq_mask = s3c_irq_mask, |
230 | .irq_unmask = s3c_irq_unmask, | 271 | .irq_unmask = s3c_irq_unmask, |
272 | .irq_set_type = s3c_irq_type, | ||
231 | .irq_set_wake = s3c_irq_wake | 273 | .irq_set_wake = s3c_irq_wake |
232 | }; | 274 | }; |
233 | 275 | ||
@@ -236,6 +278,7 @@ static struct irq_chip s3c_irq_level_chip = { | |||
236 | .irq_mask = s3c_irq_mask, | 278 | .irq_mask = s3c_irq_mask, |
237 | .irq_unmask = s3c_irq_unmask, | 279 | .irq_unmask = s3c_irq_unmask, |
238 | .irq_ack = s3c_irq_ack, | 280 | .irq_ack = s3c_irq_ack, |
281 | .irq_set_type = s3c_irq_type, | ||
239 | }; | 282 | }; |
240 | 283 | ||
241 | static struct irq_chip s3c_irqext_chip = { | 284 | static struct irq_chip s3c_irqext_chip = { |
@@ -259,12 +302,19 @@ static struct irq_chip s3c_irq_eint0t4 = { | |||
259 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | 302 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) |
260 | { | 303 | { |
261 | struct irq_chip *chip = irq_desc_get_chip(desc); | 304 | struct irq_chip *chip = irq_desc_get_chip(desc); |
262 | struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; | 305 | struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc); |
263 | struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; | 306 | struct s3c_irq_intc *intc = irq_data->intc; |
264 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; | 307 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; |
265 | unsigned long src; | 308 | unsigned long src; |
266 | unsigned long msk; | 309 | unsigned long msk; |
267 | unsigned int n; | 310 | unsigned int n; |
311 | unsigned int offset; | ||
312 | |||
313 | /* we're using individual domains for the non-dt case | ||
314 | * and one big domain for the dt case where the subintc | ||
315 | * starts at hwirq number 32. | ||
316 | */ | ||
317 | offset = (intc->domain->of_node) ? 32 : 0; | ||
268 | 318 | ||
269 | chained_irq_enter(chip, desc); | 319 | chained_irq_enter(chip, desc); |
270 | 320 | ||
@@ -277,12 +327,64 @@ static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
277 | while (src) { | 327 | while (src) { |
278 | n = __ffs(src); | 328 | n = __ffs(src); |
279 | src &= ~(1 << n); | 329 | src &= ~(1 << n); |
280 | generic_handle_irq(irq_find_mapping(sub_intc->domain, n)); | 330 | irq = irq_find_mapping(sub_intc->domain, offset + n); |
331 | generic_handle_irq(irq); | ||
281 | } | 332 | } |
282 | 333 | ||
283 | chained_irq_exit(chip, desc); | 334 | chained_irq_exit(chip, desc); |
284 | } | 335 | } |
285 | 336 | ||
337 | static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, | ||
338 | struct pt_regs *regs, int intc_offset) | ||
339 | { | ||
340 | int pnd; | ||
341 | int offset; | ||
342 | int irq; | ||
343 | |||
344 | pnd = __raw_readl(intc->reg_intpnd); | ||
345 | if (!pnd) | ||
346 | return false; | ||
347 | |||
348 | /* non-dt machines use individual domains */ | ||
349 | if (!intc->domain->of_node) | ||
350 | intc_offset = 0; | ||
351 | |||
352 | /* We have a problem that the INTOFFSET register does not always | ||
353 | * show one interrupt. Occasionally we get two interrupts through | ||
354 | * the prioritiser, and this causes the INTOFFSET register to show | ||
355 | * what looks like the logical-or of the two interrupt numbers. | ||
356 | * | ||
357 | * Thanks to Klaus, Shannon, et al for helping to debug this problem | ||
358 | */ | ||
359 | offset = __raw_readl(intc->reg_intpnd + 4); | ||
360 | |||
361 | /* Find the bit manually, when the offset is wrong. | ||
362 | * The pending register only ever contains the one bit of the next | ||
363 | * interrupt to handle. | ||
364 | */ | ||
365 | if (!(pnd & (1 << offset))) | ||
366 | offset = __ffs(pnd); | ||
367 | |||
368 | irq = irq_find_mapping(intc->domain, intc_offset + offset); | ||
369 | handle_IRQ(irq, regs); | ||
370 | return true; | ||
371 | } | ||
372 | |||
373 | asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) | ||
374 | { | ||
375 | do { | ||
376 | if (likely(s3c_intc[0])) | ||
377 | if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) | ||
378 | continue; | ||
379 | |||
380 | if (s3c_intc[2]) | ||
381 | if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) | ||
382 | continue; | ||
383 | |||
384 | break; | ||
385 | } while (1); | ||
386 | } | ||
387 | |||
286 | #ifdef CONFIG_FIQ | 388 | #ifdef CONFIG_FIQ |
287 | /** | 389 | /** |
288 | * s3c24xx_set_fiq - set the FIQ routing | 390 | * s3c24xx_set_fiq - set the FIQ routing |
@@ -325,25 +427,21 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
325 | struct s3c_irq_data *parent_irq_data; | 427 | struct s3c_irq_data *parent_irq_data; |
326 | unsigned int irqno; | 428 | unsigned int irqno; |
327 | 429 | ||
328 | if (!intc) { | ||
329 | pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); | ||
330 | return -EINVAL; | ||
331 | } | ||
332 | |||
333 | if (!irq_data) { | ||
334 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); | ||
335 | return -EINVAL; | ||
336 | } | ||
337 | |||
338 | /* attach controller pointer to irq_data */ | 430 | /* attach controller pointer to irq_data */ |
339 | irq_data->intc = intc; | 431 | irq_data->intc = intc; |
432 | irq_data->offset = hw; | ||
433 | |||
434 | parent_intc = intc->parent; | ||
340 | 435 | ||
341 | /* set handler and flags */ | 436 | /* set handler and flags */ |
342 | switch (irq_data->type) { | 437 | switch (irq_data->type) { |
343 | case S3C_IRQTYPE_NONE: | 438 | case S3C_IRQTYPE_NONE: |
344 | return 0; | 439 | return 0; |
345 | case S3C_IRQTYPE_EINT: | 440 | case S3C_IRQTYPE_EINT: |
346 | if (irq_data->parent_irq) | 441 | /* On the S3C2412, the EINT0to3 have a parent irq |
442 | * but need the s3c_irq_eint0t4 chip | ||
443 | */ | ||
444 | if (parent_intc && (!soc_is_s3c2412() || hw >= 4)) | ||
347 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, | 445 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, |
348 | handle_edge_irq); | 446 | handle_edge_irq); |
349 | else | 447 | else |
@@ -351,8 +449,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
351 | handle_edge_irq); | 449 | handle_edge_irq); |
352 | break; | 450 | break; |
353 | case S3C_IRQTYPE_EDGE: | 451 | case S3C_IRQTYPE_EDGE: |
354 | if (irq_data->parent_irq || | 452 | if (parent_intc || intc->reg_pending == S3C2416_SRCPND2) |
355 | intc->reg_pending == S3C2416_SRCPND2) | ||
356 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 453 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
357 | handle_edge_irq); | 454 | handle_edge_irq); |
358 | else | 455 | else |
@@ -360,7 +457,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
360 | handle_edge_irq); | 457 | handle_edge_irq); |
361 | break; | 458 | break; |
362 | case S3C_IRQTYPE_LEVEL: | 459 | case S3C_IRQTYPE_LEVEL: |
363 | if (irq_data->parent_irq) | 460 | if (parent_intc) |
364 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 461 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
365 | handle_level_irq); | 462 | handle_level_irq); |
366 | else | 463 | else |
@@ -371,23 +468,19 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
371 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); | 468 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); |
372 | return -EINVAL; | 469 | return -EINVAL; |
373 | } | 470 | } |
471 | |||
472 | irq_set_chip_data(virq, irq_data); | ||
473 | |||
374 | set_irq_flags(virq, IRQF_VALID); | 474 | set_irq_flags(virq, IRQF_VALID); |
375 | 475 | ||
376 | if (irq_data->parent_irq) { | 476 | if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) { |
377 | parent_intc = intc->parent; | 477 | if (irq_data->parent_irq > 31) { |
378 | if (!parent_intc) { | 478 | pr_err("irq-s3c24xx: parent irq %lu is out of range\n", |
379 | pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", | 479 | irq_data->parent_irq); |
380 | hw); | ||
381 | goto err; | 480 | goto err; |
382 | } | 481 | } |
383 | 482 | ||
384 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | 483 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; |
385 | if (!irq_data) { | ||
386 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", | ||
387 | hw); | ||
388 | goto err; | ||
389 | } | ||
390 | |||
391 | parent_irq_data->sub_intc = intc; | 484 | parent_irq_data->sub_intc = intc; |
392 | parent_irq_data->sub_bits |= (1UL << hw); | 485 | parent_irq_data->sub_bits |= (1UL << hw); |
393 | 486 | ||
@@ -442,7 +535,7 @@ static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) | |||
442 | } | 535 | } |
443 | } | 536 | } |
444 | 537 | ||
445 | struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | 538 | static struct s3c_irq_intc * __init s3c24xx_init_intc(struct device_node *np, |
446 | struct s3c_irq_data *irq_data, | 539 | struct s3c_irq_data *irq_data, |
447 | struct s3c_irq_intc *parent, | 540 | struct s3c_irq_intc *parent, |
448 | unsigned long address) | 541 | unsigned long address) |
@@ -451,7 +544,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
451 | void __iomem *base = (void *)0xf6000000; /* static mapping */ | 544 | void __iomem *base = (void *)0xf6000000; /* static mapping */ |
452 | int irq_num; | 545 | int irq_num; |
453 | int irq_start; | 546 | int irq_start; |
454 | int irq_offset; | ||
455 | int ret; | 547 | int ret; |
456 | 548 | ||
457 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); | 549 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); |
@@ -475,7 +567,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
475 | intc->reg_intpnd = base + 0x10; | 567 | intc->reg_intpnd = base + 0x10; |
476 | irq_num = 32; | 568 | irq_num = 32; |
477 | irq_start = S3C2410_IRQ(0); | 569 | irq_start = S3C2410_IRQ(0); |
478 | irq_offset = 0; | ||
479 | break; | 570 | break; |
480 | case 0x4a000018: | 571 | case 0x4a000018: |
481 | pr_debug("irq: found subintc\n"); | 572 | pr_debug("irq: found subintc\n"); |
@@ -483,7 +574,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
483 | intc->reg_mask = base + 0x1c; | 574 | intc->reg_mask = base + 0x1c; |
484 | irq_num = 29; | 575 | irq_num = 29; |
485 | irq_start = S3C2410_IRQSUB(0); | 576 | irq_start = S3C2410_IRQSUB(0); |
486 | irq_offset = 0; | ||
487 | break; | 577 | break; |
488 | case 0x4a000040: | 578 | case 0x4a000040: |
489 | pr_debug("irq: found intc2\n"); | 579 | pr_debug("irq: found intc2\n"); |
@@ -492,7 +582,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
492 | intc->reg_intpnd = base + 0x50; | 582 | intc->reg_intpnd = base + 0x50; |
493 | irq_num = 8; | 583 | irq_num = 8; |
494 | irq_start = S3C2416_IRQ(0); | 584 | irq_start = S3C2416_IRQ(0); |
495 | irq_offset = 0; | ||
496 | break; | 585 | break; |
497 | case 0x560000a4: | 586 | case 0x560000a4: |
498 | pr_debug("irq: found eintc\n"); | 587 | pr_debug("irq: found eintc\n"); |
@@ -500,9 +589,8 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
500 | 589 | ||
501 | intc->reg_mask = base + 0xa4; | 590 | intc->reg_mask = base + 0xa4; |
502 | intc->reg_pending = base + 0xa8; | 591 | intc->reg_pending = base + 0xa8; |
503 | irq_num = 20; | 592 | irq_num = 24; |
504 | irq_start = S3C2410_IRQ(32); | 593 | irq_start = S3C2410_IRQ(32); |
505 | irq_offset = 4; | ||
506 | break; | 594 | break; |
507 | default: | 595 | default: |
508 | pr_err("irq: unsupported controller address\n"); | 596 | pr_err("irq: unsupported controller address\n"); |
@@ -513,7 +601,7 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
513 | /* now that all the data is complete, init the irq-domain */ | 601 | /* now that all the data is complete, init the irq-domain */ |
514 | s3c24xx_clear_intc(intc); | 602 | s3c24xx_clear_intc(intc); |
515 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, | 603 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, |
516 | irq_offset, &s3c24xx_irq_ops, | 604 | 0, &s3c24xx_irq_ops, |
517 | intc); | 605 | intc); |
518 | if (!intc->domain) { | 606 | if (!intc->domain) { |
519 | pr_err("irq: could not create irq-domain\n"); | 607 | pr_err("irq: could not create irq-domain\n"); |
@@ -521,6 +609,8 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
521 | goto err; | 609 | goto err; |
522 | } | 610 | } |
523 | 611 | ||
612 | set_handle_irq(s3c24xx_handle_irq); | ||
613 | |||
524 | return intc; | 614 | return intc; |
525 | 615 | ||
526 | err: | 616 | err: |
@@ -528,12 +618,35 @@ err: | |||
528 | return ERR_PTR(ret); | 618 | return ERR_PTR(ret); |
529 | } | 619 | } |
530 | 620 | ||
531 | /* s3c24xx_init_irq | 621 | static struct s3c_irq_data init_eint[32] = { |
532 | * | 622 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
533 | * Initialise S3C2410 IRQ system | 623 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
534 | */ | 624 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
625 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
626 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | ||
627 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | ||
628 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | ||
629 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ | ||
630 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ | ||
631 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ | ||
632 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ | ||
633 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ | ||
634 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ | ||
635 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ | ||
636 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ | ||
637 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ | ||
638 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ | ||
639 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ | ||
640 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ | ||
641 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ | ||
642 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ | ||
643 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ | ||
644 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ | ||
645 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | ||
646 | }; | ||
535 | 647 | ||
536 | static struct s3c_irq_data init_base[32] = { | 648 | #ifdef CONFIG_CPU_S3C2410 |
649 | static struct s3c_irq_data init_s3c2410base[32] = { | ||
537 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | 650 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
538 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | 651 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
539 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | 652 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
@@ -568,11 +681,80 @@ static struct s3c_irq_data init_base[32] = { | |||
568 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | 681 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
569 | }; | 682 | }; |
570 | 683 | ||
571 | static struct s3c_irq_data init_eint[32] = { | 684 | static struct s3c_irq_data init_s3c2410subint[32] = { |
572 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 685 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
573 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 686 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
687 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
688 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
689 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
690 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
691 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
692 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
693 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
694 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
695 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
696 | }; | ||
697 | |||
698 | void __init s3c2410_init_irq(void) | ||
699 | { | ||
700 | #ifdef CONFIG_FIQ | ||
701 | init_FIQ(FIQ_START); | ||
702 | #endif | ||
703 | |||
704 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL, | ||
705 | 0x4a000000); | ||
706 | if (IS_ERR(s3c_intc[0])) { | ||
707 | pr_err("irq: could not create main interrupt controller\n"); | ||
708 | return; | ||
709 | } | ||
710 | |||
711 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0], | ||
712 | s3c_intc[0], 0x4a000018); | ||
713 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
714 | } | ||
715 | #endif | ||
716 | |||
717 | #ifdef CONFIG_CPU_S3C2412 | ||
718 | static struct s3c_irq_data init_s3c2412base[32] = { | ||
719 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */ | ||
720 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */ | ||
721 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */ | ||
722 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */ | ||
723 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
724 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
574 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 725 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
726 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
727 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
728 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ | ||
729 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
730 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
731 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
732 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
733 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
734 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
735 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
736 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
737 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
738 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
739 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
740 | { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */ | ||
741 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
742 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
575 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 743 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
744 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
745 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
746 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
747 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
748 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
749 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
750 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
751 | }; | ||
752 | |||
753 | static struct s3c_irq_data init_s3c2412eint[32] = { | ||
754 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */ | ||
755 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */ | ||
756 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */ | ||
757 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */ | ||
576 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | 758 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ |
577 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | 759 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ |
578 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | 760 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ |
@@ -595,7 +777,7 @@ static struct s3c_irq_data init_eint[32] = { | |||
595 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | 777 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ |
596 | }; | 778 | }; |
597 | 779 | ||
598 | static struct s3c_irq_data init_subint[32] = { | 780 | static struct s3c_irq_data init_s3c2412subint[32] = { |
599 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | 781 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
600 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | 782 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
601 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | 783 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
@@ -607,25 +789,32 @@ static struct s3c_irq_data init_subint[32] = { | |||
607 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | 789 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
608 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | 790 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
609 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | 791 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
792 | { .type = S3C_IRQTYPE_NONE, }, | ||
793 | { .type = S3C_IRQTYPE_NONE, }, | ||
794 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */ | ||
795 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */ | ||
610 | }; | 796 | }; |
611 | 797 | ||
612 | void __init s3c24xx_init_irq(void) | 798 | void __init s3c2412_init_irq(void) |
613 | { | 799 | { |
614 | struct s3c_irq_intc *main_intc; | 800 | pr_info("S3C2412: IRQ Support\n"); |
615 | 801 | ||
616 | #ifdef CONFIG_FIQ | 802 | #ifdef CONFIG_FIQ |
617 | init_FIQ(FIQ_START); | 803 | init_FIQ(FIQ_START); |
618 | #endif | 804 | #endif |
619 | 805 | ||
620 | main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); | 806 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, |
621 | if (IS_ERR(main_intc)) { | 807 | 0x4a000000); |
808 | if (IS_ERR(s3c_intc[0])) { | ||
622 | pr_err("irq: could not create main interrupt controller\n"); | 809 | pr_err("irq: could not create main interrupt controller\n"); |
623 | return; | 810 | return; |
624 | } | 811 | } |
625 | 812 | ||
626 | s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); | 813 | s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4); |
627 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 814 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0], |
815 | s3c_intc[0], 0x4a000018); | ||
628 | } | 816 | } |
817 | #endif | ||
629 | 818 | ||
630 | #ifdef CONFIG_CPU_S3C2416 | 819 | #ifdef CONFIG_CPU_S3C2416 |
631 | static struct s3c_irq_data init_s3c2416base[32] = { | 820 | static struct s3c_irq_data init_s3c2416base[32] = { |
@@ -697,37 +886,185 @@ static struct s3c_irq_data init_s3c2416subint[32] = { | |||
697 | 886 | ||
698 | static struct s3c_irq_data init_s3c2416_second[32] = { | 887 | static struct s3c_irq_data init_s3c2416_second[32] = { |
699 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ | 888 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ |
700 | { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ | 889 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
701 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 890 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
702 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 891 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
703 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ | 892 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ |
704 | { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ | 893 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
705 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ | 894 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ |
706 | { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ | ||
707 | }; | 895 | }; |
708 | 896 | ||
709 | void __init s3c2416_init_irq(void) | 897 | void __init s3c2416_init_irq(void) |
710 | { | 898 | { |
711 | struct s3c_irq_intc *main_intc; | ||
712 | |||
713 | pr_info("S3C2416: IRQ Support\n"); | 899 | pr_info("S3C2416: IRQ Support\n"); |
714 | 900 | ||
715 | #ifdef CONFIG_FIQ | 901 | #ifdef CONFIG_FIQ |
716 | init_FIQ(FIQ_START); | 902 | init_FIQ(FIQ_START); |
717 | #endif | 903 | #endif |
718 | 904 | ||
719 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); | 905 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, |
720 | if (IS_ERR(main_intc)) { | 906 | 0x4a000000); |
907 | if (IS_ERR(s3c_intc[0])) { | ||
721 | pr_err("irq: could not create main interrupt controller\n"); | 908 | pr_err("irq: could not create main interrupt controller\n"); |
722 | return; | 909 | return; |
723 | } | 910 | } |
724 | 911 | ||
725 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 912 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
726 | s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018); | 913 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2416subint[0], |
914 | s3c_intc[0], 0x4a000018); | ||
915 | |||
916 | s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0], | ||
917 | NULL, 0x4a000040); | ||
918 | } | ||
919 | |||
920 | #endif | ||
921 | |||
922 | #ifdef CONFIG_CPU_S3C2440 | ||
923 | static struct s3c_irq_data init_s3c2440base[32] = { | ||
924 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
925 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
926 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
927 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
928 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
929 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
930 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ | ||
931 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
932 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
933 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ | ||
934 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
935 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
936 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
937 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
938 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
939 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
940 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
941 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
942 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
943 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
944 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
945 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ | ||
946 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
947 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
948 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ | ||
949 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
950 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
951 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
952 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
953 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
954 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
955 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
956 | }; | ||
957 | |||
958 | static struct s3c_irq_data init_s3c2440subint[32] = { | ||
959 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
960 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
961 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
962 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
963 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
964 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
965 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
966 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
967 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
968 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
969 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
970 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ | ||
971 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ | ||
972 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ | ||
973 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ | ||
974 | }; | ||
975 | |||
976 | void __init s3c2440_init_irq(void) | ||
977 | { | ||
978 | pr_info("S3C2440: IRQ Support\n"); | ||
727 | 979 | ||
728 | s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); | 980 | #ifdef CONFIG_FIQ |
981 | init_FIQ(FIQ_START); | ||
982 | #endif | ||
983 | |||
984 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, | ||
985 | 0x4a000000); | ||
986 | if (IS_ERR(s3c_intc[0])) { | ||
987 | pr_err("irq: could not create main interrupt controller\n"); | ||
988 | return; | ||
989 | } | ||
990 | |||
991 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
992 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0], | ||
993 | s3c_intc[0], 0x4a000018); | ||
729 | } | 994 | } |
995 | #endif | ||
730 | 996 | ||
997 | #ifdef CONFIG_CPU_S3C2442 | ||
998 | static struct s3c_irq_data init_s3c2442base[32] = { | ||
999 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
1000 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
1001 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
1002 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
1003 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
1004 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
1005 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ | ||
1006 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
1007 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
1008 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ | ||
1009 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
1010 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
1011 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
1012 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
1013 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
1014 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
1015 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
1016 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
1017 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
1018 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
1019 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
1020 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ | ||
1021 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
1022 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
1023 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ | ||
1024 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
1025 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
1026 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
1027 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
1028 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
1029 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
1030 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
1031 | }; | ||
1032 | |||
1033 | static struct s3c_irq_data init_s3c2442subint[32] = { | ||
1034 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
1035 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
1036 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
1037 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
1038 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
1039 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
1040 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
1041 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
1042 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
1043 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
1044 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
1045 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ | ||
1046 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ | ||
1047 | }; | ||
1048 | |||
1049 | void __init s3c2442_init_irq(void) | ||
1050 | { | ||
1051 | pr_info("S3C2442: IRQ Support\n"); | ||
1052 | |||
1053 | #ifdef CONFIG_FIQ | ||
1054 | init_FIQ(FIQ_START); | ||
1055 | #endif | ||
1056 | |||
1057 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, | ||
1058 | 0x4a000000); | ||
1059 | if (IS_ERR(s3c_intc[0])) { | ||
1060 | pr_err("irq: could not create main interrupt controller\n"); | ||
1061 | return; | ||
1062 | } | ||
1063 | |||
1064 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
1065 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0], | ||
1066 | s3c_intc[0], 0x4a000018); | ||
1067 | } | ||
731 | #endif | 1068 | #endif |
732 | 1069 | ||
733 | #ifdef CONFIG_CPU_S3C2443 | 1070 | #ifdef CONFIG_CPU_S3C2443 |
@@ -801,21 +1138,219 @@ static struct s3c_irq_data init_s3c2443subint[32] = { | |||
801 | 1138 | ||
802 | void __init s3c2443_init_irq(void) | 1139 | void __init s3c2443_init_irq(void) |
803 | { | 1140 | { |
804 | struct s3c_irq_intc *main_intc; | ||
805 | |||
806 | pr_info("S3C2443: IRQ Support\n"); | 1141 | pr_info("S3C2443: IRQ Support\n"); |
807 | 1142 | ||
808 | #ifdef CONFIG_FIQ | 1143 | #ifdef CONFIG_FIQ |
809 | init_FIQ(FIQ_START); | 1144 | init_FIQ(FIQ_START); |
810 | #endif | 1145 | #endif |
811 | 1146 | ||
812 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); | 1147 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, |
813 | if (IS_ERR(main_intc)) { | 1148 | 0x4a000000); |
1149 | if (IS_ERR(s3c_intc[0])) { | ||
814 | pr_err("irq: could not create main interrupt controller\n"); | 1150 | pr_err("irq: could not create main interrupt controller\n"); |
815 | return; | 1151 | return; |
816 | } | 1152 | } |
817 | 1153 | ||
818 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 1154 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
819 | s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018); | 1155 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0], |
1156 | s3c_intc[0], 0x4a000018); | ||
1157 | } | ||
1158 | #endif | ||
1159 | |||
1160 | #ifdef CONFIG_OF | ||
1161 | static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq, | ||
1162 | irq_hw_number_t hw) | ||
1163 | { | ||
1164 | unsigned int ctrl_num = hw / 32; | ||
1165 | unsigned int intc_hw = hw % 32; | ||
1166 | struct s3c_irq_intc *intc = s3c_intc[ctrl_num]; | ||
1167 | struct s3c_irq_intc *parent_intc = intc->parent; | ||
1168 | struct s3c_irq_data *irq_data = &intc->irqs[intc_hw]; | ||
1169 | |||
1170 | /* attach controller pointer to irq_data */ | ||
1171 | irq_data->intc = intc; | ||
1172 | irq_data->offset = intc_hw; | ||
1173 | |||
1174 | if (!parent_intc) | ||
1175 | irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq); | ||
1176 | else | ||
1177 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | ||
1178 | handle_edge_irq); | ||
1179 | |||
1180 | irq_set_chip_data(virq, irq_data); | ||
1181 | |||
1182 | set_irq_flags(virq, IRQF_VALID); | ||
1183 | |||
1184 | return 0; | ||
1185 | } | ||
1186 | |||
1187 | /* Translate our of irq notation | ||
1188 | * format: <ctrl_num ctrl_irq parent_irq type> | ||
1189 | */ | ||
1190 | static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n, | ||
1191 | const u32 *intspec, unsigned int intsize, | ||
1192 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
1193 | { | ||
1194 | struct s3c_irq_intc *intc; | ||
1195 | struct s3c_irq_intc *parent_intc; | ||
1196 | struct s3c_irq_data *irq_data; | ||
1197 | struct s3c_irq_data *parent_irq_data; | ||
1198 | int irqno; | ||
1199 | |||
1200 | if (WARN_ON(intsize < 4)) | ||
1201 | return -EINVAL; | ||
1202 | |||
1203 | if (intspec[0] > 2 || !s3c_intc[intspec[0]]) { | ||
1204 | pr_err("controller number %d invalid\n", intspec[0]); | ||
1205 | return -EINVAL; | ||
1206 | } | ||
1207 | intc = s3c_intc[intspec[0]]; | ||
1208 | |||
1209 | *out_hwirq = intspec[0] * 32 + intspec[2]; | ||
1210 | *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK; | ||
1211 | |||
1212 | parent_intc = intc->parent; | ||
1213 | if (parent_intc) { | ||
1214 | irq_data = &intc->irqs[intspec[2]]; | ||
1215 | irq_data->parent_irq = intspec[1]; | ||
1216 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | ||
1217 | parent_irq_data->sub_intc = intc; | ||
1218 | parent_irq_data->sub_bits |= (1UL << intspec[2]); | ||
1219 | |||
1220 | /* parent_intc is always s3c_intc[0], so no offset */ | ||
1221 | irqno = irq_create_mapping(parent_intc->domain, intspec[1]); | ||
1222 | if (irqno < 0) { | ||
1223 | pr_err("irq: could not map parent interrupt\n"); | ||
1224 | return irqno; | ||
1225 | } | ||
1226 | |||
1227 | irq_set_chained_handler(irqno, s3c_irq_demux); | ||
1228 | } | ||
1229 | |||
1230 | return 0; | ||
1231 | } | ||
1232 | |||
1233 | static struct irq_domain_ops s3c24xx_irq_ops_of = { | ||
1234 | .map = s3c24xx_irq_map_of, | ||
1235 | .xlate = s3c24xx_irq_xlate_of, | ||
1236 | }; | ||
1237 | |||
1238 | struct s3c24xx_irq_of_ctrl { | ||
1239 | char *name; | ||
1240 | unsigned long offset; | ||
1241 | struct s3c_irq_intc **handle; | ||
1242 | struct s3c_irq_intc **parent; | ||
1243 | struct irq_domain_ops *ops; | ||
1244 | }; | ||
1245 | |||
1246 | static int __init s3c_init_intc_of(struct device_node *np, | ||
1247 | struct device_node *interrupt_parent, | ||
1248 | struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl) | ||
1249 | { | ||
1250 | struct s3c_irq_intc *intc; | ||
1251 | struct s3c24xx_irq_of_ctrl *ctrl; | ||
1252 | struct irq_domain *domain; | ||
1253 | void __iomem *reg_base; | ||
1254 | int i; | ||
1255 | |||
1256 | reg_base = of_iomap(np, 0); | ||
1257 | if (!reg_base) { | ||
1258 | pr_err("irq-s3c24xx: could not map irq registers\n"); | ||
1259 | return -EINVAL; | ||
1260 | } | ||
1261 | |||
1262 | domain = irq_domain_add_linear(np, num_ctrl * 32, | ||
1263 | &s3c24xx_irq_ops_of, NULL); | ||
1264 | if (!domain) { | ||
1265 | pr_err("irq: could not create irq-domain\n"); | ||
1266 | return -EINVAL; | ||
1267 | } | ||
1268 | |||
1269 | for (i = 0; i < num_ctrl; i++) { | ||
1270 | ctrl = &s3c_ctrl[i]; | ||
1271 | |||
1272 | pr_debug("irq: found controller %s\n", ctrl->name); | ||
1273 | |||
1274 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); | ||
1275 | if (!intc) | ||
1276 | return -ENOMEM; | ||
1277 | |||
1278 | intc->domain = domain; | ||
1279 | intc->irqs = kzalloc(sizeof(struct s3c_irq_data) * 32, | ||
1280 | GFP_KERNEL); | ||
1281 | if (!intc->irqs) { | ||
1282 | kfree(intc); | ||
1283 | return -ENOMEM; | ||
1284 | } | ||
1285 | |||
1286 | if (ctrl->parent) { | ||
1287 | intc->reg_pending = reg_base + ctrl->offset; | ||
1288 | intc->reg_mask = reg_base + ctrl->offset + 0x4; | ||
1289 | |||
1290 | if (*(ctrl->parent)) { | ||
1291 | intc->parent = *(ctrl->parent); | ||
1292 | } else { | ||
1293 | pr_warn("irq: parent of %s missing\n", | ||
1294 | ctrl->name); | ||
1295 | kfree(intc->irqs); | ||
1296 | kfree(intc); | ||
1297 | continue; | ||
1298 | } | ||
1299 | } else { | ||
1300 | intc->reg_pending = reg_base + ctrl->offset; | ||
1301 | intc->reg_mask = reg_base + ctrl->offset + 0x08; | ||
1302 | intc->reg_intpnd = reg_base + ctrl->offset + 0x10; | ||
1303 | } | ||
1304 | |||
1305 | s3c24xx_clear_intc(intc); | ||
1306 | s3c_intc[i] = intc; | ||
1307 | } | ||
1308 | |||
1309 | set_handle_irq(s3c24xx_handle_irq); | ||
1310 | |||
1311 | return 0; | ||
1312 | } | ||
1313 | |||
1314 | static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = { | ||
1315 | { | ||
1316 | .name = "intc", | ||
1317 | .offset = 0, | ||
1318 | }, { | ||
1319 | .name = "subintc", | ||
1320 | .offset = 0x18, | ||
1321 | .parent = &s3c_intc[0], | ||
1322 | } | ||
1323 | }; | ||
1324 | |||
1325 | int __init s3c2410_init_intc_of(struct device_node *np, | ||
1326 | struct device_node *interrupt_parent, | ||
1327 | struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) | ||
1328 | { | ||
1329 | return s3c_init_intc_of(np, interrupt_parent, | ||
1330 | s3c2410_ctrl, ARRAY_SIZE(s3c2410_ctrl)); | ||
1331 | } | ||
1332 | IRQCHIP_DECLARE(s3c2410_irq, "samsung,s3c2410-irq", s3c2410_init_intc_of); | ||
1333 | |||
1334 | static struct s3c24xx_irq_of_ctrl s3c2416_ctrl[] = { | ||
1335 | { | ||
1336 | .name = "intc", | ||
1337 | .offset = 0, | ||
1338 | }, { | ||
1339 | .name = "subintc", | ||
1340 | .offset = 0x18, | ||
1341 | .parent = &s3c_intc[0], | ||
1342 | }, { | ||
1343 | .name = "intc2", | ||
1344 | .offset = 0x40, | ||
1345 | } | ||
1346 | }; | ||
1347 | |||
1348 | int __init s3c2416_init_intc_of(struct device_node *np, | ||
1349 | struct device_node *interrupt_parent, | ||
1350 | struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) | ||
1351 | { | ||
1352 | return s3c_init_intc_of(np, interrupt_parent, | ||
1353 | s3c2416_ctrl, ARRAY_SIZE(s3c2416_ctrl)); | ||
820 | } | 1354 | } |
1355 | IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of); | ||
821 | #endif | 1356 | #endif |
diff --git a/arch/arm/mach-vt8500/irq.c b/drivers/irqchip/irq-vt8500.c index b9cf5ce9efbb..d97059550a2c 100644 --- a/arch/arm/mach-vt8500/irq.c +++ b/drivers/irqchip/irq-vt8500.c | |||
@@ -37,6 +37,9 @@ | |||
37 | 37 | ||
38 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
39 | #include <asm/exception.h> | 39 | #include <asm/exception.h> |
40 | #include <asm/mach/irq.h> | ||
41 | |||
42 | #include "irqchip.h" | ||
40 | 43 | ||
41 | #define VT8500_ICPC_IRQ 0x20 | 44 | #define VT8500_ICPC_IRQ 0x20 |
42 | #define VT8500_ICPC_FIQ 0x24 | 45 | #define VT8500_ICPC_FIQ 0x24 |
@@ -225,6 +228,8 @@ int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) | |||
225 | goto out; | 228 | goto out; |
226 | } | 229 | } |
227 | 230 | ||
231 | set_handle_irq(vt8500_handle_irq); | ||
232 | |||
228 | vt8500_init_irq_hw(intc[active_cnt].base); | 233 | vt8500_init_irq_hw(intc[active_cnt].base); |
229 | 234 | ||
230 | pr_info("vt8500-irq: Added interrupt controller\n"); | 235 | pr_info("vt8500-irq: Added interrupt controller\n"); |
@@ -251,3 +256,4 @@ out: | |||
251 | return 0; | 256 | return 0; |
252 | } | 257 | } |
253 | 258 | ||
259 | IRQCHIP_DECLARE(vt8500_irq, "via,vt8500-intc", vt8500_irq_init); | ||
diff --git a/drivers/of/base.c b/drivers/of/base.c index 0a2bdd106b23..c76d16c972cc 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -747,6 +747,64 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
747 | EXPORT_SYMBOL(of_find_node_by_phandle); | 747 | EXPORT_SYMBOL(of_find_node_by_phandle); |
748 | 748 | ||
749 | /** | 749 | /** |
750 | * of_find_property_value_of_size | ||
751 | * | ||
752 | * @np: device node from which the property value is to be read. | ||
753 | * @propname: name of the property to be searched. | ||
754 | * @len: requested length of property value | ||
755 | * | ||
756 | * Search for a property in a device node and valid the requested size. | ||
757 | * Returns the property value on success, -EINVAL if the property does not | ||
758 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
759 | * property data isn't large enough. | ||
760 | * | ||
761 | */ | ||
762 | static void *of_find_property_value_of_size(const struct device_node *np, | ||
763 | const char *propname, u32 len) | ||
764 | { | ||
765 | struct property *prop = of_find_property(np, propname, NULL); | ||
766 | |||
767 | if (!prop) | ||
768 | return ERR_PTR(-EINVAL); | ||
769 | if (!prop->value) | ||
770 | return ERR_PTR(-ENODATA); | ||
771 | if (len > prop->length) | ||
772 | return ERR_PTR(-EOVERFLOW); | ||
773 | |||
774 | return prop->value; | ||
775 | } | ||
776 | |||
777 | /** | ||
778 | * of_property_read_u32_index - Find and read a u32 from a multi-value property. | ||
779 | * | ||
780 | * @np: device node from which the property value is to be read. | ||
781 | * @propname: name of the property to be searched. | ||
782 | * @index: index of the u32 in the list of values | ||
783 | * @out_value: pointer to return value, modified only if no error. | ||
784 | * | ||
785 | * Search for a property in a device node and read nth 32-bit value from | ||
786 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
787 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
788 | * property data isn't large enough. | ||
789 | * | ||
790 | * The out_value is modified only if a valid u32 value can be decoded. | ||
791 | */ | ||
792 | int of_property_read_u32_index(const struct device_node *np, | ||
793 | const char *propname, | ||
794 | u32 index, u32 *out_value) | ||
795 | { | ||
796 | const u32 *val = of_find_property_value_of_size(np, propname, | ||
797 | ((index + 1) * sizeof(*out_value))); | ||
798 | |||
799 | if (IS_ERR(val)) | ||
800 | return PTR_ERR(val); | ||
801 | |||
802 | *out_value = be32_to_cpup(((__be32 *)val) + index); | ||
803 | return 0; | ||
804 | } | ||
805 | EXPORT_SYMBOL_GPL(of_property_read_u32_index); | ||
806 | |||
807 | /** | ||
750 | * of_property_read_u8_array - Find and read an array of u8 from a property. | 808 | * of_property_read_u8_array - Find and read an array of u8 from a property. |
751 | * | 809 | * |
752 | * @np: device node from which the property value is to be read. | 810 | * @np: device node from which the property value is to be read. |
@@ -767,17 +825,12 @@ EXPORT_SYMBOL(of_find_node_by_phandle); | |||
767 | int of_property_read_u8_array(const struct device_node *np, | 825 | int of_property_read_u8_array(const struct device_node *np, |
768 | const char *propname, u8 *out_values, size_t sz) | 826 | const char *propname, u8 *out_values, size_t sz) |
769 | { | 827 | { |
770 | struct property *prop = of_find_property(np, propname, NULL); | 828 | const u8 *val = of_find_property_value_of_size(np, propname, |
771 | const u8 *val; | 829 | (sz * sizeof(*out_values))); |
772 | 830 | ||
773 | if (!prop) | 831 | if (IS_ERR(val)) |
774 | return -EINVAL; | 832 | return PTR_ERR(val); |
775 | if (!prop->value) | ||
776 | return -ENODATA; | ||
777 | if ((sz * sizeof(*out_values)) > prop->length) | ||
778 | return -EOVERFLOW; | ||
779 | 833 | ||
780 | val = prop->value; | ||
781 | while (sz--) | 834 | while (sz--) |
782 | *out_values++ = *val++; | 835 | *out_values++ = *val++; |
783 | return 0; | 836 | return 0; |
@@ -805,17 +858,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array); | |||
805 | int of_property_read_u16_array(const struct device_node *np, | 858 | int of_property_read_u16_array(const struct device_node *np, |
806 | const char *propname, u16 *out_values, size_t sz) | 859 | const char *propname, u16 *out_values, size_t sz) |
807 | { | 860 | { |
808 | struct property *prop = of_find_property(np, propname, NULL); | 861 | const __be16 *val = of_find_property_value_of_size(np, propname, |
809 | const __be16 *val; | 862 | (sz * sizeof(*out_values))); |
810 | 863 | ||
811 | if (!prop) | 864 | if (IS_ERR(val)) |
812 | return -EINVAL; | 865 | return PTR_ERR(val); |
813 | if (!prop->value) | ||
814 | return -ENODATA; | ||
815 | if ((sz * sizeof(*out_values)) > prop->length) | ||
816 | return -EOVERFLOW; | ||
817 | 866 | ||
818 | val = prop->value; | ||
819 | while (sz--) | 867 | while (sz--) |
820 | *out_values++ = be16_to_cpup(val++); | 868 | *out_values++ = be16_to_cpup(val++); |
821 | return 0; | 869 | return 0; |
@@ -842,17 +890,12 @@ int of_property_read_u32_array(const struct device_node *np, | |||
842 | const char *propname, u32 *out_values, | 890 | const char *propname, u32 *out_values, |
843 | size_t sz) | 891 | size_t sz) |
844 | { | 892 | { |
845 | struct property *prop = of_find_property(np, propname, NULL); | 893 | const __be32 *val = of_find_property_value_of_size(np, propname, |
846 | const __be32 *val; | 894 | (sz * sizeof(*out_values))); |
847 | 895 | ||
848 | if (!prop) | 896 | if (IS_ERR(val)) |
849 | return -EINVAL; | 897 | return PTR_ERR(val); |
850 | if (!prop->value) | ||
851 | return -ENODATA; | ||
852 | if ((sz * sizeof(*out_values)) > prop->length) | ||
853 | return -EOVERFLOW; | ||
854 | 898 | ||
855 | val = prop->value; | ||
856 | while (sz--) | 899 | while (sz--) |
857 | *out_values++ = be32_to_cpup(val++); | 900 | *out_values++ = be32_to_cpup(val++); |
858 | return 0; | 901 | return 0; |
@@ -875,15 +918,13 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array); | |||
875 | int of_property_read_u64(const struct device_node *np, const char *propname, | 918 | int of_property_read_u64(const struct device_node *np, const char *propname, |
876 | u64 *out_value) | 919 | u64 *out_value) |
877 | { | 920 | { |
878 | struct property *prop = of_find_property(np, propname, NULL); | 921 | const __be32 *val = of_find_property_value_of_size(np, propname, |
922 | sizeof(*out_value)); | ||
879 | 923 | ||
880 | if (!prop) | 924 | if (IS_ERR(val)) |
881 | return -EINVAL; | 925 | return PTR_ERR(val); |
882 | if (!prop->value) | 926 | |
883 | return -ENODATA; | 927 | *out_value = of_read_number(val, 2); |
884 | if (sizeof(*out_value) > prop->length) | ||
885 | return -EOVERFLOW; | ||
886 | *out_value = of_read_number(prop->value, 2); | ||
887 | return 0; | 928 | return 0; |
888 | } | 929 | } |
889 | EXPORT_SYMBOL_GPL(of_property_read_u64); | 930 | EXPORT_SYMBOL_GPL(of_property_read_u64); |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 51336b2aedc9..8f6692438149 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -224,6 +224,7 @@ config PINCTRL_S3C64XX | |||
224 | source "drivers/pinctrl/mvebu/Kconfig" | 224 | source "drivers/pinctrl/mvebu/Kconfig" |
225 | source "drivers/pinctrl/sh-pfc/Kconfig" | 225 | source "drivers/pinctrl/sh-pfc/Kconfig" |
226 | source "drivers/pinctrl/spear/Kconfig" | 226 | source "drivers/pinctrl/spear/Kconfig" |
227 | source "drivers/pinctrl/vt8500/Kconfig" | ||
227 | 228 | ||
228 | config PINCTRL_XWAY | 229 | config PINCTRL_XWAY |
229 | bool | 230 | bool |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index b9aaa61facd1..9bdaeb8785ce 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -50,3 +50,4 @@ obj-$(CONFIG_PLAT_ORION) += mvebu/ | |||
50 | obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ | 50 | obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ |
51 | obj-$(CONFIG_SUPERH) += sh-pfc/ | 51 | obj-$(CONFIG_SUPERH) += sh-pfc/ |
52 | obj-$(CONFIG_PLAT_SPEAR) += spear/ | 52 | obj-$(CONFIG_PLAT_SPEAR) += spear/ |
53 | obj-$(CONFIG_ARCH_VT8500) += vt8500/ | ||
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c index f28d4b08771a..c8f20a3d8f88 100644 --- a/drivers/pinctrl/pinctrl-bcm2835.c +++ b/drivers/pinctrl/pinctrl-bcm2835.c | |||
@@ -699,11 +699,6 @@ static int bcm2835_pctl_dt_node_to_map_pull(struct bcm2835_pinctrl *pc, | |||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
701 | 701 | ||
702 | static inline u32 prop_u32(struct property *p, int i) | ||
703 | { | ||
704 | return be32_to_cpup(((__be32 *)p->value) + i); | ||
705 | } | ||
706 | |||
707 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | 702 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, |
708 | struct device_node *np, | 703 | struct device_node *np, |
709 | struct pinctrl_map **map, unsigned *num_maps) | 704 | struct pinctrl_map **map, unsigned *num_maps) |
@@ -761,7 +756,9 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
761 | return -ENOMEM; | 756 | return -ENOMEM; |
762 | 757 | ||
763 | for (i = 0; i < num_pins; i++) { | 758 | for (i = 0; i < num_pins; i++) { |
764 | pin = prop_u32(pins, i); | 759 | err = of_property_read_u32_index(np, "brcm,pins", i, &pin); |
760 | if (err) | ||
761 | goto out; | ||
765 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { | 762 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { |
766 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", | 763 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", |
767 | of_node_full_name(np), pin); | 764 | of_node_full_name(np), pin); |
@@ -770,14 +767,20 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
770 | } | 767 | } |
771 | 768 | ||
772 | if (num_funcs) { | 769 | if (num_funcs) { |
773 | func = prop_u32(funcs, (num_funcs > 1) ? i : 0); | 770 | err = of_property_read_u32_index(np, "brcm,function", |
771 | (num_funcs > 1) ? i : 0, &func); | ||
772 | if (err) | ||
773 | goto out; | ||
774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, | 774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, |
775 | func, &cur_map); | 775 | func, &cur_map); |
776 | if (err) | 776 | if (err) |
777 | goto out; | 777 | goto out; |
778 | } | 778 | } |
779 | if (num_pulls) { | 779 | if (num_pulls) { |
780 | pull = prop_u32(pulls, (num_pulls > 1) ? i : 0); | 780 | err = of_property_read_u32_index(np, "brcm,pull", |
781 | (num_funcs > 1) ? i : 0, &pull); | ||
782 | if (err) | ||
783 | goto out; | ||
781 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, | 784 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, |
782 | pull, &cur_map); | 785 | pull, &cur_map); |
783 | if (err) | 786 | if (err) |
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index ec1567842a7e..ac742817ebce 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c | |||
@@ -700,3 +700,111 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
700 | .label = "exynos4x12-gpio-ctrl3", | 700 | .label = "exynos4x12-gpio-ctrl3", |
701 | }, | 701 | }, |
702 | }; | 702 | }; |
703 | |||
704 | /* pin banks of exynos5250 pin-controller 0 */ | ||
705 | static struct samsung_pin_bank exynos5250_pin_banks0[] = { | ||
706 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), | ||
707 | EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), | ||
708 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08), | ||
709 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c), | ||
710 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10), | ||
711 | EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14), | ||
712 | EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18), | ||
713 | EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c), | ||
714 | EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc1", 0x20), | ||
715 | EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc2", 0x24), | ||
716 | EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc3", 0x28), | ||
717 | EXYNOS_PIN_BANK_EINTG(4, 0x160, "gpd0", 0x2c), | ||
718 | EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x30), | ||
719 | EXYNOS_PIN_BANK_EINTG(7, 0x2E0, "gpc4", 0x34), | ||
720 | EXYNOS_PIN_BANK_EINTN(6, 0x1A0, "gpy0"), | ||
721 | EXYNOS_PIN_BANK_EINTN(4, 0x1C0, "gpy1"), | ||
722 | EXYNOS_PIN_BANK_EINTN(6, 0x1E0, "gpy2"), | ||
723 | EXYNOS_PIN_BANK_EINTN(8, 0x200, "gpy3"), | ||
724 | EXYNOS_PIN_BANK_EINTN(8, 0x220, "gpy4"), | ||
725 | EXYNOS_PIN_BANK_EINTN(8, 0x240, "gpy5"), | ||
726 | EXYNOS_PIN_BANK_EINTN(8, 0x260, "gpy6"), | ||
727 | EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00), | ||
728 | EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04), | ||
729 | EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08), | ||
730 | EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c), | ||
731 | }; | ||
732 | |||
733 | /* pin banks of exynos5250 pin-controller 1 */ | ||
734 | static struct samsung_pin_bank exynos5250_pin_banks1[] = { | ||
735 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00), | ||
736 | EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04), | ||
737 | EXYNOS_PIN_BANK_EINTG(4, 0x040, "gpf0", 0x08), | ||
738 | EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpf1", 0x0c), | ||
739 | EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10), | ||
740 | EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14), | ||
741 | EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18), | ||
742 | EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gph0", 0x1c), | ||
743 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph1", 0x20), | ||
744 | }; | ||
745 | |||
746 | /* pin banks of exynos5250 pin-controller 2 */ | ||
747 | static struct samsung_pin_bank exynos5250_pin_banks2[] = { | ||
748 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00), | ||
749 | EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04), | ||
750 | EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08), | ||
751 | EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c), | ||
752 | EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10), | ||
753 | }; | ||
754 | |||
755 | /* pin banks of exynos5250 pin-controller 3 */ | ||
756 | static struct samsung_pin_bank exynos5250_pin_banks3[] = { | ||
757 | EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00), | ||
758 | }; | ||
759 | |||
760 | /* | ||
761 | * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes | ||
762 | * four gpio/pin-mux/pinconfig controllers. | ||
763 | */ | ||
764 | struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | ||
765 | { | ||
766 | /* pin-controller instance 0 data */ | ||
767 | .pin_banks = exynos5250_pin_banks0, | ||
768 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks0), | ||
769 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
770 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
771 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
772 | .weint_con = EXYNOS_WKUP_ECON_OFFSET, | ||
773 | .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, | ||
774 | .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, | ||
775 | .svc = EXYNOS_SVC_OFFSET, | ||
776 | .eint_gpio_init = exynos_eint_gpio_init, | ||
777 | .eint_wkup_init = exynos_eint_wkup_init, | ||
778 | .label = "exynos5250-gpio-ctrl0", | ||
779 | }, { | ||
780 | /* pin-controller instance 1 data */ | ||
781 | .pin_banks = exynos5250_pin_banks1, | ||
782 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks1), | ||
783 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
784 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
785 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
786 | .svc = EXYNOS_SVC_OFFSET, | ||
787 | .eint_gpio_init = exynos_eint_gpio_init, | ||
788 | .label = "exynos5250-gpio-ctrl1", | ||
789 | }, { | ||
790 | /* pin-controller instance 2 data */ | ||
791 | .pin_banks = exynos5250_pin_banks2, | ||
792 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks2), | ||
793 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
794 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
795 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
796 | .svc = EXYNOS_SVC_OFFSET, | ||
797 | .eint_gpio_init = exynos_eint_gpio_init, | ||
798 | .label = "exynos5250-gpio-ctrl2", | ||
799 | }, { | ||
800 | /* pin-controller instance 3 data */ | ||
801 | .pin_banks = exynos5250_pin_banks3, | ||
802 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks3), | ||
803 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
804 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
805 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
806 | .svc = EXYNOS_SVC_OFFSET, | ||
807 | .eint_gpio_init = exynos_eint_gpio_init, | ||
808 | .label = "exynos5250-gpio-ctrl3", | ||
809 | }, | ||
810 | }; | ||
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 4f54faf2971f..976366899f68 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -970,6 +970,8 @@ static const struct of_device_id samsung_pinctrl_dt_match[] = { | |||
970 | .data = (void *)exynos4210_pin_ctrl }, | 970 | .data = (void *)exynos4210_pin_ctrl }, |
971 | { .compatible = "samsung,exynos4x12-pinctrl", | 971 | { .compatible = "samsung,exynos4x12-pinctrl", |
972 | .data = (void *)exynos4x12_pin_ctrl }, | 972 | .data = (void *)exynos4x12_pin_ctrl }, |
973 | { .compatible = "samsung,exynos5250-pinctrl", | ||
974 | .data = (void *)exynos5250_pin_ctrl }, | ||
973 | #endif | 975 | #endif |
974 | #ifdef CONFIG_PINCTRL_S3C64XX | 976 | #ifdef CONFIG_PINCTRL_S3C64XX |
975 | { .compatible = "samsung,s3c64xx-pinctrl", | 977 | { .compatible = "samsung,s3c64xx-pinctrl", |
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index 45f27b41e30c..7c7f9ebcd05b 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h | |||
@@ -244,6 +244,7 @@ struct samsung_pmx_func { | |||
244 | /* list of all exported SoC specific data */ | 244 | /* list of all exported SoC specific data */ |
245 | extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; | 245 | extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; |
246 | extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; | 246 | extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; |
247 | extern struct samsung_pin_ctrl exynos5250_pin_ctrl[]; | ||
247 | extern struct samsung_pin_ctrl s3c64xx_pin_ctrl[]; | 248 | extern struct samsung_pin_ctrl s3c64xx_pin_ctrl[]; |
248 | 249 | ||
249 | #endif /* __PINCTRL_SAMSUNG_H */ | 250 | #endif /* __PINCTRL_SAMSUNG_H */ |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index 709008e94124..6f15c03077a0 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c | |||
@@ -2733,9 +2733,9 @@ static struct pinmux_data_reg pinmux_data_regs[] = { | |||
2733 | { }, | 2733 | { }, |
2734 | }; | 2734 | }; |
2735 | 2735 | ||
2736 | /* IRQ pins through INTCS with IRQ0->15 from 0x200 and IRQ16-31 from 0x3200 */ | 2736 | /* External IRQ pins mapped at IRQPIN_BASE */ |
2737 | #define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5)) | 2737 | #define EXT_IRQ16L(n) irq_pin(n) |
2738 | #define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5)) | 2738 | #define EXT_IRQ16H(n) irq_pin(n) |
2739 | 2739 | ||
2740 | static struct pinmux_irq pinmux_irqs[] = { | 2740 | static struct pinmux_irq pinmux_irqs[] = { |
2741 | PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), | 2741 | PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), |
diff --git a/drivers/pinctrl/vt8500/Kconfig b/drivers/pinctrl/vt8500/Kconfig new file mode 100644 index 000000000000..55724a73d94a --- /dev/null +++ b/drivers/pinctrl/vt8500/Kconfig | |||
@@ -0,0 +1,52 @@ | |||
1 | # | ||
2 | # VIA/Wondermedia PINCTRL drivers | ||
3 | # | ||
4 | |||
5 | if ARCH_VT8500 | ||
6 | |||
7 | config PINCTRL_WMT | ||
8 | bool | ||
9 | select PINMUX | ||
10 | select GENERIC_PINCONF | ||
11 | |||
12 | config PINCTRL_VT8500 | ||
13 | bool "VIA VT8500 pin controller driver" | ||
14 | depends on ARCH_WM8505 | ||
15 | select PINCTRL_WMT | ||
16 | help | ||
17 | Say yes here to support the gpio/pin control module on | ||
18 | VIA VT8500 SoCs. | ||
19 | |||
20 | config PINCTRL_WM8505 | ||
21 | bool "Wondermedia WM8505 pin controller driver" | ||
22 | depends on ARCH_WM8505 | ||
23 | select PINCTRL_WMT | ||
24 | help | ||
25 | Say yes here to support the gpio/pin control module on | ||
26 | Wondermedia WM8505 SoCs. | ||
27 | |||
28 | config PINCTRL_WM8650 | ||
29 | bool "Wondermedia WM8650 pin controller driver" | ||
30 | depends on ARCH_WM8505 | ||
31 | select PINCTRL_WMT | ||
32 | help | ||
33 | Say yes here to support the gpio/pin control module on | ||
34 | Wondermedia WM8650 SoCs. | ||
35 | |||
36 | config PINCTRL_WM8750 | ||
37 | bool "Wondermedia WM8750 pin controller driver" | ||
38 | depends on ARCH_WM8750 | ||
39 | select PINCTRL_WMT | ||
40 | help | ||
41 | Say yes here to support the gpio/pin control module on | ||
42 | Wondermedia WM8750 SoCs. | ||
43 | |||
44 | config PINCTRL_WM8850 | ||
45 | bool "Wondermedia WM8850 pin controller driver" | ||
46 | depends on ARCH_WM8850 | ||
47 | select PINCTRL_WMT | ||
48 | help | ||
49 | Say yes here to support the gpio/pin control module on | ||
50 | Wondermedia WM8850 SoCs. | ||
51 | |||
52 | endif | ||
diff --git a/drivers/pinctrl/vt8500/Makefile b/drivers/pinctrl/vt8500/Makefile new file mode 100644 index 000000000000..24ec45dd0d80 --- /dev/null +++ b/drivers/pinctrl/vt8500/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # VIA/Wondermedia pinctrl support | ||
2 | |||
3 | obj-$(CONFIG_PINCTRL_WMT) += pinctrl-wmt.o | ||
4 | obj-$(CONFIG_PINCTRL_VT8500) += pinctrl-vt8500.o | ||
5 | obj-$(CONFIG_PINCTRL_WM8505) += pinctrl-wm8505.o | ||
6 | obj-$(CONFIG_PINCTRL_WM8650) += pinctrl-wm8650.o | ||
7 | obj-$(CONFIG_PINCTRL_WM8750) += pinctrl-wm8750.o | ||
8 | obj-$(CONFIG_PINCTRL_WM8850) += pinctrl-wm8850.o | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-vt8500.c b/drivers/pinctrl/vt8500/pinctrl-vt8500.c new file mode 100644 index 000000000000..f2fe9f85cfa6 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-vt8500.c | |||
@@ -0,0 +1,501 @@ | |||
1 | /* | ||
2 | * Pinctrl data for VIA VT8500 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers vt8500_banks[] = { | ||
33 | WMT_PINCTRL_BANK(NO_REG, 0x3C, 0x5C, 0x7C, NO_REG, NO_REG), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x00, 0x20, 0x40, 0x60, NO_REG, NO_REG), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x04, 0x24, 0x44, 0x64, NO_REG, NO_REG), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x08, 0x28, 0x48, 0x68, NO_REG, NO_REG), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x0C, 0x2C, 0x4C, 0x6C, NO_REG, NO_REG), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x10, 0x30, 0x50, 0x70, NO_REG, NO_REG), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x14, 0x34, 0x54, 0x74, NO_REG, NO_REG), /* 6 */ | ||
40 | }; | ||
41 | |||
42 | /* Please keep sorted by bank/bit */ | ||
43 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
44 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
45 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
46 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
47 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
48 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
49 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
50 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
51 | #define WMT_PIN_EXTGPIO8 WMT_PIN(0, 8) | ||
52 | #define WMT_PIN_UART0RTS WMT_PIN(1, 0) | ||
53 | #define WMT_PIN_UART0TXD WMT_PIN(1, 1) | ||
54 | #define WMT_PIN_UART0CTS WMT_PIN(1, 2) | ||
55 | #define WMT_PIN_UART0RXD WMT_PIN(1, 3) | ||
56 | #define WMT_PIN_UART1RTS WMT_PIN(1, 4) | ||
57 | #define WMT_PIN_UART1TXD WMT_PIN(1, 5) | ||
58 | #define WMT_PIN_UART1CTS WMT_PIN(1, 6) | ||
59 | #define WMT_PIN_UART1RXD WMT_PIN(1, 7) | ||
60 | #define WMT_PIN_SPI0CLK WMT_PIN(1, 8) | ||
61 | #define WMT_PIN_SPI0SS WMT_PIN(1, 9) | ||
62 | #define WMT_PIN_SPI0MISO WMT_PIN(1, 10) | ||
63 | #define WMT_PIN_SPI0MOSI WMT_PIN(1, 11) | ||
64 | #define WMT_PIN_SPI1CLK WMT_PIN(1, 12) | ||
65 | #define WMT_PIN_SPI1SS WMT_PIN(1, 13) | ||
66 | #define WMT_PIN_SPI1MISO WMT_PIN(1, 14) | ||
67 | #define WMT_PIN_SPI1MOSI WMT_PIN(1, 15) | ||
68 | #define WMT_PIN_SPI2CLK WMT_PIN(1, 16) | ||
69 | #define WMT_PIN_SPI2SS WMT_PIN(1, 17) | ||
70 | #define WMT_PIN_SPI2MISO WMT_PIN(1, 18) | ||
71 | #define WMT_PIN_SPI2MOSI WMT_PIN(1, 19) | ||
72 | #define WMT_PIN_SDDATA0 WMT_PIN(2, 0) | ||
73 | #define WMT_PIN_SDDATA1 WMT_PIN(2, 1) | ||
74 | #define WMT_PIN_SDDATA2 WMT_PIN(2, 2) | ||
75 | #define WMT_PIN_SDDATA3 WMT_PIN(2, 3) | ||
76 | #define WMT_PIN_MMCDATA0 WMT_PIN(2, 4) | ||
77 | #define WMT_PIN_MMCDATA1 WMT_PIN(2, 5) | ||
78 | #define WMT_PIN_MMCDATA2 WMT_PIN(2, 6) | ||
79 | #define WMT_PIN_MMCDATA3 WMT_PIN(2, 7) | ||
80 | #define WMT_PIN_SDCLK WMT_PIN(2, 8) | ||
81 | #define WMT_PIN_SDWP WMT_PIN(2, 9) | ||
82 | #define WMT_PIN_SDCMD WMT_PIN(2, 10) | ||
83 | #define WMT_PIN_MSDATA0 WMT_PIN(2, 16) | ||
84 | #define WMT_PIN_MSDATA1 WMT_PIN(2, 17) | ||
85 | #define WMT_PIN_MSDATA2 WMT_PIN(2, 18) | ||
86 | #define WMT_PIN_MSDATA3 WMT_PIN(2, 19) | ||
87 | #define WMT_PIN_MSCLK WMT_PIN(2, 20) | ||
88 | #define WMT_PIN_MSBS WMT_PIN(2, 21) | ||
89 | #define WMT_PIN_MSINS WMT_PIN(2, 22) | ||
90 | #define WMT_PIN_I2C0SCL WMT_PIN(2, 24) | ||
91 | #define WMT_PIN_I2C0SDA WMT_PIN(2, 25) | ||
92 | #define WMT_PIN_I2C1SCL WMT_PIN(2, 26) | ||
93 | #define WMT_PIN_I2C1SDA WMT_PIN(2, 27) | ||
94 | #define WMT_PIN_MII0RXD0 WMT_PIN(3, 0) | ||
95 | #define WMT_PIN_MII0RXD1 WMT_PIN(3, 1) | ||
96 | #define WMT_PIN_MII0RXD2 WMT_PIN(3, 2) | ||
97 | #define WMT_PIN_MII0RXD3 WMT_PIN(3, 3) | ||
98 | #define WMT_PIN_MII0RXCLK WMT_PIN(3, 4) | ||
99 | #define WMT_PIN_MII0RXDV WMT_PIN(3, 5) | ||
100 | #define WMT_PIN_MII0RXERR WMT_PIN(3, 6) | ||
101 | #define WMT_PIN_MII0PHYRST WMT_PIN(3, 7) | ||
102 | #define WMT_PIN_MII0TXD0 WMT_PIN(3, 8) | ||
103 | #define WMT_PIN_MII0TXD1 WMT_PIN(3, 9) | ||
104 | #define WMT_PIN_MII0TXD2 WMT_PIN(3, 10) | ||
105 | #define WMT_PIN_MII0TXD3 WMT_PIN(3, 11) | ||
106 | #define WMT_PIN_MII0TXCLK WMT_PIN(3, 12) | ||
107 | #define WMT_PIN_MII0TXEN WMT_PIN(3, 13) | ||
108 | #define WMT_PIN_MII0TXERR WMT_PIN(3, 14) | ||
109 | #define WMT_PIN_MII0PHYPD WMT_PIN(3, 15) | ||
110 | #define WMT_PIN_MII0COL WMT_PIN(3, 16) | ||
111 | #define WMT_PIN_MII0CRS WMT_PIN(3, 17) | ||
112 | #define WMT_PIN_MII0MDIO WMT_PIN(3, 18) | ||
113 | #define WMT_PIN_MII0MDC WMT_PIN(3, 19) | ||
114 | #define WMT_PIN_SEECS WMT_PIN(3, 20) | ||
115 | #define WMT_PIN_SEECK WMT_PIN(3, 21) | ||
116 | #define WMT_PIN_SEEDI WMT_PIN(3, 22) | ||
117 | #define WMT_PIN_SEEDO WMT_PIN(3, 23) | ||
118 | #define WMT_PIN_IDEDREQ0 WMT_PIN(3, 24) | ||
119 | #define WMT_PIN_IDEDREQ1 WMT_PIN(3, 25) | ||
120 | #define WMT_PIN_IDEIOW WMT_PIN(3, 26) | ||
121 | #define WMT_PIN_IDEIOR WMT_PIN(3, 27) | ||
122 | #define WMT_PIN_IDEDACK WMT_PIN(3, 28) | ||
123 | #define WMT_PIN_IDEIORDY WMT_PIN(3, 29) | ||
124 | #define WMT_PIN_IDEINTRQ WMT_PIN(3, 30) | ||
125 | #define WMT_PIN_VDIN0 WMT_PIN(4, 0) | ||
126 | #define WMT_PIN_VDIN1 WMT_PIN(4, 1) | ||
127 | #define WMT_PIN_VDIN2 WMT_PIN(4, 2) | ||
128 | #define WMT_PIN_VDIN3 WMT_PIN(4, 3) | ||
129 | #define WMT_PIN_VDIN4 WMT_PIN(4, 4) | ||
130 | #define WMT_PIN_VDIN5 WMT_PIN(4, 5) | ||
131 | #define WMT_PIN_VDIN6 WMT_PIN(4, 6) | ||
132 | #define WMT_PIN_VDIN7 WMT_PIN(4, 7) | ||
133 | #define WMT_PIN_VDOUT0 WMT_PIN(4, 8) | ||
134 | #define WMT_PIN_VDOUT1 WMT_PIN(4, 9) | ||
135 | #define WMT_PIN_VDOUT2 WMT_PIN(4, 10) | ||
136 | #define WMT_PIN_VDOUT3 WMT_PIN(4, 11) | ||
137 | #define WMT_PIN_VDOUT4 WMT_PIN(4, 12) | ||
138 | #define WMT_PIN_VDOUT5 WMT_PIN(4, 13) | ||
139 | #define WMT_PIN_NANDCLE0 WMT_PIN(4, 14) | ||
140 | #define WMT_PIN_NANDCLE1 WMT_PIN(4, 15) | ||
141 | #define WMT_PIN_VDOUT6_7 WMT_PIN(4, 16) | ||
142 | #define WMT_PIN_VHSYNC WMT_PIN(4, 17) | ||
143 | #define WMT_PIN_VVSYNC WMT_PIN(4, 18) | ||
144 | #define WMT_PIN_TSDIN0 WMT_PIN(5, 8) | ||
145 | #define WMT_PIN_TSDIN1 WMT_PIN(5, 9) | ||
146 | #define WMT_PIN_TSDIN2 WMT_PIN(5, 10) | ||
147 | #define WMT_PIN_TSDIN3 WMT_PIN(5, 11) | ||
148 | #define WMT_PIN_TSDIN4 WMT_PIN(5, 12) | ||
149 | #define WMT_PIN_TSDIN5 WMT_PIN(5, 13) | ||
150 | #define WMT_PIN_TSDIN6 WMT_PIN(5, 14) | ||
151 | #define WMT_PIN_TSDIN7 WMT_PIN(5, 15) | ||
152 | #define WMT_PIN_TSSYNC WMT_PIN(5, 16) | ||
153 | #define WMT_PIN_TSVALID WMT_PIN(5, 17) | ||
154 | #define WMT_PIN_TSCLK WMT_PIN(5, 18) | ||
155 | #define WMT_PIN_LCDD0 WMT_PIN(6, 0) | ||
156 | #define WMT_PIN_LCDD1 WMT_PIN(6, 1) | ||
157 | #define WMT_PIN_LCDD2 WMT_PIN(6, 2) | ||
158 | #define WMT_PIN_LCDD3 WMT_PIN(6, 3) | ||
159 | #define WMT_PIN_LCDD4 WMT_PIN(6, 4) | ||
160 | #define WMT_PIN_LCDD5 WMT_PIN(6, 5) | ||
161 | #define WMT_PIN_LCDD6 WMT_PIN(6, 6) | ||
162 | #define WMT_PIN_LCDD7 WMT_PIN(6, 7) | ||
163 | #define WMT_PIN_LCDD8 WMT_PIN(6, 8) | ||
164 | #define WMT_PIN_LCDD9 WMT_PIN(6, 9) | ||
165 | #define WMT_PIN_LCDD10 WMT_PIN(6, 10) | ||
166 | #define WMT_PIN_LCDD11 WMT_PIN(6, 11) | ||
167 | #define WMT_PIN_LCDD12 WMT_PIN(6, 12) | ||
168 | #define WMT_PIN_LCDD13 WMT_PIN(6, 13) | ||
169 | #define WMT_PIN_LCDD14 WMT_PIN(6, 14) | ||
170 | #define WMT_PIN_LCDD15 WMT_PIN(6, 15) | ||
171 | #define WMT_PIN_LCDD16 WMT_PIN(6, 16) | ||
172 | #define WMT_PIN_LCDD17 WMT_PIN(6, 17) | ||
173 | #define WMT_PIN_LCDCLK WMT_PIN(6, 18) | ||
174 | #define WMT_PIN_LCDDEN WMT_PIN(6, 19) | ||
175 | #define WMT_PIN_LCDLINE WMT_PIN(6, 20) | ||
176 | #define WMT_PIN_LCDFRM WMT_PIN(6, 21) | ||
177 | #define WMT_PIN_LCDBIAS WMT_PIN(6, 22) | ||
178 | |||
179 | static const struct pinctrl_pin_desc vt8500_pins[] = { | ||
180 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
181 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
182 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
183 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
184 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
185 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
186 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
187 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
188 | PINCTRL_PIN(WMT_PIN_EXTGPIO8, "extgpio8"), | ||
189 | PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), | ||
190 | PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), | ||
191 | PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), | ||
192 | PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), | ||
193 | PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), | ||
194 | PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), | ||
195 | PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), | ||
196 | PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), | ||
197 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
198 | PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), | ||
199 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
200 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
201 | PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), | ||
202 | PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), | ||
203 | PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), | ||
204 | PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), | ||
205 | PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), | ||
206 | PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), | ||
207 | PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), | ||
208 | PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), | ||
209 | PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), | ||
210 | PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), | ||
211 | PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), | ||
212 | PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), | ||
213 | PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), | ||
214 | PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), | ||
215 | PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), | ||
216 | PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), | ||
217 | PINCTRL_PIN(WMT_PIN_SDCLK, "sd_clk"), | ||
218 | PINCTRL_PIN(WMT_PIN_SDWP, "sd_wp"), | ||
219 | PINCTRL_PIN(WMT_PIN_SDCMD, "sd_cmd"), | ||
220 | PINCTRL_PIN(WMT_PIN_MSDATA0, "ms_data0"), | ||
221 | PINCTRL_PIN(WMT_PIN_MSDATA1, "ms_data1"), | ||
222 | PINCTRL_PIN(WMT_PIN_MSDATA2, "ms_data2"), | ||
223 | PINCTRL_PIN(WMT_PIN_MSDATA3, "ms_data3"), | ||
224 | PINCTRL_PIN(WMT_PIN_MSCLK, "ms_clk"), | ||
225 | PINCTRL_PIN(WMT_PIN_MSBS, "ms_bs"), | ||
226 | PINCTRL_PIN(WMT_PIN_MSINS, "ms_ins"), | ||
227 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
228 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
229 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
230 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
231 | PINCTRL_PIN(WMT_PIN_MII0RXD0, "mii0_rxd0"), | ||
232 | PINCTRL_PIN(WMT_PIN_MII0RXD1, "mii0_rxd1"), | ||
233 | PINCTRL_PIN(WMT_PIN_MII0RXD2, "mii0_rxd2"), | ||
234 | PINCTRL_PIN(WMT_PIN_MII0RXD3, "mii0_rxd3"), | ||
235 | PINCTRL_PIN(WMT_PIN_MII0RXCLK, "mii0_rxclk"), | ||
236 | PINCTRL_PIN(WMT_PIN_MII0RXDV, "mii0_rxdv"), | ||
237 | PINCTRL_PIN(WMT_PIN_MII0RXERR, "mii0_rxerr"), | ||
238 | PINCTRL_PIN(WMT_PIN_MII0PHYRST, "mii0_phyrst"), | ||
239 | PINCTRL_PIN(WMT_PIN_MII0TXD0, "mii0_txd0"), | ||
240 | PINCTRL_PIN(WMT_PIN_MII0TXD1, "mii0_txd1"), | ||
241 | PINCTRL_PIN(WMT_PIN_MII0TXD2, "mii0_txd2"), | ||
242 | PINCTRL_PIN(WMT_PIN_MII0TXD3, "mii0_txd3"), | ||
243 | PINCTRL_PIN(WMT_PIN_MII0TXCLK, "mii0_txclk"), | ||
244 | PINCTRL_PIN(WMT_PIN_MII0TXEN, "mii0_txen"), | ||
245 | PINCTRL_PIN(WMT_PIN_MII0TXERR, "mii0_txerr"), | ||
246 | PINCTRL_PIN(WMT_PIN_MII0PHYPD, "mii0_phypd"), | ||
247 | PINCTRL_PIN(WMT_PIN_MII0COL, "mii0_col"), | ||
248 | PINCTRL_PIN(WMT_PIN_MII0CRS, "mii0_crs"), | ||
249 | PINCTRL_PIN(WMT_PIN_MII0MDIO, "mii0_mdio"), | ||
250 | PINCTRL_PIN(WMT_PIN_MII0MDC, "mii0_mdc"), | ||
251 | PINCTRL_PIN(WMT_PIN_SEECS, "see_cs"), | ||
252 | PINCTRL_PIN(WMT_PIN_SEECK, "see_ck"), | ||
253 | PINCTRL_PIN(WMT_PIN_SEEDI, "see_di"), | ||
254 | PINCTRL_PIN(WMT_PIN_SEEDO, "see_do"), | ||
255 | PINCTRL_PIN(WMT_PIN_IDEDREQ0, "ide_dreq0"), | ||
256 | PINCTRL_PIN(WMT_PIN_IDEDREQ1, "ide_dreq1"), | ||
257 | PINCTRL_PIN(WMT_PIN_IDEIOW, "ide_iow"), | ||
258 | PINCTRL_PIN(WMT_PIN_IDEIOR, "ide_ior"), | ||
259 | PINCTRL_PIN(WMT_PIN_IDEDACK, "ide_dack"), | ||
260 | PINCTRL_PIN(WMT_PIN_IDEIORDY, "ide_iordy"), | ||
261 | PINCTRL_PIN(WMT_PIN_IDEINTRQ, "ide_intrq"), | ||
262 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
263 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
264 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
265 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
266 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
267 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
268 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
269 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
270 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
271 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
272 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
273 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
274 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
275 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
276 | PINCTRL_PIN(WMT_PIN_NANDCLE0, "nand_cle0"), | ||
277 | PINCTRL_PIN(WMT_PIN_NANDCLE1, "nand_cle1"), | ||
278 | PINCTRL_PIN(WMT_PIN_VDOUT6_7, "vdout6_7"), | ||
279 | PINCTRL_PIN(WMT_PIN_VHSYNC, "vhsync"), | ||
280 | PINCTRL_PIN(WMT_PIN_VVSYNC, "vvsync"), | ||
281 | PINCTRL_PIN(WMT_PIN_TSDIN0, "tsdin0"), | ||
282 | PINCTRL_PIN(WMT_PIN_TSDIN1, "tsdin1"), | ||
283 | PINCTRL_PIN(WMT_PIN_TSDIN2, "tsdin2"), | ||
284 | PINCTRL_PIN(WMT_PIN_TSDIN3, "tsdin3"), | ||
285 | PINCTRL_PIN(WMT_PIN_TSDIN4, "tsdin4"), | ||
286 | PINCTRL_PIN(WMT_PIN_TSDIN5, "tsdin5"), | ||
287 | PINCTRL_PIN(WMT_PIN_TSDIN6, "tsdin6"), | ||
288 | PINCTRL_PIN(WMT_PIN_TSDIN7, "tsdin7"), | ||
289 | PINCTRL_PIN(WMT_PIN_TSSYNC, "tssync"), | ||
290 | PINCTRL_PIN(WMT_PIN_TSVALID, "tsvalid"), | ||
291 | PINCTRL_PIN(WMT_PIN_TSCLK, "tsclk"), | ||
292 | PINCTRL_PIN(WMT_PIN_LCDD0, "lcd_d0"), | ||
293 | PINCTRL_PIN(WMT_PIN_LCDD1, "lcd_d1"), | ||
294 | PINCTRL_PIN(WMT_PIN_LCDD2, "lcd_d2"), | ||
295 | PINCTRL_PIN(WMT_PIN_LCDD3, "lcd_d3"), | ||
296 | PINCTRL_PIN(WMT_PIN_LCDD4, "lcd_d4"), | ||
297 | PINCTRL_PIN(WMT_PIN_LCDD5, "lcd_d5"), | ||
298 | PINCTRL_PIN(WMT_PIN_LCDD6, "lcd_d6"), | ||
299 | PINCTRL_PIN(WMT_PIN_LCDD7, "lcd_d7"), | ||
300 | PINCTRL_PIN(WMT_PIN_LCDD8, "lcd_d8"), | ||
301 | PINCTRL_PIN(WMT_PIN_LCDD9, "lcd_d9"), | ||
302 | PINCTRL_PIN(WMT_PIN_LCDD10, "lcd_d10"), | ||
303 | PINCTRL_PIN(WMT_PIN_LCDD11, "lcd_d11"), | ||
304 | PINCTRL_PIN(WMT_PIN_LCDD12, "lcd_d12"), | ||
305 | PINCTRL_PIN(WMT_PIN_LCDD13, "lcd_d13"), | ||
306 | PINCTRL_PIN(WMT_PIN_LCDD14, "lcd_d14"), | ||
307 | PINCTRL_PIN(WMT_PIN_LCDD15, "lcd_d15"), | ||
308 | PINCTRL_PIN(WMT_PIN_LCDD16, "lcd_d16"), | ||
309 | PINCTRL_PIN(WMT_PIN_LCDD17, "lcd_d17"), | ||
310 | PINCTRL_PIN(WMT_PIN_LCDCLK, "lcd_clk"), | ||
311 | PINCTRL_PIN(WMT_PIN_LCDDEN, "lcd_den"), | ||
312 | PINCTRL_PIN(WMT_PIN_LCDLINE, "lcd_line"), | ||
313 | PINCTRL_PIN(WMT_PIN_LCDFRM, "lcd_frm"), | ||
314 | PINCTRL_PIN(WMT_PIN_LCDBIAS, "lcd_bias"), | ||
315 | }; | ||
316 | |||
317 | /* Order of these names must match the above list */ | ||
318 | static const char * const vt8500_groups[] = { | ||
319 | "extgpio0", | ||
320 | "extgpio1", | ||
321 | "extgpio2", | ||
322 | "extgpio3", | ||
323 | "extgpio4", | ||
324 | "extgpio5", | ||
325 | "extgpio6", | ||
326 | "extgpio7", | ||
327 | "extgpio8", | ||
328 | "uart0_rts", | ||
329 | "uart0_txd", | ||
330 | "uart0_cts", | ||
331 | "uart0_rxd", | ||
332 | "uart1_rts", | ||
333 | "uart1_txd", | ||
334 | "uart1_cts", | ||
335 | "uart1_rxd", | ||
336 | "spi0_clk", | ||
337 | "spi0_ss", | ||
338 | "spi0_miso", | ||
339 | "spi0_mosi", | ||
340 | "spi1_clk", | ||
341 | "spi1_ss", | ||
342 | "spi1_miso", | ||
343 | "spi1_mosi", | ||
344 | "spi2_clk", | ||
345 | "spi2_ss", | ||
346 | "spi2_miso", | ||
347 | "spi2_mosi", | ||
348 | "sd_data0", | ||
349 | "sd_data1", | ||
350 | "sd_data2", | ||
351 | "sd_data3", | ||
352 | "mmc_data0", | ||
353 | "mmc_data1", | ||
354 | "mmc_data2", | ||
355 | "mmc_data3", | ||
356 | "sd_clk", | ||
357 | "sd_wp", | ||
358 | "sd_cmd", | ||
359 | "ms_data0", | ||
360 | "ms_data1", | ||
361 | "ms_data2", | ||
362 | "ms_data3", | ||
363 | "ms_clk", | ||
364 | "ms_bs", | ||
365 | "ms_ins", | ||
366 | "i2c0_scl", | ||
367 | "i2c0_sda", | ||
368 | "i2c1_scl", | ||
369 | "i2c1_sda", | ||
370 | "mii0_rxd0", | ||
371 | "mii0_rxd1", | ||
372 | "mii0_rxd2", | ||
373 | "mii0_rxd3", | ||
374 | "mii0_rxclk", | ||
375 | "mii0_rxdv", | ||
376 | "mii0_rxerr", | ||
377 | "mii0_phyrst", | ||
378 | "mii0_txd0", | ||
379 | "mii0_txd1", | ||
380 | "mii0_txd2", | ||
381 | "mii0_txd3", | ||
382 | "mii0_txclk", | ||
383 | "mii0_txen", | ||
384 | "mii0_txerr", | ||
385 | "mii0_phypd", | ||
386 | "mii0_col", | ||
387 | "mii0_crs", | ||
388 | "mii0_mdio", | ||
389 | "mii0_mdc", | ||
390 | "see_cs", | ||
391 | "see_ck", | ||
392 | "see_di", | ||
393 | "see_do", | ||
394 | "ide_dreq0", | ||
395 | "ide_dreq1", | ||
396 | "ide_iow", | ||
397 | "ide_ior", | ||
398 | "ide_dack", | ||
399 | "ide_iordy", | ||
400 | "ide_intrq", | ||
401 | "vdin0", | ||
402 | "vdin1", | ||
403 | "vdin2", | ||
404 | "vdin3", | ||
405 | "vdin4", | ||
406 | "vdin5", | ||
407 | "vdin6", | ||
408 | "vdin7", | ||
409 | "vdout0", | ||
410 | "vdout1", | ||
411 | "vdout2", | ||
412 | "vdout3", | ||
413 | "vdout4", | ||
414 | "vdout5", | ||
415 | "nand_cle0", | ||
416 | "nand_cle1", | ||
417 | "vdout6_7", | ||
418 | "vhsync", | ||
419 | "vvsync", | ||
420 | "tsdin0", | ||
421 | "tsdin1", | ||
422 | "tsdin2", | ||
423 | "tsdin3", | ||
424 | "tsdin4", | ||
425 | "tsdin5", | ||
426 | "tsdin6", | ||
427 | "tsdin7", | ||
428 | "tssync", | ||
429 | "tsvalid", | ||
430 | "tsclk", | ||
431 | "lcd_d0", | ||
432 | "lcd_d1", | ||
433 | "lcd_d2", | ||
434 | "lcd_d3", | ||
435 | "lcd_d4", | ||
436 | "lcd_d5", | ||
437 | "lcd_d6", | ||
438 | "lcd_d7", | ||
439 | "lcd_d8", | ||
440 | "lcd_d9", | ||
441 | "lcd_d10", | ||
442 | "lcd_d11", | ||
443 | "lcd_d12", | ||
444 | "lcd_d13", | ||
445 | "lcd_d14", | ||
446 | "lcd_d15", | ||
447 | "lcd_d16", | ||
448 | "lcd_d17", | ||
449 | "lcd_clk", | ||
450 | "lcd_den", | ||
451 | "lcd_line", | ||
452 | "lcd_frm", | ||
453 | "lcd_bias", | ||
454 | }; | ||
455 | |||
456 | static int vt8500_pinctrl_probe(struct platform_device *pdev) | ||
457 | { | ||
458 | struct wmt_pinctrl_data *data; | ||
459 | |||
460 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
461 | if (!data) { | ||
462 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
463 | return -ENOMEM; | ||
464 | } | ||
465 | |||
466 | data->banks = vt8500_banks; | ||
467 | data->nbanks = ARRAY_SIZE(vt8500_banks); | ||
468 | data->pins = vt8500_pins; | ||
469 | data->npins = ARRAY_SIZE(vt8500_pins); | ||
470 | data->groups = vt8500_groups; | ||
471 | data->ngroups = ARRAY_SIZE(vt8500_groups); | ||
472 | |||
473 | return wmt_pinctrl_probe(pdev, data); | ||
474 | } | ||
475 | |||
476 | static int vt8500_pinctrl_remove(struct platform_device *pdev) | ||
477 | { | ||
478 | return wmt_pinctrl_remove(pdev); | ||
479 | } | ||
480 | |||
481 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
482 | { .compatible = "via,vt8500-pinctrl" }, | ||
483 | { /* sentinel */ }, | ||
484 | }; | ||
485 | |||
486 | static struct platform_driver wmt_pinctrl_driver = { | ||
487 | .probe = vt8500_pinctrl_probe, | ||
488 | .remove = vt8500_pinctrl_remove, | ||
489 | .driver = { | ||
490 | .name = "pinctrl-vt8500", | ||
491 | .owner = THIS_MODULE, | ||
492 | .of_match_table = wmt_pinctrl_of_match, | ||
493 | }, | ||
494 | }; | ||
495 | |||
496 | module_platform_driver(wmt_pinctrl_driver); | ||
497 | |||
498 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
499 | MODULE_DESCRIPTION("VIA VT8500 Pincontrol driver"); | ||
500 | MODULE_LICENSE("GPL v2"); | ||
501 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8505.c b/drivers/pinctrl/vt8500/pinctrl-wm8505.c new file mode 100644 index 000000000000..483ba732694e --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8505.c | |||
@@ -0,0 +1,532 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8505 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8505_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x64, 0x8C, 0xB4, 0xDC, NO_REG, NO_REG), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x40, 0x68, 0x90, 0xB8, NO_REG, NO_REG), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x44, 0x6C, 0x94, 0xBC, NO_REG, NO_REG), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x48, 0x70, 0x98, 0xC0, NO_REG, NO_REG), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x4C, 0x74, 0x9C, 0xC4, NO_REG, NO_REG), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x50, 0x78, 0xA0, 0xC8, NO_REG, NO_REG), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x54, 0x7C, 0xA4, 0xD0, NO_REG, NO_REG), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x58, 0x80, 0xA8, 0xD4, NO_REG, NO_REG), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x5C, 0x84, 0xAC, 0xD8, NO_REG, NO_REG), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x60, 0x88, 0xB0, 0xDC, NO_REG, NO_REG), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x500, 0x504, 0x508, 0x50C, NO_REG, NO_REG), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
57 | #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) | ||
58 | #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) | ||
59 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
60 | #define WMT_PIN_SDDATA0 WMT_PIN(1, 0) | ||
61 | #define WMT_PIN_SDDATA1 WMT_PIN(1, 1) | ||
62 | #define WMT_PIN_SDDATA2 WMT_PIN(1, 2) | ||
63 | #define WMT_PIN_SDDATA3 WMT_PIN(1, 3) | ||
64 | #define WMT_PIN_MMCDATA0 WMT_PIN(1, 4) | ||
65 | #define WMT_PIN_MMCDATA1 WMT_PIN(1, 5) | ||
66 | #define WMT_PIN_MMCDATA2 WMT_PIN(1, 6) | ||
67 | #define WMT_PIN_MMCDATA3 WMT_PIN(1, 7) | ||
68 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
69 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
70 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
71 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
72 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
73 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
74 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
75 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
76 | #define WMT_PIN_VDOUT0 WMT_PIN(2, 8) | ||
77 | #define WMT_PIN_VDOUT1 WMT_PIN(2, 9) | ||
78 | #define WMT_PIN_VDOUT2 WMT_PIN(2, 10) | ||
79 | #define WMT_PIN_VDOUT3 WMT_PIN(2, 11) | ||
80 | #define WMT_PIN_VDOUT4 WMT_PIN(2, 12) | ||
81 | #define WMT_PIN_VDOUT5 WMT_PIN(2, 13) | ||
82 | #define WMT_PIN_VDOUT6 WMT_PIN(2, 14) | ||
83 | #define WMT_PIN_VDOUT7 WMT_PIN(2, 15) | ||
84 | #define WMT_PIN_VDOUT8 WMT_PIN(2, 16) | ||
85 | #define WMT_PIN_VDOUT9 WMT_PIN(2, 17) | ||
86 | #define WMT_PIN_VDOUT10 WMT_PIN(2, 18) | ||
87 | #define WMT_PIN_VDOUT11 WMT_PIN(2, 19) | ||
88 | #define WMT_PIN_VDOUT12 WMT_PIN(2, 20) | ||
89 | #define WMT_PIN_VDOUT13 WMT_PIN(2, 21) | ||
90 | #define WMT_PIN_VDOUT14 WMT_PIN(2, 22) | ||
91 | #define WMT_PIN_VDOUT15 WMT_PIN(2, 23) | ||
92 | #define WMT_PIN_VDOUT16 WMT_PIN(2, 24) | ||
93 | #define WMT_PIN_VDOUT17 WMT_PIN(2, 25) | ||
94 | #define WMT_PIN_VDOUT18 WMT_PIN(2, 26) | ||
95 | #define WMT_PIN_VDOUT19 WMT_PIN(2, 27) | ||
96 | #define WMT_PIN_VDOUT20 WMT_PIN(2, 28) | ||
97 | #define WMT_PIN_VDOUT21 WMT_PIN(2, 29) | ||
98 | #define WMT_PIN_VDOUT22 WMT_PIN(2, 30) | ||
99 | #define WMT_PIN_VDOUT23 WMT_PIN(2, 31) | ||
100 | #define WMT_PIN_VHSYNC WMT_PIN(3, 0) | ||
101 | #define WMT_PIN_VVSYNC WMT_PIN(3, 1) | ||
102 | #define WMT_PIN_VGAHSYNC WMT_PIN(3, 2) | ||
103 | #define WMT_PIN_VGAVSYNC WMT_PIN(3, 3) | ||
104 | #define WMT_PIN_VDHSYNC WMT_PIN(3, 4) | ||
105 | #define WMT_PIN_VDVSYNC WMT_PIN(3, 5) | ||
106 | #define WMT_PIN_NORD0 WMT_PIN(4, 0) | ||
107 | #define WMT_PIN_NORD1 WMT_PIN(4, 1) | ||
108 | #define WMT_PIN_NORD2 WMT_PIN(4, 2) | ||
109 | #define WMT_PIN_NORD3 WMT_PIN(4, 3) | ||
110 | #define WMT_PIN_NORD4 WMT_PIN(4, 4) | ||
111 | #define WMT_PIN_NORD5 WMT_PIN(4, 5) | ||
112 | #define WMT_PIN_NORD6 WMT_PIN(4, 6) | ||
113 | #define WMT_PIN_NORD7 WMT_PIN(4, 7) | ||
114 | #define WMT_PIN_NORD8 WMT_PIN(4, 8) | ||
115 | #define WMT_PIN_NORD9 WMT_PIN(4, 9) | ||
116 | #define WMT_PIN_NORD10 WMT_PIN(4, 10) | ||
117 | #define WMT_PIN_NORD11 WMT_PIN(4, 11) | ||
118 | #define WMT_PIN_NORD12 WMT_PIN(4, 12) | ||
119 | #define WMT_PIN_NORD13 WMT_PIN(4, 13) | ||
120 | #define WMT_PIN_NORD14 WMT_PIN(4, 14) | ||
121 | #define WMT_PIN_NORD15 WMT_PIN(4, 15) | ||
122 | #define WMT_PIN_NORA0 WMT_PIN(5, 0) | ||
123 | #define WMT_PIN_NORA1 WMT_PIN(5, 1) | ||
124 | #define WMT_PIN_NORA2 WMT_PIN(5, 2) | ||
125 | #define WMT_PIN_NORA3 WMT_PIN(5, 3) | ||
126 | #define WMT_PIN_NORA4 WMT_PIN(5, 4) | ||
127 | #define WMT_PIN_NORA5 WMT_PIN(5, 5) | ||
128 | #define WMT_PIN_NORA6 WMT_PIN(5, 6) | ||
129 | #define WMT_PIN_NORA7 WMT_PIN(5, 7) | ||
130 | #define WMT_PIN_NORA8 WMT_PIN(5, 8) | ||
131 | #define WMT_PIN_NORA9 WMT_PIN(5, 9) | ||
132 | #define WMT_PIN_NORA10 WMT_PIN(5, 10) | ||
133 | #define WMT_PIN_NORA11 WMT_PIN(5, 11) | ||
134 | #define WMT_PIN_NORA12 WMT_PIN(5, 12) | ||
135 | #define WMT_PIN_NORA13 WMT_PIN(5, 13) | ||
136 | #define WMT_PIN_NORA14 WMT_PIN(5, 14) | ||
137 | #define WMT_PIN_NORA15 WMT_PIN(5, 15) | ||
138 | #define WMT_PIN_NORA16 WMT_PIN(5, 16) | ||
139 | #define WMT_PIN_NORA17 WMT_PIN(5, 17) | ||
140 | #define WMT_PIN_NORA18 WMT_PIN(5, 18) | ||
141 | #define WMT_PIN_NORA19 WMT_PIN(5, 19) | ||
142 | #define WMT_PIN_NORA20 WMT_PIN(5, 20) | ||
143 | #define WMT_PIN_NORA21 WMT_PIN(5, 21) | ||
144 | #define WMT_PIN_NORA22 WMT_PIN(5, 22) | ||
145 | #define WMT_PIN_NORA23 WMT_PIN(5, 23) | ||
146 | #define WMT_PIN_NORA24 WMT_PIN(5, 24) | ||
147 | #define WMT_PIN_AC97SDI WMT_PIN(6, 0) | ||
148 | #define WMT_PIN_AC97SYNC WMT_PIN(6, 1) | ||
149 | #define WMT_PIN_AC97SDO WMT_PIN(6, 2) | ||
150 | #define WMT_PIN_AC97BCLK WMT_PIN(6, 3) | ||
151 | #define WMT_PIN_AC97RST WMT_PIN(6, 4) | ||
152 | #define WMT_PIN_SFDO WMT_PIN(7, 0) | ||
153 | #define WMT_PIN_SFCS0 WMT_PIN(7, 1) | ||
154 | #define WMT_PIN_SFCS1 WMT_PIN(7, 2) | ||
155 | #define WMT_PIN_SFCLK WMT_PIN(7, 3) | ||
156 | #define WMT_PIN_SFDI WMT_PIN(7, 4) | ||
157 | #define WMT_PIN_SPI0CLK WMT_PIN(8, 0) | ||
158 | #define WMT_PIN_SPI0MISO WMT_PIN(8, 1) | ||
159 | #define WMT_PIN_SPI0MOSI WMT_PIN(8, 2) | ||
160 | #define WMT_PIN_SPI0SS WMT_PIN(8, 3) | ||
161 | #define WMT_PIN_SPI1CLK WMT_PIN(8, 4) | ||
162 | #define WMT_PIN_SPI1MISO WMT_PIN(8, 5) | ||
163 | #define WMT_PIN_SPI1MOSI WMT_PIN(8, 6) | ||
164 | #define WMT_PIN_SPI1SS WMT_PIN(8, 7) | ||
165 | #define WMT_PIN_SPI2CLK WMT_PIN(8, 8) | ||
166 | #define WMT_PIN_SPI2MISO WMT_PIN(8, 9) | ||
167 | #define WMT_PIN_SPI2MOSI WMT_PIN(8, 10) | ||
168 | #define WMT_PIN_SPI2SS WMT_PIN(8, 11) | ||
169 | #define WMT_PIN_UART0_RTS WMT_PIN(9, 0) | ||
170 | #define WMT_PIN_UART0_TXD WMT_PIN(9, 1) | ||
171 | #define WMT_PIN_UART0_CTS WMT_PIN(9, 2) | ||
172 | #define WMT_PIN_UART0_RXD WMT_PIN(9, 3) | ||
173 | #define WMT_PIN_UART1_RTS WMT_PIN(9, 4) | ||
174 | #define WMT_PIN_UART1_TXD WMT_PIN(9, 5) | ||
175 | #define WMT_PIN_UART1_CTS WMT_PIN(9, 6) | ||
176 | #define WMT_PIN_UART1_RXD WMT_PIN(9, 7) | ||
177 | #define WMT_PIN_UART2_RTS WMT_PIN(9, 8) | ||
178 | #define WMT_PIN_UART2_TXD WMT_PIN(9, 9) | ||
179 | #define WMT_PIN_UART2_CTS WMT_PIN(9, 10) | ||
180 | #define WMT_PIN_UART2_RXD WMT_PIN(9, 11) | ||
181 | #define WMT_PIN_UART3_RTS WMT_PIN(9, 12) | ||
182 | #define WMT_PIN_UART3_TXD WMT_PIN(9, 13) | ||
183 | #define WMT_PIN_UART3_CTS WMT_PIN(9, 14) | ||
184 | #define WMT_PIN_UART3_RXD WMT_PIN(9, 15) | ||
185 | #define WMT_PIN_I2C0SCL WMT_PIN(10, 0) | ||
186 | #define WMT_PIN_I2C0SDA WMT_PIN(10, 1) | ||
187 | #define WMT_PIN_I2C1SCL WMT_PIN(10, 2) | ||
188 | #define WMT_PIN_I2C1SDA WMT_PIN(10, 3) | ||
189 | #define WMT_PIN_I2C2SCL WMT_PIN(10, 4) | ||
190 | #define WMT_PIN_I2C2SDA WMT_PIN(10, 5) | ||
191 | |||
192 | static const struct pinctrl_pin_desc wm8505_pins[] = { | ||
193 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
194 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
195 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
196 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
197 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
198 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
199 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
200 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
201 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
202 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
203 | PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), | ||
204 | PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), | ||
205 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
206 | PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), | ||
207 | PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), | ||
208 | PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), | ||
209 | PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), | ||
210 | PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), | ||
211 | PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), | ||
212 | PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), | ||
213 | PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), | ||
214 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
215 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
216 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
217 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
218 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
219 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
220 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
221 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
222 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
223 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
224 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
225 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
226 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
227 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
228 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
229 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
230 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
231 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
232 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
233 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
234 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
235 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
236 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
237 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
238 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
239 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
240 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
241 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
242 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
243 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
244 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
245 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
246 | PINCTRL_PIN(WMT_PIN_VHSYNC, "v_hsync"), | ||
247 | PINCTRL_PIN(WMT_PIN_VVSYNC, "v_vsync"), | ||
248 | PINCTRL_PIN(WMT_PIN_VGAHSYNC, "vga_hsync"), | ||
249 | PINCTRL_PIN(WMT_PIN_VGAVSYNC, "vga_vsync"), | ||
250 | PINCTRL_PIN(WMT_PIN_VDHSYNC, "vd_hsync"), | ||
251 | PINCTRL_PIN(WMT_PIN_VDVSYNC, "vd_vsync"), | ||
252 | PINCTRL_PIN(WMT_PIN_NORD0, "nor_d0"), | ||
253 | PINCTRL_PIN(WMT_PIN_NORD1, "nor_d1"), | ||
254 | PINCTRL_PIN(WMT_PIN_NORD2, "nor_d2"), | ||
255 | PINCTRL_PIN(WMT_PIN_NORD3, "nor_d3"), | ||
256 | PINCTRL_PIN(WMT_PIN_NORD4, "nor_d4"), | ||
257 | PINCTRL_PIN(WMT_PIN_NORD5, "nor_d5"), | ||
258 | PINCTRL_PIN(WMT_PIN_NORD6, "nor_d6"), | ||
259 | PINCTRL_PIN(WMT_PIN_NORD7, "nor_d7"), | ||
260 | PINCTRL_PIN(WMT_PIN_NORD8, "nor_d8"), | ||
261 | PINCTRL_PIN(WMT_PIN_NORD9, "nor_d9"), | ||
262 | PINCTRL_PIN(WMT_PIN_NORD10, "nor_d10"), | ||
263 | PINCTRL_PIN(WMT_PIN_NORD11, "nor_d11"), | ||
264 | PINCTRL_PIN(WMT_PIN_NORD12, "nor_d12"), | ||
265 | PINCTRL_PIN(WMT_PIN_NORD13, "nor_d13"), | ||
266 | PINCTRL_PIN(WMT_PIN_NORD14, "nor_d14"), | ||
267 | PINCTRL_PIN(WMT_PIN_NORD15, "nor_d15"), | ||
268 | PINCTRL_PIN(WMT_PIN_NORA0, "nor_a0"), | ||
269 | PINCTRL_PIN(WMT_PIN_NORA1, "nor_a1"), | ||
270 | PINCTRL_PIN(WMT_PIN_NORA2, "nor_a2"), | ||
271 | PINCTRL_PIN(WMT_PIN_NORA3, "nor_a3"), | ||
272 | PINCTRL_PIN(WMT_PIN_NORA4, "nor_a4"), | ||
273 | PINCTRL_PIN(WMT_PIN_NORA5, "nor_a5"), | ||
274 | PINCTRL_PIN(WMT_PIN_NORA6, "nor_a6"), | ||
275 | PINCTRL_PIN(WMT_PIN_NORA7, "nor_a7"), | ||
276 | PINCTRL_PIN(WMT_PIN_NORA8, "nor_a8"), | ||
277 | PINCTRL_PIN(WMT_PIN_NORA9, "nor_a9"), | ||
278 | PINCTRL_PIN(WMT_PIN_NORA10, "nor_a10"), | ||
279 | PINCTRL_PIN(WMT_PIN_NORA11, "nor_a11"), | ||
280 | PINCTRL_PIN(WMT_PIN_NORA12, "nor_a12"), | ||
281 | PINCTRL_PIN(WMT_PIN_NORA13, "nor_a13"), | ||
282 | PINCTRL_PIN(WMT_PIN_NORA14, "nor_a14"), | ||
283 | PINCTRL_PIN(WMT_PIN_NORA15, "nor_a15"), | ||
284 | PINCTRL_PIN(WMT_PIN_NORA16, "nor_a16"), | ||
285 | PINCTRL_PIN(WMT_PIN_NORA17, "nor_a17"), | ||
286 | PINCTRL_PIN(WMT_PIN_NORA18, "nor_a18"), | ||
287 | PINCTRL_PIN(WMT_PIN_NORA19, "nor_a19"), | ||
288 | PINCTRL_PIN(WMT_PIN_NORA20, "nor_a20"), | ||
289 | PINCTRL_PIN(WMT_PIN_NORA21, "nor_a21"), | ||
290 | PINCTRL_PIN(WMT_PIN_NORA22, "nor_a22"), | ||
291 | PINCTRL_PIN(WMT_PIN_NORA23, "nor_a23"), | ||
292 | PINCTRL_PIN(WMT_PIN_NORA24, "nor_a24"), | ||
293 | PINCTRL_PIN(WMT_PIN_AC97SDI, "ac97_sdi"), | ||
294 | PINCTRL_PIN(WMT_PIN_AC97SYNC, "ac97_sync"), | ||
295 | PINCTRL_PIN(WMT_PIN_AC97SDO, "ac97_sdo"), | ||
296 | PINCTRL_PIN(WMT_PIN_AC97BCLK, "ac97_bclk"), | ||
297 | PINCTRL_PIN(WMT_PIN_AC97RST, "ac97_rst"), | ||
298 | PINCTRL_PIN(WMT_PIN_SFDO, "sf_do"), | ||
299 | PINCTRL_PIN(WMT_PIN_SFCS0, "sf_cs0"), | ||
300 | PINCTRL_PIN(WMT_PIN_SFCS1, "sf_cs1"), | ||
301 | PINCTRL_PIN(WMT_PIN_SFCLK, "sf_clk"), | ||
302 | PINCTRL_PIN(WMT_PIN_SFDI, "sf_di"), | ||
303 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
304 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
305 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
306 | PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), | ||
307 | PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), | ||
308 | PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), | ||
309 | PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), | ||
310 | PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), | ||
311 | PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), | ||
312 | PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), | ||
313 | PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), | ||
314 | PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), | ||
315 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
316 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
317 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
318 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
319 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
320 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
321 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
322 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
323 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
324 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
325 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
326 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
327 | PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), | ||
328 | PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), | ||
329 | PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), | ||
330 | PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), | ||
331 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
332 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
333 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
334 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
335 | PINCTRL_PIN(WMT_PIN_I2C2SCL, "i2c2_scl"), | ||
336 | PINCTRL_PIN(WMT_PIN_I2C2SDA, "i2c2_sda"), | ||
337 | }; | ||
338 | |||
339 | /* Order of these names must match the above list */ | ||
340 | static const char * const wm8505_groups[] = { | ||
341 | "extgpio0", | ||
342 | "extgpio1", | ||
343 | "extgpio2", | ||
344 | "extgpio3", | ||
345 | "extgpio4", | ||
346 | "extgpio5", | ||
347 | "extgpio6", | ||
348 | "extgpio7", | ||
349 | "wakeup0", | ||
350 | "wakeup1", | ||
351 | "wakeup2", | ||
352 | "wakeup3", | ||
353 | "susgpio0", | ||
354 | "sd_data0", | ||
355 | "sd_data1", | ||
356 | "sd_data2", | ||
357 | "sd_data3", | ||
358 | "mmc_data0", | ||
359 | "mmc_data1", | ||
360 | "mmc_data2", | ||
361 | "mmc_data3", | ||
362 | "vdin0", | ||
363 | "vdin1", | ||
364 | "vdin2", | ||
365 | "vdin3", | ||
366 | "vdin4", | ||
367 | "vdin5", | ||
368 | "vdin6", | ||
369 | "vdin7", | ||
370 | "vdout0", | ||
371 | "vdout1", | ||
372 | "vdout2", | ||
373 | "vdout3", | ||
374 | "vdout4", | ||
375 | "vdout5", | ||
376 | "vdout6", | ||
377 | "vdout7", | ||
378 | "vdout8", | ||
379 | "vdout9", | ||
380 | "vdout10", | ||
381 | "vdout11", | ||
382 | "vdout12", | ||
383 | "vdout13", | ||
384 | "vdout14", | ||
385 | "vdout15", | ||
386 | "vdout16", | ||
387 | "vdout17", | ||
388 | "vdout18", | ||
389 | "vdout19", | ||
390 | "vdout20", | ||
391 | "vdout21", | ||
392 | "vdout22", | ||
393 | "vdout23", | ||
394 | "v_hsync", | ||
395 | "v_vsync", | ||
396 | "vga_hsync", | ||
397 | "vga_vsync", | ||
398 | "vd_hsync", | ||
399 | "vd_vsync", | ||
400 | "nor_d0", | ||
401 | "nor_d1", | ||
402 | "nor_d2", | ||
403 | "nor_d3", | ||
404 | "nor_d4", | ||
405 | "nor_d5", | ||
406 | "nor_d6", | ||
407 | "nor_d7", | ||
408 | "nor_d8", | ||
409 | "nor_d9", | ||
410 | "nor_d10", | ||
411 | "nor_d11", | ||
412 | "nor_d12", | ||
413 | "nor_d13", | ||
414 | "nor_d14", | ||
415 | "nor_d15", | ||
416 | "nor_a0", | ||
417 | "nor_a1", | ||
418 | "nor_a2", | ||
419 | "nor_a3", | ||
420 | "nor_a4", | ||
421 | "nor_a5", | ||
422 | "nor_a6", | ||
423 | "nor_a7", | ||
424 | "nor_a8", | ||
425 | "nor_a9", | ||
426 | "nor_a10", | ||
427 | "nor_a11", | ||
428 | "nor_a12", | ||
429 | "nor_a13", | ||
430 | "nor_a14", | ||
431 | "nor_a15", | ||
432 | "nor_a16", | ||
433 | "nor_a17", | ||
434 | "nor_a18", | ||
435 | "nor_a19", | ||
436 | "nor_a20", | ||
437 | "nor_a21", | ||
438 | "nor_a22", | ||
439 | "nor_a23", | ||
440 | "nor_a24", | ||
441 | "ac97_sdi", | ||
442 | "ac97_sync", | ||
443 | "ac97_sdo", | ||
444 | "ac97_bclk", | ||
445 | "ac97_rst", | ||
446 | "sf_do", | ||
447 | "sf_cs0", | ||
448 | "sf_cs1", | ||
449 | "sf_clk", | ||
450 | "sf_di", | ||
451 | "spi0_clk", | ||
452 | "spi0_miso", | ||
453 | "spi0_mosi", | ||
454 | "spi0_ss", | ||
455 | "spi1_clk", | ||
456 | "spi1_miso", | ||
457 | "spi1_mosi", | ||
458 | "spi1_ss", | ||
459 | "spi2_clk", | ||
460 | "spi2_miso", | ||
461 | "spi2_mosi", | ||
462 | "spi2_ss", | ||
463 | "uart0_rts", | ||
464 | "uart0_txd", | ||
465 | "uart0_cts", | ||
466 | "uart0_rxd", | ||
467 | "uart1_rts", | ||
468 | "uart1_txd", | ||
469 | "uart1_cts", | ||
470 | "uart1_rxd", | ||
471 | "uart2_rts", | ||
472 | "uart2_txd", | ||
473 | "uart2_cts", | ||
474 | "uart2_rxd", | ||
475 | "uart3_rts", | ||
476 | "uart3_txd", | ||
477 | "uart3_cts", | ||
478 | "uart3_rxd", | ||
479 | "i2c0_scl", | ||
480 | "i2c0_sda", | ||
481 | "i2c1_scl", | ||
482 | "i2c1_sda", | ||
483 | "i2c2_scl", | ||
484 | "i2c2_sda", | ||
485 | }; | ||
486 | |||
487 | static int wm8505_pinctrl_probe(struct platform_device *pdev) | ||
488 | { | ||
489 | struct wmt_pinctrl_data *data; | ||
490 | |||
491 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
492 | if (!data) { | ||
493 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
494 | return -ENOMEM; | ||
495 | } | ||
496 | |||
497 | data->banks = wm8505_banks; | ||
498 | data->nbanks = ARRAY_SIZE(wm8505_banks); | ||
499 | data->pins = wm8505_pins; | ||
500 | data->npins = ARRAY_SIZE(wm8505_pins); | ||
501 | data->groups = wm8505_groups; | ||
502 | data->ngroups = ARRAY_SIZE(wm8505_groups); | ||
503 | |||
504 | return wmt_pinctrl_probe(pdev, data); | ||
505 | } | ||
506 | |||
507 | static int wm8505_pinctrl_remove(struct platform_device *pdev) | ||
508 | { | ||
509 | return wmt_pinctrl_remove(pdev); | ||
510 | } | ||
511 | |||
512 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
513 | { .compatible = "wm,wm8505-pinctrl" }, | ||
514 | { /* sentinel */ }, | ||
515 | }; | ||
516 | |||
517 | static struct platform_driver wmt_pinctrl_driver = { | ||
518 | .probe = wm8505_pinctrl_probe, | ||
519 | .remove = wm8505_pinctrl_remove, | ||
520 | .driver = { | ||
521 | .name = "pinctrl-wm8505", | ||
522 | .owner = THIS_MODULE, | ||
523 | .of_match_table = wmt_pinctrl_of_match, | ||
524 | }, | ||
525 | }; | ||
526 | |||
527 | module_platform_driver(wmt_pinctrl_driver); | ||
528 | |||
529 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
530 | MODULE_DESCRIPTION("Wondermedia WM8505 Pincontrol driver"); | ||
531 | MODULE_LICENSE("GPL v2"); | ||
532 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8650.c b/drivers/pinctrl/vt8500/pinctrl-wm8650.c new file mode 100644 index 000000000000..7de57f063153 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8650.c | |||
@@ -0,0 +1,370 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8650 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8650_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | }; | ||
42 | |||
43 | /* Please keep sorted by bank/bit */ | ||
44 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
45 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
46 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
47 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
48 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
49 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
50 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
51 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
52 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
53 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
54 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
55 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
56 | #define WMT_PIN_SD1CD WMT_PIN(0, 29) | ||
57 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
58 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
59 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
60 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
61 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
62 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
63 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
64 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
65 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
66 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
67 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
68 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
69 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
70 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
71 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
72 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
73 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
74 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
75 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
76 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
77 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
78 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
79 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
80 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
81 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
82 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
83 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
84 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
85 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
86 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
87 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
88 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
89 | #define WMT_PIN_I2C1SCL WMT_PIN(2, 12) | ||
90 | #define WMT_PIN_I2C1SDA WMT_PIN(2, 13) | ||
91 | #define WMT_PIN_SPI0MOSI WMT_PIN(2, 24) | ||
92 | #define WMT_PIN_SPI0MISO WMT_PIN(2, 25) | ||
93 | #define WMT_PIN_SPI0SS0 WMT_PIN(2, 26) | ||
94 | #define WMT_PIN_SPI0CLK WMT_PIN(2, 27) | ||
95 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 8) | ||
96 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 9) | ||
97 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 10) | ||
98 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 11) | ||
99 | #define WMT_PIN_SD0CLK WMT_PIN(3, 12) | ||
100 | #define WMT_PIN_SD0WP WMT_PIN(3, 13) | ||
101 | #define WMT_PIN_SD0CMD WMT_PIN(3, 14) | ||
102 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
103 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
104 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
105 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
106 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
107 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
108 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
109 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
110 | #define WMT_PIN_I2C0SCL WMT_PIN(5, 8) | ||
111 | #define WMT_PIN_I2C0SDA WMT_PIN(5, 9) | ||
112 | #define WMT_PIN_UART0RTS WMT_PIN(5, 16) | ||
113 | #define WMT_PIN_UART0TXD WMT_PIN(5, 17) | ||
114 | #define WMT_PIN_UART0CTS WMT_PIN(5, 18) | ||
115 | #define WMT_PIN_UART0RXD WMT_PIN(5, 19) | ||
116 | #define WMT_PIN_UART1RTS WMT_PIN(5, 20) | ||
117 | #define WMT_PIN_UART1TXD WMT_PIN(5, 21) | ||
118 | #define WMT_PIN_UART1CTS WMT_PIN(5, 22) | ||
119 | #define WMT_PIN_UART1RXD WMT_PIN(5, 23) | ||
120 | #define WMT_PIN_UART2RTS WMT_PIN(5, 24) | ||
121 | #define WMT_PIN_UART2TXD WMT_PIN(5, 25) | ||
122 | #define WMT_PIN_UART2CTS WMT_PIN(5, 26) | ||
123 | #define WMT_PIN_UART2RXD WMT_PIN(5, 27) | ||
124 | #define WMT_PIN_UART3RTS WMT_PIN(5, 28) | ||
125 | #define WMT_PIN_UART3TXD WMT_PIN(5, 29) | ||
126 | #define WMT_PIN_UART3CTS WMT_PIN(5, 30) | ||
127 | #define WMT_PIN_UART3RXD WMT_PIN(5, 31) | ||
128 | #define WMT_PIN_KPADROW0 WMT_PIN(6, 16) | ||
129 | #define WMT_PIN_KPADROW1 WMT_PIN(6, 17) | ||
130 | #define WMT_PIN_KPADCOL0 WMT_PIN(6, 18) | ||
131 | #define WMT_PIN_KPADCOL1 WMT_PIN(6, 19) | ||
132 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
133 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
134 | #define WMT_PIN_SD1WP WMT_PIN(7, 13) | ||
135 | |||
136 | static const struct pinctrl_pin_desc wm8650_pins[] = { | ||
137 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
138 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
139 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
140 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
141 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
142 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
143 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
144 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
145 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
146 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
147 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
148 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
149 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
150 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
151 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
152 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
153 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
154 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
155 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
156 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
157 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
158 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
159 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
160 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
161 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
162 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
182 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
183 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
184 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
185 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
186 | PINCTRL_PIN(WMT_PIN_SPI0SS0, "spi0_ss0"), | ||
187 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
188 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
189 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
190 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
191 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
192 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
193 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
194 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
195 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
196 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
197 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
198 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
199 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
203 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
204 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
205 | PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), | ||
206 | PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), | ||
207 | PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), | ||
208 | PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), | ||
209 | PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), | ||
210 | PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), | ||
211 | PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), | ||
212 | PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), | ||
213 | PINCTRL_PIN(WMT_PIN_UART2RTS, "uart2_rts"), | ||
214 | PINCTRL_PIN(WMT_PIN_UART2TXD, "uart2_txd"), | ||
215 | PINCTRL_PIN(WMT_PIN_UART2CTS, "uart2_cts"), | ||
216 | PINCTRL_PIN(WMT_PIN_UART2RXD, "uart2_rxd"), | ||
217 | PINCTRL_PIN(WMT_PIN_UART3RTS, "uart3_rts"), | ||
218 | PINCTRL_PIN(WMT_PIN_UART3TXD, "uart3_txd"), | ||
219 | PINCTRL_PIN(WMT_PIN_UART3CTS, "uart3_cts"), | ||
220 | PINCTRL_PIN(WMT_PIN_UART3RXD, "uart3_rxd"), | ||
221 | PINCTRL_PIN(WMT_PIN_KPADROW0, "kpadrow0"), | ||
222 | PINCTRL_PIN(WMT_PIN_KPADROW1, "kpadrow1"), | ||
223 | PINCTRL_PIN(WMT_PIN_KPADCOL0, "kpadcol0"), | ||
224 | PINCTRL_PIN(WMT_PIN_KPADCOL1, "kpadcol1"), | ||
225 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
226 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
227 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
228 | }; | ||
229 | |||
230 | /* Order of these names must match the above list */ | ||
231 | static const char * const wm8650_groups[] = { | ||
232 | "extgpio0", | ||
233 | "extgpio1", | ||
234 | "extgpio2", | ||
235 | "extgpio3", | ||
236 | "extgpio4", | ||
237 | "extgpio5", | ||
238 | "extgpio6", | ||
239 | "extgpio7", | ||
240 | "wakeup0", | ||
241 | "wakeup1", | ||
242 | "susgpio0", | ||
243 | "sd0_cd", | ||
244 | "sd1_cd", | ||
245 | "vdout0", | ||
246 | "vdout1", | ||
247 | "vdout2", | ||
248 | "vdout3", | ||
249 | "vdout4", | ||
250 | "vdout5", | ||
251 | "vdout6", | ||
252 | "vdout7", | ||
253 | "vdout8", | ||
254 | "vdout9", | ||
255 | "vdout10", | ||
256 | "vdout11", | ||
257 | "vdout12", | ||
258 | "vdout13", | ||
259 | "vdout14", | ||
260 | "vdout15", | ||
261 | "vdout16", | ||
262 | "vdout17", | ||
263 | "vdout18", | ||
264 | "vdout19", | ||
265 | "vdout20", | ||
266 | "vdout21", | ||
267 | "vdout22", | ||
268 | "vdout23", | ||
269 | "vdin0", | ||
270 | "vdin1", | ||
271 | "vdin2", | ||
272 | "vdin3", | ||
273 | "vdin4", | ||
274 | "vdin5", | ||
275 | "vdin6", | ||
276 | "vdin7", | ||
277 | "i2c1_scl", | ||
278 | "i2c1_sda", | ||
279 | "spi0_mosi", | ||
280 | "spi0_miso", | ||
281 | "spi0_ss0", | ||
282 | "spi0_clk", | ||
283 | "sd0_data0", | ||
284 | "sd0_data1", | ||
285 | "sd0_data2", | ||
286 | "sd0_data3", | ||
287 | "sd0_clk", | ||
288 | "sd0_wp", | ||
289 | "sd0_cmd", | ||
290 | "sd1_data0", | ||
291 | "sd1_data1", | ||
292 | "sd1_data2", | ||
293 | "sd1_data3", | ||
294 | "sd1_data4", | ||
295 | "sd1_data5", | ||
296 | "sd1_data6", | ||
297 | "sd1_data7", | ||
298 | "i2c0_scl", | ||
299 | "i2c0_sda", | ||
300 | "uart0_rts", | ||
301 | "uart0_txd", | ||
302 | "uart0_cts", | ||
303 | "uart0_rxd", | ||
304 | "uart1_rts", | ||
305 | "uart1_txd", | ||
306 | "uart1_cts", | ||
307 | "uart1_rxd", | ||
308 | "uart2_rts", | ||
309 | "uart2_txd", | ||
310 | "uart2_cts", | ||
311 | "uart2_rxd", | ||
312 | "uart3_rts", | ||
313 | "uart3_txd", | ||
314 | "uart3_cts", | ||
315 | "uart3_rxd", | ||
316 | "kpadrow0", | ||
317 | "kpadrow1", | ||
318 | "kpadcol0", | ||
319 | "kpadcol1", | ||
320 | "sd1_clk", | ||
321 | "sd1_cmd", | ||
322 | "sd1_wp", | ||
323 | }; | ||
324 | |||
325 | static int wm8650_pinctrl_probe(struct platform_device *pdev) | ||
326 | { | ||
327 | struct wmt_pinctrl_data *data; | ||
328 | |||
329 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
330 | if (!data) { | ||
331 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
332 | return -ENOMEM; | ||
333 | } | ||
334 | |||
335 | data->banks = wm8650_banks; | ||
336 | data->nbanks = ARRAY_SIZE(wm8650_banks); | ||
337 | data->pins = wm8650_pins; | ||
338 | data->npins = ARRAY_SIZE(wm8650_pins); | ||
339 | data->groups = wm8650_groups; | ||
340 | data->ngroups = ARRAY_SIZE(wm8650_groups); | ||
341 | |||
342 | return wmt_pinctrl_probe(pdev, data); | ||
343 | } | ||
344 | |||
345 | static int wm8650_pinctrl_remove(struct platform_device *pdev) | ||
346 | { | ||
347 | return wmt_pinctrl_remove(pdev); | ||
348 | } | ||
349 | |||
350 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
351 | { .compatible = "wm,wm8650-pinctrl" }, | ||
352 | { /* sentinel */ }, | ||
353 | }; | ||
354 | |||
355 | static struct platform_driver wmt_pinctrl_driver = { | ||
356 | .probe = wm8650_pinctrl_probe, | ||
357 | .remove = wm8650_pinctrl_remove, | ||
358 | .driver = { | ||
359 | .name = "pinctrl-wm8650", | ||
360 | .owner = THIS_MODULE, | ||
361 | .of_match_table = wmt_pinctrl_of_match, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | module_platform_driver(wmt_pinctrl_driver); | ||
366 | |||
367 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
368 | MODULE_DESCRIPTION("Wondermedia WM8650 Pincontrol driver"); | ||
369 | MODULE_LICENSE("GPL v2"); | ||
370 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8750.c b/drivers/pinctrl/vt8500/pinctrl-wm8750.c new file mode 100644 index 000000000000..b964cc550568 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8750.c | |||
@@ -0,0 +1,409 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8750 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8750_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 16) | ||
57 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
58 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
59 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
60 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
61 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
62 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
63 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
64 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
65 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
66 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
67 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
68 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
69 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
70 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
71 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
72 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
73 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
74 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
75 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
76 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
77 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
78 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
79 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
80 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
81 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
82 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
83 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
84 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
85 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
86 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
87 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
88 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
89 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
90 | #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) | ||
91 | #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) | ||
92 | #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) | ||
93 | #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) | ||
94 | #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) | ||
95 | #define WMT_PIN_SD0CLK WMT_PIN(3, 17) | ||
96 | #define WMT_PIN_SD0CMD WMT_PIN(3, 18) | ||
97 | #define WMT_PIN_SD0WP WMT_PIN(3, 19) | ||
98 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) | ||
99 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) | ||
100 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) | ||
101 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) | ||
102 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
103 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
104 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
105 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
106 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
107 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
108 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
109 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
110 | #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) | ||
111 | #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) | ||
112 | #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) | ||
113 | #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) | ||
114 | #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) | ||
115 | #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) | ||
116 | #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) | ||
117 | #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) | ||
118 | #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) | ||
119 | #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) | ||
120 | #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) | ||
121 | #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) | ||
122 | #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) | ||
123 | #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) | ||
124 | #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) | ||
125 | #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) | ||
126 | #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) | ||
127 | #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) | ||
128 | #define WMT_PIN_UART3_RTS WMT_PIN(5, 28) | ||
129 | #define WMT_PIN_UART3_TXD WMT_PIN(5, 29) | ||
130 | #define WMT_PIN_UART3_CTS WMT_PIN(5, 30) | ||
131 | #define WMT_PIN_UART3_RXD WMT_PIN(5, 31) | ||
132 | #define WMT_PIN_SD2CD WMT_PIN(6, 0) | ||
133 | #define WMT_PIN_SD2DATA3 WMT_PIN(6, 1) | ||
134 | #define WMT_PIN_SD2DATA0 WMT_PIN(6, 2) | ||
135 | #define WMT_PIN_SD2WP WMT_PIN(6, 3) | ||
136 | #define WMT_PIN_SD2DATA1 WMT_PIN(6, 4) | ||
137 | #define WMT_PIN_SD2DATA2 WMT_PIN(6, 5) | ||
138 | #define WMT_PIN_SD2CMD WMT_PIN(6, 6) | ||
139 | #define WMT_PIN_SD2CLK WMT_PIN(6, 7) | ||
140 | #define WMT_PIN_SD2PWR WMT_PIN(6, 9) | ||
141 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
142 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
143 | #define WMT_PIN_SD1PWR WMT_PIN(7, 10) | ||
144 | #define WMT_PIN_SD1WP WMT_PIN(7, 11) | ||
145 | #define WMT_PIN_SD1CD WMT_PIN(7, 12) | ||
146 | #define WMT_PIN_SPI0SS3 WMT_PIN(7, 24) | ||
147 | #define WMT_PIN_SPI0SS2 WMT_PIN(7, 25) | ||
148 | #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) | ||
149 | #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) | ||
150 | |||
151 | static const struct pinctrl_pin_desc wm8750_pins[] = { | ||
152 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
153 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
154 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
155 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
156 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
157 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
158 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
159 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
160 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
161 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
162 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
182 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
183 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
184 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
185 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
186 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
187 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
188 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
189 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
190 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
191 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
192 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
193 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
194 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
195 | PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), | ||
196 | PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), | ||
197 | PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), | ||
198 | PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), | ||
199 | PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
203 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
204 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
205 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
206 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
207 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
208 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
209 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
210 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
211 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
212 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
213 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
214 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
215 | PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), | ||
216 | PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), | ||
217 | PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), | ||
218 | PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), | ||
219 | PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), | ||
220 | PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), | ||
221 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
222 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
223 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
224 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
225 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
226 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
227 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
228 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
229 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
230 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
231 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
232 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
233 | PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), | ||
234 | PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), | ||
235 | PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), | ||
236 | PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), | ||
237 | PINCTRL_PIN(WMT_PIN_SD2CD, "sd2_cd"), | ||
238 | PINCTRL_PIN(WMT_PIN_SD2DATA3, "sd2_data3"), | ||
239 | PINCTRL_PIN(WMT_PIN_SD2DATA0, "sd2_data0"), | ||
240 | PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), | ||
241 | PINCTRL_PIN(WMT_PIN_SD2DATA1, "sd2_data1"), | ||
242 | PINCTRL_PIN(WMT_PIN_SD2DATA2, "sd2_data2"), | ||
243 | PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), | ||
244 | PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), | ||
245 | PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), | ||
246 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
247 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
248 | PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), | ||
249 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
250 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
251 | PINCTRL_PIN(WMT_PIN_SPI0SS3, "spi0_ss3"), | ||
252 | PINCTRL_PIN(WMT_PIN_SPI0SS2, "spi0_ss2"), | ||
253 | PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), | ||
254 | PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), | ||
255 | }; | ||
256 | |||
257 | /* Order of these names must match the above list */ | ||
258 | static const char * const wm8750_groups[] = { | ||
259 | "extgpio0", | ||
260 | "extgpio1", | ||
261 | "extgpio2", | ||
262 | "extgpio3", | ||
263 | "extgpio4", | ||
264 | "extgpio5", | ||
265 | "extgpio6", | ||
266 | "extgpio7", | ||
267 | "wakeup0", | ||
268 | "wakeup1", | ||
269 | "sd0_cd", | ||
270 | "vdout0", | ||
271 | "vdout1", | ||
272 | "vdout2", | ||
273 | "vdout3", | ||
274 | "vdout4", | ||
275 | "vdout5", | ||
276 | "vdout6", | ||
277 | "vdout7", | ||
278 | "vdout8", | ||
279 | "vdout9", | ||
280 | "vdout10", | ||
281 | "vdout11", | ||
282 | "vdout12", | ||
283 | "vdout13", | ||
284 | "vdout14", | ||
285 | "vdout15", | ||
286 | "vdout16", | ||
287 | "vdout17", | ||
288 | "vdout18", | ||
289 | "vdout19", | ||
290 | "vdout20", | ||
291 | "vdout21", | ||
292 | "vdout22", | ||
293 | "vdout23", | ||
294 | "vdin0", | ||
295 | "vdin1", | ||
296 | "vdin2", | ||
297 | "vdin3", | ||
298 | "vdin4", | ||
299 | "vdin5", | ||
300 | "vdin6", | ||
301 | "vdin7", | ||
302 | "spi0_mosi", | ||
303 | "spi0_miso", | ||
304 | "spi0_ss", | ||
305 | "spi0_clk", | ||
306 | "spi0_ssb", | ||
307 | "sd0_clk", | ||
308 | "sd0_cmd", | ||
309 | "sd0_wp", | ||
310 | "sd0_data0", | ||
311 | "sd0_data1", | ||
312 | "sd0_data2", | ||
313 | "sd0_data3", | ||
314 | "sd1_data0", | ||
315 | "sd1_data1", | ||
316 | "sd1_data2", | ||
317 | "sd1_data3", | ||
318 | "sd1_data4", | ||
319 | "sd1_data5", | ||
320 | "sd1_data6", | ||
321 | "sd1_data7", | ||
322 | "i2c0_scl", | ||
323 | "i2c0_sda", | ||
324 | "i2c1_scl", | ||
325 | "i2c1_sda", | ||
326 | "i2c2_scl", | ||
327 | "i2c2_sda", | ||
328 | "uart0_rts", | ||
329 | "uart0_txd", | ||
330 | "uart0_cts", | ||
331 | "uart0_rxd", | ||
332 | "uart1_rts", | ||
333 | "uart1_txd", | ||
334 | "uart1_cts", | ||
335 | "uart1_rxd", | ||
336 | "uart2_rts", | ||
337 | "uart2_txd", | ||
338 | "uart2_cts", | ||
339 | "uart2_rxd", | ||
340 | "uart3_rts", | ||
341 | "uart3_txd", | ||
342 | "uart3_cts", | ||
343 | "uart3_rxd", | ||
344 | "sd2_cd", | ||
345 | "sd2_data3", | ||
346 | "sd2_data0", | ||
347 | "sd2_wp", | ||
348 | "sd2_data1", | ||
349 | "sd2_data2", | ||
350 | "sd2_cmd", | ||
351 | "sd2_clk", | ||
352 | "sd2_pwr", | ||
353 | "sd1_clk", | ||
354 | "sd1_cmd", | ||
355 | "sd1_pwr", | ||
356 | "sd1_wp", | ||
357 | "sd1_cd", | ||
358 | "spi0_ss3", | ||
359 | "spi0_ss2", | ||
360 | "pwmout1", | ||
361 | "pwmout0", | ||
362 | }; | ||
363 | |||
364 | static int wm8750_pinctrl_probe(struct platform_device *pdev) | ||
365 | { | ||
366 | struct wmt_pinctrl_data *data; | ||
367 | |||
368 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
369 | if (!data) { | ||
370 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
371 | return -ENOMEM; | ||
372 | } | ||
373 | |||
374 | data->banks = wm8750_banks; | ||
375 | data->nbanks = ARRAY_SIZE(wm8750_banks); | ||
376 | data->pins = wm8750_pins; | ||
377 | data->npins = ARRAY_SIZE(wm8750_pins); | ||
378 | data->groups = wm8750_groups; | ||
379 | data->ngroups = ARRAY_SIZE(wm8750_groups); | ||
380 | |||
381 | return wmt_pinctrl_probe(pdev, data); | ||
382 | } | ||
383 | |||
384 | static int wm8750_pinctrl_remove(struct platform_device *pdev) | ||
385 | { | ||
386 | return wmt_pinctrl_remove(pdev); | ||
387 | } | ||
388 | |||
389 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
390 | { .compatible = "wm,wm8750-pinctrl" }, | ||
391 | { /* sentinel */ }, | ||
392 | }; | ||
393 | |||
394 | static struct platform_driver wmt_pinctrl_driver = { | ||
395 | .probe = wm8750_pinctrl_probe, | ||
396 | .remove = wm8750_pinctrl_remove, | ||
397 | .driver = { | ||
398 | .name = "pinctrl-wm8750", | ||
399 | .owner = THIS_MODULE, | ||
400 | .of_match_table = wmt_pinctrl_of_match, | ||
401 | }, | ||
402 | }; | ||
403 | |||
404 | module_platform_driver(wmt_pinctrl_driver); | ||
405 | |||
406 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
407 | MODULE_DESCRIPTION("Wondermedia WM8750 Pincontrol driver"); | ||
408 | MODULE_LICENSE("GPL v2"); | ||
409 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8850.c b/drivers/pinctrl/vt8500/pinctrl-wm8850.c new file mode 100644 index 000000000000..ecadce9c91d5 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8850.c | |||
@@ -0,0 +1,388 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8850 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8850_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
57 | #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) | ||
58 | #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) | ||
59 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
60 | #define WMT_PIN_SUSGPIO1 WMT_PIN(0, 22) | ||
61 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
62 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
63 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
64 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
65 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
66 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
67 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
68 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
69 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
70 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
71 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
72 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
73 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
74 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
75 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
76 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
77 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
78 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
79 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
80 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
81 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
82 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
83 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
84 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
85 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
86 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
87 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
88 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
89 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
90 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
91 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
92 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
93 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
94 | #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) | ||
95 | #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) | ||
96 | #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) | ||
97 | #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) | ||
98 | #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) | ||
99 | #define WMT_PIN_SD0CLK WMT_PIN(3, 17) | ||
100 | #define WMT_PIN_SD0CMD WMT_PIN(3, 18) | ||
101 | #define WMT_PIN_SD0WP WMT_PIN(3, 19) | ||
102 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) | ||
103 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) | ||
104 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) | ||
105 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) | ||
106 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
107 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
108 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
109 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
110 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
111 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
112 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
113 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
114 | #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) | ||
115 | #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) | ||
116 | #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) | ||
117 | #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) | ||
118 | #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) | ||
119 | #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) | ||
120 | #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) | ||
121 | #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) | ||
122 | #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) | ||
123 | #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) | ||
124 | #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) | ||
125 | #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) | ||
126 | #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) | ||
127 | #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) | ||
128 | #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) | ||
129 | #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) | ||
130 | #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) | ||
131 | #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) | ||
132 | #define WMT_PIN_SD2WP WMT_PIN(6, 3) | ||
133 | #define WMT_PIN_SD2CMD WMT_PIN(6, 6) | ||
134 | #define WMT_PIN_SD2CLK WMT_PIN(6, 7) | ||
135 | #define WMT_PIN_SD2PWR WMT_PIN(6, 9) | ||
136 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
137 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
138 | #define WMT_PIN_SD1PWR WMT_PIN(7, 10) | ||
139 | #define WMT_PIN_SD1WP WMT_PIN(7, 11) | ||
140 | #define WMT_PIN_SD1CD WMT_PIN(7, 12) | ||
141 | #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) | ||
142 | #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) | ||
143 | |||
144 | static const struct pinctrl_pin_desc wm8850_pins[] = { | ||
145 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
146 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
147 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
148 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
149 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
150 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
151 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
152 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
153 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
154 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
155 | PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), | ||
156 | PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), | ||
157 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
158 | PINCTRL_PIN(WMT_PIN_SUSGPIO1, "susgpio1"), | ||
159 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
160 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
161 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
162 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
182 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
183 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
184 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
185 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
186 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
187 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
188 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
189 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
190 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
191 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
192 | PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), | ||
193 | PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), | ||
194 | PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), | ||
195 | PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), | ||
196 | PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), | ||
197 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
198 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
199 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
203 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
204 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
205 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
206 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
207 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
208 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
209 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
210 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
211 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
212 | PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), | ||
213 | PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), | ||
214 | PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), | ||
215 | PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), | ||
216 | PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), | ||
217 | PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), | ||
218 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
219 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
220 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
221 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
222 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
223 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
224 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
225 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
226 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
227 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
228 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
229 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
230 | PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), | ||
231 | PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), | ||
232 | PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), | ||
233 | PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), | ||
234 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
235 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
236 | PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), | ||
237 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
238 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
239 | PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), | ||
240 | PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), | ||
241 | }; | ||
242 | |||
243 | /* Order of these names must match the above list */ | ||
244 | static const char * const wm8850_groups[] = { | ||
245 | "extgpio0", | ||
246 | "extgpio1", | ||
247 | "extgpio2", | ||
248 | "extgpio3", | ||
249 | "extgpio4", | ||
250 | "extgpio5", | ||
251 | "extgpio6", | ||
252 | "extgpio7", | ||
253 | "wakeup0", | ||
254 | "wakeup1", | ||
255 | "wakeup2", | ||
256 | "wakeup3", | ||
257 | "susgpio0", | ||
258 | "susgpio1", | ||
259 | "sd0_cd", | ||
260 | "vdout0", | ||
261 | "vdout1", | ||
262 | "vdout2", | ||
263 | "vdout3", | ||
264 | "vdout4", | ||
265 | "vdout5", | ||
266 | "vdout6", | ||
267 | "vdout7", | ||
268 | "vdout8", | ||
269 | "vdout9", | ||
270 | "vdout10", | ||
271 | "vdout11", | ||
272 | "vdout12", | ||
273 | "vdout13", | ||
274 | "vdout14", | ||
275 | "vdout15", | ||
276 | "vdout16", | ||
277 | "vdout17", | ||
278 | "vdout18", | ||
279 | "vdout19", | ||
280 | "vdout20", | ||
281 | "vdout21", | ||
282 | "vdout22", | ||
283 | "vdout23", | ||
284 | "vdin0", | ||
285 | "vdin1", | ||
286 | "vdin2", | ||
287 | "vdin3", | ||
288 | "vdin4", | ||
289 | "vdin5", | ||
290 | "vdin6", | ||
291 | "vdin7", | ||
292 | "spi0_mosi", | ||
293 | "spi0_miso", | ||
294 | "spi0_ss", | ||
295 | "spi0_clk", | ||
296 | "spi0_ssb", | ||
297 | "sd0_clk", | ||
298 | "sd0_cmd", | ||
299 | "sd0_wp", | ||
300 | "sd0_data0", | ||
301 | "sd0_data1", | ||
302 | "sd0_data2", | ||
303 | "sd0_data3", | ||
304 | "sd1_data0", | ||
305 | "sd1_data1", | ||
306 | "sd1_data2", | ||
307 | "sd1_data3", | ||
308 | "sd1_data4", | ||
309 | "sd1_data5", | ||
310 | "sd1_data6", | ||
311 | "sd1_data7", | ||
312 | "i2c0_scl", | ||
313 | "i2c0_sda", | ||
314 | "i2c1_scl", | ||
315 | "i2c1_sda", | ||
316 | "i2c2_scl", | ||
317 | "i2c2_sda", | ||
318 | "uart0_rts", | ||
319 | "uart0_txd", | ||
320 | "uart0_cts", | ||
321 | "uart0_rxd", | ||
322 | "uart1_rts", | ||
323 | "uart1_txd", | ||
324 | "uart1_cts", | ||
325 | "uart1_rxd", | ||
326 | "uart2_rts", | ||
327 | "uart2_txd", | ||
328 | "uart2_cts", | ||
329 | "uart2_rxd", | ||
330 | "sd2_wp", | ||
331 | "sd2_cmd", | ||
332 | "sd2_clk", | ||
333 | "sd2_pwr", | ||
334 | "sd1_clk", | ||
335 | "sd1_cmd", | ||
336 | "sd1_pwr", | ||
337 | "sd1_wp", | ||
338 | "sd1_cd", | ||
339 | "pwmout1", | ||
340 | "pwmout0", | ||
341 | }; | ||
342 | |||
343 | static int wm8850_pinctrl_probe(struct platform_device *pdev) | ||
344 | { | ||
345 | struct wmt_pinctrl_data *data; | ||
346 | |||
347 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
348 | if (!data) { | ||
349 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
350 | return -ENOMEM; | ||
351 | } | ||
352 | |||
353 | data->banks = wm8850_banks; | ||
354 | data->nbanks = ARRAY_SIZE(wm8850_banks); | ||
355 | data->pins = wm8850_pins; | ||
356 | data->npins = ARRAY_SIZE(wm8850_pins); | ||
357 | data->groups = wm8850_groups; | ||
358 | data->ngroups = ARRAY_SIZE(wm8850_groups); | ||
359 | |||
360 | return wmt_pinctrl_probe(pdev, data); | ||
361 | } | ||
362 | |||
363 | static int wm8850_pinctrl_remove(struct platform_device *pdev) | ||
364 | { | ||
365 | return wmt_pinctrl_remove(pdev); | ||
366 | } | ||
367 | |||
368 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
369 | { .compatible = "wm,wm8850-pinctrl" }, | ||
370 | { /* sentinel */ }, | ||
371 | }; | ||
372 | |||
373 | static struct platform_driver wmt_pinctrl_driver = { | ||
374 | .probe = wm8850_pinctrl_probe, | ||
375 | .remove = wm8850_pinctrl_remove, | ||
376 | .driver = { | ||
377 | .name = "pinctrl-wm8850", | ||
378 | .owner = THIS_MODULE, | ||
379 | .of_match_table = wmt_pinctrl_of_match, | ||
380 | }, | ||
381 | }; | ||
382 | |||
383 | module_platform_driver(wmt_pinctrl_driver); | ||
384 | |||
385 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
386 | MODULE_DESCRIPTION("Wondermedia WM8850 Pincontrol driver"); | ||
387 | MODULE_LICENSE("GPL v2"); | ||
388 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c new file mode 100644 index 000000000000..ab63104e8dc9 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c | |||
@@ -0,0 +1,632 @@ | |||
1 | /* | ||
2 | * Pinctrl driver for the Wondermedia SoC's | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/err.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/pinctrl/consumer.h> | ||
25 | #include <linux/pinctrl/machine.h> | ||
26 | #include <linux/pinctrl/pinconf.h> | ||
27 | #include <linux/pinctrl/pinconf-generic.h> | ||
28 | #include <linux/pinctrl/pinctrl.h> | ||
29 | #include <linux/pinctrl/pinmux.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/slab.h> | ||
32 | |||
33 | #include "pinctrl-wmt.h" | ||
34 | |||
35 | static inline void wmt_setbits(struct wmt_pinctrl_data *data, u32 reg, | ||
36 | u32 mask) | ||
37 | { | ||
38 | u32 val; | ||
39 | |||
40 | val = readl_relaxed(data->base + reg); | ||
41 | val |= mask; | ||
42 | writel_relaxed(val, data->base + reg); | ||
43 | } | ||
44 | |||
45 | static inline void wmt_clearbits(struct wmt_pinctrl_data *data, u32 reg, | ||
46 | u32 mask) | ||
47 | { | ||
48 | u32 val; | ||
49 | |||
50 | val = readl_relaxed(data->base + reg); | ||
51 | val &= ~mask; | ||
52 | writel_relaxed(val, data->base + reg); | ||
53 | } | ||
54 | |||
55 | enum wmt_func_sel { | ||
56 | WMT_FSEL_GPIO_IN = 0, | ||
57 | WMT_FSEL_GPIO_OUT = 1, | ||
58 | WMT_FSEL_ALT = 2, | ||
59 | WMT_FSEL_COUNT = 3, | ||
60 | }; | ||
61 | |||
62 | static const char * const wmt_functions[WMT_FSEL_COUNT] = { | ||
63 | [WMT_FSEL_GPIO_IN] = "gpio_in", | ||
64 | [WMT_FSEL_GPIO_OUT] = "gpio_out", | ||
65 | [WMT_FSEL_ALT] = "alt", | ||
66 | }; | ||
67 | |||
68 | static int wmt_pmx_get_functions_count(struct pinctrl_dev *pctldev) | ||
69 | { | ||
70 | return WMT_FSEL_COUNT; | ||
71 | } | ||
72 | |||
73 | static const char *wmt_pmx_get_function_name(struct pinctrl_dev *pctldev, | ||
74 | unsigned selector) | ||
75 | { | ||
76 | return wmt_functions[selector]; | ||
77 | } | ||
78 | |||
79 | static int wmt_pmx_get_function_groups(struct pinctrl_dev *pctldev, | ||
80 | unsigned selector, | ||
81 | const char * const **groups, | ||
82 | unsigned * const num_groups) | ||
83 | { | ||
84 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
85 | |||
86 | /* every pin does every function */ | ||
87 | *groups = data->groups; | ||
88 | *num_groups = data->ngroups; | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static int wmt_set_pinmux(struct wmt_pinctrl_data *data, unsigned func, | ||
94 | unsigned pin) | ||
95 | { | ||
96 | u32 bank = WMT_BANK_FROM_PIN(pin); | ||
97 | u32 bit = WMT_BIT_FROM_PIN(pin); | ||
98 | u32 reg_en = data->banks[bank].reg_en; | ||
99 | u32 reg_dir = data->banks[bank].reg_dir; | ||
100 | |||
101 | if (reg_dir == NO_REG) { | ||
102 | dev_err(data->dev, "pin:%d no direction register defined\n", | ||
103 | pin); | ||
104 | return -EINVAL; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * If reg_en == NO_REG, we assume it is a dedicated GPIO and cannot be | ||
109 | * disabled (as on VT8500) and that no alternate function is available. | ||
110 | */ | ||
111 | switch (func) { | ||
112 | case WMT_FSEL_GPIO_IN: | ||
113 | if (reg_en != NO_REG) | ||
114 | wmt_setbits(data, reg_en, BIT(bit)); | ||
115 | wmt_clearbits(data, reg_dir, BIT(bit)); | ||
116 | break; | ||
117 | case WMT_FSEL_GPIO_OUT: | ||
118 | if (reg_en != NO_REG) | ||
119 | wmt_setbits(data, reg_en, BIT(bit)); | ||
120 | wmt_setbits(data, reg_dir, BIT(bit)); | ||
121 | break; | ||
122 | case WMT_FSEL_ALT: | ||
123 | if (reg_en == NO_REG) { | ||
124 | dev_err(data->dev, "pin:%d no alt function available\n", | ||
125 | pin); | ||
126 | return -EINVAL; | ||
127 | } | ||
128 | wmt_clearbits(data, reg_en, BIT(bit)); | ||
129 | } | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static int wmt_pmx_enable(struct pinctrl_dev *pctldev, | ||
135 | unsigned func_selector, | ||
136 | unsigned group_selector) | ||
137 | { | ||
138 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
139 | u32 pinnum = data->pins[group_selector].number; | ||
140 | |||
141 | return wmt_set_pinmux(data, func_selector, pinnum); | ||
142 | } | ||
143 | |||
144 | static void wmt_pmx_disable(struct pinctrl_dev *pctldev, | ||
145 | unsigned func_selector, | ||
146 | unsigned group_selector) | ||
147 | { | ||
148 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
149 | u32 pinnum = data->pins[group_selector].number; | ||
150 | |||
151 | /* disable by setting GPIO_IN */ | ||
152 | wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, pinnum); | ||
153 | } | ||
154 | |||
155 | static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, | ||
156 | struct pinctrl_gpio_range *range, | ||
157 | unsigned offset) | ||
158 | { | ||
159 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
160 | |||
161 | /* disable by setting GPIO_IN */ | ||
162 | wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, offset); | ||
163 | } | ||
164 | |||
165 | static int wmt_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, | ||
166 | struct pinctrl_gpio_range *range, | ||
167 | unsigned offset, | ||
168 | bool input) | ||
169 | { | ||
170 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
171 | |||
172 | wmt_set_pinmux(data, (input ? WMT_FSEL_GPIO_IN : WMT_FSEL_GPIO_OUT), | ||
173 | offset); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static struct pinmux_ops wmt_pinmux_ops = { | ||
179 | .get_functions_count = wmt_pmx_get_functions_count, | ||
180 | .get_function_name = wmt_pmx_get_function_name, | ||
181 | .get_function_groups = wmt_pmx_get_function_groups, | ||
182 | .enable = wmt_pmx_enable, | ||
183 | .disable = wmt_pmx_disable, | ||
184 | .gpio_disable_free = wmt_pmx_gpio_disable_free, | ||
185 | .gpio_set_direction = wmt_pmx_gpio_set_direction, | ||
186 | }; | ||
187 | |||
188 | static int wmt_get_groups_count(struct pinctrl_dev *pctldev) | ||
189 | { | ||
190 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
191 | |||
192 | return data->ngroups; | ||
193 | } | ||
194 | |||
195 | static const char *wmt_get_group_name(struct pinctrl_dev *pctldev, | ||
196 | unsigned selector) | ||
197 | { | ||
198 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
199 | |||
200 | return data->groups[selector]; | ||
201 | } | ||
202 | |||
203 | static int wmt_get_group_pins(struct pinctrl_dev *pctldev, | ||
204 | unsigned selector, | ||
205 | const unsigned **pins, | ||
206 | unsigned *num_pins) | ||
207 | { | ||
208 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
209 | |||
210 | *pins = &data->pins[selector].number; | ||
211 | *num_pins = 1; | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static int wmt_pctl_find_group_by_pin(struct wmt_pinctrl_data *data, u32 pin) | ||
217 | { | ||
218 | int i; | ||
219 | |||
220 | for (i = 0; i < data->npins; i++) { | ||
221 | if (data->pins[i].number == pin) | ||
222 | return i; | ||
223 | } | ||
224 | |||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
228 | static int wmt_pctl_dt_node_to_map_func(struct wmt_pinctrl_data *data, | ||
229 | struct device_node *np, | ||
230 | u32 pin, u32 fnum, | ||
231 | struct pinctrl_map **maps) | ||
232 | { | ||
233 | int group; | ||
234 | struct pinctrl_map *map = *maps; | ||
235 | |||
236 | if (fnum >= ARRAY_SIZE(wmt_functions)) { | ||
237 | dev_err(data->dev, "invalid wm,function %d\n", fnum); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | |||
241 | group = wmt_pctl_find_group_by_pin(data, pin); | ||
242 | if (group < 0) { | ||
243 | dev_err(data->dev, "unable to match pin %d to group\n", pin); | ||
244 | return group; | ||
245 | } | ||
246 | |||
247 | map->type = PIN_MAP_TYPE_MUX_GROUP; | ||
248 | map->data.mux.group = data->groups[group]; | ||
249 | map->data.mux.function = wmt_functions[fnum]; | ||
250 | (*maps)++; | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, | ||
256 | struct device_node *np, | ||
257 | u32 pin, u32 pull, | ||
258 | struct pinctrl_map **maps) | ||
259 | { | ||
260 | int group; | ||
261 | unsigned long *configs; | ||
262 | struct pinctrl_map *map = *maps; | ||
263 | |||
264 | if (pull > 2) { | ||
265 | dev_err(data->dev, "invalid wm,pull %d\n", pull); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | group = wmt_pctl_find_group_by_pin(data, pin); | ||
270 | if (group < 0) { | ||
271 | dev_err(data->dev, "unable to match pin %d to group\n", pin); | ||
272 | return group; | ||
273 | } | ||
274 | |||
275 | configs = kzalloc(sizeof(*configs), GFP_KERNEL); | ||
276 | if (!configs) | ||
277 | return -ENOMEM; | ||
278 | |||
279 | configs[0] = pull; | ||
280 | |||
281 | map->type = PIN_MAP_TYPE_CONFIGS_PIN; | ||
282 | map->data.configs.group_or_pin = data->groups[group]; | ||
283 | map->data.configs.configs = configs; | ||
284 | map->data.configs.num_configs = 1; | ||
285 | (*maps)++; | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static void wmt_pctl_dt_free_map(struct pinctrl_dev *pctldev, | ||
291 | struct pinctrl_map *maps, | ||
292 | unsigned num_maps) | ||
293 | { | ||
294 | int i; | ||
295 | |||
296 | for (i = 0; i < num_maps; i++) | ||
297 | if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) | ||
298 | kfree(maps[i].data.configs.configs); | ||
299 | |||
300 | kfree(maps); | ||
301 | } | ||
302 | |||
303 | static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | ||
304 | struct device_node *np, | ||
305 | struct pinctrl_map **map, | ||
306 | unsigned *num_maps) | ||
307 | { | ||
308 | struct pinctrl_map *maps, *cur_map; | ||
309 | struct property *pins, *funcs, *pulls; | ||
310 | u32 pin, func, pull; | ||
311 | int num_pins, num_funcs, num_pulls, maps_per_pin; | ||
312 | int i, err; | ||
313 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
314 | |||
315 | pins = of_find_property(np, "wm,pins", NULL); | ||
316 | if (!pins) { | ||
317 | dev_err(data->dev, "missing wmt,pins property\n"); | ||
318 | return -EINVAL; | ||
319 | } | ||
320 | |||
321 | funcs = of_find_property(np, "wm,function", NULL); | ||
322 | pulls = of_find_property(np, "wm,pull", NULL); | ||
323 | |||
324 | if (!funcs && !pulls) { | ||
325 | dev_err(data->dev, "neither wm,function nor wm,pull specified\n"); | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | |||
329 | /* | ||
330 | * The following lines calculate how many values are defined for each | ||
331 | * of the properties. | ||
332 | */ | ||
333 | num_pins = pins->length / sizeof(u32); | ||
334 | num_funcs = funcs ? (funcs->length / sizeof(u32)) : 0; | ||
335 | num_pulls = pulls ? (pulls->length / sizeof(u32)) : 0; | ||
336 | |||
337 | if (num_funcs > 1 && num_funcs != num_pins) { | ||
338 | dev_err(data->dev, "wm,function must have 1 or %d entries\n", | ||
339 | num_pins); | ||
340 | return -EINVAL; | ||
341 | } | ||
342 | |||
343 | if (num_pulls > 1 && num_pulls != num_pins) { | ||
344 | dev_err(data->dev, "wm,pull must have 1 or %d entries\n", | ||
345 | num_pins); | ||
346 | return -EINVAL; | ||
347 | } | ||
348 | |||
349 | maps_per_pin = 0; | ||
350 | if (num_funcs) | ||
351 | maps_per_pin++; | ||
352 | if (num_pulls) | ||
353 | maps_per_pin++; | ||
354 | |||
355 | cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), | ||
356 | GFP_KERNEL); | ||
357 | if (!maps) | ||
358 | return -ENOMEM; | ||
359 | |||
360 | for (i = 0; i < num_pins; i++) { | ||
361 | err = of_property_read_u32_index(np, "wm,pins", i, &pin); | ||
362 | if (err) | ||
363 | goto fail; | ||
364 | |||
365 | if (pin >= (data->nbanks * 32)) { | ||
366 | dev_err(data->dev, "invalid wm,pins value\n"); | ||
367 | err = -EINVAL; | ||
368 | goto fail; | ||
369 | } | ||
370 | |||
371 | if (num_funcs) { | ||
372 | err = of_property_read_u32_index(np, "wm,function", | ||
373 | (num_funcs > 1 ? i : 0), &func); | ||
374 | if (err) | ||
375 | goto fail; | ||
376 | |||
377 | err = wmt_pctl_dt_node_to_map_func(data, np, pin, func, | ||
378 | &cur_map); | ||
379 | if (err) | ||
380 | goto fail; | ||
381 | } | ||
382 | |||
383 | if (num_pulls) { | ||
384 | err = of_property_read_u32_index(np, "wm,pull", | ||
385 | (num_pulls > 1 ? i : 0), &pull); | ||
386 | if (err) | ||
387 | goto fail; | ||
388 | |||
389 | err = wmt_pctl_dt_node_to_map_pull(data, np, pin, pull, | ||
390 | &cur_map); | ||
391 | if (err) | ||
392 | goto fail; | ||
393 | } | ||
394 | } | ||
395 | *map = maps; | ||
396 | *num_maps = num_pins * maps_per_pin; | ||
397 | return 0; | ||
398 | |||
399 | /* | ||
400 | * The fail path removes any maps that have been allocated. The fail path is | ||
401 | * only called from code after maps has been kzalloc'd. It is also safe to | ||
402 | * pass 'num_pins * maps_per_pin' as the map count even though we probably | ||
403 | * failed before all the mappings were read as all maps are allocated at once, | ||
404 | * and configs are only allocated for .type = PIN_MAP_TYPE_CONFIGS_PIN - there | ||
405 | * is no failpath where a config can be allocated without .type being set. | ||
406 | */ | ||
407 | fail: | ||
408 | wmt_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin); | ||
409 | return err; | ||
410 | } | ||
411 | |||
412 | static struct pinctrl_ops wmt_pctl_ops = { | ||
413 | .get_groups_count = wmt_get_groups_count, | ||
414 | .get_group_name = wmt_get_group_name, | ||
415 | .get_group_pins = wmt_get_group_pins, | ||
416 | .dt_node_to_map = wmt_pctl_dt_node_to_map, | ||
417 | .dt_free_map = wmt_pctl_dt_free_map, | ||
418 | }; | ||
419 | |||
420 | static int wmt_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, | ||
421 | unsigned long *config) | ||
422 | { | ||
423 | return -ENOTSUPP; | ||
424 | } | ||
425 | |||
426 | static int wmt_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin, | ||
427 | unsigned long config) | ||
428 | { | ||
429 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
430 | enum pin_config_param param = pinconf_to_config_param(config); | ||
431 | u16 arg = pinconf_to_config_argument(config); | ||
432 | u32 bank = WMT_BANK_FROM_PIN(pin); | ||
433 | u32 bit = WMT_BIT_FROM_PIN(pin); | ||
434 | u32 reg_pull_en = data->banks[bank].reg_pull_en; | ||
435 | u32 reg_pull_cfg = data->banks[bank].reg_pull_cfg; | ||
436 | |||
437 | if ((reg_pull_en == NO_REG) || (reg_pull_cfg == NO_REG)) { | ||
438 | dev_err(data->dev, "bias functions not supported on pin %d\n", | ||
439 | pin); | ||
440 | return -EINVAL; | ||
441 | } | ||
442 | |||
443 | if ((param == PIN_CONFIG_BIAS_PULL_DOWN) || | ||
444 | (param == PIN_CONFIG_BIAS_PULL_UP)) { | ||
445 | if (arg == 0) | ||
446 | param = PIN_CONFIG_BIAS_DISABLE; | ||
447 | } | ||
448 | |||
449 | switch (param) { | ||
450 | case PIN_CONFIG_BIAS_DISABLE: | ||
451 | wmt_clearbits(data, reg_pull_en, BIT(bit)); | ||
452 | break; | ||
453 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
454 | wmt_clearbits(data, reg_pull_cfg, BIT(bit)); | ||
455 | wmt_setbits(data, reg_pull_en, BIT(bit)); | ||
456 | break; | ||
457 | case PIN_CONFIG_BIAS_PULL_UP: | ||
458 | wmt_setbits(data, reg_pull_cfg, BIT(bit)); | ||
459 | wmt_setbits(data, reg_pull_en, BIT(bit)); | ||
460 | break; | ||
461 | default: | ||
462 | dev_err(data->dev, "unknown pinconf param\n"); | ||
463 | return -EINVAL; | ||
464 | } | ||
465 | |||
466 | return 0; | ||
467 | } | ||
468 | |||
469 | static struct pinconf_ops wmt_pinconf_ops = { | ||
470 | .pin_config_get = wmt_pinconf_get, | ||
471 | .pin_config_set = wmt_pinconf_set, | ||
472 | }; | ||
473 | |||
474 | static struct pinctrl_desc wmt_desc = { | ||
475 | .owner = THIS_MODULE, | ||
476 | .name = "pinctrl-wmt", | ||
477 | .pctlops = &wmt_pctl_ops, | ||
478 | .pmxops = &wmt_pinmux_ops, | ||
479 | .confops = &wmt_pinconf_ops, | ||
480 | }; | ||
481 | |||
482 | static int wmt_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
483 | { | ||
484 | return pinctrl_request_gpio(chip->base + offset); | ||
485 | } | ||
486 | |||
487 | static void wmt_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
488 | { | ||
489 | pinctrl_free_gpio(chip->base + offset); | ||
490 | } | ||
491 | |||
492 | static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset) | ||
493 | { | ||
494 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
495 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
496 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
497 | u32 reg_dir = data->banks[bank].reg_dir; | ||
498 | u32 val; | ||
499 | |||
500 | val = readl_relaxed(data->base + reg_dir); | ||
501 | if (val & BIT(bit)) | ||
502 | return GPIOF_DIR_OUT; | ||
503 | else | ||
504 | return GPIOF_DIR_IN; | ||
505 | } | ||
506 | |||
507 | static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
508 | { | ||
509 | return pinctrl_gpio_direction_input(chip->base + offset); | ||
510 | } | ||
511 | |||
512 | static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | ||
513 | int value) | ||
514 | { | ||
515 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
516 | } | ||
517 | |||
518 | static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset) | ||
519 | { | ||
520 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
521 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
522 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
523 | u32 reg_data_in = data->banks[bank].reg_data_in; | ||
524 | |||
525 | if (reg_data_in == NO_REG) { | ||
526 | dev_err(data->dev, "no data in register defined\n"); | ||
527 | return -EINVAL; | ||
528 | } | ||
529 | |||
530 | return !!(readl_relaxed(data->base + reg_data_in) & BIT(bit)); | ||
531 | } | ||
532 | |||
533 | static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset, | ||
534 | int val) | ||
535 | { | ||
536 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
537 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
538 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
539 | u32 reg_data_out = data->banks[bank].reg_data_out; | ||
540 | |||
541 | if (reg_data_out == NO_REG) { | ||
542 | dev_err(data->dev, "no data out register defined\n"); | ||
543 | return; | ||
544 | } | ||
545 | |||
546 | if (val) | ||
547 | wmt_setbits(data, reg_data_out, BIT(bit)); | ||
548 | else | ||
549 | wmt_clearbits(data, reg_data_out, BIT(bit)); | ||
550 | } | ||
551 | |||
552 | static struct gpio_chip wmt_gpio_chip = { | ||
553 | .label = "gpio-wmt", | ||
554 | .owner = THIS_MODULE, | ||
555 | .request = wmt_gpio_request, | ||
556 | .free = wmt_gpio_free, | ||
557 | .get_direction = wmt_gpio_get_direction, | ||
558 | .direction_input = wmt_gpio_direction_input, | ||
559 | .direction_output = wmt_gpio_direction_output, | ||
560 | .get = wmt_gpio_get_value, | ||
561 | .set = wmt_gpio_set_value, | ||
562 | .can_sleep = 0, | ||
563 | }; | ||
564 | |||
565 | int wmt_pinctrl_probe(struct platform_device *pdev, | ||
566 | struct wmt_pinctrl_data *data) | ||
567 | { | ||
568 | int err; | ||
569 | struct resource *res; | ||
570 | |||
571 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
572 | data->base = devm_request_and_ioremap(&pdev->dev, res); | ||
573 | if (!data->base) { | ||
574 | dev_err(&pdev->dev, "failed to map memory resource\n"); | ||
575 | return -EBUSY; | ||
576 | } | ||
577 | |||
578 | wmt_desc.pins = data->pins; | ||
579 | wmt_desc.npins = data->npins; | ||
580 | |||
581 | data->gpio_chip = wmt_gpio_chip; | ||
582 | data->gpio_chip.dev = &pdev->dev; | ||
583 | data->gpio_chip.of_node = pdev->dev.of_node; | ||
584 | data->gpio_chip.ngpio = data->nbanks * 32; | ||
585 | |||
586 | platform_set_drvdata(pdev, data); | ||
587 | |||
588 | data->dev = &pdev->dev; | ||
589 | |||
590 | data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data); | ||
591 | if (!data->pctl_dev) { | ||
592 | dev_err(&pdev->dev, "Failed to register pinctrl\n"); | ||
593 | return -EINVAL; | ||
594 | } | ||
595 | |||
596 | err = gpiochip_add(&data->gpio_chip); | ||
597 | if (err) { | ||
598 | dev_err(&pdev->dev, "could not add GPIO chip\n"); | ||
599 | goto fail_gpio; | ||
600 | } | ||
601 | |||
602 | err = gpiochip_add_pin_range(&data->gpio_chip, dev_name(data->dev), | ||
603 | 0, 0, data->nbanks * 32); | ||
604 | if (err) | ||
605 | goto fail_range; | ||
606 | |||
607 | dev_info(&pdev->dev, "Pin controller initialized\n"); | ||
608 | |||
609 | return 0; | ||
610 | |||
611 | fail_range: | ||
612 | err = gpiochip_remove(&data->gpio_chip); | ||
613 | if (err) | ||
614 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
615 | fail_gpio: | ||
616 | pinctrl_unregister(data->pctl_dev); | ||
617 | return err; | ||
618 | } | ||
619 | |||
620 | int wmt_pinctrl_remove(struct platform_device *pdev) | ||
621 | { | ||
622 | struct wmt_pinctrl_data *data = platform_get_drvdata(pdev); | ||
623 | int err; | ||
624 | |||
625 | err = gpiochip_remove(&data->gpio_chip); | ||
626 | if (err) | ||
627 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
628 | |||
629 | pinctrl_unregister(data->pctl_dev); | ||
630 | |||
631 | return 0; | ||
632 | } | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.h b/drivers/pinctrl/vt8500/pinctrl-wmt.h new file mode 100644 index 000000000000..41f5f2deb5d6 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Pinctrl driver for the Wondermedia SoC's | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/gpio.h> | ||
17 | |||
18 | /* VT8500 has no enable register in the extgpio bank. */ | ||
19 | #define NO_REG 0xFFFF | ||
20 | |||
21 | #define WMT_PINCTRL_BANK(__en, __dir, __dout, __din, __pen, __pcfg) \ | ||
22 | { \ | ||
23 | .reg_en = __en, \ | ||
24 | .reg_dir = __dir, \ | ||
25 | .reg_data_out = __dout, \ | ||
26 | .reg_data_in = __din, \ | ||
27 | .reg_pull_en = __pen, \ | ||
28 | .reg_pull_cfg = __pcfg, \ | ||
29 | } | ||
30 | |||
31 | /* Encode/decode the bank/bit pairs into a pin value */ | ||
32 | #define WMT_PIN(__bank, __offset) ((__bank << 5) | __offset) | ||
33 | #define WMT_BANK_FROM_PIN(__pin) (__pin >> 5) | ||
34 | #define WMT_BIT_FROM_PIN(__pin) (__pin & 0x1f) | ||
35 | |||
36 | #define WMT_GROUP(__name, __data) \ | ||
37 | { \ | ||
38 | .name = __name, \ | ||
39 | .pins = __data, \ | ||
40 | .npins = ARRAY_SIZE(__data), \ | ||
41 | } | ||
42 | |||
43 | struct wmt_pinctrl_bank_registers { | ||
44 | u32 reg_en; | ||
45 | u32 reg_dir; | ||
46 | u32 reg_data_out; | ||
47 | u32 reg_data_in; | ||
48 | |||
49 | u32 reg_pull_en; | ||
50 | u32 reg_pull_cfg; | ||
51 | }; | ||
52 | |||
53 | struct wmt_pinctrl_group { | ||
54 | const char *name; | ||
55 | const unsigned int *pins; | ||
56 | const unsigned npins; | ||
57 | }; | ||
58 | |||
59 | struct wmt_pinctrl_data { | ||
60 | struct device *dev; | ||
61 | struct pinctrl_dev *pctl_dev; | ||
62 | |||
63 | /* must be initialized before calling wmt_pinctrl_probe */ | ||
64 | void __iomem *base; | ||
65 | const struct wmt_pinctrl_bank_registers *banks; | ||
66 | const struct pinctrl_pin_desc *pins; | ||
67 | const char * const *groups; | ||
68 | |||
69 | u32 nbanks; | ||
70 | u32 npins; | ||
71 | u32 ngroups; | ||
72 | |||
73 | struct gpio_chip gpio_chip; | ||
74 | struct pinctrl_gpio_range gpio_range; | ||
75 | }; | ||
76 | |||
77 | int wmt_pinctrl_probe(struct platform_device *pdev, | ||
78 | struct wmt_pinctrl_data *data); | ||
79 | int wmt_pinctrl_remove(struct platform_device *pdev); | ||
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig new file mode 100644 index 000000000000..c9d04f797862 --- /dev/null +++ b/drivers/reset/Kconfig | |||
@@ -0,0 +1,13 @@ | |||
1 | config ARCH_HAS_RESET_CONTROLLER | ||
2 | bool | ||
3 | |||
4 | menuconfig RESET_CONTROLLER | ||
5 | bool "Reset Controller Support" | ||
6 | default y if ARCH_HAS_RESET_CONTROLLER | ||
7 | help | ||
8 | Generic Reset Controller support. | ||
9 | |||
10 | This framework is designed to abstract reset handling of devices | ||
11 | via GPIOs or SoC-internal reset controller modules. | ||
12 | |||
13 | If unsure, say no. | ||
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile new file mode 100644 index 000000000000..1e2d83f2b995 --- /dev/null +++ b/drivers/reset/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_RESET_CONTROLLER) += core.o | |||
diff --git a/drivers/reset/core.c b/drivers/reset/core.c new file mode 100644 index 000000000000..d1b6089a0ef8 --- /dev/null +++ b/drivers/reset/core.c | |||
@@ -0,0 +1,297 @@ | |||
1 | /* | ||
2 | * Reset Controller framework | ||
3 | * | ||
4 | * Copyright 2013 Philipp Zabel, Pengutronix | ||
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 | #include <linux/device.h> | ||
12 | #include <linux/err.h> | ||
13 | #include <linux/export.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/reset.h> | ||
18 | #include <linux/reset-controller.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | static DEFINE_MUTEX(reset_controller_list_mutex); | ||
22 | static LIST_HEAD(reset_controller_list); | ||
23 | |||
24 | /** | ||
25 | * struct reset_control - a reset control | ||
26 | * @rcdev: a pointer to the reset controller device | ||
27 | * this reset control belongs to | ||
28 | * @id: ID of the reset controller in the reset | ||
29 | * controller device | ||
30 | */ | ||
31 | struct reset_control { | ||
32 | struct reset_controller_dev *rcdev; | ||
33 | struct device *dev; | ||
34 | unsigned int id; | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * of_reset_simple_xlate - translate reset_spec to the reset line number | ||
39 | * @rcdev: a pointer to the reset controller device | ||
40 | * @reset_spec: reset line specifier as found in the device tree | ||
41 | * @flags: a flags pointer to fill in (optional) | ||
42 | * | ||
43 | * This simple translation function should be used for reset controllers | ||
44 | * with 1:1 mapping, where reset lines can be indexed by number without gaps. | ||
45 | */ | ||
46 | int of_reset_simple_xlate(struct reset_controller_dev *rcdev, | ||
47 | const struct of_phandle_args *reset_spec) | ||
48 | { | ||
49 | if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) | ||
50 | return -EINVAL; | ||
51 | |||
52 | if (reset_spec->args[0] >= rcdev->nr_resets) | ||
53 | return -EINVAL; | ||
54 | |||
55 | return reset_spec->args[0]; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(of_reset_simple_xlate); | ||
58 | |||
59 | /** | ||
60 | * reset_controller_register - register a reset controller device | ||
61 | * @rcdev: a pointer to the initialized reset controller device | ||
62 | */ | ||
63 | int reset_controller_register(struct reset_controller_dev *rcdev) | ||
64 | { | ||
65 | if (!rcdev->of_xlate) { | ||
66 | rcdev->of_reset_n_cells = 1; | ||
67 | rcdev->of_xlate = of_reset_simple_xlate; | ||
68 | } | ||
69 | |||
70 | mutex_lock(&reset_controller_list_mutex); | ||
71 | list_add(&rcdev->list, &reset_controller_list); | ||
72 | mutex_unlock(&reset_controller_list_mutex); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | EXPORT_SYMBOL_GPL(reset_controller_register); | ||
77 | |||
78 | /** | ||
79 | * reset_controller_unregister - unregister a reset controller device | ||
80 | * @rcdev: a pointer to the reset controller device | ||
81 | */ | ||
82 | void reset_controller_unregister(struct reset_controller_dev *rcdev) | ||
83 | { | ||
84 | mutex_lock(&reset_controller_list_mutex); | ||
85 | list_del(&rcdev->list); | ||
86 | mutex_unlock(&reset_controller_list_mutex); | ||
87 | } | ||
88 | EXPORT_SYMBOL_GPL(reset_controller_unregister); | ||
89 | |||
90 | /** | ||
91 | * reset_control_reset - reset the controlled device | ||
92 | * @rstc: reset controller | ||
93 | */ | ||
94 | int reset_control_reset(struct reset_control *rstc) | ||
95 | { | ||
96 | if (rstc->rcdev->ops->reset) | ||
97 | return rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); | ||
98 | |||
99 | return -ENOSYS; | ||
100 | } | ||
101 | EXPORT_SYMBOL_GPL(reset_control_reset); | ||
102 | |||
103 | /** | ||
104 | * reset_control_assert - asserts the reset line | ||
105 | * @rstc: reset controller | ||
106 | */ | ||
107 | int reset_control_assert(struct reset_control *rstc) | ||
108 | { | ||
109 | if (rstc->rcdev->ops->assert) | ||
110 | return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); | ||
111 | |||
112 | return -ENOSYS; | ||
113 | } | ||
114 | EXPORT_SYMBOL_GPL(reset_control_assert); | ||
115 | |||
116 | /** | ||
117 | * reset_control_deassert - deasserts the reset line | ||
118 | * @rstc: reset controller | ||
119 | */ | ||
120 | int reset_control_deassert(struct reset_control *rstc) | ||
121 | { | ||
122 | if (rstc->rcdev->ops->deassert) | ||
123 | return rstc->rcdev->ops->deassert(rstc->rcdev, rstc->id); | ||
124 | |||
125 | return -ENOSYS; | ||
126 | } | ||
127 | EXPORT_SYMBOL_GPL(reset_control_deassert); | ||
128 | |||
129 | /** | ||
130 | * reset_control_get - Lookup and obtain a reference to a reset controller. | ||
131 | * @dev: device to be reset by the controller | ||
132 | * @id: reset line name | ||
133 | * | ||
134 | * Returns a struct reset_control or IS_ERR() condition containing errno. | ||
135 | * | ||
136 | * Use of id names is optional. | ||
137 | */ | ||
138 | struct reset_control *reset_control_get(struct device *dev, const char *id) | ||
139 | { | ||
140 | struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER); | ||
141 | struct reset_controller_dev *r, *rcdev; | ||
142 | struct of_phandle_args args; | ||
143 | int index = 0; | ||
144 | int rstc_id; | ||
145 | int ret; | ||
146 | |||
147 | if (!dev) | ||
148 | return ERR_PTR(-EINVAL); | ||
149 | |||
150 | if (id) | ||
151 | index = of_property_match_string(dev->of_node, | ||
152 | "reset-names", id); | ||
153 | ret = of_parse_phandle_with_args(dev->of_node, "resets", "#reset-cells", | ||
154 | index, &args); | ||
155 | if (ret) | ||
156 | return ERR_PTR(ret); | ||
157 | |||
158 | mutex_lock(&reset_controller_list_mutex); | ||
159 | rcdev = NULL; | ||
160 | list_for_each_entry(r, &reset_controller_list, list) { | ||
161 | if (args.np == r->of_node) { | ||
162 | rcdev = r; | ||
163 | break; | ||
164 | } | ||
165 | } | ||
166 | of_node_put(args.np); | ||
167 | |||
168 | if (!rcdev) { | ||
169 | mutex_unlock(&reset_controller_list_mutex); | ||
170 | return ERR_PTR(-ENODEV); | ||
171 | } | ||
172 | |||
173 | rstc_id = rcdev->of_xlate(rcdev, &args); | ||
174 | if (rstc_id < 0) { | ||
175 | mutex_unlock(&reset_controller_list_mutex); | ||
176 | return ERR_PTR(rstc_id); | ||
177 | } | ||
178 | |||
179 | try_module_get(rcdev->owner); | ||
180 | mutex_unlock(&reset_controller_list_mutex); | ||
181 | |||
182 | rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); | ||
183 | if (!rstc) { | ||
184 | module_put(rcdev->owner); | ||
185 | return ERR_PTR(-ENOMEM); | ||
186 | } | ||
187 | |||
188 | rstc->dev = dev; | ||
189 | rstc->rcdev = rcdev; | ||
190 | rstc->id = rstc_id; | ||
191 | |||
192 | return rstc; | ||
193 | } | ||
194 | EXPORT_SYMBOL_GPL(reset_control_get); | ||
195 | |||
196 | /** | ||
197 | * reset_control_put - free the reset controller | ||
198 | * @rstc: reset controller | ||
199 | */ | ||
200 | |||
201 | void reset_control_put(struct reset_control *rstc) | ||
202 | { | ||
203 | if (IS_ERR(rstc)) | ||
204 | return; | ||
205 | |||
206 | module_put(rstc->rcdev->owner); | ||
207 | kfree(rstc); | ||
208 | } | ||
209 | EXPORT_SYMBOL_GPL(reset_control_put); | ||
210 | |||
211 | static void devm_reset_control_release(struct device *dev, void *res) | ||
212 | { | ||
213 | reset_control_put(*(struct reset_control **)res); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * devm_reset_control_get - resource managed reset_control_get() | ||
218 | * @dev: device to be reset by the controller | ||
219 | * @id: reset line name | ||
220 | * | ||
221 | * Managed reset_control_get(). For reset controllers returned from this | ||
222 | * function, reset_control_put() is called automatically on driver detach. | ||
223 | * See reset_control_get() for more information. | ||
224 | */ | ||
225 | struct reset_control *devm_reset_control_get(struct device *dev, const char *id) | ||
226 | { | ||
227 | struct reset_control **ptr, *rstc; | ||
228 | |||
229 | ptr = devres_alloc(devm_reset_control_release, sizeof(*ptr), | ||
230 | GFP_KERNEL); | ||
231 | if (!ptr) | ||
232 | return ERR_PTR(-ENOMEM); | ||
233 | |||
234 | rstc = reset_control_get(dev, id); | ||
235 | if (!IS_ERR(rstc)) { | ||
236 | *ptr = rstc; | ||
237 | devres_add(dev, ptr); | ||
238 | } else { | ||
239 | devres_free(ptr); | ||
240 | } | ||
241 | |||
242 | return rstc; | ||
243 | } | ||
244 | EXPORT_SYMBOL_GPL(devm_reset_control_get); | ||
245 | |||
246 | static int devm_reset_control_match(struct device *dev, void *res, void *data) | ||
247 | { | ||
248 | struct reset_control **rstc = res; | ||
249 | if (WARN_ON(!rstc || !*rstc)) | ||
250 | return 0; | ||
251 | return *rstc == data; | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * devm_reset_control_put - resource managed reset_control_put() | ||
256 | * @rstc: reset controller to free | ||
257 | * | ||
258 | * Deallocate a reset control allocated withd devm_reset_control_get(). | ||
259 | * This function will not need to be called normally, as devres will take | ||
260 | * care of freeing the resource. | ||
261 | */ | ||
262 | void devm_reset_control_put(struct reset_control *rstc) | ||
263 | { | ||
264 | int ret; | ||
265 | |||
266 | ret = devres_release(rstc->dev, devm_reset_control_release, | ||
267 | devm_reset_control_match, rstc); | ||
268 | if (ret) | ||
269 | WARN_ON(ret); | ||
270 | } | ||
271 | EXPORT_SYMBOL_GPL(devm_reset_control_put); | ||
272 | |||
273 | /** | ||
274 | * device_reset - find reset controller associated with the device | ||
275 | * and perform reset | ||
276 | * @dev: device to be reset by the controller | ||
277 | * | ||
278 | * Convenience wrapper for reset_control_get() and reset_control_reset(). | ||
279 | * This is useful for the common case of devices with single, dedicated reset | ||
280 | * lines. | ||
281 | */ | ||
282 | int device_reset(struct device *dev) | ||
283 | { | ||
284 | struct reset_control *rstc; | ||
285 | int ret; | ||
286 | |||
287 | rstc = reset_control_get(dev, NULL); | ||
288 | if (IS_ERR(rstc)) | ||
289 | return PTR_ERR(rstc); | ||
290 | |||
291 | ret = reset_control_reset(rstc); | ||
292 | |||
293 | reset_control_put(rstc); | ||
294 | |||
295 | return ret; | ||
296 | } | ||
297 | EXPORT_SYMBOL_GPL(device_reset); | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 98348ec0b3ce..540909de6247 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -34,6 +34,77 @@ | |||
34 | #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ | 34 | #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ |
35 | #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ | 35 | #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ |
36 | 36 | ||
37 | struct atmel_lcdfb_config { | ||
38 | bool have_alt_pixclock; | ||
39 | bool have_hozval; | ||
40 | bool have_intensity_bit; | ||
41 | }; | ||
42 | |||
43 | static struct atmel_lcdfb_config at91sam9261_config = { | ||
44 | .have_hozval = true, | ||
45 | .have_intensity_bit = true, | ||
46 | }; | ||
47 | |||
48 | static struct atmel_lcdfb_config at91sam9263_config = { | ||
49 | .have_intensity_bit = true, | ||
50 | }; | ||
51 | |||
52 | static struct atmel_lcdfb_config at91sam9g10_config = { | ||
53 | .have_hozval = true, | ||
54 | }; | ||
55 | |||
56 | static struct atmel_lcdfb_config at91sam9g45_config = { | ||
57 | .have_alt_pixclock = true, | ||
58 | }; | ||
59 | |||
60 | static struct atmel_lcdfb_config at91sam9g45es_config = { | ||
61 | }; | ||
62 | |||
63 | static struct atmel_lcdfb_config at91sam9rl_config = { | ||
64 | .have_intensity_bit = true, | ||
65 | }; | ||
66 | |||
67 | static struct atmel_lcdfb_config at32ap_config = { | ||
68 | .have_hozval = true, | ||
69 | }; | ||
70 | |||
71 | static const struct platform_device_id atmel_lcdfb_devtypes[] = { | ||
72 | { | ||
73 | .name = "at91sam9261-lcdfb", | ||
74 | .driver_data = (unsigned long)&at91sam9261_config, | ||
75 | }, { | ||
76 | .name = "at91sam9263-lcdfb", | ||
77 | .driver_data = (unsigned long)&at91sam9263_config, | ||
78 | }, { | ||
79 | .name = "at91sam9g10-lcdfb", | ||
80 | .driver_data = (unsigned long)&at91sam9g10_config, | ||
81 | }, { | ||
82 | .name = "at91sam9g45-lcdfb", | ||
83 | .driver_data = (unsigned long)&at91sam9g45_config, | ||
84 | }, { | ||
85 | .name = "at91sam9g45es-lcdfb", | ||
86 | .driver_data = (unsigned long)&at91sam9g45es_config, | ||
87 | }, { | ||
88 | .name = "at91sam9rl-lcdfb", | ||
89 | .driver_data = (unsigned long)&at91sam9rl_config, | ||
90 | }, { | ||
91 | .name = "at32ap-lcdfb", | ||
92 | .driver_data = (unsigned long)&at32ap_config, | ||
93 | }, { | ||
94 | /* terminator */ | ||
95 | } | ||
96 | }; | ||
97 | |||
98 | static struct atmel_lcdfb_config * | ||
99 | atmel_lcdfb_get_config(struct platform_device *pdev) | ||
100 | { | ||
101 | unsigned long data; | ||
102 | |||
103 | data = platform_get_device_id(pdev)->driver_data; | ||
104 | |||
105 | return (struct atmel_lcdfb_config *)data; | ||
106 | } | ||
107 | |||
37 | #if defined(CONFIG_ARCH_AT91) | 108 | #if defined(CONFIG_ARCH_AT91) |
38 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ | 109 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ |
39 | | FBINFO_PARTIAL_PAN_OK \ | 110 | | FBINFO_PARTIAL_PAN_OK \ |
@@ -193,14 +264,16 @@ static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { | |||
193 | .accel = FB_ACCEL_NONE, | 264 | .accel = FB_ACCEL_NONE, |
194 | }; | 265 | }; |
195 | 266 | ||
196 | static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) | 267 | static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo, |
268 | unsigned long xres) | ||
197 | { | 269 | { |
270 | unsigned long lcdcon2; | ||
198 | unsigned long value; | 271 | unsigned long value; |
199 | 272 | ||
200 | if (!(cpu_is_at91sam9261() || cpu_is_at91sam9g10() | 273 | if (!sinfo->config->have_hozval) |
201 | || cpu_is_at32ap7000())) | ||
202 | return xres; | 274 | return xres; |
203 | 275 | ||
276 | lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2); | ||
204 | value = xres; | 277 | value = xres; |
205 | if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { | 278 | if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { |
206 | /* STN display */ | 279 | /* STN display */ |
@@ -423,7 +496,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
423 | break; | 496 | break; |
424 | case 16: | 497 | case 16: |
425 | /* Older SOCs use IBGR:555 rather than BGR:565. */ | 498 | /* Older SOCs use IBGR:555 rather than BGR:565. */ |
426 | if (sinfo->have_intensity_bit) | 499 | if (sinfo->config->have_intensity_bit) |
427 | var->green.length = 5; | 500 | var->green.length = 5; |
428 | else | 501 | else |
429 | var->green.length = 6; | 502 | var->green.length = 6; |
@@ -531,7 +604,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
531 | /* Now, the LCDC core... */ | 604 | /* Now, the LCDC core... */ |
532 | 605 | ||
533 | /* Set pixel clock */ | 606 | /* Set pixel clock */ |
534 | if (cpu_is_at91sam9g45() && !cpu_is_at91sam9g45es()) | 607 | if (sinfo->config->have_alt_pixclock) |
535 | pix_factor = 1; | 608 | pix_factor = 1; |
536 | 609 | ||
537 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; | 610 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; |
@@ -591,8 +664,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
591 | lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); | 664 | lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); |
592 | 665 | ||
593 | /* Horizontal value (aka line size) */ | 666 | /* Horizontal value (aka line size) */ |
594 | hozval_linesz = compute_hozval(info->var.xres, | 667 | hozval_linesz = compute_hozval(sinfo, info->var.xres); |
595 | lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2)); | ||
596 | 668 | ||
597 | /* Display size */ | 669 | /* Display size */ |
598 | value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; | 670 | value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; |
@@ -684,7 +756,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
684 | 756 | ||
685 | case FB_VISUAL_PSEUDOCOLOR: | 757 | case FB_VISUAL_PSEUDOCOLOR: |
686 | if (regno < 256) { | 758 | if (regno < 256) { |
687 | if (sinfo->have_intensity_bit) { | 759 | if (sinfo->config->have_intensity_bit) { |
688 | /* old style I+BGR:555 */ | 760 | /* old style I+BGR:555 */ |
689 | val = ((red >> 11) & 0x001f); | 761 | val = ((red >> 11) & 0x001f); |
690 | val |= ((green >> 6) & 0x03e0); | 762 | val |= ((green >> 6) & 0x03e0); |
@@ -821,15 +893,13 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) | |||
821 | 893 | ||
822 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) | 894 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) |
823 | { | 895 | { |
824 | if (sinfo->bus_clk) | 896 | clk_enable(sinfo->bus_clk); |
825 | clk_enable(sinfo->bus_clk); | ||
826 | clk_enable(sinfo->lcdc_clk); | 897 | clk_enable(sinfo->lcdc_clk); |
827 | } | 898 | } |
828 | 899 | ||
829 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) | 900 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) |
830 | { | 901 | { |
831 | if (sinfo->bus_clk) | 902 | clk_disable(sinfo->bus_clk); |
832 | clk_disable(sinfo->bus_clk); | ||
833 | clk_disable(sinfo->lcdc_clk); | 903 | clk_disable(sinfo->lcdc_clk); |
834 | } | 904 | } |
835 | 905 | ||
@@ -874,10 +944,9 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
874 | } | 944 | } |
875 | sinfo->info = info; | 945 | sinfo->info = info; |
876 | sinfo->pdev = pdev; | 946 | sinfo->pdev = pdev; |
877 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || | 947 | sinfo->config = atmel_lcdfb_get_config(pdev); |
878 | cpu_is_at91sam9rl()) { | 948 | if (!sinfo->config) |
879 | sinfo->have_intensity_bit = true; | 949 | goto free_info; |
880 | } | ||
881 | 950 | ||
882 | strcpy(info->fix.id, sinfo->pdev->name); | 951 | strcpy(info->fix.id, sinfo->pdev->name); |
883 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 952 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |
@@ -888,13 +957,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
888 | info->fix = atmel_lcdfb_fix; | 957 | info->fix = atmel_lcdfb_fix; |
889 | 958 | ||
890 | /* Enable LCDC Clocks */ | 959 | /* Enable LCDC Clocks */ |
891 | if (cpu_is_at91sam9261() || cpu_is_at91sam9g10() | 960 | sinfo->bus_clk = clk_get(dev, "hclk"); |
892 | || cpu_is_at32ap7000()) { | 961 | if (IS_ERR(sinfo->bus_clk)) { |
893 | sinfo->bus_clk = clk_get(dev, "hck1"); | 962 | ret = PTR_ERR(sinfo->bus_clk); |
894 | if (IS_ERR(sinfo->bus_clk)) { | 963 | goto free_info; |
895 | ret = PTR_ERR(sinfo->bus_clk); | ||
896 | goto free_info; | ||
897 | } | ||
898 | } | 964 | } |
899 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); | 965 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); |
900 | if (IS_ERR(sinfo->lcdc_clk)) { | 966 | if (IS_ERR(sinfo->lcdc_clk)) { |
@@ -1055,8 +1121,7 @@ stop_clk: | |||
1055 | atmel_lcdfb_stop_clock(sinfo); | 1121 | atmel_lcdfb_stop_clock(sinfo); |
1056 | clk_put(sinfo->lcdc_clk); | 1122 | clk_put(sinfo->lcdc_clk); |
1057 | put_bus_clk: | 1123 | put_bus_clk: |
1058 | if (sinfo->bus_clk) | 1124 | clk_put(sinfo->bus_clk); |
1059 | clk_put(sinfo->bus_clk); | ||
1060 | free_info: | 1125 | free_info: |
1061 | framebuffer_release(info); | 1126 | framebuffer_release(info); |
1062 | out: | 1127 | out: |
@@ -1081,8 +1146,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
1081 | unregister_framebuffer(info); | 1146 | unregister_framebuffer(info); |
1082 | atmel_lcdfb_stop_clock(sinfo); | 1147 | atmel_lcdfb_stop_clock(sinfo); |
1083 | clk_put(sinfo->lcdc_clk); | 1148 | clk_put(sinfo->lcdc_clk); |
1084 | if (sinfo->bus_clk) | 1149 | clk_put(sinfo->bus_clk); |
1085 | clk_put(sinfo->bus_clk); | ||
1086 | fb_dealloc_cmap(&info->cmap); | 1150 | fb_dealloc_cmap(&info->cmap); |
1087 | free_irq(sinfo->irq_base, info); | 1151 | free_irq(sinfo->irq_base, info); |
1088 | iounmap(sinfo->mmio); | 1152 | iounmap(sinfo->mmio); |
@@ -1151,7 +1215,7 @@ static struct platform_driver atmel_lcdfb_driver = { | |||
1151 | .remove = __exit_p(atmel_lcdfb_remove), | 1215 | .remove = __exit_p(atmel_lcdfb_remove), |
1152 | .suspend = atmel_lcdfb_suspend, | 1216 | .suspend = atmel_lcdfb_suspend, |
1153 | .resume = atmel_lcdfb_resume, | 1217 | .resume = atmel_lcdfb_resume, |
1154 | 1218 | .id_table = atmel_lcdfb_devtypes, | |
1155 | .driver = { | 1219 | .driver = { |
1156 | .name = "atmel_lcdfb", | 1220 | .name = "atmel_lcdfb", |
1157 | .owner = THIS_MODULE, | 1221 | .owner = THIS_MODULE, |
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 404d6f940872..642789baec74 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h | |||
@@ -123,5 +123,6 @@ static inline void tegra_cpu_clock_resume(void) | |||
123 | void tegra_periph_reset_deassert(struct clk *c); | 123 | void tegra_periph_reset_deassert(struct clk *c); |
124 | void tegra_periph_reset_assert(struct clk *c); | 124 | void tegra_periph_reset_assert(struct clk *c); |
125 | void tegra_clocks_init(void); | 125 | void tegra_clocks_init(void); |
126 | void tegra_clocks_apply_init_table(void); | ||
126 | 127 | ||
127 | #endif /* __LINUX_CLK_TEGRA_H_ */ | 128 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 2d25ff8fe39a..fb2002f3c7dc 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property( | |||
235 | extern struct property *of_find_property(const struct device_node *np, | 235 | extern struct property *of_find_property(const struct device_node *np, |
236 | const char *name, | 236 | const char *name, |
237 | int *lenp); | 237 | int *lenp); |
238 | extern int of_property_read_u32_index(const struct device_node *np, | ||
239 | const char *propname, | ||
240 | u32 index, u32 *out_value); | ||
238 | extern int of_property_read_u8_array(const struct device_node *np, | 241 | extern int of_property_read_u8_array(const struct device_node *np, |
239 | const char *propname, u8 *out_values, size_t sz); | 242 | const char *propname, u8 *out_values, size_t sz); |
240 | extern int of_property_read_u16_array(const struct device_node *np, | 243 | extern int of_property_read_u16_array(const struct device_node *np, |
@@ -394,6 +397,12 @@ static inline struct device_node *of_find_compatible_node( | |||
394 | return NULL; | 397 | return NULL; |
395 | } | 398 | } |
396 | 399 | ||
400 | static inline int of_property_read_u32_index(const struct device_node *np, | ||
401 | const char *propname, u32 index, u32 *out_value) | ||
402 | { | ||
403 | return -ENOSYS; | ||
404 | } | ||
405 | |||
397 | static inline int of_property_read_u8_array(const struct device_node *np, | 406 | static inline int of_property_read_u8_array(const struct device_node *np, |
398 | const char *propname, u8 *out_values, size_t sz) | 407 | const char *propname, u8 *out_values, size_t sz) |
399 | { | 408 | { |
diff --git a/include/linux/platform_data/irq-renesas-intc-irqpin.h b/include/linux/platform_data/irq-renesas-intc-irqpin.h new file mode 100644 index 000000000000..e4cb911066a6 --- /dev/null +++ b/include/linux/platform_data/irq-renesas-intc-irqpin.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Renesas INTC External IRQ Pin Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
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 | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
21 | #define __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
22 | |||
23 | struct renesas_intc_irqpin_config { | ||
24 | unsigned int sense_bitfield_width; | ||
25 | unsigned int irq_base; | ||
26 | bool control_parent; | ||
27 | }; | ||
28 | |||
29 | #endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */ | ||
diff --git a/include/linux/platform_data/irq-renesas-irqc.h b/include/linux/platform_data/irq-renesas-irqc.h new file mode 100644 index 000000000000..3ae17b3e00ed --- /dev/null +++ b/include/linux/platform_data/irq-renesas-irqc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Renesas IRQC Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
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 | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_IRQC_H__ | ||
21 | #define __IRQ_RENESAS_IRQC_H__ | ||
22 | |||
23 | struct renesas_irqc_config { | ||
24 | unsigned int irq_base; | ||
25 | }; | ||
26 | |||
27 | #endif /* __IRQ_RENESAS_IRQC_H__ */ | ||
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h new file mode 100644 index 000000000000..2f61311ae3e0 --- /dev/null +++ b/include/linux/reset-controller.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _LINUX_RESET_CONTROLLER_H_ | ||
2 | #define _LINUX_RESET_CONTROLLER_H_ | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | |||
6 | struct reset_controller_dev; | ||
7 | |||
8 | /** | ||
9 | * struct reset_control_ops | ||
10 | * | ||
11 | * @reset: for self-deasserting resets, does all necessary | ||
12 | * things to reset the device | ||
13 | * @assert: manually assert the reset line, if supported | ||
14 | * @deassert: manually deassert the reset line, if supported | ||
15 | */ | ||
16 | struct reset_control_ops { | ||
17 | int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); | ||
18 | int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); | ||
19 | int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); | ||
20 | }; | ||
21 | |||
22 | struct module; | ||
23 | struct device_node; | ||
24 | |||
25 | /** | ||
26 | * struct reset_controller_dev - reset controller entity that might | ||
27 | * provide multiple reset controls | ||
28 | * @ops: a pointer to device specific struct reset_control_ops | ||
29 | * @owner: kernel module of the reset controller driver | ||
30 | * @list: internal list of reset controller devices | ||
31 | * @of_node: corresponding device tree node as phandle target | ||
32 | * @of_reset_n_cells: number of cells in reset line specifiers | ||
33 | * @of_xlate: translation function to translate from specifier as found in the | ||
34 | * device tree to id as given to the reset control ops | ||
35 | * @nr_resets: number of reset controls in this reset controller device | ||
36 | */ | ||
37 | struct reset_controller_dev { | ||
38 | struct reset_control_ops *ops; | ||
39 | struct module *owner; | ||
40 | struct list_head list; | ||
41 | struct device_node *of_node; | ||
42 | int of_reset_n_cells; | ||
43 | int (*of_xlate)(struct reset_controller_dev *rcdev, | ||
44 | const struct of_phandle_args *reset_spec); | ||
45 | unsigned int nr_resets; | ||
46 | }; | ||
47 | |||
48 | int reset_controller_register(struct reset_controller_dev *rcdev); | ||
49 | void reset_controller_unregister(struct reset_controller_dev *rcdev); | ||
50 | |||
51 | #endif | ||
diff --git a/include/linux/reset.h b/include/linux/reset.h new file mode 100644 index 000000000000..6082247feab1 --- /dev/null +++ b/include/linux/reset.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _LINUX_RESET_H_ | ||
2 | #define _LINUX_RESET_H_ | ||
3 | |||
4 | struct device; | ||
5 | struct reset_control; | ||
6 | |||
7 | int reset_control_reset(struct reset_control *rstc); | ||
8 | int reset_control_assert(struct reset_control *rstc); | ||
9 | int reset_control_deassert(struct reset_control *rstc); | ||
10 | |||
11 | struct reset_control *reset_control_get(struct device *dev, const char *id); | ||
12 | void reset_control_put(struct reset_control *rstc); | ||
13 | struct reset_control *devm_reset_control_get(struct device *dev, const char *id); | ||
14 | |||
15 | int device_reset(struct device *dev); | ||
16 | |||
17 | #endif | ||
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index 8deb22672ada..0f5a2fc69af9 100644 --- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define ATMEL_LCDC_WIRING_BGR 0 | 31 | #define ATMEL_LCDC_WIRING_BGR 0 |
32 | #define ATMEL_LCDC_WIRING_RGB 1 | 32 | #define ATMEL_LCDC_WIRING_RGB 1 |
33 | 33 | ||
34 | struct atmel_lcdfb_config; | ||
34 | 35 | ||
35 | /* LCD Controller info data structure, stored in device platform_data */ | 36 | /* LCD Controller info data structure, stored in device platform_data */ |
36 | struct atmel_lcdfb_info { | 37 | struct atmel_lcdfb_info { |
@@ -61,7 +62,8 @@ struct atmel_lcdfb_info { | |||
61 | void (*atmel_lcdfb_power_control)(int on); | 62 | void (*atmel_lcdfb_power_control)(int on); |
62 | struct fb_monspecs *default_monspecs; | 63 | struct fb_monspecs *default_monspecs; |
63 | u32 pseudo_palette[16]; | 64 | u32 pseudo_palette[16]; |
64 | bool have_intensity_bit; | 65 | |
66 | struct atmel_lcdfb_config *config; | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | #define ATMEL_LCDC_DMABADDR1 0x00 | 69 | #define ATMEL_LCDC_DMABADDR1 0x00 |