diff options
Diffstat (limited to 'arch/arm/mach-at91')
25 files changed, 3823 insertions, 329 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 05a9f8a1b45e..5b0422cdde76 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -22,6 +22,9 @@ config ARCH_AT91SAM9263 | |||
22 | config ARCH_AT91SAM9RL | 22 | config ARCH_AT91SAM9RL |
23 | bool "AT91SAM9RL" | 23 | bool "AT91SAM9RL" |
24 | 24 | ||
25 | config ARCH_AT91CAP9 | ||
26 | bool "AT91CAP9" | ||
27 | |||
25 | config ARCH_AT91X40 | 28 | config ARCH_AT91X40 |
26 | bool "AT91x40" | 29 | bool "AT91x40" |
27 | 30 | ||
@@ -178,6 +181,21 @@ endif | |||
178 | 181 | ||
179 | # ---------------------------------------------------------- | 182 | # ---------------------------------------------------------- |
180 | 183 | ||
184 | if ARCH_AT91CAP9 | ||
185 | |||
186 | comment "AT91CAP9 Board Type" | ||
187 | |||
188 | config MACH_AT91CAP9ADK | ||
189 | bool "Atmel AT91CAP9A-DK Evaluation Kit" | ||
190 | depends on ARCH_AT91CAP9 | ||
191 | help | ||
192 | Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit. | ||
193 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138> | ||
194 | |||
195 | endif | ||
196 | |||
197 | # ---------------------------------------------------------- | ||
198 | |||
181 | if ARCH_AT91X40 | 199 | if ARCH_AT91X40 |
182 | 200 | ||
183 | comment "AT91X40 Board Type" | 201 | comment "AT91X40 Board Type" |
@@ -198,13 +216,13 @@ comment "AT91 Board Options" | |||
198 | 216 | ||
199 | config MTD_AT91_DATAFLASH_CARD | 217 | config MTD_AT91_DATAFLASH_CARD |
200 | bool "Enable DataFlash Card support" | 218 | bool "Enable DataFlash Card support" |
201 | depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK) | 219 | depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK) |
202 | help | 220 | help |
203 | Enable support for the DataFlash card. | 221 | Enable support for the DataFlash card. |
204 | 222 | ||
205 | config MTD_NAND_AT91_BUSWIDTH_16 | 223 | config MTD_NAND_AT91_BUSWIDTH_16 |
206 | bool "Enable 16-bit data bus interface to NAND flash" | 224 | bool "Enable 16-bit data bus interface to NAND flash" |
207 | depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK) | 225 | depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK) |
208 | help | 226 | help |
209 | On AT91SAM926x boards both types of NAND flash can be present | 227 | On AT91SAM926x boards both types of NAND flash can be present |
210 | (8 and 16 bit data bus width). | 228 | (8 and 16 bit data bus width). |
@@ -219,6 +237,22 @@ config AT91_PROGRAMMABLE_CLOCKS | |||
219 | Select this if you need to program one or more of the PCK0..PCK3 | 237 | Select this if you need to program one or more of the PCK0..PCK3 |
220 | programmable clock outputs. | 238 | programmable clock outputs. |
221 | 239 | ||
240 | config AT91_TIMER_HZ | ||
241 | int "Kernel HZ (jiffies per second)" | ||
242 | range 32 1024 | ||
243 | depends on ARCH_AT91 | ||
244 | default "128" if ARCH_AT91RM9200 | ||
245 | default "100" | ||
246 | help | ||
247 | On AT91rm9200 chips where you're using a system clock derived | ||
248 | from the 32768 Hz hardware clock, this tick rate should divide | ||
249 | it exactly: use a power-of-two value, such as 128 or 256, to | ||
250 | reduce timing errors caused by rounding. | ||
251 | |||
252 | On AT91sam926x chips, or otherwise when using a higher precision | ||
253 | system clock (of at least several MHz), rounding is less of a | ||
254 | problem so it can be safer to use a decimal values like 100. | ||
255 | |||
222 | endmenu | 256 | endmenu |
223 | 257 | ||
224 | endif | 258 | endif |
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index a21f08c64ea6..bf5f293dccf8 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -8,7 +8,6 @@ obj-n := | |||
8 | obj- := | 8 | obj- := |
9 | 9 | ||
10 | obj-$(CONFIG_AT91_PMC_UNIT) += clock.o | 10 | obj-$(CONFIG_AT91_PMC_UNIT) += clock.o |
11 | obj-$(CONFIG_PM) += pm.o | ||
12 | 11 | ||
13 | # CPU-specific support | 12 | # CPU-specific support |
14 | 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 |
@@ -16,6 +15,7 @@ obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_d | |||
16 | 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 |
17 | obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o | 16 | obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o |
18 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o | 17 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o |
18 | obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o | ||
19 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o | 19 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o |
20 | 20 | ||
21 | # AT91RM9200 board-specific support | 21 | # AT91RM9200 board-specific support |
@@ -29,7 +29,6 @@ obj-$(CONFIG_MACH_KB9200) += board-kb9202.o | |||
29 | obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o | 29 | obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o |
30 | obj-$(CONFIG_MACH_KAFA) += board-kafa.o | 30 | obj-$(CONFIG_MACH_KAFA) += board-kafa.o |
31 | obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o | 31 | obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o |
32 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o | ||
33 | 32 | ||
34 | # AT91SAM9260 board-specific support | 33 | # AT91SAM9260 board-specific support |
35 | obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o | 34 | obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o |
@@ -43,19 +42,17 @@ obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o | |||
43 | # AT91SAM9RL board-specific support | 42 | # AT91SAM9RL board-specific support |
44 | obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o | 43 | obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o |
45 | 44 | ||
46 | # LEDs support | 45 | # AT91CAP9 board-specific support |
47 | led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o | 46 | obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o |
48 | led-$(CONFIG_MACH_AT91RM9200EK) += leds.o | ||
49 | led-$(CONFIG_MACH_AT91SAM9261EK)+= leds.o | ||
50 | led-$(CONFIG_MACH_CSB337) += leds.o | ||
51 | led-$(CONFIG_MACH_CSB637) += leds.o | ||
52 | led-$(CONFIG_MACH_KB9200) += leds.o | ||
53 | led-$(CONFIG_MACH_KAFA) += leds.o | ||
54 | obj-$(CONFIG_LEDS) += $(led-y) | ||
55 | 47 | ||
56 | # VGA support | 48 | # AT91X40 board-specific support |
57 | #obj-$(CONFIG_FB_S1D13XXX) += ics1523.o | 49 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o |
58 | 50 | ||
51 | # Drivers | ||
52 | obj-y += leds.o | ||
53 | |||
54 | # Power Management | ||
55 | obj-$(CONFIG_PM) += pm.o | ||
59 | 56 | ||
60 | ifeq ($(CONFIG_PM_DEBUG),y) | 57 | ifeq ($(CONFIG_PM_DEBUG),y) |
61 | CFLAGS_pm.o += -DDEBUG | 58 | CFLAGS_pm.o += -DDEBUG |
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index e667dcc7cd34..071a2506a69f 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot | |||
@@ -3,7 +3,12 @@ | |||
3 | # PARAMS_PHYS must be within 4MB of ZRELADDR | 3 | # PARAMS_PHYS must be within 4MB of ZRELADDR |
4 | # INITRD_PHYS must be in RAM | 4 | # INITRD_PHYS must be in RAM |
5 | 5 | ||
6 | ifeq ($(CONFIG_ARCH_AT91CAP9),y) | ||
7 | zreladdr-y := 0x70008000 | ||
8 | params_phys-y := 0x70000100 | ||
9 | initrd_phys-y := 0x70410000 | ||
10 | else | ||
6 | zreladdr-y := 0x20008000 | 11 | zreladdr-y := 0x20008000 |
7 | params_phys-y := 0x20000100 | 12 | params_phys-y := 0x20000100 |
8 | initrd_phys-y := 0x20410000 | 13 | initrd_phys-y := 0x20410000 |
9 | 14 | endif | |
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c new file mode 100644 index 000000000000..48d27d8000b0 --- /dev/null +++ b/arch/arm/mach-at91/at91cap9.c | |||
@@ -0,0 +1,365 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91cap9.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2007 Atmel Corporation. | ||
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 | |||
15 | #include <linux/module.h> | ||
16 | |||
17 | #include <asm/mach/arch.h> | ||
18 | #include <asm/mach/map.h> | ||
19 | #include <asm/arch/at91cap9.h> | ||
20 | #include <asm/arch/at91_pmc.h> | ||
21 | #include <asm/arch/at91_rstc.h> | ||
22 | |||
23 | #include "generic.h" | ||
24 | #include "clock.h" | ||
25 | |||
26 | static struct map_desc at91cap9_io_desc[] __initdata = { | ||
27 | { | ||
28 | .virtual = AT91_VA_BASE_SYS, | ||
29 | .pfn = __phys_to_pfn(AT91_BASE_SYS), | ||
30 | .length = SZ_16K, | ||
31 | .type = MT_DEVICE, | ||
32 | }, { | ||
33 | .virtual = AT91_IO_VIRT_BASE - AT91CAP9_SRAM_SIZE, | ||
34 | .pfn = __phys_to_pfn(AT91CAP9_SRAM_BASE), | ||
35 | .length = AT91CAP9_SRAM_SIZE, | ||
36 | .type = MT_DEVICE, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | /* -------------------------------------------------------------------- | ||
41 | * Clocks | ||
42 | * -------------------------------------------------------------------- */ | ||
43 | |||
44 | /* | ||
45 | * The peripheral clocks. | ||
46 | */ | ||
47 | static struct clk pioABCD_clk = { | ||
48 | .name = "pioABCD_clk", | ||
49 | .pmc_mask = 1 << AT91CAP9_ID_PIOABCD, | ||
50 | .type = CLK_TYPE_PERIPHERAL, | ||
51 | }; | ||
52 | static struct clk mpb0_clk = { | ||
53 | .name = "mpb0_clk", | ||
54 | .pmc_mask = 1 << AT91CAP9_ID_MPB0, | ||
55 | .type = CLK_TYPE_PERIPHERAL, | ||
56 | }; | ||
57 | static struct clk mpb1_clk = { | ||
58 | .name = "mpb1_clk", | ||
59 | .pmc_mask = 1 << AT91CAP9_ID_MPB1, | ||
60 | .type = CLK_TYPE_PERIPHERAL, | ||
61 | }; | ||
62 | static struct clk mpb2_clk = { | ||
63 | .name = "mpb2_clk", | ||
64 | .pmc_mask = 1 << AT91CAP9_ID_MPB2, | ||
65 | .type = CLK_TYPE_PERIPHERAL, | ||
66 | }; | ||
67 | static struct clk mpb3_clk = { | ||
68 | .name = "mpb3_clk", | ||
69 | .pmc_mask = 1 << AT91CAP9_ID_MPB3, | ||
70 | .type = CLK_TYPE_PERIPHERAL, | ||
71 | }; | ||
72 | static struct clk mpb4_clk = { | ||
73 | .name = "mpb4_clk", | ||
74 | .pmc_mask = 1 << AT91CAP9_ID_MPB4, | ||
75 | .type = CLK_TYPE_PERIPHERAL, | ||
76 | }; | ||
77 | static struct clk usart0_clk = { | ||
78 | .name = "usart0_clk", | ||
79 | .pmc_mask = 1 << AT91CAP9_ID_US0, | ||
80 | .type = CLK_TYPE_PERIPHERAL, | ||
81 | }; | ||
82 | static struct clk usart1_clk = { | ||
83 | .name = "usart1_clk", | ||
84 | .pmc_mask = 1 << AT91CAP9_ID_US1, | ||
85 | .type = CLK_TYPE_PERIPHERAL, | ||
86 | }; | ||
87 | static struct clk usart2_clk = { | ||
88 | .name = "usart2_clk", | ||
89 | .pmc_mask = 1 << AT91CAP9_ID_US2, | ||
90 | .type = CLK_TYPE_PERIPHERAL, | ||
91 | }; | ||
92 | static struct clk mmc0_clk = { | ||
93 | .name = "mci0_clk", | ||
94 | .pmc_mask = 1 << AT91CAP9_ID_MCI0, | ||
95 | .type = CLK_TYPE_PERIPHERAL, | ||
96 | }; | ||
97 | static struct clk mmc1_clk = { | ||
98 | .name = "mci1_clk", | ||
99 | .pmc_mask = 1 << AT91CAP9_ID_MCI1, | ||
100 | .type = CLK_TYPE_PERIPHERAL, | ||
101 | }; | ||
102 | static struct clk can_clk = { | ||
103 | .name = "can_clk", | ||
104 | .pmc_mask = 1 << AT91CAP9_ID_CAN, | ||
105 | .type = CLK_TYPE_PERIPHERAL, | ||
106 | }; | ||
107 | static struct clk twi_clk = { | ||
108 | .name = "twi_clk", | ||
109 | .pmc_mask = 1 << AT91CAP9_ID_TWI, | ||
110 | .type = CLK_TYPE_PERIPHERAL, | ||
111 | }; | ||
112 | static struct clk spi0_clk = { | ||
113 | .name = "spi0_clk", | ||
114 | .pmc_mask = 1 << AT91CAP9_ID_SPI0, | ||
115 | .type = CLK_TYPE_PERIPHERAL, | ||
116 | }; | ||
117 | static struct clk spi1_clk = { | ||
118 | .name = "spi1_clk", | ||
119 | .pmc_mask = 1 << AT91CAP9_ID_SPI1, | ||
120 | .type = CLK_TYPE_PERIPHERAL, | ||
121 | }; | ||
122 | static struct clk ssc0_clk = { | ||
123 | .name = "ssc0_clk", | ||
124 | .pmc_mask = 1 << AT91CAP9_ID_SSC0, | ||
125 | .type = CLK_TYPE_PERIPHERAL, | ||
126 | }; | ||
127 | static struct clk ssc1_clk = { | ||
128 | .name = "ssc1_clk", | ||
129 | .pmc_mask = 1 << AT91CAP9_ID_SSC1, | ||
130 | .type = CLK_TYPE_PERIPHERAL, | ||
131 | }; | ||
132 | static struct clk ac97_clk = { | ||
133 | .name = "ac97_clk", | ||
134 | .pmc_mask = 1 << AT91CAP9_ID_AC97C, | ||
135 | .type = CLK_TYPE_PERIPHERAL, | ||
136 | }; | ||
137 | static struct clk tcb_clk = { | ||
138 | .name = "tcb_clk", | ||
139 | .pmc_mask = 1 << AT91CAP9_ID_TCB, | ||
140 | .type = CLK_TYPE_PERIPHERAL, | ||
141 | }; | ||
142 | static struct clk pwmc_clk = { | ||
143 | .name = "pwmc_clk", | ||
144 | .pmc_mask = 1 << AT91CAP9_ID_PWMC, | ||
145 | .type = CLK_TYPE_PERIPHERAL, | ||
146 | }; | ||
147 | static struct clk macb_clk = { | ||
148 | .name = "macb_clk", | ||
149 | .pmc_mask = 1 << AT91CAP9_ID_EMAC, | ||
150 | .type = CLK_TYPE_PERIPHERAL, | ||
151 | }; | ||
152 | static struct clk aestdes_clk = { | ||
153 | .name = "aestdes_clk", | ||
154 | .pmc_mask = 1 << AT91CAP9_ID_AESTDES, | ||
155 | .type = CLK_TYPE_PERIPHERAL, | ||
156 | }; | ||
157 | static struct clk adc_clk = { | ||
158 | .name = "adc_clk", | ||
159 | .pmc_mask = 1 << AT91CAP9_ID_ADC, | ||
160 | .type = CLK_TYPE_PERIPHERAL, | ||
161 | }; | ||
162 | static struct clk isi_clk = { | ||
163 | .name = "isi_clk", | ||
164 | .pmc_mask = 1 << AT91CAP9_ID_ISI, | ||
165 | .type = CLK_TYPE_PERIPHERAL, | ||
166 | }; | ||
167 | static struct clk lcdc_clk = { | ||
168 | .name = "lcdc_clk", | ||
169 | .pmc_mask = 1 << AT91CAP9_ID_LCDC, | ||
170 | .type = CLK_TYPE_PERIPHERAL, | ||
171 | }; | ||
172 | static struct clk dma_clk = { | ||
173 | .name = "dma_clk", | ||
174 | .pmc_mask = 1 << AT91CAP9_ID_DMA, | ||
175 | .type = CLK_TYPE_PERIPHERAL, | ||
176 | }; | ||
177 | static struct clk udphs_clk = { | ||
178 | .name = "udphs_clk", | ||
179 | .pmc_mask = 1 << AT91CAP9_ID_UDPHS, | ||
180 | .type = CLK_TYPE_PERIPHERAL, | ||
181 | }; | ||
182 | static struct clk ohci_clk = { | ||
183 | .name = "ohci_clk", | ||
184 | .pmc_mask = 1 << AT91CAP9_ID_UHP, | ||
185 | .type = CLK_TYPE_PERIPHERAL, | ||
186 | }; | ||
187 | |||
188 | static struct clk *periph_clocks[] __initdata = { | ||
189 | &pioABCD_clk, | ||
190 | &mpb0_clk, | ||
191 | &mpb1_clk, | ||
192 | &mpb2_clk, | ||
193 | &mpb3_clk, | ||
194 | &mpb4_clk, | ||
195 | &usart0_clk, | ||
196 | &usart1_clk, | ||
197 | &usart2_clk, | ||
198 | &mmc0_clk, | ||
199 | &mmc1_clk, | ||
200 | &can_clk, | ||
201 | &twi_clk, | ||
202 | &spi0_clk, | ||
203 | &spi1_clk, | ||
204 | &ssc0_clk, | ||
205 | &ssc1_clk, | ||
206 | &ac97_clk, | ||
207 | &tcb_clk, | ||
208 | &pwmc_clk, | ||
209 | &macb_clk, | ||
210 | &aestdes_clk, | ||
211 | &adc_clk, | ||
212 | &isi_clk, | ||
213 | &lcdc_clk, | ||
214 | &dma_clk, | ||
215 | &udphs_clk, | ||
216 | &ohci_clk, | ||
217 | // irq0 .. irq1 | ||
218 | }; | ||
219 | |||
220 | /* | ||
221 | * The four programmable clocks. | ||
222 | * You must configure pin multiplexing to bring these signals out. | ||
223 | */ | ||
224 | static struct clk pck0 = { | ||
225 | .name = "pck0", | ||
226 | .pmc_mask = AT91_PMC_PCK0, | ||
227 | .type = CLK_TYPE_PROGRAMMABLE, | ||
228 | .id = 0, | ||
229 | }; | ||
230 | static struct clk pck1 = { | ||
231 | .name = "pck1", | ||
232 | .pmc_mask = AT91_PMC_PCK1, | ||
233 | .type = CLK_TYPE_PROGRAMMABLE, | ||
234 | .id = 1, | ||
235 | }; | ||
236 | static struct clk pck2 = { | ||
237 | .name = "pck2", | ||
238 | .pmc_mask = AT91_PMC_PCK2, | ||
239 | .type = CLK_TYPE_PROGRAMMABLE, | ||
240 | .id = 2, | ||
241 | }; | ||
242 | static struct clk pck3 = { | ||
243 | .name = "pck3", | ||
244 | .pmc_mask = AT91_PMC_PCK3, | ||
245 | .type = CLK_TYPE_PROGRAMMABLE, | ||
246 | .id = 3, | ||
247 | }; | ||
248 | |||
249 | static void __init at91cap9_register_clocks(void) | ||
250 | { | ||
251 | int i; | ||
252 | |||
253 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) | ||
254 | clk_register(periph_clocks[i]); | ||
255 | |||
256 | clk_register(&pck0); | ||
257 | clk_register(&pck1); | ||
258 | clk_register(&pck2); | ||
259 | clk_register(&pck3); | ||
260 | } | ||
261 | |||
262 | /* -------------------------------------------------------------------- | ||
263 | * GPIO | ||
264 | * -------------------------------------------------------------------- */ | ||
265 | |||
266 | static struct at91_gpio_bank at91cap9_gpio[] = { | ||
267 | { | ||
268 | .id = AT91CAP9_ID_PIOABCD, | ||
269 | .offset = AT91_PIOA, | ||
270 | .clock = &pioABCD_clk, | ||
271 | }, { | ||
272 | .id = AT91CAP9_ID_PIOABCD, | ||
273 | .offset = AT91_PIOB, | ||
274 | .clock = &pioABCD_clk, | ||
275 | }, { | ||
276 | .id = AT91CAP9_ID_PIOABCD, | ||
277 | .offset = AT91_PIOC, | ||
278 | .clock = &pioABCD_clk, | ||
279 | }, { | ||
280 | .id = AT91CAP9_ID_PIOABCD, | ||
281 | .offset = AT91_PIOD, | ||
282 | .clock = &pioABCD_clk, | ||
283 | } | ||
284 | }; | ||
285 | |||
286 | static void at91cap9_reset(void) | ||
287 | { | ||
288 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); | ||
289 | } | ||
290 | |||
291 | /* -------------------------------------------------------------------- | ||
292 | * AT91CAP9 processor initialization | ||
293 | * -------------------------------------------------------------------- */ | ||
294 | |||
295 | void __init at91cap9_initialize(unsigned long main_clock) | ||
296 | { | ||
297 | /* Map peripherals */ | ||
298 | iotable_init(at91cap9_io_desc, ARRAY_SIZE(at91cap9_io_desc)); | ||
299 | |||
300 | at91_arch_reset = at91cap9_reset; | ||
301 | at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); | ||
302 | |||
303 | /* Init clock subsystem */ | ||
304 | at91_clock_init(main_clock); | ||
305 | |||
306 | /* Register the processor-specific clocks */ | ||
307 | at91cap9_register_clocks(); | ||
308 | |||
309 | /* Register GPIO subsystem */ | ||
310 | at91_gpio_init(at91cap9_gpio, 4); | ||
311 | } | ||
312 | |||
313 | /* -------------------------------------------------------------------- | ||
314 | * Interrupt initialization | ||
315 | * -------------------------------------------------------------------- */ | ||
316 | |||
317 | /* | ||
318 | * The default interrupt priority levels (0 = lowest, 7 = highest). | ||
319 | */ | ||
320 | static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = { | ||
321 | 7, /* Advanced Interrupt Controller (FIQ) */ | ||
322 | 7, /* System Peripherals */ | ||
323 | 1, /* Parallel IO Controller A, B, C and D */ | ||
324 | 0, /* MP Block Peripheral 0 */ | ||
325 | 0, /* MP Block Peripheral 1 */ | ||
326 | 0, /* MP Block Peripheral 2 */ | ||
327 | 0, /* MP Block Peripheral 3 */ | ||
328 | 0, /* MP Block Peripheral 4 */ | ||
329 | 5, /* USART 0 */ | ||
330 | 5, /* USART 1 */ | ||
331 | 5, /* USART 2 */ | ||
332 | 0, /* Multimedia Card Interface 0 */ | ||
333 | 0, /* Multimedia Card Interface 1 */ | ||
334 | 3, /* CAN */ | ||
335 | 6, /* Two-Wire Interface */ | ||
336 | 5, /* Serial Peripheral Interface 0 */ | ||
337 | 5, /* Serial Peripheral Interface 1 */ | ||
338 | 4, /* Serial Synchronous Controller 0 */ | ||
339 | 4, /* Serial Synchronous Controller 1 */ | ||
340 | 5, /* AC97 Controller */ | ||
341 | 0, /* Timer Counter 0, 1 and 2 */ | ||
342 | 0, /* Pulse Width Modulation Controller */ | ||
343 | 3, /* Ethernet */ | ||
344 | 0, /* Advanced Encryption Standard, Triple DES*/ | ||
345 | 0, /* Analog-to-Digital Converter */ | ||
346 | 0, /* Image Sensor Interface */ | ||
347 | 3, /* LCD Controller */ | ||
348 | 0, /* DMA Controller */ | ||
349 | 2, /* USB Device Port */ | ||
350 | 2, /* USB Host port */ | ||
351 | 0, /* Advanced Interrupt Controller (IRQ0) */ | ||
352 | 0, /* Advanced Interrupt Controller (IRQ1) */ | ||
353 | }; | ||
354 | |||
355 | void __init at91cap9_init_interrupts(unsigned int priority[NR_AIC_IRQS]) | ||
356 | { | ||
357 | if (!priority) | ||
358 | priority = at91cap9_default_irq_priority; | ||
359 | |||
360 | /* Initialize the AIC interrupt controller */ | ||
361 | at91_aic_init(priority); | ||
362 | |||
363 | /* Enable GPIO interrupts */ | ||
364 | at91_gpio_irq_setup(); | ||
365 | } | ||
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c new file mode 100644 index 000000000000..c50fad9cd143 --- /dev/null +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -0,0 +1,1066 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91cap9_devices.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2007 Atmel Corporation. | ||
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 <asm/mach/arch.h> | ||
15 | #include <asm/mach/map.h> | ||
16 | |||
17 | #include <linux/dma-mapping.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/mtd/physmap.h> | ||
20 | |||
21 | #include <video/atmel_lcdc.h> | ||
22 | |||
23 | #include <asm/arch/board.h> | ||
24 | #include <asm/arch/gpio.h> | ||
25 | #include <asm/arch/at91cap9.h> | ||
26 | #include <asm/arch/at91sam926x_mc.h> | ||
27 | #include <asm/arch/at91cap9_matrix.h> | ||
28 | |||
29 | #include "generic.h" | ||
30 | |||
31 | |||
32 | /* -------------------------------------------------------------------- | ||
33 | * USB Host | ||
34 | * -------------------------------------------------------------------- */ | ||
35 | |||
36 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
37 | static u64 ohci_dmamask = DMA_BIT_MASK(32); | ||
38 | static struct at91_usbh_data usbh_data; | ||
39 | |||
40 | static struct resource usbh_resources[] = { | ||
41 | [0] = { | ||
42 | .start = AT91CAP9_UHP_BASE, | ||
43 | .end = AT91CAP9_UHP_BASE + SZ_1M - 1, | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | }, | ||
46 | [1] = { | ||
47 | .start = AT91CAP9_ID_UHP, | ||
48 | .end = AT91CAP9_ID_UHP, | ||
49 | .flags = IORESOURCE_IRQ, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct platform_device at91_usbh_device = { | ||
54 | .name = "at91_ohci", | ||
55 | .id = -1, | ||
56 | .dev = { | ||
57 | .dma_mask = &ohci_dmamask, | ||
58 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
59 | .platform_data = &usbh_data, | ||
60 | }, | ||
61 | .resource = usbh_resources, | ||
62 | .num_resources = ARRAY_SIZE(usbh_resources), | ||
63 | }; | ||
64 | |||
65 | void __init at91_add_device_usbh(struct at91_usbh_data *data) | ||
66 | { | ||
67 | int i; | ||
68 | |||
69 | if (!data) | ||
70 | return; | ||
71 | |||
72 | /* Enable VBus control for UHP ports */ | ||
73 | for (i = 0; i < data->ports; i++) { | ||
74 | if (data->vbus_pin[i]) | ||
75 | at91_set_gpio_output(data->vbus_pin[i], 0); | ||
76 | } | ||
77 | |||
78 | usbh_data = *data; | ||
79 | platform_device_register(&at91_usbh_device); | ||
80 | } | ||
81 | #else | ||
82 | void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | ||
83 | #endif | ||
84 | |||
85 | |||
86 | /* -------------------------------------------------------------------- | ||
87 | * Ethernet | ||
88 | * -------------------------------------------------------------------- */ | ||
89 | |||
90 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | ||
91 | static u64 eth_dmamask = DMA_BIT_MASK(32); | ||
92 | static struct at91_eth_data eth_data; | ||
93 | |||
94 | static struct resource eth_resources[] = { | ||
95 | [0] = { | ||
96 | .start = AT91CAP9_BASE_EMAC, | ||
97 | .end = AT91CAP9_BASE_EMAC + SZ_16K - 1, | ||
98 | .flags = IORESOURCE_MEM, | ||
99 | }, | ||
100 | [1] = { | ||
101 | .start = AT91CAP9_ID_EMAC, | ||
102 | .end = AT91CAP9_ID_EMAC, | ||
103 | .flags = IORESOURCE_IRQ, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static struct platform_device at91cap9_eth_device = { | ||
108 | .name = "macb", | ||
109 | .id = -1, | ||
110 | .dev = { | ||
111 | .dma_mask = ð_dmamask, | ||
112 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
113 | .platform_data = ð_data, | ||
114 | }, | ||
115 | .resource = eth_resources, | ||
116 | .num_resources = ARRAY_SIZE(eth_resources), | ||
117 | }; | ||
118 | |||
119 | void __init at91_add_device_eth(struct at91_eth_data *data) | ||
120 | { | ||
121 | if (!data) | ||
122 | return; | ||
123 | |||
124 | if (data->phy_irq_pin) { | ||
125 | at91_set_gpio_input(data->phy_irq_pin, 0); | ||
126 | at91_set_deglitch(data->phy_irq_pin, 1); | ||
127 | } | ||
128 | |||
129 | /* Pins used for MII and RMII */ | ||
130 | at91_set_A_periph(AT91_PIN_PB21, 0); /* ETXCK_EREFCK */ | ||
131 | at91_set_A_periph(AT91_PIN_PB22, 0); /* ERXDV */ | ||
132 | at91_set_A_periph(AT91_PIN_PB25, 0); /* ERX0 */ | ||
133 | at91_set_A_periph(AT91_PIN_PB26, 0); /* ERX1 */ | ||
134 | at91_set_A_periph(AT91_PIN_PB27, 0); /* ERXER */ | ||
135 | at91_set_A_periph(AT91_PIN_PB28, 0); /* ETXEN */ | ||
136 | at91_set_A_periph(AT91_PIN_PB23, 0); /* ETX0 */ | ||
137 | at91_set_A_periph(AT91_PIN_PB24, 0); /* ETX1 */ | ||
138 | at91_set_A_periph(AT91_PIN_PB30, 0); /* EMDIO */ | ||
139 | at91_set_A_periph(AT91_PIN_PB29, 0); /* EMDC */ | ||
140 | |||
141 | if (!data->is_rmii) { | ||
142 | at91_set_B_periph(AT91_PIN_PC25, 0); /* ECRS */ | ||
143 | at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */ | ||
144 | at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */ | ||
145 | at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */ | ||
146 | at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */ | ||
147 | at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */ | ||
148 | at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */ | ||
149 | at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */ | ||
150 | } | ||
151 | |||
152 | eth_data = *data; | ||
153 | platform_device_register(&at91cap9_eth_device); | ||
154 | } | ||
155 | #else | ||
156 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | ||
157 | #endif | ||
158 | |||
159 | |||
160 | /* -------------------------------------------------------------------- | ||
161 | * MMC / SD | ||
162 | * -------------------------------------------------------------------- */ | ||
163 | |||
164 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | ||
165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | ||
166 | static struct at91_mmc_data mmc0_data, mmc1_data; | ||
167 | |||
168 | static struct resource mmc0_resources[] = { | ||
169 | [0] = { | ||
170 | .start = AT91CAP9_BASE_MCI0, | ||
171 | .end = AT91CAP9_BASE_MCI0 + SZ_16K - 1, | ||
172 | .flags = IORESOURCE_MEM, | ||
173 | }, | ||
174 | [1] = { | ||
175 | .start = AT91CAP9_ID_MCI0, | ||
176 | .end = AT91CAP9_ID_MCI0, | ||
177 | .flags = IORESOURCE_IRQ, | ||
178 | }, | ||
179 | }; | ||
180 | |||
181 | static struct platform_device at91cap9_mmc0_device = { | ||
182 | .name = "at91_mci", | ||
183 | .id = 0, | ||
184 | .dev = { | ||
185 | .dma_mask = &mmc_dmamask, | ||
186 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
187 | .platform_data = &mmc0_data, | ||
188 | }, | ||
189 | .resource = mmc0_resources, | ||
190 | .num_resources = ARRAY_SIZE(mmc0_resources), | ||
191 | }; | ||
192 | |||
193 | static struct resource mmc1_resources[] = { | ||
194 | [0] = { | ||
195 | .start = AT91CAP9_BASE_MCI1, | ||
196 | .end = AT91CAP9_BASE_MCI1 + SZ_16K - 1, | ||
197 | .flags = IORESOURCE_MEM, | ||
198 | }, | ||
199 | [1] = { | ||
200 | .start = AT91CAP9_ID_MCI1, | ||
201 | .end = AT91CAP9_ID_MCI1, | ||
202 | .flags = IORESOURCE_IRQ, | ||
203 | }, | ||
204 | }; | ||
205 | |||
206 | static struct platform_device at91cap9_mmc1_device = { | ||
207 | .name = "at91_mci", | ||
208 | .id = 1, | ||
209 | .dev = { | ||
210 | .dma_mask = &mmc_dmamask, | ||
211 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
212 | .platform_data = &mmc1_data, | ||
213 | }, | ||
214 | .resource = mmc1_resources, | ||
215 | .num_resources = ARRAY_SIZE(mmc1_resources), | ||
216 | }; | ||
217 | |||
218 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | ||
219 | { | ||
220 | if (!data) | ||
221 | return; | ||
222 | |||
223 | /* input/irq */ | ||
224 | if (data->det_pin) { | ||
225 | at91_set_gpio_input(data->det_pin, 1); | ||
226 | at91_set_deglitch(data->det_pin, 1); | ||
227 | } | ||
228 | if (data->wp_pin) | ||
229 | at91_set_gpio_input(data->wp_pin, 1); | ||
230 | if (data->vcc_pin) | ||
231 | at91_set_gpio_output(data->vcc_pin, 0); | ||
232 | |||
233 | if (mmc_id == 0) { /* MCI0 */ | ||
234 | /* CLK */ | ||
235 | at91_set_A_periph(AT91_PIN_PA2, 0); | ||
236 | |||
237 | /* CMD */ | ||
238 | at91_set_A_periph(AT91_PIN_PA1, 1); | ||
239 | |||
240 | /* DAT0, maybe DAT1..DAT3 */ | ||
241 | at91_set_A_periph(AT91_PIN_PA0, 1); | ||
242 | if (data->wire4) { | ||
243 | at91_set_A_periph(AT91_PIN_PA3, 1); | ||
244 | at91_set_A_periph(AT91_PIN_PA4, 1); | ||
245 | at91_set_A_periph(AT91_PIN_PA5, 1); | ||
246 | } | ||
247 | |||
248 | mmc0_data = *data; | ||
249 | at91_clock_associate("mci0_clk", &at91cap9_mmc1_device.dev, "mci_clk"); | ||
250 | platform_device_register(&at91cap9_mmc0_device); | ||
251 | } else { /* MCI1 */ | ||
252 | /* CLK */ | ||
253 | at91_set_A_periph(AT91_PIN_PA16, 0); | ||
254 | |||
255 | /* CMD */ | ||
256 | at91_set_A_periph(AT91_PIN_PA17, 1); | ||
257 | |||
258 | /* DAT0, maybe DAT1..DAT3 */ | ||
259 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
260 | if (data->wire4) { | ||
261 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
262 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
263 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
264 | } | ||
265 | |||
266 | mmc1_data = *data; | ||
267 | at91_clock_associate("mci1_clk", &at91cap9_mmc1_device.dev, "mci_clk"); | ||
268 | platform_device_register(&at91cap9_mmc1_device); | ||
269 | } | ||
270 | } | ||
271 | #else | ||
272 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | ||
273 | #endif | ||
274 | |||
275 | |||
276 | /* -------------------------------------------------------------------- | ||
277 | * NAND / SmartMedia | ||
278 | * -------------------------------------------------------------------- */ | ||
279 | |||
280 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | ||
281 | static struct at91_nand_data nand_data; | ||
282 | |||
283 | #define NAND_BASE AT91_CHIPSELECT_3 | ||
284 | |||
285 | static struct resource nand_resources[] = { | ||
286 | { | ||
287 | .start = NAND_BASE, | ||
288 | .end = NAND_BASE + SZ_256M - 1, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | } | ||
291 | }; | ||
292 | |||
293 | static struct platform_device at91cap9_nand_device = { | ||
294 | .name = "at91_nand", | ||
295 | .id = -1, | ||
296 | .dev = { | ||
297 | .platform_data = &nand_data, | ||
298 | }, | ||
299 | .resource = nand_resources, | ||
300 | .num_resources = ARRAY_SIZE(nand_resources), | ||
301 | }; | ||
302 | |||
303 | void __init at91_add_device_nand(struct at91_nand_data *data) | ||
304 | { | ||
305 | unsigned long csa, mode; | ||
306 | |||
307 | if (!data) | ||
308 | return; | ||
309 | |||
310 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
311 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | ||
312 | |||
313 | /* set the bus interface characteristics */ | ||
314 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(1) | ||
315 | | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(1)); | ||
316 | |||
317 | at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(6) | ||
318 | | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(6)); | ||
319 | |||
320 | at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(8) | AT91_SMC_NRDCYCLE_(8)); | ||
321 | |||
322 | if (data->bus_width_16) | ||
323 | mode = AT91_SMC_DBW_16; | ||
324 | else | ||
325 | mode = AT91_SMC_DBW_8; | ||
326 | at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); | ||
327 | |||
328 | /* enable pin */ | ||
329 | if (data->enable_pin) | ||
330 | at91_set_gpio_output(data->enable_pin, 1); | ||
331 | |||
332 | /* ready/busy pin */ | ||
333 | if (data->rdy_pin) | ||
334 | at91_set_gpio_input(data->rdy_pin, 1); | ||
335 | |||
336 | /* card detect pin */ | ||
337 | if (data->det_pin) | ||
338 | at91_set_gpio_input(data->det_pin, 1); | ||
339 | |||
340 | nand_data = *data; | ||
341 | platform_device_register(&at91cap9_nand_device); | ||
342 | } | ||
343 | #else | ||
344 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | ||
345 | #endif | ||
346 | |||
347 | /* -------------------------------------------------------------------- | ||
348 | * TWI (i2c) | ||
349 | * -------------------------------------------------------------------- */ | ||
350 | |||
351 | /* | ||
352 | * Prefer the GPIO code since the TWI controller isn't robust | ||
353 | * (gets overruns and underruns under load) and can only issue | ||
354 | * repeated STARTs in one scenario (the driver doesn't yet handle them). | ||
355 | */ | ||
356 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) | ||
357 | |||
358 | static struct i2c_gpio_platform_data pdata = { | ||
359 | .sda_pin = AT91_PIN_PB4, | ||
360 | .sda_is_open_drain = 1, | ||
361 | .scl_pin = AT91_PIN_PB5, | ||
362 | .scl_is_open_drain = 1, | ||
363 | .udelay = 2, /* ~100 kHz */ | ||
364 | }; | ||
365 | |||
366 | static struct platform_device at91cap9_twi_device = { | ||
367 | .name = "i2c-gpio", | ||
368 | .id = -1, | ||
369 | .dev.platform_data = &pdata, | ||
370 | }; | ||
371 | |||
372 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | ||
373 | { | ||
374 | at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */ | ||
375 | at91_set_multi_drive(AT91_PIN_PB4, 1); | ||
376 | |||
377 | at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */ | ||
378 | at91_set_multi_drive(AT91_PIN_PB5, 1); | ||
379 | |||
380 | i2c_register_board_info(0, devices, nr_devices); | ||
381 | platform_device_register(&at91cap9_twi_device); | ||
382 | } | ||
383 | |||
384 | #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) | ||
385 | |||
386 | static struct resource twi_resources[] = { | ||
387 | [0] = { | ||
388 | .start = AT91CAP9_BASE_TWI, | ||
389 | .end = AT91CAP9_BASE_TWI + SZ_16K - 1, | ||
390 | .flags = IORESOURCE_MEM, | ||
391 | }, | ||
392 | [1] = { | ||
393 | .start = AT91CAP9_ID_TWI, | ||
394 | .end = AT91CAP9_ID_TWI, | ||
395 | .flags = IORESOURCE_IRQ, | ||
396 | }, | ||
397 | }; | ||
398 | |||
399 | static struct platform_device at91cap9_twi_device = { | ||
400 | .name = "at91_i2c", | ||
401 | .id = -1, | ||
402 | .resource = twi_resources, | ||
403 | .num_resources = ARRAY_SIZE(twi_resources), | ||
404 | }; | ||
405 | |||
406 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | ||
407 | { | ||
408 | /* pins used for TWI interface */ | ||
409 | at91_set_B_periph(AT91_PIN_PB4, 0); /* TWD */ | ||
410 | at91_set_multi_drive(AT91_PIN_PB4, 1); | ||
411 | |||
412 | at91_set_B_periph(AT91_PIN_PB5, 0); /* TWCK */ | ||
413 | at91_set_multi_drive(AT91_PIN_PB5, 1); | ||
414 | |||
415 | i2c_register_board_info(0, devices, nr_devices); | ||
416 | platform_device_register(&at91cap9_twi_device); | ||
417 | } | ||
418 | #else | ||
419 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {} | ||
420 | #endif | ||
421 | |||
422 | /* -------------------------------------------------------------------- | ||
423 | * SPI | ||
424 | * -------------------------------------------------------------------- */ | ||
425 | |||
426 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | ||
427 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
428 | |||
429 | static struct resource spi0_resources[] = { | ||
430 | [0] = { | ||
431 | .start = AT91CAP9_BASE_SPI0, | ||
432 | .end = AT91CAP9_BASE_SPI0 + SZ_16K - 1, | ||
433 | .flags = IORESOURCE_MEM, | ||
434 | }, | ||
435 | [1] = { | ||
436 | .start = AT91CAP9_ID_SPI0, | ||
437 | .end = AT91CAP9_ID_SPI0, | ||
438 | .flags = IORESOURCE_IRQ, | ||
439 | }, | ||
440 | }; | ||
441 | |||
442 | static struct platform_device at91cap9_spi0_device = { | ||
443 | .name = "atmel_spi", | ||
444 | .id = 0, | ||
445 | .dev = { | ||
446 | .dma_mask = &spi_dmamask, | ||
447 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
448 | }, | ||
449 | .resource = spi0_resources, | ||
450 | .num_resources = ARRAY_SIZE(spi0_resources), | ||
451 | }; | ||
452 | |||
453 | static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PD0, AT91_PIN_PD1 }; | ||
454 | |||
455 | static struct resource spi1_resources[] = { | ||
456 | [0] = { | ||
457 | .start = AT91CAP9_BASE_SPI1, | ||
458 | .end = AT91CAP9_BASE_SPI1 + SZ_16K - 1, | ||
459 | .flags = IORESOURCE_MEM, | ||
460 | }, | ||
461 | [1] = { | ||
462 | .start = AT91CAP9_ID_SPI1, | ||
463 | .end = AT91CAP9_ID_SPI1, | ||
464 | .flags = IORESOURCE_IRQ, | ||
465 | }, | ||
466 | }; | ||
467 | |||
468 | static struct platform_device at91cap9_spi1_device = { | ||
469 | .name = "atmel_spi", | ||
470 | .id = 1, | ||
471 | .dev = { | ||
472 | .dma_mask = &spi_dmamask, | ||
473 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
474 | }, | ||
475 | .resource = spi1_resources, | ||
476 | .num_resources = ARRAY_SIZE(spi1_resources), | ||
477 | }; | ||
478 | |||
479 | static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 }; | ||
480 | |||
481 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | ||
482 | { | ||
483 | int i; | ||
484 | unsigned long cs_pin; | ||
485 | short enable_spi0 = 0; | ||
486 | short enable_spi1 = 0; | ||
487 | |||
488 | /* Choose SPI chip-selects */ | ||
489 | for (i = 0; i < nr_devices; i++) { | ||
490 | if (devices[i].controller_data) | ||
491 | cs_pin = (unsigned long) devices[i].controller_data; | ||
492 | else if (devices[i].bus_num == 0) | ||
493 | cs_pin = spi0_standard_cs[devices[i].chip_select]; | ||
494 | else | ||
495 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | ||
496 | |||
497 | if (devices[i].bus_num == 0) | ||
498 | enable_spi0 = 1; | ||
499 | else | ||
500 | enable_spi1 = 1; | ||
501 | |||
502 | /* enable chip-select pin */ | ||
503 | at91_set_gpio_output(cs_pin, 1); | ||
504 | |||
505 | /* pass chip-select pin to driver */ | ||
506 | devices[i].controller_data = (void *) cs_pin; | ||
507 | } | ||
508 | |||
509 | spi_register_board_info(devices, nr_devices); | ||
510 | |||
511 | /* Configure SPI bus(es) */ | ||
512 | if (enable_spi0) { | ||
513 | at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */ | ||
514 | at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */ | ||
515 | at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */ | ||
516 | |||
517 | at91_clock_associate("spi0_clk", &at91cap9_spi0_device.dev, "spi_clk"); | ||
518 | platform_device_register(&at91cap9_spi0_device); | ||
519 | } | ||
520 | if (enable_spi1) { | ||
521 | at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */ | ||
522 | at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */ | ||
523 | at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */ | ||
524 | |||
525 | at91_clock_associate("spi1_clk", &at91cap9_spi1_device.dev, "spi_clk"); | ||
526 | platform_device_register(&at91cap9_spi1_device); | ||
527 | } | ||
528 | } | ||
529 | #else | ||
530 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {} | ||
531 | #endif | ||
532 | |||
533 | |||
534 | /* -------------------------------------------------------------------- | ||
535 | * RTT | ||
536 | * -------------------------------------------------------------------- */ | ||
537 | |||
538 | static struct platform_device at91cap9_rtt_device = { | ||
539 | .name = "at91_rtt", | ||
540 | .id = -1, | ||
541 | .num_resources = 0, | ||
542 | }; | ||
543 | |||
544 | static void __init at91_add_device_rtt(void) | ||
545 | { | ||
546 | platform_device_register(&at91cap9_rtt_device); | ||
547 | } | ||
548 | |||
549 | |||
550 | /* -------------------------------------------------------------------- | ||
551 | * Watchdog | ||
552 | * -------------------------------------------------------------------- */ | ||
553 | |||
554 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
555 | static struct platform_device at91cap9_wdt_device = { | ||
556 | .name = "at91_wdt", | ||
557 | .id = -1, | ||
558 | .num_resources = 0, | ||
559 | }; | ||
560 | |||
561 | static void __init at91_add_device_watchdog(void) | ||
562 | { | ||
563 | platform_device_register(&at91cap9_wdt_device); | ||
564 | } | ||
565 | #else | ||
566 | static void __init at91_add_device_watchdog(void) {} | ||
567 | #endif | ||
568 | |||
569 | |||
570 | /* -------------------------------------------------------------------- | ||
571 | * AC97 | ||
572 | * -------------------------------------------------------------------- */ | ||
573 | |||
574 | #if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE) | ||
575 | static u64 ac97_dmamask = DMA_BIT_MASK(32); | ||
576 | static struct atmel_ac97_data ac97_data; | ||
577 | |||
578 | static struct resource ac97_resources[] = { | ||
579 | [0] = { | ||
580 | .start = AT91CAP9_BASE_AC97C, | ||
581 | .end = AT91CAP9_BASE_AC97C + SZ_16K - 1, | ||
582 | .flags = IORESOURCE_MEM, | ||
583 | }, | ||
584 | [1] = { | ||
585 | .start = AT91CAP9_ID_AC97C, | ||
586 | .end = AT91CAP9_ID_AC97C, | ||
587 | .flags = IORESOURCE_IRQ, | ||
588 | }, | ||
589 | }; | ||
590 | |||
591 | static struct platform_device at91cap9_ac97_device = { | ||
592 | .name = "ac97c", | ||
593 | .id = 1, | ||
594 | .dev = { | ||
595 | .dma_mask = &ac97_dmamask, | ||
596 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
597 | .platform_data = &ac97_data, | ||
598 | }, | ||
599 | .resource = ac97_resources, | ||
600 | .num_resources = ARRAY_SIZE(ac97_resources), | ||
601 | }; | ||
602 | |||
603 | void __init at91_add_device_ac97(struct atmel_ac97_data *data) | ||
604 | { | ||
605 | if (!data) | ||
606 | return; | ||
607 | |||
608 | at91_set_A_periph(AT91_PIN_PA6, 0); /* AC97FS */ | ||
609 | at91_set_A_periph(AT91_PIN_PA7, 0); /* AC97CK */ | ||
610 | at91_set_A_periph(AT91_PIN_PA8, 0); /* AC97TX */ | ||
611 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ | ||
612 | |||
613 | /* reset */ | ||
614 | if (data->reset_pin) | ||
615 | at91_set_gpio_output(data->reset_pin, 0); | ||
616 | |||
617 | ac97_data = *data; | ||
618 | platform_device_register(&at91cap9_ac97_device); | ||
619 | } | ||
620 | #else | ||
621 | void __init at91_add_device_ac97(struct atmel_ac97_data *data) {} | ||
622 | #endif | ||
623 | |||
624 | |||
625 | /* -------------------------------------------------------------------- | ||
626 | * LCD Controller | ||
627 | * -------------------------------------------------------------------- */ | ||
628 | |||
629 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | ||
630 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); | ||
631 | static struct atmel_lcdfb_info lcdc_data; | ||
632 | |||
633 | static struct resource lcdc_resources[] = { | ||
634 | [0] = { | ||
635 | .start = AT91CAP9_LCDC_BASE, | ||
636 | .end = AT91CAP9_LCDC_BASE + SZ_4K - 1, | ||
637 | .flags = IORESOURCE_MEM, | ||
638 | }, | ||
639 | [1] = { | ||
640 | .start = AT91CAP9_ID_LCDC, | ||
641 | .end = AT91CAP9_ID_LCDC, | ||
642 | .flags = IORESOURCE_IRQ, | ||
643 | }, | ||
644 | }; | ||
645 | |||
646 | static struct platform_device at91_lcdc_device = { | ||
647 | .name = "atmel_lcdfb", | ||
648 | .id = 0, | ||
649 | .dev = { | ||
650 | .dma_mask = &lcdc_dmamask, | ||
651 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
652 | .platform_data = &lcdc_data, | ||
653 | }, | ||
654 | .resource = lcdc_resources, | ||
655 | .num_resources = ARRAY_SIZE(lcdc_resources), | ||
656 | }; | ||
657 | |||
658 | void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | ||
659 | { | ||
660 | if (!data) | ||
661 | return; | ||
662 | |||
663 | at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */ | ||
664 | at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */ | ||
665 | at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */ | ||
666 | at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */ | ||
667 | at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */ | ||
668 | at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */ | ||
669 | at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */ | ||
670 | at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */ | ||
671 | at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */ | ||
672 | at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */ | ||
673 | at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */ | ||
674 | at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */ | ||
675 | at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */ | ||
676 | at91_set_A_periph(AT91_PIN_PC17, 0); /* LCDD13 */ | ||
677 | at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */ | ||
678 | at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */ | ||
679 | at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */ | ||
680 | at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */ | ||
681 | at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */ | ||
682 | at91_set_A_periph(AT91_PIN_PC25, 0); /* LCDD21 */ | ||
683 | at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */ | ||
684 | at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */ | ||
685 | |||
686 | lcdc_data = *data; | ||
687 | platform_device_register(&at91_lcdc_device); | ||
688 | } | ||
689 | #else | ||
690 | void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | ||
691 | #endif | ||
692 | |||
693 | |||
694 | /* -------------------------------------------------------------------- | ||
695 | * SSC -- Synchronous Serial Controller | ||
696 | * -------------------------------------------------------------------- */ | ||
697 | |||
698 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
699 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
700 | |||
701 | static struct resource ssc0_resources[] = { | ||
702 | [0] = { | ||
703 | .start = AT91CAP9_BASE_SSC0, | ||
704 | .end = AT91CAP9_BASE_SSC0 + SZ_16K - 1, | ||
705 | .flags = IORESOURCE_MEM, | ||
706 | }, | ||
707 | [1] = { | ||
708 | .start = AT91CAP9_ID_SSC0, | ||
709 | .end = AT91CAP9_ID_SSC0, | ||
710 | .flags = IORESOURCE_IRQ, | ||
711 | }, | ||
712 | }; | ||
713 | |||
714 | static struct platform_device at91cap9_ssc0_device = { | ||
715 | .name = "ssc", | ||
716 | .id = 0, | ||
717 | .dev = { | ||
718 | .dma_mask = &ssc0_dmamask, | ||
719 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
720 | }, | ||
721 | .resource = ssc0_resources, | ||
722 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
723 | }; | ||
724 | |||
725 | static inline void configure_ssc0_pins(unsigned pins) | ||
726 | { | ||
727 | if (pins & ATMEL_SSC_TF) | ||
728 | at91_set_A_periph(AT91_PIN_PB0, 1); | ||
729 | if (pins & ATMEL_SSC_TK) | ||
730 | at91_set_A_periph(AT91_PIN_PB1, 1); | ||
731 | if (pins & ATMEL_SSC_TD) | ||
732 | at91_set_A_periph(AT91_PIN_PB2, 1); | ||
733 | if (pins & ATMEL_SSC_RD) | ||
734 | at91_set_A_periph(AT91_PIN_PB3, 1); | ||
735 | if (pins & ATMEL_SSC_RK) | ||
736 | at91_set_A_periph(AT91_PIN_PB4, 1); | ||
737 | if (pins & ATMEL_SSC_RF) | ||
738 | at91_set_A_periph(AT91_PIN_PB5, 1); | ||
739 | } | ||
740 | |||
741 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
742 | |||
743 | static struct resource ssc1_resources[] = { | ||
744 | [0] = { | ||
745 | .start = AT91CAP9_BASE_SSC1, | ||
746 | .end = AT91CAP9_BASE_SSC1 + SZ_16K - 1, | ||
747 | .flags = IORESOURCE_MEM, | ||
748 | }, | ||
749 | [1] = { | ||
750 | .start = AT91CAP9_ID_SSC1, | ||
751 | .end = AT91CAP9_ID_SSC1, | ||
752 | .flags = IORESOURCE_IRQ, | ||
753 | }, | ||
754 | }; | ||
755 | |||
756 | static struct platform_device at91cap9_ssc1_device = { | ||
757 | .name = "ssc", | ||
758 | .id = 1, | ||
759 | .dev = { | ||
760 | .dma_mask = &ssc1_dmamask, | ||
761 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
762 | }, | ||
763 | .resource = ssc1_resources, | ||
764 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
765 | }; | ||
766 | |||
767 | static inline void configure_ssc1_pins(unsigned pins) | ||
768 | { | ||
769 | if (pins & ATMEL_SSC_TF) | ||
770 | at91_set_A_periph(AT91_PIN_PB6, 1); | ||
771 | if (pins & ATMEL_SSC_TK) | ||
772 | at91_set_A_periph(AT91_PIN_PB7, 1); | ||
773 | if (pins & ATMEL_SSC_TD) | ||
774 | at91_set_A_periph(AT91_PIN_PB8, 1); | ||
775 | if (pins & ATMEL_SSC_RD) | ||
776 | at91_set_A_periph(AT91_PIN_PB9, 1); | ||
777 | if (pins & ATMEL_SSC_RK) | ||
778 | at91_set_A_periph(AT91_PIN_PB10, 1); | ||
779 | if (pins & ATMEL_SSC_RF) | ||
780 | at91_set_A_periph(AT91_PIN_PB11, 1); | ||
781 | } | ||
782 | |||
783 | /* | ||
784 | * SSC controllers are accessed through library code, instead of any | ||
785 | * kind of all-singing/all-dancing driver. For example one could be | ||
786 | * used by a particular I2S audio codec's driver, while another one | ||
787 | * on the same system might be used by a custom data capture driver. | ||
788 | */ | ||
789 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
790 | { | ||
791 | struct platform_device *pdev; | ||
792 | |||
793 | /* | ||
794 | * NOTE: caller is responsible for passing information matching | ||
795 | * "pins" to whatever will be using each particular controller. | ||
796 | */ | ||
797 | switch (id) { | ||
798 | case AT91CAP9_ID_SSC0: | ||
799 | pdev = &at91cap9_ssc0_device; | ||
800 | configure_ssc0_pins(pins); | ||
801 | at91_clock_associate("ssc0_clk", &pdev->dev, "ssc"); | ||
802 | break; | ||
803 | case AT91CAP9_ID_SSC1: | ||
804 | pdev = &at91cap9_ssc1_device; | ||
805 | configure_ssc1_pins(pins); | ||
806 | at91_clock_associate("ssc1_clk", &pdev->dev, "ssc"); | ||
807 | break; | ||
808 | default: | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | platform_device_register(pdev); | ||
813 | } | ||
814 | |||
815 | #else | ||
816 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
817 | #endif | ||
818 | |||
819 | |||
820 | /* -------------------------------------------------------------------- | ||
821 | * UART | ||
822 | * -------------------------------------------------------------------- */ | ||
823 | |||
824 | #if defined(CONFIG_SERIAL_ATMEL) | ||
825 | static struct resource dbgu_resources[] = { | ||
826 | [0] = { | ||
827 | .start = AT91_VA_BASE_SYS + AT91_DBGU, | ||
828 | .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1, | ||
829 | .flags = IORESOURCE_MEM, | ||
830 | }, | ||
831 | [1] = { | ||
832 | .start = AT91_ID_SYS, | ||
833 | .end = AT91_ID_SYS, | ||
834 | .flags = IORESOURCE_IRQ, | ||
835 | }, | ||
836 | }; | ||
837 | |||
838 | static struct atmel_uart_data dbgu_data = { | ||
839 | .use_dma_tx = 0, | ||
840 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | ||
841 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | ||
842 | }; | ||
843 | |||
844 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
845 | |||
846 | static struct platform_device at91cap9_dbgu_device = { | ||
847 | .name = "atmel_usart", | ||
848 | .id = 0, | ||
849 | .dev = { | ||
850 | .dma_mask = &dbgu_dmamask, | ||
851 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
852 | .platform_data = &dbgu_data, | ||
853 | }, | ||
854 | .resource = dbgu_resources, | ||
855 | .num_resources = ARRAY_SIZE(dbgu_resources), | ||
856 | }; | ||
857 | |||
858 | static inline void configure_dbgu_pins(void) | ||
859 | { | ||
860 | at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | ||
861 | at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | ||
862 | } | ||
863 | |||
864 | static struct resource uart0_resources[] = { | ||
865 | [0] = { | ||
866 | .start = AT91CAP9_BASE_US0, | ||
867 | .end = AT91CAP9_BASE_US0 + SZ_16K - 1, | ||
868 | .flags = IORESOURCE_MEM, | ||
869 | }, | ||
870 | [1] = { | ||
871 | .start = AT91CAP9_ID_US0, | ||
872 | .end = AT91CAP9_ID_US0, | ||
873 | .flags = IORESOURCE_IRQ, | ||
874 | }, | ||
875 | }; | ||
876 | |||
877 | static struct atmel_uart_data uart0_data = { | ||
878 | .use_dma_tx = 1, | ||
879 | .use_dma_rx = 1, | ||
880 | }; | ||
881 | |||
882 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
883 | |||
884 | static struct platform_device at91cap9_uart0_device = { | ||
885 | .name = "atmel_usart", | ||
886 | .id = 1, | ||
887 | .dev = { | ||
888 | .dma_mask = &uart0_dmamask, | ||
889 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
890 | .platform_data = &uart0_data, | ||
891 | }, | ||
892 | .resource = uart0_resources, | ||
893 | .num_resources = ARRAY_SIZE(uart0_resources), | ||
894 | }; | ||
895 | |||
896 | static inline void configure_usart0_pins(unsigned pins) | ||
897 | { | ||
898 | at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ | ||
899 | at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ | ||
900 | |||
901 | if (pins & ATMEL_UART_RTS) | ||
902 | at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */ | ||
903 | if (pins & ATMEL_UART_CTS) | ||
904 | at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */ | ||
905 | } | ||
906 | |||
907 | static struct resource uart1_resources[] = { | ||
908 | [0] = { | ||
909 | .start = AT91CAP9_BASE_US1, | ||
910 | .end = AT91CAP9_BASE_US1 + SZ_16K - 1, | ||
911 | .flags = IORESOURCE_MEM, | ||
912 | }, | ||
913 | [1] = { | ||
914 | .start = AT91CAP9_ID_US1, | ||
915 | .end = AT91CAP9_ID_US1, | ||
916 | .flags = IORESOURCE_IRQ, | ||
917 | }, | ||
918 | }; | ||
919 | |||
920 | static struct atmel_uart_data uart1_data = { | ||
921 | .use_dma_tx = 1, | ||
922 | .use_dma_rx = 1, | ||
923 | }; | ||
924 | |||
925 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
926 | |||
927 | static struct platform_device at91cap9_uart1_device = { | ||
928 | .name = "atmel_usart", | ||
929 | .id = 2, | ||
930 | .dev = { | ||
931 | .dma_mask = &uart1_dmamask, | ||
932 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
933 | .platform_data = &uart1_data, | ||
934 | }, | ||
935 | .resource = uart1_resources, | ||
936 | .num_resources = ARRAY_SIZE(uart1_resources), | ||
937 | }; | ||
938 | |||
939 | static inline void configure_usart1_pins(unsigned pins) | ||
940 | { | ||
941 | at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | ||
942 | at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | ||
943 | |||
944 | if (pins & ATMEL_UART_RTS) | ||
945 | at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ | ||
946 | if (pins & ATMEL_UART_CTS) | ||
947 | at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ | ||
948 | } | ||
949 | |||
950 | static struct resource uart2_resources[] = { | ||
951 | [0] = { | ||
952 | .start = AT91CAP9_BASE_US2, | ||
953 | .end = AT91CAP9_BASE_US2 + SZ_16K - 1, | ||
954 | .flags = IORESOURCE_MEM, | ||
955 | }, | ||
956 | [1] = { | ||
957 | .start = AT91CAP9_ID_US2, | ||
958 | .end = AT91CAP9_ID_US2, | ||
959 | .flags = IORESOURCE_IRQ, | ||
960 | }, | ||
961 | }; | ||
962 | |||
963 | static struct atmel_uart_data uart2_data = { | ||
964 | .use_dma_tx = 1, | ||
965 | .use_dma_rx = 1, | ||
966 | }; | ||
967 | |||
968 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
969 | |||
970 | static struct platform_device at91cap9_uart2_device = { | ||
971 | .name = "atmel_usart", | ||
972 | .id = 3, | ||
973 | .dev = { | ||
974 | .dma_mask = &uart2_dmamask, | ||
975 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
976 | .platform_data = &uart2_data, | ||
977 | }, | ||
978 | .resource = uart2_resources, | ||
979 | .num_resources = ARRAY_SIZE(uart2_resources), | ||
980 | }; | ||
981 | |||
982 | static inline void configure_usart2_pins(unsigned pins) | ||
983 | { | ||
984 | at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | ||
985 | at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | ||
986 | |||
987 | if (pins & ATMEL_UART_RTS) | ||
988 | at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ | ||
989 | if (pins & ATMEL_UART_CTS) | ||
990 | at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ | ||
991 | } | ||
992 | |||
993 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | ||
994 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
995 | |||
996 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
997 | { | ||
998 | struct platform_device *pdev; | ||
999 | |||
1000 | switch (id) { | ||
1001 | case 0: /* DBGU */ | ||
1002 | pdev = &at91cap9_dbgu_device; | ||
1003 | configure_dbgu_pins(); | ||
1004 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
1005 | break; | ||
1006 | case AT91CAP9_ID_US0: | ||
1007 | pdev = &at91cap9_uart0_device; | ||
1008 | configure_usart0_pins(pins); | ||
1009 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
1010 | break; | ||
1011 | case AT91CAP9_ID_US1: | ||
1012 | pdev = &at91cap9_uart1_device; | ||
1013 | configure_usart1_pins(pins); | ||
1014 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
1015 | break; | ||
1016 | case AT91CAP9_ID_US2: | ||
1017 | pdev = &at91cap9_uart2_device; | ||
1018 | configure_usart2_pins(pins); | ||
1019 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
1020 | break; | ||
1021 | default: | ||
1022 | return; | ||
1023 | } | ||
1024 | pdev->id = portnr; /* update to mapped ID */ | ||
1025 | |||
1026 | if (portnr < ATMEL_MAX_UART) | ||
1027 | at91_uarts[portnr] = pdev; | ||
1028 | } | ||
1029 | |||
1030 | void __init at91_set_serial_console(unsigned portnr) | ||
1031 | { | ||
1032 | if (portnr < ATMEL_MAX_UART) | ||
1033 | atmel_default_console_device = at91_uarts[portnr]; | ||
1034 | if (!atmel_default_console_device) | ||
1035 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1036 | } | ||
1037 | |||
1038 | void __init at91_add_device_serial(void) | ||
1039 | { | ||
1040 | int i; | ||
1041 | |||
1042 | for (i = 0; i < ATMEL_MAX_UART; i++) { | ||
1043 | if (at91_uarts[i]) | ||
1044 | platform_device_register(at91_uarts[i]); | ||
1045 | } | ||
1046 | } | ||
1047 | #else | ||
1048 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1049 | void __init at91_set_serial_console(unsigned portnr) {} | ||
1050 | void __init at91_add_device_serial(void) {} | ||
1051 | #endif | ||
1052 | |||
1053 | |||
1054 | /* -------------------------------------------------------------------- */ | ||
1055 | /* | ||
1056 | * These devices are always present and don't need any board-specific | ||
1057 | * setup. | ||
1058 | */ | ||
1059 | static int __init at91_add_standard_devices(void) | ||
1060 | { | ||
1061 | at91_add_device_rtt(); | ||
1062 | at91_add_device_watchdog(); | ||
1063 | return 0; | ||
1064 | } | ||
1065 | |||
1066 | arch_initcall(at91_add_standard_devices); | ||
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 2cad2bf864be..d688c1dbd925 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -301,28 +301,28 @@ void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks | |||
301 | static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { | 301 | static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { |
302 | 7, /* Advanced Interrupt Controller (FIQ) */ | 302 | 7, /* Advanced Interrupt Controller (FIQ) */ |
303 | 7, /* System Peripherals */ | 303 | 7, /* System Peripherals */ |
304 | 0, /* Parallel IO Controller A */ | 304 | 1, /* Parallel IO Controller A */ |
305 | 0, /* Parallel IO Controller B */ | 305 | 1, /* Parallel IO Controller B */ |
306 | 0, /* Parallel IO Controller C */ | 306 | 1, /* Parallel IO Controller C */ |
307 | 0, /* Parallel IO Controller D */ | 307 | 1, /* Parallel IO Controller D */ |
308 | 6, /* USART 0 */ | 308 | 5, /* USART 0 */ |
309 | 6, /* USART 1 */ | 309 | 5, /* USART 1 */ |
310 | 6, /* USART 2 */ | 310 | 5, /* USART 2 */ |
311 | 6, /* USART 3 */ | 311 | 5, /* USART 3 */ |
312 | 0, /* Multimedia Card Interface */ | 312 | 0, /* Multimedia Card Interface */ |
313 | 4, /* USB Device Port */ | 313 | 2, /* USB Device Port */ |
314 | 0, /* Two-Wire Interface */ | 314 | 6, /* Two-Wire Interface */ |
315 | 6, /* Serial Peripheral Interface */ | 315 | 5, /* Serial Peripheral Interface */ |
316 | 5, /* Serial Synchronous Controller 0 */ | 316 | 4, /* Serial Synchronous Controller 0 */ |
317 | 5, /* Serial Synchronous Controller 1 */ | 317 | 4, /* Serial Synchronous Controller 1 */ |
318 | 5, /* Serial Synchronous Controller 2 */ | 318 | 4, /* Serial Synchronous Controller 2 */ |
319 | 0, /* Timer Counter 0 */ | 319 | 0, /* Timer Counter 0 */ |
320 | 0, /* Timer Counter 1 */ | 320 | 0, /* Timer Counter 1 */ |
321 | 0, /* Timer Counter 2 */ | 321 | 0, /* Timer Counter 2 */ |
322 | 0, /* Timer Counter 3 */ | 322 | 0, /* Timer Counter 3 */ |
323 | 0, /* Timer Counter 4 */ | 323 | 0, /* Timer Counter 4 */ |
324 | 0, /* Timer Counter 5 */ | 324 | 0, /* Timer Counter 5 */ |
325 | 3, /* USB Host port */ | 325 | 2, /* USB Host port */ |
326 | 3, /* Ethernet MAC */ | 326 | 3, /* Ethernet MAC */ |
327 | 0, /* Advanced Interrupt Controller (IRQ0) */ | 327 | 0, /* Advanced Interrupt Controller (IRQ0) */ |
328 | 0, /* Advanced Interrupt Controller (IRQ1) */ | 328 | 0, /* Advanced Interrupt Controller (IRQ1) */ |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 9296833f91cc..ef6aeb86e980 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/mach/arch.h> | 13 | #include <asm/mach/arch.h> |
14 | #include <asm/mach/map.h> | 14 | #include <asm/mach/map.h> |
15 | 15 | ||
16 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
17 | #include <linux/i2c-gpio.h> | 18 | #include <linux/i2c-gpio.h> |
18 | 19 | ||
@@ -29,7 +30,7 @@ | |||
29 | * -------------------------------------------------------------------- */ | 30 | * -------------------------------------------------------------------- */ |
30 | 31 | ||
31 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 32 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
32 | static u64 ohci_dmamask = 0xffffffffUL; | 33 | static u64 ohci_dmamask = DMA_BIT_MASK(32); |
33 | static struct at91_usbh_data usbh_data; | 34 | static struct at91_usbh_data usbh_data; |
34 | 35 | ||
35 | static struct resource usbh_resources[] = { | 36 | static struct resource usbh_resources[] = { |
@@ -50,7 +51,7 @@ static struct platform_device at91rm9200_usbh_device = { | |||
50 | .id = -1, | 51 | .id = -1, |
51 | .dev = { | 52 | .dev = { |
52 | .dma_mask = &ohci_dmamask, | 53 | .dma_mask = &ohci_dmamask, |
53 | .coherent_dma_mask = 0xffffffff, | 54 | .coherent_dma_mask = DMA_BIT_MASK(32), |
54 | .platform_data = &usbh_data, | 55 | .platform_data = &usbh_data, |
55 | }, | 56 | }, |
56 | .resource = usbh_resources, | 57 | .resource = usbh_resources, |
@@ -125,7 +126,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
125 | * -------------------------------------------------------------------- */ | 126 | * -------------------------------------------------------------------- */ |
126 | 127 | ||
127 | #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) | 128 | #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) |
128 | static u64 eth_dmamask = 0xffffffffUL; | 129 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
129 | static struct at91_eth_data eth_data; | 130 | static struct at91_eth_data eth_data; |
130 | 131 | ||
131 | static struct resource eth_resources[] = { | 132 | static struct resource eth_resources[] = { |
@@ -146,7 +147,7 @@ static struct platform_device at91rm9200_eth_device = { | |||
146 | .id = -1, | 147 | .id = -1, |
147 | .dev = { | 148 | .dev = { |
148 | .dma_mask = ð_dmamask, | 149 | .dma_mask = ð_dmamask, |
149 | .coherent_dma_mask = 0xffffffff, | 150 | .coherent_dma_mask = DMA_BIT_MASK(32), |
150 | .platform_data = ð_data, | 151 | .platform_data = ð_data, |
151 | }, | 152 | }, |
152 | .resource = eth_resources, | 153 | .resource = eth_resources, |
@@ -285,7 +286,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {} | |||
285 | * -------------------------------------------------------------------- */ | 286 | * -------------------------------------------------------------------- */ |
286 | 287 | ||
287 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 288 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
288 | static u64 mmc_dmamask = 0xffffffffUL; | 289 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
289 | static struct at91_mmc_data mmc_data; | 290 | static struct at91_mmc_data mmc_data; |
290 | 291 | ||
291 | static struct resource mmc_resources[] = { | 292 | static struct resource mmc_resources[] = { |
@@ -306,7 +307,7 @@ static struct platform_device at91rm9200_mmc_device = { | |||
306 | .id = -1, | 307 | .id = -1, |
307 | .dev = { | 308 | .dev = { |
308 | .dma_mask = &mmc_dmamask, | 309 | .dma_mask = &mmc_dmamask, |
309 | .coherent_dma_mask = 0xffffffff, | 310 | .coherent_dma_mask = DMA_BIT_MASK(32), |
310 | .platform_data = &mmc_data, | 311 | .platform_data = &mmc_data, |
311 | }, | 312 | }, |
312 | .resource = mmc_resources, | 313 | .resource = mmc_resources, |
@@ -375,7 +376,7 @@ static struct at91_nand_data nand_data; | |||
375 | static struct resource nand_resources[] = { | 376 | static struct resource nand_resources[] = { |
376 | { | 377 | { |
377 | .start = NAND_BASE, | 378 | .start = NAND_BASE, |
378 | .end = NAND_BASE + SZ_8M - 1, | 379 | .end = NAND_BASE + SZ_256M - 1, |
379 | .flags = IORESOURCE_MEM, | 380 | .flags = IORESOURCE_MEM, |
380 | } | 381 | } |
381 | }; | 382 | }; |
@@ -513,7 +514,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
513 | * -------------------------------------------------------------------- */ | 514 | * -------------------------------------------------------------------- */ |
514 | 515 | ||
515 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 516 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
516 | static u64 spi_dmamask = 0xffffffffUL; | 517 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
517 | 518 | ||
518 | static struct resource spi_resources[] = { | 519 | static struct resource spi_resources[] = { |
519 | [0] = { | 520 | [0] = { |
@@ -533,7 +534,7 @@ static struct platform_device at91rm9200_spi_device = { | |||
533 | .id = 0, | 534 | .id = 0, |
534 | .dev = { | 535 | .dev = { |
535 | .dma_mask = &spi_dmamask, | 536 | .dma_mask = &spi_dmamask, |
536 | .coherent_dma_mask = 0xffffffff, | 537 | .coherent_dma_mask = DMA_BIT_MASK(32), |
537 | }, | 538 | }, |
538 | .resource = spi_resources, | 539 | .resource = spi_resources, |
539 | .num_resources = ARRAY_SIZE(spi_resources), | 540 | .num_resources = ARRAY_SIZE(spi_resources), |
@@ -557,8 +558,11 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
557 | else | 558 | else |
558 | cs_pin = spi_standard_cs[devices[i].chip_select]; | 559 | cs_pin = spi_standard_cs[devices[i].chip_select]; |
559 | 560 | ||
560 | /* enable chip-select pin */ | 561 | if (devices[i].chip_select == 0) /* for CS0 errata */ |
561 | at91_set_gpio_output(cs_pin, 1); | 562 | at91_set_A_periph(cs_pin, 0); |
563 | else | ||
564 | at91_set_gpio_output(cs_pin, 1); | ||
565 | |||
562 | 566 | ||
563 | /* pass chip-select pin to driver */ | 567 | /* pass chip-select pin to driver */ |
564 | devices[i].controller_data = (void *) cs_pin; | 568 | devices[i].controller_data = (void *) cs_pin; |
@@ -613,24 +617,175 @@ static void __init at91_add_device_watchdog(void) {} | |||
613 | 617 | ||
614 | 618 | ||
615 | /* -------------------------------------------------------------------- | 619 | /* -------------------------------------------------------------------- |
616 | * LEDs | 620 | * SSC -- Synchronous Serial Controller |
617 | * -------------------------------------------------------------------- */ | 621 | * -------------------------------------------------------------------- */ |
618 | 622 | ||
619 | #if defined(CONFIG_LEDS) | 623 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) |
620 | u8 at91_leds_cpu; | 624 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); |
621 | u8 at91_leds_timer; | 625 | |
626 | static struct resource ssc0_resources[] = { | ||
627 | [0] = { | ||
628 | .start = AT91RM9200_BASE_SSC0, | ||
629 | .end = AT91RM9200_BASE_SSC0 + SZ_16K - 1, | ||
630 | .flags = IORESOURCE_MEM, | ||
631 | }, | ||
632 | [1] = { | ||
633 | .start = AT91RM9200_ID_SSC0, | ||
634 | .end = AT91RM9200_ID_SSC0, | ||
635 | .flags = IORESOURCE_IRQ, | ||
636 | }, | ||
637 | }; | ||
638 | |||
639 | static struct platform_device at91rm9200_ssc0_device = { | ||
640 | .name = "ssc", | ||
641 | .id = 0, | ||
642 | .dev = { | ||
643 | .dma_mask = &ssc0_dmamask, | ||
644 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
645 | }, | ||
646 | .resource = ssc0_resources, | ||
647 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
648 | }; | ||
649 | |||
650 | static inline void configure_ssc0_pins(unsigned pins) | ||
651 | { | ||
652 | if (pins & ATMEL_SSC_TF) | ||
653 | at91_set_A_periph(AT91_PIN_PB0, 1); | ||
654 | if (pins & ATMEL_SSC_TK) | ||
655 | at91_set_A_periph(AT91_PIN_PB1, 1); | ||
656 | if (pins & ATMEL_SSC_TD) | ||
657 | at91_set_A_periph(AT91_PIN_PB2, 1); | ||
658 | if (pins & ATMEL_SSC_RD) | ||
659 | at91_set_A_periph(AT91_PIN_PB3, 1); | ||
660 | if (pins & ATMEL_SSC_RK) | ||
661 | at91_set_A_periph(AT91_PIN_PB4, 1); | ||
662 | if (pins & ATMEL_SSC_RF) | ||
663 | at91_set_A_periph(AT91_PIN_PB5, 1); | ||
664 | } | ||
665 | |||
666 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
667 | |||
668 | static struct resource ssc1_resources[] = { | ||
669 | [0] = { | ||
670 | .start = AT91RM9200_BASE_SSC1, | ||
671 | .end = AT91RM9200_BASE_SSC1 + SZ_16K - 1, | ||
672 | .flags = IORESOURCE_MEM, | ||
673 | }, | ||
674 | [1] = { | ||
675 | .start = AT91RM9200_ID_SSC1, | ||
676 | .end = AT91RM9200_ID_SSC1, | ||
677 | .flags = IORESOURCE_IRQ, | ||
678 | }, | ||
679 | }; | ||
680 | |||
681 | static struct platform_device at91rm9200_ssc1_device = { | ||
682 | .name = "ssc", | ||
683 | .id = 1, | ||
684 | .dev = { | ||
685 | .dma_mask = &ssc1_dmamask, | ||
686 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
687 | }, | ||
688 | .resource = ssc1_resources, | ||
689 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
690 | }; | ||
691 | |||
692 | static inline void configure_ssc1_pins(unsigned pins) | ||
693 | { | ||
694 | if (pins & ATMEL_SSC_TF) | ||
695 | at91_set_A_periph(AT91_PIN_PB6, 1); | ||
696 | if (pins & ATMEL_SSC_TK) | ||
697 | at91_set_A_periph(AT91_PIN_PB7, 1); | ||
698 | if (pins & ATMEL_SSC_TD) | ||
699 | at91_set_A_periph(AT91_PIN_PB8, 1); | ||
700 | if (pins & ATMEL_SSC_RD) | ||
701 | at91_set_A_periph(AT91_PIN_PB9, 1); | ||
702 | if (pins & ATMEL_SSC_RK) | ||
703 | at91_set_A_periph(AT91_PIN_PB10, 1); | ||
704 | if (pins & ATMEL_SSC_RF) | ||
705 | at91_set_A_periph(AT91_PIN_PB11, 1); | ||
706 | } | ||
707 | |||
708 | static u64 ssc2_dmamask = DMA_BIT_MASK(32); | ||
709 | |||
710 | static struct resource ssc2_resources[] = { | ||
711 | [0] = { | ||
712 | .start = AT91RM9200_BASE_SSC2, | ||
713 | .end = AT91RM9200_BASE_SSC2 + SZ_16K - 1, | ||
714 | .flags = IORESOURCE_MEM, | ||
715 | }, | ||
716 | [1] = { | ||
717 | .start = AT91RM9200_ID_SSC2, | ||
718 | .end = AT91RM9200_ID_SSC2, | ||
719 | .flags = IORESOURCE_IRQ, | ||
720 | }, | ||
721 | }; | ||
722 | |||
723 | static struct platform_device at91rm9200_ssc2_device = { | ||
724 | .name = "ssc", | ||
725 | .id = 2, | ||
726 | .dev = { | ||
727 | .dma_mask = &ssc2_dmamask, | ||
728 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
729 | }, | ||
730 | .resource = ssc2_resources, | ||
731 | .num_resources = ARRAY_SIZE(ssc2_resources), | ||
732 | }; | ||
733 | |||
734 | static inline void configure_ssc2_pins(unsigned pins) | ||
735 | { | ||
736 | if (pins & ATMEL_SSC_TF) | ||
737 | at91_set_A_periph(AT91_PIN_PB12, 1); | ||
738 | if (pins & ATMEL_SSC_TK) | ||
739 | at91_set_A_periph(AT91_PIN_PB13, 1); | ||
740 | if (pins & ATMEL_SSC_TD) | ||
741 | at91_set_A_periph(AT91_PIN_PB14, 1); | ||
742 | if (pins & ATMEL_SSC_RD) | ||
743 | at91_set_A_periph(AT91_PIN_PB15, 1); | ||
744 | if (pins & ATMEL_SSC_RK) | ||
745 | at91_set_A_periph(AT91_PIN_PB16, 1); | ||
746 | if (pins & ATMEL_SSC_RF) | ||
747 | at91_set_A_periph(AT91_PIN_PB17, 1); | ||
748 | } | ||
622 | 749 | ||
623 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 750 | /* |
751 | * SSC controllers are accessed through library code, instead of any | ||
752 | * kind of all-singing/all-dancing driver. For example one could be | ||
753 | * used by a particular I2S audio codec's driver, while another one | ||
754 | * on the same system might be used by a custom data capture driver. | ||
755 | */ | ||
756 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
624 | { | 757 | { |
625 | /* Enable GPIO to access the LEDs */ | 758 | struct platform_device *pdev; |
626 | at91_set_gpio_output(cpu_led, 1); | ||
627 | at91_set_gpio_output(timer_led, 1); | ||
628 | 759 | ||
629 | at91_leds_cpu = cpu_led; | 760 | /* |
630 | at91_leds_timer = timer_led; | 761 | * NOTE: caller is responsible for passing information matching |
762 | * "pins" to whatever will be using each particular controller. | ||
763 | */ | ||
764 | switch (id) { | ||
765 | case AT91RM9200_ID_SSC0: | ||
766 | pdev = &at91rm9200_ssc0_device; | ||
767 | configure_ssc0_pins(pins); | ||
768 | at91_clock_associate("ssc0_clk", &pdev->dev, "ssc"); | ||
769 | break; | ||
770 | case AT91RM9200_ID_SSC1: | ||
771 | pdev = &at91rm9200_ssc1_device; | ||
772 | configure_ssc1_pins(pins); | ||
773 | at91_clock_associate("ssc1_clk", &pdev->dev, "ssc"); | ||
774 | break; | ||
775 | case AT91RM9200_ID_SSC2: | ||
776 | pdev = &at91rm9200_ssc2_device; | ||
777 | configure_ssc2_pins(pins); | ||
778 | at91_clock_associate("ssc2_clk", &pdev->dev, "ssc"); | ||
779 | break; | ||
780 | default: | ||
781 | return; | ||
782 | } | ||
783 | |||
784 | platform_device_register(pdev); | ||
631 | } | 785 | } |
786 | |||
632 | #else | 787 | #else |
633 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 788 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} |
634 | #endif | 789 | #endif |
635 | 790 | ||
636 | 791 | ||
@@ -658,12 +813,15 @@ static struct atmel_uart_data dbgu_data = { | |||
658 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 813 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
659 | }; | 814 | }; |
660 | 815 | ||
816 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
817 | |||
661 | static struct platform_device at91rm9200_dbgu_device = { | 818 | static struct platform_device at91rm9200_dbgu_device = { |
662 | .name = "atmel_usart", | 819 | .name = "atmel_usart", |
663 | .id = 0, | 820 | .id = 0, |
664 | .dev = { | 821 | .dev = { |
665 | .platform_data = &dbgu_data, | 822 | .dma_mask = &dbgu_dmamask, |
666 | .coherent_dma_mask = 0xffffffff, | 823 | .coherent_dma_mask = DMA_BIT_MASK(32), |
824 | .platform_data = &dbgu_data, | ||
667 | }, | 825 | }, |
668 | .resource = dbgu_resources, | 826 | .resource = dbgu_resources, |
669 | .num_resources = ARRAY_SIZE(dbgu_resources), | 827 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -693,28 +851,35 @@ static struct atmel_uart_data uart0_data = { | |||
693 | .use_dma_rx = 1, | 851 | .use_dma_rx = 1, |
694 | }; | 852 | }; |
695 | 853 | ||
854 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
855 | |||
696 | static struct platform_device at91rm9200_uart0_device = { | 856 | static struct platform_device at91rm9200_uart0_device = { |
697 | .name = "atmel_usart", | 857 | .name = "atmel_usart", |
698 | .id = 1, | 858 | .id = 1, |
699 | .dev = { | 859 | .dev = { |
700 | .platform_data = &uart0_data, | 860 | .dma_mask = &uart0_dmamask, |
701 | .coherent_dma_mask = 0xffffffff, | 861 | .coherent_dma_mask = DMA_BIT_MASK(32), |
862 | .platform_data = &uart0_data, | ||
702 | }, | 863 | }, |
703 | .resource = uart0_resources, | 864 | .resource = uart0_resources, |
704 | .num_resources = ARRAY_SIZE(uart0_resources), | 865 | .num_resources = ARRAY_SIZE(uart0_resources), |
705 | }; | 866 | }; |
706 | 867 | ||
707 | static inline void configure_usart0_pins(void) | 868 | static inline void configure_usart0_pins(unsigned pins) |
708 | { | 869 | { |
709 | at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ | 870 | at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ |
710 | at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ | 871 | at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ |
711 | at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */ | ||
712 | 872 | ||
713 | /* | 873 | if (pins & ATMEL_UART_CTS) |
714 | * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. | 874 | at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */ |
715 | * We need to drive the pin manually. Default is off (RTS is active low). | 875 | |
716 | */ | 876 | if (pins & ATMEL_UART_RTS) { |
717 | at91_set_gpio_output(AT91_PIN_PA21, 1); | 877 | /* |
878 | * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. | ||
879 | * We need to drive the pin manually. Default is off (RTS is active low). | ||
880 | */ | ||
881 | at91_set_gpio_output(AT91_PIN_PA21, 1); | ||
882 | } | ||
718 | } | 883 | } |
719 | 884 | ||
720 | static struct resource uart1_resources[] = { | 885 | static struct resource uart1_resources[] = { |
@@ -735,27 +900,37 @@ static struct atmel_uart_data uart1_data = { | |||
735 | .use_dma_rx = 1, | 900 | .use_dma_rx = 1, |
736 | }; | 901 | }; |
737 | 902 | ||
903 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
904 | |||
738 | static struct platform_device at91rm9200_uart1_device = { | 905 | static struct platform_device at91rm9200_uart1_device = { |
739 | .name = "atmel_usart", | 906 | .name = "atmel_usart", |
740 | .id = 2, | 907 | .id = 2, |
741 | .dev = { | 908 | .dev = { |
742 | .platform_data = &uart1_data, | 909 | .dma_mask = &uart1_dmamask, |
743 | .coherent_dma_mask = 0xffffffff, | 910 | .coherent_dma_mask = DMA_BIT_MASK(32), |
911 | .platform_data = &uart1_data, | ||
744 | }, | 912 | }, |
745 | .resource = uart1_resources, | 913 | .resource = uart1_resources, |
746 | .num_resources = ARRAY_SIZE(uart1_resources), | 914 | .num_resources = ARRAY_SIZE(uart1_resources), |
747 | }; | 915 | }; |
748 | 916 | ||
749 | static inline void configure_usart1_pins(void) | 917 | static inline void configure_usart1_pins(unsigned pins) |
750 | { | 918 | { |
751 | at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */ | ||
752 | at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */ | ||
753 | at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */ | 919 | at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */ |
754 | at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */ | 920 | at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */ |
755 | at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */ | 921 | |
756 | at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */ | 922 | if (pins & ATMEL_UART_RI) |
757 | at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */ | 923 | at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */ |
758 | at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */ | 924 | if (pins & ATMEL_UART_DTR) |
925 | at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */ | ||
926 | if (pins & ATMEL_UART_DCD) | ||
927 | at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */ | ||
928 | if (pins & ATMEL_UART_CTS) | ||
929 | at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */ | ||
930 | if (pins & ATMEL_UART_DSR) | ||
931 | at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */ | ||
932 | if (pins & ATMEL_UART_RTS) | ||
933 | at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */ | ||
759 | } | 934 | } |
760 | 935 | ||
761 | static struct resource uart2_resources[] = { | 936 | static struct resource uart2_resources[] = { |
@@ -776,21 +951,29 @@ static struct atmel_uart_data uart2_data = { | |||
776 | .use_dma_rx = 1, | 951 | .use_dma_rx = 1, |
777 | }; | 952 | }; |
778 | 953 | ||
954 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
955 | |||
779 | static struct platform_device at91rm9200_uart2_device = { | 956 | static struct platform_device at91rm9200_uart2_device = { |
780 | .name = "atmel_usart", | 957 | .name = "atmel_usart", |
781 | .id = 3, | 958 | .id = 3, |
782 | .dev = { | 959 | .dev = { |
783 | .platform_data = &uart2_data, | 960 | .dma_mask = &uart2_dmamask, |
784 | .coherent_dma_mask = 0xffffffff, | 961 | .coherent_dma_mask = DMA_BIT_MASK(32), |
962 | .platform_data = &uart2_data, | ||
785 | }, | 963 | }, |
786 | .resource = uart2_resources, | 964 | .resource = uart2_resources, |
787 | .num_resources = ARRAY_SIZE(uart2_resources), | 965 | .num_resources = ARRAY_SIZE(uart2_resources), |
788 | }; | 966 | }; |
789 | 967 | ||
790 | static inline void configure_usart2_pins(void) | 968 | static inline void configure_usart2_pins(unsigned pins) |
791 | { | 969 | { |
792 | at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */ | 970 | at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */ |
793 | at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */ | 971 | at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */ |
972 | |||
973 | if (pins & ATMEL_UART_CTS) | ||
974 | at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */ | ||
975 | if (pins & ATMEL_UART_RTS) | ||
976 | at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */ | ||
794 | } | 977 | } |
795 | 978 | ||
796 | static struct resource uart3_resources[] = { | 979 | static struct resource uart3_resources[] = { |
@@ -811,27 +994,35 @@ static struct atmel_uart_data uart3_data = { | |||
811 | .use_dma_rx = 1, | 994 | .use_dma_rx = 1, |
812 | }; | 995 | }; |
813 | 996 | ||
997 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | ||
998 | |||
814 | static struct platform_device at91rm9200_uart3_device = { | 999 | static struct platform_device at91rm9200_uart3_device = { |
815 | .name = "atmel_usart", | 1000 | .name = "atmel_usart", |
816 | .id = 4, | 1001 | .id = 4, |
817 | .dev = { | 1002 | .dev = { |
818 | .platform_data = &uart3_data, | 1003 | .dma_mask = &uart3_dmamask, |
819 | .coherent_dma_mask = 0xffffffff, | 1004 | .coherent_dma_mask = DMA_BIT_MASK(32), |
1005 | .platform_data = &uart3_data, | ||
820 | }, | 1006 | }, |
821 | .resource = uart3_resources, | 1007 | .resource = uart3_resources, |
822 | .num_resources = ARRAY_SIZE(uart3_resources), | 1008 | .num_resources = ARRAY_SIZE(uart3_resources), |
823 | }; | 1009 | }; |
824 | 1010 | ||
825 | static inline void configure_usart3_pins(void) | 1011 | static inline void configure_usart3_pins(unsigned pins) |
826 | { | 1012 | { |
827 | at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */ | 1013 | at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */ |
828 | at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */ | 1014 | at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */ |
1015 | |||
1016 | if (pins & ATMEL_UART_CTS) | ||
1017 | at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */ | ||
1018 | if (pins & ATMEL_UART_RTS) | ||
1019 | at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */ | ||
829 | } | 1020 | } |
830 | 1021 | ||
831 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1022 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
832 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 1023 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
833 | 1024 | ||
834 | void __init at91_init_serial(struct at91_uart_config *config) | 1025 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
835 | { | 1026 | { |
836 | int i; | 1027 | int i; |
837 | 1028 | ||
@@ -839,22 +1030,22 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
839 | for (i = 0; i < config->nr_tty; i++) { | 1030 | for (i = 0; i < config->nr_tty; i++) { |
840 | switch (config->tty_map[i]) { | 1031 | switch (config->tty_map[i]) { |
841 | case 0: | 1032 | case 0: |
842 | configure_usart0_pins(); | 1033 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
843 | at91_uarts[i] = &at91rm9200_uart0_device; | 1034 | at91_uarts[i] = &at91rm9200_uart0_device; |
844 | at91_clock_associate("usart0_clk", &at91rm9200_uart0_device.dev, "usart"); | 1035 | at91_clock_associate("usart0_clk", &at91rm9200_uart0_device.dev, "usart"); |
845 | break; | 1036 | break; |
846 | case 1: | 1037 | case 1: |
847 | configure_usart1_pins(); | 1038 | configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI); |
848 | at91_uarts[i] = &at91rm9200_uart1_device; | 1039 | at91_uarts[i] = &at91rm9200_uart1_device; |
849 | at91_clock_associate("usart1_clk", &at91rm9200_uart1_device.dev, "usart"); | 1040 | at91_clock_associate("usart1_clk", &at91rm9200_uart1_device.dev, "usart"); |
850 | break; | 1041 | break; |
851 | case 2: | 1042 | case 2: |
852 | configure_usart2_pins(); | 1043 | configure_usart2_pins(0); |
853 | at91_uarts[i] = &at91rm9200_uart2_device; | 1044 | at91_uarts[i] = &at91rm9200_uart2_device; |
854 | at91_clock_associate("usart2_clk", &at91rm9200_uart2_device.dev, "usart"); | 1045 | at91_clock_associate("usart2_clk", &at91rm9200_uart2_device.dev, "usart"); |
855 | break; | 1046 | break; |
856 | case 3: | 1047 | case 3: |
857 | configure_usart3_pins(); | 1048 | configure_usart3_pins(0); |
858 | at91_uarts[i] = &at91rm9200_uart3_device; | 1049 | at91_uarts[i] = &at91rm9200_uart3_device; |
859 | at91_clock_associate("usart3_clk", &at91rm9200_uart3_device.dev, "usart"); | 1050 | at91_clock_associate("usart3_clk", &at91rm9200_uart3_device.dev, "usart"); |
860 | break; | 1051 | break; |
@@ -876,6 +1067,53 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
876 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 1067 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
877 | } | 1068 | } |
878 | 1069 | ||
1070 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
1071 | { | ||
1072 | struct platform_device *pdev; | ||
1073 | |||
1074 | switch (id) { | ||
1075 | case 0: /* DBGU */ | ||
1076 | pdev = &at91rm9200_dbgu_device; | ||
1077 | configure_dbgu_pins(); | ||
1078 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
1079 | break; | ||
1080 | case AT91RM9200_ID_US0: | ||
1081 | pdev = &at91rm9200_uart0_device; | ||
1082 | configure_usart0_pins(pins); | ||
1083 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
1084 | break; | ||
1085 | case AT91RM9200_ID_US1: | ||
1086 | pdev = &at91rm9200_uart1_device; | ||
1087 | configure_usart1_pins(pins); | ||
1088 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
1089 | break; | ||
1090 | case AT91RM9200_ID_US2: | ||
1091 | pdev = &at91rm9200_uart2_device; | ||
1092 | configure_usart2_pins(pins); | ||
1093 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
1094 | break; | ||
1095 | case AT91RM9200_ID_US3: | ||
1096 | pdev = &at91rm9200_uart3_device; | ||
1097 | configure_usart3_pins(pins); | ||
1098 | at91_clock_associate("usart3_clk", &pdev->dev, "usart"); | ||
1099 | break; | ||
1100 | default: | ||
1101 | return; | ||
1102 | } | ||
1103 | pdev->id = portnr; /* update to mapped ID */ | ||
1104 | |||
1105 | if (portnr < ATMEL_MAX_UART) | ||
1106 | at91_uarts[portnr] = pdev; | ||
1107 | } | ||
1108 | |||
1109 | void __init at91_set_serial_console(unsigned portnr) | ||
1110 | { | ||
1111 | if (portnr < ATMEL_MAX_UART) | ||
1112 | atmel_default_console_device = at91_uarts[portnr]; | ||
1113 | if (!atmel_default_console_device) | ||
1114 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1115 | } | ||
1116 | |||
879 | void __init at91_add_device_serial(void) | 1117 | void __init at91_add_device_serial(void) |
880 | { | 1118 | { |
881 | int i; | 1119 | int i; |
@@ -886,7 +1124,9 @@ void __init at91_add_device_serial(void) | |||
886 | } | 1124 | } |
887 | } | 1125 | } |
888 | #else | 1126 | #else |
889 | void __init at91_init_serial(struct at91_uart_config *config) {} | 1127 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} |
1128 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1129 | void __init at91_set_serial_console(unsigned portnr) {} | ||
890 | void __init at91_add_device_serial(void) {} | 1130 | void __init at91_add_device_serial(void) {} |
891 | #endif | 1131 | #endif |
892 | 1132 | ||
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index e47381e8aaba..18d06612ce8a 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
@@ -327,30 +327,30 @@ void __init at91sam9260_initialize(unsigned long main_clock) | |||
327 | static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { | 327 | static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { |
328 | 7, /* Advanced Interrupt Controller */ | 328 | 7, /* Advanced Interrupt Controller */ |
329 | 7, /* System Peripherals */ | 329 | 7, /* System Peripherals */ |
330 | 0, /* Parallel IO Controller A */ | 330 | 1, /* Parallel IO Controller A */ |
331 | 0, /* Parallel IO Controller B */ | 331 | 1, /* Parallel IO Controller B */ |
332 | 0, /* Parallel IO Controller C */ | 332 | 1, /* Parallel IO Controller C */ |
333 | 0, /* Analog-to-Digital Converter */ | 333 | 0, /* Analog-to-Digital Converter */ |
334 | 6, /* USART 0 */ | 334 | 5, /* USART 0 */ |
335 | 6, /* USART 1 */ | 335 | 5, /* USART 1 */ |
336 | 6, /* USART 2 */ | 336 | 5, /* USART 2 */ |
337 | 0, /* Multimedia Card Interface */ | 337 | 0, /* Multimedia Card Interface */ |
338 | 4, /* USB Device Port */ | 338 | 2, /* USB Device Port */ |
339 | 0, /* Two-Wire Interface */ | 339 | 6, /* Two-Wire Interface */ |
340 | 6, /* Serial Peripheral Interface 0 */ | 340 | 5, /* Serial Peripheral Interface 0 */ |
341 | 6, /* Serial Peripheral Interface 1 */ | 341 | 5, /* Serial Peripheral Interface 1 */ |
342 | 5, /* Serial Synchronous Controller */ | 342 | 5, /* Serial Synchronous Controller */ |
343 | 0, | 343 | 0, |
344 | 0, | 344 | 0, |
345 | 0, /* Timer Counter 0 */ | 345 | 0, /* Timer Counter 0 */ |
346 | 0, /* Timer Counter 1 */ | 346 | 0, /* Timer Counter 1 */ |
347 | 0, /* Timer Counter 2 */ | 347 | 0, /* Timer Counter 2 */ |
348 | 3, /* USB Host port */ | 348 | 2, /* USB Host port */ |
349 | 3, /* Ethernet */ | 349 | 3, /* Ethernet */ |
350 | 0, /* Image Sensor Interface */ | 350 | 0, /* Image Sensor Interface */ |
351 | 6, /* USART 3 */ | 351 | 5, /* USART 3 */ |
352 | 6, /* USART 4 */ | 352 | 5, /* USART 4 */ |
353 | 6, /* USART 5 */ | 353 | 5, /* USART 5 */ |
354 | 0, /* Timer Counter 3 */ | 354 | 0, /* Timer Counter 3 */ |
355 | 0, /* Timer Counter 4 */ | 355 | 0, /* Timer Counter 4 */ |
356 | 0, /* Timer Counter 5 */ | 356 | 0, /* Timer Counter 5 */ |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 3091bf47d8c9..105f8403860b 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/mach/arch.h> | 12 | #include <asm/mach/arch.h> |
13 | #include <asm/mach/map.h> | 13 | #include <asm/mach/map.h> |
14 | 14 | ||
15 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
16 | #include <linux/i2c-gpio.h> | 17 | #include <linux/i2c-gpio.h> |
17 | 18 | ||
@@ -29,7 +30,7 @@ | |||
29 | * -------------------------------------------------------------------- */ | 30 | * -------------------------------------------------------------------- */ |
30 | 31 | ||
31 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 32 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
32 | static u64 ohci_dmamask = 0xffffffffUL; | 33 | static u64 ohci_dmamask = DMA_BIT_MASK(32); |
33 | static struct at91_usbh_data usbh_data; | 34 | static struct at91_usbh_data usbh_data; |
34 | 35 | ||
35 | static struct resource usbh_resources[] = { | 36 | static struct resource usbh_resources[] = { |
@@ -50,7 +51,7 @@ static struct platform_device at91_usbh_device = { | |||
50 | .id = -1, | 51 | .id = -1, |
51 | .dev = { | 52 | .dev = { |
52 | .dma_mask = &ohci_dmamask, | 53 | .dma_mask = &ohci_dmamask, |
53 | .coherent_dma_mask = 0xffffffff, | 54 | .coherent_dma_mask = DMA_BIT_MASK(32), |
54 | .platform_data = &usbh_data, | 55 | .platform_data = &usbh_data, |
55 | }, | 56 | }, |
56 | .resource = usbh_resources, | 57 | .resource = usbh_resources, |
@@ -125,7 +126,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
125 | * -------------------------------------------------------------------- */ | 126 | * -------------------------------------------------------------------- */ |
126 | 127 | ||
127 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 128 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
128 | static u64 eth_dmamask = 0xffffffffUL; | 129 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
129 | static struct at91_eth_data eth_data; | 130 | static struct at91_eth_data eth_data; |
130 | 131 | ||
131 | static struct resource eth_resources[] = { | 132 | static struct resource eth_resources[] = { |
@@ -146,7 +147,7 @@ static struct platform_device at91sam9260_eth_device = { | |||
146 | .id = -1, | 147 | .id = -1, |
147 | .dev = { | 148 | .dev = { |
148 | .dma_mask = ð_dmamask, | 149 | .dma_mask = ð_dmamask, |
149 | .coherent_dma_mask = 0xffffffff, | 150 | .coherent_dma_mask = DMA_BIT_MASK(32), |
150 | .platform_data = ð_data, | 151 | .platform_data = ð_data, |
151 | }, | 152 | }, |
152 | .resource = eth_resources, | 153 | .resource = eth_resources, |
@@ -199,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {} | |||
199 | * -------------------------------------------------------------------- */ | 200 | * -------------------------------------------------------------------- */ |
200 | 201 | ||
201 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 202 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
202 | static u64 mmc_dmamask = 0xffffffffUL; | 203 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
203 | static struct at91_mmc_data mmc_data; | 204 | static struct at91_mmc_data mmc_data; |
204 | 205 | ||
205 | static struct resource mmc_resources[] = { | 206 | static struct resource mmc_resources[] = { |
@@ -220,7 +221,7 @@ static struct platform_device at91sam9260_mmc_device = { | |||
220 | .id = -1, | 221 | .id = -1, |
221 | .dev = { | 222 | .dev = { |
222 | .dma_mask = &mmc_dmamask, | 223 | .dma_mask = &mmc_dmamask, |
223 | .coherent_dma_mask = 0xffffffff, | 224 | .coherent_dma_mask = DMA_BIT_MASK(32), |
224 | .platform_data = &mmc_data, | 225 | .platform_data = &mmc_data, |
225 | }, | 226 | }, |
226 | .resource = mmc_resources, | 227 | .resource = mmc_resources, |
@@ -289,7 +290,7 @@ static struct at91_nand_data nand_data; | |||
289 | static struct resource nand_resources[] = { | 290 | static struct resource nand_resources[] = { |
290 | { | 291 | { |
291 | .start = NAND_BASE, | 292 | .start = NAND_BASE, |
292 | .end = NAND_BASE + SZ_8M - 1, | 293 | .end = NAND_BASE + SZ_256M - 1, |
293 | .flags = IORESOURCE_MEM, | 294 | .flags = IORESOURCE_MEM, |
294 | } | 295 | } |
295 | }; | 296 | }; |
@@ -312,7 +313,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
312 | return; | 313 | return; |
313 | 314 | ||
314 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | 315 | csa = at91_sys_read(AT91_MATRIX_EBICSA); |
315 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); | 316 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
316 | 317 | ||
317 | /* set the bus interface characteristics */ | 318 | /* set the bus interface characteristics */ |
318 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) | 319 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
@@ -431,7 +432,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
431 | * -------------------------------------------------------------------- */ | 432 | * -------------------------------------------------------------------- */ |
432 | 433 | ||
433 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 434 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
434 | static u64 spi_dmamask = 0xffffffffUL; | 435 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
435 | 436 | ||
436 | static struct resource spi0_resources[] = { | 437 | static struct resource spi0_resources[] = { |
437 | [0] = { | 438 | [0] = { |
@@ -451,7 +452,7 @@ static struct platform_device at91sam9260_spi0_device = { | |||
451 | .id = 0, | 452 | .id = 0, |
452 | .dev = { | 453 | .dev = { |
453 | .dma_mask = &spi_dmamask, | 454 | .dma_mask = &spi_dmamask, |
454 | .coherent_dma_mask = 0xffffffff, | 455 | .coherent_dma_mask = DMA_BIT_MASK(32), |
455 | }, | 456 | }, |
456 | .resource = spi0_resources, | 457 | .resource = spi0_resources, |
457 | .num_resources = ARRAY_SIZE(spi0_resources), | 458 | .num_resources = ARRAY_SIZE(spi0_resources), |
@@ -477,7 +478,7 @@ static struct platform_device at91sam9260_spi1_device = { | |||
477 | .id = 1, | 478 | .id = 1, |
478 | .dev = { | 479 | .dev = { |
479 | .dma_mask = &spi_dmamask, | 480 | .dma_mask = &spi_dmamask, |
480 | .coherent_dma_mask = 0xffffffff, | 481 | .coherent_dma_mask = DMA_BIT_MASK(32), |
481 | }, | 482 | }, |
482 | .resource = spi1_resources, | 483 | .resource = spi1_resources, |
483 | .num_resources = ARRAY_SIZE(spi1_resources), | 484 | .num_resources = ARRAY_SIZE(spi1_resources), |
@@ -539,24 +540,126 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
539 | 540 | ||
540 | 541 | ||
541 | /* -------------------------------------------------------------------- | 542 | /* -------------------------------------------------------------------- |
542 | * LEDs | 543 | * RTT |
543 | * -------------------------------------------------------------------- */ | 544 | * -------------------------------------------------------------------- */ |
544 | 545 | ||
545 | #if defined(CONFIG_LEDS) | 546 | static struct resource rtt_resources[] = { |
546 | u8 at91_leds_cpu; | 547 | { |
547 | u8 at91_leds_timer; | 548 | .start = AT91_BASE_SYS + AT91_RTT, |
549 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
550 | .flags = IORESOURCE_MEM, | ||
551 | } | ||
552 | }; | ||
548 | 553 | ||
549 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 554 | static struct platform_device at91sam9260_rtt_device = { |
555 | .name = "at91_rtt", | ||
556 | .id = -1, | ||
557 | .resource = rtt_resources, | ||
558 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
559 | }; | ||
560 | |||
561 | static void __init at91_add_device_rtt(void) | ||
550 | { | 562 | { |
551 | /* Enable GPIO to access the LEDs */ | 563 | platform_device_register(&at91sam9260_rtt_device); |
552 | at91_set_gpio_output(cpu_led, 1); | 564 | } |
553 | at91_set_gpio_output(timer_led, 1); | 565 | |
554 | 566 | ||
555 | at91_leds_cpu = cpu_led; | 567 | /* -------------------------------------------------------------------- |
556 | at91_leds_timer = timer_led; | 568 | * Watchdog |
569 | * -------------------------------------------------------------------- */ | ||
570 | |||
571 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
572 | static struct platform_device at91sam9260_wdt_device = { | ||
573 | .name = "at91_wdt", | ||
574 | .id = -1, | ||
575 | .num_resources = 0, | ||
576 | }; | ||
577 | |||
578 | static void __init at91_add_device_watchdog(void) | ||
579 | { | ||
580 | platform_device_register(&at91sam9260_wdt_device); | ||
557 | } | 581 | } |
558 | #else | 582 | #else |
559 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 583 | static void __init at91_add_device_watchdog(void) {} |
584 | #endif | ||
585 | |||
586 | |||
587 | /* -------------------------------------------------------------------- | ||
588 | * SSC -- Synchronous Serial Controller | ||
589 | * -------------------------------------------------------------------- */ | ||
590 | |||
591 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
592 | static u64 ssc_dmamask = DMA_BIT_MASK(32); | ||
593 | |||
594 | static struct resource ssc_resources[] = { | ||
595 | [0] = { | ||
596 | .start = AT91SAM9260_BASE_SSC, | ||
597 | .end = AT91SAM9260_BASE_SSC + SZ_16K - 1, | ||
598 | .flags = IORESOURCE_MEM, | ||
599 | }, | ||
600 | [1] = { | ||
601 | .start = AT91SAM9260_ID_SSC, | ||
602 | .end = AT91SAM9260_ID_SSC, | ||
603 | .flags = IORESOURCE_IRQ, | ||
604 | }, | ||
605 | }; | ||
606 | |||
607 | static struct platform_device at91sam9260_ssc_device = { | ||
608 | .name = "ssc", | ||
609 | .id = 0, | ||
610 | .dev = { | ||
611 | .dma_mask = &ssc_dmamask, | ||
612 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
613 | }, | ||
614 | .resource = ssc_resources, | ||
615 | .num_resources = ARRAY_SIZE(ssc_resources), | ||
616 | }; | ||
617 | |||
618 | static inline void configure_ssc_pins(unsigned pins) | ||
619 | { | ||
620 | if (pins & ATMEL_SSC_TF) | ||
621 | at91_set_A_periph(AT91_PIN_PB17, 1); | ||
622 | if (pins & ATMEL_SSC_TK) | ||
623 | at91_set_A_periph(AT91_PIN_PB16, 1); | ||
624 | if (pins & ATMEL_SSC_TD) | ||
625 | at91_set_A_periph(AT91_PIN_PB18, 1); | ||
626 | if (pins & ATMEL_SSC_RD) | ||
627 | at91_set_A_periph(AT91_PIN_PB19, 1); | ||
628 | if (pins & ATMEL_SSC_RK) | ||
629 | at91_set_A_periph(AT91_PIN_PB20, 1); | ||
630 | if (pins & ATMEL_SSC_RF) | ||
631 | at91_set_A_periph(AT91_PIN_PB21, 1); | ||
632 | } | ||
633 | |||
634 | /* | ||
635 | * SSC controllers are accessed through library code, instead of any | ||
636 | * kind of all-singing/all-dancing driver. For example one could be | ||
637 | * used by a particular I2S audio codec's driver, while another one | ||
638 | * on the same system might be used by a custom data capture driver. | ||
639 | */ | ||
640 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
641 | { | ||
642 | struct platform_device *pdev; | ||
643 | |||
644 | /* | ||
645 | * NOTE: caller is responsible for passing information matching | ||
646 | * "pins" to whatever will be using each particular controller. | ||
647 | */ | ||
648 | switch (id) { | ||
649 | case AT91SAM9260_ID_SSC: | ||
650 | pdev = &at91sam9260_ssc_device; | ||
651 | configure_ssc_pins(pins); | ||
652 | at91_clock_associate("ssc_clk", &pdev->dev, "pclk"); | ||
653 | break; | ||
654 | default: | ||
655 | return; | ||
656 | } | ||
657 | |||
658 | platform_device_register(pdev); | ||
659 | } | ||
660 | |||
661 | #else | ||
662 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
560 | #endif | 663 | #endif |
561 | 664 | ||
562 | 665 | ||
@@ -583,12 +686,15 @@ static struct atmel_uart_data dbgu_data = { | |||
583 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 686 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
584 | }; | 687 | }; |
585 | 688 | ||
689 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
690 | |||
586 | static struct platform_device at91sam9260_dbgu_device = { | 691 | static struct platform_device at91sam9260_dbgu_device = { |
587 | .name = "atmel_usart", | 692 | .name = "atmel_usart", |
588 | .id = 0, | 693 | .id = 0, |
589 | .dev = { | 694 | .dev = { |
590 | .platform_data = &dbgu_data, | 695 | .dma_mask = &dbgu_dmamask, |
591 | .coherent_dma_mask = 0xffffffff, | 696 | .coherent_dma_mask = DMA_BIT_MASK(32), |
697 | .platform_data = &dbgu_data, | ||
592 | }, | 698 | }, |
593 | .resource = dbgu_resources, | 699 | .resource = dbgu_resources, |
594 | .num_resources = ARRAY_SIZE(dbgu_resources), | 700 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -618,27 +724,37 @@ static struct atmel_uart_data uart0_data = { | |||
618 | .use_dma_rx = 1, | 724 | .use_dma_rx = 1, |
619 | }; | 725 | }; |
620 | 726 | ||
727 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
728 | |||
621 | static struct platform_device at91sam9260_uart0_device = { | 729 | static struct platform_device at91sam9260_uart0_device = { |
622 | .name = "atmel_usart", | 730 | .name = "atmel_usart", |
623 | .id = 1, | 731 | .id = 1, |
624 | .dev = { | 732 | .dev = { |
625 | .platform_data = &uart0_data, | 733 | .dma_mask = &uart0_dmamask, |
626 | .coherent_dma_mask = 0xffffffff, | 734 | .coherent_dma_mask = DMA_BIT_MASK(32), |
735 | .platform_data = &uart0_data, | ||
627 | }, | 736 | }, |
628 | .resource = uart0_resources, | 737 | .resource = uart0_resources, |
629 | .num_resources = ARRAY_SIZE(uart0_resources), | 738 | .num_resources = ARRAY_SIZE(uart0_resources), |
630 | }; | 739 | }; |
631 | 740 | ||
632 | static inline void configure_usart0_pins(void) | 741 | static inline void configure_usart0_pins(unsigned pins) |
633 | { | 742 | { |
634 | at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ | 743 | at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ |
635 | at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ | 744 | at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ |
636 | at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */ | 745 | |
637 | at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */ | 746 | if (pins & ATMEL_UART_RTS) |
638 | at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */ | 747 | at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */ |
639 | at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */ | 748 | if (pins & ATMEL_UART_CTS) |
640 | at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */ | 749 | at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */ |
641 | at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */ | 750 | if (pins & ATMEL_UART_DTR) |
751 | at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */ | ||
752 | if (pins & ATMEL_UART_DSR) | ||
753 | at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */ | ||
754 | if (pins & ATMEL_UART_DCD) | ||
755 | at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */ | ||
756 | if (pins & ATMEL_UART_RI) | ||
757 | at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */ | ||
642 | } | 758 | } |
643 | 759 | ||
644 | static struct resource uart1_resources[] = { | 760 | static struct resource uart1_resources[] = { |
@@ -659,23 +775,29 @@ static struct atmel_uart_data uart1_data = { | |||
659 | .use_dma_rx = 1, | 775 | .use_dma_rx = 1, |
660 | }; | 776 | }; |
661 | 777 | ||
778 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
779 | |||
662 | static struct platform_device at91sam9260_uart1_device = { | 780 | static struct platform_device at91sam9260_uart1_device = { |
663 | .name = "atmel_usart", | 781 | .name = "atmel_usart", |
664 | .id = 2, | 782 | .id = 2, |
665 | .dev = { | 783 | .dev = { |
666 | .platform_data = &uart1_data, | 784 | .dma_mask = &uart1_dmamask, |
667 | .coherent_dma_mask = 0xffffffff, | 785 | .coherent_dma_mask = DMA_BIT_MASK(32), |
786 | .platform_data = &uart1_data, | ||
668 | }, | 787 | }, |
669 | .resource = uart1_resources, | 788 | .resource = uart1_resources, |
670 | .num_resources = ARRAY_SIZE(uart1_resources), | 789 | .num_resources = ARRAY_SIZE(uart1_resources), |
671 | }; | 790 | }; |
672 | 791 | ||
673 | static inline void configure_usart1_pins(void) | 792 | static inline void configure_usart1_pins(unsigned pins) |
674 | { | 793 | { |
675 | at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ | 794 | at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ |
676 | at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ | 795 | at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ |
677 | at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */ | 796 | |
678 | at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */ | 797 | if (pins & ATMEL_UART_RTS) |
798 | at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */ | ||
799 | if (pins & ATMEL_UART_CTS) | ||
800 | at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */ | ||
679 | } | 801 | } |
680 | 802 | ||
681 | static struct resource uart2_resources[] = { | 803 | static struct resource uart2_resources[] = { |
@@ -696,21 +818,29 @@ static struct atmel_uart_data uart2_data = { | |||
696 | .use_dma_rx = 1, | 818 | .use_dma_rx = 1, |
697 | }; | 819 | }; |
698 | 820 | ||
821 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
822 | |||
699 | static struct platform_device at91sam9260_uart2_device = { | 823 | static struct platform_device at91sam9260_uart2_device = { |
700 | .name = "atmel_usart", | 824 | .name = "atmel_usart", |
701 | .id = 3, | 825 | .id = 3, |
702 | .dev = { | 826 | .dev = { |
703 | .platform_data = &uart2_data, | 827 | .dma_mask = &uart2_dmamask, |
704 | .coherent_dma_mask = 0xffffffff, | 828 | .coherent_dma_mask = DMA_BIT_MASK(32), |
829 | .platform_data = &uart2_data, | ||
705 | }, | 830 | }, |
706 | .resource = uart2_resources, | 831 | .resource = uart2_resources, |
707 | .num_resources = ARRAY_SIZE(uart2_resources), | 832 | .num_resources = ARRAY_SIZE(uart2_resources), |
708 | }; | 833 | }; |
709 | 834 | ||
710 | static inline void configure_usart2_pins(void) | 835 | static inline void configure_usart2_pins(unsigned pins) |
711 | { | 836 | { |
712 | at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ | 837 | at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ |
713 | at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ | 838 | at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ |
839 | |||
840 | if (pins & ATMEL_UART_RTS) | ||
841 | at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */ | ||
842 | if (pins & ATMEL_UART_CTS) | ||
843 | at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */ | ||
714 | } | 844 | } |
715 | 845 | ||
716 | static struct resource uart3_resources[] = { | 846 | static struct resource uart3_resources[] = { |
@@ -731,21 +861,29 @@ static struct atmel_uart_data uart3_data = { | |||
731 | .use_dma_rx = 1, | 861 | .use_dma_rx = 1, |
732 | }; | 862 | }; |
733 | 863 | ||
864 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | ||
865 | |||
734 | static struct platform_device at91sam9260_uart3_device = { | 866 | static struct platform_device at91sam9260_uart3_device = { |
735 | .name = "atmel_usart", | 867 | .name = "atmel_usart", |
736 | .id = 4, | 868 | .id = 4, |
737 | .dev = { | 869 | .dev = { |
738 | .platform_data = &uart3_data, | 870 | .dma_mask = &uart3_dmamask, |
739 | .coherent_dma_mask = 0xffffffff, | 871 | .coherent_dma_mask = DMA_BIT_MASK(32), |
872 | .platform_data = &uart3_data, | ||
740 | }, | 873 | }, |
741 | .resource = uart3_resources, | 874 | .resource = uart3_resources, |
742 | .num_resources = ARRAY_SIZE(uart3_resources), | 875 | .num_resources = ARRAY_SIZE(uart3_resources), |
743 | }; | 876 | }; |
744 | 877 | ||
745 | static inline void configure_usart3_pins(void) | 878 | static inline void configure_usart3_pins(unsigned pins) |
746 | { | 879 | { |
747 | at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */ | 880 | at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */ |
748 | at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */ | 881 | at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */ |
882 | |||
883 | if (pins & ATMEL_UART_RTS) | ||
884 | at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */ | ||
885 | if (pins & ATMEL_UART_CTS) | ||
886 | at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */ | ||
749 | } | 887 | } |
750 | 888 | ||
751 | static struct resource uart4_resources[] = { | 889 | static struct resource uart4_resources[] = { |
@@ -766,12 +904,15 @@ static struct atmel_uart_data uart4_data = { | |||
766 | .use_dma_rx = 1, | 904 | .use_dma_rx = 1, |
767 | }; | 905 | }; |
768 | 906 | ||
907 | static u64 uart4_dmamask = DMA_BIT_MASK(32); | ||
908 | |||
769 | static struct platform_device at91sam9260_uart4_device = { | 909 | static struct platform_device at91sam9260_uart4_device = { |
770 | .name = "atmel_usart", | 910 | .name = "atmel_usart", |
771 | .id = 5, | 911 | .id = 5, |
772 | .dev = { | 912 | .dev = { |
773 | .platform_data = &uart4_data, | 913 | .dma_mask = &uart4_dmamask, |
774 | .coherent_dma_mask = 0xffffffff, | 914 | .coherent_dma_mask = DMA_BIT_MASK(32), |
915 | .platform_data = &uart4_data, | ||
775 | }, | 916 | }, |
776 | .resource = uart4_resources, | 917 | .resource = uart4_resources, |
777 | .num_resources = ARRAY_SIZE(uart4_resources), | 918 | .num_resources = ARRAY_SIZE(uart4_resources), |
@@ -801,12 +942,15 @@ static struct atmel_uart_data uart5_data = { | |||
801 | .use_dma_rx = 1, | 942 | .use_dma_rx = 1, |
802 | }; | 943 | }; |
803 | 944 | ||
945 | static u64 uart5_dmamask = DMA_BIT_MASK(32); | ||
946 | |||
804 | static struct platform_device at91sam9260_uart5_device = { | 947 | static struct platform_device at91sam9260_uart5_device = { |
805 | .name = "atmel_usart", | 948 | .name = "atmel_usart", |
806 | .id = 6, | 949 | .id = 6, |
807 | .dev = { | 950 | .dev = { |
808 | .platform_data = &uart5_data, | 951 | .dma_mask = &uart5_dmamask, |
809 | .coherent_dma_mask = 0xffffffff, | 952 | .coherent_dma_mask = DMA_BIT_MASK(32), |
953 | .platform_data = &uart5_data, | ||
810 | }, | 954 | }, |
811 | .resource = uart5_resources, | 955 | .resource = uart5_resources, |
812 | .num_resources = ARRAY_SIZE(uart5_resources), | 956 | .num_resources = ARRAY_SIZE(uart5_resources), |
@@ -818,10 +962,10 @@ static inline void configure_usart5_pins(void) | |||
818 | at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ | 962 | at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ |
819 | } | 963 | } |
820 | 964 | ||
821 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 965 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
822 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 966 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
823 | 967 | ||
824 | void __init at91_init_serial(struct at91_uart_config *config) | 968 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
825 | { | 969 | { |
826 | int i; | 970 | int i; |
827 | 971 | ||
@@ -829,22 +973,22 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
829 | for (i = 0; i < config->nr_tty; i++) { | 973 | for (i = 0; i < config->nr_tty; i++) { |
830 | switch (config->tty_map[i]) { | 974 | switch (config->tty_map[i]) { |
831 | case 0: | 975 | case 0: |
832 | configure_usart0_pins(); | 976 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI); |
833 | at91_uarts[i] = &at91sam9260_uart0_device; | 977 | at91_uarts[i] = &at91sam9260_uart0_device; |
834 | at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart"); | 978 | at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart"); |
835 | break; | 979 | break; |
836 | case 1: | 980 | case 1: |
837 | configure_usart1_pins(); | 981 | configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
838 | at91_uarts[i] = &at91sam9260_uart1_device; | 982 | at91_uarts[i] = &at91sam9260_uart1_device; |
839 | at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart"); | 983 | at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart"); |
840 | break; | 984 | break; |
841 | case 2: | 985 | case 2: |
842 | configure_usart2_pins(); | 986 | configure_usart2_pins(0); |
843 | at91_uarts[i] = &at91sam9260_uart2_device; | 987 | at91_uarts[i] = &at91sam9260_uart2_device; |
844 | at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart"); | 988 | at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart"); |
845 | break; | 989 | break; |
846 | case 3: | 990 | case 3: |
847 | configure_usart3_pins(); | 991 | configure_usart3_pins(0); |
848 | at91_uarts[i] = &at91sam9260_uart3_device; | 992 | at91_uarts[i] = &at91sam9260_uart3_device; |
849 | at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart"); | 993 | at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart"); |
850 | break; | 994 | break; |
@@ -876,6 +1020,63 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
876 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 1020 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
877 | } | 1021 | } |
878 | 1022 | ||
1023 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
1024 | { | ||
1025 | struct platform_device *pdev; | ||
1026 | |||
1027 | switch (id) { | ||
1028 | case 0: /* DBGU */ | ||
1029 | pdev = &at91sam9260_dbgu_device; | ||
1030 | configure_dbgu_pins(); | ||
1031 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
1032 | break; | ||
1033 | case AT91SAM9260_ID_US0: | ||
1034 | pdev = &at91sam9260_uart0_device; | ||
1035 | configure_usart0_pins(pins); | ||
1036 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
1037 | break; | ||
1038 | case AT91SAM9260_ID_US1: | ||
1039 | pdev = &at91sam9260_uart1_device; | ||
1040 | configure_usart1_pins(pins); | ||
1041 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
1042 | break; | ||
1043 | case AT91SAM9260_ID_US2: | ||
1044 | pdev = &at91sam9260_uart2_device; | ||
1045 | configure_usart2_pins(pins); | ||
1046 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
1047 | break; | ||
1048 | case AT91SAM9260_ID_US3: | ||
1049 | pdev = &at91sam9260_uart3_device; | ||
1050 | configure_usart3_pins(pins); | ||
1051 | at91_clock_associate("usart3_clk", &pdev->dev, "usart"); | ||
1052 | break; | ||
1053 | case AT91SAM9260_ID_US4: | ||
1054 | pdev = &at91sam9260_uart4_device; | ||
1055 | configure_usart4_pins(); | ||
1056 | at91_clock_associate("usart4_clk", &pdev->dev, "usart"); | ||
1057 | break; | ||
1058 | case AT91SAM9260_ID_US5: | ||
1059 | pdev = &at91sam9260_uart5_device; | ||
1060 | configure_usart5_pins(); | ||
1061 | at91_clock_associate("usart5_clk", &pdev->dev, "usart"); | ||
1062 | break; | ||
1063 | default: | ||
1064 | return; | ||
1065 | } | ||
1066 | pdev->id = portnr; /* update to mapped ID */ | ||
1067 | |||
1068 | if (portnr < ATMEL_MAX_UART) | ||
1069 | at91_uarts[portnr] = pdev; | ||
1070 | } | ||
1071 | |||
1072 | void __init at91_set_serial_console(unsigned portnr) | ||
1073 | { | ||
1074 | if (portnr < ATMEL_MAX_UART) | ||
1075 | atmel_default_console_device = at91_uarts[portnr]; | ||
1076 | if (!atmel_default_console_device) | ||
1077 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1078 | } | ||
1079 | |||
879 | void __init at91_add_device_serial(void) | 1080 | void __init at91_add_device_serial(void) |
880 | { | 1081 | { |
881 | int i; | 1082 | int i; |
@@ -886,7 +1087,9 @@ void __init at91_add_device_serial(void) | |||
886 | } | 1087 | } |
887 | } | 1088 | } |
888 | #else | 1089 | #else |
889 | void __init at91_init_serial(struct at91_uart_config *config) {} | 1090 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} |
1091 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1092 | void __init at91_set_serial_console(unsigned portnr) {} | ||
890 | void __init at91_add_device_serial(void) {} | 1093 | void __init at91_add_device_serial(void) {} |
891 | #endif | 1094 | #endif |
892 | 1095 | ||
@@ -898,6 +1101,8 @@ void __init at91_add_device_serial(void) {} | |||
898 | */ | 1101 | */ |
899 | static int __init at91_add_standard_devices(void) | 1102 | static int __init at91_add_standard_devices(void) |
900 | { | 1103 | { |
1104 | at91_add_device_rtt(); | ||
1105 | at91_add_device_watchdog(); | ||
901 | return 0; | 1106 | return 0; |
902 | } | 1107 | } |
903 | 1108 | ||
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index dfe8c39c9fb9..90b87e1877d9 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -279,25 +279,25 @@ void __init at91sam9261_initialize(unsigned long main_clock) | |||
279 | static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { | 279 | static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { |
280 | 7, /* Advanced Interrupt Controller */ | 280 | 7, /* Advanced Interrupt Controller */ |
281 | 7, /* System Peripherals */ | 281 | 7, /* System Peripherals */ |
282 | 0, /* Parallel IO Controller A */ | 282 | 1, /* Parallel IO Controller A */ |
283 | 0, /* Parallel IO Controller B */ | 283 | 1, /* Parallel IO Controller B */ |
284 | 0, /* Parallel IO Controller C */ | 284 | 1, /* Parallel IO Controller C */ |
285 | 0, | 285 | 0, |
286 | 6, /* USART 0 */ | 286 | 5, /* USART 0 */ |
287 | 6, /* USART 1 */ | 287 | 5, /* USART 1 */ |
288 | 6, /* USART 2 */ | 288 | 5, /* USART 2 */ |
289 | 0, /* Multimedia Card Interface */ | 289 | 0, /* Multimedia Card Interface */ |
290 | 4, /* USB Device Port */ | 290 | 2, /* USB Device Port */ |
291 | 0, /* Two-Wire Interface */ | 291 | 6, /* Two-Wire Interface */ |
292 | 6, /* Serial Peripheral Interface 0 */ | 292 | 5, /* Serial Peripheral Interface 0 */ |
293 | 6, /* Serial Peripheral Interface 1 */ | 293 | 5, /* Serial Peripheral Interface 1 */ |
294 | 5, /* Serial Synchronous Controller 0 */ | 294 | 4, /* Serial Synchronous Controller 0 */ |
295 | 5, /* Serial Synchronous Controller 1 */ | 295 | 4, /* Serial Synchronous Controller 1 */ |
296 | 5, /* Serial Synchronous Controller 2 */ | 296 | 4, /* Serial Synchronous Controller 2 */ |
297 | 0, /* Timer Counter 0 */ | 297 | 0, /* Timer Counter 0 */ |
298 | 0, /* Timer Counter 1 */ | 298 | 0, /* Timer Counter 1 */ |
299 | 0, /* Timer Counter 2 */ | 299 | 0, /* Timer Counter 2 */ |
300 | 3, /* USB Host port */ | 300 | 2, /* USB Host port */ |
301 | 3, /* LCD Controller */ | 301 | 3, /* LCD Controller */ |
302 | 0, | 302 | 0, |
303 | 0, | 303 | 0, |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 64979a9023c2..245641263fce 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/mach/arch.h> | 13 | #include <asm/mach/arch.h> |
14 | #include <asm/mach/map.h> | 14 | #include <asm/mach/map.h> |
15 | 15 | ||
16 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
17 | #include <linux/i2c-gpio.h> | 18 | #include <linux/i2c-gpio.h> |
18 | 19 | ||
@@ -33,7 +34,7 @@ | |||
33 | * -------------------------------------------------------------------- */ | 34 | * -------------------------------------------------------------------- */ |
34 | 35 | ||
35 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 36 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
36 | static u64 ohci_dmamask = 0xffffffffUL; | 37 | static u64 ohci_dmamask = DMA_BIT_MASK(32); |
37 | static struct at91_usbh_data usbh_data; | 38 | static struct at91_usbh_data usbh_data; |
38 | 39 | ||
39 | static struct resource usbh_resources[] = { | 40 | static struct resource usbh_resources[] = { |
@@ -54,7 +55,7 @@ static struct platform_device at91sam9261_usbh_device = { | |||
54 | .id = -1, | 55 | .id = -1, |
55 | .dev = { | 56 | .dev = { |
56 | .dma_mask = &ohci_dmamask, | 57 | .dma_mask = &ohci_dmamask, |
57 | .coherent_dma_mask = 0xffffffff, | 58 | .coherent_dma_mask = DMA_BIT_MASK(32), |
58 | .platform_data = &usbh_data, | 59 | .platform_data = &usbh_data, |
59 | }, | 60 | }, |
60 | .resource = usbh_resources, | 61 | .resource = usbh_resources, |
@@ -106,8 +107,6 @@ static struct platform_device at91sam9261_udc_device = { | |||
106 | 107 | ||
107 | void __init at91_add_device_udc(struct at91_udc_data *data) | 108 | void __init at91_add_device_udc(struct at91_udc_data *data) |
108 | { | 109 | { |
109 | unsigned long x; | ||
110 | |||
111 | if (!data) | 110 | if (!data) |
112 | return; | 111 | return; |
113 | 112 | ||
@@ -116,9 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
116 | at91_set_deglitch(data->vbus_pin, 1); | 115 | at91_set_deglitch(data->vbus_pin, 1); |
117 | } | 116 | } |
118 | 117 | ||
119 | /* Pullup pin is handled internally */ | 118 | /* Pullup pin is handled internally by USB device peripheral */ |
120 | x = at91_sys_read(AT91_MATRIX_USBPUCR); | ||
121 | at91_sys_write(AT91_MATRIX_USBPUCR, x | AT91_MATRIX_USBPUCR_PUON); | ||
122 | 119 | ||
123 | udc_data = *data; | 120 | udc_data = *data; |
124 | platform_device_register(&at91sam9261_udc_device); | 121 | platform_device_register(&at91sam9261_udc_device); |
@@ -132,7 +129,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
132 | * -------------------------------------------------------------------- */ | 129 | * -------------------------------------------------------------------- */ |
133 | 130 | ||
134 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 131 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
135 | static u64 mmc_dmamask = 0xffffffffUL; | 132 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
136 | static struct at91_mmc_data mmc_data; | 133 | static struct at91_mmc_data mmc_data; |
137 | 134 | ||
138 | static struct resource mmc_resources[] = { | 135 | static struct resource mmc_resources[] = { |
@@ -153,7 +150,7 @@ static struct platform_device at91sam9261_mmc_device = { | |||
153 | .id = -1, | 150 | .id = -1, |
154 | .dev = { | 151 | .dev = { |
155 | .dma_mask = &mmc_dmamask, | 152 | .dma_mask = &mmc_dmamask, |
156 | .coherent_dma_mask = 0xffffffff, | 153 | .coherent_dma_mask = DMA_BIT_MASK(32), |
157 | .platform_data = &mmc_data, | 154 | .platform_data = &mmc_data, |
158 | }, | 155 | }, |
159 | .resource = mmc_resources, | 156 | .resource = mmc_resources, |
@@ -232,7 +229,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
232 | return; | 229 | return; |
233 | 230 | ||
234 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | 231 | csa = at91_sys_read(AT91_MATRIX_EBICSA); |
235 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); | 232 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
236 | 233 | ||
237 | /* set the bus interface characteristics */ | 234 | /* set the bus interface characteristics */ |
238 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) | 235 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
@@ -354,7 +351,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
354 | * -------------------------------------------------------------------- */ | 351 | * -------------------------------------------------------------------- */ |
355 | 352 | ||
356 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 353 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
357 | static u64 spi_dmamask = 0xffffffffUL; | 354 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
358 | 355 | ||
359 | static struct resource spi0_resources[] = { | 356 | static struct resource spi0_resources[] = { |
360 | [0] = { | 357 | [0] = { |
@@ -374,7 +371,7 @@ static struct platform_device at91sam9261_spi0_device = { | |||
374 | .id = 0, | 371 | .id = 0, |
375 | .dev = { | 372 | .dev = { |
376 | .dma_mask = &spi_dmamask, | 373 | .dma_mask = &spi_dmamask, |
377 | .coherent_dma_mask = 0xffffffff, | 374 | .coherent_dma_mask = DMA_BIT_MASK(32), |
378 | }, | 375 | }, |
379 | .resource = spi0_resources, | 376 | .resource = spi0_resources, |
380 | .num_resources = ARRAY_SIZE(spi0_resources), | 377 | .num_resources = ARRAY_SIZE(spi0_resources), |
@@ -400,7 +397,7 @@ static struct platform_device at91sam9261_spi1_device = { | |||
400 | .id = 1, | 397 | .id = 1, |
401 | .dev = { | 398 | .dev = { |
402 | .dma_mask = &spi_dmamask, | 399 | .dma_mask = &spi_dmamask, |
403 | .coherent_dma_mask = 0xffffffff, | 400 | .coherent_dma_mask = DMA_BIT_MASK(32), |
404 | }, | 401 | }, |
405 | .resource = spi1_resources, | 402 | .resource = spi1_resources, |
406 | .num_resources = ARRAY_SIZE(spi1_resources), | 403 | .num_resources = ARRAY_SIZE(spi1_resources), |
@@ -466,7 +463,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
466 | * -------------------------------------------------------------------- */ | 463 | * -------------------------------------------------------------------- */ |
467 | 464 | ||
468 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 465 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
469 | static u64 lcdc_dmamask = 0xffffffffUL; | 466 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); |
470 | static struct atmel_lcdfb_info lcdc_data; | 467 | static struct atmel_lcdfb_info lcdc_data; |
471 | 468 | ||
472 | static struct resource lcdc_resources[] = { | 469 | static struct resource lcdc_resources[] = { |
@@ -494,7 +491,7 @@ static struct platform_device at91_lcdc_device = { | |||
494 | .id = 0, | 491 | .id = 0, |
495 | .dev = { | 492 | .dev = { |
496 | .dma_mask = &lcdc_dmamask, | 493 | .dma_mask = &lcdc_dmamask, |
497 | .coherent_dma_mask = 0xffffffff, | 494 | .coherent_dma_mask = DMA_BIT_MASK(32), |
498 | .platform_data = &lcdc_data, | 495 | .platform_data = &lcdc_data, |
499 | }, | 496 | }, |
500 | .resource = lcdc_resources, | 497 | .resource = lcdc_resources, |
@@ -507,6 +504,17 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
507 | return; | 504 | return; |
508 | } | 505 | } |
509 | 506 | ||
507 | #if defined(CONFIG_FB_ATMEL_STN) | ||
508 | at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ | ||
509 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ | ||
510 | at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */ | ||
511 | at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */ | ||
512 | at91_set_A_periph(AT91_PIN_PB4, 0); /* LCDCC */ | ||
513 | at91_set_A_periph(AT91_PIN_PB5, 0); /* LCDD0 */ | ||
514 | at91_set_A_periph(AT91_PIN_PB6, 0); /* LCDD1 */ | ||
515 | at91_set_A_periph(AT91_PIN_PB7, 0); /* LCDD2 */ | ||
516 | at91_set_A_periph(AT91_PIN_PB8, 0); /* LCDD3 */ | ||
517 | #else | ||
510 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ | 518 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ |
511 | at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */ | 519 | at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */ |
512 | at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */ | 520 | at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */ |
@@ -529,6 +537,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
529 | at91_set_B_periph(AT91_PIN_PB26, 0); /* LCDD21 */ | 537 | at91_set_B_periph(AT91_PIN_PB26, 0); /* LCDD21 */ |
530 | at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */ | 538 | at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */ |
531 | at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ | 539 | at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ |
540 | #endif | ||
532 | 541 | ||
533 | lcdc_data = *data; | 542 | lcdc_data = *data; |
534 | platform_device_register(&at91_lcdc_device); | 543 | platform_device_register(&at91_lcdc_device); |
@@ -539,24 +548,220 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
539 | 548 | ||
540 | 549 | ||
541 | /* -------------------------------------------------------------------- | 550 | /* -------------------------------------------------------------------- |
542 | * LEDs | 551 | * RTT |
552 | * -------------------------------------------------------------------- */ | ||
553 | |||
554 | static struct resource rtt_resources[] = { | ||
555 | { | ||
556 | .start = AT91_BASE_SYS + AT91_RTT, | ||
557 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
558 | .flags = IORESOURCE_MEM, | ||
559 | } | ||
560 | }; | ||
561 | |||
562 | static struct platform_device at91sam9261_rtt_device = { | ||
563 | .name = "at91_rtt", | ||
564 | .id = -1, | ||
565 | .resource = rtt_resources, | ||
566 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
567 | }; | ||
568 | |||
569 | static void __init at91_add_device_rtt(void) | ||
570 | { | ||
571 | platform_device_register(&at91sam9261_rtt_device); | ||
572 | } | ||
573 | |||
574 | |||
575 | /* -------------------------------------------------------------------- | ||
576 | * Watchdog | ||
577 | * -------------------------------------------------------------------- */ | ||
578 | |||
579 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
580 | static struct platform_device at91sam9261_wdt_device = { | ||
581 | .name = "at91_wdt", | ||
582 | .id = -1, | ||
583 | .num_resources = 0, | ||
584 | }; | ||
585 | |||
586 | static void __init at91_add_device_watchdog(void) | ||
587 | { | ||
588 | platform_device_register(&at91sam9261_wdt_device); | ||
589 | } | ||
590 | #else | ||
591 | static void __init at91_add_device_watchdog(void) {} | ||
592 | #endif | ||
593 | |||
594 | |||
595 | /* -------------------------------------------------------------------- | ||
596 | * SSC -- Synchronous Serial Controller | ||
543 | * -------------------------------------------------------------------- */ | 597 | * -------------------------------------------------------------------- */ |
544 | 598 | ||
545 | #if defined(CONFIG_LEDS) | 599 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) |
546 | u8 at91_leds_cpu; | 600 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); |
547 | u8 at91_leds_timer; | 601 | |
602 | static struct resource ssc0_resources[] = { | ||
603 | [0] = { | ||
604 | .start = AT91SAM9261_BASE_SSC0, | ||
605 | .end = AT91SAM9261_BASE_SSC0 + SZ_16K - 1, | ||
606 | .flags = IORESOURCE_MEM, | ||
607 | }, | ||
608 | [1] = { | ||
609 | .start = AT91SAM9261_ID_SSC0, | ||
610 | .end = AT91SAM9261_ID_SSC0, | ||
611 | .flags = IORESOURCE_IRQ, | ||
612 | }, | ||
613 | }; | ||
614 | |||
615 | static struct platform_device at91sam9261_ssc0_device = { | ||
616 | .name = "ssc", | ||
617 | .id = 0, | ||
618 | .dev = { | ||
619 | .dma_mask = &ssc0_dmamask, | ||
620 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
621 | }, | ||
622 | .resource = ssc0_resources, | ||
623 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
624 | }; | ||
625 | |||
626 | static inline void configure_ssc0_pins(unsigned pins) | ||
627 | { | ||
628 | if (pins & ATMEL_SSC_TF) | ||
629 | at91_set_A_periph(AT91_PIN_PB21, 1); | ||
630 | if (pins & ATMEL_SSC_TK) | ||
631 | at91_set_A_periph(AT91_PIN_PB22, 1); | ||
632 | if (pins & ATMEL_SSC_TD) | ||
633 | at91_set_A_periph(AT91_PIN_PB23, 1); | ||
634 | if (pins & ATMEL_SSC_RD) | ||
635 | at91_set_A_periph(AT91_PIN_PB24, 1); | ||
636 | if (pins & ATMEL_SSC_RK) | ||
637 | at91_set_A_periph(AT91_PIN_PB25, 1); | ||
638 | if (pins & ATMEL_SSC_RF) | ||
639 | at91_set_A_periph(AT91_PIN_PB26, 1); | ||
640 | } | ||
641 | |||
642 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
643 | |||
644 | static struct resource ssc1_resources[] = { | ||
645 | [0] = { | ||
646 | .start = AT91SAM9261_BASE_SSC1, | ||
647 | .end = AT91SAM9261_BASE_SSC1 + SZ_16K - 1, | ||
648 | .flags = IORESOURCE_MEM, | ||
649 | }, | ||
650 | [1] = { | ||
651 | .start = AT91SAM9261_ID_SSC1, | ||
652 | .end = AT91SAM9261_ID_SSC1, | ||
653 | .flags = IORESOURCE_IRQ, | ||
654 | }, | ||
655 | }; | ||
656 | |||
657 | static struct platform_device at91sam9261_ssc1_device = { | ||
658 | .name = "ssc", | ||
659 | .id = 1, | ||
660 | .dev = { | ||
661 | .dma_mask = &ssc1_dmamask, | ||
662 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
663 | }, | ||
664 | .resource = ssc1_resources, | ||
665 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
666 | }; | ||
667 | |||
668 | static inline void configure_ssc1_pins(unsigned pins) | ||
669 | { | ||
670 | if (pins & ATMEL_SSC_TF) | ||
671 | at91_set_B_periph(AT91_PIN_PA17, 1); | ||
672 | if (pins & ATMEL_SSC_TK) | ||
673 | at91_set_B_periph(AT91_PIN_PA18, 1); | ||
674 | if (pins & ATMEL_SSC_TD) | ||
675 | at91_set_B_periph(AT91_PIN_PA19, 1); | ||
676 | if (pins & ATMEL_SSC_RD) | ||
677 | at91_set_B_periph(AT91_PIN_PA20, 1); | ||
678 | if (pins & ATMEL_SSC_RK) | ||
679 | at91_set_B_periph(AT91_PIN_PA21, 1); | ||
680 | if (pins & ATMEL_SSC_RF) | ||
681 | at91_set_B_periph(AT91_PIN_PA22, 1); | ||
682 | } | ||
683 | |||
684 | static u64 ssc2_dmamask = DMA_BIT_MASK(32); | ||
685 | |||
686 | static struct resource ssc2_resources[] = { | ||
687 | [0] = { | ||
688 | .start = AT91SAM9261_BASE_SSC2, | ||
689 | .end = AT91SAM9261_BASE_SSC2 + SZ_16K - 1, | ||
690 | .flags = IORESOURCE_MEM, | ||
691 | }, | ||
692 | [1] = { | ||
693 | .start = AT91SAM9261_ID_SSC2, | ||
694 | .end = AT91SAM9261_ID_SSC2, | ||
695 | .flags = IORESOURCE_IRQ, | ||
696 | }, | ||
697 | }; | ||
698 | |||
699 | static struct platform_device at91sam9261_ssc2_device = { | ||
700 | .name = "ssc", | ||
701 | .id = 2, | ||
702 | .dev = { | ||
703 | .dma_mask = &ssc2_dmamask, | ||
704 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
705 | }, | ||
706 | .resource = ssc2_resources, | ||
707 | .num_resources = ARRAY_SIZE(ssc2_resources), | ||
708 | }; | ||
709 | |||
710 | static inline void configure_ssc2_pins(unsigned pins) | ||
711 | { | ||
712 | if (pins & ATMEL_SSC_TF) | ||
713 | at91_set_B_periph(AT91_PIN_PC25, 1); | ||
714 | if (pins & ATMEL_SSC_TK) | ||
715 | at91_set_B_periph(AT91_PIN_PC26, 1); | ||
716 | if (pins & ATMEL_SSC_TD) | ||
717 | at91_set_B_periph(AT91_PIN_PC27, 1); | ||
718 | if (pins & ATMEL_SSC_RD) | ||
719 | at91_set_B_periph(AT91_PIN_PC28, 1); | ||
720 | if (pins & ATMEL_SSC_RK) | ||
721 | at91_set_B_periph(AT91_PIN_PC29, 1); | ||
722 | if (pins & ATMEL_SSC_RF) | ||
723 | at91_set_B_periph(AT91_PIN_PC30, 1); | ||
724 | } | ||
548 | 725 | ||
549 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 726 | /* |
727 | * SSC controllers are accessed through library code, instead of any | ||
728 | * kind of all-singing/all-dancing driver. For example one could be | ||
729 | * used by a particular I2S audio codec's driver, while another one | ||
730 | * on the same system might be used by a custom data capture driver. | ||
731 | */ | ||
732 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
550 | { | 733 | { |
551 | /* Enable GPIO to access the LEDs */ | 734 | struct platform_device *pdev; |
552 | at91_set_gpio_output(cpu_led, 1); | 735 | |
553 | at91_set_gpio_output(timer_led, 1); | 736 | /* |
737 | * NOTE: caller is responsible for passing information matching | ||
738 | * "pins" to whatever will be using each particular controller. | ||
739 | */ | ||
740 | switch (id) { | ||
741 | case AT91SAM9261_ID_SSC0: | ||
742 | pdev = &at91sam9261_ssc0_device; | ||
743 | configure_ssc0_pins(pins); | ||
744 | at91_clock_associate("ssc0_clk", &pdev->dev, "pclk"); | ||
745 | break; | ||
746 | case AT91SAM9261_ID_SSC1: | ||
747 | pdev = &at91sam9261_ssc1_device; | ||
748 | configure_ssc1_pins(pins); | ||
749 | at91_clock_associate("ssc1_clk", &pdev->dev, "pclk"); | ||
750 | break; | ||
751 | case AT91SAM9261_ID_SSC2: | ||
752 | pdev = &at91sam9261_ssc2_device; | ||
753 | configure_ssc2_pins(pins); | ||
754 | at91_clock_associate("ssc2_clk", &pdev->dev, "pclk"); | ||
755 | break; | ||
756 | default: | ||
757 | return; | ||
758 | } | ||
554 | 759 | ||
555 | at91_leds_cpu = cpu_led; | 760 | platform_device_register(pdev); |
556 | at91_leds_timer = timer_led; | ||
557 | } | 761 | } |
762 | |||
558 | #else | 763 | #else |
559 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 764 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} |
560 | #endif | 765 | #endif |
561 | 766 | ||
562 | 767 | ||
@@ -584,12 +789,15 @@ static struct atmel_uart_data dbgu_data = { | |||
584 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 789 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
585 | }; | 790 | }; |
586 | 791 | ||
792 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
793 | |||
587 | static struct platform_device at91sam9261_dbgu_device = { | 794 | static struct platform_device at91sam9261_dbgu_device = { |
588 | .name = "atmel_usart", | 795 | .name = "atmel_usart", |
589 | .id = 0, | 796 | .id = 0, |
590 | .dev = { | 797 | .dev = { |
591 | .platform_data = &dbgu_data, | 798 | .dma_mask = &dbgu_dmamask, |
592 | .coherent_dma_mask = 0xffffffff, | 799 | .coherent_dma_mask = DMA_BIT_MASK(32), |
800 | .platform_data = &dbgu_data, | ||
593 | }, | 801 | }, |
594 | .resource = dbgu_resources, | 802 | .resource = dbgu_resources, |
595 | .num_resources = ARRAY_SIZE(dbgu_resources), | 803 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -619,23 +827,29 @@ static struct atmel_uart_data uart0_data = { | |||
619 | .use_dma_rx = 1, | 827 | .use_dma_rx = 1, |
620 | }; | 828 | }; |
621 | 829 | ||
830 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
831 | |||
622 | static struct platform_device at91sam9261_uart0_device = { | 832 | static struct platform_device at91sam9261_uart0_device = { |
623 | .name = "atmel_usart", | 833 | .name = "atmel_usart", |
624 | .id = 1, | 834 | .id = 1, |
625 | .dev = { | 835 | .dev = { |
626 | .platform_data = &uart0_data, | 836 | .dma_mask = &uart0_dmamask, |
627 | .coherent_dma_mask = 0xffffffff, | 837 | .coherent_dma_mask = DMA_BIT_MASK(32), |
838 | .platform_data = &uart0_data, | ||
628 | }, | 839 | }, |
629 | .resource = uart0_resources, | 840 | .resource = uart0_resources, |
630 | .num_resources = ARRAY_SIZE(uart0_resources), | 841 | .num_resources = ARRAY_SIZE(uart0_resources), |
631 | }; | 842 | }; |
632 | 843 | ||
633 | static inline void configure_usart0_pins(void) | 844 | static inline void configure_usart0_pins(unsigned pins) |
634 | { | 845 | { |
635 | at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */ | 846 | at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */ |
636 | at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */ | 847 | at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */ |
637 | at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */ | 848 | |
638 | at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */ | 849 | if (pins & ATMEL_UART_RTS) |
850 | at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */ | ||
851 | if (pins & ATMEL_UART_CTS) | ||
852 | at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */ | ||
639 | } | 853 | } |
640 | 854 | ||
641 | static struct resource uart1_resources[] = { | 855 | static struct resource uart1_resources[] = { |
@@ -656,21 +870,29 @@ static struct atmel_uart_data uart1_data = { | |||
656 | .use_dma_rx = 1, | 870 | .use_dma_rx = 1, |
657 | }; | 871 | }; |
658 | 872 | ||
873 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
874 | |||
659 | static struct platform_device at91sam9261_uart1_device = { | 875 | static struct platform_device at91sam9261_uart1_device = { |
660 | .name = "atmel_usart", | 876 | .name = "atmel_usart", |
661 | .id = 2, | 877 | .id = 2, |
662 | .dev = { | 878 | .dev = { |
663 | .platform_data = &uart1_data, | 879 | .dma_mask = &uart1_dmamask, |
664 | .coherent_dma_mask = 0xffffffff, | 880 | .coherent_dma_mask = DMA_BIT_MASK(32), |
881 | .platform_data = &uart1_data, | ||
665 | }, | 882 | }, |
666 | .resource = uart1_resources, | 883 | .resource = uart1_resources, |
667 | .num_resources = ARRAY_SIZE(uart1_resources), | 884 | .num_resources = ARRAY_SIZE(uart1_resources), |
668 | }; | 885 | }; |
669 | 886 | ||
670 | static inline void configure_usart1_pins(void) | 887 | static inline void configure_usart1_pins(unsigned pins) |
671 | { | 888 | { |
672 | at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */ | 889 | at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */ |
673 | at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */ | 890 | at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */ |
891 | |||
892 | if (pins & ATMEL_UART_RTS) | ||
893 | at91_set_B_periph(AT91_PIN_PA12, 0); /* RTS1 */ | ||
894 | if (pins & ATMEL_UART_CTS) | ||
895 | at91_set_B_periph(AT91_PIN_PA13, 0); /* CTS1 */ | ||
674 | } | 896 | } |
675 | 897 | ||
676 | static struct resource uart2_resources[] = { | 898 | static struct resource uart2_resources[] = { |
@@ -691,27 +913,35 @@ static struct atmel_uart_data uart2_data = { | |||
691 | .use_dma_rx = 1, | 913 | .use_dma_rx = 1, |
692 | }; | 914 | }; |
693 | 915 | ||
916 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
917 | |||
694 | static struct platform_device at91sam9261_uart2_device = { | 918 | static struct platform_device at91sam9261_uart2_device = { |
695 | .name = "atmel_usart", | 919 | .name = "atmel_usart", |
696 | .id = 3, | 920 | .id = 3, |
697 | .dev = { | 921 | .dev = { |
698 | .platform_data = &uart2_data, | 922 | .dma_mask = &uart2_dmamask, |
699 | .coherent_dma_mask = 0xffffffff, | 923 | .coherent_dma_mask = DMA_BIT_MASK(32), |
924 | .platform_data = &uart2_data, | ||
700 | }, | 925 | }, |
701 | .resource = uart2_resources, | 926 | .resource = uart2_resources, |
702 | .num_resources = ARRAY_SIZE(uart2_resources), | 927 | .num_resources = ARRAY_SIZE(uart2_resources), |
703 | }; | 928 | }; |
704 | 929 | ||
705 | static inline void configure_usart2_pins(void) | 930 | static inline void configure_usart2_pins(unsigned pins) |
706 | { | 931 | { |
707 | at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */ | 932 | at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */ |
708 | at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */ | 933 | at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */ |
934 | |||
935 | if (pins & ATMEL_UART_RTS) | ||
936 | at91_set_B_periph(AT91_PIN_PA15, 0); /* RTS2*/ | ||
937 | if (pins & ATMEL_UART_CTS) | ||
938 | at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */ | ||
709 | } | 939 | } |
710 | 940 | ||
711 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 941 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
712 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 942 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
713 | 943 | ||
714 | void __init at91_init_serial(struct at91_uart_config *config) | 944 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
715 | { | 945 | { |
716 | int i; | 946 | int i; |
717 | 947 | ||
@@ -719,17 +949,17 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
719 | for (i = 0; i < config->nr_tty; i++) { | 949 | for (i = 0; i < config->nr_tty; i++) { |
720 | switch (config->tty_map[i]) { | 950 | switch (config->tty_map[i]) { |
721 | case 0: | 951 | case 0: |
722 | configure_usart0_pins(); | 952 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
723 | at91_uarts[i] = &at91sam9261_uart0_device; | 953 | at91_uarts[i] = &at91sam9261_uart0_device; |
724 | at91_clock_associate("usart0_clk", &at91sam9261_uart0_device.dev, "usart"); | 954 | at91_clock_associate("usart0_clk", &at91sam9261_uart0_device.dev, "usart"); |
725 | break; | 955 | break; |
726 | case 1: | 956 | case 1: |
727 | configure_usart1_pins(); | 957 | configure_usart1_pins(0); |
728 | at91_uarts[i] = &at91sam9261_uart1_device; | 958 | at91_uarts[i] = &at91sam9261_uart1_device; |
729 | at91_clock_associate("usart1_clk", &at91sam9261_uart1_device.dev, "usart"); | 959 | at91_clock_associate("usart1_clk", &at91sam9261_uart1_device.dev, "usart"); |
730 | break; | 960 | break; |
731 | case 2: | 961 | case 2: |
732 | configure_usart2_pins(); | 962 | configure_usart2_pins(0); |
733 | at91_uarts[i] = &at91sam9261_uart2_device; | 963 | at91_uarts[i] = &at91sam9261_uart2_device; |
734 | at91_clock_associate("usart2_clk", &at91sam9261_uart2_device.dev, "usart"); | 964 | at91_clock_associate("usart2_clk", &at91sam9261_uart2_device.dev, "usart"); |
735 | break; | 965 | break; |
@@ -751,6 +981,48 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
751 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 981 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
752 | } | 982 | } |
753 | 983 | ||
984 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
985 | { | ||
986 | struct platform_device *pdev; | ||
987 | |||
988 | switch (id) { | ||
989 | case 0: /* DBGU */ | ||
990 | pdev = &at91sam9261_dbgu_device; | ||
991 | configure_dbgu_pins(); | ||
992 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
993 | break; | ||
994 | case AT91SAM9261_ID_US0: | ||
995 | pdev = &at91sam9261_uart0_device; | ||
996 | configure_usart0_pins(pins); | ||
997 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
998 | break; | ||
999 | case AT91SAM9261_ID_US1: | ||
1000 | pdev = &at91sam9261_uart1_device; | ||
1001 | configure_usart1_pins(pins); | ||
1002 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
1003 | break; | ||
1004 | case AT91SAM9261_ID_US2: | ||
1005 | pdev = &at91sam9261_uart2_device; | ||
1006 | configure_usart2_pins(pins); | ||
1007 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
1008 | break; | ||
1009 | default: | ||
1010 | return; | ||
1011 | } | ||
1012 | pdev->id = portnr; /* update to mapped ID */ | ||
1013 | |||
1014 | if (portnr < ATMEL_MAX_UART) | ||
1015 | at91_uarts[portnr] = pdev; | ||
1016 | } | ||
1017 | |||
1018 | void __init at91_set_serial_console(unsigned portnr) | ||
1019 | { | ||
1020 | if (portnr < ATMEL_MAX_UART) | ||
1021 | atmel_default_console_device = at91_uarts[portnr]; | ||
1022 | if (!atmel_default_console_device) | ||
1023 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1024 | } | ||
1025 | |||
754 | void __init at91_add_device_serial(void) | 1026 | void __init at91_add_device_serial(void) |
755 | { | 1027 | { |
756 | int i; | 1028 | int i; |
@@ -761,7 +1033,9 @@ void __init at91_add_device_serial(void) | |||
761 | } | 1033 | } |
762 | } | 1034 | } |
763 | #else | 1035 | #else |
764 | void __init at91_init_serial(struct at91_uart_config *config) {} | 1036 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} |
1037 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1038 | void __init at91_set_serial_console(unsigned portnr) {} | ||
765 | void __init at91_add_device_serial(void) {} | 1039 | void __init at91_add_device_serial(void) {} |
766 | #endif | 1040 | #endif |
767 | 1041 | ||
@@ -774,6 +1048,8 @@ void __init at91_add_device_serial(void) {} | |||
774 | */ | 1048 | */ |
775 | static int __init at91_add_standard_devices(void) | 1049 | static int __init at91_add_standard_devices(void) |
776 | { | 1050 | { |
1051 | at91_add_device_rtt(); | ||
1052 | at91_add_device_watchdog(); | ||
777 | return 0; | 1053 | return 0; |
778 | } | 1054 | } |
779 | 1055 | ||
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 00e27b177857..a53ba0f74351 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -304,34 +304,34 @@ void __init at91sam9263_initialize(unsigned long main_clock) | |||
304 | static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { | 304 | static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { |
305 | 7, /* Advanced Interrupt Controller (FIQ) */ | 305 | 7, /* Advanced Interrupt Controller (FIQ) */ |
306 | 7, /* System Peripherals */ | 306 | 7, /* System Peripherals */ |
307 | 0, /* Parallel IO Controller A */ | 307 | 1, /* Parallel IO Controller A */ |
308 | 0, /* Parallel IO Controller B */ | 308 | 1, /* Parallel IO Controller B */ |
309 | 0, /* Parallel IO Controller C, D and E */ | 309 | 1, /* Parallel IO Controller C, D and E */ |
310 | 0, | 310 | 0, |
311 | 0, | 311 | 0, |
312 | 6, /* USART 0 */ | 312 | 5, /* USART 0 */ |
313 | 6, /* USART 1 */ | 313 | 5, /* USART 1 */ |
314 | 6, /* USART 2 */ | 314 | 5, /* USART 2 */ |
315 | 0, /* Multimedia Card Interface 0 */ | 315 | 0, /* Multimedia Card Interface 0 */ |
316 | 0, /* Multimedia Card Interface 1 */ | 316 | 0, /* Multimedia Card Interface 1 */ |
317 | 4, /* CAN */ | 317 | 3, /* CAN */ |
318 | 0, /* Two-Wire Interface */ | 318 | 6, /* Two-Wire Interface */ |
319 | 6, /* Serial Peripheral Interface 0 */ | 319 | 5, /* Serial Peripheral Interface 0 */ |
320 | 6, /* Serial Peripheral Interface 1 */ | 320 | 5, /* Serial Peripheral Interface 1 */ |
321 | 5, /* Serial Synchronous Controller 0 */ | 321 | 4, /* Serial Synchronous Controller 0 */ |
322 | 5, /* Serial Synchronous Controller 1 */ | 322 | 4, /* Serial Synchronous Controller 1 */ |
323 | 6, /* AC97 Controller */ | 323 | 5, /* AC97 Controller */ |
324 | 0, /* Timer Counter 0, 1 and 2 */ | 324 | 0, /* Timer Counter 0, 1 and 2 */ |
325 | 0, /* Pulse Width Modulation Controller */ | 325 | 0, /* Pulse Width Modulation Controller */ |
326 | 3, /* Ethernet */ | 326 | 3, /* Ethernet */ |
327 | 0, | 327 | 0, |
328 | 0, /* 2D Graphic Engine */ | 328 | 0, /* 2D Graphic Engine */ |
329 | 3, /* USB Device Port */ | 329 | 2, /* USB Device Port */ |
330 | 0, /* Image Sensor Interface */ | 330 | 0, /* Image Sensor Interface */ |
331 | 3, /* LDC Controller */ | 331 | 3, /* LDC Controller */ |
332 | 0, /* DMA Controller */ | 332 | 0, /* DMA Controller */ |
333 | 0, | 333 | 0, |
334 | 3, /* USB Host port */ | 334 | 2, /* USB Host port */ |
335 | 0, /* Advanced Interrupt Controller (IRQ0) */ | 335 | 0, /* Advanced Interrupt Controller (IRQ0) */ |
336 | 0, /* Advanced Interrupt Controller (IRQ1) */ | 336 | 0, /* Advanced Interrupt Controller (IRQ1) */ |
337 | }; | 337 | }; |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ac329a98e959..0b12e1adcc8e 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/mach/arch.h> | 12 | #include <asm/mach/arch.h> |
13 | #include <asm/mach/map.h> | 13 | #include <asm/mach/map.h> |
14 | 14 | ||
15 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
16 | #include <linux/i2c-gpio.h> | 17 | #include <linux/i2c-gpio.h> |
17 | 18 | ||
@@ -32,7 +33,7 @@ | |||
32 | * -------------------------------------------------------------------- */ | 33 | * -------------------------------------------------------------------- */ |
33 | 34 | ||
34 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 35 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
35 | static u64 ohci_dmamask = 0xffffffffUL; | 36 | static u64 ohci_dmamask = DMA_BIT_MASK(32); |
36 | static struct at91_usbh_data usbh_data; | 37 | static struct at91_usbh_data usbh_data; |
37 | 38 | ||
38 | static struct resource usbh_resources[] = { | 39 | static struct resource usbh_resources[] = { |
@@ -53,7 +54,7 @@ static struct platform_device at91_usbh_device = { | |||
53 | .id = -1, | 54 | .id = -1, |
54 | .dev = { | 55 | .dev = { |
55 | .dma_mask = &ohci_dmamask, | 56 | .dma_mask = &ohci_dmamask, |
56 | .coherent_dma_mask = 0xffffffff, | 57 | .coherent_dma_mask = DMA_BIT_MASK(32), |
57 | .platform_data = &usbh_data, | 58 | .platform_data = &usbh_data, |
58 | }, | 59 | }, |
59 | .resource = usbh_resources, | 60 | .resource = usbh_resources, |
@@ -136,7 +137,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
136 | * -------------------------------------------------------------------- */ | 137 | * -------------------------------------------------------------------- */ |
137 | 138 | ||
138 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 139 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
139 | static u64 eth_dmamask = 0xffffffffUL; | 140 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
140 | static struct at91_eth_data eth_data; | 141 | static struct at91_eth_data eth_data; |
141 | 142 | ||
142 | static struct resource eth_resources[] = { | 143 | static struct resource eth_resources[] = { |
@@ -157,7 +158,7 @@ static struct platform_device at91sam9263_eth_device = { | |||
157 | .id = -1, | 158 | .id = -1, |
158 | .dev = { | 159 | .dev = { |
159 | .dma_mask = ð_dmamask, | 160 | .dma_mask = ð_dmamask, |
160 | .coherent_dma_mask = 0xffffffff, | 161 | .coherent_dma_mask = DMA_BIT_MASK(32), |
161 | .platform_data = ð_data, | 162 | .platform_data = ð_data, |
162 | }, | 163 | }, |
163 | .resource = eth_resources, | 164 | .resource = eth_resources, |
@@ -210,7 +211,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {} | |||
210 | * -------------------------------------------------------------------- */ | 211 | * -------------------------------------------------------------------- */ |
211 | 212 | ||
212 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 213 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
213 | static u64 mmc_dmamask = 0xffffffffUL; | 214 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
214 | static struct at91_mmc_data mmc0_data, mmc1_data; | 215 | static struct at91_mmc_data mmc0_data, mmc1_data; |
215 | 216 | ||
216 | static struct resource mmc0_resources[] = { | 217 | static struct resource mmc0_resources[] = { |
@@ -231,7 +232,7 @@ static struct platform_device at91sam9263_mmc0_device = { | |||
231 | .id = 0, | 232 | .id = 0, |
232 | .dev = { | 233 | .dev = { |
233 | .dma_mask = &mmc_dmamask, | 234 | .dma_mask = &mmc_dmamask, |
234 | .coherent_dma_mask = 0xffffffff, | 235 | .coherent_dma_mask = DMA_BIT_MASK(32), |
235 | .platform_data = &mmc0_data, | 236 | .platform_data = &mmc0_data, |
236 | }, | 237 | }, |
237 | .resource = mmc0_resources, | 238 | .resource = mmc0_resources, |
@@ -256,7 +257,7 @@ static struct platform_device at91sam9263_mmc1_device = { | |||
256 | .id = 1, | 257 | .id = 1, |
257 | .dev = { | 258 | .dev = { |
258 | .dma_mask = &mmc_dmamask, | 259 | .dma_mask = &mmc_dmamask, |
259 | .coherent_dma_mask = 0xffffffff, | 260 | .coherent_dma_mask = DMA_BIT_MASK(32), |
260 | .platform_data = &mmc1_data, | 261 | .platform_data = &mmc1_data, |
261 | }, | 262 | }, |
262 | .resource = mmc1_resources, | 263 | .resource = mmc1_resources, |
@@ -382,7 +383,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
382 | return; | 383 | return; |
383 | 384 | ||
384 | csa = at91_sys_read(AT91_MATRIX_EBI0CSA); | 385 | csa = at91_sys_read(AT91_MATRIX_EBI0CSA); |
385 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC); | 386 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); |
386 | 387 | ||
387 | /* set the bus interface characteristics */ | 388 | /* set the bus interface characteristics */ |
388 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) | 389 | at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
@@ -500,7 +501,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
500 | * -------------------------------------------------------------------- */ | 501 | * -------------------------------------------------------------------- */ |
501 | 502 | ||
502 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 503 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
503 | static u64 spi_dmamask = 0xffffffffUL; | 504 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
504 | 505 | ||
505 | static struct resource spi0_resources[] = { | 506 | static struct resource spi0_resources[] = { |
506 | [0] = { | 507 | [0] = { |
@@ -520,7 +521,7 @@ static struct platform_device at91sam9263_spi0_device = { | |||
520 | .id = 0, | 521 | .id = 0, |
521 | .dev = { | 522 | .dev = { |
522 | .dma_mask = &spi_dmamask, | 523 | .dma_mask = &spi_dmamask, |
523 | .coherent_dma_mask = 0xffffffff, | 524 | .coherent_dma_mask = DMA_BIT_MASK(32), |
524 | }, | 525 | }, |
525 | .resource = spi0_resources, | 526 | .resource = spi0_resources, |
526 | .num_resources = ARRAY_SIZE(spi0_resources), | 527 | .num_resources = ARRAY_SIZE(spi0_resources), |
@@ -546,7 +547,7 @@ static struct platform_device at91sam9263_spi1_device = { | |||
546 | .id = 1, | 547 | .id = 1, |
547 | .dev = { | 548 | .dev = { |
548 | .dma_mask = &spi_dmamask, | 549 | .dma_mask = &spi_dmamask, |
549 | .coherent_dma_mask = 0xffffffff, | 550 | .coherent_dma_mask = DMA_BIT_MASK(32), |
550 | }, | 551 | }, |
551 | .resource = spi1_resources, | 552 | .resource = spi1_resources, |
552 | .num_resources = ARRAY_SIZE(spi1_resources), | 553 | .num_resources = ARRAY_SIZE(spi1_resources), |
@@ -612,7 +613,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
612 | * -------------------------------------------------------------------- */ | 613 | * -------------------------------------------------------------------- */ |
613 | 614 | ||
614 | #if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE) | 615 | #if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE) |
615 | static u64 ac97_dmamask = 0xffffffffUL; | 616 | static u64 ac97_dmamask = DMA_BIT_MASK(32); |
616 | static struct atmel_ac97_data ac97_data; | 617 | static struct atmel_ac97_data ac97_data; |
617 | 618 | ||
618 | static struct resource ac97_resources[] = { | 619 | static struct resource ac97_resources[] = { |
@@ -633,7 +634,7 @@ static struct platform_device at91sam9263_ac97_device = { | |||
633 | .id = 1, | 634 | .id = 1, |
634 | .dev = { | 635 | .dev = { |
635 | .dma_mask = &ac97_dmamask, | 636 | .dma_mask = &ac97_dmamask, |
636 | .coherent_dma_mask = 0xffffffff, | 637 | .coherent_dma_mask = DMA_BIT_MASK(32), |
637 | .platform_data = &ac97_data, | 638 | .platform_data = &ac97_data, |
638 | }, | 639 | }, |
639 | .resource = ac97_resources, | 640 | .resource = ac97_resources, |
@@ -667,7 +668,7 @@ void __init at91_add_device_ac97(struct atmel_ac97_data *data) {} | |||
667 | * -------------------------------------------------------------------- */ | 668 | * -------------------------------------------------------------------- */ |
668 | 669 | ||
669 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 670 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
670 | static u64 lcdc_dmamask = 0xffffffffUL; | 671 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); |
671 | static struct atmel_lcdfb_info lcdc_data; | 672 | static struct atmel_lcdfb_info lcdc_data; |
672 | 673 | ||
673 | static struct resource lcdc_resources[] = { | 674 | static struct resource lcdc_resources[] = { |
@@ -688,7 +689,7 @@ static struct platform_device at91_lcdc_device = { | |||
688 | .id = 0, | 689 | .id = 0, |
689 | .dev = { | 690 | .dev = { |
690 | .dma_mask = &lcdc_dmamask, | 691 | .dma_mask = &lcdc_dmamask, |
691 | .coherent_dma_mask = 0xffffffff, | 692 | .coherent_dma_mask = DMA_BIT_MASK(32), |
692 | .platform_data = &lcdc_data, | 693 | .platform_data = &lcdc_data, |
693 | }, | 694 | }, |
694 | .resource = lcdc_resources, | 695 | .resource = lcdc_resources, |
@@ -732,24 +733,242 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
732 | 733 | ||
733 | 734 | ||
734 | /* -------------------------------------------------------------------- | 735 | /* -------------------------------------------------------------------- |
735 | * LEDs | 736 | * Image Sensor Interface |
736 | * -------------------------------------------------------------------- */ | 737 | * -------------------------------------------------------------------- */ |
737 | 738 | ||
738 | #if defined(CONFIG_LEDS) | 739 | #if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE) |
739 | u8 at91_leds_cpu; | ||
740 | u8 at91_leds_timer; | ||
741 | 740 | ||
742 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 741 | struct resource isi_resources[] = { |
742 | [0] = { | ||
743 | .start = AT91SAM9263_BASE_ISI, | ||
744 | .end = AT91SAM9263_BASE_ISI + SZ_16K - 1, | ||
745 | .flags = IORESOURCE_MEM, | ||
746 | }, | ||
747 | [1] = { | ||
748 | .start = AT91SAM9263_ID_ISI, | ||
749 | .end = AT91SAM9263_ID_ISI, | ||
750 | .flags = IORESOURCE_IRQ, | ||
751 | }, | ||
752 | }; | ||
753 | |||
754 | static struct platform_device at91sam9263_isi_device = { | ||
755 | .name = "at91_isi", | ||
756 | .id = -1, | ||
757 | .resource = isi_resources, | ||
758 | .num_resources = ARRAY_SIZE(isi_resources), | ||
759 | }; | ||
760 | |||
761 | void __init at91_add_device_isi(void) | ||
762 | { | ||
763 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ | ||
764 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ | ||
765 | at91_set_A_periph(AT91_PIN_PE2, 0); /* ISI_D2 */ | ||
766 | at91_set_A_periph(AT91_PIN_PE3, 0); /* ISI_D3 */ | ||
767 | at91_set_A_periph(AT91_PIN_PE4, 0); /* ISI_D4 */ | ||
768 | at91_set_A_periph(AT91_PIN_PE5, 0); /* ISI_D5 */ | ||
769 | at91_set_A_periph(AT91_PIN_PE6, 0); /* ISI_D6 */ | ||
770 | at91_set_A_periph(AT91_PIN_PE7, 0); /* ISI_D7 */ | ||
771 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ | ||
772 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ | ||
773 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ | ||
774 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
775 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ | ||
776 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ | ||
777 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ | ||
778 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ | ||
779 | } | ||
780 | #else | ||
781 | void __init at91_add_device_isi(void) {} | ||
782 | #endif | ||
783 | |||
784 | |||
785 | /* -------------------------------------------------------------------- | ||
786 | * RTT | ||
787 | * -------------------------------------------------------------------- */ | ||
788 | |||
789 | static struct resource rtt0_resources[] = { | ||
790 | { | ||
791 | .start = AT91_BASE_SYS + AT91_RTT0, | ||
792 | .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1, | ||
793 | .flags = IORESOURCE_MEM, | ||
794 | } | ||
795 | }; | ||
796 | |||
797 | static struct platform_device at91sam9263_rtt0_device = { | ||
798 | .name = "at91_rtt", | ||
799 | .id = 0, | ||
800 | .resource = rtt0_resources, | ||
801 | .num_resources = ARRAY_SIZE(rtt0_resources), | ||
802 | }; | ||
803 | |||
804 | static struct resource rtt1_resources[] = { | ||
805 | { | ||
806 | .start = AT91_BASE_SYS + AT91_RTT1, | ||
807 | .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1, | ||
808 | .flags = IORESOURCE_MEM, | ||
809 | } | ||
810 | }; | ||
811 | |||
812 | static struct platform_device at91sam9263_rtt1_device = { | ||
813 | .name = "at91_rtt", | ||
814 | .id = 1, | ||
815 | .resource = rtt1_resources, | ||
816 | .num_resources = ARRAY_SIZE(rtt1_resources), | ||
817 | }; | ||
818 | |||
819 | static void __init at91_add_device_rtt(void) | ||
820 | { | ||
821 | platform_device_register(&at91sam9263_rtt0_device); | ||
822 | platform_device_register(&at91sam9263_rtt1_device); | ||
823 | } | ||
824 | |||
825 | |||
826 | /* -------------------------------------------------------------------- | ||
827 | * Watchdog | ||
828 | * -------------------------------------------------------------------- */ | ||
829 | |||
830 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
831 | static struct platform_device at91sam9263_wdt_device = { | ||
832 | .name = "at91_wdt", | ||
833 | .id = -1, | ||
834 | .num_resources = 0, | ||
835 | }; | ||
836 | |||
837 | static void __init at91_add_device_watchdog(void) | ||
838 | { | ||
839 | platform_device_register(&at91sam9263_wdt_device); | ||
840 | } | ||
841 | #else | ||
842 | static void __init at91_add_device_watchdog(void) {} | ||
843 | #endif | ||
844 | |||
845 | |||
846 | /* -------------------------------------------------------------------- | ||
847 | * SSC -- Synchronous Serial Controller | ||
848 | * -------------------------------------------------------------------- */ | ||
849 | |||
850 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
851 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
852 | |||
853 | static struct resource ssc0_resources[] = { | ||
854 | [0] = { | ||
855 | .start = AT91SAM9263_BASE_SSC0, | ||
856 | .end = AT91SAM9263_BASE_SSC0 + SZ_16K - 1, | ||
857 | .flags = IORESOURCE_MEM, | ||
858 | }, | ||
859 | [1] = { | ||
860 | .start = AT91SAM9263_ID_SSC0, | ||
861 | .end = AT91SAM9263_ID_SSC0, | ||
862 | .flags = IORESOURCE_IRQ, | ||
863 | }, | ||
864 | }; | ||
865 | |||
866 | static struct platform_device at91sam9263_ssc0_device = { | ||
867 | .name = "ssc", | ||
868 | .id = 0, | ||
869 | .dev = { | ||
870 | .dma_mask = &ssc0_dmamask, | ||
871 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
872 | }, | ||
873 | .resource = ssc0_resources, | ||
874 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
875 | }; | ||
876 | |||
877 | static inline void configure_ssc0_pins(unsigned pins) | ||
878 | { | ||
879 | if (pins & ATMEL_SSC_TF) | ||
880 | at91_set_B_periph(AT91_PIN_PB0, 1); | ||
881 | if (pins & ATMEL_SSC_TK) | ||
882 | at91_set_B_periph(AT91_PIN_PB1, 1); | ||
883 | if (pins & ATMEL_SSC_TD) | ||
884 | at91_set_B_periph(AT91_PIN_PB2, 1); | ||
885 | if (pins & ATMEL_SSC_RD) | ||
886 | at91_set_B_periph(AT91_PIN_PB3, 1); | ||
887 | if (pins & ATMEL_SSC_RK) | ||
888 | at91_set_B_periph(AT91_PIN_PB4, 1); | ||
889 | if (pins & ATMEL_SSC_RF) | ||
890 | at91_set_B_periph(AT91_PIN_PB5, 1); | ||
891 | } | ||
892 | |||
893 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
894 | |||
895 | static struct resource ssc1_resources[] = { | ||
896 | [0] = { | ||
897 | .start = AT91SAM9263_BASE_SSC1, | ||
898 | .end = AT91SAM9263_BASE_SSC1 + SZ_16K - 1, | ||
899 | .flags = IORESOURCE_MEM, | ||
900 | }, | ||
901 | [1] = { | ||
902 | .start = AT91SAM9263_ID_SSC1, | ||
903 | .end = AT91SAM9263_ID_SSC1, | ||
904 | .flags = IORESOURCE_IRQ, | ||
905 | }, | ||
906 | }; | ||
907 | |||
908 | static struct platform_device at91sam9263_ssc1_device = { | ||
909 | .name = "ssc", | ||
910 | .id = 1, | ||
911 | .dev = { | ||
912 | .dma_mask = &ssc1_dmamask, | ||
913 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
914 | }, | ||
915 | .resource = ssc1_resources, | ||
916 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
917 | }; | ||
918 | |||
919 | static inline void configure_ssc1_pins(unsigned pins) | ||
920 | { | ||
921 | if (pins & ATMEL_SSC_TF) | ||
922 | at91_set_A_periph(AT91_PIN_PB6, 1); | ||
923 | if (pins & ATMEL_SSC_TK) | ||
924 | at91_set_A_periph(AT91_PIN_PB7, 1); | ||
925 | if (pins & ATMEL_SSC_TD) | ||
926 | at91_set_A_periph(AT91_PIN_PB8, 1); | ||
927 | if (pins & ATMEL_SSC_RD) | ||
928 | at91_set_A_periph(AT91_PIN_PB9, 1); | ||
929 | if (pins & ATMEL_SSC_RK) | ||
930 | at91_set_A_periph(AT91_PIN_PB10, 1); | ||
931 | if (pins & ATMEL_SSC_RF) | ||
932 | at91_set_A_periph(AT91_PIN_PB11, 1); | ||
933 | } | ||
934 | |||
935 | /* | ||
936 | * Return the device node so that board init code can use it as the | ||
937 | * parent for the device node reflecting how it's used on this board. | ||
938 | * | ||
939 | * SSC controllers are accessed through library code, instead of any | ||
940 | * kind of all-singing/all-dancing driver. For example one could be | ||
941 | * used by a particular I2S audio codec's driver, while another one | ||
942 | * on the same system might be used by a custom data capture driver. | ||
943 | */ | ||
944 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
743 | { | 945 | { |
744 | /* Enable GPIO to access the LEDs */ | 946 | struct platform_device *pdev; |
745 | at91_set_gpio_output(cpu_led, 1); | 947 | |
746 | at91_set_gpio_output(timer_led, 1); | 948 | /* |
949 | * NOTE: caller is responsible for passing information matching | ||
950 | * "pins" to whatever will be using each particular controller. | ||
951 | */ | ||
952 | switch (id) { | ||
953 | case AT91SAM9263_ID_SSC0: | ||
954 | pdev = &at91sam9263_ssc0_device; | ||
955 | configure_ssc0_pins(pins); | ||
956 | at91_clock_associate("ssc0_clk", &pdev->dev, "pclk"); | ||
957 | break; | ||
958 | case AT91SAM9263_ID_SSC1: | ||
959 | pdev = &at91sam9263_ssc1_device; | ||
960 | configure_ssc1_pins(pins); | ||
961 | at91_clock_associate("ssc1_clk", &pdev->dev, "pclk"); | ||
962 | break; | ||
963 | default: | ||
964 | return; | ||
965 | } | ||
747 | 966 | ||
748 | at91_leds_cpu = cpu_led; | 967 | platform_device_register(pdev); |
749 | at91_leds_timer = timer_led; | ||
750 | } | 968 | } |
969 | |||
751 | #else | 970 | #else |
752 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 971 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} |
753 | #endif | 972 | #endif |
754 | 973 | ||
755 | 974 | ||
@@ -778,12 +997,15 @@ static struct atmel_uart_data dbgu_data = { | |||
778 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 997 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
779 | }; | 998 | }; |
780 | 999 | ||
1000 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
1001 | |||
781 | static struct platform_device at91sam9263_dbgu_device = { | 1002 | static struct platform_device at91sam9263_dbgu_device = { |
782 | .name = "atmel_usart", | 1003 | .name = "atmel_usart", |
783 | .id = 0, | 1004 | .id = 0, |
784 | .dev = { | 1005 | .dev = { |
785 | .platform_data = &dbgu_data, | 1006 | .dma_mask = &dbgu_dmamask, |
786 | .coherent_dma_mask = 0xffffffff, | 1007 | .coherent_dma_mask = DMA_BIT_MASK(32), |
1008 | .platform_data = &dbgu_data, | ||
787 | }, | 1009 | }, |
788 | .resource = dbgu_resources, | 1010 | .resource = dbgu_resources, |
789 | .num_resources = ARRAY_SIZE(dbgu_resources), | 1011 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -813,23 +1035,29 @@ static struct atmel_uart_data uart0_data = { | |||
813 | .use_dma_rx = 1, | 1035 | .use_dma_rx = 1, |
814 | }; | 1036 | }; |
815 | 1037 | ||
1038 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
1039 | |||
816 | static struct platform_device at91sam9263_uart0_device = { | 1040 | static struct platform_device at91sam9263_uart0_device = { |
817 | .name = "atmel_usart", | 1041 | .name = "atmel_usart", |
818 | .id = 1, | 1042 | .id = 1, |
819 | .dev = { | 1043 | .dev = { |
820 | .platform_data = &uart0_data, | 1044 | .dma_mask = &uart0_dmamask, |
821 | .coherent_dma_mask = 0xffffffff, | 1045 | .coherent_dma_mask = DMA_BIT_MASK(32), |
1046 | .platform_data = &uart0_data, | ||
822 | }, | 1047 | }, |
823 | .resource = uart0_resources, | 1048 | .resource = uart0_resources, |
824 | .num_resources = ARRAY_SIZE(uart0_resources), | 1049 | .num_resources = ARRAY_SIZE(uart0_resources), |
825 | }; | 1050 | }; |
826 | 1051 | ||
827 | static inline void configure_usart0_pins(void) | 1052 | static inline void configure_usart0_pins(unsigned pins) |
828 | { | 1053 | { |
829 | at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ | 1054 | at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ |
830 | at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ | 1055 | at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ |
831 | at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */ | 1056 | |
832 | at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */ | 1057 | if (pins & ATMEL_UART_RTS) |
1058 | at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */ | ||
1059 | if (pins & ATMEL_UART_CTS) | ||
1060 | at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */ | ||
833 | } | 1061 | } |
834 | 1062 | ||
835 | static struct resource uart1_resources[] = { | 1063 | static struct resource uart1_resources[] = { |
@@ -850,23 +1078,29 @@ static struct atmel_uart_data uart1_data = { | |||
850 | .use_dma_rx = 1, | 1078 | .use_dma_rx = 1, |
851 | }; | 1079 | }; |
852 | 1080 | ||
1081 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
1082 | |||
853 | static struct platform_device at91sam9263_uart1_device = { | 1083 | static struct platform_device at91sam9263_uart1_device = { |
854 | .name = "atmel_usart", | 1084 | .name = "atmel_usart", |
855 | .id = 2, | 1085 | .id = 2, |
856 | .dev = { | 1086 | .dev = { |
857 | .platform_data = &uart1_data, | 1087 | .dma_mask = &uart1_dmamask, |
858 | .coherent_dma_mask = 0xffffffff, | 1088 | .coherent_dma_mask = DMA_BIT_MASK(32), |
1089 | .platform_data = &uart1_data, | ||
859 | }, | 1090 | }, |
860 | .resource = uart1_resources, | 1091 | .resource = uart1_resources, |
861 | .num_resources = ARRAY_SIZE(uart1_resources), | 1092 | .num_resources = ARRAY_SIZE(uart1_resources), |
862 | }; | 1093 | }; |
863 | 1094 | ||
864 | static inline void configure_usart1_pins(void) | 1095 | static inline void configure_usart1_pins(unsigned pins) |
865 | { | 1096 | { |
866 | at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | 1097 | at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ |
867 | at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | 1098 | at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ |
868 | at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ | 1099 | |
869 | at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ | 1100 | if (pins & ATMEL_UART_RTS) |
1101 | at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ | ||
1102 | if (pins & ATMEL_UART_CTS) | ||
1103 | at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ | ||
870 | } | 1104 | } |
871 | 1105 | ||
872 | static struct resource uart2_resources[] = { | 1106 | static struct resource uart2_resources[] = { |
@@ -887,29 +1121,35 @@ static struct atmel_uart_data uart2_data = { | |||
887 | .use_dma_rx = 1, | 1121 | .use_dma_rx = 1, |
888 | }; | 1122 | }; |
889 | 1123 | ||
1124 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
1125 | |||
890 | static struct platform_device at91sam9263_uart2_device = { | 1126 | static struct platform_device at91sam9263_uart2_device = { |
891 | .name = "atmel_usart", | 1127 | .name = "atmel_usart", |
892 | .id = 3, | 1128 | .id = 3, |
893 | .dev = { | 1129 | .dev = { |
894 | .platform_data = &uart2_data, | 1130 | .dma_mask = &uart2_dmamask, |
895 | .coherent_dma_mask = 0xffffffff, | 1131 | .coherent_dma_mask = DMA_BIT_MASK(32), |
1132 | .platform_data = &uart2_data, | ||
896 | }, | 1133 | }, |
897 | .resource = uart2_resources, | 1134 | .resource = uart2_resources, |
898 | .num_resources = ARRAY_SIZE(uart2_resources), | 1135 | .num_resources = ARRAY_SIZE(uart2_resources), |
899 | }; | 1136 | }; |
900 | 1137 | ||
901 | static inline void configure_usart2_pins(void) | 1138 | static inline void configure_usart2_pins(unsigned pins) |
902 | { | 1139 | { |
903 | at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | 1140 | at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ |
904 | at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | 1141 | at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ |
905 | at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ | 1142 | |
906 | at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ | 1143 | if (pins & ATMEL_UART_RTS) |
1144 | at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ | ||
1145 | if (pins & ATMEL_UART_CTS) | ||
1146 | at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ | ||
907 | } | 1147 | } |
908 | 1148 | ||
909 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1149 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
910 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 1150 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
911 | 1151 | ||
912 | void __init at91_init_serial(struct at91_uart_config *config) | 1152 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
913 | { | 1153 | { |
914 | int i; | 1154 | int i; |
915 | 1155 | ||
@@ -917,17 +1157,17 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
917 | for (i = 0; i < config->nr_tty; i++) { | 1157 | for (i = 0; i < config->nr_tty; i++) { |
918 | switch (config->tty_map[i]) { | 1158 | switch (config->tty_map[i]) { |
919 | case 0: | 1159 | case 0: |
920 | configure_usart0_pins(); | 1160 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
921 | at91_uarts[i] = &at91sam9263_uart0_device; | 1161 | at91_uarts[i] = &at91sam9263_uart0_device; |
922 | at91_clock_associate("usart0_clk", &at91sam9263_uart0_device.dev, "usart"); | 1162 | at91_clock_associate("usart0_clk", &at91sam9263_uart0_device.dev, "usart"); |
923 | break; | 1163 | break; |
924 | case 1: | 1164 | case 1: |
925 | configure_usart1_pins(); | 1165 | configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
926 | at91_uarts[i] = &at91sam9263_uart1_device; | 1166 | at91_uarts[i] = &at91sam9263_uart1_device; |
927 | at91_clock_associate("usart1_clk", &at91sam9263_uart1_device.dev, "usart"); | 1167 | at91_clock_associate("usart1_clk", &at91sam9263_uart1_device.dev, "usart"); |
928 | break; | 1168 | break; |
929 | case 2: | 1169 | case 2: |
930 | configure_usart2_pins(); | 1170 | configure_usart2_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
931 | at91_uarts[i] = &at91sam9263_uart2_device; | 1171 | at91_uarts[i] = &at91sam9263_uart2_device; |
932 | at91_clock_associate("usart2_clk", &at91sam9263_uart2_device.dev, "usart"); | 1172 | at91_clock_associate("usart2_clk", &at91sam9263_uart2_device.dev, "usart"); |
933 | break; | 1173 | break; |
@@ -949,6 +1189,48 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
949 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 1189 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
950 | } | 1190 | } |
951 | 1191 | ||
1192 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
1193 | { | ||
1194 | struct platform_device *pdev; | ||
1195 | |||
1196 | switch (id) { | ||
1197 | case 0: /* DBGU */ | ||
1198 | pdev = &at91sam9263_dbgu_device; | ||
1199 | configure_dbgu_pins(); | ||
1200 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
1201 | break; | ||
1202 | case AT91SAM9263_ID_US0: | ||
1203 | pdev = &at91sam9263_uart0_device; | ||
1204 | configure_usart0_pins(pins); | ||
1205 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
1206 | break; | ||
1207 | case AT91SAM9263_ID_US1: | ||
1208 | pdev = &at91sam9263_uart1_device; | ||
1209 | configure_usart1_pins(pins); | ||
1210 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
1211 | break; | ||
1212 | case AT91SAM9263_ID_US2: | ||
1213 | pdev = &at91sam9263_uart2_device; | ||
1214 | configure_usart2_pins(pins); | ||
1215 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
1216 | break; | ||
1217 | default: | ||
1218 | return; | ||
1219 | } | ||
1220 | pdev->id = portnr; /* update to mapped ID */ | ||
1221 | |||
1222 | if (portnr < ATMEL_MAX_UART) | ||
1223 | at91_uarts[portnr] = pdev; | ||
1224 | } | ||
1225 | |||
1226 | void __init at91_set_serial_console(unsigned portnr) | ||
1227 | { | ||
1228 | if (portnr < ATMEL_MAX_UART) | ||
1229 | atmel_default_console_device = at91_uarts[portnr]; | ||
1230 | if (!atmel_default_console_device) | ||
1231 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1232 | } | ||
1233 | |||
952 | void __init at91_add_device_serial(void) | 1234 | void __init at91_add_device_serial(void) |
953 | { | 1235 | { |
954 | int i; | 1236 | int i; |
@@ -960,6 +1242,8 @@ void __init at91_add_device_serial(void) | |||
960 | } | 1242 | } |
961 | #else | 1243 | #else |
962 | void __init at91_init_serial(struct at91_uart_config *config) {} | 1244 | void __init at91_init_serial(struct at91_uart_config *config) {} |
1245 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1246 | void __init at91_set_serial_console(unsigned portnr) {} | ||
963 | void __init at91_add_device_serial(void) {} | 1247 | void __init at91_add_device_serial(void) {} |
964 | #endif | 1248 | #endif |
965 | 1249 | ||
@@ -971,6 +1255,8 @@ void __init at91_add_device_serial(void) {} | |||
971 | */ | 1255 | */ |
972 | static int __init at91_add_standard_devices(void) | 1256 | static int __init at91_add_standard_devices(void) |
973 | { | 1257 | { |
1258 | at91_add_device_rtt(); | ||
1259 | at91_add_device_watchdog(); | ||
974 | return 0; | 1260 | return 0; |
975 | } | 1261 | } |
976 | 1262 | ||
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 2bd60a3dc623..f43b5c33e45d 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/mach/arch.h> | 9 | #include <asm/mach/arch.h> |
10 | #include <asm/mach/map.h> | 10 | #include <asm/mach/map.h> |
11 | 11 | ||
12 | #include <linux/dma-mapping.h> | ||
12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
13 | #include <linux/i2c-gpio.h> | 14 | #include <linux/i2c-gpio.h> |
14 | 15 | ||
@@ -29,7 +30,7 @@ | |||
29 | * -------------------------------------------------------------------- */ | 30 | * -------------------------------------------------------------------- */ |
30 | 31 | ||
31 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 32 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
32 | static u64 mmc_dmamask = 0xffffffffUL; | 33 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
33 | static struct at91_mmc_data mmc_data; | 34 | static struct at91_mmc_data mmc_data; |
34 | 35 | ||
35 | static struct resource mmc_resources[] = { | 36 | static struct resource mmc_resources[] = { |
@@ -50,7 +51,7 @@ static struct platform_device at91sam9rl_mmc_device = { | |||
50 | .id = -1, | 51 | .id = -1, |
51 | .dev = { | 52 | .dev = { |
52 | .dma_mask = &mmc_dmamask, | 53 | .dma_mask = &mmc_dmamask, |
53 | .coherent_dma_mask = 0xffffffff, | 54 | .coherent_dma_mask = DMA_BIT_MASK(32), |
54 | .platform_data = &mmc_data, | 55 | .platform_data = &mmc_data, |
55 | }, | 56 | }, |
56 | .resource = mmc_resources, | 57 | .resource = mmc_resources, |
@@ -247,7 +248,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
247 | * -------------------------------------------------------------------- */ | 248 | * -------------------------------------------------------------------- */ |
248 | 249 | ||
249 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 250 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
250 | static u64 spi_dmamask = 0xffffffffUL; | 251 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
251 | 252 | ||
252 | static struct resource spi_resources[] = { | 253 | static struct resource spi_resources[] = { |
253 | [0] = { | 254 | [0] = { |
@@ -267,7 +268,7 @@ static struct platform_device at91sam9rl_spi_device = { | |||
267 | .id = 0, | 268 | .id = 0, |
268 | .dev = { | 269 | .dev = { |
269 | .dma_mask = &spi_dmamask, | 270 | .dma_mask = &spi_dmamask, |
270 | .coherent_dma_mask = 0xffffffff, | 271 | .coherent_dma_mask = DMA_BIT_MASK(32), |
271 | }, | 272 | }, |
272 | .resource = spi_resources, | 273 | .resource = spi_resources, |
273 | .num_resources = ARRAY_SIZE(spi_resources), | 274 | .num_resources = ARRAY_SIZE(spi_resources), |
@@ -312,7 +313,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
312 | * -------------------------------------------------------------------- */ | 313 | * -------------------------------------------------------------------- */ |
313 | 314 | ||
314 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 315 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
315 | static u64 lcdc_dmamask = 0xffffffffUL; | 316 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); |
316 | static struct atmel_lcdfb_info lcdc_data; | 317 | static struct atmel_lcdfb_info lcdc_data; |
317 | 318 | ||
318 | static struct resource lcdc_resources[] = { | 319 | static struct resource lcdc_resources[] = { |
@@ -340,7 +341,7 @@ static struct platform_device at91_lcdc_device = { | |||
340 | .id = 0, | 341 | .id = 0, |
341 | .dev = { | 342 | .dev = { |
342 | .dma_mask = &lcdc_dmamask, | 343 | .dma_mask = &lcdc_dmamask, |
343 | .coherent_dma_mask = 0xffffffff, | 344 | .coherent_dma_mask = DMA_BIT_MASK(32), |
344 | .platform_data = &lcdc_data, | 345 | .platform_data = &lcdc_data, |
345 | }, | 346 | }, |
346 | .resource = lcdc_resources, | 347 | .resource = lcdc_resources, |
@@ -384,24 +385,196 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
384 | 385 | ||
385 | 386 | ||
386 | /* -------------------------------------------------------------------- | 387 | /* -------------------------------------------------------------------- |
387 | * LEDs | 388 | * RTC |
388 | * -------------------------------------------------------------------- */ | 389 | * -------------------------------------------------------------------- */ |
389 | 390 | ||
390 | #if defined(CONFIG_LEDS) | 391 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) |
391 | u8 at91_leds_cpu; | 392 | static struct platform_device at91sam9rl_rtc_device = { |
392 | u8 at91_leds_timer; | 393 | .name = "at91_rtc", |
394 | .id = -1, | ||
395 | .num_resources = 0, | ||
396 | }; | ||
393 | 397 | ||
394 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 398 | static void __init at91_add_device_rtc(void) |
395 | { | 399 | { |
396 | /* Enable GPIO to access the LEDs */ | 400 | platform_device_register(&at91sam9rl_rtc_device); |
397 | at91_set_gpio_output(cpu_led, 1); | 401 | } |
398 | at91_set_gpio_output(timer_led, 1); | 402 | #else |
403 | static void __init at91_add_device_rtc(void) {} | ||
404 | #endif | ||
405 | |||
406 | |||
407 | /* -------------------------------------------------------------------- | ||
408 | * RTT | ||
409 | * -------------------------------------------------------------------- */ | ||
410 | |||
411 | static struct resource rtt_resources[] = { | ||
412 | { | ||
413 | .start = AT91_BASE_SYS + AT91_RTT, | ||
414 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
415 | .flags = IORESOURCE_MEM, | ||
416 | } | ||
417 | }; | ||
418 | |||
419 | static struct platform_device at91sam9rl_rtt_device = { | ||
420 | .name = "at91_rtt", | ||
421 | .id = -1, | ||
422 | .resource = rtt_resources, | ||
423 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
424 | }; | ||
399 | 425 | ||
400 | at91_leds_cpu = cpu_led; | 426 | static void __init at91_add_device_rtt(void) |
401 | at91_leds_timer = timer_led; | 427 | { |
428 | platform_device_register(&at91sam9rl_rtt_device); | ||
429 | } | ||
430 | |||
431 | |||
432 | /* -------------------------------------------------------------------- | ||
433 | * Watchdog | ||
434 | * -------------------------------------------------------------------- */ | ||
435 | |||
436 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
437 | static struct platform_device at91sam9rl_wdt_device = { | ||
438 | .name = "at91_wdt", | ||
439 | .id = -1, | ||
440 | .num_resources = 0, | ||
441 | }; | ||
442 | |||
443 | static void __init at91_add_device_watchdog(void) | ||
444 | { | ||
445 | platform_device_register(&at91sam9rl_wdt_device); | ||
402 | } | 446 | } |
403 | #else | 447 | #else |
404 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 448 | static void __init at91_add_device_watchdog(void) {} |
449 | #endif | ||
450 | |||
451 | |||
452 | /* -------------------------------------------------------------------- | ||
453 | * SSC -- Synchronous Serial Controller | ||
454 | * -------------------------------------------------------------------- */ | ||
455 | |||
456 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
457 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
458 | |||
459 | static struct resource ssc0_resources[] = { | ||
460 | [0] = { | ||
461 | .start = AT91SAM9RL_BASE_SSC0, | ||
462 | .end = AT91SAM9RL_BASE_SSC0 + SZ_16K - 1, | ||
463 | .flags = IORESOURCE_MEM, | ||
464 | }, | ||
465 | [1] = { | ||
466 | .start = AT91SAM9RL_ID_SSC0, | ||
467 | .end = AT91SAM9RL_ID_SSC0, | ||
468 | .flags = IORESOURCE_IRQ, | ||
469 | }, | ||
470 | }; | ||
471 | |||
472 | static struct platform_device at91sam9rl_ssc0_device = { | ||
473 | .name = "ssc", | ||
474 | .id = 0, | ||
475 | .dev = { | ||
476 | .dma_mask = &ssc0_dmamask, | ||
477 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
478 | }, | ||
479 | .resource = ssc0_resources, | ||
480 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
481 | }; | ||
482 | |||
483 | static inline void configure_ssc0_pins(unsigned pins) | ||
484 | { | ||
485 | if (pins & ATMEL_SSC_TF) | ||
486 | at91_set_A_periph(AT91_PIN_PC0, 1); | ||
487 | if (pins & ATMEL_SSC_TK) | ||
488 | at91_set_A_periph(AT91_PIN_PC1, 1); | ||
489 | if (pins & ATMEL_SSC_TD) | ||
490 | at91_set_A_periph(AT91_PIN_PA15, 1); | ||
491 | if (pins & ATMEL_SSC_RD) | ||
492 | at91_set_A_periph(AT91_PIN_PA16, 1); | ||
493 | if (pins & ATMEL_SSC_RK) | ||
494 | at91_set_B_periph(AT91_PIN_PA10, 1); | ||
495 | if (pins & ATMEL_SSC_RF) | ||
496 | at91_set_B_periph(AT91_PIN_PA22, 1); | ||
497 | } | ||
498 | |||
499 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
500 | |||
501 | static struct resource ssc1_resources[] = { | ||
502 | [0] = { | ||
503 | .start = AT91SAM9RL_BASE_SSC1, | ||
504 | .end = AT91SAM9RL_BASE_SSC1 + SZ_16K - 1, | ||
505 | .flags = IORESOURCE_MEM, | ||
506 | }, | ||
507 | [1] = { | ||
508 | .start = AT91SAM9RL_ID_SSC1, | ||
509 | .end = AT91SAM9RL_ID_SSC1, | ||
510 | .flags = IORESOURCE_IRQ, | ||
511 | }, | ||
512 | }; | ||
513 | |||
514 | static struct platform_device at91sam9rl_ssc1_device = { | ||
515 | .name = "ssc", | ||
516 | .id = 1, | ||
517 | .dev = { | ||
518 | .dma_mask = &ssc1_dmamask, | ||
519 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
520 | }, | ||
521 | .resource = ssc1_resources, | ||
522 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
523 | }; | ||
524 | |||
525 | static inline void configure_ssc1_pins(unsigned pins) | ||
526 | { | ||
527 | if (pins & ATMEL_SSC_TF) | ||
528 | at91_set_B_periph(AT91_PIN_PA29, 1); | ||
529 | if (pins & ATMEL_SSC_TK) | ||
530 | at91_set_B_periph(AT91_PIN_PA30, 1); | ||
531 | if (pins & ATMEL_SSC_TD) | ||
532 | at91_set_B_periph(AT91_PIN_PA13, 1); | ||
533 | if (pins & ATMEL_SSC_RD) | ||
534 | at91_set_B_periph(AT91_PIN_PA14, 1); | ||
535 | if (pins & ATMEL_SSC_RK) | ||
536 | at91_set_B_periph(AT91_PIN_PA9, 1); | ||
537 | if (pins & ATMEL_SSC_RF) | ||
538 | at91_set_B_periph(AT91_PIN_PA8, 1); | ||
539 | } | ||
540 | |||
541 | /* | ||
542 | * Return the device node so that board init code can use it as the | ||
543 | * parent for the device node reflecting how it's used on this board. | ||
544 | * | ||
545 | * SSC controllers are accessed through library code, instead of any | ||
546 | * kind of all-singing/all-dancing driver. For example one could be | ||
547 | * used by a particular I2S audio codec's driver, while another one | ||
548 | * on the same system might be used by a custom data capture driver. | ||
549 | */ | ||
550 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
551 | { | ||
552 | struct platform_device *pdev; | ||
553 | |||
554 | /* | ||
555 | * NOTE: caller is responsible for passing information matching | ||
556 | * "pins" to whatever will be using each particular controller. | ||
557 | */ | ||
558 | switch (id) { | ||
559 | case AT91SAM9RL_ID_SSC0: | ||
560 | pdev = &at91sam9rl_ssc0_device; | ||
561 | configure_ssc0_pins(pins); | ||
562 | at91_clock_associate("ssc0_clk", &pdev->dev, "pclk"); | ||
563 | break; | ||
564 | case AT91SAM9RL_ID_SSC1: | ||
565 | pdev = &at91sam9rl_ssc1_device; | ||
566 | configure_ssc1_pins(pins); | ||
567 | at91_clock_associate("ssc1_clk", &pdev->dev, "pclk"); | ||
568 | break; | ||
569 | default: | ||
570 | return; | ||
571 | } | ||
572 | |||
573 | platform_device_register(pdev); | ||
574 | } | ||
575 | |||
576 | #else | ||
577 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
405 | #endif | 578 | #endif |
406 | 579 | ||
407 | 580 | ||
@@ -429,12 +602,15 @@ static struct atmel_uart_data dbgu_data = { | |||
429 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 602 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
430 | }; | 603 | }; |
431 | 604 | ||
605 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
606 | |||
432 | static struct platform_device at91sam9rl_dbgu_device = { | 607 | static struct platform_device at91sam9rl_dbgu_device = { |
433 | .name = "atmel_usart", | 608 | .name = "atmel_usart", |
434 | .id = 0, | 609 | .id = 0, |
435 | .dev = { | 610 | .dev = { |
436 | .platform_data = &dbgu_data, | 611 | .dma_mask = &dbgu_dmamask, |
437 | .coherent_dma_mask = 0xffffffff, | 612 | .coherent_dma_mask = DMA_BIT_MASK(32), |
613 | .platform_data = &dbgu_data, | ||
438 | }, | 614 | }, |
439 | .resource = dbgu_resources, | 615 | .resource = dbgu_resources, |
440 | .num_resources = ARRAY_SIZE(dbgu_resources), | 616 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -464,23 +640,37 @@ static struct atmel_uart_data uart0_data = { | |||
464 | .use_dma_rx = 1, | 640 | .use_dma_rx = 1, |
465 | }; | 641 | }; |
466 | 642 | ||
643 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
644 | |||
467 | static struct platform_device at91sam9rl_uart0_device = { | 645 | static struct platform_device at91sam9rl_uart0_device = { |
468 | .name = "atmel_usart", | 646 | .name = "atmel_usart", |
469 | .id = 1, | 647 | .id = 1, |
470 | .dev = { | 648 | .dev = { |
471 | .platform_data = &uart0_data, | 649 | .dma_mask = &uart0_dmamask, |
472 | .coherent_dma_mask = 0xffffffff, | 650 | .coherent_dma_mask = DMA_BIT_MASK(32), |
651 | .platform_data = &uart0_data, | ||
473 | }, | 652 | }, |
474 | .resource = uart0_resources, | 653 | .resource = uart0_resources, |
475 | .num_resources = ARRAY_SIZE(uart0_resources), | 654 | .num_resources = ARRAY_SIZE(uart0_resources), |
476 | }; | 655 | }; |
477 | 656 | ||
478 | static inline void configure_usart0_pins(void) | 657 | static inline void configure_usart0_pins(unsigned pins) |
479 | { | 658 | { |
480 | at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ | 659 | at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ |
481 | at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ | 660 | at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ |
482 | at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */ | 661 | |
483 | at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */ | 662 | if (pins & ATMEL_UART_RTS) |
663 | at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */ | ||
664 | if (pins & ATMEL_UART_CTS) | ||
665 | at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */ | ||
666 | if (pins & ATMEL_UART_DSR) | ||
667 | at91_set_A_periph(AT91_PIN_PD14, 0); /* DSR0 */ | ||
668 | if (pins & ATMEL_UART_DTR) | ||
669 | at91_set_A_periph(AT91_PIN_PD15, 0); /* DTR0 */ | ||
670 | if (pins & ATMEL_UART_DCD) | ||
671 | at91_set_A_periph(AT91_PIN_PD16, 0); /* DCD0 */ | ||
672 | if (pins & ATMEL_UART_RI) | ||
673 | at91_set_A_periph(AT91_PIN_PD17, 0); /* RI0 */ | ||
484 | } | 674 | } |
485 | 675 | ||
486 | static struct resource uart1_resources[] = { | 676 | static struct resource uart1_resources[] = { |
@@ -501,21 +691,29 @@ static struct atmel_uart_data uart1_data = { | |||
501 | .use_dma_rx = 1, | 691 | .use_dma_rx = 1, |
502 | }; | 692 | }; |
503 | 693 | ||
694 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
695 | |||
504 | static struct platform_device at91sam9rl_uart1_device = { | 696 | static struct platform_device at91sam9rl_uart1_device = { |
505 | .name = "atmel_usart", | 697 | .name = "atmel_usart", |
506 | .id = 2, | 698 | .id = 2, |
507 | .dev = { | 699 | .dev = { |
508 | .platform_data = &uart1_data, | 700 | .dma_mask = &uart1_dmamask, |
509 | .coherent_dma_mask = 0xffffffff, | 701 | .coherent_dma_mask = DMA_BIT_MASK(32), |
702 | .platform_data = &uart1_data, | ||
510 | }, | 703 | }, |
511 | .resource = uart1_resources, | 704 | .resource = uart1_resources, |
512 | .num_resources = ARRAY_SIZE(uart1_resources), | 705 | .num_resources = ARRAY_SIZE(uart1_resources), |
513 | }; | 706 | }; |
514 | 707 | ||
515 | static inline void configure_usart1_pins(void) | 708 | static inline void configure_usart1_pins(unsigned pins) |
516 | { | 709 | { |
517 | at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ | 710 | at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ |
518 | at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ | 711 | at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ |
712 | |||
713 | if (pins & ATMEL_UART_RTS) | ||
714 | at91_set_B_periph(AT91_PIN_PA18, 0); /* RTS1 */ | ||
715 | if (pins & ATMEL_UART_CTS) | ||
716 | at91_set_B_periph(AT91_PIN_PA19, 0); /* CTS1 */ | ||
519 | } | 717 | } |
520 | 718 | ||
521 | static struct resource uart2_resources[] = { | 719 | static struct resource uart2_resources[] = { |
@@ -536,21 +734,29 @@ static struct atmel_uart_data uart2_data = { | |||
536 | .use_dma_rx = 1, | 734 | .use_dma_rx = 1, |
537 | }; | 735 | }; |
538 | 736 | ||
737 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
738 | |||
539 | static struct platform_device at91sam9rl_uart2_device = { | 739 | static struct platform_device at91sam9rl_uart2_device = { |
540 | .name = "atmel_usart", | 740 | .name = "atmel_usart", |
541 | .id = 3, | 741 | .id = 3, |
542 | .dev = { | 742 | .dev = { |
543 | .platform_data = &uart2_data, | 743 | .dma_mask = &uart2_dmamask, |
544 | .coherent_dma_mask = 0xffffffff, | 744 | .coherent_dma_mask = DMA_BIT_MASK(32), |
745 | .platform_data = &uart2_data, | ||
545 | }, | 746 | }, |
546 | .resource = uart2_resources, | 747 | .resource = uart2_resources, |
547 | .num_resources = ARRAY_SIZE(uart2_resources), | 748 | .num_resources = ARRAY_SIZE(uart2_resources), |
548 | }; | 749 | }; |
549 | 750 | ||
550 | static inline void configure_usart2_pins(void) | 751 | static inline void configure_usart2_pins(unsigned pins) |
551 | { | 752 | { |
552 | at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ | 753 | at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ |
553 | at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ | 754 | at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ |
755 | |||
756 | if (pins & ATMEL_UART_RTS) | ||
757 | at91_set_A_periph(AT91_PIN_PA29, 0); /* RTS2 */ | ||
758 | if (pins & ATMEL_UART_CTS) | ||
759 | at91_set_A_periph(AT91_PIN_PA30, 0); /* CTS2 */ | ||
554 | } | 760 | } |
555 | 761 | ||
556 | static struct resource uart3_resources[] = { | 762 | static struct resource uart3_resources[] = { |
@@ -571,27 +777,35 @@ static struct atmel_uart_data uart3_data = { | |||
571 | .use_dma_rx = 1, | 777 | .use_dma_rx = 1, |
572 | }; | 778 | }; |
573 | 779 | ||
780 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | ||
781 | |||
574 | static struct platform_device at91sam9rl_uart3_device = { | 782 | static struct platform_device at91sam9rl_uart3_device = { |
575 | .name = "atmel_usart", | 783 | .name = "atmel_usart", |
576 | .id = 4, | 784 | .id = 4, |
577 | .dev = { | 785 | .dev = { |
578 | .platform_data = &uart3_data, | 786 | .dma_mask = &uart3_dmamask, |
579 | .coherent_dma_mask = 0xffffffff, | 787 | .coherent_dma_mask = DMA_BIT_MASK(32), |
788 | .platform_data = &uart3_data, | ||
580 | }, | 789 | }, |
581 | .resource = uart3_resources, | 790 | .resource = uart3_resources, |
582 | .num_resources = ARRAY_SIZE(uart3_resources), | 791 | .num_resources = ARRAY_SIZE(uart3_resources), |
583 | }; | 792 | }; |
584 | 793 | ||
585 | static inline void configure_usart3_pins(void) | 794 | static inline void configure_usart3_pins(unsigned pins) |
586 | { | 795 | { |
587 | at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */ | 796 | at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */ |
588 | at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */ | 797 | at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */ |
798 | |||
799 | if (pins & ATMEL_UART_RTS) | ||
800 | at91_set_B_periph(AT91_PIN_PD4, 0); /* RTS3 */ | ||
801 | if (pins & ATMEL_UART_CTS) | ||
802 | at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */ | ||
589 | } | 803 | } |
590 | 804 | ||
591 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 805 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
592 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 806 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
593 | 807 | ||
594 | void __init at91_init_serial(struct at91_uart_config *config) | 808 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
595 | { | 809 | { |
596 | int i; | 810 | int i; |
597 | 811 | ||
@@ -599,22 +813,22 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
599 | for (i = 0; i < config->nr_tty; i++) { | 813 | for (i = 0; i < config->nr_tty; i++) { |
600 | switch (config->tty_map[i]) { | 814 | switch (config->tty_map[i]) { |
601 | case 0: | 815 | case 0: |
602 | configure_usart0_pins(); | 816 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
603 | at91_uarts[i] = &at91sam9rl_uart0_device; | 817 | at91_uarts[i] = &at91sam9rl_uart0_device; |
604 | at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart"); | 818 | at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart"); |
605 | break; | 819 | break; |
606 | case 1: | 820 | case 1: |
607 | configure_usart1_pins(); | 821 | configure_usart1_pins(0); |
608 | at91_uarts[i] = &at91sam9rl_uart1_device; | 822 | at91_uarts[i] = &at91sam9rl_uart1_device; |
609 | at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart"); | 823 | at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart"); |
610 | break; | 824 | break; |
611 | case 2: | 825 | case 2: |
612 | configure_usart2_pins(); | 826 | configure_usart2_pins(0); |
613 | at91_uarts[i] = &at91sam9rl_uart2_device; | 827 | at91_uarts[i] = &at91sam9rl_uart2_device; |
614 | at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart"); | 828 | at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart"); |
615 | break; | 829 | break; |
616 | case 3: | 830 | case 3: |
617 | configure_usart3_pins(); | 831 | configure_usart3_pins(0); |
618 | at91_uarts[i] = &at91sam9rl_uart3_device; | 832 | at91_uarts[i] = &at91sam9rl_uart3_device; |
619 | at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart"); | 833 | at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart"); |
620 | break; | 834 | break; |
@@ -636,6 +850,53 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
636 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 850 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
637 | } | 851 | } |
638 | 852 | ||
853 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
854 | { | ||
855 | struct platform_device *pdev; | ||
856 | |||
857 | switch (id) { | ||
858 | case 0: /* DBGU */ | ||
859 | pdev = &at91sam9rl_dbgu_device; | ||
860 | configure_dbgu_pins(); | ||
861 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
862 | break; | ||
863 | case AT91SAM9RL_ID_US0: | ||
864 | pdev = &at91sam9rl_uart0_device; | ||
865 | configure_usart0_pins(pins); | ||
866 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
867 | break; | ||
868 | case AT91SAM9RL_ID_US1: | ||
869 | pdev = &at91sam9rl_uart1_device; | ||
870 | configure_usart1_pins(pins); | ||
871 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
872 | break; | ||
873 | case AT91SAM9RL_ID_US2: | ||
874 | pdev = &at91sam9rl_uart2_device; | ||
875 | configure_usart2_pins(pins); | ||
876 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
877 | break; | ||
878 | case AT91SAM9RL_ID_US3: | ||
879 | pdev = &at91sam9rl_uart3_device; | ||
880 | configure_usart3_pins(pins); | ||
881 | at91_clock_associate("usart3_clk", &pdev->dev, "usart"); | ||
882 | break; | ||
883 | default: | ||
884 | return; | ||
885 | } | ||
886 | pdev->id = portnr; /* update to mapped ID */ | ||
887 | |||
888 | if (portnr < ATMEL_MAX_UART) | ||
889 | at91_uarts[portnr] = pdev; | ||
890 | } | ||
891 | |||
892 | void __init at91_set_serial_console(unsigned portnr) | ||
893 | { | ||
894 | if (portnr < ATMEL_MAX_UART) | ||
895 | atmel_default_console_device = at91_uarts[portnr]; | ||
896 | if (!atmel_default_console_device) | ||
897 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
898 | } | ||
899 | |||
639 | void __init at91_add_device_serial(void) | 900 | void __init at91_add_device_serial(void) |
640 | { | 901 | { |
641 | int i; | 902 | int i; |
@@ -646,7 +907,9 @@ void __init at91_add_device_serial(void) | |||
646 | } | 907 | } |
647 | } | 908 | } |
648 | #else | 909 | #else |
649 | void __init at91_init_serial(struct at91_uart_config *config) {} | 910 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} |
911 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
912 | void __init at91_set_serial_console(unsigned portnr) {} | ||
650 | void __init at91_add_device_serial(void) {} | 913 | void __init at91_add_device_serial(void) {} |
651 | #endif | 914 | #endif |
652 | 915 | ||
@@ -659,6 +922,9 @@ void __init at91_add_device_serial(void) {} | |||
659 | */ | 922 | */ |
660 | static int __init at91_add_standard_devices(void) | 923 | static int __init at91_add_standard_devices(void) |
661 | { | 924 | { |
925 | at91_add_device_rtc(); | ||
926 | at91_add_device_rtt(); | ||
927 | at91_add_device_watchdog(); | ||
662 | return 0; | 928 | return 0; |
663 | } | 929 | } |
664 | 930 | ||
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c new file mode 100644 index 000000000000..185437131541 --- /dev/null +++ b/arch/arm/mach-at91/board-cap9adk.c | |||
@@ -0,0 +1,359 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91/board-cap9adk.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2005 SAN People | ||
7 | * Copyright (C) 2007 Atmel Corporation. | ||
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/init.h> | ||
26 | #include <linux/mm.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/spi/spi.h> | ||
30 | #include <linux/spi/ads7846.h> | ||
31 | #include <linux/fb.h> | ||
32 | #include <linux/mtd/physmap.h> | ||
33 | |||
34 | #include <video/atmel_lcdc.h> | ||
35 | |||
36 | #include <asm/hardware.h> | ||
37 | #include <asm/setup.h> | ||
38 | #include <asm/mach-types.h> | ||
39 | #include <asm/irq.h> | ||
40 | |||
41 | #include <asm/mach/arch.h> | ||
42 | #include <asm/mach/map.h> | ||
43 | #include <asm/mach/irq.h> | ||
44 | |||
45 | #include <asm/arch/board.h> | ||
46 | #include <asm/arch/gpio.h> | ||
47 | #include <asm/arch/at91cap9_matrix.h> | ||
48 | #include <asm/arch/at91sam926x_mc.h> | ||
49 | |||
50 | #include "generic.h" | ||
51 | |||
52 | |||
53 | static void __init cap9adk_map_io(void) | ||
54 | { | ||
55 | /* Initialize processor: 12 MHz crystal */ | ||
56 | at91cap9_initialize(12000000); | ||
57 | |||
58 | /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */ | ||
59 | at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11); | ||
60 | /* ... POWER LED always on */ | ||
61 | at91_set_gpio_output(AT91_PIN_PC29, 1); | ||
62 | |||
63 | /* Setup the serial ports and console */ | ||
64 | at91_register_uart(0, 0, 0); /* DBGU = ttyS0 */ | ||
65 | at91_set_serial_console(0); | ||
66 | } | ||
67 | |||
68 | static void __init cap9adk_init_irq(void) | ||
69 | { | ||
70 | at91cap9_init_interrupts(NULL); | ||
71 | } | ||
72 | |||
73 | |||
74 | /* | ||
75 | * USB Host port | ||
76 | */ | ||
77 | static struct at91_usbh_data __initdata cap9adk_usbh_data = { | ||
78 | .ports = 2, | ||
79 | }; | ||
80 | |||
81 | |||
82 | /* | ||
83 | * ADS7846 Touchscreen | ||
84 | */ | ||
85 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
86 | static int ads7843_pendown_state(void) | ||
87 | { | ||
88 | return !at91_get_gpio_value(AT91_PIN_PC4); /* Touchscreen PENIRQ */ | ||
89 | } | ||
90 | |||
91 | static struct ads7846_platform_data ads_info = { | ||
92 | .model = 7843, | ||
93 | .x_min = 150, | ||
94 | .x_max = 3830, | ||
95 | .y_min = 190, | ||
96 | .y_max = 3830, | ||
97 | .vref_delay_usecs = 100, | ||
98 | .x_plate_ohms = 450, | ||
99 | .y_plate_ohms = 250, | ||
100 | .pressure_max = 15000, | ||
101 | .debounce_max = 1, | ||
102 | .debounce_rep = 0, | ||
103 | .debounce_tol = (~0), | ||
104 | .get_pendown_state = ads7843_pendown_state, | ||
105 | }; | ||
106 | |||
107 | static void __init cap9adk_add_device_ts(void) | ||
108 | { | ||
109 | at91_set_gpio_input(AT91_PIN_PC4, 1); /* Touchscreen PENIRQ */ | ||
110 | at91_set_gpio_input(AT91_PIN_PC5, 1); /* Touchscreen BUSY */ | ||
111 | } | ||
112 | #else | ||
113 | static void __init cap9adk_add_device_ts(void) {} | ||
114 | #endif | ||
115 | |||
116 | |||
117 | /* | ||
118 | * SPI devices. | ||
119 | */ | ||
120 | static struct spi_board_info cap9adk_spi_devices[] = { | ||
121 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) | ||
122 | { /* DataFlash card */ | ||
123 | .modalias = "mtd_dataflash", | ||
124 | .chip_select = 0, | ||
125 | .max_speed_hz = 15 * 1000 * 1000, | ||
126 | .bus_num = 0, | ||
127 | }, | ||
128 | #endif | ||
129 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
130 | { | ||
131 | .modalias = "ads7846", | ||
132 | .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */ | ||
133 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | ||
134 | .bus_num = 0, | ||
135 | .platform_data = &ads_info, | ||
136 | .irq = AT91_PIN_PC4, | ||
137 | }, | ||
138 | #endif | ||
139 | }; | ||
140 | |||
141 | |||
142 | /* | ||
143 | * MCI (SD/MMC) | ||
144 | */ | ||
145 | static struct at91_mmc_data __initdata cap9adk_mmc_data = { | ||
146 | .wire4 = 1, | ||
147 | // .det_pin = ... not connected | ||
148 | // .wp_pin = ... not connected | ||
149 | // .vcc_pin = ... not connected | ||
150 | }; | ||
151 | |||
152 | |||
153 | /* | ||
154 | * MACB Ethernet device | ||
155 | */ | ||
156 | static struct at91_eth_data __initdata cap9adk_macb_data = { | ||
157 | .is_rmii = 1, | ||
158 | }; | ||
159 | |||
160 | |||
161 | /* | ||
162 | * NAND flash | ||
163 | */ | ||
164 | static struct mtd_partition __initdata cap9adk_nand_partitions[] = { | ||
165 | { | ||
166 | .name = "NAND partition", | ||
167 | .offset = 0, | ||
168 | .size = MTDPART_SIZ_FULL, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) | ||
173 | { | ||
174 | *num_partitions = ARRAY_SIZE(cap9adk_nand_partitions); | ||
175 | return cap9adk_nand_partitions; | ||
176 | } | ||
177 | |||
178 | static struct at91_nand_data __initdata cap9adk_nand_data = { | ||
179 | .ale = 21, | ||
180 | .cle = 22, | ||
181 | // .det_pin = ... not connected | ||
182 | // .rdy_pin = ... not connected | ||
183 | .enable_pin = AT91_PIN_PD15, | ||
184 | .partition_info = nand_partitions, | ||
185 | #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) | ||
186 | .bus_width_16 = 1, | ||
187 | #else | ||
188 | .bus_width_16 = 0, | ||
189 | #endif | ||
190 | }; | ||
191 | |||
192 | |||
193 | /* | ||
194 | * NOR flash | ||
195 | */ | ||
196 | static struct mtd_partition cap9adk_nor_partitions[] = { | ||
197 | { | ||
198 | .name = "NOR partition", | ||
199 | .offset = 0, | ||
200 | .size = MTDPART_SIZ_FULL, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct physmap_flash_data cap9adk_nor_data = { | ||
205 | .width = 2, | ||
206 | .parts = cap9adk_nor_partitions, | ||
207 | .nr_parts = ARRAY_SIZE(cap9adk_nor_partitions), | ||
208 | }; | ||
209 | |||
210 | #define NOR_BASE AT91_CHIPSELECT_0 | ||
211 | #define NOR_SIZE 0x800000 | ||
212 | |||
213 | static struct resource nor_flash_resources[] = { | ||
214 | { | ||
215 | .start = NOR_BASE, | ||
216 | .end = NOR_BASE + NOR_SIZE - 1, | ||
217 | .flags = IORESOURCE_MEM, | ||
218 | } | ||
219 | }; | ||
220 | |||
221 | static struct platform_device cap9adk_nor_flash = { | ||
222 | .name = "physmap-flash", | ||
223 | .id = 0, | ||
224 | .dev = { | ||
225 | .platform_data = &cap9adk_nor_data, | ||
226 | }, | ||
227 | .resource = nor_flash_resources, | ||
228 | .num_resources = ARRAY_SIZE(nor_flash_resources), | ||
229 | }; | ||
230 | |||
231 | static __init void cap9adk_add_device_nor(void) | ||
232 | { | ||
233 | unsigned long csa; | ||
234 | |||
235 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
236 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | ||
237 | |||
238 | /* set the bus interface characteristics */ | ||
239 | at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2) | ||
240 | | AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2)); | ||
241 | |||
242 | at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10) | ||
243 | | AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10)); | ||
244 | |||
245 | at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16)); | ||
246 | |||
247 | at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | ||
248 | | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | ||
249 | | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1)); | ||
250 | |||
251 | platform_device_register(&cap9adk_nor_flash); | ||
252 | } | ||
253 | |||
254 | |||
255 | /* | ||
256 | * LCD Controller | ||
257 | */ | ||
258 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | ||
259 | static struct fb_videomode at91_tft_vga_modes[] = { | ||
260 | { | ||
261 | .name = "TX09D50VM1CCA @ 60", | ||
262 | .refresh = 60, | ||
263 | .xres = 240, .yres = 320, | ||
264 | .pixclock = KHZ2PICOS(4965), | ||
265 | |||
266 | .left_margin = 1, .right_margin = 33, | ||
267 | .upper_margin = 1, .lower_margin = 0, | ||
268 | .hsync_len = 5, .vsync_len = 1, | ||
269 | |||
270 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
271 | .vmode = FB_VMODE_NONINTERLACED, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | static struct fb_monspecs at91fb_default_monspecs = { | ||
276 | .manufacturer = "HIT", | ||
277 | .monitor = "TX09D70VM1CCA", | ||
278 | |||
279 | .modedb = at91_tft_vga_modes, | ||
280 | .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), | ||
281 | .hfmin = 15000, | ||
282 | .hfmax = 64000, | ||
283 | .vfmin = 50, | ||
284 | .vfmax = 150, | ||
285 | }; | ||
286 | |||
287 | #define AT91CAP9_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | ||
288 | | ATMEL_LCDC_DISTYPE_TFT \ | ||
289 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) | ||
290 | |||
291 | static void at91_lcdc_power_control(int on) | ||
292 | { | ||
293 | if (on) | ||
294 | at91_set_gpio_value(AT91_PIN_PC0, 0); /* power up */ | ||
295 | else | ||
296 | at91_set_gpio_value(AT91_PIN_PC0, 1); /* power down */ | ||
297 | } | ||
298 | |||
299 | /* Driver datas */ | ||
300 | static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data = { | ||
301 | .default_bpp = 16, | ||
302 | .default_dmacon = ATMEL_LCDC_DMAEN, | ||
303 | .default_lcdcon2 = AT91CAP9_DEFAULT_LCDCON2, | ||
304 | .default_monspecs = &at91fb_default_monspecs, | ||
305 | .atmel_lcdfb_power_control = at91_lcdc_power_control, | ||
306 | .guard_time = 1, | ||
307 | }; | ||
308 | |||
309 | #else | ||
310 | static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data; | ||
311 | #endif | ||
312 | |||
313 | |||
314 | /* | ||
315 | * AC97 | ||
316 | */ | ||
317 | static struct atmel_ac97_data cap9adk_ac97_data = { | ||
318 | // .reset_pin = ... not connected | ||
319 | }; | ||
320 | |||
321 | |||
322 | static void __init cap9adk_board_init(void) | ||
323 | { | ||
324 | /* Serial */ | ||
325 | at91_add_device_serial(); | ||
326 | /* USB Host */ | ||
327 | set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH); | ||
328 | at91_add_device_usbh(&cap9adk_usbh_data); | ||
329 | /* SPI */ | ||
330 | at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices)); | ||
331 | /* Touchscreen */ | ||
332 | cap9adk_add_device_ts(); | ||
333 | /* MMC */ | ||
334 | at91_add_device_mmc(1, &cap9adk_mmc_data); | ||
335 | /* Ethernet */ | ||
336 | at91_add_device_eth(&cap9adk_macb_data); | ||
337 | /* NAND */ | ||
338 | at91_add_device_nand(&cap9adk_nand_data); | ||
339 | /* NOR Flash */ | ||
340 | cap9adk_add_device_nor(); | ||
341 | /* I2C */ | ||
342 | at91_add_device_i2c(NULL, 0); | ||
343 | /* LCD Controller */ | ||
344 | set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH); | ||
345 | at91_add_device_lcdc(&cap9adk_lcdc_data); | ||
346 | /* AC97 */ | ||
347 | at91_add_device_ac97(&cap9adk_ac97_data); | ||
348 | } | ||
349 | |||
350 | MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK") | ||
351 | /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */ | ||
352 | .phys_io = AT91_BASE_SYS, | ||
353 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | ||
354 | .boot_params = AT91_SDRAM_BASE + 0x100, | ||
355 | .timer = &at91sam926x_timer, | ||
356 | .map_io = cap9adk_map_io, | ||
357 | .init_irq = cap9adk_init_irq, | ||
358 | .init_machine = cap9adk_board_init, | ||
359 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index d0aa20c9383e..0e2a11fc5bbd 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/input.h> | ||
29 | #include <linux/gpio_keys.h> | ||
28 | 30 | ||
29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
30 | #include <asm/setup.h> | 32 | #include <asm/setup.h> |
@@ -156,6 +158,85 @@ static struct platform_device csb_flash = { | |||
156 | .num_resources = ARRAY_SIZE(csb_flash_resources), | 158 | .num_resources = ARRAY_SIZE(csb_flash_resources), |
157 | }; | 159 | }; |
158 | 160 | ||
161 | /* | ||
162 | * GPIO Buttons (on CSB300) | ||
163 | */ | ||
164 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
165 | static struct gpio_keys_button csb300_buttons[] = { | ||
166 | { | ||
167 | .gpio = AT91_PIN_PB29, | ||
168 | .code = BTN_0, | ||
169 | .desc = "sw0", | ||
170 | .active_low = 1, | ||
171 | .wakeup = 1, | ||
172 | }, | ||
173 | { | ||
174 | .gpio = AT91_PIN_PB28, | ||
175 | .code = BTN_1, | ||
176 | .desc = "sw1", | ||
177 | .active_low = 1, | ||
178 | .wakeup = 1, | ||
179 | }, | ||
180 | { | ||
181 | .gpio = AT91_PIN_PA21, | ||
182 | .code = BTN_2, | ||
183 | .desc = "sw2", | ||
184 | .active_low = 1, | ||
185 | .wakeup = 1, | ||
186 | } | ||
187 | }; | ||
188 | |||
189 | static struct gpio_keys_platform_data csb300_button_data = { | ||
190 | .buttons = csb300_buttons, | ||
191 | .nbuttons = ARRAY_SIZE(csb300_buttons), | ||
192 | }; | ||
193 | |||
194 | static struct platform_device csb300_button_device = { | ||
195 | .name = "gpio-keys", | ||
196 | .id = -1, | ||
197 | .num_resources = 0, | ||
198 | .dev = { | ||
199 | .platform_data = &csb300_button_data, | ||
200 | } | ||
201 | }; | ||
202 | |||
203 | static void __init csb300_add_device_buttons(void) | ||
204 | { | ||
205 | at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */ | ||
206 | at91_set_deglitch(AT91_PIN_PB29, 1); | ||
207 | at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */ | ||
208 | at91_set_deglitch(AT91_PIN_PB28, 1); | ||
209 | at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */ | ||
210 | at91_set_deglitch(AT91_PIN_PA21, 1); | ||
211 | |||
212 | platform_device_register(&csb300_button_device); | ||
213 | } | ||
214 | #else | ||
215 | static void __init csb300_add_device_buttons(void) {} | ||
216 | #endif | ||
217 | |||
218 | static struct gpio_led csb_leds[] = { | ||
219 | { /* "led0", yellow */ | ||
220 | .name = "led0", | ||
221 | .gpio = AT91_PIN_PB2, | ||
222 | .active_low = 1, | ||
223 | .default_trigger = "heartbeat", | ||
224 | }, | ||
225 | { /* "led1", green */ | ||
226 | .name = "led1", | ||
227 | .gpio = AT91_PIN_PB1, | ||
228 | .active_low = 1, | ||
229 | .default_trigger = "mmc0", | ||
230 | }, | ||
231 | { /* "led2", yellow */ | ||
232 | .name = "led2", | ||
233 | .gpio = AT91_PIN_PB0, | ||
234 | .active_low = 1, | ||
235 | .default_trigger = "ide-disk", | ||
236 | }, | ||
237 | }; | ||
238 | |||
239 | |||
159 | static void __init csb337_board_init(void) | 240 | static void __init csb337_board_init(void) |
160 | { | 241 | { |
161 | /* Serial */ | 242 | /* Serial */ |
@@ -177,6 +258,10 @@ static void __init csb337_board_init(void) | |||
177 | at91_add_device_mmc(0, &csb337_mmc_data); | 258 | at91_add_device_mmc(0, &csb337_mmc_data); |
178 | /* NOR flash */ | 259 | /* NOR flash */ |
179 | platform_device_register(&csb_flash); | 260 | platform_device_register(&csb_flash); |
261 | /* LEDs */ | ||
262 | at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds)); | ||
263 | /* Switches on CSB300 */ | ||
264 | csb300_add_device_buttons(); | ||
180 | } | 265 | } |
181 | 266 | ||
182 | MACHINE_START(CSB337, "Cogent CSB337") | 267 | MACHINE_START(CSB337, "Cogent CSB337") |
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c index 40c9e4331706..0a897efeba8e 100644 --- a/arch/arm/mach-at91/board-dk.c +++ b/arch/arm/mach-at91/board-dk.c | |||
@@ -183,6 +183,14 @@ static struct platform_device dk_flash = { | |||
183 | .num_resources = 1, | 183 | .num_resources = 1, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static struct gpio_led dk_leds[] = { | ||
187 | { | ||
188 | .name = "led0", | ||
189 | .gpio = AT91_PIN_PB2, | ||
190 | .active_low = 1, | ||
191 | .default_trigger = "heartbeat", | ||
192 | } | ||
193 | }; | ||
186 | 194 | ||
187 | static void __init dk_board_init(void) | 195 | static void __init dk_board_init(void) |
188 | { | 196 | { |
@@ -213,6 +221,8 @@ static void __init dk_board_init(void) | |||
213 | at91_add_device_nand(&dk_nand_data); | 221 | at91_add_device_nand(&dk_nand_data); |
214 | /* NOR Flash */ | 222 | /* NOR Flash */ |
215 | platform_device_register(&dk_flash); | 223 | platform_device_register(&dk_flash); |
224 | /* LEDs */ | ||
225 | at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds)); | ||
216 | /* VGA */ | 226 | /* VGA */ |
217 | // dk_add_device_video(); | 227 | // dk_add_device_video(); |
218 | } | 228 | } |
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c index 53a5ef9e72ee..0574e50a30dd 100644 --- a/arch/arm/mach-at91/board-ek.c +++ b/arch/arm/mach-at91/board-ek.c | |||
@@ -141,6 +141,25 @@ static struct platform_device ek_flash = { | |||
141 | .num_resources = 1, | 141 | .num_resources = 1, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct gpio_led ek_leds[] = { | ||
145 | { /* "user led 1", DS2 */ | ||
146 | .name = "green", | ||
147 | .gpio = AT91_PIN_PB0, | ||
148 | .active_low = 1, | ||
149 | .default_trigger = "mmc0", | ||
150 | }, | ||
151 | { /* "user led 2", DS4 */ | ||
152 | .name = "yellow", | ||
153 | .gpio = AT91_PIN_PB1, | ||
154 | .active_low = 1, | ||
155 | .default_trigger = "heartbeat", | ||
156 | }, | ||
157 | { /* "user led 3", DS6 */ | ||
158 | .name = "red", | ||
159 | .gpio = AT91_PIN_PB2, | ||
160 | .active_low = 1, | ||
161 | } | ||
162 | }; | ||
144 | 163 | ||
145 | static void __init ek_board_init(void) | 164 | static void __init ek_board_init(void) |
146 | { | 165 | { |
@@ -167,6 +186,8 @@ static void __init ek_board_init(void) | |||
167 | #endif | 186 | #endif |
168 | /* NOR Flash */ | 187 | /* NOR Flash */ |
169 | platform_device_register(&ek_flash); | 188 | platform_device_register(&ek_flash); |
189 | /* LEDs */ | ||
190 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
170 | /* VGA */ | 191 | /* VGA */ |
171 | // ek_add_device_video(); | 192 | // ek_add_device_video(); |
172 | } | 193 | } |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 550ae59a3aca..aa29ea58ca09 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -280,6 +280,68 @@ static struct spi_board_info ek_spi_devices[] = { | |||
280 | * LCD Controller | 280 | * LCD Controller |
281 | */ | 281 | */ |
282 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 282 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
283 | |||
284 | #if defined(CONFIG_FB_ATMEL_STN) | ||
285 | |||
286 | /* STN */ | ||
287 | static struct fb_videomode at91_stn_modes[] = { | ||
288 | { | ||
289 | .name = "SP06Q002 @ 75", | ||
290 | .refresh = 75, | ||
291 | .xres = 320, .yres = 240, | ||
292 | .pixclock = KHZ2PICOS(1440), | ||
293 | |||
294 | .left_margin = 1, .right_margin = 1, | ||
295 | .upper_margin = 0, .lower_margin = 0, | ||
296 | .hsync_len = 1, .vsync_len = 1, | ||
297 | |||
298 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
299 | .vmode = FB_VMODE_NONINTERLACED, | ||
300 | }, | ||
301 | }; | ||
302 | |||
303 | static struct fb_monspecs at91fb_default_stn_monspecs = { | ||
304 | .manufacturer = "HIT", | ||
305 | .monitor = "SP06Q002", | ||
306 | |||
307 | .modedb = at91_stn_modes, | ||
308 | .modedb_len = ARRAY_SIZE(at91_stn_modes), | ||
309 | .hfmin = 15000, | ||
310 | .hfmax = 64000, | ||
311 | .vfmin = 50, | ||
312 | .vfmax = 150, | ||
313 | }; | ||
314 | |||
315 | #define AT91SAM9261_DEFAULT_STN_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | ||
316 | | ATMEL_LCDC_DISTYPE_STNMONO \ | ||
317 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \ | ||
318 | | ATMEL_LCDC_IFWIDTH_4 \ | ||
319 | | ATMEL_LCDC_SCANMOD_SINGLE) | ||
320 | |||
321 | static void at91_lcdc_stn_power_control(int on) | ||
322 | { | ||
323 | /* backlight */ | ||
324 | if (on) { /* power up */ | ||
325 | at91_set_gpio_value(AT91_PIN_PC14, 0); | ||
326 | at91_set_gpio_value(AT91_PIN_PC15, 0); | ||
327 | } else { /* power down */ | ||
328 | at91_set_gpio_value(AT91_PIN_PC14, 1); | ||
329 | at91_set_gpio_value(AT91_PIN_PC15, 1); | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { | ||
334 | .default_bpp = 1, | ||
335 | .default_dmacon = ATMEL_LCDC_DMAEN, | ||
336 | .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2, | ||
337 | .default_monspecs = &at91fb_default_stn_monspecs, | ||
338 | .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, | ||
339 | .guard_time = 1, | ||
340 | }; | ||
341 | |||
342 | #else | ||
343 | |||
344 | /* TFT */ | ||
283 | static struct fb_videomode at91_tft_vga_modes[] = { | 345 | static struct fb_videomode at91_tft_vga_modes[] = { |
284 | { | 346 | { |
285 | .name = "TX09D50VM1CCA @ 60", | 347 | .name = "TX09D50VM1CCA @ 60", |
@@ -296,7 +358,7 @@ static struct fb_videomode at91_tft_vga_modes[] = { | |||
296 | }, | 358 | }, |
297 | }; | 359 | }; |
298 | 360 | ||
299 | static struct fb_monspecs at91fb_default_monspecs = { | 361 | static struct fb_monspecs at91fb_default_tft_monspecs = { |
300 | .manufacturer = "HIT", | 362 | .manufacturer = "HIT", |
301 | .monitor = "TX09D50VM1CCA", | 363 | .monitor = "TX09D50VM1CCA", |
302 | 364 | ||
@@ -308,11 +370,11 @@ static struct fb_monspecs at91fb_default_monspecs = { | |||
308 | .vfmax = 150, | 370 | .vfmax = 150, |
309 | }; | 371 | }; |
310 | 372 | ||
311 | #define AT91SAM9261_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | 373 | #define AT91SAM9261_DEFAULT_TFT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ |
312 | | ATMEL_LCDC_DISTYPE_TFT \ | 374 | | ATMEL_LCDC_DISTYPE_TFT \ |
313 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) | 375 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) |
314 | 376 | ||
315 | static void at91_lcdc_power_control(int on) | 377 | static void at91_lcdc_tft_power_control(int on) |
316 | { | 378 | { |
317 | if (on) | 379 | if (on) |
318 | at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ | 380 | at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ |
@@ -320,15 +382,15 @@ static void at91_lcdc_power_control(int on) | |||
320 | at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ | 382 | at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ |
321 | } | 383 | } |
322 | 384 | ||
323 | /* Driver datas */ | ||
324 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { | 385 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { |
325 | .default_bpp = 16, | 386 | .default_bpp = 16, |
326 | .default_dmacon = ATMEL_LCDC_DMAEN, | 387 | .default_dmacon = ATMEL_LCDC_DMAEN, |
327 | .default_lcdcon2 = AT91SAM9261_DEFAULT_LCDCON2, | 388 | .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2, |
328 | .default_monspecs = &at91fb_default_monspecs, | 389 | .default_monspecs = &at91fb_default_tft_monspecs, |
329 | .atmel_lcdfb_power_control = at91_lcdc_power_control, | 390 | .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, |
330 | .guard_time = 1, | 391 | .guard_time = 1, |
331 | }; | 392 | }; |
393 | #endif | ||
332 | 394 | ||
333 | #else | 395 | #else |
334 | static struct atmel_lcdfb_info __initdata ek_lcdc_data; | 396 | static struct atmel_lcdfb_info __initdata ek_lcdc_data; |
@@ -342,25 +404,25 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data; | |||
342 | static struct gpio_keys_button ek_buttons[] = { | 404 | static struct gpio_keys_button ek_buttons[] = { |
343 | { | 405 | { |
344 | .gpio = AT91_PIN_PA27, | 406 | .gpio = AT91_PIN_PA27, |
345 | .keycode = BTN_0, | 407 | .code = BTN_0, |
346 | .desc = "Button 0", | 408 | .desc = "Button 0", |
347 | .active_low = 1, | 409 | .active_low = 1, |
348 | }, | 410 | }, |
349 | { | 411 | { |
350 | .gpio = AT91_PIN_PA26, | 412 | .gpio = AT91_PIN_PA26, |
351 | .keycode = BTN_1, | 413 | .code = BTN_1, |
352 | .desc = "Button 1", | 414 | .desc = "Button 1", |
353 | .active_low = 1, | 415 | .active_low = 1, |
354 | }, | 416 | }, |
355 | { | 417 | { |
356 | .gpio = AT91_PIN_PA25, | 418 | .gpio = AT91_PIN_PA25, |
357 | .keycode = BTN_2, | 419 | .code = BTN_2, |
358 | .desc = "Button 2", | 420 | .desc = "Button 2", |
359 | .active_low = 1, | 421 | .active_low = 1, |
360 | }, | 422 | }, |
361 | { | 423 | { |
362 | .gpio = AT91_PIN_PA24, | 424 | .gpio = AT91_PIN_PA24, |
363 | .keycode = BTN_3, | 425 | .code = BTN_3, |
364 | .desc = "Button 3", | 426 | .desc = "Button 3", |
365 | .active_low = 1, | 427 | .active_low = 1, |
366 | } | 428 | } |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index ab9dcc075454..f09347a86e71 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/spi/spi.h> | 27 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | 28 | #include <linux/spi/ads7846.h> |
29 | #include <linux/fb.h> | 29 | #include <linux/fb.h> |
30 | #include <linux/gpio_keys.h> | ||
31 | #include <linux/input.h> | ||
30 | 32 | ||
31 | #include <video/atmel_lcdc.h> | 33 | #include <video/atmel_lcdc.h> |
32 | 34 | ||
@@ -163,6 +165,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
163 | * MACB Ethernet device | 165 | * MACB Ethernet device |
164 | */ | 166 | */ |
165 | static struct at91_eth_data __initdata ek_macb_data = { | 167 | static struct at91_eth_data __initdata ek_macb_data = { |
168 | .phy_irq_pin = AT91_PIN_PE31, | ||
166 | .is_rmii = 1, | 169 | .is_rmii = 1, |
167 | }; | 170 | }; |
168 | 171 | ||
@@ -264,6 +267,55 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data; | |||
264 | 267 | ||
265 | 268 | ||
266 | /* | 269 | /* |
270 | * GPIO Buttons | ||
271 | */ | ||
272 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
273 | static struct gpio_keys_button ek_buttons[] = { | ||
274 | { /* BP1, "leftclic" */ | ||
275 | .code = BTN_LEFT, | ||
276 | .gpio = AT91_PIN_PC5, | ||
277 | .active_low = 1, | ||
278 | .desc = "left_click", | ||
279 | .wakeup = 1, | ||
280 | }, | ||
281 | { /* BP2, "rightclic" */ | ||
282 | .code = BTN_RIGHT, | ||
283 | .gpio = AT91_PIN_PC4, | ||
284 | .active_low = 1, | ||
285 | .desc = "right_click", | ||
286 | .wakeup = 1, | ||
287 | }, | ||
288 | }; | ||
289 | |||
290 | static struct gpio_keys_platform_data ek_button_data = { | ||
291 | .buttons = ek_buttons, | ||
292 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
293 | }; | ||
294 | |||
295 | static struct platform_device ek_button_device = { | ||
296 | .name = "gpio-keys", | ||
297 | .id = -1, | ||
298 | .num_resources = 0, | ||
299 | .dev = { | ||
300 | .platform_data = &ek_button_data, | ||
301 | } | ||
302 | }; | ||
303 | |||
304 | static void __init ek_add_device_buttons(void) | ||
305 | { | ||
306 | at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */ | ||
307 | at91_set_deglitch(AT91_PIN_PC5, 1); | ||
308 | at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */ | ||
309 | at91_set_deglitch(AT91_PIN_PC4, 1); | ||
310 | |||
311 | platform_device_register(&ek_button_device); | ||
312 | } | ||
313 | #else | ||
314 | static void __init ek_add_device_buttons(void) {} | ||
315 | #endif | ||
316 | |||
317 | |||
318 | /* | ||
267 | * AC97 | 319 | * AC97 |
268 | */ | 320 | */ |
269 | static struct atmel_ac97_data ek_ac97_data = { | 321 | static struct atmel_ac97_data ek_ac97_data = { |
@@ -271,6 +323,30 @@ static struct atmel_ac97_data ek_ac97_data = { | |||
271 | }; | 323 | }; |
272 | 324 | ||
273 | 325 | ||
326 | /* | ||
327 | * LEDs ... these could all be PWM-driven, for variable brightness | ||
328 | */ | ||
329 | static struct gpio_led ek_leds[] = { | ||
330 | { /* "left" led, green, userled1, pwm1 */ | ||
331 | .name = "ds1", | ||
332 | .gpio = AT91_PIN_PB8, | ||
333 | .active_low = 1, | ||
334 | .default_trigger = "mmc0", | ||
335 | }, | ||
336 | { /* "right" led, green, userled2, pwm2 */ | ||
337 | .name = "ds2", | ||
338 | .gpio = AT91_PIN_PC29, | ||
339 | .active_low = 1, | ||
340 | .default_trigger = "nand-disk", | ||
341 | }, | ||
342 | { /* "power" led, yellow, pwm0 */ | ||
343 | .name = "ds3", | ||
344 | .gpio = AT91_PIN_PB7, | ||
345 | .default_trigger = "heartbeat", | ||
346 | }, | ||
347 | }; | ||
348 | |||
349 | |||
274 | static void __init ek_board_init(void) | 350 | static void __init ek_board_init(void) |
275 | { | 351 | { |
276 | /* Serial */ | 352 | /* Serial */ |
@@ -294,8 +370,12 @@ static void __init ek_board_init(void) | |||
294 | at91_add_device_i2c(NULL, 0); | 370 | at91_add_device_i2c(NULL, 0); |
295 | /* LCD Controller */ | 371 | /* LCD Controller */ |
296 | at91_add_device_lcdc(&ek_lcdc_data); | 372 | at91_add_device_lcdc(&ek_lcdc_data); |
373 | /* Push Buttons */ | ||
374 | ek_add_device_buttons(); | ||
297 | /* AC97 */ | 375 | /* AC97 */ |
298 | at91_add_device_ac97(&ek_ac97_data); | 376 | at91_add_device_ac97(&ek_ac97_data); |
377 | /* LEDs */ | ||
378 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
299 | } | 379 | } |
300 | 380 | ||
301 | MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") | 381 | MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 57c3b647ce83..ec76eeaafd45 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -574,6 +574,8 @@ int __init at91_clock_init(unsigned long main_clock) | |||
574 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { | 574 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { |
575 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 575 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
576 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | 576 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; |
577 | } else if (cpu_is_at91cap9()) { | ||
578 | uhpck.pmc_mask = AT91CAP9_PMC_UHP; | ||
577 | } | 579 | } |
578 | at91_sys_write(AT91_CKGR_PLLBR, 0); | 580 | at91_sys_write(AT91_CKGR_PLLBR, 0); |
579 | 581 | ||
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 77d4c0a37842..b5daf7f5e011 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -15,6 +15,7 @@ extern void __init at91sam9261_initialize(unsigned long main_clock); | |||
15 | extern void __init at91sam9263_initialize(unsigned long main_clock); | 15 | extern void __init at91sam9263_initialize(unsigned long main_clock); |
16 | extern void __init at91sam9rl_initialize(unsigned long main_clock); | 16 | extern void __init at91sam9rl_initialize(unsigned long main_clock); |
17 | extern void __init at91x40_initialize(unsigned long main_clock); | 17 | extern void __init at91x40_initialize(unsigned long main_clock); |
18 | extern void __init at91cap9_initialize(unsigned long main_clock); | ||
18 | 19 | ||
19 | /* Interrupts */ | 20 | /* Interrupts */ |
20 | extern void __init at91rm9200_init_interrupts(unsigned int priority[]); | 21 | extern void __init at91rm9200_init_interrupts(unsigned int priority[]); |
@@ -23,6 +24,7 @@ extern void __init at91sam9261_init_interrupts(unsigned int priority[]); | |||
23 | extern void __init at91sam9263_init_interrupts(unsigned int priority[]); | 24 | extern void __init at91sam9263_init_interrupts(unsigned int priority[]); |
24 | extern void __init at91sam9rl_init_interrupts(unsigned int priority[]); | 25 | extern void __init at91sam9rl_init_interrupts(unsigned int priority[]); |
25 | extern void __init at91x40_init_interrupts(unsigned int priority[]); | 26 | extern void __init at91x40_init_interrupts(unsigned int priority[]); |
27 | extern void __init at91cap9_init_interrupts(unsigned int priority[]); | ||
26 | extern void __init at91_aic_init(unsigned int priority[]); | 28 | extern void __init at91_aic_init(unsigned int priority[]); |
27 | 29 | ||
28 | /* Timer */ | 30 | /* Timer */ |
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index aa2d365c93fb..6aeddd68d8af 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <linux/debugfs.h> | ||
17 | #include <linux/seq_file.h> | ||
16 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
17 | #include <linux/list.h> | 19 | #include <linux/list.h> |
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -414,6 +416,66 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
414 | 416 | ||
415 | /*--------------------------------------------------------------------------*/ | 417 | /*--------------------------------------------------------------------------*/ |
416 | 418 | ||
419 | #ifdef CONFIG_DEBUG_FS | ||
420 | |||
421 | static int at91_gpio_show(struct seq_file *s, void *unused) | ||
422 | { | ||
423 | int bank, j; | ||
424 | |||
425 | /* print heading */ | ||
426 | seq_printf(s, "Pin\t"); | ||
427 | for (bank = 0; bank < gpio_banks; bank++) { | ||
428 | seq_printf(s, "PIO%c\t", 'A' + bank); | ||
429 | }; | ||
430 | seq_printf(s, "\n\n"); | ||
431 | |||
432 | /* print pin status */ | ||
433 | for (j = 0; j < 32; j++) { | ||
434 | seq_printf(s, "%i:\t", j); | ||
435 | |||
436 | for (bank = 0; bank < gpio_banks; bank++) { | ||
437 | unsigned pin = PIN_BASE + (32 * bank) + j; | ||
438 | void __iomem *pio = pin_to_controller(pin); | ||
439 | unsigned mask = pin_to_mask(pin); | ||
440 | |||
441 | if (__raw_readl(pio + PIO_PSR) & mask) | ||
442 | seq_printf(s, "GPIO:%s", __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0"); | ||
443 | else | ||
444 | seq_printf(s, "%s", __raw_readl(pio + PIO_ABSR) & mask ? "B" : "A"); | ||
445 | |||
446 | seq_printf(s, "\t"); | ||
447 | } | ||
448 | |||
449 | seq_printf(s, "\n"); | ||
450 | } | ||
451 | |||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | static int at91_gpio_open(struct inode *inode, struct file *file) | ||
456 | { | ||
457 | return single_open(file, at91_gpio_show, NULL); | ||
458 | } | ||
459 | |||
460 | static const struct file_operations at91_gpio_operations = { | ||
461 | .open = at91_gpio_open, | ||
462 | .read = seq_read, | ||
463 | .llseek = seq_lseek, | ||
464 | .release = single_release, | ||
465 | }; | ||
466 | |||
467 | static int __init at91_gpio_debugfs_init(void) | ||
468 | { | ||
469 | /* /sys/kernel/debug/at91_gpio */ | ||
470 | (void) debugfs_create_file("at91_gpio", S_IFREG | S_IRUGO, NULL, NULL, &at91_gpio_operations); | ||
471 | return 0; | ||
472 | } | ||
473 | postcore_initcall(at91_gpio_debugfs_init); | ||
474 | |||
475 | #endif | ||
476 | |||
477 | /*--------------------------------------------------------------------------*/ | ||
478 | |||
417 | /* | 479 | /* |
418 | * Called from the processor-specific init to enable GPIO interrupt support. | 480 | * Called from the processor-specific init to enable GPIO interrupt support. |
419 | */ | 481 | */ |
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index 0d5144973988..9cdcda500fe8 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
@@ -14,11 +14,62 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | 15 | ||
16 | #include <asm/mach-types.h> | 16 | #include <asm/mach-types.h> |
17 | #include <asm/leds.h> | ||
18 | #include <asm/arch/board.h> | 17 | #include <asm/arch/board.h> |
19 | #include <asm/arch/gpio.h> | 18 | #include <asm/arch/gpio.h> |
20 | 19 | ||
21 | 20 | ||
21 | /* ------------------------------------------------------------------------- */ | ||
22 | |||
23 | #if defined(CONFIG_NEW_LEDS) | ||
24 | |||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | /* | ||
28 | * New cross-platform LED support. | ||
29 | */ | ||
30 | |||
31 | static struct gpio_led_platform_data led_data; | ||
32 | |||
33 | static struct platform_device at91_leds = { | ||
34 | .name = "leds-gpio", | ||
35 | .id = -1, | ||
36 | .dev.platform_data = &led_data, | ||
37 | }; | ||
38 | |||
39 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) | ||
40 | { | ||
41 | int i; | ||
42 | |||
43 | if (!nr) | ||
44 | return; | ||
45 | |||
46 | for (i = 0; i < nr; i++) | ||
47 | at91_set_gpio_output(leds[i].gpio, leds[i].active_low); | ||
48 | |||
49 | led_data.leds = leds; | ||
50 | led_data.num_leds = nr; | ||
51 | platform_device_register(&at91_leds); | ||
52 | } | ||
53 | |||
54 | #else | ||
55 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} | ||
56 | #endif | ||
57 | |||
58 | |||
59 | /* ------------------------------------------------------------------------- */ | ||
60 | |||
61 | #if defined(CONFIG_LEDS) | ||
62 | |||
63 | #include <asm/leds.h> | ||
64 | |||
65 | /* | ||
66 | * Old ARM-specific LED framework; not fully functional when generic time is | ||
67 | * in use. | ||
68 | */ | ||
69 | |||
70 | static u8 at91_leds_cpu; | ||
71 | static u8 at91_leds_timer; | ||
72 | |||
22 | static inline void at91_led_on(unsigned int led) | 73 | static inline void at91_led_on(unsigned int led) |
23 | { | 74 | { |
24 | at91_set_gpio_value(led, 0); | 75 | at91_set_gpio_value(led, 0); |
@@ -93,3 +144,18 @@ static int __init leds_init(void) | |||
93 | } | 144 | } |
94 | 145 | ||
95 | __initcall(leds_init); | 146 | __initcall(leds_init); |
147 | |||
148 | |||
149 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
150 | { | ||
151 | /* Enable GPIO to access the LEDs */ | ||
152 | at91_set_gpio_output(cpu_led, 1); | ||
153 | at91_set_gpio_output(timer_led, 1); | ||
154 | |||
155 | at91_leds_cpu = cpu_led; | ||
156 | at91_leds_timer = timer_led; | ||
157 | } | ||
158 | |||
159 | #else | ||
160 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
161 | #endif | ||
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 98cb61482917..4b120cc36135 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -80,6 +80,11 @@ static int at91_pm_verify_clocks(void) | |||
80 | pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); | 80 | pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | } else if (cpu_is_at91cap9()) { | ||
84 | if ((scsr & AT91CAP9_PMC_UHP) != 0) { | ||
85 | pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); | ||
86 | return 0; | ||
87 | } | ||
83 | } | 88 | } |
84 | 89 | ||
85 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS | 90 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS |