mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: [MTD] Cleanup of 'ioremap balanced with iounmap for drivers/mtd subsystem' [MTD] fix nftl_write warning [MTD] fix printk warning [MTD ONENAND] Check OneNAND lock scheme & all block unlock command support [MTD ONENAND] Remove unused MTD_ONENAND_SYNC_READ configuration [MTD ONENAND] Fix OneNAND probe [MTD NAND] Provide prototype for newly-exported nand_wait_ready() [MTD] Remove #ifndef __KERNEL__ hack in <mtd/mtd-abi.h> [MTD NAND] Allow override of page read and write functions. [MTD NAND] Allocate chip->buffers separately to allow it to be overridden [MTD NAND] Split nand_scan() into two parts; allow board driver to intervene [MTD NAND] Export nand_wait_ready() for use by board drivers
This commit is contained in:
commit
3e04767a46
17 changed files with 289 additions and 121 deletions
|
|
@ -27,9 +27,17 @@
|
|||
struct mtd_info;
|
||||
/* Scan and identify a NAND device */
|
||||
extern int nand_scan (struct mtd_info *mtd, int max_chips);
|
||||
/* Separate phases of nand_scan(), allowing board driver to intervene
|
||||
* and override command or ECC setup according to flash type */
|
||||
extern int nand_scan_ident(struct mtd_info *mtd, int max_chips);
|
||||
extern int nand_scan_tail(struct mtd_info *mtd);
|
||||
|
||||
/* Free resources held by the NAND device */
|
||||
extern void nand_release (struct mtd_info *mtd);
|
||||
|
||||
/* Internal helper for board drivers which need to override command function */
|
||||
extern void nand_wait_ready(struct mtd_info *mtd);
|
||||
|
||||
/* The maximum number of NAND chips in an array */
|
||||
#define NAND_MAX_CHIPS 8
|
||||
|
||||
|
|
@ -178,7 +186,9 @@ typedef enum {
|
|||
#define NAND_USE_FLASH_BBT 0x00010000
|
||||
/* This option skips the bbt scan during initialization. */
|
||||
#define NAND_SKIP_BBTSCAN 0x00020000
|
||||
|
||||
/* This option is defined if the board driver allocates its own buffers
|
||||
(e.g. because it needs them DMA-coherent */
|
||||
#define NAND_OWN_BUFFERS 0x00040000
|
||||
/* Options set by nand scan */
|
||||
/* Nand scan has allocated controller struct */
|
||||
#define NAND_CONTROLLER_ALLOC 0x80000000
|
||||
|
|
@ -228,6 +238,8 @@ struct nand_hw_control {
|
|||
* be provided if an hardware ECC is available
|
||||
* @calculate: function for ecc calculation or readback from ecc hardware
|
||||
* @correct: function for ecc correction, matching to ecc generator (sw/hw)
|
||||
* @read_page_raw: function to read a raw page without ECC
|
||||
* @write_page_raw: function to write a raw page without ECC
|
||||
* @read_page: function to read a page according to the ecc generator requirements
|
||||
* @write_page: function to write a page according to the ecc generator requirements
|
||||
* @read_oob: function to read chip OOB data
|
||||
|
|
@ -249,6 +261,12 @@ struct nand_ecc_ctrl {
|
|||
int (*correct)(struct mtd_info *mtd, uint8_t *dat,
|
||||
uint8_t *read_ecc,
|
||||
uint8_t *calc_ecc);
|
||||
int (*read_page_raw)(struct mtd_info *mtd,
|
||||
struct nand_chip *chip,
|
||||
uint8_t *buf);
|
||||
void (*write_page_raw)(struct mtd_info *mtd,
|
||||
struct nand_chip *chip,
|
||||
const uint8_t *buf);
|
||||
int (*read_page)(struct mtd_info *mtd,
|
||||
struct nand_chip *chip,
|
||||
uint8_t *buf);
|
||||
|
|
@ -337,6 +355,7 @@ struct nand_buffers {
|
|||
* @priv: [OPTIONAL] pointer to private chip date
|
||||
* @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
|
||||
* (determine if errors are correctable)
|
||||
* @write_page [REPLACEABLE] High-level page write function
|
||||
*/
|
||||
|
||||
struct nand_chip {
|
||||
|
|
@ -359,6 +378,8 @@ struct nand_chip {
|
|||
void (*erase_cmd)(struct mtd_info *mtd, int page);
|
||||
int (*scan_bbt)(struct mtd_info *mtd);
|
||||
int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
|
||||
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int page, int cached, int raw);
|
||||
|
||||
int chip_delay;
|
||||
unsigned int options;
|
||||
|
|
@ -380,7 +401,7 @@ struct nand_chip {
|
|||
struct nand_ecclayout *ecclayout;
|
||||
|
||||
struct nand_ecc_ctrl ecc;
|
||||
struct nand_buffers buffers;
|
||||
struct nand_buffers *buffers;
|
||||
struct nand_hw_control hwcontrol;
|
||||
|
||||
struct mtd_oob_ops ops;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* linux/include/linux/mtd/onenand.h
|
||||
*
|
||||
* Copyright (C) 2005 Samsung Electronics
|
||||
* Copyright (C) 2005-2006 Samsung Electronics
|
||||
* Kyungmin Park <kyungmin.park@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -96,6 +96,7 @@ struct onenand_chip {
|
|||
void __iomem *base;
|
||||
unsigned int chipsize;
|
||||
unsigned int device_id;
|
||||
unsigned int version_id;
|
||||
unsigned int density_mask;
|
||||
unsigned int options;
|
||||
|
||||
|
|
@ -149,7 +150,8 @@ struct onenand_chip {
|
|||
/*
|
||||
* Options bits
|
||||
*/
|
||||
#define ONENAND_CONT_LOCK (0x0001)
|
||||
#define ONENAND_HAS_CONT_LOCK (0x0001)
|
||||
#define ONENAND_HAS_UNLOCK_ALL (0x0002)
|
||||
#define ONENAND_PAGEBUF_ALLOC (0x1000)
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* OneNAND Register header file
|
||||
*
|
||||
* Copyright (C) 2005 Samsung Electronics
|
||||
* Copyright (C) 2005-2006 Samsung Electronics
|
||||
*
|
||||
* 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
|
||||
|
|
@ -72,6 +72,7 @@
|
|||
#define ONENAND_DEVICE_VCC_MASK (0x3)
|
||||
|
||||
#define ONENAND_DEVICE_DENSITY_512Mb (0x002)
|
||||
#define ONENAND_DEVICE_DENSITY_1Gb (0x003)
|
||||
|
||||
/*
|
||||
* Version ID Register F002h (R)
|
||||
|
|
@ -110,6 +111,7 @@
|
|||
#define ONENAND_CMD_UNLOCK (0x23)
|
||||
#define ONENAND_CMD_LOCK (0x2A)
|
||||
#define ONENAND_CMD_LOCK_TIGHT (0x2C)
|
||||
#define ONENAND_CMD_UNLOCK_ALL (0x27)
|
||||
#define ONENAND_CMD_ERASE (0x94)
|
||||
#define ONENAND_CMD_RESET (0xF0)
|
||||
#define ONENAND_CMD_OTP_ACCESS (0x65)
|
||||
|
|
|
|||
Loading…
Reference in a new issue