aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/bbm.h24
-rw-r--r--include/linux/mtd/blktrans.h31
-rw-r--r--include/linux/mtd/cfi.h50
-rw-r--r--include/linux/mtd/cfi_endian.h19
-rw-r--r--include/linux/mtd/compatmac.h10
-rw-r--r--include/linux/mtd/concat.h17
-rw-r--r--include/linux/mtd/doc2000.h23
-rw-r--r--include/linux/mtd/flashchip.h25
-rw-r--r--include/linux/mtd/gen_probe.h19
-rw-r--r--include/linux/mtd/map.h22
-rw-r--r--include/linux/mtd/mtd.h27
-rw-r--r--include/linux/mtd/mtdram.h2
-rw-r--r--include/linux/mtd/nand.h29
-rw-r--r--include/linux/mtd/nand_ecc.h4
-rw-r--r--include/linux/mtd/nftl.h17
-rw-r--r--include/linux/mtd/onenand.h11
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/mtd/sh_flctl.h7
18 files changed, 272 insertions, 66 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c5759d..7fa20beb2ab9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -4,12 +4,26 @@
4 * NAND family Bad Block Management (BBM) header file 4 * NAND family Bad Block Management (BBM) header file
5 * - Bad Block Table (BBT) implementation 5 * - Bad Block Table (BBT) implementation
6 * 6 *
7 * Copyright (c) 2005 Samsung Electronics 7 * Copyright © 2005 Samsung Electronics
8 * Kyungmin Park <kyungmin.park@samsung.com> 8 * Kyungmin Park <kyungmin.park@samsung.com>
9 * 9 *
10 * Copyright (c) 2000-2005 10 * Copyright © 2000-2005
11 * Thomas Gleixner <tglx@linuxtronix.de> 11 * Thomas Gleixner <tglx@linuxtronix.de>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 *
13 */ 27 */
14#ifndef __LINUX_MTD_BBM_H 28#ifndef __LINUX_MTD_BBM_H
15#define __LINUX_MTD_BBM_H 29#define __LINUX_MTD_BBM_H
@@ -82,6 +96,12 @@ struct nand_bbt_descr {
82#define NAND_BBT_SAVECONTENT 0x00002000 96#define NAND_BBT_SAVECONTENT 0x00002000
83/* Search good / bad pattern on the first and the second page */ 97/* Search good / bad pattern on the first and the second page */
84#define NAND_BBT_SCAN2NDPAGE 0x00004000 98#define NAND_BBT_SCAN2NDPAGE 0x00004000
99/* Search good / bad pattern on the last page of the eraseblock */
100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
85 105
86/* The maximum number of blocks to scan for a bbt */ 106/* The maximum number of blocks to scan for a bbt */
87#define NAND_BBT_SCAN_MAXBLOCKS 4 107#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 8b4aa0523db7..26529ebd59cc 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,7 +1,19 @@
1/* 1/*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
3 * 3 *
4 * Interface to Linux block layer for MTD 'translation layers'. 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 17 *
6 */ 18 */
7 19
@@ -9,6 +21,8 @@
9#define __MTD_TRANS_H__ 21#define __MTD_TRANS_H__
10 22
11#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/kref.h>
25#include <linux/sysfs.h>
12 26
13struct hd_geometry; 27struct hd_geometry;
14struct mtd_info; 28struct mtd_info;
@@ -24,11 +38,16 @@ struct mtd_blktrans_dev {
24 int devnum; 38 int devnum;
25 unsigned long size; 39 unsigned long size;
26 int readonly; 40 int readonly;
27 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */ 41 int open;
42 struct kref ref;
43 struct gendisk *disk;
44 struct attribute_group *disk_attributes;
45 struct task_struct *thread;
46 struct request_queue *rq;
47 spinlock_t queue_lock;
48 void *priv;
28}; 49};
29 50
30struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
31
32struct mtd_blktrans_ops { 51struct mtd_blktrans_ops {
33 char *name; 52 char *name;
34 int major; 53 int major;
@@ -60,8 +79,6 @@ struct mtd_blktrans_ops {
60 struct list_head devs; 79 struct list_head devs;
61 struct list_head list; 80 struct list_head list;
62 struct module *owner; 81 struct module *owner;
63
64 struct mtd_blkcore_priv *blkcore_priv;
65}; 82};
66 83
67extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); 84extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index df89f4275232..d2118b0eac9a 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,6 +1,20 @@
1 1/*
2/* Common Flash Interface structures 2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 * See http://support.intel.com/design/flash/technote/index.htm 3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
4 */ 18 */
5 19
6#ifndef __MTD_CFI_H__ 20#ifndef __MTD_CFI_H__
@@ -253,6 +267,7 @@ struct cfi_bri_query {
253#define P_ID_MITSUBISHI_STD 0x0100 267#define P_ID_MITSUBISHI_STD 0x0100
254#define P_ID_MITSUBISHI_EXT 0x0101 268#define P_ID_MITSUBISHI_EXT 0x0101
255#define P_ID_SST_PAGE 0x0102 269#define P_ID_SST_PAGE 0x0102
270#define P_ID_SST_OLD 0x0701
256#define P_ID_INTEL_PERFORMANCE 0x0200 271#define P_ID_INTEL_PERFORMANCE 0x0200
257#define P_ID_INTEL_DATA 0x0210 272#define P_ID_INTEL_DATA 0x0210
258#define P_ID_RESERVED 0xffff 273#define P_ID_RESERVED 0xffff
@@ -297,7 +312,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
297 * and 32bit devices on 16 bit busses 312 * and 32bit devices on 16 bit busses
298 * set the low bit of the alternating bit sequence of the address. 313 * set the low bit of the alternating bit sequence of the address.
299 */ 314 */
300 if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) 315 if (((type * interleave) > bankwidth) && ((cmd_ofs & 0xff) == 0xaa))
301 addr |= (type >> 1)*interleave; 316 addr |= (type >> 1)*interleave;
302 317
303 return addr; 318 return addr;
@@ -515,14 +530,25 @@ struct cfi_fixup {
515 void* param; 530 void* param;
516}; 531};
517 532
518#define CFI_MFR_ANY 0xffff 533#define CFI_MFR_ANY 0xFFFF
519#define CFI_ID_ANY 0xffff 534#define CFI_ID_ANY 0xFFFF
520 535#define CFI_MFR_CONTINUATION 0x007F
521#define CFI_MFR_AMD 0x0001 536
522#define CFI_MFR_INTEL 0x0089 537#define CFI_MFR_AMD 0x0001
523#define CFI_MFR_ATMEL 0x001F 538#define CFI_MFR_ATMEL 0x001F
524#define CFI_MFR_SAMSUNG 0x00EC 539#define CFI_MFR_EON 0x001C
525#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 540#define CFI_MFR_FUJITSU 0x0004
541#define CFI_MFR_HYUNDAI 0x00AD
542#define CFI_MFR_INTEL 0x0089
543#define CFI_MFR_MACRONIX 0x00C2
544#define CFI_MFR_NEC 0x0010
545#define CFI_MFR_PMC 0x009D
546#define CFI_MFR_SAMSUNG 0x00EC
547#define CFI_MFR_SHARP 0x00B0
548#define CFI_MFR_SST 0x00BF
549#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
550#define CFI_MFR_TOSHIBA 0x0098
551#define CFI_MFR_WINBOND 0x00DA
526 552
527void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 553void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
528 554
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index d802f7736be3..51cc3f5917a8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,3 +1,22 @@
1/*
2 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
1#include <asm/byteorder.h> 20#include <asm/byteorder.h>
2 21
3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
deleted file mode 100644
index 7d1300d9bd51..000000000000
--- a/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifndef __LINUX_MTD_COMPATMAC_H__
3#define __LINUX_MTD_COMPATMAC_H__
4
5/* Nothing to see here. We write 2.5-compatible code and this
6 file makes it all OK in older kernels, but it's empty in _current_
7 kernels. Include guard just to make GCC ignore it in future inclusions
8 anyway... */
9
10#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index e80c674daeb3..ccdbe93a909c 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -1,9 +1,22 @@
1/* 1/*
2 * MTD device concatenation layer definitions 2 * MTD device concatenation layer definitions
3 * 3 *
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 19 *
6 * This code is GPL
7 */ 20 */
8 21
9#ifndef MTD_CONCAT_H 22#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0a6d516ab71d..0f6fea73a1f6 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -1,12 +1,25 @@
1/* 1/*
2 * Linux driver for Disk-On-Chip devices 2 * Linux driver for Disk-On-Chip devices
3 * 3 *
4 * Copyright (C) 1999 Machine Vision Holdings, Inc. 4 * Copyright © 1999 Machine Vision Holdings, Inc.
5 * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> 5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright © 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright © 2002-2003 SnapGear Inc
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8 * 22 *
9 * Released under GPL
10 */ 23 */
11 24
12#ifndef __MTD_DOC2000_H__ 25#ifndef __MTD_DOC2000_H__
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index d0bf422ae374..b63fa457febd 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -1,10 +1,21 @@
1
2/* 1/*
3 * struct flchip definition 2 * Copyright © 2000 Red Hat UK Limited
3 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
4 * 14 *
5 * Contains information about the location and state of a given flash device 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 * 18 *
7 * (C) 2000 Red Hat. GPLd.
8 */ 19 */
9 20
10#ifndef __MTD_FLASHCHIP_H__ 21#ifndef __MTD_FLASHCHIP_H__
@@ -15,6 +26,7 @@
15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h 26 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
16 */ 27 */
17#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/mutex.h>
18 30
19typedef enum { 31typedef enum {
20 FL_READY, 32 FL_READY,
@@ -74,8 +86,7 @@ struct flchip {
74 unsigned int erase_suspended:1; 86 unsigned int erase_suspended:1;
75 unsigned long in_progress_block_addr; 87 unsigned long in_progress_block_addr;
76 88
77 spinlock_t *mutex; 89 struct mutex mutex;
78 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip 90 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
80 to be ready */ 91 to be ready */
81 int word_write_time; 92 int word_write_time;
@@ -92,7 +103,7 @@ struct flchip {
92/* This is used to handle contention on write/erase operations 103/* This is used to handle contention on write/erase operations
93 between partitions of the same physical chip. */ 104 between partitions of the same physical chip. */
94struct flchip_shared { 105struct flchip_shared {
95 spinlock_t lock; 106 struct mutex lock;
96 struct flchip *writing; 107 struct flchip *writing;
97 struct flchip *erasing; 108 struct flchip *erasing;
98}; 109};
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index df362ddf2949..2c456054fded 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,6 +1,21 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * Copyright © 2001 Red Hat UK Limited
3 * GPL'd 3 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
4 */ 19 */
5 20
6#ifndef __LINUX_MTD_GEN_PROBE_H__ 21#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b8772217..a9e6ba46865e 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,3 +1,21 @@
1/*
2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
1 19
2/* Overhauled routines for dealing with different mmap regions of flash */ 20/* Overhauled routines for dealing with different mmap regions of flash */
3 21
@@ -7,8 +25,8 @@
7#include <linux/types.h> 25#include <linux/types.h>
8#include <linux/list.h> 26#include <linux/list.h>
9#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/bug.h>
10 29
11#include <linux/mtd/compatmac.h>
12 30
13#include <asm/unaligned.h> 31#include <asm/unaligned.h>
14#include <asm/system.h> 32#include <asm/system.h>
@@ -386,6 +404,8 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
386#endif 404#endif
387 else if (map_bankwidth_is_large(map)) 405 else if (map_bankwidth_is_large(map))
388 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); 406 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
407 else
408 BUG();
389 409
390 return r; 410 return r;
391} 411}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0f32a9b6ff55..8485e42a9b09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,7 +1,20 @@
1/* 1/*
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 * Released under GPL
5 */ 18 */
6 19
7#ifndef __MTD_MTD_H__ 20#ifndef __MTD_MTD_H__
@@ -13,14 +26,12 @@
13#include <linux/notifier.h> 26#include <linux/notifier.h>
14#include <linux/device.h> 27#include <linux/device.h>
15 28
16#include <linux/mtd/compatmac.h>
17#include <mtd/mtd-abi.h> 29#include <mtd/mtd-abi.h>
18 30
19#include <asm/div64.h> 31#include <asm/div64.h>
20 32
21#define MTD_CHAR_MAJOR 90 33#define MTD_CHAR_MAJOR 90
22#define MTD_BLOCK_MAJOR 31 34#define MTD_BLOCK_MAJOR 31
23#define MAX_MTD_DEVICES 32
24 35
25#define MTD_ERASE_PENDING 0x01 36#define MTD_ERASE_PENDING 0x01
26#define MTD_ERASING 0x02 37#define MTD_ERASING 0x02
@@ -61,9 +72,7 @@ struct mtd_erase_region_info {
61 * MTD_OOB_PLACE: oob data are placed at the given offset 72 * MTD_OOB_PLACE: oob data are placed at the given offset
62 * MTD_OOB_AUTO: oob data are automatically placed at the free areas 73 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
63 * which are defined by the ecclayout 74 * which are defined by the ecclayout
64 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data 75 * MTD_OOB_RAW: mode to read oob and data without doing ECC checking
65 * is inserted into the data. Thats a raw image of the
66 * flash contents.
67 */ 76 */
68typedef enum { 77typedef enum {
69 MTD_OOB_PLACE, 78 MTD_OOB_PLACE,
@@ -219,6 +228,7 @@ struct mtd_info {
219 /* Chip-supported device locking */ 228 /* Chip-supported device locking */
220 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 229 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
221 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 230 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
231 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
222 232
223 /* Power Management functions */ 233 /* Power Management functions */
224 int (*suspend) (struct mtd_info *mtd); 234 int (*suspend) (struct mtd_info *mtd);
@@ -290,8 +300,9 @@ extern int add_mtd_device(struct mtd_info *mtd);
290extern int del_mtd_device (struct mtd_info *mtd); 300extern int del_mtd_device (struct mtd_info *mtd);
291 301
292extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); 302extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
303extern int __get_mtd_device(struct mtd_info *mtd);
304extern void __put_mtd_device(struct mtd_info *mtd);
293extern struct mtd_info *get_mtd_device_nm(const char *name); 305extern struct mtd_info *get_mtd_device_nm(const char *name);
294
295extern void put_mtd_device(struct mtd_info *mtd); 306extern void put_mtd_device(struct mtd_info *mtd);
296 307
297 308
diff --git a/include/linux/mtd/mtdram.h b/include/linux/mtd/mtdram.h
index 04fdc07b7353..68891313875d 100644
--- a/include/linux/mtd/mtdram.h
+++ b/include/linux/mtd/mtdram.h
@@ -3,6 +3,6 @@
3 3
4#include <linux/mtd/mtd.h> 4#include <linux/mtd/mtd.h>
5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, 5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
6 unsigned long size, char *name); 6 unsigned long size, char *name);
7 7
8#endif /* __MTD_MTDRAM_H__ */ 8#endif /* __MTD_MTDRAM_H__ */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ccab9dfc5217..102e12c58cb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> 4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -25,11 +25,13 @@
25#include <linux/mtd/bbm.h> 25#include <linux/mtd/bbm.h>
26 26
27struct mtd_info; 27struct mtd_info;
28struct nand_flash_dev;
28/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
29extern int nand_scan (struct mtd_info *mtd, int max_chips); 30extern int nand_scan (struct mtd_info *mtd, int max_chips);
30/* Separate phases of nand_scan(), allowing board driver to intervene 31/* Separate phases of nand_scan(), allowing board driver to intervene
31 * and override command or ECC setup according to flash type */ 32 * and override command or ECC setup according to flash type */
32extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); 33extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
34 struct nand_flash_dev *table);
33extern int nand_scan_tail(struct mtd_info *mtd); 35extern int nand_scan_tail(struct mtd_info *mtd);
34 36
35/* Free resources held by the NAND device */ 37/* Free resources held by the NAND device */
@@ -38,6 +40,12 @@ extern void nand_release (struct mtd_info *mtd);
38/* Internal helper for board drivers which need to override command function */ 40/* Internal helper for board drivers which need to override command function */
39extern void nand_wait_ready(struct mtd_info *mtd); 41extern void nand_wait_ready(struct mtd_info *mtd);
40 42
43/* locks all blockes present in the device */
44extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
45
46/* unlocks specified locked blockes */
47extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
48
41/* The maximum number of NAND chips in an array */ 49/* The maximum number of NAND chips in an array */
42#define NAND_MAX_CHIPS 8 50#define NAND_MAX_CHIPS 8
43 51
@@ -45,7 +53,7 @@ extern void nand_wait_ready(struct mtd_info *mtd);
45 * is supported now. If you add a chip with bigger oobsize/page 53 * is supported now. If you add a chip with bigger oobsize/page
46 * adjust this accordingly. 54 * adjust this accordingly.
47 */ 55 */
48#define NAND_MAX_OOBSIZE 128 56#define NAND_MAX_OOBSIZE 256
49#define NAND_MAX_PAGESIZE 4096 57#define NAND_MAX_PAGESIZE 4096
50 58
51/* 59/*
@@ -82,6 +90,10 @@ extern void nand_wait_ready(struct mtd_info *mtd);
82#define NAND_CMD_ERASE2 0xd0 90#define NAND_CMD_ERASE2 0xd0
83#define NAND_CMD_RESET 0xff 91#define NAND_CMD_RESET 0xff
84 92
93#define NAND_CMD_LOCK 0x2a
94#define NAND_CMD_UNLOCK1 0x23
95#define NAND_CMD_UNLOCK2 0x24
96
85/* Extended commands for large page devices */ 97/* Extended commands for large page devices */
86#define NAND_CMD_READSTART 0x30 98#define NAND_CMD_READSTART 0x30
87#define NAND_CMD_RNDOUTSTART 0xE0 99#define NAND_CMD_RNDOUTSTART 0xE0
@@ -170,6 +182,12 @@ typedef enum {
170/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
171#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
172 184
185/* Device is one of 'new' xD cards that expose fake nand command set */
186#define NAND_BROKEN_XD 0x00000400
187
188/* Device behaves just like nand, but is readonly */
189#define NAND_ROM 0x00000800
190
173/* Options valid for Samsung large page devices */ 191/* Options valid for Samsung large page devices */
174#define NAND_SAMSUNG_LP_OPTIONS \ 192#define NAND_SAMSUNG_LP_OPTIONS \
175 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) 193 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
@@ -391,6 +409,7 @@ struct nand_chip {
391 int subpagesize; 409 int subpagesize;
392 uint8_t cellinfo; 410 uint8_t cellinfo;
393 int badblockpos; 411 int badblockpos;
412 int badblockbits;
394 413
395 flstate_t state; 414 flstate_t state;
396 415
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 41bc013571d0..4d8406c81652 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * drivers/mtd/nand_ecc.h 2 * drivers/mtd/nand_ecc.h
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 * Thomas Gleixner <tglx@linutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index dcaf611ed748..b059629e22bc 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_NFTL_H__ 20#ifndef __MTD_NFTL_H__
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 5509eb06b326..0c8815bfae1c 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -68,6 +68,7 @@ struct onenand_bufferram {
68 * @write_word: [REPLACEABLE] hardware specific function for write 68 * @write_word: [REPLACEABLE] hardware specific function for write
69 * register of OneNAND 69 * register of OneNAND
70 * @mmcontrol: sync burst read function 70 * @mmcontrol: sync burst read function
71 * @chip_probe: [REPLACEABLE] hardware specific function for chip probe
71 * @block_markbad: function to mark a block as bad 72 * @block_markbad: function to mark a block as bad
72 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 73 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
73 * Bad block Table 74 * Bad block Table
@@ -114,6 +115,7 @@ struct onenand_chip {
114 unsigned short (*read_word)(void __iomem *addr); 115 unsigned short (*read_word)(void __iomem *addr);
115 void (*write_word)(unsigned short value, void __iomem *addr); 116 void (*write_word)(unsigned short value, void __iomem *addr);
116 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 117 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
118 int (*chip_probe)(struct mtd_info *mtd);
117 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
118 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
119 121
@@ -125,6 +127,9 @@ struct onenand_chip {
125 flstate_t state; 127 flstate_t state;
126 unsigned char *page_buf; 128 unsigned char *page_buf;
127 unsigned char *oob_buf; 129 unsigned char *oob_buf;
130#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
131 unsigned char *verify_buf;
132#endif
128 133
129 int subpagesize; 134 int subpagesize;
130 struct nand_ecclayout *ecclayout; 135 struct nand_ecclayout *ecclayout;
@@ -175,10 +180,14 @@ struct onenand_chip {
175#define ONENAND_HAS_CONT_LOCK (0x0001) 180#define ONENAND_HAS_CONT_LOCK (0x0001)
176#define ONENAND_HAS_UNLOCK_ALL (0x0002) 181#define ONENAND_HAS_UNLOCK_ALL (0x0002)
177#define ONENAND_HAS_2PLANE (0x0004) 182#define ONENAND_HAS_2PLANE (0x0004)
183#define ONENAND_HAS_4KB_PAGE (0x0008)
178#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 184#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
179#define ONENAND_PAGEBUF_ALLOC (0x1000) 185#define ONENAND_PAGEBUF_ALLOC (0x1000)
180#define ONENAND_OOBBUF_ALLOC (0x2000) 186#define ONENAND_OOBBUF_ALLOC (0x2000)
181 187
188#define ONENAND_IS_4KB_PAGE(this) \
189 (this->options & ONENAND_HAS_4KB_PAGE)
190
182/* 191/*
183 * OneNAND Flash Manufacturer ID Codes 192 * OneNAND Flash Manufacturer ID Codes
184 */ 193 */
@@ -205,6 +214,8 @@ struct mtd_partition;
205 214
206struct onenand_platform_data { 215struct onenand_platform_data {
207 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 216 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
217 int (*read_bufferram)(struct mtd_info *mtd, int area,
218 unsigned char *buffer, int offset, size_t count);
208 struct mtd_partition *parts; 219 struct mtd_partition *parts;
209 unsigned int nr_parts; 220 unsigned int nr_parts;
210}; 221};
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cabf07d3..bcfd9f777454 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base; 27 unsigned int pfow_base;
28 char *probe_type;
28 struct mtd_partition *parts; 29 struct mtd_partition *parts;
29}; 30};
30 31
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index ab77609ec337..9cf4c4c79555 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -93,8 +93,6 @@
93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF 93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
94#define LOOP_TIMEOUT_MAX 0x00010000 94#define LOOP_TIMEOUT_MAX 0x00010000
95 95
96#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd)
97
98struct sh_flctl { 96struct sh_flctl {
99 struct mtd_info mtd; 97 struct mtd_info mtd;
100 struct nand_chip chip; 98 struct nand_chip chip;
@@ -125,4 +123,9 @@ struct sh_flctl_platform_data {
125 unsigned has_hwecc:1; 123 unsigned has_hwecc:1;
126}; 124};
127 125
126static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
127{
128 return container_of(mtdinfo, struct sh_flctl, mtd);
129}
130
128#endif /* __SH_FLCTL_H__ */ 131#endif /* __SH_FLCTL_H__ */