tqm5200.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. /*
  2. * (C) Copyright 2003-2006
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * (C) Copyright 2004
  6. * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
  7. *
  8. * (C) Copyright 2004-2006
  9. * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
  10. *
  11. * See file CREDITS for list of people who contributed to this
  12. * project.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27. * MA 02111-1307 USA
  28. */
  29. #include <common.h>
  30. #include <mpc5xxx.h>
  31. #include <pci.h>
  32. #include <asm/processor.h>
  33. #include <libfdt.h>
  34. #include <netdev.h>
  35. #ifdef CONFIG_VIDEO_SM501
  36. #include <sm501.h>
  37. #endif
  38. #if defined(CONFIG_MPC5200_DDR)
  39. #include "mt46v16m16-75.h"
  40. #else
  41. #include "mt48lc16m16a2-75.h"
  42. #endif
  43. #ifdef CONFIG_OF_LIBFDT
  44. #include <fdt_support.h>
  45. #endif /* CONFIG_OF_LIBFDT */
  46. DECLARE_GLOBAL_DATA_PTR;
  47. #ifdef CONFIG_PS2MULT
  48. void ps2mult_early_init(void);
  49. #endif
  50. #ifndef CONFIG_SYS_RAMBOOT
  51. static void sdram_start (int hi_addr)
  52. {
  53. long hi_addr_bit = hi_addr ? 0x01000000 : 0;
  54. /* unlock mode register */
  55. *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
  56. hi_addr_bit;
  57. __asm__ volatile ("sync");
  58. /* precharge all banks */
  59. *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
  60. hi_addr_bit;
  61. __asm__ volatile ("sync");
  62. #if SDRAM_DDR
  63. /* set mode register: extended mode */
  64. *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
  65. __asm__ volatile ("sync");
  66. /* set mode register: reset DLL */
  67. *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
  68. __asm__ volatile ("sync");
  69. #endif
  70. /* precharge all banks */
  71. *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
  72. hi_addr_bit;
  73. __asm__ volatile ("sync");
  74. /* auto refresh */
  75. *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
  76. hi_addr_bit;
  77. __asm__ volatile ("sync");
  78. /* set mode register */
  79. *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
  80. __asm__ volatile ("sync");
  81. /* normal operation */
  82. *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
  83. __asm__ volatile ("sync");
  84. }
  85. #endif
  86. /*
  87. * ATTENTION: Although partially referenced initdram does NOT make real use
  88. * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE
  89. * is something else than 0x00000000.
  90. */
  91. phys_size_t initdram (int board_type)
  92. {
  93. ulong dramsize = 0;
  94. ulong dramsize2 = 0;
  95. uint svr, pvr;
  96. #ifndef CONFIG_SYS_RAMBOOT
  97. ulong test1, test2;
  98. /* setup SDRAM chip selects */
  99. *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
  100. *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
  101. __asm__ volatile ("sync");
  102. /* setup config registers */
  103. *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
  104. *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
  105. __asm__ volatile ("sync");
  106. #if SDRAM_DDR
  107. /* set tap delay */
  108. *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
  109. __asm__ volatile ("sync");
  110. #endif
  111. /* find RAM size using SDRAM CS0 only */
  112. sdram_start(0);
  113. test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
  114. sdram_start(1);
  115. test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
  116. if (test1 > test2) {
  117. sdram_start(0);
  118. dramsize = test1;
  119. } else {
  120. dramsize = test2;
  121. }
  122. /* memory smaller than 1MB is impossible */
  123. if (dramsize < (1 << 20)) {
  124. dramsize = 0;
  125. }
  126. /* set SDRAM CS0 size according to the amount of RAM found */
  127. if (dramsize > 0) {
  128. *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
  129. __builtin_ffs(dramsize >> 20) - 1;
  130. } else {
  131. *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
  132. }
  133. /* let SDRAM CS1 start right after CS0 */
  134. *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
  135. /* find RAM size using SDRAM CS1 only */
  136. if (!dramsize)
  137. sdram_start(0);
  138. test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
  139. if (!dramsize) {
  140. sdram_start(1);
  141. test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
  142. }
  143. if (test1 > test2) {
  144. sdram_start(0);
  145. dramsize2 = test1;
  146. } else {
  147. dramsize2 = test2;
  148. }
  149. /* memory smaller than 1MB is impossible */
  150. if (dramsize2 < (1 << 20)) {
  151. dramsize2 = 0;
  152. }
  153. /* set SDRAM CS1 size according to the amount of RAM found */
  154. if (dramsize2 > 0) {
  155. *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
  156. | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
  157. } else {
  158. *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
  159. }
  160. #else /* CONFIG_SYS_RAMBOOT */
  161. /* retrieve size of memory connected to SDRAM CS0 */
  162. dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
  163. if (dramsize >= 0x13) {
  164. dramsize = (1 << (dramsize - 0x13)) << 20;
  165. } else {
  166. dramsize = 0;
  167. }
  168. /* retrieve size of memory connected to SDRAM CS1 */
  169. dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
  170. if (dramsize2 >= 0x13) {
  171. dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
  172. } else {
  173. dramsize2 = 0;
  174. }
  175. #endif /* CONFIG_SYS_RAMBOOT */
  176. /*
  177. * On MPC5200B we need to set the special configuration delay in the
  178. * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
  179. * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
  180. *
  181. * "The SDelay should be written to a value of 0x00000004. It is
  182. * required to account for changes caused by normal wafer processing
  183. * parameters."
  184. */
  185. svr = get_svr();
  186. pvr = get_pvr();
  187. if ((SVR_MJREV(svr) >= 2) &&
  188. (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
  189. *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
  190. __asm__ volatile ("sync");
  191. }
  192. #if defined(CONFIG_TQM5200_B)
  193. return dramsize + dramsize2;
  194. #else
  195. return dramsize;
  196. #endif /* CONFIG_TQM5200_B */
  197. }
  198. int checkboard (void)
  199. {
  200. #if defined(CONFIG_AEVFIFO)
  201. puts ("Board: AEVFIFO\n");
  202. return 0;
  203. #endif
  204. #if defined(CONFIG_TQM5200S)
  205. # define MODULE_NAME "TQM5200S"
  206. #else
  207. # define MODULE_NAME "TQM5200"
  208. #endif
  209. #if defined(CONFIG_STK52XX)
  210. # define CARRIER_NAME "STK52xx"
  211. #elif defined(CONFIG_TB5200)
  212. # define CARRIER_NAME "TB5200"
  213. #elif defined(CONFIG_CAM5200)
  214. # define CARRIER_NAME "CAM5200"
  215. #elif defined(CONFIG_FO300)
  216. # define CARRIER_NAME "FO300"
  217. #else
  218. # error "UNKNOWN"
  219. #endif
  220. puts ( "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
  221. " on a " CARRIER_NAME " carrier board\n");
  222. return 0;
  223. }
  224. #undef MODULE_NAME
  225. #undef CARRIER_NAME
  226. void flash_preinit(void)
  227. {
  228. /*
  229. * Now, when we are in RAM, enable flash write
  230. * access for detection process.
  231. * Note that CS_BOOT cannot be cleared when
  232. * executing in flash.
  233. */
  234. *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
  235. }
  236. #ifdef CONFIG_PCI
  237. static struct pci_controller hose;
  238. extern void pci_mpc5xxx_init(struct pci_controller *);
  239. void pci_init_board(void)
  240. {
  241. pci_mpc5xxx_init(&hose);
  242. }
  243. #endif
  244. #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET)
  245. #if defined (CONFIG_MINIFAP)
  246. #define SM501_POWER_MODE0_GATE 0x00000040UL
  247. #define SM501_POWER_MODE1_GATE 0x00000048UL
  248. #define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL
  249. #define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL
  250. #define SM501_GPIO_DATA_HIGH 0x00010004UL
  251. #define SM501_GPIO_51 0x00080000UL
  252. #endif /* CONFIG MINIFAP */
  253. void init_ide_reset (void)
  254. {
  255. debug ("init_ide_reset\n");
  256. #if defined (CONFIG_MINIFAP)
  257. /* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
  258. /* enable GPIO control (in both power modes) */
  259. *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
  260. POWER_MODE_GATE_GPIO_PWM_I2C;
  261. *(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
  262. POWER_MODE_GATE_GPIO_PWM_I2C;
  263. /* configure GPIO51 as output */
  264. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
  265. SM501_GPIO_51;
  266. #else
  267. /* Configure PSC1_4 as GPIO output for ATA reset */
  268. *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
  269. *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
  270. /* by default the ATA reset is de-asserted */
  271. *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
  272. #endif
  273. }
  274. void ide_set_reset (int idereset)
  275. {
  276. debug ("ide_reset(%d)\n", idereset);
  277. #if defined (CONFIG_MINIFAP)
  278. if (idereset) {
  279. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
  280. ~SM501_GPIO_51;
  281. } else {
  282. *(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
  283. SM501_GPIO_51;
  284. }
  285. #else
  286. if (idereset) {
  287. *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
  288. } else {
  289. *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
  290. }
  291. #endif
  292. }
  293. #endif
  294. #ifdef CONFIG_POST
  295. /*
  296. * Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
  297. * is left open, no keypress is detected.
  298. */
  299. int post_hotkeys_pressed(void)
  300. {
  301. #ifdef CONFIG_STK52XX
  302. struct mpc5xxx_gpio *gpio;
  303. gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
  304. /*
  305. * Configure PSC6_1 and PSC6_3 as GPIO. PSC6 then couldn't be used in
  306. * CODEC or UART mode. Consumer IrDA should still be possible.
  307. */
  308. gpio->port_config &= ~(0x07000000);
  309. gpio->port_config |= 0x03000000;
  310. /* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
  311. gpio->simple_gpioe |= 0x20000000;
  312. /* Configure GPIO_IRDA_1 as input */
  313. gpio->simple_ddr &= ~(0x20000000);
  314. return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
  315. #else
  316. return 0;
  317. #endif
  318. }
  319. #endif
  320. #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
  321. void post_word_store (ulong a)
  322. {
  323. volatile ulong *save_addr =
  324. (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
  325. *save_addr = a;
  326. }
  327. ulong post_word_load (void)
  328. {
  329. volatile ulong *save_addr =
  330. (volatile ulong *)(MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE);
  331. return *save_addr;
  332. }
  333. #endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
  334. #ifdef CONFIG_BOARD_EARLY_INIT_R
  335. int board_early_init_r (void)
  336. {
  337. extern int usb_cpu_init(void);
  338. #ifdef CONFIG_PS2MULT
  339. ps2mult_early_init();
  340. #endif /* CONFIG_PS2MULT */
  341. #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
  342. /* Low level USB init, required for proper kernel operation */
  343. usb_cpu_init();
  344. #endif
  345. return (0);
  346. }
  347. #endif
  348. #ifdef CONFIG_FO300
  349. int silent_boot (void)
  350. {
  351. vu_long timer3_status;
  352. /* Configure GPT3 as GPIO input */
  353. *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
  354. /* Read in TIMER_3 pin status */
  355. timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
  356. #ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
  357. /* Force silent console mode if S1 switch
  358. * is in closed position (TIMER_3 pin status is LOW). */
  359. if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
  360. return 1;
  361. #else
  362. /* Force silent console mode if S1 switch
  363. * is in open position (TIMER_3 pin status is HIGH). */
  364. if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
  365. return 1;
  366. #endif
  367. return 0;
  368. }
  369. int board_early_init_f (void)
  370. {
  371. if (silent_boot())
  372. gd->flags |= GD_FLG_SILENT;
  373. return 0;
  374. }
  375. #endif /* CONFIG_FO300 */
  376. int last_stage_init (void)
  377. {
  378. /*
  379. * auto scan for really existing devices and re-set chip select
  380. * configuration.
  381. */
  382. u16 save, tmp;
  383. int restore;
  384. /*
  385. * Check for SRAM and SRAM size
  386. */
  387. /* save original SRAM content */
  388. save = *(volatile u16 *)CONFIG_SYS_CS2_START;
  389. restore = 1;
  390. /* write test pattern to SRAM */
  391. *(volatile u16 *)CONFIG_SYS_CS2_START = 0xA5A5;
  392. __asm__ volatile ("sync");
  393. /*
  394. * Put a different pattern on the data lines: otherwise they may float
  395. * long enough to read back what we wrote.
  396. */
  397. tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
  398. if (tmp == 0xA5A5)
  399. puts ("!! possible error in SRAM detection\n");
  400. if (*(volatile u16 *)CONFIG_SYS_CS2_START != 0xA5A5) {
  401. /* no SRAM at all, disable cs */
  402. *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
  403. *(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
  404. *(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
  405. restore = 0;
  406. __asm__ volatile ("sync");
  407. } else if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0xA5A5) {
  408. /* make sure that we access a mirrored address */
  409. *(volatile u16 *)CONFIG_SYS_CS2_START = 0x1111;
  410. __asm__ volatile ("sync");
  411. if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0x1111) {
  412. /* SRAM size = 512 kByte */
  413. *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CONFIG_SYS_CS2_START,
  414. 0x80000);
  415. __asm__ volatile ("sync");
  416. puts ("SRAM: 512 kB\n");
  417. }
  418. else
  419. puts ("!! possible error in SRAM detection\n");
  420. } else {
  421. puts ("SRAM: 1 MB\n");
  422. }
  423. /* restore origianl SRAM content */
  424. if (restore) {
  425. *(volatile u16 *)CONFIG_SYS_CS2_START = save;
  426. __asm__ volatile ("sync");
  427. }
  428. #ifndef CONFIG_TQM5200S /* The TQM5200S has no SM501 grafic controller */
  429. /*
  430. * Check for Grafic Controller
  431. */
  432. /* save origianl FB content */
  433. save = *(volatile u16 *)CONFIG_SYS_CS1_START;
  434. restore = 1;
  435. /* write test pattern to FB memory */
  436. *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
  437. __asm__ volatile ("sync");
  438. /*
  439. * Put a different pattern on the data lines: otherwise they may float
  440. * long enough to read back what we wrote.
  441. */
  442. tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
  443. if (tmp == 0xA5A5)
  444. puts ("!! possible error in grafic controller detection\n");
  445. if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
  446. /* no grafic controller at all, disable cs */
  447. *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
  448. *(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
  449. *(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
  450. restore = 0;
  451. __asm__ volatile ("sync");
  452. } else {
  453. puts ("VGA: SMI501 (Voyager) with 8 MB\n");
  454. }
  455. /* restore origianl FB content */
  456. if (restore) {
  457. *(volatile u16 *)CONFIG_SYS_CS1_START = save;
  458. __asm__ volatile ("sync");
  459. }
  460. #ifdef CONFIG_FO300
  461. if (silent_boot()) {
  462. setenv("bootdelay", "0");
  463. disable_ctrlc(1);
  464. }
  465. #endif
  466. #endif /* !CONFIG_TQM5200S */
  467. return 0;
  468. }
  469. #ifdef CONFIG_VIDEO_SM501
  470. #ifdef CONFIG_FO300
  471. #define DISPLAY_WIDTH 800
  472. #else
  473. #define DISPLAY_WIDTH 640
  474. #endif
  475. #define DISPLAY_HEIGHT 480
  476. #ifdef CONFIG_VIDEO_SM501_8BPP
  477. #error CONFIG_VIDEO_SM501_8BPP not supported.
  478. #endif /* CONFIG_VIDEO_SM501_8BPP */
  479. #ifdef CONFIG_VIDEO_SM501_16BPP
  480. #error CONFIG_VIDEO_SM501_16BPP not supported.
  481. #endif /* CONFIG_VIDEO_SM501_16BPP */
  482. #ifdef CONFIG_VIDEO_SM501_32BPP
  483. static const SMI_REGS init_regs [] =
  484. {
  485. #if 0 /* CRT only */
  486. {0x00004, 0x0},
  487. {0x00048, 0x00021807},
  488. {0x0004C, 0x10090a01},
  489. {0x00054, 0x1},
  490. {0x00040, 0x00021807},
  491. {0x00044, 0x10090a01},
  492. {0x00054, 0x0},
  493. {0x80200, 0x00010000},
  494. {0x80204, 0x0},
  495. {0x80208, 0x0A000A00},
  496. {0x8020C, 0x02fa027f},
  497. {0x80210, 0x004a028b},
  498. {0x80214, 0x020c01df},
  499. {0x80218, 0x000201e9},
  500. {0x80200, 0x00013306},
  501. #else /* panel + CRT */
  502. #ifdef CONFIG_FO300
  503. {0x00004, 0x0},
  504. {0x00048, 0x00021807},
  505. {0x0004C, 0x301a0a01},
  506. {0x00054, 0x1},
  507. {0x00040, 0x00021807},
  508. {0x00044, 0x091a0a01},
  509. {0x00054, 0x0},
  510. {0x80000, 0x0f013106},
  511. {0x80004, 0xc428bb17},
  512. {0x8000C, 0x00000000},
  513. {0x80010, 0x0C800C80},
  514. {0x80014, 0x03200000},
  515. {0x80018, 0x01e00000},
  516. {0x8001C, 0x00000000},
  517. {0x80020, 0x01e00320},
  518. {0x80024, 0x042a031f},
  519. {0x80028, 0x0086034a},
  520. {0x8002C, 0x020c01df},
  521. {0x80030, 0x000201ea},
  522. {0x80200, 0x00010000},
  523. #else
  524. {0x00004, 0x0},
  525. {0x00048, 0x00021807},
  526. {0x0004C, 0x091a0a01},
  527. {0x00054, 0x1},
  528. {0x00040, 0x00021807},
  529. {0x00044, 0x091a0a01},
  530. {0x00054, 0x0},
  531. {0x80000, 0x0f013106},
  532. {0x80004, 0xc428bb17},
  533. {0x8000C, 0x00000000},
  534. {0x80010, 0x0a000a00},
  535. {0x80014, 0x02800000},
  536. {0x80018, 0x01e00000},
  537. {0x8001C, 0x00000000},
  538. {0x80020, 0x01e00280},
  539. {0x80024, 0x02fa027f},
  540. {0x80028, 0x004a028b},
  541. {0x8002C, 0x020c01df},
  542. {0x80030, 0x000201e9},
  543. {0x80200, 0x00010000},
  544. #endif /* #ifdef CONFIG_FO300 */
  545. #endif
  546. {0, 0}
  547. };
  548. #endif /* CONFIG_VIDEO_SM501_32BPP */
  549. #ifdef CONFIG_CONSOLE_EXTRA_INFO
  550. /*
  551. * Return text to be printed besides the logo.
  552. */
  553. void video_get_info_str (int line_number, char *info)
  554. {
  555. if (line_number == 1) {
  556. strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
  557. #if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200) || defined(CONFIG_FO300)
  558. } else if (line_number == 2) {
  559. #if defined (CONFIG_STK52XX)
  560. strcpy (info, " on a STK52xx carrier board");
  561. #endif
  562. #if defined (CONFIG_TB5200)
  563. strcpy (info, " on a TB5200 carrier board");
  564. #endif
  565. #if defined (CONFIG_FO300)
  566. strcpy (info, " on a FO300 carrier board");
  567. #endif
  568. #endif
  569. }
  570. else {
  571. info [0] = '\0';
  572. }
  573. }
  574. #endif
  575. /*
  576. * Returns SM501 register base address. First thing called in the
  577. * driver. Checks if SM501 is physically present.
  578. */
  579. unsigned int board_video_init (void)
  580. {
  581. u16 save, tmp;
  582. int restore, ret;
  583. /*
  584. * Check for Grafic Controller
  585. */
  586. /* save origianl FB content */
  587. save = *(volatile u16 *)CONFIG_SYS_CS1_START;
  588. restore = 1;
  589. /* write test pattern to FB memory */
  590. *(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
  591. __asm__ volatile ("sync");
  592. /*
  593. * Put a different pattern on the data lines: otherwise they may float
  594. * long enough to read back what we wrote.
  595. */
  596. tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
  597. if (tmp == 0xA5A5)
  598. puts ("!! possible error in grafic controller detection\n");
  599. if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
  600. /* no grafic controller found */
  601. restore = 0;
  602. ret = 0;
  603. } else {
  604. ret = SM501_MMIO_BASE;
  605. }
  606. if (restore) {
  607. *(volatile u16 *)CONFIG_SYS_CS1_START = save;
  608. __asm__ volatile ("sync");
  609. }
  610. return ret;
  611. }
  612. /*
  613. * Returns SM501 framebuffer address
  614. */
  615. unsigned int board_video_get_fb (void)
  616. {
  617. return SM501_FB_BASE;
  618. }
  619. /*
  620. * Called after initializing the SM501 and before clearing the screen.
  621. */
  622. void board_validate_screen (unsigned int base)
  623. {
  624. }
  625. /*
  626. * Return a pointer to the initialization sequence.
  627. */
  628. const SMI_REGS *board_get_regs (void)
  629. {
  630. return init_regs;
  631. }
  632. int board_get_width (void)
  633. {
  634. return DISPLAY_WIDTH;
  635. }
  636. int board_get_height (void)
  637. {
  638. return DISPLAY_HEIGHT;
  639. }
  640. #endif /* CONFIG_VIDEO_SM501 */
  641. #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
  642. void ft_board_setup(void *blob, bd_t *bd)
  643. {
  644. ft_cpu_setup(blob, bd);
  645. fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
  646. }
  647. #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
  648. int board_eth_init(bd_t *bis)
  649. {
  650. cpu_eth_init(bis); /* Built in FEC comes first */
  651. return pci_eth_init(bis);
  652. }