common-smdk.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /* linux/arch/arm/plat-s3c24xx/common-smdk.c
  2. *
  3. * Copyright (c) 2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Common code for SMDK2410 and SMDK2440 boards
  7. *
  8. * http://www.fluff.org/ben/smdk2440/
  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/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/list.h>
  18. #include <linux/timer.h>
  19. #include <linux/init.h>
  20. #include <linux/gpio.h>
  21. #include <linux/sysdev.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/nand.h>
  25. #include <linux/mtd/nand_ecc.h>
  26. #include <linux/mtd/partitions.h>
  27. #include <linux/io.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/mach/irq.h>
  31. #include <asm/mach-types.h>
  32. #include <mach/hardware.h>
  33. #include <asm/irq.h>
  34. #include <mach/regs-gpio.h>
  35. #include <mach/leds-gpio.h>
  36. #include <plat/nand.h>
  37. #include <plat/common-smdk.h>
  38. #include <plat/gpio-cfg.h>
  39. #include <plat/devs.h>
  40. #include <plat/pm.h>
  41. /* LED devices */
  42. static struct s3c24xx_led_platdata smdk_pdata_led4 = {
  43. .gpio = S3C2410_GPF(4),
  44. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  45. .name = "led4",
  46. .def_trigger = "timer",
  47. };
  48. static struct s3c24xx_led_platdata smdk_pdata_led5 = {
  49. .gpio = S3C2410_GPF(5),
  50. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  51. .name = "led5",
  52. .def_trigger = "nand-disk",
  53. };
  54. static struct s3c24xx_led_platdata smdk_pdata_led6 = {
  55. .gpio = S3C2410_GPF(6),
  56. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  57. .name = "led6",
  58. };
  59. static struct s3c24xx_led_platdata smdk_pdata_led7 = {
  60. .gpio = S3C2410_GPF(7),
  61. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  62. .name = "led7",
  63. };
  64. static struct platform_device smdk_led4 = {
  65. .name = "s3c24xx_led",
  66. .id = 0,
  67. .dev = {
  68. .platform_data = &smdk_pdata_led4,
  69. },
  70. };
  71. static struct platform_device smdk_led5 = {
  72. .name = "s3c24xx_led",
  73. .id = 1,
  74. .dev = {
  75. .platform_data = &smdk_pdata_led5,
  76. },
  77. };
  78. static struct platform_device smdk_led6 = {
  79. .name = "s3c24xx_led",
  80. .id = 2,
  81. .dev = {
  82. .platform_data = &smdk_pdata_led6,
  83. },
  84. };
  85. static struct platform_device smdk_led7 = {
  86. .name = "s3c24xx_led",
  87. .id = 3,
  88. .dev = {
  89. .platform_data = &smdk_pdata_led7,
  90. },
  91. };
  92. /* NAND parititon from 2.4.18-swl5 */
  93. static struct mtd_partition smdk_default_nand_part[] = {
  94. [0] = {
  95. .name = "Boot Agent",
  96. .size = SZ_16K,
  97. .offset = 0,
  98. },
  99. [1] = {
  100. .name = "S3C2410 flash partition 1",
  101. .offset = 0,
  102. .size = SZ_2M,
  103. },
  104. [2] = {
  105. .name = "S3C2410 flash partition 2",
  106. .offset = SZ_4M,
  107. .size = SZ_4M,
  108. },
  109. [3] = {
  110. .name = "S3C2410 flash partition 3",
  111. .offset = SZ_8M,
  112. .size = SZ_2M,
  113. },
  114. [4] = {
  115. .name = "S3C2410 flash partition 4",
  116. .offset = SZ_1M * 10,
  117. .size = SZ_4M,
  118. },
  119. [5] = {
  120. .name = "S3C2410 flash partition 5",
  121. .offset = SZ_1M * 14,
  122. .size = SZ_1M * 10,
  123. },
  124. [6] = {
  125. .name = "S3C2410 flash partition 6",
  126. .offset = SZ_1M * 24,
  127. .size = SZ_1M * 24,
  128. },
  129. [7] = {
  130. .name = "S3C2410 flash partition 7",
  131. .offset = SZ_1M * 48,
  132. .size = MTDPART_SIZ_FULL,
  133. }
  134. };
  135. static struct s3c2410_nand_set smdk_nand_sets[] = {
  136. [0] = {
  137. .name = "NAND",
  138. .nr_chips = 1,
  139. .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
  140. .partitions = smdk_default_nand_part,
  141. },
  142. };
  143. /* choose a set of timings which should suit most 512Mbit
  144. * chips and beyond.
  145. */
  146. static struct s3c2410_platform_nand smdk_nand_info = {
  147. .tacls = 20,
  148. .twrph0 = 60,
  149. .twrph1 = 20,
  150. .nr_sets = ARRAY_SIZE(smdk_nand_sets),
  151. .sets = smdk_nand_sets,
  152. };
  153. /* devices we initialise */
  154. static struct platform_device __initdata *smdk_devs[] = {
  155. &s3c_device_nand,
  156. &smdk_led4,
  157. &smdk_led5,
  158. &smdk_led6,
  159. &smdk_led7,
  160. };
  161. void __init smdk_machine_init(void)
  162. {
  163. /* Configure the LEDs (even if we have no LED support)*/
  164. s3c_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT);
  165. s3c_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT);
  166. s3c_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT);
  167. s3c_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT);
  168. s3c2410_gpio_setpin(S3C2410_GPF(4), 1);
  169. s3c2410_gpio_setpin(S3C2410_GPF(5), 1);
  170. s3c2410_gpio_setpin(S3C2410_GPF(6), 1);
  171. s3c2410_gpio_setpin(S3C2410_GPF(7), 1);
  172. if (machine_is_smdk2443())
  173. smdk_nand_info.twrph0 = 50;
  174. s3c_nand_set_platdata(&smdk_nand_info);
  175. platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
  176. s3c_pm_init();
  177. }