Skip to content

Commit 00ce4e0

Browse files
cpackham-atlnzmiquelraynal
authored andcommitted
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>
1 parent ed6d028 commit 00ce4e0

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎drivers/mtd/nand/raw/nand_base.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5168,6 +5168,10 @@ static int nand_flash_detect_onfi(struct nand_chip *chip)
51685168
}
51695169
}
51705170

5171+
if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
5172+
chip->manufacturer.desc->ops->fixup_onfi_param_page)
5173+
chip->manufacturer.desc->ops->fixup_onfi_param_page(chip, p);
5174+
51715175
/* Check version */
51725176
val = le16_to_cpu(p->revision);
51735177
if (val & (1 << 5))

‎include/linux/mtd/rawnand.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,15 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
785785
* implementation) if any.
786786
* @cleanup: the ->init() function may have allocated resources, ->cleanup()
787787
* is here to let vendor specific code release those resources.
788+
* @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter
789+
* page. This is called after the checksum is verified.
788790
*/
789791
struct nand_manufacturer_ops {
790792
void (*detect)(struct nand_chip *chip);
791793
int (*init)(struct nand_chip *chip);
792794
void (*cleanup)(struct nand_chip *chip);
795+
void (*fixup_onfi_param_page)(struct nand_chip *chip,
796+
struct nand_onfi_params *p);
793797
};
794798

795799
/**

0 commit comments

Comments
 (0)