Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[cascardo/linux.git] / drivers / net / wireless / rtlwifi / wifi.h
index 0539439..01226f8 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/firmware.h>
 #include <linux/version.h>
 #include <linux/etherdevice.h>
+#include <linux/vmalloc.h>
 #include <linux/usb.h>
 #include <net/mac80211.h>
 #include "debug.h"
@@ -1383,6 +1384,18 @@ struct rtl_hal_ops {
                          u32 regaddr, u32 bitmask);
        void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath,
                           u32 regaddr, u32 bitmask, u32 data);
+       bool (*phy_rf6052_config) (struct ieee80211_hw *hw);
+       void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw,
+                                           u8 *powerlevel);
+       void (*phy_rf6052_set_ofdm_txpower) (struct ieee80211_hw *hw,
+                                            u8 *ppowerlevel, u8 channel);
+       bool (*config_bb_with_headerfile) (struct ieee80211_hw *hw,
+                                          u8 configtype);
+       bool (*config_bb_with_pgheaderfile) (struct ieee80211_hw *hw,
+                                            u8 configtype);
+       void (*phy_lc_calibrate) (struct ieee80211_hw *hw, bool is2t);
+       void (*phy_set_bw_mode_callback) (struct ieee80211_hw *hw);
+       void (*dm_dynamic_txpower) (struct ieee80211_hw *hw);
 };
 
 struct rtl_intf_ops {
@@ -1632,7 +1645,7 @@ struct bt_coexist_info {
        2. Before write integer to IO.
        3. After read integer from IO.
 ****************************************/
-/* Convert little data endian to host */
+/* Convert little data endian to host ordering */
 #define EF1BYTE(_val)          \
        ((u8)(_val))
 #define EF2BYTE(_val)          \
@@ -1640,27 +1653,21 @@ struct bt_coexist_info {
 #define EF4BYTE(_val)          \
        (le32_to_cpu(_val))
 
-/* Read data from memory */
-#define READEF1BYTE(_ptr)      \
-       EF1BYTE(*((u8 *)(_ptr)))
+/* Read le16 data from memory and convert to host ordering */
 #define READEF2BYTE(_ptr)      \
        EF2BYTE(*((u16 *)(_ptr)))
-#define READEF4BYTE(_ptr)      \
-       EF4BYTE(*((__le32 *)(_ptr)))
 
-/* Write data to memory */
-#define WRITEEF1BYTE(_ptr, _val)       \
-       (*((u8 *)(_ptr))) = EF1BYTE(_val)
+/* Write le16 data to memory in host ordering */
 #define WRITEEF2BYTE(_ptr, _val)       \
        (*((u16 *)(_ptr))) = EF2BYTE(_val)
-#define WRITEEF4BYTE(_ptr, _val)       \
-       (*((u32 *)(_ptr))) = EF4BYTE(_val)
-
-/*Example:
-BIT_LEN_MASK_32(0) => 0x00000000
-BIT_LEN_MASK_32(1) => 0x00000001
-BIT_LEN_MASK_32(2) => 0x00000003
-BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/
+
+/* Create a bit mask
+ * Examples:
+ * BIT_LEN_MASK_32(0) => 0x00000000
+ * BIT_LEN_MASK_32(1) => 0x00000001
+ * BIT_LEN_MASK_32(2) => 0x00000003
+ * BIT_LEN_MASK_32(32) => 0xFFFFFFFF
+ */
 #define BIT_LEN_MASK_32(__bitlen)       \
        (0xFFFFFFFF >> (32 - (__bitlen)))
 #define BIT_LEN_MASK_16(__bitlen)       \
@@ -1668,9 +1675,11 @@ BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/
 #define BIT_LEN_MASK_8(__bitlen) \
        (0xFF >> (8 - (__bitlen)))
 
-/*Example:
-BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
-BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/
+/* Create an offset bit mask
+ * Examples:
+ * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
+ * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
+ */
 #define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \
        (BIT_LEN_MASK_32(__bitlen) << (__bitoffset))
 #define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \
@@ -1679,8 +1688,9 @@ BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/
        (BIT_LEN_MASK_8(__bitlen) << (__bitoffset))
 
 /*Description:
-Return 4-byte value in host byte ordering from
-4-byte pointer in little-endian system.*/
+ * Return 4-byte value in host byte ordering from
+ * 4-byte pointer in little-endian system.
+ */
 #define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \
        (EF4BYTE(*((u32 *)(__pstart))))
 #define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \
@@ -1688,28 +1698,10 @@ Return 4-byte value in host byte ordering from
 #define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \
        (EF1BYTE(*((u8 *)(__pstart))))
 
-/*Description:
-Translate subfield (continuous bits in little-endian) of 4-byte
-value to host byte ordering.*/
-#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
-       ( \
-               (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset))  & \
-               BIT_LEN_MASK_32(__bitlen) \
-       )
-#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
-       ( \
-               (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \
-               BIT_LEN_MASK_16(__bitlen) \
-       )
-#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
-       ( \
-               (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \
-               BIT_LEN_MASK_8(__bitlen) \
-       )
-
-/*Description:
-Mask subfield (continuous bits in little-endian) of 4-byte value
-and return the result in 4-byte value in host byte ordering.*/
+/* Description:
+ * Mask subfield (continuous bits in little-endian) of 4-byte value
+ * and return the result in 4-byte value in host byte ordering.
+ */
 #define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
        ( \
                LE_P4BYTE_TO_HOST_4BYTE(__pstart)  & \
@@ -1726,20 +1718,9 @@ and return the result in 4-byte value in host byte ordering.*/
                (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \
        )
 
-/*Description:
-Set subfield of little-endian 4-byte value to specified value. */
-#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
-       *((u32 *)(__pstart)) = EF4BYTE \
-       ( \
-               LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
-               ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
-       );
-#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
-       *((u16 *)(__pstart)) = EF2BYTE \
-       ( \
-               LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
-               ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
-       );
+/* Description:
+ * Set subfield of little-endian 4-byte value to specified value.
+ */
 #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
        *((u8 *)(__pstart)) = EF1BYTE \
        ( \
@@ -1747,16 +1728,12 @@ Set subfield of little-endian 4-byte value to specified value.  */
                ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
        );
 
-#define        N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
-       (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
-
 /****************************************
        mem access macro define end
 ****************************************/
 
 #define byte(x, n) ((x >> (8 * n)) & 0xff)
 
-#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
 #define RTL_WATCH_DOG_TIME     2000
 #define MSECS(t)               msecs_to_jiffies(t)
 #define WLAN_FC_GET_VERS(fc)   (le16_to_cpu(fc) & IEEE80211_FCTL_VERS)
@@ -1791,15 +1768,6 @@ Set subfield of little-endian 4-byte value to specified value.   */
 #define container_of_dwork_rtl(x, y, z) \
        container_of(container_of(x, struct delayed_work, work), y, z)
 
-#define FILL_OCTET_STRING(_os, _octet, _len)   \
-       do {                                    \
-               (_os). octet = (u8 *)(_octet);          \
-               (_os). length = (_len);         \
-       } while (0);
-
-#define CP_MACADDR(des, src)           \
-       memcpy((des), (src), ETH_ALEN)
-
 static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr)
 {
        return rtlpriv->io.read8_sync(rtlpriv, addr);