* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)
* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)
diff --git a/board/eltec/bab7xx/Makefile b/board/eltec/bab7xx/Makefile
index 6e412c2..7d8ed26 100644
--- a/board/eltec/bab7xx/Makefile
+++ b/board/eltec/bab7xx/Makefile
@@ -30,7 +30,7 @@
SOBJS = asm_init.o
$(LIB): .depend $(OBJS) $(SOBJS)
- $(AR) crv $@ $^
+ $(AR) crv $@ $(OBJS) $(SOBJS)
clean:
rm -f $(SOBJS) $(OBJS)
@@ -46,12 +46,3 @@
sinclude .depend
#########################################################################
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/bab7xx/asm_init.S b/board/eltec/bab7xx/asm_init.S
index 934fabe..3f88bc2 100644
--- a/board/eltec/bab7xx/asm_init.S
+++ b/board/eltec/bab7xx/asm_init.S
@@ -204,7 +204,7 @@
beq SD16MB2B
li r3, 0x0011 /* get number of internal banks */
- /* from spd for bank0/1 */
+ /* from spd for bank0/1 */
bl spdRead
cmpli 0, 0, r3, 0x02
@@ -244,7 +244,7 @@
* set the Memory Configuration Reg. 2
*/
li r3, 0x0111 /* get number of internal banks */
- /* from spd for bank2/3 */
+ /* from spd for bank2/3 */
bl spdRead
cmpli 0, 0, r3, 0x02
@@ -269,13 +269,13 @@
*/
S2D64MB4B:
lis r21, 0x8630 /* BSTOPRE = 0x80, REFREC = 6, */
- /* RDLAT = 3 */
+ /* RDLAT = 3 */
/*
* set the Memory Configuration Reg. 4
*/
lis r22, 0x2430 /* PRETOACT = 2, ACTOPRE = 4, */
- /* WCBUF = 1, RCBUF = 1 */
+ /* WCBUF = 1, RCBUF = 1 */
ori r22, r22, 0x2220 /* SDMODE = 0x022, ACTORW = 2 */
/*
@@ -285,10 +285,10 @@
bl spdRead
rlwinm r16, r3, 2, 24, 29 /* calculate size in MByte */
- /* (128 MB max.) */
+ /* (128 MB max.) */
li r3, 0x0005 /* get number of banks from spd */
- /* for bank0/1 */
+ /* for bank0/1 */
bl spdRead
cmpi 0, 0, r3, 2 /* 2 banks ? */
@@ -336,10 +336,10 @@
bl spdRead
rlwinm r18, r3, 2, 24, 29 /* calculate size in MByte */
- /* (128 MB max.) */
+ /* (128 MB max.) */
li r3, 0x0105 /* get number of banks from */
- /* spd bank0/1 */
+ /* spd bank0/1 */
bl spdRead
cmpi 0, 0, r3, 2 /* 2 banks ? */
@@ -365,7 +365,7 @@
getSpdRowBank01:
li r3, 0x0003 /* get number of row bits from */
- /* spd from bank0/1 */
+ /* spd from bank0/1 */
bl spdRead
ori r20, r20, (MCCR1_BK0_9BITS | MCCR1_BK1_9BITS)
cmpli 0, 0, r3, 0x0009 /* bank0 - 9 row bits */
@@ -392,7 +392,7 @@
getSpdRowBank23:
li r3, 0x0103 /* get number of row bits from */
- /* spd for bank2/3 */
+ /* spd for bank2/3 */
bl spdRead
ori r20, r20, (MCCR1_BK2_9BITS | MCCR1_BK3_9BITS)
@@ -415,13 +415,13 @@
writeRowBits:
lis r21, 0x000a /* CPX = 1, RAS6P = 4 */
ori r21, r21, 0x2293 /* CAS5 = 2, CP4 = 1, */
- /* CAS3 = 2, RCD2 = 2, RP = 3 */
+ /* CAS3 = 2, RCD2 = 2, RP = 3 */
/*
* set the Memory Configuration Reg. 4
*/
lis r22, 0x0010 /* all SDRAM parameter 0, */
- /* WCBUF flow through, */
- /* RCBUF registered */
+ /* WCBUF flow through, */
+ /* RCBUF registered */
/*
* get the size of bank 0-3
*/
@@ -429,7 +429,7 @@
bl spdRead
li r16, 0 /* bank size is: */
- /* (8*2^row*2^column)/0x100000 MB */
+ /* (8*2^row*2^column)/0x100000 MB */
ori r16, r16, 0x8000
rlwnm r16, r16, r3, 0, 31
@@ -439,7 +439,7 @@
rlwnm r16, r16, r3, 0, 31
li r3, 0x0005 /* get number of banks from */
- /* spd for bank0/1 */
+ /* spd for bank0/1 */
bl spdRead
cmpi 0, 0, r3, 2 /* 2 banks ? */
@@ -487,7 +487,7 @@
bl spdRead
li r18, 0 /* bank size is: */
- /* (8*2^row*2^column)/0x100000 MB */
+ /* (8*2^row*2^column)/0x100000 MB */
ori r18, r18, 0x8000
rlwnm r18, r18, r3, 0, 31
@@ -497,7 +497,7 @@
rlwnm r18, r18, r3, 0, 31
li r3, 0x0105 /* get number of banks from */
- /* spd for bank2/3 */
+ /* spd for bank2/3 */
bl spdRead
cmpi 0, 0, r3, 2 /* 2 banks ? */
@@ -701,28 +701,28 @@
common3:
li r4, 0x1010 /* refesh cycle 1028 clocks */
- /* left shifted 2 */
+ /* left shifted 2 */
cmpli 0, 0, r3, 0x0000 /* 15.6 us ? */
beq writeRefresh
li r4, 0x0808 /* refesh cycle 514 clocks */
- /* left shifted 2 */
+ /* left shifted 2 */
cmpli 0, 0, r3, 0x0002 /* 7.8 us ? */
beq writeRefresh
li r4, 0x2020 /* refesh cycle 2056 clocks */
- /* left shifted 2 */
+ /* left shifted 2 */
cmpli 0, 0, r3, 0x0003 /* 31.3 us ? */
beq writeRefresh
li r4, 0x4040 /* refesh cycle 4112 clocks */
- /* left shifted 2 */
+ /* left shifted 2 */
cmpli 0, 0, r3, 0x0004 /* 62.5 us ? */
beq writeRefresh
li r4, 0
ori r4, r4, 0x8080 /* refesh cycle 8224 clocks */
- /* left shifted 2 */
+ /* left shifted 2 */
cmpli 0, 0, r3, 0x0005 /* 125 us ? */
beq writeRefresh
@@ -916,7 +916,7 @@
eieio
li r9, 0x03
stb r9, 3(r8) /* 8 data bits, 1 stop bit, */
- /* no parity */
+ /* no parity */
eieio
li r9, 0x0b
stb r9, 4(r8) /* enable the receiver and transmitter */
@@ -928,7 +928,7 @@
beq waitEmpty
li r9, 0x47
stb r9, 3(r8) /* send break, 8 data bits, */
- /* 2 stop bits, no parity */
+ /* 2 stop bits, no parity */
eieio
lis r0, 0x0001
@@ -944,7 +944,7 @@
beq waitEmpty1
li r9, 0x07
stb r9, 3(r8) /* 8 data bits, 2 stop bits, */
- /* no parity */
+ /* no parity */
eieio
/*
@@ -1473,15 +1473,3 @@
Mmbyte:
.ascii " MB .......... \000"
.align 4
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/bab7xx/bab7xx.c b/board/eltec/bab7xx/bab7xx.c
index 6f6f977..b74b055 100644
--- a/board/eltec/bab7xx/bab7xx.c
+++ b/board/eltec/bab7xx/bab7xx.c
@@ -45,7 +45,7 @@
unsigned char data = gpio->dta1;
if (data & 0x02)
- return 66666666;
+ return 66666666;
return 83333333;
}
@@ -58,7 +58,7 @@
ulong bab7xx_get_gclk_freq (void)
{
static const int pllratio_to_factor[] = {
- 00, 75, 70, 00, 20, 65, 100, 45, 30, 55, 40, 50, 80, 60, 35, 00,
+ 00, 75, 70, 00, 20, 65, 100, 45, 30, 55, 40, 50, 80, 60, 35, 00,
};
return pllratio_to_factor[get_hid1 () >> 28] * (bab7xx_get_bus_freq() / 10);
@@ -72,7 +72,7 @@
printf ("MPC7xx V%d.%d",(pvr >> 8) & 0xFF, pvr & 0xFF);
printf (" at %ld / %ld MHz\n", bab7xx_get_gclk_freq()/1000000,
- bab7xx_get_bus_freq()/1000000);
+ bab7xx_get_bus_freq()/1000000);
return (0);
}
@@ -131,8 +131,8 @@
for (reg = CFG_MEMTEST_START; reg < CFG_MEMTEST_END; reg+=4)
{
- if (*reg != reg)
- return -1;
+ if (*reg != reg)
+ return -1;
}
#endif
@@ -147,11 +147,11 @@
do
{
- if (i & 0x01) /* is bank enabled ? */
- memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
- msar1 >>= 8;
- mear1 >>= 8;
- i >>= 1;
+ if (i & 0x01) /* is bank enabled ? */
+ memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
+ msar1 >>= 8;
+ mear1 >>= 8;
+ i >>= 1;
} while (i);
return (memSize * 0x100000);
@@ -222,20 +222,20 @@
switch (line_number)
{
case 1:
- sprintf (info," MPC7xx V%d.%d at %ld / %ld MHz",
- (get_pvr() >> 8) & 0xFF,
- get_pvr() & 0xFF,
- bab7xx_get_gclk_freq()/1000000,
- bab7xx_get_bus_freq()/1000000);
- return;
+ sprintf (info," MPC7xx V%d.%d at %ld / %ld MHz",
+ (get_pvr() >> 8) & 0xFF,
+ get_pvr() & 0xFF,
+ bab7xx_get_gclk_freq()/1000000,
+ bab7xx_get_bus_freq()/1000000);
+ return;
case 2:
- sprintf (info, " ELTEC BAB7xx with %ld MB DRAM and %ld MB FLASH",
- dram_size(0)/0x100000,
- flash_init()/0x100000);
- return;
+ sprintf (info, " ELTEC BAB7xx with %ld MB DRAM and %ld MB FLASH",
+ dram_size(0)/0x100000,
+ flash_init()/0x100000);
+ return;
case 3:
- sprintf (info, " %s", smi.modeIdent);
- return;
+ sprintf (info, " %s", smi.modeIdent);
+ return;
}
/* no more info lines */
diff --git a/board/eltec/bab7xx/dc_srom.c b/board/eltec/bab7xx/dc_srom.c
index ef956e6..a44af6e 100644
--- a/board/eltec/bab7xx/dc_srom.c
+++ b/board/eltec/bab7xx/dc_srom.c
@@ -118,7 +118,7 @@
a = (char)(offset << 2);
for (i=0; i<6; i++, a <<= 1)
{
- srom_latch(command | ((a < 0) ? DT_IN : 0), addr);
+ srom_latch(command | ((a < 0) ? DT_IN : 0), addr);
}
udelay(1);
@@ -136,11 +136,11 @@
for (i=0; i<16; i++)
{
- sendto_srom(command | DT_CLK, addr);
- tmp = getfrom_srom(addr);
- sendto_srom(command, addr);
+ sendto_srom(command | DT_CLK, addr);
+ tmp = getfrom_srom(addr);
+ sendto_srom(command, addr);
- word = (word << 1) | ((tmp >> 3) & 0x01);
+ word = (word << 1) | ((tmp >> 3) & 0x01);
}
sendto_srom(command & 0x0000ff00, addr);
@@ -160,13 +160,13 @@
for (i=0; i<16; i++)
{
- tmp = (longVal & 0x8000)>>13;
+ tmp = (longVal & 0x8000)>>13;
- sendto_srom (tmp | command, addr);
- sendto_srom (tmp | command | DT_CLK, addr);
- sendto_srom (tmp | command, addr);
+ sendto_srom (tmp | command, addr);
+ sendto_srom (tmp | command | DT_CLK, addr);
+ sendto_srom (tmp | command, addr);
- longVal = longVal<<1;
+ longVal = longVal<<1;
}
sendto_srom(command & 0x0000ff00, addr);
@@ -175,15 +175,15 @@
tmp = 100;
do
{
- if ((getfrom_srom(dc_srom_iobase) & 0x8) == 0x8)
- break;
- udelay(1000);
+ if ((getfrom_srom(dc_srom_iobase) & 0x8) == 0x8)
+ break;
+ udelay(1000);
} while (--tmp);
if (tmp == 0)
{
- printf("Write DEC21143 SRom timed out !\n");
- return (-1);
+ printf("Write DEC21143 SRom timed out !\n");
+ return (-1);
}
return 0;
@@ -218,7 +218,7 @@
for (i=0; i<6; i++)
{
- srom_latch (SROM_WR | SROM_SR | DT_IN | DT_CS, addr);
+ srom_latch (SROM_WR | SROM_SR | DT_IN | DT_CS, addr);
}
}
@@ -256,8 +256,8 @@
memset (dest, 0, 128);
for (offset=0; offset<64; offset++)
{
- tmp = srom_rd (dc_srom_iobase, offset);
- *dest++ = le16_to_cpu(tmp);
+ tmp = srom_rd (dc_srom_iobase, offset);
+ *dest++ = le16_to_cpu(tmp);
}
return (0);
@@ -280,9 +280,9 @@
for (offset=0; offset<64; offset++)
{
- if (srom_wr (dc_srom_iobase, offset, *src) == -1)
- return (-1);
- src++;
+ if (srom_wr (dc_srom_iobase, offset, *src) == -1)
+ return (-1);
+ src++;
}
return (0);
diff --git a/board/eltec/bab7xx/el_srom.c b/board/eltec/bab7xx/el_srom.c
index 56abdc7..73f8066 100644
--- a/board/eltec/bab7xx/el_srom.c
+++ b/board/eltec/bab7xx/el_srom.c
@@ -83,14 +83,14 @@
for (i = 0; i < 8; i++)
{
- out8(I2C_BUS_DAT, 0x00); /* SCLK = low SDIO = high */
- udelay(10);
- out8(I2C_BUS_DAT, 0x40); /* SCLK = high SDIO = high */
- udelay(15);
- buf <<= 1;
- buf = (in8(I2C_BUS_DAT) & 0x20) ? (buf | 0x01) : (buf & 0xFE);
- out8(I2C_BUS_DAT, 0x00); /* SCLK = low SDIO = high */
- udelay(10);
+ out8(I2C_BUS_DAT, 0x00); /* SCLK = low SDIO = high */
+ udelay(10);
+ out8(I2C_BUS_DAT, 0x40); /* SCLK = high SDIO = high */
+ udelay(15);
+ buf <<= 1;
+ buf = (in8(I2C_BUS_DAT) & 0x20) ? (buf | 0x01) : (buf & 0xFE);
+ out8(I2C_BUS_DAT, 0x00); /* SCLK = low SDIO = high */
+ udelay(10);
}
return(buf);
}
@@ -113,13 +113,13 @@
for (i = 7; i >= 0; i--)
{
- (buf & 0x80) ? out8(I2C_BUS_DAT, 0x20) : out8(I2C_BUS_DAT, 0x00); /* SCLK=low SDIO=data */
- udelay(10);
- (buf & 0x80) ? out8(I2C_BUS_DAT, 0x60) : out8(I2C_BUS_DAT, 0x40); /* SCLK=high SDIO=data */
- udelay(15);
- (buf & 0x80) ? out8(I2C_BUS_DAT, 0x20) : out8(I2C_BUS_DAT, 0x00); /* SCLK=low SDIO=data */
- udelay(10);
- buf <<= 1;
+ (buf & 0x80) ? out8(I2C_BUS_DAT, 0x20) : out8(I2C_BUS_DAT, 0x00); /* SCLK=low SDIO=data */
+ udelay(10);
+ (buf & 0x80) ? out8(I2C_BUS_DAT, 0x60) : out8(I2C_BUS_DAT, 0x40); /* SCLK=high SDIO=data */
+ udelay(15);
+ (buf & 0x80) ? out8(I2C_BUS_DAT, 0x20) : out8(I2C_BUS_DAT, 0x00); /* SCLK=low SDIO=data */
+ udelay(10);
+ buf <<= 1;
}
}
@@ -184,39 +184,39 @@
for (i=0;i<cnt;i++)
{
- eepStart();
- eepWriteByte(0xA0 | device | block);
- if (eepReadAck() == ERROR)
- {
- eepStop();
- return(ERROR);
- }
- eepWriteByte(addr++);
- if (eepReadAck() == ERROR)
- {
- eepStop();
- return(ERROR);
- }
- eepStart();
+ eepStart();
+ eepWriteByte(0xA0 | device | block);
+ if (eepReadAck() == ERROR)
+ {
+ eepStop();
+ return(ERROR);
+ }
+ eepWriteByte(addr++);
+ if (eepReadAck() == ERROR)
+ {
+ eepStop();
+ return(ERROR);
+ }
+ eepStart();
- eepWriteByte(0xA1 | device | block);
- if (eepReadAck() == ERROR)
- {
- eepStop();
- return(ERROR);
- }
+ eepWriteByte(0xA1 | device | block);
+ if (eepReadAck() == ERROR)
+ {
+ eepStop();
+ return(ERROR);
+ }
- *buf++ = eepReadByte();
- eepWriteAck(1);
- eepStop();
+ *buf++ = eepReadByte();
+ eepWriteAck(1);
+ eepStop();
- if ((addr == 0) && (i != (cnt-1))) /* is it the same block ? */
- {
- if (block == FIRST_BLOCK)
- block = SECOND_BLOCK;
- else
- return(ERROR);
- }
+ if ((addr == 0) && (i != (cnt-1))) /* is it the same block ? */
+ {
+ if (block == FIRST_BLOCK)
+ block = SECOND_BLOCK;
+ else
+ return(ERROR);
+ }
}
return(cnt);
}
@@ -235,31 +235,31 @@
for (i=0;i<cnt;i++)
{
- retVal = ERROR;
- do
- {
- eepStart();
- eepWriteByte(0xA0 | device | block);
- if ((retVal = eepReadAck()) == ERROR)
- eepStop();
- } while (retVal == ERROR);
+ retVal = ERROR;
+ do
+ {
+ eepStart();
+ eepWriteByte(0xA0 | device | block);
+ if ((retVal = eepReadAck()) == ERROR)
+ eepStop();
+ } while (retVal == ERROR);
- eepWriteByte(addr++);
- if (eepReadAck() == ERROR) return(ERROR);
+ eepWriteByte(addr++);
+ if (eepReadAck() == ERROR) return(ERROR);
- if ((addr == 0) && (i != (cnt-1))) /* is it the same block ? */
- {
- if (block == FIRST_BLOCK)
- block = SECOND_BLOCK;
- else
- return(ERROR);
- }
+ if ((addr == 0) && (i != (cnt-1))) /* is it the same block ? */
+ {
+ if (block == FIRST_BLOCK)
+ block = SECOND_BLOCK;
+ else
+ return(ERROR);
+ }
- eepWriteByte(*buf++);
- if (eepReadAck() == ERROR)
- return(ERROR);
+ eepWriteByte(*buf++);
+ if (eepReadAck() == ERROR)
+ return(ERROR);
- eepStop();
+ eepStop();
}
return(cnt);
}
@@ -278,13 +278,13 @@
for (; size; size--)
{
- byte = *ptr++;
- for (i = 8; i; i--)
- {
- f = ((byte & 1) ^ (accu & 1)) ? 0x84083001 : 0;
- accu >>= 1; accu ^= f;
- byte >>= 1;
- }
+ byte = *ptr++;
+ for (i = 8; i; i--)
+ {
+ f = ((byte & 1) ^ (accu & 1)) ? 0x84083001 : 0;
+ accu >>= 1; accu ^= f;
+ byte >>= 1;
+ }
}
return(accu);
}
diff --git a/board/eltec/bab7xx/flash.c b/board/eltec/bab7xx/flash.c
index 73496a1..442dd00 100644
--- a/board/eltec/bab7xx/flash.c
+++ b/board/eltec/bab7xx/flash.c
@@ -57,7 +57,7 @@
/* Init: no FLASHes known */
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i)
{
- flash_info[i].flash_id = FLASH_UNKNOWN;
+ flash_info[i].flash_id = FLASH_UNKNOWN;
}
/* initialise 1st flash */
@@ -65,8 +65,8 @@
if (flash_info[0].flash_id == FLASH_UNKNOWN)
{
- printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
- size1, size1<<20);
+ printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
+ size1, size1<<20);
}
/* initialise 2nd flash */
@@ -74,31 +74,31 @@
if (flash_info[1].flash_id == FLASH_UNKNOWN)
{
- printf ("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n",
- size2, size2<<20);
+ printf ("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n",
+ size2, size2<<20);
}
/* monitor protection ON by default */
if (size1 == 512*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- FLASH_BASE0_PRELIM,
- FLASH_BASE0_PRELIM+monitor_flash_len-1,
- &flash_info[0]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ FLASH_BASE0_PRELIM,
+ FLASH_BASE0_PRELIM+monitor_flash_len-1,
+ &flash_info[0]);
}
if (size2 == 512*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- FLASH_BASE1_PRELIM,
- FLASH_BASE1_PRELIM+monitor_flash_len-1,
- &flash_info[1]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ FLASH_BASE1_PRELIM,
+ FLASH_BASE1_PRELIM+monitor_flash_len-1,
+ &flash_info[1]);
}
if (size2 == 4*1024*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- CFG_FLASH_BASE,
- CFG_FLASH_BASE+monitor_flash_len-1,
- &flash_info[1]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ CFG_FLASH_BASE,
+ CFG_FLASH_BASE+monitor_flash_len-1,
+ &flash_info[1]);
}
return (size1 + size2);
@@ -115,72 +115,72 @@
volatile unsigned long *flash;
if (info->flash_id == FLASH_UNKNOWN) {
- printf ("missing or unknown FLASH type\n");
- flash_init();
+ printf ("missing or unknown FLASH type\n");
+ flash_init();
}
if (info->flash_id == FLASH_UNKNOWN) {
- printf ("missing or unknown FLASH type\n");
- return;
+ printf ("missing or unknown FLASH type\n");
+ return;
}
switch (info->flash_id & FLASH_VENDMASK) {
case FLASH_MAN_AMD:
- printf ("AMD ");
- break;
+ printf ("AMD ");
+ break;
default:
- printf ("Unknown Vendor ");
- break;
+ printf ("Unknown Vendor ");
+ break;
}
switch (info->flash_id & FLASH_TYPEMASK) {
case AMD_ID_F040B:
- printf ("AM29F040B (4 Mbit)\n");
- break;
+ printf ("AM29F040B (4 Mbit)\n");
+ break;
case AMD_ID_F016D:
- printf ("AM29F016D (16 Mbit)\n");
- break;
+ printf ("AM29F016D (16 Mbit)\n");
+ break;
case AMD_ID_F032B:
- printf ("AM29F032B (32 Mbit)\n");
- break;
+ printf ("AM29F032B (32 Mbit)\n");
+ break;
default:
- printf ("Unknown Chip Type\n");
- break;
+ printf ("Unknown Chip Type\n");
+ break;
}
if (info->size >= (1 << 20)) {
- printf (" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
+ printf (" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
} else {
- printf (" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count);
+ printf (" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count);
}
printf (" Sector Start Addresses:");
for (i=0; i<info->sector_count; ++i) {
- /*
- * Check if whole sector is erased
- */
- if (i != (info->sector_count-1))
- size = info->start[i+1] - info->start[i];
- else
- size = info->start[0] + info->size - info->start[i];
+ /*
+ * Check if whole sector is erased
+ */
+ if (i != (info->sector_count-1))
+ size = info->start[i+1] - info->start[i];
+ else
+ size = info->start[0] + info->size - info->start[i];
- erased = 1;
- flash = (volatile unsigned long *)info->start[i];
- size = size >> 2; /* divide by 4 for longword access */
- for (k=0; k<size; k++) {
- if (*flash++ != 0xffffffff) {
- erased = 0;
- break;
- }
- }
+ erased = 1;
+ flash = (volatile unsigned long *)info->start[i];
+ size = size >> 2; /* divide by 4 for longword access */
+ for (k=0; k<size; k++) {
+ if (*flash++ != 0xffffffff) {
+ erased = 0;
+ break;
+ }
+ }
- if ((i % 5) == 0)
- printf ("\n ");
+ if ((i % 5) == 0)
+ printf ("\n ");
- printf (" %08lX%s%s",
- info->start[i],
- erased ? " E" : " ",
- info->protect[i] ? "RO " : " ");
+ printf (" %08lX%s%s",
+ info->start[i],
+ erased ? " E" : " ",
+ info->protect[i] ? "RO " : " ");
}
printf ("\n");
}
@@ -226,37 +226,37 @@
/* We accept only two AMD types */
switch (vendor) {
case (FLASH_WORD_SIZE)AMD_MANUFACT:
- info->flash_id = FLASH_MAN_AMD;
- break;
+ info->flash_id = FLASH_MAN_AMD;
+ break;
default:
- info->flash_id = FLASH_UNKNOWN;
- info->sector_count = 0;
- info->size = 0;
- return (0); /* no or unknown flash */
+ info->flash_id = FLASH_UNKNOWN;
+ info->sector_count = 0;
+ info->size = 0;
+ return (0); /* no or unknown flash */
}
switch (devid) {
case (FLASH_WORD_SIZE)AMD_ID_F040B:
- info->flash_id |= AMD_ID_F040B;
- info->sector_count = 8;
- info->size = 0x00080000;
- break; /* => 0.5 MB */
+ info->flash_id |= AMD_ID_F040B;
+ info->sector_count = 8;
+ info->size = 0x00080000;
+ break; /* => 0.5 MB */
case (FLASH_WORD_SIZE)AMD_ID_F016D:
- info->flash_id |= AMD_ID_F016D;
- info->sector_count = 32;
- info->size = 0x00200000;
- break; /* => 2 MB */
+ info->flash_id |= AMD_ID_F016D;
+ info->sector_count = 32;
+ info->size = 0x00200000;
+ break; /* => 2 MB */
case (FLASH_WORD_SIZE)AMD_ID_F032B:
- info->flash_id |= AMD_ID_F032B;
- info->sector_count = 64;
- info->size = 0x00400000;
- break; /* => 4 MB */
+ info->flash_id |= AMD_ID_F032B;
+ info->sector_count = 64;
+ info->size = 0x00400000;
+ break; /* => 4 MB */
default:
- info->flash_id = FLASH_UNKNOWN;
- return (0); /* => no or unknown flash */
+ info->flash_id = FLASH_UNKNOWN;
+ return (0); /* => no or unknown flash */
}
@@ -266,20 +266,20 @@
/* check for protected sectors */
for (i = 0; i < info->sector_count; i++) {
- /* sector base address */
- info->start[i] = base + i * (info->size / info->sector_count);
- /* read sector protection at sector address, (A7 .. A0) = 0x02 */
- /* D0 = 1 if protected */
- caddr = (volatile unsigned char *)(info->start[i]);
- info->protect[i] = caddr[2] & 1;
+ /* sector base address */
+ info->start[i] = base + i * (info->size / info->sector_count);
+ /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+ /* D0 = 1 if protected */
+ caddr = (volatile unsigned char *)(info->start[i]);
+ info->protect[i] = caddr[2] & 1;
}
/*
* Prevent writes to uninitialized FLASH.
*/
if (info->flash_id != FLASH_UNKNOWN) {
- caddr = (volatile unsigned char *)info->start[0];
- caddr[0] = 0xF0; /* reset bank */
+ caddr = (volatile unsigned char *)info->start[0];
+ caddr[0] = 0xF0; /* reset bank */
}
return (info->size);
@@ -295,32 +295,32 @@
int rc = 0;
if ((s_first < 0) || (s_first > s_last)) {
- if (info->flash_id == FLASH_UNKNOWN) {
- printf ("- missing\n");
- } else {
- printf ("- no sectors to erase\n");
- }
- return 1;
+ if (info->flash_id == FLASH_UNKNOWN) {
+ printf ("- missing\n");
+ } else {
+ printf ("- no sectors to erase\n");
+ }
+ return 1;
}
if ((info->flash_id == FLASH_UNKNOWN) ||
- (info->flash_id > FLASH_AMD_COMP)) {
- printf ("Can't erase unknown flash type - aborted\n");
- return 1;
+ (info->flash_id > FLASH_AMD_COMP)) {
+ printf ("Can't erase unknown flash type - aborted\n");
+ return 1;
}
prot = 0;
for (sect=s_first; sect<=s_last; ++sect) {
- if (info->protect[sect]) {
- prot++;
- }
+ if (info->protect[sect]) {
+ prot++;
+ }
}
if (prot) {
- printf ("- Warning: %d protected sectors will not be erased!\n",
- prot);
+ printf ("- Warning: %d protected sectors will not be erased!\n",
+ prot);
} else {
- printf ("\n");
+ printf ("\n");
}
l_sect = -1;
@@ -336,26 +336,26 @@
/* Start erase on unprotected sectors */
for (sect = s_first; sect<=s_last; sect++) {
- if (info->protect[sect] == 0) { /* not protected */
- addr = (FLASH_WORD_SIZE *)(info->start[sect]);
- if (info->flash_id & FLASH_MAN_SST) {
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00800080;
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr[0] = (FLASH_WORD_SIZE)0x00500050; /* block erase */
- udelay(30000); /* wait 30 ms */
- }
- else
- addr[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
- l_sect = sect;
- }
+ if (info->protect[sect] == 0) { /* not protected */
+ addr = (FLASH_WORD_SIZE *)(info->start[sect]);
+ if (info->flash_id & FLASH_MAN_SST) {
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00800080;
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr[0] = (FLASH_WORD_SIZE)0x00500050; /* block erase */
+ udelay(30000); /* wait 30 ms */
+ }
+ else
+ addr[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
+ l_sect = sect;
+ }
}
/* re-enable interrupts if necessary */
if (flag)
- enable_interrupts();
+ enable_interrupts();
/* wait at least 80us - let's wait 1 ms */
udelay (1000);
@@ -364,21 +364,21 @@
* We wait for the last triggered sector
*/
if (l_sect < 0)
- goto DONE;
+ goto DONE;
start = get_timer (0);
last = start;
addr = (FLASH_WORD_SIZE *)(info->start[l_sect]);
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
- if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
- printf ("Timeout\n");
- return 1;
- }
- /* show that we're waiting */
- if ((now - last) > 1000) { /* every second */
- serial_putc ('.');
- last = now;
- }
+ if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+ printf ("Timeout\n");
+ return 1;
+ }
+ /* show that we're waiting */
+ if ((now - last) > 1000) { /* every second */
+ serial_putc ('.');
+ last = now;
+ }
}
DONE:
@@ -408,42 +408,42 @@
* handle unaligned start bytes
*/
if ((l = addr - wp) != 0) {
- data = 0;
- for (i=0, cp=wp; i<l; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
- }
- for (; i<4 && cnt>0; ++i) {
- data = (data << 8) | *src++;
- --cnt;
- ++cp;
- }
- for (; cnt==0 && i<4; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
- }
+ data = 0;
+ for (i=0, cp=wp; i<l; ++i, ++cp) {
+ data = (data << 8) | (*(uchar *)cp);
+ }
+ for (; i<4 && cnt>0; ++i) {
+ data = (data << 8) | *src++;
+ --cnt;
+ ++cp;
+ }
+ for (; cnt==0 && i<4; ++i, ++cp) {
+ data = (data << 8) | (*(uchar *)cp);
+ }
- if ((rc = write_word(info, wp, data)) != 0) {
- return (rc);
- }
- wp += 4;
+ if ((rc = write_word(info, wp, data)) != 0) {
+ return (rc);
+ }
+ wp += 4;
}
/*
* handle word aligned part
*/
while (cnt >= 4) {
- data = 0;
- for (i=0; i<4; ++i) {
- data = (data << 8) | *src++;
- }
- if ((rc = write_word(info, wp, data)) != 0) {
- return (rc);
- }
- wp += 4;
- cnt -= 4;
+ data = 0;
+ for (i=0; i<4; ++i) {
+ data = (data << 8) | *src++;
+ }
+ if ((rc = write_word(info, wp, data)) != 0) {
+ return (rc);
+ }
+ wp += 4;
+ cnt -= 4;
}
if (cnt == 0) {
- return (0);
+ return (0);
}
/*
@@ -451,11 +451,11 @@
*/
data = 0;
for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
- data = (data << 8) | *src++;
- --cnt;
+ data = (data << 8) | *src++;
+ --cnt;
}
for (; i<4; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
+ data = (data << 8) | (*(uchar *)cp);
}
return (write_word(info, wp, data));
@@ -469,45 +469,44 @@
*/
static int write_word (flash_info_t *info, ulong dest, ulong data)
{
- volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
- volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
- volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
+ volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
+ volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
+ volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
ulong start;
int flag;
- int i;
+ int i;
/* Check if Flash is (sufficiently) erased */
if ((*((volatile FLASH_WORD_SIZE *)dest) &
- (FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
- return (2);
+ (FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
+ return (2);
}
/* Disable interrupts which might cause a timeout here */
flag = disable_interrupts();
- for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
- {
- addr2[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr2[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr2[ADDR0] = (FLASH_WORD_SIZE)0x00A000A0;
+ for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
+ {
+ addr2[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr2[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr2[ADDR0] = (FLASH_WORD_SIZE)0x00A000A0;
- dest2[i] = data2[i];
+ dest2[i] = data2[i];
- /* re-enable interrupts if necessary */
- if (flag)
- enable_interrupts();
+ /* re-enable interrupts if necessary */
+ if (flag)
+ enable_interrupts();
- /* data polling for D7 */
- start = get_timer (0);
- while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
- (data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
- return (1);
- }
- }
- }
+ /* data polling for D7 */
+ start = get_timer (0);
+ while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
+ (data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
+ if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+ return (1);
+ }
+ }
+ }
return (0);
}
/*----------------------------------------------------------------------------*/
-
diff --git a/board/eltec/bab7xx/l2cache.c b/board/eltec/bab7xx/l2cache.c
index 748d515..077f2c9 100644
--- a/board/eltec/bab7xx/l2cache.c
+++ b/board/eltec/bab7xx/l2cache.c
@@ -51,104 +51,104 @@
{
if (l2control) /* BAB750 */
{
- mtspr(SPRN_L2CR, l2control);
- mtspr(SPRN_L2CR, (l2control | L2CR_I));
- while (mfspr(SPRN_L2CR) & L2CR_IP)
- ;
- mtspr(SPRN_L2CR, (l2control | L2CR_E));
- return (0);
+ mtspr(SPRN_L2CR, l2control);
+ mtspr(SPRN_L2CR, (l2control | L2CR_I));
+ while (mfspr(SPRN_L2CR) & L2CR_IP)
+ ;
+ mtspr(SPRN_L2CR, (l2control | L2CR_E));
+ return (0);
}
else /* BAB740 */
{
- int picr1, picr2, mask;
- int picr2CacheSize, cacheSize;
- int *d;
- int devbusfn;
- u32 reg32;
+ int picr1, picr2, mask;
+ int picr2CacheSize, cacheSize;
+ int *d;
+ int devbusfn;
+ u32 reg32;
- devbusfn = pci_find_device(PCI_VENDOR_ID_MOTOROLA,
- PCI_DEVICE_ID_MOTOROLA_MPC106, 0);
- if (devbusfn == -1)
- return (-1);
+ devbusfn = pci_find_device(PCI_VENDOR_ID_MOTOROLA,
+ PCI_DEVICE_ID_MOTOROLA_MPC106, 0);
+ if (devbusfn == -1)
+ return (-1);
- pci_read_config_dword (devbusfn, PCI_PICR2, ®32);
- reg32 &= ~PICR2_L2_EN;
- pci_write_config_dword (devbusfn, PCI_PICR2, reg32);
+ pci_read_config_dword (devbusfn, PCI_PICR2, ®32);
+ reg32 &= ~PICR2_L2_EN;
+ pci_write_config_dword (devbusfn, PCI_PICR2, reg32);
- /* cache size */
- if (*(volatile unsigned char *) (CFG_ISA_IO + 0x220) & 0x04)
- {
- /* cache size is 512 KB */
- picr2CacheSize = PICR2_L2_SIZE_512K;
- cacheSize = 0x80000;
- }
- else
- {
- /* cache size is 256 KB */
- picr2CacheSize = PICR2_L2_SIZE_256K;
- cacheSize = 0x40000;
- }
+ /* cache size */
+ if (*(volatile unsigned char *) (CFG_ISA_IO + 0x220) & 0x04)
+ {
+ /* cache size is 512 KB */
+ picr2CacheSize = PICR2_L2_SIZE_512K;
+ cacheSize = 0x80000;
+ }
+ else
+ {
+ /* cache size is 256 KB */
+ picr2CacheSize = PICR2_L2_SIZE_256K;
+ cacheSize = 0x40000;
+ }
- /* setup PICR1 */
- mask =
- ~(PICR1_CF_BREAD_WS(1) |
- PICR1_CF_BREAD_WS(2) |
- PICR1_CF_CBA(0xff) |
- PICR1_CF_CACHE_1G |
- PICR1_CF_DPARK |
- PICR1_CF_APARK |
- PICR1_CF_L2_CACHE_MASK);
+ /* setup PICR1 */
+ mask =
+ ~(PICR1_CF_BREAD_WS(1) |
+ PICR1_CF_BREAD_WS(2) |
+ PICR1_CF_CBA(0xff) |
+ PICR1_CF_CACHE_1G |
+ PICR1_CF_DPARK |
+ PICR1_CF_APARK |
+ PICR1_CF_L2_CACHE_MASK);
- picr1 =
- (PICR1_CF_CBA(0x3f) |
- PICR1_CF_CACHE_1G |
- PICR1_CF_APARK |
- PICR1_CF_DPARK |
- PICR1_CF_L2_COPY_BACK); /* PICR1_CF_L2_WRITE_THROUGH */
+ picr1 =
+ (PICR1_CF_CBA(0x3f) |
+ PICR1_CF_CACHE_1G |
+ PICR1_CF_APARK |
+ PICR1_CF_DPARK |
+ PICR1_CF_L2_COPY_BACK); /* PICR1_CF_L2_WRITE_THROUGH */
- pci_read_config_dword (devbusfn, PCI_PICR1, ®32);
- reg32 &= mask;
- reg32 |= picr1;
- pci_write_config_dword (devbusfn, PCI_PICR1, reg32);
+ pci_read_config_dword (devbusfn, PCI_PICR1, ®32);
+ reg32 &= mask;
+ reg32 |= picr1;
+ pci_write_config_dword (devbusfn, PCI_PICR1, reg32);
- /*
- * invalidate all L2 cache
- */
- picr2 =
- (PICR2_CF_INV_MODE |
- PICR2_CF_HIT_HIGH |
- PICR2_CF_MOD_HIGH |
- PICR2_CF_L2_HIT_DELAY(1) |
- PICR2_CF_APHASE_WS(1) |
- picr2CacheSize);
+ /*
+ * invalidate all L2 cache
+ */
+ picr2 =
+ (PICR2_CF_INV_MODE |
+ PICR2_CF_HIT_HIGH |
+ PICR2_CF_MOD_HIGH |
+ PICR2_CF_L2_HIT_DELAY(1) |
+ PICR2_CF_APHASE_WS(1) |
+ picr2CacheSize);
- pci_write_config_dword (devbusfn, PCI_PICR2, picr2);
+ pci_write_config_dword (devbusfn, PCI_PICR2, picr2);
- /*
- * dummy transactions
- */
- for (d=0; d<(int *)(2*cacheSize); d++)
- dummy(*d);
+ /*
+ * dummy transactions
+ */
+ for (d=0; d<(int *)(2*cacheSize); d++)
+ dummy(*d);
- pci_write_config_dword (devbusfn, PCI_PICR2,
- (picr2 | PICR2_CF_FLUSH_L2));
+ pci_write_config_dword (devbusfn, PCI_PICR2,
+ (picr2 | PICR2_CF_FLUSH_L2));
- /* setup PICR2 */
- picr2 =
- (PICR2_CF_FAST_CASTOUT |
- PICR2_CF_WDATA |
- PICR2_CF_ADDR_ONLY_DISABLE |
- PICR2_CF_HIT_HIGH |
- PICR2_CF_MOD_HIGH |
- PICR2_L2_UPDATE_EN |
- PICR2_L2_EN |
- PICR2_CF_APHASE_WS(1) |
- PICR2_CF_DATA_RAM_PBURST |
- PICR2_CF_L2_HIT_DELAY(1) |
- PICR2_CF_SNOOP_WS(2) |
- picr2CacheSize);
+ /* setup PICR2 */
+ picr2 =
+ (PICR2_CF_FAST_CASTOUT |
+ PICR2_CF_WDATA |
+ PICR2_CF_ADDR_ONLY_DISABLE |
+ PICR2_CF_HIT_HIGH |
+ PICR2_CF_MOD_HIGH |
+ PICR2_L2_UPDATE_EN |
+ PICR2_L2_EN |
+ PICR2_CF_APHASE_WS(1) |
+ PICR2_CF_DATA_RAM_PBURST |
+ PICR2_CF_L2_HIT_DELAY(1) |
+ PICR2_CF_SNOOP_WS(2) |
+ picr2CacheSize);
- pci_write_config_dword (devbusfn, PCI_PICR2, picr2);
+ pci_write_config_dword (devbusfn, PCI_PICR2, picr2);
}
return (0);
}
@@ -156,4 +156,3 @@
/*----------------------------------------------------------------------------*/
#endif /* (CFG_L2_BAB7xx) */
-
diff --git a/board/eltec/bab7xx/misc.c b/board/eltec/bab7xx/misc.c
index 1b4376d..b50d11b 100644
--- a/board/eltec/bab7xx/misc.c
+++ b/board/eltec/bab7xx/misc.c
@@ -62,7 +62,7 @@
u_int i, l, initSrom, copyNv;
char buf[256];
char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
- 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
+ 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
pci_dev_t bdf;
char sromSYM[] = {
@@ -131,204 +131,204 @@
/* read out current revision srom contens */
el_srom_load (0x0000, (u_char*)&eerev, sizeof(revinfo),
- SECOND_DEVICE, FIRST_BLOCK);
+ SECOND_DEVICE, FIRST_BLOCK);
/* read out current nvram shadow image */
nvram_read (buf, CFG_NV_SROM_COPY_ADDR, CFG_SROM_SIZE);
if (strcmp (eerev.magic, "ELTEC") != 0)
{
- /* srom is not initialized -> create a default revision info */
- for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
- *ptr++ = 0x00;
- strcpy(eerev.magic, "ELTEC");
- eerev.revrev[0] = 1;
- eerev.revrev[1] = 0;
- eerev.size = 0x00E0;
- eerev.category[0] = 0x01;
+ /* srom is not initialized -> create a default revision info */
+ for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
+ *ptr++ = 0x00;
+ strcpy(eerev.magic, "ELTEC");
+ eerev.revrev[0] = 1;
+ eerev.revrev[1] = 0;
+ eerev.size = 0x00E0;
+ eerev.category[0] = 0x01;
- /* node id from dead e128 as default */
- eerev.etheraddr[0] = 0x00;
- eerev.etheraddr[1] = 0x00;
- eerev.etheraddr[2] = 0x5B;
- eerev.etheraddr[3] = 0x00;
- eerev.etheraddr[4] = 0x2E;
- eerev.etheraddr[5] = 0x4D;
+ /* node id from dead e128 as default */
+ eerev.etheraddr[0] = 0x00;
+ eerev.etheraddr[1] = 0x00;
+ eerev.etheraddr[2] = 0x5B;
+ eerev.etheraddr[3] = 0x00;
+ eerev.etheraddr[4] = 0x2E;
+ eerev.etheraddr[5] = 0x4D;
- /* cache config word for bab750 */
- *(int*)&eerev.res[0] = CLK2P0TO1_1MB_PB_0P5DH;
+ /* cache config word for bab750 */
+ *(int*)&eerev.res[0] = CLK2P0TO1_1MB_PB_0P5DH;
- initSrom = 1; /* force dialog */
- copyNv = 1; /* copy to nvram */
+ initSrom = 1; /* force dialog */
+ copyNv = 1; /* copy to nvram */
}
if ((copyNv == 0) && (el_srom_checksum((u_char*)&eerev, CFG_SROM_SIZE) !=
- el_srom_checksum((u_char*)buf, CFG_SROM_SIZE)))
+ el_srom_checksum((u_char*)buf, CFG_SROM_SIZE)))
{
- printf ("Invalid revision info copy in nvram !\n");
- printf ("Press key:\n <c> to copy current revision info to nvram.\n");
- printf (" <r> to reenter revision info.\n");
- printf ("=> ");
- if (0 != readline (NULL))
- {
- switch ((char)toupper(console_buffer[0]))
- {
- case 'C':
- copyNv = 1;
- break;
- case 'R':
- copyNv = 1;
- initSrom = 1;
- break;
- }
- }
+ printf ("Invalid revision info copy in nvram !\n");
+ printf ("Press key:\n <c> to copy current revision info to nvram.\n");
+ printf (" <r> to reenter revision info.\n");
+ printf ("=> ");
+ if (0 != readline (NULL))
+ {
+ switch ((char)toupper(console_buffer[0]))
+ {
+ case 'C':
+ copyNv = 1;
+ break;
+ case 'R':
+ copyNv = 1;
+ initSrom = 1;
+ break;
+ }
+ }
}
if (initSrom)
{
- memcpy (buf, &eerev.revision[0][0], 14); /* save all revision info */
- printf ("Enter revision number (0-9): %c ", eerev.revision[0][0]);
- if (0 != readline (NULL))
- {
- eerev.revision[0][0] = (char)toupper(console_buffer[0]);
- memcpy (&eerev.revision[1][0], buf, 12); /* shift rest of rev info */
- }
+ memcpy (buf, &eerev.revision[0][0], 14); /* save all revision info */
+ printf ("Enter revision number (0-9): %c ", eerev.revision[0][0]);
+ if (0 != readline (NULL))
+ {
+ eerev.revision[0][0] = (char)toupper(console_buffer[0]);
+ memcpy (&eerev.revision[1][0], buf, 12); /* shift rest of rev info */
+ }
- printf ("Enter revision character (A-Z): %c ", eerev.revision[0][1]);
- if (1 == readline (NULL))
- {
- eerev.revision[0][1] = (char)toupper(console_buffer[0]);
- }
+ printf ("Enter revision character (A-Z): %c ", eerev.revision[0][1]);
+ if (1 == readline (NULL))
+ {
+ eerev.revision[0][1] = (char)toupper(console_buffer[0]);
+ }
- printf ("Enter board name (V-XXXX-XXXX): %s ", (char *)&eerev.board);
- if (11 == readline (NULL))
- {
- for (i=0; i<11; i++)
- eerev.board[i] = (char)toupper(console_buffer[i]);
- eerev.board[11] = '\0';
- }
+ printf ("Enter board name (V-XXXX-XXXX): %s ", (char *)&eerev.board);
+ if (11 == readline (NULL))
+ {
+ for (i=0; i<11; i++)
+ eerev.board[i] = (char)toupper(console_buffer[i]);
+ eerev.board[11] = '\0';
+ }
- printf ("Enter serial number: %s ", (char *)&eerev.serial );
- if (6 == readline (NULL))
- {
- for (i=0; i<6; i++)
- eerev.serial[i] = console_buffer[i];
- eerev.serial[6] = '\0';
- }
+ printf ("Enter serial number: %s ", (char *)&eerev.serial );
+ if (6 == readline (NULL))
+ {
+ for (i=0; i<6; i++)
+ eerev.serial[i] = console_buffer[i];
+ eerev.serial[6] = '\0';
+ }
- printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
- eerev.etheraddr[0], eerev.etheraddr[1],
- eerev.etheraddr[2], eerev.etheraddr[3],
- eerev.etheraddr[4], eerev.etheraddr[5]);
- if (12 == readline (NULL))
- {
- for (i=0; i<12; i+=2)
- eerev.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
- hex[toupper(console_buffer[i+1])-'0']);
- }
+ printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
+ eerev.etheraddr[0], eerev.etheraddr[1],
+ eerev.etheraddr[2], eerev.etheraddr[3],
+ eerev.etheraddr[4], eerev.etheraddr[5]);
+ if (12 == readline (NULL))
+ {
+ for (i=0; i<12; i+=2)
+ eerev.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
+ hex[toupper(console_buffer[i+1])-'0']);
+ }
- l = strlen ((char *)&eerev.text);
- printf("Add to text section (max 64 chr): %s ", (char *)&eerev.text );
- if (0 != readline (NULL))
- {
- for (i = l; i<63; i++)
- eerev.text[i] = console_buffer[i-l];
- eerev.text[63] = '\0';
- }
+ l = strlen ((char *)&eerev.text);
+ printf("Add to text section (max 64 chr): %s ", (char *)&eerev.text );
+ if (0 != readline (NULL))
+ {
+ for (i = l; i<63; i++)
+ eerev.text[i] = console_buffer[i-l];
+ eerev.text[63] = '\0';
+ }
- if (strstr ((char *)&eerev.board, "75") != NULL)
- eltec_board = 750;
- else
- eltec_board = 740;
+ if (strstr ((char *)&eerev.board, "75") != NULL)
+ eltec_board = 750;
+ else
+ eltec_board = 740;
- if (eltec_board == 750)
- {
- if (CPU_TYPE == CPU_TYPE_750)
- *(int*)&eerev.res[0] = CLK2P0TO1_1MB_PB_0P5DH;
- else
- *(int*)&eerev.res[0] = CLK2P5TO1_1MB_PB_0P5DH;
+ if (eltec_board == 750)
+ {
+ if (CPU_TYPE == CPU_TYPE_750)
+ *(int*)&eerev.res[0] = CLK2P0TO1_1MB_PB_0P5DH;
+ else
+ *(int*)&eerev.res[0] = CLK2P5TO1_1MB_PB_0P5DH;
- printf("Enter L2Cache config word with leading zero (HEX): %08X ",
- *(int*)&eerev.res[0] );
- if (0 != readline (NULL))
- {
- for (i=0; i<7; i+=2)
- {
- eerev.res[i>>1] =
- (char)(16*hex[toupper(console_buffer[i])-'0'] +
- hex[toupper(console_buffer[i+1])-'0']);
- }
- }
+ printf("Enter L2Cache config word with leading zero (HEX): %08X ",
+ *(int*)&eerev.res[0] );
+ if (0 != readline (NULL))
+ {
+ for (i=0; i<7; i+=2)
+ {
+ eerev.res[i>>1] =
+ (char)(16*hex[toupper(console_buffer[i])-'0'] +
+ hex[toupper(console_buffer[i+1])-'0']);
+ }
+ }
- /* prepare network eeprom */
- sromMII[20] = eerev.etheraddr[0];
- sromMII[21] = eerev.etheraddr[1];
- sromMII[22] = eerev.etheraddr[2];
- sromMII[23] = eerev.etheraddr[3];
- sromMII[24] = eerev.etheraddr[4];
- sromMII[25] = eerev.etheraddr[5];
- printf("\nSRom: Writing DEC21143 MII info .. ");
+ /* prepare network eeprom */
+ sromMII[20] = eerev.etheraddr[0];
+ sromMII[21] = eerev.etheraddr[1];
+ sromMII[22] = eerev.etheraddr[2];
+ sromMII[23] = eerev.etheraddr[3];
+ sromMII[24] = eerev.etheraddr[4];
+ sromMII[25] = eerev.etheraddr[5];
+ printf("\nSRom: Writing DEC21143 MII info .. ");
- if (dc_srom_store ((u_short *)sromMII) == -1)
- printf("FAILED\n");
- else
- printf("OK\n");
- }
+ if (dc_srom_store ((u_short *)sromMII) == -1)
+ printf("FAILED\n");
+ else
+ printf("OK\n");
+ }
- if (eltec_board == 740)
- {
- *(int *)&eerev.res[0] = 0;
- sromSYM[20] = eerev.etheraddr[0];
- sromSYM[21] = eerev.etheraddr[1];
- sromSYM[22] = eerev.etheraddr[2];
- sromSYM[23] = eerev.etheraddr[3];
- sromSYM[24] = eerev.etheraddr[4];
- sromSYM[25] = eerev.etheraddr[5];
- printf("\nSRom: Writing DEC21143 SYM info .. ");
+ if (eltec_board == 740)
+ {
+ *(int *)&eerev.res[0] = 0;
+ sromSYM[20] = eerev.etheraddr[0];
+ sromSYM[21] = eerev.etheraddr[1];
+ sromSYM[22] = eerev.etheraddr[2];
+ sromSYM[23] = eerev.etheraddr[3];
+ sromSYM[24] = eerev.etheraddr[4];
+ sromSYM[25] = eerev.etheraddr[5];
+ printf("\nSRom: Writing DEC21143 SYM info .. ");
- if (dc_srom_store ((u_short *)sromSYM) == -1)
- printf("FAILED\n");
- else
- printf("OK\n");
- }
+ if (dc_srom_store ((u_short *)sromSYM) == -1)
+ printf("FAILED\n");
+ else
+ printf("OK\n");
+ }
- /* update CRC */
- eerev.crc = el_srom_checksum((u_char *)eerev.board, eerev.size);
+ /* update CRC */
+ eerev.crc = el_srom_checksum((u_char *)eerev.board, eerev.size);
- /* write new values */
- printf("\nSRom: Writing revision info ...... ");
- if (el_srom_store((BLOCK_SIZE-sizeof(revinfo)), (u_char *)&eerev,
- sizeof(revinfo), SECOND_DEVICE, FIRST_BLOCK) == -1)
- printf("FAILED\n\n");
- else
- printf("OK\n\n");
+ /* write new values */
+ printf("\nSRom: Writing revision info ...... ");
+ if (el_srom_store((BLOCK_SIZE-sizeof(revinfo)), (u_char *)&eerev,
+ sizeof(revinfo), SECOND_DEVICE, FIRST_BLOCK) == -1)
+ printf("FAILED\n\n");
+ else
+ printf("OK\n\n");
- /* write new values as shadow image to nvram */
- nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
+ /* write new values as shadow image to nvram */
+ nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
} /*if (initSrom) */
/* copy current values as shadow image to nvram */
if (initSrom == 0 && copyNv == 1)
- nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
+ nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
/* update environment */
sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x",
- eerev.etheraddr[0], eerev.etheraddr[1],
- eerev.etheraddr[2], eerev.etheraddr[3],
- eerev.etheraddr[4], eerev.etheraddr[5]);
+ eerev.etheraddr[0], eerev.etheraddr[1],
+ eerev.etheraddr[2], eerev.etheraddr[3],
+ eerev.etheraddr[4], eerev.etheraddr[5]);
setenv ("ethaddr", buf);
/* print actual board identification */
printf("Ident: %s Ser %s Rev %c%c\n",
- eerev.board, (char *)&eerev.serial,
- eerev.revision[0][0], eerev.revision[0][1]);
+ eerev.board, (char *)&eerev.serial,
+ eerev.revision[0][0], eerev.revision[0][1]);
/* global board ident */
if (strstr ((char *)&eerev.board, "75") != NULL)
- eltec_board = 750;
+ eltec_board = 750;
else
- eltec_board = 740;
+ eltec_board = 740;
/*
* L2 cache configuration
@@ -337,12 +337,12 @@
ptr = getenv("l2cache");
if (*ptr == '0')
{
- printf ("Cache: L2 NOT activated on BAB%d\n", eltec_board);
+ printf ("Cache: L2 NOT activated on BAB%d\n", eltec_board);
}
else
{
- printf ("Cache: L2 activated on BAB%d\n", eltec_board);
- l2_cache_enable(*(int*)&eerev.res[0]);
+ printf ("Cache: L2 activated on BAB%d\n", eltec_board);
+ l2_cache_enable(*(int*)&eerev.res[0]);
}
#endif
@@ -351,12 +351,12 @@
*/
if ((ptr = getenv ("ata_reset_time")) != NULL)
{
- ata_reset_time = (int)simple_strtoul (ptr, NULL, 10);
+ ata_reset_time = (int)simple_strtoul (ptr, NULL, 10);
}
else
{
- sprintf (buf, "%d", ata_reset_time);
- setenv ("ata_reset_time", buf);
+ sprintf (buf, "%d", ata_reset_time);
+ setenv ("ata_reset_time", buf);
}
/*
@@ -364,55 +364,55 @@
*/
if ((ptr = getenv ("scsi_reset_time")) != NULL)
{
- scsi_reset_time = (int)simple_strtoul (ptr, NULL, 10);
+ scsi_reset_time = (int)simple_strtoul (ptr, NULL, 10);
}
else
{
- sprintf (buf, "%d", scsi_reset_time);
- setenv ("scsi_reset_time", buf);
+ sprintf (buf, "%d", scsi_reset_time);
+ setenv ("scsi_reset_time", buf);
}
if ((bdf = pci_find_device(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, 0)) > 0)
{
- if (pci_find_device(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C860, 0) > 0)
- {
- /* BAB740 with SCSI=IRQ 11; SCC=IRQ 9; no IDE; NCR860 at 80 Mhz */
- scsi_dev_id = PCI_DEVICE_ID_NCR_53C860;
- scsi_max_scsi_id = 7;
- scsi_sym53c8xx_ccf = 0x15;
- pci_write_config_byte (bdf, WINBOND_IDEIRCR, 0xb0);
- }
+ if (pci_find_device(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C860, 0) > 0)
+ {
+ /* BAB740 with SCSI=IRQ 11; SCC=IRQ 9; no IDE; NCR860 at 80 Mhz */
+ scsi_dev_id = PCI_DEVICE_ID_NCR_53C860;
+ scsi_max_scsi_id = 7;
+ scsi_sym53c8xx_ccf = 0x15;
+ pci_write_config_byte (bdf, WINBOND_IDEIRCR, 0xb0);
+ }
- if ((ptr = getenv ("ide_dma_off")) != NULL)
- {
- u_long dma_off = simple_strtoul (ptr, NULL, 10);
- /*
- * setup user defined registers
- * s.a. linux/drivers/ide/sl82c105.c
- */
- bdf |= PCI_BDF(0,0,1); /* ide user reg at bdf function 1 */
- if (dma_off & 1)
- {
- pci_write_config_byte (bdf, 0x46, 1);
- printf("IDE: DMA off flag set: Bus 0 : Dev 0\n");
- }
- if (dma_off & 2)
- {
- pci_write_config_byte (bdf, 0x4a, 1);
- printf("IDE: DMA off flag set: Bus 0 : Dev 1\n");
- }
- if (dma_off & 4)
- {
- pci_write_config_byte (bdf, 0x4e, 1);
- printf("IDE: DMA off flag set: Bus 1 : Dev 0\n");
- }
- if (dma_off & 8)
- {
- pci_write_config_byte (bdf, 0x52, 1);
- printf("IDE: DMA off flag set: Bus 1 : Dev 1\n");
- }
- }
+ if ((ptr = getenv ("ide_dma_off")) != NULL)
+ {
+ u_long dma_off = simple_strtoul (ptr, NULL, 10);
+ /*
+ * setup user defined registers
+ * s.a. linux/drivers/ide/sl82c105.c
+ */
+ bdf |= PCI_BDF(0,0,1); /* ide user reg at bdf function 1 */
+ if (dma_off & 1)
+ {
+ pci_write_config_byte (bdf, 0x46, 1);
+ printf("IDE: DMA off flag set: Bus 0 : Dev 0\n");
+ }
+ if (dma_off & 2)
+ {
+ pci_write_config_byte (bdf, 0x4a, 1);
+ printf("IDE: DMA off flag set: Bus 0 : Dev 1\n");
+ }
+ if (dma_off & 4)
+ {
+ pci_write_config_byte (bdf, 0x4e, 1);
+ printf("IDE: DMA off flag set: Bus 1 : Dev 0\n");
+ }
+ if (dma_off & 8)
+ {
+ pci_write_config_byte (bdf, 0x52, 1);
+ printf("IDE: DMA off flag set: Bus 1 : Dev 1\n");
+ }
+ }
}
return (0);
}
@@ -498,48 +498,48 @@
if (eltec_board == 740)
{
- printf("SYM media select "); /* BAB740 */
- /* start autoneg. with 10 mbit */
- media_reg_init (dev, 0x3ffff, 0x08af0008, 0x00a10008, 0x00a50008, 0x02400080);
- ext = status = 0;
- for (i=0; i<2000+ext; i++)
- {
- status = INL(dev, DE4X5_SISR);
- udelay(1000);
- if (status & 0x2000) ext = 2000;
- if ((status & 0x7000) == 0x5000) break;
- }
+ printf("SYM media select "); /* BAB740 */
+ /* start autoneg. with 10 mbit */
+ media_reg_init (dev, 0x3ffff, 0x08af0008, 0x00a10008, 0x00a50008, 0x02400080);
+ ext = status = 0;
+ for (i=0; i<2000+ext; i++)
+ {
+ status = INL(dev, DE4X5_SISR);
+ udelay(1000);
+ if (status & 0x2000) ext = 2000;
+ if ((status & 0x7000) == 0x5000) break;
+ }
- /* autoneg. ok -> 100MB FD */
- if ((status & 0x0100f000) == 0x0100d000)
- {
- media_reg_init (dev, 0x37f7f, 0x08270008, 0x00210008, 0x00250008, 0x03c40280);
- printf("100baseTx-FD\n");
- }
- /* autoneg. ok -> 100MB HD */
- else if ((status & 0x0080f000) == 0x0080d000)
- {
- media_reg_init (dev, 0x17f7f, 0x08270008, 0x00210008, 0x00250008, 0x03c40080);
- printf("100baseTx\n");
- }
- /* autoneg. ok -> 10MB FD */
- else if ((status & 0x0040f000) == 0x0040d000)
- {
- media_reg_init (dev, 0x07f7f, 0x08af0008, 0x00a10008, 0x00a50008, 0x02400280);
- printf("10baseT-FD\n");
- }
- /* autoneg. fail -> 10MB HD */
- else
- {
- media_reg_init (dev, 0x7f7f, 0x08af0008, 0x00a10008, 0x00a50008,
- (OMR_SDP | OMR_TTM | OMR_PM));
- printf("10baseT\n");
- }
+ /* autoneg. ok -> 100MB FD */
+ if ((status & 0x0100f000) == 0x0100d000)
+ {
+ media_reg_init (dev, 0x37f7f, 0x08270008, 0x00210008, 0x00250008, 0x03c40280);
+ printf("100baseTx-FD\n");
+ }
+ /* autoneg. ok -> 100MB HD */
+ else if ((status & 0x0080f000) == 0x0080d000)
+ {
+ media_reg_init (dev, 0x17f7f, 0x08270008, 0x00210008, 0x00250008, 0x03c40080);
+ printf("100baseTx\n");
+ }
+ /* autoneg. ok -> 10MB FD */
+ else if ((status & 0x0040f000) == 0x0040d000)
+ {
+ media_reg_init (dev, 0x07f7f, 0x08af0008, 0x00a10008, 0x00a50008, 0x02400280);
+ printf("10baseT-FD\n");
+ }
+ /* autoneg. fail -> 10MB HD */
+ else
+ {
+ media_reg_init (dev, 0x7f7f, 0x08af0008, 0x00a10008, 0x00a50008,
+ (OMR_SDP | OMR_TTM | OMR_PM));
+ printf("10baseT\n");
+ }
}
else
{
- printf("MII media selected\n"); /* BAB750 */
- OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR); /* CSR6 */
+ printf("MII media selected\n"); /* BAB750 */
+ OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR); /* CSR6 */
}
}
#endif /* CONFIG_TULIP_SELECT_MEDIA */
diff --git a/board/eltec/bab7xx/pci.c b/board/eltec/bab7xx/pci.c
index a5fcfef..edbd3dd 100644
--- a/board/eltec/bab7xx/pci.c
+++ b/board/eltec/bab7xx/pci.c
@@ -43,48 +43,48 @@
hose->last_busno = 0xff;
pci_set_region(hose->regions + 0,
- CFG_PCI_MEMORY_BUS,
- CFG_PCI_MEMORY_PHYS,
+ CFG_PCI_MEMORY_BUS,
+ CFG_PCI_MEMORY_PHYS,
/*
* Attention: pci_hose_phys_to_bus() failes in address compare,
* so we need (CFG_PCI_MEMORY_SIZE-1)
*/
- CFG_PCI_MEMORY_SIZE-1,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
+ CFG_PCI_MEMORY_SIZE-1,
+ PCI_REGION_MEM | PCI_REGION_MEMORY);
/* PCI memory space */
pci_set_region(hose->regions + 1,
- CFG_PCI_MEM_BUS,
- CFG_PCI_MEM_PHYS,
- CFG_PCI_MEM_SIZE,
- PCI_REGION_MEM);
+ CFG_PCI_MEM_BUS,
+ CFG_PCI_MEM_PHYS,
+ CFG_PCI_MEM_SIZE,
+ PCI_REGION_MEM);
/* ISA/PCI memory space */
pci_set_region(hose->regions + 2,
- CFG_ISA_MEM_BUS,
- CFG_ISA_MEM_PHYS,
- CFG_ISA_MEM_SIZE,
- PCI_REGION_MEM);
+ CFG_ISA_MEM_BUS,
+ CFG_ISA_MEM_PHYS,
+ CFG_ISA_MEM_SIZE,
+ PCI_REGION_MEM);
/* PCI I/O space */
pci_set_region(hose->regions + 3,
- CFG_PCI_IO_BUS,
- CFG_PCI_IO_PHYS,
- CFG_PCI_IO_SIZE,
- PCI_REGION_IO);
+ CFG_PCI_IO_BUS,
+ CFG_PCI_IO_PHYS,
+ CFG_PCI_IO_SIZE,
+ PCI_REGION_IO);
/* ISA/PCI I/O space */
pci_set_region(hose->regions + 4,
- CFG_ISA_IO_BUS,
- CFG_ISA_IO_PHYS,
- CFG_ISA_IO_SIZE,
- PCI_REGION_IO);
+ CFG_ISA_IO_BUS,
+ CFG_ISA_IO_PHYS,
+ CFG_ISA_IO_SIZE,
+ PCI_REGION_IO);
hose->region_count = 5;
pci_setup_indirect(hose,
- MPC106_REG_ADDR,
- MPC106_REG_DATA);
+ MPC106_REG_ADDR,
+ MPC106_REG_DATA);
pci_register_hose(hose);
@@ -93,9 +93,9 @@
/* Initialises the MPC10x PCI Configuration regs. */
pci_read_config_dword (PCI_BDF(0,0,0), PCI_PICR2, ®32);
reg32 |= PICR2_CF_SNOOP_WS(3) |
- PICR2_CF_FLUSH_L2 |
- PICR2_CF_L2_HIT_DELAY(3) |
- PICR2_CF_APHASE_WS(3);
+ PICR2_CF_FLUSH_L2 |
+ PICR2_CF_L2_HIT_DELAY(3) |
+ PICR2_CF_APHASE_WS(3);
reg32 &= ~(PICR2_L2_EN | PICR2_L2_UPDATE_EN);
pci_write_config_dword (PCI_BDF(0,0,0), PCI_PICR2, reg32);
@@ -108,12 +108,12 @@
pci_read_config_dword (PCI_BDF(0,0,0), PCI_PICR1, ®32);
reg32 |= PICR1_CF_CBA(63) |
- PICR1_CF_BREAD_WS(2) |
- PICR1_MCP_EN |
- PICR1_CF_DPARK |
- PICR1_PROC_TYPE_604 |
- PICR1_CF_LOOP_SNOOP |
- PICR1_CF_APARK;
+ PICR1_CF_BREAD_WS(2) |
+ PICR1_MCP_EN |
+ PICR1_CF_DPARK |
+ PICR1_PROC_TYPE_604 |
+ PICR1_CF_LOOP_SNOOP |
+ PICR1_CF_APARK;
pci_write_config_dword (PCI_BDF(0,0,0), PCI_PICR1, reg32);
}
diff --git a/board/eltec/bab7xx/srom.h b/board/eltec/bab7xx/srom.h
index 7924bcd..c18ab91 100644
--- a/board/eltec/bab7xx/srom.h
+++ b/board/eltec/bab7xx/srom.h
@@ -81,18 +81,18 @@
unsigned long el_srom_checksum (unsigned char *ptr, unsigned long size);
int el_srom_load (unsigned char addr, unsigned char *buf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int el_srom_store (unsigned char addr, unsigned char *buf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int mpc107_i2c_init (unsigned long eumb_addr, unsigned long divider);
int mpc107_i2c_read_byte (unsigned char device, unsigned char block, unsigned char offset);
int mpc107_i2c_write_byte (unsigned char device, unsigned char block,
- unsigned char offset, unsigned char val);
+ unsigned char offset, unsigned char val);
int mpc107_srom_load (unsigned char addr, unsigned char *pBuf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int mpc107_srom_store (unsigned char addr, unsigned char *pBuf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int dc_srom_load (unsigned short *dest);
int dc_srom_store (unsigned short *src);
diff --git a/board/eltec/bab7xx/u-boot.lds b/board/eltec/bab7xx/u-boot.lds
index de50bf4..0dfa8c0 100644
--- a/board/eltec/bab7xx/u-boot.lds
+++ b/board/eltec/bab7xx/u-boot.lds
@@ -106,6 +106,11 @@
_edata = .;
PROVIDE (edata = .);
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/board/eltec/elppc/Makefile b/board/eltec/elppc/Makefile
index 1ed1a24..76b2cfe 100644
--- a/board/eltec/elppc/Makefile
+++ b/board/eltec/elppc/Makefile
@@ -30,7 +30,7 @@
SOBJS = asm_init.o
$(LIB): .depend $(OBJS) $(SOBJS)
- $(AR) crv $@ $^
+ $(AR) crv $@ $(OBJS) $(SOBJS)
clean:
rm -f $(SOBJS) $(OBJS)
@@ -46,12 +46,3 @@
sinclude .depend
#########################################################################
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/elppc/eepro100_srom.c b/board/eltec/elppc/eepro100_srom.c
index a5e47cf..9754c1d 100644
--- a/board/eltec/elppc/eepro100_srom.c
+++ b/board/eltec/elppc/eepro100_srom.c
@@ -32,7 +32,7 @@
#include "srom.h"
extern int eepro100_write_eeprom (struct eth_device* dev,
- int location, int addr_len, unsigned short data);
+ int location, int addr_len, unsigned short data);
/*----------------------------------------------------------------------------*/
@@ -43,7 +43,7 @@
for (i = 0; i < (EE_SIZE-1); i++)
{
- sum += sromdata[i];
+ sum += sromdata[i];
}
return (EE_CHECKSUM - sum);
}
@@ -57,7 +57,7 @@
/* get onboard network iobase */
pci_read_config_dword(PCI_BDF(0,0x10,0), PCI_BASE_ADDRESS_0,
- &onboard_dev.iobase);
+ &onboard_dev.iobase);
onboard_dev.iobase &= ~0xf;
source[63] = eepro100_srom_checksum (source);
@@ -65,8 +65,8 @@
for (count=0; count < EE_SIZE; count++)
{
if ( eepro100_write_eeprom ((struct eth_device*)&onboard_dev,
- count, EE_ADDR_BITS, SROM_SHORT(source)) == -1 )
- return -1;
+ count, EE_ADDR_BITS, SROM_SHORT(source)) == -1 )
+ return -1;
source++;
}
return 0;
@@ -89,22 +89,22 @@
/* get onboard network iobase */
pci_read_config_dword(PCI_BDF(0,0x10,0), PCI_BASE_ADDRESS_0,
- &onboard_dev.iobase);
+ &onboard_dev.iobase);
onboard_dev.iobase &= ~0xf;
memset (destination, 0x65, 128);
for (count=0; count < 0x40; count++)
{
- *destination++ = read_eeprom (struct eth_device*)&onboard_dev,
- count, EE_ADDR_BITS);
+ *destination++ = read_eeprom (struct eth_device*)&onboard_dev,
+ count, EE_ADDR_BITS);
#ifdef DEBUG
- printf ("%04x ", *(destination - 1));
- if (lr++ == 7)
- {
- printf("\n");
- lr = 0;
- }
+ printf ("%04x ", *(destination - 1));
+ if (lr++ == 7)
+ {
+ printf("\n");
+ lr = 0;
+ }
#endif
}
}
diff --git a/board/eltec/elppc/elppc.c b/board/eltec/elppc/elppc.c
index 97b70a4..7b4d7d2 100644
--- a/board/eltec/elppc/elppc.c
+++ b/board/eltec/elppc/elppc.c
@@ -30,82 +30,81 @@
int checkboard (void)
{
- puts ("Board: ELTEC PowerPC\n");
- return (0);
+ puts ("Board: ELTEC PowerPC\n");
+ return (0);
}
/* ------------------------------------------------------------------------- */
int checkflash (void)
{
- /* TODO */
- printf ("Test not implemented !\n");
- return (0);
+ /* TODO */
+ printf ("Test not implemented !\n");
+ return (0);
}
/* ------------------------------------------------------------------------- */
static unsigned int mpc106_read_cfg_dword (unsigned int reg)
{
- unsigned int reg_addr = MPC106_REG | (reg & 0xFFFFFFFC);
+ unsigned int reg_addr = MPC106_REG | (reg & 0xFFFFFFFC);
- out32r(MPC106_REG_ADDR, reg_addr);
+ out32r (MPC106_REG_ADDR, reg_addr);
- return (in32r(MPC106_REG_DATA | (reg & 0x3)));
+ return (in32r (MPC106_REG_DATA | (reg & 0x3)));
}
/* ------------------------------------------------------------------------- */
long int dram_size (int board_type)
{
- /*
- * No actual initialisation to do - done when setting up
- * PICRs MCCRs ME/SARs etc in asm_init.S.
- */
+ /*
+ * No actual initialisation to do - done when setting up
+ * PICRs MCCRs ME/SARs etc in asm_init.S.
+ */
- register unsigned long i, msar1, mear1, memSize;
+ register unsigned long i, msar1, mear1, memSize;
#if defined(CFG_MEMTEST)
- register unsigned long reg;
+ register unsigned long reg;
- printf("Testing DRAM\n");
+ printf ("Testing DRAM\n");
- /* write each mem addr with it's address */
- for (reg = CFG_MEMTEST_START; reg < CFG_MEMTEST_END; reg+=4)
- *reg = reg;
+ /* write each mem addr with it's address */
+ for (reg = CFG_MEMTEST_START; reg < CFG_MEMTEST_END; reg += 4)
+ *reg = reg;
- for (reg = CFG_MEMTEST_START; reg < CFG_MEMTEST_END; reg+=4)
- {
- if (*reg != reg)
- return -1;
- }
+ for (reg = CFG_MEMTEST_START; reg < CFG_MEMTEST_END; reg += 4) {
+ if (*reg != reg)
+ return -1;
+ }
#endif
- /*
- * Since MPC107 memory controller chip has already been set to
- * control all memory, just read and interpret its memory boundery register.
- */
- memSize = 0;
- msar1 = mpc106_read_cfg_dword(MPC106_MSAR1);
- mear1 = mpc106_read_cfg_dword(MPC106_MEAR1);
- i = mpc106_read_cfg_dword(MPC106_MBER) & 0xf;
+ /*
+ * Since MPC107 memory controller chip has already been set to
+ * control all memory, just read and interpret its memory boundery register.
+ */
+ memSize = 0;
+ msar1 = mpc106_read_cfg_dword (MPC106_MSAR1);
+ mear1 = mpc106_read_cfg_dword (MPC106_MEAR1);
+ i = mpc106_read_cfg_dword (MPC106_MBER) & 0xf;
- do
- {
- if (i & 0x01) /* is bank enabled ? */
- memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
- msar1 >>= 8;
- mear1 >>= 8;
- i >>= 1;
- } while (i);
+ do {
+ if (i & 0x01) /* is bank enabled ? */
+ memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
+ msar1 >>= 8;
+ mear1 >>= 8;
+ i >>= 1;
+ } while (i);
- return (memSize * 0x100000);
+ return (memSize * 0x100000);
}
+
/* ------------------------------------------------------------------------- */
-long int initdram(int board_type)
+long int initdram (int board_type)
{
- return dram_size(board_type);
+ return dram_size (board_type);
}
/* ------------------------------------------------------------------------- */
@@ -115,9 +114,10 @@
* Register PI in the MPC 107 (at offset 0x41090 of the Embedded Utilities
* Memory Block).
*/
-void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
+int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
- out8(MPC107_EUMB_PI, 1);
+ out8 (MPC107_EUMB_PI, 1);
+ return (0);
}
/* ------------------------------------------------------------------------- */
@@ -128,21 +128,21 @@
* Since the 7xx CPUs don't have an internal watchdog, this function is
* board specific.
*/
-void watchdog_reset(void)
+void watchdog_reset (void)
{
}
-#endif /* CONFIG_WATCHDOG */
+#endif /* CONFIG_WATCHDOG */
/* ------------------------------------------------------------------------- */
void after_reloc (ulong dest_addr)
{
- DECLARE_GLOBAL_DATA_PTR;
+ DECLARE_GLOBAL_DATA_PTR;
- /*
- * Jump to the main U-Boot board init code
- */
- board_init_r(gd, dest_addr);
+ /*
+ * Jump to the main U-Boot board init code
+ */
+ board_init_r (gd, dest_addr);
}
/* ------------------------------------------------------------------------- */
@@ -152,38 +152,23 @@
void video_get_info_str (int line_number, char *info)
{
- /* init video info strings for graphic console */
- switch (line_number)
- {
- case 1:
- sprintf (info," MPC7xx V%d.%d at %d / %d MHz",
- (get_pvr() >> 8) & 0xFF,
- get_pvr() & 0xFF,
- 400,
- 100);
- return;
- case 2:
- sprintf (info, " ELTEC ELPPC with %ld MB DRAM and %ld MB FLASH",
- dram_size(0)/0x100000,
- flash_init()/0x100000);
- return;
- case 3:
- sprintf (info, " %s", smi.modeIdent);
- return;
- }
+ /* init video info strings for graphic console */
+ switch (line_number) {
+ case 1:
+ sprintf (info, " MPC7xx V%d.%d at %d / %d MHz",
+ (get_pvr () >> 8) & 0xFF, get_pvr () & 0xFF, 400, 100);
+ return;
+ case 2:
+ sprintf (info, " ELTEC ELPPC with %ld MB DRAM and %ld MB FLASH",
+ dram_size (0) / 0x100000, flash_init () / 0x100000);
+ return;
+ case 3:
+ sprintf (info, " %s", smi.modeIdent);
+ return;
+ }
- /* no more info lines */
- *info = 0;
- return;
+ /* no more info lines */
+ *info = 0;
+ return;
}
#endif
-
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/elppc/flash.c b/board/eltec/elppc/flash.c
index 73496a1..442dd00 100644
--- a/board/eltec/elppc/flash.c
+++ b/board/eltec/elppc/flash.c
@@ -57,7 +57,7 @@
/* Init: no FLASHes known */
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i)
{
- flash_info[i].flash_id = FLASH_UNKNOWN;
+ flash_info[i].flash_id = FLASH_UNKNOWN;
}
/* initialise 1st flash */
@@ -65,8 +65,8 @@
if (flash_info[0].flash_id == FLASH_UNKNOWN)
{
- printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
- size1, size1<<20);
+ printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
+ size1, size1<<20);
}
/* initialise 2nd flash */
@@ -74,31 +74,31 @@
if (flash_info[1].flash_id == FLASH_UNKNOWN)
{
- printf ("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n",
- size2, size2<<20);
+ printf ("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n",
+ size2, size2<<20);
}
/* monitor protection ON by default */
if (size1 == 512*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- FLASH_BASE0_PRELIM,
- FLASH_BASE0_PRELIM+monitor_flash_len-1,
- &flash_info[0]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ FLASH_BASE0_PRELIM,
+ FLASH_BASE0_PRELIM+monitor_flash_len-1,
+ &flash_info[0]);
}
if (size2 == 512*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- FLASH_BASE1_PRELIM,
- FLASH_BASE1_PRELIM+monitor_flash_len-1,
- &flash_info[1]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ FLASH_BASE1_PRELIM,
+ FLASH_BASE1_PRELIM+monitor_flash_len-1,
+ &flash_info[1]);
}
if (size2 == 4*1024*1024)
{
- (void)flash_protect(FLAG_PROTECT_SET,
- CFG_FLASH_BASE,
- CFG_FLASH_BASE+monitor_flash_len-1,
- &flash_info[1]);
+ (void)flash_protect(FLAG_PROTECT_SET,
+ CFG_FLASH_BASE,
+ CFG_FLASH_BASE+monitor_flash_len-1,
+ &flash_info[1]);
}
return (size1 + size2);
@@ -115,72 +115,72 @@
volatile unsigned long *flash;
if (info->flash_id == FLASH_UNKNOWN) {
- printf ("missing or unknown FLASH type\n");
- flash_init();
+ printf ("missing or unknown FLASH type\n");
+ flash_init();
}
if (info->flash_id == FLASH_UNKNOWN) {
- printf ("missing or unknown FLASH type\n");
- return;
+ printf ("missing or unknown FLASH type\n");
+ return;
}
switch (info->flash_id & FLASH_VENDMASK) {
case FLASH_MAN_AMD:
- printf ("AMD ");
- break;
+ printf ("AMD ");
+ break;
default:
- printf ("Unknown Vendor ");
- break;
+ printf ("Unknown Vendor ");
+ break;
}
switch (info->flash_id & FLASH_TYPEMASK) {
case AMD_ID_F040B:
- printf ("AM29F040B (4 Mbit)\n");
- break;
+ printf ("AM29F040B (4 Mbit)\n");
+ break;
case AMD_ID_F016D:
- printf ("AM29F016D (16 Mbit)\n");
- break;
+ printf ("AM29F016D (16 Mbit)\n");
+ break;
case AMD_ID_F032B:
- printf ("AM29F032B (32 Mbit)\n");
- break;
+ printf ("AM29F032B (32 Mbit)\n");
+ break;
default:
- printf ("Unknown Chip Type\n");
- break;
+ printf ("Unknown Chip Type\n");
+ break;
}
if (info->size >= (1 << 20)) {
- printf (" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
+ printf (" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
} else {
- printf (" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count);
+ printf (" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count);
}
printf (" Sector Start Addresses:");
for (i=0; i<info->sector_count; ++i) {
- /*
- * Check if whole sector is erased
- */
- if (i != (info->sector_count-1))
- size = info->start[i+1] - info->start[i];
- else
- size = info->start[0] + info->size - info->start[i];
+ /*
+ * Check if whole sector is erased
+ */
+ if (i != (info->sector_count-1))
+ size = info->start[i+1] - info->start[i];
+ else
+ size = info->start[0] + info->size - info->start[i];
- erased = 1;
- flash = (volatile unsigned long *)info->start[i];
- size = size >> 2; /* divide by 4 for longword access */
- for (k=0; k<size; k++) {
- if (*flash++ != 0xffffffff) {
- erased = 0;
- break;
- }
- }
+ erased = 1;
+ flash = (volatile unsigned long *)info->start[i];
+ size = size >> 2; /* divide by 4 for longword access */
+ for (k=0; k<size; k++) {
+ if (*flash++ != 0xffffffff) {
+ erased = 0;
+ break;
+ }
+ }
- if ((i % 5) == 0)
- printf ("\n ");
+ if ((i % 5) == 0)
+ printf ("\n ");
- printf (" %08lX%s%s",
- info->start[i],
- erased ? " E" : " ",
- info->protect[i] ? "RO " : " ");
+ printf (" %08lX%s%s",
+ info->start[i],
+ erased ? " E" : " ",
+ info->protect[i] ? "RO " : " ");
}
printf ("\n");
}
@@ -226,37 +226,37 @@
/* We accept only two AMD types */
switch (vendor) {
case (FLASH_WORD_SIZE)AMD_MANUFACT:
- info->flash_id = FLASH_MAN_AMD;
- break;
+ info->flash_id = FLASH_MAN_AMD;
+ break;
default:
- info->flash_id = FLASH_UNKNOWN;
- info->sector_count = 0;
- info->size = 0;
- return (0); /* no or unknown flash */
+ info->flash_id = FLASH_UNKNOWN;
+ info->sector_count = 0;
+ info->size = 0;
+ return (0); /* no or unknown flash */
}
switch (devid) {
case (FLASH_WORD_SIZE)AMD_ID_F040B:
- info->flash_id |= AMD_ID_F040B;
- info->sector_count = 8;
- info->size = 0x00080000;
- break; /* => 0.5 MB */
+ info->flash_id |= AMD_ID_F040B;
+ info->sector_count = 8;
+ info->size = 0x00080000;
+ break; /* => 0.5 MB */
case (FLASH_WORD_SIZE)AMD_ID_F016D:
- info->flash_id |= AMD_ID_F016D;
- info->sector_count = 32;
- info->size = 0x00200000;
- break; /* => 2 MB */
+ info->flash_id |= AMD_ID_F016D;
+ info->sector_count = 32;
+ info->size = 0x00200000;
+ break; /* => 2 MB */
case (FLASH_WORD_SIZE)AMD_ID_F032B:
- info->flash_id |= AMD_ID_F032B;
- info->sector_count = 64;
- info->size = 0x00400000;
- break; /* => 4 MB */
+ info->flash_id |= AMD_ID_F032B;
+ info->sector_count = 64;
+ info->size = 0x00400000;
+ break; /* => 4 MB */
default:
- info->flash_id = FLASH_UNKNOWN;
- return (0); /* => no or unknown flash */
+ info->flash_id = FLASH_UNKNOWN;
+ return (0); /* => no or unknown flash */
}
@@ -266,20 +266,20 @@
/* check for protected sectors */
for (i = 0; i < info->sector_count; i++) {
- /* sector base address */
- info->start[i] = base + i * (info->size / info->sector_count);
- /* read sector protection at sector address, (A7 .. A0) = 0x02 */
- /* D0 = 1 if protected */
- caddr = (volatile unsigned char *)(info->start[i]);
- info->protect[i] = caddr[2] & 1;
+ /* sector base address */
+ info->start[i] = base + i * (info->size / info->sector_count);
+ /* read sector protection at sector address, (A7 .. A0) = 0x02 */
+ /* D0 = 1 if protected */
+ caddr = (volatile unsigned char *)(info->start[i]);
+ info->protect[i] = caddr[2] & 1;
}
/*
* Prevent writes to uninitialized FLASH.
*/
if (info->flash_id != FLASH_UNKNOWN) {
- caddr = (volatile unsigned char *)info->start[0];
- caddr[0] = 0xF0; /* reset bank */
+ caddr = (volatile unsigned char *)info->start[0];
+ caddr[0] = 0xF0; /* reset bank */
}
return (info->size);
@@ -295,32 +295,32 @@
int rc = 0;
if ((s_first < 0) || (s_first > s_last)) {
- if (info->flash_id == FLASH_UNKNOWN) {
- printf ("- missing\n");
- } else {
- printf ("- no sectors to erase\n");
- }
- return 1;
+ if (info->flash_id == FLASH_UNKNOWN) {
+ printf ("- missing\n");
+ } else {
+ printf ("- no sectors to erase\n");
+ }
+ return 1;
}
if ((info->flash_id == FLASH_UNKNOWN) ||
- (info->flash_id > FLASH_AMD_COMP)) {
- printf ("Can't erase unknown flash type - aborted\n");
- return 1;
+ (info->flash_id > FLASH_AMD_COMP)) {
+ printf ("Can't erase unknown flash type - aborted\n");
+ return 1;
}
prot = 0;
for (sect=s_first; sect<=s_last; ++sect) {
- if (info->protect[sect]) {
- prot++;
- }
+ if (info->protect[sect]) {
+ prot++;
+ }
}
if (prot) {
- printf ("- Warning: %d protected sectors will not be erased!\n",
- prot);
+ printf ("- Warning: %d protected sectors will not be erased!\n",
+ prot);
} else {
- printf ("\n");
+ printf ("\n");
}
l_sect = -1;
@@ -336,26 +336,26 @@
/* Start erase on unprotected sectors */
for (sect = s_first; sect<=s_last; sect++) {
- if (info->protect[sect] == 0) { /* not protected */
- addr = (FLASH_WORD_SIZE *)(info->start[sect]);
- if (info->flash_id & FLASH_MAN_SST) {
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00800080;
- addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr[0] = (FLASH_WORD_SIZE)0x00500050; /* block erase */
- udelay(30000); /* wait 30 ms */
- }
- else
- addr[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
- l_sect = sect;
- }
+ if (info->protect[sect] == 0) { /* not protected */
+ addr = (FLASH_WORD_SIZE *)(info->start[sect]);
+ if (info->flash_id & FLASH_MAN_SST) {
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00800080;
+ addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr[0] = (FLASH_WORD_SIZE)0x00500050; /* block erase */
+ udelay(30000); /* wait 30 ms */
+ }
+ else
+ addr[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
+ l_sect = sect;
+ }
}
/* re-enable interrupts if necessary */
if (flag)
- enable_interrupts();
+ enable_interrupts();
/* wait at least 80us - let's wait 1 ms */
udelay (1000);
@@ -364,21 +364,21 @@
* We wait for the last triggered sector
*/
if (l_sect < 0)
- goto DONE;
+ goto DONE;
start = get_timer (0);
last = start;
addr = (FLASH_WORD_SIZE *)(info->start[l_sect]);
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
- if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
- printf ("Timeout\n");
- return 1;
- }
- /* show that we're waiting */
- if ((now - last) > 1000) { /* every second */
- serial_putc ('.');
- last = now;
- }
+ if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+ printf ("Timeout\n");
+ return 1;
+ }
+ /* show that we're waiting */
+ if ((now - last) > 1000) { /* every second */
+ serial_putc ('.');
+ last = now;
+ }
}
DONE:
@@ -408,42 +408,42 @@
* handle unaligned start bytes
*/
if ((l = addr - wp) != 0) {
- data = 0;
- for (i=0, cp=wp; i<l; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
- }
- for (; i<4 && cnt>0; ++i) {
- data = (data << 8) | *src++;
- --cnt;
- ++cp;
- }
- for (; cnt==0 && i<4; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
- }
+ data = 0;
+ for (i=0, cp=wp; i<l; ++i, ++cp) {
+ data = (data << 8) | (*(uchar *)cp);
+ }
+ for (; i<4 && cnt>0; ++i) {
+ data = (data << 8) | *src++;
+ --cnt;
+ ++cp;
+ }
+ for (; cnt==0 && i<4; ++i, ++cp) {
+ data = (data << 8) | (*(uchar *)cp);
+ }
- if ((rc = write_word(info, wp, data)) != 0) {
- return (rc);
- }
- wp += 4;
+ if ((rc = write_word(info, wp, data)) != 0) {
+ return (rc);
+ }
+ wp += 4;
}
/*
* handle word aligned part
*/
while (cnt >= 4) {
- data = 0;
- for (i=0; i<4; ++i) {
- data = (data << 8) | *src++;
- }
- if ((rc = write_word(info, wp, data)) != 0) {
- return (rc);
- }
- wp += 4;
- cnt -= 4;
+ data = 0;
+ for (i=0; i<4; ++i) {
+ data = (data << 8) | *src++;
+ }
+ if ((rc = write_word(info, wp, data)) != 0) {
+ return (rc);
+ }
+ wp += 4;
+ cnt -= 4;
}
if (cnt == 0) {
- return (0);
+ return (0);
}
/*
@@ -451,11 +451,11 @@
*/
data = 0;
for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
- data = (data << 8) | *src++;
- --cnt;
+ data = (data << 8) | *src++;
+ --cnt;
}
for (; i<4; ++i, ++cp) {
- data = (data << 8) | (*(uchar *)cp);
+ data = (data << 8) | (*(uchar *)cp);
}
return (write_word(info, wp, data));
@@ -469,45 +469,44 @@
*/
static int write_word (flash_info_t *info, ulong dest, ulong data)
{
- volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
- volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
- volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
+ volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
+ volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
+ volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
ulong start;
int flag;
- int i;
+ int i;
/* Check if Flash is (sufficiently) erased */
if ((*((volatile FLASH_WORD_SIZE *)dest) &
- (FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
- return (2);
+ (FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
+ return (2);
}
/* Disable interrupts which might cause a timeout here */
flag = disable_interrupts();
- for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
- {
- addr2[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
- addr2[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
- addr2[ADDR0] = (FLASH_WORD_SIZE)0x00A000A0;
+ for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
+ {
+ addr2[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
+ addr2[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
+ addr2[ADDR0] = (FLASH_WORD_SIZE)0x00A000A0;
- dest2[i] = data2[i];
+ dest2[i] = data2[i];
- /* re-enable interrupts if necessary */
- if (flag)
- enable_interrupts();
+ /* re-enable interrupts if necessary */
+ if (flag)
+ enable_interrupts();
- /* data polling for D7 */
- start = get_timer (0);
- while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
- (data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
- return (1);
- }
- }
- }
+ /* data polling for D7 */
+ start = get_timer (0);
+ while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
+ (data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
+ if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+ return (1);
+ }
+ }
+ }
return (0);
}
/*----------------------------------------------------------------------------*/
-
diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c
index 7bfb3a4..f33aef7 100644
--- a/board/eltec/elppc/misc.c
+++ b/board/eltec/elppc/misc.c
@@ -32,7 +32,7 @@
extern char console_buffer[CFG_CBSIZE];
extern int l2_cache_enable (int l2control);
extern int eepro100_write_eeprom (struct eth_device* dev, int location,
- int addr_len, unsigned short data);
+ int addr_len, unsigned short data);
extern int read_eeprom (struct eth_device* dev, int location, int addr_len);
/*----------------------------------------------------------------------------*/
@@ -45,7 +45,7 @@
uchar *s = (uchar *) (CFG_ENV_MAP_ADRS + src);
while (count--)
- *d++ = *s++;
+ *d++ = *s++;
return dest;
}
@@ -56,7 +56,7 @@
uchar *s = (uchar *) src;
while (count--)
- *d++ = *s++;
+ *d++ = *s++;
}
/*----------------------------------------------------------------------------*/
@@ -72,7 +72,7 @@
u_int i, l, initSrom, copyNv;
char buf[256];
char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
- 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
+ 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
/* Clock setting for MPC107 i2c */
mpc107_i2c_init (MPC107_EUMB_ADDR, 0x2b);
@@ -91,166 +91,166 @@
/* read out current revision srom contens */
mpc107_srom_load (0x0000, (u_char*)&eerev, sizeof(revinfo),
- SECOND_DEVICE, FIRST_BLOCK);
+ SECOND_DEVICE, FIRST_BLOCK);
/* read out current nvram shadow image */
nvram_read (buf, CFG_NV_SROM_COPY_ADDR, CFG_SROM_SIZE);
if (strcmp (eerev.magic, "ELTEC") != 0)
{
- /* srom is not initialized -> create a default revision info */
- for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
- *ptr++ = 0x00;
- strcpy(eerev.magic, "ELTEC");
- eerev.revrev[0] = 1;
- eerev.revrev[1] = 0;
- eerev.size = 0x00E0;
- eerev.category[0] = 0x01;
+ /* srom is not initialized -> create a default revision info */
+ for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
+ *ptr++ = 0x00;
+ strcpy(eerev.magic, "ELTEC");
+ eerev.revrev[0] = 1;
+ eerev.revrev[1] = 0;
+ eerev.size = 0x00E0;
+ eerev.category[0] = 0x01;
- /* node id from dead e128 as default */
- eerev.etheraddr[0] = 0x00;
- eerev.etheraddr[1] = 0x00;
- eerev.etheraddr[2] = 0x5B;
- eerev.etheraddr[3] = 0x00;
- eerev.etheraddr[4] = 0x2E;
- eerev.etheraddr[5] = 0x4D;
+ /* node id from dead e128 as default */
+ eerev.etheraddr[0] = 0x00;
+ eerev.etheraddr[1] = 0x00;
+ eerev.etheraddr[2] = 0x5B;
+ eerev.etheraddr[3] = 0x00;
+ eerev.etheraddr[4] = 0x2E;
+ eerev.etheraddr[5] = 0x4D;
- /* cache config word for ELPPC */
- *(int*)&eerev.res[0] = 0;
+ /* cache config word for ELPPC */
+ *(int*)&eerev.res[0] = 0;
- initSrom = 1; /* force dialog */
- copyNv = 1; /* copy to nvram */
+ initSrom = 1; /* force dialog */
+ copyNv = 1; /* copy to nvram */
}
if ((copyNv == 0) && (el_srom_checksum((u_char*)&eerev, CFG_SROM_SIZE) !=
- el_srom_checksum((u_char*)buf, CFG_SROM_SIZE)))
+ el_srom_checksum((u_char*)buf, CFG_SROM_SIZE)))
{
- printf ("Invalid revision info copy in nvram !\n");
- printf ("Press key:\n <c> to copy current revision info to nvram.\n");
- printf (" <r> to reenter revision info.\n");
- printf ("=> ");
- if (0 != readline (NULL))
- {
- switch ((char)toupper(console_buffer[0]))
- {
- case 'C':
- copyNv = 1;
- break;
- case 'R':
- copyNv = 1;
- initSrom = 1;
- break;
- }
- }
+ printf ("Invalid revision info copy in nvram !\n");
+ printf ("Press key:\n <c> to copy current revision info to nvram.\n");
+ printf (" <r> to reenter revision info.\n");
+ printf ("=> ");
+ if (0 != readline (NULL))
+ {
+ switch ((char)toupper(console_buffer[0]))
+ {
+ case 'C':
+ copyNv = 1;
+ break;
+ case 'R':
+ copyNv = 1;
+ initSrom = 1;
+ break;
+ }
+ }
}
if (initSrom)
{
- memcpy (buf, &eerev.revision[0][0], 14); /* save all revision info */
- printf ("Enter revision number (0-9): %c ", eerev.revision[0][0]);
- if (0 != readline (NULL))
- {
- eerev.revision[0][0] = (char)toupper(console_buffer[0]);
- memcpy (&eerev.revision[1][0], buf, 12); /* shift rest of rev info */
- }
+ memcpy (buf, &eerev.revision[0][0], 14); /* save all revision info */
+ printf ("Enter revision number (0-9): %c ", eerev.revision[0][0]);
+ if (0 != readline (NULL))
+ {
+ eerev.revision[0][0] = (char)toupper(console_buffer[0]);
+ memcpy (&eerev.revision[1][0], buf, 12); /* shift rest of rev info */
+ }
- printf ("Enter revision character (A-Z): %c ", eerev.revision[0][1]);
- if (1 == readline (NULL))
- {
- eerev.revision[0][1] = (char)toupper(console_buffer[0]);
- }
+ printf ("Enter revision character (A-Z): %c ", eerev.revision[0][1]);
+ if (1 == readline (NULL))
+ {
+ eerev.revision[0][1] = (char)toupper(console_buffer[0]);
+ }
- printf ("Enter board name (V-XXXX-XXXX): %s ", (char *)&eerev.board);
- if (11 == readline (NULL))
- {
- for (i=0; i<11; i++)
- eerev.board[i] = (char)toupper(console_buffer[i]);
- eerev.board[11] = '\0';
- }
+ printf ("Enter board name (V-XXXX-XXXX): %s ", (char *)&eerev.board);
+ if (11 == readline (NULL))
+ {
+ for (i=0; i<11; i++)
+ eerev.board[i] = (char)toupper(console_buffer[i]);
+ eerev.board[11] = '\0';
+ }
- printf ("Enter serial number: %s ", (char *)&eerev.serial );
- if (6 == readline (NULL))
- {
- for (i=0; i<6; i++)
- eerev.serial[i] = console_buffer[i];
- eerev.serial[6] = '\0';
- }
+ printf ("Enter serial number: %s ", (char *)&eerev.serial );
+ if (6 == readline (NULL))
+ {
+ for (i=0; i<6; i++)
+ eerev.serial[i] = console_buffer[i];
+ eerev.serial[6] = '\0';
+ }
- printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
- eerev.etheraddr[0], eerev.etheraddr[1],
- eerev.etheraddr[2], eerev.etheraddr[3],
- eerev.etheraddr[4], eerev.etheraddr[5]);
- if (12 == readline (NULL))
- {
- for (i=0; i<12; i+=2)
- eerev.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
- hex[toupper(console_buffer[i+1])-'0']);
- }
+ printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
+ eerev.etheraddr[0], eerev.etheraddr[1],
+ eerev.etheraddr[2], eerev.etheraddr[3],
+ eerev.etheraddr[4], eerev.etheraddr[5]);
+ if (12 == readline (NULL))
+ {
+ for (i=0; i<12; i+=2)
+ eerev.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
+ hex[toupper(console_buffer[i+1])-'0']);
+ }
- l = strlen ((char *)&eerev.text);
- printf("Add to text section (max 64 chr): %s ", (char *)&eerev.text );
- if (0 != readline (NULL))
- {
- for (i = l; i<63; i++)
- eerev.text[i] = console_buffer[i-l];
- eerev.text[63] = '\0';
- }
+ l = strlen ((char *)&eerev.text);
+ printf("Add to text section (max 64 chr): %s ", (char *)&eerev.text );
+ if (0 != readline (NULL))
+ {
+ for (i = l; i<63; i++)
+ eerev.text[i] = console_buffer[i-l];
+ eerev.text[63] = '\0';
+ }
- /* prepare network eeprom */
- memset (buf, 0, 128);
+ /* prepare network eeprom */
+ memset (buf, 0, 128);
- buf[0] = eerev.etheraddr[1];
- buf[1] = eerev.etheraddr[0];
- buf[2] = eerev.etheraddr[3];
- buf[3] = eerev.etheraddr[2];
- buf[4] = eerev.etheraddr[5];
- buf[5] = eerev.etheraddr[4];
+ buf[0] = eerev.etheraddr[1];
+ buf[1] = eerev.etheraddr[0];
+ buf[2] = eerev.etheraddr[3];
+ buf[3] = eerev.etheraddr[2];
+ buf[4] = eerev.etheraddr[5];
+ buf[5] = eerev.etheraddr[4];
- *(unsigned short *)&buf[20] = 0x48B2;
- *(unsigned short *)&buf[22] = 0x0004;
- *(unsigned short *)&buf[24] = 0x1433;
+ *(unsigned short *)&buf[20] = 0x48B2;
+ *(unsigned short *)&buf[22] = 0x0004;
+ *(unsigned short *)&buf[24] = 0x1433;
- printf("\nSRom: Writing i82559 info ........ ");
- if (eepro100_srom_store ((unsigned short *)buf) == -1)
- printf("FAILED\n");
- else
- printf("OK\n");
+ printf("\nSRom: Writing i82559 info ........ ");
+ if (eepro100_srom_store ((unsigned short *)buf) == -1)
+ printf("FAILED\n");
+ else
+ printf("OK\n");
- /* update CRC */
- eerev.crc = el_srom_checksum((u_char *)eerev.board, eerev.size);
+ /* update CRC */
+ eerev.crc = el_srom_checksum((u_char *)eerev.board, eerev.size);
- /* write new values */
- printf("\nSRom: Writing revision info ...... ");
- if (mpc107_srom_store((BLOCK_SIZE-sizeof(revinfo)), (u_char *)&eerev,
- sizeof(revinfo), SECOND_DEVICE, FIRST_BLOCK) == -1)
- printf("FAILED\n\n");
- else
- printf("OK\n\n");
+ /* write new values */
+ printf("\nSRom: Writing revision info ...... ");
+ if (mpc107_srom_store((BLOCK_SIZE-sizeof(revinfo)), (u_char *)&eerev,
+ sizeof(revinfo), SECOND_DEVICE, FIRST_BLOCK) == -1)
+ printf("FAILED\n\n");
+ else
+ printf("OK\n\n");
- /* write new values as shadow image to nvram */
- nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
+ /* write new values as shadow image to nvram */
+ nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
} /*if (initSrom) */
/* copy current values as shadow image to nvram */
if (initSrom == 0 && copyNv == 1)
- nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
+ nvram_write (CFG_NV_SROM_COPY_ADDR, (void *)&eerev, CFG_SROM_SIZE);
/* update environment */
sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x",
- eerev.etheraddr[0], eerev.etheraddr[1],
- eerev.etheraddr[2], eerev.etheraddr[3],
- eerev.etheraddr[4], eerev.etheraddr[5]);
+ eerev.etheraddr[0], eerev.etheraddr[1],
+ eerev.etheraddr[2], eerev.etheraddr[3],
+ eerev.etheraddr[4], eerev.etheraddr[5]);
setenv ("ethaddr", buf);
/* set serial console as default */
if ((ptr = getenv ("console")) == NULL)
- setenv ("console", "serial");
+ setenv ("console", "serial");
/* print actual board identification */
printf("Ident: %s Ser %s Rev %c%c\n",
- eerev.board, (char *)&eerev.serial,
- eerev.revision[0][0], eerev.revision[0][1]);
+ eerev.board, (char *)&eerev.serial,
+ eerev.revision[0][0], eerev.revision[0][1]);
return (0);
}
diff --git a/board/eltec/elppc/mpc107_i2c.c b/board/eltec/elppc/mpc107_i2c.c
index a4bf599..ae6642e 100644
--- a/board/eltec/elppc/mpc107_i2c.c
+++ b/board/eltec/elppc/mpc107_i2c.c
@@ -43,13 +43,13 @@
for (; size; size--)
{
- byte = *ptr++;
- for (i = 8; i; i--)
- {
- f = ((byte & 1) ^ (accu & 1)) ? 0x84083001 : 0;
- accu >>= 1; accu ^= f;
- byte >>= 1;
- }
+ byte = *ptr++;
+ for (i = 8; i; i--)
+ {
+ f = ((byte & 1) ^ (accu & 1)) ? 0x84083001 : 0;
+ accu >>= 1; accu ^= f;
+ byte >>= 1;
+ }
}
return(accu);
}
@@ -62,13 +62,13 @@
while (((x = in32r(MPC107_I2CSR)) & 0x82) != 0x82)
{
- if (!timeout--)
- return -1;
+ if (!timeout--)
+ return -1;
}
if (x & 0x10)
{
- return -1;
+ return -1;
}
out32r(MPC107_I2CSR, 0);
@@ -81,8 +81,8 @@
{
while (in32r(MPC107_I2CSR) & 0x20)
{
- if (!timeout--)
- return -1;
+ if (!timeout--)
+ return -1;
}
return 0;
}
@@ -99,7 +99,7 @@
int data;
if (!mpc107_eumb_addr)
- return -6;
+ return -6;
mpc107_i2c_wait_idle (timeout);
@@ -112,15 +112,15 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_read Error 1\n");
- return -2;
+ printf("mpc107_i2c_read Error 1\n");
+ return -2;
}
if (in32r(MPC107_I2CSR)&0x1)
{
- /* Generate STOP condition; device busy or not existing */
- out32r(MPC107_I2CCR, 0x80);
- return -1;
+ /* Generate STOP condition; device busy or not existing */
+ out32r(MPC107_I2CCR, 0x80);
+ return -1;
}
/* Data address */
@@ -128,8 +128,8 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_read Error 2\n");
- return -3;
+ printf("mpc107_i2c_read Error 2\n");
+ return -3;
}
/* Switch to read - restart */
@@ -138,8 +138,8 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_read Error 3\n");
- return -4;
+ printf("mpc107_i2c_read Error 3\n");
+ return -4;
}
out32r(MPC107_I2CCR, 0xA8); /* no ACK */
@@ -147,8 +147,8 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_read Error 4\n");
- return -5;
+ printf("mpc107_i2c_read Error 4\n");
+ return -5;
}
/* Generate STOP condition */
out32r(MPC107_I2CCR, 0x88);
@@ -171,7 +171,7 @@
unsigned long timeout = MPC107_I2C_TIMEOUT;
if (!mpc107_eumb_addr)
- return -6;
+ return -6;
mpc107_i2c_wait_idle(timeout);
@@ -184,8 +184,8 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_write Error 1\n");
- return -1;
+ printf("mpc107_i2c_write Error 1\n");
+ return -1;
}
/* Data address */
@@ -193,16 +193,16 @@
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_write Error 2\n");
- return -1;
+ printf("mpc107_i2c_write Error 2\n");
+ return -1;
}
/* Write */
out32r(MPC107_I2CDR, val);
if (mpc107_i2c_wait(timeout) < 0)
{
- printf("mpc107_i2c_write Error 3\n");
- return -1;
+ printf("mpc107_i2c_write Error 3\n");
+ return -1;
}
/* Generate Stop Condition */
@@ -227,38 +227,38 @@
for (i = 0; i < cnt; i++)
{
- timeout=100;
- do
- {
- val = mpc107_i2c_read_byte (device, block, addr);
- if (val < -1)
- {
- printf("i2c_read_error %d at dev %x block %x addr %x\n",
- val, device, block, addr);
- return -1;
- }
- else if (timeout==0)
- {
- printf ("i2c_read_error: timeout at dev %x block %x addr %x\n",
- device, block, addr);
- return -1;
- }
- timeout--;
- } while (val == -1); /* if no ack: try again! */
+ timeout=100;
+ do
+ {
+ val = mpc107_i2c_read_byte (device, block, addr);
+ if (val < -1)
+ {
+ printf("i2c_read_error %d at dev %x block %x addr %x\n",
+ val, device, block, addr);
+ return -1;
+ }
+ else if (timeout==0)
+ {
+ printf ("i2c_read_error: timeout at dev %x block %x addr %x\n",
+ device, block, addr);
+ return -1;
+ }
+ timeout--;
+ } while (val == -1); /* if no ack: try again! */
- *pBuf++ = (unsigned char)val;
- addr++;
+ *pBuf++ = (unsigned char)val;
+ addr++;
- if ((addr == 0) && (i != cnt-1)) /* is it the same block ? */
- {
- if (block == FIRST_BLOCK)
- block = SECOND_BLOCK;
- else
- {
- printf ("ic2_read_error: read beyond 2. block !\n");
- return -1;
- }
- }
+ if ((addr == 0) && (i != cnt-1)) /* is it the same block ? */
+ {
+ if (block == FIRST_BLOCK)
+ block = SECOND_BLOCK;
+ else
+ {
+ printf ("ic2_read_error: read beyond 2. block !\n");
+ return -1;
+ }
+ }
}
udelay(100000);
return (cnt);
@@ -277,20 +277,20 @@
for (i = 0; i < cnt; i++)
{
- while (mpc107_i2c_write_byte (device,block,addr,*pBuf) == 1);
- addr++;
- pBuf++;
+ while (mpc107_i2c_write_byte (device,block,addr,*pBuf) == 1);
+ addr++;
+ pBuf++;
- if ((addr == 0) && (i != cnt-1)) /* is it the same block ? */
- {
- if (block == FIRST_BLOCK)
- block = SECOND_BLOCK;
- else
- {
- printf ("ic2_write_error: write beyond 2. block !\n");
- return -1;
- }
- }
+ if ((addr == 0) && (i != cnt-1)) /* is it the same block ? */
+ {
+ if (block == FIRST_BLOCK)
+ block = SECOND_BLOCK;
+ else
+ {
+ printf ("ic2_write_error: write beyond 2. block !\n");
+ return -1;
+ }
+ }
}
udelay(100000);
return(cnt);
@@ -303,9 +303,9 @@
unsigned long x;
if (eumb_addr)
- mpc107_eumb_addr = eumb_addr;
+ mpc107_eumb_addr = eumb_addr;
else
- return -1;
+ return -1;
/* Set I2C clock */
x = in32r(MPC107_I2CFDR) & 0xffffff00;
diff --git a/board/eltec/elppc/pci.c b/board/eltec/elppc/pci.c
index 2bbb5f2..5b115ea 100644
--- a/board/eltec/elppc/pci.c
+++ b/board/eltec/elppc/pci.c
@@ -42,44 +42,44 @@
hose->last_busno = 0xff;
pci_set_region(hose->regions + 0,
- CFG_PCI_MEMORY_BUS,
- CFG_PCI_MEMORY_PHYS,
- CFG_PCI_MEMORY_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
+ CFG_PCI_MEMORY_BUS,
+ CFG_PCI_MEMORY_PHYS,
+ CFG_PCI_MEMORY_SIZE,
+ PCI_REGION_MEM | PCI_REGION_MEMORY);
/* PCI memory space */
pci_set_region(hose->regions + 1,
- CFG_PCI_MEM_BUS,
- CFG_PCI_MEM_PHYS,
- CFG_PCI_MEM_SIZE,
- PCI_REGION_MEM);
+ CFG_PCI_MEM_BUS,
+ CFG_PCI_MEM_PHYS,
+ CFG_PCI_MEM_SIZE,
+ PCI_REGION_MEM);
/* ISA/PCI memory space */
pci_set_region(hose->regions + 2,
- CFG_ISA_MEM_BUS,
- CFG_ISA_MEM_PHYS,
- CFG_ISA_MEM_SIZE,
- PCI_REGION_MEM);
+ CFG_ISA_MEM_BUS,
+ CFG_ISA_MEM_PHYS,
+ CFG_ISA_MEM_SIZE,
+ PCI_REGION_MEM);
/* PCI I/O space */
pci_set_region(hose->regions + 3,
- CFG_PCI_IO_BUS,
- CFG_PCI_IO_PHYS,
- CFG_PCI_IO_SIZE,
- PCI_REGION_IO);
+ CFG_PCI_IO_BUS,
+ CFG_PCI_IO_PHYS,
+ CFG_PCI_IO_SIZE,
+ PCI_REGION_IO);
/* ISA/PCI I/O space */
pci_set_region(hose->regions + 4,
- CFG_ISA_IO_BUS,
- CFG_ISA_IO_PHYS,
- CFG_ISA_IO_SIZE,
- PCI_REGION_IO);
+ CFG_ISA_IO_BUS,
+ CFG_ISA_IO_PHYS,
+ CFG_ISA_IO_SIZE,
+ PCI_REGION_IO);
hose->region_count = 5;
pci_setup_indirect(hose,
- MPC106_REG_ADDR,
- MPC106_REG_DATA);
+ MPC106_REG_ADDR,
+ MPC106_REG_DATA);
pci_register_hose(hose);
diff --git a/board/eltec/elppc/srom.h b/board/eltec/elppc/srom.h
index 7924bcd..c18ab91 100644
--- a/board/eltec/elppc/srom.h
+++ b/board/eltec/elppc/srom.h
@@ -81,18 +81,18 @@
unsigned long el_srom_checksum (unsigned char *ptr, unsigned long size);
int el_srom_load (unsigned char addr, unsigned char *buf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int el_srom_store (unsigned char addr, unsigned char *buf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int mpc107_i2c_init (unsigned long eumb_addr, unsigned long divider);
int mpc107_i2c_read_byte (unsigned char device, unsigned char block, unsigned char offset);
int mpc107_i2c_write_byte (unsigned char device, unsigned char block,
- unsigned char offset, unsigned char val);
+ unsigned char offset, unsigned char val);
int mpc107_srom_load (unsigned char addr, unsigned char *pBuf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int mpc107_srom_store (unsigned char addr, unsigned char *pBuf, int cnt,
- unsigned char device, unsigned char block);
+ unsigned char device, unsigned char block);
int dc_srom_load (unsigned short *dest);
int dc_srom_store (unsigned short *src);
diff --git a/board/eltec/elppc/u-boot.lds b/board/eltec/elppc/u-boot.lds
index de50bf4..0dfa8c0 100644
--- a/board/eltec/elppc/u-boot.lds
+++ b/board/eltec/elppc/u-boot.lds
@@ -106,6 +106,11 @@
_edata = .;
PROVIDE (edata = .);
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/board/eltec/mhpc/Makefile b/board/eltec/mhpc/Makefile
index ef173d0..13ce9fc 100644
--- a/board/eltec/mhpc/Makefile
+++ b/board/eltec/mhpc/Makefile
@@ -28,7 +28,7 @@
OBJS = $(BOARD).o flash.o
$(LIB): .depend $(OBJS)
- $(AR) crv $@ $^
+ $(AR) crv $@ $(OBJS)
#########################################################################
diff --git a/board/eltec/mhpc/config.mk b/board/eltec/mhpc/config.mk
index 607ebbc..03934de 100644
--- a/board/eltec/mhpc/config.mk
+++ b/board/eltec/mhpc/config.mk
@@ -31,19 +31,3 @@
TEXT_BASE = 0xfe000000
/*TEXT_BASE = 0x00200000 */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/mhpc/flash.c b/board/eltec/mhpc/flash.c
index e9c8f98..4cc66a9 100644
--- a/board/eltec/mhpc/flash.c
+++ b/board/eltec/mhpc/flash.c
@@ -193,13 +193,13 @@
switch (value) {
case (FPW)INTEL_ID_28F640J5 :
- info->flash_id += FLASH_28F640J5 ;
- info->sector_count = 64;
- info->size = 0x00800000;
- break; /* => 8 MB */
+ info->flash_id += FLASH_28F640J5 ;
+ info->sector_count = 64;
+ info->size = 0x00800000;
+ break; /* => 8 MB */
- default:
- info->flash_id = FLASH_UNKNOWN;
+ default:
+ info->flash_id = FLASH_UNKNOWN;
break;
}
@@ -429,25 +429,3 @@
return (0);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/mhpc/mhpc.c b/board/eltec/mhpc/mhpc.c
index 81f820a..83952d8 100644
--- a/board/eltec/mhpc/mhpc.c
+++ b/board/eltec/mhpc/mhpc.c
@@ -40,17 +40,17 @@
extern void eeprom_init (void);
extern int eeprom_read (unsigned dev_addr, unsigned offset,
- unsigned char *buffer, unsigned cnt);
+ unsigned char *buffer, unsigned cnt);
extern int eeprom_write (unsigned dev_addr, unsigned offset,
- unsigned char *buffer, unsigned cnt);
+ unsigned char *buffer, unsigned cnt);
/* globals */
void *video_hw_init(void);
void video_set_lut (unsigned int index, /* color number */
- unsigned char r, /* red */
- unsigned char g, /* green */
- unsigned char b /* blue */
- );
+ unsigned char r, /* red */
+ unsigned char g, /* green */
+ unsigned char b /* blue */
+ );
GraphicDevice gdev;
@@ -153,9 +153,9 @@
revinfo mhpcRevInfo;
char nid[32];
char *mhpcSensorTypes[] = { "OMNIVISON OV7610/7620 color",
- "OMNIVISON OV7110 b&w", NULL };
+ "OMNIVISON OV7110 b&w", NULL };
char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
- 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
+ 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
int i;
/* check revision data */
@@ -166,62 +166,62 @@
printf ("Enter revision number (0-9): %c ", mhpcRevInfo.revision[0]);
if (0 != readline (NULL))
{
- mhpcRevInfo.revision[0] = (char)toupper(console_buffer[0]);
+ mhpcRevInfo.revision[0] = (char)toupper(console_buffer[0]);
}
printf ("Enter revision character (A-Z): %c ", mhpcRevInfo.revision[1]);
if (1 == readline (NULL))
{
- mhpcRevInfo.revision[1] = (char)toupper(console_buffer[0]);
+ mhpcRevInfo.revision[1] = (char)toupper(console_buffer[0]);
}
printf("Enter board name (V-XXXX-XXXX): %s ", (char *)&mhpcRevInfo.board);
if (11 == readline (NULL))
{
- for (i=0; i<11; i++)
- {
- mhpcRevInfo.board[i] = (char)toupper(console_buffer[i]);
- mhpcRevInfo.board[11] = '\0';
- }
+ for (i=0; i<11; i++)
+ {
+ mhpcRevInfo.board[i] = (char)toupper(console_buffer[i]);
+ mhpcRevInfo.board[11] = '\0';
+ }
}
printf("Supported sensor types:\n");
i=0;
do
{
- printf("\n \'%d\' : %s\n", i, mhpcSensorTypes[i]);
+ printf("\n \'%d\' : %s\n", i, mhpcSensorTypes[i]);
} while ( mhpcSensorTypes[++i] != NULL );
do
{
- printf("\nEnter sensor number (0-255): %d ", (int)mhpcRevInfo.sensor );
- if (0 != readline (NULL))
- {
- mhpcRevInfo.sensor = (unsigned char)simple_strtoul(console_buffer, NULL, 10);
- }
+ printf("\nEnter sensor number (0-255): %d ", (int)mhpcRevInfo.sensor );
+ if (0 != readline (NULL))
+ {
+ mhpcRevInfo.sensor = (unsigned char)simple_strtoul(console_buffer, NULL, 10);
+ }
} while ( mhpcRevInfo.sensor >= i );
printf("Enter serial number: %s ", (char *)&mhpcRevInfo.serial );
if (6 == readline (NULL))
{
- for (i=0; i<6; i++)
- {
- mhpcRevInfo.serial[i] = console_buffer[i];
- }
- mhpcRevInfo.serial[6] = '\0';
+ for (i=0; i<6; i++)
+ {
+ mhpcRevInfo.serial[i] = console_buffer[i];
+ }
+ mhpcRevInfo.serial[6] = '\0';
}
printf("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
- mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
- mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
- mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5] );
+ mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
+ mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
+ mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5] );
if (12 == readline (NULL))
{
- for (i=0; i<12; i+=2)
- {
- mhpcRevInfo.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
- hex[toupper(console_buffer[i+1])-'0']);
- }
+ for (i=0; i<12; i+=2)
+ {
+ mhpcRevInfo.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
+ hex[toupper(console_buffer[i+1])-'0']);
+ }
}
/* setup new revision data */
@@ -230,16 +230,16 @@
/* set environment */
sprintf( nid, "%02x:%02x:%02x:%02x:%02x:%02x",
- mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
- mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
- mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
+ mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
+ mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
+ mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
setenv("ethaddr", nid);
/* print actual board identification */
printf("Ident: %s %s Ser %s Rev %c%c\n",
- mhpcRevInfo.board, (mhpcRevInfo.sensor==0?"color":"b&w"),
- (char *)&mhpcRevInfo.serial,
- mhpcRevInfo.revision[0], mhpcRevInfo.revision[1]);
+ mhpcRevInfo.board, (mhpcRevInfo.sensor==0?"color":"b&w"),
+ (char *)&mhpcRevInfo.serial,
+ mhpcRevInfo.revision[0], mhpcRevInfo.revision[1]);
return (0);
}
@@ -308,29 +308,29 @@
*(center-x+y*pitch) = color;
while(y>x)
{
- if (d<0)
- {
- d += dE;
- dE += 2;
- dSE += 2;
- x++;
- }
- else
- {
- d += dSE;
- dE += 2;
- dSE += 4;
- x++;
- y--;
- }
- *(center+x+y*pitch) = color;
- *(center+y+x*pitch) = color;
- *(center+y-x*pitch) = color;
- *(center+x-y*pitch) = color;
- *(center-x-y*pitch) = color;
- *(center-y-x*pitch) = color;
- *(center-y+x*pitch) = color;
- *(center-x+y*pitch) = color;
+ if (d<0)
+ {
+ d += dE;
+ dE += 2;
+ dSE += 2;
+ x++;
+ }
+ else
+ {
+ d += dSE;
+ dE += 2;
+ dSE += 4;
+ x++;
+ y--;
+ }
+ *(center+x+y*pitch) = color;
+ *(center+y+x*pitch) = color;
+ *(center+y-x*pitch) = color;
+ *(center+x-y*pitch) = color;
+ *(center-x-y*pitch) = color;
+ *(center-y-x*pitch) = color;
+ *(center-y+x*pitch) = color;
+ *(center-x+y*pitch) = color;
}
}
@@ -344,31 +344,31 @@
/* draw raster */
for (i=0; i<LCD_VIDEO_ROWS; i+=32)
{
- memset((char*)(LCD_VIDEO_ADDR+i*LCD_VIDEO_COLS), LCD_VIDEO_FG, LCD_VIDEO_COLS);
- for (n=i+1;n<i+32;n++)
- memset((char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS), LCD_VIDEO_BG, LCD_VIDEO_COLS);
+ memset((char*)(LCD_VIDEO_ADDR+i*LCD_VIDEO_COLS), LCD_VIDEO_FG, LCD_VIDEO_COLS);
+ for (n=i+1;n<i+32;n++)
+ memset((char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS), LCD_VIDEO_BG, LCD_VIDEO_COLS);
}
for (i=0; i<LCD_VIDEO_COLS; i+=32)
{
- for (n=0; n<LCD_VIDEO_ROWS; n++)
- *(char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS+i) = LCD_VIDEO_FG;
+ for (n=0; n<LCD_VIDEO_ROWS; n++)
+ *(char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS+i) = LCD_VIDEO_FG;
}
/* draw gray bar */
di = (char *)(LCD_VIDEO_ADDR + (LCD_VIDEO_COLS-256)/64*32 + 97*LCD_VIDEO_COLS);
for (n=0; n<63; n++)
{
- for (i=0; i<256; i++)
- {
- *di++ = (char)i;
- *(di+LCD_VIDEO_COLS*64) = (i&1)*255;
- }
- di += LCD_VIDEO_COLS-256;
+ for (i=0; i<256; i++)
+ {
+ *di++ = (char)i;
+ *(di+LCD_VIDEO_COLS*64) = (i&1)*255;
+ }
+ di += LCD_VIDEO_COLS-256;
}
video_circle ((char*)LCD_VIDEO_ADDR+LCD_VIDEO_COLS/2+LCD_VIDEO_ROWS/2*LCD_VIDEO_COLS,
- LCD_VIDEO_ROWS/2,LCD_VIDEO_FG, LCD_VIDEO_COLS);
+ LCD_VIDEO_ROWS/2,LCD_VIDEO_FG, LCD_VIDEO_COLS);
}
/* ------------------------------------------------------------------------- */
@@ -377,36 +377,36 @@
{
unsigned int i;
unsigned char RGB[] =
- {
- 0x00, 0x00, 0x00, /* black */
- 0x80, 0x80, 0x80, /* gray */
- 0xff, 0x00, 0x00, /* red */
- 0x00, 0xff, 0x00, /* green */
- 0x00, 0x00, 0xff, /* blue */
- 0x00, 0xff, 0xff, /* cyan */
- 0xff, 0x00, 0xff, /* magenta */
- 0xff, 0xff, 0x00, /* yellow */
- 0x80, 0x00, 0x00, /* dark red */
- 0x00, 0x80, 0x00, /* dark green */
- 0x00, 0x00, 0x80, /* dark blue */
- 0x00, 0x80, 0x80, /* dark cyan */
- 0x80, 0x00, 0x80, /* dark magenta */
- 0x80, 0x80, 0x00, /* dark yellow */
- 0xc0, 0xc0, 0xc0, /* light gray */
- 0xff, 0xff, 0xff, /* white */
- };
+ {
+ 0x00, 0x00, 0x00, /* black */
+ 0x80, 0x80, 0x80, /* gray */
+ 0xff, 0x00, 0x00, /* red */
+ 0x00, 0xff, 0x00, /* green */
+ 0x00, 0x00, 0xff, /* blue */
+ 0x00, 0xff, 0xff, /* cyan */
+ 0xff, 0x00, 0xff, /* magenta */
+ 0xff, 0xff, 0x00, /* yellow */
+ 0x80, 0x00, 0x00, /* dark red */
+ 0x00, 0x80, 0x00, /* dark green */
+ 0x00, 0x00, 0x80, /* dark blue */
+ 0x00, 0x80, 0x80, /* dark cyan */
+ 0x80, 0x00, 0x80, /* dark magenta */
+ 0x80, 0x80, 0x00, /* dark yellow */
+ 0xc0, 0xc0, 0xc0, /* light gray */
+ 0xff, 0xff, 0xff, /* white */
+ };
switch (clut_type)
{
case 1:
- for (i=0; i<240; i++)
- video_set_lut (i, i, i, i);
- for (i=0; i<16; i++)
- video_set_lut (i+240, RGB[i*3], RGB[i*3+1], RGB[i*3+2]);
- break;
+ for (i=0; i<240; i++)
+ video_set_lut (i, i, i, i);
+ for (i=0; i<16; i++)
+ video_set_lut (i+240, RGB[i*3], RGB[i*3+1], RGB[i*3+2]);
+ break;
default:
- for (i=0; i<256; i++)
- video_set_lut (i, i, i, i);
+ for (i=0; i<256; i++)
+ video_set_lut (i, i, i, i);
}
}
@@ -420,9 +420,9 @@
/* enable video only on CLUT value */
if ((penv = getenv ("clut")) != NULL)
- clut = (u_int)simple_strtoul (penv, NULL, 10);
+ clut = (u_int)simple_strtoul (penv, NULL, 10);
else
- return NULL;
+ return NULL;
/* disable graphic before write LCD regs. */
immr->im_lcd.lcd_lccr = 0x96000866;
@@ -433,7 +433,7 @@
immr->im_lcd.lcd_lcvcr = 0x900f0024;
printf ("Video: 640x480 8Bit Index Lut %s\n",
- (clut==1?"240/16 (gray/vga)":"256(gray)"));
+ (clut==1?"240/16 (gray/vga)":"256(gray)"));
video_default_lut (clut);
@@ -451,11 +451,11 @@
gdev.gdfIndex = GDF__8BIT_INDEX;
if (clut > 1)
- /* return Graphic Device for console */
- return (void *)&gdev;
+ /* return Graphic Device for console */
+ return (void *)&gdev;
else
- /* just graphic enabled - draw something beautiful */
- video_test_image();
+ /* just graphic enabled - draw something beautiful */
+ video_test_image();
return NULL; /* this disabels cfb - console */
}
@@ -463,7 +463,7 @@
/* ------------------------------------------------------------------------- */
void video_set_lut (unsigned int index,
- unsigned char r, unsigned char g, unsigned char b)
+ unsigned char r, unsigned char g, unsigned char b)
{
unsigned int lum;
unsigned short *pLut = (unsigned short *)(CFG_IMMR + 0x0e00);
diff --git a/board/eltec/mhpc/u-boot.lds b/board/eltec/mhpc/u-boot.lds
index 7128155..526198c 100644
--- a/board/eltec/mhpc/u-boot.lds
+++ b/board/eltec/mhpc/u-boot.lds
@@ -99,6 +99,11 @@
_edata = .;
PROVIDE (edata = .);
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
@@ -121,4 +126,3 @@
_end = . ;
PROVIDE (end = .);
}
-
diff --git a/board/eltec/mhpc/u-boot.lds.debug b/board/eltec/mhpc/u-boot.lds.debug
index 8dc6d40..f6f7cf4 100644
--- a/board/eltec/mhpc/u-boot.lds.debug
+++ b/board/eltec/mhpc/u-boot.lds.debug
@@ -106,6 +106,11 @@
_edata = .;
PROVIDE (edata = .);
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
@@ -128,4 +133,3 @@
_end = . ;
PROVIDE (end = .);
}
-