Commit b3ce1deb authored by Linus Torvalds's avatar Linus Torvalds

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

Some manual fixups for clashing kfree() cleanups etc.
parents 5b2f7ffc c2965f11
# $Id: Kconfig,v 1.7 2004/11/22 11:33:56 ijc Exp $ # $Id: Kconfig,v 1.11 2005/11/07 11:14:19 gleixner Exp $
menu "Memory Technology Devices (MTD)" menu "Memory Technology Devices (MTD)"
...@@ -10,7 +10,7 @@ config MTD ...@@ -10,7 +10,7 @@ config MTD
will provide the generic support for MTD drivers to register will provide the generic support for MTD drivers to register
themselves with the kernel and for potential users of MTD devices themselves with the kernel and for potential users of MTD devices
to enumerate the devices which are present and obtain a handle on to enumerate the devices which are present and obtain a handle on
them. It will also allow you to select individual drivers for them. It will also allow you to select individual drivers for
particular hardware and users of MTD devices. If unsure, say N. particular hardware and users of MTD devices. If unsure, say N.
config MTD_DEBUG config MTD_DEBUG
...@@ -61,11 +61,11 @@ config MTD_REDBOOT_PARTS ...@@ -61,11 +61,11 @@ config MTD_REDBOOT_PARTS
If you need code which can detect and parse this table, and register If you need code which can detect and parse this table, and register
MTD 'partitions' corresponding to each image in the table, enable MTD 'partitions' corresponding to each image in the table, enable
this option. this option.
You will still need the parsing functions to be called by the driver You will still need the parsing functions to be called by the driver
for your particular device. It won't happen automatically. The for your particular device. It won't happen automatically. The
SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for
example. example.
config MTD_REDBOOT_DIRECTORY_BLOCK config MTD_REDBOOT_DIRECTORY_BLOCK
...@@ -81,10 +81,10 @@ config MTD_REDBOOT_DIRECTORY_BLOCK ...@@ -81,10 +81,10 @@ config MTD_REDBOOT_DIRECTORY_BLOCK
partition table. A zero or positive value gives an absolete partition table. A zero or positive value gives an absolete
erase block number. A negative value specifies a number of erase block number. A negative value specifies a number of
sectors before the end of the device. sectors before the end of the device.
For example "2" means block number 2, "-1" means the last For example "2" means block number 2, "-1" means the last
block and "-2" means the penultimate block. block and "-2" means the penultimate block.
config MTD_REDBOOT_PARTS_UNALLOCATED config MTD_REDBOOT_PARTS_UNALLOCATED
bool " Include unallocated flash regions" bool " Include unallocated flash regions"
depends on MTD_REDBOOT_PARTS depends on MTD_REDBOOT_PARTS
...@@ -105,11 +105,11 @@ config MTD_CMDLINE_PARTS ...@@ -105,11 +105,11 @@ config MTD_CMDLINE_PARTS
---help--- ---help---
Allow generic configuration of the MTD paritition tables via the kernel Allow generic configuration of the MTD paritition tables via the kernel
command line. Multiple flash resources are supported for hardware where command line. Multiple flash resources are supported for hardware where
different kinds of flash memory are available. different kinds of flash memory are available.
You will still need the parsing functions to be called by the driver You will still need the parsing functions to be called by the driver
for your particular device. It won't happen automatically. The for your particular device. It won't happen automatically. The
SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for
example. example.
The format for the command line is as follows: The format for the command line is as follows:
...@@ -118,12 +118,12 @@ config MTD_CMDLINE_PARTS ...@@ -118,12 +118,12 @@ config MTD_CMDLINE_PARTS
<mtddef> := <mtd-id>:<partdef>[,<partdef>] <mtddef> := <mtd-id>:<partdef>[,<partdef>]
<partdef> := <size>[@offset][<name>][ro] <partdef> := <size>[@offset][<name>][ro]
<mtd-id> := unique id used in mapping driver/device <mtd-id> := unique id used in mapping driver/device
<size> := standard linux memsize OR "-" to denote all <size> := standard linux memsize OR "-" to denote all
remaining space remaining space
<name> := (NAME) <name> := (NAME)
Due to the way Linux handles the command line, no spaces are Due to the way Linux handles the command line, no spaces are
allowed in the partition definition, including mtd id's and partition allowed in the partition definition, including mtd id's and partition
names. names.
Examples: Examples:
...@@ -240,7 +240,7 @@ config INFTL ...@@ -240,7 +240,7 @@ config INFTL
tristate "INFTL (Inverse NAND Flash Translation Layer) support" tristate "INFTL (Inverse NAND Flash Translation Layer) support"
depends on MTD depends on MTD
---help--- ---help---
This provides support for the Inverse NAND Flash Translation This provides support for the Inverse NAND Flash Translation
Layer which is used on M-Systems' newer DiskOnChip devices. It Layer which is used on M-Systems' newer DiskOnChip devices. It
uses a kind of pseudo-file system on a flash device to emulate 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 block device with 512-byte sectors, on top of which you put
...@@ -253,6 +253,16 @@ config INFTL ...@@ -253,6 +253,16 @@ config INFTL
permitted to copy, modify and distribute the code as you wish. Just permitted to copy, modify and distribute the code as you wish. Just
not use it. not use it.
config RFD_FTL
tristate "Resident Flash Disk (Flash Translation Layer) support"
depends on MTD
---help---
This provides support for the flash translation layer known
as the Resident Flash Disk (RFD), as used by the Embedded BIOS
of General Software. There is a blurb at:
http://www.gensw.com/pages/prod/bios/rfd.htm
source "drivers/mtd/chips/Kconfig" source "drivers/mtd/chips/Kconfig"
source "drivers/mtd/maps/Kconfig" source "drivers/mtd/maps/Kconfig"
...@@ -261,5 +271,7 @@ source "drivers/mtd/devices/Kconfig" ...@@ -261,5 +271,7 @@ source "drivers/mtd/devices/Kconfig"
source "drivers/mtd/nand/Kconfig" source "drivers/mtd/nand/Kconfig"
source "drivers/mtd/onenand/Kconfig"
endmenu endmenu
# #
# Makefile for the memory technology device drivers. # Makefile for the memory technology device drivers.
# #
# $Id: Makefile.common,v 1.5 2004/08/10 20:51:49 dwmw2 Exp $ # $Id: Makefile.common,v 1.7 2005/07/11 10:39:27 gleixner Exp $
# Core functionality. # Core functionality.
mtd-y := mtdcore.o mtd-y := mtdcore.o
...@@ -20,8 +20,9 @@ obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o mtd_blkdevs.o ...@@ -20,8 +20,9 @@ obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o mtd_blkdevs.o
obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o
obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o
obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o
obj-$(CONFIG_RFD_FTL) += rfd_ftl.o mtd_blkdevs.o
nftl-objs := nftlcore.o nftlmount.o nftl-objs := nftlcore.o nftlmount.o
inftl-objs := inftlcore.o inftlmount.o inftl-objs := inftlcore.o inftlmount.o
obj-y += chips/ maps/ devices/ nand/ obj-y += chips/ maps/ devices/ nand/ onenand/
/*====================================================================== /*======================================================================
drivers/mtd/afs.c: ARM Flash Layout/Partitioning drivers/mtd/afs.c: ARM Flash Layout/Partitioning
Copyright (C) 2000 ARM Limited Copyright (C) 2000 ARM Limited
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
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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.13 2004/02/27 22:09:59 rmk Exp $ $Id: afs.c,v 1.15 2005/11/07 11:14:19 gleixner Exp $
======================================================================*/ ======================================================================*/
...@@ -163,7 +163,7 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr) ...@@ -163,7 +163,7 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr)
return ret; return ret;
} }
static int parse_afs_partitions(struct mtd_info *mtd, static int parse_afs_partitions(struct mtd_info *mtd,
struct mtd_partition **pparts, struct mtd_partition **pparts,
unsigned long origin) unsigned long origin)
{ {
......
# drivers/mtd/chips/Kconfig # drivers/mtd/chips/Kconfig
# $Id: Kconfig,v 1.15 2005/06/06 23:04:35 tpoynor Exp $ # $Id: Kconfig,v 1.18 2005/11/07 11:14:22 gleixner Exp $
menu "RAM/ROM/Flash chip drivers" menu "RAM/ROM/Flash chip drivers"
depends on MTD!=n depends on MTD!=n
...@@ -39,7 +39,7 @@ config MTD_CFI_ADV_OPTIONS ...@@ -39,7 +39,7 @@ config MTD_CFI_ADV_OPTIONS
If you need to specify a specific endianness for access to flash If you need to specify a specific endianness for access to flash
chips, or if you wish to reduce the size of the kernel by including chips, or if you wish to reduce the size of the kernel by including
support for only specific arrangements of flash chips, say 'Y'. This support for only specific arrangements of flash chips, say 'Y'. This
option does not directly affect the code, but will enable other option does not directly affect the code, but will enable other
configuration options which allow you to do so. configuration options which allow you to do so.
If unsure, say 'N'. If unsure, say 'N'.
...@@ -56,7 +56,7 @@ config MTD_CFI_NOSWAP ...@@ -56,7 +56,7 @@ config MTD_CFI_NOSWAP
data bits when writing the 'magic' commands to the chips. Saying data bits when writing the 'magic' commands to the chips. Saying
'NO', which is the default when CONFIG_MTD_CFI_ADV_OPTIONS isn't 'NO', which is the default when CONFIG_MTD_CFI_ADV_OPTIONS isn't
enabled, means that the CPU will not do any swapping; the chips enabled, means that the CPU will not do any swapping; the chips
are expected to be wired to the CPU in 'host-endian' form. are expected to be wired to the CPU in 'host-endian' form.
Specific arrangements are possible with the BIG_ENDIAN_BYTE and Specific arrangements are possible with the BIG_ENDIAN_BYTE and
LITTLE_ENDIAN_BYTE, if the bytes are reversed. LITTLE_ENDIAN_BYTE, if the bytes are reversed.
...@@ -79,10 +79,10 @@ config MTD_CFI_GEOMETRY ...@@ -79,10 +79,10 @@ config MTD_CFI_GEOMETRY
bool "Specific CFI Flash geometry selection" bool "Specific CFI Flash geometry selection"
depends on MTD_CFI_ADV_OPTIONS depends on MTD_CFI_ADV_OPTIONS
help help
This option does not affect the code directly, but will enable This option does not affect the code directly, but will enable
some other configuration options which would allow you to reduce some other configuration options which would allow you to reduce
the size of the kernel by including support for only certain the size of the kernel by including support for only certain
arrangements of CFI chips. If unsure, say 'N' and all options arrangements of CFI chips. If unsure, say 'N' and all options
which are supported by the current code will be enabled. which are supported by the current code will be enabled.
config MTD_MAP_BANK_WIDTH_1 config MTD_MAP_BANK_WIDTH_1
...@@ -197,7 +197,7 @@ config MTD_CFI_AMDSTD ...@@ -197,7 +197,7 @@ config MTD_CFI_AMDSTD
help help
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
including the AMD Am29LV320. including the AMD Am29LV320.
config MTD_CFI_AMDSTD_RETRY config MTD_CFI_AMDSTD_RETRY
...@@ -237,14 +237,14 @@ config MTD_RAM ...@@ -237,14 +237,14 @@ config MTD_RAM
tristate "Support for RAM chips in bus mapping" tristate "Support for RAM chips in bus mapping"
depends on MTD depends on MTD
help help
This option enables basic support for RAM chips accessed through This option enables basic support for RAM chips accessed through
a bus mapping driver. a bus mapping driver.
config MTD_ROM config MTD_ROM
tristate "Support for ROM chips in bus mapping" tristate "Support for ROM chips in bus mapping"
depends on MTD depends on MTD
help help
This option enables basic support for ROM chips accessed through This option enables basic support for ROM chips accessed through
a bus mapping driver. a bus mapping driver.
config MTD_ABSENT config MTD_ABSENT
...@@ -275,7 +275,7 @@ config MTD_AMDSTD ...@@ -275,7 +275,7 @@ config MTD_AMDSTD
depends on MTD && MTD_OBSOLETE_CHIPS depends on MTD && MTD_OBSOLETE_CHIPS
help help
This option enables support for flash chips using AMD-compatible This option enables support for flash chips using AMD-compatible
commands, including some which are not CFI-compatible and hence commands, including some which are not CFI-compatible and hence
cannot be used with the CONFIG_MTD_CFI_AMDSTD option. cannot be used with the CONFIG_MTD_CFI_AMDSTD option.
It also works on AMD compatible chips that do conform to CFI. It also works on AMD compatible chips that do conform to CFI.
...@@ -285,7 +285,7 @@ config MTD_SHARP ...@@ -285,7 +285,7 @@ config MTD_SHARP
depends on MTD && MTD_OBSOLETE_CHIPS depends on MTD && MTD_OBSOLETE_CHIPS
help help
This option enables support for flash chips using Sharp-compatible This option enables support for flash chips using Sharp-compatible
commands, including some which are not CFI-compatible and hence commands, including some which are not CFI-compatible and hence
cannot be used with the CONFIG_MTD_CFI_INTELxxx options. cannot be used with the CONFIG_MTD_CFI_INTELxxx options.
config MTD_JEDEC config MTD_JEDEC
......
# #
# linux/drivers/chips/Makefile # linux/drivers/chips/Makefile
# #
# $Id: Makefile.common,v 1.4 2004/07/12 16:07:30 dwmw2 Exp $ # $Id: Makefile.common,v 1.5 2005/11/07 11:14:22 gleixner Exp $
# *** BIG UGLY NOTE *** # *** BIG UGLY NOTE ***
# #
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# the CFI command set drivers are linked before gen_probe.o # the CFI command set drivers are linked before gen_probe.o
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_UTIL) += cfi_util.o obj-$(CONFIG_MTD_CFI_UTIL) += cfi_util.o
obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o
......
...@@ -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.27 2005/02/04 07:43:09 jonashg Exp $ * $Id: amd_flash.c,v 1.28 2005/11/07 11:14:22 gleixner Exp $
* *
* Copyright (c) 2001 Axis Communications AB * Copyright (c) 2001 Axis Communications AB
* *
...@@ -93,9 +93,9 @@ ...@@ -93,9 +93,9 @@
#define D6_MASK 0x40 #define D6_MASK 0x40
struct amd_flash_private { struct amd_flash_private {
int device_type; int device_type;
int interleave; int interleave;
int numchips; int numchips;
unsigned long chipshift; unsigned long chipshift;
// const char *im_name; // const char *im_name;
struct flchip chips[0]; struct flchip chips[0];
...@@ -253,7 +253,7 @@ static int amd_flash_do_unlock(struct mtd_info *mtd, loff_t ofs, size_t len, ...@@ -253,7 +253,7 @@ static int amd_flash_do_unlock(struct mtd_info *mtd, loff_t ofs, size_t len,
int i; int i;
int retval = 0; int retval = 0;
int lock_status; int lock_status;
map = mtd->priv; map = mtd->priv;
/* Pass the whole chip through sector by sector and check for each /* Pass the whole chip through sector by sector and check for each
...@@ -273,7 +273,7 @@ static int amd_flash_do_unlock(struct mtd_info *mtd, loff_t ofs, size_t len, ...@@ -273,7 +273,7 @@ static int amd_flash_do_unlock(struct mtd_info *mtd, loff_t ofs, size_t len,
unlock_sector(map, eraseoffset, is_unlock); unlock_sector(map, eraseoffset, is_unlock);
lock_status = is_sector_locked(map, eraseoffset); lock_status = is_sector_locked(map, eraseoffset);
if (is_unlock && lock_status) { if (is_unlock && lock_status) {
printk("Cannot unlock sector at address %x length %xx\n", printk("Cannot unlock sector at address %x length %xx\n",
eraseoffset, merip->erasesize); eraseoffset, merip->erasesize);
...@@ -305,7 +305,7 @@ static int amd_flash_lock(struct mtd_info *mtd, loff_t ofs, size_t len) ...@@ -305,7 +305,7 @@ static int amd_flash_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
/* /*
* Reads JEDEC manufacturer ID and device ID and returns the index of the first * Reads JEDEC manufacturer ID and device ID and returns the index of the first
* matching table entry (-1 if not found or alias for already found chip). * matching table entry (-1 if not found or alias for already found chip).
*/ */
static int probe_new_chip(struct mtd_info *mtd, __u32 base, static int probe_new_chip(struct mtd_info *mtd, __u32 base,
struct flchip *chips, struct flchip *chips,
struct amd_flash_private *private, struct amd_flash_private *private,
...@@ -636,7 +636,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -636,7 +636,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 }, { .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
{ .offset = 0x1F0000, .erasesize = 0x02000, .numblocks = 8 } { .offset = 0x1F0000, .erasesize = 0x02000, .numblocks = 8 }
} }
} }
}; };
struct mtd_info *mtd; struct mtd_info *mtd;
...@@ -701,7 +701,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -701,7 +701,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info) * mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info) *
mtd->numeraseregions, GFP_KERNEL); mtd->numeraseregions, GFP_KERNEL);
if (!mtd->eraseregions) { if (!mtd->eraseregions) {
printk(KERN_WARNING "%s: Failed to allocate " printk(KERN_WARNING "%s: Failed to allocate "
"memory for MTD erase region info\n", map->name); "memory for MTD erase region info\n", map->name);
kfree(mtd); kfree(mtd);
...@@ -739,12 +739,12 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -739,12 +739,12 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
mtd->type = MTD_NORFLASH; mtd->type = MTD_NORFLASH;
mtd->flags = MTD_CAP_NORFLASH; mtd->flags = MTD_CAP_NORFLASH;
mtd->name = map->name; mtd->name = map->name;
mtd->erase = amd_flash_erase; mtd->erase = amd_flash_erase;
mtd->read = amd_flash_read; mtd->read = amd_flash_read;
mtd->write = amd_flash_write; mtd->write = amd_flash_write;
mtd->sync = amd_flash_sync; mtd->sync = amd_flash_sync;
mtd->suspend = amd_flash_suspend; mtd->suspend = amd_flash_suspend;
mtd->resume = amd_flash_resume; mtd->resume = amd_flash_resume;
mtd->lock = amd_flash_lock; mtd->lock = amd_flash_lock;
mtd->unlock = amd_flash_unlock; mtd->unlock = amd_flash_unlock;
...@@ -789,7 +789,7 @@ static inline int read_one_chip(struct map_info *map, struct flchip *chip, ...@@ -789,7 +789,7 @@ static inline int read_one_chip(struct map_info *map, struct flchip *chip,
map->name, chip->state); map->name, chip->state);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait); add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
schedule(); schedule();
...@@ -802,7 +802,7 @@ static inline int read_one_chip(struct map_info *map, struct flchip *chip, ...@@ -802,7 +802,7 @@ static inline int read_one_chip(struct map_info *map, struct flchip *chip,
timeo = jiffies + HZ; timeo = jiffies + HZ;
goto retry; goto retry;
} }
adr += chip->start; adr += chip->start;
...@@ -889,7 +889,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip, ...@@ -889,7 +889,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip,
map->name, chip->state); map->name, chip->state);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait); add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
schedule(); schedule();
...@@ -901,7 +901,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip, ...@@ -901,7 +901,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip,
timeo = jiffies + HZ; timeo = jiffies + HZ;
goto retry; goto retry;
} }
chip->state = FL_WRITING; chip->state = FL_WRITING;
...@@ -911,7 +911,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip, ...@@ -911,7 +911,7 @@ static int write_one_word(struct map_info *map, struct flchip *chip,
wide_write(map, datum, adr); wide_write(map, datum, adr);
times_left = 500000; times_left = 500000;
while (times_left-- && flash_is_busy(map, adr, private->interleave)) { while (times_left-- && flash_is_busy(map, adr, private->interleave)) {
if (need_resched()) { if (need_resched()) {
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
schedule(); schedule();
...@@ -989,7 +989,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len, ...@@ -989,7 +989,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len,
if (ret) { if (ret) {
return ret; return ret;
} }
ofs += n; ofs += n;
buf += n; buf += n;
(*retlen) += n; (*retlen) += n;
...@@ -1002,7 +1002,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len, ...@@ -1002,7 +1002,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len,
} }
} }
} }
/* We are now aligned, write as much as possible. */ /* We are now aligned, write as much as possible. */
while(len >= map->buswidth) { while(len >= map->buswidth) {
__u32 datum; __u32 datum;
...@@ -1063,7 +1063,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len, ...@@ -1063,7 +1063,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len,
if (ret) { if (ret) {
return ret; return ret;
} }
(*retlen) += n; (*retlen) += n;
} }
...@@ -1085,7 +1085,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1085,7 +1085,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
if (chip->state != FL_READY){ if (chip->state != FL_READY){
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait); add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
schedule(); schedule();
...@@ -1098,7 +1098,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1098,7 +1098,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
timeo = jiffies + HZ; timeo = jiffies + HZ;
goto retry; goto retry;
} }
chip->state = FL_ERASING; chip->state = FL_ERASING;
...@@ -1106,30 +1106,30 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1106,30 +1106,30 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
ENABLE_VPP(map); ENABLE_VPP(map);
send_cmd(map, chip->start, CMD_SECTOR_ERASE_UNLOCK_DATA); send_cmd(map, chip->start, CMD_SECTOR_ERASE_UNLOCK_DATA);
send_cmd_to_addr(map, chip->start, CMD_SECTOR_ERASE_UNLOCK_DATA_2, adr); send_cmd_to_addr(map, chip->start, CMD_SECTOR_ERASE_UNLOCK_DATA_2, adr);
timeo = jiffies + (HZ * 20); timeo = jiffies + (HZ * 20);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
msleep(1000); msleep(1000);
spin_lock_bh(chip->mutex); spin_lock_bh(chip->mutex);
while (flash_is_busy(map, adr, private->interleave)) { while (flash_is_busy(map, adr, private->interleave)) {
if (chip->state != FL_ERASING) { if (chip->state != FL_ERASING) {
/* Someone's suspended the erase. Sleep */ /* Someone's suspended the erase. Sleep */
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait); add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
printk(KERN_INFO "%s: erase suspended. Sleeping\n", printk(KERN_INFO "%s: erase suspended. Sleeping\n",
map->name); map->name);
schedule(); schedule();
remove_wait_queue(&chip->wq, &wait); remove_wait_queue(&chip->wq, &wait);
if (signal_pending(current)) { if (signal_pending(current)) {
return -EINTR; return -EINTR;
} }
timeo = jiffies + (HZ*2); /* FIXME */ timeo = jiffies + (HZ*2); /* FIXME */
spin_lock_bh(chip->mutex); spin_lock_bh(chip->mutex);
continue; continue;
...@@ -1145,7 +1145,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1145,7 +1145,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
return -EIO; return -EIO;
} }
/* Latency issues. Drop the lock, wait a while and retry */ /* Latency issues. Drop the lock, wait a while and retry */
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
...@@ -1153,7 +1153,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1153,7 +1153,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
schedule(); schedule();
else else
udelay(1); udelay(1);
spin_lock_bh(chip->mutex); spin_lock_bh(chip->mutex);
} }
...@@ -1180,7 +1180,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip, ...@@ -1180,7 +1180,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
return -EIO; return -EIO;
} }
} }
DISABLE_VPP(map); DISABLE_VPP(map);
chip->state = FL_READY; chip->state = FL_READY;
wake_up(&chip->wq); wake_up(&chip->wq);
...@@ -1246,7 +1246,7 @@ static int amd_flash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1246,7 +1246,7 @@ static int amd_flash_erase(struct mtd_info *mtd, struct erase_info *instr)
* with the erase region at that address. * with the erase region at that address.
*/ */
while ((i < mtd->numeraseregions) && while ((i < mtd->numeraseregions) &&
((instr->addr + instr->len) >= regions[i].offset)) { ((instr->addr + instr->len) >= regions[i].offset)) {
i++; i++;
} }
...@@ -1293,10 +1293,10 @@ static int amd_flash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1293,10 +1293,10 @@ static int amd_flash_erase(struct mtd_info *mtd, struct erase_info *instr)
} }
} }
} }
instr->state = MTD_ERASE_DONE; instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr); mtd_erase_callback(instr);
return 0; return 0;
} }
...@@ -1324,7 +1324,7 @@ static void amd_flash_sync(struct mtd_info *mtd) ...@@ -1324,7 +1324,7 @@ static void amd_flash_sync(struct mtd_info *mtd)
case FL_JEDEC_QUERY: case FL_JEDEC_QUERY:
chip->oldstate = chip->state; chip->oldstate = chip->state;
chip->state = FL_SYNCING; chip->state = FL_SYNCING;
/* No need to wake_up() on this state change - /* No need to wake_up() on this state change -
* as the whole point is that nobody can do anything * as the whole point is that nobody can do anything
* with the chip now anyway. * with the chip now anyway.
*/ */
...@@ -1335,13 +1335,13 @@ static void amd_flash_sync(struct mtd_info *mtd) ...@@ -1335,13 +1335,13 @@ static void amd_flash_sync(struct mtd_info *mtd)
default: default:
/* Not an idle state */ /* Not an idle state */
add_wait_queue(&chip->wq, &wait); add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
schedule(); schedule();
remove_wait_queue(&chip->wq, &wait); remove_wait_queue(&chip->wq, &wait);
goto retry; goto retry;
} }
} }
...@@ -1351,7 +1351,7 @@ static void amd_flash_sync(struct mtd_info *mtd) ...@@ -1351,7 +1351,7 @@ static void amd_flash_sync(struct mtd_info *mtd)
chip = &private->chips[i]; chip = &private->chips[i];
spin_lock_bh(chip->mutex); spin_lock_bh(chip->mutex);
if (chip->state == FL_SYNCING) { if (chip->state == FL_SYNCING) {
chip->state = chip->oldstate; chip->state = chip->oldstate;
wake_up(&chip->wq); wake_up(&chip->wq);
......
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.83 2004/11/16 18:19:02 nico Exp $ $Id: cfi_probe.c,v 1.84 2005/11/07 11:14:23 gleixner Exp $
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/mtd/cfi.h> #include <linux/mtd/cfi.h>
#include <linux/mtd/gen_probe.h> #include <linux/mtd/gen_probe.h>
//#define DEBUG_CFI //#define DEBUG_CFI
#ifdef DEBUG_CFI #ifdef DEBUG_CFI
static void print_cfi_ident(struct cfi_ident *); static void print_cfi_ident(struct cfi_ident *);
...@@ -103,7 +103,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -103,7 +103,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
unsigned long *chip_map, struct cfi_private *cfi) unsigned long *chip_map, struct cfi_private *cfi)
{ {
int i; int i;
if ((base + 0) >= map->size) { if ((base + 0) >= map->size) {
printk(KERN_NOTICE printk(KERN_NOTICE
"Probe at base[0x00](0x%08lx) past the end of the map(0x%08lx)\n", "Probe at base[0x00](0x%08lx) past the end of the map(0x%08lx)\n",
...@@ -128,7 +128,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -128,7 +128,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
} }
if (!cfi->numchips) { if (!cfi->numchips) {
/* This is the first time we're called. Set up the CFI /* This is the first time we're called. Set up the CFI
stuff accordingly and return */ stuff accordingly and return */
return cfi_chip_setup(map, cfi); return cfi_chip_setup(map, cfi);
} }
...@@ -138,13 +138,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -138,13 +138,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
unsigned long start; unsigned long start;
if(!test_bit(i, chip_map)) { if(!test_bit(i, chip_map)) {
/* Skip location; no valid chip at this address */ /* Skip location; no valid chip at this address */
continue; continue;
} }
start = i << cfi->chipshift; start = i << cfi->chipshift;
/* This chip should be in read mode if it's one /* This chip should be in read mode if it's one
we've already touched. */ we've already touched. */
if (qry_present(map, start, cfi)) { if (qry_present(map, start, cfi)) {
/* Eep. This chip also had the QRY marker. /* Eep. This chip also had the QRY marker.
* Is it an alias for the new one? */ * Is it an alias for the new one? */
cfi_send_gen_cmd(0xF0, 0, start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xF0, 0, start, map, cfi, cfi->device_type, NULL);
cfi_send_gen_cmd(0xFF, 0, start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xFF, 0, start, map, cfi, cfi->device_type, NULL);
...@@ -156,13 +156,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -156,13 +156,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
map->name, base, start); map->name, base, start);
return 0; return 0;
} }
/* Yes, it's actually got QRY for data. Most /* Yes, it's actually got QRY for data. Most
* unfortunate. Stick the new chip in read mode * unfortunate. Stick the new chip in read mode
* too and if it's the same, assume it's an alias. */ * too and if it's the same, assume it's an alias. */
/* FIXME: Use other modes to do a proper check */ /* FIXME: Use other modes to do a proper check */
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(0xFF, 0, start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xFF, 0, start, map, cfi, cfi->device_type, NULL);
if (qry_present(map, base, cfi)) { if (qry_present(map, base, cfi)) {
xip_allowed(base, map); xip_allowed(base, map);
printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n", printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
...@@ -171,12 +171,12 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -171,12 +171,12 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
} }
} }
} }
/* OK, if we got to here, then none of the previous chips appear to /* OK, if we got to here, then none of the previous chips appear to
be aliases for the current one. */ be aliases for the current one. */
set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */ set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
cfi->numchips++; cfi->numchips++;
/* Put it back into Read Mode */ /* Put it back into Read Mode */
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(0xFF, 0, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
...@@ -185,11 +185,11 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base, ...@@ -185,11 +185,11 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n", printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
map->name, cfi->interleave, cfi->device_type*8, base, map->name, cfi->interleave, cfi->device_type*8, base,
map->bankwidth*8); map->bankwidth*8);
return 1; return 1;
} }
static int __xipram cfi_chip_setup(struct map_info *map, static int __xipram cfi_chip_setup(struct map_info *map,
struct cfi_private *cfi) struct cfi_private *cfi)
{ {
int ofs_factor = cfi->interleave*cfi->device_type; int ofs_factor = cfi->interleave*cfi->device_type;
...@@ -209,11 +209,11 @@ static int __xipram cfi_chip_setup(struct map_info *map, ...@@ -209,11 +209,11 @@ static int __xipram cfi_chip_setup(struct map_info *map,
printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
return 0; return 0;
} }
memset(cfi->cfiq,0,sizeof(struct cfi_ident)); memset(cfi->cfiq,0,sizeof(struct cfi_ident));
cfi->cfi_mode = CFI_MODE_CFI; cfi->cfi_mode = CFI_MODE_CFI;
/* Read the CFI info structure */ /* Read the CFI info structure */
xip_disable_qry(base, map, cfi); xip_disable_qry(base, map, cfi);
for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++) for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
...@@ -231,7 +231,7 @@ static int __xipram cfi_chip_setup(struct map_info *map, ...@@ -231,7 +231,7 @@ static int __xipram cfi_chip_setup(struct map_info *map,
cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
cfi->mfr = cfi_read_query(map, base); cfi->mfr = cfi_read_query(map, base);
cfi->id = cfi_read_query(map, base + ofs_factor); cfi->id = cfi_read_query(map, base + ofs_factor);
/* Put it back into Read Mode */ /* Put it back into Read Mode */
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);
...@@ -255,10 +255,10 @@ static int __xipram cfi_chip_setup(struct map_info *map, ...@@ -255,10 +255,10 @@ static int __xipram cfi_chip_setup(struct map_info *map,
for (i=0; i<cfi->cfiq->NumEraseRegions; i++) { for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
cfi->cfiq->EraseRegionInfo[i] = le32_to_cpu(cfi->cfiq->EraseRegionInfo[i]); cfi->cfiq->EraseRegionInfo[i] = le32_to_cpu(cfi->cfiq->EraseRegionInfo[i]);
#ifdef DEBUG_CFI #ifdef DEBUG_CFI
printk(" Erase Region #%d: BlockSize 0x%4.4X bytes, %d blocks\n", printk(" Erase Region #%d: BlockSize 0x%4.4X bytes, %d blocks\n",
i, (cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xff, i, (cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xff,
(cfi->cfiq->EraseRegionInfo[i] & 0xffff) + 1); (cfi->cfiq->EraseRegionInfo[i] & 0xffff) + 1);
#endif #endif
} }
...@@ -271,33 +271,33 @@ static int __xipram cfi_chip_setup(struct map_info *map, ...@@ -271,33 +271,33 @@ static int __xipram cfi_chip_setup(struct map_info *map,
} }
#ifdef DEBUG_CFI #ifdef DEBUG_CFI
static char *vendorname(__u16 vendor) static char *vendorname(__u16 vendor)
{ {
switch (vendor) { switch (vendor) {
case P_ID_NONE: case P_ID_NONE:
return "None"; return "None";
case P_ID_INTEL_EXT: case P_ID_INTEL_EXT:
return "Intel/Sharp Extended"; return "Intel/Sharp Extended";
case P_ID_AMD_STD: case P_ID_AMD_STD:
return "AMD/Fujitsu Standard"; return "AMD/Fujitsu Standard";
case P_ID_INTEL_STD: case P_ID_INTEL_STD:
return "Intel/Sharp Standard"; return "Intel/Sharp Standard";
case P_ID_AMD_EXT: case P_ID_AMD_EXT:
return "AMD/Fujitsu Extended"; return "AMD/Fujitsu Extended";
case P_ID_WINBOND: case P_ID_WINBOND:
return "Winbond Standard"; return "Winbond Standard";
case P_ID_ST_ADV: case P_ID_ST_ADV:
return "ST Advanced"; return "ST Advanced";
case P_ID_MITSUBISHI_STD: case P_ID_MITSUBISHI_STD:
return "Mitsubishi Standard"; return "Mitsubishi Standard";
case P_ID_MITSUBISHI_EXT: case P_ID_MITSUBISHI_EXT:
return "Mitsubishi Extended"; return "Mitsubishi Extended";
...@@ -306,13 +306,13 @@ static char *vendorname(__u16 vendor) ...@@ -306,13 +306,13 @@ static char *vendorname(__u16 vendor)
case P_ID_INTEL_PERFORMANCE: case P_ID_INTEL_PERFORMANCE:
return "Intel Performance Code"; return "Intel Performance Code";
case P_ID_INTEL_DATA: case P_ID_INTEL_DATA:
return "Intel Data"; return "Intel Data";
case P_ID_RESERVED: case P_ID_RESERVED:
return "Not Allowed / Reserved for Future Use"; return "Not Allowed / Reserved for Future Use";
default: default:
return "Unknown"; return "Unknown";
} }
...@@ -325,21 +325,21 @@ static void print_cfi_ident(struct cfi_ident *cfip) ...@@ -325,21 +325,21 @@ static void print_cfi_ident(struct cfi_ident *cfip)
if (cfip->qry[0] != 'Q' || cfip->qry[1] != 'R' || cfip->qry[2] != 'Y') { if (cfip->qry[0] != 'Q' || cfip->qry[1] != 'R' || cfip->qry[2] != 'Y') {
printk("Invalid CFI ident structure.\n"); printk("Invalid CFI ident structure.\n");
return; return;
} }
#endif #endif
printk("Primary Vendor Command Set: %4.4X (%s)\n", cfip->P_ID, vendorname(cfip->P_ID)); printk("Primary Vendor Command Set: %4.4X (%s)\n", cfip->P_ID, vendorname(cfip->P_ID));
if (cfip->P_ADR) if (cfip->P_ADR)
printk("Primary Algorithm Table at %4.4X\n", cfip->P_ADR); printk("Primary Algorithm Table at %4.4X\n", cfip->P_ADR);
else else
printk("No Primary Algorithm Table\n"); printk("No Primary Algorithm Table\n");
printk("Alternative Vendor Command Set: %4.4X (%s)\n", cfip->A_ID, vendorname(cfip->A_ID)); printk("Alternative Vendor Command Set: %4.4X (%s)\n", cfip->A_ID, vendorname(cfip->A_ID));
if (cfip->A_ADR) if (cfip->A_ADR)
printk("Alternate Algorithm Table at %4.4X\n", cfip->A_ADR); printk("Alternate Algorithm Table at %4.4X\n", cfip->A_ADR);
else else
printk("No Alternate Algorithm Table\n"); printk("No Alternate Algorithm Table\n");
printk("Vcc Minimum: %2d.%d V\n", cfip->VccMin >> 4, cfip->VccMin & 0xf); printk("Vcc Minimum: %2d.%d V\n", cfip->VccMin >> 4, cfip->VccMin & 0xf);
printk("Vcc Maximum: %2d.%d V\n", cfip->VccMax >> 4, cfip->VccMax & 0xf); printk("Vcc Maximum: %2d.%d V\n", cfip->VccMax >> 4, cfip->VccMax & 0xf);
if (cfip->VppMin) { if (cfip->VppMin) {
...@@ -348,61 +348,61 @@ static void print_cfi_ident(struct cfi_ident *cfip) ...@@ -348,61 +348,61 @@ static void print_cfi_ident(struct cfi_ident *cfip)
} }
else else
printk("No Vpp line\n"); printk("No Vpp line\n");
printk("Typical byte/word write timeout: %d s\n", 1<<cfip->WordWriteTimeoutTyp); printk("Typical byte/word write timeout: %d s\n", 1<<cfip->WordWriteTimeoutTyp);
printk("Maximum byte/word write timeout: %d s\n", (1<<cfip->WordWriteTimeoutMax) * (1<<cfip->WordWriteTimeoutTyp)); printk("Maximum byte/word write timeout: %d s\n", (1<<cfip->WordWriteTimeoutMax) * (1<<cfip->WordWriteTimeoutTyp));
if (cfip->BufWriteTimeoutTyp || cfip->BufWriteTimeoutMax) { if (cfip->BufWriteTimeoutTyp || cfip->BufWriteTimeoutMax) {
printk("Typical full buffer write timeout: %d s\n", 1<<cfip->BufWriteTimeoutTyp); printk("Typical full buffer write timeout: %d s\n", 1<<cfip->BufWriteTimeoutTyp);
printk("Maximum full buffer write timeout: %d s\n", (1<<cfip->BufWriteTimeoutMax) * (1<<cfip->BufWriteTimeoutTyp)); printk("Maximum full buffer write timeout: %d s\n", (1<<cfip->BufWriteTimeoutMax) * (1<<cfip->BufWriteTimeoutTyp));
} }
else else
printk("Full buffer write not supported\n"); printk("Full buffer write not supported\n");
printk("Typical block erase timeout: %d ms\n", 1<<cfip->BlockEraseTimeoutTyp); printk("Typical block erase timeout: %d ms\n", 1<<cfip->BlockEraseTimeoutTyp);
printk("Maximum block erase timeout: %d ms\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 ms\n", 1<<cfip->ChipEraseTimeoutTyp); printk("Typical chip erase timeout: %d ms\n", 1<<cfip->ChipEraseTimeoutTyp);
printk("Maximum chip erase timeout: %d ms\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");
printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20)); printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20));
printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc); printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc);
switch(cfip->InterfaceDesc) { switch(cfip->InterfaceDesc) {
case 0: case 0:
printk(" - x8-only asynchronous interface\n"); printk(" - x8-only asynchronous interface\n");
break; break;
case 1: case 1:
printk(" - x16-only asynchronous interface\n"); printk(" - x16-only asynchronous interface\n");
break; break;
case 2: case 2:
printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n"); printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n");
break; break;
case 3: case 3:
printk(" - x32-only asynchronous interface\n"); printk(" - x32-only asynchronous interface\n");
break; break;
case 4: case 4:
printk(" - supports x16 and x32 via Word# with asynchronous interface\n"); printk(" - supports x16 and x32 via Word# with asynchronous interface\n");
break; break;
case 65535: case 65535:
printk(" - Not Allowed / Reserved\n"); printk(" - Not Allowed / Reserved\n");
break; break;
default: default:
printk(" - Unknown\n"); printk(" - Unknown\n");
break; break;
} }
printk("Max. bytes in buffer write: 0x%x\n", 1<< cfip->MaxBufWriteSize); printk("Max. bytes in buffer write: 0x%x\n", 1<< cfip->MaxBufWriteSize);
printk("Number of Erase Block Regions: %d\n", cfip->NumEraseRegions); printk("Number of Erase Block Regions: %d\n", cfip->NumEraseRegions);
} }
#endif /* DEBUG_CFI */ #endif /* DEBUG_CFI */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This code is covered by the GPL. * This code is covered by the GPL.
* *
* $Id: cfi_util.c,v 1.8 2004/12/14 19:55:56 nico Exp $ * $Id: cfi_util.c,v 1.10 2005/11/07 11:14:23 gleixner Exp $
* *
*/ */
...@@ -56,7 +56,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n ...@@ -56,7 +56,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
/* Read in the Extended Query Table */ /* Read in the Extended Query Table */
for (i=0; i<size; i++) { for (i=0; i<size; i++) {
((unsigned char *)extp)[i] = ((unsigned char *)extp)[i] =
cfi_read_query(map, base+((adr+i)*ofs_factor)); cfi_read_query(map, base+((adr+i)*ofs_factor));
} }
...@@ -70,15 +70,6 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n ...@@ -70,15 +70,6 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
local_irq_enable(); local_irq_enable();
#endif #endif
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '3')) {
printk(KERN_WARNING " Unknown %s Extended Query "
"version %c.%c.\n", name, extp->MajorVersion,
extp->MinorVersion);
kfree(extp);
extp = NULL;
}
out: return extp; out: return extp;
} }
...@@ -122,17 +113,17 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob, ...@@ -122,17 +113,17 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob,
i = 0; i = 0;
/* Skip all erase regions which are ended before the start of /* Skip all erase regions which are ended before the start of
the requested erase. Actually, to save on the calculations, the requested erase. Actually, to save on the calculations,
we skip to the first erase region which starts after the we skip to the first erase region which starts after the
start of the requested erase, and then go back one. start of the requested erase, and then go back one.
*/ */
while (i < mtd->numeraseregions && ofs >= regions[i].offset) while (i < mtd->numeraseregions && ofs >= regions[i].offset)
i++; i++;
i--; i--;
/* OK, now i is pointing at the erase region in which this /* OK, now i is pointing at the erase region in which this
erase request starts. Check the start of the requested erase request starts. Check the start of the requested
erase range is aligned with the erase size which is in erase range is aligned with the erase size which is in
effect here. effect here.
...@@ -155,7 +146,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob, ...@@ -155,7 +146,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob,
the address actually falls the address actually falls
*/ */
i--; i--;
if ((ofs + len) & (regions[i].erasesize-1)) if ((ofs + len) & (regions[i].erasesize-1))
return -EINVAL; return -EINVAL;
...@@ -168,7 +159,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob, ...@@ -168,7 +159,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob,
int size = regions[i].erasesize; int size = regions[i].erasesize;
ret = (*frob)(map, &cfi->chips[chipnum], adr, size, thunk); ret = (*frob)(map, &cfi->chips[chipnum], adr, size, thunk);
if (ret) if (ret)
return ret; return ret;
...@@ -182,7 +173,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob, ...@@ -182,7 +173,7 @@ int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob,
if (adr >> cfi->chipshift) { if (adr >> cfi->chipshift) {
adr = 0; adr = 0;
chipnum++; chipnum++;
if (chipnum >= cfi->numchips) if (chipnum >= cfi->numchips)
break; break;
} }
......
...@@ -41,7 +41,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (const char *name) ...@@ -41,7 +41,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (const char *name)
list_for_each(pos, &chip_drvs_list) { list_for_each(pos, &chip_drvs_list) {
this = list_entry(pos, typeof(*this), list); this = list_entry(pos, typeof(*this), list);
if (!strcmp(this->name, name)) { if (!strcmp(this->name, name)) {
ret = this; ret = this;
break; break;
...@@ -73,7 +73,7 @@ struct mtd_info *do_map_probe(const char *name, struct map_info *map) ...@@ -73,7 +73,7 @@ struct mtd_info *do_map_probe(const char *name, struct map_info *map)
ret = drv->probe(map); ret = drv->probe(map);
/* We decrease the use count here. It may have been a /* We decrease the use count here. It may have been a
probe-only module, which is no longer required from this probe-only module, which is no longer required from this
point, having given us a handle on (and increased the use point, having given us a handle on (and increased the use
count of) the actual driver code. count of) the actual driver code.
...@@ -82,7 +82,7 @@ struct mtd_info *do_map_probe(const char *name, struct map_info *map) ...@@ -82,7 +82,7 @@ struct mtd_info *do_map_probe(const char *name, struct map_info *map)
if (ret) if (ret)
return ret; return ret;
return NULL; return NULL;
} }
/* /*
......
...@@ -25,7 +25,7 @@ struct fwh_xxlock_thunk { ...@@ -25,7 +25,7 @@ struct fwh_xxlock_thunk {
* so this code has not been tested with interleaved chips, * so this code has not been tested with interleaved chips,
* and will likely fail in that context. * and will likely fail in that context.
*/ */
static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip, static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,
unsigned long adr, int len, void *thunk) unsigned long adr, int len, void *thunk)
{ {
struct cfi_private *cfi = map->fldrv_priv; struct cfi_private *cfi = map->fldrv_priv;
...@@ -44,7 +44,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -44,7 +44,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,
* - on 64k boundariesand * - on 64k boundariesand
* - bit 1 set high * - bit 1 set high
* - block lock registers are 4MiB lower - overflow subtract (danger) * - block lock registers are 4MiB lower - overflow subtract (danger)
* *
* The address manipulation is first done on the logical address * The address manipulation is first done on the logical address
* which is 0 at the start of the chip, and then the offset of * which is 0 at the start of the chip, and then the offset of
* the individual chip is addted to it. Any other order a weird * the individual chip is addted to it. Any other order a weird
...@@ -93,7 +93,7 @@ static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) ...@@ -93,7 +93,7 @@ static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len)
ret = cfi_varsize_frob(mtd, fwh_xxlock_oneblock, ofs, len, ret = cfi_varsize_frob(mtd, fwh_xxlock_oneblock, ofs, len,
(void *)&FWH_XXLOCK_ONEBLOCK_UNLOCK); (void *)&FWH_XXLOCK_ONEBLOCK_UNLOCK);
return ret; return ret;
} }
......
...@@ -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.22 2005/01/24 23:49:50 rmk Exp $ * $Id: gen_probe.c,v 1.24 2005/11/07 11:14:23 gleixner Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -26,7 +26,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp) ...@@ -26,7 +26,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp)
/* First probe the map to see if we have CFI stuff there. */ /* First probe the map to see if we have CFI stuff there. */
cfi = genprobe_ident_chips(map, cp); cfi = genprobe_ident_chips(map, cp);
if (!cfi) if (!cfi)
return NULL; return NULL;
...@@ -36,12 +36,12 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp) ...@@ -36,12 +36,12 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp)
mtd = check_cmd_set(map, 1); /* First the primary cmdset */ mtd = check_cmd_set(map, 1); /* First the primary cmdset */
if (!mtd) if (!mtd)
mtd = check_cmd_set(map, 0); /* Then the secondary */ mtd = check_cmd_set(map, 0); /* Then the secondary */
if (mtd) if (mtd)
return mtd; return mtd;
printk(KERN_WARNING"gen_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);
map->fldrv_priv = NULL; map->fldrv_priv = NULL;
...@@ -60,14 +60,14 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi ...@@ -60,14 +60,14 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
memset(&cfi, 0, sizeof(cfi)); memset(&cfi, 0, sizeof(cfi));
/* 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. */
if (!genprobe_new_chip(map, cp, &cfi)) { if (!genprobe_new_chip(map, cp, &cfi)) {
/* The probe didn't like it */ /* The probe didn't like it */
printk(KERN_DEBUG "%s: Found no %s device at location zero\n", printk(KERN_DEBUG "%s: Found no %s device at location zero\n",
cp->name, map->name); cp->name, map->name);
return NULL; return NULL;
} }
#if 0 /* Let the CFI probe routine do this sanity check. The Intel and AMD #if 0 /* Let the CFI probe routine do this sanity check. The Intel and AMD
probe routines won't ever return a broken CFI structure anyway, probe routines won't ever return a broken CFI structure anyway,
...@@ -92,13 +92,13 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi ...@@ -92,13 +92,13 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
} else { } else {
BUG(); BUG();
} }
cfi.numchips = 1; cfi.numchips = 1;
/* /*
* Allocate memory for bitmap of valid chips. * Allocate memory for bitmap of valid chips.
* Align bitmap storage size to full byte. * Align bitmap storage size to full byte.
*/ */
max_chips = map->size >> cfi.chipshift; max_chips = map->size >> cfi.chipshift;
mapsize = (max_chips / 8) + ((max_chips % 8) ? 1 : 0); mapsize = (max_chips / 8) + ((max_chips % 8) ? 1 : 0);
chip_map = kmalloc(mapsize, GFP_KERNEL); chip_map = kmalloc(mapsize, GFP_KERNEL);
...@@ -122,7 +122,7 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi ...@@ -122,7 +122,7 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
} }
/* /*
* Now allocate the space for the structures we need to return to * Now allocate the space for the structures we need to return to
* our caller, and copy the appropriate data into them. * our caller, and copy the appropriate data into them.
*/ */
...@@ -154,7 +154,7 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi ...@@ -154,7 +154,7 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
return retcfi; return retcfi;
} }
static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp, static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp,
struct cfi_private *cfi) struct cfi_private *cfi)
{ {
...@@ -189,7 +189,7 @@ extern cfi_cmdset_fn_t cfi_cmdset_0001; ...@@ -189,7 +189,7 @@ extern cfi_cmdset_fn_t cfi_cmdset_0001;
extern cfi_cmdset_fn_t cfi_cmdset_0002; extern cfi_cmdset_fn_t cfi_cmdset_0002;
extern cfi_cmdset_fn_t cfi_cmdset_0020; extern cfi_cmdset_fn_t cfi_cmdset_0020;
static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map, static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
int primary) int primary)
{ {
struct cfi_private *cfi = map->fldrv_priv; struct cfi_private *cfi = map->fldrv_priv;
...@@ -199,7 +199,7 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map, ...@@ -199,7 +199,7 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
cfi_cmdset_fn_t *probe_function; cfi_cmdset_fn_t *probe_function;
sprintf(probename, "cfi_cmdset_%4.4X", type); sprintf(probename, "cfi_cmdset_%4.4X", type);
probe_function = inter_module_get_request(probename, probename); probe_function = inter_module_get_request(probename, probename);
if (probe_function) { if (probe_function) {
...@@ -221,7 +221,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary) ...@@ -221,7 +221,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
{ {
struct cfi_private *cfi = map->fldrv_priv; struct cfi_private *cfi = map->fldrv_priv;
__u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID;
if (type == P_ID_NONE || type == P_ID_RESERVED) if (type == P_ID_NONE || type == P_ID_RESERVED)
return NULL; return NULL;
...@@ -235,6 +235,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary) ...@@ -235,6 +235,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
#ifdef CONFIG_MTD_CFI_INTELEXT #ifdef CONFIG_MTD_CFI_INTELEXT
case 0x0001: case 0x0001:
case 0x0003: case 0x0003:
case 0x0200:
return cfi_cmdset_0001(map, primary); return cfi_cmdset_0001(map, primary);
#endif #endif
#ifdef CONFIG_MTD_CFI_AMDSTD #ifdef CONFIG_MTD_CFI_AMDSTD
......
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: jedec_probe.c,v 1.63 2005/02/14 16:30:32 bjd Exp $ $Id: jedec_probe.c,v 1.66 2005/11/07 11:14:23 gleixner 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.
...@@ -1719,7 +1719,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -1719,7 +1719,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
static struct mtd_info *jedec_probe(struct map_info *map); static struct mtd_info *jedec_probe(struct map_info *map);
static inline u32 jedec_read_mfr(struct map_info *map, __u32 base, static inline u32 jedec_read_mfr(struct map_info *map, __u32 base,
struct cfi_private *cfi) struct cfi_private *cfi)
{ {
map_word result; map_word result;
...@@ -1730,7 +1730,7 @@ static inline u32 jedec_read_mfr(struct map_info *map, __u32 base, ...@@ -1730,7 +1730,7 @@ static inline u32 jedec_read_mfr(struct map_info *map, __u32 base,
return result.x[0] & mask; return result.x[0] & mask;
} }
static inline u32 jedec_read_id(struct map_info *map, __u32 base, static inline u32 jedec_read_id(struct map_info *map, __u32 base,
struct cfi_private *cfi) struct cfi_private *cfi)
{ {
map_word result; map_word result;
...@@ -1741,7 +1741,7 @@ static inline u32 jedec_read_id(struct map_info *map, __u32 base, ...@@ -1741,7 +1741,7 @@ static inline u32 jedec_read_id(struct map_info *map, __u32 base,
return result.x[0] & mask; return result.x[0] & mask;
} }
static inline void jedec_reset(u32 base, struct map_info *map, static inline void jedec_reset(u32 base, struct map_info *map,
struct cfi_private *cfi) struct cfi_private *cfi)
{ {
/* Reset */ /* Reset */
...@@ -1765,7 +1765,7 @@ static inline void jedec_reset(u32 base, struct map_info *map, ...@@ -1765,7 +1765,7 @@ static inline void jedec_reset(u32 base, struct map_info *map,
* so ensure we're in read mode. Send both the Intel and the AMD command * so ensure we're in read mode. Send both the Intel and the AMD command
* for this. Intel uses 0xff for this, AMD uses 0xff for NOP, so * for this. Intel uses 0xff for this, AMD uses 0xff for NOP, so
* this should be safe. * this should be safe.
*/ */
cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
/* FIXME - should have reset delay before continuing */ /* FIXME - should have reset delay before continuing */
} }
...@@ -1807,14 +1807,14 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) ...@@ -1807,14 +1807,14 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
printk("Found: %s\n",jedec_table[index].name); printk("Found: %s\n",jedec_table[index].name);
num_erase_regions = jedec_table[index].NumEraseRegions; num_erase_regions = jedec_table[index].NumEraseRegions;
p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
if (!p_cfi->cfiq) { if (!p_cfi->cfiq) {
//xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
return 0; return 0;
} }
memset(p_cfi->cfiq,0,sizeof(struct cfi_ident)); memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
p_cfi->cfiq->P_ID = jedec_table[index].CmdSet; p_cfi->cfiq->P_ID = jedec_table[index].CmdSet;
p_cfi->cfiq->NumEraseRegions = jedec_table[index].NumEraseRegions; p_cfi->cfiq->NumEraseRegions = jedec_table[index].NumEraseRegions;
...@@ -1969,7 +1969,7 @@ static inline int jedec_match( __u32 base, ...@@ -1969,7 +1969,7 @@ static inline int jedec_match( __u32 base,
cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, cfi->device_type, NULL);
/* FIXME - should have a delay before continuing */ /* FIXME - should have a delay before continuing */
match_done: match_done:
return rc; return rc;
} }
...@@ -1998,23 +1998,23 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -1998,23 +1998,23 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
"Probe at base(0x%08x) past the end of the map(0x%08lx)\n", "Probe at base(0x%08x) past the end of the map(0x%08lx)\n",
base, map->size -1); base, map->size -1);
return 0; return 0;
} }
/* Ensure the unlock addresses we try stay inside the map */ /* Ensure the unlock addresses we try stay inside the map */
probe_offset1 = cfi_build_cmd_addr( probe_offset1 = cfi_build_cmd_addr(
cfi->addr_unlock1, cfi->addr_unlock1,
cfi_interleave(cfi), cfi_interleave(cfi),
cfi->device_type); cfi->device_type);
probe_offset2 = cfi_build_cmd_addr( probe_offset2 = cfi_build_cmd_addr(
cfi->addr_unlock1, cfi->addr_unlock1,
cfi_interleave(cfi), cfi_interleave(cfi),
cfi->device_type); cfi->device_type);
if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) || if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
((base + probe_offset2 + map_bankwidth(map)) >= map->size)) ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
{ {
goto retry; goto retry;
} }
/* Reset */ /* Reset */
jedec_reset(base, map, cfi); jedec_reset(base, map, cfi);
...@@ -2027,13 +2027,13 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -2027,13 +2027,13 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
/* FIXME - should have a delay before continuing */ /* FIXME - should have a delay before continuing */
if (!cfi->numchips) { if (!cfi->numchips) {
/* This is the first time we're called. Set up the CFI /* This is the first time we're called. Set up the CFI
stuff accordingly and return */ stuff accordingly and return */
cfi->mfr = jedec_read_mfr(map, base, cfi); cfi->mfr = jedec_read_mfr(map, base, cfi);
cfi->id = jedec_read_id(map, base, cfi); cfi->id = jedec_read_id(map, base, cfi);
DEBUG(MTD_DEBUG_LEVEL3, DEBUG(MTD_DEBUG_LEVEL3,
"Search for id:(%02x %02x) interleave(%d) type(%d)\n", "Search for id:(%02x %02x) interleave(%d) type(%d)\n",
cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type); cfi->mfr, cfi->id, cfi_interleave(cfi), cfi->device_type);
for (i=0; i<sizeof(jedec_table)/sizeof(jedec_table[0]); i++) { for (i=0; i<sizeof(jedec_table)/sizeof(jedec_table[0]); i++) {
if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) { if ( jedec_match( base, map, cfi, &jedec_table[i] ) ) {
...@@ -2062,7 +2062,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -2062,7 +2062,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
return 0; return 0;
} }
} }
/* Check each previous chip locations to see if it's an alias */ /* Check each previous chip locations to see if it's an alias */
for (i=0; i < (base >> cfi->chipshift); i++) { for (i=0; i < (base >> cfi->chipshift); i++) {
unsigned long start; unsigned long start;
...@@ -2083,7 +2083,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -2083,7 +2083,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
map->name, base, start); map->name, base, start);
return 0; return 0;
} }
/* Yes, it's actually got the device IDs as data. Most /* Yes, it's actually got the device IDs as data. Most
* unfortunate. Stick the new chip in read mode * unfortunate. Stick the new chip in read mode
* too and if it's the same, assume it's an alias. */ * too and if it's the same, assume it's an alias. */
...@@ -2097,20 +2097,20 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, ...@@ -2097,20 +2097,20 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
} }
} }
} }
/* OK, if we got to here, then none of the previous chips appear to /* OK, if we got to here, then none of the previous chips appear to
be aliases for the current one. */ be aliases for the current one. */
set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */ set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
cfi->numchips++; cfi->numchips++;
ok_out: ok_out:
/* Put it back into Read Mode */ /* Put it back into Read Mode */
jedec_reset(base, map, cfi); jedec_reset(base, map, cfi);
printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n", printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
map->name, cfi_interleave(cfi), cfi->device_type*8, base, map->name, cfi_interleave(cfi), cfi->device_type*8, base,
map->bankwidth*8); map->bankwidth*8);
return 1; return 1;
} }
......
/* /*
* 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.5 2004/11/16 18:29:00 dwmw2 Exp $ * $Id: map_absent.c,v 1.6 2005/11/07 11:14:23 gleixner 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.
* Use of this driver as a fallback preserves the expected * Use of this driver as a fallback preserves the expected
* registration of MTD device nodes regardless of probe outcome. * registration of MTD device nodes regardless of probe outcome.
* A usage example is as follows: * A usage example is as follows:
* *
...@@ -80,7 +80,7 @@ static int map_absent_read(struct mtd_info *mtd, loff_t from, size_t len, size_t ...@@ -80,7 +80,7 @@ static int map_absent_read(struct mtd_info *mtd, loff_t from, size_t len, size_t
static int map_absent_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) static int map_absent_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
{ {
*retlen = 0; *retlen = 0;
return -ENODEV; return -ENODEV;
} }
static int map_absent_erase(struct mtd_info *mtd, struct erase_info *instr) static int map_absent_erase(struct mtd_info *mtd, struct erase_info *instr)
......
...@@ -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.14 2004/08/09 13:19:43 dwmw2 Exp $ * $Id: sharp.c,v 1.16 2005/11/07 11:14:23 gleixner Exp $
* *
* Devices supported: * Devices supported:
* LH28F016SCT Symmetrical block flash memory, 2Mx8 * LH28F016SCT Symmetrical block flash memory, 2Mx8
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/mtd/cfi.h> #include <linux/mtd/cfi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h>
#define CMD_RESET 0xffffffff #define CMD_RESET 0xffffffff
#define CMD_READ_ID 0x90909090 #define CMD_READ_ID 0x90909090
...@@ -214,7 +215,7 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) ...@@ -214,7 +215,7 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
/* This function returns with the chip->mutex lock held. */ /* This function returns with the chip->mutex lock held. */
static int sharp_wait(struct map_info *map, struct flchip *chip) static int sharp_wait(struct map_info *map, struct flchip *chip)
{ {
__u16 status; int status, i;
unsigned long timeo = jiffies + HZ; unsigned long timeo = jiffies + HZ;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
int adr = 0; int adr = 0;
...@@ -227,13 +228,11 @@ static int sharp_wait(struct map_info *map, struct flchip *chip) ...@@ -227,13 +228,11 @@ static int sharp_wait(struct map_info *map, struct flchip *chip)
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); for(i=0;i<100;i++){
//printk("status=%08x\n",status); status = map_read32(map,adr);
if((status & SR_READY)==SR_READY)
udelay(100); break;
if((status & SR_READY)!=SR_READY){ udelay(1);
//printk(".status=%08x\n",status);
udelay(100);
} }
break; break;
default: default:
...@@ -460,12 +459,12 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip, ...@@ -460,12 +459,12 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip,
remove_wait_queue(&chip->wq, &wait); remove_wait_queue(&chip->wq, &wait);
//spin_lock_bh(chip->mutex); //spin_lock_bh(chip->mutex);
if (signal_pending(current)){ if (signal_pending(current)){
ret = -EINTR; ret = -EINTR;
goto out; goto out;
} }
} }
ret = -ETIME; ret = -ETIME;
out: out:
...@@ -564,7 +563,7 @@ static int sharp_suspend(struct mtd_info *mtd) ...@@ -564,7 +563,7 @@ static int sharp_suspend(struct mtd_info *mtd)
static void sharp_resume(struct mtd_info *mtd) static void sharp_resume(struct mtd_info *mtd)
{ {
printk("sharp_resume()\n"); printk("sharp_resume()\n");
} }
static void sharp_destroy(struct mtd_info *mtd) static void sharp_destroy(struct mtd_info *mtd)
......
/* /*
* $Id: cmdlinepart.c,v 1.18 2005/06/07 15:04:26 joern Exp $ * $Id: cmdlinepart.c,v 1.19 2005/11/07 11:14:19 gleixner Exp $
* *
* Read flash partition table from command line * Read flash partition table from command line
* *
* Copyright 2002 SYSGO Real-Time Solutions GmbH * Copyright 2002 SYSGO Real-Time Solutions GmbH
* *
* The format for the command line is as follows: * The format for the command line is as follows:
* *
* mtdparts=<mtddef>[;<mtddef] * mtdparts=<mtddef>[;<mtddef]
* <mtddef> := <mtd-id>:<partdef>[,<partdef>] * <mtddef> := <mtd-id>:<partdef>[,<partdef>]
* <partdef> := <size>[@offset][<name>][ro] * <partdef> := <size>[@offset][<name>][ro]
* <mtd-id> := unique name used in mapping driver/device (mtd->name) * <mtd-id> := unique name used in mapping driver/device (mtd->name)
* <size> := standard linux memsize OR "-" to denote all remaining space * <size> := standard linux memsize OR "-" to denote all remaining space
* <name> := '(' NAME ')' * <name> := '(' NAME ')'
* *
* Examples: * Examples:
* *
* 1 NOR Flash, with 1 single writable partition: * 1 NOR Flash, with 1 single writable partition:
* edb7312-nor:- * edb7312-nor:-
* *
* 1 NOR Flash with 2 partitions, 1 NAND with one * 1 NOR Flash with 2 partitions, 1 NAND with one
* edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) * edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)
*/ */
...@@ -60,17 +60,17 @@ static int cmdline_parsed = 0; ...@@ -60,17 +60,17 @@ static int cmdline_parsed = 0;
/* /*
* Parse one partition definition for an MTD. Since there can be many * Parse one partition definition for an MTD. Since there can be many
* comma separated partition definitions, this function calls itself * comma separated partition definitions, this function calls itself
* recursively until no more partition definitions are found. Nice side * recursively until no more partition definitions are found. Nice side
* effect: the memory to keep the mtd_partition structs and the names * effect: the memory to keep the mtd_partition structs and the names
* is allocated upon the last definition being found. At that point the * is allocated upon the last definition being found. At that point the
* syntax has been verified ok. * syntax has been verified ok.
*/ */
static struct mtd_partition * newpart(char *s, static struct mtd_partition * newpart(char *s,
char **retptr, char **retptr,
int *num_parts, int *num_parts,
int this_part, int this_part,
unsigned char **extra_mem_ptr, unsigned char **extra_mem_ptr,
int extra_mem_size) int extra_mem_size)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
...@@ -102,7 +102,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -102,7 +102,7 @@ static struct mtd_partition * newpart(char *s,
mask_flags = 0; /* this is going to be a regular partition */ mask_flags = 0; /* this is going to be a regular partition */
delim = 0; delim = 0;
/* check for offset */ /* check for offset */
if (*s == '@') if (*s == '@')
{ {
s++; s++;
offset = memparse(s, &s); offset = memparse(s, &s);
...@@ -112,7 +112,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -112,7 +112,7 @@ static struct mtd_partition * newpart(char *s,
{ {
delim = ')'; delim = ')';
} }
if (delim) if (delim)
{ {
char *p; char *p;
...@@ -131,12 +131,12 @@ static struct mtd_partition * newpart(char *s, ...@@ -131,12 +131,12 @@ static struct mtd_partition * newpart(char *s,
name = NULL; name = NULL;
name_len = 13; /* Partition_000 */ name_len = 13; /* Partition_000 */
} }
/* record name length for memory allocation later */ /* record name length for memory allocation later */
extra_mem_size += name_len + 1; extra_mem_size += name_len + 1;
/* test for options */ /* test for options */
if (strncmp(s, "ro", 2) == 0) if (strncmp(s, "ro", 2) == 0)
{ {
mask_flags |= MTD_WRITEABLE; mask_flags |= MTD_WRITEABLE;
s += 2; s += 2;
...@@ -151,7 +151,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -151,7 +151,7 @@ static struct mtd_partition * newpart(char *s,
return NULL; return NULL;
} }
/* more partitions follow, parse them */ /* more partitions follow, parse them */
if ((parts = newpart(s + 1, &s, num_parts, if ((parts = newpart(s + 1, &s, num_parts,
this_part + 1, &extra_mem, extra_mem_size)) == 0) this_part + 1, &extra_mem, extra_mem_size)) == 0)
return NULL; return NULL;
} }
...@@ -187,7 +187,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -187,7 +187,7 @@ static struct mtd_partition * newpart(char *s,
extra_mem += name_len + 1; extra_mem += name_len + 1;
dbg(("partition %d: name <%s>, offset %x, size %x, mask flags %x\n", dbg(("partition %d: name <%s>, offset %x, size %x, mask flags %x\n",
this_part, this_part,
parts[this_part].name, parts[this_part].name,
parts[this_part].offset, parts[this_part].offset,
parts[this_part].size, parts[this_part].size,
...@@ -204,8 +204,8 @@ static struct mtd_partition * newpart(char *s, ...@@ -204,8 +204,8 @@ static struct mtd_partition * newpart(char *s,
return parts; return parts;
} }
/* /*
* Parse the command line. * Parse the command line.
*/ */
static int mtdpart_setup_real(char *s) static int mtdpart_setup_real(char *s)
{ {
...@@ -230,7 +230,7 @@ static int mtdpart_setup_real(char *s) ...@@ -230,7 +230,7 @@ static int mtdpart_setup_real(char *s)
dbg(("parsing <%s>\n", p+1)); dbg(("parsing <%s>\n", p+1));
/* /*
* parse one mtd. have it reserve memory for the * parse one mtd. have it reserve memory for the
* struct cmdline_mtd_partition and the mtd-id string. * struct cmdline_mtd_partition and the mtd-id string.
*/ */
...@@ -239,7 +239,7 @@ static int mtdpart_setup_real(char *s) ...@@ -239,7 +239,7 @@ 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*/); sizeof(void*)-1 /*alignment*/);
if(!parts) if(!parts)
{ {
...@@ -254,21 +254,21 @@ static int mtdpart_setup_real(char *s) ...@@ -254,21 +254,21 @@ static int mtdpart_setup_real(char *s)
} }
/* align this_mtd */ /* align this_mtd */
this_mtd = (struct cmdline_mtd_partition *) this_mtd = (struct cmdline_mtd_partition *)
ALIGN((unsigned long)this_mtd, sizeof(void*)); 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;
this_mtd->mtd_id = (char*)(this_mtd + 1); this_mtd->mtd_id = (char*)(this_mtd + 1);
strlcpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1); strlcpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1);
/* link into chain */ /* link into chain */
this_mtd->next = partitions; this_mtd->next = partitions;
partitions = this_mtd; partitions = this_mtd;
dbg(("mtdid=<%s> num_parts=<%d>\n", dbg(("mtdid=<%s> num_parts=<%d>\n",
this_mtd->mtd_id, this_mtd->num_parts)); this_mtd->mtd_id, this_mtd->num_parts));
/* EOS - we're done */ /* EOS - we're done */
if (*s == 0) if (*s == 0)
...@@ -292,7 +292,7 @@ static int mtdpart_setup_real(char *s) ...@@ -292,7 +292,7 @@ static int mtdpart_setup_real(char *s)
* information. It returns partitions for the requested mtd device, or * information. It returns partitions for the requested mtd device, or
* the first one in the chain if a NULL mtd_id is passed in. * the first one in the chain if a NULL mtd_id is passed in.
*/ */
static 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,
unsigned long origin) unsigned long origin)
{ {
...@@ -322,7 +322,7 @@ static int parse_cmdline_partitions(struct mtd_info *master, ...@@ -322,7 +322,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,
part->parts[i].size = master->size - offset; part->parts[i].size = master->size - offset;
if (offset + part->parts[i].size > master->size) if (offset + part->parts[i].size > master->size)
{ {
printk(KERN_WARNING ERRP printk(KERN_WARNING ERRP
"%s: partitioning exceeds flash size, truncating\n", "%s: partitioning exceeds flash size, truncating\n",
part->mtd_id); part->mtd_id);
part->parts[i].size = master->size - offset; part->parts[i].size = master->size - offset;
...@@ -338,8 +338,8 @@ static int parse_cmdline_partitions(struct mtd_info *master, ...@@ -338,8 +338,8 @@ static int parse_cmdline_partitions(struct mtd_info *master,
} }
/* /*
* This is the handler for our kernel parameter, called from * This is the handler for our kernel parameter, called from
* main.c::checksetup(). Note that we can not yet kmalloc() anything, * main.c::checksetup(). Note that we can not yet kmalloc() anything,
* so we only save the commandline for later processing. * so we only save the commandline for later processing.
* *
......
# drivers/mtd/maps/Kconfig # drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.15 2004/12/22 17:51:15 joern Exp $ # $Id: Kconfig,v 1.18 2005/11/07 11:14:24 gleixner Exp $
menu "Self-contained MTD device drivers" menu "Self-contained MTD device drivers"
depends on MTD!=n depends on MTD!=n
...@@ -110,7 +110,7 @@ config MTDRAM_ABS_POS ...@@ -110,7 +110,7 @@ config MTDRAM_ABS_POS
If you have system RAM accessible by the CPU but not used by Linux If you have system RAM accessible by the CPU but not used by Linux
in normal operation, you can give the physical address at which the in normal operation, you can give the physical address at which the
available RAM starts, and the MTDRAM driver will use it instead of available RAM starts, and the MTDRAM driver will use it instead of
allocating space from Linux's available memory. Otherwise, leave allocating space from Linux's available memory. Otherwise, leave
this set to zero. Most people will want to leave this as zero. this set to zero. Most people will want to leave this as zero.
config MTD_BLKMTD config MTD_BLKMTD
...@@ -165,7 +165,7 @@ config MTD_DOC2001 ...@@ -165,7 +165,7 @@ config MTD_DOC2001
select MTD_DOCPROBE select MTD_DOCPROBE
select MTD_NAND_IDS select MTD_NAND_IDS
---help--- ---help---
This provides an alternative MTD device driver for the M-Systems This provides an alternative MTD device driver for the M-Systems
DiskOnChip Millennium devices. Use this if you have problems with DiskOnChip Millennium devices. Use this if you have problems with
the combined DiskOnChip 2000 and Millennium driver above. To get the combined DiskOnChip 2000 and Millennium driver above. To get
the DiskOnChip probe code to load and use this driver instead of the DiskOnChip probe code to load and use this driver instead of
...@@ -192,7 +192,7 @@ config MTD_DOC2001PLUS ...@@ -192,7 +192,7 @@ config MTD_DOC2001PLUS
If you use this device, you probably also want to enable the INFTL If you use this device, you probably also want to enable the INFTL
'Inverse NAND Flash Translation Layer' option below, which is used 'Inverse NAND Flash Translation Layer' option below, which is used
to emulate a block device by using a kind of file system on the to emulate a block device by using a kind of file system on the
flash chips. flash chips.
NOTE: This driver will soon be replaced by the new DiskOnChip driver NOTE: This driver will soon be replaced by the new DiskOnChip driver
......
/* /*
* $Id: blkmtd.c,v 1.24 2004/11/16 18:29:01 dwmw2 Exp $ * $Id: blkmtd.c,v 1.27 2005/11/07 11:14:24 gleixner Exp $
* *
* blkmtd.c - use a block device as a fake MTD * blkmtd.c - use a block device as a fake MTD
* *
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
/* Default erase size in K, always make it a multiple of PAGE_SIZE */ /* Default erase size in K, always make it a multiple of PAGE_SIZE */
#define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10) /* 128KiB */ #define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10) /* 128KiB */
#define VERSION "$Revision: 1.24 $" #define VERSION "$Revision: 1.27 $"
/* Info for the block device */ /* Info for the block device */
struct blkmtd_dev { struct blkmtd_dev {
...@@ -117,7 +117,7 @@ static int bi_write_complete(struct bio *bio, unsigned int bytes_done, int error ...@@ -117,7 +117,7 @@ static int bi_write_complete(struct bio *bio, unsigned int bytes_done, int error
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
} while (bvec >= bio->bi_io_vec); } while (bvec >= bio->bi_io_vec);
complete((struct completion*)bio->bi_private); complete((struct completion*)bio->bi_private);
return 0; return 0;
} }
...@@ -135,7 +135,7 @@ static int blkmtd_readpage(struct blkmtd_dev *dev, struct page *page) ...@@ -135,7 +135,7 @@ static int blkmtd_readpage(struct blkmtd_dev *dev, struct page *page)
unlock_page(page); unlock_page(page);
return 0; return 0;
} }
ClearPageUptodate(page); ClearPageUptodate(page);
ClearPageError(page); ClearPageError(page);
...@@ -707,7 +707,7 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size ...@@ -707,7 +707,7 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
dev->mtd_info.erasesize >> 10, dev->mtd_info.erasesize >> 10,
readonly ? "(read-only)" : ""); readonly ? "(read-only)" : "");
} }
return dev; return dev;
devinit_err: devinit_err:
......
/* /*
* $Id: block2mtd.c,v 1.28 2005/03/19 22:40:44 gleixner Exp $ * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $
* *
* block2mtd.c - create an mtd from a block device * block2mtd.c - create an mtd from a block device
* *
...@@ -19,7 +19,7 @@ ...@@ -19,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.28 $" #define VERSION "$Revision: 1.29 $"
#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
...@@ -111,7 +111,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len) ...@@ -111,7 +111,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
return PTR_ERR(page); return PTR_ERR(page);
max = (u_long*)page_address(page) + PAGE_SIZE; max = (u_long*)page_address(page) + PAGE_SIZE;
for (p=(u_long*)page_address(page); p<max; p++) for (p=(u_long*)page_address(page); p<max; p++)
if (*p != -1UL) { if (*p != -1UL) {
lock_page(page); lock_page(page);
memset(page_address(page), 0xff, PAGE_SIZE); memset(page_address(page), 0xff, PAGE_SIZE);
...@@ -206,7 +206,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf, ...@@ -206,7 +206,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
if (retlen) if (retlen)
*retlen = 0; *retlen = 0;
while (len) { while (len) {
if ((offset+len) > PAGE_SIZE) if ((offset+len) > PAGE_SIZE)
cpylen = PAGE_SIZE - offset; // multiple pages cpylen = PAGE_SIZE - offset; // multiple pages
else else
cpylen = len; // this page cpylen = len; // this page
......
...@@ -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.66 2005/01/05 18:05:12 dwmw2 Exp $ * $Id: doc2000.c,v 1.67 2005/11/07 11:14:24 gleixner Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -58,7 +58,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -58,7 +58,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *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, struct nand_oobinfo *oobsel); size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, static int doc_writev_ecc(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,
u_char *eccbuf, struct nand_oobinfo *oobsel); u_char *eccbuf, struct nand_oobinfo *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,
...@@ -76,14 +76,14 @@ static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles) ...@@ -76,14 +76,14 @@ static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles)
{ {
volatile char dummy; volatile char dummy;
int i; int i;
for (i = 0; i < cycles; i++) { for (i = 0; i < cycles; i++) {
if (DoC_is_Millennium(doc)) if (DoC_is_Millennium(doc))
dummy = ReadDOC(doc->virtadr, NOP); dummy = ReadDOC(doc->virtadr, NOP);
else else
dummy = ReadDOC(doc->virtadr, DOCStatus); dummy = ReadDOC(doc->virtadr, DOCStatus);
} }
} }
/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */ /* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */
...@@ -220,8 +220,8 @@ static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs, ...@@ -220,8 +220,8 @@ static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
WriteDOC(ofs & 0xff, docptr, WritePipeTerm); WriteDOC(ofs & 0xff, docptr, WritePipeTerm);
DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */ DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */
/* FIXME: The SlowIO's for millennium could be replaced by /* FIXME: The SlowIO's for millennium could be replaced by
a single WritePipeTerm here. mf. */ a single WritePipeTerm here. mf. */
/* Lower the ALE line */ /* Lower the ALE line */
...@@ -377,9 +377,9 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -377,9 +377,9 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
if (mfr == 0xff || mfr == 0) if (mfr == 0xff || mfr == 0)
return 0; return 0;
/* Check it's the same as the first chip we identified. /* Check it's the same as the first chip we identified.
* M-Systems say that any given DiskOnChip device should only * M-Systems say that any given DiskOnChip device should only
* contain _one_ type of flash part, although that's not a * contain _one_ type of flash part, although that's not a
* hardware restriction. */ * hardware restriction. */
if (doc->mfr) { if (doc->mfr) {
if (doc->mfr == mfr && doc->id == id) if (doc->mfr == mfr && doc->id == id)
...@@ -397,7 +397,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -397,7 +397,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) { for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
if (nand_manuf_ids[j].id == mfr) if (nand_manuf_ids[j].id == mfr)
break; 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:%s)\n", mfr, id, "Chip ID: %2.2X (%s:%s)\n", mfr, id,
...@@ -405,7 +405,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -405,7 +405,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
if (!doc->mfr) { if (!doc->mfr) {
doc->mfr = mfr; doc->mfr = mfr;
doc->id = id; doc->id = id;
doc->chipshift = doc->chipshift =
ffs((nand_flash_ids[i].chipsize << 20)) - 1; ffs((nand_flash_ids[i].chipsize << 20)) - 1;
doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0; doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;
doc->pageadrlen = doc->chipshift > 25 ? 3 : 2; doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;
...@@ -467,7 +467,7 @@ static void DoC_ScanChips(struct DiskOnChip *this, int maxchips) ...@@ -467,7 +467,7 @@ static void DoC_ScanChips(struct DiskOnChip *this, int maxchips)
ret = 0; ret = 0;
/* Fill out the chip array with {floor, chipno} for each /* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */ * detected chip in the device. */
for (floor = 0; floor < MAX_FLOORS; floor++) { for (floor = 0; floor < MAX_FLOORS; floor++) {
for (chip = 0; chip < numchips[floor]; chip++) { for (chip = 0; chip < numchips[floor]; chip++) {
...@@ -757,12 +757,12 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -757,12 +757,12 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
(long)from, eccbuf[0], eccbuf[1], eccbuf[2], (long)from, eccbuf[0], eccbuf[1], eccbuf[2],
eccbuf[3], eccbuf[4], eccbuf[5]); eccbuf[3], eccbuf[4], eccbuf[5]);
#endif #endif
/* disable the ECC engine */ /* disable the ECC engine */
WriteDOC(DOC_ECC_DIS, docptr , ECCConf); WriteDOC(DOC_ECC_DIS, docptr , ECCConf);
} }
/* according to 11.4.1, we need to wait for the busy line /* according to 11.4.1, we need to wait for the busy line
* drop if we read to the end of the page. */ * drop if we read to the end of the page. */
if(0 == ((from + len) & 0x1ff)) if(0 == ((from + len) & 0x1ff))
{ {
...@@ -941,7 +941,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -941,7 +941,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
/* Let the caller know we completed it */ /* Let the caller know we completed it */
*retlen += len; *retlen += len;
if (eccbuf) { if (eccbuf) {
unsigned char x[8]; unsigned char x[8];
size_t dummy; size_t dummy;
...@@ -950,10 +950,10 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -950,10 +950,10 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
/* Write the ECC data to flash */ /* Write the ECC data to flash */
for (di=0; di<6; di++) for (di=0; di<6; di++)
x[di] = eccbuf[di]; x[di] = eccbuf[di];
x[6]=0x55; x[6]=0x55;
x[7]=0x55; x[7]=0x55;
ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x); ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x);
if (ret) { if (ret) {
up(&this->lock); up(&this->lock);
...@@ -970,7 +970,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -970,7 +970,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
return 0; return 0;
} }
static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, static int doc_writev_ecc(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,
u_char *eccbuf, struct nand_oobinfo *oobsel) u_char *eccbuf, struct nand_oobinfo *oobsel)
{ {
...@@ -1022,7 +1022,7 @@ static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, ...@@ -1022,7 +1022,7 @@ static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
break; break;
to += thislen; to += thislen;
} }
up(&writev_buf_sem); up(&writev_buf_sem);
*retlen = totretlen; *retlen = totretlen;
...@@ -1080,7 +1080,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, ...@@ -1080,7 +1080,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
/* Reading the full OOB data drops us off of the end of the page, /* Reading the full OOB data drops us off of the end of the page,
* causing the flash device to go into busy mode, so we need * causing the flash device to go into busy mode, so we need
* to wait until ready 11.4.1 and Toshiba TC58256FT docs */ * to wait until ready 11.4.1 and Toshiba TC58256FT docs */
ret = DoC_WaitReady(this); ret = DoC_WaitReady(this);
up(&this->lock); up(&this->lock);
...@@ -1190,7 +1190,7 @@ static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len, ...@@ -1190,7 +1190,7 @@ static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,
return 0; return 0;
} }
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,
size_t * retlen, const u_char * buf) size_t * retlen, const u_char * buf)
{ {
...@@ -1222,7 +1222,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1222,7 +1222,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
} }
instr->state = MTD_ERASING; instr->state = MTD_ERASING;
/* FIXME: Do this in the background. Use timers or schedule_task() */ /* FIXME: Do this in the background. Use timers or schedule_task() */
while(len) { while(len) {
mychip = &this->chips[ofs >> this->chipshift]; mychip = &this->chips[ofs >> this->chipshift];
......
...@@ -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.48 2005/01/05 18:05:12 dwmw2 Exp $ * $Id: doc2001.c,v 1.49 2005/11/07 11:14:24 gleixner Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -196,10 +196,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -196,10 +196,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
DoC_Command(doc->virtadr, NAND_CMD_RESET, CDSN_CTRL_WP); DoC_Command(doc->virtadr, NAND_CMD_RESET, CDSN_CTRL_WP);
DoC_WaitReady(doc->virtadr); DoC_WaitReady(doc->virtadr);
/* Read the NAND chip ID: 1. Send ReadID command */ /* Read the NAND chip ID: 1. Send ReadID command */
DoC_Command(doc->virtadr, NAND_CMD_READID, CDSN_CTRL_WP); DoC_Command(doc->virtadr, NAND_CMD_READID, CDSN_CTRL_WP);
/* Read the NAND chip ID: 2. Send address byte zero */ /* Read the NAND chip ID: 2. Send address byte zero */
DoC_Address(doc->virtadr, 1, 0x00, CDSN_CTRL_WP, 0x00); DoC_Address(doc->virtadr, 1, 0x00, CDSN_CTRL_WP, 0x00);
/* Read the manufacturer and device id codes of the flash device through /* Read the manufacturer and device id codes of the flash device through
...@@ -223,7 +223,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -223,7 +223,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) { for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
if (nand_manuf_ids[j].id == mfr) if (nand_manuf_ids[j].id == mfr)
break; 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:%s)\n", "Chip ID: %2.2X (%s:%s)\n",
mfr, id, nand_manuf_ids[j].name, nand_flash_ids[i].name); mfr, id, nand_manuf_ids[j].name, nand_flash_ids[i].name);
...@@ -275,7 +275,7 @@ static void DoC_ScanChips(struct DiskOnChip *this) ...@@ -275,7 +275,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
return; return;
} }
/* Fill out the chip array with {floor, chipno} for each /* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */ * detected chip in the device. */
for (floor = 0, ret = 0; floor < MAX_FLOORS_MIL; floor++) { for (floor = 0, ret = 0; floor < MAX_FLOORS_MIL; floor++) {
for (chip = 0 ; chip < numchips[floor] ; chip++) { for (chip = 0 ; chip < numchips[floor] ; chip++) {
...@@ -309,7 +309,7 @@ static int DoCMil_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2) ...@@ -309,7 +309,7 @@ static int DoCMil_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2)
tmp2 = ReadDOC(doc2->virtadr, AliasResolution); tmp2 = ReadDOC(doc2->virtadr, AliasResolution);
if (tmp1 != tmp2) if (tmp1 != tmp2)
return 0; return 0;
WriteDOC((tmp1+1) % 0xff, doc1->virtadr, AliasResolution); WriteDOC((tmp1+1) % 0xff, doc1->virtadr, AliasResolution);
tmp2 = ReadDOC(doc2->virtadr, AliasResolution); tmp2 = ReadDOC(doc2->virtadr, AliasResolution);
if (tmp2 == (tmp1+1) % 0xff) if (tmp2 == (tmp1+1) % 0xff)
...@@ -425,7 +425,7 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, ...@@ -425,7 +425,7 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
return -EINVAL; return -EINVAL;
/* Don't allow a single read to cross a 512-byte block boundary */ /* Don't allow a single read to cross a 512-byte block boundary */
if (from + len > ((from | 0x1ff) + 1)) if (from + len > ((from | 0x1ff) + 1))
len = ((from | 0x1ff) + 1) - from; len = ((from | 0x1ff) + 1) - from;
/* Find the chip which is to be used and select it */ /* Find the chip which is to be used and select it */
...@@ -552,7 +552,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, ...@@ -552,7 +552,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
#if 0 #if 0
/* Don't allow a single write to cross a 512-byte block boundary */ /* Don't allow a single write to cross a 512-byte block boundary */
if (to + len > ( (to | 0x1ff) + 1)) if (to + len > ( (to | 0x1ff) + 1))
len = ((to | 0x1ff) + 1) - to; len = ((to | 0x1ff) + 1) - to;
#else #else
/* Don't allow writes which aren't exactly one block */ /* Don't allow writes which aren't exactly one block */
...@@ -632,7 +632,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, ...@@ -632,7 +632,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
/* write the block status BLOCK_USED (0x5555) at the end of ECC data /* write the block status BLOCK_USED (0x5555) at the end of ECC data
FIXME: this is only a hack for programming the IPL area for LinuxBIOS FIXME: this is only a hack for programming the IPL area for LinuxBIOS
and should be replace with proper codes in user space utilities */ and should be replace with proper codes in user space utilities */
WriteDOC(0x55, docptr, Mil_CDSN_IO); WriteDOC(0x55, docptr, Mil_CDSN_IO);
WriteDOC(0x55, docptr, Mil_CDSN_IO + 1); WriteDOC(0x55, docptr, Mil_CDSN_IO + 1);
...@@ -802,7 +802,7 @@ int doc_erase (struct mtd_info *mtd, struct erase_info *instr) ...@@ -802,7 +802,7 @@ int doc_erase (struct mtd_info *mtd, struct erase_info *instr)
void __iomem *docptr = this->virtadr; void __iomem *docptr = this->virtadr;
struct Nand *mychip = &this->chips[ofs >> this->chipshift]; struct Nand *mychip = &this->chips[ofs >> this->chipshift];
if (len != mtd->erasesize) if (len != mtd->erasesize)
printk(KERN_WARNING "Erase not right size (%x != %x)n", printk(KERN_WARNING "Erase not right size (%x != %x)n",
len, mtd->erasesize); len, mtd->erasesize);
...@@ -870,9 +870,9 @@ static void __exit cleanup_doc2001(void) ...@@ -870,9 +870,9 @@ static void __exit cleanup_doc2001(void)
while ((mtd=docmillist)) { while ((mtd=docmillist)) {
this = mtd->priv; this = mtd->priv;
docmillist = this->nextdoc; docmillist = this->nextdoc;
del_mtd_device(mtd); del_mtd_device(mtd);
iounmap(this->virtadr); iounmap(this->virtadr);
kfree(this->chips); kfree(this->chips);
kfree(mtd); kfree(mtd);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,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: doc2001plus.c,v 1.13 2005/01/05 18:05:12 dwmw2 Exp $ * $Id: doc2001plus.c,v 1.14 2005/11/07 11:14:24 gleixner Exp $
* *
* Released under GPL * Released under GPL
*/ */
...@@ -293,10 +293,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) ...@@ -293,10 +293,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
DoC_Command(docptr, NAND_CMD_RESET, 0); DoC_Command(docptr, NAND_CMD_RESET, 0);
DoC_WaitReady(docptr); DoC_WaitReady(docptr);
/* Read the NAND chip ID: 1. Send ReadID command */ /* Read the NAND chip ID: 1. Send ReadID command */
DoC_Command(docptr, NAND_CMD_READID, 0); DoC_Command(docptr, NAND_CMD_READID, 0);
/* Read the NAND chip ID: 2. Send address byte zero */ /* Read the NAND chip ID: 2. Send address byte zero */
DoC_Address(doc, 1, 0x00, 0, 0x00); DoC_Address(doc, 1, 0x00, 0, 0x00);
WriteDOC(0, docptr, Mplus_FlashControl); WriteDOC(0, docptr, Mplus_FlashControl);
...@@ -365,7 +365,7 @@ static void DoC_ScanChips(struct DiskOnChip *this) ...@@ -365,7 +365,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
this->interleave = 1; this->interleave = 1;
/* Check the ASIC agrees */ /* Check the ASIC agrees */
if ( (this->interleave << 2) != if ( (this->interleave << 2) !=
(ReadDOC(this->virtadr, Mplus_Configuration) & 4)) { (ReadDOC(this->virtadr, Mplus_Configuration) & 4)) {
u_char conf = ReadDOC(this->virtadr, Mplus_Configuration); u_char conf = ReadDOC(this->virtadr, Mplus_Configuration);
printk(KERN_NOTICE "Setting DiskOnChip Millennium Plus interleave to %s\n", printk(KERN_NOTICE "Setting DiskOnChip Millennium Plus interleave to %s\n",
...@@ -398,7 +398,7 @@ static void DoC_ScanChips(struct DiskOnChip *this) ...@@ -398,7 +398,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
return; return;
} }
/* Fill out the chip array with {floor, chipno} for each /* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */ * detected chip in the device. */
for (floor = 0, ret = 0; floor < MAX_FLOORS_MPLUS; floor++) { for (floor = 0, ret = 0; floor < MAX_FLOORS_MPLUS; floor++) {
for (chip = 0 ; chip < numchips[floor] ; chip++) { for (chip = 0 ; chip < numchips[floor] ; chip++) {
...@@ -432,7 +432,7 @@ static int DoCMilPlus_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2) ...@@ -432,7 +432,7 @@ static int DoCMilPlus_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2)
tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution); tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution);
if (tmp1 != tmp2) if (tmp1 != tmp2)
return 0; return 0;
WriteDOC((tmp1+1) % 0xff, doc1->virtadr, Mplus_AliasResolution); WriteDOC((tmp1+1) % 0xff, doc1->virtadr, Mplus_AliasResolution);
tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution); tmp2 = ReadDOC(doc2->virtadr, Mplus_AliasResolution);
if (tmp2 == (tmp1+1) % 0xff) if (tmp2 == (tmp1+1) % 0xff)
...@@ -624,7 +624,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -624,7 +624,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
return -EINVAL; return -EINVAL;
/* Don't allow a single read to cross a 512-byte block boundary */ /* Don't allow a single read to cross a 512-byte block boundary */
if (from + len > ((from | 0x1ff) + 1)) if (from + len > ((from | 0x1ff) + 1))
len = ((from | 0x1ff) + 1) - from; len = ((from | 0x1ff) + 1) - from;
DoC_CheckASIC(docptr); DoC_CheckASIC(docptr);
...@@ -1066,7 +1066,7 @@ int doc_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1066,7 +1066,7 @@ int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
DoC_CheckASIC(docptr); DoC_CheckASIC(docptr);
if (len != mtd->erasesize) if (len != mtd->erasesize)
printk(KERN_WARNING "MTD: Erase not right size (%x != %x)n", printk(KERN_WARNING "MTD: Erase not right size (%x != %x)n",
len, mtd->erasesize); len, mtd->erasesize);
...@@ -1136,9 +1136,9 @@ static void __exit cleanup_doc2001plus(void) ...@@ -1136,9 +1136,9 @@ static void __exit cleanup_doc2001plus(void)
while ((mtd=docmilpluslist)) { while ((mtd=docmilpluslist)) {
this = mtd->priv; this = mtd->priv;
docmilpluslist = this->nextdoc; docmilpluslist = this->nextdoc;
del_mtd_device(mtd); del_mtd_device(mtd);
iounmap(this->virtadr); iounmap(this->virtadr);
kfree(this->chips); kfree(this->chips);
kfree(mtd); kfree(mtd);
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
* GNU GPL License. The rest is simply to convert the disk on chip * GNU GPL License. The rest is simply to convert the disk on chip
* syndrom into a standard syndom. * syndrom into a standard syndom.
* *
* Author: Fabrice Bellard (fabrice.bellard@netgem.com) * Author: Fabrice Bellard (fabrice.bellard@netgem.com)
* Copyright (C) 2000 Netgem S.A. * Copyright (C) 2000 Netgem S.A.
* *
* $Id: docecc.c,v 1.5 2003/05/21 15:15:06 dwmw2 Exp $ * $Id: docecc.c,v 1.7 2005/11/07 11:14:25 gleixner 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
...@@ -122,7 +122,7 @@ for(ci=(n)-1;ci >=0;ci--)\ ...@@ -122,7 +122,7 @@ for(ci=(n)-1;ci >=0;ci--)\
a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1) a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1)
we consider the integer "i" whose binary representation with a(0) being LSB we consider the integer "i" whose binary representation with a(0) being LSB
and a(m-1) MSB is (a(0),a(1),...,a(m-1)) and locate the entry and a(m-1) MSB is (a(0),a(1),...,a(m-1)) and locate the entry
"index_of[i]". Now, @^index_of[i] is that element whose polynomial "index_of[i]". Now, @^index_of[i] is that element whose polynomial
representation is (a(0),a(1),a(2),...,a(m-1)). representation is (a(0),a(1),a(2),...,a(m-1)).
NOTE: NOTE:
The element alpha_to[2^m-1] = 0 always signifying that the The element alpha_to[2^m-1] = 0 always signifying that the
...@@ -130,7 +130,7 @@ for(ci=(n)-1;ci >=0;ci--)\ ...@@ -130,7 +130,7 @@ for(ci=(n)-1;ci >=0;ci--)\
Similarily, the element index_of[0] = A0 always signifying Similarily, the element index_of[0] = A0 always signifying
that the power of alpha which has the polynomial representation that the power of alpha which has the polynomial representation
(0,0,...,0) is "infinity". (0,0,...,0) is "infinity".
*/ */
static void static void
...@@ -176,7 +176,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1]) ...@@ -176,7 +176,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1])
* are written back. NOTE! This array must be at least NN-KK elements long. * are written back. NOTE! This array must be at least NN-KK elements long.
* The corrected data are written in eras_val[]. They must be xor with the data * The corrected data are written in eras_val[]. They must be xor with the data
* to retrieve the correct data : data[erase_pos[i]] ^= erase_val[i] . * to retrieve the correct data : data[erase_pos[i]] ^= erase_val[i] .
* *
* First "no_eras" erasures are declared by the calling program. Then, the * First "no_eras" erasures are declared by the calling program. Then, the
* maximum # of errors correctable is t_after_eras = floor((NN-KK-no_eras)/2). * maximum # of errors correctable is t_after_eras = floor((NN-KK-no_eras)/2).
* If the number of channel errors is not greater than "t_after_eras" the * If the number of channel errors is not greater than "t_after_eras" the
...@@ -189,7 +189,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1]) ...@@ -189,7 +189,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1])
* */ * */
static int static int
eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
gf bb[NN - KK + 1], gf eras_val[NN-KK], int eras_pos[NN-KK], gf bb[NN - KK + 1], gf eras_val[NN-KK], int eras_pos[NN-KK],
int no_eras) int no_eras)
{ {
int deg_lambda, el, deg_omega; int deg_lambda, el, deg_omega;
...@@ -212,7 +212,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -212,7 +212,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
count = 0; count = 0;
goto finish; goto finish;
} }
for(i=1;i<=NN-KK;i++){ for(i=1;i<=NN-KK;i++){
s[i] = bb[0]; s[i] = bb[0];
} }
...@@ -220,7 +220,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -220,7 +220,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
if(bb[j] == 0) if(bb[j] == 0)
continue; continue;
tmp = Index_of[bb[j]]; tmp = Index_of[bb[j]];
for(i=1;i<=NN-KK;i++) for(i=1;i<=NN-KK;i++)
s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*PRIM*j)]; s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*PRIM*j)];
} }
...@@ -234,7 +234,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -234,7 +234,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
tmp = modnn(tmp + 2 * KK * (B0+i-1)*PRIM); tmp = modnn(tmp + 2 * KK * (B0+i-1)*PRIM);
s[i] = tmp; s[i] = tmp;
} }
CLEAR(&lambda[1],NN-KK); CLEAR(&lambda[1],NN-KK);
lambda[0] = 1; lambda[0] = 1;
...@@ -252,7 +252,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -252,7 +252,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
#if DEBUG_ECC >= 1 #if DEBUG_ECC >= 1
/* Test code that verifies the erasure locator polynomial just constructed /* Test code that verifies the erasure locator polynomial just constructed
Needed only for decoder debugging. */ Needed only for decoder debugging. */
/* find roots of the erasure location polynomial */ /* find roots of the erasure location polynomial */
for(i=1;i<=no_eras;i++) for(i=1;i<=no_eras;i++)
reg[i] = Index_of[lambda[i]]; reg[i] = Index_of[lambda[i]];
...@@ -286,7 +286,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -286,7 +286,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
} }
for(i=0;i<NN-KK+1;i++) for(i=0;i<NN-KK+1;i++)
b[i] = Index_of[lambda[i]]; b[i] = Index_of[lambda[i]];
/* /*
* Begin Berlekamp-Massey algorithm to determine error+erasure * Begin Berlekamp-Massey algorithm to determine error+erasure
* locator polynomial * locator polynomial
...@@ -389,7 +389,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -389,7 +389,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
omega[i] = Index_of[tmp]; omega[i] = Index_of[tmp];
} }
omega[NN-KK] = A0; omega[NN-KK] = A0;
/* /*
* Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
* inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form * inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form
...@@ -402,7 +402,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -402,7 +402,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
} }
num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)]; num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)];
den = 0; den = 0;
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) { for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) {
if(lambda[i+1] != A0) if(lambda[i+1] != A0)
...@@ -436,11 +436,11 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], ...@@ -436,11 +436,11 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
/* The sector bytes are packed into NB_DATA MM bits words */ /* The sector bytes are packed into NB_DATA MM bits words */
#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / MM) #define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / MM)
/* /*
* Correct the errors in 'sector[]' by using 'ecc1[]' which is the * Correct the errors in 'sector[]' by using 'ecc1[]' which is the
* content of the feedback shift register applyied to the sector and * content of the feedback shift register applyied to the sector and
* the ECC. Return the number of errors corrected (and correct them in * the ECC. Return the number of errors corrected (and correct them in
* sector), or -1 if error * sector), or -1 if error
*/ */
int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
{ {
...@@ -454,7 +454,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) ...@@ -454,7 +454,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
Alpha_to = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL); Alpha_to = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL);
if (!Alpha_to) if (!Alpha_to)
return -1; return -1;
Index_of = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL); Index_of = kmalloc((NN + 1) * sizeof(dtype), GFP_KERNEL);
if (!Index_of) { if (!Index_of) {
kfree(Alpha_to); kfree(Alpha_to);
...@@ -470,7 +470,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) ...@@ -470,7 +470,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
bb[2] = ((ecc1[2] & 0xf0) >> 4) | ((ecc1[3] & 0x3f) << 4); bb[2] = ((ecc1[2] & 0xf0) >> 4) | ((ecc1[3] & 0x3f) << 4);
bb[3] = ((ecc1[3] & 0xc0) >> 6) | ((ecc1[0] & 0xff) << 2); bb[3] = ((ecc1[3] & 0xc0) >> 6) | ((ecc1[0] & 0xff) << 2);
nb_errors = eras_dec_rs(Alpha_to, Index_of, bb, nb_errors = eras_dec_rs(Alpha_to, Index_of, bb,
error_val, error_pos, 0); error_val, error_pos, 0);
if (nb_errors <= 0) if (nb_errors <= 0)
goto the_end; goto the_end;
...@@ -489,7 +489,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) ...@@ -489,7 +489,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
can be modified since pos is even */ can be modified since pos is even */
index = (pos >> 3) ^ 1; index = (pos >> 3) ^ 1;
bitpos = pos & 7; bitpos = pos & 7;
if ((index >= 0 && index < SECTOR_SIZE) || if ((index >= 0 && index < SECTOR_SIZE) ||
index == (SECTOR_SIZE + 1)) { index == (SECTOR_SIZE + 1)) {
val = error_val[i] >> (2 + bitpos); val = error_val[i] >> (2 + bitpos);
parity ^= val; parity ^= val;
...@@ -500,7 +500,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) ...@@ -500,7 +500,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
bitpos = (bitpos + 10) & 7; bitpos = (bitpos + 10) & 7;
if (bitpos == 0) if (bitpos == 0)
bitpos = 8; bitpos = 8;
if ((index >= 0 && index < SECTOR_SIZE) || if ((index >= 0 && index < SECTOR_SIZE) ||
index == (SECTOR_SIZE + 1)) { index == (SECTOR_SIZE + 1)) {
val = error_val[i] << (8 - bitpos); val = error_val[i] << (8 - bitpos);
parity ^= val; parity ^= val;
...@@ -509,7 +509,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6]) ...@@ -509,7 +509,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
} }
} }
} }
/* use parity to test extra errors */ /* use parity to test extra errors */
if ((parity & 0xff) != 0) if ((parity & 0xff) != 0)
nb_errors = -1; nb_errors = -1;
......
...@@ -4,22 +4,22 @@ ...@@ -4,22 +4,22 @@
/* (C) 1999 Machine Vision Holdings, Inc. */ /* (C) 1999 Machine Vision Holdings, Inc. */
/* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ /* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */
/* $Id: docprobe.c,v 1.44 2005/01/05 12:40:36 dwmw2 Exp $ */ /* $Id: docprobe.c,v 1.46 2005/11/07 11:14:25 gleixner Exp $ */
/* DOC_PASSIVE_PROBE: /* DOC_PASSIVE_PROBE:
In order to ensure that the BIOS checksum is correct at boot time, and In order to ensure that the BIOS checksum is correct at boot time, and
hence that the onboard BIOS extension gets executed, the DiskOnChip hence that the onboard BIOS extension gets executed, the DiskOnChip
goes into reset mode when it is read sequentially: all registers goes into reset mode when it is read sequentially: all registers
return 0xff until the chip is woken up again by writing to the return 0xff until the chip is woken up again by writing to the
DOCControl register. DOCControl register.
Unfortunately, this means that the probe for the DiskOnChip is unsafe, Unfortunately, this means that the probe for the DiskOnChip is unsafe,
because one of the first things it does is write to where it thinks because one of the first things it does is write to where it thinks
the DOCControl register should be - which may well be shared memory the DOCControl register should be - which may well be shared memory
for another device. I've had machines which lock up when this is for another device. I've had machines which lock up when this is
attempted. Hence the possibility to do a passive probe, which will fail attempted. Hence the possibility to do a passive probe, which will fail
to detect a chip in reset mode, but is at least guaranteed not to lock to detect a chip in reset mode, but is at least guaranteed not to lock
the machine. the machine.
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
The old Millennium-only driver has been retained just in case there The old Millennium-only driver has been retained just in case there
are problems with the new code. If the combined driver doesn't work are problems with the new code. If the combined driver doesn't work
for you, you can try the old one by undefining DOC_SINGLE_DRIVER for you, you can try the old one by undefining DOC_SINGLE_DRIVER
below and also enabling it in your configuration. If this fixes the below and also enabling it in your configuration. If this fixes the
problems, please send a report to the MTD mailing list at problems, please send a report to the MTD mailing list at
<linux-mtd@lists.infradead.org>. <linux-mtd@lists.infradead.org>.
*/ */
#define DOC_SINGLE_DRIVER #define DOC_SINGLE_DRIVER
...@@ -68,16 +68,16 @@ MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe ...@@ -68,16 +68,16 @@ MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe
static unsigned long __initdata doc_locations[] = { static unsigned long __initdata doc_locations[] = {
#if defined (__alpha__) || defined(__i386__) || defined(__x86_64__) #if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)
#ifdef CONFIG_MTD_DOCPROBE_HIGH #ifdef CONFIG_MTD_DOCPROBE_HIGH
0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000, 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000,
0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000, 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000,
0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000, 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000,
0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000, 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000,
0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000, 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000,
#else /* CONFIG_MTD_DOCPROBE_HIGH */ #else /* CONFIG_MTD_DOCPROBE_HIGH */
0xc8000, 0xca000, 0xcc000, 0xce000, 0xc8000, 0xca000, 0xcc000, 0xce000,
0xd0000, 0xd2000, 0xd4000, 0xd6000, 0xd0000, 0xd2000, 0xd4000, 0xd6000,
0xd8000, 0xda000, 0xdc000, 0xde000, 0xd8000, 0xda000, 0xdc000, 0xde000,
0xe0000, 0xe2000, 0xe4000, 0xe6000, 0xe0000, 0xe2000, 0xe4000, 0xe6000,
0xe8000, 0xea000, 0xec000, 0xee000, 0xe8000, 0xea000, 0xec000, 0xee000,
#endif /* CONFIG_MTD_DOCPROBE_HIGH */ #endif /* CONFIG_MTD_DOCPROBE_HIGH */
#elif defined(__PPC__) #elif defined(__PPC__)
...@@ -111,35 +111,35 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -111,35 +111,35 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
return 0; return 0;
#endif /* CONFIG_MTD_DOCPROBE_55AA */ #endif /* CONFIG_MTD_DOCPROBE_55AA */
#ifndef DOC_PASSIVE_PROBE #ifndef DOC_PASSIVE_PROBE
/* It's not possible to cleanly detect the DiskOnChip - the /* It's not possible to cleanly detect the DiskOnChip - the
* bootup procedure will put the device into reset mode, and * bootup procedure will put the device into reset mode, and
* it's not possible to talk to it without actually writing * it's not possible to talk to it without actually writing
* to the DOCControl register. So we store the current contents * to the DOCControl register. So we store the current contents
* of the DOCControl register's location, in case we later decide * of the DOCControl register's location, in case we later decide
* that it's not a DiskOnChip, and want to put it back how we * that it's not a DiskOnChip, and want to put it back how we
* found it. * found it.
*/ */
tmp2 = ReadDOC(window, DOCControl); tmp2 = ReadDOC(window, DOCControl);
/* Reset the DiskOnChip ASIC */ /* Reset the DiskOnChip ASIC */
WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET,
window, DOCControl); window, DOCControl);
WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET,
window, DOCControl); window, DOCControl);
/* Enable the DiskOnChip ASIC */ /* Enable the DiskOnChip ASIC */
WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL,
window, DOCControl); window, DOCControl);
WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL,
window, DOCControl); window, DOCControl);
#endif /* !DOC_PASSIVE_PROBE */ #endif /* !DOC_PASSIVE_PROBE */
/* We need to read the ChipID register four times. For some /* We need to read the ChipID register four times. For some
newer DiskOnChip 2000 units, the first three reads will newer DiskOnChip 2000 units, the first three reads will
return the DiskOnChip Millennium ident. Don't ask. */ return the DiskOnChip Millennium ident. Don't ask. */
ChipID = ReadDOC(window, ChipID); ChipID = ReadDOC(window, ChipID);
switch (ChipID) { switch (ChipID) {
case DOC_ChipID_Doc2k: case DOC_ChipID_Doc2k:
/* Check the TOGGLE bit in the ECC register */ /* Check the TOGGLE bit in the ECC register */
...@@ -149,7 +149,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -149,7 +149,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
if (tmp != tmpb && tmp == tmpc) if (tmp != tmpb && tmp == tmpc)
return ChipID; return ChipID;
break; break;
case DOC_ChipID_DocMil: case DOC_ChipID_DocMil:
/* Check for the new 2000 with Millennium ASIC */ /* Check for the new 2000 with Millennium ASIC */
ReadDOC(window, ChipID); ReadDOC(window, ChipID);
...@@ -164,7 +164,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -164,7 +164,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
if (tmp != tmpb && tmp == tmpc) if (tmp != tmpb && tmp == tmpc)
return ChipID; return ChipID;
break; break;
case DOC_ChipID_DocMilPlus16: case DOC_ChipID_DocMilPlus16:
case DOC_ChipID_DocMilPlus32: case DOC_ChipID_DocMilPlus32:
case 0: case 0:
...@@ -179,7 +179,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -179,7 +179,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
DOC_MODE_BDECT; DOC_MODE_BDECT;
WriteDOC(tmp, window, Mplus_DOCControl); WriteDOC(tmp, window, Mplus_DOCControl);
WriteDOC(~tmp, window, Mplus_CtrlConfirm); WriteDOC(~tmp, window, Mplus_CtrlConfirm);
mdelay(1); mdelay(1);
/* Enable the DiskOnChip ASIC */ /* Enable the DiskOnChip ASIC */
tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT | tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT |
...@@ -187,7 +187,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -187,7 +187,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
WriteDOC(tmp, window, Mplus_DOCControl); WriteDOC(tmp, window, Mplus_DOCControl);
WriteDOC(~tmp, window, Mplus_CtrlConfirm); WriteDOC(~tmp, window, Mplus_CtrlConfirm);
mdelay(1); mdelay(1);
#endif /* !DOC_PASSIVE_PROBE */ #endif /* !DOC_PASSIVE_PROBE */
ChipID = ReadDOC(window, ChipID); ChipID = ReadDOC(window, ChipID);
...@@ -227,7 +227,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr ...@@ -227,7 +227,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
WriteDOC(tmp2, window, DOCControl); WriteDOC(tmp2, window, DOCControl);
#endif #endif
return 0; return 0;
} }
static int docfound; static int docfound;
...@@ -244,10 +244,10 @@ static void __init DoC_Probe(unsigned long physadr) ...@@ -244,10 +244,10 @@ static void __init DoC_Probe(unsigned long physadr)
void (*initroutine)(struct mtd_info *) = NULL; void (*initroutine)(struct mtd_info *) = NULL;
docptr = ioremap(physadr, DOC_IOREMAP_LEN); docptr = ioremap(physadr, DOC_IOREMAP_LEN);
if (!docptr) if (!docptr)
return; return;
if ((ChipID = doccheck(docptr, physadr))) { if ((ChipID = doccheck(docptr, physadr))) {
if (ChipID == DOC_ChipID_Doc2kTSOP) { if (ChipID == DOC_ChipID_Doc2kTSOP) {
/* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */ /* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */
...@@ -263,9 +263,9 @@ static void __init DoC_Probe(unsigned long physadr) ...@@ -263,9 +263,9 @@ static void __init DoC_Probe(unsigned long physadr)
iounmap(docptr); iounmap(docptr);
return; return;
} }
this = (struct DiskOnChip *)(&mtd[1]); this = (struct DiskOnChip *)(&mtd[1]);
memset((char *)mtd,0, sizeof(struct mtd_info)); memset((char *)mtd,0, sizeof(struct mtd_info));
memset((char *)this, 0, sizeof(struct DiskOnChip)); memset((char *)this, 0, sizeof(struct DiskOnChip));
...@@ -281,13 +281,13 @@ static void __init DoC_Probe(unsigned long physadr) ...@@ -281,13 +281,13 @@ static void __init DoC_Probe(unsigned long physadr)
im_funcname = "DoC2k_init"; im_funcname = "DoC2k_init";
im_modname = "doc2000"; im_modname = "doc2000";
break; break;
case DOC_ChipID_Doc2k: case DOC_ChipID_Doc2k:
name="2000"; name="2000";
im_funcname = "DoC2k_init"; im_funcname = "DoC2k_init";
im_modname = "doc2000"; im_modname = "doc2000";
break; break;
case DOC_ChipID_DocMil: case DOC_ChipID_DocMil:
name="Millennium"; name="Millennium";
#ifdef DOC_SINGLE_DRIVER #ifdef DOC_SINGLE_DRIVER
...@@ -331,7 +331,7 @@ static void __init DoC_Probe(unsigned long physadr) ...@@ -331,7 +331,7 @@ static void __init DoC_Probe(unsigned long physadr)
static int __init init_doc(void) static int __init init_doc(void)
{ {
int i; int i;
if (doc_config_location) { if (doc_config_location) {
printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location); printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
DoC_Probe(doc_config_location); DoC_Probe(doc_config_location);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART. * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.
* *
* $Id: lart.c,v 1.7 2004/08/09 13:19:44 dwmw2 Exp $ * $Id: lart.c,v 1.9 2005/11/07 11:14:25 gleixner Exp $
* *
* Author: Abraham vd Merwe <abraham@2d3d.co.za> * Author: Abraham vd Merwe <abraham@2d3d.co.za>
* *
...@@ -122,7 +122,7 @@ static char module_name[] = "lart"; ...@@ -122,7 +122,7 @@ static char module_name[] = "lart";
/* /*
* The data line mapping on LART is as follows: * The data line mapping on LART is as follows:
* *
* U2 CPU | U3 CPU * U2 CPU | U3 CPU
* ------------------- * -------------------
* 0 20 | 0 12 * 0 20 | 0 12
...@@ -181,7 +181,7 @@ static char module_name[] = "lart"; ...@@ -181,7 +181,7 @@ static char module_name[] = "lart";
(((x) & 0x00004000) >> 13) \ (((x) & 0x00004000) >> 13) \
) )
/* /*
* The address line mapping on LART is as follows: * The address line mapping on LART is as follows:
* *
* U3 CPU | U2 CPU * U3 CPU | U2 CPU
...@@ -204,7 +204,7 @@ static char module_name[] = "lart"; ...@@ -204,7 +204,7 @@ static char module_name[] = "lart";
* 12 15 | 12 15 * 12 15 | 12 15
* 13 14 | 13 14 * 13 14 | 13 14
* 14 16 | 14 16 * 14 16 | 14 16
* *
* MAIN BLOCK BOUNDARY * MAIN BLOCK BOUNDARY
* *
* 15 17 | 15 18 * 15 17 | 15 18
......
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.
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