mpc8536ds.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. * Copyright 2008 Freescale Semiconductor.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <command.h>
  24. #include <pci.h>
  25. #include <asm/processor.h>
  26. #include <asm/mmu.h>
  27. #include <asm/immap_85xx.h>
  28. #include <asm/immap_fsl_pci.h>
  29. #include <asm/fsl_ddr_sdram.h>
  30. #include <asm/io.h>
  31. #include <spd.h>
  32. #include <miiphy.h>
  33. #include <libfdt.h>
  34. #include <spd_sdram.h>
  35. #include <fdt_support.h>
  36. #include "../common/pixis.h"
  37. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  38. extern void ddr_enable_ecc(unsigned int dram_size);
  39. #endif
  40. phys_size_t fixed_sdram(void);
  41. int checkboard (void)
  42. {
  43. printf ("Board: MPC8536DS, System ID: 0x%02x, "
  44. "System Version: 0x%02x, FPGA Version: 0x%02x\n",
  45. in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),
  46. in8(PIXIS_BASE + PIXIS_PVER));
  47. return 0;
  48. }
  49. phys_size_t
  50. initdram(int board_type)
  51. {
  52. phys_size_t dram_size = 0;
  53. puts("Initializing....");
  54. #ifdef CONFIG_SPD_EEPROM
  55. dram_size = fsl_ddr_sdram();
  56. dram_size = setup_ddr_tlbs(dram_size / 0x100000);
  57. dram_size *= 0x100000;
  58. #else
  59. dram_size = fixed_sdram();
  60. #endif
  61. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  62. /*
  63. * Initialize and enable DDR ECC.
  64. */
  65. ddr_enable_ecc(dram_size);
  66. #endif
  67. puts(" DDR: ");
  68. return dram_size;
  69. }
  70. #if !defined(CONFIG_SPD_EEPROM)
  71. /*
  72. * Fixed sdram init -- doesn't use serial presence detect.
  73. */
  74. phys_size_t fixed_sdram (void)
  75. {
  76. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  77. volatile ccsr_ddr_t *ddr= &immap->im_ddr;
  78. uint d_init;
  79. ddr->cs0_bnds = CFG_DDR_CS0_BNDS;
  80. ddr->cs0_config = CFG_DDR_CS0_CONFIG;
  81. ddr->timing_cfg_3 = CFG_DDR_TIMING_3;
  82. ddr->timing_cfg_0 = CFG_DDR_TIMING_0;
  83. ddr->timing_cfg_1 = CFG_DDR_TIMING_1;
  84. ddr->timing_cfg_2 = CFG_DDR_TIMING_2;
  85. ddr->sdram_mode = CFG_DDR_MODE_1;
  86. ddr->sdram_mode_2 = CFG_DDR_MODE_2;
  87. ddr->sdram_interval = CFG_DDR_INTERVAL;
  88. ddr->sdram_data_init = CFG_DDR_DATA_INIT;
  89. ddr->sdram_clk_cntl = CFG_DDR_CLK_CTRL;
  90. ddr->sdram_cfg_2 = CFG_DDR_CONTROL2;
  91. #if defined (CONFIG_DDR_ECC)
  92. ddr->err_int_en = CFG_DDR_ERR_INT_EN;
  93. ddr->err_disable = CFG_DDR_ERR_DIS;
  94. ddr->err_sbe = CFG_DDR_SBE;
  95. #endif
  96. asm("sync;isync");
  97. udelay(500);
  98. ddr->sdram_cfg = CFG_DDR_CONTROL;
  99. #if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  100. d_init = 1;
  101. debug("DDR - 1st controller: memory initializing\n");
  102. /*
  103. * Poll until memory is initialized.
  104. * 512 Meg at 400 might hit this 200 times or so.
  105. */
  106. while ((ddr->sdram_cfg_2 & (d_init << 4)) != 0) {
  107. udelay(1000);
  108. }
  109. debug("DDR: memory initialized\n\n");
  110. asm("sync; isync");
  111. udelay(500);
  112. #endif
  113. return 512 * 1024 * 1024;
  114. }
  115. #endif
  116. #ifdef CONFIG_PCI1
  117. static struct pci_controller pci1_hose;
  118. #endif
  119. #ifdef CONFIG_PCIE1
  120. static struct pci_controller pcie1_hose;
  121. #endif
  122. #ifdef CONFIG_PCIE2
  123. static struct pci_controller pcie2_hose;
  124. #endif
  125. #ifdef CONFIG_PCIE3
  126. static struct pci_controller pcie3_hose;
  127. #endif
  128. int first_free_busno=0;
  129. void
  130. pci_init_board(void)
  131. {
  132. volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
  133. uint devdisr = gur->devdisr;
  134. uint sdrs2_io_sel =
  135. (gur->pordevsr & MPC85xx_PORDEVSR_SRDS2_IO_SEL) >> 27;
  136. uint io_sel = (gur->pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
  137. uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
  138. debug(" pci_init_board: devdisr=%x, sdrs2_io_sel=%x, io_sel=%x,\
  139. host_agent=%x\n", devdisr, sdrs2_io_sel, io_sel, host_agent);
  140. if (sdrs2_io_sel == 7)
  141. printf(" Serdes2 disalbed\n");
  142. else if (sdrs2_io_sel == 4) {
  143. printf(" eTSEC1 is in sgmii mode.\n");
  144. printf(" eTSEC3 is in sgmii mode.\n");
  145. } else if (sdrs2_io_sel == 6)
  146. printf(" eTSEC1 is in sgmii mode.\n");
  147. #ifdef CONFIG_PCIE3
  148. {
  149. volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CFG_PCIE3_ADDR;
  150. extern void fsl_pci_init(struct pci_controller *hose);
  151. struct pci_controller *hose = &pcie3_hose;
  152. int pcie_ep = (host_agent == 1);
  153. int pcie_configured = (io_sel == 7);
  154. if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
  155. printf ("\n PCIE3 connected to Slot3 as %s (base address %x)",
  156. pcie_ep ? "End Point" : "Root Complex",
  157. (uint)pci);
  158. if (pci->pme_msg_det) {
  159. pci->pme_msg_det = 0xffffffff;
  160. debug (" with errors. Clearing. Now 0x%08x",pci->pme_msg_det);
  161. }
  162. printf ("\n");
  163. /* inbound */
  164. pci_set_region(hose->regions + 0,
  165. CFG_PCI_MEMORY_BUS,
  166. CFG_PCI_MEMORY_PHYS,
  167. CFG_PCI_MEMORY_SIZE,
  168. PCI_REGION_MEM | PCI_REGION_MEMORY);
  169. /* outbound memory */
  170. pci_set_region(hose->regions + 1,
  171. CFG_PCIE3_MEM_BASE,
  172. CFG_PCIE3_MEM_PHYS,
  173. CFG_PCIE3_MEM_SIZE,
  174. PCI_REGION_MEM);
  175. /* outbound io */
  176. pci_set_region(hose->regions + 2,
  177. CFG_PCIE3_IO_BASE,
  178. CFG_PCIE3_IO_PHYS,
  179. CFG_PCIE3_IO_SIZE,
  180. PCI_REGION_IO);
  181. hose->region_count = 3;
  182. hose->first_busno=first_free_busno;
  183. pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
  184. fsl_pci_init(hose);
  185. first_free_busno=hose->last_busno+1;
  186. printf (" PCIE3 on bus %02x - %02x\n",
  187. hose->first_busno,hose->last_busno);
  188. } else {
  189. printf (" PCIE3: disabled\n");
  190. }
  191. }
  192. #else
  193. gur->devdisr |= MPC85xx_DEVDISR_PCIE3; /* disable */
  194. #endif
  195. #ifdef CONFIG_PCIE1
  196. {
  197. volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CFG_PCIE1_ADDR;
  198. extern void fsl_pci_init(struct pci_controller *hose);
  199. struct pci_controller *hose = &pcie1_hose;
  200. int pcie_ep = (host_agent == 5);
  201. int pcie_configured = (io_sel == 2 || io_sel == 3
  202. || io_sel == 5 || io_sel == 7);
  203. if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
  204. printf ("\n PCIE1 connected to Slot1 as %s (base address %x)",
  205. pcie_ep ? "End Point" : "Root Complex",
  206. (uint)pci);
  207. if (pci->pme_msg_det) {
  208. pci->pme_msg_det = 0xffffffff;
  209. debug (" with errors. Clearing. Now 0x%08x",pci->pme_msg_det);
  210. }
  211. printf ("\n");
  212. /* inbound */
  213. pci_set_region(hose->regions + 0,
  214. CFG_PCI_MEMORY_BUS,
  215. CFG_PCI_MEMORY_PHYS,
  216. CFG_PCI_MEMORY_SIZE,
  217. PCI_REGION_MEM | PCI_REGION_MEMORY);
  218. /* outbound memory */
  219. pci_set_region(hose->regions + 1,
  220. CFG_PCIE1_MEM_BASE,
  221. CFG_PCIE1_MEM_PHYS,
  222. CFG_PCIE1_MEM_SIZE,
  223. PCI_REGION_MEM);
  224. /* outbound io */
  225. pci_set_region(hose->regions + 2,
  226. CFG_PCIE1_IO_BASE,
  227. CFG_PCIE1_IO_PHYS,
  228. CFG_PCIE1_IO_SIZE,
  229. PCI_REGION_IO);
  230. hose->region_count = 3;
  231. #ifdef CFG_PCIE1_MEM_BASE2
  232. /* outbound memory */
  233. pci_set_region(hose->regions + 3,
  234. CFG_PCIE1_MEM_BASE2,
  235. CFG_PCIE1_MEM_PHYS2,
  236. CFG_PCIE1_MEM_SIZE2,
  237. PCI_REGION_MEM);
  238. hose->region_count++;
  239. #endif
  240. hose->first_busno=first_free_busno;
  241. pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
  242. fsl_pci_init(hose);
  243. first_free_busno=hose->last_busno+1;
  244. printf(" PCIE1 on bus %02x - %02x\n",
  245. hose->first_busno,hose->last_busno);
  246. } else {
  247. printf (" PCIE1: disabled\n");
  248. }
  249. }
  250. #else
  251. gur->devdisr |= MPC85xx_DEVDISR_PCIE; /* disable */
  252. #endif
  253. #ifdef CONFIG_PCIE2
  254. {
  255. volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CFG_PCIE2_ADDR;
  256. extern void fsl_pci_init(struct pci_controller *hose);
  257. struct pci_controller *hose = &pcie2_hose;
  258. int pcie_ep = (host_agent == 3);
  259. int pcie_configured = (io_sel == 5 || io_sel == 7);
  260. if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
  261. printf ("\n PCIE2 connected to Slot 2 as %s (base address %x)",
  262. pcie_ep ? "End Point" : "Root Complex",
  263. (uint)pci);
  264. if (pci->pme_msg_det) {
  265. pci->pme_msg_det = 0xffffffff;
  266. debug (" with errors. Clearing. Now 0x%08x",pci->pme_msg_det);
  267. }
  268. printf ("\n");
  269. /* inbound */
  270. pci_set_region(hose->regions + 0,
  271. CFG_PCI_MEMORY_BUS,
  272. CFG_PCI_MEMORY_PHYS,
  273. CFG_PCI_MEMORY_SIZE,
  274. PCI_REGION_MEM | PCI_REGION_MEMORY);
  275. /* outbound memory */
  276. pci_set_region(hose->regions + 1,
  277. CFG_PCIE2_MEM_BASE,
  278. CFG_PCIE2_MEM_PHYS,
  279. CFG_PCIE2_MEM_SIZE,
  280. PCI_REGION_MEM);
  281. /* outbound io */
  282. pci_set_region(hose->regions + 2,
  283. CFG_PCIE2_IO_BASE,
  284. CFG_PCIE2_IO_PHYS,
  285. CFG_PCIE2_IO_SIZE,
  286. PCI_REGION_IO);
  287. hose->region_count = 3;
  288. #ifdef CFG_PCIE2_MEM_BASE2
  289. /* outbound memory */
  290. pci_set_region(hose->regions + 3,
  291. CFG_PCIE2_MEM_BASE2,
  292. CFG_PCIE2_MEM_PHYS2,
  293. CFG_PCIE2_MEM_SIZE2,
  294. PCI_REGION_MEM);
  295. hose->region_count++;
  296. #endif
  297. hose->first_busno=first_free_busno;
  298. pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
  299. fsl_pci_init(hose);
  300. first_free_busno=hose->last_busno+1;
  301. printf (" PCIE2 on bus %02x - %02x\n",
  302. hose->first_busno,hose->last_busno);
  303. } else {
  304. printf (" PCIE2: disabled\n");
  305. }
  306. }
  307. #else
  308. gur->devdisr |= MPC85xx_DEVDISR_PCIE2; /* disable */
  309. #endif
  310. #ifdef CONFIG_PCI1
  311. {
  312. volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CFG_PCI1_ADDR;
  313. extern void fsl_pci_init(struct pci_controller *hose);
  314. struct pci_controller *hose = &pci1_hose;
  315. uint pci_agent = (host_agent == 6);
  316. uint pci_speed = 66666000; /*get_clock_freq (); PCI PSPEED in [4:5] */
  317. uint pci_32 = 1;
  318. uint pci_arb = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_ARB; /* PORDEVSR[14] */
  319. uint pci_clk_sel = gur->porpllsr & MPC85xx_PORDEVSR_PCI1_SPD; /* PORPLLSR[16] */
  320. if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
  321. printf ("\n PCI: %d bit, %s MHz, %s, %s, %s (base address %x)\n",
  322. (pci_32) ? 32 : 64,
  323. (pci_speed == 33333000) ? "33" :
  324. (pci_speed == 66666000) ? "66" : "unknown",
  325. pci_clk_sel ? "sync" : "async",
  326. pci_agent ? "agent" : "host",
  327. pci_arb ? "arbiter" : "external-arbiter",
  328. (uint)pci
  329. );
  330. /* inbound */
  331. pci_set_region(hose->regions + 0,
  332. CFG_PCI_MEMORY_BUS,
  333. CFG_PCI_MEMORY_PHYS,
  334. CFG_PCI_MEMORY_SIZE,
  335. PCI_REGION_MEM | PCI_REGION_MEMORY);
  336. /* outbound memory */
  337. pci_set_region(hose->regions + 1,
  338. CFG_PCI1_MEM_BASE,
  339. CFG_PCI1_MEM_PHYS,
  340. CFG_PCI1_MEM_SIZE,
  341. PCI_REGION_MEM);
  342. /* outbound io */
  343. pci_set_region(hose->regions + 2,
  344. CFG_PCI1_IO_BASE,
  345. CFG_PCI1_IO_PHYS,
  346. CFG_PCI1_IO_SIZE,
  347. PCI_REGION_IO);
  348. hose->region_count = 3;
  349. #ifdef CFG_PCI1_MEM_BASE2
  350. /* outbound memory */
  351. pci_set_region(hose->regions + 3,
  352. CFG_PCI1_MEM_BASE2,
  353. CFG_PCI1_MEM_PHYS2,
  354. CFG_PCI1_MEM_SIZE2,
  355. PCI_REGION_MEM);
  356. hose->region_count++;
  357. #endif
  358. hose->first_busno=first_free_busno;
  359. pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
  360. fsl_pci_init(hose);
  361. first_free_busno=hose->last_busno+1;
  362. printf ("PCI on bus %02x - %02x\n",
  363. hose->first_busno,hose->last_busno);
  364. } else {
  365. printf (" PCI: disabled\n");
  366. }
  367. }
  368. #else
  369. gur->devdisr |= MPC85xx_DEVDISR_PCI1; /* disable */
  370. #endif
  371. }
  372. int board_early_init_r(void)
  373. {
  374. unsigned int i;
  375. const unsigned int flashbase = CFG_FLASH_BASE;
  376. const u8 flash_esel = 1;
  377. /*
  378. * Remap Boot flash + PROMJET region to caching-inhibited
  379. * so that flash can be erased properly.
  380. */
  381. /* Invalidate any remaining lines of the flash from caches. */
  382. for (i = 0; i < 256*1024*1024; i+=32) {
  383. asm volatile ("dcbi %0,%1": : "b" (flashbase), "r" (i));
  384. asm volatile ("icbi %0,%1": : "b" (flashbase), "r" (i));
  385. }
  386. /* invalidate existing TLB entry for flash + promjet */
  387. disable_tlb(flash_esel);
  388. set_tlb(1, flashbase, flashbase, /* tlb, epn, rpn */
  389. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, /* perms, wimge */
  390. 0, flash_esel, BOOKE_PAGESZ_256M, 1); /* ts, esel, tsize, iprot */
  391. return 0;
  392. }
  393. #ifdef CONFIG_GET_CLK_FROM_ICS307
  394. /* decode S[0-2] to Output Divider (OD) */
  395. static unsigned char
  396. ics307_S_to_OD[] = {
  397. 10, 2, 8, 4, 5, 7, 3, 6
  398. };
  399. /* Calculate frequency being generated by ICS307-02 clock chip based upon
  400. * the control bytes being programmed into it. */
  401. /* XXX: This function should probably go into a common library */
  402. static unsigned long
  403. ics307_clk_freq (unsigned char cw0, unsigned char cw1, unsigned char cw2)
  404. {
  405. const unsigned long long InputFrequency = CONFIG_ICS307_REFCLK_HZ;
  406. unsigned long VDW = ((cw1 << 1) & 0x1FE) + ((cw2 >> 7) & 1);
  407. unsigned long RDW = cw2 & 0x7F;
  408. unsigned long OD = ics307_S_to_OD[cw0 & 0x7];
  409. unsigned long freq;
  410. /* CLK1Frequency = InputFrequency * 2 * (VDW + 8) / ((RDW + 2) * OD) */
  411. /* cw0: C1 C0 TTL F1 F0 S2 S1 S0
  412. * cw1: V8 V7 V6 V5 V4 V3 V2 V1
  413. * cw2: V0 R6 R5 R4 R3 R2 R1 R0
  414. *
  415. * R6:R0 = Reference Divider Word (RDW)
  416. * V8:V0 = VCO Divider Word (VDW)
  417. * S2:S0 = Output Divider Select (OD)
  418. * F1:F0 = Function of CLK2 Output
  419. * TTL = duty cycle
  420. * C1:C0 = internal load capacitance for cyrstal
  421. */
  422. /* Adding 1 to get a "nicely" rounded number, but this needs
  423. * more tweaking to get a "properly" rounded number. */
  424. freq = 1 + (InputFrequency * 2 * (VDW + 8) / ((RDW + 2) * OD));
  425. debug("ICS307: CW[0-2]: %02X %02X %02X => %u Hz\n", cw0, cw1, cw2,
  426. freq);
  427. return freq;
  428. }
  429. unsigned long
  430. get_board_sys_clk(ulong dummy)
  431. {
  432. return ics307_clk_freq (
  433. in8(PIXIS_BASE + PIXIS_VSYSCLK0),
  434. in8(PIXIS_BASE + PIXIS_VSYSCLK1),
  435. in8(PIXIS_BASE + PIXIS_VSYSCLK2)
  436. );
  437. }
  438. unsigned long
  439. get_board_ddr_clk(ulong dummy)
  440. {
  441. return ics307_clk_freq (
  442. in8(PIXIS_BASE + PIXIS_VDDRCLK0),
  443. in8(PIXIS_BASE + PIXIS_VDDRCLK1),
  444. in8(PIXIS_BASE + PIXIS_VDDRCLK2)
  445. );
  446. }
  447. #else
  448. unsigned long
  449. get_board_sys_clk(ulong dummy)
  450. {
  451. u8 i;
  452. ulong val = 0;
  453. i = in8(PIXIS_BASE + PIXIS_SPD);
  454. i &= 0x07;
  455. switch (i) {
  456. case 0:
  457. val = 33333333;
  458. break;
  459. case 1:
  460. val = 40000000;
  461. break;
  462. case 2:
  463. val = 50000000;
  464. break;
  465. case 3:
  466. val = 66666666;
  467. break;
  468. case 4:
  469. val = 83333333;
  470. break;
  471. case 5:
  472. val = 100000000;
  473. break;
  474. case 6:
  475. val = 133333333;
  476. break;
  477. case 7:
  478. val = 166666666;
  479. break;
  480. }
  481. return val;
  482. }
  483. unsigned long
  484. get_board_ddr_clk(ulong dummy)
  485. {
  486. u8 i;
  487. ulong val = 0;
  488. i = in8(PIXIS_BASE + PIXIS_SPD);
  489. i &= 0x38;
  490. i >>= 3;
  491. switch (i) {
  492. case 0:
  493. val = 33333333;
  494. break;
  495. case 1:
  496. val = 40000000;
  497. break;
  498. case 2:
  499. val = 50000000;
  500. break;
  501. case 3:
  502. val = 66666666;
  503. break;
  504. case 4:
  505. val = 83333333;
  506. break;
  507. case 5:
  508. val = 100000000;
  509. break;
  510. case 6:
  511. val = 133333333;
  512. break;
  513. case 7:
  514. val = 166666666;
  515. break;
  516. }
  517. return val;
  518. }
  519. #endif
  520. #if defined(CONFIG_OF_BOARD_SETUP)
  521. void
  522. ft_board_setup(void *blob, bd_t *bd)
  523. {
  524. int node, tmp[2];
  525. const char *path;
  526. ft_cpu_setup(blob, bd);
  527. node = fdt_path_offset(blob, "/aliases");
  528. tmp[0] = 0;
  529. if (node >= 0) {
  530. #ifdef CONFIG_PCI1
  531. path = fdt_getprop(blob, node, "pci0", NULL);
  532. if (path) {
  533. tmp[1] = pci1_hose.last_busno - pci1_hose.first_busno;
  534. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  535. }
  536. #endif
  537. #ifdef CONFIG_PCIE2
  538. path = fdt_getprop(blob, node, "pci1", NULL);
  539. if (path) {
  540. tmp[1] = pcie2_hose.last_busno - pcie2_hose.first_busno;
  541. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  542. }
  543. #endif
  544. #ifdef CONFIG_PCIE1
  545. path = fdt_getprop(blob, node, "pci2", NULL);
  546. if (path) {
  547. tmp[1] = pcie1_hose.last_busno - pcie1_hose.first_busno;
  548. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  549. }
  550. #endif
  551. #ifdef CONFIG_PCIE3
  552. path = fdt_getprop(blob, node, "pci3", NULL);
  553. if (path) {
  554. tmp[1] = pcie3_hose.last_busno - pcie3_hose.first_busno;
  555. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  556. }
  557. #endif
  558. }
  559. }
  560. #endif