]> err.no Git - linux-2.6/commitdiff
[PATCH] bcm43xx:Eliminate some 'G Mode Enable' magic numbers
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 14 Mar 2007 20:06:22 +0000 (15:06 -0500)
committerJeff Garzik <jeff@garzik.org>
Sat, 28 Apr 2007 15:00:59 +0000 (11:00 -0400)
In code manipulating the TM State Low register of 802.11 cores, two
different magic numbers are used to reference the 'G Mode Enable' bit.
One of these, 0x20000000, is clear, but the other, (0x800 << 18), is not.
This patch replaces both types with a defined constant. In addition, two
bits in the TM State High registers are given definitions to help in
following the code.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/bcm43xx/bcm43xx.h
drivers/net/wireless/bcm43xx/bcm43xx_main.c
drivers/net/wireless/bcm43xx/bcm43xx_phy.c

index 95ff175d8f334227485ee75e995c8993f290f9eb..f8483c179e4c9d4a1c6dcaf23bab05da0423e9ac 100644 (file)
 #define BCM43xx_SBTMSTATELOW_REJECT            0x02
 #define BCM43xx_SBTMSTATELOW_CLOCK             0x10000
 #define BCM43xx_SBTMSTATELOW_FORCE_GATE_CLOCK  0x20000
+#define BCM43xx_SBTMSTATELOW_G_MODE_ENABLE     0x20000000
 
 /* sbtmstatehigh state flags */
 #define BCM43xx_SBTMSTATEHIGH_SERROR           0x00000001
 #define BCM43xx_SBTMSTATEHIGH_BUSY             0x00000004
 #define BCM43xx_SBTMSTATEHIGH_TIMEOUT          0x00000020
+#define BCM43xx_SBTMSTATEHIGH_G_PHY_AVAIL      0x00010000
+#define BCM43xx_SBTMSTATEHIGH_A_PHY_AVAIL      0x00020000
 #define BCM43xx_SBTMSTATEHIGH_COREFLAGS                0x1FFF0000
 #define BCM43xx_SBTMSTATEHIGH_DMA64BIT         0x10000000
 #define BCM43xx_SBTMSTATEHIGH_GATEDCLK         0x20000000
index a38e7eec0e62174e0005a0971ae6fa6137b61058..5e96bca6730a470df027e7f10a62899f1c331cf5 100644 (file)
@@ -1407,7 +1407,7 @@ void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy)
                                & ~(BCM43xx_SBF_MAC_ENABLED | 0x00000002));
        } else {
                if (connect_phy)
-                       flags |= 0x20000000;
+                       flags |= BCM43xx_SBTMSTATELOW_G_MODE_ENABLE;
                bcm43xx_phy_connect(bcm, connect_phy);
                bcm43xx_core_enable(bcm, flags);
                bcm43xx_write16(bcm, 0x03E6, 0x0000);
@@ -3604,7 +3604,7 @@ int bcm43xx_select_wireless_core(struct bcm43xx_private *bcm,
                u32 sbtmstatelow;
 
                sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW);
-               sbtmstatelow |= 0x20000000;
+               sbtmstatelow |= BCM43xx_SBTMSTATELOW_G_MODE_ENABLE;
                bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow);
        }
        err = wireless_core_up(bcm, 1);
index 72529a440f15eab7c47177fd23e96e9cdc7de5e8..c47e19a9521a3fea1b3b51b61416f764a330f6f3 100644 (file)
@@ -168,16 +168,16 @@ int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect)
 
        flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH);
        if (connect) {
-               if (!(flags & 0x00010000))
+               if (!(flags & BCM43xx_SBTMSTATEHIGH_G_PHY_AVAIL))
                        return -ENODEV;
                flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW);
-               flags |= (0x800 << 18);
+               flags |= BCM43xx_SBTMSTATELOW_G_MODE_ENABLE;
                bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags);
        } else {
-               if (!(flags & 0x00020000))
+               if (!(flags & BCM43xx_SBTMSTATEHIGH_A_PHY_AVAIL))
                        return -ENODEV;
                flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW);
-               flags &= ~(0x800 << 18);
+               flags &= ~BCM43xx_SBTMSTATELOW_G_MODE_ENABLE;
                bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags);
        }
 out: