blob: 09f11bb4f30fd8d11858094991f4eb6970a13cfc [file] [log] [blame]
wdenk7a8e9bed2003-05-31 18:35:21 +00001/*
wdenk8bde7f72003-06-27 21:31:46 +00002 *
wdenk7a8e9bed2003-05-31 18:35:21 +00003 * (C) Copyright 2002
4 * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 */
24
25#include <common.h>
Ben Warren10efa022008-08-31 20:37:00 -070026#include <netdev.h>
Graeme Russ91ee4e12009-08-23 12:59:54 +100027#include <ds1722.h>
wdenk7a8e9bed2003-05-31 18:35:21 +000028#include <asm/io.h>
wdenk7a8e9bed2003-05-31 18:35:21 +000029#include <asm/ic/sc520.h>
Graeme Russ91ee4e12009-08-23 12:59:54 +100030#include <asm/ic/ssi.h>
wdenk7a8e9bed2003-05-31 18:35:21 +000031
Wolfgang Denkd87080b2006-03-31 18:32:53 +020032DECLARE_GLOBAL_DATA_PTR;
wdenk8bde7f72003-06-27 21:31:46 +000033
34/*
wdenk7a8e9bed2003-05-31 18:35:21 +000035 * Theory:
36 * We first set up all IRQs to be non-pci, edge triggered,
wdenk8bde7f72003-06-27 21:31:46 +000037 * when we later enumerate the pci bus and pci_sc520_fixup_irq() gets
wdenk7a8e9bed2003-05-31 18:35:21 +000038 * called we reallocate irqs to the pci bus with sc520_pci_set_irq()
39 * as needed. Whe choose the irqs to gram from a configurable list
40 * inside pci_sc520_fixup_irq() (If this list contains stupid irq's
41 * such as 0 thngas will not work)
42 */
43
44static void irq_init(void)
45{
46 /* disable global interrupt mode */
Graeme Russed7a1b62009-08-23 12:59:56 +100047 sc520_mmcr->picicr = 0x40;
wdenk8bde7f72003-06-27 21:31:46 +000048
wdenk7a8e9bed2003-05-31 18:35:21 +000049 /* set all irqs to edge */
Graeme Russed7a1b62009-08-23 12:59:56 +100050 sc520_mmcr->pic_mode[0] = 0x00;
51 sc520_mmcr->pic_mode[1] = 0x00;
52 sc520_mmcr->pic_mode[2] = 0x00;
wdenk8bde7f72003-06-27 21:31:46 +000053
54 /* active low polarity on PIC interrupt pins,
wdenk7a8e9bed2003-05-31 18:35:21 +000055 * active high polarity on all other irq pins */
Graeme Russed7a1b62009-08-23 12:59:56 +100056 sc520_mmcr->intpinpol = 0x0000;
wdenk7a8e9bed2003-05-31 18:35:21 +000057
58 /* set irq number mapping */
Graeme Russed7a1b62009-08-23 12:59:56 +100059 sc520_mmcr->gp_tmr_int_map[0] = SC520_IRQ_DISABLED; /* disable GP timer 0 INT */
60 sc520_mmcr->gp_tmr_int_map[1] = SC520_IRQ_DISABLED; /* disable GP timer 1 INT */
61 sc520_mmcr->gp_tmr_int_map[2] = SC520_IRQ_DISABLED; /* disable GP timer 2 INT */
62 sc520_mmcr->pit_int_map[0] = SC520_IRQ0; /* Set PIT timer 0 INT to IRQ0 */
63 sc520_mmcr->pit_int_map[1] = SC520_IRQ_DISABLED; /* disable PIT timer 1 INT */
64 sc520_mmcr->pit_int_map[2] = SC520_IRQ_DISABLED; /* disable PIT timer 2 INT */
65 sc520_mmcr->pci_int_map[0] = SC520_IRQ_DISABLED; /* disable PCI INT A */
66 sc520_mmcr->pci_int_map[1] = SC520_IRQ_DISABLED; /* disable PCI INT B */
67 sc520_mmcr->pci_int_map[2] = SC520_IRQ_DISABLED; /* disable PCI INT C */
68 sc520_mmcr->pci_int_map[3] = SC520_IRQ_DISABLED; /* disable PCI INT D */
69 sc520_mmcr->dmabcintmap = SC520_IRQ_DISABLED; /* disable DMA INT */
70 sc520_mmcr->ssimap = SC520_IRQ6; /* Set Synchronius serial INT to IRQ6*/
71 sc520_mmcr->wdtmap = SC520_IRQ_DISABLED; /* disable Watchdog INT */
72 sc520_mmcr->rtcmap = SC520_IRQ8; /* Set RTC int to 8 */
73 sc520_mmcr->wpvmap = SC520_IRQ_DISABLED; /* disable write protect INT */
74 sc520_mmcr->icemap = SC520_IRQ1; /* Set ICE Debug Serielport INT to IRQ1 */
75 sc520_mmcr->ferrmap = SC520_IRQ13; /* Set FP error INT to IRQ13 */
wdenk8bde7f72003-06-27 21:31:46 +000076
wdenk8bde7f72003-06-27 21:31:46 +000077
Graeme Russed7a1b62009-08-23 12:59:56 +100078 sc520_mmcr->uart_int_map[0] = SC520_IRQ4; /* Set internal UART1 INT to IRQ4 */
79 sc520_mmcr->uart_int_map[1] = SC520_IRQ3; /* Set internal UART2 INT to IRQ3 */
wdenk8bde7f72003-06-27 21:31:46 +000080
Graeme Russed7a1b62009-08-23 12:59:56 +100081 sc520_mmcr->gp_int_map[0] = SC520_IRQ7; /* Set GPIRQ0 (PC-Card AUX IRQ) to IRQ7 */
82 sc520_mmcr->gp_int_map[1] = SC520_IRQ14; /* Set GPIRQ1 (CF IRQ) to IRQ14 */
83 sc520_mmcr->gp_int_map[3] = SC520_IRQ5; /* Set GPIRQ3 ( CAN IRQ ) ti IRQ5 */
84 sc520_mmcr->gp_int_map[4] = SC520_IRQ_DISABLED; /* disbale GIRQ4 ( IRR IRQ ) */
85 sc520_mmcr->gp_int_map[5] = SC520_IRQ_DISABLED; /* disable GPIRQ5 */
86 sc520_mmcr->gp_int_map[6] = SC520_IRQ_DISABLED; /* disable GPIRQ6 */
87 sc520_mmcr->gp_int_map[7] = SC520_IRQ_DISABLED; /* disable GPIRQ7 */
88 sc520_mmcr->gp_int_map[8] = SC520_IRQ_DISABLED; /* disable GPIRQ8 */
89 sc520_mmcr->gp_int_map[9] = SC520_IRQ_DISABLED; /* disable GPIRQ9 */
90 sc520_mmcr->gp_int_map[2] = SC520_IRQ_DISABLED; /* disable GPIRQ2 */
91 sc520_mmcr->gp_int_map[10] = SC520_IRQ_DISABLED; /* disable GPIRQ10 */
92
93 sc520_mmcr->pcihostmap = 0x11f; /* Map PCI hostbridge INT to NMI */
94 sc520_mmcr->eccmap = 0x100; /* Map SDRAM ECC failure INT to NMI */
wdenk8bde7f72003-06-27 21:31:46 +000095
wdenk7a8e9bed2003-05-31 18:35:21 +000096}
97
wdenk7a8e9bed2003-05-31 18:35:21 +000098/* set up the ISA bus timing and system address mappings */
99static void bus_init(void)
100{
wdenk8bde7f72003-06-27 21:31:46 +0000101 /* versions
wdenk7a8e9bed2003-05-31 18:35:21 +0000102 * 0 Hyglo versions 0.95 and 0.96 (large baords)
103 * ?? Hyglo version 0.97 (small board)
104 * 10 Spunk board
105 */
Graeme Russed7a1b62009-08-23 12:59:56 +1000106 int version = sc520_mmcr->sysinfo;
wdenk8bde7f72003-06-27 21:31:46 +0000107
wdenk7a8e9bed2003-05-31 18:35:21 +0000108 if (version) {
109 /* set up the GP IO pins (for the Spunk board) */
Graeme Russed7a1b62009-08-23 12:59:56 +1000110 sc520_mmcr->piopfs31_16 = 0xfff0; /* set the GPIO pin function 31-16 reg */
111 sc520_mmcr->piopfs15_0 = 0x000f; /* set the GPIO pin function 15-0 reg */
112 sc520_mmcr->piodir31_16 = 0x000f; /* set the GPIO direction 31-16 reg */
113 sc520_mmcr->piodir15_0 = 0x1ff0; /* set the GPIO direction 15-0 reg */
114 sc520_mmcr->cspfs = 0xc0; /* set the CS pin function reg */
115 sc520_mmcr->clksel = 0x70;
wdenk8bde7f72003-06-27 21:31:46 +0000116
Graeme Russed7a1b62009-08-23 12:59:56 +1000117 sc520_mmcr->pioclr31_16 = 0x0003; /* reset SSI chip-selects */
118 sc520_mmcr->pioset31_16 = 0x000c;
wdenk7a8e9bed2003-05-31 18:35:21 +0000119
120 } else {
121 /* set up the GP IO pins (for the Hyglo board) */
Graeme Russed7a1b62009-08-23 12:59:56 +1000122 sc520_mmcr->piopfs31_16 = 0xffc0; /* set the GPIO pin function 31-16 reg */
123 sc520_mmcr->piopfs15_0 = 0x1e7f; /* set the GPIO pin function 15-0 reg */
124 sc520_mmcr->piodir31_16 = 0x003f; /* set the GPIO direction 31-16 reg */
125 sc520_mmcr->piodir15_0 = 0xe180; /* set the GPIO direction 15-0 reg */
126 sc520_mmcr->cspfs = 0x00; /* set the CS pin function reg */
127 sc520_mmcr->clksel = 0x70;
wdenk8bde7f72003-06-27 21:31:46 +0000128
Graeme Russed7a1b62009-08-23 12:59:56 +1000129 sc520_mmcr->pioclr15_0 = 0x0180; /* reset SSI chip-selects */
wdenk7a8e9bed2003-05-31 18:35:21 +0000130 }
wdenk8bde7f72003-06-27 21:31:46 +0000131
Graeme Russed7a1b62009-08-23 12:59:56 +1000132 sc520_mmcr->gpcsrt = 1; /* set the GP CS offset */
133 sc520_mmcr->gpcspw = 3; /* set the GP CS pulse width */
134 sc520_mmcr->gpcsoff = 1; /* set the GP CS offset */
135 sc520_mmcr->gprdw = 3; /* set the RD pulse width */
136 sc520_mmcr->gprdoff = 1; /* set the GP RD offset */
137 sc520_mmcr->gpwrw = 3; /* set the GP WR pulse width */
138 sc520_mmcr->gpwroff = 1; /* set the GP WR offset */
wdenk7a8e9bed2003-05-31 18:35:21 +0000139
Graeme Russed7a1b62009-08-23 12:59:56 +1000140 sc520_mmcr->bootcsctl = 0x0407; /* set up timing of BOOTCS */
wdenk8bde7f72003-06-27 21:31:46 +0000141
wdenk7a8e9bed2003-05-31 18:35:21 +0000142 /* adjust the memory map:
143 * by default the first 256MB (0x00000000 - 0x0fffffff) is mapped to SDRAM
144 * and 256MB to 1G-128k (0x1000000 - 0x37ffffff) is mapped to PCI mmio
wdenk8bde7f72003-06-27 21:31:46 +0000145 * we need to map 1G-128k - 1G (0x38000000 - 0x3fffffff) to CS1 */
146
147
wdenk7a8e9bed2003-05-31 18:35:21 +0000148 /* bootcs */
Graeme Russed7a1b62009-08-23 12:59:56 +1000149 sc520_mmcr->par[12] = 0x8bffe800;
wdenk8bde7f72003-06-27 21:31:46 +0000150
wdenk7a8e9bed2003-05-31 18:35:21 +0000151 /* IDE0 = GPCS6 1f0-1f7 */
Graeme Russed7a1b62009-08-23 12:59:56 +1000152 sc520_mmcr->par[3] = 0x380801f0;
wdenk7a8e9bed2003-05-31 18:35:21 +0000153
154 /* IDE1 = GPCS7 3f6 */
Graeme Russed7a1b62009-08-23 12:59:56 +1000155 sc520_mmcr->par[4] = 0x3c0003f6;
wdenk7a8e9bed2003-05-31 18:35:21 +0000156
wdenk8bde7f72003-06-27 21:31:46 +0000157 asm ("wbinvd\n"); /* Flush cache, req. after setting the unchached attribute ona PAR */
wdenk7a8e9bed2003-05-31 18:35:21 +0000158
Graeme Russed7a1b62009-08-23 12:59:56 +1000159 sc520_mmcr->adddecctl = sc520_mmcr->adddecctl & ~(UART2_DIS|UART1_DIS);
wdenk7a8e9bed2003-05-31 18:35:21 +0000160
161}
162
163
wdenk7a8e9bed2003-05-31 18:35:21 +0000164/* par usage:
165 * PAR0 (legacy_video)
166 * PAR1 (PCI ROM mapping)
wdenk8bde7f72003-06-27 21:31:46 +0000167 * PAR2
168 * PAR3 IDE
wdenk7a8e9bed2003-05-31 18:35:21 +0000169 * PAR4 IDE
170 * PAR5 (legacy_video)
wdenk8bde7f72003-06-27 21:31:46 +0000171 * PAR6
wdenk7a8e9bed2003-05-31 18:35:21 +0000172 * PAR7 (legacy_video)
173 * PAR8 (legacy_video)
174 * PAR9 (legacy_video)
175 * PAR10
176 * PAR11 (ISAROM)
177 * PAR12 BOOTCS
178 * PAR13
179 * PAR14
180 * PAR15
181 */
182
wdenk8bde7f72003-06-27 21:31:46 +0000183/*
wdenk7a8e9bed2003-05-31 18:35:21 +0000184 * Miscelaneous platform dependent initialisations
185 */
186
187int board_init(void)
188{
wdenk8bde7f72003-06-27 21:31:46 +0000189 init_sc520();
wdenk7a8e9bed2003-05-31 18:35:21 +0000190 bus_init();
191 irq_init();
wdenk8bde7f72003-06-27 21:31:46 +0000192
wdenk7a8e9bed2003-05-31 18:35:21 +0000193 /* max drive current on SDRAM */
Graeme Russed7a1b62009-08-23 12:59:56 +1000194 sc520_mmcr->dsctl = 0x0100;
wdenk8bde7f72003-06-27 21:31:46 +0000195
wdenk7a8e9bed2003-05-31 18:35:21 +0000196 /* enter debug mode after next reset (only if jumper is also set) */
Graeme Russed7a1b62009-08-23 12:59:56 +1000197 sc520_mmcr->rescfg = 0x08;
wdenk7a8e9bed2003-05-31 18:35:21 +0000198 /* configure the software timer to 33.000MHz */
Graeme Russed7a1b62009-08-23 12:59:56 +1000199 sc520_mmcr->swtmrcfg = 1;
wdenk7a8e9bed2003-05-31 18:35:21 +0000200 gd->bus_clk = 33000000;
wdenk8bde7f72003-06-27 21:31:46 +0000201
wdenk7a8e9bed2003-05-31 18:35:21 +0000202 return 0;
203}
204
205int dram_init(void)
206{
207 init_sc520_dram();
208 return 0;
209}
210
211void show_boot_progress(int val)
212{
Graeme Russed7a1b62009-08-23 12:59:56 +1000213 int version = sc520_mmcr->sysinfo;
wdenk8bde7f72003-06-27 21:31:46 +0000214
Heiko Schocher566a4942007-06-22 19:11:54 +0200215 if (val < -32) val = -1; /* let things compatible */
wdenk7a8e9bed2003-05-31 18:35:21 +0000216 if (version == 0) {
217 /* PIO31-PIO16 Data */
Graeme Russed7a1b62009-08-23 12:59:56 +1000218 sc520_mmcr->piodata31_16 = (sc520_mmcr->piodata31_16 & 0xffc0) | ((val&0x7e)>>1); /* 0x1f8 >> 3 */
wdenk8bde7f72003-06-27 21:31:46 +0000219
wdenk7a8e9bed2003-05-31 18:35:21 +0000220 /* PIO0-PIO15 Data */
Graeme Russed7a1b62009-08-23 12:59:56 +1000221 sc520_mmcr->piodata15_0 = (sc520_mmcr->piodata15_0 & 0x1fff)| ((val&0x7)<<13);
wdenk7a8e9bed2003-05-31 18:35:21 +0000222 } else {
223 /* newer boards use PIO4-PIO12 */
224 /* PIO0-PIO15 Data */
wdenk8bde7f72003-06-27 21:31:46 +0000225#if 0
226 val = (val & 0x007) | ((val & 0x038) << 3) | ((val & 0x1c0) >> 3);
wdenk7a8e9bed2003-05-31 18:35:21 +0000227#else
wdenk8bde7f72003-06-27 21:31:46 +0000228 val = (val & 0x007) | ((val & 0x07e) << 2);
wdenk7a8e9bed2003-05-31 18:35:21 +0000229#endif
Graeme Russed7a1b62009-08-23 12:59:56 +1000230 sc520_mmcr->piodata15_0 = (sc520_mmcr->piodata15_0 & 0xe00f) | ((val&0x01ff)<<4);
wdenk7a8e9bed2003-05-31 18:35:21 +0000231 }
232}
233
234
235int last_stage_init(void)
236{
wdenk8bde7f72003-06-27 21:31:46 +0000237
Graeme Russed7a1b62009-08-23 12:59:56 +1000238 int version = sc520_mmcr->sysinfo;
wdenk8bde7f72003-06-27 21:31:46 +0000239
wdenk7a8e9bed2003-05-31 18:35:21 +0000240 printf("Omicron Ceti SC520 Spunk revision %x\n", version);
wdenk8bde7f72003-06-27 21:31:46 +0000241
wdenk7a8e9bed2003-05-31 18:35:21 +0000242#if 0
243 if (version) {
244 int x, y;
wdenk8bde7f72003-06-27 21:31:46 +0000245
wdenk7a8e9bed2003-05-31 18:35:21 +0000246 printf("eeprom probe %d\n", spi_eeprom_probe(1));
wdenk8bde7f72003-06-27 21:31:46 +0000247
wdenk7a8e9bed2003-05-31 18:35:21 +0000248 spi_eeprom_read(1, 0, (u8*)&x, 2);
249 spi_eeprom_read(1, 1, (u8*)&y, 2);
250 printf("eeprom bytes %04x%04x\n", x, y);
251 x ^= 0xffff;
252 y ^= 0xffff;
253 spi_eeprom_write(1, 0, (u8*)&x, 2);
254 spi_eeprom_write(1, 1, (u8*)&y, 2);
wdenk8bde7f72003-06-27 21:31:46 +0000255
wdenk7a8e9bed2003-05-31 18:35:21 +0000256 spi_eeprom_read(1, 0, (u8*)&x, 2);
257 spi_eeprom_read(1, 1, (u8*)&y, 2);
258 printf("eeprom bytes %04x%04x\n", x, y);
wdenk8bde7f72003-06-27 21:31:46 +0000259
wdenk7a8e9bed2003-05-31 18:35:21 +0000260 } else {
261 int x, y;
wdenk8bde7f72003-06-27 21:31:46 +0000262
wdenk7a8e9bed2003-05-31 18:35:21 +0000263 printf("eeprom probe %d\n", mw_eeprom_probe(1));
wdenk8bde7f72003-06-27 21:31:46 +0000264
wdenk7a8e9bed2003-05-31 18:35:21 +0000265 mw_eeprom_read(1, 0, (u8*)&x, 2);
266 mw_eeprom_read(1, 1, (u8*)&y, 2);
267 printf("eeprom bytes %04x%04x\n", x, y);
wdenk8bde7f72003-06-27 21:31:46 +0000268
wdenk7a8e9bed2003-05-31 18:35:21 +0000269 x ^= 0xffff;
270 y ^= 0xffff;
271 mw_eeprom_write(1, 0, (u8*)&x, 2);
272 mw_eeprom_write(1, 1, (u8*)&y, 2);
wdenk8bde7f72003-06-27 21:31:46 +0000273
wdenk7a8e9bed2003-05-31 18:35:21 +0000274 mw_eeprom_read(1, 0, (u8*)&x, 2);
275 mw_eeprom_read(1, 1, (u8*)&y, 2);
276 printf("eeprom bytes %04x%04x\n", x, y);
wdenk8bde7f72003-06-27 21:31:46 +0000277
278
wdenk7a8e9bed2003-05-31 18:35:21 +0000279 }
280#endif
281
282 ds1722_probe(2);
wdenk8bde7f72003-06-27 21:31:46 +0000283
wdenk7a8e9bed2003-05-31 18:35:21 +0000284 return 0;
285}
286
wdenk8bde7f72003-06-27 21:31:46 +0000287void ssi_chip_select(int dev)
wdenk7a8e9bed2003-05-31 18:35:21 +0000288{
Graeme Russed7a1b62009-08-23 12:59:56 +1000289 int version = sc520_mmcr->sysinfo;
wdenk8bde7f72003-06-27 21:31:46 +0000290
wdenk7a8e9bed2003-05-31 18:35:21 +0000291 if (version) {
292 /* Spunk board: EEPROM and CAN are actove-low, TEMP and AUX are active high */
293 switch (dev) {
294 case 1: /* EEPROM */
Graeme Russed7a1b62009-08-23 12:59:56 +1000295 sc520_mmcr->pioclr31_16 = 0x0004;
wdenk7a8e9bed2003-05-31 18:35:21 +0000296 break;
wdenk8bde7f72003-06-27 21:31:46 +0000297
wdenk7a8e9bed2003-05-31 18:35:21 +0000298 case 2: /* Temp Probe */
Graeme Russed7a1b62009-08-23 12:59:56 +1000299 sc520_mmcr->pioset31_16 = 0x0002;
wdenk7a8e9bed2003-05-31 18:35:21 +0000300 break;
wdenk8bde7f72003-06-27 21:31:46 +0000301
wdenk7a8e9bed2003-05-31 18:35:21 +0000302 case 3: /* CAN */
Graeme Russed7a1b62009-08-23 12:59:56 +1000303 sc520_mmcr->pioclr31_16 = 0x0008;
wdenk7a8e9bed2003-05-31 18:35:21 +0000304 break;
wdenk8bde7f72003-06-27 21:31:46 +0000305
306 case 4: /* AUX */
Graeme Russed7a1b62009-08-23 12:59:56 +1000307 sc520_mmcr->pioset31_16 = 0x0001;
wdenk7a8e9bed2003-05-31 18:35:21 +0000308 break;
wdenk8bde7f72003-06-27 21:31:46 +0000309
wdenk7a8e9bed2003-05-31 18:35:21 +0000310 case 0:
Graeme Russed7a1b62009-08-23 12:59:56 +1000311 sc520_mmcr->pioclr31_16 = 0x0003;
312 sc520_mmcr->pioset31_16 = 0x000c;
wdenk7a8e9bed2003-05-31 18:35:21 +0000313 break;
wdenk8bde7f72003-06-27 21:31:46 +0000314
wdenk7a8e9bed2003-05-31 18:35:21 +0000315 default:
316 printf("Illegal SSI device requested: %d\n", dev);
317 }
318 } else {
wdenk8bde7f72003-06-27 21:31:46 +0000319
wdenk7a8e9bed2003-05-31 18:35:21 +0000320 /* Globox board: Both EEPROM and TEMP are active-high */
321
322 switch (dev) {
323 case 1: /* EEPROM */
Graeme Russed7a1b62009-08-23 12:59:56 +1000324 sc520_mmcr->pioset15_0 = 0x0100;
wdenk7a8e9bed2003-05-31 18:35:21 +0000325 break;
wdenk8bde7f72003-06-27 21:31:46 +0000326
wdenk7a8e9bed2003-05-31 18:35:21 +0000327 case 2: /* Temp Probe */
Graeme Russed7a1b62009-08-23 12:59:56 +1000328 sc520_mmcr->pioset15_0 = 0x0080;
wdenk7a8e9bed2003-05-31 18:35:21 +0000329 break;
wdenk8bde7f72003-06-27 21:31:46 +0000330
wdenk7a8e9bed2003-05-31 18:35:21 +0000331 case 0:
Graeme Russed7a1b62009-08-23 12:59:56 +1000332 sc520_mmcr->pioclr15_0 = 0x0180;
wdenk7a8e9bed2003-05-31 18:35:21 +0000333 break;
wdenk8bde7f72003-06-27 21:31:46 +0000334
wdenk7a8e9bed2003-05-31 18:35:21 +0000335 default:
336 printf("Illegal SSI device requested: %d\n", dev);
337 }
wdenk8bde7f72003-06-27 21:31:46 +0000338 }
wdenk7a8e9bed2003-05-31 18:35:21 +0000339}
340
Graeme Russ91ee4e12009-08-23 12:59:54 +1000341void spi_eeprom_probe(int x)
342{
343}
344
345int spi_eeprom_read(int x, int offset, uchar *buffer, int len)
346{
347 return 0;
348}
349
350int spi_eeprom_write(int x, int offset, uchar *buffer, int len)
351{
352 return 0;
353}
354
355void mw_eeprom_probe(int x)
356{
357}
358
359int mw_eeprom_read(int x, int offset, uchar *buffer, int len)
360{
361 return 0;
362}
363
364int mw_eeprom_write(int x, int offset, uchar *buffer, int len)
365{
366 return 0;
367}
wdenk7a8e9bed2003-05-31 18:35:21 +0000368
wdenk8bde7f72003-06-27 21:31:46 +0000369void spi_init_f(void)
wdenk7a8e9bed2003-05-31 18:35:21 +0000370{
Graeme Russed7a1b62009-08-23 12:59:56 +1000371 sc520_mmcr->sysinfo ? spi_eeprom_probe(1) : mw_eeprom_probe(1);
wdenk8bde7f72003-06-27 21:31:46 +0000372
wdenk7a8e9bed2003-05-31 18:35:21 +0000373}
374
wdenk8bde7f72003-06-27 21:31:46 +0000375ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len)
wdenk7a8e9bed2003-05-31 18:35:21 +0000376{
377 int offset;
378 int i;
wdenk8bde7f72003-06-27 21:31:46 +0000379
wdenk7a8e9bed2003-05-31 18:35:21 +0000380 offset = 0;
381 for (i=0;i<alen;i++) {
382 offset <<= 8;
383 offset |= addr[i];
384 }
wdenk8bde7f72003-06-27 21:31:46 +0000385
Graeme Russed7a1b62009-08-23 12:59:56 +1000386 return sc520_mmcr->sysinfo ?
wdenk8bde7f72003-06-27 21:31:46 +0000387 spi_eeprom_read(1, offset, buffer, len) :
wdenk7a8e9bed2003-05-31 18:35:21 +0000388 mw_eeprom_read(1, offset, buffer, len);
389}
390
wdenk8bde7f72003-06-27 21:31:46 +0000391ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
wdenk7a8e9bed2003-05-31 18:35:21 +0000392{
393 int offset;
394 int i;
wdenk8bde7f72003-06-27 21:31:46 +0000395
wdenk7a8e9bed2003-05-31 18:35:21 +0000396 offset = 0;
397 for (i=0;i<alen;i++) {
398 offset <<= 8;
399 offset |= addr[i];
400 }
wdenk8bde7f72003-06-27 21:31:46 +0000401
Graeme Russed7a1b62009-08-23 12:59:56 +1000402 return sc520_mmcr->sysinfo ?
wdenk8bde7f72003-06-27 21:31:46 +0000403 spi_eeprom_write(1, offset, buffer, len) :
wdenk7a8e9bed2003-05-31 18:35:21 +0000404 mw_eeprom_write(1, offset, buffer, len);
405}
Ben Warren10efa022008-08-31 20:37:00 -0700406
407int board_eth_init(bd_t *bis)
408{
409 return pci_eth_init(bis);
410}