Commit 8dbfae1e authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse

mtd: nand_ids: introduce helper macros

Introduce helper macros for defining NAND chips. These macros do not really add
much value in the current code-base. However, we are going to add full ID
support which adds some more complexity to the table, and helper macros become
useful for readability.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 51148f1f
This diff is collapsed.
...@@ -67,39 +67,37 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs) ...@@ -67,39 +67,37 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)
return error; return error;
} }
static struct nand_flash_dev nand_smartmedia_flash_ids[] = { static struct nand_flash_dev nand_smartmedia_flash_ids[] = {
{"SmartMedia 2MiB 3,3V ROM", 0x5d, 512, 2, 0x2000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 2MiB 3,3V ROM", 0x5d, 512, 2, 0x2000, NAND_ROM),
{"SmartMedia 4MiB 3,3V", 0xe3, 512, 4, 0x2000, 0}, LEGACY_ID_NAND("SmartMedia 4MiB 3,3V", 0xe3, 512, 4, 0x2000, 0),
{"SmartMedia 4MiB 3,3/5V", 0xe5, 512, 4, 0x2000, 0}, LEGACY_ID_NAND("SmartMedia 4MiB 3,3/5V", 0xe5, 512, 4, 0x2000, 0),
{"SmartMedia 4MiB 5V", 0x6b, 512, 4, 0x2000, 0}, LEGACY_ID_NAND("SmartMedia 4MiB 5V", 0x6b, 512, 4, 0x2000, 0),
{"SmartMedia 4MiB 3,3V ROM", 0xd5, 512, 4, 0x2000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 4MiB 3,3V ROM", 0xd5, 512, 4, 0x2000, NAND_ROM),
{"SmartMedia 8MiB 3,3V", 0xe6, 512, 8, 0x2000, 0}, LEGACY_ID_NAND("SmartMedia 8MiB 3,3V", 0xe6, 512, 8, 0x2000, 0),
{"SmartMedia 8MiB 3,3V ROM", 0xd6, 512, 8, 0x2000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 8MiB 3,3V ROM", 0xd6, 512, 8, 0x2000, NAND_ROM),
{"SmartMedia 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0}, LEGACY_ID_NAND("SmartMedia 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0),
{"SmartMedia 16MiB 3,3V ROM", 0x57, 512, 16, 0x4000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 16MiB 3,3V ROM", 0x57, 512, 16, 0x4000, NAND_ROM),
{"SmartMedia 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0}, LEGACY_ID_NAND("SmartMedia 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0),
{"SmartMedia 32MiB 3,3V ROM", 0x58, 512, 32, 0x4000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 32MiB 3,3V ROM", 0x58, 512, 32, 0x4000, NAND_ROM),
{"SmartMedia 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0}, LEGACY_ID_NAND("SmartMedia 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0),
{"SmartMedia 64MiB 3,3V ROM", 0xd9, 512, 64, 0x4000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 64MiB 3,3V ROM", 0xd9, 512, 64, 0x4000, NAND_ROM),
{"SmartMedia 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0}, LEGACY_ID_NAND("SmartMedia 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0),
{"SmartMedia 128MiB 3,3V ROM", 0xda, 512, 128, 0x4000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 128MiB 3,3V ROM", 0xda, 512, 128, 0x4000, NAND_ROM),
{"SmartMedia 256MiB 3,3V", 0x71, 512, 256, 0x4000 }, LEGACY_ID_NAND("SmartMedia 256MiB 3, 3V", 0x71, 512, 256, 0x4000, 0),
{"SmartMedia 256MiB 3,3V ROM", 0x5b, 512, 256, 0x4000, NAND_ROM}, LEGACY_ID_NAND("SmartMedia 256MiB 3,3V ROM", 0x5b, 512, 256, 0x4000, NAND_ROM),
{NULL,} {NULL}
}; };
static struct nand_flash_dev nand_xd_flash_ids[] = { static struct nand_flash_dev nand_xd_flash_ids[] = {
LEGACY_ID_NAND("xD 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0),
{"xD 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0}, LEGACY_ID_NAND("xD 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0),
{"xD 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0}, LEGACY_ID_NAND("xD 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0),
{"xD 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0}, LEGACY_ID_NAND("xD 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0),
{"xD 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0}, LEGACY_ID_NAND("xD 256MiB 3,3V", 0x71, 512, 256, 0x4000, NAND_BROKEN_XD),
{"xD 256MiB 3,3V", 0x71, 512, 256, 0x4000, NAND_BROKEN_XD}, LEGACY_ID_NAND("xD 512MiB 3,3V", 0xdc, 512, 512, 0x4000, NAND_BROKEN_XD),
{"xD 512MiB 3,3V", 0xdc, 512, 512, 0x4000, NAND_BROKEN_XD}, LEGACY_ID_NAND("xD 1GiB 3,3V", 0xd3, 512, 1024, 0x4000, NAND_BROKEN_XD),
{"xD 1GiB 3,3V", 0xd3, 512, 1024, 0x4000, NAND_BROKEN_XD}, LEGACY_ID_NAND("xD 2GiB 3,3V", 0xd5, 512, 2048, 0x4000, NAND_BROKEN_XD),
{"xD 2GiB 3,3V", 0xd5, 512, 2048, 0x4000, NAND_BROKEN_XD}, {NULL}
{NULL,}
}; };
int sm_register_device(struct mtd_info *mtd, int smartmedia) int sm_register_device(struct mtd_info *mtd, int smartmedia)
......
...@@ -546,6 +546,30 @@ struct nand_chip { ...@@ -546,6 +546,30 @@ struct nand_chip {
#define NAND_MFR_MACRONIX 0xc2 #define NAND_MFR_MACRONIX 0xc2
#define NAND_MFR_EON 0x92 #define NAND_MFR_EON 0x92
/*
* A helper for defining older NAND chips where the second ID byte fully
* defined the chip, including the geometry (chip size, eraseblock size, page
* size).
*/
#define LEGACY_ID_NAND(nm, devid, pagesz, chipsz, erasesz, opts) \
{ .name = (nm), .dev_id = (devid), .pagesize = (pagesz), \
.chipsize = (chipsz), .erasesize = (erasesz), \
.options = (opts) }
/*
* A helper for defining newer chips which report their page size and
* eraseblock size via the extended ID bytes.
*
* The real difference between LEGACY_ID_NAND and EXTENDED_ID_NAND is that with
* EXTENDED_ID_NAND, manufacturers overloaded the same device ID so that the
* device ID now only represented a particular total chip size (and voltage,
* buswidth), and the page size, eraseblock size, and OOB size could vary while
* using the same device ID.
*/
#define EXTENDED_ID_NAND(nm, devid, chipsz, opts) \
{ .name = (nm), .dev_id = (devid), .chipsize = (chipsz), \
.options = (opts) }
/** /**
* struct nand_flash_dev - NAND Flash Device ID Structure * struct nand_flash_dev - NAND Flash Device ID Structure
* @name: a human-readable name of the NAND chip * @name: a human-readable name of the NAND chip
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment