From 400afdd7734c74881e208ae4b7fdb2a3dc2220bb Mon Sep 17 00:00:00 2001
From: Brian Foster <brian.foster@maximintegrated.com>
Date: Thu, 4 Jul 2013 13:35:31 +0200
Subject: [PATCH] Init ONFI get/set features in a more logical place
For some reason the ONFI get/set feature handlers were
being initialized in nand_scan_tail(), making it rather
difficult to use the default handlers after nand_scan_ident(),
which determines whether or not the NAND chip is ONFI-compliant.
Move the handler initialization into nand_set_defaults(),
where most handlers are initialized.
Change-Id: I055179ab3d4ea23780879197f4add02e27e6c0d1
Signed-off-by: Brian Foster <brian.foster@maximintegrated.com>
Cc: Florian Fainelli <ffainelli@freebox.fr>
---
drivers/mtd/nand/nand_base.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
@@ -2814,6 +2814,11 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
init_waitqueue_head(&chip->controller->wq);
}
+ /* set for ONFI nand */
+ if (!chip->onfi_set_features)
+ chip->onfi_set_features = nand_onfi_set_features;
+ if (!chip->onfi_get_features)
+ chip->onfi_get_features = nand_onfi_get_features;
}
/* Sanitize ONFI strings so we can safely print them */
@@ -3446,12 +3451,6 @@ int nand_scan_tail(struct mtd_info *mtd)
if (!chip->write_page)
chip->write_page = nand_write_page;
- /* set for ONFI nand */
- if (!chip->onfi_set_features)
- chip->onfi_set_features = nand_onfi_set_features;
- if (!chip->onfi_get_features)
- chip->onfi_get_features = nand_onfi_get_features;
-
/*
* Check ECC mode, default to software if 3byte/512byte hardware ECC is
* selected and we have 256 byte pagesize fallback to software ECC
--
1.7.9.5