ocotea.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /*
  2. * Copyright (C) 2004 PaulReynolds@lhsolutions.com
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include "ocotea.h"
  24. #include <asm/processor.h>
  25. #include <spd_sdram.h>
  26. #include <440gx_enet.h>
  27. #define BOOT_SMALL_FLASH 32 /* 00100000 */
  28. #define FLASH_ONBD_N 2 /* 00000010 */
  29. #define FLASH_SRAM_SEL 1 /* 00000001 */
  30. long int fixed_sdram (void);
  31. void fpga_init (void);
  32. int board_early_init_f (void)
  33. {
  34. unsigned long mfr;
  35. unsigned char *fpga_base = (unsigned char *) CFG_FPGA_BASE;
  36. unsigned char switch_status;
  37. unsigned long cs0_base;
  38. unsigned long cs0_size;
  39. unsigned long cs0_twt;
  40. unsigned long cs2_base;
  41. unsigned long cs2_size;
  42. unsigned long cs2_twt;
  43. /*-------------------------------------------------------------------------+
  44. | Initialize EBC CONFIG
  45. +-------------------------------------------------------------------------*/
  46. mtebc(xbcfg, EBC_CFG_LE_UNLOCK |
  47. EBC_CFG_PTD_ENABLE | EBC_CFG_RTC_64PERCLK |
  48. EBC_CFG_ATC_PREVIOUS | EBC_CFG_DTC_PREVIOUS |
  49. EBC_CFG_CTC_PREVIOUS | EBC_CFG_EMC_NONDEFAULT |
  50. EBC_CFG_PME_DISABLE | EBC_CFG_PR_32);
  51. /*-------------------------------------------------------------------------+
  52. | FPGA. Initialize bank 7 with default values.
  53. +-------------------------------------------------------------------------*/
  54. mtebc(pb7ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(7)|
  55. EBC_BXAP_BCE_DISABLE|
  56. EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
  57. EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
  58. EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
  59. EBC_BXAP_BEM_WRITEONLY|
  60. EBC_BXAP_PEN_DISABLED);
  61. mtebc(pb7cr, EBC_BXCR_BAS_ENCODE(0x48300000)|
  62. EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
  63. /* read FPGA base register FPGA_REG0 */
  64. switch_status = *fpga_base;
  65. if (switch_status & 0x40) {
  66. cs0_base = 0xFFE00000;
  67. cs0_size = EBC_BXCR_BS_2MB;
  68. cs0_twt = 8;
  69. cs2_base = 0xFF800000;
  70. cs2_size = EBC_BXCR_BS_4MB;
  71. cs2_twt = 10;
  72. } else {
  73. cs0_base = 0xFFC00000;
  74. cs0_size = EBC_BXCR_BS_4MB;
  75. cs0_twt = 10;
  76. cs2_base = 0xFF800000;
  77. cs2_size = EBC_BXCR_BS_2MB;
  78. cs2_twt = 8;
  79. }
  80. /*-------------------------------------------------------------------------+
  81. | 1 MB FLASH / 1 MB SRAM. Initialize bank 0 with default values.
  82. +-------------------------------------------------------------------------*/
  83. mtebc(pb0ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(cs0_twt)|
  84. EBC_BXAP_BCE_DISABLE|
  85. EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
  86. EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
  87. EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
  88. EBC_BXAP_BEM_WRITEONLY|
  89. EBC_BXAP_PEN_DISABLED);
  90. mtebc(pb0cr, EBC_BXCR_BAS_ENCODE(cs0_base)|
  91. cs0_size|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
  92. /*-------------------------------------------------------------------------+
  93. | 8KB NVRAM/RTC. Initialize bank 1 with default values.
  94. +-------------------------------------------------------------------------*/
  95. mtebc(pb1ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(10)|
  96. EBC_BXAP_BCE_DISABLE|
  97. EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
  98. EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
  99. EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
  100. EBC_BXAP_BEM_WRITEONLY|
  101. EBC_BXAP_PEN_DISABLED);
  102. mtebc(pb1cr, EBC_BXCR_BAS_ENCODE(0x48000000)|
  103. EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
  104. /*-------------------------------------------------------------------------+
  105. | 4 MB FLASH. Initialize bank 2 with default values.
  106. +-------------------------------------------------------------------------*/
  107. mtebc(pb2ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(cs2_twt)|
  108. EBC_BXAP_BCE_DISABLE|
  109. EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
  110. EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
  111. EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
  112. EBC_BXAP_BEM_WRITEONLY|
  113. EBC_BXAP_PEN_DISABLED);
  114. mtebc(pb2cr, EBC_BXCR_BAS_ENCODE(cs2_base)|
  115. cs2_size|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
  116. /*-------------------------------------------------------------------------+
  117. | FPGA. Initialize bank 7 with default values.
  118. +-------------------------------------------------------------------------*/
  119. mtebc(pb7ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(7)|
  120. EBC_BXAP_BCE_DISABLE|
  121. EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
  122. EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
  123. EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
  124. EBC_BXAP_BEM_WRITEONLY|
  125. EBC_BXAP_PEN_DISABLED);
  126. mtebc(pb7cr, EBC_BXCR_BAS_ENCODE(0x48300000)|
  127. EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
  128. /*--------------------------------------------------------------------
  129. * Setup the interrupt controller polarities, triggers, etc.
  130. *-------------------------------------------------------------------*/
  131. mtdcr (uic0sr, 0xffffffff); /* clear all */
  132. mtdcr (uic0er, 0x00000000); /* disable all */
  133. mtdcr (uic0cr, 0x00000009); /* SMI & UIC1 crit are critical */
  134. mtdcr (uic0pr, 0xfffffe13); /* per ref-board manual */
  135. mtdcr (uic0tr, 0x01c00008); /* per ref-board manual */
  136. mtdcr (uic0vr, 0x00000001); /* int31 highest, base=0x000 */
  137. mtdcr (uic0sr, 0xffffffff); /* clear all */
  138. mtdcr (uic1sr, 0xffffffff); /* clear all */
  139. mtdcr (uic1er, 0x00000000); /* disable all */
  140. mtdcr (uic1cr, 0x00000000); /* all non-critical */
  141. mtdcr (uic1pr, 0xffffe0ff); /* per ref-board manual */
  142. mtdcr (uic1tr, 0x00ffc000); /* per ref-board manual */
  143. mtdcr (uic1vr, 0x00000001); /* int31 highest, base=0x000 */
  144. mtdcr (uic1sr, 0xffffffff); /* clear all */
  145. mtdcr (uic2sr, 0xffffffff); /* clear all */
  146. mtdcr (uic2er, 0x00000000); /* disable all */
  147. mtdcr (uic2cr, 0x00000000); /* all non-critical */
  148. mtdcr (uic2pr, 0xffffffff); /* per ref-board manual */
  149. mtdcr (uic2tr, 0x00ff8c0f); /* per ref-board manual */
  150. mtdcr (uic2vr, 0x00000001); /* int31 highest, base=0x000 */
  151. mtdcr (uic2sr, 0xffffffff); /* clear all */
  152. mtdcr (uicb0sr, 0xfc000000); /* clear all */
  153. mtdcr (uicb0er, 0x00000000); /* disable all */
  154. mtdcr (uicb0cr, 0x00000000); /* all non-critical */
  155. mtdcr (uicb0pr, 0xfc000000); /* */
  156. mtdcr (uicb0tr, 0x00000000); /* */
  157. mtdcr (uicb0vr, 0x00000001); /* */
  158. mfsdr (sdr_mfr, mfr);
  159. mfr &= ~SDR0_MFR_ECS_MASK;
  160. /* mtsdr(sdr_mfr, mfr); */
  161. fpga_init();
  162. return 0;
  163. }
  164. int checkboard (void)
  165. {
  166. sys_info_t sysinfo;
  167. get_sys_info (&sysinfo);
  168. printf ("Board: IBM 440GX Evaluation Board\n");
  169. printf ("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz / 1000000);
  170. printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
  171. printf ("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
  172. printf ("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
  173. printf ("\tEPB: %lu MHz\n", sysinfo.freqEPB / 1000000);
  174. return (0);
  175. }
  176. long int initdram (int board_type)
  177. {
  178. long dram_size = 0;
  179. #if defined(CONFIG_SPD_EEPROM)
  180. dram_size = spd_sdram (0);
  181. #else
  182. dram_size = fixed_sdram ();
  183. #endif
  184. return dram_size;
  185. }
  186. #if defined(CFG_DRAM_TEST)
  187. int testdram (void)
  188. {
  189. uint *pstart = (uint *) 0x00000000;
  190. uint *pend = (uint *) 0x08000000;
  191. uint *p;
  192. for (p = pstart; p < pend; p++)
  193. *p = 0xaaaaaaaa;
  194. for (p = pstart; p < pend; p++) {
  195. if (*p != 0xaaaaaaaa) {
  196. printf ("SDRAM test fails at: %08x\n", (uint) p);
  197. return 1;
  198. }
  199. }
  200. for (p = pstart; p < pend; p++)
  201. *p = 0x55555555;
  202. for (p = pstart; p < pend; p++) {
  203. if (*p != 0x55555555) {
  204. printf ("SDRAM test fails at: %08x\n", (uint) p);
  205. return 1;
  206. }
  207. }
  208. return 0;
  209. }
  210. #endif
  211. #if !defined(CONFIG_SPD_EEPROM)
  212. /*************************************************************************
  213. * fixed sdram init -- doesn't use serial presence detect.
  214. *
  215. * Assumes: 128 MB, non-ECC, non-registered
  216. * PLB @ 133 MHz
  217. *
  218. ************************************************************************/
  219. long int fixed_sdram (void)
  220. {
  221. uint reg;
  222. /*--------------------------------------------------------------------
  223. * Setup some default
  224. *------------------------------------------------------------------*/
  225. mtsdram (mem_uabba, 0x00000000); /* ubba=0 (default) */
  226. mtsdram (mem_slio, 0x00000000); /* rdre=0 wrre=0 rarw=0 */
  227. mtsdram (mem_devopt, 0x00000000); /* dll=0 ds=0 (normal) */
  228. mtsdram (mem_wddctr, 0x00000000); /* wrcp=0 dcd=0 */
  229. mtsdram (mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0 */
  230. /*--------------------------------------------------------------------
  231. * Setup for board-specific specific mem
  232. *------------------------------------------------------------------*/
  233. /*
  234. * Following for CAS Latency = 2.5 @ 133 MHz PLB
  235. */
  236. mtsdram (mem_b0cr, 0x000a4001); /* SDBA=0x000 128MB, Mode 3, enabled */
  237. mtsdram (mem_tr0, 0x410a4012); /* WR=2 WD=1 CL=2.5 PA=3 CP=4 LD=2 */
  238. /* RA=10 RD=3 */
  239. mtsdram (mem_tr1, 0x8080082f); /* SS=T2 SL=STAGE 3 CD=1 CT=0x02f */
  240. mtsdram (mem_rtr, 0x08200000); /* Rate 15.625 ns @ 133 MHz PLB */
  241. mtsdram (mem_cfg1, 0x00000000); /* Self-refresh exit, disable PM */
  242. udelay (400); /* Delay 200 usecs (min) */
  243. /*--------------------------------------------------------------------
  244. * Enable the controller, then wait for DCEN to complete
  245. *------------------------------------------------------------------*/
  246. mtsdram (mem_cfg0, 0x86000000); /* DCEN=1, PMUD=1, 64-bit */
  247. for (;;) {
  248. mfsdram (mem_mcsts, reg);
  249. if (reg & 0x80000000)
  250. break;
  251. }
  252. return (128 * 1024 * 1024); /* 128 MB */
  253. }
  254. #endif /* !defined(CONFIG_SPD_EEPROM) */
  255. /*************************************************************************
  256. * pci_pre_init
  257. *
  258. * This routine is called just prior to registering the hose and gives
  259. * the board the opportunity to check things. Returning a value of zero
  260. * indicates that things are bad & PCI initialization should be aborted.
  261. *
  262. * Different boards may wish to customize the pci controller structure
  263. * (add regions, override default access routines, etc) or perform
  264. * certain pre-initialization actions.
  265. *
  266. ************************************************************************/
  267. #if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
  268. int pci_pre_init(struct pci_controller * hose )
  269. {
  270. unsigned long strap;
  271. /*--------------------------------------------------------------------------+
  272. * The ocotea board is always configured as the host & requires the
  273. * PCI arbiter to be enabled.
  274. *--------------------------------------------------------------------------*/
  275. mfsdr(sdr_sdstp1, strap);
  276. if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ){
  277. printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
  278. return 0;
  279. }
  280. return 1;
  281. }
  282. #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
  283. /*************************************************************************
  284. * pci_target_init
  285. *
  286. * The bootstrap configuration provides default settings for the pci
  287. * inbound map (PIM). But the bootstrap config choices are limited and
  288. * may not be sufficient for a given board.
  289. *
  290. ************************************************************************/
  291. #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
  292. void pci_target_init(struct pci_controller * hose )
  293. {
  294. DECLARE_GLOBAL_DATA_PTR;
  295. /*--------------------------------------------------------------------------+
  296. * Disable everything
  297. *--------------------------------------------------------------------------*/
  298. out32r( PCIX0_PIM0SA, 0 ); /* disable */
  299. out32r( PCIX0_PIM1SA, 0 ); /* disable */
  300. out32r( PCIX0_PIM2SA, 0 ); /* disable */
  301. out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
  302. /*--------------------------------------------------------------------------+
  303. * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
  304. * options to not support sizes such as 128/256 MB.
  305. *--------------------------------------------------------------------------*/
  306. out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
  307. out32r( PCIX0_PIM0LAH, 0 );
  308. out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
  309. out32r( PCIX0_BAR0, 0 );
  310. /*--------------------------------------------------------------------------+
  311. * Program the board's subsystem id/vendor id
  312. *--------------------------------------------------------------------------*/
  313. out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
  314. out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
  315. out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
  316. }
  317. #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
  318. /*************************************************************************
  319. * is_pci_host
  320. *
  321. * This routine is called to determine if a pci scan should be
  322. * performed. With various hardware environments (especially cPCI and
  323. * PPMC) it's insufficient to depend on the state of the arbiter enable
  324. * bit in the strap register, or generic host/adapter assumptions.
  325. *
  326. * Rather than hard-code a bad assumption in the general 440 code, the
  327. * 440 pci code requires the board to decide at runtime.
  328. *
  329. * Return 0 for adapter mode, non-zero for host (monarch) mode.
  330. *
  331. *
  332. ************************************************************************/
  333. #if defined(CONFIG_PCI)
  334. int is_pci_host(struct pci_controller *hose)
  335. {
  336. /* The ocotea board is always configured as host. */
  337. return(1);
  338. }
  339. #endif /* defined(CONFIG_PCI) */
  340. void fpga_init(void)
  341. {
  342. unsigned long group;
  343. unsigned long sdr0_pfc0;
  344. unsigned long sdr0_pfc1;
  345. unsigned long sdr0_cust0;
  346. unsigned long pvr;
  347. mfsdr (sdr_pfc0, sdr0_pfc0);
  348. mfsdr (sdr_pfc1, sdr0_pfc1);
  349. group = SDR0_PFC1_EPS_DECODE(sdr0_pfc1);
  350. pvr = get_pvr ();
  351. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_GEIE_MASK) | SDR0_PFC0_GEIE_TRE;
  352. if ( ((pvr == PVR_440GX_RA) || (pvr == PVR_440GX_RB)) && ((group == 4) || (group == 5))) {
  353. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_DISABLE;
  354. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
  355. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  356. FPGA_REG2_EXT_INTFACE_ENABLE);
  357. mtsdr (sdr_pfc0, sdr0_pfc0);
  358. mtsdr (sdr_pfc1, sdr0_pfc1);
  359. } else {
  360. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_ENABLE;
  361. switch (group)
  362. {
  363. case 0:
  364. case 1:
  365. case 2:
  366. /* CPU trace A */
  367. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  368. FPGA_REG2_EXT_INTFACE_ENABLE);
  369. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
  370. mtsdr (sdr_pfc0, sdr0_pfc0);
  371. mtsdr (sdr_pfc1, sdr0_pfc1);
  372. break;
  373. case 3:
  374. case 4:
  375. case 5:
  376. case 6:
  377. /* CPU trace B - Over EBMI */
  378. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_CPUTRACE;
  379. mtsdr (sdr_pfc0, sdr0_pfc0);
  380. mtsdr (sdr_pfc1, sdr0_pfc1);
  381. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  382. FPGA_REG2_EXT_INTFACE_DISABLE);
  383. break;
  384. }
  385. }
  386. /* Initialize the ethernet specific functions in the fpga */
  387. mfsdr(sdr_pfc1, sdr0_pfc1);
  388. mfsdr(sdr_cust0, sdr0_cust0);
  389. if ( (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) == 4) &&
  390. ((SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII) ||
  391. (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_TBI)))
  392. {
  393. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  394. {
  395. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
  396. FPGA_REG3_ENET_GROUP7);
  397. }
  398. else
  399. {
  400. if (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII)
  401. {
  402. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  403. FPGA_REG3_ENET_GROUP7);
  404. }
  405. else
  406. {
  407. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  408. FPGA_REG3_ENET_GROUP8);
  409. }
  410. }
  411. }
  412. else
  413. {
  414. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  415. {
  416. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
  417. FPGA_REG3_ENET_ENCODE1(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
  418. }
  419. else
  420. {
  421. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  422. FPGA_REG3_ENET_ENCODE2(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
  423. }
  424. }
  425. out8(FPGA_REG4, FPGA_REG4_GPHY_MODE10 |
  426. FPGA_REG4_GPHY_MODE100 | FPGA_REG4_GPHY_MODE1000 |
  427. FPGA_REG4_GPHY_FRC_DPLX | FPGA_REG4_CONNECT_PHYS);
  428. /* reset the gigabyte phy if necessary */
  429. if (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) >= 3)
  430. {
  431. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  432. {
  433. out8(FPGA_REG3, in8(FPGA_REG3) & ~FPGA_REG3_GIGABIT_RESET_DISABLE);
  434. udelay(10000);
  435. out8(FPGA_REG3, in8(FPGA_REG3) | FPGA_REG3_GIGABIT_RESET_DISABLE);
  436. }
  437. else
  438. {
  439. out8(FPGA_REG2, in8(FPGA_REG2) & ~FPGA_REG2_GIGABIT_RESET_DISABLE);
  440. udelay(10000);
  441. out8(FPGA_REG2, in8(FPGA_REG2) | FPGA_REG2_GIGABIT_RESET_DISABLE);
  442. }
  443. }
  444. /* Turn off the LED's */
  445. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_STAT_MASK) |
  446. FPGA_REG3_STAT_LED8_DISAB | FPGA_REG3_STAT_LED4_DISAB |
  447. FPGA_REG3_STAT_LED2_DISAB | FPGA_REG3_STAT_LED1_DISAB);
  448. return;
  449. }
  450. #ifdef CONFIG_POST
  451. /*
  452. * Returns 1 if keys pressed to start the power-on long-running tests
  453. * Called from board_init_f().
  454. */
  455. int post_hotkeys_pressed(void)
  456. {
  457. return (ctrlc());
  458. }
  459. #endif