On Sunday 12 June 2016 09:04 PM, Алексей Елсаков wrote:
Hello, Flashrom developers!
I'am trying to flash Atmel AT25DF161 EEPROM with ft2232h_spi programmer.
My hardware is "FT2232H Breakout board" by DangerousPrototypes -
http://dangerousprototypes.com/docs/FT2232_breakout_board
IC is soldered to board with wires ~3cm length.
using latest flashrom v0.9.9-r1954 form SVN, IC reads well, but erasing
failed - see logs.
after erasing fail, IC content looks like this:
with SST 25VF512, Winbond 25X80VSIC, Macronix MX25L8005 this flashrom
and programmer works well.
what should I do?
Hi Alexey,
Based on the logs that you've sent, your chip had some write protection
in place and flashrom successfully disabled it. The erase functions
defined in flashrom for your chip is correct as per datasheet
(https://www.adestotech.com/wp-content/uploads/doc3687.pdf).
My theory as to why erase failed for your chip is that some 64kB
sector(s) must be locked down, meaning that they have become permanently
read-only. Attempting to program or erase such a sector is a cause of
command failure.
I have attached a patch that can help verify this theory. Please apply
the patch locally, build, test and resend the verbose log to the mailing
list.
Thanks.
Kind regards,
Hatim
/--
best regards,
Alexey Elsakov /mailto:ale...@yelsakov.ru
_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom
>From 871811ebe82fb9f9be16b4102626552b9f845f42 Mon Sep 17 00:00:00 2001
In-Reply-To: <156892285.20160612183...@yelsakov.ru>
References: <156892285.20160612183...@yelsakov.ru>
From: Hatim Kanchwala <ha...@hatimak.me>
Date: Mon, 13 Jun 2016 16:43:34 +0530
Subject: [PATCH] Print sector lockdown registers for AT25DF161
To: ale...@yelsakov.ru
Cc: flashrom@flashrom.org
When pretty-printing status register byte 1 of AT25DF chips, if chip
is AT25DF161, also print the values of sector lockdown registers for
each of the 32 64kB sectors.
Signed-off-by: Hatim Kanchwala <ha...@hatimak.me>
---
spi25_statusreg.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 01a6862..fb0e8a4 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -14,26 +14,27 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "flash.h"
#include "chipdrivers.h"
#include "spi.h"
+#include "flashchips.h"
/* === Generic functions === */
int spi_write_status_enable(struct flashctx *flash)
{
static const unsigned char cmd[JEDEC_EWSR_OUTSIZE] = { JEDEC_EWSR };
int result;
/* Send EWSR (Enable Write Status Register). */
result = spi_send_command(flash, sizeof(cmd), JEDEC_EWSR_INSIZE, cmd, NULL);
if (result)
msg_cerr("%s failed\n", __func__);
@@ -452,26 +453,61 @@ static void spi_prettyprint_status_register_atmel_at25_swp(uint8_t status)
}
}
int spi_prettyprint_status_register_at25df(struct flashctx *flash)
{
uint8_t status = spi_read_status_register(flash);
spi_prettyprint_status_register_hex(status);
spi_prettyprint_status_register_atmel_at25_srpl(status);
spi_prettyprint_status_register_bit(status, 6);
spi_prettyprint_status_register_atmel_at25_epewpp(status);
spi_prettyprint_status_register_atmel_at25_swp(status);
spi_prettyprint_status_register_welwip(status);
+
+ if (flash->chip->model_id == ATMEL_AT25DF161)
+ {
+ int address, i, count, result;
+ unsigned char read_result, lockdown_status_sector[64], cmd[5];
+ cmd[0] = (unsigned char)0x35;
+ cmd[4] = (unsigned char)0x00;
+
+ for (address = 0x000000, i = 0, count = 0; address < 0x200000; address += 0x010000, i++)
+ {
+ cmd[1] = (unsigned char)(address >> 16) & 0xff;
+ cmd[2] = (unsigned char)(address >> 8) & 0xff;
+ cmd[3] = (unsigned char)address & 0xff;
+ result = spi_send_command(flash, sizeof(cmd), sizeof(unsigned char), cmd, &read_result);
+ if (result)
+ {
+ msg_cerr("%s failed during command execution (ATMEL_AT25DF161)\n", __func__);
+ return result;
+ }
+ if (i % 8 == 0)
+ msg_cdbg("0x%02x:", i);
+ msg_cdbg(" %02x%s", read_result, (i + 1) % 8 == 0 ? "\n": "");
+ lockdown_status_sector[address / 0x010000] = read_result;
+ if (read_result)
+ count++;
+ }
+
+ msg_cdbg("%d sector%s locked down permanently%s", count, (count == 1) ? "" : "s", (count == 0) ? "." : " :");
+ if (count)
+ for (i = 0; i < 64; i++)
+ if (lockdown_status_sector[i])
+ msg_cdbg(" %2d", i);
+ msg_cdbg("\n");
+ }
+
return 0;
}
int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash)
{
/* FIXME: We should check the security lockdown. */
msg_cdbg("Ignoring security lockdown (if present)\n");
msg_cdbg("Ignoring status register byte 2\n");
return spi_prettyprint_status_register_at25df(flash);
}
/* used for AT25F512, AT25F1024(A), AT25F2048 */
int spi_prettyprint_status_register_at25f(struct flashctx *flash)
--
http://hatimak.me
_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom