Commit d0582887 authored by David Woodhouse's avatar David Woodhouse

MTD driver cleanups...

 - Fix AFS partitioning oops when no partitions are found
 - Add missing spin_unlock, optimise buffer writes in Intel NOR driver
 - Fix DiskOnChip Millennium Plus register OutputControl register definition
 - Fix DiskOnChip drivers to indicate correct ECC type
 - Fix map drivers to use ARRAY_SIZE instead of redefining it.
 - Make uCLinux map driver depend on !MMU
 - Fix NAND write verify problem on some chips
 - Other trivia from Rusty.
parent 56fefe50
......@@ -21,7 +21,7 @@
This is access code for flashes using ARM's flash partitioning
standards.
$Id: afs.c,v 1.11 2003/05/16 17:08:24 dwmw2 Exp $
$Id: afs.c,v 1.12 2003/06/13 15:31:06 rmk Exp $
======================================================================*/
......@@ -76,17 +76,19 @@ afs_read_footer(struct mtd_info *mtd, u_int *img_start, u_int *iis_start,
return ret;
}
ret = 1;
/*
* Does it contain the magic number?
*/
if (fs.signature != 0xa0ffff9f)
ret = 1;
ret = 0;
/*
* Don't touch the SIB.
*/
if (fs.type == 2)
ret = 1;
ret = 0;
*iis_start = fs.image_info_base & mask;
*img_start = fs.image_start & mask;
......@@ -96,14 +98,14 @@ afs_read_footer(struct mtd_info *mtd, u_int *img_start, u_int *iis_start,
* be located after the footer structure.
*/
if (*iis_start >= ptr)
ret = 1;
ret = 0;
/*
* Check the start of this image. The image
* data can not be located after this block.
*/
if (*img_start > off)
ret = 1;
ret = 0;
return ret;
}
......@@ -152,7 +154,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);
if (ret < 0)
break;
if (ret == 1)
if (ret == 0)
continue;
ret = afs_read_iis(mtd, &iis, iis_ptr);
......@@ -185,7 +187,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);
if (ret < 0)
break;
if (ret == 1)
if (ret == 0)
continue;
/* Read the image info block */
......
......@@ -3,7 +3,7 @@
*
* Author: Jonas Holmberg <jonas.holmberg@axis.com>
*
* $Id: amd_flash.c,v 1.22 2003/05/28 13:47:19 dwmw2 Exp $
* $Id: amd_flash.c,v 1.23 2003/06/12 09:24:13 dwmw2 Exp $
*
* Copyright (c) 2001 Axis Communications AB
*
......@@ -19,6 +19,7 @@
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/flashchip.h>
......
......@@ -4,7 +4,7 @@
*
* (C) 2000 Red Hat. GPL'd
*
* $Id: cfi_cmdset_0001.c,v 1.123 2003/05/28 12:51:48 dwmw2 Exp $
* $Id: cfi_cmdset_0001.c,v 1.126 2003/06/23 07:45:48 dwmw2 Exp $
*
*
* 10/10/2000 Nicolas Pitre <nico@cam.org>
......@@ -936,7 +936,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
struct cfi_private *cfi = map->fldrv_priv;
cfi_word status, status_OK;
unsigned long cmd_adr, timeo;
int wbufsize, z, ret=0;
int wbufsize, z, ret=0, bytes, words;
wbufsize = CFIDEV_INTERLEAVE << cfi->cfiq->MaxBufWriteSize;
adr += chip->start;
......@@ -995,10 +995,13 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
}
/* Write length of data to come */
cfi_write(map, CMD(len/CFIDEV_BUSWIDTH-1), cmd_adr );
bytes = len & (CFIDEV_BUSWIDTH-1);
words = len / CFIDEV_BUSWIDTH;
cfi_write(map, CMD(words - !bytes), cmd_adr );
/* Write data */
for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
z = 0;
while(z < words * CFIDEV_BUSWIDTH) {
if (cfi_buswidth_is_1()) {
map_write8 (map, *((__u8*)buf)++, adr+z);
} else if (cfi_buswidth_is_2()) {
......@@ -1011,6 +1014,26 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
ret = -EINVAL;
goto out;
}
z += CFIDEV_BUSWIDTH;
}
if (bytes) {
int i = 0, n = 0;
u_char tmp_buf[8], *tmp_p = tmp_buf;
while (bytes--)
tmp_buf[i++] = buf[n++];
while (i < CFIDEV_BUSWIDTH)
tmp_buf[i++] = 0xff;
if (cfi_buswidth_is_2()) {
map_write16 (map, *((__u16*)tmp_p)++, adr+z);
} else if (cfi_buswidth_is_4()) {
map_write32 (map, *((__u32*)tmp_p)++, adr+z);
} else if (cfi_buswidth_is_8()) {
map_write64 (map, *((__u64*)tmp_p)++, adr+z);
} else {
ret = -EINVAL;
goto out;
}
}
/* GO GO GO */
cfi_write(map, CMD(0xd0), cmd_adr);
......@@ -1119,12 +1142,12 @@ static int cfi_intelext_write_buffers (struct mtd_info *mtd, loff_t to,
}
/* Write buffer is worth it only if more than one word to write... */
while(len > CFIDEV_BUSWIDTH) {
while(len) {
/* We must not cross write block boundaries */
int size = wbufsize - (ofs & (wbufsize-1));
if (size > len)
size = len & ~(CFIDEV_BUSWIDTH-1);
size = len;
ret = do_write_buffer(map, &cfi->chips[chipnum],
ofs, buf, size);
if (ret)
......@@ -1142,17 +1165,6 @@ static int cfi_intelext_write_buffers (struct mtd_info *mtd, loff_t to,
return 0;
}
}
/* ... and write the remaining bytes */
if (len > 0) {
size_t local_retlen;
ret = cfi_intelext_write_words(mtd, ofs + (chipnum << cfi->chipshift),
len, &local_retlen, buf);
if (ret)
return ret;
(*retlen) += local_retlen;
}
return 0;
}
......@@ -1423,6 +1435,7 @@ static void cfi_intelext_sync (struct mtd_info *mtd)
* with the chip now anyway.
*/
}
spin_unlock(chip->mutex);
}
/* Unlock the chips again */
......
......@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2000.c,v 1.52 2003/05/20 21:03:07 dwmw2 Exp $
* $Id: doc2000.c,v 1.53 2003/06/11 09:45:19 dwmw2 Exp $
*/
#include <linux/kernel.h>
......@@ -553,6 +553,7 @@ static void DoC2k_init(struct mtd_info *mtd)
mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->ecctype = MTD_ECC_RS_DiskOnChip;
mtd->size = 0;
mtd->erasesize = 0;
mtd->oobblock = 512;
......
......@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2001.c,v 1.40 2003/05/20 21:03:07 dwmw2 Exp $
* $Id: doc2001.c,v 1.41 2003/06/11 09:45:19 dwmw2 Exp $
*/
#include <linux/kernel.h>
......@@ -359,9 +359,10 @@ static void DoCMil_init(struct mtd_info *mtd)
mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->ecctype = MTD_ECC_RS_DiskOnChip;
mtd->size = 0;
/* FIXME: erase size is not always 8kB */
/* FIXME: erase size is not always 8KiB */
mtd->erasesize = 0x2000;
mtd->oobblock = 512;
......
......@@ -6,7 +6,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2001plus.c,v 1.4 2003/05/23 11:28:46 dwmw2 Exp $
* $Id: doc2001plus.c,v 1.5 2003/06/11 09:45:19 dwmw2 Exp $
*/
#include <linux/kernel.h>
......@@ -458,6 +458,7 @@ static void DoCMilPlus_init(struct mtd_info *mtd)
mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH;
mtd->ecctype = MTD_ECC_RS_DiskOnChip;
mtd->size = 0;
mtd->erasesize = 0;
......
......@@ -8,7 +8,7 @@
* Author: Fabrice Bellard (fabrice.bellard@netgem.com)
* Copyright (C) 2000 Netgem S.A.
*
* $Id: inftlmount.c,v 1.9 2003/05/23 11:35:07 dwmw2 Exp $
* $Id: inftlmount.c,v 1.11 2003/06/23 07:39:21 dwmw2 Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -25,7 +25,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define __NO_VERSION__
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/errno.h>
......@@ -42,7 +41,7 @@
#include <linux/mtd/inftl.h>
#include <linux/mtd/compatmac.h>
char inftlmountrev[]="$Revision: 1.9 $";
char inftlmountrev[]="$Revision: 1.11 $";
/*
* find_boot_record: Find the INFTL Media Header and its Spare copy which
......@@ -242,7 +241,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
}
if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) {
printk(KERN_WARNING "INFTL: Media Header "
"Parition %d sanity check failed\n"
"Partition %d sanity check failed\n"
" firstUnit %d : lastUnit %d > "
"virtualUnits %d\n", i, ip->lastUnit,
ip->firstUnit, ip->Reserved0);
......@@ -250,7 +249,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
}
if (ip->Reserved1 != 0) {
printk(KERN_WARNING "INFTL: Media Header "
"Parition %d sanity check failed: "
"Partition %d sanity check failed: "
"Reserved1 %d != 0\n",
i, ip->Reserved1);
return -1;
......@@ -261,7 +260,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
}
if (i >= 4) {
printk(KERN_WARNING "INFTL: Media Header Parition "
printk(KERN_WARNING "INFTL: Media Header Partition "
"sanity check failed:\n No partition "
"marked as Disk Partition\n");
return -1;
......@@ -630,7 +629,7 @@ int INFTL_mount(struct INFTLrecord *s)
if (prev_block < s->nb_blocks)
prev_block += s->firstEUN;
/* Already explored paritial chain? */
/* Already explored partial chain? */
if (s->PUtable[block] != BLOCK_NOTEXPLORED) {
/* Check if chain for this logical */
if (logical_block == first_logical_block) {
......
# drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.11 2003/05/28 15:16:56 dwmw2 Exp $
# $Id: Kconfig,v 1.12 2003/06/23 07:38:11 dwmw2 Exp $
menu "Mapping drivers for chip access"
depends on MTD!=n
......@@ -476,7 +476,7 @@ config MTD_PCMCIA
config MTD_UCLINUX
tristate "Generic uClinux RAM/ROM filesystem support"
depends on MTD_PARTITIONS
depends on MTD_PARTITIONS && !MMU
help
Map driver to support image based filesystems for uClinux.
......
/*
* $Id: arctic-mtd.c,v 1.8 2003/05/21 12:45:17 dwmw2 Exp $
* $Id: arctic-mtd.c,v 1.10 2003/06/02 16:37:59 trini Exp $
*
* drivers/mtd/maps/arctic-mtd.c MTD mappings and partition tables for
* IBM 405LP Arctic boards.
......@@ -45,18 +45,23 @@
#include <asm/ibm4xx.h>
/*
* fe000000 -- ff9fffff Arctic FFS (26MB)
* ffa00000 -- fff5ffff kernel (5.504MB)
* fff60000 -- ffffffff firmware (640KB)
* 0 : 0xFE00 0000 - 0xFEFF FFFF : Filesystem 1 (16MiB)
* 1 : 0xFF00 0000 - 0xFF4F FFFF : kernel (5.12MiB)
* 2 : 0xFF50 0000 - 0xFFF5 FFFF : Filesystem 2 (10.624MiB) (if non-XIP)
* 3 : 0xFFF6 0000 - 0xFFFF FFFF : PIBS Firmware (640KiB)
*/
#define ARCTIC_FFS_SIZE 0x01a00000 /* 26 M */
#define ARCTIC_FIRMWARE_SIZE 0x000a0000 /* 640K */
#define FFS1_SIZE 0x01000000 /* 16MiB */
#define KERNEL_SIZE 0x00500000 /* 5.12MiB */
#define FFS2_SIZE 0x00a60000 /* 10.624MiB */
#define FIRMWARE_SIZE 0x000a0000 /* 640KiB */
#define NAME "Arctic Linux Flash"
#define PADDR SUBZERO_BOOTFLASH_PADDR
#define SIZE SUBZERO_BOOTFLASH_SIZE
#define BUSWIDTH 2
#define SIZE SUBZERO_BOOTFLASH_SIZE
#define PARTITIONS 4
/* Flash memories on these boards are memory resources, accessed big-endian. */
......@@ -73,17 +78,19 @@ static struct map_info arctic_mtd_map = {
static struct mtd_info *arctic_mtd;
static struct mtd_partition arctic_partitions[3] = {
{ .name = "Arctic FFS",
.size = ARCTIC_FFS_SIZE,
static struct mtd_partition arctic_partitions[PARTITIONS] = {
{ .name = "Filesystem",
.size = FFS1_SIZE,
.offset = 0,},
{ .name = "Kernel",
.size = SUBZERO_BOOTFLASH_SIZE - ARCTIC_FFS_SIZE -
ARCTIC_FIRMWARE_SIZE,
.offset = ARCTIC_FFS_SIZE,},
.size = KERNEL_SIZE,
.offset = FFS1_SIZE,},
{ .name = "Filesystem",
.size = FFS2_SIZE,
.offset = FFS1_SIZE + KERNEL_SIZE,},
{ .name = "Firmware",
.size = ARCTIC_FIRMWARE_SIZE,
.offset = SUBZERO_BOOTFLASH_SIZE - ARCTIC_FIRMWARE_SIZE,},
.size = FIRMWARE_SIZE,
.offset = SUBZERO_BOOTFLASH_SIZE - FIRMWARE_SIZE,},
};
static int __init
......@@ -107,7 +114,7 @@ init_arctic_mtd(void)
arctic_mtd->owner = THIS_MODULE;
return add_mtd_partitions(arctic_mtd, arctic_partitions, 3);
return add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS);
}
static void __exit
......
/*
* $Id: ebony.c,v 1.7 2003/05/21 12:45:18 dwmw2 Exp $
* $Id: ebony.c,v 1.8 2003/06/23 11:48:18 dwmw2 Exp $
*
* Mapping for Ebony user flash
*
......@@ -60,8 +60,6 @@ static struct mtd_partition ebony_large_partitions[] = {
}
};
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
int __init init_ebony(void)
{
u8 fpga0_reg;
......@@ -109,7 +107,7 @@ int __init init_ebony(void)
if (flash) {
flash->owner = THIS_MODULE;
add_mtd_partitions(flash, ebony_small_partitions,
NB_OF(ebony_small_partitions));
ARRAY_SIZE(ebony_small_partitions));
} else {
printk("map probe failed for flash\n");
return -ENXIO;
......@@ -131,7 +129,7 @@ int __init init_ebony(void)
if (flash) {
flash->owner = THIS_MODULE;
add_mtd_partitions(flash, ebony_large_partitions,
NB_OF(ebony_large_partitions));
ARRAY_SIZE(ebony_large_partitions));
} else {
printk("map probe failed for flash\n");
return -ENXIO;
......
/*
* $Id: edb7312.c,v 1.8 2003/05/21 12:45:18 dwmw2 Exp $
* $Id: edb7312.c,v 1.9 2003/06/23 11:48:18 dwmw2 Exp $
*
* Handle mapping of the NOR flash on Cogent EDB7312 boards
*
......@@ -67,7 +67,6 @@ static struct mtd_partition static_partitions[3] =
},
};
#define NB_OF(x) (sizeof (x) / sizeof (x[0]))
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
#endif
......@@ -109,7 +108,7 @@ int __init init_edb7312nor(void)
if (mtd_parts_nb == 0)
{
mtd_parts = static_partitions;
mtd_parts_nb = NB_OF(static_partitions);
mtd_parts_nb = ARRAY_SIZE(static_partitions);
part_type = "static";
}
#endif
......
......@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
$Id: elan-104nc.c,v 1.17 2003/05/21 15:15:07 dwmw2 Exp $
$Id: elan-104nc.c,v 1.18 2003/06/23 07:37:02 dwmw2 Exp $
The ELAN-104NC has up to 8 Mibyte of Intel StrataFlash (28F320/28F640) in x16
mode. This drivers uses the CFI probe and Intel Extended Command Set drivers.
......@@ -223,20 +223,13 @@ static void cleanup_elan_104nc(void)
}
iounmap((void *)iomapadr);
release_region(PAGE_IO,PAGE_IO_SIZE);
}
int __init init_elan_104nc(void)
{
/* Urg! We use I/O port 0x22 without request_region()ing it */
/*
if (check_region(PAGE_IO,PAGE_IO_SIZE) != 0) {
printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
elan_104nc_map.name,
PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1 );
return -EAGAIN;
}
*/
/* Urg! We use I/O port 0x22 without request_region()ing it,
because it's already allocated to the PIC. */
iomapadr = (unsigned long)ioremap(WINDOW_START, WINDOW_LENGTH);
if (!iomapadr) {
printk( KERN_ERR"%s: failed to ioremap memory region\n",
......@@ -244,10 +237,6 @@ int __init init_elan_104nc(void)
return -EIO;
}
/*
request_region( PAGE_IO, PAGE_IO_SIZE, "ELAN-104NC flash" );
*/
printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n",
elan_104nc_map.name,
PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1,
......
/*
* $Id: impa7.c,v 1.8 2003/05/21 12:45:18 dwmw2 Exp $
* $Id: impa7.c,v 1.9 2003/06/23 11:47:43 dwmw2 Exp $
*
* Handle mapping of the NOR flash on implementa A7 boards
*
......@@ -66,12 +66,11 @@ static struct mtd_partition static_partitions[] =
},
};
#define NB_OF(x) (sizeof (x) / sizeof (x[0]))
static int mtd_parts_nb[NUM_FLASHBANKS];
static struct mtd_partition *mtd_parts[NUM_FLASHBANKS];
#endif
static int mtd_parts_nb = 0;
static struct mtd_partition *mtd_parts = 0;
static const char *probes[] = { "cmdlinepart", NULL };
int __init init_impa7(void)
......@@ -84,7 +83,6 @@ int __init init_impa7(void)
{ WINDOW_ADDR0, WINDOW_SIZE0 },
{ WINDOW_ADDR1, WINDOW_SIZE1 },
};
char mtdid[10];
int devicesfound = 0;
for(i=0; i<NUM_FLASHBANKS; i++)
......@@ -107,38 +105,30 @@ int __init init_impa7(void)
impa7_mtd[i] = do_map_probe(*type, &impa7_map[i]);
}
if (impa7_mtd[i])
{
if (impa7_mtd[i]) {
impa7_mtd[i]->owner = THIS_MODULE;
add_mtd_device(impa7_mtd[i]);
devicesfound++;
#ifdef CONFIG_MTD_PARTITIONS
mtd_parts_nb = parse_mtd_partitions(impa7_mtd[i],
mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i],
probes,
&mtd_parts,
&mtd_parts[i],
0);
if (mtd_parts_nb > 0)
if (mtd_parts_nb[i] > 0) {
part_type = "command line";
#endif
if (mtd_parts_nb <= 0)
{
mtd_parts = static_partitions;
mtd_parts_nb = NB_OF(static_partitions);
} else {
mtd_parts[i] = static_partitions;
mtd_parts_nb[i] = ARRAY_SIZE(static_partitions);
part_type = "static";
}
if (mtd_parts_nb <= 0)
{
printk(KERN_NOTICE MSG_PREFIX
"no partition info available\n");
}
else
{
printk(KERN_NOTICE MSG_PREFIX
"using %s partition definition\n",
part_type);
add_mtd_partitions(impa7_mtd[i],
mtd_parts, mtd_parts_nb);
}
mtd_parts[i], mtd_parts_nb[i]);
#else
add_mtd_device(impa7_mtd[i]);
#endif
}
else
......@@ -150,15 +140,14 @@ int __init init_impa7(void)
static void __exit cleanup_impa7(void)
{
int i;
for (i=0; i<NUM_FLASHBANKS; i++)
{
if (impa7_mtd[i])
{
for (i=0; i<NUM_FLASHBANKS; i++) {
if (impa7_mtd[i]) {
#ifdef CONFIG_MTD_PARTITIONS
del_mtd_partitions(impa7_mtd[i]);
#else
del_mtd_device(impa7_mtd[i]);
#endif
map_destroy(impa7_mtd[i]);
}
if (impa7_map[i].virt)
{
iounmap((void *)impa7_map[i].virt);
impa7_map[i].virt = 0;
}
......
/*
* $Id: iq80310.c,v 1.16 2003/05/21 15:15:07 dwmw2 Exp $
* $Id: iq80310.c,v 1.17 2003/06/23 11:48:18 dwmw2 Exp $
*
* Mapping for the Intel XScale IQ80310 evaluation board
*
......@@ -57,8 +57,6 @@ static struct mtd_partition iq80310_partitions[4] = {
}
};
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_info *mymtd;
static struct mtd_partition *parsed_parts;
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
......@@ -94,7 +92,7 @@ static int __init init_iq80310(void)
nb_parts = parsed_nr_parts;
} else {
parts = iq80310_partitions;
nb_parts = NB_OF(iq80310_partitions);
nb_parts = ARRAY_SIZE(iq80310_partitions);
}
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
......
/*
* $Id: lubbock-flash.c,v 1.8 2003/05/21 12:45:19 dwmw2 Exp $
* $Id: lubbock-flash.c,v 1.9 2003/06/23 11:48:18 dwmw2 Exp $
*
* Map driver for the Lubbock developer platform.
*
......@@ -52,8 +52,6 @@ static struct mtd_partition lubbock_partitions[] = {
}
};
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_info *mymtds[2];
static struct mtd_partition *parsed_parts[2];
static int nr_parsed_parts[2];
......@@ -116,7 +114,7 @@ static int __init init_lubbock(void)
add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
} else if (!i) {
printk("Using static partitions on %s\n", lubbock_maps[i].name);
add_mtd_partitions(mymtds[i], lubbock_partitions, NB_OF(lubbock_partitions));
add_mtd_partitions(mymtds[i], lubbock_partitions, ARRAY_SIZE(lubbock_partitions));
} else {
printk("Registering %s as whole device\n", lubbock_maps[i].name);
add_mtd_device(mymtds[i]);
......
......@@ -3,7 +3,7 @@
*
* (C) 2001 Pete Popov <ppopov@mvista.com>
*
* $Id: pb1xxx-flash.c,v 1.8 2003/05/21 12:45:19 dwmw2 Exp $
* $Id: pb1xxx-flash.c,v 1.9 2003/06/23 11:48:18 dwmw2 Exp $
*/
#include <linux/config.h>
......@@ -131,9 +131,6 @@ static struct mtd_partition pb1xxx_partitions[] = {
#error Unsupported board
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
static struct mtd_partition *parsed_parts;
static struct mtd_info *mymtd;
......@@ -151,7 +148,7 @@ int __init pb1xxx_mtd_init(void)
*/
part_type = "static";
parts = pb1xxx_partitions;
nb_parts = NB_OF(pb1xxx_partitions);
nb_parts = ARRAY_SIZE(pb1xxx_partitions);
pb1xxx_map.size = flash_size;
/*
......
......@@ -2,7 +2,7 @@
* Handle mapping of the flash memory access routines
* on TQM8xxL based devices.
*
* $Id: tqm8xxl.c,v 1.8 2003/05/21 12:45:20 dwmw2 Exp $
* $Id: tqm8xxl.c,v 1.9 2003/06/23 11:48:18 dwmw2 Exp $
*
* based on rpxlite.c
*
......@@ -110,8 +110,6 @@ static struct mtd_partition tqm8xxl_fs_partitions[] = {
};
#endif
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
int __init init_tqm_mtd(void)
{
int idx = 0, ret = 0;
......@@ -198,11 +196,11 @@ int __init init_tqm_mtd(void)
*/
part_banks[0].mtd_part = tqm8xxl_partitions;
part_banks[0].type = "Static image";
part_banks[0].nums = NB_OF(tqm8xxl_partitions);
part_banks[0].nums = ARRAY_SIZE(tqm8xxl_partitions);
part_banks[1].mtd_part = tqm8xxl_fs_partitions;
part_banks[1].type = "Static file system";
part_banks[1].nums = NB_OF(tqm8xxl_fs_partitions);
part_banks[1].nums = ARRAY_SIZE(tqm8xxl_fs_partitions);
for(idx = 0; idx < num_banks ; idx++) {
if (part_banks[idx].nums == 0) {
......
......@@ -5,7 +5,7 @@
*
* This code is GPL
*
* $Id: mtdpart.c,v 1.39 2003/05/21 15:15:03 dwmw2 Exp $
* $Id: mtdpart.c,v 1.41 2003/06/18 14:53:02 dwmw2 Exp $
*
* 02-21-2002 Thomas Gleixner <gleixner@autronix.de>
* added support for read_oob, write_oob
......@@ -120,7 +120,7 @@ static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t le
size_t *retlen, u_char *buf)
{
struct mtd_part *part = PART(mtd);
return part->master->read_user_prot_reg (part->master, from,
return part->master->read_fact_prot_reg (part->master, from,
len, retlen, buf);
}
......
......@@ -6,7 +6,7 @@
* Derived from drivers/mtd/spia.c
* Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
*
* $Id: autcpu12.c,v 1.10 2003/04/20 07:24:40 gleixner Exp $
* $Id: autcpu12.c,v 1.11 2003/06/04 17:04:09 gleixner Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -28,6 +28,7 @@
*/
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
......
......@@ -126,7 +126,13 @@
* supplied by ioctl (MEMSETOOBSEL) are used.
* For partitions the partition defaults are used (mtdpart.c)
*
* $Id: nand.c,v 1.45 2003/05/20 21:01:30 dwmw2 Exp $
* 06-04-2003 tglx: fix compile errors and fix write verify problem for
* some chips, which need either a delay between the readback
* and the next write command or have the CE removed. The
* CE disable/enable is much faster than a 20us delay and
* it should work on all available chips.
*
* $Id: nand.c,v 1.46 2003/06/04 17:10:36 gleixner Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -141,6 +147,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/compatmac.h>
#include <linux/interrupt.h>
#include <asm/io.h>
......@@ -510,6 +517,13 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
}
}
}
/*
* Terminate the read command. This is faster than sending a reset command or
* applying a 20us delay before issuing the next programm sequence.
* This is not a problem for all chips, but I have found a bunch of them.
*/
nand_deselect();
nand_select();
#endif
return 0;
}
......
......@@ -2,7 +2,7 @@
/* Linux driver for Disk-On-Chip 2000 */
/* (c) 1999 Machine Vision Holdings, Inc. */
/* Author: David Woodhouse <dwmw2@mvhi.com> */
/* $Id: doc2000.h,v 1.16 2003/05/23 11:29:33 dwmw2 Exp $ */
/* $Id: doc2000.h,v 1.17 2003/06/12 01:20:46 gerg Exp $ */
#ifndef __MTD_DOC2000_H__
#define __MTD_DOC2000_H__
......@@ -44,7 +44,7 @@
#define DoC_Mplus_AccessStatus 0x1008
#define DoC_Mplus_DeviceSelect 0x1008
#define DoC_Mplus_Configuration 0x100a
#define DoC_Mplus_OutputControl 0x1002
#define DoC_Mplus_OutputControl 0x100c
#define DoC_Mplus_FlashControl 0x1020
#define DoC_Mplus_FlashSelect 0x1022
#define DoC_Mplus_FlashCmd 0x1024
......
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