setup.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. static struct map_desc at91_io_desc __initdata = {
  16. .virtual = AT91_VA_BASE_SYS,
  17. .pfn = __phys_to_pfn(AT91_BASE_SYS),
  18. .length = SZ_16K,
  19. .type = MT_DEVICE,
  20. };
  21. void __init at91_map_io(void)
  22. {
  23. /* Map peripherals */
  24. iotable_init(&at91_io_desc, 1);
  25. if (cpu_is_at91cap9())
  26. at91_boot_soc = at91cap9_soc;
  27. else if (cpu_is_at91rm9200())
  28. at91_boot_soc = at91rm9200_soc;
  29. else if (cpu_is_at91sam9260())
  30. at91_boot_soc = at91sam9260_soc;
  31. else if (cpu_is_at91sam9261())
  32. at91_boot_soc = at91sam9261_soc;
  33. else if (cpu_is_at91sam9263())
  34. at91_boot_soc = at91sam9263_soc;
  35. else if (cpu_is_at91sam9g10())
  36. at91_boot_soc = at91sam9261_soc;
  37. else if (cpu_is_at91sam9g20())
  38. at91_boot_soc = at91sam9260_soc;
  39. else if (cpu_is_at91sam9g45())
  40. at91_boot_soc = at91sam9g45_soc;
  41. else if (cpu_is_at91sam9rl())
  42. at91_boot_soc = at91sam9rl_soc;
  43. else if (cpu_is_at91sam9x5())
  44. at91_boot_soc = at91sam9x5_soc;
  45. else
  46. panic("Impossible to detect the SOC type");
  47. if (at91_boot_soc.map_io)
  48. at91_boot_soc.map_io();
  49. }
  50. void __init at91_initialize(unsigned long main_clock)
  51. {
  52. at91_boot_soc.init(main_clock);
  53. }