diff options
Diffstat (limited to 'drivers/mtd/maps/ixp4xx.c')
| -rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index e0a5e0426ead..1f9fde0dad35 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
| @@ -118,7 +118,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, | |||
| 118 | *dest++ = BYTE1(data); | 118 | *dest++ = BYTE1(data); |
| 119 | src += 2; | 119 | src += 2; |
| 120 | len -= 2; | 120 | len -= 2; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | if (len > 0) | 123 | if (len > 0) |
| 124 | *dest++ = BYTE0(flash_read16(src)); | 124 | *dest++ = BYTE0(flash_read16(src)); |
| @@ -185,6 +185,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
| 185 | { | 185 | { |
| 186 | struct flash_platform_data *plat = dev->dev.platform_data; | 186 | struct flash_platform_data *plat = dev->dev.platform_data; |
| 187 | struct ixp4xx_flash_info *info; | 187 | struct ixp4xx_flash_info *info; |
| 188 | const char *part_type = NULL; | ||
| 189 | int nr_parts = 0; | ||
| 188 | int err = -1; | 190 | int err = -1; |
| 189 | 191 | ||
| 190 | if (!plat) | 192 | if (!plat) |
| @@ -218,9 +220,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
| 218 | */ | 220 | */ |
| 219 | info->map.bankwidth = 2; | 221 | info->map.bankwidth = 2; |
| 220 | info->map.name = dev_name(&dev->dev); | 222 | info->map.name = dev_name(&dev->dev); |
| 221 | info->map.read = ixp4xx_read16, | 223 | info->map.read = ixp4xx_read16; |
| 222 | info->map.write = ixp4xx_probe_write16, | 224 | info->map.write = ixp4xx_probe_write16; |
| 223 | info->map.copy_from = ixp4xx_copy_from, | 225 | info->map.copy_from = ixp4xx_copy_from; |
| 224 | 226 | ||
| 225 | info->res = request_mem_region(dev->resource->start, | 227 | info->res = request_mem_region(dev->resource->start, |
| 226 | resource_size(dev->resource), | 228 | resource_size(dev->resource), |
| @@ -248,11 +250,28 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
| 248 | info->mtd->owner = THIS_MODULE; | 250 | info->mtd->owner = THIS_MODULE; |
| 249 | 251 | ||
| 250 | /* Use the fast version */ | 252 | /* Use the fast version */ |
| 251 | info->map.write = ixp4xx_write16, | 253 | info->map.write = ixp4xx_write16; |
| 254 | |||
| 255 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 256 | nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, | ||
| 257 | dev->resource->start); | ||
| 258 | #endif | ||
| 259 | if (nr_parts > 0) { | ||
| 260 | part_type = "dynamic"; | ||
| 261 | } else { | ||
| 262 | info->partitions = plat->parts; | ||
| 263 | nr_parts = plat->nr_parts; | ||
| 264 | part_type = "static"; | ||
| 265 | } | ||
| 266 | if (nr_parts == 0) { | ||
| 267 | printk(KERN_NOTICE "IXP4xx flash: no partition info " | ||
| 268 | "available, registering whole flash\n"); | ||
| 269 | err = add_mtd_device(info->mtd); | ||
| 270 | } else { | ||
| 271 | printk(KERN_NOTICE "IXP4xx flash: using %s partition " | ||
| 272 | "definition\n", part_type); | ||
| 273 | err = add_mtd_partitions(info->mtd, info->partitions, nr_parts); | ||
| 252 | 274 | ||
| 253 | err = parse_mtd_partitions(info->mtd, probes, &info->partitions, dev->resource->start); | ||
| 254 | if (err > 0) { | ||
| 255 | err = add_mtd_partitions(info->mtd, info->partitions, err); | ||
| 256 | if(err) | 275 | if(err) |
| 257 | printk(KERN_ERR "Could not parse partitions\n"); | 276 | printk(KERN_ERR "Could not parse partitions\n"); |
| 258 | } | 277 | } |
