summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2007-12-31 01:49:00 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2007-12-31 01:49:00 +0000
commitae8afa9ddb709985bfd5bce38c30610cc3e47abe (patch)
tree6d4c9d27ad37db63a247647d01ec92d20a663033 /jedec.c
parentc2a18452b14481adffcbc894c1342404f8e737a5 (diff)
downloadast2050-flashrom-ae8afa9ddb709985bfd5bce38c30610cc3e47abe.zip
ast2050-flashrom-ae8afa9ddb709985bfd5bce38c30610cc3e47abe.tar.gz
Add continuation ID support to jedec.c
The continuation ID code does not go further than checking for IDs of the type 0x7fXX, but does this for vendor and product ID. The current published JEDEC spec has a list where the largest vendor ID is 7 bytes long, but all leading bytes are 0x7f. The list will grow in the future, and using a 64bit variable will not be enough anymore. Besides that, it seems that the location of the ID byte after the first continuation ID byte is very vendor specific, so we may have to revisit that code some time in the future. (Suggestion for a new encoding: Use a two-byte data type for the ID, the lower byte contains the only non-0x7f byte, the upper byte contains the number of 0x7f bytes used as prefix, which is the bank number minus 1 the vendor ID appears in.) Add support for EON EN29F002AT. Corresponding to flashrom svn r171 and coreboot v2 svn r3030. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Corey Osgood <corey.osgood@gmail.com>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/jedec.c b/jedec.c
index 30d0cda..9588751 100644
--- a/jedec.c
+++ b/jedec.c
@@ -4,6 +4,7 @@
* Copyright (C) 2000 Silicon Integrated System Corporation
* Copyright (C) 2006 Giampiero Giancipoli <gianci@email.it>
* Copyright (C) 2006 coresystems GmbH <info@coresystems.de>
+ * Copyright (C) 2007 Carl-Daniel Hailfinger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,6 +83,7 @@ int probe_jedec(struct flashchip *flash)
{
volatile uint8_t *bios = flash->virtual_memory;
uint8_t id1, id2;
+ uint32_t largeid1, largeid2;
/* Issue JEDEC Product ID Entry command */
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
@@ -98,6 +100,20 @@ int probe_jedec(struct flashchip *flash)
/* Read product ID */
id1 = *(volatile uint8_t *)bios;
id2 = *(volatile uint8_t *)(bios + 0x01);
+ largeid1 = id1;
+ largeid2 = id2;
+
+ /* Check if it is a continuation ID, this should be a while loop. */
+ if (id1 == 0x7F) {
+ largeid1 <<= 8;
+ id1 = *(volatile uint8_t *)(bios + 0x100);
+ largeid1 |= id1;
+ }
+ if (id2 == 0x7F) {
+ largeid2 <<= 8;
+ id2 = *(volatile uint8_t *)(bios + 0x101);
+ largeid2 |= id2;
+ }
/* Issue JEDEC Product ID Exit command */
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
@@ -107,8 +123,8 @@ int probe_jedec(struct flashchip *flash)
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
myusec_delay(40);
- printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, id1, id2);
- if (id1 == flash->manufacture_id && id2 == flash->model_id)
+ printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, largeid1, largeid2);
+ if (largeid1 == flash->manufacture_id && largeid2 == flash->model_id)
return 1;
return 0;
OpenPOWER on IntegriCloud