aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/ixp2000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/ixp2000.c')
-rw-r--r--drivers/mtd/maps/ixp2000.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 00b9f67580f1..641eb2b55e9f 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ixp2000.c,v 1.6 2005/03/18 14:07:46 gleixner Exp $ 2 * $Id: ixp2000.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/ixp2000.c 4 * drivers/mtd/maps/ixp2000.c
5 * 5 *
@@ -14,7 +14,7 @@
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 * 17 *
18 */ 18 */
19 19
20#include <linux/module.h> 20#include <linux/module.h>
@@ -46,8 +46,8 @@ struct ixp2000_flash_info {
46}; 46};
47 47
48static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) 48static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs)
49{ 49{
50 unsigned long (*set_bank)(unsigned long) = 50 unsigned long (*set_bank)(unsigned long) =
51 (unsigned long(*)(unsigned long))map->map_priv_2; 51 (unsigned long(*)(unsigned long))map->map_priv_2;
52 52
53 return (set_bank ? set_bank(ofs) : ofs); 53 return (set_bank ? set_bank(ofs) : ofs);
@@ -55,8 +55,8 @@ static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long
55 55
56#ifdef __ARMEB__ 56#ifdef __ARMEB__
57/* 57/*
58 * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which 58 * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which
59 * causes the lower address bits to be XORed with 0x11 on 8 bit accesses 59 * causes the lower address bits to be XORed with 0x11 on 8 bit accesses
60 * and XORed with 0x10 on 16 bit accesses. See the spec update, erratum 44. 60 * and XORed with 0x10 on 16 bit accesses. See the spec update, erratum 44.
61 */ 61 */
62static int erratum44_workaround = 0; 62static int erratum44_workaround = 0;
@@ -90,7 +90,7 @@ static void ixp2000_flash_copy_from(struct map_info *map, void *to,
90 unsigned long from, ssize_t len) 90 unsigned long from, ssize_t len)
91{ 91{
92 from = flash_bank_setup(map, from); 92 from = flash_bank_setup(map, from);
93 while(len--) 93 while(len--)
94 *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++); 94 *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++);
95} 95}
96 96
@@ -129,8 +129,7 @@ static int ixp2000_flash_remove(struct device *_dev)
129 if (info->map.map_priv_1) 129 if (info->map.map_priv_1)
130 iounmap((void *) info->map.map_priv_1); 130 iounmap((void *) info->map.map_priv_1);
131 131
132 if (info->partitions) { 132 kfree(info->partitions);
133 kfree(info->partitions); }
134 133
135 if (info->res) { 134 if (info->res) {
136 release_resource(info->res); 135 release_resource(info->res);
@@ -149,11 +148,11 @@ static int ixp2000_flash_probe(struct device *_dev)
149 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 148 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
150 struct platform_device *dev = to_platform_device(_dev); 149 struct platform_device *dev = to_platform_device(_dev);
151 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; 150 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data;
152 struct flash_platform_data *plat; 151 struct flash_platform_data *plat;
153 struct ixp2000_flash_info *info; 152 struct ixp2000_flash_info *info;
154 unsigned long window_size; 153 unsigned long window_size;
155 int err = -1; 154 int err = -1;
156 155
157 if (!ixp_data) 156 if (!ixp_data)
158 return -ENODEV; 157 return -ENODEV;
159 158
@@ -162,7 +161,7 @@ static int ixp2000_flash_probe(struct device *_dev)
162 return -ENODEV; 161 return -ENODEV;
163 162
164 window_size = dev->resource->end - dev->resource->start + 1; 163 window_size = dev->resource->end - dev->resource->start + 1;
165 dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", 164 dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n",
166 ixp_data->nr_banks, ((u32)window_size >> 20)); 165 ixp_data->nr_banks, ((u32)window_size >> 20));
167 166
168 if (plat->width != 1) { 167 if (plat->width != 1) {
@@ -175,7 +174,7 @@ static int ixp2000_flash_probe(struct device *_dev)
175 if(!info) { 174 if(!info) {
176 err = -ENOMEM; 175 err = -ENOMEM;
177 goto Error; 176 goto Error;
178 } 177 }
179 memzero(info, sizeof(struct ixp2000_flash_info)); 178 memzero(info, sizeof(struct ixp2000_flash_info));
180 179
181 dev_set_drvdata(&dev->dev, info); 180 dev_set_drvdata(&dev->dev, info);
@@ -185,7 +184,7 @@ static int ixp2000_flash_probe(struct device *_dev)
185 * not attempt to do a direct access on us. 184 * not attempt to do a direct access on us.
186 */ 185 */
187 info->map.phys = NO_XIP; 186 info->map.phys = NO_XIP;
188 187
189 info->nr_banks = ixp_data->nr_banks; 188 info->nr_banks = ixp_data->nr_banks;
190 info->map.size = ixp_data->nr_banks * window_size; 189 info->map.size = ixp_data->nr_banks * window_size;
191 info->map.bankwidth = 1; 190 info->map.bankwidth = 1;
@@ -193,7 +192,7 @@ static int ixp2000_flash_probe(struct device *_dev)
193 /* 192 /*
194 * map_priv_2 is used to store a ptr to to the bank_setup routine 193 * map_priv_2 is used to store a ptr to to the bank_setup routine
195 */ 194 */
196 info->map.map_priv_2 = (void __iomem *) ixp_data->bank_setup; 195 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup;
197 196
198 info->map.name = dev->dev.bus_id; 197 info->map.name = dev->dev.bus_id;
199 info->map.read = ixp2000_flash_read8; 198 info->map.read = ixp2000_flash_read8;
@@ -201,8 +200,8 @@ static int ixp2000_flash_probe(struct device *_dev)
201 info->map.copy_from = ixp2000_flash_copy_from; 200 info->map.copy_from = ixp2000_flash_copy_from;
202 info->map.copy_to = ixp2000_flash_copy_to; 201 info->map.copy_to = ixp2000_flash_copy_to;
203 202
204 info->res = request_mem_region(dev->resource->start, 203 info->res = request_mem_region(dev->resource->start,
205 dev->resource->end - dev->resource->start + 1, 204 dev->resource->end - dev->resource->start + 1,
206 dev->dev.bus_id); 205 dev->dev.bus_id);
207 if (!info->res) { 206 if (!info->res) {
208 dev_err(_dev, "Could not reserve memory region\n"); 207 dev_err(_dev, "Could not reserve memory region\n");
@@ -210,7 +209,7 @@ static int ixp2000_flash_probe(struct device *_dev)
210 goto Error; 209 goto Error;
211 } 210 }
212 211
213 info->map.map_priv_1 = ioremap(dev->resource->start, 212 info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start,
214 dev->resource->end - dev->resource->start + 1); 213 dev->resource->end - dev->resource->start + 1);
215 if (!info->map.map_priv_1) { 214 if (!info->map.map_priv_1) {
216 dev_err(_dev, "Failed to ioremap flash region\n"); 215 dev_err(_dev, "Failed to ioremap flash region\n");