Commit e98403d7 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Fix up and annotate MTD map usage of PCI memory access

parent 48eed47a
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
struct amd76xrom_map_info { struct amd76xrom_map_info {
struct map_info map; struct map_info map;
struct mtd_info *mtd; struct mtd_info *mtd;
unsigned long window_addr; void __iomem * window_addr;
u32 window_start, window_size; u32 window_start, window_size;
struct pci_dev *pdev; struct pci_dev *pdev;
struct resource window_rsrc; struct resource window_rsrc;
...@@ -57,7 +57,7 @@ static void amd76xrom_cleanup(struct amd76xrom_map_info *info) ...@@ -57,7 +57,7 @@ static void amd76xrom_cleanup(struct amd76xrom_map_info *info)
del_mtd_device(info->mtd); del_mtd_device(info->mtd);
map_destroy(info->mtd); map_destroy(info->mtd);
info->mtd = NULL; info->mtd = NULL;
info->map.virt = 0; info->map.virt = NULL;
} }
if (info->rom_rsrc.parent) if (info->rom_rsrc.parent)
release_resource(&info->rom_rsrc); release_resource(&info->rom_rsrc);
...@@ -65,8 +65,8 @@ static void amd76xrom_cleanup(struct amd76xrom_map_info *info) ...@@ -65,8 +65,8 @@ static void amd76xrom_cleanup(struct amd76xrom_map_info *info)
release_resource(&info->window_rsrc); release_resource(&info->window_rsrc);
if (info->window_addr) { if (info->window_addr) {
iounmap((void *)(info->window_addr)); iounmap(info->window_addr);
info->window_addr = 0; info->window_addr = NULL;
} }
} }
...@@ -136,8 +136,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, ...@@ -136,8 +136,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
printk(KERN_NOTICE MOD_NAME " window : %x at %x\n", printk(KERN_NOTICE MOD_NAME " window : %x at %x\n",
window->size, window->start); window->size, window->start);
/* For write accesses caches are useless */ /* For write accesses caches are useless */
info->window_addr = info->window_addr = ioremap_nocache(window->start,
(unsigned long)ioremap_nocache(window->start,
window->size); window->size);
if (!info->window_addr) { if (!info->window_addr) {
...@@ -163,8 +162,8 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, ...@@ -163,8 +162,8 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
} }
if (info->mtd) goto found_mtd; if (info->mtd) goto found_mtd;
} }
iounmap((void *)(info->window_addr)); iounmap(info->window_addr);
info->window_addr = 0; info->window_addr = NULL;
/* Disable writes through the rom window */ /* Disable writes through the rom window */
pci_read_config_byte(pdev, 0x40, &byte); pci_read_config_byte(pdev, 0x40, &byte);
......
...@@ -103,7 +103,7 @@ struct clps_info { ...@@ -103,7 +103,7 @@ struct clps_info {
unsigned long base; unsigned long base;
unsigned long size; unsigned long size;
int width; int width;
void *vbase; void __iomem *vbase;
struct map_info *map; struct map_info *map;
struct mtd_info *mtd; struct mtd_info *mtd;
struct resource *res; struct resource *res;
...@@ -150,7 +150,7 @@ static int __init clps_setup_mtd(struct clps_info *clps, int nr, struct mtd_info ...@@ -150,7 +150,7 @@ static int __init clps_setup_mtd(struct clps_info *clps, int nr, struct mtd_info
break; break;
} }
clps[i].map->virt = (unsigned long)clps[i].vbase; clps[i].map->virt = clps[i].vbase;
clps[i].map->bankwidth = clps[i].width; clps[i].map->bankwidth = clps[i].width;
clps[i].map->size = clps[i].size; clps[i].map->size = clps[i].size;
......
...@@ -885,7 +885,7 @@ struct sa_info { ...@@ -885,7 +885,7 @@ struct sa_info {
unsigned long base; unsigned long base;
unsigned long size; unsigned long size;
int width; int width;
void *vbase; void __iomem *vbase;
void (*set_vpp)(struct map_info *, int); void (*set_vpp)(struct map_info *, int);
struct map_info *map; struct map_info *map;
struct mtd_info *mtd; struct mtd_info *mtd;
...@@ -932,7 +932,7 @@ static int __init sa1100_setup_mtd(struct sa_info *sa, int nr, struct mtd_info * ...@@ -932,7 +932,7 @@ static int __init sa1100_setup_mtd(struct sa_info *sa, int nr, struct mtd_info *
break; break;
} }
sa[i].map->virt = (unsigned long)sa[i].vbase; sa[i].map->virt = sa[i].vbase;
sa[i].map->phys = sa[i].base; sa[i].map->phys = sa[i].base;
sa[i].map->set_vpp = sa[i].set_vpp; sa[i].map->set_vpp = sa[i].set_vpp;
sa[i].map->bankwidth = sa[i].width; sa[i].map->bankwidth = sa[i].width;
......
...@@ -50,7 +50,7 @@ static struct mtd_info* mtd_banks[FLASH_BANK_MAX]; ...@@ -50,7 +50,7 @@ static struct mtd_info* mtd_banks[FLASH_BANK_MAX];
static struct map_info* map_banks[FLASH_BANK_MAX]; static struct map_info* map_banks[FLASH_BANK_MAX];
static struct mtd_part_def part_banks[FLASH_BANK_MAX]; static struct mtd_part_def part_banks[FLASH_BANK_MAX];
static unsigned long num_banks; static unsigned long num_banks;
static unsigned long start_scan_addr; static void __iomem *start_scan_addr;
/* /*
* Here are partition information for all known TQM8xxL series devices. * Here are partition information for all known TQM8xxL series devices.
...@@ -121,7 +121,7 @@ int __init init_tqm_mtd(void) ...@@ -121,7 +121,7 @@ int __init init_tqm_mtd(void)
flash_size = bd->bi_flashsize; flash_size = bd->bi_flashsize;
//request maximum flash size address space //request maximum flash size address space
start_scan_addr = (unsigned long)ioremap(flash_addr, flash_size); start_scan_addr = ioremap(flash_addr, flash_size);
if (!start_scan_addr) { if (!start_scan_addr) {
printk(KERN_WARNING "%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr); printk(KERN_WARNING "%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr);
return -EIO; return -EIO;
...@@ -231,7 +231,7 @@ int __init init_tqm_mtd(void) ...@@ -231,7 +231,7 @@ int __init init_tqm_mtd(void)
} }
} }
error: error:
iounmap((void *)start_scan_addr); iounmap(start_scan_addr);
return ret; return ret;
} }
...@@ -250,7 +250,7 @@ static void __exit cleanup_tqm_mtd(void) ...@@ -250,7 +250,7 @@ static void __exit cleanup_tqm_mtd(void)
} }
if (start_scan_addr) { if (start_scan_addr) {
iounmap((void *)start_scan_addr); iounmap(start_scan_addr);
start_scan_addr = 0; start_scan_addr = 0;
} }
} }
......
...@@ -69,10 +69,9 @@ int __init uclinux_mtd_init(void) ...@@ -69,10 +69,9 @@ int __init uclinux_mtd_init(void)
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
(int) mapp->map_priv_2, (int) mapp->size); (int) mapp->map_priv_2, (int) mapp->size);
mapp->virt = (unsigned long) mapp->virt = ioremap_nocache(mapp->phys, mapp->size);
ioremap_nocache(mapp->phys, mapp->size);
if (mapp->virt == 0) { if (!mapp->virt) {
printk("uclinux[mtd]: ioremap_nocache() failed\n"); printk("uclinux[mtd]: ioremap_nocache() failed\n");
return(-EIO); return(-EIO);
} }
...@@ -82,7 +81,7 @@ int __init uclinux_mtd_init(void) ...@@ -82,7 +81,7 @@ int __init uclinux_mtd_init(void)
mtd = do_map_probe("map_ram", mapp); mtd = do_map_probe("map_ram", mapp);
if (!mtd) { if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n"); printk("uclinux[mtd]: failed to find a mapping?\n");
iounmap((void *) mapp->virt); iounmap(mapp->virt);
return(-ENXIO); return(-ENXIO);
} }
......
...@@ -179,7 +179,7 @@ struct map_info { ...@@ -179,7 +179,7 @@ struct map_info {
unsigned long phys; unsigned long phys;
#define NO_XIP (-1UL) #define NO_XIP (-1UL)
unsigned long virt; void __iomem *virt;
void *cached; void *cached;
int bankwidth; /* in octets. This isn't necessarily the width int bankwidth; /* in octets. This isn't necessarily the width
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment