aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2009-04-28 14:14:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:55 -0400
commit15e469284d5e89c9113379b68566b0e059a97704 (patch)
tree9900894c6620016c7ae5dff5a89af1f906bdc72a /drivers/net/wireless/rt2x00/rt2800usb.c
parente430d6074dede3b4d7d87e30296fe3894cb4709c (diff)
rt2x00: Synchronize initialization with rt2870 driver
Ralink released a new rt2870 driver, these are the obvious differences I could find. It doesn't same to make my device work better, but neither does it seem to regress... Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 93ebf2458762..cf4a97f32ab3 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -984,9 +984,9 @@ static void rt2800usb_config_ps(struct rt2x00_dev *rt2x00dev,
984 rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1); 984 rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
985 rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); 985 rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
986 986
987 rt2800usb_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0); 987 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
988 } else { 988 } else {
989 rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0); 989 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
990 990
991 rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg); 991 rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
992 rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0); 992 rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
@@ -1171,7 +1171,9 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev,
1171 /* 1171 /*
1172 * Check which section of the firmware we need. 1172 * Check which section of the firmware we need.
1173 */ 1173 */
1174 if ((chipset == 0x2860) || (chipset == 0x2872) || (chipset == 0x3070)) { 1174 if ((chipset == 0x2860) ||
1175 (chipset == 0x2872) ||
1176 (chipset == 0x3070)) {
1175 offset = 0; 1177 offset = 0;
1176 length = 4096; 1178 length = 4096;
1177 } else { 1179 } else {
@@ -1218,6 +1220,22 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev,
1218 return status; 1220 return status;
1219 } 1221 }
1220 1222
1223 msleep(10);
1224 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
1225
1226 /*
1227 * Send signal to firmware during boot time.
1228 */
1229 rt2800usb_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
1230
1231 if ((chipset == 0x3070) ||
1232 (chipset == 0x3071) ||
1233 (chipset == 0x3572)) {
1234 udelay(200);
1235 rt2800usb_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0);
1236 udelay(10);
1237 }
1238
1221 /* 1239 /*
1222 * Wait for device to stabilize. 1240 * Wait for device to stabilize.
1223 */ 1241 */
@@ -1566,6 +1584,14 @@ static int rt2800usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
1566 unsigned int i; 1584 unsigned int i;
1567 u8 value; 1585 u8 value;
1568 1586
1587 /*
1588 * BBP was enabled after firmware was loaded,
1589 * but we need to reactivate it now.
1590 */
1591 rt2x00usb_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
1592 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
1593 msleep(1);
1594
1569 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 1595 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
1570 rt2800usb_bbp_read(rt2x00dev, 0, &value); 1596 rt2800usb_bbp_read(rt2x00dev, 0, &value);
1571 if ((value != 0xff) && (value != 0x00)) 1597 if ((value != 0xff) && (value != 0x00))
@@ -1823,8 +1849,12 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
1823 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN, 1849 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN,
1824 (rt2x00dev->rx->usb_maxpacket == 512)); 1850 (rt2x00dev->rx->usb_maxpacket == 512));
1825 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128); 1851 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128);
1826 /* FIXME: Calculate this value based on Aggregation defines */ 1852 /*
1827 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_LIMIT, 21); 1853 * Total room for RX frames in kilobytes, PBF might still exceed
1854 * this limit so reduce the number to prevent errors.
1855 */
1856 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_LIMIT,
1857 ((RX_ENTRIES * DATA_FRAME_SIZE) / 1024) - 3);
1828 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1); 1858 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1);
1829 rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1); 1859 rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1);
1830 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg); 1860 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg);
@@ -1835,11 +1865,6 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
1835 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 1865 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
1836 1866
1837 /* 1867 /*
1838 * Send signal to firmware during boot time.
1839 */
1840 rt2800usb_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
1841
1842 /*
1843 * Initialize LED control 1868 * Initialize LED control
1844 */ 1869 */
1845 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); 1870 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word);
@@ -1879,8 +1904,6 @@ static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev)
1879static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev, 1904static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev,
1880 enum dev_state state) 1905 enum dev_state state)
1881{ 1906{
1882 rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
1883
1884 if (state == STATE_AWAKE) 1907 if (state == STATE_AWAKE)
1885 rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0); 1908 rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
1886 else 1909 else