aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
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
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')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c47
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.h11
2 files changed, 46 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 93ebf245876..cf4a97f32ab 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
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h
index 8e4291d280b..61a8be61d3f 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.h
+++ b/drivers/net/wireless/rt2x00/rt2800usb.h
@@ -1375,6 +1375,10 @@ struct mac_iveiv_entry {
1375 * H2M_MAILBOX_CID: 1375 * H2M_MAILBOX_CID:
1376 */ 1376 */
1377#define H2M_MAILBOX_CID 0x7014 1377#define H2M_MAILBOX_CID 0x7014
1378#define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff)
1379#define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00)
1380#define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000)
1381#define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000)
1378 1382
1379/* 1383/*
1380 * H2M_MAILBOX_STATUS: 1384 * H2M_MAILBOX_STATUS:
@@ -1715,6 +1719,7 @@ struct mac_iveiv_entry {
1715#define MCU_SLEEP 0x30 1719#define MCU_SLEEP 0x30
1716#define MCU_WAKEUP 0x31 1720#define MCU_WAKEUP 0x31
1717#define MCU_RADIO_OFF 0x35 1721#define MCU_RADIO_OFF 0x35
1722#define MCU_CURRENT 0x36
1718#define MCU_LED 0x50 1723#define MCU_LED 0x50
1719#define MCU_LED_STRENGTH 0x51 1724#define MCU_LED_STRENGTH 0x51
1720#define MCU_LED_1 0x52 1725#define MCU_LED_1 0x52
@@ -1723,6 +1728,12 @@ struct mac_iveiv_entry {
1723#define MCU_RADAR 0x60 1728#define MCU_RADAR 0x60
1724#define MCU_BOOT_SIGNAL 0x72 1729#define MCU_BOOT_SIGNAL 0x72
1725#define MCU_BBP_SIGNAL 0x80 1730#define MCU_BBP_SIGNAL 0x80
1731#define MCU_POWER_SAVE 0x83
1732
1733/*
1734 * MCU mailbox tokens
1735 */
1736#define TOKEN_WAKUP 3
1726 1737
1727/* 1738/*
1728 * DMA descriptor defines. 1739 * DMA descriptor defines.