Skip to content

Commit

Permalink
Merge git://git.infradead.org/mtd-2.6
Browse files Browse the repository at this point in the history
* git://git.infradead.org/mtd-2.6:
  [MTD][NOR] Add physical address to point() method
  [JFFS2] Track parent inode for directories (for NFS export)
  [JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.
  [JFFS2] Quiet lockdep false positive.
  [JFFS2] Clean up jffs2_alloc_inode() and jffs2_i_init_once()
  [MTD] Delete long-unused jedec.h header file.
  [MTD] [NAND] at91_nand: use at91_nand_{en,dis}able consistently.
  • Loading branch information
Linus Torvalds committed May 1, 2008
2 parents bcf35af + a98889f commit 2c4aabc
Show file tree
Hide file tree
Showing 25 changed files with 193 additions and 196 deletions.
14 changes: 8 additions & 6 deletions drivers/mtd/chips/cfi_cmdset_0001.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ static struct mtd_info *cfi_intelext_setup (struct mtd_info *);
static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **);

static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf);
static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from,
size_t len);
size_t *retlen, void **virt, resource_size_t *phys);
static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len);

static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode);
static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode);
Expand Down Expand Up @@ -1240,7 +1239,8 @@ static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t a
return ret;
}

static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf)
static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys)
{
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
Expand All @@ -1257,8 +1257,10 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si
chipnum = (from >> cfi->chipshift);
ofs = from - (chipnum << cfi->chipshift);

*mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs;
*virt = map->virt + cfi->chips[chipnum].start + ofs;
*retlen = 0;
if (phys)
*phys = map->phys + cfi->chips[chipnum].start + ofs;

while (len) {
unsigned long thislen;
Expand Down Expand Up @@ -1291,7 +1293,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si
return 0;
}

static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
Expand Down
11 changes: 7 additions & 4 deletions drivers/mtd/devices/mtdram.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
}

static int ram_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
size_t *retlen, void **virt, resource_size_t *phys)
{
if (from + len > mtd->size)
return -EINVAL;

*mtdbuf = mtd->priv + from;
/* can we return a physical address with this driver? */
if (phys)
return -EINVAL;

*virt = mtd->priv + from;
*retlen = len;
return 0;
}

static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
size_t len)
static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
}

Expand Down
13 changes: 7 additions & 6 deletions drivers/mtd/devices/phram.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,21 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
}

static int phram_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
size_t *retlen, void **virt, resource_size_t *phys)
{
u_char *start = mtd->priv;

if (from + len > mtd->size)
return -EINVAL;

*mtdbuf = start + from;
/* can we return a physical address with this driver? */
if (phys)
return -EINVAL;

*virt = mtd->priv + from;
*retlen = len;
return 0;
}

static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from,
size_t len)
static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
}

Expand Down
27 changes: 17 additions & 10 deletions drivers/mtd/devices/pmc551.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr)
eoff_lo = end & (priv->asize - 1);
soff_lo = instr->addr & (priv->asize - 1);

pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr);
pmc551_point(mtd, instr->addr, instr->len, &retlen,
(void **)&ptr, NULL);

if (soff_hi == eoff_hi || mtd->size == priv->asize) {
/* The whole thing fits within one access, so just one shot
Expand All @@ -154,7 +155,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr)
}
soff_hi += priv->asize;
pmc551_point(mtd, (priv->base_map0 | soff_hi),
priv->asize, &retlen, &ptr);
priv->asize, &retlen,
(void **)&ptr, NULL);
}
memset(ptr, 0xff, eoff_lo);
}
Expand All @@ -170,7 +172,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr)
}

static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t * retlen, u_char ** mtdbuf)
size_t *retlen, void **virt, resource_size_t *phys)
{
struct mypriv *priv = mtd->priv;
u32 soff_hi;
Expand All @@ -188,6 +190,10 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
return -EINVAL;
}

/* can we return a physical address with this driver? */
if (phys)
return -EINVAL;

soff_hi = from & ~(priv->asize - 1);
soff_lo = from & (priv->asize - 1);

Expand All @@ -198,13 +204,12 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
priv->curr_map0 = soff_hi;
}

*mtdbuf = priv->start + soff_lo;
*virt = priv->start + soff_lo;
*retlen = len;
return 0;
}

static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
size_t len)
static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
#ifdef CONFIG_MTD_PMC551_DEBUG
printk(KERN_DEBUG "pmc551_unpoint()\n");
Expand Down Expand Up @@ -242,7 +247,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len,
soff_lo = from & (priv->asize - 1);
eoff_lo = end & (priv->asize - 1);

pmc551_point(mtd, from, len, retlen, &ptr);
pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL);

