Comments
Patch
From 51d82f7c36037daa359d8a2a4d14aeea5b4dbb24 Mon Sep 17 00:00:00 2001
From: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Date: Thu, 8 Aug 2013 14:09:49 +0200
Subject: [PATCH] Ugly hack for broken OPMENU rdid
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
---
flashchips.c | 2 +-
ichspi.c | 4 ++++
spi25.c | 4 ++--
3 files changed, 7 insertions(+), 3 deletions(-)
@@ -9294,7 +9294,7 @@ const struct flashchip flashchips[] = {
},
.printlock = spi_prettyprint_status_register_sst25vf016,
.unlock = spi_disable_blockprotect,
- .write = spi_aai_write,
+ .write = spi_chip_write_1,
.read = spi_chip_read,
.voltage = {2700, 3600},
},
@@ -1021,10 +1021,14 @@ static int ich_spi_send_command(struct flashctx *flash, unsigned int writecnt,
*/
if ((opcode->spi_type == SPI_OPCODE_TYPE_READ_WITH_ADDRESS) &&
(writecnt != 4)) {
+ if (writecnt > 0 && writearr[0] == 0x9f)
+ writecnt = 4;
+ else {
msg_perr("%s: Internal command size error for opcode "
"0x%02x, got writecnt=%i, want =4\n", __func__, cmd,
writecnt);
return SPI_INVALID_LENGTH;
+ }
}
if ((opcode->spi_type == SPI_OPCODE_TYPE_READ_NO_ADDRESS) &&
(writecnt != 1)) {
@@ -31,11 +31,11 @@
static int spi_rdid(struct flashctx *flash, unsigned char *readarr, int bytes)
{
- static const unsigned char cmd[JEDEC_RDID_OUTSIZE] = { JEDEC_RDID };
+ static const unsigned char cmd[4] = { JEDEC_RDID };
int ret;
int i;
- ret = spi_send_command(flash, sizeof(cmd), bytes, cmd, readarr);
+ ret = spi_send_command(flash, 1, bytes, cmd, readarr);
if (ret)
return ret;
msg_cspew("RDID returned");
--
Kind regards, Stefan Tauner