common-smdk.c 4.4 KB

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