X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fmaps%2Fpcmciamtd.c;h=4453a2707b90fcff81330928277cc70370e93160;hb=5e3b93f248c98873cc843e83092bb8da92ac85a2;hp=ec63e3b6fa6855b7126dc55ba492b6b0221d0528;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index ec63e3b6f..4453a2707 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -1,5 +1,5 @@ /* - * $Id: pcmciamtd.c,v 1.51 2004/07/12 22:38:29 dwmw2 Exp $ + * $Id: pcmciamtd.c,v 1.48 2003/06/24 07:14:38 spse Exp $ * * pcmciamtd.c - MTD driver for PCMCIA flash memory cards * @@ -49,7 +49,7 @@ static const int debug = 0; #define DRIVER_DESC "PCMCIA Flash memory card driver" -#define DRIVER_VERSION "$Revision: 1.51 $" +#define DRIVER_VERSION "$Revision: 1.48 $" /* Size of the PCMCIA address space: 26 bits = 64 MB */ #define MAX_PCMCIA_ADDR 0x4000000 @@ -73,7 +73,7 @@ static dev_link_t *dev_list; /* Module parameters */ /* 2 = do 16-bit transfers, 1 = do 8-bit transfers */ -static int bankwidth = 2; +static int buswidth = 2; /* Speed of memory accesses, in ns */ static int mem_speed; @@ -93,8 +93,8 @@ static int mem_type; MODULE_LICENSE("GPL"); MODULE_AUTHOR("Simon Evans "); MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_PARM(bankwidth, "i"); -MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); +MODULE_PARM(buswidth, "i"); +MODULE_PARM_DESC(buswidth, "Set buswidth (1=8 bit, 2=16 bit, default=2)"); MODULE_PARM(mem_speed, "i"); MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); MODULE_PARM(force_size, "i"); @@ -135,32 +135,32 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) } -static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs) +static u8 pcmcia_read8_remap(struct map_info *map, unsigned long ofs) { caddr_t addr; - map_word d = {{0}}; + u8 d; addr = remap_window(map, ofs); if(!addr) - return d; + return 0; - d.x[0] = readb(addr); - DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02x", ofs, addr, d.x[0]); + d = readb(addr); + DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02x", ofs, addr, d); return d; } -static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs) +static u16 pcmcia_read16_remap(struct map_info *map, unsigned long ofs) { caddr_t addr; - map_word d = {{0}}; + u16 d; addr = remap_window(map, ofs); if(!addr) - return d; + return 0; - d.x[0] = readw(addr); - DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04x", ofs, addr, d.x[0]); + d = readw(addr); + DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04x", ofs, addr, d); return d; } @@ -191,26 +191,26 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long } -static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr) +static void pcmcia_write8_remap(struct map_info *map, u8 d, unsigned long adr) { caddr_t addr = remap_window(map, adr); if(!addr) return; - DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02x", adr, addr, d.x[0]); - writeb(d.x[0], addr); + DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02x", adr, addr, d); + writeb(d, addr); } -static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr) +static void pcmcia_write16_remap(struct map_info *map, u16 d, unsigned long adr) { caddr_t addr = remap_window(map, adr); if(!addr) return; - DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04x", adr, addr, d.x[0]); - writew(d.x[0], addr); + DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04x", adr, addr, d); + writew(d, addr); } @@ -244,30 +244,30 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v #define DEV_REMOVED(x) (!(*(u_int *)x->map_priv_1 & DEV_PRESENT)) -static map_word pcmcia_read8(struct map_info *map, unsigned long ofs) +static u8 pcmcia_read8(struct map_info *map, unsigned long ofs) { caddr_t win_base = (caddr_t)map->map_priv_2; - map_word d = {{0}}; + u8 d; if(DEV_REMOVED(map)) - return d; + return 0; - d.x[0] = readb(win_base + ofs); - DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02x", ofs, win_base + ofs, d.x[0]); + d = readb(win_base + ofs); + DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02x", ofs, win_base + ofs, d); return d; } -static map_word pcmcia_read16(struct map_info *map, unsigned long ofs) +static u16 pcmcia_read16(struct map_info *map, unsigned long ofs) { caddr_t win_base = (caddr_t)map->map_priv_2; - map_word d = {{0}}; + u16 d; if(DEV_REMOVED(map)) - return d; + return 0; - d.x[0] = readw(win_base + ofs); - DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04x", ofs, win_base + ofs, d.x[0]); + d = readw(win_base + ofs); + DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04x", ofs, win_base + ofs, d); return d; } @@ -439,9 +439,9 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ case CISTPL_DEVICE_GEO: { cistpl_device_geo_t *t = &parse.device_geo; int i; - dev->pcmcia_map.bankwidth = t->geo[0].buswidth; + dev->pcmcia_map.buswidth = t->geo[0].buswidth; for(i = 0; i < t->ngeo; i++) { - DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); + DEBUG(2, "region: %d buswidth = %u", i, t->geo[i].buswidth); DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block); @@ -460,17 +460,17 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ if(!dev->pcmcia_map.size) dev->pcmcia_map.size = MAX_PCMCIA_ADDR; - if(!dev->pcmcia_map.bankwidth) - dev->pcmcia_map.bankwidth = 2; + if(!dev->pcmcia_map.buswidth) + dev->pcmcia_map.buswidth = 2; if(force_size) { dev->pcmcia_map.size = force_size << 20; DEBUG(2, "size forced to %dM", force_size); } - if(bankwidth) { - dev->pcmcia_map.bankwidth = bankwidth; - DEBUG(2, "bankwidth forced to %d", bankwidth); + if(buswidth) { + dev->pcmcia_map.buswidth = buswidth; + DEBUG(2, "buswidth forced to %d", buswidth); } dev->pcmcia_map.name = dev->mtd_name; @@ -480,7 +480,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ } DEBUG(1, "Device: Size: %lu Width:%d Name: %s", - dev->pcmcia_map.size, dev->pcmcia_map.bankwidth << 3, dev->mtd_name); + dev->pcmcia_map.size, dev->pcmcia_map.buswidth << 3, dev->mtd_name); } @@ -522,15 +522,12 @@ static void pcmciamtd_config(dev_link_t *link) card_settings(dev, link, &new_name); dev->pcmcia_map.phys = NO_XIP; + dev->pcmcia_map.read8 = pcmcia_read8_remap; + dev->pcmcia_map.read16 = pcmcia_read16_remap; dev->pcmcia_map.copy_from = pcmcia_copy_from_remap; + dev->pcmcia_map.write8 = pcmcia_write8_remap; + dev->pcmcia_map.write16 = pcmcia_write16_remap; dev->pcmcia_map.copy_to = pcmcia_copy_to_remap; - if (dev->pcmcia_map.bankwidth == 1) { - dev->pcmcia_map.read = pcmcia_read8_remap; - dev->pcmcia_map.write = pcmcia_write8_remap; - } else { - dev->pcmcia_map.read = pcmcia_read16_remap; - dev->pcmcia_map.write = pcmcia_write16_remap; - } if(setvpp == 1) dev->pcmcia_map.set_vpp = pcmciamtd_set_vpp; @@ -539,7 +536,7 @@ static void pcmciamtd_config(dev_link_t *link) whole card - otherwise we try smaller windows until we succeed */ req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; - req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; + req.Attributes |= (dev->pcmcia_map.buswidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; req.Base = 0; req.AccessSpeed = mem_speed; link->win = (window_handle_t)link->handle; @@ -660,14 +657,11 @@ static void pcmciamtd_config(dev_link_t *link) DEBUG(1, "Using non remapping memory functions"); dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->link.state); dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; - if (dev->pcmcia_map.bankwidth == 1) { - dev->pcmcia_map.read = pcmcia_read8; - dev->pcmcia_map.write = pcmcia_write8; - } else { - dev->pcmcia_map.read = pcmcia_read16; - dev->pcmcia_map.write = pcmcia_write16; - } + dev->pcmcia_map.read8 = pcmcia_read8; + dev->pcmcia_map.read16 = pcmcia_read16; dev->pcmcia_map.copy_from = pcmcia_copy_from; + dev->pcmcia_map.write8 = pcmcia_write8; + dev->pcmcia_map.write16 = pcmcia_write16; dev->pcmcia_map.copy_to = pcmcia_copy_to; } @@ -834,9 +828,9 @@ static int __init init_pcmciamtd(void) { info(DRIVER_DESC " " DRIVER_VERSION); - if(bankwidth && bankwidth != 1 && bankwidth != 2) { - info("bad bankwidth (%d), using default", bankwidth); - bankwidth = 2; + if(buswidth && buswidth != 1 && buswidth != 2) { + info("bad buswidth (%d), using default", buswidth); + buswidth = 2; } if(force_size && (force_size < 1 || force_size > 64)) { info("bad force_size (%d), using default", force_size);