mtd: denali: Use SELF_INIT to fix up registers after nand_scan_ident()
Subsystems (2)
v2 cover mtd: denali: Use SELF_INIT to fix up registers after nand_scan_ident()
This patch series is here because Scott Wood recommended me to use CONFIG_SYS_NAND_SELF_INIT to solve my problem:
http://patchwork.ozlabs.org/patch/402462/
Changes in v2:
- Use &nand_info[0] instead of nand_info
- Print a warning message if initialization fails
Masahiro Yamada (2):
mtd: denali: use CONFIG_SYS_NAND_SELF_INIT
mtd: denali: set some registers after nand_scan_ident()
drivers/mtd/nand/Kconfig | 7 +++ drivers/mtd/nand/denali.c | 132 +++++++++++++++++++++++++++++++++------------- drivers/mtd/nand/denali.h | 5 +- 3 files changed, 104 insertions(+), 40 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 mtd: denali: use CONFIG_SYS_NAND_SELF_INIT
Some variants of the Denali NAND controller need some registers set up based on the device information that has been detected during nand_scan_ident().
CONFIG_SYS_NAND_SELF_INIT has to be defined to insert code between nand_scan_ident() and nand_scan_tail(). It is also helpful to reduce the difference between this driver and its Linux counterpart because this driver was ported from Linux. Moreover, doc/README.nand recommends to use CONFIG_SYS_NAND_SELF_INIT.
---
Changes in v2:
- Use &nand_info[0] instead of nand_info
- Print a warning message if initialization fails
drivers/mtd/nand/Kconfig | 7 +++ drivers/mtd/nand/denali.c | 121 ++++++++++++++++++++++++++++++++-------------- drivers/mtd/nand/denali.h | 5 +- 3 files changed, 93 insertions(+), 40 deletions(-)
drivers/mtd/nand/Kconfig +7 -0
@@ -1,9 +1,16 @@ menu "NAND Device Support" +config SYS_NAND_SELF_INIT + bool + help + This option, if enabled, provides more flexible and linux-like + NAND initialization process. + if !SPL_BUILD config NAND_DENALI bool "Support Denali NAND controller" + select SYS_NAND_SELF_INIT help Enable support for the Denali NAND controller.
drivers/mtd/nand/denali.c +84 -37
161 lines not on this page · raw message
drivers/mtd/nand/denali.h +2 -3
@@ -434,9 +434,8 @@ struct nand_buf {#define DT 3struct denali_nand_info { -struct mtd_info mtd; -struct nand_chip *nand; - +struct mtd_info *mtd; +struct nand_chip nand;int flash_bank;/* currently selected chip */ int status;int platform;
Signature · 1 line
1.9.1
PATCH v2 2/2 mtd: denali: set some registers after nand_scan_ident()
In reply to Masahiro YamadaSome but not all of implementations of the Denali NAND controller have hardware circuits to detect the device parameters such as page_size, erase_size, etc. Even on those SoCs with such hardware supported, the hardware is known to detect wrong parameters for some nasty (almost buggy) NAND devices. The device parameters detected during nand_scan_ident() are more trustworthy.
This commit sets some hardware registers to mtd->pagesize, mtd->oobsize, etc. in the code between nand_scan_ident() and nand_scan_tail().
---
Changes in v2: None
drivers/mtd/nand/denali.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/mtd/nand/denali.c +11 -0
@@ -1209,6 +1209,17 @@ static int denali_init(struct denali_nand_info *denali) nand_oob.eccbytes = denali->nand.ecc.bytes; denali->nand.ecc.layout = &nand_oob; +writel (denali->mtd->erasesize / denali->mtd->writesize, + denali->flash_reg +PAGES_PER_BLOCK ); +writel (denali->nand.options &NAND_BUSWIDTH_16 ?1 :0 , + denali->flash_reg +DEVICE_WIDTH ); +writel (denali->mtd->writesize, + denali->flash_reg +DEVICE_MAIN_AREA_SIZE ); +writel (denali->mtd->oobsize, + denali->flash_reg +DEVICE_SPARE_AREA_SIZE ); +if (readl (denali->flash_reg +DEVICES_CONNECTED ) ==0 ) +writel (1 , denali->flash_reg +DEVICES_CONNECTED ); +/* override the default operations */ denali->nand.ecc.read_page = denali_read_page; denali->nand.ecc.read_page_raw = denali_read_page_raw;
Signature · 1 line
1.9.1
v2 cover mtd: denali: Use SELF_INIT to fix up registers after nand_scan_ident()
In reply to Masahiro YamadaScott,
If you have no more comment on this series,
please apply it.
Masahiro
Quoted 21 lines · On Thu, 13 Nov 2014 20:31:49 +0900 Masahiro Yamada <[email protected]>…
This patch series is here because Scott Wood recommended me to use
CONFIG_SYS_NAND_SELF_INITto solve my problem:
http://patchwork.ozlabs.org/patch/402462/Changes in v2:
- Use &nand_info[0] instead ofnand_info
- Print a warning message if initialization failsMasahiro Yamada (2):
mtd: denali: useCONFIG_SYS_NAND_SELF_INIT
mtd: denali: set some registers afternand_scan_ident()drivers/mtd/nand/Kconfig | 7 +++ drivers/mtd/nand/denali.c | 132 +++++++++++++++++++++++++++++++++------------- drivers/mtd/nand/denali.h | 5 +- 3 files changed, 104 insertions(+), 40 deletions(-)Signature · 1 line
1.9.1