OSDN Git Service

mtd: rawnand: add manufacturer fixup for ONFI parameter page
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Sun, 24 Jun 2018 22:44:44 +0000 (10:44 +1200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 2 Jul 2018 07:02:16 +0000 (09:02 +0200)
This is called after the ONFI parameter page checksum is verified
and allows us to override the contents of the parameter page.

Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/nand_base.c
include/linux/mtd/rawnand.h

index 1c633f8..f362c09 100644 (file)
@@ -5168,6 +5168,10 @@ static int nand_flash_detect_onfi(struct nand_chip *chip)
                }
        }
 
+       if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
+           chip->manufacturer.desc->ops->fixup_onfi_param_page)
+               chip->manufacturer.desc->ops->fixup_onfi_param_page(chip, p);
+
        /* Check version */
        val = le16_to_cpu(p->revision);
        if (val & (1 << 5))
index 80aeeca..dc4538b 100644 (file)
@@ -785,11 +785,15 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
  *       implementation) if any.
  * @cleanup: the ->init() function may have allocated resources, ->cleanup()
  *          is here to let vendor specific code release those resources.
+ * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter
+ *                        page. This is called after the checksum is verified.
  */
 struct nand_manufacturer_ops {
        void (*detect)(struct nand_chip *chip);
        int (*init)(struct nand_chip *chip);
        void (*cleanup)(struct nand_chip *chip);
+       void (*fixup_onfi_param_page)(struct nand_chip *chip,
+                                     struct nand_onfi_params *p);
 };
 
 /**