aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2006-01-08 04:01:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:12:46 -0500
commit084f746a01ca026920e388e76e913cc7a26d5a3f (patch)
tree8eb430502c39b4398bb162e80b012cc659fc4eee /drivers
parent3b68d70dffe255e7681d5725d96bc2b92a24bb9d (diff)
[PATCH] cs89x0: switch {in,out}sw to {read,write}words
Implement readwords/writewords that use readword/writeword, and switch the rest of the driver over to use these. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Cc: dmitry pervushin <dpervushin@ru.mvista.com> Cc: <dsaxena@plexity.net> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/cs89x0.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 7abc9f858f98..f7ec590e80ea 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -378,6 +378,34 @@ writeword(unsigned long base_addr, int portno, int value)
378#endif 378#endif
379#endif 379#endif
380 380
381static void
382readwords(unsigned long base_addr, int portno, void *buf, int length)
383{
384 u8 *buf8 = (u8 *)buf;
385
386 do {
387 u32 tmp32;
388
389 tmp32 = readword(base_addr, portno);
390 *buf8++ = (u8)tmp32;
391 *buf8++ = (u8)(tmp32 >> 8);
392 } while (--length);
393}
394
395static void
396writewords(unsigned long base_addr, int portno, void *buf, int length)
397{
398 u8 *buf8 = (u8 *)buf;
399
400 do {
401 u32 tmp32;
402
403 tmp32 = *buf8++;
404 tmp32 |= (*buf8++) << 8;
405 writeword(base_addr, portno, tmp32);
406 } while (--length);
407}
408
381static int 409static int
382readreg(struct net_device *dev, int regno) 410readreg(struct net_device *dev, int regno)
383{ 411{
@@ -1143,7 +1171,7 @@ send_test_pkt(struct net_device *dev)
1143 return 0; /* this shouldn't happen */ 1171 return 0; /* this shouldn't happen */
1144 1172
1145 /* Write the contents of the packet */ 1173 /* Write the contents of the packet */
1146 outsw(dev->base_addr + TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1); 1174 writewords(dev->base_addr, TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1);
1147 1175
1148 if (net_debug > 1) printk("Sending test packet "); 1176 if (net_debug > 1) printk("Sending test packet ");
1149 /* wait a couple of jiffies for packet to be received */ 1177 /* wait a couple of jiffies for packet to be received */
@@ -1500,7 +1528,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1500 return 1; 1528 return 1;
1501 } 1529 }
1502 /* Write the contents of the packet */ 1530 /* Write the contents of the packet */
1503 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1531 writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1504 spin_unlock_irq(&lp->lock); 1532 spin_unlock_irq(&lp->lock);
1505 lp->stats.tx_bytes += skb->len; 1533 lp->stats.tx_bytes += skb->len;
1506 dev->trans_start = jiffies; 1534 dev->trans_start = jiffies;
@@ -1654,7 +1682,7 @@ net_rx(struct net_device *dev)
1654 skb_reserve(skb, 2); /* longword align L3 header */ 1682 skb_reserve(skb, 2); /* longword align L3 header */
1655 skb->dev = dev; 1683 skb->dev = dev;
1656 1684
1657 insw(ioaddr + RX_FRAME_PORT, skb_put(skb, length), length >> 1); 1685 readwords(ioaddr, RX_FRAME_PORT, skb_put(skb, length), length >> 1);
1658 if (length & 1) 1686 if (length & 1)
1659 skb->data[length-1] = readword(ioaddr, RX_FRAME_PORT); 1687 skb->data[length-1] = readword(ioaddr, RX_FRAME_PORT);
1660 1688