Skip to contentSkip to conversation

b44: Cleanup and bcm47xx support

PATCH In review Florian Schirmer 5 participants 18 messages Aug 29, 2004 – Sep 17, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover b44: Cleanup and bcm47xx support

Hi,

here is the second try to add bcm47xx support to the b44 driver. Changes since the first version:

- Splitted the patch into logical hunks
- Ignore carrier lost errors (buggy hardware)
- Added CAM read support
- Read MAC from CAM instead of hardcoding a dummy MAC into the driver
- Use a special PHY address (0x30) to indicate that there is no PHY (this is compatible with the Broadcom et and 4401 driver)
- Added MDIO value calculation based on the backplane speed

Comments welcome!

Regards,
Florian

#1 lore raw

PATCH 1/4 b44: Ignore carrier lost errors

Hi,

some (?) hardware seems to be buggy and is reporting bogus carrier lost values. Both reference implementations from Broadcom indicate that this counter is not reliable and therefore ignore it. We should do the same. "Fixes" the carrier lost problem i've seen.

Regards,
Florian

drivers/net/b44.c 2004-08-29 16:27:00.000000000 +0200 renamed from drivers/net/b44.c-old1 2004-08-29 16:29:08.000000000 +0200 +3 -0
@@ -1347,7 +1347,10 @@ static struct net_device_stats *b44_get_
        hwstat->rx_symbol_errs);
 
  nstat->tx_aborted_errors = hwstat->tx_underruns;
+#if 0
+ /* Carrier lost counter seems to be broken for some devices */
  nstat->tx_carrier_errors = hwstat->tx_carrier_lost;
+#endif
 
  return nstat;
 }
#12 lore raw

PATCH 2/4 b44: Cleanup SiliconBackplane definitions/functions

In reply to Florian Schirmer

Hi,

there is a good amount of code to support SiliconBackplane functions which are unneeded or simply plain wrong. Lets get rid of it.

Regards,
Florian

