ocotea.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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 *) CONFIG_SYS_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. /*
  136. * Because of the interrupt handling rework to handle 440GX interrupts
  137. * with the common code, we needed to change names of the UIC registers.
  138. * Here the new relationship:
  139. *
  140. * U-Boot name 440GX name
  141. * -----------------------
  142. * UIC0 UICB0
  143. * UIC1 UIC0
  144. * UIC2 UIC1
  145. * UIC3 UIC2
  146. */
  147. mtdcr (uic1sr, 0xffffffff); /* clear all */
  148. mtdcr (uic1er, 0x00000000); /* disable all */
  149. mtdcr (uic1cr, 0x00000009); /* SMI & UIC1 crit are critical */
  150. mtdcr (uic1pr, 0xfffffe13); /* per ref-board manual */
  151. mtdcr (uic1tr, 0x01c00008); /* per ref-board manual */
  152. mtdcr (uic1vr, 0x00000001); /* int31 highest, base=0x000 */
  153. mtdcr (uic1sr, 0xffffffff); /* clear all */
  154. mtdcr (uic2sr, 0xffffffff); /* clear all */
  155. mtdcr (uic2er, 0x00000000); /* disable all */
  156. mtdcr (uic2cr, 0x00000000); /* all non-critical */
  157. mtdcr (uic2pr, 0xffffe0ff); /* per ref-board manual */
  158. mtdcr (uic2tr, 0x00ffc000); /* per ref-board manual */
  159. mtdcr (uic2vr, 0x00000001); /* int31 highest, base=0x000 */
  160. mtdcr (uic2sr, 0xffffffff); /* clear all */
  161. mtdcr (uic3sr, 0xffffffff); /* clear all */
  162. mtdcr (uic3er, 0x00000000); /* disable all */
  163. mtdcr (uic3cr, 0x00000000); /* all non-critical */
  164. mtdcr (uic3pr, 0xffffffff); /* per ref-board manual */
  165. mtdcr (uic3tr, 0x00ff8c0f); /* per ref-board manual */
  166. mtdcr (uic3vr, 0x00000001); /* int31 highest, base=0x000 */
  167. mtdcr (uic3sr, 0xffffffff); /* clear all */
  168. mtdcr (uic0sr, 0xfc000000); /* clear all */
  169. mtdcr (uic0er, 0x00000000); /* disable all */
  170. mtdcr (uic0cr, 0x00000000); /* all non-critical */
  171. mtdcr (uic0pr, 0xfc000000); /* */
  172. mtdcr (uic0tr, 0x00000000); /* */
  173. mtdcr (uic0vr, 0x00000001); /* */
  174. mfsdr (sdr_mfr, mfr);
  175. mfr &= ~SDR0_MFR_ECS_MASK;
  176. /* mtsdr(sdr_mfr, mfr); */
  177. fpga_init();
  178. return 0;
  179. }
  180. int checkboard (void)
  181. {
  182. char *s = getenv ("serial#");
  183. printf ("Board: Ocotea - AMCC PPC440GX Evaluation Board");
  184. if (s != NULL) {
  185. puts (", serial# ");
  186. puts (s);
  187. }
  188. putc ('\n');
  189. return (0);
  190. }
  191. phys_size_t initdram (int board_type)
  192. {
  193. long dram_size = 0;
  194. #if defined(CONFIG_SPD_EEPROM)
  195. dram_size = spd_sdram ();
  196. #else
  197. dram_size = fixed_sdram ();
  198. #endif
  199. return dram_size;
  200. }
  201. #if !defined(CONFIG_SPD_EEPROM)
  202. /*************************************************************************
  203. * fixed sdram init -- doesn't use serial presence detect.
  204. *
  205. * Assumes: 128 MB, non-ECC, non-registered
  206. * PLB @ 133 MHz
  207. *
  208. ************************************************************************/
  209. long int fixed_sdram (void)
  210. {
  211. uint reg;
  212. /*--------------------------------------------------------------------
  213. * Setup some default
  214. *------------------------------------------------------------------*/
  215. mtsdram (mem_uabba, 0x00000000); /* ubba=0 (default) */
  216. mtsdram (mem_slio, 0x00000000); /* rdre=0 wrre=0 rarw=0 */
  217. mtsdram (mem_devopt, 0x00000000); /* dll=0 ds=0 (normal) */
  218. mtsdram (mem_wddctr, 0x00000000); /* wrcp=0 dcd=0 */
  219. mtsdram (mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0 */
  220. /*--------------------------------------------------------------------
  221. * Setup for board-specific specific mem
  222. *------------------------------------------------------------------*/
  223. /*
  224. * Following for CAS Latency = 2.5 @ 133 MHz PLB
  225. */
  226. mtsdram (mem_b0cr, 0x000a4001); /* SDBA=0x000 128MB, Mode 3, enabled */
  227. mtsdram (mem_tr0, 0x410a4012); /* WR=2 WD=1 CL=2.5 PA=3 CP=4 LD=2 */
  228. /* RA=10 RD=3 */
  229. mtsdram (mem_tr1, 0x8080082f); /* SS=T2 SL=STAGE 3 CD=1 CT=0x02f */
  230. mtsdram (mem_rtr, 0x08200000); /* Rate 15.625 ns @ 133 MHz PLB */
  231. mtsdram (mem_cfg1, 0x00000000); /* Self-refresh exit, disable PM */
  232. udelay (400); /* Delay 200 usecs (min) */
  233. /*--------------------------------------------------------------------
  234. * Enable the controller, then wait for DCEN to complete
  235. *------------------------------------------------------------------*/
  236. mtsdram (mem_cfg0, 0x86000000); /* DCEN=1, PMUD=1, 64-bit */
  237. for (;;) {
  238. mfsdram (mem_mcsts, reg);
  239. if (reg & 0x80000000)
  240. break;
  241. }
  242. return (128 * 1024 * 1024); /* 128 MB */
  243. }
  244. #endif /* !defined(CONFIG_SPD_EEPROM) */
  245. /*************************************************************************
  246. * pci_pre_init
  247. *
  248. * This routine is called just prior to registering the hose and gives
  249. * the board the opportunity to check things. Returning a value of zero
  250. * indicates that things are bad & PCI initialization should be aborted.
  251. *
  252. * Different boards may wish to customize the pci controller structure
  253. * (add regions, override default access routines, etc) or perform
  254. * certain pre-initialization actions.
  255. *
  256. ************************************************************************/
  257. #if defined(CONFIG_PCI)
  258. int pci_pre_init(struct pci_controller * hose )
  259. {
  260. unsigned long strap;
  261. /*--------------------------------------------------------------------------+
  262. * The ocotea board is always configured as the host & requires the
  263. * PCI arbiter to be enabled.
  264. *--------------------------------------------------------------------------*/
  265. mfsdr(sdr_sdstp1, strap);
  266. if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ){
  267. printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
  268. return 0;
  269. }
  270. return 1;
  271. }
  272. #endif /* defined(CONFIG_PCI) */
  273. /*************************************************************************
  274. * pci_target_init
  275. *
  276. * The bootstrap configuration provides default settings for the pci
  277. * inbound map (PIM). But the bootstrap config choices are limited and
  278. * may not be sufficient for a given board.
  279. *
  280. ************************************************************************/
  281. #if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT)
  282. void pci_target_init(struct pci_controller * hose )
  283. {
  284. /*--------------------------------------------------------------------------+
  285. * Disable everything
  286. *--------------------------------------------------------------------------*/
  287. out32r( PCIX0_PIM0SA, 0 ); /* disable */
  288. out32r( PCIX0_PIM1SA, 0 ); /* disable */
  289. out32r( PCIX0_PIM2SA, 0 ); /* disable */
  290. out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
  291. /*--------------------------------------------------------------------------+
  292. * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
  293. * options to not support sizes such as 128/256 MB.
  294. *--------------------------------------------------------------------------*/
  295. out32r( PCIX0_PIM0LAL, CONFIG_SYS_SDRAM_BASE );
  296. out32r( PCIX0_PIM0LAH, 0 );
  297. out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
  298. out32r( PCIX0_BAR0, 0 );
  299. /*--------------------------------------------------------------------------+
  300. * Program the board's subsystem id/vendor id
  301. *--------------------------------------------------------------------------*/
  302. out16r( PCIX0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID );
  303. out16r( PCIX0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_DEVICEID );
  304. out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
  305. }
  306. #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
  307. /*************************************************************************
  308. * is_pci_host
  309. *
  310. * This routine is called to determine if a pci scan should be
  311. * performed. With various hardware environments (especially cPCI and
  312. * PPMC) it's insufficient to depend on the state of the arbiter enable
  313. * bit in the strap register, or generic host/adapter assumptions.
  314. *
  315. * Rather than hard-code a bad assumption in the general 440 code, the
  316. * 440 pci code requires the board to decide at runtime.
  317. *
  318. * Return 0 for adapter mode, non-zero for host (monarch) mode.
  319. *
  320. *
  321. ************************************************************************/
  322. #if defined(CONFIG_PCI)
  323. int is_pci_host(struct pci_controller *hose)
  324. {
  325. /* The ocotea board is always configured as host. */
  326. return(1);
  327. }
  328. #endif /* defined(CONFIG_PCI) */
  329. void fpga_init(void)
  330. {
  331. unsigned long group;
  332. unsigned long sdr0_pfc0;
  333. unsigned long sdr0_pfc1;
  334. unsigned long sdr0_cust0;
  335. unsigned long pvr;
  336. mfsdr (sdr_pfc0, sdr0_pfc0);
  337. mfsdr (sdr_pfc1, sdr0_pfc1);
  338. group = SDR0_PFC1_EPS_DECODE(sdr0_pfc1);
  339. pvr = get_pvr ();
  340. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_GEIE_MASK) | SDR0_PFC0_GEIE_TRE;
  341. if ( ((pvr == PVR_440GX_RA) || (pvr == PVR_440GX_RB)) && ((group == 4) || (group == 5))) {
  342. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_DISABLE;
  343. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
  344. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  345. FPGA_REG2_EXT_INTFACE_ENABLE);
  346. mtsdr (sdr_pfc0, sdr0_pfc0);
  347. mtsdr (sdr_pfc1, sdr0_pfc1);
  348. } else {
  349. sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_ENABLE;
  350. switch (group)
  351. {
  352. case 0:
  353. case 1:
  354. case 2:
  355. /* CPU trace A */
  356. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  357. FPGA_REG2_EXT_INTFACE_ENABLE);
  358. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
  359. mtsdr (sdr_pfc0, sdr0_pfc0);
  360. mtsdr (sdr_pfc1, sdr0_pfc1);
  361. break;
  362. case 3:
  363. case 4:
  364. case 5:
  365. case 6:
  366. /* CPU trace B - Over EBMI */
  367. sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_CPUTRACE;
  368. mtsdr (sdr_pfc0, sdr0_pfc0);
  369. mtsdr (sdr_pfc1, sdr0_pfc1);
  370. out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
  371. FPGA_REG2_EXT_INTFACE_DISABLE);
  372. break;
  373. }
  374. }
  375. /* Initialize the ethernet specific functions in the fpga */
  376. mfsdr(sdr_pfc1, sdr0_pfc1);
  377. mfsdr(sdr_cust0, sdr0_cust0);
  378. if ( (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) == 4) &&
  379. ((SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII) ||
  380. (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_TBI)))
  381. {
  382. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  383. {
  384. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
  385. FPGA_REG3_ENET_GROUP7);
  386. }
  387. else
  388. {
  389. if (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII)
  390. {
  391. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  392. FPGA_REG3_ENET_GROUP7);
  393. }
  394. else
  395. {
  396. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  397. FPGA_REG3_ENET_GROUP8);
  398. }
  399. }
  400. }
  401. else
  402. {
  403. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  404. {
  405. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
  406. FPGA_REG3_ENET_ENCODE1(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
  407. }
  408. else
  409. {
  410. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
  411. FPGA_REG3_ENET_ENCODE2(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
  412. }
  413. }
  414. out8(FPGA_REG4, FPGA_REG4_GPHY_MODE10 |
  415. FPGA_REG4_GPHY_MODE100 | FPGA_REG4_GPHY_MODE1000 |
  416. FPGA_REG4_GPHY_FRC_DPLX | FPGA_REG4_CONNECT_PHYS);
  417. /* reset the gigabyte phy if necessary */
  418. if (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) >= 3)
  419. {
  420. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
  421. {
  422. out8(FPGA_REG3, in8(FPGA_REG3) & ~FPGA_REG3_GIGABIT_RESET_DISABLE);
  423. udelay(10000);
  424. out8(FPGA_REG3, in8(FPGA_REG3) | FPGA_REG3_GIGABIT_RESET_DISABLE);
  425. }
  426. else
  427. {
  428. out8(FPGA_REG2, in8(FPGA_REG2) & ~FPGA_REG2_GIGABIT_RESET_DISABLE);
  429. udelay(10000);
  430. out8(FPGA_REG2, in8(FPGA_REG2) | FPGA_REG2_GIGABIT_RESET_DISABLE);
  431. }
  432. }
  433. /*
  434. * new Ocotea with Rev. F (pass 3) chips has SMII PHY reset
  435. */
  436. if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER2) {
  437. out8(FPGA_REG2, in8(FPGA_REG2) & ~FPGA_REG2_SMII_RESET_DISABLE);
  438. udelay(10000);
  439. out8(FPGA_REG2, in8(FPGA_REG2) | FPGA_REG2_SMII_RESET_DISABLE);
  440. }
  441. /* Turn off the LED's */
  442. out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_STAT_MASK) |
  443. FPGA_REG3_STAT_LED8_DISAB | FPGA_REG3_STAT_LED4_DISAB |
  444. FPGA_REG3_STAT_LED2_DISAB | FPGA_REG3_STAT_LED1_DISAB);
  445. return;
  446. }
  447. #ifdef CONFIG_POST
  448. /*
  449. * Returns 1 if keys pressed to start the power-on long-running tests
  450. * Called from board_init_f().
  451. */
  452. int post_hotkeys_pressed(void)
  453. {
  454. return (ctrlc());
  455. }
  456. #endif