mach-vstms.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // (C) 2006 Thomas Gleixner <[email protected]>
  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-sw-hamming.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 <asm/setup.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach-types.h>
  27. #include "regs-gpio.h"
  28. #include "gpio-samsung.h"
  29. #include "gpio-cfg.h"
  30. #include <linux/platform_data/fb-s3c2410.h>
  31. #include <linux/platform_data/i2c-s3c2410.h>
  32. #include <linux/platform_data/mtd-nand-s3c2410.h>
  33. #include "devs.h"
  34. #include "cpu.h"
  35. #include "s3c24xx.h"
  36. static struct map_desc vstms_iodesc[] __initdata = {
  37. };
  38. static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
  39. [0] = {
  40. .hwport = 0,
  41. .flags = 0,
  42. .ucon = 0x3c5,
  43. .ulcon = 0x03,
  44. .ufcon = 0x51,
  45. },
  46. [1] = {
  47. .hwport = 1,
  48. .flags = 0,
  49. .ucon = 0x3c5,
  50. .ulcon = 0x03,
  51. .ufcon = 0x51,
  52. },
  53. [2] = {
  54. .hwport = 2,
  55. .flags = 0,
  56. .ucon = 0x3c5,
  57. .ulcon = 0x03,
  58. .ufcon = 0x51,
  59. }
  60. };
  61. static struct mtd_partition __initdata vstms_nand_part[] = {
  62. [0] = {
  63. .name = "Boot Agent",
  64. .size = 0x7C000,
  65. .offset = 0,
  66. },
  67. [1] = {
  68. .name = "UBoot Config",
  69. .offset = 0x7C000,
  70. .size = 0x4000,
  71. },
  72. [2] = {
  73. .name = "Kernel",
  74. .offset = 0x80000,
  75. .size = 0x200000,
  76. },
  77. [3] = {
  78. .name = "RFS",
  79. .offset = 0x280000,
  80. .size = 0x3d80000,
  81. },
  82. };
  83. static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
  84. [0] = {
  85. .name = "NAND",
  86. .nr_chips = 1,
  87. .nr_partitions = ARRAY_SIZE(vstms_nand_part),
  88. .partitions = vstms_nand_part,
  89. },
  90. };
  91. /* choose a set of timings which should suit most 512Mbit
  92. * chips and beyond.
  93. */
  94. static struct s3c2410_platform_nand __initdata vstms_nand_info = {
  95. .tacls = 20,
  96. .twrph0 = 60,
  97. .twrph1 = 20,
  98. .nr_sets = ARRAY_SIZE(vstms_nand_sets),
  99. .sets = vstms_nand_sets,
  100. .engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
  101. };
  102. static struct platform_device *vstms_devices[] __initdata = {
  103. &s3c_device_ohci,
  104. &s3c_device_wdt,
  105. &s3c_device_i2c0,
  106. &s3c_device_iis,
  107. &s3c_device_rtc,
  108. &s3c_device_nand,
  109. &s3c2412_device_dma,
  110. };
  111. static void __init vstms_fixup(struct tag *tags, char **cmdline)
  112. {
  113. if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
  114. memblock_add(0x30000000, SZ_64M);
  115. }
  116. }
  117. static void __init vstms_map_io(void)
  118. {
  119. s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
  120. s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
  121. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  122. }
  123. static void __init vstms_init_time(void)
  124. {
  125. s3c2412_init_clocks(12000000);
  126. s3c24xx_timer_init();
  127. }
  128. static void __init vstms_init(void)
  129. {
  130. s3c_i2c0_set_platdata(NULL);
  131. s3c_nand_set_platdata(&vstms_nand_info);
  132. /* Configure the I2S pins (GPE0...GPE4) in correct mode */
  133. s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
  134. S3C_GPIO_PULL_NONE);
  135. platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
  136. }
  137. MACHINE_START(VSTMS, "VSTMS")
  138. .atag_offset = 0x100,
  139. .nr_irqs = NR_IRQS_S3C2412,
  140. .fixup = vstms_fixup,
  141. .init_irq = s3c2412_init_irq,
  142. .init_machine = vstms_init,
  143. .map_io = vstms_map_io,
  144. .init_time = vstms_init_time,
  145. MACHINE_END