arm: iproc: add NAND driver
Subsystems (4)
RFC PATCH v3 1/4 arm: iproc: add NAND driver
From: Jiandong Zheng <[email protected]>
Add support for the iproc NAND, and enable on Cygnus and NSP boards.
---
There was a previous attempt to implement this "iproc NAND" (see: http://patchwork.ozlabs.org/patch/505399), however, due to the amount of changes required, it seemed better to implement the code in a series of steps. This is the first step, where the "iproc_nand.c" is essentially an empty file (with one function required to allow this commit to build successfully).
RFC only - more changes are coming for "drivers/mtd/nand/iproc_nand.c"
Changes in v3:
- convert more CONFIG_* to Kconfig
Changes in v2:
- convert some CONFIG_* to Kconfig
arch/arm/include/asm/arch-bcmcygnus/configs.h | 2 - arch/arm/include/asm/arch-bcmnsp/configs.h | 2 - board/broadcom/bcmcygnus/Kconfig | 33 ++++++++ board/broadcom/bcmnsp/Kconfig | 33 ++++++++ drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/iproc_nand.c | 19 +++++ drivers/mtd/nand/iproc_nand_cygnus.h | 111 +++++++++++++++++++++++++ drivers/mtd/nand/iproc_nand_ns_plus.h | 113 ++++++++++++++++++++++++++ 8 files changed, 310 insertions(+), 4 deletions(-) create mode 100644 drivers/mtd/nand/iproc_nand.c create mode 100644 drivers/mtd/nand/iproc_nand_cygnus.h create mode 100644 drivers/mtd/nand/iproc_nand_ns_plus.h
arch/arm/include/asm/arch-bcmcygnus/configs.h +0 -2
@@ -9,8 +9,6 @@#include <asm/iproc-common/configs.h> -/* uArchitecture specifics */ -/* Serial Info */ /* Post pad 3 bytes after each reg addr */ #define CONFIG_SYS_NS16550_REG_SIZE (-4)
arch/arm/include/asm/arch-bcmnsp/configs.h +0 -2
@@ -9,8 +9,6 @@#include <asm/iproc-common/configs.h> -/* uArchitecture specifics */ -/* Serial Info */ /* no padding */ #define CONFIG_SYS_NS16550_REG_SIZE 1
board/broadcom/bcmcygnus/Kconfig +33 -0
@@ -12,4 +12,37 @@ config SYS_SOC config SYS_CONFIG_NAME default "bcm_ep_board" +config SYS_BCM_CYGNUS + bool + default y + select CMD_NAND + select SYS_NAND_SELF_INIT + +config NAND_IPROC + bool + default y + +# +# NAND configuration +# +config SYS_NAND_IPROC_TIMING_MODE + int + default 5 + +config SYS_NAND_BASE + int + default 0 + +config SYS_MAX_NAND_DEVICE + int + default 1 + +config SYS_MAX_NAND_CHIPS + int + default 1 + +config SYS_NAND_ONFI_DETECTION + bool + default y + endif
board/broadcom/bcmnsp/Kconfig +33 -0
@@ -12,4 +12,37 @@ config SYS_SOC config SYS_CONFIG_NAME default "bcm_ep_board" +config SYS_BCM_NSPLUS + bool + default y + select CMD_NAND + select SYS_NAND_SELF_INIT + +config NAND_IPROC + bool + default y + +# +# NAND configuration +# +config SYS_NAND_IPROC_TIMING_MODE + int + default 5 + +config SYS_NAND_BASE + int + default 0 + +config SYS_MAX_NAND_DEVICE + int + default 1 + +config SYS_MAX_NAND_CHIPS + int + default 1 + +config SYS_NAND_ONFI_DETECTION + bool + default y + endif
drivers/mtd/nand/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o +obj-$(CONFIG_NAND_IPROC) += iproc_nand.o obj-$(CONFIG_NAND_JZ4740) += jz4740_nand.o obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
drivers/mtd/nand/iproc_nand.c new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright 2015 Broadcom Corporation. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +#if defined(CONFIG_SYS_BCM_CYGNUS ) +#include "iproc_nand_cygnus.h" +#elif defined(CONFIG_SYS_BCM_NSPLUS ) +#include "iproc_nand_ns_plus.h" +#else +#error "Unsupported configuration" +#endif + +void board_nand_init (void ) +{ +}
drivers/mtd/nand/iproc_nand_cygnus.h new file +111 -0
111 lines not on this page · raw message
drivers/mtd/nand/iproc_nand_ns_plus.h new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
1.8.5
RFC PATCH v3 2/4 mtd: fix compiler warnings
- add missing declaration
- update debug output format specifiers
---
the checkpatch warning:
warning: cmd/mtdparts.c,1494: quoted string split across lines
is for the existing code; it is not introduced with this change...
Changes in v3: None
Changes in v2: None
cmd/mtdparts.c | 4 ++-- include/linux/mtd/mtd.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
cmd/mtdparts.c +2 -2
@@ -1491,7 +1491,7 @@ static int spread_partitions(void) part = list_entry(pentry, struct part_info, link);debug ("spread_partitions: device = %s%d, partition %d =" -" (%s) 0x%08x at 0x%08x\n" , +" (%s) 0x%08llx at 0x%08llx\n" ,MTD_DEV_TYPE (dev->id->type), dev->id->num, part_num, part->name, part->size, part->offset);
@@ -2009,7 +2009,7 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,if (!strcmp (&argv[1 ][3 ],".spread" )) {spread_partition (mtd, p, &next_offset); -debug ("increased %s to %d bytes\n" , p->name, p->size); +debug ("increased %s to %llu bytes\n" , p->name, p->size); }#endif
include/linux/mtd/mtd.h +8 -0
@@ -495,5 +495,13 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off,loff_t *size,loff_t *maxsize,int devtype,uint64_t chipsize); + +#ifdef CONFIG_CMD_MTDPARTS_SPREAD +/* drivers/mtd/mtdcore.c */ +void mtd_get_len_incl_bad (struct mtd_info *mtd,uint64_t offset, +const uint64_t length,uint64_t *len_incl_bad, +int *truncated); +#endif /* CONFIG_CMD_MTDPARTS_SPREAD */ +#endif #endif /* __MTD_MTD_H__ */
Signature · 1 line
1.8.5
RFC PATCH v3 2/4 mtd: fix compiler warnings
Quoted 11 lines · Steve Rae
- add missing declaration
- update debug output format specifiersSigned-off-by Steve Rae <[email protected]>---
the checkpatch warning:
? warning: cmd/mtdparts.c,1494: quoted string split across lines is for the existing code; it is not introduced with this change...Changes in v3: None
Changes in v2: None
Why is this an RFC patch? ?It seems like an attempt to fix straightforward problems, unrelated to the iproc driver.
Quoted 7 lines
?
include/linux/mtd/mtd.h +0
-0@@ -495,5 +495,13 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
include/linux/mtd/mtd.h int mtd_arg_off(const char *arg, int *idx, loff_t *off, · line 505
Quoted 10 lines
include/linux/mtd/mtd.h +7
-0?int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off, ? ?????loff_t *size, loff_t *maxsize, int devtype, ? ?????uint64_t chipsize); + +#ifdef CONFIG_CMD_MTDPARTS_SPREAD +/* drivers/mtd/mtdcore.c */ +void mtd_get_len_incl_bad (struct mtd_info *mtd,uint64_t offset, + ??const uint64_t length, uint64_t *len_incl_bad, + ??int *truncated); +#endif /* CONFIG_CMD_MTDPARTS_SPREAD */
Don't ifdef prototypes.
-Scott
RFC PATCH v3 2/4 mtd: fix compiler warnings
Hi Scott,
Quoted 10 lines · Scott Wood
Quoted 9 lines · Steve Rae
- add missing declaration
- update debug output format specifiersSigned-off-by Steve Rae <[email protected]>---
the checkpatch warning:
warning: cmd/mtdparts.c,1494: quoted string split across lines
is for the existing code; it is not introduced with this change...
Quoted 6 lines
Quoted 2 lines
Changes in v3: None
Changes in v2: NoneWhy is this an RFC patch? It seems like an attempt to fix straightforward problems, unrelated to the iproc driver.
True - I'll pull it out of this series and send a new patch.
Quoted 11 lines
Quoted 11 lines
include/linux/mtd/mtd.h +1
-0@@ -495,5 +495,13 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off,loff_t *size, int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,loff_t *size,loff_t *maxsize,int devtype,uint64_t chipsize); +
Quoted 8 lines
include/linux/mtd/mtd.h int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, · line 504
Quoted 6 lines
include/linux/mtd/mtd.h +6
-0+#ifdef CONFIG_CMD_MTDPARTS_SPREAD +/* drivers/mtd/mtdcore.c */ +void mtd_get_len_incl_bad (struct mtd_info *mtd,uint64_t offset, +const uint64_t length,uint64_t *len_incl_bad, +int *truncated); +#endif /* CONFIG_CMD_MTDPARTS_SPREAD */ Don't ifdef prototypes.
OK - thanks
Quoted 7 lines
-Scott
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
RFC PATCH v3 3/4 arm: bcm: enable MTD support
In reply to Steve RaeEnable MTD support on Cygnus and NSP boards.
---
Changes in v3: None
Changes in v2: None
arch/arm/include/asm/arch-bcmcygnus/configs.h | 6 ++++++ arch/arm/include/asm/arch-bcmnsp/configs.h | 6 ++++++ 2 files changed, 12 insertions(+)
arch/arm/include/asm/arch-bcmcygnus/configs.h +6 -0
@@ -31,4 +31,10 @@#define CONFIG_CMD_PING #define CONFIG_CMD_MII +/* MTD configuration */ +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS +#define CONFIG_CMD_MTDPARTS +#define CONFIG_CMD_MTDPARTS_SPREAD +#endif /* __ARCH_CONFIGS_H */
arch/arm/include/asm/arch-bcmnsp/configs.h +6 -0
@@ -17,4 +17,10 @@#define CONFIG_CONS_INDEX 1#define CONFIG_SYS_NS16550_COM1 0x18000300 +/* MTD configuration */ +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS +#define CONFIG_CMD_MTDPARTS +#define CONFIG_CMD_MTDPARTS_SPREAD +#endif /* __ARCH_CONFIGS_H */
Signature · 1 line
1.8.5
RFC PATCH v3 4/4 arm: bcm: configure NAND device and environment
In reply to Steve RaeConfigure the NAND device, define partition sizes, and create the environment space for Cygnus and NSP boards.
---
Changes in v3: None
Changes in v2: None
arch/arm/include/asm/arch-bcmcygnus/configs.h | 33 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-bcmnsp/configs.h | 33 +++++++++++++++++++++++++++ include/configs/bcm_ep_board.h | 3 --- 3 files changed, 66 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-bcmcygnus/configs.h +33 -0
@@ -31,6 +31,39 @@#define CONFIG_CMD_PING #define CONFIG_CMD_MII +/* Configuration for Micron MT29F8G08ABACA */ +#define CONFIG_NAND_CHIPSIZE (1 << 30)/* 1GB */ +#define CONFIG_NAND_BLOCKSIZE (1 << 18)/* 256KB */ +#define CONFIG_NAND_PAGE_SHIFT 12/* 4KiB */ +#define CONFIG_NAND_BLOCK_SHIFT 18/* 256 KiB */ + +/* Configure the Environment and the u-boot-env partition */ +#define MTD_PART_BOOT1_SIZE 0x00200000 +#define MTD_PART_GPT_SIZE 0x00100000 +#define MTD_PART_SSB_SIZE 0x00200000 +#define MTD_PART_UBOOT_SIZE 0x00200000 +#define MTD_PART_UBOOT_ENV_SIZE 0x00200000 +#define MTD_PART_DTB_SIZE 0x00100000 +#define MTD_PART_KERNEL_SIZE 0x01000000 +#define MTD_PART_ROOT_SIZE 0x1c000000 +/* +* WARNING: When changing the order of the partitions, make sure you update +* CONFIG_ENV_OFFSET accordingly. +*/ +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_RANGE (2 * CONFIG_NAND_BLOCKSIZE) +#define CONFIG_ENV_OFFSET (MTD_PART_BOOT1_SIZE + MTD_PART_GPT_SIZE + \ + MTD_PART_SSB_SIZE + MTD_PART_UBOOT_SIZE) +#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE) +/* +* Check that the u-boot-env partition is big enough to accomodate the +* u-boot environment data and its redundant copy +*/ +#if ((2 *CONFIG_ENV_RANGE ) >MTD_PART_UBOOT_ENV_SIZE ) +#error u-boot-env partition size is to small +#endif +/* MTD configuration */ #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS
arch/arm/include/asm/arch-bcmnsp/configs.h +33 -0
@@ -17,6 +17,39 @@#define CONFIG_CONS_INDEX 1#define CONFIG_SYS_NS16550_COM1 0x18000300 +/* Configuration for Micron MT29F8G08ABACA */ +#define CONFIG_NAND_CHIPSIZE (1 << 30)/* 1GB */ +#define CONFIG_NAND_BLOCKSIZE (1 << 18)/* 256KB */ +#define CONFIG_NAND_PAGE_SHIFT 12/* 4KiB */ +#define CONFIG_NAND_BLOCK_SHIFT 18/* 256 KiB */ + +/* Configure the Environment and the u-boot-env partition */ +#define MTD_PART_BOOT1_SIZE 0x00200000 +#define MTD_PART_GPT_SIZE 0x00100000 +#define MTD_PART_SSB_SIZE 0x00200000 +#define MTD_PART_UBOOT_SIZE 0x00200000 +#define MTD_PART_UBOOT_ENV_SIZE 0x00200000 +#define MTD_PART_DTB_SIZE 0x00100000 +#define MTD_PART_KERNEL_SIZE 0x01000000 +#define MTD_PART_ROOT_SIZE 0x0c000000 +/* +* WARNING: When changing the order of the partitions, make sure you update +* CONFIG_ENV_OFFSET accordingly. +*/ +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_RANGE (2 * CONFIG_NAND_BLOCKSIZE) +#define CONFIG_ENV_OFFSET (MTD_PART_BOOT1_SIZE + MTD_PART_GPT_SIZE + \ + MTD_PART_SSB_SIZE + MTD_PART_UBOOT_SIZE) +#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE) +/* +* Check that the u-boot-env partition is big enough to accomodate the +* u-boot environment data and its redundant copy +*/ +#if ((2 *CONFIG_ENV_RANGE ) >MTD_PART_UBOOT_ENV_SIZE ) +#error u-boot-env partition size is to small +#endif +/* MTD configuration */ #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS
include/configs/bcm_ep_board.h +0 -3
@@ -50,9 +50,6 @@#define CONFIG_BAUDRATE 115200 -#define CONFIG_ENV_SIZE 0x2000 -#define CONFIG_ENV_IS_NOWHERE -#define CONFIG_SYS_NO_FLASH /* Not using NAND/NOR unmanaged flash */ /* console configuration */
Signature · 1 line
1.8.5