aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bmac.c')
-rw-r--r--drivers/net/bmac.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 4528ce9c4e43..c143304dcff5 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/crc32.h> 20#include <linux/crc32.h>
21#include <linux/bitrev.h>
21#include <asm/prom.h> 22#include <asm/prom.h>
22#include <asm/dbdma.h> 23#include <asm/dbdma.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -140,7 +141,6 @@ static unsigned char *bmac_emergency_rxbuf;
140 + (N_RX_RING + N_TX_RING + 4) * sizeof(struct dbdma_cmd) \ 141 + (N_RX_RING + N_TX_RING + 4) * sizeof(struct dbdma_cmd) \
141 + sizeof(struct sk_buff_head)) 142 + sizeof(struct sk_buff_head))
142 143
143static unsigned char bitrev(unsigned char b);
144static int bmac_open(struct net_device *dev); 144static int bmac_open(struct net_device *dev);
145static int bmac_close(struct net_device *dev); 145static int bmac_close(struct net_device *dev);
146static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev); 146static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev);
@@ -586,18 +586,6 @@ bmac_construct_rxbuff(struct sk_buff *skb, volatile struct dbdma_cmd *cp)
586 virt_to_bus(addr), 0); 586 virt_to_bus(addr), 0);
587} 587}
588 588
589/* Bit-reverse one byte of an ethernet hardware address. */
590static unsigned char
591bitrev(unsigned char b)
592{
593 int d = 0, i;
594
595 for (i = 0; i < 8; ++i, b >>= 1)
596 d = (d << 1) | (b & 1);
597 return d;
598}
599
600
601static void 589static void
602bmac_init_tx_ring(struct bmac_data *bp) 590bmac_init_tx_ring(struct bmac_data *bp)
603{ 591{
@@ -1224,8 +1212,8 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea)
1224 { 1212 {
1225 reset_and_select_srom(dev); 1213 reset_and_select_srom(dev);
1226 data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); 1214 data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits);
1227 ea[2*i] = bitrev(data & 0x0ff); 1215 ea[2*i] = bitrev8(data & 0x0ff);
1228 ea[2*i+1] = bitrev((data >> 8) & 0x0ff); 1216 ea[2*i+1] = bitrev8((data >> 8) & 0x0ff);
1229 } 1217 }
1230} 1218}
1231 1219
@@ -1315,7 +1303,7 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
1315 1303
1316 rev = addr[0] == 0 && addr[1] == 0xA0; 1304 rev = addr[0] == 0 && addr[1] == 0xA0;
1317 for (j = 0; j < 6; ++j) 1305 for (j = 0; j < 6; ++j)
1318 dev->dev_addr[j] = rev? bitrev(addr[j]): addr[j]; 1306 dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
1319 1307
1320 /* Enable chip without interrupts for now */ 1308 /* Enable chip without interrupts for now */
1321 bmac_enable_and_reset_chip(dev); 1309 bmac_enable_and_reset_chip(dev);