
Hi Scott,
On 6/14/2014 2:10 AM, Scott Wood wrote:
On Thu, 2014-06-12 at 12:14 +0530, Prabhakar Kushwaha wrote:
IFC controller v1.1.0 requires internal SRAM initialize by reading NAND flash. Higher controller versions have provided "SRAM init" bit in NCFGR register space.
update SRAM initialize logic to reflect the same.
Also print error message in case of Page read error.
Signed-off-by: Prabhakar Kushwaha prabhakar@freescale.com
Changes for v2:
- Updated error handling
drivers/mtd/nand/fsl_ifc_nand.c | 35 +++++++++++++++++++++++++++++++---- include/fsl_ifc.h | 2 ++ 2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index 27f5177..280e14e 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -806,12 +806,30 @@ static void fsl_ifc_select_chip(struct mtd_info *mtd, int chip) { }
-static void fsl_ifc_sram_init(void) +static int fsl_ifc_sram_init(uint32_t ver) { struct fsl_ifc *ifc = ifc_ctrl->regs; uint32_t cs = 0, csor = 0, csor_8k = 0, csor_ext = 0;
uint32_t ncfgr = 0; long long end_tick;
if (ver > FSL_IFC_V1_1_0) {
It would be better to check that ver >= the first version that supports this, rather than > the last version that doesn't.
here only 2 type of code is present i.e. (ver == FSL_IFC_V1_1_0) and (ver > FSL_IFC_V1_1_0). if i put (ver == FSL_IFC_V1_1_0) earlier a lots of code go in "if ". I am trying to avoid it to make code more cleaner.
How much benefit is there in doing this versus continuing with the current code?
Existing code is perfect for 8KB internal SRAM as we are reading 8KB Page. As IFC 2.0 has 16KB SRAM, either I have to read 16KB page or I have to read 2 8KB page to fill complete SRAM.
in future, there may be possibility of > 16KB internal SRAM. So I decided to use SRAM init bit.
Should we determine the IFC version at compile time instead, so that we don't need to carry around both versions of the code in the binary?
Compile time option can be used. But in Linux driver it may not be possible. I am trying to have same code base in u-boot and Linux for maintainability.
--prabhakar