]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/bcm43xx/bcm43xx.h
Pull motherboard into release branch
[linux-2.6] / drivers / net / wireless / bcm43xx / bcm43xx.h
index 29c95b07122ae6056e566711434cc93d930d09ad..2e83083935e1d9bd90570975c5cb771b62055a1e 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "bcm43xx_debugfs.h"
 #include "bcm43xx_leds.h"
-#include "bcm43xx_sysfs.h"
 
 
 #define PFX                            KBUILD_MODNAME ": "
 #define BCM43xx_BFL_AFTERBURNER                0x0200 /* supports Afterburner mode */
 #define BCM43xx_BFL_NOPCI              0x0400 /* leaves PCI floating */
 #define BCM43xx_BFL_FEM                        0x0800 /* supports the Front End Module */
+#define BCM43xx_BFL_EXTLNA             0x1000 /* has an external LNA */
+#define BCM43xx_BFL_HGPA               0x2000 /* had high gain PA */
+#define BCM43xx_BFL_BTCMOD             0x4000 /* BFL_BTCOEXIST is given in alternate GPIOs */
+#define BCM43xx_BFL_ALTIQ              0x8000 /* alternate I/Q settings */
 
 /* GPIO register offset, in both ChipCommon and PCI core. */
 #define BCM43xx_GPIO_CONTROL           0x6c
