lwmon5.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /*
  2. * (C) Copyright 2007-2013
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #include <common.h>
  21. #include <command.h>
  22. #include <asm/ppc440.h>
  23. #include <asm/processor.h>
  24. #include <asm/ppc4xx-gpio.h>
  25. #include <asm/io.h>
  26. #include <post.h>
  27. #include <flash.h>
  28. #include <mtd/cfi_flash.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. static phys_addr_t lwmon5_cfi_flash_bank_addr[2] = CONFIG_SYS_FLASH_BANKS_LIST;
  31. ulong flash_get_size(ulong base, int banknum);
  32. int misc_init_r_kbd(void);
  33. int board_early_init_f(void)
  34. {
  35. u32 sdr0_pfc1, sdr0_pfc2;
  36. u32 reg;
  37. /* PLB Write pipelining disabled. Denali Core workaround */
  38. mtdcr(PLB4A0_ACR, 0xDE000000);
  39. mtdcr(PLB4A1_ACR, 0xDE000000);
  40. /*--------------------------------------------------------------------
  41. * Setup the interrupt controller polarities, triggers, etc.
  42. *-------------------------------------------------------------------*/
  43. mtdcr(UIC0SR, 0xffffffff); /* clear all. if write with 1 then the status is cleared */
  44. mtdcr(UIC0ER, 0x00000000); /* disable all */
  45. mtdcr(UIC0CR, 0x00000000); /* we have not critical interrupts at the moment */
  46. mtdcr(UIC0PR, 0xFFBFF1EF); /* Adjustment of the polarity */
  47. mtdcr(UIC0TR, 0x00000900); /* per ref-board manual */
  48. mtdcr(UIC0VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  49. mtdcr(UIC0SR, 0xffffffff); /* clear all */
  50. mtdcr(UIC1SR, 0xffffffff); /* clear all */
  51. mtdcr(UIC1ER, 0x00000000); /* disable all */
  52. mtdcr(UIC1CR, 0x00000000); /* all non-critical */
  53. mtdcr(UIC1PR, 0xFFFFC6A5); /* Adjustment of the polarity */
  54. mtdcr(UIC1TR, 0x60000040); /* per ref-board manual */
  55. mtdcr(UIC1VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  56. mtdcr(UIC1SR, 0xffffffff); /* clear all */
  57. mtdcr(UIC2SR, 0xffffffff); /* clear all */
  58. mtdcr(UIC2ER, 0x00000000); /* disable all */
  59. mtdcr(UIC2CR, 0x00000000); /* all non-critical */
  60. mtdcr(UIC2PR, 0x27C00000); /* Adjustment of the polarity */
  61. mtdcr(UIC2TR, 0x3C000000); /* per ref-board manual */
  62. mtdcr(UIC2VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  63. mtdcr(UIC2SR, 0xffffffff); /* clear all */
  64. /* Trace Pins are disabled. SDR0_PFC0 Register */
  65. mtsdr(SDR0_PFC0, 0x0);
  66. /* select Ethernet pins */
  67. mfsdr(SDR0_PFC1, sdr0_pfc1);
  68. /* SMII via ZMII */
  69. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
  70. SDR0_PFC1_SELECT_CONFIG_6;
  71. mfsdr(SDR0_PFC2, sdr0_pfc2);
  72. sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
  73. SDR0_PFC2_SELECT_CONFIG_6;
  74. /* enable SPI (SCP) */
  75. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_SCP_SEL;
  76. mtsdr(SDR0_PFC2, sdr0_pfc2);
  77. mtsdr(SDR0_PFC1, sdr0_pfc1);
  78. mtsdr(SDR0_PFC4, 0x80000000);
  79. /* PCI arbiter disabled */
  80. /* PCI Host Configuration disbaled */
  81. mfsdr(SDR0_PCI0, reg);
  82. reg = 0;
  83. mtsdr(SDR0_PCI0, 0x00000000 | reg);
  84. gpio_write_bit(CONFIG_SYS_GPIO_FLASH_WP, 1);
  85. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
  86. /* enable the LSB transmitter */
  87. gpio_write_bit(CONFIG_SYS_GPIO_LSB_ENABLE, 1);
  88. /* enable the CAN transmitter */
  89. gpio_write_bit(CONFIG_SYS_GPIO_CAN_ENABLE, 1);
  90. reg = 0; /* reuse as counter */
  91. out_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR,
  92. in_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR)
  93. & ~CONFIG_SYS_DSPIC_TEST_MASK);
  94. while (gpio_read_in_bit(CONFIG_SYS_GPIO_DSPIC_READY) && reg++ < 1000) {
  95. udelay(1000);
  96. }
  97. if (gpio_read_in_bit(CONFIG_SYS_GPIO_DSPIC_READY)) {
  98. /* set "boot error" flag */
  99. out_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR,
  100. in_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR) |
  101. CONFIG_SYS_DSPIC_TEST_MASK);
  102. }
  103. #endif
  104. /*
  105. * Reset PHY's:
  106. * The PHY's need a 2nd reset pulse, since the MDIO address is latched
  107. * upon reset, and with the first reset upon powerup, the addresses are
  108. * not latched reliable, since the IRQ line is multiplexed with an
  109. * MDIO address. A 2nd reset at this time will make sure, that the
  110. * correct address is latched.
  111. */
  112. gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 1);
  113. gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 1);
  114. udelay(1000);
  115. gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 0);
  116. gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 0);
  117. udelay(1000);
  118. gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 1);
  119. gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 1);
  120. return 0;
  121. }
  122. /*
  123. * Override weak default with board specific version
  124. */
  125. phys_addr_t cfi_flash_bank_addr(int bank)
  126. {
  127. return lwmon5_cfi_flash_bank_addr[bank];
  128. }
  129. /*
  130. * Override the weak default mapping function with a board specific one
  131. */
  132. u32 flash_get_bank_size(int cs, int idx)
  133. {
  134. return flash_info[idx].size;
  135. }
  136. int board_early_init_r(void)
  137. {
  138. u32 val0, val1;
  139. /*
  140. * lwmon5 is manufactured in 2 different board versions:
  141. * The lwmon5a board has 64MiB NOR flash instead of the
  142. * 128MiB of the original lwmon5. Unfortunately the CFI driver
  143. * will report 2 banks of 64MiB even for the smaller flash
  144. * chip, since the bank is mirrored. To fix this, we bring
  145. * one bank into CFI query mode and read its response. This
  146. * enables us to detect the real number of flash devices/
  147. * banks which will be used later on by the common CFI driver.
  148. */
  149. /* Put bank 0 into CFI command mode and read */
  150. out_be32((void *)CONFIG_SYS_FLASH0, 0x00980098);
  151. val0 = in_be32((void *)CONFIG_SYS_FLASH0 + FLASH_OFFSET_CFI_RESP);
  152. val1 = in_be32((void *)CONFIG_SYS_FLASH1 + FLASH_OFFSET_CFI_RESP);
  153. /* Reset flash again out of query mode */
  154. out_be32((void *)CONFIG_SYS_FLASH0, 0x00f000f0);
  155. /* When not identical, we have 2 different flash devices/banks */
  156. if (val0 != val1)
  157. return 0;
  158. /*
  159. * Now we're sure that we're running on a LWMON5a board with
  160. * only 64MiB NOR flash in one bank:
  161. *
  162. * Set flash base address and bank count for CFI driver probing.
  163. */
  164. cfi_flash_num_flash_banks = 1;
  165. lwmon5_cfi_flash_bank_addr[0] = CONFIG_SYS_FLASH0;
  166. return 0;
  167. }
  168. int misc_init_r(void)
  169. {
  170. u32 pbcr;
  171. int size_val = 0;
  172. u32 reg;
  173. #ifndef CONFIG_LCD4_LWMON5
  174. unsigned long usb2d0cr = 0;
  175. unsigned long usb2phy0cr, usb2h0cr = 0;
  176. unsigned long sdr0_pfc1, sdr0_srst;
  177. #endif
  178. /*
  179. * FLASH stuff...
  180. */
  181. /* Re-do sizing to get full correct info */
  182. /* adjust flash start and offset */
  183. gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
  184. gd->bd->bi_flashoffset = 0;
  185. mfebc(PB0CR, pbcr);
  186. size_val = ffs(gd->bd->bi_flashsize) - 21;
  187. pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
  188. mtebc(PB0CR, pbcr);
  189. /*
  190. * Re-check to get correct base address
  191. */
  192. flash_get_size(gd->bd->bi_flashstart, 0);
  193. /* Monitor protection ON by default */
  194. flash_protect(FLAG_PROTECT_SET, -CONFIG_SYS_MONITOR_LEN, 0xffffffff,
  195. &flash_info[cfi_flash_num_flash_banks - 1]);
  196. /* Env protection ON by default */
  197. flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND,
  198. CONFIG_ENV_ADDR_REDUND + 2 * CONFIG_ENV_SECT_SIZE - 1,
  199. &flash_info[cfi_flash_num_flash_banks - 1]);
  200. #ifndef CONFIG_LCD4_LWMON5
  201. /*
  202. * USB suff...
  203. */
  204. /* Reset USB */
  205. /* Reset of USB2PHY0 must be active at least 10 us */
  206. mtsdr(SDR0_SRST0, SDR0_SRST0_USB2H | SDR0_SRST0_USB2D);
  207. udelay(2000);
  208. mtsdr(SDR0_SRST1, SDR0_SRST1_USB20PHY | SDR0_SRST1_USB2HUTMI |
  209. SDR0_SRST1_USB2HPHY | SDR0_SRST1_OPBA2 |
  210. SDR0_SRST1_PLB42OPB1 | SDR0_SRST1_OPB2PLB40);
  211. udelay(2000);
  212. /* Errata CHIP_6 */
  213. /* 1. Set internal PHY configuration */
  214. /* SDR Setting */
  215. mfsdr(SDR0_PFC1, sdr0_pfc1);
  216. mfsdr(SDR0_USB0, usb2d0cr);
  217. mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
  218. mfsdr(SDR0_USB2H0CR, usb2h0cr);
  219. usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_XOCLK_MASK;
  220. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL; /*0*/
  221. usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_WDINT_MASK;
  222. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ; /*1*/
  223. usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_DVBUS_MASK;
  224. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN; /*1*/
  225. usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_DWNSTR_MASK;
  226. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST; /*1*/
  227. usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_UTMICN_MASK;
  228. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST; /*1*/
  229. /*
  230. * An 8-bit/60MHz interface is the only possible alternative
  231. * when connecting the Device to the PHY
  232. */
  233. usb2h0cr = usb2h0cr & ~SDR0_USB2H0CR_WDINT_MASK;
  234. usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ; /*1*/
  235. mtsdr(SDR0_PFC1, sdr0_pfc1);
  236. mtsdr(SDR0_USB0, usb2d0cr);
  237. mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
  238. mtsdr(SDR0_USB2H0CR, usb2h0cr);
  239. /* 2. De-assert internal PHY reset */
  240. mfsdr(SDR0_SRST1, sdr0_srst);
  241. sdr0_srst = sdr0_srst & ~SDR0_SRST1_USB20PHY;
  242. mtsdr(SDR0_SRST1, sdr0_srst);
  243. /* 3. Wait for more than 1 ms */
  244. udelay(2000);
  245. /* 4. De-assert USB 2.0 Host main reset */
  246. mfsdr(SDR0_SRST0, sdr0_srst);
  247. sdr0_srst = sdr0_srst &~ SDR0_SRST0_USB2H;
  248. mtsdr(SDR0_SRST0, sdr0_srst);
  249. udelay(1000);
  250. /* 5. De-assert reset of OPB2 cores */
  251. mfsdr(SDR0_SRST1, sdr0_srst);
  252. sdr0_srst = sdr0_srst &~ SDR0_SRST1_PLB42OPB1;
  253. sdr0_srst = sdr0_srst &~ SDR0_SRST1_OPB2PLB40;
  254. sdr0_srst = sdr0_srst &~ SDR0_SRST1_OPBA2;
  255. mtsdr(SDR0_SRST1, sdr0_srst);
  256. udelay(1000);
  257. /* 6. Set EHCI Configure FLAG */
  258. /* 7. Reassert internal PHY reset: */
  259. mtsdr(SDR0_SRST1, SDR0_SRST1_USB20PHY);
  260. udelay(1000);
  261. #endif
  262. /*
  263. * Clear resets
  264. */
  265. mtsdr(SDR0_SRST1, 0x00000000);
  266. mtsdr(SDR0_SRST0, 0x00000000);
  267. #ifndef CONFIG_LCD4_LWMON5
  268. printf("USB: Host(int phy) Device(ext phy)\n");
  269. #endif
  270. /*
  271. * Clear PLB4A0_ACR[WRP]
  272. * This fix will make the MAL burst disabling patch for the Linux
  273. * EMAC driver obsolete.
  274. */
  275. reg = mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_WRP_MASK;
  276. mtdcr(PLB4A0_ACR, reg);
  277. #ifndef CONFIG_LCD4_LWMON5
  278. /*
  279. * Init matrix keyboard
  280. */
  281. misc_init_r_kbd();
  282. #endif
  283. return 0;
  284. }
  285. int checkboard(void)
  286. {
  287. char buf[64];
  288. int i = getenv_f("serial#", buf, sizeof(buf));
  289. printf("Board: %s", __stringify(CONFIG_HOSTNAME));
  290. if (i > 0) {
  291. puts(", serial# ");
  292. puts(buf);
  293. }
  294. putc('\n');
  295. return (0);
  296. }
  297. void hw_watchdog_reset(void)
  298. {
  299. int val;
  300. #if defined(CONFIG_WD_MAX_RATE)
  301. unsigned long long ct = get_ticks();
  302. /*
  303. * Don't allow watch-dog triggering more frequently than
  304. * the predefined value CONFIG_WD_MAX_RATE [ticks].
  305. */
  306. if (ct >= gd->arch.wdt_last) {
  307. if ((ct - gd->arch.wdt_last) < CONFIG_WD_MAX_RATE)
  308. return;
  309. } else {
  310. /* Time base counter had been reset */
  311. if (((unsigned long long)(-1) - gd->arch.wdt_last + ct) <
  312. CONFIG_WD_MAX_RATE)
  313. return;
  314. }
  315. gd->arch.wdt_last = get_ticks();
  316. #endif
  317. /*
  318. * Toggle watchdog output
  319. */
  320. val = gpio_read_out_bit(CONFIG_SYS_GPIO_WATCHDOG) == 0 ? 1 : 0;
  321. gpio_write_bit(CONFIG_SYS_GPIO_WATCHDOG, val);
  322. }
  323. int do_eeprom_wp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  324. {
  325. if (argc < 2)
  326. return cmd_usage(cmdtp);
  327. if ((strcmp(argv[1], "on") == 0))
  328. gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 1);
  329. else if ((strcmp(argv[1], "off") == 0))
  330. gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 0);
  331. else
  332. return cmd_usage(cmdtp);
  333. return 0;
  334. }
  335. U_BOOT_CMD(
  336. eepromwp, 2, 0, do_eeprom_wp,
  337. "eeprom write protect off/on",
  338. "<on|off> - enable (on) or disable (off) I2C EEPROM write protect"
  339. );
  340. #if defined(CONFIG_VIDEO)
  341. #include <video_fb.h>
  342. #include <mb862xx.h>
  343. extern GraphicDevice mb862xx;
  344. static const gdc_regs init_regs [] = {
  345. { 0x0100, 0x00000f00 },
  346. { 0x0020, 0x801401df },
  347. { 0x0024, 0x00000000 },
  348. { 0x0028, 0x00000000 },
  349. { 0x002c, 0x00000000 },
  350. { 0x0110, 0x00000000 },
  351. { 0x0114, 0x00000000 },
  352. { 0x0118, 0x01df0280 },
  353. { 0x0004, 0x031f0000 },
  354. { 0x0008, 0x027f027f },
  355. { 0x000c, 0x015f028f },
  356. { 0x0010, 0x020c0000 },
  357. { 0x0014, 0x01df01ea },
  358. { 0x0018, 0x00000000 },
  359. { 0x001c, 0x01e00280 },
  360. { 0x0100, 0x80010f00 },
  361. { 0x0, 0x0 }
  362. };
  363. const gdc_regs *board_get_regs(void)
  364. {
  365. return init_regs;
  366. }
  367. /* Returns Lime base address */
  368. unsigned int board_video_init(void)
  369. {
  370. /*
  371. * Reset Lime controller
  372. */
  373. gpio_write_bit(CONFIG_SYS_GPIO_LIME_S, 1);
  374. udelay(500);
  375. gpio_write_bit(CONFIG_SYS_GPIO_LIME_RST, 1);
  376. mb862xx.winSizeX = 640;
  377. mb862xx.winSizeY = 480;
  378. mb862xx.gdfBytesPP = 2;
  379. mb862xx.gdfIndex = GDF_15BIT_555RGB;
  380. return CONFIG_SYS_LIME_BASE_0;
  381. }
  382. #define DEFAULT_BRIGHTNESS 0x64
  383. static void board_backlight_brightness(int brightness)
  384. {
  385. if (brightness > 0) {
  386. /* pwm duty, lamp on */
  387. out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000024), brightness);
  388. out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000020), 0x701);
  389. } else {
  390. /* lamp off */
  391. out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000024), 0x00);
  392. out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000020), 0x00);
  393. }
  394. }
  395. void board_backlight_switch(int flag)
  396. {
  397. char * param;
  398. int rc;
  399. if (flag) {
  400. param = getenv("brightness");
  401. rc = param ? simple_strtol(param, NULL, 10) : -1;
  402. if (rc < 0)
  403. rc = DEFAULT_BRIGHTNESS;
  404. } else {
  405. rc = 0;
  406. }
  407. board_backlight_brightness(rc);
  408. }
  409. #if defined(CONFIG_CONSOLE_EXTRA_INFO)
  410. /*
  411. * Return text to be printed besides the logo.
  412. */
  413. void video_get_info_str(int line_number, char *info)
  414. {
  415. if (line_number == 1)
  416. strcpy(info, " Board: Lwmon5 (Liebherr Elektronik GmbH)");
  417. else
  418. info [0] = '\0';
  419. }
  420. #endif /* CONFIG_CONSOLE_EXTRA_INFO */
  421. #endif /* CONFIG_VIDEO */
  422. void board_reset(void)
  423. {
  424. gpio_write_bit(CONFIG_SYS_GPIO_BOARD_RESET, 1);
  425. }
  426. #ifdef CONFIG_SPL_OS_BOOT
  427. /*
  428. * lwmon5 specific implementation of spl_start_uboot()
  429. *
  430. * RETURN
  431. * 0 if booting into OS is selected (default)
  432. * 1 if booting into U-Boot is selected
  433. */
  434. int spl_start_uboot(void)
  435. {
  436. char s[8];
  437. env_init();
  438. getenv_f("boot_os", s, sizeof(s));
  439. if ((s != NULL) && (strcmp(s, "yes") == 0))
  440. return 0;
  441. return 1;
  442. }
  443. /*
  444. * This function is called from the SPL U-Boot version for
  445. * early init stuff, that needs to be done for OS (e.g. Linux)
  446. * booting. Doing it later in the real U-Boot would not work
  447. * in case that the SPL U-Boot boots Linux directly.
  448. */
  449. void spl_board_init(void)
  450. {
  451. const gdc_regs *regs = board_get_regs();
  452. /*
  453. * Setup PFC registers, mainly for ethernet support
  454. * later on in Linux
  455. */
  456. board_early_init_f();
  457. /*
  458. * Clear resets
  459. */
  460. mtsdr(SDR0_SRST1, 0x00000000);
  461. mtsdr(SDR0_SRST0, 0x00000000);
  462. /*
  463. * Reset Lime controller
  464. */
  465. gpio_write_bit(CONFIG_SYS_GPIO_LIME_S, 1);
  466. udelay(500);
  467. gpio_write_bit(CONFIG_SYS_GPIO_LIME_RST, 1);
  468. out_be32((void *)CONFIG_SYS_LIME_SDRAM_CLOCK, CONFIG_SYS_MB862xx_CCF);
  469. udelay(300);
  470. out_be32((void *)CONFIG_SYS_LIME_MMR, CONFIG_SYS_MB862xx_MMR);
  471. while (regs->index) {
  472. out_be32((void *)(CONFIG_SYS_LIME_BASE_0 + GC_DISP_BASE) +
  473. regs->index, regs->value);
  474. regs++;
  475. }
  476. board_backlight_brightness(DEFAULT_BRIGHTNESS);
  477. }
  478. #endif