setup.c 1.7 KB

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