apex: Revert back to 1.4.7 - what I thought I tested wasn't what I actually tested...
[openwrt.git] / target / linux / brcm47xx-2.6 / patches / 120-b44_ssb_support.patch
index 44b2c42..5b44774 100644 (file)
@@ -27,7 +27,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  #include "b44.h"
  
  #define DRV_MODULE_NAME               "b44"
-@@ -87,8 +91,8 @@
+@@ -86,8 +90,8 @@
  static char version[] __devinitdata =
        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
  
@@ -38,7 +38,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  MODULE_LICENSE("GPL");
  MODULE_VERSION(DRV_MODULE_VERSION);
  
-@@ -96,24 +100,18 @@
+@@ -95,18 +99,11 @@
  module_param(b44_debug, int, 0);
  MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
  
@@ -59,15 +59,16 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -
  static void b44_halt(struct b44 *);
  static void b44_init_rings(struct b44 *);
- static void b44_init_hw(struct b44 *, int);
+
+@@ -118,6 +115,7 @@
+
  static int dma_desc_align_mask;
  static int dma_desc_sync_size;
 +static int instance;
  
  static const char b44_gstrings[][ETH_GSTRING_LEN] = {
  #define _B44(x...)    # x,
-@@ -121,35 +119,24 @@
+@@ -125,35 +123,24 @@
  #undef _B44
  };
  
@@ -121,7 +122,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  }
  
  static int b44_wait_bit(struct b44 *bp, unsigned long reg,
-@@ -177,117 +164,29 @@
+@@ -181,117 +168,29 @@
        return 0;
  }
  
@@ -252,7 +253,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  {
        u32 val;
  
-@@ -323,14 +222,14 @@
+@@ -327,14 +226,14 @@
        bw32(bp, B44_IMASK, bp->imask);
  }
  
@@ -269,7 +270,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                             (reg << MDIO_DATA_RA_SHIFT) |
                             (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
        err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
-@@ -339,18 +238,34 @@
+@@ -343,18 +242,34 @@
        return err;
  }
  
@@ -306,7 +307,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  /* miilib interface */
  /* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional
   * due to code existing before miilib use was added to this driver.
-@@ -379,6 +294,8 @@
+@@ -383,6 +298,8 @@
        u32 val;
        int err;
  
@@ -315,7 +316,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
        if (err)
                return err;
-@@ -437,11 +354,27 @@
+@@ -441,11 +358,27 @@
        __b44_set_flow_ctrl(bp, pause_enab);
  }
  
@@ -343,7 +344,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
                goto out;
        if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
-@@ -537,6 +470,19 @@
+@@ -541,6 +474,19 @@
  {
        u32 bmsr, aux;
  
@@ -363,7 +364,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
            !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
            (bmsr != 0xffff)) {
-@@ -613,10 +559,10 @@
+@@ -617,10 +563,10 @@
  
                BUG_ON(skb == NULL);
  
@@ -376,7 +377,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                rp->skb = NULL;
                dev_kfree_skb_irq(skb);
        }
-@@ -652,10 +598,10 @@
+@@ -656,10 +602,10 @@
        skb = dev_alloc_skb(RX_PKT_BUF_SZ);
        if (skb == NULL)
                return -ENOMEM;
@@ -390,8 +391,8 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        /* Hardware bug work-around, the chip is unable to do PCI DMA
           to/from anything above 1GB :-( */
-@@ -663,18 +609,18 @@
-               mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
+@@ -667,18 +613,18 @@
+               mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
                /* Sigh... */
                if (!dma_mapping_error(mapping))
 -                      pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
@@ -406,14 +407,14 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -                                       PCI_DMA_FROMDEVICE);
 +                                       DMA_FROM_DEVICE);
                if (dma_mapping_error(mapping) ||
-                       mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
+                       mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
                        if (!dma_mapping_error(mapping))
 -                              pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
 +                              dma_unmap_single(&bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE);
                        dev_kfree_skb_any(skb);
                        return -ENOMEM;
                }
-@@ -703,9 +649,9 @@
+@@ -707,9 +653,9 @@
        dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);
  
        if (bp->flags & B44_FLAG_RX_RING_HACK)
@@ -426,7 +427,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        return RX_PKT_BUF_SZ;
  }
