summaryrefslogtreecommitdiff
path: root/board/eltec/elppc
diff options
context:
space:
mode:
Diffstat (limited to 'board/eltec/elppc')
-rw-r--r--board/eltec/elppc/Makefile11
-rw-r--r--board/eltec/elppc/eepro100_srom.c28
-rw-r--r--board/eltec/elppc/elppc.c157
-rw-r--r--board/eltec/elppc/flash.c367
-rw-r--r--board/eltec/elppc/misc.c270
-rw-r--r--board/eltec/elppc/mpc107_i2c.c158
-rw-r--r--board/eltec/elppc/pci.c44
-rw-r--r--board/eltec/elppc/srom.h10
-rw-r--r--board/eltec/elppc/u-boot.lds5
9 files changed, 515 insertions, 535 deletions
diff --git a/board/eltec/elppc/Makefile b/board/eltec/elppc/Makefile
index 1ed1a24c46f..76b2cfe6203 100644
--- a/board/eltec/elppc/Makefile
+++ b/board/eltec/elppc/Makefile
@@ -30,7 +30,7 @@ OBJS = $(BOARD).o flash.o pci.o misc.o mpc107_i2c.o eepro100_srom.o
SOBJS = asm_init.o
$(LIB): .depend $(OBJS) $(SOBJS)
- $(AR) crv $@ $^
+ $(AR) crv $@ $(OBJS) $(SOBJS)
clean:
rm -f $(SOBJS) $(OBJS)
@@ -46,12 +46,3 @@ distclean: clean
sinclude .depend
#########################################################################
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/elppc/eepro100_srom.c b/board/eltec/elppc/eepro100_srom.c
index a5e47cfe2f0..9754c1d248e 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 @@ unsigned short eepro100_srom_checksum (unsigned short *sromdata)
for (i = 0; i < (EE_SIZE-1); i++)
{
- sum += sromdata[i];
+ sum += sromdata[i];
}
return (EE_CHECKSUM - sum);
}
@@ -57,7 +57,7 @@ int eepro100_srom_store (unsigned short *source)
/* 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 @@ int eepro100_srom_store (unsigned short *source)
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 @@ void eepro100_srom_load (unsigned short *destination)
/* 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 97b70a4d8f8..7b4d7d20090 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;
-
- do
- {
- if (i & 0x01) /* is bank enabled ? */
- memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
- msar1 >>= 8;
- mear1 >>= 8;
- i >>= 1;
- } while (i);
-
- return (memSize * 0x100000);
+ /*
+ * 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);
+
+ 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 @@ long int initdram(int board_type)
* 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 @@ void do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
* 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 @@ extern GraphicDevice smi;
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;
- }
-
- /* no more info lines */
- *info = 0;
- 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;
}
#endif
-
-
-
-
-
-
-
-
-
-
diff --git a/board/eltec/elppc/flash.c b/board/eltec/elppc/flash.c
index 73496a13ded..442dd00519a 100644
--- a/board/eltec/elppc/flash.c
+++ b/board/eltec/elppc/flash.c
@@ -57,7 +57,7 @@ unsigned long flash_init (void)
/* 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 @@ unsigned long flash_init (void)
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 @@ unsigned long flash_init (void)
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 @@ void flash_print_info (flash_info_t *info)
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];
-
- 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 ");
-
- printf (" %08lX%s%s",
- info->start[i],
- erased ? " E" : " ",
- info->protect[i] ? "RO " : " ");
+ /*
+ * 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;
+ }
+ }
+
+ if ((i % 5) == 0)
+ printf ("\n ");
+
+ printf (" %08lX%s%s",
+ info->start[i],
+ erased ? " E" : " ",
+ info->protect[i] ? "RO " : " ");
}
printf ("\n");
}
@@ -226,37 +226,37 @@ ulong flash_get_size (vu_long *addr, flash_info_t *info)
/* 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 @@ ulong flash_get_size (vu_long *addr, flash_info_t *info)
/* 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 flash_erase (flash_info_t *info, int s_first, int s_last)
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 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
/* 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 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
* 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 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
* 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);
- }
-
- if ((rc = write_word(info, wp, data)) != 0) {
- return (rc);
- }
- wp += 4;
+ 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;
}
/*
* 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 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
*/
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 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
*/
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 7bfb3a493de..f33aef71bc3 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 @@ void *nvram_read(void *dest, const long src, size_t count)
uchar *s = (uchar *) (CFG_ENV_MAP_ADRS + src);
while (count--)
- *d++ = *s++;
+ *d++ = *s++;
return dest;
}
@@ -56,7 +56,7 @@ void nvram_write(long dest, const void *src, size_t count)
uchar *s = (uchar *) src;
while (count--)
- *d++ = *s++;
+ *d++ = *s++;
}
/*----------------------------------------------------------------------------*/
@@ -72,7 +72,7 @@ int misc_init_r (void)
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 @@ int misc_init_r (void)
/* 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;
-
- /* 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;
-
- initSrom = 1; /* force dialog */
- copyNv = 1; /* copy to nvram */
+ /* 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;
+
+ /* cache config word for ELPPC */
+ *(int*)&eerev.res[0] = 0;
+
+ 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 */
- }
-
- 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 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']);
- }
-
- 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);
-
- 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;
-
- 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);
-
- /* 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);
+ 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 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 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';
+ }
+
+ /* 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];
+
+ *(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");
+
+ /* 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 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 a4bf5992d29..ae6642e952b 100644
--- a/board/eltec/elppc/mpc107_i2c.c
+++ b/board/eltec/elppc/mpc107_i2c.c
@@ -43,13 +43,13 @@ unsigned long size;
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 @@ static int mpc107_i2c_wait ( unsigned long timeout )
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 @@ static int mpc107_i2c_wait_idle ( unsigned long timeout )
{
while (in32r(MPC107_I2CSR) & 0x20)
{
- if (!timeout--)
- return -1;
+ if (!timeout--)
+ return -1;
}
return 0;
}
@@ -99,7 +99,7 @@ int mpc107_i2c_read_byte (
int data;
if (!mpc107_eumb_addr)
- return -6;
+ return -6;
mpc107_i2c_wait_idle (timeout);
@@ -112,15 +112,15 @@ int mpc107_i2c_read_byte (
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 @@ int mpc107_i2c_read_byte (
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 @@ int mpc107_i2c_read_byte (
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 @@ int mpc107_i2c_read_byte (
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 @@ int mpc107_i2c_write_byte (
unsigned long timeout = MPC107_I2C_TIMEOUT;
if (!mpc107_eumb_addr)
- return -6;
+ return -6;
mpc107_i2c_wait_idle(timeout);
@@ -184,8 +184,8 @@ int mpc107_i2c_write_byte (
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 @@ int mpc107_i2c_write_byte (
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 @@ int mpc107_srom_load (
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! */
-
- *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;
- }
- }
+ 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++;
+
+ 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 @@ int mpc107_srom_store (
for (i = 0; i < cnt; i++)
{
- 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;
- }
- }
+ 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;
+ }
+ }
}
udelay(100000);
return(cnt);
@@ -303,9 +303,9 @@ int mpc107_i2c_init ( unsigned long eumb_addr, unsigned long divider )
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 2bbb5f2ea47..5b115ea617b 100644
--- a/board/eltec/elppc/pci.c
+++ b/board/eltec/elppc/pci.c
@@ -42,44 +42,44 @@ void pci_init_board(void)
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 7924bcd40c1..c18ab916457 100644
--- a/board/eltec/elppc/srom.h
+++ b/board/eltec/elppc/srom.h
@@ -81,18 +81,18 @@ typedef struct {
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 de50bf49cc0..0dfa8c00054 100644
--- a/board/eltec/elppc/u-boot.lds
+++ b/board/eltec/elppc/u-boot.lds
@@ -106,6 +106,11 @@ SECTIONS
_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 = .;