aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/maps/ixp4xx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:24:08 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:24:08 -0800
commitb3ce1debe2685383a9ad6ace9c49869c3968c013 (patch)
treedcb606fac467d6ce78a9c608a1e0d2323af44f2b /drivers/mtd/maps/ixp4xx.c
parent5b2f7ffcb734d3046144dfbd5ac6d76254a9e522 (diff)
parentc2965f1129ee54afcc4ef293ff0f25fa3a7e7392 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6
Some manual fixups for clashing kfree() cleanups etc.
Diffstat (limited to 'drivers/mtd/maps/ixp4xx.c')
-rw-r--r--drivers/mtd/maps/ixp4xx.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 0d87c02dee0..56b3a355bf7 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -1,5 +1,5 @@
/*
- * $Id: ixp4xx.c,v 1.7 2004/11/04 13:24:15 gleixner Exp $
+ * $Id: ixp4xx.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $
*
* drivers/mtd/maps/ixp4xx.c
*
@@ -45,7 +45,7 @@
static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
{
map_word val;
- val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
+ val.x[0] = le16_to_cpu(readw(map->virt + ofs));
return val;
}
@@ -59,35 +59,35 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
{
int i;
u8 *dest = (u8 *) to;
- u16 *src = (u16 *) (map->map_priv_1 + from);
+ void __iomem *src = map->virt + from;
u16 data;
for (i = 0; i < (len / 2); i++) {
- data = src[i];
+ data = le16_to_cpu(readw(src + 2*i));
dest[i * 2] = BYTE0(data);
dest[i * 2 + 1] = BYTE1(data);
}
if (len & 1)
- dest[len - 1] = BYTE0(src[i]);
+ dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i)));
}
-/*
+/*
* Unaligned writes are ignored, causing the 8-bit
* probe to fail and proceed to the 16-bit probe (which succeeds).
*/
static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
{
if (!(adr & 1))
- *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
+ writew(cpu_to_le16(d.x[0]), map->virt + adr);
}
-/*
+/*
* Fast write16 function without the probing check above
*/
static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
{
- *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
+ writew(cpu_to_le16(d.x[0]), map->virt + adr);
}
struct ixp4xx_flash_info {
@@ -104,25 +104,18 @@ static int ixp4xx_flash_remove(struct device *_dev)
struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
- map_word d;
dev_set_drvdata(&dev->dev, NULL);
if(!info)
return 0;
- /*
- * This is required for a soft reboot to work.
- */
- d.x[0] = 0xff;
- ixp4xx_write16(&info->map, d, 0x55 * 0x2);
-
if (info->mtd) {
del_mtd_partitions(info->mtd);
map_destroy(info->mtd);
}
- if (info->map.map_priv_1)
- iounmap((void *) info->map.map_priv_1);
+ if (info->map.virt)
+ iounmap(info->map.virt);
kfree(info->partitions);
@@ -134,9 +127,6 @@ static int ixp4xx_flash_remove(struct device *_dev)
if (plat->exit)
plat->exit();
- /* Disable flash write */
- *IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
-
return 0;
}
@@ -160,17 +150,11 @@ static int ixp4xx_flash_probe(struct device *_dev)
if(!info) {
err = -ENOMEM;
goto Error;
- }
+ }
memzero(info, sizeof(struct ixp4xx_flash_info));
dev_set_drvdata(&dev->dev, info);
- /*
- * Enable flash write
- * TODO: Move this out to board specific code
- */
- *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
-
/*
* Tell the MTD layer we're not 1:1 mapped so that it does
* not attempt to do a direct access on us.
@@ -189,8 +173,8 @@ static int ixp4xx_flash_probe(struct device *_dev)
info->map.write = ixp4xx_probe_write16,
info->map.copy_from = ixp4xx_copy_from,
- info->res = request_mem_region(dev->resource->start,
- dev->resource->end - dev->resource->start + 1,
+ info->res = request_mem_region(dev->resource->start,
+ dev->resource->end - dev->resource->start + 1,
"IXP4XXFlash");
if (!info->res) {
printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
@@ -198,9 +182,9 @@ static int ixp4xx_flash_probe(struct device *_dev)
goto Error;
}
- info->map.map_priv_1 = ioremap(dev->resource->start,
- dev->resource->end - dev->resource->start + 1);
- if (!info->map.map_priv_1) {
+ info->map.virt = ioremap(dev->resource->start,
+ dev->resource->end - dev->resource->start + 1);
+ if (!info->map.virt) {
printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
err = -EIO;
goto Error;
@@ -213,7 +197,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
goto Error;
}
info->mtd->owner = THIS_MODULE;
-
+
/* Use the fast version */
info->map.write = ixp4xx_write16,
@@ -258,4 +242,3 @@ module_exit(ixp4xx_flash_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
MODULE_AUTHOR("Deepak Saxena");
-