cpu.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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/sysdev.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/dma-mapping.h>
  23. #include <mach/hardware.h>
  24. #include <mach/map.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <plat/regs-serial.h>
  28. #include <plat/cpu.h>
  29. #include <plat/devs.h>
  30. #include <plat/clock.h>
  31. #include <plat/s3c6400.h>
  32. #include <plat/s3c6410.h>
  33. /* table of supported CPUs */
  34. static const char name_s3c6400[] = "S3C6400";
  35. static const char name_s3c6410[] = "S3C6410";
  36. static struct cpu_table cpu_ids[] __initdata = {
  37. {
  38. .idcode = S3C6400_CPU_ID,
  39. .idmask = S3C64XX_CPU_MASK,
  40. .map_io = s3c6400_map_io,
  41. .init_clocks = s3c6400_init_clocks,
  42. .init_uarts = s3c6400_init_uarts,
  43. .init = s3c6400_init,
  44. .name = name_s3c6400,
  45. }, {
  46. .idcode = S3C6410_CPU_ID,
  47. .idmask = S3C64XX_CPU_MASK,
  48. .map_io = s3c6410_map_io,
  49. .init_clocks = s3c6410_init_clocks,
  50. .init_uarts = s3c6410_init_uarts,
  51. .init = s3c6410_init,
  52. .name = name_s3c6410,
  53. },
  54. };
  55. /* minimal IO mapping */
  56. /* see notes on uart map in arch/arm/mach-s3c6400/include/mach/debug-macro.S */
  57. #define UART_OFFS (S3C_PA_UART & 0xfffff)
  58. static struct map_desc s3c_iodesc[] __initdata = {
  59. {
  60. .virtual = (unsigned long)S3C_VA_SYS,
  61. .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
  62. .length = SZ_4K,
  63. .type = MT_DEVICE,
  64. }, {
  65. .virtual = (unsigned long)S3C_VA_MEM,
  66. .pfn = __phys_to_pfn(S3C64XX_PA_SROM),
  67. .length = SZ_4K,
  68. .type = MT_DEVICE,
  69. }, {
  70. .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS),
  71. .pfn = __phys_to_pfn(S3C_PA_UART),
  72. .length = SZ_4K,
  73. .type = MT_DEVICE,
  74. }, {
  75. .virtual = (unsigned long)VA_VIC0,
  76. .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
  77. .length = SZ_16K,
  78. .type = MT_DEVICE,
  79. }, {
  80. .virtual = (unsigned long)VA_VIC1,
  81. .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
  82. .length = SZ_16K,
  83. .type = MT_DEVICE,
  84. }, {
  85. .virtual = (unsigned long)S3C_VA_TIMER,
  86. .pfn = __phys_to_pfn(S3C_PA_TIMER),
  87. .length = SZ_16K,
  88. .type = MT_DEVICE,
  89. }, {
  90. .virtual = (unsigned long)S3C64XX_VA_GPIO,
  91. .pfn = __phys_to_pfn(S3C64XX_PA_GPIO),
  92. .length = SZ_4K,
  93. .type = MT_DEVICE,
  94. }, {
  95. .virtual = (unsigned long)S3C64XX_VA_MODEM,
  96. .pfn = __phys_to_pfn(S3C64XX_PA_MODEM),
  97. .length = SZ_4K,
  98. .type = MT_DEVICE,
  99. }, {
  100. .virtual = (unsigned long)S3C_VA_WATCHDOG,
  101. .pfn = __phys_to_pfn(S3C64XX_PA_WATCHDOG),
  102. .length = SZ_4K,
  103. .type = MT_DEVICE,
  104. }, {
  105. .virtual = (unsigned long)S3C_VA_USB_HSPHY,
  106. .pfn = __phys_to_pfn(S3C64XX_PA_USB_HSPHY),
  107. .length = SZ_1K,
  108. .type = MT_DEVICE,
  109. },
  110. };
  111. struct sysdev_class s3c64xx_sysclass = {
  112. .name = "s3c64xx-core",
  113. };
  114. static struct sys_device s3c64xx_sysdev = {
  115. .cls = &s3c64xx_sysclass,
  116. };
  117. /* uart registration process */
  118. void __init s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
  119. {
  120. s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
  121. }
  122. /* read cpu identification code */
  123. void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
  124. {
  125. /* initialise the io descriptors we need for initialisation */
  126. iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
  127. iotable_init(mach_desc, size);
  128. init_consistent_dma_size(SZ_8M);
  129. /* detect cpu id */
  130. s3c64xx_init_cpu();
  131. s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
  132. }
  133. static __init int s3c64xx_sysdev_init(void)
  134. {
  135. sysdev_class_register(&s3c64xx_sysclass);
  136. return sysdev_register(&s3c64xx_sysdev);
  137. }
  138. core_initcall(s3c64xx_sysdev_init);