mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-29 07:53:44 +02:00
Use consistent naming for local chip ID variables
Every chip besides SPI and w39v080fa uses id1/id2 as local variable names to store ID responses from the flash chip. This eases grepping a lot. As a bonus, it also frees up some names to be used as parameters. Corresponding to flashrom svn r551. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
This commit is contained in:
parent
09b4fb73f2
commit
2ad267d8cd
44
spi.c
44
spi.c
@ -150,8 +150,8 @@ int spi_write_disable(void)
|
|||||||
static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
|
static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
|
||||||
{
|
{
|
||||||
unsigned char readarr[4];
|
unsigned char readarr[4];
|
||||||
uint32_t manuf_id;
|
uint32_t id1;
|
||||||
uint32_t model_id;
|
uint32_t id2;
|
||||||
|
|
||||||
if (spi_rdid(readarr, bytes))
|
if (spi_rdid(readarr, bytes))
|
||||||
return 0;
|
return 0;
|
||||||
@ -163,21 +163,20 @@ static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
|
|||||||
if (readarr[0] == 0x7f) {
|
if (readarr[0] == 0x7f) {
|
||||||
if (!oddparity(readarr[1]))
|
if (!oddparity(readarr[1]))
|
||||||
printf_debug("RDID byte 1 parity violation.\n");
|
printf_debug("RDID byte 1 parity violation.\n");
|
||||||
manuf_id = (readarr[0] << 8) | readarr[1];
|
id1 = (readarr[0] << 8) | readarr[1];
|
||||||
model_id = readarr[2];
|
id2 = readarr[2];
|
||||||
if (bytes > 3) {
|
if (bytes > 3) {
|
||||||
model_id <<= 8;
|
id2 <<= 8;
|
||||||
model_id |= readarr[3];
|
id2 |= readarr[3];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
manuf_id = readarr[0];
|
id1 = readarr[0];
|
||||||
model_id = (readarr[1] << 8) | readarr[2];
|
id2 = (readarr[1] << 8) | readarr[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, manuf_id,
|
printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2);
|
||||||
model_id);
|
|
||||||
|
|
||||||
if (manuf_id == flash->manufacture_id && model_id == flash->model_id) {
|
if (id1 == flash->manufacture_id && id2 == flash->model_id) {
|
||||||
/* Print the status register to tell the
|
/* Print the status register to tell the
|
||||||
* user about possible write protection.
|
* user about possible write protection.
|
||||||
*/
|
*/
|
||||||
@ -187,7 +186,7 @@ static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test if this is a pure vendor match. */
|
/* Test if this is a pure vendor match. */
|
||||||
if (manuf_id == flash->manufacture_id &&
|
if (id1 == flash->manufacture_id &&
|
||||||
GENERIC_DEVICE_ID == flash->model_id)
|
GENERIC_DEVICE_ID == flash->model_id)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -221,18 +220,17 @@ int probe_spi_rdid4(struct flashchip *flash)
|
|||||||
int probe_spi_rems(struct flashchip *flash)
|
int probe_spi_rems(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
unsigned char readarr[JEDEC_REMS_INSIZE];
|
unsigned char readarr[JEDEC_REMS_INSIZE];
|
||||||
uint32_t manuf_id, model_id;
|
uint32_t id1, id2;
|
||||||
|
|
||||||
if (spi_rems(readarr))
|
if (spi_rems(readarr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
manuf_id = readarr[0];
|
id1 = readarr[0];
|
||||||
model_id = readarr[1];
|
id2 = readarr[1];
|
||||||
|
|
||||||
printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, manuf_id,
|
printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
|
||||||
model_id);
|
|
||||||
|
|
||||||
if (manuf_id == flash->manufacture_id && model_id == flash->model_id) {
|
if (id1 == flash->manufacture_id && id2 == flash->model_id) {
|
||||||
/* Print the status register to tell the
|
/* Print the status register to tell the
|
||||||
* user about possible write protection.
|
* user about possible write protection.
|
||||||
*/
|
*/
|
||||||
@ -242,7 +240,7 @@ int probe_spi_rems(struct flashchip *flash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test if this is a pure vendor match. */
|
/* Test if this is a pure vendor match. */
|
||||||
if (manuf_id == flash->manufacture_id &&
|
if (id1 == flash->manufacture_id &&
|
||||||
GENERIC_DEVICE_ID == flash->model_id)
|
GENERIC_DEVICE_ID == flash->model_id)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -252,7 +250,7 @@ int probe_spi_rems(struct flashchip *flash)
|
|||||||
int probe_spi_res(struct flashchip *flash)
|
int probe_spi_res(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
unsigned char readarr[3];
|
unsigned char readarr[3];
|
||||||
uint32_t model_id;
|
uint32_t id2;
|
||||||
|
|
||||||
/* Check if RDID was successful and did not return 0xff 0xff 0xff.
|
/* Check if RDID was successful and did not return 0xff 0xff 0xff.
|
||||||
* In that case, RES is pointless.
|
* In that case, RES is pointless.
|
||||||
@ -264,9 +262,9 @@ int probe_spi_res(struct flashchip *flash)
|
|||||||
if (spi_res(readarr))
|
if (spi_res(readarr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
model_id = readarr[0];
|
id2 = readarr[0];
|
||||||
printf_debug("%s: id 0x%x\n", __FUNCTION__, model_id);
|
printf_debug("%s: id 0x%x\n", __FUNCTION__, id2);
|
||||||
if (model_id != flash->model_id)
|
if (id2 != flash->model_id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Print the status register to tell the
|
/* Print the status register to tell the
|
||||||
|
10
w39v080fa.c
10
w39v080fa.c
@ -23,7 +23,7 @@
|
|||||||
int probe_winbond_fwhub(struct flashchip *flash)
|
int probe_winbond_fwhub(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
chipaddr bios = flash->virtual_memory;
|
chipaddr bios = flash->virtual_memory;
|
||||||
uint8_t vid, did;
|
uint8_t id1, id2;
|
||||||
|
|
||||||
/* Product Identification Entry */
|
/* Product Identification Entry */
|
||||||
chip_writeb(0xAA, bios + 0x5555);
|
chip_writeb(0xAA, bios + 0x5555);
|
||||||
@ -32,8 +32,8 @@ int probe_winbond_fwhub(struct flashchip *flash)
|
|||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
|
|
||||||
/* Read product ID */
|
/* Read product ID */
|
||||||
vid = chip_readb(bios);
|
id1 = chip_readb(bios);
|
||||||
did = chip_readb(bios + 0x01);
|
id2 = chip_readb(bios + 0x01);
|
||||||
|
|
||||||
/* Product Identifixation Exit */
|
/* Product Identifixation Exit */
|
||||||
chip_writeb(0xAA, bios + 0x5555);
|
chip_writeb(0xAA, bios + 0x5555);
|
||||||
@ -41,9 +41,9 @@ int probe_winbond_fwhub(struct flashchip *flash)
|
|||||||
chip_writeb(0xF0, bios + 0x5555);
|
chip_writeb(0xF0, bios + 0x5555);
|
||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
|
|
||||||
printf_debug("%s: vid 0x%x, did 0x%x\n", __FUNCTION__, vid, did);
|
printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
|
||||||
|
|
||||||
if (vid != flash->manufacture_id || did != flash->model_id)
|
if (id1 != flash->manufacture_id || id2 != flash->model_id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
map_flash_registers(flash);
|
map_flash_registers(flash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user