1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 15:33:42 +02:00

fixup! 4BA: Basic support for 4-bytes addressing mode extensions

Fix some whitespace, and braces. Remove sector size from comments that I
could not verify.

Change-Id: I4faaa036fea744135fa37f405686fb9fd0882806
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/21947
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
This commit is contained in:
Boris Baykov 2016-06-11 18:28:59 +02:00 committed by Nico Huber
parent 50a5660c9c
commit b1f88360fc
2 changed files with 15 additions and 23 deletions

View File

@ -120,8 +120,8 @@ enum write_granularity {
#define FEATURE_OTP (1 << 8) #define FEATURE_OTP (1 << 8)
#define FEATURE_QPI (1 << 9) #define FEATURE_QPI (1 << 9)
/* Feature bits used for 4-bytes addressing mode */ /* Feature bits used for 4-bytes addressing mode */
#define FEATURE_4BA_SUPPORT (1 << 10) #define FEATURE_4BA_SUPPORT (1 << 10)
#define FEATURE_4BA_ONLY (1 << 11) #define FEATURE_4BA_ONLY (1 << 11)
enum test_state { enum test_state {
OK = 0, OK = 0,

View File

@ -43,7 +43,7 @@ int spi_enter_4ba_b7(struct flashctx *flash)
msg_trace("-> %s\n", __func__); msg_trace("-> %s\n", __func__);
/* Switch to 4-bytes addressing mode */ /* Switch to 4-bytes addressing mode */
return spi_send_command(flash, sizeof(cmd), 0, cmd, NULL); return spi_send_command(flash, sizeof(cmd), 0, cmd, NULL);
} }
@ -71,17 +71,15 @@ int spi_enter_4ba_b7_we(struct flashctx *flash)
msg_trace("-> %s\n", __func__); msg_trace("-> %s\n", __func__);
/* Switch to 4-bytes addressing mode */ /* Switch to 4-bytes addressing mode */
result = spi_send_multicommand(flash, cmds); result = spi_send_multicommand(flash, cmds);
if (result) { if (result)
msg_cerr("%s failed during command execution\n", __func__); msg_cerr("%s failed during command execution\n", __func__);
}
return result; return result;
} }
/* Program one flash byte from 4-bytes addressing mode */ /* Program one flash byte from 4-bytes addressing mode */
int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr, int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr, uint8_t databyte)
uint8_t databyte)
{ {
int result; int result;
struct spi_command cmds[] = { struct spi_command cmds[] = {
@ -112,16 +110,13 @@ int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr,
msg_trace("-> %s (0x%08X)\n", __func__, addr); msg_trace("-> %s (0x%08X)\n", __func__, addr);
result = spi_send_multicommand(flash, cmds); result = spi_send_multicommand(flash, cmds);
if (result) { if (result)
msg_cerr("%s failed during command execution at address 0x%x\n", msg_cerr("%s failed during command execution at address 0x%x\n", __func__, addr);
__func__, addr);
}
return result; return result;
} }
/* Program flash bytes from 4-bytes addressing mode */ /* Program flash bytes from 4-bytes addressing mode */
int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr, int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr, const uint8_t *bytes, unsigned int len)
const uint8_t *bytes, unsigned int len)
{ {
int result; int result;
unsigned char cmd[(JEDEC_BYTE_PROGRAM_OUTSIZE + 1) - 1 + 256] = { unsigned char cmd[(JEDEC_BYTE_PROGRAM_OUTSIZE + 1) - 1 + 256] = {
@ -171,8 +166,7 @@ int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr,
} }
/* Read flash bytes from 4-bytes addressing mode */ /* Read flash bytes from 4-bytes addressing mode */
int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr, int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len)
uint8_t *bytes, unsigned int len)
{ {
const unsigned char cmd[JEDEC_READ_OUTSIZE + 1] = { const unsigned char cmd[JEDEC_READ_OUTSIZE + 1] = {
JEDEC_READ, JEDEC_READ,
@ -188,9 +182,8 @@ int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr,
return spi_send_command(flash, sizeof(cmd), len, cmd, bytes); return spi_send_command(flash, sizeof(cmd), len, cmd, bytes);
} }
/* Erases 4 KB of flash from 4-bytes addressing mode */ /* Erase one sector of flash from 4-bytes addressing mode */
int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr, int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
unsigned int blocklen)
{ {
int result; int result;
struct spi_command cmds[] = { struct spi_command cmds[] = {
@ -234,9 +227,8 @@ int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr,
return 0; return 0;
} }
/* Erases 32 KB of flash from 4-bytes addressing mode */ /* Erase one sector of flash from 4-bytes addressing mode */
int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr, int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
unsigned int blocklen)
{ {
int result; int result;
struct spi_command cmds[] = { struct spi_command cmds[] = {
@ -280,7 +272,7 @@ int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr,
return 0; return 0;
} }
/* Erases 64 KB of flash from 4-bytes addressing mode */ /* Erase one sector of flash from 4-bytes addressing mode */
int spi_block_erase_d8_4ba(struct flashctx *flash, unsigned int addr, int spi_block_erase_d8_4ba(struct flashctx *flash, unsigned int addr,
unsigned int blocklen) unsigned int blocklen)
{ {