-diff -urN orig/linux-2.6.15/drivers/net/b44.c linux-2.6.15/drivers/net/b44.c
---- orig/linux-2.6.15/drivers/net/b44.c 2006-01-03 04:21:10.000000000 +0100
-+++ linux-2.6.15/drivers/net/b44.c 2006-01-12 12:22:58.760883688 +0100
+diff -urN linux.old/drivers/net/b44.c linux.dev/drivers/net/b44.c
+--- linux.old/drivers/net/b44.c 2006-01-16 20:35:09.203794500 +0100
++++ linux.dev/drivers/net/b44.c 2006-01-16 22:20:45.631180500 +0100
@@ -1,7 +1,9 @@
-/* b44.c: Broadcom 4400 device driver.
+/* b44.c: Broadcom 4400/47xx device driver.
return 0;
}
-@@ -313,14 +334,14 @@
+@@ -277,6 +298,30 @@
+ == SBTMSLOW_CLOCK);
+ }
+
++#ifdef CONFIG_BCM947XX
++static inline void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
++{
++ u32 val;
++
++ bw32(bp, B44_CAM_CTRL, (CAM_CTRL_READ |
++ (index << CAM_CTRL_INDEX_SHIFT)));
++
++ b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
++
++ val = br32(bp, B44_CAM_DATA_LO);
++
++ data[2] = (val >> 24) & 0xFF;
++ data[3] = (val >> 16) & 0xFF;
++ data[4] = (val >> 8) & 0xFF;
++ data[5] = (val >> 0) & 0xFF;
++
++ val = br32(bp, B44_CAM_DATA_HI);
++
++ data[0] = (val >> 8) & 0xFF;
++ data[1] = (val >> 0) & 0xFF;
++}
++#endif
++
+ static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
+ {
+ u32 val;
+@@ -313,14 +358,14 @@
bw32(bp, B44_IMASK, bp->imask);
}
(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);
-@@ -329,18 +350,34 @@
+@@ -329,18 +374,34 @@
return err;
}
/* 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.
-@@ -369,6 +406,8 @@
+@@ -369,6 +430,8 @@
u32 val;
int err;
err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
if (err)
return err;
-@@ -439,6 +478,30 @@
+@@ -439,6 +502,22 @@
u32 val;
int err;
+#ifdef CONFIG_BCM947XX
-+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
-+ /*
-+ * workaround for bad hardware design in Linksys WAP54G v1.0
-+ * see https://dev.openwrt.org/ticket/146
-+ * check and reset bit "isolate"
-+ */
-+ if (!strcmp(nvram_get("boardnum"), "2\r")) {
-+ u32 val;
-+ if (__b44_readphy(bp, 0, MII_BMCR, &val) != 0) {
-+ printk(KERN_WARNING PFX "%s: PHY WAP54G: cannot access PHY.\n",
-+ bp->dev->name);
-+ } else if (val & BMCR_ISOLATE) {
-+ printk(KERN_INFO PFX "%s: PHY WAP54G: resetting isolate bit.\n",
-+ bp->dev->name);
-+ if (__b44_writephy(bp, 0, MII_BMCR, val & ~BMCR_ISOLATE) != 0)
-+ printk(KERN_WARNING PFX "PHY WAP54G: cannot reset isolate bit.\n");
-+ }
-+ }
++ /*
++ * workaround for bad hardware design in Linksys WAP54G v1.0
++ * see https://dev.openwrt.org/ticket/146
++ * check and reset bit "isolate"
++ */
++ if ((bp->pdev->device == PCI_DEVICE_ID_BCM4713) &&
++ (atoi(nvram_get("boardnum")) == 2) &&
++ (__b44_readphy(bp, 0, MII_BMCR, &val) == 0) &&
++ (val & BMCR_ISOLATE) &&
++ (__b44_writephy(bp, 0, MII_BMCR, val & ~BMCR_ISOLATE) != 0)) {
++ printk(KERN_WARNING PFX "PHY: cannot reset MII transceiver isolate bit.\n");
+ }
+#endif
-+
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+ return 0;
if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
goto out;
if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
-@@ -534,6 +597,19 @@
+@@ -534,6 +613,19 @@
{
u32 bmsr, aux;
if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
!b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
(bmsr != 0xffff)) {
-@@ -1281,9 +1357,10 @@
+@@ -1281,9 +1373,10 @@
bw32(bp, B44_DMARX_CTRL, 0);
bp->rx_prod = bp->rx_cons = 0;
} else {
}
ssb_core_reset(bp);
-@@ -1291,8 +1368,14 @@
+@@ -1291,8 +1384,14 @@
b44_clear_stats(bp);
/* Make PHY accessible. */
br32(bp, B44_MDIO_CTRL);
if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
-@@ -1834,18 +1917,297 @@
+@@ -1834,18 +1933,297 @@
.get_perm_addr = ethtool_op_get_perm_addr,
};
out:
return err;
}
-@@ -1865,22 +2227,43 @@
+@@ -1865,22 +2243,55 @@
static int __devinit b44_get_invariants(struct b44 *bp)
{
u8 eeprom[128];
- int err;
-+ u8 buf[32];
-+ int err = 0;
-
+-
- err = b44_read_eeprom(bp, &eeprom[0]);
- if (err)
- goto out;
- memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len);
-
- bp->phy_addr = eeprom[90] & 0x1f;
++ u8 buf[32];
++ int err = 0;
++ unsigned long flags;
++
+#ifdef CONFIG_BCM947XX
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
+ /*
+ * a NVRAM area somewhere in the flash memory.
+ */
+ sprintf(buf, "et%dmacaddr", b44_4713_instance);
-+ e_aton(nvram_get(buf), bp->dev->dev_addr);
++ if (nvram_get(buf)) {
++ e_aton(nvram_get(buf), bp->dev->dev_addr);
++ } else {
++ /*
++ * Getting the MAC out of NVRAM failed. To make it work
++ * here, we simply rely on the bootloader to write the
++ * MAC into the CAM.
++ */
++ spin_lock_irqsave(&bp->lock, flags);
++ __b44_cam_read(bp, bp->dev->dev_addr, 0);
++ spin_unlock_irqrestore(&bp->lock, flags);
++ }
+ /*
+ * BCM47xx boards don't have a PHY. Usually there is a switch
/* With this, plus the rx_header prepended to the data by the
* hardware, we'll land the ethernet header on a 2-byte boundary.
*/
-@@ -1889,11 +2272,7 @@
+@@ -1889,11 +2300,7 @@
bp->imask = IMASK_DEF;
bp->core_unit = ssb_core_unit(bp);
out:
return err;
}
-@@ -2032,11 +2411,17 @@
+@@ -2032,11 +2439,17 @@
pci_save_state(bp->pdev);
return 0;
err_out_iounmap:
-diff -urN orig/linux-2.6.15/drivers/net/b44.h linux-2.6.15/drivers/net/b44.h
---- orig/linux-2.6.15/drivers/net/b44.h 2006-01-03 04:21:10.000000000 +0100
-+++ linux-2.6.15/drivers/net/b44.h 2006-01-12 12:16:02.403179680 +0100
+diff -urN linux.old/drivers/net/b44.h linux.dev/drivers/net/b44.h
+--- linux.old/drivers/net/b44.h 2006-01-16 20:35:09.255797750 +0100
++++ linux.dev/drivers/net/b44.h 2006-01-16 20:30:30.566380750 +0100
@@ -292,6 +292,10 @@
#define SSB_PCI_MASK1 0xfc000000
#define SSB_PCI_MASK2 0xc0000000