changeset 973:7c18eac91457

loadtools: round out support for Intel flash families The three Intel flash families encountered so far in Calypso GSM devices are C3, W30 and W18, sizes from 2 to 8 MiB. Let's support all Intel flash chips from these 3 families across this range of sizes.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 Nov 2023 18:56:40 +0000
parents 97a331a4b455
children bee0e096f076
files loadtools/flashid.c loadtools/fldevs.c
diffstat 2 files changed, 109 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/flashid.c	Sat Sep 02 06:38:07 2023 +0000
+++ b/loadtools/flashid.c	Tue Nov 28 18:56:40 2023 +0000
@@ -9,11 +9,16 @@
 #include "flash.h"
 
 extern struct flash_device flashdev_28F160C3T;
+extern struct flash_device flashdev_28F160C3B;
 extern struct flash_device flashdev_28F320C3T;
+extern struct flash_device flashdev_28F320C3B;
 extern struct flash_device flashdev_28F640C3T;
 extern struct flash_device flashdev_28F640C3B;
+extern struct flash_device flashdev_28F320W30T;
+extern struct flash_device flashdev_28F320W30B;
 extern struct flash_device flashdev_28F640W30T;
 extern struct flash_device flashdev_28F640W30B;
+
 extern struct flash_device flashdev_Am29DL640G;
 extern struct flash_device flashdev_PL032J;
 extern struct flash_device flashdev_PL129J;
@@ -180,12 +185,21 @@
 	/* 28F160C3T and 28F320C3T equivalents found in some Mot C1xx phones */
 	{0x0020, 0x88BA, try_device, &flashdev_28F320C3T},
 	{0x0020, 0x88CE, try_device, &flashdev_28F160C3T},
-	/* Intel flash chips */
+	/* Intel W30 flash family */
+	{0x0089, 0x8852, try_device, &flashdev_28F320W30T},
+	{0x0089, 0x8853, try_device, &flashdev_28F320W30B},
 	{0x0089, 0x8854, try_device, &flashdev_28F640W30T},
 	{0x0089, 0x8855, try_device, &flashdev_28F640W30B},
+	/* Intel W18 flash family: same as W30, but different ID codes */
+	{0x0089, 0x8862, try_device, &flashdev_28F320W30T},
+	{0x0089, 0x8863, try_device, &flashdev_28F320W30B},
 	{0x0089, 0x8864, try_device, &flashdev_28F640W30T},
+	{0x0089, 0x8865, try_device, &flashdev_28F640W30B},
+	/* Intel C3 flash family */
 	{0x0089, 0x88C2, try_device, &flashdev_28F160C3T},
+	{0x0089, 0x88C3, try_device, &flashdev_28F160C3B},
 	{0x0089, 0x88C4, try_device, &flashdev_28F320C3T},
+	{0x0089, 0x88C5, try_device, &flashdev_28F320C3B},
 	{0x0089, 0x88CC, try_device, &flashdev_28F640C3T},
 	{0x0089, 0x88CD, try_device, &flashdev_28F640C3B},
 	/* Samsung flash */
--- a/loadtools/fldevs.c	Sat Sep 02 06:38:07 2023 +0000
+++ b/loadtools/fldevs.c	Tue Nov 28 18:56:40 2023 +0000
@@ -18,6 +18,13 @@
 	.total_sectors	= 39,
 };
 
+static struct flash_geom geom_2M_bottomboot = {
+	.total_size	= 0x200000,
+	.nregions	= 2,
+	.regions	= {0x2000, 8, 0x10000, 31},
+	.total_sectors	= 39,
+};
+
 static struct flash_geom geom_4M_topboot = {
 	.total_size	= 0x400000,
 	.nregions	= 2,
@@ -25,6 +32,13 @@
 	.total_sectors	= 71,
 };
 
+static struct flash_geom geom_4M_bottomboot = {
+	.total_size	= 0x400000,
+	.nregions	= 2,
+	.regions	= {0x2000, 8, 0x10000, 63},
+	.total_sectors	= 71,
+};
+
 static struct flash_geom geom_4M_bothends = {
 	.total_size	= 0x400000,
 	.nregions	= 3,
@@ -88,6 +102,25 @@
 	{-1,   0}
 };
 
