mach-mini2440.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /* linux/arch/arm/mach-s3c2440/mach-mini2440.c
  2. *
  3. * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
  4. * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
  5. * and modifications by SBZ <sbz@spgui.org> and
  6. * Weibing <http://weibing.blogbus.com> and
  7. * Michel Pollet <buserror@gmail.com>
  8. *
  9. * For product information, visit http://code.google.com/p/mini2440/
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/timer.h>
  20. #include <linux/init.h>
  21. #include <linux/gpio.h>
  22. #include <linux/input.h>
  23. #include <linux/io.h>
  24. #include <linux/serial_core.h>
  25. #include <linux/dm9000.h>
  26. #include <linux/i2c/at24.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/gpio_keys.h>
  29. #include <linux/i2c.h>
  30. #include <linux/mmc/host.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <mach/hardware.h>
  34. #include <mach/fb.h>
  35. #include <asm/mach-types.h>
  36. #include <plat/regs-serial.h>
  37. #include <mach/regs-gpio.h>
  38. #include <mach/leds-gpio.h>
  39. #include <mach/regs-mem.h>
  40. #include <mach/regs-lcd.h>
  41. #include <mach/irqs.h>
  42. #include <plat/nand.h>
  43. #include <plat/iic.h>
  44. #include <plat/mci.h>
  45. #include <plat/udc.h>
  46. #include <linux/mtd/mtd.h>
  47. #include <linux/mtd/nand.h>
  48. #include <linux/mtd/nand_ecc.h>
  49. #include <linux/mtd/partitions.h>
  50. #include <plat/gpio-cfg.h>
  51. #include <plat/clock.h>
  52. #include <plat/devs.h>
  53. #include <plat/cpu.h>
  54. #include <sound/s3c24xx_uda134x.h>
  55. #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
  56. static struct map_desc mini2440_iodesc[] __initdata = {
  57. /* nothing to declare, move along */
  58. };
  59. #define UCON S3C2410_UCON_DEFAULT
  60. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  61. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  62. static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
  63. [0] = {
  64. .hwport = 0,
  65. .flags = 0,
  66. .ucon = UCON,
  67. .ulcon = ULCON,
  68. .ufcon = UFCON,
  69. },
  70. [1] = {
  71. .hwport = 1,
  72. .flags = 0,
  73. .ucon = UCON,
  74. .ulcon = ULCON,
  75. .ufcon = UFCON,
  76. },
  77. [2] = {
  78. .hwport = 2,
  79. .flags = 0,
  80. .ucon = UCON,
  81. .ulcon = ULCON,
  82. .ufcon = UFCON,
  83. },
  84. };
  85. /* USB device UDC support */
  86. static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
  87. .pullup_pin = S3C2410_GPC(5),
  88. };
  89. /* LCD timing and setup */
  90. /*
  91. * This macro simplifies the table bellow
  92. */
  93. #define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \
  94. _yres,margin_top,margin_bottom,vsync, refresh) \
  95. .width = _xres, \
  96. .xres = _xres, \
  97. .height = _yres, \
  98. .yres = _yres, \
  99. .left_margin = margin_left, \
  100. .right_margin = margin_right, \
  101. .upper_margin = margin_top, \
  102. .lower_margin = margin_bottom, \
  103. .hsync_len = hsync, \
  104. .vsync_len = vsync, \
  105. .pixclock = ((_clock*100000000000LL) / \
  106. ((refresh) * \
  107. (hsync + margin_left + _xres + margin_right) * \
  108. (vsync + margin_top + _yres + margin_bottom))), \
  109. .bpp = 16,\
  110. .type = (S3C2410_LCDCON1_TFT16BPP |\
  111. S3C2410_LCDCON1_TFT)
  112. static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
  113. [0] = { /* mini2440 + 3.5" TFT + touchscreen */
  114. _LCD_DECLARE(
  115. 7, /* The 3.5 is quite fast */
  116. 240, 21, 38, 6, /* x timing */
  117. 320, 4, 4, 2, /* y timing */
  118. 60), /* refresh rate */
  119. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  120. S3C2410_LCDCON5_INVVLINE |
  121. S3C2410_LCDCON5_INVVFRAME |
  122. S3C2410_LCDCON5_INVVDEN |
  123. S3C2410_LCDCON5_PWREN),
  124. },
  125. [1] = { /* mini2440 + 7" TFT + touchscreen */
  126. _LCD_DECLARE(
  127. 10, /* the 7" runs slower */
  128. 800, 40, 40, 48, /* x timing */
  129. 480, 29, 3, 3, /* y timing */
  130. 50), /* refresh rate */
  131. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  132. S3C2410_LCDCON5_INVVLINE |
  133. S3C2410_LCDCON5_INVVFRAME |
  134. S3C2410_LCDCON5_PWREN),
  135. },
  136. /* The VGA shield can outout at several resolutions. All share
  137. * the same timings, however, anything smaller than 1024x768
  138. * will only be displayed in the top left corner of a 1024x768
  139. * XGA output unless you add optional dip switches to the shield.
  140. * Therefore timings for other resolutions have been omitted here.
  141. */
  142. [2] = {
  143. _LCD_DECLARE(
  144. 10,
  145. 1024, 1, 2, 2, /* y timing */
  146. 768, 200, 16, 16, /* x timing */
  147. 24), /* refresh rate, maximum stable,
  148. tested with the FPGA shield */
  149. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  150. S3C2410_LCDCON5_HWSWP),
  151. },
  152. /* mini2440 + 3.5" TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/
  153. [3] = {
  154. _LCD_DECLARE(
  155. /* clock */
  156. 7,
  157. /* xres, margin_right, margin_left, hsync */
  158. 320, 68, 66, 4,
  159. /* yres, margin_top, margin_bottom, vsync */
  160. 240, 4, 4, 9,
  161. /* refresh rate */
  162. 60),
  163. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  164. S3C2410_LCDCON5_INVVDEN |
  165. S3C2410_LCDCON5_INVVFRAME |
  166. S3C2410_LCDCON5_INVVLINE |
  167. S3C2410_LCDCON5_INVVCLK |
  168. S3C2410_LCDCON5_HWSWP),
  169. },
  170. };
  171. /* todo - put into gpio header */
  172. #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
  173. #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
  174. static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
  175. .displays = &mini2440_lcd_cfg[0], /* not constant! see init */
  176. .num_displays = 1,
  177. .default_display = 0,
  178. /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
  179. * and disable the pull down resistors on pins we are using for LCD
  180. * data. */
  181. .gpcup = (0xf << 1) | (0x3f << 10),
  182. .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
  183. S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
  184. S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
  185. S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
  186. S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
  187. .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
  188. S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
  189. S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
  190. S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
  191. S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
  192. .gpdup = (0x3f << 2) | (0x3f << 10),
  193. .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
  194. S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
  195. S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
  196. S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
  197. S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
  198. S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
  199. .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
  200. S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
  201. S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
  202. S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
  203. S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
  204. S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
  205. };
  206. /* MMC/SD */
  207. static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
  208. .gpio_detect = S3C2410_GPG(8),
  209. .gpio_wprotect = S3C2410_GPH(8),
  210. .set_power = NULL,
  211. .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
  212. };
  213. /* NAND Flash on MINI2440 board */
  214. static struct mtd_partition mini2440_default_nand_part[] __initdata = {
  215. [0] = {
  216. .name = "u-boot",
  217. .size = SZ_256K,
  218. .offset = 0,
  219. },
  220. [1] = {
  221. .name = "u-boot-env",
  222. .size = SZ_128K,
  223. .offset = SZ_256K,
  224. },
  225. [2] = {
  226. .name = "kernel",
  227. /* 5 megabytes, for a kernel with no modules
  228. * or a uImage with a ramdisk attached */
  229. .size = 0x00500000,
  230. .offset = SZ_256K + SZ_128K,
  231. },
  232. [3] = {
  233. .name = "root",
  234. .offset = SZ_256K + SZ_128K + 0x00500000,
  235. .size = MTDPART_SIZ_FULL,
  236. },
  237. };
  238. static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
  239. [0] = {
  240. .name = "nand",
  241. .nr_chips = 1,
  242. .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part),
  243. .partitions = mini2440_default_nand_part,
  244. .flash_bbt = 1, /* we use u-boot to create a BBT */
  245. },
  246. };
  247. static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
  248. .tacls = 0,
  249. .twrph0 = 25,
  250. .twrph1 = 15,
  251. .nr_sets = ARRAY_SIZE(mini2440_nand_sets),
  252. .sets = mini2440_nand_sets,
  253. .ignore_unset_ecc = 1,
  254. };
  255. /* DM9000AEP 10/100 ethernet controller */
  256. static struct resource mini2440_dm9k_resource[] = {
  257. [0] = {
  258. .start = MACH_MINI2440_DM9K_BASE,
  259. .end = MACH_MINI2440_DM9K_BASE + 3,
  260. .flags = IORESOURCE_MEM
  261. },
  262. [1] = {
  263. .start = MACH_MINI2440_DM9K_BASE + 4,
  264. .end = MACH_MINI2440_DM9K_BASE + 7,
  265. .flags = IORESOURCE_MEM
  266. },
  267. [2] = {
  268. .start = IRQ_EINT7,
  269. .end = IRQ_EINT7,
  270. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  271. }
  272. };
  273. /*
  274. * The DM9000 has no eeprom, and it's MAC address is set by
  275. * the bootloader before starting the kernel.
  276. */
  277. static struct dm9000_plat_data mini2440_dm9k_pdata = {
  278. .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
  279. };
  280. static struct platform_device mini2440_device_eth = {
  281. .name = "dm9000",
  282. .id = -1,
  283. .num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
  284. .resource = mini2440_dm9k_resource,
  285. .dev = {
  286. .platform_data = &mini2440_dm9k_pdata,
  287. },
  288. };
  289. /* CON5
  290. * +--+ /-----\
  291. * | | | |
  292. * | | | BAT |
  293. * | | \_____/
  294. * | |
  295. * | | +----+ +----+
  296. * | | | K5 | | K1 |
  297. * | | +----+ +----+
  298. * | | +----+ +----+
  299. * | | | K4 | | K2 |
  300. * | | +----+ +----+
  301. * | | +----+ +----+
  302. * | | | K6 | | K3 |
  303. * | | +----+ +----+
  304. * .....
  305. */
  306. static struct gpio_keys_button mini2440_buttons[] = {
  307. {
  308. .gpio = S3C2410_GPG(0), /* K1 */
  309. .code = KEY_F1,
  310. .desc = "Button 1",
  311. .active_low = 1,
  312. },
  313. {
  314. .gpio = S3C2410_GPG(3), /* K2 */
  315. .code = KEY_F2,
  316. .desc = "Button 2",
  317. .active_low = 1,
  318. },
  319. {
  320. .gpio = S3C2410_GPG(5), /* K3 */
  321. .code = KEY_F3,
  322. .desc = "Button 3",
  323. .active_low = 1,
  324. },
  325. {
  326. .gpio = S3C2410_GPG(6), /* K4 */
  327. .code = KEY_POWER,
  328. .desc = "Power",
  329. .active_low = 1,
  330. },
  331. {
  332. .gpio = S3C2410_GPG(7), /* K5 */
  333. .code = KEY_F5,
  334. .desc = "Button 5",
  335. .active_low = 1,
  336. },
  337. #if 0
  338. /* this pin is also known as TCLK1 and seems to already
  339. * marked as "in use" somehow in the kernel -- possibly wrongly */
  340. {
  341. .gpio = S3C2410_GPG(11), /* K6 */
  342. .code = KEY_F6,
  343. .desc = "Button 6",
  344. .active_low = 1,
  345. },
  346. #endif
  347. };
  348. static struct gpio_keys_platform_data mini2440_button_data = {
  349. .buttons = mini2440_buttons,
  350. .nbuttons = ARRAY_SIZE(mini2440_buttons),
  351. };
  352. static struct platform_device mini2440_button_device = {
  353. .name = "gpio-keys",
  354. .id = -1,
  355. .dev = {
  356. .platform_data = &mini2440_button_data,
  357. }
  358. };
  359. /* LEDS */
  360. static struct s3c24xx_led_platdata mini2440_led1_pdata = {
  361. .name = "led1",
  362. .gpio = S3C2410_GPB(5),
  363. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  364. .def_trigger = "heartbeat",
  365. };
  366. static struct s3c24xx_led_platdata mini2440_led2_pdata = {
  367. .name = "led2",
  368. .gpio = S3C2410_GPB(6),
  369. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  370. .def_trigger = "nand-disk",
  371. };
  372. static struct s3c24xx_led_platdata mini2440_led3_pdata = {
  373. .name = "led3",
  374. .gpio = S3C2410_GPB(7),
  375. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  376. .def_trigger = "mmc0",
  377. };
  378. static struct s3c24xx_led_platdata mini2440_led4_pdata = {
  379. .name = "led4",
  380. .gpio = S3C2410_GPB(8),
  381. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  382. .def_trigger = "",
  383. };
  384. static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
  385. .name = "backlight",
  386. .gpio = S3C2410_GPG(4),
  387. .def_trigger = "backlight",
  388. };
  389. static struct platform_device mini2440_led1 = {
  390. .name = "s3c24xx_led",
  391. .id = 1,
  392. .dev = {
  393. .platform_data = &mini2440_led1_pdata,
  394. },
  395. };
  396. static struct platform_device mini2440_led2 = {
  397. .name = "s3c24xx_led",
  398. .id = 2,
  399. .dev = {
  400. .platform_data = &mini2440_led2_pdata,
  401. },
  402. };
  403. static struct platform_device mini2440_led3 = {
  404. .name = "s3c24xx_led",
  405. .id = 3,
  406. .dev = {
  407. .platform_data = &mini2440_led3_pdata,
  408. },
  409. };
  410. static struct platform_device mini2440_led4 = {
  411. .name = "s3c24xx_led",
  412. .id = 4,
  413. .dev = {
  414. .platform_data = &mini2440_led4_pdata,
  415. },
  416. };
  417. static struct platform_device mini2440_led_backlight = {
  418. .name = "s3c24xx_led",
  419. .id = 5,
  420. .dev = {
  421. .platform_data = &mini2440_led_backlight_pdata,
  422. },
  423. };
  424. /* AUDIO */
  425. static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
  426. .l3_clk = S3C2410_GPB(4),
  427. .l3_mode = S3C2410_GPB(2),
  428. .l3_data = S3C2410_GPB(3),
  429. .model = UDA134X_UDA1341
  430. };
  431. static struct platform_device mini2440_audio = {
  432. .name = "s3c24xx_uda134x",
  433. .id = 0,
  434. .dev = {
  435. .platform_data = &mini2440_audio_pins,
  436. },
  437. };
  438. /*
  439. * I2C devices
  440. */
  441. static struct at24_platform_data at24c08 = {
  442. .byte_len = SZ_8K / 8,
  443. .page_size = 16,
  444. };
  445. static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
  446. {
  447. I2C_BOARD_INFO("24c08", 0x50),
  448. .platform_data = &at24c08,
  449. },
  450. };
  451. static struct platform_device uda1340_codec = {
  452. .name = "uda134x-codec",
  453. .id = -1,
  454. };
  455. static struct platform_device *mini2440_devices[] __initdata = {
  456. &s3c_device_ohci,
  457. &s3c_device_wdt,
  458. &s3c_device_i2c0,
  459. &s3c_device_rtc,
  460. &s3c_device_usbgadget,
  461. &mini2440_device_eth,
  462. &mini2440_led1,
  463. &mini2440_led2,
  464. &mini2440_led3,
  465. &mini2440_led4,
  466. &mini2440_button_device,
  467. &s3c_device_nand,
  468. &s3c_device_sdi,
  469. &s3c_device_iis,
  470. &uda1340_codec,
  471. &mini2440_audio,
  472. &samsung_asoc_dma,
  473. };
  474. static void __init mini2440_map_io(void)
  475. {
  476. s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
  477. s3c24xx_init_clocks(12000000);
  478. s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
  479. }
  480. /*
  481. * mini2440_features string
  482. *
  483. * t = Touchscreen present
  484. * b = backlight control
  485. * c = camera [TODO]
  486. * 0-9 LCD configuration
  487. *
  488. */
  489. static char mini2440_features_str[12] __initdata = "0tb";
  490. static int __init mini2440_features_setup(char *str)
  491. {
  492. if (str)
  493. strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str));
  494. return 1;
  495. }
  496. __setup("mini2440=", mini2440_features_setup);
  497. #define FEATURE_SCREEN (1 << 0)
  498. #define FEATURE_BACKLIGHT (1 << 1)
  499. #define FEATURE_TOUCH (1 << 2)
  500. #define FEATURE_CAMERA (1 << 3)
  501. struct mini2440_features_t {
  502. int count;
  503. int done;
  504. int lcd_index;
  505. struct platform_device *optional[8];
  506. };
  507. static void __init mini2440_parse_features(
  508. struct mini2440_features_t * features,
  509. const char * features_str )
  510. {
  511. const char * fp = features_str;
  512. features->count = 0;
  513. features->done = 0;
  514. features->lcd_index = -1;
  515. while (*fp) {
  516. char f = *fp++;
  517. switch (f) {
  518. case '0'...'9': /* tft screen */
  519. if (features->done & FEATURE_SCREEN) {
  520. printk(KERN_INFO "MINI2440: '%c' ignored, "
  521. "screen type already set\n", f);
  522. } else {
  523. int li = f - '0';
  524. if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
  525. printk(KERN_INFO "MINI2440: "
  526. "'%c' out of range LCD mode\n", f);
  527. else {
  528. features->optional[features->count++] =
  529. &s3c_device_lcd;
  530. features->lcd_index = li;
  531. }
  532. }
  533. features->done |= FEATURE_SCREEN;
  534. break;
  535. case 'b':
  536. if (features->done & FEATURE_BACKLIGHT)
  537. printk(KERN_INFO "MINI2440: '%c' ignored, "
  538. "backlight already set\n", f);
  539. else {
  540. features->optional[features->count++] =
  541. &mini2440_led_backlight;
  542. }
  543. features->done |= FEATURE_BACKLIGHT;
  544. break;
  545. case 't':
  546. printk(KERN_INFO "MINI2440: '%c' ignored, "
  547. "touchscreen not compiled in\n", f);
  548. break;
  549. case 'c':
  550. if (features->done & FEATURE_CAMERA)
  551. printk(KERN_INFO "MINI2440: '%c' ignored, "
  552. "camera already registered\n", f);
  553. else
  554. features->optional[features->count++] =
  555. &s3c_device_camif;
  556. features->done |= FEATURE_CAMERA;
  557. break;
  558. }
  559. }
  560. }
  561. static void __init mini2440_init(void)
  562. {
  563. struct mini2440_features_t features = { 0 };
  564. int i;
  565. printk(KERN_INFO "MINI2440: Option string mini2440=%s\n",
  566. mini2440_features_str);
  567. /* Parse the feature string */
  568. mini2440_parse_features(&features, mini2440_features_str);
  569. /* turn LCD on */
  570. s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
  571. /* Turn the backlight early on */
  572. WARN_ON(gpio_request(S3C2410_GPG(4), "backlight"));
  573. gpio_direction_output(S3C2410_GPG(4), 1);
  574. /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
  575. s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
  576. s3c2410_gpio_setpin(S3C2410_GPB(1), 0);
  577. s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
  578. /* mark the key as input, without pullups (there is one on the board) */
  579. for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
  580. s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
  581. s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
  582. }
  583. if (features.lcd_index != -1) {
  584. int li;
  585. mini2440_fb_info.displays =
  586. &mini2440_lcd_cfg[features.lcd_index];
  587. printk(KERN_INFO "MINI2440: LCD");
  588. for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
  589. if (li == features.lcd_index)
  590. printk(" [%d:%dx%d]", li,
  591. mini2440_lcd_cfg[li].width,
  592. mini2440_lcd_cfg[li].height);
  593. else
  594. printk(" %d:%dx%d", li,
  595. mini2440_lcd_cfg[li].width,
  596. mini2440_lcd_cfg[li].height);
  597. printk("\n");
  598. s3c24xx_fb_set_platdata(&mini2440_fb_info);
  599. }
  600. s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
  601. s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
  602. s3c_nand_set_platdata(&mini2440_nand_info);
  603. s3c_i2c0_set_platdata(NULL);
  604. i2c_register_board_info(0, mini2440_i2c_devs,
  605. ARRAY_SIZE(mini2440_i2c_devs));
  606. platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
  607. if (features.count) /* the optional features */
  608. platform_add_devices(features.optional, features.count);
  609. }
  610. MACHINE_START(MINI2440, "MINI2440")
  611. /* Maintainer: Michel Pollet <buserror@gmail.com> */
  612. .atag_offset = 0x100,
  613. .map_io = mini2440_map_io,
  614. .init_machine = mini2440_init,
  615. .init_irq = s3c24xx_init_irq,
  616. .timer = &s3c24xx_timer,
  617. MACHINE_END