diff options
author | Andrew Victor <andrew@sanpeople.com> | 2007-02-08 03:42:40 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-02-08 09:55:24 -0500 |
commit | b2c6561605da4802886cafe96432b8e2968e9edc (patch) | |
tree | 46991d838d08e6b7ed4ec3942a1bc7ea70b8280f /arch/arm | |
parent | d0760b3bc8ff9b34e3e2e166e2102548a24751b4 (diff) |
[ARM] 4145/2: AT91: Add support for AT91SAM9263 processor
Add support for the Atmel AT91SAM9263 processor. It is similar to the
AT91SAM9260 but with more integrated peripherals, 5 GPIO banks, etc.
Original patch from Nicolas Ferre.
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263.c | 313 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 818 | ||||
-rw-r--r-- | arch/arm/mach-at91/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/generic.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/Kconfig | 4 |
8 files changed, 1142 insertions, 3 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 9f11db8af233..2499385e22da 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -14,6 +14,9 @@ config ARCH_AT91SAM9260 | |||
14 | config ARCH_AT91SAM9261 | 14 | config ARCH_AT91SAM9261 |
15 | bool "AT91SAM9261" | 15 | bool "AT91SAM9261" |
16 | 16 | ||
17 | config ARCH_AT91SAM9263 | ||
18 | bool "AT91SAM9263" | ||
19 | |||
17 | endchoice | 20 | endchoice |
18 | 21 | ||
19 | # ---------------------------------------------------------- | 22 | # ---------------------------------------------------------- |
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index cf777007847a..2fd4cd4a57f8 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -13,6 +13,7 @@ obj-$(CONFIG_PM) += pm.o | |||
13 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o | 13 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o |
14 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o | 14 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o |
15 | obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o | 15 | obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o |
16 | obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o | ||
16 | 17 | ||
17 | # AT91RM9200 board-specific support | 18 | # AT91RM9200 board-specific support |
18 | obj-$(CONFIG_MACH_ONEARM) += board-1arm.o | 19 | obj-$(CONFIG_MACH_ONEARM) += board-1arm.o |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c new file mode 100644 index 000000000000..fae6a821a61b --- /dev/null +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -0,0 +1,313 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91sam9263.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Atmel Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | |||
15 | #include <asm/mach/arch.h> | ||
16 | #include <asm/mach/map.h> | ||
17 | #include <asm/arch/at91sam9263.h> | ||
18 | #include <asm/arch/at91_pmc.h> | ||
19 | #include <asm/arch/at91_rstc.h> | ||
20 | |||
21 | #include "generic.h" | ||
22 | #include "clock.h" | ||
23 | |||
24 | static struct map_desc at91sam9263_io_desc[] __initdata = { | ||
25 | { | ||
26 | .virtual = AT91_VA_BASE_SYS, | ||
27 | .pfn = __phys_to_pfn(AT91_BASE_SYS), | ||
28 | .length = SZ_16K, | ||
29 | .type = MT_DEVICE, | ||
30 | }, { | ||
31 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9263_SRAM0_SIZE, | ||
32 | .pfn = __phys_to_pfn(AT91SAM9263_SRAM0_BASE), | ||
33 | .length = AT91SAM9263_SRAM0_SIZE, | ||
34 | .type = MT_DEVICE, | ||
35 | }, { | ||
36 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9263_SRAM0_SIZE - AT91SAM9263_SRAM1_SIZE, | ||
37 | .pfn = __phys_to_pfn(AT91SAM9263_SRAM1_BASE), | ||
38 | .length = AT91SAM9263_SRAM1_SIZE, | ||
39 | .type = MT_DEVICE, | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | /* -------------------------------------------------------------------- | ||
44 | * Clocks | ||
45 | * -------------------------------------------------------------------- */ | ||
46 | |||
47 | /* | ||
48 | * The peripheral clocks. | ||
49 | */ | ||
50 | static struct clk pioA_clk = { | ||
51 | .name = "pioA_clk", | ||
52 | .pmc_mask = 1 << AT91SAM9263_ID_PIOA, | ||
53 | .type = CLK_TYPE_PERIPHERAL, | ||
54 | }; | ||
55 | static struct clk pioB_clk = { | ||
56 | .name = "pioB_clk", | ||
57 | .pmc_mask = 1 << AT91SAM9263_ID_PIOB, | ||
58 | .type = CLK_TYPE_PERIPHERAL, | ||
59 | }; | ||
60 | static struct clk pioCDE_clk = { | ||
61 | .name = "pioCDE_clk", | ||
62 | .pmc_mask = 1 << AT91SAM9263_ID_PIOCDE, | ||
63 | .type = CLK_TYPE_PERIPHERAL, | ||
64 | }; | ||
65 | static struct clk usart0_clk = { | ||
66 | .name = "usart0_clk", | ||
67 | .pmc_mask = 1 << AT91SAM9263_ID_US0, | ||
68 | .type = CLK_TYPE_PERIPHERAL, | ||
69 | }; | ||
70 | static struct clk usart1_clk = { | ||
71 | .name = "usart1_clk", | ||
72 | .pmc_mask = 1 << AT91SAM9263_ID_US1, | ||
73 | .type = CLK_TYPE_PERIPHERAL, | ||
74 | }; | ||
75 | static struct clk usart2_clk = { | ||
76 | .name = "usart2_clk", | ||
77 | .pmc_mask = 1 << AT91SAM9263_ID_US2, | ||
78 | .type = CLK_TYPE_PERIPHERAL, | ||
79 | }; | ||
80 | static struct clk mmc0_clk = { | ||
81 | .name = "mci0_clk", | ||
82 | .pmc_mask = 1 << AT91SAM9263_ID_MCI0, | ||
83 | .type = CLK_TYPE_PERIPHERAL, | ||
84 | }; | ||
85 | static struct clk mmc1_clk = { | ||
86 | .name = "mci1_clk", | ||
87 | .pmc_mask = 1 << AT91SAM9263_ID_MCI1, | ||
88 | .type = CLK_TYPE_PERIPHERAL, | ||
89 | }; | ||
90 | static struct clk twi_clk = { | ||
91 | .name = "twi_clk", | ||
92 | .pmc_mask = 1 << AT91SAM9263_ID_TWI, | ||
93 | .type = CLK_TYPE_PERIPHERAL, | ||
94 | }; | ||
95 | static struct clk spi0_clk = { | ||
96 | .name = "spi0_clk", | ||
97 | .pmc_mask = 1 << AT91SAM9263_ID_SPI0, | ||
98 | .type = CLK_TYPE_PERIPHERAL, | ||
99 | }; | ||
100 | static struct clk spi1_clk = { | ||
101 | .name = "spi1_clk", | ||
102 | .pmc_mask = 1 << AT91SAM9263_ID_SPI1, | ||
103 | .type = CLK_TYPE_PERIPHERAL, | ||
104 | }; | ||
105 | static struct clk tcb_clk = { | ||
106 | .name = "tcb_clk", | ||
107 | .pmc_mask = 1 << AT91SAM9263_ID_TCB, | ||
108 | .type = CLK_TYPE_PERIPHERAL, | ||
109 | }; | ||
110 | static struct clk ether_clk = { | ||
111 | .name = "ether_clk", | ||
112 | .pmc_mask = 1 << AT91SAM9263_ID_EMAC, | ||
113 | .type = CLK_TYPE_PERIPHERAL, | ||
114 | }; | ||
115 | static struct clk udc_clk = { | ||
116 | .name = "udc_clk", | ||
117 | .pmc_mask = 1 << AT91SAM9263_ID_UDP, | ||
118 | .type = CLK_TYPE_PERIPHERAL, | ||
119 | }; | ||
120 | static struct clk isi_clk = { | ||
121 | .name = "isi_clk", | ||
122 | .pmc_mask = 1 << AT91SAM9263_ID_ISI, | ||
123 | .type = CLK_TYPE_PERIPHERAL, | ||
124 | }; | ||
125 | static struct clk lcdc_clk = { | ||
126 | .name = "lcdc_clk", | ||
127 | .pmc_mask = 1 << AT91SAM9263_ID_ISI, | ||
128 | .type = CLK_TYPE_PERIPHERAL, | ||
129 | }; | ||
130 | static struct clk ohci_clk = { | ||
131 | .name = "ohci_clk", | ||
132 | .pmc_mask = 1 << AT91SAM9263_ID_UHP, | ||
133 | .type = CLK_TYPE_PERIPHERAL, | ||
134 | }; | ||
135 | |||
136 | static struct clk *periph_clocks[] __initdata = { | ||
137 | &pioA_clk, | ||
138 | &pioB_clk, | ||
139 | &pioCDE_clk, | ||
140 | &usart0_clk, | ||
141 | &usart1_clk, | ||
142 | &usart2_clk, | ||
143 | &mmc0_clk, | ||
144 | &mmc1_clk, | ||
145 | // can | ||
146 | &twi_clk, | ||
147 | &spi0_clk, | ||
148 | &spi1_clk, | ||
149 | // ssc0 .. ssc1 | ||
150 | // ac97 | ||
151 | &tcb_clk, | ||
152 | // pwmc | ||
153 | ðer_clk, | ||
154 | // 2dge | ||
155 | &udc_clk, | ||
156 | &isi_clk, | ||
157 | &lcdc_clk, | ||
158 | // dma | ||
159 | &ohci_clk, | ||
160 | // irq0 .. irq1 | ||
161 | }; | ||
162 | |||
163 | /* | ||
164 | * The four programmable clocks. | ||
165 | * You must configure pin multiplexing to bring these signals out. | ||
166 | */ | ||
167 | static struct clk pck0 = { | ||
168 | .name = "pck0", | ||
169 | .pmc_mask = AT91_PMC_PCK0, | ||
170 | .type = CLK_TYPE_PROGRAMMABLE, | ||
171 | .id = 0, | ||
172 | }; | ||
173 | static struct clk pck1 = { | ||
174 | .name = "pck1", | ||
175 | .pmc_mask = AT91_PMC_PCK1, | ||
176 | .type = CLK_TYPE_PROGRAMMABLE, | ||
177 | .id = 1, | ||
178 | }; | ||
179 | static struct clk pck2 = { | ||
180 | .name = "pck2", | ||
181 | .pmc_mask = AT91_PMC_PCK2, | ||
182 | .type = CLK_TYPE_PROGRAMMABLE, | ||
183 | .id = 2, | ||
184 | }; | ||
185 | static struct clk pck3 = { | ||
186 | .name = "pck3", | ||
187 | .pmc_mask = AT91_PMC_PCK3, | ||
188 | .type = CLK_TYPE_PROGRAMMABLE, | ||
189 | .id = 3, | ||
190 | }; | ||
191 | |||
192 | static void __init at91sam9263_register_clocks(void) | ||
193 | { | ||
194 | int i; | ||
195 | |||
196 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) | ||
197 | clk_register(periph_clocks[i]); | ||
198 | |||
199 | clk_register(&pck0); | ||
200 | clk_register(&pck1); | ||
201 | clk_register(&pck2); | ||
202 | clk_register(&pck3); | ||
203 | } | ||
204 | |||
205 | /* -------------------------------------------------------------------- | ||
206 | * GPIO | ||
207 | * -------------------------------------------------------------------- */ | ||
208 | |||
209 | static struct at91_gpio_bank at91sam9263_gpio[] = { | ||
210 | { | ||
211 | .id = AT91SAM9263_ID_PIOA, | ||
212 | .offset = AT91_PIOA, | ||
213 | .clock = &pioA_clk, | ||
214 | }, { | ||
215 | .id = AT91SAM9263_ID_PIOB, | ||
216 | .offset = AT91_PIOB, | ||
217 | .clock = &pioB_clk, | ||
218 | }, { | ||
219 | .id = AT91SAM9263_ID_PIOCDE, | ||
220 | .offset = AT91_PIOC, | ||
221 | .clock = &pioCDE_clk, | ||
222 | }, { | ||
223 | .id = AT91SAM9263_ID_PIOCDE, | ||
224 | .offset = AT91_PIOD, | ||
225 | .clock = &pioCDE_clk, | ||
226 | }, { | ||
227 | .id = AT91SAM9263_ID_PIOCDE, | ||
228 | .offset = AT91_PIOE, | ||
229 | .clock = &pioCDE_clk, | ||
230 | } | ||
231 | }; | ||
232 | |||
233 | static void at91sam9263_reset(void) | ||
234 | { | ||
235 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); | ||
236 | } | ||
237 | |||
238 | |||
239 | /* -------------------------------------------------------------------- | ||
240 | * AT91SAM9263 processor initialization | ||
241 | * -------------------------------------------------------------------- */ | ||
242 | |||
243 | void __init at91sam9263_initialize(unsigned long main_clock) | ||
244 | { | ||
245 | /* Map peripherals */ | ||
246 | iotable_init(at91sam9263_io_desc, ARRAY_SIZE(at91sam9263_io_desc)); | ||
247 | |||
248 | at91_arch_reset = at91sam9263_reset; | ||
249 | at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); | ||
250 | |||
251 | /* Init clock subsystem */ | ||
252 | at91_clock_init(main_clock); | ||
253 | |||
254 | /* Register the processor-specific clocks */ | ||
255 | at91sam9263_register_clocks(); | ||
256 | |||
257 | /* Register GPIO subsystem */ | ||
258 | at91_gpio_init(at91sam9263_gpio, 5); | ||
259 | } | ||
260 | |||
261 | /* -------------------------------------------------------------------- | ||
262 | * Interrupt initialization | ||
263 | * -------------------------------------------------------------------- */ | ||
264 | |||
265 | /* | ||
266 | * The default interrupt priority levels (0 = lowest, 7 = highest). | ||
267 | */ | ||
268 | static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { | ||
269 | 7, /* Advanced Interrupt Controller (FIQ) */ | ||
270 | 7, /* System Peripherals */ | ||
271 | 0, /* Parallel IO Controller A */ | ||
272 | 0, /* Parallel IO Controller B */ | ||
273 | 0, /* Parallel IO Controller C, D and E */ | ||
274 | 0, | ||
275 | 0, | ||
276 | 6, /* USART 0 */ | ||
277 | 6, /* USART 1 */ | ||
278 | 6, /* USART 2 */ | ||
279 | 0, /* Multimedia Card Interface 0 */ | ||
280 | 0, /* Multimedia Card Interface 1 */ | ||
281 | 4, /* CAN */ | ||
282 | 0, /* Two-Wire Interface */ | ||
283 | 6, /* Serial Peripheral Interface 0 */ | ||
284 | 6, /* Serial Peripheral Interface 1 */ | ||
285 | 5, /* Serial Synchronous Controller 0 */ | ||
286 | 5, /* Serial Synchronous Controller 1 */ | ||
287 | 6, /* AC97 Controller */ | ||
288 | 0, /* Timer Counter 0, 1 and 2 */ | ||
289 | 0, /* Pulse Width Modulation Controller */ | ||
290 | 3, /* Ethernet */ | ||
291 | 0, | ||
292 | 0, /* 2D Graphic Engine */ | ||
293 | 3, /* USB Device Port */ | ||
294 | 0, /* Image Sensor Interface */ | ||
295 | 3, /* LDC Controller */ | ||
296 | 0, /* DMA Controller */ | ||
297 | 0, | ||
298 | 3, /* USB Host port */ | ||
299 | 0, /* Advanced Interrupt Controller (IRQ0) */ | ||
300 | 0, /* Advanced Interrupt Controller (IRQ1) */ | ||
301 | }; | ||
302 | |||
303 | void __init at91sam9263_init_interrupts(unsigned int priority[NR_AIC_IRQS]) | ||
304 | { | ||
305 | if (!priority) | ||
306 | priority = at91sam9263_default_irq_priority; | ||
307 | |||
308 | /* Initialize the AIC interrupt controller */ | ||
309 | at91_aic_init(priority); | ||
310 | |||
311 | /* Enable GPIO interrupts */ | ||
312 | at91_gpio_irq_setup(); | ||
313 | } | ||
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c new file mode 100644 index 000000000000..d9af7ca58bce --- /dev/null +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -0,0 +1,818 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91sam9263_devices.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Atmel Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | #include <asm/mach/arch.h> | ||
13 | #include <asm/mach/map.h> | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <asm/arch/board.h> | ||
18 | #include <asm/arch/gpio.h> | ||
19 | #include <asm/arch/at91sam9263.h> | ||
20 | #include <asm/arch/at91sam926x_mc.h> | ||
21 | #include <asm/arch/at91sam9263_matrix.h> | ||
22 | |||
23 | #include "generic.h" | ||
24 | |||
25 | #define SZ_512 0x00000200 | ||
26 | #define SZ_256 0x00000100 | ||
27 | #define SZ_16 0x00000010 | ||
28 | |||
29 | /* -------------------------------------------------------------------- | ||
30 | * USB Host | ||
31 | * -------------------------------------------------------------------- */ | ||
32 | |||
33 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
34 | static u64 ohci_dmamask = 0xffffffffUL; | ||
35 | static struct at91_usbh_data usbh_data; | ||
36 | |||
37 | static struct resource usbh_resources[] = { | ||
38 | [0] = { | ||
39 | .start = AT91SAM9263_UHP_BASE, | ||
40 | .end = AT91SAM9263_UHP_BASE + SZ_1M - 1, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, | ||
43 | [1] = { | ||
44 | .start = AT91SAM9263_ID_UHP, | ||
45 | .end = AT91SAM9263_ID_UHP, | ||
46 | .flags = IORESOURCE_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | static struct platform_device at91_usbh_device = { | ||
51 | .name = "at91_ohci", | ||
52 | .id = -1, | ||
53 | .dev = { | ||
54 | .dma_mask = &ohci_dmamask, | ||
55 | .coherent_dma_mask = 0xffffffff, | ||
56 | .platform_data = &usbh_data, | ||
57 | }, | ||
58 | .resource = usbh_resources, | ||
59 | .num_resources = ARRAY_SIZE(usbh_resources), | ||
60 | }; | ||
61 | |||
62 | void __init at91_add_device_usbh(struct at91_usbh_data *data) | ||
63 | { | ||
64 | int i; | ||
65 | |||
66 | if (!data) | ||
67 | return; | ||
68 | |||
69 | /* Enable VBus control for UHP ports */ | ||
70 | for (i = 0; i < data->ports; i++) { | ||
71 | if (data->vbus_pin[i]) | ||
72 | at91_set_gpio_output(data->vbus_pin[i], 0); | ||
73 | } | ||
74 | |||
75 | usbh_data = *data; | ||
76 | platform_device_register(&at91_usbh_device); | ||
77 | } | ||
78 | #else | ||
79 | void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | ||
80 | #endif | ||
81 | |||
82 | |||
83 | /* -------------------------------------------------------------------- | ||
84 | * USB Device (Gadget) | ||
85 | * -------------------------------------------------------------------- */ | ||
86 | |||
87 | #ifdef CONFIG_USB_GADGET_AT91 | ||
88 | static struct at91_udc_data udc_data; | ||
89 | |||
90 | static struct resource udc_resources[] = { | ||
91 | [0] = { | ||
92 | .start = AT91SAM9263_BASE_UDP, | ||
93 | .end = AT91SAM9263_BASE_UDP + SZ_16K - 1, | ||
94 | .flags = IORESOURCE_MEM, | ||
95 | }, | ||
96 | [1] = { | ||
97 | .start = AT91SAM9263_ID_UDP, | ||
98 | .end = AT91SAM9263_ID_UDP, | ||
99 | .flags = IORESOURCE_IRQ, | ||
100 | }, | ||
101 | }; | ||
102 | |||
103 | static struct platform_device at91_udc_device = { | ||
104 | .name = "at91_udc", | ||
105 | .id = -1, | ||
106 | .dev = { | ||
107 | .platform_data = &udc_data, | ||
108 | }, | ||
109 | .resource = udc_resources, | ||
110 | .num_resources = ARRAY_SIZE(udc_resources), | ||
111 | }; | ||
112 | |||
113 | void __init at91_add_device_udc(struct at91_udc_data *data) | ||
114 | { | ||
115 | if (!data) | ||
116 | return; | ||
117 | |||
118 | if (data->vbus_pin) { | ||
119 | at91_set_gpio_input(data->vbus_pin, 0); | ||
120 | at91_set_deglitch(data->vbus_pin, 1); | ||
121 | } | ||
122 | |||
123 | /* Pullup pin is handled internally by USB device peripheral */ | ||
124 | |||
125 | udc_data = *data; | ||
126 | platform_device_register(&at91_udc_device); | ||
127 | } | ||
128 | #else | ||
129 | void __init at91_add_device_udc(struct at91_udc_data *data) {} | ||
130 | #endif | ||
131 | |||
132 | |||
133 | /* -------------------------------------------------------------------- | ||
134 | * Ethernet | ||
135 | * -------------------------------------------------------------------- */ | ||
136 | |||
137 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | ||
138 | static u64 eth_dmamask = 0xffffffffUL; | ||
139 | static struct at91_eth_data eth_data; | ||
140 | |||
141 | static struct resource eth_resources[] = { | ||
142 | [0] = { | ||
143 | .start = AT91SAM9263_BASE_EMAC, | ||
144 | .end = AT91SAM9263_BASE_EMAC + SZ_16K - 1, | ||
145 | .flags = IORESOURCE_MEM, | ||
146 | }, | ||
147 | [1] = { | ||
148 | .start = AT91SAM9263_ID_EMAC, | ||
149 | .end = AT91SAM9263_ID_EMAC, | ||
150 | .flags = IORESOURCE_IRQ, | ||
151 | }, | ||
152 | }; | ||
153 | |||
154 | static struct platform_device at91sam9263_eth_device = { | ||
155 | .name = "macb", | ||
156 | .id = -1, | ||
157 | .dev = { | ||
158 | .dma_mask = ð_dmamask, | ||
159 | .coherent_dma_mask = 0xffffffff, | ||
160 | .platform_data = ð_data, | ||
161 | }, | ||
162 | .resource = eth_resources, | ||
163 | .num_resources = ARRAY_SIZE(eth_resources), | ||
164 | }; | ||
165 | |||
166 | void __init at91_add_device_eth(struct at91_eth_data *data) | ||
167 | { | ||
168 | if (!data) | ||
169 | return; | ||
170 | |||
171 | if (data->phy_irq_pin) { | ||
172 | at91_set_gpio_input(data->phy_irq_pin, 0); | ||
173 | at91_set_deglitch(data->phy_irq_pin, 1); | ||
174 | } | ||
175 | |||
176 | /* Pins used for MII and RMII */ | ||
177 | at91_set_A_periph(AT91_PIN_PE21, 0); /* ETXCK_EREFCK */ | ||
178 | at91_set_B_periph(AT91_PIN_PC25, 0); /* ERXDV */ | ||
179 | at91_set_A_periph(AT91_PIN_PE25, 0); /* ERX0 */ | ||
180 | at91_set_A_periph(AT91_PIN_PE26, 0); /* ERX1 */ | ||
181 | at91_set_A_periph(AT91_PIN_PE27, 0); /* ERXER */ | ||
182 | at91_set_A_periph(AT91_PIN_PE28, 0); /* ETXEN */ | ||
183 | at91_set_A_periph(AT91_PIN_PE23, 0); /* ETX0 */ | ||
184 | at91_set_A_periph(AT91_PIN_PE24, 0); /* ETX1 */ | ||
185 | at91_set_A_periph(AT91_PIN_PE30, 0); /* EMDIO */ | ||
186 | at91_set_A_periph(AT91_PIN_PE29, 0); /* EMDC */ | ||
187 | |||
188 | if (!data->is_rmii) { | ||
189 | at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */ | ||
190 | at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */ | ||
191 | at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */ | ||
192 | at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */ | ||
193 | at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */ | ||
194 | at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */ | ||
195 | at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */ | ||
196 | at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */ | ||
197 | } | ||
198 | |||
199 | eth_data = *data; | ||
200 | platform_device_register(&at91sam9263_eth_device); | ||
201 | } | ||
202 | #else | ||
203 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | ||
204 | #endif | ||
205 | |||
206 | |||
207 | /* -------------------------------------------------------------------- | ||
208 | * MMC / SD | ||
209 | * -------------------------------------------------------------------- */ | ||
210 | |||
211 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | ||
212 | static u64 mmc_dmamask = 0xffffffffUL; | ||
213 | static struct at91_mmc_data mmc0_data, mmc1_data; | ||
214 | |||
215 | static struct resource mmc0_resources[] = { | ||
216 | [0] = { | ||
217 | .start = AT91SAM9263_BASE_MCI0, | ||
218 | .end = AT91SAM9263_BASE_MCI0 + SZ_16K - 1, | ||
219 | .flags = IORESOURCE_MEM, | ||
220 | }, | ||
221 | [1] = { | ||
222 | .start = AT91SAM9263_ID_MCI0, | ||
223 | .end = AT91SAM9263_ID_MCI0, | ||
224 | .flags = IORESOURCE_IRQ, | ||
225 | }, | ||
226 | }; | ||
227 | |||
228 | static struct platform_device at91sam9263_mmc0_device = { | ||
229 | .name = "at91_mci", | ||
230 | .id = 0, | ||
231 | .dev = { | ||
232 | .dma_mask = &mmc_dmamask, | ||
233 | .coherent_dma_mask = 0xffffffff, | ||
234 | .platform_data = &mmc0_data, | ||
235 | }, | ||
236 | .resource = mmc0_resources, | ||
237 | .num_resources = ARRAY_SIZE(mmc0_resources), | ||
238 | }; | ||
239 | |||
240 | static struct resource mmc1_resources[] = { | ||
241 | [0] = { | ||
242 | .start = AT91SAM9263_BASE_MCI1, | ||
243 | .end = AT91SAM9263_BASE_MCI1 + SZ_16K - 1, | ||
244 | .flags = IORESOURCE_MEM, | ||
245 | }, | ||
246 | [1] = { | ||
247 | .start = AT91SAM9263_ID_MCI1, | ||
248 | .end = AT91SAM9263_ID_MCI1, | ||
249 | .flags = IORESOURCE_IRQ, | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct platform_device at91sam9263_mmc1_device = { | ||
254 | .name = "at91_mci", | ||
255 | .id = 1, | ||
256 | .dev = { | ||
257 | .dma_mask = &mmc_dmamask, | ||
258 | .coherent_dma_mask = 0xffffffff, | ||
259 | .platform_data = &mmc1_data, | ||
260 | }, | ||
261 | .resource = mmc1_resources, | ||
262 | .num_resources = ARRAY_SIZE(mmc1_resources), | ||
263 | }; | ||
264 | |||
265 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | ||
266 | { | ||
267 | if (!data) | ||
268 | return; | ||
269 | |||
270 | /* input/irq */ | ||
271 | if (data->det_pin) { | ||
272 | at91_set_gpio_input(data->det_pin, 1); | ||
273 | at91_set_deglitch(data->det_pin, 1); | ||
274 | } | ||
275 | if (data->wp_pin) | ||
276 | at91_set_gpio_input(data->wp_pin, 1); | ||
277 | if (data->vcc_pin) | ||
278 | at91_set_gpio_output(data->vcc_pin, 0); | ||
279 | |||
280 | if (mmc_id == 0) { /* MCI0 */ | ||
281 | /* CLK */ | ||
282 | at91_set_A_periph(AT91_PIN_PA12, 0); | ||
283 | |||
284 | if (data->slot_b) { | ||
285 | /* CMD */ | ||
286 | at91_set_A_periph(AT91_PIN_PA16, 1); | ||
287 | |||
288 | /* DAT0, maybe DAT1..DAT3 */ | ||
289 | at91_set_A_periph(AT91_PIN_PA17, 1); | ||
290 | if (data->wire4) { | ||
291 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
292 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
293 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
294 | } | ||
295 | } else { | ||
296 | /* CMD */ | ||
297 | at91_set_A_periph(AT91_PIN_PA1, 1); | ||
298 | |||
299 | /* DAT0, maybe DAT1..DAT3 */ | ||
300 | at91_set_A_periph(AT91_PIN_PA0, 1); | ||
301 | if (data->wire4) { | ||
302 | at91_set_A_periph(AT91_PIN_PA3, 1); | ||
303 | at91_set_A_periph(AT91_PIN_PA4, 1); | ||
304 | at91_set_A_periph(AT91_PIN_PA5, 1); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | mmc0_data = *data; | ||
309 | at91_clock_associate("mci0_clk", &at91sam9263_mmc1_device.dev, "mci_clk"); | ||
310 | platform_device_register(&at91sam9263_mmc0_device); | ||
311 | } else { /* MCI1 */ | ||
312 | /* CLK */ | ||
313 | at91_set_A_periph(AT91_PIN_PA6, 0); | ||
314 | |||
315 | if (data->slot_b) { | ||
316 | /* CMD */ | ||
317 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
318 | |||
319 | /* DAT0, maybe DAT1..DAT3 */ | ||
320 | at91_set_A_periph(AT91_PIN_PA22, 1); | ||
321 | if (data->wire4) { | ||
322 | at91_set_A_periph(AT91_PIN_PA23, 1); | ||
323 | at91_set_A_periph(AT91_PIN_PA24, 1); | ||
324 | at91_set_A_periph(AT91_PIN_PA25, 1); | ||
325 | } | ||
326 | } else { | ||
327 | /* CMD */ | ||
328 | at91_set_A_periph(AT91_PIN_PA7, 1); | ||
329 | |||
330 | /* DAT0, maybe DAT1..DAT3 */ | ||
331 | at91_set_A_periph(AT91_PIN_PA8, 1); | ||
332 | if (data->wire4) { | ||
333 | at91_set_A_periph(AT91_PIN_PA9, 1); | ||
334 | at91_set_A_periph(AT91_PIN_PA10, 1); | ||
335 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | mmc1_data = *data; | ||
340 | at91_clock_associate("mci1_clk", &at91sam9263_mmc1_device.dev, "mci_clk"); | ||
341 | platform_device_register(&at91sam9263_mmc1_device); | ||
342 | } | ||
343 | } | ||
344 | #else | ||
345 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | ||
346 | #endif | ||
347 | |||
348 | |||
349 | /* -------------------------------------------------------------------- | ||
350 | * NAND / SmartMedia | ||
351 | * -------------------------------------------------------------------- */ | ||
352 | |||
353 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | ||
354 | static struct at91_nand_data nand_data; | ||
355 | |||
356 | #define NAND_BASE AT91_CHIPSELECT_3 | ||
357 | |||
358 | static struct resource nand_resources[] = { | ||
359 | { | ||
360 | .start = NAND_BASE, | ||
361 | .end = NAND_BASE + SZ_256M - 1, | ||
362 | .flags = IORESOURCE_MEM, | ||
363 | } | ||
364 | }; | ||
365 | |||
366 | static struct platform_device at91sam9263_nand_device = { | ||
367 | .name = "at91_nand", | ||
368 | .id = -1, | ||
369 | .dev = { | ||
370 | .platform_data = &nand_data, | ||
371 | }, | ||
372 | .resource = nand_resources, | ||
373 | .num_resources = ARRAY_SIZE(nand_resources), | ||
374 | }; | ||
375 | |||
376 | void __init at91_add_device_nand(struct at91_nand_data *data) | ||
377 | { | ||
378 | unsigned long csa, mode; | ||
379 | |||
380 | if (!data) | ||
381 | return; | ||
382 | |||
383 | csa = at91_sys_read(AT91_MATRIX_EBI0CSA); | ||
384 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC); | ||
385 | |||
386 | /* set the bus interface characteristics */ | ||
387 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) | ||
388 | | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); | ||
389 | |||
390 | at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) | ||
391 | | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); | ||
392 | |||
393 | at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5)); | ||
394 | |||
395 | if (data->bus_width_16) | ||
396 | mode = AT91_SMC_DBW_16; | ||
397 | else | ||
398 | mode = AT91_SMC_DBW_8; | ||
399 | at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2)); | ||
400 | |||
401 | /* enable pin */ | ||
402 | if (data->enable_pin) | ||
403 | at91_set_gpio_output(data->enable_pin, 1); | ||
404 | |||
405 | /* ready/busy pin */ | ||
406 | if (data->rdy_pin) | ||
407 | at91_set_gpio_input(data->rdy_pin, 1); | ||
408 | |||
409 | /* card detect pin */ | ||
410 | if (data->det_pin) | ||
411 | at91_set_gpio_input(data->det_pin, 1); | ||
412 | |||
413 | nand_data = *data; | ||
414 | platform_device_register(&at91sam9263_nand_device); | ||
415 | } | ||
416 | #else | ||
417 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | ||
418 | #endif | ||
419 | |||
420 | |||
421 | /* -------------------------------------------------------------------- | ||
422 | * TWI (i2c) | ||
423 | * -------------------------------------------------------------------- */ | ||
424 | |||
425 | #if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) | ||
426 | |||
427 | static struct resource twi_resources[] = { | ||
428 | [0] = { | ||
429 | .start = AT91SAM9263_BASE_TWI, | ||
430 | .end = AT91SAM9263_BASE_TWI + SZ_16K - 1, | ||
431 | .flags = IORESOURCE_MEM, | ||
432 | }, | ||
433 | [1] = { | ||
434 | .start = AT91SAM9263_ID_TWI, | ||
435 | .end = AT91SAM9263_ID_TWI, | ||
436 | .flags = IORESOURCE_IRQ, | ||
437 | }, | ||
438 | }; | ||
439 | |||
440 | static struct platform_device at91sam9263_twi_device = { | ||
441 | .name = "at91_i2c", | ||
442 | .id = -1, | ||
443 | .resource = twi_resources, | ||
444 | .num_resources = ARRAY_SIZE(twi_resources), | ||
445 | }; | ||
446 | |||
447 | void __init at91_add_device_i2c(void) | ||
448 | { | ||
449 | /* pins used for TWI interface */ | ||
450 | at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */ | ||
451 | at91_set_multi_drive(AT91_PIN_PB4, 1); | ||
452 | |||
453 | at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */ | ||
454 | at91_set_multi_drive(AT91_PIN_PB5, 1); | ||
455 | |||
456 | platform_device_register(&at91sam9263_twi_device); | ||
457 | } | ||
458 | #else | ||
459 | void __init at91_add_device_i2c(void) {} | ||
460 | #endif | ||
461 | |||
462 | |||
463 | /* -------------------------------------------------------------------- | ||
464 | * SPI | ||
465 | * -------------------------------------------------------------------- */ | ||
466 | |||
467 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | ||
468 | static u64 spi_dmamask = 0xffffffffUL; | ||
469 | |||
470 | static struct resource spi0_resources[] = { | ||
471 | [0] = { | ||
472 | .start = AT91SAM9263_BASE_SPI0, | ||
473 | .end = AT91SAM9263_BASE_SPI0 + SZ_16K - 1, | ||
474 | .flags = IORESOURCE_MEM, | ||
475 | }, | ||
476 | [1] = { | ||
477 | .start = AT91SAM9263_ID_SPI0, | ||
478 | .end = AT91SAM9263_ID_SPI0, | ||
479 | .flags = IORESOURCE_IRQ, | ||
480 | }, | ||
481 | }; | ||
482 | |||
483 | static struct platform_device at91sam9263_spi0_device = { | ||
484 | .name = "atmel_spi", | ||
485 | .id = 0, | ||
486 | .dev = { | ||
487 | .dma_mask = &spi_dmamask, | ||
488 | .coherent_dma_mask = 0xffffffff, | ||
489 | }, | ||
490 | .resource = spi0_resources, | ||
491 | .num_resources = ARRAY_SIZE(spi0_resources), | ||
492 | }; | ||
493 | |||
494 | static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PB11 }; | ||
495 | |||
496 | static struct resource spi1_resources[] = { | ||
497 | [0] = { | ||
498 | .start = AT91SAM9263_BASE_SPI1, | ||
499 | .end = AT91SAM9263_BASE_SPI1 + SZ_16K - 1, | ||
500 | .flags = IORESOURCE_MEM, | ||
501 | }, | ||
502 | [1] = { | ||
503 | .start = AT91SAM9263_ID_SPI1, | ||
504 | .end = AT91SAM9263_ID_SPI1, | ||
505 | .flags = IORESOURCE_IRQ, | ||
506 | }, | ||
507 | }; | ||
508 | |||
509 | static struct platform_device at91sam9263_spi1_device = { | ||
510 | .name = "atmel_spi", | ||
511 | .id = 1, | ||
512 | .dev = { | ||
513 | .dma_mask = &spi_dmamask, | ||
514 | .coherent_dma_mask = 0xffffffff, | ||
515 | }, | ||
516 | .resource = spi1_resources, | ||
517 | .num_resources = ARRAY_SIZE(spi1_resources), | ||
518 | }; | ||
519 | |||
520 | static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 }; | ||
521 | |||
522 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | ||
523 | { | ||
524 | int i; | ||
525 | unsigned long cs_pin; | ||
526 | short enable_spi0 = 0; | ||
527 | short enable_spi1 = 0; | ||
528 | |||
529 | /* Choose SPI chip-selects */ | ||
530 | for (i = 0; i < nr_devices; i++) { | ||
531 | if (devices[i].controller_data) | ||
532 | cs_pin = (unsigned long) devices[i].controller_data; | ||
533 | else if (devices[i].bus_num == 0) | ||
534 | cs_pin = spi0_standard_cs[devices[i].chip_select]; | ||
535 | else | ||
536 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | ||
537 | |||
538 | if (devices[i].bus_num == 0) | ||
539 | enable_spi0 = 1; | ||
540 | else | ||
541 | enable_spi1 = 1; | ||
542 | |||
543 | /* enable chip-select pin */ | ||
544 | at91_set_gpio_output(cs_pin, 1); | ||
545 | |||
546 | /* pass chip-select pin to driver */ | ||
547 | devices[i].controller_data = (void *) cs_pin; | ||
548 | } | ||
549 | |||
550 | spi_register_board_info(devices, nr_devices); | ||
551 | |||
552 | /* Configure SPI bus(es) */ | ||
553 | if (enable_spi0) { | ||
554 | at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */ | ||
555 | at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */ | ||
556 | at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI1_SPCK */ | ||
557 | |||
558 | at91_clock_associate("spi0_clk", &at91sam9263_spi0_device.dev, "spi_clk"); | ||
559 | platform_device_register(&at91sam9263_spi0_device); | ||
560 | } | ||
561 | if (enable_spi1) { | ||
562 | at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */ | ||
563 | at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */ | ||
564 | at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */ | ||
565 | |||
566 | at91_clock_associate("spi1_clk", &at91sam9263_spi1_device.dev, "spi_clk"); | ||
567 | platform_device_register(&at91sam9263_spi1_device); | ||
568 | } | ||
569 | } | ||
570 | #else | ||
571 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {} | ||
572 | #endif | ||
573 | |||
574 | |||
575 | /* -------------------------------------------------------------------- | ||
576 | * LEDs | ||
577 | * -------------------------------------------------------------------- */ | ||
578 | |||
579 | #if defined(CONFIG_LEDS) | ||
580 | u8 at91_leds_cpu; | ||
581 | u8 at91_leds_timer; | ||
582 | |||
583 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
584 | { | ||
585 | /* Enable GPIO to access the LEDs */ | ||
586 | at91_set_gpio_output(cpu_led, 1); | ||
587 | at91_set_gpio_output(timer_led, 1); | ||
588 | |||
589 | at91_leds_cpu = cpu_led; | ||
590 | at91_leds_timer = timer_led; | ||
591 | } | ||
592 | #else | ||
593 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
594 | #endif | ||
595 | |||
596 | |||
597 | /* -------------------------------------------------------------------- | ||
598 | * UART | ||
599 | * -------------------------------------------------------------------- */ | ||
600 | |||
601 | #if defined(CONFIG_SERIAL_ATMEL) | ||
602 | |||
603 | static struct resource dbgu_resources[] = { | ||
604 | [0] = { | ||
605 | .start = AT91_VA_BASE_SYS + AT91_DBGU, | ||
606 | .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1, | ||
607 | .flags = IORESOURCE_MEM, | ||
608 | }, | ||
609 | [1] = { | ||
610 | .start = AT91_ID_SYS, | ||
611 | .end = AT91_ID_SYS, | ||
612 | .flags = IORESOURCE_IRQ, | ||
613 | }, | ||
614 | }; | ||
615 | |||
616 | static struct atmel_uart_data dbgu_data = { | ||
617 | .use_dma_tx = 0, | ||
618 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | ||
619 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | ||
620 | }; | ||
621 | |||
622 | static struct platform_device at91sam9263_dbgu_device = { | ||
623 | .name = "atmel_usart", | ||
624 | .id = 0, | ||
625 | .dev = { | ||
626 | .platform_data = &dbgu_data, | ||
627 | .coherent_dma_mask = 0xffffffff, | ||
628 | }, | ||
629 | .resource = dbgu_resources, | ||
630 | .num_resources = ARRAY_SIZE(dbgu_resources), | ||
631 | }; | ||
632 | |||
633 | static inline void configure_dbgu_pins(void) | ||
634 | { | ||
635 | at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | ||
636 | at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | ||
637 | } | ||
638 | |||
639 | static struct resource uart0_resources[] = { | ||
640 | [0] = { | ||
641 | .start = AT91SAM9263_BASE_US0, | ||
642 | .end = AT91SAM9263_BASE_US0 + SZ_16K - 1, | ||
643 | .flags = IORESOURCE_MEM, | ||
644 | }, | ||
645 | [1] = { | ||
646 | .start = AT91SAM9263_ID_US0, | ||
647 | .end = AT91SAM9263_ID_US0, | ||
648 | .flags = IORESOURCE_IRQ, | ||
649 | }, | ||
650 | }; | ||
651 | |||
652 | static struct atmel_uart_data uart0_data = { | ||
653 | .use_dma_tx = 1, | ||
654 | .use_dma_rx = 1, | ||
655 | }; | ||
656 | |||
657 | static struct platform_device at91sam9263_uart0_device = { | ||
658 | .name = "atmel_usart", | ||
659 | .id = 1, | ||
660 | .dev = { | ||
661 | .platform_data = &uart0_data, | ||
662 | .coherent_dma_mask = 0xffffffff, | ||
663 | }, | ||
664 | .resource = uart0_resources, | ||
665 | .num_resources = ARRAY_SIZE(uart0_resources), | ||
666 | }; | ||
667 | |||
668 | static inline void configure_usart0_pins(void) | ||
669 | { | ||
670 | at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ | ||
671 | at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ | ||
672 | at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */ | ||
673 | at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */ | ||
674 | } | ||
675 | |||
676 | static struct resource uart1_resources[] = { | ||
677 | [0] = { | ||
678 | .start = AT91SAM9263_BASE_US1, | ||
679 | .end = AT91SAM9263_BASE_US1 + SZ_16K - 1, | ||
680 | .flags = IORESOURCE_MEM, | ||
681 | }, | ||
682 | [1] = { | ||
683 | .start = AT91SAM9263_ID_US1, | ||
684 | .end = AT91SAM9263_ID_US1, | ||
685 | .flags = IORESOURCE_IRQ, | ||
686 | }, | ||
687 | }; | ||
688 | |||
689 | static struct atmel_uart_data uart1_data = { | ||
690 | .use_dma_tx = 1, | ||
691 | .use_dma_rx = 1, | ||
692 | }; | ||
693 | |||
694 | static struct platform_device at91sam9263_uart1_device = { | ||
695 | .name = "atmel_usart", | ||
696 | .id = 2, | ||
697 | .dev = { | ||
698 | .platform_data = &uart1_data, | ||
699 | .coherent_dma_mask = 0xffffffff, | ||
700 | }, | ||
701 | .resource = uart1_resources, | ||
702 | .num_resources = ARRAY_SIZE(uart1_resources), | ||
703 | }; | ||
704 | |||
705 | static inline void configure_usart1_pins(void) | ||
706 | { | ||
707 | at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | ||
708 | at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | ||
709 | at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ | ||
710 | at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ | ||
711 | } | ||
712 | |||
713 | static struct resource uart2_resources[] = { | ||
714 | [0] = { | ||
715 | .start = AT91SAM9263_BASE_US2, | ||
716 | .end = AT91SAM9263_BASE_US2 + SZ_16K - 1, | ||
717 | .flags = IORESOURCE_MEM, | ||
718 | }, | ||
719 | [1] = { | ||
720 | .start = AT91SAM9263_ID_US2, | ||
721 | .end = AT91SAM9263_ID_US2, | ||
722 | .flags = IORESOURCE_IRQ, | ||
723 | }, | ||
724 | }; | ||
725 | |||
726 | static struct atmel_uart_data uart2_data = { | ||
727 | .use_dma_tx = 1, | ||
728 | .use_dma_rx = 1, | ||
729 | }; | ||
730 | |||
731 | static struct platform_device at91sam9263_uart2_device = { | ||
732 | .name = "atmel_usart", | ||
733 | .id = 3, | ||
734 | .dev = { | ||
735 | .platform_data = &uart2_data, | ||
736 | .coherent_dma_mask = 0xffffffff, | ||
737 | }, | ||
738 | .resource = uart2_resources, | ||
739 | .num_resources = ARRAY_SIZE(uart2_resources), | ||
740 | }; | ||
741 | |||
742 | static inline void configure_usart2_pins(void) | ||
743 | { | ||
744 | at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | ||
745 | at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | ||
746 | at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ | ||
747 | at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ | ||
748 | } | ||
749 | |||
750 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | ||
751 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
752 | |||
753 | void __init at91_init_serial(struct at91_uart_config *config) | ||
754 | { | ||
755 | int i; | ||
756 | |||
757 | /* Fill in list of supported UARTs */ | ||
758 | for (i = 0; i < config->nr_tty; i++) { | ||
759 | switch (config->tty_map[i]) { | ||
760 | case 0: | ||
761 | configure_usart0_pins(); | ||
762 | at91_uarts[i] = &at91sam9263_uart0_device; | ||
763 | at91_clock_associate("usart0_clk", &at91sam9263_uart0_device.dev, "usart"); | ||
764 | break; | ||
765 | case 1: | ||
766 | configure_usart1_pins(); | ||
767 | at91_uarts[i] = &at91sam9263_uart1_device; | ||
768 | at91_clock_associate("usart1_clk", &at91sam9263_uart1_device.dev, "usart"); | ||
769 | break; | ||
770 | case 2: | ||
771 | configure_usart2_pins(); | ||
772 | at91_uarts[i] = &at91sam9263_uart2_device; | ||
773 | at91_clock_associate("usart2_clk", &at91sam9263_uart2_device.dev, "usart"); | ||
774 | break; | ||
775 | case 3: | ||
776 | configure_dbgu_pins(); | ||
777 | at91_uarts[i] = &at91sam9263_dbgu_device; | ||
778 | at91_clock_associate("mck", &at91sam9263_dbgu_device.dev, "usart"); | ||
779 | break; | ||
780 | default: | ||
781 | continue; | ||
782 | } | ||
783 | at91_uarts[i]->id = i; /* update ID number to mapped ID */ | ||
784 | } | ||
785 | |||
786 | /* Set serial console device */ | ||
787 | if (config->console_tty < ATMEL_MAX_UART) | ||
788 | atmel_default_console_device = at91_uarts[config->console_tty]; | ||
789 | if (!atmel_default_console_device) | ||
790 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
791 | } | ||
792 | |||
793 | void __init at91_add_device_serial(void) | ||
794 | { | ||
795 | int i; | ||
796 | |||
797 | for (i = 0; i < ATMEL_MAX_UART; i++) { | ||
798 | if (at91_uarts[i]) | ||
799 | platform_device_register(at91_uarts[i]); | ||
800 | } | ||
801 | } | ||
802 | #else | ||
803 | void __init at91_init_serial(struct at91_uart_config *config) {} | ||
804 | void __init at91_add_device_serial(void) {} | ||
805 | #endif | ||
806 | |||
807 | |||
808 | /* -------------------------------------------------------------------- */ | ||
809 | /* | ||
810 | * These devices are always present and don't need any board-specific | ||
811 | * setup. | ||
812 | */ | ||
813 | static int __init at91_add_standard_devices(void) | ||
814 | { | ||
815 | return 0; | ||
816 | } | ||
817 | |||
818 | arch_initcall(at91_add_standard_devices); | ||
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index baab095f6e32..27e7279b5b39 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -598,7 +598,7 @@ int __init at91_clock_init(unsigned long main_clock) | |||
598 | udpck.pmc_mask = AT91RM9200_PMC_UDP; | 598 | udpck.pmc_mask = AT91RM9200_PMC_UDP; |
599 | at91_sys_write(AT91_PMC_SCDR, AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP); | 599 | at91_sys_write(AT91_PMC_SCDR, AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP); |
600 | at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); | 600 | at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); |
601 | } else if (cpu_is_at91sam9260()) { | 601 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) { |
602 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 602 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
603 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | 603 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; |
604 | at91_sys_write(AT91_PMC_SCDR, AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP); | 604 | at91_sys_write(AT91_PMC_SCDR, AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP); |
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 10ee37bf6d4d..bda26221c522 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -12,11 +12,13 @@ | |||
12 | extern void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks); | 12 | extern void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks); |
13 | extern void __init at91sam9260_initialize(unsigned long main_clock); | 13 | extern void __init at91sam9260_initialize(unsigned long main_clock); |
14 | extern void __init at91sam9261_initialize(unsigned long main_clock); | 14 | extern void __init at91sam9261_initialize(unsigned long main_clock); |
15 | extern void __init at91sam9263_initialize(unsigned long main_clock); | ||
15 | 16 | ||
16 | /* Interrupts */ | 17 | /* Interrupts */ |
17 | extern void __init at91rm9200_init_interrupts(unsigned int priority[]); | 18 | extern void __init at91rm9200_init_interrupts(unsigned int priority[]); |
18 | extern void __init at91sam9260_init_interrupts(unsigned int priority[]); | 19 | extern void __init at91sam9260_init_interrupts(unsigned int priority[]); |
19 | extern void __init at91sam9261_init_interrupts(unsigned int priority[]); | 20 | extern void __init at91sam9261_init_interrupts(unsigned int priority[]); |
21 | extern void __init at91sam9263_init_interrupts(unsigned int priority[]); | ||
20 | extern void __init at91_aic_init(unsigned int priority[]); | 22 | extern void __init at91_aic_init(unsigned int priority[]); |
21 | 23 | ||
22 | /* Timer */ | 24 | /* Timer */ |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index e095b1fe8d8a..b49bfda53d7f 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -80,6 +80,8 @@ static int at91_pm_verify_clocks(void) | |||
80 | #warning "Check SAM9260 USB clocks" | 80 | #warning "Check SAM9260 USB clocks" |
81 | } else if (cpu_is_at91sam9261()) { | 81 | } else if (cpu_is_at91sam9261()) { |
82 | #warning "Check SAM9261 USB clocks" | 82 | #warning "Check SAM9261 USB clocks" |
83 | } else if (cpu_is_at91sam9263()) { | ||
84 | #warning "Check SAM9263 USB clocks" | ||
83 | } | 85 | } |
84 | 86 | ||
85 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS | 87 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index aade2f72c920..b305cbda8b87 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -171,8 +171,8 @@ config CPU_ARM925T | |||
171 | # ARM926T | 171 | # ARM926T |
172 | config CPU_ARM926T | 172 | config CPU_ARM926T |
173 | bool "Support ARM926T processor" | 173 | bool "Support ARM926T processor" |
174 | depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 | 174 | depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 |
175 | default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 | 175 | default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 |
176 | select CPU_32v5 | 176 | select CPU_32v5 |
177 | select CPU_ABRT_EV5TJ | 177 | select CPU_ABRT_EV5TJ |
178 | select CPU_CACHE_VIVT | 178 | select CPU_CACHE_VIVT |