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: (63 commits) mtd: OneNAND: Allow setting of boundary information when built as module jffs2: leaking jffs2_summary in function jffs2_scan_medium mtd: nand: Fix memory leak on txx9ndfmc probe failure. mtd: orion_nand: use burst reads with double word accesses mtd/nand: s3c6400 support for s3c2410 driver [MTD] [NAND] S3C2410: Use DIV_ROUND_UP [MTD] [NAND] S3C2410: Deal with unaligned lengths in S3C2440 buffer read/write [MTD] [NAND] S3C2410: Allow the machine code to get the BBT table from NAND [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set mtd: physmap_of: Add multiple regions and concatenation support mtd: nand: max_retries off by one in mxc_nand mtd: nand: s3c2410_nand_setrate(): use correct macros for 2412/2440 mtd: onenand: add bbt_wait & unlock_all as replaceable for some platform mtd: Flex-OneNAND support mtd: nand: add OMAP2/OMAP3 NAND driver mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs mtd: uclinux: mark local stuff static mtd: uclinux: do not allow to be built as a module mtd: uclinux: allow systems to override map addr/size mtd: blackfin NFC: fix hang when using NAND on BF527-EZKITs ...
This commit is contained in:
@@ -565,7 +565,7 @@ int omap2_onenand_rephase(void)
|
||||
NULL, __adjust_timing);
|
||||
}
|
||||
|
||||
static void __devexit omap2_onenand_shutdown(struct platform_device *pdev)
|
||||
static void omap2_onenand_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct omap2_onenand *c = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
@@ -777,7 +777,7 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
|
||||
|
||||
static struct platform_driver omap2_onenand_driver = {
|
||||
.probe = omap2_onenand_probe,
|
||||
.remove = omap2_onenand_remove,
|
||||
.remove = __devexit_p(omap2_onenand_remove),
|
||||
.shutdown = omap2_onenand_shutdown,
|
||||
.driver = {
|
||||
.name = DRIVER_NAME,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
|
||||
loff_t from;
|
||||
size_t readlen, ooblen;
|
||||
struct mtd_oob_ops ops;
|
||||
int rgn;
|
||||
|
||||
printk(KERN_INFO "Scanning device for bad blocks\n");
|
||||
|
||||
@@ -76,7 +77,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
|
||||
/* Note that numblocks is 2 * (real numblocks) here;
|
||||
* see i += 2 below as it makses shifting and masking less painful
|
||||
*/
|
||||
numblocks = mtd->size >> (bbm->bbt_erase_shift - 1);
|
||||
numblocks = this->chipsize >> (bbm->bbt_erase_shift - 1);
|
||||
startblock = 0;
|
||||
from = 0;
|
||||
|
||||
@@ -106,7 +107,12 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
|
||||
}
|
||||
}
|
||||
i += 2;
|
||||
from += (1 << bbm->bbt_erase_shift);
|
||||
|
||||
if (FLEXONENAND(this)) {
|
||||
rgn = flexonenand_region(mtd, from);
|
||||
from += mtd->eraseregions[rgn].erasesize;
|
||||
} else
|
||||
from += (1 << bbm->bbt_erase_shift);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -143,7 +149,7 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
|
||||
uint8_t res;
|
||||
|
||||
/* Get block number * 2 */
|
||||
block = (int) (offs >> (bbm->bbt_erase_shift - 1));
|
||||
block = (int) (onenand_block(this, offs) << 1);
|
||||
res = (bbm->bbt[block >> 3] >> (block & 0x06)) & 0x03;
|
||||
|
||||
DEBUG(MTD_DEBUG_LEVEL2, "onenand_isbad_bbt: bbt info for offs 0x%08x: (block %d) 0x%02x\n",
|
||||
@@ -178,7 +184,7 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
|
||||
struct bbm_info *bbm = this->bbm;
|
||||
int len, ret = 0;
|
||||
|
||||
len = mtd->size >> (this->erase_shift + 2);
|
||||
len = this->chipsize >> (this->erase_shift + 2);
|
||||
/* Allocate memory (2bit per block) and clear the memory bad block table */
|
||||
bbm->bbt = kzalloc(len, GFP_KERNEL);
|
||||
if (!bbm->bbt) {
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
* Copyright © 2005-2007 Samsung Electronics
|
||||
* Kyungmin Park <kyungmin.park@samsung.com>
|
||||
*
|
||||
* Vishak G <vishak.g at samsung.com>, Rohit Hagargundgi <h.rohit at samsung.com>
|
||||
* Flex-OneNAND simulator support
|
||||
* Copyright (C) Samsung Electronics, 2008
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
@@ -24,16 +28,38 @@
|
||||
#ifndef CONFIG_ONENAND_SIM_MANUFACTURER
|
||||
#define CONFIG_ONENAND_SIM_MANUFACTURER 0xec
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ONENAND_SIM_DEVICE_ID
|
||||
#define CONFIG_ONENAND_SIM_DEVICE_ID 0x04
|
||||
#endif
|
||||
|
||||
#define CONFIG_FLEXONENAND ((CONFIG_ONENAND_SIM_DEVICE_ID >> 9) & 1)
|
||||
|
||||
#ifndef CONFIG_ONENAND_SIM_VERSION_ID
|
||||
#define CONFIG_ONENAND_SIM_VERSION_ID 0x1e
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ONENAND_SIM_TECHNOLOGY_ID
|
||||
#define CONFIG_ONENAND_SIM_TECHNOLOGY_ID CONFIG_FLEXONENAND
|
||||
#endif
|
||||
|
||||
/* Initial boundary values for Flex-OneNAND Simulator */
|
||||
#ifndef CONFIG_FLEXONENAND_SIM_DIE0_BOUNDARY
|
||||
#define CONFIG_FLEXONENAND_SIM_DIE0_BOUNDARY 0x01
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_FLEXONENAND_SIM_DIE1_BOUNDARY
|
||||
#define CONFIG_FLEXONENAND_SIM_DIE1_BOUNDARY 0x01
|
||||
#endif
|
||||
|
||||
static int manuf_id = CONFIG_ONENAND_SIM_MANUFACTURER;
|
||||
static int device_id = CONFIG_ONENAND_SIM_DEVICE_ID;
|
||||
static int version_id = CONFIG_ONENAND_SIM_VERSION_ID;
|
||||
static int technology_id = CONFIG_ONENAND_SIM_TECHNOLOGY_ID;
|
||||
static int boundary[] = {
|
||||
CONFIG_FLEXONENAND_SIM_DIE0_BOUNDARY,
|
||||
CONFIG_FLEXONENAND_SIM_DIE1_BOUNDARY,
|
||||
};
|
||||
|
||||
struct onenand_flash {
|
||||
void __iomem *base;
|
||||
@@ -57,12 +83,18 @@ struct onenand_flash {
|
||||
(writew(v, this->base + ONENAND_REG_WP_STATUS))
|
||||
|
||||
/* It has all 0xff chars */
|
||||
#define MAX_ONENAND_PAGESIZE (2048 + 64)
|
||||
#define MAX_ONENAND_PAGESIZE (4096 + 128)
|
||||
static unsigned char *ffchars;
|
||||
|
||||
#if CONFIG_FLEXONENAND
|
||||
#define PARTITION_NAME "Flex-OneNAND simulator partition"
|
||||
#else
|
||||
#define PARTITION_NAME "OneNAND simulator partition"
|
||||
#endif
|
||||
|
||||
static struct mtd_partition os_partitions[] = {
|
||||
{
|
||||
.name = "OneNAND simulator partition",
|
||||
.name = PARTITION_NAME,
|
||||
.offset = 0,
|
||||
.size = MTDPART_SIZ_FULL,
|
||||
},
|
||||
@@ -104,6 +136,7 @@ static void onenand_lock_handle(struct onenand_chip *this, int cmd)
|
||||
|
||||
switch (cmd) {
|
||||
case ONENAND_CMD_UNLOCK:
|
||||
case ONENAND_CMD_UNLOCK_ALL:
|
||||
if (block_lock_scheme)
|
||||
ONENAND_SET_WP_STATUS(ONENAND_WP_US, this);
|
||||
else
|
||||
@@ -228,10 +261,12 @@ static void onenand_data_handle(struct onenand_chip *this, int cmd,
|
||||
{
|
||||
struct mtd_info *mtd = &info->mtd;
|
||||
struct onenand_flash *flash = this->priv;
|
||||
int main_offset, spare_offset;
|
||||
int main_offset, spare_offset, die = 0;
|
||||
void __iomem *src;
|
||||
void __iomem *dest;
|
||||
unsigned int i;
|
||||
static int pi_operation;
|
||||
int erasesize, rgn;
|
||||
|
||||
if (dataram) {
|
||||
main_offset = mtd->writesize;
|
||||
@@ -241,10 +276,27 @@ static void onenand_data_handle(struct onenand_chip *this, int cmd,
|
||||
spare_offset = 0;
|
||||
}
|
||||
|
||||
if (pi_operation) {
|
||||
die = readw(this->base + ONENAND_REG_START_ADDRESS2);
|
||||
die >>= ONENAND_DDP_SHIFT;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case FLEXONENAND_CMD_PI_ACCESS:
|
||||
pi_operation = 1;
|
||||
break;
|
||||
|
||||
case ONENAND_CMD_RESET:
|
||||
pi_operation = 0;
|
||||
break;
|
||||
|
||||
case ONENAND_CMD_READ:
|
||||
src = ONENAND_CORE(flash) + offset;
|
||||
dest = ONENAND_MAIN_AREA(this, main_offset);
|
||||
if (pi_operation) {
|
||||
writew(boundary[die], this->base + ONENAND_DATARAM);
|
||||
break;
|
||||
}
|
||||
memcpy(dest, src, mtd->writesize);
|
||||
/* Fall through */
|
||||
|
||||
@@ -257,6 +309,10 @@ static void onenand_data_handle(struct onenand_chip *this, int cmd,
|
||||
case ONENAND_CMD_PROG:
|
||||
src = ONENAND_MAIN_AREA(this, main_offset);
|
||||
dest = ONENAND_CORE(flash) + offset;
|
||||
if (pi_operation) {
|
||||
boundary[die] = readw(this->base + ONENAND_DATARAM);
|
||||
break;
|
||||
}
|
||||
/* To handle partial write */
|
||||
for (i = 0; i < (1 << mtd->subpage_sft); i++) {
|
||||
int off = i * this->subpagesize;
|
||||
@@ -284,9 +340,18 @@ static void onenand_data_handle(struct onenand_chip *this, int cmd,
|
||||
break;
|
||||
|
||||
case ONENAND_CMD_ERASE:
|
||||
memset(ONENAND_CORE(flash) + offset, 0xff, mtd->erasesize);
|
||||
if (pi_operation)
|
||||
break;
|
||||
|
||||
if (FLEXONENAND(this)) {
|
||||
rgn = flexonenand_region(mtd, offset);
|
||||
erasesize = mtd->eraseregions[rgn].erasesize;
|
||||
} else
|
||||
erasesize = mtd->erasesize;
|
||||
|
||||
memset(ONENAND_CORE(flash) + offset, 0xff, erasesize);
|
||||
memset(ONENAND_CORE_SPARE(flash, this, offset), 0xff,
|
||||
(mtd->erasesize >> 5));
|
||||
(erasesize >> 5));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -339,7 +404,7 @@ static void onenand_command_handle(struct onenand_chip *this, int cmd)
|
||||
}
|
||||
|
||||
if (block != -1)
|
||||
offset += block << this->erase_shift;
|
||||
offset = onenand_addr(this, block);
|
||||
|
||||
if (page != -1)
|
||||
offset += page << this->page_shift;
|
||||
@@ -390,6 +455,7 @@ static int __init flash_init(struct onenand_flash *flash)
|
||||
}
|
||||
|
||||
density = device_id >> ONENAND_DEVICE_DENSITY_SHIFT;
|
||||
density &= ONENAND_DEVICE_DENSITY_MASK;
|
||||
size = ((16 << 20) << density);
|
||||
|
||||
ONENAND_CORE(flash) = vmalloc(size + (size >> 5));
|
||||
@@ -405,8 +471,9 @@ static int __init flash_init(struct onenand_flash *flash)
|
||||
writew(manuf_id, flash->base + ONENAND_REG_MANUFACTURER_ID);
|
||||
writew(device_id, flash->base + ONENAND_REG_DEVICE_ID);
|
||||
writew(version_id, flash->base + ONENAND_REG_VERSION_ID);
|
||||
writew(technology_id, flash->base + ONENAND_REG_TECHNOLOGY);
|
||||
|
||||
if (density < 2)
|
||||
if (density < 2 && (!CONFIG_FLEXONENAND))
|
||||
buffer_size = 0x0400; /* 1KiB page */
|
||||
else
|
||||
buffer_size = 0x0800; /* 2KiB page */
|
||||
|
||||
Reference in New Issue
Block a user