lwmon5.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /*
  2. * (C) Copyright 2007
  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 <ppc440.h>
  23. #include <asm/processor.h>
  24. #include <asm/gpio.h>
  25. #include <asm/io.h>
  26. DECLARE_GLOBAL_DATA_PTR;
  27. extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
  28. ulong flash_get_size(ulong base, int banknum);
  29. int misc_init_r_kbd(void);
  30. int board_early_init_f(void)
  31. {
  32. u32 sdr0_pfc1, sdr0_pfc2;
  33. u32 reg;
  34. /* PLB Write pipelining disabled. Denali Core workaround */
  35. mtdcr(plb0_acr, 0xDE000000);
  36. mtdcr(plb1_acr, 0xDE000000);
  37. /*--------------------------------------------------------------------
  38. * Setup the interrupt controller polarities, triggers, etc.
  39. *-------------------------------------------------------------------*/
  40. mtdcr(uic0sr, 0xffffffff); /* clear all. if write with 1 then the status is cleared */
  41. mtdcr(uic0er, 0x00000000); /* disable all */
  42. mtdcr(uic0cr, 0x00000000); /* we have not critical interrupts at the moment */
  43. mtdcr(uic0pr, 0xFFBFF1EF); /* Adjustment of the polarity */
  44. mtdcr(uic0tr, 0x00000900); /* per ref-board manual */
  45. mtdcr(uic0vr, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  46. mtdcr(uic0sr, 0xffffffff); /* clear all */
  47. mtdcr(uic1sr, 0xffffffff); /* clear all */
  48. mtdcr(uic1er, 0x00000000); /* disable all */
  49. mtdcr(uic1cr, 0x00000000); /* all non-critical */
  50. mtdcr(uic1pr, 0xFFFFC6A5); /* Adjustment of the polarity */
  51. mtdcr(uic1tr, 0x60000040); /* per ref-board manual */
  52. mtdcr(uic1vr, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  53. mtdcr(uic1sr, 0xffffffff); /* clear all */
  54. mtdcr(uic2sr, 0xffffffff); /* clear all */
  55. mtdcr(uic2er, 0x00000000); /* disable all */
  56. mtdcr(uic2cr, 0x00000000); /* all non-critical */
  57. mtdcr(uic2pr, 0x27C00000); /* Adjustment of the polarity */
  58. mtdcr(uic2tr, 0x3C000000); /* per ref-board manual */
  59. mtdcr(uic2vr, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
  60. mtdcr(uic2sr, 0xffffffff); /* clear all */
  61. /* Trace Pins are disabled. SDR0_PFC0 Register */
  62. mtsdr(SDR0_PFC0, 0x0);
  63. /* select Ethernet pins */
  64. mfsdr(SDR0_PFC1, sdr0_pfc1);
  65. /* SMII via ZMII */
  66. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
  67. SDR0_PFC1_SELECT_CONFIG_6;
  68. mfsdr(SDR0_PFC2, sdr0_pfc2);
  69. sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
  70. SDR0_PFC2_SELECT_CONFIG_6;
  71. /* enable SPI (SCP) */
  72. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_SCP_SEL;
  73. mtsdr(SDR0_PFC2, sdr0_pfc2);
  74. mtsdr(SDR0_PFC1, sdr0_pfc1);
  75. mtsdr(SDR0_PFC4, 0x80000000);
  76. /* PCI arbiter disabled */
  77. /* PCI Host Configuration disbaled */
  78. mfsdr(sdr_pci0, reg);
  79. reg = 0;
  80. mtsdr(sdr_pci0, 0x00000000 | reg);
  81. gpio_write_bit(CFG_GPIO_FLASH_WP, 1);
  82. /*
  83. * Reset PHY's:
  84. * The PHY's need a 2nd reset pulse, since the MDIO address is latched
  85. * upon reset, and with the first reset upon powerup, the addresses are
  86. * not latched reliable, since the IRQ line is multiplexed with an
  87. * MDIO address. A 2nd reset at this time will make sure, that the
  88. * correct address is latched.
  89. */
  90. gpio_write_bit(CFG_GPIO_PHY0_RST, 1);
  91. gpio_write_bit(CFG_GPIO_PHY1_RST, 1);
  92. udelay(1000);
  93. gpio_write_bit(CFG_GPIO_PHY0_RST, 0);
  94. gpio_write_bit(CFG_GPIO_PHY1_RST, 0);
  95. udelay(1000);
  96. gpio_write_bit(CFG_GPIO_PHY0_RST, 1);
  97. gpio_write_bit(CFG_GPIO_PHY1_RST, 1);
  98. return 0;
  99. }
  100. /*---------------------------------------------------------------------------+
  101. | misc_init_r.
  102. +---------------------------------------------------------------------------*/
  103. int misc_init_r(void)
  104. {
  105. u32 pbcr;
  106. int size_val = 0;
  107. u32 reg;
  108. unsigned long usb2d0cr = 0;
  109. unsigned long usb2phy0cr, usb2h0cr = 0;
  110. unsigned long sdr0_pfc1;
  111. /*
  112. * FLASH stuff...
  113. */
  114. /* Re-do sizing to get full correct info */
  115. /* adjust flash start and offset */
  116. gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
  117. gd->bd->bi_flashoffset = 0;
  118. mfebc(pb0cr, pbcr);
  119. switch (gd->bd->bi_flashsize) {
  120. case 1 << 20:
  121. size_val = 0;
  122. break;
  123. case 2 << 20:
  124. size_val = 1;
  125. break;
  126. case 4 << 20:
  127. size_val = 2;
  128. break;
  129. case 8 << 20:
  130. size_val = 3;
  131. break;
  132. case 16 << 20:
  133. size_val = 4;
  134. break;
  135. case 32 << 20:
  136. size_val = 5;
  137. break;
  138. case 64 << 20:
  139. size_val = 6;
  140. break;
  141. case 128 << 20:
  142. size_val = 7;
  143. break;
  144. }
  145. pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
  146. mtebc(pb0cr, pbcr);
  147. /*
  148. * Re-check to get correct base address
  149. */
  150. flash_get_size(gd->bd->bi_flashstart, 0);
  151. /* Monitor protection ON by default */
  152. (void)flash_protect(FLAG_PROTECT_SET,
  153. -CFG_MONITOR_LEN,
  154. 0xffffffff,
  155. &flash_info[1]);
  156. /* Env protection ON by default */
  157. (void)flash_protect(FLAG_PROTECT_SET,
  158. CFG_ENV_ADDR_REDUND,
  159. CFG_ENV_ADDR_REDUND + 2*CFG_ENV_SECT_SIZE - 1,
  160. &flash_info[1]);
  161. /*
  162. * USB suff...
  163. */
  164. /* SDR Setting */
  165. mfsdr(SDR0_PFC1, sdr0_pfc1);
  166. mfsdr(SDR0_USB0, usb2d0cr);
  167. mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
  168. mfsdr(SDR0_USB2H0CR, usb2h0cr);
  169. usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
  170. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL; /*0*/
  171. usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
  172. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ; /*1*/
  173. usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
  174. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS; /*0*/
  175. usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
  176. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST; /*1*/
  177. usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
  178. usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST; /*1*/
  179. /* An 8-bit/60MHz interface is the only possible alternative
  180. when connecting the Device to the PHY */
  181. usb2h0cr = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
  182. usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ; /*1*/
  183. mtsdr(SDR0_PFC1, sdr0_pfc1);
  184. mtsdr(SDR0_USB0, usb2d0cr);
  185. mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
  186. mtsdr(SDR0_USB2H0CR, usb2h0cr);
  187. /*
  188. * Clear resets
  189. */
  190. udelay (1000);
  191. mtsdr(SDR0_SRST1, 0x00000000);
  192. udelay (1000);
  193. mtsdr(SDR0_SRST0, 0x00000000);
  194. printf("USB: Host(int phy) Device(ext phy)\n");
  195. /*
  196. * Clear PLB4A0_ACR[WRP]
  197. * This fix will make the MAL burst disabling patch for the Linux
  198. * EMAC driver obsolete.
  199. */
  200. reg = mfdcr(plb4_acr) & ~PLB4_ACR_WRP;
  201. mtdcr(plb4_acr, reg);
  202. /*
  203. * Init matrix keyboard
  204. */
  205. misc_init_r_kbd();
  206. return 0;
  207. }
  208. int checkboard(void)
  209. {
  210. char *s = getenv("serial#");
  211. printf("Board: lwmon5");
  212. if (s != NULL) {
  213. puts(", serial# ");
  214. puts(s);
  215. }
  216. putc('\n');
  217. return (0);
  218. }
  219. #if defined(CFG_DRAM_TEST)
  220. int testdram(void)
  221. {
  222. unsigned long *mem = (unsigned long *)0;
  223. const unsigned long kend = (1024 / sizeof(unsigned long));
  224. unsigned long k, n;
  225. mtmsr(0);
  226. for (k = 0; k < CFG_MBYTES_SDRAM;
  227. ++k, mem += (1024 / sizeof(unsigned long))) {
  228. if ((k & 1023) == 0) {
  229. printf("%3d MB\r", k / 1024);
  230. }
  231. memset(mem, 0xaaaaaaaa, 1024);
  232. for (n = 0; n < kend; ++n) {
  233. if (mem[n] != 0xaaaaaaaa) {
  234. printf("SDRAM test fails at: %08x\n",
  235. (uint) & mem[n]);
  236. return 1;
  237. }
  238. }
  239. memset(mem, 0x55555555, 1024);
  240. for (n = 0; n < kend; ++n) {
  241. if (mem[n] != 0x55555555) {
  242. printf("SDRAM test fails at: %08x\n",
  243. (uint) & mem[n]);
  244. return 1;
  245. }
  246. }
  247. }
  248. printf("SDRAM test passes\n");
  249. return 0;
  250. }
  251. #endif
  252. /*************************************************************************
  253. * pci_pre_init
  254. *
  255. * This routine is called just prior to registering the hose and gives
  256. * the board the opportunity to check things. Returning a value of zero
  257. * indicates that things are bad & PCI initialization should be aborted.
  258. *
  259. * Different boards may wish to customize the pci controller structure
  260. * (add regions, override default access routines, etc) or perform
  261. * certain pre-initialization actions.
  262. *
  263. ************************************************************************/
  264. #if defined(CONFIG_PCI)
  265. int pci_pre_init(struct pci_controller *hose)
  266. {
  267. unsigned long addr;
  268. /*-------------------------------------------------------------------------+
  269. | Set priority for all PLB3 devices to 0.
  270. | Set PLB3 arbiter to fair mode.
  271. +-------------------------------------------------------------------------*/
  272. mfsdr(sdr_amp1, addr);
  273. mtsdr(sdr_amp1, (addr & 0x000000FF) | 0x0000FF00);
  274. addr = mfdcr(plb3_acr);
  275. mtdcr(plb3_acr, addr | 0x80000000);
  276. /*-------------------------------------------------------------------------+
  277. | Set priority for all PLB4 devices to 0.
  278. +-------------------------------------------------------------------------*/
  279. mfsdr(sdr_amp0, addr);
  280. mtsdr(sdr_amp0, (addr & 0x000000FF) | 0x0000FF00);
  281. addr = mfdcr(plb4_acr) | 0xa0000000; /* Was 0x8---- */
  282. mtdcr(plb4_acr, addr);
  283. /*-------------------------------------------------------------------------+
  284. | Set Nebula PLB4 arbiter to fair mode.
  285. +-------------------------------------------------------------------------*/
  286. /* Segment0 */
  287. addr = (mfdcr(plb0_acr) & ~plb0_acr_ppm_mask) | plb0_acr_ppm_fair;
  288. addr = (addr & ~plb0_acr_hbu_mask) | plb0_acr_hbu_enabled;
  289. addr = (addr & ~plb0_acr_rdp_mask) | plb0_acr_rdp_4deep;
  290. addr = (addr & ~plb0_acr_wrp_mask) | plb0_acr_wrp_2deep;
  291. mtdcr(plb0_acr, addr);
  292. /* Segment1 */
  293. addr = (mfdcr(plb1_acr) & ~plb1_acr_ppm_mask) | plb1_acr_ppm_fair;
  294. addr = (addr & ~plb1_acr_hbu_mask) | plb1_acr_hbu_enabled;
  295. addr = (addr & ~plb1_acr_rdp_mask) | plb1_acr_rdp_4deep;
  296. addr = (addr & ~plb1_acr_wrp_mask) | plb1_acr_wrp_2deep;
  297. mtdcr(plb1_acr, addr);
  298. return 1;
  299. }
  300. #endif /* defined(CONFIG_PCI) */
  301. /*************************************************************************
  302. * pci_target_init
  303. *
  304. * The bootstrap configuration provides default settings for the pci
  305. * inbound map (PIM). But the bootstrap config choices are limited and
  306. * may not be sufficient for a given board.
  307. *
  308. ************************************************************************/
  309. #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
  310. void pci_target_init(struct pci_controller *hose)
  311. {
  312. /*--------------------------------------------------------------------------+
  313. * Set up Direct MMIO registers
  314. *--------------------------------------------------------------------------*/
  315. /*--------------------------------------------------------------------------+
  316. | PowerPC440EPX PCI Master configuration.
  317. | Map one 1Gig range of PLB/processor addresses to PCI memory space.
  318. | PLB address 0xA0000000-0xDFFFFFFF ==> PCI address 0xA0000000-0xDFFFFFFF
  319. | Use byte reversed out routines to handle endianess.
  320. | Make this region non-prefetchable.
  321. +--------------------------------------------------------------------------*/
  322. out32r(PCIX0_PMM0MA, 0x00000000); /* PMM0 Mask/Attribute - disabled b4 setting */
  323. out32r(PCIX0_PMM0LA, CFG_PCI_MEMBASE); /* PMM0 Local Address */
  324. out32r(PCIX0_PMM0PCILA, CFG_PCI_MEMBASE); /* PMM0 PCI Low Address */
  325. out32r(PCIX0_PMM0PCIHA, 0x00000000); /* PMM0 PCI High Address */
  326. out32r(PCIX0_PMM0MA, 0xE0000001); /* 512M + No prefetching, and enable region */
  327. out32r(PCIX0_PMM1MA, 0x00000000); /* PMM0 Mask/Attribute - disabled b4 setting */
  328. out32r(PCIX0_PMM1LA, CFG_PCI_MEMBASE2); /* PMM0 Local Address */
  329. out32r(PCIX0_PMM1PCILA, CFG_PCI_MEMBASE2); /* PMM0 PCI Low Address */
  330. out32r(PCIX0_PMM1PCIHA, 0x00000000); /* PMM0 PCI High Address */
  331. out32r(PCIX0_PMM1MA, 0xE0000001); /* 512M + No prefetching, and enable region */
  332. out32r(PCIX0_PTM1MS, 0x00000001); /* Memory Size/Attribute */
  333. out32r(PCIX0_PTM1LA, 0); /* Local Addr. Reg */
  334. out32r(PCIX0_PTM2MS, 0); /* Memory Size/Attribute */
  335. out32r(PCIX0_PTM2LA, 0); /* Local Addr. Reg */
  336. /*--------------------------------------------------------------------------+
  337. * Set up Configuration registers
  338. *--------------------------------------------------------------------------*/
  339. /* Program the board's subsystem id/vendor id */
  340. pci_write_config_word(0, PCI_SUBSYSTEM_VENDOR_ID,
  341. CFG_PCI_SUBSYS_VENDORID);
  342. pci_write_config_word(0, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_ID);
  343. /* Configure command register as bus master */
  344. pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER);
  345. /* 240nS PCI clock */
  346. pci_write_config_word(0, PCI_LATENCY_TIMER, 1);
  347. /* No error reporting */
  348. pci_write_config_word(0, PCI_ERREN, 0);
  349. pci_write_config_dword(0, PCI_BRDGOPT2, 0x00000101);
  350. }
  351. #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
  352. /*************************************************************************
  353. * pci_master_init
  354. *
  355. ************************************************************************/
  356. #if defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT)
  357. void pci_master_init(struct pci_controller *hose)
  358. {
  359. unsigned short temp_short;
  360. /*--------------------------------------------------------------------------+
  361. | Write the PowerPC440 EP PCI Configuration regs.
  362. | Enable PowerPC440 EP to be a master on the PCI bus (PMM).
  363. | Enable PowerPC440 EP to act as a PCI memory target (PTM).
  364. +--------------------------------------------------------------------------*/
  365. pci_read_config_word(0, PCI_COMMAND, &temp_short);
  366. pci_write_config_word(0, PCI_COMMAND,
  367. temp_short | PCI_COMMAND_MASTER |
  368. PCI_COMMAND_MEMORY);
  369. }
  370. #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT) */
  371. /*************************************************************************
  372. * is_pci_host
  373. *
  374. * This routine is called to determine if a pci scan should be
  375. * performed. With various hardware environments (especially cPCI and
  376. * PPMC) it's insufficient to depend on the state of the arbiter enable
  377. * bit in the strap register, or generic host/adapter assumptions.
  378. *
  379. * Rather than hard-code a bad assumption in the general 440 code, the
  380. * 440 pci code requires the board to decide at runtime.
  381. *
  382. * Return 0 for adapter mode, non-zero for host (monarch) mode.
  383. *
  384. *
  385. ************************************************************************/
  386. #if defined(CONFIG_PCI)
  387. int is_pci_host(struct pci_controller *hose)
  388. {
  389. /* Cactus is always configured as host. */
  390. return (1);
  391. }
  392. #endif /* defined(CONFIG_PCI) */
  393. void hw_watchdog_reset(void)
  394. {
  395. int val;
  396. /*
  397. * Toggle watchdog output
  398. */
  399. val = gpio_read_out_bit(CFG_GPIO_WATCHDOG) == 0 ? 1 : 0;
  400. gpio_write_bit(CFG_GPIO_WATCHDOG, val);
  401. }
  402. int do_eeprom_wp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  403. {
  404. if (argc < 2) {
  405. printf("Usage:\n%s\n", cmdtp->usage);
  406. return 1;
  407. }
  408. if ((strcmp(argv[1], "on") == 0)) {
  409. gpio_write_bit(CFG_GPIO_EEPROM_EXT_WP, 1);
  410. } else if ((strcmp(argv[1], "off") == 0)) {
  411. gpio_write_bit(CFG_GPIO_EEPROM_EXT_WP, 0);
  412. } else {
  413. printf("Usage:\n%s\n", cmdtp->usage);
  414. return 1;
  415. }
  416. return 0;
  417. }
  418. U_BOOT_CMD(
  419. eepromwp, 2, 0, do_eeprom_wp,
  420. "eepromwp- eeprom write protect off/on\n",
  421. "<on|off> - enable (on) or disable (off) I2C EEPROM write protect\n"
  422. );
  423. #if defined(CONFIG_VIDEO)
  424. #include <video_fb.h>
  425. #include <mb862xx.h>
  426. extern GraphicDevice mb862xx;
  427. static const gdc_regs init_regs [] =
  428. {
  429. {0x0100, 0x00000f00},
  430. {0x0020, 0x801401df},
  431. {0x0024, 0x00000000},
  432. {0x0028, 0x00000000},
  433. {0x002c, 0x00000000},
  434. {0x0110, 0x00000000},
  435. {0x0114, 0x00000000},
  436. {0x0118, 0x01df0280},
  437. {0x0004, 0x031f0000},
  438. {0x0008, 0x027f027f},
  439. {0x000c, 0x015f028f},
  440. {0x0010, 0x020c0000},
  441. {0x0014, 0x01df01ea},
  442. {0x0018, 0x00000000},
  443. {0x001c, 0x01e00280},
  444. {0x0100, 0x80010f00},
  445. {0x0, 0x0}
  446. };
  447. const gdc_regs *board_get_regs (void)
  448. {
  449. return init_regs;
  450. }
  451. /* Returns Lime base address */
  452. unsigned int board_video_init (void)
  453. {
  454. /*
  455. * Reset Lime controller
  456. */
  457. gpio_write_bit(CFG_GPIO_LIME_S, 1);
  458. udelay(500);
  459. gpio_write_bit(CFG_GPIO_LIME_RST, 1);
  460. /* Lime memory clock adjusted to 100MHz */
  461. out_be32((void *)CFG_LIME_SDRAM_CLOCK, CFG_LIME_CLOCK_100MHZ);
  462. /* Wait untill time expired. Because of requirements in lime manual */
  463. udelay(300);
  464. /* Write lime controller memory parameters */
  465. out_be32((void *)CFG_LIME_MMR, CFG_LIME_MMR_VALUE);
  466. mb862xx.winSizeX = 640;
  467. mb862xx.winSizeY = 480;
  468. mb862xx.gdfBytesPP = 2;
  469. mb862xx.gdfIndex = GDF_15BIT_555RGB;
  470. return CFG_LIME_BASE_0;
  471. }
  472. void board_backlight_switch (int flag)
  473. {
  474. if (flag) {
  475. /* pwm duty, lamp on */
  476. out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000024), 0x64);
  477. out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000020), 0x701);
  478. } else {
  479. /* lamp off */
  480. out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000024), 0x00);
  481. out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000020), 0x00);
  482. }
  483. }
  484. #if defined(CONFIG_CONSOLE_EXTRA_INFO)
  485. /*
  486. * Return text to be printed besides the logo.
  487. */
  488. void video_get_info_str (int line_number, char *info)
  489. {
  490. if (line_number == 1) {
  491. strcpy (info, " Board: Lwmon5 (Liebherr Elektronik GmbH)");
  492. } else {
  493. info [0] = '\0';
  494. }
  495. }
  496. #endif
  497. #endif /* CONFIG_VIDEO */