cpu.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* linux/arch/arm/plat-s3c64xx/cpu.c
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * S3C64XX CPU Support
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/module.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/ioport.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/io.h>
  21. #include <mach/hardware.h>
  22. #include <mach/map.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <plat/regs-serial.h>
  26. #include <plat/cpu.h>
  27. #include <plat/devs.h>
  28. #include <plat/clock.h>
  29. #include <plat/s3c6400.h>
  30. #include <plat/s3c6410.h>
  31. /* table of supported CPUs */
  32. static const char name_s3c6400[] = "S3C6400";
  33. static const char name_s3c6410[] = "S3C6410";
  34. static struct cpu_table cpu_ids[] __initdata = {
  35. {
  36. .idcode = 0x36400000,
  37. .idmask = 0xfffff000,
  38. .map_io = s3c6400_map_io,
  39. .init_clocks = s3c6400_init_clocks,
  40. .init_uarts = s3c6400_init_uarts,
  41. .init = s3c6400_init,
  42. .name = name_s3c6400,
  43. }, {
  44. .idcode = 0x36410100,
  45. .idmask = 0xffffff00,
  46. .map_io = s3c6410_map_io,
  47. .init_clocks = s3c6410_init_clocks,
  48. .init_uarts = s3c6410_init_uarts,
  49. .init = s3c6410_init,
  50. .name = name_s3c6410,
  51. },
  52. };
  53. /* minimal IO mapping */
  54. /* see notes on uart map in arch/arm/mach-s3c6400/include/mach/debug-macro.S */
  55. #define UART_OFFS (S3C_PA_UART & 0xfffff)
  56. static struct map_desc s3c_iodesc[] __initdata = {
  57. {
  58. .virtual = (unsigned long)S3C_VA_SYS,
  59. .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
  60. .length = SZ_4K,
  61. .type = MT_DEVICE,
  62. }, {
  63. .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS),
  64. .pfn = __phys_to_pfn(S3C_PA_UART),
  65. .length = SZ_4K,
  66. .type = MT_DEVICE,
  67. }, {
  68. .virtual = (unsigned long)S3C_VA_VIC0,
  69. .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
  70. .length = SZ_16K,
  71. .type = MT_DEVICE,
  72. }, {
  73. .virtual = (unsigned long)S3C_VA_VIC1,
  74. .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
  75. .length = SZ_16K,
  76. .type = MT_DEVICE,
  77. }, {
  78. .virtual = (unsigned long)S3C_VA_TIMER,
  79. .pfn = __phys_to_pfn(S3C_PA_TIMER),
  80. .length = SZ_16K,
  81. .type = MT_DEVICE,
  82. }, {
  83. .virtual = (unsigned long)S3C64XX_VA_GPIO,
  84. .pfn = __phys_to_pfn(S3C64XX_PA_GPIO),
  85. .length = SZ_4K,
  86. .type = MT_DEVICE,
  87. }, {
  88. .virtual = (unsigned long)S3C64XX_VA_MODEM,
  89. .pfn = __phys_to_pfn(S3C64XX_PA_MODEM),
  90. .length = SZ_4K,
  91. .type = MT_DEVICE,
  92. },
  93. };
  94. /* read cpu identification code */
  95. void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
  96. {
  97. unsigned long idcode;
  98. /* initialise the io descriptors we need for initialisation */
  99. iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
  100. iotable_init(mach_desc, size);
  101. idcode = __raw_readl(S3C_VA_SYS + 0x118);
  102. s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
  103. }