PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/u-boot-1.1.6/cpu/ppc4xx/405gp_pci.c

http://dingoo-linux.googlecode.com/
C | 574 lines | 333 code | 73 blank | 168 comment | 52 complexity | 2f2401acbb766bd78882b71da01ef100 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0, CC-BY-SA-3.0
  1. /*-----------------------------------------------------------------------------+
  2. *
  3. * This source code has been made available to you by IBM on an AS-IS
  4. * basis. Anyone receiving this source is licensed under IBM
  5. * copyrights to use it in any way he or she deems fit, including
  6. * copying it, modifying it, compiling it, and redistributing it either
  7. * with or without modifications. No license under IBM patents or
  8. * patent applications is to be implied by the copyright license.
  9. *
  10. * Any user of this software should understand that IBM cannot provide
  11. * technical support for this software and will not be responsible for
  12. * any consequences resulting from the use of this software.
  13. *
  14. * Any person who transfers this source code or any derivative work
  15. * must include the IBM copyright notice, this paragraph, and the
  16. * preceding two paragraphs in the transferred software.
  17. *
  18. * COPYRIGHT I B M CORPORATION 1995
  19. * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
  20. *-----------------------------------------------------------------------------*/
  21. /*----------------------------------------------------------------------------+
  22. *
  23. * File Name: 405gp_pci.c
  24. *
  25. * Function: Initialization code for the 405GP PCI Configuration regs.
  26. *
  27. * Author: Mark Game
  28. *
  29. * Change Activity-
  30. *
  31. * Date Description of Change BY
  32. * --------- --------------------- ---
  33. * 09-Sep-98 Created MCG
  34. * 02-Nov-98 Removed External arbiter selected message JWB
  35. * 27-Nov-98 Zero out PTMBAR2 and disable in PTM2MS JWB
  36. * 04-Jan-99 Zero out other unused PMM and PTM regs. Change bus scan MCG
  37. * from (0 to n) to (1 to n).
  38. * 17-May-99 Port to Walnut JWB
  39. * 17-Jun-99 Updated for VGA support JWB
  40. * 21-Jun-99 Updated to allow SRAM region to be a target from PCI bus JWB
  41. * 19-Jul-99 Updated for 405GP pass 1 errata #26 (Low PCI subsequent MCG
  42. * target latency timer values are not supported).
  43. * Should be fixed in pass 2.
  44. * 09-Sep-99 Removed use of PTM2 since the SRAM region no longer needs JWB
  45. * to be a PCI target. Zero out PTMBAR2 and disable in PTM2MS.
  46. * 10-Dec-99 Updated PCI_Write_CFG_Reg for pass2 errata #6 JWB
  47. * 11-Jan-00 Ensure PMMxMAs disabled before setting PMMxLAs. This is not
  48. * really required after a reset since PMMxMAs are already
  49. * disabled but is a good practice nonetheless. JWB
  50. * 12-Jun-01 stefan.roese@esd-electronics.com
  51. * - PCI host/adapter handling reworked
  52. * 09-Jul-01 stefan.roese@esd-electronics.com
  53. * - PCI host now configures from device 0 (not 1) to max_dev,
  54. * (host configures itself)
  55. * - On CPCI-405 pci base address and size is generated from
  56. * SDRAM and FLASH size (CFG regs not used anymore)
  57. * - Some minor changes for CPCI-405-A (adapter version)
  58. * 14-Sep-01 stefan.roese@esd-electronics.com
  59. * - CONFIG_PCI_SCAN_SHOW added to print pci devices upon startup
  60. * 28-Sep-01 stefan.roese@esd-electronics.com
  61. * - Changed pci master configuration for linux compatibility
  62. * (no need for bios_fixup() anymore)
  63. * 26-Feb-02 stefan.roese@esd-electronics.com
  64. * - Bug fixed in pci configuration (Andrew May)
  65. * - Removed pci class code init for CPCI405 board
  66. * 15-May-02 stefan.roese@esd-electronics.com
  67. * - New vga device handling
  68. * 29-May-02 stefan.roese@esd-electronics.com
  69. * - PCI class code init added (if defined)
  70. *----------------------------------------------------------------------------*/
  71. #include <common.h>
  72. #include <command.h>
  73. #if !defined(CONFIG_440)
  74. #include <405gp_pci.h>
  75. #endif
  76. #include <asm/processor.h>
  77. #include <pci.h>
  78. DECLARE_GLOBAL_DATA_PTR;
  79. #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
  80. #ifdef CONFIG_PCI
  81. #if defined(CONFIG_PMC405)
  82. ushort pmc405_pci_subsys_deviceid(void);
  83. #endif
  84. /*#define DEBUG*/
  85. /*-----------------------------------------------------------------------------+
  86. * pci_init. Initializes the 405GP PCI Configuration regs.
  87. *-----------------------------------------------------------------------------*/
  88. void pci_405gp_init(struct pci_controller *hose)
  89. {
  90. int i, reg_num = 0;
  91. bd_t *bd = gd->bd;
  92. unsigned short temp_short;
  93. unsigned long ptmpcila[2] = {CFG_PCI_PTM1PCI, CFG_PCI_PTM2PCI};
  94. #if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
  95. char *ptmla_str, *ptmms_str;
  96. #endif
  97. unsigned long ptmla[2] = {CFG_PCI_PTM1LA, CFG_PCI_PTM2LA};
  98. unsigned long ptmms[2] = {CFG_PCI_PTM1MS, CFG_PCI_PTM2MS};
  99. #if defined(CONFIG_PIP405) || defined (CONFIG_MIP405)
  100. unsigned long pmmla[3] = {0x80000000, 0xA0000000, 0};
  101. unsigned long pmmma[3] = {0xE0000001, 0xE0000001, 0};
  102. unsigned long pmmpcila[3] = {0x80000000, 0x00000000, 0};
  103. unsigned long pmmpciha[3] = {0x00000000, 0x00000000, 0};
  104. #else
  105. unsigned long pmmla[3] = {0x80000000, 0,0};
  106. unsigned long pmmma[3] = {0xC0000001, 0,0};
  107. unsigned long pmmpcila[3] = {0x80000000, 0,0};
  108. unsigned long pmmpciha[3] = {0x00000000, 0,0};
  109. #endif
  110. #ifdef CONFIG_PCI_PNP
  111. #if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
  112. char *s;
  113. #endif
  114. #endif
  115. #if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
  116. ptmla_str = getenv("ptm1la");
  117. ptmms_str = getenv("ptm1ms");
  118. if(NULL != ptmla_str && NULL != ptmms_str ) {
  119. ptmla[0] = simple_strtoul (ptmla_str, NULL, 16);
  120. ptmms[0] = simple_strtoul (ptmms_str, NULL, 16);
  121. }
  122. ptmla_str = getenv("ptm2la");
  123. ptmms_str = getenv("ptm2ms");
  124. if(NULL != ptmla_str && NULL != ptmms_str ) {
  125. ptmla[1] = simple_strtoul (ptmla_str, NULL, 16);
  126. ptmms[1] = simple_strtoul (ptmms_str, NULL, 16);
  127. }
  128. #endif
  129. /*
  130. * Register the hose
  131. */
  132. hose->first_busno = 0;
  133. hose->last_busno = 0xff;
  134. /* ISA/PCI I/O space */
  135. pci_set_region(hose->regions + reg_num++,
  136. MIN_PCI_PCI_IOADDR,
  137. MIN_PLB_PCI_IOADDR,
  138. 0x10000,
  139. PCI_REGION_IO);
  140. /* PCI I/O space */
  141. pci_set_region(hose->regions + reg_num++,
  142. 0x00800000,
  143. 0xe8800000,
  144. 0x03800000,
  145. PCI_REGION_IO);
  146. reg_num = 2;
  147. /* Memory spaces */
  148. for (i=0; i<2; i++)
  149. if (ptmms[i] & 1)
  150. {
  151. if (!i) hose->pci_fb = hose->regions + reg_num;
  152. pci_set_region(hose->regions + reg_num++,
  153. ptmpcila[i], ptmla[i],
  154. ~(ptmms[i] & 0xfffff000) + 1,
  155. PCI_REGION_MEM |
  156. PCI_REGION_MEMORY);
  157. }
  158. /* PCI memory spaces */
  159. for (i=0; i<3; i++)
  160. if (pmmma[i] & 1)
  161. {
  162. pci_set_region(hose->regions + reg_num++,
  163. pmmpcila[i], pmmla[i],
  164. ~(pmmma[i] & 0xfffff000) + 1,
  165. PCI_REGION_MEM);
  166. }
  167. hose->region_count = reg_num;
  168. pci_setup_indirect(hose,
  169. PCICFGADR,
  170. PCICFGDATA);
  171. if (hose->pci_fb)
  172. pciauto_region_init(hose->pci_fb);
  173. pci_register_hose(hose);
  174. /*--------------------------------------------------------------------------+
  175. * 405GP PCI Master configuration.
  176. * Map one 512 MB range of PLB/processor addresses to PCI memory space.
  177. * PLB address 0x80000000-0xBFFFFFFF ==> PCI address 0x80000000-0xBFFFFFFF
  178. * Use byte reversed out routines to handle endianess.
  179. *--------------------------------------------------------------------------*/
  180. out32r(PMM0MA, (pmmma[0]&~0x1)); /* disable, configure PMMxLA, PMMxPCILA first */
  181. out32r(PMM0LA, pmmla[0]);
  182. out32r(PMM0PCILA, pmmpcila[0]);
  183. out32r(PMM0PCIHA, pmmpciha[0]);
  184. out32r(PMM0MA, pmmma[0]);
  185. /*--------------------------------------------------------------------------+
  186. * PMM1 is not used. Initialize them to zero.
  187. *--------------------------------------------------------------------------*/
  188. out32r(PMM1MA, (pmmma[1]&~0x1));
  189. out32r(PMM1LA, pmmla[1]);
  190. out32r(PMM1PCILA, pmmpcila[1]);
  191. out32r(PMM1PCIHA, pmmpciha[1]);
  192. out32r(PMM1MA, pmmma[1]);
  193. /*--------------------------------------------------------------------------+
  194. * PMM2 is not used. Initialize them to zero.
  195. *--------------------------------------------------------------------------*/
  196. out32r(PMM2MA, (pmmma[2]&~0x1));
  197. out32r(PMM2LA, pmmla[2]);
  198. out32r(PMM2PCILA, pmmpcila[2]);
  199. out32r(PMM2PCIHA, pmmpciha[2]);
  200. out32r(PMM2MA, pmmma[2]);
  201. /*--------------------------------------------------------------------------+
  202. * 405GP PCI Target configuration. (PTM1)
  203. * Note: PTM1MS is hardwire enabled but we set the enable bit anyway.
  204. *--------------------------------------------------------------------------*/
  205. out32r(PTM1LA, ptmla[0]); /* insert address */
  206. out32r(PTM1MS, ptmms[0]); /* insert size, enable bit is 1 */
  207. pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_1, ptmpcila[0]);
  208. /*--------------------------------------------------------------------------+
  209. * 405GP PCI Target configuration. (PTM2)
  210. *--------------------------------------------------------------------------*/
  211. out32r(PTM2LA, ptmla[1]); /* insert address */
  212. pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, ptmpcila[1]);
  213. if (ptmms[1] == 0)
  214. {
  215. out32r(PTM2MS, 0x00000001); /* set enable bit */
  216. pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, 0x00000000);
  217. out32r(PTM2MS, 0x00000000); /* disable */
  218. }
  219. else
  220. {
  221. out32r(PTM2MS, ptmms[1]); /* insert size, enable bit is 1 */
  222. }
  223. /*
  224. * Insert Subsystem Vendor and Device ID
  225. */
  226. pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_VENDOR_ID, CFG_PCI_SUBSYS_VENDORID);
  227. #ifdef CONFIG_CPCI405
  228. if (mfdcr(strap) & PSR_PCI_ARBIT_EN)
  229. pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID);
  230. else
  231. pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID2);
  232. #else
  233. pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID);
  234. #endif
  235. /*
  236. * Insert Class-code
  237. */
  238. #ifdef CFG_PCI_CLASSCODE
  239. pci_write_config_word(PCIDEVID_405GP, PCI_CLASS_SUB_CODE, CFG_PCI_CLASSCODE);
  240. #endif /* CFG_PCI_CLASSCODE */
  241. /*--------------------------------------------------------------------------+
  242. * If PCI speed = 66Mhz, set 66Mhz capable bit.
  243. *--------------------------------------------------------------------------*/
  244. if (bd->bi_pci_busfreq >= 66000000) {
  245. pci_read_config_word(PCIDEVID_405GP, PCI_STATUS, &temp_short);
  246. pci_write_config_word(PCIDEVID_405GP,PCI_STATUS,(temp_short|PCI_STATUS_66MHZ));
  247. }
  248. #if (CONFIG_PCI_HOST != PCI_HOST_ADAPTER)
  249. #if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
  250. if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
  251. (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
  252. #endif
  253. {
  254. /*--------------------------------------------------------------------------+
  255. * Write the 405GP PCI Configuration regs.
  256. * Enable 405GP to be a master on the PCI bus (PMM).
  257. * Enable 405GP to act as a PCI memory target (PTM).
  258. *--------------------------------------------------------------------------*/
  259. pci_read_config_word(PCIDEVID_405GP, PCI_COMMAND, &temp_short);
  260. pci_write_config_word(PCIDEVID_405GP, PCI_COMMAND, temp_short |
  261. PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
  262. }
  263. #endif
  264. #if defined(CONFIG_405EP) /* on ppc405ep vendor id is not set */
  265. pci_write_config_word(PCIDEVID_405GP, PCI_VENDOR_ID, 0x1014); /* IBM */
  266. #endif
  267. /*
  268. * Set HCE bit (Host Configuration Enabled)
  269. */
  270. pci_read_config_word(PCIDEVID_405GP, PCIBRDGOPT2, &temp_short);
  271. pci_write_config_word(PCIDEVID_405GP, PCIBRDGOPT2, (temp_short | 0x0001));
  272. #ifdef CONFIG_PCI_PNP
  273. /*--------------------------------------------------------------------------+
  274. * Scan the PCI bus and configure devices found.
  275. *--------------------------------------------------------------------------*/
  276. #if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
  277. if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
  278. (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
  279. #endif
  280. {
  281. #ifdef CONFIG_PCI_SCAN_SHOW
  282. printf("PCI: Bus Dev VenId DevId Class Int\n");
  283. #endif
  284. hose->last_busno = pci_hose_scan(hose);
  285. }
  286. #endif /* CONFIG_PCI_PNP */
  287. }
  288. /*
  289. * drivers/pci.c skips every host bridge but the 405GP since it could
  290. * be set as an Adapter.
  291. *
  292. * I (Andrew May) don't know what we should do here, but I don't want
  293. * the auto setup of a PCI device disabling what is done pci_405gp_init
  294. * as has happened before.
  295. */
  296. void pci_405gp_setup_bridge(struct pci_controller *hose, pci_dev_t dev,
  297. struct pci_config_table *entry)
  298. {
  299. #ifdef DEBUG
  300. printf("405gp_setup_bridge\n");
  301. #endif
  302. }
  303. /*
  304. *
  305. */
  306. void pci_405gp_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
  307. {
  308. unsigned char int_line = 0xff;
  309. /*
  310. * Write pci interrupt line register (cpci405 specific)
  311. */
  312. switch (PCI_DEV(dev) & 0x03)
  313. {
  314. case 0:
  315. int_line = 27 + 2;
  316. break;
  317. case 1:
  318. int_line = 27 + 3;
  319. break;
  320. case 2:
  321. int_line = 27 + 0;
  322. break;
  323. case 3:
  324. int_line = 27 + 1;
  325. break;
  326. }
  327. pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
  328. }
  329. void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
  330. struct pci_config_table *entry)
  331. {
  332. unsigned int cmdstat = 0;
  333. pciauto_setup_device(hose, dev, 6, hose->pci_mem, hose->pci_prefetch, hose->pci_io);
  334. /* always enable io space on vga boards */
  335. pci_hose_read_config_dword(hose, dev, PCI_COMMAND, &cmdstat);
  336. cmdstat |= PCI_COMMAND_IO;
  337. pci_hose_write_config_dword(hose, dev, PCI_COMMAND, cmdstat);
  338. }
  339. #if !(defined(CONFIG_PIP405) || defined (CONFIG_MIP405))
  340. /*
  341. *As is these functs get called out of flash Not a horrible
  342. *thing, but something to keep in mind. (no statics?)
  343. */
  344. static struct pci_config_table pci_405gp_config_table[] = {
  345. /*if VendID is 0 it terminates the table search (ie Walnut)*/
  346. #ifdef CFG_PCI_SUBSYS_VENDORID
  347. {CFG_PCI_SUBSYS_VENDORID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST,
  348. PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_bridge},
  349. #endif
  350. {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA,
  351. PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
  352. {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NOT_DEFINED_VGA,
  353. PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
  354. { }
  355. };
  356. static struct pci_controller hose = {
  357. fixup_irq: pci_405gp_fixup_irq,
  358. config_table: pci_405gp_config_table,
  359. };
  360. void pci_init_board(void)
  361. {
  362. /*we want the ptrs to RAM not flash (ie don't use init list)*/
  363. hose.fixup_irq = pci_405gp_fixup_irq;
  364. hose.config_table = pci_405gp_config_table;
  365. pci_405gp_init(&hose);
  366. }
  367. #endif
  368. #endif /* CONFIG_PCI */
  369. #endif /* CONFIG_405GP */
  370. /*-----------------------------------------------------------------------------+
  371. * CONFIG_440
  372. *-----------------------------------------------------------------------------*/
  373. #if defined(CONFIG_440) && defined(CONFIG_PCI)
  374. static struct pci_controller ppc440_hose = {0};
  375. void pci_440_init (struct pci_controller *hose)
  376. {
  377. int reg_num = 0;
  378. #ifndef CONFIG_DISABLE_PISE_TEST
  379. /*--------------------------------------------------------------------------+
  380. * The PCI initialization sequence enable bit must be set ... if not abort
  381. * pci setup since updating the bit requires chip reset.
  382. *--------------------------------------------------------------------------*/
  383. #if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
  384. unsigned long strap;
  385. mfsdr(sdr_sdstp1,strap);
  386. if ((strap & SDR0_SDSTP1_PISE_MASK) == 0) {
  387. printf("PCI: SDR0_STRP1[PISE] not set.\n");
  388. printf("PCI: Configuration aborted.\n");
  389. return;
  390. }
  391. #elif defined(CONFIG_440GP)
  392. unsigned long strap;
  393. strap = mfdcr(cpc0_strp1);
  394. if ((strap & CPC0_STRP1_PISE_MASK) == 0) {
  395. printf("PCI: CPC0_STRP1[PISE] not set.\n");
  396. printf("PCI: Configuration aborted.\n");
  397. return;
  398. }
  399. #endif
  400. #endif /* CONFIG_DISABLE_PISE_TEST */
  401. /*--------------------------------------------------------------------------+
  402. * PCI controller init
  403. *--------------------------------------------------------------------------*/
  404. hose->first_busno = 0;
  405. hose->last_busno = 0xff;
  406. /* PCI I/O space */
  407. pci_set_region(hose->regions + reg_num++,
  408. 0x00000000,
  409. PCIX0_IOBASE,
  410. 0x10000,
  411. PCI_REGION_IO);
  412. /* PCI memory space */
  413. pci_set_region(hose->regions + reg_num++,
  414. CFG_PCI_TARGBASE,
  415. CFG_PCI_MEMBASE,
  416. 0x10000000,
  417. PCI_REGION_MEM );
  418. #if defined(CONFIG_PCI_SYS_MEM_BUS) && defined(CONFIG_PCI_SYS_MEM_PHYS) && \
  419. defined(CONFIG_PCI_SYS_MEM_SIZE)
  420. /* System memory space */
  421. pci_set_region(hose->regions + reg_num++,
  422. CONFIG_PCI_SYS_MEM_BUS,
  423. CONFIG_PCI_SYS_MEM_PHYS,
  424. CONFIG_PCI_SYS_MEM_SIZE,
  425. PCI_REGION_MEM | PCI_REGION_MEMORY );
  426. #endif
  427. hose->region_count = reg_num;
  428. pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
  429. #if defined(CFG_PCI_PRE_INIT)
  430. /* Let board change/modify hose & do initial checks */
  431. if (pci_pre_init (hose) == 0) {
  432. printf("PCI: Board-specific initialization failed.\n");
  433. printf("PCI: Configuration aborted.\n");
  434. return;
  435. }
  436. #endif
  437. pci_register_hose( hose );
  438. /*--------------------------------------------------------------------------+
  439. * PCI target init
  440. *--------------------------------------------------------------------------*/
  441. #if defined(CFG_PCI_TARGET_INIT)
  442. pci_target_init(hose); /* Let board setup pci target */
  443. #else
  444. out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
  445. out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_ID );
  446. out16r( PCIX0_CLS, 0x00060000 ); /* Bridge, host bridge */
  447. #endif
  448. #if defined(CONFIG_440GX) || defined(CONFIG_440SPE)
  449. out32r( PCIX0_BRDGOPT1, 0x04000060 ); /* PLB Rq pri highest */
  450. out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 0x83 ); /* Enable host config, clear Timeout, ensure int src1 */
  451. #elif defined(PCIX0_BRDGOPT1)
  452. out32r( PCIX0_BRDGOPT1, 0x10000060 ); /* PLB Rq pri highest */
  453. out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 1 ); /* Enable host config */
  454. #endif
  455. /*--------------------------------------------------------------------------+
  456. * PCI master init: default is one 256MB region for PCI memory:
  457. * 0x3_00000000 - 0x3_0FFFFFFF ==> CFG_PCI_MEMBASE
  458. *--------------------------------------------------------------------------*/
  459. #if defined(CFG_PCI_MASTER_INIT)
  460. pci_master_init(hose); /* Let board setup pci master */
  461. #else
  462. out32r( PCIX0_POM0SA, 0 ); /* disable */
  463. out32r( PCIX0_POM1SA, 0 ); /* disable */
  464. out32r( PCIX0_POM2SA, 0 ); /* disable */
  465. #if defined(CONFIG_440SPE)
  466. out32r( PCIX0_POM0LAL, 0x10000000 );
  467. out32r( PCIX0_POM0LAH, 0x0000000c );
  468. #else
  469. out32r( PCIX0_POM0LAL, 0x00000000 );
  470. out32r( PCIX0_POM0LAH, 0x00000003 );
  471. #endif
  472. out32r( PCIX0_POM0PCIAL, CFG_PCI_MEMBASE );
  473. out32r( PCIX0_POM0PCIAH, 0x00000000 );
  474. out32r( PCIX0_POM0SA, 0xf0000001 ); /* 256MB, enabled */
  475. out32r( PCIX0_STS, in32r( PCIX0_STS ) & ~0x0000fff8 );
  476. #endif
  477. /*--------------------------------------------------------------------------+
  478. * PCI host configuration -- we don't make any assumptions here ... the
  479. * _board_must_indicate_ what to do -- there's just too many runtime
  480. * scenarios in environments like cPCI, PPMC, etc. to make a determination
  481. * based on hard-coded values or state of arbiter enable.
  482. *--------------------------------------------------------------------------*/
  483. if (is_pci_host(hose)) {
  484. #ifdef CONFIG_PCI_SCAN_SHOW
  485. printf("PCI: Bus Dev VenId DevId Class Int\n");
  486. #endif
  487. #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) && \
  488. !defined(CONFIG_440EPX) && !defined(CONFIG_440GRX)
  489. out16r( PCIX0_CMD, in16r( PCIX0_CMD ) | PCI_COMMAND_MASTER);
  490. #endif
  491. hose->last_busno = pci_hose_scan(hose);
  492. }
  493. }
  494. void pci_init_board(void)
  495. {
  496. pci_440_init (&ppc440_hose);
  497. #if defined(CONFIG_440SPE)
  498. pcie_setup_hoses();
  499. #endif
  500. }
  501. #endif /* CONFIG_440 & CONFIG_PCI */