yucca.c 35 KB

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