if (soff_hi == eoff_hi) {
/* The whole thing fits within one access, so just one shot
Expand All @@ -263,7 +268,8 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len,
goto out;
}
soff_hi += priv->asize;
pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr);
pmc551_point(mtd, soff_hi, priv->asize, retlen,
(void **)&ptr, NULL);
}
memcpy(copyto, ptr, eoff_lo);
copyto += eoff_lo;
Expand Down Expand Up @@ -308,7 +314,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len,
soff_lo = to & (priv->asize - 1);
eoff_lo = end & (priv->asize - 1);

pmc551_point(mtd, to, len, retlen, &ptr);
pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL);

if (soff_hi == eoff_hi) {
/* The whole thing fits within one access, so just one shot
Expand All @@ -329,7 +335,8 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len,
goto out;
}
soff_hi += priv->asize;
pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr);
pmc551_point(mtd, soff_hi, priv->asize, retlen,
(void **)&ptr, NULL);
}
memcpy(ptr, copyfrom, eoff_lo);
copyfrom += eoff_lo;
Expand Down
15 changes: 10 additions & 5 deletions drivers/mtd/devices/slram.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ static char *map;
static slram_mtd_list_t *slram_mtdlist = NULL;

static int slram_erase(struct mtd_info *, struct erase_info *);
static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **);
static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t);
static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **,
resource_size_t *);
static void slram_unpoint(struct mtd_info *, loff_t, size_t);
static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);

Expand All @@ -104,19 +105,23 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
}

static int slram_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
size_t *retlen, void **virt, resource_size_t *phys)
{
slram_priv_t *priv = mtd->priv;

/* can we return a physical address with this driver? */
if (phys)
return -EINVAL;

if (from + len > mtd->size)
return -EINVAL;

*mtdbuf = priv->start + from;
*virt = priv->start + from;
*retlen = len;
return(0);
}

static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
}

Expand Down
6 changes: 4 additions & 2 deletions drivers/mtd/maps/uclinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ struct mtd_partition uclinux_romfs[] = {
/****************************************************************************/

int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
size_t *retlen, void **virt, resource_size_t *phys)
{
struct map_info *map = mtd->priv;
*mtdbuf = (u_char *) (map->virt + ((int) from));
*virt = map->virt + from;
if (phys)
*phys = map->phys + from;
*retlen = len;
return(0);
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/mtd/mtdpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len,
}

static int part_point (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **buf)
size_t *retlen, void **virt, resource_size_t *phys)
{
struct mtd_part *part = PART(mtd);
if (from >= mtd->size)
len = 0;
else if (from + len > mtd->size)
len = mtd->size - from;
return part->master->point (part->master, from + part->offset,
len, retlen, buf);
len, retlen, virt, phys);
}

static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
struct mtd_part *part = PART(mtd);

part->master->unpoint (part->master, addr, from + part->offset, len);
part->master->unpoint(part->master, from + part->offset, len);
}

static int part_read_oob(struct mtd_info *mtd, loff_t from,
Expand Down
42 changes: 21 additions & 21 deletions drivers/mtd/nand/at91_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ struct at91_nand_host {
void __iomem *ecc;
};

/*
* Enable NAND.
*/
static void at91_nand_enable(struct at91_nand_host *host)
{
if (host->board->enable_pin)
at91_set_gpio_value(host->board->enable_pin, 0);
}

/*
* Disable NAND.
*/
static void at91_nand_disable(struct at91_nand_host *host)
{
if (host->board->enable_pin)
at91_set_gpio_value(host->board->enable_pin, 1);
}

/*
* Hardware specific access to control-lines
*/
Expand All @@ -101,11 +119,11 @@ static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
struct nand_chip *nand_chip = mtd->priv;
struct at91_nand_host *host = nand_chip->priv;

if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) {
if (ctrl & NAND_CTRL_CHANGE) {
if (ctrl & NAND_NCE)
at91_set_gpio_value(host->board->enable_pin, 0);
at91_nand_enable(host);
else
at91_set_gpio_value(host->board->enable_pin, 1);
at91_nand_disable(host);
}
if (cmd == NAND_CMD_NONE)
return;
Expand All @@ -127,24 +145,6 @@ static int at91_nand_device_ready(struct mtd_info *mtd)
return at91_get_gpio_value(host->board->rdy_pin);
}

/*
* Enable NAND.
*/
static void at91_nand_enable(struct at91_nand_host *host)
{
if (host->board->enable_pin)
at91_set_gpio_value(host->board->enable_pin, 0);
}

/*
* Disable NAND.
*/
static void at91_nand_disable(struct at91_nand_host *host)
{
if (host->board->enable_pin)
at91_set_gpio_value(host->board->enable_pin, 1);
}

/*
* write oob for small pages
*/
Expand Down
Loading

0 comments on commit 2c4aabc

Please sign in to comment.