diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 58b477043f2e..c510c736ed97 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ixp4xx.c,v 1.8 2005/09/08 10:32:20 dvrabel Exp $ | 2 | * $Id: ixp4xx.c,v 1.11 2005/11/06 11:15:51 gleixner Exp $ |
3 | * | 3 | * |
4 | * drivers/mtd/maps/ixp4xx.c | 4 | * drivers/mtd/maps/ixp4xx.c |
5 | * | 5 | * |
@@ -45,7 +45,7 @@ | |||
45 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) | 45 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) |
46 | { | 46 | { |
47 | map_word val; | 47 | map_word val; |
48 | val.x[0] = *(__u16 *) (map->map_priv_1 + ofs); | 48 | val.x[0] = le16_to_cpu(readw(map->virt + ofs)); |
49 | return val; | 49 | return val; |
50 | } | 50 | } |
51 | 51 | ||
@@ -59,17 +59,17 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, | |||
59 | { | 59 | { |
60 | int i; | 60 | int i; |
61 | u8 *dest = (u8 *) to; | 61 | u8 *dest = (u8 *) to; |
62 | u16 *src = (u16 *) (map->map_priv_1 + from); | 62 | void __iomem *src = map->virt + from; |
63 | u16 data; | 63 | u16 data; |
64 | 64 | ||
65 | for (i = 0; i < (len / 2); i++) { | 65 | for (i = 0; i < (len / 2); i++) { |
66 | data = src[i]; | 66 | data = le16_to_cpu(readw(src + 2*i)); |
67 | dest[i * 2] = BYTE0(data); | 67 | dest[i * 2] = BYTE0(data); |
68 | dest[i * 2 + 1] = BYTE1(data); | 68 | dest[i * 2 + 1] = BYTE1(data); |
69 | } | 69 | } |
70 | 70 | ||
71 | if (len & 1) | 71 | if (len & 1) |
72 | dest[len - 1] = BYTE0(src[i]); | 72 | dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i))); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* | 75 | /* |
@@ -79,7 +79,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, | |||
79 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) | 79 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) |
80 | { | 80 | { |
81 | if (!(adr & 1)) | 81 | if (!(adr & 1)) |
82 | *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; | 82 | writew(cpu_to_le16(d.x[0]), map->virt + adr); |
83 | } | 83 | } |
84 | 84 | ||
85 | /* | 85 | /* |
@@ -87,7 +87,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long | |||
87 | */ | 87 | */ |
88 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | 88 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) |
89 | { | 89 | { |
90 | *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; | 90 | writew(cpu_to_le16(d.x[0]), map->virt + adr); |
91 | } | 91 | } |
92 | 92 | ||
93 | struct ixp4xx_flash_info { | 93 | struct ixp4xx_flash_info { |
@@ -104,7 +104,6 @@ static int ixp4xx_flash_remove(struct device *_dev) | |||
104 | struct platform_device *dev = to_platform_device(_dev); | 104 | struct platform_device *dev = to_platform_device(_dev); |
105 | struct flash_platform_data *plat = dev->dev.platform_data; | 105 | struct flash_platform_data *plat = dev->dev.platform_data; |
106 | struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); | 106 | struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); |
107 | map_word d; | ||
108 | 107 | ||
109 | dev_set_drvdata(&dev->dev, NULL); | 108 | dev_set_drvdata(&dev->dev, NULL); |
110 | 109 | ||
@@ -115,8 +114,8 @@ static int ixp4xx_flash_remove(struct device *_dev) | |||
115 | del_mtd_partitions(info->mtd); | 114 | del_mtd_partitions(info->mtd); |
116 | map_destroy(info->mtd); | 115 | map_destroy(info->mtd); |
117 | } | 116 | } |
118 | if (info->map.map_priv_1) | 117 | if (info->map.virt) |
119 | iounmap((void *) info->map.map_priv_1); | 118 | iounmap(info->map.virt); |
120 | 119 | ||
121 | if (info->partitions) | 120 | if (info->partitions) |
122 | kfree(info->partitions); | 121 | kfree(info->partitions); |
@@ -184,9 +183,9 @@ static int ixp4xx_flash_probe(struct device *_dev) | |||
184 | goto Error; | 183 | goto Error; |
185 | } | 184 | } |
186 | 185 | ||
187 | info->map.map_priv_1 = ioremap(dev->resource->start, | 186 | info->map.virt = ioremap(dev->resource->start, |
188 | dev->resource->end - dev->resource->start + 1); | 187 | dev->resource->end - dev->resource->start + 1); |
189 | if (!info->map.map_priv_1) { | 188 | if (!info->map.virt) { |
190 | printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); | 189 | printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); |
191 | err = -EIO; | 190 | err = -EIO; |
192 | goto Error; | 191 | goto Error; |
@@ -244,4 +243,3 @@ module_exit(ixp4xx_flash_exit); | |||
244 | MODULE_LICENSE("GPL"); | 243 | MODULE_LICENSE("GPL"); |
245 | MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); | 244 | MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); |
246 | MODULE_AUTHOR("Deepak Saxena"); | 245 | MODULE_AUTHOR("Deepak Saxena"); |
247 | |||