diff options
Diffstat (limited to 'arch/arm/mach-s3c2416')
-rw-r--r-- | arch/arm/mach-s3c2416/Kconfig | 38 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/Makefile | 19 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/clock.c | 135 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/irq.c | 254 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/mach-smdk2416.c | 150 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/s3c2416.c | 128 |
6 files changed, 724 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig new file mode 100644 index 000000000000..29103a6047de --- /dev/null +++ b/arch/arm/mach-s3c2416/Kconfig | |||
@@ -0,0 +1,38 @@ | |||
1 | # arch/arm/mach-s3c2416/Kconfig | ||
2 | # | ||
3 | # Copyright 2009 Yauhen Kharuzhy <jekhor@gmail.com> | ||
4 | # | ||
5 | # Licensed under GPLv2 | ||
6 | |||
7 | # note, this also supports the S3C2450 which is so similar it has the same | ||
8 | # ID code as the S3C2416. | ||
9 | |||
10 | config CPU_S3C2416 | ||
11 | bool | ||
12 | depends on ARCH_S3C2410 | ||
13 | select CPU_ARM926T | ||
14 | select S3C2416_DMA if S3C2410_DMA | ||
15 | select CPU_LLSERIAL_S3C2440 | ||
16 | select S3C_GPIO_PULL_UPDOWN | ||
17 | select SAMSUNG_CLKSRC | ||
18 | select S3C2443_CLOCK | ||
19 | help | ||
20 | Support for the S3C2416 SoC from the S3C24XX line | ||
21 | |||
22 | config S3C2416_DMA | ||
23 | bool | ||
24 | depends on CPU_S3C2416 | ||
25 | help | ||
26 | Internal config node for S3C2416 DMA support | ||
27 | |||
28 | menu "S3C2416 Machines" | ||
29 | |||
30 | config MACH_SMDK2416 | ||
31 | bool "SMDK2416" | ||
32 | select CPU_S3C2416 | ||
33 | select S3C_DEV_HSMMC | ||
34 | select S3C_DEV_HSMMC1 | ||
35 | help | ||
36 | Say Y here if you are using an SMDK2416 | ||
37 | |||
38 | endmenu | ||
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile new file mode 100644 index 000000000000..6c12c7bf40ad --- /dev/null +++ b/arch/arm/mach-s3c2416/Makefile | |||
@@ -0,0 +1,19 @@ | |||
1 | # arch/arm/mach-s3c2416/Makefile | ||
2 | # | ||
3 | # Copyright 2009 Yauhen Kharuzhy <jekhor@gmail.com> | ||
4 | # | ||
5 | # Licensed under GPLv2 | ||
6 | |||
7 | obj-y := | ||
8 | obj-m := | ||
9 | obj-n := | ||
10 | obj- := | ||
11 | |||
12 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o | ||
13 | obj-$(CONFIG_CPU_S3C2416) += irq.o | ||
14 | |||
15 | #obj-$(CONFIG_S3C2416_DMA) += dma.o | ||
16 | |||
17 | # Machine support | ||
18 | |||
19 | obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o | ||
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c2416/clock.c new file mode 100644 index 000000000000..7ccf5a2a2bfc --- /dev/null +++ b/arch/arm/mach-s3c2416/clock.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Simtec Electronics | ||
4 | * Copyright (c) 2010 Ben Dooks <ben-linux@fluff.org> | ||
5 | * | ||
6 | * S3C2416 Clock control support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/clk.h> | ||
16 | |||
17 | #include <plat/s3c2416.h> | ||
18 | #include <plat/s3c2443.h> | ||
19 | #include <plat/clock.h> | ||
20 | #include <plat/clock-clksrc.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | #include <plat/cpu-freq.h> | ||
24 | #include <plat/pll6553x.h> | ||
25 | #include <plat/pll.h> | ||
26 | |||
27 | #include <asm/mach/map.h> | ||
28 | |||
29 | #include <mach/regs-clock.h> | ||
30 | #include <mach/regs-s3c2443-clock.h> | ||
31 | |||
32 | static unsigned int armdiv[8] = { | ||
33 | [0] = 1, | ||
34 | [1] = 2, | ||
35 | [2] = 3, | ||
36 | [3] = 4, | ||
37 | [5] = 6, | ||
38 | [7] = 8, | ||
39 | }; | ||
40 | |||
41 | /* ID to hardware numbering, 0 is HSMMC1, 1 is HSMMC0 */ | ||
42 | static struct clksrc_clk hsmmc_div[] = { | ||
43 | [0] = { | ||
44 | .clk = { | ||
45 | .name = "hsmmc-div", | ||
46 | .id = 1, | ||
47 | .parent = &clk_esysclk.clk, | ||
48 | }, | ||
49 | .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 }, | ||
50 | }, | ||
51 | [1] = { | ||
52 | .clk = { | ||
53 | .name = "hsmmc-div", | ||
54 | .id = 0, | ||
55 | .parent = &clk_esysclk.clk, | ||
56 | }, | ||
57 | .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static struct clksrc_clk hsmmc_mux[] = { | ||
62 | [0] = { | ||
63 | .clk = { | ||
64 | .id = 1, | ||
65 | .name = "hsmmc-if", | ||
66 | .ctrlbit = (1 << 6), | ||
67 | .enable = s3c2443_clkcon_enable_s, | ||
68 | }, | ||
69 | .sources = &(struct clksrc_sources) { | ||
70 | .nr_sources = 2, | ||
71 | .sources = (struct clk *[]) { | ||
72 | [0] = &hsmmc_div[0].clk, | ||
73 | [1] = NULL, /* to fix */ | ||
74 | }, | ||
75 | }, | ||
76 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 16 }, | ||
77 | }, | ||
78 | [1] = { | ||
79 | .clk = { | ||
80 | .id = 0, | ||
81 | .name = "hsmmc-if", | ||
82 | .ctrlbit = (1 << 12), | ||
83 | .enable = s3c2443_clkcon_enable_s, | ||
84 | }, | ||
85 | .sources = &(struct clksrc_sources) { | ||
86 | .nr_sources = 2, | ||
87 | .sources = (struct clk *[]) { | ||
88 | [0] = &hsmmc_div[1].clk, | ||
89 | [1] = NULL, /* to fix */ | ||
90 | }, | ||
91 | }, | ||
92 | .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 17 }, | ||
93 | }, | ||
94 | }; | ||
95 | |||
96 | |||
97 | static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) | ||
98 | { | ||
99 | clkcon0 &= 7 << S3C2443_CLKDIV0_ARMDIV_SHIFT; | ||
100 | |||
101 | return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; | ||
102 | } | ||
103 | |||
104 | void __init_or_cpufreq s3c2416_setup_clocks(void) | ||
105 | { | ||
106 | s3c2443_common_setup_clocks(s3c2416_get_pll, s3c2416_fclk_div); | ||
107 | } | ||
108 | |||
109 | |||
110 | static struct clksrc_clk *clksrcs[] __initdata = { | ||
111 | &hsmmc_div[0], | ||
112 | &hsmmc_div[1], | ||
113 | &hsmmc_mux[0], | ||
114 | &hsmmc_mux[1], | ||
115 | }; | ||
116 | |||
117 | void __init s3c2416_init_clocks(int xtal) | ||
118 | { | ||
119 | u32 epllcon = __raw_readl(S3C2443_EPLLCON); | ||
120 | u32 epllcon1 = __raw_readl(S3C2443_EPLLCON+4); | ||
121 | int ptr; | ||
122 | |||
123 | /* s3c2416 EPLL compatible with s3c64xx */ | ||
124 | clk_epll.rate = s3c_get_pll6553x(xtal, epllcon, epllcon1); | ||
125 | |||
126 | clk_epll.parent = &clk_epllref.clk; | ||
127 | |||
128 | s3c2443_common_init_clocks(xtal, s3c2416_get_pll, s3c2416_fclk_div); | ||
129 | |||
130 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
131 | s3c_register_clksrc(clksrcs[ptr], 1); | ||
132 | |||
133 | s3c_pwmclk_init(); | ||
134 | |||
135 | } | ||
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c new file mode 100644 index 000000000000..89f521d59d06 --- /dev/null +++ b/arch/arm/mach-s3c2416/irq.c | |||
@@ -0,0 +1,254 @@ | |||
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/sysdev.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <asm/mach/irq.h> | ||
35 | |||
36 | #include <mach/regs-irq.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | |||
39 | #include <plat/cpu.h> | ||
40 | #include <plat/pm.h> | ||
41 | #include <plat/irq.h> | ||
42 | |||
43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
44 | |||
45 | static inline void s3c2416_irq_demux(unsigned int irq, unsigned int len) | ||
46 | { | ||
47 | unsigned int subsrc, submsk; | ||
48 | unsigned int end; | ||
49 | |||
50 | /* read the current pending interrupts, and the mask | ||
51 | * for what it is available */ | ||
52 | |||
53 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
54 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
55 | |||
56 | subsrc &= ~submsk; | ||
57 | subsrc >>= (irq - S3C2410_IRQSUB(0)); | ||
58 | subsrc &= (1 << len)-1; | ||
59 | |||
60 | end = len + irq; | ||
61 | |||
62 | for (; irq < end && subsrc; irq++) { | ||
63 | if (subsrc & 1) | ||
64 | generic_handle_irq(irq); | ||
65 | |||
66 | subsrc >>= 1; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /* WDT/AC97 sub interrupts */ | ||
71 | |||
72 | static void s3c2416_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc) | ||
73 | { | ||
74 | s3c2416_irq_demux(IRQ_S3C2443_WDT, 4); | ||
75 | } | ||
76 | |||
77 | #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
78 | #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) | ||
79 | |||
80 | static void s3c2416_irq_wdtac97_mask(unsigned int irqno) | ||
81 | { | ||
82 | s3c_irqsub_mask(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
83 | } | ||
84 | |||
85 | static void s3c2416_irq_wdtac97_unmask(unsigned int irqno) | ||
86 | { | ||
87 | s3c_irqsub_unmask(irqno, INTMSK_WDTAC97); | ||
88 | } | ||
89 | |||
90 | static void s3c2416_irq_wdtac97_ack(unsigned int irqno) | ||
91 | { | ||
92 | s3c_irqsub_maskack(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); | ||
93 | } | ||
94 | |||
95 | static struct irq_chip s3c2416_irq_wdtac97 = { | ||
96 | .mask = s3c2416_irq_wdtac97_mask, | ||
97 | .unmask = s3c2416_irq_wdtac97_unmask, | ||
98 | .ack = s3c2416_irq_wdtac97_ack, | ||
99 | }; | ||
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(unsigned int irqno) | ||
113 | { | ||
114 | s3c_irqsub_mask(irqno, INTMSK_LCD, SUBMSK_LCD); | ||
115 | } | ||
116 | |||
117 | static void s3c2416_irq_lcd_unmask(unsigned int irqno) | ||
118 | { | ||
119 | s3c_irqsub_unmask(irqno, INTMSK_LCD); | ||
120 | } | ||
121 | |||
122 | static void s3c2416_irq_lcd_ack(unsigned int irqno) | ||
123 | { | ||
124 | s3c_irqsub_maskack(irqno, INTMSK_LCD, SUBMSK_LCD); | ||
125 | } | ||
126 | |||
127 | static struct irq_chip s3c2416_irq_lcd = { | ||
128 | .mask = s3c2416_irq_lcd_mask, | ||
129 | .unmask = s3c2416_irq_lcd_unmask, | ||
130 | .ack = s3c2416_irq_lcd_ack, | ||
131 | }; | ||
132 | |||
133 | |||
134 | /* DMA sub interrupts */ | ||
135 | |||
136 | static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc) | ||
137 | { | ||
138 | s3c2416_irq_demux(IRQ_S3C2443_DMA0, 6); | ||
139 | } | ||
140 | |||
141 | #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) | ||
142 | #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) | ||
143 | |||
144 | |||
145 | static void s3c2416_irq_dma_mask(unsigned int irqno) | ||
146 | { | ||
147 | s3c_irqsub_mask(irqno, INTMSK_DMA, SUBMSK_DMA); | ||
148 | } | ||
149 | |||
150 | static void s3c2416_irq_dma_unmask(unsigned int irqno) | ||
151 | { | ||
152 | s3c_irqsub_unmask(irqno, INTMSK_DMA); | ||
153 | } | ||
154 | |||
155 | static void s3c2416_irq_dma_ack(unsigned int irqno) | ||
156 | { | ||
157 | s3c_irqsub_maskack(irqno, INTMSK_DMA, SUBMSK_DMA); | ||
158 | } | ||
159 | |||
160 | static struct irq_chip s3c2416_irq_dma = { | ||
161 | .mask = s3c2416_irq_dma_mask, | ||
162 | .unmask = s3c2416_irq_dma_unmask, | ||
163 | .ack = s3c2416_irq_dma_ack, | ||
164 | }; | ||
165 | |||
166 | |||
167 | /* UART3 sub interrupts */ | ||
168 | |||
169 | static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) | ||
170 | { | ||
171 | s3c2416_irq_demux(IRQ_S3C2443_UART3, 3); | ||
172 | } | ||
173 | |||
174 | #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) | ||
175 | #define SUBMSK_UART3 (0xf << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) | ||
176 | |||
177 | |||
178 | static void s3c2416_irq_uart3_mask(unsigned int irqno) | ||
179 | { | ||
180 | s3c_irqsub_mask(irqno, INTMSK_UART3, SUBMSK_UART3); | ||
181 | } | ||
182 | |||
183 | static void s3c2416_irq_uart3_unmask(unsigned int irqno) | ||
184 | { | ||
185 | s3c_irqsub_unmask(irqno, INTMSK_UART3); | ||
186 | } | ||
187 | |||
188 | static void s3c2416_irq_uart3_ack(unsigned int irqno) | ||
189 | { | ||
190 | s3c_irqsub_maskack(irqno, INTMSK_UART3, SUBMSK_UART3); | ||
191 | } | ||
192 | |||
193 | static struct irq_chip s3c2416_irq_uart3 = { | ||
194 | .mask = s3c2416_irq_uart3_mask, | ||
195 | .unmask = s3c2416_irq_uart3_unmask, | ||
196 | .ack = s3c2416_irq_uart3_ack, | ||
197 | }; | ||
198 | |||
199 | |||
200 | /* IRQ initialisation code */ | ||
201 | |||
202 | static int __init s3c2416_add_sub(unsigned int base, | ||
203 | void (*demux)(unsigned int, | ||
204 | struct irq_desc *), | ||
205 | struct irq_chip *chip, | ||
206 | unsigned int start, unsigned int end) | ||
207 | { | ||
208 | unsigned int irqno; | ||
209 | |||
210 | set_irq_chip(base, &s3c_irq_level_chip); | ||
211 | set_irq_handler(base, handle_level_irq); | ||
212 | set_irq_chained_handler(base, demux); | ||
213 | |||
214 | for (irqno = start; irqno <= end; irqno++) { | ||
215 | set_irq_chip(irqno, chip); | ||
216 | set_irq_handler(irqno, handle_level_irq); | ||
217 | set_irq_flags(irqno, IRQF_VALID); | ||
218 | } | ||
219 | |||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static int __init s3c2416_irq_add(struct sys_device *sysdev) | ||
224 | { | ||
225 | printk(KERN_INFO "S3C2416: IRQ Support\n"); | ||
226 | |||
227 | s3c2416_add_sub(IRQ_LCD, s3c2416_irq_demux_lcd, &s3c2416_irq_lcd, | ||
228 | IRQ_S3C2443_LCD2, IRQ_S3C2443_LCD4); | ||
229 | |||
230 | s3c2416_add_sub(IRQ_S3C2443_DMA, s3c2416_irq_demux_dma, | ||
231 | &s3c2416_irq_dma, IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5); | ||
232 | |||
233 | s3c2416_add_sub(IRQ_S3C2443_UART3, s3c2416_irq_demux_uart3, | ||
234 | &s3c2416_irq_uart3, | ||
235 | IRQ_S3C2443_RX3, IRQ_S3C2443_ERR3); | ||
236 | |||
237 | s3c2416_add_sub(IRQ_WDT, s3c2416_irq_demux_wdtac97, | ||
238 | &s3c2416_irq_wdtac97, | ||
239 | IRQ_S3C2443_WDT, IRQ_S3C2443_AC97); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static struct sysdev_driver s3c2416_irq_driver = { | ||
245 | .add = s3c2416_irq_add, | ||
246 | }; | ||
247 | |||
248 | static int __init s3c2416_irq_init(void) | ||
249 | { | ||
250 | return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_irq_driver); | ||
251 | } | ||
252 | |||
253 | arch_initcall(s3c2416_irq_init); | ||
254 | |||
diff --git a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c2416/mach-smdk2416.c new file mode 100644 index 000000000000..99d24c44f30f --- /dev/null +++ b/arch/arm/mach-s3c2416/mach-smdk2416.c | |||
@@ -0,0 +1,150 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/mach-hanlin_v3c.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/mtd/partitions.h> | ||
24 | #include <linux/gpio.h> | ||
25 | |||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/irq.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <plat/regs-serial.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | #include <mach/regs-lcd.h> | ||
37 | |||
38 | #include <mach/idle.h> | ||
39 | #include <mach/fb.h> | ||
40 | #include <mach/leds-gpio.h> | ||
41 | #include <plat/iic.h> | ||
42 | |||
43 | #include <plat/s3c2416.h> | ||
44 | #include <plat/clock.h> | ||
45 | #include <plat/devs.h> | ||
46 | #include <plat/cpu.h> | ||
47 | #include <plat/nand.h> | ||
48 | |||
49 | #include <plat/common-smdk.h> | ||
50 | |||
51 | static struct map_desc smdk2416_iodesc[] __initdata = { | ||
52 | /* ISA IO Space map (memory space selected by A24) */ | ||
53 | |||
54 | { | ||
55 | .virtual = (u32)S3C24XX_VA_ISA_WORD, | ||
56 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
57 | .length = 0x10000, | ||
58 | .type = MT_DEVICE, | ||
59 | }, { | ||
60 | .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000, | ||
61 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
62 | .length = SZ_4M, | ||
63 | .type = MT_DEVICE, | ||
64 | }, { | ||
65 | .virtual = (u32)S3C24XX_VA_ISA_BYTE, | ||
66 | .pfn = __phys_to_pfn(S3C2410_CS2), | ||
67 | .length = 0x10000, | ||
68 | .type = MT_DEVICE, | ||
69 | }, { | ||
70 | .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000, | ||
71 | .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), | ||
72 | .length = SZ_4M, | ||
73 | .type = MT_DEVICE, | ||
74 | } | ||
75 | }; | ||
76 | |||
77 | #define UCON (S3C2410_UCON_DEFAULT | \ | ||
78 | S3C2440_UCON_PCLK | \ | ||
79 | S3C2443_UCON_RXERR_IRQEN) | ||
80 | |||
81 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE) | ||
82 | |||
83 | #define UFCON (S3C2410_UFCON_RXTRIG8 | \ | ||
84 | S3C2410_UFCON_FIFOMODE | \ | ||
85 | S3C2440_UFCON_TXTRIG16) | ||
86 | |||
87 | static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = { | ||
88 | [0] = { | ||
89 | .hwport = 0, | ||
90 | .flags = 0, | ||
91 | .ucon = UCON, | ||
92 | .ulcon = ULCON, | ||
93 | .ufcon = UFCON, | ||
94 | }, | ||
95 | [1] = { | ||
96 | .hwport = 1, | ||
97 | .flags = 0, | ||
98 | .ucon = UCON, | ||
99 | .ulcon = ULCON, | ||
100 | .ufcon = UFCON, | ||
101 | }, | ||
102 | /* IR port */ | ||
103 | [2] = { | ||
104 | .hwport = 2, | ||
105 | .flags = 0, | ||
106 | .ucon = UCON, | ||
107 | .ulcon = ULCON | 0x50, | ||
108 | .ufcon = UFCON, | ||
109 | } | ||
110 | }; | ||
111 | |||
112 | static struct platform_device *smdk2416_devices[] __initdata = { | ||
113 | &s3c_device_wdt, | ||
114 | &s3c_device_ohci, | ||
115 | &s3c_device_i2c0, | ||
116 | &s3c_device_hsmmc0, | ||
117 | &s3c_device_hsmmc1, | ||
118 | }; | ||
119 | |||
120 | static void __init smdk2416_map_io(void) | ||
121 | { | ||
122 | |||
123 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); | ||
124 | s3c24xx_init_clocks(12000000); | ||
125 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); | ||
126 | |||
127 | } | ||
128 | |||
129 | static void __init smdk2416_machine_init(void) | ||
130 | { | ||
131 | s3c_i2c0_set_platdata(NULL); | ||
132 | |||
133 | gpio_request(S3C2410_GPB(4), "USBHost Power"); | ||
134 | gpio_direction_output(S3C2410_GPB(4), 1); | ||
135 | |||
136 | platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices)); | ||
137 | smdk_machine_init(); | ||
138 | } | ||
139 | |||
140 | MACHINE_START(SMDK2416, "SMDK2416") | ||
141 | /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */ | ||
142 | .phys_io = S3C2410_PA_UART, | ||
143 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
144 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
145 | |||
146 | .init_irq = s3c24xx_init_irq, | ||
147 | .map_io = smdk2416_map_io, | ||
148 | .init_machine = smdk2416_machine_init, | ||
149 | .timer = &s3c24xx_timer, | ||
150 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c new file mode 100644 index 000000000000..3bff05745d0b --- /dev/null +++ b/arch/arm/mach-s3c2416/s3c2416.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* linux/arch/arm/mach-s3c2416/s3c2416.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>, | ||
4 | * as part of OpenInkpot project | ||
5 | * Copyright (c) 2009 Promwad Innovation Company | ||
6 | * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> | ||
7 | * | ||
8 | * Samsung S3C2416 Mobile CPU support | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/list.h> | ||
29 | #include <linux/timer.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/gpio.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/serial_core.h> | ||
34 | #include <linux/sysdev.h> | ||
35 | #include <linux/clk.h> | ||
36 | #include <linux/io.h> | ||
37 | |||
38 | #include <asm/mach/arch.h> | ||
39 | #include <asm/mach/map.h> | ||
40 | #include <asm/mach/irq.h> | ||
41 | |||
42 | #include <mach/hardware.h> | ||
43 | #include <asm/proc-fns.h> | ||
44 | #include <asm/irq.h> | ||
45 | |||
46 | #include <mach/reset.h> | ||
47 | #include <mach/idle.h> | ||
48 | #include <mach/regs-s3c2443-clock.h> | ||
49 | |||
50 | #include <plat/gpio-core.h> | ||
51 | #include <plat/gpio-cfg.h> | ||
52 | #include <plat/gpio-cfg-helpers.h> | ||
53 | #include <plat/s3c2416.h> | ||
54 | #include <plat/devs.h> | ||
55 | #include <plat/cpu.h> | ||
56 | |||
57 | #include <plat/iic-core.h> | ||
58 | |||
59 | static struct map_desc s3c2416_iodesc[] __initdata = { | ||
60 | IODESC_ENT(WATCHDOG), | ||
61 | IODESC_ENT(CLKPWR), | ||
62 | IODESC_ENT(TIMER), | ||
63 | }; | ||
64 | |||
65 | struct sysdev_class s3c2416_sysclass = { | ||
66 | .name = "s3c2416-core", | ||
67 | }; | ||
68 | |||
69 | static struct sys_device s3c2416_sysdev = { | ||
70 | .cls = &s3c2416_sysclass, | ||
71 | }; | ||
72 | |||
73 | static void s3c2416_hard_reset(void) | ||
74 | { | ||
75 | __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); | ||
76 | } | ||
77 | |||
78 | int __init s3c2416_init(void) | ||
79 | { | ||
80 | printk(KERN_INFO "S3C2416: Initializing architecture\n"); | ||
81 | |||
82 | s3c24xx_reset_hook = s3c2416_hard_reset; | ||
83 | /* s3c24xx_idle = s3c2416_idle; */ | ||
84 | |||
85 | /* change WDT IRQ number */ | ||
86 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | ||
87 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; | ||
88 | |||
89 | /* the i2c devices are directly compatible with s3c2440 */ | ||
90 | s3c_i2c0_setname("s3c2440-i2c"); | ||
91 | s3c_i2c1_setname("s3c2440-i2c"); | ||
92 | |||
93 | return sysdev_register(&s3c2416_sysdev); | ||
94 | } | ||
95 | |||
96 | void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
97 | { | ||
98 | s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); | ||
99 | |||
100 | s3c_device_nand.name = "s3c2416-nand"; | ||
101 | } | ||
102 | |||
103 | /* s3c2416_map_io | ||
104 | * | ||
105 | * register the standard cpu IO areas, and any passed in from the | ||
106 | * machine specific initialisation. | ||
107 | */ | ||
108 | |||
109 | void __init s3c2416_map_io(void) | ||
110 | { | ||
111 | s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown; | ||
112 | s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown; | ||
113 | |||
114 | iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); | ||
115 | } | ||
116 | |||
117 | /* need to register class before we actually register the device, and | ||
118 | * we also need to ensure that it has been initialised before any of the | ||
119 | * drivers even try to use it (even if not on an s3c2416 based system) | ||
120 | * as a driver which may support both 2443 and 2440 may try and use it. | ||
121 | */ | ||
122 | |||
123 | static int __init s3c2416_core_init(void) | ||
124 | { | ||
125 | return sysdev_class_register(&s3c2416_sysclass); | ||
126 | } | ||
127 | |||
128 | core_initcall(s3c2416_core_init); | ||