Commit 872b71ff authored by Chris Packham's avatar Chris Packham Committed by Miquel Raynal

mtd: rawnand: add defines for ONFI version bits

Add defines for the ONFI version bits and use them in
nand_flash_detect_onfi().
Signed-off-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 00ce4e03
...@@ -5174,15 +5174,15 @@ static int nand_flash_detect_onfi(struct nand_chip *chip) ...@@ -5174,15 +5174,15 @@ static int nand_flash_detect_onfi(struct nand_chip *chip)
/* Check version */ /* Check version */
val = le16_to_cpu(p->revision); val = le16_to_cpu(p->revision);
if (val & (1 << 5)) if (val & ONFI_VERSION_2_3)
chip->parameters.onfi.version = 23; chip->parameters.onfi.version = 23;
else if (val & (1 << 4)) else if (val & ONFI_VERSION_2_2)
chip->parameters.onfi.version = 22; chip->parameters.onfi.version = 22;
else if (val & (1 << 3)) else if (val & ONFI_VERSION_2_1)
chip->parameters.onfi.version = 21; chip->parameters.onfi.version = 21;
else if (val & (1 << 2)) else if (val & ONFI_VERSION_2_0)
chip->parameters.onfi.version = 20; chip->parameters.onfi.version = 20;
else if (val & (1 << 1)) else if (val & ONFI_VERSION_1_0)
chip->parameters.onfi.version = 10; chip->parameters.onfi.version = 10;
if (!chip->parameters.onfi.version) { if (!chip->parameters.onfi.version) {
......
...@@ -237,6 +237,17 @@ enum nand_ecc_algo { ...@@ -237,6 +237,17 @@ enum nand_ecc_algo {
/* Keep gcc happy */ /* Keep gcc happy */
struct nand_chip; struct nand_chip;
/* ONFI version bits */
#define ONFI_VERSION_1_0 BIT(1)
#define ONFI_VERSION_2_0 BIT(2)
#define ONFI_VERSION_2_1 BIT(3)
#define ONFI_VERSION_2_2 BIT(4)
#define ONFI_VERSION_2_3 BIT(5)
#define ONFI_VERSION_3_0 BIT(6)
#define ONFI_VERSION_3_1 BIT(7)
#define ONFI_VERSION_3_2 BIT(8)
#define ONFI_VERSION_4_0 BIT(9)
/* ONFI features */ /* ONFI features */
#define ONFI_FEATURE_16_BIT_BUS (1 << 0) #define ONFI_FEATURE_16_BIT_BUS (1 << 0)
#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7) #define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
......
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