From 2b67e88f648f3b16783feb09178719380150e51f Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 22 Aug 2011 16:50:16 -0500 Subject: rtlwifi: rtl8192cu: Convert to use the new rate-mapping routine in rtlwifi This patch also removes the now unused code from rtl8192ce/def.h. Signed-off-by: Larry Finger Cc: Chaoming Li Signed-off-by: John W. Linville --- drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 139 --------------------------- 1 file changed, 139 deletions(-) (limited to 'drivers/net/wireless/rtlwifi/rtl8192ce/def.h') diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h index 35ff7df41a1d..11f43196e61d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h @@ -220,41 +220,6 @@ enum rtl_desc_qsel { QSLT_CMD = 0x13, }; -enum rtl_desc92c_rate { - DESC92C_RATE1M = 0x00, - DESC92C_RATE2M = 0x01, - DESC92C_RATE5_5M = 0x02, - DESC92C_RATE11M = 0x03, - - DESC92C_RATE6M = 0x04, - DESC92C_RATE9M = 0x05, - DESC92C_RATE12M = 0x06, - DESC92C_RATE18M = 0x07, - DESC92C_RATE24M = 0x08, - DESC92C_RATE36M = 0x09, - DESC92C_RATE48M = 0x0a, - DESC92C_RATE54M = 0x0b, - - DESC92C_RATEMCS0 = 0x0c, - DESC92C_RATEMCS1 = 0x0d, - DESC92C_RATEMCS2 = 0x0e, - DESC92C_RATEMCS3 = 0x0f, - DESC92C_RATEMCS4 = 0x10, - DESC92C_RATEMCS5 = 0x11, - DESC92C_RATEMCS6 = 0x12, - DESC92C_RATEMCS7 = 0x13, - DESC92C_RATEMCS8 = 0x14, - DESC92C_RATEMCS9 = 0x15, - DESC92C_RATEMCS10 = 0x16, - DESC92C_RATEMCS11 = 0x17, - DESC92C_RATEMCS12 = 0x18, - DESC92C_RATEMCS13 = 0x19, - DESC92C_RATEMCS14 = 0x1a, - DESC92C_RATEMCS15 = 0x1b, - DESC92C_RATEMCS15_SG = 0x1c, - DESC92C_RATEMCS32 = 0x20, -}; - struct phy_sts_cck_8192s_t { u8 adc_pwdb_X[4]; u8 sq_rpt; @@ -267,108 +232,4 @@ struct h2c_cmd_8192c { u8 *p_cmdbuffer; }; -/* NOTE: reference to rtl8192c_rates struct */ -static inline int _rtl92c_rate_mapping(struct ieee80211_hw *hw, bool isHT, - u8 desc_rate, bool first_ampdu) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int rate_idx = 0; - - if (first_ampdu) { - if (false == isHT) { - switch (desc_rate) { - case DESC92C_RATE1M: - rate_idx = 0; - break; - case DESC92C_RATE2M: - rate_idx = 1; - break; - case DESC92C_RATE5_5M: - rate_idx = 2; - break; - case DESC92C_RATE11M: - rate_idx = 3; - break; - case DESC92C_RATE6M: - rate_idx = 4; - break; - case DESC92C_RATE9M: - rate_idx = 5; - break; - case DESC92C_RATE12M: - rate_idx = 6; - break; - case DESC92C_RATE18M: - rate_idx = 7; - break; - case DESC92C_RATE24M: - rate_idx = 8; - break; - case DESC92C_RATE36M: - rate_idx = 9; - break; - case DESC92C_RATE48M: - rate_idx = 10; - break; - case DESC92C_RATE54M: - rate_idx = 11; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, - ("Rate %d is not support, set to " - "1M rate.\n", desc_rate)); - rate_idx = 0; - break; - } - } else { - rate_idx = 11; - } - return rate_idx; - } - switch (desc_rate) { - case DESC92C_RATE1M: - rate_idx = 0; - break; - case DESC92C_RATE2M: - rate_idx = 1; - break; - case DESC92C_RATE5_5M: - rate_idx = 2; - break; - case DESC92C_RATE11M: - rate_idx = 3; - break; - case DESC92C_RATE6M: - rate_idx = 4; - break; - case DESC92C_RATE9M: - rate_idx = 5; - break; - case DESC92C_RATE12M: - rate_idx = 6; - break; - case DESC92C_RATE18M: - rate_idx = 7; - break; - case DESC92C_RATE24M: - rate_idx = 8; - break; - case DESC92C_RATE36M: - rate_idx = 9; - break; - case DESC92C_RATE48M: - rate_idx = 10; - break; - case DESC92C_RATE54M: - rate_idx = 11; - break; - /* TODO: How to mapping MCS rate? */ - /* NOTE: referenc to __ieee80211_rx */ - default: - rate_idx = 11; - break; - } - return rate_idx; -} - #endif -- cgit v1.2.3 From db7599391385f9837ac8a35b8f9d202b85409992 Mon Sep 17 00:00:00 2001 From: Chaoming Li Date: Tue, 11 Oct 2011 21:28:49 -0500 Subject: rtlwifi: rtl8192ce: Add new chip revisions This patch incorporate the differences between the 06/20/2011 and 08/16/2011 Realtek releases of the rtlwifi driver. The changes include: 1. Adding new chip revisions including new firmware. Signed-off-by: Chaoming Li Signed-off-by: Larry Finger Signed-off-by: John W. Linville --- drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 14 ++++++++++++++ drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | 14 ++++++++++++-- drivers/net/wireless/rtlwifi/rtl8192cu/def.h | 4 ---- 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'drivers/net/wireless/rtlwifi/rtl8192ce/def.h') diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h index 11f43196e61d..9fc804d89d65 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h @@ -142,8 +142,22 @@ enum version_8192c { VERSION_UNKNOWN = 0x88, }; +#define CUT_VERSION_MASK (BIT(6)|BIT(7)) +#define CHIP_VENDOR_UMC BIT(5) +#define CHIP_VENDOR_UMC_B_CUT BIT(6) /* Chip version for ECO */ +#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ + ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) #define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false) +#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ + ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) #define IS_92C_SERIAL(version) ((version & CHIP_92C_BITMASK) ? true : false) +#define IS_CHIP_VENDOR_UMC(version) \ + ((version & CHIP_VENDOR_UMC) ? true : false) +#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) +#define IS_81xxC_VENDOR_UMC_B_CUT(version) \ + ((IS_CHIP_VENDOR_UMC(version)) ? \ + ((GET_CVID_CUT_VERSION(version) == CHIP_VENDOR_UMC_B_CUT) ? \ + true : false) : false) enum rtl819x_loopback_e { RTL819X_NO_LOOPBACK = 0, diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c index 141302f2b044..a48404cc2b96 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c @@ -92,6 +92,8 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); const struct firmware *firmware; + struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); + char *fw_name = NULL; rtl8192ce_bt_reg_init(hw); @@ -161,8 +163,14 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) } /* request fw */ - err = request_firmware(&firmware, rtlpriv->cfg->fw_name, - rtlpriv->io.dev); + if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && + !IS_92C_SERIAL(rtlhal->version)) + fw_name = "rtlwifi/rtl8192cfwU.bin"; + else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) + fw_name = "rtlwifi/rtl8192cfwU_B.bin"; + else + fw_name = rtlpriv->cfg->fw_name; + err = request_firmware(&firmware, fw_name, rtlpriv->io.dev); if (err) { RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Failed to request firmware!\n")); @@ -358,6 +366,8 @@ MODULE_AUTHOR("Larry Finger "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless"); MODULE_FIRMWARE("rtlwifi/rtl8192cfw.bin"); +MODULE_FIRMWARE("rtlwifi/rtl8192cfwU.bin"); +MODULE_FIRMWARE("rtlwifi/rtl8192cfwU_B.bin"); module_param_named(swenc, rtl92ce_mod_params.sw_crypto, bool, 0444); module_param_named(debug, rtl92ce_mod_params.debug, int, 0444); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h b/drivers/net/wireless/rtlwifi/rtl8192cu/def.h index c54940ea72fe..d097efb1e717 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/def.h @@ -50,10 +50,6 @@ #define IS_VENDOR_UMC(version) \ (((version) & CHIP_VENDOR_UMC) ? true : false) -#define IS_VENDOR_UMC_A_CUT(version) \ - (((version) & CHIP_VENDOR_UMC) ? (((version) & (BIT(6) | BIT(7))) ? \ - false : true) : false) - #define IS_VENDOR_8723_A_CUT(version) \ (((version) & CHIP_VENDOR_UMC) ? (((version) & (BIT(6))) ? \ false : true) : false) -- cgit v1.2.3