#include <linux/wait.h>
#include <linux/spinlock.h>
#include <linux/mtd/mtd.h>
Include dependency graph for nand.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | nand_hw_control |
struct | nand_ecc_ctrl |
struct | nand_buffers |
struct | nand_chip |
struct | nand_flash_dev |
struct | nand_manufacturers |
struct | nand_bbt_descr |
struct | platform_nand_chip |
struct | platform_nand_ctrl |
: Manufacturer name | |
struct nand_manufacturers - NAND Flash Manufacturer ID Structure
: manufacturer ID code of device. | |
#define | NAND_BBT_NRBITS_MSK 0x0000000F |
#define | NAND_BBT_1BIT 0x00000001 |
#define | NAND_BBT_2BIT 0x00000002 |
#define | NAND_BBT_4BIT 0x00000004 |
#define | NAND_BBT_8BIT 0x00000008 |
#define | NAND_BBT_LASTBLOCK 0x00000010 |
#define | NAND_BBT_ABSPAGE 0x00000020 |
#define | NAND_BBT_SEARCH 0x00000040 |
#define | NAND_BBT_PERCHIP 0x00000080 |
#define | NAND_BBT_VERSION 0x00000100 |
#define | NAND_BBT_CREATE 0x00000200 |
#define | NAND_BBT_SCANALLPAGES 0x00000400 |
#define | NAND_BBT_SCANEMPTY 0x00000800 |
#define | NAND_BBT_WRITE 0x00001000 |
#define | NAND_BBT_SAVECONTENT 0x00002000 |
#define | NAND_BBT_SCAN2NDPAGE 0x00004000 |
#define | NAND_BBT_SCAN_MAXBLOCKS 4 |
#define | NAND_SMALL_BADBLOCK_POS 5 |
#define | NAND_LARGE_BADBLOCK_POS 0 |
nand_flash_dev | nand_flash_ids [] |
nand_manufacturers | nand_manuf_ids [] |
int | nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd) |
int | nand_update_bbt (struct mtd_info *mtd, loff_t offs) |
int | nand_default_bbt (struct mtd_info *mtd) |
int | nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt) |
int | nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt) |
int | nand_do_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf) |
static struct platform_nand_chip * | get_platform_nandchip (struct mtd_info *mtd) |
Defines | |
#define | NAND_MAX_CHIPS 8 |
#define | NAND_MAX_OOBSIZE 64 |
#define | NAND_MAX_PAGESIZE 2048 |
#define | NAND_NCE 0x01 |
#define | NAND_CLE 0x02 |
#define | NAND_ALE 0x04 |
#define | NAND_CTRL_CLE (NAND_NCE | NAND_CLE) |
#define | NAND_CTRL_ALE (NAND_NCE | NAND_ALE) |
#define | NAND_CTRL_CHANGE 0x80 |
#define | NAND_CMD_READ0 0 |
#define | NAND_CMD_READ1 1 |
#define | NAND_CMD_RNDOUT 5 |
#define | NAND_CMD_PAGEPROG 0x10 |
#define | NAND_CMD_READOOB 0x50 |
#define | NAND_CMD_ERASE1 0x60 |
#define | NAND_CMD_STATUS 0x70 |
#define | NAND_CMD_STATUS_MULTI 0x71 |
#define | NAND_CMD_SEQIN 0x80 |
#define | NAND_CMD_RNDIN 0x85 |
#define | NAND_CMD_READID 0x90 |
#define | NAND_CMD_ERASE2 0xd0 |
#define | NAND_CMD_RESET 0xff |
#define | NAND_CMD_READSTART 0x30 |
#define | NAND_CMD_RNDOUTSTART 0xE0 |
#define | NAND_CMD_CACHEDPROG 0x15 |
#define | NAND_CMD_DEPLETE1 0x100 |
#define | NAND_CMD_DEPLETE2 0x38 |
#define | NAND_CMD_STATUS_MULTI 0x71 |
#define | NAND_CMD_STATUS_ERROR 0x72 |
#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 |
#define | NAND_CMD_NONE -1 |
#define | NAND_STATUS_FAIL 0x01 |
#define | NAND_STATUS_FAIL_N1 0x02 |
#define | NAND_STATUS_TRUE_READY 0x20 |
#define | NAND_STATUS_READY 0x40 |
#define | NAND_STATUS_WP 0x80 |
#define | NAND_ECC_READ 0 |
#define | NAND_ECC_WRITE 1 |
#define | NAND_ECC_READSYN 2 |
#define | NAND_GET_DEVICE 0x80 |
#define | NAND_NO_AUTOINCR 0x00000001 |
#define | NAND_BUSWIDTH_16 0x00000002 |
#define | NAND_NO_PADDING 0x00000004 |
#define | NAND_CACHEPRG 0x00000008 |
#define | NAND_COPYBACK 0x00000010 |
#define | NAND_IS_AND 0x00000020 |
#define | NAND_4PAGE_ARRAY 0x00000040 |
#define | BBT_AUTO_REFRESH 0x00000080 |
#define | NAND_NO_READRDY 0x00000100 |
#define | NAND_SAMSUNG_LP_OPTIONS (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
#define | NAND_CANAUTOINCR(chip) (!(chip->options & NAND_NO_AUTOINCR)) |
#define | NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) |
#define | NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) |
#define | NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) |
#define | NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) |
#define | NAND_USE_FLASH_BBT 0x00010000 |
#define | NAND_SKIP_BBTSCAN 0x00020000 |
#define | NAND_OWN_BUFFERS 0x00040000 |
#define | NAND_CONTROLLER_ALLOC 0x80000000 |
#define | NAND_MFR_TOSHIBA 0x98 |
#define | NAND_MFR_SAMSUNG 0xec |
#define | NAND_MFR_FUJITSU 0x04 |
#define | NAND_MFR_NATIONAL 0x8f |
#define | NAND_MFR_RENESAS 0x07 |
#define | NAND_MFR_STMICRO 0x20 |
#define | NAND_MFR_HYNIX 0xad |
Enumerations | |
enum | nand_ecc_modes_t { NAND_ECC_NONE, NAND_ECC_SOFT, NAND_ECC_HW, NAND_ECC_HW_SYNDROME } |
enum | nand_state_t { FL_READY, FL_READING, FL_WRITING, FL_ERASING, FL_SYNCING, FL_CACHEDPRG, FL_PM_SUSPENDED, FL_READY, FL_READING, FL_WRITING, FL_ERASING, FL_SYNCING, FL_CACHEDPRG, FL_PM_SUSPENDED } |
Functions | |
int | nand_scan (struct mtd_info *mtd, int max_chips) |
int | nand_scan_ident (struct mtd_info *mtd, int max_chips) |
int | nand_scan_tail (struct mtd_info *mtd) |
void | nand_release (struct mtd_info *mtd) |
void | nand_wait_ready (struct mtd_info *mtd) |
#define BBT_AUTO_REFRESH 0x00000080 |
#define NAND_4PAGE_ARRAY 0x00000040 |
#define NAND_ALE 0x04 |
#define NAND_BBT_ABSPAGE 0x00000020 |
#define NAND_BBT_LASTBLOCK 0x00000010 |
Definition at line 508 of file nand.h.
Referenced by mark_bbt_region(), search_bbt(), and write_bbt().
#define NAND_BBT_NRBITS_MSK 0x0000000F |
#define NAND_BBT_PERCHIP 0x00000080 |
Definition at line 514 of file nand.h.
Referenced by check_create(), mark_bbt_region(), nand_erase_nand(), nand_update_bbt(), read_abs_bbt(), search_bbt(), and write_bbt().
#define NAND_BBT_SCAN2NDPAGE 0x00004000 |
#define NAND_BBT_SCANALLPAGES 0x00000400 |
#define NAND_BBT_SCANEMPTY 0x00000800 |
Definition at line 522 of file nand.h.
Referenced by check_pattern(), create_bbt(), and nand_memory_bbt().
#define NAND_BBT_VERSION 0x00000100 |
#define NAND_BBT_WRITE 0x00001000 |
#define NAND_BUSWIDTH_16 0x00000002 |
Definition at line 148 of file nand.h.
Referenced by nand_block_bad(), nand_command(), nand_command_lp(), nand_get_flash_type(), nand_scan(), and nand_scan_ident().
#define NAND_CACHEPRG 0x00000008 |
#define NAND_CANAUTOINCR | ( | chip | ) | (!(chip->options & NAND_NO_AUTOINCR)) |
Definition at line 175 of file nand.h.
Referenced by nand_do_read_ecc(), nand_do_read_oob(), nand_do_read_ops(), nand_read_oob(), nand_read_raw(), and nand_wait().
#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) |
#define NAND_CLE 0x02 |
#define NAND_CMD_CACHEDPROG 0x15 |
Definition at line 88 of file nand.h.
Referenced by nand_command_lp(), nand_wait(), and nand_write_page().
#define NAND_CMD_DEPLETE1 0x100 |
#define NAND_CMD_ERASE1 0x60 |
Definition at line 76 of file nand.h.
Referenced by multi_erase_cmd(), nand_command(), nand_command_lp(), and single_erase_cmd().
#define NAND_CMD_ERASE2 0xd0 |
Definition at line 82 of file nand.h.
Referenced by multi_erase_cmd(), nand_command(), nand_command_lp(), and single_erase_cmd().
#define NAND_CMD_NONE -1 |
Definition at line 109 of file nand.h.
Referenced by crisv32_hwcontrol(), nand_command(), nand_command_lp(), and nand_select_chip().
#define NAND_CMD_PAGEPROG 0x10 |
Definition at line 74 of file nand.h.
Referenced by nand_command(), nand_command_lp(), nand_wait(), nand_write_oob_std(), and nand_write_page().
#define NAND_CMD_READ0 0 |
Definition at line 71 of file nand.h.
Referenced by nand_command(), nand_command_lp(), nand_do_read_ecc(), nand_do_read_ops(), nand_read_oob_syndrome(), nand_read_raw(), nand_wait(), and nand_write_page().
#define NAND_CMD_READ1 1 |
#define NAND_CMD_READID 0x90 |
Definition at line 81 of file nand.h.
Referenced by nand_get_flash_type(), nand_scan(), and nand_scan_ident().
#define NAND_CMD_READOOB 0x50 |
Definition at line 75 of file nand.h.
Referenced by nand_block_bad(), nand_command(), nand_command_lp(), nand_read_oob(), and nand_read_oob_std().
#define NAND_CMD_READSTART 0x30 |
#define NAND_CMD_RESET 0xff |
Definition at line 83 of file nand.h.
Referenced by nand_command(), nand_command_lp(), nand_do_write_oob(), and nand_wait().
#define NAND_CMD_RNDIN 0x85 |
Definition at line 80 of file nand.h.
Referenced by nand_command_lp(), and nand_write_oob_syndrome().
#define NAND_CMD_RNDOUT 5 |
Definition at line 73 of file nand.h.
Referenced by nand_command_lp(), and nand_read_oob_syndrome().
#define NAND_CMD_RNDOUTSTART 0xE0 |
#define NAND_CMD_SEQIN 0x80 |
Definition at line 79 of file nand.h.
Referenced by nand_command(), nand_command_lp(), nand_wait(), nand_write_oob_std(), nand_write_oob_syndrome(), and nand_write_page().
#define NAND_CMD_STATUS 0x70 |
Definition at line 77 of file nand.h.
Referenced by nand_check_wp(), nand_command(), nand_command_lp(), and nand_wait().
#define NAND_CMD_STATUS_ERROR 0x72 |
#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_MULTI 0x71 |
#define NAND_CTRL_ALE (NAND_NCE | NAND_ALE) |
#define NAND_CTRL_CHANGE 0x80 |
Definition at line 66 of file nand.h.
Referenced by crisv32_hwcontrol(), nand_command(), nand_command_lp(), and nand_select_chip().
#define NAND_CTRL_CLE (NAND_NCE | NAND_CLE) |
#define NAND_ECC_READ 0 |
Definition at line 132 of file nand.h.
Referenced by nand_do_read_ecc(), nand_read_page_hwecc(), and nand_read_page_syndrome().
#define NAND_ECC_READSYN 2 |
Definition at line 136 of file nand.h.
Referenced by nand_do_read_ecc(), and nand_read_page_syndrome().
#define NAND_ECC_WRITE 1 |
Definition at line 134 of file nand.h.
Referenced by nand_wait(), nand_write_page_hwecc(), and nand_write_page_syndrome().
#define NAND_GET_DEVICE 0x80 |
#define NAND_HAS_CACHEPROG | ( | chip | ) | ((chip->options & NAND_CACHEPRG)) |
#define NAND_HAS_COPYBACK | ( | chip | ) | ((chip->options & NAND_COPYBACK)) |
#define NAND_IS_AND 0x00000020 |
#define NAND_LARGE_BADBLOCK_POS 0 |
#define NAND_MAX_CHIPS 8 |
#define NAND_MFR_SAMSUNG 0xec |
#define NAND_MUST_PAD | ( | chip | ) | (!(chip->options & NAND_NO_PADDING)) |
#define NAND_NCE 0x01 |
Definition at line 58 of file nand.h.
Referenced by crisv32_device_ready(), crisv32_hwcontrol(), nand_command(), and nand_command_lp().
#define NAND_NO_AUTOINCR 0x00000001 |
#define NAND_NO_READRDY 0x00000100 |
#define NAND_OWN_BUFFERS 0x00040000 |
#define NAND_SAMSUNG_LP_OPTIONS (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
#define NAND_SMALL_BADBLOCK_POS 5 |
#define NAND_STATUS_FAIL 0x01 |
Definition at line 112 of file nand.h.
Referenced by nand_erase_nand(), nand_wait(), nand_write_oob_std(), and nand_write_page().
#define NAND_STATUS_READY 0x40 |
Definition at line 115 of file nand.h.
Referenced by nand_command(), nand_command_lp(), and nand_wait().
#define NAND_STATUS_WP 0x80 |
#define NAND_USE_FLASH_BBT 0x00010000 |
Definition at line 186 of file nand.h.
Referenced by crisv32_nand_flash_probe(), nand_default_bbt(), nand_default_block_markbad(), and rflflash_init().
enum nand_ecc_modes_t |
enum nand_state_t |
static struct platform_nand_chip* get_platform_nandchip | ( | struct mtd_info * | mtd | ) | [inline, static] |
int nand_default_bbt | ( | struct mtd_info * | mtd | ) |
nand_default_bbt - [NAND Interface] Select a default bad block table for the device : MTD device structure
This function selects the default bad block table support for the device and calls the nand_scan_bbt function
Definition at line 1152 of file nand_bbt.c.
int nand_do_read | ( | struct mtd_info * | mtd, | |
loff_t | from, | |||
size_t | len, | |||
size_t * | retlen, | |||
uint8_t * | buf | |||
) |
int nand_erase_nand | ( | struct mtd_info * | mtd, | |
struct erase_info * | instr, | |||
int | allowbbt | |||
) |
nand_erase_nand - [Internal] erase block(s) : MTD device structure : erase instruction : allow erasing the bbt area
Erase one ore more blocks
Definition at line 1864 of file nand_base.c.
int nand_isbad_bbt | ( | struct mtd_info * | mtd, | |
loff_t | offs, | |||
int | allowbbt | |||
) |
nand_isbad_bbt - [NAND Interface] Check if a block is bad : MTD device structure : offset in the device : allow access to bad block table region
Definition at line 1201 of file nand_bbt.c.
void nand_release | ( | struct mtd_info * | mtd | ) |
nand_release - [NAND Interface] Free resources held by the NAND device : MTD device structure
Definition at line 2561 of file nand_base.c.
int nand_scan | ( | struct mtd_info * | mtd, | |
int | maxchips | |||
) |
nand_scan - [NAND Interface] Scan for the NAND device : MTD device structure : Number of chips to scan for
This fills out all the not initialized function pointers with the defaults. The flash ID is read and the mtd/chip structures are filled with the appropriate values. Buffers are allocated if they are not provided by the board driver
Definition at line 2541 of file nand_base.c.
int nand_scan_bbt | ( | struct mtd_info * | mtd, | |
struct nand_bbt_descr * | bd | |||
) |
nand_scan_bbt - [NAND Interface] scan, find, read and maybe create bad block table(s) : MTD device structure : descriptor for the good/bad block search pattern
The function checks, if a bad block table(s) is/are already available. If not it scans the device for manufacturer marked good / bad blocks and writes the bad block table(s) to the selected place.
The bad block table memory is allocated here. It must be freed by calling the nand_free_bbt function.
Definition at line 955 of file nand_bbt.c.
int nand_scan_ident | ( | struct mtd_info * | mtd, | |
int | maxchips | |||
) |
nand_scan_ident - [NAND Interface] Scan for the NAND device : MTD device structure : Number of chips to scan for
This is the first phase of the normal nand_scan() function. It reads the flash ID and sets up MTD fields accordingly.
The mtd->owner field must be set to the module of the caller.
Definition at line 2300 of file nand_base.c.
References nand_chip::chipsize, nand_chip::cmdfunc, KERN_INFO, KERN_WARNING, NAND_BUSWIDTH_16, NAND_CMD_READID, nand_get_flash_type(), nand_set_defaults(), nand_chip::numchips, nand_chip::options, printk, mtd_info::priv, nand_chip::read_byte, nand_chip::select_chip, mtd_info::size, and type.
Referenced by nand_scan().
int nand_scan_tail | ( | struct mtd_info * | mtd | ) |
nand_scan_tail - [NAND Interface] Scan for the NAND device : MTD device structure : Number of chips to scan for
This is the second phase of the normal nand_scan() function. It fills out all the uninitialized function pointers with the defaults and scans for a bad block table if appropriate.
Definition at line 2350 of file nand_base.c.
References nand_chip::buffers, BUG, nand_ecc_ctrl::bytes, nand_ecc_ctrl::calculate, nand_ecc_ctrl::correct, nand_chip::ecc, GFP_KERNEL, nand_ecc_ctrl::hwctl, KERN_WARNING, kmalloc, nand_ecc_ctrl::layout, memset(), nand_ecc_ctrl::mode, nand_calculate_ecc(), nand_correct_data(), NAND_ECC_HW, NAND_ECC_HW_SYNDROME, NAND_ECC_NONE, NAND_ECC_SOFT, nand_oob_16, nand_oob_64, nand_oob_8, NAND_OWN_BUFFERS, nand_read_oob_std(), nand_read_oob_syndrome(), nand_read_page_hwecc(), nand_read_page_raw(), nand_read_page_swecc(), nand_read_page_syndrome(), nand_write_oob_std(), nand_write_oob_syndrome(), nand_write_page(), nand_write_page_hwecc(), nand_write_page_raw(), nand_write_page_swecc(), nand_write_page_syndrome(), mtd_info::oobsize, nand_buffers::oobwbuf, nand_chip::options, printk, mtd_info::priv, nand_ecc_ctrl::read_oob, nand_ecc_ctrl::read_page, nand_ecc_ctrl::read_page_raw, nand_ecc_ctrl::size, nand_ecc_ctrl::steps, nand_ecc_ctrl::write_oob, nand_ecc_ctrl::write_page, nand_chip::write_page, and nand_ecc_ctrl::write_page_raw.
Referenced by nand_scan().
int nand_update_bbt | ( | struct mtd_info * | mtd, | |
loff_t | offs | |||
) |
nand_update_bbt - [NAND Interface] update bad block table(s) : MTD device structure : the offset of the newly marked block
The function updates the bad block table(s)
Definition at line 1023 of file nand_bbt.c.
void nand_wait_ready | ( | struct mtd_info * | mtd | ) |
Definition at line 421 of file nand_base.c.
References nand_chip::dev_ready, jiffies, LED_OFF, mtd_info::priv, time_before, and touch_softlockup_watchdog.
Referenced by nand_command(), nand_command_lp(), nand_do_read_ecc(), nand_do_read_oob(), nand_do_read_ops(), nand_read_oob(), nand_read_raw(), and nand_wait().
struct nand_flash_dev nand_flash_ids[] |
struct nand_manufacturers nand_manuf_ids[] |