mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: [MTD] NAND: Select chip before checking write protect status [MTD] CORE mtdchar.c: fix off-by-one error in lseek() [MTD] NAND: Fix typo in mtd/nand/ts7250.c [JFFS2][XATTR] coexistence between xattr and write buffering support. [JFFS2][XATTR] Fix wrong copyright [JFFS2][XATTR] Re-define xd->refcnt as atomic_t [JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref [JFFS2][XATTR] rid unnecessary writing of delete marker. [JFFS2][XATTR] Fix ACL bug when updating null xattr by null ACL. [JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion [MTD] Fix off-by-one error in physmap.c [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver [MTD NAND] s3c2412 support in s3c2410.c [MTD] Initialize 'writesize' [MTD] NAND: ndfc fix address offset thinko [MTD] NAND: S3C2410 convert prinks to dev_*()s [MTD] NAND: Missing fixups
This commit is contained in:
commit
936813a880
34 changed files with 657 additions and 411 deletions
|
|
@ -357,6 +357,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
|
|||
mtd->resume = cfi_intelext_resume;
|
||||
mtd->flags = MTD_CAP_NORFLASH;
|
||||
mtd->name = map->name;
|
||||
mtd->writesize = 1;
|
||||
|
||||
mtd->reboot_notifier.notifier_call = cfi_intelext_reboot;
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
|
|||
MTD->name = map->name;
|
||||
MTD->type = MTD_NORFLASH;
|
||||
MTD->flags = MTD_CAP_NORFLASH;
|
||||
MTD->writesize = 1;
|
||||
MTD->erasesize = SectorSize*(map->buswidth);
|
||||
// printk("MTD->erasesize is %x\n",(unsigned int)MTD->erasesize);
|
||||
MTD->size = priv->size;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
|
|||
mtd->write = map_absent_write;
|
||||
mtd->sync = map_absent_sync;
|
||||
mtd->flags = 0;
|
||||
mtd->erasesize = PAGE_SIZE;
|
||||
mtd->erasesize = PAGE_SIZE;
|
||||
mtd->writesize = 1;
|
||||
|
||||
__module_get(THIS_MODULE);
|
||||
return mtd;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
|
|||
mtd->write = mapram_write;
|
||||
mtd->sync = mapram_nop;
|
||||
mtd->flags = MTD_CAP_RAM;
|
||||
mtd->writesize = 1;
|
||||
|
||||
mtd->erasesize = PAGE_SIZE;
|
||||
while(mtd->size & (mtd->erasesize - 1))
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
|
|||
mtd->sync = maprom_nop;
|
||||
mtd->flags = MTD_CAP_ROM;
|
||||
mtd->erasesize = map->size;
|
||||
mtd->writesize = 1;
|
||||
|
||||
__module_get(THIS_MODULE);
|
||||
return mtd;
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
|
|||
|
||||
dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
|
||||
dev->mtd.erasesize = erase_size;
|
||||
dev->mtd.writesize = 1;
|
||||
dev->mtd.type = MTD_RAM;
|
||||
dev->mtd.flags = MTD_CAP_RAM;
|
||||
dev->mtd.erase = block2mtd_erase;
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ static int __init ms02nv_init_one(ulong addr)
|
|||
mtd->owner = THIS_MODULE;
|
||||
mtd->read = ms02nv_read;
|
||||
mtd->write = ms02nv_write;
|
||||
mtd->writesize = 1;
|
||||
|
||||
ret = -EIO;
|
||||
if (add_mtd_device(mtd)) {
|
||||
|
|
|
|||
|
|
@ -478,6 +478,7 @@ add_dataflash(struct spi_device *spi, char *name,
|
|||
device->name = (pdata && pdata->name) ? pdata->name : priv->name;
|
||||
device->size = nr_pages * pagesize;
|
||||
device->erasesize = pagesize;
|
||||
device->writesize = pagesize;
|
||||
device->owner = THIS_MODULE;
|
||||
device->type = MTD_DATAFLASH;
|
||||
device->flags = MTD_CAP_NORFLASH;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
|
|||
new->mtd.owner = THIS_MODULE;
|
||||
new->mtd.type = MTD_RAM;
|
||||
new->mtd.erasesize = PAGE_SIZE;
|
||||
new->mtd.writesize = 1;
|
||||
|
||||
ret = -EAGAIN;
|
||||
if (add_mtd_device(&new->mtd)) {
|
||||
|
|
|
|||
|
|
@ -778,7 +778,8 @@ static int __init init_pmc551(void)
|
|||
mtd->type = MTD_RAM;
|
||||
mtd->name = "PMC551 RAM board";
|
||||
mtd->erasesize = 0x10000;
|
||||
mtd->owner = THIS_MODULE;
|
||||
mtd->writesize = 1;
|
||||
mtd->owner = THIS_MODULE;
|
||||
|
||||
if (add_mtd_device(mtd)) {
|
||||
printk(KERN_NOTICE "pmc551: Failed to register new device\n");
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
|
|||
(*curmtd)->mtdinfo->owner = THIS_MODULE;
|
||||
(*curmtd)->mtdinfo->type = MTD_RAM;
|
||||
(*curmtd)->mtdinfo->erasesize = SLRAM_BLK_SZ;
|
||||
(*curmtd)->mtdinfo->writesize = 1;
|
||||
|
||||
if (add_mtd_device((*curmtd)->mtdinfo)) {
|
||||
E("slram: Failed to register new device\n");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ struct ixp2000_flash_info {
|
|||
struct map_info map;
|
||||
struct mtd_partition *partitions;
|
||||
struct resource *res;
|
||||
int nr_banks;
|
||||
};
|
||||
|
||||
static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs)
|
||||
|
|
@ -183,7 +182,6 @@ static int ixp2000_flash_probe(struct platform_device *dev)
|
|||
*/
|
||||
info->map.phys = NO_XIP;
|
||||
|
||||
info->nr_banks = ixp_data->nr_banks;
|
||||
info->map.size = ixp_data->nr_banks * window_size;
|
||||
info->map.bankwidth = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ static struct physmap_flash_data physmap_flash_data = {
|
|||
|
||||
static struct resource physmap_flash_resource = {
|
||||
.start = CONFIG_MTD_PHYSMAP_START,
|
||||
.end = CONFIG_MTD_PHYSMAP_START + CONFIG_MTD_PHYSMAP_LEN,
|
||||
.end = CONFIG_MTD_PHYSMAP_START + CONFIG_MTD_PHYSMAP_LEN - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (offset >= 0 && offset < mtd->size)
|
||||
if (offset >= 0 && offset <= mtd->size)
|
||||
return file->f_pos = offset;
|
||||
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -1176,7 +1176,7 @@ static int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
|
|||
|
||||
status = chip->waitfunc(mtd, chip);
|
||||
|
||||
return status;
|
||||
return status & NAND_STATUS_FAIL ? -EIO : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1271,10 +1271,6 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
|
|||
sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
|
||||
buf = nand_transfer_oob(chip, buf, ops);
|
||||
|
||||
readlen -= ops->ooblen;
|
||||
if (!readlen)
|
||||
break;
|
||||
|
||||
if (!(chip->options & NAND_NO_READRDY)) {
|
||||
/*
|
||||
* Apply delay or wait for ready/busy pin. Do this
|
||||
|
|
@ -1288,6 +1284,10 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
|
|||
nand_wait_ready(mtd);
|
||||
}
|
||||
|
||||
readlen -= ops->ooblen;
|
||||
if (!readlen)
|
||||
break;
|
||||
|
||||
/* Increment page address */
|
||||
realpage++;
|
||||
|
||||
|
|
@ -1610,13 +1610,13 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
|||
if (!writelen)
|
||||
return 0;
|
||||
|
||||
chipnr = (int)(to >> chip->chip_shift);
|
||||
chip->select_chip(mtd, chipnr);
|
||||
|
||||
/* Check, if it is write protected */
|
||||
if (nand_check_wp(mtd))
|
||||
return -EIO;
|
||||
|
||||
chipnr = (int)(to >> chip->chip_shift);
|
||||
chip->select_chip(mtd, chipnr);
|
||||
|
||||
realpage = (int)(to >> chip->page_shift);
|
||||
page = realpage & chip->pagemask;
|
||||
blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;
|
||||
|
|
|
|||
|
|
@ -61,15 +61,15 @@ static void ndfc_select_chip(struct mtd_info *mtd, int chip)
|
|||
|
||||
static void ndfc_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *chip = mtd->priv;
|
||||
struct ndfc_controller *ndfc = &ndfc_ctrl;
|
||||
|
||||
if (cmd == NAND_CMD_NONE)
|
||||
return;
|
||||
|
||||
if (ctrl & NAND_CLE)
|
||||
writel(cmd & 0xFF, chip->IO_ADDR_W + NDFC_CMD);
|
||||
writel(cmd & 0xFF, ndfc->ndfcbase + NDFC_CMD);
|
||||
else
|
||||
writel(cmd & 0xFF, chip->IO_ADDR_W + NDFC_ALE);
|
||||
writel(cmd & 0xFF, ndfc->ndfcbase + NDFC_ALE);
|
||||
}
|
||||
|
||||
static int ndfc_ready(struct mtd_info *mtd)
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@
|
|||
#include <asm/arch/regs-nand.h>
|
||||
#include <asm/arch/nand.h>
|
||||
|
||||
#define PFX "s3c2410-nand: "
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_S3C2410_HWECC
|
||||
static int hardware_ecc = 1;
|
||||
#else
|
||||
|
|
@ -99,6 +97,12 @@ struct s3c2410_nand_mtd {
|
|||
int scan_res;
|
||||
};
|
||||
|
||||
enum s3c_cpu_type {
|
||||
TYPE_S3C2410,
|
||||
TYPE_S3C2412,
|
||||
TYPE_S3C2440,
|
||||
};
|
||||
|
||||
/* overview of the s3c2410 nand state */
|
||||
|
||||
struct s3c2410_nand_info {
|
||||
|
|
@ -112,9 +116,11 @@ struct s3c2410_nand_info {
|
|||
struct resource *area;
|
||||
struct clk *clk;
|
||||
void __iomem *regs;
|
||||
void __iomem *sel_reg;
|
||||
int sel_bit;
|
||||
int mtd_count;
|
||||
|
||||
unsigned char is_s3c2440;
|
||||
enum s3c_cpu_type cpu_type;
|
||||
};
|
||||
|
||||
/* conversion functions */
|
||||
|
|
@ -148,7 +154,7 @@ static inline int allow_clk_stop(struct s3c2410_nand_info *info)
|
|||
|
||||
#define NS_IN_KHZ 1000000
|
||||
|
||||
static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)
|
||||
static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -172,53 +178,58 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)
|
|||
|
||||
/* controller setup */
|
||||
|
||||
static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, struct platform_device *pdev)
|
||||
static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,
|
||||
struct platform_device *pdev)
|
||||
{
|
||||
struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
|
||||
unsigned long clkrate = clk_get_rate(info->clk);
|
||||
int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4;
|
||||
int tacls, twrph0, twrph1;
|
||||
unsigned long cfg;
|
||||
unsigned long cfg = 0;
|
||||
|
||||
/* calculate the timing information for the controller */
|
||||
|
||||
clkrate /= 1000; /* turn clock into kHz for ease of use */
|
||||
|
||||
if (plat != NULL) {
|
||||
tacls = s3c2410_nand_calc_rate(plat->tacls, clkrate, 4);
|
||||
twrph0 = s3c2410_nand_calc_rate(plat->twrph0, clkrate, 8);
|
||||
twrph1 = s3c2410_nand_calc_rate(plat->twrph1, clkrate, 8);
|
||||
tacls = s3c_nand_calc_rate(plat->tacls, clkrate, tacls_max);
|
||||
twrph0 = s3c_nand_calc_rate(plat->twrph0, clkrate, 8);
|
||||
twrph1 = s3c_nand_calc_rate(plat->twrph1, clkrate, 8);
|
||||
} else {
|
||||
/* default timings */
|
||||
tacls = 4;
|
||||
tacls = tacls_max;
|
||||
twrph0 = 8;
|
||||
twrph1 = 8;
|
||||
}
|
||||
|
||||
if (tacls < 0 || twrph0 < 0 || twrph1 < 0) {
|
||||
printk(KERN_ERR PFX "cannot get timings suitable for board\n");
|
||||
dev_err(info->device, "cannot get suitable timings\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
printk(KERN_INFO PFX "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
|
||||
dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
|
||||
tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate));
|
||||
|
||||
if (!info->is_s3c2440) {
|
||||
switch (info->cpu_type) {
|
||||
case TYPE_S3C2410:
|
||||
cfg = S3C2410_NFCONF_EN;
|
||||
cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
|
||||
cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1);
|
||||
cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1);
|
||||
} else {
|
||||
break;
|
||||
|
||||
case TYPE_S3C2440:
|
||||
case TYPE_S3C2412:
|
||||
cfg = S3C2440_NFCONF_TACLS(tacls - 1);
|
||||
cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1);
|
||||
cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1);
|
||||
|
||||
/* enable the controller and de-assert nFCE */
|
||||
|
||||
writel(S3C2440_NFCONT_ENABLE | S3C2440_NFCONT_ENABLE,
|
||||
info->regs + S3C2440_NFCONT);
|
||||
writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT);
|
||||
}
|
||||
|
||||
pr_debug(PFX "NF_CONF is 0x%lx\n", cfg);
|
||||
dev_dbg(info->device, "NF_CONF is 0x%lx\n", cfg);
|
||||
|
||||
writel(cfg, info->regs + S3C2410_NFCONF);
|
||||
return 0;
|
||||
|
|
@ -231,26 +242,21 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
|
|||
struct s3c2410_nand_info *info;
|
||||
struct s3c2410_nand_mtd *nmtd;
|
||||
struct nand_chip *this = mtd->priv;
|
||||
void __iomem *reg;
|
||||
unsigned long cur;
|
||||
unsigned long bit;
|
||||
|
||||
nmtd = this->priv;
|
||||
info = nmtd->info;
|
||||
|
||||
bit = (info->is_s3c2440) ? S3C2440_NFCONT_nFCE : S3C2410_NFCONF_nFCE;
|
||||
reg = info->regs + ((info->is_s3c2440) ? S3C2440_NFCONT : S3C2410_NFCONF);
|
||||
|
||||
if (chip != -1 && allow_clk_stop(info))
|
||||
clk_enable(info->clk);
|
||||
|
||||
cur = readl(reg);
|
||||
cur = readl(info->sel_reg);
|
||||
|
||||
if (chip == -1) {
|
||||
cur |= bit;
|
||||
cur |= info->sel_bit;
|
||||
} else {
|
||||
if (nmtd->set != NULL && chip > nmtd->set->nr_chips) {
|
||||
printk(KERN_ERR PFX "chip %d out of range\n", chip);
|
||||
dev_err(info->device, "invalid chip %d\n", chip);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -259,10 +265,10 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
|
|||
(info->platform->select_chip) (nmtd->set, chip);
|
||||
}
|
||||
|
||||
cur &= ~bit;
|
||||
cur &= ~info->sel_bit;
|
||||
}
|
||||
|
||||
writel(cur, reg);
|
||||
writel(cur, info->sel_reg);
|
||||
|
||||
if (chip == -1 && allow_clk_stop(info))
|
||||
clk_disable(info->clk);
|
||||
|
|
@ -311,15 +317,25 @@ static void s3c2440_nand_hwcontrol(struct mtd_info *mtd, int cmd,
|
|||
static int s3c2410_nand_devready(struct mtd_info *mtd)
|
||||
{
|
||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
||||
|
||||
if (info->is_s3c2440)
|
||||
return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY;
|
||||
return readb(info->regs + S3C2410_NFSTAT) & S3C2410_NFSTAT_BUSY;
|
||||
}
|
||||
|
||||
static int s3c2440_nand_devready(struct mtd_info *mtd)
|
||||
{
|
||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
||||
return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY;
|
||||
}
|
||||
|
||||
static int s3c2412_nand_devready(struct mtd_info *mtd)
|
||||
{
|
||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
||||
return readb(info->regs + S3C2412_NFSTAT) & S3C2412_NFSTAT_READY;
|
||||
}
|
||||
|
||||
/* ECC handling functions */
|
||||
|
||||
static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc)
|
||||
static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
|
||||
u_char *read_ecc, u_char *calc_ecc)
|
||||
{
|
||||
pr_debug("s3c2410_nand_correct_data(%p,%p,%p,%p)\n", mtd, dat, read_ecc, calc_ecc);
|
||||
|
||||
|
|
@ -487,11 +503,8 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
|||
struct s3c2410_nand_set *set)
|
||||
{
|
||||
struct nand_chip *chip = &nmtd->chip;
|
||||
void __iomem *regs = info->regs;
|
||||
|
||||
chip->IO_ADDR_R = info->regs + S3C2410_NFDATA;
|
||||
chip->IO_ADDR_W = info->regs + S3C2410_NFDATA;
|
||||
chip->cmd_ctrl = s3c2410_nand_hwcontrol;
|
||||
chip->dev_ready = s3c2410_nand_devready;
|
||||
chip->write_buf = s3c2410_nand_write_buf;
|
||||
chip->read_buf = s3c2410_nand_read_buf;
|
||||
chip->select_chip = s3c2410_nand_select_chip;
|
||||
|
|
@ -500,11 +513,37 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
|||
chip->options = 0;
|
||||
chip->controller = &info->controller;
|
||||
|
||||
if (info->is_s3c2440) {
|
||||
chip->IO_ADDR_R = info->regs + S3C2440_NFDATA;
|
||||
chip->IO_ADDR_W = info->regs + S3C2440_NFDATA;
|
||||
chip->cmd_ctrl = s3c2440_nand_hwcontrol;
|
||||
}
|
||||
switch (info->cpu_type) {
|
||||
case TYPE_S3C2410:
|
||||
chip->IO_ADDR_W = regs + S3C2410_NFDATA;
|
||||
info->sel_reg = regs + S3C2410_NFCONF;
|
||||
info->sel_bit = S3C2410_NFCONF_nFCE;
|
||||
chip->cmd_ctrl = s3c2410_nand_hwcontrol;
|
||||
chip->dev_ready = s3c2410_nand_devready;
|
||||
break;
|
||||
|
||||
case TYPE_S3C2440:
|
||||
chip->IO_ADDR_W = regs + S3C2440_NFDATA;
|
||||
info->sel_reg = regs + S3C2440_NFCONT;
|
||||
info->sel_bit = S3C2440_NFCONT_nFCE;
|
||||
chip->cmd_ctrl = s3c2440_nand_hwcontrol;
|
||||
chip->dev_ready = s3c2440_nand_devready;
|
||||
break;
|
||||
|
||||
case TYPE_S3C2412:
|
||||
chip->IO_ADDR_W = regs + S3C2440_NFDATA;
|
||||
info->sel_reg = regs + S3C2440_NFCONT;
|
||||
info->sel_bit = S3C2412_NFCONT_nFCE0;
|
||||
chip->cmd_ctrl = s3c2440_nand_hwcontrol;
|
||||
chip->dev_ready = s3c2412_nand_devready;
|
||||
|
||||
if (readl(regs + S3C2410_NFCONF) & S3C2412_NFCONF_NANDBOOT)
|
||||
dev_info(info->device, "System booted from NAND\n");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
chip->IO_ADDR_R = chip->IO_ADDR_W;
|
||||
|
||||
nmtd->info = info;
|
||||
nmtd->mtd.priv = chip;
|
||||
|
|
@ -512,17 +551,25 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
|||
nmtd->set = set;
|
||||
|
||||
if (hardware_ecc) {
|
||||
chip->ecc.correct = s3c2410_nand_correct_data;
|
||||
chip->ecc.hwctl = s3c2410_nand_enable_hwecc;
|
||||
chip->ecc.calculate = s3c2410_nand_calculate_ecc;
|
||||
chip->ecc.correct = s3c2410_nand_correct_data;
|
||||
chip->ecc.mode = NAND_ECC_HW;
|
||||
chip->ecc.size = 512;
|
||||
chip->ecc.bytes = 3;
|
||||
chip->ecc.layout = &nand_hw_eccoob;
|
||||
|
||||
if (info->is_s3c2440) {
|
||||
chip->ecc.hwctl = s3c2440_nand_enable_hwecc;
|
||||
chip->ecc.calculate = s3c2440_nand_calculate_ecc;
|
||||
switch (info->cpu_type) {
|
||||
case TYPE_S3C2410:
|
||||
chip->ecc.hwctl = s3c2410_nand_enable_hwecc;
|
||||
chip->ecc.calculate = s3c2410_nand_calculate_ecc;
|
||||
break;
|
||||
|
||||
case TYPE_S3C2412:
|
||||
case TYPE_S3C2440:
|
||||
chip->ecc.hwctl = s3c2440_nand_enable_hwecc;
|
||||
chip->ecc.calculate = s3c2440_nand_calculate_ecc;
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
chip->ecc.mode = NAND_ECC_SOFT;
|
||||
|
|
@ -537,7 +584,8 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
|||
* nand layer to look for devices
|
||||
*/
|
||||
|
||||
static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
|
||||
static int s3c24xx_nand_probe(struct platform_device *pdev,
|
||||
enum s3c_cpu_type cpu_type)
|
||||
{
|
||||
struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
|
||||
struct s3c2410_nand_info *info;
|
||||
|
|
@ -592,7 +640,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
|
|||
info->device = &pdev->dev;
|
||||
info->platform = plat;
|
||||
info->regs = ioremap(res->start, size);
|
||||
info->is_s3c2440 = is_s3c2440;
|
||||
info->cpu_type = cpu_type;
|
||||
|
||||
if (info->regs == NULL) {
|
||||
dev_err(&pdev->dev, "cannot reserve register region\n");
|
||||
|
|
@ -699,12 +747,17 @@ static int s3c24xx_nand_resume(struct platform_device *dev)
|
|||
|
||||
static int s3c2410_nand_probe(struct platform_device *dev)
|
||||
{
|
||||
return s3c24xx_nand_probe(dev, 0);
|
||||
return s3c24xx_nand_probe(dev, TYPE_S3C2410);
|
||||
}
|
||||
|
||||
static int s3c2440_nand_probe(struct platform_device *dev)
|
||||
{
|
||||
return s3c24xx_nand_probe(dev, 1);
|
||||
return s3c24xx_nand_probe(dev, TYPE_S3C2440);
|
||||
}
|
||||
|
||||
static int s3c2412_nand_probe(struct platform_device *dev)
|
||||
{
|
||||
return s3c24xx_nand_probe(dev, TYPE_S3C2412);
|
||||
}
|
||||
|
||||
static struct platform_driver s3c2410_nand_driver = {
|
||||
|
|
@ -729,16 +782,29 @@ static struct platform_driver s3c2440_nand_driver = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct platform_driver s3c2412_nand_driver = {
|
||||
.probe = s3c2412_nand_probe,
|
||||
.remove = s3c2410_nand_remove,
|
||||
.suspend = s3c24xx_nand_suspend,
|
||||
.resume = s3c24xx_nand_resume,
|
||||
.driver = {
|
||||
.name = "s3c2412-nand",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init s3c2410_nand_init(void)
|
||||
{
|
||||
printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
|
||||
|
||||
platform_driver_register(&s3c2412_nand_driver);
|
||||
platform_driver_register(&s3c2440_nand_driver);
|
||||
return platform_driver_register(&s3c2410_nand_driver);
|
||||
}
|
||||
|
||||
static void __exit s3c2410_nand_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&s3c2412_nand_driver);
|
||||
platform_driver_unregister(&s3c2440_nand_driver);
|
||||
platform_driver_unregister(&s3c2410_nand_driver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static void ts7250_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
|
|||
unsigned long addr = TS72XX_NAND_CONTROL_VIRT_BASE;
|
||||
unsigned char bits;
|
||||
|
||||
bits = (ctrl & NAND_CNE) << 2;
|
||||
bits = (ctrl & NAND_NCE) << 2;
|
||||
bits |= ctrl & NAND_CLE;
|
||||
bits |= (ctrl & NAND_ALE) >> 2;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue