board-n8x0.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. /*
  2. * linux/arch/arm/mach-omap2/board-n8x0.c
  3. *
  4. * Copyright (C) 2005-2009 Nokia Corporation
  5. * Author: Juha Yrjola <juha.yrjola@nokia.com>
  6. *
  7. * Modified from mach-omap2/board-generic.c
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/clk.h>
  14. #include <linux/delay.h>
  15. #include <linux/gpio.h>
  16. #include <linux/init.h>
  17. #include <linux/io.h>
  18. #include <linux/irq.h>
  19. #include <linux/stddef.h>
  20. #include <linux/i2c.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/usb/musb.h>
  23. #include <linux/platform_data/i2c-cbus-gpio.h>
  24. #include <linux/platform_data/spi-omap2-mcspi.h>
  25. #include <linux/platform_data/mtd-onenand-omap2.h>
  26. #include <sound/tlv320aic3x.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach-types.h>
  29. #include "common.h"
  30. #include <plat/menelaus.h>
  31. #include <plat/mmc.h>
  32. #include "mux.h"
  33. #define TUSB6010_ASYNC_CS 1
  34. #define TUSB6010_SYNC_CS 4
  35. #define TUSB6010_GPIO_INT 58
  36. #define TUSB6010_GPIO_ENABLE 0
  37. #define TUSB6010_DMACHAN 0x3f
  38. #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE)
  39. static struct i2c_cbus_platform_data n8x0_cbus_data = {
  40. .clk_gpio = 66,
  41. .dat_gpio = 65,
  42. .sel_gpio = 64,
  43. };
  44. static struct platform_device n8x0_cbus_device = {
  45. .name = "i2c-cbus-gpio",
  46. .id = 3,
  47. .dev = {
  48. .platform_data = &n8x0_cbus_data,
  49. },
  50. };
  51. static struct i2c_board_info n8x0_i2c_board_info_3[] __initdata = {
  52. {
  53. I2C_BOARD_INFO("retu-mfd", 0x01),
  54. },
  55. };
  56. static void __init n8x0_cbus_init(void)
  57. {
  58. const int retu_irq_gpio = 108;
  59. if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
  60. return;
  61. irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
  62. n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio);
  63. i2c_register_board_info(3, n8x0_i2c_board_info_3,
  64. ARRAY_SIZE(n8x0_i2c_board_info_3));
  65. platform_device_register(&n8x0_cbus_device);
  66. }
  67. #else /* CONFIG_I2C_CBUS_GPIO */
  68. static void __init n8x0_cbus_init(void)
  69. {
  70. }
  71. #endif /* CONFIG_I2C_CBUS_GPIO */
  72. #if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
  73. /*
  74. * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
  75. * 1.5 V voltage regulators of PM companion chip. Companion chip will then
  76. * provide then PGOOD signal to TUSB6010 which will release it from reset.
  77. */
  78. static int tusb_set_power(int state)
  79. {
  80. int i, retval = 0;
  81. if (state) {
  82. gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
  83. msleep(1);
  84. /* Wait until TUSB6010 pulls INT pin down */
  85. i = 100;
  86. while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
  87. msleep(1);
  88. i--;
  89. }
  90. if (!i) {
  91. printk(KERN_ERR "tusb: powerup failed\n");
  92. retval = -ENODEV;
  93. }
  94. } else {
  95. gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
  96. msleep(10);
  97. }
  98. return retval;
  99. }
  100. static struct musb_hdrc_config musb_config = {
  101. .multipoint = 1,
  102. .dyn_fifo = 1,
  103. .num_eps = 16,
  104. .ram_bits = 12,
  105. };
  106. static struct musb_hdrc_platform_data tusb_data = {
  107. #ifdef CONFIG_USB_GADGET_MUSB_HDRC
  108. .mode = MUSB_OTG,
  109. #else
  110. .mode = MUSB_HOST,
  111. #endif
  112. .set_power = tusb_set_power,
  113. .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
  114. .power = 100, /* Max 100 mA VBUS for host mode */
  115. .config = &musb_config,
  116. };
  117. static void __init n8x0_usb_init(void)
  118. {
  119. int ret = 0;
  120. static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
  121. /* PM companion chip power control pin */
  122. ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
  123. "TUSB6010 enable");
  124. if (ret != 0) {
  125. printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
  126. TUSB6010_GPIO_ENABLE);
  127. return;
  128. }
  129. tusb_set_power(0);
  130. ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
  131. TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
  132. TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
  133. if (ret != 0)
  134. goto err;
  135. printk(announce);
  136. return;
  137. err:
  138. gpio_free(TUSB6010_GPIO_ENABLE);
  139. }
  140. #else
  141. static void __init n8x0_usb_init(void) {}
  142. #endif /*CONFIG_USB_MUSB_TUSB6010 */
  143. static struct omap2_mcspi_device_config p54spi_mcspi_config = {
  144. .turbo_mode = 0,
  145. };
  146. static struct spi_board_info n800_spi_board_info[] __initdata = {
  147. {
  148. .modalias = "p54spi",
  149. .bus_num = 2,
  150. .chip_select = 0,
  151. .max_speed_hz = 48000000,
  152. .controller_data = &p54spi_mcspi_config,
  153. },
  154. };
  155. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  156. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  157. static struct mtd_partition onenand_partitions[] = {
  158. {
  159. .name = "bootloader",
  160. .offset = 0,
  161. .size = 0x20000,
  162. .mask_flags = MTD_WRITEABLE, /* Force read-only */
  163. },
  164. {
  165. .name = "config",
  166. .offset = MTDPART_OFS_APPEND,
  167. .size = 0x60000,
  168. },
  169. {
  170. .name = "kernel",
  171. .offset = MTDPART_OFS_APPEND,
  172. .size = 0x200000,
  173. },
  174. {
  175. .name = "initfs",
  176. .offset = MTDPART_OFS_APPEND,
  177. .size = 0x400000,
  178. },
  179. {
  180. .name = "rootfs",
  181. .offset = MTDPART_OFS_APPEND,
  182. .size = MTDPART_SIZ_FULL,
  183. },
  184. };
  185. static struct omap_onenand_platform_data board_onenand_data[] = {
  186. {
  187. .cs = 0,
  188. .gpio_irq = 26,
  189. .parts = onenand_partitions,
  190. .nr_parts = ARRAY_SIZE(onenand_partitions),
  191. .flags = ONENAND_SYNC_READ,
  192. }
  193. };
  194. #endif
  195. #if defined(CONFIG_MENELAUS) && \
  196. (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
  197. /*
  198. * On both N800 and N810, only the first of the two MMC controllers is in use.
  199. * The two MMC slots are multiplexed via Menelaus companion chip over I2C.
  200. * On N800, both slots are powered via Menelaus. On N810, only one of the
  201. * slots is powered via Menelaus. The N810 EMMC is powered via GPIO.
  202. *
  203. * VMMC slot 1 on both N800 and N810
  204. * VDCDC3_APE and VMCS2_APE slot 2 on N800
  205. * GPIO23 and GPIO9 slot 2 EMMC on N810
  206. *
  207. */
  208. #define N8X0_SLOT_SWITCH_GPIO 96
  209. #define N810_EMMC_VSD_GPIO 23
  210. #define N810_EMMC_VIO_GPIO 9
  211. static int slot1_cover_open;
  212. static int slot2_cover_open;
  213. static struct device *mmc_device;
  214. static int n8x0_mmc_switch_slot(struct device *dev, int slot)
  215. {
  216. #ifdef CONFIG_MMC_DEBUG
  217. dev_dbg(dev, "Choose slot %d\n", slot + 1);
  218. #endif
  219. gpio_set_value(N8X0_SLOT_SWITCH_GPIO, slot);
  220. return 0;
  221. }
  222. static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,
  223. int power_on, int vdd)
  224. {
  225. int mV;
  226. #ifdef CONFIG_MMC_DEBUG
  227. dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
  228. power_on ? "on" : "off", vdd);
  229. #endif
  230. if (slot == 0) {
  231. if (!power_on)
  232. return menelaus_set_vmmc(0);
  233. switch (1 << vdd) {
  234. case MMC_VDD_33_34:
  235. case MMC_VDD_32_33:
  236. case MMC_VDD_31_32:
  237. mV = 3100;
  238. break;
  239. case MMC_VDD_30_31:
  240. mV = 3000;
  241. break;
  242. case MMC_VDD_28_29:
  243. mV = 2800;
  244. break;
  245. case MMC_VDD_165_195:
  246. mV = 1850;
  247. break;
  248. default:
  249. BUG();
  250. }
  251. return menelaus_set_vmmc(mV);
  252. } else {
  253. if (!power_on)
  254. return menelaus_set_vdcdc(3, 0);
  255. switch (1 << vdd) {
  256. case MMC_VDD_33_34:
  257. case MMC_VDD_32_33:
  258. mV = 3300;
  259. break;
  260. case MMC_VDD_30_31:
  261. case MMC_VDD_29_30:
  262. mV = 3000;
  263. break;
  264. case MMC_VDD_28_29:
  265. case MMC_VDD_27_28:
  266. mV = 2800;
  267. break;
  268. case MMC_VDD_24_25:
  269. case MMC_VDD_23_24:
  270. mV = 2400;
  271. break;
  272. case MMC_VDD_22_23:
  273. case MMC_VDD_21_22:
  274. mV = 2200;
  275. break;
  276. case MMC_VDD_20_21:
  277. mV = 2000;
  278. break;
  279. case MMC_VDD_165_195:
  280. mV = 1800;
  281. break;
  282. default:
  283. BUG();
  284. }
  285. return menelaus_set_vdcdc(3, mV);
  286. }
  287. return 0;
  288. }
  289. static void n810_set_power_emmc(struct device *dev,
  290. int power_on)
  291. {
  292. dev_dbg(dev, "Set EMMC power %s\n", power_on ? "on" : "off");
  293. if (power_on) {
  294. gpio_set_value(N810_EMMC_VSD_GPIO, 1);
  295. msleep(1);
  296. gpio_set_value(N810_EMMC_VIO_GPIO, 1);
  297. msleep(1);
  298. } else {
  299. gpio_set_value(N810_EMMC_VIO_GPIO, 0);
  300. msleep(50);
  301. gpio_set_value(N810_EMMC_VSD_GPIO, 0);
  302. msleep(50);
  303. }
  304. }
  305. static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
  306. int vdd)
  307. {
  308. if (machine_is_nokia_n800() || slot == 0)
  309. return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
  310. n810_set_power_emmc(dev, power_on);
  311. return 0;
  312. }
  313. static int n8x0_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
  314. {
  315. int r;
  316. dev_dbg(dev, "Set slot %d bus mode %s\n", slot + 1,
  317. bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
  318. BUG_ON(slot != 0 && slot != 1);
  319. slot++;
  320. switch (bus_mode) {
  321. case MMC_BUSMODE_OPENDRAIN:
  322. r = menelaus_set_mmc_opendrain(slot, 1);
  323. break;
  324. case MMC_BUSMODE_PUSHPULL:
  325. r = menelaus_set_mmc_opendrain(slot, 0);
  326. break;
  327. default:
  328. BUG();
  329. }
  330. if (r != 0 && printk_ratelimit())
  331. dev_err(dev, "MMC: unable to set bus mode for slot %d\n",
  332. slot);
  333. return r;
  334. }
  335. static int n8x0_mmc_get_cover_state(struct device *dev, int slot)
  336. {
  337. slot++;
  338. BUG_ON(slot != 1 && slot != 2);
  339. if (slot == 1)
  340. return slot1_cover_open;
  341. else
  342. return slot2_cover_open;
  343. }
  344. static void n8x0_mmc_callback(void *data, u8 card_mask)
  345. {
  346. int bit, *openp, index;
  347. if (machine_is_nokia_n800()) {
  348. bit = 1 << 1;
  349. openp = &slot2_cover_open;
  350. index = 1;
  351. } else {
  352. bit = 1;
  353. openp = &slot1_cover_open;
  354. index = 0;
  355. }
  356. if (card_mask & bit)
  357. *openp = 1;
  358. else
  359. *openp = 0;
  360. #ifdef CONFIG_MMC_OMAP
  361. omap_mmc_notify_cover_event(mmc_device, index, *openp);
  362. #else
  363. pr_warn("MMC: notify cover event not available\n");
  364. #endif
  365. }
  366. static int n8x0_mmc_late_init(struct device *dev)
  367. {
  368. int r, bit, *openp;
  369. int vs2sel;
  370. mmc_device = dev;
  371. r = menelaus_set_slot_sel(1);
  372. if (r < 0)
  373. return r;
  374. if (machine_is_nokia_n800())
  375. vs2sel = 0;
  376. else
  377. vs2sel = 2;
  378. r = menelaus_set_mmc_slot(2, 0, vs2sel, 1);
  379. if (r < 0)
  380. return r;
  381. n8x0_mmc_set_power(dev, 0, MMC_POWER_ON, 16); /* MMC_VDD_28_29 */
  382. n8x0_mmc_set_power(dev, 1, MMC_POWER_ON, 16);
  383. r = menelaus_set_mmc_slot(1, 1, 0, 1);
  384. if (r < 0)
  385. return r;
  386. r = menelaus_set_mmc_slot(2, 1, vs2sel, 1);
  387. if (r < 0)
  388. return r;
  389. r = menelaus_get_slot_pin_states();
  390. if (r < 0)
  391. return r;
  392. if (machine_is_nokia_n800()) {
  393. bit = 1 << 1;
  394. openp = &slot2_cover_open;
  395. } else {
  396. bit = 1;
  397. openp = &slot1_cover_open;
  398. slot2_cover_open = 0;
  399. }
  400. /* All slot pin bits seem to be inversed until first switch change */
  401. if (r == 0xf || r == (0xf & ~bit))
  402. r = ~r;
  403. if (r & bit)
  404. *openp = 1;
  405. else
  406. *openp = 0;
  407. r = menelaus_register_mmc_callback(n8x0_mmc_callback, NULL);
  408. return r;
  409. }
  410. static void n8x0_mmc_shutdown(struct device *dev)
  411. {
  412. int vs2sel;
  413. if (machine_is_nokia_n800())
  414. vs2sel = 0;
  415. else
  416. vs2sel = 2;
  417. menelaus_set_mmc_slot(1, 0, 0, 0);
  418. menelaus_set_mmc_slot(2, 0, vs2sel, 0);
  419. }
  420. static void n8x0_mmc_cleanup(struct device *dev)
  421. {
  422. menelaus_unregister_mmc_callback();
  423. gpio_free(N8X0_SLOT_SWITCH_GPIO);
  424. if (machine_is_nokia_n810()) {
  425. gpio_free(N810_EMMC_VSD_GPIO);
  426. gpio_free(N810_EMMC_VIO_GPIO);
  427. }
  428. }
  429. /*
  430. * MMC controller1 has two slots that are multiplexed via I2C.
  431. * MMC controller2 is not in use.
  432. */
  433. static struct omap_mmc_platform_data mmc1_data = {
  434. .nr_slots = 2,
  435. .switch_slot = n8x0_mmc_switch_slot,
  436. .init = n8x0_mmc_late_init,
  437. .cleanup = n8x0_mmc_cleanup,
  438. .shutdown = n8x0_mmc_shutdown,
  439. .max_freq = 24000000,
  440. .slots[0] = {
  441. .wires = 4,
  442. .set_power = n8x0_mmc_set_power,
  443. .set_bus_mode = n8x0_mmc_set_bus_mode,
  444. .get_cover_state = n8x0_mmc_get_cover_state,
  445. .ocr_mask = MMC_VDD_165_195 | MMC_VDD_30_31 |
  446. MMC_VDD_32_33 | MMC_VDD_33_34,
  447. .name = "internal",
  448. },
  449. .slots[1] = {
  450. .set_power = n8x0_mmc_set_power,
  451. .set_bus_mode = n8x0_mmc_set_bus_mode,
  452. .get_cover_state = n8x0_mmc_get_cover_state,
  453. .ocr_mask = MMC_VDD_165_195 | MMC_VDD_20_21 |
  454. MMC_VDD_21_22 | MMC_VDD_22_23 |
  455. MMC_VDD_23_24 | MMC_VDD_24_25 |
  456. MMC_VDD_27_28 | MMC_VDD_28_29 |
  457. MMC_VDD_29_30 | MMC_VDD_30_31 |
  458. MMC_VDD_32_33 | MMC_VDD_33_34,
  459. .name = "external",
  460. },
  461. };
  462. static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
  463. static struct gpio n810_emmc_gpios[] __initdata = {
  464. { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" },
  465. { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" },
  466. };
  467. static void __init n8x0_mmc_init(void)
  468. {
  469. int err;
  470. if (machine_is_nokia_n810()) {
  471. mmc1_data.slots[0].name = "external";
  472. /*
  473. * Some Samsung Movinand chips do not like open-ended
  474. * multi-block reads and fall to braind-dead state
  475. * while doing so. Reducing the number of blocks in
  476. * the transfer or delays in clock disable do not help
  477. */
  478. mmc1_data.slots[1].name = "internal";
  479. mmc1_data.slots[1].ban_openended = 1;
  480. }
  481. err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
  482. "MMC slot switch");
  483. if (err)
  484. return;
  485. if (machine_is_nokia_n810()) {
  486. err = gpio_request_array(n810_emmc_gpios,
  487. ARRAY_SIZE(n810_emmc_gpios));
  488. if (err) {
  489. gpio_free(N8X0_SLOT_SWITCH_GPIO);
  490. return;
  491. }
  492. }
  493. mmc_data[0] = &mmc1_data;
  494. omap242x_init_mmc(mmc_data);
  495. }
  496. #else
  497. void __init n8x0_mmc_init(void)
  498. {
  499. }
  500. #endif /* CONFIG_MMC_OMAP */
  501. #ifdef CONFIG_MENELAUS
  502. static int n8x0_auto_sleep_regulators(void)
  503. {
  504. u32 val;
  505. int ret;
  506. val = EN_VPLL_SLEEP | EN_VMMC_SLEEP \
  507. | EN_VAUX_SLEEP | EN_VIO_SLEEP \
  508. | EN_VMEM_SLEEP | EN_DC3_SLEEP \
  509. | EN_VC_SLEEP | EN_DC2_SLEEP;
  510. ret = menelaus_set_regulator_sleep(1, val);
  511. if (ret < 0) {
  512. pr_err("Could not set regulators to sleep on menelaus: %u\n",
  513. ret);
  514. return ret;
  515. }
  516. return 0;
  517. }
  518. static int n8x0_auto_voltage_scale(void)
  519. {
  520. int ret;
  521. ret = menelaus_set_vcore_hw(1400, 1050);
  522. if (ret < 0) {
  523. pr_err("Could not set VCORE voltage on menelaus: %u\n", ret);
  524. return ret;
  525. }
  526. return 0;
  527. }
  528. static int n8x0_menelaus_late_init(struct device *dev)
  529. {
  530. int ret;
  531. ret = n8x0_auto_voltage_scale();
  532. if (ret < 0)
  533. return ret;
  534. ret = n8x0_auto_sleep_regulators();
  535. if (ret < 0)
  536. return ret;
  537. return 0;
  538. }
  539. #else
  540. static int n8x0_menelaus_late_init(struct device *dev)
  541. {
  542. return 0;
  543. }
  544. #endif
  545. static struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
  546. .late_init = n8x0_menelaus_late_init,
  547. };
  548. static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] __initdata = {
  549. {
  550. I2C_BOARD_INFO("menelaus", 0x72),
  551. .irq = 7 + OMAP_INTC_START,
  552. .platform_data = &n8x0_menelaus_platform_data,
  553. },
  554. };
  555. static struct aic3x_pdata n810_aic33_data __initdata = {
  556. .gpio_reset = 118,
  557. };
  558. static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
  559. {
  560. I2C_BOARD_INFO("tlv320aic3x", 0x18),
  561. .platform_data = &n810_aic33_data,
  562. },
  563. };
  564. #ifdef CONFIG_OMAP_MUX
  565. static struct omap_board_mux board_mux[] __initdata = {
  566. /* I2S codec port pins for McBSP block */
  567. OMAP2420_MUX(EAC_AC_SCLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  568. OMAP2420_MUX(EAC_AC_FS, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  569. OMAP2420_MUX(EAC_AC_DIN, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
  570. OMAP2420_MUX(EAC_AC_DOUT, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
  571. { .reg_offset = OMAP_MUX_TERMINATOR },
  572. };
  573. static struct omap_device_pad serial2_pads[] __initdata = {
  574. {
  575. .name = "uart3_rx_irrx.uart3_rx_irrx",
  576. .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
  577. .enable = OMAP_MUX_MODE0,
  578. .idle = OMAP_MUX_MODE3 /* Mux as GPIO for idle */
  579. },
  580. };
  581. static inline void board_serial_init(void)
  582. {
  583. struct omap_board_data bdata;
  584. bdata.flags = 0;
  585. bdata.pads = NULL;
  586. bdata.pads_cnt = 0;
  587. bdata.id = 0;
  588. omap_serial_init_port(&bdata, NULL);
  589. bdata.id = 1;
  590. omap_serial_init_port(&bdata, NULL);
  591. bdata.id = 2;
  592. bdata.pads = serial2_pads;
  593. bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
  594. omap_serial_init_port(&bdata, NULL);
  595. }
  596. #else
  597. static inline void board_serial_init(void)
  598. {
  599. omap_serial_init();
  600. }
  601. #endif
  602. static void __init n8x0_init_machine(void)
  603. {
  604. omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
  605. /* FIXME: add n810 spi devices */
  606. spi_register_board_info(n800_spi_board_info,
  607. ARRAY_SIZE(n800_spi_board_info));
  608. omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
  609. ARRAY_SIZE(n8x0_i2c_board_info_1));
  610. omap_register_i2c_bus(2, 400, NULL, 0);
  611. if (machine_is_nokia_n810())
  612. i2c_register_board_info(2, n810_i2c_board_info_2,
  613. ARRAY_SIZE(n810_i2c_board_info_2));
  614. board_serial_init();
  615. omap_sdrc_init(NULL, NULL);
  616. gpmc_onenand_init(board_onenand_data);
  617. n8x0_mmc_init();
  618. n8x0_usb_init();
  619. n8x0_cbus_init();
  620. }
  621. MACHINE_START(NOKIA_N800, "Nokia N800")
  622. .atag_offset = 0x100,
  623. .reserve = omap_reserve,
  624. .map_io = omap242x_map_io,
  625. .init_early = omap2420_init_early,
  626. .init_irq = omap2_init_irq,
  627. .handle_irq = omap2_intc_handle_irq,
  628. .init_machine = n8x0_init_machine,
  629. .init_late = omap2420_init_late,
  630. .timer = &omap2_timer,
  631. .restart = omap_prcm_restart,
  632. MACHINE_END
  633. MACHINE_START(NOKIA_N810, "Nokia N810")
  634. .atag_offset = 0x100,
  635. .reserve = omap_reserve,
  636. .map_io = omap242x_map_io,
  637. .init_early = omap2420_init_early,
  638. .init_irq = omap2_init_irq,
  639. .handle_irq = omap2_intc_handle_irq,
  640. .init_machine = n8x0_init_machine,
  641. .init_late = omap2420_init_late,
  642. .timer = &omap2_timer,
  643. .restart = omap_prcm_restart,
  644. MACHINE_END
  645. MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
  646. .atag_offset = 0x100,
  647. .reserve = omap_reserve,
  648. .map_io = omap242x_map_io,
  649. .init_early = omap2420_init_early,
  650. .init_irq = omap2_init_irq,
  651. .handle_irq = omap2_intc_handle_irq,
  652. .init_machine = n8x0_init_machine,
  653. .init_late = omap2420_init_late,
  654. .timer = &omap2_timer,
  655. .restart = omap_prcm_restart,
  656. MACHINE_END