drivers/net/b44.c 2004-08-29 16:59:24.000000000 +0200 renamed from drivers/net/b44.c-old2 2004-08-29 16:27:00.000000000 +0200 +4 -39
@@ -130,41 +130,8 @@ static int b44_wait_bit(struct b44 *bp, 
  * interrupts disabled.
  */
 
-#define SBID_SDRAM  0
-#define SBID_PCI_MEM  1
-#define SBID_PCI_CFG  2
-#define SBID_PCI_DMA  3
-#define SBID_SDRAM_SWAPPED 4
-#define SBID_ENUM  5
-#define SBID_REG_SDRAM  6
-#define SBID_REG_ILINE20 7
-#define SBID_REG_EMAC  8
-#define SBID_REG_CODEC  9
-#define SBID_REG_USB  10
-#define SBID_REG_PCI  11
-#define SBID_REG_MIPS  12
-#define SBID_REG_EXTIF  13
-#define SBID_EXTIF  14
-#define SBID_EJTAG  15
-#define SBID_MAX  16
-
-static u32 ssb_get_addr(struct b44 *bp, u32 id, u32 instance)
-{
- switch (id) {
- case SBID_PCI_DMA:
-  return 0x40000000;
- case SBID_ENUM:
-  return 0x18000000;
- case SBID_REG_EMAC:
-  return 0x18000000;
- case SBID_REG_CODEC:
-  return 0x18001000;
- case SBID_REG_PCI:
-  return 0x18002000;
- default:
-  return 0;
- };
-}
+#define SB_PCI_DMA             0x40000000      /* Client Mode PCI memory access space (1 GB) */
+#define BCM4400_PCI_CORE_ADDR  0x18002000      /* Address of PCI core on BCM4400 cards */
 
 static u32 ssb_get_core_rev(struct b44 *bp)
 {
@@ -176,8 +143,7 @@ static u32 ssb_pci_setup(struct b44 *bp,
  u32 bar_orig, pci_rev, val;
 
  pci_read_config_dword(bp->pdev, SSB_BAR0_WIN, &bar_orig);
- pci_write_config_dword(bp->pdev, SSB_BAR0_WIN,
-          ssb_get_addr(bp, SBID_REG_PCI, 0));
+ pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, BCM4400_PCI_CORE_ADDR);
  pci_rev = ssb_get_core_rev(bp);
 
  val = br32(B44_SBINTVEC);
@@ -1676,7 +1642,6 @@ static int __devinit b44_get_invariants(
  bp->dev->dev_addr[5] = eeprom[82];
 
  bp->phy_addr = eeprom[90] & 0x1f;
- bp->mdc_port = (eeprom[90] >> 14) & 0x1;
 
  /* With this, plus the rx_header prepended to the data by the
   * hardware, we'll land the ethernet header on a 2-byte boundary.
@@ -1686,7 +1651,7 @@ static int __devinit b44_get_invariants(
  bp->imask = IMASK_DEF;
 
  bp->core_unit = ssb_core_unit(bp);
- bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0);
+ bp->dma_offset = SB_PCI_DMA;
 
  /* XXX - really required? 
     bp->flags |= B44_FLAG_BUGGY_TXPTR;
drivers/net/b44.h 2004-08-29 17:06:44.000000000 +0200 renamed from drivers/net/b44.h-old2 2004-08-29 16:25:36.000000000 +0200 +3 -107

140 lines not on this page · raw message

#14 lore raw

PATCH 3/4 b44: Add support for PHY-less cards

In reply to Florian Schirmer

Hi,

add support for PHY-less cards by using a special magic PHY address. This is compatible with the way Broadcom drivers handle that. We don't have to waste a flags bit for that.

Regards,
Florian

drivers/net/b44.c 2004-08-29 17:24:23.000000000 +0200 renamed from drivers/net/b44.c-old3 2004-08-29 16:59:24.000000000 +0200 +25 -0
@@ -273,6 +273,9 @@ static int b44_readphy(struct b44 *bp, i
 {
  int err;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
  bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
         (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
@@ -287,6 +290,9 @@ static int b44_readphy(struct b44 *bp, i
 
 static int b44_writephy(struct b44 *bp, int reg, u32 val)
 {
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
  bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
         (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
@@ -325,6 +331,9 @@ static int b44_phy_reset(struct b44 *bp)
  u32 val;
  int err;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
  if (err)
   return err;
@@ -395,6 +404,9 @@ static int b44_setup_phy(struct b44 *bp)
  u32 val;
  int err;
 
+ 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,
@@ -487,6 +499,19 @@ static void b44_check_phy(struct b44 *bp
 {
  u32 bmsr, aux;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
+  bp->flags |= B44_FLAG_100_BASE_T;
+  bp->flags |= B44_FLAG_FULL_DUPLEX;
+  if (!netif_carrier_ok(bp->dev)) {
+   u32 val = br32(B44_TX_CTRL);
+   val |= TX_CTRL_DUPLEX;
+   bw32(B44_TX_CTRL, val);
+   netif_carrier_on(bp->dev);
+   b44_link_report(bp);
+  }
+  return;
+ }
+
  if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
      !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
      (bmsr != 0xffff)) {
drivers/net/b44.h 2004-08-29 17:24:53.000000000 +0200 renamed from drivers/net/b44.h-old3 2004-08-29 17:06:44.000000000 +0200 +1 -0
@@ -362,6 +362,7 @@ struct ring_info {
 };
 
 #define B44_MCAST_TABLE_SIZE 32
+#define B44_PHY_ADDR_NO_PHY 30
 
 /* SW copy of device statistics, kept up to date by periodic timer
  * which probes HW values.  Must have same relative layout as HW
#15 lore raw

PATCH 4/4 b44: Add bcm47xx support

In reply to Florian Schirmer

Hi,

finally add bcm47xx support using the infrastructure created by the earlier patches.

Regards,
Florian

drivers/net/b44.c 2004-08-29 18:48:45.000000000 +0200 renamed from drivers/net/b44.c-old4 2004-08-29 17:24:23.000000000 +0200 +85 -44
@@ -1,7 +1,8 @@
-/* b44.c: Broadcom 4400 device driver.
+/* b44.c: Broadcom 4400/47xx device driver.
  *
  * Copyright (C) 2002 David S. Miller ([email protected])
- * Fixed by Pekka Pietikainen ([email protected])
+ * Copyright (C) 2004 Pekka Pietikainen ([email protected])
+ * Copyright (C) 2004 Florian Schirmer ([email protected])
  *
  * Distribute under GPL.
  */
@@ -75,7 +76,7 @@ static char version[] __devinitdata =
  DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
 
 MODULE_AUTHOR("David S. Miller ([email protected])");
-MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
+MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver");
 MODULE_LICENSE("GPL");
 MODULE_PARM(b44_debug, "i");
 MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
@@ -89,6 +90,8 @@ static struct pci_device_id b44_pci_tbl[
    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
  { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+ { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
  { } /* terminate list with empty entry */
 };
 
@@ -202,29 +205,14 @@ static void ssb_core_reset(struct b44 *b
  udelay(1);
 }
 
+static int b44_4713_instance;
+
 static int ssb_core_unit(struct b44 *bp)
 {
-#if 0
- u32 val = br32(B44_SBADMATCH0);
- u32 base;
-
- type = val & SBADMATCH0_TYPE_MASK;
- switch (type) {
- case 0:
-  base = val & SBADMATCH0_BS0_MASK;
-  break;
-
- case 1:
-  base = val & SBADMATCH0_BS1_MASK;
-  break;
-
- case 2:
- default:
-  base = val & SBADMATCH0_BS2_MASK;
-  break;
- };
-#endif
- return 0;
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
+  return b44_4713_instance++;
+ else
+  return 0;
 }
 
 static int ssb_is_core_up(struct b44 *bp)
@@ -233,6 +221,28 @@ static int ssb_is_core_up(struct b44 *bp
   == SBTMSLOW_CLOCK);
 }
 
+static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
+{
+ u32 val;
+
+ bw32(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(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(B44_CAM_DATA_HI);
+ 
+ data[0] = (val >> 8) & 0xFF;
+ data[1] = (val >> 0) & 0xFF;
+}
+
 static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
 {
  u32 val;
@@ -1110,6 +1120,8 @@ static void b44_clear_stats(struct b44 *
 /* bp->lock is held. */
 static void b44_chip_reset(struct b44 *bp)
 {
+ unsigned int sb_clock;
+
  if (ssb_is_core_up(bp)) {
   bw32(B44_RCV_LAZY, 0);
   bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
@@ -1123,9 +1135,10 @@ static void b44_chip_reset(struct b44 *b
   bw32(B44_DMARX_CTRL, 0);
   bp->rx_prod = bp->rx_cons = 0;
  } else {
-  ssb_pci_setup(bp, (bp->core_unit == 0 ?
-       SBINTVEC_ENET0 :
-       SBINTVEC_ENET1));
+  if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)
+   ssb_pci_setup(bp, (bp->core_unit == 0 ?
+        SBINTVEC_ENET0 :
+        SBINTVEC_ENET1));
  }
 
  ssb_core_reset(bp);
@@ -1133,8 +1146,14 @@ static void b44_chip_reset(struct b44 *b
  b44_clear_stats(bp);
 
  /* Make PHY accessible. */
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
+  sb_clock = 100000000; /* 100 MHz */
+ else
+  sb_clock = 62500000; /* 62.5 MHz */
+
  bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
-        (0x0d & MDIO_CTRL_MAXF_MASK)));
+        (((sb_clock + (B44_MDC_RATIO / 2)) / B44_MDC_RATIO)
+        & MDIO_CTRL_MAXF_MASK)));
  br32(B44_MDIO_CTRL);
 
  if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) {
@@ -1654,19 +1673,41 @@ static int __devinit b44_get_invariants(
 {
  u8 eeprom[128];
  int err;
+ unsigned long flags;
 
- err = b44_read_eeprom(bp, &eeprom[0]);
- if (err)
-  goto out;
-
- bp->dev->dev_addr[0] = eeprom[79];
- bp->dev->dev_addr[1] = eeprom[78];
- bp->dev->dev_addr[2] = eeprom[81];
- bp->dev->dev_addr[3] = eeprom[80];
- bp->dev->dev_addr[4] = eeprom[83];
- bp->dev->dev_addr[5] = eeprom[82];
-
- bp->phy_addr = eeprom[90] & 0x1f;
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
+  /* 
+   * BCM47xx boards don't have a EEPROM. The MAC is stored in
+   * a NVRAM area somewhere in the flash memory. As we don't
+   * know the location and/or the format of the NVRAM area
+   * 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
+   * chip with multiple PHYs connected to the PHY port.
+   */
+  bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+  bp->dma_offset = 0;
+ } else {
+  err = b44_read_eeprom(bp, &eeprom[0]);
+  if (err)
+   return err;
+
+  bp->dev->dev_addr[0] = eeprom[79];
+  bp->dev->dev_addr[1] = eeprom[78];
+  bp->dev->dev_addr[2] = eeprom[81];
+  bp->dev->dev_addr[3] = eeprom[80];
+  bp->dev->dev_addr[4] = eeprom[83];
+  bp->dev->dev_addr[5] = eeprom[82];
+
+  bp->phy_addr = eeprom[90] & 0x1f;
+  bp->dma_offset = SB_PCI_DMA;
+ } 
 
  /* With this, plus the rx_header prepended to the data by the
   * hardware, we'll land the ethernet header on a 2-byte boundary.
@@ -1676,13 +1717,12 @@ static int __devinit b44_get_invariants(
  bp->imask = IMASK_DEF;
 
  bp->core_unit = ssb_core_unit(bp);
- bp->dma_offset = SB_PCI_DMA;
 
  /* XXX - really required? 
     bp->flags |= B44_FLAG_BUGGY_TXPTR;
          */
-out:
- return err;
+
+ return 0;
 }
 
 static int __devinit b44_init_one(struct pci_dev *pdev,
@@ -1811,7 +1851,8 @@ static int __devinit b44_init_one(struct
 
  pci_save_state(bp->pdev, bp->pci_cfg_state);
 
- printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
+ printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name,
+  (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400");
  for (i = 0; i < 6; i++)
   printk("%2.2x%c", dev->dev_addr[i],
          i == 5 ? '\n' : ':');
drivers/net/b44.h 2004-08-29 18:42:56.000000000 +0200 renamed from drivers/net/b44.h-old4 2004-08-29 17:24:53.000000000 +0200 +1 -0
@@ -363,6 +363,7 @@ struct ring_info {
 
 #define B44_MCAST_TABLE_SIZE 32
 #define B44_PHY_ADDR_NO_PHY 30
+#define B44_MDC_RATIO  5000000
 
 /* SW copy of device statistics, kept up to date by periodic timer
  * which probes HW values.  Must have same relative layout as HW
#2 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

In reply to Florian Schirmer

Your mailer is mangling the patches. Can you please resend without this?

The patches need to be apply-able without MIME massaging.

Jeff

=2D-- linux/drivers/net/b44.c-old1 2004-08-29 16:29:08.000000000 +0200 +++ linux/drivers/net/b44.c 2004-08-29 16:27:00.000000000 +0200 @@ -1347,7 +1347,10 @@ static struct net_device_stats *b44_get_

        hwstat->rx_symbol_errs);

=20
nstat->tx_aborted_errors =3D hwstat->tx_underruns;
+#if 0
+ /* Carrier lost counter seems to be broken for some devices */ nstat->tx_carrier_errors =3D hwstat->tx_carrier_lost;
+#endif
=20
return nstat;
}

#3 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

Hi,

Quoted 2 lines

Your mailer is mangling the patches. Can you please resend without this? The patches need to be apply-able without MIME massaging.

Sorry for that. KMail seems to mangle the message as soon as you sign it. Please find the non broken versions attached to this mail.

Sorry,
Florian

drivers/net/b44.c renamed from drivers/net/b44.c-old1 +3 -0
@@ -1347,7 +1347,10 @@ static struct net_device_stats *b44_get_
 				   hwstat->rx_symbol_errs);
 
 	nstat->tx_aborted_errors = hwstat->tx_underruns;
+#if 0
+	/* Carrier lost counter seems to be broken for some devices */
 	nstat->tx_carrier_errors = hwstat->tx_carrier_lost;
+#endif
 
 	return nstat;
 }
drivers/net/b44.c renamed from drivers/net/b44.c-old2 +4 -39

67 lines not on this page · raw message

drivers/net/b44.h renamed from drivers/net/b44.h-old2 +3 -107

140 lines not on this page · raw message

drivers/net/b44.c renamed from drivers/net/b44.c-old3 +25 -0
@@ -273,6 +273,9 @@ static int b44_readphy(struct b44 *bp, i
 {
 	int err;
 
+	if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+		return 0;
+
 	bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
 	bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
 			     (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
@@ -287,6 +290,9 @@ static int b44_readphy(struct b44 *bp, i
 
 static int b44_writephy(struct b44 *bp, int reg, u32 val)
 {
+	if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+		return 0;
+
 	bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
 	bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
 			     (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
@@ -325,6 +331,9 @@ static int b44_phy_reset(struct b44 *bp)
 	u32 val;
 	int err;
 
+	if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+		return 0;
+
 	err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
 	if (err)
 		return err;
@@ -395,6 +404,9 @@ static int b44_setup_phy(struct b44 *bp)
 	u32 val;
 	int err;
 
+	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,
@@ -487,6 +499,19 @@ static void b44_check_phy(struct b44 *bp
 {
 	u32 bmsr, aux;
 
+	if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
+		bp->flags |= B44_FLAG_100_BASE_T;
+		bp->flags |= B44_FLAG_FULL_DUPLEX;
+		if (!netif_carrier_ok(bp->dev)) {
+			u32 val = br32(B44_TX_CTRL);
+			val |= TX_CTRL_DUPLEX;
+			bw32(B44_TX_CTRL, val);
+			netif_carrier_on(bp->dev);
+			b44_link_report(bp);
+		}
+		return;
+	}
+
 	if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
 	    !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
 	    (bmsr != 0xffff)) {
drivers/net/b44.h renamed from drivers/net/b44.h-old3 +1 -0
@@ -362,6 +362,7 @@ struct ring_info {
 };
 
 #define B44_MCAST_TABLE_SIZE	32
+#define B44_PHY_ADDR_NO_PHY	30
 
 /* SW copy of device statistics, kept up to date by periodic timer
  * which probes HW values.  Must have same relative layout as HW
drivers/net/b44.c renamed from drivers/net/b44.c-old4 +85 -44

202 lines not on this page · raw message

drivers/net/b44.h renamed from drivers/net/b44.h-old4 +1 -0
@@ -363,6 +363,7 @@ struct ring_info {
 
 #define B44_MCAST_TABLE_SIZE	32
 #define B44_PHY_ADDR_NO_PHY	30
+#define B44_MDC_RATIO		5000000
 
 /* SW copy of device statistics, kept up to date by periodic timer
  * which probes HW values.  Must have same relative layout as HW
maintainer
#4 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

Quoted 2 lines · On Sun, 29 Aug 2004 23:04:24 +0200 Florian Schirmer <[email protected]> wrote:

Sorry for that. KMail seems to mangle the message as soon as you sign it. Please find the non broken versions attached to this mail.

I think Florian's changes are fine.

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

#5 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

Quoted 11 lines · David S. Miller
Quoted 2 lines · On Sun, 29 Aug 2004 23:04:24 +0200 Florian Schirmer <[email protected]> wrote:

Sorry for that. KMail seems to mangle the message as soon as you sign it. Please find the non broken versions attached to this mail.

I think Florian's changes are fine.

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

hehe. I'll take care of it tonight when I queue Florian's stuff to netdev-2.6 (and thus -mm, and thus eventually mainline).

Jeff

#6 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

Quoted 6 lines · Jeff Garzik
Quoted 3 lines

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

hehe. I'll take care of it tonight when I queue Florian's stuff to netdev-2.6 (and thus -mm, and thus eventually mainline).

And here's a resend of the bounce buffer patch, which should still apply on top of Florians (or without) just fine.

drivers/net/b44.h renamed from drivers/net/b44.h.4g4g +2 -1
@@ -493,6 +493,7 @@
 
 	struct ring_info	*rx_buffers;
 	struct ring_info	*tx_buffers;
+	unsigned char		*tx_bufs; 
 
 	u32			dma_offset;
 	u32			flags;
@@ -525,7 +526,7 @@
 	struct pci_dev		*pdev;
 	struct net_device	*dev;
 
-	dma_addr_t		rx_ring_dma, tx_ring_dma;
+	dma_addr_t		rx_ring_dma, tx_ring_dma,tx_bufs_dma;
 
 	u32			rx_pending;
 	u32			tx_pending;
drivers/net/b44.c renamed from drivers/net/b44.c.4g4g +50 -4

110 lines not on this page · raw message

#7 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

Hi,

while i do agree that this patch is needed and should do what it is supposed to do i'm still wondering what the idea behind pci_map_single() returning inaccessible DMA addresses is. The pci layer knows that the device can only handle addresses up to 1GB. For what reasons should it return addresses above that limit? Reading the DMA-mappings.txt didn't reveal an answer so maybe someone can shed some light onto this topic?

Thanks,
Florian

Quoted 16 lines · Pekka Pietikainen
Quoted 9 lines · Jeff Garzik
Quoted 5 lines

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

hehe. I'll take care of it tonight when I queue Florian's stuff to netdev-2.6 (and thus -mm, and thus eventually mainline).

And here's a resend of the bounce buffer patch, which should still apply on top of Florians (or without) just fine.

#16 lore raw

PATCH 1/1 Fix for b44 warnings.

In reply to Florian Schirmer

B44 driver was using unsigned long as an io memory address. Recent changes caused this to be a warning. This patch fixes that and makes the readl/writel wrapper into inline's instead of macros with magic variable side effect (yuck).

drivers/net/b44.c +103 -92
diff -Nru a/drivers/net/b44.c b/drivers/net/b44.c
@@ -98,13 +98,24 @@
 static void b44_init_rings(struct b44 *);
 static void b44_init_hw(struct b44 *);
 
+static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
+{
+	return readl(bp->regs + reg);
+}
+
+static inline void bw32(const struct b44 *bp, 
+			unsigned long reg, unsigned long val)
+{
+	writel(val, bp->regs + reg);
+}
+
 static int b44_wait_bit(struct b44 *bp, unsigned long reg,
 			u32 bit, unsigned long timeout, const int clear)
 {
 	unsigned long i;
 
 	for (i = 0; i < timeout; i++) {
-		u32 val = br32(reg);
+		u32 val = br32(bp, reg);
 
 		if (clear && !(val & bit))
 			break;
@@ -168,7 +179,7 @@
 
 static u32 ssb_get_core_rev(struct b44 *bp)
 {
-	return (br32(B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
+	return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
 }
 
 static u32 ssb_pci_setup(struct b44 *bp, u32 cores)
@@ -180,13 +191,13 @@
 			       ssb_get_addr(bp, SBID_REG_PCI, 0));
 	pci_rev = ssb_get_core_rev(bp);
 
-	val = br32(B44_SBINTVEC);
+	val = br32(bp, B44_SBINTVEC);
 	val |= cores;
-	bw32(B44_SBINTVEC, val);
+	bw32(bp, B44_SBINTVEC, val);
 
-	val = br32(SSB_PCI_TRANS_2);
+	val = br32(bp, SSB_PCI_TRANS_2);
 	val |= SSB_PCI_PREF | SSB_PCI_BURST;
-	bw32(SSB_PCI_TRANS_2, val);
+	bw32(bp, SSB_PCI_TRANS_2, val);
 
 	pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig);
 
@@ -195,18 +206,18 @@
 
 static void ssb_core_disable(struct b44 *bp)
 {
-	if (br32(B44_SBTMSLOW) & SBTMSLOW_RESET)
+	if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET)
 		return;
 
-	bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
 	b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0);
 	b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1);
-	bw32(B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
 			    SBTMSLOW_REJECT | SBTMSLOW_RESET));
-	br32(B44_SBTMSLOW);
+	br32(bp, B44_SBTMSLOW);
 	udelay(1);
-	bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
-	br32(B44_SBTMSLOW);
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
+	br32(bp, B44_SBTMSLOW);
 	udelay(1);
 }
 
@@ -215,31 +226,31 @@
 	u32 val;
 
 	ssb_core_disable(bp);
-	bw32(B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
-	br32(B44_SBTMSLOW);
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
+	br32(bp, B44_SBTMSLOW);
 	udelay(1);
 
 	/* Clear SERR if set, this is a hw bug workaround.  */
-	if (br32(B44_SBTMSHIGH) & SBTMSHIGH_SERR)
-		bw32(B44_SBTMSHIGH, 0);
+	if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR)
+		bw32(bp, B44_SBTMSHIGH, 0);
 
-	val = br32(B44_SBIMSTATE);
+	val = br32(bp, B44_SBIMSTATE);
 	if (val & (SBIMSTATE_IBE | SBIMSTATE_TO))
-		bw32(B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
+		bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
 
-	bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
-	br32(B44_SBTMSLOW);
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
+	br32(bp, B44_SBTMSLOW);
 	udelay(1);
 
-	bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK));
-	br32(B44_SBTMSLOW);
+	bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK));
+	br32(bp, B44_SBTMSLOW);
 	udelay(1);
 }
 
 static int ssb_core_unit(struct b44 *bp)
 {
 #if 0
-	u32 val = br32(B44_SBADMATCH0);
+	u32 val = br32(bp, B44_SBADMATCH0);
 	u32 base;
 
 	type = val & SBADMATCH0_TYPE_MASK;
@@ -263,7 +274,7 @@
 
 static int ssb_is_core_up(struct b44 *bp)
 {
-	return ((br32(B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
+	return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
 		== SBTMSLOW_CLOCK);
 }
 
@@ -275,19 +286,19 @@
 	val |= ((u32) data[3]) << 16;
 	val |= ((u32) data[4]) <<  8;
 	val |= ((u32) data[5]) <<  0;
-	bw32(B44_CAM_DATA_LO, val);
+	bw32(bp, B44_CAM_DATA_LO, val);
 	val = (CAM_DATA_HI_VALID | 
 	       (((u32) data[0]) << 8) |
 	       (((u32) data[1]) << 0));
-	bw32(B44_CAM_DATA_HI, val);
-	bw32(B44_CAM_CTRL, (CAM_CTRL_WRITE |
+	bw32(bp, B44_CAM_DATA_HI, val);
+	bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
 			    (index << CAM_CTRL_INDEX_SHIFT)));
 	b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);	
 }
 
 static inline void __b44_disable_ints(struct b44 *bp)
 {
-	bw32(B44_IMASK, 0);
+	bw32(bp, B44_IMASK, 0);
 }
 
 static void b44_disable_ints(struct b44 *bp)
@@ -295,34 +306,34 @@
 	__b44_disable_ints(bp);
 
 	/* Flush posted writes. */
-	br32(B44_IMASK);
+	br32(bp, B44_IMASK);
 }
 
 static void b44_enable_ints(struct b44 *bp)
 {
-	bw32(B44_IMASK, bp->imask);
+	bw32(bp, B44_IMASK, bp->imask);
 }
 
 static int b44_readphy(struct b44 *bp, int reg, u32 *val)
 {
 	int err;
 
-	bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
-	bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
+	bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
+	bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
 			     (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
 			     (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
 			     (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);
-	*val = br32(B44_MDIO_DATA) & MDIO_DATA_DATA;
+	*val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA;
 
 	return err;
 }
 
 static int b44_writephy(struct b44 *bp, int reg, u32 val)
 {
-	bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
-	bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
+	bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
+	bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
 			     (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
 			     (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
 			     (reg << MDIO_DATA_RA_SHIFT) |
@@ -382,20 +393,20 @@
 	bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE);
 	bp->flags |= pause_flags;
 
-	val = br32(B44_RXCONFIG);
+	val = br32(bp, B44_RXCONFIG);
 	if (pause_flags & B44_FLAG_RX_PAUSE)
 		val |= RXCONFIG_FLOW;
 	else
 		val &= ~RXCONFIG_FLOW;
-	bw32(B44_RXCONFIG, val);
+	bw32(bp, B44_RXCONFIG, val);
 
-	val = br32(B44_MAC_FLOW);
+	val = br32(bp, B44_MAC_FLOW);
 	if (pause_flags & B44_FLAG_TX_PAUSE)
 		val |= (MAC_FLOW_PAUSE_ENAB |
 			(0xc0 & MAC_FLOW_RX_HI_WATER));
 	else
 		val &= ~MAC_FLOW_PAUSE_ENAB;
-	bw32(B44_MAC_FLOW, val);
+	bw32(bp, B44_MAC_FLOW, val);
 }
 
 static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
@@ -491,11 +502,11 @@
 
 	val = &bp->hw_stats.tx_good_octets;
 	for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
-		*val++ += br32(reg);
+		*val++ += br32(bp, reg);
 	}
 	val = &bp->hw_stats.rx_good_octets;
 	for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
-		*val++ += br32(reg);
+		*val++ += br32(bp, reg);
 	}
 }
 
@@ -535,14 +546,14 @@
 
 		if (!netif_carrier_ok(bp->dev) &&
 		    (bmsr & BMSR_LSTATUS)) {
-			u32 val = br32(B44_TX_CTRL);
+			u32 val = br32(bp, B44_TX_CTRL);
 			u32 local_adv, remote_adv;
 
 			if (bp->flags & B44_FLAG_FULL_DUPLEX)
 				val |= TX_CTRL_DUPLEX;
 			else
 				val &= ~TX_CTRL_DUPLEX;
-			bw32(B44_TX_CTRL, val);
+			bw32(bp, B44_TX_CTRL, val);
 
 			if (!(bp->flags & B44_FLAG_FORCE_LINK) &&
 			    !b44_readphy(bp, MII_ADVERTISE, &local_adv) &&
@@ -587,7 +598,7 @@
 {
 	u32 cur, cons;
 
-	cur  = br32(B44_DMATX_STAT) & DMATX_STAT_CDMASK;
+	cur  = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
 	cur /= sizeof(struct dma_desc);
 
 	/* XXX needs updating when NETIF_F_SG is supported */
@@ -611,7 +622,7 @@
 	    TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
 		netif_wake_queue(bp->dev);
 
-	bw32(B44_GPTIMER, 0);
+	bw32(bp, B44_GPTIMER, 0);
 }
 
 /* Works like this.  This chip writes a 'struct rx_header" 30 bytes
@@ -708,7 +719,7 @@
 	u32 cons, prod;
 
 	received = 0;
-	prod  = br32(B44_DMARX_STAT) & DMARX_STAT_CDMASK;
+	prod  = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK;
 	prod /= sizeof(struct dma_desc);
 	cons = bp->rx_cons;
 
@@ -787,7 +798,7 @@
 	}
 
 	bp->rx_cons = cons;
-	bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc));
+	bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc));
 
 	return received;
 }
@@ -851,8 +862,8 @@
 
 	spin_lock_irqsave(&bp->lock, flags);
 
-	istat = br32(B44_ISTAT);
-	imask = br32(B44_IMASK);
+	istat = br32(bp, B44_ISTAT);
+	imask = br32(bp, B44_IMASK);
 
 	/* ??? What the fuck is the purpose of the interrupt mask
 	 * ??? register if we have to mask it out by hand anyways?
@@ -872,8 +883,8 @@
 			       dev->name);
 		}
 
-		bw32(B44_ISTAT, istat);
-		br32(B44_ISTAT);
+		bw32(bp, B44_ISTAT, istat);
+		br32(bp, B44_ISTAT);
 	}
 	spin_unlock_irqrestore(&bp->lock, flags);
 	return IRQ_RETVAL(handled);
@@ -937,11 +948,11 @@
 
 	wmb();
 
-	bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
+	bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
 	if (bp->flags & B44_FLAG_BUGGY_TXPTR)
-		bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
+		bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
 	if (bp->flags & B44_FLAG_REORDER_BUG)
-		br32(B44_DMATX_PTR);
+		br32(bp, B44_DMATX_PTR);
 
 	if (TX_BUFFS_AVAIL(bp) < 1)
 		netif_stop_queue(dev);
@@ -1109,27 +1120,27 @@
 {
 	unsigned long reg;
 
-	bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+	bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
 	for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL)
-		br32(reg);
+		br32(bp, reg);
 	for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL)
-		br32(reg);
+		br32(bp, reg);
 }
 
 /* bp->lock is held. */
 static void b44_chip_reset(struct b44 *bp)
 {
 	if (ssb_is_core_up(bp)) {
-		bw32(B44_RCV_LAZY, 0);
-		bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
+		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);
-		bw32(B44_DMATX_CTRL, 0);
+		bw32(bp, B44_DMATX_CTRL, 0);
 		bp->tx_prod = bp->tx_cons = 0;
-		if (br32(B44_DMARX_STAT) & DMARX_STAT_EMASK) {
+		if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
 			b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE,
 				     100, 0);
 		}
-		bw32(B44_DMARX_CTRL, 0);
+		bw32(bp, B44_DMARX_CTRL, 0);
 		bp->rx_prod = bp->rx_cons = 0;
 	} else {
 		ssb_pci_setup(bp, (bp->core_unit == 0 ?
@@ -1142,20 +1153,20 @@
 	b44_clear_stats(bp);
 
 	/* Make PHY accessible. */
-	bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
+	bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
 			     (0x0d & MDIO_CTRL_MAXF_MASK)));
-	br32(B44_MDIO_CTRL);
+	br32(bp, B44_MDIO_CTRL);
 
-	if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) {
-		bw32(B44_ENET_CTRL, ENET_CTRL_EPSEL);
-		br32(B44_ENET_CTRL);
+	if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
+		bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
+		br32(bp, B44_ENET_CTRL);
 		bp->flags &= ~B44_FLAG_INTERNAL_PHY;
 	} else {
-		u32 val = br32(B44_DEVCTRL);
+		u32 val = br32(bp, B44_DEVCTRL);
 
 		if (val & DEVCTRL_EPR) {
-			bw32(B44_DEVCTRL, (val & ~DEVCTRL_EPR));
-			br32(B44_DEVCTRL);
+			bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR));
+			br32(bp, B44_DEVCTRL);
 			udelay(100);
 		}
 		bp->flags |= B44_FLAG_INTERNAL_PHY;
@@ -1172,13 +1183,13 @@
 /* bp->lock is held. */
 static void __b44_set_mac_addr(struct b44 *bp)
 {
-	bw32(B44_CAM_CTRL, 0);
+	bw32(bp, B44_CAM_CTRL, 0);
 	if (!(bp->dev->flags & IFF_PROMISC)) {
 		u32 val;
 
 		__b44_cam_write(bp, bp->dev->dev_addr, 0);
-		val = br32(B44_CAM_CTRL);
-		bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
+		val = br32(bp, B44_CAM_CTRL);
+		bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
 	}
 }
 
@@ -1212,30 +1223,30 @@
 	b44_setup_phy(bp);
 
 	/* Enable CRC32, set proper LED modes and power on PHY */
-	bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
-	bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
+	bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
+	bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
 
 	/* This sets the MAC address too.  */
 	__b44_set_rx_mode(bp->dev);
 
 	/* MTU + eth header + possible VLAN tag + struct rx_header */
-	bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
-	bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
+	bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
+	bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
 
-	bw32(B44_TX_WMARK, 56); /* XXX magic */
-	bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
-	bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
-	bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+	bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
+	bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
+	bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
+	bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
 			      (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
-	bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
+	bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
 
-	bw32(B44_DMARX_PTR, bp->rx_pending);
+	bw32(bp, B44_DMARX_PTR, bp->rx_pending);
 	bp->rx_prod = bp->rx_pending;	
 
-	bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+	bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
 
-	val = br32(B44_ENET_CTRL);
-	bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
+	val = br32(bp, B44_ENET_CTRL);
+	bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
 }
 
 static int b44_open(struct net_device *dev)
@@ -1372,11 +1383,11 @@
 	int i=0;
 	unsigned char zero[6] = {0,0,0,0,0,0};
 
-	val = br32(B44_RXCONFIG);
+	val = br32(bp, B44_RXCONFIG);
 	val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
 	if (dev->flags & IFF_PROMISC) {
 		val |= RXCONFIG_PROMISC;
-		bw32(B44_RXCONFIG, val);
+		bw32(bp, B44_RXCONFIG, val);
 	} else {
 		__b44_set_mac_addr(bp);
 
@@ -1388,9 +1399,9 @@
 		for(;i<64;i++) {
 			__b44_cam_write(bp, zero, i);			
 		}
-		bw32(B44_RXCONFIG, val);
-        	val = br32(B44_CAM_CTRL);
-	        bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
+		bw32(bp, B44_RXCONFIG, val);
+        	val = br32(bp, B44_CAM_CTRL);
+	        bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
 	}
 }
 
@@ -1760,7 +1771,7 @@
 
 	spin_lock_init(&bp->lock);
 
-	bp->regs = (unsigned long) ioremap(b44reg_base, b44reg_len);
+	bp->regs = ioremap(b44reg_base, b44reg_len);
 	if (bp->regs == 0UL) {
 		printk(KERN_ERR PFX "Cannot map device registers, "
 		       "aborting.\n");
drivers/net/b44.h +1 -4
diff -Nru a/drivers/net/b44.h b/drivers/net/b44.h
@@ -395,9 +395,6 @@
 #define SSB_PCI_MASK1		0xfc000000
 #define SSB_PCI_MASK2		0xc0000000
 
-#define br32(REG)	readl(bp->regs + (REG))
-#define bw32(REG,VAL)	writel((VAL), bp->regs + (REG))
-
 /* 4400 PHY registers */
 #define B44_MII_AUXCTRL		24	/* Auxiliary Control */
 #define  MII_AUXCTRL_DUPLEX	0x0001  /* Full Duplex */
@@ -530,7 +527,7 @@
 	struct net_device_stats	stats;
 	struct b44_hw_stats	hw_stats;
 
-	unsigned long		regs;
+	volatile void __iomem   *regs;
 	struct pci_dev		*pdev;
 	struct net_device	*dev;
 
maintainer
#17 lore raw

Re: [PATCH] Fix for b44 warnings.

Quoted 4 lines · On Mon, 13 Sep 2004 16:30:01 -0700 Stephen Hemminger <[email protected]>…

B44 driver was using unsigned long as an io memory address. Recent changes caused this to be a warning. This patch fixes that and makes the readl/writel wrapper into inline's instead of macros with magic variable side effect (yuck).

Jeff, I'll merge this one.

Thanks Stephen.

#11 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

In reply to Florian Schirmer
Quoted 8 lines · Florian Schirmer

Hi,

some (?) hardware seems to be buggy and is reporting bogus carrier lost values. Both reference implementations from Broadcom indicate that this counter is not reliable and therefore ignore it. We should do the same. "Fixes" the carrier lost problem i've seen.

Regards,
Florian

patch applied to 2.6.x

#8 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

In reply to Pekka Pietikainen
Quoted 6 lines · Pekka Pietikainen
Quoted 4 lines · Jeff Garzik
Quoted 3 lines

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

Quoted 7 lines
Quoted 2 lines

hehe. I'll take care of it tonight when I queue Florian's stuff to netdev-2.6 (and thus -mm, and thus eventually mainline).

And here's a resend of the bounce buffer patch, which should still apply on top of Florians (or without) just fine.

patch applied to 2.6.x.

#9 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

In reply to David S. Miller
Quoted 8 lines · David S. Miller
Quoted 2 lines · On Sun, 29 Aug 2004 23:04:24 +0200 Florian Schirmer <[email protected]> wrote:

Sorry for that. KMail seems to mangle the message as soon as you sign it. Please find the non broken versions attached to this mail.

Quoted 5 lines

I think Florian's changes are fine.

BTW, can someone fixup something for me? Update MODULE_AUTHOR() please :-) 3/4 of this driver have been rewritten since I last touched it, heh.

done.

#10 lore raw

Re: [PATCH][1/4] b44: Ignore carrier lost errors

In reply to Florian Schirmer

Florian,

I was unable to apply your patch #3 (phy-less-mode) and patch #4 (bcm47xx support).

Could you please resend these two patches, diff'd against the attached b44 driver (my current version in netdev-2.6)?

Please send one patch per email, as per http://linux.yyz.us/patch-format.html, even when resending patches.

Jeff