X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/769ee01960e4241017ab9f9f760fc51c1141bf90..7f9cbfdbd66ac6b0cd8862795bb7eb149605b349:/target/linux/brcm47xx/patches-2.6.23/120-b44_ssb_support.patch?ds=sidebyside diff --git a/target/linux/brcm47xx/patches-2.6.23/120-b44_ssb_support.patch b/target/linux/brcm47xx/patches-2.6.23/120-b44_ssb_support.patch index e8114c6bb..4f33615a5 100644 --- a/target/linux/brcm47xx/patches-2.6.23/120-b44_ssb_support.patch +++ b/target/linux/brcm47xx/patches-2.6.23/120-b44_ssb_support.patch @@ -1,7 +1,5 @@ -Index: linux-2.6.23/drivers/net/b44.c -=================================================================== ---- linux-2.6.23.orig/drivers/net/b44.c 2007-10-09 22:31:38.000000000 +0200 -+++ linux-2.6.23/drivers/net/b44.c 2007-10-13 02:46:38.946989430 +0200 +--- a/drivers/net/b44.c ++++ b/drivers/net/b44.c @@ -1,7 +1,9 @@ -/* b44.c: Broadcom 4400 device driver. +/* b44.c: Broadcom 4400/47xx device driver. @@ -107,7 +105,7 @@ Index: linux-2.6.23/drivers/net/b44.c + unsigned long offset, + enum dma_data_direction dir) +{ -+ dma_sync_single_range_for_device(&sdev->dev, dma_base, ++ dma_sync_single_range_for_device(sdev->dev, dma_base, + offset & dma_desc_align_mask, + dma_desc_sync_size, dir); +} @@ -117,7 +115,7 @@ Index: linux-2.6.23/drivers/net/b44.c + unsigned long offset, + enum dma_data_direction dir) +{ -+ dma_sync_single_range_for_cpu(&sdev->dev, dma_base, ++ dma_sync_single_range_for_cpu(sdev->dev, dma_base, + offset & dma_desc_align_mask, + dma_desc_sync_size, dir); } @@ -370,7 +368,7 @@ Index: linux-2.6.23/drivers/net/b44.c BUG_ON(skb == NULL); - pci_unmap_single(bp->pdev, -+ dma_unmap_single(&bp->sdev->dev, ++ dma_unmap_single(bp->sdev->dev, pci_unmap_addr(rp, mapping), skb->len, - PCI_DMA_TODEVICE); @@ -383,7 +381,7 @@ Index: linux-2.6.23/drivers/net/b44.c return -ENOMEM; - mapping = pci_map_single(bp->pdev, skb->data, -+ mapping = dma_map_single(&bp->sdev->dev, skb->data, ++ mapping = dma_map_single(bp->sdev->dev, skb->data, RX_PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); @@ -395,13 +393,13 @@ Index: linux-2.6.23/drivers/net/b44.c /* Sigh... */ 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); ++ dma_unmap_single(bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); dev_kfree_skb_any(skb); skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); if (skb == NULL) return -ENOMEM; - mapping = pci_map_single(bp->pdev, skb->data, -+ mapping = dma_map_single(&bp->sdev->dev, skb->data, ++ mapping = dma_map_single(bp->sdev->dev, skb->data, RX_PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); @@ -409,7 +407,7 @@ Index: linux-2.6.23/drivers/net/b44.c 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); ++ dma_unmap_single(bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); dev_kfree_skb_any(skb); return -ENOMEM; } @@ -451,7 +449,7 @@ Index: linux-2.6.23/drivers/net/b44.c + DMA_BIDIRECTIONAL); - 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), ++ dma_sync_single_for_device(bp->sdev->dev, le32_to_cpu(src_desc->addr), RX_PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); @@ -463,7 +461,7 @@ Index: linux-2.6.23/drivers/net/b44.c u16 len; - pci_dma_sync_single_for_cpu(bp->pdev, map, -+ dma_sync_single_for_cpu(&bp->sdev->dev, map, ++ dma_sync_single_for_cpu(bp->sdev->dev, map, RX_PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); + DMA_FROM_DEVICE); @@ -476,7 +474,7 @@ Index: linux-2.6.23/drivers/net/b44.c goto drop_it; - pci_unmap_single(bp->pdev, map, - skb_size, PCI_DMA_FROMDEVICE); -+ dma_unmap_single(&bp->sdev->dev, map, ++ dma_unmap_single(bp->sdev->dev, map, + skb_size, DMA_FROM_DEVICE); /* Leave out rx_header */ skb_put(skb, len + RX_PKT_OFFSET); @@ -486,14 +484,14 @@ Index: linux-2.6.23/drivers/net/b44.c } - 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); ++ mapping = dma_map_single(bp->sdev->dev, skb->data, len, DMA_TO_DEVICE); if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { struct sk_buff *bounce_skb; /* 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); -+ dma_unmap_single(&bp->sdev->dev, mapping, len, DMA_TO_DEVICE); ++ dma_unmap_single(bp->sdev->dev, mapping, len, DMA_TO_DEVICE); bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA); if (!bounce_skb) @@ -501,13 +499,13 @@ Index: linux-2.6.23/drivers/net/b44.c - mapping = pci_map_single(bp->pdev, bounce_skb->data, - len, PCI_DMA_TODEVICE); -+ mapping = dma_map_single(&bp->sdev->dev, bounce_skb->data, ++ mapping = dma_map_single(bp->sdev->dev, bounce_skb->data, + len, DMA_TO_DEVICE); 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); -+ dma_unmap_single(&bp->sdev->dev, mapping, ++ dma_unmap_single(bp->sdev->dev, mapping, + len, DMA_TO_DEVICE); dev_kfree_skb_any(bounce_skb); goto err_out; @@ -530,7 +528,7 @@ Index: linux-2.6.23/drivers/net/b44.c if (rp->skb == NULL) continue; - pci_unmap_single(bp->pdev, -+ dma_unmap_single(&bp->sdev->dev, ++ dma_unmap_single(bp->sdev->dev, pci_unmap_addr(rp, mapping), RX_PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); @@ -543,7 +541,7 @@ Index: linux-2.6.23/drivers/net/b44.c if (rp->skb == NULL) continue; - pci_unmap_single(bp->pdev, -+ dma_unmap_single(&bp->sdev->dev, ++ dma_unmap_single(bp->sdev->dev, pci_unmap_addr(rp, mapping), rp->skb->len, - PCI_DMA_TODEVICE); @@ -558,7 +556,7 @@ Index: linux-2.6.23/drivers/net/b44.c - dma_sync_single_for_device(&bp->pdev->dev, bp->rx_ring_dma, - DMA_TABLE_BYTES, - PCI_DMA_BIDIRECTIONAL); -+ dma_sync_single_for_device(&bp->sdev->dev, bp->rx_ring_dma, ++ dma_sync_single_for_device(bp->sdev->dev, bp->rx_ring_dma, + DMA_TABLE_BYTES, + DMA_BIDIRECTIONAL); @@ -566,7 +564,7 @@ Index: linux-2.6.23/drivers/net/b44.c - dma_sync_single_for_device(&bp->pdev->dev, bp->tx_ring_dma, - DMA_TABLE_BYTES, - PCI_DMA_TODEVICE); -+ dma_sync_single_for_device(&bp->sdev->dev, bp->tx_ring_dma, ++ dma_sync_single_for_device(bp->sdev->dev, bp->tx_ring_dma, + DMA_TABLE_BYTES, + DMA_TO_DEVICE); @@ -579,13 +577,13 @@ Index: linux-2.6.23/drivers/net/b44.c - dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma, - DMA_TABLE_BYTES, - DMA_BIDIRECTIONAL); -+ dma_unmap_single(&bp->sdev->dev, bp->rx_ring_dma, ++ dma_unmap_single(bp->sdev->dev, bp->rx_ring_dma, + DMA_TABLE_BYTES, + DMA_BIDIRECTIONAL); kfree(bp->rx_ring); } else - pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, -+ dma_free_coherent(&bp->sdev->dev, DMA_TABLE_BYTES, ++ dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, bp->rx_ring, bp->rx_ring_dma); bp->rx_ring = NULL; bp->flags &= ~B44_FLAG_RX_RING_HACK; @@ -595,13 +593,13 @@ Index: linux-2.6.23/drivers/net/b44.c - dma_unmap_single(&bp->pdev->dev, bp->tx_ring_dma, - DMA_TABLE_BYTES, - DMA_TO_DEVICE); -+ dma_unmap_single(&bp->sdev->dev, bp->tx_ring_dma, ++ dma_unmap_single(bp->sdev->dev, bp->tx_ring_dma, + DMA_TABLE_BYTES, + DMA_TO_DEVICE); kfree(bp->tx_ring); } else - pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, -+ dma_free_coherent(&bp->sdev->dev, DMA_TABLE_BYTES, ++ dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, bp->tx_ring, bp->tx_ring_dma); bp->tx_ring = NULL; bp->flags &= ~B44_FLAG_TX_RING_HACK; @@ -610,7 +608,7 @@ Index: linux-2.6.23/drivers/net/b44.c size = DMA_TABLE_BYTES; - bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); -+ bp->rx_ring = dma_alloc_coherent(&bp->sdev->dev, size, &bp->rx_ring_dma, GFP_ATOMIC); ++ bp->rx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->rx_ring_dma, GFP_ATOMIC); if (!bp->rx_ring) { /* Allocation may have failed due to pci_alloc_consistent insisting on use of GFP_DMA, which is more restrictive @@ -621,7 +619,7 @@ Index: linux-2.6.23/drivers/net/b44.c - rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, - DMA_TABLE_BYTES, - DMA_BIDIRECTIONAL); -+ rx_ring_dma = dma_map_single(&bp->sdev->dev, rx_ring, ++ rx_ring_dma = dma_map_single(bp->sdev->dev, rx_ring, + DMA_TABLE_BYTES, + DMA_BIDIRECTIONAL); @@ -632,7 +630,7 @@ Index: linux-2.6.23/drivers/net/b44.c } - bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma); -+ bp->tx_ring = dma_alloc_coherent(&bp->sdev->dev, size, &bp->tx_ring_dma, GFP_ATOMIC); ++ bp->tx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->tx_ring_dma, GFP_ATOMIC); if (!bp->tx_ring) { - /* Allocation may have failed due to pci_alloc_consistent + /* Allocation may have failed due to dma_alloc_coherent @@ -646,7 +644,7 @@ Index: linux-2.6.23/drivers/net/b44.c - tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, - DMA_TABLE_BYTES, - DMA_TO_DEVICE); -+ tx_ring_dma = dma_map_single(&bp->sdev->dev, tx_ring, ++ tx_ring_dma = dma_map_single(bp->sdev->dev, tx_ring, + DMA_TABLE_BYTES, + DMA_TO_DEVICE); @@ -663,7 +661,7 @@ Index: linux-2.6.23/drivers/net/b44.c bw32(bp, B44_RCV_LAZY, 0); bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1); -@@ -1294,19 +1242,23 @@ +@@ -1294,19 +1242,24 @@ } bw32(bp, B44_DMARX_CTRL, 0); bp->rx_prod = bp->rx_cons = 0; @@ -687,6 +685,7 @@ Index: linux-2.6.23/drivers/net/b44.c + & MDIO_CTRL_MAXF_MASK))); + break; + case SSB_BUSTYPE_PCI: ++ case SSB_BUSTYPE_PCMCIA: + bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | (0x0d & MDIO_CTRL_MAXF_MASK))); + break; @@ -695,7 +694,7 @@ Index: linux-2.6.23/drivers/net/b44.c br32(bp, B44_MDIO_CTRL); if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) { -@@ -1349,6 +1301,7 @@ +@@ -1349,6 +1302,7 @@ { struct b44 *bp = netdev_priv(dev); struct sockaddr *addr = p; @@ -703,7 +702,7 @@ Index: linux-2.6.23/drivers/net/b44.c if (netif_running(dev)) return -EBUSY; -@@ -1359,7 +1312,11 @@ +@@ -1359,7 +1313,11 @@ memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); spin_lock_irq(&bp->lock); @@ -716,7 +715,7 @@ Index: linux-2.6.23/drivers/net/b44.c spin_unlock_irq(&bp->lock); return 0; -@@ -1445,18 +1402,6 @@ +@@ -1445,18 +1403,6 @@ return err; } @@ -735,7 +734,7 @@ Index: linux-2.6.23/drivers/net/b44.c #ifdef CONFIG_NET_POLL_CONTROLLER /* * Polling receive - used by netconsole and other diagnostic tools -@@ -1570,7 +1515,6 @@ +@@ -1570,7 +1516,6 @@ static void b44_setup_wol(struct b44 *bp) { u32 val; @@ -743,7 +742,7 @@ Index: linux-2.6.23/drivers/net/b44.c bw32(bp, B44_RXCONFIG, RXCONFIG_ALLMULTI); -@@ -1594,13 +1538,6 @@ +@@ -1594,13 +1539,6 @@ } else { b44_setup_pseudo_magicp(bp); } @@ -757,7 +756,7 @@ Index: linux-2.6.23/drivers/net/b44.c } static int b44_close(struct net_device *dev) -@@ -1700,7 +1637,7 @@ +@@ -1700,7 +1638,7 @@ val = br32(bp, B44_RXCONFIG); val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); @@ -766,7 +765,7 @@ Index: linux-2.6.23/drivers/net/b44.c val |= RXCONFIG_PROMISC; bw32(bp, B44_RXCONFIG, val); } else { -@@ -1747,12 +1684,8 @@ +@@ -1747,12 +1685,8 @@ static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) { @@ -779,7 +778,7 @@ Index: linux-2.6.23/drivers/net/b44.c } static int b44_nway_reset(struct net_device *dev) -@@ -2035,6 +1968,245 @@ +@@ -2035,6 +1969,245 @@ .get_ethtool_stats = b44_get_ethtool_stats, }; @@ -1025,7 +1024,7 @@ Index: linux-2.6.23/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); -@@ -2044,40 +2216,64 @@ +@@ -2044,40 +2217,64 @@ if (!netif_running(dev)) goto out; @@ -1102,12 +1101,12 @@ Index: linux-2.6.23/drivers/net/b44.c - bp->dev->dev_addr[5] = eeprom[82]; + switch (instance) { + case 1: -+ addr = sdev->bus->sprom.r1.et0mac; -+ bp->phy_addr = sdev->bus->sprom.r1.et0phyaddr; ++ addr = sdev->bus->sprom.et0mac; ++ bp->phy_addr = sdev->bus->sprom.et0phyaddr; + break; + default: -+ addr = sdev->bus->sprom.r1.et1mac; -+ bp->phy_addr = sdev->bus->sprom.r1.et1phyaddr; ++ addr = sdev->bus->sprom.et1mac; ++ bp->phy_addr = sdev->bus->sprom.et1phyaddr; + break; + } + @@ -1115,7 +1114,7 @@ Index: linux-2.6.23/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"); -@@ -2086,26 +2282,20 @@ +@@ -2086,103 +2283,52 @@ memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len); @@ -1131,7 +1130,7 @@ Index: linux-2.6.23/drivers/net/b44.c */ - if (ssb_get_core_rev(bp) >= 7) -+ if (bp->sdev->dev->id.revision >= 7) ++ if (bp->sdev->id.revision >= 7) bp->flags |= B44_FLAG_B0_ANDLATER; -out: @@ -1144,8 +1143,8 @@ Index: linux-2.6.23/drivers/net/b44.c + const struct ssb_device_id *ent) { static int b44_version_printed = 0; - unsigned long b44reg_base, b44reg_len; -@@ -2113,76 +2303,32 @@ +- unsigned long b44reg_base, b44reg_len; + struct net_device *dev; struct b44 *bp; int err, i; @@ -1195,7 +1194,8 @@ Index: linux-2.6.23/drivers/net/b44.c - dev = alloc_etherdev(sizeof(*bp)); if (!dev) { - dev_err(&pdev->dev, "Etherdev alloc failed, aborting.\n"); +- dev_err(&pdev->dev, "Etherdev alloc failed, aborting.\n"); ++ dev_err(sdev->dev, "Etherdev alloc failed, aborting.\n"); err = -ENOMEM; - goto err_out_free_res; + goto out; @@ -1203,7 +1203,7 @@ Index: linux-2.6.23/drivers/net/b44.c SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev,&pdev->dev); -+ SET_NETDEV_DEV(dev,&sdev->dev); ++ SET_NETDEV_DEV(dev,sdev->dev); /* No interesting netdevice features in this card... */ dev->features |= 0; @@ -1240,7 +1240,7 @@ Index: linux-2.6.23/drivers/net/b44.c err = b44_get_invariants(bp); if (err) { - dev_err(&pdev->dev, -+ dev_err(&sdev->dev, ++ dev_err(sdev->dev, "Problem fetching invariants of chip, aborting.\n"); - goto err_out_iounmap; + goto err_out_free_dev; @@ -1253,7 +1253,7 @@ Index: linux-2.6.23/drivers/net/b44.c if (err) { - dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); - goto err_out_iounmap; -+ dev_err(&sdev->dev, "Cannot register net device, aborting.\n"); ++ dev_err(sdev->dev, "Cannot register net device, aborting.\n"); + goto out; } @@ -1325,7 +1325,7 @@ Index: linux-2.6.23/drivers/net/b44.c del_timer_sync(&bp->timer); -@@ -2301,26 +2438,16 @@ +@@ -2301,33 +2438,22 @@ b44_init_hw(bp, B44_PARTIAL_RESET); b44_setup_wol(bp); } @@ -1355,7 +1355,14 @@ Index: linux-2.6.23/drivers/net/b44.c if (!netif_running(dev)) return 0; -@@ -2346,29 +2473,31 @@ + rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev); + if (rc) { + printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name); +- pci_disable_device(pdev); + return rc; + } + +@@ -2346,29 +2472,31 @@ return 0; } @@ -1393,10 +1400,8 @@ Index: linux-2.6.23/drivers/net/b44.c } module_init(b44_init); -Index: linux-2.6.23/drivers/net/b44.h -=================================================================== ---- linux-2.6.23.orig/drivers/net/b44.h 2007-10-09 22:31:38.000000000 +0200 -+++ linux-2.6.23/drivers/net/b44.h 2007-10-13 02:28:25.848697310 +0200 +--- a/drivers/net/b44.h ++++ b/drivers/net/b44.h @@ -129,6 +129,7 @@ #define RXCONFIG_FLOW 0x00000020 /* Flow Control Enable */ #define RXCONFIG_FLOW_ACCEPT 0x00000040 /* Accept Unicast Flow Control Frame */ @@ -1520,10 +1525,8 @@ Index: linux-2.6.23/drivers/net/b44.h struct net_device *dev; dma_addr_t rx_ring_dma, tx_ring_dma; -Index: linux-2.6.23/drivers/net/Kconfig -=================================================================== ---- linux-2.6.23.orig/drivers/net/Kconfig 2007-10-13 02:19:47.919182188 +0200 -+++ linux-2.6.23/drivers/net/Kconfig 2007-10-13 02:28:25.860697993 +0200 +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig @@ -1577,7 +1577,7 @@ config B44