Update MTD NAND to Linux-2.6.14
Subsystems (2)
PATCH 1/1 Update MTD NAND to Linux-2.6.14
Generated against testing-NAND branch.
CHANGELOG:
* Update NAND code to be based on what is in Linux-2.6.14 Patch by Ladislav Michl, 3 Nov 2005
include/linux/mtd/nand.h +46 -5
@@ -5,7 +5,7 @@* Steven J. Hill <[email protected]> * Thomas Gleixner <[email protected]> * -* $Id: nand.h,v 1.68 2004/11/12 10:40:37 gleixner Exp $ +* $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -48,12 +48,15 @@* 02-08-2004 tglx added option field to nand structure for chip anomalities * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id * update of nand_chip structure description +* 01-17-2005 dmarlin added extended commands for AG-AND device and added option +* for BBT_AUTO_REFRESH. +* 01-20-2005 dmarlin added optional pointer to hardware specific callback for +* extra error status checks. */ #ifndef __LINUX_MTD_NAND_H#define __LINUX_MTD_NAND_H#include <linux/mtd/compat.h> -#include <linux/mtd/mtd.h> struct mtd_info ;/* Scan and identify a NAND device */
@@ -113,6 +116,25 @@#define NAND_CMD_READSTART 0x30#define NAND_CMD_CACHEDPROG 0x15 +/* Extended commands for AG-AND device */ +/* +* Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but +* there is no way to distinguish that from NAND_CMD_READ0 +* until the remaining sequence of commands has been completed +* so add a high order bit and mask it off in the command. +*/ +#define NAND_CMD_DEPLETE1 0x100 +#define NAND_CMD_DEPLETE2 0x38 +#define NAND_CMD_STATUS_MULTI 0x71 +#define NAND_CMD_STATUS_ERROR 0x72 +/* multi-bank error status (banks 0-3) */ +#define NAND_CMD_STATUS_ERROR0 0x73 +#define NAND_CMD_STATUS_ERROR1 0x74 +#define NAND_CMD_STATUS_ERROR2 0x75 +#define NAND_CMD_STATUS_ERROR3 0x76 +#define NAND_CMD_STATUS_RESET 0x7f +#define NAND_CMD_STATUS_CLEAR 0xff +/* Status bits */ #define NAND_STATUS_FAIL 0x01#define NAND_STATUS_FAIL_N1 0x02
@@ -149,6 +171,10 @@/* Enable Hardware ECC before syndrom is read back from flash */ #define NAND_ECC_READSYN 2 +/* Bit mask for flags passed to do_nand_read_ecc */ +#define NAND_GET_DEVICE 0x80 + +/* Option constants for bizarre disfunctionality and real * features */
@@ -168,6 +194,10 @@/* Chip has a array of 4 pages which can be read without * additional ready /busy waits */ #define NAND_4PAGE_ARRAY 0x00000040 +/* Chip requires that BBT is periodically rewritten to prevent +* bits from adjacent blocks from 'leaking' in altering data. +* This happens with the Renesas AG-AND chips, possibly others. */ +#define BBT_AUTO_REFRESH 0x00000080/* Options valid for Samsung large page devices */ #define NAND_SAMSUNG_LP_OPTIONS \
@@ -190,7 +220,8 @@* This can only work if we have the ecc bytes directly behind the * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ #define NAND_HWECC_SYNDROME 0x00020000 - +/* This option skips the bbt scan during initialization. */ +#define NAND_SKIP_BBTSCAN 0x00040000/* Options set by nand scan */ /* Nand scan has allocated oob_buf */
@@ -215,15 +246,18 @@/* Keep gcc happy */ struct nand_chip ; -#if 0 /** * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices * @lock: protection lock * @active: the mtd device which holds the controller currently +* @wq: wait queue to sleep on if a NAND operation is in progress +* used instead of the per chip wait queue when a hw controller is available */ +#if 0 struct nand_hw_control {spinlock_t lock;struct nand_chip *active; +wait_queue_head_t wq; };#endif
@@ -283,6 +317,8 @@* @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices * @priv: [OPTIONAL] pointer to private chip date +* @errstat: [OPTIONAL] hardware specific function to perform additional error status checks +* (determine if errors are correctable) */ struct nand_chip {
@@ -338,8 +374,9 @@struct nand_bbt_descr *bbt_td;struct nand_bbt_descr *bbt_md;struct nand_bbt_descr *badblock_pattern; -struct nand_hw_control *controller; +/* struct nand_hw_control *controller; */ void *priv; +int (*errstat)(struct mtd_info *mtd,struct nand_chip *this,int state,int status,int page); };/*
@@ -351,6 +388,7 @@#define NAND_MFR_NATIONAL 0x8f#define NAND_MFR_RENESAS 0x07#define NAND_MFR_STMICRO 0x20 +#define NAND_MFR_HYNIX 0xad/** * struct nand_flash_dev - NAND Flash Device ID Structure
@@ -461,6 +499,9 @@extern int nand_default_bbt (struct mtd_info *mtd);extern int nand_isbad_bbt (struct mtd_info *mtd,loff_t offs,int allowbbt);extern int nand_erase_nand (struct mtd_info *mtd,struct erase_info *instr,int allowbbt); +extern int nand_do_read_ecc (struct mtd_info *mtd,loff_t from,size_t len, +size_t * retlen,u_char * buf,u_char * oob_buf, +struct nand_oobinfo *oobsel,int flags);/* * Constants for oob configuration
drivers/nand/diskonchip.c +59 -47
249 lines not on this page · raw message
drivers/nand/nand_base.c +233 -82
674 lines not on this page · raw message
drivers/nand/nand_bbt.c +75 -19
187 lines not on this page · raw message
drivers/nand/nand_ecc.c +5 -1
@@ -39,6 +39,8 @@#if (CONFIG_COMMANDS &CFG_CMD_NAND ) +#include <linux/mtd/nand_ecc.h> +/* * Pre-calculated 256-way 1 byte column parity */
@@ -205,7 +207,8 @@ a ^= (b << bit); dat[add] = a;return 1 ; - }else { + } +else { i =0 ;while (d1) {if (d1 &0x01 )
@@ -241,3 +244,4 @@ }#endif /* CONFIG_COMMANDS & CFG_CMD_NAND */ +
drivers/nand/nand_ids.c +16 -5
@@ -3,13 +3,14 @@* * Copyright (C) 2002 Thomas Gleixner ([email protected]) * -* $Id: nand_ids.c,v 1.10 2004/05/26 13:40:12 gleixner Exp $ +* $Id: nand_ids.c,v 1.14 2005/06/23 09:38:50 gleixner Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ +#include <common.h> #if (CONFIG_COMMANDS &CFG_CMD_NAND )
@@ -60,17 +61,24 @@ {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16}, {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0}, + {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0}, {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0}, {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16}, + {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16}, {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16}, + {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16}, {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0}, - {"NAND 512MiB 3,3V 8-bit", 0xDC, 512, 512, 0x4000, 0}, -/* These are the new chips with large page size. The pagesize * and the erasesize is determined from the extended id bytes */ +/*512 Megabit */ + {"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_NO_AUTOINCR}, + {"NAND 64MiB 3,3V 8-bit", 0xF2, 0, 64, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_NO_AUTOINCR}, + {"NAND 64MiB 1,8V 16-bit", 0xB2, 0, 64, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_BUSWIDTH_16 | NAND_NO_AUTOINCR}, + {"NAND 64MiB 3,3V 16-bit", 0xC2, 0, 64, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_BUSWIDTH_16 | NAND_NO_AUTOINCR}, +/* 1 Gigabit */ {"NAND 128MiB 1,8V 8-bit", 0xA1, 0, 128, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_NO_AUTOINCR}, {"NAND 128MiB 3,3V 8-bit", 0xF1, 0, 128, 0, NAND_SAMSUNG_LP_OPTIONS | NAND_NO_AUTOINCR},
@@ -107,7 +115,7 @@* Anyway JFFS2 would increase the eraseblock size so we chose a combined one which can be erased in one go * There are more speed improvements for reads and writes possible, but not implemented now */ - {"AND 128MiB 3,3V 8-bit", 0x01, 2048, 128, 0x4000, NAND_IS_AND | NAND_NO_AUTOINCR | NAND_4PAGE_ARRAY}, + {"AND 128MiB 3,3V 8-bit", 0x01, 2048, 128, 0x4000, NAND_IS_AND | NAND_NO_AUTOINCR | NAND_4PAGE_ARRAY | BBT_AUTO_REFRESH}, {NULL,} };
@@ -122,6 +130,9 @@ {NAND_MFR_NATIONAL, "National"}, {NAND_MFR_RENESAS, "Renesas"}, {NAND_MFR_STMICRO, "ST Micro"}, + {NAND_MFR_HYNIX, "Hynix"}, {0x0, "Unknown"} }; -#endif + +#endif /* CONFIG_COMMANDS & CFG_CMD_NAND */ +
PATCH 1/1 Update MTD NAND to Linux-2.6.14
Quoted 7 lines · In message <20051103120523.GA3894@orphique> you wrote:
Generated against testing-NAND branch.
Signed-off-by Ladislav Michl <[email protected]>CHANGELOG:
* Update NAND code to be based on what is in Linux-2.6.14 Patch by Ladislav Michl, 3 Nov 2005
Sorry, but this patch needs major cleanup. I get:
nand_base.c: In function 'nand_wait_ready':
nand_base.c:573: warning: implicit declaration of function 'reset_timer_masked' nand_base.c:579: warning: implicit declaration of function 'get_timer_masked'
In file included from nand_ids.c:18:/home/wd/git/u-boot/mailing-list/include/linux/mtd/nand.h:498: warning: 'struct erase_info' declared i nside parameter list/home/wd/git/u-boot/mailing-list/include/linux/mtd/nand.h:498: warning: its scope is only this definit ion or declaration, which is probably not what you want
In file included from cmd_jffs2.c:105:/home/wd/git/u-boot/mailing-list/include/linux/mtd/nand.h:498: warning: 'struct erase_info' declared i nside parameter list/home/wd/git/u-boot/mailing-list/include/linux/mtd/nand.h:498: warning: its scope is only this definit ion or declaration, which is probably not what you want drivers/nand/libnand.a(nand_base.o): In function `nand_wait_ready':
/.automount/castor-vlab/root/home/wd/git/u-boot/mailing-list/drivers/nand/nand_base.c:573: undefined r eference to reset_timer_masked' /.automount/castor-vlab/root/home/wd/git/u-boot/mailing-list/drivers/nand/nand_base.c:579: undefined r eference to get_timer_masked'
make: *** [u-boot] Error 1
Note that "reset_timer_masked" and "get_timer_masked" are functions which are architecture-specific and should NOT be used in common code.
Actually, you should never need to use these in the the first place. They are only needed for broken ports.
Please get rid of these, clean up the other errors, and resubmit.
Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Clothes make the man. Naked people have little or no influence on society. - Mark Twain