diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 17:25:53 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 17:25:53 -0400 |
commit | 7abd3ef9875eb2afcdcd4f450680298a2983a55e (patch) | |
tree | 64c19d2e5ecca182938acfcb8a172efb7d907d85 /include/linux/mtd | |
parent | 3821720d51b5f304d2c33021a82c8da70f6d6ac9 (diff) |
[MTD] Refactor NAND hwcontrol to cmd_ctrl
The hwcontrol function enforced a step by step state machine
for any kind of hardware chip access. Let the hardware driver
know which control bits are set and inform it about a change
of the control lines. Let the hardware driver write out the
command and address bytes directly. This gives a peformance
advantage for address bus controlled chips and simplifies the
quirks in the hardware drivers.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/nand.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 8362b466df3..e9a93526315 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -50,23 +50,20 @@ extern int nand_write_raw(struct mtd_info *mtd, loff_t to, size_t len, | |||
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Constants for hardware specific CLE/ALE/NCE function | 52 | * Constants for hardware specific CLE/ALE/NCE function |
53 | */ | 53 | * |
54 | * These are bits which can be or'ed to set/clear multiple | ||
55 | * bits in one go. | ||
56 | */ | ||
54 | /* Select the chip by setting nCE to low */ | 57 | /* Select the chip by setting nCE to low */ |
55 | #define NAND_CTL_SETNCE 1 | 58 | #define NAND_NCE 0x01 |
56 | /* Deselect the chip by setting nCE to high */ | ||
57 | #define NAND_CTL_CLRNCE 2 | ||
58 | /* Select the command latch by setting CLE to high */ | 59 | /* Select the command latch by setting CLE to high */ |
59 | #define NAND_CTL_SETCLE 3 | 60 | #define NAND_CLE 0x02 |
60 | /* Deselect the command latch by setting CLE to low */ | ||
61 | #define NAND_CTL_CLRCLE 4 | ||
62 | /* Select the address latch by setting ALE to high */ | 61 | /* Select the address latch by setting ALE to high */ |
63 | #define NAND_CTL_SETALE 5 | 62 | #define NAND_ALE 0x04 |
64 | /* Deselect the address latch by setting ALE to low */ | 63 | |
65 | #define NAND_CTL_CLRALE 6 | 64 | #define NAND_CTRL_CLE (NAND_NCE | NAND_CLE) |
66 | /* Set write protection by setting WP to high. Not used! */ | 65 | #define NAND_CTRL_ALE (NAND_NCE | NAND_ALE) |
67 | #define NAND_CTL_SETWP 7 | 66 | #define NAND_CTRL_CHANGE 0x80 |
68 | /* Clear write protection by setting WP to low. Not used! */ | ||
69 | #define NAND_CTL_CLRWP 8 | ||
70 | 67 | ||
71 | /* | 68 | /* |
72 | * Standard NAND flash commands | 69 | * Standard NAND flash commands |
@@ -106,6 +103,8 @@ extern int nand_write_raw(struct mtd_info *mtd, loff_t to, size_t len, | |||
106 | #define NAND_CMD_STATUS_RESET 0x7f | 103 | #define NAND_CMD_STATUS_RESET 0x7f |
107 | #define NAND_CMD_STATUS_CLEAR 0xff | 104 | #define NAND_CMD_STATUS_CLEAR 0xff |
108 | 105 | ||
106 | #define NAND_CMD_NONE -1 | ||
107 | |||
109 | /* Status bits */ | 108 | /* Status bits */ |
110 | #define NAND_STATUS_FAIL 0x01 | 109 | #define NAND_STATUS_FAIL 0x01 |
111 | #define NAND_STATUS_FAIL_N1 0x02 | 110 | #define NAND_STATUS_FAIL_N1 0x02 |
@@ -263,7 +262,8 @@ struct nand_ecc_ctrl { | |||
263 | * @select_chip: [REPLACEABLE] select chip nr | 262 | * @select_chip: [REPLACEABLE] select chip nr |
264 | * @block_bad: [REPLACEABLE] check, if the block is bad | 263 | * @block_bad: [REPLACEABLE] check, if the block is bad |
265 | * @block_markbad: [REPLACEABLE] mark the block bad | 264 | * @block_markbad: [REPLACEABLE] mark the block bad |
266 | * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines | 265 | * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling |
266 | * ALE/CLE/nCE. Also used to write command and address | ||
267 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line | 267 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line |
268 | * If set to NULL no access to ready/busy is available and the ready/busy information | 268 | * If set to NULL no access to ready/busy is available and the ready/busy information |
269 | * is read from the chip status register | 269 | * is read from the chip status register |
@@ -317,7 +317,8 @@ struct nand_chip { | |||
317 | void (*select_chip)(struct mtd_info *mtd, int chip); | 317 | void (*select_chip)(struct mtd_info *mtd, int chip); |
318 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); | 318 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); |
319 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | 319 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); |
320 | void (*hwcontrol)(struct mtd_info *mtd, int cmd); | 320 | void (*cmd_ctrl)(struct mtd_info *mtd, int dat, |
321 | unsigned int ctrl); | ||
321 | int (*dev_ready)(struct mtd_info *mtd); | 322 | int (*dev_ready)(struct mtd_info *mtd); |
322 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); | 323 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); |
323 | int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); | 324 | int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); |