aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2008-03-19 05:44:39 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-26 00:18:04 -0400
commit05bd831fcdf4ce08ae5b832cfe03a303245fb135 (patch)
treecf6c85ad2c1a38798d22ff89f4e42884bf76ac3c /drivers
parent176f65f3efb55723518d018c8020867f44d05147 (diff)
ni52: more unbreaking
missed read*/write* plus a bunch of wrong-sized ones... 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.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index e0d1947c997a..a316dcc8a06d 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -134,7 +134,7 @@ static int fifo = 0x8; /* don't change */
134#define ni_disint() { outb(0, dev->base_addr + NI52_INTDIS); } 134#define ni_disint() { outb(0, dev->base_addr + NI52_INTDIS); }
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) ((void __iomem *)(p->memtop + (short) (ptr16)))
138#define make24(ptr32) ((char __iomem *)(ptr32)) - p->base 138#define make24(ptr32) ((char __iomem *)(ptr32)) - p->base
139#define make16(ptr32) ((unsigned short) ((char __iomem *)(ptr32)\ 139#define make16(ptr32) ((unsigned short) ((char __iomem *)(ptr32)\
140 - p->memtop)) 140 - p->memtop))
@@ -241,7 +241,8 @@ static void wait_for_scb_cmd_ruc(struct net_device *dev)
241 udelay(4); 241 udelay(4);
242 if (i == 16383) { 242 if (i == 16383) {
243 printk(KERN_ERR "%s: scb_cmd (ruc) timed out: %04x,%04x .. disabling i82586!!\n", 243 printk(KERN_ERR "%s: scb_cmd (ruc) timed out: %04x,%04x .. disabling i82586!!\n",
244 dev->name, p->scb->cmd_ruc, p->scb->rus); 244 dev->name, readb(&p->scb->cmd_ruc),
245 readb(&p->scb->rus));
245 if (!p->reset) { 246 if (!p->reset) {
246 p->reset = 1; 247 p->reset = 1;
247 ni_reset586(); 248 ni_reset586();
@@ -627,7 +628,7 @@ static int init586(struct net_device *dev)
627 writeb(0x01, &cfg_cmd->promisc); 628 writeb(0x01, &cfg_cmd->promisc);
628 writeb(0x00, &cfg_cmd->carr_coll); 629 writeb(0x00, &cfg_cmd->carr_coll);
629 writew(make16(cfg_cmd), &p->scb->cbl_offset); 630 writew(make16(cfg_cmd), &p->scb->cbl_offset);
630 writew(0, &p->scb->cmd_ruc); 631 writeb(0, &p->scb->cmd_ruc);
631 632
632 writeb(CUC_START, &p->scb->cmd_cuc); /* cmd.-unit start */ 633 writeb(CUC_START, &p->scb->cmd_cuc); /* cmd.-unit start */
633 ni_attn586(); 634 ni_attn586();
@@ -898,7 +899,7 @@ static irqreturn_t ni52_interrupt(int irq, void *dev_id)
898 if (readb(&p->scb->rus) & RU_SUSPEND) { 899 if (readb(&p->scb->rus) & RU_SUSPEND) {
899 /* special case: RU_SUSPEND */ 900 /* special case: RU_SUSPEND */
900 wait_for_scb_cmd(dev); 901 wait_for_scb_cmd(dev);
901 p->scb->cmd_ruc = RUC_RESUME; 902 writeb(RUC_RESUME, &p->scb->cmd_ruc);
902 ni_attn586(); 903 ni_attn586();
903 wait_for_scb_cmd_ruc(dev); 904 wait_for_scb_cmd_ruc(dev);
904 } else { 905 } else {
@@ -925,7 +926,7 @@ static irqreturn_t ni52_interrupt(int irq, void *dev_id)
925 926
926 /* Wait for ack. (ni52_xmt_int can be faster than ack!!) */ 927 /* Wait for ack. (ni52_xmt_int can be faster than ack!!) */
927 wait_for_scb_cmd(dev); 928 wait_for_scb_cmd(dev);
928 if (p->scb->cmd_cuc) { /* timed out? */ 929 if (readb(&p->scb->cmd_cuc)) { /* timed out? */
929 printk(KERN_ERR "%s: Acknowledge timed out.\n", 930 printk(KERN_ERR "%s: Acknowledge timed out.\n",
930 dev->name); 931 dev->name);
931 ni_disint(); 932 ni_disint();
@@ -955,7 +956,7 @@ static void ni52_rcv_int(struct net_device *dev)
955 printk("R"); 956 printk("R");
956 957
957 for (; (status = readb(&p->rfd_top->stat_high)) & RFD_COMPL;) { 958 for (; (status = readb(&p->rfd_top->stat_high)) & RFD_COMPL;) {
958 rbd = (struct rbd_struct __iomem *) make32(p->rfd_top->rbd_offset); 959 rbd = make32(readw(&p->rfd_top->rbd_offset));
959 if (status & RFD_OK) { /* frame received without error? */ 960 if (status & RFD_OK) { /* frame received without error? */
960 totlen = readw(&rbd->status); 961 totlen = readw(&rbd->status);
961 if (totlen & RBD_LAST) { 962 if (totlen & RBD_LAST) {
@@ -966,7 +967,7 @@ static void ni52_rcv_int(struct net_device *dev)
966 if (skb != NULL) { 967 if (skb != NULL) {
967 skb_reserve(skb, 2); 968 skb_reserve(skb, 2);
968 skb_put(skb, totlen); 969 skb_put(skb, totlen);
969 skb_copy_to_linear_data(skb, p->base + (unsigned long) rbd->buffer, totlen); 970 memcpy_fromio(skb->data, p->base + readl(&rbd->buffer), totlen);
970 skb->protocol = eth_type_trans(skb, dev); 971 skb->protocol = eth_type_trans(skb, dev);
971 netif_rx(skb); 972 netif_rx(skb);
972 dev->last_rx = jiffies; 973 dev->last_rx = jiffies;
@@ -985,7 +986,7 @@ static void ni52_rcv_int(struct net_device *dev)
985 break; 986 break;
986 } 987 }
987 writew(0, &rbd->status); 988 writew(0, &rbd->status);
988 rbd = (struct rbd_struct __iomem *) make32(readl(&rbd->next)); 989 rbd = make32(readw(&rbd->next));
989 } 990 }
990 totlen += rstat & RBD_MASK; 991 totlen += rstat & RBD_MASK;
991 writew(0, &rbd->status); 992 writew(0, &rbd->status);
@@ -1003,7 +1004,7 @@ static void ni52_rcv_int(struct net_device *dev)
1003 writew(0xffff, &p->rfd_top->rbd_offset); 1004 writew(0xffff, &p->rfd_top->rbd_offset);
1004 writeb(0, &p->rfd_last->last); /* delete RFD_SUSP */ 1005 writeb(0, &p->rfd_last->last); /* delete RFD_SUSP */
1005 p->rfd_last = p->rfd_top; 1006 p->rfd_last = p->rfd_top;
1006 p->rfd_top = (struct rfd_struct __iomem *) make32(p->rfd_top->next); /* step to next RFD */ 1007 p->rfd_top = make32(readw(&p->rfd_top->next)); /* step to next RFD */
1007 writew(make16(p->rfd_top), &p->scb->rfa_offset); 1008 writew(make16(p->rfd_top), &p->scb->rfa_offset);
1008 1009
1009 if (debuglevel > 0) 1010 if (debuglevel > 0)
@@ -1052,7 +1053,8 @@ static void ni52_rnr_int(struct net_device *dev)
1052 /* maybe add a check here, before restarting the RU */ 1053 /* maybe add a check here, before restarting the RU */
1053 startrecv586(dev); /* restart RU */ 1054 startrecv586(dev); /* restart RU */
1054 1055
1055 printk(KERN_ERR "%s: Receive-Unit restarted. Status: %04x\n", dev->name, p->scb->rus); 1056 printk(KERN_ERR "%s: Receive-Unit restarted. Status: %04x\n",
1057 dev->name, readb(&p->scb->rus));
1056 1058
1057} 1059}
1058 1060
@@ -1184,12 +1186,11 @@ static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev)
1184 1186
1185 netif_stop_queue(dev); 1187 netif_stop_queue(dev);
1186 1188
1187 skb_copy_from_linear_data(skb, (char *)p->xmit_cbuffs[p->xmit_count], 1189 memcpy_toio(p->xmit_cbuffs[p->xmit_count], skb->data, skb->len);
1188 skb->len);
1189 len = skb->len; 1190 len = skb->len;
1190 if (len < ETH_ZLEN) { 1191 if (len < ETH_ZLEN) {
1191 len = ETH_ZLEN; 1192 len = ETH_ZLEN;
1192 memset((char *)p->xmit_cbuffs[p->xmit_count]+skb->len, 0, 1193 memset_io(p->xmit_cbuffs[p->xmit_count]+skb->len, 0,
1193 len - skb->len); 1194 len - skb->len);
1194 } 1195 }
1195 1196
@@ -1197,14 +1198,14 @@ static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev)
1197# ifdef NO_NOPCOMMANDS 1198# ifdef NO_NOPCOMMANDS
1198 1199
1199#ifdef DEBUG 1200#ifdef DEBUG
1200 if (p->scb->cus & CU_ACTIVE) { 1201 if (readb(&p->scb->cus) & CU_ACTIVE) {
1201 printk(KERN_ERR "%s: Hmmm .. CU is still running and we wanna send a new packet.\n", dev->name); 1202 printk(KERN_ERR "%s: Hmmm .. CU is still running and we wanna send a new packet.\n", dev->name);
1202 printk(KERN_ERR "%s: stat: %04x %04x\n", 1203 printk(KERN_ERR "%s: stat: %04x %04x\n",
1203 dev->name, readb(&p->scb->cus), 1204 dev->name, readb(&p->scb->cus),
1204 readw(&p->xmit_cmds[0]->cmd_status)); 1205 readw(&p->xmit_cmds[0]->cmd_status));
1205 } 1206 }
1206#endif 1207#endif
1207 writew(TBD_LAST | len, &p->xmit_buffs[0]->size);; 1208 writew(TBD_LAST | len, &p->xmit_buffs[0]->size);
1208 for (i = 0; i < 16; i++) { 1209 for (i = 0; i < 16; i++) {
1209 writew(0, &p->xmit_cmds[0]->cmd_status); 1210 writew(0, &p->xmit_cmds[0]->cmd_status);
1210 wait_for_scb_cmd(dev); 1211 wait_for_scb_cmd(dev);