Commit 1b9e349f authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.5-rmk

into home.transmeta.com:/home/torvalds/v2.5/linux
parents b5671292 fea45e9c
...@@ -3131,9 +3131,18 @@ void mgslpc_remove_device(MGSLPC_INFO *remove_info) ...@@ -3131,9 +3131,18 @@ void mgslpc_remove_device(MGSLPC_INFO *remove_info)
} }
} }
static struct pcmcia_driver mgslpc_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "synclink_cs",
},
.attach = mgslpc_attach,
.detach = mgslpc_detach,
};
static int __init synclink_cs_init(void) static int __init synclink_cs_init(void)
{ {
servinfo_t serv; int error;
if (break_on_load) { if (break_on_load) {
mgslpc_get_text_ptr(); mgslpc_get_text_ptr();
...@@ -3142,13 +3151,9 @@ static int __init synclink_cs_init(void) ...@@ -3142,13 +3151,9 @@ static int __init synclink_cs_init(void)
printk("%s %s\n", driver_name, driver_version); printk("%s %s\n", driver_name, driver_version);
CardServices(GetCardServicesInfo, &serv); error = pcmcia_register_driver(&mgslpc_driver);
if (serv.Revision != CS_RELEASE_CODE) { if (error)
printk(KERN_NOTICE "synclink_cs: Card Services release " return error;
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &mgslpc_attach, &mgslpc_detach);
/* Initialize the tty_driver structure */ /* Initialize the tty_driver structure */
...@@ -3217,7 +3222,9 @@ static void __exit synclink_cs_exit(void) ...@@ -3217,7 +3222,9 @@ static void __exit synclink_cs_exit(void)
printk("%s(%d) failed to unregister tty driver err=%d\n", printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
unregister_pccard_driver(&dev_info); pcmcia_unregister_driver(&mgslpc_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) { while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG) if (dev_list->state & DEV_CONFIG)
mgslpc_release((u_long)dev_list); mgslpc_release((u_long)dev_list);
......
...@@ -470,28 +470,25 @@ int ide_event(event_t event, int priority, ...@@ -470,28 +470,25 @@ int ide_event(event_t event, int priority,
return 0; return 0;
} /* ide_event */ } /* ide_event */
/*====================================================================*/ static struct pcmcia_driver ide_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "ide_cs",
},
.attach = ide_attach,
.detach = ide_detach,
};
static int __init init_ide_cs(void) static int __init init_ide_cs(void)
{ {
servinfo_t serv; return pcmcia_register_driver(&ide_cs_driver);
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "ide-cs: Card Services release "
"does not match!\n");
return -EINVAL;
}
register_pccard_driver(&dev_info, &ide_attach, &ide_detach);
return 0;
} }
static void __exit exit_ide_cs(void) static void __exit exit_ide_cs(void)
{ {
DEBUG(0, "ide-cs: unloading\n"); pcmcia_unregister_driver(&ide_cs_driver);
unregister_pccard_driver(&dev_info); while (dev_list != NULL)
while (dev_list != NULL) ide_detach(dev_list);
ide_detach(dev_list);
} }
module_init(init_ide_cs); module_init(init_ide_cs);
......
...@@ -510,29 +510,30 @@ static int avmcs_event(event_t event, int priority, ...@@ -510,29 +510,30 @@ static int avmcs_event(event_t event, int priority,
return 0; return 0;
} /* avmcs_event */ } /* avmcs_event */
/*====================================================================*/ static struct pcmcia_driver avmcs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avmcs_cs",
},
.attach = avmcs_attach,
.detach = avmcs_detach,
};
static int __init avmcs_init(void) static int __init avmcs_init(void)
{ {
servinfo_t serv; return pcmcia_register_driver(&avmcs_driver);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avm_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avmcs_attach, &avmcs_detach);
return 0;
} }
static void __exit avmcs_exit(void) static void __exit avmcs_exit(void)
{ {
unregister_pccard_driver(&dev_info); pcmcia_unregister_driver(&avmcs_driver);
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG) /* XXX: this really needs to move into generic code.. */
avmcs_release((u_long)dev_list); while (dev_list != NULL) {
avmcs_detach(dev_list); if (dev_list->state & DEV_CONFIG)
} avmcs_release((u_long)dev_list);
avmcs_detach(dev_list);
}
} }
module_init(avmcs_init); module_init(avmcs_init);
......
...@@ -515,30 +515,30 @@ static int avma1cs_event(event_t event, int priority, ...@@ -515,30 +515,30 @@ static int avma1cs_event(event_t event, int priority,
return 0; return 0;
} /* avma1cs_event */ } /* avma1cs_event */
/*====================================================================*/ static struct pcmcia_driver avma1cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avma1_cs",
},
.attach = avma1cs_attach,
.detach = avma1cs_detach,
};
static int __init init_avma1_cs(void) static int __init init_avma1_cs(void)
{ {
servinfo_t serv; return pcmcia_register_driver(&avma1cs_driver);
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avma1_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avma1cs_attach, &avma1cs_detach);
return 0;
} }
static void __exit exit_avma1_cs(void) static void __exit exit_avma1_cs(void)
{ {
DEBUG(0, "avma1_cs: unloading\n"); pcmcia_unregister_driver(&avma1cs_driver);
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) /* XXX: this really needs to move into generic code.. */
if (dev_list->state & DEV_CONFIG) while (dev_list != NULL) {
avma1cs_release((u_long)dev_list); if (dev_list->state & DEV_CONFIG)
avma1cs_detach(dev_list); avma1cs_release((u_long)dev_list);
avma1cs_detach(dev_list);
}
} }
module_init(init_avma1_cs); module_init(init_avma1_cs);
......
...@@ -531,28 +531,27 @@ static int elsa_cs_event(event_t event, int priority, ...@@ -531,28 +531,27 @@ static int elsa_cs_event(event_t event, int priority,
return 0; return 0;
} /* elsa_cs_event */ } /* elsa_cs_event */
/*====================================================================*/ static struct pcmcia_driver elsa_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "elsa_cs",
},
.attach = elsa_cs_attach,
.detach = elsa_cs_detach,
};
static int __init init_elsa_cs(void) static int __init init_elsa_cs(void)
{ {
servinfo_t serv; return pcmcia_register_driver(&elsa_cs_driver);
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "elsa_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &elsa_cs_attach, &elsa_cs_detach);
return 0;
} }
static void __exit exit_elsa_cs(void) static void __exit exit_elsa_cs(void)
{ {
DEBUG(0, "elsa_cs: unloading\n"); pcmcia_unregister_driver(&elsa_cs_driver);
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) /* XXX: this really needs to move into generic code.. */
elsa_cs_detach(dev_list); while (dev_list != NULL)
elsa_cs_detach(dev_list);
} }
module_init(init_elsa_cs); module_init(init_elsa_cs);
......
...@@ -633,34 +633,32 @@ static int sedlbauer_event(event_t event, int priority, ...@@ -633,34 +633,32 @@ static int sedlbauer_event(event_t event, int priority,
return 0; return 0;
} /* sedlbauer_event */ } /* sedlbauer_event */
/*====================================================================*/ static struct pcmcia_driver sedlbauer_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "sedlbauer_cs",
},
.attach = sedlbauer_attach,
.detach = sedlbauer_detach,
};
static int __init init_sedlbauer_cs(void) static int __init init_sedlbauer_cs(void)
{ {
servinfo_t serv; return pcmcia_register_driver(&sedlbauer_driver);
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "sedlbauer_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &sedlbauer_attach, &sedlbauer_detach);
return 0;
} }
static void __exit exit_sedlbauer_cs(void) static void __exit exit_sedlbauer_cs(void)
{ {
DEBUG(0, "sedlbauer_cs: unloading\n"); pcmcia_unregister_driver(&sedlbauer_driver);
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) { /* XXX: this really needs to move into generic code.. */
del_timer(&dev_list->release); while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG) del_timer(&dev_list->release);
sedlbauer_release((u_long)dev_list); if (dev_list->state & DEV_CONFIG)
sedlbauer_detach(dev_list); sedlbauer_release((u_long)dev_list);
} sedlbauer_detach(dev_list);
}
} }
module_init(init_sedlbauer_cs); module_init(init_sedlbauer_cs);
module_exit(exit_sedlbauer_cs); module_exit(exit_sedlbauer_cs);
# $Id: Config.in,v 1.74 2002/04/23 13:52:14 mag Exp $ # $Id: Kconfig,v 1.3 2003/05/28 11:02:23 dwmw2 Exp $
menu "Memory Technology Devices (MTD)" menu "Memory Technology Devices (MTD)"
...@@ -199,13 +199,28 @@ config NFTL ...@@ -199,13 +199,28 @@ config NFTL
not use it. not use it.
config NFTL_RW config NFTL_RW
bool "Write support for NFTL (BETA)" bool "Write support for NFTL"
depends on NFTL depends on NFTL
help help
If you're lucky, this will actually work. Don't whinge if it Support for writing to the NAND Flash Translation Layer, as used
doesn't. Send mail to the MTD mailing list on the DiskOnChip.
<linux-mtd@lists.infradead.org> if you want to help to make it more
reliable. config INFTL
tristate "INFTL (Inverse NAND Flash Translation Layer) support"
depends on MTD
---help---
This provides support for the Inverse NAND Flash Translation
Layer which is used on M-Systems' newer DiskOnChip devices. It
uses a kind of pseudo-file system on a flash device to emulate
a block device with 512-byte sectors, on top of which you put
a 'normal' file system.
You may find that the algorithms used in this code are patented
unless you live in the Free World where software patents aren't
legal - in the USA you are only permitted to use this on DiskOnChip
hardware, although under the terms of the GPL you're obviously
permitted to copy, modify and distribute the code as you wish. Just
not use it.
source "drivers/mtd/chips/Kconfig" source "drivers/mtd/chips/Kconfig"
......
# #
# Makefile for the memory technology device drivers. # Makefile for the memory technology device drivers.
# #
# Based on: # $Id: Makefile.common,v 1.2 2003/05/23 11:38:29 dwmw2 Exp $
# $Id: Makefile,v 1.66 2002/04/23 13:52:14 mag Exp $
obj-y += chips/ maps/ devices/ nand/
# *** BIG UGLY NOTE *** # *** BIG UGLY NOTE ***
# #
...@@ -27,14 +24,18 @@ obj-$(CONFIG_MTD) += mtdcore.o ...@@ -27,14 +24,18 @@ obj-$(CONFIG_MTD) += mtdcore.o
obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdline.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
# 'Users' - code which presents functionality to userspace. # 'Users' - code which presents functionality to userspace.
obj-$(CONFIG_MTD_CHAR) += mtdchar.o obj-$(CONFIG_MTD_CHAR) += mtdchar.o
obj-$(CONFIG_MTD_BLOCK) += mtdblock.o obj-$(CONFIG_MTD_BLOCK) += mtdblock.o mtd_blkdevs.o
obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o mtd_blkdevs.o
obj-$(CONFIG_FTL) += ftl.o obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o
obj-$(CONFIG_NFTL) += nftl.o obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o
obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o
nftl-objs := nftlcore.o nftlmount.o
inftl-objs := inftlcore.o inftlmount.o
nftl-objs := nftlcore.o nftlmount.o obj-y += chips/ maps/ devices/ nand/
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
This is access code for flashes using ARM's flash partitioning This is access code for flashes using ARM's flash partitioning
standards. standards.
$Id: afs.c,v 1.8 2002/05/04 08:49:09 rmk Exp $ $Id: afs.c,v 1.11 2003/05/16 17:08:24 dwmw2 Exp $
======================================================================*/ ======================================================================*/
...@@ -125,7 +125,9 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr) ...@@ -125,7 +125,9 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr)
return ret; return ret;
} }
int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts) static int parse_afs_partitions(struct mtd_info *mtd,
struct mtd_partition **pparts,
unsigned long origin)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
u_int mask, off, idx, sz; u_int mask, off, idx, sz;
...@@ -227,7 +229,25 @@ int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts) ...@@ -227,7 +229,25 @@ int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts)
return idx ? idx : ret; return idx ? idx : ret;
} }
EXPORT_SYMBOL(parse_afs_partitions); static struct mtd_part_parser afs_parser = {
.owner = THIS_MODULE,
.parse_fn = parse_afs_partitions,
.name = "afs",
};
static int __init afs_parser_init(void)
{
return register_mtd_parser(&afs_parser);
}
static void __exit afs_parser_exit(void)
{
deregister_mtd_parser(&afs_parser);
}
module_init(afs_parser_init);
module_exit(afs_parser_exit);
MODULE_AUTHOR("ARM Ltd"); MODULE_AUTHOR("ARM Ltd");
MODULE_DESCRIPTION("ARM Firmware Suite partition parser"); MODULE_DESCRIPTION("ARM Firmware Suite partition parser");
......
# drivers/mtd/chips/Config.in # drivers/mtd/chips/Kconfig
# $Id: Config.in,v 1.12 2001/09/23 15:35:21 dwmw2 Exp $ # $Id: Kconfig,v 1.3 2003/05/28 15:13:24 dwmw2 Exp $
menu "RAM/ROM/Flash chip drivers" menu "RAM/ROM/Flash chip drivers"
depends on MTD!=n depends on MTD!=n
...@@ -15,7 +15,6 @@ config MTD_CFI ...@@ -15,7 +15,6 @@ config MTD_CFI
option. Visit <http://www.amd.com/products/nvd/overview/cfi.html> option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
for more information on CFI. for more information on CFI.
#dep_tristate ' Detect non-CFI Intel-compatible flash chips' CONFIG_MTD_INTELPROBE $CONFIG_MTD
config MTD_JEDECPROBE config MTD_JEDECPROBE
tristate "Detect non-CFI AMD/JEDEC-compatible flash chips" tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
depends on MTD depends on MTD
...@@ -107,6 +106,13 @@ config MTD_CFI_B4 ...@@ -107,6 +106,13 @@ config MTD_CFI_B4
If you wish to support CFI devices on a physical bus which is If you wish to support CFI devices on a physical bus which is
32 bits wide, say 'Y'. 32 bits wide, say 'Y'.
config MTD_CFI_B8
bool "Support 64-bit buswidth"
depends on MTD_CFI_GEOMETRY
help
If you wish to support CFI devices on a physical bus which is
64 bits wide, say 'Y'.
config MTD_CFI_I1 config MTD_CFI_I1
bool "Support 1-chip flash interleave" if !MTD_CFI_B1 bool "Support 1-chip flash interleave" if !MTD_CFI_B1
depends on MTD_CFI_GEOMETRY depends on MTD_CFI_GEOMETRY
...@@ -129,6 +135,13 @@ config MTD_CFI_I4 ...@@ -129,6 +135,13 @@ config MTD_CFI_I4
If your flash chips are interleaved in fours - i.e. you have four If your flash chips are interleaved in fours - i.e. you have four
flash chips addressed by each bus cycle, then say 'Y'. flash chips addressed by each bus cycle, then say 'Y'.
config MTD_CFI_I8
bool "Support 8-chip flash interleave"
depends on MTD_CFI_GEOMETRY
help
If your flash chips are interleaved in eights - i.e. you have eight
flash chips addressed by each bus cycle, then say 'Y'.
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
...@@ -145,7 +158,15 @@ config MTD_CFI_AMDSTD ...@@ -145,7 +158,15 @@ config MTD_CFI_AMDSTD
The Common Flash Interface defines a number of different command The Common Flash Interface defines a number of different command
sets which a CFI-compliant chip may claim to implement. This code sets which a CFI-compliant chip may claim to implement. This code
provides support for one of those command sets, used on chips provides support for one of those command sets, used on chips
chips including the AMD Am29LV320. including the AMD Am29LV320.
config MTD_CFI_STAA
tristate "Support for ST (Advanced Architecture) flash chips"
depends on MTD_GEN_PROBE
help
The Common Flash Interface defines a number of different command
sets which a CFI-compliant chip may claim to implement. This code
provides support for one of those command sets.
config MTD_RAM config MTD_RAM
tristate "Support for RAM chips in bus mapping" tristate "Support for RAM chips in bus mapping"
...@@ -177,10 +198,10 @@ config MTD_OBSOLETE_CHIPS ...@@ -177,10 +198,10 @@ config MTD_OBSOLETE_CHIPS
help help
This option does not enable any code directly, but will allow you to This option does not enable any code directly, but will allow you to
select some other chip drivers which are now considered obsolete, select some other chip drivers which are now considered obsolete,
because the generic CONFIG_JEDEC_PROBE code above should now detect because the generic CONFIG_JEDECPROBE code above should now detect
the chips which are supported by these drivers, and allow the generic the chips which are supported by these drivers, and allow the generic
CFI-compatible drivers to drive the chips. Say 'N' here unless you have CFI-compatible drivers to drive the chips. Say 'N' here unless you have
already tried the CONFIG_JEDEC_PROBE method and reported its failure already tried the CONFIG_JEDECPROBE method and reported its failure
to the MTD mailing list at <linux-mtd@lists.infradead.org> to the MTD mailing list at <linux-mtd@lists.infradead.org>
config MTD_AMDSTD config MTD_AMDSTD
...@@ -209,8 +230,7 @@ config MTD_JEDEC ...@@ -209,8 +230,7 @@ config MTD_JEDEC
programming flash. It is commonly used in older AMD chips. It is programming flash. It is commonly used in older AMD chips. It is
only called JEDEC because the JEDEC association only called JEDEC because the JEDEC association
<http://www.jedec.org/> distributes the identification codes for the <http://www.jedec.org/> distributes the identification codes for the
chips. WARNING!!!! This code does not compile and is incomplete as chips.
are the specific JEDEC devices drivers.
endmenu endmenu
# #
# linux/drivers/chips/Makefile # linux/drivers/chips/Makefile
# #
# $Id: Makefile,v 1.7 2001/10/05 06:53:51 dwmw2 Exp $ # $Id: Makefile.common,v 1.1 2003/05/21 15:00:01 dwmw2 Exp $
# *** BIG UGLY NOTE *** # *** BIG UGLY NOTE ***
# #
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
obj-$(CONFIG_MTD) += chipreg.o obj-$(CONFIG_MTD) += chipreg.o
obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o
obj-$(CONFIG_MTD_CFI) += cfi_probe.o obj-$(CONFIG_MTD_CFI) += cfi_probe.o
obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o
obj-$(CONFIG_MTD_CFI_AMDSTD) += cfi_cmdset_0002.o obj-$(CONFIG_MTD_CFI_AMDSTD) += cfi_cmdset_0002.o
obj-$(CONFIG_MTD_CFI_INTELEXT) += cfi_cmdset_0001.o obj-$(CONFIG_MTD_CFI_INTELEXT) += cfi_cmdset_0001.o
obj-$(CONFIG_MTD_GEN_PROBE) += gen_probe.o obj-$(CONFIG_MTD_GEN_PROBE) += gen_probe.o
obj-$(CONFIG_MTD_INTELPROBE) += intel_probe.o
obj-$(CONFIG_MTD_JEDEC) += jedec.o obj-$(CONFIG_MTD_JEDEC) += jedec.o
obj-$(CONFIG_MTD_JEDECPROBE) += jedec_probe.o obj-$(CONFIG_MTD_JEDECPROBE) += jedec_probe.o
obj-$(CONFIG_MTD_RAM) += map_ram.o obj-$(CONFIG_MTD_RAM) += map_ram.o
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* /*
Common Flash Interface probe code. Common Flash Interface probe code.
(C) 2000 Red Hat. GPL'd. (C) 2000 Red Hat. GPL'd.
$Id: cfi_probe.c,v 1.66 2001/10/02 15:05:12 dwmw2 Exp $ $Id: cfi_probe.c,v 1.71 2003/05/28 12:51:48 dwmw2 Exp $
*/ */
#include <linux/config.h> #include <linux/config.h>
#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 <linux/init.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -24,16 +25,13 @@ ...@@ -24,16 +25,13 @@
static void print_cfi_ident(struct cfi_ident *); static void print_cfi_ident(struct cfi_ident *);
#endif #endif
int cfi_jedec_setup(struct cfi_private *p_cfi, int index);
int cfi_jedec_lookup(int index, int mfr_id, int dev_id);
static int cfi_probe_chip(struct map_info *map, __u32 base, static int cfi_probe_chip(struct map_info *map, __u32 base,
struct flchip *chips, struct cfi_private *cfi); struct flchip *chips, struct cfi_private *cfi);
static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi); static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi);
struct mtd_info *cfi_probe(struct map_info *map); struct mtd_info *cfi_probe(struct map_info *map);
/* check for QRY, or search for jedec id. /* check for QRY.
in: interleave,type,mode in: interleave,type,mode
ret: table index, <0 for error ret: table index, <0 for error
*/ */
...@@ -55,6 +53,18 @@ static int cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -55,6 +53,18 @@ static int cfi_probe_chip(struct map_info *map, __u32 base,
{ {
int i; int i;
if ((base + 0) >= map->size) {
printk(KERN_NOTICE
"Probe at base[0x00](0x%08lx) past the end of the map(0x%08lx)\n",
(unsigned long)base, map->size -1);
return 0;
}
if ((base + 0xff) >= map->size) {
printk(KERN_NOTICE
"Probe at base[0x55](0x%08lx) past the end of the map(0x%08lx)\n",
(unsigned long)base + 0x55, map->size -1);
return 0;
}
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
...@@ -139,7 +149,7 @@ static int cfi_chip_setup(struct map_info *map, ...@@ -139,7 +149,7 @@ static int cfi_chip_setup(struct map_info *map,
memset(cfi->cfiq,0,sizeof(struct cfi_ident)); memset(cfi->cfiq,0,sizeof(struct cfi_ident));
cfi->cfi_mode = 1; cfi->cfi_mode = CFI_MODE_CFI;
cfi->fast_prog=1; /* CFI supports fast programming */ cfi->fast_prog=1; /* CFI supports fast programming */
/* Read the CFI info structure */ /* Read the CFI info structure */
...@@ -250,11 +260,11 @@ static void print_cfi_ident(struct cfi_ident *cfip) ...@@ -250,11 +260,11 @@ static void print_cfi_ident(struct cfi_ident *cfip)
else else
printk("Full buffer write not supported\n"); printk("Full buffer write not supported\n");
printk("Typical block erase timeout: %d s\n", 1<<cfip->BlockEraseTimeoutTyp); printk("Typical block erase timeout: %d ms\n", 1<<cfip->BlockEraseTimeoutTyp);
printk("Maximum block erase timeout: %d s\n", (1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp)); printk("Maximum block erase timeout: %d ms\n", (1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp));
if (cfip->ChipEraseTimeoutTyp || cfip->ChipEraseTimeoutMax) { if (cfip->ChipEraseTimeoutTyp || cfip->ChipEraseTimeoutMax) {
printk("Typical chip erase timeout: %d s\n", 1<<cfip->ChipEraseTimeoutTyp); printk("Typical chip erase timeout: %d ms\n", 1<<cfip->ChipEraseTimeoutTyp);
printk("Maximum chip erase timeout: %d s\n", (1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp)); printk("Maximum chip erase timeout: %d ms\n", (1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp));
} }
else else
printk("Chip erase not supported\n"); printk("Chip erase not supported\n");
......
/* /*
* $Id: chipreg.c,v 1.12 2001/10/02 15:29:53 dwmw2 Exp $ * $Id: chipreg.c,v 1.15 2003/05/21 15:15:05 dwmw2 Exp $
* *
* Registration for chip drivers * Registration for chip drivers
* *
...@@ -7,10 +7,13 @@ ...@@ -7,10 +7,13 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/mtd/compatmac.h> #include <linux/slab.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/compatmac.h>
spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED; spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(chip_drvs_list); static LIST_HEAD(chip_drvs_list);
...@@ -29,7 +32,7 @@ void unregister_mtd_chip_driver(struct mtd_chip_driver *drv) ...@@ -29,7 +32,7 @@ void unregister_mtd_chip_driver(struct mtd_chip_driver *drv)
spin_unlock(&chip_drvs_lock); spin_unlock(&chip_drvs_lock);
} }
static struct mtd_chip_driver *get_mtd_chip_driver (char *name) static struct mtd_chip_driver *get_mtd_chip_driver (const char *name)
{ {
struct list_head *pos; struct list_head *pos;
struct mtd_chip_driver *ret = NULL, *this; struct mtd_chip_driver *ret = NULL, *this;
...@@ -44,10 +47,8 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name) ...@@ -44,10 +47,8 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
break; break;
} }
} }
if (ret && !try_module_get(ret->module)) { if (ret && !try_module_get(ret->module))
/* Eep. Failed. */
ret = NULL; ret = NULL;
}
spin_unlock(&chip_drvs_lock); spin_unlock(&chip_drvs_lock);
...@@ -57,7 +58,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name) ...@@ -57,7 +58,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
/* Hide all the horrid details, like some silly person taking /* Hide all the horrid details, like some silly person taking
get_module_symbol() away from us, from the caller. */ get_module_symbol() away from us, from the caller. */
struct mtd_info *do_map_probe(char *name, struct map_info *map) struct mtd_info *do_map_probe(const char *name, struct map_info *map)
{ {
struct mtd_chip_driver *drv; struct mtd_chip_driver *drv;
struct mtd_info *ret; struct mtd_info *ret;
...@@ -84,10 +85,26 @@ struct mtd_info *do_map_probe(char *name, struct map_info *map) ...@@ -84,10 +85,26 @@ struct mtd_info *do_map_probe(char *name, struct map_info *map)
return NULL; return NULL;
} }
/*
* Destroy an MTD device which was created for a map device.
* Make sure the MTD device is already unregistered before calling this
*/
void map_destroy(struct mtd_info *mtd)
{
struct map_info *map = mtd->priv;
if (map->fldrv->destroy)
map->fldrv->destroy(mtd);
module_put(map->fldrv->module);
kfree(mtd);
}
EXPORT_SYMBOL(register_mtd_chip_driver); EXPORT_SYMBOL(register_mtd_chip_driver);
EXPORT_SYMBOL(unregister_mtd_chip_driver); EXPORT_SYMBOL(unregister_mtd_chip_driver);
EXPORT_SYMBOL(do_map_probe); EXPORT_SYMBOL(do_map_probe);
EXPORT_SYMBOL(map_destroy);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
......
...@@ -2,13 +2,16 @@ ...@@ -2,13 +2,16 @@
* Routines common to all CFI-type probes. * Routines common to all CFI-type probes.
* (C) 2001, 2001 Red Hat, Inc. * (C) 2001, 2001 Red Hat, Inc.
* GPL'd * GPL'd
* $Id: gen_probe.c,v 1.5 2001/10/02 15:05:12 dwmw2 Exp $ * $Id: gen_probe.c,v 1.11 2003/05/21 15:15:05 dwmw2 Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/cfi.h> #include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/gen_probe.h> #include <linux/mtd/gen_probe.h>
static struct mtd_info *check_cmd_set(struct map_info *, int); static struct mtd_info *check_cmd_set(struct map_info *, int);
...@@ -38,7 +41,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp) ...@@ -38,7 +41,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp)
if (mtd) if (mtd)
return mtd; return mtd;
printk(KERN_WARNING"cfi_probe: No supported Vendor Command Set found\n"); printk(KERN_WARNING"gen_probe: No supported Vendor Command Set found\n");
kfree(cfi->cfiq); kfree(cfi->cfiq);
kfree(cfi); kfree(cfi);
...@@ -57,6 +60,7 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe ...@@ -57,6 +60,7 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe
int i; int i;
memset(&cfi, 0, sizeof(cfi)); memset(&cfi, 0, sizeof(cfi));
memset(&chip[0], 0, sizeof(chip));
/* Call the probetype-specific code with all permutations of /* Call the probetype-specific code with all permutations of
interleave and device type, etc. */ interleave and device type, etc. */
...@@ -106,6 +110,12 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe ...@@ -106,6 +110,12 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe
* Now probe for other chips, checking sensibly for aliases while * Now probe for other chips, checking sensibly for aliases while
* we're at it. The new_chip probe above should have let the first * we're at it. The new_chip probe above should have let the first
* chip in read mode. * chip in read mode.
*
* NOTE: Here, we're checking if there is room for another chip
* the same size within the mapping. Therefore,
* base + chipsize <= map->size is the correct thing to do,
* because, base + chipsize would be the _first_ byte of the
* next chip, not the one we're currently pondering.
*/ */
for (base = (1<<cfi.chipshift); base + (1<<cfi.chipshift) <= map->size; for (base = (1<<cfi.chipshift); base + (1<<cfi.chipshift) <= map->size;
...@@ -224,6 +234,41 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp, ...@@ -224,6 +234,41 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp,
break; break;
#endif /* CFIDEV_BUSWIDTH_4 */ #endif /* CFIDEV_BUSWIDTH_4 */
#ifdef CFIDEV_BUSWIDTH_8
case CFIDEV_BUSWIDTH_8:
#if defined(CFIDEV_INTERLEAVE_2) && defined(SOMEONE_ACTUALLY_MAKES_THESE)
cfi->interleave = CFIDEV_INTERLEAVE_2;
cfi->device_type = CFI_DEVICETYPE_X32;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_2 */
#ifdef CFIDEV_INTERLEAVE_4
cfi->interleave = CFIDEV_INTERLEAVE_4;
#ifdef SOMEONE_ACTUALLY_MAKES_THESE
cfi->device_type = CFI_DEVICETYPE_X32;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif
cfi->device_type = CFI_DEVICETYPE_X16;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_4 */
#ifdef CFIDEV_INTERLEAVE_8
cfi->interleave = CFIDEV_INTERLEAVE_8;
cfi->device_type = CFI_DEVICETYPE_X16;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
cfi->device_type = CFI_DEVICETYPE_X8;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_8 */
break;
#endif /* CFIDEV_BUSWIDTH_8 */
default: default:
printk(KERN_WARNING "genprobe_new_chip called with unsupported buswidth %d\n", map->buswidth); printk(KERN_WARNING "genprobe_new_chip called with unsupported buswidth %d\n", map->buswidth);
return 0; return 0;
...@@ -288,6 +333,10 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary) ...@@ -288,6 +333,10 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
#ifdef CONFIG_MTD_CFI_AMDSTD #ifdef CONFIG_MTD_CFI_AMDSTD
case 0x0002: case 0x0002:
return cfi_cmdset_0002(map, primary); return cfi_cmdset_0002(map, primary);
#endif
#ifdef CONFIG_MTD_CFI_STAA
case 0x0020:
return cfi_cmdset_0020(map, primary);
#endif #endif
} }
......
...@@ -11,10 +11,16 @@ ...@@ -11,10 +11,16 @@
* not going to guess how to send commands to them, plus I expect they will * not going to guess how to send commands to them, plus I expect they will
* all speak CFI.. * all speak CFI..
* *
* $Id: jedec.c,v 1.12 2001/11/06 14:37:35 dwmw2 Exp $ * $Id: jedec.c,v 1.18 2003/05/28 12:51:48 dwmw2 Exp $
*/ */
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mtd/jedec.h> #include <linux/mtd/jedec.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/compatmac.h>
static struct mtd_info *jedec_probe(struct map_info *); static struct mtd_info *jedec_probe(struct map_info *);
static int jedec_probe8(struct map_info *map,unsigned long base, static int jedec_probe8(struct map_info *map,unsigned long base,
...@@ -168,7 +174,8 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -168,7 +174,8 @@ static struct mtd_info *jedec_probe(struct map_info *map)
/* Generate a part name that includes the number of different chips and /* Generate a part name that includes the number of different chips and
other configuration information */ other configuration information */
count = 1; count = 1;
strlcpy(Part,map->name,sizeof(Part)-10); strncpy(Part,map->name,sizeof(Part)-10);
Part[sizeof(Part)-11] = 0;
strcat(Part," "); strcat(Part," ");
Uniq = 0; Uniq = 0;
for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++) for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)
...@@ -245,7 +252,8 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -245,7 +252,8 @@ static struct mtd_info *jedec_probe(struct map_info *map)
// printk("Part: '%s'\n",Part); // printk("Part: '%s'\n",Part);
memset(MTD,0,sizeof(*MTD)); memset(MTD,0,sizeof(*MTD));
// strlcpy(MTD->name,Part,sizeof(MTD->name)); // strncpy(MTD->name,Part,sizeof(MTD->name));
// MTD->name[sizeof(MTD->name)-1] = 0;
MTD->name = map->name; MTD->name = map->name;
MTD->type = MTD_NORFLASH; MTD->type = MTD_NORFLASH;
MTD->flags = MTD_CAP_NORFLASH; MTD->flags = MTD_CAP_NORFLASH;
...@@ -264,7 +272,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -264,7 +272,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
MTD->priv = map; MTD->priv = map;
map->fldrv_priv = priv; map->fldrv_priv = priv;
map->fldrv = &jedec_chipdrv; map->fldrv = &jedec_chipdrv;
MOD_INC_USE_COUNT; __module_get(THIS_MODULE);
return MTD; return MTD;
} }
...@@ -386,8 +394,8 @@ static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id) ...@@ -386,8 +394,8 @@ static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id)
static int jedec_probe8(struct map_info *map,unsigned long base, static int jedec_probe8(struct map_info *map,unsigned long base,
struct jedec_private *priv) struct jedec_private *priv)
{ {
#define flread(x) map->read8(map,base+x) #define flread(x) map_read8(map,base+x)
#define flwrite(v,x) map->write8(map,v,base+x) #define flwrite(v,x) map_write8(map,v,base+x)
const unsigned long AutoSel1 = 0xAA; const unsigned long AutoSel1 = 0xAA;
const unsigned long AutoSel2 = 0x55; const unsigned long AutoSel2 = 0x55;
...@@ -446,8 +454,8 @@ static int jedec_probe16(struct map_info *map,unsigned long base, ...@@ -446,8 +454,8 @@ static int jedec_probe16(struct map_info *map,unsigned long base,
static int jedec_probe32(struct map_info *map,unsigned long base, static int jedec_probe32(struct map_info *map,unsigned long base,
struct jedec_private *priv) struct jedec_private *priv)
{ {
#define flread(x) map->read32(map,base+((x)<<2)) #define flread(x) map_read32(map,base+((x)<<2))
#define flwrite(v,x) map->write32(map,v,base+((x)<<2)) #define flwrite(v,x) map_write32(map,v,base+((x)<<2))
const unsigned long AutoSel1 = 0xAAAAAAAA; const unsigned long AutoSel1 = 0xAAAAAAAA;
const unsigned long AutoSel2 = 0x55555555; const unsigned long AutoSel2 = 0x55555555;
...@@ -500,8 +508,8 @@ static int jedec_probe32(struct map_info *map,unsigned long base, ...@@ -500,8 +508,8 @@ static int jedec_probe32(struct map_info *map,unsigned long base,
we call this routine with the JEDEC return still enabled, if two or we call this routine with the JEDEC return still enabled, if two or
more flashes have a truncated address space the probe test will still more flashes have a truncated address space the probe test will still
work */ work */
if (base + Size+0x555 < map->size && if (base + (Size<<2)+0x555 < map->size &&
base + Size+0x555 < (base & (~(my_bank_size-1))) + my_bank_size) base + (Size<<2)+0x555 < (base & (~(my_bank_size-1))) + my_bank_size)
{ {
if (flread(base+Size) != flread(base+Size + 0x100) || if (flread(base+Size) != flread(base+Size + 0x100) ||
flread(base+Size + 1) != flread(base+Size + 0x101)) flread(base+Size + 1) != flread(base+Size + 0x101))
...@@ -525,7 +533,7 @@ static int jedec_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -525,7 +533,7 @@ static int jedec_read(struct mtd_info *mtd, loff_t from, size_t len,
{ {
struct map_info *map = (struct map_info *)mtd->priv; struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len); map_copy_from(map, buf, from, len);
*retlen = len; *retlen = len;
return 0; return 0;
} }
...@@ -549,7 +557,7 @@ static int jedec_read_banked(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -549,7 +557,7 @@ static int jedec_read_banked(struct mtd_info *mtd, loff_t from, size_t len,
get = priv->bank_fill[0] - offset; get = priv->bank_fill[0] - offset;
bank /= priv->bank_fill[0]; bank /= priv->bank_fill[0];
map->copy_from(map,buf + *retlen,bank*my_bank_size + offset,get); map_copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);
len -= get; len -= get;
*retlen += get; *retlen += get;
...@@ -580,8 +588,8 @@ static void jedec_flash_failed(unsigned char code) ...@@ -580,8 +588,8 @@ static void jedec_flash_failed(unsigned char code)
static int flash_erase(struct mtd_info *mtd, struct erase_info *instr) static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
{ {
// Does IO to the currently selected chip // Does IO to the currently selected chip
#define flread(x) map->read8(map,chip->base+((x)<<chip->addrshift)) #define flread(x) map_read8(map,chip->base+((x)<<chip->addrshift))
#define flwrite(v,x) map->write8(map,v,chip->base+((x)<<chip->addrshift)) #define flwrite(v,x) map_write8(map,v,chip->base+((x)<<chip->addrshift))
unsigned long Time = 0; unsigned long Time = 0;
unsigned long NoTime = 0; unsigned long NoTime = 0;
...@@ -686,19 +694,19 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -686,19 +694,19 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
or this is not really flash ;> */ or this is not really flash ;> */
switch (map->buswidth) { switch (map->buswidth) {
case 1: case 1:
Last[0] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off); Last[0] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off); Last[1] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off); Last[2] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
case 2: case 2:
Last[0] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off); Last[0] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off); Last[1] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off); Last[2] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
case 3: case 3:
Last[0] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off); Last[0] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off); Last[1] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off); Last[2] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
} }
Count = 3; Count = 3;
...@@ -734,13 +742,13 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -734,13 +742,13 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
switch (map->buswidth) { switch (map->buswidth) {
case 1: case 1:
Last[Count % 4] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off); Last[Count % 4] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
case 2: case 2:
Last[Count % 4] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off); Last[Count % 4] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
case 4: case 4:
Last[Count % 4] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off); Last[Count % 4] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
break; break;
} }
Count++; Count++;
...@@ -773,6 +781,7 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -773,6 +781,7 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
} }
//printk("done\n"); //printk("done\n");
instr->state = MTD_ERASE_DONE;
if (instr->callback) if (instr->callback)
instr->callback(instr); instr->callback(instr);
return 0; return 0;
...@@ -790,9 +799,9 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len, ...@@ -790,9 +799,9 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
{ {
/* Does IO to the currently selected chip. It takes the bank addressing /* Does IO to the currently selected chip. It takes the bank addressing
base (which is divisible by the chip size) adds the necessary lower bits base (which is divisible by the chip size) adds the necessary lower bits
of addrshift (interleve index) and then adds the control register index. */ of addrshift (interleave index) and then adds the control register index. */
#define flread(x) map->read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift)) #define flread(x) map_read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
#define flwrite(v,x) map->write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift)) #define flwrite(v,x) map_write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
struct map_info *map = (struct map_info *)mtd->priv; struct map_info *map = (struct map_info *)mtd->priv;
struct jedec_private *priv = (struct jedec_private *)map->fldrv_priv; struct jedec_private *priv = (struct jedec_private *)map->fldrv_priv;
...@@ -828,7 +837,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len, ...@@ -828,7 +837,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
// Loop over this page // Loop over this page
for (; off != (chip->size << chip->addrshift) && len != 0; start++, len--, off++,buf++) for (; off != (chip->size << chip->addrshift) && len != 0; start++, len--, off++,buf++)
{ {
unsigned char oldbyte = map->read8(map,base+off); unsigned char oldbyte = map_read8(map,base+off);
unsigned char Last[4]; unsigned char Last[4];
unsigned long Count = 0; unsigned long Count = 0;
...@@ -843,10 +852,10 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len, ...@@ -843,10 +852,10 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
flwrite(0xAA,0x555); flwrite(0xAA,0x555);
flwrite(0x55,0x2AA); flwrite(0x55,0x2AA);
flwrite(0xA0,0x555); flwrite(0xA0,0x555);
map->write8(map,*buf,base + off); map_write8(map,*buf,base + off);
Last[0] = map->read8(map,base + off); Last[0] = map_read8(map,base + off);
Last[1] = map->read8(map,base + off); Last[1] = map_read8(map,base + off);
Last[2] = map->read8(map,base + off); Last[2] = map_read8(map,base + off);
/* Wait for the flash to finish the operation. We store the last 4 /* Wait for the flash to finish the operation. We store the last 4
status bytes that have been retrieved so we can determine why status bytes that have been retrieved so we can determine why
...@@ -854,7 +863,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len, ...@@ -854,7 +863,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
failure */ failure */
for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] && for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] &&
Count < 10000; Count++) Count < 10000; Count++)
Last[Count % 4] = map->read8(map,base + off); Last[Count % 4] = map_read8(map,base + off);
if (Last[(Count - 1) % 4] != *buf) if (Last[(Count - 1) % 4] != *buf)
{ {
jedec_flash_failed(Last[(Count - 3) % 4]); jedec_flash_failed(Last[(Count - 3) % 4]);
......
This diff is collapsed.
/* /*
* Common code to handle absent "placeholder" devices * Common code to handle absent "placeholder" devices
* Copyright 2001 Resilience Corporation <ebrower@resilience.com> * Copyright 2001 Resilience Corporation <ebrower@resilience.com>
* $Id: map_absent.c,v 1.2 2001/10/02 15:05:12 dwmw2 Exp $ * $Id: map_absent.c,v 1.4 2003/05/28 12:51:49 dwmw2 Exp $
* *
* This map driver is used to allocate "placeholder" MTD * This map driver is used to allocate "placeholder" MTD
* devices on systems that have socketed/removable media. * devices on systems that have socketed/removable media.
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
...@@ -36,10 +37,10 @@ static void map_absent_destroy (struct mtd_info *); ...@@ -36,10 +37,10 @@ static void map_absent_destroy (struct mtd_info *);
static struct mtd_chip_driver map_absent_chipdrv = { static struct mtd_chip_driver map_absent_chipdrv = {
.probe = map_absent_probe, .probe = map_absent_probe,
.destroy = map_absent_destroy, .destroy = map_absent_destroy,
.name = "map_absent", .name = "map_absent",
.module = THIS_MODULE .module = THIS_MODULE
}; };
static struct mtd_info *map_absent_probe(struct map_info *map) static struct mtd_info *map_absent_probe(struct map_info *map)
...@@ -65,7 +66,7 @@ static struct mtd_info *map_absent_probe(struct map_info *map) ...@@ -65,7 +66,7 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
mtd->flags = 0; mtd->flags = 0;
mtd->erasesize = PAGE_SIZE; mtd->erasesize = PAGE_SIZE;
MOD_INC_USE_COUNT; __module_get(THIS_MODULE);
return mtd; return mtd;
} }
......
/* /*
* Common code to handle map devices which are simple RAM * Common code to handle map devices which are simple RAM
* (C) 2000 Red Hat. GPL'd. * (C) 2000 Red Hat. GPL'd.
* $Id: map_ram.c,v 1.14 2001/10/02 15:05:12 dwmw2 Exp $ * $Id: map_ram.c,v 1.17 2003/05/28 12:51:49 dwmw2 Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
...@@ -34,21 +36,21 @@ static struct mtd_info *map_ram_probe(struct map_info *map) ...@@ -34,21 +36,21 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
/* Check the first byte is RAM */ /* Check the first byte is RAM */
#if 0 #if 0
map->write8(map, 0x55, 0); map_write8(map, 0x55, 0);
if (map->read8(map, 0) != 0x55) if (map_read8(map, 0) != 0x55)
return NULL; return NULL;
map->write8(map, 0xAA, 0); map_write8(map, 0xAA, 0);
if (map->read8(map, 0) != 0xAA) if (map_read8(map, 0) != 0xAA)
return NULL; return NULL;
/* Check the last byte is RAM */ /* Check the last byte is RAM */
map->write8(map, 0x55, map->size-1); map_write8(map, 0x55, map->size-1);
if (map->read8(map, map->size-1) != 0x55) if (map_read8(map, map->size-1) != 0x55)
return NULL; return NULL;
map->write8(map, 0xAA, map->size-1); map_write8(map, 0xAA, map->size-1);
if (map->read8(map, map->size-1) != 0xAA) if (map_read8(map, map->size-1) != 0xAA)
return NULL; return NULL;
#endif #endif
/* OK. It seems to be RAM. */ /* OK. It seems to be RAM. */
...@@ -74,7 +76,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map) ...@@ -74,7 +76,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
while(mtd->size & (mtd->erasesize - 1)) while(mtd->size & (mtd->erasesize - 1))
mtd->erasesize >>= 1; mtd->erasesize >>= 1;
MOD_INC_USE_COUNT; __module_get(THIS_MODULE);
return mtd; return mtd;
} }
...@@ -83,7 +85,7 @@ static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r ...@@ -83,7 +85,7 @@ static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
{ {
struct map_info *map = (struct map_info *)mtd->priv; struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len); map_copy_from(map, buf, from, len);
*retlen = len; *retlen = len;
return 0; return 0;
} }
...@@ -92,7 +94,7 @@ static int mapram_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re ...@@ -92,7 +94,7 @@ static int mapram_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
{ {
struct map_info *map = (struct map_info *)mtd->priv; struct map_info *map = (struct map_info *)mtd->priv;
map->copy_to(map, to, buf, len); map_copy_to(map, to, buf, len);
*retlen = len; *retlen = len;
return 0; return 0;
} }
...@@ -105,7 +107,7 @@ static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr) ...@@ -105,7 +107,7 @@ static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr)
unsigned long i; unsigned long i;
for (i=0; i<instr->len; i++) for (i=0; i<instr->len; i++)
map->write8(map, 0xFF, instr->addr + i); map_write8(map, 0xFF, instr->addr + i);
if (instr->callback) if (instr->callback)
instr->callback(instr); instr->callback(instr);
......
/* /*
* Common code to handle map devices which are simple ROM * Common code to handle map devices which are simple ROM
* (C) 2000 Red Hat. GPL'd. * (C) 2000 Red Hat. GPL'd.
* $Id: map_rom.c,v 1.17 2001/10/02 15:05:12 dwmw2 Exp $ * $Id: map_rom.c,v 1.20 2003/05/28 12:51:49 dwmw2 Exp $
*/ */
#include <linux/version.h> #include <linux/version.h>
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
...@@ -49,7 +51,7 @@ struct mtd_info *map_rom_probe(struct map_info *map) ...@@ -49,7 +51,7 @@ struct mtd_info *map_rom_probe(struct map_info *map)
while(mtd->size & (mtd->erasesize - 1)) while(mtd->size & (mtd->erasesize - 1))
mtd->erasesize >>= 1; mtd->erasesize >>= 1;
MOD_INC_USE_COUNT; __module_get(THIS_MODULE);
return mtd; return mtd;
} }
...@@ -58,7 +60,7 @@ static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r ...@@ -58,7 +60,7 @@ static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
{ {
struct map_info *map = (struct map_info *)mtd->priv; struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len); map_copy_from(map, buf, from, len);
*retlen = len; *retlen = len;
return 0; return 0;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright 2000,2001 David A. Schleef <ds@schleef.org> * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
* 2000,2001 Lineo, Inc. * 2000,2001 Lineo, Inc.
* *
* $Id: sharp.c,v 1.6 2001/10/02 15:05:12 dwmw2 Exp $ * $Id: sharp.c,v 1.12 2003/05/28 15:39:52 dwmw2 Exp $
* *
* Devices supported: * Devices supported:
* LH28F016SCT Symmetrical block flash memory, 2Mx8 * LH28F016SCT Symmetrical block flash memory, 2Mx8
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/cfi.h> #include <linux/mtd/cfi.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -165,12 +166,12 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) ...@@ -165,12 +166,12 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
u32 read0, read4; u32 read0, read4;
int width = 4; int width = 4;
tmp = map->read32(map, base+0); tmp = map_read32(map, base+0);
map->write32(map, CMD_READ_ID, base+0); map_write32(map, CMD_READ_ID, base+0);
read0=map->read32(map, base+0); read0=map_read32(map, base+0);
read4=map->read32(map, base+4); read4=map_read32(map, base+4);
if(read0 == 0x89898989){ if(read0 == 0x89898989){
printk("Looks like sharp flash\n"); printk("Looks like sharp flash\n");
switch(read4){ switch(read4){
...@@ -198,10 +199,10 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) ...@@ -198,10 +199,10 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n", printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n",
read0,read4); read0,read4);
} }
}else if((map->read32(map, base+0) == CMD_READ_ID)){ }else if((map_read32(map, base+0) == CMD_READ_ID)){
/* RAM, probably */ /* RAM, probably */
printk("Looks like RAM\n"); printk("Looks like RAM\n");
map->write32(map, tmp, base+0); map_write32(map, tmp, base+0);
}else{ }else{
printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n", printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n",
read0,read4); read0,read4);
...@@ -223,10 +224,10 @@ static int sharp_wait(struct map_info *map, struct flchip *chip) ...@@ -223,10 +224,10 @@ static int sharp_wait(struct map_info *map, struct flchip *chip)
switch(chip->state){ switch(chip->state){
case FL_READY: case FL_READY:
map->write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
case FL_STATUS: case FL_STATUS:
status = map->read32(map,adr); status = map_read32(map,adr);
//printk("status=%08x\n",status); //printk("status=%08x\n",status);
udelay(100); udelay(100);
...@@ -254,7 +255,7 @@ static int sharp_wait(struct map_info *map, struct flchip *chip) ...@@ -254,7 +255,7 @@ static int sharp_wait(struct map_info *map, struct flchip *chip)
goto retry; goto retry;
} }
map->write32(map,CMD_RESET, adr); map_write32(map,CMD_RESET, adr);
chip->state = FL_READY; chip->state = FL_READY;
...@@ -295,7 +296,7 @@ static int sharp_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -295,7 +296,7 @@ static int sharp_read(struct mtd_info *mtd, loff_t from, size_t len,
if(ret<0) if(ret<0)
break; break;
map->copy_from(map,buf,ofs,thislen); map_copy_from(map,buf,ofs,thislen);
sharp_release(&sharp->chips[chipnum]); sharp_release(&sharp->chips[chipnum]);
...@@ -356,17 +357,17 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip, ...@@ -356,17 +357,17 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip,
ret = sharp_wait(map,chip); ret = sharp_wait(map,chip);
for(try=0;try<10;try++){ for(try=0;try<10;try++){
map->write32(map,CMD_BYTE_WRITE,adr); map_write32(map,CMD_BYTE_WRITE,adr);
/* cpu_to_le32 -> hack to fix the writel be->le conversion */ /* cpu_to_le32 -> hack to fix the writel be->le conversion */
map->write32(map,cpu_to_le32(datum),adr); map_write32(map,cpu_to_le32(datum),adr);
chip->state = FL_WRITING; chip->state = FL_WRITING;
timeo = jiffies + (HZ/2); timeo = jiffies + (HZ/2);
map->write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
for(i=0;i<100;i++){ for(i=0;i<100;i++){
status = map->read32(map,adr); status = map_read32(map,adr);
if((status & SR_READY)==SR_READY) if((status & SR_READY)==SR_READY)
break; break;
} }
...@@ -379,9 +380,9 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip, ...@@ -379,9 +380,9 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip,
printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status); printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status);
map->write32(map,CMD_CLEAR_STATUS,adr); map_write32(map,CMD_CLEAR_STATUS,adr);
} }
map->write32(map,CMD_RESET,adr); map_write32(map,CMD_RESET,adr);
chip->state = FL_READY; chip->state = FL_READY;
wake_up(&chip->wq); wake_up(&chip->wq);
...@@ -423,6 +424,7 @@ static int sharp_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -423,6 +424,7 @@ static int sharp_erase(struct mtd_info *mtd, struct erase_info *instr)
} }
} }
instr->state = MTD_ERASE_DONE;
if(instr->callback) if(instr->callback)
instr->callback(instr); instr->callback(instr);
...@@ -433,18 +435,18 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip, ...@@ -433,18 +435,18 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip,
unsigned long adr) unsigned long adr)
{ {
int ret; int ret;
unsigned long timeo; int timeo;
int status; int status;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
map->write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
status = map->read32(map,adr); status = map_read32(map,adr);
timeo = jiffies + HZ; timeo = jiffies + HZ;
while(time_before(jiffies, timeo)){ while(time_before(jiffies, timeo)){
map->write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
status = map->read32(map,adr); status = map_read32(map,adr);
if((status & SR_READY)==SR_READY){ if((status & SR_READY)==SR_READY){
ret = 0; ret = 0;
goto out; goto out;
...@@ -486,26 +488,26 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip, ...@@ -486,26 +488,26 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip,
sharp_unlock_oneblock(map,chip,adr); sharp_unlock_oneblock(map,chip,adr);
#endif #endif
map->write32(map,CMD_BLOCK_ERASE_1,adr); map_write32(map,CMD_BLOCK_ERASE_1,adr);
map->write32(map,CMD_BLOCK_ERASE_2,adr); map_write32(map,CMD_BLOCK_ERASE_2,adr);
chip->state = FL_ERASING; chip->state = FL_ERASING;
ret = sharp_do_wait_for_ready(map,chip,adr); ret = sharp_do_wait_for_ready(map,chip,adr);
if(ret<0)return ret; if(ret<0)return ret;
map->write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
status = map->read32(map,adr); status = map_read32(map,adr);
if(!(status&SR_ERRORS)){ if(!(status&SR_ERRORS)){
map->write32(map,CMD_RESET,adr); map_write32(map,CMD_RESET,adr);
chip->state = FL_READY; chip->state = FL_READY;
//spin_unlock_bh(chip->mutex); //spin_unlock_bh(chip->mutex);
return 0; return 0;
} }
printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status); printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status);
map->write32(map,CMD_CLEAR_STATUS,adr); map_write32(map,CMD_CLEAR_STATUS,adr);
//spin_unlock_bh(chip->mutex); //spin_unlock_bh(chip->mutex);
...@@ -519,17 +521,17 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -519,17 +521,17 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
int i; int i;
int status; int status;
map->write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr); map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr);
map->write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr); map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr);
udelay(100); udelay(100);
status = map->read32(map,adr); status = map_read32(map,adr);
printk("status=%08x\n",status); printk("status=%08x\n",status);
for(i=0;i<1000;i++){ for(i=0;i<1000;i++){
//map->write32(map,CMD_READ_STATUS,adr); //map_write32(map,CMD_READ_STATUS,adr);
status = map->read32(map,adr); status = map_read32(map,adr);
if((status & SR_READY)==SR_READY) if((status & SR_READY)==SR_READY)
break; break;
udelay(100); udelay(100);
...@@ -539,13 +541,13 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -539,13 +541,13 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
} }
if(!(status&SR_ERRORS)){ if(!(status&SR_ERRORS)){
map->write32(map,CMD_RESET,adr); map_write32(map,CMD_RESET,adr);
chip->state = FL_READY; chip->state = FL_READY;
return; return;
} }
printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status); printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status);
map->write32(map,CMD_CLEAR_STATUS,adr); map_write32(map,CMD_CLEAR_STATUS,adr);
} }
#endif #endif
......
/* /*
* $Id: cmdline.c,v 1.5 2002/11/06 22:40:04 rmk Exp $ * $Id: cmdlinepart.c,v 1.9 2003/05/16 17:08:24 dwmw2 Exp $
* *
* Read flash partition table from command line * Read flash partition table from command line
* *
...@@ -92,11 +92,6 @@ static struct mtd_partition * newpart(char *s, ...@@ -92,11 +92,6 @@ static struct mtd_partition * newpart(char *s,
else else
{ {
size = memparse(s, &s); size = memparse(s, &s);
if (!size)
{
printk(KERN_ERR ERRP "couldn't parse number from input string\n");
return 0;
}
if (size < PAGE_SIZE) if (size < PAGE_SIZE)
{ {
printk(KERN_ERR ERRP "partition size too small (%lx)\n", size); printk(KERN_ERR ERRP "partition size too small (%lx)\n", size);
...@@ -112,17 +107,13 @@ static struct mtd_partition * newpart(char *s, ...@@ -112,17 +107,13 @@ static struct mtd_partition * newpart(char *s,
{ {
s++; s++;
offset = memparse(s, &s); offset = memparse(s, &s);
if (!offset)
{
printk(KERN_ERR ERRP "couldn't parse number from input string\n");
return 0;
}
} }
/* now look for name */ /* now look for name */
if (*s == '(') if (*s == '(')
{ {
delim = ')'; delim = ')';
} }
if (delim) if (delim)
{ {
char *p; char *p;
...@@ -295,17 +286,19 @@ static int mtdpart_setup_real(char *s) ...@@ -295,17 +286,19 @@ static int mtdpart_setup_real(char *s)
* Main function to be called from the MTD mapping driver/device to * Main function to be called from the MTD mapping driver/device to
* obtain the partitioning information. At this point the command line * obtain the partitioning information. At this point the command line
* arguments will actually be parsed and turned to struct mtd_partition * arguments will actually be parsed and turned to struct mtd_partition
* information. * information. It returns partitions for the requested mtd device, or
* the first one in the chain if a NULL mtd_id is passed in.
*/ */
int parse_cmdline_partitions(struct mtd_info *master, static int parse_cmdline_partitions(struct mtd_info *master,
struct mtd_partition **pparts, struct mtd_partition **pparts,
const char *mtd_id) unsigned long origin)
{ {
unsigned long offset; unsigned long offset;
int i; int i;
struct cmdline_mtd_partition *part; struct cmdline_mtd_partition *part;
char *mtd_id = master->name;
if (!cmdline) if(!cmdline)
return -EINVAL; return -EINVAL;
/* parse command line */ /* parse command line */
...@@ -314,7 +307,7 @@ int parse_cmdline_partitions(struct mtd_info *master, ...@@ -314,7 +307,7 @@ int parse_cmdline_partitions(struct mtd_info *master,
for(part = partitions; part; part = part->next) for(part = partitions; part; part = part->next)
{ {
if (!strcmp(part->mtd_id, mtd_id)) if ((!mtd_id) || (!strcmp(part->mtd_id, mtd_id)))
{ {
for(i = 0, offset = 0; i < part->num_parts; i++) for(i = 0, offset = 0; i < part->num_parts; i++)
{ {
...@@ -328,7 +321,7 @@ int parse_cmdline_partitions(struct mtd_info *master, ...@@ -328,7 +321,7 @@ int parse_cmdline_partitions(struct mtd_info *master,
{ {
printk(KERN_WARNING ERRP printk(KERN_WARNING ERRP
"%s: partitioning exceeds flash size, truncating\n", "%s: partitioning exceeds flash size, truncating\n",
mtd_id); part->mtd_id);
part->parts[i].size = master->size - offset; part->parts[i].size = master->size - offset;
part->num_parts = i; part->num_parts = i;
} }
...@@ -355,7 +348,25 @@ static int __init mtdpart_setup(char *s) ...@@ -355,7 +348,25 @@ static int __init mtdpart_setup(char *s)
__setup("mtdparts=", mtdpart_setup); __setup("mtdparts=", mtdpart_setup);
EXPORT_SYMBOL(parse_cmdline_partitions); static struct mtd_part_parser cmdline_parser = {
.owner = THIS_MODULE,
.parse_fn = parse_cmdline_partitions,
.name = "cmdlinepart",
};
static int __init cmdline_parser_init(void)
{
return register_mtd_parser(&cmdline_parser);
}
static void __exit cmdline_parser_exit(void)
{
deregister_mtd_parser(&cmdline_parser);
}
module_init(cmdline_parser_init);
module_exit(cmdline_parser_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>"); MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
......
# drivers/mtd/maps/Config.in # drivers/mtd/maps/Kconfig
# $Id: Config.in,v 1.5 2001/09/23 15:33:10 dwmw2 Exp $ # $Id: Kconfig,v 1.4 2003/05/28 15:18:54 dwmw2 Exp $
menu "Self-contained MTD device drivers" menu "Self-contained MTD device drivers"
depends on MTD!=n depends on MTD!=n
...@@ -38,6 +38,12 @@ config MTD_PMC551_DEBUG ...@@ -38,6 +38,12 @@ config MTD_PMC551_DEBUG
is only really useful if you are developing on this driver or is only really useful if you are developing on this driver or
suspect a possible hardware or driver bug. If unsure say N. suspect a possible hardware or driver bug. If unsure say N.
config MTD_MS02NV
tristate "DEC MS02-NV NVRAM module support"
depends on CONFIG_DECSTATION
help
Support for NVRAM module on DECstation.
config MTD_SLRAM config MTD_SLRAM
tristate "Uncached system RAM" tristate "Uncached system RAM"
depends on MTD depends on MTD
...@@ -108,13 +114,6 @@ config MTD_BLKMTD ...@@ -108,13 +114,6 @@ config MTD_BLKMTD
comment "Disk-On-Chip Device Drivers" comment "Disk-On-Chip Device Drivers"
config MTD_DOC1000
tristate "M-Systems Disk-On-Chip 1000"
depends on MTD
help
This provides an MTD device driver for the M-Systems DiskOnChip
1000 devices, which are obsolete so you probably want to say 'N'.
config MTD_DOC2000 config MTD_DOC2000
tristate "M-Systems Disk-On-Chip 2000 and Millennium" tristate "M-Systems Disk-On-Chip 2000 and Millennium"
depends on MTD depends on MTD
...@@ -148,10 +147,22 @@ config MTD_DOC2001 ...@@ -148,10 +147,22 @@ config MTD_DOC2001
emulate a block device by using a kind of file system on the flash emulate a block device by using a kind of file system on the flash
chips. chips.
config MTD_DOC2001PLUS
tristate "M-Systems Disk-On-Chip Millennium Plus"
depends on MTD
---help---
This provides an MTD device driver for the M-Systems DiskOnChip
Millennium Plus devices.
If you use this device, you probably also want to enable the INFTL
'Inverse NAND Flash Translation Layer' option below, which is used
to emulate a block device by using a kind of file system on the
flash chips.
config MTD_DOCPROBE config MTD_DOCPROBE
tristate tristate
default m if MTD_DOC2001!=y && MTD_DOC2000!=y && (MTD_DOC2001=m || MTD_DOC2000=m) default m if MTD_DOC2001!=y && MTD_DOC2000!=y && MTD_DOC2001PLUS!=y && (MTD_DOC2001=m || MTD_DOC2000=m || MOD_DOC2001PLUS=m)
default y if MTD_DOC2001=y || MTD_DOC2000=y default y if MTD_DOC2001=y || MTD_DOC2000=y || MTD_DOC2001PLUS=y
help help
This isn't a real config option, it's derived. This isn't a real config option, it's derived.
...@@ -200,7 +211,7 @@ config MTD_DOCPROBE_55AA ...@@ -200,7 +211,7 @@ config MTD_DOCPROBE_55AA
continue with probing if it is absent. The signature will always be continue with probing if it is absent. The signature will always be
present for a DiskOnChip 2000 or a normal DiskOnChip Millennium. present for a DiskOnChip 2000 or a normal DiskOnChip Millennium.
Only if you have overwritten the first block of a DiskOnChip Only if you have overwritten the first block of a DiskOnChip
Millennium will it be absent. Enable this option if you are using Millennium will it be absent. Enable this option if you are using
LinuxBIOS or if you need to recover a DiskOnChip Millennium on which LinuxBIOS or if you need to recover a DiskOnChip Millennium on which
you have managed to wipe the first block. you have managed to wipe the first block.
......
# #
# linux/drivers/devices/Makefile # linux/drivers/devices/Makefile
# #
# $Id: Makefile,v 1.4 2001/06/26 21:10:05 spse Exp $ # $Id: Makefile.common,v 1.3 2003/05/28 10:54:23 dwmw2 Exp $
# *** BIG UGLY NOTE *** # *** BIG UGLY NOTE ***
# #
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
# here where previously there was none. We now have to ensure that # here where previously there was none. We now have to ensure that
# doc200[01].o are linked before docprobe.o # doc200[01].o are linked before docprobe.o
obj-$(CONFIG_MTD_DOC1000) += doc1000.o
obj-$(CONFIG_MTD_DOC2000) += doc2000.o obj-$(CONFIG_MTD_DOC2000) += doc2000.o
obj-$(CONFIG_MTD_DOC2001) += doc2001.o obj-$(CONFIG_MTD_DOC2001) += doc2001.o
obj-$(CONFIG_MTD_DOC2001PLUS) += doc2001plus.o
obj-$(CONFIG_MTD_DOCPROBE) += docprobe.o docecc.o obj-$(CONFIG_MTD_DOCPROBE) += docprobe.o docecc.o
obj-$(CONFIG_MTD_SLRAM) += slram.o obj-$(CONFIG_MTD_SLRAM) += slram.o
obj-$(CONFIG_MTD_PMC551) += pmc551.o obj-$(CONFIG_MTD_PMC551) += pmc551.o
obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o
obj-$(CONFIG_MTD_MTDRAM) += mtdram.o obj-$(CONFIG_MTD_MTDRAM) += mtdram.o
obj-$(CONFIG_MTD_LART) += lart.o obj-$(CONFIG_MTD_LART) += lart.o
obj-$(CONFIG_MTD_BLKMTD) += blkmtd.o obj-$(CONFIG_MTD_BLKMTD) += blkmtd.o
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc. * (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
* *
* $Id: doc2000.c,v 1.46 2001/10/02 15:05:13 dwmw2 Exp $ * $Id: doc2000.c,v 1.52 2003/05/20 21:03:07 dwmw2 Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ids.h>
#include <linux/mtd/doc2000.h> #include <linux/mtd/doc2000.h>
#define DOC_SUPPORT_2000 #define DOC_SUPPORT_2000
...@@ -54,9 +53,9 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -54,9 +53,9 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, static int doc_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);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf); size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf); size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel);
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf); size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
...@@ -97,12 +96,8 @@ static int _DoC_WaitReady(struct DiskOnChip *doc) ...@@ -97,12 +96,8 @@ static int _DoC_WaitReady(struct DiskOnChip *doc)
DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n"); DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n");
return -EIO; return -EIO;
} }
if (need_resched()) { udelay(1);
set_current_state(TASK_UNINTERRUPTIBLE); cond_resched();
schedule_timeout(1);
}
else
udelay(1);
} }
return 0; return 0;
...@@ -320,7 +315,7 @@ static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor) ...@@ -320,7 +315,7 @@ static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor)
static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
{ {
int mfr, id, i; int mfr, id, i, j;
volatile char dummy; volatile char dummy;
/* Page in the required floor/chip */ /* Page in the required floor/chip */
...@@ -378,12 +373,16 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -378,12 +373,16 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
/* Print and store the manufacturer and ID codes. */ /* Print and store the manufacturer and ID codes. */
for (i = 0; nand_flash_ids[i].name != NULL; i++) { for (i = 0; nand_flash_ids[i].name != NULL; i++) {
if (mfr == nand_flash_ids[i].manufacture_id && if (id == nand_flash_ids[i].id) {
id == nand_flash_ids[i].model_id) { /* Try to identify manufacturer */
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
if (nand_manuf_ids[j].id == mfr)
break;
}
printk(KERN_INFO printk(KERN_INFO
"Flash chip found: Manufacturer ID: %2.2X, " "Flash chip found: Manufacturer ID: %2.2X, "
"Chip ID: %2.2X (%s)\n", mfr, id, "Chip ID: %2.2X (%s:%s)\n", mfr, id,
nand_flash_ids[i].name); nand_manuf_ids[j].name, nand_flash_ids[i].name);
if (!doc->mfr) { if (!doc->mfr) {
doc->mfr = mfr; doc->mfr = mfr;
doc->id = id; doc->id = id;
...@@ -391,7 +390,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -391,7 +390,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
nand_flash_ids[i].chipshift; nand_flash_ids[i].chipshift;
doc->page256 = nand_flash_ids[i].page256; doc->page256 = nand_flash_ids[i].page256;
doc->pageadrlen = doc->pageadrlen =
nand_flash_ids[i].pageadrlen; nand_flash_ids[i].chipshift > 25 ? 3 : 2;
doc->erasesize = doc->erasesize =
nand_flash_ids[i].erasesize; nand_flash_ids[i].erasesize;
return 1; return 1;
...@@ -558,7 +557,7 @@ static void DoC2k_init(struct mtd_info *mtd) ...@@ -558,7 +557,7 @@ static void DoC2k_init(struct mtd_info *mtd)
mtd->erasesize = 0; mtd->erasesize = 0;
mtd->oobblock = 512; mtd->oobblock = 512;
mtd->oobsize = 16; mtd->oobsize = 16;
mtd->module = THIS_MODULE; mtd->owner = THIS_MODULE;
mtd->erase = doc_erase; mtd->erase = doc_erase;
mtd->point = NULL; mtd->point = NULL;
mtd->unpoint = NULL; mtd->unpoint = NULL;
...@@ -597,11 +596,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -597,11 +596,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t * retlen, u_char * buf) size_t * retlen, u_char * buf)
{ {
/* Just a special case of doc_read_ecc */ /* Just a special case of doc_read_ecc */
return doc_read_ecc(mtd, from, len, retlen, buf, NULL); return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0);
} }
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t * retlen, u_char * buf, u_char * eccbuf) size_t * retlen, u_char * buf, u_char * eccbuf, int oobsel)
{ {
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv; struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
unsigned long docptr; unsigned long docptr;
...@@ -745,12 +744,12 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -745,12 +744,12 @@ static int doc_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)
{ {
char eccbuf[6]; char eccbuf[6];
return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf); return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0);
} }
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t * retlen, const u_char * buf, size_t * retlen, const u_char * buf,
u_char * eccbuf) u_char * eccbuf, int oobsel)
{ {
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv; struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */ int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc. * (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
* *
* $Id: doc2001.c,v 1.35 2001/10/02 15:05:13 dwmw2 Exp $ * $Id: doc2001.c,v 1.40 2003/05/20 21:03:07 dwmw2 Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ids.h>
#include <linux/mtd/doc2000.h> #include <linux/mtd/doc2000.h>
/* #define ECC_DEBUG */ /* #define ECC_DEBUG */
...@@ -38,9 +37,9 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -38,9 +37,9 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, static int doc_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);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf); size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf); size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel);
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf); size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
...@@ -182,7 +181,7 @@ static int DoC_SelectFloor(unsigned long docptr, int floor) ...@@ -182,7 +181,7 @@ static int DoC_SelectFloor(unsigned long docptr, int floor)
/* DoC_IdentChip: Identify a given NAND chip given {floor,chip} */ /* DoC_IdentChip: Identify a given NAND chip given {floor,chip} */
static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
{ {
int mfr, id, i; int mfr, id, i, j;
volatile char dummy; volatile char dummy;
/* Page in the required floor/chip /* Page in the required floor/chip
...@@ -216,11 +215,15 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -216,11 +215,15 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
/* FIXME: to deal with multi-flash on multi-Millennium case more carefully */ /* FIXME: to deal with multi-flash on multi-Millennium case more carefully */
for (i = 0; nand_flash_ids[i].name != NULL; i++) { for (i = 0; nand_flash_ids[i].name != NULL; i++) {
if (mfr == nand_flash_ids[i].manufacture_id && if ( id == nand_flash_ids[i].id) {
id == nand_flash_ids[i].model_id) { /* Try to identify manufacturer */
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
if (nand_manuf_ids[j].id == mfr)
break;
}
printk(KERN_INFO "Flash chip found: Manufacturer ID: %2.2X, " printk(KERN_INFO "Flash chip found: Manufacturer ID: %2.2X, "
"Chip ID: %2.2X (%s)\n", "Chip ID: %2.2X (%s:%s)\n",
mfr, id, nand_flash_ids[i].name); mfr, id, nand_manuf_ids[j].name, nand_flash_ids[i].name);
doc->mfr = mfr; doc->mfr = mfr;
doc->id = id; doc->id = id;
doc->chipshift = nand_flash_ids[i].chipshift; doc->chipshift = nand_flash_ids[i].chipshift;
...@@ -363,7 +366,7 @@ static void DoCMil_init(struct mtd_info *mtd) ...@@ -363,7 +366,7 @@ static void DoCMil_init(struct mtd_info *mtd)
mtd->oobblock = 512; mtd->oobblock = 512;
mtd->oobsize = 16; mtd->oobsize = 16;
mtd->module = THIS_MODULE; mtd->owner = THIS_MODULE;
mtd->erase = doc_erase; mtd->erase = doc_erase;
mtd->point = NULL; mtd->point = NULL;
mtd->unpoint = NULL; mtd->unpoint = NULL;
...@@ -399,11 +402,11 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, ...@@ -399,11 +402,11 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf) size_t *retlen, u_char *buf)
{ {
/* Just a special case of doc_read_ecc */ /* Just a special case of doc_read_ecc */
return doc_read_ecc(mtd, from, len, retlen, buf, NULL); return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0);
} }
static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf) size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel)
{ {
int i, ret; int i, ret;
volatile char dummy; volatile char dummy;
...@@ -525,11 +528,11 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, ...@@ -525,11 +528,11 @@ static int doc_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)
{ {
char eccbuf[6]; char eccbuf[6];
return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf); return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0);
} }
static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf) size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel)
{ {
int i,ret = 0; int i,ret = 0;
volatile char dummy; volatile char dummy;
......
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.
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.
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.
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