diff options
Diffstat (limited to 'arch/arm/mach-s3c24xx')
115 files changed, 20401 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig new file mode 100644 index 000000000000..0f3a327ebcaa --- /dev/null +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -0,0 +1,538 @@ | |||
1 | # arch/arm/mach-s3c24xx/Kconfig | ||
2 | # | ||
3 | # Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Copyright 2007 Simtec Electronics | ||
7 | # | ||
8 | # Licensed under GPLv2 | ||
9 | |||
10 | if ARCH_S3C24XX | ||
11 | |||
12 | menu "SAMSUNG S3C24XX SoCs Support" | ||
13 | |||
14 | comment "S3C24XX SoCs" | ||
15 | |||
16 | config CPU_S3C2410 | ||
17 | bool "SAMSUNG S3C2410" | ||
18 | default y | ||
19 | select CPU_ARM920T | ||
20 | select S3C2410_CLOCK | ||
21 | select CPU_LLSERIAL_S3C2410 | ||
22 | select S3C2410_PM if PM | ||
23 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX | ||
24 | help | ||
25 | Support for S3C2410 and S3C2410A family from the S3C24XX line | ||
26 | of Samsung Mobile CPUs. | ||
27 | |||
28 | config CPU_S3C2412 | ||
29 | bool "SAMSUNG S3C2412" | ||
30 | depends on ARCH_S3C24XX | ||
31 | select CPU_ARM926T | ||
32 | select CPU_LLSERIAL_S3C2440 | ||
33 | select S3C2412_PM if PM | ||
34 | select S3C2412_DMA if S3C24XX_DMA | ||
35 | help | ||
36 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line | ||
37 | |||
38 | config CPU_S3C2416 | ||
39 | bool "SAMSUNG S3C2416/S3C2450" | ||
40 | depends on ARCH_S3C24XX | ||
41 | select CPU_ARM926T | ||
42 | select CPU_LLSERIAL_S3C2440 | ||
43 | select SAMSUNG_CLKSRC | ||
44 | select S3C2443_COMMON | ||
45 | select S3C2443_DMA if S3C24XX_DMA | ||
46 | select S3C2416_PM if PM | ||
47 | help | ||
48 | Support for the S3C2416 SoC from the S3C24XX line | ||
49 | |||
50 | config CPU_S3C2440 | ||
51 | bool "SAMSUNG S3C2440" | ||
52 | select CPU_ARM920T | ||
53 | select CPU_LLSERIAL_S3C2440 | ||
54 | select S3C2410_CLOCK | ||
55 | select S3C2410_PM if PM | ||
56 | select S3C2440_DMA if S3C24XX_DMA | ||
57 | help | ||
58 | Support for S3C2440 Samsung Mobile CPU based systems. | ||
59 | |||
60 | config CPU_S3C2442 | ||
61 | bool "SAMSUNG S3C2442" | ||
62 | select CPU_ARM920T | ||
63 | select CPU_LLSERIAL_S3C2440 | ||
64 | select S3C2410_CLOCK | ||
65 | select S3C2410_PM if PM | ||
66 | help | ||
67 | Support for S3C2442 Samsung Mobile CPU based systems. | ||
68 | |||
69 | config CPU_S3C244X | ||
70 | def_bool y | ||
71 | depends on CPU_S3C2440 || CPU_S3C2442 | ||
72 | |||
73 | config CPU_S3C2443 | ||
74 | bool "SAMSUNG S3C2443" | ||
75 | depends on ARCH_S3C24XX | ||
76 | select CPU_ARM920T | ||
77 | select CPU_LLSERIAL_S3C2440 | ||
78 | select SAMSUNG_CLKSRC | ||
79 | select S3C2443_COMMON | ||
80 | select S3C2443_DMA if S3C24XX_DMA | ||
81 | help | ||
82 | Support for the S3C2443 SoC from the S3C24XX line | ||
83 | |||
84 | # common code | ||
85 | |||
86 | config S3C24XX_SMDK | ||
87 | bool | ||
88 | help | ||
89 | Common machine code for SMDK2410 and SMDK2440 | ||
90 | |||
91 | config S3C24XX_SIMTEC_AUDIO | ||
92 | bool | ||
93 | depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS) | ||
94 | default y | ||
95 | help | ||
96 | Add audio devices for common Simtec S3C24XX boards | ||
97 | |||
98 | config S3C24XX_SIMTEC_PM | ||
99 | bool | ||
100 | help | ||
101 | Common power management code for systems that are | ||
102 | compatible with the Simtec style of power management | ||
103 | |||
104 | config S3C24XX_SIMTEC_USB | ||
105 | bool | ||
106 | help | ||
107 | USB management code for common Simtec S3C24XX boards | ||
108 | |||
109 | config S3C24XX_SETUP_TS | ||
110 | bool | ||
111 | help | ||
112 | Compile in platform device definition for Samsung TouchScreen. | ||
113 | |||
114 | # cpu-specific sections | ||
115 | |||
116 | if CPU_S3C2410 | ||
117 | |||
118 | config S3C2410_DMA | ||
119 | bool | ||
120 | depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) | ||
121 | default y if CPU_S3C2410 || CPU_S3C2442 | ||
122 | help | ||
123 | DMA device selection for S3C2410 and compatible CPUs | ||
124 | |||
125 | config S3C2410_PM | ||
126 | bool | ||
127 | help | ||
128 | Power Management code common to S3C2410 and better | ||
129 | |||
130 | config S3C24XX_SIMTEC_NOR | ||
131 | bool | ||
132 | help | ||
133 | Internal node to specify machine has simtec NOR mapping | ||
134 | |||
135 | config MACH_BAST_IDE | ||
136 | bool | ||
137 | select HAVE_PATA_PLATFORM | ||
138 | help | ||
139 | Internal node for machines with an BAST style IDE | ||
140 | interface | ||
141 | |||
142 | comment "S3C2410 Boards" | ||
143 | |||
144 | # | ||
145 | # The "S3C2410 Boards" list is ordered alphabetically by option text. | ||
146 | # (without ARCH_ or MACH_) | ||
147 | # | ||
148 | |||
149 | config MACH_AML_M5900 | ||
150 | bool "AML M5900 Series" | ||
151 | select S3C24XX_SIMTEC_PM if PM | ||
152 | select S3C_DEV_USB_HOST | ||
153 | help | ||
154 | Say Y here if you are using the American Microsystems M5900 Series | ||
155 | <http://www.amltd.com> | ||
156 | |||
157 | config ARCH_BAST | ||
158 | bool "Simtec Electronics BAST (EB2410ITX)" | ||
159 | select S3C2410_IOTIMING if S3C2410_CPUFREQ | ||
160 | select S3C24XX_SIMTEC_PM if PM | ||
161 | select S3C24XX_SIMTEC_NOR | ||
162 | select S3C24XX_SIMTEC_USB | ||
163 | select MACH_BAST_IDE | ||
164 | select S3C24XX_DCLK | ||
165 | select ISA | ||
166 | select S3C_DEV_HWMON | ||
167 | select S3C_DEV_USB_HOST | ||
168 | select S3C_DEV_NAND | ||
169 | help | ||
170 | Say Y here if you are using the Simtec Electronics EB2410ITX | ||
171 | development board (also known as BAST) | ||
172 | |||
173 | config BAST_PC104_IRQ | ||
174 | bool "BAST PC104 IRQ support" | ||
175 | depends on ARCH_BAST | ||
176 | default y | ||
177 | help | ||
178 | Say Y here to enable the PC104 IRQ routing on the | ||
179 | Simtec BAST (EB2410ITX) | ||
180 | |||
181 | config ARCH_H1940 | ||
182 | bool "IPAQ H1940" | ||
183 | select PM_H1940 if PM | ||
184 | select S3C_DEV_USB_HOST | ||
185 | select S3C_DEV_NAND | ||
186 | select S3C24XX_SETUP_TS | ||
187 | help | ||
188 | Say Y here if you are using the HP IPAQ H1940 | ||
189 | |||
190 | config H1940BT | ||
191 | tristate "Control the state of H1940 bluetooth chip" | ||
192 | depends on ARCH_H1940 | ||
193 | select RFKILL | ||
194 | help | ||
195 | This is a simple driver that is able to control | ||
196 | the state of built in bluetooth chip on h1940. | ||
197 | |||
198 | config PM_H1940 | ||
199 | bool | ||
200 | help | ||
201 | Internal node for H1940 and related PM | ||
202 | |||
203 | config MACH_N30 | ||
204 | bool "Acer N30 family" | ||
205 | select MACH_N35 | ||
206 | select S3C_DEV_USB_HOST | ||
207 | select S3C_DEV_NAND | ||
208 | help | ||
209 | Say Y here if you want suppt for the Acer N30, Acer N35, | ||
210 | Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs. | ||
211 | |||
212 | config MACH_OTOM | ||
213 | bool "NexVision OTOM Board" | ||
214 | select S3C_DEV_USB_HOST | ||
215 | select S3C_DEV_NAND | ||
216 | help | ||
217 | Say Y here if you are using the Nex Vision OTOM board | ||
218 | |||
219 | config MACH_QT2410 | ||
220 | bool "QT2410" | ||
221 | select S3C_DEV_USB_HOST | ||
222 | select S3C_DEV_NAND | ||
223 | help | ||
224 | Say Y here if you are using the Armzone QT2410 | ||
225 | |||
226 | config ARCH_SMDK2410 | ||
227 | bool "SMDK2410/A9M2410" | ||
228 | select S3C24XX_SMDK | ||
229 | help | ||
230 | Say Y here if you are using the SMDK2410 or the derived module A9M2410 | ||
231 | <http://www.fsforth.de> | ||
232 | |||
233 | config MACH_TCT_HAMMER | ||
234 | bool "TCT Hammer Board" | ||
235 | select S3C_DEV_USB_HOST | ||
236 | help | ||
237 | Say Y here if you are using the TinCanTools Hammer Board | ||
238 | <http://www.tincantools.com> | ||
239 | |||
240 | config MACH_VR1000 | ||
241 | bool "Thorcom VR1000" | ||
242 | select S3C24XX_SIMTEC_PM if PM | ||
243 | select S3C24XX_DCLK | ||
244 | select S3C24XX_SIMTEC_NOR | ||
245 | select MACH_BAST_IDE | ||
246 | select S3C_DEV_USB_HOST | ||
247 | select S3C24XX_SIMTEC_USB | ||
248 | help | ||
249 | Say Y here if you are using the Thorcom VR1000 board. | ||
250 | |||
251 | endif # CPU_S3C2410 | ||
252 | |||
253 | config S3C2412_PM_SLEEP | ||
254 | bool | ||
255 | help | ||
256 | Internal config node to apply sleep for S3C2412 power management. | ||
257 | Can be selected by another SoCs such as S3C2416 with similar | ||
258 | sleep procedure. | ||
259 | |||
260 | if CPU_S3C2412 | ||
261 | |||
262 | config CPU_S3C2412_ONLY | ||
263 | bool | ||
264 | depends on ARCH_S3C24XX && !CPU_S3C2410 && \ | ||
265 | !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \ | ||
266 | !CPU_S3C2443 && CPU_S3C2412 | ||
267 | default y | ||
268 | |||
269 | config S3C2412_DMA | ||
270 | bool | ||
271 | help | ||
272 | Internal config node for S3C2412 DMA support | ||
273 | |||
274 | config S3C2412_PM | ||
275 | bool | ||
276 | help | ||
277 | Internal config node to apply S3C2412 power management | ||
278 | |||
279 | comment "S3C2412 Boards" | ||
280 | |||
281 | # | ||
282 | # The "S3C2412 Boards" list is ordered alphabetically by option text. | ||
283 | # (without ARCH_ or MACH_) | ||
284 | # | ||
285 | |||
286 | config MACH_JIVE | ||
287 | bool "Logitech Jive" | ||
288 | select S3C_DEV_USB_HOST | ||
289 | select S3C_DEV_NAND | ||
290 | help | ||
291 | Say Y here if you are using the Logitech Jive. | ||
292 | |||
293 | config MACH_JIVE_SHOW_BOOTLOADER | ||
294 | bool "Allow access to bootloader partitions in MTD (EXPERIMENTAL)" | ||
295 | depends on MACH_JIVE && EXPERIMENTAL | ||
296 | |||
297 | config MACH_S3C2413 | ||
298 | bool | ||
299 | help | ||
300 | Internal node for S3C2413 version of SMDK2413, so that | ||
301 | machine_is_s3c2413() will work when MACH_SMDK2413 is | ||
302 | selected | ||
303 | |||
304 | config MACH_SMDK2412 | ||
305 | bool "SMDK2412" | ||
306 | select MACH_SMDK2413 | ||
307 | help | ||
308 | Say Y here if you are using an SMDK2412 | ||
309 | |||
310 | Note, this shares support with SMDK2413, so will automatically | ||
311 | select MACH_SMDK2413. | ||
312 | |||
313 | config MACH_SMDK2413 | ||
314 | bool "SMDK2413" | ||
315 | select MACH_S3C2413 | ||
316 | select S3C24XX_SMDK | ||
317 | select S3C_DEV_USB_HOST | ||
318 | select S3C_DEV_NAND | ||
319 | help | ||
320 | Say Y here if you are using an SMDK2413 | ||
321 | |||
322 | config MACH_VSTMS | ||
323 | bool "VMSTMS" | ||
324 | select S3C_DEV_USB_HOST | ||
325 | select S3C_DEV_NAND | ||
326 | help | ||
327 | Say Y here if you are using an VSTMS board | ||
328 | |||
329 | endif # CPU_S3C2412 | ||
330 | |||
331 | if CPU_S3C2416 | ||
332 | |||
333 | config S3C2416_PM | ||
334 | bool | ||
335 | select S3C2412_PM_SLEEP | ||
336 | help | ||
337 | Internal config node to apply S3C2416 power management | ||
338 | |||
339 | config S3C2416_SETUP_SDHCI | ||
340 | bool | ||
341 | select S3C2416_SETUP_SDHCI_GPIO | ||
342 | help | ||
343 | Internal helper functions for S3C2416 based SDHCI systems | ||
344 | |||
345 | config S3C2416_SETUP_SDHCI_GPIO | ||
346 | bool | ||
347 | help | ||
348 | Common setup code for SDHCI gpio. | ||
349 | |||
350 | comment "S3C2416 Boards" | ||
351 | |||
352 | config MACH_SMDK2416 | ||
353 | bool "SMDK2416" | ||
354 | select S3C24XX_SMDK | ||
355 | select S3C_DEV_FB | ||
356 | select S3C_DEV_HSMMC | ||
357 | select S3C_DEV_HSMMC1 | ||
358 | select S3C_DEV_NAND | ||
359 | select S3C_DEV_USB_HOST | ||
360 | select S3C2416_SETUP_SDHCI | ||
361 | help | ||
362 | Say Y here if you are using an SMDK2416 | ||
363 | |||
364 | endif # CPU_S3C2416 | ||
365 | |||
366 | if CPU_S3C2440 | ||
367 | |||
368 | config S3C2440_DMA | ||
369 | bool | ||
370 | help | ||
371 | Support for S3C2440 specific DMA code5A | ||
372 | |||
373 | comment "S3C2440 Boards" | ||
374 | |||
375 | # | ||
376 | # The "S3C2440 Boards" list is ordered alphabetically by option text. | ||
377 | # (without ARCH_ or MACH_) | ||
378 | # | ||
379 | |||
380 | config MACH_ANUBIS | ||
381 | bool "Simtec Electronics ANUBIS" | ||
382 | select S3C24XX_DCLK | ||
383 | select S3C24XX_SIMTEC_PM if PM | ||
384 | select HAVE_PATA_PLATFORM | ||
385 | select S3C24XX_GPIO_EXTRA64 | ||
386 | select S3C2440_XTAL_12000000 | ||
387 | select S3C_DEV_USB_HOST | ||
388 | help | ||
389 | Say Y here if you are using the Simtec Electronics ANUBIS | ||
390 | development system | ||
391 | |||
392 | config MACH_AT2440EVB | ||
393 | bool "Avantech AT2440EVB development board" | ||
394 | select S3C_DEV_USB_HOST | ||
395 | select S3C_DEV_NAND | ||
396 | help | ||
397 | Say Y here if you are using the AT2440EVB development board | ||
398 | |||
399 | config MACH_MINI2440 | ||
400 | bool "MINI2440 development board" | ||
401 | select EEPROM_AT24 | ||
402 | select NEW_LEDS | ||
403 | select LEDS_CLASS | ||
404 | select LEDS_TRIGGER | ||
405 | select LEDS_TRIGGER_BACKLIGHT | ||
406 | select S3C_DEV_NAND | ||
407 | select S3C_DEV_USB_HOST | ||
408 | help | ||
409 | Say Y here to select support for the MINI2440. Is a 10cm x 10cm board | ||
410 | available via various sources. It can come with a 3.5" or 7" touch LCD. | ||
411 | |||
412 | config MACH_NEXCODER_2440 | ||
413 | bool "NexVision NEXCODER 2440 Light Board" | ||
414 | select S3C2440_XTAL_12000000 | ||
415 | select S3C_DEV_USB_HOST | ||
416 | select S3C_DEV_NAND | ||
417 | help | ||
418 | Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board | ||
419 | |||
420 | config MACH_OSIRIS | ||
421 | bool "Simtec IM2440D20 (OSIRIS) module" | ||
422 | select S3C24XX_DCLK | ||
423 | select S3C24XX_SIMTEC_PM if PM | ||
424 | select S3C24XX_GPIO_EXTRA128 | ||
425 | select S3C2440_XTAL_12000000 | ||
426 | select S3C2410_IOTIMING if S3C2440_CPUFREQ | ||
427 | select S3C_DEV_USB_HOST | ||
428 | select S3C_DEV_NAND | ||
429 | help | ||
430 | Say Y here if you are using the Simtec IM2440D20 module, also | ||
431 | known as the Osiris. | ||
432 | |||
433 | config MACH_OSIRIS_DVS | ||
434 | tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver" | ||
435 | depends on MACH_OSIRIS | ||
436 | select TPS65010 | ||
437 | help | ||
438 | Say Y/M here if you want to have dynamic voltage scaling support | ||
439 | on the Simtec IM2440D20 (OSIRIS) module via the TPS65011. | ||
440 | |||
441 | The DVS driver alters the voltage supplied to the ARM core | ||
442 | depending on the frequency it is running at. The driver itself | ||
443 | does not do any of the frequency alteration, which is left up | ||
444 | to the cpufreq driver. | ||
445 | |||
446 | config MACH_RX3715 | ||
447 | bool "HP iPAQ rx3715" | ||
448 | select S3C2440_XTAL_16934400 | ||
449 | select PM_H1940 if PM | ||
450 | select S3C_DEV_NAND | ||
451 | help | ||
452 | Say Y here if you are using the HP iPAQ rx3715. | ||
453 | |||
454 | config ARCH_S3C2440 | ||
455 | bool "SMDK2440" | ||
456 | select S3C2440_XTAL_16934400 | ||
457 | select S3C24XX_SMDK | ||
458 | select S3C_DEV_USB_HOST | ||
459 | select S3C_DEV_NAND | ||
460 | help | ||
461 | Say Y here if you are using the SMDK2440. | ||
462 | |||
463 | config SMDK2440_CPU2440 | ||
464 | bool "SMDK2440 with S3C2440 CPU module" | ||
465 | default y if ARCH_S3C2440 | ||
466 | select S3C2440_XTAL_16934400 | ||
467 | |||
468 | endif # CPU_S3C2440 | ||
469 | |||
470 | if CPU_S3C2442 | ||
471 | |||
472 | comment "S3C2442 Boards" | ||
473 | |||
474 | # | ||
475 | # The "S3C2442 Boards" list is ordered alphabetically by option text. | ||
476 | # (without ARCH_ or MACH_) | ||
477 | # | ||
478 | |||
479 | config MACH_NEO1973_GTA02 | ||
480 | bool "Openmoko GTA02 / Freerunner phone" | ||
481 | select MFD_PCF50633 | ||
482 | select PCF50633_GPIO | ||
483 | select I2C | ||
484 | select POWER_SUPPLY | ||
485 | select MACH_NEO1973 | ||
486 | select S3C2410_PWM | ||
487 | select S3C_DEV_USB_HOST | ||
488 | help | ||
489 | Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone | ||
490 | |||
491 | config MACH_RX1950 | ||
492 | bool "HP iPAQ rx1950" | ||
493 | select S3C24XX_DCLK | ||
494 | select PM_H1940 if PM | ||
495 | select I2C | ||
496 | select S3C2410_PWM | ||
497 | select S3C_DEV_NAND | ||
498 | select S3C2410_IOTIMING if S3C2440_CPUFREQ | ||
499 | select S3C2440_XTAL_16934400 | ||
500 | help | ||
501 | Say Y here if you're using HP iPAQ rx1950 | ||
502 | |||
503 | config SMDK2440_CPU2442 | ||
504 | bool "SMDM2440 with S3C2442 CPU module" | ||
505 | |||
506 | endif # CPU_S3C2440 | ||
507 | |||
508 | if CPU_S3C2443 || CPU_S3C2416 | ||
509 | |||
510 | config S3C2443_COMMON | ||
511 | bool | ||
512 | help | ||
513 | Common code for the S3C2443 and similar processors, which includes | ||
514 | the S3C2416 and S3C2450. | ||
515 | |||
516 | config S3C2443_DMA | ||
517 | bool | ||
518 | help | ||
519 | Internal config node for S3C2443 DMA support | ||
520 | |||
521 | endif # CPU_S3C2443 || CPU_S3C2416 | ||
522 | |||
523 | if CPU_S3C2443 | ||
524 | |||
525 | comment "S3C2443 Boards" | ||
526 | |||
527 | config MACH_SMDK2443 | ||
528 | bool "SMDK2443" | ||
529 | select S3C24XX_SMDK | ||
530 | select S3C_DEV_HSMMC1 | ||
531 | help | ||
532 | Say Y here if you are using an SMDK2443 | ||
533 | |||
534 | endif # CPU_S3C2443 | ||
535 | |||
536 | endmenu # SAMSUNG S3C24XX SoCs Support | ||
537 | |||
538 | endif # ARCH_S3C24XX | ||
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile new file mode 100644 index 000000000000..3518fe812d5f --- /dev/null +++ b/arch/arm/mach-s3c24xx/Makefile | |||
@@ -0,0 +1,95 @@ | |||
1 | # arch/arm/mach-s3c24xx/Makefile | ||
2 | # | ||
3 | # Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Copyright 2007 Simtec Electronics | ||
7 | # | ||
8 | # Licensed under GPLv2 | ||
9 | |||
10 | obj-y := | ||
11 | obj-m := | ||
12 | obj-n := | ||
13 | obj- := | ||
14 | |||
15 | # core | ||
16 | |||
17 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o | ||
18 | obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o | ||
19 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o | ||
20 | |||
21 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o | ||
22 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o | ||
23 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o | ||
24 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o | ||
25 | |||
26 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o irq-s3c2416.o clock-s3c2416.o | ||
27 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o | ||
28 | |||
29 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o | ||
30 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o | ||
31 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o | ||
32 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o | ||
33 | |||
34 | obj-$(CONFIG_CPU_S3C2443) += s3c2443.o irq-s3c2443.o clock-s3c2443.o | ||
35 | |||
36 | # common code | ||
37 | |||
38 | obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o | ||
39 | obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o | ||
40 | |||
41 | # | ||
42 | # machine support | ||
43 | # following is ordered alphabetically by option text. | ||
44 | # | ||
45 | |||
46 | obj-$(CONFIG_MACH_AML_M5900) += mach-amlm5900.o | ||
47 | obj-$(CONFIG_ARCH_BAST) += mach-bast.o | ||
48 | obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o | ||
49 | obj-$(CONFIG_ARCH_H1940) += mach-h1940.o | ||
50 | obj-$(CONFIG_H1940BT) += h1940-bluetooth.o | ||
51 | obj-$(CONFIG_PM_H1940) += pm-h1940.o | ||
52 | obj-$(CONFIG_MACH_N30) += mach-n30.o | ||
53 | obj-$(CONFIG_MACH_OTOM) += mach-otom.o | ||
54 | obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o | ||
55 | obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o | ||
56 | obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o | ||
57 | obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o | ||
58 | |||
59 | obj-$(CONFIG_MACH_JIVE) += mach-jive.o | ||
60 | obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o | ||
61 | obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o | ||
62 | |||
63 | obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o | ||
64 | |||
65 | obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o | ||
66 | obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o | ||
67 | obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o | ||
68 | obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o | ||
69 | obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o | ||
70 | obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o | ||
71 | obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o | ||
72 | |||
73 | obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o | ||
74 | obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o | ||
75 | |||
76 | obj-$(CONFIG_MACH_SMDK2443) += mach-smdk2443.o | ||
77 | |||
78 | # common bits of machine support | ||
79 | |||
80 | obj-$(CONFIG_S3C24XX_SMDK) += common-smdk.o | ||
81 | obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO) += simtec-audio.o | ||
82 | obj-$(CONFIG_S3C24XX_SIMTEC_NOR) += simtec-nor.o | ||
83 | obj-$(CONFIG_S3C24XX_SIMTEC_PM) += simtec-pm.o | ||
84 | obj-$(CONFIG_S3C24XX_SIMTEC_USB) += simtec-usb.o | ||
85 | |||
86 | # machine additions | ||
87 | |||
88 | obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o | ||
89 | obj-$(CONFIG_MACH_OSIRIS_DVS) += mach-osiris-dvs.o | ||
90 | |||
91 | # device setup | ||
92 | |||
93 | obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | ||
94 | obj-$(CONFIG_ARCH_S3C24XX) += setup-i2c.o | ||
95 | obj-$(CONFIG_S3C24XX_SETUP_TS) += setup-ts.o | ||
diff --git a/arch/arm/mach-s3c24xx/Makefile.boot b/arch/arm/mach-s3c24xx/Makefile.boot new file mode 100644 index 000000000000..4457605ba04a --- /dev/null +++ b/arch/arm/mach-s3c24xx/Makefile.boot | |||
@@ -0,0 +1,7 @@ | |||
1 | ifeq ($(CONFIG_PM_H1940),y) | ||
2 | zreladdr-y += 0x30108000 | ||
3 | params_phys-y := 0x30100100 | ||
4 | else | ||
5 | zreladdr-y += 0x30008000 | ||
6 | params_phys-y := 0x30000100 | ||
7 | endif | ||
diff --git a/arch/arm/mach-s3c24xx/bast-ide.c b/arch/arm/mach-s3c24xx/bast-ide.c new file mode 100644 index 000000000000..298ececfa366 --- /dev/null +++ b/arch/arm/mach-s3c24xx/bast-ide.c | |||
@@ -0,0 +1,112 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/bast-ide.c | ||
2 | * | ||
3 | * Copyright 2007 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/EB2410ITX/ | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | |||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/ata_platform.h> | ||
20 | |||
21 | #include <asm/mach-types.h> | ||
22 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach/map.h> | ||
25 | #include <asm/mach/irq.h> | ||
26 | |||
27 | #include <mach/map.h> | ||
28 | #include <mach/bast-map.h> | ||
29 | #include <mach/bast-irq.h> | ||
30 | |||
31 | /* IDE ports */ | ||
32 | |||
33 | static struct pata_platform_info bast_ide_platdata = { | ||
34 | .ioport_shift = 5, | ||
35 | }; | ||
36 | |||
37 | #define IDE_CS S3C2410_CS5 | ||
38 | |||
39 | static struct resource bast_ide0_resource[] = { | ||
40 | [0] = { | ||
41 | .start = IDE_CS + BAST_PA_IDEPRI, | ||
42 | .end = IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1, | ||
43 | .flags = IORESOURCE_MEM, | ||
44 | }, | ||
45 | [1] = { | ||
46 | .start = IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) , | ||
47 | .end = IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }, | ||
50 | [2] = { | ||
51 | .start = IRQ_IDE0, | ||
52 | .end = IRQ_IDE0, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static struct platform_device bast_device_ide0 = { | ||
58 | .name = "pata_platform", | ||
59 | .id = 0, | ||
60 | .num_resources = ARRAY_SIZE(bast_ide0_resource), | ||
61 | .resource = bast_ide0_resource, | ||
62 | .dev = { | ||
63 | .platform_data = &bast_ide_platdata, | ||
64 | .coherent_dma_mask = ~0, | ||
65 | } | ||
66 | |||
67 | }; | ||
68 | |||
69 | static struct resource bast_ide1_resource[] = { | ||
70 | [0] = { | ||
71 | .start = IDE_CS + BAST_PA_IDESEC, | ||
72 | .end = IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1, | ||
73 | .flags = IORESOURCE_MEM, | ||
74 | }, | ||
75 | [1] = { | ||
76 | .start = IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), | ||
77 | .end = IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1, | ||
78 | .flags = IORESOURCE_MEM, | ||
79 | }, | ||
80 | [2] = { | ||
81 | .start = IRQ_IDE1, | ||
82 | .end = IRQ_IDE1, | ||
83 | .flags = IORESOURCE_IRQ, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | static struct platform_device bast_device_ide1 = { | ||
88 | .name = "pata_platform", | ||
89 | .id = 1, | ||
90 | .num_resources = ARRAY_SIZE(bast_ide1_resource), | ||
91 | .resource = bast_ide1_resource, | ||
92 | .dev = { | ||
93 | .platform_data = &bast_ide_platdata, | ||
94 | .coherent_dma_mask = ~0, | ||
95 | } | ||
96 | }; | ||
97 | |||
98 | static struct platform_device *bast_ide_devices[] __initdata = { | ||
99 | &bast_device_ide0, | ||
100 | &bast_device_ide1, | ||
101 | }; | ||
102 | |||
103 | static __init int bast_ide_init(void) | ||
104 | { | ||
105 | if (machine_is_bast() || machine_is_vr1000()) | ||
106 | return platform_add_devices(bast_ide_devices, | ||
107 | ARRAY_SIZE(bast_ide_devices)); | ||
108 | |||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | fs_initcall(bast_ide_init); | ||
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c new file mode 100644 index 000000000000..ac7b2ad5c405 --- /dev/null +++ b/arch/arm/mach-s3c24xx/bast-irq.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/bast-irq.c | ||
2 | * | ||
3 | * Copyright 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.simtec.co.uk/products/EB2410ITX/ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/io.h> | ||
29 | |||
30 | #include <asm/mach-types.h> | ||
31 | |||
32 | #include <mach/hardware.h> | ||
33 | #include <asm/irq.h> | ||
34 | |||
35 | #include <asm/mach/irq.h> | ||
36 | |||
37 | #include <mach/regs-irq.h> | ||
38 | #include <mach/bast-map.h> | ||
39 | #include <mach/bast-irq.h> | ||
40 | |||
41 | #include <plat/irq.h> | ||
42 | |||
43 | #if 0 | ||
44 | #include <asm/debug-ll.h> | ||
45 | #endif | ||
46 | |||
47 | #define irqdbf(x...) | ||
48 | #define irqdbf2(x...) | ||
49 | |||
50 | |||
51 | /* handle PC104 ISA interrupts from the system CPLD */ | ||
52 | |||
53 | /* table of ISA irq nos to the relevant mask... zero means | ||
54 | * the irq is not implemented | ||
55 | */ | ||
56 | static unsigned char bast_pc104_irqmasks[] = { | ||
57 | 0, /* 0 */ | ||
58 | 0, /* 1 */ | ||
59 | 0, /* 2 */ | ||
60 | 1, /* 3 */ | ||
61 | 0, /* 4 */ | ||
62 | 2, /* 5 */ | ||
63 | 0, /* 6 */ | ||
64 | 4, /* 7 */ | ||
65 | 0, /* 8 */ | ||
66 | 0, /* 9 */ | ||
67 | 8, /* 10 */ | ||
68 | 0, /* 11 */ | ||
69 | 0, /* 12 */ | ||
70 | 0, /* 13 */ | ||
71 | 0, /* 14 */ | ||
72 | 0, /* 15 */ | ||
73 | }; | ||
74 | |||
75 | static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 }; | ||
76 | |||
77 | static void | ||
78 | bast_pc104_mask(struct irq_data *data) | ||
79 | { | ||
80 | unsigned long temp; | ||
81 | |||
82 | temp = __raw_readb(BAST_VA_PC104_IRQMASK); | ||
83 | temp &= ~bast_pc104_irqmasks[data->irq]; | ||
84 | __raw_writeb(temp, BAST_VA_PC104_IRQMASK); | ||
85 | } | ||
86 | |||
87 | static void | ||
88 | bast_pc104_maskack(struct irq_data *data) | ||
89 | { | ||
90 | struct irq_desc *desc = irq_desc + IRQ_ISA; | ||
91 | |||
92 | bast_pc104_mask(data); | ||
93 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
94 | } | ||
95 | |||
96 | static void | ||
97 | bast_pc104_unmask(struct irq_data *data) | ||
98 | { | ||
99 | unsigned long temp; | ||
100 | |||
101 | temp = __raw_readb(BAST_VA_PC104_IRQMASK); | ||
102 | temp |= bast_pc104_irqmasks[data->irq]; | ||
103 | __raw_writeb(temp, BAST_VA_PC104_IRQMASK); | ||
104 | } | ||
105 | |||
106 | static struct irq_chip bast_pc104_chip = { | ||
107 | .irq_mask = bast_pc104_mask, | ||
108 | .irq_unmask = bast_pc104_unmask, | ||
109 | .irq_ack = bast_pc104_maskack | ||
110 | }; | ||
111 | |||
112 | static void | ||
113 | bast_irq_pc104_demux(unsigned int irq, | ||
114 | struct irq_desc *desc) | ||
115 | { | ||
116 | unsigned int stat; | ||
117 | unsigned int irqno; | ||
118 | int i; | ||
119 | |||
120 | stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf; | ||
121 | |||
122 | if (unlikely(stat == 0)) { | ||
123 | /* ack if we get an irq with nothing (ie, startup) */ | ||
124 | |||
125 | desc = irq_desc + IRQ_ISA; | ||
126 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
127 | } else { | ||
128 | /* handle the IRQ */ | ||
129 | |||
130 | for (i = 0; stat != 0; i++, stat >>= 1) { | ||
131 | if (stat & 1) { | ||
132 | irqno = bast_pc104_irqs[i]; | ||
133 | generic_handle_irq(irqno); | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | |||
139 | static __init int bast_irq_init(void) | ||
140 | { | ||
141 | unsigned int i; | ||
142 | |||
143 | if (machine_is_bast()) { | ||
144 | printk(KERN_INFO "BAST PC104 IRQ routing, Copyright 2005 Simtec Electronics\n"); | ||
145 | |||
146 | /* zap all the IRQs */ | ||
147 | |||
148 | __raw_writeb(0x0, BAST_VA_PC104_IRQMASK); | ||
149 | |||
150 | irq_set_chained_handler(IRQ_ISA, bast_irq_pc104_demux); | ||
151 | |||
152 | /* register our IRQs */ | ||
153 | |||
154 | for (i = 0; i < 4; i++) { | ||
155 | unsigned int irqno = bast_pc104_irqs[i]; | ||
156 | |||
157 | irq_set_chip_and_handler(irqno, &bast_pc104_chip, | ||
158 | handle_level_irq); | ||
159 | set_irq_flags(irqno, IRQF_VALID); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | arch_initcall(bast_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c new file mode 100644 index 000000000000..d10b695a9066 --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c2412.c | |||
@@ -0,0 +1,763 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2412,S3C2413 Clock control 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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/list.h> | ||
27 | #include <linux/errno.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/device.h> | ||
30 | #include <linux/clk.h> | ||
31 | #include <linux/mutex.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/serial_core.h> | ||
34 | #include <linux/io.h> | ||
35 | |||
36 | #include <asm/mach/map.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | |||
40 | #include <plat/regs-serial.h> | ||
41 | #include <mach/regs-clock.h> | ||
42 | #include <mach/regs-gpio.h> | ||
43 | |||
44 | #include <plat/s3c2412.h> | ||
45 | #include <plat/clock.h> | ||
46 | #include <plat/cpu.h> | ||
47 | |||
48 | /* We currently have to assume that the system is running | ||
49 | * from the XTPll input, and that all ***REFCLKs are being | ||
50 | * fed from it, as we cannot read the state of OM[4] from | ||
51 | * software. | ||
52 | * | ||
53 | * It would be possible for each board initialisation to | ||
54 | * set the correct muxing at initialisation | ||
55 | */ | ||
56 | |||
57 | static int s3c2412_clkcon_enable(struct clk *clk, int enable) | ||
58 | { | ||
59 | unsigned int clocks = clk->ctrlbit; | ||
60 | unsigned long clkcon; | ||
61 | |||
62 | clkcon = __raw_readl(S3C2410_CLKCON); | ||
63 | |||
64 | if (enable) | ||
65 | clkcon |= clocks; | ||
66 | else | ||
67 | clkcon &= ~clocks; | ||
68 | |||
69 | __raw_writel(clkcon, S3C2410_CLKCON); | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static int s3c2412_upll_enable(struct clk *clk, int enable) | ||
75 | { | ||
76 | unsigned long upllcon = __raw_readl(S3C2410_UPLLCON); | ||
77 | unsigned long orig = upllcon; | ||
78 | |||
79 | if (!enable) | ||
80 | upllcon |= S3C2412_PLLCON_OFF; | ||
81 | else | ||
82 | upllcon &= ~S3C2412_PLLCON_OFF; | ||
83 | |||
84 | __raw_writel(upllcon, S3C2410_UPLLCON); | ||
85 | |||
86 | /* allow ~150uS for the PLL to settle and lock */ | ||
87 | |||
88 | if (enable && (orig & S3C2412_PLLCON_OFF)) | ||
89 | udelay(150); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /* clock selections */ | ||
95 | |||
96 | static struct clk clk_erefclk = { | ||
97 | .name = "erefclk", | ||
98 | }; | ||
99 | |||
100 | static struct clk clk_urefclk = { | ||
101 | .name = "urefclk", | ||
102 | }; | ||
103 | |||
104 | static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent) | ||
105 | { | ||
106 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
107 | |||
108 | if (parent == &clk_urefclk) | ||
109 | clksrc &= ~S3C2412_CLKSRC_USYSCLK_UPLL; | ||
110 | else if (parent == &clk_upll) | ||
111 | clksrc |= S3C2412_CLKSRC_USYSCLK_UPLL; | ||
112 | else | ||
113 | return -EINVAL; | ||
114 | |||
115 | clk->parent = parent; | ||
116 | |||
117 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static struct clk clk_usysclk = { | ||
122 | .name = "usysclk", | ||
123 | .parent = &clk_xtal, | ||
124 | .ops = &(struct clk_ops) { | ||
125 | .set_parent = s3c2412_setparent_usysclk, | ||
126 | }, | ||
127 | }; | ||
128 | |||
129 | static struct clk clk_mrefclk = { | ||
130 | .name = "mrefclk", | ||
131 | .parent = &clk_xtal, | ||
132 | }; | ||
133 | |||
134 | static struct clk clk_mdivclk = { | ||
135 | .name = "mdivclk", | ||
136 | .parent = &clk_xtal, | ||
137 | }; | ||
138 | |||
139 | static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent) | ||
140 | { | ||
141 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
142 | |||
143 | if (parent == &clk_usysclk) | ||
144 | clksrc &= ~S3C2412_CLKSRC_USBCLK_HCLK; | ||
145 | else if (parent == &clk_h) | ||
146 | clksrc |= S3C2412_CLKSRC_USBCLK_HCLK; | ||
147 | else | ||
148 | return -EINVAL; | ||
149 | |||
150 | clk->parent = parent; | ||
151 | |||
152 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static unsigned long s3c2412_roundrate_usbsrc(struct clk *clk, | ||
157 | unsigned long rate) | ||
158 | { | ||
159 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
160 | int div; | ||
161 | |||
162 | if (rate > parent_rate) | ||
163 | return parent_rate; | ||
164 | |||
165 | div = parent_rate / rate; | ||
166 | if (div > 2) | ||
167 | div = 2; | ||
168 | |||
169 | return parent_rate / div; | ||
170 | } | ||
171 | |||
172 | static unsigned long s3c2412_getrate_usbsrc(struct clk *clk) | ||
173 | { | ||
174 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
175 | unsigned long div = __raw_readl(S3C2410_CLKDIVN); | ||
176 | |||
177 | return parent_rate / ((div & S3C2412_CLKDIVN_USB48DIV) ? 2 : 1); | ||
178 | } | ||
179 | |||
180 | static int s3c2412_setrate_usbsrc(struct clk *clk, unsigned long rate) | ||
181 | { | ||
182 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
183 | unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN); | ||
184 | |||
185 | rate = s3c2412_roundrate_usbsrc(clk, rate); | ||
186 | |||
187 | if ((parent_rate / rate) == 2) | ||
188 | clkdivn |= S3C2412_CLKDIVN_USB48DIV; | ||
189 | else | ||
190 | clkdivn &= ~S3C2412_CLKDIVN_USB48DIV; | ||
191 | |||
192 | __raw_writel(clkdivn, S3C2410_CLKDIVN); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static struct clk clk_usbsrc = { | ||
197 | .name = "usbsrc", | ||
198 | .ops = &(struct clk_ops) { | ||
199 | .get_rate = s3c2412_getrate_usbsrc, | ||
200 | .set_rate = s3c2412_setrate_usbsrc, | ||
201 | .round_rate = s3c2412_roundrate_usbsrc, | ||
202 | .set_parent = s3c2412_setparent_usbsrc, | ||
203 | }, | ||
204 | }; | ||
205 | |||
206 | static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent) | ||
207 | { | ||
208 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
209 | |||
210 | if (parent == &clk_mdivclk) | ||
211 | clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL; | ||
212 | else if (parent == &clk_mpll) | ||
213 | clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL; | ||
214 | else | ||
215 | return -EINVAL; | ||
216 | |||
217 | clk->parent = parent; | ||
218 | |||
219 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static struct clk clk_msysclk = { | ||
224 | .name = "msysclk", | ||
225 | .ops = &(struct clk_ops) { | ||
226 | .set_parent = s3c2412_setparent_msysclk, | ||
227 | }, | ||
228 | }; | ||
229 | |||
230 | static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent) | ||
231 | { | ||
232 | unsigned long flags; | ||
233 | unsigned long clkdiv; | ||
234 | unsigned long dvs; | ||
235 | |||
236 | /* Note, we current equate fclk andf msysclk for S3C2412 */ | ||
237 | |||
238 | if (parent == &clk_msysclk || parent == &clk_f) | ||
239 | dvs = 0; | ||
240 | else if (parent == &clk_h) | ||
241 | dvs = S3C2412_CLKDIVN_DVSEN; | ||
242 | else | ||
243 | return -EINVAL; | ||
244 | |||
245 | clk->parent = parent; | ||
246 | |||
247 | /* update this under irq lockdown, clkdivn is not protected | ||
248 | * by the clock system. */ | ||
249 | |||
250 | local_irq_save(flags); | ||
251 | |||
252 | clkdiv = __raw_readl(S3C2410_CLKDIVN); | ||
253 | clkdiv &= ~S3C2412_CLKDIVN_DVSEN; | ||
254 | clkdiv |= dvs; | ||
255 | __raw_writel(clkdiv, S3C2410_CLKDIVN); | ||
256 | |||
257 | local_irq_restore(flags); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static struct clk clk_armclk = { | ||
263 | .name = "armclk", | ||
264 | .parent = &clk_msysclk, | ||
265 | .ops = &(struct clk_ops) { | ||
266 | .set_parent = s3c2412_setparent_armclk, | ||
267 | }, | ||
268 | }; | ||
269 | |||
270 | /* these next clocks have an divider immediately after them, | ||
271 | * so we can register them with their divider and leave out the | ||
272 | * intermediate clock stage | ||
273 | */ | ||
274 | static unsigned long s3c2412_roundrate_clksrc(struct clk *clk, | ||
275 | unsigned long rate) | ||
276 | { | ||
277 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
278 | int div; | ||
279 | |||
280 | if (rate > parent_rate) | ||
281 | return parent_rate; | ||
282 | |||
283 | /* note, we remove the +/- 1 calculations as they cancel out */ | ||
284 | |||
285 | div = (rate / parent_rate); | ||
286 | |||
287 | if (div < 1) | ||
288 | div = 1; | ||
289 | else if (div > 16) | ||
290 | div = 16; | ||
291 | |||
292 | return parent_rate / div; | ||
293 | } | ||
294 | |||
295 | static int s3c2412_setparent_uart(struct clk *clk, struct clk *parent) | ||
296 | { | ||
297 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
298 | |||
299 | if (parent == &clk_erefclk) | ||
300 | clksrc &= ~S3C2412_CLKSRC_UARTCLK_MPLL; | ||
301 | else if (parent == &clk_mpll) | ||
302 | clksrc |= S3C2412_CLKSRC_UARTCLK_MPLL; | ||
303 | else | ||
304 | return -EINVAL; | ||
305 | |||
306 | clk->parent = parent; | ||
307 | |||
308 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
309 | return 0; | ||
310 | } | ||
311 | |||
312 | static unsigned long s3c2412_getrate_uart(struct clk *clk) | ||
313 | { | ||
314 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
315 | unsigned long div = __raw_readl(S3C2410_CLKDIVN); | ||
316 | |||
317 | div &= S3C2412_CLKDIVN_UARTDIV_MASK; | ||
318 | div >>= S3C2412_CLKDIVN_UARTDIV_SHIFT; | ||
319 | |||
320 | return parent_rate / (div + 1); | ||
321 | } | ||
322 | |||
323 | static int s3c2412_setrate_uart(struct clk *clk, unsigned long rate) | ||
324 | { | ||
325 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
326 | unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN); | ||
327 | |||
328 | rate = s3c2412_roundrate_clksrc(clk, rate); | ||
329 | |||
330 | clkdivn &= ~S3C2412_CLKDIVN_UARTDIV_MASK; | ||
331 | clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_UARTDIV_SHIFT; | ||
332 | |||
333 | __raw_writel(clkdivn, S3C2410_CLKDIVN); | ||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | static struct clk clk_uart = { | ||
338 | .name = "uartclk", | ||
339 | .ops = &(struct clk_ops) { | ||
340 | .get_rate = s3c2412_getrate_uart, | ||
341 | .set_rate = s3c2412_setrate_uart, | ||
342 | .set_parent = s3c2412_setparent_uart, | ||
343 | .round_rate = s3c2412_roundrate_clksrc, | ||
344 | }, | ||
345 | }; | ||
346 | |||
347 | static int s3c2412_setparent_i2s(struct clk *clk, struct clk *parent) | ||
348 | { | ||
349 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
350 | |||
351 | if (parent == &clk_erefclk) | ||
352 | clksrc &= ~S3C2412_CLKSRC_I2SCLK_MPLL; | ||
353 | else if (parent == &clk_mpll) | ||
354 | clksrc |= S3C2412_CLKSRC_I2SCLK_MPLL; | ||
355 | else | ||
356 | return -EINVAL; | ||
357 | |||
358 | clk->parent = parent; | ||
359 | |||
360 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static unsigned long s3c2412_getrate_i2s(struct clk *clk) | ||
365 | { | ||
366 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
367 | unsigned long div = __raw_readl(S3C2410_CLKDIVN); | ||
368 | |||
369 | div &= S3C2412_CLKDIVN_I2SDIV_MASK; | ||
370 | div >>= S3C2412_CLKDIVN_I2SDIV_SHIFT; | ||
371 | |||
372 | return parent_rate / (div + 1); | ||
373 | } | ||
374 | |||
375 | static int s3c2412_setrate_i2s(struct clk *clk, unsigned long rate) | ||
376 | { | ||
377 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
378 | unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN); | ||
379 | |||
380 | rate = s3c2412_roundrate_clksrc(clk, rate); | ||
381 | |||
382 | clkdivn &= ~S3C2412_CLKDIVN_I2SDIV_MASK; | ||
383 | clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_I2SDIV_SHIFT; | ||
384 | |||
385 | __raw_writel(clkdivn, S3C2410_CLKDIVN); | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static struct clk clk_i2s = { | ||
390 | .name = "i2sclk", | ||
391 | .ops = &(struct clk_ops) { | ||
392 | .get_rate = s3c2412_getrate_i2s, | ||
393 | .set_rate = s3c2412_setrate_i2s, | ||
394 | .set_parent = s3c2412_setparent_i2s, | ||
395 | .round_rate = s3c2412_roundrate_clksrc, | ||
396 | }, | ||
397 | }; | ||
398 | |||
399 | static int s3c2412_setparent_cam(struct clk *clk, struct clk *parent) | ||
400 | { | ||
401 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
402 | |||
403 | if (parent == &clk_usysclk) | ||
404 | clksrc &= ~S3C2412_CLKSRC_CAMCLK_HCLK; | ||
405 | else if (parent == &clk_h) | ||
406 | clksrc |= S3C2412_CLKSRC_CAMCLK_HCLK; | ||
407 | else | ||
408 | return -EINVAL; | ||
409 | |||
410 | clk->parent = parent; | ||
411 | |||
412 | __raw_writel(clksrc, S3C2412_CLKSRC); | ||
413 | return 0; | ||
414 | } | ||
415 | static unsigned long s3c2412_getrate_cam(struct clk *clk) | ||
416 | { | ||
417 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
418 | unsigned long div = __raw_readl(S3C2410_CLKDIVN); | ||
419 | |||
420 | div &= S3C2412_CLKDIVN_CAMDIV_MASK; | ||
421 | div >>= S3C2412_CLKDIVN_CAMDIV_SHIFT; | ||
422 | |||
423 | return parent_rate / (div + 1); | ||
424 | } | ||
425 | |||
426 | static int s3c2412_setrate_cam(struct clk *clk, unsigned long rate) | ||
427 | { | ||
428 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
429 | unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN); | ||
430 | |||
431 | rate = s3c2412_roundrate_clksrc(clk, rate); | ||
432 | |||
433 | clkdivn &= ~S3C2412_CLKDIVN_CAMDIV_MASK; | ||
434 | clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_CAMDIV_SHIFT; | ||
435 | |||
436 | __raw_writel(clkdivn, S3C2410_CLKDIVN); | ||
437 | return 0; | ||
438 | } | ||
439 | |||
440 | static struct clk clk_cam = { | ||
441 | .name = "camif-upll", /* same as 2440 name */ | ||
442 | .ops = &(struct clk_ops) { | ||
443 | .get_rate = s3c2412_getrate_cam, | ||
444 | .set_rate = s3c2412_setrate_cam, | ||
445 | .set_parent = s3c2412_setparent_cam, | ||
446 | .round_rate = s3c2412_roundrate_clksrc, | ||
447 | }, | ||
448 | }; | ||
449 | |||
450 | /* standard clock definitions */ | ||
451 | |||
452 | static struct clk init_clocks_disable[] = { | ||
453 | { | ||
454 | .name = "nand", | ||
455 | .parent = &clk_h, | ||
456 | .enable = s3c2412_clkcon_enable, | ||
457 | .ctrlbit = S3C2412_CLKCON_NAND, | ||
458 | }, { | ||
459 | .name = "sdi", | ||
460 | .parent = &clk_p, | ||
461 | .enable = s3c2412_clkcon_enable, | ||
462 | .ctrlbit = S3C2412_CLKCON_SDI, | ||
463 | }, { | ||
464 | .name = "adc", | ||
465 | .parent = &clk_p, | ||
466 | .enable = s3c2412_clkcon_enable, | ||
467 | .ctrlbit = S3C2412_CLKCON_ADC, | ||
468 | }, { | ||
469 | .name = "i2c", | ||
470 | .parent = &clk_p, | ||
471 | .enable = s3c2412_clkcon_enable, | ||
472 | .ctrlbit = S3C2412_CLKCON_IIC, | ||
473 | }, { | ||
474 | .name = "iis", | ||
475 | .parent = &clk_p, | ||
476 | .enable = s3c2412_clkcon_enable, | ||
477 | .ctrlbit = S3C2412_CLKCON_IIS, | ||
478 | }, { | ||
479 | .name = "spi", | ||
480 | .parent = &clk_p, | ||
481 | .enable = s3c2412_clkcon_enable, | ||
482 | .ctrlbit = S3C2412_CLKCON_SPI, | ||
483 | } | ||
484 | }; | ||
485 | |||
486 | static struct clk init_clocks[] = { | ||
487 | { | ||
488 | .name = "dma", | ||
489 | .parent = &clk_h, | ||
490 | .enable = s3c2412_clkcon_enable, | ||
491 | .ctrlbit = S3C2412_CLKCON_DMA0, | ||
492 | }, { | ||
493 | .name = "dma", | ||
494 | .parent = &clk_h, | ||
495 | .enable = s3c2412_clkcon_enable, | ||
496 | .ctrlbit = S3C2412_CLKCON_DMA1, | ||
497 | }, { | ||
498 | .name = "dma", | ||
499 | .parent = &clk_h, | ||
500 | .enable = s3c2412_clkcon_enable, | ||
501 | .ctrlbit = S3C2412_CLKCON_DMA2, | ||
502 | }, { | ||
503 | .name = "dma", | ||
504 | .parent = &clk_h, | ||
505 | .enable = s3c2412_clkcon_enable, | ||
506 | .ctrlbit = S3C2412_CLKCON_DMA3, | ||
507 | }, { | ||
508 | .name = "lcd", | ||
509 | .parent = &clk_h, | ||
510 | .enable = s3c2412_clkcon_enable, | ||
511 | .ctrlbit = S3C2412_CLKCON_LCDC, | ||
512 | }, { | ||
513 | .name = "gpio", | ||
514 | .parent = &clk_p, | ||
515 | .enable = s3c2412_clkcon_enable, | ||
516 | .ctrlbit = S3C2412_CLKCON_GPIO, | ||
517 | }, { | ||
518 | .name = "usb-host", | ||
519 | .parent = &clk_h, | ||
520 | .enable = s3c2412_clkcon_enable, | ||
521 | .ctrlbit = S3C2412_CLKCON_USBH, | ||
522 | }, { | ||
523 | .name = "usb-device", | ||
524 | .parent = &clk_h, | ||
525 | .enable = s3c2412_clkcon_enable, | ||
526 | .ctrlbit = S3C2412_CLKCON_USBD, | ||
527 | }, { | ||
528 | .name = "timers", | ||
529 | .parent = &clk_p, | ||
530 | .enable = s3c2412_clkcon_enable, | ||
531 | .ctrlbit = S3C2412_CLKCON_PWMT, | ||
532 | }, { | ||
533 | .name = "uart", | ||
534 | .devname = "s3c2412-uart.0", | ||
535 | .parent = &clk_p, | ||
536 | .enable = s3c2412_clkcon_enable, | ||
537 | .ctrlbit = S3C2412_CLKCON_UART0, | ||
538 | }, { | ||
539 | .name = "uart", | ||
540 | .devname = "s3c2412-uart.1", | ||
541 | .parent = &clk_p, | ||
542 | .enable = s3c2412_clkcon_enable, | ||
543 | .ctrlbit = S3C2412_CLKCON_UART1, | ||
544 | }, { | ||
545 | .name = "uart", | ||
546 | .devname = "s3c2412-uart.2", | ||
547 | .parent = &clk_p, | ||
548 | .enable = s3c2412_clkcon_enable, | ||
549 | .ctrlbit = S3C2412_CLKCON_UART2, | ||
550 | }, { | ||
551 | .name = "rtc", | ||
552 | .parent = &clk_p, | ||
553 | .enable = s3c2412_clkcon_enable, | ||
554 | .ctrlbit = S3C2412_CLKCON_RTC, | ||
555 | }, { | ||
556 | .name = "watchdog", | ||
557 | .parent = &clk_p, | ||
558 | .ctrlbit = 0, | ||
559 | }, { | ||
560 | .name = "usb-bus-gadget", | ||
561 | .parent = &clk_usb_bus, | ||
562 | .enable = s3c2412_clkcon_enable, | ||
563 | .ctrlbit = S3C2412_CLKCON_USB_DEV48, | ||
564 | }, { | ||
565 | .name = "usb-bus-host", | ||
566 | .parent = &clk_usb_bus, | ||
567 | .enable = s3c2412_clkcon_enable, | ||
568 | .ctrlbit = S3C2412_CLKCON_USB_HOST48, | ||
569 | } | ||
570 | }; | ||
571 | |||
572 | /* clocks to add where we need to check their parentage */ | ||
573 | |||
574 | struct clk_init { | ||
575 | struct clk *clk; | ||
576 | unsigned int bit; | ||
577 | struct clk *src_0; | ||
578 | struct clk *src_1; | ||
579 | }; | ||
580 | |||
581 | static struct clk_init clks_src[] __initdata = { | ||
582 | { | ||
583 | .clk = &clk_usysclk, | ||
584 | .bit = S3C2412_CLKSRC_USBCLK_HCLK, | ||
585 | .src_0 = &clk_urefclk, | ||
586 | .src_1 = &clk_upll, | ||
587 | }, { | ||
588 | .clk = &clk_i2s, | ||
589 | .bit = S3C2412_CLKSRC_I2SCLK_MPLL, | ||
590 | .src_0 = &clk_erefclk, | ||
591 | .src_1 = &clk_mpll, | ||
592 | }, { | ||
593 | .clk = &clk_cam, | ||
594 | .bit = S3C2412_CLKSRC_CAMCLK_HCLK, | ||
595 | .src_0 = &clk_usysclk, | ||
596 | .src_1 = &clk_h, | ||
597 | }, { | ||
598 | .clk = &clk_msysclk, | ||
599 | .bit = S3C2412_CLKSRC_MSYSCLK_MPLL, | ||
600 | .src_0 = &clk_mdivclk, | ||
601 | .src_1 = &clk_mpll, | ||
602 | }, { | ||
603 | .clk = &clk_uart, | ||
604 | .bit = S3C2412_CLKSRC_UARTCLK_MPLL, | ||
605 | .src_0 = &clk_erefclk, | ||
606 | .src_1 = &clk_mpll, | ||
607 | }, { | ||
608 | .clk = &clk_usbsrc, | ||
609 | .bit = S3C2412_CLKSRC_USBCLK_HCLK, | ||
610 | .src_0 = &clk_usysclk, | ||
611 | .src_1 = &clk_h, | ||
612 | /* here we assume OM[4] select xtal */ | ||
613 | }, { | ||
614 | .clk = &clk_erefclk, | ||
615 | .bit = S3C2412_CLKSRC_EREFCLK_EXTCLK, | ||
616 | .src_0 = &clk_xtal, | ||
617 | .src_1 = &clk_ext, | ||
618 | }, { | ||
619 | .clk = &clk_urefclk, | ||
620 | .bit = S3C2412_CLKSRC_UREFCLK_EXTCLK, | ||
621 | .src_0 = &clk_xtal, | ||
622 | .src_1 = &clk_ext, | ||
623 | }, | ||
624 | }; | ||
625 | |||
626 | /* s3c2412_clk_initparents | ||
627 | * | ||
628 | * Initialise the parents for the clocks that we get at start-time | ||
629 | */ | ||
630 | |||
631 | static void __init s3c2412_clk_initparents(void) | ||
632 | { | ||
633 | unsigned long clksrc = __raw_readl(S3C2412_CLKSRC); | ||
634 | struct clk_init *cip = clks_src; | ||
635 | struct clk *src; | ||
636 | int ptr; | ||
637 | int ret; | ||
638 | |||
639 | for (ptr = 0; ptr < ARRAY_SIZE(clks_src); ptr++, cip++) { | ||
640 | ret = s3c24xx_register_clock(cip->clk); | ||
641 | if (ret < 0) { | ||
642 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
643 | cip->clk->name, ret); | ||
644 | } | ||
645 | |||
646 | src = (clksrc & cip->bit) ? cip->src_1 : cip->src_0; | ||
647 | |||
648 | printk(KERN_INFO "%s: parent %s\n", cip->clk->name, src->name); | ||
649 | clk_set_parent(cip->clk, src); | ||
650 | } | ||
651 | } | ||
652 | |||
653 | /* clocks to add straight away */ | ||
654 | |||
655 | static struct clk *clks[] __initdata = { | ||
656 | &clk_ext, | ||
657 | &clk_usb_bus, | ||
658 | &clk_mrefclk, | ||
659 | &clk_armclk, | ||
660 | }; | ||
661 | |||
662 | static struct clk_lookup s3c2412_clk_lookup[] = { | ||
663 | CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), | ||
664 | CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), | ||
665 | CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_usysclk), | ||
666 | }; | ||
667 | |||
668 | int __init s3c2412_baseclk_add(void) | ||
669 | { | ||
670 | unsigned long clkcon = __raw_readl(S3C2410_CLKCON); | ||
671 | unsigned int dvs; | ||
672 | struct clk *clkp; | ||
673 | int ret; | ||
674 | int ptr; | ||
675 | |||
676 | clk_upll.enable = s3c2412_upll_enable; | ||
677 | clk_usb_bus.parent = &clk_usbsrc; | ||
678 | clk_usb_bus.rate = 0x0; | ||
679 | |||
680 | clk_f.parent = &clk_msysclk; | ||
681 | |||
682 | s3c2412_clk_initparents(); | ||
683 | |||
684 | for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) { | ||
685 | clkp = clks[ptr]; | ||
686 | |||
687 | ret = s3c24xx_register_clock(clkp); | ||
688 | if (ret < 0) { | ||
689 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
690 | clkp->name, ret); | ||
691 | } | ||
692 | } | ||
693 | |||
694 | /* set the dvs state according to what we got at boot time */ | ||
695 | |||
696 | dvs = __raw_readl(S3C2410_CLKDIVN) & S3C2412_CLKDIVN_DVSEN; | ||
697 | |||
698 | if (dvs) | ||
699 | clk_armclk.parent = &clk_h; | ||
700 | |||
701 | printk(KERN_INFO "S3C2412: DVS is %s\n", dvs ? "on" : "off"); | ||
702 | |||
703 | /* ensure usb bus clock is within correct rate of 48MHz */ | ||
704 | |||
705 | if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) { | ||
706 | printk(KERN_INFO "Warning: USB bus clock not at 48MHz\n"); | ||
707 | |||
708 | /* for the moment, let's use the UPLL, and see if we can | ||
709 | * get 48MHz */ | ||
710 | |||
711 | clk_set_parent(&clk_usysclk, &clk_upll); | ||
712 | clk_set_parent(&clk_usbsrc, &clk_usysclk); | ||
713 | clk_set_rate(&clk_usbsrc, 48*1000*1000); | ||
714 | } | ||
715 | |||
716 | printk("S3C2412: upll %s, %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n", | ||
717 | (__raw_readl(S3C2410_UPLLCON) & S3C2412_PLLCON_OFF) ? "off":"on", | ||
718 | print_mhz(clk_get_rate(&clk_upll)), | ||
719 | print_mhz(clk_get_rate(&clk_usb_bus))); | ||
720 | |||
721 | /* register clocks from clock array */ | ||
722 | |||
723 | clkp = init_clocks; | ||
724 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { | ||
725 | /* ensure that we note the clock state */ | ||
726 | |||
727 | clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0; | ||
728 | |||
729 | ret = s3c24xx_register_clock(clkp); | ||
730 | if (ret < 0) { | ||
731 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
732 | clkp->name, ret); | ||
733 | } | ||
734 | } | ||
735 | |||
736 | /* We must be careful disabling the clocks we are not intending to | ||
737 | * be using at boot time, as subsystems such as the LCD which do | ||
738 | * their own DMA requests to the bus can cause the system to lockup | ||
739 | * if they where in the middle of requesting bus access. | ||
740 | * | ||
741 | * Disabling the LCD clock if the LCD is active is very dangerous, | ||
742 | * and therefore the bootloader should be careful to not enable | ||
743 | * the LCD clock if it is not needed. | ||
744 | */ | ||
745 | |||
746 | /* install (and disable) the clocks we do not need immediately */ | ||
747 | |||
748 | clkp = init_clocks_disable; | ||
749 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { | ||
750 | |||
751 | ret = s3c24xx_register_clock(clkp); | ||
752 | if (ret < 0) { | ||
753 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
754 | clkp->name, ret); | ||
755 | } | ||
756 | |||
757 | s3c2412_clkcon_enable(clkp, 0); | ||
758 | } | ||
759 | |||
760 | clkdev_add_table(s3c2412_clk_lookup, ARRAY_SIZE(s3c2412_clk_lookup)); | ||
761 | s3c_pwmclk_init(); | ||
762 | return 0; | ||
763 | } | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c new file mode 100644 index 000000000000..dbc9ab4aaca2 --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c2416.c | |||
@@ -0,0 +1,172 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Simtec Electronics | ||
4 | * Copyright (c) 2010 Ben Dooks <ben-linux@fluff.org> | ||
5 | * | ||
6 | * S3C2416 Clock control 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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/clk.h> | ||
16 | |||
17 | #include <plat/s3c2416.h> | ||
18 | #include <plat/clock.h> | ||
19 | #include <plat/clock-clksrc.h> | ||
20 | #include <plat/cpu.h> | ||
21 | |||
22 | #include <plat/cpu-freq.h> | ||
23 | #include <plat/pll.h> | ||
24 | |||
25 | #include <asm/mach/map.h> | ||
26 | |||
27 | #include <mach/regs-clock.h> | ||
28 | #include <mach/regs-s3c2443-clock.h> | ||
29 | |||
30 | /* armdiv | ||
31 | * | ||
32 | * this clock is sourced from msysclk and can have a number of | ||
33 | * divider values applied to it to then be fed into armclk. | ||
34 | * The real clock definition is done in s3c2443-clock.c, | ||
35 | * only the armdiv divisor table must be defined here. | ||
36 | */ | ||
37 | |||
38 | static unsigned int armdiv[8] = { | ||
39 | [0] = 1, | ||
40 | [1] = 2, | ||
41 | [2] = 3, | ||
42 | [3] = 4, | ||
43 | [5] = 6, | ||
44 | [7] = 8, | ||
45 | }; | ||
46 | |||
47 | static struct clksrc_clk hsspi_eplldiv = { | ||
48 | .clk = { | ||
49 | .name = "hsspi-eplldiv", | ||
50 | .parent = &clk_esysclk.clk, | ||
51 | .ctrlbit = (1 << 14), | ||
52 | .enable = s3c2443_clkcon_enable_s, | ||
53 | }, | ||
54 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 24 }, | ||
55 | }; | ||
56 | |||
57 | static struct clk *hsspi_sources[] = { | ||
58 | [0] = &hsspi_eplldiv.clk, | ||
59 | [1] = NULL, /* to fix */ | ||
60 | }; | ||
61 | |||
62 | static struct clksrc_clk hsspi_mux = { | ||
63 | .clk = { | ||
64 | .name = "hsspi-if", | ||
65 | }, | ||
66 | .sources = &(struct clksrc_sources) { | ||
67 | .sources = hsspi_sources, | ||
68 | .nr_sources = ARRAY_SIZE(hsspi_sources), | ||
69 | }, | ||
70 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 18 }, | ||
71 | }; | ||
72 | |||
73 | static struct clksrc_clk hsmmc_div[] = { | ||
74 | [0] = { | ||
75 | .clk = { | ||
76 | .name = "hsmmc-div", | ||
77 | .devname = "s3c-sdhci.0", | ||
78 | .parent = &clk_esysclk.clk, | ||
79 | }, | ||
80 | .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 }, | ||
81 | }, | ||
82 | [1] = { | ||
83 | .clk = { | ||
84 | .name = "hsmmc-div", | ||
85 | .devname = "s3c-sdhci.1", | ||
86 | .parent = &clk_esysclk.clk, | ||
87 | }, | ||
88 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static struct clksrc_clk hsmmc_mux0 = { | ||
93 | .clk = { | ||
94 | .name = "hsmmc-if", | ||
95 | .devname = "s3c-sdhci.0", | ||
96 | .ctrlbit = (1 << 6), | ||
97 | .enable = s3c2443_clkcon_enable_s, | ||
98 | }, | ||
99 | .sources = &(struct clksrc_sources) { | ||
100 | .nr_sources = 2, | ||
101 | .sources = (struct clk * []) { | ||
102 | [0] = &hsmmc_div[0].clk, | ||
103 | [1] = NULL, /* to fix */ | ||
104 | }, | ||
105 | }, | ||
106 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 16 }, | ||
107 | }; | ||
108 | |||
109 | static struct clksrc_clk hsmmc_mux1 = { | ||
110 | .clk = { | ||
111 | .name = "hsmmc-if", | ||
112 | .devname = "s3c-sdhci.1", | ||
113 | .ctrlbit = (1 << 12), | ||
114 | .enable = s3c2443_clkcon_enable_s, | ||
115 | }, | ||
116 | .sources = &(struct clksrc_sources) { | ||
117 | .nr_sources = 2, | ||
118 | .sources = (struct clk * []) { | ||
119 | [0] = &hsmmc_div[1].clk, | ||
120 | [1] = NULL, /* to fix */ | ||
121 | }, | ||
122 | }, | ||
123 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 17 }, | ||
124 | }; | ||
125 | |||
126 | static struct clk hsmmc0_clk = { | ||
127 | .name = "hsmmc", | ||
128 | .devname = "s3c-sdhci.0", | ||
129 | .parent = &clk_h, | ||
130 | .enable = s3c2443_clkcon_enable_h, | ||
131 | .ctrlbit = S3C2416_HCLKCON_HSMMC0, | ||
132 | }; | ||
133 | |||
134 | static struct clksrc_clk *clksrcs[] __initdata = { | ||
135 | &hsspi_eplldiv, | ||
136 | &hsspi_mux, | ||
137 | &hsmmc_div[0], | ||
138 | &hsmmc_div[1], | ||
139 | &hsmmc_mux0, | ||
140 | &hsmmc_mux1, | ||
141 | }; | ||
142 | |||
143 | static struct clk_lookup s3c2416_clk_lookup[] = { | ||
144 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk), | ||
145 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk), | ||
146 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk), | ||
147 | }; | ||
148 | |||
149 | void __init s3c2416_init_clocks(int xtal) | ||
150 | { | ||
151 | u32 epllcon = __raw_readl(S3C2443_EPLLCON); | ||
152 | u32 epllcon1 = __raw_readl(S3C2443_EPLLCON+4); | ||
153 | int ptr; | ||
154 | |||
155 | /* s3c2416 EPLL compatible with s3c64xx */ | ||
156 | clk_epll.rate = s3c_get_pll6553x(xtal, epllcon, epllcon1); | ||
157 | |||
158 | clk_epll.parent = &clk_epllref.clk; | ||
159 | |||
160 | s3c2443_common_init_clocks(xtal, s3c2416_get_pll, | ||
161 | armdiv, ARRAY_SIZE(armdiv), | ||
162 | S3C2416_CLKDIV0_ARMDIV_MASK); | ||
163 | |||
164 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
165 | s3c_register_clksrc(clksrcs[ptr], 1); | ||
166 | |||
167 | s3c24xx_register_clock(&hsmmc0_clk); | ||
168 | clkdev_add_table(s3c2416_clk_lookup, ARRAY_SIZE(s3c2416_clk_lookup)); | ||
169 | |||
170 | s3c_pwmclk_init(); | ||
171 | |||
172 | } | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c new file mode 100644 index 000000000000..414364eb426c --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c | |||
@@ -0,0 +1,194 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2440 Clock support | ||
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 as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/ioport.h> | ||
33 | #include <linux/mutex.h> | ||
34 | #include <linux/clk.h> | ||
35 | #include <linux/io.h> | ||
36 | #include <linux/serial_core.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | #include <linux/atomic.h> | ||
40 | #include <asm/irq.h> | ||
41 | |||
42 | #include <mach/regs-clock.h> | ||
43 | |||
44 | #include <plat/clock.h> | ||
45 | #include <plat/cpu.h> | ||
46 | #include <plat/regs-serial.h> | ||
47 | |||
48 | /* S3C2440 extended clock support */ | ||
49 | |||
50 | static unsigned long s3c2440_camif_upll_round(struct clk *clk, | ||
51 | unsigned long rate) | ||
52 | { | ||
53 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
54 | int div; | ||
55 | |||
56 | if (rate > parent_rate) | ||
57 | return parent_rate; | ||
58 | |||
59 | /* note, we remove the +/- 1 calculations for the divisor */ | ||
60 | |||
61 | div = (parent_rate / rate) / 2; | ||
62 | |||
63 | if (div < 1) | ||
64 | div = 1; | ||
65 | else if (div > 16) | ||
66 | div = 16; | ||
67 | |||
68 | return parent_rate / (div * 2); | ||
69 | } | ||
70 | |||
71 | static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate) | ||
72 | { | ||
73 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
74 | unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); | ||
75 | |||
76 | rate = s3c2440_camif_upll_round(clk, rate); | ||
77 | |||
78 | camdivn &= ~(S3C2440_CAMDIVN_CAMCLK_SEL | S3C2440_CAMDIVN_CAMCLK_MASK); | ||
79 | |||
80 | if (rate != parent_rate) { | ||
81 | camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL; | ||
82 | camdivn |= (((parent_rate / rate) / 2) - 1); | ||
83 | } | ||
84 | |||
85 | __raw_writel(camdivn, S3C2440_CAMDIVN); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | /* Extra S3C2440 clocks */ | ||
91 | |||
92 | static struct clk s3c2440_clk_cam = { | ||
93 | .name = "camif", | ||
94 | .enable = s3c2410_clkcon_enable, | ||
95 | .ctrlbit = S3C2440_CLKCON_CAMERA, | ||
96 | }; | ||
97 | |||
98 | static struct clk s3c2440_clk_cam_upll = { | ||
99 | .name = "camif-upll", | ||
100 | .ops = &(struct clk_ops) { | ||
101 | .set_rate = s3c2440_camif_upll_setrate, | ||
102 | .round_rate = s3c2440_camif_upll_round, | ||
103 | }, | ||
104 | }; | ||
105 | |||
106 | static struct clk s3c2440_clk_ac97 = { | ||
107 | .name = "ac97", | ||
108 | .enable = s3c2410_clkcon_enable, | ||
109 | .ctrlbit = S3C2440_CLKCON_CAMERA, | ||
110 | }; | ||
111 | |||
112 | static unsigned long s3c2440_fclk_n_getrate(struct clk *clk) | ||
113 | { | ||
114 | unsigned long ucon0, ucon1, ucon2, divisor; | ||
115 | |||
116 | /* the fun of calculating the uart divisors on the s3c2440 */ | ||
117 | ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON); | ||
118 | ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON); | ||
119 | ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON); | ||
120 | |||
121 | ucon0 &= S3C2440_UCON0_DIVMASK; | ||
122 | ucon1 &= S3C2440_UCON1_DIVMASK; | ||
123 | ucon2 &= S3C2440_UCON2_DIVMASK; | ||
124 | |||
125 | if (ucon0 != 0) | ||
126 | divisor = (ucon0 >> S3C2440_UCON_DIVSHIFT) + 6; | ||
127 | else if (ucon1 != 0) | ||
128 | divisor = (ucon1 >> S3C2440_UCON_DIVSHIFT) + 21; | ||
129 | else if (ucon2 != 0) | ||
130 | divisor = (ucon2 >> S3C2440_UCON_DIVSHIFT) + 36; | ||
131 | else | ||
132 | /* manual calims 44, seems to be 9 */ | ||
133 | divisor = 9; | ||
134 | |||
135 | return clk_get_rate(clk->parent) / divisor; | ||
136 | } | ||
137 | |||
138 | static struct clk s3c2440_clk_fclk_n = { | ||
139 | .name = "fclk_n", | ||
140 | .parent = &clk_f, | ||
141 | .ops = &(struct clk_ops) { | ||
142 | .get_rate = s3c2440_fclk_n_getrate, | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | static struct clk_lookup s3c2440_clk_lookup[] = { | ||
147 | CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), | ||
148 | CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), | ||
149 | CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), | ||
150 | }; | ||
151 | |||
152 | static int s3c2440_clk_add(struct device *dev, struct subsys_interface *sif) | ||
153 | { | ||
154 | struct clk *clock_upll; | ||
155 | struct clk *clock_h; | ||
156 | struct clk *clock_p; | ||
157 | |||
158 | clock_p = clk_get(NULL, "pclk"); | ||
159 | clock_h = clk_get(NULL, "hclk"); | ||
160 | clock_upll = clk_get(NULL, "upll"); | ||
161 | |||
162 | if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) { | ||
163 | printk(KERN_ERR "S3C2440: Failed to get parent clocks\n"); | ||
164 | return -EINVAL; | ||
165 | } | ||
166 | |||
167 | s3c2440_clk_cam.parent = clock_h; | ||
168 | s3c2440_clk_ac97.parent = clock_p; | ||
169 | s3c2440_clk_cam_upll.parent = clock_upll; | ||
170 | s3c24xx_register_clock(&s3c2440_clk_fclk_n); | ||
171 | |||
172 | s3c24xx_register_clock(&s3c2440_clk_ac97); | ||
173 | s3c24xx_register_clock(&s3c2440_clk_cam); | ||
174 | s3c24xx_register_clock(&s3c2440_clk_cam_upll); | ||
175 | clkdev_add_table(s3c2440_clk_lookup, ARRAY_SIZE(s3c2440_clk_lookup)); | ||
176 | |||
177 | clk_disable(&s3c2440_clk_ac97); | ||
178 | clk_disable(&s3c2440_clk_cam); | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static struct subsys_interface s3c2440_clk_interface = { | ||
184 | .name = "s3c2440_clk", | ||
185 | .subsys = &s3c2440_subsys, | ||
186 | .add_dev = s3c2440_clk_add, | ||
187 | }; | ||
188 | |||
189 | static __init int s3c24xx_clk_init(void) | ||
190 | { | ||
191 | return subsys_interface_register(&s3c2440_clk_interface); | ||
192 | } | ||
193 | |||
194 | arch_initcall(s3c24xx_clk_init); | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c new file mode 100644 index 000000000000..efb3ac359566 --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c | |||
@@ -0,0 +1,215 @@ | |||
1 | /* linux/arch/arm/mach-s3c2443/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2007, 2010 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2443 Clock control 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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/clk.h> | ||
32 | #include <linux/mutex.h> | ||
33 | #include <linux/serial_core.h> | ||
34 | #include <linux/io.h> | ||
35 | |||
36 | #include <asm/mach/map.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | |||
40 | #include <mach/regs-s3c2443-clock.h> | ||
41 | |||
42 | #include <plat/cpu-freq.h> | ||
43 | |||
44 | #include <plat/s3c2443.h> | ||
45 | #include <plat/clock.h> | ||
46 | #include <plat/clock-clksrc.h> | ||
47 | #include <plat/cpu.h> | ||
48 | |||
49 | /* We currently have to assume that the system is running | ||
50 | * from the XTPll input, and that all ***REFCLKs are being | ||
51 | * fed from it, as we cannot read the state of OM[4] from | ||
52 | * software. | ||
53 | * | ||
54 | * It would be possible for each board initialisation to | ||
55 | * set the correct muxing at initialisation | ||
56 | */ | ||
57 | |||
58 | /* clock selections */ | ||
59 | |||
60 | /* armdiv | ||
61 | * | ||
62 | * this clock is sourced from msysclk and can have a number of | ||
63 | * divider values applied to it to then be fed into armclk. | ||
64 | * The real clock definition is done in s3c2443-clock.c, | ||
65 | * only the armdiv divisor table must be defined here. | ||
66 | */ | ||
67 | |||
68 | static unsigned int armdiv[16] = { | ||
69 | [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1, | ||
70 | [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2, | ||
71 | [S3C2443_CLKDIV0_ARMDIV_3 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 3, | ||
72 | [S3C2443_CLKDIV0_ARMDIV_4 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 4, | ||
73 | [S3C2443_CLKDIV0_ARMDIV_6 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 6, | ||
74 | [S3C2443_CLKDIV0_ARMDIV_8 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 8, | ||
75 | [S3C2443_CLKDIV0_ARMDIV_12 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 12, | ||
76 | [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16, | ||
77 | }; | ||
78 | |||
79 | /* hsspi | ||
80 | * | ||
81 | * high-speed spi clock, sourced from esysclk | ||
82 | */ | ||
83 | |||
84 | static struct clksrc_clk clk_hsspi = { | ||
85 | .clk = { | ||
86 | .name = "hsspi-if", | ||
87 | .parent = &clk_esysclk.clk, | ||
88 | .ctrlbit = S3C2443_SCLKCON_HSSPICLK, | ||
89 | .enable = s3c2443_clkcon_enable_s, | ||
90 | }, | ||
91 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 }, | ||
92 | }; | ||
93 | |||
94 | |||
95 | /* clk_hsmcc_div | ||
96 | * | ||
97 | * this clock is sourced from epll, and is fed through a divider, | ||
98 | * to a mux controlled by sclkcon where either it or a extclk can | ||
99 | * be fed to the hsmmc block | ||
100 | */ | ||
101 | |||
102 | static struct clksrc_clk clk_hsmmc_div = { | ||
103 | .clk = { | ||
104 | .name = "hsmmc-div", | ||
105 | .devname = "s3c-sdhci.1", | ||
106 | .parent = &clk_esysclk.clk, | ||
107 | }, | ||
108 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, | ||
109 | }; | ||
110 | |||
111 | static int s3c2443_setparent_hsmmc(struct clk *clk, struct clk *parent) | ||
112 | { | ||
113 | unsigned long clksrc = __raw_readl(S3C2443_SCLKCON); | ||
114 | |||
115 | clksrc &= ~(S3C2443_SCLKCON_HSMMCCLK_EXT | | ||
116 | S3C2443_SCLKCON_HSMMCCLK_EPLL); | ||
117 | |||
118 | if (parent == &clk_epll) | ||
119 | clksrc |= S3C2443_SCLKCON_HSMMCCLK_EPLL; | ||
120 | else if (parent == &clk_ext) | ||
121 | clksrc |= S3C2443_SCLKCON_HSMMCCLK_EXT; | ||
122 | else | ||
123 | return -EINVAL; | ||
124 | |||
125 | if (clk->usage > 0) { | ||
126 | __raw_writel(clksrc, S3C2443_SCLKCON); | ||
127 | } | ||
128 | |||
129 | clk->parent = parent; | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static int s3c2443_enable_hsmmc(struct clk *clk, int enable) | ||
134 | { | ||
135 | return s3c2443_setparent_hsmmc(clk, clk->parent); | ||
136 | } | ||
137 | |||
138 | static struct clk clk_hsmmc = { | ||
139 | .name = "hsmmc-if", | ||
140 | .devname = "s3c-sdhci.1", | ||
141 | .parent = &clk_hsmmc_div.clk, | ||
142 | .enable = s3c2443_enable_hsmmc, | ||
143 | .ops = &(struct clk_ops) { | ||
144 | .set_parent = s3c2443_setparent_hsmmc, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | /* standard clock definitions */ | ||
149 | |||
150 | static struct clk init_clocks_off[] = { | ||
151 | { | ||
152 | .name = "sdi", | ||
153 | .parent = &clk_p, | ||
154 | .enable = s3c2443_clkcon_enable_p, | ||
155 | .ctrlbit = S3C2443_PCLKCON_SDI, | ||
156 | }, { | ||
157 | .name = "spi", | ||
158 | .devname = "s3c2410-spi.0", | ||
159 | .parent = &clk_p, | ||
160 | .enable = s3c2443_clkcon_enable_p, | ||
161 | .ctrlbit = S3C2443_PCLKCON_SPI0, | ||
162 | }, { | ||
163 | .name = "spi", | ||
164 | .devname = "s3c2410-spi.1", | ||
165 | .parent = &clk_p, | ||
166 | .enable = s3c2443_clkcon_enable_p, | ||
167 | .ctrlbit = S3C2443_PCLKCON_SPI1, | ||
168 | } | ||
169 | }; | ||
170 | |||
171 | /* clocks to add straight away */ | ||
172 | |||
173 | static struct clksrc_clk *clksrcs[] __initdata = { | ||
174 | &clk_hsspi, | ||
175 | &clk_hsmmc_div, | ||
176 | }; | ||
177 | |||
178 | static struct clk *clks[] __initdata = { | ||
179 | &clk_hsmmc, | ||
180 | }; | ||
181 | |||
182 | void __init s3c2443_init_clocks(int xtal) | ||
183 | { | ||
184 | unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); | ||
185 | int ptr; | ||
186 | |||
187 | clk_epll.rate = s3c2443_get_epll(epllcon, xtal); | ||
188 | clk_epll.parent = &clk_epllref.clk; | ||
189 | |||
190 | s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, | ||
191 | armdiv, ARRAY_SIZE(armdiv), | ||
192 | S3C2443_CLKDIV0_ARMDIV_MASK); | ||
193 | |||
194 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
195 | |||
196 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
197 | s3c_register_clksrc(clksrcs[ptr], 1); | ||
198 | |||
199 | /* We must be careful disabling the clocks we are not intending to | ||
200 | * be using at boot time, as subsystems such as the LCD which do | ||
201 | * their own DMA requests to the bus can cause the system to lockup | ||
202 | * if they where in the middle of requesting bus access. | ||
203 | * | ||
204 | * Disabling the LCD clock if the LCD is active is very dangerous, | ||
205 | * and therefore the bootloader should be careful to not enable | ||
206 | * the LCD clock if it is not needed. | ||
207 | */ | ||
208 | |||
209 | /* install (and disable) the clocks we do not need immediately */ | ||
210 | |||
211 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
212 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
213 | |||
214 | s3c_pwmclk_init(); | ||
215 | } | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c244x.c b/arch/arm/mach-s3c24xx/clock-s3c244x.c new file mode 100644 index 000000000000..6d9b688c442b --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c244x.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2440/S3C2442 Common clock support | ||
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 as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/ioport.h> | ||
33 | #include <linux/clk.h> | ||
34 | #include <linux/io.h> | ||
35 | |||
36 | #include <mach/hardware.h> | ||
37 | #include <linux/atomic.h> | ||
38 | #include <asm/irq.h> | ||
39 | |||
40 | #include <mach/regs-clock.h> | ||
41 | |||
42 | #include <plat/clock.h> | ||
43 | #include <plat/cpu.h> | ||
44 | |||
45 | static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent) | ||
46 | { | ||
47 | unsigned long camdivn; | ||
48 | unsigned long dvs; | ||
49 | |||
50 | if (parent == &clk_f) | ||
51 | dvs = 0; | ||
52 | else if (parent == &clk_h) | ||
53 | dvs = S3C2440_CAMDIVN_DVSEN; | ||
54 | else | ||
55 | return -EINVAL; | ||
56 | |||
57 | clk->parent = parent; | ||
58 | |||
59 | camdivn = __raw_readl(S3C2440_CAMDIVN); | ||
60 | camdivn &= ~S3C2440_CAMDIVN_DVSEN; | ||
61 | camdivn |= dvs; | ||
62 | __raw_writel(camdivn, S3C2440_CAMDIVN); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static struct clk clk_arm = { | ||
68 | .name = "armclk", | ||
69 | .id = -1, | ||
70 | .ops = &(struct clk_ops) { | ||
71 | .set_parent = s3c2440_setparent_armclk, | ||
72 | }, | ||
73 | }; | ||
74 | |||
75 | static int s3c244x_clk_add(struct device *dev, struct subsys_interface *sif) | ||
76 | { | ||
77 | unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); | ||
78 | unsigned long clkdivn; | ||
79 | struct clk *clock_upll; | ||
80 | int ret; | ||
81 | |||
82 | printk("S3C244X: Clock Support, DVS %s\n", | ||
83 | (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off"); | ||
84 | |||
85 | clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f; | ||
86 | |||
87 | ret = s3c24xx_register_clock(&clk_arm); | ||
88 | if (ret < 0) { | ||
89 | printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret); | ||
90 | return ret; | ||
91 | } | ||
92 | |||
93 | clock_upll = clk_get(NULL, "upll"); | ||
94 | if (IS_ERR(clock_upll)) { | ||
95 | printk(KERN_ERR "S3C244X: Failed to get upll clock\n"); | ||
96 | return -ENOENT; | ||
97 | } | ||
98 | |||
99 | /* check rate of UPLL, and if it is near 96MHz, then change | ||
100 | * to using half the UPLL rate for the system */ | ||
101 | |||
102 | if (clk_get_rate(clock_upll) > (94 * MHZ)) { | ||
103 | clk_usb_bus.rate = clk_get_rate(clock_upll) / 2; | ||
104 | |||
105 | spin_lock(&clocks_lock); | ||
106 | |||
107 | clkdivn = __raw_readl(S3C2410_CLKDIVN); | ||
108 | clkdivn |= S3C2440_CLKDIVN_UCLK; | ||
109 | __raw_writel(clkdivn, S3C2410_CLKDIVN); | ||
110 | |||
111 | spin_unlock(&clocks_lock); | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static struct subsys_interface s3c2440_clk_interface = { | ||
118 | .name = "s3c2440_clk", | ||
119 | .subsys = &s3c2440_subsys, | ||
120 | .add_dev = s3c244x_clk_add, | ||
121 | }; | ||
122 | |||
123 | static int s3c2440_clk_init(void) | ||
124 | { | ||
125 | return subsys_interface_register(&s3c2440_clk_interface); | ||
126 | } | ||
127 | |||
128 | arch_initcall(s3c2440_clk_init); | ||
129 | |||
130 | static struct subsys_interface s3c2442_clk_interface = { | ||
131 | .name = "s3c2442_clk", | ||
132 | .subsys = &s3c2442_subsys, | ||
133 | .add_dev = s3c244x_clk_add, | ||
134 | }; | ||
135 | |||
136 | static int s3c2442_clk_init(void) | ||
137 | { | ||
138 | return subsys_interface_register(&s3c2442_clk_interface); | ||
139 | } | ||
140 | |||
141 | arch_initcall(s3c2442_clk_init); | ||
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c new file mode 100644 index 000000000000..460431589f39 --- /dev/null +++ b/arch/arm/mach-s3c24xx/common-s3c2443.c | |||
@@ -0,0 +1,670 @@ | |||
1 | /* | ||
2 | * Common code for SoCs starting with the S3C2443 | ||
3 | * | ||
4 | * Copyright (c) 2007, 2010 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
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 as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
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/init.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/io.h> | ||
21 | |||
22 | #include <mach/regs-s3c2443-clock.h> | ||
23 | |||
24 | #include <plat/clock.h> | ||
25 | #include <plat/clock-clksrc.h> | ||
26 | #include <plat/cpu.h> | ||
27 | |||
28 | #include <plat/cpu-freq.h> | ||
29 | |||
30 | |||
31 | static int s3c2443_gate(void __iomem *reg, struct clk *clk, int enable) | ||
32 | { | ||
33 | u32 ctrlbit = clk->ctrlbit; | ||
34 | u32 con = __raw_readl(reg); | ||
35 | |||
36 | if (enable) | ||
37 | con |= ctrlbit; | ||
38 | else | ||
39 | con &= ~ctrlbit; | ||
40 | |||
41 | __raw_writel(con, reg); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | int s3c2443_clkcon_enable_h(struct clk *clk, int enable) | ||
46 | { | ||
47 | return s3c2443_gate(S3C2443_HCLKCON, clk, enable); | ||
48 | } | ||
49 | |||
50 | int s3c2443_clkcon_enable_p(struct clk *clk, int enable) | ||
51 | { | ||
52 | return s3c2443_gate(S3C2443_PCLKCON, clk, enable); | ||
53 | } | ||
54 | |||
55 | int s3c2443_clkcon_enable_s(struct clk *clk, int enable) | ||
56 | { | ||
57 | return s3c2443_gate(S3C2443_SCLKCON, clk, enable); | ||
58 | } | ||
59 | |||
60 | /* mpllref is a direct descendant of clk_xtal by default, but it is not | ||
61 | * elided as the EPLL can be either sourced by the XTAL or EXTCLK and as | ||
62 | * such directly equating the two source clocks is impossible. | ||
63 | */ | ||
64 | static struct clk clk_mpllref = { | ||
65 | .name = "mpllref", | ||
66 | .parent = &clk_xtal, | ||
67 | }; | ||
68 | |||
69 | static struct clk *clk_epllref_sources[] = { | ||
70 | [0] = &clk_mpllref, | ||
71 | [1] = &clk_mpllref, | ||
72 | [2] = &clk_xtal, | ||
73 | [3] = &clk_ext, | ||
74 | }; | ||
75 | |||
76 | struct clksrc_clk clk_epllref = { | ||
77 | .clk = { | ||
78 | .name = "epllref", | ||
79 | }, | ||
80 | .sources = &(struct clksrc_sources) { | ||
81 | .sources = clk_epllref_sources, | ||
82 | .nr_sources = ARRAY_SIZE(clk_epllref_sources), | ||
83 | }, | ||
84 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 7 }, | ||
85 | }; | ||
86 | |||
87 | /* esysclk | ||
88 | * | ||
89 | * this is sourced from either the EPLL or the EPLLref clock | ||
90 | */ | ||
91 | |||
92 | static struct clk *clk_sysclk_sources[] = { | ||
93 | [0] = &clk_epllref.clk, | ||
94 | [1] = &clk_epll, | ||
95 | }; | ||
96 | |||
97 | struct clksrc_clk clk_esysclk = { | ||
98 | .clk = { | ||
99 | .name = "esysclk", | ||
100 | .parent = &clk_epll, | ||
101 | }, | ||
102 | .sources = &(struct clksrc_sources) { | ||
103 | .sources = clk_sysclk_sources, | ||
104 | .nr_sources = ARRAY_SIZE(clk_sysclk_sources), | ||
105 | }, | ||
106 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 6 }, | ||
107 | }; | ||
108 | |||
109 | static unsigned long s3c2443_getrate_mdivclk(struct clk *clk) | ||
110 | { | ||
111 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
112 | unsigned long div = __raw_readl(S3C2443_CLKDIV0); | ||
113 | |||
114 | div &= S3C2443_CLKDIV0_EXTDIV_MASK; | ||
115 | div >>= (S3C2443_CLKDIV0_EXTDIV_SHIFT-1); /* x2 */ | ||
116 | |||
117 | return parent_rate / (div + 1); | ||
118 | } | ||
119 | |||
120 | static struct clk clk_mdivclk = { | ||
121 | .name = "mdivclk", | ||
122 | .parent = &clk_mpllref, | ||
123 | .ops = &(struct clk_ops) { | ||
124 | .get_rate = s3c2443_getrate_mdivclk, | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static struct clk *clk_msysclk_sources[] = { | ||
129 | [0] = &clk_mpllref, | ||
130 | [1] = &clk_mpll, | ||
131 | [2] = &clk_mdivclk, | ||
132 | [3] = &clk_mpllref, | ||
133 | }; | ||
134 | |||
135 | struct clksrc_clk clk_msysclk = { | ||
136 | .clk = { | ||
137 | .name = "msysclk", | ||
138 | .parent = &clk_xtal, | ||
139 | }, | ||
140 | .sources = &(struct clksrc_sources) { | ||
141 | .sources = clk_msysclk_sources, | ||
142 | .nr_sources = ARRAY_SIZE(clk_msysclk_sources), | ||
143 | }, | ||
144 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 3 }, | ||
145 | }; | ||
146 | |||
147 | /* prediv | ||
148 | * | ||
149 | * this divides the msysclk down to pass to h/p/etc. | ||
150 | */ | ||
151 | |||
152 | static unsigned long s3c2443_prediv_getrate(struct clk *clk) | ||
153 | { | ||
154 | unsigned long rate = clk_get_rate(clk->parent); | ||
155 | unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); | ||
156 | |||
157 | clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK; | ||
158 | clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT; | ||
159 | |||
160 | return rate / (clkdiv0 + 1); | ||
161 | } | ||
162 | |||
163 | static struct clk clk_prediv = { | ||
164 | .name = "prediv", | ||
165 | .parent = &clk_msysclk.clk, | ||
166 | .ops = &(struct clk_ops) { | ||
167 | .get_rate = s3c2443_prediv_getrate, | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | /* hclk divider | ||
172 | * | ||
173 | * divides the prediv and provides the hclk. | ||
174 | */ | ||
175 | |||
176 | static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk) | ||
177 | { | ||
178 | unsigned long rate = clk_get_rate(clk->parent); | ||
179 | unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); | ||
180 | |||
181 | clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK; | ||
182 | |||
183 | return rate / (clkdiv0 + 1); | ||
184 | } | ||
185 | |||
186 | static struct clk_ops clk_h_ops = { | ||
187 | .get_rate = s3c2443_hclkdiv_getrate, | ||
188 | }; | ||
189 | |||
190 | /* pclk divider | ||
191 | * | ||
192 | * divides the hclk and provides the pclk. | ||
193 | */ | ||
194 | |||
195 | static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk) | ||
196 | { | ||
197 | unsigned long rate = clk_get_rate(clk->parent); | ||
198 | unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); | ||
199 | |||
200 | clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0); | ||
201 | |||
202 | return rate / (clkdiv0 + 1); | ||
203 | } | ||
204 | |||
205 | static struct clk_ops clk_p_ops = { | ||
206 | .get_rate = s3c2443_pclkdiv_getrate, | ||
207 | }; | ||
208 | |||
209 | /* armdiv | ||
210 | * | ||
211 | * this clock is sourced from msysclk and can have a number of | ||
212 | * divider values applied to it to then be fed into armclk. | ||
213 | */ | ||
214 | |||
215 | static unsigned int *armdiv; | ||
216 | static int nr_armdiv; | ||
217 | static int armdivmask; | ||
218 | |||
219 | static unsigned long s3c2443_armclk_roundrate(struct clk *clk, | ||
220 | unsigned long rate) | ||
221 | { | ||
222 | unsigned long parent = clk_get_rate(clk->parent); | ||
223 | unsigned long calc; | ||
224 | unsigned best = 256; /* bigger than any value */ | ||
225 | unsigned div; | ||
226 | int ptr; | ||
227 | |||
228 | if (!nr_armdiv) | ||
229 | return -EINVAL; | ||
230 | |||
231 | for (ptr = 0; ptr < nr_armdiv; ptr++) { | ||
232 | div = armdiv[ptr]; | ||
233 | if (div) { | ||
234 | /* cpufreq provides 266mhz as 266666000 not 266666666 */ | ||
235 | calc = (parent / div / 1000) * 1000; | ||
236 | if (calc <= rate && div < best) | ||
237 | best = div; | ||
238 | } | ||
239 | } | ||
240 | |||
241 | return parent / best; | ||
242 | } | ||
243 | |||
244 | static unsigned long s3c2443_armclk_getrate(struct clk *clk) | ||
245 | { | ||
246 | unsigned long rate = clk_get_rate(clk->parent); | ||
247 | unsigned long clkcon0; | ||
248 | int val; | ||
249 | |||
250 | if (!nr_armdiv || !armdivmask) | ||
251 | return -EINVAL; | ||
252 | |||
253 | clkcon0 = __raw_readl(S3C2443_CLKDIV0); | ||
254 | clkcon0 &= armdivmask; | ||
255 | val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT; | ||
256 | |||
257 | return rate / armdiv[val]; | ||
258 | } | ||
259 | |||
260 | static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate) | ||
261 | { | ||
262 | unsigned long parent = clk_get_rate(clk->parent); | ||
263 | unsigned long calc; | ||
264 | unsigned div; | ||
265 | unsigned best = 256; /* bigger than any value */ | ||
266 | int ptr; | ||
267 | int val = -1; | ||
268 | |||
269 | if (!nr_armdiv || !armdivmask) | ||
270 | return -EINVAL; | ||
271 | |||
272 | for (ptr = 0; ptr < nr_armdiv; ptr++) { | ||
273 | div = armdiv[ptr]; | ||
274 | if (div) { | ||
275 | /* cpufreq provides 266mhz as 266666000 not 266666666 */ | ||
276 | calc = (parent / div / 1000) * 1000; | ||
277 | if (calc <= rate && div < best) { | ||
278 | best = div; | ||
279 | val = ptr; | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | |||
284 | if (val >= 0) { | ||
285 | unsigned long clkcon0; | ||
286 | |||
287 | clkcon0 = __raw_readl(S3C2443_CLKDIV0); | ||
288 | clkcon0 &= ~armdivmask; | ||
289 | clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT; | ||
290 | __raw_writel(clkcon0, S3C2443_CLKDIV0); | ||
291 | } | ||
292 | |||
293 | return (val == -1) ? -EINVAL : 0; | ||
294 | } | ||
295 | |||
296 | static struct clk clk_armdiv = { | ||
297 | .name = "armdiv", | ||
298 | .parent = &clk_msysclk.clk, | ||
299 | .ops = &(struct clk_ops) { | ||
300 | .round_rate = s3c2443_armclk_roundrate, | ||
301 | .get_rate = s3c2443_armclk_getrate, | ||
302 | .set_rate = s3c2443_armclk_setrate, | ||
303 | }, | ||
304 | }; | ||
305 | |||
306 | /* armclk | ||
307 | * | ||
308 | * this is the clock fed into the ARM core itself, from armdiv or from hclk. | ||
309 | */ | ||
310 | |||
311 | static struct clk *clk_arm_sources[] = { | ||
312 | [0] = &clk_armdiv, | ||
313 | [1] = &clk_h, | ||
314 | }; | ||
315 | |||
316 | static struct clksrc_clk clk_arm = { | ||
317 | .clk = { | ||
318 | .name = "armclk", | ||
319 | }, | ||
320 | .sources = &(struct clksrc_sources) { | ||
321 | .sources = clk_arm_sources, | ||
322 | .nr_sources = ARRAY_SIZE(clk_arm_sources), | ||
323 | }, | ||
324 | .reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 }, | ||
325 | }; | ||
326 | |||
327 | /* usbhost | ||
328 | * | ||
329 | * usb host bus-clock, usually 48MHz to provide USB bus clock timing | ||
330 | */ | ||
331 | |||
332 | static struct clksrc_clk clk_usb_bus_host = { | ||
333 | .clk = { | ||
334 | .name = "usb-bus-host-parent", | ||
335 | .parent = &clk_esysclk.clk, | ||
336 | .ctrlbit = S3C2443_SCLKCON_USBHOST, | ||
337 | .enable = s3c2443_clkcon_enable_s, | ||
338 | }, | ||
339 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 }, | ||
340 | }; | ||
341 | |||
342 | /* common clksrc clocks */ | ||
343 | |||
344 | static struct clksrc_clk clksrc_clks[] = { | ||
345 | { | ||
346 | /* camera interface bus-clock, divided down from esysclk */ | ||
347 | .clk = { | ||
348 | .name = "camif-upll", /* same as 2440 name */ | ||
349 | .parent = &clk_esysclk.clk, | ||
350 | .ctrlbit = S3C2443_SCLKCON_CAMCLK, | ||
351 | .enable = s3c2443_clkcon_enable_s, | ||
352 | }, | ||
353 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 26 }, | ||
354 | }, { | ||
355 | .clk = { | ||
356 | .name = "display-if", | ||
357 | .parent = &clk_esysclk.clk, | ||
358 | .ctrlbit = S3C2443_SCLKCON_DISPCLK, | ||
359 | .enable = s3c2443_clkcon_enable_s, | ||
360 | }, | ||
361 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 8, .shift = 16 }, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | static struct clksrc_clk clk_esys_uart = { | ||
366 | /* ART baud-rate clock sourced from esysclk via a divisor */ | ||
367 | .clk = { | ||
368 | .name = "uartclk", | ||
369 | .parent = &clk_esysclk.clk, | ||
370 | }, | ||
371 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 }, | ||
372 | }; | ||
373 | |||
374 | static struct clk clk_i2s_ext = { | ||
375 | .name = "i2s-ext", | ||
376 | }; | ||
377 | |||
378 | /* i2s_eplldiv | ||
379 | * | ||
380 | * This clock is the output from the I2S divisor of ESYSCLK, and is separate | ||
381 | * from the mux that comes after it (cannot merge into one single clock) | ||
382 | */ | ||
383 | |||
384 | static struct clksrc_clk clk_i2s_eplldiv = { | ||
385 | .clk = { | ||
386 | .name = "i2s-eplldiv", | ||
387 | .parent = &clk_esysclk.clk, | ||
388 | }, | ||
389 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, }, | ||
390 | }; | ||
391 | |||
392 | /* i2s-ref | ||
393 | * | ||
394 | * i2s bus reference clock, selectable from external, esysclk or epllref | ||
395 | * | ||
396 | * Note, this used to be two clocks, but was compressed into one. | ||
397 | */ | ||
398 | |||
399 | static struct clk *clk_i2s_srclist[] = { | ||
400 | [0] = &clk_i2s_eplldiv.clk, | ||
401 | [1] = &clk_i2s_ext, | ||
402 | [2] = &clk_epllref.clk, | ||
403 | [3] = &clk_epllref.clk, | ||
404 | }; | ||
405 | |||
406 | static struct clksrc_clk clk_i2s = { | ||
407 | .clk = { | ||
408 | .name = "i2s-if", | ||
409 | .ctrlbit = S3C2443_SCLKCON_I2SCLK, | ||
410 | .enable = s3c2443_clkcon_enable_s, | ||
411 | |||
412 | }, | ||
413 | .sources = &(struct clksrc_sources) { | ||
414 | .sources = clk_i2s_srclist, | ||
415 | .nr_sources = ARRAY_SIZE(clk_i2s_srclist), | ||
416 | }, | ||
417 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 14 }, | ||
418 | }; | ||
419 | |||
420 | static struct clk init_clocks_off[] = { | ||
421 | { | ||
422 | .name = "iis", | ||
423 | .parent = &clk_p, | ||
424 | .enable = s3c2443_clkcon_enable_p, | ||
425 | .ctrlbit = S3C2443_PCLKCON_IIS, | ||
426 | }, { | ||
427 | .name = "hsspi", | ||
428 | .parent = &clk_p, | ||
429 | .enable = s3c2443_clkcon_enable_p, | ||
430 | .ctrlbit = S3C2443_PCLKCON_HSSPI, | ||
431 | }, { | ||
432 | .name = "adc", | ||
433 | .parent = &clk_p, | ||
434 | .enable = s3c2443_clkcon_enable_p, | ||
435 | .ctrlbit = S3C2443_PCLKCON_ADC, | ||
436 | }, { | ||
437 | .name = "i2c", | ||
438 | .parent = &clk_p, | ||
439 | .enable = s3c2443_clkcon_enable_p, | ||
440 | .ctrlbit = S3C2443_PCLKCON_IIC, | ||
441 | } | ||
442 | }; | ||
443 | |||
444 | static struct clk init_clocks[] = { | ||
445 | { | ||
446 | .name = "dma", | ||
447 | .parent = &clk_h, | ||
448 | .enable = s3c2443_clkcon_enable_h, | ||
449 | .ctrlbit = S3C2443_HCLKCON_DMA0, | ||
450 | }, { | ||
451 | .name = "dma", | ||
452 | .parent = &clk_h, | ||
453 | .enable = s3c2443_clkcon_enable_h, | ||
454 | .ctrlbit = S3C2443_HCLKCON_DMA1, | ||
455 | }, { | ||
456 | .name = "dma", | ||
457 | .parent = &clk_h, | ||
458 | .enable = s3c2443_clkcon_enable_h, | ||
459 | .ctrlbit = S3C2443_HCLKCON_DMA2, | ||
460 | }, { | ||
461 | .name = "dma", | ||
462 | .parent = &clk_h, | ||
463 | .enable = s3c2443_clkcon_enable_h, | ||
464 | .ctrlbit = S3C2443_HCLKCON_DMA3, | ||
465 | }, { | ||
466 | .name = "dma", | ||
467 | .parent = &clk_h, | ||
468 | .enable = s3c2443_clkcon_enable_h, | ||
469 | .ctrlbit = S3C2443_HCLKCON_DMA4, | ||
470 | }, { | ||
471 | .name = "dma", | ||
472 | .parent = &clk_h, | ||
473 | .enable = s3c2443_clkcon_enable_h, | ||
474 | .ctrlbit = S3C2443_HCLKCON_DMA5, | ||
475 | }, { | ||
476 | .name = "gpio", | ||
477 | .parent = &clk_p, | ||
478 | .enable = s3c2443_clkcon_enable_p, | ||
479 | .ctrlbit = S3C2443_PCLKCON_GPIO, | ||
480 | }, { | ||
481 | .name = "usb-host", | ||
482 | .parent = &clk_h, | ||
483 | .enable = s3c2443_clkcon_enable_h, | ||
484 | .ctrlbit = S3C2443_HCLKCON_USBH, | ||
485 | }, { | ||
486 | .name = "usb-device", | ||
487 | .parent = &clk_h, | ||
488 | .enable = s3c2443_clkcon_enable_h, | ||
489 | .ctrlbit = S3C2443_HCLKCON_USBD, | ||
490 | }, { | ||
491 | .name = "lcd", | ||
492 | .parent = &clk_h, | ||
493 | .enable = s3c2443_clkcon_enable_h, | ||
494 | .ctrlbit = S3C2443_HCLKCON_LCDC, | ||
495 | |||
496 | }, { | ||
497 | .name = "timers", | ||
498 | .parent = &clk_p, | ||
499 | .enable = s3c2443_clkcon_enable_p, | ||
500 | .ctrlbit = S3C2443_PCLKCON_PWMT, | ||
501 | }, { | ||
502 | .name = "cfc", | ||
503 | .parent = &clk_h, | ||
504 | .enable = s3c2443_clkcon_enable_h, | ||
505 | .ctrlbit = S3C2443_HCLKCON_CFC, | ||
506 | }, { | ||
507 | .name = "ssmc", | ||
508 | .parent = &clk_h, | ||
509 | .enable = s3c2443_clkcon_enable_h, | ||
510 | .ctrlbit = S3C2443_HCLKCON_SSMC, | ||
511 | }, { | ||
512 | .name = "uart", | ||
513 | .devname = "s3c2440-uart.0", | ||
514 | .parent = &clk_p, | ||
515 | .enable = s3c2443_clkcon_enable_p, | ||
516 | .ctrlbit = S3C2443_PCLKCON_UART0, | ||
517 | }, { | ||
518 | .name = "uart", | ||
519 | .devname = "s3c2440-uart.1", | ||
520 | .parent = &clk_p, | ||
521 | .enable = s3c2443_clkcon_enable_p, | ||
522 | .ctrlbit = S3C2443_PCLKCON_UART1, | ||
523 | }, { | ||
524 | .name = "uart", | ||
525 | .devname = "s3c2440-uart.2", | ||
526 | .parent = &clk_p, | ||
527 | .enable = s3c2443_clkcon_enable_p, | ||
528 | .ctrlbit = S3C2443_PCLKCON_UART2, | ||
529 | }, { | ||
530 | .name = "uart", | ||
531 | .devname = "s3c2440-uart.3", | ||
532 | .parent = &clk_p, | ||
533 | .enable = s3c2443_clkcon_enable_p, | ||
534 | .ctrlbit = S3C2443_PCLKCON_UART3, | ||
535 | }, { | ||
536 | .name = "rtc", | ||
537 | .parent = &clk_p, | ||
538 | .enable = s3c2443_clkcon_enable_p, | ||
539 | .ctrlbit = S3C2443_PCLKCON_RTC, | ||
540 | }, { | ||
541 | .name = "watchdog", | ||
542 | .parent = &clk_p, | ||
543 | .ctrlbit = S3C2443_PCLKCON_WDT, | ||
544 | }, { | ||
545 | .name = "ac97", | ||
546 | .parent = &clk_p, | ||
547 | .ctrlbit = S3C2443_PCLKCON_AC97, | ||
548 | }, { | ||
549 | .name = "nand", | ||
550 | .parent = &clk_h, | ||
551 | }, { | ||
552 | .name = "usb-bus-host", | ||
553 | .parent = &clk_usb_bus_host.clk, | ||
554 | } | ||
555 | }; | ||
556 | |||
557 | static struct clk hsmmc1_clk = { | ||
558 | .name = "hsmmc", | ||
559 | .devname = "s3c-sdhci.1", | ||
560 | .parent = &clk_h, | ||
561 | .enable = s3c2443_clkcon_enable_h, | ||
562 | .ctrlbit = S3C2443_HCLKCON_HSMMC, | ||
563 | }; | ||
564 | |||
565 | /* EPLLCON compatible enough to get on/off information */ | ||
566 | |||
567 | void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) | ||
568 | { | ||
569 | unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); | ||
570 | unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); | ||
571 | struct clk *xtal_clk; | ||
572 | unsigned long xtal; | ||
573 | unsigned long pll; | ||
574 | int ptr; | ||
575 | |||
576 | xtal_clk = clk_get(NULL, "xtal"); | ||
577 | xtal = clk_get_rate(xtal_clk); | ||
578 | clk_put(xtal_clk); | ||
579 | |||
580 | pll = get_mpll(mpllcon, xtal); | ||
581 | clk_msysclk.clk.rate = pll; | ||
582 | clk_mpll.rate = pll; | ||
583 | |||
584 | printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n", | ||
585 | (mpllcon & S3C2443_PLLCON_OFF) ? "off" : "on", | ||
586 | print_mhz(pll), print_mhz(clk_get_rate(&clk_armdiv)), | ||
587 | print_mhz(clk_get_rate(&clk_h)), | ||
588 | print_mhz(clk_get_rate(&clk_p))); | ||
589 | |||
590 | for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++) | ||
591 | s3c_set_clksrc(&clksrc_clks[ptr], true); | ||
592 | |||
593 | /* ensure usb bus clock is within correct rate of 48MHz */ | ||
594 | |||
595 | if (clk_get_rate(&clk_usb_bus_host.clk) != (48 * 1000 * 1000)) { | ||
596 | printk(KERN_INFO "Warning: USB host bus not at 48MHz\n"); | ||
597 | clk_set_rate(&clk_usb_bus_host.clk, 48*1000*1000); | ||
598 | } | ||
599 | |||
600 | printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n", | ||
601 | (epllcon & S3C2443_PLLCON_OFF) ? "off" : "on", | ||
602 | print_mhz(clk_get_rate(&clk_epll)), | ||
603 | print_mhz(clk_get_rate(&clk_usb_bus))); | ||
604 | } | ||
605 | |||
606 | static struct clk *clks[] __initdata = { | ||
607 | &clk_prediv, | ||
608 | &clk_mpllref, | ||
609 | &clk_mdivclk, | ||
610 | &clk_ext, | ||
611 | &clk_epll, | ||
612 | &clk_usb_bus, | ||
613 | &clk_armdiv, | ||
614 | &hsmmc1_clk, | ||
615 | }; | ||
616 | |||
617 | static struct clksrc_clk *clksrcs[] __initdata = { | ||
618 | &clk_i2s_eplldiv, | ||
619 | &clk_i2s, | ||
620 | &clk_usb_bus_host, | ||
621 | &clk_epllref, | ||
622 | &clk_esysclk, | ||
623 | &clk_msysclk, | ||
624 | &clk_arm, | ||
625 | }; | ||
626 | |||
627 | static struct clk_lookup s3c2443_clk_lookup[] = { | ||
628 | CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), | ||
629 | CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), | ||
630 | CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk), | ||
631 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk), | ||
632 | }; | ||
633 | |||
634 | void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | ||
635 | unsigned int *divs, int nr_divs, | ||
636 | int divmask) | ||
637 | { | ||
638 | int ptr; | ||
639 | |||
640 | armdiv = divs; | ||
641 | nr_armdiv = nr_divs; | ||
642 | armdivmask = divmask; | ||
643 | |||
644 | /* s3c2443 parents h clock from prediv */ | ||
645 | clk_h.parent = &clk_prediv; | ||
646 | clk_h.ops = &clk_h_ops; | ||
647 | |||
648 | /* and p clock from h clock */ | ||
649 | clk_p.parent = &clk_h; | ||
650 | clk_p.ops = &clk_p_ops; | ||
651 | |||
652 | clk_usb_bus.parent = &clk_usb_bus_host.clk; | ||
653 | clk_epll.parent = &clk_epllref.clk; | ||
654 | |||
655 | s3c24xx_register_baseclocks(xtal); | ||
656 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
657 | |||
658 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
659 | s3c_register_clksrc(clksrcs[ptr], 1); | ||
660 | |||
661 | s3c_register_clksrc(clksrc_clks, ARRAY_SIZE(clksrc_clks)); | ||
662 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
663 | |||
664 | /* See s3c2443/etc notes on disabling clocks at init time */ | ||
665 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
666 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
667 | clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup)); | ||
668 | |||
669 | s3c2443_common_setup_clocks(get_mpll); | ||
670 | } | ||
diff --git a/arch/arm/mach-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c new file mode 100644 index 000000000000..084604be6ad1 --- /dev/null +++ b/arch/arm/mach-s3c24xx/common-smdk.c | |||
@@ -0,0 +1,207 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/common-smdk.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Common code for SMDK2410 and SMDK2440 boards | ||
7 | * | ||
8 | * http://www.fluff.org/ben/smdk2440/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
25 | #include <linux/mtd/mtd.h> | ||
26 | #include <linux/mtd/nand.h> | ||
27 | #include <linux/mtd/nand_ecc.h> | ||
28 | #include <linux/mtd/partitions.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | #include <asm/mach/arch.h> | ||
32 | #include <asm/mach/map.h> | ||
33 | #include <asm/mach/irq.h> | ||
34 | |||
35 | #include <asm/mach-types.h> | ||
36 | #include <mach/hardware.h> | ||
37 | #include <asm/irq.h> | ||
38 | |||
39 | #include <mach/regs-gpio.h> | ||
40 | #include <mach/leds-gpio.h> | ||
41 | |||
42 | #include <plat/nand.h> | ||
43 | |||
44 | #include <plat/common-smdk.h> | ||
45 | #include <plat/gpio-cfg.h> | ||
46 | #include <plat/devs.h> | ||
47 | #include <plat/pm.h> | ||
48 | |||
49 | /* LED devices */ | ||
50 | |||
51 | static struct s3c24xx_led_platdata smdk_pdata_led4 = { | ||
52 | .gpio = S3C2410_GPF(4), | ||
53 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
54 | .name = "led4", | ||
55 | .def_trigger = "timer", | ||
56 | }; | ||
57 | |||
58 | static struct s3c24xx_led_platdata smdk_pdata_led5 = { | ||
59 | .gpio = S3C2410_GPF(5), | ||
60 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
61 | .name = "led5", | ||
62 | .def_trigger = "nand-disk", | ||
63 | }; | ||
64 | |||
65 | static struct s3c24xx_led_platdata smdk_pdata_led6 = { | ||
66 | .gpio = S3C2410_GPF(6), | ||
67 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
68 | .name = "led6", | ||
69 | }; | ||
70 | |||
71 | static struct s3c24xx_led_platdata smdk_pdata_led7 = { | ||
72 | .gpio = S3C2410_GPF(7), | ||
73 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
74 | .name = "led7", | ||
75 | }; | ||
76 | |||
77 | static struct platform_device smdk_led4 = { | ||
78 | .name = "s3c24xx_led", | ||
79 | .id = 0, | ||
80 | .dev = { | ||
81 | .platform_data = &smdk_pdata_led4, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | static struct platform_device smdk_led5 = { | ||
86 | .name = "s3c24xx_led", | ||
87 | .id = 1, | ||
88 | .dev = { | ||
89 | .platform_data = &smdk_pdata_led5, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | static struct platform_device smdk_led6 = { | ||
94 | .name = "s3c24xx_led", | ||
95 | .id = 2, | ||
96 | .dev = { | ||
97 | .platform_data = &smdk_pdata_led6, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | static struct platform_device smdk_led7 = { | ||
102 | .name = "s3c24xx_led", | ||
103 | .id = 3, | ||
104 | .dev = { | ||
105 | .platform_data = &smdk_pdata_led7, | ||
106 | }, | ||
107 | }; | ||
108 | |||
109 | /* NAND parititon from 2.4.18-swl5 */ | ||
110 | |||
111 | static struct mtd_partition smdk_default_nand_part[] = { | ||
112 | [0] = { | ||
113 | .name = "Boot Agent", | ||
114 | .size = SZ_16K, | ||
115 | .offset = 0, | ||
116 | }, | ||
117 | [1] = { | ||
118 | .name = "S3C2410 flash partition 1", | ||
119 | .offset = 0, | ||
120 | .size = SZ_2M, | ||
121 | }, | ||
122 | [2] = { | ||
123 | .name = "S3C2410 flash partition 2", | ||
124 | .offset = SZ_4M, | ||
125 | .size = SZ_4M, | ||
126 | }, | ||
127 | [3] = { | ||
128 | .name = "S3C2410 flash partition 3", | ||
129 | .offset = SZ_8M, | ||
130 | .size = SZ_2M, | ||
131 | }, | ||
132 | [4] = { | ||
133 | .name = "S3C2410 flash partition 4", | ||
134 | .offset = SZ_1M * 10, | ||
135 | .size = SZ_4M, | ||
136 | }, | ||
137 | [5] = { | ||
138 | .name = "S3C2410 flash partition 5", | ||
139 | .offset = SZ_1M * 14, | ||
140 | .size = SZ_1M * 10, | ||
141 | }, | ||
142 | [6] = { | ||
143 | .name = "S3C2410 flash partition 6", | ||
144 | .offset = SZ_1M * 24, | ||
145 | .size = SZ_1M * 24, | ||
146 | }, | ||
147 | [7] = { | ||
148 | .name = "S3C2410 flash partition 7", | ||
149 | .offset = SZ_1M * 48, | ||
150 | .size = MTDPART_SIZ_FULL, | ||
151 | } | ||
152 | }; | ||
153 | |||
154 | static struct s3c2410_nand_set smdk_nand_sets[] = { | ||
155 | [0] = { | ||
156 | .name = "NAND", | ||
157 | .nr_chips = 1, | ||
158 | .nr_partitions = ARRAY_SIZE(smdk_default_nand_part), | ||
159 | .partitions = smdk_default_nand_part, | ||
160 | }, | ||
161 | }; | ||
162 | |||
163 | /* choose a set of timings which should suit most 512Mbit | ||
164 | * chips and beyond. | ||
165 | */ | ||
166 | |||
167 | static struct s3c2410_platform_nand smdk_nand_info = { | ||
168 | .tacls = 20, | ||
169 | .twrph0 = 60, | ||
170 | .twrph1 = 20, | ||
171 | .nr_sets = ARRAY_SIZE(smdk_nand_sets), | ||
172 | .sets = smdk_nand_sets, | ||
173 | }; | ||
174 | |||
175 | /* devices we initialise */ | ||
176 | |||
177 | static struct platform_device __initdata *smdk_devs[] = { | ||
178 | &s3c_device_nand, | ||
179 | &smdk_led4, | ||
180 | &smdk_led5, | ||
181 | &smdk_led6, | ||
182 | &smdk_led7, | ||
183 | }; | ||
184 | |||
185 | void __init smdk_machine_init(void) | ||
186 | { | ||
187 | /* Configure the LEDs (even if we have no LED support)*/ | ||
188 | |||
189 | s3c_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT); | ||
190 | s3c_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT); | ||
191 | s3c_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT); | ||
192 | s3c_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT); | ||
193 | |||
194 | s3c2410_gpio_setpin(S3C2410_GPF(4), 1); | ||
195 | s3c2410_gpio_setpin(S3C2410_GPF(5), 1); | ||
196 | s3c2410_gpio_setpin(S3C2410_GPF(6), 1); | ||
197 | s3c2410_gpio_setpin(S3C2410_GPF(7), 1); | ||
198 | |||
199 | if (machine_is_smdk2443()) | ||
200 | smdk_nand_info.twrph0 = 50; | ||
201 | |||
202 | s3c_nand_set_platdata(&smdk_nand_info); | ||
203 | |||
204 | platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); | ||
205 | |||
206 | s3c_pm_init(); | ||
207 | } | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2410.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c new file mode 100644 index 000000000000..4803338cf56e --- /dev/null +++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c | |||
@@ -0,0 +1,186 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 DMA selection | ||
7 | * | ||
8 | * http://armlinux.simtec.co.uk/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | |||
20 | #include <mach/map.h> | ||
21 | #include <mach/dma.h> | ||
22 | |||
23 | #include <plat/cpu.h> | ||
24 | #include <plat/dma-s3c24xx.h> | ||
25 | |||
26 | #include <plat/regs-serial.h> | ||
27 | #include <mach/regs-gpio.h> | ||
28 | #include <plat/regs-ac97.h> | ||
29 | #include <plat/regs-dma.h> | ||
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | ||
32 | #include <mach/regs-sdi.h> | ||
33 | #include <plat/regs-iis.h> | ||
34 | #include <plat/regs-spi.h> | ||
35 | |||
36 | static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = { | ||
37 | [DMACH_XD0] = { | ||
38 | .name = "xdreq0", | ||
39 | .channels[0] = S3C2410_DCON_CH0_XDREQ0 | DMA_CH_VALID, | ||
40 | }, | ||
41 | [DMACH_XD1] = { | ||
42 | .name = "xdreq1", | ||
43 | .channels[1] = S3C2410_DCON_CH1_XDREQ1 | DMA_CH_VALID, | ||
44 | }, | ||
45 | [DMACH_SDI] = { | ||
46 | .name = "sdi", | ||
47 | .channels[0] = S3C2410_DCON_CH0_SDI | DMA_CH_VALID, | ||
48 | .channels[2] = S3C2410_DCON_CH2_SDI | DMA_CH_VALID, | ||
49 | .channels[3] = S3C2410_DCON_CH3_SDI | DMA_CH_VALID, | ||
50 | }, | ||
51 | [DMACH_SPI0] = { | ||
52 | .name = "spi0", | ||
53 | .channels[1] = S3C2410_DCON_CH1_SPI | DMA_CH_VALID, | ||
54 | }, | ||
55 | [DMACH_SPI1] = { | ||
56 | .name = "spi1", | ||
57 | .channels[3] = S3C2410_DCON_CH3_SPI | DMA_CH_VALID, | ||
58 | }, | ||
59 | [DMACH_UART0] = { | ||
60 | .name = "uart0", | ||
61 | .channels[0] = S3C2410_DCON_CH0_UART0 | DMA_CH_VALID, | ||
62 | }, | ||
63 | [DMACH_UART1] = { | ||
64 | .name = "uart1", | ||
65 | .channels[1] = S3C2410_DCON_CH1_UART1 | DMA_CH_VALID, | ||
66 | }, | ||
67 | [DMACH_UART2] = { | ||
68 | .name = "uart2", | ||
69 | .channels[3] = S3C2410_DCON_CH3_UART2 | DMA_CH_VALID, | ||
70 | }, | ||
71 | [DMACH_TIMER] = { | ||
72 | .name = "timer", | ||
73 | .channels[0] = S3C2410_DCON_CH0_TIMER | DMA_CH_VALID, | ||
74 | .channels[2] = S3C2410_DCON_CH2_TIMER | DMA_CH_VALID, | ||
75 | .channels[3] = S3C2410_DCON_CH3_TIMER | DMA_CH_VALID, | ||
76 | }, | ||
77 | [DMACH_I2S_IN] = { | ||
78 | .name = "i2s-sdi", | ||
79 | .channels[1] = S3C2410_DCON_CH1_I2SSDI | DMA_CH_VALID, | ||
80 | .channels[2] = S3C2410_DCON_CH2_I2SSDI | DMA_CH_VALID, | ||
81 | }, | ||
82 | [DMACH_I2S_OUT] = { | ||
83 | .name = "i2s-sdo", | ||
84 | .channels[2] = S3C2410_DCON_CH2_I2SSDO | DMA_CH_VALID, | ||
85 | }, | ||
86 | [DMACH_USB_EP1] = { | ||
87 | .name = "usb-ep1", | ||
88 | .channels[0] = S3C2410_DCON_CH0_USBEP1 | DMA_CH_VALID, | ||
89 | }, | ||
90 | [DMACH_USB_EP2] = { | ||
91 | .name = "usb-ep2", | ||
92 | .channels[1] = S3C2410_DCON_CH1_USBEP2 | DMA_CH_VALID, | ||
93 | }, | ||
94 | [DMACH_USB_EP3] = { | ||
95 | .name = "usb-ep3", | ||
96 | .channels[2] = S3C2410_DCON_CH2_USBEP3 | DMA_CH_VALID, | ||
97 | }, | ||
98 | [DMACH_USB_EP4] = { | ||
99 | .name = "usb-ep4", | ||
100 | .channels[3] =S3C2410_DCON_CH3_USBEP4 | DMA_CH_VALID, | ||
101 | }, | ||
102 | }; | ||
103 | |||
104 | static void s3c2410_dma_select(struct s3c2410_dma_chan *chan, | ||
105 | struct s3c24xx_dma_map *map) | ||
106 | { | ||
107 | chan->dcon = map->channels[chan->number] & ~DMA_CH_VALID; | ||
108 | } | ||
109 | |||
110 | static struct s3c24xx_dma_selection __initdata s3c2410_dma_sel = { | ||
111 | .select = s3c2410_dma_select, | ||
112 | .dcon_mask = 7 << 24, | ||
113 | .map = s3c2410_dma_mappings, | ||
114 | .map_size = ARRAY_SIZE(s3c2410_dma_mappings), | ||
115 | }; | ||
116 | |||
117 | static struct s3c24xx_dma_order __initdata s3c2410_dma_order = { | ||
118 | .channels = { | ||
119 | [DMACH_SDI] = { | ||
120 | .list = { | ||
121 | [0] = 3 | DMA_CH_VALID, | ||
122 | [1] = 2 | DMA_CH_VALID, | ||
123 | [2] = 0 | DMA_CH_VALID, | ||
124 | }, | ||
125 | }, | ||
126 | [DMACH_I2S_IN] = { | ||
127 | .list = { | ||
128 | [0] = 1 | DMA_CH_VALID, | ||
129 | [1] = 2 | DMA_CH_VALID, | ||
130 | }, | ||
131 | }, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | static int __init s3c2410_dma_add(struct device *dev, | ||
136 | struct subsys_interface *sif) | ||
137 | { | ||
138 | s3c2410_dma_init(); | ||
139 | s3c24xx_dma_order_set(&s3c2410_dma_order); | ||
140 | return s3c24xx_dma_init_map(&s3c2410_dma_sel); | ||
141 | } | ||
142 | |||
143 | #if defined(CONFIG_CPU_S3C2410) | ||
144 | static struct subsys_interface s3c2410_dma_interface = { | ||
145 | .name = "s3c2410_dma", | ||
146 | .subsys = &s3c2410_subsys, | ||
147 | .add_dev = s3c2410_dma_add, | ||
148 | }; | ||
149 | |||
150 | static int __init s3c2410_dma_drvinit(void) | ||
151 | { | ||
152 | return subsys_interface_register(&s3c2410_dma_interface); | ||
153 | } | ||
154 | |||
155 | arch_initcall(s3c2410_dma_drvinit); | ||
156 | |||
157 | static struct subsys_interface s3c2410a_dma_interface = { | ||
158 | .name = "s3c2410a_dma", | ||
159 | .subsys = &s3c2410a_subsys, | ||
160 | .add_dev = s3c2410_dma_add, | ||
161 | }; | ||
162 | |||
163 | static int __init s3c2410a_dma_drvinit(void) | ||
164 | { | ||
165 | return subsys_interface_register(&s3c2410a_dma_interface); | ||
166 | } | ||
167 | |||
168 | arch_initcall(s3c2410a_dma_drvinit); | ||
169 | #endif | ||
170 | |||
171 | #if defined(CONFIG_CPU_S3C2442) | ||
172 | /* S3C2442 DMA contains the same selection table as the S3C2410 */ | ||
173 | static struct subsys_interface s3c2442_dma_interface = { | ||
174 | .name = "s3c2442_dma", | ||
175 | .subsys = &s3c2442_subsys, | ||
176 | .add_dev = s3c2410_dma_add, | ||
177 | }; | ||
178 | |||
179 | static int __init s3c2442_dma_drvinit(void) | ||
180 | { | ||
181 | return subsys_interface_register(&s3c2442_dma_interface); | ||
182 | } | ||
183 | |||
184 | arch_initcall(s3c2442_dma_drvinit); | ||
185 | #endif | ||
186 | |||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c new file mode 100644 index 000000000000..38472ac920ff --- /dev/null +++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c | |||
@@ -0,0 +1,180 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2412 DMA selection | ||
7 | * | ||
8 | * http://armlinux.simtec.co.uk/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
21 | #include <mach/dma.h> | ||
22 | |||
23 | #include <plat/dma-s3c24xx.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | #include <plat/regs-serial.h> | ||
27 | #include <mach/regs-gpio.h> | ||
28 | #include <plat/regs-ac97.h> | ||
29 | #include <plat/regs-dma.h> | ||
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | ||
32 | #include <mach/regs-sdi.h> | ||
33 | #include <plat/regs-iis.h> | ||
34 | #include <plat/regs-spi.h> | ||
35 | |||
36 | #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID } | ||
37 | |||
38 | static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = { | ||
39 | [DMACH_XD0] = { | ||
40 | .name = "xdreq0", | ||
41 | .channels = MAP(S3C2412_DMAREQSEL_XDREQ0), | ||
42 | .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ0), | ||
43 | }, | ||
44 | [DMACH_XD1] = { | ||
45 | .name = "xdreq1", | ||
46 | .channels = MAP(S3C2412_DMAREQSEL_XDREQ1), | ||
47 | .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ1), | ||
48 | }, | ||
49 | [DMACH_SDI] = { | ||
50 | .name = "sdi", | ||
51 | .channels = MAP(S3C2412_DMAREQSEL_SDI), | ||
52 | .channels_rx = MAP(S3C2412_DMAREQSEL_SDI), | ||
53 | }, | ||
54 | [DMACH_SPI0] = { | ||
55 | .name = "spi0", | ||
56 | .channels = MAP(S3C2412_DMAREQSEL_SPI0TX), | ||
57 | .channels_rx = MAP(S3C2412_DMAREQSEL_SPI0RX), | ||
58 | }, | ||
59 | [DMACH_SPI1] = { | ||
60 | .name = "spi1", | ||
61 | .channels = MAP(S3C2412_DMAREQSEL_SPI1TX), | ||
62 | .channels_rx = MAP(S3C2412_DMAREQSEL_SPI1RX), | ||
63 | }, | ||
64 | [DMACH_UART0] = { | ||
65 | .name = "uart0", | ||
66 | .channels = MAP(S3C2412_DMAREQSEL_UART0_0), | ||
67 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_0), | ||
68 | }, | ||
69 | [DMACH_UART1] = { | ||
70 | .name = "uart1", | ||
71 | .channels = MAP(S3C2412_DMAREQSEL_UART1_0), | ||
72 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_0), | ||
73 | }, | ||
74 | [DMACH_UART2] = { | ||
75 | .name = "uart2", | ||
76 | .channels = MAP(S3C2412_DMAREQSEL_UART2_0), | ||
77 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_0), | ||
78 | }, | ||
79 | [DMACH_UART0_SRC2] = { | ||
80 | .name = "uart0", | ||
81 | .channels = MAP(S3C2412_DMAREQSEL_UART0_1), | ||
82 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_1), | ||
83 | }, | ||
84 | [DMACH_UART1_SRC2] = { | ||
85 | .name = "uart1", | ||
86 | .channels = MAP(S3C2412_DMAREQSEL_UART1_1), | ||
87 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_1), | ||
88 | }, | ||
89 | [DMACH_UART2_SRC2] = { | ||
90 | .name = "uart2", | ||
91 | .channels = MAP(S3C2412_DMAREQSEL_UART2_1), | ||
92 | .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_1), | ||
93 | }, | ||
94 | [DMACH_TIMER] = { | ||
95 | .name = "timer", | ||
96 | .channels = MAP(S3C2412_DMAREQSEL_TIMER), | ||
97 | .channels_rx = MAP(S3C2412_DMAREQSEL_TIMER), | ||
98 | }, | ||
99 | [DMACH_I2S_IN] = { | ||
100 | .name = "i2s-sdi", | ||
101 | .channels = MAP(S3C2412_DMAREQSEL_I2SRX), | ||
102 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX), | ||
103 | }, | ||
104 | [DMACH_I2S_OUT] = { | ||
105 | .name = "i2s-sdo", | ||
106 | .channels = MAP(S3C2412_DMAREQSEL_I2STX), | ||
107 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2STX), | ||
108 | }, | ||
109 | [DMACH_USB_EP1] = { | ||
110 | .name = "usb-ep1", | ||
111 | .channels = MAP(S3C2412_DMAREQSEL_USBEP1), | ||
112 | .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP1), | ||
113 | }, | ||
114 | [DMACH_USB_EP2] = { | ||
115 | .name = "usb-ep2", | ||
116 | .channels = MAP(S3C2412_DMAREQSEL_USBEP2), | ||
117 | .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP2), | ||
118 | }, | ||
119 | [DMACH_USB_EP3] = { | ||
120 | .name = "usb-ep3", | ||
121 | .channels = MAP(S3C2412_DMAREQSEL_USBEP3), | ||
122 | .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP3), | ||
123 | }, | ||
124 | [DMACH_USB_EP4] = { | ||
125 | .name = "usb-ep4", | ||
126 | .channels = MAP(S3C2412_DMAREQSEL_USBEP4), | ||
127 | .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP4), | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | static void s3c2412_dma_direction(struct s3c2410_dma_chan *chan, | ||
132 | struct s3c24xx_dma_map *map, | ||
133 | enum dma_data_direction dir) | ||
134 | { | ||
135 | unsigned long chsel; | ||
136 | |||
137 | if (dir == DMA_FROM_DEVICE) | ||
138 | chsel = map->channels_rx[0]; | ||
139 | else | ||
140 | chsel = map->channels[0]; | ||
141 | |||
142 | chsel &= ~DMA_CH_VALID; | ||
143 | chsel |= S3C2412_DMAREQSEL_HW; | ||
144 | |||
145 | writel(chsel, chan->regs + S3C2412_DMA_DMAREQSEL); | ||
146 | } | ||
147 | |||
148 | static void s3c2412_dma_select(struct s3c2410_dma_chan *chan, | ||
149 | struct s3c24xx_dma_map *map) | ||
150 | { | ||
151 | s3c2412_dma_direction(chan, map, chan->source); | ||
152 | } | ||
153 | |||
154 | static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = { | ||
155 | .select = s3c2412_dma_select, | ||
156 | .direction = s3c2412_dma_direction, | ||
157 | .dcon_mask = 0, | ||
158 | .map = s3c2412_dma_mappings, | ||
159 | .map_size = ARRAY_SIZE(s3c2412_dma_mappings), | ||
160 | }; | ||
161 | |||
162 | static int __init s3c2412_dma_add(struct device *dev, | ||
163 | struct subsys_interface *sif) | ||
164 | { | ||
165 | s3c2410_dma_init(); | ||
166 | return s3c24xx_dma_init_map(&s3c2412_dma_sel); | ||
167 | } | ||
168 | |||
169 | static struct subsys_interface s3c2412_dma_interface = { | ||
170 | .name = "s3c2412_dma", | ||
171 | .subsys = &s3c2412_subsys, | ||
172 | .add_dev = s3c2412_dma_add, | ||
173 | }; | ||
174 | |||
175 | static int __init s3c2412_dma_init(void) | ||
176 | { | ||
177 | return subsys_interface_register(&s3c2412_dma_interface); | ||
178 | } | ||
179 | |||
180 | arch_initcall(s3c2412_dma_init); | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2440.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c new file mode 100644 index 000000000000..5f0a0c8ef84f --- /dev/null +++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c | |||
@@ -0,0 +1,197 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2440 DMA selection | ||
7 | * | ||
8 | * http://armlinux.simtec.co.uk/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | |||
20 | #include <mach/map.h> | ||
21 | #include <mach/dma.h> | ||
22 | |||
23 | #include <plat/dma-s3c24xx.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | #include <plat/regs-serial.h> | ||
27 | #include <mach/regs-gpio.h> | ||
28 | #include <plat/regs-ac97.h> | ||
29 | #include <plat/regs-dma.h> | ||
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | ||
32 | #include <mach/regs-sdi.h> | ||
33 | #include <plat/regs-iis.h> | ||
34 | #include <plat/regs-spi.h> | ||
35 | |||
36 | static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = { | ||
37 | [DMACH_XD0] = { | ||
38 | .name = "xdreq0", | ||
39 | .channels[0] = S3C2410_DCON_CH0_XDREQ0 | DMA_CH_VALID, | ||
40 | }, | ||
41 | [DMACH_XD1] = { | ||
42 | .name = "xdreq1", | ||
43 | .channels[1] = S3C2410_DCON_CH1_XDREQ1 | DMA_CH_VALID, | ||
44 | }, | ||
45 | [DMACH_SDI] = { | ||
46 | .name = "sdi", | ||
47 | .channels[0] = S3C2410_DCON_CH0_SDI | DMA_CH_VALID, | ||
48 | .channels[1] = S3C2440_DCON_CH1_SDI | DMA_CH_VALID, | ||
49 | .channels[2] = S3C2410_DCON_CH2_SDI | DMA_CH_VALID, | ||
50 | .channels[3] = S3C2410_DCON_CH3_SDI | DMA_CH_VALID, | ||
51 | }, | ||
52 | [DMACH_SPI0] = { | ||
53 | .name = "spi0", | ||
54 | .channels[1] = S3C2410_DCON_CH1_SPI | DMA_CH_VALID, | ||
55 | }, | ||
56 | [DMACH_SPI1] = { | ||
57 | .name = "spi1", | ||
58 | .channels[3] = S3C2410_DCON_CH3_SPI | DMA_CH_VALID, | ||
59 | }, | ||
60 | [DMACH_UART0] = { | ||
61 | .name = "uart0", | ||
62 | .channels[0] = S3C2410_DCON_CH0_UART0 | DMA_CH_VALID, | ||
63 | }, | ||
64 | [DMACH_UART1] = { | ||
65 | .name = "uart1", | ||
66 | .channels[1] = S3C2410_DCON_CH1_UART1 | DMA_CH_VALID, | ||
67 | }, | ||
68 | [DMACH_UART2] = { | ||
69 | .name = "uart2", | ||
70 | .channels[3] = S3C2410_DCON_CH3_UART2 | DMA_CH_VALID, | ||
71 | }, | ||
72 | [DMACH_TIMER] = { | ||
73 | .name = "timer", | ||
74 | .channels[0] = S3C2410_DCON_CH0_TIMER | DMA_CH_VALID, | ||
75 | .channels[2] = S3C2410_DCON_CH2_TIMER | DMA_CH_VALID, | ||
76 | .channels[3] = S3C2410_DCON_CH3_TIMER | DMA_CH_VALID, | ||
77 | }, | ||
78 | [DMACH_I2S_IN] = { | ||
79 | .name = "i2s-sdi", | ||
80 | .channels[1] = S3C2410_DCON_CH1_I2SSDI | DMA_CH_VALID, | ||
81 | .channels[2] = S3C2410_DCON_CH2_I2SSDI | DMA_CH_VALID, | ||
82 | }, | ||
83 | [DMACH_I2S_OUT] = { | ||
84 | .name = "i2s-sdo", | ||
85 | .channels[0] = S3C2440_DCON_CH0_I2SSDO | DMA_CH_VALID, | ||
86 | .channels[2] = S3C2410_DCON_CH2_I2SSDO | DMA_CH_VALID, | ||
87 | }, | ||
88 | [DMACH_PCM_IN] = { | ||
89 | .name = "pcm-in", | ||
90 | .channels[0] = S3C2440_DCON_CH0_PCMIN | DMA_CH_VALID, | ||
91 | .channels[2] = S3C2440_DCON_CH2_PCMIN | DMA_CH_VALID, | ||
92 | }, | ||
93 | [DMACH_PCM_OUT] = { | ||
94 | .name = "pcm-out", | ||
95 | .channels[1] = S3C2440_DCON_CH1_PCMOUT | DMA_CH_VALID, | ||
96 | .channels[3] = S3C2440_DCON_CH3_PCMOUT | DMA_CH_VALID, | ||
97 | }, | ||
98 | [DMACH_MIC_IN] = { | ||
99 | .name = "mic-in", | ||
100 | .channels[2] = S3C2440_DCON_CH2_MICIN | DMA_CH_VALID, | ||
101 | .channels[3] = S3C2440_DCON_CH3_MICIN | DMA_CH_VALID, | ||
102 | }, | ||
103 | [DMACH_USB_EP1] = { | ||
104 | .name = "usb-ep1", | ||
105 | .channels[0] = S3C2410_DCON_CH0_USBEP1 | DMA_CH_VALID, | ||
106 | }, | ||
107 | [DMACH_USB_EP2] = { | ||
108 | .name = "usb-ep2", | ||
109 | .channels[1] = S3C2410_DCON_CH1_USBEP2 | DMA_CH_VALID, | ||
110 | }, | ||
111 | [DMACH_USB_EP3] = { | ||
112 | .name = "usb-ep3", | ||
113 | .channels[2] = S3C2410_DCON_CH2_USBEP3 | DMA_CH_VALID, | ||
114 | }, | ||
115 | [DMACH_USB_EP4] = { | ||
116 | .name = "usb-ep4", | ||
117 | .channels[3] = S3C2410_DCON_CH3_USBEP4 | DMA_CH_VALID, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | static void s3c2440_dma_select(struct s3c2410_dma_chan *chan, | ||
122 | struct s3c24xx_dma_map *map) | ||
123 | { | ||
124 | chan->dcon = map->channels[chan->number] & ~DMA_CH_VALID; | ||
125 | } | ||
126 | |||
127 | static struct s3c24xx_dma_selection __initdata s3c2440_dma_sel = { | ||
128 | .select = s3c2440_dma_select, | ||
129 | .dcon_mask = 7 << 24, | ||
130 | .map = s3c2440_dma_mappings, | ||
131 | .map_size = ARRAY_SIZE(s3c2440_dma_mappings), | ||
132 | }; | ||
133 | |||
134 | static struct s3c24xx_dma_order __initdata s3c2440_dma_order = { | ||
135 | .channels = { | ||
136 | [DMACH_SDI] = { | ||
137 | .list = { | ||
138 | [0] = 3 | DMA_CH_VALID, | ||
139 | [1] = 2 | DMA_CH_VALID, | ||
140 | [2] = 1 | DMA_CH_VALID, | ||
141 | [3] = 0 | DMA_CH_VALID, | ||
142 | }, | ||
143 | }, | ||
144 | [DMACH_I2S_IN] = { | ||
145 | .list = { | ||
146 | [0] = 1 | DMA_CH_VALID, | ||
147 | [1] = 2 | DMA_CH_VALID, | ||
148 | }, | ||
149 | }, | ||
150 | [DMACH_I2S_OUT] = { | ||
151 | .list = { | ||
152 | [0] = 2 | DMA_CH_VALID, | ||
153 | [1] = 1 | DMA_CH_VALID, | ||
154 | }, | ||
155 | }, | ||
156 | [DMACH_PCM_IN] = { | ||
157 | .list = { | ||
158 | [0] = 2 | DMA_CH_VALID, | ||
159 | [1] = 1 | DMA_CH_VALID, | ||
160 | }, | ||
161 | }, | ||
162 | [DMACH_PCM_OUT] = { | ||
163 | .list = { | ||
164 | [0] = 1 | DMA_CH_VALID, | ||
165 | [1] = 3 | DMA_CH_VALID, | ||
166 | }, | ||
167 | }, | ||
168 | [DMACH_MIC_IN] = { | ||
169 | .list = { | ||
170 | [0] = 3 | DMA_CH_VALID, | ||
171 | [1] = 2 | DMA_CH_VALID, | ||
172 | }, | ||
173 | }, | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | static int __init s3c2440_dma_add(struct device *dev, | ||
178 | struct subsys_interface *sif) | ||
179 | { | ||
180 | s3c2410_dma_init(); | ||
181 | s3c24xx_dma_order_set(&s3c2440_dma_order); | ||
182 | return s3c24xx_dma_init_map(&s3c2440_dma_sel); | ||
183 | } | ||
184 | |||
185 | static struct subsys_interface s3c2440_dma_interface = { | ||
186 | .name = "s3c2440_dma", | ||
187 | .subsys = &s3c2440_subsys, | ||
188 | .add_dev = s3c2440_dma_add, | ||
189 | }; | ||
190 | |||
191 | static int __init s3c2440_dma_init(void) | ||
192 | { | ||
193 | return subsys_interface_register(&s3c2440_dma_interface); | ||
194 | } | ||
195 | |||
196 | arch_initcall(s3c2440_dma_init); | ||
197 | |||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c new file mode 100644 index 000000000000..e227c472a40a --- /dev/null +++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* linux/arch/arm/mach-s3c2443/dma.c | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2443 DMA selection | ||
7 | * | ||
8 | * http://armlinux.simtec.co.uk/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
21 | #include <mach/dma.h> | ||
22 | |||
23 | #include <plat/dma-s3c24xx.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | #include <plat/regs-serial.h> | ||
27 | #include <mach/regs-gpio.h> | ||
28 | #include <plat/regs-ac97.h> | ||
29 | #include <plat/regs-dma.h> | ||
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | ||
32 | #include <mach/regs-sdi.h> | ||
33 | #include <plat/regs-iis.h> | ||
34 | #include <plat/regs-spi.h> | ||
35 | |||
36 | #define MAP(x) { \ | ||
37 | [0] = (x) | DMA_CH_VALID, \ | ||
38 | [1] = (x) | DMA_CH_VALID, \ | ||
39 | [2] = (x) | DMA_CH_VALID, \ | ||
40 | [3] = (x) | DMA_CH_VALID, \ | ||
41 | [4] = (x) | DMA_CH_VALID, \ | ||
42 | [5] = (x) | DMA_CH_VALID, \ | ||
43 | } | ||
44 | |||
45 | static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = { | ||
46 | [DMACH_XD0] = { | ||
47 | .name = "xdreq0", | ||
48 | .channels = MAP(S3C2443_DMAREQSEL_XDREQ0), | ||
49 | }, | ||
50 | [DMACH_XD1] = { | ||
51 | .name = "xdreq1", | ||
52 | .channels = MAP(S3C2443_DMAREQSEL_XDREQ1), | ||
53 | }, | ||
54 | [DMACH_SDI] = { /* only on S3C2443 */ | ||
55 | .name = "sdi", | ||
56 | .channels = MAP(S3C2443_DMAREQSEL_SDI), | ||
57 | }, | ||
58 | [DMACH_SPI0] = { | ||
59 | .name = "spi0", | ||
60 | .channels = MAP(S3C2443_DMAREQSEL_SPI0TX), | ||
61 | }, | ||
62 | [DMACH_SPI1] = { /* only on S3C2443/S3C2450 */ | ||
63 | .name = "spi1", | ||
64 | .channels = MAP(S3C2443_DMAREQSEL_SPI1TX), | ||
65 | }, | ||
66 | [DMACH_UART0] = { | ||
67 | .name = "uart0", | ||
68 | .channels = MAP(S3C2443_DMAREQSEL_UART0_0), | ||
69 | }, | ||
70 | [DMACH_UART1] = { | ||
71 | .name = "uart1", | ||
72 | .channels = MAP(S3C2443_DMAREQSEL_UART1_0), | ||
73 | }, | ||
74 | [DMACH_UART2] = { | ||
75 | .name = "uart2", | ||
76 | .channels = MAP(S3C2443_DMAREQSEL_UART2_0), | ||
77 | }, | ||
78 | [DMACH_UART3] = { | ||
79 | .name = "uart3", | ||
80 | .channels = MAP(S3C2443_DMAREQSEL_UART3_0), | ||
81 | }, | ||
82 | [DMACH_UART0_SRC2] = { | ||
83 | .name = "uart0", | ||
84 | .channels = MAP(S3C2443_DMAREQSEL_UART0_1), | ||
85 | }, | ||
86 | [DMACH_UART1_SRC2] = { | ||
87 | .name = "uart1", | ||
88 | .channels = MAP(S3C2443_DMAREQSEL_UART1_1), | ||
89 | }, | ||
90 | [DMACH_UART2_SRC2] = { | ||
91 | .name = "uart2", | ||
92 | .channels = MAP(S3C2443_DMAREQSEL_UART2_1), | ||
93 | }, | ||
94 | [DMACH_UART3_SRC2] = { | ||
95 | .name = "uart3", | ||
96 | .channels = MAP(S3C2443_DMAREQSEL_UART3_1), | ||
97 | }, | ||
98 | [DMACH_TIMER] = { | ||
99 | .name = "timer", | ||
100 | .channels = MAP(S3C2443_DMAREQSEL_TIMER), | ||
101 | }, | ||
102 | [DMACH_I2S_IN] = { | ||
103 | .name = "i2s-sdi", | ||
104 | .channels = MAP(S3C2443_DMAREQSEL_I2SRX), | ||
105 | }, | ||
106 | [DMACH_I2S_OUT] = { | ||
107 | .name = "i2s-sdo", | ||
108 | .channels = MAP(S3C2443_DMAREQSEL_I2STX), | ||
109 | }, | ||
110 | [DMACH_PCM_IN] = { | ||
111 | .name = "pcm-in", | ||
112 | .channels = MAP(S3C2443_DMAREQSEL_PCMIN), | ||
113 | }, | ||
114 | [DMACH_PCM_OUT] = { | ||
115 | .name = "pcm-out", | ||
116 | .channels = MAP(S3C2443_DMAREQSEL_PCMOUT), | ||
117 | }, | ||
118 | [DMACH_MIC_IN] = { | ||
119 | .name = "mic-in", | ||
120 | .channels = MAP(S3C2443_DMAREQSEL_MICIN), | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | static void s3c2443_dma_select(struct s3c2410_dma_chan *chan, | ||
125 | struct s3c24xx_dma_map *map) | ||
126 | { | ||
127 | writel(map->channels[0] | S3C2443_DMAREQSEL_HW, | ||
128 | chan->regs + S3C2443_DMA_DMAREQSEL); | ||
129 | } | ||
130 | |||
131 | static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = { | ||
132 | .select = s3c2443_dma_select, | ||
133 | .dcon_mask = 0, | ||
134 | .map = s3c2443_dma_mappings, | ||
135 | .map_size = ARRAY_SIZE(s3c2443_dma_mappings), | ||
136 | }; | ||
137 | |||
138 | static int __init s3c2443_dma_add(struct device *dev, | ||
139 | struct subsys_interface *sif) | ||
140 | { | ||
141 | s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100); | ||
142 | return s3c24xx_dma_init_map(&s3c2443_dma_sel); | ||
143 | } | ||
144 | |||
145 | #ifdef CONFIG_CPU_S3C2416 | ||
146 | /* S3C2416 DMA contains the same selection table as the S3C2443 */ | ||
147 | static struct subsys_interface s3c2416_dma_interface = { | ||
148 | .name = "s3c2416_dma", | ||
149 | .subsys = &s3c2416_subsys, | ||
150 | .add_dev = s3c2443_dma_add, | ||
151 | }; | ||
152 | |||
153 | static int __init s3c2416_dma_init(void) | ||
154 | { | ||
155 | return subsys_interface_register(&s3c2416_dma_interface); | ||
156 | } | ||
157 | |||
158 | arch_initcall(s3c2416_dma_init); | ||
159 | #endif | ||
160 | |||
161 | #ifdef CONFIG_CPU_S3C2443 | ||
162 | static struct subsys_interface s3c2443_dma_interface = { | ||
163 | .name = "s3c2443_dma", | ||
164 | .subsys = &s3c2443_subsys, | ||
165 | .add_dev = s3c2443_dma_add, | ||
166 | }; | ||
167 | |||
168 | static int __init s3c2443_dma_init(void) | ||
169 | { | ||
170 | return subsys_interface_register(&s3c2443_dma_interface); | ||
171 | } | ||
172 | |||
173 | arch_initcall(s3c2443_dma_init); | ||
174 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c new file mode 100644 index 000000000000..a5eeb62ce1c2 --- /dev/null +++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-s3c2410/h1940-bluetooth.c | ||
3 | * Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org> | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file COPYING in the main directory of this archive for | ||
7 | * more details. | ||
8 | * | ||
9 | * S3C2410 bluetooth "driver" | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/ctype.h> | ||
18 | #include <linux/leds.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/rfkill.h> | ||
21 | |||
22 | #include <mach/regs-gpio.h> | ||
23 | #include <mach/hardware.h> | ||
24 | #include <mach/h1940-latch.h> | ||
25 | #include <mach/h1940.h> | ||
26 | |||
27 | #define DRV_NAME "h1940-bt" | ||
28 | |||
29 | /* Bluetooth control */ | ||
30 | static void h1940bt_enable(int on) | ||
31 | { | ||
32 | if (on) { | ||
33 | /* Power on the chip */ | ||
34 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1); | ||
35 | /* Reset the chip */ | ||
36 | mdelay(10); | ||
37 | |||
38 | gpio_set_value(S3C2410_GPH(1), 1); | ||
39 | mdelay(10); | ||
40 | gpio_set_value(S3C2410_GPH(1), 0); | ||
41 | |||
42 | h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL); | ||
43 | } | ||
44 | else { | ||
45 | gpio_set_value(S3C2410_GPH(1), 1); | ||
46 | mdelay(10); | ||
47 | gpio_set_value(S3C2410_GPH(1), 0); | ||
48 | mdelay(10); | ||
49 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); | ||
50 | |||
51 | h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | static int h1940bt_set_block(void *data, bool blocked) | ||
56 | { | ||
57 | h1940bt_enable(!blocked); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static const struct rfkill_ops h1940bt_rfkill_ops = { | ||
62 | .set_block = h1940bt_set_block, | ||
63 | }; | ||
64 | |||
65 | static int __devinit h1940bt_probe(struct platform_device *pdev) | ||
66 | { | ||
67 | struct rfkill *rfk; | ||
68 | int ret = 0; | ||
69 | |||
70 | ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev)); | ||
71 | if (ret) { | ||
72 | dev_err(&pdev->dev, "could not get GPH1\n"); | ||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(&pdev->dev)); | ||
77 | if (ret) { | ||
78 | gpio_free(S3C2410_GPH(1)); | ||
79 | dev_err(&pdev->dev, "could not get BT_POWER\n"); | ||
80 | return ret; | ||
81 | } | ||
82 | |||
83 | /* Configures BT serial port GPIOs */ | ||
84 | s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); | ||
85 | s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE); | ||
86 | s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT); | ||
87 | s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE); | ||
88 | s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0); | ||
89 | s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE); | ||
90 | s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); | ||
91 | s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE); | ||
92 | |||
93 | rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH, | ||
94 | &h1940bt_rfkill_ops, NULL); | ||
95 | if (!rfk) { | ||
96 | ret = -ENOMEM; | ||
97 | goto err_rfk_alloc; | ||
98 | } | ||
99 | |||
100 | ret = rfkill_register(rfk); | ||
101 | if (ret) | ||
102 | goto err_rfkill; | ||
103 | |||
104 | platform_set_drvdata(pdev, rfk); | ||
105 | |||
106 | return 0; | ||
107 | |||
108 | err_rfkill: | ||
109 | rfkill_destroy(rfk); | ||
110 | err_rfk_alloc: | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static int h1940bt_remove(struct platform_device *pdev) | ||
115 | { | ||
116 | struct rfkill *rfk = platform_get_drvdata(pdev); | ||
117 | |||
118 | platform_set_drvdata(pdev, NULL); | ||
119 | gpio_free(S3C2410_GPH(1)); | ||
120 | |||
121 | if (rfk) { | ||
122 | rfkill_unregister(rfk); | ||
123 | rfkill_destroy(rfk); | ||
124 | } | ||
125 | rfk = NULL; | ||
126 | |||
127 | h1940bt_enable(0); | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | |||
133 | static struct platform_driver h1940bt_driver = { | ||
134 | .driver = { | ||
135 | .name = DRV_NAME, | ||
136 | }, | ||
137 | .probe = h1940bt_probe, | ||
138 | .remove = h1940bt_remove, | ||
139 | }; | ||
140 | |||
141 | |||
142 | static int __init h1940bt_init(void) | ||
143 | { | ||
144 | return platform_driver_register(&h1940bt_driver); | ||
145 | } | ||
146 | |||
147 | static void __exit h1940bt_exit(void) | ||
148 | { | ||
149 | platform_driver_unregister(&h1940bt_driver); | ||
150 | } | ||
151 | |||
152 | module_init(h1940bt_init); | ||
153 | module_exit(h1940bt_exit); | ||
154 | |||
155 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); | ||
156 | MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip"); | ||
157 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h b/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h new file mode 100644 index 000000000000..1b614d5a81f3 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/anubis-cpld.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * ANUBIS - CPLD control constants | ||
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 | #ifndef __ASM_ARCH_ANUBISCPLD_H | ||
15 | #define __ASM_ARCH_ANUBISCPLD_H | ||
16 | |||
17 | /* CTRL2 - NAND WP control, IDE Reset assert/check */ | ||
18 | |||
19 | #define ANUBIS_CTRL1_NANDSEL (0x3) | ||
20 | |||
21 | /* IDREG - revision */ | ||
22 | |||
23 | #define ANUBIS_IDREG_REVMASK (0x7) | ||
24 | |||
25 | #endif /* __ASM_ARCH_ANUBISCPLD_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h b/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h new file mode 100644 index 000000000000..a2a328134e34 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/anubis-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * ANUBIS - IRQ Number definitions | ||
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 | #ifndef __ASM_ARCH_ANUBISIRQ_H | ||
15 | #define __ASM_ARCH_ANUBISIRQ_H | ||
16 | |||
17 | #define IRQ_IDE0 IRQ_EINT2 | ||
18 | #define IRQ_IDE1 IRQ_EINT3 | ||
19 | #define IRQ_ASIX IRQ_EINT1 | ||
20 | |||
21 | #endif /* __ASM_ARCH_ANUBISIRQ_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/anubis-map.h b/arch/arm/mach-s3c24xx/include/mach/anubis-map.h new file mode 100644 index 000000000000..c9deb3a5b2c3 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/anubis-map.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/anubis-map.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * ANUBIS - Memory map definitions | ||
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 | /* needs arch/map.h including with this */ | ||
15 | |||
16 | #ifndef __ASM_ARCH_ANUBISMAP_H | ||
17 | #define __ASM_ARCH_ANUBISMAP_H | ||
18 | |||
19 | /* start peripherals off after the S3C2410 */ | ||
20 | |||
21 | #define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x01800000)) | ||
22 | |||
23 | #define ANUBIS_PA_CPLD (S3C2410_CS1 | (1<<26)) | ||
24 | |||
25 | /* we put the CPLD registers next, to get them out of the way */ | ||
26 | |||
27 | #define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01800000 */ | ||
28 | #define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD) | ||
29 | |||
30 | #define ANUBIS_VA_IDREG ANUBIS_IOADDR(0x00300000) /* 0x01B00000 */ | ||
31 | #define ANUBIS_PA_IDREG (ANUBIS_PA_CPLD + (3<<23)) | ||
32 | |||
33 | #define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000) | ||
34 | #define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000) | ||
35 | #define ANUBIS_IDESEC ANUBIS_IOADDR(0x01200000) | ||
36 | #define ANUBIS_IDESECAUX ANUBIS_IOADDR(0x01300000) | ||
37 | |||
38 | #endif /* __ASM_ARCH_ANUBISMAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h b/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h new file mode 100644 index 000000000000..bee2a7a932a0 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/bast-cpld.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * BAST - CPLD control constants | ||
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_BASTCPLD_H | ||
14 | #define __ASM_ARCH_BASTCPLD_H | ||
15 | |||
16 | /* CTRL1 - Audio LR routing */ | ||
17 | |||
18 | #define BAST_CPLD_CTRL1_LRCOFF (0x00) | ||
19 | #define BAST_CPLD_CTRL1_LRCADC (0x01) | ||
20 | #define BAST_CPLD_CTRL1_LRCDAC (0x02) | ||
21 | #define BAST_CPLD_CTRL1_LRCARM (0x03) | ||
22 | #define BAST_CPLD_CTRL1_LRMASK (0x03) | ||
23 | |||
24 | /* CTRL2 - NAND WP control, IDE Reset assert/check */ | ||
25 | |||
26 | #define BAST_CPLD_CTRL2_WNAND (0x04) | ||
27 | #define BAST_CPLD_CTLR2_IDERST (0x08) | ||
28 | |||
29 | /* CTRL3 - rom write control, CPLD identity */ | ||
30 | |||
31 | #define BAST_CPLD_CTRL3_IDMASK (0x0e) | ||
32 | #define BAST_CPLD_CTRL3_ROMWEN (0x01) | ||
33 | |||
34 | /* CTRL4 - 8bit LCD interface control/status */ | ||
35 | |||
36 | #define BAST_CPLD_CTRL4_LLAT (0x01) | ||
37 | #define BAST_CPLD_CTRL4_LCDRW (0x02) | ||
38 | #define BAST_CPLD_CTRL4_LCDCMD (0x04) | ||
39 | #define BAST_CPLD_CTRL4_LCDE2 (0x01) | ||
40 | |||
41 | /* CTRL5 - DMA routing */ | ||
42 | |||
43 | #define BAST_CPLD_DMA0_PRIIDE (0<<0) | ||
44 | #define BAST_CPLD_DMA0_SECIDE (1<<0) | ||
45 | #define BAST_CPLD_DMA0_ISA15 (2<<0) | ||
46 | #define BAST_CPLD_DMA0_ISA36 (3<<0) | ||
47 | |||
48 | #define BAST_CPLD_DMA1_PRIIDE (0<<2) | ||
49 | #define BAST_CPLD_DMA1_SECIDE (1<<2) | ||
50 | #define BAST_CPLD_DMA1_ISA15 (2<<2) | ||
51 | #define BAST_CPLD_DMA1_ISA36 (3<<2) | ||
52 | |||
53 | #endif /* __ASM_ARCH_BASTCPLD_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/bast-irq.h b/arch/arm/mach-s3c24xx/include/mach/bast-irq.h new file mode 100644 index 000000000000..cac428c42e7f --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/bast-irq.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/bast-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Machine BAST - IRQ Number definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_BASTIRQ_H | ||
14 | #define __ASM_ARCH_BASTIRQ_H | ||
15 | |||
16 | /* irq numbers to onboard peripherals */ | ||
17 | |||
18 | #define IRQ_USBOC IRQ_EINT18 | ||
19 | #define IRQ_IDE0 IRQ_EINT16 | ||
20 | #define IRQ_IDE1 IRQ_EINT17 | ||
21 | #define IRQ_PCSERIAL1 IRQ_EINT15 | ||
22 | #define IRQ_PCSERIAL2 IRQ_EINT14 | ||
23 | #define IRQ_PCPARALLEL IRQ_EINT13 | ||
24 | #define IRQ_ASIX IRQ_EINT11 | ||
25 | #define IRQ_DM9000 IRQ_EINT10 | ||
26 | #define IRQ_ISA IRQ_EINT9 | ||
27 | #define IRQ_SMALERT IRQ_EINT8 | ||
28 | |||
29 | #endif /* __ASM_ARCH_BASTIRQ_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/bast-map.h b/arch/arm/mach-s3c24xx/include/mach/bast-map.h new file mode 100644 index 000000000000..6e7dc9d0cf0e --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/bast-map.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/bast-map.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Machine BAST - Memory map definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* needs arch/map.h including with this */ | ||
14 | |||
15 | /* ok, we've used up to 0x13000000, now we need to find space for the | ||
16 | * peripherals that live in the nGCS[x] areas, which are quite numerous | ||
17 | * in their space. We also have the board's CPLD to find register space | ||
18 | * for. | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASM_ARCH_BASTMAP_H | ||
22 | #define __ASM_ARCH_BASTMAP_H | ||
23 | |||
24 | #define BAST_IOADDR(x) (S3C2410_ADDR((x) + 0x01300000)) | ||
25 | |||
26 | /* we put the CPLD registers next, to get them out of the way */ | ||
27 | |||
28 | #define BAST_VA_CTRL1 BAST_IOADDR(0x00000000) /* 0x01300000 */ | ||
29 | #define BAST_PA_CTRL1 (S3C2410_CS5 | 0x7800000) | ||
30 | |||
31 | #define BAST_VA_CTRL2 BAST_IOADDR(0x00100000) /* 0x01400000 */ | ||
32 | #define BAST_PA_CTRL2 (S3C2410_CS1 | 0x6000000) | ||
33 | |||
34 | #define BAST_VA_CTRL3 BAST_IOADDR(0x00200000) /* 0x01500000 */ | ||
35 | #define BAST_PA_CTRL3 (S3C2410_CS1 | 0x6800000) | ||
36 | |||
37 | #define BAST_VA_CTRL4 BAST_IOADDR(0x00300000) /* 0x01600000 */ | ||
38 | #define BAST_PA_CTRL4 (S3C2410_CS1 | 0x7000000) | ||
39 | |||
40 | /* next, we have the PC104 ISA interrupt registers */ | ||
41 | |||
42 | #define BAST_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) /* 0x01700000 */ | ||
43 | #define BAST_VA_PC104_IRQREQ BAST_IOADDR(0x00400000) | ||
44 | |||
45 | #define BAST_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) /* 0x01800000 */ | ||
46 | #define BAST_VA_PC104_IRQRAW BAST_IOADDR(0x00500000) | ||
47 | |||
48 | #define BAST_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) /* 0x01900000 */ | ||
49 | #define BAST_VA_PC104_IRQMASK BAST_IOADDR(0x00600000) | ||
50 | |||
51 | #define BAST_PA_LCD_RCMD1 (0x8800000) | ||
52 | #define BAST_VA_LCD_RCMD1 BAST_IOADDR(0x00700000) | ||
53 | |||
54 | #define BAST_PA_LCD_WCMD1 (0x8000000) | ||
55 | #define BAST_VA_LCD_WCMD1 BAST_IOADDR(0x00800000) | ||
56 | |||
57 | #define BAST_PA_LCD_RDATA1 (0x9800000) | ||
58 | #define BAST_VA_LCD_RDATA1 BAST_IOADDR(0x00900000) | ||
59 | |||
60 | #define BAST_PA_LCD_WDATA1 (0x9000000) | ||
61 | #define BAST_VA_LCD_WDATA1 BAST_IOADDR(0x00A00000) | ||
62 | |||
63 | #define BAST_PA_LCD_RCMD2 (0xA800000) | ||
64 | #define BAST_VA_LCD_RCMD2 BAST_IOADDR(0x00B00000) | ||
65 | |||
66 | #define BAST_PA_LCD_WCMD2 (0xA000000) | ||
67 | #define BAST_VA_LCD_WCMD2 BAST_IOADDR(0x00C00000) | ||
68 | |||
69 | #define BAST_PA_LCD_RDATA2 (0xB800000) | ||
70 | #define BAST_VA_LCD_RDATA2 BAST_IOADDR(0x00D00000) | ||
71 | |||
72 | #define BAST_PA_LCD_WDATA2 (0xB000000) | ||
73 | #define BAST_VA_LCD_WDATA2 BAST_IOADDR(0x00E00000) | ||
74 | |||
75 | |||
76 | /* 0xE0000000 contains the IO space that is split by speed and | ||
77 | * wether the access is for 8 or 16bit IO... this ensures that | ||
78 | * the correct access is made | ||
79 | * | ||
80 | * 0x10000000 of space, partitioned as so: | ||
81 | * | ||
82 | * 0x00000000 to 0x04000000 8bit, slow | ||
83 | * 0x04000000 to 0x08000000 16bit, slow | ||
84 | * 0x08000000 to 0x0C000000 16bit, net | ||
85 | * 0x0C000000 to 0x10000000 16bit, fast | ||
86 | * | ||
87 | * each of these spaces has the following in: | ||
88 | * | ||
89 | * 0x00000000 to 0x01000000 16MB ISA IO space | ||
90 | * 0x01000000 to 0x02000000 16MB ISA memory space | ||
91 | * 0x02000000 to 0x02100000 1MB IDE primary channel | ||
92 | * 0x02100000 to 0x02200000 1MB IDE primary channel aux | ||
93 | * 0x02200000 to 0x02400000 1MB IDE secondary channel | ||
94 | * 0x02300000 to 0x02400000 1MB IDE secondary channel aux | ||
95 | * 0x02400000 to 0x02500000 1MB ASIX ethernet controller | ||
96 | * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controller | ||
97 | * 0x02600000 to 0x02700000 1MB PC SuperIO controller | ||
98 | * | ||
99 | * the phyiscal layout of the zones are: | ||
100 | * nGCS2 - 8bit, slow | ||
101 | * nGCS3 - 16bit, slow | ||
102 | * nGCS4 - 16bit, net | ||
103 | * nGCS5 - 16bit, fast | ||
104 | */ | ||
105 | |||
106 | #define BAST_VA_MULTISPACE (0xE0000000) | ||
107 | |||
108 | #define BAST_VA_ISAIO (BAST_VA_MULTISPACE + 0x00000000) | ||
109 | #define BAST_VA_ISAMEM (BAST_VA_MULTISPACE + 0x01000000) | ||
110 | #define BAST_VA_IDEPRI (BAST_VA_MULTISPACE + 0x02000000) | ||
111 | #define BAST_VA_IDEPRIAUX (BAST_VA_MULTISPACE + 0x02100000) | ||
112 | #define BAST_VA_IDESEC (BAST_VA_MULTISPACE + 0x02200000) | ||
113 | #define BAST_VA_IDESECAUX (BAST_VA_MULTISPACE + 0x02300000) | ||
114 | #define BAST_VA_ASIXNET (BAST_VA_MULTISPACE + 0x02400000) | ||
115 | #define BAST_VA_DM9000 (BAST_VA_MULTISPACE + 0x02500000) | ||
116 | #define BAST_VA_SUPERIO (BAST_VA_MULTISPACE + 0x02600000) | ||
117 | |||
118 | #define BAST_VA_MULTISPACE (0xE0000000) | ||
119 | |||
120 | #define BAST_VAM_CS2 (0x00000000) | ||
121 | #define BAST_VAM_CS3 (0x04000000) | ||
122 | #define BAST_VAM_CS4 (0x08000000) | ||
123 | #define BAST_VAM_CS5 (0x0C000000) | ||
124 | |||
125 | /* physical offset addresses for the peripherals */ | ||
126 | |||
127 | #define BAST_PA_ISAIO (0x00000000) | ||
128 | #define BAST_PA_ASIXNET (0x01000000) | ||
129 | #define BAST_PA_SUPERIO (0x01800000) | ||
130 | #define BAST_PA_IDEPRI (0x02000000) | ||
131 | #define BAST_PA_IDEPRIAUX (0x02800000) | ||
132 | #define BAST_PA_IDESEC (0x03000000) | ||
133 | #define BAST_PA_IDESECAUX (0x03800000) | ||
134 | #define BAST_PA_ISAMEM (0x04000000) | ||
135 | #define BAST_PA_DM9000 (0x05000000) | ||
136 | |||
137 | /* some configurations for the peripherals */ | ||
138 | |||
139 | #define BAST_PCSIO (BAST_VA_SUPERIO + BAST_VAM_CS2) | ||
140 | /* */ | ||
141 | |||
142 | #define BAST_ASIXNET_CS BAST_VAM_CS5 | ||
143 | #define BAST_IDE_CS BAST_VAM_CS5 | ||
144 | #define BAST_DM9000_CS BAST_VAM_CS4 | ||
145 | |||
146 | #endif /* __ASM_ARCH_BASTMAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/bast-pmu.h b/arch/arm/mach-s3c24xx/include/mach/bast-pmu.h new file mode 100644 index 000000000000..4c38b39b741d --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/bast-pmu.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/bast-pmu.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * Vincent Sanders <vince@simtec.co.uk> | ||
6 | * | ||
7 | * Machine BAST - Power Management chip | ||
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 | #ifndef __ASM_ARCH_BASTPMU_H | ||
15 | #define __ASM_ARCH_BASTPMU_H "08_OCT_2004" | ||
16 | |||
17 | #define BASTPMU_REG_IDENT (0x00) | ||
18 | #define BASTPMU_REG_VERSION (0x01) | ||
19 | #define BASTPMU_REG_DDCCTRL (0x02) | ||
20 | #define BASTPMU_REG_POWER (0x03) | ||
21 | #define BASTPMU_REG_RESET (0x04) | ||
22 | #define BASTPMU_REG_GWO (0x05) | ||
23 | #define BASTPMU_REG_WOL (0x06) | ||
24 | #define BASTPMU_REG_WOR (0x07) | ||
25 | #define BASTPMU_REG_UID (0x09) | ||
26 | |||
27 | #define BASTPMU_EEPROM (0xC0) | ||
28 | |||
29 | #define BASTPMU_EEP_UID (BASTPMU_EEPROM + 0) | ||
30 | #define BASTPMU_EEP_WOL (BASTPMU_EEPROM + 8) | ||
31 | #define BASTPMU_EEP_WOR (BASTPMU_EEPROM + 9) | ||
32 | |||
33 | #define BASTPMU_IDENT_0 0x53 | ||
34 | #define BASTPMU_IDENT_1 0x42 | ||
35 | #define BASTPMU_IDENT_2 0x50 | ||
36 | #define BASTPMU_IDENT_3 0x4d | ||
37 | |||
38 | #define BASTPMU_RESET_GUARD (0x55) | ||
39 | |||
40 | #endif /* __ASM_ARCH_BASTPMU_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S new file mode 100644 index 000000000000..4135de87d1f7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S | |||
@@ -0,0 +1,101 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/debug-macro.S | ||
2 | * | ||
3 | * Debugging macro include header | ||
4 | * | ||
5 | * Copyright (C) 1994-1999 Russell King | ||
6 | * Copyright (C) 2005 Simtec Electronics | ||
7 | * | ||
8 | * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks | ||
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 | #include <mach/map.h> | ||
16 | #include <mach/regs-gpio.h> | ||
17 | #include <plat/regs-serial.h> | ||
18 | |||
19 | #define S3C2410_UART1_OFF (0x4000) | ||
20 | #define SHIFT_2440TXF (14-9) | ||
21 | |||
22 | .macro addruart, rp, rv, tmp | ||
23 | ldr \rp, = S3C24XX_PA_UART | ||
24 | ldr \rv, = S3C24XX_VA_UART | ||
25 | #if CONFIG_DEBUG_S3C_UART != 0 | ||
26 | add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART) | ||
27 | add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART) | ||
28 | #endif | ||
29 | .endm | ||
30 | |||
31 | .macro fifo_full_s3c24xx rd, rx | ||
32 | @ check for arm920 vs arm926. currently assume all arm926 | ||
33 | @ devices have an 64 byte FIFO identical to the s3c2440 | ||
34 | mrc p15, 0, \rd, c0, c0 | ||
35 | and \rd, \rd, #0xff0 | ||
36 | teq \rd, #0x260 | ||
37 | beq 1004f | ||
38 | mrc p15, 0, \rd, c1, c0 | ||
39 | tst \rd, #1 | ||
40 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) | ||
41 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) | ||
42 | bic \rd, \rd, #0xff000 | ||
43 | ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] | ||
44 | and \rd, \rd, #0x00ff0000 | ||
45 | teq \rd, #0x00440000 @ is it 2440? | ||
46 | 1004: | ||
47 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] | ||
48 | moveq \rd, \rd, lsr #SHIFT_2440TXF | ||
49 | tst \rd, #S3C2410_UFSTAT_TXFULL | ||
50 | .endm | ||
51 | |||
52 | .macro fifo_full_s3c2410 rd, rx | ||
53 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] | ||
54 | tst \rd, #S3C2410_UFSTAT_TXFULL | ||
55 | .endm | ||
56 | |||
57 | /* fifo level reading */ | ||
58 | |||
59 | .macro fifo_level_s3c24xx rd, rx | ||
60 | @ check for arm920 vs arm926. currently assume all arm926 | ||
61 | @ devices have an 64 byte FIFO identical to the s3c2440 | ||
62 | mrc p15, 0, \rd, c0, c0 | ||
63 | and \rd, \rd, #0xff0 | ||
64 | teq \rd, #0x260 | ||
65 | beq 10000f | ||
66 | mrc p15, 0, \rd, c1, c0 | ||
67 | tst \rd, #1 | ||
68 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) | ||
69 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) | ||
70 | bic \rd, \rd, #0xff000 | ||
71 | ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] | ||
72 | and \rd, \rd, #0x00ff0000 | ||
73 | teq \rd, #0x00440000 @ is it 2440? | ||
74 | |||
75 | 10000: | ||
76 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] | ||
77 | andne \rd, \rd, #S3C2410_UFSTAT_TXMASK | ||
78 | andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK | ||
79 | .endm | ||
80 | |||
81 | .macro fifo_level_s3c2410 rd, rx | ||
82 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] | ||
83 | and \rd, \rd, #S3C2410_UFSTAT_TXMASK | ||
84 | .endm | ||
85 | |||
86 | /* Select the correct implementation depending on the configuration. The | ||
87 | * S3C2440 will get selected by default, as these are the most widely | ||
88 | * used variants of these | ||
89 | */ | ||
90 | |||
91 | #if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY) | ||
92 | #define fifo_full fifo_full_s3c2410 | ||
93 | #define fifo_level fifo_level_s3c2410 | ||
94 | #elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY) | ||
95 | #define fifo_full fifo_full_s3c24xx | ||
96 | #define fifo_level fifo_level_s3c24xx | ||
97 | #endif | ||
98 | |||
99 | /* include the reset of the code which will do the work */ | ||
100 | |||
101 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h new file mode 100644 index 000000000000..acbdfecd4186 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/dma.h | |||
@@ -0,0 +1,210 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/dma.h | ||
2 | * | ||
3 | * Copyright (C) 2003-2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Samsung S3C24XX DMA 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_ARCH_DMA_H | ||
14 | #define __ASM_ARCH_DMA_H __FILE__ | ||
15 | |||
16 | #include <linux/device.h> | ||
17 | |||
18 | #define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ | ||
19 | |||
20 | /* We use `virtual` dma channels to hide the fact we have only a limited | ||
21 | * number of DMA channels, and not of all of them (dependent on the device) | ||
22 | * can be attached to any DMA source. We therefore let the DMA core handle | ||
23 | * the allocation of hardware channels to clients. | ||
24 | */ | ||
25 | |||
26 | enum dma_ch { | ||
27 | DMACH_XD0, | ||
28 | DMACH_XD1, | ||
29 | DMACH_SDI, | ||
30 | DMACH_SPI0, | ||
31 | DMACH_SPI1, | ||
32 | DMACH_UART0, | ||
33 | DMACH_UART1, | ||
34 | DMACH_UART2, | ||
35 | DMACH_TIMER, | ||
36 | DMACH_I2S_IN, | ||
37 | DMACH_I2S_OUT, | ||
38 | DMACH_PCM_IN, | ||
39 | DMACH_PCM_OUT, | ||
40 | DMACH_MIC_IN, | ||
41 | DMACH_USB_EP1, | ||
42 | DMACH_USB_EP2, | ||
43 | DMACH_USB_EP3, | ||
44 | DMACH_USB_EP4, | ||
45 | DMACH_UART0_SRC2, /* s3c2412 second uart sources */ | ||
46 | DMACH_UART1_SRC2, | ||
47 | DMACH_UART2_SRC2, | ||
48 | DMACH_UART3, /* s3c2443 has extra uart */ | ||
49 | DMACH_UART3_SRC2, | ||
50 | DMACH_MAX, /* the end entry */ | ||
51 | }; | ||
52 | |||
53 | static inline bool samsung_dma_has_circular(void) | ||
54 | { | ||
55 | return false; | ||
56 | } | ||
57 | |||
58 | static inline bool samsung_dma_is_dmadev(void) | ||
59 | { | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | #include <plat/dma.h> | ||
64 | |||
65 | #define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */ | ||
66 | |||
67 | /* we have 4 dma channels */ | ||
68 | #if !defined(CONFIG_CPU_S3C2443) && !defined(CONFIG_CPU_S3C2416) | ||
69 | #define S3C_DMA_CHANNELS (4) | ||
70 | #else | ||
71 | #define S3C_DMA_CHANNELS (6) | ||
72 | #endif | ||
73 | |||
74 | /* types */ | ||
75 | |||
76 | enum s3c2410_dma_state { | ||
77 | S3C2410_DMA_IDLE, | ||
78 | S3C2410_DMA_RUNNING, | ||
79 | S3C2410_DMA_PAUSED | ||
80 | }; | ||
81 | |||
82 | /* enum s3c2410_dma_loadst | ||
83 | * | ||
84 | * This represents the state of the DMA engine, wrt to the loaded / running | ||
85 | * transfers. Since we don't have any way of knowing exactly the state of | ||
86 | * the DMA transfers, we need to know the state to make decisions on wether | ||
87 | * we can | ||
88 | * | ||
89 | * S3C2410_DMA_NONE | ||
90 | * | ||
91 | * There are no buffers loaded (the channel should be inactive) | ||
92 | * | ||
93 | * S3C2410_DMA_1LOADED | ||
94 | * | ||
95 | * There is one buffer loaded, however it has not been confirmed to be | ||
96 | * loaded by the DMA engine. This may be because the channel is not | ||
97 | * yet running, or the DMA driver decided that it was too costly to | ||
98 | * sit and wait for it to happen. | ||
99 | * | ||
100 | * S3C2410_DMA_1RUNNING | ||
101 | * | ||
102 | * The buffer has been confirmed running, and not finisged | ||
103 | * | ||
104 | * S3C2410_DMA_1LOADED_1RUNNING | ||
105 | * | ||
106 | * There is a buffer waiting to be loaded by the DMA engine, and one | ||
107 | * currently running. | ||
108 | */ | ||
109 | |||
110 | enum s3c2410_dma_loadst { | ||
111 | S3C2410_DMALOAD_NONE, | ||
112 | S3C2410_DMALOAD_1LOADED, | ||
113 | S3C2410_DMALOAD_1RUNNING, | ||
114 | S3C2410_DMALOAD_1LOADED_1RUNNING, | ||
115 | }; | ||
116 | |||
117 | |||
118 | /* flags */ | ||
119 | |||
120 | #define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about | ||
121 | * waiting for reloads */ | ||
122 | #define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */ | ||
123 | |||
124 | #define S3C2410_DMAF_CIRCULAR (1 << 2) /* no circular dma support */ | ||
125 | |||
126 | /* dma buffer */ | ||
127 | |||
128 | struct s3c2410_dma_buf; | ||
129 | |||
130 | /* s3c2410_dma_buf | ||
131 | * | ||
132 | * internally used buffer structure to describe a queued or running | ||
133 | * buffer. | ||
134 | */ | ||
135 | |||
136 | struct s3c2410_dma_buf { | ||
137 | struct s3c2410_dma_buf *next; | ||
138 | int magic; /* magic */ | ||
139 | int size; /* buffer size in bytes */ | ||
140 | dma_addr_t data; /* start of DMA data */ | ||
141 | dma_addr_t ptr; /* where the DMA got to [1] */ | ||
142 | void *id; /* client's id */ | ||
143 | }; | ||
144 | |||
145 | /* [1] is this updated for both recv/send modes? */ | ||
146 | |||
147 | struct s3c2410_dma_stats { | ||
148 | unsigned long loads; | ||
149 | unsigned long timeout_longest; | ||
150 | unsigned long timeout_shortest; | ||
151 | unsigned long timeout_avg; | ||
152 | unsigned long timeout_failed; | ||
153 | }; | ||
154 | |||
155 | struct s3c2410_dma_map; | ||
156 | |||
157 | /* struct s3c2410_dma_chan | ||
158 | * | ||
159 | * full state information for each DMA channel | ||
160 | */ | ||
161 | |||
162 | struct s3c2410_dma_chan { | ||
163 | /* channel state flags and information */ | ||
164 | unsigned char number; /* number of this dma channel */ | ||
165 | unsigned char in_use; /* channel allocated */ | ||
166 | unsigned char irq_claimed; /* irq claimed for channel */ | ||
167 | unsigned char irq_enabled; /* irq enabled for channel */ | ||
168 | unsigned char xfer_unit; /* size of an transfer */ | ||
169 | |||
170 | /* channel state */ | ||
171 | |||
172 | enum s3c2410_dma_state state; | ||
173 | enum s3c2410_dma_loadst load_state; | ||
174 | struct s3c2410_dma_client *client; | ||
175 | |||
176 | /* channel configuration */ | ||
177 | enum dma_data_direction source; | ||
178 | enum dma_ch req_ch; | ||
179 | unsigned long dev_addr; | ||
180 | unsigned long load_timeout; | ||
181 | unsigned int flags; /* channel flags */ | ||
182 | |||
183 | struct s3c24xx_dma_map *map; /* channel hw maps */ | ||
184 | |||
185 | /* channel's hardware position and configuration */ | ||
186 | void __iomem *regs; /* channels registers */ | ||
187 | void __iomem *addr_reg; /* data address register */ | ||
188 | unsigned int irq; /* channel irq */ | ||
189 | unsigned long dcon; /* default value of DCON */ | ||
190 | |||
191 | /* driver handles */ | ||
192 | s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */ | ||
193 | s3c2410_dma_opfn_t op_fn; /* channel op callback */ | ||
194 | |||
195 | /* stats gathering */ | ||
196 | struct s3c2410_dma_stats *stats; | ||
197 | struct s3c2410_dma_stats stats_store; | ||
198 | |||
199 | /* buffer list and information */ | ||
200 | struct s3c2410_dma_buf *curr; /* current dma buffer */ | ||
201 | struct s3c2410_dma_buf *next; /* next buffer to load */ | ||
202 | struct s3c2410_dma_buf *end; /* end of queue */ | ||
203 | |||
204 | /* system device */ | ||
205 | struct device dev; | ||
206 | }; | ||
207 | |||
208 | typedef unsigned long dma_device_t; | ||
209 | |||
210 | #endif /* __ASM_ARCH_DMA_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S new file mode 100644 index 000000000000..7615a14773fa --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S | |||
@@ -0,0 +1,70 @@ | |||
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/fb.h b/arch/arm/mach-s3c24xx/include/mach/fb.h new file mode 100644 index 000000000000..a957bc8ed44f --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/fb.h | |||
@@ -0,0 +1 @@ | |||
#include <plat/fb-s3c2410.h> | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h b/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h new file mode 100644 index 000000000000..c53ad34c6579 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h | |||
@@ -0,0 +1 @@ | |||
#include <plat/gpio-fns.h> | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h b/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h new file mode 100644 index 000000000000..019ea86057f6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h | |||
@@ -0,0 +1,118 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/gpio-nrs.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2410 - GPIO bank numbering | ||
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 | #ifndef __MACH_GPIONRS_H | ||
15 | #define __MACH_GPIONRS_H | ||
16 | |||
17 | #define S3C2410_GPIONO(bank,offset) ((bank) + (offset)) | ||
18 | |||
19 | #define S3C2410_GPIO_BANKG (32*6) | ||
20 | #define S3C2410_GPIO_BANKH (32*7) | ||
21 | |||
22 | /* GPIO sizes for various SoCs: | ||
23 | * | ||
24 | * 2442 | ||
25 | * 2410 2412 2440 2443 2416 | ||
26 | * ---- ---- ---- ---- ---- | ||
27 | * A 23 22 25 16 25 | ||
28 | * B 11 11 11 11 9 | ||
29 | * C 16 15 16 16 16 | ||
30 | * D 16 16 16 16 16 | ||
31 | * E 16 16 16 16 16 | ||
32 | * F 8 8 8 8 8 | ||
33 | * G 16 16 16 16 8 | ||
34 | * H 11 11 9 15 15 | ||
35 | * J -- -- 13 16 -- | ||
36 | * K -- -- -- -- 16 | ||
37 | * L -- -- -- 15 7 | ||
38 | * M -- -- -- 2 2 | ||
39 | */ | ||
40 | |||
41 | /* GPIO bank sizes */ | ||
42 | #define S3C2410_GPIO_A_NR (32) | ||
43 | #define S3C2410_GPIO_B_NR (32) | ||
44 | #define S3C2410_GPIO_C_NR (32) | ||
45 | #define S3C2410_GPIO_D_NR (32) | ||
46 | #define S3C2410_GPIO_E_NR (32) | ||
47 | #define S3C2410_GPIO_F_NR (32) | ||
48 | #define S3C2410_GPIO_G_NR (32) | ||
49 | #define S3C2410_GPIO_H_NR (32) | ||
50 | #define S3C2410_GPIO_J_NR (32) /* technically 16. */ | ||
51 | #define S3C2410_GPIO_K_NR (32) /* technically 16. */ | ||
52 | #define S3C2410_GPIO_L_NR (32) /* technically 15. */ | ||
53 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ | ||
54 | |||
55 | #if CONFIG_S3C_GPIO_SPACE != 0 | ||
56 | #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment | ||
57 | #endif | ||
58 | |||
59 | #define S3C2410_GPIO_NEXT(__gpio) \ | ||
60 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0) | ||
61 | |||
62 | #ifndef __ASSEMBLY__ | ||
63 | |||
64 | enum s3c_gpio_number { | ||
65 | S3C2410_GPIO_A_START = 0, | ||
66 | S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A), | ||
67 | S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B), | ||
68 | S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C), | ||
69 | S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D), | ||
70 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), | ||
71 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), | ||
72 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), | ||
73 | S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), | ||
74 | S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), | ||
75 | S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), | ||
76 | S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), | ||
77 | }; | ||
78 | |||
79 | #endif /* __ASSEMBLY__ */ | ||
80 | |||
81 | /* S3C2410 GPIO number definitions. */ | ||
82 | |||
83 | #define S3C2410_GPA(_nr) (S3C2410_GPIO_A_START + (_nr)) | ||
84 | #define S3C2410_GPB(_nr) (S3C2410_GPIO_B_START + (_nr)) | ||
85 | #define S3C2410_GPC(_nr) (S3C2410_GPIO_C_START + (_nr)) | ||
86 | #define S3C2410_GPD(_nr) (S3C2410_GPIO_D_START + (_nr)) | ||
87 | #define S3C2410_GPE(_nr) (S3C2410_GPIO_E_START + (_nr)) | ||
88 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) | ||
89 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) | ||
90 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) | ||
91 | #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) | ||
92 | #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) | ||
93 | #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) | ||
94 | #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) | ||
95 | |||
96 | /* compatibility until drivers can be modified */ | ||
97 | |||
98 | #define S3C2410_GPA0 S3C2410_GPA(0) | ||
99 | #define S3C2410_GPA1 S3C2410_GPA(1) | ||
100 | #define S3C2410_GPA3 S3C2410_GPA(3) | ||
101 | #define S3C2410_GPA7 S3C2410_GPA(7) | ||
102 | |||
103 | #define S3C2410_GPE0 S3C2410_GPE(0) | ||
104 | #define S3C2410_GPE1 S3C2410_GPE(1) | ||
105 | #define S3C2410_GPE2 S3C2410_GPE(2) | ||
106 | #define S3C2410_GPE3 S3C2410_GPE(3) | ||
107 | #define S3C2410_GPE4 S3C2410_GPE(4) | ||
108 | #define S3C2410_GPE5 S3C2410_GPE(5) | ||
109 | #define S3C2410_GPE6 S3C2410_GPE(6) | ||
110 | #define S3C2410_GPE7 S3C2410_GPE(7) | ||
111 | #define S3C2410_GPE8 S3C2410_GPE(8) | ||
112 | #define S3C2410_GPE9 S3C2410_GPE(9) | ||
113 | #define S3C2410_GPE10 S3C2410_GPE(10) | ||
114 | |||
115 | #define S3C2410_GPH10 S3C2410_GPH(10) | ||
116 | |||
117 | #endif /* __MACH_GPIONRS_H */ | ||
118 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio-track.h b/arch/arm/mach-s3c24xx/include/mach/gpio-track.h new file mode 100644 index 000000000000..c410a078622c --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/gpio-track.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* arch/arm/mach-s3c24100/include/mach/gpio-core.h | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * S3C2410 - GPIO core support | ||
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 | #ifndef __ASM_ARCH_GPIO_CORE_H | ||
16 | #define __ASM_ARCH_GPIO_CORE_H __FILE__ | ||
17 | |||
18 | #include <mach/regs-gpio.h> | ||
19 | |||
20 | extern struct samsung_gpio_chip s3c24xx_gpios[]; | ||
21 | |||
22 | static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int pin) | ||
23 | { | ||
24 | struct samsung_gpio_chip *chip; | ||
25 | |||
26 | if (pin > S3C_GPIO_END) | ||
27 | return NULL; | ||
28 | |||
29 | chip = &s3c24xx_gpios[pin/32]; | ||
30 | return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL; | ||
31 | } | ||
32 | |||
33 | #endif /* __ASM_ARCH_GPIO_CORE_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio.h b/arch/arm/mach-s3c24xx/include/mach/gpio.h new file mode 100644 index 000000000000..6fac70f3484e --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/gpio.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2410 - GPIO lib support | ||
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 | /* some boards require extra gpio capacity to support external | ||
15 | * devices that need GPIO. | ||
16 | */ | ||
17 | |||
18 | #ifdef CONFIG_CPU_S3C244X | ||
19 | #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) | ||
20 | #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) | ||
21 | #define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA) | ||
22 | #else | ||
23 | #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) | ||
24 | #endif | ||
25 | |||
26 | #include <mach/gpio-nrs.h> | ||
27 | #include <mach/gpio-fns.h> | ||
28 | |||
29 | #ifdef CONFIG_CPU_S3C244X | ||
30 | #define S3C_GPIO_END (S3C2410_GPJ(0) + 32) | ||
31 | #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) | ||
32 | #define S3C_GPIO_END (S3C2410_GPM(0) + 32) | ||
33 | #else | ||
34 | #define S3C_GPIO_END (S3C2410_GPH(0) + 32) | ||
35 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gta02.h b/arch/arm/mach-s3c24xx/include/mach/gta02.h new file mode 100644 index 000000000000..3a56a229cac6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/gta02.h | |||
@@ -0,0 +1,84 @@ | |||
1 | #ifndef _GTA02_H | ||
2 | #define _GTA02_H | ||
3 | |||
4 | #include <mach/regs-gpio.h> | ||
5 | |||
6 | /* Different hardware revisions, passed in ATAG_REVISION by u-boot */ | ||
7 | #define GTA02v1_SYSTEM_REV 0x00000310 | ||
8 | #define GTA02v2_SYSTEM_REV 0x00000320 | ||
9 | #define GTA02v3_SYSTEM_REV 0x00000330 | ||
10 | #define GTA02v4_SYSTEM_REV 0x00000340 | ||
11 | #define GTA02v5_SYSTEM_REV 0x00000350 | ||
12 | /* since A7 is basically same as A6, we use A6 PCB ID */ | ||
13 | #define GTA02v6_SYSTEM_REV 0x00000360 | ||
14 | |||
15 | #define GTA02_GPIO_n3DL_GSM S3C2410_GPA(13) /* v1 + v2 + v3 only */ | ||
16 | |||
17 | #define GTA02_GPIO_PWR_LED1 S3C2410_GPB(0) | ||
18 | #define GTA02_GPIO_PWR_LED2 S3C2410_GPB(1) | ||
19 | #define GTA02_GPIO_AUX_LED S3C2410_GPB(2) | ||
20 | #define GTA02_GPIO_VIBRATOR_ON S3C2410_GPB(3) | ||
21 | #define GTA02_GPIO_MODEM_RST S3C2410_GPB(5) | ||
22 | #define GTA02_GPIO_BT_EN S3C2410_GPB(6) | ||
23 | #define GTA02_GPIO_MODEM_ON S3C2410_GPB(7) | ||
24 | #define GTA02_GPIO_EXTINT8 S3C2410_GPB(8) | ||
25 | #define GTA02_GPIO_USB_PULLUP S3C2410_GPB(9) | ||
26 | |||
27 | #define GTA02_GPIO_PIO5 S3C2410_GPC(5) /* v3 + v4 only */ | ||
28 | |||
29 | #define GTA02v3_GPIO_nG1_CS S3C2410_GPD(12) /* v3 + v4 only */ | ||
30 | #define GTA02v3_GPIO_nG2_CS S3C2410_GPD(13) /* v3 + v4 only */ | ||
31 | #define GTA02v5_GPIO_HDQ S3C2410_GPD(14) /* v5 + */ | ||
32 | |||
33 | #define GTA02_GPIO_nG1_INT S3C2410_GPF(0) | ||
34 | #define GTA02_GPIO_IO1 S3C2410_GPF(1) | ||
35 | #define GTA02_GPIO_PIO_2 S3C2410_GPF(2) /* v2 + v3 + v4 only */ | ||
36 | #define GTA02_GPIO_JACK_INSERT S3C2410_GPF(4) | ||
37 | #define GTA02_GPIO_WLAN_GPIO1 S3C2410_GPF(5) /* v2 + v3 + v4 only */ | ||
38 | #define GTA02_GPIO_AUX_KEY S3C2410_GPF(6) | ||
39 | #define GTA02_GPIO_HOLD_KEY S3C2410_GPF(7) | ||
40 | |||
41 | #define GTA02_GPIO_3D_IRQ S3C2410_GPG(4) | ||
42 | #define GTA02v2_GPIO_nG2_INT S3C2410_GPG(8) /* v2 + v3 + v4 only */ | ||
43 | #define GTA02v3_GPIO_nUSB_OC S3C2410_GPG(9) /* v3 + v4 only */ | ||
44 | #define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG(10) /* v3 + v4 only */ | ||
45 | #define GTA02v3_GPIO_nGSM_OC S3C2410_GPG(11) /* v3 + v4 only */ | ||
46 | |||
47 | #define GTA02_GPIO_AMP_SHUT S3C2410_GPJ(1) /* v2 + v3 + v4 only */ | ||
48 | #define GTA02v1_GPIO_WLAN_GPIO10 S3C2410_GPJ(2) | ||
49 | #define GTA02_GPIO_HP_IN S3C2410_GPJ(2) /* v2 + v3 + v4 only */ | ||
50 | #define GTA02_GPIO_INT0 S3C2410_GPJ(3) /* v2 + v3 + v4 only */ | ||
51 | #define GTA02_GPIO_nGSM_EN S3C2410_GPJ(4) | ||
52 | #define GTA02_GPIO_3D_RESET S3C2410_GPJ(5) | ||
53 | #define GTA02_GPIO_nDL_GSM S3C2410_GPJ(6) /* v4 + v5 only */ | ||
54 | #define GTA02_GPIO_WLAN_GPIO0 S3C2410_GPJ(7) | ||
55 | #define GTA02v1_GPIO_BAT_ID S3C2410_GPJ(8) | ||
56 | #define GTA02_GPIO_KEEPACT S3C2410_GPJ(8) | ||
57 | #define GTA02v1_GPIO_HP_IN S3C2410_GPJ(10) | ||
58 | #define GTA02_CHIP_PWD S3C2410_GPJ(11) /* v2 + v3 + v4 only */ | ||
59 | #define GTA02_GPIO_nWLAN_RESET S3C2410_GPJ(12) /* v2 + v3 + v4 only */ | ||
60 | |||
61 | #define GTA02_IRQ_GSENSOR_1 IRQ_EINT0 | ||
62 | #define GTA02_IRQ_MODEM IRQ_EINT1 | ||
63 | #define GTA02_IRQ_PIO_2 IRQ_EINT2 /* v2 + v3 + v4 only */ | ||
64 | #define GTA02_IRQ_nJACK_INSERT IRQ_EINT4 | ||
65 | #define GTA02_IRQ_WLAN_GPIO1 IRQ_EINT5 | ||
66 | #define GTA02_IRQ_AUX IRQ_EINT6 | ||
67 | #define GTA02_IRQ_nHOLD IRQ_EINT7 | ||
68 | #define GTA02_IRQ_PCF50633 IRQ_EINT9 | ||
69 | #define GTA02_IRQ_3D IRQ_EINT12 | ||
70 | #define GTA02_IRQ_GSENSOR_2 IRQ_EINT16 /* v2 + v3 + v4 only */ | ||
71 | #define GTA02v3_IRQ_nUSB_OC IRQ_EINT17 /* v3 + v4 only */ | ||
72 | #define GTA02v3_IRQ_nUSB_FLT IRQ_EINT18 /* v3 + v4 only */ | ||
73 | #define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */ | ||
74 | |||
75 | /* returns 00 000 on GTA02 A5 and earlier, A6 returns 01 001 */ | ||
76 | #define GTA02_PCB_ID1_0 S3C2410_GPC(13) | ||
77 | #define GTA02_PCB_ID1_1 S3C2410_GPC(15) | ||
78 | #define GTA02_PCB_ID1_2 S3C2410_GPD(0) | ||
79 | #define GTA02_PCB_ID2_0 S3C2410_GPD(3) | ||
80 | #define GTA02_PCB_ID2_1 S3C2410_GPD(4) | ||
81 | |||
82 | int gta02_get_pcb_revision(void); | ||
83 | |||
84 | #endif /* _GTA02_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h b/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h new file mode 100644 index 000000000000..fc897d3a056c --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/h1940-latch.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * iPAQ H1940 series - latch definitions | ||
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 | #ifndef __ASM_ARCH_H1940_LATCH_H | ||
15 | #define __ASM_ARCH_H1940_LATCH_H | ||
16 | |||
17 | #include <asm/gpio.h> | ||
18 | |||
19 | #define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x)) | ||
20 | |||
21 | /* SD layer latch */ | ||
22 | |||
23 | #define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0) | ||
24 | #define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1) | ||
25 | #define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2) | ||
26 | #define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3) | ||
27 | #define H1940_LATCH_MAX1698_nSHUTDOWN H1940_LATCH_GPIO(4) | ||
28 | #define H1940_LATCH_LED_RED H1940_LATCH_GPIO(5) | ||
29 | #define H1940_LATCH_SDQ7 H1940_LATCH_GPIO(6) | ||
30 | #define H1940_LATCH_USB_DP H1940_LATCH_GPIO(7) | ||
31 | |||
32 | /* CPU layer latch */ | ||
33 | |||
34 | #define H1940_LATCH_UDA_POWER H1940_LATCH_GPIO(8) | ||
35 | #define H1940_LATCH_AUDIO_POWER H1940_LATCH_GPIO(9) | ||
36 | #define H1940_LATCH_SM803_ENABLE H1940_LATCH_GPIO(10) | ||
37 | #define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11) | ||
38 | #define H1940_LATCH_SD_POWER H1940_LATCH_GPIO(12) | ||
39 | #define H1940_LATCH_BLUETOOTH_POWER H1940_LATCH_GPIO(13) | ||
40 | #define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14) | ||
41 | #define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15) | ||
42 | |||
43 | #endif /* __ASM_ARCH_H1940_LATCH_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/h1940.h b/arch/arm/mach-s3c24xx/include/mach/h1940.h new file mode 100644 index 000000000000..2aa683c8d3d6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/h1940.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/h1940.h | ||
2 | * | ||
3 | * Copyright 2006 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * H1940 definitions | ||
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_H1940_H | ||
13 | #define __ASM_ARCH_H1940_H | ||
14 | |||
15 | #define H1940_SUSPEND_CHECKSUM (0x30003ff8) | ||
16 | #define H1940_SUSPEND_RESUMEAT (0x30081000) | ||
17 | #define H1940_SUSPEND_CHECK (0x30080000) | ||
18 | |||
19 | extern void h1940_pm_return(void); | ||
20 | extern int h1940_led_blink_set(unsigned gpio, int state, | ||
21 | unsigned long *delay_on, unsigned long *delay_off); | ||
22 | |||
23 | |||
24 | #endif /* __ASM_ARCH_H1940_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/hardware.h b/arch/arm/mach-s3c24xx/include/mach/hardware.h new file mode 100644 index 000000000000..aef5631eac58 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/hardware.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/hardware.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - hardware | ||
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_HARDWARE_H | ||
14 | #define __ASM_ARCH_HARDWARE_H | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); | ||
19 | |||
20 | #ifdef CONFIG_CPU_S3C2440 | ||
21 | |||
22 | extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); | ||
23 | |||
24 | #endif /* CONFIG_CPU_S3C2440 */ | ||
25 | |||
26 | #ifdef CONFIG_CPU_S3C2412 | ||
27 | |||
28 | extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state); | ||
29 | |||
30 | #endif /* CONFIG_CPU_S3C2412 */ | ||
31 | |||
32 | #endif /* __ASSEMBLY__ */ | ||
33 | |||
34 | #include <asm/sizes.h> | ||
35 | #include <mach/map.h> | ||
36 | |||
37 | /* machine specific hardware definitions should go after this */ | ||
38 | |||
39 | /* currently here until moved into config (todo) */ | ||
40 | #define CONFIG_NO_MULTIWORD_IO | ||
41 | |||
42 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/idle.h b/arch/arm/mach-s3c24xx/include/mach/idle.h new file mode 100644 index 000000000000..e9ddd706b16e --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/idle.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/idle.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2410 CPU Idle controls | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_IDLE_H | ||
14 | #define __ASM_ARCH_IDLE_H __FILE__ | ||
15 | |||
16 | /* This allows the over-ride of the default idle code, in case there | ||
17 | * is any other things to be done over idle (like DVS) | ||
18 | */ | ||
19 | |||
20 | extern void (*s3c24xx_idle)(void); | ||
21 | |||
22 | extern void s3c24xx_default_idle(void); | ||
23 | |||
24 | #endif /* __ASM_ARCH_IDLE_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h new file mode 100644 index 000000000000..118749f37c4c --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/io.h | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-s3c2410/include/mach/io.h | ||
3 | * from arch/arm/mach-rpc/include/mach/io.h | ||
4 | * | ||
5 | * Copyright (C) 1997 Russell King | ||
6 | * (C) 2003 Simtec Electronics | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_ARM_ARCH_IO_H | ||
10 | #define __ASM_ARM_ARCH_IO_H | ||
11 | |||
12 | #include <mach/hardware.h> | ||
13 | |||
14 | #define IO_SPACE_LIMIT 0xffffffff | ||
15 | |||
16 | /* | ||
17 | * We use two different types of addressing - PC style addresses, and ARM | ||
18 | * addresses. PC style accesses the PC hardware with the normal PC IO | ||
19 | * addresses, eg 0x3f8 for serial#1. ARM addresses are above A28 | ||
20 | * and are translated to the start of IO. Note that all addresses are | ||
21 | * not shifted left! | ||
22 | */ | ||
23 | |||
24 | #define __PORT_PCIO(x) ((x) < (1<<28)) | ||
25 | |||
26 | #define PCIO_BASE (S3C24XX_VA_ISA_WORD) | ||
27 | #define PCIO_BASE_b (S3C24XX_VA_ISA_BYTE) | ||
28 | #define PCIO_BASE_w (S3C24XX_VA_ISA_WORD) | ||
29 | #define PCIO_BASE_l (S3C24XX_VA_ISA_WORD) | ||
30 | /* | ||
31 | * Dynamic IO functions - let the compiler | ||
32 | * optimize the expressions | ||
33 | */ | ||
34 | |||
35 | #define DECLARE_DYN_OUT(sz,fnsuffix,instr) \ | ||
36 | static inline void __out##fnsuffix (unsigned int val, unsigned int port) \ | ||
37 | { \ | ||
38 | unsigned long temp; \ | ||
39 | __asm__ __volatile__( \ | ||
40 | "cmp %2, #(1<<28)\n\t" \ | ||
41 | "mov %0, %2\n\t" \ | ||
42 | "addcc %0, %0, %3\n\t" \ | ||
43 | "str" instr " %1, [%0, #0 ] @ out" #fnsuffix \ | ||
44 | : "=&r" (temp) \ | ||
45 | : "r" (val), "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \ | ||
46 | : "cc"); \ | ||
47 | } | ||
48 | |||
49 | |||
50 | #define DECLARE_DYN_IN(sz,fnsuffix,instr) \ | ||
51 | static inline unsigned sz __in##fnsuffix (unsigned int port) \ | ||
52 | { \ | ||
53 | unsigned long temp, value; \ | ||
54 | __asm__ __volatile__( \ | ||
55 | "cmp %2, #(1<<28)\n\t" \ | ||
56 | "mov %0, %2\n\t" \ | ||
57 | "addcc %0, %0, %3\n\t" \ | ||
58 | "ldr" instr " %1, [%0, #0 ] @ in" #fnsuffix \ | ||
59 | : "=&r" (temp), "=r" (value) \ | ||
60 | : "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \ | ||
61 | : "cc"); \ | ||
62 | return (unsigned sz)value; \ | ||
63 | } | ||
64 | |||
65 | static inline void __iomem *__ioaddr (unsigned long port) | ||
66 | { | ||
67 | return __PORT_PCIO(port) ? (PCIO_BASE + port) : (void __iomem *)port; | ||
68 | } | ||
69 | |||
70 | #define DECLARE_IO(sz,fnsuffix,instr) \ | ||
71 | DECLARE_DYN_IN(sz,fnsuffix,instr) \ | ||
72 | DECLARE_DYN_OUT(sz,fnsuffix,instr) | ||
73 | |||
74 | DECLARE_IO(char,b,"b") | ||
75 | DECLARE_IO(short,w,"h") | ||
76 | DECLARE_IO(int,l,"") | ||
77 | |||
78 | #undef DECLARE_IO | ||
79 | #undef DECLARE_DYN_IN | ||
80 | |||
81 | /* | ||
82 | * Constant address IO functions | ||
83 | * | ||
84 | * These have to be macros for the 'J' constraint to work - | ||
85 | * +/-4096 immediate operand. | ||
86 | */ | ||
87 | #define __outbc(value,port) \ | ||
88 | ({ \ | ||
89 | if (__PORT_PCIO((port))) \ | ||
90 | __asm__ __volatile__( \ | ||
91 | "strb %0, [%1, %2] @ outbc" \ | ||
92 | : : "r" (value), "r" (PCIO_BASE), "Jr" ((port))); \ | ||
93 | else \ | ||
94 | __asm__ __volatile__( \ | ||
95 | "strb %0, [%1, #0] @ outbc" \ | ||
96 | : : "r" (value), "r" ((port))); \ | ||
97 | }) | ||
98 | |||
99 | #define __inbc(port) \ | ||
100 | ({ \ | ||
101 | unsigned char result; \ | ||
102 | if (__PORT_PCIO((port))) \ | ||
103 | __asm__ __volatile__( \ | ||
104 | "ldrb %0, [%1, %2] @ inbc" \ | ||
105 | : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ | ||
106 | else \ | ||
107 | __asm__ __volatile__( \ | ||
108 | "ldrb %0, [%1, #0] @ inbc" \ | ||
109 | : "=r" (result) : "r" ((port))); \ | ||
110 | result; \ | ||
111 | }) | ||
112 | |||
113 | #define __outwc(value,port) \ | ||
114 | ({ \ | ||
115 | unsigned long v = value; \ | ||
116 | if (__PORT_PCIO((port))) { \ | ||
117 | if ((port) < 256 && (port) > -256) \ | ||
118 | __asm__ __volatile__( \ | ||
119 | "strh %0, [%1, %2] @ outwc" \ | ||
120 | : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ | ||
121 | else if ((port) > 0) \ | ||
122 | __asm__ __volatile__( \ | ||
123 | "strh %0, [%1, %2] @ outwc" \ | ||
124 | : : "r" (v), \ | ||
125 | "r" (PCIO_BASE + ((port) & ~0xff)), \ | ||
126 | "Jr" (((port) & 0xff))); \ | ||
127 | else \ | ||
128 | __asm__ __volatile__( \ | ||
129 | "strh %0, [%1, #0] @ outwc" \ | ||
130 | : : "r" (v), \ | ||
131 | "r" (PCIO_BASE + (port))); \ | ||
132 | } else \ | ||
133 | __asm__ __volatile__( \ | ||
134 | "strh %0, [%1, #0] @ outwc" \ | ||
135 | : : "r" (v), "r" ((port))); \ | ||
136 | }) | ||
137 | |||
138 | #define __inwc(port) \ | ||
139 | ({ \ | ||
140 | unsigned short result; \ | ||
141 | if (__PORT_PCIO((port))) { \ | ||
142 | if ((port) < 256 && (port) > -256 ) \ | ||
143 | __asm__ __volatile__( \ | ||
144 | "ldrh %0, [%1, %2] @ inwc" \ | ||
145 | : "=r" (result) \ | ||
146 | : "r" (PCIO_BASE), \ | ||
147 | "Jr" ((port))); \ | ||
148 | else if ((port) > 0) \ | ||
149 | __asm__ __volatile__( \ | ||
150 | "ldrh %0, [%1, %2] @ inwc" \ | ||
151 | : "=r" (result) \ | ||
152 | : "r" (PCIO_BASE + ((port) & ~0xff)), \ | ||
153 | "Jr" (((port) & 0xff))); \ | ||
154 | else \ | ||
155 | __asm__ __volatile__( \ | ||
156 | "ldrh %0, [%1, #0] @ inwc" \ | ||
157 | : "=r" (result) \ | ||
158 | : "r" (PCIO_BASE + ((port)))); \ | ||
159 | } else \ | ||
160 | __asm__ __volatile__( \ | ||
161 | "ldrh %0, [%1, #0] @ inwc" \ | ||
162 | : "=r" (result) : "r" ((port))); \ | ||
163 | result; \ | ||
164 | }) | ||
165 | |||
166 | #define __outlc(value,port) \ | ||
167 | ({ \ | ||
168 | unsigned long v = value; \ | ||
169 | if (__PORT_PCIO((port))) \ | ||
170 | __asm__ __volatile__( \ | ||
171 | "str %0, [%1, %2] @ outlc" \ | ||
172 | : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ | ||
173 | else \ | ||
174 | __asm__ __volatile__( \ | ||
175 | "str %0, [%1, #0] @ outlc" \ | ||
176 | : : "r" (v), "r" ((port))); \ | ||
177 | }) | ||
178 | |||
179 | #define __inlc(port) \ | ||
180 | ({ \ | ||
181 | unsigned long result; \ | ||
182 | if (__PORT_PCIO((port))) \ | ||
183 | __asm__ __volatile__( \ | ||
184 | "ldr %0, [%1, %2] @ inlc" \ | ||
185 | : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ | ||
186 | else \ | ||
187 | __asm__ __volatile__( \ | ||
188 | "ldr %0, [%1, #0] @ inlc" \ | ||
189 | : "=r" (result) : "r" ((port))); \ | ||
190 | result; \ | ||
191 | }) | ||
192 | |||
193 | #define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)(port))) | ||
194 | |||
195 | #define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) | ||
196 | #define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) | ||
197 | #define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) | ||
198 | #define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) | ||
199 | #define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) | ||
200 | #define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) | ||
201 | #define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) | ||
202 | |||
203 | #define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l) | ||
204 | #define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l) | ||
205 | #define insl(p,d,l) __raw_readsl(__ioaddr(p),d,l) | ||
206 | |||
207 | #define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l) | ||
208 | #define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l) | ||
209 | #define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l) | ||
210 | |||
211 | /* | ||
212 | * 1:1 mapping for ioremapped regions. | ||
213 | */ | ||
214 | #define __mem_pci(x) (x) | ||
215 | |||
216 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h new file mode 100644 index 000000000000..e53b2177319e --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/irqs.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/irqs.h | ||
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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #ifndef __ASM_ARCH_IRQS_H | ||
13 | #define __ASM_ARCH_IRQS_H __FILE__ | ||
14 | |||
15 | /* we keep the first set of CPU IRQs out of the range of | ||
16 | * the ISA space, so that the PC104 has them to itself | ||
17 | * and we don't end up having to do horrible things to the | ||
18 | * standard ISA drivers.... | ||
19 | */ | ||
20 | |||
21 | #define S3C2410_CPUIRQ_OFFSET (16) | ||
22 | |||
23 | #define S3C2410_IRQ(x) ((x) + S3C2410_CPUIRQ_OFFSET) | ||
24 | |||
25 | /* main cpu interrupts */ | ||
26 | #define IRQ_EINT0 S3C2410_IRQ(0) /* 16 */ | ||
27 | #define IRQ_EINT1 S3C2410_IRQ(1) | ||
28 | #define IRQ_EINT2 S3C2410_IRQ(2) | ||
29 | #define IRQ_EINT3 S3C2410_IRQ(3) | ||
30 | #define IRQ_EINT4t7 S3C2410_IRQ(4) /* 20 */ | ||
31 | #define IRQ_EINT8t23 S3C2410_IRQ(5) | ||
32 | #define IRQ_RESERVED6 S3C2410_IRQ(6) /* for s3c2410 */ | ||
33 | #define IRQ_CAM S3C2410_IRQ(6) /* for s3c2440,s3c2443 */ | ||
34 | #define IRQ_BATT_FLT S3C2410_IRQ(7) | ||
35 | #define IRQ_TICK S3C2410_IRQ(8) /* 24 */ | ||
36 | #define IRQ_WDT S3C2410_IRQ(9) /* WDT/AC97 for s3c2443 */ | ||
37 | #define IRQ_TIMER0 S3C2410_IRQ(10) | ||
38 | #define IRQ_TIMER1 S3C2410_IRQ(11) | ||
39 | #define IRQ_TIMER2 S3C2410_IRQ(12) | ||
40 | #define IRQ_TIMER3 S3C2410_IRQ(13) | ||
41 | #define IRQ_TIMER4 S3C2410_IRQ(14) | ||
42 | #define IRQ_UART2 S3C2410_IRQ(15) | ||
43 | #define IRQ_LCD S3C2410_IRQ(16) /* 32 */ | ||
44 | #define IRQ_DMA0 S3C2410_IRQ(17) /* IRQ_DMA for s3c2443 */ | ||
45 | #define IRQ_DMA1 S3C2410_IRQ(18) | ||
46 | #define IRQ_DMA2 S3C2410_IRQ(19) | ||
47 | #define IRQ_DMA3 S3C2410_IRQ(20) | ||
48 | #define IRQ_SDI S3C2410_IRQ(21) | ||
49 | #define IRQ_SPI0 S3C2410_IRQ(22) | ||
50 | #define IRQ_UART1 S3C2410_IRQ(23) | ||
51 | #define IRQ_RESERVED24 S3C2410_IRQ(24) /* 40 */ | ||
52 | #define IRQ_NFCON S3C2410_IRQ(24) /* for s3c2440 */ | ||
53 | #define IRQ_USBD S3C2410_IRQ(25) | ||
54 | #define IRQ_USBH S3C2410_IRQ(26) | ||
55 | #define IRQ_IIC S3C2410_IRQ(27) | ||
56 | #define IRQ_UART0 S3C2410_IRQ(28) /* 44 */ | ||
57 | #define IRQ_SPI1 S3C2410_IRQ(29) | ||
58 | #define IRQ_RTC S3C2410_IRQ(30) | ||
59 | #define IRQ_ADCPARENT S3C2410_IRQ(31) | ||
60 | |||
61 | /* interrupts generated from the external interrupts sources */ | ||
62 | #define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */ | ||
63 | #define IRQ_EINT5 S3C2410_IRQ(33) | ||
64 | #define IRQ_EINT6 S3C2410_IRQ(34) | ||
65 | #define IRQ_EINT7 S3C2410_IRQ(35) | ||
66 | #define IRQ_EINT8 S3C2410_IRQ(36) | ||
67 | #define IRQ_EINT9 S3C2410_IRQ(37) | ||
68 | #define IRQ_EINT10 S3C2410_IRQ(38) | ||
69 | #define IRQ_EINT11 S3C2410_IRQ(39) | ||
70 | #define IRQ_EINT12 S3C2410_IRQ(40) | ||
71 | #define IRQ_EINT13 S3C2410_IRQ(41) | ||
72 | #define IRQ_EINT14 S3C2410_IRQ(42) | ||
73 | #define IRQ_EINT15 S3C2410_IRQ(43) | ||
74 | #define IRQ_EINT16 S3C2410_IRQ(44) | ||
75 | #define IRQ_EINT17 S3C2410_IRQ(45) | ||
76 | #define IRQ_EINT18 S3C2410_IRQ(46) | ||
77 | #define IRQ_EINT19 S3C2410_IRQ(47) | ||
78 | #define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */ | ||
79 | #define IRQ_EINT21 S3C2410_IRQ(49) | ||
80 | #define IRQ_EINT22 S3C2410_IRQ(50) | ||
81 | #define IRQ_EINT23 S3C2410_IRQ(51) | ||
82 | |||
83 | #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) | ||
84 | #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) | ||
85 | |||
86 | #define IRQ_LCD_FIFO S3C2410_IRQ(52) | ||
87 | #define IRQ_LCD_FRAME S3C2410_IRQ(53) | ||
88 | |||
89 | /* IRQs for the interal UARTs, and ADC | ||
90 | * these need to be ordered in number of appearance in the | ||
91 | * SUBSRC mask register | ||
92 | */ | ||
93 | |||
94 | #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54) | ||
95 | |||
96 | #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */ | ||
97 | #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) | ||
98 | #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) | ||
99 | |||
100 | #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */ | ||
101 | #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) | ||
102 | #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) | ||
103 | |||
104 | #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */ | ||
105 | #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) | ||
106 | #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) | ||
107 | |||
108 | #define IRQ_TC S3C2410_IRQSUB(9) | ||
109 | #define IRQ_ADC S3C2410_IRQSUB(10) | ||
110 | |||
111 | /* extra irqs for s3c2412 */ | ||
112 | |||
113 | #define IRQ_S3C2412_CFSDI S3C2410_IRQ(21) | ||
114 | |||
115 | #define IRQ_S3C2412_SDI S3C2410_IRQSUB(13) | ||
116 | #define IRQ_S3C2412_CF S3C2410_IRQSUB(14) | ||
117 | |||
118 | |||
119 | #define IRQ_S3C2416_EINT8t15 S3C2410_IRQ(5) | ||
120 | #define IRQ_S3C2416_DMA S3C2410_IRQ(17) | ||
121 | #define IRQ_S3C2416_UART3 S3C2410_IRQ(18) | ||
122 | #define IRQ_S3C2416_SDI1 S3C2410_IRQ(20) | ||
123 | #define IRQ_S3C2416_SDI0 S3C2410_IRQ(21) | ||
124 | |||
125 | #define IRQ_S3C2416_LCD2 S3C2410_IRQSUB(15) | ||
126 | #define IRQ_S3C2416_LCD3 S3C2410_IRQSUB(16) | ||
127 | #define IRQ_S3C2416_LCD4 S3C2410_IRQSUB(17) | ||
128 | #define IRQ_S3C2416_DMA0 S3C2410_IRQSUB(18) | ||
129 | #define IRQ_S3C2416_DMA1 S3C2410_IRQSUB(19) | ||
130 | #define IRQ_S3C2416_DMA2 S3C2410_IRQSUB(20) | ||
131 | #define IRQ_S3C2416_DMA3 S3C2410_IRQSUB(21) | ||
132 | #define IRQ_S3C2416_DMA4 S3C2410_IRQSUB(22) | ||
133 | #define IRQ_S3C2416_DMA5 S3C2410_IRQSUB(23) | ||
134 | #define IRQ_S32416_WDT S3C2410_IRQSUB(27) | ||
135 | #define IRQ_S32416_AC97 S3C2410_IRQSUB(28) | ||
136 | |||
137 | |||
138 | /* extra irqs for s3c2440 */ | ||
139 | |||
140 | #define IRQ_S3C2440_CAM_C S3C2410_IRQSUB(11) /* S3C2443 too */ | ||
141 | #define IRQ_S3C2440_CAM_P S3C2410_IRQSUB(12) /* S3C2443 too */ | ||
142 | #define IRQ_S3C2440_WDT S3C2410_IRQSUB(13) | ||
143 | #define IRQ_S3C2440_AC97 S3C2410_IRQSUB(14) | ||
144 | |||
145 | /* irqs for s3c2443 */ | ||
146 | |||
147 | #define IRQ_S3C2443_DMA S3C2410_IRQ(17) /* IRQ_DMA1 */ | ||
148 | #define IRQ_S3C2443_UART3 S3C2410_IRQ(18) /* IRQ_DMA2 */ | ||
149 | #define IRQ_S3C2443_CFCON S3C2410_IRQ(19) /* IRQ_DMA3 */ | ||
150 | #define IRQ_S3C2443_HSMMC S3C2410_IRQ(20) /* IRQ_SDI */ | ||
151 | #define IRQ_S3C2443_NAND S3C2410_IRQ(24) /* reserved */ | ||
152 | |||
153 | #define IRQ_S3C2416_HSMMC0 S3C2410_IRQ(21) /* S3C2416/S3C2450 */ | ||
154 | |||
155 | #define IRQ_HSMMC0 IRQ_S3C2416_HSMMC0 | ||
156 | #define IRQ_HSMMC1 IRQ_S3C2443_HSMMC | ||
157 | |||
158 | #define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14) | ||
159 | #define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15) | ||
160 | #define IRQ_S3C2443_LCD3 S3C2410_IRQSUB(16) | ||
161 | #define IRQ_S3C2443_LCD4 S3C2410_IRQSUB(17) | ||
162 | |||
163 | #define IRQ_S3C2443_DMA0 S3C2410_IRQSUB(18) | ||
164 | #define IRQ_S3C2443_DMA1 S3C2410_IRQSUB(19) | ||
165 | #define IRQ_S3C2443_DMA2 S3C2410_IRQSUB(20) | ||
166 | #define IRQ_S3C2443_DMA3 S3C2410_IRQSUB(21) | ||
167 | #define IRQ_S3C2443_DMA4 S3C2410_IRQSUB(22) | ||
168 | #define IRQ_S3C2443_DMA5 S3C2410_IRQSUB(23) | ||
169 | |||
170 | /* UART3 */ | ||
171 | #define IRQ_S3C2443_RX3 S3C2410_IRQSUB(24) | ||
172 | #define IRQ_S3C2443_TX3 S3C2410_IRQSUB(25) | ||
173 | #define IRQ_S3C2443_ERR3 S3C2410_IRQSUB(26) | ||
174 | |||
175 | #define IRQ_S3C2443_WDT S3C2410_IRQSUB(27) | ||
176 | #define IRQ_S3C2443_AC97 S3C2410_IRQSUB(28) | ||
177 | |||
178 | #if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) | ||
179 | #define NR_IRQS (IRQ_S3C2443_AC97+1) | ||
180 | #else | ||
181 | #define NR_IRQS (IRQ_S3C2440_AC97+1) | ||
182 | #endif | ||
183 | |||
184 | /* compatibility define. */ | ||
185 | #define IRQ_UART3 IRQ_S3C2443_UART3 | ||
186 | #define IRQ_S3CUART_RX3 IRQ_S3C2443_RX3 | ||
187 | #define IRQ_S3CUART_TX3 IRQ_S3C2443_TX3 | ||
188 | #define IRQ_S3CUART_ERR3 IRQ_S3C2443_ERR3 | ||
189 | |||
190 | #define IRQ_LCD_VSYNC IRQ_S3C2443_LCD3 | ||
191 | #define IRQ_LCD_SYSTEM IRQ_S3C2443_LCD2 | ||
192 | |||
193 | #ifdef CONFIG_CPU_S3C2440 | ||
194 | #define IRQ_S3C244X_AC97 IRQ_S3C2440_AC97 | ||
195 | #else | ||
196 | #define IRQ_S3C244X_AC97 IRQ_S3C2443_AC97 | ||
197 | #endif | ||
198 | |||
199 | /* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */ | ||
200 | #define FIQ_START IRQ_EINT0 | ||
201 | |||
202 | #endif /* __ASM_ARCH_IRQ_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/leds-gpio.h b/arch/arm/mach-s3c24xx/include/mach/leds-gpio.h new file mode 100644 index 000000000000..d8a7672519b6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/leds-gpio.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/leds-gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C24XX - LEDs GPIO connector | ||
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 | #ifndef __ASM_ARCH_LEDSGPIO_H | ||
15 | #define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h" | ||
16 | |||
17 | #define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */ | ||
18 | #define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */ | ||
19 | |||
20 | struct s3c24xx_led_platdata { | ||
21 | unsigned int gpio; | ||
22 | unsigned int flags; | ||
23 | |||
24 | char *name; | ||
25 | char *def_trigger; | ||
26 | }; | ||
27 | |||
28 | #endif /* __ASM_ARCH_LEDSGPIO_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/map.h b/arch/arm/mach-s3c24xx/include/mach/map.h new file mode 100644 index 000000000000..78ae807f1281 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/map.h | |||
@@ -0,0 +1,165 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/map.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - Memory map definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_MAP_H | ||
14 | #define __ASM_ARCH_MAP_H | ||
15 | |||
16 | #include <plat/map-base.h> | ||
17 | |||
18 | /* | ||
19 | * S3C2410 UART offset is 0x4000 but the other SoCs are 0x400. | ||
20 | * So need to define it, and here is to avoid redefinition warning. | ||
21 | */ | ||
22 | #define S3C_UART_OFFSET (0x4000) | ||
23 | |||
24 | #include <plat/map-s3c.h> | ||
25 | |||
26 | /* | ||
27 | * interrupt controller is the first thing we put in, to make | ||
28 | * the assembly code for the irq detection easier | ||
29 | */ | ||
30 | #define S3C2410_PA_IRQ (0x4A000000) | ||
31 | #define S3C24XX_SZ_IRQ SZ_1M | ||
32 | |||
33 | /* memory controller registers */ | ||
34 | #define S3C2410_PA_MEMCTRL (0x48000000) | ||
35 | #define S3C24XX_SZ_MEMCTRL SZ_1M | ||
36 | |||
37 | /* UARTs */ | ||
38 | #define S3C_VA_UARTx(uart) (S3C_VA_UART + ((uart * S3C_UART_OFFSET))) | ||
39 | |||
40 | /* Timers */ | ||
41 | #define S3C2410_PA_TIMER (0x51000000) | ||
42 | #define S3C24XX_SZ_TIMER SZ_1M | ||
43 | |||
44 | /* Clock and Power management */ | ||
45 | #define S3C24XX_SZ_CLKPWR SZ_1M | ||
46 | |||
47 | /* USB Device port */ | ||
48 | #define S3C2410_PA_USBDEV (0x52000000) | ||
49 | #define S3C24XX_SZ_USBDEV SZ_1M | ||
50 | |||
51 | /* Watchdog */ | ||
52 | #define S3C2410_PA_WATCHDOG (0x53000000) | ||
53 | #define S3C24XX_SZ_WATCHDOG SZ_1M | ||
54 | |||
55 | /* Standard size definitions for peripheral blocks. */ | ||
56 | |||
57 | #define S3C24XX_SZ_UART SZ_1M | ||
58 | #define S3C24XX_SZ_IIS SZ_1M | ||
59 | #define S3C24XX_SZ_ADC SZ_1M | ||
60 | #define S3C24XX_SZ_SPI SZ_1M | ||
61 | #define S3C24XX_SZ_SDI SZ_1M | ||
62 | #define S3C24XX_SZ_NAND SZ_1M | ||
63 | #define S3C24XX_SZ_GPIO SZ_1M | ||
64 | |||
65 | /* USB host controller */ | ||
66 | #define S3C2410_PA_USBHOST (0x49000000) | ||
67 | |||
68 | /* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */ | ||
69 | #define S3C2416_PA_HSUDC (0x49800000) | ||
70 | #define S3C2416_SZ_HSUDC (SZ_4K) | ||
71 | |||
72 | /* DMA controller */ | ||
73 | #define S3C2410_PA_DMA (0x4B000000) | ||
74 | #define S3C24XX_SZ_DMA SZ_1M | ||
75 | |||
76 | /* Clock and Power management */ | ||
77 | #define S3C2410_PA_CLKPWR (0x4C000000) | ||
78 | |||
79 | /* LCD controller */ | ||
80 | #define S3C2410_PA_LCD (0x4D000000) | ||
81 | #define S3C24XX_SZ_LCD SZ_1M | ||
82 | |||
83 | /* NAND flash controller */ | ||
84 | #define S3C2410_PA_NAND (0x4E000000) | ||
85 | |||
86 | /* IIC hardware controller */ | ||
87 | #define S3C2410_PA_IIC (0x54000000) | ||
88 | |||
89 | /* IIS controller */ | ||
90 | #define S3C2410_PA_IIS (0x55000000) | ||
91 | |||
92 | /* RTC */ | ||
93 | #define S3C2410_PA_RTC (0x57000000) | ||
94 | #define S3C24XX_SZ_RTC SZ_1M | ||
95 | |||
96 | /* ADC */ | ||
97 | #define S3C2410_PA_ADC (0x58000000) | ||
98 | |||
99 | /* SPI */ | ||
100 | #define S3C2410_PA_SPI (0x59000000) | ||
101 | |||
102 | /* SDI */ | ||
103 | #define S3C2410_PA_SDI (0x5A000000) | ||
104 | |||
105 | /* CAMIF */ | ||
106 | #define S3C2440_PA_CAMIF (0x4F000000) | ||
107 | #define S3C2440_SZ_CAMIF SZ_1M | ||
108 | |||
109 | /* AC97 */ | ||
110 | |||
111 | #define S3C2440_PA_AC97 (0x5B000000) | ||
112 | #define S3C2440_SZ_AC97 SZ_1M | ||
113 | |||
114 | /* S3C2443/S3C2416 High-speed SD/MMC */ | ||
115 | #define S3C2443_PA_HSMMC (0x4A800000) | ||
116 | #define S3C2416_PA_HSMMC0 (0x4AC00000) | ||
117 | |||
118 | #define S3C2443_PA_FB (0x4C800000) | ||
119 | |||
120 | /* S3C2412 memory and IO controls */ | ||
121 | #define S3C2412_PA_SSMC (0x4F000000) | ||
122 | |||
123 | #define S3C2412_PA_EBI (0x48800000) | ||
124 | |||
125 | /* physical addresses of all the chip-select areas */ | ||
126 | |||
127 | #define S3C2410_CS0 (0x00000000) | ||
128 | #define S3C2410_CS1 (0x08000000) | ||
129 | #define S3C2410_CS2 (0x10000000) | ||
130 | #define S3C2410_CS3 (0x18000000) | ||
131 | #define S3C2410_CS4 (0x20000000) | ||
132 | #define S3C2410_CS5 (0x28000000) | ||
133 | #define S3C2410_CS6 (0x30000000) | ||
134 | #define S3C2410_CS7 (0x38000000) | ||
135 | |||
136 | #define S3C2410_SDRAM_PA (S3C2410_CS6) | ||
137 | |||
138 | /* Use a single interface for common resources between S3C24XX cpus */ | ||
139 | |||
140 | #define S3C24XX_PA_IRQ S3C2410_PA_IRQ | ||
141 | #define S3C24XX_PA_MEMCTRL S3C2410_PA_MEMCTRL | ||
142 | #define S3C24XX_PA_DMA S3C2410_PA_DMA | ||
143 | #define S3C24XX_PA_CLKPWR S3C2410_PA_CLKPWR | ||
144 | #define S3C24XX_PA_LCD S3C2410_PA_LCD | ||
145 | #define S3C24XX_PA_TIMER S3C2410_PA_TIMER | ||
146 | #define S3C24XX_PA_USBDEV S3C2410_PA_USBDEV | ||
147 | #define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG | ||
148 | #define S3C24XX_PA_IIS S3C2410_PA_IIS | ||
149 | #define S3C24XX_PA_RTC S3C2410_PA_RTC | ||
150 | #define S3C24XX_PA_ADC S3C2410_PA_ADC | ||
151 | #define S3C24XX_PA_SPI S3C2410_PA_SPI | ||
152 | #define S3C24XX_PA_SPI1 (S3C2410_PA_SPI + S3C2410_SPI1) | ||
153 | #define S3C24XX_PA_SDI S3C2410_PA_SDI | ||
154 | #define S3C24XX_PA_NAND S3C2410_PA_NAND | ||
155 | |||
156 | #define S3C_PA_FB S3C2443_PA_FB | ||
157 | #define S3C_PA_IIC S3C2410_PA_IIC | ||
158 | #define S3C_PA_UART S3C24XX_PA_UART | ||
159 | #define S3C_PA_USBHOST S3C2410_PA_USBHOST | ||
160 | #define S3C_PA_HSMMC0 S3C2416_PA_HSMMC0 | ||
161 | #define S3C_PA_HSMMC1 S3C2443_PA_HSMMC | ||
162 | #define S3C_PA_WDT S3C2410_PA_WATCHDOG | ||
163 | #define S3C_PA_NAND S3C24XX_PA_NAND | ||
164 | |||
165 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h b/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h new file mode 100644 index 000000000000..e9e36b0abbac --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/osiris-cpld.h | ||
2 | * | ||
3 | * Copyright 2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * OSIRIS - CPLD control constants | ||
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 | #ifndef __ASM_ARCH_OSIRISCPLD_H | ||
15 | #define __ASM_ARCH_OSIRISCPLD_H | ||
16 | |||
17 | /* CTRL0 - NAND WP control */ | ||
18 | |||
19 | #define OSIRIS_CTRL0_NANDSEL (0x3) | ||
20 | #define OSIRIS_CTRL0_BOOT_INT (1<<3) | ||
21 | #define OSIRIS_CTRL0_PCMCIA (1<<4) | ||
22 | #define OSIRIS_CTRL0_FIX8 (1<<5) | ||
23 | #define OSIRIS_CTRL0_PCMCIA_nWAIT (1<<6) | ||
24 | #define OSIRIS_CTRL0_PCMCIA_nIOIS16 (1<<7) | ||
25 | |||
26 | #define OSIRIS_CTRL1_FIX8 (1<<0) | ||
27 | |||
28 | #define OSIRIS_ID_REVMASK (0x7) | ||
29 | |||
30 | #endif /* __ASM_ARCH_OSIRISCPLD_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/osiris-map.h b/arch/arm/mach-s3c24xx/include/mach/osiris-map.h new file mode 100644 index 000000000000..17380f848428 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/osiris-map.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/osiris-map.h | ||
2 | * | ||
3 | * Copyright 2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * OSIRIS - Memory map definitions | ||
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 | /* needs arch/map.h including with this */ | ||
15 | |||
16 | #ifndef __ASM_ARCH_OSIRISMAP_H | ||
17 | #define __ASM_ARCH_OSIRISMAP_H | ||
18 | |||
19 | /* start peripherals off after the S3C2410 */ | ||
20 | |||
21 | #define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x04000000)) | ||
22 | |||
23 | #define OSIRIS_PA_CPLD (S3C2410_CS1 | (1<<26)) | ||
24 | |||
25 | /* we put the CPLD registers next, to get them out of the way */ | ||
26 | |||
27 | #define OSIRIS_VA_CTRL0 OSIRIS_IOADDR(0x00000000) | ||
28 | #define OSIRIS_PA_CTRL0 (OSIRIS_PA_CPLD) | ||
29 | |||
30 | #define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00100000) | ||
31 | #define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD + (1<<23)) | ||
32 | |||
33 | #define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00200000) | ||
34 | #define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (2<<23)) | ||
35 | |||
36 | #define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00300000) | ||
37 | #define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23)) | ||
38 | |||
39 | #define OSIRIS_VA_IDREG OSIRIS_IOADDR(0x00700000) | ||
40 | #define OSIRIS_PA_IDREG (OSIRIS_PA_CPLD + (7<<23)) | ||
41 | |||
42 | #endif /* __ASM_ARCH_OSIRISMAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/otom-map.h b/arch/arm/mach-s3c24xx/include/mach/otom-map.h new file mode 100644 index 000000000000..f9277a52c145 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/otom-map.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/otom-map.h | ||
2 | * | ||
3 | * (c) 2005 Guillaume GOURAT / NexVision | ||
4 | * guillaume.gourat@nexvision.fr | ||
5 | * | ||
6 | * NexVision OTOM board memory map definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* needs arch/map.h including with this */ | ||
14 | |||
15 | /* ok, we've used up to 0x01300000, now we need to find space for the | ||
16 | * peripherals that live in the nGCS[x] areas, which are quite numerous | ||
17 | * in their space. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_ARCH_OTOMMAP_H | ||
21 | #define __ASM_ARCH_OTOMMAP_H | ||
22 | |||
23 | #define OTOM_PA_CS8900A_BASE (S3C2410_CS3 + 0x01000000) /* nGCS3 +0x01000000 */ | ||
24 | #define OTOM_VA_CS8900A_BASE S3C2410_ADDR(0x04000000) /* 0xF4000000 */ | ||
25 | |||
26 | /* physical offset addresses for the peripherals */ | ||
27 | |||
28 | #define OTOM_PA_FLASH0_BASE (S3C2410_CS0) /* Bank 0 */ | ||
29 | |||
30 | #endif /* __ASM_ARCH_OTOMMAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/pm-core.h b/arch/arm/mach-s3c24xx/include/mach/pm-core.h new file mode 100644 index 000000000000..2eef7e6f7675 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/pm-core.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/include/pm-core.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C24xx - PM core support for arch/arm/plat-s3c/pm.c | ||
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 | static inline void s3c_pm_debug_init_uart(void) | ||
15 | { | ||
16 | unsigned long tmp = __raw_readl(S3C2410_CLKCON); | ||
17 | |||
18 | /* re-start uart clocks */ | ||
19 | tmp |= S3C2410_CLKCON_UART0; | ||
20 | tmp |= S3C2410_CLKCON_UART1; | ||
21 | tmp |= S3C2410_CLKCON_UART2; | ||
22 | |||
23 | __raw_writel(tmp, S3C2410_CLKCON); | ||
24 | udelay(10); | ||
25 | } | ||
26 | |||
27 | static inline void s3c_pm_arch_prepare_irqs(void) | ||
28 | { | ||
29 | __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK); | ||
30 | __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK); | ||
31 | |||
32 | /* ack any outstanding external interrupts before we go to sleep */ | ||
33 | |||
34 | __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND); | ||
35 | __raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND); | ||
36 | __raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND); | ||
37 | |||
38 | } | ||
39 | |||
40 | static inline void s3c_pm_arch_stop_clocks(void) | ||
41 | { | ||
42 | __raw_writel(0x00, S3C2410_CLKCON); /* turn off clocks over sleep */ | ||
43 | } | ||
44 | |||
45 | static void s3c_pm_show_resume_irqs(int start, unsigned long which, | ||
46 | unsigned long mask); | ||
47 | |||
48 | static inline void s3c_pm_arch_show_resume_irqs(void) | ||
49 | { | ||
50 | S3C_PMDBG("post sleep: IRQs 0x%08x, 0x%08x\n", | ||
51 | __raw_readl(S3C2410_SRCPND), | ||
52 | __raw_readl(S3C2410_EINTPEND)); | ||
53 | |||
54 | s3c_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND), | ||
55 | s3c_irqwake_intmask); | ||
56 | |||
57 | s3c_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND), | ||
58 | s3c_irqwake_eintmask); | ||
59 | } | ||
60 | |||
61 | static inline void s3c_pm_arch_update_uart(void __iomem *regs, | ||
62 | struct pm_uart_save *save) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | static inline void s3c_pm_restored_gpios(void) { } | ||
67 | static inline void samsung_pm_saved_gpios(void) { } | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h new file mode 100644 index 000000000000..3415b60082d7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://armlinux.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * S3C2410 clock register definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_REGS_CLOCK | ||
14 | #define __ASM_ARM_REGS_CLOCK | ||
15 | |||
16 | #define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR) | ||
17 | |||
18 | #define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s))) | ||
19 | |||
20 | #define S3C2410_LOCKTIME S3C2410_CLKREG(0x00) | ||
21 | #define S3C2410_MPLLCON S3C2410_CLKREG(0x04) | ||
22 | #define S3C2410_UPLLCON S3C2410_CLKREG(0x08) | ||
23 | #define S3C2410_CLKCON S3C2410_CLKREG(0x0C) | ||
24 | #define S3C2410_CLKSLOW S3C2410_CLKREG(0x10) | ||
25 | #define S3C2410_CLKDIVN S3C2410_CLKREG(0x14) | ||
26 | |||
27 | #define S3C2410_CLKCON_IDLE (1<<2) | ||
28 | #define S3C2410_CLKCON_POWER (1<<3) | ||
29 | #define S3C2410_CLKCON_NAND (1<<4) | ||
30 | #define S3C2410_CLKCON_LCDC (1<<5) | ||
31 | #define S3C2410_CLKCON_USBH (1<<6) | ||
32 | #define S3C2410_CLKCON_USBD (1<<7) | ||
33 | #define S3C2410_CLKCON_PWMT (1<<8) | ||
34 | #define S3C2410_CLKCON_SDI (1<<9) | ||
35 | #define S3C2410_CLKCON_UART0 (1<<10) | ||
36 | #define S3C2410_CLKCON_UART1 (1<<11) | ||
37 | #define S3C2410_CLKCON_UART2 (1<<12) | ||
38 | #define S3C2410_CLKCON_GPIO (1<<13) | ||
39 | #define S3C2410_CLKCON_RTC (1<<14) | ||
40 | #define S3C2410_CLKCON_ADC (1<<15) | ||
41 | #define S3C2410_CLKCON_IIC (1<<16) | ||
42 | #define S3C2410_CLKCON_IIS (1<<17) | ||
43 | #define S3C2410_CLKCON_SPI (1<<18) | ||
44 | |||
45 | /* DCLKCON register addresses in gpio.h */ | ||
46 | |||
47 | #define S3C2410_DCLKCON_DCLK0EN (1<<0) | ||
48 | #define S3C2410_DCLKCON_DCLK0_PCLK (0<<1) | ||
49 | #define S3C2410_DCLKCON_DCLK0_UCLK (1<<1) | ||
50 | #define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4) | ||
51 | #define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8) | ||
52 | #define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4) | ||
53 | #define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8) | ||
54 | |||
55 | #define S3C2410_DCLKCON_DCLK1EN (1<<16) | ||
56 | #define S3C2410_DCLKCON_DCLK1_PCLK (0<<17) | ||
57 | #define S3C2410_DCLKCON_DCLK1_UCLK (1<<17) | ||
58 | #define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20) | ||
59 | #define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24) | ||
60 | #define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20) | ||
61 | #define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24) | ||
62 | |||
63 | #define S3C2410_CLKDIVN_PDIVN (1<<0) | ||
64 | #define S3C2410_CLKDIVN_HDIVN (1<<1) | ||
65 | |||
66 | #define S3C2410_CLKSLOW_UCLK_OFF (1<<7) | ||
67 | #define S3C2410_CLKSLOW_MPLL_OFF (1<<5) | ||
68 | #define S3C2410_CLKSLOW_SLOW (1<<4) | ||
69 | #define S3C2410_CLKSLOW_SLOWVAL(x) (x) | ||
70 | #define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7) | ||
71 | |||
72 | #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) | ||
73 | |||
74 | /* extra registers */ | ||
75 | #define S3C2440_CAMDIVN S3C2410_CLKREG(0x18) | ||
76 | |||
77 | #define S3C2440_CLKCON_CAMERA (1<<19) | ||
78 | #define S3C2440_CLKCON_AC97 (1<<20) | ||
79 | |||
80 | #define S3C2440_CLKDIVN_PDIVN (1<<0) | ||
81 | #define S3C2440_CLKDIVN_HDIVN_MASK (3<<1) | ||
82 | #define S3C2440_CLKDIVN_HDIVN_1 (0<<1) | ||
83 | #define S3C2440_CLKDIVN_HDIVN_2 (1<<1) | ||
84 | #define S3C2440_CLKDIVN_HDIVN_4_8 (2<<1) | ||
85 | #define S3C2440_CLKDIVN_HDIVN_3_6 (3<<1) | ||
86 | #define S3C2440_CLKDIVN_UCLK (1<<3) | ||
87 | |||
88 | #define S3C2440_CAMDIVN_CAMCLK_MASK (0xf<<0) | ||
89 | #define S3C2440_CAMDIVN_CAMCLK_SEL (1<<4) | ||
90 | #define S3C2440_CAMDIVN_HCLK3_HALF (1<<8) | ||
91 | #define S3C2440_CAMDIVN_HCLK4_HALF (1<<9) | ||
92 | #define S3C2440_CAMDIVN_DVSEN (1<<12) | ||
93 | |||
94 | #define S3C2442_CAMDIVN_CAMCLK_DIV3 (1<<5) | ||
95 | |||
96 | #endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */ | ||
97 | |||
98 | #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) | ||
99 | |||
100 | #define S3C2412_OSCSET S3C2410_CLKREG(0x18) | ||
101 | #define S3C2412_CLKSRC S3C2410_CLKREG(0x1C) | ||
102 | |||
103 | #define S3C2412_PLLCON_OFF (1<<20) | ||
104 | |||
105 | #define S3C2412_CLKDIVN_PDIVN (1<<2) | ||
106 | #define S3C2412_CLKDIVN_HDIVN_MASK (3<<0) | ||
107 | #define S3C2412_CLKDIVN_ARMDIVN (1<<3) | ||
108 | #define S3C2412_CLKDIVN_DVSEN (1<<4) | ||
109 | #define S3C2412_CLKDIVN_HALFHCLK (1<<5) | ||
110 | #define S3C2412_CLKDIVN_USB48DIV (1<<6) | ||
111 | #define S3C2412_CLKDIVN_UARTDIV_MASK (15<<8) | ||
112 | #define S3C2412_CLKDIVN_UARTDIV_SHIFT (8) | ||
113 | #define S3C2412_CLKDIVN_I2SDIV_MASK (15<<12) | ||
114 | #define S3C2412_CLKDIVN_I2SDIV_SHIFT (12) | ||
115 | #define S3C2412_CLKDIVN_CAMDIV_MASK (15<<16) | ||
116 | #define S3C2412_CLKDIVN_CAMDIV_SHIFT (16) | ||
117 | |||
118 | #define S3C2412_CLKCON_WDT (1<<28) | ||
119 | #define S3C2412_CLKCON_SPI (1<<27) | ||
120 | #define S3C2412_CLKCON_IIS (1<<26) | ||
121 | #define S3C2412_CLKCON_IIC (1<<25) | ||
122 | #define S3C2412_CLKCON_ADC (1<<24) | ||
123 | #define S3C2412_CLKCON_RTC (1<<23) | ||
124 | #define S3C2412_CLKCON_GPIO (1<<22) | ||
125 | #define S3C2412_CLKCON_UART2 (1<<21) | ||
126 | #define S3C2412_CLKCON_UART1 (1<<20) | ||
127 | #define S3C2412_CLKCON_UART0 (1<<19) | ||
128 | #define S3C2412_CLKCON_SDI (1<<18) | ||
129 | #define S3C2412_CLKCON_PWMT (1<<17) | ||
130 | #define S3C2412_CLKCON_USBD (1<<16) | ||
131 | #define S3C2412_CLKCON_CAMCLK (1<<15) | ||
132 | #define S3C2412_CLKCON_UARTCLK (1<<14) | ||
133 | /* missing 13 */ | ||
134 | #define S3C2412_CLKCON_USB_HOST48 (1<<12) | ||
135 | #define S3C2412_CLKCON_USB_DEV48 (1<<11) | ||
136 | #define S3C2412_CLKCON_HCLKdiv2 (1<<10) | ||
137 | #define S3C2412_CLKCON_HCLKx2 (1<<9) | ||
138 | #define S3C2412_CLKCON_SDRAM (1<<8) | ||
139 | /* missing 7 */ | ||
140 | #define S3C2412_CLKCON_USBH S3C2410_CLKCON_USBH | ||
141 | #define S3C2412_CLKCON_LCDC S3C2410_CLKCON_LCDC | ||
142 | #define S3C2412_CLKCON_NAND S3C2410_CLKCON_NAND | ||
143 | #define S3C2412_CLKCON_DMA3 (1<<3) | ||
144 | #define S3C2412_CLKCON_DMA2 (1<<2) | ||
145 | #define S3C2412_CLKCON_DMA1 (1<<1) | ||
146 | #define S3C2412_CLKCON_DMA0 (1<<0) | ||
147 | |||
148 | /* clock sourec controls */ | ||
149 | |||
150 | #define S3C2412_CLKSRC_EXTCLKDIV_MASK (7 << 0) | ||
151 | #define S3C2412_CLKSRC_EXTCLKDIV_SHIFT (0) | ||
152 | #define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV (1<<3) | ||
153 | #define S3C2412_CLKSRC_MSYSCLK_MPLL (1<<4) | ||
154 | #define S3C2412_CLKSRC_USYSCLK_UPLL (1<<5) | ||
155 | #define S3C2412_CLKSRC_UARTCLK_MPLL (1<<8) | ||
156 | #define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9) | ||
157 | #define S3C2412_CLKSRC_USBCLK_HCLK (1<<10) | ||
158 | #define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11) | ||
159 | #define S3C2412_CLKSRC_UREFCLK_EXTCLK (1<<12) | ||
160 | #define S3C2412_CLKSRC_EREFCLK_EXTCLK (1<<14) | ||
161 | |||
162 | #endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */ | ||
163 | |||
164 | #define S3C2416_CLKDIV2 S3C2410_CLKREG(0x28) | ||
165 | |||
166 | #endif /* __ASM_ARM_REGS_CLOCK */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h b/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h new file mode 100644 index 000000000000..98fd4a05587c --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h | |||
@@ -0,0 +1,220 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-dsc.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2440/S3C2412 Signal Drive Strength Control | ||
11 | */ | ||
12 | |||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_DSC_H | ||
15 | #define __ASM_ARCH_REGS_DSC_H "2440-dsc" | ||
16 | |||
17 | #if defined(CONFIG_CPU_S3C2412) | ||
18 | #define S3C2412_DSC0 S3C2410_GPIOREG(0xdc) | ||
19 | #define S3C2412_DSC1 S3C2410_GPIOREG(0xe0) | ||
20 | #endif | ||
21 | |||
22 | #if defined(CONFIG_CPU_S3C2416) | ||
23 | #define S3C2416_DSC0 S3C2410_GPIOREG(0xc0) | ||
24 | #define S3C2416_DSC1 S3C2410_GPIOREG(0xc4) | ||
25 | #define S3C2416_DSC2 S3C2410_GPIOREG(0xc8) | ||
26 | #define S3C2416_DSC3 S3C2410_GPIOREG(0x110) | ||
27 | |||
28 | #define S3C2416_SELECT_DSC0 (0 << 30) | ||
29 | #define S3C2416_SELECT_DSC1 (1 << 30) | ||
30 | #define S3C2416_SELECT_DSC2 (2 << 30) | ||
31 | #define S3C2416_SELECT_DSC3 (3 << 30) | ||
32 | |||
33 | #define S3C2416_DSC_GETSHIFT(x) (x & 30) | ||
34 | |||
35 | #define S3C2416_DSC0_CF (S3C2416_SELECT_DSC0 | 28) | ||
36 | #define S3C2416_DSC0_CF_5mA (0 << 28) | ||
37 | #define S3C2416_DSC0_CF_10mA (1 << 28) | ||
38 | #define S3C2416_DSC0_CF_15mA (2 << 28) | ||
39 | #define S3C2416_DSC0_CF_21mA (3 << 28) | ||
40 | #define S3C2416_DSC0_CF_MASK (3 << 28) | ||
41 | |||
42 | #define S3C2416_DSC0_nRBE (S3C2416_SELECT_DSC0 | 26) | ||
43 | #define S3C2416_DSC0_nRBE_5mA (0 << 26) | ||
44 | #define S3C2416_DSC0_nRBE_10mA (1 << 26) | ||
45 | #define S3C2416_DSC0_nRBE_15mA (2 << 26) | ||
46 | #define S3C2416_DSC0_nRBE_21mA (3 << 26) | ||
47 | #define S3C2416_DSC0_nRBE_MASK (3 << 26) | ||
48 | |||
49 | #define S3C2416_DSC0_nROE (S3C2416_SELECT_DSC0 | 24) | ||
50 | #define S3C2416_DSC0_nROE_5mA (0 << 24) | ||
51 | #define S3C2416_DSC0_nROE_10mA (1 << 24) | ||
52 | #define S3C2416_DSC0_nROE_15mA (2 << 24) | ||
53 | #define S3C2416_DSC0_nROE_21mA (3 << 24) | ||
54 | #define S3C2416_DSC0_nROE_MASK (3 << 24) | ||
55 | |||
56 | #endif | ||
57 | |||
58 | #if defined(CONFIG_CPU_S3C244X) | ||
59 | |||
60 | #define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) | ||
61 | #define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) | ||
62 | |||
63 | #define S3C2440_SELECT_DSC0 (0) | ||
64 | #define S3C2440_SELECT_DSC1 (1<<31) | ||
65 | |||
66 | #define S3C2440_DSC_GETSHIFT(x) ((x) & 31) | ||
67 | |||
68 | #define S3C2440_DSC0_DISABLE (1<<31) | ||
69 | |||
70 | #define S3C2440_DSC0_ADDR (S3C2440_SELECT_DSC0 | 8) | ||
71 | #define S3C2440_DSC0_ADDR_12mA (0<<8) | ||
72 | #define S3C2440_DSC0_ADDR_10mA (1<<8) | ||
73 | #define S3C2440_DSC0_ADDR_8mA (2<<8) | ||
74 | #define S3C2440_DSC0_ADDR_6mA (3<<8) | ||
75 | #define S3C2440_DSC0_ADDR_MASK (3<<8) | ||
76 | |||
77 | /* D24..D31 */ | ||
78 | #define S3C2440_DSC0_DATA3 (S3C2440_SELECT_DSC0 | 6) | ||
79 | #define S3C2440_DSC0_DATA3_12mA (0<<6) | ||
80 | #define S3C2440_DSC0_DATA3_10mA (1<<6) | ||
81 | #define S3C2440_DSC0_DATA3_8mA (2<<6) | ||
82 | #define S3C2440_DSC0_DATA3_6mA (3<<6) | ||
83 | #define S3C2440_DSC0_DATA3_MASK (3<<6) | ||
84 | |||
85 | /* D16..D23 */ | ||
86 | #define S3C2440_DSC0_DATA2 (S3C2440_SELECT_DSC0 | 4) | ||
87 | #define S3C2440_DSC0_DATA2_12mA (0<<4) | ||
88 | #define S3C2440_DSC0_DATA2_10mA (1<<4) | ||
89 | #define S3C2440_DSC0_DATA2_8mA (2<<4) | ||
90 | #define S3C2440_DSC0_DATA2_6mA (3<<4) | ||
91 | #define S3C2440_DSC0_DATA2_MASK (3<<4) | ||
92 | |||
93 | /* D8..D15 */ | ||
94 | #define S3C2440_DSC0_DATA1 (S3C2440_SELECT_DSC0 | 2) | ||
95 | #define S3C2440_DSC0_DATA1_12mA (0<<2) | ||
96 | #define S3C2440_DSC0_DATA1_10mA (1<<2) | ||
97 | #define S3C2440_DSC0_DATA1_8mA (2<<2) | ||
98 | #define S3C2440_DSC0_DATA1_6mA (3<<2) | ||
99 | #define S3C2440_DSC0_DATA1_MASK (3<<2) | ||
100 | |||
101 | /* D0..D7 */ | ||
102 | #define S3C2440_DSC0_DATA0 (S3C2440_SELECT_DSC0 | 0) | ||
103 | #define S3C2440_DSC0_DATA0_12mA (0<<0) | ||
104 | #define S3C2440_DSC0_DATA0_10mA (1<<0) | ||
105 | #define S3C2440_DSC0_DATA0_8mA (2<<0) | ||
106 | #define S3C2440_DSC0_DATA0_6mA (3<<0) | ||
107 | #define S3C2440_DSC0_DATA0_MASK (3<<0) | ||
108 | |||
109 | #define S3C2440_DSC1_SCK1 (S3C2440_SELECT_DSC1 | 28) | ||
110 | #define S3C2440_DSC1_SCK1_12mA (0<<28) | ||
111 | #define S3C2440_DSC1_SCK1_10mA (1<<28) | ||
112 | #define S3C2440_DSC1_SCK1_8mA (2<<28) | ||
113 | #define S3C2440_DSC1_SCK1_6mA (3<<28) | ||
114 | #define S3C2440_DSC1_SCK1_MASK (3<<28) | ||
115 | |||
116 | #define S3C2440_DSC1_SCK0 (S3C2440_SELECT_DSC1 | 26) | ||
117 | #define S3C2440_DSC1_SCK0_12mA (0<<26) | ||
118 | #define S3C2440_DSC1_SCK0_10mA (1<<26) | ||
119 | #define S3C2440_DSC1_SCK0_8mA (2<<26) | ||
120 | #define S3C2440_DSC1_SCK0_6mA (3<<26) | ||
121 | #define S3C2440_DSC1_SCK0_MASK (3<<26) | ||
122 | |||
123 | #define S3C2440_DSC1_SCKE (S3C2440_SELECT_DSC1 | 24) | ||
124 | #define S3C2440_DSC1_SCKE_10mA (0<<24) | ||
125 | #define S3C2440_DSC1_SCKE_8mA (1<<24) | ||
126 | #define S3C2440_DSC1_SCKE_6mA (2<<24) | ||
127 | #define S3C2440_DSC1_SCKE_4mA (3<<24) | ||
128 | #define S3C2440_DSC1_SCKE_MASK (3<<24) | ||
129 | |||
130 | /* SDRAM nRAS/nCAS */ | ||
131 | #define S3C2440_DSC1_SDR (S3C2440_SELECT_DSC1 | 22) | ||
132 | #define S3C2440_DSC1_SDR_10mA (0<<22) | ||
133 | #define S3C2440_DSC1_SDR_8mA (1<<22) | ||
134 | #define S3C2440_DSC1_SDR_6mA (2<<22) | ||
135 | #define S3C2440_DSC1_SDR_4mA (3<<22) | ||
136 | #define S3C2440_DSC1_SDR_MASK (3<<22) | ||
137 | |||
138 | /* NAND Flash Controller */ | ||
139 | #define S3C2440_DSC1_NFC (S3C2440_SELECT_DSC1 | 20) | ||
140 | #define S3C2440_DSC1_NFC_10mA (0<<20) | ||
141 | #define S3C2440_DSC1_NFC_8mA (1<<20) | ||
142 | #define S3C2440_DSC1_NFC_6mA (2<<20) | ||
143 | #define S3C2440_DSC1_NFC_4mA (3<<20) | ||
144 | #define S3C2440_DSC1_NFC_MASK (3<<20) | ||
145 | |||
146 | /* nBE[0..3] */ | ||
147 | #define S3C2440_DSC1_nBE (S3C2440_SELECT_DSC1 | 18) | ||
148 | #define S3C2440_DSC1_nBE_10mA (0<<18) | ||
149 | #define S3C2440_DSC1_nBE_8mA (1<<18) | ||
150 | #define S3C2440_DSC1_nBE_6mA (2<<18) | ||
151 | #define S3C2440_DSC1_nBE_4mA (3<<18) | ||
152 | #define S3C2440_DSC1_nBE_MASK (3<<18) | ||
153 | |||
154 | #define S3C2440_DSC1_WOE (S3C2440_SELECT_DSC1 | 16) | ||
155 | #define S3C2440_DSC1_WOE_10mA (0<<16) | ||
156 | #define S3C2440_DSC1_WOE_8mA (1<<16) | ||
157 | #define S3C2440_DSC1_WOE_6mA (2<<16) | ||
158 | #define S3C2440_DSC1_WOE_4mA (3<<16) | ||
159 | #define S3C2440_DSC1_WOE_MASK (3<<16) | ||
160 | |||
161 | #define S3C2440_DSC1_CS7 (S3C2440_SELECT_DSC1 | 14) | ||
162 | #define S3C2440_DSC1_CS7_10mA (0<<14) | ||
163 | #define S3C2440_DSC1_CS7_8mA (1<<14) | ||
164 | #define S3C2440_DSC1_CS7_6mA (2<<14) | ||
165 | #define S3C2440_DSC1_CS7_4mA (3<<14) | ||
166 | #define S3C2440_DSC1_CS7_MASK (3<<14) | ||
167 | |||
168 | #define S3C2440_DSC1_CS6 (S3C2440_SELECT_DSC1 | 12) | ||
169 | #define S3C2440_DSC1_CS6_10mA (0<<12) | ||
170 | #define S3C2440_DSC1_CS6_8mA (1<<12) | ||
171 | #define S3C2440_DSC1_CS6_6mA (2<<12) | ||
172 | #define S3C2440_DSC1_CS6_4mA (3<<12) | ||
173 | #define S3C2440_DSC1_CS6_MASK (3<<12) | ||
174 | |||
175 | #define S3C2440_DSC1_CS5 (S3C2440_SELECT_DSC1 | 10) | ||
176 | #define S3C2440_DSC1_CS5_10mA (0<<10) | ||
177 | #define S3C2440_DSC1_CS5_8mA (1<<10) | ||
178 | #define S3C2440_DSC1_CS5_6mA (2<<10) | ||
179 | #define S3C2440_DSC1_CS5_4mA (3<<10) | ||
180 | #define S3C2440_DSC1_CS5_MASK (3<<10) | ||
181 | |||
182 | #define S3C2440_DSC1_CS4 (S3C2440_SELECT_DSC1 | 8) | ||
183 | #define S3C2440_DSC1_CS4_10mA (0<<8) | ||
184 | #define S3C2440_DSC1_CS4_8mA (1<<8) | ||
185 | #define S3C2440_DSC1_CS4_6mA (2<<8) | ||
186 | #define S3C2440_DSC1_CS4_4mA (3<<8) | ||
187 | #define S3C2440_DSC1_CS4_MASK (3<<8) | ||
188 | |||
189 | #define S3C2440_DSC1_CS3 (S3C2440_SELECT_DSC1 | 6) | ||
190 | #define S3C2440_DSC1_CS3_10mA (0<<6) | ||
191 | #define S3C2440_DSC1_CS3_8mA (1<<6) | ||
192 | #define S3C2440_DSC1_CS3_6mA (2<<6) | ||
193 | #define S3C2440_DSC1_CS3_4mA (3<<6) | ||
194 | #define S3C2440_DSC1_CS3_MASK (3<<6) | ||
195 | |||
196 | #define S3C2440_DSC1_CS2 (S3C2440_SELECT_DSC1 | 4) | ||
197 | #define S3C2440_DSC1_CS2_10mA (0<<4) | ||
198 | #define S3C2440_DSC1_CS2_8mA (1<<4) | ||
199 | #define S3C2440_DSC1_CS2_6mA (2<<4) | ||
200 | #define S3C2440_DSC1_CS2_4mA (3<<4) | ||
201 | #define S3C2440_DSC1_CS2_MASK (3<<4) | ||
202 | |||
203 | #define S3C2440_DSC1_CS1 (S3C2440_SELECT_DSC1 | 2) | ||
204 | #define S3C2440_DSC1_CS1_10mA (0<<2) | ||
205 | #define S3C2440_DSC1_CS1_8mA (1<<2) | ||
206 | #define S3C2440_DSC1_CS1_6mA (2<<2) | ||
207 | #define S3C2440_DSC1_CS1_4mA (3<<2) | ||
208 | #define S3C2440_DSC1_CS1_MASK (3<<2) | ||
209 | |||
210 | #define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0) | ||
211 | #define S3C2440_DSC1_CS0_10mA (0<<0) | ||
212 | #define S3C2440_DSC1_CS0_8mA (1<<0) | ||
213 | #define S3C2440_DSC1_CS0_6mA (2<<0) | ||
214 | #define S3C2440_DSC1_CS0_4mA (3<<0) | ||
215 | #define S3C2440_DSC1_CS0_MASK (3<<0) | ||
216 | |||
217 | #endif /* CONFIG_CPU_S3C2440 */ | ||
218 | |||
219 | #endif /* __ASM_ARCH_REGS_DSC_H */ | ||
220 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h new file mode 100644 index 000000000000..cac1ad6b582c --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h | |||
@@ -0,0 +1,602 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2410 GPIO register definitions | ||
11 | */ | ||
12 | |||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_GPIO_H | ||
15 | #define __ASM_ARCH_REGS_GPIO_H | ||
16 | |||
17 | #include <mach/gpio-nrs.h> | ||
18 | |||
19 | #define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80) | ||
20 | |||
21 | /* general configuration options */ | ||
22 | |||
23 | #define S3C2410_GPIO_LEAVE (0xFFFFFFFF) | ||
24 | #define S3C2410_GPIO_INPUT (0xFFFFFFF0) /* not available on A */ | ||
25 | #define S3C2410_GPIO_OUTPUT (0xFFFFFFF1) | ||
26 | #define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */ | ||
27 | #define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* bank A => addr/cs/nand */ | ||
28 | #define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ | ||
29 | |||
30 | /* register address for the GPIO registers. | ||
31 | * S3C24XX_GPIOREG2 is for the second set of registers in the | ||
32 | * GPIO which move between s3c2410 and s3c2412 type systems */ | ||
33 | |||
34 | #define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO) | ||
35 | #define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2) | ||
36 | |||
37 | |||
38 | /* configure GPIO ports A..G */ | ||
39 | |||
40 | /* port A - S3C2410: 22bits, zero in bit X makes pin X output | ||
41 | * 1 makes port special function, this is default | ||
42 | */ | ||
43 | #define S3C2410_GPACON S3C2410_GPIOREG(0x00) | ||
44 | #define S3C2410_GPADAT S3C2410_GPIOREG(0x04) | ||
45 | |||
46 | #define S3C2410_GPA0_ADDR0 (1<<0) | ||
47 | #define S3C2410_GPA1_ADDR16 (1<<1) | ||
48 | #define S3C2410_GPA2_ADDR17 (1<<2) | ||
49 | #define S3C2410_GPA3_ADDR18 (1<<3) | ||
50 | #define S3C2410_GPA4_ADDR19 (1<<4) | ||
51 | #define S3C2410_GPA5_ADDR20 (1<<5) | ||
52 | #define S3C2410_GPA6_ADDR21 (1<<6) | ||
53 | #define S3C2410_GPA7_ADDR22 (1<<7) | ||
54 | #define S3C2410_GPA8_ADDR23 (1<<8) | ||
55 | #define S3C2410_GPA9_ADDR24 (1<<9) | ||
56 | #define S3C2410_GPA10_ADDR25 (1<<10) | ||
57 | #define S3C2410_GPA11_ADDR26 (1<<11) | ||
58 | #define S3C2410_GPA12_nGCS1 (1<<12) | ||
59 | #define S3C2410_GPA13_nGCS2 (1<<13) | ||
60 | #define S3C2410_GPA14_nGCS3 (1<<14) | ||
61 | #define S3C2410_GPA15_nGCS4 (1<<15) | ||
62 | #define S3C2410_GPA16_nGCS5 (1<<16) | ||
63 | #define S3C2410_GPA17_CLE (1<<17) | ||
64 | #define S3C2410_GPA18_ALE (1<<18) | ||
65 | #define S3C2410_GPA19_nFWE (1<<19) | ||
66 | #define S3C2410_GPA20_nFRE (1<<20) | ||
67 | #define S3C2410_GPA21_nRSTOUT (1<<21) | ||
68 | #define S3C2410_GPA22_nFCE (1<<22) | ||
69 | |||
70 | /* 0x08 and 0x0c are reserved on S3C2410 */ | ||
71 | |||
72 | /* S3C2410: | ||
73 | * GPB is 10 IO pins, each configured by 2 bits each in GPBCON. | ||
74 | * 00 = input, 01 = output, 10=special function, 11=reserved | ||
75 | |||
76 | * bit 0,1 = pin 0, 2,3= pin 1... | ||
77 | * | ||
78 | * CPBUP = pull up resistor control, 1=disabled, 0=enabled | ||
79 | */ | ||
80 | |||
81 | #define S3C2410_GPBCON S3C2410_GPIOREG(0x10) | ||
82 | #define S3C2410_GPBDAT S3C2410_GPIOREG(0x14) | ||
83 | #define S3C2410_GPBUP S3C2410_GPIOREG(0x18) | ||
84 | |||
85 | /* no i/o pin in port b can have value 3 (unless it is a s3c2443) ! */ | ||
86 | |||
87 | #define S3C2410_GPB0_TOUT0 (0x02 << 0) | ||
88 | |||
89 | #define S3C2410_GPB1_TOUT1 (0x02 << 2) | ||
90 | |||
91 | #define S3C2410_GPB2_TOUT2 (0x02 << 4) | ||
92 | |||
93 | #define S3C2410_GPB3_TOUT3 (0x02 << 6) | ||
94 | |||
95 | #define S3C2410_GPB4_TCLK0 (0x02 << 8) | ||
96 | #define S3C2410_GPB4_MASK (0x03 << 8) | ||
97 | |||
98 | #define S3C2410_GPB5_nXBACK (0x02 << 10) | ||
99 | #define S3C2443_GPB5_XBACK (0x03 << 10) | ||
100 | |||
101 | #define S3C2410_GPB6_nXBREQ (0x02 << 12) | ||
102 | #define S3C2443_GPB6_XBREQ (0x03 << 12) | ||
103 | |||
104 | #define S3C2410_GPB7_nXDACK1 (0x02 << 14) | ||
105 | #define S3C2443_GPB7_XDACK1 (0x03 << 14) | ||
106 | |||
107 | #define S3C2410_GPB8_nXDREQ1 (0x02 << 16) | ||
108 | |||
109 | #define S3C2410_GPB9_nXDACK0 (0x02 << 18) | ||
110 | #define S3C2443_GPB9_XDACK0 (0x03 << 18) | ||
111 | |||
112 | #define S3C2410_GPB10_nXDRE0 (0x02 << 20) | ||
113 | #define S3C2443_GPB10_XDREQ0 (0x03 << 20) | ||
114 | |||
115 | #define S3C2410_GPB_PUPDIS(x) (1<<(x)) | ||
116 | |||
117 | /* Port C consits of 16 GPIO/Special function | ||
118 | * | ||
119 | * almost identical setup to port b, but the special functions are mostly | ||
120 | * to do with the video system's sync/etc. | ||
121 | */ | ||
122 | |||
123 | #define S3C2410_GPCCON S3C2410_GPIOREG(0x20) | ||
124 | #define S3C2410_GPCDAT S3C2410_GPIOREG(0x24) | ||
125 | #define S3C2410_GPCUP S3C2410_GPIOREG(0x28) | ||
126 | #define S3C2410_GPC0_LEND (0x02 << 0) | ||
127 | #define S3C2410_GPC1_VCLK (0x02 << 2) | ||
128 | #define S3C2410_GPC2_VLINE (0x02 << 4) | ||
129 | #define S3C2410_GPC3_VFRAME (0x02 << 6) | ||
130 | #define S3C2410_GPC4_VM (0x02 << 8) | ||
131 | #define S3C2410_GPC5_LCDVF0 (0x02 << 10) | ||
132 | #define S3C2410_GPC6_LCDVF1 (0x02 << 12) | ||
133 | #define S3C2410_GPC7_LCDVF2 (0x02 << 14) | ||
134 | #define S3C2410_GPC8_VD0 (0x02 << 16) | ||
135 | #define S3C2410_GPC9_VD1 (0x02 << 18) | ||
136 | #define S3C2410_GPC10_VD2 (0x02 << 20) | ||
137 | #define S3C2410_GPC11_VD3 (0x02 << 22) | ||
138 | #define S3C2410_GPC12_VD4 (0x02 << 24) | ||
139 | #define S3C2410_GPC13_VD5 (0x02 << 26) | ||
140 | #define S3C2410_GPC14_VD6 (0x02 << 28) | ||
141 | #define S3C2410_GPC15_VD7 (0x02 << 30) | ||
142 | #define S3C2410_GPC_PUPDIS(x) (1<<(x)) | ||
143 | |||
144 | /* | ||
145 | * S3C2410: Port D consists of 16 GPIO/Special function | ||
146 | * | ||
147 | * almost identical setup to port b, but the special functions are mostly | ||
148 | * to do with the video system's data. | ||
149 | * | ||
150 | * almost identical setup to port c | ||
151 | */ | ||
152 | |||
153 | #define S3C2410_GPDCON S3C2410_GPIOREG(0x30) | ||
154 | #define S3C2410_GPDDAT S3C2410_GPIOREG(0x34) | ||
155 | #define S3C2410_GPDUP S3C2410_GPIOREG(0x38) | ||
156 | |||
157 | #define S3C2410_GPD0_VD8 (0x02 << 0) | ||
158 | #define S3C2442_GPD0_nSPICS1 (0x03 << 0) | ||
159 | |||
160 | #define S3C2410_GPD1_VD9 (0x02 << 2) | ||
161 | #define S3C2442_GPD1_SPICLK1 (0x03 << 2) | ||
162 | |||
163 | #define S3C2410_GPD2_VD10 (0x02 << 4) | ||
164 | |||
165 | #define S3C2410_GPD3_VD11 (0x02 << 6) | ||
166 | |||
167 | #define S3C2410_GPD4_VD12 (0x02 << 8) | ||
168 | |||
169 | #define S3C2410_GPD5_VD13 (0x02 << 10) | ||
170 | |||
171 | #define S3C2410_GPD6_VD14 (0x02 << 12) | ||
172 | |||
173 | #define S3C2410_GPD7_VD15 (0x02 << 14) | ||
174 | |||
175 | #define S3C2410_GPD8_VD16 (0x02 << 16) | ||
176 | #define S3C2440_GPD8_SPIMISO1 (0x03 << 16) | ||
177 | |||
178 | #define S3C2410_GPD9_VD17 (0x02 << 18) | ||
179 | #define S3C2440_GPD9_SPIMOSI1 (0x03 << 18) | ||
180 | |||
181 | #define S3C2410_GPD10_VD18 (0x02 << 20) | ||
182 | #define S3C2440_GPD10_SPICLK1 (0x03 << 20) | ||
183 | |||
184 | #define S3C2410_GPD11_VD19 (0x02 << 22) | ||
185 | |||
186 | #define S3C2410_GPD12_VD20 (0x02 << 24) | ||
187 | |||
188 | #define S3C2410_GPD13_VD21 (0x02 << 26) | ||
189 | |||
190 | #define S3C2410_GPD14_VD22 (0x02 << 28) | ||
191 | #define S3C2410_GPD14_nSS1 (0x03 << 28) | ||
192 | |||
193 | #define S3C2410_GPD15_VD23 (0x02 << 30) | ||
194 | #define S3C2410_GPD15_nSS0 (0x03 << 30) | ||
195 | |||
196 | #define S3C2410_GPD_PUPDIS(x) (1<<(x)) | ||
197 | |||
198 | /* S3C2410: | ||
199 | * Port E consists of 16 GPIO/Special function | ||
200 | * | ||
201 | * again, the same as port B, but dealing with I2S, SDI, and | ||
202 | * more miscellaneous functions | ||
203 | * | ||
204 | * GPIO / interrupt inputs | ||
205 | */ | ||
206 | |||
207 | #define S3C2410_GPECON S3C2410_GPIOREG(0x40) | ||
208 | #define S3C2410_GPEDAT S3C2410_GPIOREG(0x44) | ||
209 | #define S3C2410_GPEUP S3C2410_GPIOREG(0x48) | ||
210 | |||
211 | #define S3C2410_GPE0_I2SLRCK (0x02 << 0) | ||
212 | #define S3C2443_GPE0_AC_nRESET (0x03 << 0) | ||
213 | #define S3C2410_GPE0_MASK (0x03 << 0) | ||
214 | |||
215 | #define S3C2410_GPE1_I2SSCLK (0x02 << 2) | ||
216 | #define S3C2443_GPE1_AC_SYNC (0x03 << 2) | ||
217 | #define S3C2410_GPE1_MASK (0x03 << 2) | ||
218 | |||
219 | #define S3C2410_GPE2_CDCLK (0x02 << 4) | ||
220 | #define S3C2443_GPE2_AC_BITCLK (0x03 << 4) | ||
221 | |||
222 | #define S3C2410_GPE3_I2SSDI (0x02 << 6) | ||
223 | #define S3C2443_GPE3_AC_SDI (0x03 << 6) | ||
224 | #define S3C2410_GPE3_nSS0 (0x03 << 6) | ||
225 | #define S3C2410_GPE3_MASK (0x03 << 6) | ||
226 | |||
227 | #define S3C2410_GPE4_I2SSDO (0x02 << 8) | ||
228 | #define S3C2443_GPE4_AC_SDO (0x03 << 8) | ||
229 | #define S3C2410_GPE4_I2SSDI (0x03 << 8) | ||
230 | #define S3C2410_GPE4_MASK (0x03 << 8) | ||
231 | |||
232 | #define S3C2410_GPE5_SDCLK (0x02 << 10) | ||
233 | #define S3C2443_GPE5_SD1_CLK (0x02 << 10) | ||
234 | #define S3C2443_GPE5_AC_BITCLK (0x03 << 10) | ||
235 | |||
236 | #define S3C2410_GPE6_SDCMD (0x02 << 12) | ||
237 | #define S3C2443_GPE6_SD1_CMD (0x02 << 12) | ||
238 | #define S3C2443_GPE6_AC_SDI (0x03 << 12) | ||
239 | |||
240 | #define S3C2410_GPE7_SDDAT0 (0x02 << 14) | ||
241 | #define S3C2443_GPE5_SD1_DAT0 (0x02 << 14) | ||
242 | #define S3C2443_GPE7_AC_SDO (0x03 << 14) | ||
243 | |||
244 | #define S3C2410_GPE8_SDDAT1 (0x02 << 16) | ||
245 | #define S3C2443_GPE8_SD1_DAT1 (0x02 << 16) | ||
246 | #define S3C2443_GPE8_AC_SYNC (0x03 << 16) | ||
247 | |||
248 | #define S3C2410_GPE9_SDDAT2 (0x02 << 18) | ||
249 | #define S3C2443_GPE9_SD1_DAT2 (0x02 << 18) | ||
250 | #define S3C2443_GPE9_AC_nRESET (0x03 << 18) | ||
251 | |||
252 | #define S3C2410_GPE10_SDDAT3 (0x02 << 20) | ||
253 | #define S3C2443_GPE10_SD1_DAT3 (0x02 << 20) | ||
254 | |||
255 | #define S3C2410_GPE11_SPIMISO0 (0x02 << 22) | ||
256 | |||
257 | #define S3C2410_GPE12_SPIMOSI0 (0x02 << 24) | ||
258 | |||
259 | #define S3C2410_GPE13_SPICLK0 (0x02 << 26) | ||
260 | |||
261 | #define S3C2410_GPE14_IICSCL (0x02 << 28) | ||
262 | #define S3C2410_GPE14_MASK (0x03 << 28) | ||
263 | |||
264 | #define S3C2410_GPE15_IICSDA (0x02 << 30) | ||
265 | #define S3C2410_GPE15_MASK (0x03 << 30) | ||
266 | |||
267 | #define S3C2440_GPE0_ACSYNC (0x03 << 0) | ||
268 | #define S3C2440_GPE1_ACBITCLK (0x03 << 2) | ||
269 | #define S3C2440_GPE2_ACRESET (0x03 << 4) | ||
270 | #define S3C2440_GPE3_ACIN (0x03 << 6) | ||
271 | #define S3C2440_GPE4_ACOUT (0x03 << 8) | ||
272 | |||
273 | #define S3C2410_GPE_PUPDIS(x) (1<<(x)) | ||
274 | |||
275 | /* S3C2410: | ||
276 | * Port F consists of 8 GPIO/Special function | ||
277 | * | ||
278 | * GPIO / interrupt inputs | ||
279 | * | ||
280 | * GPFCON has 2 bits for each of the input pins on port F | ||
281 | * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined | ||
282 | * | ||
283 | * pull up works like all other ports. | ||
284 | * | ||
285 | * GPIO/serial/misc pins | ||
286 | */ | ||
287 | |||
288 | #define S3C2410_GPFCON S3C2410_GPIOREG(0x50) | ||
289 | #define S3C2410_GPFDAT S3C2410_GPIOREG(0x54) | ||
290 | #define S3C2410_GPFUP S3C2410_GPIOREG(0x58) | ||
291 | |||
292 | #define S3C2410_GPF0_EINT0 (0x02 << 0) | ||
293 | #define S3C2410_GPF1_EINT1 (0x02 << 2) | ||
294 | #define S3C2410_GPF2_EINT2 (0x02 << 4) | ||
295 | #define S3C2410_GPF3_EINT3 (0x02 << 6) | ||
296 | #define S3C2410_GPF4_EINT4 (0x02 << 8) | ||
297 | #define S3C2410_GPF5_EINT5 (0x02 << 10) | ||
298 | #define S3C2410_GPF6_EINT6 (0x02 << 12) | ||
299 | #define S3C2410_GPF7_EINT7 (0x02 << 14) | ||
300 | #define S3C2410_GPF_PUPDIS(x) (1<<(x)) | ||
301 | |||
302 | /* S3C2410: | ||
303 | * Port G consists of 8 GPIO/IRQ/Special function | ||
304 | * | ||
305 | * GPGCON has 2 bits for each of the input pins on port F | ||
306 | * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func | ||
307 | * | ||
308 | * pull up works like all other ports. | ||
309 | */ | ||
310 | |||
311 | #define S3C2410_GPGCON S3C2410_GPIOREG(0x60) | ||
312 | #define S3C2410_GPGDAT S3C2410_GPIOREG(0x64) | ||
313 | #define S3C2410_GPGUP S3C2410_GPIOREG(0x68) | ||
314 | |||
315 | #define S3C2410_GPG0_EINT8 (0x02 << 0) | ||
316 | |||
317 | #define S3C2410_GPG1_EINT9 (0x02 << 2) | ||
318 | |||
319 | #define S3C2410_GPG2_EINT10 (0x02 << 4) | ||
320 | #define S3C2410_GPG2_nSS0 (0x03 << 4) | ||
321 | |||
322 | #define S3C2410_GPG3_EINT11 (0x02 << 6) | ||
323 | #define S3C2410_GPG3_nSS1 (0x03 << 6) | ||
324 | |||
325 | #define S3C2410_GPG4_EINT12 (0x02 << 8) | ||
326 | #define S3C2410_GPG4_LCDPWREN (0x03 << 8) | ||
327 | #define S3C2443_GPG4_LCDPWRDN (0x03 << 8) | ||
328 | |||
329 | #define S3C2410_GPG5_EINT13 (0x02 << 10) | ||
330 | #define S3C2410_GPG5_SPIMISO1 (0x03 << 10) /* not s3c2443 */ | ||
331 | |||
332 | #define S3C2410_GPG6_EINT14 (0x02 << 12) | ||
333 | #define S3C2410_GPG6_SPIMOSI1 (0x03 << 12) | ||
334 | |||
335 | #define S3C2410_GPG7_EINT15 (0x02 << 14) | ||
336 | #define S3C2410_GPG7_SPICLK1 (0x03 << 14) | ||
337 | |||
338 | #define S3C2410_GPG8_EINT16 (0x02 << 16) | ||
339 | |||
340 | #define S3C2410_GPG9_EINT17 (0x02 << 18) | ||
341 | |||
342 | #define S3C2410_GPG10_EINT18 (0x02 << 20) | ||
343 | |||
344 | #define S3C2410_GPG11_EINT19 (0x02 << 22) | ||
345 | #define S3C2410_GPG11_TCLK1 (0x03 << 22) | ||
346 | #define S3C2443_GPG11_CF_nIREQ (0x03 << 22) | ||
347 | |||
348 | #define S3C2410_GPG12_EINT20 (0x02 << 24) | ||
349 | #define S3C2410_GPG12_XMON (0x03 << 24) | ||
350 | #define S3C2442_GPG12_nSPICS0 (0x03 << 24) | ||
351 | #define S3C2443_GPG12_nINPACK (0x03 << 24) | ||
352 | |||
353 | #define S3C2410_GPG13_EINT21 (0x02 << 26) | ||
354 | #define S3C2410_GPG13_nXPON (0x03 << 26) | ||
355 | #define S3C2443_GPG13_CF_nREG (0x03 << 26) | ||
356 | |||
357 | #define S3C2410_GPG14_EINT22 (0x02 << 28) | ||
358 | #define S3C2410_GPG14_YMON (0x03 << 28) | ||
359 | #define S3C2443_GPG14_CF_RESET (0x03 << 28) | ||
360 | |||
361 | #define S3C2410_GPG15_EINT23 (0x02 << 30) | ||
362 | #define S3C2410_GPG15_nYPON (0x03 << 30) | ||
363 | #define S3C2443_GPG15_CF_PWR (0x03 << 30) | ||
364 | |||
365 | #define S3C2410_GPG_PUPDIS(x) (1<<(x)) | ||
366 | |||
367 | /* Port H consists of11 GPIO/serial/Misc pins | ||
368 | * | ||
369 | * GPGCON has 2 bits for each of the input pins on port F | ||
370 | * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func | ||
371 | * | ||
372 | * pull up works like all other ports. | ||
373 | */ | ||
374 | |||
375 | #define S3C2410_GPHCON S3C2410_GPIOREG(0x70) | ||
376 | #define S3C2410_GPHDAT S3C2410_GPIOREG(0x74) | ||
377 | #define S3C2410_GPHUP S3C2410_GPIOREG(0x78) | ||
378 | |||
379 | #define S3C2410_GPH0_nCTS0 (0x02 << 0) | ||
380 | #define S3C2416_GPH0_TXD0 (0x02 << 0) | ||
381 | |||
382 | #define S3C2410_GPH1_nRTS0 (0x02 << 2) | ||
383 | #define S3C2416_GPH1_RXD0 (0x02 << 2) | ||
384 | |||
385 | #define S3C2410_GPH2_TXD0 (0x02 << 4) | ||
386 | #define S3C2416_GPH2_TXD1 (0x02 << 4) | ||
387 | |||
388 | #define S3C2410_GPH3_RXD0 (0x02 << 6) | ||
389 | #define S3C2416_GPH3_RXD1 (0x02 << 6) | ||
390 | |||
391 | #define S3C2410_GPH4_TXD1 (0x02 << 8) | ||
392 | #define S3C2416_GPH4_TXD2 (0x02 << 8) | ||
393 | |||
394 | #define S3C2410_GPH5_RXD1 (0x02 << 10) | ||
395 | #define S3C2416_GPH5_RXD2 (0x02 << 10) | ||
396 | |||
397 | #define S3C2410_GPH6_TXD2 (0x02 << 12) | ||
398 | #define S3C2416_GPH6_TXD3 (0x02 << 12) | ||
399 | #define S3C2410_GPH6_nRTS1 (0x03 << 12) | ||
400 | #define S3C2416_GPH6_nRTS2 (0x03 << 12) | ||
401 | |||
402 | #define S3C2410_GPH7_RXD2 (0x02 << 14) | ||
403 | #define S3C2416_GPH7_RXD3 (0x02 << 14) | ||
404 | #define S3C2410_GPH7_nCTS1 (0x03 << 14) | ||
405 | #define S3C2416_GPH7_nCTS2 (0x03 << 14) | ||
406 | |||
407 | #define S3C2410_GPH8_UCLK (0x02 << 16) | ||
408 | #define S3C2416_GPH8_nCTS0 (0x02 << 16) | ||
409 | |||
410 | #define S3C2410_GPH9_CLKOUT0 (0x02 << 18) | ||
411 | #define S3C2442_GPH9_nSPICS0 (0x03 << 18) | ||
412 | #define S3C2416_GPH9_nRTS0 (0x02 << 18) | ||
413 | |||
414 | #define S3C2410_GPH10_CLKOUT1 (0x02 << 20) | ||
415 | #define S3C2416_GPH10_nCTS1 (0x02 << 20) | ||
416 | |||
417 | #define S3C2416_GPH11_nRTS1 (0x02 << 22) | ||
418 | |||
419 | #define S3C2416_GPH12_EXTUARTCLK (0x02 << 24) | ||
420 | |||
421 | #define S3C2416_GPH13_CLKOUT0 (0x02 << 26) | ||
422 | |||
423 | #define S3C2416_GPH14_CLKOUT1 (0x02 << 28) | ||
424 | |||
425 | /* The S3C2412 and S3C2413 move the GPJ register set to after | ||
426 | * GPH, which means all registers after 0x80 are now offset by 0x10 | ||
427 | * for the 2412/2413 from the 2410/2440/2442 | ||
428 | */ | ||
429 | |||
430 | /* S3C2443 and above */ | ||
431 | #define S3C2440_GPJCON S3C2410_GPIOREG(0xD0) | ||
432 | #define S3C2440_GPJDAT S3C2410_GPIOREG(0xD4) | ||
433 | #define S3C2440_GPJUP S3C2410_GPIOREG(0xD8) | ||
434 | |||
435 | #define S3C2443_GPKCON S3C2410_GPIOREG(0xE0) | ||
436 | #define S3C2443_GPKDAT S3C2410_GPIOREG(0xE4) | ||
437 | #define S3C2443_GPKUP S3C2410_GPIOREG(0xE8) | ||
438 | |||
439 | #define S3C2443_GPLCON S3C2410_GPIOREG(0xF0) | ||
440 | #define S3C2443_GPLDAT S3C2410_GPIOREG(0xF4) | ||
441 | #define S3C2443_GPLUP S3C2410_GPIOREG(0xF8) | ||
442 | |||
443 | #define S3C2443_GPMCON S3C2410_GPIOREG(0x100) | ||
444 | #define S3C2443_GPMDAT S3C2410_GPIOREG(0x104) | ||
445 | #define S3C2443_GPMUP S3C2410_GPIOREG(0x108) | ||
446 | |||
447 | /* miscellaneous control */ | ||
448 | #define S3C2410_MISCCR S3C2410_GPIOREG(0x80) | ||
449 | #define S3C2410_DCLKCON S3C2410_GPIOREG(0x84) | ||
450 | |||
451 | #define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84) | ||
452 | |||
453 | /* see clock.h for dclk definitions */ | ||
454 | |||
455 | /* pullup control on databus */ | ||
456 | #define S3C2410_MISCCR_SPUCR_HEN (0<<0) | ||
457 | #define S3C2410_MISCCR_SPUCR_HDIS (1<<0) | ||
458 | #define S3C2410_MISCCR_SPUCR_LEN (0<<1) | ||
459 | #define S3C2410_MISCCR_SPUCR_LDIS (1<<1) | ||
460 | |||
461 | #define S3C2410_MISCCR_USBDEV (0<<3) | ||
462 | #define S3C2410_MISCCR_USBHOST (1<<3) | ||
463 | |||
464 | #define S3C2410_MISCCR_CLK0_MPLL (0<<4) | ||
465 | #define S3C2410_MISCCR_CLK0_UPLL (1<<4) | ||
466 | #define S3C2410_MISCCR_CLK0_FCLK (2<<4) | ||
467 | #define S3C2410_MISCCR_CLK0_HCLK (3<<4) | ||
468 | #define S3C2410_MISCCR_CLK0_PCLK (4<<4) | ||
469 | #define S3C2410_MISCCR_CLK0_DCLK0 (5<<4) | ||
470 | #define S3C2410_MISCCR_CLK0_MASK (7<<4) | ||
471 | |||
472 | #define S3C2412_MISCCR_CLK0_RTC (2<<4) | ||
473 | |||
474 | #define S3C2410_MISCCR_CLK1_MPLL (0<<8) | ||
475 | #define S3C2410_MISCCR_CLK1_UPLL (1<<8) | ||
476 | #define S3C2410_MISCCR_CLK1_FCLK (2<<8) | ||
477 | #define S3C2410_MISCCR_CLK1_HCLK (3<<8) | ||
478 | #define S3C2410_MISCCR_CLK1_PCLK (4<<8) | ||
479 | #define S3C2410_MISCCR_CLK1_DCLK1 (5<<8) | ||
480 | #define S3C2410_MISCCR_CLK1_MASK (7<<8) | ||
481 | |||
482 | #define S3C2412_MISCCR_CLK1_CLKsrc (0<<8) | ||
483 | |||
484 | #define S3C2410_MISCCR_USBSUSPND0 (1<<12) | ||
485 | #define S3C2416_MISCCR_SEL_SUSPND (1<<12) | ||
486 | #define S3C2410_MISCCR_USBSUSPND1 (1<<13) | ||
487 | |||
488 | #define S3C2410_MISCCR_nRSTCON (1<<16) | ||
489 | |||
490 | #define S3C2410_MISCCR_nEN_SCLK0 (1<<17) | ||
491 | #define S3C2410_MISCCR_nEN_SCLK1 (1<<18) | ||
492 | #define S3C2410_MISCCR_nEN_SCLKE (1<<19) /* not 2412 */ | ||
493 | #define S3C2410_MISCCR_SDSLEEP (7<<17) | ||
494 | |||
495 | #define S3C2416_MISCCR_FLT_I2C (1<<24) | ||
496 | #define S3C2416_MISCCR_HSSPI_EN2 (1<<31) | ||
497 | |||
498 | /* external interrupt control... */ | ||
499 | /* S3C2410_EXTINT0 -> irq sense control for EINT0..EINT7 | ||
500 | * S3C2410_EXTINT1 -> irq sense control for EINT8..EINT15 | ||
501 | * S3C2410_EXTINT2 -> irq sense control for EINT16..EINT23 | ||
502 | * | ||
503 | * note S3C2410_EXTINT2 has filtering options for EINT16..EINT23 | ||
504 | * | ||
505 | * Samsung datasheet p9-25 | ||
506 | */ | ||
507 | #define S3C2410_EXTINT0 S3C2410_GPIOREG(0x88) | ||
508 | #define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C) | ||
509 | #define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90) | ||
510 | |||
511 | #define S3C24XX_EXTINT0 S3C24XX_GPIOREG2(0x88) | ||
512 | #define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C) | ||
513 | #define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90) | ||
514 | |||
515 | /* interrupt filtering conrrol for EINT16..EINT23 */ | ||
516 | #define S3C2410_EINFLT0 S3C2410_GPIOREG(0x94) | ||
517 | #define S3C2410_EINFLT1 S3C2410_GPIOREG(0x98) | ||
518 | #define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C) | ||
519 | #define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0) | ||
520 | |||
521 | #define S3C24XX_EINFLT0 S3C24XX_GPIOREG2(0x94) | ||
522 | #define S3C24XX_EINFLT1 S3C24XX_GPIOREG2(0x98) | ||
523 | #define S3C24XX_EINFLT2 S3C24XX_GPIOREG2(0x9C) | ||
524 | #define S3C24XX_EINFLT3 S3C24XX_GPIOREG2(0xA0) | ||
525 | |||
526 | /* values for interrupt filtering */ | ||
527 | #define S3C2410_EINTFLT_PCLK (0x00) | ||
528 | #define S3C2410_EINTFLT_EXTCLK (1<<7) | ||
529 | #define S3C2410_EINTFLT_WIDTHMSK(x) ((x) & 0x3f) | ||
530 | |||
531 | /* removed EINTxxxx defs from here, not meant for this */ | ||
532 | |||
533 | /* GSTATUS have miscellaneous information in them | ||
534 | * | ||
535 | * These move between s3c2410 and s3c2412 style systems. | ||
536 | */ | ||
537 | |||
538 | #define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC) | ||
539 | #define S3C2410_GSTATUS1 S3C2410_GPIOREG(0x0B0) | ||
540 | #define S3C2410_GSTATUS2 S3C2410_GPIOREG(0x0B4) | ||
541 | #define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8) | ||
542 | #define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC) | ||
543 | |||
544 | #define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC) | ||
545 | #define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0) | ||
546 | #define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4) | ||
547 | #define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8) | ||
548 | #define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC) | ||
549 | |||
550 | #define S3C24XX_GSTATUS0 S3C24XX_GPIOREG2(0x0AC) | ||
551 | #define S3C24XX_GSTATUS1 S3C24XX_GPIOREG2(0x0B0) | ||
552 | #define S3C24XX_GSTATUS2 S3C24XX_GPIOREG2(0x0B4) | ||
553 | #define S3C24XX_GSTATUS3 S3C24XX_GPIOREG2(0x0B8) | ||
554 | #define S3C24XX_GSTATUS4 S3C24XX_GPIOREG2(0x0BC) | ||
555 | |||
556 | #define S3C2410_GSTATUS0_nWAIT (1<<3) | ||
557 | #define S3C2410_GSTATUS0_NCON (1<<2) | ||
558 | #define S3C2410_GSTATUS0_RnB (1<<1) | ||
559 | #define S3C2410_GSTATUS0_nBATTFLT (1<<0) | ||
560 | |||
561 | #define S3C2410_GSTATUS1_IDMASK (0xffff0000) | ||
562 | #define S3C2410_GSTATUS1_2410 (0x32410000) | ||
563 | #define S3C2410_GSTATUS1_2412 (0x32412001) | ||
564 | #define S3C2410_GSTATUS1_2416 (0x32416003) | ||
565 | #define S3C2410_GSTATUS1_2440 (0x32440000) | ||
566 | #define S3C2410_GSTATUS1_2442 (0x32440aaa) | ||
567 | /* some 2416 CPUs report this value also */ | ||
568 | #define S3C2410_GSTATUS1_2450 (0x32450003) | ||
569 | |||
570 | #define S3C2410_GSTATUS2_WTRESET (1<<2) | ||
571 | #define S3C2410_GSTATUS2_OFFRESET (1<<1) | ||
572 | #define S3C2410_GSTATUS2_PONRESET (1<<0) | ||
573 | |||
574 | /* 2412/2413 sleep configuration registers */ | ||
575 | |||
576 | #define S3C2412_GPBSLPCON S3C2410_GPIOREG(0x1C) | ||
577 | #define S3C2412_GPCSLPCON S3C2410_GPIOREG(0x2C) | ||
578 | #define S3C2412_GPDSLPCON S3C2410_GPIOREG(0x3C) | ||
579 | #define S3C2412_GPFSLPCON S3C2410_GPIOREG(0x5C) | ||
580 | #define S3C2412_GPGSLPCON S3C2410_GPIOREG(0x6C) | ||
581 | #define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C) | ||
582 | |||
583 | /* definitions for each pin bit */ | ||
584 | #define S3C2412_GPIO_SLPCON_LOW ( 0x00 ) | ||
585 | #define S3C2412_GPIO_SLPCON_HIGH ( 0x01 ) | ||
586 | #define S3C2412_GPIO_SLPCON_IN ( 0x02 ) | ||
587 | #define S3C2412_GPIO_SLPCON_PULL ( 0x03 ) | ||
588 | |||
589 | #define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2)) | ||
590 | #define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2)) | ||
591 | #define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2)) | ||
592 | #define S3C2412_SLPCON_PULL(x) ( 0x03 << ((x) * 2)) | ||
593 | #define S3C2412_SLPCON_EINT(x) ( 0x02 << ((x) * 2)) /* only IRQ pins */ | ||
594 | #define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2)) | ||
595 | |||
596 | #define S3C2412_SLPCON_ALL_LOW (0x0) | ||
597 | #define S3C2412_SLPCON_ALL_HIGH (0x11111111 | 0x44444444) | ||
598 | #define S3C2412_SLPCON_ALL_IN (0x22222222 | 0x88888888) | ||
599 | #define S3C2412_SLPCON_ALL_PULL (0x33333333) | ||
600 | |||
601 | #endif /* __ASM_ARCH_REGS_GPIO_H */ | ||
602 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h new file mode 100644 index 000000000000..19575e061114 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpioj.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-gpioj.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2440 GPIO J register definitions | ||
11 | */ | ||
12 | |||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_GPIOJ_H | ||
15 | #define __ASM_ARCH_REGS_GPIOJ_H "gpioj" | ||
16 | |||
17 | /* Port J consists of 13 GPIO/Camera pins | ||
18 | * | ||
19 | * GPJCON has 2 bits for each of the input pins on port F | ||
20 | * 00 = 0 input, 1 output, 2 Camera | ||
21 | * | ||
22 | * pull up works like all other ports. | ||
23 | */ | ||
24 | |||
25 | #define S3C2413_GPJCON S3C2410_GPIOREG(0x80) | ||
26 | #define S3C2413_GPJDAT S3C2410_GPIOREG(0x84) | ||
27 | #define S3C2413_GPJUP S3C2410_GPIOREG(0x88) | ||
28 | #define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C) | ||
29 | |||
30 | #define S3C2440_GPJ0_OUTP (0x01 << 0) | ||
31 | #define S3C2440_GPJ0_CAMDATA0 (0x02 << 0) | ||
32 | |||
33 | #define S3C2440_GPJ1_OUTP (0x01 << 2) | ||
34 | #define S3C2440_GPJ1_CAMDATA1 (0x02 << 2) | ||
35 | |||
36 | #define S3C2440_GPJ2_OUTP (0x01 << 4) | ||
37 | #define S3C2440_GPJ2_CAMDATA2 (0x02 << 4) | ||
38 | |||
39 | #define S3C2440_GPJ3_OUTP (0x01 << 6) | ||
40 | #define S3C2440_GPJ3_CAMDATA3 (0x02 << 6) | ||
41 | |||
42 | #define S3C2440_GPJ4_OUTP (0x01 << 8) | ||
43 | #define S3C2440_GPJ4_CAMDATA4 (0x02 << 8) | ||
44 | |||
45 | #define S3C2440_GPJ5_OUTP (0x01 << 10) | ||
46 | #define S3C2440_GPJ5_CAMDATA5 (0x02 << 10) | ||
47 | |||
48 | #define S3C2440_GPJ6_OUTP (0x01 << 12) | ||
49 | #define S3C2440_GPJ6_CAMDATA6 (0x02 << 12) | ||
50 | |||
51 | #define S3C2440_GPJ7_OUTP (0x01 << 14) | ||
52 | #define S3C2440_GPJ7_CAMDATA7 (0x02 << 14) | ||
53 | |||
54 | #define S3C2440_GPJ8_OUTP (0x01 << 16) | ||
55 | #define S3C2440_GPJ8_CAMPCLK (0x02 << 16) | ||
56 | |||
57 | #define S3C2440_GPJ9_OUTP (0x01 << 18) | ||
58 | #define S3C2440_GPJ9_CAMVSYNC (0x02 << 18) | ||
59 | |||
60 | #define S3C2440_GPJ10_OUTP (0x01 << 20) | ||
61 | #define S3C2440_GPJ10_CAMHREF (0x02 << 20) | ||
62 | |||
63 | #define S3C2440_GPJ11_OUTP (0x01 << 22) | ||
64 | #define S3C2440_GPJ11_CAMCLKOUT (0x02 << 22) | ||
65 | |||
66 | #define S3C2440_GPJ12_OUTP (0x01 << 24) | ||
67 | #define S3C2440_GPJ12_CAMRESET (0x02 << 24) | ||
68 | |||
69 | #endif /* __ASM_ARCH_REGS_GPIOJ_H */ | ||
70 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-irq.h b/arch/arm/mach-s3c24xx/include/mach/regs-irq.h new file mode 100644 index 000000000000..0f07ba30b1fb --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-irq.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | |||
11 | |||
12 | #ifndef ___ASM_ARCH_REGS_IRQ_H | ||
13 | #define ___ASM_ARCH_REGS_IRQ_H | ||
14 | |||
15 | /* interrupt controller */ | ||
16 | |||
17 | #define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ) | ||
18 | #define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO) | ||
19 | #define S3C24XX_EINTREG(x) ((x) + S3C24XX_VA_GPIO2) | ||
20 | |||
21 | #define S3C2410_SRCPND S3C2410_IRQREG(0x000) | ||
22 | #define S3C2410_INTMOD S3C2410_IRQREG(0x004) | ||
23 | #define S3C2410_INTMSK S3C2410_IRQREG(0x008) | ||
24 | #define S3C2410_PRIORITY S3C2410_IRQREG(0x00C) | ||
25 | #define S3C2410_INTPND S3C2410_IRQREG(0x010) | ||
26 | #define S3C2410_INTOFFSET S3C2410_IRQREG(0x014) | ||
27 | #define S3C2410_SUBSRCPND S3C2410_IRQREG(0x018) | ||
28 | #define S3C2410_INTSUBMSK S3C2410_IRQREG(0x01C) | ||
29 | |||
30 | #define S3C2416_PRIORITY_MODE1 S3C2410_IRQREG(0x030) | ||
31 | #define S3C2416_PRIORITY_UPDATE1 S3C2410_IRQREG(0x034) | ||
32 | #define S3C2416_SRCPND2 S3C2410_IRQREG(0x040) | ||
33 | #define S3C2416_INTMOD2 S3C2410_IRQREG(0x044) | ||
34 | #define S3C2416_INTMSK2 S3C2410_IRQREG(0x048) | ||
35 | #define S3C2416_INTPND2 S3C2410_IRQREG(0x050) | ||
36 | #define S3C2416_INTOFFSET2 S3C2410_IRQREG(0x054) | ||
37 | #define S3C2416_PRIORITY_MODE2 S3C2410_IRQREG(0x070) | ||
38 | #define S3C2416_PRIORITY_UPDATE2 S3C2410_IRQREG(0x074) | ||
39 | |||
40 | /* mask: 0=enable, 1=disable | ||
41 | * 1 bit EINT, 4=EINT4, 23=EINT23 | ||
42 | * EINT0,1,2,3 are not handled here. | ||
43 | */ | ||
44 | |||
45 | #define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4) | ||
46 | #define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8) | ||
47 | #define S3C2412_EINTMASK S3C2410_EINTREG(0x0B4) | ||
48 | #define S3C2412_EINTPEND S3C2410_EINTREG(0X0B8) | ||
49 | |||
50 | #define S3C24XX_EINTMASK S3C24XX_EINTREG(0x0A4) | ||
51 | #define S3C24XX_EINTPEND S3C24XX_EINTREG(0X0A8) | ||
52 | |||
53 | #endif /* ___ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h new file mode 100644 index 000000000000..ee8f040aff5f --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-lcd.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | |||
11 | |||
12 | #ifndef ___ASM_ARCH_REGS_LCD_H | ||
13 | #define ___ASM_ARCH_REGS_LCD_H | ||
14 | |||
15 | #define S3C2410_LCDREG(x) (x) | ||
16 | |||
17 | /* LCD control registers */ | ||
18 | #define S3C2410_LCDCON1 S3C2410_LCDREG(0x00) | ||
19 | #define S3C2410_LCDCON2 S3C2410_LCDREG(0x04) | ||
20 | #define S3C2410_LCDCON3 S3C2410_LCDREG(0x08) | ||
21 | #define S3C2410_LCDCON4 S3C2410_LCDREG(0x0C) | ||
22 | #define S3C2410_LCDCON5 S3C2410_LCDREG(0x10) | ||
23 | |||
24 | #define S3C2410_LCDCON1_CLKVAL(x) ((x) << 8) | ||
25 | #define S3C2410_LCDCON1_MMODE (1<<7) | ||
26 | #define S3C2410_LCDCON1_DSCAN4 (0<<5) | ||
27 | #define S3C2410_LCDCON1_STN4 (1<<5) | ||
28 | #define S3C2410_LCDCON1_STN8 (2<<5) | ||
29 | #define S3C2410_LCDCON1_TFT (3<<5) | ||
30 | |||
31 | #define S3C2410_LCDCON1_STN1BPP (0<<1) | ||
32 | #define S3C2410_LCDCON1_STN2GREY (1<<1) | ||
33 | #define S3C2410_LCDCON1_STN4GREY (2<<1) | ||
34 | #define S3C2410_LCDCON1_STN8BPP (3<<1) | ||
35 | #define S3C2410_LCDCON1_STN12BPP (4<<1) | ||
36 | |||
37 | #define S3C2410_LCDCON1_TFT1BPP (8<<1) | ||
38 | #define S3C2410_LCDCON1_TFT2BPP (9<<1) | ||
39 | #define S3C2410_LCDCON1_TFT4BPP (10<<1) | ||
40 | #define S3C2410_LCDCON1_TFT8BPP (11<<1) | ||
41 | #define S3C2410_LCDCON1_TFT16BPP (12<<1) | ||
42 | #define S3C2410_LCDCON1_TFT24BPP (13<<1) | ||
43 | |||
44 | #define S3C2410_LCDCON1_ENVID (1) | ||
45 | |||
46 | #define S3C2410_LCDCON1_MODEMASK 0x1E | ||
47 | |||
48 | #define S3C2410_LCDCON2_VBPD(x) ((x) << 24) | ||
49 | #define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14) | ||
50 | #define S3C2410_LCDCON2_VFPD(x) ((x) << 6) | ||
51 | #define S3C2410_LCDCON2_VSPW(x) ((x) << 0) | ||
52 | |||
53 | #define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF) | ||
54 | #define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF) | ||
55 | #define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F) | ||
56 | |||
57 | #define S3C2410_LCDCON3_HBPD(x) ((x) << 19) | ||
58 | #define S3C2410_LCDCON3_WDLY(x) ((x) << 19) | ||
59 | #define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8) | ||
60 | #define S3C2410_LCDCON3_HFPD(x) ((x) << 0) | ||
61 | #define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0) | ||
62 | |||
63 | #define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F) | ||
64 | #define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF) | ||
65 | |||
66 | /* LDCCON4 changes for STN mode on the S3C2412 */ | ||
67 | |||
68 | #define S3C2410_LCDCON4_MVAL(x) ((x) << 8) | ||
69 | #define S3C2410_LCDCON4_HSPW(x) ((x) << 0) | ||
70 | #define S3C2410_LCDCON4_WLH(x) ((x) << 0) | ||
71 | |||
72 | #define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF) | ||
73 | |||
74 | #define S3C2410_LCDCON5_BPP24BL (1<<12) | ||
75 | #define S3C2410_LCDCON5_FRM565 (1<<11) | ||
76 | #define S3C2410_LCDCON5_INVVCLK (1<<10) | ||
77 | #define S3C2410_LCDCON5_INVVLINE (1<<9) | ||
78 | #define S3C2410_LCDCON5_INVVFRAME (1<<8) | ||
79 | #define S3C2410_LCDCON5_INVVD (1<<7) | ||
80 | #define S3C2410_LCDCON5_INVVDEN (1<<6) | ||
81 | #define S3C2410_LCDCON5_INVPWREN (1<<5) | ||
82 | #define S3C2410_LCDCON5_INVLEND (1<<4) | ||
83 | #define S3C2410_LCDCON5_PWREN (1<<3) | ||
84 | #define S3C2410_LCDCON5_ENLEND (1<<2) | ||
85 | #define S3C2410_LCDCON5_BSWP (1<<1) | ||
86 | #define S3C2410_LCDCON5_HWSWP (1<<0) | ||
87 | |||
88 | /* framebuffer start addressed */ | ||
89 | #define S3C2410_LCDSADDR1 S3C2410_LCDREG(0x14) | ||
90 | #define S3C2410_LCDSADDR2 S3C2410_LCDREG(0x18) | ||
91 | #define S3C2410_LCDSADDR3 S3C2410_LCDREG(0x1C) | ||
92 | |||
93 | #define S3C2410_LCDBANK(x) ((x) << 21) | ||
94 | #define S3C2410_LCDBASEU(x) (x) | ||
95 | |||
96 | #define S3C2410_OFFSIZE(x) ((x) << 11) | ||
97 | #define S3C2410_PAGEWIDTH(x) (x) | ||
98 | |||
99 | /* colour lookup and miscellaneous controls */ | ||
100 | |||
101 | #define S3C2410_REDLUT S3C2410_LCDREG(0x20) | ||
102 | #define S3C2410_GREENLUT S3C2410_LCDREG(0x24) | ||
103 | #define S3C2410_BLUELUT S3C2410_LCDREG(0x28) | ||
104 | |||
105 | #define S3C2410_DITHMODE S3C2410_LCDREG(0x4C) | ||
106 | #define S3C2410_TPAL S3C2410_LCDREG(0x50) | ||
107 | |||
108 | #define S3C2410_TPAL_EN (1<<24) | ||
109 | |||
110 | /* interrupt info */ | ||
111 | #define S3C2410_LCDINTPND S3C2410_LCDREG(0x54) | ||
112 | #define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58) | ||
113 | #define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C) | ||
114 | #define S3C2410_LCDINT_FIWSEL (1<<2) | ||
115 | #define S3C2410_LCDINT_FRSYNC (1<<1) | ||
116 | #define S3C2410_LCDINT_FICNT (1<<0) | ||
117 | |||
118 | /* s3c2442 extra stn registers */ | ||
119 | |||
120 | #define S3C2442_REDLUT S3C2410_LCDREG(0x20) | ||
121 | #define S3C2442_GREENLUT S3C2410_LCDREG(0x24) | ||
122 | #define S3C2442_BLUELUT S3C2410_LCDREG(0x28) | ||
123 | #define S3C2442_DITHMODE S3C2410_LCDREG(0x20) | ||
124 | |||
125 | #define S3C2410_LPCSEL S3C2410_LCDREG(0x60) | ||
126 | |||
127 | #define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) | ||
128 | |||
129 | /* S3C2412 registers */ | ||
130 | |||
131 | #define S3C2412_TPAL S3C2410_LCDREG(0x20) | ||
132 | |||
133 | #define S3C2412_LCDINTPND S3C2410_LCDREG(0x24) | ||
134 | #define S3C2412_LCDSRCPND S3C2410_LCDREG(0x28) | ||
135 | #define S3C2412_LCDINTMSK S3C2410_LCDREG(0x2C) | ||
136 | |||
137 | #define S3C2412_TCONSEL S3C2410_LCDREG(0x30) | ||
138 | |||
139 | #define S3C2412_LCDCON6 S3C2410_LCDREG(0x34) | ||
140 | #define S3C2412_LCDCON7 S3C2410_LCDREG(0x38) | ||
141 | #define S3C2412_LCDCON8 S3C2410_LCDREG(0x3C) | ||
142 | #define S3C2412_LCDCON9 S3C2410_LCDREG(0x40) | ||
143 | |||
144 | #define S3C2412_REDLUT(x) S3C2410_LCDREG(0x44 + ((x)*4)) | ||
145 | #define S3C2412_GREENLUT(x) S3C2410_LCDREG(0x60 + ((x)*4)) | ||
146 | #define S3C2412_BLUELUT(x) S3C2410_LCDREG(0x98 + ((x)*4)) | ||
147 | |||
148 | #define S3C2412_FRCPAT(x) S3C2410_LCDREG(0xB4 + ((x)*4)) | ||
149 | |||
150 | /* general registers */ | ||
151 | |||
152 | /* base of the LCD registers, where INTPND, INTSRC and then INTMSK | ||
153 | * are available. */ | ||
154 | |||
155 | #define S3C2410_LCDINTBASE S3C2410_LCDREG(0x54) | ||
156 | #define S3C2412_LCDINTBASE S3C2410_LCDREG(0x24) | ||
157 | |||
158 | #define S3C24XX_LCDINTPND (0x00) | ||
159 | #define S3C24XX_LCDSRCPND (0x04) | ||
160 | #define S3C24XX_LCDINTMSK (0x08) | ||
161 | |||
162 | #endif /* ___ASM_ARCH_REGS_LCD_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-mem.h new file mode 100644 index 000000000000..e0c67b0163d8 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-mem.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-mem.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2410 Memory Control register definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_MEMREGS_H | ||
14 | #define __ASM_ARM_MEMREGS_H | ||
15 | |||
16 | #ifndef S3C2410_MEMREG | ||
17 | #define S3C2410_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) | ||
18 | #endif | ||
19 | |||
20 | /* bus width, and wait state control */ | ||
21 | #define S3C2410_BWSCON S3C2410_MEMREG(0x0000) | ||
22 | |||
23 | /* bank zero config - note, pinstrapped from OM pins! */ | ||
24 | #define S3C2410_BWSCON_DW0_16 (1<<1) | ||
25 | #define S3C2410_BWSCON_DW0_32 (2<<1) | ||
26 | |||
27 | /* bank one configs */ | ||
28 | #define S3C2410_BWSCON_DW1_8 (0<<4) | ||
29 | #define S3C2410_BWSCON_DW1_16 (1<<4) | ||
30 | #define S3C2410_BWSCON_DW1_32 (2<<4) | ||
31 | #define S3C2410_BWSCON_WS1 (1<<6) | ||
32 | #define S3C2410_BWSCON_ST1 (1<<7) | ||
33 | |||
34 | /* bank 2 configurations */ | ||
35 | #define S3C2410_BWSCON_DW2_8 (0<<8) | ||
36 | #define S3C2410_BWSCON_DW2_16 (1<<8) | ||
37 | #define S3C2410_BWSCON_DW2_32 (2<<8) | ||
38 | #define S3C2410_BWSCON_WS2 (1<<10) | ||
39 | #define S3C2410_BWSCON_ST2 (1<<11) | ||
40 | |||
41 | /* bank 3 configurations */ | ||
42 | #define S3C2410_BWSCON_DW3_8 (0<<12) | ||
43 | #define S3C2410_BWSCON_DW3_16 (1<<12) | ||
44 | #define S3C2410_BWSCON_DW3_32 (2<<12) | ||
45 | #define S3C2410_BWSCON_WS3 (1<<14) | ||
46 | #define S3C2410_BWSCON_ST3 (1<<15) | ||
47 | |||
48 | /* bank 4 configurations */ | ||
49 | #define S3C2410_BWSCON_DW4_8 (0<<16) | ||
50 | #define S3C2410_BWSCON_DW4_16 (1<<16) | ||
51 | #define S3C2410_BWSCON_DW4_32 (2<<16) | ||
52 | #define S3C2410_BWSCON_WS4 (1<<18) | ||
53 | #define S3C2410_BWSCON_ST4 (1<<19) | ||
54 | |||
55 | /* bank 5 configurations */ | ||
56 | #define S3C2410_BWSCON_DW5_8 (0<<20) | ||
57 | #define S3C2410_BWSCON_DW5_16 (1<<20) | ||
58 | #define S3C2410_BWSCON_DW5_32 (2<<20) | ||
59 | #define S3C2410_BWSCON_WS5 (1<<22) | ||
60 | #define S3C2410_BWSCON_ST5 (1<<23) | ||
61 | |||
62 | /* bank 6 configurations */ | ||
63 | #define S3C2410_BWSCON_DW6_8 (0<<24) | ||
64 | #define S3C2410_BWSCON_DW6_16 (1<<24) | ||
65 | #define S3C2410_BWSCON_DW6_32 (2<<24) | ||
66 | #define S3C2410_BWSCON_WS6 (1<<26) | ||
67 | #define S3C2410_BWSCON_ST6 (1<<27) | ||
68 | |||
69 | /* bank 7 configurations */ | ||
70 | #define S3C2410_BWSCON_DW7_8 (0<<28) | ||
71 | #define S3C2410_BWSCON_DW7_16 (1<<28) | ||
72 | #define S3C2410_BWSCON_DW7_32 (2<<28) | ||
73 | #define S3C2410_BWSCON_WS7 (1<<30) | ||
74 | #define S3C2410_BWSCON_ST7 (1<<31) | ||
75 | |||
76 | /* accesor functions for getting BANK(n) configuration. (n != 0) */ | ||
77 | |||
78 | #define S3C2410_BWSCON_GET(_bwscon, _bank) (((_bwscon) >> ((_bank) * 4)) & 0xf) | ||
79 | |||
80 | #define S3C2410_BWSCON_DW8 (0) | ||
81 | #define S3C2410_BWSCON_DW16 (1) | ||
82 | #define S3C2410_BWSCON_DW32 (2) | ||
83 | #define S3C2410_BWSCON_WS (1 << 2) | ||
84 | #define S3C2410_BWSCON_ST (1 << 3) | ||
85 | |||
86 | /* memory set (rom, ram) */ | ||
87 | #define S3C2410_BANKCON0 S3C2410_MEMREG(0x0004) | ||
88 | #define S3C2410_BANKCON1 S3C2410_MEMREG(0x0008) | ||
89 | #define S3C2410_BANKCON2 S3C2410_MEMREG(0x000C) | ||
90 | #define S3C2410_BANKCON3 S3C2410_MEMREG(0x0010) | ||
91 | #define S3C2410_BANKCON4 S3C2410_MEMREG(0x0014) | ||
92 | #define S3C2410_BANKCON5 S3C2410_MEMREG(0x0018) | ||
93 | #define S3C2410_BANKCON6 S3C2410_MEMREG(0x001C) | ||
94 | #define S3C2410_BANKCON7 S3C2410_MEMREG(0x0020) | ||
95 | |||
96 | /* bank configuration registers */ | ||
97 | |||
98 | #define S3C2410_BANKCON_PMCnorm (0x00) | ||
99 | #define S3C2410_BANKCON_PMC4 (0x01) | ||
100 | #define S3C2410_BANKCON_PMC8 (0x02) | ||
101 | #define S3C2410_BANKCON_PMC16 (0x03) | ||
102 | |||
103 | /* bank configurations for banks 0..7, note banks | ||
104 | * 6 and 7 have different configurations depending on | ||
105 | * the memory type bits */ | ||
106 | |||
107 | #define S3C2410_BANKCON_Tacp2 (0x0 << 2) | ||
108 | #define S3C2410_BANKCON_Tacp3 (0x1 << 2) | ||
109 | #define S3C2410_BANKCON_Tacp4 (0x2 << 2) | ||
110 | #define S3C2410_BANKCON_Tacp6 (0x3 << 2) | ||
111 | #define S3C2410_BANKCON_Tacp_SHIFT (2) | ||
112 | |||
113 | #define S3C2410_BANKCON_Tcah0 (0x0 << 4) | ||
114 | #define S3C2410_BANKCON_Tcah1 (0x1 << 4) | ||
115 | #define S3C2410_BANKCON_Tcah2 (0x2 << 4) | ||
116 | #define S3C2410_BANKCON_Tcah4 (0x3 << 4) | ||
117 | #define S3C2410_BANKCON_Tcah_SHIFT (4) | ||
118 | |||
119 | #define S3C2410_BANKCON_Tcoh0 (0x0 << 6) | ||
120 | #define S3C2410_BANKCON_Tcoh1 (0x1 << 6) | ||
121 | #define S3C2410_BANKCON_Tcoh2 (0x2 << 6) | ||
122 | #define S3C2410_BANKCON_Tcoh4 (0x3 << 6) | ||
123 | #define S3C2410_BANKCON_Tcoh_SHIFT (6) | ||
124 | |||
125 | #define S3C2410_BANKCON_Tacc1 (0x0 << 8) | ||
126 | #define S3C2410_BANKCON_Tacc2 (0x1 << 8) | ||
127 | #define S3C2410_BANKCON_Tacc3 (0x2 << 8) | ||
128 | #define S3C2410_BANKCON_Tacc4 (0x3 << 8) | ||
129 | #define S3C2410_BANKCON_Tacc6 (0x4 << 8) | ||
130 | #define S3C2410_BANKCON_Tacc8 (0x5 << 8) | ||
131 | #define S3C2410_BANKCON_Tacc10 (0x6 << 8) | ||
132 | #define S3C2410_BANKCON_Tacc14 (0x7 << 8) | ||
133 | #define S3C2410_BANKCON_Tacc_SHIFT (8) | ||
134 | |||
135 | #define S3C2410_BANKCON_Tcos0 (0x0 << 11) | ||
136 | #define S3C2410_BANKCON_Tcos1 (0x1 << 11) | ||
137 | #define S3C2410_BANKCON_Tcos2 (0x2 << 11) | ||
138 | #define S3C2410_BANKCON_Tcos4 (0x3 << 11) | ||
139 | #define S3C2410_BANKCON_Tcos_SHIFT (11) | ||
140 | |||
141 | #define S3C2410_BANKCON_Tacs0 (0x0 << 13) | ||
142 | #define S3C2410_BANKCON_Tacs1 (0x1 << 13) | ||
143 | #define S3C2410_BANKCON_Tacs2 (0x2 << 13) | ||
144 | #define S3C2410_BANKCON_Tacs4 (0x3 << 13) | ||
145 | #define S3C2410_BANKCON_Tacs_SHIFT (13) | ||
146 | |||
147 | #define S3C2410_BANKCON_SRAM (0x0 << 15) | ||
148 | #define S3C2410_BANKCON_SDRAM (0x3 << 15) | ||
149 | |||
150 | /* next bits only for SDRAM in 6,7 */ | ||
151 | #define S3C2410_BANKCON_Trcd2 (0x00 << 2) | ||
152 | #define S3C2410_BANKCON_Trcd3 (0x01 << 2) | ||
153 | #define S3C2410_BANKCON_Trcd4 (0x02 << 2) | ||
154 | |||
155 | /* control column address select */ | ||
156 | #define S3C2410_BANKCON_SCANb8 (0x00 << 0) | ||
157 | #define S3C2410_BANKCON_SCANb9 (0x01 << 0) | ||
158 | #define S3C2410_BANKCON_SCANb10 (0x02 << 0) | ||
159 | |||
160 | #define S3C2410_REFRESH S3C2410_MEMREG(0x0024) | ||
161 | #define S3C2410_BANKSIZE S3C2410_MEMREG(0x0028) | ||
162 | #define S3C2410_MRSRB6 S3C2410_MEMREG(0x002C) | ||
163 | #define S3C2410_MRSRB7 S3C2410_MEMREG(0x0030) | ||
164 | |||
165 | /* refresh control */ | ||
166 | |||
167 | #define S3C2410_REFRESH_REFEN (1<<23) | ||
168 | #define S3C2410_REFRESH_SELF (1<<22) | ||
169 | #define S3C2410_REFRESH_REFCOUNTER ((1<<11)-1) | ||
170 | |||
171 | #define S3C2410_REFRESH_TRP_MASK (3<<20) | ||
172 | #define S3C2410_REFRESH_TRP_2clk (0<<20) | ||
173 | #define S3C2410_REFRESH_TRP_3clk (1<<20) | ||
174 | #define S3C2410_REFRESH_TRP_4clk (2<<20) | ||
175 | |||
176 | #define S3C2410_REFRESH_TSRC_MASK (3<<18) | ||
177 | #define S3C2410_REFRESH_TSRC_4clk (0<<18) | ||
178 | #define S3C2410_REFRESH_TSRC_5clk (1<<18) | ||
179 | #define S3C2410_REFRESH_TSRC_6clk (2<<18) | ||
180 | #define S3C2410_REFRESH_TSRC_7clk (3<<18) | ||
181 | |||
182 | |||
183 | /* mode select register(s) */ | ||
184 | |||
185 | #define S3C2410_MRSRB_CL1 (0x00 << 4) | ||
186 | #define S3C2410_MRSRB_CL2 (0x02 << 4) | ||
187 | #define S3C2410_MRSRB_CL3 (0x03 << 4) | ||
188 | |||
189 | /* bank size register */ | ||
190 | #define S3C2410_BANKSIZE_128M (0x2 << 0) | ||
191 | #define S3C2410_BANKSIZE_64M (0x1 << 0) | ||
192 | #define S3C2410_BANKSIZE_32M (0x0 << 0) | ||
193 | #define S3C2410_BANKSIZE_16M (0x7 << 0) | ||
194 | #define S3C2410_BANKSIZE_8M (0x6 << 0) | ||
195 | #define S3C2410_BANKSIZE_4M (0x5 << 0) | ||
196 | #define S3C2410_BANKSIZE_2M (0x4 << 0) | ||
197 | #define S3C2410_BANKSIZE_MASK (0x7 << 0) | ||
198 | #define S3C2410_BANKSIZE_SCLK_EN (1<<4) | ||
199 | #define S3C2410_BANKSIZE_SCKE_EN (1<<5) | ||
200 | #define S3C2410_BANKSIZE_BURST (1<<7) | ||
201 | |||
202 | #endif /* __ASM_ARM_MEMREGS_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-power.h b/arch/arm/mach-s3c24xx/include/mach/regs-power.h new file mode 100644 index 000000000000..4932b87bdf3d --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-power.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-power.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://armlinux.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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * S3C24XX power control register definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_REGS_PWR | ||
14 | #define __ASM_ARM_REGS_PWR __FILE__ | ||
15 | |||
16 | #define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR) | ||
17 | |||
18 | #define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20) | ||
19 | #define S3C2412_PWRCFG S3C24XX_PWRREG(0x24) | ||
20 | |||
21 | #define S3C2412_INFORM0 S3C24XX_PWRREG(0x70) | ||
22 | #define S3C2412_INFORM1 S3C24XX_PWRREG(0x74) | ||
23 | #define S3C2412_INFORM2 S3C24XX_PWRREG(0x78) | ||
24 | #define S3C2412_INFORM3 S3C24XX_PWRREG(0x7C) | ||
25 | |||
26 | #define S3C2412_PWRCFG_BATF_IRQ (1<<0) | ||
27 | #define S3C2412_PWRCFG_BATF_IGNORE (2<<0) | ||
28 | #define S3C2412_PWRCFG_BATF_SLEEP (3<<0) | ||
29 | #define S3C2412_PWRCFG_BATF_MASK (3<<0) | ||
30 | |||
31 | #define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0<<6) | ||
32 | #define S3C2412_PWRCFG_STANDBYWFI_IDLE (1<<6) | ||
33 | #define S3C2412_PWRCFG_STANDBYWFI_STOP (2<<6) | ||
34 | #define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3<<6) | ||
35 | #define S3C2412_PWRCFG_STANDBYWFI_MASK (3<<6) | ||
36 | |||
37 | #define S3C2412_PWRCFG_RTC_MASKIRQ (1<<8) | ||
38 | #define S3C2412_PWRCFG_NAND_NORST (1<<9) | ||
39 | |||
40 | #endif /* __ASM_ARM_REGS_PWR */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h new file mode 100644 index 000000000000..fb6352515090 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
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 | * S3C2412 memory register definitions | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARM_REGS_S3C2412_MEM | ||
15 | #define __ASM_ARM_REGS_S3C2412_MEM | ||
16 | |||
17 | #define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) | ||
18 | #define S3C2412_EBIREG(x) (S3C2412_VA_EBI + (x)) | ||
19 | |||
20 | #define S3C2412_SSMCREG(x) (S3C2412_VA_SSMC + (x)) | ||
21 | #define S3C2412_SSMC(x, o) (S3C2412_SSMCREG((x * 0x20) + (o))) | ||
22 | |||
23 | #define S3C2412_BANKCFG S3C2412_MEMREG(0x00) | ||
24 | #define S3C2412_BANKCON1 S3C2412_MEMREG(0x04) | ||
25 | #define S3C2412_BANKCON2 S3C2412_MEMREG(0x08) | ||
26 | #define S3C2412_BANKCON3 S3C2412_MEMREG(0x0C) | ||
27 | |||
28 | #define S3C2412_REFRESH S3C2412_MEMREG(0x10) | ||
29 | #define S3C2412_TIMEOUT S3C2412_MEMREG(0x14) | ||
30 | |||
31 | /* EBI control registers */ | ||
32 | |||
33 | #define S3C2412_EBI_PR S3C2412_EBIREG(0x00) | ||
34 | #define S3C2412_EBI_BANKCFG S3C2412_EBIREG(0x04) | ||
35 | |||
36 | /* SSMC control registers */ | ||
37 | |||
38 | #define S3C2412_SSMC_BANK(x) S3C2412_SSMC(x, 0x00) | ||
39 | #define S3C2412_SMIDCYR(x) S3C2412_SSMC(x, 0x00) | ||
40 | #define S3C2412_SMBWSTRD(x) S3C2412_SSMC(x, 0x04) | ||
41 | #define S3C2412_SMBWSTWRR(x) S3C2412_SSMC(x, 0x08) | ||
42 | #define S3C2412_SMBWSTOENR(x) S3C2412_SSMC(x, 0x0C) | ||
43 | #define S3C2412_SMBWSTWENR(x) S3C2412_SSMC(x, 0x10) | ||
44 | #define S3C2412_SMBCR(x) S3C2412_SSMC(x, 0x14) | ||
45 | #define S3C2412_SMBSR(x) S3C2412_SSMC(x, 0x18) | ||
46 | #define S3C2412_SMBWSTBRDR(x) S3C2412_SSMC(x, 0x1C) | ||
47 | |||
48 | #endif /* __ASM_ARM_REGS_S3C2412_MEM */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h new file mode 100644 index 000000000000..aa69dc79bc38 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h | ||
2 | * | ||
3 | * Copyright 2007 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | * S3C2412 specific register definitions | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_S3C2412_H | ||
15 | #define __ASM_ARCH_REGS_S3C2412_H "s3c2412" | ||
16 | |||
17 | #define S3C2412_SWRST (S3C24XX_VA_CLKPWR + 0x30) | ||
18 | #define S3C2412_SWRST_RESET (0x533C2412) | ||
19 | |||
20 | /* see regs-power.h for the other registers in the power block. */ | ||
21 | |||
22 | #endif /* __ASM_ARCH_REGS_S3C2412_H */ | ||
23 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h new file mode 100644 index 000000000000..2f31b74974af --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-s3c2416-mem.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
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 | * S3C2416 memory register definitions | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_ARM_REGS_S3C2416_MEM | ||
16 | #define __ASM_ARM_REGS_S3C2416_MEM | ||
17 | |||
18 | #ifndef S3C2416_MEMREG | ||
19 | #define S3C2416_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) | ||
20 | #endif | ||
21 | |||
22 | #define S3C2416_BANKCFG S3C2416_MEMREG(0x00) | ||
23 | #define S3C2416_BANKCON1 S3C2416_MEMREG(0x04) | ||
24 | #define S3C2416_BANKCON2 S3C2416_MEMREG(0x08) | ||
25 | #define S3C2416_BANKCON3 S3C2416_MEMREG(0x0C) | ||
26 | |||
27 | #define S3C2416_REFRESH S3C2416_MEMREG(0x10) | ||
28 | #define S3C2416_TIMEOUT S3C2416_MEMREG(0x14) | ||
29 | |||
30 | #endif /* __ASM_ARM_REGS_S3C2416_MEM */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h new file mode 100644 index 000000000000..e443167efb87 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-s3c2416.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
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 | * S3C2416 specific register definitions | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_ARCH_REGS_S3C2416_H | ||
16 | #define __ASM_ARCH_REGS_S3C2416_H "s3c2416" | ||
17 | |||
18 | #define S3C2416_SWRST (S3C24XX_VA_CLKPWR + 0x44) | ||
19 | #define S3C2416_SWRST_RESET (0x533C2416) | ||
20 | |||
21 | /* see regs-power.h for the other registers in the power block. */ | ||
22 | |||
23 | #endif /* __ASM_ARCH_REGS_S3C2416_H */ | ||
24 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h new file mode 100644 index 000000000000..c3feff3c0488 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
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 | * S3C2443 clock register definitions | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARM_REGS_S3C2443_CLOCK | ||
15 | #define __ASM_ARM_REGS_S3C2443_CLOCK | ||
16 | |||
17 | #define S3C2443_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR) | ||
18 | |||
19 | #define S3C2443_PLLCON_MDIVSHIFT 16 | ||
20 | #define S3C2443_PLLCON_PDIVSHIFT 8 | ||
21 | #define S3C2443_PLLCON_SDIVSHIFT 0 | ||
22 | #define S3C2443_PLLCON_MDIVMASK ((1<<(1+(23-16)))-1) | ||
23 | #define S3C2443_PLLCON_PDIVMASK ((1<<(1+(9-8)))-1) | ||
24 | #define S3C2443_PLLCON_SDIVMASK (3) | ||
25 | |||
26 | #define S3C2443_MPLLCON S3C2443_CLKREG(0x10) | ||
27 | #define S3C2443_EPLLCON S3C2443_CLKREG(0x18) | ||
28 | #define S3C2443_CLKSRC S3C2443_CLKREG(0x20) | ||
29 | #define S3C2443_CLKDIV0 S3C2443_CLKREG(0x24) | ||
30 | #define S3C2443_CLKDIV1 S3C2443_CLKREG(0x28) | ||
31 | #define S3C2443_HCLKCON S3C2443_CLKREG(0x30) | ||
32 | #define S3C2443_PCLKCON S3C2443_CLKREG(0x34) | ||
33 | #define S3C2443_SCLKCON S3C2443_CLKREG(0x38) | ||
34 | #define S3C2443_PWRMODE S3C2443_CLKREG(0x40) | ||
35 | #define S3C2443_SWRST S3C2443_CLKREG(0x44) | ||
36 | #define S3C2443_BUSPRI0 S3C2443_CLKREG(0x50) | ||
37 | #define S3C2443_SYSID S3C2443_CLKREG(0x5C) | ||
38 | #define S3C2443_PWRCFG S3C2443_CLKREG(0x60) | ||
39 | #define S3C2443_RSTCON S3C2443_CLKREG(0x64) | ||
40 | #define S3C2443_PHYCTRL S3C2443_CLKREG(0x80) | ||
41 | #define S3C2443_PHYPWR S3C2443_CLKREG(0x84) | ||
42 | #define S3C2443_URSTCON S3C2443_CLKREG(0x88) | ||
43 | #define S3C2443_UCLKCON S3C2443_CLKREG(0x8C) | ||
44 | |||
45 | #define S3C2443_SWRST_RESET (0x533c2443) | ||
46 | |||
47 | #define S3C2443_PLLCON_OFF (1<<24) | ||
48 | |||
49 | #define S3C2443_CLKSRC_EPLLREF_XTAL (2<<7) | ||
50 | #define S3C2443_CLKSRC_EPLLREF_EXTCLK (3<<7) | ||
51 | #define S3C2443_CLKSRC_EPLLREF_MPLLREF (0<<7) | ||
52 | #define S3C2443_CLKSRC_EPLLREF_MPLLREF2 (1<<7) | ||
53 | #define S3C2443_CLKSRC_EPLLREF_MASK (3<<7) | ||
54 | |||
55 | #define S3C2443_CLKSRC_EXTCLK_DIV (1<<3) | ||
56 | |||
57 | #define S3C2443_CLKDIV0_HALF_HCLK (1<<3) | ||
58 | #define S3C2443_CLKDIV0_HALF_PCLK (1<<2) | ||
59 | |||
60 | #define S3C2443_CLKDIV0_HCLKDIV_MASK (3<<0) | ||
61 | |||
62 | #define S3C2443_CLKDIV0_EXTDIV_MASK (3<<6) | ||
63 | #define S3C2443_CLKDIV0_EXTDIV_SHIFT (6) | ||
64 | |||
65 | #define S3C2443_CLKDIV0_PREDIV_MASK (3<<4) | ||
66 | #define S3C2443_CLKDIV0_PREDIV_SHIFT (4) | ||
67 | |||
68 | #define S3C2416_CLKDIV0_ARMDIV_MASK (7 << 9) | ||
69 | #define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9) | ||
70 | #define S3C2443_CLKDIV0_ARMDIV_SHIFT (9) | ||
71 | #define S3C2443_CLKDIV0_ARMDIV_1 (0<<9) | ||
72 | #define S3C2443_CLKDIV0_ARMDIV_2 (8<<9) | ||
73 | #define S3C2443_CLKDIV0_ARMDIV_3 (2<<9) | ||
74 | #define S3C2443_CLKDIV0_ARMDIV_4 (9<<9) | ||
75 | #define S3C2443_CLKDIV0_ARMDIV_6 (10<<9) | ||
76 | #define S3C2443_CLKDIV0_ARMDIV_8 (11<<9) | ||
77 | #define S3C2443_CLKDIV0_ARMDIV_12 (13<<9) | ||
78 | #define S3C2443_CLKDIV0_ARMDIV_16 (15<<9) | ||
79 | |||
80 | /* S3C2443_CLKDIV1 removed, only used in clock.c code */ | ||
81 | |||
82 | #define S3C2443_CLKCON_NAND | ||
83 | |||
84 | #define S3C2443_HCLKCON_DMA0 (1<<0) | ||
85 | #define S3C2443_HCLKCON_DMA1 (1<<1) | ||
86 | #define S3C2443_HCLKCON_DMA2 (1<<2) | ||
87 | #define S3C2443_HCLKCON_DMA3 (1<<3) | ||
88 | #define S3C2443_HCLKCON_DMA4 (1<<4) | ||
89 | #define S3C2443_HCLKCON_DMA5 (1<<5) | ||
90 | #define S3C2443_HCLKCON_CAMIF (1<<8) | ||
91 | #define S3C2443_HCLKCON_LCDC (1<<9) | ||
92 | #define S3C2443_HCLKCON_USBH (1<<11) | ||
93 | #define S3C2443_HCLKCON_USBD (1<<12) | ||
94 | #define S3C2416_HCLKCON_HSMMC0 (1<<15) | ||
95 | #define S3C2443_HCLKCON_HSMMC (1<<16) | ||
96 | #define S3C2443_HCLKCON_CFC (1<<17) | ||
97 | #define S3C2443_HCLKCON_SSMC (1<<18) | ||
98 | #define S3C2443_HCLKCON_DRAMC (1<<19) | ||
99 | |||
100 | #define S3C2443_PCLKCON_UART0 (1<<0) | ||
101 | #define S3C2443_PCLKCON_UART1 (1<<1) | ||
102 | #define S3C2443_PCLKCON_UART2 (1<<2) | ||
103 | #define S3C2443_PCLKCON_UART3 (1<<3) | ||
104 | #define S3C2443_PCLKCON_IIC (1<<4) | ||
105 | #define S3C2443_PCLKCON_SDI (1<<5) | ||
106 | #define S3C2443_PCLKCON_HSSPI (1<<6) | ||
107 | #define S3C2443_PCLKCON_ADC (1<<7) | ||
108 | #define S3C2443_PCLKCON_AC97 (1<<8) | ||
109 | #define S3C2443_PCLKCON_IIS (1<<9) | ||
110 | #define S3C2443_PCLKCON_PWMT (1<<10) | ||
111 | #define S3C2443_PCLKCON_WDT (1<<11) | ||
112 | #define S3C2443_PCLKCON_RTC (1<<12) | ||
113 | #define S3C2443_PCLKCON_GPIO (1<<13) | ||
114 | #define S3C2443_PCLKCON_SPI0 (1<<14) | ||
115 | #define S3C2443_PCLKCON_SPI1 (1<<15) | ||
116 | |||
117 | #define S3C2443_SCLKCON_DDRCLK (1<<16) | ||
118 | #define S3C2443_SCLKCON_SSMCCLK (1<<15) | ||
119 | #define S3C2443_SCLKCON_HSSPICLK (1<<14) | ||
120 | #define S3C2443_SCLKCON_HSMMCCLK_EXT (1<<13) | ||
121 | #define S3C2443_SCLKCON_HSMMCCLK_EPLL (1<<12) | ||
122 | #define S3C2443_SCLKCON_CAMCLK (1<<11) | ||
123 | #define S3C2443_SCLKCON_DISPCLK (1<<10) | ||
124 | #define S3C2443_SCLKCON_I2SCLK (1<<9) | ||
125 | #define S3C2443_SCLKCON_UARTCLK (1<<8) | ||
126 | #define S3C2443_SCLKCON_USBHOST (1<<1) | ||
127 | |||
128 | #define S3C2443_PWRCFG_SLEEP (1<<15) | ||
129 | |||
130 | #define S3C2443_PWRCFG_USBPHY (1 << 4) | ||
131 | |||
132 | #define S3C2443_URSTCON_FUNCRST (1 << 2) | ||
133 | #define S3C2443_URSTCON_PHYRST (1 << 0) | ||
134 | |||
135 | #define S3C2443_PHYCTRL_CLKSEL (1 << 3) | ||
136 | #define S3C2443_PHYCTRL_EXTCLK (1 << 2) | ||
137 | #define S3C2443_PHYCTRL_PLLSEL (1 << 1) | ||
138 | #define S3C2443_PHYCTRL_DSPORT (1 << 0) | ||
139 | |||
140 | #define S3C2443_PHYPWR_COMMON_ON (1 << 31) | ||
141 | #define S3C2443_PHYPWR_ANALOG_PD (1 << 4) | ||
142 | #define S3C2443_PHYPWR_PLL_REFCLK (1 << 3) | ||
143 | #define S3C2443_PHYPWR_XO_ON (1 << 2) | ||
144 | #define S3C2443_PHYPWR_PLL_PWRDN (1 << 1) | ||
145 | #define S3C2443_PHYPWR_FSUSPEND (1 << 0) | ||
146 | |||
147 | #define S3C2443_UCLKCON_DETECT_VBUS (1 << 31) | ||
148 | #define S3C2443_UCLKCON_FUNC_CLKEN (1 << 2) | ||
149 | #define S3C2443_UCLKCON_TCLKEN (1 << 0) | ||
150 | |||
151 | #include <asm/div64.h> | ||
152 | |||
153 | static inline unsigned int | ||
154 | s3c2443_get_mpll(unsigned int pllval, unsigned int baseclk) | ||
155 | { | ||
156 | unsigned int mdiv, pdiv, sdiv; | ||
157 | uint64_t fvco; | ||
158 | |||
159 | mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT; | ||
160 | pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT; | ||
161 | sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT; | ||
162 | |||
163 | mdiv &= S3C2443_PLLCON_MDIVMASK; | ||
164 | pdiv &= S3C2443_PLLCON_PDIVMASK; | ||
165 | sdiv &= S3C2443_PLLCON_SDIVMASK; | ||
166 | |||
167 | fvco = (uint64_t)baseclk * (2 * (mdiv + 8)); | ||
168 | do_div(fvco, pdiv << sdiv); | ||
169 | |||
170 | return (unsigned int)fvco; | ||
171 | } | ||
172 | |||
173 | static inline unsigned int | ||
174 | s3c2443_get_epll(unsigned int pllval, unsigned int baseclk) | ||
175 | { | ||
176 | unsigned int mdiv, pdiv, sdiv; | ||
177 | uint64_t fvco; | ||
178 | |||
179 | mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT; | ||
180 | pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT; | ||
181 | sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT; | ||
182 | |||
183 | mdiv &= S3C2443_PLLCON_MDIVMASK; | ||
184 | pdiv &= S3C2443_PLLCON_PDIVMASK; | ||
185 | sdiv &= S3C2443_PLLCON_SDIVMASK; | ||
186 | |||
187 | fvco = (uint64_t)baseclk * (mdiv + 8); | ||
188 | do_div(fvco, (pdiv + 2) << sdiv); | ||
189 | |||
190 | return (unsigned int)fvco; | ||
191 | } | ||
192 | |||
193 | #endif /* __ASM_ARM_REGS_S3C2443_CLOCK */ | ||
194 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h new file mode 100644 index 000000000000..cbf2d8884e30 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-sdi.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2410 MMC/SDIO register definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_REGS_SDI | ||
14 | #define __ASM_ARM_REGS_SDI "regs-sdi.h" | ||
15 | |||
16 | #define S3C2410_SDICON (0x00) | ||
17 | #define S3C2410_SDIPRE (0x04) | ||
18 | #define S3C2410_SDICMDARG (0x08) | ||
19 | #define S3C2410_SDICMDCON (0x0C) | ||
20 | #define S3C2410_SDICMDSTAT (0x10) | ||
21 | #define S3C2410_SDIRSP0 (0x14) | ||
22 | #define S3C2410_SDIRSP1 (0x18) | ||
23 | #define S3C2410_SDIRSP2 (0x1C) | ||
24 | #define S3C2410_SDIRSP3 (0x20) | ||
25 | #define S3C2410_SDITIMER (0x24) | ||
26 | #define S3C2410_SDIBSIZE (0x28) | ||
27 | #define S3C2410_SDIDCON (0x2C) | ||
28 | #define S3C2410_SDIDCNT (0x30) | ||
29 | #define S3C2410_SDIDSTA (0x34) | ||
30 | #define S3C2410_SDIFSTA (0x38) | ||
31 | |||
32 | #define S3C2410_SDIDATA (0x3C) | ||
33 | #define S3C2410_SDIIMSK (0x40) | ||
34 | |||
35 | #define S3C2440_SDIDATA (0x40) | ||
36 | #define S3C2440_SDIIMSK (0x3C) | ||
37 | |||
38 | #define S3C2440_SDICON_SDRESET (1<<8) | ||
39 | #define S3C2440_SDICON_MMCCLOCK (1<<5) | ||
40 | #define S3C2410_SDICON_BYTEORDER (1<<4) | ||
41 | #define S3C2410_SDICON_SDIOIRQ (1<<3) | ||
42 | #define S3C2410_SDICON_RWAITEN (1<<2) | ||
43 | #define S3C2410_SDICON_FIFORESET (1<<1) | ||
44 | #define S3C2410_SDICON_CLOCKTYPE (1<<0) | ||
45 | |||
46 | #define S3C2410_SDICMDCON_ABORT (1<<12) | ||
47 | #define S3C2410_SDICMDCON_WITHDATA (1<<11) | ||
48 | #define S3C2410_SDICMDCON_LONGRSP (1<<10) | ||
49 | #define S3C2410_SDICMDCON_WAITRSP (1<<9) | ||
50 | #define S3C2410_SDICMDCON_CMDSTART (1<<8) | ||
51 | #define S3C2410_SDICMDCON_SENDERHOST (1<<6) | ||
52 | #define S3C2410_SDICMDCON_INDEX (0x3f) | ||
53 | |||
54 | #define S3C2410_SDICMDSTAT_CRCFAIL (1<<12) | ||
55 | #define S3C2410_SDICMDSTAT_CMDSENT (1<<11) | ||
56 | #define S3C2410_SDICMDSTAT_CMDTIMEOUT (1<<10) | ||
57 | #define S3C2410_SDICMDSTAT_RSPFIN (1<<9) | ||
58 | #define S3C2410_SDICMDSTAT_XFERING (1<<8) | ||
59 | #define S3C2410_SDICMDSTAT_INDEX (0xff) | ||
60 | |||
61 | #define S3C2440_SDIDCON_DS_BYTE (0<<22) | ||
62 | #define S3C2440_SDIDCON_DS_HALFWORD (1<<22) | ||
63 | #define S3C2440_SDIDCON_DS_WORD (2<<22) | ||
64 | #define S3C2410_SDIDCON_IRQPERIOD (1<<21) | ||
65 | #define S3C2410_SDIDCON_TXAFTERRESP (1<<20) | ||
66 | #define S3C2410_SDIDCON_RXAFTERCMD (1<<19) | ||
67 | #define S3C2410_SDIDCON_BUSYAFTERCMD (1<<18) | ||
68 | #define S3C2410_SDIDCON_BLOCKMODE (1<<17) | ||
69 | #define S3C2410_SDIDCON_WIDEBUS (1<<16) | ||
70 | #define S3C2410_SDIDCON_DMAEN (1<<15) | ||
71 | #define S3C2410_SDIDCON_STOP (1<<14) | ||
72 | #define S3C2440_SDIDCON_DATSTART (1<<14) | ||
73 | #define S3C2410_SDIDCON_DATMODE (3<<12) | ||
74 | #define S3C2410_SDIDCON_BLKNUM (0x7ff) | ||
75 | |||
76 | /* constants for S3C2410_SDIDCON_DATMODE */ | ||
77 | #define S3C2410_SDIDCON_XFER_READY (0<<12) | ||
78 | #define S3C2410_SDIDCON_XFER_CHKSTART (1<<12) | ||
79 | #define S3C2410_SDIDCON_XFER_RXSTART (2<<12) | ||
80 | #define S3C2410_SDIDCON_XFER_TXSTART (3<<12) | ||
81 | |||
82 | #define S3C2410_SDIDCON_BLKNUM_MASK (0xFFF) | ||
83 | #define S3C2410_SDIDCNT_BLKNUM_SHIFT (12) | ||
84 | |||
85 | #define S3C2410_SDIDSTA_RDYWAITREQ (1<<10) | ||
86 | #define S3C2410_SDIDSTA_SDIOIRQDETECT (1<<9) | ||
87 | #define S3C2410_SDIDSTA_FIFOFAIL (1<<8) /* reserved on 2440 */ | ||
88 | #define S3C2410_SDIDSTA_CRCFAIL (1<<7) | ||
89 | #define S3C2410_SDIDSTA_RXCRCFAIL (1<<6) | ||
90 | #define S3C2410_SDIDSTA_DATATIMEOUT (1<<5) | ||
91 | #define S3C2410_SDIDSTA_XFERFINISH (1<<4) | ||
92 | #define S3C2410_SDIDSTA_BUSYFINISH (1<<3) | ||
93 | #define S3C2410_SDIDSTA_SBITERR (1<<2) /* reserved on 2410a/2440 */ | ||
94 | #define S3C2410_SDIDSTA_TXDATAON (1<<1) | ||
95 | #define S3C2410_SDIDSTA_RXDATAON (1<<0) | ||
96 | |||
97 | #define S3C2440_SDIFSTA_FIFORESET (1<<16) | ||
98 | #define S3C2440_SDIFSTA_FIFOFAIL (3<<14) /* 3 is correct (2 bits) */ | ||
99 | #define S3C2410_SDIFSTA_TFDET (1<<13) | ||
100 | #define S3C2410_SDIFSTA_RFDET (1<<12) | ||
101 | #define S3C2410_SDIFSTA_TFHALF (1<<11) | ||
102 | #define S3C2410_SDIFSTA_TFEMPTY (1<<10) | ||
103 | #define S3C2410_SDIFSTA_RFLAST (1<<9) | ||
104 | #define S3C2410_SDIFSTA_RFFULL (1<<8) | ||
105 | #define S3C2410_SDIFSTA_RFHALF (1<<7) | ||
106 | #define S3C2410_SDIFSTA_COUNTMASK (0x7f) | ||
107 | |||
108 | #define S3C2410_SDIIMSK_RESPONSECRC (1<<17) | ||
109 | #define S3C2410_SDIIMSK_CMDSENT (1<<16) | ||
110 | #define S3C2410_SDIIMSK_CMDTIMEOUT (1<<15) | ||
111 | #define S3C2410_SDIIMSK_RESPONSEND (1<<14) | ||
112 | #define S3C2410_SDIIMSK_READWAIT (1<<13) | ||
113 | #define S3C2410_SDIIMSK_SDIOIRQ (1<<12) | ||
114 | #define S3C2410_SDIIMSK_FIFOFAIL (1<<11) | ||
115 | #define S3C2410_SDIIMSK_CRCSTATUS (1<<10) | ||
116 | #define S3C2410_SDIIMSK_DATACRC (1<<9) | ||
117 | #define S3C2410_SDIIMSK_DATATIMEOUT (1<<8) | ||
118 | #define S3C2410_SDIIMSK_DATAFINISH (1<<7) | ||
119 | #define S3C2410_SDIIMSK_BUSYFINISH (1<<6) | ||
120 | #define S3C2410_SDIIMSK_SBITERR (1<<5) /* reserved 2440/2410a */ | ||
121 | #define S3C2410_SDIIMSK_TXFIFOHALF (1<<4) | ||
122 | #define S3C2410_SDIIMSK_TXFIFOEMPTY (1<<3) | ||
123 | #define S3C2410_SDIIMSK_RXFIFOLAST (1<<2) | ||
124 | #define S3C2410_SDIIMSK_RXFIFOFULL (1<<1) | ||
125 | #define S3C2410_SDIIMSK_RXFIFOHALF (1<<0) | ||
126 | |||
127 | #endif /* __ASM_ARM_REGS_SDI */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/tick.h b/arch/arm/mach-s3c24xx/include/mach/tick.h new file mode 100644 index 000000000000..544da41979db --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/tick.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/include/mach/tick.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C2410 - timer tick support | ||
8 | */ | ||
9 | |||
10 | #define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0)) | ||
11 | |||
12 | static inline int s3c24xx_ostimer_pending(void) | ||
13 | { | ||
14 | return __raw_readl(S3C2410_SRCPND) & SRCPND_TIMER4; | ||
15 | } | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/timex.h b/arch/arm/mach-s3c24xx/include/mach/timex.h new file mode 100644 index 000000000000..fe9ca1ffd51b --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/timex.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/timex.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - time parameters | ||
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_TIMEX_H | ||
14 | #define __ASM_ARCH_TIMEX_H | ||
15 | |||
16 | /* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it | ||
17 | * a variable is useless. It seems as long as we make our timers an | ||
18 | * exact multiple of HZ, any value that makes a 1->1 correspondence | ||
19 | * for the time conversion functions to/from jiffies is acceptable. | ||
20 | */ | ||
21 | |||
22 | #define CLOCK_TICK_RATE 12000000 | ||
23 | |||
24 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/uncompress.h b/arch/arm/mach-s3c24xx/include/mach/uncompress.h new file mode 100644 index 000000000000..8b283f847daa --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/uncompress.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/uncompress.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2007 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2410 - uncompress code | ||
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 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
15 | #define __ASM_ARCH_UNCOMPRESS_H | ||
16 | |||
17 | #include <mach/regs-gpio.h> | ||
18 | #include <mach/map.h> | ||
19 | |||
20 | /* working in physical space... */ | ||
21 | #undef S3C2410_GPIOREG | ||
22 | #define S3C2410_GPIOREG(x) ((S3C24XX_PA_GPIO + (x))) | ||
23 | |||
24 | #include <plat/uncompress.h> | ||
25 | |||
26 | static inline int is_arm926(void) | ||
27 | { | ||
28 | unsigned int cpuid; | ||
29 | |||
30 | asm volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (cpuid)); | ||
31 | |||
32 | return ((cpuid & 0xff0) == 0x260); | ||
33 | } | ||
34 | |||
35 | static void arch_detect_cpu(void) | ||
36 | { | ||
37 | unsigned int cpuid; | ||
38 | |||
39 | cpuid = *((volatile unsigned int *)S3C2410_GSTATUS1); | ||
40 | cpuid &= S3C2410_GSTATUS1_IDMASK; | ||
41 | |||
42 | if (is_arm926() || cpuid == S3C2410_GSTATUS1_2440 || | ||
43 | cpuid == S3C2410_GSTATUS1_2442 || | ||
44 | cpuid == S3C2410_GSTATUS1_2416 || | ||
45 | cpuid == S3C2410_GSTATUS1_2450) { | ||
46 | fifo_mask = S3C2440_UFSTAT_TXMASK; | ||
47 | fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT; | ||
48 | } else { | ||
49 | fifo_mask = S3C2410_UFSTAT_TXMASK; | ||
50 | fifo_max = 15 << S3C2410_UFSTAT_TXSHIFT; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | #endif /* __ASM_ARCH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h new file mode 100644 index 000000000000..e4119913d7c5 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * VR1000 - CPLD control constants | ||
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_VR1000CPLD_H | ||
14 | #define __ASM_ARCH_VR1000CPLD_H | ||
15 | |||
16 | #define VR1000_CPLD_CTRL2_RAMWEN (0x04) /* SRAM Write Enable */ | ||
17 | |||
18 | #endif /* __ASM_ARCH_VR1000CPLD_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h new file mode 100644 index 000000000000..47add133b8ee --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/vr1000-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Machine VR1000 - IRQ Number definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_VR1000IRQ_H | ||
14 | #define __ASM_ARCH_VR1000IRQ_H | ||
15 | |||
16 | /* irq numbers to onboard peripherals */ | ||
17 | |||
18 | #define IRQ_USBOC IRQ_EINT19 | ||
19 | #define IRQ_IDE0 IRQ_EINT16 | ||
20 | #define IRQ_IDE1 IRQ_EINT17 | ||
21 | #define IRQ_VR1000_SERIAL IRQ_EINT12 | ||
22 | #define IRQ_VR1000_DM9000A IRQ_EINT10 | ||
23 | #define IRQ_VR1000_DM9000N IRQ_EINT9 | ||
24 | #define IRQ_SMALERT IRQ_EINT8 | ||
25 | |||
26 | #endif /* __ASM_ARCH_VR1000IRQ_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h new file mode 100644 index 000000000000..99612fcc4eb2 --- /dev/null +++ b/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/vr1000-map.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Machine VR1000 - Memory map definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* needs arch/map.h including with this */ | ||
14 | |||
15 | /* ok, we've used up to 0x13000000, now we need to find space for the | ||
16 | * peripherals that live in the nGCS[x] areas, which are quite numerous | ||
17 | * in their space. We also have the board's CPLD to find register space | ||
18 | * for. | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASM_ARCH_VR1000MAP_H | ||
22 | #define __ASM_ARCH_VR1000MAP_H | ||
23 | |||
24 | #include <mach/bast-map.h> | ||
25 | |||
26 | #define VR1000_IOADDR(x) BAST_IOADDR(x) | ||
27 | |||
28 | /* we put the CPLD registers next, to get them out of the way */ | ||
29 | |||
30 | #define VR1000_VA_CTRL1 VR1000_IOADDR(0x00000000) /* 0x01300000 */ | ||
31 | #define VR1000_PA_CTRL1 (S3C2410_CS5 | 0x7800000) | ||
32 | |||
33 | #define VR1000_VA_CTRL2 VR1000_IOADDR(0x00100000) /* 0x01400000 */ | ||
34 | #define VR1000_PA_CTRL2 (S3C2410_CS1 | 0x6000000) | ||
35 | |||
36 | #define VR1000_VA_CTRL3 VR1000_IOADDR(0x00200000) /* 0x01500000 */ | ||
37 | #define VR1000_PA_CTRL3 (S3C2410_CS1 | 0x6800000) | ||
38 | |||
39 | #define VR1000_VA_CTRL4 VR1000_IOADDR(0x00300000) /* 0x01600000 */ | ||
40 | #define VR1000_PA_CTRL4 (S3C2410_CS1 | 0x7000000) | ||
41 | |||
42 | /* next, we have the PC104 ISA interrupt registers */ | ||
43 | |||
44 | #define VR1000_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) /* 0x01700000 */ | ||
45 | #define VR1000_VA_PC104_IRQREQ VR1000_IOADDR(0x00400000) | ||
46 | |||
47 | #define VR1000_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) /* 0x01800000 */ | ||
48 | #define VR1000_VA_PC104_IRQRAW VR1000_IOADDR(0x00500000) | ||
49 | |||
50 | #define VR1000_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) /* 0x01900000 */ | ||
51 | #define VR1000_VA_PC104_IRQMASK VR1000_IOADDR(0x00600000) | ||
52 | |||
53 | /* 0xE0000000 contains the IO space that is split by speed and | ||
54 | * wether the access is for 8 or 16bit IO... this ensures that | ||
55 | * the correct access is made | ||
56 | * | ||
57 | * 0x10000000 of space, partitioned as so: | ||
58 | * | ||
59 | * 0x00000000 to 0x04000000 8bit, slow | ||
60 | * 0x04000000 to 0x08000000 16bit, slow | ||
61 | * 0x08000000 to 0x0C000000 16bit, net | ||
62 | * 0x0C000000 to 0x10000000 16bit, fast | ||
63 | * | ||
64 | * each of these spaces has the following in: | ||
65 | * | ||
66 | * 0x02000000 to 0x02100000 1MB IDE primary channel | ||
67 | * 0x02100000 to 0x02200000 1MB IDE primary channel aux | ||
68 | * 0x02200000 to 0x02400000 1MB IDE secondary channel | ||
69 | * 0x02300000 to 0x02400000 1MB IDE secondary channel aux | ||
70 | * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controllers | ||
71 | * 0x02600000 to 0x02700000 1MB | ||
72 | * | ||
73 | * the phyiscal layout of the zones are: | ||
74 | * nGCS2 - 8bit, slow | ||
75 | * nGCS3 - 16bit, slow | ||
76 | * nGCS4 - 16bit, net | ||
77 | * nGCS5 - 16bit, fast | ||
78 | */ | ||
79 | |||
80 | #define VR1000_VA_MULTISPACE (0xE0000000) | ||
81 | |||
82 | #define VR1000_VA_ISAIO (VR1000_VA_MULTISPACE + 0x00000000) | ||
83 | #define VR1000_VA_ISAMEM (VR1000_VA_MULTISPACE + 0x01000000) | ||
84 | #define VR1000_VA_IDEPRI (VR1000_VA_MULTISPACE + 0x02000000) | ||
85 | #define VR1000_VA_IDEPRIAUX (VR1000_VA_MULTISPACE + 0x02100000) | ||
86 | #define VR1000_VA_IDESEC (VR1000_VA_MULTISPACE + 0x02200000) | ||
87 | #define VR1000_VA_IDESECAUX (VR1000_VA_MULTISPACE + 0x02300000) | ||
88 | #define VR1000_VA_ASIXNET (VR1000_VA_MULTISPACE + 0x02400000) | ||
89 | #define VR1000_VA_DM9000 (VR1000_VA_MULTISPACE + 0x02500000) | ||
90 | #define VR1000_VA_SUPERIO (VR1000_VA_MULTISPACE + 0x02600000) | ||
91 | |||
92 | /* physical offset addresses for the peripherals */ | ||
93 | |||
94 | #define VR1000_PA_IDEPRI (0x02000000) | ||
95 | #define VR1000_PA_IDEPRIAUX (0x02800000) | ||
96 | #define VR1000_PA_IDESEC (0x03000000) | ||
97 | #define VR1000_PA_IDESECAUX (0x03800000) | ||
98 | #define VR1000_PA_DM9000 (0x05000000) | ||
99 | |||
100 | #define VR1000_PA_SERIAL (0x11800000) | ||
101 | #define VR1000_VA_SERIAL (VR1000_IOADDR(0x00700000)) | ||
102 | |||
103 | /* VR1000 ram is in CS1, with A26..A24 = 2_101 */ | ||
104 | #define VR1000_PA_SRAM (S3C2410_CS1 | 0x05000000) | ||
105 | |||
106 | /* some configurations for the peripherals */ | ||
107 | |||
108 | #define VR1000_DM9000_CS VR1000_VAM_CS4 | ||
109 | |||
110 | #endif /* __ASM_ARCH_VR1000MAP_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c new file mode 100644 index 000000000000..e65619ddbccc --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq-s3c2412.c | |||
@@ -0,0 +1,214 @@ | |||
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 | #include <mach/regs-power.h> | ||
37 | |||
38 | #include <plat/cpu.h> | ||
39 | #include <plat/irq.h> | ||
40 | #include <plat/pm.h> | ||
41 | |||
42 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
43 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | ||
44 | |||
45 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
46 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
47 | * both show the status, they both now need to be acked when the IRQs | ||
48 | * go off. | ||
49 | */ | ||
50 | |||
51 | static void | ||
52 | s3c2412_irq_mask(struct irq_data *data) | ||
53 | { | ||
54 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
55 | unsigned long mask; | ||
56 | |||
57 | mask = __raw_readl(S3C2410_INTMSK); | ||
58 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
59 | |||
60 | mask = __raw_readl(S3C2412_EINTMASK); | ||
61 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
62 | } | ||
63 | |||
64 | static inline void | ||
65 | s3c2412_irq_ack(struct irq_data *data) | ||
66 | { | ||
67 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
68 | |||
69 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
70 | __raw_writel(bitval, S3C2410_SRCPND); | ||
71 | __raw_writel(bitval, S3C2410_INTPND); | ||
72 | } | ||
73 | |||
74 | static inline void | ||
75 | s3c2412_irq_maskack(struct irq_data *data) | ||
76 | { | ||
77 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
78 | unsigned long mask; | ||
79 | |||
80 | mask = __raw_readl(S3C2410_INTMSK); | ||
81 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
82 | |||
83 | mask = __raw_readl(S3C2412_EINTMASK); | ||
84 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
85 | |||
86 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
87 | __raw_writel(bitval, S3C2410_SRCPND); | ||
88 | __raw_writel(bitval, S3C2410_INTPND); | ||
89 | } | ||
90 | |||
91 | static void | ||
92 | s3c2412_irq_unmask(struct irq_data *data) | ||
93 | { | ||
94 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
95 | unsigned long mask; | ||
96 | |||
97 | mask = __raw_readl(S3C2412_EINTMASK); | ||
98 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
99 | |||
100 | mask = __raw_readl(S3C2410_INTMSK); | ||
101 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
102 | } | ||
103 | |||
104 | static struct irq_chip s3c2412_irq_eint0t4 = { | ||
105 | .irq_ack = s3c2412_irq_ack, | ||
106 | .irq_mask = s3c2412_irq_mask, | ||
107 | .irq_unmask = s3c2412_irq_unmask, | ||
108 | .irq_set_wake = s3c_irq_wake, | ||
109 | .irq_set_type = s3c_irqext_type, | ||
110 | }; | ||
111 | |||
112 | #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) | ||
113 | |||
114 | /* CF and SDI sub interrupts */ | ||
115 | |||
116 | static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) | ||
117 | { | ||
118 | unsigned int subsrc, submsk; | ||
119 | |||
120 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
121 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
122 | |||
123 | subsrc &= ~submsk; | ||
124 | |||
125 | if (subsrc & INTBIT(IRQ_S3C2412_SDI)) | ||
126 | generic_handle_irq(IRQ_S3C2412_SDI); | ||
127 | |||
128 | if (subsrc & INTBIT(IRQ_S3C2412_CF)) | ||
129 | generic_handle_irq(IRQ_S3C2412_CF); | ||
130 | } | ||
131 | |||
132 | #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) | ||
133 | #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) | ||
134 | |||
135 | static void s3c2412_irq_cfsdi_mask(struct irq_data *data) | ||
136 | { | ||
137 | s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
138 | } | ||
139 | |||
140 | static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) | ||
141 | { | ||
142 | s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); | ||
143 | } | ||
144 | |||
145 | static void s3c2412_irq_cfsdi_ack(struct irq_data *data) | ||
146 | { | ||
147 | s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
148 | } | ||
149 | |||
150 | static struct irq_chip s3c2412_irq_cfsdi = { | ||
151 | .name = "s3c2412-cfsdi", | ||
152 | .irq_ack = s3c2412_irq_cfsdi_ack, | ||
153 | .irq_mask = s3c2412_irq_cfsdi_mask, | ||
154 | .irq_unmask = s3c2412_irq_cfsdi_unmask, | ||
155 | }; | ||
156 | |||
157 | static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state) | ||
158 | { | ||
159 | unsigned long pwrcfg; | ||
160 | |||
161 | pwrcfg = __raw_readl(S3C2412_PWRCFG); | ||
162 | if (state) | ||
163 | pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ; | ||
164 | else | ||
165 | pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ; | ||
166 | __raw_writel(pwrcfg, S3C2412_PWRCFG); | ||
167 | |||
168 | return s3c_irq_chip.irq_set_wake(data, state); | ||
169 | } | ||
170 | |||
171 | static struct irq_chip s3c2412_irq_rtc_chip; | ||
172 | |||
173 | static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | ||
174 | { | ||
175 | unsigned int irqno; | ||
176 | |||
177 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
178 | irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, | ||
179 | handle_edge_irq); | ||
180 | set_irq_flags(irqno, IRQF_VALID); | ||
181 | } | ||
182 | |||
183 | /* add demux support for CF/SDI */ | ||
184 | |||
185 | irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); | ||
186 | |||
187 | for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { | ||
188 | irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, | ||
189 | handle_level_irq); | ||
190 | set_irq_flags(irqno, IRQF_VALID); | ||
191 | } | ||
192 | |||
193 | /* change RTC IRQ's set wake method */ | ||
194 | |||
195 | s3c2412_irq_rtc_chip = s3c_irq_chip; | ||
196 | s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake; | ||
197 | |||
198 | irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct subsys_interface s3c2412_irq_interface = { | ||
204 | .name = "s3c2412_irq", | ||
205 | .subsys = &s3c2412_subsys, | ||
206 | .add_dev = s3c2412_irq_add, | ||
207 | }; | ||
208 | |||
209 | static int s3c2412_irq_init(void) | ||
210 | { | ||
211 | return subsys_interface_register(&s3c2412_irq_interface); | ||
212 | } | ||
213 | |||
214 | arch_initcall(s3c2412_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2416.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c new file mode 100644 index 000000000000..fd49f35e448e --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq-s3c2416.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/ioport.h> | ||
28 | #include <linux/device.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <asm/mach/irq.h> | ||
35 | |||
36 | #include <mach/regs-irq.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | |||
39 | #include <plat/cpu.h> | ||
40 | #include <plat/pm.h> | ||
41 | #include <plat/irq.h> | ||
42 | |||
43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
44 | |||
45 | static inline void s3c2416_irq_demux(unsigned int irq, unsigned int len) | ||
46 | { | ||
47 | unsigned int subsrc, submsk; | ||
48 | unsigned int end; | ||
49 | |||
50 | /* read the current pending interrupts, and the mask | ||
51 | * for what it is available */ | ||
52 | |||
53 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
54 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
55 | |||
56 | subsrc &= ~submsk; | ||
57 | subsrc >>= (irq - S3C2410_IRQSUB(0)); | ||
58 | subsrc &= (1 << len)-1; | ||
59 | |||
60 | end = len + irq; | ||
61 | |||
62 | for (; irq < end && subsrc; irq++) { | ||
63 | if (subsrc & 1) | ||
64 | generic_handle_irq(irq); | ||
65 | |||
66 | subsrc >>= 1; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /* WDT/AC97 sub interrupts */ | ||
71 | |||
72 | static void s3c2416_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc) | ||
73 | { | ||
74 | s3c2416_irq_demux(IRQ_S3C2443_WDT, 4); | ||
75 | } | ||
76 | |||
77 | #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
78 | #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) | ||
79 | |||
80 | static void s3c2416_irq_wdtac97_mask(struct irq_data *data) | ||
81 | { | ||
82 | s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
83 | } | ||
84 | |||
85 | static void s3c2416_irq_wdtac97_unmask(struct irq_data *data) | ||
86 | { | ||
87 | s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97); | ||
88 | } | ||
89 | |||
90 | static void s3c2416_irq_wdtac97_ack(struct irq_data *data) | ||
91 | { | ||
92 | s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
93 | } | ||
94 | |||
95 | static struct irq_chip s3c2416_irq_wdtac97 = { | ||
96 | .irq_mask = s3c2416_irq_wdtac97_mask, | ||
97 | .irq_unmask = s3c2416_irq_wdtac97_unmask, | ||
98 | .irq_ack = s3c2416_irq_wdtac97_ack, | ||
99 | }; | ||
100 | |||
101 | /* LCD sub interrupts */ | ||
102 | |||
103 | static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc) | ||
104 | { | ||
105 | s3c2416_irq_demux(IRQ_S3C2443_LCD1, 4); | ||
106 | } | ||
107 | |||
108 | #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) | ||
109 | #define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4) | ||
110 | |||
111 | static void s3c2416_irq_lcd_mask(struct irq_data *data) | ||
112 | { | ||
113 | s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
114 | } | ||
115 | |||
116 | static void s3c2416_irq_lcd_unmask(struct irq_data *data) | ||
117 | { | ||
118 | s3c_irqsub_unmask(data->irq, INTMSK_LCD); | ||
119 | } | ||
120 | |||
121 | static void s3c2416_irq_lcd_ack(struct irq_data *data) | ||
122 | { | ||
123 | s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
124 | } | ||
125 | |||
126 | static struct irq_chip s3c2416_irq_lcd = { | ||
127 | .irq_mask = s3c2416_irq_lcd_mask, | ||
128 | .irq_unmask = s3c2416_irq_lcd_unmask, | ||
129 | .irq_ack = s3c2416_irq_lcd_ack, | ||
130 | }; | ||
131 | |||
132 | /* DMA sub interrupts */ | ||
133 | |||
134 | static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc) | ||
135 | { | ||
136 | s3c2416_irq_demux(IRQ_S3C2443_DMA0, 6); | ||
137 | } | ||
138 | |||
139 | #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) | ||
140 | #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) | ||
141 | |||
142 | |||
143 | static void s3c2416_irq_dma_mask(struct irq_data *data) | ||
144 | { | ||
145 | s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
146 | } | ||
147 | |||
148 | static void s3c2416_irq_dma_unmask(struct irq_data *data) | ||
149 | { | ||
150 | s3c_irqsub_unmask(data->irq, INTMSK_DMA); | ||
151 | } | ||
152 | |||
153 | static void s3c2416_irq_dma_ack(struct irq_data *data) | ||
154 | { | ||
155 | s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
156 | } | ||
157 | |||
158 | static struct irq_chip s3c2416_irq_dma = { | ||
159 | .irq_mask = s3c2416_irq_dma_mask, | ||
160 | .irq_unmask = s3c2416_irq_dma_unmask, | ||
161 | .irq_ack = s3c2416_irq_dma_ack, | ||
162 | }; | ||
163 | |||
164 | /* UART3 sub interrupts */ | ||
165 | |||
166 | static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) | ||
167 | { | ||
168 | s3c2416_irq_demux(IRQ_S3C2443_RX3, 3); | ||
169 | } | ||
170 | |||
171 | #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) | ||
172 | #define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) | ||
173 | |||
174 | static void s3c2416_irq_uart3_mask(struct irq_data *data) | ||
175 | { | ||
176 | s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
177 | } | ||
178 | |||
179 | static void s3c2416_irq_uart3_unmask(struct irq_data *data) | ||
180 | { | ||
181 | s3c_irqsub_unmask(data->irq, INTMSK_UART3); | ||
182 | } | ||
183 | |||
184 | static void s3c2416_irq_uart3_ack(struct irq_data *data) | ||
185 | { | ||
186 | s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
187 | } | ||
188 | |||
189 | static struct irq_chip s3c2416_irq_uart3 = { | ||
190 | .irq_mask = s3c2416_irq_uart3_mask, | ||
191 | .irq_unmask = s3c2416_irq_uart3_unmask, | ||
192 | .irq_ack = s3c2416_irq_uart3_ack, | ||
193 | }; | ||
194 | |||
195 | /* IRQ initialisation code */ | ||
196 | |||
197 | static int __init s3c2416_add_sub(unsigned int base, | ||
198 | void (*demux)(unsigned int, | ||
199 | struct irq_desc *), | ||
200 | struct irq_chip *chip, | ||
201 | unsigned int start, unsigned int end) | ||
202 | { | ||
203 | unsigned int irqno; | ||
204 | |||
205 | irq_set_chip_and_handler(base, &s3c_irq_level_chip, handle_level_irq); | ||
206 | irq_set_chained_handler(base, demux); | ||
207 | |||
208 | for (irqno = start; irqno <= end; irqno++) { | ||
209 | irq_set_chip_and_handler(irqno, chip, handle_level_irq); | ||
210 | set_irq_flags(irqno, IRQF_VALID); | ||
211 | } | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static int __init s3c2416_irq_add(struct device *dev, | ||
217 | struct subsys_interface *sif) | ||
218 | { | ||
219 | printk(KERN_INFO "S3C2416: IRQ Support\n"); | ||
220 | |||
221 | s3c2416_add_sub(IRQ_LCD, s3c2416_irq_demux_lcd, &s3c2416_irq_lcd, | ||
222 | IRQ_S3C2443_LCD2, IRQ_S3C2443_LCD4); | ||
223 | |||
224 | s3c2416_add_sub(IRQ_S3C2443_DMA, s3c2416_irq_demux_dma, | ||
225 | &s3c2416_irq_dma, IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5); | ||
226 | |||
227 | s3c2416_add_sub(IRQ_S3C2443_UART3, s3c2416_irq_demux_uart3, | ||
228 | &s3c2416_irq_uart3, | ||
229 | IRQ_S3C2443_RX3, IRQ_S3C2443_ERR3); | ||
230 | |||
231 | s3c2416_add_sub(IRQ_WDT, s3c2416_irq_demux_wdtac97, | ||
232 | &s3c2416_irq_wdtac97, | ||
233 | IRQ_S3C2443_WDT, IRQ_S3C2443_AC97); | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static struct subsys_interface s3c2416_irq_interface = { | ||
239 | .name = "s3c2416_irq", | ||
240 | .subsys = &s3c2416_subsys, | ||
241 | .add_dev = s3c2416_irq_add, | ||
242 | }; | ||
243 | |||
244 | static int __init s3c2416_irq_init(void) | ||
245 | { | ||
246 | return subsys_interface_register(&s3c2416_irq_interface); | ||
247 | } | ||
248 | |||
249 | arch_initcall(s3c2416_irq_init); | ||
250 | |||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2440.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c new file mode 100644 index 000000000000..4a18cde439cc --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq-s3c2440.c | |||
@@ -0,0 +1,128 @@ | |||
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-s3c2443.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c new file mode 100644 index 000000000000..ac2829f56d12 --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq-s3c2443.c | |||
@@ -0,0 +1,281 @@ | |||
1 | /* linux/arch/arm/mach-s3c2443/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2007 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 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
42 | |||
43 | static inline void s3c2443_irq_demux(unsigned int irq, unsigned int len) | ||
44 | { | ||
45 | unsigned int subsrc, submsk; | ||
46 | unsigned int end; | ||
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 >>= (irq - S3C2410_IRQSUB(0)); | ||
56 | subsrc &= (1 << len)-1; | ||
57 | |||
58 | end = len + irq; | ||
59 | |||
60 | for (; irq < end && subsrc; irq++) { | ||
61 | if (subsrc & 1) | ||
62 | generic_handle_irq(irq); | ||
63 | |||
64 | subsrc >>= 1; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /* WDT/AC97 sub interrupts */ | ||
69 | |||
70 | static void s3c2443_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc) | ||
71 | { | ||
72 | s3c2443_irq_demux(IRQ_S3C2443_WDT, 4); | ||
73 | } | ||
74 | |||
75 | #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
76 | #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) | ||
77 | |||
78 | static void s3c2443_irq_wdtac97_mask(struct irq_data *data) | ||
79 | { | ||
80 | s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
81 | } | ||
82 | |||
83 | static void s3c2443_irq_wdtac97_unmask(struct irq_data *data) | ||
84 | { | ||
85 | s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97); | ||
86 | } | ||
87 | |||
88 | static void s3c2443_irq_wdtac97_ack(struct irq_data *data) | ||
89 | { | ||
90 | s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
91 | } | ||
92 | |||
93 | static struct irq_chip s3c2443_irq_wdtac97 = { | ||
94 | .irq_mask = s3c2443_irq_wdtac97_mask, | ||
95 | .irq_unmask = s3c2443_irq_wdtac97_unmask, | ||
96 | .irq_ack = s3c2443_irq_wdtac97_ack, | ||
97 | }; | ||
98 | |||
99 | /* LCD sub interrupts */ | ||
100 | |||
101 | static void s3c2443_irq_demux_lcd(unsigned int irq, struct irq_desc *desc) | ||
102 | { | ||
103 | s3c2443_irq_demux(IRQ_S3C2443_LCD1, 4); | ||
104 | } | ||
105 | |||
106 | #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) | ||
107 | #define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4) | ||
108 | |||
109 | static void s3c2443_irq_lcd_mask(struct irq_data *data) | ||
110 | { | ||
111 | s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
112 | } | ||
113 | |||
114 | static void s3c2443_irq_lcd_unmask(struct irq_data *data) | ||
115 | { | ||
116 | s3c_irqsub_unmask(data->irq, INTMSK_LCD); | ||
117 | } | ||
118 | |||
119 | static void s3c2443_irq_lcd_ack(struct irq_data *data) | ||
120 | { | ||
121 | s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
122 | } | ||
123 | |||
124 | static struct irq_chip s3c2443_irq_lcd = { | ||
125 | .irq_mask = s3c2443_irq_lcd_mask, | ||
126 | .irq_unmask = s3c2443_irq_lcd_unmask, | ||
127 | .irq_ack = s3c2443_irq_lcd_ack, | ||
128 | }; | ||
129 | |||
130 | /* DMA sub interrupts */ | ||
131 | |||
132 | static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc) | ||
133 | { | ||
134 | s3c2443_irq_demux(IRQ_S3C2443_DMA0, 6); | ||
135 | } | ||
136 | |||
137 | #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) | ||
138 | #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) | ||
139 | |||
140 | static void s3c2443_irq_dma_mask(struct irq_data *data) | ||
141 | { | ||
142 | s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
143 | } | ||
144 | |||
145 | static void s3c2443_irq_dma_unmask(struct irq_data *data) | ||
146 | { | ||
147 | s3c_irqsub_unmask(data->irq, INTMSK_DMA); | ||
148 | } | ||
149 | |||
150 | static void s3c2443_irq_dma_ack(struct irq_data *data) | ||
151 | { | ||
152 | s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
153 | } | ||
154 | |||
155 | static struct irq_chip s3c2443_irq_dma = { | ||
156 | .irq_mask = s3c2443_irq_dma_mask, | ||
157 | .irq_unmask = s3c2443_irq_dma_unmask, | ||
158 | .irq_ack = s3c2443_irq_dma_ack, | ||
159 | }; | ||
160 | |||
161 | /* UART3 sub interrupts */ | ||
162 | |||
163 | static void s3c2443_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) | ||
164 | { | ||
165 | s3c2443_irq_demux(IRQ_S3C2443_RX3, 3); | ||
166 | } | ||
167 | |||
168 | #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) | ||
169 | #define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) | ||
170 | |||
171 | static void s3c2443_irq_uart3_mask(struct irq_data *data) | ||
172 | { | ||
173 | s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
174 | } | ||
175 | |||
176 | static void s3c2443_irq_uart3_unmask(struct irq_data *data) | ||
177 | { | ||
178 | s3c_irqsub_unmask(data->irq, INTMSK_UART3); | ||
179 | } | ||
180 | |||
181 | static void s3c2443_irq_uart3_ack(struct irq_data *data) | ||
182 | { | ||
183 | s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
184 | } | ||
185 | |||
186 | static struct irq_chip s3c2443_irq_uart3 = { | ||
187 | .irq_mask = s3c2443_irq_uart3_mask, | ||
188 | .irq_unmask = s3c2443_irq_uart3_unmask, | ||
189 | .irq_ack = s3c2443_irq_uart3_ack, | ||
190 | }; | ||
191 | |||
192 | /* CAM sub interrupts */ | ||
193 | |||
194 | static void s3c2443_irq_demux_cam(unsigned int irq, struct irq_desc *desc) | ||
195 | { | ||
196 | s3c2443_irq_demux(IRQ_S3C2440_CAM_C, 4); | ||
197 | } | ||
198 | |||
199 | #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) | ||
200 | #define SUBMSK_CAM INTMSK(IRQ_S3C2440_CAM_C, IRQ_S3C2440_CAM_P) | ||
201 | |||
202 | static void s3c2443_irq_cam_mask(struct irq_data *data) | ||
203 | { | ||
204 | s3c_irqsub_mask(data->irq, INTMSK_CAM, SUBMSK_CAM); | ||
205 | } | ||
206 | |||
207 | static void s3c2443_irq_cam_unmask(struct irq_data *data) | ||
208 | { | ||
209 | s3c_irqsub_unmask(data->irq, INTMSK_CAM); | ||
210 | } | ||
211 | |||
212 | static void s3c2443_irq_cam_ack(struct irq_data *data) | ||
213 | { | ||
214 | s3c_irqsub_maskack(data->irq, INTMSK_CAM, SUBMSK_CAM); | ||
215 | } | ||
216 | |||
217 | static struct irq_chip s3c2443_irq_cam = { | ||
218 | .irq_mask = s3c2443_irq_cam_mask, | ||
219 | .irq_unmask = s3c2443_irq_cam_unmask, | ||
220 | .irq_ack = s3c2443_irq_cam_ack, | ||
221 | }; | ||
222 | |||
223 | /* IRQ initialisation code */ | ||
224 | |||
225 | static int __init s3c2443_add_sub(unsigned int base, | ||
226 | void (*demux)(unsigned int, | ||
227 | struct irq_desc *), | ||
228 | struct irq_chip *chip, | ||
229 | unsigned int start, unsigned int end) | ||
230 | { | ||
231 | unsigned int irqno; | ||
232 | |||
233 | irq_set_chip_and_handler(base, &s3c_irq_level_chip, handle_level_irq); | ||
234 | irq_set_chained_handler(base, demux); | ||
235 | |||
236 | for (irqno = start; irqno <= end; irqno++) { | ||
237 | irq_set_chip_and_handler(irqno, chip, handle_level_irq); | ||
238 | set_irq_flags(irqno, IRQF_VALID); | ||
239 | } | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static int __init s3c2443_irq_add(struct device *dev, | ||
245 | struct subsys_interface *sif) | ||
246 | { | ||
247 | printk("S3C2443: IRQ Support\n"); | ||
248 | |||
249 | s3c2443_add_sub(IRQ_CAM, s3c2443_irq_demux_cam, &s3c2443_irq_cam, | ||
250 | IRQ_S3C2440_CAM_C, IRQ_S3C2440_CAM_P); | ||
251 | |||
252 | s3c2443_add_sub(IRQ_LCD, s3c2443_irq_demux_lcd, &s3c2443_irq_lcd, | ||
253 | IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4); | ||
254 | |||
255 | s3c2443_add_sub(IRQ_S3C2443_DMA, s3c2443_irq_demux_dma, | ||
256 | &s3c2443_irq_dma, IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5); | ||
257 | |||
258 | s3c2443_add_sub(IRQ_S3C2443_UART3, s3c2443_irq_demux_uart3, | ||
259 | &s3c2443_irq_uart3, | ||
260 | IRQ_S3C2443_RX3, IRQ_S3C2443_ERR3); | ||
261 | |||
262 | s3c2443_add_sub(IRQ_WDT, s3c2443_irq_demux_wdtac97, | ||
263 | &s3c2443_irq_wdtac97, | ||
264 | IRQ_S3C2443_WDT, IRQ_S3C2443_AC97); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static struct subsys_interface s3c2443_irq_interface = { | ||
270 | .name = "s3c2443_irq", | ||
271 | .subsys = &s3c2443_subsys, | ||
272 | .add_dev = s3c2443_irq_add, | ||
273 | }; | ||
274 | |||
275 | static int __init s3c2443_irq_init(void) | ||
276 | { | ||
277 | return subsys_interface_register(&s3c2443_irq_interface); | ||
278 | } | ||
279 | |||
280 | arch_initcall(s3c2443_irq_init); | ||
281 | |||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c244x.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c new file mode 100644 index 000000000000..5fe8e58d3afd --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq-s3c244x.c | |||
@@ -0,0 +1,142 @@ | |||
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 new file mode 100644 index 000000000000..4220cc60de3c --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c | |||
@@ -0,0 +1,247 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-amlm5900.c | ||
2 | * | ||
3 | * linux/arch/arm/mach-s3c2410/mach-amlm5900.c | ||
4 | * | ||
5 | * Copyright (c) 2006 American Microsystems Limited | ||
6 | * David Anders <danders@amltd.com> | ||
7 | |||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation; either version 2 of | ||
11 | * the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
21 | * MA 02111-1307 USA | ||
22 | * | ||
23 | * @History: | ||
24 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by | ||
25 | * Ben Dooks <ben@simtec.co.uk> | ||
26 | * | ||
27 | ***********************************************************************/ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/list.h> | ||
33 | #include <linux/timer.h> | ||
34 | #include <linux/init.h> | ||
35 | #include <linux/gpio.h> | ||
36 | #include <linux/device.h> | ||
37 | #include <linux/platform_device.h> | ||
38 | #include <linux/proc_fs.h> | ||
39 | #include <linux/serial_core.h> | ||
40 | #include <linux/io.h> | ||
41 | |||
42 | #include <asm/mach/arch.h> | ||
43 | #include <asm/mach/map.h> | ||
44 | #include <asm/mach/irq.h> | ||
45 | #include <asm/mach/flash.h> | ||
46 | |||
47 | #include <mach/hardware.h> | ||
48 | #include <asm/irq.h> | ||
49 | #include <asm/mach-types.h> | ||
50 | #include <mach/fb.h> | ||
51 | |||
52 | #include <plat/regs-serial.h> | ||
53 | #include <mach/regs-lcd.h> | ||
54 | #include <mach/regs-gpio.h> | ||
55 | |||
56 | #include <plat/iic.h> | ||
57 | #include <plat/devs.h> | ||
58 | #include <plat/cpu.h> | ||
59 | #include <plat/gpio-cfg.h> | ||
60 | |||
61 | #include <linux/mtd/mtd.h> | ||
62 | #include <linux/mtd/partitions.h> | ||
63 | #include <linux/mtd/map.h> | ||
64 | #include <linux/mtd/physmap.h> | ||
65 | |||
66 | #include "common.h" | ||
67 | |||
68 | static struct resource amlm5900_nor_resource = { | ||
69 | .start = 0x00000000, | ||
70 | .end = 0x01000000 - 1, | ||
71 | .flags = IORESOURCE_MEM, | ||
72 | }; | ||
73 | |||
74 | |||
75 | |||
76 | static struct mtd_partition amlm5900_mtd_partitions[] = { | ||
77 | { | ||
78 | .name = "System", | ||
79 | .size = 0x240000, | ||
80 | .offset = 0, | ||
81 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
82 | }, { | ||
83 | .name = "Kernel", | ||
84 | .size = 0x100000, | ||
85 | .offset = MTDPART_OFS_APPEND, | ||
86 | }, { | ||
87 | .name = "Ramdisk", | ||
88 | .size = 0x300000, | ||
89 | .offset = MTDPART_OFS_APPEND, | ||
90 | }, { | ||
91 | .name = "JFFS2", | ||
92 | .size = 0x9A0000, | ||
93 | .offset = MTDPART_OFS_APPEND, | ||
94 | }, { | ||
95 | .name = "Settings", | ||
96 | .size = MTDPART_SIZ_FULL, | ||
97 | .offset = MTDPART_OFS_APPEND, | ||
98 | } | ||
99 | }; | ||
100 | |||
101 | static struct physmap_flash_data amlm5900_flash_data = { | ||
102 | .width = 2, | ||
103 | .parts = amlm5900_mtd_partitions, | ||
104 | .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions), | ||
105 | }; | ||
106 | |||
107 | static struct platform_device amlm5900_device_nor = { | ||
108 | .name = "physmap-flash", | ||
109 | .id = 0, | ||
110 | .dev = { | ||
111 | .platform_data = &amlm5900_flash_data, | ||
112 | }, | ||
113 | .num_resources = 1, | ||
114 | .resource = &amlm5900_nor_resource, | ||
115 | }; | ||
116 | |||
117 | static struct map_desc amlm5900_iodesc[] __initdata = { | ||
118 | }; | ||
119 | |||
120 | #define UCON S3C2410_UCON_DEFAULT | ||
121 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
122 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
123 | |||
124 | static struct s3c2410_uartcfg amlm5900_uartcfgs[] = { | ||
125 | [0] = { | ||
126 | .hwport = 0, | ||
127 | .flags = 0, | ||
128 | .ucon = UCON, | ||
129 | .ulcon = ULCON, | ||
130 | .ufcon = UFCON, | ||
131 | }, | ||
132 | [1] = { | ||
133 | .hwport = 1, | ||
134 | .flags = 0, | ||
135 | .ucon = UCON, | ||
136 | .ulcon = ULCON, | ||
137 | .ufcon = UFCON, | ||
138 | }, | ||
139 | [2] = { | ||
140 | .hwport = 2, | ||
141 | .flags = 0, | ||
142 | .ucon = UCON, | ||
143 | .ulcon = ULCON, | ||
144 | .ufcon = UFCON, | ||
145 | } | ||
146 | }; | ||
147 | |||
148 | |||
149 | static struct platform_device *amlm5900_devices[] __initdata = { | ||
150 | #ifdef CONFIG_FB_S3C2410 | ||
151 | &s3c_device_lcd, | ||
152 | #endif | ||
153 | &s3c_device_adc, | ||
154 | &s3c_device_wdt, | ||
155 | &s3c_device_i2c0, | ||
156 | &s3c_device_ohci, | ||
157 | &s3c_device_rtc, | ||
158 | &s3c_device_usbgadget, | ||
159 | &s3c_device_sdi, | ||
160 | &amlm5900_device_nor, | ||
161 | }; | ||
162 | |||
163 | static void __init amlm5900_map_io(void) | ||
164 | { | ||
165 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); | ||
166 | s3c24xx_init_clocks(0); | ||
167 | s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); | ||
168 | } | ||
169 | |||
170 | #ifdef CONFIG_FB_S3C2410 | ||
171 | static struct s3c2410fb_display __initdata amlm5900_lcd_info = { | ||
172 | .width = 160, | ||
173 | .height = 160, | ||
174 | |||
175 | .type = S3C2410_LCDCON1_STN4, | ||
176 | |||
177 | .pixclock = 680000, /* HCLK = 100MHz */ | ||
178 | .xres = 160, | ||
179 | .yres = 160, | ||
180 | .bpp = 4, | ||
181 | .left_margin = 1 << (4 + 3), | ||
182 | .right_margin = 8 << 3, | ||
183 | .hsync_len = 48, | ||
184 | .upper_margin = 0, | ||
185 | .lower_margin = 0, | ||
186 | |||
187 | .lcdcon5 = 0x00000001, | ||
188 | }; | ||
189 | |||
190 | static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = { | ||
191 | |||
192 | .displays = &amlm5900_lcd_info, | ||
193 | .num_displays = 1, | ||
194 | .default_display = 0, | ||
195 | |||
196 | .gpccon = 0xaaaaaaaa, | ||
197 | .gpccon_mask = 0xffffffff, | ||
198 | .gpcup = 0x0000ffff, | ||
199 | .gpcup_mask = 0xffffffff, | ||
200 | |||
201 | .gpdcon = 0xaaaaaaaa, | ||
202 | .gpdcon_mask = 0xffffffff, | ||
203 | .gpdup = 0x0000ffff, | ||
204 | .gpdup_mask = 0xffffffff, | ||
205 | }; | ||
206 | #endif | ||
207 | |||
208 | static irqreturn_t | ||
209 | amlm5900_wake_interrupt(int irq, void *ignored) | ||
210 | { | ||
211 | return IRQ_HANDLED; | ||
212 | } | ||
213 | |||
214 | static void amlm5900_init_pm(void) | ||
215 | { | ||
216 | int ret = 0; | ||
217 | |||
218 | ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt, | ||
219 | IRQF_TRIGGER_RISING | IRQF_SHARED, | ||
220 | "amlm5900_wakeup", &amlm5900_wake_interrupt); | ||
221 | if (ret != 0) { | ||
222 | printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret); | ||
223 | } else { | ||
224 | enable_irq_wake(IRQ_EINT9); | ||
225 | /* configure the suspend/resume status pin */ | ||
226 | s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); | ||
227 | s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP); | ||
228 | } | ||
229 | } | ||
230 | static void __init amlm5900_init(void) | ||
231 | { | ||
232 | amlm5900_init_pm(); | ||
233 | #ifdef CONFIG_FB_S3C2410 | ||
234 | s3c24xx_fb_set_platdata(&amlm5900_fb_info); | ||
235 | #endif | ||
236 | s3c_i2c0_set_platdata(NULL); | ||
237 | platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices)); | ||
238 | } | ||
239 | |||
240 | MACHINE_START(AML_M5900, "AML_M5900") | ||
241 | .atag_offset = 0x100, | ||
242 | .map_io = amlm5900_map_io, | ||
243 | .init_irq = s3c24xx_init_irq, | ||
244 | .init_machine = amlm5900_init, | ||
245 | .timer = &s3c24xx_timer, | ||
246 | .restart = s3c2410_restart, | ||
247 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c new file mode 100644 index 000000000000..60c72c54c21e --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-anubis.c | |||
@@ -0,0 +1,492 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-anubis.c | ||
2 | * | ||
3 | * Copyright 2003-2009 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
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/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/serial_core.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/ata_platform.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/sm501.h> | ||
25 | #include <linux/sm501-regs.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/anubis-map.h> | ||
32 | #include <mach/anubis-irq.h> | ||
33 | #include <mach/anubis-cpld.h> | ||
34 | |||
35 | #include <mach/hardware.h> | ||
36 | #include <asm/irq.h> | ||
37 | #include <asm/mach-types.h> | ||
38 | |||
39 | #include <plat/regs-serial.h> | ||
40 | #include <mach/regs-gpio.h> | ||
41 | #include <mach/regs-mem.h> | ||
42 | #include <mach/regs-lcd.h> | ||
43 | #include <plat/nand.h> | ||
44 | #include <plat/iic.h> | ||
45 | |||
46 | #include <linux/mtd/mtd.h> | ||
47 | #include <linux/mtd/nand.h> | ||
48 | #include <linux/mtd/nand_ecc.h> | ||
49 | #include <linux/mtd/partitions.h> | ||
50 | |||
51 | #include <net/ax88796.h> | ||
52 | |||
53 | #include <plat/clock.h> | ||
54 | #include <plat/devs.h> | ||
55 | #include <plat/cpu.h> | ||
56 | #include <plat/audio-simtec.h> | ||
57 | |||
58 | #include "simtec.h" | ||
59 | #include "common.h" | ||
60 | |||
61 | #define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics" | ||
62 | |||
63 | static struct map_desc anubis_iodesc[] __initdata = { | ||
64 | /* ISA IO areas */ | ||
65 | |||
66 | { | ||
67 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
68 | .pfn = __phys_to_pfn(0x0), | ||
69 | .length = SZ_4M, | ||
70 | .type = MT_DEVICE, | ||
71 | }, { | ||
72 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
73 | .pfn = __phys_to_pfn(0x0), | ||
74 | .length = SZ_4M, | ||
75 | .type = MT_DEVICE, | ||
76 | }, | ||
77 | |||
78 | /* we could possibly compress the next set down into a set of smaller tables | ||
79 | * pagetables, but that would mean using an L2 section, and it still means | ||
80 | * we cannot actually feed the same register to an LDR due to 16K spacing | ||
81 | */ | ||
82 | |||
83 | /* CPLD control registers */ | ||
84 | |||
85 | { | ||
86 | .virtual = (u32)ANUBIS_VA_CTRL1, | ||
87 | .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1), | ||
88 | .length = SZ_4K, | ||
89 | .type = MT_DEVICE, | ||
90 | }, { | ||
91 | .virtual = (u32)ANUBIS_VA_IDREG, | ||
92 | .pfn = __phys_to_pfn(ANUBIS_PA_IDREG), | ||
93 | .length = SZ_4K, | ||
94 | .type = MT_DEVICE, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
99 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
100 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
101 | |||
102 | static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = { | ||
103 | [0] = { | ||
104 | .hwport = 0, | ||
105 | .flags = 0, | ||
106 | .ucon = UCON, | ||
107 | .ulcon = ULCON, | ||
108 | .ufcon = UFCON, | ||
109 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
110 | }, | ||
111 | [1] = { | ||
112 | .hwport = 2, | ||
113 | .flags = 0, | ||
114 | .ucon = UCON, | ||
115 | .ulcon = ULCON, | ||
116 | .ufcon = UFCON, | ||
117 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | /* NAND Flash on Anubis board */ | ||
122 | |||
123 | static int external_map[] = { 2 }; | ||
124 | static int chip0_map[] = { 0 }; | ||
125 | static int chip1_map[] = { 1 }; | ||
126 | |||
127 | static struct mtd_partition __initdata anubis_default_nand_part[] = { | ||
128 | [0] = { | ||
129 | .name = "Boot Agent", | ||
130 | .size = SZ_16K, | ||
131 | .offset = 0, | ||
132 | }, | ||
133 | [1] = { | ||
134 | .name = "/boot", | ||
135 | .size = SZ_4M - SZ_16K, | ||
136 | .offset = SZ_16K, | ||
137 | }, | ||
138 | [2] = { | ||
139 | .name = "user1", | ||
140 | .offset = SZ_4M, | ||
141 | .size = SZ_32M - SZ_4M, | ||
142 | }, | ||
143 | [3] = { | ||
144 | .name = "user2", | ||
145 | .offset = SZ_32M, | ||
146 | .size = MTDPART_SIZ_FULL, | ||
147 | } | ||
148 | }; | ||
149 | |||
150 | static struct mtd_partition __initdata anubis_default_nand_part_large[] = { | ||
151 | [0] = { | ||
152 | .name = "Boot Agent", | ||
153 | .size = SZ_128K, | ||
154 | .offset = 0, | ||
155 | }, | ||
156 | [1] = { | ||
157 | .name = "/boot", | ||
158 | .size = SZ_4M - SZ_128K, | ||
159 | .offset = SZ_128K, | ||
160 | }, | ||
161 | [2] = { | ||
162 | .name = "user1", | ||
163 | .offset = SZ_4M, | ||
164 | .size = SZ_32M - SZ_4M, | ||
165 | }, | ||
166 | [3] = { | ||
167 | .name = "user2", | ||
168 | .offset = SZ_32M, | ||
169 | .size = MTDPART_SIZ_FULL, | ||
170 | } | ||
171 | }; | ||
172 | |||
173 | /* the Anubis has 3 selectable slots for nand-flash, the two | ||
174 | * on-board chip areas, as well as the external slot. | ||
175 | * | ||
176 | * Note, there is no current hot-plug support for the External | ||
177 | * socket. | ||
178 | */ | ||
179 | |||
180 | static struct s3c2410_nand_set __initdata anubis_nand_sets[] = { | ||
181 | [1] = { | ||
182 | .name = "External", | ||
183 | .nr_chips = 1, | ||
184 | .nr_map = external_map, | ||
185 | .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), | ||
186 | .partitions = anubis_default_nand_part, | ||
187 | }, | ||
188 | [0] = { | ||
189 | .name = "chip0", | ||
190 | .nr_chips = 1, | ||
191 | .nr_map = chip0_map, | ||
192 | .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), | ||
193 | .partitions = anubis_default_nand_part, | ||
194 | }, | ||
195 | [2] = { | ||
196 | .name = "chip1", | ||
197 | .nr_chips = 1, | ||
198 | .nr_map = chip1_map, | ||
199 | .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), | ||
200 | .partitions = anubis_default_nand_part, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static void anubis_nand_select(struct s3c2410_nand_set *set, int slot) | ||
205 | { | ||
206 | unsigned int tmp; | ||
207 | |||
208 | slot = set->nr_map[slot] & 3; | ||
209 | |||
210 | pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n", | ||
211 | slot, set, set->nr_map); | ||
212 | |||
213 | tmp = __raw_readb(ANUBIS_VA_CTRL1); | ||
214 | tmp &= ~ANUBIS_CTRL1_NANDSEL; | ||
215 | tmp |= slot; | ||
216 | |||
217 | pr_debug("anubis_nand: ctrl1 now %02x\n", tmp); | ||
218 | |||
219 | __raw_writeb(tmp, ANUBIS_VA_CTRL1); | ||
220 | } | ||
221 | |||
222 | static struct s3c2410_platform_nand __initdata anubis_nand_info = { | ||
223 | .tacls = 25, | ||
224 | .twrph0 = 55, | ||
225 | .twrph1 = 40, | ||
226 | .nr_sets = ARRAY_SIZE(anubis_nand_sets), | ||
227 | .sets = anubis_nand_sets, | ||
228 | .select_chip = anubis_nand_select, | ||
229 | }; | ||
230 | |||
231 | /* IDE channels */ | ||
232 | |||
233 | static struct pata_platform_info anubis_ide_platdata = { | ||
234 | .ioport_shift = 5, | ||
235 | }; | ||
236 | |||
237 | static struct resource anubis_ide0_resource[] = { | ||
238 | { | ||
239 | .start = S3C2410_CS3, | ||
240 | .end = S3C2410_CS3 + (8*32) - 1, | ||
241 | .flags = IORESOURCE_MEM, | ||
242 | }, { | ||
243 | .start = S3C2410_CS3 + (1<<26) + (6*32), | ||
244 | .end = S3C2410_CS3 + (1<<26) + (7*32) - 1, | ||
245 | .flags = IORESOURCE_MEM, | ||
246 | }, { | ||
247 | .start = IRQ_IDE0, | ||
248 | .end = IRQ_IDE0, | ||
249 | .flags = IORESOURCE_IRQ, | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct platform_device anubis_device_ide0 = { | ||
254 | .name = "pata_platform", | ||
255 | .id = 0, | ||
256 | .num_resources = ARRAY_SIZE(anubis_ide0_resource), | ||
257 | .resource = anubis_ide0_resource, | ||
258 | .dev = { | ||
259 | .platform_data = &anubis_ide_platdata, | ||
260 | .coherent_dma_mask = ~0, | ||
261 | }, | ||
262 | }; | ||
263 | |||
264 | static struct resource anubis_ide1_resource[] = { | ||
265 | { | ||
266 | .start = S3C2410_CS4, | ||
267 | .end = S3C2410_CS4 + (8*32) - 1, | ||
268 | .flags = IORESOURCE_MEM, | ||
269 | }, { | ||
270 | .start = S3C2410_CS4 + (1<<26) + (6*32), | ||
271 | .end = S3C2410_CS4 + (1<<26) + (7*32) - 1, | ||
272 | .flags = IORESOURCE_MEM, | ||
273 | }, { | ||
274 | .start = IRQ_IDE0, | ||
275 | .end = IRQ_IDE0, | ||
276 | .flags = IORESOURCE_IRQ, | ||
277 | }, | ||
278 | }; | ||
279 | |||
280 | static struct platform_device anubis_device_ide1 = { | ||
281 | .name = "pata_platform", | ||
282 | .id = 1, | ||
283 | .num_resources = ARRAY_SIZE(anubis_ide1_resource), | ||
284 | .resource = anubis_ide1_resource, | ||
285 | .dev = { | ||
286 | .platform_data = &anubis_ide_platdata, | ||
287 | .coherent_dma_mask = ~0, | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | /* Asix AX88796 10/100 ethernet controller */ | ||
292 | |||
293 | static struct ax_plat_data anubis_asix_platdata = { | ||
294 | .flags = AXFLG_MAC_FROMDEV, | ||
295 | .wordlength = 2, | ||
296 | .dcr_val = 0x48, | ||
297 | .rcr_val = 0x40, | ||
298 | }; | ||
299 | |||
300 | static struct resource anubis_asix_resource[] = { | ||
301 | [0] = { | ||
302 | .start = S3C2410_CS5, | ||
303 | .end = S3C2410_CS5 + (0x20 * 0x20) -1, | ||
304 | .flags = IORESOURCE_MEM | ||
305 | }, | ||
306 | [1] = { | ||
307 | .start = IRQ_ASIX, | ||
308 | .end = IRQ_ASIX, | ||
309 | .flags = IORESOURCE_IRQ | ||
310 | } | ||
311 | }; | ||
312 | |||
313 | static struct platform_device anubis_device_asix = { | ||
314 | .name = "ax88796", | ||
315 | .id = 0, | ||
316 | .num_resources = ARRAY_SIZE(anubis_asix_resource), | ||
317 | .resource = anubis_asix_resource, | ||
318 | .dev = { | ||
319 | .platform_data = &anubis_asix_platdata, | ||
320 | } | ||
321 | }; | ||
322 | |||
323 | /* SM501 */ | ||
324 | |||
325 | static struct resource anubis_sm501_resource[] = { | ||
326 | [0] = { | ||
327 | .start = S3C2410_CS2, | ||
328 | .end = S3C2410_CS2 + SZ_8M, | ||
329 | .flags = IORESOURCE_MEM, | ||
330 | }, | ||
331 | [1] = { | ||
332 | .start = S3C2410_CS2 + SZ_64M - SZ_2M, | ||
333 | .end = S3C2410_CS2 + SZ_64M - 1, | ||
334 | .flags = IORESOURCE_MEM, | ||
335 | }, | ||
336 | [2] = { | ||
337 | .start = IRQ_EINT0, | ||
338 | .end = IRQ_EINT0, | ||
339 | .flags = IORESOURCE_IRQ, | ||
340 | }, | ||
341 | }; | ||
342 | |||
343 | static struct sm501_initdata anubis_sm501_initdata = { | ||
344 | .gpio_high = { | ||
345 | .set = 0x3F000000, /* 24bit panel */ | ||
346 | .mask = 0x0, | ||
347 | }, | ||
348 | .misc_timing = { | ||
349 | .set = 0x010100, /* SDRAM timing */ | ||
350 | .mask = 0x1F1F00, | ||
351 | }, | ||
352 | .misc_control = { | ||
353 | .set = SM501_MISC_PNL_24BIT, | ||
354 | .mask = 0, | ||
355 | }, | ||
356 | |||
357 | .devices = SM501_USE_GPIO, | ||
358 | |||
359 | /* set the SDRAM and bus clocks */ | ||
360 | .mclk = 72 * MHZ, | ||
361 | .m1xclk = 144 * MHZ, | ||
362 | }; | ||
363 | |||
364 | static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = { | ||
365 | [0] = { | ||
366 | .bus_num = 1, | ||
367 | .pin_scl = 44, | ||
368 | .pin_sda = 45, | ||
369 | }, | ||
370 | [1] = { | ||
371 | .bus_num = 2, | ||
372 | .pin_scl = 40, | ||
373 | .pin_sda = 41, | ||
374 | }, | ||
375 | }; | ||
376 | |||
377 | static struct sm501_platdata anubis_sm501_platdata = { | ||
378 | .init = &anubis_sm501_initdata, | ||
379 | .gpio_base = -1, | ||
380 | .gpio_i2c = anubis_sm501_gpio_i2c, | ||
381 | .gpio_i2c_nr = ARRAY_SIZE(anubis_sm501_gpio_i2c), | ||
382 | }; | ||
383 | |||
384 | static struct platform_device anubis_device_sm501 = { | ||
385 | .name = "sm501", | ||
386 | .id = 0, | ||
387 | .num_resources = ARRAY_SIZE(anubis_sm501_resource), | ||
388 | .resource = anubis_sm501_resource, | ||
389 | .dev = { | ||
390 | .platform_data = &anubis_sm501_platdata, | ||
391 | }, | ||
392 | }; | ||
393 | |||
394 | /* Standard Anubis devices */ | ||
395 | |||
396 | static struct platform_device *anubis_devices[] __initdata = { | ||
397 | &s3c_device_ohci, | ||
398 | &s3c_device_wdt, | ||
399 | &s3c_device_adc, | ||
400 | &s3c_device_i2c0, | ||
401 | &s3c_device_rtc, | ||
402 | &s3c_device_nand, | ||
403 | &anubis_device_ide0, | ||
404 | &anubis_device_ide1, | ||
405 | &anubis_device_asix, | ||
406 | &anubis_device_sm501, | ||
407 | }; | ||
408 | |||
409 | static struct clk *anubis_clocks[] __initdata = { | ||
410 | &s3c24xx_dclk0, | ||
411 | &s3c24xx_dclk1, | ||
412 | &s3c24xx_clkout0, | ||
413 | &s3c24xx_clkout1, | ||
414 | &s3c24xx_uclk, | ||
415 | }; | ||
416 | |||
417 | /* I2C devices. */ | ||
418 | |||
419 | static struct i2c_board_info anubis_i2c_devs[] __initdata = { | ||
420 | { | ||
421 | I2C_BOARD_INFO("tps65011", 0x48), | ||
422 | .irq = IRQ_EINT20, | ||
423 | } | ||
424 | }; | ||
425 | |||
426 | /* Audio setup */ | ||
427 | static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = { | ||
428 | .have_mic = 1, | ||
429 | .have_lout = 1, | ||
430 | .output_cdclk = 1, | ||
431 | .use_mpllin = 1, | ||
432 | .amp_gpio = S3C2410_GPB(2), | ||
433 | .amp_gain[0] = S3C2410_GPD(10), | ||
434 | .amp_gain[1] = S3C2410_GPD(11), | ||
435 | }; | ||
436 | |||
437 | static void __init anubis_map_io(void) | ||
438 | { | ||
439 | /* initialise the clocks */ | ||
440 | |||
441 | s3c24xx_dclk0.parent = &clk_upll; | ||
442 | s3c24xx_dclk0.rate = 12*1000*1000; | ||
443 | |||
444 | s3c24xx_dclk1.parent = &clk_upll; | ||
445 | s3c24xx_dclk1.rate = 24*1000*1000; | ||
446 | |||
447 | s3c24xx_clkout0.parent = &s3c24xx_dclk0; | ||
448 | s3c24xx_clkout1.parent = &s3c24xx_dclk1; | ||
449 | |||
450 | s3c24xx_uclk.parent = &s3c24xx_clkout1; | ||
451 | |||
452 | s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks)); | ||
453 | |||
454 | s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); | ||
455 | s3c24xx_init_clocks(0); | ||
456 | s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); | ||
457 | |||
458 | /* check for the newer revision boards with large page nand */ | ||
459 | |||
460 | if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) { | ||
461 | printk(KERN_INFO "ANUBIS-B detected (revision %d)\n", | ||
462 | __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK); | ||
463 | anubis_nand_sets[0].partitions = anubis_default_nand_part_large; | ||
464 | anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large); | ||
465 | } else { | ||
466 | /* ensure that the GPIO is setup */ | ||
467 | s3c2410_gpio_setpin(S3C2410_GPA(0), 1); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | static void __init anubis_init(void) | ||
472 | { | ||
473 | s3c_i2c0_set_platdata(NULL); | ||
474 | s3c_nand_set_platdata(&anubis_nand_info); | ||
475 | simtec_audio_add(NULL, false, &anubis_audio); | ||
476 | |||
477 | platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); | ||
478 | |||
479 | i2c_register_board_info(0, anubis_i2c_devs, | ||
480 | ARRAY_SIZE(anubis_i2c_devs)); | ||
481 | } | ||
482 | |||
483 | |||
484 | MACHINE_START(ANUBIS, "Simtec-Anubis") | ||
485 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | ||
486 | .atag_offset = 0x100, | ||
487 | .map_io = anubis_map_io, | ||
488 | .init_machine = anubis_init, | ||
489 | .init_irq = s3c24xx_init_irq, | ||
490 | .timer = &s3c24xx_timer, | ||
491 | .restart = s3c244x_restart, | ||
492 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c new file mode 100644 index 000000000000..d7ae49c90118 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c | |||
@@ -0,0 +1,226 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-at2440evb.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com> | ||
4 | * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk> | ||
5 | * and modifications by SBZ <sbz@spgui.org> and | ||
6 | * Weibing <http://weibing.blogbus.com> | ||
7 | * | ||
8 | * For product information, visit http://www.arm.com/ | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/serial_core.h> | ||
23 | #include <linux/dm9000.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <mach/fb.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | |||
35 | #include <plat/regs-serial.h> | ||
36 | #include <mach/regs-gpio.h> | ||
37 | #include <mach/regs-mem.h> | ||
38 | #include <mach/regs-lcd.h> | ||
39 | #include <plat/nand.h> | ||
40 | #include <plat/iic.h> | ||
41 | |||
42 | #include <linux/mtd/mtd.h> | ||
43 | #include <linux/mtd/nand.h> | ||
44 | #include <linux/mtd/nand_ecc.h> | ||
45 | #include <linux/mtd/partitions.h> | ||
46 | |||
47 | #include <plat/clock.h> | ||
48 | #include <plat/devs.h> | ||
49 | #include <plat/cpu.h> | ||
50 | #include <plat/mci.h> | ||
51 | |||
52 | #include "common.h" | ||
53 | |||
54 | static struct map_desc at2440evb_iodesc[] __initdata = { | ||
55 | /* Nothing here */ | ||
56 | }; | ||
57 | |||
58 | #define UCON S3C2410_UCON_DEFAULT | ||
59 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE) | ||
60 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) | ||
61 | |||
62 | static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = { | ||
63 | [0] = { | ||
64 | .hwport = 0, | ||
65 | .flags = 0, | ||
66 | .ucon = UCON, | ||
67 | .ulcon = ULCON, | ||
68 | .ufcon = UFCON, | ||
69 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
70 | }, | ||
71 | [1] = { | ||
72 | .hwport = 1, | ||
73 | .flags = 0, | ||
74 | .ucon = UCON, | ||
75 | .ulcon = ULCON, | ||
76 | .ufcon = UFCON, | ||
77 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | /* NAND Flash on AT2440EVB board */ | ||
82 | |||
83 | static struct mtd_partition __initdata at2440evb_default_nand_part[] = { | ||
84 | [0] = { | ||
85 | .name = "Boot Agent", | ||
86 | .size = SZ_256K, | ||
87 | .offset = 0, | ||
88 | }, | ||
89 | [1] = { | ||
90 | .name = "Kernel", | ||
91 | .size = SZ_2M, | ||
92 | .offset = SZ_256K, | ||
93 | }, | ||
94 | [2] = { | ||
95 | .name = "Root", | ||
96 | .offset = SZ_256K + SZ_2M, | ||
97 | .size = MTDPART_SIZ_FULL, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = { | ||
102 | [0] = { | ||
103 | .name = "nand", | ||
104 | .nr_chips = 1, | ||
105 | .nr_partitions = ARRAY_SIZE(at2440evb_default_nand_part), | ||
106 | .partitions = at2440evb_default_nand_part, | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | static struct s3c2410_platform_nand __initdata at2440evb_nand_info = { | ||
111 | .tacls = 25, | ||
112 | .twrph0 = 55, | ||
113 | .twrph1 = 40, | ||
114 | .nr_sets = ARRAY_SIZE(at2440evb_nand_sets), | ||
115 | .sets = at2440evb_nand_sets, | ||
116 | }; | ||
117 | |||
118 | /* DM9000AEP 10/100 ethernet controller */ | ||
119 | |||
120 | static struct resource at2440evb_dm9k_resource[] = { | ||
121 | [0] = { | ||
122 | .start = S3C2410_CS3, | ||
123 | .end = S3C2410_CS3 + 3, | ||
124 | .flags = IORESOURCE_MEM | ||
125 | }, | ||
126 | [1] = { | ||
127 | .start = S3C2410_CS3 + 4, | ||
128 | .end = S3C2410_CS3 + 7, | ||
129 | .flags = IORESOURCE_MEM | ||
130 | }, | ||
131 | [2] = { | ||
132 | .start = IRQ_EINT7, | ||
133 | .end = IRQ_EINT7, | ||
134 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
135 | } | ||
136 | }; | ||
137 | |||
138 | static struct dm9000_plat_data at2440evb_dm9k_pdata = { | ||
139 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), | ||
140 | }; | ||
141 | |||
142 | static struct platform_device at2440evb_device_eth = { | ||
143 | .name = "dm9000", | ||
144 | .id = -1, | ||
145 | .num_resources = ARRAY_SIZE(at2440evb_dm9k_resource), | ||
146 | .resource = at2440evb_dm9k_resource, | ||
147 | .dev = { | ||
148 | .platform_data = &at2440evb_dm9k_pdata, | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | static struct s3c24xx_mci_pdata at2440evb_mci_pdata __initdata = { | ||
153 | .gpio_detect = S3C2410_GPG(10), | ||
154 | }; | ||
155 | |||
156 | /* 7" LCD panel */ | ||
157 | |||
158 | static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = { | ||
159 | |||
160 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
161 | S3C2410_LCDCON5_INVVLINE | | ||
162 | S3C2410_LCDCON5_INVVFRAME | | ||
163 | S3C2410_LCDCON5_PWREN | | ||
164 | S3C2410_LCDCON5_HWSWP, | ||
165 | |||
166 | .type = S3C2410_LCDCON1_TFT, | ||
167 | |||
168 | .width = 800, | ||
169 | .height = 480, | ||
170 | |||
171 | .pixclock = 33333, /* HCLK 60 MHz, divisor 2 */ | ||
172 | .xres = 800, | ||
173 | .yres = 480, | ||
174 | .bpp = 16, | ||
175 | .left_margin = 88, | ||
176 | .right_margin = 40, | ||
177 | .hsync_len = 128, | ||
178 | .upper_margin = 32, | ||
179 | .lower_margin = 11, | ||
180 | .vsync_len = 2, | ||
181 | }; | ||
182 | |||
183 | static struct s3c2410fb_mach_info at2440evb_fb_info __initdata = { | ||
184 | .displays = &at2440evb_lcd_cfg, | ||
185 | .num_displays = 1, | ||
186 | .default_display = 0, | ||
187 | }; | ||
188 | |||
189 | static struct platform_device *at2440evb_devices[] __initdata = { | ||
190 | &s3c_device_ohci, | ||
191 | &s3c_device_wdt, | ||
192 | &s3c_device_adc, | ||
193 | &s3c_device_i2c0, | ||
194 | &s3c_device_rtc, | ||
195 | &s3c_device_nand, | ||
196 | &s3c_device_sdi, | ||
197 | &s3c_device_lcd, | ||
198 | &at2440evb_device_eth, | ||
199 | }; | ||
200 | |||
201 | static void __init at2440evb_map_io(void) | ||
202 | { | ||
203 | s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); | ||
204 | s3c24xx_init_clocks(16934400); | ||
205 | s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); | ||
206 | } | ||
207 | |||
208 | static void __init at2440evb_init(void) | ||
209 | { | ||
210 | s3c24xx_fb_set_platdata(&at2440evb_fb_info); | ||
211 | s3c24xx_mci_set_platdata(&at2440evb_mci_pdata); | ||
212 | s3c_nand_set_platdata(&at2440evb_nand_info); | ||
213 | s3c_i2c0_set_platdata(NULL); | ||
214 | |||
215 | platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices)); | ||
216 | } | ||
217 | |||
218 | |||
219 | MACHINE_START(AT2440EVB, "AT2440EVB") | ||
220 | .atag_offset = 0x100, | ||
221 | .map_io = at2440evb_map_io, | ||
222 | .init_machine = at2440evb_init, | ||
223 | .init_irq = s3c24xx_init_irq, | ||
224 | .timer = &s3c24xx_timer, | ||
225 | .restart = s3c244x_restart, | ||
226 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c new file mode 100644 index 000000000000..53219c02eca0 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-bast.c | |||
@@ -0,0 +1,644 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-bast.c | ||
2 | * | ||
3 | * Copyright 2003-2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.simtec.co.uk/products/EB2410ITX/ | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/syscore_ops.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/dm9000.h> | ||
24 | #include <linux/ata_platform.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/io.h> | ||
27 | |||
28 | #include <net/ax88796.h> | ||
29 | |||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/bast-map.h> | ||
35 | #include <mach/bast-irq.h> | ||
36 | #include <mach/bast-cpld.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | #include <asm/irq.h> | ||
40 | #include <asm/mach-types.h> | ||
41 | |||
42 | //#include <asm/debug-ll.h> | ||
43 | #include <plat/regs-serial.h> | ||
44 | #include <mach/regs-gpio.h> | ||
45 | #include <mach/regs-mem.h> | ||
46 | #include <mach/regs-lcd.h> | ||
47 | |||
48 | #include <plat/hwmon.h> | ||
49 | #include <plat/nand.h> | ||
50 | #include <plat/iic.h> | ||
51 | #include <mach/fb.h> | ||
52 | |||
53 | #include <linux/mtd/mtd.h> | ||
54 | #include <linux/mtd/nand.h> | ||
55 | #include <linux/mtd/nand_ecc.h> | ||
56 | #include <linux/mtd/partitions.h> | ||
57 | |||
58 | #include <linux/serial_8250.h> | ||
59 | |||
60 | #include <plat/clock.h> | ||
61 | #include <plat/devs.h> | ||
62 | #include <plat/cpu.h> | ||
63 | #include <plat/cpu-freq.h> | ||
64 | #include <plat/gpio-cfg.h> | ||
65 | #include <plat/audio-simtec.h> | ||
66 | |||
67 | #include "simtec.h" | ||
68 | #include "common.h" | ||
69 | |||
70 | #define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics" | ||
71 | |||
72 | /* macros for virtual address mods for the io space entries */ | ||
73 | #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) | ||
74 | #define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4) | ||
75 | #define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3) | ||
76 | #define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2) | ||
77 | |||
78 | /* macros to modify the physical addresses for io space */ | ||
79 | |||
80 | #define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2)) | ||
81 | #define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3)) | ||
82 | #define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4)) | ||
83 | #define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5)) | ||
84 | |||
85 | static struct map_desc bast_iodesc[] __initdata = { | ||
86 | /* ISA IO areas */ | ||
87 | { | ||
88 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
89 | .pfn = PA_CS2(BAST_PA_ISAIO), | ||
90 | .length = SZ_16M, | ||
91 | .type = MT_DEVICE, | ||
92 | }, { | ||
93 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
94 | .pfn = PA_CS3(BAST_PA_ISAIO), | ||
95 | .length = SZ_16M, | ||
96 | .type = MT_DEVICE, | ||
97 | }, | ||
98 | /* bast CPLD control registers, and external interrupt controls */ | ||
99 | { | ||
100 | .virtual = (u32)BAST_VA_CTRL1, | ||
101 | .pfn = __phys_to_pfn(BAST_PA_CTRL1), | ||
102 | .length = SZ_1M, | ||
103 | .type = MT_DEVICE, | ||
104 | }, { | ||
105 | .virtual = (u32)BAST_VA_CTRL2, | ||
106 | .pfn = __phys_to_pfn(BAST_PA_CTRL2), | ||
107 | .length = SZ_1M, | ||
108 | .type = MT_DEVICE, | ||
109 | }, { | ||
110 | .virtual = (u32)BAST_VA_CTRL3, | ||
111 | .pfn = __phys_to_pfn(BAST_PA_CTRL3), | ||
112 | .length = SZ_1M, | ||
113 | .type = MT_DEVICE, | ||
114 | }, { | ||
115 | .virtual = (u32)BAST_VA_CTRL4, | ||
116 | .pfn = __phys_to_pfn(BAST_PA_CTRL4), | ||
117 | .length = SZ_1M, | ||
118 | .type = MT_DEVICE, | ||
119 | }, | ||
120 | /* PC104 IRQ mux */ | ||
121 | { | ||
122 | .virtual = (u32)BAST_VA_PC104_IRQREQ, | ||
123 | .pfn = __phys_to_pfn(BAST_PA_PC104_IRQREQ), | ||
124 | .length = SZ_1M, | ||
125 | .type = MT_DEVICE, | ||
126 | }, { | ||
127 | .virtual = (u32)BAST_VA_PC104_IRQRAW, | ||
128 | .pfn = __phys_to_pfn(BAST_PA_PC104_IRQRAW), | ||
129 | .length = SZ_1M, | ||
130 | .type = MT_DEVICE, | ||
131 | }, { | ||
132 | .virtual = (u32)BAST_VA_PC104_IRQMASK, | ||
133 | .pfn = __phys_to_pfn(BAST_PA_PC104_IRQMASK), | ||
134 | .length = SZ_1M, | ||
135 | .type = MT_DEVICE, | ||
136 | }, | ||
137 | |||
138 | /* peripheral space... one for each of fast/slow/byte/16bit */ | ||
139 | /* note, ide is only decoded in word space, even though some registers | ||
140 | * are only 8bit */ | ||
141 | |||
142 | /* slow, byte */ | ||
143 | { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, | ||
144 | { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, | ||
145 | { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, | ||
146 | |||
147 | /* slow, word */ | ||
148 | { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, | ||
149 | { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, | ||
150 | { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, | ||
151 | |||
152 | /* fast, byte */ | ||
153 | { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, | ||
154 | { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, | ||
155 | { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, | ||
156 | |||
157 | /* fast, word */ | ||
158 | { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, | ||
159 | { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, | ||
160 | { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, | ||
161 | }; | ||
162 | |||
163 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
164 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
165 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
166 | |||
167 | static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = { | ||
168 | [0] = { | ||
169 | .hwport = 0, | ||
170 | .flags = 0, | ||
171 | .ucon = UCON, | ||
172 | .ulcon = ULCON, | ||
173 | .ufcon = UFCON, | ||
174 | }, | ||
175 | [1] = { | ||
176 | .hwport = 1, | ||
177 | .flags = 0, | ||
178 | .ucon = UCON, | ||
179 | .ulcon = ULCON, | ||
180 | .ufcon = UFCON, | ||
181 | }, | ||
182 | /* port 2 is not actually used */ | ||
183 | [2] = { | ||
184 | .hwport = 2, | ||
185 | .flags = 0, | ||
186 | .ucon = UCON, | ||
187 | .ulcon = ULCON, | ||
188 | .ufcon = UFCON, | ||
189 | } | ||
190 | }; | ||
191 | |||
192 | /* NAND Flash on BAST board */ | ||
193 | |||
194 | #ifdef CONFIG_PM | ||
195 | static int bast_pm_suspend(void) | ||
196 | { | ||
197 | /* ensure that an nRESET is not generated on resume. */ | ||
198 | gpio_direction_output(S3C2410_GPA(21), 1); | ||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static void bast_pm_resume(void) | ||
203 | { | ||
204 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); | ||
205 | } | ||
206 | |||
207 | #else | ||
208 | #define bast_pm_suspend NULL | ||
209 | #define bast_pm_resume NULL | ||
210 | #endif | ||
211 | |||
212 | static struct syscore_ops bast_pm_syscore_ops = { | ||
213 | .suspend = bast_pm_suspend, | ||
214 | .resume = bast_pm_resume, | ||
215 | }; | ||
216 | |||
217 | static int smartmedia_map[] = { 0 }; | ||
218 | static int chip0_map[] = { 1 }; | ||
219 | static int chip1_map[] = { 2 }; | ||
220 | static int chip2_map[] = { 3 }; | ||
221 | |||
222 | static struct mtd_partition __initdata bast_default_nand_part[] = { | ||
223 | [0] = { | ||
224 | .name = "Boot Agent", | ||
225 | .size = SZ_16K, | ||
226 | .offset = 0, | ||
227 | }, | ||
228 | [1] = { | ||
229 | .name = "/boot", | ||
230 | .size = SZ_4M - SZ_16K, | ||
231 | .offset = SZ_16K, | ||
232 | }, | ||
233 | [2] = { | ||
234 | .name = "user", | ||
235 | .offset = SZ_4M, | ||
236 | .size = MTDPART_SIZ_FULL, | ||
237 | } | ||
238 | }; | ||
239 | |||
240 | /* the bast has 4 selectable slots for nand-flash, the three | ||
241 | * on-board chip areas, as well as the external SmartMedia | ||
242 | * slot. | ||
243 | * | ||
244 | * Note, there is no current hot-plug support for the SmartMedia | ||
245 | * socket. | ||
246 | */ | ||
247 | |||
248 | static struct s3c2410_nand_set __initdata bast_nand_sets[] = { | ||
249 | [0] = { | ||
250 | .name = "SmartMedia", | ||
251 | .nr_chips = 1, | ||
252 | .nr_map = smartmedia_map, | ||
253 | .options = NAND_SCAN_SILENT_NODEV, | ||
254 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | ||
255 | .partitions = bast_default_nand_part, | ||
256 | }, | ||
257 | [1] = { | ||
258 | .name = "chip0", | ||
259 | .nr_chips = 1, | ||
260 | .nr_map = chip0_map, | ||
261 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | ||
262 | .partitions = bast_default_nand_part, | ||
263 | }, | ||
264 | [2] = { | ||
265 | .name = "chip1", | ||
266 | .nr_chips = 1, | ||
267 | .nr_map = chip1_map, | ||
268 | .options = NAND_SCAN_SILENT_NODEV, | ||
269 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | ||
270 | .partitions = bast_default_nand_part, | ||
271 | }, | ||
272 | [3] = { | ||
273 | .name = "chip2", | ||
274 | .nr_chips = 1, | ||
275 | .nr_map = chip2_map, | ||
276 | .options = NAND_SCAN_SILENT_NODEV, | ||
277 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | ||
278 | .partitions = bast_default_nand_part, | ||
279 | } | ||
280 | }; | ||
281 | |||
282 | static void bast_nand_select(struct s3c2410_nand_set *set, int slot) | ||
283 | { | ||
284 | unsigned int tmp; | ||
285 | |||
286 | slot = set->nr_map[slot] & 3; | ||
287 | |||
288 | pr_debug("bast_nand: selecting slot %d (set %p,%p)\n", | ||
289 | slot, set, set->nr_map); | ||
290 | |||
291 | tmp = __raw_readb(BAST_VA_CTRL2); | ||
292 | tmp &= BAST_CPLD_CTLR2_IDERST; | ||
293 | tmp |= slot; | ||
294 | tmp |= BAST_CPLD_CTRL2_WNAND; | ||
295 | |||
296 | pr_debug("bast_nand: ctrl2 now %02x\n", tmp); | ||
297 | |||
298 | __raw_writeb(tmp, BAST_VA_CTRL2); | ||
299 | } | ||
300 | |||
301 | static struct s3c2410_platform_nand __initdata bast_nand_info = { | ||
302 | .tacls = 30, | ||
303 | .twrph0 = 60, | ||
304 | .twrph1 = 60, | ||
305 | .nr_sets = ARRAY_SIZE(bast_nand_sets), | ||
306 | .sets = bast_nand_sets, | ||
307 | .select_chip = bast_nand_select, | ||
308 | }; | ||
309 | |||
310 | /* DM9000 */ | ||
311 | |||
312 | static struct resource bast_dm9k_resource[] = { | ||
313 | [0] = { | ||
314 | .start = S3C2410_CS5 + BAST_PA_DM9000, | ||
315 | .end = S3C2410_CS5 + BAST_PA_DM9000 + 3, | ||
316 | .flags = IORESOURCE_MEM, | ||
317 | }, | ||
318 | [1] = { | ||
319 | .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40, | ||
320 | .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f, | ||
321 | .flags = IORESOURCE_MEM, | ||
322 | }, | ||
323 | [2] = { | ||
324 | .start = IRQ_DM9000, | ||
325 | .end = IRQ_DM9000, | ||
326 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | ||
327 | } | ||
328 | |||
329 | }; | ||
330 | |||
331 | /* for the moment we limit ourselves to 16bit IO until some | ||
332 | * better IO routines can be written and tested | ||
333 | */ | ||
334 | |||
335 | static struct dm9000_plat_data bast_dm9k_platdata = { | ||
336 | .flags = DM9000_PLATF_16BITONLY, | ||
337 | }; | ||
338 | |||
339 | static struct platform_device bast_device_dm9k = { | ||
340 | .name = "dm9000", | ||
341 | .id = 0, | ||
342 | .num_resources = ARRAY_SIZE(bast_dm9k_resource), | ||
343 | .resource = bast_dm9k_resource, | ||
344 | .dev = { | ||
345 | .platform_data = &bast_dm9k_platdata, | ||
346 | } | ||
347 | }; | ||
348 | |||
349 | /* serial devices */ | ||
350 | |||
351 | #define SERIAL_BASE (S3C2410_CS2 + BAST_PA_SUPERIO) | ||
352 | #define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ) | ||
353 | #define SERIAL_CLK (1843200) | ||
354 | |||
355 | static struct plat_serial8250_port bast_sio_data[] = { | ||
356 | [0] = { | ||
357 | .mapbase = SERIAL_BASE + 0x2f8, | ||
358 | .irq = IRQ_PCSERIAL1, | ||
359 | .flags = SERIAL_FLAGS, | ||
360 | .iotype = UPIO_MEM, | ||
361 | .regshift = 0, | ||
362 | .uartclk = SERIAL_CLK, | ||
363 | }, | ||
364 | [1] = { | ||
365 | .mapbase = SERIAL_BASE + 0x3f8, | ||
366 | .irq = IRQ_PCSERIAL2, | ||
367 | .flags = SERIAL_FLAGS, | ||
368 | .iotype = UPIO_MEM, | ||
369 | .regshift = 0, | ||
370 | .uartclk = SERIAL_CLK, | ||
371 | }, | ||
372 | { } | ||
373 | }; | ||
374 | |||
375 | static struct platform_device bast_sio = { | ||
376 | .name = "serial8250", | ||
377 | .id = PLAT8250_DEV_PLATFORM, | ||
378 | .dev = { | ||
379 | .platform_data = &bast_sio_data, | ||
380 | }, | ||
381 | }; | ||
382 | |||
383 | /* we have devices on the bus which cannot work much over the | ||
384 | * standard 100KHz i2c bus frequency | ||
385 | */ | ||
386 | |||
387 | static struct s3c2410_platform_i2c __initdata bast_i2c_info = { | ||
388 | .flags = 0, | ||
389 | .slave_addr = 0x10, | ||
390 | .frequency = 100*1000, | ||
391 | }; | ||
392 | |||
393 | /* Asix AX88796 10/100 ethernet controller */ | ||
394 | |||
395 | static struct ax_plat_data bast_asix_platdata = { | ||
396 | .flags = AXFLG_MAC_FROMDEV, | ||
397 | .wordlength = 2, | ||
398 | .dcr_val = 0x48, | ||
399 | .rcr_val = 0x40, | ||
400 | }; | ||
401 | |||
402 | static struct resource bast_asix_resource[] = { | ||
403 | [0] = { | ||
404 | .start = S3C2410_CS5 + BAST_PA_ASIXNET, | ||
405 | .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20) - 1, | ||
406 | .flags = IORESOURCE_MEM, | ||
407 | }, | ||
408 | [1] = { | ||
409 | .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), | ||
410 | .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), | ||
411 | .flags = IORESOURCE_MEM, | ||
412 | }, | ||
413 | [2] = { | ||
414 | .start = IRQ_ASIX, | ||
415 | .end = IRQ_ASIX, | ||
416 | .flags = IORESOURCE_IRQ | ||
417 | } | ||
418 | }; | ||
419 | |||
420 | static struct platform_device bast_device_asix = { | ||
421 | .name = "ax88796", | ||
422 | .id = 0, | ||
423 | .num_resources = ARRAY_SIZE(bast_asix_resource), | ||
424 | .resource = bast_asix_resource, | ||
425 | .dev = { | ||
426 | .platform_data = &bast_asix_platdata | ||
427 | } | ||
428 | }; | ||
429 | |||
430 | /* Asix AX88796 10/100 ethernet controller parallel port */ | ||
431 | |||
432 | static struct resource bast_asixpp_resource[] = { | ||
433 | [0] = { | ||
434 | .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), | ||
435 | .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1b * 0x20) - 1, | ||
436 | .flags = IORESOURCE_MEM, | ||
437 | } | ||
438 | }; | ||
439 | |||
440 | static struct platform_device bast_device_axpp = { | ||
441 | .name = "ax88796-pp", | ||
442 | .id = 0, | ||
443 | .num_resources = ARRAY_SIZE(bast_asixpp_resource), | ||
444 | .resource = bast_asixpp_resource, | ||
445 | }; | ||
446 | |||
447 | /* LCD/VGA controller */ | ||
448 | |||
449 | static struct s3c2410fb_display __initdata bast_lcd_info[] = { | ||
450 | { | ||
451 | .type = S3C2410_LCDCON1_TFT, | ||
452 | .width = 640, | ||
453 | .height = 480, | ||
454 | |||
455 | .pixclock = 33333, | ||
456 | .xres = 640, | ||
457 | .yres = 480, | ||
458 | .bpp = 4, | ||
459 | .left_margin = 40, | ||
460 | .right_margin = 20, | ||
461 | .hsync_len = 88, | ||
462 | .upper_margin = 30, | ||
463 | .lower_margin = 32, | ||
464 | .vsync_len = 3, | ||
465 | |||
466 | .lcdcon5 = 0x00014b02, | ||
467 | }, | ||
468 | { | ||
469 | .type = S3C2410_LCDCON1_TFT, | ||
470 | .width = 640, | ||
471 | .height = 480, | ||
472 | |||
473 | .pixclock = 33333, | ||
474 | .xres = 640, | ||
475 | .yres = 480, | ||
476 | .bpp = 8, | ||
477 | .left_margin = 40, | ||
478 | .right_margin = 20, | ||
479 | .hsync_len = 88, | ||
480 | .upper_margin = 30, | ||
481 | .lower_margin = 32, | ||
482 | .vsync_len = 3, | ||
483 | |||
484 | .lcdcon5 = 0x00014b02, | ||
485 | }, | ||
486 | { | ||
487 | .type = S3C2410_LCDCON1_TFT, | ||
488 | .width = 640, | ||
489 | .height = 480, | ||
490 | |||
491 | .pixclock = 33333, | ||
492 | .xres = 640, | ||
493 | .yres = 480, | ||
494 | .bpp = 16, | ||
495 | .left_margin = 40, | ||
496 | .right_margin = 20, | ||
497 | .hsync_len = 88, | ||
498 | .upper_margin = 30, | ||
499 | .lower_margin = 32, | ||
500 | .vsync_len = 3, | ||
501 | |||
502 | .lcdcon5 = 0x00014b02, | ||
503 | }, | ||
504 | }; | ||
505 | |||
506 | /* LCD/VGA controller */ | ||
507 | |||
508 | static struct s3c2410fb_mach_info __initdata bast_fb_info = { | ||
509 | |||
510 | .displays = bast_lcd_info, | ||
511 | .num_displays = ARRAY_SIZE(bast_lcd_info), | ||
512 | .default_display = 1, | ||
513 | }; | ||
514 | |||
515 | /* I2C devices fitted. */ | ||
516 | |||
517 | static struct i2c_board_info bast_i2c_devs[] __initdata = { | ||
518 | { | ||
519 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
520 | }, { | ||
521 | I2C_BOARD_INFO("simtec-pmu", 0x6b), | ||
522 | }, { | ||
523 | I2C_BOARD_INFO("ch7013", 0x75), | ||
524 | }, | ||
525 | }; | ||
526 | |||
527 | static struct s3c_hwmon_pdata bast_hwmon_info = { | ||
528 | /* LCD contrast (0-6.6V) */ | ||
529 | .in[0] = &(struct s3c_hwmon_chcfg) { | ||
530 | .name = "lcd-contrast", | ||
531 | .mult = 3300, | ||
532 | .div = 512, | ||
533 | }, | ||
534 | /* LED current feedback */ | ||
535 | .in[1] = &(struct s3c_hwmon_chcfg) { | ||
536 | .name = "led-feedback", | ||
537 | .mult = 3300, | ||
538 | .div = 1024, | ||
539 | }, | ||
540 | /* LCD feedback (0-6.6V) */ | ||
541 | .in[2] = &(struct s3c_hwmon_chcfg) { | ||
542 | .name = "lcd-feedback", | ||
543 | .mult = 3300, | ||
544 | .div = 512, | ||
545 | }, | ||
546 | /* Vcore (1.8-2.0V), Vref 3.3V */ | ||
547 | .in[3] = &(struct s3c_hwmon_chcfg) { | ||
548 | .name = "vcore", | ||
549 | .mult = 3300, | ||
550 | .div = 1024, | ||
551 | }, | ||
552 | }; | ||
553 | |||
554 | /* Standard BAST devices */ | ||
555 | // cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0 | ||
556 | |||
557 | static struct platform_device *bast_devices[] __initdata = { | ||
558 | &s3c_device_ohci, | ||
559 | &s3c_device_lcd, | ||
560 | &s3c_device_wdt, | ||
561 | &s3c_device_i2c0, | ||
562 | &s3c_device_rtc, | ||
563 | &s3c_device_nand, | ||
564 | &s3c_device_adc, | ||
565 | &s3c_device_hwmon, | ||
566 | &bast_device_dm9k, | ||
567 | &bast_device_asix, | ||
568 | &bast_device_axpp, | ||
569 | &bast_sio, | ||
570 | }; | ||
571 | |||
572 | static struct clk *bast_clocks[] __initdata = { | ||
573 | &s3c24xx_dclk0, | ||
574 | &s3c24xx_dclk1, | ||
575 | &s3c24xx_clkout0, | ||
576 | &s3c24xx_clkout1, | ||
577 | &s3c24xx_uclk, | ||
578 | }; | ||
579 | |||
580 | static struct s3c_cpufreq_board __initdata bast_cpufreq = { | ||
581 | .refresh = 7800, /* 7.8usec */ | ||
582 | .auto_io = 1, | ||
583 | .need_io = 1, | ||
584 | }; | ||
585 | |||
586 | static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = { | ||
587 | .have_mic = 1, | ||
588 | .have_lout = 1, | ||
589 | }; | ||
590 | |||
591 | static void __init bast_map_io(void) | ||
592 | { | ||
593 | /* initialise the clocks */ | ||
594 | |||
595 | s3c24xx_dclk0.parent = &clk_upll; | ||
596 | s3c24xx_dclk0.rate = 12*1000*1000; | ||
597 | |||
598 | s3c24xx_dclk1.parent = &clk_upll; | ||
599 | s3c24xx_dclk1.rate = 24*1000*1000; | ||
600 | |||
601 | s3c24xx_clkout0.parent = &s3c24xx_dclk0; | ||
602 | s3c24xx_clkout1.parent = &s3c24xx_dclk1; | ||
603 | |||
604 | s3c24xx_uclk.parent = &s3c24xx_clkout1; | ||
605 | |||
606 | s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); | ||
607 | |||
608 | s3c_hwmon_set_platdata(&bast_hwmon_info); | ||
609 | |||
610 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); | ||
611 | s3c24xx_init_clocks(0); | ||
612 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); | ||
613 | } | ||
614 | |||
615 | static void __init bast_init(void) | ||
616 | { | ||
617 | register_syscore_ops(&bast_pm_syscore_ops); | ||
618 | |||
619 | s3c_i2c0_set_platdata(&bast_i2c_info); | ||
620 | s3c_nand_set_platdata(&bast_nand_info); | ||
621 | s3c24xx_fb_set_platdata(&bast_fb_info); | ||
622 | platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); | ||
623 | |||
624 | i2c_register_board_info(0, bast_i2c_devs, | ||
625 | ARRAY_SIZE(bast_i2c_devs)); | ||
626 | |||
627 | usb_simtec_init(); | ||
628 | nor_simtec_init(); | ||
629 | simtec_audio_add(NULL, true, &bast_audio); | ||
630 | |||
631 | WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset")); | ||
632 | |||
633 | s3c_cpufreq_setboard(&bast_cpufreq); | ||
634 | } | ||
635 | |||
636 | MACHINE_START(BAST, "Simtec-BAST") | ||
637 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | ||
638 | .atag_offset = 0x100, | ||
639 | .map_io = bast_map_io, | ||
640 | .init_irq = s3c24xx_init_irq, | ||
641 | .init_machine = bast_init, | ||
642 | .timer = &s3c24xx_timer, | ||
643 | .restart = s3c2410_restart, | ||
644 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c new file mode 100644 index 000000000000..ba5d85394105 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-gta02.c | |||
@@ -0,0 +1,605 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-s3c2442/mach-gta02.c | ||
3 | * | ||
4 | * S3C2442 Machine Support for Openmoko GTA02 / FreeRunner. | ||
5 | * | ||
6 | * Copyright (C) 2006-2009 by Openmoko, Inc. | ||
7 | * Authors: Harald Welte <laforge@openmoko.org> | ||
8 | * Andy Green <andy@openmoko.org> | ||
9 | * Werner Almesberger <werner@openmoko.org> | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License as | ||
14 | * published by the Free Software Foundation; either version 2 of | ||
15 | * the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
25 | * MA 02111-1307 USA | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/list.h> | ||
33 | #include <linux/delay.h> | ||
34 | #include <linux/timer.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/gpio.h> | ||
37 | #include <linux/workqueue.h> | ||
38 | #include <linux/platform_device.h> | ||
39 | #include <linux/serial_core.h> | ||
40 | #include <linux/spi/spi.h> | ||
41 | #include <linux/spi/s3c24xx.h> | ||
42 | |||
43 | #include <linux/mmc/host.h> | ||
44 | |||
45 | #include <linux/mtd/mtd.h> | ||
46 | #include <linux/mtd/nand.h> | ||
47 | #include <linux/mtd/nand_ecc.h> | ||
48 | #include <linux/mtd/partitions.h> | ||
49 | #include <linux/mtd/physmap.h> | ||
50 | #include <linux/io.h> | ||
51 | |||
52 | #include <linux/i2c.h> | ||
53 | #include <linux/regulator/machine.h> | ||
54 | |||
55 | #include <linux/mfd/pcf50633/core.h> | ||
56 | #include <linux/mfd/pcf50633/mbc.h> | ||
57 | #include <linux/mfd/pcf50633/adc.h> | ||
58 | #include <linux/mfd/pcf50633/gpio.h> | ||
59 | #include <linux/mfd/pcf50633/pmic.h> | ||
60 | #include <linux/mfd/pcf50633/backlight.h> | ||
61 | |||
62 | #include <linux/input.h> | ||
63 | #include <linux/gpio_keys.h> | ||
64 | |||
65 | #include <asm/mach/arch.h> | ||
66 | #include <asm/mach/map.h> | ||
67 | #include <asm/mach/irq.h> | ||
68 | |||
69 | #include <asm/irq.h> | ||
70 | #include <asm/mach-types.h> | ||
71 | |||
72 | #include <mach/regs-irq.h> | ||
73 | #include <mach/regs-gpio.h> | ||
74 | #include <mach/regs-gpioj.h> | ||
75 | #include <mach/fb.h> | ||
76 | |||
77 | #include <plat/usb-control.h> | ||
78 | #include <mach/regs-mem.h> | ||
79 | #include <mach/hardware.h> | ||
80 | |||
81 | #include <mach/gta02.h> | ||
82 | |||
83 | #include <plat/regs-serial.h> | ||
84 | #include <plat/nand.h> | ||
85 | #include <plat/devs.h> | ||
86 | #include <plat/cpu.h> | ||
87 | #include <plat/pm.h> | ||
88 | #include <plat/udc.h> | ||
89 | #include <plat/gpio-cfg.h> | ||
90 | #include <plat/iic.h> | ||
91 | #include <plat/ts.h> | ||
92 | |||
93 | #include "common.h" | ||
94 | |||
95 | static struct pcf50633 *gta02_pcf; | ||
96 | |||
97 | /* | ||
98 | * This gets called frequently when we paniced. | ||
99 | */ | ||
100 | |||
101 | static long gta02_panic_blink(int state) | ||
102 | { | ||
103 | long delay = 0; | ||
104 | char led; | ||
105 | |||
106 | led = (state) ? 1 : 0; | ||
107 | gpio_direction_output(GTA02_GPIO_AUX_LED, led); | ||
108 | |||
109 | return delay; | ||
110 | } | ||
111 | |||
112 | |||
113 | static struct map_desc gta02_iodesc[] __initdata = { | ||
114 | { | ||
115 | .virtual = 0xe0000000, | ||
116 | .pfn = __phys_to_pfn(S3C2410_CS3 + 0x01000000), | ||
117 | .length = SZ_1M, | ||
118 | .type = MT_DEVICE | ||
119 | }, | ||
120 | }; | ||
121 | |||
122 | #define UCON (S3C2410_UCON_DEFAULT | S3C2443_UCON_RXERR_IRQEN) | ||
123 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) | ||
124 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) | ||
125 | |||
126 | static struct s3c2410_uartcfg gta02_uartcfgs[] = { | ||
127 | [0] = { | ||
128 | .hwport = 0, | ||
129 | .flags = 0, | ||
130 | .ucon = UCON, | ||
131 | .ulcon = ULCON, | ||
132 | .ufcon = UFCON, | ||
133 | }, | ||
134 | [1] = { | ||
135 | .hwport = 1, | ||
136 | .flags = 0, | ||
137 | .ucon = UCON, | ||
138 | .ulcon = ULCON, | ||
139 | .ufcon = UFCON, | ||
140 | }, | ||
141 | [2] = { | ||
142 | .hwport = 2, | ||
143 | .flags = 0, | ||
144 | .ucon = UCON, | ||
145 | .ulcon = ULCON, | ||
146 | .ufcon = UFCON, | ||
147 | }, | ||
148 | }; | ||
149 | |||
150 | #ifdef CONFIG_CHARGER_PCF50633 | ||
151 | /* | ||
152 | * On GTA02 the 1A charger features a 48K resistor to 0V on the ID pin. | ||
153 | * We use this to recognize that we can pull 1A from the USB socket. | ||
154 | * | ||
155 | * These constants are the measured pcf50633 ADC levels with the 1A | ||
156 | * charger / 48K resistor, and with no pulldown resistor. | ||
157 | */ | ||
158 | |||
159 | #define ADC_NOM_CHG_DETECT_1A 6 | ||
160 | #define ADC_NOM_CHG_DETECT_USB 43 | ||
161 | |||
162 | static void | ||
163 | gta02_configure_pmu_for_charger(struct pcf50633 *pcf, void *unused, int res) | ||
164 | { | ||
165 | int ma; | ||
166 | |||
167 | /* Interpret charger type */ | ||
168 | if (res < ((ADC_NOM_CHG_DETECT_USB + ADC_NOM_CHG_DETECT_1A) / 2)) { | ||
169 | |||
170 | /* | ||
171 | * Sanity - stop GPO driving out now that we have a 1A charger | ||
172 | * GPO controls USB Host power generation on GTA02 | ||
173 | */ | ||
174 | pcf50633_gpio_set(pcf, PCF50633_GPO, 0); | ||
175 | |||
176 | ma = 1000; | ||
177 | } else | ||
178 | ma = 100; | ||
179 | |||
180 | pcf50633_mbc_usb_curlim_set(pcf, ma); | ||
181 | } | ||
182 | |||
183 | static struct delayed_work gta02_charger_work; | ||
184 | static int gta02_usb_vbus_draw; | ||
185 | |||
186 | static void gta02_charger_worker(struct work_struct *work) | ||
187 | { | ||
188 | if (gta02_usb_vbus_draw) { | ||
189 | pcf50633_mbc_usb_curlim_set(gta02_pcf, gta02_usb_vbus_draw); | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | #ifdef CONFIG_PCF50633_ADC | ||
194 | pcf50633_adc_async_read(gta02_pcf, | ||
195 | PCF50633_ADCC1_MUX_ADCIN1, | ||
196 | PCF50633_ADCC1_AVERAGE_16, | ||
197 | gta02_configure_pmu_for_charger, | ||
198 | NULL); | ||
199 | #else | ||
200 | /* | ||
201 | * If the PCF50633 ADC is disabled we fallback to a | ||
202 | * 100mA limit for safety. | ||
203 | */ | ||
204 | pcf50633_mbc_usb_curlim_set(pcf, 100); | ||
205 | #endif | ||
206 | } | ||
207 | |||
208 | #define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000) | ||
209 | |||
210 | static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq) | ||
211 | { | ||
212 | if (irq == PCF50633_IRQ_USBINS) { | ||
213 | schedule_delayed_work(>a02_charger_work, | ||
214 | GTA02_CHARGER_CONFIGURE_TIMEOUT); | ||
215 | |||
216 | return; | ||
217 | } | ||
218 | |||
219 | if (irq == PCF50633_IRQ_USBREM) { | ||
220 | cancel_delayed_work_sync(>a02_charger_work); | ||
221 | gta02_usb_vbus_draw = 0; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static void gta02_udc_vbus_draw(unsigned int ma) | ||
226 | { | ||
227 | if (!gta02_pcf) | ||
228 | return; | ||
229 | |||
230 | gta02_usb_vbus_draw = ma; | ||
231 | |||
232 | schedule_delayed_work(>a02_charger_work, | ||
233 | GTA02_CHARGER_CONFIGURE_TIMEOUT); | ||
234 | } | ||
235 | #else /* !CONFIG_CHARGER_PCF50633 */ | ||
236 | #define gta02_pmu_event_callback NULL | ||
237 | #define gta02_udc_vbus_draw NULL | ||
238 | #endif | ||
239 | |||
240 | /* | ||
241 | * This is called when pc50633 is probed, unfortunately quite late in the | ||
242 | * day since it is an I2C bus device. Here we can belatedly define some | ||
243 | * platform devices with the advantage that we can mark the pcf50633 as the | ||
244 | * parent. This makes them get suspended and resumed with their parent | ||
245 | * the pcf50633 still around. | ||
246 | */ | ||
247 | |||
248 | static void gta02_pmu_attach_child_devices(struct pcf50633 *pcf); | ||
249 | |||
250 | |||
251 | static char *gta02_batteries[] = { | ||
252 | "battery", | ||
253 | }; | ||
254 | |||
255 | static struct pcf50633_bl_platform_data gta02_backlight_data = { | ||
256 | .default_brightness = 0x3f, | ||
257 | .default_brightness_limit = 0, | ||
258 | .ramp_time = 5, | ||
259 | }; | ||
260 | |||
261 | static struct pcf50633_platform_data gta02_pcf_pdata = { | ||
262 | .resumers = { | ||
263 | [0] = PCF50633_INT1_USBINS | | ||
264 | PCF50633_INT1_USBREM | | ||
265 | PCF50633_INT1_ALARM, | ||
266 | [1] = PCF50633_INT2_ONKEYF, | ||
267 | [2] = PCF50633_INT3_ONKEY1S, | ||
268 | [3] = PCF50633_INT4_LOWSYS | | ||
269 | PCF50633_INT4_LOWBAT | | ||
270 | PCF50633_INT4_HIGHTMP, | ||
271 | }, | ||
272 | |||
273 | .batteries = gta02_batteries, | ||
274 | .num_batteries = ARRAY_SIZE(gta02_batteries), | ||
275 | |||
276 | .charger_reference_current_ma = 1000, | ||
277 | |||
278 | .backlight_data = >a02_backlight_data, | ||
279 | |||
280 | .reg_init_data = { | ||
281 | [PCF50633_REGULATOR_AUTO] = { | ||
282 | .constraints = { | ||
283 | .min_uV = 3300000, | ||
284 | .max_uV = 3300000, | ||
285 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
286 | .always_on = 1, | ||
287 | .apply_uV = 1, | ||
288 | }, | ||
289 | }, | ||
290 | [PCF50633_REGULATOR_DOWN1] = { | ||
291 | .constraints = { | ||
292 | .min_uV = 1300000, | ||
293 | .max_uV = 1600000, | ||
294 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
295 | .always_on = 1, | ||
296 | .apply_uV = 1, | ||
297 | }, | ||
298 | }, | ||
299 | [PCF50633_REGULATOR_DOWN2] = { | ||
300 | .constraints = { | ||
301 | .min_uV = 1800000, | ||
302 | .max_uV = 1800000, | ||
303 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
304 | .apply_uV = 1, | ||
305 | .always_on = 1, | ||
306 | }, | ||
307 | }, | ||
308 | [PCF50633_REGULATOR_HCLDO] = { | ||
309 | .constraints = { | ||
310 | .min_uV = 2000000, | ||
311 | .max_uV = 3300000, | ||
312 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
313 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
314 | REGULATOR_CHANGE_STATUS, | ||
315 | }, | ||
316 | }, | ||
317 | [PCF50633_REGULATOR_LDO1] = { | ||
318 | .constraints = { | ||
319 | .min_uV = 3300000, | ||
320 | .max_uV = 3300000, | ||
321 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
322 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
323 | .apply_uV = 1, | ||
324 | }, | ||
325 | }, | ||
326 | [PCF50633_REGULATOR_LDO2] = { | ||
327 | .constraints = { | ||
328 | .min_uV = 3300000, | ||
329 | .max_uV = 3300000, | ||
330 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
331 | .apply_uV = 1, | ||
332 | }, | ||
333 | }, | ||
334 | [PCF50633_REGULATOR_LDO3] = { | ||
335 | .constraints = { | ||
336 | .min_uV = 3000000, | ||
337 | .max_uV = 3000000, | ||
338 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
339 | .apply_uV = 1, | ||
340 | }, | ||
341 | }, | ||
342 | [PCF50633_REGULATOR_LDO4] = { | ||
343 | .constraints = { | ||
344 | .min_uV = 3200000, | ||
345 | .max_uV = 3200000, | ||
346 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
347 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
348 | .apply_uV = 1, | ||
349 | }, | ||
350 | }, | ||
351 | [PCF50633_REGULATOR_LDO5] = { | ||
352 | .constraints = { | ||
353 | .min_uV = 3000000, | ||
354 | .max_uV = 3000000, | ||
355 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
356 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
357 | .apply_uV = 1, | ||
358 | }, | ||
359 | }, | ||
360 | [PCF50633_REGULATOR_LDO6] = { | ||
361 | .constraints = { | ||
362 | .min_uV = 3000000, | ||
363 | .max_uV = 3000000, | ||
364 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
365 | }, | ||
366 | }, | ||
367 | [PCF50633_REGULATOR_MEMLDO] = { | ||
368 | .constraints = { | ||
369 | .min_uV = 1800000, | ||
370 | .max_uV = 1800000, | ||
371 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
372 | }, | ||
373 | }, | ||
374 | |||
375 | }, | ||
376 | .probe_done = gta02_pmu_attach_child_devices, | ||
377 | .mbc_event_callback = gta02_pmu_event_callback, | ||
378 | }; | ||
379 | |||
380 | |||
381 | /* NOR Flash. */ | ||
382 | |||
383 | #define GTA02_FLASH_BASE 0x18000000 /* GCS3 */ | ||
384 | #define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */ | ||
385 | |||
386 | static struct physmap_flash_data gta02_nor_flash_data = { | ||
387 | .width = 2, | ||
388 | }; | ||
389 | |||
390 | static struct resource gta02_nor_flash_resource = { | ||
391 | .start = GTA02_FLASH_BASE, | ||
392 | .end = GTA02_FLASH_BASE + GTA02_FLASH_SIZE - 1, | ||
393 | .flags = IORESOURCE_MEM, | ||
394 | }; | ||
395 | |||
396 | static struct platform_device gta02_nor_flash = { | ||
397 | .name = "physmap-flash", | ||
398 | .id = 0, | ||
399 | .dev = { | ||
400 | .platform_data = >a02_nor_flash_data, | ||
401 | }, | ||
402 | .resource = >a02_nor_flash_resource, | ||
403 | .num_resources = 1, | ||
404 | }; | ||
405 | |||
406 | |||
407 | static struct platform_device s3c24xx_pwm_device = { | ||
408 | .name = "s3c24xx_pwm", | ||
409 | .num_resources = 0, | ||
410 | }; | ||
411 | |||
412 | static struct platform_device gta02_dfbmcs320_device = { | ||
413 | .name = "dfbmcs320", | ||
414 | }; | ||
415 | |||
416 | static struct i2c_board_info gta02_i2c_devs[] __initdata = { | ||
417 | { | ||
418 | I2C_BOARD_INFO("pcf50633", 0x73), | ||
419 | .irq = GTA02_IRQ_PCF50633, | ||
420 | .platform_data = >a02_pcf_pdata, | ||
421 | }, | ||
422 | { | ||
423 | I2C_BOARD_INFO("wm8753", 0x1a), | ||
424 | }, | ||
425 | }; | ||
426 | |||
427 | static struct s3c2410_nand_set __initdata gta02_nand_sets[] = { | ||
428 | [0] = { | ||
429 | /* | ||
430 | * This name is also hard-coded in the boot loaders, so | ||
431 | * changing it would would require all users to upgrade | ||
432 | * their boot loaders, some of which are stored in a NOR | ||
433 | * that is considered to be immutable. | ||
434 | */ | ||
435 | .name = "neo1973-nand", | ||
436 | .nr_chips = 1, | ||
437 | .flash_bbt = 1, | ||
438 | }, | ||
439 | }; | ||
440 | |||
441 | /* | ||
442 | * Choose a set of timings derived from S3C@2442B MCP54 | ||
443 | * data sheet (K5D2G13ACM-D075 MCP Memory). | ||
444 | */ | ||
445 | |||
446 | static struct s3c2410_platform_nand __initdata gta02_nand_info = { | ||
447 | .tacls = 0, | ||
448 | .twrph0 = 25, | ||
449 | .twrph1 = 15, | ||
450 | .nr_sets = ARRAY_SIZE(gta02_nand_sets), | ||
451 | .sets = gta02_nand_sets, | ||
452 | }; | ||
453 | |||
454 | |||
455 | /* Get PMU to set USB current limit accordingly. */ | ||
456 | static struct s3c2410_udc_mach_info gta02_udc_cfg __initdata = { | ||
457 | .vbus_draw = gta02_udc_vbus_draw, | ||
458 | .pullup_pin = GTA02_GPIO_USB_PULLUP, | ||
459 | }; | ||
460 | |||
461 | /* USB */ | ||
462 | static struct s3c2410_hcd_info gta02_usb_info __initdata = { | ||
463 | .port[0] = { | ||
464 | .flags = S3C_HCDFLG_USED, | ||
465 | }, | ||
466 | .port[1] = { | ||
467 | .flags = 0, | ||
468 | }, | ||
469 | }; | ||
470 | |||
471 | /* Touchscreen */ | ||
472 | static struct s3c2410_ts_mach_info gta02_ts_info = { | ||
473 | .delay = 10000, | ||
474 | .presc = 0xff, /* slow as we can go */ | ||
475 | .oversampling_shift = 2, | ||
476 | }; | ||
477 | |||
478 | /* Buttons */ | ||
479 | static struct gpio_keys_button gta02_buttons[] = { | ||
480 | { | ||
481 | .gpio = GTA02_GPIO_AUX_KEY, | ||
482 | .code = KEY_PHONE, | ||
483 | .desc = "Aux", | ||
484 | .type = EV_KEY, | ||
485 | .debounce_interval = 100, | ||
486 | }, | ||
487 | { | ||
488 | .gpio = GTA02_GPIO_HOLD_KEY, | ||
489 | .code = KEY_PAUSE, | ||
490 | .desc = "Hold", | ||
491 | .type = EV_KEY, | ||
492 | .debounce_interval = 100, | ||
493 | }, | ||
494 | }; | ||
495 | |||
496 | static struct gpio_keys_platform_data gta02_buttons_pdata = { | ||
497 | .buttons = gta02_buttons, | ||
498 | .nbuttons = ARRAY_SIZE(gta02_buttons), | ||
499 | }; | ||
500 | |||
501 | static struct platform_device gta02_buttons_device = { | ||
502 | .name = "gpio-keys", | ||
503 | .id = -1, | ||
504 | .dev = { | ||
505 | .platform_data = >a02_buttons_pdata, | ||
506 | }, | ||
507 | }; | ||
508 | |||
509 | static void __init gta02_map_io(void) | ||
510 | { | ||
511 | s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); | ||
512 | s3c24xx_init_clocks(12000000); | ||
513 | s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); | ||
514 | } | ||
515 | |||
516 | |||
517 | /* These are the guys that don't need to be children of PMU. */ | ||
518 | |||
519 | static struct platform_device *gta02_devices[] __initdata = { | ||
520 | &s3c_device_ohci, | ||
521 | &s3c_device_wdt, | ||
522 | &s3c_device_sdi, | ||
523 | &s3c_device_usbgadget, | ||
524 | &s3c_device_nand, | ||
525 | >a02_nor_flash, | ||
526 | &s3c24xx_pwm_device, | ||
527 | &s3c_device_iis, | ||
528 | &samsung_asoc_dma, | ||
529 | &s3c_device_i2c0, | ||
530 | >a02_dfbmcs320_device, | ||
531 | >a02_buttons_device, | ||
532 | &s3c_device_adc, | ||
533 | &s3c_device_ts, | ||
534 | }; | ||
535 | |||
536 | /* These guys DO need to be children of PMU. */ | ||
537 | |||
538 | static struct platform_device *gta02_devices_pmu_children[] = { | ||
539 | }; | ||
540 | |||
541 | |||
542 | /* | ||
543 | * This is called when pc50633 is probed, quite late in the day since it is an | ||
544 | * I2C bus device. Here we can define platform devices with the advantage that | ||
545 | * we can mark the pcf50633 as the parent. This makes them get suspended and | ||
546 | * resumed with their parent the pcf50633 still around. All devices whose | ||
547 | * operation depends on something from pcf50633 must have this relationship | ||
548 | * made explicit like this, or suspend and resume will become an unreliable | ||
549 | * hellworld. | ||
550 | */ | ||
551 | |||
552 | static void gta02_pmu_attach_child_devices(struct pcf50633 *pcf) | ||
553 | { | ||
554 | int n; | ||
555 | |||
556 | /* Grab a copy of the now probed PMU pointer. */ | ||
557 | gta02_pcf = pcf; | ||
558 | |||
559 | for (n = 0; n < ARRAY_SIZE(gta02_devices_pmu_children); n++) | ||
560 | gta02_devices_pmu_children[n]->dev.parent = pcf->dev; | ||
561 | |||
562 | platform_add_devices(gta02_devices_pmu_children, | ||
563 | ARRAY_SIZE(gta02_devices_pmu_children)); | ||
564 | } | ||
565 | |||
566 | static void gta02_poweroff(void) | ||
567 | { | ||
568 | pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1); | ||
569 | } | ||
570 | |||
571 | static void __init gta02_machine_init(void) | ||
572 | { | ||
573 | /* Set the panic callback to turn AUX LED on or off. */ | ||
574 | panic_blink = gta02_panic_blink; | ||
575 | |||
576 | s3c_pm_init(); | ||
577 | |||
578 | #ifdef CONFIG_CHARGER_PCF50633 | ||
579 | INIT_DELAYED_WORK(>a02_charger_work, gta02_charger_worker); | ||
580 | #endif | ||
581 | |||
582 | s3c24xx_udc_set_platdata(>a02_udc_cfg); | ||
583 | s3c24xx_ts_set_platdata(>a02_ts_info); | ||
584 | s3c_ohci_set_platdata(>a02_usb_info); | ||
585 | s3c_nand_set_platdata(>a02_nand_info); | ||
586 | s3c_i2c0_set_platdata(NULL); | ||
587 | |||
588 | i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs)); | ||
589 | |||
590 | platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices)); | ||
591 | pm_power_off = gta02_poweroff; | ||
592 | |||
593 | regulator_has_full_constraints(); | ||
594 | } | ||
595 | |||
596 | |||
597 | MACHINE_START(NEO1973_GTA02, "GTA02") | ||
598 | /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ | ||
599 | .atag_offset = 0x100, | ||
600 | .map_io = gta02_map_io, | ||
601 | .init_irq = s3c24xx_init_irq, | ||
602 | .init_machine = gta02_machine_init, | ||
603 | .timer = &s3c24xx_timer, | ||
604 | .restart = s3c244x_restart, | ||
605 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c new file mode 100644 index 000000000000..6b21ba107eab --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -0,0 +1,757 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-h1940.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.handhelds.org/projects/h1940.html | ||
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 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/memblock.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/serial_core.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/io.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/input.h> | ||
27 | #include <linux/gpio_keys.h> | ||
28 | #include <linux/pwm_backlight.h> | ||
29 | #include <linux/i2c.h> | ||
30 | #include <linux/leds.h> | ||
31 | #include <linux/pda_power.h> | ||
32 | #include <linux/s3c_adc_battery.h> | ||
33 | #include <linux/delay.h> | ||
34 | |||
35 | #include <video/platform_lcd.h> | ||
36 | |||
37 | #include <linux/mmc/host.h> | ||
38 | #include <linux/export.h> | ||
39 | |||
40 | #include <asm/mach/arch.h> | ||
41 | #include <asm/mach/map.h> | ||
42 | #include <asm/mach/irq.h> | ||
43 | |||
44 | #include <mach/hardware.h> | ||
45 | #include <asm/irq.h> | ||
46 | #include <asm/mach-types.h> | ||
47 | |||
48 | #include <plat/regs-serial.h> | ||
49 | #include <mach/regs-lcd.h> | ||
50 | #include <mach/regs-clock.h> | ||
51 | |||
52 | #include <mach/regs-gpio.h> | ||
53 | #include <mach/gpio-fns.h> | ||
54 | #include <mach/gpio-nrs.h> | ||
55 | |||
56 | #include <mach/h1940.h> | ||
57 | #include <mach/h1940-latch.h> | ||
58 | #include <mach/fb.h> | ||
59 | #include <plat/udc.h> | ||
60 | #include <plat/iic.h> | ||
61 | |||
62 | #include <plat/gpio-cfg.h> | ||
63 | #include <plat/clock.h> | ||
64 | #include <plat/devs.h> | ||
65 | #include <plat/cpu.h> | ||
66 | #include <plat/pll.h> | ||
67 | #include <plat/pm.h> | ||
68 | #include <plat/mci.h> | ||
69 | #include <plat/ts.h> | ||
70 | |||
71 | #include <sound/uda1380.h> | ||
72 | |||
73 | #include "common.h" | ||
74 | |||
75 | #define H1940_LATCH ((void __force __iomem *)0xF8000000) | ||
76 | |||
77 | #define H1940_PA_LATCH S3C2410_CS2 | ||
78 | |||
79 | #define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END)) | ||
80 | |||
81 | static struct map_desc h1940_iodesc[] __initdata = { | ||
82 | [0] = { | ||
83 | .virtual = (unsigned long)H1940_LATCH, | ||
84 | .pfn = __phys_to_pfn(H1940_PA_LATCH), | ||
85 | .length = SZ_16K, | ||
86 | .type = MT_DEVICE | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
91 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
92 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
93 | |||
94 | static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = { | ||
95 | [0] = { | ||
96 | .hwport = 0, | ||
97 | .flags = 0, | ||
98 | .ucon = 0x3c5, | ||
99 | .ulcon = 0x03, | ||
100 | .ufcon = 0x51, | ||
101 | }, | ||
102 | [1] = { | ||
103 | .hwport = 1, | ||
104 | .flags = 0, | ||
105 | .ucon = 0x245, | ||
106 | .ulcon = 0x03, | ||
107 | .ufcon = 0x00, | ||
108 | }, | ||
109 | /* IR port */ | ||
110 | [2] = { | ||
111 | .hwport = 2, | ||
112 | .flags = 0, | ||
113 | .uart_flags = UPF_CONS_FLOW, | ||
114 | .ucon = 0x3c5, | ||
115 | .ulcon = 0x43, | ||
116 | .ufcon = 0x51, | ||
117 | } | ||
118 | }; | ||
119 | |||
120 | /* Board control latch control */ | ||
121 | |||
122 | static unsigned int latch_state; | ||
123 | |||
124 | static void h1940_latch_control(unsigned int clear, unsigned int set) | ||
125 | { | ||
126 | unsigned long flags; | ||
127 | |||
128 | local_irq_save(flags); | ||
129 | |||
130 | latch_state &= ~clear; | ||
131 | latch_state |= set; | ||
132 | |||
133 | __raw_writel(latch_state, H1940_LATCH); | ||
134 | |||
135 | local_irq_restore(flags); | ||
136 | } | ||
137 | |||
138 | static inline int h1940_gpiolib_to_latch(int offset) | ||
139 | { | ||
140 | return 1 << (offset + 16); | ||
141 | } | ||
142 | |||
143 | static void h1940_gpiolib_latch_set(struct gpio_chip *chip, | ||
144 | unsigned offset, int value) | ||
145 | { | ||
146 | int latch_bit = h1940_gpiolib_to_latch(offset); | ||
147 | |||
148 | h1940_latch_control(value ? 0 : latch_bit, | ||
149 | value ? latch_bit : 0); | ||
150 | } | ||
151 | |||
152 | static int h1940_gpiolib_latch_output(struct gpio_chip *chip, | ||
153 | unsigned offset, int value) | ||
154 | { | ||
155 | h1940_gpiolib_latch_set(chip, offset, value); | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int h1940_gpiolib_latch_get(struct gpio_chip *chip, | ||
160 | unsigned offset) | ||
161 | { | ||
162 | return (latch_state >> (offset + 16)) & 1; | ||
163 | } | ||
164 | |||
165 | static struct gpio_chip h1940_latch_gpiochip = { | ||
166 | .base = H1940_LATCH_GPIO(0), | ||
167 | .owner = THIS_MODULE, | ||
168 | .label = "H1940_LATCH", | ||
169 | .ngpio = 16, | ||
170 | .direction_output = h1940_gpiolib_latch_output, | ||
171 | .set = h1940_gpiolib_latch_set, | ||
172 | .get = h1940_gpiolib_latch_get, | ||
173 | }; | ||
174 | |||
175 | static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = { | ||
176 | .vbus_pin = S3C2410_GPG(5), | ||
177 | .vbus_pin_inverted = 1, | ||
178 | .pullup_pin = H1940_LATCH_USB_DP, | ||
179 | }; | ||
180 | |||
181 | static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = { | ||
182 | .delay = 10000, | ||
183 | .presc = 49, | ||
184 | .oversampling_shift = 2, | ||
185 | .cfg_gpio = s3c24xx_ts_cfg_gpio, | ||
186 | }; | ||
187 | |||
188 | /** | ||
189 | * Set lcd on or off | ||
190 | **/ | ||
191 | static struct s3c2410fb_display h1940_lcd __initdata = { | ||
192 | .lcdcon5= S3C2410_LCDCON5_FRM565 | \ | ||
193 | S3C2410_LCDCON5_INVVLINE | \ | ||
194 | S3C2410_LCDCON5_HWSWP, | ||
195 | |||
196 | .type = S3C2410_LCDCON1_TFT, | ||
197 | .width = 240, | ||
198 | .height = 320, | ||
199 | .pixclock = 260000, | ||
200 | .xres = 240, | ||
201 | .yres = 320, | ||
202 | .bpp = 16, | ||
203 | .left_margin = 8, | ||
204 | .right_margin = 20, | ||
205 | .hsync_len = 4, | ||
206 | .upper_margin = 8, | ||
207 | .lower_margin = 7, | ||
208 | .vsync_len = 1, | ||
209 | }; | ||
210 | |||
211 | static struct s3c2410fb_mach_info h1940_fb_info __initdata = { | ||
212 | .displays = &h1940_lcd, | ||
213 | .num_displays = 1, | ||
214 | .default_display = 0, | ||
215 | |||
216 | .lpcsel = 0x02, | ||
217 | .gpccon = 0xaa940659, | ||
218 | .gpccon_mask = 0xffffc0f0, | ||
219 | .gpcup = 0x0000ffff, | ||
220 | .gpcup_mask = 0xffffffff, | ||
221 | .gpdcon = 0xaa84aaa0, | ||
222 | .gpdcon_mask = 0xffffffff, | ||
223 | .gpdup = 0x0000faff, | ||
224 | .gpdup_mask = 0xffffffff, | ||
225 | }; | ||
226 | |||
227 | static int power_supply_init(struct device *dev) | ||
228 | { | ||
229 | return gpio_request(S3C2410_GPF(2), "cable plugged"); | ||
230 | } | ||
231 | |||
232 | static int h1940_is_ac_online(void) | ||
233 | { | ||
234 | return !gpio_get_value(S3C2410_GPF(2)); | ||
235 | } | ||
236 | |||
237 | static void power_supply_exit(struct device *dev) | ||
238 | { | ||
239 | gpio_free(S3C2410_GPF(2)); | ||
240 | } | ||
241 | |||
242 | static char *h1940_supplicants[] = { | ||
243 | "main-battery", | ||
244 | "backup-battery", | ||
245 | }; | ||
246 | |||
247 | static struct pda_power_pdata power_supply_info = { | ||
248 | .init = power_supply_init, | ||
249 | .is_ac_online = h1940_is_ac_online, | ||
250 | .exit = power_supply_exit, | ||
251 | .supplied_to = h1940_supplicants, | ||
252 | .num_supplicants = ARRAY_SIZE(h1940_supplicants), | ||
253 | }; | ||
254 | |||
255 | static struct resource power_supply_resources[] = { | ||
256 | [0] = { | ||
257 | .name = "ac", | ||
258 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE | | ||
259 | IORESOURCE_IRQ_HIGHEDGE, | ||
260 | .start = IRQ_EINT2, | ||
261 | .end = IRQ_EINT2, | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static struct platform_device power_supply = { | ||
266 | .name = "pda-power", | ||
267 | .id = -1, | ||
268 | .dev = { | ||
269 | .platform_data = | ||
270 | &power_supply_info, | ||
271 | }, | ||
272 | .resource = power_supply_resources, | ||
273 | .num_resources = ARRAY_SIZE(power_supply_resources), | ||
274 | }; | ||
275 | |||
276 | static const struct s3c_adc_bat_thresh bat_lut_noac[] = { | ||
277 | { .volt = 4070, .cur = 162, .level = 100}, | ||
278 | { .volt = 4040, .cur = 165, .level = 95}, | ||
279 | { .volt = 4016, .cur = 164, .level = 90}, | ||
280 | { .volt = 3996, .cur = 166, .level = 85}, | ||
281 | { .volt = 3971, .cur = 168, .level = 80}, | ||
282 | { .volt = 3951, .cur = 168, .level = 75}, | ||
283 | { .volt = 3931, .cur = 170, .level = 70}, | ||
284 | { .volt = 3903, .cur = 172, .level = 65}, | ||
285 | { .volt = 3886, .cur = 172, .level = 60}, | ||
286 | { .volt = 3858, .cur = 176, .level = 55}, | ||
287 | { .volt = 3842, .cur = 176, .level = 50}, | ||
288 | { .volt = 3818, .cur = 176, .level = 45}, | ||
289 | { .volt = 3789, .cur = 180, .level = 40}, | ||
290 | { .volt = 3769, .cur = 180, .level = 35}, | ||
291 | { .volt = 3749, .cur = 184, .level = 30}, | ||
292 | { .volt = 3732, .cur = 184, .level = 25}, | ||
293 | { .volt = 3716, .cur = 184, .level = 20}, | ||
294 | { .volt = 3708, .cur = 184, .level = 15}, | ||
295 | { .volt = 3716, .cur = 96, .level = 10}, | ||
296 | { .volt = 3700, .cur = 96, .level = 5}, | ||
297 | { .volt = 3684, .cur = 96, .level = 0}, | ||
298 | }; | ||
299 | |||
300 | static const struct s3c_adc_bat_thresh bat_lut_acin[] = { | ||
301 | { .volt = 4130, .cur = 0, .level = 100}, | ||
302 | { .volt = 3982, .cur = 0, .level = 50}, | ||
303 | { .volt = 3854, .cur = 0, .level = 10}, | ||
304 | { .volt = 3841, .cur = 0, .level = 0}, | ||
305 | }; | ||
306 | |||
307 | static int h1940_bat_init(void) | ||
308 | { | ||
309 | int ret; | ||
310 | |||
311 | ret = gpio_request(H1940_LATCH_SM803_ENABLE, "h1940-charger-enable"); | ||
312 | if (ret) | ||
313 | return ret; | ||
314 | gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0); | ||
315 | |||
316 | return 0; | ||
317 | |||
318 | } | ||
319 | |||
320 | static void h1940_bat_exit(void) | ||
321 | { | ||
322 | gpio_free(H1940_LATCH_SM803_ENABLE); | ||
323 | } | ||
324 | |||
325 | static void h1940_enable_charger(void) | ||
326 | { | ||
327 | gpio_set_value(H1940_LATCH_SM803_ENABLE, 1); | ||
328 | } | ||
329 | |||
330 | static void h1940_disable_charger(void) | ||
331 | { | ||
332 | gpio_set_value(H1940_LATCH_SM803_ENABLE, 0); | ||
333 | } | ||
334 | |||
335 | static struct s3c_adc_bat_pdata h1940_bat_cfg = { | ||
336 | .init = h1940_bat_init, | ||
337 | .exit = h1940_bat_exit, | ||
338 | .enable_charger = h1940_enable_charger, | ||
339 | .disable_charger = h1940_disable_charger, | ||
340 | .gpio_charge_finished = S3C2410_GPF(3), | ||
341 | .gpio_inverted = 1, | ||
342 | .lut_noac = bat_lut_noac, | ||
343 | .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac), | ||
344 | .lut_acin = bat_lut_acin, | ||
345 | .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin), | ||
346 | .volt_channel = 0, | ||
347 | .current_channel = 1, | ||
348 | .volt_mult = 4056, | ||
349 | .current_mult = 1893, | ||
350 | .internal_impedance = 200, | ||
351 | .backup_volt_channel = 3, | ||
352 | /* TODO Check backup volt multiplier */ | ||
353 | .backup_volt_mult = 4056, | ||
354 | .backup_volt_min = 0, | ||
355 | .backup_volt_max = 4149288 | ||
356 | }; | ||
357 | |||
358 | static struct platform_device h1940_battery = { | ||
359 | .name = "s3c-adc-battery", | ||
360 | .id = -1, | ||
361 | .dev = { | ||
362 | .parent = &s3c_device_adc.dev, | ||
363 | .platform_data = &h1940_bat_cfg, | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static DEFINE_SPINLOCK(h1940_blink_spin); | ||
368 | |||
369 | int h1940_led_blink_set(unsigned gpio, int state, | ||
370 | unsigned long *delay_on, unsigned long *delay_off) | ||
371 | { | ||
372 | int blink_gpio, check_gpio1, check_gpio2; | ||
373 | |||
374 | switch (gpio) { | ||
375 | case H1940_LATCH_LED_GREEN: | ||
376 | blink_gpio = S3C2410_GPA(7); | ||
377 | check_gpio1 = S3C2410_GPA(1); | ||
378 | check_gpio2 = S3C2410_GPA(3); | ||
379 | break; | ||
380 | case H1940_LATCH_LED_RED: | ||
381 | blink_gpio = S3C2410_GPA(1); | ||
382 | check_gpio1 = S3C2410_GPA(7); | ||
383 | check_gpio2 = S3C2410_GPA(3); | ||
384 | break; | ||
385 | default: | ||
386 | blink_gpio = S3C2410_GPA(3); | ||
387 | check_gpio1 = S3C2410_GPA(1); | ||
388 | check_gpio1 = S3C2410_GPA(7); | ||
389 | break; | ||
390 | } | ||
391 | |||
392 | if (delay_on && delay_off && !*delay_on && !*delay_off) | ||
393 | *delay_on = *delay_off = 500; | ||
394 | |||
395 | spin_lock(&h1940_blink_spin); | ||
396 | |||
397 | switch (state) { | ||
398 | case GPIO_LED_NO_BLINK_LOW: | ||
399 | case GPIO_LED_NO_BLINK_HIGH: | ||
400 | if (!gpio_get_value(check_gpio1) && | ||
401 | !gpio_get_value(check_gpio2)) | ||
402 | gpio_set_value(H1940_LATCH_LED_FLASH, 0); | ||
403 | gpio_set_value(blink_gpio, 0); | ||
404 | if (gpio_is_valid(gpio)) | ||
405 | gpio_set_value(gpio, state); | ||
406 | break; | ||
407 | case GPIO_LED_BLINK: | ||
408 | if (gpio_is_valid(gpio)) | ||
409 | gpio_set_value(gpio, 0); | ||
410 | gpio_set_value(H1940_LATCH_LED_FLASH, 1); | ||
411 | gpio_set_value(blink_gpio, 1); | ||
412 | break; | ||
413 | } | ||
414 | |||
415 | spin_unlock(&h1940_blink_spin); | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | EXPORT_SYMBOL(h1940_led_blink_set); | ||
420 | |||
421 | static struct gpio_led h1940_leds_desc[] = { | ||
422 | { | ||
423 | .name = "Green", | ||
424 | .default_trigger = "main-battery-full", | ||
425 | .gpio = H1940_LATCH_LED_GREEN, | ||
426 | .retain_state_suspended = 1, | ||
427 | }, | ||
428 | { | ||
429 | .name = "Red", | ||
430 | .default_trigger | ||
431 | = "main-battery-charging-blink-full-solid", | ||
432 | .gpio = H1940_LATCH_LED_RED, | ||
433 | .retain_state_suspended = 1, | ||
434 | }, | ||
435 | }; | ||
436 | |||
437 | static struct gpio_led_platform_data h1940_leds_pdata = { | ||
438 | .num_leds = ARRAY_SIZE(h1940_leds_desc), | ||
439 | .leds = h1940_leds_desc, | ||
440 | .gpio_blink_set = h1940_led_blink_set, | ||
441 | }; | ||
442 | |||
443 | static struct platform_device h1940_device_leds = { | ||
444 | .name = "leds-gpio", | ||
445 | .id = -1, | ||
446 | .dev = { | ||
447 | .platform_data = &h1940_leds_pdata, | ||
448 | }, | ||
449 | }; | ||
450 | |||
451 | static struct platform_device h1940_device_bluetooth = { | ||
452 | .name = "h1940-bt", | ||
453 | .id = -1, | ||
454 | }; | ||
455 | |||
456 | static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd) | ||
457 | { | ||
458 | switch (power_mode) { | ||
459 | case MMC_POWER_OFF: | ||
460 | gpio_set_value(H1940_LATCH_SD_POWER, 0); | ||
461 | break; | ||
462 | case MMC_POWER_UP: | ||
463 | case MMC_POWER_ON: | ||
464 | gpio_set_value(H1940_LATCH_SD_POWER, 1); | ||
465 | break; | ||
466 | default: | ||
467 | break; | ||
468 | }; | ||
469 | } | ||
470 | |||
471 | static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { | ||
472 | .gpio_detect = S3C2410_GPF(5), | ||
473 | .gpio_wprotect = S3C2410_GPH(8), | ||
474 | .set_power = h1940_set_mmc_power, | ||
475 | .ocr_avail = MMC_VDD_32_33, | ||
476 | }; | ||
477 | |||
478 | static int h1940_backlight_init(struct device *dev) | ||
479 | { | ||
480 | gpio_request(S3C2410_GPB(0), "Backlight"); | ||
481 | |||
482 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
483 | s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); | ||
484 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | ||
485 | gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1); | ||
486 | |||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static int h1940_backlight_notify(struct device *dev, int brightness) | ||
491 | { | ||
492 | if (!brightness) { | ||
493 | gpio_direction_output(S3C2410_GPB(0), 1); | ||
494 | gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0); | ||
495 | } else { | ||
496 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
497 | s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); | ||
498 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | ||
499 | gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1); | ||
500 | } | ||
501 | return brightness; | ||
502 | } | ||
503 | |||
504 | static void h1940_backlight_exit(struct device *dev) | ||
505 | { | ||
506 | gpio_direction_output(S3C2410_GPB(0), 1); | ||
507 | gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0); | ||
508 | } | ||
509 | |||
510 | |||
511 | static struct platform_pwm_backlight_data backlight_data = { | ||
512 | .pwm_id = 0, | ||
513 | .max_brightness = 100, | ||
514 | .dft_brightness = 50, | ||
515 | /* tcnt = 0x31 */ | ||
516 | .pwm_period_ns = 36296, | ||
517 | .init = h1940_backlight_init, | ||
518 | .notify = h1940_backlight_notify, | ||
519 | .exit = h1940_backlight_exit, | ||
520 | }; | ||
521 | |||
522 | static struct platform_device h1940_backlight = { | ||
523 | .name = "pwm-backlight", | ||
524 | .dev = { | ||
525 | .parent = &s3c_device_timer[0].dev, | ||
526 | .platform_data = &backlight_data, | ||
527 | }, | ||
528 | .id = -1, | ||
529 | }; | ||
530 | |||
531 | static void h1940_lcd_power_set(struct plat_lcd_data *pd, | ||
532 | unsigned int power) | ||
533 | { | ||
534 | int value, retries = 100; | ||
535 | |||
536 | if (!power) { | ||
537 | gpio_set_value(S3C2410_GPC(0), 0); | ||
538 | /* wait for 3ac */ | ||
539 | do { | ||
540 | value = gpio_get_value(S3C2410_GPC(6)); | ||
541 | } while (value && retries--); | ||
542 | |||
543 | gpio_set_value(H1940_LATCH_LCD_P2, 0); | ||
544 | gpio_set_value(H1940_LATCH_LCD_P3, 0); | ||
545 | gpio_set_value(H1940_LATCH_LCD_P4, 0); | ||
546 | |||
547 | gpio_direction_output(S3C2410_GPC(1), 0); | ||
548 | gpio_direction_output(S3C2410_GPC(4), 0); | ||
549 | |||
550 | gpio_set_value(H1940_LATCH_LCD_P1, 0); | ||
551 | gpio_set_value(H1940_LATCH_LCD_P0, 0); | ||
552 | |||
553 | gpio_set_value(S3C2410_GPC(5), 0); | ||
554 | |||
555 | } else { | ||
556 | gpio_set_value(H1940_LATCH_LCD_P0, 1); | ||
557 | gpio_set_value(H1940_LATCH_LCD_P1, 1); | ||
558 | |||
559 | gpio_direction_input(S3C2410_GPC(1)); | ||
560 | gpio_direction_input(S3C2410_GPC(4)); | ||
561 | mdelay(10); | ||
562 | s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2)); | ||
563 | s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2)); | ||
564 | |||
565 | gpio_set_value(S3C2410_GPC(5), 1); | ||
566 | gpio_set_value(S3C2410_GPC(0), 1); | ||
567 | |||
568 | gpio_set_value(H1940_LATCH_LCD_P3, 1); | ||
569 | gpio_set_value(H1940_LATCH_LCD_P2, 1); | ||
570 | gpio_set_value(H1940_LATCH_LCD_P4, 1); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | static struct plat_lcd_data h1940_lcd_power_data = { | ||
575 | .set_power = h1940_lcd_power_set, | ||
576 | }; | ||
577 | |||
578 | static struct platform_device h1940_lcd_powerdev = { | ||
579 | .name = "platform-lcd", | ||
580 | .dev.parent = &s3c_device_lcd.dev, | ||
581 | .dev.platform_data = &h1940_lcd_power_data, | ||
582 | }; | ||
583 | |||
584 | static struct uda1380_platform_data uda1380_info = { | ||
585 | .gpio_power = H1940_LATCH_UDA_POWER, | ||
586 | .gpio_reset = S3C2410_GPA(12), | ||
587 | .dac_clk = UDA1380_DAC_CLK_SYSCLK, | ||
588 | }; | ||
589 | |||
590 | static struct i2c_board_info h1940_i2c_devices[] = { | ||
591 | { | ||
592 | I2C_BOARD_INFO("uda1380", 0x1a), | ||
593 | .platform_data = &uda1380_info, | ||
594 | }, | ||
595 | }; | ||
596 | |||
597 | #define DECLARE_BUTTON(p, k, n, w) \ | ||
598 | { \ | ||
599 | .gpio = p, \ | ||
600 | .code = k, \ | ||
601 | .desc = n, \ | ||
602 | .wakeup = w, \ | ||
603 | .active_low = 1, \ | ||
604 | } | ||
605 | |||
606 | static struct gpio_keys_button h1940_buttons[] = { | ||
607 | DECLARE_BUTTON(S3C2410_GPF(0), KEY_POWER, "Power", 1), | ||
608 | DECLARE_BUTTON(S3C2410_GPF(6), KEY_ENTER, "Select", 1), | ||
609 | DECLARE_BUTTON(S3C2410_GPF(7), KEY_RECORD, "Record", 0), | ||
610 | DECLARE_BUTTON(S3C2410_GPG(0), KEY_F11, "Calendar", 0), | ||
611 | DECLARE_BUTTON(S3C2410_GPG(2), KEY_F12, "Contacts", 0), | ||
612 | DECLARE_BUTTON(S3C2410_GPG(3), KEY_MAIL, "Mail", 0), | ||
613 | DECLARE_BUTTON(S3C2410_GPG(6), KEY_LEFT, "Left_arrow", 0), | ||
614 | DECLARE_BUTTON(S3C2410_GPG(7), KEY_HOMEPAGE, "Home", 0), | ||
615 | DECLARE_BUTTON(S3C2410_GPG(8), KEY_RIGHT, "Right_arrow", 0), | ||
616 | DECLARE_BUTTON(S3C2410_GPG(9), KEY_UP, "Up_arrow", 0), | ||
617 | DECLARE_BUTTON(S3C2410_GPG(10), KEY_DOWN, "Down_arrow", 0), | ||
618 | }; | ||
619 | |||
620 | static struct gpio_keys_platform_data h1940_buttons_data = { | ||
621 | .buttons = h1940_buttons, | ||
622 | .nbuttons = ARRAY_SIZE(h1940_buttons), | ||
623 | }; | ||
624 | |||
625 | static struct platform_device h1940_dev_buttons = { | ||
626 | .name = "gpio-keys", | ||
627 | .id = -1, | ||
628 | .dev = { | ||
629 | .platform_data = &h1940_buttons_data, | ||
630 | } | ||
631 | }; | ||
632 | |||
633 | static struct platform_device *h1940_devices[] __initdata = { | ||
634 | &h1940_dev_buttons, | ||
635 | &s3c_device_ohci, | ||
636 | &s3c_device_lcd, | ||
637 | &s3c_device_wdt, | ||
638 | &s3c_device_i2c0, | ||
639 | &s3c_device_iis, | ||
640 | &samsung_asoc_dma, | ||
641 | &s3c_device_usbgadget, | ||
642 | &h1940_device_leds, | ||
643 | &h1940_device_bluetooth, | ||
644 | &s3c_device_sdi, | ||
645 | &s3c_device_rtc, | ||
646 | &s3c_device_timer[0], | ||
647 | &h1940_backlight, | ||
648 | &h1940_lcd_powerdev, | ||
649 | &s3c_device_adc, | ||
650 | &s3c_device_ts, | ||
651 | &power_supply, | ||
652 | &h1940_battery, | ||
653 | }; | ||
654 | |||
655 | static void __init h1940_map_io(void) | ||
656 | { | ||
657 | s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); | ||
658 | s3c24xx_init_clocks(0); | ||
659 | s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); | ||
660 | |||
661 | /* setup PM */ | ||
662 | |||
663 | #ifdef CONFIG_PM_H1940 | ||
664 | memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); | ||
665 | #endif | ||
666 | s3c_pm_init(); | ||
667 | |||
668 | /* Add latch gpio chip, set latch initial value */ | ||
669 | h1940_latch_control(0, 0); | ||
670 | WARN_ON(gpiochip_add(&h1940_latch_gpiochip)); | ||
671 | } | ||
672 | |||
673 | /* H1940 and RX3715 need to reserve this for suspend */ | ||
674 | static void __init h1940_reserve(void) | ||
675 | { | ||
676 | memblock_reserve(0x30003000, 0x1000); | ||
677 | memblock_reserve(0x30081000, 0x1000); | ||
678 | } | ||
679 | |||
680 | static void __init h1940_init_irq(void) | ||
681 | { | ||
682 | s3c24xx_init_irq(); | ||
683 | } | ||
684 | |||
685 | static void __init h1940_init(void) | ||
686 | { | ||
687 | u32 tmp; | ||
688 | |||
689 | s3c24xx_fb_set_platdata(&h1940_fb_info); | ||
690 | s3c24xx_mci_set_platdata(&h1940_mmc_cfg); | ||
691 | s3c24xx_udc_set_platdata(&h1940_udc_cfg); | ||
692 | s3c24xx_ts_set_platdata(&h1940_ts_cfg); | ||
693 | s3c_i2c0_set_platdata(NULL); | ||
694 | |||
695 | /* Turn off suspend on both USB ports, and switch the | ||
696 | * selectable USB port to USB device mode. */ | ||
697 | |||
698 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
699 | S3C2410_MISCCR_USBSUSPND0 | | ||
700 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
701 | |||
702 | tmp = (0x78 << S3C24XX_PLL_MDIV_SHIFT) | ||
703 | | (0x02 << S3C24XX_PLL_PDIV_SHIFT) | ||
704 | | (0x03 << S3C24XX_PLL_SDIV_SHIFT); | ||
705 | writel(tmp, S3C2410_UPLLCON); | ||
706 | |||
707 | gpio_request(S3C2410_GPC(0), "LCD power"); | ||
708 | gpio_request(S3C2410_GPC(1), "LCD power"); | ||
709 | gpio_request(S3C2410_GPC(4), "LCD power"); | ||
710 | gpio_request(S3C2410_GPC(5), "LCD power"); | ||
711 | gpio_request(S3C2410_GPC(6), "LCD power"); | ||
712 | gpio_request(H1940_LATCH_LCD_P0, "LCD power"); | ||
713 | gpio_request(H1940_LATCH_LCD_P1, "LCD power"); | ||
714 | gpio_request(H1940_LATCH_LCD_P2, "LCD power"); | ||
715 | gpio_request(H1940_LATCH_LCD_P3, "LCD power"); | ||
716 | gpio_request(H1940_LATCH_LCD_P4, "LCD power"); | ||
717 | gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power"); | ||
718 | gpio_direction_output(S3C2410_GPC(0), 0); | ||
719 | gpio_direction_output(S3C2410_GPC(1), 0); | ||
720 | gpio_direction_output(S3C2410_GPC(4), 0); | ||
721 | gpio_direction_output(S3C2410_GPC(5), 0); | ||
722 | gpio_direction_input(S3C2410_GPC(6)); | ||
723 | gpio_direction_output(H1940_LATCH_LCD_P0, 0); | ||
724 | gpio_direction_output(H1940_LATCH_LCD_P1, 0); | ||
725 | gpio_direction_output(H1940_LATCH_LCD_P2, 0); | ||
726 | gpio_direction_output(H1940_LATCH_LCD_P3, 0); | ||
727 | gpio_direction_output(H1940_LATCH_LCD_P4, 0); | ||
728 | gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0); | ||
729 | |||
730 | gpio_request(H1940_LATCH_SD_POWER, "SD power"); | ||
731 | gpio_direction_output(H1940_LATCH_SD_POWER, 0); | ||
732 | |||
733 | platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); | ||
734 | |||
735 | gpio_request(S3C2410_GPA(1), "Red LED blink"); | ||
736 | gpio_request(S3C2410_GPA(3), "Blue LED blink"); | ||
737 | gpio_request(S3C2410_GPA(7), "Green LED blink"); | ||
738 | gpio_request(H1940_LATCH_LED_FLASH, "LED blink"); | ||
739 | gpio_direction_output(S3C2410_GPA(1), 0); | ||
740 | gpio_direction_output(S3C2410_GPA(3), 0); | ||
741 | gpio_direction_output(S3C2410_GPA(7), 0); | ||
742 | gpio_direction_output(H1940_LATCH_LED_FLASH, 0); | ||
743 | |||
744 | i2c_register_board_info(0, h1940_i2c_devices, | ||
745 | ARRAY_SIZE(h1940_i2c_devices)); | ||
746 | } | ||
747 | |||
748 | MACHINE_START(H1940, "IPAQ-H1940") | ||
749 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
750 | .atag_offset = 0x100, | ||
751 | .map_io = h1940_map_io, | ||
752 | .reserve = h1940_reserve, | ||
753 | .init_irq = h1940_init_irq, | ||
754 | .init_machine = h1940_init, | ||
755 | .timer = &s3c24xx_timer, | ||
756 | .restart = s3c2410_restart, | ||
757 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c new file mode 100644 index 000000000000..ae73ba34ecc6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-jive.c | |||
@@ -0,0 +1,666 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-jive.c | ||
2 | * | ||
3 | * Copyright 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/ | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/syscore_ops.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/i2c.h> | ||
24 | |||
25 | #include <video/ili9320.h> | ||
26 | |||
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/spi/spi_gpio.h> | ||
29 | |||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <plat/regs-serial.h> | ||
35 | #include <plat/nand.h> | ||
36 | #include <plat/iic.h> | ||
37 | |||
38 | #include <mach/regs-power.h> | ||
39 | #include <mach/regs-gpio.h> | ||
40 | #include <mach/regs-mem.h> | ||
41 | #include <mach/regs-lcd.h> | ||
42 | #include <mach/fb.h> | ||
43 | |||
44 | #include <asm/mach-types.h> | ||
45 | |||
46 | #include <linux/mtd/mtd.h> | ||
47 | #include <linux/mtd/nand.h> | ||
48 | #include <linux/mtd/nand_ecc.h> | ||
49 | #include <linux/mtd/partitions.h> | ||
50 | |||
51 | #include <plat/s3c2412.h> | ||
52 | #include <plat/gpio-cfg.h> | ||
53 | #include <plat/clock.h> | ||
54 | #include <plat/devs.h> | ||
55 | #include <plat/cpu.h> | ||
56 | #include <plat/pm.h> | ||
57 | #include <plat/udc.h> | ||
58 | |||
59 | static struct map_desc jive_iodesc[] __initdata = { | ||
60 | }; | ||
61 | |||
62 | #define UCON S3C2410_UCON_DEFAULT | ||
63 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | ||
64 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
65 | |||
66 | static struct s3c2410_uartcfg jive_uartcfgs[] = { | ||
67 | [0] = { | ||
68 | .hwport = 0, | ||
69 | .flags = 0, | ||
70 | .ucon = UCON, | ||
71 | .ulcon = ULCON, | ||
72 | .ufcon = UFCON, | ||
73 | }, | ||
74 | [1] = { | ||
75 | .hwport = 1, | ||
76 | .flags = 0, | ||
77 | .ucon = UCON, | ||
78 | .ulcon = ULCON, | ||
79 | .ufcon = UFCON, | ||
80 | }, | ||
81 | [2] = { | ||
82 | .hwport = 2, | ||
83 | .flags = 0, | ||
84 | .ucon = UCON, | ||
85 | .ulcon = ULCON, | ||
86 | .ufcon = UFCON, | ||
87 | } | ||
88 | }; | ||
89 | |||
90 | /* Jive flash assignment | ||
91 | * | ||
92 | * 0x00000000-0x00028000 : uboot | ||
93 | * 0x00028000-0x0002c000 : uboot env | ||
94 | * 0x0002c000-0x00030000 : spare | ||
95 | * 0x00030000-0x00200000 : zimage A | ||
96 | * 0x00200000-0x01600000 : cramfs A | ||
97 | * 0x01600000-0x017d0000 : zimage B | ||
98 | * 0x017d0000-0x02bd0000 : cramfs B | ||
99 | * 0x02bd0000-0x03fd0000 : yaffs | ||
100 | */ | ||
101 | static struct mtd_partition __initdata jive_imageA_nand_part[] = { | ||
102 | |||
103 | #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER | ||
104 | /* Don't allow access to the bootloader from linux */ | ||
105 | { | ||
106 | .name = "uboot", | ||
107 | .offset = 0, | ||
108 | .size = (160 * SZ_1K), | ||
109 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
110 | }, | ||
111 | |||
112 | /* spare */ | ||
113 | { | ||
114 | .name = "spare", | ||
115 | .offset = (176 * SZ_1K), | ||
116 | .size = (16 * SZ_1K), | ||
117 | }, | ||
118 | #endif | ||
119 | |||
120 | /* booted images */ | ||
121 | { | ||
122 | .name = "kernel (ro)", | ||
123 | .offset = (192 * SZ_1K), | ||
124 | .size = (SZ_2M) - (192 * SZ_1K), | ||
125 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
126 | }, { | ||
127 | .name = "root (ro)", | ||
128 | .offset = (SZ_2M), | ||
129 | .size = (20 * SZ_1M), | ||
130 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
131 | }, | ||
132 | |||
133 | /* yaffs */ | ||
134 | { | ||
135 | .name = "yaffs", | ||
136 | .offset = (44 * SZ_1M), | ||
137 | .size = (20 * SZ_1M), | ||
138 | }, | ||
139 | |||
140 | /* bootloader environment */ | ||
141 | { | ||
142 | .name = "env", | ||
143 | .offset = (160 * SZ_1K), | ||
144 | .size = (16 * SZ_1K), | ||
145 | }, | ||
146 | |||
147 | /* upgrade images */ | ||
148 | { | ||
149 | .name = "zimage", | ||
150 | .offset = (22 * SZ_1M), | ||
151 | .size = (2 * SZ_1M) - (192 * SZ_1K), | ||
152 | }, { | ||
153 | .name = "cramfs", | ||
154 | .offset = (24 * SZ_1M) - (192*SZ_1K), | ||
155 | .size = (20 * SZ_1M), | ||
156 | }, | ||
157 | }; | ||
158 | |||
159 | static struct mtd_partition __initdata jive_imageB_nand_part[] = { | ||
160 | |||
161 | #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER | ||
162 | /* Don't allow access to the bootloader from linux */ | ||
163 | { | ||
164 | .name = "uboot", | ||
165 | .offset = 0, | ||
166 | .size = (160 * SZ_1K), | ||
167 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
168 | }, | ||
169 | |||
170 | /* spare */ | ||
171 | { | ||
172 | .name = "spare", | ||
173 | .offset = (176 * SZ_1K), | ||
174 | .size = (16 * SZ_1K), | ||
175 | }, | ||
176 | #endif | ||
177 | |||
178 | /* booted images */ | ||
179 | { | ||
180 | .name = "kernel (ro)", | ||
181 | .offset = (22 * SZ_1M), | ||
182 | .size = (2 * SZ_1M) - (192 * SZ_1K), | ||
183 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
184 | }, | ||
185 | { | ||
186 | .name = "root (ro)", | ||
187 | .offset = (24 * SZ_1M) - (192 * SZ_1K), | ||
188 | .size = (20 * SZ_1M), | ||
189 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
190 | }, | ||
191 | |||
192 | /* yaffs */ | ||
193 | { | ||
194 | .name = "yaffs", | ||
195 | .offset = (44 * SZ_1M), | ||
196 | .size = (20 * SZ_1M), | ||
197 | }, | ||
198 | |||
199 | /* bootloader environment */ | ||
200 | { | ||
201 | .name = "env", | ||
202 | .offset = (160 * SZ_1K), | ||
203 | .size = (16 * SZ_1K), | ||
204 | }, | ||
205 | |||
206 | /* upgrade images */ | ||
207 | { | ||
208 | .name = "zimage", | ||
209 | .offset = (192 * SZ_1K), | ||
210 | .size = (2 * SZ_1M) - (192 * SZ_1K), | ||
211 | }, { | ||
212 | .name = "cramfs", | ||
213 | .offset = (2 * SZ_1M), | ||
214 | .size = (20 * SZ_1M), | ||
215 | }, | ||
216 | }; | ||
217 | |||
218 | static struct s3c2410_nand_set __initdata jive_nand_sets[] = { | ||
219 | [0] = { | ||
220 | .name = "flash", | ||
221 | .nr_chips = 1, | ||
222 | .nr_partitions = ARRAY_SIZE(jive_imageA_nand_part), | ||
223 | .partitions = jive_imageA_nand_part, | ||
224 | }, | ||
225 | }; | ||
226 | |||
227 | static struct s3c2410_platform_nand __initdata jive_nand_info = { | ||
228 | /* set taken from osiris nand timings, possibly still conservative */ | ||
229 | .tacls = 30, | ||
230 | .twrph0 = 55, | ||
231 | .twrph1 = 40, | ||
232 | .sets = jive_nand_sets, | ||
233 | .nr_sets = ARRAY_SIZE(jive_nand_sets), | ||
234 | }; | ||
235 | |||
236 | static int __init jive_mtdset(char *options) | ||
237 | { | ||
238 | struct s3c2410_nand_set *nand = &jive_nand_sets[0]; | ||
239 | unsigned long set; | ||
240 | |||
241 | if (options == NULL || options[0] == '\0') | ||
242 | return 0; | ||
243 | |||
244 | if (strict_strtoul(options, 10, &set)) { | ||
245 | printk(KERN_ERR "failed to parse mtdset=%s\n", options); | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | switch (set) { | ||
250 | case 1: | ||
251 | nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part); | ||
252 | nand->partitions = jive_imageB_nand_part; | ||
253 | case 0: | ||
254 | /* this is already setup in the nand info */ | ||
255 | break; | ||
256 | default: | ||
257 | printk(KERN_ERR "Unknown mtd set %ld specified," | ||
258 | "using default.", set); | ||
259 | } | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | /* parse the mtdset= option given to the kernel command line */ | ||
265 | __setup("mtdset=", jive_mtdset); | ||
266 | |||
267 | /* LCD timing and setup */ | ||
268 | |||
269 | #define LCD_XRES (240) | ||
270 | #define LCD_YRES (320) | ||
271 | #define LCD_LEFT_MARGIN (12) | ||
272 | #define LCD_RIGHT_MARGIN (12) | ||
273 | #define LCD_LOWER_MARGIN (12) | ||
274 | #define LCD_UPPER_MARGIN (12) | ||
275 | #define LCD_VSYNC (2) | ||
276 | #define LCD_HSYNC (2) | ||
277 | |||
278 | #define LCD_REFRESH (60) | ||
279 | |||
280 | #define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN) | ||
281 | #define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN) | ||
282 | |||
283 | static struct s3c2410fb_display jive_vgg2432a4_display[] = { | ||
284 | [0] = { | ||
285 | .width = LCD_XRES, | ||
286 | .height = LCD_YRES, | ||
287 | .xres = LCD_XRES, | ||
288 | .yres = LCD_YRES, | ||
289 | .left_margin = LCD_LEFT_MARGIN, | ||
290 | .right_margin = LCD_RIGHT_MARGIN, | ||
291 | .upper_margin = LCD_UPPER_MARGIN, | ||
292 | .lower_margin = LCD_LOWER_MARGIN, | ||
293 | .hsync_len = LCD_HSYNC, | ||
294 | .vsync_len = LCD_VSYNC, | ||
295 | |||
296 | .pixclock = (1000000000000LL / | ||
297 | (LCD_REFRESH * LCD_HTOT * LCD_VTOT)), | ||
298 | |||
299 | .bpp = 16, | ||
300 | .type = (S3C2410_LCDCON1_TFT16BPP | | ||
301 | S3C2410_LCDCON1_TFT), | ||
302 | |||
303 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 | | ||
304 | S3C2410_LCDCON5_INVVLINE | | ||
305 | S3C2410_LCDCON5_INVVFRAME | | ||
306 | S3C2410_LCDCON5_INVVDEN | | ||
307 | S3C2410_LCDCON5_PWREN), | ||
308 | }, | ||
309 | }; | ||
310 | |||
311 | /* todo - put into gpio header */ | ||
312 | |||
313 | #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2)) | ||
314 | #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2)) | ||
315 | |||
316 | static struct s3c2410fb_mach_info jive_lcd_config = { | ||
317 | .displays = jive_vgg2432a4_display, | ||
318 | .num_displays = ARRAY_SIZE(jive_vgg2432a4_display), | ||
319 | .default_display = 0, | ||
320 | |||
321 | /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN | ||
322 | * and disable the pull down resistors on pins we are using for LCD | ||
323 | * data. */ | ||
324 | |||
325 | .gpcup = (0xf << 1) | (0x3f << 10), | ||
326 | |||
327 | .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE | | ||
328 | S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM | | ||
329 | S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 | | ||
330 | S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 | | ||
331 | S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7), | ||
332 | |||
333 | .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) | | ||
334 | S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) | | ||
335 | S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) | | ||
336 | S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) | | ||
337 | S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)), | ||
338 | |||
339 | .gpdup = (0x3f << 2) | (0x3f << 10), | ||
340 | |||
341 | .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 | | ||
342 | S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 | | ||
343 | S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 | | ||
344 | S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 | | ||
345 | S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 | | ||
346 | S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23), | ||
347 | |||
348 | .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) | | ||
349 | S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) | | ||
350 | S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) | | ||
351 | S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)| | ||
352 | S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)| | ||
353 | S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)), | ||
354 | }; | ||
355 | |||
356 | /* ILI9320 support. */ | ||
357 | |||
358 | static void jive_lcm_reset(unsigned int set) | ||
359 | { | ||
360 | printk(KERN_DEBUG "%s(%d)\n", __func__, set); | ||
361 | |||
362 | gpio_set_value(S3C2410_GPG(13), set); | ||
363 | } | ||
364 | |||
365 | #undef LCD_UPPER_MARGIN | ||
366 | #define LCD_UPPER_MARGIN 2 | ||
367 | |||
368 | static struct ili9320_platdata jive_lcm_config = { | ||
369 | .hsize = LCD_XRES, | ||
370 | .vsize = LCD_YRES, | ||
371 | |||
372 | .reset = jive_lcm_reset, | ||
373 | .suspend = ILI9320_SUSPEND_DEEP, | ||
374 | |||
375 | .entry_mode = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR, | ||
376 | .display2 = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) | | ||
377 | ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)), | ||
378 | .display3 = 0x0, | ||
379 | .display4 = 0x0, | ||
380 | .rgb_if1 = (ILI9320_RGBIF1_RIM_RGB18 | | ||
381 | ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF), | ||
382 | .rgb_if2 = ILI9320_RGBIF2_DPL, | ||
383 | .interface2 = 0x0, | ||
384 | .interface3 = 0x3, | ||
385 | .interface4 = (ILI9320_INTERFACE4_RTNE(16) | | ||
386 | ILI9320_INTERFACE4_DIVE(1)), | ||
387 | .interface5 = 0x0, | ||
388 | .interface6 = 0x0, | ||
389 | }; | ||
390 | |||
391 | /* LCD SPI support */ | ||
392 | |||
393 | static struct spi_gpio_platform_data jive_lcd_spi = { | ||
394 | .sck = S3C2410_GPG(8), | ||
395 | .mosi = S3C2410_GPB(8), | ||
396 | .miso = SPI_GPIO_NO_MISO, | ||
397 | }; | ||
398 | |||
399 | static struct platform_device jive_device_lcdspi = { | ||
400 | .name = "spi-gpio", | ||
401 | .id = 1, | ||
402 | .dev.platform_data = &jive_lcd_spi, | ||
403 | }; | ||
404 | |||
405 | |||
406 | /* WM8750 audio code SPI definition */ | ||
407 | |||
408 | static struct spi_gpio_platform_data jive_wm8750_spi = { | ||
409 | .sck = S3C2410_GPB(4), | ||
410 | .mosi = S3C2410_GPB(9), | ||
411 | .miso = SPI_GPIO_NO_MISO, | ||
412 | }; | ||
413 | |||
414 | static struct platform_device jive_device_wm8750 = { | ||
415 | .name = "spi-gpio", | ||
416 | .id = 2, | ||
417 | .dev.platform_data = &jive_wm8750_spi, | ||
418 | }; | ||
419 | |||
420 | /* JIVE SPI devices. */ | ||
421 | |||
422 | static struct spi_board_info __initdata jive_spi_devs[] = { | ||
423 | [0] = { | ||
424 | .modalias = "VGG2432A4", | ||
425 | .bus_num = 1, | ||
426 | .chip_select = 0, | ||
427 | .mode = SPI_MODE_3, /* CPOL=1, CPHA=1 */ | ||
428 | .max_speed_hz = 100000, | ||
429 | .platform_data = &jive_lcm_config, | ||
430 | .controller_data = (void *)S3C2410_GPB(7), | ||
431 | }, { | ||
432 | .modalias = "WM8750", | ||
433 | .bus_num = 2, | ||
434 | .chip_select = 0, | ||
435 | .mode = SPI_MODE_0, /* CPOL=0, CPHA=0 */ | ||
436 | .max_speed_hz = 100000, | ||
437 | .controller_data = (void *)S3C2410_GPH(10), | ||
438 | }, | ||
439 | }; | ||
440 | |||
441 | /* I2C bus and device configuration. */ | ||
442 | |||
443 | static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = { | ||
444 | .frequency = 80 * 1000, | ||
445 | .flags = S3C_IICFLG_FILTER, | ||
446 | .sda_delay = 2, | ||
447 | }; | ||
448 | |||
449 | static struct i2c_board_info jive_i2c_devs[] __initdata = { | ||
450 | [0] = { | ||
451 | I2C_BOARD_INFO("lis302dl", 0x1c), | ||
452 | .irq = IRQ_EINT14, | ||
453 | }, | ||
454 | }; | ||
455 | |||
456 | /* The platform devices being used. */ | ||
457 | |||
458 | static struct platform_device *jive_devices[] __initdata = { | ||
459 | &s3c_device_ohci, | ||
460 | &s3c_device_rtc, | ||
461 | &s3c_device_wdt, | ||
462 | &s3c_device_i2c0, | ||
463 | &s3c_device_lcd, | ||
464 | &jive_device_lcdspi, | ||
465 | &jive_device_wm8750, | ||
466 | &s3c_device_nand, | ||
467 | &s3c_device_usbgadget, | ||
468 | }; | ||
469 | |||
470 | static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = { | ||
471 | .vbus_pin = S3C2410_GPG(1), /* detect is on GPG1 */ | ||
472 | }; | ||
473 | |||
474 | /* Jive power management device */ | ||
475 | |||
476 | #ifdef CONFIG_PM | ||
477 | static int jive_pm_suspend(void) | ||
478 | { | ||
479 | /* Write the magic value u-boot uses to check for resume into | ||
480 | * the INFORM0 register, and ensure INFORM1 is set to the | ||
481 | * correct address to resume from. */ | ||
482 | |||
483 | __raw_writel(0x2BED, S3C2412_INFORM0); | ||
484 | __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); | ||
485 | |||
486 | return 0; | ||
487 | } | ||
488 | |||
489 | static void jive_pm_resume(void) | ||
490 | { | ||
491 | __raw_writel(0x0, S3C2412_INFORM0); | ||
492 | } | ||
493 | |||
494 | #else | ||
495 | #define jive_pm_suspend NULL | ||
496 | #define jive_pm_resume NULL | ||
497 | #endif | ||
498 | |||
499 | static struct syscore_ops jive_pm_syscore_ops = { | ||
500 | .suspend = jive_pm_suspend, | ||
501 | .resume = jive_pm_resume, | ||
502 | }; | ||
503 | |||
504 | static void __init jive_map_io(void) | ||
505 | { | ||
506 | s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); | ||
507 | s3c24xx_init_clocks(12000000); | ||
508 | s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); | ||
509 | } | ||
510 | |||
511 | static void jive_power_off(void) | ||
512 | { | ||
513 | printk(KERN_INFO "powering system down...\n"); | ||
514 | |||
515 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); | ||
516 | s3c_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); | ||
517 | } | ||
518 | |||
519 | static void __init jive_machine_init(void) | ||
520 | { | ||
521 | /* register system core operations for managing low level suspend */ | ||
522 | |||
523 | register_syscore_ops(&jive_pm_syscore_ops); | ||
524 | |||
525 | /* write our sleep configurations for the IO. Pull down all unused | ||
526 | * IO, ensure that we have turned off all peripherals we do not | ||
527 | * need, and configure the ones we do need. */ | ||
528 | |||
529 | /* Port B sleep */ | ||
530 | |||
531 | __raw_writel(S3C2412_SLPCON_IN(0) | | ||
532 | S3C2412_SLPCON_PULL(1) | | ||
533 | S3C2412_SLPCON_HIGH(2) | | ||
534 | S3C2412_SLPCON_PULL(3) | | ||
535 | S3C2412_SLPCON_PULL(4) | | ||
536 | S3C2412_SLPCON_PULL(5) | | ||
537 | S3C2412_SLPCON_PULL(6) | | ||
538 | S3C2412_SLPCON_HIGH(7) | | ||
539 | S3C2412_SLPCON_PULL(8) | | ||
540 | S3C2412_SLPCON_PULL(9) | | ||
541 | S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON); | ||
542 | |||
543 | /* Port C sleep */ | ||
544 | |||
545 | __raw_writel(S3C2412_SLPCON_PULL(0) | | ||
546 | S3C2412_SLPCON_PULL(1) | | ||
547 | S3C2412_SLPCON_PULL(2) | | ||
548 | S3C2412_SLPCON_PULL(3) | | ||
549 | S3C2412_SLPCON_PULL(4) | | ||
550 | S3C2412_SLPCON_PULL(5) | | ||
551 | S3C2412_SLPCON_LOW(6) | | ||
552 | S3C2412_SLPCON_PULL(6) | | ||
553 | S3C2412_SLPCON_PULL(7) | | ||
554 | S3C2412_SLPCON_PULL(8) | | ||
555 | S3C2412_SLPCON_PULL(9) | | ||
556 | S3C2412_SLPCON_PULL(10) | | ||
557 | S3C2412_SLPCON_PULL(11) | | ||
558 | S3C2412_SLPCON_PULL(12) | | ||
559 | S3C2412_SLPCON_PULL(13) | | ||
560 | S3C2412_SLPCON_PULL(14) | | ||
561 | S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON); | ||
562 | |||
563 | /* Port D sleep */ | ||
564 | |||
565 | __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON); | ||
566 | |||
567 | /* Port F sleep */ | ||
568 | |||
569 | __raw_writel(S3C2412_SLPCON_LOW(0) | | ||
570 | S3C2412_SLPCON_LOW(1) | | ||
571 | S3C2412_SLPCON_LOW(2) | | ||
572 | S3C2412_SLPCON_EINT(3) | | ||
573 | S3C2412_SLPCON_EINT(4) | | ||
574 | S3C2412_SLPCON_EINT(5) | | ||
575 | S3C2412_SLPCON_EINT(6) | | ||
576 | S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON); | ||
577 | |||
578 | /* Port G sleep */ | ||
579 | |||
580 | __raw_writel(S3C2412_SLPCON_IN(0) | | ||
581 | S3C2412_SLPCON_IN(1) | | ||
582 | S3C2412_SLPCON_IN(2) | | ||
583 | S3C2412_SLPCON_IN(3) | | ||
584 | S3C2412_SLPCON_IN(4) | | ||
585 | S3C2412_SLPCON_IN(5) | | ||
586 | S3C2412_SLPCON_IN(6) | | ||
587 | S3C2412_SLPCON_IN(7) | | ||
588 | S3C2412_SLPCON_PULL(8) | | ||
589 | S3C2412_SLPCON_PULL(9) | | ||
590 | S3C2412_SLPCON_IN(10) | | ||
591 | S3C2412_SLPCON_PULL(11) | | ||
592 | S3C2412_SLPCON_PULL(12) | | ||
593 | S3C2412_SLPCON_PULL(13) | | ||
594 | S3C2412_SLPCON_IN(14) | | ||
595 | S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON); | ||
596 | |||
597 | /* Port H sleep */ | ||
598 | |||
599 | __raw_writel(S3C2412_SLPCON_PULL(0) | | ||
600 | S3C2412_SLPCON_PULL(1) | | ||
601 | S3C2412_SLPCON_PULL(2) | | ||
602 | S3C2412_SLPCON_PULL(3) | | ||
603 | S3C2412_SLPCON_PULL(4) | | ||
604 | S3C2412_SLPCON_PULL(5) | | ||
605 | S3C2412_SLPCON_PULL(6) | | ||
606 | S3C2412_SLPCON_IN(7) | | ||
607 | S3C2412_SLPCON_IN(8) | | ||
608 | S3C2412_SLPCON_PULL(9) | | ||
609 | S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON); | ||
610 | |||
611 | /* initialise the power management now we've setup everything. */ | ||
612 | |||
613 | s3c_pm_init(); | ||
614 | |||
615 | /** TODO - check that this is after the cmdline option! */ | ||
616 | s3c_nand_set_platdata(&jive_nand_info); | ||
617 | |||
618 | /* initialise the spi */ | ||
619 | |||
620 | gpio_request(S3C2410_GPG(13), "lcm reset"); | ||
621 | gpio_direction_output(S3C2410_GPG(13), 0); | ||
622 | |||
623 | gpio_request(S3C2410_GPB(7), "jive spi"); | ||
624 | gpio_direction_output(S3C2410_GPB(7), 1); | ||
625 | |||
626 | s3c2410_gpio_setpin(S3C2410_GPB(6), 0); | ||
627 | s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT); | ||
628 | |||
629 | s3c2410_gpio_setpin(S3C2410_GPG(8), 1); | ||
630 | s3c_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPIO_OUTPUT); | ||
631 | |||
632 | /* initialise the WM8750 spi */ | ||
633 | |||
634 | gpio_request(S3C2410_GPH(10), "jive wm8750 spi"); | ||
635 | gpio_direction_output(S3C2410_GPH(10), 1); | ||
636 | |||
637 | /* Turn off suspend on both USB ports, and switch the | ||
638 | * selectable USB port to USB device mode. */ | ||
639 | |||
640 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
641 | S3C2410_MISCCR_USBSUSPND0 | | ||
642 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
643 | |||
644 | s3c24xx_udc_set_platdata(&jive_udc_cfg); | ||
645 | s3c24xx_fb_set_platdata(&jive_lcd_config); | ||
646 | |||
647 | spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs)); | ||
648 | |||
649 | s3c_i2c0_set_platdata(&jive_i2c_cfg); | ||
650 | i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs)); | ||
651 | |||
652 | pm_power_off = jive_power_off; | ||
653 | |||
654 | platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices)); | ||
655 | } | ||
656 | |||
657 | MACHINE_START(JIVE, "JIVE") | ||
658 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
659 | .atag_offset = 0x100, | ||
660 | |||
661 | .init_irq = s3c24xx_init_irq, | ||
662 | .map_io = jive_map_io, | ||
663 | .init_machine = jive_machine_init, | ||
664 | .timer = &s3c24xx_timer, | ||
665 | .restart = s3c2412_restart, | ||
666 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c new file mode 100644 index 000000000000..5d66fb218a41 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c | |||
@@ -0,0 +1,705 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-mini2440.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com> | ||
4 | * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk> | ||
5 | * and modifications by SBZ <sbz@spgui.org> and | ||
6 | * Weibing <http://weibing.blogbus.com> and | ||
7 | * Michel Pollet <buserror@gmail.com> | ||
8 | * | ||
9 | * For product information, visit http://code.google.com/p/mini2440/ | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/io.h> | ||
25 | #include <linux/serial_core.h> | ||
26 | #include <linux/dm9000.h> | ||
27 | #include <linux/i2c/at24.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/gpio_keys.h> | ||
30 | #include <linux/i2c.h> | ||
31 | #include <linux/mmc/host.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | |||
36 | #include <mach/hardware.h> | ||
37 | #include <mach/fb.h> | ||
38 | #include <asm/mach-types.h> | ||
39 | |||
40 | #include <plat/regs-serial.h> | ||
41 | #include <mach/regs-gpio.h> | ||
42 | #include <mach/leds-gpio.h> | ||
43 | #include <mach/regs-mem.h> | ||
44 | #include <mach/regs-lcd.h> | ||
45 | #include <mach/irqs.h> | ||
46 | #include <plat/nand.h> | ||
47 | #include <plat/iic.h> | ||
48 | #include <plat/mci.h> | ||
49 | #include <plat/udc.h> | ||
50 | |||
51 | #include <linux/mtd/mtd.h> | ||
52 | #include <linux/mtd/nand.h> | ||
53 | #include <linux/mtd/nand_ecc.h> | ||
54 | #include <linux/mtd/partitions.h> | ||
55 | |||
56 | #include <plat/gpio-cfg.h> | ||
57 | #include <plat/clock.h> | ||
58 | #include <plat/devs.h> | ||
59 | #include <plat/cpu.h> | ||
60 | |||
61 | #include <sound/s3c24xx_uda134x.h> | ||
62 | |||
63 | #include "common.h" | ||
64 | |||
65 | #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300) | ||
66 | |||
67 | static struct map_desc mini2440_iodesc[] __initdata = { | ||
68 | /* nothing to declare, move along */ | ||
69 | }; | ||
70 | |||
71 | #define UCON S3C2410_UCON_DEFAULT | ||
72 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
73 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
74 | |||
75 | |||
76 | static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = { | ||
77 | [0] = { | ||
78 | .hwport = 0, | ||
79 | .flags = 0, | ||
80 | .ucon = UCON, | ||
81 | .ulcon = ULCON, | ||
82 | .ufcon = UFCON, | ||
83 | }, | ||
84 | [1] = { | ||
85 | .hwport = 1, | ||
86 | .flags = 0, | ||
87 | .ucon = UCON, | ||
88 | .ulcon = ULCON, | ||
89 | .ufcon = UFCON, | ||
90 | }, | ||
91 | [2] = { | ||
92 | .hwport = 2, | ||
93 | .flags = 0, | ||
94 | .ucon = UCON, | ||
95 | .ulcon = ULCON, | ||
96 | .ufcon = UFCON, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | /* USB device UDC support */ | ||
101 | |||
102 | static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = { | ||
103 | .pullup_pin = S3C2410_GPC(5), | ||
104 | }; | ||
105 | |||
106 | |||
107 | /* LCD timing and setup */ | ||
108 | |||
109 | /* | ||
110 | * This macro simplifies the table bellow | ||
111 | */ | ||
112 | #define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \ | ||
113 | _yres,margin_top,margin_bottom,vsync, refresh) \ | ||
114 | .width = _xres, \ | ||
115 | .xres = _xres, \ | ||
116 | .height = _yres, \ | ||
117 | .yres = _yres, \ | ||
118 | .left_margin = margin_left, \ | ||
119 | .right_margin = margin_right, \ | ||
120 | .upper_margin = margin_top, \ | ||
121 | .lower_margin = margin_bottom, \ | ||
122 | .hsync_len = hsync, \ | ||
123 | .vsync_len = vsync, \ | ||
124 | .pixclock = ((_clock*100000000000LL) / \ | ||
125 | ((refresh) * \ | ||
126 | (hsync + margin_left + _xres + margin_right) * \ | ||
127 | (vsync + margin_top + _yres + margin_bottom))), \ | ||
128 | .bpp = 16,\ | ||
129 | .type = (S3C2410_LCDCON1_TFT16BPP |\ | ||
130 | S3C2410_LCDCON1_TFT) | ||
131 | |||
132 | static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = { | ||
133 | [0] = { /* mini2440 + 3.5" TFT + touchscreen */ | ||
134 | _LCD_DECLARE( | ||
135 | 7, /* The 3.5 is quite fast */ | ||
136 | 240, 21, 38, 6, /* x timing */ | ||
137 | 320, 4, 4, 2, /* y timing */ | ||
138 | 60), /* refresh rate */ | ||
139 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 | | ||
140 | S3C2410_LCDCON5_INVVLINE | | ||
141 | S3C2410_LCDCON5_INVVFRAME | | ||
142 | S3C2410_LCDCON5_INVVDEN | | ||
143 | S3C2410_LCDCON5_PWREN), | ||
144 | }, | ||
145 | [1] = { /* mini2440 + 7" TFT + touchscreen */ | ||
146 | _LCD_DECLARE( | ||
147 | 10, /* the 7" runs slower */ | ||
148 | 800, 40, 40, 48, /* x timing */ | ||
149 | 480, 29, 3, 3, /* y timing */ | ||
150 | 50), /* refresh rate */ | ||
151 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 | | ||
152 | S3C2410_LCDCON5_INVVLINE | | ||
153 | S3C2410_LCDCON5_INVVFRAME | | ||
154 | S3C2410_LCDCON5_PWREN), | ||
155 | }, | ||
156 | /* The VGA shield can outout at several resolutions. All share | ||
157 | * the same timings, however, anything smaller than 1024x768 | ||
158 | * will only be displayed in the top left corner of a 1024x768 | ||
159 | * XGA output unless you add optional dip switches to the shield. | ||
160 | * Therefore timings for other resolutions have been omitted here. | ||
161 | */ | ||
162 | [2] = { | ||
163 | _LCD_DECLARE( | ||
164 | 10, | ||
165 | 1024, 1, 2, 2, /* y timing */ | ||
166 | 768, 200, 16, 16, /* x timing */ | ||
167 | 24), /* refresh rate, maximum stable, | ||
168 | tested with the FPGA shield */ | ||
169 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 | | ||
170 | S3C2410_LCDCON5_HWSWP), | ||
171 | }, | ||
172 | /* mini2440 + 3.5" TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/ | ||
173 | [3] = { | ||
174 | _LCD_DECLARE( | ||
175 | /* clock */ | ||
176 | 7, | ||
177 | /* xres, margin_right, margin_left, hsync */ | ||
178 | 320, 68, 66, 4, | ||
179 | /* yres, margin_top, margin_bottom, vsync */ | ||
180 | 240, 4, 4, 9, | ||
181 | /* refresh rate */ | ||
182 | 60), | ||
183 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 | | ||
184 | S3C2410_LCDCON5_INVVDEN | | ||
185 | S3C2410_LCDCON5_INVVFRAME | | ||
186 | S3C2410_LCDCON5_INVVLINE | | ||
187 | S3C2410_LCDCON5_INVVCLK | | ||
188 | S3C2410_LCDCON5_HWSWP), | ||
189 | }, | ||
190 | }; | ||
191 | |||
192 | /* todo - put into gpio header */ | ||
193 | |||
194 | #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2)) | ||
195 | #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2)) | ||
196 | |||
197 | static struct s3c2410fb_mach_info mini2440_fb_info __initdata = { | ||
198 | .displays = &mini2440_lcd_cfg[0], /* not constant! see init */ | ||
199 | .num_displays = 1, | ||
200 | .default_display = 0, | ||
201 | |||
202 | /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN | ||
203 | * and disable the pull down resistors on pins we are using for LCD | ||
204 | * data. */ | ||
205 | |||
206 | .gpcup = (0xf << 1) | (0x3f << 10), | ||
207 | |||
208 | .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE | | ||
209 | S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM | | ||
210 | S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 | | ||
211 | S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 | | ||
212 | S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7), | ||
213 | |||
214 | .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) | | ||
215 | S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) | | ||
216 | S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) | | ||
217 | S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) | | ||
218 | S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)), | ||
219 | |||
220 | .gpdup = (0x3f << 2) | (0x3f << 10), | ||
221 | |||
222 | .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 | | ||
223 | S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 | | ||
224 | S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 | | ||
225 | S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 | | ||
226 | S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 | | ||
227 | S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23), | ||
228 | |||
229 | .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) | | ||
230 | S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) | | ||
231 | S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) | | ||
232 | S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)| | ||
233 | S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)| | ||
234 | S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)), | ||
235 | }; | ||
236 | |||
237 | /* MMC/SD */ | ||
238 | |||
239 | static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = { | ||
240 | .gpio_detect = S3C2410_GPG(8), | ||
241 | .gpio_wprotect = S3C2410_GPH(8), | ||
242 | .set_power = NULL, | ||
243 | .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34, | ||
244 | }; | ||
245 | |||
246 | /* NAND Flash on MINI2440 board */ | ||
247 | |||
248 | static struct mtd_partition mini2440_default_nand_part[] __initdata = { | ||
249 | [0] = { | ||
250 | .name = "u-boot", | ||
251 | .size = SZ_256K, | ||
252 | .offset = 0, | ||
253 | }, | ||
254 | [1] = { | ||
255 | .name = "u-boot-env", | ||
256 | .size = SZ_128K, | ||
257 | .offset = SZ_256K, | ||
258 | }, | ||
259 | [2] = { | ||
260 | .name = "kernel", | ||
261 | /* 5 megabytes, for a kernel with no modules | ||
262 | * or a uImage with a ramdisk attached */ | ||
263 | .size = 0x00500000, | ||
264 | .offset = SZ_256K + SZ_128K, | ||
265 | }, | ||
266 | [3] = { | ||
267 | .name = "root", | ||
268 | .offset = SZ_256K + SZ_128K + 0x00500000, | ||
269 | .size = MTDPART_SIZ_FULL, | ||
270 | }, | ||
271 | }; | ||
272 | |||
273 | static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = { | ||
274 | [0] = { | ||
275 | .name = "nand", | ||
276 | .nr_chips = 1, | ||
277 | .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part), | ||
278 | .partitions = mini2440_default_nand_part, | ||
279 | .flash_bbt = 1, /* we use u-boot to create a BBT */ | ||
280 | }, | ||
281 | }; | ||
282 | |||
283 | static struct s3c2410_platform_nand mini2440_nand_info __initdata = { | ||
284 | .tacls = 0, | ||
285 | .twrph0 = 25, | ||
286 | .twrph1 = 15, | ||
287 | .nr_sets = ARRAY_SIZE(mini2440_nand_sets), | ||
288 | .sets = mini2440_nand_sets, | ||
289 | .ignore_unset_ecc = 1, | ||
290 | }; | ||
291 | |||
292 | /* DM9000AEP 10/100 ethernet controller */ | ||
293 | |||
294 | static struct resource mini2440_dm9k_resource[] = { | ||
295 | [0] = { | ||
296 | .start = MACH_MINI2440_DM9K_BASE, | ||
297 | .end = MACH_MINI2440_DM9K_BASE + 3, | ||
298 | .flags = IORESOURCE_MEM | ||
299 | }, | ||
300 | [1] = { | ||
301 | .start = MACH_MINI2440_DM9K_BASE + 4, | ||
302 | .end = MACH_MINI2440_DM9K_BASE + 7, | ||
303 | .flags = IORESOURCE_MEM | ||
304 | }, | ||
305 | [2] = { | ||
306 | .start = IRQ_EINT7, | ||
307 | .end = IRQ_EINT7, | ||
308 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
309 | } | ||
310 | }; | ||
311 | |||
312 | /* | ||
313 | * The DM9000 has no eeprom, and it's MAC address is set by | ||
314 | * the bootloader before starting the kernel. | ||
315 | */ | ||
316 | static struct dm9000_plat_data mini2440_dm9k_pdata = { | ||
317 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), | ||
318 | }; | ||
319 | |||
320 | static struct platform_device mini2440_device_eth = { | ||
321 | .name = "dm9000", | ||
322 | .id = -1, | ||
323 | .num_resources = ARRAY_SIZE(mini2440_dm9k_resource), | ||
324 | .resource = mini2440_dm9k_resource, | ||
325 | .dev = { | ||
326 | .platform_data = &mini2440_dm9k_pdata, | ||
327 | }, | ||
328 | }; | ||
329 | |||
330 | /* CON5 | ||
331 | * +--+ /-----\ | ||
332 | * | | | | | ||
333 | * | | | BAT | | ||
334 | * | | \_____/ | ||
335 | * | | | ||
336 | * | | +----+ +----+ | ||
337 | * | | | K5 | | K1 | | ||
338 | * | | +----+ +----+ | ||
339 | * | | +----+ +----+ | ||
340 | * | | | K4 | | K2 | | ||
341 | * | | +----+ +----+ | ||
342 | * | | +----+ +----+ | ||
343 | * | | | K6 | | K3 | | ||
344 | * | | +----+ +----+ | ||
345 | * ..... | ||
346 | */ | ||
347 | static struct gpio_keys_button mini2440_buttons[] = { | ||
348 | { | ||
349 | .gpio = S3C2410_GPG(0), /* K1 */ | ||
350 | .code = KEY_F1, | ||
351 | .desc = "Button 1", | ||
352 | .active_low = 1, | ||
353 | }, | ||
354 | { | ||
355 | .gpio = S3C2410_GPG(3), /* K2 */ | ||
356 | .code = KEY_F2, | ||
357 | .desc = "Button 2", | ||
358 | .active_low = 1, | ||
359 | }, | ||
360 | { | ||
361 | .gpio = S3C2410_GPG(5), /* K3 */ | ||
362 | .code = KEY_F3, | ||
363 | .desc = "Button 3", | ||
364 | .active_low = 1, | ||
365 | }, | ||
366 | { | ||
367 | .gpio = S3C2410_GPG(6), /* K4 */ | ||
368 | .code = KEY_POWER, | ||
369 | .desc = "Power", | ||
370 | .active_low = 1, | ||
371 | }, | ||
372 | { | ||
373 | .gpio = S3C2410_GPG(7), /* K5 */ | ||
374 | .code = KEY_F5, | ||
375 | .desc = "Button 5", | ||
376 | .active_low = 1, | ||
377 | }, | ||
378 | #if 0 | ||
379 | /* this pin is also known as TCLK1 and seems to already | ||
380 | * marked as "in use" somehow in the kernel -- possibly wrongly */ | ||
381 | { | ||
382 | .gpio = S3C2410_GPG(11), /* K6 */ | ||
383 | .code = KEY_F6, | ||
384 | .desc = "Button 6", | ||
385 | .active_low = 1, | ||
386 | }, | ||
387 | #endif | ||
388 | }; | ||
389 | |||
390 | static struct gpio_keys_platform_data mini2440_button_data = { | ||
391 | .buttons = mini2440_buttons, | ||
392 | .nbuttons = ARRAY_SIZE(mini2440_buttons), | ||
393 | }; | ||
394 | |||
395 | static struct platform_device mini2440_button_device = { | ||
396 | .name = "gpio-keys", | ||
397 | .id = -1, | ||
398 | .dev = { | ||
399 | .platform_data = &mini2440_button_data, | ||
400 | } | ||
401 | }; | ||
402 | |||
403 | /* LEDS */ | ||
404 | |||
405 | static struct s3c24xx_led_platdata mini2440_led1_pdata = { | ||
406 | .name = "led1", | ||
407 | .gpio = S3C2410_GPB(5), | ||
408 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
409 | .def_trigger = "heartbeat", | ||
410 | }; | ||
411 | |||
412 | static struct s3c24xx_led_platdata mini2440_led2_pdata = { | ||
413 | .name = "led2", | ||
414 | .gpio = S3C2410_GPB(6), | ||
415 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
416 | .def_trigger = "nand-disk", | ||
417 | }; | ||
418 | |||
419 | static struct s3c24xx_led_platdata mini2440_led3_pdata = { | ||
420 | .name = "led3", | ||
421 | .gpio = S3C2410_GPB(7), | ||
422 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
423 | .def_trigger = "mmc0", | ||
424 | }; | ||
425 | |||
426 | static struct s3c24xx_led_platdata mini2440_led4_pdata = { | ||
427 | .name = "led4", | ||
428 | .gpio = S3C2410_GPB(8), | ||
429 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
430 | .def_trigger = "", | ||
431 | }; | ||
432 | |||
433 | static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = { | ||
434 | .name = "backlight", | ||
435 | .gpio = S3C2410_GPG(4), | ||
436 | .def_trigger = "backlight", | ||
437 | }; | ||
438 | |||
439 | static struct platform_device mini2440_led1 = { | ||
440 | .name = "s3c24xx_led", | ||
441 | .id = 1, | ||
442 | .dev = { | ||
443 | .platform_data = &mini2440_led1_pdata, | ||
444 | }, | ||
445 | }; | ||
446 | |||
447 | static struct platform_device mini2440_led2 = { | ||
448 | .name = "s3c24xx_led", | ||
449 | .id = 2, | ||
450 | .dev = { | ||
451 | .platform_data = &mini2440_led2_pdata, | ||
452 | }, | ||
453 | }; | ||
454 | |||
455 | static struct platform_device mini2440_led3 = { | ||
456 | .name = "s3c24xx_led", | ||
457 | .id = 3, | ||
458 | .dev = { | ||
459 | .platform_data = &mini2440_led3_pdata, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | static struct platform_device mini2440_led4 = { | ||
464 | .name = "s3c24xx_led", | ||
465 | .id = 4, | ||
466 | .dev = { | ||
467 | .platform_data = &mini2440_led4_pdata, | ||
468 | }, | ||
469 | }; | ||
470 | |||
471 | static struct platform_device mini2440_led_backlight = { | ||
472 | .name = "s3c24xx_led", | ||
473 | .id = 5, | ||
474 | .dev = { | ||
475 | .platform_data = &mini2440_led_backlight_pdata, | ||
476 | }, | ||
477 | }; | ||
478 | |||
479 | /* AUDIO */ | ||
480 | |||
481 | static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = { | ||
482 | .l3_clk = S3C2410_GPB(4), | ||
483 | .l3_mode = S3C2410_GPB(2), | ||
484 | .l3_data = S3C2410_GPB(3), | ||
485 | .model = UDA134X_UDA1341 | ||
486 | }; | ||
487 | |||
488 | static struct platform_device mini2440_audio = { | ||
489 | .name = "s3c24xx_uda134x", | ||
490 | .id = 0, | ||
491 | .dev = { | ||
492 | .platform_data = &mini2440_audio_pins, | ||
493 | }, | ||
494 | }; | ||
495 | |||
496 | /* | ||
497 | * I2C devices | ||
498 | */ | ||
499 | static struct at24_platform_data at24c08 = { | ||
500 | .byte_len = SZ_8K / 8, | ||
501 | .page_size = 16, | ||
502 | }; | ||
503 | |||
504 | static struct i2c_board_info mini2440_i2c_devs[] __initdata = { | ||
505 | { | ||
506 | I2C_BOARD_INFO("24c08", 0x50), | ||
507 | .platform_data = &at24c08, | ||
508 | }, | ||
509 | }; | ||
510 | |||
511 | static struct platform_device uda1340_codec = { | ||
512 | .name = "uda134x-codec", | ||
513 | .id = -1, | ||
514 | }; | ||
515 | |||
516 | static struct platform_device *mini2440_devices[] __initdata = { | ||
517 | &s3c_device_ohci, | ||
518 | &s3c_device_wdt, | ||
519 | &s3c_device_i2c0, | ||
520 | &s3c_device_rtc, | ||
521 | &s3c_device_usbgadget, | ||
522 | &mini2440_device_eth, | ||
523 | &mini2440_led1, | ||
524 | &mini2440_led2, | ||
525 | &mini2440_led3, | ||
526 | &mini2440_led4, | ||
527 | &mini2440_button_device, | ||
528 | &s3c_device_nand, | ||
529 | &s3c_device_sdi, | ||
530 | &s3c_device_iis, | ||
531 | &uda1340_codec, | ||
532 | &mini2440_audio, | ||
533 | &samsung_asoc_dma, | ||
534 | }; | ||
535 | |||
536 | static void __init mini2440_map_io(void) | ||
537 | { | ||
538 | s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); | ||
539 | s3c24xx_init_clocks(12000000); | ||
540 | s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); | ||
541 | } | ||
542 | |||
543 | /* | ||
544 | * mini2440_features string | ||
545 | * | ||
546 | * t = Touchscreen present | ||
547 | * b = backlight control | ||
548 | * c = camera [TODO] | ||
549 | * 0-9 LCD configuration | ||
550 | * | ||
551 | */ | ||
552 | static char mini2440_features_str[12] __initdata = "0tb"; | ||
553 | |||
554 | static int __init mini2440_features_setup(char *str) | ||
555 | { | ||
556 | if (str) | ||
557 | strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str)); | ||
558 | return 1; | ||
559 | } | ||
560 | |||
561 | __setup("mini2440=", mini2440_features_setup); | ||
562 | |||
563 | #define FEATURE_SCREEN (1 << 0) | ||
564 | #define FEATURE_BACKLIGHT (1 << 1) | ||
565 | #define FEATURE_TOUCH (1 << 2) | ||
566 | #define FEATURE_CAMERA (1 << 3) | ||
567 | |||
568 | struct mini2440_features_t { | ||
569 | int count; | ||
570 | int done; | ||
571 | int lcd_index; | ||
572 | struct platform_device *optional[8]; | ||
573 | }; | ||
574 | |||
575 | static void __init mini2440_parse_features( | ||
576 | struct mini2440_features_t * features, | ||
577 | const char * features_str ) | ||
578 | { | ||
579 | const char * fp = features_str; | ||
580 | |||
581 | features->count = 0; | ||
582 | features->done = 0; | ||
583 | features->lcd_index = -1; | ||
584 | |||
585 | while (*fp) { | ||
586 | char f = *fp++; | ||
587 | |||
588 | switch (f) { | ||
589 | case '0'...'9': /* tft screen */ | ||
590 | if (features->done & FEATURE_SCREEN) { | ||
591 | printk(KERN_INFO "MINI2440: '%c' ignored, " | ||
592 | "screen type already set\n", f); | ||
593 | } else { | ||
594 | int li = f - '0'; | ||
595 | if (li >= ARRAY_SIZE(mini2440_lcd_cfg)) | ||
596 | printk(KERN_INFO "MINI2440: " | ||
597 | "'%c' out of range LCD mode\n", f); | ||
598 | else { | ||
599 | features->optional[features->count++] = | ||
600 | &s3c_device_lcd; | ||
601 | features->lcd_index = li; | ||
602 | } | ||
603 | } | ||
604 | features->done |= FEATURE_SCREEN; | ||
605 | break; | ||
606 | case 'b': | ||
607 | if (features->done & FEATURE_BACKLIGHT) | ||
608 | printk(KERN_INFO "MINI2440: '%c' ignored, " | ||
609 | "backlight already set\n", f); | ||
610 | else { | ||
611 | features->optional[features->count++] = | ||
612 | &mini2440_led_backlight; | ||
613 | } | ||
614 | features->done |= FEATURE_BACKLIGHT; | ||
615 | break; | ||
616 | case 't': | ||
617 | printk(KERN_INFO "MINI2440: '%c' ignored, " | ||
618 | "touchscreen not compiled in\n", f); | ||
619 | break; | ||
620 | case 'c': | ||
621 | if (features->done & FEATURE_CAMERA) | ||
622 | printk(KERN_INFO "MINI2440: '%c' ignored, " | ||
623 | "camera already registered\n", f); | ||
624 | else | ||
625 | features->optional[features->count++] = | ||
626 | &s3c_device_camif; | ||
627 | features->done |= FEATURE_CAMERA; | ||
628 | break; | ||
629 | } | ||
630 | } | ||
631 | } | ||
632 | |||
633 | static void __init mini2440_init(void) | ||
634 | { | ||
635 | struct mini2440_features_t features = { 0 }; | ||
636 | int i; | ||
637 | |||
638 | printk(KERN_INFO "MINI2440: Option string mini2440=%s\n", | ||
639 | mini2440_features_str); | ||
640 | |||
641 | /* Parse the feature string */ | ||
642 | mini2440_parse_features(&features, mini2440_features_str); | ||
643 | |||
644 | /* turn LCD on */ | ||
645 | s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); | ||
646 | |||
647 | /* Turn the backlight early on */ | ||
648 | WARN_ON(gpio_request(S3C2410_GPG(4), "backlight")); | ||
649 | gpio_direction_output(S3C2410_GPG(4), 1); | ||
650 | |||
651 | /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */ | ||
652 | s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP); | ||
653 | s3c2410_gpio_setpin(S3C2410_GPB(1), 0); | ||
654 | s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT); | ||
655 | |||
656 | /* mark the key as input, without pullups (there is one on the board) */ | ||
657 | for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) { | ||
658 | s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP); | ||
659 | s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT); | ||
660 | } | ||
661 | if (features.lcd_index != -1) { | ||
662 | int li; | ||
663 | |||
664 | mini2440_fb_info.displays = | ||
665 | &mini2440_lcd_cfg[features.lcd_index]; | ||
666 | |||
667 | printk(KERN_INFO "MINI2440: LCD"); | ||
668 | for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++) | ||
669 | if (li == features.lcd_index) | ||
670 | printk(" [%d:%dx%d]", li, | ||
671 | mini2440_lcd_cfg[li].width, | ||
672 | mini2440_lcd_cfg[li].height); | ||
673 | else | ||
674 | printk(" %d:%dx%d", li, | ||
675 | mini2440_lcd_cfg[li].width, | ||
676 | mini2440_lcd_cfg[li].height); | ||
677 | printk("\n"); | ||
678 | s3c24xx_fb_set_platdata(&mini2440_fb_info); | ||
679 | } | ||
680 | |||
681 | s3c24xx_udc_set_platdata(&mini2440_udc_cfg); | ||
682 | s3c24xx_mci_set_platdata(&mini2440_mmc_cfg); | ||
683 | s3c_nand_set_platdata(&mini2440_nand_info); | ||
684 | s3c_i2c0_set_platdata(NULL); | ||
685 | |||
686 | i2c_register_board_info(0, mini2440_i2c_devs, | ||
687 | ARRAY_SIZE(mini2440_i2c_devs)); | ||
688 | |||
689 | platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices)); | ||
690 | |||
691 | if (features.count) /* the optional features */ | ||
692 | platform_add_devices(features.optional, features.count); | ||
693 | |||
694 | } | ||
695 | |||
696 | |||
697 | MACHINE_START(MINI2440, "MINI2440") | ||
698 | /* Maintainer: Michel Pollet <buserror@gmail.com> */ | ||
699 | .atag_offset = 0x100, | ||
700 | .map_io = mini2440_map_io, | ||
701 | .init_machine = mini2440_init, | ||
702 | .init_irq = s3c24xx_init_irq, | ||
703 | .timer = &s3c24xx_timer, | ||
704 | .restart = s3c244x_restart, | ||
705 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c new file mode 100644 index 000000000000..383d00ca8f60 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-n30.c | |||
@@ -0,0 +1,608 @@ | |||
1 | /* Machine specific code for the Acer n30, Acer N35, Navman PiN 570, | ||
2 | * Yakumo AlphaX and Airis NC05 PDAs. | ||
3 | * | ||
4 | * Copyright (c) 2003-2005 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se> | ||
8 | * | ||
9 | * There is a wiki with more information about the n30 port at | ||
10 | * http://handhelds.org/moin/moin.cgi/AcerN30Documentation . | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/types.h> | ||
19 | |||
20 | #include <linux/gpio_keys.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/serial_core.h> | ||
27 | #include <linux/timer.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/mmc/host.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | |||
35 | #include <mach/fb.h> | ||
36 | #include <mach/leds-gpio.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | #include <mach/regs-lcd.h> | ||
39 | |||
40 | #include <asm/mach/arch.h> | ||
41 | #include <asm/mach/irq.h> | ||
42 | #include <asm/mach/map.h> | ||
43 | |||
44 | #include <plat/iic.h> | ||
45 | #include <plat/regs-serial.h> | ||
46 | |||
47 | #include <plat/clock.h> | ||
48 | #include <plat/cpu.h> | ||
49 | #include <plat/devs.h> | ||
50 | #include <plat/mci.h> | ||
51 | #include <plat/s3c2410.h> | ||
52 | #include <plat/udc.h> | ||
53 | |||
54 | #include "common.h" | ||
55 | |||
56 | static struct map_desc n30_iodesc[] __initdata = { | ||
57 | /* nothing here yet */ | ||
58 | }; | ||
59 | |||
60 | static struct s3c2410_uartcfg n30_uartcfgs[] = { | ||
61 | /* Normal serial port */ | ||
62 | [0] = { | ||
63 | .hwport = 0, | ||
64 | .flags = 0, | ||
65 | .ucon = 0x2c5, | ||
66 | .ulcon = 0x03, | ||
67 | .ufcon = 0x51, | ||
68 | }, | ||
69 | /* IR port */ | ||
70 | [1] = { | ||
71 | .hwport = 1, | ||
72 | .flags = 0, | ||
73 | .uart_flags = UPF_CONS_FLOW, | ||
74 | .ucon = 0x2c5, | ||
75 | .ulcon = 0x43, | ||
76 | .ufcon = 0x51, | ||
77 | }, | ||
78 | /* On the N30 the bluetooth controller is connected here. | ||
79 | * On the N35 and variants the GPS receiver is connected here. */ | ||
80 | [2] = { | ||
81 | .hwport = 2, | ||
82 | .flags = 0, | ||
83 | .ucon = 0x2c5, | ||
84 | .ulcon = 0x03, | ||
85 | .ufcon = 0x51, | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { | ||
90 | .vbus_pin = S3C2410_GPG(1), | ||
91 | .vbus_pin_inverted = 0, | ||
92 | .pullup_pin = S3C2410_GPB(3), | ||
93 | }; | ||
94 | |||
95 | static struct gpio_keys_button n30_buttons[] = { | ||
96 | { | ||
97 | .gpio = S3C2410_GPF(0), | ||
98 | .code = KEY_POWER, | ||
99 | .desc = "Power", | ||
100 | .active_low = 0, | ||
101 | }, | ||
102 | { | ||
103 | .gpio = S3C2410_GPG(9), | ||
104 | .code = KEY_UP, | ||
105 | .desc = "Thumbwheel Up", | ||
106 | .active_low = 0, | ||
107 | }, | ||
108 | { | ||
109 | .gpio = S3C2410_GPG(8), | ||
110 | .code = KEY_DOWN, | ||
111 | .desc = "Thumbwheel Down", | ||
112 | .active_low = 0, | ||
113 | }, | ||
114 | { | ||
115 | .gpio = S3C2410_GPG(7), | ||
116 | .code = KEY_ENTER, | ||
117 | .desc = "Thumbwheel Press", | ||
118 | .active_low = 0, | ||
119 | }, | ||
120 | { | ||
121 | .gpio = S3C2410_GPF(7), | ||
122 | .code = KEY_HOMEPAGE, | ||
123 | .desc = "Home", | ||
124 | .active_low = 0, | ||
125 | }, | ||
126 | { | ||
127 | .gpio = S3C2410_GPF(6), | ||
128 | .code = KEY_CALENDAR, | ||
129 | .desc = "Calendar", | ||
130 | .active_low = 0, | ||
131 | }, | ||
132 | { | ||
133 | .gpio = S3C2410_GPF(5), | ||
134 | .code = KEY_ADDRESSBOOK, | ||
135 | .desc = "Contacts", | ||
136 | .active_low = 0, | ||
137 | }, | ||
138 | { | ||
139 | .gpio = S3C2410_GPF(4), | ||
140 | .code = KEY_MAIL, | ||
141 | .desc = "Mail", | ||
142 | .active_low = 0, | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | static struct gpio_keys_platform_data n30_button_data = { | ||
147 | .buttons = n30_buttons, | ||
148 | .nbuttons = ARRAY_SIZE(n30_buttons), | ||
149 | }; | ||
150 | |||
151 | static struct platform_device n30_button_device = { | ||
152 | .name = "gpio-keys", | ||
153 | .id = -1, | ||
154 | .dev = { | ||
155 | .platform_data = &n30_button_data, | ||
156 | } | ||
157 | }; | ||
158 | |||
159 | static struct gpio_keys_button n35_buttons[] = { | ||
160 | { | ||
161 | .gpio = S3C2410_GPF(0), | ||
162 | .code = KEY_POWER, | ||
163 | .type = EV_PWR, | ||
164 | .desc = "Power", | ||
165 | .active_low = 0, | ||
166 | .wakeup = 1, | ||
167 | }, | ||
168 | { | ||
169 | .gpio = S3C2410_GPG(9), | ||
170 | .code = KEY_UP, | ||
171 | .desc = "Joystick Up", | ||
172 | .active_low = 0, | ||
173 | }, | ||
174 | { | ||
175 | .gpio = S3C2410_GPG(8), | ||
176 | .code = KEY_DOWN, | ||
177 | .desc = "Joystick Down", | ||
178 | .active_low = 0, | ||
179 | }, | ||
180 | { | ||
181 | .gpio = S3C2410_GPG(6), | ||
182 | .code = KEY_DOWN, | ||
183 | .desc = "Joystick Left", | ||
184 | .active_low = 0, | ||
185 | }, | ||
186 | { | ||
187 | .gpio = S3C2410_GPG(5), | ||
188 | .code = KEY_DOWN, | ||
189 | .desc = "Joystick Right", | ||
190 | .active_low = 0, | ||
191 | }, | ||
192 | { | ||
193 | .gpio = S3C2410_GPG(7), | ||
194 | .code = KEY_ENTER, | ||
195 | .desc = "Joystick Press", | ||
196 | .active_low = 0, | ||
197 | }, | ||
198 | { | ||
199 | .gpio = S3C2410_GPF(7), | ||
200 | .code = KEY_HOMEPAGE, | ||
201 | .desc = "Home", | ||
202 | .active_low = 0, | ||
203 | }, | ||
204 | { | ||
205 | .gpio = S3C2410_GPF(6), | ||
206 | .code = KEY_CALENDAR, | ||
207 | .desc = "Calendar", | ||
208 | .active_low = 0, | ||
209 | }, | ||
210 | { | ||
211 | .gpio = S3C2410_GPF(5), | ||
212 | .code = KEY_ADDRESSBOOK, | ||
213 | .desc = "Contacts", | ||
214 | .active_low = 0, | ||
215 | }, | ||
216 | { | ||
217 | .gpio = S3C2410_GPF(4), | ||
218 | .code = KEY_MAIL, | ||
219 | .desc = "Mail", | ||
220 | .active_low = 0, | ||
221 | }, | ||
222 | { | ||
223 | .gpio = S3C2410_GPF(3), | ||
224 | .code = SW_RADIO, | ||
225 | .desc = "GPS Antenna", | ||
226 | .active_low = 0, | ||
227 | }, | ||
228 | { | ||
229 | .gpio = S3C2410_GPG(2), | ||
230 | .code = SW_HEADPHONE_INSERT, | ||
231 | .desc = "Headphone", | ||
232 | .active_low = 0, | ||
233 | }, | ||
234 | }; | ||
235 | |||
236 | static struct gpio_keys_platform_data n35_button_data = { | ||
237 | .buttons = n35_buttons, | ||
238 | .nbuttons = ARRAY_SIZE(n35_buttons), | ||
239 | }; | ||
240 | |||
241 | static struct platform_device n35_button_device = { | ||
242 | .name = "gpio-keys", | ||
243 | .id = -1, | ||
244 | .num_resources = 0, | ||
245 | .dev = { | ||
246 | .platform_data = &n35_button_data, | ||
247 | } | ||
248 | }; | ||
249 | |||
250 | /* This is the bluetooth LED on the device. */ | ||
251 | static struct s3c24xx_led_platdata n30_blue_led_pdata = { | ||
252 | .name = "blue_led", | ||
253 | .gpio = S3C2410_GPG(6), | ||
254 | .def_trigger = "", | ||
255 | }; | ||
256 | |||
257 | /* This is the blue LED on the device. Originally used to indicate GPS activity | ||
258 | * by flashing. */ | ||
259 | static struct s3c24xx_led_platdata n35_blue_led_pdata = { | ||
260 | .name = "blue_led", | ||
261 | .gpio = S3C2410_GPD(8), | ||
262 | .def_trigger = "", | ||
263 | }; | ||
264 | |||
265 | /* This LED is driven by the battery microcontroller, and is blinking | ||
266 | * red, blinking green or solid green when the battery is low, | ||
267 | * charging or full respectively. By driving GPD9 low, it's possible | ||
268 | * to force the LED to blink red, so call that warning LED. */ | ||
269 | static struct s3c24xx_led_platdata n30_warning_led_pdata = { | ||
270 | .name = "warning_led", | ||
271 | .flags = S3C24XX_LEDF_ACTLOW, | ||
272 | .gpio = S3C2410_GPD(9), | ||
273 | .def_trigger = "", | ||
274 | }; | ||
275 | |||
276 | static struct s3c24xx_led_platdata n35_warning_led_pdata = { | ||
277 | .name = "warning_led", | ||
278 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
279 | .gpio = S3C2410_GPD(9), | ||
280 | .def_trigger = "", | ||
281 | }; | ||
282 | |||
283 | static struct platform_device n30_blue_led = { | ||
284 | .name = "s3c24xx_led", | ||
285 | .id = 1, | ||
286 | .dev = { | ||
287 | .platform_data = &n30_blue_led_pdata, | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | static struct platform_device n35_blue_led = { | ||
292 | .name = "s3c24xx_led", | ||
293 | .id = 1, | ||
294 | .dev = { | ||
295 | .platform_data = &n35_blue_led_pdata, | ||
296 | }, | ||
297 | }; | ||
298 | |||
299 | static struct platform_device n30_warning_led = { | ||
300 | .name = "s3c24xx_led", | ||
301 | .id = 2, | ||
302 | .dev = { | ||
303 | .platform_data = &n30_warning_led_pdata, | ||
304 | }, | ||
305 | }; | ||
306 | |||
307 | static struct platform_device n35_warning_led = { | ||
308 | .name = "s3c24xx_led", | ||
309 | .id = 2, | ||
310 | .dev = { | ||
311 | .platform_data = &n35_warning_led_pdata, | ||
312 | }, | ||
313 | }; | ||
314 | |||
315 | static struct s3c2410fb_display n30_display __initdata = { | ||
316 | .type = S3C2410_LCDCON1_TFT, | ||
317 | .width = 240, | ||
318 | .height = 320, | ||
319 | .pixclock = 170000, | ||
320 | |||
321 | .xres = 240, | ||
322 | .yres = 320, | ||
323 | .bpp = 16, | ||
324 | .left_margin = 3, | ||
325 | .right_margin = 40, | ||
326 | .hsync_len = 40, | ||
327 | .upper_margin = 2, | ||
328 | .lower_margin = 3, | ||
329 | .vsync_len = 2, | ||
330 | |||
331 | .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME, | ||
332 | }; | ||
333 | |||
334 | static struct s3c2410fb_mach_info n30_fb_info __initdata = { | ||
335 | .displays = &n30_display, | ||
336 | .num_displays = 1, | ||
337 | .default_display = 0, | ||
338 | .lpcsel = 0x06, | ||
339 | }; | ||
340 | |||
341 | static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd) | ||
342 | { | ||
343 | switch (power_mode) { | ||
344 | case MMC_POWER_ON: | ||
345 | case MMC_POWER_UP: | ||
346 | gpio_set_value(S3C2410_GPG(4), 1); | ||
347 | break; | ||
348 | case MMC_POWER_OFF: | ||
349 | default: | ||
350 | gpio_set_value(S3C2410_GPG(4), 0); | ||
351 | break; | ||
352 | } | ||
353 | } | ||
354 | |||
355 | static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = { | ||
356 | .gpio_detect = S3C2410_GPF(1), | ||
357 | .gpio_wprotect = S3C2410_GPG(10), | ||
358 | .ocr_avail = MMC_VDD_32_33, | ||
359 | .set_power = n30_sdi_set_power, | ||
360 | }; | ||
361 | |||
362 | static struct platform_device *n30_devices[] __initdata = { | ||
363 | &s3c_device_lcd, | ||
364 | &s3c_device_wdt, | ||
365 | &s3c_device_i2c0, | ||
366 | &s3c_device_iis, | ||
367 | &s3c_device_ohci, | ||
368 | &s3c_device_rtc, | ||
369 | &s3c_device_usbgadget, | ||
370 | &s3c_device_sdi, | ||
371 | &n30_button_device, | ||
372 | &n30_blue_led, | ||
373 | &n30_warning_led, | ||
374 | }; | ||
375 | |||
376 | static struct platform_device *n35_devices[] __initdata = { | ||
377 | &s3c_device_lcd, | ||
378 | &s3c_device_wdt, | ||
379 | &s3c_device_i2c0, | ||
380 | &s3c_device_iis, | ||
381 | &s3c_device_rtc, | ||
382 | &s3c_device_usbgadget, | ||
383 | &s3c_device_sdi, | ||
384 | &n35_button_device, | ||
385 | &n35_blue_led, | ||
386 | &n35_warning_led, | ||
387 | }; | ||
388 | |||
389 | static struct s3c2410_platform_i2c __initdata n30_i2ccfg = { | ||
390 | .flags = 0, | ||
391 | .slave_addr = 0x10, | ||
392 | .frequency = 10*1000, | ||
393 | }; | ||
394 | |||
395 | /* Lots of hardcoded stuff, but it sets up the hardware in a useful | ||
396 | * state so that we can boot Linux directly from flash. */ | ||
397 | static void __init n30_hwinit(void) | ||
398 | { | ||
399 | /* GPA0-11 special functions -- unknown what they do | ||
400 | * GPA12 N30 special function -- unknown what it does | ||
401 | * N35/PiN output -- unknown what it does | ||
402 | * | ||
403 | * A12 is nGCS1 on the N30 and an output on the N35/PiN. I | ||
404 | * don't think it does anything useful on the N30, so I ought | ||
405 | * to make it an output there too since it always driven to 0 | ||
406 | * as far as I can tell. */ | ||
407 | if (machine_is_n30()) | ||
408 | __raw_writel(0x007fffff, S3C2410_GPACON); | ||
409 | if (machine_is_n35()) | ||
410 | __raw_writel(0x007fefff, S3C2410_GPACON); | ||
411 | __raw_writel(0x00000000, S3C2410_GPADAT); | ||
412 | |||
413 | /* GPB0 TOUT0 backlight level | ||
414 | * GPB1 output 1=backlight on | ||
415 | * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled | ||
416 | * GPB3 output USB D+ pull up 0=disabled, 1=enabled | ||
417 | * GPB4 N30 output -- unknown function | ||
418 | * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled | ||
419 | * GPB5 output -- unknown function | ||
420 | * GPB6 input -- unknown function | ||
421 | * GPB7 output -- unknown function | ||
422 | * GPB8 output -- probably LCD driver enable | ||
423 | * GPB9 output -- probably LCD VSYNC driver enable | ||
424 | * GPB10 output -- probably LCD HSYNC driver enable | ||
425 | */ | ||
426 | __raw_writel(0x00154556, S3C2410_GPBCON); | ||
427 | __raw_writel(0x00000750, S3C2410_GPBDAT); | ||
428 | __raw_writel(0x00000073, S3C2410_GPBUP); | ||
429 | |||
430 | /* GPC0 input RS232 DCD/DSR/RI | ||
431 | * GPC1 LCD | ||
432 | * GPC2 output RS232 DTR? | ||
433 | * GPC3 input RS232 DCD/DSR/RI | ||
434 | * GPC4 LCD | ||
435 | * GPC5 output 0=NAND write enabled, 1=NAND write protect | ||
436 | * GPC6 input -- unknown function | ||
437 | * GPC7 input charger status 0=charger connected | ||
438 | * this input can be triggered by power on the USB device | ||
439 | * port too, but will go back to disconnected soon after. | ||
440 | * GPC8 N30/N35 output -- unknown function, always driven to 1 | ||
441 | * PiN input -- unknown function, always read as 1 | ||
442 | * Make it an input with a pull up for all models. | ||
443 | * GPC9-15 LCD | ||
444 | */ | ||
445 | __raw_writel(0xaaa80618, S3C2410_GPCCON); | ||
446 | __raw_writel(0x0000014c, S3C2410_GPCDAT); | ||
447 | __raw_writel(0x0000fef2, S3C2410_GPCUP); | ||
448 | |||
449 | /* GPD0 input -- unknown function | ||
450 | * GPD1-D7 LCD | ||
451 | * GPD8 N30 output -- unknown function | ||
452 | * N35/PiN output 1=GPS LED on | ||
453 | * GPD9 output 0=power led blinks red, 1=normal power led function | ||
454 | * GPD10 output -- unknown function | ||
455 | * GPD11-15 LCD drivers | ||
456 | */ | ||
457 | __raw_writel(0xaa95aaa4, S3C2410_GPDCON); | ||
458 | __raw_writel(0x00000601, S3C2410_GPDDAT); | ||
459 | __raw_writel(0x0000fbfe, S3C2410_GPDUP); | ||
460 | |||
461 | /* GPE0-4 I2S audio bus | ||
462 | * GPE5-10 SD/MMC bus | ||
463 | * E11-13 outputs -- unknown function, probably power management | ||
464 | * E14-15 I2C bus connected to the battery controller | ||
465 | */ | ||
466 | __raw_writel(0xa56aaaaa, S3C2410_GPECON); | ||
467 | __raw_writel(0x0000efc5, S3C2410_GPEDAT); | ||
468 | __raw_writel(0x0000f81f, S3C2410_GPEUP); | ||
469 | |||
470 | /* GPF0 input 0=power button pressed | ||
471 | * GPF1 input SD/MMC switch 0=card present | ||
472 | * GPF2 N30 1=reset button pressed (inverted compared to the rest) | ||
473 | * N35/PiN 0=reset button pressed | ||
474 | * GPF3 N30/PiN input -- unknown function | ||
475 | * N35 input GPS antenna position, 0=antenna closed, 1=open | ||
476 | * GPF4 input 0=button 4 pressed | ||
477 | * GPF5 input 0=button 3 pressed | ||
478 | * GPF6 input 0=button 2 pressed | ||
479 | * GPF7 input 0=button 1 pressed | ||
480 | */ | ||
481 | __raw_writel(0x0000aaaa, S3C2410_GPFCON); | ||
482 | __raw_writel(0x00000000, S3C2410_GPFDAT); | ||
483 | __raw_writel(0x000000ff, S3C2410_GPFUP); | ||
484 | |||
485 | /* GPG0 input RS232 DCD/DSR/RI | ||
486 | * GPG1 input 1=USB gadget port has power from a host | ||
487 | * GPG2 N30 input -- unknown function | ||
488 | * N35/PiN input 0=headphones plugged in, 1=not plugged in | ||
489 | * GPG3 N30 output -- unknown function | ||
490 | * N35/PiN input with unknown function | ||
491 | * GPG4 N30 output 0=MMC enabled, 1=MMC disabled | ||
492 | * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled | ||
493 | * N35/PiN input joystick right | ||
494 | * GPG6 N30 output 0=blue led on, 1=off | ||
495 | * N35/PiN input joystick left | ||
496 | * GPG7 input 0=thumbwheel pressed | ||
497 | * GPG8 input 0=thumbwheel down | ||
498 | * GPG9 input 0=thumbwheel up | ||
499 | * GPG10 input SD/MMC write protect switch | ||
500 | * GPG11 N30 input -- unknown function | ||
501 | * N35 output 0=GPS antenna powered, 1=not powered | ||
502 | * PiN output -- unknown function | ||
503 | * GPG12-15 touch screen functions | ||
504 | * | ||
505 | * The pullups differ between the models, so enable all | ||
506 | * pullups that are enabled on any of the models. | ||
507 | */ | ||
508 | if (machine_is_n30()) | ||
509 | __raw_writel(0xff0a956a, S3C2410_GPGCON); | ||
510 | if (machine_is_n35()) | ||
511 | __raw_writel(0xff4aa92a, S3C2410_GPGCON); | ||
512 | __raw_writel(0x0000e800, S3C2410_GPGDAT); | ||
513 | __raw_writel(0x0000f86f, S3C2410_GPGUP); | ||
514 | |||
515 | /* GPH0/1/2/3 RS232 serial port | ||
516 | * GPH4/5 IrDA serial port | ||
517 | * GPH6/7 N30 BlueTooth serial port | ||
518 | * N35/PiN GPS receiver | ||
519 | * GPH8 input -- unknown function | ||
520 | * GPH9 CLKOUT0 HCLK -- unknown use | ||
521 | * GPH10 CLKOUT1 FCLK -- unknown use | ||
522 | * | ||
523 | * The pull ups for H6/H7 are enabled on N30 but not on the | ||
524 | * N35/PiN. I suppose is useful for a budget model of the N30 | ||
525 | * with no bluetooh. It doesn't hurt to have the pull ups | ||
526 | * enabled on the N35, so leave them enabled for all models. | ||
527 | */ | ||
528 | __raw_writel(0x0028aaaa, S3C2410_GPHCON); | ||
529 | __raw_writel(0x000005ef, S3C2410_GPHDAT); | ||
530 | __raw_writel(0x0000063f, S3C2410_GPHUP); | ||
531 | } | ||
532 | |||
533 | static void __init n30_map_io(void) | ||
534 | { | ||
535 | s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); | ||
536 | n30_hwinit(); | ||
537 | s3c24xx_init_clocks(0); | ||
538 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); | ||
539 | } | ||
540 | |||
541 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ | ||
542 | |||
543 | static void __init n30_init(void) | ||
544 | { | ||
545 | WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power")); | ||
546 | |||
547 | s3c24xx_fb_set_platdata(&n30_fb_info); | ||
548 | s3c24xx_udc_set_platdata(&n30_udc_cfg); | ||
549 | s3c24xx_mci_set_platdata(&n30_mci_cfg); | ||
550 | s3c_i2c0_set_platdata(&n30_i2ccfg); | ||
551 | |||
552 | /* Turn off suspend on both USB ports, and switch the | ||
553 | * selectable USB port to USB device mode. */ | ||
554 | |||
555 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
556 | S3C2410_MISCCR_USBSUSPND0 | | ||
557 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
558 | |||
559 | if (machine_is_n30()) { | ||
560 | /* Turn off suspend on both USB ports, and switch the | ||
561 | * selectable USB port to USB device mode. */ | ||
562 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
563 | S3C2410_MISCCR_USBSUSPND0 | | ||
564 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
565 | |||
566 | platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices)); | ||
567 | } | ||
568 | |||
569 | if (machine_is_n35()) { | ||
570 | /* Turn off suspend and switch the selectable USB port | ||
571 | * to USB device mode. Turn on suspend for the host | ||
572 | * port since it is not connected on the N35. | ||
573 | * | ||
574 | * Actually, the host port is available at some pads | ||
575 | * on the back of the device, so it would actually be | ||
576 | * possible to add a USB device inside the N35 if you | ||
577 | * are willing to do some hardware modifications. */ | ||
578 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
579 | S3C2410_MISCCR_USBSUSPND0 | | ||
580 | S3C2410_MISCCR_USBSUSPND1, | ||
581 | S3C2410_MISCCR_USBSUSPND0); | ||
582 | |||
583 | platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices)); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | MACHINE_START(N30, "Acer-N30") | ||
588 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, | ||
589 | Ben Dooks <ben-linux@fluff.org> | ||
590 | */ | ||
591 | .atag_offset = 0x100, | ||
592 | .timer = &s3c24xx_timer, | ||
593 | .init_machine = n30_init, | ||
594 | .init_irq = s3c24xx_init_irq, | ||
595 | .map_io = n30_map_io, | ||
596 | .restart = s3c2410_restart, | ||
597 | MACHINE_END | ||
598 | |||
599 | MACHINE_START(N35, "Acer-N35") | ||
600 | /* Maintainer: Christer Weinigel <christer@weinigel.se> | ||
601 | */ | ||
602 | .atag_offset = 0x100, | ||
603 | .timer = &s3c24xx_timer, | ||
604 | .init_machine = n30_init, | ||
605 | .init_irq = s3c24xx_init_irq, | ||
606 | .map_io = n30_map_io, | ||
607 | .restart = s3c2410_restart, | ||
608 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c new file mode 100644 index 000000000000..5198e3e1c5be --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-nexcoder.c | ||
2 | * | ||
3 | * Copyright (c) 2004 Nex Vision | ||
4 | * Guillaume GOURAT <guillaume.gourat@nexvision.tv> | ||
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 | * Modifications: | ||
11 | * 15-10-2004 GG Created initial version | ||
12 | * 12-03-2005 BJD Updated for release | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/string.h> | ||
23 | #include <linux/serial_core.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <linux/mtd/map.h> | ||
28 | |||
29 | #include <asm/mach/arch.h> | ||
30 | #include <asm/mach/map.h> | ||
31 | #include <asm/mach/irq.h> | ||
32 | |||
33 | #include <asm/setup.h> | ||
34 | #include <mach/hardware.h> | ||
35 | #include <asm/irq.h> | ||
36 | #include <asm/mach-types.h> | ||
37 | |||
38 | //#include <asm/debug-ll.h> | ||
39 | #include <mach/regs-gpio.h> | ||
40 | #include <plat/regs-serial.h> | ||
41 | #include <plat/iic.h> | ||
42 | |||
43 | #include <plat/gpio-cfg.h> | ||
44 | #include <plat/s3c2410.h> | ||
45 | #include <plat/s3c244x.h> | ||
46 | #include <plat/clock.h> | ||
47 | #include <plat/devs.h> | ||
48 | #include <plat/cpu.h> | ||
49 | |||
50 | #include "common.h" | ||
51 | |||
52 | static struct map_desc nexcoder_iodesc[] __initdata = { | ||
53 | /* nothing here yet */ | ||
54 | }; | ||
55 | |||
56 | #define UCON S3C2410_UCON_DEFAULT | ||
57 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
58 | #define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE | ||
59 | |||
60 | static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = { | ||
61 | [0] = { | ||
62 | .hwport = 0, | ||
63 | .flags = 0, | ||
64 | .ucon = UCON, | ||
65 | .ulcon = ULCON, | ||
66 | .ufcon = UFCON, | ||
67 | }, | ||
68 | [1] = { | ||
69 | .hwport = 1, | ||
70 | .flags = 0, | ||
71 | .ucon = UCON, | ||
72 | .ulcon = ULCON, | ||
73 | .ufcon = UFCON, | ||
74 | }, | ||
75 | [2] = { | ||
76 | .hwport = 2, | ||
77 | .flags = 0, | ||
78 | .ucon = UCON, | ||
79 | .ulcon = ULCON, | ||
80 | .ufcon = UFCON, | ||
81 | } | ||
82 | }; | ||
83 | |||
84 | /* NOR Flash on NexVision NexCoder 2440 board */ | ||
85 | |||
86 | static struct resource nexcoder_nor_resource[] = { | ||
87 | [0] = { | ||
88 | .start = S3C2410_CS0, | ||
89 | .end = S3C2410_CS0 + (8*1024*1024) - 1, | ||
90 | .flags = IORESOURCE_MEM, | ||
91 | } | ||
92 | }; | ||
93 | |||
94 | static struct map_info nexcoder_nor_map = { | ||
95 | .bankwidth = 2, | ||
96 | }; | ||
97 | |||
98 | static struct platform_device nexcoder_device_nor = { | ||
99 | .name = "mtd-flash", | ||
100 | .id = -1, | ||
101 | .num_resources = ARRAY_SIZE(nexcoder_nor_resource), | ||
102 | .resource = nexcoder_nor_resource, | ||
103 | .dev = | ||
104 | { | ||
105 | .platform_data = &nexcoder_nor_map, | ||
106 | } | ||
107 | }; | ||
108 | |||
109 | /* Standard Nexcoder devices */ | ||
110 | |||
111 | static struct platform_device *nexcoder_devices[] __initdata = { | ||
112 | &s3c_device_ohci, | ||
113 | &s3c_device_lcd, | ||
114 | &s3c_device_wdt, | ||
115 | &s3c_device_i2c0, | ||
116 | &s3c_device_iis, | ||
117 | &s3c_device_rtc, | ||
118 | &s3c_device_camif, | ||
119 | &s3c_device_spi0, | ||
120 | &s3c_device_spi1, | ||
121 | &nexcoder_device_nor, | ||
122 | }; | ||
123 | |||
124 | static void __init nexcoder_sensorboard_init(void) | ||
125 | { | ||
126 | // Initialize SCCB bus | ||
127 | s3c2410_gpio_setpin(S3C2410_GPE(14), 1); // IICSCL | ||
128 | s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPIO_OUTPUT); | ||
129 | s3c2410_gpio_setpin(S3C2410_GPE(15), 1); // IICSDA | ||
130 | s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPIO_OUTPUT); | ||
131 | |||
132 | // Power up the sensor board | ||
133 | s3c2410_gpio_setpin(S3C2410_GPF(1), 1); | ||
134 | s3c_gpio_cfgpin(S3C2410_GPF(1), S3C2410_GPIO_OUTPUT); // CAM_GPIO7 => nLDO_PWRDN | ||
135 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | ||
136 | s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); // CAM_GPIO6 => CAM_PWRDN | ||
137 | } | ||
138 | |||
139 | static void __init nexcoder_map_io(void) | ||
140 | { | ||
141 | s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); | ||
142 | s3c24xx_init_clocks(0); | ||
143 | s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); | ||
144 | |||
145 | nexcoder_sensorboard_init(); | ||
146 | } | ||
147 | |||
148 | static void __init nexcoder_init(void) | ||
149 | { | ||
150 | s3c_i2c0_set_platdata(NULL); | ||
151 | platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices)); | ||
152 | }; | ||
153 | |||
154 | MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | ||
155 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ | ||
156 | .atag_offset = 0x100, | ||
157 | .map_io = nexcoder_map_io, | ||
158 | .init_machine = nexcoder_init, | ||
159 | .init_irq = s3c24xx_init_irq, | ||
160 | .timer = &s3c24xx_timer, | ||
161 | .restart = s3c244x_restart, | ||
162 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c new file mode 100644 index 000000000000..ad2792dfbee1 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c | |||
@@ -0,0 +1,194 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-osiris-dvs.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Simtec Osiris Dynamic Voltage Scaling support. | ||
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 | #include <linux/kernel.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/gpio.h> | ||
19 | |||
20 | #include <linux/i2c/tps65010.h> | ||
21 | |||
22 | #include <plat/cpu-freq.h> | ||
23 | |||
24 | #define OSIRIS_GPIO_DVS S3C2410_GPB(5) | ||
25 | |||
26 | static bool dvs_en; | ||
27 | |||
28 | static void osiris_dvs_tps_setdvs(bool on) | ||
29 | { | ||
30 | unsigned vregs1 = 0, vdcdc2 = 0; | ||
31 | |||
32 | if (!on) { | ||
33 | vdcdc2 = TPS_VCORE_DISCH | TPS_LP_COREOFF; | ||
34 | vregs1 = TPS_LDO1_OFF; /* turn off in low-power mode */ | ||
35 | } | ||
36 | |||
37 | dvs_en = on; | ||
38 | vdcdc2 |= TPS_VCORE_1_3V | TPS_VCORE_LP_1_0V; | ||
39 | vregs1 |= TPS_LDO2_ENABLE | TPS_LDO1_ENABLE; | ||
40 | |||
41 | tps65010_config_vregs1(vregs1); | ||
42 | tps65010_config_vdcdc2(vdcdc2); | ||
43 | } | ||
44 | |||
45 | static bool is_dvs(struct s3c_freq *f) | ||
46 | { | ||
47 | /* at the moment, we assume ARMCLK = HCLK => DVS */ | ||
48 | return f->armclk == f->hclk; | ||
49 | } | ||
50 | |||
51 | /* keep track of current state */ | ||
52 | static bool cur_dvs = false; | ||
53 | |||
54 | static int osiris_dvs_notify(struct notifier_block *nb, | ||
55 | unsigned long val, void *data) | ||
56 | { | ||
57 | struct cpufreq_freqs *cf = data; | ||
58 | struct s3c_cpufreq_freqs *freqs = to_s3c_cpufreq(cf); | ||
59 | bool old_dvs = is_dvs(&freqs->old); | ||
60 | bool new_dvs = is_dvs(&freqs->new); | ||
61 | int ret = 0; | ||
62 | |||
63 | if (!dvs_en) | ||
64 | return 0; | ||
65 | |||
66 | printk(KERN_DEBUG "%s: old %ld,%ld new %ld,%ld\n", __func__, | ||
67 | freqs->old.armclk, freqs->old.hclk, | ||
68 | freqs->new.armclk, freqs->new.hclk); | ||
69 | |||
70 | switch (val) { | ||
71 | case CPUFREQ_PRECHANGE: | ||
72 | if (old_dvs & !new_dvs || | ||
73 | cur_dvs & !new_dvs) { | ||
74 | pr_debug("%s: exiting dvs\n", __func__); | ||
75 | cur_dvs = false; | ||
76 | gpio_set_value(OSIRIS_GPIO_DVS, 1); | ||
77 | } | ||
78 | break; | ||
79 | case CPUFREQ_POSTCHANGE: | ||
80 | if (!old_dvs & new_dvs || | ||
81 | !cur_dvs & new_dvs) { | ||
82 | pr_debug("entering dvs\n"); | ||
83 | cur_dvs = true; | ||
84 | gpio_set_value(OSIRIS_GPIO_DVS, 0); | ||
85 | } | ||
86 | break; | ||
87 | } | ||
88 | |||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static struct notifier_block osiris_dvs_nb = { | ||
93 | .notifier_call = osiris_dvs_notify, | ||
94 | }; | ||
95 | |||
96 | static int __devinit osiris_dvs_probe(struct platform_device *pdev) | ||
97 | { | ||
98 | int ret; | ||
99 | |||
100 | dev_info(&pdev->dev, "initialising\n"); | ||
101 | |||
102 | ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs"); | ||
103 | if (ret) { | ||
104 | dev_err(&pdev->dev, "cannot claim gpio\n"); | ||
105 | goto err_nogpio; | ||
106 | } | ||
107 | |||
108 | /* start with dvs disabled */ | ||
109 | gpio_direction_output(OSIRIS_GPIO_DVS, 1); | ||
110 | |||
111 | ret = cpufreq_register_notifier(&osiris_dvs_nb, | ||
112 | CPUFREQ_TRANSITION_NOTIFIER); | ||
113 | if (ret) { | ||
114 | dev_err(&pdev->dev, "failed to register with cpufreq\n"); | ||
115 | goto err_nofreq; | ||
116 | } | ||
117 | |||
118 | osiris_dvs_tps_setdvs(true); | ||
119 | |||
120 | return 0; | ||
121 | |||
122 | err_nofreq: | ||
123 | gpio_free(OSIRIS_GPIO_DVS); | ||
124 | |||
125 | err_nogpio: | ||
126 | return ret; | ||
127 | } | ||
128 | |||
129 | static int __devexit osiris_dvs_remove(struct platform_device *pdev) | ||
130 | { | ||
131 | dev_info(&pdev->dev, "exiting\n"); | ||
132 | |||
133 | /* disable any current dvs */ | ||
134 | gpio_set_value(OSIRIS_GPIO_DVS, 1); | ||
135 | osiris_dvs_tps_setdvs(false); | ||
136 | |||
137 | cpufreq_unregister_notifier(&osiris_dvs_nb, | ||
138 | CPUFREQ_TRANSITION_NOTIFIER); | ||
139 | |||
140 | gpio_free(OSIRIS_GPIO_DVS); | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | /* the CONFIG_PM block is so small, it isn't worth actaully compiling it | ||
146 | * out if the configuration isn't set. */ | ||
147 | |||
148 | static int osiris_dvs_suspend(struct device *dev) | ||
149 | { | ||
150 | gpio_set_value(OSIRIS_GPIO_DVS, 1); | ||
151 | osiris_dvs_tps_setdvs(false); | ||
152 | cur_dvs = false; | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static int osiris_dvs_resume(struct device *dev) | ||
158 | { | ||
159 | osiris_dvs_tps_setdvs(true); | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static const struct dev_pm_ops osiris_dvs_pm = { | ||
164 | .suspend = osiris_dvs_suspend, | ||
165 | .resume = osiris_dvs_resume, | ||
166 | }; | ||
167 | |||
168 | static struct platform_driver osiris_dvs_driver = { | ||
169 | .probe = osiris_dvs_probe, | ||
170 | .remove = __devexit_p(osiris_dvs_remove), | ||
171 | .driver = { | ||
172 | .name = "osiris-dvs", | ||
173 | .owner = THIS_MODULE, | ||
174 | .pm = &osiris_dvs_pm, | ||
175 | }, | ||
176 | }; | ||
177 | |||
178 | static int __init osiris_dvs_init(void) | ||
179 | { | ||
180 | return platform_driver_register(&osiris_dvs_driver); | ||
181 | } | ||
182 | |||
183 | static void __exit osiris_dvs_exit(void) | ||
184 | { | ||
185 | platform_driver_unregister(&osiris_dvs_driver); | ||
186 | } | ||
187 | |||
188 | module_init(osiris_dvs_init); | ||
189 | module_exit(osiris_dvs_exit); | ||
190 | |||
191 | MODULE_DESCRIPTION("Simtec OSIRIS DVS support"); | ||
192 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
193 | MODULE_LICENSE("GPL"); | ||
194 | MODULE_ALIAS("platform:osiris-dvs"); | ||
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c new file mode 100644 index 000000000000..c5daeb612a88 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-osiris.c | |||
@@ -0,0 +1,440 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-osiris.c | ||
2 | * | ||
3 | * Copyright (c) 2005-2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
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/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/syscore_ops.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <linux/i2c/tps65010.h> | ||
27 | |||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/irq.h> | ||
31 | |||
32 | #include <mach/osiris-map.h> | ||
33 | #include <mach/osiris-cpld.h> | ||
34 | |||
35 | #include <mach/hardware.h> | ||
36 | #include <asm/irq.h> | ||
37 | #include <asm/mach-types.h> | ||
38 | |||
39 | #include <plat/cpu-freq.h> | ||
40 | #include <plat/regs-serial.h> | ||
41 | #include <mach/regs-gpio.h> | ||
42 | #include <mach/regs-mem.h> | ||
43 | #include <mach/regs-lcd.h> | ||
44 | #include <plat/nand.h> | ||
45 | #include <plat/iic.h> | ||
46 | |||
47 | #include <linux/mtd/mtd.h> | ||
48 | #include <linux/mtd/nand.h> | ||
49 | #include <linux/mtd/nand_ecc.h> | ||
50 | #include <linux/mtd/partitions.h> | ||
51 | |||
52 | #include <plat/gpio-cfg.h> | ||
53 | #include <plat/clock.h> | ||
54 | #include <plat/devs.h> | ||
55 | #include <plat/cpu.h> | ||
56 | |||
57 | #include "common.h" | ||
58 | |||
59 | /* onboard perihperal map */ | ||
60 | |||
61 | static struct map_desc osiris_iodesc[] __initdata = { | ||
62 | /* ISA IO areas (may be over-written later) */ | ||
63 | |||
64 | { | ||
65 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
66 | .pfn = __phys_to_pfn(S3C2410_CS5), | ||
67 | .length = SZ_16M, | ||
68 | .type = MT_DEVICE, | ||
69 | }, { | ||
70 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
71 | .pfn = __phys_to_pfn(S3C2410_CS5), | ||
72 | .length = SZ_16M, | ||
73 | .type = MT_DEVICE, | ||
74 | }, | ||
75 | |||
76 | /* CPLD control registers */ | ||
77 | |||
78 | { | ||
79 | .virtual = (u32)OSIRIS_VA_CTRL0, | ||
80 | .pfn = __phys_to_pfn(OSIRIS_PA_CTRL0), | ||
81 | .length = SZ_16K, | ||
82 | .type = MT_DEVICE, | ||
83 | }, { | ||
84 | .virtual = (u32)OSIRIS_VA_CTRL1, | ||
85 | .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1), | ||
86 | .length = SZ_16K, | ||
87 | .type = MT_DEVICE, | ||
88 | }, { | ||
89 | .virtual = (u32)OSIRIS_VA_CTRL2, | ||
90 | .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2), | ||
91 | .length = SZ_16K, | ||
92 | .type = MT_DEVICE, | ||
93 | }, { | ||
94 | .virtual = (u32)OSIRIS_VA_IDREG, | ||
95 | .pfn = __phys_to_pfn(OSIRIS_PA_IDREG), | ||
96 | .length = SZ_16K, | ||
97 | .type = MT_DEVICE, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
102 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
103 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
104 | |||
105 | static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = { | ||
106 | [0] = { | ||
107 | .hwport = 0, | ||
108 | .flags = 0, | ||
109 | .ucon = UCON, | ||
110 | .ulcon = ULCON, | ||
111 | .ufcon = UFCON, | ||
112 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
113 | }, | ||
114 | [1] = { | ||
115 | .hwport = 1, | ||
116 | .flags = 0, | ||
117 | .ucon = UCON, | ||
118 | .ulcon = ULCON, | ||
119 | .ufcon = UFCON, | ||
120 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
121 | }, | ||
122 | [2] = { | ||
123 | .hwport = 2, | ||
124 | .flags = 0, | ||
125 | .ucon = UCON, | ||
126 | .ulcon = ULCON, | ||
127 | .ufcon = UFCON, | ||
128 | .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2, | ||
129 | } | ||
130 | }; | ||
131 | |||
132 | /* NAND Flash on Osiris board */ | ||
133 | |||
134 | static int external_map[] = { 2 }; | ||
135 | static int chip0_map[] = { 0 }; | ||
136 | static int chip1_map[] = { 1 }; | ||
137 | |||
138 | static struct mtd_partition __initdata osiris_default_nand_part[] = { | ||
139 | [0] = { | ||
140 | .name = "Boot Agent", | ||
141 | .size = SZ_16K, | ||
142 | .offset = 0, | ||
143 | }, | ||
144 | [1] = { | ||
145 | .name = "/boot", | ||
146 | .size = SZ_4M - SZ_16K, | ||
147 | .offset = SZ_16K, | ||
148 | }, | ||
149 | [2] = { | ||
150 | .name = "user1", | ||
151 | .offset = SZ_4M, | ||
152 | .size = SZ_32M - SZ_4M, | ||
153 | }, | ||
154 | [3] = { | ||
155 | .name = "user2", | ||
156 | .offset = SZ_32M, | ||
157 | .size = MTDPART_SIZ_FULL, | ||
158 | } | ||
159 | }; | ||
160 | |||
161 | static struct mtd_partition __initdata osiris_default_nand_part_large[] = { | ||
162 | [0] = { | ||
163 | .name = "Boot Agent", | ||
164 | .size = SZ_128K, | ||
165 | .offset = 0, | ||
166 | }, | ||
167 | [1] = { | ||
168 | .name = "/boot", | ||
169 | .size = SZ_4M - SZ_128K, | ||
170 | .offset = SZ_128K, | ||
171 | }, | ||
172 | [2] = { | ||
173 | .name = "user1", | ||
174 | .offset = SZ_4M, | ||
175 | .size = SZ_32M - SZ_4M, | ||
176 | }, | ||
177 | [3] = { | ||
178 | .name = "user2", | ||
179 | .offset = SZ_32M, | ||
180 | .size = MTDPART_SIZ_FULL, | ||
181 | } | ||
182 | }; | ||
183 | |||
184 | /* the Osiris has 3 selectable slots for nand-flash, the two | ||
185 | * on-board chip areas, as well as the external slot. | ||
186 | * | ||
187 | * Note, there is no current hot-plug support for the External | ||
188 | * socket. | ||
189 | */ | ||
190 | |||
191 | static struct s3c2410_nand_set __initdata osiris_nand_sets[] = { | ||
192 | [1] = { | ||
193 | .name = "External", | ||
194 | .nr_chips = 1, | ||
195 | .nr_map = external_map, | ||
196 | .options = NAND_SCAN_SILENT_NODEV, | ||
197 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), | ||
198 | .partitions = osiris_default_nand_part, | ||
199 | }, | ||
200 | [0] = { | ||
201 | .name = "chip0", | ||
202 | .nr_chips = 1, | ||
203 | .nr_map = chip0_map, | ||
204 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), | ||
205 | .partitions = osiris_default_nand_part, | ||
206 | }, | ||
207 | [2] = { | ||
208 | .name = "chip1", | ||
209 | .nr_chips = 1, | ||
210 | .nr_map = chip1_map, | ||
211 | .options = NAND_SCAN_SILENT_NODEV, | ||
212 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), | ||
213 | .partitions = osiris_default_nand_part, | ||
214 | }, | ||
215 | }; | ||
216 | |||
217 | static void osiris_nand_select(struct s3c2410_nand_set *set, int slot) | ||
218 | { | ||
219 | unsigned int tmp; | ||
220 | |||
221 | slot = set->nr_map[slot] & 3; | ||
222 | |||
223 | pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n", | ||
224 | slot, set, set->nr_map); | ||
225 | |||
226 | tmp = __raw_readb(OSIRIS_VA_CTRL0); | ||
227 | tmp &= ~OSIRIS_CTRL0_NANDSEL; | ||
228 | tmp |= slot; | ||
229 | |||
230 | pr_debug("osiris_nand: ctrl0 now %02x\n", tmp); | ||
231 | |||
232 | __raw_writeb(tmp, OSIRIS_VA_CTRL0); | ||
233 | } | ||
234 | |||
235 | static struct s3c2410_platform_nand __initdata osiris_nand_info = { | ||
236 | .tacls = 25, | ||
237 | .twrph0 = 60, | ||
238 | .twrph1 = 60, | ||
239 | .nr_sets = ARRAY_SIZE(osiris_nand_sets), | ||
240 | .sets = osiris_nand_sets, | ||
241 | .select_chip = osiris_nand_select, | ||
242 | }; | ||
243 | |||
244 | /* PCMCIA control and configuration */ | ||
245 | |||
246 | static struct resource osiris_pcmcia_resource[] = { | ||
247 | [0] = { | ||
248 | .start = 0x0f000000, | ||
249 | .end = 0x0f100000, | ||
250 | .flags = IORESOURCE_MEM, | ||
251 | }, | ||
252 | [1] = { | ||
253 | .start = 0x0c000000, | ||
254 | .end = 0x0c100000, | ||
255 | .flags = IORESOURCE_MEM, | ||
256 | } | ||
257 | }; | ||
258 | |||
259 | static struct platform_device osiris_pcmcia = { | ||
260 | .name = "osiris-pcmcia", | ||
261 | .id = -1, | ||
262 | .num_resources = ARRAY_SIZE(osiris_pcmcia_resource), | ||
263 | .resource = osiris_pcmcia_resource, | ||
264 | }; | ||
265 | |||
266 | /* Osiris power management device */ | ||
267 | |||
268 | #ifdef CONFIG_PM | ||
269 | static unsigned char pm_osiris_ctrl0; | ||
270 | |||
271 | static int osiris_pm_suspend(void) | ||
272 | { | ||
273 | unsigned int tmp; | ||
274 | |||
275 | pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0); | ||
276 | tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL; | ||
277 | |||
278 | /* ensure correct NAND slot is selected on resume */ | ||
279 | if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0) | ||
280 | tmp |= 2; | ||
281 | |||
282 | __raw_writeb(tmp, OSIRIS_VA_CTRL0); | ||
283 | |||
284 | /* ensure that an nRESET is not generated on resume. */ | ||
285 | s3c2410_gpio_setpin(S3C2410_GPA(21), 1); | ||
286 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); | ||
287 | |||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | static void osiris_pm_resume(void) | ||
292 | { | ||
293 | if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8) | ||
294 | __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1); | ||
295 | |||
296 | __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); | ||
297 | |||
298 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); | ||
299 | } | ||
300 | |||
301 | #else | ||
302 | #define osiris_pm_suspend NULL | ||
303 | #define osiris_pm_resume NULL | ||
304 | #endif | ||
305 | |||
306 | static struct syscore_ops osiris_pm_syscore_ops = { | ||
307 | .suspend = osiris_pm_suspend, | ||
308 | .resume = osiris_pm_resume, | ||
309 | }; | ||
310 | |||
311 | /* Link for DVS driver to TPS65011 */ | ||
312 | |||
313 | static void osiris_tps_release(struct device *dev) | ||
314 | { | ||
315 | /* static device, do not need to release anything */ | ||
316 | } | ||
317 | |||
318 | static struct platform_device osiris_tps_device = { | ||
319 | .name = "osiris-dvs", | ||
320 | .id = -1, | ||
321 | .dev.release = osiris_tps_release, | ||
322 | }; | ||
323 | |||
324 | static int osiris_tps_setup(struct i2c_client *client, void *context) | ||
325 | { | ||
326 | osiris_tps_device.dev.parent = &client->dev; | ||
327 | return platform_device_register(&osiris_tps_device); | ||
328 | } | ||
329 | |||
330 | static int osiris_tps_remove(struct i2c_client *client, void *context) | ||
331 | { | ||
332 | platform_device_unregister(&osiris_tps_device); | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static struct tps65010_board osiris_tps_board = { | ||
337 | .base = -1, /* GPIO can go anywhere at the moment */ | ||
338 | .setup = osiris_tps_setup, | ||
339 | .teardown = osiris_tps_remove, | ||
340 | }; | ||
341 | |||
342 | /* I2C devices fitted. */ | ||
343 | |||
344 | static struct i2c_board_info osiris_i2c_devs[] __initdata = { | ||
345 | { | ||
346 | I2C_BOARD_INFO("tps65011", 0x48), | ||
347 | .irq = IRQ_EINT20, | ||
348 | .platform_data = &osiris_tps_board, | ||
349 | }, | ||
350 | }; | ||
351 | |||
352 | /* Standard Osiris devices */ | ||
353 | |||
354 | static struct platform_device *osiris_devices[] __initdata = { | ||
355 | &s3c_device_i2c0, | ||
356 | &s3c_device_wdt, | ||
357 | &s3c_device_nand, | ||
358 | &osiris_pcmcia, | ||
359 | }; | ||
360 | |||
361 | static struct clk *osiris_clocks[] __initdata = { | ||
362 | &s3c24xx_dclk0, | ||
363 | &s3c24xx_dclk1, | ||
364 | &s3c24xx_clkout0, | ||
365 | &s3c24xx_clkout1, | ||
366 | &s3c24xx_uclk, | ||
367 | }; | ||
368 | |||
369 | static struct s3c_cpufreq_board __initdata osiris_cpufreq = { | ||
370 | .refresh = 7800, /* refresh period is 7.8usec */ | ||
371 | .auto_io = 1, | ||
372 | .need_io = 1, | ||
373 | }; | ||
374 | |||
375 | static void __init osiris_map_io(void) | ||
376 | { | ||
377 | unsigned long flags; | ||
378 | |||
379 | /* initialise the clocks */ | ||
380 | |||
381 | s3c24xx_dclk0.parent = &clk_upll; | ||
382 | s3c24xx_dclk0.rate = 12*1000*1000; | ||
383 | |||
384 | s3c24xx_dclk1.parent = &clk_upll; | ||
385 | s3c24xx_dclk1.rate = 24*1000*1000; | ||
386 | |||
387 | s3c24xx_clkout0.parent = &s3c24xx_dclk0; | ||
388 | s3c24xx_clkout1.parent = &s3c24xx_dclk1; | ||
389 | |||
390 | s3c24xx_uclk.parent = &s3c24xx_clkout1; | ||
391 | |||
392 | s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks)); | ||
393 | |||
394 | s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); | ||
395 | s3c24xx_init_clocks(0); | ||
396 | s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); | ||
397 | |||
398 | /* check for the newer revision boards with large page nand */ | ||
399 | |||
400 | if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) { | ||
401 | printk(KERN_INFO "OSIRIS-B detected (revision %d)\n", | ||
402 | __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK); | ||
403 | osiris_nand_sets[0].partitions = osiris_default_nand_part_large; | ||
404 | osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large); | ||
405 | } else { | ||
406 | /* write-protect line to the NAND */ | ||
407 | s3c2410_gpio_setpin(S3C2410_GPA(0), 1); | ||
408 | } | ||
409 | |||
410 | /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */ | ||
411 | |||
412 | local_irq_save(flags); | ||
413 | __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON); | ||
414 | local_irq_restore(flags); | ||
415 | } | ||
416 | |||
417 | static void __init osiris_init(void) | ||
418 | { | ||
419 | register_syscore_ops(&osiris_pm_syscore_ops); | ||
420 | |||
421 | s3c_i2c0_set_platdata(NULL); | ||
422 | s3c_nand_set_platdata(&osiris_nand_info); | ||
423 | |||
424 | s3c_cpufreq_setboard(&osiris_cpufreq); | ||
425 | |||
426 | i2c_register_board_info(0, osiris_i2c_devs, | ||
427 | ARRAY_SIZE(osiris_i2c_devs)); | ||
428 | |||
429 | platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices)); | ||
430 | }; | ||
431 | |||
432 | MACHINE_START(OSIRIS, "Simtec-OSIRIS") | ||
433 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | ||
434 | .atag_offset = 0x100, | ||
435 | .map_io = osiris_map_io, | ||
436 | .init_irq = s3c24xx_init_irq, | ||
437 | .init_machine = osiris_init, | ||
438 | .timer = &s3c24xx_timer, | ||
439 | .restart = s3c244x_restart, | ||
440 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c new file mode 100644 index 000000000000..5f1e0eeb38a9 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-otom.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-otom.c | ||
2 | * | ||
3 | * Copyright (c) 2004 Nex Vision | ||
4 | * Guillaume GOURAT <guillaume.gourat@nexvision.fr> | ||
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 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/io.h> | ||
21 | |||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach/map.h> | ||
24 | #include <asm/mach/irq.h> | ||
25 | |||
26 | #include <mach/otom-map.h> | ||
27 | |||
28 | #include <mach/hardware.h> | ||
29 | #include <asm/irq.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | |||
32 | #include <plat/regs-serial.h> | ||
33 | #include <mach/regs-gpio.h> | ||
34 | |||
35 | #include <plat/s3c2410.h> | ||
36 | #include <plat/clock.h> | ||
37 | #include <plat/devs.h> | ||
38 | #include <plat/iic.h> | ||
39 | #include <plat/cpu.h> | ||
40 | |||
41 | #include "common.h" | ||
42 | |||
43 | static struct map_desc otom11_iodesc[] __initdata = { | ||
44 | /* Device area */ | ||
45 | { (u32)OTOM_VA_CS8900A_BASE, OTOM_PA_CS8900A_BASE, SZ_16M, MT_DEVICE }, | ||
46 | }; | ||
47 | |||
48 | #define UCON S3C2410_UCON_DEFAULT | ||
49 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
50 | #define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE | ||
51 | |||
52 | static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = { | ||
53 | [0] = { | ||
54 | .hwport = 0, | ||
55 | .flags = 0, | ||
56 | .ucon = UCON, | ||
57 | .ulcon = ULCON, | ||
58 | .ufcon = UFCON, | ||
59 | }, | ||
60 | [1] = { | ||
61 | .hwport = 1, | ||
62 | .flags = 0, | ||
63 | .ucon = UCON, | ||
64 | .ulcon = ULCON, | ||
65 | .ufcon = UFCON, | ||
66 | }, | ||
67 | /* port 2 is not actually used */ | ||
68 | [2] = { | ||
69 | .hwport = 2, | ||
70 | .flags = 0, | ||
71 | .ucon = UCON, | ||
72 | .ulcon = ULCON, | ||
73 | .ufcon = UFCON, | ||
74 | } | ||
75 | }; | ||
76 | |||
77 | /* NOR Flash on NexVision OTOM board */ | ||
78 | |||
79 | static struct resource otom_nor_resource[] = { | ||
80 | [0] = { | ||
81 | .start = S3C2410_CS0, | ||
82 | .end = S3C2410_CS0 + (4*1024*1024) - 1, | ||
83 | .flags = IORESOURCE_MEM, | ||
84 | } | ||
85 | }; | ||
86 | |||
87 | static struct platform_device otom_device_nor = { | ||
88 | .name = "mtd-flash", | ||
89 | .id = -1, | ||
90 | .num_resources = ARRAY_SIZE(otom_nor_resource), | ||
91 | .resource = otom_nor_resource, | ||
92 | }; | ||
93 | |||
94 | /* Standard OTOM devices */ | ||
95 | |||
96 | static struct platform_device *otom11_devices[] __initdata = { | ||
97 | &s3c_device_ohci, | ||
98 | &s3c_device_lcd, | ||
99 | &s3c_device_wdt, | ||
100 | &s3c_device_i2c0, | ||
101 | &s3c_device_iis, | ||
102 | &s3c_device_rtc, | ||
103 | &otom_device_nor, | ||
104 | }; | ||
105 | |||
106 | static void __init otom11_map_io(void) | ||
107 | { | ||
108 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); | ||
109 | s3c24xx_init_clocks(0); | ||
110 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); | ||
111 | } | ||
112 | |||
113 | static void __init otom11_init(void) | ||
114 | { | ||
115 | s3c_i2c0_set_platdata(NULL); | ||
116 | platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices)); | ||
117 | } | ||
118 | |||
119 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | ||
120 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ | ||
121 | .atag_offset = 0x100, | ||
122 | .map_io = otom11_map_io, | ||
123 | .init_machine = otom11_init, | ||
124 | .init_irq = s3c24xx_init_irq, | ||
125 | .timer = &s3c24xx_timer, | ||
126 | .restart = s3c2410_restart, | ||
127 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c new file mode 100644 index 000000000000..91c16d9d2459 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c | |||
@@ -0,0 +1,356 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-qt2410.c | ||
2 | * | ||
3 | * Copyright (C) 2006 by OpenMoko, Inc. | ||
4 | * Author: Harald Welte <laforge@openmoko.org> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License as | ||
9 | * published by the Free Software Foundation; either version 2 of | ||
10 | * the License, or (at your option) any later version. | ||
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 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
20 | * MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/timer.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/gpio.h> | ||
31 | #include <linux/device.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/serial_core.h> | ||
34 | #include <linux/spi/spi.h> | ||
35 | #include <linux/spi/spi_gpio.h> | ||
36 | #include <linux/io.h> | ||
37 | #include <linux/mtd/mtd.h> | ||
38 | #include <linux/mtd/nand.h> | ||
39 | #include <linux/mtd/nand_ecc.h> | ||
40 | #include <linux/mtd/partitions.h> | ||
41 | |||
42 | #include <asm/mach/arch.h> | ||
43 | #include <asm/mach/map.h> | ||
44 | #include <asm/mach/irq.h> | ||
45 | |||
46 | #include <mach/hardware.h> | ||
47 | #include <asm/irq.h> | ||
48 | #include <asm/mach-types.h> | ||
49 | |||
50 | #include <mach/regs-gpio.h> | ||
51 | #include <mach/leds-gpio.h> | ||
52 | #include <mach/regs-lcd.h> | ||
53 | #include <plat/regs-serial.h> | ||
54 | #include <mach/fb.h> | ||
55 | #include <plat/nand.h> | ||
56 | #include <plat/udc.h> | ||
57 | #include <plat/iic.h> | ||
58 | |||
59 | #include <plat/common-smdk.h> | ||
60 | #include <plat/gpio-cfg.h> | ||
61 | #include <plat/devs.h> | ||
62 | #include <plat/cpu.h> | ||
63 | #include <plat/pm.h> | ||
64 | |||
65 | #include "common.h" | ||
66 | |||
67 | static struct map_desc qt2410_iodesc[] __initdata = { | ||
68 | { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE } | ||
69 | }; | ||
70 | |||
71 | #define UCON S3C2410_UCON_DEFAULT | ||
72 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
73 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
74 | |||
75 | static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { | ||
76 | [0] = { | ||
77 | .hwport = 0, | ||
78 | .flags = 0, | ||
79 | .ucon = UCON, | ||
80 | .ulcon = ULCON, | ||
81 | .ufcon = UFCON, | ||
82 | }, | ||
83 | [1] = { | ||
84 | .hwport = 1, | ||
85 | .flags = 0, | ||
86 | .ucon = UCON, | ||
87 | .ulcon = ULCON, | ||
88 | .ufcon = UFCON, | ||
89 | }, | ||
90 | [2] = { | ||
91 | .hwport = 2, | ||
92 | .flags = 0, | ||
93 | .ucon = UCON, | ||
94 | .ulcon = ULCON, | ||
95 | .ufcon = UFCON, | ||
96 | } | ||
97 | }; | ||
98 | |||
99 | /* LCD driver info */ | ||
100 | |||
101 | static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = { | ||
102 | { | ||
103 | /* Configuration for 640x480 SHARP LQ080V3DG01 */ | ||
104 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
105 | S3C2410_LCDCON5_INVVLINE | | ||
106 | S3C2410_LCDCON5_INVVFRAME | | ||
107 | S3C2410_LCDCON5_PWREN | | ||
108 | S3C2410_LCDCON5_HWSWP, | ||
109 | |||
110 | .type = S3C2410_LCDCON1_TFT, | ||
111 | .width = 640, | ||
112 | .height = 480, | ||
113 | |||
114 | .pixclock = 40000, /* HCLK/4 */ | ||
115 | .xres = 640, | ||
116 | .yres = 480, | ||
117 | .bpp = 16, | ||
118 | .left_margin = 44, | ||
119 | .right_margin = 116, | ||
120 | .hsync_len = 96, | ||
121 | .upper_margin = 19, | ||
122 | .lower_margin = 11, | ||
123 | .vsync_len = 15, | ||
124 | }, | ||
125 | { | ||
126 | /* Configuration for 480x640 toppoly TD028TTEC1 */ | ||
127 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
128 | S3C2410_LCDCON5_INVVLINE | | ||
129 | S3C2410_LCDCON5_INVVFRAME | | ||
130 | S3C2410_LCDCON5_PWREN | | ||
131 | S3C2410_LCDCON5_HWSWP, | ||
132 | |||
133 | .type = S3C2410_LCDCON1_TFT, | ||
134 | .width = 480, | ||
135 | .height = 640, | ||
136 | .pixclock = 40000, /* HCLK/4 */ | ||
137 | .xres = 480, | ||
138 | .yres = 640, | ||
139 | .bpp = 16, | ||
140 | .left_margin = 8, | ||
141 | .right_margin = 24, | ||
142 | .hsync_len = 8, | ||
143 | .upper_margin = 2, | ||
144 | .lower_margin = 4, | ||
145 | .vsync_len = 2, | ||
146 | }, | ||
147 | { | ||
148 | /* Config for 240x320 LCD */ | ||
149 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
150 | S3C2410_LCDCON5_INVVLINE | | ||
151 | S3C2410_LCDCON5_INVVFRAME | | ||
152 | S3C2410_LCDCON5_PWREN | | ||
153 | S3C2410_LCDCON5_HWSWP, | ||
154 | |||
155 | .type = S3C2410_LCDCON1_TFT, | ||
156 | .width = 240, | ||
157 | .height = 320, | ||
158 | .pixclock = 100000, /* HCLK/10 */ | ||
159 | .xres = 240, | ||
160 | .yres = 320, | ||
161 | .bpp = 16, | ||
162 | .left_margin = 13, | ||
163 | .right_margin = 8, | ||
164 | .hsync_len = 4, | ||
165 | .upper_margin = 2, | ||
166 | .lower_margin = 7, | ||
167 | .vsync_len = 4, | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | |||
172 | static struct s3c2410fb_mach_info qt2410_fb_info __initdata = { | ||
173 | .displays = qt2410_lcd_cfg, | ||
174 | .num_displays = ARRAY_SIZE(qt2410_lcd_cfg), | ||
175 | .default_display = 0, | ||
176 | |||
177 | .lpcsel = ((0xCE6) & ~7) | 1<<4, | ||
178 | }; | ||
179 | |||
180 | /* CS8900 */ | ||
181 | |||
182 | static struct resource qt2410_cs89x0_resources[] = { | ||
183 | [0] = { | ||
184 | .start = 0x19000000, | ||
185 | .end = 0x19000000 + 16, | ||
186 | .flags = IORESOURCE_MEM, | ||
187 | }, | ||
188 | [1] = { | ||
189 | .start = IRQ_EINT9, | ||
190 | .end = IRQ_EINT9, | ||
191 | .flags = IORESOURCE_IRQ, | ||
192 | }, | ||
193 | }; | ||
194 | |||
195 | static struct platform_device qt2410_cs89x0 = { | ||
196 | .name = "cirrus-cs89x0", | ||
197 | .num_resources = ARRAY_SIZE(qt2410_cs89x0_resources), | ||
198 | .resource = qt2410_cs89x0_resources, | ||
199 | }; | ||
200 | |||
201 | /* LED */ | ||
202 | |||
203 | static struct s3c24xx_led_platdata qt2410_pdata_led = { | ||
204 | .gpio = S3C2410_GPB(0), | ||
205 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
206 | .name = "led", | ||
207 | .def_trigger = "timer", | ||
208 | }; | ||
209 | |||
210 | static struct platform_device qt2410_led = { | ||
211 | .name = "s3c24xx_led", | ||
212 | .id = 0, | ||
213 | .dev = { | ||
214 | .platform_data = &qt2410_pdata_led, | ||
215 | }, | ||
216 | }; | ||
217 | |||
218 | /* SPI */ | ||
219 | |||
220 | static struct spi_gpio_platform_data spi_gpio_cfg = { | ||
221 | .sck = S3C2410_GPG(7), | ||
222 | .mosi = S3C2410_GPG(6), | ||
223 | .miso = S3C2410_GPG(5), | ||
224 | }; | ||
225 | |||
226 | static struct platform_device qt2410_spi = { | ||
227 | .name = "spi-gpio", | ||
228 | .id = 1, | ||
229 | .dev.platform_data = &spi_gpio_cfg, | ||
230 | }; | ||
231 | |||
232 | /* Board devices */ | ||
233 | |||
234 | static struct platform_device *qt2410_devices[] __initdata = { | ||
235 | &s3c_device_ohci, | ||
236 | &s3c_device_lcd, | ||
237 | &s3c_device_wdt, | ||
238 | &s3c_device_i2c0, | ||
239 | &s3c_device_iis, | ||
240 | &s3c_device_sdi, | ||
241 | &s3c_device_usbgadget, | ||
242 | &qt2410_spi, | ||
243 | &qt2410_cs89x0, | ||
244 | &qt2410_led, | ||
245 | }; | ||
246 | |||
247 | static struct mtd_partition __initdata qt2410_nand_part[] = { | ||
248 | [0] = { | ||
249 | .name = "U-Boot", | ||
250 | .size = 0x30000, | ||
251 | .offset = 0, | ||
252 | }, | ||
253 | [1] = { | ||
254 | .name = "U-Boot environment", | ||
255 | .offset = 0x30000, | ||
256 | .size = 0x4000, | ||
257 | }, | ||
258 | [2] = { | ||
259 | .name = "kernel", | ||
260 | .offset = 0x34000, | ||
261 | .size = SZ_2M, | ||
262 | }, | ||
263 | [3] = { | ||
264 | .name = "initrd", | ||
265 | .offset = 0x234000, | ||
266 | .size = SZ_4M, | ||
267 | }, | ||
268 | [4] = { | ||
269 | .name = "jffs2", | ||
270 | .offset = 0x634000, | ||
271 | .size = 0x39cc000, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = { | ||
276 | [0] = { | ||
277 | .name = "NAND", | ||
278 | .nr_chips = 1, | ||
279 | .nr_partitions = ARRAY_SIZE(qt2410_nand_part), | ||
280 | .partitions = qt2410_nand_part, | ||
281 | }, | ||
282 | }; | ||
283 | |||
284 | /* choose a set of timings which should suit most 512Mbit | ||
285 | * chips and beyond. | ||
286 | */ | ||
287 | |||
288 | static struct s3c2410_platform_nand __initdata qt2410_nand_info = { | ||
289 | .tacls = 20, | ||
290 | .twrph0 = 60, | ||
291 | .twrph1 = 20, | ||
292 | .nr_sets = ARRAY_SIZE(qt2410_nand_sets), | ||
293 | .sets = qt2410_nand_sets, | ||
294 | }; | ||
295 | |||
296 | /* UDC */ | ||
297 | |||
298 | static struct s3c2410_udc_mach_info qt2410_udc_cfg = { | ||
299 | }; | ||
300 | |||
301 | static char tft_type = 's'; | ||
302 | |||
303 | static int __init qt2410_tft_setup(char *str) | ||
304 | { | ||
305 | tft_type = str[0]; | ||
306 | return 1; | ||
307 | } | ||
308 | |||
309 | __setup("tft=", qt2410_tft_setup); | ||
310 | |||
311 | static void __init qt2410_map_io(void) | ||
312 | { | ||
313 | s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); | ||
314 | s3c24xx_init_clocks(12*1000*1000); | ||
315 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | ||
316 | } | ||
317 | |||
318 | static void __init qt2410_machine_init(void) | ||
319 | { | ||
320 | s3c_nand_set_platdata(&qt2410_nand_info); | ||
321 | |||
322 | switch (tft_type) { | ||
323 | case 'p': /* production */ | ||
324 | qt2410_fb_info.default_display = 1; | ||
325 | break; | ||
326 | case 'b': /* big */ | ||
327 | qt2410_fb_info.default_display = 0; | ||
328 | break; | ||
329 | case 's': /* small */ | ||
330 | default: | ||
331 | qt2410_fb_info.default_display = 2; | ||
332 | break; | ||
333 | } | ||
334 | s3c24xx_fb_set_platdata(&qt2410_fb_info); | ||
335 | |||
336 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPIO_OUTPUT); | ||
337 | s3c2410_gpio_setpin(S3C2410_GPB(0), 1); | ||
338 | |||
339 | s3c24xx_udc_set_platdata(&qt2410_udc_cfg); | ||
340 | s3c_i2c0_set_platdata(NULL); | ||
341 | |||
342 | WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs")); | ||
343 | gpio_direction_output(S3C2410_GPB(5), 1); | ||
344 | |||
345 | platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices)); | ||
346 | s3c_pm_init(); | ||
347 | } | ||
348 | |||
349 | MACHINE_START(QT2410, "QT2410") | ||
350 | .atag_offset = 0x100, | ||
351 | .map_io = qt2410_map_io, | ||
352 | .init_irq = s3c24xx_init_irq, | ||
353 | .init_machine = qt2410_machine_init, | ||
354 | .timer = &s3c24xx_timer, | ||
355 | .restart = s3c2410_restart, | ||
356 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c new file mode 100644 index 000000000000..200debb4c72d --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -0,0 +1,826 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-rx1950.c | ||
2 | * | ||
3 | * Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev, | ||
4 | * Copyright (c) 2007-2010 Vasily Khoruzhick | ||
5 | * | ||
6 | * based on smdk2440 written by Ben Dooks | ||
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 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/memblock.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/serial_core.h> | ||
25 | #include <linux/input.h> | ||
26 | #include <linux/gpio_keys.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/pda_power.h> | ||
29 | #include <linux/pwm_backlight.h> | ||
30 | #include <linux/pwm.h> | ||
31 | #include <linux/s3c_adc_battery.h> | ||
32 | #include <linux/leds.h> | ||
33 | #include <linux/i2c.h> | ||
34 | |||
35 | #include <linux/mtd/mtd.h> | ||
36 | #include <linux/mtd/partitions.h> | ||
37 | |||
38 | #include <linux/mmc/host.h> | ||
39 | |||
40 | #include <asm/mach/arch.h> | ||
41 | #include <asm/mach/map.h> | ||
42 | #include <asm/mach-types.h> | ||
43 | |||
44 | #include <mach/regs-gpio.h> | ||
45 | #include <mach/regs-gpioj.h> | ||
46 | #include <mach/regs-lcd.h> | ||
47 | #include <mach/h1940.h> | ||
48 | #include <mach/fb.h> | ||
49 | |||
50 | #include <plat/clock.h> | ||
51 | #include <plat/regs-serial.h> | ||
52 | #include <plat/regs-iic.h> | ||
53 | #include <plat/mci.h> | ||
54 | #include <plat/udc.h> | ||
55 | #include <plat/nand.h> | ||
56 | #include <plat/iic.h> | ||
57 | #include <plat/devs.h> | ||
58 | #include <plat/cpu.h> | ||
59 | #include <plat/pm.h> | ||
60 | #include <plat/irq.h> | ||
61 | #include <plat/ts.h> | ||
62 | |||
63 | #include <sound/uda1380.h> | ||
64 | |||
65 | #include "common.h" | ||
66 | |||
67 | #define LCD_PWM_PERIOD 192960 | ||
68 | #define LCD_PWM_DUTY 127353 | ||
69 | |||
70 | static struct map_desc rx1950_iodesc[] __initdata = { | ||
71 | }; | ||
72 | |||
73 | static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = { | ||
74 | [0] = { | ||
75 | .hwport = 0, | ||
76 | .flags = 0, | ||
77 | .ucon = 0x3c5, | ||
78 | .ulcon = 0x03, | ||
79 | .ufcon = 0x51, | ||
80 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
81 | }, | ||
82 | [1] = { | ||
83 | .hwport = 1, | ||
84 | .flags = 0, | ||
85 | .ucon = 0x3c5, | ||
86 | .ulcon = 0x03, | ||
87 | .ufcon = 0x51, | ||
88 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
89 | }, | ||
90 | /* IR port */ | ||
91 | [2] = { | ||
92 | .hwport = 2, | ||
93 | .flags = 0, | ||
94 | .ucon = 0x3c5, | ||
95 | .ulcon = 0x43, | ||
96 | .ufcon = 0xf1, | ||
97 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | static struct s3c2410fb_display rx1950_display = { | ||
102 | .type = S3C2410_LCDCON1_TFT, | ||
103 | .width = 240, | ||
104 | .height = 320, | ||
105 | .xres = 240, | ||
106 | .yres = 320, | ||
107 | .bpp = 16, | ||
108 | |||
109 | .pixclock = 260000, | ||
110 | .left_margin = 10, | ||
111 | .right_margin = 20, | ||
112 | .hsync_len = 10, | ||
113 | .upper_margin = 2, | ||
114 | .lower_margin = 2, | ||
115 | .vsync_len = 2, | ||
116 | |||
117 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
118 | S3C2410_LCDCON5_INVVCLK | | ||
119 | S3C2410_LCDCON5_INVVLINE | | ||
120 | S3C2410_LCDCON5_INVVFRAME | | ||
121 | S3C2410_LCDCON5_HWSWP | | ||
122 | (0x02 << 13) | | ||
123 | (0x02 << 15), | ||
124 | |||
125 | }; | ||
126 | |||
127 | static int power_supply_init(struct device *dev) | ||
128 | { | ||
129 | return gpio_request(S3C2410_GPF(2), "cable plugged"); | ||
130 | } | ||
131 | |||
132 | static int rx1950_is_ac_online(void) | ||
133 | { | ||
134 | return !gpio_get_value(S3C2410_GPF(2)); | ||
135 | } | ||
136 | |||
137 | static void power_supply_exit(struct device *dev) | ||
138 | { | ||
139 | gpio_free(S3C2410_GPF(2)); | ||
140 | } | ||
141 | |||
142 | static char *rx1950_supplicants[] = { | ||
143 | "main-battery" | ||
144 | }; | ||
145 | |||
146 | static struct pda_power_pdata power_supply_info = { | ||
147 | .init = power_supply_init, | ||
148 | .is_ac_online = rx1950_is_ac_online, | ||
149 | .exit = power_supply_exit, | ||
150 | .supplied_to = rx1950_supplicants, | ||
151 | .num_supplicants = ARRAY_SIZE(rx1950_supplicants), | ||
152 | }; | ||
153 | |||
154 | static struct resource power_supply_resources[] = { | ||
155 | [0] = { | ||
156 | .name = "ac", | ||
157 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE | | ||
158 | IORESOURCE_IRQ_HIGHEDGE, | ||
159 | .start = IRQ_EINT2, | ||
160 | .end = IRQ_EINT2, | ||
161 | }, | ||
162 | }; | ||
163 | |||
164 | static struct platform_device power_supply = { | ||
165 | .name = "pda-power", | ||
166 | .id = -1, | ||
167 | .dev = { | ||
168 | .platform_data = | ||
169 | &power_supply_info, | ||
170 | }, | ||
171 | .resource = power_supply_resources, | ||
172 | .num_resources = ARRAY_SIZE(power_supply_resources), | ||
173 | }; | ||
174 | |||
175 | static const struct s3c_adc_bat_thresh bat_lut_noac[] = { | ||
176 | { .volt = 4100, .cur = 156, .level = 100}, | ||
177 | { .volt = 4050, .cur = 156, .level = 95}, | ||
178 | { .volt = 4025, .cur = 141, .level = 90}, | ||
179 | { .volt = 3995, .cur = 144, .level = 85}, | ||
180 | { .volt = 3957, .cur = 162, .level = 80}, | ||
181 | { .volt = 3931, .cur = 147, .level = 75}, | ||
182 | { .volt = 3902, .cur = 147, .level = 70}, | ||
183 | { .volt = 3863, .cur = 153, .level = 65}, | ||
184 | { .volt = 3838, .cur = 150, .level = 60}, | ||
185 | { .volt = 3800, .cur = 153, .level = 55}, | ||
186 | { .volt = 3765, .cur = 153, .level = 50}, | ||
187 | { .volt = 3748, .cur = 172, .level = 45}, | ||
188 | { .volt = 3740, .cur = 153, .level = 40}, | ||
189 | { .volt = 3714, .cur = 175, .level = 35}, | ||
190 | { .volt = 3710, .cur = 156, .level = 30}, | ||
191 | { .volt = 3963, .cur = 156, .level = 25}, | ||
192 | { .volt = 3672, .cur = 178, .level = 20}, | ||
193 | { .volt = 3651, .cur = 178, .level = 15}, | ||
194 | { .volt = 3629, .cur = 178, .level = 10}, | ||
195 | { .volt = 3612, .cur = 162, .level = 5}, | ||
196 | { .volt = 3605, .cur = 162, .level = 0}, | ||
197 | }; | ||
198 | |||
199 | static const struct s3c_adc_bat_thresh bat_lut_acin[] = { | ||
200 | { .volt = 4200, .cur = 0, .level = 100}, | ||
201 | { .volt = 4190, .cur = 0, .level = 99}, | ||
202 | { .volt = 4178, .cur = 0, .level = 95}, | ||
203 | { .volt = 4110, .cur = 0, .level = 70}, | ||
204 | { .volt = 4076, .cur = 0, .level = 65}, | ||
205 | { .volt = 4046, .cur = 0, .level = 60}, | ||
206 | { .volt = 4021, .cur = 0, .level = 55}, | ||
207 | { .volt = 3999, .cur = 0, .level = 50}, | ||
208 | { .volt = 3982, .cur = 0, .level = 45}, | ||
209 | { .volt = 3965, .cur = 0, .level = 40}, | ||
210 | { .volt = 3957, .cur = 0, .level = 35}, | ||
211 | { .volt = 3948, .cur = 0, .level = 30}, | ||
212 | { .volt = 3936, .cur = 0, .level = 25}, | ||
213 | { .volt = 3927, .cur = 0, .level = 20}, | ||
214 | { .volt = 3906, .cur = 0, .level = 15}, | ||
215 | { .volt = 3880, .cur = 0, .level = 10}, | ||
216 | { .volt = 3829, .cur = 0, .level = 5}, | ||
217 | { .volt = 3820, .cur = 0, .level = 0}, | ||
218 | }; | ||
219 | |||
220 | static int rx1950_bat_init(void) | ||
221 | { | ||
222 | int ret; | ||
223 | |||
224 | ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1"); | ||
225 | if (ret) | ||
226 | goto err_gpio1; | ||
227 | ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2"); | ||
228 | if (ret) | ||
229 | goto err_gpio2; | ||
230 | |||
231 | return 0; | ||
232 | |||
233 | err_gpio2: | ||
234 | gpio_free(S3C2410_GPJ(2)); | ||
235 | err_gpio1: | ||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static void rx1950_bat_exit(void) | ||
240 | { | ||
241 | gpio_free(S3C2410_GPJ(2)); | ||
242 | gpio_free(S3C2410_GPJ(3)); | ||
243 | } | ||
244 | |||
245 | static void rx1950_enable_charger(void) | ||
246 | { | ||
247 | gpio_direction_output(S3C2410_GPJ(2), 1); | ||
248 | gpio_direction_output(S3C2410_GPJ(3), 1); | ||
249 | } | ||
250 | |||
251 | static void rx1950_disable_charger(void) | ||
252 | { | ||
253 | gpio_direction_output(S3C2410_GPJ(2), 0); | ||
254 | gpio_direction_output(S3C2410_GPJ(3), 0); | ||
255 | } | ||
256 | |||
257 | static DEFINE_SPINLOCK(rx1950_blink_spin); | ||
258 | |||
259 | static int rx1950_led_blink_set(unsigned gpio, int state, | ||
260 | unsigned long *delay_on, unsigned long *delay_off) | ||
261 | { | ||
262 | int blink_gpio, check_gpio; | ||
263 | |||
264 | switch (gpio) { | ||
265 | case S3C2410_GPA(6): | ||
266 | blink_gpio = S3C2410_GPA(4); | ||
267 | check_gpio = S3C2410_GPA(3); | ||
268 | break; | ||
269 | case S3C2410_GPA(7): | ||
270 | blink_gpio = S3C2410_GPA(3); | ||
271 | check_gpio = S3C2410_GPA(4); | ||
272 | break; | ||
273 | default: | ||
274 | return -EINVAL; | ||
275 | break; | ||
276 | } | ||
277 | |||
278 | if (delay_on && delay_off && !*delay_on && !*delay_off) | ||
279 | *delay_on = *delay_off = 500; | ||
280 | |||
281 | spin_lock(&rx1950_blink_spin); | ||
282 | |||
283 | switch (state) { | ||
284 | case GPIO_LED_NO_BLINK_LOW: | ||
285 | case GPIO_LED_NO_BLINK_HIGH: | ||
286 | if (!gpio_get_value(check_gpio)) | ||
287 | gpio_set_value(S3C2410_GPJ(6), 0); | ||
288 | gpio_set_value(blink_gpio, 0); | ||
289 | gpio_set_value(gpio, state); | ||
290 | break; | ||
291 | case GPIO_LED_BLINK: | ||
292 | gpio_set_value(gpio, 0); | ||
293 | gpio_set_value(S3C2410_GPJ(6), 1); | ||
294 | gpio_set_value(blink_gpio, 1); | ||
295 | break; | ||
296 | } | ||
297 | |||
298 | spin_unlock(&rx1950_blink_spin); | ||
299 | |||
300 | return 0; | ||
301 | } | ||
302 | |||
303 | static struct gpio_led rx1950_leds_desc[] = { | ||
304 | { | ||
305 | .name = "Green", | ||
306 | .default_trigger = "main-battery-full", | ||
307 | .gpio = S3C2410_GPA(6), | ||
308 | .retain_state_suspended = 1, | ||
309 | }, | ||
310 | { | ||
311 | .name = "Red", | ||
312 | .default_trigger | ||
313 | = "main-battery-charging-blink-full-solid", | ||
314 | .gpio = S3C2410_GPA(7), | ||
315 | .retain_state_suspended = 1, | ||
316 | }, | ||
317 | { | ||
318 | .name = "Blue", | ||
319 | .default_trigger = "rx1950-acx-mem", | ||
320 | .gpio = S3C2410_GPA(11), | ||
321 | .retain_state_suspended = 1, | ||
322 | }, | ||
323 | }; | ||
324 | |||
325 | static struct gpio_led_platform_data rx1950_leds_pdata = { | ||
326 | .num_leds = ARRAY_SIZE(rx1950_leds_desc), | ||
327 | .leds = rx1950_leds_desc, | ||
328 | .gpio_blink_set = rx1950_led_blink_set, | ||
329 | }; | ||
330 | |||
331 | static struct platform_device rx1950_leds = { | ||
332 | .name = "leds-gpio", | ||
333 | .id = -1, | ||
334 | .dev = { | ||
335 | .platform_data = &rx1950_leds_pdata, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static struct s3c_adc_bat_pdata rx1950_bat_cfg = { | ||
340 | .init = rx1950_bat_init, | ||
341 | .exit = rx1950_bat_exit, | ||
342 | .enable_charger = rx1950_enable_charger, | ||
343 | .disable_charger = rx1950_disable_charger, | ||
344 | .gpio_charge_finished = S3C2410_GPF(3), | ||
345 | .lut_noac = bat_lut_noac, | ||
346 | .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac), | ||
347 | .lut_acin = bat_lut_acin, | ||
348 | .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin), | ||
349 | .volt_channel = 0, | ||
350 | .current_channel = 1, | ||
351 | .volt_mult = 4235, | ||
352 | .current_mult = 2900, | ||
353 | .internal_impedance = 200, | ||
354 | }; | ||
355 | |||
356 | static struct platform_device rx1950_battery = { | ||
357 | .name = "s3c-adc-battery", | ||
358 | .id = -1, | ||
359 | .dev = { | ||
360 | .parent = &s3c_device_adc.dev, | ||
361 | .platform_data = &rx1950_bat_cfg, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | static struct s3c2410fb_mach_info rx1950_lcd_cfg = { | ||
366 | .displays = &rx1950_display, | ||
367 | .num_displays = 1, | ||
368 | .default_display = 0, | ||
369 | |||
370 | .lpcsel = 0x02, | ||
371 | .gpccon = 0xaa9556a9, | ||
372 | .gpccon_mask = 0xffc003fc, | ||
373 | .gpcup = 0x0000ffff, | ||
374 | .gpcup_mask = 0xffffffff, | ||
375 | |||
376 | .gpdcon = 0xaa90aaa1, | ||
377 | .gpdcon_mask = 0xffc0fff0, | ||
378 | .gpdup = 0x0000fcfd, | ||
379 | .gpdup_mask = 0xffffffff, | ||
380 | |||
381 | }; | ||
382 | |||
383 | static struct pwm_device *lcd_pwm; | ||
384 | |||
385 | static void rx1950_lcd_power(int enable) | ||
386 | { | ||
387 | int i; | ||
388 | static int enabled; | ||
389 | if (enabled == enable) | ||
390 | return; | ||
391 | if (!enable) { | ||
392 | |||
393 | /* GPC11-GPC15->OUTPUT */ | ||
394 | for (i = 11; i < 16; i++) | ||
395 | gpio_direction_output(S3C2410_GPC(i), 1); | ||
396 | |||
397 | /* Wait a bit here... */ | ||
398 | mdelay(100); | ||
399 | |||
400 | /* GPD2-GPD7->OUTPUT */ | ||
401 | /* GPD11-GPD15->OUTPUT */ | ||
402 | /* GPD2-GPD7->1, GPD11-GPD15->1 */ | ||
403 | for (i = 2; i < 8; i++) | ||
404 | gpio_direction_output(S3C2410_GPD(i), 1); | ||
405 | for (i = 11; i < 16; i++) | ||
406 | gpio_direction_output(S3C2410_GPD(i), 1); | ||
407 | |||
408 | /* Wait a bit here...*/ | ||
409 | mdelay(100); | ||
410 | |||
411 | /* GPB0->OUTPUT, GPB0->0 */ | ||
412 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
413 | |||
414 | /* GPC1-GPC4->OUTPUT, GPC1-4->0 */ | ||
415 | for (i = 1; i < 5; i++) | ||
416 | gpio_direction_output(S3C2410_GPC(i), 0); | ||
417 | |||
418 | /* GPC15-GPC11->0 */ | ||
419 | for (i = 11; i < 16; i++) | ||
420 | gpio_direction_output(S3C2410_GPC(i), 0); | ||
421 | |||
422 | /* GPD15-GPD11->0, GPD2->GPD7->0 */ | ||
423 | for (i = 11; i < 16; i++) | ||
424 | gpio_direction_output(S3C2410_GPD(i), 0); | ||
425 | |||
426 | for (i = 2; i < 8; i++) | ||
427 | gpio_direction_output(S3C2410_GPD(i), 0); | ||
428 | |||
429 | /* GPC6->0, GPC7->0, GPC5->0 */ | ||
430 | gpio_direction_output(S3C2410_GPC(6), 0); | ||
431 | gpio_direction_output(S3C2410_GPC(7), 0); | ||
432 | gpio_direction_output(S3C2410_GPC(5), 0); | ||
433 | |||
434 | /* GPB1->OUTPUT, GPB1->0 */ | ||
435 | gpio_direction_output(S3C2410_GPB(1), 0); | ||
436 | pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD); | ||
437 | pwm_disable(lcd_pwm); | ||
438 | |||
439 | /* GPC0->0, GPC10->0 */ | ||
440 | gpio_direction_output(S3C2410_GPC(0), 0); | ||
441 | gpio_direction_output(S3C2410_GPC(10), 0); | ||
442 | } else { | ||
443 | pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD); | ||
444 | pwm_enable(lcd_pwm); | ||
445 | |||
446 | gpio_direction_output(S3C2410_GPC(0), 1); | ||
447 | gpio_direction_output(S3C2410_GPC(5), 1); | ||
448 | |||
449 | s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1); | ||
450 | gpio_direction_output(S3C2410_GPC(7), 1); | ||
451 | |||
452 | for (i = 1; i < 5; i++) | ||
453 | s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2)); | ||
454 | |||
455 | for (i = 11; i < 16; i++) | ||
456 | s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2)); | ||
457 | |||
458 | for (i = 2; i < 8; i++) | ||
459 | s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2)); | ||
460 | |||
461 | for (i = 11; i < 16; i++) | ||
462 | s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2)); | ||
463 | |||
464 | gpio_direction_output(S3C2410_GPC(10), 1); | ||
465 | gpio_direction_output(S3C2410_GPC(6), 1); | ||
466 | } | ||
467 | enabled = enable; | ||
468 | } | ||
469 | |||
470 | static void rx1950_bl_power(int enable) | ||
471 | { | ||
472 | static int enabled; | ||
473 | if (enabled == enable) | ||
474 | return; | ||
475 | if (!enable) { | ||
476 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
477 | } else { | ||
478 | /* LED driver need a "push" to power on */ | ||
479 | gpio_direction_output(S3C2410_GPB(0), 1); | ||
480 | /* Warm up backlight for one period of PWM. | ||
481 | * Without this trick its almost impossible to | ||
482 | * enable backlight with low brightness value | ||
483 | */ | ||
484 | ndelay(48000); | ||
485 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | ||
486 | } | ||
487 | enabled = enable; | ||
488 | } | ||
489 | |||
490 | static int rx1950_backlight_init(struct device *dev) | ||
491 | { | ||
492 | WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight")); | ||
493 | lcd_pwm = pwm_request(1, "RX1950 LCD"); | ||
494 | if (IS_ERR(lcd_pwm)) { | ||
495 | dev_err(dev, "Unable to request PWM for LCD power!\n"); | ||
496 | return PTR_ERR(lcd_pwm); | ||
497 | } | ||
498 | |||
499 | rx1950_lcd_power(1); | ||
500 | rx1950_bl_power(1); | ||
501 | |||
502 | return 0; | ||
503 | } | ||
504 | |||
505 | static void rx1950_backlight_exit(struct device *dev) | ||
506 | { | ||
507 | rx1950_bl_power(0); | ||
508 | rx1950_lcd_power(0); | ||
509 | |||
510 | pwm_free(lcd_pwm); | ||
511 | gpio_free(S3C2410_GPB(0)); | ||
512 | } | ||
513 | |||
514 | |||
515 | static int rx1950_backlight_notify(struct device *dev, int brightness) | ||
516 | { | ||
517 | if (!brightness) { | ||
518 | rx1950_bl_power(0); | ||
519 | rx1950_lcd_power(0); | ||
520 | } else { | ||
521 | rx1950_lcd_power(1); | ||
522 | rx1950_bl_power(1); | ||
523 | } | ||
524 | return brightness; | ||
525 | } | ||
526 | |||
527 | static struct platform_pwm_backlight_data rx1950_backlight_data = { | ||
528 | .pwm_id = 0, | ||
529 | .max_brightness = 24, | ||
530 | .dft_brightness = 4, | ||
531 | .pwm_period_ns = 48000, | ||
532 | .init = rx1950_backlight_init, | ||
533 | .notify = rx1950_backlight_notify, | ||
534 | .exit = rx1950_backlight_exit, | ||
535 | }; | ||
536 | |||
537 | static struct platform_device rx1950_backlight = { | ||
538 | .name = "pwm-backlight", | ||
539 | .dev = { | ||
540 | .parent = &s3c_device_timer[0].dev, | ||
541 | .platform_data = &rx1950_backlight_data, | ||
542 | }, | ||
543 | }; | ||
544 | |||
545 | static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd) | ||
546 | { | ||
547 | switch (power_mode) { | ||
548 | case MMC_POWER_OFF: | ||
549 | gpio_direction_output(S3C2410_GPJ(1), 0); | ||
550 | break; | ||
551 | case MMC_POWER_UP: | ||
552 | case MMC_POWER_ON: | ||
553 | gpio_direction_output(S3C2410_GPJ(1), 1); | ||
554 | break; | ||
555 | default: | ||
556 | break; | ||
557 | } | ||
558 | } | ||
559 | |||
560 | static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = { | ||
561 | .gpio_detect = S3C2410_GPF(5), | ||
562 | .gpio_wprotect = S3C2410_GPH(8), | ||
563 | .set_power = rx1950_set_mmc_power, | ||
564 | .ocr_avail = MMC_VDD_32_33, | ||
565 | }; | ||
566 | |||
567 | static struct mtd_partition rx1950_nand_part[] = { | ||
568 | [0] = { | ||
569 | .name = "Boot0", | ||
570 | .offset = 0, | ||
571 | .size = 0x4000, | ||
572 | .mask_flags = MTD_WRITEABLE, | ||
573 | }, | ||
574 | [1] = { | ||
575 | .name = "Boot1", | ||
576 | .offset = MTDPART_OFS_APPEND, | ||
577 | .size = 0x40000, | ||
578 | .mask_flags = MTD_WRITEABLE, | ||
579 | }, | ||
580 | [2] = { | ||
581 | .name = "Kernel", | ||
582 | .offset = MTDPART_OFS_APPEND, | ||
583 | .size = 0x300000, | ||
584 | .mask_flags = 0, | ||
585 | }, | ||
586 | [3] = { | ||
587 | .name = "Filesystem", | ||
588 | .offset = MTDPART_OFS_APPEND, | ||
589 | .size = MTDPART_SIZ_FULL, | ||
590 | .mask_flags = 0, | ||
591 | }, | ||
592 | }; | ||
593 | |||
594 | static struct s3c2410_nand_set rx1950_nand_sets[] = { | ||
595 | [0] = { | ||
596 | .name = "Internal", | ||
597 | .nr_chips = 1, | ||
598 | .nr_partitions = ARRAY_SIZE(rx1950_nand_part), | ||
599 | .partitions = rx1950_nand_part, | ||
600 | }, | ||
601 | }; | ||
602 | |||
603 | static struct s3c2410_platform_nand rx1950_nand_info = { | ||
604 | .tacls = 25, | ||
605 | .twrph0 = 50, | ||
606 | .twrph1 = 15, | ||
607 | .nr_sets = ARRAY_SIZE(rx1950_nand_sets), | ||
608 | .sets = rx1950_nand_sets, | ||
609 | }; | ||
610 | |||
611 | static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = { | ||
612 | .vbus_pin = S3C2410_GPG(5), | ||
613 | .vbus_pin_inverted = 1, | ||
614 | .pullup_pin = S3C2410_GPJ(5), | ||
615 | }; | ||
616 | |||
617 | static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = { | ||
618 | .delay = 10000, | ||
619 | .presc = 49, | ||
620 | .oversampling_shift = 3, | ||
621 | }; | ||
622 | |||
623 | static struct gpio_keys_button rx1950_gpio_keys_table[] = { | ||
624 | { | ||
625 | .code = KEY_POWER, | ||
626 | .gpio = S3C2410_GPF(0), | ||
627 | .active_low = 1, | ||
628 | .desc = "Power button", | ||
629 | .wakeup = 1, | ||
630 | }, | ||
631 | { | ||
632 | .code = KEY_F5, | ||
633 | .gpio = S3C2410_GPF(7), | ||
634 | .active_low = 1, | ||
635 | .desc = "Record button", | ||
636 | }, | ||
637 | { | ||
638 | .code = KEY_F1, | ||
639 | .gpio = S3C2410_GPG(0), | ||
640 | .active_low = 1, | ||
641 | .desc = "Calendar button", | ||
642 | }, | ||
643 | { | ||
644 | .code = KEY_F2, | ||
645 | .gpio = S3C2410_GPG(2), | ||
646 | .active_low = 1, | ||
647 | .desc = "Contacts button", | ||
648 | }, | ||
649 | { | ||
650 | .code = KEY_F3, | ||
651 | .gpio = S3C2410_GPG(3), | ||
652 | .active_low = 1, | ||
653 | .desc = "Mail button", | ||
654 | }, | ||
655 | { | ||
656 | .code = KEY_F4, | ||
657 | .gpio = S3C2410_GPG(7), | ||
658 | .active_low = 1, | ||
659 | .desc = "WLAN button", | ||
660 | }, | ||
661 | { | ||
662 | .code = KEY_LEFT, | ||
663 | .gpio = S3C2410_GPG(10), | ||
664 | .active_low = 1, | ||
665 | .desc = "Left button", | ||
666 | }, | ||
667 | { | ||
668 | .code = KEY_RIGHT, | ||
669 | .gpio = S3C2410_GPG(11), | ||
670 | .active_low = 1, | ||
671 | .desc = "Right button", | ||
672 | }, | ||
673 | { | ||
674 | .code = KEY_UP, | ||
675 | .gpio = S3C2410_GPG(4), | ||
676 | .active_low = 1, | ||
677 | .desc = "Up button", | ||
678 | }, | ||
679 | { | ||
680 | .code = KEY_DOWN, | ||
681 | .gpio = S3C2410_GPG(6), | ||
682 | .active_low = 1, | ||
683 | .desc = "Down button", | ||
684 | }, | ||
685 | { | ||
686 | .code = KEY_ENTER, | ||
687 | .gpio = S3C2410_GPG(9), | ||
688 | .active_low = 1, | ||
689 | .desc = "Ok button" | ||
690 | }, | ||
691 | }; | ||
692 | |||
693 | static struct gpio_keys_platform_data rx1950_gpio_keys_data = { | ||
694 | .buttons = rx1950_gpio_keys_table, | ||
695 | .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table), | ||
696 | }; | ||
697 | |||
698 | static struct platform_device rx1950_device_gpiokeys = { | ||
699 | .name = "gpio-keys", | ||
700 | .dev.platform_data = &rx1950_gpio_keys_data, | ||
701 | }; | ||
702 | |||
703 | static struct uda1380_platform_data uda1380_info = { | ||
704 | .gpio_power = S3C2410_GPJ(0), | ||
705 | .gpio_reset = S3C2410_GPD(0), | ||
706 | .dac_clk = UDA1380_DAC_CLK_SYSCLK, | ||
707 | }; | ||
708 | |||
709 | static struct i2c_board_info rx1950_i2c_devices[] = { | ||
710 | { | ||
711 | I2C_BOARD_INFO("uda1380", 0x1a), | ||
712 | .platform_data = &uda1380_info, | ||
713 | }, | ||
714 | }; | ||
715 | |||
716 | static struct platform_device *rx1950_devices[] __initdata = { | ||
717 | &s3c_device_lcd, | ||
718 | &s3c_device_wdt, | ||
719 | &s3c_device_i2c0, | ||
720 | &s3c_device_iis, | ||
721 | &samsung_asoc_dma, | ||
722 | &s3c_device_usbgadget, | ||
723 | &s3c_device_rtc, | ||
724 | &s3c_device_nand, | ||
725 | &s3c_device_sdi, | ||
726 | &s3c_device_adc, | ||
727 | &s3c_device_ts, | ||
728 | &s3c_device_timer[0], | ||
729 | &s3c_device_timer[1], | ||
730 | &rx1950_backlight, | ||
731 | &rx1950_device_gpiokeys, | ||
732 | &power_supply, | ||
733 | &rx1950_battery, | ||
734 | &rx1950_leds, | ||
735 | }; | ||
736 | |||
737 | static struct clk *rx1950_clocks[] __initdata = { | ||
738 | &s3c24xx_clkout0, | ||
739 | &s3c24xx_clkout1, | ||
740 | }; | ||
741 | |||
742 | static void __init rx1950_map_io(void) | ||
743 | { | ||
744 | s3c24xx_clkout0.parent = &clk_h; | ||
745 | s3c24xx_clkout1.parent = &clk_f; | ||
746 | |||
747 | s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks)); | ||
748 | |||
749 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); | ||
750 | s3c24xx_init_clocks(16934000); | ||
751 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); | ||
752 | |||
753 | /* setup PM */ | ||
754 | |||
755 | #ifdef CONFIG_PM_H1940 | ||
756 | memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8); | ||
757 | #endif | ||
758 | |||
759 | s3c_pm_init(); | ||
760 | } | ||
761 | |||
762 | static void __init rx1950_init_machine(void) | ||
763 | { | ||
764 | int i; | ||
765 | |||
766 | s3c24xx_fb_set_platdata(&rx1950_lcd_cfg); | ||
767 | s3c24xx_udc_set_platdata(&rx1950_udc_cfg); | ||
768 | s3c24xx_ts_set_platdata(&rx1950_ts_cfg); | ||
769 | s3c24xx_mci_set_platdata(&rx1950_mmc_cfg); | ||
770 | s3c_i2c0_set_platdata(NULL); | ||
771 | s3c_nand_set_platdata(&rx1950_nand_info); | ||
772 | |||
773 | /* Turn off suspend on both USB ports, and switch the | ||
774 | * selectable USB port to USB device mode. */ | ||
775 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
776 | S3C2410_MISCCR_USBSUSPND0 | | ||
777 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
778 | |||
779 | /* mmc power is disabled by default */ | ||
780 | WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power")); | ||
781 | gpio_direction_output(S3C2410_GPJ(1), 0); | ||
782 | |||
783 | for (i = 0; i < 8; i++) | ||
784 | WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); | ||
785 | |||
786 | for (i = 10; i < 16; i++) | ||
787 | WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); | ||
788 | |||
789 | for (i = 2; i < 8; i++) | ||
790 | WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); | ||
791 | |||
792 | for (i = 11; i < 16; i++) | ||
793 | WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); | ||
794 | |||
795 | WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); | ||
796 | |||
797 | WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink")); | ||
798 | WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink")); | ||
799 | WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink")); | ||
800 | gpio_direction_output(S3C2410_GPA(3), 0); | ||
801 | gpio_direction_output(S3C2410_GPA(4), 0); | ||
802 | gpio_direction_output(S3C2410_GPJ(6), 0); | ||
803 | |||
804 | platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); | ||
805 | |||
806 | i2c_register_board_info(0, rx1950_i2c_devices, | ||
807 | ARRAY_SIZE(rx1950_i2c_devices)); | ||
808 | } | ||
809 | |||
810 | /* H1940 and RX3715 need to reserve this for suspend */ | ||
811 | static void __init rx1950_reserve(void) | ||
812 | { | ||
813 | memblock_reserve(0x30003000, 0x1000); | ||
814 | memblock_reserve(0x30081000, 0x1000); | ||
815 | } | ||
816 | |||
817 | MACHINE_START(RX1950, "HP iPAQ RX1950") | ||
818 | /* Maintainers: Vasily Khoruzhick */ | ||
819 | .atag_offset = 0x100, | ||
820 | .map_io = rx1950_map_io, | ||
821 | .reserve = rx1950_reserve, | ||
822 | .init_irq = s3c24xx_init_irq, | ||
823 | .init_machine = rx1950_init_machine, | ||
824 | .timer = &s3c24xx_timer, | ||
825 | .restart = s3c244x_restart, | ||
826 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c new file mode 100644 index 000000000000..56af35447598 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c | |||
@@ -0,0 +1,217 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-rx3715.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.handhelds.org/projects/rx3715.html | ||
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 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/memblock.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/tty.h> | ||
22 | #include <linux/console.h> | ||
23 | #include <linux/device.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/serial_core.h> | ||
26 | #include <linux/serial.h> | ||
27 | #include <linux/io.h> | ||
28 | #include <linux/mtd/mtd.h> | ||
29 | #include <linux/mtd/nand.h> | ||
30 | #include <linux/mtd/nand_ecc.h> | ||
31 | #include <linux/mtd/partitions.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | #include <asm/mach/irq.h> | ||
36 | |||
37 | #include <mach/hardware.h> | ||
38 | #include <asm/irq.h> | ||
39 | #include <asm/mach-types.h> | ||
40 | |||
41 | #include <plat/regs-serial.h> | ||
42 | #include <mach/regs-gpio.h> | ||
43 | #include <mach/regs-lcd.h> | ||
44 | |||
45 | #include <mach/h1940.h> | ||
46 | #include <plat/nand.h> | ||
47 | #include <mach/fb.h> | ||
48 | |||
49 | #include <plat/clock.h> | ||
50 | #include <plat/devs.h> | ||
51 | #include <plat/cpu.h> | ||
52 | #include <plat/pm.h> | ||
53 | |||
54 | #include "common.h" | ||
55 | |||
56 | static struct map_desc rx3715_iodesc[] __initdata = { | ||
57 | /* dump ISA space somewhere unused */ | ||
58 | |||
59 | { | ||
60 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
61 | .pfn = __phys_to_pfn(S3C2410_CS3), | ||
62 | .length = SZ_1M, | ||
63 | .type = MT_DEVICE, | ||
64 | }, { | ||
65 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
66 | .pfn = __phys_to_pfn(S3C2410_CS3), | ||
67 | .length = SZ_1M, | ||
68 | .type = MT_DEVICE, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | static struct s3c2410_uartcfg rx3715_uartcfgs[] = { | ||
73 | [0] = { | ||
74 | .hwport = 0, | ||
75 | .flags = 0, | ||
76 | .ucon = 0x3c5, | ||
77 | .ulcon = 0x03, | ||
78 | .ufcon = 0x51, | ||
79 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
80 | }, | ||
81 | [1] = { | ||
82 | .hwport = 1, | ||
83 | .flags = 0, | ||
84 | .ucon = 0x3c5, | ||
85 | .ulcon = 0x03, | ||
86 | .ufcon = 0x00, | ||
87 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
88 | }, | ||
89 | /* IR port */ | ||
90 | [2] = { | ||
91 | .hwport = 2, | ||
92 | .uart_flags = UPF_CONS_FLOW, | ||
93 | .ucon = 0x3c5, | ||
94 | .ulcon = 0x43, | ||
95 | .ufcon = 0x51, | ||
96 | .clk_sel = S3C2410_UCON_CLKSEL3, | ||
97 | } | ||
98 | }; | ||
99 | |||
100 | /* framebuffer lcd controller information */ | ||
101 | |||
102 | static struct s3c2410fb_display rx3715_lcdcfg __initdata = { | ||
103 | .lcdcon5 = S3C2410_LCDCON5_INVVLINE | | ||
104 | S3C2410_LCDCON5_FRM565 | | ||
105 | S3C2410_LCDCON5_HWSWP, | ||
106 | |||
107 | .type = S3C2410_LCDCON1_TFT, | ||
108 | .width = 240, | ||
109 | .height = 320, | ||
110 | |||
111 | .pixclock = 260000, | ||
112 | .xres = 240, | ||
113 | .yres = 320, | ||
114 | .bpp = 16, | ||
115 | .left_margin = 36, | ||
116 | .right_margin = 36, | ||
117 | .hsync_len = 8, | ||
118 | .upper_margin = 6, | ||
119 | .lower_margin = 7, | ||
120 | .vsync_len = 3, | ||
121 | }; | ||
122 | |||
123 | static struct s3c2410fb_mach_info rx3715_fb_info __initdata = { | ||
124 | |||
125 | .displays = &rx3715_lcdcfg, | ||
126 | .num_displays = 1, | ||
127 | .default_display = 0, | ||
128 | |||
129 | .lpcsel = 0xf82, | ||
130 | |||
131 | .gpccon = 0xaa955699, | ||
132 | .gpccon_mask = 0xffc003cc, | ||
133 | .gpcup = 0x0000ffff, | ||
134 | .gpcup_mask = 0xffffffff, | ||
135 | |||
136 | .gpdcon = 0xaa95aaa1, | ||
137 | .gpdcon_mask = 0xffc0fff0, | ||
138 | .gpdup = 0x0000faff, | ||
139 | .gpdup_mask = 0xffffffff, | ||
140 | }; | ||
141 | |||
142 | static struct mtd_partition __initdata rx3715_nand_part[] = { | ||
143 | [0] = { | ||
144 | .name = "Whole Flash", | ||
145 | .offset = 0, | ||
146 | .size = MTDPART_SIZ_FULL, | ||
147 | .mask_flags = MTD_WRITEABLE, | ||
148 | } | ||
149 | }; | ||
150 | |||
151 | static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = { | ||
152 | [0] = { | ||
153 | .name = "Internal", | ||
154 | .nr_chips = 1, | ||
155 | .nr_partitions = ARRAY_SIZE(rx3715_nand_part), | ||
156 | .partitions = rx3715_nand_part, | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | static struct s3c2410_platform_nand __initdata rx3715_nand_info = { | ||
161 | .tacls = 25, | ||
162 | .twrph0 = 50, | ||
163 | .twrph1 = 15, | ||
164 | .nr_sets = ARRAY_SIZE(rx3715_nand_sets), | ||
165 | .sets = rx3715_nand_sets, | ||
166 | }; | ||
167 | |||
168 | static struct platform_device *rx3715_devices[] __initdata = { | ||
169 | &s3c_device_ohci, | ||
170 | &s3c_device_lcd, | ||
171 | &s3c_device_wdt, | ||
172 | &s3c_device_i2c0, | ||
173 | &s3c_device_iis, | ||
174 | &s3c_device_nand, | ||
175 | }; | ||
176 | |||
177 | static void __init rx3715_map_io(void) | ||
178 | { | ||
179 | s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); | ||
180 | s3c24xx_init_clocks(16934000); | ||
181 | s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); | ||
182 | } | ||
183 | |||
184 | /* H1940 and RX3715 need to reserve this for suspend */ | ||
185 | static void __init rx3715_reserve(void) | ||
186 | { | ||
187 | memblock_reserve(0x30003000, 0x1000); | ||
188 | memblock_reserve(0x30081000, 0x1000); | ||
189 | } | ||
190 | |||
191 | static void __init rx3715_init_irq(void) | ||
192 | { | ||
193 | s3c24xx_init_irq(); | ||
194 | } | ||
195 | |||
196 | static void __init rx3715_init_machine(void) | ||
197 | { | ||
198 | #ifdef CONFIG_PM_H1940 | ||
199 | memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); | ||
200 | #endif | ||
201 | s3c_pm_init(); | ||
202 | |||
203 | s3c_nand_set_platdata(&rx3715_nand_info); | ||
204 | s3c24xx_fb_set_platdata(&rx3715_fb_info); | ||
205 | platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices)); | ||
206 | } | ||
207 | |||
208 | MACHINE_START(RX3715, "IPAQ-RX3715") | ||
209 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
210 | .atag_offset = 0x100, | ||
211 | .map_io = rx3715_map_io, | ||
212 | .reserve = rx3715_reserve, | ||
213 | .init_irq = rx3715_init_irq, | ||
214 | .init_machine = rx3715_init_machine, | ||
215 | .timer = &s3c24xx_timer, | ||
216 | .restart = s3c244x_restart, | ||
217 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c new file mode 100644 index 000000000000..bdc27e772876 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-smdk2410.c | ||
2 | * | ||
3 | * linux/arch/arm/mach-s3c2410/mach-smdk2410.c | ||
4 | * | ||
5 | * Copyright (C) 2004 by FS Forth-Systeme GmbH | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * @Author: Jonas Dietsche | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License as | ||
12 | * published by the Free Software Foundation; either version 2 of | ||
13 | * the License, or (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
23 | * MA 02111-1307 USA | ||
24 | * | ||
25 | * @History: | ||
26 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by | ||
27 | * Ben Dooks <ben@simtec.co.uk> | ||
28 | * | ||
29 | ***********************************************************************/ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/types.h> | ||
33 | #include <linux/interrupt.h> | ||
34 | #include <linux/list.h> | ||
35 | #include <linux/timer.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/serial_core.h> | ||
38 | #include <linux/platform_device.h> | ||
39 | #include <linux/io.h> | ||
40 | |||
41 | #include <asm/mach/arch.h> | ||
42 | #include <asm/mach/map.h> | ||
43 | #include <asm/mach/irq.h> | ||
44 | |||
45 | #include <mach/hardware.h> | ||
46 | #include <asm/irq.h> | ||
47 | #include <asm/mach-types.h> | ||
48 | |||
49 | #include <plat/regs-serial.h> | ||
50 | #include <plat/iic.h> | ||
51 | |||
52 | #include <plat/devs.h> | ||
53 | #include <plat/cpu.h> | ||
54 | |||
55 | #include <plat/common-smdk.h> | ||
56 | |||
57 | #include "common.h" | ||
58 | |||
59 | static struct map_desc smdk2410_iodesc[] __initdata = { | ||
60 | /* nothing here yet */ | ||
61 | }; | ||
62 | |||
63 | #define UCON S3C2410_UCON_DEFAULT | ||
64 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
65 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
66 | |||
67 | static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = { | ||
68 | [0] = { | ||
69 | .hwport = 0, | ||
70 | .flags = 0, | ||
71 | .ucon = UCON, | ||
72 | .ulcon = ULCON, | ||
73 | .ufcon = UFCON, | ||
74 | }, | ||
75 | [1] = { | ||
76 | .hwport = 1, | ||
77 | .flags = 0, | ||
78 | .ucon = UCON, | ||
79 | .ulcon = ULCON, | ||
80 | .ufcon = UFCON, | ||
81 | }, | ||
82 | [2] = { | ||
83 | .hwport = 2, | ||
84 | .flags = 0, | ||
85 | .ucon = UCON, | ||
86 | .ulcon = ULCON, | ||
87 | .ufcon = UFCON, | ||
88 | } | ||
89 | }; | ||
90 | |||
91 | static struct platform_device *smdk2410_devices[] __initdata = { | ||
92 | &s3c_device_ohci, | ||
93 | &s3c_device_lcd, | ||
94 | &s3c_device_wdt, | ||
95 | &s3c_device_i2c0, | ||
96 | &s3c_device_iis, | ||
97 | }; | ||
98 | |||
99 | static void __init smdk2410_map_io(void) | ||
100 | { | ||
101 | s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); | ||
102 | s3c24xx_init_clocks(0); | ||
103 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | ||
104 | } | ||
105 | |||
106 | static void __init smdk2410_init(void) | ||
107 | { | ||
108 | s3c_i2c0_set_platdata(NULL); | ||
109 | platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices)); | ||
110 | smdk_machine_init(); | ||
111 | } | ||
112 | |||
113 | MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch | ||
114 | * to SMDK2410 */ | ||
115 | /* Maintainer: Jonas Dietsche */ | ||
116 | .atag_offset = 0x100, | ||
117 | .map_io = smdk2410_map_io, | ||
118 | .init_irq = s3c24xx_init_irq, | ||
119 | .init_machine = smdk2410_init, | ||
120 | .timer = &s3c24xx_timer, | ||
121 | .restart = s3c2410_restart, | ||
122 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c new file mode 100644 index 000000000000..b11451b853d8 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/mach-smdk2413.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Thanks to Dimity Andric (TomTom) and Steven Ryu (Samsung) for the | ||
7 | * loans of SMDK2413 to work with. | ||
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 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/map.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/hardware/iomd.h> | ||
31 | #include <asm/setup.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | |||
35 | //#include <asm/debug-ll.h> | ||
36 | #include <plat/regs-serial.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | #include <mach/regs-lcd.h> | ||
39 | |||
40 | #include <mach/idle.h> | ||
41 | #include <plat/udc.h> | ||
42 | #include <plat/iic.h> | ||
43 | #include <mach/fb.h> | ||
44 | |||
45 | #include <plat/s3c2410.h> | ||
46 | #include <plat/s3c2412.h> | ||
47 | #include <plat/clock.h> | ||
48 | #include <plat/devs.h> | ||
49 | #include <plat/cpu.h> | ||
50 | |||
51 | #include <plat/common-smdk.h> | ||
52 | |||
53 | static struct map_desc smdk2413_iodesc[] __initdata = { | ||
54 | }; | ||
55 | |||
56 | static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = { | ||
57 | [0] = { | ||
58 | .hwport = 0, | ||
59 | .flags = 0, | ||
60 | .ucon = 0x3c5, | ||
61 | .ulcon = 0x03, | ||
62 | .ufcon = 0x51, | ||
63 | }, | ||
64 | [1] = { | ||
65 | .hwport = 1, | ||
66 | .flags = 0, | ||
67 | .ucon = 0x3c5, | ||
68 | .ulcon = 0x03, | ||
69 | .ufcon = 0x51, | ||
70 | }, | ||
71 | /* IR port */ | ||
72 | [2] = { | ||
73 | .hwport = 2, | ||
74 | .flags = 0, | ||
75 | .ucon = 0x3c5, | ||
76 | .ulcon = 0x43, | ||
77 | .ufcon = 0x51, | ||
78 | } | ||
79 | }; | ||
80 | |||
81 | |||
82 | static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = { | ||
83 | .pullup_pin = S3C2410_GPF(2), | ||
84 | }; | ||
85 | |||
86 | |||
87 | static struct platform_device *smdk2413_devices[] __initdata = { | ||
88 | &s3c_device_ohci, | ||
89 | &s3c_device_wdt, | ||
90 | &s3c_device_i2c0, | ||
91 | &s3c_device_iis, | ||
92 | &s3c_device_usbgadget, | ||
93 | }; | ||
94 | |||
95 | static void __init smdk2413_fixup(struct tag *tags, char **cmdline, | ||
96 | struct meminfo *mi) | ||
97 | { | ||
98 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { | ||
99 | mi->nr_banks=1; | ||
100 | mi->bank[0].start = 0x30000000; | ||
101 | mi->bank[0].size = SZ_64M; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | static void __init smdk2413_map_io(void) | ||
106 | { | ||
107 | s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); | ||
108 | s3c24xx_init_clocks(12000000); | ||
109 | s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); | ||
110 | } | ||
111 | |||
112 | static void __init smdk2413_machine_init(void) | ||
113 | { /* Turn off suspend on both USB ports, and switch the | ||
114 | * selectable USB port to USB device mode. */ | ||
115 | |||
116 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
117 | S3C2410_MISCCR_USBSUSPND0 | | ||
118 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
119 | |||
120 | |||
121 | s3c24xx_udc_set_platdata(&smdk2413_udc_cfg); | ||
122 | s3c_i2c0_set_platdata(NULL); | ||
123 | |||
124 | platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices)); | ||
125 | smdk_machine_init(); | ||
126 | } | ||
127 | |||
128 | MACHINE_START(S3C2413, "S3C2413") | ||
129 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
130 | .atag_offset = 0x100, | ||
131 | |||
132 | .fixup = smdk2413_fixup, | ||
133 | .init_irq = s3c24xx_init_irq, | ||
134 | .map_io = smdk2413_map_io, | ||
135 | .init_machine = smdk2413_machine_init, | ||
136 | .timer = &s3c24xx_timer, | ||
137 | .restart = s3c2412_restart, | ||
138 | MACHINE_END | ||
139 | |||
140 | MACHINE_START(SMDK2412, "SMDK2412") | ||
141 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
142 | .atag_offset = 0x100, | ||
143 | |||
144 | .fixup = smdk2413_fixup, | ||
145 | .init_irq = s3c24xx_init_irq, | ||
146 | .map_io = smdk2413_map_io, | ||
147 | .init_machine = smdk2413_machine_init, | ||
148 | .timer = &s3c24xx_timer, | ||
149 | .restart = s3c2412_restart, | ||
150 | MACHINE_END | ||
151 | |||
152 | MACHINE_START(SMDK2413, "SMDK2413") | ||
153 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
154 | .atag_offset = 0x100, | ||
155 | |||
156 | .fixup = smdk2413_fixup, | ||
157 | .init_irq = s3c24xx_init_irq, | ||
158 | .map_io = smdk2413_map_io, | ||
159 | .init_machine = smdk2413_machine_init, | ||
160 | .timer = &s3c24xx_timer, | ||
161 | .restart = s3c2412_restart, | ||
162 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c new file mode 100644 index 000000000000..30a44f806e01 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c | |||
@@ -0,0 +1,256 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/mach-hanlin_v3c.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
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 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/mtd/partitions.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <linux/fb.h> | ||
26 | #include <linux/delay.h> | ||
27 | |||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/irq.h> | ||
31 | |||
32 | #include <mach/hardware.h> | ||
33 | #include <asm/irq.h> | ||
34 | #include <asm/mach-types.h> | ||
35 | |||
36 | #include <plat/regs-serial.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | #include <mach/regs-lcd.h> | ||
39 | #include <mach/regs-s3c2443-clock.h> | ||
40 | |||
41 | #include <mach/idle.h> | ||
42 | #include <mach/leds-gpio.h> | ||
43 | #include <plat/iic.h> | ||
44 | |||
45 | #include <plat/s3c2416.h> | ||
46 | #include <plat/gpio-cfg.h> | ||
47 | #include <plat/clock.h> | ||
48 | #include <plat/devs.h> | ||
49 | #include <plat/cpu.h> | ||
50 | #include <plat/nand.h> | ||
51 | #include <plat/sdhci.h> | ||
52 | #include <plat/udc.h> | ||
53 | #include <linux/platform_data/s3c-hsudc.h> | ||
54 | |||
55 | #include <plat/regs-fb-v4.h> | ||
56 | #include <plat/fb.h> | ||
57 | |||
58 | #include <plat/common-smdk.h> | ||
59 | |||
60 | static struct map_desc smdk2416_iodesc[] __initdata = { | ||
61 | /* ISA IO Space map (memory space selected by A24) */ | ||
62 | |||
63 | { | ||
64 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
65 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
66 | .length = 0x10000, | ||
67 | .type = MT_DEVICE, | ||
68 | }, { | ||
69 | .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000, | ||
70 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
71 | .length = SZ_4M, | ||
72 | .type = MT_DEVICE, | ||
73 | }, { | ||
74 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
75 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
76 | .length = 0x10000, | ||
77 | .type = MT_DEVICE, | ||
78 | }, { | ||
79 | .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000, | ||
80 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
81 | .length = SZ_4M, | ||
82 | .type = MT_DEVICE, | ||
83 | } | ||
84 | }; | ||
85 | |||
86 | #define UCON (S3C2410_UCON_DEFAULT | \ | ||
87 | S3C2440_UCON_PCLK | \ | ||
88 | S3C2443_UCON_RXERR_IRQEN) | ||
89 | |||
90 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE) | ||
91 | |||
92 | #define UFCON (S3C2410_UFCON_RXTRIG8 | \ | ||
93 | S3C2410_UFCON_FIFOMODE | \ | ||
94 | S3C2440_UFCON_TXTRIG16) | ||
95 | |||
96 | static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = { | ||
97 | [0] = { | ||
98 | .hwport = 0, | ||
99 | .flags = 0, | ||
100 | .ucon = UCON, | ||
101 | .ulcon = ULCON, | ||
102 | .ufcon = UFCON, | ||
103 | }, | ||
104 | [1] = { | ||
105 | .hwport = 1, | ||
106 | .flags = 0, | ||
107 | .ucon = UCON, | ||
108 | .ulcon = ULCON, | ||
109 | .ufcon = UFCON, | ||
110 | }, | ||
111 | /* IR port */ | ||
112 | [2] = { | ||
113 | .hwport = 2, | ||
114 | .flags = 0, | ||
115 | .ucon = UCON, | ||
116 | .ulcon = ULCON | 0x50, | ||
117 | .ufcon = UFCON, | ||
118 | }, | ||
119 | [3] = { | ||
120 | .hwport = 3, | ||
121 | .flags = 0, | ||
122 | .ucon = UCON, | ||
123 | .ulcon = ULCON, | ||
124 | .ufcon = UFCON, | ||
125 | } | ||
126 | }; | ||
127 | |||
128 | static void smdk2416_hsudc_gpio_init(void) | ||
129 | { | ||
130 | s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP); | ||
131 | s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE); | ||
132 | s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1)); | ||
133 | s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0); | ||
134 | } | ||
135 | |||
136 | static void smdk2416_hsudc_gpio_uninit(void) | ||
137 | { | ||
138 | s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1); | ||
139 | s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE); | ||
140 | s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0)); | ||
141 | } | ||
142 | |||
143 | static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = { | ||
144 | .epnum = 9, | ||
145 | .gpio_init = smdk2416_hsudc_gpio_init, | ||
146 | .gpio_uninit = smdk2416_hsudc_gpio_uninit, | ||
147 | }; | ||
148 | |||
149 | static struct s3c_fb_pd_win smdk2416_fb_win[] = { | ||
150 | [0] = { | ||
151 | /* think this is the same as the smdk6410 */ | ||
152 | .win_mode = { | ||
153 | .pixclock = 41094, | ||
154 | .left_margin = 8, | ||
155 | .right_margin = 13, | ||
156 | .upper_margin = 7, | ||
157 | .lower_margin = 5, | ||
158 | .hsync_len = 3, | ||
159 | .vsync_len = 1, | ||
160 | .xres = 800, | ||
161 | .yres = 480, | ||
162 | }, | ||
163 | .default_bpp = 16, | ||
164 | .max_bpp = 32, | ||
165 | }, | ||
166 | }; | ||
167 | |||
168 | static void s3c2416_fb_gpio_setup_24bpp(void) | ||
169 | { | ||
170 | unsigned int gpio; | ||
171 | |||
172 | for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) { | ||
173 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
174 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
175 | } | ||
176 | |||
177 | for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) { | ||
178 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
179 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
180 | } | ||
181 | |||
182 | for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) { | ||
183 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
184 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
185 | } | ||
186 | } | ||
187 | |||
188 | static struct s3c_fb_platdata smdk2416_fb_platdata = { | ||
189 | .win[0] = &smdk2416_fb_win[0], | ||
190 | .setup_gpio = s3c2416_fb_gpio_setup_24bpp, | ||
191 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | ||
192 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
193 | }; | ||
194 | |||
195 | static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = { | ||
196 | .max_width = 4, | ||
197 | .cd_type = S3C_SDHCI_CD_GPIO, | ||
198 | .ext_cd_gpio = S3C2410_GPF(1), | ||
199 | .ext_cd_gpio_invert = 1, | ||
200 | }; | ||
201 | |||
202 | static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = { | ||
203 | .max_width = 4, | ||
204 | .cd_type = S3C_SDHCI_CD_NONE, | ||
205 | }; | ||
206 | |||
207 | static struct platform_device *smdk2416_devices[] __initdata = { | ||
208 | &s3c_device_fb, | ||
209 | &s3c_device_wdt, | ||
210 | &s3c_device_ohci, | ||
211 | &s3c_device_i2c0, | ||
212 | &s3c_device_hsmmc0, | ||
213 | &s3c_device_hsmmc1, | ||
214 | &s3c_device_usb_hsudc, | ||
215 | }; | ||
216 | |||
217 | static void __init smdk2416_map_io(void) | ||
218 | { | ||
219 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); | ||
220 | s3c24xx_init_clocks(12000000); | ||
221 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); | ||
222 | } | ||
223 | |||
224 | static void __init smdk2416_machine_init(void) | ||
225 | { | ||
226 | s3c_i2c0_set_platdata(NULL); | ||
227 | s3c_fb_set_platdata(&smdk2416_fb_platdata); | ||
228 | |||
229 | s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata); | ||
230 | s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata); | ||
231 | |||
232 | s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata); | ||
233 | |||
234 | gpio_request(S3C2410_GPB(4), "USBHost Power"); | ||
235 | gpio_direction_output(S3C2410_GPB(4), 1); | ||
236 | |||
237 | gpio_request(S3C2410_GPB(3), "Display Power"); | ||
238 | gpio_direction_output(S3C2410_GPB(3), 1); | ||
239 | |||
240 | gpio_request(S3C2410_GPB(1), "Display Reset"); | ||
241 | gpio_direction_output(S3C2410_GPB(1), 1); | ||
242 | |||
243 | platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices)); | ||
244 | smdk_machine_init(); | ||
245 | } | ||
246 | |||
247 | MACHINE_START(SMDK2416, "SMDK2416") | ||
248 | /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */ | ||
249 | .atag_offset = 0x100, | ||
250 | |||
251 | .init_irq = s3c24xx_init_irq, | ||
252 | .map_io = smdk2416_map_io, | ||
253 | .init_machine = smdk2416_machine_init, | ||
254 | .timer = &s3c24xx_timer, | ||
255 | .restart = s3c2416_restart, | ||
256 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c new file mode 100644 index 000000000000..83a1036d7dcb --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-smdk2440.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.fluff.org/ben/smdk2440/ | ||
7 | * | ||
8 | * Thanks to Dimity Andric and TomTom for the loan of an SMDK2440. | ||
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 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/serial_core.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/irq.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <plat/regs-serial.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | #include <mach/regs-lcd.h> | ||
37 | |||
38 | #include <mach/idle.h> | ||
39 | #include <mach/fb.h> | ||
40 | #include <plat/iic.h> | ||
41 | |||
42 | #include <plat/s3c2410.h> | ||
43 | #include <plat/s3c244x.h> | ||
44 | #include <plat/clock.h> | ||
45 | #include <plat/devs.h> | ||
46 | #include <plat/cpu.h> | ||
47 | |||
48 | #include <plat/common-smdk.h> | ||
49 | |||
50 | #include "common.h" | ||
51 | |||
52 | static struct map_desc smdk2440_iodesc[] __initdata = { | ||
53 | /* ISA IO Space map (memory space selected by A24) */ | ||
54 | |||
55 | { | ||
56 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
57 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
58 | .length = 0x10000, | ||
59 | .type = MT_DEVICE, | ||
60 | }, { | ||
61 | .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000, | ||
62 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
63 | .length = SZ_4M, | ||
64 | .type = MT_DEVICE, | ||
65 | }, { | ||
66 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
67 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
68 | .length = 0x10000, | ||
69 | .type = MT_DEVICE, | ||
70 | }, { | ||
71 | .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000, | ||
72 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
73 | .length = SZ_4M, | ||
74 | .type = MT_DEVICE, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
79 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
80 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
81 | |||
82 | static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = { | ||
83 | [0] = { | ||
84 | .hwport = 0, | ||
85 | .flags = 0, | ||
86 | .ucon = 0x3c5, | ||
87 | .ulcon = 0x03, | ||
88 | .ufcon = 0x51, | ||
89 | }, | ||
90 | [1] = { | ||
91 | .hwport = 1, | ||
92 | .flags = 0, | ||
93 | .ucon = 0x3c5, | ||
94 | .ulcon = 0x03, | ||
95 | .ufcon = 0x51, | ||
96 | }, | ||
97 | /* IR port */ | ||
98 | [2] = { | ||
99 | .hwport = 2, | ||
100 | .flags = 0, | ||
101 | .ucon = 0x3c5, | ||
102 | .ulcon = 0x43, | ||
103 | .ufcon = 0x51, | ||
104 | } | ||
105 | }; | ||
106 | |||
107 | /* LCD driver info */ | ||
108 | |||
109 | static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = { | ||
110 | |||
111 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
112 | S3C2410_LCDCON5_INVVLINE | | ||
113 | S3C2410_LCDCON5_INVVFRAME | | ||
114 | S3C2410_LCDCON5_PWREN | | ||
115 | S3C2410_LCDCON5_HWSWP, | ||
116 | |||
117 | .type = S3C2410_LCDCON1_TFT, | ||
118 | |||
119 | .width = 240, | ||
120 | .height = 320, | ||
121 | |||
122 | .pixclock = 166667, /* HCLK 60 MHz, divisor 10 */ | ||
123 | .xres = 240, | ||
124 | .yres = 320, | ||
125 | .bpp = 16, | ||
126 | .left_margin = 20, | ||
127 | .right_margin = 8, | ||
128 | .hsync_len = 4, | ||
129 | .upper_margin = 8, | ||
130 | .lower_margin = 7, | ||
131 | .vsync_len = 4, | ||
132 | }; | ||
133 | |||
134 | static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = { | ||
135 | .displays = &smdk2440_lcd_cfg, | ||
136 | .num_displays = 1, | ||
137 | .default_display = 0, | ||
138 | |||
139 | #if 0 | ||
140 | /* currently setup by downloader */ | ||
141 | .gpccon = 0xaa940659, | ||
142 | .gpccon_mask = 0xffffffff, | ||
143 | .gpcup = 0x0000ffff, | ||
144 | .gpcup_mask = 0xffffffff, | ||
145 | .gpdcon = 0xaa84aaa0, | ||
146 | .gpdcon_mask = 0xffffffff, | ||
147 | .gpdup = 0x0000faff, | ||
148 | .gpdup_mask = 0xffffffff, | ||
149 | #endif | ||
150 | |||
151 | .lpcsel = ((0xCE6) & ~7) | 1<<4, | ||
152 | }; | ||
153 | |||
154 | static struct platform_device *smdk2440_devices[] __initdata = { | ||
155 | &s3c_device_ohci, | ||
156 | &s3c_device_lcd, | ||
157 | &s3c_device_wdt, | ||
158 | &s3c_device_i2c0, | ||
159 | &s3c_device_iis, | ||
160 | }; | ||
161 | |||
162 | static void __init smdk2440_map_io(void) | ||
163 | { | ||
164 | s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); | ||
165 | s3c24xx_init_clocks(16934400); | ||
166 | s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); | ||
167 | } | ||
168 | |||
169 | static void __init smdk2440_machine_init(void) | ||
170 | { | ||
171 | s3c24xx_fb_set_platdata(&smdk2440_fb_info); | ||
172 | s3c_i2c0_set_platdata(NULL); | ||
173 | |||
174 | platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices)); | ||
175 | smdk_machine_init(); | ||
176 | } | ||
177 | |||
178 | MACHINE_START(S3C2440, "SMDK2440") | ||
179 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
180 | .atag_offset = 0x100, | ||
181 | |||
182 | .init_irq = s3c24xx_init_irq, | ||
183 | .map_io = smdk2440_map_io, | ||
184 | .init_machine = smdk2440_machine_init, | ||
185 | .timer = &s3c24xx_timer, | ||
186 | .restart = s3c244x_restart, | ||
187 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c new file mode 100644 index 000000000000..209236956222 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* linux/arch/arm/mach-s3c2443/mach-smdk2443.c | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.fluff.org/ben/smdk2443/ | ||
7 | * | ||
8 | * Thanks to Samsung for the loan of an SMDK2443 | ||
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 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/serial_core.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/irq.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <plat/regs-serial.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | #include <mach/regs-lcd.h> | ||
37 | |||
38 | #include <mach/idle.h> | ||
39 | #include <mach/fb.h> | ||
40 | #include <plat/iic.h> | ||
41 | |||
42 | #include <plat/s3c2410.h> | ||
43 | #include <plat/s3c2443.h> | ||
44 | #include <plat/clock.h> | ||
45 | #include <plat/devs.h> | ||
46 | #include <plat/cpu.h> | ||
47 | |||
48 | #include <plat/common-smdk.h> | ||
49 | |||
50 | static struct map_desc smdk2443_iodesc[] __initdata = { | ||
51 | /* ISA IO Space map (memory space selected by A24) */ | ||
52 | |||
53 | { | ||
54 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
55 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
56 | .length = 0x10000, | ||
57 | .type = MT_DEVICE, | ||
58 | }, { | ||
59 | .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000, | ||
60 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
61 | .length = SZ_4M, | ||
62 | .type = MT_DEVICE, | ||
63 | }, { | ||
64 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
65 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
66 | .length = 0x10000, | ||
67 | .type = MT_DEVICE, | ||
68 | }, { | ||
69 | .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000, | ||
70 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
71 | .length = SZ_4M, | ||
72 | .type = MT_DEVICE, | ||
73 | } | ||
74 | }; | ||
75 | |||
76 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
77 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
78 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
79 | |||
80 | static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = { | ||
81 | [0] = { | ||
82 | .hwport = 0, | ||
83 | .flags = 0, | ||
84 | .ucon = 0x3c5, | ||
85 | .ulcon = 0x03, | ||
86 | .ufcon = 0x51, | ||
87 | }, | ||
88 | [1] = { | ||
89 | .hwport = 1, | ||
90 | .flags = 0, | ||
91 | .ucon = 0x3c5, | ||
92 | .ulcon = 0x03, | ||
93 | .ufcon = 0x51, | ||
94 | }, | ||
95 | /* IR port */ | ||
96 | [2] = { | ||
97 | .hwport = 2, | ||
98 | .flags = 0, | ||
99 | .ucon = 0x3c5, | ||
100 | .ulcon = 0x43, | ||
101 | .ufcon = 0x51, | ||
102 | }, | ||
103 | [3] = { | ||
104 | .hwport = 3, | ||
105 | .flags = 0, | ||
106 | .ucon = 0x3c5, | ||
107 | .ulcon = 0x03, | ||
108 | .ufcon = 0x51, | ||
109 | } | ||
110 | }; | ||
111 | |||
112 | static struct platform_device *smdk2443_devices[] __initdata = { | ||
113 | &s3c_device_wdt, | ||
114 | &s3c_device_i2c0, | ||
115 | &s3c_device_hsmmc1, | ||
116 | #ifdef CONFIG_SND_SOC_SMDK2443_WM9710 | ||
117 | &s3c_device_ac97, | ||
118 | #endif | ||
119 | }; | ||
120 | |||
121 | static void __init smdk2443_map_io(void) | ||
122 | { | ||
123 | s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); | ||
124 | s3c24xx_init_clocks(12000000); | ||
125 | s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); | ||
126 | } | ||
127 | |||
128 | static void __init smdk2443_machine_init(void) | ||
129 | { | ||
130 | s3c_i2c0_set_platdata(NULL); | ||
131 | |||
132 | #ifdef CONFIG_SND_SOC_SMDK2443_WM9710 | ||
133 | s3c24xx_ac97_setup_gpio(S3C24XX_AC97_GPE0); | ||
134 | #endif | ||
135 | |||
136 | platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices)); | ||
137 | smdk_machine_init(); | ||
138 | } | ||
139 | |||
140 | MACHINE_START(SMDK2443, "SMDK2443") | ||
141 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | ||
142 | .atag_offset = 0x100, | ||
143 | |||
144 | .init_irq = s3c24xx_init_irq, | ||
145 | .map_io = smdk2443_map_io, | ||
146 | .init_machine = smdk2443_machine_init, | ||
147 | .timer = &s3c24xx_timer, | ||
148 | .restart = s3c2443_restart, | ||
149 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c new file mode 100644 index 000000000000..1114666f0efb --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c | |||
@@ -0,0 +1,157 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-tct_hammer.c | ||
2 | * | ||
3 | * Copyright (c) 2007 TinCanTools | ||
4 | * David Anders <danders@amltd.com> | ||
5 | |||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation; either version 2 of | ||
9 | * the License, or (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, | ||
19 | * MA 02111-1307 USA | ||
20 | * | ||
21 | * @History: | ||
22 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by | ||
23 | * Ben Dooks <ben@simtec.co.uk> | ||
24 | * | ||
25 | ***********************************************************************/ | ||
26 | |||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/types.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/timer.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/device.h> | ||
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/serial_core.h> | ||
36 | #include <linux/io.h> | ||
37 | |||
38 | #include <asm/mach/arch.h> | ||
39 | #include <asm/mach/map.h> | ||
40 | #include <asm/mach/irq.h> | ||
41 | #include <asm/mach/flash.h> | ||
42 | |||
43 | #include <mach/hardware.h> | ||
44 | #include <asm/irq.h> | ||
45 | #include <asm/mach-types.h> | ||
46 | |||
47 | #include <plat/regs-serial.h> | ||
48 | #include <plat/iic.h> | ||
49 | #include <plat/devs.h> | ||
50 | #include <plat/cpu.h> | ||
51 | |||
52 | #include <linux/mtd/mtd.h> | ||
53 | #include <linux/mtd/partitions.h> | ||
54 | #include <linux/mtd/map.h> | ||
55 | #include <linux/mtd/physmap.h> | ||
56 | |||
57 | #include "common.h" | ||
58 | |||
59 | static struct resource tct_hammer_nor_resource = { | ||
60 | .start = 0x00000000, | ||
61 | .end = 0x01000000 - 1, | ||
62 | .flags = IORESOURCE_MEM, | ||
63 | }; | ||
64 | |||
65 | static struct mtd_partition tct_hammer_mtd_partitions[] = { | ||
66 | { | ||
67 | .name = "System", | ||
68 | .size = 0x240000, | ||
69 | .offset = 0, | ||
70 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
71 | }, { | ||
72 | .name = "JFFS2", | ||
73 | .size = MTDPART_SIZ_FULL, | ||
74 | .offset = MTDPART_OFS_APPEND, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | static struct physmap_flash_data tct_hammer_flash_data = { | ||
79 | .width = 2, | ||
80 | .parts = tct_hammer_mtd_partitions, | ||
81 | .nr_parts = ARRAY_SIZE(tct_hammer_mtd_partitions), | ||
82 | }; | ||
83 | |||
84 | static struct platform_device tct_hammer_device_nor = { | ||
85 | .name = "physmap-flash", | ||
86 | .id = 0, | ||
87 | .dev = { | ||
88 | .platform_data = &tct_hammer_flash_data, | ||
89 | }, | ||
90 | .num_resources = 1, | ||
91 | .resource = &tct_hammer_nor_resource, | ||
92 | }; | ||
93 | |||
94 | static struct map_desc tct_hammer_iodesc[] __initdata = { | ||
95 | }; | ||
96 | |||
97 | #define UCON S3C2410_UCON_DEFAULT | ||
98 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
99 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
100 | |||
101 | static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = { | ||
102 | [0] = { | ||
103 | .hwport = 0, | ||
104 | .flags = 0, | ||
105 | .ucon = UCON, | ||
106 | .ulcon = ULCON, | ||
107 | .ufcon = UFCON, | ||
108 | }, | ||
109 | [1] = { | ||
110 | .hwport = 1, | ||
111 | .flags = 0, | ||
112 | .ucon = UCON, | ||
113 | .ulcon = ULCON, | ||
114 | .ufcon = UFCON, | ||
115 | }, | ||
116 | [2] = { | ||
117 | .hwport = 2, | ||
118 | .flags = 0, | ||
119 | .ucon = UCON, | ||
120 | .ulcon = ULCON, | ||
121 | .ufcon = UFCON, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | |||
126 | static struct platform_device *tct_hammer_devices[] __initdata = { | ||
127 | &s3c_device_adc, | ||
128 | &s3c_device_wdt, | ||
129 | &s3c_device_i2c0, | ||
130 | &s3c_device_ohci, | ||
131 | &s3c_device_rtc, | ||
132 | &s3c_device_usbgadget, | ||
133 | &s3c_device_sdi, | ||
134 | &tct_hammer_device_nor, | ||
135 | }; | ||
136 | |||
137 | static void __init tct_hammer_map_io(void) | ||
138 | { | ||
139 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); | ||
140 | s3c24xx_init_clocks(0); | ||
141 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); | ||
142 | } | ||
143 | |||
144 | static void __init tct_hammer_init(void) | ||
145 | { | ||
146 | s3c_i2c0_set_platdata(NULL); | ||
147 | platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices)); | ||
148 | } | ||
149 | |||
150 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") | ||
151 | .atag_offset = 0x100, | ||
152 | .map_io = tct_hammer_map_io, | ||
153 | .init_irq = s3c24xx_init_irq, | ||
154 | .init_machine = tct_hammer_init, | ||
155 | .timer = &s3c24xx_timer, | ||
156 | .restart = s3c2410_restart, | ||
157 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c new file mode 100644 index 000000000000..87608d45dac4 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c | |||
@@ -0,0 +1,385 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-vr1000.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Machine support for Thorcom VR1000 board. Designed for Thorcom by | ||
7 | * Simtec Electronics, http://www.simtec.co.uk/ | ||
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 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/dm9000.h> | ||
23 | #include <linux/i2c.h> | ||
24 | |||
25 | #include <linux/serial.h> | ||
26 | #include <linux/tty.h> | ||
27 | #include <linux/serial_8250.h> | ||
28 | #include <linux/serial_reg.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | #include <asm/mach/arch.h> | ||
32 | #include <asm/mach/map.h> | ||
33 | #include <asm/mach/irq.h> | ||
34 | |||
35 | #include <mach/bast-map.h> | ||
36 | #include <mach/vr1000-map.h> | ||
37 | #include <mach/vr1000-irq.h> | ||
38 | #include <mach/vr1000-cpld.h> | ||
39 | |||
40 | #include <mach/hardware.h> | ||
41 | #include <asm/irq.h> | ||
42 | #include <asm/mach-types.h> | ||
43 | |||
44 | #include <plat/regs-serial.h> | ||
45 | #include <mach/regs-gpio.h> | ||
46 | #include <mach/leds-gpio.h> | ||
47 | |||
48 | #include <plat/clock.h> | ||
49 | #include <plat/devs.h> | ||
50 | #include <plat/cpu.h> | ||
51 | #include <plat/iic.h> | ||
52 | #include <plat/audio-simtec.h> | ||
53 | |||
54 | #include "simtec.h" | ||
55 | #include "common.h" | ||
56 | |||
57 | /* macros for virtual address mods for the io space entries */ | ||
58 | #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) | ||
59 | #define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4) | ||
60 | #define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3) | ||
61 | #define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2) | ||
62 | |||
63 | /* macros to modify the physical addresses for io space */ | ||
64 | |||
65 | #define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2)) | ||
66 | #define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3)) | ||
67 | #define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4)) | ||
68 | #define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5)) | ||
69 | |||
70 | static struct map_desc vr1000_iodesc[] __initdata = { | ||
71 | /* ISA IO areas */ | ||
72 | { | ||
73 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
74 | .pfn = PA_CS2(BAST_PA_ISAIO), | ||
75 | .length = SZ_16M, | ||
76 | .type = MT_DEVICE, | ||
77 | }, { | ||
78 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
79 | .pfn = PA_CS3(BAST_PA_ISAIO), | ||
80 | .length = SZ_16M, | ||
81 | .type = MT_DEVICE, | ||
82 | }, | ||
83 | |||
84 | /* CPLD control registers, and external interrupt controls */ | ||
85 | { | ||
86 | .virtual = (u32)VR1000_VA_CTRL1, | ||
87 | .pfn = __phys_to_pfn(VR1000_PA_CTRL1), | ||
88 | .length = SZ_1M, | ||
89 | .type = MT_DEVICE, | ||
90 | }, { | ||
91 | .virtual = (u32)VR1000_VA_CTRL2, | ||
92 | .pfn = __phys_to_pfn(VR1000_PA_CTRL2), | ||
93 | .length = SZ_1M, | ||
94 | .type = MT_DEVICE, | ||
95 | }, { | ||
96 | .virtual = (u32)VR1000_VA_CTRL3, | ||
97 | .pfn = __phys_to_pfn(VR1000_PA_CTRL3), | ||
98 | .length = SZ_1M, | ||
99 | .type = MT_DEVICE, | ||
100 | }, { | ||
101 | .virtual = (u32)VR1000_VA_CTRL4, | ||
102 | .pfn = __phys_to_pfn(VR1000_PA_CTRL4), | ||
103 | .length = SZ_1M, | ||
104 | .type = MT_DEVICE, | ||
105 | }, | ||
106 | }; | ||
107 | |||
108 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
109 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
110 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
111 | |||
112 | static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = { | ||
113 | [0] = { | ||
114 | .hwport = 0, | ||
115 | .flags = 0, | ||
116 | .ucon = UCON, | ||
117 | .ulcon = ULCON, | ||
118 | .ufcon = UFCON, | ||
119 | }, | ||
120 | [1] = { | ||
121 | .hwport = 1, | ||
122 | .flags = 0, | ||
123 | .ucon = UCON, | ||
124 | .ulcon = ULCON, | ||
125 | .ufcon = UFCON, | ||
126 | }, | ||
127 | /* port 2 is not actually used */ | ||
128 | [2] = { | ||
129 | .hwport = 2, | ||
130 | .flags = 0, | ||
131 | .ucon = UCON, | ||
132 | .ulcon = ULCON, | ||
133 | .ufcon = UFCON, | ||
134 | } | ||
135 | }; | ||
136 | |||
137 | /* definitions for the vr1000 extra 16550 serial ports */ | ||
138 | |||
139 | #define VR1000_BAUDBASE (3692307) | ||
140 | |||
141 | #define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5)) | ||
142 | |||
143 | static struct plat_serial8250_port serial_platform_data[] = { | ||
144 | [0] = { | ||
145 | .mapbase = VR1000_SERIAL_MAPBASE(0), | ||
146 | .irq = IRQ_VR1000_SERIAL + 0, | ||
147 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | ||
148 | .iotype = UPIO_MEM, | ||
149 | .regshift = 0, | ||
150 | .uartclk = VR1000_BAUDBASE, | ||
151 | }, | ||
152 | [1] = { | ||
153 | .mapbase = VR1000_SERIAL_MAPBASE(1), | ||
154 | .irq = IRQ_VR1000_SERIAL + 1, | ||
155 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | ||
156 | .iotype = UPIO_MEM, | ||
157 | .regshift = 0, | ||
158 | .uartclk = VR1000_BAUDBASE, | ||
159 | }, | ||
160 | [2] = { | ||
161 | .mapbase = VR1000_SERIAL_MAPBASE(2), | ||
162 | .irq = IRQ_VR1000_SERIAL + 2, | ||
163 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | ||
164 | .iotype = UPIO_MEM, | ||
165 | .regshift = 0, | ||
166 | .uartclk = VR1000_BAUDBASE, | ||
167 | }, | ||
168 | [3] = { | ||
169 | .mapbase = VR1000_SERIAL_MAPBASE(3), | ||
170 | .irq = IRQ_VR1000_SERIAL + 3, | ||
171 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | ||
172 | .iotype = UPIO_MEM, | ||
173 | .regshift = 0, | ||
174 | .uartclk = VR1000_BAUDBASE, | ||
175 | }, | ||
176 | { }, | ||
177 | }; | ||
178 | |||
179 | static struct platform_device serial_device = { | ||
180 | .name = "serial8250", | ||
181 | .id = PLAT8250_DEV_PLATFORM, | ||
182 | .dev = { | ||
183 | .platform_data = serial_platform_data, | ||
184 | }, | ||
185 | }; | ||
186 | |||
187 | /* DM9000 ethernet devices */ | ||
188 | |||
189 | static struct resource vr1000_dm9k0_resource[] = { | ||
190 | [0] = { | ||
191 | .start = S3C2410_CS5 + VR1000_PA_DM9000, | ||
192 | .end = S3C2410_CS5 + VR1000_PA_DM9000 + 3, | ||
193 | .flags = IORESOURCE_MEM | ||
194 | }, | ||
195 | [1] = { | ||
196 | .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, | ||
197 | .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x7f, | ||
198 | .flags = IORESOURCE_MEM | ||
199 | }, | ||
200 | [2] = { | ||
201 | .start = IRQ_VR1000_DM9000A, | ||
202 | .end = IRQ_VR1000_DM9000A, | ||
203 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | ||
204 | } | ||
205 | |||
206 | }; | ||
207 | |||
208 | static struct resource vr1000_dm9k1_resource[] = { | ||
209 | [0] = { | ||
210 | .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, | ||
211 | .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x83, | ||
212 | .flags = IORESOURCE_MEM | ||
213 | }, | ||
214 | [1] = { | ||
215 | .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, | ||
216 | .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0xFF, | ||
217 | .flags = IORESOURCE_MEM | ||
218 | }, | ||
219 | [2] = { | ||
220 | .start = IRQ_VR1000_DM9000N, | ||
221 | .end = IRQ_VR1000_DM9000N, | ||
222 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | ||
223 | } | ||
224 | }; | ||
225 | |||
226 | /* for the moment we limit ourselves to 16bit IO until some | ||
227 | * better IO routines can be written and tested | ||
228 | */ | ||
229 | |||
230 | static struct dm9000_plat_data vr1000_dm9k_platdata = { | ||
231 | .flags = DM9000_PLATF_16BITONLY, | ||
232 | }; | ||
233 | |||
234 | static struct platform_device vr1000_dm9k0 = { | ||
235 | .name = "dm9000", | ||
236 | .id = 0, | ||
237 | .num_resources = ARRAY_SIZE(vr1000_dm9k0_resource), | ||
238 | .resource = vr1000_dm9k0_resource, | ||
239 | .dev = { | ||
240 | .platform_data = &vr1000_dm9k_platdata, | ||
241 | } | ||
242 | }; | ||
243 | |||
244 | static struct platform_device vr1000_dm9k1 = { | ||
245 | .name = "dm9000", | ||
246 | .id = 1, | ||
247 | .num_resources = ARRAY_SIZE(vr1000_dm9k1_resource), | ||
248 | .resource = vr1000_dm9k1_resource, | ||
249 | .dev = { | ||
250 | .platform_data = &vr1000_dm9k_platdata, | ||
251 | } | ||
252 | }; | ||
253 | |||
254 | /* LEDS */ | ||
255 | |||
256 | static struct s3c24xx_led_platdata vr1000_led1_pdata = { | ||
257 | .name = "led1", | ||
258 | .gpio = S3C2410_GPB(0), | ||
259 | .def_trigger = "", | ||
260 | }; | ||
261 | |||
262 | static struct s3c24xx_led_platdata vr1000_led2_pdata = { | ||
263 | .name = "led2", | ||
264 | .gpio = S3C2410_GPB(1), | ||
265 | .def_trigger = "", | ||
266 | }; | ||
267 | |||
268 | static struct s3c24xx_led_platdata vr1000_led3_pdata = { | ||
269 | .name = "led3", | ||
270 | .gpio = S3C2410_GPB(2), | ||
271 | .def_trigger = "", | ||
272 | }; | ||
273 | |||
274 | static struct platform_device vr1000_led1 = { | ||
275 | .name = "s3c24xx_led", | ||
276 | .id = 1, | ||
277 | .dev = { | ||
278 | .platform_data = &vr1000_led1_pdata, | ||
279 | }, | ||
280 | }; | ||
281 | |||
282 | static struct platform_device vr1000_led2 = { | ||
283 | .name = "s3c24xx_led", | ||
284 | .id = 2, | ||
285 | .dev = { | ||
286 | .platform_data = &vr1000_led2_pdata, | ||
287 | }, | ||
288 | }; | ||
289 | |||
290 | static struct platform_device vr1000_led3 = { | ||
291 | .name = "s3c24xx_led", | ||
292 | .id = 3, | ||
293 | .dev = { | ||
294 | .platform_data = &vr1000_led3_pdata, | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | /* I2C devices. */ | ||
299 | |||
300 | static struct i2c_board_info vr1000_i2c_devs[] __initdata = { | ||
301 | { | ||
302 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
303 | }, { | ||
304 | I2C_BOARD_INFO("tmp101", 0x48), | ||
305 | }, { | ||
306 | I2C_BOARD_INFO("m41st87", 0x68), | ||
307 | }, | ||
308 | }; | ||
309 | |||
310 | /* devices for this board */ | ||
311 | |||
312 | static struct platform_device *vr1000_devices[] __initdata = { | ||
313 | &s3c_device_ohci, | ||
314 | &s3c_device_lcd, | ||
315 | &s3c_device_wdt, | ||
316 | &s3c_device_i2c0, | ||
317 | &s3c_device_adc, | ||
318 | &serial_device, | ||
319 | &vr1000_dm9k0, | ||
320 | &vr1000_dm9k1, | ||
321 | &vr1000_led1, | ||
322 | &vr1000_led2, | ||
323 | &vr1000_led3, | ||
324 | }; | ||
325 | |||
326 | static struct clk *vr1000_clocks[] __initdata = { | ||
327 | &s3c24xx_dclk0, | ||
328 | &s3c24xx_dclk1, | ||
329 | &s3c24xx_clkout0, | ||
330 | &s3c24xx_clkout1, | ||
331 | &s3c24xx_uclk, | ||
332 | }; | ||
333 | |||
334 | static void vr1000_power_off(void) | ||
335 | { | ||
336 | gpio_direction_output(S3C2410_GPB(9), 1); | ||
337 | } | ||
338 | |||
339 | static void __init vr1000_map_io(void) | ||
340 | { | ||
341 | /* initialise clock sources */ | ||
342 | |||
343 | s3c24xx_dclk0.parent = &clk_upll; | ||
344 | s3c24xx_dclk0.rate = 12*1000*1000; | ||
345 | |||
346 | s3c24xx_dclk1.parent = NULL; | ||
347 | s3c24xx_dclk1.rate = 3692307; | ||
348 | |||
349 | s3c24xx_clkout0.parent = &s3c24xx_dclk0; | ||
350 | s3c24xx_clkout1.parent = &s3c24xx_dclk1; | ||
351 | |||
352 | s3c24xx_uclk.parent = &s3c24xx_clkout1; | ||
353 | |||
354 | s3c24xx_register_clocks(vr1000_clocks, ARRAY_SIZE(vr1000_clocks)); | ||
355 | |||
356 | pm_power_off = vr1000_power_off; | ||
357 | |||
358 | s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); | ||
359 | s3c24xx_init_clocks(0); | ||
360 | s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); | ||
361 | } | ||
362 | |||
363 | static void __init vr1000_init(void) | ||
364 | { | ||
365 | s3c_i2c0_set_platdata(NULL); | ||
366 | platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices)); | ||
367 | |||
368 | i2c_register_board_info(0, vr1000_i2c_devs, | ||
369 | ARRAY_SIZE(vr1000_i2c_devs)); | ||
370 | |||
371 | nor_simtec_init(); | ||
372 | simtec_audio_add(NULL, true, NULL); | ||
373 | |||
374 | WARN_ON(gpio_request(S3C2410_GPB(9), "power off")); | ||
375 | } | ||
376 | |||
377 | MACHINE_START(VR1000, "Thorcom-VR1000") | ||
378 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | ||
379 | .atag_offset = 0x100, | ||
380 | .map_io = vr1000_map_io, | ||
381 | .init_machine = vr1000_init, | ||
382 | .init_irq = s3c24xx_init_irq, | ||
383 | .timer = &s3c24xx_timer, | ||
384 | .restart = s3c2410_restart, | ||
385 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c new file mode 100644 index 000000000000..94bfaa1fb148 --- /dev/null +++ b/arch/arm/mach-s3c24xx/mach-vstms.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/mach-vstms.c | ||
2 | * | ||
3 | * (C) 2006 Thomas Gleixner <tglx@linutronix.de> | ||
4 | * | ||
5 | * Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics | ||
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/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/mtd/mtd.h> | ||
22 | #include <linux/mtd/nand.h> | ||
23 | #include <linux/mtd/nand_ecc.h> | ||
24 | #include <linux/mtd/partitions.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/setup.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | |||
35 | #include <plat/regs-serial.h> | ||
36 | #include <mach/regs-gpio.h> | ||
37 | #include <mach/regs-lcd.h> | ||
38 | |||
39 | #include <mach/idle.h> | ||
40 | #include <mach/fb.h> | ||
41 | |||
42 | #include <plat/iic.h> | ||
43 | #include <plat/nand.h> | ||
44 | |||
45 | #include <plat/s3c2410.h> | ||
46 | #include <plat/s3c2412.h> | ||
47 | #include <plat/clock.h> | ||
48 | #include <plat/devs.h> | ||
49 | #include <plat/cpu.h> | ||
50 | |||
51 | |||
52 | static struct map_desc vstms_iodesc[] __initdata = { | ||
53 | }; | ||
54 | |||
55 | static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = { | ||
56 | [0] = { | ||
57 | .hwport = 0, | ||
58 | .flags = 0, | ||
59 | .ucon = 0x3c5, | ||
60 | .ulcon = 0x03, | ||
61 | .ufcon = 0x51, | ||
62 | }, | ||
63 | [1] = { | ||
64 | .hwport = 1, | ||
65 | .flags = 0, | ||
66 | .ucon = 0x3c5, | ||
67 | .ulcon = 0x03, | ||
68 | .ufcon = 0x51, | ||
69 | }, | ||
70 | [2] = { | ||
71 | .hwport = 2, | ||
72 | .flags = 0, | ||
73 | .ucon = 0x3c5, | ||
74 | .ulcon = 0x03, | ||
75 | .ufcon = 0x51, | ||
76 | } | ||
77 | }; | ||
78 | |||
79 | static struct mtd_partition __initdata vstms_nand_part[] = { | ||
80 | [0] = { | ||
81 | .name = "Boot Agent", | ||
82 | .size = 0x7C000, | ||
83 | .offset = 0, | ||
84 | }, | ||
85 | [1] = { | ||
86 | .name = "UBoot Config", | ||
87 | .offset = 0x7C000, | ||
88 | .size = 0x4000, | ||
89 | }, | ||
90 | [2] = { | ||
91 | .name = "Kernel", | ||
92 | .offset = 0x80000, | ||
93 | .size = 0x200000, | ||
94 | }, | ||
95 | [3] = { | ||
96 | .name = "RFS", | ||
97 | .offset = 0x280000, | ||
98 | .size = 0x3d80000, | ||
99 | }, | ||
100 | }; | ||
101 | |||
102 | static struct s3c2410_nand_set __initdata vstms_nand_sets[] = { | ||
103 | [0] = { | ||
104 | .name = "NAND", | ||
105 | .nr_chips = 1, | ||
106 | .nr_partitions = ARRAY_SIZE(vstms_nand_part), | ||
107 | .partitions = vstms_nand_part, | ||
108 | }, | ||
109 | }; | ||
110 | |||
111 | /* choose a set of timings which should suit most 512Mbit | ||
112 | * chips and beyond. | ||
113 | */ | ||
114 | |||
115 | static struct s3c2410_platform_nand __initdata vstms_nand_info = { | ||
116 | .tacls = 20, | ||
117 | .twrph0 = 60, | ||
118 | .twrph1 = 20, | ||
119 | .nr_sets = ARRAY_SIZE(vstms_nand_sets), | ||
120 | .sets = vstms_nand_sets, | ||
121 | }; | ||
122 | |||
123 | static struct platform_device *vstms_devices[] __initdata = { | ||
124 | &s3c_device_ohci, | ||
125 | &s3c_device_wdt, | ||
126 | &s3c_device_i2c0, | ||
127 | &s3c_device_iis, | ||
128 | &s3c_device_rtc, | ||
129 | &s3c_device_nand, | ||
130 | }; | ||
131 | |||
132 | static void __init vstms_fixup(struct tag *tags, char **cmdline, | ||
133 | struct meminfo *mi) | ||
134 | { | ||
135 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { | ||
136 | mi->nr_banks=1; | ||
137 | mi->bank[0].start = 0x30000000; | ||
138 | mi->bank[0].size = SZ_64M; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | static void __init vstms_map_io(void) | ||
143 | { | ||
144 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); | ||
145 | s3c24xx_init_clocks(12000000); | ||
146 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); | ||
147 | } | ||
148 | |||
149 | static void __init vstms_init(void) | ||
150 | { | ||
151 | s3c_i2c0_set_platdata(NULL); | ||
152 | s3c_nand_set_platdata(&vstms_nand_info); | ||
153 | |||
154 | platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); | ||
155 | } | ||
156 | |||
157 | MACHINE_START(VSTMS, "VSTMS") | ||
158 | .atag_offset = 0x100, | ||
159 | |||
160 | .fixup = vstms_fixup, | ||
161 | .init_irq = s3c24xx_init_irq, | ||
162 | .init_machine = vstms_init, | ||
163 | .map_io = vstms_map_io, | ||
164 | .timer = &s3c24xx_timer, | ||
165 | .restart = s3c2412_restart, | ||
166 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c24xx/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S new file mode 100644 index 000000000000..c93bf2db9f4d --- /dev/null +++ b/arch/arm/mach-s3c24xx/pm-h1940.S | |||
@@ -0,0 +1,33 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/pm-h1940.S | ||
2 | * | ||
3 | * Copyright (c) 2006 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * H1940 Suspend to RAM | ||
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 as published by | ||
9 | * the Free Software Foundation; either version 2 of the License | ||
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/linkage.h> | ||
22 | #include <asm/assembler.h> | ||
23 | #include <mach/hardware.h> | ||
24 | #include <mach/map.h> | ||
25 | |||
26 | #include <mach/regs-gpio.h> | ||
27 | |||
28 | .text | ||
29 | .global h1940_pm_return | ||
30 | |||
31 | h1940_pm_return: | ||
32 | mov r0, #S3C2410_PA_GPIO | ||
33 | ldr pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ] | ||
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2410.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c new file mode 100644 index 000000000000..03f706dd6009 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pm-s3c2410.c | |||
@@ -0,0 +1,180 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/pm.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 (and compatible) Power Manager (Suspend-To-RAM) 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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/suspend.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/time.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/syscore_ops.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/io.h> | ||
31 | |||
32 | #include <mach/hardware.h> | ||
33 | |||
34 | #include <asm/mach-types.h> | ||
35 | |||
36 | #include <mach/regs-gpio.h> | ||
37 | #include <mach/h1940.h> | ||
38 | |||
39 | #include <plat/cpu.h> | ||
40 | #include <plat/pm.h> | ||
41 | |||
42 | static void s3c2410_pm_prepare(void) | ||
43 | { | ||
44 | /* ensure at least GSTATUS3 has the resume address */ | ||
45 | |||
46 | __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2410_GSTATUS3); | ||
47 | |||
48 | S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); | ||
49 | S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); | ||
50 | |||
51 | if (machine_is_h1940()) { | ||
52 | void *base = phys_to_virt(H1940_SUSPEND_CHECK); | ||
53 | unsigned long ptr; | ||
54 | unsigned long calc = 0; | ||
55 | |||
56 | /* generate check for the bootloader to check on resume */ | ||
57 | |||
58 | for (ptr = 0; ptr < 0x40000; ptr += 0x400) | ||
59 | calc += __raw_readl(base+ptr); | ||
60 | |||
61 | __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); | ||
62 | } | ||
63 | |||
64 | /* RX3715 and RX1950 use similar to H1940 code and the | ||
65 | * same offsets for resume and checksum pointers */ | ||
66 | |||
67 | if (machine_is_rx3715() || machine_is_rx1950()) { | ||
68 | void *base = phys_to_virt(H1940_SUSPEND_CHECK); | ||
69 | unsigned long ptr; | ||
70 | unsigned long calc = 0; | ||
71 | |||
72 | /* generate check for the bootloader to check on resume */ | ||
73 | |||
74 | for (ptr = 0; ptr < 0x40000; ptr += 0x4) | ||
75 | calc += __raw_readl(base+ptr); | ||
76 | |||
77 | __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); | ||
78 | } | ||
79 | |||
80 | if ( machine_is_aml_m5900() ) | ||
81 | s3c2410_gpio_setpin(S3C2410_GPF(2), 1); | ||
82 | |||
83 | if (machine_is_rx1950()) { | ||
84 | /* According to S3C2442 user's manual, page 7-17, | ||
85 | * when the system is operating in NAND boot mode, | ||
86 | * the hardware pin configuration - EINT[23:21] – | ||
87 | * must be set as input for starting up after | ||
88 | * wakeup from sleep mode | ||
89 | */ | ||
90 | s3c_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_INPUT); | ||
91 | s3c_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPIO_INPUT); | ||
92 | s3c_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPIO_INPUT); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | static void s3c2410_pm_resume(void) | ||
97 | { | ||
98 | unsigned long tmp; | ||
99 | |||
100 | /* unset the return-from-sleep flag, to ensure reset */ | ||
101 | |||
102 | tmp = __raw_readl(S3C2410_GSTATUS2); | ||
103 | tmp &= S3C2410_GSTATUS2_OFFRESET; | ||
104 | __raw_writel(tmp, S3C2410_GSTATUS2); | ||
105 | |||
106 | if ( machine_is_aml_m5900() ) | ||
107 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | ||
108 | } | ||
109 | |||
110 | struct syscore_ops s3c2410_pm_syscore_ops = { | ||
111 | .resume = s3c2410_pm_resume, | ||
112 | }; | ||
113 | |||
114 | static int s3c2410_pm_add(struct device *dev, struct subsys_interface *sif) | ||
115 | { | ||
116 | pm_cpu_prep = s3c2410_pm_prepare; | ||
117 | pm_cpu_sleep = s3c2410_cpu_suspend; | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | #if defined(CONFIG_CPU_S3C2410) | ||
123 | static struct subsys_interface s3c2410_pm_interface = { | ||
124 | .name = "s3c2410_pm", | ||
125 | .subsys = &s3c2410_subsys, | ||
126 | .add_dev = s3c2410_pm_add, | ||
127 | }; | ||
128 | |||
129 | /* register ourselves */ | ||
130 | |||
131 | static int __init s3c2410_pm_drvinit(void) | ||
132 | { | ||
133 | return subsys_interface_register(&s3c2410_pm_interface); | ||
134 | } | ||
135 | |||
136 | arch_initcall(s3c2410_pm_drvinit); | ||
137 | |||
138 | static struct subsys_interface s3c2410a_pm_interface = { | ||
139 | .name = "s3c2410a_pm", | ||
140 | .subsys = &s3c2410a_subsys, | ||
141 | .add_dev = s3c2410_pm_add, | ||
142 | }; | ||
143 | |||
144 | static int __init s3c2410a_pm_drvinit(void) | ||
145 | { | ||
146 | return subsys_interface_register(&s3c2410a_pm_interface); | ||
147 | } | ||
148 | |||
149 | arch_initcall(s3c2410a_pm_drvinit); | ||
150 | #endif | ||
151 | |||
152 | #if defined(CONFIG_CPU_S3C2440) | ||
153 | static struct subsys_interface s3c2440_pm_interface = { | ||
154 | .name = "s3c2440_pm", | ||
155 | .subsys = &s3c2440_subsys, | ||
156 | .add_dev = s3c2410_pm_add, | ||
157 | }; | ||
158 | |||
159 | static int __init s3c2440_pm_drvinit(void) | ||
160 | { | ||
161 | return subsys_interface_register(&s3c2440_pm_interface); | ||
162 | } | ||
163 | |||
164 | arch_initcall(s3c2440_pm_drvinit); | ||
165 | #endif | ||
166 | |||
167 | #if defined(CONFIG_CPU_S3C2442) | ||
168 | static struct subsys_interface s3c2442_pm_interface = { | ||
169 | .name = "s3c2442_pm", | ||
170 | .subsys = &s3c2442_subsys, | ||
171 | .add_dev = s3c2410_pm_add, | ||
172 | }; | ||
173 | |||
174 | static int __init s3c2442_pm_drvinit(void) | ||
175 | { | ||
176 | return subsys_interface_register(&s3c2442_pm_interface); | ||
177 | } | ||
178 | |||
179 | arch_initcall(s3c2442_pm_drvinit); | ||
180 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c new file mode 100644 index 000000000000..d04588506ec4 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/pm.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/. | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/syscore_ops.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <asm/cacheflush.h> | ||
26 | #include <asm/irq.h> | ||
27 | |||
28 | #include <mach/regs-power.h> | ||
29 | #include <mach/regs-gpioj.h> | ||
30 | #include <mach/regs-gpio.h> | ||
31 | #include <mach/regs-dsc.h> | ||
32 | |||
33 | #include <plat/cpu.h> | ||
34 | #include <plat/pm.h> | ||
35 | |||
36 | #include <plat/s3c2412.h> | ||
37 | |||
38 | extern void s3c2412_sleep_enter(void); | ||
39 | |||
40 | static int s3c2412_cpu_suspend(unsigned long arg) | ||
41 | { | ||
42 | unsigned long tmp; | ||
43 | |||
44 | /* set our standby method to sleep */ | ||
45 | |||
46 | tmp = __raw_readl(S3C2412_PWRCFG); | ||
47 | tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP; | ||
48 | __raw_writel(tmp, S3C2412_PWRCFG); | ||
49 | |||
50 | s3c2412_sleep_enter(); | ||
51 | |||
52 | panic("sleep resumed to originator?"); | ||
53 | } | ||
54 | |||
55 | static void s3c2412_pm_prepare(void) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) | ||
60 | { | ||
61 | pm_cpu_prep = s3c2412_pm_prepare; | ||
62 | pm_cpu_sleep = s3c2412_cpu_suspend; | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static struct sleep_save s3c2412_sleep[] = { | ||
68 | SAVE_ITEM(S3C2412_DSC0), | ||
69 | SAVE_ITEM(S3C2412_DSC1), | ||
70 | SAVE_ITEM(S3C2413_GPJDAT), | ||
71 | SAVE_ITEM(S3C2413_GPJCON), | ||
72 | SAVE_ITEM(S3C2413_GPJUP), | ||
73 | |||
74 | /* save the PWRCFG to get back to original sleep method */ | ||
75 | |||
76 | SAVE_ITEM(S3C2412_PWRCFG), | ||
77 | |||
78 | /* save the sleep configuration anyway, just in case these | ||
79 | * get damaged during wakeup */ | ||
80 | |||
81 | SAVE_ITEM(S3C2412_GPBSLPCON), | ||
82 | SAVE_ITEM(S3C2412_GPCSLPCON), | ||
83 | SAVE_ITEM(S3C2412_GPDSLPCON), | ||
84 | SAVE_ITEM(S3C2412_GPFSLPCON), | ||
85 | SAVE_ITEM(S3C2412_GPGSLPCON), | ||
86 | SAVE_ITEM(S3C2412_GPHSLPCON), | ||
87 | SAVE_ITEM(S3C2413_GPJSLPCON), | ||
88 | }; | ||
89 | |||
90 | static struct subsys_interface s3c2412_pm_interface = { | ||
91 | .name = "s3c2412_pm", | ||
92 | .subsys = &s3c2412_subsys, | ||
93 | .add_dev = s3c2412_pm_add, | ||
94 | }; | ||
95 | |||
96 | static __init int s3c2412_pm_init(void) | ||
97 | { | ||
98 | return subsys_interface_register(&s3c2412_pm_interface); | ||
99 | } | ||
100 | |||
101 | arch_initcall(s3c2412_pm_init); | ||
102 | |||
103 | static int s3c2412_pm_suspend(void) | ||
104 | { | ||
105 | s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static void s3c2412_pm_resume(void) | ||
110 | { | ||
111 | unsigned long tmp; | ||
112 | |||
113 | tmp = __raw_readl(S3C2412_PWRCFG); | ||
114 | tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK; | ||
115 | tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE; | ||
116 | __raw_writel(tmp, S3C2412_PWRCFG); | ||
117 | |||
118 | s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
119 | } | ||
120 | |||
121 | struct syscore_ops s3c2412_pm_syscore_ops = { | ||
122 | .suspend = s3c2412_pm_suspend, | ||
123 | .resume = s3c2412_pm_resume, | ||
124 | }; | ||
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2416.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c new file mode 100644 index 000000000000..1bd4817b8eb8 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pm-s3c2416.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/pm.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM 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 | #include <linux/device.h> | ||
14 | #include <linux/syscore_ops.h> | ||
15 | #include <linux/io.h> | ||
16 | |||
17 | #include <asm/cacheflush.h> | ||
18 | |||
19 | #include <mach/regs-power.h> | ||
20 | #include <mach/regs-s3c2443-clock.h> | ||
21 | |||
22 | #include <plat/cpu.h> | ||
23 | #include <plat/pm.h> | ||
24 | |||
25 | extern void s3c2412_sleep_enter(void); | ||
26 | |||
27 | static int s3c2416_cpu_suspend(unsigned long arg) | ||
28 | { | ||
29 | /* enable wakeup sources regardless of battery state */ | ||
30 | __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG); | ||
31 | |||
32 | /* set the mode as sleep, 2BED represents "Go to BED" */ | ||
33 | __raw_writel(0x2BED, S3C2443_PWRMODE); | ||
34 | |||
35 | s3c2412_sleep_enter(); | ||
36 | |||
37 | panic("sleep resumed to originator?"); | ||
38 | } | ||
39 | |||
40 | static void s3c2416_pm_prepare(void) | ||
41 | { | ||
42 | /* | ||
43 | * write the magic value u-boot uses to check for resume into | ||
44 | * the INFORM0 register, and ensure INFORM1 is set to the | ||
45 | * correct address to resume from. | ||
46 | */ | ||
47 | __raw_writel(0x2BED, S3C2412_INFORM0); | ||
48 | __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); | ||
49 | } | ||
50 | |||
51 | static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif) | ||
52 | { | ||
53 | pm_cpu_prep = s3c2416_pm_prepare; | ||
54 | pm_cpu_sleep = s3c2416_cpu_suspend; | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static struct subsys_interface s3c2416_pm_interface = { | ||
60 | .name = "s3c2416_pm", | ||
61 | .subsys = &s3c2416_subsys, | ||
62 | .add_dev = s3c2416_pm_add, | ||
63 | }; | ||
64 | |||
65 | static __init int s3c2416_pm_init(void) | ||
66 | { | ||
67 | return subsys_interface_register(&s3c2416_pm_interface); | ||
68 | } | ||
69 | |||
70 | arch_initcall(s3c2416_pm_init); | ||
71 | |||
72 | |||
73 | static void s3c2416_pm_resume(void) | ||
74 | { | ||
75 | /* unset the return-from-sleep amd inform flags */ | ||
76 | __raw_writel(0x0, S3C2443_PWRMODE); | ||
77 | __raw_writel(0x0, S3C2412_INFORM0); | ||
78 | __raw_writel(0x0, S3C2412_INFORM1); | ||
79 | } | ||
80 | |||
81 | struct syscore_ops s3c2416_pm_syscore_ops = { | ||
82 | .resume = s3c2416_pm_resume, | ||
83 | }; | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c new file mode 100644 index 000000000000..061b6bb1a557 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2410.c | |||
@@ -0,0 +1,206 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/s3c2410.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.simtec.co.uk/products/EB2410ITX/ | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/syscore_ops.h> | ||
23 | #include <linux/serial_core.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <plat/cpu-freq.h> | ||
35 | |||
36 | #include <mach/regs-clock.h> | ||
37 | #include <plat/regs-serial.h> | ||
38 | |||
39 | #include <plat/s3c2410.h> | ||
40 | #include <plat/cpu.h> | ||
41 | #include <plat/devs.h> | ||
42 | #include <plat/clock.h> | ||
43 | #include <plat/pll.h> | ||
44 | #include <plat/pm.h> | ||
45 | #include <plat/watchdog-reset.h> | ||
46 | |||
47 | #include <plat/gpio-core.h> | ||
48 | #include <plat/gpio-cfg.h> | ||
49 | #include <plat/gpio-cfg-helpers.h> | ||
50 | |||
51 | /* Initial IO mappings */ | ||
52 | |||
53 | static struct map_desc s3c2410_iodesc[] __initdata = { | ||
54 | IODESC_ENT(CLKPWR), | ||
55 | IODESC_ENT(TIMER), | ||
56 | IODESC_ENT(WATCHDOG), | ||
57 | }; | ||
58 | |||
59 | /* our uart devices */ | ||
60 | |||
61 | /* uart registration process */ | ||
62 | |||
63 | void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
64 | { | ||
65 | s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no); | ||
66 | } | ||
67 | |||
68 | /* s3c2410_map_io | ||
69 | * | ||
70 | * register the standard cpu IO areas, and any passed in from the | ||
71 | * machine specific initialisation. | ||
72 | */ | ||
73 | |||
74 | void __init s3c2410_map_io(void) | ||
75 | { | ||
76 | s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up; | ||
77 | s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up; | ||
78 | |||
79 | iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); | ||
80 | } | ||
81 | |||
82 | void __init_or_cpufreq s3c2410_setup_clocks(void) | ||
83 | { | ||
84 | struct clk *xtal_clk; | ||
85 | unsigned long tmp; | ||
86 | unsigned long xtal; | ||
87 | unsigned long fclk; | ||
88 | unsigned long hclk; | ||
89 | unsigned long pclk; | ||
90 | |||
91 | xtal_clk = clk_get(NULL, "xtal"); | ||
92 | xtal = clk_get_rate(xtal_clk); | ||
93 | clk_put(xtal_clk); | ||
94 | |||
95 | /* now we've got our machine bits initialised, work out what | ||
96 | * clocks we've got */ | ||
97 | |||
98 | fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal); | ||
99 | |||
100 | tmp = __raw_readl(S3C2410_CLKDIVN); | ||
101 | |||
102 | /* work out clock scalings */ | ||
103 | |||
104 | hclk = fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1); | ||
105 | pclk = hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1); | ||
106 | |||
107 | /* print brieft summary of clocks, etc */ | ||
108 | |||
109 | printk("S3C2410: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n", | ||
110 | print_mhz(fclk), print_mhz(hclk), print_mhz(pclk)); | ||
111 | |||
112 | /* initialise the clocks here, to allow other things like the | ||
113 | * console to use them | ||
114 | */ | ||
115 | |||
116 | s3c24xx_setup_clocks(fclk, hclk, pclk); | ||
117 | } | ||
118 | |||
119 | /* fake ARMCLK for use with cpufreq, etc. */ | ||
120 | |||
121 | static struct clk s3c2410_armclk = { | ||
122 | .name = "armclk", | ||
123 | .parent = &clk_f, | ||
124 | .id = -1, | ||
125 | }; | ||
126 | |||
127 | static struct clk_lookup s3c2410_clk_lookup[] = { | ||
128 | CLKDEV_INIT(NULL, "clk_uart_baud0", &clk_p), | ||
129 | CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), | ||
130 | }; | ||
131 | |||
132 | void __init s3c2410_init_clocks(int xtal) | ||
133 | { | ||
134 | s3c24xx_register_baseclocks(xtal); | ||
135 | s3c2410_setup_clocks(); | ||
136 | s3c2410_baseclk_add(); | ||
137 | s3c24xx_register_clock(&s3c2410_armclk); | ||
138 | clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup)); | ||
139 | } | ||
140 | |||
141 | struct bus_type s3c2410_subsys = { | ||
142 | .name = "s3c2410-core", | ||
143 | .dev_name = "s3c2410-core", | ||
144 | }; | ||
145 | |||
146 | /* Note, we would have liked to name this s3c2410-core, but we cannot | ||
147 | * register two subsystems with the same name. | ||
148 | */ | ||
149 | struct bus_type s3c2410a_subsys = { | ||
150 | .name = "s3c2410a-core", | ||
151 | .dev_name = "s3c2410a-core", | ||
152 | }; | ||
153 | |||
154 | static struct device s3c2410_dev = { | ||
155 | .bus = &s3c2410_subsys, | ||
156 | }; | ||
157 | |||
158 | /* need to register the subsystem before we actually register the device, and | ||
159 | * we also need to ensure that it has been initialised before any of the | ||
160 | * drivers even try to use it (even if not on an s3c2410 based system) | ||
161 | * as a driver which may support both 2410 and 2440 may try and use it. | ||
162 | */ | ||
163 | |||
164 | static int __init s3c2410_core_init(void) | ||
165 | { | ||
166 | return subsys_system_register(&s3c2410_subsys, NULL); | ||
167 | } | ||
168 | |||
169 | core_initcall(s3c2410_core_init); | ||
170 | |||
171 | static int __init s3c2410a_core_init(void) | ||
172 | { | ||
173 | return subsys_system_register(&s3c2410a_subsys, NULL); | ||
174 | } | ||
175 | |||
176 | core_initcall(s3c2410a_core_init); | ||
177 | |||
178 | int __init s3c2410_init(void) | ||
179 | { | ||
180 | printk("S3C2410: Initialising architecture\n"); | ||
181 | |||
182 | #ifdef CONFIG_PM | ||
183 | register_syscore_ops(&s3c2410_pm_syscore_ops); | ||
184 | #endif | ||
185 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
186 | |||
187 | return device_register(&s3c2410_dev); | ||
188 | } | ||
189 | |||
190 | int __init s3c2410a_init(void) | ||
191 | { | ||
192 | s3c2410_dev.bus = &s3c2410a_subsys; | ||
193 | return s3c2410_init(); | ||
194 | } | ||
195 | |||
196 | void s3c2410_restart(char mode, const char *cmd) | ||
197 | { | ||
198 | if (mode == 's') { | ||
199 | soft_restart(0); | ||
200 | } | ||
201 | |||
202 | arch_wdt_reset(); | ||
203 | |||
204 | /* we'll take a jump through zero as a poor second */ | ||
205 | soft_restart(0); | ||
206 | } | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c new file mode 100644 index 000000000000..c6eac9871093 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2412.c | |||
@@ -0,0 +1,251 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/s3c2412.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/. | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/syscore_ops.h> | ||
23 | #include <linux/serial_core.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/proc-fns.h> | ||
33 | #include <asm/irq.h> | ||
34 | |||
35 | #include <plat/cpu-freq.h> | ||
36 | |||
37 | #include <mach/regs-clock.h> | ||
38 | #include <plat/regs-serial.h> | ||
39 | #include <mach/regs-power.h> | ||
40 | #include <mach/regs-gpio.h> | ||
41 | #include <mach/regs-gpioj.h> | ||
42 | #include <mach/regs-dsc.h> | ||
43 | #include <plat/regs-spi.h> | ||
44 | #include <mach/regs-s3c2412.h> | ||
45 | |||
46 | #include <plat/s3c2412.h> | ||
47 | #include <plat/cpu.h> | ||
48 | #include <plat/devs.h> | ||
49 | #include <plat/clock.h> | ||
50 | #include <plat/pm.h> | ||
51 | #include <plat/pll.h> | ||
52 | #include <plat/nand-core.h> | ||
53 | |||
54 | #ifndef CONFIG_CPU_S3C2412_ONLY | ||
55 | void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; | ||
56 | |||
57 | static inline void s3c2412_init_gpio2(void) | ||
58 | { | ||
59 | s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10; | ||
60 | } | ||
61 | #else | ||
62 | #define s3c2412_init_gpio2() do { } while(0) | ||
63 | #endif | ||
64 | |||
65 | /* Initial IO mappings */ | ||
66 | |||
67 | static struct map_desc s3c2412_iodesc[] __initdata = { | ||
68 | IODESC_ENT(CLKPWR), | ||
69 | IODESC_ENT(TIMER), | ||
70 | IODESC_ENT(WATCHDOG), | ||
71 | { | ||
72 | .virtual = (unsigned long)S3C2412_VA_SSMC, | ||
73 | .pfn = __phys_to_pfn(S3C2412_PA_SSMC), | ||
74 | .length = SZ_1M, | ||
75 | .type = MT_DEVICE, | ||
76 | }, | ||
77 | { | ||
78 | .virtual = (unsigned long)S3C2412_VA_EBI, | ||
79 | .pfn = __phys_to_pfn(S3C2412_PA_EBI), | ||
80 | .length = SZ_1M, | ||
81 | .type = MT_DEVICE, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | /* uart registration process */ | ||
86 | |||
87 | void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
88 | { | ||
89 | s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no); | ||
90 | |||
91 | /* rename devices that are s3c2412/s3c2413 specific */ | ||
92 | s3c_device_sdi.name = "s3c2412-sdi"; | ||
93 | s3c_device_lcd.name = "s3c2412-lcd"; | ||
94 | s3c_nand_setname("s3c2412-nand"); | ||
95 | |||
96 | /* alter IRQ of SDI controller */ | ||
97 | |||
98 | s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI; | ||
99 | s3c_device_sdi.resource[1].end = IRQ_S3C2412_SDI; | ||
100 | |||
101 | /* spi channel related changes, s3c2412/13 specific */ | ||
102 | s3c_device_spi0.name = "s3c2412-spi"; | ||
103 | s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24; | ||
104 | s3c_device_spi1.name = "s3c2412-spi"; | ||
105 | s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1; | ||
106 | s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24; | ||
107 | |||
108 | } | ||
109 | |||
110 | /* s3c2412_idle | ||
111 | * | ||
112 | * use the standard idle call by ensuring the idle mode | ||
113 | * in power config, then issuing the idle co-processor | ||
114 | * instruction | ||
115 | */ | ||
116 | |||
117 | static void s3c2412_idle(void) | ||
118 | { | ||
119 | unsigned long tmp; | ||
120 | |||
121 | /* ensure our idle mode is to go to idle */ | ||
122 | |||
123 | tmp = __raw_readl(S3C2412_PWRCFG); | ||
124 | tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK; | ||
125 | tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE; | ||
126 | __raw_writel(tmp, S3C2412_PWRCFG); | ||
127 | |||
128 | cpu_do_idle(); | ||
129 | } | ||
130 | |||
131 | void s3c2412_restart(char mode, const char *cmd) | ||
132 | { | ||
133 | if (mode == 's') | ||
134 | soft_restart(0); | ||
135 | |||
136 | /* errata "Watch-dog/Software Reset Problem" specifies that | ||
137 | * this reset must be done with the SYSCLK sourced from | ||
138 | * EXTCLK instead of FOUT to avoid a glitch in the reset | ||
139 | * mechanism. | ||
140 | * | ||
141 | * See the watchdog section of the S3C2412 manual for more | ||
142 | * information on this fix. | ||
143 | */ | ||
144 | |||
145 | __raw_writel(0x00, S3C2412_CLKSRC); | ||
146 | __raw_writel(S3C2412_SWRST_RESET, S3C2412_SWRST); | ||
147 | |||
148 | mdelay(1); | ||
149 | } | ||
150 | |||
151 | /* s3c2412_map_io | ||
152 | * | ||
153 | * register the standard cpu IO areas, and any passed in from the | ||
154 | * machine specific initialisation. | ||
155 | */ | ||
156 | |||
157 | void __init s3c2412_map_io(void) | ||
158 | { | ||
159 | /* move base of IO */ | ||
160 | |||
161 | s3c2412_init_gpio2(); | ||
162 | |||
163 | /* set our idle function */ | ||
164 | |||
165 | arm_pm_idle = s3c2412_idle; | ||
166 | |||
167 | /* register our io-tables */ | ||
168 | |||
169 | iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); | ||
170 | } | ||
171 | |||
172 | void __init_or_cpufreq s3c2412_setup_clocks(void) | ||
173 | { | ||
174 | struct clk *xtal_clk; | ||
175 | unsigned long tmp; | ||
176 | unsigned long xtal; | ||
177 | unsigned long fclk; | ||
178 | unsigned long hclk; | ||
179 | unsigned long pclk; | ||
180 | |||
181 | xtal_clk = clk_get(NULL, "xtal"); | ||
182 | xtal = clk_get_rate(xtal_clk); | ||
183 | clk_put(xtal_clk); | ||
184 | |||
185 | /* now we've got our machine bits initialised, work out what | ||
186 | * clocks we've got */ | ||
187 | |||
188 | fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal * 2); | ||
189 | |||
190 | clk_mpll.rate = fclk; | ||
191 | |||
192 | tmp = __raw_readl(S3C2410_CLKDIVN); | ||
193 | |||
194 | /* work out clock scalings */ | ||
195 | |||
196 | hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1); | ||
197 | hclk /= ((tmp & S3C2412_CLKDIVN_ARMDIVN) ? 2 : 1); | ||
198 | pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1); | ||
199 | |||
200 | /* print brieft summary of clocks, etc */ | ||
201 | |||
202 | printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n", | ||
203 | print_mhz(fclk), print_mhz(hclk), print_mhz(pclk)); | ||
204 | |||
205 | s3c24xx_setup_clocks(fclk, hclk, pclk); | ||
206 | } | ||
207 | |||
208 | void __init s3c2412_init_clocks(int xtal) | ||
209 | { | ||
210 | /* initialise the clocks here, to allow other things like the | ||
211 | * console to use them | ||
212 | */ | ||
213 | |||
214 | s3c24xx_register_baseclocks(xtal); | ||
215 | s3c2412_setup_clocks(); | ||
216 | s3c2412_baseclk_add(); | ||
217 | } | ||
218 | |||
219 | /* need to register the subsystem before we actually register the device, and | ||
220 | * we also need to ensure that it has been initialised before any of the | ||
221 | * drivers even try to use it (even if not on an s3c2412 based system) | ||
222 | * as a driver which may support both 2410 and 2440 may try and use it. | ||
223 | */ | ||
224 | |||
225 | struct bus_type s3c2412_subsys = { | ||
226 | .name = "s3c2412-core", | ||
227 | .dev_name = "s3c2412-core", | ||
228 | }; | ||
229 | |||
230 | static int __init s3c2412_core_init(void) | ||
231 | { | ||
232 | return subsys_system_register(&s3c2412_subsys, NULL); | ||
233 | } | ||
234 | |||
235 | core_initcall(s3c2412_core_init); | ||
236 | |||
237 | static struct device s3c2412_dev = { | ||
238 | .bus = &s3c2412_subsys, | ||
239 | }; | ||
240 | |||
241 | int __init s3c2412_init(void) | ||
242 | { | ||
243 | printk("S3C2412: Initialising architecture\n"); | ||
244 | |||
245 | #ifdef CONFIG_PM | ||
246 | register_syscore_ops(&s3c2412_pm_syscore_ops); | ||
247 | #endif | ||
248 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
249 | |||
250 | return device_register(&s3c2412_dev); | ||
251 | } | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c new file mode 100644 index 000000000000..0e9a71c90ed7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2416.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/s3c2416.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
7 | * | ||
8 | * Samsung S3C2416 Mobile CPU support | ||
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 as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/list.h> | ||
29 | #include <linux/timer.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/gpio.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/serial_core.h> | ||
34 | #include <linux/device.h> | ||
35 | #include <linux/syscore_ops.h> | ||
36 | #include <linux/clk.h> | ||
37 | #include <linux/io.h> | ||
38 | |||
39 | #include <asm/mach/arch.h> | ||
40 | #include <asm/mach/map.h> | ||
41 | #include <asm/mach/irq.h> | ||
42 | |||
43 | #include <mach/hardware.h> | ||
44 | #include <asm/proc-fns.h> | ||
45 | #include <asm/irq.h> | ||
46 | |||
47 | #include <mach/regs-s3c2443-clock.h> | ||
48 | |||
49 | #include <plat/gpio-core.h> | ||
50 | #include <plat/gpio-cfg.h> | ||
51 | #include <plat/gpio-cfg-helpers.h> | ||
52 | #include <plat/s3c2416.h> | ||
53 | #include <plat/devs.h> | ||
54 | #include <plat/cpu.h> | ||
55 | #include <plat/sdhci.h> | ||
56 | #include <plat/pm.h> | ||
57 | |||
58 | #include <plat/iic-core.h> | ||
59 | #include <plat/fb-core.h> | ||
60 | #include <plat/nand-core.h> | ||
61 | #include <plat/adc-core.h> | ||
62 | #include <plat/rtc-core.h> | ||
63 | |||
64 | static struct map_desc s3c2416_iodesc[] __initdata = { | ||
65 | IODESC_ENT(WATCHDOG), | ||
66 | IODESC_ENT(CLKPWR), | ||
67 | IODESC_ENT(TIMER), | ||
68 | }; | ||
69 | |||
70 | struct bus_type s3c2416_subsys = { | ||
71 | .name = "s3c2416-core", | ||
72 | .dev_name = "s3c2416-core", | ||
73 | }; | ||
74 | |||
75 | static struct device s3c2416_dev = { | ||
76 | .bus = &s3c2416_subsys, | ||
77 | }; | ||
78 | |||
79 | void s3c2416_restart(char mode, const char *cmd) | ||
80 | { | ||
81 | if (mode == 's') | ||
82 | soft_restart(0); | ||
83 | |||
84 | __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); | ||
85 | } | ||
86 | |||
87 | int __init s3c2416_init(void) | ||
88 | { | ||
89 | printk(KERN_INFO "S3C2416: Initializing architecture\n"); | ||
90 | |||
91 | /* change WDT IRQ number */ | ||
92 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | ||
93 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; | ||
94 | |||
95 | /* the i2c devices are directly compatible with s3c2440 */ | ||
96 | s3c_i2c0_setname("s3c2440-i2c"); | ||
97 | s3c_i2c1_setname("s3c2440-i2c"); | ||
98 | |||
99 | s3c_fb_setname("s3c2443-fb"); | ||
100 | |||
101 | s3c_adc_setname("s3c2416-adc"); | ||
102 | s3c_rtc_setname("s3c2416-rtc"); | ||
103 | |||
104 | #ifdef CONFIG_PM | ||
105 | register_syscore_ops(&s3c2416_pm_syscore_ops); | ||
106 | #endif | ||
107 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
108 | |||
109 | return device_register(&s3c2416_dev); | ||
110 | } | ||
111 | |||
112 | void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
113 | { | ||
114 | s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); | ||
115 | |||
116 | s3c_nand_setname("s3c2412-nand"); | ||
117 | } | ||
118 | |||
119 | /* s3c2416_map_io | ||
120 | * | ||
121 | * register the standard cpu IO areas, and any passed in from the | ||
122 | * machine specific initialisation. | ||
123 | */ | ||
124 | |||
125 | void __init s3c2416_map_io(void) | ||
126 | { | ||
127 | s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown; | ||
128 | s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown; | ||
129 | |||
130 | /* initialize device information early */ | ||
131 | s3c2416_default_sdhci0(); | ||
132 | s3c2416_default_sdhci1(); | ||
133 | |||
134 | iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); | ||
135 | } | ||
136 | |||
137 | /* need to register the subsystem before we actually register the device, and | ||
138 | * we also need to ensure that it has been initialised before any of the | ||
139 | * drivers even try to use it (even if not on an s3c2416 based system) | ||
140 | * as a driver which may support both 2443 and 2440 may try and use it. | ||
141 | */ | ||
142 | |||
143 | static int __init s3c2416_core_init(void) | ||
144 | { | ||
145 | return subsys_system_register(&s3c2416_subsys, NULL); | ||
146 | } | ||
147 | |||
148 | core_initcall(s3c2416_core_init); | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c new file mode 100644 index 000000000000..2b3dddb49af7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2440.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/s3c2440.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Samsung S3C2440 Mobile CPU 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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/syscore_ops.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <plat/devs.h> | ||
35 | #include <plat/cpu.h> | ||
36 | #include <plat/s3c244x.h> | ||
37 | #include <plat/pm.h> | ||
38 | |||
39 | #include <plat/gpio-core.h> | ||
40 | #include <plat/gpio-cfg.h> | ||
41 | #include <plat/gpio-cfg-helpers.h> | ||
42 | |||
43 | static struct device s3c2440_dev = { | ||
44 | .bus = &s3c2440_subsys, | ||
45 | }; | ||
46 | |||
47 | int __init s3c2440_init(void) | ||
48 | { | ||
49 | printk("S3C2440: Initialising architecture\n"); | ||
50 | |||
51 | /* change irq for watchdog */ | ||
52 | |||
53 | s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; | ||
54 | s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT; | ||
55 | |||
56 | /* register suspend/resume handlers */ | ||
57 | |||
58 | #ifdef CONFIG_PM | ||
59 | register_syscore_ops(&s3c2410_pm_syscore_ops); | ||
60 | #endif | ||
61 | register_syscore_ops(&s3c244x_pm_syscore_ops); | ||
62 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
63 | |||
64 | /* register our system device for everything else */ | ||
65 | |||
66 | return device_register(&s3c2440_dev); | ||
67 | } | ||
68 | |||
69 | void __init s3c2440_map_io(void) | ||
70 | { | ||
71 | s3c244x_map_io(); | ||
72 | |||
73 | s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up; | ||
74 | s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up; | ||
75 | } | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c new file mode 100644 index 000000000000..22cb7c94a8c8 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2442.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* linux/arch/arm/mach-s3c2442/s3c2442.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2442 core and lock support | ||
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 as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/syscore_ops.h> | ||
32 | #include <linux/interrupt.h> | ||
33 | #include <linux/ioport.h> | ||
34 | #include <linux/mutex.h> | ||
35 | #include <linux/gpio.h> | ||
36 | #include <linux/clk.h> | ||
37 | #include <linux/io.h> | ||
38 | |||
39 | #include <mach/hardware.h> | ||
40 | #include <linux/atomic.h> | ||
41 | #include <asm/irq.h> | ||
42 | |||
43 | #include <mach/regs-clock.h> | ||
44 | |||
45 | #include <plat/clock.h> | ||
46 | #include <plat/cpu.h> | ||
47 | #include <plat/s3c244x.h> | ||
48 | #include <plat/pm.h> | ||
49 | |||
50 | #include <plat/gpio-core.h> | ||
51 | #include <plat/gpio-cfg.h> | ||
52 | #include <plat/gpio-cfg-helpers.h> | ||
53 | |||
54 | /* S3C2442 extended clock support */ | ||
55 | |||
56 | static unsigned long s3c2442_camif_upll_round(struct clk *clk, | ||
57 | unsigned long rate) | ||
58 | { | ||
59 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
60 | int div; | ||
61 | |||
62 | if (rate > parent_rate) | ||
63 | return parent_rate; | ||
64 | |||
65 | div = parent_rate / rate; | ||
66 | |||
67 | if (div == 3) | ||
68 | return parent_rate / 3; | ||
69 | |||
70 | /* note, we remove the +/- 1 calculations for the divisor */ | ||
71 | |||
72 | div /= 2; | ||
73 | |||
74 | if (div < 1) | ||
75 | div = 1; | ||
76 | else if (div > 16) | ||
77 | div = 16; | ||
78 | |||
79 | return parent_rate / (div * 2); | ||
80 | } | ||
81 | |||
82 | static int s3c2442_camif_upll_setrate(struct clk *clk, unsigned long rate) | ||
83 | { | ||
84 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
85 | unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); | ||
86 | |||
87 | rate = s3c2442_camif_upll_round(clk, rate); | ||
88 | |||
89 | camdivn &= ~S3C2442_CAMDIVN_CAMCLK_DIV3; | ||
90 | |||
91 | if (rate == parent_rate) { | ||
92 | camdivn &= ~S3C2440_CAMDIVN_CAMCLK_SEL; | ||
93 | } else if ((parent_rate / rate) == 3) { | ||
94 | camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL; | ||
95 | camdivn |= S3C2442_CAMDIVN_CAMCLK_DIV3; | ||
96 | } else { | ||
97 | camdivn &= ~S3C2440_CAMDIVN_CAMCLK_MASK; | ||
98 | camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL; | ||
99 | camdivn |= (((parent_rate / rate) / 2) - 1); | ||
100 | } | ||
101 | |||
102 | __raw_writel(camdivn, S3C2440_CAMDIVN); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /* Extra S3C2442 clocks */ | ||
108 | |||
109 | static struct clk s3c2442_clk_cam = { | ||
110 | .name = "camif", | ||
111 | .id = -1, | ||
112 | .enable = s3c2410_clkcon_enable, | ||
113 | .ctrlbit = S3C2440_CLKCON_CAMERA, | ||
114 | }; | ||
115 | |||
116 | static struct clk s3c2442_clk_cam_upll = { | ||
117 | .name = "camif-upll", | ||
118 | .id = -1, | ||
119 | .ops = &(struct clk_ops) { | ||
120 | .set_rate = s3c2442_camif_upll_setrate, | ||
121 | .round_rate = s3c2442_camif_upll_round, | ||
122 | }, | ||
123 | }; | ||
124 | |||
125 | static int s3c2442_clk_add(struct device *dev, struct subsys_interface *sif) | ||
126 | { | ||
127 | struct clk *clock_upll; | ||
128 | struct clk *clock_h; | ||
129 | struct clk *clock_p; | ||
130 | |||
131 | clock_p = clk_get(NULL, "pclk"); | ||
132 | clock_h = clk_get(NULL, "hclk"); | ||
133 | clock_upll = clk_get(NULL, "upll"); | ||
134 | |||
135 | if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) { | ||
136 | printk(KERN_ERR "S3C2442: Failed to get parent clocks\n"); | ||
137 | return -EINVAL; | ||
138 | } | ||
139 | |||
140 | s3c2442_clk_cam.parent = clock_h; | ||
141 | s3c2442_clk_cam_upll.parent = clock_upll; | ||
142 | |||
143 | s3c24xx_register_clock(&s3c2442_clk_cam); | ||
144 | s3c24xx_register_clock(&s3c2442_clk_cam_upll); | ||
145 | |||
146 | clk_disable(&s3c2442_clk_cam); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static struct subsys_interface s3c2442_clk_interface = { | ||
152 | .name = "s3c2442_clk", | ||
153 | .subsys = &s3c2442_subsys, | ||
154 | .add_dev = s3c2442_clk_add, | ||
155 | }; | ||
156 | |||
157 | static __init int s3c2442_clk_init(void) | ||
158 | { | ||
159 | return subsys_interface_register(&s3c2442_clk_interface); | ||
160 | } | ||
161 | |||
162 | arch_initcall(s3c2442_clk_init); | ||
163 | |||
164 | |||
165 | static struct device s3c2442_dev = { | ||
166 | .bus = &s3c2442_subsys, | ||
167 | }; | ||
168 | |||
169 | int __init s3c2442_init(void) | ||
170 | { | ||
171 | printk("S3C2442: Initialising architecture\n"); | ||
172 | |||
173 | #ifdef CONFIG_PM | ||
174 | register_syscore_ops(&s3c2410_pm_syscore_ops); | ||
175 | #endif | ||
176 | register_syscore_ops(&s3c244x_pm_syscore_ops); | ||
177 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
178 | |||
179 | return device_register(&s3c2442_dev); | ||
180 | } | ||
181 | |||
182 | void __init s3c2442_map_io(void) | ||
183 | { | ||
184 | s3c244x_map_io(); | ||
185 | |||
186 | s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1down; | ||
187 | s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1down; | ||
188 | } | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c new file mode 100644 index 000000000000..b7778a9dafaf --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2443.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* linux/arch/arm/mach-s3c2443/s3c2443.c | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Samsung S3C2443 Mobile CPU 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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <mach/regs-s3c2443-clock.h> | ||
34 | |||
35 | #include <plat/gpio-core.h> | ||
36 | #include <plat/gpio-cfg.h> | ||
37 | #include <plat/gpio-cfg-helpers.h> | ||
38 | #include <plat/s3c2443.h> | ||
39 | #include <plat/devs.h> | ||
40 | #include <plat/cpu.h> | ||
41 | #include <plat/fb-core.h> | ||
42 | #include <plat/nand-core.h> | ||
43 | #include <plat/adc-core.h> | ||
44 | #include <plat/rtc-core.h> | ||
45 | |||
46 | static struct map_desc s3c2443_iodesc[] __initdata = { | ||
47 | IODESC_ENT(WATCHDOG), | ||
48 | IODESC_ENT(CLKPWR), | ||
49 | IODESC_ENT(TIMER), | ||
50 | }; | ||
51 | |||
52 | struct bus_type s3c2443_subsys = { | ||
53 | .name = "s3c2443-core", | ||
54 | .dev_name = "s3c2443-core", | ||
55 | }; | ||
56 | |||
57 | static struct device s3c2443_dev = { | ||
58 | .bus = &s3c2443_subsys, | ||
59 | }; | ||
60 | |||
61 | void s3c2443_restart(char mode, const char *cmd) | ||
62 | { | ||
63 | if (mode == 's') | ||
64 | soft_restart(0); | ||
65 | |||
66 | __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); | ||
67 | } | ||
68 | |||
69 | int __init s3c2443_init(void) | ||
70 | { | ||
71 | printk("S3C2443: Initialising architecture\n"); | ||
72 | |||
73 | s3c_nand_setname("s3c2412-nand"); | ||
74 | s3c_fb_setname("s3c2443-fb"); | ||
75 | |||
76 | s3c_adc_setname("s3c2443-adc"); | ||
77 | s3c_rtc_setname("s3c2443-rtc"); | ||
78 | |||
79 | /* change WDT IRQ number */ | ||
80 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | ||
81 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; | ||
82 | |||
83 | return device_register(&s3c2443_dev); | ||
84 | } | ||
85 | |||
86 | void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
87 | { | ||
88 | s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); | ||
89 | } | ||
90 | |||
91 | /* s3c2443_map_io | ||
92 | * | ||
93 | * register the standard cpu IO areas, and any passed in from the | ||
94 | * machine specific initialisation. | ||
95 | */ | ||
96 | |||
97 | void __init s3c2443_map_io(void) | ||
98 | { | ||
99 | s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull; | ||
100 | s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull; | ||
101 | |||
102 | iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); | ||
103 | } | ||
104 | |||
105 | /* need to register the subsystem before we actually register the device, and | ||
106 | * we also need to ensure that it has been initialised before any of the | ||
107 | * drivers even try to use it (even if not on an s3c2443 based system) | ||
108 | * as a driver which may support both 2443 and 2440 may try and use it. | ||
109 | */ | ||
110 | |||
111 | static int __init s3c2443_core_init(void) | ||
112 | { | ||
113 | return subsys_system_register(&s3c2443_subsys, NULL); | ||
114 | } | ||
115 | |||
116 | core_initcall(s3c2443_core_init); | ||
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c new file mode 100644 index 000000000000..d15852f642b7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c244x.c | |||
@@ -0,0 +1,210 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/s3c244x.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443) | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/serial_core.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/syscore_ops.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <plat/cpu-freq.h> | ||
34 | |||
35 | #include <mach/regs-clock.h> | ||
36 | #include <plat/regs-serial.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | #include <mach/regs-gpioj.h> | ||
39 | #include <mach/regs-dsc.h> | ||
40 | |||
41 | #include <plat/s3c2410.h> | ||
42 | #include <plat/s3c244x.h> | ||
43 | #include <plat/clock.h> | ||
44 | #include <plat/devs.h> | ||
45 | #include <plat/cpu.h> | ||
46 | #include <plat/pm.h> | ||
47 | #include <plat/pll.h> | ||
48 | #include <plat/nand-core.h> | ||
49 | #include <plat/watchdog-reset.h> | ||
50 | |||
51 | static struct map_desc s3c244x_iodesc[] __initdata = { | ||
52 | IODESC_ENT(CLKPWR), | ||
53 | IODESC_ENT(TIMER), | ||
54 | IODESC_ENT(WATCHDOG), | ||
55 | }; | ||
56 | |||
57 | /* uart initialisation */ | ||
58 | |||
59 | void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
60 | { | ||
61 | s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); | ||
62 | } | ||
63 | |||
64 | void __init s3c244x_map_io(void) | ||
65 | { | ||
66 | /* register our io-tables */ | ||
67 | |||
68 | iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc)); | ||
69 | |||
70 | /* rename any peripherals used differing from the s3c2410 */ | ||
71 | |||
72 | s3c_device_sdi.name = "s3c2440-sdi"; | ||
73 | s3c_device_i2c0.name = "s3c2440-i2c"; | ||
74 | s3c_nand_setname("s3c2440-nand"); | ||
75 | s3c_device_ts.name = "s3c2440-ts"; | ||
76 | s3c_device_usbgadget.name = "s3c2440-usbgadget"; | ||
77 | } | ||
78 | |||
79 | void __init_or_cpufreq s3c244x_setup_clocks(void) | ||
80 | { | ||
81 | struct clk *xtal_clk; | ||
82 | unsigned long clkdiv; | ||
83 | unsigned long camdiv; | ||
84 | unsigned long xtal; | ||
85 | unsigned long hclk, fclk, pclk; | ||
86 | int hdiv = 1; | ||
87 | |||
88 | xtal_clk = clk_get(NULL, "xtal"); | ||
89 | xtal = clk_get_rate(xtal_clk); | ||
90 | clk_put(xtal_clk); | ||
91 | |||
92 | fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2; | ||
93 | |||
94 | clkdiv = __raw_readl(S3C2410_CLKDIVN); | ||
95 | camdiv = __raw_readl(S3C2440_CAMDIVN); | ||
96 | |||
97 | /* work out clock scalings */ | ||
98 | |||
99 | switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) { | ||
100 | case S3C2440_CLKDIVN_HDIVN_1: | ||
101 | hdiv = 1; | ||
102 | break; | ||
103 | |||
104 | case S3C2440_CLKDIVN_HDIVN_2: | ||
105 | hdiv = 2; | ||
106 | break; | ||
107 | |||
108 | case S3C2440_CLKDIVN_HDIVN_4_8: | ||
109 | hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4; | ||
110 | break; | ||
111 | |||
112 | case S3C2440_CLKDIVN_HDIVN_3_6: | ||
113 | hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3; | ||
114 | break; | ||
115 | } | ||
116 | |||
117 | hclk = fclk / hdiv; | ||
118 | pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN) ? 2 : 1); | ||
119 | |||
120 | /* print brief summary of clocks, etc */ | ||
121 | |||
122 | printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n", | ||
123 | print_mhz(fclk), print_mhz(hclk), print_mhz(pclk)); | ||
124 | |||
125 | s3c24xx_setup_clocks(fclk, hclk, pclk); | ||
126 | } | ||
127 | |||
128 | void __init s3c244x_init_clocks(int xtal) | ||
129 | { | ||
130 | /* initialise the clocks here, to allow other things like the | ||
131 | * console to use them, and to add new ones after the initialisation | ||
132 | */ | ||
133 | |||
134 | s3c24xx_register_baseclocks(xtal); | ||
135 | s3c244x_setup_clocks(); | ||
136 | s3c2410_baseclk_add(); | ||
137 | } | ||
138 | |||
139 | /* Since the S3C2442 and S3C2440 share items, put both subsystems here */ | ||
140 | |||
141 | struct bus_type s3c2440_subsys = { | ||
142 | .name = "s3c2440-core", | ||
143 | .dev_name = "s3c2440-core", | ||
144 | }; | ||
145 | |||
146 | struct bus_type s3c2442_subsys = { | ||
147 | .name = "s3c2442-core", | ||
148 | .dev_name = "s3c2442-core", | ||
149 | }; | ||
150 | |||
151 | /* need to register the subsystem before we actually register the device, and | ||
152 | * we also need to ensure that it has been initialised before any of the | ||
153 | * drivers even try to use it (even if not on an s3c2440 based system) | ||
154 | * as a driver which may support both 2410 and 2440 may try and use it. | ||
155 | */ | ||
156 | |||
157 | static int __init s3c2440_core_init(void) | ||
158 | { | ||
159 | return subsys_system_register(&s3c2440_subsys, NULL); | ||
160 | } | ||
161 | |||
162 | core_initcall(s3c2440_core_init); | ||
163 | |||
164 | static int __init s3c2442_core_init(void) | ||
165 | { | ||
166 | return subsys_system_register(&s3c2442_subsys, NULL); | ||
167 | } | ||
168 | |||
169 | core_initcall(s3c2442_core_init); | ||
170 | |||
171 | |||
172 | #ifdef CONFIG_PM | ||
173 | static struct sleep_save s3c244x_sleep[] = { | ||
174 | SAVE_ITEM(S3C2440_DSC0), | ||
175 | SAVE_ITEM(S3C2440_DSC1), | ||
176 | SAVE_ITEM(S3C2440_GPJDAT), | ||
177 | SAVE_ITEM(S3C2440_GPJCON), | ||
178 | SAVE_ITEM(S3C2440_GPJUP) | ||
179 | }; | ||
180 | |||
181 | static int s3c244x_suspend(void) | ||
182 | { | ||
183 | s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep)); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static void s3c244x_resume(void) | ||
188 | { | ||
189 | s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep)); | ||
190 | } | ||
191 | #else | ||
192 | #define s3c244x_suspend NULL | ||
193 | #define s3c244x_resume NULL | ||
194 | #endif | ||
195 | |||
196 | struct syscore_ops s3c244x_pm_syscore_ops = { | ||
197 | .suspend = s3c244x_suspend, | ||
198 | .resume = s3c244x_resume, | ||
199 | }; | ||
200 | |||
201 | void s3c244x_restart(char mode, const char *cmd) | ||
202 | { | ||
203 | if (mode == 's') | ||
204 | soft_restart(0); | ||
205 | |||
206 | arch_wdt_reset(); | ||
207 | |||
208 | /* we'll take a jump through zero as a poor second */ | ||
209 | soft_restart(0); | ||
210 | } | ||
diff --git a/arch/arm/mach-s3c24xx/setup-i2c.c b/arch/arm/mach-s3c24xx/setup-i2c.c new file mode 100644 index 000000000000..9e90a7cbd1d6 --- /dev/null +++ b/arch/arm/mach-s3c24xx/setup-i2c.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/setup-i2c.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX Base setup for i2c device | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/gpio.h> | ||
15 | |||
16 | struct platform_device; | ||
17 | |||
18 | #include <plat/gpio-cfg.h> | ||
19 | #include <plat/iic.h> | ||
20 | #include <mach/hardware.h> | ||
21 | #include <mach/regs-gpio.h> | ||
22 | |||
23 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) | ||
24 | { | ||
25 | s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA); | ||
26 | s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL); | ||
27 | } | ||
diff --git a/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c new file mode 100644 index 000000000000..f65cb3ef16ce --- /dev/null +++ b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* linux/arch/arm/plat-s3c2416/setup-sdhci-gpio.c | ||
2 | * | ||
3 | * Copyright 2010 Promwad Innovation Company | ||
4 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
5 | * | ||
6 | * S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC) | ||
7 | * | ||
8 | * Based on mach-s3c64xx/setup-sdhci-gpio.c | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/gpio.h> | ||
21 | |||
22 | #include <mach/regs-gpio.h> | ||
23 | #include <plat/gpio-cfg.h> | ||
24 | |||
25 | void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | ||
26 | { | ||
27 | s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2)); | ||
28 | } | ||
29 | |||
30 | void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | ||
31 | { | ||
32 | s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2)); | ||
33 | s3c_gpio_cfgrange_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2)); | ||
34 | } | ||
diff --git a/arch/arm/mach-s3c24xx/setup-ts.c b/arch/arm/mach-s3c24xx/setup-ts.c new file mode 100644 index 000000000000..ed2638663675 --- /dev/null +++ b/arch/arm/mach-s3c24xx/setup-ts.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/setup-ts.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Based on S3C24XX setup for i2c device | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/gpio.h> | ||
15 | |||
16 | struct platform_device; /* don't need the contents */ | ||
17 | |||
18 | #include <mach/hardware.h> | ||
19 | #include <mach/regs-gpio.h> | ||
20 | |||
21 | /** | ||
22 | * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems | ||
23 | * | ||
24 | * Configure the GPIO for the S3C2410 system, where we have external FETs | ||
25 | * connected to the device (later systems such as the S3C2440 integrate | ||
26 | * these into the device). | ||
27 | */ | ||
28 | void s3c24xx_ts_cfg_gpio(struct platform_device *dev) | ||
29 | { | ||
30 | s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON); | ||
31 | s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPG13_nXPON); | ||
32 | s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON); | ||
33 | s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON); | ||
34 | } | ||
diff --git a/arch/arm/mach-s3c24xx/simtec-audio.c b/arch/arm/mach-s3c24xx/simtec-audio.c new file mode 100644 index 000000000000..11881c9a38c0 --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec-audio.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/simtec-audio.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Audio setup for various Simtec S3C24XX implementations | ||
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 | #include <linux/kernel.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <mach/bast-map.h> | ||
21 | #include <mach/bast-irq.h> | ||
22 | #include <mach/bast-cpld.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/regs-gpio.h> | ||
26 | |||
27 | #include <plat/audio-simtec.h> | ||
28 | #include <plat/devs.h> | ||
29 | |||
30 | #include "simtec.h" | ||
31 | |||
32 | /* platform ops for audio */ | ||
33 | |||
34 | static void simtec_audio_startup_lrroute(void) | ||
35 | { | ||
36 | unsigned int tmp; | ||
37 | unsigned long flags; | ||
38 | |||
39 | local_irq_save(flags); | ||
40 | |||
41 | tmp = __raw_readb(BAST_VA_CTRL1); | ||
42 | tmp &= ~BAST_CPLD_CTRL1_LRMASK; | ||
43 | tmp |= BAST_CPLD_CTRL1_LRCDAC; | ||
44 | __raw_writeb(tmp, BAST_VA_CTRL1); | ||
45 | |||
46 | local_irq_restore(flags); | ||
47 | } | ||
48 | |||
49 | static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata; | ||
50 | static char our_name[32]; | ||
51 | |||
52 | static struct platform_device simtec_audio_dev = { | ||
53 | .name = our_name, | ||
54 | .id = -1, | ||
55 | .dev = { | ||
56 | .parent = &s3c_device_iis.dev, | ||
57 | .platform_data = &simtec_audio_platdata, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | int __init simtec_audio_add(const char *name, bool has_lr_routing, | ||
62 | struct s3c24xx_audio_simtec_pdata *spd) | ||
63 | { | ||
64 | if (!name) | ||
65 | name = "tlv320aic23"; | ||
66 | |||
67 | snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name); | ||
68 | |||
69 | /* copy platform data so the source can be __initdata */ | ||
70 | if (spd) | ||
71 | simtec_audio_platdata = *spd; | ||
72 | |||
73 | if (has_lr_routing) | ||
74 | simtec_audio_platdata.startup = simtec_audio_startup_lrroute; | ||
75 | |||
76 | platform_device_register(&s3c_device_iis); | ||
77 | platform_device_register(&simtec_audio_dev); | ||
78 | return 0; | ||
79 | } | ||
diff --git a/arch/arm/mach-s3c24xx/simtec-nor.c b/arch/arm/mach-s3c24xx/simtec-nor.c new file mode 100644 index 000000000000..2119ca6a73bc --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec-nor.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/nor-simtec.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Simtec NOR mapping | ||
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 | #include <linux/module.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | #include <linux/mtd/mtd.h> | ||
21 | #include <linux/mtd/map.h> | ||
22 | #include <linux/mtd/physmap.h> | ||
23 | #include <linux/mtd/partitions.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/map.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | |||
29 | #include <mach/map.h> | ||
30 | #include <mach/bast-map.h> | ||
31 | #include <mach/bast-cpld.h> | ||
32 | |||
33 | #include "simtec.h" | ||
34 | |||
35 | static void simtec_nor_vpp(struct platform_device *pdev, int vpp) | ||
36 | { | ||
37 | unsigned int val; | ||
38 | unsigned long flags; | ||
39 | |||
40 | local_irq_save(flags); | ||
41 | val = __raw_readb(BAST_VA_CTRL3); | ||
42 | |||
43 | printk(KERN_DEBUG "%s(%d)\n", __func__, vpp); | ||
44 | |||
45 | if (vpp) | ||
46 | val |= BAST_CPLD_CTRL3_ROMWEN; | ||
47 | else | ||
48 | val &= ~BAST_CPLD_CTRL3_ROMWEN; | ||
49 | |||
50 | __raw_writeb(val, BAST_VA_CTRL3); | ||
51 | local_irq_restore(flags); | ||
52 | } | ||
53 | |||
54 | static struct physmap_flash_data simtec_nor_pdata = { | ||
55 | .width = 2, | ||
56 | .set_vpp = simtec_nor_vpp, | ||
57 | .nr_parts = 0, | ||
58 | }; | ||
59 | |||
60 | static struct resource simtec_nor_resource[] = { | ||
61 | [0] = { | ||
62 | .start = S3C2410_CS1 + 0x4000000, | ||
63 | .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1, | ||
64 | .flags = IORESOURCE_MEM, | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static struct platform_device simtec_device_nor = { | ||
69 | .name = "physmap-flash", | ||
70 | .id = -1, | ||
71 | .num_resources = ARRAY_SIZE(simtec_nor_resource), | ||
72 | .resource = simtec_nor_resource, | ||
73 | .dev = { | ||
74 | .platform_data = &simtec_nor_pdata, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | void __init nor_simtec_init(void) | ||
79 | { | ||
80 | int ret; | ||
81 | |||
82 | ret = platform_device_register(&simtec_device_nor); | ||
83 | if (ret < 0) | ||
84 | printk(KERN_ERR "failed to register physmap-flash device\n"); | ||
85 | else | ||
86 | simtec_nor_vpp(NULL, 1); | ||
87 | } | ||
diff --git a/arch/arm/mach-s3c24xx/simtec-pm.c b/arch/arm/mach-s3c24xx/simtec-pm.c new file mode 100644 index 000000000000..699f93171297 --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec-pm.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/pm-simtec.c | ||
2 | * | ||
3 | * Copyright 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Power Management helpers for Simtec S3C24XX implementations | ||
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 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach/map.h> | ||
26 | |||
27 | #include <mach/hardware.h> | ||
28 | |||
29 | #include <mach/map.h> | ||
30 | #include <mach/regs-gpio.h> | ||
31 | #include <mach/regs-mem.h> | ||
32 | |||
33 | #include <asm/mach-types.h> | ||
34 | |||
35 | #include <plat/pm.h> | ||
36 | |||
37 | #define COPYRIGHT ", Copyright 2005 Simtec Electronics" | ||
38 | |||
39 | /* pm_simtec_init | ||
40 | * | ||
41 | * enable the power management functions | ||
42 | */ | ||
43 | |||
44 | static __init int pm_simtec_init(void) | ||
45 | { | ||
46 | unsigned long gstatus4; | ||
47 | |||
48 | /* check which machine we are running on */ | ||
49 | |||
50 | if (!machine_is_bast() && !machine_is_vr1000() && | ||
51 | !machine_is_anubis() && !machine_is_osiris() && | ||
52 | !machine_is_aml_m5900()) | ||
53 | return 0; | ||
54 | |||
55 | printk(KERN_INFO "Simtec Board Power Management" COPYRIGHT "\n"); | ||
56 | |||
57 | gstatus4 = (__raw_readl(S3C2410_BANKCON7) & 0x3) << 30; | ||
58 | gstatus4 |= (__raw_readl(S3C2410_BANKCON6) & 0x3) << 28; | ||
59 | gstatus4 |= (__raw_readl(S3C2410_BANKSIZE) & S3C2410_BANKSIZE_MASK); | ||
60 | |||
61 | __raw_writel(gstatus4, S3C2410_GSTATUS4); | ||
62 | |||
63 | return s3c_pm_init(); | ||
64 | } | ||
65 | |||
66 | arch_initcall(pm_simtec_init); | ||
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c new file mode 100644 index 000000000000..d91c1a725139 --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec-usb.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/usb-simtec.c | ||
2 | * | ||
3 | * Copyright 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://www.simtec.co.uk/products/EB2410ITX/ | ||
7 | * | ||
8 | * Simtec BAST and Thorcom VR1000 USB port support functions | ||
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 | #define DEBUG | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/list.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/timer.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/device.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/bast-map.h> | ||
32 | #include <mach/bast-irq.h> | ||
33 | |||
34 | #include <mach/hardware.h> | ||
35 | #include <asm/irq.h> | ||
36 | |||
37 | #include <plat/usb-control.h> | ||
38 | #include <plat/devs.h> | ||
39 | |||
40 | #include "simtec.h" | ||
41 | |||
42 | /* control power and monitor over-current events on various Simtec | ||
43 | * designed boards. | ||
44 | */ | ||
45 | |||
46 | static unsigned int power_state[2]; | ||
47 | |||
48 | static void | ||
49 | usb_simtec_powercontrol(int port, int to) | ||
50 | { | ||
51 | pr_debug("usb_simtec_powercontrol(%d,%d)\n", port, to); | ||
52 | |||
53 | power_state[port] = to; | ||
54 | |||
55 | if (power_state[0] && power_state[1]) | ||
56 | gpio_set_value(S3C2410_GPB(4), 0); | ||
57 | else | ||
58 | gpio_set_value(S3C2410_GPB(4), 1); | ||
59 | } | ||
60 | |||
61 | static irqreturn_t | ||
62 | usb_simtec_ocirq(int irq, void *pw) | ||
63 | { | ||
64 | struct s3c2410_hcd_info *info = pw; | ||
65 | |||
66 | if (gpio_get_value(S3C2410_GPG(10)) == 0) { | ||
67 | pr_debug("usb_simtec: over-current irq (oc detected)\n"); | ||
68 | s3c2410_usb_report_oc(info, 3); | ||
69 | } else { | ||
70 | pr_debug("usb_simtec: over-current irq (oc cleared)\n"); | ||
71 | s3c2410_usb_report_oc(info, 0); | ||
72 | } | ||
73 | |||
74 | return IRQ_HANDLED; | ||
75 | } | ||
76 | |||
77 | static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on) | ||
78 | { | ||
79 | int ret; | ||
80 | |||
81 | if (on) { | ||
82 | ret = request_irq(IRQ_USBOC, usb_simtec_ocirq, | ||
83 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
84 | IRQF_TRIGGER_FALLING, | ||
85 | "USB Over-current", info); | ||
86 | if (ret != 0) { | ||
87 | printk(KERN_ERR "failed to request usb oc irq\n"); | ||
88 | } | ||
89 | } else { | ||
90 | free_irq(IRQ_USBOC, info); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | static struct s3c2410_hcd_info usb_simtec_info __initdata = { | ||
95 | .port[0] = { | ||
96 | .flags = S3C_HCDFLG_USED | ||
97 | }, | ||
98 | .port[1] = { | ||
99 | .flags = S3C_HCDFLG_USED | ||
100 | }, | ||
101 | |||
102 | .power_control = usb_simtec_powercontrol, | ||
103 | .enable_oc = usb_simtec_enableoc, | ||
104 | }; | ||
105 | |||
106 | |||
107 | int usb_simtec_init(void) | ||
108 | { | ||
109 | int ret; | ||
110 | |||
111 | printk("USB Power Control, Copyright 2004 Simtec Electronics\n"); | ||
112 | |||
113 | ret = gpio_request(S3C2410_GPB(4), "USB power control"); | ||
114 | if (ret < 0) { | ||
115 | pr_err("%s: failed to get GPB4\n", __func__); | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | ret = gpio_request(S3C2410_GPG(10), "USB overcurrent"); | ||
120 | if (ret < 0) { | ||
121 | pr_err("%s: failed to get GPG10\n", __func__); | ||
122 | gpio_free(S3C2410_GPB(4)); | ||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | /* turn power on */ | ||
127 | gpio_direction_output(S3C2410_GPB(4), 1); | ||
128 | gpio_direction_input(S3C2410_GPG(10)); | ||
129 | |||
130 | s3c_ohci_set_platdata(&usb_simtec_info); | ||
131 | return 0; | ||
132 | } | ||
diff --git a/arch/arm/mach-s3c24xx/simtec.h b/arch/arm/mach-s3c24xx/simtec.h new file mode 100644 index 000000000000..ae8f4f9ad2ee --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/nor-simtec.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Simtec common functions | ||
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 | struct s3c24xx_audio_simtec_pdata; | ||
15 | |||
16 | extern void nor_simtec_init(void); | ||
17 | |||
18 | extern int usb_simtec_init(void); | ||
19 | |||
20 | extern int simtec_audio_add(const char *codec_name, bool has_lr_routing, | ||
21 | struct s3c24xx_audio_simtec_pdata *pdata); | ||
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S new file mode 100644 index 000000000000..dd5b6388a5a5 --- /dev/null +++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S | |||
@@ -0,0 +1,68 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/sleep.S | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 Power Manager (Suspend-To-RAM) support | ||
7 | * | ||
8 | * Based on PXA/SA1100 sleep code by: | ||
9 | * Nicolas Pitre, (c) 2002 Monta Vista Software Inc | ||
10 | * Cliff Brake, (c) 2001 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | */ | ||
26 | |||
27 | #include <linux/linkage.h> | ||
28 | #include <asm/assembler.h> | ||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/map.h> | ||
31 | |||
32 | #include <mach/regs-gpio.h> | ||
33 | #include <mach/regs-clock.h> | ||
34 | #include <mach/regs-mem.h> | ||
35 | #include <plat/regs-serial.h> | ||
36 | |||
37 | /* s3c2410_cpu_suspend | ||
38 | * | ||
39 | * put the cpu into sleep mode | ||
40 | */ | ||
41 | |||
42 | ENTRY(s3c2410_cpu_suspend) | ||
43 | @@ prepare cpu to sleep | ||
44 | |||
45 | ldr r4, =S3C2410_REFRESH | ||
46 | ldr r5, =S3C24XX_MISCCR | ||
47 | ldr r6, =S3C2410_CLKCON | ||
48 | ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB) | ||
49 | ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB) | ||
50 | ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB) | ||
51 | |||
52 | orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command | ||
53 | orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals | ||
54 | orr r9, r9, #S3C2410_CLKCON_POWER @ power down command | ||
55 | |||
56 | teq pc, #0 @ first as a trial-run to load cache | ||
57 | bl s3c2410_do_sleep | ||
58 | teq r0, r0 @ now do it for real | ||
59 | b s3c2410_do_sleep @ | ||
60 | |||
61 | @@ align next bit of code to cache line | ||
62 | .align 5 | ||
63 | s3c2410_do_sleep: | ||
64 | streq r7, [ r4 ] @ SDRAM sleep command | ||
65 | streq r8, [ r5 ] @ SDRAM power-down config | ||
66 | streq r9, [ r6 ] @ CPU sleep | ||
67 | 1: beq 1b | ||
68 | mov pc, r14 | ||
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S new file mode 100644 index 000000000000..c82418ed714d --- /dev/null +++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S | |||
@@ -0,0 +1,68 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/sleep.S | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2412 Power Manager low-level sleep 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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/linkage.h> | ||
24 | #include <asm/assembler.h> | ||
25 | #include <mach/hardware.h> | ||
26 | #include <mach/map.h> | ||
27 | |||
28 | #include <mach/regs-irq.h> | ||
29 | |||
30 | .text | ||
31 | |||
32 | .global s3c2412_sleep_enter | ||
33 | |||
34 | s3c2412_sleep_enter: | ||
35 | mov r0, #0 /* argument for coprocessors */ | ||
36 | ldr r1, =S3C2410_INTPND | ||
37 | ldr r2, =S3C2410_SRCPND | ||
38 | ldr r3, =S3C2410_EINTPEND | ||
39 | |||
40 | teq r0, r0 | ||
41 | bl s3c2412_sleep_enter1 | ||
42 | teq pc, r0 | ||
43 | bl s3c2412_sleep_enter1 | ||
44 | |||
45 | .align 5 | ||
46 | |||
47 | /* this is called twice, first with the Z flag to ensure that the | ||
48 | * instructions have been loaded into the cache, and the second | ||
49 | * time to try and suspend the system. | ||
50 | */ | ||
51 | s3c2412_sleep_enter1: | ||
52 | mcr p15, 0, r0, c7, c10, 4 | ||
53 | mcrne p15, 0, r0, c7, c0, 4 | ||
54 | |||
55 | /* if we return from here, it is because an interrupt was | ||
56 | * active when we tried to shutdown. Try and ack the IRQ and | ||
57 | * retry, as simply returning causes the system to lock. | ||
58 | */ | ||
59 | |||
60 | ldrne r9, [ r1 ] | ||
61 | strne r9, [ r1 ] | ||
62 | ldrne r9, [ r2 ] | ||
63 | strne r9, [ r2 ] | ||
64 | ldrne r9, [ r3 ] | ||
65 | strne r9, [ r3 ] | ||
66 | bne s3c2412_sleep_enter1 | ||
67 | |||
68 | mov pc, r14 | ||