16 #include <linux/module.h>
17 #include <linux/types.h>
19 #include <linux/kernel.h>
20 #include <linux/string.h>
21 #include <linux/slab.h>
23 #include <linux/device.h>
33 #include <linux/reboot.h>
55 #ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
56 # error CONFIG_MTD_CFI_BE_BYTE_SWAP required
64 static inline void flash_write16(
u16 d,
void __iomem *addr)
69 #define BYTE0(h) ((h) & 0xFF)
70 #define BYTE1(h) (((h) >> 8) & 0xFF)
74 static inline u16 flash_read16(
const void __iomem *addr)
79 static inline void flash_write16(
u16 d,
void __iomem *addr)
84 #define BYTE0(h) (((h) >> 8) & 0xFF)
85 #define BYTE1(h) ((h) & 0xFF)
91 val.
x[0] = flash_read16(map->
virt + ofs);
100 static void ixp4xx_copy_from(
struct map_info *
map,
void *to,
110 *dest++ =
BYTE1(flash_read16(src-1));
117 *dest++ =
BYTE0(data);
118 *dest++ =
BYTE1(data);
124 *dest++ =
BYTE0(flash_read16(src));
131 static void ixp4xx_probe_write16(
struct map_info *map,
map_word d,
unsigned long adr)
134 flash_write16(d.
x[0], map->
virt + adr);
140 static void ixp4xx_write16(
struct map_info *map,
map_word d,
unsigned long adr)
142 flash_write16(d.
x[0], map->
virt + adr);
151 static const char *probes[] = {
"RedBoot",
"cmdlinepart",
NULL };
158 platform_set_drvdata(dev,
NULL);
205 platform_set_drvdata(dev, info);
219 info->
map.bankwidth = 2;
220 info->
map.name = dev_name(&dev->
dev);
221 info->
map.read = ixp4xx_read16;
222 info->
map.write = ixp4xx_probe_write16;
223 info->
map.copy_from = ixp4xx_copy_from;
229 printk(
KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
236 if (!info->
map.virt) {
251 info->
map.write = ixp4xx_write16;
263 ixp4xx_flash_remove(dev);
268 .probe = ixp4xx_flash_probe,
269 .remove = ixp4xx_flash_remove,
271 .name =
"IXP4XX-Flash",