common-smdk.c 4.2 KB

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