ocotea.c 17 KB

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