Patchwork Fix probe_jedec() with continuation bytes, add EN29LV640T and get rid of probe_en29lv640b().

login
register
about
Submitter Stefan Tauner
Date 2014-08-10 22:12:56
Message ID <1407708776-18902-1-git-send-email-stefan.tauner@alumni.tuwien.ac.at>
Download mbox | patch
Permalink /patch/4232/
State New
Headers show

Comments

Stefan Tauner - 2014-08-10 22:12:56
We forgot to shift the addresses for continuation bytes in r1840.
Also, probe_en29lv640b() can easily be replaced with refined probe_jedec().
Furthermore, add EN29LV640T which is the top boot sector-variant of
EN29LV640B.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
---

Rudolf, if you still have access to the bifferboard, I'd very welcome
testing this patch on it. This would verify the change we did in r1840
(+ its fix in this patch) + the refactoring as well.

I might look into the write function later too, but currently probing
functions are my main focus.

 flashchips.c | 32 +++++++++++++++++++++++++++++++-
 flashchips.h |  1 +
 jedec.c      |  4 ++--
 3 files changed, 34 insertions(+), 3 deletions(-)
Stefan Tauner - 2014-08-10 23:07:44
On Mon, 11 Aug 2014 00:12:56 +0200
Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> wrote:

> We forgot to shift the addresses for continuation bytes in r1840.
> Also, probe_en29lv640b() can easily be replaced with refined probe_jedec().
> Furthermore, add EN29LV640T which is the top boot sector-variant of
> EN29LV640B.
> 
> Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
> ---
> 
> Rudolf, if you still have access to the bifferboard, I'd very welcome
> testing this patch on it. This would verify the change we did in r1840
> (+ its fix in this patch) + the refactoring as well.
> 
> I might look into the write function later too, but currently probing
> functions are my main focus.

Actually I don't see anything unusual in the datasheet regarding
writing either, where does it state that the chip has to be programmed
in 16b words even if BYTE# is low?. I am not 100% if jedec_probe needs a
refinement for shifted access too, but we should be able to get this
to work in any case without an extra function, Carl-Daniel, please
advice. :)

PS: I have removed probe_en29lv640b() locally which I forgot on the
posted patch.

Patch

diff --git a/flashchips.c b/flashchips.c
index 74b58ba..80fe1f5 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -4871,7 +4871,7 @@  const struct flashchip flashchips[] = {
 		.page_size	= 8192,
 		.feature_bits	= FEATURE_ADDR_SHIFTED,
 		.tested		= TEST_OK_PREW,
-		.probe		= probe_en29lv640b,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.block_erasers	=
 		{
@@ -4893,6 +4893,36 @@  const struct flashchip flashchips[] = {
 
 	{
 		.vendor		= "Eon",
+		.name		= "EN29LV640T",
+		.bustype	= BUS_PARALLEL,
+		.manufacture_id	= EON_ID,
+		.model_id	= EON_EN29LV640T,
+		.total_size	= 8192,
+		.page_size	= 8192,
+		.feature_bits	= FEATURE_ADDR_SHIFTED,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
+		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = {
+					{64 * 1024, 127},
+					{8 * 1024, 8},
+				},
+				.block_erase = erase_block_jedec,
+			}, {
+				.eraseblocks = { {8 * 1024 * 1024, 1} },
+				.block_erase = erase_chip_block_jedec,
+			},
+		},
+		.write		= write_en29lv640b,
+		.read		= read_memmapped,
+		.voltage	= {2700, 3600},
+	},
+
+	{
+		.vendor		= "Eon",
 		.name		= "EN29GL064(A)B",
 		.bustype	= BUS_PARALLEL,
 		.manufacture_id	= EON_ID,
diff --git a/flashchips.h b/flashchips.h
index f0fbf4b..b2418bb 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -295,6 +295,7 @@ 
 #define EON_EN29LV010		0x7F6E
 #define EON_EN29LV040A		0x7F4F	/* EN29LV040(A) */
 #define EON_EN29LV640B		0xCB
+#define EON_EN29LV640T		0xC9
 #define EON_EN29F002T		0x7F92	/* Same as EN29F002A */
 #define EON_EN29F002B		0x7F97	/* Same as EN29F002AN */
 #define EON_EN29GL064HL		0x7E0C01	/* Uniform Sectors, WP protects Top OR Bottom sector */
diff --git a/jedec.c b/jedec.c
index 358b850..dce110d 100644
--- a/jedec.c
+++ b/jedec.c
@@ -237,12 +237,12 @@  static int probe_jedec_common(struct flashctx *flash, unsigned int mask)
 	/* Check if it is a continuation ID, this should be a while loop. */
 	if (id1 == 0x7F) {
 		largeid1 <<= 8;
-		id1 = chip_readb(flash, bios + 0x100);
+		id1 = chip_readb(flash, bios + (0x100 << shifted));
 		largeid1 |= id1;
 	}
 	if (id2 == 0x7F) {
 		largeid2 <<= 8;
-		id2 = chip_readb(flash, bios + 0x101);
+		id2 = chip_readb(flash, bios + (0x101 << shifted));
 		largeid2 |= id2;
 	}