Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 1 | /* |
Andrew Victor | 9d04126 | 2007-02-05 11:42:07 +0100 | [diff] [blame] | 2 | * arch/arm/mach-at91/at91sam9260.c |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2006 SAN People |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <linux/module.h> |
Andrew Victor | 3ef2fb4 | 2008-04-02 21:36:06 +0100 | [diff] [blame] | 14 | #include <linux/pm.h> |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 15 | |
Russell King | 80b02c1 | 2009-01-08 10:01:47 +0000 | [diff] [blame] | 16 | #include <asm/irq.h> |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 17 | #include <asm/mach/arch.h> |
| 18 | #include <asm/mach/map.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 19 | #include <mach/cpu.h> |
| 20 | #include <mach/at91sam9260.h> |
| 21 | #include <mach/at91_pmc.h> |
| 22 | #include <mach/at91_rstc.h> |
| 23 | #include <mach/at91_shdwc.h> |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 24 | |
| 25 | #include "generic.h" |
| 26 | #include "clock.h" |
| 27 | |
| 28 | static struct map_desc at91sam9260_io_desc[] __initdata = { |
| 29 | { |
| 30 | .virtual = AT91_VA_BASE_SYS, |
| 31 | .pfn = __phys_to_pfn(AT91_BASE_SYS), |
| 32 | .length = SZ_16K, |
| 33 | .type = MT_DEVICE, |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 34 | } |
| 35 | }; |
| 36 | |
| 37 | static struct map_desc at91sam9260_sram_desc[] __initdata = { |
| 38 | { |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 39 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE, |
| 40 | .pfn = __phys_to_pfn(AT91SAM9260_SRAM0_BASE), |
| 41 | .length = AT91SAM9260_SRAM0_SIZE, |
| 42 | .type = MT_DEVICE, |
| 43 | }, { |
| 44 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9260_SRAM0_SIZE - AT91SAM9260_SRAM1_SIZE, |
| 45 | .pfn = __phys_to_pfn(AT91SAM9260_SRAM1_BASE), |
| 46 | .length = AT91SAM9260_SRAM1_SIZE, |
| 47 | .type = MT_DEVICE, |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 48 | } |
| 49 | }; |
| 50 | |
sedji gaouaou | 6135266 | 2008-07-10 10:15:35 +0100 | [diff] [blame] | 51 | static struct map_desc at91sam9g20_sram_desc[] __initdata = { |
| 52 | { |
| 53 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE, |
| 54 | .pfn = __phys_to_pfn(AT91SAM9G20_SRAM0_BASE), |
| 55 | .length = AT91SAM9G20_SRAM0_SIZE, |
| 56 | .type = MT_DEVICE, |
| 57 | }, { |
| 58 | .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE - AT91SAM9G20_SRAM1_SIZE, |
| 59 | .pfn = __phys_to_pfn(AT91SAM9G20_SRAM1_BASE), |
| 60 | .length = AT91SAM9G20_SRAM1_SIZE, |
| 61 | .type = MT_DEVICE, |
| 62 | } |
| 63 | }; |
| 64 | |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 65 | static struct map_desc at91sam9xe_sram_desc[] __initdata = { |
| 66 | { |
| 67 | .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE), |
| 68 | .type = MT_DEVICE, |
| 69 | } |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | /* -------------------------------------------------------------------- |
| 73 | * Clocks |
| 74 | * -------------------------------------------------------------------- */ |
| 75 | |
| 76 | /* |
| 77 | * The peripheral clocks. |
| 78 | */ |
| 79 | static struct clk pioA_clk = { |
| 80 | .name = "pioA_clk", |
| 81 | .pmc_mask = 1 << AT91SAM9260_ID_PIOA, |
| 82 | .type = CLK_TYPE_PERIPHERAL, |
| 83 | }; |
| 84 | static struct clk pioB_clk = { |
| 85 | .name = "pioB_clk", |
| 86 | .pmc_mask = 1 << AT91SAM9260_ID_PIOB, |
| 87 | .type = CLK_TYPE_PERIPHERAL, |
| 88 | }; |
| 89 | static struct clk pioC_clk = { |
| 90 | .name = "pioC_clk", |
| 91 | .pmc_mask = 1 << AT91SAM9260_ID_PIOC, |
| 92 | .type = CLK_TYPE_PERIPHERAL, |
| 93 | }; |
| 94 | static struct clk adc_clk = { |
| 95 | .name = "adc_clk", |
| 96 | .pmc_mask = 1 << AT91SAM9260_ID_ADC, |
| 97 | .type = CLK_TYPE_PERIPHERAL, |
| 98 | }; |
| 99 | static struct clk usart0_clk = { |
| 100 | .name = "usart0_clk", |
| 101 | .pmc_mask = 1 << AT91SAM9260_ID_US0, |
| 102 | .type = CLK_TYPE_PERIPHERAL, |
| 103 | }; |
| 104 | static struct clk usart1_clk = { |
| 105 | .name = "usart1_clk", |
| 106 | .pmc_mask = 1 << AT91SAM9260_ID_US1, |
| 107 | .type = CLK_TYPE_PERIPHERAL, |
| 108 | }; |
| 109 | static struct clk usart2_clk = { |
| 110 | .name = "usart2_clk", |
| 111 | .pmc_mask = 1 << AT91SAM9260_ID_US2, |
| 112 | .type = CLK_TYPE_PERIPHERAL, |
| 113 | }; |
| 114 | static struct clk mmc_clk = { |
| 115 | .name = "mci_clk", |
| 116 | .pmc_mask = 1 << AT91SAM9260_ID_MCI, |
| 117 | .type = CLK_TYPE_PERIPHERAL, |
| 118 | }; |
| 119 | static struct clk udc_clk = { |
| 120 | .name = "udc_clk", |
| 121 | .pmc_mask = 1 << AT91SAM9260_ID_UDP, |
| 122 | .type = CLK_TYPE_PERIPHERAL, |
| 123 | }; |
| 124 | static struct clk twi_clk = { |
| 125 | .name = "twi_clk", |
| 126 | .pmc_mask = 1 << AT91SAM9260_ID_TWI, |
| 127 | .type = CLK_TYPE_PERIPHERAL, |
| 128 | }; |
| 129 | static struct clk spi0_clk = { |
| 130 | .name = "spi0_clk", |
| 131 | .pmc_mask = 1 << AT91SAM9260_ID_SPI0, |
| 132 | .type = CLK_TYPE_PERIPHERAL, |
| 133 | }; |
| 134 | static struct clk spi1_clk = { |
| 135 | .name = "spi1_clk", |
| 136 | .pmc_mask = 1 << AT91SAM9260_ID_SPI1, |
| 137 | .type = CLK_TYPE_PERIPHERAL, |
| 138 | }; |
Andrew Victor | e8788ba | 2007-05-02 17:14:57 +0100 | [diff] [blame] | 139 | static struct clk ssc_clk = { |
| 140 | .name = "ssc_clk", |
| 141 | .pmc_mask = 1 << AT91SAM9260_ID_SSC, |
| 142 | .type = CLK_TYPE_PERIPHERAL, |
| 143 | }; |
Andrew Victor | c177a1e | 2007-02-08 10:25:38 +0100 | [diff] [blame] | 144 | static struct clk tc0_clk = { |
| 145 | .name = "tc0_clk", |
| 146 | .pmc_mask = 1 << AT91SAM9260_ID_TC0, |
| 147 | .type = CLK_TYPE_PERIPHERAL, |
| 148 | }; |
| 149 | static struct clk tc1_clk = { |
| 150 | .name = "tc1_clk", |
| 151 | .pmc_mask = 1 << AT91SAM9260_ID_TC1, |
| 152 | .type = CLK_TYPE_PERIPHERAL, |
| 153 | }; |
| 154 | static struct clk tc2_clk = { |
| 155 | .name = "tc2_clk", |
| 156 | .pmc_mask = 1 << AT91SAM9260_ID_TC2, |
| 157 | .type = CLK_TYPE_PERIPHERAL, |
| 158 | }; |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 159 | static struct clk ohci_clk = { |
| 160 | .name = "ohci_clk", |
| 161 | .pmc_mask = 1 << AT91SAM9260_ID_UHP, |
| 162 | .type = CLK_TYPE_PERIPHERAL, |
| 163 | }; |
Andrew Victor | 69b2e99 | 2007-02-14 08:44:43 +0100 | [diff] [blame] | 164 | static struct clk macb_clk = { |
| 165 | .name = "macb_clk", |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 166 | .pmc_mask = 1 << AT91SAM9260_ID_EMAC, |
| 167 | .type = CLK_TYPE_PERIPHERAL, |
| 168 | }; |
| 169 | static struct clk isi_clk = { |
| 170 | .name = "isi_clk", |
| 171 | .pmc_mask = 1 << AT91SAM9260_ID_ISI, |
| 172 | .type = CLK_TYPE_PERIPHERAL, |
| 173 | }; |
| 174 | static struct clk usart3_clk = { |
| 175 | .name = "usart3_clk", |
| 176 | .pmc_mask = 1 << AT91SAM9260_ID_US3, |
| 177 | .type = CLK_TYPE_PERIPHERAL, |
| 178 | }; |
| 179 | static struct clk usart4_clk = { |
| 180 | .name = "usart4_clk", |
| 181 | .pmc_mask = 1 << AT91SAM9260_ID_US4, |
| 182 | .type = CLK_TYPE_PERIPHERAL, |
| 183 | }; |
| 184 | static struct clk usart5_clk = { |
| 185 | .name = "usart5_clk", |
| 186 | .pmc_mask = 1 << AT91SAM9260_ID_US5, |
| 187 | .type = CLK_TYPE_PERIPHERAL, |
| 188 | }; |
Andrew Victor | c177a1e | 2007-02-08 10:25:38 +0100 | [diff] [blame] | 189 | static struct clk tc3_clk = { |
| 190 | .name = "tc3_clk", |
| 191 | .pmc_mask = 1 << AT91SAM9260_ID_TC3, |
| 192 | .type = CLK_TYPE_PERIPHERAL, |
| 193 | }; |
| 194 | static struct clk tc4_clk = { |
| 195 | .name = "tc4_clk", |
| 196 | .pmc_mask = 1 << AT91SAM9260_ID_TC4, |
| 197 | .type = CLK_TYPE_PERIPHERAL, |
| 198 | }; |
| 199 | static struct clk tc5_clk = { |
| 200 | .name = "tc5_clk", |
| 201 | .pmc_mask = 1 << AT91SAM9260_ID_TC5, |
| 202 | .type = CLK_TYPE_PERIPHERAL, |
| 203 | }; |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 204 | |
| 205 | static struct clk *periph_clocks[] __initdata = { |
| 206 | &pioA_clk, |
| 207 | &pioB_clk, |
| 208 | &pioC_clk, |
| 209 | &adc_clk, |
| 210 | &usart0_clk, |
| 211 | &usart1_clk, |
| 212 | &usart2_clk, |
| 213 | &mmc_clk, |
| 214 | &udc_clk, |
| 215 | &twi_clk, |
| 216 | &spi0_clk, |
| 217 | &spi1_clk, |
Andrew Victor | e8788ba | 2007-05-02 17:14:57 +0100 | [diff] [blame] | 218 | &ssc_clk, |
Andrew Victor | c177a1e | 2007-02-08 10:25:38 +0100 | [diff] [blame] | 219 | &tc0_clk, |
| 220 | &tc1_clk, |
| 221 | &tc2_clk, |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 222 | &ohci_clk, |
Andrew Victor | 69b2e99 | 2007-02-14 08:44:43 +0100 | [diff] [blame] | 223 | &macb_clk, |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 224 | &isi_clk, |
| 225 | &usart3_clk, |
| 226 | &usart4_clk, |
| 227 | &usart5_clk, |
Andrew Victor | c177a1e | 2007-02-08 10:25:38 +0100 | [diff] [blame] | 228 | &tc3_clk, |
| 229 | &tc4_clk, |
| 230 | &tc5_clk, |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 231 | // irq0 .. irq2 |
| 232 | }; |
| 233 | |
Jean-Christophe PLAGNIOL-VILLARD | bd60299 | 2011-02-02 07:27:07 +0100 | [diff] [blame^] | 234 | static struct clk_lookup periph_clocks_lookups[] = { |
| 235 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
| 236 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
| 237 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
| 238 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), |
| 239 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), |
| 240 | CLKDEV_CON_DEV_ID("t3_clk", "atmel_tcb.1", &tc3_clk), |
| 241 | CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), |
| 242 | CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), |
| 243 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), |
| 244 | }; |
| 245 | |
| 246 | static struct clk_lookup usart_clocks_lookups[] = { |
| 247 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck), |
| 248 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk), |
| 249 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk), |
| 250 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk), |
| 251 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk), |
| 252 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.5", &usart4_clk), |
| 253 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.6", &usart5_clk), |
| 254 | }; |
| 255 | |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 256 | /* |
| 257 | * The two programmable clocks. |
| 258 | * You must configure pin multiplexing to bring these signals out. |
| 259 | */ |
| 260 | static struct clk pck0 = { |
| 261 | .name = "pck0", |
| 262 | .pmc_mask = AT91_PMC_PCK0, |
| 263 | .type = CLK_TYPE_PROGRAMMABLE, |
| 264 | .id = 0, |
| 265 | }; |
| 266 | static struct clk pck1 = { |
| 267 | .name = "pck1", |
| 268 | .pmc_mask = AT91_PMC_PCK1, |
| 269 | .type = CLK_TYPE_PROGRAMMABLE, |
| 270 | .id = 1, |
| 271 | }; |
| 272 | |
| 273 | static void __init at91sam9260_register_clocks(void) |
| 274 | { |
| 275 | int i; |
| 276 | |
| 277 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) |
| 278 | clk_register(periph_clocks[i]); |
| 279 | |
Jean-Christophe PLAGNIOL-VILLARD | bd60299 | 2011-02-02 07:27:07 +0100 | [diff] [blame^] | 280 | clkdev_add_table(periph_clocks_lookups, |
| 281 | ARRAY_SIZE(periph_clocks_lookups)); |
| 282 | clkdev_add_table(usart_clocks_lookups, |
| 283 | ARRAY_SIZE(usart_clocks_lookups)); |
| 284 | |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 285 | clk_register(&pck0); |
| 286 | clk_register(&pck1); |
| 287 | } |
| 288 | |
Jean-Christophe PLAGNIOL-VILLARD | bd60299 | 2011-02-02 07:27:07 +0100 | [diff] [blame^] | 289 | static struct clk_lookup console_clock_lookup; |
| 290 | |
| 291 | void __init at91sam9260_set_console_clock(int id) |
| 292 | { |
| 293 | if (id >= ARRAY_SIZE(usart_clocks_lookups)) |
| 294 | return; |
| 295 | |
| 296 | console_clock_lookup.con_id = "usart"; |
| 297 | console_clock_lookup.clk = usart_clocks_lookups[id].clk; |
| 298 | clkdev_add(&console_clock_lookup); |
| 299 | } |
| 300 | |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 301 | /* -------------------------------------------------------------------- |
| 302 | * GPIO |
| 303 | * -------------------------------------------------------------------- */ |
| 304 | |
| 305 | static struct at91_gpio_bank at91sam9260_gpio[] = { |
| 306 | { |
| 307 | .id = AT91SAM9260_ID_PIOA, |
| 308 | .offset = AT91_PIOA, |
| 309 | .clock = &pioA_clk, |
| 310 | }, { |
| 311 | .id = AT91SAM9260_ID_PIOB, |
| 312 | .offset = AT91_PIOB, |
| 313 | .clock = &pioB_clk, |
| 314 | }, { |
| 315 | .id = AT91SAM9260_ID_PIOC, |
| 316 | .offset = AT91_PIOC, |
| 317 | .clock = &pioC_clk, |
| 318 | } |
| 319 | }; |
| 320 | |
Andrew Victor | 3ef2fb4 | 2008-04-02 21:36:06 +0100 | [diff] [blame] | 321 | static void at91sam9260_poweroff(void) |
| 322 | { |
| 323 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); |
| 324 | } |
| 325 | |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 326 | |
| 327 | /* -------------------------------------------------------------------- |
| 328 | * AT91SAM9260 processor initialization |
| 329 | * -------------------------------------------------------------------- */ |
| 330 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 331 | static void __init at91sam9xe_map_io(void) |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 332 | { |
| 333 | unsigned long cidr, sram_size; |
| 334 | |
| 335 | cidr = at91_sys_read(AT91_DBGU_CIDR); |
| 336 | |
| 337 | switch (cidr & AT91_CIDR_SRAMSIZ) { |
| 338 | case AT91_CIDR_SRAMSIZ_32K: |
| 339 | sram_size = 2 * SZ_16K; |
| 340 | break; |
| 341 | case AT91_CIDR_SRAMSIZ_16K: |
| 342 | default: |
| 343 | sram_size = SZ_16K; |
| 344 | } |
| 345 | |
| 346 | at91sam9xe_sram_desc->virtual = AT91_IO_VIRT_BASE - sram_size; |
| 347 | at91sam9xe_sram_desc->length = sram_size; |
| 348 | |
| 349 | iotable_init(at91sam9xe_sram_desc, ARRAY_SIZE(at91sam9xe_sram_desc)); |
| 350 | } |
| 351 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 352 | void __init at91sam9260_map_io(void) |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 353 | { |
| 354 | /* Map peripherals */ |
| 355 | iotable_init(at91sam9260_io_desc, ARRAY_SIZE(at91sam9260_io_desc)); |
| 356 | |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 357 | if (cpu_is_at91sam9xe()) |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 358 | at91sam9xe_map_io(); |
sedji gaouaou | 6135266 | 2008-07-10 10:15:35 +0100 | [diff] [blame] | 359 | else if (cpu_is_at91sam9g20()) |
| 360 | iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc)); |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 361 | else |
| 362 | iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 363 | } |
Andrew Victor | f7eee89 | 2007-02-15 08:17:38 +0100 | [diff] [blame] | 364 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 365 | void __init at91sam9260_initialize(unsigned long main_clock) |
| 366 | { |
Nicolas Ferre | bb413db | 2010-10-14 19:14:00 +0200 | [diff] [blame] | 367 | at91_arch_reset = at91sam9_alt_reset; |
Andrew Victor | 3ef2fb4 | 2008-04-02 21:36:06 +0100 | [diff] [blame] | 368 | pm_power_off = at91sam9260_poweroff; |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 369 | at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) |
| 370 | | (1 << AT91SAM9260_ID_IRQ2); |
| 371 | |
| 372 | /* Init clock subsystem */ |
| 373 | at91_clock_init(main_clock); |
| 374 | |
| 375 | /* Register the processor-specific clocks */ |
| 376 | at91sam9260_register_clocks(); |
| 377 | |
| 378 | /* Register GPIO subsystem */ |
| 379 | at91_gpio_init(at91sam9260_gpio, 3); |
| 380 | } |
| 381 | |
| 382 | /* -------------------------------------------------------------------- |
| 383 | * Interrupt initialization |
| 384 | * -------------------------------------------------------------------- */ |
| 385 | |
| 386 | /* |
| 387 | * The default interrupt priority levels (0 = lowest, 7 = highest). |
| 388 | */ |
| 389 | static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { |
| 390 | 7, /* Advanced Interrupt Controller */ |
| 391 | 7, /* System Peripherals */ |
Andrew Victor | 7cbed2b | 2007-11-20 08:46:53 +0100 | [diff] [blame] | 392 | 1, /* Parallel IO Controller A */ |
| 393 | 1, /* Parallel IO Controller B */ |
| 394 | 1, /* Parallel IO Controller C */ |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 395 | 0, /* Analog-to-Digital Converter */ |
Andrew Victor | 7cbed2b | 2007-11-20 08:46:53 +0100 | [diff] [blame] | 396 | 5, /* USART 0 */ |
| 397 | 5, /* USART 1 */ |
| 398 | 5, /* USART 2 */ |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 399 | 0, /* Multimedia Card Interface */ |
Andrew Victor | 7cbed2b | 2007-11-20 08:46:53 +0100 | [diff] [blame] | 400 | 2, /* USB Device Port */ |
| 401 | 6, /* Two-Wire Interface */ |
| 402 | 5, /* Serial Peripheral Interface 0 */ |
| 403 | 5, /* Serial Peripheral Interface 1 */ |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 404 | 5, /* Serial Synchronous Controller */ |
| 405 | 0, |
| 406 | 0, |
| 407 | 0, /* Timer Counter 0 */ |
| 408 | 0, /* Timer Counter 1 */ |
| 409 | 0, /* Timer Counter 2 */ |
Andrew Victor | 7cbed2b | 2007-11-20 08:46:53 +0100 | [diff] [blame] | 410 | 2, /* USB Host port */ |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 411 | 3, /* Ethernet */ |
| 412 | 0, /* Image Sensor Interface */ |
Andrew Victor | 7cbed2b | 2007-11-20 08:46:53 +0100 | [diff] [blame] | 413 | 5, /* USART 3 */ |
| 414 | 5, /* USART 4 */ |
| 415 | 5, /* USART 5 */ |
Andrew Victor | 62c1660 | 2006-11-30 12:27:38 +0100 | [diff] [blame] | 416 | 0, /* Timer Counter 3 */ |
| 417 | 0, /* Timer Counter 4 */ |
| 418 | 0, /* Timer Counter 5 */ |
| 419 | 0, /* Advanced Interrupt Controller */ |
| 420 | 0, /* Advanced Interrupt Controller */ |
| 421 | 0, /* Advanced Interrupt Controller */ |
| 422 | }; |
| 423 | |
| 424 | void __init at91sam9260_init_interrupts(unsigned int priority[NR_AIC_IRQS]) |
| 425 | { |
| 426 | if (!priority) |
| 427 | priority = at91sam9260_default_irq_priority; |
| 428 | |
| 429 | /* Initialize the AIC interrupt controller */ |
| 430 | at91_aic_init(priority); |
| 431 | |
| 432 | /* Enable GPIO interrupts */ |
| 433 | at91_gpio_irq_setup(); |
| 434 | } |