mach-mini2440.c 18 KB

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