board-n8x0.c 17 KB

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