blob: 7269458fef35a2085e041b2b2cf0379f0cf42d76 [file] [log] [blame]
wdenk2d5b5612003-10-14 19:43:55 +00001/*
Wolfgang Denkba94a1b2006-05-30 15:56:48 +02002 * (C) Copyright 2006
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
wdenk2d5b5612003-10-14 19:43:55 +00005 * (C) Copyright 2002
6 * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
7 *
8 * (C) Copyright 2002
9 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
10 * Marius Groeger <mgroeger@sysgo.de>
11 *
12 * See file CREDITS for list of people who contributed to this
13 * project.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
29 */
30
wdenk2d5b5612003-10-14 19:43:55 +000031#include <common.h>
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020032#include <command.h>
33#include <malloc.h>
Ben Warren10efa022008-08-31 20:37:00 -070034#include <netdev.h>
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020035#include <asm/arch/ixp425.h>
Michael Schwingen973af332011-05-23 00:00:10 +020036#include <asm/io.h>
37#ifdef CONFIG_PCI
38#include <pci.h>
39#include <asm/arch/ixp425pci.h>
40#endif
wdenk2d5b5612003-10-14 19:43:55 +000041
Wolfgang Denkd87080b2006-03-31 18:32:53 +020042DECLARE_GLOBAL_DATA_PTR;
wdenk2d5b5612003-10-14 19:43:55 +000043
Michael Schwingen973af332011-05-23 00:00:10 +020044#define IXDP425_LED_PORT 0x52000000 /* 4-digit hex display */
45
46int board_early_init_f(void)
47{
48 /* CS2: LED port */
49 writel(0xbcff0002, IXP425_EXP_CS2);
50 writew(0x0001, IXDP425_LED_PORT); /* output postcode to LEDs */
51
52 return 0;
53}
54
55#ifdef CONFIG_PCI
56#ifndef CONFIG_PCI_PNP
57static struct pci_config_table pci_ixpdp425_config_table[] = {
58 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, PCI_ANY_ID,
59 pci_cfgfunc_config_device,
60 { 0x400,
61 0x40000000,
62 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
63
64 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x01, PCI_ANY_ID,
65 pci_cfgfunc_config_device,
66 { 0x800,
67 0x40010000,
68 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
69
70 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x02, PCI_ANY_ID,
71 pci_cfgfunc_config_device,
72 { 0xc00,
73 0x40020000,
74 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
75
76 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x03, PCI_ANY_ID,
77 pci_cfgfunc_config_device,
78 { 0x1000,
79 0x40030000,
80 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
81 { }
82};
83#endif
84
85struct pci_controller hose = {
86#ifndef CONFIG_PCI_PNP
87 config_table: pci_ixpdp425_config_table,
88#endif
89};
90#endif /* CONFIG_PCI */
91
92
wdenk2d5b5612003-10-14 19:43:55 +000093/*
94 * Miscelaneous platform dependent initialisations
95 */
Michael Schwingen973af332011-05-23 00:00:10 +020096int board_init(void)
wdenk2d5b5612003-10-14 19:43:55 +000097{
Michael Schwingen973af332011-05-23 00:00:10 +020098 writew(0x0002, IXDP425_LED_PORT); /* output postcode to LEDs */
99
100#ifdef CONFIG_IXDPG425
101 /* arch number of IXDP */
102 gd->bd->bi_arch_number = MACH_TYPE_IXDPG425;
103#else
wdenk2d5b5612003-10-14 19:43:55 +0000104 /* arch number of IXDP */
wdenk731215e2004-10-10 18:41:04 +0000105 gd->bd->bi_arch_number = MACH_TYPE_IXDP425;
Michael Schwingen973af332011-05-23 00:00:10 +0200106#endif
wdenk2d5b5612003-10-14 19:43:55 +0000107
108 /* adress of boot parameters */
109 gd->bd->bi_boot_params = 0x00000100;
110
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200111#ifdef CONFIG_IXDPG425
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200112 /*
113 * Get realtek RTL8305 switch and SLIC out of reset
114 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200115 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SWITCH_RESET_N);
116 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_SWITCH_RESET_N);
117 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SLIC_RESET_N);
118 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_SLIC_RESET_N);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200119
120 /*
Michael Schwingen973af332011-05-23 00:00:10 +0200121 * Setup GPIOs for PCI INTA & INTB
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200122 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200123 GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTA_N);
124 GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTA_N);
125 GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTB_N);
126 GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTB_N);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200127
Michael Schwingen973af332011-05-23 00:00:10 +0200128 /* Setup GPIOs for 33MHz clock output */
129 writel(0x01FF01FF, IXP425_GPIO_GPCLKR);
130
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200131 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
132 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
Michael Schwingen973af332011-05-23 00:00:10 +0200133
134 /* set GPIO8..11 interrupt type to active low */
135 writel((0x1 << 9) | (0x1 << 6) | (0x1 << 3) | 0x1, IXP425_GPIO_GPIT2R);
136
137 /* clear pending interrupts */
138 writel(-1, IXP425_GPIO_GPISR);
139
140 /* assert PCI reset */
141 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_SLIC_RESET_N);
142
143 udelay(533);
144
145 /* deassert PCI reset */
146 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SLIC_RESET_N);
147
148 udelay(533);
149
150#else /* IXDP425 */
151 /* Setup GPIOs for 33MHz ExpBus and PCI clock output */
152 writel(0x01FF01FF, IXP425_GPIO_GPCLKR);
153 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
154 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
155 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_RESET_N);
156
157 /* set GPIO8..11 interrupt type to active low */
158 writel((0x1 << 9) | (0x1 << 6) | (0x1 << 3) | 0x1, IXP425_GPIO_GPIT2R);
159 /* clear pending interrupts */
160 writel(-1, IXP425_GPIO_GPISR);
161
162 /* assert PCI reset */
163 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_PCI_RESET_N);
164
165 udelay(533);
166
167 /* deassert PCI reset */
168 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_PCI_RESET_N);
169
170 udelay(533);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200171#endif
172
wdenk2d5b5612003-10-14 19:43:55 +0000173 return 0;
174}
175
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200176/*
177 * Check Board Identity
178 */
179int checkboard(void)
180{
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000181 char buf[64];
182 int i = getenv_f("serial#", buf, sizeof(buf));
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200183
184#ifdef CONFIG_IXDPG425
185 puts("Board: IXDPG425 - Intel Network Gateway Reference Platform");
186#else
187 puts("Board: IXDP425 - Intel Development Platform");
188#endif
189
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000190 if (i > 0) {
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200191 puts(", serial# ");
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000192 puts(buf);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200193 }
194 putc('\n');
195
Michael Schwingen973af332011-05-23 00:00:10 +0200196 return 0;
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200197}
wdenk289f9322005-01-12 00:15:14 +0000198
Michael Schwingen973af332011-05-23 00:00:10 +0200199int dram_init(void)
wdenk2d5b5612003-10-14 19:43:55 +0000200{
Michael Schwingen973af332011-05-23 00:00:10 +0200201 /* we can only map 64MB via PCI, so we limit memory
202 until a better solution is implemented. */
203#ifdef CONFIG_PCI
204 gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 64<<20);
205#else
206 gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 256<<20);
207#endif
208 return 0;
wdenk2d5b5612003-10-14 19:43:55 +0000209}
wdenk289f9322005-01-12 00:15:14 +0000210
Michael Schwingen973af332011-05-23 00:00:10 +0200211#ifdef CONFIG_PCI
wdenka1191902005-01-09 17:12:27 +0000212void pci_init_board(void)
213{
214 pci_ixp_init(&hose);
wdenka1191902005-01-09 17:12:27 +0000215}
Michael Schwingen973af332011-05-23 00:00:10 +0200216
217/*
218 * dev 0 on the PCI bus is not the host bridge, so we have to override
219 * these functions in order to not skip PCI slot 0 during configuration.
220*/
221int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
222{
223 return 0;
224}
225int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
226{
227 return 1;
228}
229
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200230#endif
Ben Warren10efa022008-08-31 20:37:00 -0700231
232int board_eth_init(bd_t *bis)
233{
Michael Schwingen973af332011-05-23 00:00:10 +0200234#ifdef CONFIG_PCI
235 pci_eth_init(bis);
236#endif
237 return cpu_eth_init(bis);
Ben Warren10efa022008-08-31 20:37:00 -0700238}