@@ -491,6 +494,10 @@ struct bcm43xx_phyinfo {
        const s8 *tssi2dbm;
        /* idle TSSI value */
        s8 idle_tssi;
+
+       /* Values from bcm43xx_calc_loopback_gain() */
+       u16 loopback_gain[2];
+
        /* PHY lock for core.rev < 3
         * This lock is only used by bcm43xx_phy_{un}lock()
         */
@@ -503,18 +510,35 @@ struct bcm43xx_radioinfo {
        u16 version;
        u8 revision;
 
-       /* 0: baseband attenuation,
-        * 1: radio attenuation, 
-        * 2: tx_CTL1
-        * 3: tx_CTL2
-        */
-       u16 txpower[4];
        /* Desired TX power in dBm Q5.2 */
        u16 txpower_desired;
+       /* TX Power control values. */
+       union {
+               /* B/G PHY */
+               struct {
+                       u16 baseband_atten;
+                       u16 radio_atten;
+                       u16 txctl1;
+                       u16 txctl2;
+               };
+               /* A PHY */
+               struct {
+                       u16 txpwr_offset;
+               };
+       };
+
        /* Current Interference Mitigation mode */
        int interfmode;
-       /* Stack of saved values from the Interference Mitigation code */
-       u16 interfstack[20];
+       /* Stack of saved values from the Interference Mitigation code.
+        * Each value in the stack is layed out as follows:
+        * bit 0-11:  offset
+        * bit 12-15: register ID
+        * bit 16-32: value
+        * register ID is: 0x1 PHY, 0x2 Radio, 0x3 ILT
+        */
+#define BCM43xx_INTERFSTACK_SIZE       26
+       u32 interfstack[BCM43xx_INTERFSTACK_SIZE];
+
        /* Saved values from the NRSSI Slope calculation */
        s16 nrssi[2];
        s32 nrssislope;
@@ -556,33 +580,37 @@ struct bcm43xx_pio {
 
 #define BCM43xx_MAX_80211_CORES                2
 
-#define BCM43xx_COREFLAG_AVAILABLE     (1 << 0)
-#define BCM43xx_COREFLAG_ENABLED       (1 << 1)
-#define BCM43xx_COREFLAG_INITIALIZED   (1 << 2)
-
 #ifdef CONFIG_BCM947XX
 #define core_offset(bcm) (bcm)->current_core_offset
 #else
 #define core_offset(bcm) 0
 #endif
 
+/* Generic information about a core. */
 struct bcm43xx_coreinfo {
-       /** Driver internal flags. See BCM43xx_COREFLAG_* */
-       u32 flags;
+       u8 available:1,
+          enabled:1,
+          initialized:1;
        /** core_id ID number */
        u16 id;
        /** core_rev revision number */
        u8 rev;
        /** Index number for _switch_core() */
        u8 index;
-       /* Pointer to the PHYinfo, which belongs to this core (if 80211 core) */
-       struct bcm43xx_phyinfo *phy;
-       /* Pointer to the RadioInfo, which belongs to this core (if 80211 core) */
-       struct bcm43xx_radioinfo *radio;
-       /* Pointer to the DMA rings, which belong to this core (if 80211 core) */
-       struct bcm43xx_dma *dma;
-       /* Pointer to the PIO queues, which belong to this core (if 80211 core) */
-       struct bcm43xx_pio *pio;
+};
+
+/* Additional information for each 80211 core. */
+struct bcm43xx_coreinfo_80211 {
+       /* PHY device. */
+       struct bcm43xx_phyinfo phy;
+       /* Radio device. */
+       struct bcm43xx_radioinfo radio;
+       union {
+               /* DMA context. */
+               struct bcm43xx_dma dma;
+               /* PIO context. */
+               struct bcm43xx_pio pio;
+       };
 };
 
 /* Context information for a noise calculation (Link Quality). */
@@ -596,6 +624,8 @@ struct bcm43xx_noise_calculation {
 
 struct bcm43xx_stats {
        u8 link_quality;
+       u8 noise;
+       struct iw_statistics wstats;
        /* Store the last TX/RX times here for updating the leds. */
        unsigned long last_tx;
        unsigned long last_rx;
@@ -607,8 +637,6 @@ struct bcm43xx_key {
 };
 
 struct bcm43xx_private {
-       struct bcm43xx_sysfs sysfs;
-
        struct ieee80211_device *ieee;
        struct ieee80211softmac_device *softmac;
 
@@ -647,12 +675,13 @@ struct bcm43xx_private {
 
        u16 chip_id;
        u8 chip_rev;
+       u8 chip_package;
 
        struct bcm43xx_sprominfo sprom;
 #define BCM43xx_NR_LEDS                4
        struct bcm43xx_led leds[BCM43xx_NR_LEDS];
 
-       /* The currently active core. NULL if not initialized, yet. */
+       /* The currently active core. */
        struct bcm43xx_coreinfo *current_core;
 #ifdef CONFIG_BCM947XX
        /** current core memory offset */
@@ -665,18 +694,15 @@ struct bcm43xx_private {
         */
        struct bcm43xx_coreinfo core_chipcommon;
        struct bcm43xx_coreinfo core_pci;
-       struct bcm43xx_coreinfo core_v90;
-       struct bcm43xx_coreinfo core_pcmcia;
-       struct bcm43xx_coreinfo core_ethernet;
        struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ];
-       /* Info about the PHY for each 80211 core. */
-       struct bcm43xx_phyinfo phy[ BCM43xx_MAX_80211_CORES ];
-       /* Info about the Radio for each 80211 core. */
-       struct bcm43xx_radioinfo radio[ BCM43xx_MAX_80211_CORES ];
-       /* DMA */
-       struct bcm43xx_dma dma[ BCM43xx_MAX_80211_CORES ];
-       /* PIO */
-       struct bcm43xx_pio pio[ BCM43xx_MAX_80211_CORES ];
+       /* Additional information, specific to the 80211 cores. */
+       struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ];
+       /* Index of the current 80211 core. If current_core is not
+        * an 80211 core, this is -1.
+        */
+       int current_80211_core_idx;
+       /* Number of available 80211 cores. */
+       int nr_80211_available;
 
        u32 chipcommon_capabilities;
 
@@ -743,6 +769,20 @@ struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
        return ieee80211softmac_priv(dev);
 }
 
+struct device;
+
+static inline
+struct bcm43xx_private * dev_to_bcm(struct device *dev)
+{
+       struct net_device *net_dev;
+       struct bcm43xx_private *bcm;
+
+       net_dev = dev_get_drvdata(dev);
+       bcm = bcm43xx_priv(net_dev);
+
+       return bcm;
+}
+
 
 /* Helper function, which returns a boolean.
  * TRUE, if PIO is used; FALSE, if DMA is used.
@@ -769,18 +809,39 @@ int bcm43xx_using_pio(struct bcm43xx_private *bcm)
 # error "Using neither DMA nor PIO? Confused..."
 #endif
 
-
+/* Helper functions to access data structures private to the 80211 cores.
+ * Note that we _must_ have an 80211 core mapped when calling
+ * any of these functions.
+ */
 static inline
-int bcm43xx_num_80211_cores(struct bcm43xx_private *bcm)
+struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm)
 {
-       int i, cnt = 0;
-
-       for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
-               if (bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE)
-                       cnt++;
-       }
-
-       return cnt;
+       assert(bcm43xx_using_pio(bcm));
+       assert(bcm->current_80211_core_idx >= 0);
+       assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
+       return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio);
+}
+static inline
+struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm)
+{
+       assert(!bcm43xx_using_pio(bcm));
+       assert(bcm->current_80211_core_idx >= 0);
+       assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
+       return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma);
+}
+static inline
+struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm)
+{
+       assert(bcm->current_80211_core_idx >= 0);
+       assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
+       return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy);
+}
+static inline
+struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
+{
+       assert(bcm->current_80211_core_idx >= 0);
+       assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
+       return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
 }
 
 /* Are we running in init_board() context? */