diff options
author | wdenk <wdenk> | 2003-06-27 21:31:46 (GMT) |
---|---|---|
committer | wdenk <wdenk> | 2003-06-27 21:31:46 (GMT) |
commit | 8bde7f776c77b343aca29b8c7b58464d915ac245 (patch) | |
tree | 20f1fd99975215e7c658454a15cdb4ed4694e2d4 /board/eltec/bab7xx/el_srom.c | |
parent | 993cad9364c6b87ae429d1ed1130d8153f6f027e (diff) | |
download | u-boot-fsl-qoriq-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.xz |
* 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)
Diffstat (limited to 'board/eltec/bab7xx/el_srom.c')
-rw-r--r-- | board/eltec/bab7xx/el_srom.c | 146 |
1 files changed, 73 insertions, 73 deletions
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 @@ static unsigned char eepReadByte (void) 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 @@ static void eepWriteByte (register unsigned char buf) 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 @@ unsigned char block; 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 @@ int cnt; 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 @@ 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); } |