canyonlands.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /*
  2. * (C) Copyright 2008
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #include <common.h>
  21. #include <ppc440.h>
  22. #include <libfdt.h>
  23. #include <fdt_support.h>
  24. #include <i2c.h>
  25. #include <asm/processor.h>
  26. #include <asm/io.h>
  27. #include <asm/mmu.h>
  28. #include <asm/4xx_pcie.h>
  29. #include <asm/gpio.h>
  30. extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
  31. DECLARE_GLOBAL_DATA_PTR;
  32. #define CONFIG_SYS_BCSR3_PCIE 0x10
  33. #define BOARD_CANYONLANDS_PCIE 1
  34. #define BOARD_CANYONLANDS_SATA 2
  35. #define BOARD_GLACIER 3
  36. #define BOARD_ARCHES 4
  37. /*
  38. * Override the default functions in cpu/ppc4xx/44x_spd_ddr2.c with
  39. * board specific values.
  40. */
  41. #if defined(CONFIG_ARCHES)
  42. u32 ddr_wrdtr(u32 default_val) {
  43. return (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_0_DEG | 0x823);
  44. }
  45. #else
  46. u32 ddr_wrdtr(u32 default_val) {
  47. return (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_180_DEG_ADV | 0x823);
  48. }
  49. u32 ddr_clktr(u32 default_val) {
  50. return (SDRAM_CLKTR_CLKP_90_DEG_ADV);
  51. }
  52. #endif
  53. #if defined(CONFIG_ARCHES)
  54. /*
  55. * FPGA read/write helper macros
  56. */
  57. static inline int board_fpga_read(int offset)
  58. {
  59. int data;
  60. data = in_8((void *)(CONFIG_SYS_FPGA_BASE + offset));
  61. return data;
  62. }
  63. static inline void board_fpga_write(int offset, int data)
  64. {
  65. out_8((void *)(CONFIG_SYS_FPGA_BASE + offset), data);
  66. }
  67. /*
  68. * CPLD read/write helper macros
  69. */
  70. static inline int board_cpld_read(int offset)
  71. {
  72. int data;
  73. out_8((void *)(CONFIG_SYS_CPLD_ADDR), offset);
  74. data = in_8((void *)(CONFIG_SYS_CPLD_DATA));
  75. return data;
  76. }
  77. static inline void board_cpld_write(int offset, int data)
  78. {
  79. out_8((void *)(CONFIG_SYS_CPLD_ADDR), offset);
  80. out_8((void *)(CONFIG_SYS_CPLD_DATA), data);
  81. }
  82. #endif /* defined(CONFIG_ARCHES) */
  83. int board_early_init_f(void)
  84. {
  85. #if !defined(CONFIG_ARCHES)
  86. u32 sdr0_cust0;
  87. u32 pvr = get_pvr();
  88. #endif
  89. /*
  90. * Setup the interrupt controller polarities, triggers, etc.
  91. */
  92. mtdcr(uic0sr, 0xffffffff); /* clear all */
  93. mtdcr(uic0er, 0x00000000); /* disable all */
  94. mtdcr(uic0cr, 0x00000005); /* ATI & UIC1 crit are critical */
  95. mtdcr(uic0pr, 0xffffffff); /* per ref-board manual */
  96. mtdcr(uic0tr, 0x00000000); /* per ref-board manual */
  97. mtdcr(uic0vr, 0x00000000); /* int31 highest, base=0x000 */
  98. mtdcr(uic0sr, 0xffffffff); /* clear all */
  99. mtdcr(uic1sr, 0xffffffff); /* clear all */
  100. mtdcr(uic1er, 0x00000000); /* disable all */
  101. mtdcr(uic1cr, 0x00000000); /* all non-critical */
  102. mtdcr(uic1pr, 0xffffffff); /* per ref-board manual */
  103. mtdcr(uic1tr, 0x00000000); /* per ref-board manual */
  104. mtdcr(uic1vr, 0x00000000); /* int31 highest, base=0x000 */
  105. mtdcr(uic1sr, 0xffffffff); /* clear all */
  106. mtdcr(uic2sr, 0xffffffff); /* clear all */
  107. mtdcr(uic2er, 0x00000000); /* disable all */
  108. mtdcr(uic2cr, 0x00000000); /* all non-critical */
  109. mtdcr(uic2pr, 0xffffffff); /* per ref-board manual */
  110. mtdcr(uic2tr, 0x00000000); /* per ref-board manual */
  111. mtdcr(uic2vr, 0x00000000); /* int31 highest, base=0x000 */
  112. mtdcr(uic2sr, 0xffffffff); /* clear all */
  113. mtdcr(uic3sr, 0xffffffff); /* clear all */
  114. mtdcr(uic3er, 0x00000000); /* disable all */
  115. mtdcr(uic3cr, 0x00000000); /* all non-critical */
  116. mtdcr(uic3pr, 0xffffffff); /* per ref-board manual */
  117. mtdcr(uic3tr, 0x00000000); /* per ref-board manual */
  118. mtdcr(uic3vr, 0x00000000); /* int31 highest, base=0x000 */
  119. mtdcr(uic3sr, 0xffffffff); /* clear all */
  120. #if !defined(CONFIG_ARCHES)
  121. /* SDR Setting - enable NDFC */
  122. mfsdr(SDR0_CUST0, sdr0_cust0);
  123. sdr0_cust0 = SDR0_CUST0_MUX_NDFC_SEL |
  124. SDR0_CUST0_NDFC_ENABLE |
  125. SDR0_CUST0_NDFC_BW_8_BIT |
  126. SDR0_CUST0_NDFC_ARE_MASK |
  127. SDR0_CUST0_NDFC_BAC_ENCODE(3) |
  128. (0x80000000 >> (28 + CONFIG_SYS_NAND_CS));
  129. mtsdr(SDR0_CUST0, sdr0_cust0);
  130. #endif
  131. /*
  132. * Configure PFC (Pin Function Control) registers
  133. * UART0: 4 pins
  134. */
  135. mtsdr(SDR0_PFC1, 0x00040000);
  136. /* Enable PCI host functionality in SDR0_PCI0 */
  137. mtsdr(SDR0_PCI0, 0xe0000000);
  138. #if !defined(CONFIG_ARCHES)
  139. /* Enable ethernet and take out of reset */
  140. out_8((void *)CONFIG_SYS_BCSR_BASE + 6, 0);
  141. /* Remove NOR-FLASH, NAND-FLASH & EEPROM hardware write protection */
  142. out_8((void *)CONFIG_SYS_BCSR_BASE + 5, 0);
  143. /* Enable USB host & USB-OTG */
  144. out_8((void *)CONFIG_SYS_BCSR_BASE + 7, 0);
  145. mtsdr(SDR0_SRST1, 0); /* Pull AHB out of reset default=1 */
  146. /* Setup PLB4-AHB bridge based on the system address map */
  147. mtdcr(AHB_TOP, 0x8000004B);
  148. mtdcr(AHB_BOT, 0x8000004B);
  149. if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA)) {
  150. /*
  151. * Configure USB-STP pins as alternate and not GPIO
  152. * It seems to be neccessary to configure the STP pins as GPIO
  153. * input at powerup (perhaps while USB reset is asserted). So
  154. * we configure those pins to their "real" function now.
  155. */
  156. gpio_config(16, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
  157. gpio_config(19, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
  158. }
  159. #endif
  160. return 0;
  161. }
  162. #if !defined(CONFIG_ARCHES)
  163. static void canyonlands_sata_init(int board_type)
  164. {
  165. u32 reg;
  166. if (board_type == BOARD_CANYONLANDS_SATA) {
  167. /* Put SATA in reset */
  168. SDR_WRITE(SDR0_SRST1, 0x00020001);
  169. /* Set the phy for SATA, not PCI-E port 0 */
  170. reg = SDR_READ(PESDR0_PHY_CTL_RST);
  171. SDR_WRITE(PESDR0_PHY_CTL_RST, (reg & 0xeffffffc) | 0x00000001);
  172. reg = SDR_READ(PESDR0_L0CLK);
  173. SDR_WRITE(PESDR0_L0CLK, (reg & 0xfffffff8) | 0x00000007);
  174. SDR_WRITE(PESDR0_L0CDRCTL, 0x00003111);
  175. SDR_WRITE(PESDR0_L0DRV, 0x00000104);
  176. /* Bring SATA out of reset */
  177. SDR_WRITE(SDR0_SRST1, 0x00000000);
  178. }
  179. }
  180. #endif /* !defined(CONFIG_ARCHES) */
  181. int get_cpu_num(void)
  182. {
  183. int cpu = NA_OR_UNKNOWN_CPU;
  184. #if defined(CONFIG_ARCHES)
  185. int cpu_num;
  186. cpu_num = board_fpga_read(0x3);
  187. /* sanity check; assume cpu numbering starts and increments from 0 */
  188. if ((cpu_num >= 0) && (cpu_num < CONFIG_BD_NUM_CPUS))
  189. cpu = cpu_num;
  190. #endif
  191. return cpu;
  192. }
  193. #if !defined(CONFIG_ARCHES)
  194. int checkboard(void)
  195. {
  196. char *s = getenv("serial#");
  197. u32 pvr = get_pvr();
  198. if ((pvr == PVR_460GT_RA) || (pvr == PVR_460GT_SE_RA)) {
  199. printf("Board: Glacier - AMCC PPC460GT Evaluation Board");
  200. gd->board_type = BOARD_GLACIER;
  201. } else {
  202. printf("Board: Canyonlands - AMCC PPC460EX Evaluation Board");
  203. if (in_8((void *)(CONFIG_SYS_BCSR_BASE + 3)) & CONFIG_SYS_BCSR3_PCIE)
  204. gd->board_type = BOARD_CANYONLANDS_PCIE;
  205. else
  206. gd->board_type = BOARD_CANYONLANDS_SATA;
  207. }
  208. switch (gd->board_type) {
  209. case BOARD_CANYONLANDS_PCIE:
  210. case BOARD_GLACIER:
  211. puts(", 2*PCIe");
  212. break;
  213. case BOARD_CANYONLANDS_SATA:
  214. puts(", 1*PCIe/1*SATA");
  215. break;
  216. }
  217. printf(", Rev. %X", in_8((void *)(CONFIG_SYS_BCSR_BASE + 0)));
  218. if (s != NULL) {
  219. puts(", serial# ");
  220. puts(s);
  221. }
  222. putc('\n');
  223. canyonlands_sata_init(gd->board_type);
  224. return (0);
  225. }
  226. #else /* defined(CONFIG_ARCHES) */
  227. int checkboard(void)
  228. {
  229. char *s = getenv("serial#");
  230. printf("Board: Arches - AMCC DUAL PPC460GT Reference Design\n");
  231. printf(" Revision %02x.%02x ",
  232. board_fpga_read(0x0), board_fpga_read(0x1));
  233. gd->board_type = BOARD_ARCHES;
  234. /* Only CPU0 has access to CPLD registers */
  235. if (get_cpu_num() == 0) {
  236. u8 cfg_sw = board_cpld_read(0x1);
  237. printf("(FPGA=%02x, CPLD=%02x)\n",
  238. board_fpga_read(0x2), board_cpld_read(0x0));
  239. printf(" Configuration Switch %d%d%d%d\n",
  240. ((cfg_sw >> 3) & 0x01),
  241. ((cfg_sw >> 2) & 0x01),
  242. ((cfg_sw >> 1) & 0x01),
  243. ((cfg_sw >> 0) & 0x01));
  244. } else
  245. printf("(FPGA=%02x, CPLD=xx)\n", board_fpga_read(0x2));
  246. if (s != NULL)
  247. printf(" Serial# %s\n", s);
  248. return 0;
  249. }
  250. #endif /* !defined(CONFIG_ARCHES) */
  251. #if defined(CONFIG_NAND_U_BOOT)
  252. /*
  253. * NAND booting U-Boot version uses a fixed initialization, since the whole
  254. * I2C SPD DIMM autodetection/calibration doesn't fit into the 4k of boot
  255. * code.
  256. */
  257. phys_size_t initdram(int board_type)
  258. {
  259. return CONFIG_SYS_MBYTES_SDRAM << 20;
  260. }
  261. #endif
  262. /*
  263. * pci_target_init
  264. *
  265. * The bootstrap configuration provides default settings for the pci
  266. * inbound map (PIM). But the bootstrap config choices are limited and
  267. * may not be sufficient for a given board.
  268. */
  269. #if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT)
  270. void pci_target_init(struct pci_controller * hose )
  271. {
  272. /*
  273. * Disable everything
  274. */
  275. out_le32((void *)PCIX0_PIM0SA, 0); /* disable */
  276. out_le32((void *)PCIX0_PIM1SA, 0); /* disable */
  277. out_le32((void *)PCIX0_PIM2SA, 0); /* disable */
  278. out_le32((void *)PCIX0_EROMBA, 0); /* disable expansion rom */
  279. /*
  280. * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440
  281. * strapping options to not support sizes such as 128/256 MB.
  282. */
  283. out_le32((void *)PCIX0_PIM0LAL, CONFIG_SYS_SDRAM_BASE);
  284. out_le32((void *)PCIX0_PIM0LAH, 0);
  285. out_le32((void *)PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1);
  286. out_le32((void *)PCIX0_BAR0, 0);
  287. /*
  288. * Program the board's subsystem id/vendor id
  289. */
  290. out_le16((void *)PCIX0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID);
  291. out_le16((void *)PCIX0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_DEVICEID);
  292. out_le16((void *)PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY);
  293. }
  294. #endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
  295. #if defined(CONFIG_PCI)
  296. /*
  297. * is_pci_host
  298. *
  299. * This routine is called to determine if a pci scan should be
  300. * performed. With various hardware environments (especially cPCI and
  301. * PPMC) it's insufficient to depend on the state of the arbiter enable
  302. * bit in the strap register, or generic host/adapter assumptions.
  303. *
  304. * Rather than hard-code a bad assumption in the general 440 code, the
  305. * 440 pci code requires the board to decide at runtime.
  306. *
  307. * Return 0 for adapter mode, non-zero for host (monarch) mode.
  308. */
  309. int is_pci_host(struct pci_controller *hose)
  310. {
  311. /* Board is always configured as host. */
  312. return (1);
  313. }
  314. static struct pci_controller pcie_hose[2] = {{0},{0}};
  315. void pcie_setup_hoses(int busno)
  316. {
  317. struct pci_controller *hose;
  318. int i, bus;
  319. int ret = 0;
  320. char *env;
  321. unsigned int delay;
  322. int start;
  323. /*
  324. * assume we're called after the PCIX hose is initialized, which takes
  325. * bus ID 0 and therefore start numbering PCIe's from 1.
  326. */
  327. bus = busno;
  328. /*
  329. * Canyonlands with SATA enabled has only one PCIe slot
  330. * (2nd one).
  331. */
  332. if (gd->board_type == BOARD_CANYONLANDS_SATA)
  333. start = 1;
  334. else
  335. start = 0;
  336. for (i = start; i <= 1; i++) {
  337. if (is_end_point(i))
  338. ret = ppc4xx_init_pcie_endport(i);
  339. else
  340. ret = ppc4xx_init_pcie_rootport(i);
  341. if (ret) {
  342. printf("PCIE%d: initialization as %s failed\n", i,
  343. is_end_point(i) ? "endpoint" : "root-complex");
  344. continue;
  345. }
  346. hose = &pcie_hose[i];
  347. hose->first_busno = bus;
  348. hose->last_busno = bus;
  349. hose->current_busno = bus;
  350. /* setup mem resource */
  351. pci_set_region(hose->regions + 0,
  352. CONFIG_SYS_PCIE_MEMBASE + i * CONFIG_SYS_PCIE_MEMSIZE,
  353. CONFIG_SYS_PCIE_MEMBASE + i * CONFIG_SYS_PCIE_MEMSIZE,
  354. CONFIG_SYS_PCIE_MEMSIZE,
  355. PCI_REGION_MEM);
  356. hose->region_count = 1;
  357. pci_register_hose(hose);
  358. if (is_end_point(i)) {
  359. ppc4xx_setup_pcie_endpoint(hose, i);
  360. /*
  361. * Reson for no scanning is endpoint can not generate
  362. * upstream configuration accesses.
  363. */
  364. } else {
  365. ppc4xx_setup_pcie_rootpoint(hose, i);
  366. env = getenv ("pciscandelay");
  367. if (env != NULL) {
  368. delay = simple_strtoul(env, NULL, 10);
  369. if (delay > 5)
  370. printf("Warning, expect noticable delay before "
  371. "PCIe scan due to 'pciscandelay' value!\n");
  372. mdelay(delay * 1000);
  373. }
  374. /*
  375. * Config access can only go down stream
  376. */
  377. hose->last_busno = pci_hose_scan(hose);
  378. bus = hose->last_busno + 1;
  379. }
  380. }
  381. }
  382. #endif /* CONFIG_PCI */
  383. int board_early_init_r (void)
  384. {
  385. /*
  386. * Canyonlands has 64MBytes of NOR FLASH (Spansion 29GL512), but the
  387. * boot EBC mapping only supports a maximum of 16MBytes
  388. * (4.ff00.0000 - 4.ffff.ffff).
  389. * To solve this problem, the FLASH has to get remapped to another
  390. * EBC address which accepts bigger regions:
  391. *
  392. * 0xfc00.0000 -> 4.cc00.0000
  393. */
  394. /* Remap the NOR FLASH to 0xcc00.0000 ... 0xcfff.ffff */
  395. #if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
  396. mtebc(pb3cr, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
  397. #else
  398. mtebc(pb0cr, CONFIG_SYS_FLASH_BASE_PHYS_L | 0xda000);
  399. #endif
  400. /* Remove TLB entry of boot EBC mapping */
  401. remove_tlb(CONFIG_SYS_BOOT_BASE_ADDR, 16 << 20);
  402. /* Add TLB entry for 0xfc00.0000 -> 0x4.cc00.0000 */
  403. program_tlb(CONFIG_SYS_FLASH_BASE_PHYS, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_SIZE,
  404. TLB_WORD2_I_ENABLE);
  405. /*
  406. * Now accessing of the whole 64Mbytes of NOR FLASH at virtual address
  407. * 0xfc00.0000 is possible
  408. */
  409. /*
  410. * Clear potential errors resulting from auto-calibration.
  411. * If not done, then we could get an interrupt later on when
  412. * exceptions are enabled.
  413. */
  414. set_mcsr(get_mcsr());
  415. return 0;
  416. }
  417. #if !defined(CONFIG_ARCHES)
  418. int misc_init_r(void)
  419. {
  420. u32 sdr0_srst1 = 0;
  421. u32 eth_cfg;
  422. u32 pvr = get_pvr();
  423. u8 val;
  424. /*
  425. * Set EMAC mode/configuration (GMII, SGMII, RGMII...).
  426. * This is board specific, so let's do it here.
  427. */
  428. mfsdr(SDR0_ETH_CFG, eth_cfg);
  429. /* disable SGMII mode */
  430. eth_cfg &= ~(SDR0_ETH_CFG_SGMII2_ENABLE |
  431. SDR0_ETH_CFG_SGMII1_ENABLE |
  432. SDR0_ETH_CFG_SGMII0_ENABLE);
  433. /* Set the for 2 RGMII mode */
  434. /* GMC0 EMAC4_0, GMC0 EMAC4_1, RGMII Bridge 0 */
  435. eth_cfg &= ~SDR0_ETH_CFG_GMC0_BRIDGE_SEL;
  436. if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA))
  437. eth_cfg |= SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
  438. else
  439. eth_cfg &= ~SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
  440. mtsdr(SDR0_ETH_CFG, eth_cfg);
  441. /*
  442. * The AHB Bridge core is held in reset after power-on or reset
  443. * so enable it now
  444. */
  445. mfsdr(SDR0_SRST1, sdr0_srst1);
  446. sdr0_srst1 &= ~SDR0_SRST1_AHB;
  447. mtsdr(SDR0_SRST1, sdr0_srst1);
  448. /*
  449. * RTC/M41T62:
  450. * Disable square wave output: Batterie will be drained
  451. * quickly, when this output is not disabled
  452. */
  453. val = i2c_reg_read(CONFIG_SYS_I2C_RTC_ADDR, 0xa);
  454. val &= ~0x40;
  455. i2c_reg_write(CONFIG_SYS_I2C_RTC_ADDR, 0xa, val);
  456. return 0;
  457. }
  458. #else /* defined(CONFIG_ARCHES) */
  459. int misc_init_r(void)
  460. {
  461. u32 eth_cfg = 0;
  462. u32 eth_pll;
  463. u32 reg;
  464. /*
  465. * Set EMAC mode/configuration (GMII, SGMII, RGMII...).
  466. * This is board specific, so let's do it here.
  467. */
  468. /* enable SGMII mode */
  469. eth_cfg |= (SDR0_ETH_CFG_SGMII0_ENABLE |
  470. SDR0_ETH_CFG_SGMII1_ENABLE |
  471. SDR0_ETH_CFG_SGMII2_ENABLE);
  472. /* Set EMAC for MDIO */
  473. eth_cfg |= SDR0_ETH_CFG_MDIO_SEL_EMAC0;
  474. /* bypass the TAHOE0/TAHOE1 cores for U-Boot */
  475. eth_cfg |= (SDR0_ETH_CFG_TAHOE0_BYPASS | SDR0_ETH_CFG_TAHOE1_BYPASS);
  476. mtsdr(SDR0_ETH_CFG, eth_cfg);
  477. /* reset all SGMII interfaces */
  478. mfsdr(SDR0_SRST1, reg);
  479. reg |= (SDR0_SRST1_SGMII0 | SDR0_SRST1_SGMII1 | SDR0_SRST1_SGMII2);
  480. mtsdr(SDR0_SRST1, reg);
  481. mtsdr(SDR0_ETH_STS, 0xFFFFFFFF);
  482. mtsdr(SDR0_SRST1, 0x00000000);
  483. do {
  484. mfsdr(SDR0_ETH_PLL, eth_pll);
  485. } while (!(eth_pll & SDR0_ETH_PLL_PLLLOCK));
  486. return 0;
  487. }
  488. #endif /* !defined(CONFIG_ARCHES) */
  489. #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
  490. extern void __ft_board_setup(void *blob, bd_t *bd);
  491. void ft_board_setup(void *blob, bd_t *bd)
  492. {
  493. __ft_board_setup(blob, bd);
  494. if (gd->board_type == BOARD_CANYONLANDS_SATA) {
  495. /*
  496. * When SATA is selected we need to disable the first PCIe
  497. * node in the device tree, so that Linux doesn't initialize
  498. * it.
  499. */
  500. fdt_find_and_setprop(blob, "/plb/pciex@d00000000", "status",
  501. "disabled", sizeof("disabled"), 1);
  502. }
  503. if (gd->board_type == BOARD_CANYONLANDS_PCIE) {
  504. /*
  505. * When PCIe is selected we need to disable the SATA
  506. * node in the device tree, so that Linux doesn't initialize
  507. * it.
  508. */
  509. fdt_find_and_setprop(blob, "/plb/sata@bffd1000", "status",
  510. "disabled", sizeof("disabled"), 1);
  511. }
  512. }
  513. #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */