diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index f8ba01cbc6dd..4753fb1b0aaf 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -818,8 +818,6 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
818 | /* | 818 | /* |
819 | * Enable beaconing again. | 819 | * Enable beaconing again. |
820 | */ | 820 | */ |
821 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
822 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
823 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | 821 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); |
824 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 822 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
825 | 823 | ||
@@ -831,8 +829,8 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
831 | } | 829 | } |
832 | EXPORT_SYMBOL_GPL(rt2800_write_beacon); | 830 | EXPORT_SYMBOL_GPL(rt2800_write_beacon); |
833 | 831 | ||
834 | static inline void rt2800_clear_beacon(struct rt2x00_dev *rt2x00dev, | 832 | static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, |
835 | unsigned int beacon_base) | 833 | unsigned int beacon_base) |
836 | { | 834 | { |
837 | int i; | 835 | int i; |
838 | 836 | ||
@@ -845,6 +843,33 @@ static inline void rt2800_clear_beacon(struct rt2x00_dev *rt2x00dev, | |||
845 | rt2800_register_write(rt2x00dev, beacon_base + i, 0); | 843 | rt2800_register_write(rt2x00dev, beacon_base + i, 0); |
846 | } | 844 | } |
847 | 845 | ||
846 | void rt2800_clear_beacon(struct queue_entry *entry) | ||
847 | { | ||
848 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
849 | u32 reg; | ||
850 | |||
851 | /* | ||
852 | * Disable beaconing while we are reloading the beacon data, | ||
853 | * otherwise we might be sending out invalid data. | ||
854 | */ | ||
855 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
856 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); | ||
857 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
858 | |||
859 | /* | ||
860 | * Clear beacon. | ||
861 | */ | ||
862 | rt2800_clear_beacon_register(rt2x00dev, | ||
863 | HW_BEACON_OFFSET(entry->entry_idx)); | ||
864 | |||
865 | /* | ||
866 | * Enabled beaconing again. | ||
867 | */ | ||
868 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
869 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
870 | } | ||
871 | EXPORT_SYMBOL_GPL(rt2800_clear_beacon); | ||
872 | |||
848 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 873 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
849 | const struct rt2x00debug rt2800_rt2x00debug = { | 874 | const struct rt2x00debug rt2800_rt2x00debug = { |
850 | .owner = THIS_MODULE, | 875 | .owner = THIS_MODULE, |
@@ -1155,29 +1180,11 @@ void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, | |||
1155 | 1180 | ||
1156 | if (flags & CONFIG_UPDATE_TYPE) { | 1181 | if (flags & CONFIG_UPDATE_TYPE) { |
1157 | /* | 1182 | /* |
1158 | * Clear current synchronisation setup. | ||
1159 | */ | ||
1160 | rt2800_clear_beacon(rt2x00dev, | ||
1161 | HW_BEACON_OFFSET(intf->beacon->entry_idx)); | ||
1162 | /* | ||
1163 | * Enable synchronisation. | 1183 | * Enable synchronisation. |
1164 | */ | 1184 | */ |
1165 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | 1185 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); |
1166 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
1167 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, conf->sync); | 1186 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, conf->sync); |
1168 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, | ||
1169 | (conf->sync == TSF_SYNC_ADHOC || | ||
1170 | conf->sync == TSF_SYNC_AP_NONE)); | ||
1171 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 1187 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
1172 | |||
1173 | /* | ||
1174 | * Enable pre tbtt interrupt for beaconing modes | ||
1175 | */ | ||
1176 | rt2800_register_read(rt2x00dev, INT_TIMER_EN, ®); | ||
1177 | rt2x00_set_field32(®, INT_TIMER_EN_PRE_TBTT_TIMER, | ||
1178 | (conf->sync == TSF_SYNC_AP_NONE)); | ||
1179 | rt2800_register_write(rt2x00dev, INT_TIMER_EN, reg); | ||
1180 | |||
1181 | } | 1188 | } |
1182 | 1189 | ||
1183 | if (flags & CONFIG_UPDATE_MAC) { | 1190 | if (flags & CONFIG_UPDATE_MAC) { |
@@ -2187,14 +2194,14 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
2187 | /* | 2194 | /* |
2188 | * Clear all beacons | 2195 | * Clear all beacons |
2189 | */ | 2196 | */ |
2190 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE0); | 2197 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE0); |
2191 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE1); | 2198 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE1); |
2192 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE2); | 2199 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE2); |
2193 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE3); | 2200 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE3); |
2194 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE4); | 2201 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE4); |
2195 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE5); | 2202 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE5); |
2196 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE6); | 2203 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE6); |
2197 | rt2800_clear_beacon(rt2x00dev, HW_BEACON_BASE7); | 2204 | rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE7); |
2198 | 2205 | ||
2199 | if (rt2x00_is_usb(rt2x00dev)) { | 2206 | if (rt2x00_is_usb(rt2x00dev)) { |
2200 | rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); | 2207 | rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); |