common-smdk.c 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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/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/mach/flash.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. /*Qisda , wenny cheng , 20091224 , board id info {*/
  39. int board_id = 0;
  40. /*Qisda , wenny cheng , 20091224 , board id info }*/
  41. /* LED devices */
  42. static struct s3c24xx_led_platdata smdk_pdata_led0 = {
  43. .gpio = S3C2410_GPH12,
  44. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  45. .name = "led0",
  46. .def_trigger = "power",
  47. };
  48. /*static struct s3c24xx_led_platdata smdk_pdata_led1 = {
  49. .gpio = S3C_GPK8,
  50. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  51. .name = "led1",
  52. .def_trigger = "bluetooth",
  53. };
  54. static struct s3c24xx_led_platdata smdk_pdata_led2 = {
  55. .gpio = S3C_GPK9,
  56. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  57. .name = "led6",
  58. .def_trigger = "wifi",
  59. };*/
  60. static struct platform_device smdk_led0 = {
  61. .name = "s3c24xx_led",
  62. .id = 0,
  63. .dev = {
  64. .platform_data = &smdk_pdata_led0,
  65. },
  66. };
  67. /*static struct platform_device smdk_led1 = {
  68. .name = "s3c24xx_led",
  69. .id = 1,
  70. .dev = {
  71. .platform_data = &smdk_pdata_led1,
  72. },
  73. };
  74. static struct platform_device smdk_led2 = {
  75. .name = "s3c24xx_led",
  76. .id = 2,
  77. .dev = {
  78. .platform_data = &smdk_pdata_led2,
  79. },
  80. };*/
  81. /* NAND parititon from 2.4.18-swl5 */
  82. static struct mtd_partition smdk_default_nand_part[] = {
  83. [0] = {
  84. .name = "Boot Agent",
  85. .size = SZ_16K,
  86. .offset = 0,
  87. },
  88. [1] = {
  89. .name = "S3C2410 flash partition 1",
  90. .offset = 0,
  91. .size = SZ_2M,
  92. },
  93. [2] = {
  94. .name = "S3C2410 flash partition 2",
  95. .offset = SZ_4M,
  96. .size = SZ_4M,
  97. },
  98. [3] = {
  99. .name = "S3C2410 flash partition 3",
  100. .offset = SZ_8M,
  101. .size = SZ_2M,
  102. },
  103. [4] = {
  104. .name = "S3C2410 flash partition 4",
  105. .offset = SZ_1M * 10,
  106. .size = SZ_4M,
  107. },
  108. [5] = {
  109. .name = "S3C2410 flash partition 5",
  110. .offset = SZ_1M * 14,
  111. .size = SZ_1M * 10,
  112. },
  113. [6] = {
  114. .name = "S3C2410 flash partition 6",
  115. .offset = SZ_1M * 24,
  116. .size = SZ_1M * 24,
  117. },
  118. [7] = {
  119. .name = "S3C2410 flash partition 7",
  120. .offset = SZ_1M * 48,
  121. .size = SZ_16M,
  122. }
  123. };
  124. /* ----------------S3C NAND partition information ---------------------*/
  125. struct mtd_partition s3c_partition_info[] = {
  126. {
  127. .name = "Bootloader",
  128. .offset = 0,
  129. .size = (256*SZ_1K),
  130. .mask_flags = MTD_CAP_NANDFLASH,
  131. },
  132. /*Qisda Qube for change partition table*/
  133. {
  134. .name = "Kernel",
  135. .offset = (256*SZ_1K), /* Block number is 0x10 */
  136. //.size = (2*SZ_1M) - (256*SZ_1K),
  137. .size = (2*SZ_1M),
  138. .mask_flags = MTD_CAP_NANDFLASH,
  139. },
  140. #ifdef CONFIG_SPLIT_ROOT_FILESYSTEM
  141. {
  142. .name = "Root - Cramfs",
  143. .offset = (2*SZ_1M+256*SZ_1K), /* Block number is 0x80 */
  144. .size = (80*SZ_1M),
  145. },
  146. #endif
  147. {
  148. .name = "ODM - reserved",
  149. .offset = (2*SZ_1M+256*SZ_1K+80*SZ_1M), /* Block number is 0x80 */
  150. .size = (SZ_1M),
  151. },
  152. /*Qisda Qube for change partition table*/
  153. {
  154. .name = "File System",
  155. .offset = MTDPART_OFS_APPEND,
  156. .size = MTDPART_SIZ_FULL,
  157. }
  158. };
  159. struct s3c_nand_mtd_info nand_mtd_info = {
  160. .chip_nr = 1,
  161. .mtd_part_nr = ARRAY_SIZE(s3c_partition_info),
  162. .partition = s3c_partition_info,
  163. };
  164. struct s3c_nand_mtd_info * get_board_nand_mtd_info (void)
  165. {
  166. return &nand_mtd_info;
  167. }
  168. struct flash_platform_data s3c_onenand_data = {
  169. .parts = s3c_partition_info,
  170. .nr_parts = ARRAY_SIZE(s3c_partition_info),
  171. };
  172. /* ---------------------------------------------------------------------*/
  173. static struct s3c2410_nand_set smdk_nand_sets[] = {
  174. [0] = {
  175. .name = "NAND",
  176. .nr_chips = 1,
  177. .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
  178. .partitions = smdk_default_nand_part,
  179. },
  180. };
  181. /* choose a set of timings which should suit most 512Mbit
  182. * chips and beyond.
  183. */
  184. static struct s3c2410_platform_nand smdk_nand_info = {
  185. .tacls = 20,
  186. .twrph0 = 60,
  187. .twrph1 = 20,
  188. .nr_sets = ARRAY_SIZE(smdk_nand_sets),
  189. .sets = smdk_nand_sets,
  190. };
  191. /* devices we initialise */
  192. static struct platform_device __initdata *smdk_devs[] = {
  193. &s3c_device_nand,
  194. &s3c_device_onenand,
  195. &smdk_led0,
  196. /* &smdk_led1,
  197. &smdk_led2,*/
  198. };
  199. void __init smdk_machine_init(void)
  200. {
  201. /* Configure the LEDs (even if we have no LED support)*/
  202. /*Qisda , wenny cheng , 20091224 , board id info {*/
  203. //writel((readl(S3C2416_GPKCON) & ~(3<<18)), S3C2416_GPKCON);
  204. //writel((readl(S3C2416_GPKUDP) & ~(3<<18)), S3C2416_GPKUDP);
  205. //writel((readl(S3C2416_GPKCON) & ~(3<<16)), S3C2416_GPKCON);
  206. //writel((readl(S3C2416_GPKUDP) & ~(3<<16)), S3C2416_GPKUDP);
  207. //writel((readl(S3C2410_GPHCON) & ~(3<<24)), S3C2410_GPHCON);
  208. //writel((readl(S3C2410_GPHUP) & ~(3<<24)), S3C2410_GPHUP);
  209. #ifdef CONFIG_QISDA_BQ060B00_DVT
  210. if((readl(S3C2416_GPKDAT) & (1<<1))){
  211. board_id = BQ060B00_A02;
  212. }
  213. else{
  214. board_id = BQ060B00_A01_And_Before;
  215. }
  216. #elif defined(CONFIG_QISDA_QD090B00)
  217. if((readl(S3C2416_GPKDAT) & (1<<3))){
  218. board_id = QD090B00_S03;
  219. }
  220. else{
  221. board_id = QD090B00_S02;
  222. }
  223. #else
  224. if((readl(S3C2416_GPKDAT) & (1<<1))){
  225. board_id = QD060B00_A02;
  226. }
  227. else{
  228. board_id = QD060B00_A01_And_Before;
  229. }
  230. #endif
  231. //printk("\nsmdk_machine_init: %d\n", as090b00_board_id);
  232. /*Qisda , wenny cheng , 20091224 , board id info }*/
  233. //Qisda, Leo SJ Yang, 2009/08/14, re{
  234. // remove gpio configuration that doesn't need in EVT2
  235. #ifdef CONFIG_QISDA_E600_EVT0
  236. s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
  237. s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
  238. s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
  239. s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
  240. s3c2410_gpio_setpin(S3C2410_GPF4, 1);
  241. s3c2410_gpio_setpin(S3C2410_GPF5, 1);
  242. s3c2410_gpio_setpin(S3C2410_GPF6, 1);
  243. s3c2410_gpio_setpin(S3C2410_GPF7, 1);
  244. #endif
  245. //}Qisda, Leo SJ Yang, 2009/08/14,
  246. // remove gpio configuration that doesn't need in EVT2
  247. //Qisda, Asaku Chen, 2009/07/31, audio codec enable {
  248. #ifdef CONFIG_SND_S3C24XX_SOC_SMDK2416_RT5624
  249. // rt5624_power(true);
  250. // msleep(10);
  251. #endif
  252. //Qisda, Asaku Chen, 2009/07/31, audio codec enable }
  253. //Qisda, Asaku Chen, 2009/07/16, touch panel enable {
  254. #ifdef CONFIG_TOUCHSCREEN_IIC_QISDA
  255. //Qisda, Leo SJ Yang, 2009/08/14,{
  256. // //Set GPF5 as touch enable pin for evt2
  257. #ifdef CONFIG_QISDA_E600_EVT0
  258. writel((readl(S3C2416_GPKCON) & ~(1<<5) | (1<<4)), S3C2416_GPKCON);
  259. writel((readl(S3C2416_GPKDAT) | (1<<2)), S3C2416_GPKDAT);
  260. #elif CONFIG_QISDA_BK060B00
  261. s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
  262. s3c2410_gpio_setpin(S3C2410_GPD10, 1);
  263. #else
  264. s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
  265. s3c2410_gpio_setpin(S3C2410_GPF5, 1);
  266. #endif
  267. #endif
  268. //}Qisda, Leo SJ Yang, 2009/08/14,
  269. ////Set GPF5 as touch enable pin for evt2
  270. //Qisda, Asaku Chen, 2009/07/16, touch panel enable }
  271. #ifdef CONFIG_QISDA_AS090B00_EVT1_1
  272. s3c2410_gpio_cfgpin(S3C2410_GPA1, S3C2410_GPA1_OUT);
  273. s3c2410_gpio_setpin(S3C2410_GPA1, 1);
  274. #else
  275. //Qisda, Asaku Chen, 2009/07/16, I2C enable {
  276. s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_OUTP);
  277. s3c2410_gpio_setpin(S3C2410_GPG3, 1);
  278. //Qisda, Asaku Chen, 2009/07/16, I2C enable }
  279. #endif //!CONFIG_QISDA_AS090B00_EVT1_1
  280. s3c_device_nand.dev.platform_data = &smdk_nand_info;
  281. //For s3c nand partition
  282. s3c_device_nand.dev.platform_data = &nand_mtd_info;
  283. platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
  284. s3c2410_pm_init();
  285. }