Commit 176f65f3 authored by Al Viro's avatar Al Viro Committed by Jeff Garzik

ni52: switch to ioremap()

isa_bus_to_virt() is the wrong thing to do here; it happens
to work on i386, but only by accident.  What we want is
normal ioremap/readb/etc. set - it's all in iomem.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 76af5699
...@@ -320,7 +320,10 @@ static int check586(struct net_device *dev, unsigned size) ...@@ -320,7 +320,10 @@ static int check586(struct net_device *dev, unsigned size)
struct priv *p = dev->priv; struct priv *p = dev->priv;
int i; int i;
p->mapped = (char __iomem *)isa_bus_to_virt(dev->mem_start); p->mapped = ioremap(dev->mem_start, size);
if (!p->mapped)
return 0;
p->base = p->mapped + size - 0x01000000; p->base = p->mapped + size - 0x01000000;
p->memtop = p->mapped + size; p->memtop = p->mapped + size;
p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS); p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS);
...@@ -330,16 +333,19 @@ static int check586(struct net_device *dev, unsigned size) ...@@ -330,16 +333,19 @@ static int check586(struct net_device *dev, unsigned size)
for (i = 0; i < sizeof(struct scp_struct); i++) for (i = 0; i < sizeof(struct scp_struct); i++)
/* memory was writeable? */ /* memory was writeable? */
if (readb((char __iomem *)p->scp + i)) if (readb((char __iomem *)p->scp + i))
return 0; goto Enodev;
writeb(SYSBUSVAL, &p->scp->sysbus); /* 1 = 8Bit-Bus, 0 = 16 Bit */ writeb(SYSBUSVAL, &p->scp->sysbus); /* 1 = 8Bit-Bus, 0 = 16 Bit */
if (readb(&p->scp->sysbus) != SYSBUSVAL) if (readb(&p->scp->sysbus) != SYSBUSVAL)
return 0; goto Enodev;
if (!check_iscp(dev, p->mapped)) if (!check_iscp(dev, p->mapped))
return 0; goto Enodev;
if (!check_iscp(dev, p->iscp)) if (!check_iscp(dev, p->iscp))
return 0; goto Enodev;
return 1; return 1;
Enodev:
iounmap(p->mapped);
return 0;
} }
/****************************************************************** /******************************************************************
...@@ -386,12 +392,15 @@ struct net_device * __init ni52_probe(int unit) ...@@ -386,12 +392,15 @@ struct net_device * __init ni52_probe(int unit)
{ {
struct net_device *dev = alloc_etherdev(sizeof(struct priv)); struct net_device *dev = alloc_etherdev(sizeof(struct priv));
static int ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0}; static int ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0};
struct priv *p;
int *port; int *port;
int err = 0; int err = 0;
if (!dev) if (!dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
p = dev->priv;
if (unit >= 0) { if (unit >= 0) {
sprintf(dev->name, "eth%d", unit); sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev); netdev_boot_setup_check(dev);
...@@ -426,6 +435,7 @@ struct net_device * __init ni52_probe(int unit) ...@@ -426,6 +435,7 @@ struct net_device * __init ni52_probe(int unit)
goto out1; goto out1;
return dev; return dev;
out1: out1:
iounmap(p->mapped);
release_region(dev->base_addr, NI52_TOTAL_SIZE); release_region(dev->base_addr, NI52_TOTAL_SIZE);
out: out:
free_netdev(dev); free_netdev(dev);
...@@ -542,6 +552,7 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr) ...@@ -542,6 +552,7 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)
if (!dev->irq) { if (!dev->irq) {
printk("?autoirq, Failed to detect IRQ line!\n"); printk("?autoirq, Failed to detect IRQ line!\n");
retval = -EAGAIN; retval = -EAGAIN;
iounmap(priv->mapped);
goto out; goto out;
} }
printk("IRQ %d (autodetected).\n", dev->irq); printk("IRQ %d (autodetected).\n", dev->irq);
...@@ -1325,7 +1336,9 @@ int __init init_module(void) ...@@ -1325,7 +1336,9 @@ int __init init_module(void)
void __exit cleanup_module(void) void __exit cleanup_module(void)
{ {
struct priv *p = dev_ni52->priv;
unregister_netdev(dev_ni52); unregister_netdev(dev_ni52);
iounmap(p->mapped);
release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE); release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE);
free_netdev(dev_ni52); free_netdev(dev_ni52);
} }
......
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