Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
nand_base.c File Reference
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/nand_bch.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/leds.h>
#include <linux/io.h>
#include <linux/mtd/partitions.h>

Go to the source code of this file.

Macros

#define NOTALIGNED(x)   ((x & (chip->subpagesize - 1)) != 0)
 
#define BBT_PAGE_MASK   0xffffff3f
 
#define caller_is_module()   is_module_text_address((unsigned long)__builtin_return_address(0))
 

Functions

 DEFINE_LED_TRIGGER (nand_led_trigger)
 
void nand_wait_ready (struct mtd_info *mtd)
 
 EXPORT_SYMBOL_GPL (nand_wait_ready)
 
int nand_unlock (struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 EXPORT_SYMBOL (nand_unlock)
 
int nand_lock (struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 EXPORT_SYMBOL (nand_lock)
 
int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt)
 
int nand_scan_ident (struct mtd_info *mtd, int maxchips, struct nand_flash_dev *table)
 
 EXPORT_SYMBOL (nand_scan_ident)
 
int nand_scan_tail (struct mtd_info *mtd)
 
 EXPORT_SYMBOL (nand_scan_tail)
 
int nand_scan (struct mtd_info *mtd, int maxchips)
 
 EXPORT_SYMBOL (nand_scan)
 
void nand_release (struct mtd_info *mtd)
 
 EXPORT_SYMBOL_GPL (nand_release)
 
 module_init (nand_base_init)
 
 module_exit (nand_base_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Steven J. Hill <[email protected]>")
 
 MODULE_AUTHOR ("Thomas Gleixner <[email protected]>")
 
 MODULE_DESCRIPTION ("Generic NAND flash driver code")
 

Macro Definition Documentation

#define BBT_PAGE_MASK   0xffffff3f

Definition at line 2490 of file nand_base.c.

#define caller_is_module ( )    is_module_text_address((unsigned long)__builtin_return_address(0))

Definition at line 3658 of file nand_base.c.

#define NOTALIGNED (   x)    ((x & (chip->subpagesize - 1)) != 0)

Definition at line 2142 of file nand_base.c.

Function Documentation

DEFINE_LED_TRIGGER ( nand_led_trigger  )
EXPORT_SYMBOL ( nand_unlock  )
EXPORT_SYMBOL ( nand_lock  )
EXPORT_SYMBOL ( nand_scan_ident  )
EXPORT_SYMBOL ( nand_scan_tail  )
EXPORT_SYMBOL ( nand_scan  )
EXPORT_SYMBOL_GPL ( nand_wait_ready  )
EXPORT_SYMBOL_GPL ( nand_release  )
MODULE_AUTHOR ( "Steven J. Hill <[email protected]>"  )
MODULE_AUTHOR ( "Thomas Gleixner <[email protected]>"  )
MODULE_DESCRIPTION ( "Generic NAND flash driver code )
module_exit ( nand_base_exit  )
module_init ( nand_base_init  )
MODULE_LICENSE ( "GPL"  )
int nand_erase_nand ( struct mtd_info mtd,
struct erase_info instr,
int  allowbbt 
)

nand_erase_nand - [INTERN] erase block(s) : MTD device structure : erase instruction : allow erasing the bbt area

Erase one ore more blocks.

Definition at line 2499 of file nand_base.c.

int nand_lock ( struct mtd_info mtd,
loff_t  ofs,
uint64_t  len 
)

nand_lock - [REPLACEABLE] locks all blocks present in the device : mtd info : offset to start unlock from : length to unlock

This feature is not supported in many NAND parts. 'Micron' NAND parts do have this feature, but it allows only to lock all blocks, not for specified range for block. Implementing 'lock' feature by making use of 'unlock', for now.

Returns lock status.

Definition at line 972 of file nand_base.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 3693 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 uninitialized function pointers with the defaults. The flash ID is read and the mtd/chip structures are filled with the appropriate values. The mtd->owner field must be set to the module of the caller.

Definition at line 3672 of file nand_base.c.

int nand_scan_ident ( struct mtd_info mtd,
int  maxchips,
struct nand_flash_dev table 
)

nand_scan_ident - [NAND Interface] Scan for the NAND device : MTD device structure : number of chips to scan for : alternative NAND ID table

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 3307 of file nand_base.c.

int nand_scan_tail ( struct mtd_info mtd)

nand_scan_tail - [NAND Interface] Scan for the NAND device : MTD device structure

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 3362 of file nand_base.c.

int nand_unlock ( struct mtd_info mtd,
loff_t  ofs,
uint64_t  len 
)

nand_unlock - [REPLACEABLE] unlocks specified locked blocks : mtd info : offset to start unlock from : length to unlock

Returns unlock status.

Definition at line 919 of file nand_base.c.

void nand_wait_ready ( struct mtd_info mtd)

Definition at line 492 of file nand_base.c.