Manufacturer postponed initialization is for MTD default call-back function replacement for vendor soecific operation, i.e., _lock/_unlock, _suspend/_resume and so on. Signed-off-by: Mason Yang <masonccyang@xxxxxxxxxxx> --- drivers/mtd/nand/raw/internals.h | 4 ++++ drivers/mtd/nand/raw/nand_base.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h index cba6fe7..505dd46 100644 --- a/drivers/mtd/nand/raw/internals.h +++ b/drivers/mtd/nand/raw/internals.h @@ -42,6 +42,9 @@ * 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. + * @post_init: postponed initialization is for MTD default call-back function + * replacement for vendor specific operation i.e., _lock/_unlock, + * _suspend/_resume and so on. */ struct nand_manufacturer_ops { void (*detect)(struct nand_chip *chip); @@ -49,6 +52,7 @@ struct nand_manufacturer_ops { void (*cleanup)(struct nand_chip *chip); void (*fixup_onfi_param_page)(struct nand_chip *chip, struct nand_onfi_params *p); + void (*post_init)(struct nand_chip *chip); }; /** diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 91f046d..7835b81 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -4619,6 +4619,21 @@ static int nand_manufacturer_init(struct nand_chip *chip) } /* + * Manufacturer postponed initialization. This function is called for all NANDs + * whose MTD default call-back function replacement is needed. + * Manufacturer drivers should put all their specific postponed initialization + * code in their ->post_init() hook. + */ +static void nand_manufacturer_post_init(struct nand_chip *chip) +{ + if (!chip->manufacturer.desc || !chip->manufacturer.desc->ops || + !chip->manufacturer.desc->ops->post_init) + return; + + return chip->manufacturer.desc->ops->post_init(chip); +} + +/* * Manufacturer cleanup. This function is called for all NANDs including * ONFI and JEDEC compliant ones. * Manufacturer drivers should put all their specific cleanup code in their @@ -5812,6 +5827,10 @@ static int nand_scan_tail(struct nand_chip *chip) goto err_nanddev_cleanup; } + nand_select_target(chip, 0); + nand_manufacturer_post_init(chip); + nand_deselect_target(chip); + /* Check, if we should skip the bad block table scan */ if (chip->options & NAND_SKIP_BBTSCAN) return 0; -- 1.9.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/