common-smdk.c 4.3 KB

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