]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/3c515.c
iwlwifi: keep 3945 and 4965 headers separate
[linux-2.6-omap-h63xx.git] / drivers / net / 3c515.c
index 91f2232e6050fbfe2f4e8caff253c3b99ed37b43..684bab7810156998f3fd366b27ac1b645d5169e7 100644 (file)
@@ -243,14 +243,16 @@ enum eeprom_offset {
 enum Window3 {                 /* Window 3: MAC/config bits. */
        Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8,
 };
-union wn3_config {
-       int i;
-       struct w3_config_fields {
-               unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2;
-               int pad8:8;
-               unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1;
-               int pad24:7;
-       } u;
+enum wn3_config {
+       Ram_size = 7,
+       Ram_width = 8,
+       Ram_speed = 0x30,
+       Rom_size = 0xc0,
+       Ram_split_shift = 16,
+       Ram_split = 3 << Ram_split_shift,
+       Xcvr_shift = 20,
+       Xcvr = 7 << Xcvr_shift,
+       Autoselect = 0x1000000,
 };
 
 enum Window4 {
@@ -373,8 +375,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb,
 static int corkscrew_rx(struct net_device *dev);
 static void corkscrew_timeout(struct net_device *dev);
 static int boomerang_rx(struct net_device *dev);
-static irqreturn_t corkscrew_interrupt(int irq, void *dev_id,
-                                   struct pt_regs *regs);
+static irqreturn_t corkscrew_interrupt(int irq, void *dev_id);
 static int corkscrew_close(struct net_device *dev);
 static void update_stats(int addr, struct net_device *dev);
 static struct net_device_stats *corkscrew_get_stats(struct net_device *dev);
@@ -502,8 +503,6 @@ static struct net_device *corkscrew_scan(int unit)
                netdev_boot_setup_check(dev);
        }
 
-       SET_MODULE_OWNER(dev);
-
 #ifdef __ISAPNP__
        if(nopnp == 1)
                goto no_pnp;
@@ -572,6 +571,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
        unsigned int eeprom[0x40], checksum = 0;        /* EEPROM contents */
        int i;
        int irq;
+       DECLARE_MAC_BUF(mac);
 
        if (idev) {
                irq = pnp_irq(idev, 0);
@@ -616,7 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
        /* Read the station address from the EEPROM. */
        EL3WINDOW(0);
        for (i = 0; i < 0x18; i++) {
-               short *phys_addr = (short *) dev->dev_addr;
+               __be16 *phys_addr = (__be16 *) dev->dev_addr;
                int timer;
                outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd);
                /* Pause for at least 162 us. for the read to take place. */
@@ -633,8 +633,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
        checksum = (checksum ^ (checksum >> 8)) & 0xff;
        if (checksum != 0x00)
                printk(" ***INVALID CHECKSUM %4.4x*** ", checksum);
-       for (i = 0; i < 6; i++)
-               printk("%c%2.2x", i ? ':' : ' ', dev->dev_addr[i]);
+       printk(" %s", print_mac(mac, dev->dev_addr));
        if (eeprom[16] == 0x11c7) {     /* Corkscrew */
                if (request_dma(dev->dma, "3c515")) {
                        printk(", DMA %d allocation failed", dev->dma);
@@ -649,22 +648,22 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
 
        {
                char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
-               union wn3_config config;
+               __u32 config;
                EL3WINDOW(3);
                vp->available_media = inw(ioaddr + Wn3_Options);
-               config.i = inl(ioaddr + Wn3_Config);
+               config = inl(ioaddr + Wn3_Config);
                if (corkscrew_debug > 1)
                        printk(KERN_INFO "  Internal config register is %4.4x, transceivers %#x.\n",
-                               config.i, inw(ioaddr + Wn3_Options));
+                               config, inw(ioaddr + Wn3_Options));
                printk(KERN_INFO "  %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n",
-                       8 << config.u.ram_size,
-                       config.u.ram_width ? "word" : "byte",
-                       ram_split[config.u.ram_split],
-                       config.u.autoselect ? "autoselect/" : "",
-                       media_tbl[config.u.xcvr].name);
-               dev->if_port = config.u.xcvr;
-               vp->default_media = config.u.xcvr;
-               vp->autoselect = config.u.autoselect;
+                       8 << config & Ram_size,
+                       config & Ram_width ? "word" : "byte",
+                       ram_split[(config & Ram_split) >> Ram_split_shift],
+                       config & Autoselect ? "autoselect/" : "",
+                       media_tbl[(config & Xcvr) >> Xcvr_shift].name);
+               vp->default_media = (config & Xcvr) >> Xcvr_shift;
+               vp->autoselect = config & Autoselect ? 1 : 0;
+               dev->if_port = vp->default_media;
        }
        if (vp->media_override != 7) {
                printk(KERN_INFO "  Media override to transceiver type %d (%s).\n",
@@ -697,14 +696,14 @@ static int corkscrew_open(struct net_device *dev)
 {
        int ioaddr = dev->base_addr;
        struct corkscrew_private *vp = netdev_priv(dev);
-       union wn3_config config;
+       __u32 config;
        int i;
 
        /* Before initializing select the active media port. */
        EL3WINDOW(3);
        if (vp->full_duplex)
                outb(0x20, ioaddr + Wn3_MAC_Ctrl);      /* Set the full-duplex bit. */
-       config.i = inl(ioaddr + Wn3_Config);
+       config = inl(ioaddr + Wn3_Config);
 
        if (vp->media_override != 7) {
                if (corkscrew_debug > 1)
@@ -730,12 +729,12 @@ static int corkscrew_open(struct net_device *dev)
        } else
                dev->if_port = vp->default_media;
 
-       config.u.xcvr = dev->if_port;
-       outl(config.i, ioaddr + Wn3_Config);
+       config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
+       outl(config, ioaddr + Wn3_Config);
 
        if (corkscrew_debug > 1) {
                printk("%s: corkscrew_open() InternalConfig %8.8x.\n",
-                      dev->name, config.i);
+                      dev->name, config);
        }
 
        outw(TxReset, ioaddr + EL3_CMD);
@@ -904,7 +903,7 @@ static void corkscrew_timer(unsigned long data)
                        ok = 1;
                }
                if (!ok) {
-                       union wn3_config config;
+                       __u32 config;
 
                        do {
                                dev->if_port =
@@ -931,9 +930,9 @@ static void corkscrew_timer(unsigned long data)
                             ioaddr + Wn4_Media);
 
                        EL3WINDOW(3);
-                       config.i = inl(ioaddr + Wn3_Config);
-                       config.u.xcvr = dev->if_port;
-                       outl(config.i, ioaddr + Wn3_Config);
+                       config = inl(ioaddr + Wn3_Config);
+                       config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
+                       outl(config, ioaddr + Wn3_Config);
 
                        outw(dev->if_port == 3 ? StartCoax : StopCoax,
                             ioaddr + EL3_CMD);
@@ -1116,8 +1115,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb,
 /* The interrupt handler does all of the Rx thread work and cleans up
    after the Tx thread. */
 
-static irqreturn_t corkscrew_interrupt(int irq, void *dev_id,
-                                   struct pt_regs *regs)
+static irqreturn_t corkscrew_interrupt(int irq, void *dev_id)
 {
        /* Use the now-standard shared IRQ implementation. */
        struct net_device *dev = dev_id;
@@ -1294,7 +1292,6 @@ static int corkscrew_rx(struct net_device *dev)
                                printk("Receiving packet size %d status %4.4x.\n",
                                     pkt_len, rx_status);
                        if (skb != NULL) {
-                               skb->dev = dev;
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                /* 'skb_put()' points to the start of sk_buff data area. */
                                insl(ioaddr + RX_FIFO,
@@ -1365,7 +1362,6 @@ static int boomerang_rx(struct net_device *dev)
                           copying to a properly sized skbuff. */
                        if (pkt_len < rx_copybreak
                            && (skb = dev_alloc_skb(pkt_len + 4)) != 0) {
-                               skb->dev = dev;
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                /* 'skb_put()' points to the start of sk_buff data area. */
                                memcpy(skb_put(skb, pkt_len),