Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Atmel Corporation. |
| 3 | * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> |
| 4 | * |
| 5 | * Under GPLv2 |
| 6 | */ |
| 7 | |
| 8 | #include <linux/module.h> |
| 9 | #include <linux/io.h> |
| 10 | |
| 11 | #include <asm/mach/map.h> |
| 12 | |
| 13 | #include <mach/hardware.h> |
| 14 | #include <mach/cpu.h> |
| 15 | |
| 16 | #include "soc.h" |
| 17 | #include "generic.h" |
| 18 | |
| 19 | struct at91_soc __initdata at91_boot_soc; |
| 20 | |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame^] | 21 | void __init at91_init_irq_default(void) |
| 22 | { |
| 23 | at91_init_interrupts(at91_boot_soc.default_irq_priority); |
| 24 | } |
| 25 | |
| 26 | void __init at91_init_interrupts(unsigned int *priority) |
| 27 | { |
| 28 | /* Initialize the AIC interrupt controller */ |
| 29 | at91_aic_init(priority); |
| 30 | |
| 31 | /* Enable GPIO interrupts */ |
| 32 | at91_gpio_irq_setup(); |
| 33 | } |
| 34 | |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 35 | static struct map_desc at91_io_desc __initdata = { |
| 36 | .virtual = AT91_VA_BASE_SYS, |
| 37 | .pfn = __phys_to_pfn(AT91_BASE_SYS), |
| 38 | .length = SZ_16K, |
| 39 | .type = MT_DEVICE, |
| 40 | }; |
| 41 | |
| 42 | void __init at91_map_io(void) |
| 43 | { |
| 44 | /* Map peripherals */ |
| 45 | iotable_init(&at91_io_desc, 1); |
| 46 | |
| 47 | if (cpu_is_at91cap9()) |
| 48 | at91_boot_soc = at91cap9_soc; |
| 49 | else if (cpu_is_at91rm9200()) |
| 50 | at91_boot_soc = at91rm9200_soc; |
| 51 | else if (cpu_is_at91sam9260()) |
| 52 | at91_boot_soc = at91sam9260_soc; |
| 53 | else if (cpu_is_at91sam9261()) |
| 54 | at91_boot_soc = at91sam9261_soc; |
| 55 | else if (cpu_is_at91sam9263()) |
| 56 | at91_boot_soc = at91sam9263_soc; |
| 57 | else if (cpu_is_at91sam9g10()) |
| 58 | at91_boot_soc = at91sam9261_soc; |
| 59 | else if (cpu_is_at91sam9g20()) |
| 60 | at91_boot_soc = at91sam9260_soc; |
| 61 | else if (cpu_is_at91sam9g45()) |
| 62 | at91_boot_soc = at91sam9g45_soc; |
| 63 | else if (cpu_is_at91sam9rl()) |
| 64 | at91_boot_soc = at91sam9rl_soc; |
| 65 | else if (cpu_is_at91sam9x5()) |
| 66 | at91_boot_soc = at91sam9x5_soc; |
| 67 | else |
| 68 | panic("Impossible to detect the SOC type"); |
| 69 | |
| 70 | if (at91_boot_soc.map_io) |
| 71 | at91_boot_soc.map_io(); |
| 72 | } |
| 73 | |
| 74 | void __init at91_initialize(unsigned long main_clock) |
| 75 | { |
| 76 | at91_boot_soc.init(main_clock); |
| 77 | } |