From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Benard Date: Wed, 15 Jul 2009 17:18:40 +0200 Subject: [U-Boot] [PATCH v2 2/3] Fix 2k page size NAND for iMX27 In-Reply-To: <1247671121-5160-1-git-send-email-eric@eukrea.com> References: <1247671121-5160-1-git-send-email-eric@eukrea.com> Message-ID: <1247671121-5160-2-git-send-email-eric@eukrea.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Eric Benard --- drivers/nand/nand_imx.c | 20 +++++++++++++++++--- include/asm-arm/arch-imx/imx-nand.h | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/nand/nand_imx.c b/drivers/nand/nand_imx.c index cbff7ce..ecfb649 100644 --- a/drivers/nand/nand_imx.c +++ b/drivers/nand/nand_imx.c @@ -874,7 +874,7 @@ static void imx_nand_command(struct mtd_info *mtd, unsigned command, if (host->pagesize_2k) { send_addr(host, (page_addr >> 8) & 0xFF); - if (mtd->size >= 0x40000000) { + if (mtd->size >= 0x10000000) { send_addr(host, (page_addr >> 16) & 0xff); } } else { @@ -961,6 +961,15 @@ static void imx_low_erase(struct mtd_info *mtd) * * @return The function always returns 0. */ +static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + +static struct nand_bbt_descr smallpage_memorybased = { + .options = NAND_BBT_SCAN2NDPAGE, + .offs = 5, + .len = 1, + .pattern = scan_ff_pattern +}; + static int __init imxnd_probe(struct device_d *dev) { struct nand_chip *this; @@ -969,7 +978,7 @@ static int __init imxnd_probe(struct device_d *dev) struct imx_nand_host *host; u16 tmp; int err = 0; -#ifdef CONFIG_ARCH_MX27 +#ifdef CONFIG_ARCH_IMX27 PCCR1 |= PCCR1_NFC_BAUDEN; #endif /* Allocate memory for MTD device structure and private data */ @@ -1050,7 +1059,12 @@ static int __init imxnd_probe(struct device_d *dev) this->ecc.layout = &nand_hw_eccoob_16; } - host->pagesize_2k = 0; + if (pdata->is2k) { + host->pagesize_2k = 1; + NFMS |= (1 << NFMS_BIT); + this->badblock_pattern = &smallpage_memorybased; + } else + host->pagesize_2k = 0; /* Scan to find existence of the device */ if (nand_scan(mtd, 1)) { diff --git a/include/asm-arm/arch-imx/imx-nand.h b/include/asm-arm/arch-imx/imx-nand.h index 5ebe0be..500bb1a 100644 --- a/include/asm-arm/arch-imx/imx-nand.h +++ b/include/asm-arm/arch-imx/imx-nand.h @@ -8,6 +8,7 @@ void imx_nand_load_image(void *dest, int size, int pagesize, int blocksize); struct imx_nand_platform_data { int width; int hw_ecc; -}; + int is2k; + }; #endif /* __ASM_ARCH_NAND_H */ -- 1.6.0.4