-@@ -732,9 +678,9 @@
+@@ -736,9 +682,9 @@
                           pci_unmap_addr(src_map, mapping));
  
        if (bp->flags & B44_FLAG_RX_RING_HACK)
@@ -439,7 +440,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        ctrl = src_desc->ctrl;
        if (dest_idx == (B44_RX_RING_SIZE - 1))
-@@ -748,13 +694,13 @@
+@@ -752,13 +698,13 @@
        src_map->skb = NULL;
  
        if (bp->flags & B44_FLAG_RX_RING_HACK)
@@ -450,15 +451,15 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 +                                          dest_idx * sizeof(dest_desc),
 +                                          DMA_BIDIRECTIONAL);
  
--      pci_dma_sync_single_for_device(bp->pdev, src_desc->addr,
-+      dma_sync_single_for_device(&bp->sdev->dev, src_desc->addr,
+-      pci_dma_sync_single_for_device(bp->pdev, le32_to_cpu(src_desc->addr),
++      dma_sync_single_for_device(&bp->sdev->dev, le32_to_cpu(src_desc->addr),
                                       RX_PKT_BUF_SZ,
 -                                     PCI_DMA_FROMDEVICE);
 +                                     DMA_FROM_DEVICE);
  }
  
  static int b44_rx(struct b44 *bp, int budget)
-@@ -774,9 +720,9 @@
+@@ -778,9 +724,9 @@
                struct rx_header *rh;
                u16 len;
  
@@ -468,9 +469,9 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -                                          PCI_DMA_FROMDEVICE);
 +                                          DMA_FROM_DEVICE);
                rh = (struct rx_header *) skb->data;
-               len = cpu_to_le16(rh->len);
+               len = le16_to_cpu(rh->len);
                if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
-@@ -808,11 +754,11 @@
+@@ -812,11 +758,11 @@
                        skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
                        if (skb_size < 0)
                                goto drop_it;
@@ -486,13 +487,13 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                } else {
                        struct sk_buff *copy_skb;
  
-@@ -980,23 +926,23 @@
+@@ -986,23 +932,23 @@
                goto err_out;
        }
  
 -      mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
 +      mapping = dma_map_single(&bp->sdev->dev, skb->data, len, DMA_TO_DEVICE);
-       if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) {
+       if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
                /* Chip can't handle DMA to/from >1GB, use bounce buffer */
                if (!dma_mapping_error(mapping))
 -                      pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
@@ -507,7 +508,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -                                       len, PCI_DMA_TODEVICE);
 +              mapping = dma_map_single(&bp->sdev->dev, bounce_skb->data,
 +                                       len, DMA_TO_DEVICE);
-               if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) {
+               if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
                        if (!dma_mapping_error(mapping))
 -                              pci_unmap_single(bp->pdev, mapping,
 -                                       len, PCI_DMA_TODEVICE);
@@ -516,7 +517,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                        dev_kfree_skb_any(bounce_skb);
                        goto err_out;
                }
-@@ -1019,9 +965,9 @@
+@@ -1025,9 +971,9 @@
        bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
  
        if (bp->flags & B44_FLAG_TX_RING_HACK)
@@ -529,7 +530,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        entry = NEXT_TX(entry);
  
-@@ -1094,10 +1040,10 @@
+@@ -1100,10 +1046,10 @@
  
                if (rp->skb == NULL)
                        continue;
@@ -542,7 +543,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                dev_kfree_skb_any(rp->skb);
                rp->skb = NULL;
        }
-@@ -1108,10 +1054,10 @@
+@@ -1114,10 +1060,10 @@
  
                if (rp->skb == NULL)
                        continue;
@@ -555,7 +556,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                dev_kfree_skb_any(rp->skb);
                rp->skb = NULL;
        }
-@@ -1133,14 +1079,14 @@
+@@ -1139,14 +1085,14 @@
        memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
  
        if (bp->flags & B44_FLAG_RX_RING_HACK)
