All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/9] mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members
@ 2010-04-24 15:57 Guillaume LECERF
  2010-04-24 15:57 ` [PATCH v5 2/9] mtd: cfi_probe: make the addresses used to enter Auto Select Mode variable Guillaume LECERF
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Guillaume LECERF @ 2010-04-24 15:57 UTC (permalink / raw)
  To: linux-mtd; +Cc: Wolfram Sang, David Woodhouse, Chris Moore, Artem Bityutskiy

Move the code to enter Auto Select Mode down to be able to use cfi->cfiq
members to add support for chips using alternative sequence / unlock
addresses.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
---
 drivers/mtd/chips/cfi_probe.c |   47 +++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index e63e674..f657d16 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -181,29 +181,6 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 	for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
 		((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor);
 
-	/* Note we put the device back into Read Mode BEFORE going into Auto
-	 * Select Mode, as some devices support nesting of modes, others
-	 * don't. This way should always work.
-	 * On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
-	 * so should be treated as nops or illegal (and so put the device
-	 * back into Read Mode, which is a nop in this case).
-	 */
-	cfi_send_gen_cmd(0xf0,     0, base, map, cfi, cfi->device_type, NULL);
-	cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
-	cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
-	cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
-	cfi->mfr = cfi_read_query16(map, base);
-	cfi->id = cfi_read_query16(map, base + ofs_factor);
-
-	/* Get AMD/Spansion extended JEDEC ID */
-	if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
-		cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
-			  cfi_read_query(map, base + 0xf * ofs_factor);
-
-	/* Put it back into Read Mode */
-	cfi_qry_mode_off(base, map, cfi);
-	xip_allowed(base, map);
-
 	/* Do any necessary byteswapping */
 	cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
 
@@ -228,6 +205,30 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 #endif
 	}
 
+	/*
+	 * Note we put the device back into Read Mode BEFORE going into Auto
+	 * Select Mode, as some devices support nesting of modes, others
+	 * don't. This way should always work.
+	 * On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
+	 * so should be treated as nops or illegal (and so put the device
+	 * back into Read Mode, which is a nop in this case).
+	 */
+	cfi_send_gen_cmd(0xf0,     0, base, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
+	cfi->mfr = cfi_read_query16(map, base);
+	cfi->id = cfi_read_query16(map, base + ofs_factor);
+
+	/* Get AMD/Spansion extended JEDEC ID */
+	if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
+		cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
+			  cfi_read_query(map, base + 0xf * ofs_factor);
+
+	/* Put it back into Read Mode */
+	cfi_qry_mode_off(base, map, cfi);
+	xip_allowed(base, map);
+
 	printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
 	       map->name, cfi->interleave, cfi->device_type*8, base,
 	       map->bankwidth*8);

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-05-14  8:15 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-24 15:57 [PATCH v5 1/9] mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members Guillaume LECERF
2010-04-24 15:57 ` [PATCH v5 2/9] mtd: cfi_probe: make the addresses used to enter Auto Select Mode variable Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 3/9] mtd: cfi_probe: add support for SST 0x0701 vendorname Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 4/9] mtd: cfi_probe: use P_ID_* definitions instead of hardcoded values Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 5/9] [MTD] remove bogus warning about missing boot bank location Guillaume LECERF
2010-04-29  5:57   ` Artem Bityutskiy
2010-04-29 11:01     ` Guillaume LECERF
2010-05-11  8:43     ` Guillaume LECERF
2010-05-14  0:19   ` David Woodhouse
2010-05-14  6:17     ` Chris Moore
2010-05-14  7:54       ` David Woodhouse
2010-05-14  8:09         ` Guillaume LECERF
2010-05-14  8:15           ` David Woodhouse
2010-04-24 15:58 ` [PATCH v5 6/9] mtd: cfi_cmdset_0002: do not fail on no extended query table as they are both optional Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 7/9] mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{16, 32}xx chips Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 8/9] mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{32, 64}xxB chips Guillaume LECERF
2010-04-24 15:58 ` [PATCH v5 9/9] mtd: cfi_util: do not printk if no extended query table Guillaume LECERF

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.