Commit 200d481f authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6

parents f43a64c5 97f927a4
# drivers/mtd/chips/Kconfig # drivers/mtd/chips/Kconfig
# $Id: Kconfig,v 1.13 2004/12/01 15:49:10 nico Exp $ # $Id: Kconfig,v 1.15 2005/06/06 23:04:35 tpoynor Exp $
menu "RAM/ROM/Flash chip drivers" menu "RAM/ROM/Flash chip drivers"
depends on MTD!=n depends on MTD!=n
...@@ -155,6 +155,31 @@ config MTD_CFI_I8 ...@@ -155,6 +155,31 @@ config MTD_CFI_I8
If your flash chips are interleaved in eights - i.e. you have eight If your flash chips are interleaved in eights - i.e. you have eight
flash chips addressed by each bus cycle, then say 'Y'. flash chips addressed by each bus cycle, then say 'Y'.
config MTD_OTP
bool "Protection Registers aka one-time programmable (OTP) bits"
depends on MTD_CFI_ADV_OPTIONS
default n
help
This enables support for reading, writing and locking so called
"Protection Registers" present on some flash chips.
A subset of them are pre-programmed at the factory with a
unique set of values. The rest is user-programmable.
The user-programmable Protection Registers contain one-time
programmable (OTP) bits; when programmed, register bits cannot be
erased. Each Protection Register can be accessed multiple times to
program individual bits, as long as the register remains unlocked.
Each Protection Register has an associated Lock Register bit. When a
Lock Register bit is programmed, the associated Protection Register
can only be read; it can no longer be programmed. Additionally,
because the Lock Register bits themselves are OTP, when programmed,
Lock Register bits cannot be erased. Therefore, when a Protection
Register is locked, it cannot be unlocked.
This feature should therefore be used with extreme care. Any mistake
in the programming of OTP bits will waste them.
config MTD_CFI_INTELEXT config MTD_CFI_INTELEXT
tristate "Support for Intel/Sharp flash chips" tristate "Support for Intel/Sharp flash chips"
depends on MTD_GEN_PROBE depends on MTD_GEN_PROBE
...@@ -275,7 +300,7 @@ config MTD_JEDEC ...@@ -275,7 +300,7 @@ config MTD_JEDEC
config MTD_XIP config MTD_XIP
bool "XIP aware MTD support" bool "XIP aware MTD support"
depends on !SMP && MTD_CFI_INTELEXT && EXPERIMENTAL depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL
default y if XIP_KERNEL default y if XIP_KERNEL
help help
This allows MTD support to work with flash memory which is also This allows MTD support to work with flash memory which is also
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Author: Jonas Holmberg <jonas.holmberg@axis.com> * Author: Jonas Holmberg <jonas.holmberg@axis.com>
* *
* $Id: amd_flash.c,v 1.26 2004/11/20 12:49:04 dwmw2 Exp $ * $Id: amd_flash.c,v 1.27 2005/02/04 07:43:09 jonashg Exp $
* *
* Copyright (c) 2001 Axis Communications AB * Copyright (c) 2001 Axis Communications AB
* *
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#define AM29LV160DT 0x22C4 #define AM29LV160DT 0x22C4
#define AM29LV160DB 0x2249 #define AM29LV160DB 0x2249
#define AM29BDS323D 0x22D1 #define AM29BDS323D 0x22D1
#define AM29BDS643D 0x227E
/* Atmel */ /* Atmel */
#define AT49xV16x 0x00C0 #define AT49xV16x 0x00C0
...@@ -617,17 +616,6 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -617,17 +616,6 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
{ .offset = 0x300000, .erasesize = 0x10000, .numblocks = 15 }, { .offset = 0x300000, .erasesize = 0x10000, .numblocks = 15 },
{ .offset = 0x3f0000, .erasesize = 0x02000, .numblocks = 8 }, { .offset = 0x3f0000, .erasesize = 0x02000, .numblocks = 8 },
} }
}, {
.mfr_id = MANUFACTURER_AMD,
.dev_id = AM29BDS643D,
.name = "AMD AM29BDS643D",
.size = 0x00800000,
.numeraseregions = 3,
.regions = {
{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 96 },
{ .offset = 0x600000, .erasesize = 0x10000, .numblocks = 31 },
{ .offset = 0x7f0000, .erasesize = 0x02000, .numblocks = 8 },
}
}, { }, {
.mfr_id = MANUFACTURER_ATMEL, .mfr_id = MANUFACTURER_ATMEL,
.dev_id = AT49xV16x, .dev_id = AT49xV16x,
......
This diff is collapsed.
This diff is collapsed.
...@@ -58,10 +58,10 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -58,10 +58,10 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,
* to flash memory - that means that we don't have to check status * to flash memory - that means that we don't have to check status
* and timeout. * and timeout.
*/ */
cfi_spin_lock(chip->mutex); spin_lock(chip->mutex);
ret = get_chip(map, chip, adr, FL_LOCKING); ret = get_chip(map, chip, adr, FL_LOCKING);
if (ret) { if (ret) {
cfi_spin_unlock(chip->mutex); spin_unlock(chip->mutex);
return ret; return ret;
} }
...@@ -71,7 +71,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -71,7 +71,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,
/* Done and happy. */ /* Done and happy. */
chip->state = FL_READY; chip->state = FL_READY;
put_chip(map, chip, adr); put_chip(map, chip, adr);
cfi_spin_unlock(chip->mutex); spin_unlock(chip->mutex);
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Routines common to all CFI-type probes. * Routines common to all CFI-type probes.
* (C) 2001-2003 Red Hat, Inc. * (C) 2001-2003 Red Hat, Inc.
* GPL'd * GPL'd
* $Id: gen_probe.c,v 1.21 2004/08/14 15:14:05 dwmw2 Exp $ * $Id: gen_probe.c,v 1.22 2005/01/24 23:49:50 rmk Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -162,7 +162,7 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp, ...@@ -162,7 +162,7 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp,
int max_chips = map_bankwidth(map); /* And minimum 1 */ int max_chips = map_bankwidth(map); /* And minimum 1 */
int nr_chips, type; int nr_chips, type;
for (nr_chips = min_chips; nr_chips <= max_chips; nr_chips <<= 1) { for (nr_chips = max_chips; nr_chips >= min_chips; nr_chips >>= 1) {
if (!cfi_interleave_supported(nr_chips)) if (!cfi_interleave_supported(nr_chips))
continue; continue;
......
/* /*
Common Flash Interface probe code. Common Flash Interface probe code.
(C) 2000 Red Hat. GPL'd. (C) 2000 Red Hat. GPL'd.
$Id: jedec_probe.c,v 1.61 2004/11/19 20:52:16 thayne Exp $ $Id: jedec_probe.c,v 1.63 2005/02/14 16:30:32 bjd Exp $
See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5) See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5)
for the standard this probe goes back to. for the standard this probe goes back to.
...@@ -142,6 +142,7 @@ ...@@ -142,6 +142,7 @@
#define SST29LE512 0x003d #define SST29LE512 0x003d
#define SST39LF800 0x2781 #define SST39LF800 0x2781
#define SST39LF160 0x2782 #define SST39LF160 0x2782
#define SST39VF1601 0x234b
#define SST39LF512 0x00D4 #define SST39LF512 0x00D4
#define SST39LF010 0x00D5 #define SST39LF010 0x00D5
#define SST39LF020 0x00D6 #define SST39LF020 0x00D6
...@@ -1448,6 +1449,21 @@ static const struct amd_flash_info jedec_table[] = { ...@@ -1448,6 +1449,21 @@ static const struct amd_flash_info jedec_table[] = {
ERASEINFO(0x1000,256), ERASEINFO(0x1000,256),
ERASEINFO(0x1000,256) ERASEINFO(0x1000,256)
} }
}, {
.mfr_id = MANUFACTURER_SST, /* should be CFI */
.dev_id = SST39VF1601,
.name = "SST 39VF1601",
.uaddr = {
[0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */
[1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
},
.DevSize = SIZE_2MiB,
.CmdSet = P_ID_AMD_STD,
.NumEraseRegions= 2,
.regions = {
ERASEINFO(0x1000,256),
ERASEINFO(0x1000,256)
}
}, { }, {
.mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */ .mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
...@@ -1856,6 +1872,16 @@ static inline int jedec_match( __u32 base, ...@@ -1856,6 +1872,16 @@ static inline int jedec_match( __u32 base,
case CFI_DEVICETYPE_X8: case CFI_DEVICETYPE_X8:
mfr = (__u8)finfo->mfr_id; mfr = (__u8)finfo->mfr_id;
id = (__u8)finfo->dev_id; id = (__u8)finfo->dev_id;
/* bjd: it seems that if we do this, we can end up
* detecting 16bit flashes as an 8bit device, even though
* there aren't.
*/
if (finfo->dev_id > 0xff) {
DEBUG( MTD_DEBUG_LEVEL3, "%s(): ID is not 8bit\n",
__func__);
goto match_done;
}
break; break;
case CFI_DEVICETYPE_X16: case CFI_DEVICETYPE_X16:
mfr = (__u16)finfo->mfr_id; mfr = (__u16)finfo->mfr_id;
......
/* /*
* $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * $Id: cmdlinepart.c,v 1.18 2005/06/07 15:04:26 joern Exp $
* *
* Read flash partition table from command line * Read flash partition table from command line
* *
...@@ -239,7 +239,8 @@ static int mtdpart_setup_real(char *s) ...@@ -239,7 +239,8 @@ static int mtdpart_setup_real(char *s)
&num_parts, /* out: number of parts */ &num_parts, /* out: number of parts */
0, /* first partition */ 0, /* first partition */
(unsigned char**)&this_mtd, /* out: extra mem */ (unsigned char**)&this_mtd, /* out: extra mem */
mtd_id_len + 1 + sizeof(*this_mtd)); mtd_id_len + 1 + sizeof(*this_mtd) +
sizeof(void*)-1 /*alignment*/);
if(!parts) if(!parts)
{ {
/* /*
...@@ -252,6 +253,9 @@ static int mtdpart_setup_real(char *s) ...@@ -252,6 +253,9 @@ static int mtdpart_setup_real(char *s)
return 0; return 0;
} }
/* align this_mtd */
this_mtd = (struct cmdline_mtd_partition *)
ALIGN((unsigned long)this_mtd, sizeof(void*));
/* enter results */ /* enter results */
this_mtd->parts = parts; this_mtd->parts = parts;
this_mtd->num_parts = num_parts; this_mtd->num_parts = num_parts;
......
/* /*
* $Id: block2mtd.c,v 1.23 2005/01/05 17:05:46 dwmw2 Exp $ * $Id: block2mtd.c,v 1.28 2005/03/19 22:40:44 gleixner Exp $
* *
* block2mtd.c - create an mtd from a block device * block2mtd.c - create an mtd from a block device
* *
* Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk>
* Copyright (C) 2004 Gareth Bult <Gareth@Encryptec.net>
* Copyright (C) 2004,2005 Jrn Engel <joern@wh.fh-wedel.de> * Copyright (C) 2004,2005 Jrn Engel <joern@wh.fh-wedel.de>
* *
* Licence: GPL * Licence: GPL
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#define VERSION "$Revision: 1.23 $" #define VERSION "$Revision: 1.28 $"
#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
...@@ -89,7 +88,6 @@ void cache_readahead(struct address_space *mapping, int index) ...@@ -89,7 +88,6 @@ void cache_readahead(struct address_space *mapping, int index)
static struct page* page_readahead(struct address_space *mapping, int index) static struct page* page_readahead(struct address_space *mapping, int index)
{ {
filler_t *filler = (filler_t*)mapping->a_ops->readpage; filler_t *filler = (filler_t*)mapping->a_ops->readpage;
//do_page_cache_readahead(mapping, index, XXX, 64);
cache_readahead(mapping, index); cache_readahead(mapping, index);
return read_cache_page(mapping, index, filler, NULL); return read_cache_page(mapping, index, filler, NULL);
} }
...@@ -157,7 +155,7 @@ static int block2mtd_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -157,7 +155,7 @@ static int block2mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
struct block2mtd_dev *dev = mtd->priv; struct block2mtd_dev *dev = mtd->priv;
struct page *page; struct page *page;
int index = from >> PAGE_SHIFT; int index = from >> PAGE_SHIFT;
int offset = from & (PAGE_SHIFT-1); int offset = from & (PAGE_SIZE-1);
int cpylen; int cpylen;
if (from > mtd->size) if (from > mtd->size)
...@@ -370,16 +368,16 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base) ...@@ -370,16 +368,16 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base)
} }
static int parse_num32(u32 *num32, const char *token) static int parse_num(size_t *num, const char *token)
{ {
char *endp; char *endp;
unsigned long n; size_t n;
n = ustrtoul(token, &endp, 0); n = (size_t) ustrtoul(token, &endp, 0);
if (*endp) if (*endp)
return -EINVAL; return -EINVAL;
*num32 = n; *num = n;
return 0; return 0;
} }
...@@ -422,7 +420,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp) ...@@ -422,7 +420,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp)
char buf[80+12], *str=buf; /* 80 for device, 12 for erase size */ char buf[80+12], *str=buf; /* 80 for device, 12 for erase size */
char *token[2]; char *token[2];
char *name; char *name;
u32 erase_size = PAGE_SIZE; size_t erase_size = PAGE_SIZE;
int i, ret; int i, ret;
if (strnlen(val, sizeof(buf)) >= sizeof(buf)) if (strnlen(val, sizeof(buf)) >= sizeof(buf))
...@@ -449,7 +447,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp) ...@@ -449,7 +447,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp)
return 0; return 0;
if (token[1]) { if (token[1]) {
ret = parse_num32(&erase_size, token[1]); ret = parse_num(&erase_size, token[1]);
if (ret) if (ret)
parse_err("illegal erase size"); parse_err("illegal erase size");
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
* $Id: ms02-nv.c,v 1.8 2005/01/05 18:05:12 dwmw2 Exp $ * $Id: ms02-nv.c,v 1.10 2005/06/20 12:24:41 macro Exp $
*/ */
#include <linux/init.h> #include <linux/init.h>
...@@ -99,8 +99,8 @@ static inline uint ms02nv_probe_one(ulong addr) ...@@ -99,8 +99,8 @@ static inline uint ms02nv_probe_one(ulong addr)
* The firmware writes MS02NV_ID at MS02NV_MAGIC and also * The firmware writes MS02NV_ID at MS02NV_MAGIC and also
* a diagnostic status at MS02NV_DIAG. * a diagnostic status at MS02NV_DIAG.
*/ */
ms02nv_diagp = (ms02nv_uint *)(KSEG1ADDR(addr + MS02NV_DIAG)); ms02nv_diagp = (ms02nv_uint *)(CKSEG1ADDR(addr + MS02NV_DIAG));
ms02nv_magicp = (ms02nv_uint *)(KSEG1ADDR(addr + MS02NV_MAGIC)); ms02nv_magicp = (ms02nv_uint *)(CKSEG1ADDR(addr + MS02NV_MAGIC));
err = get_dbe(ms02nv_magic, ms02nv_magicp); err = get_dbe(ms02nv_magic, ms02nv_magicp);
if (err) if (err)
return 0; return 0;
...@@ -233,7 +233,7 @@ static int __init ms02nv_init_one(ulong addr) ...@@ -233,7 +233,7 @@ static int __init ms02nv_init_one(ulong addr)
goto err_out_csr_res; goto err_out_csr_res;
} }
printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMiB.\n", printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %zuMiB.\n",
mtd->index, ms02nv_name, addr, size >> 20); mtd->index, ms02nv_name, addr, size >> 20);
mp->next = root_ms02nv_mtd; mp->next = root_ms02nv_mtd;
......
/* /*
* mtdram - a test mtd device * mtdram - a test mtd device
* $Id: mtdram.c,v 1.35 2005/01/05 18:05:12 dwmw2 Exp $ * $Id: mtdram.c,v 1.37 2005/04/21 03:42:11 joern Exp $
* Author: Alexander Larsson <alex@cendio.se> * Author: Alexander Larsson <alex@cendio.se>
* *
* Copyright (c) 1999 Alexander Larsson <alex@cendio.se> * Copyright (c) 1999 Alexander Larsson <alex@cendio.se>
* Copyright (c) 2005 Joern Engel <joern@wh.fh-wedel.de>
* *
* This code is GPL * This code is GPL
* *
...@@ -18,213 +19,140 @@ ...@@ -18,213 +19,140 @@
#include <linux/mtd/compatmac.h> #include <linux/mtd/compatmac.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#ifndef CONFIG_MTDRAM_ABS_POS
#define CONFIG_MTDRAM_ABS_POS 0
#endif
#if CONFIG_MTDRAM_ABS_POS > 0
#include <asm/io.h>
#endif
#ifdef MODULE
static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE; static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE;
static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE; static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE;
module_param(total_size,ulong,0);
MODULE_PARM_DESC(total_size, "Total device size in KiB");
module_param(erase_size,ulong,0);
MODULE_PARM_DESC(erase_size, "Device erase block size in KiB");
#define MTDRAM_TOTAL_SIZE (total_size * 1024) #define MTDRAM_TOTAL_SIZE (total_size * 1024)
#define MTDRAM_ERASE_SIZE (erase_size * 1024) #define MTDRAM_ERASE_SIZE (erase_size * 1024)
#else
#define MTDRAM_TOTAL_SIZE (CONFIG_MTDRAM_TOTAL_SIZE * 1024)
#define MTDRAM_ERASE_SIZE (CONFIG_MTDRAM_ERASE_SIZE * 1024)
#endif
#ifdef MODULE
module_param(total_size, ulong, 0);
MODULE_PARM_DESC(total_size, "Total device size in KiB");
module_param(erase_size, ulong, 0);
MODULE_PARM_DESC(erase_size, "Device erase block size in KiB");
#endif
// We could store these in the mtd structure, but we only support 1 device.. // We could store these in the mtd structure, but we only support 1 device..
static struct mtd_info *mtd_info; static struct mtd_info *mtd_info;
static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
static int
ram_erase(struct mtd_info *mtd, struct erase_info *instr)
{ {
DEBUG(MTD_DEBUG_LEVEL2, "ram_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len); if (instr->addr + instr->len > mtd->size)
if (instr->addr + instr->len > mtd->size) { return -EINVAL;
DEBUG(MTD_DEBUG_LEVEL1, "ram_erase() out of bounds (%ld > %ld)\n", (long)(instr->addr + instr->len), (long)mtd->size);
return -EINVAL; memset((char *)mtd->priv + instr->addr, 0xff, instr->len);
}
instr->state = MTD_ERASE_DONE;
memset((char *)mtd->priv + instr->addr, 0xff, instr->len); mtd_erase_callback(instr);
instr->state = MTD_ERASE_DONE; return 0;
mtd_erase_callback(instr);
return 0;
} }
static int ram_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) static int ram_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
{ {
if (from + len > mtd->size) if (from + len > mtd->size)
return -EINVAL; return -EINVAL;
*mtdbuf = mtd->priv + from; *mtdbuf = mtd->priv + from;
*retlen = len; *retlen = len;
return 0; return 0;
} }
static void ram_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
size_t len) size_t len)
{ {
DEBUG(MTD_DEBUG_LEVEL2, "ram_unpoint\n");
} }
static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, static int ram_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf) size_t *retlen, u_char *buf)
{ {
DEBUG(MTD_DEBUG_LEVEL2, "ram_read(pos:%ld, len:%ld)\n", (long)from, (long)len); if (from + len > mtd->size)
if (from + len > mtd->size) { return -EINVAL;
DEBUG(MTD_DEBUG_LEVEL1, "ram_read() out of bounds (%ld > %ld)\n", (long)(from + len), (long)mtd->size);
return -EINVAL;
}
memcpy(buf, mtd->priv + from, len); memcpy(buf, mtd->priv + from, len);
*retlen=len; *retlen = len;
return 0; return 0;
} }
static int ram_write(struct mtd_info *mtd, loff_t to, size_t len, static int ram_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf) size_t *retlen, const u_char *buf)
{ {
DEBUG(MTD_DEBUG_LEVEL2, "ram_write(pos:%ld, len:%ld)\n", (long)to, (long)len); if (to + len > mtd->size)
if (to + len > mtd->size) { return -EINVAL;
DEBUG(MTD_DEBUG_LEVEL1, "ram_write() out of bounds (%ld > %ld)\n", (long)(to + len), (long)mtd->size);
return -EINVAL;
}
memcpy ((char *)mtd->priv + to, buf, len); memcpy((char *)mtd->priv + to, buf, len);
*retlen=len; *retlen = len;
return 0; return 0;
} }
static void __exit cleanup_mtdram(void) static void __exit cleanup_mtdram(void)
{ {
if (mtd_info) { if (mtd_info) {
del_mtd_device(mtd_info); del_mtd_device(mtd_info);
#if CONFIG_MTDRAM_TOTAL_SIZE > 0 if (mtd_info->priv)
if (mtd_info->priv) vfree(mtd_info->priv);
#if CONFIG_MTDRAM_ABS_POS > 0 kfree(mtd_info);
iounmap(mtd_info->priv); }
#else
vfree(mtd_info->priv);
#endif
#endif
kfree(mtd_info);
}
}
int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
unsigned long size, char *name)
{
memset(mtd, 0, sizeof(*mtd));
/* Setup the MTD structure */
mtd->name = name;
mtd->type = MTD_RAM;
mtd->flags = MTD_CAP_RAM;
mtd->size = size;
mtd->erasesize = MTDRAM_ERASE_SIZE;
mtd->priv = mapped_address;
mtd->owner = THIS_MODULE;
mtd->erase = ram_erase;
mtd->point = ram_point;
mtd->unpoint = ram_unpoint;
mtd->read = ram_read;
mtd->write = ram_write;
if (add_mtd_device(mtd)) {
return -EIO;
}
return 0;
}
#if CONFIG_MTDRAM_TOTAL_SIZE > 0
#if CONFIG_MTDRAM_ABS_POS > 0
static int __init init_mtdram(void)
{
void *addr;
int err;
/* Allocate some memory */
mtd_info = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
if (!mtd_info)
return -ENOMEM;
addr = ioremap(CONFIG_MTDRAM_ABS_POS, MTDRAM_TOTAL_SIZE);
if (!addr) {
DEBUG(MTD_DEBUG_LEVEL1,
"Failed to ioremap) memory region of size %ld at ABS_POS:%ld\n",
(long)MTDRAM_TOTAL_SIZE, (long)CONFIG_MTDRAM_ABS_POS);
kfree(mtd_info);
mtd_info = NULL;
return -ENOMEM;
}
err = mtdram_init_device(mtd_info, addr,
MTDRAM_TOTAL_SIZE, "mtdram test device");
if (err)
{
iounmap(addr);
kfree(mtd_info);
mtd_info = NULL;
return err;
}
memset(mtd_info->priv, 0xff, MTDRAM_TOTAL_SIZE);
return err;
} }
#else /* CONFIG_MTDRAM_ABS_POS > 0 */ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
unsigned long size, char *name)
static int __init init_mtdram(void)
{ {
void *addr; memset(mtd, 0, sizeof(*mtd));
int err;
/* Allocate some memory */ /* Setup the MTD structure */
mtd_info = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); mtd->name = name;
if (!mtd_info) mtd->type = MTD_RAM;
return -ENOMEM; mtd->flags = MTD_CAP_RAM;
mtd->size = size;
addr = vmalloc(MTDRAM_TOTAL_SIZE); mtd->erasesize = MTDRAM_ERASE_SIZE;
if (!addr) { mtd->priv = mapped_address;
DEBUG(MTD_DEBUG_LEVEL1,
"Failed to vmalloc memory region of size %ld\n", mtd->owner = THIS_MODULE;
(long)MTDRAM_TOTAL_SIZE); mtd->erase = ram_erase;
kfree(mtd_info); mtd->point = ram_point;
mtd_info = NULL; mtd->unpoint = ram_unpoint;
return -ENOMEM; mtd->read = ram_read;
} mtd->write = ram_write;
err = mtdram_init_device(mtd_info, addr,
MTDRAM_TOTAL_SIZE, "mtdram test device"); if (add_mtd_device(mtd)) {
if (err) return -EIO;
{ }
vfree(addr);
kfree(mtd_info); return 0;
mtd_info = NULL;
return err;
}
memset(mtd_info->priv, 0xff, MTDRAM_TOTAL_SIZE);
return err;
} }
#endif /* !(CONFIG_MTDRAM_ABS_POS > 0) */
#else /* CONFIG_MTDRAM_TOTAL_SIZE > 0 */
static int __init init_mtdram(void) static int __init init_mtdram(void)
{ {
return 0; void *addr;
int err;
if (!total_size)
return -EINVAL;
/* Allocate some memory */
mtd_info = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
if (!mtd_info)
return -ENOMEM;
addr = vmalloc(MTDRAM_TOTAL_SIZE);
if (!addr) {
kfree(mtd_info);
mtd_info = NULL;
return -ENOMEM;
}
err = mtdram_init_device(mtd_info, addr, MTDRAM_TOTAL_SIZE, "mtdram test device");
if (err) {
vfree(addr);
kfree(mtd_info);
mtd_info = NULL;
return err;
}
memset(mtd_info->priv, 0xff, MTDRAM_TOTAL_SIZE);
return err;
} }
#endif /* !(CONFIG_MTDRAM_TOTAL_SIZE > 0) */
module_init(init_mtdram); module_init(init_mtdram);
module_exit(cleanup_mtdram); module_exit(cleanup_mtdram);
...@@ -232,4 +160,3 @@ module_exit(cleanup_mtdram); ...@@ -232,4 +160,3 @@ module_exit(cleanup_mtdram);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alexander Larsson <alexl@redhat.com>"); MODULE_AUTHOR("Alexander Larsson <alexl@redhat.com>");
MODULE_DESCRIPTION("Simulated MTD driver for testing"); MODULE_DESCRIPTION("Simulated MTD driver for testing");
/** /**
* $Id: phram.c,v 1.11 2005/01/05 18:05:13 dwmw2 Exp $ * $Id: phram.c,v 1.14 2005/03/07 21:43:38 joern Exp $
* *
* Copyright (c) ???? Jochen Schuble <psionic@psionic.de> * Copyright (c) ???? Jochen Schuble <psionic@psionic.de>
* Copyright (c) 2003-2004 Jrn Engel <joern@wh.fh-wedel.de> * Copyright (c) 2003-2004 Jrn Engel <joern@wh.fh-wedel.de>
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
* *
* Example: * Example:
* phram=swap,64Mi,128Mi phram=test,900Mi,1Mi * phram=swap,64Mi,128Mi phram=test,900Mi,1Mi
*
*/ */
#include <asm/io.h> #include <asm/io.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -36,7 +34,6 @@ struct phram_mtd_list { ...@@ -36,7 +34,6 @@ struct phram_mtd_list {
static LIST_HEAD(phram_list); static LIST_HEAD(phram_list);
static int phram_erase(struct mtd_info *mtd, struct erase_info *instr) static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
{ {
u_char *start = mtd->priv; u_char *start = mtd->priv;
...@@ -71,7 +68,8 @@ static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -71,7 +68,8 @@ static int phram_point(struct mtd_info *mtd, loff_t from, size_t len,
return 0; return 0;
} }
static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from,
size_t len)
{ {
} }
...@@ -80,8 +78,11 @@ static int phram_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -80,8 +78,11 @@ static int phram_read(struct mtd_info *mtd, loff_t from, size_t len,
{ {
u_char *start = mtd->priv; u_char *start = mtd->priv;
if (from + len > mtd->size) if (from >= mtd->size)
return -EINVAL; return -EINVAL;
if (len > mtd->size - from)
len = mtd->size - from;
memcpy(buf, start + from, len); memcpy(buf, start + from, len);
...@@ -94,8 +95,11 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -94,8 +95,11 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len,
{ {
u_char *start = mtd->priv; u_char *start = mtd->priv;
if (to + len > mtd->size) if (to >= mtd->size)
return -EINVAL; return -EINVAL;
if (len > mtd->size - to)
len = mtd->size - to;
memcpy(start + to, buf, len); memcpy(start + to, buf, len);
...@@ -107,9 +111,9 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -107,9 +111,9 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len,
static void unregister_devices(void) static void unregister_devices(void)
{ {
struct phram_mtd_list *this; struct phram_mtd_list *this, *safe;
list_for_each_entry(this, &phram_list, list) { list_for_each_entry_safe(this, safe, &phram_list, list) {
del_mtd_device(&this->mtd); del_mtd_device(&this->mtd);
iounmap(this->mtd.priv); iounmap(this->mtd.priv);
kfree(this); kfree(this);
...@@ -145,7 +149,7 @@ static int register_device(char *name, unsigned long start, unsigned long len) ...@@ -145,7 +149,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
new->mtd.write = phram_write; new->mtd.write = phram_write;
new->mtd.owner = THIS_MODULE; new->mtd.owner = THIS_MODULE;
new->mtd.type = MTD_RAM; new->mtd.type = MTD_RAM;
new->mtd.erasesize = 0; new->mtd.erasesize = PAGE_SIZE;
ret = -EAGAIN; ret = -EAGAIN;
if (add_mtd_device(&new->mtd)) { if (add_mtd_device(&new->mtd)) {
...@@ -214,6 +218,15 @@ static int parse_name(char **pname, const char *token) ...@@ -214,6 +218,15 @@ static int parse_name(char **pname, const char *token)
return 0; return 0;
} }
static inline void kill_final_newline(char *str)
{
char *newline = strrchr(str, '\n');
if (newline && !newline[1])
*newline = 0;
}
#define parse_err(fmt, args...) do { \ #define parse_err(fmt, args...) do { \
ERROR(fmt , ## args); \ ERROR(fmt , ## args); \
return 0; \ return 0; \
...@@ -232,6 +245,7 @@ static int phram_setup(const char *val, struct kernel_param *kp) ...@@ -232,6 +245,7 @@ static int phram_setup(const char *val, struct kernel_param *kp)
parse_err("parameter too long\n"); parse_err("parameter too long\n");
strcpy(str, val); strcpy(str, val);
kill_final_newline(str);
for (i=0; i<3; i++) for (i=0; i<3; i++)
token[i] = strsep(&str, ","); token[i] = strsep(&str, ",");
......
/*====================================================================== /*======================================================================
$Id: slram.c,v 1.33 2005/01/05 18:05:13 dwmw2 Exp $ $Id: slram.c,v 1.34 2005/01/06 21:16:42 jwboyer Exp $
This driver provides a method to access memory not used by the kernel This driver provides a method to access memory not used by the kernel
itself (i.e. if the kernel commandline mem=xxx is used). To actually itself (i.e. if the kernel commandline mem=xxx is used). To actually
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#define SLRAM_MAX_DEVICES_PARAMS 6 /* 3 parameters / device */ #define SLRAM_MAX_DEVICES_PARAMS 6 /* 3 parameters / device */
#define SLRAM_BLK_SZ 0x4000
#define T(fmt, args...) printk(KERN_DEBUG fmt, ## args) #define T(fmt, args...) printk(KERN_DEBUG fmt, ## args)
#define E(fmt, args...) printk(KERN_NOTICE fmt, ## args) #define E(fmt, args...) printk(KERN_NOTICE fmt, ## args)
...@@ -108,6 +109,9 @@ static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -108,6 +109,9 @@ static int slram_point(struct mtd_info *mtd, loff_t from, size_t len,
{ {
slram_priv_t *priv = mtd->priv; slram_priv_t *priv = mtd->priv;
if (from + len > mtd->size)
return -EINVAL;
*mtdbuf = priv->start + from; *mtdbuf = priv->start + from;
*retlen = len; *retlen = len;
return(0); return(0);
...@@ -121,7 +125,13 @@ static int slram_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -121,7 +125,13 @@ static int slram_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf) size_t *retlen, u_char *buf)
{ {
slram_priv_t *priv = mtd->priv; slram_priv_t *priv = mtd->priv;
if (from > mtd->size)
return -EINVAL;
if (from + len > mtd->size)
len = mtd->size - from;
memcpy(buf, priv->start + from, len); memcpy(buf, priv->start + from, len);
*retlen = len; *retlen = len;
...@@ -133,6 +143,9 @@ static int slram_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -133,6 +143,9 @@ static int slram_write(struct mtd_info *mtd, loff_t to, size_t len,
{ {
slram_priv_t *priv = mtd->priv; slram_priv_t *priv = mtd->priv;
if (to + len > mtd->size)
return -EINVAL;
memcpy(priv->start + to, buf, len); memcpy(priv->start + to, buf, len);
*retlen = len; *retlen = len;
...@@ -188,7 +201,7 @@ static int register_device(char *name, unsigned long start, unsigned long length ...@@ -188,7 +201,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
(*curmtd)->mtdinfo->name = name; (*curmtd)->mtdinfo->name = name;
(*curmtd)->mtdinfo->size = length; (*curmtd)->mtdinfo->size = length;
(*curmtd)->mtdinfo->flags = MTD_CLEAR_BITS | MTD_SET_BITS | (*curmtd)->mtdinfo->flags = MTD_CLEAR_BITS | MTD_SET_BITS |
MTD_WRITEB_WRITEABLE | MTD_VOLATILE; MTD_WRITEB_WRITEABLE | MTD_VOLATILE | MTD_CAP_RAM;
(*curmtd)->mtdinfo->erase = slram_erase; (*curmtd)->mtdinfo->erase = slram_erase;
(*curmtd)->mtdinfo->point = slram_point; (*curmtd)->mtdinfo->point = slram_point;
(*curmtd)->mtdinfo->unpoint = slram_unpoint; (*curmtd)->mtdinfo->unpoint = slram_unpoint;
...@@ -196,7 +209,7 @@ static int register_device(char *name, unsigned long start, unsigned long length ...@@ -196,7 +209,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
(*curmtd)->mtdinfo->write = slram_write; (*curmtd)->mtdinfo->write = slram_write;
(*curmtd)->mtdinfo->owner = THIS_MODULE; (*curmtd)->mtdinfo->owner = THIS_MODULE;
(*curmtd)->mtdinfo->type = MTD_RAM; (*curmtd)->mtdinfo->type = MTD_RAM;
(*curmtd)->mtdinfo->erasesize = 0x0; (*curmtd)->mtdinfo->erasesize = SLRAM_BLK_SZ;
if (add_mtd_device((*curmtd)->mtdinfo)) { if (add_mtd_device((*curmtd)->mtdinfo)) {
E("slram: Failed to register new device\n"); E("slram: Failed to register new device\n");
...@@ -261,7 +274,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) ...@@ -261,7 +274,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
} }
T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n",
devname, devstart, devlength); devname, devstart, devlength);
if ((devstart < 0) || (devlength < 0)) { if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) {
E("slram: Illegal start / length parameter.\n"); E("slram: Illegal start / length parameter.\n");
return(-EINVAL); return(-EINVAL);
} }
......
/* This version ported to the Linux-MTD system by dwmw2@infradead.org /* This version ported to the Linux-MTD system by dwmw2@infradead.org
* $Id: ftl.c,v 1.54 2004/11/16 18:33:15 dwmw2 Exp $ * $Id: ftl.c,v 1.55 2005/01/17 13:47:21 hvr Exp $
* *
* Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups
...@@ -357,6 +357,7 @@ static int erase_xfer(partition_t *part, ...@@ -357,6 +357,7 @@ static int erase_xfer(partition_t *part,
if (!erase) if (!erase)
return -ENOMEM; return -ENOMEM;
erase->mtd = part->mbd.mtd;
erase->callback = ftl_erase_callback; erase->callback = ftl_erase_callback;
erase->addr = xfer->Offset; erase->addr = xfer->Offset;
erase->len = 1 << part->header.EraseUnitSize; erase->len = 1 << part->header.EraseUnitSize;
...@@ -1096,7 +1097,7 @@ struct mtd_blktrans_ops ftl_tr = { ...@@ -1096,7 +1097,7 @@ struct mtd_blktrans_ops ftl_tr = {
int init_ftl(void) int init_ftl(void)
{ {
DEBUG(0, "$Id: ftl.c,v 1.54 2004/11/16 18:33:15 dwmw2 Exp $\n"); DEBUG(0, "$Id: ftl.c,v 1.55 2005/01/17 13:47:21 hvr Exp $\n");
return register_mtd_blktrans(&ftl_tr); return register_mtd_blktrans(&ftl_tr);
} }
......
# drivers/mtd/maps/Kconfig # drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.42 2005/01/05 16:59:50 dwmw2 Exp $ # $Id: Kconfig,v 1.55 2005/07/02 01:53:24 tpoynor Exp $
menu "Mapping drivers for chip access" menu "Mapping drivers for chip access"
depends on MTD!=n depends on MTD!=n
...@@ -122,16 +122,6 @@ config MTD_SBC_GXX ...@@ -122,16 +122,6 @@ config MTD_SBC_GXX
More info at More info at
<http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>. <http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>.
config MTD_ELAN_104NC
tristate "CFI Flash device mapped on Arcom ELAN-104NC"
depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS
help
This provides a driver for the on-board flash of the Arcom Control
System's ELAN-104NC development board. By default the flash
is split into 3 partitions which are accessed as separate MTD
devices. This board utilizes Intel StrataFlash. More info at
<http://www.arcomcontrols.com/products/icp/pc104/processors/ELAN104NC.htm>.
config MTD_LUBBOCK config MTD_LUBBOCK
tristate "CFI Flash device mapped on Intel Lubbock XScale eval board" tristate "CFI Flash device mapped on Intel Lubbock XScale eval board"
depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS
...@@ -139,6 +129,14 @@ config MTD_LUBBOCK ...@@ -139,6 +129,14 @@ config MTD_LUBBOCK
This provides a driver for the on-board flash of the Intel This provides a driver for the on-board flash of the Intel
'Lubbock' XScale evaluation board. 'Lubbock' XScale evaluation board.
config MTD_MAINSTONE
tristate "CFI Flash device mapped on Intel Mainstone XScale eval board"
depends on MACH_MAINSTONE && MTD_CFI_INTELEXT
select MTD_PARTITIONS
help
This provides a driver for the on-board flash of the Intel
'Mainstone PXA27x evaluation board.
config MTD_OCTAGON config MTD_OCTAGON
tristate "JEDEC Flash device mapped on Octagon 5066 SBC" tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
...@@ -213,74 +211,11 @@ config MTD_NETtel ...@@ -213,74 +211,11 @@ config MTD_NETtel
help help
Support for flash chips on NETtel/SecureEdge/SnapGear boards. Support for flash chips on NETtel/SecureEdge/SnapGear boards.
config MTD_PB1XXX config MTD_ALCHEMY
tristate "Flash devices on Alchemy PB1xxx boards" tristate ' AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support'
depends on MIPS && ( MIPS_PB1000 || MIPS_PB1100 || MIPS_PB1500 ) depends on MIPS && SOC_AU1X00
help
Flash memory access on Alchemy Pb1000/Pb1100/Pb1500 boards
config MTD_PB1XXX_BOOT
bool "PB1x00 boot flash device"
depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
help
Use the first of the two 32MiB flash banks on Pb1100/Pb1500 board.
You can say 'Y' to both this and 'MTD_PB1XXX_USER' below, to use
both banks.
config MTD_PB1XXX_USER
bool "PB1x00 user flash device"
depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
default y if MTD_PB1XX_BOOT = n
help
Use the second of the two 32MiB flash banks on Pb1100/Pb1500 board.
You can say 'Y' to both this and 'MTD_PB1XXX_BOOT' above, to use
both banks.
config MTD_PB1550
tristate "Flash devices on Alchemy PB1550 board"
depends on MIPS && MIPS_PB1550
help
Flash memory access on Alchemy Pb1550 board
config MTD_PB1550_BOOT
bool "PB1550 boot flash device"
depends on MTD_PB1550
help help
Use the first of the two 64MiB flash banks on Pb1550 board. Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
You can say 'Y' to both this and 'MTD_PB1550_USER' below, to use
both banks.
config MTD_PB1550_USER
bool "PB1550 user flash device"
depends on MTD_PB1550
default y if MTD_PB1550_BOOT = n
help
Use the second of the two 64MiB flash banks on Pb1550 board.
You can say 'Y' to both this and 'MTD_PB1550_BOOT' above, to use
both banks.
config MTD_DB1550
tristate "Flash devices on Alchemy DB1550 board"
depends on MIPS && MIPS_DB1550
help
Flash memory access on Alchemy Db1550 board
config MTD_DB1550_BOOT
bool "DB1550 boot flash device"
depends on MTD_DB1550
help
Use the first of the two 64MiB flash banks on Db1550 board.
You can say 'Y' to both this and 'MTD_DB1550_USER' below, to use
both banks.
config MTD_DB1550_USER
bool "DB1550 user flash device"
depends on MTD_DB1550
default y if MTD_DB1550_BOOT = n
help
Use the second of the two 64MiB flash banks on Db1550 board.
You can say 'Y' to both this and 'MTD_DB1550_BOOT' above, to use
both banks.
config MTD_DILNETPC config MTD_DILNETPC
tristate "CFI Flash device mapped on DIL/Net PC" tristate "CFI Flash device mapped on DIL/Net PC"
...@@ -588,6 +523,15 @@ config MTD_MPC1211 ...@@ -588,6 +523,15 @@ config MTD_MPC1211
This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02).
If you have such a board, say 'Y'. If you have such a board, say 'Y'.
config MTD_OMAP_NOR
tristate "TI OMAP board mappings"
depends on MTD_CFI && ARCH_OMAP
help
This enables access to the NOR flash chips on TI OMAP-based
boards defining flash platform devices and flash platform data.
These boards include the Innovator, H2, H3, OSK, Perseus2, and
more. If you have such a board, say 'Y'.
# This needs CFI or JEDEC, depending on the cards found. # This needs CFI or JEDEC, depending on the cards found.
config MTD_PCI config MTD_PCI
tristate "PCI MTD driver" tristate "PCI MTD driver"
...@@ -647,13 +591,14 @@ config MTD_DMV182 ...@@ -647,13 +591,14 @@ config MTD_DMV182
Map driver for Dy-4 SVME/DMV-182 board. Map driver for Dy-4 SVME/DMV-182 board.
config MTD_BAST config MTD_BAST
tristate "Map driver for Simtec BAST (EB2410ITX)" tristate "Map driver for Simtec BAST (EB2410ITX) or Thorcom VR1000"
depends on ARCH_BAST depends on ARCH_BAST || MACH_VR1000
select MTD_PARTITIONS select MTD_PARTITIONS
select MTD_MAP_BANK_WIDTH_16 select MTD_MAP_BANK_WIDTH_16
select MTD_JEDECPROBE select MTD_JEDECPROBE
help help
Map driver for NOR flash on the Simtec BAST (EB2410ITX). Map driver for NOR flash on the Simtec BAST (EB2410ITX), or the
Thorcom VR1000
Note, this driver *cannot* over-ride the WP link on the Note, this driver *cannot* over-ride the WP link on the
board, or currently detect the state of the link. board, or currently detect the state of the link.
...@@ -669,5 +614,15 @@ config MTD_SHARP_SL ...@@ -669,5 +614,15 @@ config MTD_SHARP_SL
help help
This enables access to the flash chip on the Sharp SL Series of PDAs. This enables access to the flash chip on the Sharp SL Series of PDAs.
config MTD_PLATRAM
tristate "Map driver for platform device RAM (mtd-ram)"
depends on MTD
select MTD_RAM
help
Map driver for RAM areas described via the platform device
system.
This selection automatically selects the map_ram driver.
endmenu endmenu
# #
# linux/drivers/maps/Makefile # linux/drivers/maps/Makefile
# #
# $Id: Makefile.common,v 1.23 2005/01/05 17:06:36 dwmw2 Exp $ # $Id: Makefile.common,v 1.30 2005/07/02 01:53:24 tpoynor Exp $
ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y) ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
obj-$(CONFIG_MTD) += map_funcs.o obj-$(CONFIG_MTD) += map_funcs.o
...@@ -15,7 +15,6 @@ obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o ...@@ -15,7 +15,6 @@ obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o
obj-$(CONFIG_MTD_CSTM_MIPS_IXX) += cstm_mips_ixx.o obj-$(CONFIG_MTD_CSTM_MIPS_IXX) += cstm_mips_ixx.o
obj-$(CONFIG_MTD_DC21285) += dc21285.o obj-$(CONFIG_MTD_DC21285) += dc21285.o
obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o
obj-$(CONFIG_MTD_ELAN_104NC) += elan-104nc.o
obj-$(CONFIG_MTD_EPXA10DB) += epxa10db-flash.o obj-$(CONFIG_MTD_EPXA10DB) += epxa10db-flash.o
obj-$(CONFIG_MTD_IQ80310) += iq80310.o obj-$(CONFIG_MTD_IQ80310) += iq80310.o
obj-$(CONFIG_MTD_L440GX) += l440gx.o obj-$(CONFIG_MTD_L440GX) += l440gx.o
...@@ -23,6 +22,7 @@ obj-$(CONFIG_MTD_AMD76XROM) += amd76xrom.o ...@@ -23,6 +22,7 @@ obj-$(CONFIG_MTD_AMD76XROM) += amd76xrom.o
obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o
obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o
obj-$(CONFIG_MTD_MAINSTONE) += mainstone-flash.o
obj-$(CONFIG_MTD_MBX860) += mbx860.o obj-$(CONFIG_MTD_MBX860) += mbx860.o
obj-$(CONFIG_MTD_CEIVA) += ceiva.o obj-$(CONFIG_MTD_CEIVA) += ceiva.o
obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
...@@ -44,10 +44,7 @@ obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o ...@@ -44,10 +44,7 @@ obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o
obj-$(CONFIG_MTD_OCELOT) += ocelot.o obj-$(CONFIG_MTD_OCELOT) += ocelot.o
obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
obj-$(CONFIG_MTD_PCI) += pci.o obj-$(CONFIG_MTD_PCI) += pci.o
obj-$(CONFIG_MTD_PB1XXX) += pb1xxx-flash.o obj-$(CONFIG_MTD_ALCHEMY) += alchemy-flash.o
obj-$(CONFIG_MTD_DB1X00) += db1x00-flash.o
obj-$(CONFIG_MTD_PB1550) += pb1550-flash.o
obj-$(CONFIG_MTD_DB1550) += db1550-flash.o
obj-$(CONFIG_MTD_LASAT) += lasat.o obj-$(CONFIG_MTD_LASAT) += lasat.o
obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
obj-$(CONFIG_MTD_EDB7312) += edb7312.o obj-$(CONFIG_MTD_EDB7312) += edb7312.o
...@@ -71,3 +68,5 @@ obj-$(CONFIG_MTD_IXP2000) += ixp2000.o ...@@ -71,3 +68,5 @@ obj-$(CONFIG_MTD_IXP2000) += ixp2000.o
obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o
obj-$(CONFIG_MTD_DMV182) += dmv182.o obj-$(CONFIG_MTD_DMV182) += dmv182.o
obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
/*
* Flash memory access on AMD Alchemy evaluation boards
*
* $Id: alchemy-flash.c,v 1.1 2005/02/27 21:50:21 ppopov Exp $
*
* (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
#ifdef CONFIG_MIPS_PB1000
#define BOARD_MAP_NAME "Pb1000 Flash"
#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_PB1500
#define BOARD_MAP_NAME "Pb1500 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_PB1100
#define BOARD_MAP_NAME "Pb1100 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_PB1550
#define BOARD_MAP_NAME "Pb1550 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_PB1200
#define BOARD_MAP_NAME "Pb1200 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif
#ifdef CONFIG_MIPS_DB1000
#define BOARD_MAP_NAME "Db1000 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_DB1500
#define BOARD_MAP_NAME "Db1500 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_DB1100
#define BOARD_MAP_NAME "Db1100 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_DB1550
#define BOARD_MAP_NAME "Db1550 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#ifdef CONFIG_MIPS_DB1200
#define BOARD_MAP_NAME "Db1200 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif
#ifdef CONFIG_MIPS_HYDROGEN3
#define BOARD_MAP_NAME "Hydrogen3 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#define USE_LOCAL_ACCESSORS /* why? */
#endif
#ifdef CONFIG_MIPS_BOSPORUS
#define BOARD_MAP_NAME "Bosporus Flash"
#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif
#ifdef CONFIG_MIPS_MIRAGE
#define BOARD_MAP_NAME "Mirage Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#define USE_LOCAL_ACCESSORS /* why? */
#endif
static struct map_info alchemy_map = {
.name = BOARD_MAP_NAME,
};
static struct mtd_partition alchemy_partitions[] = {
{
.name = "User FS",
.size = BOARD_FLASH_SIZE - 0x00400000,
.offset = 0x0000000
},{
.name = "YAMON",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000 - 0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_info *mymtd;
int __init alchemy_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
unsigned long window_addr;
unsigned long window_size;
/* Default flash buswidth */
alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
window_addr = 0x20000000 - BOARD_FLASH_SIZE;
window_size = BOARD_FLASH_SIZE;
#ifdef CONFIG_MIPS_MIRAGE_WHY
/* Boot ROM flash bank only; no user bank */
window_addr = 0x1C000000;
window_size = 0x04000000;
/* USERFS from 0x1C00 0000 to 0x1FC00000 */
alchemy_partitions[0].size = 0x03C00000;
#endif
/*
* Static partition definition selection
*/
parts = alchemy_partitions;
nb_parts = NB_OF(alchemy_partitions);
alchemy_map.size = window_size;
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
alchemy_map.bankwidth*8);
alchemy_map.virt = ioremap(window_addr, window_size);
mymtd = do_map_probe("cfi_probe", &alchemy_map);
if (!mymtd) {
iounmap(alchemy_map.virt);
return -ENXIO;
}
mymtd->owner = THIS_MODULE;
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}
static void __exit alchemy_mtd_cleanup(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
iounmap(alchemy_map.virt);
}
}
module_init(alchemy_mtd_init);
module_exit(alchemy_mtd_cleanup);
MODULE_AUTHOR("Embedded Alley Solutions, Inc");
MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
MODULE_LICENSE("GPL");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* amd76xrom.c * amd76xrom.c
* *
* Normal mappings of chips in physical memory * Normal mappings of chips in physical memory
* $Id: amd76xrom.c,v 1.19 2004/11/28 09:40:39 dwmw2 Exp $ * $Id: amd76xrom.c,v 1.20 2005/03/18 14:04:35 gleixner Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
...@@ -314,7 +314,7 @@ static int __init init_amd76xrom(void) ...@@ -314,7 +314,7 @@ static int __init init_amd76xrom(void)
} }
return -ENXIO; return -ENXIO;
#if 0 #if 0
return pci_module_init(&amd76xrom_driver); return pci_register_driver(&amd76xrom_driver);
#endif #endif
} }
......
/* linux/drivers/mtd/maps/bast_flash.c /* linux/drivers/mtd/maps/bast_flash.c
* *
* Copyright (c) 2004 Simtec Electronics * Copyright (c) 2004-2005 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk> * Ben Dooks <ben@simtec.co.uk>
* *
* Simtec Bast (EB2410ITX) NOR MTD Mapping driver * Simtec Bast (EB2410ITX) NOR MTD Mapping driver
* *
* Changelog: * Changelog:
* 20-Sep-2004 BJD Initial version * 20-Sep-2004 BJD Initial version
* 17-Jan-2005 BJD Add whole device if no partitions found
* *
* $Id: bast-flash.c,v 1.1 2004/09/21 14:29:04 bjd Exp $ * $Id: bast-flash.c,v 1.2 2005/01/18 11:13:47 bjd Exp $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -46,9 +47,9 @@ ...@@ -46,9 +47,9 @@
#include <asm/arch/bast-cpld.h> #include <asm/arch/bast-cpld.h>
#ifdef CONFIG_MTD_BAST_MAXSIZE #ifdef CONFIG_MTD_BAST_MAXSIZE
#define AREA_MAXSIZE (CONFIG_MTD_BAST_MAXSIZE * (1024*1024)) #define AREA_MAXSIZE (CONFIG_MTD_BAST_MAXSIZE * SZ_1M)
#else #else
#define AREA_MAXSIZE (32*1024*1024) #define AREA_MAXSIZE (32 * SZ_1M)
#endif #endif
#define PFX "bast-flash: " #define PFX "bast-flash: "
...@@ -189,6 +190,8 @@ static int bast_flash_probe(struct device *dev) ...@@ -189,6 +190,8 @@ static int bast_flash_probe(struct device *dev)
err = add_mtd_partitions(info->mtd, info->partitions, err); err = add_mtd_partitions(info->mtd, info->partitions, err);
if (err) if (err)
printk(KERN_ERR PFX "cannot add/parse partitions\n"); printk(KERN_ERR PFX "cannot add/parse partitions\n");
} else {
err = add_mtd_device(info->mtd);
} }
if (err == 0) if (err == 0)
......
/*
* Flash memory access on Alchemy Db1550 board
*
* $Id: db1550-flash.c,v 1.7 2004/11/04 13:24:14 gleixner Exp $
*
* (C) 2004 Embedded Edge, LLC, based on db1550-flash.c:
* (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
static unsigned long window_addr;
static unsigned long window_size;
static struct map_info db1550_map = {
.name = "Db1550 flash",
};
static unsigned char flash_bankwidth = 4;
/*
* Support only 64MB NOR Flash parts
*/
#if defined(CONFIG_MTD_DB1550_BOOT) && defined(CONFIG_MTD_DB1550_USER)
#define DB1550_BOTH_BANKS
#elif defined(CONFIG_MTD_DB1550_BOOT) && !defined(CONFIG_MTD_DB1550_USER)
#define DB1550_BOOT_ONLY
#elif !defined(CONFIG_MTD_DB1550_BOOT) && defined(CONFIG_MTD_DB1550_USER)
#define DB1550_USER_ONLY
#endif
#ifdef DB1550_BOTH_BANKS
/* both banks will be used. Combine the first bank and the first
* part of the second bank together into a single jffs/jffs2
* partition.
*/
static struct mtd_partition db1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash
* 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash
*/
{
.name = "User FS",
.size = (0x1FC00000 - 0x18000000),
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000 - 0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1550_BOOT_ONLY)
static struct mtd_partition db1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash
*/
{
.name = "User FS",
.size = 0x03c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1550_USER_ONLY)
static struct mtd_partition db1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash
*/
{
.name = "User FS",
.size = (0x4000000 - 0x200000), /* reserve 2MB for raw kernel */
.offset = 0x0000000
},{
.name = "raw kernel",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
}
};
#else
#error MTD_DB1550 define combo error /* should never happen */
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_info *mymtd;
/*
* Probe the flash density and setup window address and size
* based on user CONFIG options. There are times when we don't
* want the MTD driver to be probing the boot or user flash,
* so having the option to enable only one bank is important.
*/
int setup_flash_params(void)
{
#if defined(DB1550_BOTH_BANKS)
window_addr = 0x18000000;
window_size = 0x8000000;
#elif defined(DB1550_BOOT_ONLY)
window_addr = 0x1C000000;
window_size = 0x4000000;
#else /* USER ONLY */
window_addr = 0x18000000;
window_size = 0x4000000;
#endif
return 0;
}
int __init db1550_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
/* Default flash bankwidth */
db1550_map.bankwidth = flash_bankwidth;
if (setup_flash_params())
return -ENXIO;
/*
* Static partition definition selection
*/
parts = db1550_partitions;
nb_parts = NB_OF(db1550_partitions);
db1550_map.size = window_size;
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE "Db1550 flash: probing %d-bit flash bus\n",
db1550_map.bankwidth*8);
db1550_map.virt = ioremap(window_addr, window_size);
mymtd = do_map_probe("cfi_probe", &db1550_map);
if (!mymtd) return -ENXIO;
mymtd->owner = THIS_MODULE;
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}
static void __exit db1550_mtd_cleanup(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
iounmap((void *) db1550_map.virt);
}
}
module_init(db1550_mtd_init);
module_exit(db1550_mtd_cleanup);
MODULE_AUTHOR("Embedded Edge, LLC");
MODULE_DESCRIPTION("Db1550 mtd map driver");
MODULE_LICENSE("GPL");
/*
* Flash memory access on Alchemy Db1xxx boards
*
* $Id: db1x00-flash.c,v 1.6 2004/11/04 13:24:14 gleixner Exp $
*
* (C) 2003 Pete Popov <ppopov@embeddedalley.com>
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
/* MTD CONFIG OPTIONS */
#if defined(CONFIG_MTD_DB1X00_BOOT) && defined(CONFIG_MTD_DB1X00_USER)
#define DB1X00_BOTH_BANKS
#elif defined(CONFIG_MTD_DB1X00_BOOT) && !defined(CONFIG_MTD_DB1X00_USER)
#define DB1X00_BOOT_ONLY
#elif !defined(CONFIG_MTD_DB1X00_BOOT) && defined(CONFIG_MTD_DB1X00_USER)
#define DB1X00_USER_ONLY
#endif
static unsigned long window_addr;
static unsigned long window_size;
static unsigned long flash_size;
static unsigned short *bcsr = (unsigned short *)0xAE000000;
static unsigned char flash_bankwidth = 4;
/*
* The Db1x boards support different flash densities. We setup
* the mtd_partition structures below for default of 64Mbit
* flash densities, and override the partitions sizes, if
* necessary, after we check the board status register.
*/
#ifdef DB1X00_BOTH_BANKS
/* both banks will be used. Combine the first bank and the first
* part of the second bank together into a single jffs/jffs2
* partition.
*/
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x1c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1X00_BOOT_ONLY)
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x00c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(DB1X00_USER_ONLY)
static struct mtd_partition db1x00_partitions[] = {
{
.name = "User FS",
.size = 0x0e00000,
.offset = 0x0000000
},{
.name = "raw kernel",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
}
};
#else
#error MTD_DB1X00 define combo error /* should never happen */
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
#define NAME "Db1x00 Linux Flash"
static struct map_info db1xxx_mtd_map = {
.name = NAME,
};
static struct mtd_partition *parsed_parts;
static struct mtd_info *db1xxx_mtd;
/*
* Probe the flash density and setup window address and size
* based on user CONFIG options. There are times when we don't
* want the MTD driver to be probing the boot or user flash,
* so having the option to enable only one bank is important.
*/
int setup_flash_params(void)
{
switch ((bcsr[2] >> 14) & 0x3) {
case 0: /* 64Mbit devices */
flash_size = 0x800000; /* 8MB per part */
#if defined(DB1X00_BOTH_BANKS)
window_addr = 0x1E000000;
window_size = 0x2000000;
#elif defined(DB1X00_BOOT_ONLY)
window_addr = 0x1F000000;
window_size = 0x1000000;
#else /* USER ONLY */
window_addr = 0x1E000000;
window_size = 0x1000000;
#endif
break;
case 1:
/* 128 Mbit devices */
flash_size = 0x1000000; /* 16MB per part */
#if defined(DB1X00_BOTH_BANKS)
window_addr = 0x1C000000;
window_size = 0x4000000;
/* USERFS from 0x1C00 0000 to 0x1FC0 0000 */
db1x00_partitions[0].size = 0x3C00000;
#elif defined(DB1X00_BOOT_ONLY)
window_addr = 0x1E000000;
window_size = 0x2000000;
/* USERFS from 0x1E00 0000 to 0x1FC0 0000 */
db1x00_partitions[0].size = 0x1C00000;
#else /* USER ONLY */
window_addr = 0x1C000000;
window_size = 0x2000000;
/* USERFS from 0x1C00 0000 to 0x1DE00000 */
db1x00_partitions[0].size = 0x1DE0000;
#endif
break;
case 2:
/* 256 Mbit devices */
flash_size = 0x4000000; /* 64MB per part */
#if defined(DB1X00_BOTH_BANKS)
return 1;
#elif defined(DB1X00_BOOT_ONLY)
/* Boot ROM flash bank only; no user bank */
window_addr = 0x1C000000;
window_size = 0x4000000;
/* USERFS from 0x1C00 0000 to 0x1FC00000 */
db1x00_partitions[0].size = 0x3C00000;
#else /* USER ONLY */
return 1;
#endif
break;
default:
return 1;
}
db1xxx_mtd_map.size = window_size;
db1xxx_mtd_map.bankwidth = flash_bankwidth;
db1xxx_mtd_map.phys = window_addr;
db1xxx_mtd_map.bankwidth = flash_bankwidth;
return 0;
}
int __init db1x00_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
if (setup_flash_params())
return -ENXIO;
/*
* Static partition definition selection
*/
parts = db1x00_partitions;
nb_parts = NB_OF(db1x00_partitions);
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE "Db1xxx flash: probing %d-bit flash bus\n",
db1xxx_mtd_map.bankwidth*8);
db1xxx_mtd_map.virt = ioremap(window_addr, window_size);
db1xxx_mtd = do_map_probe("cfi_probe", &db1xxx_mtd_map);
if (!db1xxx_mtd) return -ENXIO;
db1xxx_mtd->owner = THIS_MODULE;
add_mtd_partitions(db1xxx_mtd, parts, nb_parts);
return 0;
}
static void __exit db1x00_mtd_cleanup(void)
{
if (db1xxx_mtd) {
del_mtd_partitions(db1xxx_mtd);
map_destroy(db1xxx_mtd);
if (parsed_parts)
kfree(parsed_parts);
}
}
module_init(db1x00_mtd_init);
module_exit(db1x00_mtd_cleanup);
MODULE_AUTHOR("Pete Popov");
MODULE_DESCRIPTION("Db1x00 mtd map driver");
MODULE_LICENSE("GPL");
/* elan-104nc.c -- MTD map driver for Arcom Control Systems ELAN-104NC
Copyright (C) 2000 Arcom Control System Ltd
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
$Id: elan-104nc.c,v 1.25 2004/11/28 09:40:39 dwmw2 Exp $
The ELAN-104NC has up to 8 Mibyte of Intel StrataFlash (28F320/28F640) in x16
mode. This drivers uses the CFI probe and Intel Extended Command Set drivers.
The flash is accessed as follows:
32 kbyte memory window at 0xb0000-0xb7fff
16 bit I/O port (0x22) for some sort of paging.
The single flash device is divided into 3 partition which appear as separate
MTD devices.
Linux thinks that the I/O port is used by the PIC and hence check_region() will
always fail. So we don't do it. I just hope it doesn't break anything.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <asm/io.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#define WINDOW_START 0xb0000
/* Number of bits in offset. */
#define WINDOW_SHIFT 15
#define WINDOW_LENGTH (1 << WINDOW_SHIFT)
/* The bits for the offset into the window. */
#define WINDOW_MASK (WINDOW_LENGTH-1)
#define PAGE_IO 0x22
#define PAGE_IO_SIZE 2
static volatile int page_in_window = -1; // Current page in window.
static void __iomem *iomapadr;
static DEFINE_SPINLOCK(elan_104nc_spin);
/* partition_info gives details on the logical partitions that the split the
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
{ .name = "ELAN-104NC flash boot partition",
.offset = 0,
.size = 640*1024 },
{ .name = "ELAN-104NC flash partition 1",
.offset = 640*1024,
.size = 896*1024 },
{ .name = "ELAN-104NC flash partition 2",
.offset = (640+896)*1024 }
};
#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
/*
* If no idea what is going on here. This is taken from the FlashFX stuff.
*/
#define ROMCS 1
static inline void elan_104nc_setup(void)
{
u16 t;
outw( 0x0023 + ROMCS*2, PAGE_IO );
t=inb( PAGE_IO+1 );
t=(t & 0xf9) | 0x04;
outw( ((0x0023 + ROMCS*2) | (t << 8)), PAGE_IO );
}
static inline void elan_104nc_page(struct map_info *map, unsigned long ofs)
{
unsigned long page = ofs >> WINDOW_SHIFT;
if( page!=page_in_window ) {
int cmd1;
int cmd2;
cmd1=(page & 0x700) + 0x0833 + ROMCS*0x4000;
cmd2=((page & 0xff) << 8) + 0x0032;
outw( cmd1, PAGE_IO );
outw( cmd2, PAGE_IO );
page_in_window = page;
}
}
static map_word elan_104nc_read16(struct map_info *map, unsigned long ofs)
{
map_word ret;
spin_lock(&elan_104nc_spin);
elan_104nc_page(map, ofs);
ret.x[0] = readw(iomapadr + (ofs & WINDOW_MASK));
spin_unlock(&elan_104nc_spin);
return ret;
}
static void elan_104nc_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
while (len) {
unsigned long thislen = len;
if (len > (WINDOW_LENGTH - (from & WINDOW_MASK)))
thislen = WINDOW_LENGTH-(from & WINDOW_MASK);
spin_lock(&elan_104nc_spin);
elan_104nc_page(map, from);
memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen);
spin_unlock(&elan_104nc_spin);
to += thislen;
from += thislen;
len -= thislen;
}
}
static void elan_104nc_write16(struct map_info *map, map_word d, unsigned long adr)
{
spin_lock(&elan_104nc_spin);
elan_104nc_page(map, adr);
writew(d.x[0], iomapadr + (adr & WINDOW_MASK));
spin_unlock(&elan_104nc_spin);
}
static void elan_104nc_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
while(len) {
unsigned long thislen = len;
if (len > (WINDOW_LENGTH - (to & WINDOW_MASK)))
thislen = WINDOW_LENGTH-(to & WINDOW_MASK);
spin_lock(&elan_104nc_spin);
elan_104nc_page(map, to);
memcpy_toio(iomapadr + (to & WINDOW_MASK), from, thislen);
spin_unlock(&elan_104nc_spin);
to += thislen;
from += thislen;
len -= thislen;
}
}
static struct map_info elan_104nc_map = {
.name = "ELAN-104NC flash",
.phys = NO_XIP,
.size = 8*1024*1024, /* this must be set to a maximum possible amount
of flash so the cfi probe routines find all
the chips */
.bankwidth = 2,
.read = elan_104nc_read16,
.copy_from = elan_104nc_copy_from,
.write = elan_104nc_write16,
.copy_to = elan_104nc_copy_to
};
/* MTD device for all of the flash. */
static struct mtd_info *all_mtd;
static void cleanup_elan_104nc(void)
{
if( all_mtd ) {
del_mtd_partitions( all_mtd );
map_destroy( all_mtd );
}
iounmap(iomapadr);
}
static int __init init_elan_104nc(void)
{
/* Urg! We use I/O port 0x22 without request_region()ing it,
because it's already allocated to the PIC. */
iomapadr = ioremap(WINDOW_START, WINDOW_LENGTH);
if (!iomapadr) {
printk( KERN_ERR"%s: failed to ioremap memory region\n",
elan_104nc_map.name );
return -EIO;
}
printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n",
elan_104nc_map.name,
PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1,
WINDOW_START, WINDOW_START+WINDOW_LENGTH-1 );
elan_104nc_setup();
/* Probe for chip. */
all_mtd = do_map_probe("cfi_probe", &elan_104nc_map );
if( !all_mtd ) {
cleanup_elan_104nc();
return -ENXIO;
}
all_mtd->owner = THIS_MODULE;
/* Create MTD devices for each partition. */
add_mtd_partitions( all_mtd, partition_info, NUM_PARTITIONS );
return 0;
}
module_init(init_elan_104nc);
module_exit(cleanup_elan_104nc);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arcom Control Systems Ltd.");
MODULE_DESCRIPTION("MTD map driver for Arcom Control Systems ELAN-104NC");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ichxrom.c * ichxrom.c
* *
* Normal mappings of chips in physical memory * Normal mappings of chips in physical memory
* $Id: ichxrom.c,v 1.16 2004/11/28 09:40:39 dwmw2 Exp $ * $Id: ichxrom.c,v 1.18 2005/07/07 10:26:20 dwmw2 Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
...@@ -338,9 +338,9 @@ static struct pci_device_id ichxrom_pci_tbl[] __devinitdata = { ...@@ -338,9 +338,9 @@ static struct pci_device_id ichxrom_pci_tbl[] __devinitdata = {
{ 0, }, { 0, },
}; };
#if 0
MODULE_DEVICE_TABLE(pci, ichxrom_pci_tbl); MODULE_DEVICE_TABLE(pci, ichxrom_pci_tbl);
#if 0
static struct pci_driver ichxrom_driver = { static struct pci_driver ichxrom_driver = {
.name = MOD_NAME, .name = MOD_NAME,
.id_table = ichxrom_pci_tbl, .id_table = ichxrom_pci_tbl,
...@@ -366,7 +366,7 @@ static int __init init_ichxrom(void) ...@@ -366,7 +366,7 @@ static int __init init_ichxrom(void)
} }
return -ENXIO; return -ENXIO;
#if 0 #if 0
return pci_module_init(&ichxrom_driver); return pci_register_driver(&ichxrom_driver);
#endif #endif
} }
......
/* /*
* $Id: ixp2000.c,v 1.5 2004/11/16 17:15:48 dsaxena Exp $ * $Id: ixp2000.c,v 1.6 2005/03/18 14:07:46 gleixner Exp $
* *
* drivers/mtd/maps/ixp2000.c * drivers/mtd/maps/ixp2000.c
* *
...@@ -216,11 +216,6 @@ static int ixp2000_flash_probe(struct device *_dev) ...@@ -216,11 +216,6 @@ static int ixp2000_flash_probe(struct device *_dev)
goto Error; goto Error;
} }
/*
* Setup read mode for FLASH
*/
*IXP2000_SLOWPORT_FRM = 1;
#if defined(__ARMEB__) #if defined(__ARMEB__)
/* /*
* Enable erratum 44 workaround for NPUs with broken slowport * Enable erratum 44 workaround for NPUs with broken slowport
......
/*
* $Id: $
*
* Map driver for the Mainstone developer platform.
*
* Author: Nicolas Pitre
* Copyright: (C) 2001 MontaVista Software Inc.
*
* 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
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/mainstone.h>
#define ROM_ADDR 0x00000000
#define FLASH_ADDR 0x04000000
#define WINDOW_SIZE 0x04000000
static void mainstone_map_inval_cache(struct map_info *map, unsigned long from,
ssize_t len)
{
consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
}
static struct map_info mainstone_maps[2] = { {
.size = WINDOW_SIZE,
.phys = PXA_CS0_PHYS,
.inval_cache = mainstone_map_inval_cache,
}, {
.size = WINDOW_SIZE,
.phys = PXA_CS1_PHYS,
.inval_cache = mainstone_map_inval_cache,
} };
static struct mtd_partition mainstone_partitions[] = {
{
.name = "Bootloader",
.size = 0x00040000,
.offset = 0,
.mask_flags = MTD_WRITEABLE /* force read-only */
},{
.name = "Kernel",
.size = 0x00400000,
.offset = 0x00040000,
},{
.name = "Filesystem",
.size = MTDPART_SIZ_FULL,
.offset = 0x00440000
}
};
static struct mtd_info *mymtds[2];
static struct mtd_partition *parsed_parts[2];
static int nr_parsed_parts[2];
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
static int __init init_mainstone(void)
{
int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
int ret = 0, i;
mainstone_maps[0].bankwidth = (BOOT_DEF & 1) ? 2 : 4;
mainstone_maps[1].bankwidth = 4;
/* Compensate for SW7 which swaps the flash banks */
mainstone_maps[SW7].name = "processor flash";
mainstone_maps[SW7 ^ 1].name = "main board flash";
printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
mainstone_maps[0].name);
for (i = 0; i < 2; i++) {
mainstone_maps[i].virt = ioremap(mainstone_maps[i].phys,
WINDOW_SIZE);
if (!mainstone_maps[i].virt) {
printk(KERN_WARNING "Failed to ioremap %s\n",
mainstone_maps[i].name);
if (!ret)
ret = -ENOMEM;
continue;
}
mainstone_maps[i].cached =
ioremap_cached(mainstone_maps[i].phys, WINDOW_SIZE);
if (!mainstone_maps[i].cached)
printk(KERN_WARNING "Failed to ioremap cached %s\n",
mainstone_maps[i].name);
simple_map_init(&mainstone_maps[i]);
printk(KERN_NOTICE
"Probing %s at physical address 0x%08lx"
" (%d-bit bankwidth)\n",
mainstone_maps[i].name, mainstone_maps[i].phys,
mainstone_maps[i].bankwidth * 8);
mymtds[i] = do_map_probe("cfi_probe", &mainstone_maps[i]);
if (!mymtds[i]) {
iounmap((void *)mainstone_maps[i].virt);
if (mainstone_maps[i].cached)
iounmap(mainstone_maps[i].cached);
if (!ret)
ret = -EIO;
continue;
}
mymtds[i]->owner = THIS_MODULE;
ret = parse_mtd_partitions(mymtds[i], probes,
&parsed_parts[i], 0);
if (ret > 0)
nr_parsed_parts[i] = ret;
}
if (!mymtds[0] && !mymtds[1])
return ret;
for (i = 0; i < 2; i++) {
if (!mymtds[i]) {
printk(KERN_WARNING "%s is absent. Skipping\n",
mainstone_maps[i].name);
} else if (nr_parsed_parts[i]) {
add_mtd_partitions(mymtds[i], parsed_parts[i],
nr_parsed_parts[i]);
} else if (!i) {
printk("Using static partitions on %s\n",
mainstone_maps[i].name);
add_mtd_partitions(mymtds[i], mainstone_partitions,
ARRAY_SIZE(mainstone_partitions));
} else {
printk("Registering %s as whole device\n",
mainstone_maps[i].name);
add_mtd_device(mymtds[i]);
}
}
return 0;
}
static void __exit cleanup_mainstone(void)
{
int i;
for (i = 0; i < 2; i++) {
if (!mymtds[i])
continue;
if (nr_parsed_parts[i] || !i)
del_mtd_partitions(mymtds[i]);
else
del_mtd_device(mymtds[i]);
map_destroy(mymtds[i]);
iounmap((void *)mainstone_maps[i].virt);
if (mainstone_maps[i].cached)
iounmap(mainstone_maps[i].cached);
kfree(parsed_parts[i]);
}
}
module_init(init_mainstone);
module_exit(cleanup_mainstone);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
MODULE_DESCRIPTION("MTD map driver for Intel Mainstone");
/* /*
* $Id: map_funcs.c,v 1.9 2004/07/13 22:33:15 dwmw2 Exp $ * $Id: map_funcs.c,v 1.10 2005/06/06 23:04:36 tpoynor Exp $
* *
* Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS
* is enabled. * is enabled.
...@@ -9,23 +9,24 @@ ...@@ -9,23 +9,24 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/xip.h>
static map_word simple_map_read(struct map_info *map, unsigned long ofs) static map_word __xipram simple_map_read(struct map_info *map, unsigned long ofs)
{ {
return inline_map_read(map, ofs); return inline_map_read(map, ofs);
} }
static void simple_map_write(struct map_info *map, const map_word datum, unsigned long ofs) static void __xipram simple_map_write(struct map_info *map, const map_word datum, unsigned long ofs)
{ {
inline_map_write(map, datum, ofs); inline_map_write(map, datum, ofs);
} }
static void simple_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) static void __xipram simple_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{ {
inline_map_copy_from(map, to, from, len); inline_map_copy_from(map, to, from, len);
} }
static void simple_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) static void __xipram simple_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{ {
inline_map_copy_to(map, to, from, len); inline_map_copy_to(map, to, from, len);
} }
......
/*
* Flash memory support for various TI OMAP boards
*
* Copyright (C) 2001-2002 MontaVista Software Inc.
* Copyright (C) 2003-2004 Texas Instruments
* Copyright (C) 2004 Nokia Corporation
*
* Assembled using driver code copyright the companies above
* and written by David Brownell, Jian Zhang <jzhang@ti.com>,
* Tony Lindgren <tony@atomide.com> and others.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/device.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/flash.h>
#include <asm/arch/tc.h>
#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probes[] = { /* "RedBoot", */ "cmdlinepart", NULL };
#endif
struct omapflash_info {
struct mtd_partition *parts;
struct mtd_info *mtd;
struct map_info map;
};
static void omap_set_vpp(struct map_info *map, int enable)
{
static int count;
if (enable) {
if (count++ == 0)
OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP;
} else {
if (count && (--count == 0))
OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP;
}
}
static int __devinit omapflash_probe(struct device *dev)
{
int err;
struct omapflash_info *info;
struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *pdata = pdev->dev.platform_data;
struct resource *res = pdev->resource;
unsigned long size = res->end - res->start + 1;
info = kmalloc(sizeof(struct omapflash_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
memset(info, 0, sizeof(struct omapflash_info));
if (!request_mem_region(res->start, size, "flash")) {
err = -EBUSY;
goto out_free_info;
}
info->map.virt = ioremap(res->start, size);
if (!info->map.virt) {
err = -ENOMEM;
goto out_release_mem_region;
}
info->map.name = pdev->dev.bus_id;
info->map.phys = res->start;
info->map.size = size;
info->map.bankwidth = pdata->width;
info->map.set_vpp = omap_set_vpp;
simple_map_init(&info->map);
info->mtd = do_map_probe(pdata->map_name, &info->map);
if (!info->mtd) {
err = -EIO;
goto out_iounmap;
}
info->mtd->owner = THIS_MODULE;
#ifdef CONFIG_MTD_PARTITIONS
err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0);
if (err > 0)
add_mtd_partitions(info->mtd, info->parts, err);
else if (err < 0 && pdata->parts)
add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts);
else
#endif
add_mtd_device(info->mtd);
dev_set_drvdata(&pdev->dev, info);
return 0;
out_iounmap:
iounmap(info->map.virt);
out_release_mem_region:
release_mem_region(res->start, size);
out_free_info:
kfree(info);
return err;
}
static int __devexit omapflash_remove(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omapflash_info *info = dev_get_drvdata(&pdev->dev);
dev_set_drvdata(&pdev->dev, NULL);
if (info) {
if (info->parts) {
del_mtd_partitions(info->mtd);
kfree(info->parts);
} else
del_mtd_device(info->mtd);
map_destroy(info->mtd);
release_mem_region(info->map.phys, info->map.size);
iounmap((void __iomem *) info->map.virt);
kfree(info);
}
return 0;
}
static struct device_driver omapflash_driver = {
.name = "omapflash",
.bus = &platform_bus_type,
.probe = omapflash_probe,
.remove = __devexit_p(omapflash_remove),
};
static int __init omapflash_init(void)
{
return driver_register(&omapflash_driver);
}
static void __exit omapflash_exit(void)
{
driver_unregister(&omapflash_driver);
}
module_init(omapflash_init);
module_exit(omapflash_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MTD NOR map driver for TI OMAP boards");
/*
* Flash memory access on Alchemy Pb1550 board
*
* $Id: pb1550-flash.c,v 1.6 2004/11/04 13:24:15 gleixner Exp $
*
* (C) 2004 Embedded Edge, LLC, based on pb1550-flash.c:
* (C) 2003 Pete Popov <ppopov@pacbell.net>
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/au1000.h>
#include <asm/pb1550.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
static unsigned long window_addr;
static unsigned long window_size;
static struct map_info pb1550_map = {
.name = "Pb1550 flash",
};
static unsigned char flash_bankwidth = 4;
/*
* Support only 64MB NOR Flash parts
*/
#ifdef PB1550_BOTH_BANKS
/* both banks will be used. Combine the first bank and the first
* part of the second bank together into a single jffs/jffs2
* partition.
*/
static struct mtd_partition pb1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash
* 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash
*/
{
.name = "User FS",
.size = (0x1FC00000 - 0x18000000),
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000 - 0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(PB1550_BOOT_ONLY)
static struct mtd_partition pb1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash
*/
{
.name = "User FS",
.size = 0x03c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000-0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};
#elif defined(PB1550_USER_ONLY)
static struct mtd_partition pb1550_partitions[] = {
/* assume boot[2:0]:swap is '0000' or '1000', which translates to:
* 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash
*/
{
.name = "User FS",
.size = (0x4000000 - 0x200000), /* reserve 2MB for raw kernel */
.offset = 0x0000000
},{
.name = "raw kernel",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
}
};
#else
#error MTD_PB1550 define combo error /* should never happen */
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_info *mymtd;
/*
* Probe the flash density and setup window address and size
* based on user CONFIG options. There are times when we don't
* want the MTD driver to be probing the boot or user flash,
* so having the option to enable only one bank is important.
*/
int setup_flash_params(void)
{
u16 boot_swapboot;
boot_swapboot = (au_readl(MEM_STSTAT) & (0x7<<1)) |
((bcsr->status >> 6) & 0x1);
printk("Pb1550 MTD: boot:swap %d\n", boot_swapboot);
switch (boot_swapboot) {
case 0: /* 512Mbit devices, both enabled */
case 1:
case 8:
case 9:
#if defined(PB1550_BOTH_BANKS)
window_addr = 0x18000000;
window_size = 0x8000000;
#elif defined(PB1550_BOOT_ONLY)
window_addr = 0x1C000000;
window_size = 0x4000000;
#else /* USER ONLY */
window_addr = 0x1E000000;
window_size = 0x4000000;
#endif
break;
case 0xC:
case 0xD:
case 0xE:
case 0xF:
/* 64 MB Boot NOR Flash is disabled */
/* and the start address is moved to 0x0C00000 */
window_addr = 0x0C000000;
window_size = 0x4000000;
default:
printk("Pb1550 MTD: unsupported boot:swap setting\n");
return 1;
}
return 0;
}
int __init pb1550_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
/* Default flash bankwidth */
pb1550_map.bankwidth = flash_bankwidth;
if (setup_flash_params())
return -ENXIO;
/*
* Static partition definition selection
*/
parts = pb1550_partitions;
nb_parts = NB_OF(pb1550_partitions);
pb1550_map.size = window_size;
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE "Pb1550 flash: probing %d-bit flash bus\n",
pb1550_map.bankwidth*8);
pb1550_map.virt = ioremap(window_addr, window_size);
mymtd = do_map_probe("cfi_probe", &pb1550_map);
if (!mymtd) return -ENXIO;
mymtd->owner = THIS_MODULE;
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}
static void __exit pb1550_mtd_cleanup(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
}
module_init(pb1550_mtd_init);
module_exit(pb1550_mtd_cleanup);
MODULE_AUTHOR("Embedded Edge, LLC");
MODULE_DESCRIPTION("Pb1550 mtd map driver");
MODULE_LICENSE("GPL");
/*
* Flash memory access on Alchemy Pb1xxx boards
*
* (C) 2001 Pete Popov <ppopov@mvista.com>
*
* $Id: pb1xxx-flash.c,v 1.14 2004/11/04 13:24:15 gleixner Exp $
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
#ifdef CONFIG_MIPS_PB1000
#define WINDOW_ADDR 0x1F800000
#define WINDOW_SIZE 0x800000
static struct mtd_partition pb1xxx_partitions[] = {
{
.name = "yamon env",
.size = 0x00020000,
.offset = 0,
.mask_flags = MTD_WRITEABLE},
{
.name = "User FS",
.size = 0x003e0000,
.offset = 0x20000,},
{
.name = "boot code",
.size = 0x100000,
.offset = 0x400000,
.mask_flags = MTD_WRITEABLE},
{
.name = "raw/kernel",
.size = 0x300000,
.offset = 0x500000}
};
#elif defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100)
#if defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER)
/* both 32MB banks will be used. Combine the first 32MB bank and the
* first 28MB of the second bank together into a single jffs/jffs2
* partition.
*/
#define WINDOW_ADDR 0x1C000000
#define WINDOW_SIZE 0x4000000
static struct mtd_partition pb1xxx_partitions[] = {
{
.name = "User FS",
.size = 0x3c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = 0x3c00000,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = 0x02c0000,
.offset = 0x3d00000
}
};
#elif defined(CONFIG_MTD_PB1500_BOOT) && !defined(CONFIG_MTD_PB1500_USER)
#define WINDOW_ADDR 0x1E000000
#define WINDOW_SIZE 0x2000000
static struct mtd_partition pb1xxx_partitions[] = {
{
.name = "User FS",
.size = 0x1c00000,
.offset = 0x0000000
},{
.name = "yamon",
.size = 0x0100000,
.offset = 0x1c00000,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = 0x02c0000,
.offset = 0x1d00000
}
};
#elif !defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER)
#define WINDOW_ADDR 0x1C000000
#define WINDOW_SIZE 0x2000000
static struct mtd_partition pb1xxx_partitions[] = {
{
.name = "User FS",
.size = 0x1e00000,
.offset = 0x0000000
},{
.name = "raw kernel",
.size = 0x0200000,
.offset = 0x1e00000,
}
};
#else
#error MTD_PB1500 define combo error /* should never happen */
#endif
#else
#error Unsupported board
#endif
#define NAME "Pb1x00 Linux Flash"
#define PADDR WINDOW_ADDR
#define BUSWIDTH 4
#define SIZE WINDOW_SIZE
#define PARTITIONS 4
static struct map_info pb1xxx_mtd_map = {
.name = NAME,
.size = SIZE,
.bankwidth = BUSWIDTH,
.phys = PADDR,
};
static struct mtd_info *pb1xxx_mtd;
int __init pb1xxx_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
char *part_type;
/*
* Static partition definition selection
*/
part_type = "static";
parts = pb1xxx_partitions;
nb_parts = ARRAY_SIZE(pb1xxx_partitions);
/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE "Pb1xxx flash: probing %d-bit flash bus\n",
BUSWIDTH*8);
pb1xxx_mtd_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
simple_map_init(&pb1xxx_mtd_map);
pb1xxx_mtd = do_map_probe("cfi_probe", &pb1xxx_mtd_map);
if (!pb1xxx_mtd) return -ENXIO;
pb1xxx_mtd->owner = THIS_MODULE;
add_mtd_partitions(pb1xxx_mtd, parts, nb_parts);
return 0;
}
static void __exit pb1xxx_mtd_cleanup(void)
{
if (pb1xxx_mtd) {
del_mtd_partitions(pb1xxx_mtd);
map_destroy(pb1xxx_mtd);
iounmap((void *) pb1xxx_mtd_map.virt);
}
}
module_init(pb1xxx_mtd_init);
module_exit(pb1xxx_mtd_cleanup);
MODULE_AUTHOR("Pete Popov");
MODULE_DESCRIPTION("Pb1xxx CFI map driver");
MODULE_LICENSE("GPL");
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* $Id: pci.c,v 1.9 2004/11/28 09:40:40 dwmw2 Exp $ * $Id: pci.c,v 1.10 2005/03/18 14:04:35 gleixner Exp $
* *
* Generic PCI memory map driver. We support the following boards: * Generic PCI memory map driver. We support the following boards:
* - Intel IQ80310 ATU. * - Intel IQ80310 ATU.
...@@ -370,7 +370,7 @@ static struct pci_driver mtd_pci_driver = { ...@@ -370,7 +370,7 @@ static struct pci_driver mtd_pci_driver = {
static int __init mtd_pci_maps_init(void) static int __init mtd_pci_maps_init(void)
{ {
return pci_module_init(&mtd_pci_driver); return pci_register_driver(&mtd_pci_driver);
} }
static void __exit mtd_pci_maps_exit(void) static void __exit mtd_pci_maps_exit(void)
......
/* drivers/mtd/maps/plat-ram.c
*
* (c) 2004-2005 Simtec Electronics
* http://www.simtec.co.uk/products/SWLINUX/
* Ben Dooks <ben@simtec.co.uk>
*
* Generic platfrom device based RAM map
*
* $Id: plat-ram.c,v 1.3 2005/03/19 22:41:27 gleixner Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/ioport.h>
#include <linux/device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/plat-ram.h>
#include <asm/io.h>
/* private structure for each mtd platform ram device created */
struct platram_info {
struct device *dev;
struct mtd_info *mtd;
struct map_info map;
struct mtd_partition *partitions;
struct resource *area;
struct platdata_mtd_ram *pdata;
};
/* to_platram_info()
*
* device private data to struct platram_info conversion
*/
static inline struct platram_info *to_platram_info(struct device *dev)
{
return (struct platram_info *)dev_get_drvdata(dev);
}
/* platram_setrw
*
* call the platform device's set rw/ro control
*
* to = 0 => read-only
* = 1 => read-write
*/
static inline void platram_setrw(struct platram_info *info, int to)
{
if (info->pdata == NULL)
return;
if (info->pdata->set_rw != NULL)
(info->pdata->set_rw)(info->dev, to);
}
/* platram_remove
*
* called to remove the device from the driver's control
*/
static int platram_remove(struct device *dev)
{
struct platram_info *info = to_platram_info(dev);
dev_set_drvdata(dev, NULL);
dev_dbg(dev, "removing device\n");
if (info == NULL)
return 0;
if (info->mtd) {
#ifdef CONFIG_MTD_PARTITIONS
if (info->partitions) {
del_mtd_partitions(info->mtd);
kfree(info->partitions);
}
#endif
del_mtd_device(info->mtd);
map_destroy(info->mtd);
}
/* ensure ram is left read-only */
platram_setrw(info, PLATRAM_RO);
/* release resources */
if (info->area) {
release_resource(info->area);
kfree(info->area);
}
if (info->map.virt != NULL)
iounmap(info->map.virt);
kfree(info);
return 0;
}
/* platram_probe
*
* called from device drive system when a device matching our
* driver is found.
*/
static int platram_probe(struct device *dev)
{
struct platform_device *pd = to_platform_device(dev);
struct platdata_mtd_ram *pdata;
struct platram_info *info;
struct resource *res;
int err = 0;
dev_dbg(dev, "probe entered\n");
if (dev->platform_data == NULL) {
dev_err(dev, "no platform data supplied\n");
err = -ENOENT;
goto exit_error;
}
pdata = dev->platform_data;
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) {
dev_err(dev, "no memory for flash info\n");
err = -ENOMEM;
goto exit_error;
}
memset(info, 0, sizeof(*info));
dev_set_drvdata(dev, info);
info->dev = dev;
info->pdata = pdata;
/* get the resource for the memory mapping */
res = platform_get_resource(pd, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "no memory resource specified\n");
err = -ENOENT;
goto exit_free;
}
dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start);
/* setup map parameters */
info->map.phys = res->start;
info->map.size = (res->end - res->start) + 1;
info->map.name = pdata->mapname != NULL ? pdata->mapname : pd->name;
info->map.bankwidth = pdata->bankwidth;
/* register our usage of the memory area */
info->area = request_mem_region(res->start, info->map.size, pd->name);
if (info->area == NULL) {
dev_err(dev, "failed to request memory region\n");
err = -EIO;
goto exit_free;
}
/* remap the memory area */
info->map.virt = ioremap(res->start, info->map.size);
dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size);
if (info->map.virt == NULL) {
dev_err(dev, "failed to ioremap() region\n");
err = -EIO;
goto exit_free;
}
simple_map_init(&info->map);
dev_dbg(dev, "initialised map, probing for mtd\n");
/* probe for the right mtd map driver */
info->mtd = do_map_probe("map_ram" , &info->map);
if (info->mtd == NULL) {
dev_err(dev, "failed to probe for map_ram\n");
err = -ENOMEM;
goto exit_free;
}
info->mtd->owner = THIS_MODULE;
platram_setrw(info, PLATRAM_RW);
/* check to see if there are any available partitions, or wether
* to add this device whole */
#ifdef CONFIG_MTD_PARTITIONS
if (pdata->nr_partitions > 0) {
const char **probes = { NULL };
if (pdata->probes)
probes = (const char **)pdata->probes;
err = parse_mtd_partitions(info->mtd, probes,
&info->partitions, 0);
if (err > 0) {
err = add_mtd_partitions(info->mtd, info->partitions,
err);
}
}
#endif /* CONFIG_MTD_PARTITIONS */
if (add_mtd_device(info->mtd)) {
dev_err(dev, "add_mtd_device() failed\n");
err = -ENOMEM;
}
dev_info(dev, "registered mtd device\n");
return err;
exit_free:
platram_remove(dev);
exit_error:
return err;
}
/* device driver info */
static struct device_driver platram_driver = {
.name = "mtd-ram",
.bus = &platform_bus_type,
.probe = platram_probe,
.remove = platram_remove,
};
/* module init/exit */
static int __init platram_init(void)
{
printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n");
return driver_register(&platram_driver);
}
static void __exit platram_exit(void)
{
driver_unregister(&platram_driver);
}
module_init(platram_init);
module_exit(platram_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
MODULE_DESCRIPTION("MTD platform RAM map driver");
/* /*
* MTD map driver for BIOS Flash on Intel SCB2 boards * MTD map driver for BIOS Flash on Intel SCB2 boards
* $Id: scb2_flash.c,v 1.11 2004/11/28 09:40:40 dwmw2 Exp $ * $Id: scb2_flash.c,v 1.12 2005/03/18 14:04:35 gleixner Exp $
* Copyright (C) 2002 Sun Microsystems, Inc. * Copyright (C) 2002 Sun Microsystems, Inc.
* Tim Hockin <thockin@sun.com> * Tim Hockin <thockin@sun.com>
* *
...@@ -238,7 +238,7 @@ static struct pci_driver scb2_flash_driver = { ...@@ -238,7 +238,7 @@ static struct pci_driver scb2_flash_driver = {
static int __init static int __init
scb2_flash_init(void) scb2_flash_init(void)
{ {
return pci_module_init(&scb2_flash_driver); return pci_register_driver(&scb2_flash_driver);
} }
static void __exit static void __exit
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (C) 2001 Lineo Japan, Inc. * Copyright (C) 2001 Lineo Japan, Inc.
* Copyright (C) 2002 SHARP * Copyright (C) 2002 SHARP
* *
* $Id: sharpsl-flash.c,v 1.2 2004/11/24 20:38:06 rpurdie Exp $ * $Id: sharpsl-flash.c,v 1.5 2005/03/21 08:42:11 rpurdie Exp $
* *
* based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp
* Handle mapping of the flash on the RPX Lite and CLLF boards * Handle mapping of the flash on the RPX Lite and CLLF boards
...@@ -24,13 +24,14 @@ ...@@ -24,13 +24,14 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/mach-types.h>
#define WINDOW_ADDR 0x00000000 #define WINDOW_ADDR 0x00000000
#define WINDOW_SIZE 0x01000000 #define WINDOW_SIZE 0x00800000
#define BANK_WIDTH 2 #define BANK_WIDTH 2
static struct mtd_info *mymtd; static struct mtd_info *mymtd;
...@@ -44,9 +45,7 @@ struct map_info sharpsl_map = { ...@@ -44,9 +45,7 @@ struct map_info sharpsl_map = {
static struct mtd_partition sharpsl_partitions[1] = { static struct mtd_partition sharpsl_partitions[1] = {
{ {
name: "Filesystem", name: "Boot PROM Filesystem",
size: 0x006d0000,
offset: 0x00120000
} }
}; };
...@@ -58,12 +57,16 @@ int __init init_sharpsl(void) ...@@ -58,12 +57,16 @@ int __init init_sharpsl(void)
int nb_parts = 0; int nb_parts = 0;
char *part_type = "static"; char *part_type = "static";
printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR); printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n",
WINDOW_SIZE, WINDOW_ADDR);
sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
if (!sharpsl_map.virt) { if (!sharpsl_map.virt) {
printk("Failed to ioremap\n"); printk("Failed to ioremap\n");
return -EIO; return -EIO;
} }
simple_map_init(&sharpsl_map);
mymtd = do_map_probe("map_rom", &sharpsl_map); mymtd = do_map_probe("map_rom", &sharpsl_map);
if (!mymtd) { if (!mymtd) {
iounmap(sharpsl_map.virt); iounmap(sharpsl_map.virt);
...@@ -72,6 +75,22 @@ int __init init_sharpsl(void) ...@@ -72,6 +75,22 @@ int __init init_sharpsl(void)
mymtd->owner = THIS_MODULE; mymtd->owner = THIS_MODULE;
if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()
|| machine_is_poodle()) {
sharpsl_partitions[0].size=0x006d0000;
sharpsl_partitions[0].offset=0x00120000;
} else if (machine_is_tosa()) {
sharpsl_partitions[0].size=0x006a0000;
sharpsl_partitions[0].offset=0x00160000;
} else if (machine_is_spitz()) {
sharpsl_partitions[0].size=0x006b0000;
sharpsl_partitions[0].offset=0x00140000;
} else {
map_destroy(mymtd);
iounmap(sharpsl_map.virt);
return -ENODEV;
}
parts = sharpsl_partitions; parts = sharpsl_partitions;
nb_parts = NB_OF(sharpsl_partitions); nb_parts = NB_OF(sharpsl_partitions);
......
This diff is collapsed.
/* /*
* $Id: mtdcore.c,v 1.44 2004/11/16 18:28:59 dwmw2 Exp $ * $Id: mtdcore.c,v 1.45 2005/02/18 14:34:50 dedekind Exp $
* *
* Core registration and callback routines for MTD * Core registration and callback routines for MTD
* drivers and users. * drivers and users.
...@@ -149,8 +149,8 @@ void register_mtd_user (struct mtd_notifier *new) ...@@ -149,8 +149,8 @@ void register_mtd_user (struct mtd_notifier *new)
} }
/** /**
* register_mtd_user - unregister a 'user' of MTD devices. * unregister_mtd_user - unregister a 'user' of MTD devices.
* @new: pointer to notifier info structure * @old: pointer to notifier info structure
* *
* Removes a callback function pair from the list of 'users' to be * Removes a callback function pair from the list of 'users' to be
* notified upon addition or removal of MTD devices. Causes the * notified upon addition or removal of MTD devices. Causes the
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* This code is GPL * This code is GPL
* *
* $Id: mtdpart.c,v 1.51 2004/11/16 18:28:59 dwmw2 Exp $ * $Id: mtdpart.c,v 1.53 2005/02/08 17:11:13 nico Exp $
* *
* 02-21-2002 Thomas Gleixner <gleixner@autronix.de> * 02-21-2002 Thomas Gleixner <gleixner@autronix.de>
* added support for read_oob, write_oob * added support for read_oob, write_oob
...@@ -116,6 +116,13 @@ static int part_read_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t le ...@@ -116,6 +116,13 @@ static int part_read_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t le
len, retlen, buf); len, retlen, buf);
} }
static int part_get_user_prot_info (struct mtd_info *mtd,
struct otp_info *buf, size_t len)
{
struct mtd_part *part = PART(mtd);
return part->master->get_user_prot_info (part->master, buf, len);
}
static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t len, static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf) size_t *retlen, u_char *buf)
{ {
...@@ -124,6 +131,13 @@ static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t le ...@@ -124,6 +131,13 @@ static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t le
len, retlen, buf); len, retlen, buf);
} }
static int part_get_fact_prot_info (struct mtd_info *mtd,
struct otp_info *buf, size_t len)
{
struct mtd_part *part = PART(mtd);
return part->master->get_fact_prot_info (part->master, buf, len);
}
static int part_write (struct mtd_info *mtd, loff_t to, size_t len, static int part_write (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf) size_t *retlen, const u_char *buf)
{ {
...@@ -182,6 +196,12 @@ static int part_write_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t l ...@@ -182,6 +196,12 @@ static int part_write_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t l
len, retlen, buf); len, retlen, buf);
} }
static int part_lock_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t len)
{
struct mtd_part *part = PART(mtd);
return part->master->lock_user_prot_reg (part->master, from, len);
}
static int part_writev (struct mtd_info *mtd, const struct kvec *vecs, static int part_writev (struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen) unsigned long count, loff_t to, size_t *retlen)
{ {
...@@ -409,6 +429,12 @@ int add_mtd_partitions(struct mtd_info *master, ...@@ -409,6 +429,12 @@ int add_mtd_partitions(struct mtd_info *master,
slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg; slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg;
if(master->write_user_prot_reg) if(master->write_user_prot_reg)
slave->mtd.write_user_prot_reg = part_write_user_prot_reg; slave->mtd.write_user_prot_reg = part_write_user_prot_reg;
if(master->lock_user_prot_reg)
slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg;
if(master->get_user_prot_info)
slave->mtd.get_user_prot_info = part_get_user_prot_info;
if(master->get_fact_prot_info)
slave->mtd.get_fact_prot_info = part_get_fact_prot_info;
if (master->sync) if (master->sync)
slave->mtd.sync = part_sync; slave->mtd.sync = part_sync;
if (!i && master->suspend && master->resume) { if (!i && master->suspend && master->resume) {
......
# drivers/mtd/nand/Kconfig # drivers/mtd/nand/Kconfig
# $Id: Kconfig,v 1.26 2005/01/05 12:42:24 dwmw2 Exp $ # $Id: Kconfig,v 1.31 2005/06/20 12:03:21 bjd Exp $
menu "NAND Flash Device Drivers" menu "NAND Flash Device Drivers"
depends on MTD!=n depends on MTD!=n
...@@ -58,20 +58,6 @@ config MTD_NAND_TOTO ...@@ -58,20 +58,6 @@ config MTD_NAND_TOTO
config MTD_NAND_IDS config MTD_NAND_IDS
tristate tristate
config MTD_NAND_TX4925NDFMC
tristate "SmartMedia Card on Toshiba RBTX4925 reference board"
depends on TOSHIBA_RBTX4925 && MTD_NAND && TOSHIBA_RBTX4925_MPLEX_NAND
help
This enables the driver for the NAND flash device found on the
Toshiba RBTX4925 reference board, which is a SmartMediaCard.
config MTD_NAND_TX4938NDFMC
tristate "NAND Flash device on Toshiba RBTX4938 reference board"
depends on TOSHIBA_RBTX4938 && MTD_NAND && TOSHIBA_RBTX4938_MPLEX_NAND
help
This enables the driver for the NAND flash device found on the
Toshiba RBTX4938 reference board.
config MTD_NAND_AU1550 config MTD_NAND_AU1550
tristate "Au1550 NAND support" tristate "Au1550 NAND support"
depends on SOC_AU1550 && MTD_NAND depends on SOC_AU1550 && MTD_NAND
...@@ -95,10 +81,11 @@ config MTD_NAND_PPCHAMELEONEVB ...@@ -95,10 +81,11 @@ config MTD_NAND_PPCHAMELEONEVB
This enables the NAND flash driver on the PPChameleon EVB Board. This enables the NAND flash driver on the PPChameleon EVB Board.
config MTD_NAND_S3C2410 config MTD_NAND_S3C2410
tristate "NAND Flash support for S3C2410 SoC" tristate "NAND Flash support for S3C2410/S3C2440 SoC"
depends on ARCH_S3C2410 && MTD_NAND depends on ARCH_S3C2410 && MTD_NAND
help help
This enables the NAND flash controller on the S3C2410. This enables the NAND flash controller on the S3C2410 and S3C2440
SoCs
No board specfic support is done by this driver, each board No board specfic support is done by this driver, each board
must advertise a platform_device for the driver to attach. must advertise a platform_device for the driver to attach.
......
...@@ -10,8 +10,6 @@ obj-$(CONFIG_MTD_NAND_SPIA) += spia.o ...@@ -10,8 +10,6 @@ obj-$(CONFIG_MTD_NAND_SPIA) += spia.o
obj-$(CONFIG_MTD_NAND_TOTO) += toto.o obj-$(CONFIG_MTD_NAND_TOTO) += toto.o
obj-$(CONFIG_MTD_NAND_AUTCPU12) += autcpu12.o obj-$(CONFIG_MTD_NAND_AUTCPU12) += autcpu12.o
obj-$(CONFIG_MTD_NAND_EDB7312) += edb7312.o obj-$(CONFIG_MTD_NAND_EDB7312) += edb7312.o
obj-$(CONFIG_MTD_NAND_TX4925NDFMC) += tx4925ndfmc.o
obj-$(CONFIG_MTD_NAND_TX4938NDFMC) += tx4938ndfmc.o
obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o
obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB) += ppchameleonevb.o obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB) += ppchameleonevb.o
obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 2004 Richard Purdie * Copyright (C) 2004 Richard Purdie
* *
* $Id: sharpsl.c,v 1.3 2005/01/03 14:53:50 rpurdie Exp $ * $Id: sharpsl.c,v 1.4 2005/01/23 11:09:19 rpurdie Exp $
* *
* Based on Sharp's NAND driver sharp_sl.c * Based on Sharp's NAND driver sharp_sl.c
* *
...@@ -216,7 +216,7 @@ sharpsl_nand_init(void) ...@@ -216,7 +216,7 @@ sharpsl_nand_init(void)
nr_partitions = DEFAULT_NUM_PARTITIONS; nr_partitions = DEFAULT_NUM_PARTITIONS;
sharpsl_partition_info = sharpsl_nand_default_partition_info; sharpsl_partition_info = sharpsl_nand_default_partition_info;
if (machine_is_poodle()) { if (machine_is_poodle()) {
sharpsl_partition_info[1].size=22 * 1024 * 1024; sharpsl_partition_info[1].size=30 * 1024 * 1024;
} else if (machine_is_corgi() || machine_is_shepherd()) { } else if (machine_is_corgi() || machine_is_shepherd()) {
sharpsl_partition_info[1].size=25 * 1024 * 1024; sharpsl_partition_info[1].size=25 * 1024 * 1024;
} else if (machine_is_husky()) { } else if (machine_is_husky()) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment