xref: /rk3399_rockchip-uboot/board/freescale/mpc8548cds/mpc8548cds.c (revision 7b626880b4e1fd8d2297c9341b92c2253fc27fd0)
1415a613bSKumar Gala /*
2*7b626880SKumar Gala  * Copyright 2004, 2007, 200 Freescale Semiconductor, Inc.
3415a613bSKumar Gala  *
4415a613bSKumar Gala  * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
5415a613bSKumar Gala  *
6415a613bSKumar Gala  * See file CREDITS for list of people who contributed to this
7415a613bSKumar Gala  * project.
8415a613bSKumar Gala  *
9415a613bSKumar Gala  * This program is free software; you can redistribute it and/or
10415a613bSKumar Gala  * modify it under the terms of the GNU General Public License as
11415a613bSKumar Gala  * published by the Free Software Foundation; either version 2 of
12415a613bSKumar Gala  * the License, or (at your option) any later version.
13415a613bSKumar Gala  *
14415a613bSKumar Gala  * This program is distributed in the hope that it will be useful,
15415a613bSKumar Gala  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16415a613bSKumar Gala  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
17415a613bSKumar Gala  * GNU General Public License for more details.
18415a613bSKumar Gala  *
19415a613bSKumar Gala  * You should have received a copy of the GNU General Public License
20415a613bSKumar Gala  * along with this program; if not, write to the Free Software
21415a613bSKumar Gala  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22415a613bSKumar Gala  * MA 02111-1307 USA
23415a613bSKumar Gala  */
24415a613bSKumar Gala 
25415a613bSKumar Gala #include <common.h>
26415a613bSKumar Gala #include <pci.h>
27415a613bSKumar Gala #include <asm/processor.h>
28e31d2c1eSJon Loeliger #include <asm/mmu.h>
29415a613bSKumar Gala #include <asm/immap_85xx.h>
30c8514622SKumar Gala #include <asm/fsl_pci.h>
31e31d2c1eSJon Loeliger #include <asm/fsl_ddr_sdram.h>
32a30a549aSJon Loeliger #include <spd_sdram.h>
33415a613bSKumar Gala #include <miiphy.h>
34415a613bSKumar Gala #include <libfdt.h>
35415a613bSKumar Gala #include <fdt_support.h>
36415a613bSKumar Gala 
37415a613bSKumar Gala #include "../common/cadmus.h"
38415a613bSKumar Gala #include "../common/eeprom.h"
39415a613bSKumar Gala #include "../common/via.h"
40415a613bSKumar Gala 
41415a613bSKumar Gala DECLARE_GLOBAL_DATA_PTR;
42415a613bSKumar Gala 
43415a613bSKumar Gala void local_bus_init(void);
44415a613bSKumar Gala void sdram_init(void);
45415a613bSKumar Gala 
46415a613bSKumar Gala int checkboard (void)
47415a613bSKumar Gala {
486d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
496d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
50415a613bSKumar Gala 
51415a613bSKumar Gala 	/* PCI slot in USER bits CSR[6:7] by convention. */
52415a613bSKumar Gala 	uint pci_slot = get_pci_slot ();
53415a613bSKumar Gala 
54415a613bSKumar Gala 	uint cpu_board_rev = get_cpu_board_revision ();
55415a613bSKumar Gala 
56415a613bSKumar Gala 	printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
57415a613bSKumar Gala 		get_board_version (), pci_slot);
58415a613bSKumar Gala 
59415a613bSKumar Gala 	printf ("CPU Board Revision %d.%d (0x%04x)\n",
60415a613bSKumar Gala 		MPC85XX_CPU_BOARD_MAJOR (cpu_board_rev),
61415a613bSKumar Gala 		MPC85XX_CPU_BOARD_MINOR (cpu_board_rev), cpu_board_rev);
62415a613bSKumar Gala 	/*
63415a613bSKumar Gala 	 * Initialize local bus.
64415a613bSKumar Gala 	 */
65415a613bSKumar Gala 	local_bus_init ();
66415a613bSKumar Gala 
67415a613bSKumar Gala 	/*
68415a613bSKumar Gala 	 * Hack TSEC 3 and 4 IO voltages.
69415a613bSKumar Gala 	 */
70415a613bSKumar Gala 	gur->tsec34ioovcr = 0xe7e0;	/*  1110 0111 1110 0xxx */
71415a613bSKumar Gala 
72415a613bSKumar Gala 	ecm->eedr = 0xffffffff;		/* clear ecm errors */
73415a613bSKumar Gala 	ecm->eeer = 0xffffffff;		/* enable ecm errors */
74415a613bSKumar Gala 	return 0;
75415a613bSKumar Gala }
76415a613bSKumar Gala 
779973e3c6SBecky Bruce phys_size_t
78415a613bSKumar Gala initdram(int board_type)
79415a613bSKumar Gala {
80415a613bSKumar Gala 	long dram_size = 0;
81415a613bSKumar Gala 
82415a613bSKumar Gala 	puts("Initializing\n");
83415a613bSKumar Gala 
84415a613bSKumar Gala #if defined(CONFIG_DDR_DLL)
85415a613bSKumar Gala 	{
86415a613bSKumar Gala 		/*
87415a613bSKumar Gala 		 * Work around to stabilize DDR DLL MSYNC_IN.
88415a613bSKumar Gala 		 * Errata DDR9 seems to have been fixed.
89415a613bSKumar Gala 		 * This is now the workaround for Errata DDR11:
90415a613bSKumar Gala 		 *    Override DLL = 1, Course Adj = 1, Tap Select = 0
91415a613bSKumar Gala 		 */
92415a613bSKumar Gala 
936d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 		volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
94415a613bSKumar Gala 
95415a613bSKumar Gala 		gur->ddrdllcr = 0x81000000;
96415a613bSKumar Gala 		asm("sync;isync;msync");
97415a613bSKumar Gala 		udelay(200);
98415a613bSKumar Gala 	}
99415a613bSKumar Gala #endif
100e31d2c1eSJon Loeliger 
101e31d2c1eSJon Loeliger 	dram_size = fsl_ddr_sdram();
102e31d2c1eSJon Loeliger 	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
103e31d2c1eSJon Loeliger 	dram_size *= 0x100000;
104415a613bSKumar Gala 
105415a613bSKumar Gala 	/*
106415a613bSKumar Gala 	 * SDRAM Initialization
107415a613bSKumar Gala 	 */
108415a613bSKumar Gala 	sdram_init();
109415a613bSKumar Gala 
110415a613bSKumar Gala 	puts("    DDR: ");
111415a613bSKumar Gala 	return dram_size;
112415a613bSKumar Gala }
113415a613bSKumar Gala 
114415a613bSKumar Gala /*
115415a613bSKumar Gala  * Initialize Local Bus
116415a613bSKumar Gala  */
117415a613bSKumar Gala void
118415a613bSKumar Gala local_bus_init(void)
119415a613bSKumar Gala {
1206d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
1216d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
122415a613bSKumar Gala 
123415a613bSKumar Gala 	uint clkdiv;
124415a613bSKumar Gala 	uint lbc_hz;
125415a613bSKumar Gala 	sys_info_t sysinfo;
126415a613bSKumar Gala 
127415a613bSKumar Gala 	get_sys_info(&sysinfo);
128a5d212a2STrent Piepho 	clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2;
129415a613bSKumar Gala 	lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
130415a613bSKumar Gala 
131415a613bSKumar Gala 	gur->lbiuiplldcr1 = 0x00078080;
132415a613bSKumar Gala 	if (clkdiv == 16) {
133415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x7c0f1bf0;
134415a613bSKumar Gala 	} else if (clkdiv == 8) {
135415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x6c0f1bf0;
136415a613bSKumar Gala 	} else if (clkdiv == 4) {
137415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x5c0f1bf0;
138415a613bSKumar Gala 	}
139415a613bSKumar Gala 
140415a613bSKumar Gala 	lbc->lcrr |= 0x00030000;
141415a613bSKumar Gala 
142415a613bSKumar Gala 	asm("sync;isync;msync");
143415a613bSKumar Gala 
144415a613bSKumar Gala 	lbc->ltesr = 0xffffffff;	/* Clear LBC error interrupts */
145415a613bSKumar Gala 	lbc->lteir = 0xffffffff;	/* Enable LBC error interrupts */
146415a613bSKumar Gala }
147415a613bSKumar Gala 
148415a613bSKumar Gala /*
149415a613bSKumar Gala  * Initialize SDRAM memory on the Local Bus.
150415a613bSKumar Gala  */
151415a613bSKumar Gala void
152415a613bSKumar Gala sdram_init(void)
153415a613bSKumar Gala {
1546d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
155415a613bSKumar Gala 
156415a613bSKumar Gala 	uint idx;
1576d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
1586d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
159415a613bSKumar Gala 	uint cpu_board_rev;
160415a613bSKumar Gala 	uint lsdmr_common;
161415a613bSKumar Gala 
162415a613bSKumar Gala 	puts("    SDRAM: ");
163415a613bSKumar Gala 
1646d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	print_size (CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
165415a613bSKumar Gala 
166415a613bSKumar Gala 	/*
167415a613bSKumar Gala 	 * Setup SDRAM Base and Option Registers
168415a613bSKumar Gala 	 */
1696d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->or2 = CONFIG_SYS_OR2_PRELIM;
170415a613bSKumar Gala 	asm("msync");
171415a613bSKumar Gala 
1726d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->br2 = CONFIG_SYS_BR2_PRELIM;
173415a613bSKumar Gala 	asm("msync");
174415a613bSKumar Gala 
1756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->lbcr = CONFIG_SYS_LBC_LBCR;
176415a613bSKumar Gala 	asm("msync");
177415a613bSKumar Gala 
178415a613bSKumar Gala 
1796d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->lsrt = CONFIG_SYS_LBC_LSRT;
1806d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->mrtpr = CONFIG_SYS_LBC_MRTPR;
181415a613bSKumar Gala 	asm("msync");
182415a613bSKumar Gala 
183415a613bSKumar Gala 	/*
184415a613bSKumar Gala 	 * MPC8548 uses "new" 15-16 style addressing.
185415a613bSKumar Gala 	 */
186415a613bSKumar Gala 	cpu_board_rev = get_cpu_board_revision();
1876d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON;
188b0fe93edSKumar Gala 	lsdmr_common |= LSDMR_BSMA1516;
189415a613bSKumar Gala 
190415a613bSKumar Gala 	/*
191415a613bSKumar Gala 	 * Issue PRECHARGE ALL command.
192415a613bSKumar Gala 	 */
193b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL;
194415a613bSKumar Gala 	asm("sync;msync");
195415a613bSKumar Gala 	*sdram_addr = 0xff;
196415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
197415a613bSKumar Gala 	udelay(100);
198415a613bSKumar Gala 
199415a613bSKumar Gala 	/*
200415a613bSKumar Gala 	 * Issue 8 AUTO REFRESH commands.
201415a613bSKumar Gala 	 */
202415a613bSKumar Gala 	for (idx = 0; idx < 8; idx++) {
203b0fe93edSKumar Gala 		lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH;
204415a613bSKumar Gala 		asm("sync;msync");
205415a613bSKumar Gala 		*sdram_addr = 0xff;
206415a613bSKumar Gala 		ppcDcbf((unsigned long) sdram_addr);
207415a613bSKumar Gala 		udelay(100);
208415a613bSKumar Gala 	}
209415a613bSKumar Gala 
210415a613bSKumar Gala 	/*
211415a613bSKumar Gala 	 * Issue 8 MODE-set command.
212415a613bSKumar Gala 	 */
213b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW;
214415a613bSKumar Gala 	asm("sync;msync");
215415a613bSKumar Gala 	*sdram_addr = 0xff;
216415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
217415a613bSKumar Gala 	udelay(100);
218415a613bSKumar Gala 
219415a613bSKumar Gala 	/*
220415a613bSKumar Gala 	 * Issue NORMAL OP command.
221415a613bSKumar Gala 	 */
222b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL;
223415a613bSKumar Gala 	asm("sync;msync");
224415a613bSKumar Gala 	*sdram_addr = 0xff;
225415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
226415a613bSKumar Gala 	udelay(200);    /* Overkill. Must wait > 200 bus cycles */
227415a613bSKumar Gala 
228415a613bSKumar Gala #endif	/* enable SDRAM init */
229415a613bSKumar Gala }
230415a613bSKumar Gala 
231415a613bSKumar Gala #if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
232415a613bSKumar Gala /* For some reason the Tundra PCI bridge shows up on itself as a
233415a613bSKumar Gala  * different device.  Work around that by refusing to configure it.
234415a613bSKumar Gala  */
235415a613bSKumar Gala void dummy_func(struct pci_controller* hose, pci_dev_t dev, struct pci_config_table *tab) { }
236415a613bSKumar Gala 
237415a613bSKumar Gala static struct pci_config_table pci_mpc85xxcds_config_table[] = {
238415a613bSKumar Gala 	{0x10e3, 0x0513, PCI_ANY_ID, 1, 3, PCI_ANY_ID, dummy_func, {0,0,0}},
239415a613bSKumar Gala 	{0x1106, 0x0686, PCI_ANY_ID, 1, VIA_ID, 0, mpc85xx_config_via, {0,0,0}},
240415a613bSKumar Gala 	{0x1106, 0x0571, PCI_ANY_ID, 1, VIA_ID, 1,
241415a613bSKumar Gala 		mpc85xx_config_via_usbide, {0,0,0}},
242415a613bSKumar Gala 	{0x1105, 0x3038, PCI_ANY_ID, 1, VIA_ID, 2,
243415a613bSKumar Gala 		mpc85xx_config_via_usb, {0,0,0}},
244415a613bSKumar Gala 	{0x1106, 0x3038, PCI_ANY_ID, 1, VIA_ID, 3,
245415a613bSKumar Gala 		mpc85xx_config_via_usb2, {0,0,0}},
246415a613bSKumar Gala 	{0x1106, 0x3058, PCI_ANY_ID, 1, VIA_ID, 5,
247415a613bSKumar Gala 		mpc85xx_config_via_power, {0,0,0}},
248415a613bSKumar Gala 	{0x1106, 0x3068, PCI_ANY_ID, 1, VIA_ID, 6,
249415a613bSKumar Gala 		mpc85xx_config_via_ac97, {0,0,0}},
250415a613bSKumar Gala 	{},
251415a613bSKumar Gala };
252415a613bSKumar Gala 
253415a613bSKumar Gala static struct pci_controller pci1_hose = {
254415a613bSKumar Gala 	config_table: pci_mpc85xxcds_config_table};
255415a613bSKumar Gala #endif	/* CONFIG_PCI */
256415a613bSKumar Gala 
257415a613bSKumar Gala #ifdef CONFIG_PCI2
258415a613bSKumar Gala static struct pci_controller pci2_hose;
259415a613bSKumar Gala #endif	/* CONFIG_PCI2 */
260415a613bSKumar Gala 
261415a613bSKumar Gala #ifdef CONFIG_PCIE1
262415a613bSKumar Gala static struct pci_controller pcie1_hose;
263415a613bSKumar Gala #endif	/* CONFIG_PCIE1 */
264415a613bSKumar Gala 
265*7b626880SKumar Gala void pci_init_board(void)
266415a613bSKumar Gala {
2676d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
268*7b626880SKumar Gala 	struct fsl_pci_info pci_info[4];
269*7b626880SKumar Gala 	u32 devdisr, pordevsr, io_sel;
270*7b626880SKumar Gala 	u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel;
271*7b626880SKumar Gala 	int first_free_busno = 0;
272*7b626880SKumar Gala 	int num = 0;
273415a613bSKumar Gala 
274*7b626880SKumar Gala 	int pcie_ep, pcie_configured;
275*7b626880SKumar Gala 
276*7b626880SKumar Gala 	devdisr = in_be32(&gur->devdisr);
277*7b626880SKumar Gala 	pordevsr = in_be32(&gur->pordevsr);
278*7b626880SKumar Gala 	porpllsr = in_be32(&gur->porpllsr);
279*7b626880SKumar Gala 	io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
280*7b626880SKumar Gala 
281*7b626880SKumar Gala 	debug ("   pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel);
282415a613bSKumar Gala 
283415a613bSKumar Gala #ifdef CONFIG_PCI1
284*7b626880SKumar Gala 	pci_speed = get_clock_freq ();	/* PCI PSPEED in [4:5] */
285*7b626880SKumar Gala 	pci_32 = pordevsr & MPC85xx_PORDEVSR_PCI1_PCI32;	/* PORDEVSR[15] */
286*7b626880SKumar Gala 	pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
287*7b626880SKumar Gala 	pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
288415a613bSKumar Gala 
289*7b626880SKumar Gala 	if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
290*7b626880SKumar Gala 		SET_STD_PCI_INFO(pci_info[num], 1);
291*7b626880SKumar Gala 		pci_agent = fsl_setup_hose(&pci1_hose, pci_info[num].regs);
292*7b626880SKumar Gala 		printf ("\n    PCI: %d bit, %s MHz, %s, %s, %s (base address %lx)\n",
293415a613bSKumar Gala 			(pci_32) ? 32 : 64,
294415a613bSKumar Gala 			(pci_speed == 33333000) ? "33" :
295415a613bSKumar Gala 			(pci_speed == 66666000) ? "66" : "unknown",
296415a613bSKumar Gala 			pci_clk_sel ? "sync" : "async",
297415a613bSKumar Gala 			pci_agent ? "agent" : "host",
298*7b626880SKumar Gala 			pci_arb ? "arbiter" : "external-arbiter",
299*7b626880SKumar Gala 			pci_info[num].regs);
300415a613bSKumar Gala 
301*7b626880SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
302*7b626880SKumar Gala 					&pci1_hose, first_free_busno);
303415a613bSKumar Gala 
304415a613bSKumar Gala #ifdef CONFIG_PCIX_CHECK
305*7b626880SKumar Gala 		if (!(pordevsr & MPC85xx_PORDEVSR_PCI1)) {
306415a613bSKumar Gala 			/* PCI-X init */
307415a613bSKumar Gala 			if (CONFIG_SYS_CLK_FREQ < 66000000)
308415a613bSKumar Gala 				printf("PCI-X will only work at 66 MHz\n");
309415a613bSKumar Gala 
310415a613bSKumar Gala 			reg16 = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
311415a613bSKumar Gala 				| PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
312415a613bSKumar Gala 			pci_hose_write_config_word(hose, bus, PCIX_COMMAND, reg16);
313415a613bSKumar Gala 		}
314415a613bSKumar Gala #endif
315415a613bSKumar Gala 	} else {
316415a613bSKumar Gala 		printf ("    PCI: disabled\n");
317415a613bSKumar Gala 	}
318*7b626880SKumar Gala 
319*7b626880SKumar Gala 	puts("\n");
320415a613bSKumar Gala #else
321*7b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */
322415a613bSKumar Gala #endif
323415a613bSKumar Gala 
324415a613bSKumar Gala #ifdef CONFIG_PCI2
325415a613bSKumar Gala {
326*7b626880SKumar Gala 	uint pci2_clk_sel = porpllsr & 0x4000;	/* PORPLLSR[17] */
327415a613bSKumar Gala 	uint pci_dual = get_pci_dual ();	/* PCI DUAL in CM_PCI[3] */
328415a613bSKumar Gala 	if (pci_dual) {
329415a613bSKumar Gala 		printf ("    PCI2: 32 bit, 66 MHz, %s\n",
330415a613bSKumar Gala 			pci2_clk_sel ? "sync" : "async");
331415a613bSKumar Gala 	} else {
332415a613bSKumar Gala 		printf ("    PCI2: disabled\n");
333415a613bSKumar Gala 	}
334415a613bSKumar Gala }
335415a613bSKumar Gala #else
336*7b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI2); /* disable */
337415a613bSKumar Gala #endif /* CONFIG_PCI2 */
338415a613bSKumar Gala 
339415a613bSKumar Gala #ifdef CONFIG_PCIE1
340*7b626880SKumar Gala 	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel);
341415a613bSKumar Gala 
342*7b626880SKumar Gala 	if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
343*7b626880SKumar Gala 		SET_STD_PCIE_INFO(pci_info[num], 1);
344*7b626880SKumar Gala 		pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs);
345*7b626880SKumar Gala 		printf ("    PCIE1 connected to Slot as %s (base addr %lx)\n",
346415a613bSKumar Gala 				pcie_ep ? "End Point" : "Root Complex",
347*7b626880SKumar Gala 				pci_info[num].regs);
348415a613bSKumar Gala 
349*7b626880SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
350*7b626880SKumar Gala 					&pcie1_hose, first_free_busno);
351415a613bSKumar Gala 	} else {
352*7b626880SKumar Gala 		printf ("    PCIE1: disabled\n");
353415a613bSKumar Gala 	}
354415a613bSKumar Gala 
355*7b626880SKumar Gala 	puts("\n");
356*7b626880SKumar Gala #else
357*7b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE); /* disable */
358*7b626880SKumar Gala #endif
359415a613bSKumar Gala }
360415a613bSKumar Gala 
361415a613bSKumar Gala int last_stage_init(void)
362415a613bSKumar Gala {
363415a613bSKumar Gala 	unsigned short temp;
364415a613bSKumar Gala 
365415a613bSKumar Gala 	/* Change the resistors for the PHY */
366415a613bSKumar Gala 	/* This is needed to get the RGMII working for the 1.3+
367415a613bSKumar Gala 	 * CDS cards */
368415a613bSKumar Gala 	if (get_board_version() ==  0x13) {
369415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
370415a613bSKumar Gala 				TSEC1_PHY_ADDR, 29, 18);
371415a613bSKumar Gala 
372415a613bSKumar Gala 		miiphy_read(CONFIG_TSEC1_NAME,
373415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, &temp);
374415a613bSKumar Gala 
375415a613bSKumar Gala 		temp = (temp & 0xf03f);
376415a613bSKumar Gala 		temp |= 2 << 9;		/* 36 ohm */
377415a613bSKumar Gala 		temp |= 2 << 6;		/* 39 ohm */
378415a613bSKumar Gala 
379415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
380415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, temp);
381415a613bSKumar Gala 
382415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
383415a613bSKumar Gala 				TSEC1_PHY_ADDR, 29, 3);
384415a613bSKumar Gala 
385415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
386415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, 0x8000);
387415a613bSKumar Gala 	}
388415a613bSKumar Gala 
389415a613bSKumar Gala 	return 0;
390415a613bSKumar Gala }
391415a613bSKumar Gala 
392415a613bSKumar Gala 
393415a613bSKumar Gala #if defined(CONFIG_OF_BOARD_SETUP)
3942dba0deaSKumar Gala void ft_pci_setup(void *blob, bd_t *bd)
3952dba0deaSKumar Gala {
396415a613bSKumar Gala #ifdef CONFIG_PCI1
3972dba0deaSKumar Gala 	ft_fsl_pci_setup(blob, "pci0", &pci1_hose);
398415a613bSKumar Gala #endif
399415a613bSKumar Gala #ifdef CONFIG_PCIE1
4002dba0deaSKumar Gala 	ft_fsl_pci_setup(blob, "pci1", &pcie1_hose);
401415a613bSKumar Gala #endif
402415a613bSKumar Gala }
403415a613bSKumar Gala #endif
404