cpu.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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/delay.h>
  21. #include <linux/io.h>
  22. #include <mach/hardware.h>
  23. #include <mach/map.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <plat/regs-serial.h>
  27. #include <plat/cpu.h>
  28. #include <plat/devs.h>
  29. #include <plat/clock.h>
  30. #include <plat/s3c6400.h>
  31. #include <plat/s3c6410.h>
  32. /* table of supported CPUs */
  33. static const char name_s3c6400[] = "S3C6400";
  34. static const char name_s3c6410[] = "S3C6410";
  35. static struct cpu_table cpu_ids[] __initdata = {
  36. {
  37. .idcode = 0x36400000,
  38. .idmask = 0xfffff000,
  39. .map_io = s3c6400_map_io,
  40. .init_clocks = s3c6400_init_clocks,
  41. .init_uarts = s3c6400_init_uarts,
  42. .init = s3c6400_init,
  43. .name = name_s3c6400,
  44. }, {
  45. .idcode = 0x36410100,
  46. .idmask = 0xffffff00,
  47. .map_io = s3c6410_map_io,
  48. .init_clocks = s3c6410_init_clocks,
  49. .init_uarts = s3c6410_init_uarts,
  50. .init = s3c6410_init,
  51. .name = name_s3c6410,
  52. },
  53. };
  54. /* minimal IO mapping */
  55. /* see notes on uart map in arch/arm/mach-s3c6400/include/mach/debug-macro.S */
  56. #define UART_OFFS (S3C_PA_UART & 0xfffff)
  57. static struct map_desc s3c_iodesc[] __initdata = {
  58. {
  59. .virtual = (unsigned long)S3C_VA_SYS,
  60. .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
  61. .length = SZ_4K,
  62. .type = MT_DEVICE,
  63. }, {
  64. .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS),
  65. .pfn = __phys_to_pfn(S3C_PA_UART),
  66. .length = SZ_4K,
  67. .type = MT_DEVICE,
  68. }, {
  69. .virtual = (unsigned long)S3C_VA_VIC0,
  70. .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
  71. .length = SZ_16K,
  72. .type = MT_DEVICE,
  73. }, {
  74. .virtual = (unsigned long)S3C_VA_VIC1,
  75. .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
  76. .length = SZ_16K,
  77. .type = MT_DEVICE,
  78. }, {
  79. .virtual = (unsigned long)S3C_VA_TIMER,
  80. .pfn = __phys_to_pfn(S3C_PA_TIMER),
  81. .length = SZ_16K,
  82. .type = MT_DEVICE,
  83. }, {
  84. .virtual = (unsigned long)S3C64XX_VA_GPIO,
  85. .pfn = __phys_to_pfn(S3C64XX_PA_GPIO),
  86. .length = SZ_4K,
  87. .type = MT_DEVICE,
  88. },
  89. };
  90. /* read cpu identification code */
  91. void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
  92. {
  93. unsigned long idcode;
  94. /* initialise the io descriptors we need for initialisation */
  95. iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
  96. iotable_init(mach_desc, size);
  97. idcode = __raw_readl(S3C_VA_SYS + 0x118);
  98. s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
  99. }