xref: /rk3399_rockchip-uboot/board/freescale/mpc8548cds/mpc8548cds.c (revision 5d27e02c04f8fef38341e58475a988f8b2c78b9f)
1415a613bSKumar Gala /*
26525d51fSKumar Gala  * Copyright 2004, 2007, 2009-2010 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>
32*5d27e02cSKumar Gala #include <asm/fsl_serdes.h>
33a30a549aSJon Loeliger #include <spd_sdram.h>
34415a613bSKumar Gala #include <miiphy.h>
35415a613bSKumar Gala #include <libfdt.h>
36415a613bSKumar Gala #include <fdt_support.h>
37415a613bSKumar Gala 
38415a613bSKumar Gala #include "../common/cadmus.h"
39415a613bSKumar Gala #include "../common/eeprom.h"
40415a613bSKumar Gala #include "../common/via.h"
41415a613bSKumar Gala 
42415a613bSKumar Gala DECLARE_GLOBAL_DATA_PTR;
43415a613bSKumar Gala 
44415a613bSKumar Gala void local_bus_init(void);
45415a613bSKumar Gala void sdram_init(void);
46415a613bSKumar Gala 
47415a613bSKumar Gala int checkboard (void)
48415a613bSKumar Gala {
496d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
506d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
51415a613bSKumar Gala 
52415a613bSKumar Gala 	/* PCI slot in USER bits CSR[6:7] by convention. */
53415a613bSKumar Gala 	uint pci_slot = get_pci_slot ();
54415a613bSKumar Gala 
55415a613bSKumar Gala 	uint cpu_board_rev = get_cpu_board_revision ();
56415a613bSKumar Gala 
57415a613bSKumar Gala 	printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
58415a613bSKumar Gala 		get_board_version (), pci_slot);
59415a613bSKumar Gala 
60415a613bSKumar Gala 	printf ("CPU Board Revision %d.%d (0x%04x)\n",
61415a613bSKumar Gala 		MPC85XX_CPU_BOARD_MAJOR (cpu_board_rev),
62415a613bSKumar Gala 		MPC85XX_CPU_BOARD_MINOR (cpu_board_rev), cpu_board_rev);
63415a613bSKumar Gala 	/*
64415a613bSKumar Gala 	 * Initialize local bus.
65415a613bSKumar Gala 	 */
66415a613bSKumar Gala 	local_bus_init ();
67415a613bSKumar Gala 
68415a613bSKumar Gala 	/*
69415a613bSKumar Gala 	 * Hack TSEC 3 and 4 IO voltages.
70415a613bSKumar Gala 	 */
71415a613bSKumar Gala 	gur->tsec34ioovcr = 0xe7e0;	/*  1110 0111 1110 0xxx */
72415a613bSKumar Gala 
73415a613bSKumar Gala 	ecm->eedr = 0xffffffff;		/* clear ecm errors */
74415a613bSKumar Gala 	ecm->eeer = 0xffffffff;		/* enable ecm errors */
75415a613bSKumar Gala 	return 0;
76415a613bSKumar Gala }
77415a613bSKumar Gala 
789973e3c6SBecky Bruce phys_size_t
79415a613bSKumar Gala initdram(int board_type)
80415a613bSKumar Gala {
81415a613bSKumar Gala 	long dram_size = 0;
82415a613bSKumar Gala 
83415a613bSKumar Gala 	puts("Initializing\n");
84415a613bSKumar Gala 
85415a613bSKumar Gala #if defined(CONFIG_DDR_DLL)
86415a613bSKumar Gala 	{
87415a613bSKumar Gala 		/*
88415a613bSKumar Gala 		 * Work around to stabilize DDR DLL MSYNC_IN.
89415a613bSKumar Gala 		 * Errata DDR9 seems to have been fixed.
90415a613bSKumar Gala 		 * This is now the workaround for Errata DDR11:
91415a613bSKumar Gala 		 *    Override DLL = 1, Course Adj = 1, Tap Select = 0
92415a613bSKumar Gala 		 */
93415a613bSKumar Gala 
946d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 		volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
95415a613bSKumar Gala 
96415a613bSKumar Gala 		gur->ddrdllcr = 0x81000000;
97415a613bSKumar Gala 		asm("sync;isync;msync");
98415a613bSKumar Gala 		udelay(200);
99415a613bSKumar Gala 	}
100415a613bSKumar Gala #endif
101e31d2c1eSJon Loeliger 
102e31d2c1eSJon Loeliger 	dram_size = fsl_ddr_sdram();
103e31d2c1eSJon Loeliger 	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
104e31d2c1eSJon Loeliger 	dram_size *= 0x100000;
105415a613bSKumar Gala 
106415a613bSKumar Gala 	/*
107415a613bSKumar Gala 	 * SDRAM Initialization
108415a613bSKumar Gala 	 */
109415a613bSKumar Gala 	sdram_init();
110415a613bSKumar Gala 
111415a613bSKumar Gala 	puts("    DDR: ");
112415a613bSKumar Gala 	return dram_size;
113415a613bSKumar Gala }
114415a613bSKumar Gala 
115415a613bSKumar Gala /*
116415a613bSKumar Gala  * Initialize Local Bus
117415a613bSKumar Gala  */
118415a613bSKumar Gala void
119415a613bSKumar Gala local_bus_init(void)
120415a613bSKumar Gala {
1216d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
122f51cdaf1SBecky Bruce 	volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
123415a613bSKumar Gala 
124415a613bSKumar Gala 	uint clkdiv;
125415a613bSKumar Gala 	uint lbc_hz;
126415a613bSKumar Gala 	sys_info_t sysinfo;
127415a613bSKumar Gala 
128415a613bSKumar Gala 	get_sys_info(&sysinfo);
129a5d212a2STrent Piepho 	clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2;
130415a613bSKumar Gala 	lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
131415a613bSKumar Gala 
132415a613bSKumar Gala 	gur->lbiuiplldcr1 = 0x00078080;
133415a613bSKumar Gala 	if (clkdiv == 16) {
134415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x7c0f1bf0;
135415a613bSKumar Gala 	} else if (clkdiv == 8) {
136415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x6c0f1bf0;
137415a613bSKumar Gala 	} else if (clkdiv == 4) {
138415a613bSKumar Gala 		gur->lbiuiplldcr0 = 0x5c0f1bf0;
139415a613bSKumar Gala 	}
140415a613bSKumar Gala 
141415a613bSKumar Gala 	lbc->lcrr |= 0x00030000;
142415a613bSKumar Gala 
143415a613bSKumar Gala 	asm("sync;isync;msync");
144415a613bSKumar Gala 
145415a613bSKumar Gala 	lbc->ltesr = 0xffffffff;	/* Clear LBC error interrupts */
146415a613bSKumar Gala 	lbc->lteir = 0xffffffff;	/* Enable LBC error interrupts */
147415a613bSKumar Gala }
148415a613bSKumar Gala 
149415a613bSKumar Gala /*
150415a613bSKumar Gala  * Initialize SDRAM memory on the Local Bus.
151415a613bSKumar Gala  */
152415a613bSKumar Gala void
153415a613bSKumar Gala sdram_init(void)
154415a613bSKumar Gala {
1556d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
156415a613bSKumar Gala 
157415a613bSKumar Gala 	uint idx;
158f51cdaf1SBecky Bruce 	volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
1596d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
160415a613bSKumar Gala 	uint cpu_board_rev;
161415a613bSKumar Gala 	uint lsdmr_common;
162415a613bSKumar Gala 
163415a613bSKumar Gala 	puts("    SDRAM: ");
164415a613bSKumar Gala 
1656d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	print_size (CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
166415a613bSKumar Gala 
167415a613bSKumar Gala 	/*
168415a613bSKumar Gala 	 * Setup SDRAM Base and Option Registers
169415a613bSKumar Gala 	 */
170f51cdaf1SBecky Bruce 	set_lbc_or(2, CONFIG_SYS_OR2_PRELIM);
171f51cdaf1SBecky Bruce 	set_lbc_br(2, CONFIG_SYS_BR2_PRELIM);
1726d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->lbcr = CONFIG_SYS_LBC_LBCR;
173415a613bSKumar Gala 	asm("msync");
174415a613bSKumar Gala 
1756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->lsrt = CONFIG_SYS_LBC_LSRT;
1766d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lbc->mrtpr = CONFIG_SYS_LBC_MRTPR;
177415a613bSKumar Gala 	asm("msync");
178415a613bSKumar Gala 
179415a613bSKumar Gala 	/*
180415a613bSKumar Gala 	 * MPC8548 uses "new" 15-16 style addressing.
181415a613bSKumar Gala 	 */
182415a613bSKumar Gala 	cpu_board_rev = get_cpu_board_revision();
1836d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON;
184b0fe93edSKumar Gala 	lsdmr_common |= LSDMR_BSMA1516;
185415a613bSKumar Gala 
186415a613bSKumar Gala 	/*
187415a613bSKumar Gala 	 * Issue PRECHARGE ALL command.
188415a613bSKumar Gala 	 */
189b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL;
190415a613bSKumar Gala 	asm("sync;msync");
191415a613bSKumar Gala 	*sdram_addr = 0xff;
192415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
193415a613bSKumar Gala 	udelay(100);
194415a613bSKumar Gala 
195415a613bSKumar Gala 	/*
196415a613bSKumar Gala 	 * Issue 8 AUTO REFRESH commands.
197415a613bSKumar Gala 	 */
198415a613bSKumar Gala 	for (idx = 0; idx < 8; idx++) {
199b0fe93edSKumar Gala 		lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH;
200415a613bSKumar Gala 		asm("sync;msync");
201415a613bSKumar Gala 		*sdram_addr = 0xff;
202415a613bSKumar Gala 		ppcDcbf((unsigned long) sdram_addr);
203415a613bSKumar Gala 		udelay(100);
204415a613bSKumar Gala 	}
205415a613bSKumar Gala 
206415a613bSKumar Gala 	/*
207415a613bSKumar Gala 	 * Issue 8 MODE-set command.
208415a613bSKumar Gala 	 */
209b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW;
210415a613bSKumar Gala 	asm("sync;msync");
211415a613bSKumar Gala 	*sdram_addr = 0xff;
212415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
213415a613bSKumar Gala 	udelay(100);
214415a613bSKumar Gala 
215415a613bSKumar Gala 	/*
216415a613bSKumar Gala 	 * Issue NORMAL OP command.
217415a613bSKumar Gala 	 */
218b0fe93edSKumar Gala 	lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL;
219415a613bSKumar Gala 	asm("sync;msync");
220415a613bSKumar Gala 	*sdram_addr = 0xff;
221415a613bSKumar Gala 	ppcDcbf((unsigned long) sdram_addr);
222415a613bSKumar Gala 	udelay(200);    /* Overkill. Must wait > 200 bus cycles */
223415a613bSKumar Gala 
224415a613bSKumar Gala #endif	/* enable SDRAM init */
225415a613bSKumar Gala }
226415a613bSKumar Gala 
227415a613bSKumar Gala #if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
228415a613bSKumar Gala /* For some reason the Tundra PCI bridge shows up on itself as a
229415a613bSKumar Gala  * different device.  Work around that by refusing to configure it.
230415a613bSKumar Gala  */
231415a613bSKumar Gala void dummy_func(struct pci_controller* hose, pci_dev_t dev, struct pci_config_table *tab) { }
232415a613bSKumar Gala 
233415a613bSKumar Gala static struct pci_config_table pci_mpc85xxcds_config_table[] = {
234415a613bSKumar Gala 	{0x10e3, 0x0513, PCI_ANY_ID, 1, 3, PCI_ANY_ID, dummy_func, {0,0,0}},
235415a613bSKumar Gala 	{0x1106, 0x0686, PCI_ANY_ID, 1, VIA_ID, 0, mpc85xx_config_via, {0,0,0}},
236415a613bSKumar Gala 	{0x1106, 0x0571, PCI_ANY_ID, 1, VIA_ID, 1,
237415a613bSKumar Gala 		mpc85xx_config_via_usbide, {0,0,0}},
238415a613bSKumar Gala 	{0x1105, 0x3038, PCI_ANY_ID, 1, VIA_ID, 2,
239415a613bSKumar Gala 		mpc85xx_config_via_usb, {0,0,0}},
240415a613bSKumar Gala 	{0x1106, 0x3038, PCI_ANY_ID, 1, VIA_ID, 3,
241415a613bSKumar Gala 		mpc85xx_config_via_usb2, {0,0,0}},
242415a613bSKumar Gala 	{0x1106, 0x3058, PCI_ANY_ID, 1, VIA_ID, 5,
243415a613bSKumar Gala 		mpc85xx_config_via_power, {0,0,0}},
244415a613bSKumar Gala 	{0x1106, 0x3068, PCI_ANY_ID, 1, VIA_ID, 6,
245415a613bSKumar Gala 		mpc85xx_config_via_ac97, {0,0,0}},
246415a613bSKumar Gala 	{},
247415a613bSKumar Gala };
248415a613bSKumar Gala 
249415a613bSKumar Gala static struct pci_controller pci1_hose = {
250415a613bSKumar Gala 	config_table: pci_mpc85xxcds_config_table};
251415a613bSKumar Gala #endif	/* CONFIG_PCI */
252415a613bSKumar Gala 
253415a613bSKumar Gala #ifdef CONFIG_PCI2
254415a613bSKumar Gala static struct pci_controller pci2_hose;
255415a613bSKumar Gala #endif	/* CONFIG_PCI2 */
256415a613bSKumar Gala 
257415a613bSKumar Gala #ifdef CONFIG_PCIE1
258415a613bSKumar Gala static struct pci_controller pcie1_hose;
259415a613bSKumar Gala #endif	/* CONFIG_PCIE1 */
260415a613bSKumar Gala 
2617b626880SKumar Gala void pci_init_board(void)
262415a613bSKumar Gala {
2636d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
2647b626880SKumar Gala 	struct fsl_pci_info pci_info[4];
2657b626880SKumar Gala 	u32 devdisr, pordevsr, io_sel;
2667b626880SKumar Gala 	u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel;
2677b626880SKumar Gala 	int first_free_busno = 0;
2687b626880SKumar Gala 	int num = 0;
269415a613bSKumar Gala 
2707b626880SKumar Gala 	int pcie_ep, pcie_configured;
2717b626880SKumar Gala 
2727b626880SKumar Gala 	devdisr = in_be32(&gur->devdisr);
2737b626880SKumar Gala 	pordevsr = in_be32(&gur->pordevsr);
2747b626880SKumar Gala 	porpllsr = in_be32(&gur->porpllsr);
2757b626880SKumar Gala 	io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
2767b626880SKumar Gala 
2777b626880SKumar Gala 	debug ("   pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel);
278415a613bSKumar Gala 
279415a613bSKumar Gala #ifdef CONFIG_PCI1
2807b626880SKumar Gala 	pci_speed = get_clock_freq ();	/* PCI PSPEED in [4:5] */
2817b626880SKumar Gala 	pci_32 = pordevsr & MPC85xx_PORDEVSR_PCI1_PCI32;	/* PORDEVSR[15] */
2827b626880SKumar Gala 	pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
2837b626880SKumar Gala 	pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD;
284415a613bSKumar Gala 
2857b626880SKumar Gala 	if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
2867b626880SKumar Gala 		SET_STD_PCI_INFO(pci_info[num], 1);
2877b626880SKumar Gala 		pci_agent = fsl_setup_hose(&pci1_hose, pci_info[num].regs);
2888ca78f2cSPeter Tyser 		printf("PCI: %d bit, %s MHz, %s, %s, %s (base address %lx)\n",
289415a613bSKumar Gala 			(pci_32) ? 32 : 64,
290415a613bSKumar Gala 			(pci_speed == 33333000) ? "33" :
291415a613bSKumar Gala 			(pci_speed == 66666000) ? "66" : "unknown",
292415a613bSKumar Gala 			pci_clk_sel ? "sync" : "async",
293415a613bSKumar Gala 			pci_agent ? "agent" : "host",
2947b626880SKumar Gala 			pci_arb ? "arbiter" : "external-arbiter",
2957b626880SKumar Gala 			pci_info[num].regs);
296415a613bSKumar Gala 
2977b626880SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
2987b626880SKumar Gala 					&pci1_hose, first_free_busno);
299415a613bSKumar Gala 
300415a613bSKumar Gala #ifdef CONFIG_PCIX_CHECK
3017b626880SKumar Gala 		if (!(pordevsr & MPC85xx_PORDEVSR_PCI1)) {
302415a613bSKumar Gala 			/* PCI-X init */
303415a613bSKumar Gala 			if (CONFIG_SYS_CLK_FREQ < 66000000)
304415a613bSKumar Gala 				printf("PCI-X will only work at 66 MHz\n");
305415a613bSKumar Gala 
306415a613bSKumar Gala 			reg16 = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
307415a613bSKumar Gala 				| PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
308415a613bSKumar Gala 			pci_hose_write_config_word(hose, bus, PCIX_COMMAND, reg16);
309415a613bSKumar Gala 		}
310415a613bSKumar Gala #endif
311415a613bSKumar Gala 	} else {
312415a613bSKumar Gala 		printf("PCI: disabled\n");
313415a613bSKumar Gala 	}
3147b626880SKumar Gala 
3157b626880SKumar Gala 	puts("\n");
316415a613bSKumar Gala #else
3177b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */
318415a613bSKumar Gala #endif
319415a613bSKumar Gala 
320415a613bSKumar Gala #ifdef CONFIG_PCI2
321415a613bSKumar Gala {
3227b626880SKumar Gala 	uint pci2_clk_sel = porpllsr & 0x4000;	/* PORPLLSR[17] */
323415a613bSKumar Gala 	uint pci_dual = get_pci_dual ();	/* PCI DUAL in CM_PCI[3] */
324415a613bSKumar Gala 	if (pci_dual) {
325415a613bSKumar Gala 		printf("PCI2: 32 bit, 66 MHz, %s\n",
326415a613bSKumar Gala 			pci2_clk_sel ? "sync" : "async");
327415a613bSKumar Gala 	} else {
328415a613bSKumar Gala 		printf("PCI2: disabled\n");
329415a613bSKumar Gala 	}
330415a613bSKumar Gala }
331415a613bSKumar Gala #else
3327b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI2); /* disable */
333415a613bSKumar Gala #endif /* CONFIG_PCI2 */
334415a613bSKumar Gala 
335415a613bSKumar Gala #ifdef CONFIG_PCIE1
336*5d27e02cSKumar Gala 	pcie_configured = is_serdes_configured(PCIE1);
337415a613bSKumar Gala 
3387b626880SKumar Gala 	if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){
3397b626880SKumar Gala 		SET_STD_PCIE_INFO(pci_info[num], 1);
3407b626880SKumar Gala 		pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs);
3418ca78f2cSPeter Tyser 		printf("PCIE1: connected to Slot as %s (base addr %lx)\n",
34264917ca3SPeter Tyser 			pcie_ep ? "Endpoint" : "Root Complex",
3437b626880SKumar Gala 			pci_info[num].regs);
344415a613bSKumar Gala 
3457b626880SKumar Gala 		first_free_busno = fsl_pci_init_port(&pci_info[num++],
3467b626880SKumar Gala 					&pcie1_hose, first_free_busno);
347415a613bSKumar Gala 	} else {
3487b626880SKumar Gala 		printf("PCIE1: disabled\n");
349415a613bSKumar Gala 	}
350415a613bSKumar Gala 
3517b626880SKumar Gala 	puts("\n");
3527b626880SKumar Gala #else
3537b626880SKumar Gala 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE); /* disable */
3547b626880SKumar Gala #endif
355415a613bSKumar Gala }
356415a613bSKumar Gala 
357415a613bSKumar Gala int last_stage_init(void)
358415a613bSKumar Gala {
359415a613bSKumar Gala 	unsigned short temp;
360415a613bSKumar Gala 
361415a613bSKumar Gala 	/* Change the resistors for the PHY */
362415a613bSKumar Gala 	/* This is needed to get the RGMII working for the 1.3+
363415a613bSKumar Gala 	 * CDS cards */
364415a613bSKumar Gala 	if (get_board_version() ==  0x13) {
365415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
366415a613bSKumar Gala 				TSEC1_PHY_ADDR, 29, 18);
367415a613bSKumar Gala 
368415a613bSKumar Gala 		miiphy_read(CONFIG_TSEC1_NAME,
369415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, &temp);
370415a613bSKumar Gala 
371415a613bSKumar Gala 		temp = (temp & 0xf03f);
372415a613bSKumar Gala 		temp |= 2 << 9;		/* 36 ohm */
373415a613bSKumar Gala 		temp |= 2 << 6;		/* 39 ohm */
374415a613bSKumar Gala 
375415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
376415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, temp);
377415a613bSKumar Gala 
378415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
379415a613bSKumar Gala 				TSEC1_PHY_ADDR, 29, 3);
380415a613bSKumar Gala 
381415a613bSKumar Gala 		miiphy_write(CONFIG_TSEC1_NAME,
382415a613bSKumar Gala 				TSEC1_PHY_ADDR, 30, 0x8000);
383415a613bSKumar Gala 	}
384415a613bSKumar Gala 
385415a613bSKumar Gala 	return 0;
386415a613bSKumar Gala }
387415a613bSKumar Gala 
388415a613bSKumar Gala 
389415a613bSKumar Gala #if defined(CONFIG_OF_BOARD_SETUP)
3902dba0deaSKumar Gala void ft_pci_setup(void *blob, bd_t *bd)
3912dba0deaSKumar Gala {
3926525d51fSKumar Gala 	FT_FSL_PCI_SETUP;
393415a613bSKumar Gala }
394415a613bSKumar Gala #endif
395