Skip to contentSkip to conversation

rt2x00: Misc fixes

PATCH In review Ivo van Doorn 1 participant 1 message Feb 28, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 28/28 rt2x00: Misc fixes

Misc fixes:
- sparse fixes
- register initialization
- device uninitialization
- txpower updating

---

drivers/net/wireless/mac80211/rt2x00/rt2400pci.c +29 -9
index 04ceda9..1a2164d 100644
@@ -395,6 +395,12 @@ static void rt2400pci_config_channel(struct rt2x00_dev *rt2x00dev,
 	if (channel == rt2x00dev->rx_status.channel)
 		return;
 
+	/*
+	 * Switch on tuning bits.
+	 */
+	rt2x00_set_field32(&rf1, RF1_TUNER, 1);
+	rt2x00_set_field32(&rf3, RF3_TUNER, 1);
+
 	INFO("Switching channel. RF1: 0x%08x, RF2: 0x%08x, RF3: 0x%08x.\n",
 		rf1, rf2, rf3);
 
@@ -626,10 +632,8 @@ static void rt2400pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
  */
 static void rt2400pci_link_tuner(struct work_struct *work)
 {
-	struct link *link =
-		container_of(work, struct link, work.work);
 	struct rt2x00_dev *rt2x00dev =
-		container_of(link, struct rt2x00_dev, link);
+		container_of(work, struct rt2x00_dev, link.work.work);
 	u8 reg;
 	char false_cca_delta;
 
@@ -1086,6 +1090,7 @@ static int rt2400pci_init_bbp(struct rt2x00_dev *rt2x00dev)
 		if ((value != 0xff) && (value != 0x00))
 			goto continue_csr_init;
 		NOTICE("Waiting for BBP register.\n");
+		udelay(REGISTER_BUSY_DELAY);
 	}
 
 	ERROR("BBP register access failed, aborting.\n");
@@ -1800,6 +1805,7 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw,
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
 	struct data_entry *entry;
+	u32 reg;
 
 	entry = rt2x00_get_data_entry(&rt2x00dev->ring[RING_BEACON]);
 
@@ -1817,6 +1823,15 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw,
 	rt2400pci_write_tx_desc(rt2x00dev, entry->priv,
 		(struct ieee80211_hdr *)skb->data, skb->len, control);
 
+	/*
+	 * Enable beacon generation.
+	 */
+	rt2x00_register_read(rt2x00dev, CSR14, &reg);
+	if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
+		rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
+		rt2x00_register_write(rt2x00dev, CSR14, reg);
+	}
+
 	return 0;
 }
 
@@ -1829,7 +1844,7 @@ static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw)
 	return rt2x00_get_field32(reg, CSR15_BEACON_SENT);
 }
 
-static struct ieee80211_ops rt2400pci_mac80211_ops = {
+static const struct ieee80211_ops rt2400pci_mac80211_ops = {
 	.tx			= rt2x00lib_tx,
 	.reset			= rt2x00lib_reset,
 	.add_interface		= rt2x00lib_add_interface,
@@ -1913,7 +1928,7 @@ static int rt2400pci_alloc_eeprom(struct rt2x00_dev *rt2x00dev)
 	 * Allocate the eeprom memory, check the eeprom width
 	 * and copy the entire eeprom into this allocated memory.
 	 */
-	rt2x00dev->eeprom = kzalloc(EEPROM_SIZE * sizeof(u16), GFP_KERNEL);
+	rt2x00dev->eeprom = kzalloc(EEPROM_SIZE, GFP_KERNEL);
 	if (!rt2x00dev->eeprom)
 		return -ENOMEM;
 
@@ -1930,7 +1945,7 @@ static int rt2400pci_alloc_eeprom(struct rt2x00_dev *rt2x00dev)
 	eeprom.reg_chip_select = 0;
 
 	eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom,
-		EEPROM_SIZE);
+		EEPROM_SIZE / sizeof(u16));
 
 	return 0;
 }
@@ -1982,8 +1997,10 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	rt2x00_set_chip(&rt2x00dev->chip, RT2460, value, reg);
 
 	if (!rt2x00_rf(&rt2x00dev->chip, RF2420) &&
-	    !rt2x00_rf(&rt2x00dev->chip, RF2421))
+	    !rt2x00_rf(&rt2x00dev->chip, RF2421)) {
+		ERROR("Invalid RF chipset detected.");
 		return -ENODEV;
+	}
 
 	/*
 	 * Identify default antenna configuration.
@@ -2418,7 +2435,11 @@ static void rt2400pci_remove(struct pci_dev *pci_dev)
 	struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
 	struct rt2x00_dev *rt2x00dev = hw->priv;
 
+	/*
+	 * Uninitialize the 80211 stack data.
+	 */
 	ieee80211_netif_oper(hw, NETIF_DETACH);
+	ieee80211_unregister_hw(hw);
 
 	/*
 	 * Uninitialize and free the rt2400pci driver data.
@@ -2428,9 +2449,8 @@ static void rt2400pci_remove(struct pci_dev *pci_dev)
 	rt2400pci_free_dev(rt2x00dev);
 
 	/*
-	 * Uninitialize and free the 80211 stack data.
+	 * Free the 80211 stack data.
 	 */
-	ieee80211_unregister_hw(hw);
 	ieee80211_free_hw(hw);
 
 	/*
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c +34 -11

127 lines not on this page · raw message

drivers/net/wireless/mac80211/rt2x00/rt2500usb.c +23 -25

143 lines not on this page · raw message

drivers/net/wireless/mac80211/rt2x00/rt2500usb.h +1 -1
index 4cb05e5..287160c 100644
@@ -547,7 +547,7 @@
 /*
  * EEPROM BBP.
  */
-#define EEPROM_BBP_START		0x0076
+#define EEPROM_BBP_START		0x000e
 #define EEPROM_BBP_SIZE			16
 #define EEPROM_BBP_VALUE		FIELD16(0x00ff)
 #define EEPROM_BBP_REG_ID		FIELD16(0xff00)
drivers/net/wireless/mac80211/rt2x00/rt61pci.c +33 -18

154 lines not on this page · raw message

drivers/net/wireless/mac80211/rt2x00/rt73usb.c +19 -24

124 lines not on this page · raw message