yucca.c 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. /*
  2. * (C) Copyright 2006
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. * Port to AMCC-440SPE Evaluation Board SOP - April 2005
  24. *
  25. * PCIe supporting routines derived from Linux 440SPe PCIe driver.
  26. */
  27. #include <common.h>
  28. #include <ppc4xx.h>
  29. #include <i2c.h>
  30. #include <asm/processor.h>
  31. #include <asm/io.h>
  32. #include <asm/4xx_pcie.h>
  33. #include "yucca.h"
  34. DECLARE_GLOBAL_DATA_PTR;
  35. void fpga_init (void);
  36. #define DEBUG_ENV
  37. #ifdef DEBUG_ENV
  38. #define DEBUGF(fmt,args...) printf(fmt ,##args)
  39. #else
  40. #define DEBUGF(fmt,args...)
  41. #endif
  42. #define FALSE 0
  43. #define TRUE 1
  44. int board_early_init_f (void)
  45. {
  46. /*----------------------------------------------------------------------------+
  47. | Define Boot devices
  48. +----------------------------------------------------------------------------*/
  49. #define BOOT_FROM_SMALL_FLASH 0x00
  50. #define BOOT_FROM_LARGE_FLASH_OR_SRAM 0x01
  51. #define BOOT_FROM_PCI 0x02
  52. #define BOOT_DEVICE_UNKNOWN 0x03
  53. /*----------------------------------------------------------------------------+
  54. | EBC Devices Characteristics
  55. | Peripheral Bank Access Parameters - EBC_BxAP
  56. | Peripheral Bank Configuration Register - EBC_BxCR
  57. +----------------------------------------------------------------------------*/
  58. /*
  59. * Small Flash and FRAM
  60. * BU Value
  61. * BxAP : 0x03800000 - 0 00000111 0 00 00 00 00 00 000 0 0 0 0 00000
  62. * B0CR : 0xff098000 - BAS = ff0 - 100 11 00 0000000000000
  63. * B2CR : 0xe7098000 - BAS = e70 - 100 11 00 0000000000000
  64. */
  65. #define EBC_BXAP_SMALL_FLASH EBC_BXAP_BME_DISABLED | \
  66. EBC_BXAP_TWT_ENCODE(7) | \
  67. EBC_BXAP_BCE_DISABLE | \
  68. EBC_BXAP_BCT_2TRANS | \
  69. EBC_BXAP_CSN_ENCODE(0) | \
  70. EBC_BXAP_OEN_ENCODE(0) | \
  71. EBC_BXAP_WBN_ENCODE(0) | \
  72. EBC_BXAP_WBF_ENCODE(0) | \
  73. EBC_BXAP_TH_ENCODE(0) | \
  74. EBC_BXAP_RE_DISABLED | \
  75. EBC_BXAP_SOR_DELAYED | \
  76. EBC_BXAP_BEM_WRITEONLY | \
  77. EBC_BXAP_PEN_DISABLED
  78. #define EBC_BXCR_SMALL_FLASH_CS0 EBC_BXCR_BAS_ENCODE(0xFF000000) | \
  79. EBC_BXCR_BS_16MB | \
  80. EBC_BXCR_BU_RW | \
  81. EBC_BXCR_BW_8BIT
  82. #define EBC_BXCR_SMALL_FLASH_CS2 EBC_BXCR_BAS_ENCODE(0xe7000000) | \
  83. EBC_BXCR_BS_16MB | \
  84. EBC_BXCR_BU_RW | \
  85. EBC_BXCR_BW_8BIT
  86. /*
  87. * Large Flash and SRAM
  88. * BU Value
  89. * BxAP : 0x048ff240 - 0 00000111 0 00 00 00 00 00 000 0 0 0 0 00000
  90. * B0CR : 0xff09a000 - BAS = ff0 - 100 11 01 0000000000000
  91. * B2CR : 0xe709a000 - BAS = e70 - 100 11 01 0000000000000
  92. */
  93. #define EBC_BXAP_LARGE_FLASH EBC_BXAP_BME_DISABLED | \
  94. EBC_BXAP_TWT_ENCODE(7) | \
  95. EBC_BXAP_BCE_DISABLE | \
  96. EBC_BXAP_BCT_2TRANS | \
  97. EBC_BXAP_CSN_ENCODE(0) | \
  98. EBC_BXAP_OEN_ENCODE(0) | \
  99. EBC_BXAP_WBN_ENCODE(0) | \
  100. EBC_BXAP_WBF_ENCODE(0) | \
  101. EBC_BXAP_TH_ENCODE(0) | \
  102. EBC_BXAP_RE_DISABLED | \
  103. EBC_BXAP_SOR_DELAYED | \
  104. EBC_BXAP_BEM_WRITEONLY | \
  105. EBC_BXAP_PEN_DISABLED
  106. #define EBC_BXCR_LARGE_FLASH_CS0 EBC_BXCR_BAS_ENCODE(0xFF000000) | \
  107. EBC_BXCR_BS_16MB | \
  108. EBC_BXCR_BU_RW | \
  109. EBC_BXCR_BW_16BIT
  110. #define EBC_BXCR_LARGE_FLASH_CS2 EBC_BXCR_BAS_ENCODE(0xE7000000) | \
  111. EBC_BXCR_BS_16MB | \
  112. EBC_BXCR_BU_RW | \
  113. EBC_BXCR_BW_16BIT
  114. /*
  115. * FPGA
  116. * BU value :
  117. * B1AP = 0x05895240 - 0 00001011 0 00 10 01 01 01 001 0 0 1 0 00000
  118. * B1CR = 0xe201a000 - BAS = e20 - 000 11 01 00000000000000
  119. */
  120. #define EBC_BXAP_FPGA EBC_BXAP_BME_DISABLED | \
  121. EBC_BXAP_TWT_ENCODE(11) | \
  122. EBC_BXAP_BCE_DISABLE | \
  123. EBC_BXAP_BCT_2TRANS | \
  124. EBC_BXAP_CSN_ENCODE(10) | \
  125. EBC_BXAP_OEN_ENCODE(1) | \
  126. EBC_BXAP_WBN_ENCODE(1) | \
  127. EBC_BXAP_WBF_ENCODE(1) | \
  128. EBC_BXAP_TH_ENCODE(1) | \
  129. EBC_BXAP_RE_DISABLED | \
  130. EBC_BXAP_SOR_DELAYED | \
  131. EBC_BXAP_BEM_RW | \
  132. EBC_BXAP_PEN_DISABLED
  133. #define EBC_BXCR_FPGA_CS1 EBC_BXCR_BAS_ENCODE(0xe2000000) | \
  134. EBC_BXCR_BS_1MB | \
  135. EBC_BXCR_BU_RW | \
  136. EBC_BXCR_BW_16BIT
  137. unsigned long mfr;
  138. /*
  139. * Define Variables for EBC initialization depending on BOOTSTRAP option
  140. */
  141. unsigned long sdr0_pinstp, sdr0_sdstp1 ;
  142. unsigned long bootstrap_settings, ebc_data_width, boot_selection;
  143. int computed_boot_device = BOOT_DEVICE_UNKNOWN;
  144. /*-------------------------------------------------------------------+
  145. | Initialize EBC CONFIG -
  146. | Keep the Default value, but the bit PDT which has to be set to 1 ?TBC
  147. | default value :
  148. | 0x07C00000 - 0 0 000 1 1 1 1 1 0000 0 00000 000000000000
  149. |
  150. +-------------------------------------------------------------------*/
  151. mtebc(xbcfg, EBC_CFG_LE_UNLOCK |
  152. EBC_CFG_PTD_ENABLE |
  153. EBC_CFG_RTC_16PERCLK |
  154. EBC_CFG_ATC_PREVIOUS |
  155. EBC_CFG_DTC_PREVIOUS |
  156. EBC_CFG_CTC_PREVIOUS |
  157. EBC_CFG_OEO_PREVIOUS |
  158. EBC_CFG_EMC_DEFAULT |
  159. EBC_CFG_PME_DISABLE |
  160. EBC_CFG_PR_16);
  161. /*-------------------------------------------------------------------+
  162. |
  163. | PART 1 : Initialize EBC Bank 1
  164. | ==============================
  165. | Bank1 is always associated to the EPLD.
  166. | It has to be initialized prior to other banks settings computation
  167. | since some board registers values may be needed to determine the
  168. | boot type
  169. |
  170. +-------------------------------------------------------------------*/
  171. mtebc(pb1ap, EBC_BXAP_FPGA);
  172. mtebc(pb1cr, EBC_BXCR_FPGA_CS1);
  173. /*-------------------------------------------------------------------+
  174. |
  175. | PART 2 : Determine which boot device was selected
  176. | =================================================
  177. |
  178. | Read Pin Strap Register in PPC440SPe
  179. | Result can either be :
  180. | - Boot strap = boot from EBC 8bits => Small Flash
  181. | - Boot strap = boot from PCI
  182. | - Boot strap = IIC
  183. | In case of boot from IIC, read Serial Device Strap Register1
  184. |
  185. | Result can either be :
  186. | - Boot from EBC - EBC Bus Width = 8bits => Small Flash
  187. | - Boot from EBC - EBC Bus Width = 16bits => Large Flash or SRAM
  188. | - Boot from PCI
  189. |
  190. +-------------------------------------------------------------------*/
  191. /* Read Pin Strap Register in PPC440SP */
  192. mfsdr(SDR0_PINSTP, sdr0_pinstp);
  193. bootstrap_settings = sdr0_pinstp & SDR0_PINSTP_BOOTSTRAP_MASK;
  194. switch (bootstrap_settings) {
  195. case SDR0_PINSTP_BOOTSTRAP_SETTINGS0:
  196. /*
  197. * Strapping Option A
  198. * Boot from EBC - 8 bits , Small Flash
  199. */
  200. computed_boot_device = BOOT_FROM_SMALL_FLASH;
  201. break;
  202. case SDR0_PINSTP_BOOTSTRAP_SETTINGS1:
  203. /*
  204. * Strappping Option B
  205. * Boot from PCI
  206. */
  207. computed_boot_device = BOOT_FROM_PCI;
  208. break;
  209. case SDR0_PINSTP_BOOTSTRAP_IIC_50_EN:
  210. case SDR0_PINSTP_BOOTSTRAP_IIC_54_EN:
  211. /*
  212. * Strapping Option C or D
  213. * Boot Settings in IIC EEprom address 0x50 or 0x54
  214. * Read Serial Device Strap Register1 in PPC440SPe
  215. */
  216. mfsdr(SDR0_SDSTP1, sdr0_sdstp1);
  217. boot_selection = sdr0_sdstp1 & SDR0_SDSTP1_ERPN_MASK;
  218. ebc_data_width = sdr0_sdstp1 & SDR0_SDSTP1_EBCW_MASK;
  219. switch (boot_selection) {
  220. case SDR0_SDSTP1_ERPN_EBC:
  221. switch (ebc_data_width) {
  222. case SDR0_SDSTP1_EBCW_16_BITS:
  223. computed_boot_device =
  224. BOOT_FROM_LARGE_FLASH_OR_SRAM;
  225. break;
  226. case SDR0_SDSTP1_EBCW_8_BITS :
  227. computed_boot_device = BOOT_FROM_SMALL_FLASH;
  228. break;
  229. }
  230. break;
  231. case SDR0_SDSTP1_ERPN_PCI:
  232. computed_boot_device = BOOT_FROM_PCI;
  233. break;
  234. default:
  235. /* should not occure */
  236. computed_boot_device = BOOT_DEVICE_UNKNOWN;
  237. }
  238. break;
  239. default:
  240. /* should not be */
  241. computed_boot_device = BOOT_DEVICE_UNKNOWN;
  242. break;
  243. }
  244. /*-------------------------------------------------------------------+
  245. |
  246. | PART 3 : Compute EBC settings depending on selected boot device
  247. | ====== ======================================================
  248. |
  249. | Resulting EBC init will be among following configurations :
  250. |
  251. | - Boot from EBC 8bits => boot from Small Flash selected
  252. | EBC-CS0 = Small Flash
  253. | EBC-CS2 = Large Flash and SRAM
  254. |
  255. | - Boot from EBC 16bits => boot from Large Flash or SRAM
  256. | EBC-CS0 = Large Flash or SRAM
  257. | EBC-CS2 = Small Flash
  258. |
  259. | - Boot from PCI
  260. | EBC-CS0 = not initialized to avoid address contention
  261. | EBC-CS2 = same as boot from Small Flash selected
  262. |
  263. +-------------------------------------------------------------------*/
  264. unsigned long ebc0_cs0_bxap_value = 0, ebc0_cs0_bxcr_value = 0;
  265. unsigned long ebc0_cs2_bxap_value = 0, ebc0_cs2_bxcr_value = 0;
  266. switch (computed_boot_device) {
  267. /*-------------------------------------------------------------------*/
  268. case BOOT_FROM_PCI:
  269. /*-------------------------------------------------------------------*/
  270. /*
  271. * By Default CS2 is affected to LARGE Flash
  272. * do not initialize SMALL FLASH to avoid address contention
  273. * Large Flash
  274. */
  275. ebc0_cs2_bxap_value = EBC_BXAP_LARGE_FLASH;
  276. ebc0_cs2_bxcr_value = EBC_BXCR_LARGE_FLASH_CS2;
  277. break;
  278. /*-------------------------------------------------------------------*/
  279. case BOOT_FROM_SMALL_FLASH:
  280. /*-------------------------------------------------------------------*/
  281. ebc0_cs0_bxap_value = EBC_BXAP_SMALL_FLASH;
  282. ebc0_cs0_bxcr_value = EBC_BXCR_SMALL_FLASH_CS0;
  283. /*
  284. * Large Flash or SRAM
  285. */
  286. /* ebc0_cs2_bxap_value = EBC_BXAP_LARGE_FLASH; */
  287. ebc0_cs2_bxap_value = 0x048ff240;
  288. ebc0_cs2_bxcr_value = EBC_BXCR_LARGE_FLASH_CS2;
  289. break;
  290. /*-------------------------------------------------------------------*/
  291. case BOOT_FROM_LARGE_FLASH_OR_SRAM:
  292. /*-------------------------------------------------------------------*/
  293. ebc0_cs0_bxap_value = EBC_BXAP_LARGE_FLASH;
  294. ebc0_cs0_bxcr_value = EBC_BXCR_LARGE_FLASH_CS0;
  295. /* Small flash */
  296. ebc0_cs2_bxap_value = EBC_BXAP_SMALL_FLASH;
  297. ebc0_cs2_bxcr_value = EBC_BXCR_SMALL_FLASH_CS2;
  298. break;
  299. /*-------------------------------------------------------------------*/
  300. default:
  301. /*-------------------------------------------------------------------*/
  302. /* BOOT_DEVICE_UNKNOWN */
  303. break;
  304. }
  305. mtebc(pb0ap, ebc0_cs0_bxap_value);
  306. mtebc(pb0cr, ebc0_cs0_bxcr_value);
  307. mtebc(pb2ap, ebc0_cs2_bxap_value);
  308. mtebc(pb2cr, ebc0_cs2_bxcr_value);
  309. /*--------------------------------------------------------------------+
  310. | Interrupt controller setup for the AMCC 440SPe Evaluation board.
  311. +--------------------------------------------------------------------+
  312. +---------------------------------------------------------------------+
  313. |Interrupt| Source | Pol. | Sensi.| Crit. |
  314. +---------+-----------------------------------+-------+-------+-------+
  315. | IRQ 00 | UART0 | High | Level | Non |
  316. | IRQ 01 | UART1 | High | Level | Non |
  317. | IRQ 02 | IIC0 | High | Level | Non |
  318. | IRQ 03 | IIC1 | High | Level | Non |
  319. | IRQ 04 | PCI0X0 MSG IN | High | Level | Non |
  320. | IRQ 05 | PCI0X0 CMD Write | High | Level | Non |
  321. | IRQ 06 | PCI0X0 Power Mgt | High | Level | Non |
  322. | IRQ 07 | PCI0X0 VPD Access | Rising| Edge | Non |
  323. | IRQ 08 | PCI0X0 MSI level 0 | High | Lvl/ed| Non |
  324. | IRQ 09 | External IRQ 15 - (PCI-Express) | pgm H | Pgm | Non |
  325. | IRQ 10 | UIC2 Non-critical Int. | NA | NA | Non |
  326. | IRQ 11 | UIC2 Critical Interrupt | NA | NA | Crit |
  327. | IRQ 12 | PCI Express MSI Level 0 | Rising| Edge | Non |
  328. | IRQ 13 | PCI Express MSI Level 1 | Rising| Edge | Non |
  329. | IRQ 14 | PCI Express MSI Level 2 | Rising| Edge | Non |
  330. | IRQ 15 | PCI Express MSI Level 3 | Rising| Edge | Non |
  331. | IRQ 16 | UIC3 Non-critical Int. | NA | NA | Non |
  332. | IRQ 17 | UIC3 Critical Interrupt | NA | NA | Crit |
  333. | IRQ 18 | External IRQ 14 - (PCI-Express) | Pgm | Pgm | Non |
  334. | IRQ 19 | DMA Channel 0 FIFO Full | High | Level | Non |
  335. | IRQ 20 | DMA Channel 0 Stat FIFO | High | Level | Non |
  336. | IRQ 21 | DMA Channel 1 FIFO Full | High | Level | Non |
  337. | IRQ 22 | DMA Channel 1 Stat FIFO | High | Level | Non |
  338. | IRQ 23 | I2O Inbound Doorbell | High | Level | Non |
  339. | IRQ 24 | Inbound Post List FIFO Not Empt | High | Level | Non |
  340. | IRQ 25 | I2O Region 0 LL PLB Write | High | Level | Non |
  341. | IRQ 26 | I2O Region 1 LL PLB Write | High | Level | Non |
  342. | IRQ 27 | I2O Region 0 HB PLB Write | High | Level | Non |
  343. | IRQ 28 | I2O Region 1 HB PLB Write | High | Level | Non |
  344. | IRQ 29 | GPT Down Count Timer | Rising| Edge | Non |
  345. | IRQ 30 | UIC1 Non-critical Int. | NA | NA | Non |
  346. | IRQ 31 | UIC1 Critical Interrupt | NA | NA | Crit. |
  347. |----------------------------------------------------------------------
  348. | IRQ 32 | Ext. IRQ 13 - (PCI-Express) |pgm (H)|pgm/Lvl| Non |
  349. | IRQ 33 | MAL Serr | High | Level | Non |
  350. | IRQ 34 | MAL Txde | High | Level | Non |
  351. | IRQ 35 | MAL Rxde | High | Level | Non |
  352. | IRQ 36 | DMC CE or DMC UE | High | Level | Non |
  353. | IRQ 37 | EBC or UART2 | High |Lvl Edg| Non |
  354. | IRQ 38 | MAL TX EOB | High | Level | Non |
  355. | IRQ 39 | MAL RX EOB | High | Level | Non |
  356. | IRQ 40 | PCIX0 MSI Level 1 | High |Lvl Edg| Non |
  357. | IRQ 41 | PCIX0 MSI level 2 | High |Lvl Edg| Non |
  358. | IRQ 42 | PCIX0 MSI level 3 | High |Lvl Edg| Non |
  359. | IRQ 43 | L2 Cache | Risin | Edge | Non |
  360. | IRQ 44 | GPT Compare Timer 0 | Risin | Edge | Non |
  361. | IRQ 45 | GPT Compare Timer 1 | Risin | Edge | Non |
  362. | IRQ 46 | GPT Compare Timer 2 | Risin | Edge | Non |
  363. | IRQ 47 | GPT Compare Timer 3 | Risin | Edge | Non |
  364. | IRQ 48 | GPT Compare Timer 4 | Risin | Edge | Non |
  365. | IRQ 49 | Ext. IRQ 12 - PCI-X |pgm/Fal|pgm/Lvl| Non |
  366. | IRQ 50 | Ext. IRQ 11 - |pgm (H)|pgm/Lvl| Non |
  367. | IRQ 51 | Ext. IRQ 10 - |pgm (H)|pgm/Lvl| Non |
  368. | IRQ 52 | Ext. IRQ 9 |pgm (H)|pgm/Lvl| Non |
  369. | IRQ 53 | Ext. IRQ 8 |pgm (H)|pgm/Lvl| Non |
  370. | IRQ 54 | DMA Error | High | Level | Non |
  371. | IRQ 55 | DMA I2O Error | High | Level | Non |
  372. | IRQ 56 | Serial ROM | High | Level | Non |
  373. | IRQ 57 | PCIX0 Error | High | Edge | Non |
  374. | IRQ 58 | Ext. IRQ 7- |pgm (H)|pgm/Lvl| Non |
  375. | IRQ 59 | Ext. IRQ 6- |pgm (H)|pgm/Lvl| Non |
  376. | IRQ 60 | EMAC0 Interrupt | High | Level | Non |
  377. | IRQ 61 | EMAC0 Wake-up | High | Level | Non |
  378. | IRQ 62 | Reserved | High | Level | Non |
  379. | IRQ 63 | XOR | High | Level | Non |
  380. |----------------------------------------------------------------------
  381. | IRQ 64 | PE0 AL | High | Level | Non |
  382. | IRQ 65 | PE0 VPD Access | Risin | Edge | Non |
  383. | IRQ 66 | PE0 Hot Reset Request | Risin | Edge | Non |
  384. | IRQ 67 | PE0 Hot Reset Request | Falli | Edge | Non |
  385. | IRQ 68 | PE0 TCR | High | Level | Non |
  386. | IRQ 69 | PE0 BusMaster VCO | Falli | Edge | Non |
  387. | IRQ 70 | PE0 DCR Error | High | Level | Non |
  388. | IRQ 71 | Reserved | N/A | N/A | Non |
  389. | IRQ 72 | PE1 AL | High | Level | Non |
  390. | IRQ 73 | PE1 VPD Access | Risin | Edge | Non |
  391. | IRQ 74 | PE1 Hot Reset Request | Risin | Edge | Non |
  392. | IRQ 75 | PE1 Hot Reset Request | Falli | Edge | Non |
  393. | IRQ 76 | PE1 TCR | High | Level | Non |
  394. | IRQ 77 | PE1 BusMaster VCO | Falli | Edge | Non |
  395. | IRQ 78 | PE1 DCR Error | High | Level | Non |
  396. | IRQ 79 | Reserved | N/A | N/A | Non |
  397. | IRQ 80 | PE2 AL | High | Level | Non |
  398. | IRQ 81 | PE2 VPD Access | Risin | Edge | Non |
  399. | IRQ 82 | PE2 Hot Reset Request | Risin | Edge | Non |
  400. | IRQ 83 | PE2 Hot Reset Request | Falli | Edge | Non |
  401. | IRQ 84 | PE2 TCR | High | Level | Non |
  402. | IRQ 85 | PE2 BusMaster VCO | Falli | Edge | Non |
  403. | IRQ 86 | PE2 DCR Error | High | Level | Non |
  404. | IRQ 87 | Reserved | N/A | N/A | Non |
  405. | IRQ 88 | External IRQ(5) | Progr | Progr | Non |
  406. | IRQ 89 | External IRQ 4 - Ethernet | Progr | Progr | Non |
  407. | IRQ 90 | External IRQ 3 - PCI-X | Progr | Progr | Non |
  408. | IRQ 91 | External IRQ 2 - PCI-X | Progr | Progr | Non |
  409. | IRQ 92 | External IRQ 1 - PCI-X | Progr | Progr | Non |
  410. | IRQ 93 | External IRQ 0 - PCI-X | Progr | Progr | Non |
  411. | IRQ 94 | Reserved | N/A | N/A | Non |
  412. | IRQ 95 | Reserved | N/A | N/A | Non |
  413. |---------------------------------------------------------------------
  414. | IRQ 96 | PE0 INTA | High | Level | Non |
  415. | IRQ 97 | PE0 INTB | High | Level | Non |
  416. | IRQ 98 | PE0 INTC | High | Level | Non |
  417. | IRQ 99 | PE0 INTD | High | Level | Non |
  418. | IRQ 100 | PE1 INTA | High | Level | Non |
  419. | IRQ 101 | PE1 INTB | High | Level | Non |
  420. | IRQ 102 | PE1 INTC | High | Level | Non |
  421. | IRQ 103 | PE1 INTD | High | Level | Non |
  422. | IRQ 104 | PE2 INTA | High | Level | Non |
  423. | IRQ 105 | PE2 INTB | High | Level | Non |
  424. | IRQ 106 | PE2 INTC | High | Level | Non |
  425. | IRQ 107 | PE2 INTD | Risin | Edge | Non |
  426. | IRQ 108 | PCI Express MSI Level 4 | Risin | Edge | Non |
  427. | IRQ 109 | PCI Express MSI Level 5 | Risin | Edge | Non |
  428. | IRQ 110 | PCI Express MSI Level 6 | Risin | Edge | Non |
  429. | IRQ 111 | PCI Express MSI Level 7 | Risin | Edge | Non |
  430. | IRQ 116 | PCI Express MSI Level 12 | Risin | Edge | Non |
  431. | IRQ 112 | PCI Express MSI Level 8 | Risin | Edge | Non |
  432. | IRQ 113 | PCI Express MSI Level 9 | Risin | Edge | Non |
  433. | IRQ 114 | PCI Express MSI Level 10 | Risin | Edge | Non |
  434. | IRQ 115 | PCI Express MSI Level 11 | Risin | Edge | Non |
  435. | IRQ 117 | PCI Express MSI Level 13 | Risin | Edge | Non |
  436. | IRQ 118 | PCI Express MSI Level 14 | Risin | Edge | Non |
  437. | IRQ 119 | PCI Express MSI Level 15 | Risin | Edge | Non |
  438. | IRQ 120 | PCI Express MSI Level 16 | Risin | Edge | Non |
  439. | IRQ 121 | PCI Express MSI Level 17 | Risin | Edge | Non |
  440. | IRQ 122 | PCI Express MSI Level 18 | Risin | Edge | Non |
  441. | IRQ 123 | PCI Express MSI Level 19 | Risin | Edge | Non |
  442. | IRQ 124 | PCI Express MSI Level 20 | Risin | Edge | Non |
  443. | IRQ 125 | PCI Express MSI Level 21 | Risin | Edge | Non |
  444. | IRQ 126 | PCI Express MSI Level 22 | Risin | Edge | Non |
  445. | IRQ 127 | PCI Express MSI Level 23 | Risin | Edge | Non |
  446. +---------+-----------------------------------+-------+-------+------*/
  447. /*--------------------------------------------------------------------+
  448. | Put UICs in PowerPC440SPemode.
  449. | Initialise UIC registers. Clear all interrupts. Disable all
  450. | interrupts.
  451. | Set critical interrupt values. Set interrupt polarities. Set
  452. | interrupt trigger levels. Make bit 0 High priority. Clear all
  453. | interrupts again.
  454. +-------------------------------------------------------------------*/
  455. mtdcr (uic3sr, 0xffffffff); /* Clear all interrupts */
  456. mtdcr (uic3er, 0x00000000); /* disable all interrupts */
  457. mtdcr (uic3cr, 0x00000000); /* Set Critical / Non Critical
  458. * interrupts */
  459. mtdcr (uic3pr, 0xffffffff); /* Set Interrupt Polarities */
  460. mtdcr (uic3tr, 0x001fffff); /* Set Interrupt Trigger Levels */
  461. mtdcr (uic3vr, 0x00000001); /* Set Vect base=0,INT31 Highest
  462. * priority */
  463. mtdcr (uic3sr, 0x00000000); /* clear all interrupts */
  464. mtdcr (uic3sr, 0xffffffff); /* clear all interrupts */
  465. mtdcr (uic2sr, 0xffffffff); /* Clear all interrupts */
  466. mtdcr (uic2er, 0x00000000); /* disable all interrupts */
  467. mtdcr (uic2cr, 0x00000000); /* Set Critical / Non Critical
  468. * interrupts */
  469. mtdcr (uic2pr, 0xebebebff); /* Set Interrupt Polarities */
  470. mtdcr (uic2tr, 0x74747400); /* Set Interrupt Trigger Levels */
  471. mtdcr (uic2vr, 0x00000001); /* Set Vect base=0,INT31 Highest
  472. * priority */
  473. mtdcr (uic2sr, 0x00000000); /* clear all interrupts */
  474. mtdcr (uic2sr, 0xffffffff); /* clear all interrupts */
  475. mtdcr (uic1sr, 0xffffffff); /* Clear all interrupts */
  476. mtdcr (uic1er, 0x00000000); /* disable all interrupts */
  477. mtdcr (uic1cr, 0x00000000); /* Set Critical / Non Critical
  478. * interrupts */
  479. mtdcr (uic1pr, 0xffffffff); /* Set Interrupt Polarities */
  480. mtdcr (uic1tr, 0x001f8040); /* Set Interrupt Trigger Levels */
  481. mtdcr (uic1vr, 0x00000001); /* Set Vect base=0,INT31 Highest
  482. * priority */
  483. mtdcr (uic1sr, 0x00000000); /* clear all interrupts */
  484. mtdcr (uic1sr, 0xffffffff); /* clear all interrupts */
  485. mtdcr (uic0sr, 0xffffffff); /* Clear all interrupts */
  486. mtdcr (uic0er, 0x00000000); /* disable all interrupts excepted
  487. * cascade to be checked */
  488. mtdcr (uic0cr, 0x00104001); /* Set Critical / Non Critical
  489. * interrupts */
  490. mtdcr (uic0pr, 0xffffffff); /* Set Interrupt Polarities */
  491. mtdcr (uic0tr, 0x010f0004); /* Set Interrupt Trigger Levels */
  492. mtdcr (uic0vr, 0x00000001); /* Set Vect base=0,INT31 Highest
  493. * priority */
  494. mtdcr (uic0sr, 0x00000000); /* clear all interrupts */
  495. mtdcr (uic0sr, 0xffffffff); /* clear all interrupts */
  496. /* SDR0_MFR should be part of Ethernet init */
  497. mfsdr (sdr_mfr, mfr);
  498. mfr &= ~SDR0_MFR_ECS_MASK;
  499. /*mtsdr(sdr_mfr, mfr);*/
  500. fpga_init();
  501. return 0;
  502. }
  503. int checkboard (void)
  504. {
  505. char *s = getenv("serial#");
  506. printf("Board: Yucca - AMCC 440SPe Evaluation Board");
  507. if (s != NULL) {
  508. puts(", serial# ");
  509. puts(s);
  510. }
  511. putc('\n');
  512. return 0;
  513. }
  514. /*
  515. * Override the default functions in cpu/ppc4xx/44x_spd_ddr2.c with
  516. * board specific values.
  517. */
  518. static int ppc440spe_rev_a(void)
  519. {
  520. if ((get_pvr() == PVR_440SPe_6_RA) || (get_pvr() == PVR_440SPe_RA))
  521. return 1;
  522. else
  523. return 0;
  524. }
  525. u32 ddr_wrdtr(u32 default_val) {
  526. /*
  527. * Yucca boards with 440SPe rev. A need a slightly different setup
  528. * for the MCIF0_WRDTR register.
  529. */
  530. if (ppc440spe_rev_a())
  531. return (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_270_DEG_ADV);
  532. return default_val;
  533. }
  534. u32 ddr_clktr(u32 default_val) {
  535. /*
  536. * Yucca boards with 440SPe rev. A need a slightly different setup
  537. * for the MCIF0_CLKTR register.
  538. */
  539. if (ppc440spe_rev_a())
  540. return (SDRAM_CLKTR_CLKP_180_DEG_ADV);
  541. return default_val;
  542. }
  543. #if defined(CFG_DRAM_TEST)
  544. int testdram (void)
  545. {
  546. uint *pstart = (uint *) 0x00000000;
  547. uint *pend = (uint *) 0x08000000;
  548. uint *p;
  549. for (p = pstart; p < pend; p++)
  550. *p = 0xaaaaaaaa;
  551. for (p = pstart; p < pend; p++) {
  552. if (*p != 0xaaaaaaaa) {
  553. printf ("SDRAM test fails at: %08x\n", (uint) p);
  554. return 1;
  555. }
  556. }
  557. for (p = pstart; p < pend; p++)
  558. *p = 0x55555555;
  559. for (p = pstart; p < pend; p++) {
  560. if (*p != 0x55555555) {
  561. printf ("SDRAM test fails at: %08x\n", (uint) p);
  562. return 1;
  563. }
  564. }
  565. return 0;
  566. }
  567. #endif
  568. /*************************************************************************
  569. * pci_pre_init
  570. *
  571. * This routine is called just prior to registering the hose and gives
  572. * the board the opportunity to check things. Returning a value of zero
  573. * indicates that things are bad & PCI initialization should be aborted.
  574. *
  575. * Different boards may wish to customize the pci controller structure
  576. * (add regions, override default access routines, etc) or perform
  577. * certain pre-initialization actions.
  578. *
  579. ************************************************************************/
  580. #if defined(CONFIG_PCI)
  581. int pci_pre_init(struct pci_controller * hose )
  582. {
  583. unsigned long strap;
  584. /*-------------------------------------------------------------------+
  585. * The yucca board is always configured as the host & requires the
  586. * PCI arbiter to be enabled.
  587. *-------------------------------------------------------------------*/
  588. mfsdr(sdr_sdstp1, strap);
  589. if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ) {
  590. printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
  591. return 0;
  592. }
  593. return 1;
  594. }
  595. #endif /* defined(CONFIG_PCI) */
  596. /*************************************************************************
  597. * pci_target_init
  598. *
  599. * The bootstrap configuration provides default settings for the pci
  600. * inbound map (PIM). But the bootstrap config choices are limited and
  601. * may not be sufficient for a given board.
  602. *
  603. ************************************************************************/
  604. #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
  605. void pci_target_init(struct pci_controller * hose )
  606. {
  607. /*-------------------------------------------------------------------+
  608. * Disable everything
  609. *-------------------------------------------------------------------*/
  610. out32r( PCIX0_PIM0SA, 0 ); /* disable */
  611. out32r( PCIX0_PIM1SA, 0 ); /* disable */
  612. out32r( PCIX0_PIM2SA, 0 ); /* disable */
  613. out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
  614. /*-------------------------------------------------------------------+
  615. * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440
  616. * strapping options to not support sizes such as 128/256 MB.
  617. *-------------------------------------------------------------------*/
  618. out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
  619. out32r( PCIX0_PIM0LAH, 0 );
  620. out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
  621. out32r( PCIX0_BAR0, 0 );
  622. /*-------------------------------------------------------------------+
  623. * Program the board's subsystem id/vendor id
  624. *-------------------------------------------------------------------*/
  625. out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
  626. out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
  627. out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
  628. }
  629. #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
  630. #if defined(CONFIG_PCI)
  631. /*************************************************************************
  632. * is_pci_host
  633. *
  634. * This routine is called to determine if a pci scan should be
  635. * performed. With various hardware environments (especially cPCI and
  636. * PPMC) it's insufficient to depend on the state of the arbiter enable
  637. * bit in the strap register, or generic host/adapter assumptions.
  638. *
  639. * Rather than hard-code a bad assumption in the general 440 code, the
  640. * 440 pci code requires the board to decide at runtime.
  641. *
  642. * Return 0 for adapter mode, non-zero for host (monarch) mode.
  643. *
  644. *
  645. ************************************************************************/
  646. int is_pci_host(struct pci_controller *hose)
  647. {
  648. /* The yucca board is always configured as host. */
  649. return 1;
  650. }
  651. int yucca_pcie_card_present(int port)
  652. {
  653. u16 reg;
  654. reg = in_be16((u16 *)FPGA_REG1C);
  655. switch(port) {
  656. case 0:
  657. return !(reg & FPGA_REG1C_PE0_PRSNT);
  658. case 1:
  659. return !(reg & FPGA_REG1C_PE1_PRSNT);
  660. case 2:
  661. return !(reg & FPGA_REG1C_PE2_PRSNT);
  662. default:
  663. return 0;
  664. }
  665. }
  666. /*
  667. * For the given slot, set rootpoint mode, send power to the slot,
  668. * turn on the green LED and turn off the yellow LED, enable the clock
  669. * and turn off reset.
  670. */
  671. void yucca_setup_pcie_fpga_rootpoint(int port)
  672. {
  673. u16 power, clock, green_led, yellow_led, reset_off, rootpoint, endpoint;
  674. switch(port) {
  675. case 0:
  676. rootpoint = FPGA_REG1C_PE0_ROOTPOINT;
  677. endpoint = 0;
  678. power = FPGA_REG1A_PE0_PWRON;
  679. green_led = FPGA_REG1A_PE0_GLED;
  680. clock = FPGA_REG1A_PE0_REFCLK_ENABLE;
  681. yellow_led = FPGA_REG1A_PE0_YLED;
  682. reset_off = FPGA_REG1C_PE0_PERST;
  683. break;
  684. case 1:
  685. rootpoint = 0;
  686. endpoint = FPGA_REG1C_PE1_ENDPOINT;
  687. power = FPGA_REG1A_PE1_PWRON;
  688. green_led = FPGA_REG1A_PE1_GLED;
  689. clock = FPGA_REG1A_PE1_REFCLK_ENABLE;
  690. yellow_led = FPGA_REG1A_PE1_YLED;
  691. reset_off = FPGA_REG1C_PE1_PERST;
  692. break;
  693. case 2:
  694. rootpoint = 0;
  695. endpoint = FPGA_REG1C_PE2_ENDPOINT;
  696. power = FPGA_REG1A_PE2_PWRON;
  697. green_led = FPGA_REG1A_PE2_GLED;
  698. clock = FPGA_REG1A_PE2_REFCLK_ENABLE;
  699. yellow_led = FPGA_REG1A_PE2_YLED;
  700. reset_off = FPGA_REG1C_PE2_PERST;
  701. break;
  702. default:
  703. return;
  704. }
  705. out_be16((u16 *)FPGA_REG1A,
  706. ~(power | clock | green_led) &
  707. (yellow_led | in_be16((u16 *)FPGA_REG1A)));
  708. out_be16((u16 *)FPGA_REG1C,
  709. ~(endpoint | reset_off) &
  710. (rootpoint | in_be16((u16 *)FPGA_REG1C)));
  711. /*
  712. * Leave device in reset for a while after powering on the
  713. * slot to give it a chance to initialize.
  714. */
  715. udelay(250 * 1000);
  716. out_be16((u16 *)FPGA_REG1C, reset_off | in_be16((u16 *)FPGA_REG1C));
  717. }
  718. /*
  719. * For the given slot, set endpoint mode, send power to the slot,
  720. * turn on the green LED and turn off the yellow LED, enable the clock
  721. * .In end point mode reset bit is read only.
  722. */
  723. void yucca_setup_pcie_fpga_endpoint(int port)
  724. {
  725. u16 power, clock, green_led, yellow_led, reset_off, rootpoint, endpoint;
  726. switch(port) {
  727. case 0:
  728. rootpoint = FPGA_REG1C_PE0_ROOTPOINT;
  729. endpoint = 0;
  730. power = FPGA_REG1A_PE0_PWRON;
  731. green_led = FPGA_REG1A_PE0_GLED;
  732. clock = FPGA_REG1A_PE0_REFCLK_ENABLE;
  733. yellow_led = FPGA_REG1A_PE0_YLED;
  734. reset_off = FPGA_REG1C_PE0_PERST;
  735. break;
  736. case 1:
  737. rootpoint = 0;
  738. endpoint = FPGA_REG1C_PE1_ENDPOINT;
  739. power = FPGA_REG1A_PE1_PWRON;
  740. green_led = FPGA_REG1A_PE1_GLED;
  741. clock = FPGA_REG1A_PE1_REFCLK_ENABLE;
  742. yellow_led = FPGA_REG1A_PE1_YLED;
  743. reset_off = FPGA_REG1C_PE1_PERST;
  744. break;
  745. case 2:
  746. rootpoint = 0;
  747. endpoint = FPGA_REG1C_PE2_ENDPOINT;
  748. power = FPGA_REG1A_PE2_PWRON;
  749. green_led = FPGA_REG1A_PE2_GLED;
  750. clock = FPGA_REG1A_PE2_REFCLK_ENABLE;
  751. yellow_led = FPGA_REG1A_PE2_YLED;
  752. reset_off = FPGA_REG1C_PE2_PERST;
  753. break;
  754. default:
  755. return;
  756. }
  757. out_be16((u16 *)FPGA_REG1A,
  758. ~(power | clock | green_led) &
  759. (yellow_led | in_be16((u16 *)FPGA_REG1A)));
  760. out_be16((u16 *)FPGA_REG1C,
  761. ~(rootpoint | reset_off) &
  762. (endpoint | in_be16((u16 *)FPGA_REG1C)));
  763. }
  764. static struct pci_controller pcie_hose[3] = {{0},{0},{0}};
  765. void pcie_setup_hoses(int busno)
  766. {
  767. struct pci_controller *hose;
  768. int i, bus;
  769. int ret = 0;
  770. char *env;
  771. unsigned int delay;
  772. /*
  773. * assume we're called after the PCIX hose is initialized, which takes
  774. * bus ID 0 and therefore start numbering PCIe's from 1.
  775. */
  776. bus = busno;
  777. for (i = 0; i <= 2; i++) {
  778. /* Check for yucca card presence */
  779. if (!yucca_pcie_card_present(i))
  780. continue;
  781. if (is_end_point(i)) {
  782. printf("PCIE%d: will be configured as endpoint\n",i);
  783. yucca_setup_pcie_fpga_endpoint(i);
  784. ret = ppc4xx_init_pcie_endport(i);
  785. } else {
  786. printf("PCIE%d: will be configured as root-complex\n",i);
  787. yucca_setup_pcie_fpga_rootpoint(i);
  788. ret = ppc4xx_init_pcie_rootport(i);
  789. }
  790. if (ret) {
  791. printf("PCIE%d: initialization failed\n", i);
  792. continue;
  793. }
  794. hose = &pcie_hose[i];
  795. hose->first_busno = bus;
  796. hose->last_busno = bus;
  797. hose->current_busno = bus;
  798. /* setup mem resource */
  799. pci_set_region(hose->regions + 0,
  800. CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE,
  801. CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE,
  802. CFG_PCIE_MEMSIZE,
  803. PCI_REGION_MEM);
  804. hose->region_count = 1;
  805. pci_register_hose(hose);
  806. if (is_end_point(i)) {
  807. ppc4xx_setup_pcie_endpoint(hose, i);
  808. /*
  809. * Reson for no scanning is endpoint can not generate
  810. * upstream configuration accesses.
  811. */
  812. } else {
  813. ppc4xx_setup_pcie_rootpoint(hose, i);
  814. env = getenv("pciscandelay");
  815. if (env != NULL) {
  816. delay = simple_strtoul(env, NULL, 10);
  817. if (delay > 5)
  818. printf("Warning, expect noticable delay before "
  819. "PCIe scan due to 'pciscandelay' value!\n");
  820. mdelay(delay * 1000);
  821. }
  822. /*
  823. * Config access can only go down stream
  824. */
  825. hose->last_busno = pci_hose_scan(hose);
  826. bus = hose->last_busno + 1;
  827. }
  828. }
  829. }
  830. #endif /* defined(CONFIG_PCI) */
  831. int misc_init_f (void)
  832. {
  833. uint reg;
  834. #if defined(CONFIG_STRESS)
  835. uint i ;
  836. uint disp;
  837. #endif
  838. out16(FPGA_REG10, (in16(FPGA_REG10) &
  839. ~(FPGA_REG10_AUTO_NEG_DIS|FPGA_REG10_RESET_ETH)) |
  840. FPGA_REG10_10MHZ_ENABLE |
  841. FPGA_REG10_100MHZ_ENABLE |
  842. FPGA_REG10_GIGABIT_ENABLE |
  843. FPGA_REG10_FULL_DUPLEX );
  844. udelay(10000); /* wait 10ms */
  845. out16(FPGA_REG10, (in16(FPGA_REG10) | FPGA_REG10_RESET_ETH));
  846. /* minimal init for PCIe */
  847. /* pci express 0 Endpoint Mode */
  848. mfsdr(SDR0_PE0DLPSET, reg);
  849. reg &= (~0x00400000);
  850. mtsdr(SDR0_PE0DLPSET, reg);
  851. /* pci express 1 Rootpoint Mode */
  852. mfsdr(SDR0_PE1DLPSET, reg);
  853. reg |= 0x00400000;
  854. mtsdr(SDR0_PE1DLPSET, reg);
  855. /* pci express 2 Rootpoint Mode */
  856. mfsdr(SDR0_PE2DLPSET, reg);
  857. reg |= 0x00400000;
  858. mtsdr(SDR0_PE2DLPSET, reg);
  859. out16(FPGA_REG1C,(in16 (FPGA_REG1C) &
  860. ~FPGA_REG1C_PE0_ROOTPOINT &
  861. ~FPGA_REG1C_PE1_ENDPOINT &
  862. ~FPGA_REG1C_PE2_ENDPOINT));
  863. #if defined(CONFIG_STRESS)
  864. /*
  865. * all this setting done by linux only needed by stress an charac. test
  866. * procedure
  867. * PCIe 1 Rootpoint PCIe2 Endpoint
  868. * PCIe 0 FIR Pre-emphasis Filter Coefficients & Transmit Driver
  869. * Power Level
  870. */
  871. for (i = 0, disp = 0; i < 8; i++, disp += 3) {
  872. mfsdr(SDR0_PE0HSSSET1L0 + disp, reg);
  873. reg |= 0x33000000;
  874. mtsdr(SDR0_PE0HSSSET1L0 + disp, reg);
  875. }
  876. /*
  877. * PCIe 1 FIR Pre-emphasis Filter Coefficients & Transmit Driver
  878. * Power Level
  879. */
  880. for (i = 0, disp = 0; i < 4; i++, disp += 3) {
  881. mfsdr(SDR0_PE1HSSSET1L0 + disp, reg);
  882. reg |= 0x33000000;
  883. mtsdr(SDR0_PE1HSSSET1L0 + disp, reg);
  884. }
  885. /*
  886. * PCIE 2 FIR Pre-emphasis Filter Coefficients & Transmit Driver
  887. * Power Level
  888. */
  889. for (i = 0, disp = 0; i < 4; i++, disp += 3) {
  890. mfsdr(SDR0_PE2HSSSET1L0 + disp, reg);
  891. reg |= 0x33000000;
  892. mtsdr(SDR0_PE2HSSSET1L0 + disp, reg);
  893. }
  894. reg = 0x21242222;
  895. mtsdr(SDR0_PE2UTLSET1, reg);
  896. reg = 0x11000000;
  897. mtsdr(SDR0_PE2UTLSET2, reg);
  898. /* pci express 1 Endpoint Mode */
  899. reg = 0x00004000;
  900. mtsdr(SDR0_PE2DLPSET, reg);
  901. mtsdr(SDR0_UART1, 0x2080005a); /* patch for TG */
  902. #endif
  903. return 0;
  904. }
  905. void fpga_init(void)
  906. {
  907. /*
  908. * by default sdram access is disabled by fpga
  909. */
  910. out16(FPGA_REG10, (in16 (FPGA_REG10) |
  911. FPGA_REG10_SDRAM_ENABLE |
  912. FPGA_REG10_ENABLE_DISPLAY ));
  913. return;
  914. }
  915. #ifdef CONFIG_POST
  916. /*
  917. * Returns 1 if keys pressed to start the power-on long-running tests
  918. * Called from board_init_f().
  919. */
  920. int post_hotkeys_pressed(void)
  921. {
  922. return (ctrlc());
  923. }
  924. #endif
  925. /*---------------------------------------------------------------------------+
  926. | onboard_pci_arbiter_selected => from EPLD
  927. +---------------------------------------------------------------------------*/
  928. int onboard_pci_arbiter_selected(int core_pci)
  929. {
  930. #if 0
  931. unsigned long onboard_pci_arbiter_sel;
  932. onboard_pci_arbiter_sel = in16(FPGA_REG0) & FPGA_REG0_EXT_ARB_SEL_MASK;
  933. if (onboard_pci_arbiter_sel == FPGA_REG0_EXT_ARB_SEL_EXTERNAL)
  934. return (BOARD_OPTION_SELECTED);
  935. else
  936. #endif
  937. return (BOARD_OPTION_NOT_SELECTED);
  938. }