ac14xx.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. /*
  2. * (C) Copyright 2009 Wolfgang Denk <wd@denx.de>
  3. * (C) Copyright 2009 Dave Srl www.dave.eu
  4. * (C) Copyright 2010 ifm ecomatic GmbH
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/bitops.h>
  10. #include <command.h>
  11. #include <asm/io.h>
  12. #include <asm/processor.h>
  13. #include <asm/mpc512x.h>
  14. #include <fdt_support.h>
  15. #ifdef CONFIG_MISC_INIT_R
  16. #include <i2c.h>
  17. #endif
  18. static int eeprom_diag;
  19. static int mac_diag;
  20. static int gpio_diag;
  21. DECLARE_GLOBAL_DATA_PTR;
  22. static void gpio_configure(void)
  23. {
  24. immap_t *im;
  25. gpio512x_t *gpioregs;
  26. im = (immap_t *) CONFIG_SYS_IMMR;
  27. gpioregs = &im->gpio;
  28. out_be32(&gpioregs->gpodr, 0x00290000); /* open drain */
  29. out_be32(&gpioregs->gpdat, 0x80001040); /* data (when output) */
  30. /*
  31. * out_be32(&gpioregs->gpdir, 0xC2293020);
  32. * workaround for a hardware effect: configure direction in pieces,
  33. * setting all outputs at once drops the reset line too low and
  34. * makes us lose the MII connection (breaks ethernet for us)
  35. */
  36. out_be32(&gpioregs->gpdir, 0x02003060); /* direction */
  37. setbits_be32(&gpioregs->gpdir, 0x00200000); /* += reset asi */
  38. udelay(10);
  39. setbits_be32(&gpioregs->gpdir, 0x00080000); /* += reset safety */
  40. udelay(10);
  41. setbits_be32(&gpioregs->gpdir, 0x00010000); /* += reset comm */
  42. udelay(10);
  43. setbits_be32(&gpioregs->gpdir, 0xC0000000); /* += backlight, KB sel */
  44. /* to turn from red to yellow when U-Boot runs */
  45. setbits_be32(&gpioregs->gpdat, 0x00002020);
  46. out_be32(&gpioregs->gpimr, 0x00000000); /* interrupt mask */
  47. out_be32(&gpioregs->gpicr1, 0x00000004); /* interrupt sense part 1 */
  48. out_be32(&gpioregs->gpicr2, 0x00A80000); /* interrupt sense part 2 */
  49. out_be32(&gpioregs->gpier, 0xFFFFFFFF); /* interrupt events, clear */
  50. }
  51. /* the physical location of the pins */
  52. #define GPIOKEY_ROW_BITMASK 0x40000000
  53. #define GPIOKEY_ROW_UPPER 0
  54. #define GPIOKEY_ROW_LOWER 1
  55. #define GPIOKEY_COL0_BITMASK 0x20000000
  56. #define GPIOKEY_COL1_BITMASK 0x10000000
  57. #define GPIOKEY_COL2_BITMASK 0x08000000
  58. /* the logical presentation of pressed keys */
  59. #define GPIOKEY_BIT_FNLEFT (1 << 5)
  60. #define GPIOKEY_BIT_FNRIGHT (1 << 4)
  61. #define GPIOKEY_BIT_DIRUP (1 << 3)
  62. #define GPIOKEY_BIT_DIRLEFT (1 << 2)
  63. #define GPIOKEY_BIT_DIRRIGHT (1 << 1)
  64. #define GPIOKEY_BIT_DIRDOWN (1 << 0)
  65. /* the hotkey combination which starts recovery */
  66. #define GPIOKEY_BITS_RECOVERY (GPIOKEY_BIT_FNLEFT | GPIOKEY_BIT_DIRUP | \
  67. GPIOKEY_BIT_DIRDOWN)
  68. static void gpio_selectrow(gpio512x_t *gpioregs, u32 row)
  69. {
  70. if (row)
  71. setbits_be32(&gpioregs->gpdat, GPIOKEY_ROW_BITMASK);
  72. else
  73. clrbits_be32(&gpioregs->gpdat, GPIOKEY_ROW_BITMASK);
  74. udelay(10);
  75. }
  76. static u32 gpio_querykbd(void)
  77. {
  78. immap_t *im;
  79. gpio512x_t *gpioregs;
  80. u32 keybits;
  81. u32 input;
  82. im = (immap_t *)CONFIG_SYS_IMMR;
  83. gpioregs = &im->gpio;
  84. keybits = 0;
  85. /* query upper row */
  86. gpio_selectrow(gpioregs, GPIOKEY_ROW_UPPER);
  87. input = in_be32(&gpioregs->gpdat);
  88. if ((input & GPIOKEY_COL0_BITMASK) == 0)
  89. keybits |= GPIOKEY_BIT_FNLEFT;
  90. if ((input & GPIOKEY_COL1_BITMASK) == 0)
  91. keybits |= GPIOKEY_BIT_DIRUP;
  92. if ((input & GPIOKEY_COL2_BITMASK) == 0)
  93. keybits |= GPIOKEY_BIT_FNRIGHT;
  94. /* query lower row */
  95. gpio_selectrow(gpioregs, GPIOKEY_ROW_LOWER);
  96. input = in_be32(&gpioregs->gpdat);
  97. if ((input & GPIOKEY_COL0_BITMASK) == 0)
  98. keybits |= GPIOKEY_BIT_DIRLEFT;
  99. if ((input & GPIOKEY_COL1_BITMASK) == 0)
  100. keybits |= GPIOKEY_BIT_DIRRIGHT;
  101. if ((input & GPIOKEY_COL2_BITMASK) == 0)
  102. keybits |= GPIOKEY_BIT_DIRDOWN;
  103. /* return bit pattern for keys */
  104. return keybits;
  105. }
  106. /* excerpt from the recovery's hw_info.h */
  107. struct __attribute__ ((__packed__)) eeprom_layout {
  108. char magic[3]; /** 'ifm' */
  109. u8 len[2]; /** content length without magic/len fields */
  110. u8 version[3]; /** structure version */
  111. u8 type; /** type of PCB */
  112. u8 reserved[0x37]; /** padding up to offset 0x40 */
  113. u8 macaddress[6]; /** ethernet MAC (for the mainboard) @0x40 */
  114. };
  115. #define HW_COMP_MAINCPU 2
  116. static struct eeprom_layout eeprom_content;
  117. static int eeprom_was_read; /* has_been_read */
  118. static int eeprom_is_valid;
  119. static int eeprom_version;
  120. #define get_eeprom_field_int(name) ({ \
  121. int value; \
  122. int idx; \
  123. value = 0; \
  124. for (idx = 0; idx < sizeof(name); idx++) { \
  125. value <<= 8; \
  126. value |= name[idx]; \
  127. } \
  128. value; \
  129. })
  130. static int read_eeprom(void)
  131. {
  132. int eeprom_datalen;
  133. int ret;
  134. if (eeprom_was_read)
  135. return 0;
  136. eeprom_is_valid = 0;
  137. ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,
  138. CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
  139. (uchar *)&eeprom_content, sizeof(eeprom_content));
  140. if (eeprom_diag) {
  141. printf("DIAG: %s() read rc[%d], size[%d]\n",
  142. __func__, ret, sizeof(eeprom_content));
  143. }
  144. if (ret != 0)
  145. return -1;
  146. eeprom_was_read = 1;
  147. /*
  148. * check validity of EEPROM content
  149. * (check version, length, optionally checksum)
  150. */
  151. eeprom_is_valid = 1;
  152. eeprom_datalen = get_eeprom_field_int(eeprom_content.len);
  153. eeprom_version = get_eeprom_field_int(eeprom_content.version);
  154. if (eeprom_diag) {
  155. printf("DIAG: %s() magic[%c%c%c] len[%d] ver[%d] type[%d]\n",
  156. __func__, eeprom_content.magic[0],
  157. eeprom_content.magic[1], eeprom_content.magic[2],
  158. eeprom_datalen, eeprom_version, eeprom_content.type);
  159. }
  160. if (strncmp(eeprom_content.magic, "ifm", strlen("ifm")) != 0)
  161. eeprom_is_valid = 0;
  162. if (eeprom_datalen < sizeof(struct eeprom_layout) - 5)
  163. eeprom_is_valid = 0;
  164. if ((eeprom_version != 1) && (eeprom_version != 2))
  165. eeprom_is_valid = 0;
  166. if (eeprom_content.type != HW_COMP_MAINCPU)
  167. eeprom_is_valid = 0;
  168. if (eeprom_diag)
  169. printf("DIAG: %s() valid[%d]\n", __func__, eeprom_is_valid);
  170. return ret;
  171. }
  172. int mac_read_from_eeprom(void)
  173. {
  174. const u8 *mac;
  175. const char *mac_txt;
  176. if (read_eeprom()) {
  177. printf("I2C EEPROM read failed.\n");
  178. return -1;
  179. }
  180. if (!eeprom_is_valid) {
  181. printf("I2C EEPROM content not valid\n");
  182. return -1;
  183. }
  184. mac = NULL;
  185. switch (eeprom_version) {
  186. case 1:
  187. case 2:
  188. mac = (const u8 *)&eeprom_content.macaddress;
  189. break;
  190. }
  191. if (mac && is_valid_ethaddr(mac)) {
  192. eth_setenv_enetaddr("ethaddr", mac);
  193. if (mac_diag) {
  194. mac_txt = getenv("ethaddr");
  195. if (mac_txt)
  196. printf("DIAG: MAC value [%s]\n", mac_txt);
  197. else
  198. printf("DIAG: failed to setup MAC env\n");
  199. }
  200. }
  201. return 0;
  202. }
  203. /*
  204. * BEWARE!
  205. * this board uses DDR1(!) Micron SDRAM, *NOT* the DDR2
  206. * which the ADS, Aria or PDM360NG boards are using
  207. * (the steps outlined here refer to the Micron datasheet)
  208. */
  209. u32 sdram_init_seq[] = {
  210. /* item 6, at least one NOP after CKE went high */
  211. CONFIG_SYS_DDRCMD_NOP,
  212. CONFIG_SYS_DDRCMD_NOP,
  213. CONFIG_SYS_DDRCMD_NOP,
  214. CONFIG_SYS_DDRCMD_NOP,
  215. CONFIG_SYS_DDRCMD_NOP,
  216. CONFIG_SYS_DDRCMD_NOP,
  217. CONFIG_SYS_DDRCMD_NOP,
  218. CONFIG_SYS_DDRCMD_NOP,
  219. CONFIG_SYS_DDRCMD_NOP,
  220. CONFIG_SYS_DDRCMD_NOP,
  221. /* item 7, precharge all; item 8, tRP (20ns) */
  222. CONFIG_SYS_DDRCMD_PCHG_ALL,
  223. CONFIG_SYS_DDRCMD_NOP,
  224. /* item 9, extended mode register; item 10, tMRD 10ns) */
  225. CONFIG_SYS_MICRON_EMODE | CONFIG_SYS_MICRON_EMODE_PARAM,
  226. CONFIG_SYS_DDRCMD_NOP,
  227. /*
  228. * item 11, (base) mode register _with_ reset DLL;
  229. * item 12, tMRD (10ns)
  230. */
  231. CONFIG_SYS_MICRON_BMODE | CONFIG_SYS_MICRON_BMODE_RSTDLL |
  232. CONFIG_SYS_MICRON_BMODE_PARAM,
  233. CONFIG_SYS_DDRCMD_NOP,
  234. /* item 13, precharge all; item 14, tRP (20ns) */
  235. CONFIG_SYS_DDRCMD_PCHG_ALL,
  236. CONFIG_SYS_DDRCMD_NOP,
  237. /*
  238. * item 15, auto refresh (i.e. refresh with CKE held high);
  239. * item 16, tRFC (70ns)
  240. */
  241. CONFIG_SYS_DDRCMD_RFSH,
  242. CONFIG_SYS_DDRCMD_NOP,
  243. CONFIG_SYS_DDRCMD_NOP,
  244. CONFIG_SYS_DDRCMD_NOP,
  245. CONFIG_SYS_DDRCMD_NOP,
  246. CONFIG_SYS_DDRCMD_NOP,
  247. CONFIG_SYS_DDRCMD_NOP,
  248. CONFIG_SYS_DDRCMD_NOP,
  249. CONFIG_SYS_DDRCMD_NOP,
  250. /*
  251. * item 17, auto refresh (i.e. refresh with CKE held high);
  252. * item 18, tRFC (70ns)
  253. */
  254. CONFIG_SYS_DDRCMD_RFSH,
  255. CONFIG_SYS_DDRCMD_NOP,
  256. CONFIG_SYS_DDRCMD_NOP,
  257. CONFIG_SYS_DDRCMD_NOP,
  258. CONFIG_SYS_DDRCMD_NOP,
  259. CONFIG_SYS_DDRCMD_NOP,
  260. CONFIG_SYS_DDRCMD_NOP,
  261. CONFIG_SYS_DDRCMD_NOP,
  262. CONFIG_SYS_DDRCMD_NOP,
  263. /* item 19, optional, unassert DLL reset; item 20, tMRD (20ns) */
  264. CONFIG_SYS_MICRON_BMODE | CONFIG_SYS_MICRON_BMODE_PARAM,
  265. CONFIG_SYS_DDRCMD_NOP,
  266. /*
  267. * item 21, "actually done", but make sure 200 DRAM clock cycles
  268. * have passed after DLL reset before READ requests are issued
  269. * (200 cycles at 160MHz -> 1.25 usec)
  270. */
  271. /* EMPTY, optional, we don't do it */
  272. };
  273. phys_size_t initdram(int board_type)
  274. {
  275. return fixed_sdram(NULL, sdram_init_seq, ARRAY_SIZE(sdram_init_seq));
  276. }
  277. int misc_init_r(void)
  278. {
  279. u32 keys;
  280. char *s;
  281. int want_recovery;
  282. /* we use bus I2C-0 for the on-board eeprom */
  283. i2c_set_bus_num(0);
  284. /* setup GPIO directions and initial values */
  285. gpio_configure();
  286. /*
  287. * enforce the start of the recovery system when
  288. * - the appropriate keys were pressed
  289. * - "some" external software told us to
  290. * - a previous installation was aborted or has failed
  291. */
  292. want_recovery = 0;
  293. keys = gpio_querykbd();
  294. if (gpio_diag)
  295. printf("GPIO keyboard status [0x%02X]\n", keys);
  296. if ((keys & GPIOKEY_BITS_RECOVERY) == GPIOKEY_BITS_RECOVERY) {
  297. printf("detected recovery request (keyboard)\n");
  298. want_recovery = 1;
  299. }
  300. s = getenv("want_recovery");
  301. if ((s != NULL) && (*s != '\0')) {
  302. printf("detected recovery request (environment)\n");
  303. want_recovery = 1;
  304. }
  305. s = getenv("install_in_progress");
  306. if ((s != NULL) && (*s != '\0')) {
  307. printf("previous installation has not completed\n");
  308. want_recovery = 1;
  309. }
  310. s = getenv("install_failed");
  311. if ((s != NULL) && (*s != '\0')) {
  312. printf("previous installation has failed\n");
  313. want_recovery = 1;
  314. }
  315. if (want_recovery) {
  316. printf("enforced start of the recovery system\n");
  317. setenv("bootcmd", "run recovery");
  318. }
  319. /*
  320. * boot the recovery system without waiting; boot the
  321. * production system without waiting by default, only
  322. * insert a pause (to provide a chance to get a prompt)
  323. * when GPIO keys were pressed during power on
  324. */
  325. if (want_recovery)
  326. setenv("bootdelay", "0");
  327. else if (!keys)
  328. setenv("bootdelay", "0");
  329. else
  330. setenv("bootdelay", "2");
  331. /* get the ethernet MAC from I2C EEPROM */
  332. mac_read_from_eeprom();
  333. return 0;
  334. }
  335. /* setup specific IO pad configuration */
  336. static iopin_t ioregs_init[] = {
  337. { /* LPC CS3 */
  338. offsetof(struct ioctrl512x, io_control_nfc_ce0), 1,
  339. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  340. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  341. },
  342. { /* LPC CS1 */
  343. offsetof(struct ioctrl512x, io_control_lpc_cs1), 1,
  344. IO_PIN_OVER_DRVSTR,
  345. IO_PIN_DS(2),
  346. },
  347. { /* LPC CS2 */
  348. offsetof(struct ioctrl512x, io_control_lpc_cs2), 1,
  349. IO_PIN_OVER_DRVSTR,
  350. IO_PIN_DS(2),
  351. },
  352. { /* LPC CS4, CS5 */
  353. offsetof(struct ioctrl512x, io_control_pata_ce1), 2,
  354. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  355. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  356. },
  357. { /* SDHC CLK, CMD, D0, D1, D2, D3 */
  358. offsetof(struct ioctrl512x, io_control_pata_ior), 6,
  359. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  360. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  361. },
  362. { /* GPIO keyboard */
  363. offsetof(struct ioctrl512x, io_control_pci_ad30), 4,
  364. IO_PIN_OVER_FMUX,
  365. IO_PIN_FMUX(3),
  366. },
  367. { /* GPIO DN1 PF, LCD power, DN2 PF */
  368. offsetof(struct ioctrl512x, io_control_pci_ad26), 3,
  369. IO_PIN_OVER_FMUX,
  370. IO_PIN_FMUX(3),
  371. },
  372. { /* GPIO reset AS-i */
  373. offsetof(struct ioctrl512x, io_control_pci_ad21), 1,
  374. IO_PIN_OVER_FMUX,
  375. IO_PIN_FMUX(3),
  376. },
  377. { /* GPIO reset safety */
  378. offsetof(struct ioctrl512x, io_control_pci_ad19), 1,
  379. IO_PIN_OVER_FMUX,
  380. IO_PIN_FMUX(3),
  381. },
  382. { /* GPIO reset netX */
  383. offsetof(struct ioctrl512x, io_control_pci_ad16), 1,
  384. IO_PIN_OVER_FMUX,
  385. IO_PIN_FMUX(3),
  386. },
  387. { /* GPIO ma2 en */
  388. offsetof(struct ioctrl512x, io_control_pci_ad15), 1,
  389. IO_PIN_OVER_FMUX,
  390. IO_PIN_FMUX(3),
  391. },
  392. { /* GPIO SD CD, SD WP */
  393. offsetof(struct ioctrl512x, io_control_pci_ad08), 2,
  394. IO_PIN_OVER_FMUX,
  395. IO_PIN_FMUX(3),
  396. },
  397. { /* FEC RX DV */
  398. offsetof(struct ioctrl512x, io_control_pci_ad06), 1,
  399. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  400. IO_PIN_FMUX(2) | IO_PIN_DS(2),
  401. },
  402. { /* GPIO AS-i prog, AS-i done, LCD backlight */
  403. offsetof(struct ioctrl512x, io_control_pci_ad05), 3,
  404. IO_PIN_OVER_FMUX,
  405. IO_PIN_FMUX(3),
  406. },
  407. { /* GPIO AS-i wdg */
  408. offsetof(struct ioctrl512x, io_control_pci_req2), 1,
  409. IO_PIN_OVER_FMUX,
  410. IO_PIN_FMUX(3),
  411. },
  412. { /* GPIO safety wdg */
  413. offsetof(struct ioctrl512x, io_control_pci_req1), 1,
  414. IO_PIN_OVER_FMUX,
  415. IO_PIN_FMUX(3),
  416. },
  417. { /* GPIO netX wdg */
  418. offsetof(struct ioctrl512x, io_control_pci_req0), 1,
  419. IO_PIN_OVER_FMUX,
  420. IO_PIN_FMUX(3),
  421. },
  422. { /* GPIO IRQ powerfail */
  423. offsetof(struct ioctrl512x, io_control_pci_inta), 1,
  424. IO_PIN_OVER_FMUX,
  425. IO_PIN_FMUX(3),
  426. },
  427. { /* GPIO AS-i PWRD */
  428. offsetof(struct ioctrl512x, io_control_pci_frame), 1,
  429. IO_PIN_OVER_FMUX,
  430. IO_PIN_FMUX(3),
  431. },
  432. { /* GPIO LED0, LED1 */
  433. offsetof(struct ioctrl512x, io_control_pci_idsel), 2,
  434. IO_PIN_OVER_FMUX,
  435. IO_PIN_FMUX(3),
  436. },
  437. { /* GPIO IRQ AS-i 1, IRQ AS-i 2, IRQ safety */
  438. offsetof(struct ioctrl512x, io_control_pci_irdy), 3,
  439. IO_PIN_OVER_FMUX,
  440. IO_PIN_FMUX(3),
  441. },
  442. { /* DIU clk */
  443. offsetof(struct ioctrl512x, io_control_spdif_txclk), 1,
  444. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  445. IO_PIN_FMUX(2) | IO_PIN_DS(2),
  446. },
  447. { /* FEC TX ER, CRS */
  448. offsetof(struct ioctrl512x, io_control_spdif_tx), 2,
  449. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  450. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  451. },
  452. { /* GPIO/GPT */ /* to *NOT* have the EXT IRQ0 float */
  453. offsetof(struct ioctrl512x, io_control_irq0), 1,
  454. IO_PIN_OVER_FMUX,
  455. IO_PIN_FMUX(3),
  456. },
  457. { /*
  458. * FEC col, tx en, tx clk, txd 0-3, mdc, rx er,
  459. * rdx 3-0, mdio, rx clk
  460. */
  461. offsetof(struct ioctrl512x, io_control_psc0_0), 15,
  462. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  463. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  464. },
  465. /* optional: make sure PSC3 remains the serial console */
  466. { /* LPC CS6 */
  467. offsetof(struct ioctrl512x, io_control_psc3_4), 1,
  468. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  469. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  470. },
  471. /* make sure PSC4 remains available for SPI,
  472. *BUT* PSC4_1 is a GPIO kind of SS! */
  473. { /* enforce drive strength on the SPI pin */
  474. offsetof(struct ioctrl512x, io_control_psc4_0), 5,
  475. IO_PIN_OVER_DRVSTR,
  476. IO_PIN_DS(2),
  477. },
  478. {
  479. offsetof(struct ioctrl512x, io_control_psc4_1), 1,
  480. IO_PIN_OVER_FMUX,
  481. IO_PIN_FMUX(3),
  482. },
  483. /* optional: make sure PSC5 remains available for SPI */
  484. { /* enforce drive strength on the SPI pin */
  485. offsetof(struct ioctrl512x, io_control_psc5_0), 5,
  486. IO_PIN_OVER_DRVSTR,
  487. IO_PIN_DS(1),
  488. },
  489. { /* LPC TSIZ1 */
  490. offsetof(struct ioctrl512x, io_control_psc6_0), 1,
  491. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  492. IO_PIN_FMUX(1) | IO_PIN_DS(2),
  493. },
  494. { /* DIU hsync */
  495. offsetof(struct ioctrl512x, io_control_psc6_1), 1,
  496. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  497. IO_PIN_FMUX(2) | IO_PIN_DS(1),
  498. },
  499. { /* DIU vsync */
  500. offsetof(struct ioctrl512x, io_control_psc6_4), 1,
  501. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  502. IO_PIN_FMUX(2) | IO_PIN_DS(1),
  503. },
  504. { /* PSC7, part of DIU RGB */
  505. offsetof(struct ioctrl512x, io_control_psc7_0), 2,
  506. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  507. IO_PIN_FMUX(2) | IO_PIN_DS(1),
  508. },
  509. { /* PSC7, safety UART */
  510. offsetof(struct ioctrl512x, io_control_psc7_2), 2,
  511. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  512. IO_PIN_FMUX(0) | IO_PIN_DS(1),
  513. },
  514. { /* DIU (part of) RGB[] */
  515. offsetof(struct ioctrl512x, io_control_psc8_3), 16,
  516. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  517. IO_PIN_FMUX(2) | IO_PIN_DS(1),
  518. },
  519. { /* DIU data enable */
  520. offsetof(struct ioctrl512x, io_control_psc11_4), 1,
  521. IO_PIN_OVER_FMUX | IO_PIN_OVER_DRVSTR,
  522. IO_PIN_FMUX(2) | IO_PIN_DS(1),
  523. },
  524. /* reduce LPB drive strength for improved EMI */
  525. { /* LPC OE, LPC RW */
  526. offsetof(struct ioctrl512x, io_control_lpc_oe), 2,
  527. IO_PIN_OVER_DRVSTR,
  528. IO_PIN_DS(2),
  529. },
  530. { /* LPC AX03 through LPC AD00 */
  531. offsetof(struct ioctrl512x, io_control_lpc_ax03), 36,
  532. IO_PIN_OVER_DRVSTR,
  533. IO_PIN_DS(2),
  534. },
  535. { /* LPC CS5 */
  536. offsetof(struct ioctrl512x, io_control_pata_ce2), 1,
  537. IO_PIN_OVER_DRVSTR,
  538. IO_PIN_DS(2),
  539. },
  540. { /* SDHC CLK */
  541. offsetof(struct ioctrl512x, io_control_nfc_wp), 1,
  542. IO_PIN_OVER_DRVSTR,
  543. IO_PIN_DS(2),
  544. },
  545. { /* SDHC DATA */
  546. offsetof(struct ioctrl512x, io_control_nfc_ale), 4,
  547. IO_PIN_OVER_DRVSTR,
  548. IO_PIN_DS(2),
  549. },
  550. };
  551. int checkboard(void)
  552. {
  553. puts("Board: ifm AC14xx\n");
  554. /* initialize function mux & slew rate IO inter alia on IO Pins */
  555. iopin_initialize_bits(ioregs_init, ARRAY_SIZE(ioregs_init));
  556. return 0;
  557. }
  558. #ifdef CONFIG_OF_BOARD_SETUP
  559. int ft_board_setup(void *blob, bd_t *bd)
  560. {
  561. ft_cpu_setup(blob, bd);
  562. return 0;
  563. }
  564. #endif /* CONFIG_OF_BOARD_SETUP */