xref: /openbmc/u-boot/board/freescale/mpc837xemds/mpc837xemds.c (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
219580e66SDave Liu /*
3a1964ea5SKumar Gala  * Copyright (C) 2007,2010 Freescale Semiconductor, Inc.
419580e66SDave Liu  * Dave Liu <daveliu@freescale.com>
519580e66SDave Liu  */
619580e66SDave Liu 
719580e66SDave Liu #include <common.h>
8c78c6783SAnton Vorontsov #include <hwconfig.h>
919580e66SDave Liu #include <i2c.h>
106f8c85e8SDave Liu #include <asm/io.h>
117e1afb62SKumar Gala #include <asm/fsl_mpc83xx_serdes.h>
1219580e66SDave Liu #include <spd_sdram.h>
131da83a63SAnton Vorontsov #include <tsec.h>
14b08c8c48SMasahiro Yamada #include <linux/libfdt.h>
153bf1be3cSAnton Vorontsov #include <fdt_support.h>
16c78c6783SAnton Vorontsov #include <fsl_esdhc.h>
17063c1263SAndy Fleming #include <fsl_mdio.h>
18865ff856SAndy Fleming #include <phy.h>
198b34557cSAnton Vorontsov #include "pci.h"
2019580e66SDave Liu #include "../common/pq-mds-pib.h"
2119580e66SDave Liu 
22088454cdSSimon Glass DECLARE_GLOBAL_DATA_PTR;
23088454cdSSimon Glass 
board_early_init_f(void)2419580e66SDave Liu int board_early_init_f(void)
2519580e66SDave Liu {
266d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	u8 *bcsr = (u8 *)CONFIG_SYS_BCSR;
2719580e66SDave Liu 
2819580e66SDave Liu 	/* Enable flash write */
2919580e66SDave Liu 	bcsr[0x9] &= ~0x04;
3019580e66SDave Liu 	/* Clear all of the interrupt of BCSR */
3119580e66SDave Liu 	bcsr[0xe] = 0xff;
3219580e66SDave Liu 
336f8c85e8SDave Liu #ifdef CONFIG_FSL_SERDES
346d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
356f8c85e8SDave Liu 	u32 spridr = in_be32(&immr->sysconf.spridr);
366f8c85e8SDave Liu 
376f8c85e8SDave Liu 	/* we check only part num, and don't look for CPU revisions */
385fb5a689SDave Liu 	switch (PARTID_NO_E(spridr)) {
39e5c4ade4SKim Phillips 	case SPR_8377:
406f8c85e8SDave Liu 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
416f8c85e8SDave Liu 				FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
426f8c85e8SDave Liu 		break;
43e5c4ade4SKim Phillips 	case SPR_8378:
441da83a63SAnton Vorontsov 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SGMII,
451da83a63SAnton Vorontsov 				FSL_SERDES_CLK_125, FSL_SERDES_VDD_1V);
46e5c4ade4SKim Phillips 		break;
47e5c4ade4SKim Phillips 	case SPR_8379:
48e5c4ade4SKim Phillips 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
49e5c4ade4SKim Phillips 				FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
50e5c4ade4SKim Phillips 		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
51e5c4ade4SKim Phillips 				FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
52e5c4ade4SKim Phillips 		break;
536f8c85e8SDave Liu 	default:
546f8c85e8SDave Liu 		printf("serdes not configured: unknown CPU part number: "
556f8c85e8SDave Liu 				"%04x\n", spridr >> 16);
566f8c85e8SDave Liu 		break;
576f8c85e8SDave Liu 	}
586f8c85e8SDave Liu #endif /* CONFIG_FSL_SERDES */
5919580e66SDave Liu 	return 0;
6019580e66SDave Liu }
6119580e66SDave Liu 
62c78c6783SAnton Vorontsov #ifdef CONFIG_FSL_ESDHC
board_mmc_init(bd_t * bd)63c78c6783SAnton Vorontsov int board_mmc_init(bd_t *bd)
64c78c6783SAnton Vorontsov {
65c78c6783SAnton Vorontsov 	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
66c78c6783SAnton Vorontsov 	u8 *bcsr = (u8 *)CONFIG_SYS_BCSR;
67c78c6783SAnton Vorontsov 
68c78c6783SAnton Vorontsov 	if (!hwconfig("esdhc"))
69c78c6783SAnton Vorontsov 		return 0;
70c78c6783SAnton Vorontsov 
71c78c6783SAnton Vorontsov 	/* Set SPI_SD, SER_SD, and IRQ4_WP so that SD signals go through */
72c78c6783SAnton Vorontsov 	bcsr[0xc] |= 0x4c;
73c78c6783SAnton Vorontsov 
74c78c6783SAnton Vorontsov 	/* Set proper bits in SICR to allow SD signals through */
75c78c6783SAnton Vorontsov 	clrsetbits_be32(&im->sysconf.sicrl, SICRL_USB_B, SICRL_USB_B_SD);
76c78c6783SAnton Vorontsov 	clrsetbits_be32(&im->sysconf.sicrh, SICRH_GPIO2_E | SICRH_SPI,
77c78c6783SAnton Vorontsov 			SICRH_GPIO2_E_SD | SICRH_SPI_SD);
78c78c6783SAnton Vorontsov 
79c78c6783SAnton Vorontsov 	return fsl_esdhc_mmc_init(bd);
80c78c6783SAnton Vorontsov }
81c78c6783SAnton Vorontsov #endif
82c78c6783SAnton Vorontsov 
831da83a63SAnton Vorontsov #if defined(CONFIG_TSEC1) || defined(CONFIG_TSEC2)
board_eth_init(bd_t * bd)841da83a63SAnton Vorontsov int board_eth_init(bd_t *bd)
851da83a63SAnton Vorontsov {
86063c1263SAndy Fleming 	struct fsl_pq_mdio_info mdio_info;
871da83a63SAnton Vorontsov 	struct tsec_info_struct tsec_info[2];
881da83a63SAnton Vorontsov 	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
891da83a63SAnton Vorontsov 	u32 rcwh = in_be32(&im->reset.rcwh);
901da83a63SAnton Vorontsov 	u32 tsec_mode;
911da83a63SAnton Vorontsov 	int num = 0;
921da83a63SAnton Vorontsov 
931da83a63SAnton Vorontsov 	/* New line after Net: */
941da83a63SAnton Vorontsov 	printf("\n");
951da83a63SAnton Vorontsov 
961da83a63SAnton Vorontsov #ifdef CONFIG_TSEC1
971da83a63SAnton Vorontsov 	SET_STD_TSEC_INFO(tsec_info[num], 1);
981da83a63SAnton Vorontsov 
991da83a63SAnton Vorontsov 	printf(CONFIG_TSEC1_NAME ": ");
1001da83a63SAnton Vorontsov 
1011da83a63SAnton Vorontsov 	tsec_mode = rcwh & HRCWH_TSEC1M_MASK;
1021da83a63SAnton Vorontsov 	if (tsec_mode == HRCWH_TSEC1M_IN_RGMII) {
1031da83a63SAnton Vorontsov 		printf("RGMII\n");
1041da83a63SAnton Vorontsov 		/* this is default, no need to fixup */
1051da83a63SAnton Vorontsov 	} else if (tsec_mode == HRCWH_TSEC1M_IN_SGMII) {
1061da83a63SAnton Vorontsov 		printf("SGMII\n");
1071da83a63SAnton Vorontsov 		tsec_info[num].phyaddr = TSEC1_PHY_ADDR_SGMII;
1081da83a63SAnton Vorontsov 		tsec_info[num].flags = TSEC_GIGABIT;
1091da83a63SAnton Vorontsov 	} else {
1101da83a63SAnton Vorontsov 		printf("unsupported PHY type\n");
1111da83a63SAnton Vorontsov 	}
1121da83a63SAnton Vorontsov 	num++;
1131da83a63SAnton Vorontsov #endif
1141da83a63SAnton Vorontsov #ifdef CONFIG_TSEC2
1151da83a63SAnton Vorontsov 	SET_STD_TSEC_INFO(tsec_info[num], 2);
1161da83a63SAnton Vorontsov 
1171da83a63SAnton Vorontsov 	printf(CONFIG_TSEC2_NAME ": ");
1181da83a63SAnton Vorontsov 
1191da83a63SAnton Vorontsov 	tsec_mode = rcwh & HRCWH_TSEC2M_MASK;
1201da83a63SAnton Vorontsov 	if (tsec_mode == HRCWH_TSEC2M_IN_RGMII) {
1211da83a63SAnton Vorontsov 		printf("RGMII\n");
1221da83a63SAnton Vorontsov 		/* this is default, no need to fixup */
1231da83a63SAnton Vorontsov 	} else if (tsec_mode == HRCWH_TSEC2M_IN_SGMII) {
1241da83a63SAnton Vorontsov 		printf("SGMII\n");
1251da83a63SAnton Vorontsov 		tsec_info[num].phyaddr = TSEC2_PHY_ADDR_SGMII;
1261da83a63SAnton Vorontsov 		tsec_info[num].flags = TSEC_GIGABIT;
1271da83a63SAnton Vorontsov 	} else {
1281da83a63SAnton Vorontsov 		printf("unsupported PHY type\n");
1291da83a63SAnton Vorontsov 	}
1301da83a63SAnton Vorontsov 	num++;
1311da83a63SAnton Vorontsov #endif
132063c1263SAndy Fleming 
133063c1263SAndy Fleming 	mdio_info.regs = (struct tsec_mii_mng *)CONFIG_SYS_MDIO_BASE_ADDR;
134063c1263SAndy Fleming 	mdio_info.name = DEFAULT_MII_NAME;
135063c1263SAndy Fleming 	fsl_pq_mdio_init(bd, &mdio_info);
136063c1263SAndy Fleming 
1371da83a63SAnton Vorontsov 	return tsec_eth_init(bd, tsec_info, num);
1381da83a63SAnton Vorontsov }
1391da83a63SAnton Vorontsov 
__ft_tsec_fixup(void * blob,bd_t * bd,const char * alias,int phy_addr)1401da83a63SAnton Vorontsov static void __ft_tsec_fixup(void *blob, bd_t *bd, const char *alias,
1411da83a63SAnton Vorontsov 			    int phy_addr)
1421da83a63SAnton Vorontsov {
1431da83a63SAnton Vorontsov 	const u32 *ph;
1441da83a63SAnton Vorontsov 	int off;
1451da83a63SAnton Vorontsov 	int err;
1461da83a63SAnton Vorontsov 
1471da83a63SAnton Vorontsov 	off = fdt_path_offset(blob, alias);
1481da83a63SAnton Vorontsov 	if (off < 0) {
1491da83a63SAnton Vorontsov 		printf("WARNING: could not find %s alias: %s.\n", alias,
1501da83a63SAnton Vorontsov 			fdt_strerror(off));
1511da83a63SAnton Vorontsov 		return;
1521da83a63SAnton Vorontsov 	}
1531da83a63SAnton Vorontsov 
154865ff856SAndy Fleming 	err = fdt_fixup_phy_connection(blob, off, PHY_INTERFACE_MODE_SGMII);
155a1964ea5SKumar Gala 
1561da83a63SAnton Vorontsov 	if (err) {
1571da83a63SAnton Vorontsov 		printf("WARNING: could not set phy-connection-type for %s: "
1581da83a63SAnton Vorontsov 			"%s.\n", alias, fdt_strerror(err));
1591da83a63SAnton Vorontsov 		return;
1601da83a63SAnton Vorontsov 	}
1611da83a63SAnton Vorontsov 
1621da83a63SAnton Vorontsov 	ph = (u32 *)fdt_getprop(blob, off, "phy-handle", 0);
1631da83a63SAnton Vorontsov 	if (!ph) {
1641da83a63SAnton Vorontsov 		printf("WARNING: could not get phy-handle for %s.\n",
1651da83a63SAnton Vorontsov 			alias);
1661da83a63SAnton Vorontsov 		return;
1671da83a63SAnton Vorontsov 	}
1681da83a63SAnton Vorontsov 
1691da83a63SAnton Vorontsov 	off = fdt_node_offset_by_phandle(blob, *ph);
1701da83a63SAnton Vorontsov 	if (off < 0) {
1711da83a63SAnton Vorontsov 		printf("WARNING: could not get phy node for %s: %s\n", alias,
1721da83a63SAnton Vorontsov 			fdt_strerror(off));
1731da83a63SAnton Vorontsov 		return;
1741da83a63SAnton Vorontsov 	}
1751da83a63SAnton Vorontsov 
1761da83a63SAnton Vorontsov 	phy_addr = cpu_to_fdt32(phy_addr);
1771da83a63SAnton Vorontsov 	err = fdt_setprop(blob, off, "reg", &phy_addr, sizeof(phy_addr));
1781da83a63SAnton Vorontsov 	if (err < 0) {
1791da83a63SAnton Vorontsov 		printf("WARNING: could not set phy node's reg for %s: "
1801da83a63SAnton Vorontsov 			"%s.\n", alias, fdt_strerror(err));
1811da83a63SAnton Vorontsov 		return;
1821da83a63SAnton Vorontsov 	}
1831da83a63SAnton Vorontsov }
1841da83a63SAnton Vorontsov 
ft_tsec_fixup(void * blob,bd_t * bd)1851da83a63SAnton Vorontsov static void ft_tsec_fixup(void *blob, bd_t *bd)
1861da83a63SAnton Vorontsov {
1871da83a63SAnton Vorontsov 	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
1881da83a63SAnton Vorontsov 	u32 rcwh = in_be32(&im->reset.rcwh);
1891da83a63SAnton Vorontsov 	u32 tsec_mode;
1901da83a63SAnton Vorontsov 
1911da83a63SAnton Vorontsov #ifdef CONFIG_TSEC1
1921da83a63SAnton Vorontsov 	tsec_mode = rcwh & HRCWH_TSEC1M_MASK;
1931da83a63SAnton Vorontsov 	if (tsec_mode == HRCWH_TSEC1M_IN_SGMII)
1941da83a63SAnton Vorontsov 		__ft_tsec_fixup(blob, bd, "ethernet0", TSEC1_PHY_ADDR_SGMII);
1951da83a63SAnton Vorontsov #endif
1961da83a63SAnton Vorontsov 
1971da83a63SAnton Vorontsov #ifdef CONFIG_TSEC2
1981da83a63SAnton Vorontsov 	tsec_mode = rcwh & HRCWH_TSEC2M_MASK;
1991da83a63SAnton Vorontsov 	if (tsec_mode == HRCWH_TSEC2M_IN_SGMII)
2001da83a63SAnton Vorontsov 		__ft_tsec_fixup(blob, bd, "ethernet1", TSEC2_PHY_ADDR_SGMII);
2011da83a63SAnton Vorontsov #endif
2021da83a63SAnton Vorontsov }
2031da83a63SAnton Vorontsov #else
ft_tsec_fixup(void * blob,bd_t * bd)2041da83a63SAnton Vorontsov static inline void ft_tsec_fixup(void *blob, bd_t *bd) {}
2051da83a63SAnton Vorontsov #endif /* defined(CONFIG_TSEC1) || defined(CONFIG_TSEC2) */
2061da83a63SAnton Vorontsov 
board_early_init_r(void)20719580e66SDave Liu int board_early_init_r(void)
20819580e66SDave Liu {
20919580e66SDave Liu #ifdef CONFIG_PQ_MDS_PIB
21019580e66SDave Liu 	pib_init();
21119580e66SDave Liu #endif
21219580e66SDave Liu 	return 0;
21319580e66SDave Liu }
21419580e66SDave Liu 
2159adda545SPeter Tyser #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
21619580e66SDave Liu extern void ddr_enable_ecc(unsigned int dram_size);
21719580e66SDave Liu #endif
21819580e66SDave Liu int fixed_sdram(void);
21919580e66SDave Liu 
dram_init(void)220f1683aa7SSimon Glass int dram_init(void)
22119580e66SDave Liu {
2226d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
22319580e66SDave Liu 	u32 msize = 0;
22419580e66SDave Liu 
22519580e66SDave Liu 	if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
226088454cdSSimon Glass 		return -ENXIO;
22719580e66SDave Liu 
22819580e66SDave Liu #if defined(CONFIG_SPD_EEPROM)
22919580e66SDave Liu 	msize = spd_sdram();
23019580e66SDave Liu #else
23119580e66SDave Liu 	msize = fixed_sdram();
23219580e66SDave Liu #endif
23319580e66SDave Liu 
2349adda545SPeter Tyser #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
23519580e66SDave Liu 	/* Initialize DDR ECC byte */
23619580e66SDave Liu 	ddr_enable_ecc(msize * 1024 * 1024);
23719580e66SDave Liu #endif
23819580e66SDave Liu 
23919580e66SDave Liu 	/* return total bus DDR size(bytes) */
240088454cdSSimon Glass 	gd->ram_size = msize * 1024 * 1024;
241088454cdSSimon Glass 
242088454cdSSimon Glass 	return 0;
24319580e66SDave Liu }
24419580e66SDave Liu 
24519580e66SDave Liu #if !defined(CONFIG_SPD_EEPROM)
24619580e66SDave Liu /*************************************************************************
24719580e66SDave Liu  *  fixed sdram init -- doesn't use serial presence detect.
24819580e66SDave Liu  ************************************************************************/
fixed_sdram(void)24919580e66SDave Liu int fixed_sdram(void)
25019580e66SDave Liu {
2516d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
2526d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024;
25319580e66SDave Liu 	u32 msize_log2 = __ilog2(msize);
25419580e66SDave Liu 
2556d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_SDRAM_BASE & 0xfffff000;
25619580e66SDave Liu 	im->sysconf.ddrlaw[0].ar = LBLAWAR_EN | (msize_log2 - 1);
25719580e66SDave Liu 
2586d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if (CONFIG_SYS_DDR_SIZE != 512)
25919580e66SDave Liu #warning Currenly any ddr size other than 512 is not supported
26019580e66SDave Liu #endif
2616d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->sysconf.ddrcdr = CONFIG_SYS_DDRCDR_VALUE;
26219580e66SDave Liu 	udelay(50000);
26319580e66SDave Liu 
2646d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_clk_cntl = CONFIG_SYS_DDR_SDRAM_CLK_CNTL;
26519580e66SDave Liu 	udelay(1000);
26619580e66SDave Liu 
2676d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.csbnds[0].csbnds = CONFIG_SYS_DDR_CS0_BNDS;
2686d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.cs_config[0] = CONFIG_SYS_DDR_CS0_CONFIG;
26919580e66SDave Liu 	udelay(1000);
27019580e66SDave Liu 
2716d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.timing_cfg_0 = CONFIG_SYS_DDR_TIMING_0;
2726d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1;
2736d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2;
2746d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.timing_cfg_3 = CONFIG_SYS_DDR_TIMING_3;
2756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_cfg = CONFIG_SYS_DDR_SDRAM_CFG;
2766d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_cfg2 = CONFIG_SYS_DDR_SDRAM_CFG2;
2776d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_mode = CONFIG_SYS_DDR_MODE;
2786d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_mode2 = CONFIG_SYS_DDR_MODE2;
2796d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	im->ddr.sdram_interval = CONFIG_SYS_DDR_INTERVAL;
28019580e66SDave Liu 	__asm__ __volatile__("sync");
28119580e66SDave Liu 	udelay(1000);
28219580e66SDave Liu 
28319580e66SDave Liu 	im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN;
28419580e66SDave Liu 	udelay(2000);
2856d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	return CONFIG_SYS_DDR_SIZE;
28619580e66SDave Liu }
2876d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #endif /*!CONFIG_SYS_SPD_EEPROM */
28819580e66SDave Liu 
checkboard(void)28919580e66SDave Liu int checkboard(void)
29019580e66SDave Liu {
29119580e66SDave Liu 	puts("Board: Freescale MPC837xEMDS\n");
29219580e66SDave Liu 	return 0;
29319580e66SDave Liu }
29419580e66SDave Liu 
29500f7bbaeSAnton Vorontsov #ifdef CONFIG_PCI
board_pci_host_broken(void)29600f7bbaeSAnton Vorontsov int board_pci_host_broken(void)
29700f7bbaeSAnton Vorontsov {
29800f7bbaeSAnton Vorontsov 	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
29900f7bbaeSAnton Vorontsov 	const u32 rcw_mask = HRCWH_PCI1_ARBITER_ENABLE | HRCWH_PCI_HOST;
30000f7bbaeSAnton Vorontsov 
30100f7bbaeSAnton Vorontsov 	/* It's always OK in case of external arbiter. */
302bfadb17fSAnton Vorontsov 	if (hwconfig_subarg_cmp("pci", "arbiter", "external"))
30300f7bbaeSAnton Vorontsov 		return 0;
30400f7bbaeSAnton Vorontsov 
30500f7bbaeSAnton Vorontsov 	if ((in_be32(&im->reset.rcwh) & rcw_mask) != rcw_mask)
30600f7bbaeSAnton Vorontsov 		return 1;
30700f7bbaeSAnton Vorontsov 
30800f7bbaeSAnton Vorontsov 	return 0;
30900f7bbaeSAnton Vorontsov }
31000f7bbaeSAnton Vorontsov 
ft_pci_fixup(void * blob,bd_t * bd)31100f7bbaeSAnton Vorontsov static void ft_pci_fixup(void *blob, bd_t *bd)
31200f7bbaeSAnton Vorontsov {
31300f7bbaeSAnton Vorontsov 	const char *status = "broken (no arbiter)";
31400f7bbaeSAnton Vorontsov 	int off;
31500f7bbaeSAnton Vorontsov 	int err;
31600f7bbaeSAnton Vorontsov 
31700f7bbaeSAnton Vorontsov 	off = fdt_path_offset(blob, "pci0");
31800f7bbaeSAnton Vorontsov 	if (off < 0) {
31900f7bbaeSAnton Vorontsov 		printf("WARNING: could not find pci0 alias: %s.\n",
32000f7bbaeSAnton Vorontsov 			fdt_strerror(off));
32100f7bbaeSAnton Vorontsov 		return;
32200f7bbaeSAnton Vorontsov 	}
32300f7bbaeSAnton Vorontsov 
32400f7bbaeSAnton Vorontsov 	err = fdt_setprop(blob, off, "status", status, strlen(status) + 1);
32500f7bbaeSAnton Vorontsov 	if (err) {
32600f7bbaeSAnton Vorontsov 		printf("WARNING: could not set status for pci0: %s.\n",
32700f7bbaeSAnton Vorontsov 			fdt_strerror(err));
32800f7bbaeSAnton Vorontsov 		return;
32900f7bbaeSAnton Vorontsov 	}
33000f7bbaeSAnton Vorontsov }
33100f7bbaeSAnton Vorontsov #endif
33200f7bbaeSAnton Vorontsov 
33319580e66SDave Liu #if defined(CONFIG_OF_BOARD_SETUP)
ft_board_setup(void * blob,bd_t * bd)334e895a4b0SSimon Glass int ft_board_setup(void *blob, bd_t *bd)
33519580e66SDave Liu {
33619580e66SDave Liu 	ft_cpu_setup(blob, bd);
3371da83a63SAnton Vorontsov 	ft_tsec_fixup(blob, bd);
338a5c289b9SSriram Dash 	fsl_fdt_fixup_dr_usb(blob, bd);
339c78c6783SAnton Vorontsov 	fdt_fixup_esdhc(blob, bd);
34019580e66SDave Liu #ifdef CONFIG_PCI
34119580e66SDave Liu 	ft_pci_setup(blob, bd);
34200f7bbaeSAnton Vorontsov 	if (board_pci_host_broken())
34300f7bbaeSAnton Vorontsov 		ft_pci_fixup(blob, bd);
3448b34557cSAnton Vorontsov 	ft_pcie_fixup(blob, bd);
34519580e66SDave Liu #endif
346e895a4b0SSimon Glass 
347e895a4b0SSimon Glass 	return 0;
34819580e66SDave Liu }
34919580e66SDave Liu #endif /* CONFIG_OF_BOARD_SETUP */
350