(2 * sizeof(__le32)));
 }
 
-static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, int type)
+static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
+                                 const int tsf_sync)
 {
-       struct interface *intf = &rt2x00dev->interface;
        u32 reg;
 
        rt2x00pci_register_write(rt2x00dev, CSR14, 0);
        rt2x00_set_field32(®, CSR14_TSF_COUNT, 1);
        rt2x00_set_field32(®, CSR14_TBCN, 1);
        rt2x00_set_field32(®, CSR14_BEACON_GEN, 0);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) ||
-           is_interface_type(intf, IEEE80211_IF_TYPE_AP))
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 2);
-       else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 1);
-       else
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 0);
+       rt2x00_set_field32(®, CSR14_TSF_SYNC, tsf_sync);
        rt2x00pci_register_write(rt2x00dev, CSR14, reg);
 }
 
 
                                      (2 * sizeof(__le32)));
 }
 
-static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type)
+static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
+                                 const int tsf_sync)
 {
-       struct interface *intf = &rt2x00dev->interface;
        u32 reg;
 
        rt2x00pci_register_write(rt2x00dev, CSR14, 0);
        rt2x00_set_field32(®, CSR14_TSF_COUNT, 1);
        rt2x00_set_field32(®, CSR14_TBCN, 1);
        rt2x00_set_field32(®, CSR14_BEACON_GEN, 0);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) ||
-           is_interface_type(intf, IEEE80211_IF_TYPE_AP))
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 2);
-       else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 1);
-       else
-               rt2x00_set_field32(®, CSR14_TSF_SYNC, 0);
+       rt2x00_set_field32(®, CSR14_TSF_SYNC, tsf_sync);
        rt2x00pci_register_write(rt2x00dev, CSR14, reg);
 }
 
 
                                      (3 * sizeof(__le16)));
 }
 
-static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type)
+static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type,
+                                 const int tsf_sync)
 {
-       struct interface *intf = &rt2x00dev->interface;
        u16 reg;
 
        rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0);
        rt2500usb_register_read(rt2x00dev, TXRX_CSR20, ®);
        rt2x00_set_field16(®, TXRX_CSR20_OFFSET,
                           (PREAMBLE + get_duration(IEEE80211_HEADER, 2)) >> 6);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
+       if (type == IEEE80211_IF_TYPE_STA)
                rt2x00_set_field16(®, TXRX_CSR20_BCN_EXPECT_WINDOW, 0);
        else
                rt2x00_set_field16(®, TXRX_CSR20_BCN_EXPECT_WINDOW, 2);
        rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1);
        rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1);
        rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 0);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) ||
-           is_interface_type(intf, IEEE80211_IF_TYPE_AP))
-               rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, 2);
-       else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
-               rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, 1);
-       else
-               rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, 0);
+       rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, tsf_sync);
        rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
 }
 
 
         */
        void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac);
        void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid);
-       void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type);
+       void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type,
+                                                          const int tsf_sync);
        void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags,
                        struct ieee80211_conf *conf);
 #define CONFIG_UPDATE_PHYMODE          ( 1 << 1 )
 
        rt2x00dev->ops->lib->config_bssid(rt2x00dev, ®[0]);
 }
 
-void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type)
+void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type)
 {
-       if (type != INVALID_INTERFACE)
-               rt2x00dev->ops->lib->config_type(rt2x00dev, type);
+       int tsf_sync;
+
+       switch (type) {
+       case IEEE80211_IF_TYPE_IBSS:
+       case IEEE80211_IF_TYPE_AP:
+               tsf_sync = TSF_SYNC_BEACON;
+               break;
+       case IEEE80211_IF_TYPE_STA:
+               tsf_sync = TSF_SYNC_INFRA;
+               break;
+       default:
+               tsf_sync = TSF_SYNC_NONE;
+               break;
+       }
+
+       rt2x00dev->ops->lib->config_type(rt2x00dev, type, tsf_sync);
 }
 
 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
 
  */
 void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac);
 void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid);
-void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type);
+void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type);
 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
                      struct ieee80211_conf *conf, const int force_config);
 
 
        LED_MODE_ALPHA = 4,
 };
 
+/*
+ * TSF sync values
+ */
+enum tsf_sync {
+       TSF_SYNC_NONE = 0,
+       TSF_SYNC_INFRA = 1,
+       TSF_SYNC_BEACON = 2,
+};
+
 /*
  * Device states
  */
 
                                      (2 * sizeof(__le32)));
 }
 
-static void rt61pci_config_type(struct rt2x00_dev *rt2x00dev, const int type)
+static void rt61pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
+                               const int tsf_sync)
 {
-       struct interface *intf = &rt2x00dev->interface;
        u32 reg;
 
        /*
        rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1);
        rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1);
        rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) ||
-           is_interface_type(intf, IEEE80211_IF_TYPE_AP))
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 2);
-       else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 1);
-       else
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 0);
+       rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, tsf_sync);
        rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
 }
 
 
                                    (2 * sizeof(__le32)));
 }
 
-static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type)
+static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type,
+                               const int tsf_sync)
 {
-       struct interface *intf = &rt2x00dev->interface;
        u32 reg;
 
        /*
        rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1);
        rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1);
        rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0);
-       if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) ||
-           is_interface_type(intf, IEEE80211_IF_TYPE_AP))
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 2);
-       else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 1);
-       else
-               rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 0);
+       rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, tsf_sync);
        rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
 }