mtd/NAND: Support for FSMC controller
Subsystems (3)
v5 cover mtd/NAND: Support for FSMC controller
This patchset adds support for ST's FSMC controller. In the current u-boot, a SPEAr specific driver exists for FSMC controller. This patchset adds a full fledged driver that can be used across multiple platforms and removes the obsolete SPEAr specific driver.
V4 -> V5
- Dropped the patch that defined change_bit as wrapper over __change_bit and, instead, defined logic to correct bit errors without using __change_bit
V3 -> V4
- Removed local_irq_save and local_irq_restore calls from change_bit wrapper
- Report the total bit flips, including that of ECC, to the upper layers
- Replace change_bit calls for err_idx's 0th and 1st bit with "^= 3" operation
V2 -> V3
- Implemented timeout during hardware ecc read
- Used __attribute__ ((aligned(2))) instead of using array of U16
- Removed unnecessary enum
V1 -> V2
- Defined CONFIG_SYS_NAND_SELF_INIT and did the related changes
- Modified the error index calculation process
- Modified newly erased page read algorithm
- Initialized the badblockbits index to 7
- Improved fsmc_bch8_correct_data() implementation
Vipin KUMAR (3):
mtd/NAND: Add FSMC driver support
SPEAr: Configure FSMC driver for NAND interface mtd/NAND: Remove obsolete SPEAr specific NAND drivers
arch/arm/include/asm/arch-spear/hardware.h | 8 +- arch/arm/include/asm/arch-spear/spr_nand.h | 57 ---- board/spear/spear300/spear300.c | 14 +- board/spear/spear310/spear310.c | 14 +- board/spear/spear320/spear320.c | 13 +- board/spear/spear600/spear600.c | 14 +- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/fsmc_nand.c | 487 ++++++++++++++++++++++++++++ drivers/mtd/nand/spr_nand.c | 124 ------- include/configs/spear-common.h | 3 +- include/configs/spear3xx.h | 4 + include/configs/spear6xx.h | 3 + include/linux/mtd/fsmc_nand.h | 101 ++++++ 13 files changed, 638 insertions(+), 205 deletions(-) delete mode 100644 arch/arm/include/asm/arch-spear/spr_nand.h create mode 100644 drivers/mtd/nand/fsmc_nand.c delete mode 100644 drivers/mtd/nand/spr_nand.c create mode 100644 include/linux/mtd/fsmc_nand.h
Signature · 1 line
1.7.2.2
PATCH RESEND v5 1/3 mtd/NAND: Add FSMC driver support
From: Vipin KUMAR <[email protected]>
Flexible static memory controller is a peripheral provided by ST, which controls the access to NAND chips along with many other memory device chips eg NOR, SRAM.
This patch adds the driver support for FSMC controller interfacing with NAND memory.
--- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/fsmc_nand.c | 487 +++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/fsmc_nand.h | 101 +++++++++ 3 files changed, 589 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/fsmc_nand.c create mode 100644 include/linux/mtd/fsmc_nand.h
drivers/mtd/nand/Makefile +1 -0
@@ -49,6 +49,7 @@ COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o +COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o COBJS-$(CONFIG_NAND_JZ4740) += jz4740_nand.o COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
drivers/mtd/nand/fsmc_nand.c new file +487 -0
487 lines not on this page · raw message
include/linux/mtd/fsmc_nand.h new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
1.7.2.2
PATCH RESEND v5 1/3 mtd/NAND: Add FSMC driver support
Quoted 37 lines · Amit Virdi
From: Vipin KUMAR<[email protected]>
Flexible static memory controller is a peripheral provided by ST, which controls the access to NAND chips along with many other memory device chips eg NOR, SRAM.
This patch adds the driver support for FSMC controller interfacing with NAND memory.
Signed-off-by Vipin Kumar<[email protected]>Signed-off-by Amit Virdi<[email protected]>--- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/fsmc_nand.c | 487 +++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/fsmc_nand.h | 101 +++++++++ 3 files changed, 589 insertions(+), 0 deletions(-)create mode 100644
drivers/mtd/nand/fsmc_nand.ccreate mode 100644include/linux/mtd/fsmc_nand.hdrivers/mtd/nand/Makefile +1
-0@@ -49,6 +49,7 @@ COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o +COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o COBJS-$(CONFIG_NAND_JZ4740) += jz4740_nand.o COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.odrivers/mtd/nand/fsmc_nand.c new file +0
-0
drivers/mtd/nand/fsmc_nand.c line 6
Quoted 6 lines
drivers/mtd/nand/fsmc_nand.c new file +6
-0@@ -0,0 +1,487 @@ +/* +* (C) Copyright 2010 +* Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com. +* +* (C) Copyright 2012 +* Amit Virdi, ST Micoelectronics, amit.virdi at st.com.
Fix the typo please. In all the copyright headers.
~Vikram
PATCH RESEND v5 1/3 mtd/NAND: Add FSMC driver support
Scott,
Quoted 9 lines · Vikram Narayanan
Quoted 6 lines
+/*
+ * (C) Copyright 2010
+ * Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com.
+ *
+ * (C) Copyright 2012
+ * Amit Virdi, ST Micoelectronics, amit.virdi at st.com.Fix the typo please. In all the copyright headers.
If you're fine with this patchset, while pushing the patches upstream, could you please change Micoelectronics to Microelectronics at both the places?
Thanks
Amit Virdi
PATCH RESEND v5 2/3 SPEAr: Configure FSMC driver for NAND interface
In reply to Amit VirdiFrom: Vipin KUMAR <[email protected]>
Since FSMC is a standard IP and it supports different memory interfaces, it is supported independent of spear platform and spear is configured to use that driver for interfacing with the NAND device
--- arch/arm/include/asm/arch-spear/hardware.h | 8 ++++---- board/spear/spear300/spear300.c | 14 +++++++++----- board/spear/spear310/spear310.c | 14 +++++++++----- board/spear/spear320/spear320.c | 13 +++++++++---- board/spear/spear600/spear600.c | 14 +++++++++----- include/configs/spear-common.h | 3 ++- include/configs/spear3xx.h | 4 ++++ include/configs/spear6xx.h | 3 +++ 8 files changed, 49 insertions(+), 24 deletions(-)
arch/arm/include/asm/arch-spear/hardware.h +4 -4
@@ -37,15 +37,15 @@#if defined(CONFIG_SPEAR600 )#define CONFIG_SYS_I2C_BASE (0xD0200000) -#define CONFIG_SPEAR_FSMCBASE (0xD1800000) +#define CONFIG_SYS_FSMC_BASE (0xD1800000)#elif defined(CONFIG_SPEAR300 )#define CONFIG_SYS_I2C_BASE (0xD0180000) -#define CONFIG_SPEAR_FSMCBASE (0x94000000) +#define CONFIG_SYS_FSMC_BASE (0x94000000)#elif defined(CONFIG_SPEAR310 )#define CONFIG_SYS_I2C_BASE (0xD0180000) -#define CONFIG_SPEAR_FSMCBASE (0x44000000) +#define CONFIG_SYS_FSMC_BASE (0x44000000)#undef CONFIG_SYS_NAND_CLE#undef CONFIG_SYS_NAND_ALE
@@ -57,7 +57,7 @@#elif defined(CONFIG_SPEAR320 )#define CONFIG_SYS_I2C_BASE (0xD0180000) -#define CONFIG_SPEAR_FSMCBASE (0x4C000000) +#define CONFIG_SYS_FSMC_BASE (0x4C000000)#define CONFIG_SPEAR_EMIBASE (0x40000000)#define CONFIG_SPEAR_RASBASE (0xB3000000)
board/spear/spear300/spear300.c +9 -5
@@ -24,10 +24,12 @@#include <common.h> #include <nand.h> #include <asm/io.h> +#include <linux/mtd/fsmc_nand.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_defs.h> #include <asm/arch/spr_misc.h> -#include <asm/arch/spr_nand.h> + +static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];int board_init (void ) {
@@ -41,18 +43,20 @@ int board_init(void)* Called by nand_init_chip to initialize the board specific functions */ -int board_nand_init (struct nand_chip *nand) +void board_nand_init () {struct misc_regs *const misc_regs_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE ; +struct nand_chip *nand = &nand_chip[0 ]; +#if defined(CONFIG_NAND_FSMC )if (((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG30 ) || ((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG31 )) { -return spear_nand_init (nand); +fsmc_nand_init (nand); } - -return -1 ; +#endif +return ; }
board/spear/spear310/spear310.c +9 -5
@@ -25,10 +25,12 @@#include <common.h> #include <nand.h> #include <asm/io.h> +#include <linux/mtd/fsmc_nand.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_defs.h> #include <asm/arch/spr_misc.h> -#include <asm/arch/spr_nand.h> + +static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];int board_init (void ) {
@@ -42,18 +44,20 @@ int board_init(void)* Called by nand_init_chip to initialize the board specific functions */ -int board_nand_init (struct nand_chip *nand) +void board_nand_init () {struct misc_regs *const misc_regs_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE ; +struct nand_chip *nand = &nand_chip[0 ]; +#if defined(CONFIG_NAND_FSMC )if (((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG30 ) || ((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG31 )) { -return spear_nand_init (nand); +fsmc_nand_init (nand); } - -return -1 ; +#endif +return ; }
board/spear/spear320/spear320.c +9 -4
@@ -25,10 +25,12 @@#include <common.h> #include <nand.h> #include <asm/io.h> +#include <linux/mtd/fsmc_nand.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_defs.h> #include <asm/arch/spr_misc.h> -#include <asm/arch/spr_nand.h> + +static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];int board_init (void ) {
@@ -42,18 +44,21 @@ int board_init(void)* Called by nand_init_chip to initialize the board specific functions */ -int board_nand_init (struct nand_chip *nand) +void board_nand_init () {struct misc_regs *const misc_regs_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE ; +struct nand_chip *nand = &nand_chip[0 ]; +#if defined(CONFIG_NAND_FSMC )if (((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG30 ) || ((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) ==MISC_SOCCFG31 )) { -return spear_nand_init (nand); +fsmc_nand_init (nand); } +#endif -return -1 ; +return ; }
board/spear/spear600/spear600.c +9 -5
@@ -24,10 +24,12 @@#include <common.h> #include <nand.h> #include <asm/io.h> +#include <linux/mtd/fsmc_nand.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_defs.h> #include <asm/arch/spr_misc.h> -#include <asm/arch/spr_nand.h> + +static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];int board_init (void ) {
@@ -41,13 +43,15 @@ int board_init(void)* Called by nand_init_chip to initialize the board specific functions */ -int board_nand_init (struct nand_chip *nand) +void board_nand_init () {struct misc_regs *const misc_regs_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE ; +struct nand_chip *nand = &nand_chip[0 ]; +#if defined(CONFIG_NAND_FSMC )if (!(readl (&misc_regs_p->auto_cfg_reg) &MISC_NANDDIS )) -return spear_nand_init (nand); - -return -1 ; +fsmc_nand_init (nand); +#endif +return ; }
include/configs/spear-common.h +2 -1
@@ -88,9 +88,10 @@#define CONFIG_SYS_LOADS_BAUD_CHANGE /* NAND FLASH Configuration */ +#define CONFIG_SYS_NAND_SELF_INIT #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS -#define CONFIG_NAND_SPEAR 1 +#define CONFIG_NAND_FSMC #define CONFIG_SYS_MAX_NAND_DEVICE 1#define CONFIG_MTD_NAND_VERIFY_WRITE 1
include/configs/spear3xx.h +4 -0
@@ -117,6 +117,10 @@#endif +/* NAND flash configuration */ +#define CONFIG_SYS_FSMC_NAND_SP +#define CONFIG_SYS_FSMC_NAND_8BIT +#if defined(CONFIG_SPEAR300 )#define CONFIG_SYS_NAND_BASE (0x80000000)
include/configs/spear6xx.h +3 -0
@@ -38,6 +38,9 @@#define CONFIG_PL01x_PORTS { (void *)CONFIG_SYS_SERIAL0, \ (void *)CONFIG_SYS_SERIAL1 } +/* NAND flash configuration */ +#define CONFIG_SYS_FSMC_NAND_SP +#define CONFIG_SYS_FSMC_NAND_8BIT #define CONFIG_SYS_NAND_BASE (0xD2000000)#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.2
PATCH RESEND v5 3/3 mtd/NAND: Remove obsolete SPEAr specific NAND drivers
In reply to Amit VirdiFrom: Vipin KUMAR <[email protected]>
Since, SPEAr platform uses generic FSMC driver now, so spear specific files drivers/mtd/nand/spr_nand.c, arch/arm/include/asm/arch-spear/spr_nand.h are removed
--- arch/arm/include/asm/arch-spear/spr_nand.h | 57 ------------- drivers/mtd/nand/spr_nand.c | 124 ---------------------------- 2 files changed, 0 insertions(+), 181 deletions(-) delete mode 100644 arch/arm/include/asm/arch-spear/spr_nand.h delete mode 100644 drivers/mtd/nand/spr_nand.c
arch/arm/include/asm/arch-spear/spr_nand.h deleted +0 -57
@@ -1,57 +0,0 @@ -/* -* (C) Copyright 2009 -* Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com. -* -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef __SPR_NAND_H__ -#define __SPR_NAND_H__ - -struct fsmc_regs { -u32 reserved_1[0x10 ]; -u32 genmemctrl_pc; -u32 reserved_2; -u32 genmemctrl_comm; -u32 genmemctrl_attrib; -u32 reserved_3; -u32 genmemctrl_ecc; -}; - -/* genmemctrl_pc register definitions */ -#define FSMC_RESET (1 << 0) -#define FSMC_WAITON (1 << 1) -#define FSMC_ENABLE (1 << 2) -#define FSMC_DEVTYPE_NAND (1 << 3) -#define FSMC_DEVWID_8 (0 << 4) -#define FSMC_DEVWID_16 (1 << 4) -#define FSMC_ECCEN (1 << 6) -#define FSMC_ECCPLEN_512 (0 << 7) -#define FSMC_ECCPLEN_256 (1 << 7) -#define FSMC_TCLR_1 (1 << 9) -#define FSMC_TAR_1 (1 << 13) - -/* genmemctrl_comm register definitions */ -#define FSMC_TSET_0 (0 << 0) -#define FSMC_TWAIT_6 (6 << 8) -#define FSMC_THOLD_4 (4 << 16) -#define FSMC_THIZ_1 (1 << 24) - -extern int spear_nand_init (struct nand_chip *nand); -#endif
drivers/mtd/nand/spr_nand.c deleted +0 -124
124 lines not on this page · raw message
Signature · 1 line
1.7.2.2
v5 cover mtd/NAND: Support for FSMC controller
In reply to Amit VirdiHi Scott,
Quoted 7 lines · Amit Virdi
This patchset adds support for ST's FSMC controller. In the current u-boot, a
SPEAr specific driver exists for FSMC controller. This patchset adds a full
fledged driver that can be used across multiple platforms and removes the
obsolete SPEAr specific driver.
Are you okay with this patchset version? If yes, please go ahead and push it upstream via your repository. There are some other SPEAr related
patches depending on this set that I would like to push.
Thanks,
Stefan
v5 cover mtd/NAND: Support for FSMC controller
Hi Scott,
Quoted 8 lines · On Friday 25 May 2012 03:58:39 stefan at roese.nl wrote:
Quoted 7 lines
This patchset adds support for ST's FSMC controller. In the current u-boot, a
SPEAr specific driver exists for FSMC controller. This patchset adds a full
fledged driver that can be used across multiple platforms and removes the
obsolete SPEAr specific driver.
Quoted 4 lines
Are you okay with this patchset version? If yes, please go ahead and push it upstream via your repository. There are some other SPEAr related
patches depending on this set that I would like to push.
Ping.
Thanks,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
v5 cover mtd/NAND: Support for FSMC controller
Quoted 11 lines · Stefan Roese
Hi Scott,
Quoted 8 lines · On Friday 25 May 2012 03:58:39 stefan at roese.nl wrote:
Quoted 7 lines
This patchset adds support for ST's FSMC controller. In the current u-boot, a
SPEAr specific driver exists for FSMC controller. This patchset adds a full
fledged driver that can be used across multiple platforms and removes the
obsolete SPEAr specific driver.
Quoted 6 lines
Quoted 4 lines
Are you okay with this patchset version? If yes, please go ahead and push it upstream via your repository. There are some other SPEAr related
patches depending on this set that I would like to push.Ping.
If you have other things to put on top of them, go ahead and take these patches with them.
-Scott
v5 cover mtd/NAND: Support for FSMC controller
Quoted 12 lines · Scott Wood
Quoted 11 lines · Stefan Roese
Hi Scott,
Quoted 8 lines · On Friday 25 May 2012 03:58:39 stefan at roese.nl wrote:
Quoted 7 lines
This patchset adds support for ST's FSMC controller. In the current u-boot, a
SPEAr specific driver exists for FSMC controller. This patchset adds a full
fledged driver that can be used across multiple platforms and removes the
obsolete SPEAr specific driver.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Are you okay with this patchset version? If yes, please go ahead and push it upstream via your repository. There are some other SPEAr related
patches depending on this set that I would like to push.Ping.
Acked-by Scott Wood<[email protected]>
Thanks Scott.
Quoted 3 lines
If you have other things to put on top of them, go ahead and take these patches with them.
Stefan, if you're going to apply these patches could you please fix Micoelectronics -> Microelectronics in fsmc_nand.c?
Quoted 4 lines
Quoted 4 lines
drivers/mtd/nand/fsmc_nand.c new file +0
-1--- /dev/null
Quoted 8 lines
drivers/mtd/nand/fsmc_nand.c line 6
Quoted 8 lines
+++
b/drivers/mtd/nand/fsmc_nand.cdrivers/mtd/nand/fsmc_nand.c new file +6
-0@@ -0,0 +1,487 @@ +/* +* (C) Copyright 2010 +* Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com. +* +* (C) Copyright 2012 +* Amit Virdi, ST Micoelectronics, amit.virdi at st.com.
Regards
Amit Virdi
v5 cover mtd/NAND: Support for FSMC controller
Quoted 5 lines · On Friday 01 June 2012 06:24:18 Amit Virdi wrote:
Quoted 2 lines
If you have other things to put on top of them, go ahead and take these patches with them.
Stefan, if you're going to apply these patches could you please fix Micoelectronics -> Microelectronics in
fsmc_nand.c?
Will do.
Thanks,
Stefan
v5 cover mtd/NAND: Support for FSMC controller
In reply to Scott WoodQuoted 4 lines · On Thursday 31 May 2012 21:27:56 Scott Wood wrote:
Acked-by Scott Wood <[email protected]>If you have other things to put on top of them, go ahead and take these patches with them.
Okay, will do.
Thanks,
Stefan