aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-22 19:56:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-22 19:56:22 -0400
commitac1b7c378ef26fba6694d5f118fe7fc16fee2fe2 (patch)
tree3f72979545bb070eb2c3e903cbf31dc4aef3ffc9 /include/linux/mtd
parent9e268beb92ee3a853b3946e84b10358207e2085f (diff)
parentc90173f0907486fe4010c2a8cef534e2473db43f (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (63 commits) mtd: OneNAND: Allow setting of boundary information when built as module jffs2: leaking jffs2_summary in function jffs2_scan_medium mtd: nand: Fix memory leak on txx9ndfmc probe failure. mtd: orion_nand: use burst reads with double word accesses mtd/nand: s3c6400 support for s3c2410 driver [MTD] [NAND] S3C2410: Use DIV_ROUND_UP [MTD] [NAND] S3C2410: Deal with unaligned lengths in S3C2440 buffer read/write [MTD] [NAND] S3C2410: Allow the machine code to get the BBT table from NAND [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set mtd: physmap_of: Add multiple regions and concatenation support mtd: nand: max_retries off by one in mxc_nand mtd: nand: s3c2410_nand_setrate(): use correct macros for 2412/2440 mtd: onenand: add bbt_wait & unlock_all as replaceable for some platform mtd: Flex-OneNAND support mtd: nand: add OMAP2/OMAP3 NAND driver mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs mtd: uclinux: mark local stuff static mtd: uclinux: do not allow to be built as a module mtd: uclinux: allow systems to override map addr/size mtd: blackfin NFC: fix hang when using NAND on BF527-EZKITs ...
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mtd/onenand.h24
-rw-r--r--include/linux/mtd/onenand_regs.h20
-rw-r--r--include/linux/mtd/partitions.h1
4 files changed, 58 insertions, 3 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 7efb9be34662..4030ebada49e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -563,6 +563,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
563 * @options: Option flags, e.g. 16bit buswidth 563 * @options: Option flags, e.g. 16bit buswidth
564 * @ecclayout: ecc layout info structure 564 * @ecclayout: ecc layout info structure
565 * @part_probe_types: NULL-terminated array of probe types 565 * @part_probe_types: NULL-terminated array of probe types
566 * @set_parts: platform specific function to set partitions
566 * @priv: hardware controller specific settings 567 * @priv: hardware controller specific settings
567 */ 568 */
568struct platform_nand_chip { 569struct platform_nand_chip {
@@ -574,26 +575,41 @@ struct platform_nand_chip {
574 int chip_delay; 575 int chip_delay;
575 unsigned int options; 576 unsigned int options;
576 const char **part_probe_types; 577 const char **part_probe_types;
578 void (*set_parts)(uint64_t size,
579 struct platform_nand_chip *chip);
577 void *priv; 580 void *priv;
578}; 581};
579 582
583/* Keep gcc happy */
584struct platform_device;
585
580/** 586/**
581 * struct platform_nand_ctrl - controller level device structure 587 * struct platform_nand_ctrl - controller level device structure
588 * @probe: platform specific function to probe/setup hardware
589 * @remove: platform specific function to remove/teardown hardware
582 * @hwcontrol: platform specific hardware control structure 590 * @hwcontrol: platform specific hardware control structure
583 * @dev_ready: platform specific function to read ready/busy pin 591 * @dev_ready: platform specific function to read ready/busy pin
584 * @select_chip: platform specific chip select function 592 * @select_chip: platform specific chip select function
585 * @cmd_ctrl: platform specific function for controlling 593 * @cmd_ctrl: platform specific function for controlling
586 * ALE/CLE/nCE. Also used to write command and address 594 * ALE/CLE/nCE. Also used to write command and address
595 * @write_buf: platform specific function for write buffer
596 * @read_buf: platform specific function for read buffer
587 * @priv: private data to transport driver specific settings 597 * @priv: private data to transport driver specific settings
588 * 598 *
589 * All fields are optional and depend on the hardware driver requirements 599 * All fields are optional and depend on the hardware driver requirements
590 */ 600 */
591struct platform_nand_ctrl { 601struct platform_nand_ctrl {
602 int (*probe)(struct platform_device *pdev);
603 void (*remove)(struct platform_device *pdev);
592 void (*hwcontrol)(struct mtd_info *mtd, int cmd); 604 void (*hwcontrol)(struct mtd_info *mtd, int cmd);
593 int (*dev_ready)(struct mtd_info *mtd); 605 int (*dev_ready)(struct mtd_info *mtd);
594 void (*select_chip)(struct mtd_info *mtd, int chip); 606 void (*select_chip)(struct mtd_info *mtd, int chip);
595 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, 607 void (*cmd_ctrl)(struct mtd_info *mtd, int dat,
596 unsigned int ctrl); 608 unsigned int ctrl);
609 void (*write_buf)(struct mtd_info *mtd,
610 const uint8_t *buf, int len);
611 void (*read_buf)(struct mtd_info *mtd,
612 uint8_t *buf, int len);
597 void *priv; 613 void *priv;
598}; 614};
599 615
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9aa2a9149b58..8ed873374381 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -17,6 +17,7 @@
17#include <linux/mtd/onenand_regs.h> 17#include <linux/mtd/onenand_regs.h>
18#include <linux/mtd/bbm.h> 18#include <linux/mtd/bbm.h>
19 19
20#define MAX_DIES 2
20#define MAX_BUFFERRAM 2 21#define MAX_BUFFERRAM 2
21 22
22/* Scan and identify a OneNAND device */ 23/* Scan and identify a OneNAND device */
@@ -51,7 +52,12 @@ struct onenand_bufferram {
51/** 52/**
52 * struct onenand_chip - OneNAND Private Flash Chip Data 53 * struct onenand_chip - OneNAND Private Flash Chip Data
53 * @base: [BOARDSPECIFIC] address to access OneNAND 54 * @base: [BOARDSPECIFIC] address to access OneNAND
55 * @dies: [INTERN][FLEX-ONENAND] number of dies on chip
56 * @boundary: [INTERN][FLEX-ONENAND] Boundary of the dies
57 * @diesize: [INTERN][FLEX-ONENAND] Size of the dies
54 * @chipsize: [INTERN] the size of one chip for multichip arrays 58 * @chipsize: [INTERN] the size of one chip for multichip arrays
59 * FIXME For Flex-OneNAND, chipsize holds maximum possible
60 * device size ie when all blocks are considered MLC
55 * @device_id: [INTERN] device ID 61 * @device_id: [INTERN] device ID
56 * @density_mask: chip density, used for DDP devices 62 * @density_mask: chip density, used for DDP devices
57 * @verstion_id: [INTERN] version ID 63 * @verstion_id: [INTERN] version ID
@@ -68,6 +74,8 @@ struct onenand_bufferram {
68 * @command: [REPLACEABLE] hardware specific function for writing 74 * @command: [REPLACEABLE] hardware specific function for writing
69 * commands to the chip 75 * commands to the chip
70 * @wait: [REPLACEABLE] hardware specific function for wait on ready 76 * @wait: [REPLACEABLE] hardware specific function for wait on ready
77 * @bbt_wait: [REPLACEABLE] hardware specific function for bbt wait on ready
78 * @unlock_all: [REPLACEABLE] hardware specific function for unlock all
71 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 79 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
72 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 80 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
73 * @read_word: [REPLACEABLE] hardware specific function for read 81 * @read_word: [REPLACEABLE] hardware specific function for read
@@ -92,9 +100,13 @@ struct onenand_bufferram {
92 */ 100 */
93struct onenand_chip { 101struct onenand_chip {
94 void __iomem *base; 102 void __iomem *base;
103 unsigned dies;
104 unsigned boundary[MAX_DIES];
105 loff_t diesize[MAX_DIES];
95 unsigned int chipsize; 106 unsigned int chipsize;
96 unsigned int device_id; 107 unsigned int device_id;
97 unsigned int version_id; 108 unsigned int version_id;
109 unsigned int technology;
98 unsigned int density_mask; 110 unsigned int density_mask;
99 unsigned int options; 111 unsigned int options;
100 112
@@ -108,6 +120,8 @@ struct onenand_chip {
108 120
109 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); 121 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len);
110 int (*wait)(struct mtd_info *mtd, int state); 122 int (*wait)(struct mtd_info *mtd, int state);
123 int (*bbt_wait)(struct mtd_info *mtd, int state);
124 void (*unlock_all)(struct mtd_info *mtd);
111 int (*read_bufferram)(struct mtd_info *mtd, int area, 125 int (*read_bufferram)(struct mtd_info *mtd, int area,
112 unsigned char *buffer, int offset, size_t count); 126 unsigned char *buffer, int offset, size_t count);
113 int (*write_bufferram)(struct mtd_info *mtd, int area, 127 int (*write_bufferram)(struct mtd_info *mtd, int area,
@@ -145,6 +159,8 @@ struct onenand_chip {
145#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0) 159#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0)
146#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1) 160#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1)
147 161
162#define FLEXONENAND(this) \
163 (this->device_id & DEVICE_IS_FLEXONENAND)
148#define ONENAND_GET_SYS_CFG1(this) \ 164#define ONENAND_GET_SYS_CFG1(this) \
149 (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) 165 (this->read_word(this->base + ONENAND_REG_SYS_CFG1))
150#define ONENAND_SET_SYS_CFG1(v, this) \ 166#define ONENAND_SET_SYS_CFG1(v, this) \
@@ -153,6 +169,9 @@ struct onenand_chip {
153#define ONENAND_IS_DDP(this) \ 169#define ONENAND_IS_DDP(this) \
154 (this->device_id & ONENAND_DEVICE_IS_DDP) 170 (this->device_id & ONENAND_DEVICE_IS_DDP)
155 171
172#define ONENAND_IS_MLC(this) \
173 (this->technology & ONENAND_TECHNOLOGY_IS_MLC)
174
156#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM 175#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM
157#define ONENAND_IS_2PLANE(this) \ 176#define ONENAND_IS_2PLANE(this) \
158 (this->options & ONENAND_HAS_2PLANE) 177 (this->options & ONENAND_HAS_2PLANE)
@@ -169,6 +188,7 @@ struct onenand_chip {
169#define ONENAND_HAS_CONT_LOCK (0x0001) 188#define ONENAND_HAS_CONT_LOCK (0x0001)
170#define ONENAND_HAS_UNLOCK_ALL (0x0002) 189#define ONENAND_HAS_UNLOCK_ALL (0x0002)
171#define ONENAND_HAS_2PLANE (0x0004) 190#define ONENAND_HAS_2PLANE (0x0004)
191#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
172#define ONENAND_PAGEBUF_ALLOC (0x1000) 192#define ONENAND_PAGEBUF_ALLOC (0x1000)
173#define ONENAND_OOBBUF_ALLOC (0x2000) 193#define ONENAND_OOBBUF_ALLOC (0x2000)
174 194
@@ -176,6 +196,7 @@ struct onenand_chip {
176 * OneNAND Flash Manufacturer ID Codes 196 * OneNAND Flash Manufacturer ID Codes
177 */ 197 */
178#define ONENAND_MFR_SAMSUNG 0xec 198#define ONENAND_MFR_SAMSUNG 0xec
199#define ONENAND_MFR_NUMONYX 0x20
179 200
180/** 201/**
181 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure 202 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure
@@ -189,5 +210,8 @@ struct onenand_manufacturers {
189 210
190int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, 211int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
191 struct mtd_oob_ops *ops); 212 struct mtd_oob_ops *ops);
213unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
192 216
193#endif /* __LINUX_MTD_ONENAND_H */ 217#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 0c6bbe28f38c..86a6bbef6465 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -67,6 +67,9 @@
67/* 67/*
68 * Device ID Register F001h (R) 68 * Device ID Register F001h (R)
69 */ 69 */
70#define DEVICE_IS_FLEXONENAND (1 << 9)
71#define FLEXONENAND_PI_MASK (0x3ff)
72#define FLEXONENAND_PI_UNLOCK_SHIFT (14)
70#define ONENAND_DEVICE_DENSITY_MASK (0xf) 73#define ONENAND_DEVICE_DENSITY_MASK (0xf)
71#define ONENAND_DEVICE_DENSITY_SHIFT (4) 74#define ONENAND_DEVICE_DENSITY_SHIFT (4)
72#define ONENAND_DEVICE_IS_DDP (1 << 3) 75#define ONENAND_DEVICE_IS_DDP (1 << 3)
@@ -84,6 +87,11 @@
84#define ONENAND_VERSION_PROCESS_SHIFT (8) 87#define ONENAND_VERSION_PROCESS_SHIFT (8)
85 88
86/* 89/*
90 * Technology Register F006h (R)
91 */
92#define ONENAND_TECHNOLOGY_IS_MLC (1 << 0)
93
94/*
87 * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W) 95 * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W)
88 */ 96 */
89#define ONENAND_DDP_SHIFT (15) 97#define ONENAND_DDP_SHIFT (15)
@@ -93,7 +101,8 @@
93/* 101/*
94 * Start Address 8 F107h (R/W) 102 * Start Address 8 F107h (R/W)
95 */ 103 */
96#define ONENAND_FPA_MASK (0x3f) 104/* Note: It's actually 0x3f in case of SLC */
105#define ONENAND_FPA_MASK (0x7f)
97#define ONENAND_FPA_SHIFT (2) 106#define ONENAND_FPA_SHIFT (2)
98#define ONENAND_FSA_MASK (0x03) 107#define ONENAND_FSA_MASK (0x03)
99 108
@@ -105,7 +114,8 @@
105#define ONENAND_BSA_BOOTRAM (0 << 2) 114#define ONENAND_BSA_BOOTRAM (0 << 2)
106#define ONENAND_BSA_DATARAM0 (2 << 2) 115#define ONENAND_BSA_DATARAM0 (2 << 2)
107#define ONENAND_BSA_DATARAM1 (3 << 2) 116#define ONENAND_BSA_DATARAM1 (3 << 2)
108#define ONENAND_BSC_MASK (0x03) 117/* Note: It's actually 0x03 in case of SLC */
118#define ONENAND_BSC_MASK (0x07)
109 119
110/* 120/*
111 * Command Register F220h (R/W) 121 * Command Register F220h (R/W)
@@ -124,9 +134,13 @@
124#define ONENAND_CMD_RESET (0xF0) 134#define ONENAND_CMD_RESET (0xF0)
125#define ONENAND_CMD_OTP_ACCESS (0x65) 135#define ONENAND_CMD_OTP_ACCESS (0x65)
126#define ONENAND_CMD_READID (0x90) 136#define ONENAND_CMD_READID (0x90)
137#define FLEXONENAND_CMD_PI_UPDATE (0x05)
138#define FLEXONENAND_CMD_PI_ACCESS (0x66)
139#define FLEXONENAND_CMD_RECOVER_LSB (0x05)
127 140
128/* NOTE: Those are not *REAL* commands */ 141/* NOTE: Those are not *REAL* commands */
129#define ONENAND_CMD_BUFFERRAM (0x1978) 142#define ONENAND_CMD_BUFFERRAM (0x1978)
143#define FLEXONENAND_CMD_READ_PI (0x1985)
130 144
131/* 145/*
132 * System Configuration 1 Register F221h (R, R/W) 146 * System Configuration 1 Register F221h (R, R/W)
@@ -192,10 +206,12 @@
192#define ONENAND_ECC_1BIT_ALL (0x5555) 206#define ONENAND_ECC_1BIT_ALL (0x5555)
193#define ONENAND_ECC_2BIT (1 << 1) 207#define ONENAND_ECC_2BIT (1 << 1)
194#define ONENAND_ECC_2BIT_ALL (0xAAAA) 208#define ONENAND_ECC_2BIT_ALL (0xAAAA)
209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
195 210
196/* 211/*
197 * One-Time Programmable (OTP) 212 * One-Time Programmable (OTP)
198 */ 213 */
214#define FLEXONENAND_OTP_LOCK_OFFSET (2048)
199#define ONENAND_OTP_LOCK_OFFSET (14) 215#define ONENAND_OTP_LOCK_OFFSET (14)
200 216
201#endif /* __ONENAND_REG_H */ 217#endif /* __ONENAND_REG_H */
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 7535a74083b9..af6dcb992bc3 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -40,7 +40,6 @@ struct mtd_partition {
40 uint64_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
43 struct mtd_info **mtdp; /* pointer to store the MTD object */
44}; 43};
45 44
46#define MTDPART_OFS_NXTBLK (-2) 45#define MTDPART_OFS_NXTBLK (-2)