@@ -576,7 +577,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        for (i = 0; i < bp->rx_pending; i++) {
                if (b44_alloc_rx_skb(bp, -1, i) < 0)
-@@ -1160,24 +1106,24 @@
+@@ -1166,24 +1112,24 @@
        bp->tx_buffers = NULL;
        if (bp->rx_ring) {
                if (bp->flags & B44_FLAG_RX_RING_HACK) {
@@ -609,7 +610,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                                            bp->tx_ring, bp->tx_ring_dma);
                bp->tx_ring = NULL;
                bp->flags &= ~B44_FLAG_TX_RING_HACK;
-@@ -1203,7 +1149,7 @@
+@@ -1209,7 +1155,7 @@
                goto out_err;
  
        size = DMA_TABLE_BYTES;
@@ -618,7 +619,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        if (!bp->rx_ring) {
                /* Allocation may have failed due to pci_alloc_consistent
                   insisting on use of GFP_DMA, which is more restrictive
-@@ -1215,9 +1161,9 @@
+@@ -1221,9 +1167,9 @@
                if (!rx_ring)
                        goto out_err;
  
@@ -630,8 +631,8 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 +                                          DMA_BIDIRECTIONAL);
  
                if (dma_mapping_error(rx_ring_dma) ||
-                       rx_ring_dma + size > B44_DMA_MASK) {
-@@ -1230,9 +1176,9 @@
+                       rx_ring_dma + size > DMA_30BIT_MASK) {
+@@ -1236,9 +1182,9 @@
                bp->flags |= B44_FLAG_RX_RING_HACK;
        }
  
@@ -643,7 +644,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                   insisting on use of GFP_DMA, which is more restrictive
                   than necessary...  */
                struct dma_desc *tx_ring;
-@@ -1242,9 +1188,9 @@
+@@ -1248,9 +1194,9 @@
                if (!tx_ring)
                        goto out_err;
  
@@ -655,8 +656,8 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 +                                          DMA_TO_DEVICE);
  
                if (dma_mapping_error(tx_ring_dma) ||
-                       tx_ring_dma + size > B44_DMA_MASK) {
-@@ -1279,7 +1225,9 @@
+                       tx_ring_dma + size > DMA_30BIT_MASK) {
+@@ -1285,7 +1231,9 @@
  /* bp->lock is held. */
  static void b44_chip_reset(struct b44 *bp)
  {
@@ -666,8 +667,8 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 +      if (ssb_device_is_enabled(bp->sdev)) {
                bw32(bp, B44_RCV_LAZY, 0);
                bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
-               b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
-@@ -1291,19 +1239,23 @@
+               b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1);
+@@ -1297,19 +1245,23 @@
                }
                bw32(bp, B44_DMARX_CTRL, 0);
                bp->rx_prod = bp->rx_cons = 0;
@@ -699,7 +700,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        br32(bp, B44_MDIO_CTRL);
  
        if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
-@@ -1346,6 +1298,7 @@
+@@ -1352,6 +1304,7 @@
  {
        struct b44 *bp = netdev_priv(dev);
        struct sockaddr *addr = p;
@@ -707,7 +708,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        if (netif_running(dev))
                return -EBUSY;
-@@ -1356,7 +1309,11 @@
+@@ -1362,7 +1315,11 @@
        memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
  
        spin_lock_irq(&bp->lock);
@@ -720,7 +721,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        spin_unlock_irq(&bp->lock);
  
        return 0;
-@@ -1442,18 +1399,6 @@
+@@ -1448,18 +1405,6 @@
        return err;
  }
  
@@ -739,7 +740,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  #ifdef CONFIG_NET_POLL_CONTROLLER
  /*
   * Polling receive - used by netconsole and other diagnostic tools
-@@ -1568,7 +1513,6 @@
+@@ -1574,7 +1519,6 @@
  static void b44_setup_wol(struct b44 *bp)
  {
        u32 val;
@@ -747,7 +748,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        bw32(bp, B44_RXCONFIG, RXCONFIG_ALLMULTI);
  
-@@ -1592,13 +1536,6 @@
+@@ -1598,13 +1542,6 @@
        } else {
                b44_setup_pseudo_magicp(bp);
        }
@@ -761,7 +762,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  }
  
  static int b44_close(struct net_device *dev)
-@@ -1698,7 +1635,7 @@
+@@ -1704,7 +1641,7 @@
  
        val = br32(bp, B44_RXCONFIG);
        val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
@@ -770,7 +771,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
                val |= RXCONFIG_PROMISC;
                bw32(bp, B44_RXCONFIG, val);
        } else {
-@@ -1745,12 +1682,8 @@
+@@ -1751,12 +1688,8 @@
  
  static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
  {
@@ -783,7 +784,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  }
  
  static int b44_nway_reset(struct net_device *dev)
-@@ -2034,6 +1967,245 @@
+@@ -2040,6 +1973,245 @@
        .get_perm_addr          = ethtool_op_get_perm_addr,
  };
  
@@ -1029,7 +1030,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
  {
        struct mii_ioctl_data *data = if_mii(ifr);
-@@ -2043,40 +2215,64 @@
+@@ -2049,40 +2221,64 @@
        if (!netif_running(dev))
                goto out;
  
@@ -1047,7 +1048,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -static int b44_read_eeprom(struct b44 *bp, u8 *data)
 -{
 -      long i;
--      u16 *ptr = (u16 *) data;
+-      __le16 *ptr = (__le16 *) data;
 +      case SIOCGMIIPHY:
 +             data->phy_id = bp->phy_addr;
  
@@ -1119,7 +1120,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
                printk(KERN_ERR PFX "Invalid MAC address found in EEPROM\n");
-@@ -2085,108 +2281,52 @@
+@@ -2091,108 +2287,52 @@
  
        memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len);
  
@@ -1187,13 +1188,13 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -
 -      pci_set_master(pdev);
 -
--      err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK);
+-      err = pci_set_dma_mask(pdev, (u64) DMA_30BIT_MASK);
 -      if (err) {
 -              dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n");
 -              goto err_out_free_res;
 -      }
 -
--      err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
+-      err = pci_set_consistent_dma_mask(pdev, (u64) DMA_30BIT_MASK);
 -      if (err) {
 -              dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n");
 -              goto err_out_free_res;
@@ -1237,7 +1238,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        bp->rx_pending = B44_DEF_RX_RING_PENDING;
        bp->tx_pending = B44_DEF_TX_RING_PENDING;
  
-@@ -2205,16 +2345,16 @@
+@@ -2211,16 +2351,16 @@
        dev->poll_controller = b44_poll_controller;
  #endif
        dev->change_mtu = b44_change_mtu;
@@ -1257,7 +1258,7 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
        }
  
        bp->mii_if.dev = dev;
-@@ -2233,61 +2373,52 @@
+@@ -2239,61 +2379,52 @@
  
        err = register_netdev(dev);
        if (err) {
@@ -1335,8 +1336,8 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
  
        del_timer_sync(&bp->timer);
  
-@@ -2305,19 +2436,15 @@
-               b44_init_hw(bp, 0);
+@@ -2311,26 +2442,16 @@
+               b44_init_hw(bp, B44_PARTIAL_RESET);
                b44_setup_wol(bp);
        }
 -      pci_disable_device(pdev);
@@ -1350,15 +1351,22 @@ diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
 -      struct net_device *dev = pci_get_drvdata(pdev);
 +      struct net_device *dev = ssb_get_drvdata(pdev);
        struct b44 *bp = netdev_priv(dev);
+       int rc = 0;
  
 -      pci_restore_state(pdev);
--      pci_enable_device(pdev);
+-      rc = pci_enable_device(pdev);
+-      if (rc) {
+-              printk(KERN_ERR PFX "%s: pci_enable_device failed\n",
+-                      dev->name);
+-              return rc;
+-      }
+-
 -      pci_set_master(pdev);
 -
        if (!netif_running(dev))
                return 0;
  
-@@ -2339,29 +2466,31 @@
+@@ -2356,29 +2477,31 @@
        return 0;
  }
  
@@ -1525,7 +1533,7 @@ diff -urN linux.old/drivers/net/b44.h linux.dev/drivers/net/b44.h
 diff -urN linux.old/drivers/net/Kconfig linux.dev/drivers/net/Kconfig
 --- linux.old/drivers/net/Kconfig      2007-01-03 02:25:09.000000000 +0100
 +++ linux.dev/drivers/net/Kconfig      2007-01-03 02:26:02.000000000 +0100
-@@ -1525,7 +1525,7 @@
+@@ -1511,7 +1511,7 @@
  
  config B44
        tristate "Broadcom 4400 ethernet support"
This page took 0.042072 seconds and 4 git commands to generate.