1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

Indent according to development guidelines

Corresponding to flashrom svn r277 and coreboot v2 svn r3392.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
This commit is contained in:
Stefan Reinauer 2008-06-27 15:18:20 +00:00 committed by Stefan Reinauer
parent 43b2281f51
commit 325b5d47d8

View File

@ -71,7 +71,6 @@
#define SPI_OPCODE_TYPE_READ_WITH_ADDRESS 2
#define SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS 3
typedef struct _OPCODE {
uint8_t opcode; //This commands spi opcode
uint8_t spi_type; //This commands spi type
@ -96,10 +95,8 @@ typedef struct _OPCODES {
OPCODE opcode[8];
} OPCODES;
static OPCODES *curopcodes = NULL;
/* HW access functions */
static inline uint32_t REGREAD32(int X)
{
@ -112,20 +109,20 @@ static inline uint32_t REGREAD32(int X)
#define REGWRITE16(X,Y) (*(uint16_t *)((uint8_t *)ich_spibar+X)=Y)
#define REGWRITE8(X,Y) (*(uint8_t *)((uint8_t *)ich_spibar+X)=Y)
/* Common SPI functions */
static int program_opcodes(OPCODES * op);
static int run_opcode(uint8_t nr, OPCODE op, uint32_t offset, uint8_t datalength, uint8_t * data);
static int ich_spi_read_page(struct flashchip *flash, uint8_t * buf, int Offset);
static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes, int Offset);
static int run_opcode(uint8_t nr, OPCODE op, uint32_t offset,
uint8_t datalength, uint8_t * data);
static int ich_spi_read_page(struct flashchip *flash, uint8_t * buf,
int Offset);
static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes,
int Offset);
static int ich_spi_erase_block(struct flashchip *flash, int offset);
OPCODES O_ST_M25P = {
{
JEDEC_WREN,
0
},
0},
{
{JEDEC_BYTE_PROGRAM, SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS, 1}, // Write Byte
{JEDEC_READ, SPI_OPCODE_TYPE_READ_WITH_ADDRESS, 0}, // Read Data
@ -138,7 +135,6 @@ OPCODES O_ST_M25P = {
}
};
int program_opcodes(OPCODES * op)
{
uint8_t a;
@ -275,7 +271,6 @@ int run_opcode(uint8_t nr, OPCODE op, uint32_t offset, uint8_t datalength,
return 0;
}
static int ich_spi_erase_block(struct flashchip *flash, int offset)
{
printf_debug("Spi_Erase,Offset=%d,sectors=%d\n", offset, 1);
@ -296,7 +291,8 @@ static int ich_spi_read_page(struct flashchip *flash, uint8_t * buf, int Offset)
uint32_t remaining = flash->page_size;
int a;
printf_debug("Spi_Read,Offset=%d,number=%d,buf=%p\n", Offset, page_size, buf);
printf_debug("Spi_Read,Offset=%d,number=%d,buf=%p\n", Offset, page_size,
buf);
for (a = 0; a < page_size; a += MAXDATABYTES) {
if (remaining < MAXDATABYTES) {
@ -331,8 +327,8 @@ static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes,
uint32_t remaining = page_size;
int a;
printf_debug("write_page_ichspi,Offset=%d,number=%d,buf=%p\n", Offset, page_size,
bytes);
printf_debug("write_page_ichspi,Offset=%d,number=%d,buf=%p\n", Offset,
page_size, bytes);
for (a = 0; a < page_size; a += MAXDATABYTES) {
if (remaining < MAXDATABYTES) {
@ -359,7 +355,6 @@ static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes,
return 0;
}
int ich_spi_read(struct flashchip *flash, uint8_t * buf)
{
int i, rc = 0;
@ -374,7 +369,6 @@ int ich_spi_read(struct flashchip *flash, uint8_t * buf)
return rc;
}
int ich_spi_write(struct flashchip *flash, uint8_t * buf)
{
int i, j, rc = 0;
@ -404,7 +398,8 @@ int ich_spi_write(struct flashchip *flash, uint8_t * buf)
return rc;
}
int ich_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr)
int ich_spi_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr)
{
int a;
int opcode_index = -1;
@ -441,20 +436,17 @@ int ich_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned
if (opcode->spi_type == SPI_OPCODE_TYPE_READ_WITH_ADDRESS ||
opcode->spi_type == SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS) {
addr = (writearr[1] << 16) |
(writearr[2]<<8) |
(writearr[3]<<0);
(writearr[2] << 8) | (writearr[3] << 0);
}
/* translate read/write array/count */
if (opcode->spi_type == SPI_OPCODE_TYPE_WRITE_NO_ADDRESS) {
data = (uint8_t *) (writearr + 1);
count = writecnt - 1;
}
else if (opcode->spi_type == SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS) {
} else if (opcode->spi_type == SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS) {
data = (uint8_t *) (writearr + 4);
count = writecnt - 4;
}
else {
} else {
data = (uint8_t *) readarr;
count = readcnt;
}