mtd: rawnand: add manufacturer fixup for ONFI parameter page

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>
This commit is contained in:
Chris Packham 2018-06-25 10:44:44 +12:00 committed by Miquel Raynal
parent ed6d0285f8
commit 00ce4e039a
2 changed files with 8 additions and 0 deletions

View 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 */ /* Check version */
val = le16_to_cpu(p->revision); val = le16_to_cpu(p->revision);
if (val & (1 << 5)) if (val & (1 << 5))

View File

@ -785,11 +785,15 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
* implementation) if any. * implementation) if any.
* @cleanup: the ->init() function may have allocated resources, ->cleanup() * @cleanup: the ->init() function may have allocated resources, ->cleanup()
* is here to let vendor specific code release those resources. * 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 { struct nand_manufacturer_ops {
void (*detect)(struct nand_chip *chip); void (*detect)(struct nand_chip *chip);
int (*init)(struct nand_chip *chip); int (*init)(struct nand_chip *chip);
void (*cleanup)(struct nand_chip *chip); void (*cleanup)(struct nand_chip *chip);
void (*fixup_onfi_param_page)(struct nand_chip *chip,
struct nand_onfi_params *p);
}; };
/** /**