xref: /rk3399_rockchip-uboot/board/freescale/mpc8544ds/mpc8544ds.c (revision 8ca78f2c89cd058e498fa438f57accc2e810bb98)
125d83d7fSJon Loeliger /*
26525d51fSKumar Gala  * Copyright 2007,2009-2010 Freescale Semiconductor, Inc.
325d83d7fSJon Loeliger  *
425d83d7fSJon Loeliger  * See file CREDITS for list of people who contributed to this
525d83d7fSJon Loeliger  * project.
625d83d7fSJon Loeliger  *
725d83d7fSJon Loeliger  * This program is free software; you can redistribute it and/or
825d83d7fSJon Loeliger  * modify it under the terms of the GNU General Public License as
925d83d7fSJon Loeliger  * published by the Free Software Foundation; either version 2 of
1025d83d7fSJon Loeliger  * the License, or (at your option) any later version.
1125d83d7fSJon Loeliger  *
1225d83d7fSJon Loeliger  * This program is distributed in the hope that it will be useful,
1325d83d7fSJon Loeliger  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1425d83d7fSJon Loeliger  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1525d83d7fSJon Loeliger  * GNU General Public License for more details.
1625d83d7fSJon Loeliger  *
1725d83d7fSJon Loeliger  * You should have received a copy of the GNU General Public License
1825d83d7fSJon Loeliger  * along with this program; if not, write to the Free Software
1925d83d7fSJon Loeliger  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2025d83d7fSJon Loeliger  * MA 02111-1307 USA
2125d83d7fSJon Loeliger  */
2225d83d7fSJon Loeliger 
2325d83d7fSJon Loeliger #include <common.h>
2425d83d7fSJon Loeliger #include <command.h>
25837f1ba0SEd Swarthout #include <pci.h>
2625d83d7fSJon Loeliger #include <asm/processor.h>
271167a2fdSKumar Gala #include <asm/mmu.h>
2825d83d7fSJon Loeliger #include <asm/immap_85xx.h>
29c8514622SKumar Gala #include <asm/fsl_pci.h>
301167a2fdSKumar Gala #include <asm/fsl_ddr_sdram.h>
3156a92705SKumar Gala #include <asm/io.h>
3225d83d7fSJon Loeliger #include <miiphy.h>
33addce57eSKumar Gala #include <libfdt.h>
34addce57eSKumar Gala #include <fdt_support.h>
35216f2a71SAndy Fleming #include <tsec.h>
360b252f50SBen Warren #include <netdev.h>
3725d83d7fSJon Loeliger 
38216f2a71SAndy Fleming #include "../common/sgmii_riser.h"
3925d83d7fSJon Loeliger 
4025d83d7fSJon Loeliger int checkboard (void)
4125d83d7fSJon Loeliger {
426d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
43f51cdaf1SBecky Bruce 	volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
446d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
456bb5b412SKumar Gala 	u8 vboot;
466bb5b412SKumar Gala 	u8 *pixis_base = (u8 *)PIXIS_BASE;
4725d83d7fSJon Loeliger 
4825d83d7fSJon Loeliger 	if ((uint)&gur->porpllsr != 0xe00e0000) {
499b55a253SWolfgang Denk 		printf("immap size error %lx\n",(ulong)&gur->porpllsr);
5025d83d7fSJon Loeliger 	}
516bb5b412SKumar Gala 	printf ("Board: MPC8544DS, Sys ID: 0x%02x, "
526bb5b412SKumar Gala 		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
536bb5b412SKumar Gala 		in_8(pixis_base + PIXIS_ID), in_8(pixis_base + PIXIS_VER),
546bb5b412SKumar Gala 		in_8(pixis_base + PIXIS_PVER));
556bb5b412SKumar Gala 
566bb5b412SKumar Gala 	vboot = in_8(pixis_base + PIXIS_VBOOT);
576bb5b412SKumar Gala 	if (vboot & PIXIS_VBOOT_FMAP)
586bb5b412SKumar Gala 		printf ("vBank: %d\n", ((vboot & PIXIS_VBOOT_FBANK) >> 6));
596bb5b412SKumar Gala 	else
606bb5b412SKumar Gala 		puts ("Promjet\n");
6125d83d7fSJon Loeliger 
62837f1ba0SEd Swarthout 	lbc->ltesr = 0xffffffff;	/* Clear LBC error interrupts */
63837f1ba0SEd Swarthout 	lbc->lteir = 0xffffffff;	/* Enable LBC error interrupts */
64837f1ba0SEd Swarthout 	ecm->eedr = 0xffffffff;		/* Clear ecm errors */
65837f1ba0SEd Swarthout 	ecm->eeer = 0xffffffff;		/* Enable ecm errors */
66837f1ba0SEd Swarthout 
6725d83d7fSJon Loeliger 	return 0;
6825d83d7fSJon Loeliger }
6925d83d7fSJon Loeliger 
709973e3c6SBecky Bruce phys_size_t
7125d83d7fSJon Loeliger initdram(int board_type)
7225d83d7fSJon Loeliger {
7325d83d7fSJon Loeliger 	long dram_size = 0;
7425d83d7fSJon Loeliger 
7525d83d7fSJon Loeliger 	puts("Initializing\n");
7625d83d7fSJon Loeliger 
771167a2fdSKumar Gala 	dram_size = fsl_ddr_sdram();
781167a2fdSKumar Gala 
791167a2fdSKumar Gala 	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
801167a2fdSKumar Gala 
811167a2fdSKumar Gala 	dram_size *= 0x100000;
8225d83d7fSJon Loeliger 
8325d83d7fSJon Loeliger 	puts("    DDR: ");
8425d83d7fSJon Loeliger 	return dram_size;
8525d83d7fSJon Loeliger }
8625d83d7fSJon Loeliger 
87837f1ba0SEd Swarthout #ifdef CONFIG_PCI1
88837f1ba0SEd Swarthout static struct pci_controller pci1_hose;
89837f1ba0SEd Swarthout #endif
90837f1ba0SEd Swarthout 
91837f1ba0SEd Swarthout #ifdef CONFIG_PCIE1
92837f1ba0SEd Swarthout static struct pci_controller pcie1_hose;
93837f1ba0SEd Swarthout #endif
94837f1ba0SEd Swarthout 
95837f1ba0SEd Swarthout #ifdef CONFIG_PCIE2
96837f1ba0SEd Swarthout static struct pci_controller pcie2_hose;
97837f1ba0SEd Swarthout #endif
98837f1ba0SEd Swarthout 
99837f1ba0SEd Swarthout #ifdef CONFIG_PCIE3
100837f1ba0SEd Swarthout static struct pci_controller pcie3_hose;
101837f1ba0SEd Swarthout #endif
102837f1ba0SEd Swarthout 
103645d5a78SKumar Gala void pci_init_board(void)
104837f1ba0SEd Swarthout {
1056d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
106645d5a78SKumar Gala 	struct fsl_pci_info pci_info[4];
107645d5a78SKumar Gala 	u32 devdisr, pordevsr, io_sel;
108645d5a78SKumar Gala 	u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel;
109645d5a78SKumar Gala 	int first_free_busno = 0;
110645d5a78SKumar Gala 	int num = 0;
111837f1ba0SEd Swarthout 
112645d5a78SKumar Gala 	int pcie_ep, pcie_configured;
113645d5a78SKumar Gala 
114645d5a78SKumar Gala 	devdisr = in_be32(&gur->devdisr);
115645d5a78SKumar Gala 	pordevsr = in_be32(&gur->pordevsr);
116645d5a78SKumar Gala 	porpllsr = in_be32(&gur->porpllsr);
117645d5a78SKumar Gala 	io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
118645d5a78SKumar Gala 
119645d5a78SKumar Gala 	debug ("   pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel);
120837f1ba0SEd Swarthout 
121837f1ba0SEd Swarthout 	if (io_sel & 1) {
122837f1ba0SEd Swarthout 		if (!(gur->pordevsr & MPC85xx_PORDEVSR_SGMII1_DIS))
123837f1ba0SEd Swarthout 			printf ("    eTSEC1 is in sgmii mode.\n");
124837f1ba0SEd Swarthout 		if (!(gur->pordevsr & MPC85xx_PORDEVSR_SGMII3_DIS))
125837f1ba0SEd Swarthout 			printf ("    eTSEC3 is in sgmii mode.\n");
126837f1ba0SEd Swarthout 	}
127645d5a78SKumar Gala 	puts("\n");
128837f1ba0SEd Swarthout 
129837f1ba0SEd Swarthout #ifdef CONFIG_PCIE3
130645d5a78SKumar Gala 	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_3, io_sel);
131837f1ba0SEd Swarthout 
132645d5a78SKumar Gala 	if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE3)){
133645d5a78SKumar Gala 		SET_STD_PCIE_INFO(pci_info[num], 3);
134645d5a78SKumar Gala 		pcie_ep = fsl_setup_hose(&pcie3_hose, pci_info[num].regs);
13510795f42SKumar Gala #ifdef CONFIG_SYS_PCIE3_MEM_BUS2
136837f1ba0SEd Swarthout 		/* outbound memory */
137645d5a78SKumar Gala 		pci_set_region(&pcie3_hose.regions[0],
13810795f42SKumar Gala 			       CONFIG_SYS_PCIE3_MEM_BUS2,
1396d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE3_MEM_PHYS2,
1406d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE3_MEM_SIZE2,
141837f1ba0SEd Swarthout 			       PCI_REGION_MEM);
142645d5a78SKumar Gala 
143645d5a78SKumar Gala 		pcie3_hose.region_count = 1;
144837f1ba0SEd Swarthout #endif
145*8ca78f2cSPeter Tyser 		printf("PCIE3: connected to ULI as %s (base addr %lx)\n",
14664917ca3SPeter Tyser 			pcie_ep ? "Endpoint" : "Root Complex",
147645d5a78SKumar Gala 			pci_info[num].regs);
148645d5a78SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
149645d5a78SKumar Gala 					&pcie3_hose, first_free_busno);
150837f1ba0SEd Swarthout 
15156a92705SKumar Gala 		/*
15256a92705SKumar Gala 		 * Activate ULI1575 legacy chip by performing a fake
15356a92705SKumar Gala 		 * memory access.  Needed to make ULI RTC work.
15456a92705SKumar Gala 		 */
15510795f42SKumar Gala 		in_be32((u32 *)CONFIG_SYS_PCIE3_MEM_BUS);
156837f1ba0SEd Swarthout 	} else {
157837f1ba0SEd Swarthout 		printf("PCIE3: disabled\n");
158837f1ba0SEd Swarthout 	}
159645d5a78SKumar Gala 	puts("\n");
160837f1ba0SEd Swarthout #else
161645d5a78SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE3); /* disable */
162837f1ba0SEd Swarthout #endif
163837f1ba0SEd Swarthout 
164837f1ba0SEd Swarthout #ifdef CONFIG_PCIE1
165645d5a78SKumar Gala 	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel);
166837f1ba0SEd Swarthout 
167837f1ba0SEd Swarthout 	if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
168645d5a78SKumar Gala 		SET_STD_PCIE_INFO(pci_info[num], 1);
169645d5a78SKumar Gala 		pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs);
17010795f42SKumar Gala #ifdef CONFIG_SYS_PCIE1_MEM_BUS2
171837f1ba0SEd Swarthout 		/* outbound memory */
172645d5a78SKumar Gala 		pci_set_region(&pcie1_hose.regions[0],
17310795f42SKumar Gala 			       CONFIG_SYS_PCIE1_MEM_BUS2,
1746d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE1_MEM_PHYS2,
1756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE1_MEM_SIZE2,
176837f1ba0SEd Swarthout 			       PCI_REGION_MEM);
177645d5a78SKumar Gala 
178645d5a78SKumar Gala 		pcie1_hose.region_count = 1;
179837f1ba0SEd Swarthout #endif
180*8ca78f2cSPeter Tyser 		printf("PCIE1: connected to Slot 2 as %s (base addr %lx)\n",
18164917ca3SPeter Tyser 				pcie_ep ? "Endpoint" : "Root Complex",
182645d5a78SKumar Gala 				pci_info[num].regs);
183837f1ba0SEd Swarthout 
184645d5a78SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
185645d5a78SKumar Gala 					&pcie1_hose, first_free_busno);
186837f1ba0SEd Swarthout 	} else {
187837f1ba0SEd Swarthout 		printf("PCIE1: disabled\n");
188837f1ba0SEd Swarthout 	}
189837f1ba0SEd Swarthout 
190645d5a78SKumar Gala 	puts("\n");
191837f1ba0SEd Swarthout #else
192645d5a78SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE); /* disable */
193837f1ba0SEd Swarthout #endif
194837f1ba0SEd Swarthout 
195837f1ba0SEd Swarthout #ifdef CONFIG_PCIE2
196645d5a78SKumar Gala 	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_2, io_sel);
197837f1ba0SEd Swarthout 
198645d5a78SKumar Gala 	if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE2)){
199645d5a78SKumar Gala 		SET_STD_PCIE_INFO(pci_info[num], 2);
200645d5a78SKumar Gala 		pcie_ep = fsl_setup_hose(&pcie2_hose, pci_info[num].regs);
20110795f42SKumar Gala #ifdef CONFIG_SYS_PCIE2_MEM_BUS2
202837f1ba0SEd Swarthout 		/* outbound memory */
203645d5a78SKumar Gala 		pci_set_region(&pcie2_hose.regions[0],
20410795f42SKumar Gala 			       CONFIG_SYS_PCIE2_MEM_BUS2,
2056d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE2_MEM_PHYS2,
2066d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 			       CONFIG_SYS_PCIE2_MEM_SIZE2,
207837f1ba0SEd Swarthout 			       PCI_REGION_MEM);
208645d5a78SKumar Gala 
209645d5a78SKumar Gala 		pcie2_hose.region_count = 1;
210837f1ba0SEd Swarthout #endif
211*8ca78f2cSPeter Tyser 		printf("PCIE2: connected to Slot 1 as %s (base addr %lx)\n",
21264917ca3SPeter Tyser 			pcie_ep ? "Endpoint" : "Root Complex",
213645d5a78SKumar Gala 			pci_info[num].regs);
214645d5a78SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
215645d5a78SKumar Gala 					&pcie2_hose, first_free_busno);
216837f1ba0SEd Swarthout 	} else {
217837f1ba0SEd Swarthout 		printf("PCIE2: disabled\n");
218837f1ba0SEd Swarthout 	}
219837f1ba0SEd Swarthout 
220645d5a78SKumar Gala 	puts("\n");
221837f1ba0SEd Swarthout #else
222645d5a78SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE2); /* disable */
223837f1ba0SEd Swarthout #endif
224837f1ba0SEd Swarthout 
225837f1ba0SEd Swarthout #ifdef CONFIG_PCI1
226645d5a78SKumar Gala 	pci_speed = 66666000;
227645d5a78SKumar Gala 	pci_32 = 1;
228645d5a78SKumar Gala 	pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
229645d5a78SKumar Gala 	pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
230837f1ba0SEd Swarthout 
231837f1ba0SEd Swarthout 	if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
232645d5a78SKumar Gala 		SET_STD_PCI_INFO(pci_info[num], 1);
233645d5a78SKumar Gala 		pci_agent = fsl_setup_hose(&pci1_hose, pci_info[num].regs);
234*8ca78f2cSPeter Tyser 		printf("PCI: %d bit, %s MHz, %s, %s, %s (base address %lx)\n",
235837f1ba0SEd Swarthout 			(pci_32) ? 32 : 64,
236837f1ba0SEd Swarthout 			(pci_speed == 33333000) ? "33" :
237837f1ba0SEd Swarthout 			(pci_speed == 66666000) ? "66" : "unknown",
238837f1ba0SEd Swarthout 			pci_clk_sel ? "sync" : "async",
239837f1ba0SEd Swarthout 			pci_agent ? "agent" : "host",
240837f1ba0SEd Swarthout 			pci_arb ? "arbiter" : "external-arbiter",
241645d5a78SKumar Gala 			pci_info[num].regs);
242837f1ba0SEd Swarthout 
243645d5a78SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
244645d5a78SKumar Gala 					&pci1_hose, first_free_busno);
245837f1ba0SEd Swarthout 	} else {
246837f1ba0SEd Swarthout 		printf("PCI: disabled\n");
247837f1ba0SEd Swarthout 	}
248645d5a78SKumar Gala 
249645d5a78SKumar Gala 	puts("\n");
250837f1ba0SEd Swarthout #else
251645d5a78SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */
252837f1ba0SEd Swarthout #endif
253837f1ba0SEd Swarthout }
254837f1ba0SEd Swarthout 
255837f1ba0SEd Swarthout 
25625d83d7fSJon Loeliger int last_stage_init(void)
25725d83d7fSJon Loeliger {
25825d83d7fSJon Loeliger 	return 0;
25925d83d7fSJon Loeliger }
26025d83d7fSJon Loeliger 
26125d83d7fSJon Loeliger 
26225d83d7fSJon Loeliger unsigned long
26325d83d7fSJon Loeliger get_board_sys_clk(ulong dummy)
26425d83d7fSJon Loeliger {
26525d83d7fSJon Loeliger 	u8 i, go_bit, rd_clks;
26625d83d7fSJon Loeliger 	ulong val = 0;
267048e7efeSKumar Gala 	u8 *pixis_base = (u8 *)PIXIS_BASE;
26825d83d7fSJon Loeliger 
269048e7efeSKumar Gala 	go_bit = in_8(pixis_base + PIXIS_VCTL);
27025d83d7fSJon Loeliger 	go_bit &= 0x01;
27125d83d7fSJon Loeliger 
272048e7efeSKumar Gala 	rd_clks = in_8(pixis_base + PIXIS_VCFGEN0);
27325d83d7fSJon Loeliger 	rd_clks &= 0x1C;
27425d83d7fSJon Loeliger 
27525d83d7fSJon Loeliger 	/*
27625d83d7fSJon Loeliger 	 * Only if both go bit and the SCLK bit in VCFGEN0 are set
27725d83d7fSJon Loeliger 	 * should we be using the AUX register. Remember, we also set the
27825d83d7fSJon Loeliger 	 * GO bit to boot from the alternate bank on the on-board flash
27925d83d7fSJon Loeliger 	 */
28025d83d7fSJon Loeliger 
28125d83d7fSJon Loeliger 	if (go_bit) {
28225d83d7fSJon Loeliger 		if (rd_clks == 0x1c)
283048e7efeSKumar Gala 			i = in_8(pixis_base + PIXIS_AUX);
28425d83d7fSJon Loeliger 		else
285048e7efeSKumar Gala 			i = in_8(pixis_base + PIXIS_SPD);
28625d83d7fSJon Loeliger 	} else {
287048e7efeSKumar Gala 		i = in_8(pixis_base + PIXIS_SPD);
28825d83d7fSJon Loeliger 	}
28925d83d7fSJon Loeliger 
29025d83d7fSJon Loeliger 	i &= 0x07;
29125d83d7fSJon Loeliger 
29225d83d7fSJon Loeliger 	switch (i) {
29325d83d7fSJon Loeliger 	case 0:
29425d83d7fSJon Loeliger 		val = 33333333;
29525d83d7fSJon Loeliger 		break;
29625d83d7fSJon Loeliger 	case 1:
29725d83d7fSJon Loeliger 		val = 40000000;
29825d83d7fSJon Loeliger 		break;
29925d83d7fSJon Loeliger 	case 2:
30025d83d7fSJon Loeliger 		val = 50000000;
30125d83d7fSJon Loeliger 		break;
30225d83d7fSJon Loeliger 	case 3:
30325d83d7fSJon Loeliger 		val = 66666666;
30425d83d7fSJon Loeliger 		break;
30525d83d7fSJon Loeliger 	case 4:
30625d83d7fSJon Loeliger 		val = 83000000;
30725d83d7fSJon Loeliger 		break;
30825d83d7fSJon Loeliger 	case 5:
30925d83d7fSJon Loeliger 		val = 100000000;
31025d83d7fSJon Loeliger 		break;
31125d83d7fSJon Loeliger 	case 6:
31225d83d7fSJon Loeliger 		val = 133333333;
31325d83d7fSJon Loeliger 		break;
31425d83d7fSJon Loeliger 	case 7:
31525d83d7fSJon Loeliger 		val = 166666666;
31625d83d7fSJon Loeliger 		break;
31725d83d7fSJon Loeliger 	}
31825d83d7fSJon Loeliger 
31925d83d7fSJon Loeliger 	return val;
32025d83d7fSJon Loeliger }
32125d83d7fSJon Loeliger 
322216f2a71SAndy Fleming int board_eth_init(bd_t *bis)
323216f2a71SAndy Fleming {
3240b252f50SBen Warren #ifdef CONFIG_TSEC_ENET
325216f2a71SAndy Fleming 	struct tsec_info_struct tsec_info[2];
3266d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
327216f2a71SAndy Fleming 	uint io_sel = (gur->pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
328216f2a71SAndy Fleming 	int num = 0;
329216f2a71SAndy Fleming 
330216f2a71SAndy Fleming #ifdef CONFIG_TSEC1
331216f2a71SAndy Fleming 	SET_STD_TSEC_INFO(tsec_info[num], 1);
332216f2a71SAndy Fleming 	if (!(gur->pordevsr & MPC85xx_PORDEVSR_SGMII1_DIS))
333216f2a71SAndy Fleming 		tsec_info[num].flags |= TSEC_SGMII;
334216f2a71SAndy Fleming 	num++;
335216f2a71SAndy Fleming #endif
336216f2a71SAndy Fleming #ifdef CONFIG_TSEC3
337216f2a71SAndy Fleming 	SET_STD_TSEC_INFO(tsec_info[num], 3);
338216f2a71SAndy Fleming 	if (!(gur->pordevsr & MPC85xx_PORDEVSR_SGMII3_DIS))
339216f2a71SAndy Fleming 		tsec_info[num].flags |= TSEC_SGMII;
340216f2a71SAndy Fleming 	num++;
341216f2a71SAndy Fleming #endif
342216f2a71SAndy Fleming 
343216f2a71SAndy Fleming 	if (!num) {
344216f2a71SAndy Fleming 		printf("No TSECs initialized\n");
345216f2a71SAndy Fleming 
346216f2a71SAndy Fleming 		return 0;
347216f2a71SAndy Fleming 	}
348216f2a71SAndy Fleming 
349216f2a71SAndy Fleming 	if (io_sel & 1)
350216f2a71SAndy Fleming 		fsl_sgmii_riser_init(tsec_info, num);
351216f2a71SAndy Fleming 
352216f2a71SAndy Fleming 
353216f2a71SAndy Fleming 	tsec_eth_init(bis, tsec_info, num);
354216f2a71SAndy Fleming #endif
3550b252f50SBen Warren 	return pci_eth_init(bis);
3560b252f50SBen Warren }
357216f2a71SAndy Fleming 
358addce57eSKumar Gala #if defined(CONFIG_OF_BOARD_SETUP)
3592dba0deaSKumar Gala void ft_board_setup(void *blob, bd_t *bd)
36025d83d7fSJon Loeliger {
36125d83d7fSJon Loeliger 	ft_cpu_setup(blob, bd);
36225d83d7fSJon Loeliger 
3636525d51fSKumar Gala 	FT_FSL_PCI_SETUP;
3642dba0deaSKumar Gala 
365feede8b0SAndy Fleming #ifdef CONFIG_FSL_SGMII_RISER
366feede8b0SAndy Fleming 	fsl_sgmii_riser_fdt_fixup(blob);
367feede8b0SAndy Fleming #endif
36825d83d7fSJon Loeliger }
36925d83d7fSJon Loeliger #endif
370