+static struct cfi_check intel_2M_bottomboot_cfi[] = {
+	{0x10, 'Q'},
+	{0x11, 'R'},
+	{0x12, 'Y'},
+	{0x13, 0x03},
+	{0x14, 0x00},
+	{0x27, 0x15},
+	{0x2C, 0x02},
+	{0x2D, 0x07},
+	{0x2E, 0x00},
+	{0x2F, 0x20},
+	{0x30, 0x00},
+	{0x31, 0x1E},
+	{0x32, 0x00},
+	{0x33, 0x00},
+	{0x34, 0x01},
+	{-1,   0}
+};
+
 static struct cfi_check intel_4M_topboot_cfi[] = {
 	{0x10, 'Q'},
 	{0x11, 'R'},
@@ -107,6 +140,25 @@
 	{-1,   0}
 };
 
+static struct cfi_check intel_4M_bottomboot_cfi[] = {
+	{0x10, 'Q'},
+	{0x11, 'R'},
+	{0x12, 'Y'},
+	{0x13, 0x03},
+	{0x14, 0x00},
+	{0x27, 0x16},
+	{0x2C, 0x02},
+	{0x2D, 0x07},
+	{0x2E, 0x00},
+	{0x2F, 0x20},
+	{0x30, 0x00},
+	{0x31, 0x3E},
+	{0x32, 0x00},
+	{0x33, 0x00},
+	{0x34, 0x01},
+	{-1,   0}
+};
+
 static struct cfi_check intel_8M_topboot_cfi[] = {
 	{0x10, 'Q'},
 	{0x11, 'R'},
@@ -145,6 +197,8 @@
 	{-1,   0}
 };
 
+/* classic Intel C3 family: found in low-end Mot C1xx models and BenQ M32 */
+
 struct flash_device flashdev_28F160C3T = {
 	.name			= "Intel 28F160C3T",
 	.cfi_table		= intel_2M_topboot_cfi,
@@ -153,6 +207,14 @@
 	.cmdset			= &flash_cmdset_intel,
 };
 
+struct flash_device flashdev_28F160C3B = {
+	.name			= "Intel 28F160C3B",
+	.cfi_table		= intel_2M_bottomboot_cfi,
+	.required_global_config	= FLASH_GLOBAL_CFG_SINGLE_4M,
+	.bank_geom		= {&geom_2M_bottomboot, 0},
+	.cmdset			= &flash_cmdset_intel,
+};
+
 struct flash_device flashdev_28F320C3T = {
 	.name			= "Intel 28F320C3T",
 	.cfi_table		= intel_4M_topboot_cfi,
@@ -161,6 +223,14 @@
 	.cmdset			= &flash_cmdset_intel,
 };
 
+struct flash_device flashdev_28F320C3B = {
+	.name			= "Intel 28F320C3B",
+	.cfi_table		= intel_4M_bottomboot_cfi,
+	.required_global_config	= FLASH_GLOBAL_CFG_SINGLE_4M,
+	.bank_geom		= {&geom_4M_bottomboot, 0},
+	.cmdset			= &flash_cmdset_intel,
+};
+
 struct flash_device flashdev_28F640C3T = {
 	.name			= "Intel 28F640C3T",
 	.cfi_table		= intel_8M_topboot_cfi,
@@ -177,6 +247,30 @@
 	.cmdset			= &flash_cmdset_intel,
 };
 
+/*
+ * Intel W18 and W30 families are equivalent in terms of geometries and
+ * relevant quirks, and are distinguishable only by ID codes.  We treat them
+ * all as W30, based on the latter family being the first one encountered:
+ * 28F640W30B is the flash chip used on TI's legendary D-Sample board, and
+ * the flash inside Motorola C155/156 is an MCP equivalent of the same.
+ */
+
+struct flash_device flashdev_28F320W30T = {
+	.name			= "Intel 28F320W30T",
+	.cfi_table		= intel_4M_topboot_cfi,
+	.required_global_config	= FLASH_GLOBAL_CFG_SINGLE_4M,
+	.bank_geom		= {&geom_4M_topboot, 0},
+	.cmdset			= &flash_cmdset_intel_w30,
+};
+
+struct flash_device flashdev_28F320W30B = {
+	.name			= "Intel 28F320W30B",
+	.cfi_table		= intel_4M_bottomboot_cfi,
+	.required_global_config	= FLASH_GLOBAL_CFG_SINGLE_4M,
+	.bank_geom		= {&geom_4M_bottomboot, 0},
+	.cmdset			= &flash_cmdset_intel_w30,
+};
+
 struct flash_device flashdev_28F640W30T = {
 	.name			= "Intel 28F640W30T",
 	.cfi_table		= intel_8M_topboot_cfi,