mach-vstms.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // (C) 2006 Thomas Gleixner <tglx@linutronix.de>
  4. //
  5. // Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics
  6. #include <linux/kernel.h>
  7. #include <linux/types.h>
  8. #include <linux/interrupt.h>
  9. #include <linux/list.h>
  10. #include <linux/timer.h>
  11. #include <linux/init.h>
  12. #include <linux/serial_core.h>
  13. #include <linux/serial_s3c.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/rawnand.h>
  18. #include <linux/mtd/nand_ecc.h>
  19. #include <linux/mtd/partitions.h>
  20. #include <linux/memblock.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/mach/irq.h>
  24. #include <mach/hardware.h>
  25. #include <asm/setup.h>
  26. #include <asm/irq.h>
  27. #include <asm/mach-types.h>
  28. #include <mach/regs-gpio.h>
  29. #include <mach/regs-lcd.h>
  30. #include <mach/fb.h>
  31. #include <linux/platform_data/i2c-s3c2410.h>
  32. #include <linux/platform_data/mtd-nand-s3c2410.h>
  33. #include <plat/devs.h>
  34. #include <plat/cpu.h>
  35. #include <plat/samsung-time.h>
  36. #include "common.h"
  37. static struct map_desc vstms_iodesc[] __initdata = {
  38. };
  39. static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
  40. [0] = {
  41. .hwport = 0,
  42. .flags = 0,
  43. .ucon = 0x3c5,
  44. .ulcon = 0x03,
  45. .ufcon = 0x51,
  46. },
  47. [1] = {
  48. .hwport = 1,
  49. .flags = 0,
  50. .ucon = 0x3c5,
  51. .ulcon = 0x03,
  52. .ufcon = 0x51,
  53. },
  54. [2] = {
  55. .hwport = 2,
  56. .flags = 0,
  57. .ucon = 0x3c5,
  58. .ulcon = 0x03,
  59. .ufcon = 0x51,
  60. }
  61. };
  62. static struct mtd_partition __initdata vstms_nand_part[] = {
  63. [0] = {
  64. .name = "Boot Agent",
  65. .size = 0x7C000,
  66. .offset = 0,
  67. },
  68. [1] = {
  69. .name = "UBoot Config",
  70. .offset = 0x7C000,
  71. .size = 0x4000,
  72. },
  73. [2] = {
  74. .name = "Kernel",
  75. .offset = 0x80000,
  76. .size = 0x200000,
  77. },
  78. [3] = {
  79. .name = "RFS",
  80. .offset = 0x280000,
  81. .size = 0x3d80000,
  82. },
  83. };
  84. static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
  85. [0] = {
  86. .name = "NAND",
  87. .nr_chips = 1,
  88. .nr_partitions = ARRAY_SIZE(vstms_nand_part),
  89. .partitions = vstms_nand_part,
  90. },
  91. };
  92. /* choose a set of timings which should suit most 512Mbit
  93. * chips and beyond.
  94. */
  95. static struct s3c2410_platform_nand __initdata vstms_nand_info = {
  96. .tacls = 20,
  97. .twrph0 = 60,
  98. .twrph1 = 20,
  99. .nr_sets = ARRAY_SIZE(vstms_nand_sets),
  100. .sets = vstms_nand_sets,
  101. .ecc_mode = NAND_ECC_SOFT,
  102. };
  103. static struct platform_device *vstms_devices[] __initdata = {
  104. &s3c_device_ohci,
  105. &s3c_device_wdt,
  106. &s3c_device_i2c0,
  107. &s3c_device_iis,
  108. &s3c_device_rtc,
  109. &s3c_device_nand,
  110. &s3c2412_device_dma,
  111. };
  112. static void __init vstms_fixup(struct tag *tags, char **cmdline)
  113. {
  114. if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
  115. memblock_add(0x30000000, SZ_64M);
  116. }
  117. }
  118. static void __init vstms_map_io(void)
  119. {
  120. s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
  121. s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
  122. samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
  123. }
  124. static void __init vstms_init_time(void)
  125. {
  126. s3c2412_init_clocks(12000000);
  127. samsung_timer_init();
  128. }
  129. static void __init vstms_init(void)
  130. {
  131. s3c_i2c0_set_platdata(NULL);
  132. s3c_nand_set_platdata(&vstms_nand_info);
  133. platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
  134. }
  135. MACHINE_START(VSTMS, "VSTMS")
  136. .atag_offset = 0x100,
  137. .fixup = vstms_fixup,
  138. .init_irq = s3c2412_init_irq,
  139. .init_machine = vstms_init,
  140. .map_io = vstms_map_io,
  141. .init_time = vstms_init_time,
  142. MACHINE_END