mach-n30.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
  4. // Yakumo AlphaX and Airis NC05 PDAs.
  5. //
  6. // Copyright (c) 2003-2005 Simtec Electronics
  7. // Ben Dooks <[email protected]>
  8. //
  9. // Copyright (c) 2005-2008 Christer Weinigel <[email protected]>
  10. //
  11. // There is a wiki with more information about the n30 port at
  12. // https://handhelds.org/moin/moin.cgi/AcerN30Documentation .
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/gpio_keys.h>
  16. #include <linux/init.h>
  17. #include <linux/gpio.h>
  18. #include <linux/gpio/machine.h>
  19. #include <linux/input.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/serial_core.h>
  23. #include <linux/serial_s3c.h>
  24. #include <linux/timer.h>
  25. #include <linux/io.h>
  26. #include <linux/mmc/host.h>
  27. #include "hardware-s3c24xx.h"
  28. #include <asm/irq.h>
  29. #include <asm/mach-types.h>
  30. #include <linux/platform_data/fb-s3c2410.h>
  31. #include <linux/platform_data/leds-s3c24xx.h>
  32. #include "regs-gpio.h"
  33. #include "gpio-samsung.h"
  34. #include "gpio-cfg.h"
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/irq.h>
  37. #include <asm/mach/map.h>
  38. #include <linux/platform_data/i2c-s3c2410.h>
  39. #include "cpu.h"
  40. #include "devs.h"
  41. #include <linux/platform_data/mmc-s3cmci.h>
  42. #include <linux/platform_data/usb-s3c2410_udc.h>
  43. #include "s3c24xx.h"
  44. static struct map_desc n30_iodesc[] __initdata = {
  45. /* nothing here yet */
  46. };
  47. static struct s3c2410_uartcfg n30_uartcfgs[] = {
  48. /* Normal serial port */
  49. [0] = {
  50. .hwport = 0,
  51. .flags = 0,
  52. .ucon = 0x2c5,
  53. .ulcon = 0x03,
  54. .ufcon = 0x51,
  55. },
  56. /* IR port */
  57. [1] = {
  58. .hwport = 1,
  59. .flags = 0,
  60. .uart_flags = UPF_CONS_FLOW,
  61. .ucon = 0x2c5,
  62. .ulcon = 0x43,
  63. .ufcon = 0x51,
  64. },
  65. /* On the N30 the bluetooth controller is connected here.
  66. * On the N35 and variants the GPS receiver is connected here. */
  67. [2] = {
  68. .hwport = 2,
  69. .flags = 0,
  70. .ucon = 0x2c5,
  71. .ulcon = 0x03,
  72. .ufcon = 0x51,
  73. },
  74. };
  75. static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
  76. };
  77. static struct gpiod_lookup_table n30_udc_gpio_table = {
  78. .dev_id = "s3c2410-usbgadget",
  79. .table = {
  80. GPIO_LOOKUP("GPIOG", 1, "vbus", GPIO_ACTIVE_HIGH),
  81. GPIO_LOOKUP("GPIOB", 3, "pullup", GPIO_ACTIVE_HIGH),
  82. { },
  83. },
  84. };
  85. static struct gpio_keys_button n30_buttons[] = {
  86. {
  87. .gpio = S3C2410_GPF(0),
  88. .code = KEY_POWER,
  89. .desc = "Power",
  90. .active_low = 0,
  91. },
  92. {
  93. .gpio = S3C2410_GPG(9),
  94. .code = KEY_UP,
  95. .desc = "Thumbwheel Up",
  96. .active_low = 0,
  97. },
  98. {
  99. .gpio = S3C2410_GPG(8),
  100. .code = KEY_DOWN,
  101. .desc = "Thumbwheel Down",
  102. .active_low = 0,
  103. },
  104. {
  105. .gpio = S3C2410_GPG(7),
  106. .code = KEY_ENTER,
  107. .desc = "Thumbwheel Press",
  108. .active_low = 0,
  109. },
  110. {
  111. .gpio = S3C2410_GPF(7),
  112. .code = KEY_HOMEPAGE,
  113. .desc = "Home",
  114. .active_low = 0,
  115. },
  116. {
  117. .gpio = S3C2410_GPF(6),
  118. .code = KEY_CALENDAR,
  119. .desc = "Calendar",
  120. .active_low = 0,
  121. },
  122. {
  123. .gpio = S3C2410_GPF(5),
  124. .code = KEY_ADDRESSBOOK,
  125. .desc = "Contacts",
  126. .active_low = 0,
  127. },
  128. {
  129. .gpio = S3C2410_GPF(4),
  130. .code = KEY_MAIL,
  131. .desc = "Mail",
  132. .active_low = 0,
  133. },
  134. };
  135. static struct gpio_keys_platform_data n30_button_data = {
  136. .buttons = n30_buttons,
  137. .nbuttons = ARRAY_SIZE(n30_buttons),
  138. };
  139. static struct platform_device n30_button_device = {
  140. .name = "gpio-keys",
  141. .id = -1,
  142. .dev = {
  143. .platform_data = &n30_button_data,
  144. }
  145. };
  146. static struct gpio_keys_button n35_buttons[] = {
  147. {
  148. .gpio = S3C2410_GPF(0),
  149. .code = KEY_POWER,
  150. .type = EV_PWR,
  151. .desc = "Power",
  152. .active_low = 0,
  153. .wakeup = 1,
  154. },
  155. {
  156. .gpio = S3C2410_GPG(9),
  157. .code = KEY_UP,
  158. .desc = "Joystick Up",
  159. .active_low = 0,
  160. },
  161. {
  162. .gpio = S3C2410_GPG(8),
  163. .code = KEY_DOWN,
  164. .desc = "Joystick Down",
  165. .active_low = 0,
  166. },
  167. {
  168. .gpio = S3C2410_GPG(6),
  169. .code = KEY_DOWN,
  170. .desc = "Joystick Left",
  171. .active_low = 0,
  172. },
  173. {
  174. .gpio = S3C2410_GPG(5),
  175. .code = KEY_DOWN,
  176. .desc = "Joystick Right",
  177. .active_low = 0,
  178. },
  179. {
  180. .gpio = S3C2410_GPG(7),
  181. .code = KEY_ENTER,
  182. .desc = "Joystick Press",
  183. .active_low = 0,
  184. },
  185. {
  186. .gpio = S3C2410_GPF(7),
  187. .code = KEY_HOMEPAGE,
  188. .desc = "Home",
  189. .active_low = 0,
  190. },
  191. {
  192. .gpio = S3C2410_GPF(6),
  193. .code = KEY_CALENDAR,
  194. .desc = "Calendar",
  195. .active_low = 0,
  196. },
  197. {
  198. .gpio = S3C2410_GPF(5),
  199. .code = KEY_ADDRESSBOOK,
  200. .desc = "Contacts",
  201. .active_low = 0,
  202. },
  203. {
  204. .gpio = S3C2410_GPF(4),
  205. .code = KEY_MAIL,
  206. .desc = "Mail",
  207. .active_low = 0,
  208. },
  209. {
  210. .gpio = S3C2410_GPF(3),
  211. .code = SW_RADIO,
  212. .desc = "GPS Antenna",
  213. .active_low = 0,
  214. },
  215. {
  216. .gpio = S3C2410_GPG(2),
  217. .code = SW_HEADPHONE_INSERT,
  218. .desc = "Headphone",
  219. .active_low = 0,
  220. },
  221. };
  222. static struct gpio_keys_platform_data n35_button_data = {
  223. .buttons = n35_buttons,
  224. .nbuttons = ARRAY_SIZE(n35_buttons),
  225. };
  226. static struct platform_device n35_button_device = {
  227. .name = "gpio-keys",
  228. .id = -1,
  229. .num_resources = 0,
  230. .dev = {
  231. .platform_data = &n35_button_data,
  232. }
  233. };
  234. /* This is the bluetooth LED on the device. */
  235. static struct gpiod_lookup_table n30_blue_led_gpio_table = {
  236. .dev_id = "s3c24xx_led.1",
  237. .table = {
  238. GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
  239. { },
  240. },
  241. };
  242. static struct s3c24xx_led_platdata n30_blue_led_pdata = {
  243. .name = "blue_led",
  244. .def_trigger = "",
  245. };
  246. /* This is the blue LED on the device. Originally used to indicate GPS activity
  247. * by flashing. */
  248. static struct gpiod_lookup_table n35_blue_led_gpio_table = {
  249. .dev_id = "s3c24xx_led.1",
  250. .table = {
  251. GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
  252. { },
  253. },
  254. };
  255. static struct s3c24xx_led_platdata n35_blue_led_pdata = {
  256. .name = "blue_led",
  257. .def_trigger = "",
  258. };
  259. /* This LED is driven by the battery microcontroller, and is blinking
  260. * red, blinking green or solid green when the battery is low,
  261. * charging or full respectively. By driving GPD9 low, it's possible
  262. * to force the LED to blink red, so call that warning LED. */
  263. static struct gpiod_lookup_table n30_warning_led_gpio_table = {
  264. .dev_id = "s3c24xx_led.2",
  265. .table = {
  266. GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
  267. { },
  268. },
  269. };
  270. static struct s3c24xx_led_platdata n30_warning_led_pdata = {
  271. .name = "warning_led",
  272. .def_trigger = "",
  273. };
  274. static struct gpiod_lookup_table n35_warning_led_gpio_table = {
  275. .dev_id = "s3c24xx_led.2",
  276. .table = {
  277. GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
  278. { },
  279. },
  280. };
  281. static struct s3c24xx_led_platdata n35_warning_led_pdata = {
  282. .name = "warning_led",
  283. .def_trigger = "",
  284. };
  285. static struct platform_device n30_blue_led = {
  286. .name = "s3c24xx_led",
  287. .id = 1,
  288. .dev = {
  289. .platform_data = &n30_blue_led_pdata,
  290. },
  291. };
  292. static struct platform_device n35_blue_led = {
  293. .name = "s3c24xx_led",
  294. .id = 1,
  295. .dev = {
  296. .platform_data = &n35_blue_led_pdata,
  297. },
  298. };
  299. static struct platform_device n30_warning_led = {
  300. .name = "s3c24xx_led",
  301. .id = 2,
  302. .dev = {
  303. .platform_data = &n30_warning_led_pdata,
  304. },
  305. };
  306. static struct platform_device n35_warning_led = {
  307. .name = "s3c24xx_led",
  308. .id = 2,
  309. .dev = {
  310. .platform_data = &n35_warning_led_pdata,
  311. },
  312. };
  313. static struct s3c2410fb_display n30_display __initdata = {
  314. .type = S3C2410_LCDCON1_TFT,
  315. .width = 240,
  316. .height = 320,
  317. .pixclock = 170000,
  318. .xres = 240,
  319. .yres = 320,
  320. .bpp = 16,
  321. .left_margin = 3,
  322. .right_margin = 40,
  323. .hsync_len = 40,
  324. .upper_margin = 2,
  325. .lower_margin = 3,
  326. .vsync_len = 2,
  327. .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
  328. };
  329. static struct s3c2410fb_mach_info n30_fb_info __initdata = {
  330. .displays = &n30_display,
  331. .num_displays = 1,
  332. .default_display = 0,
  333. .lpcsel = 0x06,
  334. };
  335. static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
  336. {
  337. s3c24xx_mci_def_set_power(power_mode, vdd);
  338. switch (power_mode) {
  339. case MMC_POWER_ON:
  340. case MMC_POWER_UP:
  341. gpio_set_value(S3C2410_GPG(4), 1);
  342. break;
  343. case MMC_POWER_OFF:
  344. default:
  345. gpio_set_value(S3C2410_GPG(4), 0);
  346. break;
  347. }
  348. }
  349. static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
  350. .ocr_avail = MMC_VDD_32_33,
  351. .set_power = n30_sdi_set_power,
  352. };
  353. static struct gpiod_lookup_table n30_mci_gpio_table = {
  354. .dev_id = "s3c2410-sdi",
  355. .table = {
  356. /* Card detect S3C2410_GPF(1) */
  357. GPIO_LOOKUP("GPIOF", 1, "cd", GPIO_ACTIVE_LOW),
  358. /* Write protect S3C2410_GPG(10) */
  359. GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW),
  360. { },
  361. /* bus pins */
  362. GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
  363. GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
  364. GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
  365. GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
  366. GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
  367. GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
  368. },
  369. };
  370. static struct platform_device *n30_devices[] __initdata = {
  371. &s3c_device_lcd,
  372. &s3c_device_wdt,
  373. &s3c_device_i2c0,
  374. &s3c_device_iis,
  375. &s3c_device_ohci,
  376. &s3c_device_rtc,
  377. &s3c_device_usbgadget,
  378. &s3c_device_sdi,
  379. &n30_button_device,
  380. &n30_blue_led,
  381. &n30_warning_led,
  382. };
  383. static struct platform_device *n35_devices[] __initdata = {
  384. &s3c_device_lcd,
  385. &s3c_device_wdt,
  386. &s3c_device_i2c0,
  387. &s3c_device_iis,
  388. &s3c_device_rtc,
  389. &s3c_device_usbgadget,
  390. &s3c_device_sdi,
  391. &n35_button_device,
  392. &n35_blue_led,
  393. &n35_warning_led,
  394. };
  395. static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
  396. .flags = 0,
  397. .slave_addr = 0x10,
  398. .frequency = 10*1000,
  399. };
  400. /* Lots of hardcoded stuff, but it sets up the hardware in a useful
  401. * state so that we can boot Linux directly from flash. */
  402. static void __init n30_hwinit(void)
  403. {
  404. /* GPA0-11 special functions -- unknown what they do
  405. * GPA12 N30 special function -- unknown what it does
  406. * N35/PiN output -- unknown what it does
  407. *
  408. * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
  409. * don't think it does anything useful on the N30, so I ought
  410. * to make it an output there too since it always driven to 0
  411. * as far as I can tell. */
  412. if (machine_is_n30())
  413. __raw_writel(0x007fffff, S3C2410_GPACON);
  414. if (machine_is_n35())
  415. __raw_writel(0x007fefff, S3C2410_GPACON);
  416. __raw_writel(0x00000000, S3C2410_GPADAT);
  417. /* GPB0 TOUT0 backlight level
  418. * GPB1 output 1=backlight on
  419. * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
  420. * GPB3 output USB D+ pull up 0=disabled, 1=enabled
  421. * GPB4 N30 output -- unknown function
  422. * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
  423. * GPB5 output -- unknown function
  424. * GPB6 input -- unknown function
  425. * GPB7 output -- unknown function
  426. * GPB8 output -- probably LCD driver enable
  427. * GPB9 output -- probably LCD VSYNC driver enable
  428. * GPB10 output -- probably LCD HSYNC driver enable
  429. */
  430. __raw_writel(0x00154556, S3C2410_GPBCON);
  431. __raw_writel(0x00000750, S3C2410_GPBDAT);
  432. __raw_writel(0x00000073, S3C2410_GPBUP);
  433. /* GPC0 input RS232 DCD/DSR/RI
  434. * GPC1 LCD
  435. * GPC2 output RS232 DTR?
  436. * GPC3 input RS232 DCD/DSR/RI
  437. * GPC4 LCD
  438. * GPC5 output 0=NAND write enabled, 1=NAND write protect
  439. * GPC6 input -- unknown function
  440. * GPC7 input charger status 0=charger connected
  441. * this input can be triggered by power on the USB device
  442. * port too, but will go back to disconnected soon after.
  443. * GPC8 N30/N35 output -- unknown function, always driven to 1
  444. * PiN input -- unknown function, always read as 1
  445. * Make it an input with a pull up for all models.
  446. * GPC9-15 LCD
  447. */
  448. __raw_writel(0xaaa80618, S3C2410_GPCCON);
  449. __raw_writel(0x0000014c, S3C2410_GPCDAT);
  450. __raw_writel(0x0000fef2, S3C2410_GPCUP);
  451. /* GPD0 input -- unknown function
  452. * GPD1-D7 LCD
  453. * GPD8 N30 output -- unknown function
  454. * N35/PiN output 1=GPS LED on
  455. * GPD9 output 0=power led blinks red, 1=normal power led function
  456. * GPD10 output -- unknown function
  457. * GPD11-15 LCD drivers
  458. */
  459. __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
  460. __raw_writel(0x00000601, S3C2410_GPDDAT);
  461. __raw_writel(0x0000fbfe, S3C2410_GPDUP);
  462. /* GPE0-4 I2S audio bus
  463. * GPE5-10 SD/MMC bus
  464. * E11-13 outputs -- unknown function, probably power management
  465. * E14-15 I2C bus connected to the battery controller
  466. */
  467. __raw_writel(0xa56aaaaa, S3C2410_GPECON);
  468. __raw_writel(0x0000efc5, S3C2410_GPEDAT);
  469. __raw_writel(0x0000f81f, S3C2410_GPEUP);
  470. /* GPF0 input 0=power button pressed
  471. * GPF1 input SD/MMC switch 0=card present
  472. * GPF2 N30 1=reset button pressed (inverted compared to the rest)
  473. * N35/PiN 0=reset button pressed
  474. * GPF3 N30/PiN input -- unknown function
  475. * N35 input GPS antenna position, 0=antenna closed, 1=open
  476. * GPF4 input 0=button 4 pressed
  477. * GPF5 input 0=button 3 pressed
  478. * GPF6 input 0=button 2 pressed
  479. * GPF7 input 0=button 1 pressed
  480. */
  481. __raw_writel(0x0000aaaa, S3C2410_GPFCON);
  482. __raw_writel(0x00000000, S3C2410_GPFDAT);
  483. __raw_writel(0x000000ff, S3C2410_GPFUP);
  484. /* GPG0 input RS232 DCD/DSR/RI
  485. * GPG1 input 1=USB gadget port has power from a host
  486. * GPG2 N30 input -- unknown function
  487. * N35/PiN input 0=headphones plugged in, 1=not plugged in
  488. * GPG3 N30 output -- unknown function
  489. * N35/PiN input with unknown function
  490. * GPG4 N30 output 0=MMC enabled, 1=MMC disabled
  491. * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled
  492. * N35/PiN input joystick right
  493. * GPG6 N30 output 0=blue led on, 1=off
  494. * N35/PiN input joystick left
  495. * GPG7 input 0=thumbwheel pressed
  496. * GPG8 input 0=thumbwheel down
  497. * GPG9 input 0=thumbwheel up
  498. * GPG10 input SD/MMC write protect switch
  499. * GPG11 N30 input -- unknown function
  500. * N35 output 0=GPS antenna powered, 1=not powered
  501. * PiN output -- unknown function
  502. * GPG12-15 touch screen functions
  503. *
  504. * The pullups differ between the models, so enable all
  505. * pullups that are enabled on any of the models.
  506. */
  507. if (machine_is_n30())
  508. __raw_writel(0xff0a956a, S3C2410_GPGCON);
  509. if (machine_is_n35())
  510. __raw_writel(0xff4aa92a, S3C2410_GPGCON);
  511. __raw_writel(0x0000e800, S3C2410_GPGDAT);
  512. __raw_writel(0x0000f86f, S3C2410_GPGUP);
  513. /* GPH0/1/2/3 RS232 serial port
  514. * GPH4/5 IrDA serial port
  515. * GPH6/7 N30 BlueTooth serial port
  516. * N35/PiN GPS receiver
  517. * GPH8 input -- unknown function
  518. * GPH9 CLKOUT0 HCLK -- unknown use
  519. * GPH10 CLKOUT1 FCLK -- unknown use
  520. *
  521. * The pull ups for H6/H7 are enabled on N30 but not on the
  522. * N35/PiN. I suppose is useful for a budget model of the N30
  523. * with no bluetooth. It doesn't hurt to have the pull ups
  524. * enabled on the N35, so leave them enabled for all models.
  525. */
  526. __raw_writel(0x0028aaaa, S3C2410_GPHCON);
  527. __raw_writel(0x000005ef, S3C2410_GPHDAT);
  528. __raw_writel(0x0000063f, S3C2410_GPHUP);
  529. }
  530. static void __init n30_map_io(void)
  531. {
  532. s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
  533. n30_hwinit();
  534. s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
  535. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  536. }
  537. static void __init n30_init_time(void)
  538. {
  539. s3c2410_init_clocks(12000000);
  540. s3c24xx_timer_init();
  541. }
  542. /* GPB3 is the line that controls the pull-up for the USB D+ line */
  543. static void __init n30_init(void)
  544. {
  545. WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
  546. s3c24xx_fb_set_platdata(&n30_fb_info);
  547. gpiod_add_lookup_table(&n30_udc_gpio_table);
  548. s3c24xx_udc_set_platdata(&n30_udc_cfg);
  549. gpiod_add_lookup_table(&n30_mci_gpio_table);
  550. s3c24xx_mci_set_platdata(&n30_mci_cfg);
  551. s3c_i2c0_set_platdata(&n30_i2ccfg);
  552. /* Turn off suspend on both USB ports, and switch the
  553. * selectable USB port to USB device mode. */
  554. s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
  555. S3C2410_MISCCR_USBSUSPND0 |
  556. S3C2410_MISCCR_USBSUSPND1, 0x0);
  557. /* Configure the I2S pins (GPE0...GPE4) in correct mode */
  558. s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
  559. S3C_GPIO_PULL_NONE);
  560. if (machine_is_n30()) {
  561. /* Turn off suspend on both USB ports, and switch the
  562. * selectable USB port to USB device mode. */
  563. s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
  564. S3C2410_MISCCR_USBSUSPND0 |
  565. S3C2410_MISCCR_USBSUSPND1, 0x0);
  566. /* Disable pull-up and add GPIO tables */
  567. s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
  568. s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
  569. gpiod_add_lookup_table(&n30_blue_led_gpio_table);
  570. gpiod_add_lookup_table(&n30_warning_led_gpio_table);
  571. platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
  572. }
  573. if (machine_is_n35()) {
  574. /* Turn off suspend and switch the selectable USB port
  575. * to USB device mode. Turn on suspend for the host
  576. * port since it is not connected on the N35.
  577. *
  578. * Actually, the host port is available at some pads
  579. * on the back of the device, so it would actually be
  580. * possible to add a USB device inside the N35 if you
  581. * are willing to do some hardware modifications. */
  582. s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
  583. S3C2410_MISCCR_USBSUSPND0 |
  584. S3C2410_MISCCR_USBSUSPND1,
  585. S3C2410_MISCCR_USBSUSPND0);
  586. /* Disable pull-up and add GPIO tables */
  587. s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
  588. s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
  589. gpiod_add_lookup_table(&n35_blue_led_gpio_table);
  590. gpiod_add_lookup_table(&n35_warning_led_gpio_table);
  591. platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
  592. }
  593. }
  594. MACHINE_START(N30, "Acer-N30")
  595. /* Maintainer: Christer Weinigel <[email protected]>,
  596. Ben Dooks <[email protected]>
  597. */
  598. .atag_offset = 0x100,
  599. .nr_irqs = NR_IRQS_S3C2410,
  600. .init_time = n30_init_time,
  601. .init_machine = n30_init,
  602. .init_irq = s3c2410_init_irq,
  603. .map_io = n30_map_io,
  604. MACHINE_END
  605. MACHINE_START(N35, "Acer-N35")
  606. /* Maintainer: Christer Weinigel <[email protected]>
  607. */
  608. .atag_offset = 0x100,
  609. .nr_irqs = NR_IRQS_S3C2410,
  610. .init_time = n30_init_time,
  611. .init_machine = n30_init,
  612. .init_irq = s3c2410_init_irq,
  613. .map_io = n30_map_io,
  614. MACHINE_END