aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2008-03-19 05:43:59 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-26 00:18:01 -0400
commite06ee2bb03f936c57265e447bc05e8324db61207 (patch)
treea5e2a1a16364dc0078c652bdbae242fdd6054378 /drivers
parentde5971462fe27885290d8c95d9446a8b6d012448 (diff)
ni52: make ->base char __iomem *
... and store the virt address where we map the ->mem_addr, while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ni52.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index 71ce4f276199..8eac7146a884 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -135,9 +135,9 @@ static int fifo = 0x8; /* don't change */
135#define ni_enaint() { outb(0, dev->base_addr + NI52_INTENA); } 135#define ni_enaint() { outb(0, dev->base_addr + NI52_INTENA); }
136 136
137#define make32(ptr16) (p->memtop + (short) (ptr16)) 137#define make32(ptr16) (p->memtop + (short) (ptr16))
138#define make24(ptr32) ((unsigned long)(ptr32)) - p->base 138#define make24(ptr32) ((char __iomem *)(ptr32)) - p->base
139#define make16(ptr32) ((unsigned short) ((unsigned long)(ptr32)\ 139#define make16(ptr32) ((unsigned short) ((char __iomem *)(ptr32)\
140 - (unsigned long) p->memtop)) 140 - p->memtop))
141 141
142/******************* how to calculate the buffers ***************************** 142/******************* how to calculate the buffers *****************************
143 143
@@ -189,7 +189,8 @@ static void ni52_rnr_int(struct net_device *dev);
189 189
190struct priv { 190struct priv {
191 struct net_device_stats stats; 191 struct net_device_stats stats;
192 unsigned long base; 192 char __iomem *base;
193 char __iomem *mapped;
193 char __iomem *memtop; 194 char __iomem *memtop;
194 spinlock_t spinlock; 195 spinlock_t spinlock;
195 int reset; 196 int reset;
@@ -304,8 +305,9 @@ static int check586(struct net_device *dev, unsigned size)
304 char __iomem *iscp_addrs[2]; 305 char __iomem *iscp_addrs[2];
305 int i; 306 int i;
306 307
307 p->base = (unsigned long) isa_bus_to_virt(where) + size - 0x01000000; 308 p->mapped = (char __iomem *)isa_bus_to_virt(where);
308 p->memtop = (char __iomem *)isa_bus_to_virt(where) + size; 309 p->base = p->mapped + size - 0x01000000;
310 p->memtop = p->mapped + size;
309 p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS); 311 p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS);
310 memset_io(p->scp, 0, sizeof(struct scp_struct)); 312 memset_io(p->scp, 0, sizeof(struct scp_struct));
311 for (i = 0; i < sizeof(struct scp_struct); i++) 313 for (i = 0; i < sizeof(struct scp_struct); i++)
@@ -316,7 +318,7 @@ static int check586(struct net_device *dev, unsigned size)
316 if (readb(&p->scp->sysbus) != SYSBUSVAL) 318 if (readb(&p->scp->sysbus) != SYSBUSVAL)
317 return 0; 319 return 0;
318 320
319 iscp_addrs[0] = (char __iomem *)isa_bus_to_virt(where); 321 iscp_addrs[0] = p->mapped;
320 iscp_addrs[1] = (char __iomem *)p->scp - sizeof(struct iscp_struct); 322 iscp_addrs[1] = (char __iomem *)p->scp - sizeof(struct iscp_struct);
321 323
322 for (i = 0; i < 2; i++) { 324 for (i = 0; i < 2; i++) {
@@ -436,6 +438,7 @@ out:
436static int __init ni52_probe1(struct net_device *dev, int ioaddr) 438static int __init ni52_probe1(struct net_device *dev, int ioaddr)
437{ 439{
438 int i, size, retval; 440 int i, size, retval;
441 struct priv *priv = dev->priv;
439 442
440 dev->base_addr = ioaddr; 443 dev->base_addr = ioaddr;
441 dev->irq = irq; 444 dev->irq = irq;
@@ -517,19 +520,18 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)
517 dev->mem_end = dev->mem_start + size; 520 dev->mem_end = dev->mem_start + size;
518#endif 521#endif
519 522
520 memset((char *)dev->priv, 0, sizeof(struct priv)); 523 memset(priv, 0, sizeof(struct priv));
521 524
522 ((struct priv *)(dev->priv))->memtop = 525 priv->mapped = (char __iomem *)isa_bus_to_virt(dev->mem_start);
523 (char __iomem *)isa_bus_to_virt(dev->mem_start) + size; 526 priv->memtop = priv->mapped + size;
524 ((struct priv *)(dev->priv))->base = (unsigned long) 527 priv->base = priv->mapped + size - 0x01000000;
525 isa_bus_to_virt(dev->mem_start) + size - 0x01000000;
526 alloc586(dev); 528 alloc586(dev);
527 529
528 /* set number of receive-buffs according to memsize */ 530 /* set number of receive-buffs according to memsize */
529 if (size == 0x2000) 531 if (size == 0x2000)
530 ((struct priv *) dev->priv)->num_recv_buffs = NUM_RECV_BUFFS_8; 532 priv->num_recv_buffs = NUM_RECV_BUFFS_8;
531 else 533 else
532 ((struct priv *) dev->priv)->num_recv_buffs = NUM_RECV_BUFFS_16; 534 priv->num_recv_buffs = NUM_RECV_BUFFS_16;
533 535
534 printk(KERN_DEBUG "Memaddr: 0x%lx, Memsize: %d, ", 536 printk(KERN_DEBUG "Memaddr: 0x%lx, Memsize: %d, ",
535 dev->mem_start, size); 537 dev->mem_start, size);
@@ -959,7 +961,7 @@ static void ni52_rcv_int(struct net_device *dev)
959 if (skb != NULL) { 961 if (skb != NULL) {
960 skb_reserve(skb, 2); 962 skb_reserve(skb, 2);
961 skb_put(skb, totlen); 963 skb_put(skb, totlen);
962 skb_copy_to_linear_data(skb, (char *)p->base + (unsigned long) rbd->buffer, totlen); 964 skb_copy_to_linear_data(skb, p->base + (unsigned long) rbd->buffer, totlen);
963 skb->protocol = eth_type_trans(skb, dev); 965 skb->protocol = eth_type_trans(skb, dev);
964 netif_rx(skb); 966 netif_rx(skb);
965 dev->last_rx = jiffies; 967 dev->last_rx = jiffies;