You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (82 commits) [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash [MTD] m25p80: add FAST_READ access support to M25Pxx [MTD] [NAND] bf5xx_nand: Avoid crash if bfin_mac is installed. [MTD] [NAND] at91_nand: control NCE signal [MTD] [NAND] AT91 hardware ECC compile fix for at91sam9263 / at91sam9260 [MTD] [NAND] Hardware ECC controller on at91sam9263 / at91sam9260 [JFFS2] Introduce dbg_readinode2 log level, use it to shut read_dnode() up [JFFS2] Fix jffs2_reserve_space() when all blocks are pending erasure. [JFFS2] Add erase_checking_list to hold blocks being marked. UBI: add a message [JFFS2] Return values of jffs2_block_check_erase error paths [MTD] Clean up AR7 partition map support [MTD] [NOR] Fix Intel CFI driver for collie flash [JFFS2] Finally remove redundant ref->__totlen field. [JFFS2] Honour TEST_TOTLEN macro in debugging code. ref->__totlen is going! [JFFS2] Add paranoia debugging for superblock counts [JFFS2] Fix free space leak with in-band cleanmarkers [JFFS2] Self-sufficient #includes in jffs2_fs_i.h: include <linux/mutex.h> [MTD] [NAND] Verify probe by retrying to checking the results match [MTD] [NAND] S3C2410 Allow ECC disable to be specified by the board ...
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
What: /sys/class/ubi/
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
The ubi/ class sub-directory belongs to the UBI subsystem and
|
||||
provides general UBI information, per-UBI device information
|
||||
and per-UBI volume information.
|
||||
|
||||
What: /sys/class/ubi/version
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
This file contains version of the latest supported UBI on-media
|
||||
format. Currently it is 1, and there is no plan to change this.
|
||||
However, if in the future UBI needs on-flash format changes
|
||||
which cannot be done in a compatible manner, a new format
|
||||
version will be added. So this is a mechanism for possible
|
||||
future backward-compatible (but forward-incompatible)
|
||||
improvements.
|
||||
|
||||
What: /sys/class/ubiX/
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
The /sys/class/ubi0, /sys/class/ubi1, etc directories describe
|
||||
UBI devices (UBI device 0, 1, etc). They contain general UBI
|
||||
device information and per UBI volume information (each UBI
|
||||
device may have many UBI volumes)
|
||||
|
||||
What: /sys/class/ubi/ubiX/avail_eraseblocks
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Amount of available logical eraseblock. For example, one may
|
||||
create a new UBI volume which has this amount of logical
|
||||
eraseblocks.
|
||||
|
||||
What: /sys/class/ubi/ubiX/bad_peb_count
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Count of bad physical eraseblocks on the underlying MTD device.
|
||||
|
||||
What: /sys/class/ubi/ubiX/bgt_enabled
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Contains ASCII "0\n" if the UBI background thread is disabled,
|
||||
and ASCII "1\n" if it is enabled.
|
||||
|
||||
What: /sys/class/ubi/ubiX/dev
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Major and minor numbers of the character device corresponding
|
||||
to this UBI device (in <major>:<minor> format).
|
||||
|
||||
What: /sys/class/ubi/ubiX/eraseblock_size
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Maximum logical eraseblock size this UBI device may provide. UBI
|
||||
volumes may have smaller logical eraseblock size because of their
|
||||
alignment.
|
||||
|
||||
What: /sys/class/ubi/ubiX/max_ec
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Maximum physical eraseblock erase counter value.
|
||||
|
||||
What: /sys/class/ubi/ubiX/max_vol_count
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Maximum number of volumes which this UBI device may have.
|
||||
|
||||
What: /sys/class/ubi/ubiX/min_io_size
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Minimum input/output unit size. All the I/O may only be done
|
||||
in fractions of the contained number.
|
||||
|
||||
What: /sys/class/ubi/ubiX/mtd_num
|
||||
Date: January 2008
|
||||
KernelVersion: 2.6.25
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Number of the underlying MTD device.
|
||||
|
||||
What: /sys/class/ubi/ubiX/reserved_for_bad
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Number of physical eraseblocks reserved for bad block handling.
|
||||
|
||||
What: /sys/class/ubi/ubiX/total_eraseblocks
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Total number of good (not marked as bad) physical eraseblocks on
|
||||
the underlying MTD device.
|
||||
|
||||
What: /sys/class/ubi/ubiX/volumes_count
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Count of volumes on this UBI device.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
The /sys/class/ubi/ubiX/ubiX_0/, /sys/class/ubi/ubiX/ubiX_1/,
|
||||
etc directories describe UBI volumes on UBI device X (volumes
|
||||
0, 1, etc).
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/alignment
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Volume alignment - the value the logical eraseblock size of
|
||||
this volume has to be aligned on. For example, 2048 means that
|
||||
logical eraseblock size is multiple of 2048. In other words,
|
||||
volume logical eraseblock size is UBI device logical eraseblock
|
||||
size aligned to the alignment value.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/corrupted
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Contains ASCII "0\n" if the UBI volume is OK, and ASCII "1\n"
|
||||
if it is corrupted (e.g., due to an interrupted volume update).
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/data_bytes
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
The amount of data this volume contains. This value makes sense
|
||||
only for static volumes, and for dynamic volume it equivalent
|
||||
to the total volume size in bytes.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/dev
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Major and minor numbers of the character device corresponding
|
||||
to this UBI volume (in <major>:<minor> format).
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/name
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Volume name.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/reserved_ebs
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Count of physical eraseblock reserved for this volume.
|
||||
Equivalent to the volume size in logical eraseblocks.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/type
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Volume type. Contains ASCII "dynamic\n" for dynamic volumes and
|
||||
"static\n" for static volumes.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/upd_marker
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Contains ASCII "0\n" if the update marker is not set for this
|
||||
volume, and "1\n" if it is set. The update marker is set when
|
||||
volume update starts, and cleaned when it ends. So the presence
|
||||
of the update marker indicates that the volume is being updated
|
||||
at the moment of the update was interrupted. The later may be
|
||||
checked using the "corrupted" sysfs file.
|
||||
|
||||
What: /sys/class/ubi/ubiX/ubiX_Y/usable_eb_size
|
||||
Date: July 2006
|
||||
KernelVersion: 2.6.22
|
||||
Contact: Artem Bityutskiy <dedekind@infradead.org>
|
||||
Description:
|
||||
Logical eraseblock size of this volume. Equivalent to logical
|
||||
eraseblock size of the device aligned on the volume alignment
|
||||
value.
|
||||
@@ -0,0 +1,30 @@
|
||||
S3C24XX NAND Support
|
||||
====================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Small Page NAND
|
||||
---------------
|
||||
|
||||
The driver uses a 512 byte (1 page) ECC code for this setup. The
|
||||
ECC code is not directly compatible with the default kernel ECC
|
||||
code, so the driver enforces its own OOB layout and ECC parameters
|
||||
|
||||
Large Page NAND
|
||||
---------------
|
||||
|
||||
The driver is capable of handling NAND flash with a 2KiB page
|
||||
size, with support for hardware ECC generation and correction.
|
||||
|
||||
Unlike the 512byte page mode, the driver generates ECC data for
|
||||
each 256 byte block in an 2KiB page. This means that more than
|
||||
one error in a page can be rectified. It also means that the
|
||||
OOB layout remains the default kernel layout for these flashes.
|
||||
|
||||
|
||||
Document Author
|
||||
---------------
|
||||
|
||||
Ben Dooks, Copyright 2007 Simtec Electronics
|
||||
|
||||
@@ -156,6 +156,8 @@ NAND
|
||||
controller. If there are any problems the latest linux-mtd
|
||||
code can be found from http://www.linux-mtd.infradead.org/
|
||||
|
||||
For more information see Documentation/arm/Samsung-S3C24XX/NAND.txt
|
||||
|
||||
|
||||
Serial
|
||||
------
|
||||
|
||||
@@ -158,6 +158,12 @@ config MTD_OF_PARTS
|
||||
the partition map from the children of the flash node,
|
||||
as described in Documentation/powerpc/booting-without-of.txt.
|
||||
|
||||
config MTD_AR7_PARTS
|
||||
tristate "TI AR7 partitioning support"
|
||||
depends on MTD_PARTITIONS
|
||||
---help---
|
||||
TI AR7 partitioning support
|
||||
|
||||
comment "User Modules And Translation Layers"
|
||||
|
||||
config MTD_CHAR
|
||||
|
||||
@@ -11,6 +11,7 @@ obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
|
||||
obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
|
||||
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
|
||||
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
|
||||
obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
|
||||
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
|
||||
|
||||
# 'Users' - code which presents functionality to userspace.
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright © 2007 Eugene Konev <ejka@openwrt.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* TI AR7 flash partition table.
|
||||
* Based on ar7 map by Felix Fietkau <nbd@openwrt.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/magic.h>
|
||||
|
||||
#define AR7_PARTS 4
|
||||
#define ROOT_OFFSET 0xe0000
|
||||
|
||||
#define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42)
|
||||
#define LOADER_MAGIC2 le32_to_cpu(0xfeed1281)
|
||||
|
||||
#ifndef SQUASHFS_MAGIC
|
||||
#define SQUASHFS_MAGIC 0x73717368
|
||||
#endif
|
||||
|
||||
struct ar7_bin_rec {
|
||||
unsigned int checksum;
|
||||
unsigned int length;
|
||||
unsigned int address;
|
||||
};
|
||||
|
||||
static struct mtd_partition ar7_parts[AR7_PARTS];
|
||||
|
||||
static int create_mtd_partitions(struct mtd_info *master,
|
||||
struct mtd_partition **pparts,
|
||||
unsigned long origin)
|
||||
{
|
||||
struct ar7_bin_rec header;
|
||||
unsigned int offset;
|
||||
size_t len;
|
||||
unsigned int pre_size = master->erasesize, post_size = 0;
|
||||
unsigned int root_offset = ROOT_OFFSET;
|
||||
|
||||
int retries = 10;
|
||||
|
||||
ar7_parts[0].name = "loader";
|
||||
ar7_parts[0].offset = 0;
|
||||
ar7_parts[0].size = master->erasesize;
|
||||
ar7_parts[0].mask_flags = MTD_WRITEABLE;
|
||||
|
||||
ar7_parts[1].name = "config";
|
||||
ar7_parts[1].offset = 0;
|
||||
ar7_parts[1].size = master->erasesize;
|
||||
ar7_parts[1].mask_flags = 0;
|
||||
|
||||
do { /* Try 10 blocks starting from master->erasesize */
|
||||
offset = pre_size;
|
||||
master->read(master, offset,
|
||||
sizeof(header), &len, (uint8_t *)&header);
|
||||
if (!strncmp((char *)&header, "TIENV0.8", 8))
|
||||
ar7_parts[1].offset = pre_size;
|
||||
if (header.checksum == LOADER_MAGIC1)
|
||||
break;
|
||||
if (header.checksum == LOADER_MAGIC2)
|
||||
break;
|
||||
pre_size += master->erasesize;
|
||||
} while (retries--);
|
||||
|
||||
pre_size = offset;
|
||||
|
||||
if (!ar7_parts[1].offset) {
|
||||
ar7_parts[1].offset = master->size - master->erasesize;
|
||||
post_size = master->erasesize;
|
||||
}
|
||||
|
||||
switch (header.checksum) {
|
||||
case LOADER_MAGIC1:
|
||||
while (header.length) {
|
||||
offset += sizeof(header) + header.length;
|
||||
master->read(master, offset, sizeof(header),
|
||||
&len, (uint8_t *)&header);
|
||||
}
|
||||
root_offset = offset + sizeof(header) + 4;
|
||||
break;
|
||||
case LOADER_MAGIC2:
|
||||
while (header.length) {
|
||||
offset += sizeof(header) + header.length;
|
||||
master->read(master, offset, sizeof(header),
|
||||
&len, (uint8_t *)&header);
|
||||
}
|
||||
root_offset = offset + sizeof(header) + 4 + 0xff;
|
||||
root_offset &= ~(uint32_t)0xff;
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum);
|
||||
break;
|
||||
}
|
||||
|
||||
master->read(master, root_offset,
|
||||
sizeof(header), &len, (u8 *)&header);
|
||||
if (header.checksum != SQUASHFS_MAGIC) {
|
||||
root_offset += master->erasesize - 1;
|
||||
root_offset &= ~(master->erasesize - 1);
|
||||
}
|
||||
|
||||
ar7_parts[2].name = "linux";
|
||||
ar7_parts[2].offset = pre_size;
|
||||
ar7_parts[2].size = master->size - pre_size - post_size;
|
||||
ar7_parts[2].mask_flags = 0;
|
||||
|
||||
ar7_parts[3].name = "rootfs";
|
||||
ar7_parts[3].offset = root_offset;
|
||||
ar7_parts[3].size = master->size - root_offset - post_size;
|
||||
ar7_parts[3].mask_flags = 0;
|
||||
|
||||
*pparts = ar7_parts;
|
||||
return AR7_PARTS;
|
||||
}
|
||||
|
||||
static struct mtd_part_parser ar7_parser = {
|
||||
.owner = THIS_MODULE,
|
||||
.parse_fn = create_mtd_partitions,
|
||||
.name = "ar7part",
|
||||
};
|
||||
|
||||
static int __init ar7_parser_init(void)
|
||||
{
|
||||
return register_mtd_parser(&ar7_parser);
|
||||
}
|
||||
|
||||
module_init(ar7_parser_init);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR( "Felix Fietkau <nbd@openwrt.org>, "
|
||||
"Eugene Konev <ejka@openwrt.org>");
|
||||
MODULE_DESCRIPTION("MTD partitioning for TI AR7");
|
||||
@@ -384,7 +384,7 @@ read_pri_intelext(struct map_info *map, __u16 adr)
|
||||
if (extp_size > 4096) {
|
||||
printk(KERN_ERR
|
||||
"%s: cfi_pri_intelext is too fat\n",
|
||||
__FUNCTION__);
|
||||
__func__);
|
||||
return NULL;
|
||||
}
|
||||
goto again;
|
||||
@@ -619,6 +619,9 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
|
||||
sizeof(struct cfi_intelext_blockinfo);
|
||||
}
|
||||
|
||||
if (!numparts)
|
||||
numparts = 1;
|
||||
|
||||
/* Programming Region info */
|
||||
if (extp->MinorVersion >= '4') {
|
||||
struct cfi_intelext_programming_regioninfo *prinfo;
|
||||
@@ -641,7 +644,7 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
|
||||
if ((1 << partshift) < mtd->erasesize) {
|
||||
printk( KERN_ERR
|
||||
"%s: bad number of hw partitions (%d)\n",
|
||||
__FUNCTION__, numparts);
|
||||
__func__, numparts);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1071,10 +1074,10 @@ static int __xipram xip_wait_for_operation(
|
||||
chip->state = newstate;
|
||||
map_write(map, CMD(0xff), adr);
|
||||
(void) map_read(map, adr);
|
||||
asm volatile (".rep 8; nop; .endr");
|
||||
xip_iprefetch();
|
||||
local_irq_enable();
|
||||
spin_unlock(chip->mutex);
|
||||
asm volatile (".rep 8; nop; .endr");
|
||||
xip_iprefetch();
|
||||
cond_resched();
|
||||
|
||||
/*
|
||||
@@ -2013,7 +2016,7 @@ static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
|
||||
|
||||
#ifdef DEBUG_LOCK_BITS
|
||||
printk(KERN_DEBUG "%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
|
||||
__FUNCTION__, ofs, len);
|
||||
__func__, ofs, len);
|
||||
cfi_varsize_frob(mtd, do_printlockstatus_oneblock,
|
||||
ofs, len, NULL);
|
||||
#endif
|
||||
@@ -2023,7 +2026,7 @@ static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
|
||||
|
||||
#ifdef DEBUG_LOCK_BITS
|
||||
printk(KERN_DEBUG "%s: lock status after, ret=%d\n",
|
||||
__FUNCTION__, ret);
|
||||
__func__, ret);
|
||||
cfi_varsize_frob(mtd, do_printlockstatus_oneblock,
|
||||
ofs, len, NULL);
|
||||
#endif
|
||||
@@ -2037,7 +2040,7 @@ static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
|
||||
|
||||
#ifdef DEBUG_LOCK_BITS
|
||||
printk(KERN_DEBUG "%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
|
||||
__FUNCTION__, ofs, len);
|
||||
__func__, ofs, len);
|
||||
cfi_varsize_frob(mtd, do_printlockstatus_oneblock,
|
||||
ofs, len, NULL);
|
||||
#endif
|
||||
@@ -2047,7 +2050,7 @@ static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
|
||||
|
||||
#ifdef DEBUG_LOCK_BITS
|
||||
printk(KERN_DEBUG "%s: lock status after, ret=%d\n",
|
||||
__FUNCTION__, ret);
|
||||
__func__, ret);
|
||||
cfi_varsize_frob(mtd, do_printlockstatus_oneblock,
|
||||
ofs, len, NULL);
|
||||
#endif
|
||||
|
||||
@@ -220,6 +220,28 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
|
||||
mtd->flags |= MTD_POWERUP_LOCK;
|
||||
}
|
||||
|
||||
static void fixup_s29gl064n_sectors(struct mtd_info *mtd, void *param)
|
||||
{
|
||||
struct map_info *map = mtd->priv;
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
|
||||
if ((cfi->cfiq->EraseRegionInfo[0] & 0xffff) == 0x003f) {
|
||||
cfi->cfiq->EraseRegionInfo[0] |= 0x0040;
|
||||
pr_warning("%s: Bad S29GL064N CFI data, adjust from 64 to 128 sectors\n", mtd->name);
|
||||
}
|
||||
}
|
||||
|
||||
static void fixup_s29gl032n_sectors(struct mtd_info *mtd, void *param)
|
||||
{
|
||||
struct map_info *map = mtd->priv;
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
|
||||
if ((cfi->cfiq->EraseRegionInfo[1] & 0xffff) == 0x007e) {
|
||||
cfi->cfiq->EraseRegionInfo[1] &= ~0x0040;
|
||||
pr_warning("%s: Bad S29GL032N CFI data, adjust from 127 to 63 sectors\n", mtd->name);
|
||||
}
|
||||
}
|
||||
|
||||
static struct cfi_fixup cfi_fixup_table[] = {
|
||||
{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
|
||||
#ifdef AMD_BOOTLOC_BUG
|
||||
@@ -231,6 +253,10 @@ static struct cfi_fixup cfi_fixup_table[] = {
|
||||
{ CFI_MFR_AMD, 0x0056, fixup_use_secsi, NULL, },
|
||||
{ CFI_MFR_AMD, 0x005C, fixup_use_secsi, NULL, },
|
||||
{ CFI_MFR_AMD, 0x005F, fixup_use_secsi, NULL, },
|
||||
{ CFI_MFR_AMD, 0x0c01, fixup_s29gl064n_sectors, NULL, },
|
||||
{ CFI_MFR_AMD, 0x1301, fixup_s29gl064n_sectors, NULL, },
|
||||
{ CFI_MFR_AMD, 0x1a00, fixup_s29gl032n_sectors, NULL, },
|
||||
{ CFI_MFR_AMD, 0x1a01, fixup_s29gl032n_sectors, NULL, },
|
||||
#if !FORCE_WORD_WRITE
|
||||
{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
|
||||
#endif
|
||||
@@ -723,10 +749,10 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
|
||||
chip->erase_suspended = 1;
|
||||
map_write(map, CMD(0xf0), adr);
|
||||
(void) map_read(map, adr);
|
||||
asm volatile (".rep 8; nop; .endr");
|
||||
xip_iprefetch();
|
||||
local_irq_enable();
|
||||
spin_unlock(chip->mutex);
|
||||
asm volatile (".rep 8; nop; .endr");
|
||||
xip_iprefetch();
|
||||
cond_resched();
|
||||
|
||||
/*
|
||||
|
||||
@@ -445,7 +445,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
retry:
|
||||
|
||||
#ifdef DEBUG_CFI_FEATURES
|
||||
printk("%s: chip->state[%d]\n", __FUNCTION__, chip->state);
|
||||
printk("%s: chip->state[%d]\n", __func__, chip->state);
|
||||
#endif
|
||||
spin_lock_bh(chip->mutex);
|
||||
|
||||
@@ -463,7 +463,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
map_write(map, CMD(0x70), cmd_adr);
|
||||
chip->state = FL_STATUS;
|
||||
#ifdef DEBUG_CFI_FEATURES
|
||||
printk("%s: 1 status[%x]\n", __FUNCTION__, map_read(map, cmd_adr));
|
||||
printk("%s: 1 status[%x]\n", __func__, map_read(map, cmd_adr));
|
||||
#endif
|
||||
|
||||
case FL_STATUS:
|
||||
@@ -591,7 +591,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
/* check for errors: 'lock bit', 'VPP', 'dead cell'/'unerased cell' or 'incorrect cmd' -- saw */
|
||||
if (map_word_bitsset(map, status, CMD(0x3a))) {
|
||||
#ifdef DEBUG_CFI_FEATURES
|
||||
printk("%s: 2 status[%lx]\n", __FUNCTION__, status.x[0]);
|
||||
printk("%s: 2 status[%lx]\n", __func__, status.x[0]);
|
||||
#endif
|
||||
/* clear status */
|
||||
map_write(map, CMD(0x50), cmd_adr);
|
||||
@@ -625,9 +625,9 @@ static int cfi_staa_write_buffers (struct mtd_info *mtd, loff_t to,
|
||||
ofs = to - (chipnum << cfi->chipshift);
|
||||
|
||||
#ifdef DEBUG_CFI_FEATURES
|
||||
printk("%s: map_bankwidth(map)[%x]\n", __FUNCTION__, map_bankwidth(map));
|
||||
printk("%s: chipnum[%x] wbufsize[%x]\n", __FUNCTION__, chipnum, wbufsize);
|
||||
printk("%s: ofs[%x] len[%x]\n", __FUNCTION__, ofs, len);
|
||||
printk("%s: map_bankwidth(map)[%x]\n", __func__, map_bankwidth(map));
|
||||
printk("%s: chipnum[%x] wbufsize[%x]\n", __func__, chipnum, wbufsize);
|
||||
printk("%s: ofs[%x] len[%x]\n", __func__, ofs, len);
|
||||
#endif
|
||||
|
||||
/* Write buffer is worth it only if more than one word to write... */
|
||||
@@ -893,7 +893,8 @@ retry:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cfi_staa_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
|
||||
static int cfi_staa_erase_varsize(struct mtd_info *mtd,
|
||||
struct erase_info *instr)
|
||||
{ struct map_info *map = mtd->priv;
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
unsigned long adr, len;
|
||||
|
||||
@@ -39,7 +39,7 @@ struct mtd_info *cfi_probe(struct map_info *map);
|
||||
#define xip_allowed(base, map) \
|
||||
do { \
|
||||
(void) map_read(map, base); \
|
||||
asm volatile (".rep 8; nop; .endr"); \
|
||||
xip_iprefetch(); \
|
||||
local_irq_enable(); \
|
||||
} while (0)
|
||||
|
||||
@@ -232,6 +232,11 @@ static int __xipram cfi_chip_setup(struct map_info *map,
|
||||
cfi->mfr = cfi_read_query16(map, base);
|
||||
cfi->id = cfi_read_query16(map, base + ofs_factor);
|
||||
|
||||
/* Get AMD/Spansion extended JEDEC ID */
|
||||
if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
|
||||
cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
|
||||
cfi_read_query(map, base + 0xf * ofs_factor);
|
||||
|
||||
/* Put it back into Read Mode */
|
||||
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
|
||||
/* ... even if it's an Intel chip */
|
||||
|
||||
@@ -65,7 +65,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
|
||||
|
||||
#ifdef CONFIG_MTD_XIP
|
||||
(void) map_read(map, base);
|
||||
asm volatile (".rep 8; nop; .endr");
|
||||
xip_iprefetch();
|
||||
local_irq_enable();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -132,6 +132,8 @@
|
||||
#define M29F800AB 0x0058
|
||||
#define M29W800DT 0x00D7
|
||||
#define M29W800DB 0x005B
|
||||
#define M29W400DT 0x00EE
|
||||
#define M29W400DB 0x00EF
|
||||
#define M29W160DT 0x22C4
|
||||
#define M29W160DB 0x2249
|
||||
#define M29W040B 0x00E3
|
||||
@@ -160,6 +162,7 @@
|
||||
#define SST49LF030A 0x001C
|
||||
#define SST49LF040A 0x0051
|
||||
#define SST49LF080A 0x005B
|
||||
#define SST36VF3203 0x7354
|
||||
|
||||
/* Toshiba */
|
||||
#define TC58FVT160 0x00C2
|
||||
@@ -1113,7 +1116,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,8),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_MACRONIX,
|
||||
.dev_id = MX29F016,
|
||||
.name = "Macronix MX29F016",
|
||||
@@ -1125,7 +1128,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,32),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_MACRONIX,
|
||||
.dev_id = MX29F004T,
|
||||
.name = "Macronix MX29F004T",
|
||||
@@ -1140,7 +1143,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
ERASEINFO(0x02000,2),
|
||||
ERASEINFO(0x04000,1),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_MACRONIX,
|
||||
.dev_id = MX29F004B,
|
||||
.name = "Macronix MX29F004B",
|
||||
@@ -1218,7 +1221,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x40000,16),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST39LF512,
|
||||
.name = "SST 39LF512",
|
||||
@@ -1230,7 +1233,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x01000,16),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST39LF010,
|
||||
.name = "SST 39LF010",
|
||||
@@ -1242,7 +1245,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x01000,32),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST29EE020,
|
||||
.name = "SST 29EE020",
|
||||
@@ -1276,7 +1279,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x01000,64),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST39LF040,
|
||||
.name = "SST 39LF040",
|
||||
@@ -1288,7 +1291,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x01000,128),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST39SF010A,
|
||||
.name = "SST 39SF010A",
|
||||
@@ -1300,7 +1303,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x01000,32),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST39SF020A,
|
||||
.name = "SST 39SF020A",
|
||||
@@ -1411,6 +1414,18 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
ERASEINFO(0x1000,256),
|
||||
ERASEINFO(0x1000,256)
|
||||
}
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_SST,
|
||||
.dev_id = SST36VF3203,
|
||||
.name = "SST 36VF3203",
|
||||
.devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
|
||||
.uaddr = MTD_UADDR_0x0AAA_0x0555,
|
||||
.dev_size = SIZE_4MiB,
|
||||
.cmd_set = P_ID_AMD_STD,
|
||||
.nr_regions = 1,
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,64),
|
||||
}
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M29F800AB,
|
||||
@@ -1426,7 +1441,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
ERASEINFO(0x08000,1),
|
||||
ERASEINFO(0x10000,15),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
|
||||
.dev_id = M29W800DT,
|
||||
.name = "ST M29W800DT",
|
||||
@@ -1456,6 +1471,36 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
ERASEINFO(0x08000,1),
|
||||
ERASEINFO(0x10000,15)
|
||||
}
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M29W400DT,
|
||||
.name = "ST M29W400DT",
|
||||
.devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
|
||||
.uaddr = MTD_UADDR_0x0AAA_0x0555,
|
||||
.dev_size = SIZE_512KiB,
|
||||
.cmd_set = P_ID_AMD_STD,
|
||||
.nr_regions = 4,
|
||||
.regions = {
|
||||
ERASEINFO(0x04000,7),
|
||||
ERASEINFO(0x02000,1),
|
||||
ERASEINFO(0x08000,2),
|
||||
ERASEINFO(0x10000,1)
|
||||
}
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M29W400DB,
|
||||
.name = "ST M29W400DB",
|
||||
.devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8,
|
||||
.uaddr = MTD_UADDR_0x0AAA_0x0555,
|
||||
.dev_size = SIZE_512KiB,
|
||||
.cmd_set = P_ID_AMD_STD,
|
||||
.nr_regions = 4,
|
||||
.regions = {
|
||||
ERASEINFO(0x04000,1),
|
||||
ERASEINFO(0x02000,2),
|
||||
ERASEINFO(0x08000,1),
|
||||
ERASEINFO(0x10000,7)
|
||||
}
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST, /* FIXME - CFI device? */
|
||||
.dev_id = M29W160DT,
|
||||
@@ -1486,7 +1531,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
ERASEINFO(0x08000,1),
|
||||
ERASEINFO(0x10000,31)
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M29W040B,
|
||||
.name = "ST M29W040B",
|
||||
@@ -1498,7 +1543,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,8),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M50FW040,
|
||||
.name = "ST M50FW040",
|
||||
@@ -1510,7 +1555,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,8),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M50FW080,
|
||||
.name = "ST M50FW080",
|
||||
@@ -1522,7 +1567,7 @@ static const struct amd_flash_info jedec_table[] = {
|
||||
.regions = {
|
||||
ERASEINFO(0x10000,16),
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
.mfr_id = MANUFACTURER_ST,
|
||||
.dev_id = M50FW016,
|
||||
.name = "ST M50FW016",
|
||||
|
||||
@@ -119,7 +119,8 @@ static struct mtd_partition * newpart(char *s,
|
||||
char *p;
|
||||
|
||||
name = ++s;
|
||||
if ((p = strchr(name, delim)) == 0)
|
||||
p = strchr(name, delim);
|
||||
if (!p)
|
||||
{
|
||||
printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim);
|
||||
return NULL;
|
||||
@@ -159,9 +160,10 @@ static struct mtd_partition * newpart(char *s,
|
||||
return NULL;
|
||||
}
|
||||
/* more partitions follow, parse them */
|
||||
if ((parts = newpart(s + 1, &s, num_parts,
|
||||
this_part + 1, &extra_mem, extra_mem_size)) == 0)
|
||||
return NULL;
|
||||
parts = newpart(s + 1, &s, num_parts, this_part + 1,
|
||||
&extra_mem, extra_mem_size);
|
||||
if (!parts)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{ /* this is the last partition: allocate space for all */
|
||||
@@ -308,9 +310,6 @@ static int parse_cmdline_partitions(struct mtd_info *master,
|
||||
struct cmdline_mtd_partition *part;
|
||||
char *mtd_id = master->name;
|
||||
|
||||
if(!cmdline)
|
||||
return -EINVAL;
|
||||
|
||||
/* parse command line */
|
||||
if (!cmdline_parsed)
|
||||
mtdpart_setup_real(cmdline);
|
||||
@@ -341,7 +340,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,
|
||||
return part->num_parts;
|
||||
}
|
||||
}
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,13 @@ config MTD_M25P80
|
||||
if you want to specify device partitioning or to use a device which
|
||||
doesn't support the JEDEC ID instruction.
|
||||
|
||||
config M25PXX_USE_FAST_READ
|
||||
bool "Use FAST_READ OPCode allowing SPI CLK <= 50MHz"
|
||||
depends on MTD_M25P80
|
||||
default y
|
||||
help
|
||||
This option enables FAST_READ access supported by ST M25Pxx.
|
||||
|
||||
config MTD_SLRAM
|
||||
tristate "Uncached system RAM"
|
||||
help
|
||||
|
||||
@@ -305,7 +305,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
|
||||
}
|
||||
list_add(&dev->list, &blkmtd_device_list);
|
||||
INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index,
|
||||
dev->mtd.name + strlen("blkmtd: "),
|
||||
dev->mtd.name + strlen("block2mtd: "),
|
||||
dev->mtd.erasesize >> 10, dev->mtd.erasesize);
|
||||
return dev;
|
||||
|
||||
@@ -366,9 +366,9 @@ static inline void kill_final_newline(char *str)
|
||||
}
|
||||
|
||||
|
||||
#define parse_err(fmt, args...) do { \
|
||||
ERROR("block2mtd: " fmt "\n", ## args); \
|
||||
return 0; \
|
||||
#define parse_err(fmt, args...) do { \
|
||||
ERROR(fmt, ## args); \
|
||||
return 0; \
|
||||
} while (0)
|
||||
|
||||
#ifndef MODULE
|
||||
@@ -473,7 +473,7 @@ static void __devexit block2mtd_exit(void)
|
||||
block2mtd_sync(&dev->mtd);
|
||||
del_mtd_device(&dev->mtd);
|
||||
INFO("mtd%d: [%s] removed", dev->mtd.index,
|
||||
dev->mtd.name + strlen("blkmtd: "));
|
||||
dev->mtd.name + strlen("block2mtd: "));
|
||||
list_del(&dev->list);
|
||||
block2mtd_free_device(dev);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ static __u8 read8 (__u32 offset)
|
||||
{
|
||||
volatile __u8 *data = (__u8 *) (FLASH_OFFSET + offset);
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.2x\n",__FUNCTION__,offset,*data);
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.2x\n", __func__, offset, *data);
|
||||
#endif
|
||||
return (*data);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ static __u32 read32 (__u32 offset)
|
||||
{
|
||||
volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.8x\n",__FUNCTION__,offset,*data);
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x -> 0x%.8x\n", __func__, offset, *data);
|
||||
#endif
|
||||
return (*data);
|
||||
}
|
||||
@@ -294,7 +294,7 @@ static void write32 (__u32 x,__u32 offset)
|
||||
volatile __u32 *data = (__u32 *) (FLASH_OFFSET + offset);
|
||||
*data = x;
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n",__FUNCTION__,offset,*data);
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, *data);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ static inline int erase_block (__u32 offset)
|
||||
__u32 status;
|
||||
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x\n",__FUNCTION__,offset);
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x\n", __func__, offset);
|
||||
#endif
|
||||
|
||||
/* erase and confirm */
|
||||
@@ -371,7 +371,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
|
||||
int i,first;
|
||||
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n",__FUNCTION__,instr->addr,instr->len);
|
||||
printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n", __func__, instr->addr, instr->len);
|
||||
#endif
|
||||
|
||||
/* sanity checks */
|
||||
@@ -442,7 +442,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
|
||||
static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retlen,u_char *buf)
|
||||
{
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n",__FUNCTION__,(__u32) from,len);
|
||||
printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n", __func__, (__u32)from, len);
|
||||
#endif
|
||||
|
||||
/* sanity checks */
|
||||
@@ -488,7 +488,7 @@ static inline int write_dword (__u32 offset,__u32 x)
|
||||
__u32 status;
|
||||
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n",__FUNCTION__,offset,x);
|
||||
printk (KERN_DEBUG "%s(): 0x%.8x <- 0x%.8x\n", __func__, offset, x);
|
||||
#endif
|
||||
|
||||
/* setup writing */
|
||||
@@ -524,7 +524,7 @@ static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen
|
||||
int i,n;
|
||||
|
||||
#ifdef LART_DEBUG
|
||||
printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n",__FUNCTION__,(__u32) to,len);
|
||||
printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len);
|
||||
#endif
|
||||
|
||||
*retlen = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/* Flash opcodes. */
|
||||
#define OPCODE_WREN 0x06 /* Write enable */
|
||||
#define OPCODE_RDSR 0x05 /* Read status register */
|
||||
#define OPCODE_READ 0x03 /* Read data bytes (low frequency) */
|
||||
#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
|
||||
#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
|
||||
#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
|
||||
#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
|
||||
@@ -52,7 +52,15 @@
|
||||
|
||||
/* Define max times to check status register before we give up. */
|
||||
#define MAX_READY_WAIT_COUNT 100000
|
||||
#define CMD_SIZE 4
|
||||
|
||||
#ifdef CONFIG_M25PXX_USE_FAST_READ
|
||||
#define OPCODE_READ OPCODE_FAST_READ
|
||||
#define FAST_READ_DUMMY_BYTE 1
|
||||
#else
|
||||
#define OPCODE_READ OPCODE_NORM_READ
|
||||
#define FAST_READ_DUMMY_BYTE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MTD_PARTITIONS
|
||||
#define mtd_has_partitions() (1)
|
||||
@@ -68,7 +76,7 @@ struct m25p {
|
||||
struct mtd_info mtd;
|
||||
unsigned partitioned:1;
|
||||
u8 erase_opcode;
|
||||
u8 command[4];
|
||||
u8 command[CMD_SIZE + FAST_READ_DUMMY_BYTE];
|
||||
};
|
||||
|
||||
static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
|
||||
@@ -151,7 +159,7 @@ static int wait_till_ready(struct m25p *flash)
|
||||
static int erase_sector(struct m25p *flash, u32 offset)
|
||||
{
|
||||
DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB at 0x%08x\n",
|
||||
flash->spi->dev.bus_id, __FUNCTION__,
|
||||
flash->spi->dev.bus_id, __func__,
|
||||
flash->mtd.erasesize / 1024, offset);
|
||||
|
||||
/* Wait until finished previous write command. */
|
||||
@@ -167,7 +175,7 @@ static int erase_sector(struct m25p *flash, u32 offset)
|
||||
flash->command[2] = offset >> 8;
|
||||
flash->command[3] = offset;
|
||||
|
||||
spi_write(flash->spi, flash->command, sizeof(flash->command));
|
||||
spi_write(flash->spi, flash->command, CMD_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -188,7 +196,7 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
|
||||
u32 addr,len;
|
||||
|
||||
DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %d\n",
|
||||
flash->spi->dev.bus_id, __FUNCTION__, "at",
|
||||
flash->spi->dev.bus_id, __func__, "at",
|
||||
(u32)instr->addr, instr->len);
|
||||
|
||||
/* sanity checks */
|
||||
@@ -240,7 +248,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
struct spi_message m;
|
||||
|
||||
DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
|
||||
flash->spi->dev.bus_id, __FUNCTION__, "from",
|
||||
flash->spi->dev.bus_id, __func__, "from",
|
||||
(u32)from, len);
|
||||
|
||||
/* sanity checks */
|
||||
@@ -253,8 +261,12 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
spi_message_init(&m);
|
||||
memset(t, 0, (sizeof t));
|
||||
|
||||
/* NOTE:
|
||||
* OPCODE_FAST_READ (if available) is faster.
|
||||
* Should add 1 byte DUMMY_BYTE.
|
||||
*/
|
||||
t[0].tx_buf = flash->command;
|
||||
t[0].len = sizeof(flash->command);
|
||||
t[0].len = CMD_SIZE + FAST_READ_DUMMY_BYTE;
|
||||
spi_message_add_tail(&t[0], &m);
|
||||
|
||||
t[1].rx_buf = buf;
|
||||
@@ -287,7 +299,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
|
||||
spi_sync(flash->spi, &m);
|
||||
|
||||
*retlen = m.actual_length - sizeof(flash->command);
|
||||
*retlen = m.actual_length - CMD_SIZE - FAST_READ_DUMMY_BYTE;
|
||||
|
||||
mutex_unlock(&flash->lock);
|
||||
|
||||
@@ -308,7 +320,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
struct spi_message m;
|
||||
|
||||
DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
|
||||
flash->spi->dev.bus_id, __FUNCTION__, "to",
|
||||
flash->spi->dev.bus_id, __func__, "to",
|
||||
(u32)to, len);
|
||||
|
||||
if (retlen)
|
||||
@@ -325,7 +337,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
memset(t, 0, (sizeof t));
|
||||
|
||||
t[0].tx_buf = flash->command;
|
||||
t[0].len = sizeof(flash->command);
|
||||
t[0].len = CMD_SIZE;
|
||||
spi_message_add_tail(&t[0], &m);
|
||||
|
||||
t[1].tx_buf = buf;
|
||||
@@ -354,7 +366,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
|
||||
spi_sync(flash->spi, &m);
|
||||
|
||||
*retlen = m.actual_length - sizeof(flash->command);
|
||||
*retlen = m.actual_length - CMD_SIZE;
|
||||
} else {
|
||||
u32 i;
|
||||
|
||||
@@ -364,7 +376,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
t[1].len = page_size;
|
||||
spi_sync(flash->spi, &m);
|
||||
|
||||
*retlen = m.actual_length - sizeof(flash->command);
|
||||
*retlen = m.actual_length - CMD_SIZE;
|
||||
|
||||
/* write everything in PAGESIZE chunks */
|
||||
for (i = page_size; i < len; i += page_size) {
|
||||
@@ -387,8 +399,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
spi_sync(flash->spi, &m);
|
||||
|
||||
if (retlen)
|
||||
*retlen += m.actual_length
|
||||
- sizeof(flash->command);
|
||||
*retlen += m.actual_length - CMD_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,6 +446,7 @@ static struct flash_info __devinitdata m25p_data [] = {
|
||||
{ "at25fs040", 0x1f6604, 64 * 1024, 8, SECT_4K, },
|
||||
|
||||
{ "at25df041a", 0x1f4401, 64 * 1024, 8, SECT_4K, },
|
||||
{ "at25df641", 0x1f4800, 64 * 1024, 128, SECT_4K, },
|
||||
|
||||
{ "at26f004", 0x1f0400, 64 * 1024, 8, SECT_4K, },
|
||||
{ "at26df081a", 0x1f4501, 64 * 1024, 16, SECT_4K, },
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/mtd/compatmac.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/mtdram.h>
|
||||
|
||||
static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE;
|
||||
static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE;
|
||||
|
||||
@@ -282,7 +282,7 @@ static int phram_setup(const char *val, struct kernel_param *kp)
|
||||
}
|
||||
|
||||
module_param_call(phram, phram_setup, NULL, NULL, 000);
|
||||
MODULE_PARM_DESC(phram,"Memory region to map. \"map=<name>,<start>,<length>\"");
|
||||
MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>\"");
|
||||
|
||||
|
||||
static int __init init_phram(void)
|
||||
|
||||
+2
-4
@@ -136,8 +136,6 @@ typedef struct partition_t {
|
||||
#endif
|
||||
} partition_t;
|
||||
|
||||
void ftl_freepart(partition_t *part);
|
||||
|
||||
/* Partition state flags */
|
||||
#define FTL_FORMATTED 0x01
|
||||
|
||||
@@ -1014,7 +1012,7 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev,
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
void ftl_freepart(partition_t *part)
|
||||
static void ftl_freepart(partition_t *part)
|
||||
{
|
||||
vfree(part->VirtualBlockMap);
|
||||
part->VirtualBlockMap = NULL;
|
||||
@@ -1069,7 +1067,7 @@ static void ftl_remove_dev(struct mtd_blktrans_dev *dev)
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
struct mtd_blktrans_ops ftl_tr = {
|
||||
static struct mtd_blktrans_ops ftl_tr = {
|
||||
.name = "ftl",
|
||||
.major = FTL_MAJOR,
|
||||
.part_bits = PART_BITS,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user