diff options
Diffstat (limited to 'arch/arm/mach-s3c24xx')
103 files changed, 6596 insertions, 1990 deletions
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 7079a70b1ab8..37f513d1588e 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -9,6 +9,15 @@ | |||
9 | 9 | ||
10 | if ARCH_S3C24XX | 10 | if ARCH_S3C24XX |
11 | 11 | ||
12 | config PLAT_S3C24XX | ||
13 | def_bool y | ||
14 | select ARCH_REQUIRE_GPIOLIB | ||
15 | select NO_IOPORT | ||
16 | select S3C_DEV_NAND | ||
17 | select IRQ_DOMAIN | ||
18 | help | ||
19 | Base platform code for any Samsung S3C24XX device | ||
20 | |||
12 | menu "SAMSUNG S3C24XX SoCs Support" | 21 | menu "SAMSUNG S3C24XX SoCs Support" |
13 | 22 | ||
14 | comment "S3C24XX SoCs" | 23 | comment "S3C24XX SoCs" |
@@ -83,6 +92,17 @@ config CPU_S3C2443 | |||
83 | 92 | ||
84 | # common code | 93 | # common code |
85 | 94 | ||
95 | config S3C2410_CLOCK | ||
96 | bool | ||
97 | help | ||
98 | Clock code for the S3C2410, and similar processors which | ||
99 | is currently includes the S3C2410, S3C2440, S3C2442. | ||
100 | |||
101 | config S3C24XX_DCLK | ||
102 | bool | ||
103 | help | ||
104 | Clock code for supporting DCLK/CLKOUT on S3C24XX architectures | ||
105 | |||
86 | config S3C24XX_SMDK | 106 | config S3C24XX_SMDK |
87 | bool | 107 | bool |
88 | help | 108 | help |
@@ -111,6 +131,22 @@ config S3C24XX_SETUP_TS | |||
111 | help | 131 | help |
112 | Compile in platform device definition for Samsung TouchScreen. | 132 | Compile in platform device definition for Samsung TouchScreen. |
113 | 133 | ||
134 | config S3C24XX_DMA | ||
135 | bool "S3C2410 DMA support" | ||
136 | depends on ARCH_S3C24XX | ||
137 | select S3C_DMA | ||
138 | help | ||
139 | S3C2410 DMA support. This is needed for drivers like sound which | ||
140 | use the S3C2410's DMA system to move data to and from the | ||
141 | peripheral blocks. | ||
142 | |||
143 | config S3C2410_DMA_DEBUG | ||
144 | bool "S3C2410 DMA support debug" | ||
145 | depends on ARCH_S3C24XX && S3C2410_DMA | ||
146 | help | ||
147 | Enable debugging output for the DMA code. This option sends info | ||
148 | to the kernel log, at priority KERN_DEBUG. | ||
149 | |||
114 | config S3C2410_DMA | 150 | config S3C2410_DMA |
115 | bool | 151 | bool |
116 | depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) | 152 | depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) |
@@ -123,10 +159,92 @@ config S3C2410_PM | |||
123 | help | 159 | help |
124 | Power Management code common to S3C2410 and better | 160 | Power Management code common to S3C2410 and better |
125 | 161 | ||
162 | # low-level serial option nodes | ||
163 | |||
164 | config CPU_LLSERIAL_S3C2410_ONLY | ||
165 | bool | ||
166 | default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440 | ||
167 | |||
168 | config CPU_LLSERIAL_S3C2440_ONLY | ||
169 | bool | ||
170 | default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410 | ||
171 | |||
172 | config CPU_LLSERIAL_S3C2410 | ||
173 | bool | ||
174 | help | ||
175 | Selected if there is an S3C2410 (or register compatible) serial | ||
176 | low-level implementation needed | ||
177 | |||
178 | config CPU_LLSERIAL_S3C2440 | ||
179 | bool | ||
180 | help | ||
181 | Selected if there is an S3C2440 (or register compatible) serial | ||
182 | low-level implementation needed | ||
183 | |||
184 | # gpio configurations | ||
185 | |||
186 | config S3C24XX_GPIO_EXTRA | ||
187 | int | ||
188 | default 128 if S3C24XX_GPIO_EXTRA128 | ||
189 | default 64 if S3C24XX_GPIO_EXTRA64 | ||
190 | default 16 if ARCH_H1940 | ||
191 | default 0 | ||
192 | |||
193 | config S3C24XX_GPIO_EXTRA64 | ||
194 | bool | ||
195 | help | ||
196 | Add an extra 64 gpio numbers to the available GPIO pool. This is | ||
197 | available for boards that need extra gpios for external devices. | ||
198 | |||
199 | config S3C24XX_GPIO_EXTRA128 | ||
200 | bool | ||
201 | help | ||
202 | Add an extra 128 gpio numbers to the available GPIO pool. This is | ||
203 | available for boards that need extra gpios for external devices. | ||
204 | |||
205 | # cpu frequency items common between s3c2410 and s3c2440/s3c2442 | ||
206 | |||
207 | config S3C2410_IOTIMING | ||
208 | bool | ||
209 | depends on CPU_FREQ_S3C24XX | ||
210 | help | ||
211 | Internal node to select io timing code that is common to the s3c2410 | ||
212 | and s3c2440/s3c2442 cpu frequency support. | ||
213 | |||
214 | config S3C2410_CPUFREQ_UTILS | ||
215 | bool | ||
216 | depends on CPU_FREQ_S3C24XX | ||
217 | help | ||
218 | Internal node to select timing code that is common to the s3c2410 | ||
219 | and s3c2440/s3c244 cpu frequency support. | ||
220 | |||
221 | # cpu frequency support common to s3c2412, s3c2413 and s3c2442 | ||
222 | |||
223 | config S3C2412_IOTIMING | ||
224 | bool | ||
225 | depends on CPU_FREQ_S3C24XX && (CPU_S3C2412 || CPU_S3C2443) | ||
226 | help | ||
227 | Intel node to select io timing code that is common to the s3c2412 | ||
228 | and the s3c2443. | ||
229 | |||
126 | # cpu-specific sections | 230 | # cpu-specific sections |
127 | 231 | ||
128 | if CPU_S3C2410 | 232 | if CPU_S3C2410 |
129 | 233 | ||
234 | config S3C2410_CPUFREQ | ||
235 | bool | ||
236 | depends on CPU_FREQ_S3C24XX && CPU_S3C2410 | ||
237 | select S3C2410_CPUFREQ_UTILS | ||
238 | help | ||
239 | CPU Frequency scaling support for S3C2410 | ||
240 | |||
241 | config S3C2410_PLL | ||
242 | bool | ||
243 | depends on S3C2410_CPUFREQ && CPU_FREQ_S3C24XX_PLL | ||
244 | default y | ||
245 | help | ||
246 | Select the PLL table for the S3C2410 | ||
247 | |||
130 | config S3C24XX_SIMTEC_NOR | 248 | config S3C24XX_SIMTEC_NOR |
131 | bool | 249 | bool |
132 | help | 250 | help |
@@ -267,6 +385,14 @@ config CPU_S3C2412_ONLY | |||
267 | !CPU_S3C2443 && CPU_S3C2412 | 385 | !CPU_S3C2443 && CPU_S3C2412 |
268 | default y | 386 | default y |
269 | 387 | ||
388 | config S3C2412_CPUFREQ | ||
389 | bool | ||
390 | depends on CPU_FREQ_S3C24XX && CPU_S3C2412 | ||
391 | default y | ||
392 | select S3C2412_IOTIMING | ||
393 | help | ||
394 | CPU Frequency scaling support for S3C2412 and S3C2413 SoC CPUs. | ||
395 | |||
270 | config S3C2412_DMA | 396 | config S3C2412_DMA |
271 | bool | 397 | bool |
272 | help | 398 | help |
@@ -367,11 +493,45 @@ endif # CPU_S3C2416 | |||
367 | 493 | ||
368 | if CPU_S3C2440 | 494 | if CPU_S3C2440 |
369 | 495 | ||
496 | config S3C2440_CPUFREQ | ||
497 | bool "S3C2440/S3C2442 CPU Frequency scaling support" | ||
498 | depends on CPU_FREQ_S3C24XX && (CPU_S3C2440 || CPU_S3C2442) | ||
499 | default y | ||
500 | select S3C2410_CPUFREQ_UTILS | ||
501 | help | ||
502 | CPU Frequency scaling support for S3C2440 and S3C2442 SoC CPUs. | ||
503 | |||
370 | config S3C2440_DMA | 504 | config S3C2440_DMA |
371 | bool | 505 | bool |
372 | help | 506 | help |
373 | Support for S3C2440 specific DMA code5A | 507 | Support for S3C2440 specific DMA code5A |
374 | 508 | ||
509 | config S3C2440_XTAL_12000000 | ||
510 | bool | ||
511 | help | ||
512 | Indicate that the build needs to support 12MHz system | ||
513 | crystal. | ||
514 | |||
515 | config S3C2440_XTAL_16934400 | ||
516 | bool | ||
517 | help | ||
518 | Indicate that the build needs to support 16.9344MHz system | ||
519 | crystal. | ||
520 | |||
521 | config S3C2440_PLL_12000000 | ||
522 | bool | ||
523 | depends on S3C2440_CPUFREQ && S3C2440_XTAL_12000000 | ||
524 | default y if CPU_FREQ_S3C24XX_PLL | ||
525 | help | ||
526 | PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals. | ||
527 | |||
528 | config S3C2440_PLL_16934400 | ||
529 | bool | ||
530 | depends on S3C2440_CPUFREQ && S3C2440_XTAL_16934400 | ||
531 | default y if CPU_FREQ_S3C24XX_PLL | ||
532 | help | ||
533 | PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals. | ||
534 | |||
375 | comment "S3C2440 Boards" | 535 | comment "S3C2440 Boards" |
376 | 536 | ||
377 | # | 537 | # |
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile index 0ab6ab15da4c..af53d27d5c36 100644 --- a/arch/arm/mach-s3c24xx/Makefile +++ b/arch/arm/mach-s3c24xx/Makefile | |||
@@ -14,26 +14,32 @@ obj- := | |||
14 | 14 | ||
15 | # core | 15 | # core |
16 | 16 | ||
17 | obj-y += common.o | 17 | obj-y += common.o irq.o |
18 | 18 | ||
19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o | 19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o |
20 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o | ||
20 | obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o | 21 | obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o |
22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o | ||
21 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o | 23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o |
22 | 24 | ||
23 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o | 25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o |
26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o | ||
24 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o | 27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o |
25 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o | 28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o |
26 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o | 29 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o |
27 | 30 | ||
28 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o irq-s3c2416.o clock-s3c2416.o | 31 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o |
29 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o | 32 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o |
30 | 33 | ||
31 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o | 34 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o |
32 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o | 35 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o |
33 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o | 36 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o |
37 | obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o | ||
34 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o | 38 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o |
39 | obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o | ||
40 | obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o | ||
35 | 41 | ||
36 | obj-$(CONFIG_CPU_S3C2443) += s3c2443.o irq-s3c2443.o clock-s3c2443.o | 42 | obj-$(CONFIG_CPU_S3C2443) += s3c2443.o clock-s3c2443.o |
37 | 43 | ||
38 | # PM | 44 | # PM |
39 | 45 | ||
@@ -41,9 +47,21 @@ obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o | |||
41 | 47 | ||
42 | # common code | 48 | # common code |
43 | 49 | ||
50 | obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o | ||
51 | obj-$(CONFIG_S3C24XX_DMA) += dma.o | ||
52 | |||
53 | obj-$(CONFIG_S3C2410_CLOCK) += clock-s3c2410.o | ||
54 | obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o | ||
55 | |||
56 | obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o | ||
57 | obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o | ||
58 | |||
44 | obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o | 59 | obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o |
45 | obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o | 60 | obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o |
46 | 61 | ||
62 | obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpufreq.o | ||
63 | obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpufreq-debugfs.o | ||
64 | |||
47 | # | 65 | # |
48 | # machine support | 66 | # machine support |
49 | # following is ordered alphabetically by option text. | 67 | # following is ordered alphabetically by option text. |
diff --git a/arch/arm/mach-s3c24xx/anubis.h b/arch/arm/mach-s3c24xx/anubis.h new file mode 100644 index 000000000000..2691665f27d9 --- /dev/null +++ b/arch/arm/mach-s3c24xx/anubis.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Simtec Electronics | ||
3 | * http://www.simtec.co.uk/products/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * ANUBIS - CPLD control constants | ||
7 | * ANUBIS - IRQ Number definitions | ||
8 | * ANUBIS - Memory map definitions | ||
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 __MACH_S3C24XX_ANUBIS_H | ||
16 | #define __MACH_S3C24XX_ANUBIS_H __FILE__ | ||
17 | |||
18 | /* CTRL2 - NAND WP control, IDE Reset assert/check */ | ||
19 | |||
20 | #define ANUBIS_CTRL1_NANDSEL (0x3) | ||
21 | |||
22 | /* IDREG - revision */ | ||
23 | |||
24 | #define ANUBIS_IDREG_REVMASK (0x7) | ||
25 | |||
26 | /* irq */ | ||
27 | |||
28 | #define ANUBIS_IRQ_IDE0 IRQ_EINT2 | ||
29 | #define ANUBIS_IRQ_IDE1 IRQ_EINT3 | ||
30 | #define ANUBIS_IRQ_ASIX IRQ_EINT1 | ||
31 | |||
32 | /* map */ | ||
33 | |||
34 | /* start peripherals off after the S3C2410 */ | ||
35 | |||
36 | #define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x01800000)) | ||
37 | |||
38 | #define ANUBIS_PA_CPLD (S3C2410_CS1 | (1<<26)) | ||
39 | |||
40 | /* we put the CPLD registers next, to get them out of the way */ | ||
41 | |||
42 | #define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) | ||
43 | #define ANUBIS_PA_CTRL1 ANUBIS_PA_CPLD | ||
44 | |||
45 | #define ANUBIS_VA_IDREG ANUBIS_IOADDR(0x00300000) | ||
46 | #define ANUBIS_PA_IDREG (ANUBIS_PA_CPLD + (3 << 23)) | ||
47 | |||
48 | #define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000) | ||
49 | #define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000) | ||
50 | #define ANUBIS_IDESEC ANUBIS_IOADDR(0x01200000) | ||
51 | #define ANUBIS_IDESECAUX ANUBIS_IOADDR(0x01300000) | ||
52 | |||
53 | #endif /* __MACH_S3C24XX_ANUBIS_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/bast-ide.c b/arch/arm/mach-s3c24xx/bast-ide.c index ba02cf8d80a2..3f0288f2f542 100644 --- a/arch/arm/mach-s3c24xx/bast-ide.c +++ b/arch/arm/mach-s3c24xx/bast-ide.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <asm/mach/irq.h> | 25 | #include <asm/mach/irq.h> |
26 | 26 | ||
27 | #include <mach/map.h> | 27 | #include <mach/map.h> |
28 | #include <mach/bast-map.h> | 28 | |
29 | #include <mach/bast-irq.h> | 29 | #include "bast.h" |
30 | 30 | ||
31 | /* IDE ports */ | 31 | /* IDE ports */ |
32 | 32 | ||
@@ -34,12 +34,10 @@ static struct pata_platform_info bast_ide_platdata = { | |||
34 | .ioport_shift = 5, | 34 | .ioport_shift = 5, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define IDE_CS S3C2410_CS5 | ||
38 | |||
39 | static struct resource bast_ide0_resource[] = { | 37 | static struct resource bast_ide0_resource[] = { |
40 | [0] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDEPRI, 8 * 0x20), | 38 | [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20), |
41 | [1] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20), | 39 | [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20), |
42 | [2] = DEFINE_RES_IRQ(IRQ_IDE0), | 40 | [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0), |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static struct platform_device bast_device_ide0 = { | 43 | static struct platform_device bast_device_ide0 = { |
@@ -55,9 +53,9 @@ static struct platform_device bast_device_ide0 = { | |||
55 | }; | 53 | }; |
56 | 54 | ||
57 | static struct resource bast_ide1_resource[] = { | 55 | static struct resource bast_ide1_resource[] = { |
58 | [0] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDESEC, 8 * 0x20), | 56 | [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20), |
59 | [1] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20), | 57 | [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20), |
60 | [2] = DEFINE_RES_IRQ(IRQ_IDE1), | 58 | [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1), |
61 | }; | 59 | }; |
62 | 60 | ||
63 | static struct platform_device bast_device_ide1 = { | 61 | static struct platform_device bast_device_ide1 = { |
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c index ac7b2ad5c405..c0daa9590b4c 100644 --- a/arch/arm/mach-s3c24xx/bast-irq.c +++ b/arch/arm/mach-s3c24xx/bast-irq.c | |||
@@ -27,27 +27,20 @@ | |||
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | #include <asm/mach-types.h> | ||
31 | |||
32 | #include <mach/hardware.h> | ||
33 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
34 | 31 | #include <asm/mach-types.h> | |
35 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
36 | 33 | ||
34 | #include <mach/hardware.h> | ||
37 | #include <mach/regs-irq.h> | 35 | #include <mach/regs-irq.h> |
38 | #include <mach/bast-map.h> | ||
39 | #include <mach/bast-irq.h> | ||
40 | 36 | ||
41 | #include <plat/irq.h> | 37 | #include <plat/irq.h> |
42 | 38 | ||
43 | #if 0 | 39 | #include "bast.h" |
44 | #include <asm/debug-ll.h> | ||
45 | #endif | ||
46 | 40 | ||
47 | #define irqdbf(x...) | 41 | #define irqdbf(x...) |
48 | #define irqdbf2(x...) | 42 | #define irqdbf2(x...) |
49 | 43 | ||
50 | |||
51 | /* handle PC104 ISA interrupts from the system CPLD */ | 44 | /* handle PC104 ISA interrupts from the system CPLD */ |
52 | 45 | ||
53 | /* table of ISA irq nos to the relevant mask... zero means | 46 | /* table of ISA irq nos to the relevant mask... zero means |
@@ -87,7 +80,7 @@ bast_pc104_mask(struct irq_data *data) | |||
87 | static void | 80 | static void |
88 | bast_pc104_maskack(struct irq_data *data) | 81 | bast_pc104_maskack(struct irq_data *data) |
89 | { | 82 | { |
90 | struct irq_desc *desc = irq_desc + IRQ_ISA; | 83 | struct irq_desc *desc = irq_desc + BAST_IRQ_ISA; |
91 | 84 | ||
92 | bast_pc104_mask(data); | 85 | bast_pc104_mask(data); |
93 | desc->irq_data.chip->irq_ack(&desc->irq_data); | 86 | desc->irq_data.chip->irq_ack(&desc->irq_data); |
@@ -122,7 +115,7 @@ bast_irq_pc104_demux(unsigned int irq, | |||
122 | if (unlikely(stat == 0)) { | 115 | if (unlikely(stat == 0)) { |
123 | /* ack if we get an irq with nothing (ie, startup) */ | 116 | /* ack if we get an irq with nothing (ie, startup) */ |
124 | 117 | ||
125 | desc = irq_desc + IRQ_ISA; | 118 | desc = irq_desc + BAST_IRQ_ISA; |
126 | desc->irq_data.chip->irq_ack(&desc->irq_data); | 119 | desc->irq_data.chip->irq_ack(&desc->irq_data); |
127 | } else { | 120 | } else { |
128 | /* handle the IRQ */ | 121 | /* handle the IRQ */ |
@@ -147,7 +140,7 @@ static __init int bast_irq_init(void) | |||
147 | 140 | ||
148 | __raw_writeb(0x0, BAST_VA_PC104_IRQMASK); | 141 | __raw_writeb(0x0, BAST_VA_PC104_IRQMASK); |
149 | 142 | ||
150 | irq_set_chained_handler(IRQ_ISA, bast_irq_pc104_demux); | 143 | irq_set_chained_handler(BAST_IRQ_ISA, bast_irq_pc104_demux); |
151 | 144 | ||
152 | /* register our IRQs */ | 145 | /* register our IRQs */ |
153 | 146 | ||
diff --git a/arch/arm/mach-s3c24xx/bast.h b/arch/arm/mach-s3c24xx/bast.h new file mode 100644 index 000000000000..5c7534bae92d --- /dev/null +++ b/arch/arm/mach-s3c24xx/bast.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2004 Simtec Electronics | ||
3 | * Ben Dooks <ben@simtec.co.uk> | ||
4 | * | ||
5 | * BAST - CPLD control constants | ||
6 | * BAST - IRQ Number definitions | ||
7 | * BAST - 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 | #ifndef __MACH_S3C24XX_BAST_H | ||
15 | #define __MACH_S3C24XX_BAST_H __FILE__ | ||
16 | |||
17 | /* CTRL1 - Audio LR routing */ | ||
18 | |||
19 | #define BAST_CPLD_CTRL1_LRCOFF (0x00) | ||
20 | #define BAST_CPLD_CTRL1_LRCADC (0x01) | ||
21 | #define BAST_CPLD_CTRL1_LRCDAC (0x02) | ||
22 | #define BAST_CPLD_CTRL1_LRCARM (0x03) | ||
23 | #define BAST_CPLD_CTRL1_LRMASK (0x03) | ||
24 | |||
25 | /* CTRL2 - NAND WP control, IDE Reset assert/check */ | ||
26 | |||
27 | #define BAST_CPLD_CTRL2_WNAND (0x04) | ||
28 | #define BAST_CPLD_CTLR2_IDERST (0x08) | ||
29 | |||
30 | /* CTRL3 - rom write control, CPLD identity */ | ||
31 | |||
32 | #define BAST_CPLD_CTRL3_IDMASK (0x0e) | ||
33 | #define BAST_CPLD_CTRL3_ROMWEN (0x01) | ||
34 | |||
35 | /* CTRL4 - 8bit LCD interface control/status */ | ||
36 | |||
37 | #define BAST_CPLD_CTRL4_LLAT (0x01) | ||
38 | #define BAST_CPLD_CTRL4_LCDRW (0x02) | ||
39 | #define BAST_CPLD_CTRL4_LCDCMD (0x04) | ||
40 | #define BAST_CPLD_CTRL4_LCDE2 (0x01) | ||
41 | |||
42 | /* CTRL5 - DMA routing */ | ||
43 | |||
44 | #define BAST_CPLD_DMA0_PRIIDE (0) | ||
45 | #define BAST_CPLD_DMA0_SECIDE (1) | ||
46 | #define BAST_CPLD_DMA0_ISA15 (2) | ||
47 | #define BAST_CPLD_DMA0_ISA36 (3) | ||
48 | |||
49 | #define BAST_CPLD_DMA1_PRIIDE (0 << 2) | ||
50 | #define BAST_CPLD_DMA1_SECIDE (1 << 2) | ||
51 | #define BAST_CPLD_DMA1_ISA15 (2 << 2) | ||
52 | #define BAST_CPLD_DMA1_ISA36 (3 << 2) | ||
53 | |||
54 | /* irq numbers to onboard peripherals */ | ||
55 | |||
56 | #define BAST_IRQ_USBOC IRQ_EINT18 | ||
57 | #define BAST_IRQ_IDE0 IRQ_EINT16 | ||
58 | #define BAST_IRQ_IDE1 IRQ_EINT17 | ||
59 | #define BAST_IRQ_PCSERIAL1 IRQ_EINT15 | ||
60 | #define BAST_IRQ_PCSERIAL2 IRQ_EINT14 | ||
61 | #define BAST_IRQ_PCPARALLEL IRQ_EINT13 | ||
62 | #define BAST_IRQ_ASIX IRQ_EINT11 | ||
63 | #define BAST_IRQ_DM9000 IRQ_EINT10 | ||
64 | #define BAST_IRQ_ISA IRQ_EINT9 | ||
65 | #define BAST_IRQ_SMALERT IRQ_EINT8 | ||
66 | |||
67 | /* map */ | ||
68 | |||
69 | /* | ||
70 | * ok, we've used up to 0x13000000, now we need to find space for the | ||
71 | * peripherals that live in the nGCS[x] areas, which are quite numerous | ||
72 | * in their space. We also have the board's CPLD to find register space | ||
73 | * for. | ||
74 | */ | ||
75 | |||
76 | #define BAST_IOADDR(x) (S3C2410_ADDR((x) + 0x01300000)) | ||
77 | |||
78 | /* we put the CPLD registers next, to get them out of the way */ | ||
79 | |||
80 | #define BAST_VA_CTRL1 BAST_IOADDR(0x00000000) | ||
81 | #define BAST_PA_CTRL1 (S3C2410_CS5 | 0x7800000) | ||
82 | |||
83 | #define BAST_VA_CTRL2 BAST_IOADDR(0x00100000) | ||
84 | #define BAST_PA_CTRL2 (S3C2410_CS1 | 0x6000000) | ||
85 | |||
86 | #define BAST_VA_CTRL3 BAST_IOADDR(0x00200000) | ||
87 | #define BAST_PA_CTRL3 (S3C2410_CS1 | 0x6800000) | ||
88 | |||
89 | #define BAST_VA_CTRL4 BAST_IOADDR(0x00300000) | ||
90 | #define BAST_PA_CTRL4 (S3C2410_CS1 | 0x7000000) | ||
91 | |||
92 | /* next, we have the PC104 ISA interrupt registers */ | ||
93 | |||
94 | #define BAST_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) | ||
95 | #define BAST_VA_PC104_IRQREQ BAST_IOADDR(0x00400000) | ||
96 | |||
97 | #define BAST_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) | ||
98 | #define BAST_VA_PC104_IRQRAW BAST_IOADDR(0x00500000) | ||
99 | |||
100 | #define BAST_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) | ||
101 | #define BAST_VA_PC104_IRQMASK BAST_IOADDR(0x00600000) | ||
102 | |||
103 | #define BAST_PA_LCD_RCMD1 (0x8800000) | ||
104 | #define BAST_VA_LCD_RCMD1 BAST_IOADDR(0x00700000) | ||
105 | |||
106 | #define BAST_PA_LCD_WCMD1 (0x8000000) | ||
107 | #define BAST_VA_LCD_WCMD1 BAST_IOADDR(0x00800000) | ||
108 | |||
109 | #define BAST_PA_LCD_RDATA1 (0x9800000) | ||
110 | #define BAST_VA_LCD_RDATA1 BAST_IOADDR(0x00900000) | ||
111 | |||
112 | #define BAST_PA_LCD_WDATA1 (0x9000000) | ||
113 | #define BAST_VA_LCD_WDATA1 BAST_IOADDR(0x00A00000) | ||
114 | |||
115 | #define BAST_PA_LCD_RCMD2 (0xA800000) | ||
116 | #define BAST_VA_LCD_RCMD2 BAST_IOADDR(0x00B00000) | ||
117 | |||
118 | #define BAST_PA_LCD_WCMD2 (0xA000000) | ||
119 | #define BAST_VA_LCD_WCMD2 BAST_IOADDR(0x00C00000) | ||
120 | |||
121 | #define BAST_PA_LCD_RDATA2 (0xB800000) | ||
122 | #define BAST_VA_LCD_RDATA2 BAST_IOADDR(0x00D00000) | ||
123 | |||
124 | #define BAST_PA_LCD_WDATA2 (0xB000000) | ||
125 | #define BAST_VA_LCD_WDATA2 BAST_IOADDR(0x00E00000) | ||
126 | |||
127 | |||
128 | /* | ||
129 | * 0xE0000000 contains the IO space that is split by speed and | ||
130 | * whether the access is for 8 or 16bit IO... this ensures that | ||
131 | * the correct access is made | ||
132 | * | ||
133 | * 0x10000000 of space, partitioned as so: | ||
134 | * | ||
135 | * 0x00000000 to 0x04000000 8bit, slow | ||
136 | * 0x04000000 to 0x08000000 16bit, slow | ||
137 | * 0x08000000 to 0x0C000000 16bit, net | ||
138 | * 0x0C000000 to 0x10000000 16bit, fast | ||
139 | * | ||
140 | * each of these spaces has the following in: | ||
141 | * | ||
142 | * 0x00000000 to 0x01000000 16MB ISA IO space | ||
143 | * 0x01000000 to 0x02000000 16MB ISA memory space | ||
144 | * 0x02000000 to 0x02100000 1MB IDE primary channel | ||
145 | * 0x02100000 to 0x02200000 1MB IDE primary channel aux | ||
146 | * 0x02200000 to 0x02400000 1MB IDE secondary channel | ||
147 | * 0x02300000 to 0x02400000 1MB IDE secondary channel aux | ||
148 | * 0x02400000 to 0x02500000 1MB ASIX ethernet controller | ||
149 | * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controller | ||
150 | * 0x02600000 to 0x02700000 1MB PC SuperIO controller | ||
151 | * | ||
152 | * the phyiscal layout of the zones are: | ||
153 | * nGCS2 - 8bit, slow | ||
154 | * nGCS3 - 16bit, slow | ||
155 | * nGCS4 - 16bit, net | ||
156 | * nGCS5 - 16bit, fast | ||
157 | */ | ||
158 | |||
159 | #define BAST_VA_MULTISPACE (0xE0000000) | ||
160 | |||
161 | #define BAST_VA_ISAIO (BAST_VA_MULTISPACE + 0x00000000) | ||
162 | #define BAST_VA_ISAMEM (BAST_VA_MULTISPACE + 0x01000000) | ||
163 | #define BAST_VA_IDEPRI (BAST_VA_MULTISPACE + 0x02000000) | ||
164 | #define BAST_VA_IDEPRIAUX (BAST_VA_MULTISPACE + 0x02100000) | ||
165 | #define BAST_VA_IDESEC (BAST_VA_MULTISPACE + 0x02200000) | ||
166 | #define BAST_VA_IDESECAUX (BAST_VA_MULTISPACE + 0x02300000) | ||
167 | #define BAST_VA_ASIXNET (BAST_VA_MULTISPACE + 0x02400000) | ||
168 | #define BAST_VA_DM9000 (BAST_VA_MULTISPACE + 0x02500000) | ||
169 | #define BAST_VA_SUPERIO (BAST_VA_MULTISPACE + 0x02600000) | ||
170 | |||
171 | #define BAST_VAM_CS2 (0x00000000) | ||
172 | #define BAST_VAM_CS3 (0x04000000) | ||
173 | #define BAST_VAM_CS4 (0x08000000) | ||
174 | #define BAST_VAM_CS5 (0x0C000000) | ||
175 | |||
176 | /* physical offset addresses for the peripherals */ | ||
177 | |||
178 | #define BAST_PA_ISAIO (0x00000000) | ||
179 | #define BAST_PA_ASIXNET (0x01000000) | ||
180 | #define BAST_PA_SUPERIO (0x01800000) | ||
181 | #define BAST_PA_IDEPRI (0x02000000) | ||
182 | #define BAST_PA_IDEPRIAUX (0x02800000) | ||
183 | #define BAST_PA_IDESEC (0x03000000) | ||
184 | #define BAST_PA_IDESECAUX (0x03800000) | ||
185 | #define BAST_PA_ISAMEM (0x04000000) | ||
186 | #define BAST_PA_DM9000 (0x05000000) | ||
187 | |||
188 | /* some configurations for the peripherals */ | ||
189 | |||
190 | #define BAST_PCSIO (BAST_VA_SUPERIO + BAST_VAM_CS2) | ||
191 | |||
192 | #define BAST_ASIXNET_CS BAST_VAM_CS5 | ||
193 | #define BAST_DM9000_CS BAST_VAM_CS4 | ||
194 | |||
195 | #define BAST_IDE_CS S3C2410_CS5 | ||
196 | |||
197 | #endif /* __MACH_S3C24XX_BAST_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/clock-dclk.c b/arch/arm/mach-s3c24xx/clock-dclk.c new file mode 100644 index 000000000000..1edd9b2369c5 --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-dclk.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2004-2008 Simtec Electronics | ||
3 | * Ben Dooks <ben@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 - definitions for DCLK and CLKOUT registers | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/clk.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <mach/regs-clock.h> | ||
19 | #include <mach/regs-gpio.h> | ||
20 | |||
21 | #include <plat/clock.h> | ||
22 | #include <plat/cpu.h> | ||
23 | |||
24 | /* clocks that could be registered by external code */ | ||
25 | |||
26 | static int s3c24xx_dclk_enable(struct clk *clk, int enable) | ||
27 | { | ||
28 | unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON); | ||
29 | |||
30 | if (enable) | ||
31 | dclkcon |= clk->ctrlbit; | ||
32 | else | ||
33 | dclkcon &= ~clk->ctrlbit; | ||
34 | |||
35 | __raw_writel(dclkcon, S3C24XX_DCLKCON); | ||
36 | |||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent) | ||
41 | { | ||
42 | unsigned long dclkcon; | ||
43 | unsigned int uclk; | ||
44 | |||
45 | if (parent == &clk_upll) | ||
46 | uclk = 1; | ||
47 | else if (parent == &clk_p) | ||
48 | uclk = 0; | ||
49 | else | ||
50 | return -EINVAL; | ||
51 | |||
52 | clk->parent = parent; | ||
53 | |||
54 | dclkcon = __raw_readl(S3C24XX_DCLKCON); | ||
55 | |||
56 | if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) { | ||
57 | if (uclk) | ||
58 | dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK; | ||
59 | else | ||
60 | dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK; | ||
61 | } else { | ||
62 | if (uclk) | ||
63 | dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK; | ||
64 | else | ||
65 | dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK; | ||
66 | } | ||
67 | |||
68 | __raw_writel(dclkcon, S3C24XX_DCLKCON); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate) | ||
73 | { | ||
74 | unsigned long div; | ||
75 | |||
76 | if ((rate == 0) || !clk->parent) | ||
77 | return 0; | ||
78 | |||
79 | div = clk_get_rate(clk->parent) / rate; | ||
80 | if (div < 2) | ||
81 | div = 2; | ||
82 | else if (div > 16) | ||
83 | div = 16; | ||
84 | |||
85 | return div; | ||
86 | } | ||
87 | |||
88 | static unsigned long s3c24xx_round_dclk_rate(struct clk *clk, | ||
89 | unsigned long rate) | ||
90 | { | ||
91 | unsigned long div = s3c24xx_calc_div(clk, rate); | ||
92 | |||
93 | if (div == 0) | ||
94 | return 0; | ||
95 | |||
96 | return clk_get_rate(clk->parent) / div; | ||
97 | } | ||
98 | |||
99 | static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate) | ||
100 | { | ||
101 | unsigned long mask, data, div = s3c24xx_calc_div(clk, rate); | ||
102 | |||
103 | if (div == 0) | ||
104 | return -EINVAL; | ||
105 | |||
106 | if (clk == &s3c24xx_dclk0) { | ||
107 | mask = S3C2410_DCLKCON_DCLK0_DIV_MASK | | ||
108 | S3C2410_DCLKCON_DCLK0_CMP_MASK; | ||
109 | data = S3C2410_DCLKCON_DCLK0_DIV(div) | | ||
110 | S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2); | ||
111 | } else if (clk == &s3c24xx_dclk1) { | ||
112 | mask = S3C2410_DCLKCON_DCLK1_DIV_MASK | | ||
113 | S3C2410_DCLKCON_DCLK1_CMP_MASK; | ||
114 | data = S3C2410_DCLKCON_DCLK1_DIV(div) | | ||
115 | S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2); | ||
116 | } else | ||
117 | return -EINVAL; | ||
118 | |||
119 | clk->rate = clk_get_rate(clk->parent) / div; | ||
120 | __raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data), | ||
121 | S3C24XX_DCLKCON); | ||
122 | return clk->rate; | ||
123 | } | ||
124 | static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent) | ||
125 | { | ||
126 | unsigned long mask; | ||
127 | unsigned long source; | ||
128 | |||
129 | /* calculate the MISCCR setting for the clock */ | ||
130 | |||
131 | if (parent == &clk_mpll) | ||
132 | source = S3C2410_MISCCR_CLK0_MPLL; | ||
133 | else if (parent == &clk_upll) | ||
134 | source = S3C2410_MISCCR_CLK0_UPLL; | ||
135 | else if (parent == &clk_f) | ||
136 | source = S3C2410_MISCCR_CLK0_FCLK; | ||
137 | else if (parent == &clk_h) | ||
138 | source = S3C2410_MISCCR_CLK0_HCLK; | ||
139 | else if (parent == &clk_p) | ||
140 | source = S3C2410_MISCCR_CLK0_PCLK; | ||
141 | else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0) | ||
142 | source = S3C2410_MISCCR_CLK0_DCLK0; | ||
143 | else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1) | ||
144 | source = S3C2410_MISCCR_CLK0_DCLK0; | ||
145 | else | ||
146 | return -EINVAL; | ||
147 | |||
148 | clk->parent = parent; | ||
149 | |||
150 | if (clk == &s3c24xx_clkout0) | ||
151 | mask = S3C2410_MISCCR_CLK0_MASK; | ||
152 | else { | ||
153 | source <<= 4; | ||
154 | mask = S3C2410_MISCCR_CLK1_MASK; | ||
155 | } | ||
156 | |||
157 | s3c2410_modify_misccr(mask, source); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | /* external clock definitions */ | ||
162 | |||
163 | static struct clk_ops dclk_ops = { | ||
164 | .set_parent = s3c24xx_dclk_setparent, | ||
165 | .set_rate = s3c24xx_set_dclk_rate, | ||
166 | .round_rate = s3c24xx_round_dclk_rate, | ||
167 | }; | ||
168 | |||
169 | struct clk s3c24xx_dclk0 = { | ||
170 | .name = "dclk0", | ||
171 | .ctrlbit = S3C2410_DCLKCON_DCLK0EN, | ||
172 | .enable = s3c24xx_dclk_enable, | ||
173 | .ops = &dclk_ops, | ||
174 | }; | ||
175 | |||
176 | struct clk s3c24xx_dclk1 = { | ||
177 | .name = "dclk1", | ||
178 | .ctrlbit = S3C2410_DCLKCON_DCLK1EN, | ||
179 | .enable = s3c24xx_dclk_enable, | ||
180 | .ops = &dclk_ops, | ||
181 | }; | ||
182 | |||
183 | static struct clk_ops clkout_ops = { | ||
184 | .set_parent = s3c24xx_clkout_setparent, | ||
185 | }; | ||
186 | |||
187 | struct clk s3c24xx_clkout0 = { | ||
188 | .name = "clkout0", | ||
189 | .ops = &clkout_ops, | ||
190 | }; | ||
191 | |||
192 | struct clk s3c24xx_clkout1 = { | ||
193 | .name = "clkout1", | ||
194 | .ops = &clkout_ops, | ||
195 | }; | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c new file mode 100644 index 000000000000..641266f3d152 --- /dev/null +++ b/arch/arm/mach-s3c24xx/clock-s3c2410.c | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006 Simtec Electronics | ||
3 | * Ben Dooks <ben@simtec.co.uk> | ||
4 | * | ||
5 | * S3C2410,S3C2440,S3C2442 Clock control support | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License 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 | * 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, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/err.h> | ||
28 | #include <linux/device.h> | ||
29 | #include <linux/clk.h> | ||
30 | #include <linux/mutex.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/serial_core.h> | ||
33 | #include <linux/io.h> | ||
34 | |||
35 | #include <asm/mach/map.h> | ||
36 | |||
37 | #include <mach/hardware.h> | ||
38 | |||
39 | #include <plat/regs-serial.h> | ||
40 | #include <mach/regs-clock.h> | ||
41 | #include <mach/regs-gpio.h> | ||
42 | |||
43 | #include <plat/s3c2410.h> | ||
44 | #include <plat/clock.h> | ||
45 | #include <plat/cpu.h> | ||
46 | |||
47 | int s3c2410_clkcon_enable(struct clk *clk, int enable) | ||
48 | { | ||
49 | unsigned int clocks = clk->ctrlbit; | ||
50 | unsigned long clkcon; | ||
51 | |||
52 | clkcon = __raw_readl(S3C2410_CLKCON); | ||
53 | |||
54 | if (enable) | ||
55 | clkcon |= clocks; | ||
56 | else | ||
57 | clkcon &= ~clocks; | ||
58 | |||
59 | /* ensure none of the special function bits set */ | ||
60 | clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER); | ||
61 | |||
62 | __raw_writel(clkcon, S3C2410_CLKCON); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int s3c2410_upll_enable(struct clk *clk, int enable) | ||
68 | { | ||
69 | unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW); | ||
70 | unsigned long orig = clkslow; | ||
71 | |||
72 | if (enable) | ||
73 | clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF; | ||
74 | else | ||
75 | clkslow |= S3C2410_CLKSLOW_UCLK_OFF; | ||
76 | |||
77 | __raw_writel(clkslow, S3C2410_CLKSLOW); | ||
78 | |||
79 | /* if we started the UPLL, then allow to settle */ | ||
80 | |||
81 | if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF)) | ||
82 | udelay(200); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /* standard clock definitions */ | ||
88 | |||
89 | static struct clk init_clocks_off[] = { | ||
90 | { | ||
91 | .name = "nand", | ||
92 | .parent = &clk_h, | ||
93 | .enable = s3c2410_clkcon_enable, | ||
94 | .ctrlbit = S3C2410_CLKCON_NAND, | ||
95 | }, { | ||
96 | .name = "sdi", | ||
97 | .parent = &clk_p, | ||
98 | .enable = s3c2410_clkcon_enable, | ||
99 | .ctrlbit = S3C2410_CLKCON_SDI, | ||
100 | }, { | ||
101 | .name = "adc", | ||
102 | .parent = &clk_p, | ||
103 | .enable = s3c2410_clkcon_enable, | ||
104 | .ctrlbit = S3C2410_CLKCON_ADC, | ||
105 | }, { | ||
106 | .name = "i2c", | ||
107 | .parent = &clk_p, | ||
108 | .enable = s3c2410_clkcon_enable, | ||
109 | .ctrlbit = S3C2410_CLKCON_IIC, | ||
110 | }, { | ||
111 | .name = "iis", | ||
112 | .parent = &clk_p, | ||
113 | .enable = s3c2410_clkcon_enable, | ||
114 | .ctrlbit = S3C2410_CLKCON_IIS, | ||
115 | }, { | ||
116 | .name = "spi", | ||
117 | .parent = &clk_p, | ||
118 | .enable = s3c2410_clkcon_enable, | ||
119 | .ctrlbit = S3C2410_CLKCON_SPI, | ||
120 | } | ||
121 | }; | ||
122 | |||
123 | static struct clk init_clocks[] = { | ||
124 | { | ||
125 | .name = "lcd", | ||
126 | .parent = &clk_h, | ||
127 | .enable = s3c2410_clkcon_enable, | ||
128 | .ctrlbit = S3C2410_CLKCON_LCDC, | ||
129 | }, { | ||
130 | .name = "gpio", | ||
131 | .parent = &clk_p, | ||
132 | .enable = s3c2410_clkcon_enable, | ||
133 | .ctrlbit = S3C2410_CLKCON_GPIO, | ||
134 | }, { | ||
135 | .name = "usb-host", | ||
136 | .parent = &clk_h, | ||
137 | .enable = s3c2410_clkcon_enable, | ||
138 | .ctrlbit = S3C2410_CLKCON_USBH, | ||
139 | }, { | ||
140 | .name = "usb-device", | ||
141 | .parent = &clk_h, | ||
142 | .enable = s3c2410_clkcon_enable, | ||
143 | .ctrlbit = S3C2410_CLKCON_USBD, | ||
144 | }, { | ||
145 | .name = "timers", | ||
146 | .parent = &clk_p, | ||
147 | .enable = s3c2410_clkcon_enable, | ||
148 | .ctrlbit = S3C2410_CLKCON_PWMT, | ||
149 | }, { | ||
150 | .name = "uart", | ||
151 | .devname = "s3c2410-uart.0", | ||
152 | .parent = &clk_p, | ||
153 | .enable = s3c2410_clkcon_enable, | ||
154 | .ctrlbit = S3C2410_CLKCON_UART0, | ||
155 | }, { | ||
156 | .name = "uart", | ||
157 | .devname = "s3c2410-uart.1", | ||
158 | .parent = &clk_p, | ||
159 | .enable = s3c2410_clkcon_enable, | ||
160 | .ctrlbit = S3C2410_CLKCON_UART1, | ||
161 | }, { | ||
162 | .name = "uart", | ||
163 | .devname = "s3c2410-uart.2", | ||
164 | .parent = &clk_p, | ||
165 | .enable = s3c2410_clkcon_enable, | ||
166 | .ctrlbit = S3C2410_CLKCON_UART2, | ||
167 | }, { | ||
168 | .name = "rtc", | ||
169 | .parent = &clk_p, | ||
170 | .enable = s3c2410_clkcon_enable, | ||
171 | .ctrlbit = S3C2410_CLKCON_RTC, | ||
172 | }, { | ||
173 | .name = "watchdog", | ||
174 | .parent = &clk_p, | ||
175 | .ctrlbit = 0, | ||
176 | }, { | ||
177 | .name = "usb-bus-host", | ||
178 | .parent = &clk_usb_bus, | ||
179 | }, { | ||
180 | .name = "usb-bus-gadget", | ||
181 | .parent = &clk_usb_bus, | ||
182 | }, | ||
183 | }; | ||
184 | |||
185 | /* s3c2410_baseclk_add() | ||
186 | * | ||
187 | * Add all the clocks used by the s3c2410 or compatible CPUs | ||
188 | * such as the S3C2440 and S3C2442. | ||
189 | * | ||
190 | * We cannot use a system device as we are needed before any | ||
191 | * of the init-calls that initialise the devices are actually | ||
192 | * done. | ||
193 | */ | ||
194 | |||
195 | int __init s3c2410_baseclk_add(void) | ||
196 | { | ||
197 | unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW); | ||
198 | unsigned long clkcon = __raw_readl(S3C2410_CLKCON); | ||
199 | struct clk *clkp; | ||
200 | struct clk *xtal; | ||
201 | int ret; | ||
202 | int ptr; | ||
203 | |||
204 | clk_upll.enable = s3c2410_upll_enable; | ||
205 | |||
206 | if (s3c24xx_register_clock(&clk_usb_bus) < 0) | ||
207 | printk(KERN_ERR "failed to register usb bus clock\n"); | ||
208 | |||
209 | /* register clocks from clock array */ | ||
210 | |||
211 | clkp = init_clocks; | ||
212 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { | ||
213 | /* ensure that we note the clock state */ | ||
214 | |||
215 | clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0; | ||
216 | |||
217 | ret = s3c24xx_register_clock(clkp); | ||
218 | if (ret < 0) { | ||
219 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
220 | clkp->name, ret); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | /* We must be careful disabling the clocks we are not intending to | ||
225 | * be using at boot time, as subsystems such as the LCD which do | ||
226 | * their own DMA requests to the bus can cause the system to lockup | ||
227 | * if they where in the middle of requesting bus access. | ||
228 | * | ||
229 | * Disabling the LCD clock if the LCD is active is very dangerous, | ||
230 | * and therefore the bootloader should be careful to not enable | ||
231 | * the LCD clock if it is not needed. | ||
232 | */ | ||
233 | |||
234 | /* install (and disable) the clocks we do not need immediately */ | ||
235 | |||
236 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
237 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
238 | |||
239 | /* show the clock-slow value */ | ||
240 | |||
241 | xtal = clk_get(NULL, "xtal"); | ||
242 | |||
243 | printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n", | ||
244 | print_mhz(clk_get_rate(xtal) / | ||
245 | ( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))), | ||
246 | (clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast", | ||
247 | (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on", | ||
248 | (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on"); | ||
249 | |||
250 | s3c_pwmclk_init(); | ||
251 | return 0; | ||
252 | } | ||
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h index c2f596e7bc2d..ed6276fcaa3b 100644 --- a/arch/arm/mach-s3c24xx/common.h +++ b/arch/arm/mach-s3c24xx/common.h | |||
@@ -15,4 +15,6 @@ | |||
15 | void s3c2410_restart(char mode, const char *cmd); | 15 | void s3c2410_restart(char mode, const char *cmd); |
16 | void s3c244x_restart(char mode, const char *cmd); | 16 | void s3c244x_restart(char mode, const char *cmd); |
17 | 17 | ||
18 | extern struct syscore_ops s3c24xx_irq_syscore_ops; | ||
19 | |||
18 | #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ | 20 | #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ |
diff --git a/arch/arm/mach-s3c24xx/cpufreq-debugfs.c b/arch/arm/mach-s3c24xx/cpufreq-debugfs.c new file mode 100644 index 000000000000..9b7b4289d66c --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq-debugfs.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX CPU Frequency scaling - debugfs status 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/init.h> | ||
14 | #include <linux/export.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/debugfs.h> | ||
19 | #include <linux/seq_file.h> | ||
20 | #include <linux/err.h> | ||
21 | |||
22 | #include <plat/cpu-freq-core.h> | ||
23 | |||
24 | static struct dentry *dbgfs_root; | ||
25 | static struct dentry *dbgfs_file_io; | ||
26 | static struct dentry *dbgfs_file_info; | ||
27 | static struct dentry *dbgfs_file_board; | ||
28 | |||
29 | #define print_ns(x) ((x) / 10), ((x) % 10) | ||
30 | |||
31 | static void show_max(struct seq_file *seq, struct s3c_freq *f) | ||
32 | { | ||
33 | seq_printf(seq, "MAX: F=%lu, H=%lu, P=%lu, A=%lu\n", | ||
34 | f->fclk, f->hclk, f->pclk, f->armclk); | ||
35 | } | ||
36 | |||
37 | static int board_show(struct seq_file *seq, void *p) | ||
38 | { | ||
39 | struct s3c_cpufreq_config *cfg; | ||
40 | struct s3c_cpufreq_board *brd; | ||
41 | |||
42 | cfg = s3c_cpufreq_getconfig(); | ||
43 | if (!cfg) { | ||
44 | seq_printf(seq, "no configuration registered\n"); | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | brd = cfg->board; | ||
49 | if (!brd) { | ||
50 | seq_printf(seq, "no board definition set?\n"); | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | seq_printf(seq, "SDRAM refresh %u ns\n", brd->refresh); | ||
55 | seq_printf(seq, "auto_io=%u\n", brd->auto_io); | ||
56 | seq_printf(seq, "need_io=%u\n", brd->need_io); | ||
57 | |||
58 | show_max(seq, &brd->max); | ||
59 | |||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int fops_board_open(struct inode *inode, struct file *file) | ||
65 | { | ||
66 | return single_open(file, board_show, NULL); | ||
67 | } | ||
68 | |||
69 | static const struct file_operations fops_board = { | ||
70 | .open = fops_board_open, | ||
71 | .read = seq_read, | ||
72 | .llseek = seq_lseek, | ||
73 | .release = single_release, | ||
74 | .owner = THIS_MODULE, | ||
75 | }; | ||
76 | |||
77 | static int info_show(struct seq_file *seq, void *p) | ||
78 | { | ||
79 | struct s3c_cpufreq_config *cfg; | ||
80 | |||
81 | cfg = s3c_cpufreq_getconfig(); | ||
82 | if (!cfg) { | ||
83 | seq_printf(seq, "no configuration registered\n"); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | seq_printf(seq, " FCLK %ld Hz\n", cfg->freq.fclk); | ||
88 | seq_printf(seq, " HCLK %ld Hz (%lu.%lu ns)\n", | ||
89 | cfg->freq.hclk, print_ns(cfg->freq.hclk_tns)); | ||
90 | seq_printf(seq, " PCLK %ld Hz\n", cfg->freq.hclk); | ||
91 | seq_printf(seq, "ARMCLK %ld Hz\n", cfg->freq.armclk); | ||
92 | seq_printf(seq, "\n"); | ||
93 | |||
94 | show_max(seq, &cfg->max); | ||
95 | |||
96 | seq_printf(seq, "Divisors: P=%d, H=%d, A=%d, dvs=%s\n", | ||
97 | cfg->divs.h_divisor, cfg->divs.p_divisor, | ||
98 | cfg->divs.arm_divisor, cfg->divs.dvs ? "on" : "off"); | ||
99 | seq_printf(seq, "\n"); | ||
100 | |||
101 | seq_printf(seq, "lock_pll=%u\n", cfg->lock_pll); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static int fops_info_open(struct inode *inode, struct file *file) | ||
107 | { | ||
108 | return single_open(file, info_show, NULL); | ||
109 | } | ||
110 | |||
111 | static const struct file_operations fops_info = { | ||
112 | .open = fops_info_open, | ||
113 | .read = seq_read, | ||
114 | .llseek = seq_lseek, | ||
115 | .release = single_release, | ||
116 | .owner = THIS_MODULE, | ||
117 | }; | ||
118 | |||
119 | static int io_show(struct seq_file *seq, void *p) | ||
120 | { | ||
121 | void (*show_bank)(struct seq_file *, struct s3c_cpufreq_config *, union s3c_iobank *); | ||
122 | struct s3c_cpufreq_config *cfg; | ||
123 | struct s3c_iotimings *iot; | ||
124 | union s3c_iobank *iob; | ||
125 | int bank; | ||
126 | |||
127 | cfg = s3c_cpufreq_getconfig(); | ||
128 | if (!cfg) { | ||
129 | seq_printf(seq, "no configuration registered\n"); | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | show_bank = cfg->info->debug_io_show; | ||
134 | if (!show_bank) { | ||
135 | seq_printf(seq, "no code to show bank timing\n"); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | iot = s3c_cpufreq_getiotimings(); | ||
140 | if (!iot) { | ||
141 | seq_printf(seq, "no io timings registered\n"); | ||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | seq_printf(seq, "hclk period is %lu.%lu ns\n", print_ns(cfg->freq.hclk_tns)); | ||
146 | |||
147 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
148 | iob = &iot->bank[bank]; | ||
149 | |||
150 | seq_printf(seq, "bank %d: ", bank); | ||
151 | |||
152 | if (!iob->io_2410) { | ||
153 | seq_printf(seq, "nothing set\n"); | ||
154 | continue; | ||
155 | } | ||
156 | |||
157 | show_bank(seq, cfg, iob); | ||
158 | } | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int fops_io_open(struct inode *inode, struct file *file) | ||
164 | { | ||
165 | return single_open(file, io_show, NULL); | ||
166 | } | ||
167 | |||
168 | static const struct file_operations fops_io = { | ||
169 | .open = fops_io_open, | ||
170 | .read = seq_read, | ||
171 | .llseek = seq_lseek, | ||
172 | .release = single_release, | ||
173 | .owner = THIS_MODULE, | ||
174 | }; | ||
175 | |||
176 | |||
177 | static int __init s3c_freq_debugfs_init(void) | ||
178 | { | ||
179 | dbgfs_root = debugfs_create_dir("s3c-cpufreq", NULL); | ||
180 | if (IS_ERR(dbgfs_root)) { | ||
181 | printk(KERN_ERR "%s: error creating debugfs root\n", __func__); | ||
182 | return PTR_ERR(dbgfs_root); | ||
183 | } | ||
184 | |||
185 | dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root, | ||
186 | NULL, &fops_io); | ||
187 | |||
188 | dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root, | ||
189 | NULL, &fops_info); | ||
190 | |||
191 | dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root, | ||
192 | NULL, &fops_board); | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | late_initcall(s3c_freq_debugfs_init); | ||
198 | |||
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c new file mode 100644 index 000000000000..cfa0dd8723ec --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2008 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 CPU Frequency scaling | ||
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/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/io.h> | ||
22 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach/map.h> | ||
25 | |||
26 | #include <mach/regs-clock.h> | ||
27 | |||
28 | #include <plat/cpu.h> | ||
29 | #include <plat/clock.h> | ||
30 | #include <plat/cpu-freq-core.h> | ||
31 | |||
32 | /* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */ | ||
33 | |||
34 | static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg) | ||
35 | { | ||
36 | u32 clkdiv = 0; | ||
37 | |||
38 | if (cfg->divs.h_divisor == 2) | ||
39 | clkdiv |= S3C2410_CLKDIVN_HDIVN; | ||
40 | |||
41 | if (cfg->divs.p_divisor != cfg->divs.h_divisor) | ||
42 | clkdiv |= S3C2410_CLKDIVN_PDIVN; | ||
43 | |||
44 | __raw_writel(clkdiv, S3C2410_CLKDIVN); | ||
45 | } | ||
46 | |||
47 | static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg) | ||
48 | { | ||
49 | unsigned long hclk, fclk, pclk; | ||
50 | unsigned int hdiv, pdiv; | ||
51 | unsigned long hclk_max; | ||
52 | |||
53 | fclk = cfg->freq.fclk; | ||
54 | hclk_max = cfg->max.hclk; | ||
55 | |||
56 | cfg->freq.armclk = fclk; | ||
57 | |||
58 | s3c_freq_dbg("%s: fclk is %lu, max hclk %lu\n", | ||
59 | __func__, fclk, hclk_max); | ||
60 | |||
61 | hdiv = (fclk > cfg->max.hclk) ? 2 : 1; | ||
62 | hclk = fclk / hdiv; | ||
63 | |||
64 | if (hclk > cfg->max.hclk) { | ||
65 | s3c_freq_dbg("%s: hclk too big\n", __func__); | ||
66 | return -EINVAL; | ||
67 | } | ||
68 | |||
69 | pdiv = (hclk > cfg->max.pclk) ? 2 : 1; | ||
70 | pclk = hclk / pdiv; | ||
71 | |||
72 | if (pclk > cfg->max.pclk) { | ||
73 | s3c_freq_dbg("%s: pclk too big\n", __func__); | ||
74 | return -EINVAL; | ||
75 | } | ||
76 | |||
77 | pdiv *= hdiv; | ||
78 | |||
79 | /* record the result */ | ||
80 | cfg->divs.p_divisor = pdiv; | ||
81 | cfg->divs.h_divisor = hdiv; | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static struct s3c_cpufreq_info s3c2410_cpufreq_info = { | ||
87 | .max = { | ||
88 | .fclk = 200000000, | ||
89 | .hclk = 100000000, | ||
90 | .pclk = 50000000, | ||
91 | }, | ||
92 | |||
93 | /* transition latency is about 5ms worst-case, so | ||
94 | * set 10ms to be sure */ | ||
95 | .latency = 10000000, | ||
96 | |||
97 | .locktime_m = 150, | ||
98 | .locktime_u = 150, | ||
99 | .locktime_bits = 12, | ||
100 | |||
101 | .need_pll = 1, | ||
102 | |||
103 | .name = "s3c2410", | ||
104 | .calc_iotiming = s3c2410_iotiming_calc, | ||
105 | .set_iotiming = s3c2410_iotiming_set, | ||
106 | .get_iotiming = s3c2410_iotiming_get, | ||
107 | .resume_clocks = s3c2410_setup_clocks, | ||
108 | |||
109 | .set_fvco = s3c2410_set_fvco, | ||
110 | .set_refresh = s3c2410_cpufreq_setrefresh, | ||
111 | .set_divs = s3c2410_cpufreq_setdivs, | ||
112 | .calc_divs = s3c2410_cpufreq_calcdivs, | ||
113 | |||
114 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), | ||
115 | }; | ||
116 | |||
117 | static int s3c2410_cpufreq_add(struct device *dev, | ||
118 | struct subsys_interface *sif) | ||
119 | { | ||
120 | return s3c_cpufreq_register(&s3c2410_cpufreq_info); | ||
121 | } | ||
122 | |||
123 | static struct subsys_interface s3c2410_cpufreq_interface = { | ||
124 | .name = "s3c2410_cpufreq", | ||
125 | .subsys = &s3c2410_subsys, | ||
126 | .add_dev = s3c2410_cpufreq_add, | ||
127 | }; | ||
128 | |||
129 | static int __init s3c2410_cpufreq_init(void) | ||
130 | { | ||
131 | return subsys_interface_register(&s3c2410_cpufreq_interface); | ||
132 | } | ||
133 | arch_initcall(s3c2410_cpufreq_init); | ||
134 | |||
135 | static int s3c2410a_cpufreq_add(struct device *dev, | ||
136 | struct subsys_interface *sif) | ||
137 | { | ||
138 | /* alter the maximum freq settings for S3C2410A. If a board knows | ||
139 | * it only has a maximum of 200, then it should register its own | ||
140 | * limits. */ | ||
141 | |||
142 | s3c2410_cpufreq_info.max.fclk = 266000000; | ||
143 | s3c2410_cpufreq_info.max.hclk = 133000000; | ||
144 | s3c2410_cpufreq_info.max.pclk = 66500000; | ||
145 | s3c2410_cpufreq_info.name = "s3c2410a"; | ||
146 | |||
147 | return s3c2410_cpufreq_add(dev, sif); | ||
148 | } | ||
149 | |||
150 | static struct subsys_interface s3c2410a_cpufreq_interface = { | ||
151 | .name = "s3c2410a_cpufreq", | ||
152 | .subsys = &s3c2410a_subsys, | ||
153 | .add_dev = s3c2410a_cpufreq_add, | ||
154 | }; | ||
155 | |||
156 | static int __init s3c2410a_cpufreq_init(void) | ||
157 | { | ||
158 | return subsys_interface_register(&s3c2410a_cpufreq_interface); | ||
159 | } | ||
160 | arch_initcall(s3c2410a_cpufreq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c new file mode 100644 index 000000000000..8bf0f3a77476 --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2412 CPU Frequency scalling | ||
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/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach/map.h> | ||
26 | |||
27 | #include <mach/regs-clock.h> | ||
28 | |||
29 | #include <plat/cpu.h> | ||
30 | #include <plat/clock.h> | ||
31 | #include <plat/cpu-freq-core.h> | ||
32 | |||
33 | #include "s3c2412.h" | ||
34 | |||
35 | /* our clock resources. */ | ||
36 | static struct clk *xtal; | ||
37 | static struct clk *fclk; | ||
38 | static struct clk *hclk; | ||
39 | static struct clk *armclk; | ||
40 | |||
41 | /* HDIV: 1, 2, 3, 4, 6, 8 */ | ||
42 | |||
43 | static int s3c2412_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg) | ||
44 | { | ||
45 | unsigned int hdiv, pdiv, armdiv, dvs; | ||
46 | unsigned long hclk, fclk, armclk, armdiv_clk; | ||
47 | unsigned long hclk_max; | ||
48 | |||
49 | fclk = cfg->freq.fclk; | ||
50 | armclk = cfg->freq.armclk; | ||
51 | hclk_max = cfg->max.hclk; | ||
52 | |||
53 | /* We can't run hclk above armclk as at the best we have to | ||
54 | * have armclk and hclk in dvs mode. */ | ||
55 | |||
56 | if (hclk_max > armclk) | ||
57 | hclk_max = armclk; | ||
58 | |||
59 | s3c_freq_dbg("%s: fclk=%lu, armclk=%lu, hclk_max=%lu\n", | ||
60 | __func__, fclk, armclk, hclk_max); | ||
61 | s3c_freq_dbg("%s: want f=%lu, arm=%lu, h=%lu, p=%lu\n", | ||
62 | __func__, cfg->freq.fclk, cfg->freq.armclk, | ||
63 | cfg->freq.hclk, cfg->freq.pclk); | ||
64 | |||
65 | armdiv = fclk / armclk; | ||
66 | |||
67 | if (armdiv < 1) | ||
68 | armdiv = 1; | ||
69 | if (armdiv > 2) | ||
70 | armdiv = 2; | ||
71 | |||
72 | cfg->divs.arm_divisor = armdiv; | ||
73 | armdiv_clk = fclk / armdiv; | ||
74 | |||
75 | hdiv = armdiv_clk / hclk_max; | ||
76 | if (hdiv < 1) | ||
77 | hdiv = 1; | ||
78 | |||
79 | cfg->freq.hclk = hclk = armdiv_clk / hdiv; | ||
80 | |||
81 | /* set dvs depending on whether we reached armclk or not. */ | ||
82 | cfg->divs.dvs = dvs = armclk < armdiv_clk; | ||
83 | |||
84 | /* update the actual armclk we achieved. */ | ||
85 | cfg->freq.armclk = dvs ? hclk : armdiv_clk; | ||
86 | |||
87 | s3c_freq_dbg("%s: armclk %lu, hclk %lu, armdiv %d, hdiv %d, dvs %d\n", | ||
88 | __func__, armclk, hclk, armdiv, hdiv, cfg->divs.dvs); | ||
89 | |||
90 | if (hdiv > 4) | ||
91 | goto invalid; | ||
92 | |||
93 | pdiv = (hclk > cfg->max.pclk) ? 2 : 1; | ||
94 | |||
95 | if ((hclk / pdiv) > cfg->max.pclk) | ||
96 | pdiv++; | ||
97 | |||
98 | cfg->freq.pclk = hclk / pdiv; | ||
99 | |||
100 | s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv); | ||
101 | |||
102 | if (pdiv > 2) | ||
103 | goto invalid; | ||
104 | |||
105 | pdiv *= hdiv; | ||
106 | |||
107 | /* store the result, and then return */ | ||
108 | |||
109 | cfg->divs.h_divisor = hdiv * armdiv; | ||
110 | cfg->divs.p_divisor = pdiv * armdiv; | ||
111 | |||
112 | return 0; | ||
113 | |||
114 | invalid: | ||
115 | return -EINVAL; | ||
116 | } | ||
117 | |||
118 | static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg) | ||
119 | { | ||
120 | unsigned long clkdiv; | ||
121 | unsigned long olddiv; | ||
122 | |||
123 | olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN); | ||
124 | |||
125 | /* clear off current clock info */ | ||
126 | |||
127 | clkdiv &= ~S3C2412_CLKDIVN_ARMDIVN; | ||
128 | clkdiv &= ~S3C2412_CLKDIVN_HDIVN_MASK; | ||
129 | clkdiv &= ~S3C2412_CLKDIVN_PDIVN; | ||
130 | |||
131 | if (cfg->divs.arm_divisor == 2) | ||
132 | clkdiv |= S3C2412_CLKDIVN_ARMDIVN; | ||
133 | |||
134 | clkdiv |= ((cfg->divs.h_divisor / cfg->divs.arm_divisor) - 1); | ||
135 | |||
136 | if (cfg->divs.p_divisor != cfg->divs.h_divisor) | ||
137 | clkdiv |= S3C2412_CLKDIVN_PDIVN; | ||
138 | |||
139 | s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv); | ||
140 | __raw_writel(clkdiv, S3C2410_CLKDIVN); | ||
141 | |||
142 | clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk); | ||
143 | } | ||
144 | |||
145 | static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg) | ||
146 | { | ||
147 | struct s3c_cpufreq_board *board = cfg->board; | ||
148 | unsigned long refresh; | ||
149 | |||
150 | s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__, | ||
151 | board->refresh, cfg->freq.hclk); | ||
152 | |||
153 | /* Reduce both the refresh time (in ns) and the frequency (in MHz) | ||
154 | * by 10 each to ensure that we do not overflow 32 bit numbers. This | ||
155 | * should work for HCLK up to 133MHz and refresh period up to 30usec. | ||
156 | */ | ||
157 | |||
158 | refresh = (board->refresh / 10); | ||
159 | refresh *= (cfg->freq.hclk / 100); | ||
160 | refresh /= (1 * 1000 * 1000); /* 10^6 */ | ||
161 | |||
162 | s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh); | ||
163 | __raw_writel(refresh, S3C2412_REFRESH); | ||
164 | } | ||
165 | |||
166 | /* set the default cpu frequency information, based on an 200MHz part | ||
167 | * as we have no other way of detecting the speed rating in software. | ||
168 | */ | ||
169 | |||
170 | static struct s3c_cpufreq_info s3c2412_cpufreq_info = { | ||
171 | .max = { | ||
172 | .fclk = 200000000, | ||
173 | .hclk = 100000000, | ||
174 | .pclk = 50000000, | ||
175 | }, | ||
176 | |||
177 | .latency = 5000000, /* 5ms */ | ||
178 | |||
179 | .locktime_m = 150, | ||
180 | .locktime_u = 150, | ||
181 | .locktime_bits = 16, | ||
182 | |||
183 | .name = "s3c2412", | ||
184 | .set_refresh = s3c2412_cpufreq_setrefresh, | ||
185 | .set_divs = s3c2412_cpufreq_setdivs, | ||
186 | .calc_divs = s3c2412_cpufreq_calcdivs, | ||
187 | |||
188 | .calc_iotiming = s3c2412_iotiming_calc, | ||
189 | .set_iotiming = s3c2412_iotiming_set, | ||
190 | .get_iotiming = s3c2412_iotiming_get, | ||
191 | |||
192 | .resume_clocks = s3c2412_setup_clocks, | ||
193 | |||
194 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs), | ||
195 | }; | ||
196 | |||
197 | static int s3c2412_cpufreq_add(struct device *dev, | ||
198 | struct subsys_interface *sif) | ||
199 | { | ||
200 | unsigned long fclk_rate; | ||
201 | |||
202 | hclk = clk_get(NULL, "hclk"); | ||
203 | if (IS_ERR(hclk)) { | ||
204 | printk(KERN_ERR "%s: cannot find hclk clock\n", __func__); | ||
205 | return -ENOENT; | ||
206 | } | ||
207 | |||
208 | fclk = clk_get(NULL, "fclk"); | ||
209 | if (IS_ERR(fclk)) { | ||
210 | printk(KERN_ERR "%s: cannot find fclk clock\n", __func__); | ||
211 | goto err_fclk; | ||
212 | } | ||
213 | |||
214 | fclk_rate = clk_get_rate(fclk); | ||
215 | if (fclk_rate > 200000000) { | ||
216 | printk(KERN_INFO | ||
217 | "%s: fclk %ld MHz, assuming 266MHz capable part\n", | ||
218 | __func__, fclk_rate / 1000000); | ||
219 | s3c2412_cpufreq_info.max.fclk = 266000000; | ||
220 | s3c2412_cpufreq_info.max.hclk = 133000000; | ||
221 | s3c2412_cpufreq_info.max.pclk = 66000000; | ||
222 | } | ||
223 | |||
224 | armclk = clk_get(NULL, "armclk"); | ||
225 | if (IS_ERR(armclk)) { | ||
226 | printk(KERN_ERR "%s: cannot find arm clock\n", __func__); | ||
227 | goto err_armclk; | ||
228 | } | ||
229 | |||
230 | xtal = clk_get(NULL, "xtal"); | ||
231 | if (IS_ERR(xtal)) { | ||
232 | printk(KERN_ERR "%s: cannot find xtal clock\n", __func__); | ||
233 | goto err_xtal; | ||
234 | } | ||
235 | |||
236 | return s3c_cpufreq_register(&s3c2412_cpufreq_info); | ||
237 | |||
238 | err_xtal: | ||
239 | clk_put(armclk); | ||
240 | err_armclk: | ||
241 | clk_put(fclk); | ||
242 | err_fclk: | ||
243 | clk_put(hclk); | ||
244 | |||
245 | return -ENOENT; | ||
246 | } | ||
247 | |||
248 | static struct subsys_interface s3c2412_cpufreq_interface = { | ||
249 | .name = "s3c2412_cpufreq", | ||
250 | .subsys = &s3c2412_subsys, | ||
251 | .add_dev = s3c2412_cpufreq_add, | ||
252 | }; | ||
253 | |||
254 | static int s3c2412_cpufreq_init(void) | ||
255 | { | ||
256 | return subsys_interface_register(&s3c2412_cpufreq_interface); | ||
257 | } | ||
258 | arch_initcall(s3c2412_cpufreq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c new file mode 100644 index 000000000000..72b2cc8a5a85 --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c | |||
@@ -0,0 +1,312 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2009 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * Vincent Sanders <vince@simtec.co.uk> | ||
6 | * | ||
7 | * S3C2440/S3C2442 CPU Frequency scaling | ||
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/init.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/ioport.h> | ||
18 | #include <linux/cpufreq.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/err.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <mach/hardware.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | |||
30 | #include <mach/regs-clock.h> | ||
31 | |||
32 | #include <plat/cpu.h> | ||
33 | #include <plat/cpu-freq-core.h> | ||
34 | #include <plat/clock.h> | ||
35 | |||
36 | static struct clk *xtal; | ||
37 | static struct clk *fclk; | ||
38 | static struct clk *hclk; | ||
39 | static struct clk *armclk; | ||
40 | |||
41 | /* HDIV: 1, 2, 3, 4, 6, 8 */ | ||
42 | |||
43 | static inline int within_khz(unsigned long a, unsigned long b) | ||
44 | { | ||
45 | long diff = a - b; | ||
46 | |||
47 | return (diff >= -1000 && diff <= 1000); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * s3c2440_cpufreq_calcdivs - calculate divider settings | ||
52 | * @cfg: The cpu frequency settings. | ||
53 | * | ||
54 | * Calcualte the divider values for the given frequency settings | ||
55 | * specified in @cfg. The values are stored in @cfg for later use | ||
56 | * by the relevant set routine if the request settings can be reached. | ||
57 | */ | ||
58 | int s3c2440_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg) | ||
59 | { | ||
60 | unsigned int hdiv, pdiv; | ||
61 | unsigned long hclk, fclk, armclk; | ||
62 | unsigned long hclk_max; | ||
63 | |||
64 | fclk = cfg->freq.fclk; | ||
65 | armclk = cfg->freq.armclk; | ||
66 | hclk_max = cfg->max.hclk; | ||
67 | |||
68 | s3c_freq_dbg("%s: fclk is %lu, armclk %lu, max hclk %lu\n", | ||
69 | __func__, fclk, armclk, hclk_max); | ||
70 | |||
71 | if (armclk > fclk) { | ||
72 | printk(KERN_WARNING "%s: armclk > fclk\n", __func__); | ||
73 | armclk = fclk; | ||
74 | } | ||
75 | |||
76 | /* if we are in DVS, we need HCLK to be <= ARMCLK */ | ||
77 | if (armclk < fclk && armclk < hclk_max) | ||
78 | hclk_max = armclk; | ||
79 | |||
80 | for (hdiv = 1; hdiv < 9; hdiv++) { | ||
81 | if (hdiv == 5 || hdiv == 7) | ||
82 | hdiv++; | ||
83 | |||
84 | hclk = (fclk / hdiv); | ||
85 | if (hclk <= hclk_max || within_khz(hclk, hclk_max)) | ||
86 | break; | ||
87 | } | ||
88 | |||
89 | s3c_freq_dbg("%s: hclk %lu, div %d\n", __func__, hclk, hdiv); | ||
90 | |||
91 | if (hdiv > 8) | ||
92 | goto invalid; | ||
93 | |||
94 | pdiv = (hclk > cfg->max.pclk) ? 2 : 1; | ||
95 | |||
96 | if ((hclk / pdiv) > cfg->max.pclk) | ||
97 | pdiv++; | ||
98 | |||
99 | s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv); | ||
100 | |||
101 | if (pdiv > 2) | ||
102 | goto invalid; | ||
103 | |||
104 | pdiv *= hdiv; | ||
105 | |||
106 | /* calculate a valid armclk */ | ||
107 | |||
108 | if (armclk < hclk) | ||
109 | armclk = hclk; | ||
110 | |||
111 | /* if we're running armclk lower than fclk, this really means | ||
112 | * that the system should go into dvs mode, which means that | ||
113 | * armclk is connected to hclk. */ | ||
114 | if (armclk < fclk) { | ||
115 | cfg->divs.dvs = 1; | ||
116 | armclk = hclk; | ||
117 | } else | ||
118 | cfg->divs.dvs = 0; | ||
119 | |||
120 | cfg->freq.armclk = armclk; | ||
121 | |||
122 | /* store the result, and then return */ | ||
123 | |||
124 | cfg->divs.h_divisor = hdiv; | ||
125 | cfg->divs.p_divisor = pdiv; | ||
126 | |||
127 | return 0; | ||
128 | |||
129 | invalid: | ||
130 | return -EINVAL; | ||
131 | } | ||
132 | |||
133 | #define CAMDIVN_HCLK_HALF (S3C2440_CAMDIVN_HCLK3_HALF | \ | ||
134 | S3C2440_CAMDIVN_HCLK4_HALF) | ||
135 | |||
136 | /** | ||
137 | * s3c2440_cpufreq_setdivs - set the cpu frequency divider settings | ||
138 | * @cfg: The cpu frequency settings. | ||
139 | * | ||
140 | * Set the divisors from the settings in @cfg, which where generated | ||
141 | * during the calculation phase by s3c2440_cpufreq_calcdivs(). | ||
142 | */ | ||
143 | static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg) | ||
144 | { | ||
145 | unsigned long clkdiv, camdiv; | ||
146 | |||
147 | s3c_freq_dbg("%s: divsiors: h=%d, p=%d\n", __func__, | ||
148 | cfg->divs.h_divisor, cfg->divs.p_divisor); | ||
149 | |||
150 | clkdiv = __raw_readl(S3C2410_CLKDIVN); | ||
151 | camdiv = __raw_readl(S3C2440_CAMDIVN); | ||
152 | |||
153 | clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN); | ||
154 | camdiv &= ~CAMDIVN_HCLK_HALF; | ||
155 | |||
156 | switch (cfg->divs.h_divisor) { | ||
157 | case 1: | ||
158 | clkdiv |= S3C2440_CLKDIVN_HDIVN_1; | ||
159 | break; | ||
160 | |||
161 | case 2: | ||
162 | clkdiv |= S3C2440_CLKDIVN_HDIVN_2; | ||
163 | break; | ||
164 | |||
165 | case 6: | ||
166 | camdiv |= S3C2440_CAMDIVN_HCLK3_HALF; | ||
167 | case 3: | ||
168 | clkdiv |= S3C2440_CLKDIVN_HDIVN_3_6; | ||
169 | break; | ||
170 | |||
171 | case 8: | ||
172 | camdiv |= S3C2440_CAMDIVN_HCLK4_HALF; | ||
173 | case 4: | ||
174 | clkdiv |= S3C2440_CLKDIVN_HDIVN_4_8; | ||
175 | break; | ||
176 | |||
177 | default: | ||
178 | BUG(); /* we don't expect to get here. */ | ||
179 | } | ||
180 | |||
181 | if (cfg->divs.p_divisor != cfg->divs.h_divisor) | ||
182 | clkdiv |= S3C2440_CLKDIVN_PDIVN; | ||
183 | |||
184 | /* todo - set pclk. */ | ||
185 | |||
186 | /* Write the divisors first with hclk intentionally halved so that | ||
187 | * when we write clkdiv we will under-frequency instead of over. We | ||
188 | * then make a short delay and remove the hclk halving if necessary. | ||
189 | */ | ||
190 | |||
191 | __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN); | ||
192 | __raw_writel(clkdiv, S3C2410_CLKDIVN); | ||
193 | |||
194 | ndelay(20); | ||
195 | __raw_writel(camdiv, S3C2440_CAMDIVN); | ||
196 | |||
197 | clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk); | ||
198 | } | ||
199 | |||
200 | static int run_freq_for(unsigned long max_hclk, unsigned long fclk, | ||
201 | int *divs, | ||
202 | struct cpufreq_frequency_table *table, | ||
203 | size_t table_size) | ||
204 | { | ||
205 | unsigned long freq; | ||
206 | int index = 0; | ||
207 | int div; | ||
208 | |||
209 | for (div = *divs; div > 0; div = *divs++) { | ||
210 | freq = fclk / div; | ||
211 | |||
212 | if (freq > max_hclk && div != 1) | ||
213 | continue; | ||
214 | |||
215 | freq /= 1000; /* table is in kHz */ | ||
216 | index = s3c_cpufreq_addfreq(table, index, table_size, freq); | ||
217 | if (index < 0) | ||
218 | break; | ||
219 | } | ||
220 | |||
221 | return index; | ||
222 | } | ||
223 | |||
224 | static int hclk_divs[] = { 1, 2, 3, 4, 6, 8, -1 }; | ||
225 | |||
226 | static int s3c2440_cpufreq_calctable(struct s3c_cpufreq_config *cfg, | ||
227 | struct cpufreq_frequency_table *table, | ||
228 | size_t table_size) | ||
229 | { | ||
230 | int ret; | ||
231 | |||
232 | WARN_ON(cfg->info == NULL); | ||
233 | WARN_ON(cfg->board == NULL); | ||
234 | |||
235 | ret = run_freq_for(cfg->info->max.hclk, | ||
236 | cfg->info->max.fclk, | ||
237 | hclk_divs, | ||
238 | table, table_size); | ||
239 | |||
240 | s3c_freq_dbg("%s: returning %d\n", __func__, ret); | ||
241 | |||
242 | return ret; | ||
243 | } | ||
244 | |||
245 | struct s3c_cpufreq_info s3c2440_cpufreq_info = { | ||
246 | .max = { | ||
247 | .fclk = 400000000, | ||
248 | .hclk = 133333333, | ||
249 | .pclk = 66666666, | ||
250 | }, | ||
251 | |||
252 | .locktime_m = 300, | ||
253 | .locktime_u = 300, | ||
254 | .locktime_bits = 16, | ||
255 | |||
256 | .name = "s3c244x", | ||
257 | .calc_iotiming = s3c2410_iotiming_calc, | ||
258 | .set_iotiming = s3c2410_iotiming_set, | ||
259 | .get_iotiming = s3c2410_iotiming_get, | ||
260 | .set_fvco = s3c2410_set_fvco, | ||
261 | |||
262 | .set_refresh = s3c2410_cpufreq_setrefresh, | ||
263 | .set_divs = s3c2440_cpufreq_setdivs, | ||
264 | .calc_divs = s3c2440_cpufreq_calcdivs, | ||
265 | .calc_freqtable = s3c2440_cpufreq_calctable, | ||
266 | |||
267 | .resume_clocks = s3c244x_setup_clocks, | ||
268 | |||
269 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), | ||
270 | }; | ||
271 | |||
272 | static int s3c2440_cpufreq_add(struct device *dev, | ||
273 | struct subsys_interface *sif) | ||
274 | { | ||
275 | xtal = s3c_cpufreq_clk_get(NULL, "xtal"); | ||
276 | hclk = s3c_cpufreq_clk_get(NULL, "hclk"); | ||
277 | fclk = s3c_cpufreq_clk_get(NULL, "fclk"); | ||
278 | armclk = s3c_cpufreq_clk_get(NULL, "armclk"); | ||
279 | |||
280 | if (IS_ERR(xtal) || IS_ERR(hclk) || IS_ERR(fclk) || IS_ERR(armclk)) { | ||
281 | printk(KERN_ERR "%s: failed to get clocks\n", __func__); | ||
282 | return -ENOENT; | ||
283 | } | ||
284 | |||
285 | return s3c_cpufreq_register(&s3c2440_cpufreq_info); | ||
286 | } | ||
287 | |||
288 | static struct subsys_interface s3c2440_cpufreq_interface = { | ||
289 | .name = "s3c2440_cpufreq", | ||
290 | .subsys = &s3c2440_subsys, | ||
291 | .add_dev = s3c2440_cpufreq_add, | ||
292 | }; | ||
293 | |||
294 | static int s3c2440_cpufreq_init(void) | ||
295 | { | ||
296 | return subsys_interface_register(&s3c2440_cpufreq_interface); | ||
297 | } | ||
298 | |||
299 | /* arch_initcall adds the clocks we need, so use subsys_initcall. */ | ||
300 | subsys_initcall(s3c2440_cpufreq_init); | ||
301 | |||
302 | static struct subsys_interface s3c2442_cpufreq_interface = { | ||
303 | .name = "s3c2442_cpufreq", | ||
304 | .subsys = &s3c2442_subsys, | ||
305 | .add_dev = s3c2440_cpufreq_add, | ||
306 | }; | ||
307 | |||
308 | static int s3c2442_cpufreq_init(void) | ||
309 | { | ||
310 | return subsys_interface_register(&s3c2442_cpufreq_interface); | ||
311 | } | ||
312 | subsys_initcall(s3c2442_cpufreq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c new file mode 100644 index 000000000000..ddd8280e3875 --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX CPU Frequency scaling - utils for S3C2410/S3C2440/S3C2442 | ||
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/errno.h> | ||
15 | #include <linux/cpufreq.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <mach/regs-clock.h> | ||
20 | |||
21 | #include <plat/cpu-freq-core.h> | ||
22 | |||
23 | #include "regs-mem.h" | ||
24 | |||
25 | /** | ||
26 | * s3c2410_cpufreq_setrefresh - set SDRAM refresh value | ||
27 | * @cfg: The frequency configuration | ||
28 | * | ||
29 | * Set the SDRAM refresh value appropriately for the configured | ||
30 | * frequency. | ||
31 | */ | ||
32 | void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg) | ||
33 | { | ||
34 | struct s3c_cpufreq_board *board = cfg->board; | ||
35 | unsigned long refresh; | ||
36 | unsigned long refval; | ||
37 | |||
38 | /* Reduce both the refresh time (in ns) and the frequency (in MHz) | ||
39 | * down to ensure that we do not overflow 32 bit numbers. | ||
40 | * | ||
41 | * This should work for HCLK up to 133MHz and refresh period up | ||
42 | * to 30usec. | ||
43 | */ | ||
44 | |||
45 | refresh = (cfg->freq.hclk / 100) * (board->refresh / 10); | ||
46 | refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale */ | ||
47 | refresh = (1 << 11) + 1 - refresh; | ||
48 | |||
49 | s3c_freq_dbg("%s: refresh value %lu\n", __func__, refresh); | ||
50 | |||
51 | refval = __raw_readl(S3C2410_REFRESH); | ||
52 | refval &= ~((1 << 12) - 1); | ||
53 | refval |= refresh; | ||
54 | __raw_writel(refval, S3C2410_REFRESH); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * s3c2410_set_fvco - set the PLL value | ||
59 | * @cfg: The frequency configuration | ||
60 | */ | ||
61 | void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg) | ||
62 | { | ||
63 | __raw_writel(cfg->pll.index, S3C2410_MPLLCON); | ||
64 | } | ||
diff --git a/arch/arm/mach-s3c24xx/cpufreq.c b/arch/arm/mach-s3c24xx/cpufreq.c new file mode 100644 index 000000000000..5f181e733eee --- /dev/null +++ b/arch/arm/mach-s3c24xx/cpufreq.c | |||
@@ -0,0 +1,715 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2008 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX CPU Frequency scaling | ||
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/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/cpu.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/sysfs.h> | ||
24 | #include <linux/slab.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | |||
29 | #include <plat/cpu.h> | ||
30 | #include <plat/clock.h> | ||
31 | #include <plat/cpu-freq-core.h> | ||
32 | |||
33 | #include <mach/regs-clock.h> | ||
34 | |||
35 | /* note, cpufreq support deals in kHz, no Hz */ | ||
36 | |||
37 | static struct cpufreq_driver s3c24xx_driver; | ||
38 | static struct s3c_cpufreq_config cpu_cur; | ||
39 | static struct s3c_iotimings s3c24xx_iotiming; | ||
40 | static struct cpufreq_frequency_table *pll_reg; | ||
41 | static unsigned int last_target = ~0; | ||
42 | static unsigned int ftab_size; | ||
43 | static struct cpufreq_frequency_table *ftab; | ||
44 | |||
45 | static struct clk *_clk_mpll; | ||
46 | static struct clk *_clk_xtal; | ||
47 | static struct clk *clk_fclk; | ||
48 | static struct clk *clk_hclk; | ||
49 | static struct clk *clk_pclk; | ||
50 | static struct clk *clk_arm; | ||
51 | |||
52 | #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS | ||
53 | struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void) | ||
54 | { | ||
55 | return &cpu_cur; | ||
56 | } | ||
57 | |||
58 | struct s3c_iotimings *s3c_cpufreq_getiotimings(void) | ||
59 | { | ||
60 | return &s3c24xx_iotiming; | ||
61 | } | ||
62 | #endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUGFS */ | ||
63 | |||
64 | static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg) | ||
65 | { | ||
66 | unsigned long fclk, pclk, hclk, armclk; | ||
67 | |||
68 | cfg->freq.fclk = fclk = clk_get_rate(clk_fclk); | ||
69 | cfg->freq.hclk = hclk = clk_get_rate(clk_hclk); | ||
70 | cfg->freq.pclk = pclk = clk_get_rate(clk_pclk); | ||
71 | cfg->freq.armclk = armclk = clk_get_rate(clk_arm); | ||
72 | |||
73 | cfg->pll.index = __raw_readl(S3C2410_MPLLCON); | ||
74 | cfg->pll.frequency = fclk; | ||
75 | |||
76 | cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10); | ||
77 | |||
78 | cfg->divs.h_divisor = fclk / hclk; | ||
79 | cfg->divs.p_divisor = fclk / pclk; | ||
80 | } | ||
81 | |||
82 | static inline void s3c_cpufreq_calc(struct s3c_cpufreq_config *cfg) | ||
83 | { | ||
84 | unsigned long pll = cfg->pll.frequency; | ||
85 | |||
86 | cfg->freq.fclk = pll; | ||
87 | cfg->freq.hclk = pll / cfg->divs.h_divisor; | ||
88 | cfg->freq.pclk = pll / cfg->divs.p_divisor; | ||
89 | |||
90 | /* convert hclk into 10ths of nanoseconds for io calcs */ | ||
91 | cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10); | ||
92 | } | ||
93 | |||
94 | static inline int closer(unsigned int target, unsigned int n, unsigned int c) | ||
95 | { | ||
96 | int diff_cur = abs(target - c); | ||
97 | int diff_new = abs(target - n); | ||
98 | |||
99 | return (diff_new < diff_cur); | ||
100 | } | ||
101 | |||
102 | static void s3c_cpufreq_show(const char *pfx, | ||
103 | struct s3c_cpufreq_config *cfg) | ||
104 | { | ||
105 | s3c_freq_dbg("%s: Fvco=%u, F=%lu, A=%lu, H=%lu (%u), P=%lu (%u)\n", | ||
106 | pfx, cfg->pll.frequency, cfg->freq.fclk, cfg->freq.armclk, | ||
107 | cfg->freq.hclk, cfg->divs.h_divisor, | ||
108 | cfg->freq.pclk, cfg->divs.p_divisor); | ||
109 | } | ||
110 | |||
111 | /* functions to wrapper the driver info calls to do the cpu specific work */ | ||
112 | |||
113 | static void s3c_cpufreq_setio(struct s3c_cpufreq_config *cfg) | ||
114 | { | ||
115 | if (cfg->info->set_iotiming) | ||
116 | (cfg->info->set_iotiming)(cfg, &s3c24xx_iotiming); | ||
117 | } | ||
118 | |||
119 | static int s3c_cpufreq_calcio(struct s3c_cpufreq_config *cfg) | ||
120 | { | ||
121 | if (cfg->info->calc_iotiming) | ||
122 | return (cfg->info->calc_iotiming)(cfg, &s3c24xx_iotiming); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void s3c_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg) | ||
128 | { | ||
129 | (cfg->info->set_refresh)(cfg); | ||
130 | } | ||
131 | |||
132 | static void s3c_cpufreq_setdivs(struct s3c_cpufreq_config *cfg) | ||
133 | { | ||
134 | (cfg->info->set_divs)(cfg); | ||
135 | } | ||
136 | |||
137 | static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg) | ||
138 | { | ||
139 | return (cfg->info->calc_divs)(cfg); | ||
140 | } | ||
141 | |||
142 | static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg) | ||
143 | { | ||
144 | (cfg->info->set_fvco)(cfg); | ||
145 | } | ||
146 | |||
147 | static inline void s3c_cpufreq_resume_clocks(void) | ||
148 | { | ||
149 | cpu_cur.info->resume_clocks(); | ||
150 | } | ||
151 | |||
152 | static inline void s3c_cpufreq_updateclk(struct clk *clk, | ||
153 | unsigned int freq) | ||
154 | { | ||
155 | clk_set_rate(clk, freq); | ||
156 | } | ||
157 | |||
158 | static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | ||
159 | unsigned int target_freq, | ||
160 | struct cpufreq_frequency_table *pll) | ||
161 | { | ||
162 | struct s3c_cpufreq_freqs freqs; | ||
163 | struct s3c_cpufreq_config cpu_new; | ||
164 | unsigned long flags; | ||
165 | |||
166 | cpu_new = cpu_cur; /* copy new from current */ | ||
167 | |||
168 | s3c_cpufreq_show("cur", &cpu_cur); | ||
169 | |||
170 | /* TODO - check for DMA currently outstanding */ | ||
171 | |||
172 | cpu_new.pll = pll ? *pll : cpu_cur.pll; | ||
173 | |||
174 | if (pll) | ||
175 | freqs.pll_changing = 1; | ||
176 | |||
177 | /* update our frequencies */ | ||
178 | |||
179 | cpu_new.freq.armclk = target_freq; | ||
180 | cpu_new.freq.fclk = cpu_new.pll.frequency; | ||
181 | |||
182 | if (s3c_cpufreq_calcdivs(&cpu_new) < 0) { | ||
183 | printk(KERN_ERR "no divisors for %d\n", target_freq); | ||
184 | goto err_notpossible; | ||
185 | } | ||
186 | |||
187 | s3c_freq_dbg("%s: got divs\n", __func__); | ||
188 | |||
189 | s3c_cpufreq_calc(&cpu_new); | ||
190 | |||
191 | s3c_freq_dbg("%s: calculated frequencies for new\n", __func__); | ||
192 | |||
193 | if (cpu_new.freq.hclk != cpu_cur.freq.hclk) { | ||
194 | if (s3c_cpufreq_calcio(&cpu_new) < 0) { | ||
195 | printk(KERN_ERR "%s: no IO timings\n", __func__); | ||
196 | goto err_notpossible; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | s3c_cpufreq_show("new", &cpu_new); | ||
201 | |||
202 | /* setup our cpufreq parameters */ | ||
203 | |||
204 | freqs.old = cpu_cur.freq; | ||
205 | freqs.new = cpu_new.freq; | ||
206 | |||
207 | freqs.freqs.cpu = 0; | ||
208 | freqs.freqs.old = cpu_cur.freq.armclk / 1000; | ||
209 | freqs.freqs.new = cpu_new.freq.armclk / 1000; | ||
210 | |||
211 | /* update f/h/p clock settings before we issue the change | ||
212 | * notification, so that drivers do not need to do anything | ||
213 | * special if they want to recalculate on CPUFREQ_PRECHANGE. */ | ||
214 | |||
215 | s3c_cpufreq_updateclk(_clk_mpll, cpu_new.pll.frequency); | ||
216 | s3c_cpufreq_updateclk(clk_fclk, cpu_new.freq.fclk); | ||
217 | s3c_cpufreq_updateclk(clk_hclk, cpu_new.freq.hclk); | ||
218 | s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); | ||
219 | |||
220 | /* start the frequency change */ | ||
221 | |||
222 | if (policy) | ||
223 | cpufreq_notify_transition(&freqs.freqs, CPUFREQ_PRECHANGE); | ||
224 | |||
225 | /* If hclk is staying the same, then we do not need to | ||
226 | * re-write the IO or the refresh timings whilst we are changing | ||
227 | * speed. */ | ||
228 | |||
229 | local_irq_save(flags); | ||
230 | |||
231 | /* is our memory clock slowing down? */ | ||
232 | if (cpu_new.freq.hclk < cpu_cur.freq.hclk) { | ||
233 | s3c_cpufreq_setrefresh(&cpu_new); | ||
234 | s3c_cpufreq_setio(&cpu_new); | ||
235 | } | ||
236 | |||
237 | if (cpu_new.freq.fclk == cpu_cur.freq.fclk) { | ||
238 | /* not changing PLL, just set the divisors */ | ||
239 | |||
240 | s3c_cpufreq_setdivs(&cpu_new); | ||
241 | } else { | ||
242 | if (cpu_new.freq.fclk < cpu_cur.freq.fclk) { | ||
243 | /* slow the cpu down, then set divisors */ | ||
244 | |||
245 | s3c_cpufreq_setfvco(&cpu_new); | ||
246 | s3c_cpufreq_setdivs(&cpu_new); | ||
247 | } else { | ||
248 | /* set the divisors, then speed up */ | ||
249 | |||
250 | s3c_cpufreq_setdivs(&cpu_new); | ||
251 | s3c_cpufreq_setfvco(&cpu_new); | ||
252 | } | ||
253 | } | ||
254 | |||
255 | /* did our memory clock speed up */ | ||
256 | if (cpu_new.freq.hclk > cpu_cur.freq.hclk) { | ||
257 | s3c_cpufreq_setrefresh(&cpu_new); | ||
258 | s3c_cpufreq_setio(&cpu_new); | ||
259 | } | ||
260 | |||
261 | /* update our current settings */ | ||
262 | cpu_cur = cpu_new; | ||
263 | |||
264 | local_irq_restore(flags); | ||
265 | |||
266 | /* notify everyone we've done this */ | ||
267 | if (policy) | ||
268 | cpufreq_notify_transition(&freqs.freqs, CPUFREQ_POSTCHANGE); | ||
269 | |||
270 | s3c_freq_dbg("%s: finished\n", __func__); | ||
271 | return 0; | ||
272 | |||
273 | err_notpossible: | ||
274 | printk(KERN_ERR "no compatible settings for %d\n", target_freq); | ||
275 | return -EINVAL; | ||
276 | } | ||
277 | |||
278 | /* s3c_cpufreq_target | ||
279 | * | ||
280 | * called by the cpufreq core to adjust the frequency that the CPU | ||
281 | * is currently running at. | ||
282 | */ | ||
283 | |||
284 | static int s3c_cpufreq_target(struct cpufreq_policy *policy, | ||
285 | unsigned int target_freq, | ||
286 | unsigned int relation) | ||
287 | { | ||
288 | struct cpufreq_frequency_table *pll; | ||
289 | unsigned int index; | ||
290 | |||
291 | /* avoid repeated calls which cause a needless amout of duplicated | ||
292 | * logging output (and CPU time as the calculation process is | ||
293 | * done) */ | ||
294 | if (target_freq == last_target) | ||
295 | return 0; | ||
296 | |||
297 | last_target = target_freq; | ||
298 | |||
299 | s3c_freq_dbg("%s: policy %p, target %u, relation %u\n", | ||
300 | __func__, policy, target_freq, relation); | ||
301 | |||
302 | if (ftab) { | ||
303 | if (cpufreq_frequency_table_target(policy, ftab, | ||
304 | target_freq, relation, | ||
305 | &index)) { | ||
306 | s3c_freq_dbg("%s: table failed\n", __func__); | ||
307 | return -EINVAL; | ||
308 | } | ||
309 | |||
310 | s3c_freq_dbg("%s: adjust %d to entry %d (%u)\n", __func__, | ||
311 | target_freq, index, ftab[index].frequency); | ||
312 | target_freq = ftab[index].frequency; | ||
313 | } | ||
314 | |||
315 | target_freq *= 1000; /* convert target to Hz */ | ||
316 | |||
317 | /* find the settings for our new frequency */ | ||
318 | |||
319 | if (!pll_reg || cpu_cur.lock_pll) { | ||
320 | /* either we've not got any PLL values, or we've locked | ||
321 | * to the current one. */ | ||
322 | pll = NULL; | ||
323 | } else { | ||
324 | struct cpufreq_policy tmp_policy; | ||
325 | int ret; | ||
326 | |||
327 | /* we keep the cpu pll table in Hz, to ensure we get an | ||
328 | * accurate value for the PLL output. */ | ||
329 | |||
330 | tmp_policy.min = policy->min * 1000; | ||
331 | tmp_policy.max = policy->max * 1000; | ||
332 | tmp_policy.cpu = policy->cpu; | ||
333 | |||
334 | /* cpufreq_frequency_table_target uses a pointer to 'index' | ||
335 | * which is the number of the table entry, not the value of | ||
336 | * the table entry's index field. */ | ||
337 | |||
338 | ret = cpufreq_frequency_table_target(&tmp_policy, pll_reg, | ||
339 | target_freq, relation, | ||
340 | &index); | ||
341 | |||
342 | if (ret < 0) { | ||
343 | printk(KERN_ERR "%s: no PLL available\n", __func__); | ||
344 | goto err_notpossible; | ||
345 | } | ||
346 | |||
347 | pll = pll_reg + index; | ||
348 | |||
349 | s3c_freq_dbg("%s: target %u => %u\n", | ||
350 | __func__, target_freq, pll->frequency); | ||
351 | |||
352 | target_freq = pll->frequency; | ||
353 | } | ||
354 | |||
355 | return s3c_cpufreq_settarget(policy, target_freq, pll); | ||
356 | |||
357 | err_notpossible: | ||
358 | printk(KERN_ERR "no compatible settings for %d\n", target_freq); | ||
359 | return -EINVAL; | ||
360 | } | ||
361 | |||
362 | static unsigned int s3c_cpufreq_get(unsigned int cpu) | ||
363 | { | ||
364 | return clk_get_rate(clk_arm) / 1000; | ||
365 | } | ||
366 | |||
367 | struct clk *s3c_cpufreq_clk_get(struct device *dev, const char *name) | ||
368 | { | ||
369 | struct clk *clk; | ||
370 | |||
371 | clk = clk_get(dev, name); | ||
372 | if (IS_ERR(clk)) | ||
373 | printk(KERN_ERR "cpufreq: failed to get clock '%s'\n", name); | ||
374 | |||
375 | return clk; | ||
376 | } | ||
377 | |||
378 | static int s3c_cpufreq_init(struct cpufreq_policy *policy) | ||
379 | { | ||
380 | printk(KERN_INFO "%s: initialising policy %p\n", __func__, policy); | ||
381 | |||
382 | if (policy->cpu != 0) | ||
383 | return -EINVAL; | ||
384 | |||
385 | policy->cur = s3c_cpufreq_get(0); | ||
386 | policy->min = policy->cpuinfo.min_freq = 0; | ||
387 | policy->max = policy->cpuinfo.max_freq = cpu_cur.info->max.fclk / 1000; | ||
388 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
389 | |||
390 | /* feed the latency information from the cpu driver */ | ||
391 | policy->cpuinfo.transition_latency = cpu_cur.info->latency; | ||
392 | |||
393 | if (ftab) | ||
394 | cpufreq_frequency_table_cpuinfo(policy, ftab); | ||
395 | |||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static __init int s3c_cpufreq_initclks(void) | ||
400 | { | ||
401 | _clk_mpll = s3c_cpufreq_clk_get(NULL, "mpll"); | ||
402 | _clk_xtal = s3c_cpufreq_clk_get(NULL, "xtal"); | ||
403 | clk_fclk = s3c_cpufreq_clk_get(NULL, "fclk"); | ||
404 | clk_hclk = s3c_cpufreq_clk_get(NULL, "hclk"); | ||
405 | clk_pclk = s3c_cpufreq_clk_get(NULL, "pclk"); | ||
406 | clk_arm = s3c_cpufreq_clk_get(NULL, "armclk"); | ||
407 | |||
408 | if (IS_ERR(clk_fclk) || IS_ERR(clk_hclk) || IS_ERR(clk_pclk) || | ||
409 | IS_ERR(_clk_mpll) || IS_ERR(clk_arm) || IS_ERR(_clk_xtal)) { | ||
410 | printk(KERN_ERR "%s: could not get clock(s)\n", __func__); | ||
411 | return -ENOENT; | ||
412 | } | ||
413 | |||
414 | printk(KERN_INFO "%s: clocks f=%lu,h=%lu,p=%lu,a=%lu\n", __func__, | ||
415 | clk_get_rate(clk_fclk) / 1000, | ||
416 | clk_get_rate(clk_hclk) / 1000, | ||
417 | clk_get_rate(clk_pclk) / 1000, | ||
418 | clk_get_rate(clk_arm) / 1000); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int s3c_cpufreq_verify(struct cpufreq_policy *policy) | ||
424 | { | ||
425 | if (policy->cpu != 0) | ||
426 | return -EINVAL; | ||
427 | |||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | #ifdef CONFIG_PM | ||
432 | static struct cpufreq_frequency_table suspend_pll; | ||
433 | static unsigned int suspend_freq; | ||
434 | |||
435 | static int s3c_cpufreq_suspend(struct cpufreq_policy *policy) | ||
436 | { | ||
437 | suspend_pll.frequency = clk_get_rate(_clk_mpll); | ||
438 | suspend_pll.index = __raw_readl(S3C2410_MPLLCON); | ||
439 | suspend_freq = s3c_cpufreq_get(0) * 1000; | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static int s3c_cpufreq_resume(struct cpufreq_policy *policy) | ||
445 | { | ||
446 | int ret; | ||
447 | |||
448 | s3c_freq_dbg("%s: resuming with policy %p\n", __func__, policy); | ||
449 | |||
450 | last_target = ~0; /* invalidate last_target setting */ | ||
451 | |||
452 | /* first, find out what speed we resumed at. */ | ||
453 | s3c_cpufreq_resume_clocks(); | ||
454 | |||
455 | /* whilst we will be called later on, we try and re-set the | ||
456 | * cpu frequencies as soon as possible so that we do not end | ||
457 | * up resuming devices and then immediately having to re-set | ||
458 | * a number of settings once these devices have restarted. | ||
459 | * | ||
460 | * as a note, it is expected devices are not used until they | ||
461 | * have been un-suspended and at that time they should have | ||
462 | * used the updated clock settings. | ||
463 | */ | ||
464 | |||
465 | ret = s3c_cpufreq_settarget(NULL, suspend_freq, &suspend_pll); | ||
466 | if (ret) { | ||
467 | printk(KERN_ERR "%s: failed to reset pll/freq\n", __func__); | ||
468 | return ret; | ||
469 | } | ||
470 | |||
471 | return 0; | ||
472 | } | ||
473 | #else | ||
474 | #define s3c_cpufreq_resume NULL | ||
475 | #define s3c_cpufreq_suspend NULL | ||
476 | #endif | ||
477 | |||
478 | static struct cpufreq_driver s3c24xx_driver = { | ||
479 | .flags = CPUFREQ_STICKY, | ||
480 | .verify = s3c_cpufreq_verify, | ||
481 | .target = s3c_cpufreq_target, | ||
482 | .get = s3c_cpufreq_get, | ||
483 | .init = s3c_cpufreq_init, | ||
484 | .suspend = s3c_cpufreq_suspend, | ||
485 | .resume = s3c_cpufreq_resume, | ||
486 | .name = "s3c24xx", | ||
487 | }; | ||
488 | |||
489 | |||
490 | int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info) | ||
491 | { | ||
492 | if (!info || !info->name) { | ||
493 | printk(KERN_ERR "%s: failed to pass valid information\n", | ||
494 | __func__); | ||
495 | return -EINVAL; | ||
496 | } | ||
497 | |||
498 | printk(KERN_INFO "S3C24XX CPU Frequency driver, %s cpu support\n", | ||
499 | info->name); | ||
500 | |||
501 | /* check our driver info has valid data */ | ||
502 | |||
503 | BUG_ON(info->set_refresh == NULL); | ||
504 | BUG_ON(info->set_divs == NULL); | ||
505 | BUG_ON(info->calc_divs == NULL); | ||
506 | |||
507 | /* info->set_fvco is optional, depending on whether there | ||
508 | * is a need to set the clock code. */ | ||
509 | |||
510 | cpu_cur.info = info; | ||
511 | |||
512 | /* Note, driver registering should probably update locktime */ | ||
513 | |||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | int __init s3c_cpufreq_setboard(struct s3c_cpufreq_board *board) | ||
518 | { | ||
519 | struct s3c_cpufreq_board *ours; | ||
520 | |||
521 | if (!board) { | ||
522 | printk(KERN_INFO "%s: no board data\n", __func__); | ||
523 | return -EINVAL; | ||
524 | } | ||
525 | |||
526 | /* Copy the board information so that each board can make this | ||
527 | * initdata. */ | ||
528 | |||
529 | ours = kzalloc(sizeof(struct s3c_cpufreq_board), GFP_KERNEL); | ||
530 | if (ours == NULL) { | ||
531 | printk(KERN_ERR "%s: no memory\n", __func__); | ||
532 | return -ENOMEM; | ||
533 | } | ||
534 | |||
535 | *ours = *board; | ||
536 | cpu_cur.board = ours; | ||
537 | |||
538 | return 0; | ||
539 | } | ||
540 | |||
541 | int __init s3c_cpufreq_auto_io(void) | ||
542 | { | ||
543 | int ret; | ||
544 | |||
545 | if (!cpu_cur.info->get_iotiming) { | ||
546 | printk(KERN_ERR "%s: get_iotiming undefined\n", __func__); | ||
547 | return -ENOENT; | ||
548 | } | ||
549 | |||
550 | printk(KERN_INFO "%s: working out IO settings\n", __func__); | ||
551 | |||
552 | ret = (cpu_cur.info->get_iotiming)(&cpu_cur, &s3c24xx_iotiming); | ||
553 | if (ret) | ||
554 | printk(KERN_ERR "%s: failed to get timings\n", __func__); | ||
555 | |||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | /* if one or is zero, then return the other, otherwise return the min */ | ||
560 | #define do_min(_a, _b) ((_a) == 0 ? (_b) : (_b) == 0 ? (_a) : min(_a, _b)) | ||
561 | |||
562 | /** | ||
563 | * s3c_cpufreq_freq_min - find the minimum settings for the given freq. | ||
564 | * @dst: The destination structure | ||
565 | * @a: One argument. | ||
566 | * @b: The other argument. | ||
567 | * | ||
568 | * Create a minimum of each frequency entry in the 'struct s3c_freq', | ||
569 | * unless the entry is zero when it is ignored and the non-zero argument | ||
570 | * used. | ||
571 | */ | ||
572 | static void s3c_cpufreq_freq_min(struct s3c_freq *dst, | ||
573 | struct s3c_freq *a, struct s3c_freq *b) | ||
574 | { | ||
575 | dst->fclk = do_min(a->fclk, b->fclk); | ||
576 | dst->hclk = do_min(a->hclk, b->hclk); | ||
577 | dst->pclk = do_min(a->pclk, b->pclk); | ||
578 | dst->armclk = do_min(a->armclk, b->armclk); | ||
579 | } | ||
580 | |||
581 | static inline u32 calc_locktime(u32 freq, u32 time_us) | ||
582 | { | ||
583 | u32 result; | ||
584 | |||
585 | result = freq * time_us; | ||
586 | result = DIV_ROUND_UP(result, 1000 * 1000); | ||
587 | |||
588 | return result; | ||
589 | } | ||
590 | |||
591 | static void s3c_cpufreq_update_loctkime(void) | ||
592 | { | ||
593 | unsigned int bits = cpu_cur.info->locktime_bits; | ||
594 | u32 rate = (u32)clk_get_rate(_clk_xtal); | ||
595 | u32 val; | ||
596 | |||
597 | if (bits == 0) { | ||
598 | WARN_ON(1); | ||
599 | return; | ||
600 | } | ||
601 | |||
602 | val = calc_locktime(rate, cpu_cur.info->locktime_u) << bits; | ||
603 | val |= calc_locktime(rate, cpu_cur.info->locktime_m); | ||
604 | |||
605 | printk(KERN_INFO "%s: new locktime is 0x%08x\n", __func__, val); | ||
606 | __raw_writel(val, S3C2410_LOCKTIME); | ||
607 | } | ||
608 | |||
609 | static int s3c_cpufreq_build_freq(void) | ||
610 | { | ||
611 | int size, ret; | ||
612 | |||
613 | if (!cpu_cur.info->calc_freqtable) | ||
614 | return -EINVAL; | ||
615 | |||
616 | kfree(ftab); | ||
617 | ftab = NULL; | ||
618 | |||
619 | size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0); | ||
620 | size++; | ||
621 | |||
622 | ftab = kmalloc(sizeof(struct cpufreq_frequency_table) * size, GFP_KERNEL); | ||
623 | if (!ftab) { | ||
624 | printk(KERN_ERR "%s: no memory for tables\n", __func__); | ||
625 | return -ENOMEM; | ||
626 | } | ||
627 | |||
628 | ftab_size = size; | ||
629 | |||
630 | ret = cpu_cur.info->calc_freqtable(&cpu_cur, ftab, size); | ||
631 | s3c_cpufreq_addfreq(ftab, ret, size, CPUFREQ_TABLE_END); | ||
632 | |||
633 | return 0; | ||
634 | } | ||
635 | |||
636 | static int __init s3c_cpufreq_initcall(void) | ||
637 | { | ||
638 | int ret = 0; | ||
639 | |||
640 | if (cpu_cur.info && cpu_cur.board) { | ||
641 | ret = s3c_cpufreq_initclks(); | ||
642 | if (ret) | ||
643 | goto out; | ||
644 | |||
645 | /* get current settings */ | ||
646 | s3c_cpufreq_getcur(&cpu_cur); | ||
647 | s3c_cpufreq_show("cur", &cpu_cur); | ||
648 | |||
649 | if (cpu_cur.board->auto_io) { | ||
650 | ret = s3c_cpufreq_auto_io(); | ||
651 | if (ret) { | ||
652 | printk(KERN_ERR "%s: failed to get io timing\n", | ||
653 | __func__); | ||
654 | goto out; | ||
655 | } | ||
656 | } | ||
657 | |||
658 | if (cpu_cur.board->need_io && !cpu_cur.info->set_iotiming) { | ||
659 | printk(KERN_ERR "%s: no IO support registered\n", | ||
660 | __func__); | ||
661 | ret = -EINVAL; | ||
662 | goto out; | ||
663 | } | ||
664 | |||
665 | if (!cpu_cur.info->need_pll) | ||
666 | cpu_cur.lock_pll = 1; | ||
667 | |||
668 | s3c_cpufreq_update_loctkime(); | ||
669 | |||
670 | s3c_cpufreq_freq_min(&cpu_cur.max, &cpu_cur.board->max, | ||
671 | &cpu_cur.info->max); | ||
672 | |||
673 | if (cpu_cur.info->calc_freqtable) | ||
674 | s3c_cpufreq_build_freq(); | ||
675 | |||
676 | ret = cpufreq_register_driver(&s3c24xx_driver); | ||
677 | } | ||
678 | |||
679 | out: | ||
680 | return ret; | ||
681 | } | ||
682 | |||
683 | late_initcall(s3c_cpufreq_initcall); | ||
684 | |||
685 | /** | ||
686 | * s3c_plltab_register - register CPU PLL table. | ||
687 | * @plls: The list of PLL entries. | ||
688 | * @plls_no: The size of the PLL entries @plls. | ||
689 | * | ||
690 | * Register the given set of PLLs with the system. | ||
691 | */ | ||
692 | int __init s3c_plltab_register(struct cpufreq_frequency_table *plls, | ||
693 | unsigned int plls_no) | ||
694 | { | ||
695 | struct cpufreq_frequency_table *vals; | ||
696 | unsigned int size; | ||
697 | |||
698 | size = sizeof(struct cpufreq_frequency_table) * (plls_no + 1); | ||
699 | |||
700 | vals = kmalloc(size, GFP_KERNEL); | ||
701 | if (vals) { | ||
702 | memcpy(vals, plls, size); | ||
703 | pll_reg = vals; | ||
704 | |||
705 | /* write a terminating entry, we don't store it in the | ||
706 | * table that is stored in the kernel */ | ||
707 | vals += plls_no; | ||
708 | vals->frequency = CPUFREQ_TABLE_END; | ||
709 | |||
710 | printk(KERN_INFO "cpufreq: %d PLL entries\n", plls_no); | ||
711 | } else | ||
712 | printk(KERN_ERR "cpufreq: no memory for PLL tables\n"); | ||
713 | |||
714 | return vals ? 0 : -ENOMEM; | ||
715 | } | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2410.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c index 4803338cf56e..25d085adc93c 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2410.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/regs-gpio.h> | 27 | #include <mach/regs-gpio.h> |
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
32 | #include <mach/regs-sdi.h> | 31 | #include <mach/regs-sdi.h> |
33 | #include <plat/regs-iis.h> | 32 | #include <plat/regs-iis.h> |
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c index 38472ac920ff..d2408ba372cb 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2412.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/regs-gpio.h> | 27 | #include <mach/regs-gpio.h> |
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
32 | #include <mach/regs-sdi.h> | 31 | #include <mach/regs-sdi.h> |
33 | #include <plat/regs-iis.h> | 32 | #include <plat/regs-iis.h> |
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2440.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c index 5f0a0c8ef84f..0b86e74d104f 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2440.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/regs-gpio.h> | 27 | #include <mach/regs-gpio.h> |
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
32 | #include <mach/regs-sdi.h> | 31 | #include <mach/regs-sdi.h> |
33 | #include <plat/regs-iis.h> | 32 | #include <plat/regs-iis.h> |
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c index 2d94228d2866..05536254a3f8 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2443.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <mach/regs-gpio.h> | 27 | #include <mach/regs-gpio.h> |
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-mem.h> | ||
31 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
32 | #include <mach/regs-sdi.h> | 31 | #include <mach/regs-sdi.h> |
33 | #include <plat/regs-iis.h> | 32 | #include <plat/regs-iis.h> |
diff --git a/arch/arm/mach-s3c24xx/dma.c b/arch/arm/mach-s3c24xx/dma.c new file mode 100644 index 000000000000..aab64909e9a3 --- /dev/null +++ b/arch/arm/mach-s3c24xx/dma.c | |||
@@ -0,0 +1,1468 @@ | |||
1 | /* | ||
2 | * Copyright 2003-2006 Simtec Electronics | ||
3 | * Ben Dooks <ben@simtec.co.uk> | ||
4 | * | ||
5 | * S3C2410 DMA core | ||
6 | * | ||
7 | * http://armlinux.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 | #ifdef CONFIG_S3C2410_DMA_DEBUG | ||
16 | #define DEBUG | ||
17 | #endif | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/syscore_ops.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <asm/irq.h> | ||
30 | #include <mach/hardware.h> | ||
31 | #include <mach/dma.h> | ||
32 | #include <mach/map.h> | ||
33 | |||
34 | #include <plat/dma-s3c24xx.h> | ||
35 | #include <plat/regs-dma.h> | ||
36 | |||
37 | /* io map for dma */ | ||
38 | static void __iomem *dma_base; | ||
39 | static struct kmem_cache *dma_kmem; | ||
40 | |||
41 | static int dma_channels; | ||
42 | |||
43 | static struct s3c24xx_dma_selection dma_sel; | ||
44 | |||
45 | |||
46 | /* debugging functions */ | ||
47 | |||
48 | #define BUF_MAGIC (0xcafebabe) | ||
49 | |||
50 | #define dmawarn(fmt...) printk(KERN_DEBUG fmt) | ||
51 | |||
52 | #define dma_regaddr(chan, reg) ((chan)->regs + (reg)) | ||
53 | |||
54 | #if 1 | ||
55 | #define dma_wrreg(chan, reg, val) writel((val), (chan)->regs + (reg)) | ||
56 | #else | ||
57 | static inline void | ||
58 | dma_wrreg(struct s3c2410_dma_chan *chan, int reg, unsigned long val) | ||
59 | { | ||
60 | pr_debug("writing %08x to register %08x\n",(unsigned int)val,reg); | ||
61 | writel(val, dma_regaddr(chan, reg)); | ||
62 | } | ||
63 | #endif | ||
64 | |||
65 | #define dma_rdreg(chan, reg) readl((chan)->regs + (reg)) | ||
66 | |||
67 | /* captured register state for debug */ | ||
68 | |||
69 | struct s3c2410_dma_regstate { | ||
70 | unsigned long dcsrc; | ||
71 | unsigned long disrc; | ||
72 | unsigned long dstat; | ||
73 | unsigned long dcon; | ||
74 | unsigned long dmsktrig; | ||
75 | }; | ||
76 | |||
77 | #ifdef CONFIG_S3C2410_DMA_DEBUG | ||
78 | |||
79 | /* dmadbg_showregs | ||
80 | * | ||
81 | * simple debug routine to print the current state of the dma registers | ||
82 | */ | ||
83 | |||
84 | static void | ||
85 | dmadbg_capture(struct s3c2410_dma_chan *chan, struct s3c2410_dma_regstate *regs) | ||
86 | { | ||
87 | regs->dcsrc = dma_rdreg(chan, S3C2410_DMA_DCSRC); | ||
88 | regs->disrc = dma_rdreg(chan, S3C2410_DMA_DISRC); | ||
89 | regs->dstat = dma_rdreg(chan, S3C2410_DMA_DSTAT); | ||
90 | regs->dcon = dma_rdreg(chan, S3C2410_DMA_DCON); | ||
91 | regs->dmsktrig = dma_rdreg(chan, S3C2410_DMA_DMASKTRIG); | ||
92 | } | ||
93 | |||
94 | static void | ||
95 | dmadbg_dumpregs(const char *fname, int line, struct s3c2410_dma_chan *chan, | ||
96 | struct s3c2410_dma_regstate *regs) | ||
97 | { | ||
98 | printk(KERN_DEBUG "dma%d: %s:%d: DCSRC=%08lx, DISRC=%08lx, DSTAT=%08lx DMT=%02lx, DCON=%08lx\n", | ||
99 | chan->number, fname, line, | ||
100 | regs->dcsrc, regs->disrc, regs->dstat, regs->dmsktrig, | ||
101 | regs->dcon); | ||
102 | } | ||
103 | |||
104 | static void | ||
105 | dmadbg_showchan(const char *fname, int line, struct s3c2410_dma_chan *chan) | ||
106 | { | ||
107 | struct s3c2410_dma_regstate state; | ||
108 | |||
109 | dmadbg_capture(chan, &state); | ||
110 | |||
111 | printk(KERN_DEBUG "dma%d: %s:%d: ls=%d, cur=%p, %p %p\n", | ||
112 | chan->number, fname, line, chan->load_state, | ||
113 | chan->curr, chan->next, chan->end); | ||
114 | |||
115 | dmadbg_dumpregs(fname, line, chan, &state); | ||
116 | } | ||
117 | |||
118 | static void | ||
119 | dmadbg_showregs(const char *fname, int line, struct s3c2410_dma_chan *chan) | ||
120 | { | ||
121 | struct s3c2410_dma_regstate state; | ||
122 | |||
123 | dmadbg_capture(chan, &state); | ||
124 | dmadbg_dumpregs(fname, line, chan, &state); | ||
125 | } | ||
126 | |||
127 | #define dbg_showregs(chan) dmadbg_showregs(__func__, __LINE__, (chan)) | ||
128 | #define dbg_showchan(chan) dmadbg_showchan(__func__, __LINE__, (chan)) | ||
129 | #else | ||
130 | #define dbg_showregs(chan) do { } while(0) | ||
131 | #define dbg_showchan(chan) do { } while(0) | ||
132 | #endif /* CONFIG_S3C2410_DMA_DEBUG */ | ||
133 | |||
134 | /* s3c2410_dma_stats_timeout | ||
135 | * | ||
136 | * Update DMA stats from timeout info | ||
137 | */ | ||
138 | |||
139 | static void | ||
140 | s3c2410_dma_stats_timeout(struct s3c2410_dma_stats *stats, int val) | ||
141 | { | ||
142 | if (stats == NULL) | ||
143 | return; | ||
144 | |||
145 | if (val > stats->timeout_longest) | ||
146 | stats->timeout_longest = val; | ||
147 | if (val < stats->timeout_shortest) | ||
148 | stats->timeout_shortest = val; | ||
149 | |||
150 | stats->timeout_avg += val; | ||
151 | } | ||
152 | |||
153 | /* s3c2410_dma_waitforload | ||
154 | * | ||
155 | * wait for the DMA engine to load a buffer, and update the state accordingly | ||
156 | */ | ||
157 | |||
158 | static int | ||
159 | s3c2410_dma_waitforload(struct s3c2410_dma_chan *chan, int line) | ||
160 | { | ||
161 | int timeout = chan->load_timeout; | ||
162 | int took; | ||
163 | |||
164 | if (chan->load_state != S3C2410_DMALOAD_1LOADED) { | ||
165 | printk(KERN_ERR "dma%d: s3c2410_dma_waitforload() called in loadstate %d from line %d\n", chan->number, chan->load_state, line); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | if (chan->stats != NULL) | ||
170 | chan->stats->loads++; | ||
171 | |||
172 | while (--timeout > 0) { | ||
173 | if ((dma_rdreg(chan, S3C2410_DMA_DSTAT) << (32-20)) != 0) { | ||
174 | took = chan->load_timeout - timeout; | ||
175 | |||
176 | s3c2410_dma_stats_timeout(chan->stats, took); | ||
177 | |||
178 | switch (chan->load_state) { | ||
179 | case S3C2410_DMALOAD_1LOADED: | ||
180 | chan->load_state = S3C2410_DMALOAD_1RUNNING; | ||
181 | break; | ||
182 | |||
183 | default: | ||
184 | printk(KERN_ERR "dma%d: unknown load_state in s3c2410_dma_waitforload() %d\n", chan->number, chan->load_state); | ||
185 | } | ||
186 | |||
187 | return 1; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | if (chan->stats != NULL) { | ||
192 | chan->stats->timeout_failed++; | ||
193 | } | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | /* s3c2410_dma_loadbuffer | ||
199 | * | ||
200 | * load a buffer, and update the channel state | ||
201 | */ | ||
202 | |||
203 | static inline int | ||
204 | s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan, | ||
205 | struct s3c2410_dma_buf *buf) | ||
206 | { | ||
207 | unsigned long reload; | ||
208 | |||
209 | if (buf == NULL) { | ||
210 | dmawarn("buffer is NULL\n"); | ||
211 | return -EINVAL; | ||
212 | } | ||
213 | |||
214 | pr_debug("s3c2410_chan_loadbuffer: loading buff %p (0x%08lx,0x%06x)\n", | ||
215 | buf, (unsigned long)buf->data, buf->size); | ||
216 | |||
217 | /* check the state of the channel before we do anything */ | ||
218 | |||
219 | if (chan->load_state == S3C2410_DMALOAD_1LOADED) { | ||
220 | dmawarn("load_state is S3C2410_DMALOAD_1LOADED\n"); | ||
221 | } | ||
222 | |||
223 | if (chan->load_state == S3C2410_DMALOAD_1LOADED_1RUNNING) { | ||
224 | dmawarn("state is S3C2410_DMALOAD_1LOADED_1RUNNING\n"); | ||
225 | } | ||
226 | |||
227 | /* it would seem sensible if we are the last buffer to not bother | ||
228 | * with the auto-reload bit, so that the DMA engine will not try | ||
229 | * and load another transfer after this one has finished... | ||
230 | */ | ||
231 | if (chan->load_state == S3C2410_DMALOAD_NONE) { | ||
232 | pr_debug("load_state is none, checking for noreload (next=%p)\n", | ||
233 | buf->next); | ||
234 | reload = (buf->next == NULL) ? S3C2410_DCON_NORELOAD : 0; | ||
235 | } else { | ||
236 | //pr_debug("load_state is %d => autoreload\n", chan->load_state); | ||
237 | reload = S3C2410_DCON_AUTORELOAD; | ||
238 | } | ||
239 | |||
240 | if ((buf->data & 0xf0000000) != 0x30000000) { | ||
241 | dmawarn("dmaload: buffer is %p\n", (void *)buf->data); | ||
242 | } | ||
243 | |||
244 | writel(buf->data, chan->addr_reg); | ||
245 | |||
246 | dma_wrreg(chan, S3C2410_DMA_DCON, | ||
247 | chan->dcon | reload | (buf->size/chan->xfer_unit)); | ||
248 | |||
249 | chan->next = buf->next; | ||
250 | |||
251 | /* update the state of the channel */ | ||
252 | |||
253 | switch (chan->load_state) { | ||
254 | case S3C2410_DMALOAD_NONE: | ||
255 | chan->load_state = S3C2410_DMALOAD_1LOADED; | ||
256 | break; | ||
257 | |||
258 | case S3C2410_DMALOAD_1RUNNING: | ||
259 | chan->load_state = S3C2410_DMALOAD_1LOADED_1RUNNING; | ||
260 | break; | ||
261 | |||
262 | default: | ||
263 | dmawarn("dmaload: unknown state %d in loadbuffer\n", | ||
264 | chan->load_state); | ||
265 | break; | ||
266 | } | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | /* s3c2410_dma_call_op | ||
272 | * | ||
273 | * small routine to call the op routine with the given op if it has been | ||
274 | * registered | ||
275 | */ | ||
276 | |||
277 | static void | ||
278 | s3c2410_dma_call_op(struct s3c2410_dma_chan *chan, enum s3c2410_chan_op op) | ||
279 | { | ||
280 | if (chan->op_fn != NULL) { | ||
281 | (chan->op_fn)(chan, op); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | /* s3c2410_dma_buffdone | ||
286 | * | ||
287 | * small wrapper to check if callback routine needs to be called, and | ||
288 | * if so, call it | ||
289 | */ | ||
290 | |||
291 | static inline void | ||
292 | s3c2410_dma_buffdone(struct s3c2410_dma_chan *chan, struct s3c2410_dma_buf *buf, | ||
293 | enum s3c2410_dma_buffresult result) | ||
294 | { | ||
295 | #if 0 | ||
296 | pr_debug("callback_fn=%p, buf=%p, id=%p, size=%d, result=%d\n", | ||
297 | chan->callback_fn, buf, buf->id, buf->size, result); | ||
298 | #endif | ||
299 | |||
300 | if (chan->callback_fn != NULL) { | ||
301 | (chan->callback_fn)(chan, buf->id, buf->size, result); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | /* s3c2410_dma_start | ||
306 | * | ||
307 | * start a dma channel going | ||
308 | */ | ||
309 | |||
310 | static int s3c2410_dma_start(struct s3c2410_dma_chan *chan) | ||
311 | { | ||
312 | unsigned long tmp; | ||
313 | unsigned long flags; | ||
314 | |||
315 | pr_debug("s3c2410_start_dma: channel=%d\n", chan->number); | ||
316 | |||
317 | local_irq_save(flags); | ||
318 | |||
319 | if (chan->state == S3C2410_DMA_RUNNING) { | ||
320 | pr_debug("s3c2410_start_dma: already running (%d)\n", chan->state); | ||
321 | local_irq_restore(flags); | ||
322 | return 0; | ||
323 | } | ||
324 | |||
325 | chan->state = S3C2410_DMA_RUNNING; | ||
326 | |||
327 | /* check whether there is anything to load, and if not, see | ||
328 | * if we can find anything to load | ||
329 | */ | ||
330 | |||
331 | if (chan->load_state == S3C2410_DMALOAD_NONE) { | ||
332 | if (chan->next == NULL) { | ||
333 | printk(KERN_ERR "dma%d: channel has nothing loaded\n", | ||
334 | chan->number); | ||
335 | chan->state = S3C2410_DMA_IDLE; | ||
336 | local_irq_restore(flags); | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | |||
340 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
341 | } | ||
342 | |||
343 | dbg_showchan(chan); | ||
344 | |||
345 | /* enable the channel */ | ||
346 | |||
347 | if (!chan->irq_enabled) { | ||
348 | enable_irq(chan->irq); | ||
349 | chan->irq_enabled = 1; | ||
350 | } | ||
351 | |||
352 | /* start the channel going */ | ||
353 | |||
354 | tmp = dma_rdreg(chan, S3C2410_DMA_DMASKTRIG); | ||
355 | tmp &= ~S3C2410_DMASKTRIG_STOP; | ||
356 | tmp |= S3C2410_DMASKTRIG_ON; | ||
357 | dma_wrreg(chan, S3C2410_DMA_DMASKTRIG, tmp); | ||
358 | |||
359 | pr_debug("dma%d: %08lx to DMASKTRIG\n", chan->number, tmp); | ||
360 | |||
361 | #if 0 | ||
362 | /* the dma buffer loads should take care of clearing the AUTO | ||
363 | * reloading feature */ | ||
364 | tmp = dma_rdreg(chan, S3C2410_DMA_DCON); | ||
365 | tmp &= ~S3C2410_DCON_NORELOAD; | ||
366 | dma_wrreg(chan, S3C2410_DMA_DCON, tmp); | ||
367 | #endif | ||
368 | |||
369 | s3c2410_dma_call_op(chan, S3C2410_DMAOP_START); | ||
370 | |||
371 | dbg_showchan(chan); | ||
372 | |||
373 | /* if we've only loaded one buffer onto the channel, then chec | ||
374 | * to see if we have another, and if so, try and load it so when | ||
375 | * the first buffer is finished, the new one will be loaded onto | ||
376 | * the channel */ | ||
377 | |||
378 | if (chan->next != NULL) { | ||
379 | if (chan->load_state == S3C2410_DMALOAD_1LOADED) { | ||
380 | |||
381 | if (s3c2410_dma_waitforload(chan, __LINE__) == 0) { | ||
382 | pr_debug("%s: buff not yet loaded, no more todo\n", | ||
383 | __func__); | ||
384 | } else { | ||
385 | chan->load_state = S3C2410_DMALOAD_1RUNNING; | ||
386 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
387 | } | ||
388 | |||
389 | } else if (chan->load_state == S3C2410_DMALOAD_1RUNNING) { | ||
390 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | |||
395 | local_irq_restore(flags); | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | /* s3c2410_dma_canload | ||
401 | * | ||
402 | * work out if we can queue another buffer into the DMA engine | ||
403 | */ | ||
404 | |||
405 | static int | ||
406 | s3c2410_dma_canload(struct s3c2410_dma_chan *chan) | ||
407 | { | ||
408 | if (chan->load_state == S3C2410_DMALOAD_NONE || | ||
409 | chan->load_state == S3C2410_DMALOAD_1RUNNING) | ||
410 | return 1; | ||
411 | |||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | /* s3c2410_dma_enqueue | ||
416 | * | ||
417 | * queue an given buffer for dma transfer. | ||
418 | * | ||
419 | * id the device driver's id information for this buffer | ||
420 | * data the physical address of the buffer data | ||
421 | * size the size of the buffer in bytes | ||
422 | * | ||
423 | * If the channel is not running, then the flag S3C2410_DMAF_AUTOSTART | ||
424 | * is checked, and if set, the channel is started. If this flag isn't set, | ||
425 | * then an error will be returned. | ||
426 | * | ||
427 | * It is possible to queue more than one DMA buffer onto a channel at | ||
428 | * once, and the code will deal with the re-loading of the next buffer | ||
429 | * when necessary. | ||
430 | */ | ||
431 | |||
432 | int s3c2410_dma_enqueue(enum dma_ch channel, void *id, | ||
433 | dma_addr_t data, int size) | ||
434 | { | ||
435 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
436 | struct s3c2410_dma_buf *buf; | ||
437 | unsigned long flags; | ||
438 | |||
439 | if (chan == NULL) | ||
440 | return -EINVAL; | ||
441 | |||
442 | pr_debug("%s: id=%p, data=%08x, size=%d\n", | ||
443 | __func__, id, (unsigned int)data, size); | ||
444 | |||
445 | buf = kmem_cache_alloc(dma_kmem, GFP_ATOMIC); | ||
446 | if (buf == NULL) { | ||
447 | pr_debug("%s: out of memory (%ld alloc)\n", | ||
448 | __func__, (long)sizeof(*buf)); | ||
449 | return -ENOMEM; | ||
450 | } | ||
451 | |||
452 | //pr_debug("%s: new buffer %p\n", __func__, buf); | ||
453 | //dbg_showchan(chan); | ||
454 | |||
455 | buf->next = NULL; | ||
456 | buf->data = buf->ptr = data; | ||
457 | buf->size = size; | ||
458 | buf->id = id; | ||
459 | buf->magic = BUF_MAGIC; | ||
460 | |||
461 | local_irq_save(flags); | ||
462 | |||
463 | if (chan->curr == NULL) { | ||
464 | /* we've got nothing loaded... */ | ||
465 | pr_debug("%s: buffer %p queued onto empty channel\n", | ||
466 | __func__, buf); | ||
467 | |||
468 | chan->curr = buf; | ||
469 | chan->end = buf; | ||
470 | chan->next = NULL; | ||
471 | } else { | ||
472 | pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n", | ||
473 | chan->number, __func__, buf); | ||
474 | |||
475 | if (chan->end == NULL) { | ||
476 | pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n", | ||
477 | chan->number, __func__, chan); | ||
478 | } else { | ||
479 | chan->end->next = buf; | ||
480 | chan->end = buf; | ||
481 | } | ||
482 | } | ||
483 | |||
484 | /* if necessary, update the next buffer field */ | ||
485 | if (chan->next == NULL) | ||
486 | chan->next = buf; | ||
487 | |||
488 | /* check to see if we can load a buffer */ | ||
489 | if (chan->state == S3C2410_DMA_RUNNING) { | ||
490 | if (chan->load_state == S3C2410_DMALOAD_1LOADED && 1) { | ||
491 | if (s3c2410_dma_waitforload(chan, __LINE__) == 0) { | ||
492 | printk(KERN_ERR "dma%d: loadbuffer:" | ||
493 | "timeout loading buffer\n", | ||
494 | chan->number); | ||
495 | dbg_showchan(chan); | ||
496 | local_irq_restore(flags); | ||
497 | return -EINVAL; | ||
498 | } | ||
499 | } | ||
500 | |||
501 | while (s3c2410_dma_canload(chan) && chan->next != NULL) { | ||
502 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
503 | } | ||
504 | } else if (chan->state == S3C2410_DMA_IDLE) { | ||
505 | if (chan->flags & S3C2410_DMAF_AUTOSTART) { | ||
506 | s3c2410_dma_ctrl(chan->number | DMACH_LOW_LEVEL, | ||
507 | S3C2410_DMAOP_START); | ||
508 | } | ||
509 | } | ||
510 | |||
511 | local_irq_restore(flags); | ||
512 | return 0; | ||
513 | } | ||
514 | |||
515 | EXPORT_SYMBOL(s3c2410_dma_enqueue); | ||
516 | |||
517 | static inline void | ||
518 | s3c2410_dma_freebuf(struct s3c2410_dma_buf *buf) | ||
519 | { | ||
520 | int magicok = (buf->magic == BUF_MAGIC); | ||
521 | |||
522 | buf->magic = -1; | ||
523 | |||
524 | if (magicok) { | ||
525 | kmem_cache_free(dma_kmem, buf); | ||
526 | } else { | ||
527 | printk("s3c2410_dma_freebuf: buff %p with bad magic\n", buf); | ||
528 | } | ||
529 | } | ||
530 | |||
531 | /* s3c2410_dma_lastxfer | ||
532 | * | ||
533 | * called when the system is out of buffers, to ensure that the channel | ||
534 | * is prepared for shutdown. | ||
535 | */ | ||
536 | |||
537 | static inline void | ||
538 | s3c2410_dma_lastxfer(struct s3c2410_dma_chan *chan) | ||
539 | { | ||
540 | #if 0 | ||
541 | pr_debug("dma%d: s3c2410_dma_lastxfer: load_state %d\n", | ||
542 | chan->number, chan->load_state); | ||
543 | #endif | ||
544 | |||
545 | switch (chan->load_state) { | ||
546 | case S3C2410_DMALOAD_NONE: | ||
547 | break; | ||
548 | |||
549 | case S3C2410_DMALOAD_1LOADED: | ||
550 | if (s3c2410_dma_waitforload(chan, __LINE__) == 0) { | ||
551 | /* flag error? */ | ||
552 | printk(KERN_ERR "dma%d: timeout waiting for load (%s)\n", | ||
553 | chan->number, __func__); | ||
554 | return; | ||
555 | } | ||
556 | break; | ||
557 | |||
558 | case S3C2410_DMALOAD_1LOADED_1RUNNING: | ||
559 | /* I believe in this case we do not have anything to do | ||
560 | * until the next buffer comes along, and we turn off the | ||
561 | * reload */ | ||
562 | return; | ||
563 | |||
564 | default: | ||
565 | pr_debug("dma%d: lastxfer: unhandled load_state %d with no next\n", | ||
566 | chan->number, chan->load_state); | ||
567 | return; | ||
568 | |||
569 | } | ||
570 | |||
571 | /* hopefully this'll shut the damned thing up after the transfer... */ | ||
572 | dma_wrreg(chan, S3C2410_DMA_DCON, chan->dcon | S3C2410_DCON_NORELOAD); | ||
573 | } | ||
574 | |||
575 | |||
576 | #define dmadbg2(x...) | ||
577 | |||
578 | static irqreturn_t | ||
579 | s3c2410_dma_irq(int irq, void *devpw) | ||
580 | { | ||
581 | struct s3c2410_dma_chan *chan = (struct s3c2410_dma_chan *)devpw; | ||
582 | struct s3c2410_dma_buf *buf; | ||
583 | |||
584 | buf = chan->curr; | ||
585 | |||
586 | dbg_showchan(chan); | ||
587 | |||
588 | /* modify the channel state */ | ||
589 | |||
590 | switch (chan->load_state) { | ||
591 | case S3C2410_DMALOAD_1RUNNING: | ||
592 | /* TODO - if we are running only one buffer, we probably | ||
593 | * want to reload here, and then worry about the buffer | ||
594 | * callback */ | ||
595 | |||
596 | chan->load_state = S3C2410_DMALOAD_NONE; | ||
597 | break; | ||
598 | |||
599 | case S3C2410_DMALOAD_1LOADED: | ||
600 | /* iirc, we should go back to NONE loaded here, we | ||
601 | * had a buffer, and it was never verified as being | ||
602 | * loaded. | ||
603 | */ | ||
604 | |||
605 | chan->load_state = S3C2410_DMALOAD_NONE; | ||
606 | break; | ||
607 | |||
608 | case S3C2410_DMALOAD_1LOADED_1RUNNING: | ||
609 | /* we'll worry about checking to see if another buffer is | ||
610 | * ready after we've called back the owner. This should | ||
611 | * ensure we do not wait around too long for the DMA | ||
612 | * engine to start the next transfer | ||
613 | */ | ||
614 | |||
615 | chan->load_state = S3C2410_DMALOAD_1LOADED; | ||
616 | break; | ||
617 | |||
618 | case S3C2410_DMALOAD_NONE: | ||
619 | printk(KERN_ERR "dma%d: IRQ with no loaded buffer?\n", | ||
620 | chan->number); | ||
621 | break; | ||
622 | |||
623 | default: | ||
624 | printk(KERN_ERR "dma%d: IRQ in invalid load_state %d\n", | ||
625 | chan->number, chan->load_state); | ||
626 | break; | ||
627 | } | ||
628 | |||
629 | if (buf != NULL) { | ||
630 | /* update the chain to make sure that if we load any more | ||
631 | * buffers when we call the callback function, things should | ||
632 | * work properly */ | ||
633 | |||
634 | chan->curr = buf->next; | ||
635 | buf->next = NULL; | ||
636 | |||
637 | if (buf->magic != BUF_MAGIC) { | ||
638 | printk(KERN_ERR "dma%d: %s: buf %p incorrect magic\n", | ||
639 | chan->number, __func__, buf); | ||
640 | return IRQ_HANDLED; | ||
641 | } | ||
642 | |||
643 | s3c2410_dma_buffdone(chan, buf, S3C2410_RES_OK); | ||
644 | |||
645 | /* free resouces */ | ||
646 | s3c2410_dma_freebuf(buf); | ||
647 | } else { | ||
648 | } | ||
649 | |||
650 | /* only reload if the channel is still running... our buffer done | ||
651 | * routine may have altered the state by requesting the dma channel | ||
652 | * to stop or shutdown... */ | ||
653 | |||
654 | /* todo: check that when the channel is shut-down from inside this | ||
655 | * function, we cope with unsetting reload, etc */ | ||
656 | |||
657 | if (chan->next != NULL && chan->state != S3C2410_DMA_IDLE) { | ||
658 | unsigned long flags; | ||
659 | |||
660 | switch (chan->load_state) { | ||
661 | case S3C2410_DMALOAD_1RUNNING: | ||
662 | /* don't need to do anything for this state */ | ||
663 | break; | ||
664 | |||
665 | case S3C2410_DMALOAD_NONE: | ||
666 | /* can load buffer immediately */ | ||
667 | break; | ||
668 | |||
669 | case S3C2410_DMALOAD_1LOADED: | ||
670 | if (s3c2410_dma_waitforload(chan, __LINE__) == 0) { | ||
671 | /* flag error? */ | ||
672 | printk(KERN_ERR "dma%d: timeout waiting for load (%s)\n", | ||
673 | chan->number, __func__); | ||
674 | return IRQ_HANDLED; | ||
675 | } | ||
676 | |||
677 | break; | ||
678 | |||
679 | case S3C2410_DMALOAD_1LOADED_1RUNNING: | ||
680 | goto no_load; | ||
681 | |||
682 | default: | ||
683 | printk(KERN_ERR "dma%d: unknown load_state in irq, %d\n", | ||
684 | chan->number, chan->load_state); | ||
685 | return IRQ_HANDLED; | ||
686 | } | ||
687 | |||
688 | local_irq_save(flags); | ||
689 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
690 | local_irq_restore(flags); | ||
691 | } else { | ||
692 | s3c2410_dma_lastxfer(chan); | ||
693 | |||
694 | /* see if we can stop this channel.. */ | ||
695 | if (chan->load_state == S3C2410_DMALOAD_NONE) { | ||
696 | pr_debug("dma%d: end of transfer, stopping channel (%ld)\n", | ||
697 | chan->number, jiffies); | ||
698 | s3c2410_dma_ctrl(chan->number | DMACH_LOW_LEVEL, | ||
699 | S3C2410_DMAOP_STOP); | ||
700 | } | ||
701 | } | ||
702 | |||
703 | no_load: | ||
704 | return IRQ_HANDLED; | ||
705 | } | ||
706 | |||
707 | static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel); | ||
708 | |||
709 | /* s3c2410_request_dma | ||
710 | * | ||
711 | * get control of an dma channel | ||
712 | */ | ||
713 | |||
714 | int s3c2410_dma_request(enum dma_ch channel, | ||
715 | struct s3c2410_dma_client *client, | ||
716 | void *dev) | ||
717 | { | ||
718 | struct s3c2410_dma_chan *chan; | ||
719 | unsigned long flags; | ||
720 | int err; | ||
721 | |||
722 | pr_debug("dma%d: s3c2410_request_dma: client=%s, dev=%p\n", | ||
723 | channel, client->name, dev); | ||
724 | |||
725 | local_irq_save(flags); | ||
726 | |||
727 | chan = s3c2410_dma_map_channel(channel); | ||
728 | if (chan == NULL) { | ||
729 | local_irq_restore(flags); | ||
730 | return -EBUSY; | ||
731 | } | ||
732 | |||
733 | dbg_showchan(chan); | ||
734 | |||
735 | chan->client = client; | ||
736 | chan->in_use = 1; | ||
737 | |||
738 | if (!chan->irq_claimed) { | ||
739 | pr_debug("dma%d: %s : requesting irq %d\n", | ||
740 | channel, __func__, chan->irq); | ||
741 | |||
742 | chan->irq_claimed = 1; | ||
743 | local_irq_restore(flags); | ||
744 | |||
745 | err = request_irq(chan->irq, s3c2410_dma_irq, IRQF_DISABLED, | ||
746 | client->name, (void *)chan); | ||
747 | |||
748 | local_irq_save(flags); | ||
749 | |||
750 | if (err) { | ||
751 | chan->in_use = 0; | ||
752 | chan->irq_claimed = 0; | ||
753 | local_irq_restore(flags); | ||
754 | |||
755 | printk(KERN_ERR "%s: cannot get IRQ %d for DMA %d\n", | ||
756 | client->name, chan->irq, chan->number); | ||
757 | return err; | ||
758 | } | ||
759 | |||
760 | chan->irq_enabled = 1; | ||
761 | } | ||
762 | |||
763 | local_irq_restore(flags); | ||
764 | |||
765 | /* need to setup */ | ||
766 | |||
767 | pr_debug("%s: channel initialised, %p\n", __func__, chan); | ||
768 | |||
769 | return chan->number | DMACH_LOW_LEVEL; | ||
770 | } | ||
771 | |||
772 | EXPORT_SYMBOL(s3c2410_dma_request); | ||
773 | |||
774 | /* s3c2410_dma_free | ||
775 | * | ||
776 | * release the given channel back to the system, will stop and flush | ||
777 | * any outstanding transfers, and ensure the channel is ready for the | ||
778 | * next claimant. | ||
779 | * | ||
780 | * Note, although a warning is currently printed if the freeing client | ||
781 | * info is not the same as the registrant's client info, the free is still | ||
782 | * allowed to go through. | ||
783 | */ | ||
784 | |||
785 | int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client) | ||
786 | { | ||
787 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
788 | unsigned long flags; | ||
789 | |||
790 | if (chan == NULL) | ||
791 | return -EINVAL; | ||
792 | |||
793 | local_irq_save(flags); | ||
794 | |||
795 | if (chan->client != client) { | ||
796 | printk(KERN_WARNING "dma%d: possible free from different client (channel %p, passed %p)\n", | ||
797 | channel, chan->client, client); | ||
798 | } | ||
799 | |||
800 | /* sort out stopping and freeing the channel */ | ||
801 | |||
802 | if (chan->state != S3C2410_DMA_IDLE) { | ||
803 | pr_debug("%s: need to stop dma channel %p\n", | ||
804 | __func__, chan); | ||
805 | |||
806 | /* possibly flush the channel */ | ||
807 | s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STOP); | ||
808 | } | ||
809 | |||
810 | chan->client = NULL; | ||
811 | chan->in_use = 0; | ||
812 | |||
813 | if (chan->irq_claimed) | ||
814 | free_irq(chan->irq, (void *)chan); | ||
815 | |||
816 | chan->irq_claimed = 0; | ||
817 | |||
818 | if (!(channel & DMACH_LOW_LEVEL)) | ||
819 | s3c_dma_chan_map[channel] = NULL; | ||
820 | |||
821 | local_irq_restore(flags); | ||
822 | |||
823 | return 0; | ||
824 | } | ||
825 | |||
826 | EXPORT_SYMBOL(s3c2410_dma_free); | ||
827 | |||
828 | static int s3c2410_dma_dostop(struct s3c2410_dma_chan *chan) | ||
829 | { | ||
830 | unsigned long flags; | ||
831 | unsigned long tmp; | ||
832 | |||
833 | pr_debug("%s:\n", __func__); | ||
834 | |||
835 | dbg_showchan(chan); | ||
836 | |||
837 | local_irq_save(flags); | ||
838 | |||
839 | s3c2410_dma_call_op(chan, S3C2410_DMAOP_STOP); | ||
840 | |||
841 | tmp = dma_rdreg(chan, S3C2410_DMA_DMASKTRIG); | ||
842 | tmp |= S3C2410_DMASKTRIG_STOP; | ||
843 | //tmp &= ~S3C2410_DMASKTRIG_ON; | ||
844 | dma_wrreg(chan, S3C2410_DMA_DMASKTRIG, tmp); | ||
845 | |||
846 | #if 0 | ||
847 | /* should also clear interrupts, according to WinCE BSP */ | ||
848 | tmp = dma_rdreg(chan, S3C2410_DMA_DCON); | ||
849 | tmp |= S3C2410_DCON_NORELOAD; | ||
850 | dma_wrreg(chan, S3C2410_DMA_DCON, tmp); | ||
851 | #endif | ||
852 | |||
853 | /* should stop do this, or should we wait for flush? */ | ||
854 | chan->state = S3C2410_DMA_IDLE; | ||
855 | chan->load_state = S3C2410_DMALOAD_NONE; | ||
856 | |||
857 | local_irq_restore(flags); | ||
858 | |||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | static void s3c2410_dma_waitforstop(struct s3c2410_dma_chan *chan) | ||
863 | { | ||
864 | unsigned long tmp; | ||
865 | unsigned int timeout = 0x10000; | ||
866 | |||
867 | while (timeout-- > 0) { | ||
868 | tmp = dma_rdreg(chan, S3C2410_DMA_DMASKTRIG); | ||
869 | |||
870 | if (!(tmp & S3C2410_DMASKTRIG_ON)) | ||
871 | return; | ||
872 | } | ||
873 | |||
874 | pr_debug("dma%d: failed to stop?\n", chan->number); | ||
875 | } | ||
876 | |||
877 | |||
878 | /* s3c2410_dma_flush | ||
879 | * | ||
880 | * stop the channel, and remove all current and pending transfers | ||
881 | */ | ||
882 | |||
883 | static int s3c2410_dma_flush(struct s3c2410_dma_chan *chan) | ||
884 | { | ||
885 | struct s3c2410_dma_buf *buf, *next; | ||
886 | unsigned long flags; | ||
887 | |||
888 | pr_debug("%s: chan %p (%d)\n", __func__, chan, chan->number); | ||
889 | |||
890 | dbg_showchan(chan); | ||
891 | |||
892 | local_irq_save(flags); | ||
893 | |||
894 | if (chan->state != S3C2410_DMA_IDLE) { | ||
895 | pr_debug("%s: stopping channel...\n", __func__ ); | ||
896 | s3c2410_dma_ctrl(chan->number, S3C2410_DMAOP_STOP); | ||
897 | } | ||
898 | |||
899 | buf = chan->curr; | ||
900 | if (buf == NULL) | ||
901 | buf = chan->next; | ||
902 | |||
903 | chan->curr = chan->next = chan->end = NULL; | ||
904 | |||
905 | if (buf != NULL) { | ||
906 | for ( ; buf != NULL; buf = next) { | ||
907 | next = buf->next; | ||
908 | |||
909 | pr_debug("%s: free buffer %p, next %p\n", | ||
910 | __func__, buf, buf->next); | ||
911 | |||
912 | s3c2410_dma_buffdone(chan, buf, S3C2410_RES_ABORT); | ||
913 | s3c2410_dma_freebuf(buf); | ||
914 | } | ||
915 | } | ||
916 | |||
917 | dbg_showregs(chan); | ||
918 | |||
919 | s3c2410_dma_waitforstop(chan); | ||
920 | |||
921 | #if 0 | ||
922 | /* should also clear interrupts, according to WinCE BSP */ | ||
923 | { | ||
924 | unsigned long tmp; | ||
925 | |||
926 | tmp = dma_rdreg(chan, S3C2410_DMA_DCON); | ||
927 | tmp |= S3C2410_DCON_NORELOAD; | ||
928 | dma_wrreg(chan, S3C2410_DMA_DCON, tmp); | ||
929 | } | ||
930 | #endif | ||
931 | |||
932 | dbg_showregs(chan); | ||
933 | |||
934 | local_irq_restore(flags); | ||
935 | |||
936 | return 0; | ||
937 | } | ||
938 | |||
939 | static int s3c2410_dma_started(struct s3c2410_dma_chan *chan) | ||
940 | { | ||
941 | unsigned long flags; | ||
942 | |||
943 | local_irq_save(flags); | ||
944 | |||
945 | dbg_showchan(chan); | ||
946 | |||
947 | /* if we've only loaded one buffer onto the channel, then chec | ||
948 | * to see if we have another, and if so, try and load it so when | ||
949 | * the first buffer is finished, the new one will be loaded onto | ||
950 | * the channel */ | ||
951 | |||
952 | if (chan->next != NULL) { | ||
953 | if (chan->load_state == S3C2410_DMALOAD_1LOADED) { | ||
954 | |||
955 | if (s3c2410_dma_waitforload(chan, __LINE__) == 0) { | ||
956 | pr_debug("%s: buff not yet loaded, no more todo\n", | ||
957 | __func__); | ||
958 | } else { | ||
959 | chan->load_state = S3C2410_DMALOAD_1RUNNING; | ||
960 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
961 | } | ||
962 | |||
963 | } else if (chan->load_state == S3C2410_DMALOAD_1RUNNING) { | ||
964 | s3c2410_dma_loadbuffer(chan, chan->next); | ||
965 | } | ||
966 | } | ||
967 | |||
968 | |||
969 | local_irq_restore(flags); | ||
970 | |||
971 | return 0; | ||
972 | |||
973 | } | ||
974 | |||
975 | int | ||
976 | s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op) | ||
977 | { | ||
978 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
979 | |||
980 | if (chan == NULL) | ||
981 | return -EINVAL; | ||
982 | |||
983 | switch (op) { | ||
984 | case S3C2410_DMAOP_START: | ||
985 | return s3c2410_dma_start(chan); | ||
986 | |||
987 | case S3C2410_DMAOP_STOP: | ||
988 | return s3c2410_dma_dostop(chan); | ||
989 | |||
990 | case S3C2410_DMAOP_PAUSE: | ||
991 | case S3C2410_DMAOP_RESUME: | ||
992 | return -ENOENT; | ||
993 | |||
994 | case S3C2410_DMAOP_FLUSH: | ||
995 | return s3c2410_dma_flush(chan); | ||
996 | |||
997 | case S3C2410_DMAOP_STARTED: | ||
998 | return s3c2410_dma_started(chan); | ||
999 | |||
1000 | case S3C2410_DMAOP_TIMEOUT: | ||
1001 | return 0; | ||
1002 | |||
1003 | } | ||
1004 | |||
1005 | return -ENOENT; /* unknown, don't bother */ | ||
1006 | } | ||
1007 | |||
1008 | EXPORT_SYMBOL(s3c2410_dma_ctrl); | ||
1009 | |||
1010 | /* DMA configuration for each channel | ||
1011 | * | ||
1012 | * DISRCC -> source of the DMA (AHB,APB) | ||
1013 | * DISRC -> source address of the DMA | ||
1014 | * DIDSTC -> destination of the DMA (AHB,APD) | ||
1015 | * DIDST -> destination address of the DMA | ||
1016 | */ | ||
1017 | |||
1018 | /* s3c2410_dma_config | ||
1019 | * | ||
1020 | * xfersize: size of unit in bytes (1,2,4) | ||
1021 | */ | ||
1022 | |||
1023 | int s3c2410_dma_config(enum dma_ch channel, | ||
1024 | int xferunit) | ||
1025 | { | ||
1026 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
1027 | unsigned int dcon; | ||
1028 | |||
1029 | pr_debug("%s: chan=%d, xfer_unit=%d\n", __func__, channel, xferunit); | ||
1030 | |||
1031 | if (chan == NULL) | ||
1032 | return -EINVAL; | ||
1033 | |||
1034 | dcon = chan->dcon & dma_sel.dcon_mask; | ||
1035 | pr_debug("%s: dcon is %08x\n", __func__, dcon); | ||
1036 | |||
1037 | switch (chan->req_ch) { | ||
1038 | case DMACH_I2S_IN: | ||
1039 | case DMACH_I2S_OUT: | ||
1040 | case DMACH_PCM_IN: | ||
1041 | case DMACH_PCM_OUT: | ||
1042 | case DMACH_MIC_IN: | ||
1043 | default: | ||
1044 | dcon |= S3C2410_DCON_HANDSHAKE; | ||
1045 | dcon |= S3C2410_DCON_SYNC_PCLK; | ||
1046 | break; | ||
1047 | |||
1048 | case DMACH_SDI: | ||
1049 | /* note, ensure if need HANDSHAKE or not */ | ||
1050 | dcon |= S3C2410_DCON_SYNC_PCLK; | ||
1051 | break; | ||
1052 | |||
1053 | case DMACH_XD0: | ||
1054 | case DMACH_XD1: | ||
1055 | dcon |= S3C2410_DCON_HANDSHAKE; | ||
1056 | dcon |= S3C2410_DCON_SYNC_HCLK; | ||
1057 | break; | ||
1058 | } | ||
1059 | |||
1060 | switch (xferunit) { | ||
1061 | case 1: | ||
1062 | dcon |= S3C2410_DCON_BYTE; | ||
1063 | break; | ||
1064 | |||
1065 | case 2: | ||
1066 | dcon |= S3C2410_DCON_HALFWORD; | ||
1067 | break; | ||
1068 | |||
1069 | case 4: | ||
1070 | dcon |= S3C2410_DCON_WORD; | ||
1071 | break; | ||
1072 | |||
1073 | default: | ||
1074 | pr_debug("%s: bad transfer size %d\n", __func__, xferunit); | ||
1075 | return -EINVAL; | ||
1076 | } | ||
1077 | |||
1078 | dcon |= S3C2410_DCON_HWTRIG; | ||
1079 | dcon |= S3C2410_DCON_INTREQ; | ||
1080 | |||
1081 | pr_debug("%s: dcon now %08x\n", __func__, dcon); | ||
1082 | |||
1083 | chan->dcon = dcon; | ||
1084 | chan->xfer_unit = xferunit; | ||
1085 | |||
1086 | return 0; | ||
1087 | } | ||
1088 | |||
1089 | EXPORT_SYMBOL(s3c2410_dma_config); | ||
1090 | |||
1091 | |||
1092 | /* s3c2410_dma_devconfig | ||
1093 | * | ||
1094 | * configure the dma source/destination hardware type and address | ||
1095 | * | ||
1096 | * source: DMA_FROM_DEVICE: source is hardware | ||
1097 | * DMA_TO_DEVICE: source is memory | ||
1098 | * | ||
1099 | * devaddr: physical address of the source | ||
1100 | */ | ||
1101 | |||
1102 | int s3c2410_dma_devconfig(enum dma_ch channel, | ||
1103 | enum dma_data_direction source, | ||
1104 | unsigned long devaddr) | ||
1105 | { | ||
1106 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
1107 | unsigned int hwcfg; | ||
1108 | |||
1109 | if (chan == NULL) | ||
1110 | return -EINVAL; | ||
1111 | |||
1112 | pr_debug("%s: source=%d, devaddr=%08lx\n", | ||
1113 | __func__, (int)source, devaddr); | ||
1114 | |||
1115 | chan->source = source; | ||
1116 | chan->dev_addr = devaddr; | ||
1117 | |||
1118 | switch (chan->req_ch) { | ||
1119 | case DMACH_XD0: | ||
1120 | case DMACH_XD1: | ||
1121 | hwcfg = 0; /* AHB */ | ||
1122 | break; | ||
1123 | |||
1124 | default: | ||
1125 | hwcfg = S3C2410_DISRCC_APB; | ||
1126 | } | ||
1127 | |||
1128 | /* always assume our peripheral desintation is a fixed | ||
1129 | * address in memory. */ | ||
1130 | hwcfg |= S3C2410_DISRCC_INC; | ||
1131 | |||
1132 | switch (source) { | ||
1133 | case DMA_FROM_DEVICE: | ||
1134 | /* source is hardware */ | ||
1135 | pr_debug("%s: hw source, devaddr=%08lx, hwcfg=%d\n", | ||
1136 | __func__, devaddr, hwcfg); | ||
1137 | dma_wrreg(chan, S3C2410_DMA_DISRCC, hwcfg & 3); | ||
1138 | dma_wrreg(chan, S3C2410_DMA_DISRC, devaddr); | ||
1139 | dma_wrreg(chan, S3C2410_DMA_DIDSTC, (0<<1) | (0<<0)); | ||
1140 | |||
1141 | chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DIDST); | ||
1142 | break; | ||
1143 | |||
1144 | case DMA_TO_DEVICE: | ||
1145 | /* source is memory */ | ||
1146 | pr_debug("%s: mem source, devaddr=%08lx, hwcfg=%d\n", | ||
1147 | __func__, devaddr, hwcfg); | ||
1148 | dma_wrreg(chan, S3C2410_DMA_DISRCC, (0<<1) | (0<<0)); | ||
1149 | dma_wrreg(chan, S3C2410_DMA_DIDST, devaddr); | ||
1150 | dma_wrreg(chan, S3C2410_DMA_DIDSTC, hwcfg & 3); | ||
1151 | |||
1152 | chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DISRC); | ||
1153 | break; | ||
1154 | |||
1155 | default: | ||
1156 | printk(KERN_ERR "dma%d: invalid source type (%d)\n", | ||
1157 | channel, source); | ||
1158 | |||
1159 | return -EINVAL; | ||
1160 | } | ||
1161 | |||
1162 | if (dma_sel.direction != NULL) | ||
1163 | (dma_sel.direction)(chan, chan->map, source); | ||
1164 | |||
1165 | return 0; | ||
1166 | } | ||
1167 | |||
1168 | EXPORT_SYMBOL(s3c2410_dma_devconfig); | ||
1169 | |||
1170 | /* s3c2410_dma_getposition | ||
1171 | * | ||
1172 | * returns the current transfer points for the dma source and destination | ||
1173 | */ | ||
1174 | |||
1175 | int s3c2410_dma_getposition(enum dma_ch channel, dma_addr_t *src, dma_addr_t *dst) | ||
1176 | { | ||
1177 | struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
1178 | |||
1179 | if (chan == NULL) | ||
1180 | return -EINVAL; | ||
1181 | |||
1182 | if (src != NULL) | ||
1183 | *src = dma_rdreg(chan, S3C2410_DMA_DCSRC); | ||
1184 | |||
1185 | if (dst != NULL) | ||
1186 | *dst = dma_rdreg(chan, S3C2410_DMA_DCDST); | ||
1187 | |||
1188 | return 0; | ||
1189 | } | ||
1190 | |||
1191 | EXPORT_SYMBOL(s3c2410_dma_getposition); | ||
1192 | |||
1193 | /* system core operations */ | ||
1194 | |||
1195 | #ifdef CONFIG_PM | ||
1196 | |||
1197 | static void s3c2410_dma_suspend_chan(struct s3c2410_dma_chan *cp) | ||
1198 | { | ||
1199 | printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); | ||
1200 | |||
1201 | if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) { | ||
1202 | /* the dma channel is still working, which is probably | ||
1203 | * a bad thing to do over suspend/resume. We stop the | ||
1204 | * channel and assume that the client is either going to | ||
1205 | * retry after resume, or that it is broken. | ||
1206 | */ | ||
1207 | |||
1208 | printk(KERN_INFO "dma: stopping channel %d due to suspend\n", | ||
1209 | cp->number); | ||
1210 | |||
1211 | s3c2410_dma_dostop(cp); | ||
1212 | } | ||
1213 | } | ||
1214 | |||
1215 | static int s3c2410_dma_suspend(void) | ||
1216 | { | ||
1217 | struct s3c2410_dma_chan *cp = s3c2410_chans; | ||
1218 | int channel; | ||
1219 | |||
1220 | for (channel = 0; channel < dma_channels; cp++, channel++) | ||
1221 | s3c2410_dma_suspend_chan(cp); | ||
1222 | |||
1223 | return 0; | ||
1224 | } | ||
1225 | |||
1226 | static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp) | ||
1227 | { | ||
1228 | unsigned int no = cp->number | DMACH_LOW_LEVEL; | ||
1229 | |||
1230 | /* restore channel's hardware configuration */ | ||
1231 | |||
1232 | if (!cp->in_use) | ||
1233 | return; | ||
1234 | |||
1235 | printk(KERN_INFO "dma%d: restoring configuration\n", cp->number); | ||
1236 | |||
1237 | s3c2410_dma_config(no, cp->xfer_unit); | ||
1238 | s3c2410_dma_devconfig(no, cp->source, cp->dev_addr); | ||
1239 | |||
1240 | /* re-select the dma source for this channel */ | ||
1241 | |||
1242 | if (cp->map != NULL) | ||
1243 | dma_sel.select(cp, cp->map); | ||
1244 | } | ||
1245 | |||
1246 | static void s3c2410_dma_resume(void) | ||
1247 | { | ||
1248 | struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels - 1; | ||
1249 | int channel; | ||
1250 | |||
1251 | for (channel = dma_channels - 1; channel >= 0; cp--, channel--) | ||
1252 | s3c2410_dma_resume_chan(cp); | ||
1253 | } | ||
1254 | |||
1255 | #else | ||
1256 | #define s3c2410_dma_suspend NULL | ||
1257 | #define s3c2410_dma_resume NULL | ||
1258 | #endif /* CONFIG_PM */ | ||
1259 | |||
1260 | struct syscore_ops dma_syscore_ops = { | ||
1261 | .suspend = s3c2410_dma_suspend, | ||
1262 | .resume = s3c2410_dma_resume, | ||
1263 | }; | ||
1264 | |||
1265 | /* kmem cache implementation */ | ||
1266 | |||
1267 | static void s3c2410_dma_cache_ctor(void *p) | ||
1268 | { | ||
1269 | memset(p, 0, sizeof(struct s3c2410_dma_buf)); | ||
1270 | } | ||
1271 | |||
1272 | /* initialisation code */ | ||
1273 | |||
1274 | static int __init s3c24xx_dma_syscore_init(void) | ||
1275 | { | ||
1276 | register_syscore_ops(&dma_syscore_ops); | ||
1277 | |||
1278 | return 0; | ||
1279 | } | ||
1280 | |||
1281 | late_initcall(s3c24xx_dma_syscore_init); | ||
1282 | |||
1283 | int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq, | ||
1284 | unsigned int stride) | ||
1285 | { | ||
1286 | struct s3c2410_dma_chan *cp; | ||
1287 | int channel; | ||
1288 | int ret; | ||
1289 | |||
1290 | printk("S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics\n"); | ||
1291 | |||
1292 | dma_channels = channels; | ||
1293 | |||
1294 | dma_base = ioremap(S3C24XX_PA_DMA, stride * channels); | ||
1295 | if (dma_base == NULL) { | ||
1296 | printk(KERN_ERR "dma failed to remap register block\n"); | ||
1297 | return -ENOMEM; | ||
1298 | } | ||
1299 | |||
1300 | dma_kmem = kmem_cache_create("dma_desc", | ||
1301 | sizeof(struct s3c2410_dma_buf), 0, | ||
1302 | SLAB_HWCACHE_ALIGN, | ||
1303 | s3c2410_dma_cache_ctor); | ||
1304 | |||
1305 | if (dma_kmem == NULL) { | ||
1306 | printk(KERN_ERR "dma failed to make kmem cache\n"); | ||
1307 | ret = -ENOMEM; | ||
1308 | goto err; | ||
1309 | } | ||
1310 | |||
1311 | for (channel = 0; channel < channels; channel++) { | ||
1312 | cp = &s3c2410_chans[channel]; | ||
1313 | |||
1314 | memset(cp, 0, sizeof(struct s3c2410_dma_chan)); | ||
1315 | |||
1316 | /* dma channel irqs are in order.. */ | ||
1317 | cp->number = channel; | ||
1318 | cp->irq = channel + irq; | ||
1319 | cp->regs = dma_base + (channel * stride); | ||
1320 | |||
1321 | /* point current stats somewhere */ | ||
1322 | cp->stats = &cp->stats_store; | ||
1323 | cp->stats_store.timeout_shortest = LONG_MAX; | ||
1324 | |||
1325 | /* basic channel configuration */ | ||
1326 | |||
1327 | cp->load_timeout = 1<<18; | ||
1328 | |||
1329 | printk("DMA channel %d at %p, irq %d\n", | ||
1330 | cp->number, cp->regs, cp->irq); | ||
1331 | } | ||
1332 | |||
1333 | return 0; | ||
1334 | |||
1335 | err: | ||
1336 | kmem_cache_destroy(dma_kmem); | ||
1337 | iounmap(dma_base); | ||
1338 | dma_base = NULL; | ||
1339 | return ret; | ||
1340 | } | ||
1341 | |||
1342 | int __init s3c2410_dma_init(void) | ||
1343 | { | ||
1344 | return s3c24xx_dma_init(4, IRQ_DMA0, 0x40); | ||
1345 | } | ||
1346 | |||
1347 | static inline int is_channel_valid(unsigned int channel) | ||
1348 | { | ||
1349 | return (channel & DMA_CH_VALID); | ||
1350 | } | ||
1351 | |||
1352 | static struct s3c24xx_dma_order *dma_order; | ||
1353 | |||
1354 | |||
1355 | /* s3c2410_dma_map_channel() | ||
1356 | * | ||
1357 | * turn the virtual channel number into a real, and un-used hardware | ||
1358 | * channel. | ||
1359 | * | ||
1360 | * first, try the dma ordering given to us by either the relevant | ||
1361 | * dma code, or the board. Then just find the first usable free | ||
1362 | * channel | ||
1363 | */ | ||
1364 | |||
1365 | static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel) | ||
1366 | { | ||
1367 | struct s3c24xx_dma_order_ch *ord = NULL; | ||
1368 | struct s3c24xx_dma_map *ch_map; | ||
1369 | struct s3c2410_dma_chan *dmach; | ||
1370 | int ch; | ||
1371 | |||
1372 | if (dma_sel.map == NULL || channel > dma_sel.map_size) | ||
1373 | return NULL; | ||
1374 | |||
1375 | ch_map = dma_sel.map + channel; | ||
1376 | |||
1377 | /* first, try the board mapping */ | ||
1378 | |||
1379 | if (dma_order) { | ||
1380 | ord = &dma_order->channels[channel]; | ||
1381 | |||
1382 | for (ch = 0; ch < dma_channels; ch++) { | ||
1383 | int tmp; | ||
1384 | if (!is_channel_valid(ord->list[ch])) | ||
1385 | continue; | ||
1386 | |||
1387 | tmp = ord->list[ch] & ~DMA_CH_VALID; | ||
1388 | if (s3c2410_chans[tmp].in_use == 0) { | ||
1389 | ch = tmp; | ||
1390 | goto found; | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1394 | if (ord->flags & DMA_CH_NEVER) | ||
1395 | return NULL; | ||
1396 | } | ||
1397 | |||
1398 | /* second, search the channel map for first free */ | ||
1399 | |||
1400 | for (ch = 0; ch < dma_channels; ch++) { | ||
1401 | if (!is_channel_valid(ch_map->channels[ch])) | ||
1402 | continue; | ||
1403 | |||
1404 | if (s3c2410_chans[ch].in_use == 0) { | ||
1405 | printk("mapped channel %d to %d\n", channel, ch); | ||
1406 | break; | ||
1407 | } | ||
1408 | } | ||
1409 | |||
1410 | if (ch >= dma_channels) | ||
1411 | return NULL; | ||
1412 | |||
1413 | /* update our channel mapping */ | ||
1414 | |||
1415 | found: | ||
1416 | dmach = &s3c2410_chans[ch]; | ||
1417 | dmach->map = ch_map; | ||
1418 | dmach->req_ch = channel; | ||
1419 | s3c_dma_chan_map[channel] = dmach; | ||
1420 | |||
1421 | /* select the channel */ | ||
1422 | |||
1423 | (dma_sel.select)(dmach, ch_map); | ||
1424 | |||
1425 | return dmach; | ||
1426 | } | ||
1427 | |||
1428 | static int s3c24xx_dma_check_entry(struct s3c24xx_dma_map *map, int ch) | ||
1429 | { | ||
1430 | return 0; | ||
1431 | } | ||
1432 | |||
1433 | int __init s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel) | ||
1434 | { | ||
1435 | struct s3c24xx_dma_map *nmap; | ||
1436 | size_t map_sz = sizeof(*nmap) * sel->map_size; | ||
1437 | int ptr; | ||
1438 | |||
1439 | nmap = kmemdup(sel->map, map_sz, GFP_KERNEL); | ||
1440 | if (nmap == NULL) | ||
1441 | return -ENOMEM; | ||
1442 | |||
1443 | memcpy(&dma_sel, sel, sizeof(*sel)); | ||
1444 | |||
1445 | dma_sel.map = nmap; | ||
1446 | |||
1447 | for (ptr = 0; ptr < sel->map_size; ptr++) | ||
1448 | s3c24xx_dma_check_entry(nmap+ptr, ptr); | ||
1449 | |||
1450 | return 0; | ||
1451 | } | ||
1452 | |||
1453 | int __init s3c24xx_dma_order_set(struct s3c24xx_dma_order *ord) | ||
1454 | { | ||
1455 | struct s3c24xx_dma_order *nord = dma_order; | ||
1456 | |||
1457 | if (nord == NULL) | ||
1458 | nord = kmalloc(sizeof(struct s3c24xx_dma_order), GFP_KERNEL); | ||
1459 | |||
1460 | if (nord == NULL) { | ||
1461 | printk(KERN_ERR "no memory to store dma channel order\n"); | ||
1462 | return -ENOMEM; | ||
1463 | } | ||
1464 | |||
1465 | dma_order = nord; | ||
1466 | memcpy(nord, ord, sizeof(struct s3c24xx_dma_order)); | ||
1467 | return 0; | ||
1468 | } | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gta02.h b/arch/arm/mach-s3c24xx/gta02.h index 217393482153..9430a71e9184 100644 --- a/arch/arm/mach-s3c24xx/include/mach/gta02.h +++ b/arch/arm/mach-s3c24xx/gta02.h | |||
@@ -1,5 +1,13 @@ | |||
1 | #ifndef _GTA02_H | 1 | /* |
2 | #define _GTA02_H | 2 | * GTA02 header |
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __MACH_S3C24XX_GTA02_H | ||
10 | #define __MACH_S3C24XX_GTA02_H __FILE__ | ||
3 | 11 | ||
4 | #include <mach/regs-gpio.h> | 12 | #include <mach/regs-gpio.h> |
5 | 13 | ||
@@ -12,4 +20,4 @@ | |||
12 | 20 | ||
13 | #define GTA02_IRQ_PCF50633 IRQ_EINT9 | 21 | #define GTA02_IRQ_PCF50633 IRQ_EINT9 |
14 | 22 | ||
15 | #endif /* _GTA02_H */ | 23 | #endif /* __MACH_S3C24XX_GTA02_H */ |
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c index 3f40c61b6e02..5b98bfd1df43 100644 --- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c +++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/rfkill.h> | 20 | #include <linux/rfkill.h> |
21 | 21 | ||
22 | #include <mach/regs-gpio.h> | ||
23 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
24 | #include <mach/h1940-latch.h> | 23 | #include <mach/regs-gpio.h> |
25 | #include <mach/h1940.h> | 24 | |
25 | #include "h1940.h" | ||
26 | 26 | ||
27 | #define DRV_NAME "h1940-bt" | 27 | #define DRV_NAME "h1940-bt" |
28 | 28 | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h b/arch/arm/mach-s3c24xx/h1940.h index fc897d3a056c..2950cc466840 100644 --- a/arch/arm/mach-s3c24xx/include/mach/h1940-latch.h +++ b/arch/arm/mach-s3c24xx/h1940.h | |||
@@ -1,20 +1,30 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/h1940-latch.h | 1 | /* |
2 | * Copyright 2006 Ben Dooks <ben-linux@fluff.org> | ||
2 | * | 3 | * |
3 | * Copyright (c) 2005 Simtec Electronics | 4 | * Copyright (c) 2005 Simtec Electronics |
4 | * http://armlinux.simtec.co.uk/ | 5 | * http://armlinux.simtec.co.uk/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 6 | * Ben Dooks <ben@simtec.co.uk> |
6 | * | 7 | * |
7 | * iPAQ H1940 series - latch definitions | 8 | * iPAQ H1940 series definitions |
8 | * | 9 | * |
9 | * This program is free software; you can redistribute it and/or modify | 10 | * 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 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
12 | */ | 13 | */ |
13 | 14 | ||
14 | #ifndef __ASM_ARCH_H1940_LATCH_H | 15 | #ifndef __MACH_S3C24XX_H1940_H |
15 | #define __ASM_ARCH_H1940_LATCH_H | 16 | #define __MACH_S3C24XX_H1940_H __FILE__ |
16 | 17 | ||
17 | #include <asm/gpio.h> | 18 | #define H1940_SUSPEND_CHECKSUM (0x30003ff8) |
19 | #define H1940_SUSPEND_RESUMEAT (0x30081000) | ||
20 | #define H1940_SUSPEND_CHECK (0x30080000) | ||
21 | |||
22 | extern void h1940_pm_return(void); | ||
23 | extern int h1940_led_blink_set(unsigned gpio, int state, | ||
24 | unsigned long *delay_on, | ||
25 | unsigned long *delay_off); | ||
26 | |||
27 | #include <linux/gpio.h> | ||
18 | 28 | ||
19 | #define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x)) | 29 | #define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x)) |
20 | 30 | ||
@@ -40,4 +50,4 @@ | |||
40 | #define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14) | 50 | #define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14) |
41 | #define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15) | 51 | #define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15) |
42 | 52 | ||
43 | #endif /* __ASM_ARCH_H1940_LATCH_H */ | 53 | #endif /* __MACH_S3C24XX_H1940_H */ |
diff --git a/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h b/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h deleted file mode 100644 index 1b614d5a81f3..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/anubis-cpld.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
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 deleted file mode 100644 index a2a328134e34..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/anubis-irq.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
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 deleted file mode 100644 index c9deb3a5b2c3..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/anubis-map.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
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 deleted file mode 100644 index bee2a7a932a0..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/bast-cpld.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
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 deleted file mode 100644 index cac428c42e7f..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/bast-irq.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
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 deleted file mode 100644 index eecea2a50f8f..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/bast-map.h +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
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 | * whether 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/gpio-fns.h b/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h deleted file mode 100644 index c53ad34c6579..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/gpio-fns.h +++ /dev/null | |||
@@ -1 +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 deleted file mode 100644 index 3890a05948fb..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/gpio-nrs.h +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
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 | #endif /* __MACH_GPIONRS_H */ | ||
97 | |||
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio-track.h b/arch/arm/mach-s3c24xx/include/mach/gpio-track.h deleted file mode 100644 index c410a078622c..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/gpio-track.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
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 index 6fac70f3484e..14591563ca70 100644 --- a/arch/arm/mach-s3c24xx/include/mach/gpio.h +++ b/arch/arm/mach-s3c24xx/include/mach/gpio.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/gpio.h | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | 2 | * Copyright (c) 2008 Simtec Electronics |
4 | * http://armlinux.simtec.co.uk/ | 3 | * http://armlinux.simtec.co.uk/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
@@ -15,6 +14,9 @@ | |||
15 | * devices that need GPIO. | 14 | * devices that need GPIO. |
16 | */ | 15 | */ |
17 | 16 | ||
17 | #ifndef __MACH_GPIO_H | ||
18 | #define __MACH_GPIO_H __FILE__ | ||
19 | |||
18 | #ifdef CONFIG_CPU_S3C244X | 20 | #ifdef CONFIG_CPU_S3C244X |
19 | #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) | 21 | #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) |
20 | #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) | 22 | #elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) |
@@ -23,8 +25,83 @@ | |||
23 | #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) | 25 | #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) |
24 | #endif | 26 | #endif |
25 | 27 | ||
26 | #include <mach/gpio-nrs.h> | 28 | /* |
27 | #include <mach/gpio-fns.h> | 29 | * GPIO sizes for various SoCs: |
30 | * | ||
31 | * 2410 2412 2440 2443 2416 | ||
32 | * 2442 | ||
33 | * ---- ---- ---- ---- ---- | ||
34 | * A 23 22 25 16 25 | ||
35 | * B 11 11 11 11 9 | ||
36 | * C 16 15 16 16 16 | ||
37 | * D 16 16 16 16 16 | ||
38 | * E 16 16 16 16 16 | ||
39 | * F 8 8 8 8 8 | ||
40 | * G 16 16 16 16 8 | ||
41 | * H 11 11 9 15 15 | ||
42 | * J -- -- 13 16 -- | ||
43 | * K -- -- -- -- 16 | ||
44 | * L -- -- -- 15 7 | ||
45 | * M -- -- -- 2 2 | ||
46 | */ | ||
47 | |||
48 | /* GPIO bank sizes */ | ||
49 | |||
50 | #define S3C2410_GPIO_A_NR (32) | ||
51 | #define S3C2410_GPIO_B_NR (32) | ||
52 | #define S3C2410_GPIO_C_NR (32) | ||
53 | #define S3C2410_GPIO_D_NR (32) | ||
54 | #define S3C2410_GPIO_E_NR (32) | ||
55 | #define S3C2410_GPIO_F_NR (32) | ||
56 | #define S3C2410_GPIO_G_NR (32) | ||
57 | #define S3C2410_GPIO_H_NR (32) | ||
58 | #define S3C2410_GPIO_J_NR (32) /* technically 16. */ | ||
59 | #define S3C2410_GPIO_K_NR (32) /* technically 16. */ | ||
60 | #define S3C2410_GPIO_L_NR (32) /* technically 15. */ | ||
61 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ | ||
62 | |||
63 | #if CONFIG_S3C_GPIO_SPACE != 0 | ||
64 | #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment | ||
65 | #endif | ||
66 | |||
67 | #define S3C2410_GPIO_NEXT(__gpio) \ | ||
68 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0) | ||
69 | |||
70 | #ifndef __ASSEMBLY__ | ||
71 | |||
72 | enum s3c_gpio_number { | ||
73 | S3C2410_GPIO_A_START = 0, | ||
74 | S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A), | ||
75 | S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B), | ||
76 | S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C), | ||
77 | S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D), | ||
78 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), | ||
79 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), | ||
80 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), | ||
81 | S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), | ||
82 | S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), | ||
83 | S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), | ||
84 | S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), | ||
85 | }; | ||
86 | |||
87 | #endif /* __ASSEMBLY__ */ | ||
88 | |||
89 | /* S3C2410 GPIO number definitions. */ | ||
90 | |||
91 | #define S3C2410_GPA(_nr) (S3C2410_GPIO_A_START + (_nr)) | ||
92 | #define S3C2410_GPB(_nr) (S3C2410_GPIO_B_START + (_nr)) | ||
93 | #define S3C2410_GPC(_nr) (S3C2410_GPIO_C_START + (_nr)) | ||
94 | #define S3C2410_GPD(_nr) (S3C2410_GPIO_D_START + (_nr)) | ||
95 | #define S3C2410_GPE(_nr) (S3C2410_GPIO_E_START + (_nr)) | ||
96 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) | ||
97 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) | ||
98 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) | ||
99 | #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) | ||
100 | #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) | ||
101 | #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) | ||
102 | #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) | ||
103 | |||
104 | #include <plat/gpio-cfg.h> | ||
28 | 105 | ||
29 | #ifdef CONFIG_CPU_S3C244X | 106 | #ifdef CONFIG_CPU_S3C244X |
30 | #define S3C_GPIO_END (S3C2410_GPJ(0) + 32) | 107 | #define S3C_GPIO_END (S3C2410_GPJ(0) + 32) |
@@ -33,3 +110,5 @@ | |||
33 | #else | 110 | #else |
34 | #define S3C_GPIO_END (S3C2410_GPH(0) + 32) | 111 | #define S3C_GPIO_END (S3C2410_GPH(0) + 32) |
35 | #endif | 112 | #endif |
113 | |||
114 | #endif /* __MACH_GPIO_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/h1940.h b/arch/arm/mach-s3c24xx/include/mach/h1940.h deleted file mode 100644 index 2aa683c8d3d6..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/h1940.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
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 index aef5631eac58..a6cc14a092fc 100644 --- a/arch/arm/mach-s3c24xx/include/mach/hardware.h +++ b/arch/arm/mach-s3c24xx/include/mach/hardware.h | |||
@@ -23,12 +23,6 @@ extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); | |||
23 | 23 | ||
24 | #endif /* CONFIG_CPU_S3C2440 */ | 24 | #endif /* CONFIG_CPU_S3C2440 */ |
25 | 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__ */ | 26 | #endif /* __ASSEMBLY__ */ |
33 | 27 | ||
34 | #include <asm/sizes.h> | 28 | #include <asm/sizes.h> |
diff --git a/arch/arm/mach-s3c24xx/include/mach/idle.h b/arch/arm/mach-s3c24xx/include/mach/idle.h deleted file mode 100644 index e9ddd706b16e..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/idle.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
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/osiris-cpld.h b/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h deleted file mode 100644 index e9e36b0abbac..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/osiris-cpld.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
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/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h index a11a638bd599..c2ef016032ab 100644 --- a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h +++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #ifndef __ASM_ARCH_REGS_GPIO_H | 14 | #ifndef __ASM_ARCH_REGS_GPIO_H |
15 | #define __ASM_ARCH_REGS_GPIO_H | 15 | #define __ASM_ARCH_REGS_GPIO_H |
16 | 16 | ||
17 | #include <mach/gpio-nrs.h> | ||
18 | |||
19 | #define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80) | 17 | #define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80) |
20 | 18 | ||
21 | /* general configuration options */ | 19 | /* general configuration options */ |
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-mem.h b/arch/arm/mach-s3c24xx/include/mach/regs-mem.h deleted file mode 100644 index e0c67b0163d8..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-mem.h +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
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 deleted file mode 100644 index 4932b87bdf3d..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-power.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
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 deleted file mode 100644 index fb6352515090..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412-mem.h +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
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 deleted file mode 100644 index aa69dc79bc38..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2412.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
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 deleted file mode 100644 index 2f31b74974af..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416-mem.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
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 deleted file mode 100644 index e443167efb87..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2416.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
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/vr1000-cpld.h b/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h deleted file mode 100644 index e4119913d7c5..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/vr1000-cpld.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
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 deleted file mode 100644 index 47add133b8ee..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/vr1000-irq.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
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 deleted file mode 100644 index 28376e56dd3b..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/vr1000-map.h +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
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 | * whether 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/iotiming-s3c2410.c b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c new file mode 100644 index 000000000000..4cd13ab6496b --- /dev/null +++ b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c | |||
@@ -0,0 +1,478 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2009 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX CPU Frequency scaling - IO timing for S3C2410/S3C2440/S3C2442 | ||
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/init.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/cpufreq.h> | ||
17 | #include <linux/seq_file.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | #include <mach/map.h> | ||
22 | #include <mach/regs-clock.h> | ||
23 | |||
24 | #include <plat/cpu-freq-core.h> | ||
25 | |||
26 | #include "regs-mem.h" | ||
27 | |||
28 | #define print_ns(x) ((x) / 10), ((x) % 10) | ||
29 | |||
30 | /** | ||
31 | * s3c2410_print_timing - print bank timing data for debug purposes | ||
32 | * @pfx: The prefix to put on the output | ||
33 | * @timings: The timing inforamtion to print. | ||
34 | */ | ||
35 | static void s3c2410_print_timing(const char *pfx, | ||
36 | struct s3c_iotimings *timings) | ||
37 | { | ||
38 | struct s3c2410_iobank_timing *bt; | ||
39 | int bank; | ||
40 | |||
41 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
42 | bt = timings->bank[bank].io_2410; | ||
43 | if (!bt) | ||
44 | continue; | ||
45 | |||
46 | printk(KERN_DEBUG "%s %d: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, " | ||
47 | "Tcoh=%d.%d, Tcah=%d.%d\n", pfx, bank, | ||
48 | print_ns(bt->tacs), | ||
49 | print_ns(bt->tcos), | ||
50 | print_ns(bt->tacc), | ||
51 | print_ns(bt->tcoh), | ||
52 | print_ns(bt->tcah)); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * bank_reg - convert bank number to pointer to the control register. | ||
58 | * @bank: The IO bank number. | ||
59 | */ | ||
60 | static inline void __iomem *bank_reg(unsigned int bank) | ||
61 | { | ||
62 | return S3C2410_BANKCON0 + (bank << 2); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * bank_is_io - test whether bank is used for IO | ||
67 | * @bankcon: The bank control register. | ||
68 | * | ||
69 | * This is a simplistic test to see if any BANKCON[x] is not an IO | ||
70 | * bank. It currently does not take into account whether BWSCON has | ||
71 | * an illegal width-setting in it, or if the pin connected to nCS[x] | ||
72 | * is actually being handled as a chip-select. | ||
73 | */ | ||
74 | static inline int bank_is_io(unsigned long bankcon) | ||
75 | { | ||
76 | return !(bankcon & S3C2410_BANKCON_SDRAM); | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * to_div - convert cycle time to divisor | ||
81 | * @cyc: The cycle time, in 10ths of nanoseconds. | ||
82 | * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. | ||
83 | * | ||
84 | * Convert the given cycle time into the divisor to use to obtain it from | ||
85 | * HCLK. | ||
86 | */ | ||
87 | static inline unsigned int to_div(unsigned int cyc, unsigned int hclk_tns) | ||
88 | { | ||
89 | if (cyc == 0) | ||
90 | return 0; | ||
91 | |||
92 | return DIV_ROUND_UP(cyc, hclk_tns); | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * calc_0124 - calculate divisor control for divisors that do /0, /1. /2 and /4 | ||
97 | * @cyc: The cycle time, in 10ths of nanoseconds. | ||
98 | * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. | ||
99 | * @v: Pointer to register to alter. | ||
100 | * @shift: The shift to get to the control bits. | ||
101 | * | ||
102 | * Calculate the divisor, and turn it into the correct control bits to | ||
103 | * set in the result, @v. | ||
104 | */ | ||
105 | static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns, | ||
106 | unsigned long *v, int shift) | ||
107 | { | ||
108 | unsigned int div = to_div(cyc, hclk_tns); | ||
109 | unsigned long val; | ||
110 | |||
111 | s3c_freq_iodbg("%s: cyc=%d, hclk=%lu, shift=%d => div %d\n", | ||
112 | __func__, cyc, hclk_tns, shift, div); | ||
113 | |||
114 | switch (div) { | ||
115 | case 0: | ||
116 | val = 0; | ||
117 | break; | ||
118 | case 1: | ||
119 | val = 1; | ||
120 | break; | ||
121 | case 2: | ||
122 | val = 2; | ||
123 | break; | ||
124 | case 3: | ||
125 | case 4: | ||
126 | val = 3; | ||
127 | break; | ||
128 | default: | ||
129 | return -1; | ||
130 | } | ||
131 | |||
132 | *v |= val << shift; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v) | ||
137 | { | ||
138 | /* Currently no support for Tacp calculations. */ | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | /** | ||
143 | * calc_tacc - calculate divisor control for tacc. | ||
144 | * @cyc: The cycle time, in 10ths of nanoseconds. | ||
145 | * @nwait_en: IS nWAIT enabled for this bank. | ||
146 | * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. | ||
147 | * @v: Pointer to register to alter. | ||
148 | * | ||
149 | * Calculate the divisor control for tACC, taking into account whether | ||
150 | * the bank has nWAIT enabled. The result is used to modify the value | ||
151 | * pointed to by @v. | ||
152 | */ | ||
153 | static int calc_tacc(unsigned int cyc, int nwait_en, | ||
154 | unsigned long hclk_tns, unsigned long *v) | ||
155 | { | ||
156 | unsigned int div = to_div(cyc, hclk_tns); | ||
157 | unsigned long val; | ||
158 | |||
159 | s3c_freq_iodbg("%s: cyc=%u, nwait=%d, hclk=%lu => div=%u\n", | ||
160 | __func__, cyc, nwait_en, hclk_tns, div); | ||
161 | |||
162 | /* if nWait enabled on an bank, Tacc must be at-least 4 cycles. */ | ||
163 | if (nwait_en && div < 4) | ||
164 | div = 4; | ||
165 | |||
166 | switch (div) { | ||
167 | case 0: | ||
168 | val = 0; | ||
169 | break; | ||
170 | |||
171 | case 1: | ||
172 | case 2: | ||
173 | case 3: | ||
174 | case 4: | ||
175 | val = div - 1; | ||
176 | break; | ||
177 | |||
178 | case 5: | ||
179 | case 6: | ||
180 | val = 4; | ||
181 | break; | ||
182 | |||
183 | case 7: | ||
184 | case 8: | ||
185 | val = 5; | ||
186 | break; | ||
187 | |||
188 | case 9: | ||
189 | case 10: | ||
190 | val = 6; | ||
191 | break; | ||
192 | |||
193 | case 11: | ||
194 | case 12: | ||
195 | case 13: | ||
196 | case 14: | ||
197 | val = 7; | ||
198 | break; | ||
199 | |||
200 | default: | ||
201 | return -1; | ||
202 | } | ||
203 | |||
204 | *v |= val << 8; | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * s3c2410_calc_bank - calculate bank timing infromation | ||
210 | * @cfg: The configuration we need to calculate for. | ||
211 | * @bt: The bank timing information. | ||
212 | * | ||
213 | * Given the cycle timine for a bank @bt, calculate the new BANKCON | ||
214 | * setting for the @cfg timing. This updates the timing information | ||
215 | * ready for the cpu frequency change. | ||
216 | */ | ||
217 | static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg, | ||
218 | struct s3c2410_iobank_timing *bt) | ||
219 | { | ||
220 | unsigned long hclk = cfg->freq.hclk_tns; | ||
221 | unsigned long res; | ||
222 | int ret; | ||
223 | |||
224 | res = bt->bankcon; | ||
225 | res &= (S3C2410_BANKCON_SDRAM | S3C2410_BANKCON_PMC16); | ||
226 | |||
227 | /* tacp: 2,3,4,5 */ | ||
228 | /* tcah: 0,1,2,4 */ | ||
229 | /* tcoh: 0,1,2,4 */ | ||
230 | /* tacc: 1,2,3,4,6,7,10,14 (>4 for nwait) */ | ||
231 | /* tcos: 0,1,2,4 */ | ||
232 | /* tacs: 0,1,2,4 */ | ||
233 | |||
234 | ret = calc_0124(bt->tacs, hclk, &res, S3C2410_BANKCON_Tacs_SHIFT); | ||
235 | ret |= calc_0124(bt->tcos, hclk, &res, S3C2410_BANKCON_Tcos_SHIFT); | ||
236 | ret |= calc_0124(bt->tcah, hclk, &res, S3C2410_BANKCON_Tcah_SHIFT); | ||
237 | ret |= calc_0124(bt->tcoh, hclk, &res, S3C2410_BANKCON_Tcoh_SHIFT); | ||
238 | |||
239 | if (ret) | ||
240 | return -EINVAL; | ||
241 | |||
242 | ret |= calc_tacp(bt->tacp, hclk, &res); | ||
243 | ret |= calc_tacc(bt->tacc, bt->nwait_en, hclk, &res); | ||
244 | |||
245 | if (ret) | ||
246 | return -EINVAL; | ||
247 | |||
248 | bt->bankcon = res; | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static unsigned int tacc_tab[] = { | ||
253 | [0] = 1, | ||
254 | [1] = 2, | ||
255 | [2] = 3, | ||
256 | [3] = 4, | ||
257 | [4] = 6, | ||
258 | [5] = 9, | ||
259 | [6] = 10, | ||
260 | [7] = 14, | ||
261 | }; | ||
262 | |||
263 | /** | ||
264 | * get_tacc - turn tACC value into cycle time | ||
265 | * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. | ||
266 | * @val: The bank timing register value, shifed down. | ||
267 | */ | ||
268 | static unsigned int get_tacc(unsigned long hclk_tns, | ||
269 | unsigned long val) | ||
270 | { | ||
271 | val &= 7; | ||
272 | return hclk_tns * tacc_tab[val]; | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * get_0124 - turn 0/1/2/4 divider into cycle time | ||
277 | * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. | ||
278 | * @val: The bank timing register value, shifed down. | ||
279 | */ | ||
280 | static unsigned int get_0124(unsigned long hclk_tns, | ||
281 | unsigned long val) | ||
282 | { | ||
283 | val &= 3; | ||
284 | return hclk_tns * ((val == 3) ? 4 : val); | ||
285 | } | ||
286 | |||
287 | /** | ||
288 | * s3c2410_iotiming_getbank - turn BANKCON into cycle time information | ||
289 | * @cfg: The frequency configuration | ||
290 | * @bt: The bank timing to fill in (uses cached BANKCON) | ||
291 | * | ||
292 | * Given the BANKCON setting in @bt and the current frequency settings | ||
293 | * in @cfg, update the cycle timing information. | ||
294 | */ | ||
295 | void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg, | ||
296 | struct s3c2410_iobank_timing *bt) | ||
297 | { | ||
298 | unsigned long bankcon = bt->bankcon; | ||
299 | unsigned long hclk = cfg->freq.hclk_tns; | ||
300 | |||
301 | bt->tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT); | ||
302 | bt->tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT); | ||
303 | bt->tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT); | ||
304 | bt->tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT); | ||
305 | bt->tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT); | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * s3c2410_iotiming_debugfs - debugfs show io bank timing information | ||
310 | * @seq: The seq_file to write output to using seq_printf(). | ||
311 | * @cfg: The current configuration. | ||
312 | * @iob: The IO bank information to decode. | ||
313 | */ | ||
314 | void s3c2410_iotiming_debugfs(struct seq_file *seq, | ||
315 | struct s3c_cpufreq_config *cfg, | ||
316 | union s3c_iobank *iob) | ||
317 | { | ||
318 | struct s3c2410_iobank_timing *bt = iob->io_2410; | ||
319 | unsigned long bankcon = bt->bankcon; | ||
320 | unsigned long hclk = cfg->freq.hclk_tns; | ||
321 | unsigned int tacs; | ||
322 | unsigned int tcos; | ||
323 | unsigned int tacc; | ||
324 | unsigned int tcoh; | ||
325 | unsigned int tcah; | ||
326 | |||
327 | seq_printf(seq, "BANKCON=0x%08lx\n", bankcon); | ||
328 | |||
329 | tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT); | ||
330 | tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT); | ||
331 | tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT); | ||
332 | tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT); | ||
333 | tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT); | ||
334 | |||
335 | seq_printf(seq, | ||
336 | "\tRead: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n", | ||
337 | print_ns(bt->tacs), | ||
338 | print_ns(bt->tcos), | ||
339 | print_ns(bt->tacc), | ||
340 | print_ns(bt->tcoh), | ||
341 | print_ns(bt->tcah)); | ||
342 | |||
343 | seq_printf(seq, | ||
344 | "\t Set: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n", | ||
345 | print_ns(tacs), | ||
346 | print_ns(tcos), | ||
347 | print_ns(tacc), | ||
348 | print_ns(tcoh), | ||
349 | print_ns(tcah)); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * s3c2410_iotiming_calc - Calculate bank timing for frequency change. | ||
354 | * @cfg: The frequency configuration | ||
355 | * @iot: The IO timing information to fill out. | ||
356 | * | ||
357 | * Calculate the new values for the banks in @iot based on the new | ||
358 | * frequency information in @cfg. This is then used by s3c2410_iotiming_set() | ||
359 | * to update the timing when necessary. | ||
360 | */ | ||
361 | int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg, | ||
362 | struct s3c_iotimings *iot) | ||
363 | { | ||
364 | struct s3c2410_iobank_timing *bt; | ||
365 | unsigned long bankcon; | ||
366 | int bank; | ||
367 | int ret; | ||
368 | |||
369 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
370 | bankcon = __raw_readl(bank_reg(bank)); | ||
371 | bt = iot->bank[bank].io_2410; | ||
372 | |||
373 | if (!bt) | ||
374 | continue; | ||
375 | |||
376 | bt->bankcon = bankcon; | ||
377 | |||
378 | ret = s3c2410_calc_bank(cfg, bt); | ||
379 | if (ret) { | ||
380 | printk(KERN_ERR "%s: cannot calculate bank %d io\n", | ||
381 | __func__, bank); | ||
382 | goto err; | ||
383 | } | ||
384 | |||
385 | s3c_freq_iodbg("%s: bank %d: con=%08lx\n", | ||
386 | __func__, bank, bt->bankcon); | ||
387 | } | ||
388 | |||
389 | return 0; | ||
390 | err: | ||
391 | return ret; | ||
392 | } | ||
393 | |||
394 | /** | ||
395 | * s3c2410_iotiming_set - set the IO timings from the given setup. | ||
396 | * @cfg: The frequency configuration | ||
397 | * @iot: The IO timing information to use. | ||
398 | * | ||
399 | * Set all the currently used IO bank timing information generated | ||
400 | * by s3c2410_iotiming_calc() once the core has validated that all | ||
401 | * the new values are within permitted bounds. | ||
402 | */ | ||
403 | void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg, | ||
404 | struct s3c_iotimings *iot) | ||
405 | { | ||
406 | struct s3c2410_iobank_timing *bt; | ||
407 | int bank; | ||
408 | |||
409 | /* set the io timings from the specifier */ | ||
410 | |||
411 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
412 | bt = iot->bank[bank].io_2410; | ||
413 | if (!bt) | ||
414 | continue; | ||
415 | |||
416 | __raw_writel(bt->bankcon, bank_reg(bank)); | ||
417 | } | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * s3c2410_iotiming_get - Get the timing information from current registers. | ||
422 | * @cfg: The frequency configuration | ||
423 | * @timings: The IO timing information to fill out. | ||
424 | * | ||
425 | * Calculate the @timings timing information from the current frequency | ||
426 | * information in @cfg, and the new frequency configur | ||
427 | * through all the IO banks, reading the state and then updating @iot | ||
428 | * as necessary. | ||
429 | * | ||
430 | * This is used at the moment on initialisation to get the current | ||
431 | * configuration so that boards do not have to carry their own setup | ||
432 | * if the timings are correct on initialisation. | ||
433 | */ | ||
434 | |||
435 | int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg, | ||
436 | struct s3c_iotimings *timings) | ||
437 | { | ||
438 | struct s3c2410_iobank_timing *bt; | ||
439 | unsigned long bankcon; | ||
440 | unsigned long bwscon; | ||
441 | int bank; | ||
442 | |||
443 | bwscon = __raw_readl(S3C2410_BWSCON); | ||
444 | |||
445 | /* look through all banks to see what is currently set. */ | ||
446 | |||
447 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
448 | bankcon = __raw_readl(bank_reg(bank)); | ||
449 | |||
450 | if (!bank_is_io(bankcon)) | ||
451 | continue; | ||
452 | |||
453 | s3c_freq_iodbg("%s: bank %d: con %08lx\n", | ||
454 | __func__, bank, bankcon); | ||
455 | |||
456 | bt = kzalloc(sizeof(struct s3c2410_iobank_timing), GFP_KERNEL); | ||
457 | if (!bt) { | ||
458 | printk(KERN_ERR "%s: no memory for bank\n", __func__); | ||
459 | return -ENOMEM; | ||
460 | } | ||
461 | |||
462 | /* find out in nWait is enabled for bank. */ | ||
463 | |||
464 | if (bank != 0) { | ||
465 | unsigned long tmp = S3C2410_BWSCON_GET(bwscon, bank); | ||
466 | if (tmp & S3C2410_BWSCON_WS) | ||
467 | bt->nwait_en = 1; | ||
468 | } | ||
469 | |||
470 | timings->bank[bank].io_2410 = bt; | ||
471 | bt->bankcon = bankcon; | ||
472 | |||
473 | s3c2410_iotiming_getbank(cfg, bt); | ||
474 | } | ||
475 | |||
476 | s3c2410_print_timing("get", timings); | ||
477 | return 0; | ||
478 | } | ||
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c new file mode 100644 index 000000000000..663436d9db01 --- /dev/null +++ b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c | |||
@@ -0,0 +1,285 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2008 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2412/S3C2443 (PL093 based) IO timing 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/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/cpufreq.h> | ||
18 | #include <linux/seq_file.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/err.h> | ||
23 | #include <linux/slab.h> | ||
24 | |||
25 | #include <linux/amba/pl093.h> | ||
26 | |||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | |||
30 | #include <plat/cpu.h> | ||
31 | #include <plat/cpu-freq-core.h> | ||
32 | #include <plat/clock.h> | ||
33 | |||
34 | #include "s3c2412.h" | ||
35 | |||
36 | #define print_ns(x) ((x) / 10), ((x) % 10) | ||
37 | |||
38 | /** | ||
39 | * s3c2412_print_timing - print timing infromation via printk. | ||
40 | * @pfx: The prefix to print each line with. | ||
41 | * @iot: The IO timing information | ||
42 | */ | ||
43 | static void s3c2412_print_timing(const char *pfx, struct s3c_iotimings *iot) | ||
44 | { | ||
45 | struct s3c2412_iobank_timing *bt; | ||
46 | unsigned int bank; | ||
47 | |||
48 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
49 | bt = iot->bank[bank].io_2412; | ||
50 | if (!bt) | ||
51 | continue; | ||
52 | |||
53 | printk(KERN_DEBUG "%s: %d: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d" | ||
54 | "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank, | ||
55 | print_ns(bt->idcy), | ||
56 | print_ns(bt->wstrd), | ||
57 | print_ns(bt->wstwr), | ||
58 | print_ns(bt->wstoen), | ||
59 | print_ns(bt->wstwen), | ||
60 | print_ns(bt->wstbrd)); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * to_div - turn a cycle length into a divisor setting. | ||
66 | * @cyc_tns: The cycle time in 10ths of nanoseconds. | ||
67 | * @clk_tns: The clock period in 10ths of nanoseconds. | ||
68 | */ | ||
69 | static inline unsigned int to_div(unsigned int cyc_tns, unsigned int clk_tns) | ||
70 | { | ||
71 | return cyc_tns ? DIV_ROUND_UP(cyc_tns, clk_tns) : 0; | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * calc_timing - calculate timing divisor value and check in range. | ||
76 | * @hwtm: The hardware timing in 10ths of nanoseconds. | ||
77 | * @clk_tns: The clock period in 10ths of nanoseconds. | ||
78 | * @err: Pointer to err variable to update in event of failure. | ||
79 | */ | ||
80 | static unsigned int calc_timing(unsigned int hwtm, unsigned int clk_tns, | ||
81 | unsigned int *err) | ||
82 | { | ||
83 | unsigned int ret = to_div(hwtm, clk_tns); | ||
84 | |||
85 | if (ret > 0xf) | ||
86 | *err = -EINVAL; | ||
87 | |||
88 | return ret; | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * s3c2412_calc_bank - calculate the bank divisor settings. | ||
93 | * @cfg: The current frequency configuration. | ||
94 | * @bt: The bank timing. | ||
95 | */ | ||
96 | static int s3c2412_calc_bank(struct s3c_cpufreq_config *cfg, | ||
97 | struct s3c2412_iobank_timing *bt) | ||
98 | { | ||
99 | unsigned int hclk = cfg->freq.hclk_tns; | ||
100 | int err = 0; | ||
101 | |||
102 | bt->smbidcyr = calc_timing(bt->idcy, hclk, &err); | ||
103 | bt->smbwstrd = calc_timing(bt->wstrd, hclk, &err); | ||
104 | bt->smbwstwr = calc_timing(bt->wstwr, hclk, &err); | ||
105 | bt->smbwstoen = calc_timing(bt->wstoen, hclk, &err); | ||
106 | bt->smbwstwen = calc_timing(bt->wstwen, hclk, &err); | ||
107 | bt->smbwstbrd = calc_timing(bt->wstbrd, hclk, &err); | ||
108 | |||
109 | return err; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * s3c2412_iotiming_debugfs - debugfs show io bank timing information | ||
114 | * @seq: The seq_file to write output to using seq_printf(). | ||
115 | * @cfg: The current configuration. | ||
116 | * @iob: The IO bank information to decode. | ||
117 | */ | ||
118 | void s3c2412_iotiming_debugfs(struct seq_file *seq, | ||
119 | struct s3c_cpufreq_config *cfg, | ||
120 | union s3c_iobank *iob) | ||
121 | { | ||
122 | struct s3c2412_iobank_timing *bt = iob->io_2412; | ||
123 | |||
124 | seq_printf(seq, | ||
125 | "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d" | ||
126 | "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", | ||
127 | print_ns(bt->idcy), | ||
128 | print_ns(bt->wstrd), | ||
129 | print_ns(bt->wstwr), | ||
130 | print_ns(bt->wstoen), | ||
131 | print_ns(bt->wstwen), | ||
132 | print_ns(bt->wstbrd)); | ||
133 | } | ||
134 | |||
135 | /** | ||
136 | * s3c2412_iotiming_calc - calculate all the bank divisor settings. | ||
137 | * @cfg: The current frequency configuration. | ||
138 | * @iot: The bank timing information. | ||
139 | * | ||
140 | * Calculate the timing information for all the banks that are | ||
141 | * configured as IO, using s3c2412_calc_bank(). | ||
142 | */ | ||
143 | int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg, | ||
144 | struct s3c_iotimings *iot) | ||
145 | { | ||
146 | struct s3c2412_iobank_timing *bt; | ||
147 | int bank; | ||
148 | int ret; | ||
149 | |||
150 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
151 | bt = iot->bank[bank].io_2412; | ||
152 | if (!bt) | ||
153 | continue; | ||
154 | |||
155 | ret = s3c2412_calc_bank(cfg, bt); | ||
156 | if (ret) { | ||
157 | printk(KERN_ERR "%s: cannot calculate bank %d io\n", | ||
158 | __func__, bank); | ||
159 | goto err; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | return 0; | ||
164 | err: | ||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * s3c2412_iotiming_set - set the timing information | ||
170 | * @cfg: The current frequency configuration. | ||
171 | * @iot: The bank timing information. | ||
172 | * | ||
173 | * Set the IO bank information from the details calculated earlier from | ||
174 | * calling s3c2412_iotiming_calc(). | ||
175 | */ | ||
176 | void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg, | ||
177 | struct s3c_iotimings *iot) | ||
178 | { | ||
179 | struct s3c2412_iobank_timing *bt; | ||
180 | void __iomem *regs; | ||
181 | int bank; | ||
182 | |||
183 | /* set the io timings from the specifier */ | ||
184 | |||
185 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
186 | bt = iot->bank[bank].io_2412; | ||
187 | if (!bt) | ||
188 | continue; | ||
189 | |||
190 | regs = S3C2412_SSMC_BANK(bank); | ||
191 | |||
192 | __raw_writel(bt->smbidcyr, regs + SMBIDCYR); | ||
193 | __raw_writel(bt->smbwstrd, regs + SMBWSTRDR); | ||
194 | __raw_writel(bt->smbwstwr, regs + SMBWSTWRR); | ||
195 | __raw_writel(bt->smbwstoen, regs + SMBWSTOENR); | ||
196 | __raw_writel(bt->smbwstwen, regs + SMBWSTWENR); | ||
197 | __raw_writel(bt->smbwstbrd, regs + SMBWSTBRDR); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | static inline unsigned int s3c2412_decode_timing(unsigned int clock, u32 reg) | ||
202 | { | ||
203 | return (reg & 0xf) * clock; | ||
204 | } | ||
205 | |||
206 | static void s3c2412_iotiming_getbank(struct s3c_cpufreq_config *cfg, | ||
207 | struct s3c2412_iobank_timing *bt, | ||
208 | unsigned int bank) | ||
209 | { | ||
210 | unsigned long clk = cfg->freq.hclk_tns; /* ssmc clock??? */ | ||
211 | void __iomem *regs = S3C2412_SSMC_BANK(bank); | ||
212 | |||
213 | bt->idcy = s3c2412_decode_timing(clk, __raw_readl(regs + SMBIDCYR)); | ||
214 | bt->wstrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTRDR)); | ||
215 | bt->wstoen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTOENR)); | ||
216 | bt->wstwen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTWENR)); | ||
217 | bt->wstbrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTBRDR)); | ||
218 | } | ||
219 | |||
220 | /** | ||
221 | * bank_is_io - return true if bank is (possibly) IO. | ||
222 | * @bank: The bank number. | ||
223 | * @bankcfg: The value of S3C2412_EBI_BANKCFG. | ||
224 | */ | ||
225 | static inline bool bank_is_io(unsigned int bank, u32 bankcfg) | ||
226 | { | ||
227 | if (bank < 2) | ||
228 | return true; | ||
229 | |||
230 | return !(bankcfg & (1 << bank)); | ||
231 | } | ||
232 | |||
233 | int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg, | ||
234 | struct s3c_iotimings *timings) | ||
235 | { | ||
236 | struct s3c2412_iobank_timing *bt; | ||
237 | u32 bankcfg = __raw_readl(S3C2412_EBI_BANKCFG); | ||
238 | unsigned int bank; | ||
239 | |||
240 | /* look through all banks to see what is currently set. */ | ||
241 | |||
242 | for (bank = 0; bank < MAX_BANKS; bank++) { | ||
243 | if (!bank_is_io(bank, bankcfg)) | ||
244 | continue; | ||
245 | |||
246 | bt = kzalloc(sizeof(struct s3c2412_iobank_timing), GFP_KERNEL); | ||
247 | if (!bt) { | ||
248 | printk(KERN_ERR "%s: no memory for bank\n", __func__); | ||
249 | return -ENOMEM; | ||
250 | } | ||
251 | |||
252 | timings->bank[bank].io_2412 = bt; | ||
253 | s3c2412_iotiming_getbank(cfg, bt, bank); | ||
254 | } | ||
255 | |||
256 | s3c2412_print_timing("get", timings); | ||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | /* this is in here as it is so small, it doesn't currently warrant a file | ||
261 | * to itself. We expect that any s3c24xx needing this is going to also | ||
262 | * need the iotiming support. | ||
263 | */ | ||
264 | void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg) | ||
265 | { | ||
266 | struct s3c_cpufreq_board *board = cfg->board; | ||
267 | u32 refresh; | ||
268 | |||
269 | WARN_ON(board == NULL); | ||
270 | |||
271 | /* Reduce both the refresh time (in ns) and the frequency (in MHz) | ||
272 | * down to ensure that we do not overflow 32 bit numbers. | ||
273 | * | ||
274 | * This should work for HCLK up to 133MHz and refresh period up | ||
275 | * to 30usec. | ||
276 | */ | ||
277 | |||
278 | refresh = (cfg->freq.hclk / 100) * (board->refresh / 10); | ||
279 | refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale */ | ||
280 | refresh &= ((1 << 16) - 1); | ||
281 | |||
282 | s3c_freq_dbg("%s: refresh value %u\n", __func__, (unsigned int)refresh); | ||
283 | |||
284 | __raw_writel(refresh, S3C2412_REFRESH); | ||
285 | } | ||
diff --git a/arch/arm/mach-s3c24xx/irq-pm.c b/arch/arm/mach-s3c24xx/irq-pm.c index 0efb2e2848c8..e1199599873e 100644 --- a/arch/arm/mach-s3c24xx/irq-pm.c +++ b/arch/arm/mach-s3c24xx/irq-pm.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/syscore_ops.h> | ||
18 | 19 | ||
19 | #include <plat/cpu.h> | 20 | #include <plat/cpu.h> |
20 | #include <plat/pm.h> | 21 | #include <plat/pm.h> |
@@ -29,18 +30,18 @@ | |||
29 | * set bit to 1 in allow bitfield to enable the wakeup settings on it | 30 | * set bit to 1 in allow bitfield to enable the wakeup settings on it |
30 | */ | 31 | */ |
31 | 32 | ||
32 | unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL; | 33 | unsigned long s3c_irqwake_intallow = 1L << 30 | 0xfL; |
33 | unsigned long s3c_irqwake_eintallow = 0x0000fff0L; | 34 | unsigned long s3c_irqwake_eintallow = 0x0000fff0L; |
34 | 35 | ||
35 | int s3c_irq_wake(struct irq_data *data, unsigned int state) | 36 | int s3c_irq_wake(struct irq_data *data, unsigned int state) |
36 | { | 37 | { |
37 | unsigned long irqbit = 1 << (data->irq - IRQ_EINT0); | 38 | unsigned long irqbit = 1 << data->hwirq; |
38 | 39 | ||
39 | if (!(s3c_irqwake_intallow & irqbit)) | 40 | if (!(s3c_irqwake_intallow & irqbit)) |
40 | return -ENOENT; | 41 | return -ENOENT; |
41 | 42 | ||
42 | printk(KERN_INFO "wake %s for irq %d\n", | 43 | pr_info("wake %s for hwirq %lu\n", |
43 | state ? "enabled" : "disabled", data->irq); | 44 | state ? "enabled" : "disabled", data->hwirq); |
44 | 45 | ||
45 | if (!state) | 46 | if (!state) |
46 | s3c_irqwake_intmask |= irqbit; | 47 | s3c_irqwake_intmask |= irqbit; |
@@ -64,7 +65,7 @@ static unsigned long save_extint[3]; | |||
64 | static unsigned long save_eintflt[4]; | 65 | static unsigned long save_eintflt[4]; |
65 | static unsigned long save_eintmask; | 66 | static unsigned long save_eintmask; |
66 | 67 | ||
67 | int s3c24xx_irq_suspend(void) | 68 | static int s3c24xx_irq_suspend(void) |
68 | { | 69 | { |
69 | unsigned int i; | 70 | unsigned int i; |
70 | 71 | ||
@@ -80,7 +81,7 @@ int s3c24xx_irq_suspend(void) | |||
80 | return 0; | 81 | return 0; |
81 | } | 82 | } |
82 | 83 | ||
83 | void s3c24xx_irq_resume(void) | 84 | static void s3c24xx_irq_resume(void) |
84 | { | 85 | { |
85 | unsigned int i; | 86 | unsigned int i; |
86 | 87 | ||
@@ -93,3 +94,31 @@ void s3c24xx_irq_resume(void) | |||
93 | s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); | 94 | s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); |
94 | __raw_writel(save_eintmask, S3C24XX_EINTMASK); | 95 | __raw_writel(save_eintmask, S3C24XX_EINTMASK); |
95 | } | 96 | } |
97 | |||
98 | struct syscore_ops s3c24xx_irq_syscore_ops = { | ||
99 | .suspend = s3c24xx_irq_suspend, | ||
100 | .resume = s3c24xx_irq_resume, | ||
101 | }; | ||
102 | |||
103 | #ifdef CONFIG_CPU_S3C2416 | ||
104 | static struct sleep_save s3c2416_irq_save[] = { | ||
105 | SAVE_ITEM(S3C2416_INTMSK2), | ||
106 | }; | ||
107 | |||
108 | static int s3c2416_irq_suspend(void) | ||
109 | { | ||
110 | s3c_pm_do_save(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save)); | ||
111 | |||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | static void s3c2416_irq_resume(void) | ||
116 | { | ||
117 | s3c_pm_do_restore(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save)); | ||
118 | } | ||
119 | |||
120 | struct syscore_ops s3c2416_irq_syscore_ops = { | ||
121 | .suspend = s3c2416_irq_suspend, | ||
122 | .resume = s3c2416_irq_resume, | ||
123 | }; | ||
124 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c index e65619ddbccc..67d763178d3f 100644 --- a/arch/arm/mach-s3c24xx/irq-s3c2412.c +++ b/arch/arm/mach-s3c24xx/irq-s3c2412.c | |||
@@ -33,12 +33,13 @@ | |||
33 | 33 | ||
34 | #include <mach/regs-irq.h> | 34 | #include <mach/regs-irq.h> |
35 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
36 | #include <mach/regs-power.h> | ||
37 | 36 | ||
38 | #include <plat/cpu.h> | 37 | #include <plat/cpu.h> |
39 | #include <plat/irq.h> | 38 | #include <plat/irq.h> |
40 | #include <plat/pm.h> | 39 | #include <plat/pm.h> |
41 | 40 | ||
41 | #include "s3c2412-power.h" | ||
42 | |||
42 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | 43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) |
43 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | 44 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) |
44 | 45 | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2416.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c deleted file mode 100644 index ff141b0af26b..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2416.c +++ /dev/null | |||
@@ -1,348 +0,0 @@ | |||
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 | #include <linux/syscore_ops.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/regs-gpio.h> | ||
39 | |||
40 | #include <plat/cpu.h> | ||
41 | #include <plat/pm.h> | ||
42 | #include <plat/irq.h> | ||
43 | |||
44 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
45 | |||
46 | static inline void s3c2416_irq_demux(unsigned int irq, unsigned int len) | ||
47 | { | ||
48 | unsigned int subsrc, submsk; | ||
49 | unsigned int end; | ||
50 | |||
51 | /* read the current pending interrupts, and the mask | ||
52 | * for what it is available */ | ||
53 | |||
54 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
55 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
56 | |||
57 | subsrc &= ~submsk; | ||
58 | subsrc >>= (irq - S3C2410_IRQSUB(0)); | ||
59 | subsrc &= (1 << len)-1; | ||
60 | |||
61 | end = len + irq; | ||
62 | |||
63 | for (; irq < end && subsrc; irq++) { | ||
64 | if (subsrc & 1) | ||
65 | generic_handle_irq(irq); | ||
66 | |||
67 | subsrc >>= 1; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /* WDT/AC97 sub interrupts */ | ||
72 | |||
73 | static void s3c2416_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc) | ||
74 | { | ||
75 | s3c2416_irq_demux(IRQ_S3C2443_WDT, 4); | ||
76 | } | ||
77 | |||
78 | #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
79 | #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) | ||
80 | |||
81 | static void s3c2416_irq_wdtac97_mask(struct irq_data *data) | ||
82 | { | ||
83 | s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
84 | } | ||
85 | |||
86 | static void s3c2416_irq_wdtac97_unmask(struct irq_data *data) | ||
87 | { | ||
88 | s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97); | ||
89 | } | ||
90 | |||
91 | static void s3c2416_irq_wdtac97_ack(struct irq_data *data) | ||
92 | { | ||
93 | s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
94 | } | ||
95 | |||
96 | static struct irq_chip s3c2416_irq_wdtac97 = { | ||
97 | .irq_mask = s3c2416_irq_wdtac97_mask, | ||
98 | .irq_unmask = s3c2416_irq_wdtac97_unmask, | ||
99 | .irq_ack = s3c2416_irq_wdtac97_ack, | ||
100 | }; | ||
101 | |||
102 | /* LCD sub interrupts */ | ||
103 | |||
104 | static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc) | ||
105 | { | ||
106 | s3c2416_irq_demux(IRQ_S3C2443_LCD1, 4); | ||
107 | } | ||
108 | |||
109 | #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) | ||
110 | #define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4) | ||
111 | |||
112 | static void s3c2416_irq_lcd_mask(struct irq_data *data) | ||
113 | { | ||
114 | s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
115 | } | ||
116 | |||
117 | static void s3c2416_irq_lcd_unmask(struct irq_data *data) | ||
118 | { | ||
119 | s3c_irqsub_unmask(data->irq, INTMSK_LCD); | ||
120 | } | ||
121 | |||
122 | static void s3c2416_irq_lcd_ack(struct irq_data *data) | ||
123 | { | ||
124 | s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD); | ||
125 | } | ||
126 | |||
127 | static struct irq_chip s3c2416_irq_lcd = { | ||
128 | .irq_mask = s3c2416_irq_lcd_mask, | ||
129 | .irq_unmask = s3c2416_irq_lcd_unmask, | ||
130 | .irq_ack = s3c2416_irq_lcd_ack, | ||
131 | }; | ||
132 | |||
133 | /* DMA sub interrupts */ | ||
134 | |||
135 | static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc) | ||
136 | { | ||
137 | s3c2416_irq_demux(IRQ_S3C2443_DMA0, 6); | ||
138 | } | ||
139 | |||
140 | #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) | ||
141 | #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) | ||
142 | |||
143 | |||
144 | static void s3c2416_irq_dma_mask(struct irq_data *data) | ||
145 | { | ||
146 | s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
147 | } | ||
148 | |||
149 | static void s3c2416_irq_dma_unmask(struct irq_data *data) | ||
150 | { | ||
151 | s3c_irqsub_unmask(data->irq, INTMSK_DMA); | ||
152 | } | ||
153 | |||
154 | static void s3c2416_irq_dma_ack(struct irq_data *data) | ||
155 | { | ||
156 | s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA); | ||
157 | } | ||
158 | |||
159 | static struct irq_chip s3c2416_irq_dma = { | ||
160 | .irq_mask = s3c2416_irq_dma_mask, | ||
161 | .irq_unmask = s3c2416_irq_dma_unmask, | ||
162 | .irq_ack = s3c2416_irq_dma_ack, | ||
163 | }; | ||
164 | |||
165 | /* UART3 sub interrupts */ | ||
166 | |||
167 | static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) | ||
168 | { | ||
169 | s3c2416_irq_demux(IRQ_S3C2443_RX3, 3); | ||
170 | } | ||
171 | |||
172 | #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) | ||
173 | #define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) | ||
174 | |||
175 | static void s3c2416_irq_uart3_mask(struct irq_data *data) | ||
176 | { | ||
177 | s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
178 | } | ||
179 | |||
180 | static void s3c2416_irq_uart3_unmask(struct irq_data *data) | ||
181 | { | ||
182 | s3c_irqsub_unmask(data->irq, INTMSK_UART3); | ||
183 | } | ||
184 | |||
185 | static void s3c2416_irq_uart3_ack(struct irq_data *data) | ||
186 | { | ||
187 | s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3); | ||
188 | } | ||
189 | |||
190 | static struct irq_chip s3c2416_irq_uart3 = { | ||
191 | .irq_mask = s3c2416_irq_uart3_mask, | ||
192 | .irq_unmask = s3c2416_irq_uart3_unmask, | ||
193 | .irq_ack = s3c2416_irq_uart3_ack, | ||
194 | }; | ||
195 | |||
196 | /* second interrupt register */ | ||
197 | |||
198 | static inline void s3c2416_irq_ack_second(struct irq_data *data) | ||
199 | { | ||
200 | unsigned long bitval = 1UL << (data->irq - IRQ_S3C2416_2D); | ||
201 | |||
202 | __raw_writel(bitval, S3C2416_SRCPND2); | ||
203 | __raw_writel(bitval, S3C2416_INTPND2); | ||
204 | } | ||
205 | |||
206 | static void s3c2416_irq_mask_second(struct irq_data *data) | ||
207 | { | ||
208 | unsigned long bitval = 1UL << (data->irq - IRQ_S3C2416_2D); | ||
209 | unsigned long mask; | ||
210 | |||
211 | mask = __raw_readl(S3C2416_INTMSK2); | ||
212 | mask |= bitval; | ||
213 | __raw_writel(mask, S3C2416_INTMSK2); | ||
214 | } | ||
215 | |||
216 | static void s3c2416_irq_unmask_second(struct irq_data *data) | ||
217 | { | ||
218 | unsigned long bitval = 1UL << (data->irq - IRQ_S3C2416_2D); | ||
219 | unsigned long mask; | ||
220 | |||
221 | mask = __raw_readl(S3C2416_INTMSK2); | ||
222 | mask &= ~bitval; | ||
223 | __raw_writel(mask, S3C2416_INTMSK2); | ||
224 | } | ||
225 | |||
226 | struct irq_chip s3c2416_irq_second = { | ||
227 | .irq_ack = s3c2416_irq_ack_second, | ||
228 | .irq_mask = s3c2416_irq_mask_second, | ||
229 | .irq_unmask = s3c2416_irq_unmask_second, | ||
230 | }; | ||
231 | |||
232 | |||
233 | /* IRQ initialisation code */ | ||
234 | |||
235 | static int s3c2416_add_sub(unsigned int base, | ||
236 | void (*demux)(unsigned int, | ||
237 | struct irq_desc *), | ||
238 | struct irq_chip *chip, | ||
239 | unsigned int start, unsigned int end) | ||
240 | { | ||
241 | unsigned int irqno; | ||
242 | |||
243 | irq_set_chip_and_handler(base, &s3c_irq_level_chip, handle_level_irq); | ||
244 | irq_set_chained_handler(base, demux); | ||
245 | |||
246 | for (irqno = start; irqno <= end; irqno++) { | ||
247 | irq_set_chip_and_handler(irqno, chip, handle_level_irq); | ||
248 | set_irq_flags(irqno, IRQF_VALID); | ||
249 | } | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static void s3c2416_irq_add_second(void) | ||
255 | { | ||
256 | unsigned long pend; | ||
257 | unsigned long last; | ||
258 | int irqno; | ||
259 | int i; | ||
260 | |||
261 | /* first, clear all interrupts pending... */ | ||
262 | last = 0; | ||
263 | for (i = 0; i < 4; i++) { | ||
264 | pend = __raw_readl(S3C2416_INTPND2); | ||
265 | |||
266 | if (pend == 0 || pend == last) | ||
267 | break; | ||
268 | |||
269 | __raw_writel(pend, S3C2416_SRCPND2); | ||
270 | __raw_writel(pend, S3C2416_INTPND2); | ||
271 | printk(KERN_INFO "irq: clearing pending status %08x\n", | ||
272 | (int)pend); | ||
273 | last = pend; | ||
274 | } | ||
275 | |||
276 | for (irqno = IRQ_S3C2416_2D; irqno <= IRQ_S3C2416_I2S1; irqno++) { | ||
277 | switch (irqno) { | ||
278 | case IRQ_S3C2416_RESERVED2: | ||
279 | case IRQ_S3C2416_RESERVED3: | ||
280 | /* no IRQ here */ | ||
281 | break; | ||
282 | default: | ||
283 | irq_set_chip_and_handler(irqno, &s3c2416_irq_second, | ||
284 | handle_edge_irq); | ||
285 | set_irq_flags(irqno, IRQF_VALID); | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | |||
290 | static int s3c2416_irq_add(struct device *dev, | ||
291 | struct subsys_interface *sif) | ||
292 | { | ||
293 | printk(KERN_INFO "S3C2416: IRQ Support\n"); | ||
294 | |||
295 | s3c2416_add_sub(IRQ_LCD, s3c2416_irq_demux_lcd, &s3c2416_irq_lcd, | ||
296 | IRQ_S3C2443_LCD2, IRQ_S3C2443_LCD4); | ||
297 | |||
298 | s3c2416_add_sub(IRQ_S3C2443_DMA, s3c2416_irq_demux_dma, | ||
299 | &s3c2416_irq_dma, IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5); | ||
300 | |||
301 | s3c2416_add_sub(IRQ_S3C2443_UART3, s3c2416_irq_demux_uart3, | ||
302 | &s3c2416_irq_uart3, | ||
303 | IRQ_S3C2443_RX3, IRQ_S3C2443_ERR3); | ||
304 | |||
305 | s3c2416_add_sub(IRQ_WDT, s3c2416_irq_demux_wdtac97, | ||
306 | &s3c2416_irq_wdtac97, | ||
307 | IRQ_S3C2443_WDT, IRQ_S3C2443_AC97); | ||
308 | |||
309 | s3c2416_irq_add_second(); | ||
310 | |||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static struct subsys_interface s3c2416_irq_interface = { | ||
315 | .name = "s3c2416_irq", | ||
316 | .subsys = &s3c2416_subsys, | ||
317 | .add_dev = s3c2416_irq_add, | ||
318 | }; | ||
319 | |||
320 | static int __init s3c2416_irq_init(void) | ||
321 | { | ||
322 | return subsys_interface_register(&s3c2416_irq_interface); | ||
323 | } | ||
324 | |||
325 | arch_initcall(s3c2416_irq_init); | ||
326 | |||
327 | #ifdef CONFIG_PM | ||
328 | static struct sleep_save irq_save[] = { | ||
329 | SAVE_ITEM(S3C2416_INTMSK2), | ||
330 | }; | ||
331 | |||
332 | int s3c2416_irq_suspend(void) | ||
333 | { | ||
334 | s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save)); | ||
335 | |||
336 | return 0; | ||
337 | } | ||
338 | |||
339 | void s3c2416_irq_resume(void) | ||
340 | { | ||
341 | s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); | ||
342 | } | ||
343 | |||
344 | struct syscore_ops s3c2416_irq_syscore_ops = { | ||
345 | .suspend = s3c2416_irq_suspend, | ||
346 | .resume = s3c2416_irq_resume, | ||
347 | }; | ||
348 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2443.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c deleted file mode 100644 index 5e69109c0928..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2443.c +++ /dev/null | |||
@@ -1,281 +0,0 @@ | |||
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 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 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.c b/arch/arm/mach-s3c24xx/irq.c new file mode 100644 index 000000000000..cb9f5e011e73 --- /dev/null +++ b/arch/arm/mach-s3c24xx/irq.c | |||
@@ -0,0 +1,822 @@ | |||
1 | /* | ||
2 | * S3C24XX IRQ handling | ||
3 | * | ||
4 | * Copyright (c) 2003-2004 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de> | ||
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 | |||
19 | #include <linux/init.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/err.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/irqdomain.h> | ||
28 | |||
29 | #include <asm/mach/irq.h> | ||
30 | |||
31 | #include <mach/regs-irq.h> | ||
32 | #include <mach/regs-gpio.h> | ||
33 | |||
34 | #include <plat/cpu.h> | ||
35 | #include <plat/regs-irqtype.h> | ||
36 | #include <plat/pm.h> | ||
37 | #include <plat/irq.h> | ||
38 | |||
39 | #define S3C_IRQTYPE_NONE 0 | ||
40 | #define S3C_IRQTYPE_EINT 1 | ||
41 | #define S3C_IRQTYPE_EDGE 2 | ||
42 | #define S3C_IRQTYPE_LEVEL 3 | ||
43 | |||
44 | struct s3c_irq_data { | ||
45 | unsigned int type; | ||
46 | unsigned long parent_irq; | ||
47 | |||
48 | /* data gets filled during init */ | ||
49 | struct s3c_irq_intc *intc; | ||
50 | unsigned long sub_bits; | ||
51 | struct s3c_irq_intc *sub_intc; | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * Sructure holding the controller data | ||
56 | * @reg_pending register holding pending irqs | ||
57 | * @reg_intpnd special register intpnd in main intc | ||
58 | * @reg_mask mask register | ||
59 | * @domain irq_domain of the controller | ||
60 | * @parent parent controller for ext and sub irqs | ||
61 | * @irqs irq-data, always s3c_irq_data[32] | ||
62 | */ | ||
63 | struct s3c_irq_intc { | ||
64 | void __iomem *reg_pending; | ||
65 | void __iomem *reg_intpnd; | ||
66 | void __iomem *reg_mask; | ||
67 | struct irq_domain *domain; | ||
68 | struct s3c_irq_intc *parent; | ||
69 | struct s3c_irq_data *irqs; | ||
70 | }; | ||
71 | |||
72 | static void s3c_irq_mask(struct irq_data *data) | ||
73 | { | ||
74 | struct s3c_irq_intc *intc = data->domain->host_data; | ||
75 | struct s3c_irq_intc *parent_intc = intc->parent; | ||
76 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
77 | struct s3c_irq_data *parent_data; | ||
78 | unsigned long mask; | ||
79 | unsigned int irqno; | ||
80 | |||
81 | mask = __raw_readl(intc->reg_mask); | ||
82 | mask |= (1UL << data->hwirq); | ||
83 | __raw_writel(mask, intc->reg_mask); | ||
84 | |||
85 | if (parent_intc && irq_data->parent_irq) { | ||
86 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; | ||
87 | |||
88 | /* check to see if we need to mask the parent IRQ */ | ||
89 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { | ||
90 | irqno = irq_find_mapping(parent_intc->domain, | ||
91 | irq_data->parent_irq); | ||
92 | s3c_irq_mask(irq_get_irq_data(irqno)); | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | static void s3c_irq_unmask(struct irq_data *data) | ||
98 | { | ||
99 | struct s3c_irq_intc *intc = data->domain->host_data; | ||
100 | struct s3c_irq_intc *parent_intc = intc->parent; | ||
101 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
102 | unsigned long mask; | ||
103 | unsigned int irqno; | ||
104 | |||
105 | mask = __raw_readl(intc->reg_mask); | ||
106 | mask &= ~(1UL << data->hwirq); | ||
107 | __raw_writel(mask, intc->reg_mask); | ||
108 | |||
109 | if (parent_intc && irq_data->parent_irq) { | ||
110 | irqno = irq_find_mapping(parent_intc->domain, | ||
111 | irq_data->parent_irq); | ||
112 | s3c_irq_unmask(irq_get_irq_data(irqno)); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | static inline void s3c_irq_ack(struct irq_data *data) | ||
117 | { | ||
118 | struct s3c_irq_intc *intc = data->domain->host_data; | ||
119 | unsigned long bitval = 1UL << data->hwirq; | ||
120 | |||
121 | __raw_writel(bitval, intc->reg_pending); | ||
122 | if (intc->reg_intpnd) | ||
123 | __raw_writel(bitval, intc->reg_intpnd); | ||
124 | } | ||
125 | |||
126 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, | ||
127 | void __iomem *extint_reg, | ||
128 | unsigned long gpcon_offset, | ||
129 | unsigned long extint_offset, | ||
130 | unsigned int type) | ||
131 | { | ||
132 | unsigned long newvalue = 0, value; | ||
133 | |||
134 | /* Set the GPIO to external interrupt mode */ | ||
135 | value = __raw_readl(gpcon_reg); | ||
136 | value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset); | ||
137 | __raw_writel(value, gpcon_reg); | ||
138 | |||
139 | /* Set the external interrupt to pointed trigger type */ | ||
140 | switch (type) | ||
141 | { | ||
142 | case IRQ_TYPE_NONE: | ||
143 | pr_warn("No edge setting!\n"); | ||
144 | break; | ||
145 | |||
146 | case IRQ_TYPE_EDGE_RISING: | ||
147 | newvalue = S3C2410_EXTINT_RISEEDGE; | ||
148 | break; | ||
149 | |||
150 | case IRQ_TYPE_EDGE_FALLING: | ||
151 | newvalue = S3C2410_EXTINT_FALLEDGE; | ||
152 | break; | ||
153 | |||
154 | case IRQ_TYPE_EDGE_BOTH: | ||
155 | newvalue = S3C2410_EXTINT_BOTHEDGE; | ||
156 | break; | ||
157 | |||
158 | case IRQ_TYPE_LEVEL_LOW: | ||
159 | newvalue = S3C2410_EXTINT_LOWLEV; | ||
160 | break; | ||
161 | |||
162 | case IRQ_TYPE_LEVEL_HIGH: | ||
163 | newvalue = S3C2410_EXTINT_HILEV; | ||
164 | break; | ||
165 | |||
166 | default: | ||
167 | pr_err("No such irq type %d", type); | ||
168 | return -EINVAL; | ||
169 | } | ||
170 | |||
171 | value = __raw_readl(extint_reg); | ||
172 | value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset); | ||
173 | __raw_writel(value, extint_reg); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | /* FIXME: make static when it's out of plat-samsung/irq.h */ | ||
179 | int s3c_irqext_type(struct irq_data *data, unsigned int type) | ||
180 | { | ||
181 | void __iomem *extint_reg; | ||
182 | void __iomem *gpcon_reg; | ||
183 | unsigned long gpcon_offset, extint_offset; | ||
184 | |||
185 | if ((data->hwirq >= 4) && (data->hwirq <= 7)) { | ||
186 | gpcon_reg = S3C2410_GPFCON; | ||
187 | extint_reg = S3C24XX_EXTINT0; | ||
188 | gpcon_offset = (data->hwirq) * 2; | ||
189 | extint_offset = (data->hwirq) * 4; | ||
190 | } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) { | ||
191 | gpcon_reg = S3C2410_GPGCON; | ||
192 | extint_reg = S3C24XX_EXTINT1; | ||
193 | gpcon_offset = (data->hwirq - 8) * 2; | ||
194 | extint_offset = (data->hwirq - 8) * 4; | ||
195 | } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) { | ||
196 | gpcon_reg = S3C2410_GPGCON; | ||
197 | extint_reg = S3C24XX_EXTINT2; | ||
198 | gpcon_offset = (data->hwirq - 8) * 2; | ||
199 | extint_offset = (data->hwirq - 16) * 4; | ||
200 | } else { | ||
201 | return -EINVAL; | ||
202 | } | ||
203 | |||
204 | return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset, | ||
205 | extint_offset, type); | ||
206 | } | ||
207 | |||
208 | static int s3c_irqext0_type(struct irq_data *data, unsigned int type) | ||
209 | { | ||
210 | void __iomem *extint_reg; | ||
211 | void __iomem *gpcon_reg; | ||
212 | unsigned long gpcon_offset, extint_offset; | ||
213 | |||
214 | if ((data->hwirq >= 0) && (data->hwirq <= 3)) { | ||
215 | gpcon_reg = S3C2410_GPFCON; | ||
216 | extint_reg = S3C24XX_EXTINT0; | ||
217 | gpcon_offset = (data->hwirq) * 2; | ||
218 | extint_offset = (data->hwirq) * 4; | ||
219 | } else { | ||
220 | return -EINVAL; | ||
221 | } | ||
222 | |||
223 | return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset, | ||
224 | extint_offset, type); | ||
225 | } | ||
226 | |||
227 | struct irq_chip s3c_irq_chip = { | ||
228 | .name = "s3c", | ||
229 | .irq_ack = s3c_irq_ack, | ||
230 | .irq_mask = s3c_irq_mask, | ||
231 | .irq_unmask = s3c_irq_unmask, | ||
232 | .irq_set_wake = s3c_irq_wake | ||
233 | }; | ||
234 | |||
235 | struct irq_chip s3c_irq_level_chip = { | ||
236 | .name = "s3c-level", | ||
237 | .irq_mask = s3c_irq_mask, | ||
238 | .irq_unmask = s3c_irq_unmask, | ||
239 | .irq_ack = s3c_irq_ack, | ||
240 | }; | ||
241 | |||
242 | static struct irq_chip s3c_irqext_chip = { | ||
243 | .name = "s3c-ext", | ||
244 | .irq_mask = s3c_irq_mask, | ||
245 | .irq_unmask = s3c_irq_unmask, | ||
246 | .irq_ack = s3c_irq_ack, | ||
247 | .irq_set_type = s3c_irqext_type, | ||
248 | .irq_set_wake = s3c_irqext_wake | ||
249 | }; | ||
250 | |||
251 | static struct irq_chip s3c_irq_eint0t4 = { | ||
252 | .name = "s3c-ext0", | ||
253 | .irq_ack = s3c_irq_ack, | ||
254 | .irq_mask = s3c_irq_mask, | ||
255 | .irq_unmask = s3c_irq_unmask, | ||
256 | .irq_set_wake = s3c_irq_wake, | ||
257 | .irq_set_type = s3c_irqext0_type, | ||
258 | }; | ||
259 | |||
260 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | ||
261 | { | ||
262 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
263 | struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; | ||
264 | struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; | ||
265 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; | ||
266 | unsigned long src; | ||
267 | unsigned long msk; | ||
268 | unsigned int n; | ||
269 | |||
270 | chained_irq_enter(chip, desc); | ||
271 | |||
272 | src = __raw_readl(sub_intc->reg_pending); | ||
273 | msk = __raw_readl(sub_intc->reg_mask); | ||
274 | |||
275 | src &= ~msk; | ||
276 | src &= irq_data->sub_bits; | ||
277 | |||
278 | while (src) { | ||
279 | n = __ffs(src); | ||
280 | src &= ~(1 << n); | ||
281 | generic_handle_irq(irq_find_mapping(sub_intc->domain, n)); | ||
282 | } | ||
283 | |||
284 | chained_irq_exit(chip, desc); | ||
285 | } | ||
286 | |||
287 | #ifdef CONFIG_FIQ | ||
288 | /** | ||
289 | * s3c24xx_set_fiq - set the FIQ routing | ||
290 | * @irq: IRQ number to route to FIQ on processor. | ||
291 | * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing. | ||
292 | * | ||
293 | * Change the state of the IRQ to FIQ routing depending on @irq and @on. If | ||
294 | * @on is true, the @irq is checked to see if it can be routed and the | ||
295 | * interrupt controller updated to route the IRQ. If @on is false, the FIQ | ||
296 | * routing is cleared, regardless of which @irq is specified. | ||
297 | */ | ||
298 | int s3c24xx_set_fiq(unsigned int irq, bool on) | ||
299 | { | ||
300 | u32 intmod; | ||
301 | unsigned offs; | ||
302 | |||
303 | if (on) { | ||
304 | offs = irq - FIQ_START; | ||
305 | if (offs > 31) | ||
306 | return -EINVAL; | ||
307 | |||
308 | intmod = 1 << offs; | ||
309 | } else { | ||
310 | intmod = 0; | ||
311 | } | ||
312 | |||
313 | __raw_writel(intmod, S3C2410_INTMOD); | ||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | EXPORT_SYMBOL_GPL(s3c24xx_set_fiq); | ||
318 | #endif | ||
319 | |||
320 | static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | ||
321 | irq_hw_number_t hw) | ||
322 | { | ||
323 | struct s3c_irq_intc *intc = h->host_data; | ||
324 | struct s3c_irq_data *irq_data = &intc->irqs[hw]; | ||
325 | struct s3c_irq_intc *parent_intc; | ||
326 | struct s3c_irq_data *parent_irq_data; | ||
327 | unsigned int irqno; | ||
328 | |||
329 | if (!intc) { | ||
330 | pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); | ||
331 | return -EINVAL; | ||
332 | } | ||
333 | |||
334 | if (!irq_data) { | ||
335 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); | ||
336 | return -EINVAL; | ||
337 | } | ||
338 | |||
339 | /* attach controller pointer to irq_data */ | ||
340 | irq_data->intc = intc; | ||
341 | |||
342 | /* set handler and flags */ | ||
343 | switch (irq_data->type) { | ||
344 | case S3C_IRQTYPE_NONE: | ||
345 | return 0; | ||
346 | case S3C_IRQTYPE_EINT: | ||
347 | if (irq_data->parent_irq) | ||
348 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, | ||
349 | handle_edge_irq); | ||
350 | else | ||
351 | irq_set_chip_and_handler(virq, &s3c_irq_eint0t4, | ||
352 | handle_edge_irq); | ||
353 | break; | ||
354 | case S3C_IRQTYPE_EDGE: | ||
355 | if (irq_data->parent_irq || | ||
356 | intc->reg_pending == S3C2416_SRCPND2) | ||
357 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | ||
358 | handle_edge_irq); | ||
359 | else | ||
360 | irq_set_chip_and_handler(virq, &s3c_irq_chip, | ||
361 | handle_edge_irq); | ||
362 | break; | ||
363 | case S3C_IRQTYPE_LEVEL: | ||
364 | if (irq_data->parent_irq) | ||
365 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | ||
366 | handle_level_irq); | ||
367 | else | ||
368 | irq_set_chip_and_handler(virq, &s3c_irq_chip, | ||
369 | handle_level_irq); | ||
370 | break; | ||
371 | default: | ||
372 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); | ||
373 | return -EINVAL; | ||
374 | } | ||
375 | set_irq_flags(virq, IRQF_VALID); | ||
376 | |||
377 | if (irq_data->parent_irq) { | ||
378 | parent_intc = intc->parent; | ||
379 | if (!parent_intc) { | ||
380 | pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", | ||
381 | hw); | ||
382 | goto err; | ||
383 | } | ||
384 | |||
385 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | ||
386 | if (!irq_data) { | ||
387 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", | ||
388 | hw); | ||
389 | goto err; | ||
390 | } | ||
391 | |||
392 | parent_irq_data->sub_intc = intc; | ||
393 | parent_irq_data->sub_bits |= (1UL << hw); | ||
394 | |||
395 | /* attach the demuxer to the parent irq */ | ||
396 | irqno = irq_find_mapping(parent_intc->domain, | ||
397 | irq_data->parent_irq); | ||
398 | if (!irqno) { | ||
399 | pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n", | ||
400 | irq_data->parent_irq); | ||
401 | goto err; | ||
402 | } | ||
403 | irq_set_chained_handler(irqno, s3c_irq_demux); | ||
404 | } | ||
405 | |||
406 | return 0; | ||
407 | |||
408 | err: | ||
409 | set_irq_flags(virq, 0); | ||
410 | |||
411 | /* the only error can result from bad mapping data*/ | ||
412 | return -EINVAL; | ||
413 | } | ||
414 | |||
415 | static struct irq_domain_ops s3c24xx_irq_ops = { | ||
416 | .map = s3c24xx_irq_map, | ||
417 | .xlate = irq_domain_xlate_twocell, | ||
418 | }; | ||
419 | |||
420 | static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) | ||
421 | { | ||
422 | void __iomem *reg_source; | ||
423 | unsigned long pend; | ||
424 | unsigned long last; | ||
425 | int i; | ||
426 | |||
427 | /* if intpnd is set, read the next pending irq from there */ | ||
428 | reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending; | ||
429 | |||
430 | last = 0; | ||
431 | for (i = 0; i < 4; i++) { | ||
432 | pend = __raw_readl(reg_source); | ||
433 | |||
434 | if (pend == 0 || pend == last) | ||
435 | break; | ||
436 | |||
437 | __raw_writel(pend, intc->reg_pending); | ||
438 | if (intc->reg_intpnd) | ||
439 | __raw_writel(pend, intc->reg_intpnd); | ||
440 | |||
441 | pr_info("irq: clearing pending status %08x\n", (int)pend); | ||
442 | last = pend; | ||
443 | } | ||
444 | } | ||
445 | |||
446 | struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | ||
447 | struct s3c_irq_data *irq_data, | ||
448 | struct s3c_irq_intc *parent, | ||
449 | unsigned long address) | ||
450 | { | ||
451 | struct s3c_irq_intc *intc; | ||
452 | void __iomem *base = (void *)0xf6000000; /* static mapping */ | ||
453 | int irq_num; | ||
454 | int irq_start; | ||
455 | int irq_offset; | ||
456 | int ret; | ||
457 | |||
458 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); | ||
459 | if (!intc) | ||
460 | return ERR_PTR(-ENOMEM); | ||
461 | |||
462 | intc->irqs = irq_data; | ||
463 | |||
464 | if (parent) | ||
465 | intc->parent = parent; | ||
466 | |||
467 | /* select the correct data for the controller. | ||
468 | * Need to hard code the irq num start and offset | ||
469 | * to preserve the static mapping for now | ||
470 | */ | ||
471 | switch (address) { | ||
472 | case 0x4a000000: | ||
473 | pr_debug("irq: found main intc\n"); | ||
474 | intc->reg_pending = base; | ||
475 | intc->reg_mask = base + 0x08; | ||
476 | intc->reg_intpnd = base + 0x10; | ||
477 | irq_num = 32; | ||
478 | irq_start = S3C2410_IRQ(0); | ||
479 | irq_offset = 0; | ||
480 | break; | ||
481 | case 0x4a000018: | ||
482 | pr_debug("irq: found subintc\n"); | ||
483 | intc->reg_pending = base + 0x18; | ||
484 | intc->reg_mask = base + 0x1c; | ||
485 | irq_num = 29; | ||
486 | irq_start = S3C2410_IRQSUB(0); | ||
487 | irq_offset = 0; | ||
488 | break; | ||
489 | case 0x4a000040: | ||
490 | pr_debug("irq: found intc2\n"); | ||
491 | intc->reg_pending = base + 0x40; | ||
492 | intc->reg_mask = base + 0x48; | ||
493 | intc->reg_intpnd = base + 0x50; | ||
494 | irq_num = 8; | ||
495 | irq_start = S3C2416_IRQ(0); | ||
496 | irq_offset = 0; | ||
497 | break; | ||
498 | case 0x560000a4: | ||
499 | pr_debug("irq: found eintc\n"); | ||
500 | base = (void *)0xfd000000; | ||
501 | |||
502 | intc->reg_mask = base + 0xa4; | ||
503 | intc->reg_pending = base + 0x08; | ||
504 | irq_num = 20; | ||
505 | irq_start = S3C2410_IRQ(32); | ||
506 | irq_offset = 4; | ||
507 | break; | ||
508 | default: | ||
509 | pr_err("irq: unsupported controller address\n"); | ||
510 | ret = -EINVAL; | ||
511 | goto err; | ||
512 | } | ||
513 | |||
514 | /* now that all the data is complete, init the irq-domain */ | ||
515 | s3c24xx_clear_intc(intc); | ||
516 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, | ||
517 | irq_offset, &s3c24xx_irq_ops, | ||
518 | intc); | ||
519 | if (!intc->domain) { | ||
520 | pr_err("irq: could not create irq-domain\n"); | ||
521 | ret = -EINVAL; | ||
522 | goto err; | ||
523 | } | ||
524 | |||
525 | return intc; | ||
526 | |||
527 | err: | ||
528 | kfree(intc); | ||
529 | return ERR_PTR(ret); | ||
530 | } | ||
531 | |||
532 | /* s3c24xx_init_irq | ||
533 | * | ||
534 | * Initialise S3C2410 IRQ system | ||
535 | */ | ||
536 | |||
537 | static struct s3c_irq_data init_base[32] = { | ||
538 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
539 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
540 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
541 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
542 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
543 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
544 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
545 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
546 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
547 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ | ||
548 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
549 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
550 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
551 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
552 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
553 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
554 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
555 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
556 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
557 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
558 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
559 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ | ||
560 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
561 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
562 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
563 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
564 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
565 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
566 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
567 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
568 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
569 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
570 | }; | ||
571 | |||
572 | static struct s3c_irq_data init_eint[32] = { | ||
573 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
574 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
575 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
576 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
577 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | ||
578 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | ||
579 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | ||
580 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ | ||
581 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ | ||
582 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ | ||
583 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ | ||
584 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ | ||
585 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ | ||
586 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ | ||
587 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ | ||
588 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ | ||
589 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ | ||
590 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ | ||
591 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ | ||
592 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ | ||
593 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ | ||
594 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ | ||
595 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ | ||
596 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | ||
597 | }; | ||
598 | |||
599 | static struct s3c_irq_data init_subint[32] = { | ||
600 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
601 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
602 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
603 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
604 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
605 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
606 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
607 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
608 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
609 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
610 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
611 | }; | ||
612 | |||
613 | void __init s3c24xx_init_irq(void) | ||
614 | { | ||
615 | struct s3c_irq_intc *main_intc; | ||
616 | |||
617 | #ifdef CONFIG_FIQ | ||
618 | init_FIQ(FIQ_START); | ||
619 | #endif | ||
620 | |||
621 | main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); | ||
622 | if (IS_ERR(main_intc)) { | ||
623 | pr_err("irq: could not create main interrupt controller\n"); | ||
624 | return; | ||
625 | } | ||
626 | |||
627 | s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); | ||
628 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | ||
629 | } | ||
630 | |||
631 | #ifdef CONFIG_CPU_S3C2416 | ||
632 | static struct s3c_irq_data init_s3c2416base[32] = { | ||
633 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
634 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
635 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
636 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
637 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
638 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
639 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
640 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
641 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
642 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ | ||
643 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
644 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
645 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
646 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
647 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
648 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
649 | { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */ | ||
650 | { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */ | ||
651 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */ | ||
652 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
653 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */ | ||
654 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */ | ||
655 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
656 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
657 | { .type = S3C_IRQTYPE_EDGE, }, /* NAND */ | ||
658 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
659 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
660 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
661 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
662 | { .type = S3C_IRQTYPE_NONE, }, | ||
663 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
664 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
665 | }; | ||
666 | |||
667 | static struct s3c_irq_data init_s3c2416subint[32] = { | ||
668 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
669 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
670 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
671 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
672 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
673 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
674 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
675 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
676 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
677 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
678 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
679 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
680 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
681 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
682 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
683 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */ | ||
684 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */ | ||
685 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */ | ||
686 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */ | ||
687 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */ | ||
688 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */ | ||
689 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */ | ||
690 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */ | ||
691 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */ | ||
692 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */ | ||
693 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */ | ||
694 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */ | ||
695 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ | ||
696 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ | ||
697 | }; | ||
698 | |||
699 | static struct s3c_irq_data init_s3c2416_second[32] = { | ||
700 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ | ||
701 | { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ | ||
702 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
703 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
704 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ | ||
705 | { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ | ||
706 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ | ||
707 | { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ | ||
708 | }; | ||
709 | |||
710 | void __init s3c2416_init_irq(void) | ||
711 | { | ||
712 | struct s3c_irq_intc *main_intc; | ||
713 | |||
714 | pr_info("S3C2416: IRQ Support\n"); | ||
715 | |||
716 | #ifdef CONFIG_FIQ | ||
717 | init_FIQ(FIQ_START); | ||
718 | #endif | ||
719 | |||
720 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); | ||
721 | if (IS_ERR(main_intc)) { | ||
722 | pr_err("irq: could not create main interrupt controller\n"); | ||
723 | return; | ||
724 | } | ||
725 | |||
726 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | ||
727 | s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018); | ||
728 | |||
729 | s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); | ||
730 | } | ||
731 | |||
732 | #endif | ||
733 | |||
734 | #ifdef CONFIG_CPU_S3C2443 | ||
735 | static struct s3c_irq_data init_s3c2443base[32] = { | ||
736 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
737 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
738 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
739 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
740 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
741 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
742 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ | ||
743 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
744 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
745 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ | ||
746 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
747 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
748 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
749 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
750 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
751 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
752 | { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */ | ||
753 | { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */ | ||
754 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */ | ||
755 | { .type = S3C_IRQTYPE_EDGE, }, /* CFON */ | ||
756 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */ | ||
757 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */ | ||
758 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
759 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
760 | { .type = S3C_IRQTYPE_EDGE, }, /* NAND */ | ||
761 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
762 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
763 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
764 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
765 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
766 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
767 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
768 | }; | ||
769 | |||
770 | |||
771 | static struct s3c_irq_data init_s3c2443subint[32] = { | ||
772 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
773 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
774 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
775 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
776 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
777 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
778 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
779 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
780 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
781 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
782 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
783 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ | ||
784 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ | ||
785 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | ||
786 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */ | ||
787 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */ | ||
788 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */ | ||
789 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */ | ||
790 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */ | ||
791 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */ | ||
792 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */ | ||
793 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */ | ||
794 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */ | ||
795 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */ | ||
796 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */ | ||
797 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */ | ||
798 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */ | ||
799 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ | ||
800 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ | ||
801 | }; | ||
802 | |||
803 | void __init s3c2443_init_irq(void) | ||
804 | { | ||
805 | struct s3c_irq_intc *main_intc; | ||
806 | |||
807 | pr_info("S3C2443: IRQ Support\n"); | ||
808 | |||
809 | #ifdef CONFIG_FIQ | ||
810 | init_FIQ(FIQ_START); | ||
811 | #endif | ||
812 | |||
813 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); | ||
814 | if (IS_ERR(main_intc)) { | ||
815 | pr_err("irq: could not create main interrupt controller\n"); | ||
816 | return; | ||
817 | } | ||
818 | |||
819 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | ||
820 | s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018); | ||
821 | } | ||
822 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c index f4ad99c1e476..0e0279e79150 100644 --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c | |||
@@ -237,6 +237,6 @@ MACHINE_START(AML_M5900, "AML_M5900") | |||
237 | .map_io = amlm5900_map_io, | 237 | .map_io = amlm5900_map_io, |
238 | .init_irq = s3c24xx_init_irq, | 238 | .init_irq = s3c24xx_init_irq, |
239 | .init_machine = amlm5900_init, | 239 | .init_machine = amlm5900_init, |
240 | .timer = &s3c24xx_timer, | 240 | .init_time = s3c24xx_timer_init, |
241 | .restart = s3c2410_restart, | 241 | .restart = s3c2410_restart, |
242 | MACHINE_END | 242 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c index 1ee8c4638743..bb595f15ce36 100644 --- a/arch/arm/mach-s3c24xx/mach-anubis.c +++ b/arch/arm/mach-s3c24xx/mach-anubis.c | |||
@@ -28,17 +28,12 @@ | |||
28 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
29 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
30 | 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> | 31 | #include <mach/hardware.h> |
36 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
37 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
38 | 34 | ||
39 | #include <plat/regs-serial.h> | 35 | #include <plat/regs-serial.h> |
40 | #include <mach/regs-gpio.h> | 36 | #include <mach/regs-gpio.h> |
41 | #include <mach/regs-mem.h> | ||
42 | #include <mach/regs-lcd.h> | 37 | #include <mach/regs-lcd.h> |
43 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 38 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
44 | #include <linux/platform_data/i2c-s3c2410.h> | 39 | #include <linux/platform_data/i2c-s3c2410.h> |
@@ -55,8 +50,9 @@ | |||
55 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
56 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 51 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> |
57 | 52 | ||
58 | #include "simtec.h" | 53 | #include "anubis.h" |
59 | #include "common.h" | 54 | #include "common.h" |
55 | #include "simtec.h" | ||
60 | 56 | ||
61 | #define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics" | 57 | #define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics" |
62 | 58 | ||
@@ -237,7 +233,7 @@ static struct pata_platform_info anubis_ide_platdata = { | |||
237 | static struct resource anubis_ide0_resource[] = { | 233 | static struct resource anubis_ide0_resource[] = { |
238 | [0] = DEFINE_RES_MEM(S3C2410_CS3, 8 * 32), | 234 | [0] = DEFINE_RES_MEM(S3C2410_CS3, 8 * 32), |
239 | [2] = DEFINE_RES_MEM(S3C2410_CS3 + (1 << 26) + (6 * 32), 32), | 235 | [2] = DEFINE_RES_MEM(S3C2410_CS3 + (1 << 26) + (6 * 32), 32), |
240 | [3] = DEFINE_RES_IRQ(IRQ_IDE0), | 236 | [3] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0), |
241 | }; | 237 | }; |
242 | 238 | ||
243 | static struct platform_device anubis_device_ide0 = { | 239 | static struct platform_device anubis_device_ide0 = { |
@@ -254,7 +250,7 @@ static struct platform_device anubis_device_ide0 = { | |||
254 | static struct resource anubis_ide1_resource[] = { | 250 | static struct resource anubis_ide1_resource[] = { |
255 | [0] = DEFINE_RES_MEM(S3C2410_CS4, 8 * 32), | 251 | [0] = DEFINE_RES_MEM(S3C2410_CS4, 8 * 32), |
256 | [1] = DEFINE_RES_MEM(S3C2410_CS4 + (1 << 26) + (6 * 32), 32), | 252 | [1] = DEFINE_RES_MEM(S3C2410_CS4 + (1 << 26) + (6 * 32), 32), |
257 | [2] = DEFINE_RES_IRQ(IRQ_IDE0), | 253 | [2] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0), |
258 | }; | 254 | }; |
259 | 255 | ||
260 | static struct platform_device anubis_device_ide1 = { | 256 | static struct platform_device anubis_device_ide1 = { |
@@ -279,7 +275,7 @@ static struct ax_plat_data anubis_asix_platdata = { | |||
279 | 275 | ||
280 | static struct resource anubis_asix_resource[] = { | 276 | static struct resource anubis_asix_resource[] = { |
281 | [0] = DEFINE_RES_MEM(S3C2410_CS5, 0x20 * 0x20), | 277 | [0] = DEFINE_RES_MEM(S3C2410_CS5, 0x20 * 0x20), |
282 | [1] = DEFINE_RES_IRQ(IRQ_ASIX), | 278 | [1] = DEFINE_RES_IRQ(ANUBIS_IRQ_ASIX), |
283 | }; | 279 | }; |
284 | 280 | ||
285 | static struct platform_device anubis_device_asix = { | 281 | static struct platform_device anubis_device_asix = { |
@@ -448,6 +444,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis") | |||
448 | .map_io = anubis_map_io, | 444 | .map_io = anubis_map_io, |
449 | .init_machine = anubis_init, | 445 | .init_machine = anubis_init, |
450 | .init_irq = s3c24xx_init_irq, | 446 | .init_irq = s3c24xx_init_irq, |
451 | .timer = &s3c24xx_timer, | 447 | .init_time = s3c24xx_timer_init, |
452 | .restart = s3c244x_restart, | 448 | .restart = s3c244x_restart, |
453 | MACHINE_END | 449 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c index 00381fe5de32..b4bc60c78ebb 100644 --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/gpio.h> | ||
17 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
18 | #include <linux/list.h> | 19 | #include <linux/list.h> |
19 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
@@ -34,7 +35,6 @@ | |||
34 | 35 | ||
35 | #include <plat/regs-serial.h> | 36 | #include <plat/regs-serial.h> |
36 | #include <mach/regs-gpio.h> | 37 | #include <mach/regs-gpio.h> |
37 | #include <mach/regs-mem.h> | ||
38 | #include <mach/regs-lcd.h> | 38 | #include <mach/regs-lcd.h> |
39 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 39 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
40 | #include <linux/platform_data/i2c-s3c2410.h> | 40 | #include <linux/platform_data/i2c-s3c2410.h> |
@@ -210,6 +210,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB") | |||
210 | .map_io = at2440evb_map_io, | 210 | .map_io = at2440evb_map_io, |
211 | .init_machine = at2440evb_init, | 211 | .init_machine = at2440evb_init, |
212 | .init_irq = s3c24xx_init_irq, | 212 | .init_irq = s3c24xx_init_irq, |
213 | .timer = &s3c24xx_timer, | 213 | .init_time = s3c24xx_timer_init, |
214 | .restart = s3c244x_restart, | 214 | .restart = s3c244x_restart, |
215 | MACHINE_END | 215 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c index 6a30ce7e4aa7..ca6618081041 100644 --- a/arch/arm/mach-s3c24xx/mach-bast.c +++ b/arch/arm/mach-s3c24xx/mach-bast.c | |||
@@ -24,48 +24,41 @@ | |||
24 | #include <linux/ata_platform.h> | 24 | #include <linux/ata_platform.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/serial_8250.h> | ||
28 | |||
29 | #include <linux/mtd/mtd.h> | ||
30 | #include <linux/mtd/nand.h> | ||
31 | #include <linux/mtd/nand_ecc.h> | ||
32 | #include <linux/mtd/partitions.h> | ||
33 | |||
34 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | ||
35 | #include <linux/platform_data/hwmon-s3c.h> | ||
36 | #include <linux/platform_data/i2c-s3c2410.h> | ||
37 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
27 | 38 | ||
28 | #include <net/ax88796.h> | 39 | #include <net/ax88796.h> |
29 | 40 | ||
41 | #include <asm/irq.h> | ||
30 | #include <asm/mach/arch.h> | 42 | #include <asm/mach/arch.h> |
31 | #include <asm/mach/map.h> | 43 | #include <asm/mach/map.h> |
32 | #include <asm/mach/irq.h> | 44 | #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> | 45 | #include <asm/mach-types.h> |
41 | 46 | ||
42 | //#include <asm/debug-ll.h> | 47 | #include <mach/fb.h> |
43 | #include <plat/regs-serial.h> | 48 | #include <mach/hardware.h> |
44 | #include <mach/regs-gpio.h> | 49 | #include <mach/regs-gpio.h> |
45 | #include <mach/regs-mem.h> | ||
46 | #include <mach/regs-lcd.h> | 50 | #include <mach/regs-lcd.h> |
47 | 51 | ||
48 | #include <linux/platform_data/hwmon-s3c.h> | ||
49 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
50 | #include <linux/platform_data/i2c-s3c2410.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> | 52 | #include <plat/clock.h> |
61 | #include <plat/devs.h> | ||
62 | #include <plat/cpu.h> | 53 | #include <plat/cpu.h> |
63 | #include <plat/cpu-freq.h> | 54 | #include <plat/cpu-freq.h> |
55 | #include <plat/devs.h> | ||
64 | #include <plat/gpio-cfg.h> | 56 | #include <plat/gpio-cfg.h> |
65 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 57 | #include <plat/regs-serial.h> |
66 | 58 | ||
67 | #include "simtec.h" | 59 | #include "bast.h" |
68 | #include "common.h" | 60 | #include "common.h" |
61 | #include "simtec.h" | ||
69 | 62 | ||
70 | #define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics" | 63 | #define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics" |
71 | 64 | ||
@@ -312,7 +305,7 @@ static struct s3c2410_platform_nand __initdata bast_nand_info = { | |||
312 | static struct resource bast_dm9k_resource[] = { | 305 | static struct resource bast_dm9k_resource[] = { |
313 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4), | 306 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4), |
314 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40), | 307 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40), |
315 | [2] = DEFINE_RES_NAMED(IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \ | 308 | [2] = DEFINE_RES_NAMED(BAST_IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \ |
316 | | IORESOURCE_IRQ_HIGHLEVEL), | 309 | | IORESOURCE_IRQ_HIGHLEVEL), |
317 | }; | 310 | }; |
318 | 311 | ||
@@ -343,7 +336,7 @@ static struct platform_device bast_device_dm9k = { | |||
343 | static struct plat_serial8250_port bast_sio_data[] = { | 336 | static struct plat_serial8250_port bast_sio_data[] = { |
344 | [0] = { | 337 | [0] = { |
345 | .mapbase = SERIAL_BASE + 0x2f8, | 338 | .mapbase = SERIAL_BASE + 0x2f8, |
346 | .irq = IRQ_PCSERIAL1, | 339 | .irq = BAST_IRQ_PCSERIAL1, |
347 | .flags = SERIAL_FLAGS, | 340 | .flags = SERIAL_FLAGS, |
348 | .iotype = UPIO_MEM, | 341 | .iotype = UPIO_MEM, |
349 | .regshift = 0, | 342 | .regshift = 0, |
@@ -351,7 +344,7 @@ static struct plat_serial8250_port bast_sio_data[] = { | |||
351 | }, | 344 | }, |
352 | [1] = { | 345 | [1] = { |
353 | .mapbase = SERIAL_BASE + 0x3f8, | 346 | .mapbase = SERIAL_BASE + 0x3f8, |
354 | .irq = IRQ_PCSERIAL2, | 347 | .irq = BAST_IRQ_PCSERIAL2, |
355 | .flags = SERIAL_FLAGS, | 348 | .flags = SERIAL_FLAGS, |
356 | .iotype = UPIO_MEM, | 349 | .iotype = UPIO_MEM, |
357 | .regshift = 0, | 350 | .regshift = 0, |
@@ -390,7 +383,7 @@ static struct ax_plat_data bast_asix_platdata = { | |||
390 | static struct resource bast_asix_resource[] = { | 383 | static struct resource bast_asix_resource[] = { |
391 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20), | 384 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20), |
392 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1), | 385 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1), |
393 | [2] = DEFINE_RES_IRQ(IRQ_ASIX), | 386 | [2] = DEFINE_RES_IRQ(BAST_IRQ_ASIX), |
394 | }; | 387 | }; |
395 | 388 | ||
396 | static struct platform_device bast_device_asix = { | 389 | static struct platform_device bast_device_asix = { |
@@ -612,6 +605,6 @@ MACHINE_START(BAST, "Simtec-BAST") | |||
612 | .map_io = bast_map_io, | 605 | .map_io = bast_map_io, |
613 | .init_irq = s3c24xx_init_irq, | 606 | .init_irq = s3c24xx_init_irq, |
614 | .init_machine = bast_init, | 607 | .init_machine = bast_init, |
615 | .timer = &s3c24xx_timer, | 608 | .init_time = s3c24xx_timer_init, |
616 | .restart = s3c2410_restart, | 609 | .restart = s3c2410_restart, |
617 | MACHINE_END | 610 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c index 973b87ca87f4..a25e8c5a7b4c 100644 --- a/arch/arm/mach-s3c24xx/mach-gta02.c +++ b/arch/arm/mach-s3c24xx/mach-gta02.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-s3c2442/mach-gta02.c | ||
3 | * | ||
4 | * S3C2442 Machine Support for Openmoko GTA02 / FreeRunner. | 2 | * S3C2442 Machine Support for Openmoko GTA02 / FreeRunner. |
5 | * | 3 | * |
6 | * Copyright (C) 2006-2009 by Openmoko, Inc. | 4 | * Copyright (C) 2006-2009 by Openmoko, Inc. |
@@ -23,7 +21,6 @@ | |||
23 | * along with this program; if not, write to the Free Software | 21 | * along with this program; if not, write to the Free Software |
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
25 | * MA 02111-1307 USA | 23 | * MA 02111-1307 USA |
26 | * | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
@@ -34,62 +31,59 @@ | |||
34 | #include <linux/timer.h> | 31 | #include <linux/timer.h> |
35 | #include <linux/init.h> | 32 | #include <linux/init.h> |
36 | #include <linux/gpio.h> | 33 | #include <linux/gpio.h> |
34 | #include <linux/gpio_keys.h> | ||
37 | #include <linux/workqueue.h> | 35 | #include <linux/workqueue.h> |
38 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
39 | #include <linux/serial_core.h> | 37 | #include <linux/serial_core.h> |
40 | #include <linux/spi/spi.h> | 38 | #include <linux/input.h> |
41 | #include <linux/spi/s3c24xx.h> | 39 | #include <linux/io.h> |
40 | #include <linux/i2c.h> | ||
42 | 41 | ||
43 | #include <linux/mmc/host.h> | 42 | #include <linux/mmc/host.h> |
44 | 43 | ||
44 | #include <linux/mfd/pcf50633/adc.h> | ||
45 | #include <linux/mfd/pcf50633/backlight.h> | ||
46 | #include <linux/mfd/pcf50633/core.h> | ||
47 | #include <linux/mfd/pcf50633/gpio.h> | ||
48 | #include <linux/mfd/pcf50633/mbc.h> | ||
49 | #include <linux/mfd/pcf50633/pmic.h> | ||
50 | |||
45 | #include <linux/mtd/mtd.h> | 51 | #include <linux/mtd/mtd.h> |
46 | #include <linux/mtd/nand.h> | 52 | #include <linux/mtd/nand.h> |
47 | #include <linux/mtd/nand_ecc.h> | 53 | #include <linux/mtd/nand_ecc.h> |
48 | #include <linux/mtd/partitions.h> | 54 | #include <linux/mtd/partitions.h> |
49 | #include <linux/mtd/physmap.h> | 55 | #include <linux/mtd/physmap.h> |
50 | #include <linux/io.h> | ||
51 | 56 | ||
52 | #include <linux/i2c.h> | ||
53 | #include <linux/regulator/machine.h> | 57 | #include <linux/regulator/machine.h> |
54 | 58 | ||
55 | #include <linux/mfd/pcf50633/core.h> | 59 | #include <linux/spi/spi.h> |
56 | #include <linux/mfd/pcf50633/mbc.h> | 60 | #include <linux/spi/s3c24xx.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 | 61 | ||
62 | #include <asm/irq.h> | ||
63 | #include <asm/mach-types.h> | ||
65 | #include <asm/mach/arch.h> | 64 | #include <asm/mach/arch.h> |
66 | #include <asm/mach/map.h> | 65 | #include <asm/mach/map.h> |
67 | #include <asm/mach/irq.h> | 66 | #include <asm/mach/irq.h> |
68 | 67 | ||
69 | #include <asm/irq.h> | 68 | #include <linux/platform_data/i2c-s3c2410.h> |
70 | #include <asm/mach-types.h> | 69 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
70 | #include <linux/platform_data/touchscreen-s3c2410.h> | ||
71 | #include <linux/platform_data/usb-ohci-s3c2410.h> | ||
72 | #include <linux/platform_data/usb-s3c2410_udc.h> | ||
71 | 73 | ||
72 | #include <mach/regs-irq.h> | ||
73 | #include <mach/regs-gpio.h> | ||
74 | #include <mach/fb.h> | 74 | #include <mach/fb.h> |
75 | |||
76 | #include <linux/platform_data/usb-ohci-s3c2410.h> | ||
77 | #include <mach/regs-mem.h> | ||
78 | #include <mach/hardware.h> | 75 | #include <mach/hardware.h> |
76 | #include <mach/regs-gpio.h> | ||
77 | #include <mach/regs-irq.h> | ||
79 | 78 | ||
80 | #include <mach/gta02.h> | ||
81 | |||
82 | #include <plat/regs-serial.h> | ||
83 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
84 | #include <plat/devs.h> | ||
85 | #include <plat/cpu.h> | 79 | #include <plat/cpu.h> |
86 | #include <plat/pm.h> | 80 | #include <plat/devs.h> |
87 | #include <linux/platform_data/usb-s3c2410_udc.h> | ||
88 | #include <plat/gpio-cfg.h> | 81 | #include <plat/gpio-cfg.h> |
89 | #include <linux/platform_data/i2c-s3c2410.h> | 82 | #include <plat/pm.h> |
90 | #include <linux/platform_data/touchscreen-s3c2410.h> | 83 | #include <plat/regs-serial.h> |
91 | 84 | ||
92 | #include "common.h" | 85 | #include "common.h" |
86 | #include "gta02.h" | ||
93 | 87 | ||
94 | static struct pcf50633 *gta02_pcf; | 88 | static struct pcf50633 *gta02_pcf; |
95 | 89 | ||
@@ -595,6 +589,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02") | |||
595 | .map_io = gta02_map_io, | 589 | .map_io = gta02_map_io, |
596 | .init_irq = s3c24xx_init_irq, | 590 | .init_irq = s3c24xx_init_irq, |
597 | .init_machine = gta02_machine_init, | 591 | .init_machine = gta02_machine_init, |
598 | .timer = &s3c24xx_timer, | 592 | .init_time = s3c24xx_timer_init, |
599 | .restart = s3c244x_restart, | 593 | .restart = s3c244x_restart, |
600 | MACHINE_END | 594 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index b23dd1b106e8..79bc0830d740 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-h1940.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | 2 | * Copyright (c) 2003-2005 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 3 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 4 | * |
@@ -37,40 +36,36 @@ | |||
37 | #include <linux/mmc/host.h> | 36 | #include <linux/mmc/host.h> |
38 | #include <linux/export.h> | 37 | #include <linux/export.h> |
39 | 38 | ||
39 | #include <asm/irq.h> | ||
40 | #include <asm/mach-types.h> | ||
40 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
41 | #include <asm/mach/map.h> | 42 | #include <asm/mach/map.h> |
42 | #include <asm/mach/irq.h> | 43 | #include <asm/mach/irq.h> |
43 | 44 | ||
44 | #include <mach/hardware.h> | 45 | #include <linux/platform_data/i2c-s3c2410.h> |
45 | #include <asm/irq.h> | 46 | #include <linux/platform_data/mmc-s3cmci.h> |
46 | #include <asm/mach-types.h> | 47 | #include <linux/platform_data/touchscreen-s3c2410.h> |
47 | 48 | #include <linux/platform_data/usb-s3c2410_udc.h> | |
48 | #include <plat/regs-serial.h> | ||
49 | #include <mach/regs-lcd.h> | ||
50 | #include <mach/regs-clock.h> | ||
51 | 49 | ||
52 | #include <mach/regs-gpio.h> | 50 | #include <sound/uda1380.h> |
53 | #include <mach/gpio-fns.h> | ||
54 | #include <mach/gpio-nrs.h> | ||
55 | 51 | ||
56 | #include <mach/h1940.h> | ||
57 | #include <mach/h1940-latch.h> | ||
58 | #include <mach/fb.h> | 52 | #include <mach/fb.h> |
59 | #include <linux/platform_data/usb-s3c2410_udc.h> | 53 | #include <mach/hardware.h> |
60 | #include <linux/platform_data/i2c-s3c2410.h> | 54 | #include <mach/regs-clock.h> |
55 | #include <mach/regs-gpio.h> | ||
56 | #include <mach/regs-lcd.h> | ||
61 | 57 | ||
62 | #include <plat/gpio-cfg.h> | ||
63 | #include <plat/clock.h> | 58 | #include <plat/clock.h> |
64 | #include <plat/devs.h> | ||
65 | #include <plat/cpu.h> | 59 | #include <plat/cpu.h> |
60 | #include <plat/devs.h> | ||
61 | #include <plat/gpio-cfg.h> | ||
66 | #include <plat/pll.h> | 62 | #include <plat/pll.h> |
67 | #include <plat/pm.h> | 63 | #include <plat/pm.h> |
68 | #include <linux/platform_data/mmc-s3cmci.h> | 64 | #include <plat/regs-serial.h> |
69 | #include <linux/platform_data/touchscreen-s3c2410.h> | ||
70 | 65 | ||
71 | #include <sound/uda1380.h> | ||
72 | 66 | ||
73 | #include "common.h" | 67 | #include "common.h" |
68 | #include "h1940.h" | ||
74 | 69 | ||
75 | #define H1940_LATCH ((void __force __iomem *)0xF8000000) | 70 | #define H1940_LATCH ((void __force __iomem *)0xF8000000) |
76 | 71 | ||
@@ -746,6 +741,6 @@ MACHINE_START(H1940, "IPAQ-H1940") | |||
746 | .reserve = h1940_reserve, | 741 | .reserve = h1940_reserve, |
747 | .init_irq = h1940_init_irq, | 742 | .init_irq = h1940_init_irq, |
748 | .init_machine = h1940_init, | 743 | .init_machine = h1940_init, |
749 | .timer = &s3c24xx_timer, | 744 | .init_time = s3c24xx_timer_init, |
750 | .restart = s3c2410_restart, | 745 | .restart = s3c2410_restart, |
751 | MACHINE_END | 746 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c index c9954e26b492..54e83c1f780c 100644 --- a/arch/arm/mach-s3c24xx/mach-jive.c +++ b/arch/arm/mach-s3c24xx/mach-jive.c | |||
@@ -35,9 +35,7 @@ | |||
35 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 35 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
36 | #include <linux/platform_data/i2c-s3c2410.h> | 36 | #include <linux/platform_data/i2c-s3c2410.h> |
37 | 37 | ||
38 | #include <mach/regs-power.h> | ||
39 | #include <mach/regs-gpio.h> | 38 | #include <mach/regs-gpio.h> |
40 | #include <mach/regs-mem.h> | ||
41 | #include <mach/regs-lcd.h> | 39 | #include <mach/regs-lcd.h> |
42 | #include <mach/fb.h> | 40 | #include <mach/fb.h> |
43 | 41 | ||
@@ -56,6 +54,8 @@ | |||
56 | #include <plat/pm.h> | 54 | #include <plat/pm.h> |
57 | #include <linux/platform_data/usb-s3c2410_udc.h> | 55 | #include <linux/platform_data/usb-s3c2410_udc.h> |
58 | 56 | ||
57 | #include "s3c2412-power.h" | ||
58 | |||
59 | static struct map_desc jive_iodesc[] __initdata = { | 59 | static struct map_desc jive_iodesc[] __initdata = { |
60 | }; | 60 | }; |
61 | 61 | ||
@@ -661,6 +661,6 @@ MACHINE_START(JIVE, "JIVE") | |||
661 | .init_irq = s3c24xx_init_irq, | 661 | .init_irq = s3c24xx_init_irq, |
662 | .map_io = jive_map_io, | 662 | .map_io = jive_map_io, |
663 | .init_machine = jive_machine_init, | 663 | .init_machine = jive_machine_init, |
664 | .timer = &s3c24xx_timer, | 664 | .init_time = s3c24xx_timer_init, |
665 | .restart = s3c2412_restart, | 665 | .restart = s3c2412_restart, |
666 | MACHINE_END | 666 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c index a31d5b83e5f7..2865e5919f2c 100644 --- a/arch/arm/mach-s3c24xx/mach-mini2440.c +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <plat/regs-serial.h> | 40 | #include <plat/regs-serial.h> |
41 | #include <mach/regs-gpio.h> | 41 | #include <mach/regs-gpio.h> |
42 | #include <linux/platform_data/leds-s3c24xx.h> | 42 | #include <linux/platform_data/leds-s3c24xx.h> |
43 | #include <mach/regs-mem.h> | ||
44 | #include <mach/regs-lcd.h> | 43 | #include <mach/regs-lcd.h> |
45 | #include <mach/irqs.h> | 44 | #include <mach/irqs.h> |
46 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 45 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
@@ -688,6 +687,6 @@ MACHINE_START(MINI2440, "MINI2440") | |||
688 | .map_io = mini2440_map_io, | 687 | .map_io = mini2440_map_io, |
689 | .init_machine = mini2440_init, | 688 | .init_machine = mini2440_init, |
690 | .init_irq = s3c24xx_init_irq, | 689 | .init_irq = s3c24xx_init_irq, |
691 | .timer = &s3c24xx_timer, | 690 | .init_time = s3c24xx_timer_init, |
692 | .restart = s3c244x_restart, | 691 | .restart = s3c244x_restart, |
693 | MACHINE_END | 692 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c index c53a9bfe1417..d9d04b240295 100644 --- a/arch/arm/mach-s3c24xx/mach-n30.c +++ b/arch/arm/mach-s3c24xx/mach-n30.c | |||
@@ -589,7 +589,7 @@ MACHINE_START(N30, "Acer-N30") | |||
589 | Ben Dooks <ben-linux@fluff.org> | 589 | Ben Dooks <ben-linux@fluff.org> |
590 | */ | 590 | */ |
591 | .atag_offset = 0x100, | 591 | .atag_offset = 0x100, |
592 | .timer = &s3c24xx_timer, | 592 | .init_time = s3c24xx_timer_init, |
593 | .init_machine = n30_init, | 593 | .init_machine = n30_init, |
594 | .init_irq = s3c24xx_init_irq, | 594 | .init_irq = s3c24xx_init_irq, |
595 | .map_io = n30_map_io, | 595 | .map_io = n30_map_io, |
@@ -600,7 +600,7 @@ MACHINE_START(N35, "Acer-N35") | |||
600 | /* Maintainer: Christer Weinigel <christer@weinigel.se> | 600 | /* Maintainer: Christer Weinigel <christer@weinigel.se> |
601 | */ | 601 | */ |
602 | .atag_offset = 0x100, | 602 | .atag_offset = 0x100, |
603 | .timer = &s3c24xx_timer, | 603 | .init_time = s3c24xx_timer_init, |
604 | .init_machine = n30_init, | 604 | .init_machine = n30_init, |
605 | .init_irq = s3c24xx_init_irq, | 605 | .init_irq = s3c24xx_init_irq, |
606 | .map_io = n30_map_io, | 606 | .map_io = n30_map_io, |
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c index a2b92b0898e2..a454e2461860 100644 --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c | |||
@@ -153,6 +153,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | |||
153 | .map_io = nexcoder_map_io, | 153 | .map_io = nexcoder_map_io, |
154 | .init_machine = nexcoder_init, | 154 | .init_machine = nexcoder_init, |
155 | .init_irq = s3c24xx_init_irq, | 155 | .init_irq = s3c24xx_init_irq, |
156 | .timer = &s3c24xx_timer, | 156 | .init_time = s3c24xx_timer_init, |
157 | .restart = s3c244x_restart, | 157 | .restart = s3c244x_restart, |
158 | MACHINE_END | 158 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c index c52100ef2322..ae2cbdf3e3ca 100644 --- a/arch/arm/mach-s3c24xx/mach-osiris.c +++ b/arch/arm/mach-s3c24xx/mach-osiris.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-osiris.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2005-2008 Simtec Electronics | 2 | * Copyright (c) 2005-2008 Simtec Electronics |
4 | * http://armlinux.simtec.co.uk/ | 3 | * http://armlinux.simtec.co.uk/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
@@ -26,22 +25,12 @@ | |||
26 | 25 | ||
27 | #include <linux/i2c/tps65010.h> | 26 | #include <linux/i2c/tps65010.h> |
28 | 27 | ||
28 | #include <asm/mach-types.h> | ||
29 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
30 | #include <asm/mach/map.h> | 30 | #include <asm/mach/map.h> |
31 | #include <asm/mach/irq.h> | 31 | #include <asm/mach/irq.h> |
32 | |||
33 | #include <mach/osiris-map.h> | ||
34 | #include <mach/osiris-cpld.h> | ||
35 | |||
36 | #include <mach/hardware.h> | ||
37 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
38 | #include <asm/mach-types.h> | ||
39 | 33 | ||
40 | #include <plat/cpu-freq.h> | ||
41 | #include <plat/regs-serial.h> | ||
42 | #include <mach/regs-gpio.h> | ||
43 | #include <mach/regs-mem.h> | ||
44 | #include <mach/regs-lcd.h> | ||
45 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 34 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
46 | #include <linux/platform_data/i2c-s3c2410.h> | 35 | #include <linux/platform_data/i2c-s3c2410.h> |
47 | 36 | ||
@@ -50,12 +39,20 @@ | |||
50 | #include <linux/mtd/nand_ecc.h> | 39 | #include <linux/mtd/nand_ecc.h> |
51 | #include <linux/mtd/partitions.h> | 40 | #include <linux/mtd/partitions.h> |
52 | 41 | ||
53 | #include <plat/gpio-cfg.h> | ||
54 | #include <plat/clock.h> | 42 | #include <plat/clock.h> |
55 | #include <plat/devs.h> | ||
56 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/cpu-freq.h> | ||
45 | #include <plat/devs.h> | ||
46 | #include <plat/gpio-cfg.h> | ||
47 | #include <plat/regs-serial.h> | ||
48 | |||
49 | #include <mach/hardware.h> | ||
50 | #include <mach/regs-gpio.h> | ||
51 | #include <mach/regs-lcd.h> | ||
57 | 52 | ||
58 | #include "common.h" | 53 | #include "common.h" |
54 | #include "osiris.h" | ||
55 | #include "regs-mem.h" | ||
59 | 56 | ||
60 | /* onboard perihperal map */ | 57 | /* onboard perihperal map */ |
61 | 58 | ||
@@ -429,6 +426,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS") | |||
429 | .map_io = osiris_map_io, | 426 | .map_io = osiris_map_io, |
430 | .init_irq = s3c24xx_init_irq, | 427 | .init_irq = s3c24xx_init_irq, |
431 | .init_machine = osiris_init, | 428 | .init_machine = osiris_init, |
432 | .timer = &s3c24xx_timer, | 429 | .init_time = s3c24xx_timer_init, |
433 | .restart = s3c244x_restart, | 430 | .restart = s3c244x_restart, |
434 | MACHINE_END | 431 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c index bca39f0232b3..40a47d6c6a85 100644 --- a/arch/arm/mach-s3c24xx/mach-otom.c +++ b/arch/arm/mach-s3c24xx/mach-otom.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-otom.c | 1 | /* |
2 | * | 2 | * |
3 | * Copyright (c) 2004 Nex Vision | 3 | * Copyright (c) 2004 Nex Vision |
4 | * Guillaume GOURAT <guillaume.gourat@nexvision.fr> | 4 | * Guillaume GOURAT <guillaume.gourat@nexvision.fr> |
@@ -6,7 +6,6 @@ | |||
6 | * This program is free software; you can redistribute it and/or modify | 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 | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | ||
10 | */ | 9 | */ |
11 | 10 | ||
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
@@ -19,26 +18,25 @@ | |||
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
20 | #include <linux/io.h> | 19 | #include <linux/io.h> |
21 | 20 | ||
21 | #include <linux/platform_data/i2c-s3c2410.h> | ||
22 | |||
23 | #include <asm/irq.h> | ||
24 | #include <asm/mach-types.h> | ||
22 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
24 | #include <asm/mach/irq.h> | 27 | #include <asm/mach/irq.h> |
25 | 28 | ||
26 | #include <mach/otom-map.h> | ||
27 | |||
28 | #include <mach/hardware.h> | 29 | #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> | 30 | #include <mach/regs-gpio.h> |
34 | 31 | ||
35 | #include <plat/s3c2410.h> | ||
36 | #include <plat/clock.h> | 32 | #include <plat/clock.h> |
37 | #include <plat/devs.h> | ||
38 | #include <linux/platform_data/i2c-s3c2410.h> | ||
39 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
34 | #include <plat/devs.h> | ||
35 | #include <plat/regs-serial.h> | ||
36 | #include <plat/s3c2410.h> | ||
40 | 37 | ||
41 | #include "common.h" | 38 | #include "common.h" |
39 | #include "otom.h" | ||
42 | 40 | ||
43 | static struct map_desc otom11_iodesc[] __initdata = { | 41 | static struct map_desc otom11_iodesc[] __initdata = { |
44 | /* Device area */ | 42 | /* Device area */ |
@@ -118,6 +116,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | |||
118 | .map_io = otom11_map_io, | 116 | .map_io = otom11_map_io, |
119 | .init_machine = otom11_init, | 117 | .init_machine = otom11_init, |
120 | .init_irq = s3c24xx_init_irq, | 118 | .init_irq = s3c24xx_init_irq, |
121 | .timer = &s3c24xx_timer, | 119 | .init_time = s3c24xx_timer_init, |
122 | .restart = s3c2410_restart, | 120 | .restart = s3c2410_restart, |
123 | MACHINE_END | 121 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c index 7b6ba13d7285..56175f0941b1 100644 --- a/arch/arm/mach-s3c24xx/mach-qt2410.c +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c | |||
@@ -343,6 +343,6 @@ MACHINE_START(QT2410, "QT2410") | |||
343 | .map_io = qt2410_map_io, | 343 | .map_io = qt2410_map_io, |
344 | .init_irq = s3c24xx_init_irq, | 344 | .init_irq = s3c24xx_init_irq, |
345 | .init_machine = qt2410_machine_init, | 345 | .init_machine = qt2410_machine_init, |
346 | .timer = &s3c24xx_timer, | 346 | .init_time = s3c24xx_timer_init, |
347 | .restart = s3c2410_restart, | 347 | .restart = s3c2410_restart, |
348 | MACHINE_END | 348 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index 0606f2faaa5c..1f9ba2ae5288 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-rx1950.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev, | 2 | * Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev, |
4 | * Copyright (c) 2007-2010 Vasily Khoruzhick | 3 | * Copyright (c) 2007-2010 Vasily Khoruzhick |
5 | * | 4 | * |
@@ -37,31 +36,31 @@ | |||
37 | 36 | ||
38 | #include <linux/mmc/host.h> | 37 | #include <linux/mmc/host.h> |
39 | 38 | ||
39 | #include <asm/mach-types.h> | ||
40 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
41 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
42 | #include <asm/mach-types.h> | ||
43 | 42 | ||
43 | #include <linux/platform_data/i2c-s3c2410.h> | ||
44 | #include <linux/platform_data/mmc-s3cmci.h> | ||
45 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
46 | #include <linux/platform_data/touchscreen-s3c2410.h> | ||
47 | #include <linux/platform_data/usb-s3c2410_udc.h> | ||
48 | |||
49 | #include <sound/uda1380.h> | ||
50 | |||
51 | #include <mach/fb.h> | ||
44 | #include <mach/regs-gpio.h> | 52 | #include <mach/regs-gpio.h> |
45 | #include <mach/regs-lcd.h> | 53 | #include <mach/regs-lcd.h> |
46 | #include <mach/h1940.h> | ||
47 | #include <mach/fb.h> | ||
48 | 54 | ||
49 | #include <plat/clock.h> | 55 | #include <plat/clock.h> |
50 | #include <plat/regs-serial.h> | ||
51 | #include <plat/regs-iic.h> | ||
52 | #include <linux/platform_data/mmc-s3cmci.h> | ||
53 | #include <linux/platform_data/usb-s3c2410_udc.h> | ||
54 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
55 | #include <linux/platform_data/i2c-s3c2410.h> | ||
56 | #include <plat/devs.h> | ||
57 | #include <plat/cpu.h> | 56 | #include <plat/cpu.h> |
57 | #include <plat/devs.h> | ||
58 | #include <plat/pm.h> | 58 | #include <plat/pm.h> |
59 | #include <plat/irq.h> | 59 | #include <plat/regs-iic.h> |
60 | #include <linux/platform_data/touchscreen-s3c2410.h> | 60 | #include <plat/regs-serial.h> |
61 | |||
62 | #include <sound/uda1380.h> | ||
63 | 61 | ||
64 | #include "common.h" | 62 | #include "common.h" |
63 | #include "h1940.h" | ||
65 | 64 | ||
66 | #define LCD_PWM_PERIOD 192960 | 65 | #define LCD_PWM_PERIOD 192960 |
67 | #define LCD_PWM_DUTY 127353 | 66 | #define LCD_PWM_DUTY 127353 |
@@ -814,6 +813,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950") | |||
814 | .reserve = rx1950_reserve, | 813 | .reserve = rx1950_reserve, |
815 | .init_irq = s3c24xx_init_irq, | 814 | .init_irq = s3c24xx_init_irq, |
816 | .init_machine = rx1950_init_machine, | 815 | .init_machine = rx1950_init_machine, |
817 | .timer = &s3c24xx_timer, | 816 | .init_time = s3c24xx_timer_init, |
818 | .restart = s3c244x_restart, | 817 | .restart = s3c244x_restart, |
819 | MACHINE_END | 818 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c index dacbb9a2122a..f20418a2fb1b 100644 --- a/arch/arm/mach-s3c24xx/mach-rx3715.c +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c | |||
@@ -31,27 +31,27 @@ | |||
31 | #include <linux/mtd/partitions.h> | 31 | #include <linux/mtd/partitions.h> |
32 | 32 | ||
33 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
34 | #include <asm/mach/map.h> | ||
35 | #include <asm/mach/irq.h> | 34 | #include <asm/mach/irq.h> |
35 | #include <asm/mach/map.h> | ||
36 | |||
37 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
36 | 38 | ||
37 | #include <mach/hardware.h> | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
40 | 41 | ||
41 | #include <plat/regs-serial.h> | 42 | #include <mach/fb.h> |
43 | #include <mach/hardware.h> | ||
42 | #include <mach/regs-gpio.h> | 44 | #include <mach/regs-gpio.h> |
43 | #include <mach/regs-lcd.h> | 45 | #include <mach/regs-lcd.h> |
44 | 46 | ||
45 | #include <mach/h1940.h> | ||
46 | #include <linux/platform_data/mtd-nand-s3c2410.h> | ||
47 | #include <mach/fb.h> | ||
48 | |||
49 | #include <plat/clock.h> | 47 | #include <plat/clock.h> |
50 | #include <plat/devs.h> | ||
51 | #include <plat/cpu.h> | 48 | #include <plat/cpu.h> |
49 | #include <plat/devs.h> | ||
52 | #include <plat/pm.h> | 50 | #include <plat/pm.h> |
51 | #include <plat/regs-serial.h> | ||
53 | 52 | ||
54 | #include "common.h" | 53 | #include "common.h" |
54 | #include "h1940.h" | ||
55 | 55 | ||
56 | static struct map_desc rx3715_iodesc[] __initdata = { | 56 | static struct map_desc rx3715_iodesc[] __initdata = { |
57 | /* dump ISA space somewhere unused */ | 57 | /* dump ISA space somewhere unused */ |
@@ -212,6 +212,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715") | |||
212 | .reserve = rx3715_reserve, | 212 | .reserve = rx3715_reserve, |
213 | .init_irq = rx3715_init_irq, | 213 | .init_irq = rx3715_init_irq, |
214 | .init_machine = rx3715_init_machine, | 214 | .init_machine = rx3715_init_machine, |
215 | .timer = &s3c24xx_timer, | 215 | .init_time = s3c24xx_timer_init, |
216 | .restart = s3c244x_restart, | 216 | .restart = s3c244x_restart, |
217 | MACHINE_END | 217 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c index 82796b97cb04..e184bfa9613a 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c | |||
@@ -117,6 +117,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc | |||
117 | .map_io = smdk2410_map_io, | 117 | .map_io = smdk2410_map_io, |
118 | .init_irq = s3c24xx_init_irq, | 118 | .init_irq = s3c24xx_init_irq, |
119 | .init_machine = smdk2410_init, | 119 | .init_machine = smdk2410_init, |
120 | .timer = &s3c24xx_timer, | 120 | .init_time = s3c24xx_timer_init, |
121 | .restart = s3c2410_restart, | 121 | .restart = s3c2410_restart, |
122 | MACHINE_END | 122 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c index ce99fd8bbbc5..86d7847c9d45 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <mach/regs-gpio.h> | 37 | #include <mach/regs-gpio.h> |
38 | #include <mach/regs-lcd.h> | 38 | #include <mach/regs-lcd.h> |
39 | 39 | ||
40 | #include <mach/idle.h> | ||
41 | #include <linux/platform_data/usb-s3c2410_udc.h> | 40 | #include <linux/platform_data/usb-s3c2410_udc.h> |
42 | #include <linux/platform_data/i2c-s3c2410.h> | 41 | #include <linux/platform_data/i2c-s3c2410.h> |
43 | #include <mach/fb.h> | 42 | #include <mach/fb.h> |
@@ -133,7 +132,7 @@ MACHINE_START(S3C2413, "S3C2413") | |||
133 | .init_irq = s3c24xx_init_irq, | 132 | .init_irq = s3c24xx_init_irq, |
134 | .map_io = smdk2413_map_io, | 133 | .map_io = smdk2413_map_io, |
135 | .init_machine = smdk2413_machine_init, | 134 | .init_machine = smdk2413_machine_init, |
136 | .timer = &s3c24xx_timer, | 135 | .init_time = s3c24xx_timer_init, |
137 | .restart = s3c2412_restart, | 136 | .restart = s3c2412_restart, |
138 | MACHINE_END | 137 | MACHINE_END |
139 | 138 | ||
@@ -145,7 +144,7 @@ MACHINE_START(SMDK2412, "SMDK2412") | |||
145 | .init_irq = s3c24xx_init_irq, | 144 | .init_irq = s3c24xx_init_irq, |
146 | .map_io = smdk2413_map_io, | 145 | .map_io = smdk2413_map_io, |
147 | .init_machine = smdk2413_machine_init, | 146 | .init_machine = smdk2413_machine_init, |
148 | .timer = &s3c24xx_timer, | 147 | .init_time = s3c24xx_timer_init, |
149 | .restart = s3c2412_restart, | 148 | .restart = s3c2412_restart, |
150 | MACHINE_END | 149 | MACHINE_END |
151 | 150 | ||
@@ -157,6 +156,6 @@ MACHINE_START(SMDK2413, "SMDK2413") | |||
157 | .init_irq = s3c24xx_init_irq, | 156 | .init_irq = s3c24xx_init_irq, |
158 | .map_io = smdk2413_map_io, | 157 | .map_io = smdk2413_map_io, |
159 | .init_machine = smdk2413_machine_init, | 158 | .init_machine = smdk2413_machine_init, |
160 | .timer = &s3c24xx_timer, | 159 | .init_time = s3c24xx_timer_init, |
161 | .restart = s3c2412_restart, | 160 | .restart = s3c2412_restart, |
162 | MACHINE_END | 161 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c index f30d7fccbfee..ebb2e61f3d07 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <mach/regs-lcd.h> | 39 | #include <mach/regs-lcd.h> |
40 | #include <mach/regs-s3c2443-clock.h> | 40 | #include <mach/regs-s3c2443-clock.h> |
41 | 41 | ||
42 | #include <mach/idle.h> | ||
43 | #include <linux/platform_data/leds-s3c24xx.h> | 42 | #include <linux/platform_data/leds-s3c24xx.h> |
44 | #include <linux/platform_data/i2c-s3c2410.h> | 43 | #include <linux/platform_data/i2c-s3c2410.h> |
45 | 44 | ||
@@ -251,9 +250,9 @@ MACHINE_START(SMDK2416, "SMDK2416") | |||
251 | /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */ | 250 | /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */ |
252 | .atag_offset = 0x100, | 251 | .atag_offset = 0x100, |
253 | 252 | ||
254 | .init_irq = s3c24xx_init_irq, | 253 | .init_irq = s3c2416_init_irq, |
255 | .map_io = smdk2416_map_io, | 254 | .map_io = smdk2416_map_io, |
256 | .init_machine = smdk2416_machine_init, | 255 | .init_machine = smdk2416_machine_init, |
257 | .timer = &s3c24xx_timer, | 256 | .init_time = s3c24xx_timer_init, |
258 | .restart = s3c2416_restart, | 257 | .restart = s3c2416_restart, |
259 | MACHINE_END | 258 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c index b7ff882c6ce6..08cc38c8a4ae 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
36 | #include <mach/regs-lcd.h> | 36 | #include <mach/regs-lcd.h> |
37 | 37 | ||
38 | #include <mach/idle.h> | ||
39 | #include <mach/fb.h> | 38 | #include <mach/fb.h> |
40 | #include <linux/platform_data/i2c-s3c2410.h> | 39 | #include <linux/platform_data/i2c-s3c2410.h> |
41 | 40 | ||
@@ -182,6 +181,6 @@ MACHINE_START(S3C2440, "SMDK2440") | |||
182 | .init_irq = s3c24xx_init_irq, | 181 | .init_irq = s3c24xx_init_irq, |
183 | .map_io = smdk2440_map_io, | 182 | .map_io = smdk2440_map_io, |
184 | .init_machine = smdk2440_machine_init, | 183 | .init_machine = smdk2440_machine_init, |
185 | .timer = &s3c24xx_timer, | 184 | .init_time = s3c24xx_timer_init, |
186 | .restart = s3c244x_restart, | 185 | .restart = s3c244x_restart, |
187 | MACHINE_END | 186 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c index 2568656f046f..fc65d74d3c73 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
36 | #include <mach/regs-lcd.h> | 36 | #include <mach/regs-lcd.h> |
37 | 37 | ||
38 | #include <mach/idle.h> | ||
39 | #include <mach/fb.h> | 38 | #include <mach/fb.h> |
40 | #include <linux/platform_data/i2c-s3c2410.h> | 39 | #include <linux/platform_data/i2c-s3c2410.h> |
41 | 40 | ||
@@ -141,9 +140,9 @@ MACHINE_START(SMDK2443, "SMDK2443") | |||
141 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | 140 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
142 | .atag_offset = 0x100, | 141 | .atag_offset = 0x100, |
143 | 142 | ||
144 | .init_irq = s3c24xx_init_irq, | 143 | .init_irq = s3c2443_init_irq, |
145 | .map_io = smdk2443_map_io, | 144 | .map_io = smdk2443_map_io, |
146 | .init_machine = smdk2443_machine_init, | 145 | .init_machine = smdk2443_machine_init, |
147 | .timer = &s3c24xx_timer, | 146 | .init_time = s3c24xx_timer_init, |
148 | .restart = s3c2443_restart, | 147 | .restart = s3c2443_restart, |
149 | MACHINE_END | 148 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 495bf5cf52e9..24b3d79e7b2c 100644 --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c | |||
@@ -149,6 +149,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER") | |||
149 | .map_io = tct_hammer_map_io, | 149 | .map_io = tct_hammer_map_io, |
150 | .init_irq = s3c24xx_init_irq, | 150 | .init_irq = s3c24xx_init_irq, |
151 | .init_machine = tct_hammer_init, | 151 | .init_machine = tct_hammer_init, |
152 | .timer = &s3c24xx_timer, | 152 | .init_time = s3c24xx_timer_init, |
153 | .restart = s3c2410_restart, | 153 | .restart = s3c2410_restart, |
154 | MACHINE_END | 154 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c index 14d5b12e388c..ec42d1e4e465 100644 --- a/arch/arm/mach-s3c24xx/mach-vr1000.c +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/mach-vr1000.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2003-2008 Simtec Electronics | 2 | * Copyright (c) 2003-2008 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 3 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 4 | * |
@@ -32,27 +31,25 @@ | |||
32 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
33 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
34 | 33 | ||
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> | 34 | #include <asm/irq.h> |
42 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
43 | 36 | ||
44 | #include <plat/regs-serial.h> | ||
45 | #include <mach/regs-gpio.h> | ||
46 | #include <linux/platform_data/leds-s3c24xx.h> | 37 | #include <linux/platform_data/leds-s3c24xx.h> |
38 | #include <linux/platform_data/i2c-s3c2410.h> | ||
39 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | ||
40 | |||
41 | #include <mach/hardware.h> | ||
42 | #include <mach/regs-gpio.h> | ||
47 | 43 | ||
48 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
49 | #include <plat/devs.h> | ||
50 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
51 | #include <linux/platform_data/i2c-s3c2410.h> | 46 | #include <plat/devs.h> |
52 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 47 | #include <plat/regs-serial.h> |
53 | 48 | ||
54 | #include "simtec.h" | 49 | #include "bast.h" |
55 | #include "common.h" | 50 | #include "common.h" |
51 | #include "simtec.h" | ||
52 | #include "vr1000.h" | ||
56 | 53 | ||
57 | /* macros for virtual address mods for the io space entries */ | 54 | /* macros for virtual address mods for the io space entries */ |
58 | #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) | 55 | #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) |
@@ -143,7 +140,7 @@ static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = { | |||
143 | static struct plat_serial8250_port serial_platform_data[] = { | 140 | static struct plat_serial8250_port serial_platform_data[] = { |
144 | [0] = { | 141 | [0] = { |
145 | .mapbase = VR1000_SERIAL_MAPBASE(0), | 142 | .mapbase = VR1000_SERIAL_MAPBASE(0), |
146 | .irq = IRQ_VR1000_SERIAL + 0, | 143 | .irq = VR1000_IRQ_SERIAL + 0, |
147 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | 144 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
148 | .iotype = UPIO_MEM, | 145 | .iotype = UPIO_MEM, |
149 | .regshift = 0, | 146 | .regshift = 0, |
@@ -151,7 +148,7 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
151 | }, | 148 | }, |
152 | [1] = { | 149 | [1] = { |
153 | .mapbase = VR1000_SERIAL_MAPBASE(1), | 150 | .mapbase = VR1000_SERIAL_MAPBASE(1), |
154 | .irq = IRQ_VR1000_SERIAL + 1, | 151 | .irq = VR1000_IRQ_SERIAL + 1, |
155 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | 152 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
156 | .iotype = UPIO_MEM, | 153 | .iotype = UPIO_MEM, |
157 | .regshift = 0, | 154 | .regshift = 0, |
@@ -159,7 +156,7 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
159 | }, | 156 | }, |
160 | [2] = { | 157 | [2] = { |
161 | .mapbase = VR1000_SERIAL_MAPBASE(2), | 158 | .mapbase = VR1000_SERIAL_MAPBASE(2), |
162 | .irq = IRQ_VR1000_SERIAL + 2, | 159 | .irq = VR1000_IRQ_SERIAL + 2, |
163 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | 160 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
164 | .iotype = UPIO_MEM, | 161 | .iotype = UPIO_MEM, |
165 | .regshift = 0, | 162 | .regshift = 0, |
@@ -167,7 +164,7 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
167 | }, | 164 | }, |
168 | [3] = { | 165 | [3] = { |
169 | .mapbase = VR1000_SERIAL_MAPBASE(3), | 166 | .mapbase = VR1000_SERIAL_MAPBASE(3), |
170 | .irq = IRQ_VR1000_SERIAL + 3, | 167 | .irq = VR1000_IRQ_SERIAL + 3, |
171 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, | 168 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
172 | .iotype = UPIO_MEM, | 169 | .iotype = UPIO_MEM, |
173 | .regshift = 0, | 170 | .regshift = 0, |
@@ -189,14 +186,14 @@ static struct platform_device serial_device = { | |||
189 | static struct resource vr1000_dm9k0_resource[] = { | 186 | static struct resource vr1000_dm9k0_resource[] = { |
190 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4), | 187 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4), |
191 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40), | 188 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40), |
192 | [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000A, 1, NULL, IORESOURCE_IRQ \ | 189 | [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000A, 1, NULL, IORESOURCE_IRQ \ |
193 | | IORESOURCE_IRQ_HIGHLEVEL), | 190 | | IORESOURCE_IRQ_HIGHLEVEL), |
194 | }; | 191 | }; |
195 | 192 | ||
196 | static struct resource vr1000_dm9k1_resource[] = { | 193 | static struct resource vr1000_dm9k1_resource[] = { |
197 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4), | 194 | [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4), |
198 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40), | 195 | [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40), |
199 | [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000N, 1, NULL, IORESOURCE_IRQ \ | 196 | [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000N, 1, NULL, IORESOURCE_IRQ \ |
200 | | IORESOURCE_IRQ_HIGHLEVEL), | 197 | | IORESOURCE_IRQ_HIGHLEVEL), |
201 | }; | 198 | }; |
202 | 199 | ||
@@ -357,6 +354,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000") | |||
357 | .map_io = vr1000_map_io, | 354 | .map_io = vr1000_map_io, |
358 | .init_machine = vr1000_init, | 355 | .init_machine = vr1000_init, |
359 | .init_irq = s3c24xx_init_irq, | 356 | .init_irq = s3c24xx_init_irq, |
360 | .timer = &s3c24xx_timer, | 357 | .init_time = s3c24xx_timer_init, |
361 | .restart = s3c2410_restart, | 358 | .restart = s3c2410_restart, |
362 | MACHINE_END | 359 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c index f1d44ae11833..3e2bfddc9df1 100644 --- a/arch/arm/mach-s3c24xx/mach-vstms.c +++ b/arch/arm/mach-s3c24xx/mach-vstms.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <mach/regs-gpio.h> | 36 | #include <mach/regs-gpio.h> |
37 | #include <mach/regs-lcd.h> | 37 | #include <mach/regs-lcd.h> |
38 | 38 | ||
39 | #include <mach/idle.h> | ||
40 | #include <mach/fb.h> | 39 | #include <mach/fb.h> |
41 | 40 | ||
42 | #include <linux/platform_data/i2c-s3c2410.h> | 41 | #include <linux/platform_data/i2c-s3c2410.h> |
@@ -161,6 +160,6 @@ MACHINE_START(VSTMS, "VSTMS") | |||
161 | .init_irq = s3c24xx_init_irq, | 160 | .init_irq = s3c24xx_init_irq, |
162 | .init_machine = vstms_init, | 161 | .init_machine = vstms_init, |
163 | .map_io = vstms_map_io, | 162 | .map_io = vstms_map_io, |
164 | .timer = &s3c24xx_timer, | 163 | .init_time = s3c24xx_timer_init, |
165 | .restart = s3c2412_restart, | 164 | .restart = s3c2412_restart, |
166 | MACHINE_END | 165 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/include/mach/osiris-map.h b/arch/arm/mach-s3c24xx/osiris.h index 17380f848428..b8d56074abac 100644 --- a/arch/arm/mach-s3c24xx/include/mach/osiris-map.h +++ b/arch/arm/mach-s3c24xx/osiris.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/osiris-map.h | 1 | /* |
2 | * | ||
3 | * Copyright 2005 Simtec Electronics | 2 | * Copyright 2005 Simtec Electronics |
4 | * http://www.simtec.co.uk/products/ | 3 | * http://www.simtec.co.uk/products/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
6 | * | 5 | * |
6 | * OSIRIS - CPLD control constants | ||
7 | * OSIRIS - Memory map definitions | 7 | * OSIRIS - Memory map definitions |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
@@ -11,10 +11,21 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* needs arch/map.h including with this */ | 14 | #ifndef __MACH_S3C24XX_OSIRIS_H |
15 | #define __MACH_S3C24XX_OSIRIS_H __FILE__ | ||
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) | ||
15 | 27 | ||
16 | #ifndef __ASM_ARCH_OSIRISMAP_H | 28 | #define OSIRIS_ID_REVMASK (0x7) |
17 | #define __ASM_ARCH_OSIRISMAP_H | ||
18 | 29 | ||
19 | /* start peripherals off after the S3C2410 */ | 30 | /* start peripherals off after the S3C2410 */ |
20 | 31 | ||
@@ -39,4 +50,4 @@ | |||
39 | #define OSIRIS_VA_IDREG OSIRIS_IOADDR(0x00700000) | 50 | #define OSIRIS_VA_IDREG OSIRIS_IOADDR(0x00700000) |
40 | #define OSIRIS_PA_IDREG (OSIRIS_PA_CPLD + (7<<23)) | 51 | #define OSIRIS_PA_IDREG (OSIRIS_PA_CPLD + (7<<23)) |
41 | 52 | ||
42 | #endif /* __ASM_ARCH_OSIRISMAP_H */ | 53 | #endif /* __MACH_S3C24XX_OSIRIS_H */ |
diff --git a/arch/arm/mach-s3c24xx/include/mach/otom-map.h b/arch/arm/mach-s3c24xx/otom.h index f9277a52c145..321b7be1c0f7 100644 --- a/arch/arm/mach-s3c24xx/include/mach/otom-map.h +++ b/arch/arm/mach-s3c24xx/otom.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/otom-map.h | 1 | /* |
2 | * | ||
3 | * (c) 2005 Guillaume GOURAT / NexVision | 2 | * (c) 2005 Guillaume GOURAT / NexVision |
4 | * guillaume.gourat@nexvision.fr | 3 | * guillaume.gourat@nexvision.fr |
5 | * | 4 | * |
@@ -10,21 +9,20 @@ | |||
10 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
11 | */ | 10 | */ |
12 | 11 | ||
13 | /* needs arch/map.h including with this */ | 12 | /* |
14 | 13 | * ok, we've used up to 0x01300000, now we need to find space for the | |
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 | 14 | * peripherals that live in the nGCS[x] areas, which are quite numerous |
17 | * in their space. | 15 | * in their space. |
18 | */ | 16 | */ |
19 | 17 | ||
20 | #ifndef __ASM_ARCH_OTOMMAP_H | 18 | #ifndef __MACH_S3C24XX_OTOM_H |
21 | #define __ASM_ARCH_OTOMMAP_H | 19 | #define __MACH_S3C24XX_OTOM_H __FILE__ |
22 | 20 | ||
23 | #define OTOM_PA_CS8900A_BASE (S3C2410_CS3 + 0x01000000) /* nGCS3 +0x01000000 */ | 21 | #define OTOM_PA_CS8900A_BASE (S3C2410_CS3 + 0x01000000) /* nGCS3 +0x01000000 */ |
24 | #define OTOM_VA_CS8900A_BASE S3C2410_ADDR(0x04000000) /* 0xF4000000 */ | 22 | #define OTOM_VA_CS8900A_BASE S3C2410_ADDR(0x04000000) /* 0xF4000000 */ |
25 | 23 | ||
26 | /* physical offset addresses for the peripherals */ | 24 | /* physical offset addresses for the peripherals */ |
27 | 25 | ||
28 | #define OTOM_PA_FLASH0_BASE (S3C2410_CS0) /* Bank 0 */ | 26 | #define OTOM_PA_FLASH0_BASE (S3C2410_CS0) |
29 | 27 | ||
30 | #endif /* __ASM_ARCH_OTOMMAP_H */ | 28 | #endif /* __MACH_S3C24XX_OTOM_H */ |
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2410.c b/arch/arm/mach-s3c24xx/pll-s3c2410.c new file mode 100644 index 000000000000..dcf3420a3271 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pll-s3c2410.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2007 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * Vincent Sanders <vince@arm.linux.org.uk> | ||
6 | * | ||
7 | * S3C2410 CPU PLL tables | ||
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/types.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/list.h> | ||
29 | #include <linux/clk.h> | ||
30 | #include <linux/err.h> | ||
31 | |||
32 | #include <plat/cpu.h> | ||
33 | #include <plat/cpu-freq-core.h> | ||
34 | |||
35 | static struct cpufreq_frequency_table pll_vals_12MHz[] = { | ||
36 | { .frequency = 34000000, .index = PLLVAL(82, 2, 3), }, | ||
37 | { .frequency = 45000000, .index = PLLVAL(82, 1, 3), }, | ||
38 | { .frequency = 51000000, .index = PLLVAL(161, 3, 3), }, | ||
39 | { .frequency = 48000000, .index = PLLVAL(120, 2, 3), }, | ||
40 | { .frequency = 56000000, .index = PLLVAL(142, 2, 3), }, | ||
41 | { .frequency = 68000000, .index = PLLVAL(82, 2, 2), }, | ||
42 | { .frequency = 79000000, .index = PLLVAL(71, 1, 2), }, | ||
43 | { .frequency = 85000000, .index = PLLVAL(105, 2, 2), }, | ||
44 | { .frequency = 90000000, .index = PLLVAL(112, 2, 2), }, | ||
45 | { .frequency = 101000000, .index = PLLVAL(127, 2, 2), }, | ||
46 | { .frequency = 113000000, .index = PLLVAL(105, 1, 2), }, | ||
47 | { .frequency = 118000000, .index = PLLVAL(150, 2, 2), }, | ||
48 | { .frequency = 124000000, .index = PLLVAL(116, 1, 2), }, | ||
49 | { .frequency = 135000000, .index = PLLVAL(82, 2, 1), }, | ||
50 | { .frequency = 147000000, .index = PLLVAL(90, 2, 1), }, | ||
51 | { .frequency = 152000000, .index = PLLVAL(68, 1, 1), }, | ||
52 | { .frequency = 158000000, .index = PLLVAL(71, 1, 1), }, | ||
53 | { .frequency = 170000000, .index = PLLVAL(77, 1, 1), }, | ||
54 | { .frequency = 180000000, .index = PLLVAL(82, 1, 1), }, | ||
55 | { .frequency = 186000000, .index = PLLVAL(85, 1, 1), }, | ||
56 | { .frequency = 192000000, .index = PLLVAL(88, 1, 1), }, | ||
57 | { .frequency = 203000000, .index = PLLVAL(161, 3, 1), }, | ||
58 | |||
59 | /* 2410A extras */ | ||
60 | |||
61 | { .frequency = 210000000, .index = PLLVAL(132, 2, 1), }, | ||
62 | { .frequency = 226000000, .index = PLLVAL(105, 1, 1), }, | ||
63 | { .frequency = 266000000, .index = PLLVAL(125, 1, 1), }, | ||
64 | { .frequency = 268000000, .index = PLLVAL(126, 1, 1), }, | ||
65 | { .frequency = 270000000, .index = PLLVAL(127, 1, 1), }, | ||
66 | }; | ||
67 | |||
68 | static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif) | ||
69 | { | ||
70 | return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz)); | ||
71 | } | ||
72 | |||
73 | static struct subsys_interface s3c2410_plls_interface = { | ||
74 | .name = "s3c2410_plls", | ||
75 | .subsys = &s3c2410_subsys, | ||
76 | .add_dev = s3c2410_plls_add, | ||
77 | }; | ||
78 | |||
79 | static int __init s3c2410_pll_init(void) | ||
80 | { | ||
81 | return subsys_interface_register(&s3c2410_plls_interface); | ||
82 | |||
83 | } | ||
84 | arch_initcall(s3c2410_pll_init); | ||
85 | |||
86 | static struct subsys_interface s3c2410a_plls_interface = { | ||
87 | .name = "s3c2410a_plls", | ||
88 | .subsys = &s3c2410a_subsys, | ||
89 | .add_dev = s3c2410_plls_add, | ||
90 | }; | ||
91 | |||
92 | static int __init s3c2410a_pll_init(void) | ||
93 | { | ||
94 | return subsys_interface_register(&s3c2410a_plls_interface); | ||
95 | } | ||
96 | arch_initcall(s3c2410a_pll_init); | ||
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c b/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c new file mode 100644 index 000000000000..673781758319 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2007 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * Vincent Sanders <vince@arm.linux.org.uk> | ||
6 | * | ||
7 | * S3C2440/S3C2442 CPU PLL tables (12MHz Crystal) | ||
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/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/err.h> | ||
19 | |||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/cpu-freq-core.h> | ||
22 | |||
23 | static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = { | ||
24 | { .frequency = 75000000, .index = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */ | ||
25 | { .frequency = 80000000, .index = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */ | ||
26 | { .frequency = 90000000, .index = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */ | ||
27 | { .frequency = 100000000, .index = PLLVAL(0x5c, 1, 3), }, /* FVco 800.000000 */ | ||
28 | { .frequency = 110000000, .index = PLLVAL(0x66, 1, 3), }, /* FVco 880.000000 */ | ||
29 | { .frequency = 120000000, .index = PLLVAL(0x70, 1, 3), }, /* FVco 960.000000 */ | ||
30 | { .frequency = 150000000, .index = PLLVAL(0x75, 3, 2), }, /* FVco 600.000000 */ | ||
31 | { .frequency = 160000000, .index = PLLVAL(0x98, 4, 2), }, /* FVco 640.000000 */ | ||
32 | { .frequency = 170000000, .index = PLLVAL(0x4d, 1, 2), }, /* FVco 680.000000 */ | ||
33 | { .frequency = 180000000, .index = PLLVAL(0x70, 2, 2), }, /* FVco 720.000000 */ | ||
34 | { .frequency = 190000000, .index = PLLVAL(0x57, 1, 2), }, /* FVco 760.000000 */ | ||
35 | { .frequency = 200000000, .index = PLLVAL(0x5c, 1, 2), }, /* FVco 800.000000 */ | ||
36 | { .frequency = 210000000, .index = PLLVAL(0x84, 2, 2), }, /* FVco 840.000000 */ | ||
37 | { .frequency = 220000000, .index = PLLVAL(0x66, 1, 2), }, /* FVco 880.000000 */ | ||
38 | { .frequency = 230000000, .index = PLLVAL(0x6b, 1, 2), }, /* FVco 920.000000 */ | ||
39 | { .frequency = 240000000, .index = PLLVAL(0x70, 1, 2), }, /* FVco 960.000000 */ | ||
40 | { .frequency = 300000000, .index = PLLVAL(0x75, 3, 1), }, /* FVco 600.000000 */ | ||
41 | { .frequency = 310000000, .index = PLLVAL(0x93, 4, 1), }, /* FVco 620.000000 */ | ||
42 | { .frequency = 320000000, .index = PLLVAL(0x98, 4, 1), }, /* FVco 640.000000 */ | ||
43 | { .frequency = 330000000, .index = PLLVAL(0x66, 2, 1), }, /* FVco 660.000000 */ | ||
44 | { .frequency = 340000000, .index = PLLVAL(0x4d, 1, 1), }, /* FVco 680.000000 */ | ||
45 | { .frequency = 350000000, .index = PLLVAL(0xa7, 4, 1), }, /* FVco 700.000000 */ | ||
46 | { .frequency = 360000000, .index = PLLVAL(0x70, 2, 1), }, /* FVco 720.000000 */ | ||
47 | { .frequency = 370000000, .index = PLLVAL(0xb1, 4, 1), }, /* FVco 740.000000 */ | ||
48 | { .frequency = 380000000, .index = PLLVAL(0x57, 1, 1), }, /* FVco 760.000000 */ | ||
49 | { .frequency = 390000000, .index = PLLVAL(0x7a, 2, 1), }, /* FVco 780.000000 */ | ||
50 | { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */ | ||
51 | }; | ||
52 | |||
53 | static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif) | ||
54 | { | ||
55 | struct clk *xtal_clk; | ||
56 | unsigned long xtal; | ||
57 | |||
58 | xtal_clk = clk_get(NULL, "xtal"); | ||
59 | if (IS_ERR(xtal_clk)) | ||
60 | return PTR_ERR(xtal_clk); | ||
61 | |||
62 | xtal = clk_get_rate(xtal_clk); | ||
63 | clk_put(xtal_clk); | ||
64 | |||
65 | if (xtal == 12000000) { | ||
66 | printk(KERN_INFO "Using PLL table for 12MHz crystal\n"); | ||
67 | return s3c_plltab_register(s3c2440_plls_12, | ||
68 | ARRAY_SIZE(s3c2440_plls_12)); | ||
69 | } | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static struct subsys_interface s3c2440_plls12_interface = { | ||
75 | .name = "s3c2440_plls12", | ||
76 | .subsys = &s3c2440_subsys, | ||
77 | .add_dev = s3c2440_plls12_add, | ||
78 | }; | ||
79 | |||
80 | static int __init s3c2440_pll_12mhz(void) | ||
81 | { | ||
82 | return subsys_interface_register(&s3c2440_plls12_interface); | ||
83 | |||
84 | } | ||
85 | arch_initcall(s3c2440_pll_12mhz); | ||
86 | |||
87 | static struct subsys_interface s3c2442_plls12_interface = { | ||
88 | .name = "s3c2442_plls12", | ||
89 | .subsys = &s3c2442_subsys, | ||
90 | .add_dev = s3c2440_plls12_add, | ||
91 | }; | ||
92 | |||
93 | static int __init s3c2442_pll_12mhz(void) | ||
94 | { | ||
95 | return subsys_interface_register(&s3c2442_plls12_interface); | ||
96 | |||
97 | } | ||
98 | arch_initcall(s3c2442_pll_12mhz); | ||
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c b/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c new file mode 100644 index 000000000000..debfa106289b --- /dev/null +++ b/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2008 Simtec Electronics | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * Vincent Sanders <vince@arm.linux.org.uk> | ||
6 | * | ||
7 | * S3C2440/S3C2442 CPU PLL tables (16.93444MHz Crystal) | ||
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/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/err.h> | ||
19 | |||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/cpu-freq-core.h> | ||
22 | |||
23 | static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = { | ||
24 | { .frequency = 78019200, .index = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */ | ||
25 | { .frequency = 84067200, .index = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */ | ||
26 | { .frequency = 90115200, .index = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */ | ||
27 | { .frequency = 96163200, .index = PLLVAL(151, 5, 3), }, /* FVco 769.305600 */ | ||
28 | { .frequency = 102135600, .index = PLLVAL(185, 6, 3), }, /* FVco 817.084800 */ | ||
29 | { .frequency = 108259200, .index = PLLVAL(171, 5, 3), }, /* FVco 866.073600 */ | ||
30 | { .frequency = 114307200, .index = PLLVAL(127, 3, 3), }, /* FVco 914.457600 */ | ||
31 | { .frequency = 120234240, .index = PLLVAL(134, 3, 3), }, /* FVco 961.873920 */ | ||
32 | { .frequency = 126161280, .index = PLLVAL(141, 3, 3), }, /* FVco 1009.290240 */ | ||
33 | { .frequency = 132088320, .index = PLLVAL(148, 3, 3), }, /* FVco 1056.706560 */ | ||
34 | { .frequency = 138015360, .index = PLLVAL(155, 3, 3), }, /* FVco 1104.122880 */ | ||
35 | { .frequency = 144789120, .index = PLLVAL(163, 3, 3), }, /* FVco 1158.312960 */ | ||
36 | { .frequency = 150100363, .index = PLLVAL(187, 9, 2), }, /* FVco 600.401454 */ | ||
37 | { .frequency = 156038400, .index = PLLVAL(121, 5, 2), }, /* FVco 624.153600 */ | ||
38 | { .frequency = 162086400, .index = PLLVAL(126, 5, 2), }, /* FVco 648.345600 */ | ||
39 | { .frequency = 168134400, .index = PLLVAL(131, 5, 2), }, /* FVco 672.537600 */ | ||
40 | { .frequency = 174048000, .index = PLLVAL(177, 7, 2), }, /* FVco 696.192000 */ | ||
41 | { .frequency = 180230400, .index = PLLVAL(141, 5, 2), }, /* FVco 720.921600 */ | ||
42 | { .frequency = 186278400, .index = PLLVAL(124, 4, 2), }, /* FVco 745.113600 */ | ||
43 | { .frequency = 192326400, .index = PLLVAL(151, 5, 2), }, /* FVco 769.305600 */ | ||
44 | { .frequency = 198132480, .index = PLLVAL(109, 3, 2), }, /* FVco 792.529920 */ | ||
45 | { .frequency = 204271200, .index = PLLVAL(185, 6, 2), }, /* FVco 817.084800 */ | ||
46 | { .frequency = 210268800, .index = PLLVAL(141, 4, 2), }, /* FVco 841.075200 */ | ||
47 | { .frequency = 216518400, .index = PLLVAL(171, 5, 2), }, /* FVco 866.073600 */ | ||
48 | { .frequency = 222264000, .index = PLLVAL(97, 2, 2), }, /* FVco 889.056000 */ | ||
49 | { .frequency = 228614400, .index = PLLVAL(127, 3, 2), }, /* FVco 914.457600 */ | ||
50 | { .frequency = 234259200, .index = PLLVAL(158, 4, 2), }, /* FVco 937.036800 */ | ||
51 | { .frequency = 240468480, .index = PLLVAL(134, 3, 2), }, /* FVco 961.873920 */ | ||
52 | { .frequency = 246960000, .index = PLLVAL(167, 4, 2), }, /* FVco 987.840000 */ | ||
53 | { .frequency = 252322560, .index = PLLVAL(141, 3, 2), }, /* FVco 1009.290240 */ | ||
54 | { .frequency = 258249600, .index = PLLVAL(114, 2, 2), }, /* FVco 1032.998400 */ | ||
55 | { .frequency = 264176640, .index = PLLVAL(148, 3, 2), }, /* FVco 1056.706560 */ | ||
56 | { .frequency = 270950400, .index = PLLVAL(120, 2, 2), }, /* FVco 1083.801600 */ | ||
57 | { .frequency = 276030720, .index = PLLVAL(155, 3, 2), }, /* FVco 1104.122880 */ | ||
58 | { .frequency = 282240000, .index = PLLVAL(92, 1, 2), }, /* FVco 1128.960000 */ | ||
59 | { .frequency = 289578240, .index = PLLVAL(163, 3, 2), }, /* FVco 1158.312960 */ | ||
60 | { .frequency = 294235200, .index = PLLVAL(131, 2, 2), }, /* FVco 1176.940800 */ | ||
61 | { .frequency = 300200727, .index = PLLVAL(187, 9, 1), }, /* FVco 600.401454 */ | ||
62 | { .frequency = 306358690, .index = PLLVAL(191, 9, 1), }, /* FVco 612.717380 */ | ||
63 | { .frequency = 312076800, .index = PLLVAL(121, 5, 1), }, /* FVco 624.153600 */ | ||
64 | { .frequency = 318366720, .index = PLLVAL(86, 3, 1), }, /* FVco 636.733440 */ | ||
65 | { .frequency = 324172800, .index = PLLVAL(126, 5, 1), }, /* FVco 648.345600 */ | ||
66 | { .frequency = 330220800, .index = PLLVAL(109, 4, 1), }, /* FVco 660.441600 */ | ||
67 | { .frequency = 336268800, .index = PLLVAL(131, 5, 1), }, /* FVco 672.537600 */ | ||
68 | { .frequency = 342074880, .index = PLLVAL(93, 3, 1), }, /* FVco 684.149760 */ | ||
69 | { .frequency = 348096000, .index = PLLVAL(177, 7, 1), }, /* FVco 696.192000 */ | ||
70 | { .frequency = 355622400, .index = PLLVAL(118, 4, 1), }, /* FVco 711.244800 */ | ||
71 | { .frequency = 360460800, .index = PLLVAL(141, 5, 1), }, /* FVco 720.921600 */ | ||
72 | { .frequency = 366206400, .index = PLLVAL(165, 6, 1), }, /* FVco 732.412800 */ | ||
73 | { .frequency = 372556800, .index = PLLVAL(124, 4, 1), }, /* FVco 745.113600 */ | ||
74 | { .frequency = 378201600, .index = PLLVAL(126, 4, 1), }, /* FVco 756.403200 */ | ||
75 | { .frequency = 384652800, .index = PLLVAL(151, 5, 1), }, /* FVco 769.305600 */ | ||
76 | { .frequency = 391608000, .index = PLLVAL(177, 6, 1), }, /* FVco 783.216000 */ | ||
77 | { .frequency = 396264960, .index = PLLVAL(109, 3, 1), }, /* FVco 792.529920 */ | ||
78 | { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */ | ||
79 | }; | ||
80 | |||
81 | static int s3c2440_plls169344_add(struct device *dev, | ||
82 | struct subsys_interface *sif) | ||
83 | { | ||
84 | struct clk *xtal_clk; | ||
85 | unsigned long xtal; | ||
86 | |||
87 | xtal_clk = clk_get(NULL, "xtal"); | ||
88 | if (IS_ERR(xtal_clk)) | ||
89 | return PTR_ERR(xtal_clk); | ||
90 | |||
91 | xtal = clk_get_rate(xtal_clk); | ||
92 | clk_put(xtal_clk); | ||
93 | |||
94 | if (xtal == 169344000) { | ||
95 | printk(KERN_INFO "Using PLL table for 16.9344MHz crystal\n"); | ||
96 | return s3c_plltab_register(s3c2440_plls_169344, | ||
97 | ARRAY_SIZE(s3c2440_plls_169344)); | ||
98 | } | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static struct subsys_interface s3c2440_plls169344_interface = { | ||
104 | .name = "s3c2440_plls169344", | ||
105 | .subsys = &s3c2440_subsys, | ||
106 | .add_dev = s3c2440_plls169344_add, | ||
107 | }; | ||
108 | |||
109 | static int __init s3c2440_pll_16934400(void) | ||
110 | { | ||
111 | return subsys_interface_register(&s3c2440_plls169344_interface); | ||
112 | } | ||
113 | arch_initcall(s3c2440_pll_16934400); | ||
114 | |||
115 | static struct subsys_interface s3c2442_plls169344_interface = { | ||
116 | .name = "s3c2442_plls169344", | ||
117 | .subsys = &s3c2442_subsys, | ||
118 | .add_dev = s3c2440_plls169344_add, | ||
119 | }; | ||
120 | |||
121 | static int __init s3c2442_pll_16934400(void) | ||
122 | { | ||
123 | return subsys_interface_register(&s3c2442_plls169344_interface); | ||
124 | } | ||
125 | arch_initcall(s3c2442_pll_16934400); | ||
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2410.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c index 949ae05e07c5..2d82c4f116cd 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2410.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2410.c | |||
@@ -29,16 +29,16 @@ | |||
29 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | 31 | ||
32 | #include <mach/hardware.h> | ||
33 | |||
34 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
35 | 33 | ||
34 | #include <mach/hardware.h> | ||
36 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
37 | #include <mach/h1940.h> | ||
38 | 36 | ||
39 | #include <plat/cpu.h> | 37 | #include <plat/cpu.h> |
40 | #include <plat/pm.h> | 38 | #include <plat/pm.h> |
41 | 39 | ||
40 | #include "h1940.h" | ||
41 | |||
42 | static void s3c2410_pm_prepare(void) | 42 | static void s3c2410_pm_prepare(void) |
43 | { | 43 | { |
44 | /* ensure at least GSTATUS3 has the resume address */ | 44 | /* ensure at least GSTATUS3 has the resume address */ |
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c index f5dc2b254a5a..668a78a8b195 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2412.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c | |||
@@ -21,19 +21,19 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | 23 | ||
24 | #include <mach/hardware.h> | ||
25 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
26 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
27 | 26 | ||
28 | #include <mach/regs-power.h> | 27 | #include <mach/hardware.h> |
29 | #include <mach/regs-gpio.h> | 28 | #include <mach/regs-gpio.h> |
30 | #include <mach/regs-dsc.h> | ||
31 | 29 | ||
32 | #include <plat/cpu.h> | 30 | #include <plat/cpu.h> |
33 | #include <plat/pm.h> | 31 | #include <plat/pm.h> |
34 | |||
35 | #include <plat/s3c2412.h> | 32 | #include <plat/s3c2412.h> |
36 | 33 | ||
34 | #include "regs-dsc.h" | ||
35 | #include "s3c2412-power.h" | ||
36 | |||
37 | extern void s3c2412_sleep_enter(void); | 37 | extern void s3c2412_sleep_enter(void); |
38 | 38 | ||
39 | static int s3c2412_cpu_suspend(unsigned long arg) | 39 | static int s3c2412_cpu_suspend(unsigned long arg) |
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2416.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c index 1a9e8dd194ff..44923895f558 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2416.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2416.c | |||
@@ -16,12 +16,13 @@ | |||
16 | 16 | ||
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | 18 | ||
19 | #include <mach/regs-power.h> | ||
20 | #include <mach/regs-s3c2443-clock.h> | 19 | #include <mach/regs-s3c2443-clock.h> |
21 | 20 | ||
22 | #include <plat/cpu.h> | 21 | #include <plat/cpu.h> |
23 | #include <plat/pm.h> | 22 | #include <plat/pm.h> |
24 | 23 | ||
24 | #include "s3c2412-power.h" | ||
25 | |||
25 | extern void s3c2412_sleep_enter(void); | 26 | extern void s3c2412_sleep_enter(void); |
26 | 27 | ||
27 | static int s3c2416_cpu_suspend(unsigned long arg) | 28 | static int s3c2416_cpu_suspend(unsigned long arg) |
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c index 724755f0b0f5..caa5b7211380 100644 --- a/arch/arm/mach-s3c24xx/pm.c +++ b/arch/arm/mach-s3c24xx/pm.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
39 | #include <mach/regs-clock.h> | 39 | #include <mach/regs-clock.h> |
40 | #include <mach/regs-gpio.h> | 40 | #include <mach/regs-gpio.h> |
41 | #include <mach/regs-mem.h> | ||
42 | #include <mach/regs-irq.h> | 41 | #include <mach/regs-irq.h> |
43 | 42 | ||
44 | #include <asm/mach/time.h> | 43 | #include <asm/mach/time.h> |
@@ -46,6 +45,8 @@ | |||
46 | #include <plat/gpio-cfg.h> | 45 | #include <plat/gpio-cfg.h> |
47 | #include <plat/pm.h> | 46 | #include <plat/pm.h> |
48 | 47 | ||
48 | #include "regs-mem.h" | ||
49 | |||
49 | #define PFX "s3c24xx-pm: " | 50 | #define PFX "s3c24xx-pm: " |
50 | 51 | ||
51 | static struct sleep_save core_save[] = { | 52 | static struct sleep_save core_save[] = { |
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h b/arch/arm/mach-s3c24xx/regs-dsc.h index 98fd4a05587c..98fd4a05587c 100644 --- a/arch/arm/mach-s3c24xx/include/mach/regs-dsc.h +++ b/arch/arm/mach-s3c24xx/regs-dsc.h | |||
diff --git a/arch/arm/mach-s3c24xx/regs-mem.h b/arch/arm/mach-s3c24xx/regs-mem.h new file mode 100644 index 000000000000..86b1258368c2 --- /dev/null +++ b/arch/arm/mach-s3c24xx/regs-mem.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
3 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * S3C2410 Memory Control register definitions | ||
10 | */ | ||
11 | |||
12 | #ifndef __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H | ||
13 | #define __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H __FILE__ | ||
14 | |||
15 | #define S3C2410_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) | ||
16 | |||
17 | #define S3C2410_BWSCON S3C2410_MEMREG(0x00) | ||
18 | #define S3C2410_BANKCON0 S3C2410_MEMREG(0x04) | ||
19 | #define S3C2410_BANKCON1 S3C2410_MEMREG(0x08) | ||
20 | #define S3C2410_BANKCON2 S3C2410_MEMREG(0x0C) | ||
21 | #define S3C2410_BANKCON3 S3C2410_MEMREG(0x10) | ||
22 | #define S3C2410_BANKCON4 S3C2410_MEMREG(0x14) | ||
23 | #define S3C2410_BANKCON5 S3C2410_MEMREG(0x18) | ||
24 | #define S3C2410_BANKCON6 S3C2410_MEMREG(0x1C) | ||
25 | #define S3C2410_BANKCON7 S3C2410_MEMREG(0x20) | ||
26 | #define S3C2410_REFRESH S3C2410_MEMREG(0x24) | ||
27 | #define S3C2410_BANKSIZE S3C2410_MEMREG(0x28) | ||
28 | |||
29 | #define S3C2410_BWSCON_ST1 (1 << 7) | ||
30 | #define S3C2410_BWSCON_ST2 (1 << 11) | ||
31 | #define S3C2410_BWSCON_ST3 (1 << 15) | ||
32 | #define S3C2410_BWSCON_ST4 (1 << 19) | ||
33 | #define S3C2410_BWSCON_ST5 (1 << 23) | ||
34 | |||
35 | #define S3C2410_BWSCON_GET(_bwscon, _bank) (((_bwscon) >> ((_bank) * 4)) & 0xf) | ||
36 | |||
37 | #define S3C2410_BWSCON_WS (1 << 2) | ||
38 | |||
39 | #define S3C2410_BANKCON_PMC16 (0x3) | ||
40 | |||
41 | #define S3C2410_BANKCON_Tacp_SHIFT (2) | ||
42 | #define S3C2410_BANKCON_Tcah_SHIFT (4) | ||
43 | #define S3C2410_BANKCON_Tcoh_SHIFT (6) | ||
44 | #define S3C2410_BANKCON_Tacc_SHIFT (8) | ||
45 | #define S3C2410_BANKCON_Tcos_SHIFT (11) | ||
46 | #define S3C2410_BANKCON_Tacs_SHIFT (13) | ||
47 | |||
48 | #define S3C2410_BANKCON_SDRAM (0x3 << 15) | ||
49 | |||
50 | #define S3C2410_REFRESH_SELF (1 << 22) | ||
51 | |||
52 | #define S3C2410_BANKSIZE_MASK (0x7 << 0) | ||
53 | |||
54 | #endif /* __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c index a3c5cb086ee2..9ebef95da721 100644 --- a/arch/arm/mach-s3c24xx/s3c2410.c +++ b/arch/arm/mach-s3c24xx/s3c2410.c | |||
@@ -49,6 +49,8 @@ | |||
49 | #include <plat/gpio-cfg.h> | 49 | #include <plat/gpio-cfg.h> |
50 | #include <plat/gpio-cfg-helpers.h> | 50 | #include <plat/gpio-cfg-helpers.h> |
51 | 51 | ||
52 | #include "common.h" | ||
53 | |||
52 | /* Initial IO mappings */ | 54 | /* Initial IO mappings */ |
53 | 55 | ||
54 | static struct map_desc s3c2410_iodesc[] __initdata = { | 56 | static struct map_desc s3c2410_iodesc[] __initdata = { |
@@ -182,8 +184,8 @@ int __init s3c2410_init(void) | |||
182 | 184 | ||
183 | #ifdef CONFIG_PM | 185 | #ifdef CONFIG_PM |
184 | register_syscore_ops(&s3c2410_pm_syscore_ops); | 186 | register_syscore_ops(&s3c2410_pm_syscore_ops); |
185 | #endif | ||
186 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | 187 | register_syscore_ops(&s3c24xx_irq_syscore_ops); |
188 | #endif | ||
187 | 189 | ||
188 | return device_register(&s3c2410_dev); | 190 | return device_register(&s3c2410_dev); |
189 | } | 191 | } |
diff --git a/arch/arm/mach-s3c24xx/s3c2412-power.h b/arch/arm/mach-s3c24xx/s3c2412-power.h new file mode 100644 index 000000000000..1b02c5ddb31b --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2412-power.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk> | ||
3 | * http://armlinux.simtec.co.uk/ | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H | ||
11 | #define __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H __FILE__ | ||
12 | |||
13 | #define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR) | ||
14 | |||
15 | #define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20) | ||
16 | #define S3C2412_PWRCFG S3C24XX_PWRREG(0x24) | ||
17 | |||
18 | #define S3C2412_INFORM0 S3C24XX_PWRREG(0x70) | ||
19 | #define S3C2412_INFORM1 S3C24XX_PWRREG(0x74) | ||
20 | #define S3C2412_INFORM2 S3C24XX_PWRREG(0x78) | ||
21 | #define S3C2412_INFORM3 S3C24XX_PWRREG(0x7C) | ||
22 | |||
23 | #define S3C2412_PWRCFG_BATF_IRQ (1 << 0) | ||
24 | #define S3C2412_PWRCFG_BATF_IGNORE (2 << 0) | ||
25 | #define S3C2412_PWRCFG_BATF_SLEEP (3 << 0) | ||
26 | #define S3C2412_PWRCFG_BATF_MASK (3 << 0) | ||
27 | |||
28 | #define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0 << 6) | ||
29 | #define S3C2412_PWRCFG_STANDBYWFI_IDLE (1 << 6) | ||
30 | #define S3C2412_PWRCFG_STANDBYWFI_STOP (2 << 6) | ||
31 | #define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3 << 6) | ||
32 | #define S3C2412_PWRCFG_STANDBYWFI_MASK (3 << 6) | ||
33 | |||
34 | #define S3C2412_PWRCFG_RTC_MASKIRQ (1 << 8) | ||
35 | #define S3C2412_PWRCFG_NAND_NORST (1 << 9) | ||
36 | |||
37 | #endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c index 6c5f4031ff0c..0d592159a5c3 100644 --- a/arch/arm/mach-s3c24xx/s3c2412.c +++ b/arch/arm/mach-s3c24xx/s3c2412.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/s3c2412.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | 2 | * Copyright (c) 2006 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 3 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 4 | * |
@@ -28,28 +27,31 @@ | |||
28 | #include <asm/mach/map.h> | 27 | #include <asm/mach/map.h> |
29 | #include <asm/mach/irq.h> | 28 | #include <asm/mach/irq.h> |
30 | 29 | ||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/proc-fns.h> | 30 | #include <asm/proc-fns.h> |
33 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
34 | #include <asm/system_misc.h> | 32 | #include <asm/system_misc.h> |
35 | 33 | ||
36 | #include <plat/cpu-freq.h> | 34 | #include <mach/hardware.h> |
37 | |||
38 | #include <mach/regs-clock.h> | 35 | #include <mach/regs-clock.h> |
39 | #include <plat/regs-serial.h> | ||
40 | #include <mach/regs-power.h> | ||
41 | #include <mach/regs-gpio.h> | 36 | #include <mach/regs-gpio.h> |
42 | #include <mach/regs-dsc.h> | ||
43 | #include <plat/regs-spi.h> | ||
44 | #include <mach/regs-s3c2412.h> | ||
45 | 37 | ||
46 | #include <plat/s3c2412.h> | 38 | #include <plat/clock.h> |
47 | #include <plat/cpu.h> | 39 | #include <plat/cpu.h> |
40 | #include <plat/cpu-freq.h> | ||
48 | #include <plat/devs.h> | 41 | #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> | 42 | #include <plat/nand-core.h> |
43 | #include <plat/pll.h> | ||
44 | #include <plat/pm.h> | ||
45 | #include <plat/regs-serial.h> | ||
46 | #include <plat/regs-spi.h> | ||
47 | #include <plat/s3c2412.h> | ||
48 | |||
49 | #include "common.h" | ||
50 | #include "regs-dsc.h" | ||
51 | #include "s3c2412-power.h" | ||
52 | |||
53 | #define S3C2412_SWRST (S3C24XX_VA_CLKPWR + 0x30) | ||
54 | #define S3C2412_SWRST_RESET (0x533C2412) | ||
53 | 55 | ||
54 | #ifndef CONFIG_CPU_S3C2412_ONLY | 56 | #ifndef CONFIG_CPU_S3C2412_ONLY |
55 | void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; | 57 | void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; |
@@ -244,8 +246,8 @@ int __init s3c2412_init(void) | |||
244 | 246 | ||
245 | #ifdef CONFIG_PM | 247 | #ifdef CONFIG_PM |
246 | register_syscore_ops(&s3c2412_pm_syscore_ops); | 248 | register_syscore_ops(&s3c2412_pm_syscore_ops); |
247 | #endif | ||
248 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | 249 | register_syscore_ops(&s3c24xx_irq_syscore_ops); |
250 | #endif | ||
249 | 251 | ||
250 | return device_register(&s3c2412_dev); | 252 | return device_register(&s3c2412_dev); |
251 | } | 253 | } |
diff --git a/arch/arm/mach-s3c24xx/s3c2412.h b/arch/arm/mach-s3c24xx/s3c2412.h new file mode 100644 index 000000000000..548ced42cbb7 --- /dev/null +++ b/arch/arm/mach-s3c24xx/s3c2412.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008 Simtec Electronics | ||
3 | * Ben Dooks <ben@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 | |||
11 | #ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_H | ||
12 | #define __ARCH_ARM_REGS_S3C24XX_S3C2412_H __FILE__ | ||
13 | |||
14 | #define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) | ||
15 | #define S3C2412_EBIREG(x) (S3C2412_VA_EBI + (x)) | ||
16 | |||
17 | #define S3C2412_SSMCREG(x) (S3C2412_VA_SSMC + (x)) | ||
18 | #define S3C2412_SSMC(x, o) (S3C2412_SSMCREG((x * 0x20) + (o))) | ||
19 | |||
20 | #define S3C2412_REFRESH S3C2412_MEMREG(0x10) | ||
21 | |||
22 | #define S3C2412_EBI_BANKCFG S3C2412_EBIREG(0x4) | ||
23 | |||
24 | #define S3C2412_SSMC_BANK(x) S3C2412_SSMC(x, 0x0) | ||
25 | |||
26 | #endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_H */ | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c index 77ee0b732237..e30476db0295 100644 --- a/arch/arm/mach-s3c24xx/s3c2416.c +++ b/arch/arm/mach-s3c24xx/s3c2416.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #include <plat/rtc-core.h> | 63 | #include <plat/rtc-core.h> |
64 | #include <plat/spi-core.h> | 64 | #include <plat/spi-core.h> |
65 | 65 | ||
66 | #include "common.h" | ||
67 | |||
66 | static struct map_desc s3c2416_iodesc[] __initdata = { | 68 | static struct map_desc s3c2416_iodesc[] __initdata = { |
67 | IODESC_ENT(WATCHDOG), | 69 | IODESC_ENT(WATCHDOG), |
68 | IODESC_ENT(CLKPWR), | 70 | IODESC_ENT(CLKPWR), |
@@ -105,9 +107,9 @@ int __init s3c2416_init(void) | |||
105 | 107 | ||
106 | #ifdef CONFIG_PM | 108 | #ifdef CONFIG_PM |
107 | register_syscore_ops(&s3c2416_pm_syscore_ops); | 109 | register_syscore_ops(&s3c2416_pm_syscore_ops); |
108 | #endif | ||
109 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | 110 | register_syscore_ops(&s3c24xx_irq_syscore_ops); |
110 | register_syscore_ops(&s3c2416_irq_syscore_ops); | 111 | register_syscore_ops(&s3c2416_irq_syscore_ops); |
112 | #endif | ||
111 | 113 | ||
112 | return device_register(&s3c2416_dev); | 114 | return device_register(&s3c2416_dev); |
113 | } | 115 | } |
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c index 2b3dddb49af7..559e394e8989 100644 --- a/arch/arm/mach-s3c24xx/s3c2440.c +++ b/arch/arm/mach-s3c24xx/s3c2440.c | |||
@@ -40,6 +40,8 @@ | |||
40 | #include <plat/gpio-cfg.h> | 40 | #include <plat/gpio-cfg.h> |
41 | #include <plat/gpio-cfg-helpers.h> | 41 | #include <plat/gpio-cfg-helpers.h> |
42 | 42 | ||
43 | #include "common.h" | ||
44 | |||
43 | static struct device s3c2440_dev = { | 45 | static struct device s3c2440_dev = { |
44 | .bus = &s3c2440_subsys, | 46 | .bus = &s3c2440_subsys, |
45 | }; | 47 | }; |
@@ -57,9 +59,9 @@ int __init s3c2440_init(void) | |||
57 | 59 | ||
58 | #ifdef CONFIG_PM | 60 | #ifdef CONFIG_PM |
59 | register_syscore_ops(&s3c2410_pm_syscore_ops); | 61 | register_syscore_ops(&s3c2410_pm_syscore_ops); |
62 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
60 | #endif | 63 | #endif |
61 | register_syscore_ops(&s3c244x_pm_syscore_ops); | 64 | register_syscore_ops(&s3c244x_pm_syscore_ops); |
62 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
63 | 65 | ||
64 | /* register our system device for everything else */ | 66 | /* register our system device for everything else */ |
65 | 67 | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c index 22cb7c94a8c8..f732826c2359 100644 --- a/arch/arm/mach-s3c24xx/s3c2442.c +++ b/arch/arm/mach-s3c24xx/s3c2442.c | |||
@@ -51,6 +51,8 @@ | |||
51 | #include <plat/gpio-cfg.h> | 51 | #include <plat/gpio-cfg.h> |
52 | #include <plat/gpio-cfg-helpers.h> | 52 | #include <plat/gpio-cfg-helpers.h> |
53 | 53 | ||
54 | #include "common.h" | ||
55 | |||
54 | /* S3C2442 extended clock support */ | 56 | /* S3C2442 extended clock support */ |
55 | 57 | ||
56 | static unsigned long s3c2442_camif_upll_round(struct clk *clk, | 58 | static unsigned long s3c2442_camif_upll_round(struct clk *clk, |
@@ -172,9 +174,9 @@ int __init s3c2442_init(void) | |||
172 | 174 | ||
173 | #ifdef CONFIG_PM | 175 | #ifdef CONFIG_PM |
174 | register_syscore_ops(&s3c2410_pm_syscore_ops); | 176 | register_syscore_ops(&s3c2410_pm_syscore_ops); |
177 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
175 | #endif | 178 | #endif |
176 | register_syscore_ops(&s3c244x_pm_syscore_ops); | 179 | register_syscore_ops(&s3c244x_pm_syscore_ops); |
177 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
178 | 180 | ||
179 | return device_register(&s3c2442_dev); | 181 | return device_register(&s3c2442_dev); |
180 | } | 182 | } |
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c index b0b60a1154d6..ad2671baa910 100644 --- a/arch/arm/mach-s3c24xx/s3c244x.c +++ b/arch/arm/mach-s3c24xx/s3c244x.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <mach/regs-clock.h> | 36 | #include <mach/regs-clock.h> |
37 | #include <plat/regs-serial.h> | 37 | #include <plat/regs-serial.h> |
38 | #include <mach/regs-gpio.h> | 38 | #include <mach/regs-gpio.h> |
39 | #include <mach/regs-dsc.h> | ||
40 | 39 | ||
41 | #include <plat/s3c2410.h> | 40 | #include <plat/s3c2410.h> |
42 | #include <plat/s3c244x.h> | 41 | #include <plat/s3c244x.h> |
@@ -48,6 +47,8 @@ | |||
48 | #include <plat/nand-core.h> | 47 | #include <plat/nand-core.h> |
49 | #include <plat/watchdog-reset.h> | 48 | #include <plat/watchdog-reset.h> |
50 | 49 | ||
50 | #include "regs-dsc.h" | ||
51 | |||
51 | static struct map_desc s3c244x_iodesc[] __initdata = { | 52 | static struct map_desc s3c244x_iodesc[] __initdata = { |
52 | IODESC_ENT(CLKPWR), | 53 | IODESC_ENT(CLKPWR), |
53 | IODESC_ENT(TIMER), | 54 | IODESC_ENT(TIMER), |
diff --git a/arch/arm/mach-s3c24xx/simtec-audio.c b/arch/arm/mach-s3c24xx/simtec-audio.c index fd0ef05763a9..67cb5120dfeb 100644 --- a/arch/arm/mach-s3c24xx/simtec-audio.c +++ b/arch/arm/mach-s3c24xx/simtec-audio.c | |||
@@ -17,16 +17,13 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | 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> | 20 | #include <mach/hardware.h> |
25 | #include <mach/regs-gpio.h> | 21 | #include <mach/regs-gpio.h> |
26 | 22 | ||
27 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 23 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> |
28 | #include <plat/devs.h> | 24 | #include <plat/devs.h> |
29 | 25 | ||
26 | #include "bast.h" | ||
30 | #include "simtec.h" | 27 | #include "simtec.h" |
31 | 28 | ||
32 | /* platform ops for audio */ | 29 | /* platform ops for audio */ |
diff --git a/arch/arm/mach-s3c24xx/simtec-nor.c b/arch/arm/mach-s3c24xx/simtec-nor.c index 029744fcaacb..8884bffa619a 100644 --- a/arch/arm/mach-s3c24xx/simtec-nor.c +++ b/arch/arm/mach-s3c24xx/simtec-nor.c | |||
@@ -27,9 +27,8 @@ | |||
27 | #include <asm/mach/irq.h> | 27 | #include <asm/mach/irq.h> |
28 | 28 | ||
29 | #include <mach/map.h> | 29 | #include <mach/map.h> |
30 | #include <mach/bast-map.h> | ||
31 | #include <mach/bast-cpld.h> | ||
32 | 30 | ||
31 | #include "bast.h" | ||
33 | #include "simtec.h" | 32 | #include "simtec.h" |
34 | 33 | ||
35 | static void simtec_nor_vpp(struct platform_device *pdev, int vpp) | 34 | static void simtec_nor_vpp(struct platform_device *pdev, int vpp) |
diff --git a/arch/arm/mach-s3c24xx/simtec-pm.c b/arch/arm/mach-s3c24xx/simtec-pm.c index 699f93171297..38a2f1fdebab 100644 --- a/arch/arm/mach-s3c24xx/simtec-pm.c +++ b/arch/arm/mach-s3c24xx/simtec-pm.c | |||
@@ -28,12 +28,13 @@ | |||
28 | 28 | ||
29 | #include <mach/map.h> | 29 | #include <mach/map.h> |
30 | #include <mach/regs-gpio.h> | 30 | #include <mach/regs-gpio.h> |
31 | #include <mach/regs-mem.h> | ||
32 | 31 | ||
33 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
34 | 33 | ||
35 | #include <plat/pm.h> | 34 | #include <plat/pm.h> |
36 | 35 | ||
36 | #include "regs-mem.h" | ||
37 | |||
37 | #define COPYRIGHT ", Copyright 2005 Simtec Electronics" | 38 | #define COPYRIGHT ", Copyright 2005 Simtec Electronics" |
38 | 39 | ||
39 | /* pm_simtec_init | 40 | /* pm_simtec_init |
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c index ddf7a3c743ac..2ed2e32430dc 100644 --- a/arch/arm/mach-s3c24xx/simtec-usb.c +++ b/arch/arm/mach-s3c24xx/simtec-usb.c | |||
@@ -28,15 +28,13 @@ | |||
28 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
29 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
30 | 30 | ||
31 | #include <mach/bast-map.h> | ||
32 | #include <mach/bast-irq.h> | ||
33 | |||
34 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
35 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
36 | 33 | ||
37 | #include <linux/platform_data/usb-ohci-s3c2410.h> | 34 | #include <linux/platform_data/usb-ohci-s3c2410.h> |
38 | #include <plat/devs.h> | 35 | #include <plat/devs.h> |
39 | 36 | ||
37 | #include "bast.h" | ||
40 | #include "simtec.h" | 38 | #include "simtec.h" |
41 | 39 | ||
42 | /* control power and monitor over-current events on various Simtec | 40 | /* control power and monitor over-current events on various Simtec |
@@ -79,7 +77,7 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on) | |||
79 | int ret; | 77 | int ret; |
80 | 78 | ||
81 | if (on) { | 79 | if (on) { |
82 | ret = request_irq(IRQ_USBOC, usb_simtec_ocirq, | 80 | ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq, |
83 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | 81 | IRQF_DISABLED | IRQF_TRIGGER_RISING | |
84 | IRQF_TRIGGER_FALLING, | 82 | IRQF_TRIGGER_FALLING, |
85 | "USB Over-current", info); | 83 | "USB Over-current", info); |
@@ -87,7 +85,7 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on) | |||
87 | printk(KERN_ERR "failed to request usb oc irq\n"); | 85 | printk(KERN_ERR "failed to request usb oc irq\n"); |
88 | } | 86 | } |
89 | } else { | 87 | } else { |
90 | free_irq(IRQ_USBOC, info); | 88 | free_irq(BAST_IRQ_USBOC, info); |
91 | } | 89 | } |
92 | } | 90 | } |
93 | 91 | ||
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S index 65200ae72c90..dd47c8fa07fa 100644 --- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S +++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S | |||
@@ -31,9 +31,10 @@ | |||
31 | 31 | ||
32 | #include <mach/regs-gpio.h> | 32 | #include <mach/regs-gpio.h> |
33 | #include <mach/regs-clock.h> | 33 | #include <mach/regs-clock.h> |
34 | #include <mach/regs-mem.h> | ||
35 | #include <plat/regs-serial.h> | 34 | #include <plat/regs-serial.h> |
36 | 35 | ||
36 | #include "regs-mem.h" | ||
37 | |||
37 | /* s3c2410_cpu_suspend | 38 | /* s3c2410_cpu_suspend |
38 | * | 39 | * |
39 | * put the cpu into sleep mode | 40 | * put the cpu into sleep mode |
diff --git a/arch/arm/mach-s3c24xx/sleep.S b/arch/arm/mach-s3c24xx/sleep.S index c56612569b40..7f378b662da6 100644 --- a/arch/arm/mach-s3c24xx/sleep.S +++ b/arch/arm/mach-s3c24xx/sleep.S | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <mach/regs-gpio.h> | 32 | #include <mach/regs-gpio.h> |
33 | #include <mach/regs-clock.h> | 33 | #include <mach/regs-clock.h> |
34 | #include <mach/regs-mem.h> | ||
35 | #include <plat/regs-serial.h> | 34 | #include <plat/regs-serial.h> |
36 | 35 | ||
37 | /* CONFIG_DEBUG_RESUME is dangerous if your bootloader does not | 36 | /* CONFIG_DEBUG_RESUME is dangerous if your bootloader does not |
diff --git a/arch/arm/mach-s3c24xx/vr1000.h b/arch/arm/mach-s3c24xx/vr1000.h new file mode 100644 index 000000000000..7fcd2c2f183c --- /dev/null +++ b/arch/arm/mach-s3c24xx/vr1000.h | |||
@@ -0,0 +1,118 @@ | |||
1 | |||
2 | /* arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h | ||
3 | * | ||
4 | * Copyright (c) 2003 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * VR1000 - CPLD control constants | ||
8 | * Machine VR1000 - IRQ Number definitions | ||
9 | * Machine VR1000 - Memory map definitions | ||
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 | #ifndef __MACH_S3C24XX_VR1000_H | ||
17 | #define __MACH_S3C24XX_VR1000_H __FILE__ | ||
18 | |||
19 | #define VR1000_CPLD_CTRL2_RAMWEN (0x04) /* SRAM Write Enable */ | ||
20 | |||
21 | /* irq numbers to onboard peripherals */ | ||
22 | |||
23 | #define VR1000_IRQ_USBOC IRQ_EINT19 | ||
24 | #define VR1000_IRQ_IDE0 IRQ_EINT16 | ||
25 | #define VR1000_IRQ_IDE1 IRQ_EINT17 | ||
26 | #define VR1000_IRQ_SERIAL IRQ_EINT12 | ||
27 | #define VR1000_IRQ_DM9000A IRQ_EINT10 | ||
28 | #define VR1000_IRQ_DM9000N IRQ_EINT9 | ||
29 | #define VR1000_IRQ_SMALERT IRQ_EINT8 | ||
30 | |||
31 | /* map */ | ||
32 | |||
33 | #define VR1000_IOADDR(x) (S3C2410_ADDR((x) + 0x01300000)) | ||
34 | |||
35 | /* we put the CPLD registers next, to get them out of the way */ | ||
36 | |||
37 | #define VR1000_VA_CTRL1 VR1000_IOADDR(0x00000000) /* 0x01300000 */ | ||
38 | #define VR1000_PA_CTRL1 (S3C2410_CS5 | 0x7800000) | ||
39 | |||
40 | #define VR1000_VA_CTRL2 VR1000_IOADDR(0x00100000) /* 0x01400000 */ | ||
41 | #define VR1000_PA_CTRL2 (S3C2410_CS1 | 0x6000000) | ||
42 | |||
43 | #define VR1000_VA_CTRL3 VR1000_IOADDR(0x00200000) /* 0x01500000 */ | ||
44 | #define VR1000_PA_CTRL3 (S3C2410_CS1 | 0x6800000) | ||
45 | |||
46 | #define VR1000_VA_CTRL4 VR1000_IOADDR(0x00300000) /* 0x01600000 */ | ||
47 | #define VR1000_PA_CTRL4 (S3C2410_CS1 | 0x7000000) | ||
48 | |||
49 | /* next, we have the PC104 ISA interrupt registers */ | ||
50 | |||
51 | #define VR1000_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) /* 0x01700000 */ | ||
52 | #define VR1000_VA_PC104_IRQREQ VR1000_IOADDR(0x00400000) | ||
53 | |||
54 | #define VR1000_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) /* 0x01800000 */ | ||
55 | #define VR1000_VA_PC104_IRQRAW VR1000_IOADDR(0x00500000) | ||
56 | |||
57 | #define VR1000_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) /* 0x01900000 */ | ||
58 | #define VR1000_VA_PC104_IRQMASK VR1000_IOADDR(0x00600000) | ||
59 | |||
60 | /* | ||
61 | * 0xE0000000 contains the IO space that is split by speed and | ||
62 | * whether the access is for 8 or 16bit IO... this ensures that | ||
63 | * the correct access is made | ||
64 | * | ||
65 | * 0x10000000 of space, partitioned as so: | ||
66 | * | ||
67 | * 0x00000000 to 0x04000000 8bit, slow | ||
68 | * 0x04000000 to 0x08000000 16bit, slow | ||
69 | * 0x08000000 to 0x0C000000 16bit, net | ||
70 | * 0x0C000000 to 0x10000000 16bit, fast | ||
71 | * | ||
72 | * each of these spaces has the following in: | ||
73 | * | ||
74 | * 0x02000000 to 0x02100000 1MB IDE primary channel | ||
75 | * 0x02100000 to 0x02200000 1MB IDE primary channel aux | ||
76 | * 0x02200000 to 0x02400000 1MB IDE secondary channel | ||
77 | * 0x02300000 to 0x02400000 1MB IDE secondary channel aux | ||
78 | * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controllers | ||
79 | * 0x02600000 to 0x02700000 1MB | ||
80 | * | ||
81 | * the phyiscal layout of the zones are: | ||
82 | * nGCS2 - 8bit, slow | ||
83 | * nGCS3 - 16bit, slow | ||
84 | * nGCS4 - 16bit, net | ||
85 | * nGCS5 - 16bit, fast | ||
86 | */ | ||
87 | |||
88 | #define VR1000_VA_MULTISPACE (0xE0000000) | ||
89 | |||
90 | #define VR1000_VA_ISAIO (VR1000_VA_MULTISPACE + 0x00000000) | ||
91 | #define VR1000_VA_ISAMEM (VR1000_VA_MULTISPACE + 0x01000000) | ||
92 | #define VR1000_VA_IDEPRI (VR1000_VA_MULTISPACE + 0x02000000) | ||
93 | #define VR1000_VA_IDEPRIAUX (VR1000_VA_MULTISPACE + 0x02100000) | ||
94 | #define VR1000_VA_IDESEC (VR1000_VA_MULTISPACE + 0x02200000) | ||
95 | #define VR1000_VA_IDESECAUX (VR1000_VA_MULTISPACE + 0x02300000) | ||
96 | #define VR1000_VA_ASIXNET (VR1000_VA_MULTISPACE + 0x02400000) | ||
97 | #define VR1000_VA_DM9000 (VR1000_VA_MULTISPACE + 0x02500000) | ||
98 | #define VR1000_VA_SUPERIO (VR1000_VA_MULTISPACE + 0x02600000) | ||
99 | |||
100 | /* physical offset addresses for the peripherals */ | ||
101 | |||
102 | #define VR1000_PA_IDEPRI (0x02000000) | ||
103 | #define VR1000_PA_IDEPRIAUX (0x02800000) | ||
104 | #define VR1000_PA_IDESEC (0x03000000) | ||
105 | #define VR1000_PA_IDESECAUX (0x03800000) | ||
106 | #define VR1000_PA_DM9000 (0x05000000) | ||
107 | |||
108 | #define VR1000_PA_SERIAL (0x11800000) | ||
109 | #define VR1000_VA_SERIAL (VR1000_IOADDR(0x00700000)) | ||
110 | |||
111 | /* VR1000 ram is in CS1, with A26..A24 = 2_101 */ | ||
112 | #define VR1000_PA_SRAM (S3C2410_CS1 | 0x05000000) | ||
113 | |||
114 | /* some configurations for the peripherals */ | ||
115 | |||
116 | #define VR1000_DM9000_CS VR1000_VAM_CS4 | ||
117 | |||
118 | #endif /* __MACH_S3C24XX_VR1000_H */ | ||