yucca.c 36 KB

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