aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2008-10-13 14:11:00 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:19 -0400
commitf8288317b5076fde0bb4e91cd4754379c850be7a (patch)
treec0d96383a3d66ccecd141a9275c05bf6307f69de /drivers
parent64761077f815660276f69b497edb9842d880df9a (diff)
rtl8187: add short slot handling for 8187B
This change adds short slot handling for 8187B variant of rtl8187 chips. Some things to note about changes done: * Values used are chosen to met 802.11-2007 spec. This raised a question about SIFS value used with 8187L: 0x22 (34) doesn't match any spec value. For now just don't change 8187L, but is something to be looked at. * On 8187B, the location of EIFS register is at the same place as BRSR+1 of struct rtl818x_csr. Unfortunately there is no clean way to accomodate 8187B differences currently, just use address of BRSR+1 and comment about it. The same thing happens for Ack timeout register, that is on CARRIER_SENSE_COUNTER location of 8187L. The eifs and ack timeout values are in units of 4us. All these registers information was gathered from references being the vendor gpl driver and 8180 datasheet, unfortunately there is no information about this on 8187B datasheet. Also the ack timeout value was inspired by the same calculation as done on rt2x00. Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rtl8187_dev.c45
-rw-r--r--drivers/net/wireless/rtl8187_rtl8225.c8
2 files changed, 41 insertions, 12 deletions
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 991d65c27088..cd839bcb6d78 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -911,9 +911,45 @@ static int rtl8187_config_interface(struct ieee80211_hw *dev,
911 return 0; 911 return 0;
912} 912}
913 913
914static void rtl8187_conf_erp(struct rtl8187_priv *priv, bool use_short_slot) 914static void rtl8187_conf_erp(struct rtl8187_priv *priv, bool use_short_slot,
915 bool use_short_preamble)
915{ 916{
916 if (!priv->is_rtl8187b) { 917 if (priv->is_rtl8187b) {
918 u8 difs, eifs, slot_time;
919 u16 ack_timeout;
920
921 if (use_short_slot) {
922 slot_time = 0x9;
923 difs = 0x1c;
924 eifs = 0x53;
925 } else {
926 slot_time = 0x14;
927 difs = 0x32;
928 eifs = 0x5b;
929 }
930 rtl818x_iowrite8(priv, &priv->map->SIFS, 0xa);
931 rtl818x_iowrite8(priv, &priv->map->SLOT, slot_time);
932 rtl818x_iowrite8(priv, &priv->map->DIFS, difs);
933
934 /*
935 * BRSR+1 on 8187B is in fact EIFS register
936 * Value in units of 4 us
937 */
938 rtl818x_iowrite8(priv, (u8 *)&priv->map->BRSR + 1, eifs);
939
940 /*
941 * For 8187B, CARRIER_SENSE_COUNTER is in fact ack timeout
942 * register. In units of 4 us like eifs register
943 * ack_timeout = ack duration + plcp + difs + preamble
944 */
945 ack_timeout = 112 + 48 + difs;
946 if (use_short_preamble)
947 ack_timeout += 72;
948 else
949 ack_timeout += 144;
950 rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER,
951 DIV_ROUND_UP(ack_timeout, 4));
952 } else {
917 rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22); 953 rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
918 if (use_short_slot) { 954 if (use_short_slot) {
919 rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9); 955 rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9);
@@ -936,8 +972,9 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
936{ 972{
937 struct rtl8187_priv *priv = dev->priv; 973 struct rtl8187_priv *priv = dev->priv;
938 974
939 if (changed & BSS_CHANGED_ERP_SLOT) 975 if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_ERP_PREAMBLE))
940 rtl8187_conf_erp(priv, info->use_short_slot); 976 rtl8187_conf_erp(priv, info->use_short_slot,
977 info->use_short_preamble);
941} 978}
942 979
943static void rtl8187_configure_filter(struct ieee80211_hw *dev, 980static void rtl8187_configure_filter(struct ieee80211_hw *dev,
diff --git a/drivers/net/wireless/rtl8187_rtl8225.c b/drivers/net/wireless/rtl8187_rtl8225.c
index 1bae89903410..b999f87ed150 100644
--- a/drivers/net/wireless/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl8187_rtl8225.c
@@ -885,14 +885,6 @@ static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)
885 for (i = 0; i < ARRAY_SIZE(rtl8225z2_ofdm); i++) 885 for (i = 0; i < ARRAY_SIZE(rtl8225z2_ofdm); i++)
886 rtl8225_write_phy_ofdm(dev, i, rtl8225z2_ofdm[i]); 886 rtl8225_write_phy_ofdm(dev, i, rtl8225z2_ofdm[i]);
887 887
888 rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
889 rtl818x_iowrite8(priv, &priv->map->SLOT, 9);
890 rtl818x_iowrite8(priv, (u8 *)0xFFF0, 28);
891 rtl818x_iowrite8(priv, (u8 *)0xFFF4, 28);
892 rtl818x_iowrite8(priv, (u8 *)0xFFF8, 28);
893 rtl818x_iowrite8(priv, (u8 *)0xFFFC, 28);
894 rtl818x_iowrite8(priv, (u8 *)0xFF2D, 0x5B);
895 rtl818x_iowrite8(priv, (u8 *)0xFF79, 0x5B);
896 rtl818x_iowrite32(priv, (__le32 *)0xFFF0, (7 << 12) | (3 << 8) | 28); 888 rtl818x_iowrite32(priv, (__le32 *)0xFFF0, (7 << 12) | (3 << 8) | 28);
897 rtl818x_iowrite32(priv, (__le32 *)0xFFF4, (7 << 12) | (3 << 8) | 28); 889 rtl818x_iowrite32(priv, (__le32 *)0xFFF4, (7 << 12) | (3 << 8) | 28);
898 rtl818x_iowrite32(priv, (__le32 *)0xFFF8, (7 << 12) | (3 << 8) | 28); 890 rtl818x_iowrite32(priv, (__le32 *)0xFFF8, (7 << 12) | (3 << 8) | 28);