aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c103
1 files changed, 58 insertions, 45 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index cae772ea5686..938f198f3562 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -97,7 +97,8 @@ static void rt2800pci_bbp_write(struct rt2x00_dev *rt2x00dev,
97 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 97 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word);
98 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 98 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1);
99 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 0); 99 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 0);
100 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 100 if (rt2x00_intf_is_pci(rt2x00dev))
101 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1);
101 102
102 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); 103 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
103 } 104 }
@@ -125,7 +126,8 @@ static void rt2800pci_bbp_read(struct rt2x00_dev *rt2x00dev,
125 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 126 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word);
126 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 127 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1);
127 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 1); 128 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 1);
128 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 129 if (rt2x00_intf_is_pci(rt2x00dev))
130 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1);
129 131
130 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); 132 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg);
131 133
@@ -253,12 +255,14 @@ static void rt2800pci_mcu_request(struct rt2x00_dev *rt2x00dev,
253{ 255{
254 u32 reg; 256 u32 reg;
255 257
256 /* 258 if (rt2x00_intf_is_pci(rt2x00dev)) {
257 * RT2880 and RT3052 don't support MCU requests. 259 /*
258 */ 260 * RT2880 and RT3052 don't support MCU requests.
259 if (rt2x00_rt(&rt2x00dev->chip, RT2880) || 261 */
260 rt2x00_rt(&rt2x00dev->chip, RT3052)) 262 if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
261 return; 263 rt2x00_rt(&rt2x00dev->chip, RT3052))
264 return;
265 }
262 266
263 mutex_lock(&rt2x00dev->csr_mutex); 267 mutex_lock(&rt2x00dev->csr_mutex);
264 268
@@ -814,7 +818,8 @@ static void rt2800pci_config_ant(struct rt2x00_dev *rt2x00dev,
814 switch ((int)ant->tx) { 818 switch ((int)ant->tx) {
815 case 1: 819 case 1:
816 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); 820 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0);
817 rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); 821 if (rt2x00_intf_is_pci(rt2x00dev))
822 rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
818 break; 823 break;
819 case 2: 824 case 2:
820 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2); 825 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2);
@@ -1480,7 +1485,8 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)
1480 u32 reg; 1485 u32 reg;
1481 unsigned int i; 1486 unsigned int i;
1482 1487
1483 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 1488 if (rt2x00_intf_is_pci(rt2x00dev))
1489 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
1484 1490
1485 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 1491 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
1486 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 1492 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
@@ -1803,7 +1809,8 @@ static int rt2800pci_init_bbp(struct rt2x00_dev *rt2x00dev)
1803 if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION) 1809 if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
1804 rt2800_bbp_write(rt2x00dev, 84, 0x19); 1810 rt2800_bbp_write(rt2x00dev, 84, 0x19);
1805 1811
1806 if (rt2x00_rt(&rt2x00dev->chip, RT3052)) { 1812 if (rt2x00_intf_is_pci(rt2x00dev) &&
1813 rt2x00_rt(&rt2x00dev->chip, RT3052)) {
1807 rt2800_bbp_write(rt2x00dev, 31, 0x08); 1814 rt2800_bbp_write(rt2x00dev, 31, 0x08);
1808 rt2800_bbp_write(rt2x00dev, 78, 0x0e); 1815 rt2800_bbp_write(rt2x00dev, 78, 0x0e);
1809 rt2800_bbp_write(rt2x00dev, 80, 0x08); 1816 rt2800_bbp_write(rt2x00dev, 80, 0x08);
@@ -1887,10 +1894,12 @@ static int rt2800pci_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1887 u8 rfcsr; 1894 u8 rfcsr;
1888 u8 bbp; 1895 u8 bbp;
1889 1896
1890 if (!rt2x00_rf(&rt2x00dev->chip, RF3020) && 1897 if (rt2x00_intf_is_pci(rt2x00dev)) {
1891 !rt2x00_rf(&rt2x00dev->chip, RF3021) && 1898 if (!rt2x00_rf(&rt2x00dev->chip, RF3020) &&
1892 !rt2x00_rf(&rt2x00dev->chip, RF3022)) 1899 !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
1893 return 0; 1900 !rt2x00_rf(&rt2x00dev->chip, RF3022))
1901 return 0;
1902 }
1894 1903
1895 /* 1904 /*
1896 * Init RF calibration. 1905 * Init RF calibration.
@@ -1902,36 +1911,38 @@ static int rt2800pci_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1902 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); 1911 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
1903 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); 1912 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1904 1913
1905 rt2800_rfcsr_write(rt2x00dev, 0, 0x50); 1914 if (rt2x00_intf_is_pci(rt2x00dev)) {
1906 rt2800_rfcsr_write(rt2x00dev, 1, 0x01); 1915 rt2800_rfcsr_write(rt2x00dev, 0, 0x50);
1907 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); 1916 rt2800_rfcsr_write(rt2x00dev, 1, 0x01);
1908 rt2800_rfcsr_write(rt2x00dev, 3, 0x75); 1917 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7);
1909 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); 1918 rt2800_rfcsr_write(rt2x00dev, 3, 0x75);
1910 rt2800_rfcsr_write(rt2x00dev, 5, 0x03); 1919 rt2800_rfcsr_write(rt2x00dev, 4, 0x40);
1911 rt2800_rfcsr_write(rt2x00dev, 6, 0x02); 1920 rt2800_rfcsr_write(rt2x00dev, 5, 0x03);
1912 rt2800_rfcsr_write(rt2x00dev, 7, 0x50); 1921 rt2800_rfcsr_write(rt2x00dev, 6, 0x02);
1913 rt2800_rfcsr_write(rt2x00dev, 8, 0x39); 1922 rt2800_rfcsr_write(rt2x00dev, 7, 0x50);
1914 rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); 1923 rt2800_rfcsr_write(rt2x00dev, 8, 0x39);
1915 rt2800_rfcsr_write(rt2x00dev, 10, 0x60); 1924 rt2800_rfcsr_write(rt2x00dev, 9, 0x0f);
1916 rt2800_rfcsr_write(rt2x00dev, 11, 0x21); 1925 rt2800_rfcsr_write(rt2x00dev, 10, 0x60);
1917 rt2800_rfcsr_write(rt2x00dev, 12, 0x75); 1926 rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
1918 rt2800_rfcsr_write(rt2x00dev, 13, 0x75); 1927 rt2800_rfcsr_write(rt2x00dev, 12, 0x75);
1919 rt2800_rfcsr_write(rt2x00dev, 14, 0x90); 1928 rt2800_rfcsr_write(rt2x00dev, 13, 0x75);
1920 rt2800_rfcsr_write(rt2x00dev, 15, 0x58); 1929 rt2800_rfcsr_write(rt2x00dev, 14, 0x90);
1921 rt2800_rfcsr_write(rt2x00dev, 16, 0xb3); 1930 rt2800_rfcsr_write(rt2x00dev, 15, 0x58);
1922 rt2800_rfcsr_write(rt2x00dev, 17, 0x92); 1931 rt2800_rfcsr_write(rt2x00dev, 16, 0xb3);
1923 rt2800_rfcsr_write(rt2x00dev, 18, 0x2c); 1932 rt2800_rfcsr_write(rt2x00dev, 17, 0x92);
1924 rt2800_rfcsr_write(rt2x00dev, 19, 0x02); 1933 rt2800_rfcsr_write(rt2x00dev, 18, 0x2c);
1925 rt2800_rfcsr_write(rt2x00dev, 20, 0xba); 1934 rt2800_rfcsr_write(rt2x00dev, 19, 0x02);
1926 rt2800_rfcsr_write(rt2x00dev, 21, 0xdb); 1935 rt2800_rfcsr_write(rt2x00dev, 20, 0xba);
1927 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); 1936 rt2800_rfcsr_write(rt2x00dev, 21, 0xdb);
1928 rt2800_rfcsr_write(rt2x00dev, 23, 0x31); 1937 rt2800_rfcsr_write(rt2x00dev, 22, 0x00);
1929 rt2800_rfcsr_write(rt2x00dev, 24, 0x08); 1938 rt2800_rfcsr_write(rt2x00dev, 23, 0x31);
1930 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); 1939 rt2800_rfcsr_write(rt2x00dev, 24, 0x08);
1931 rt2800_rfcsr_write(rt2x00dev, 26, 0x25); 1940 rt2800_rfcsr_write(rt2x00dev, 25, 0x01);
1932 rt2800_rfcsr_write(rt2x00dev, 27, 0x23); 1941 rt2800_rfcsr_write(rt2x00dev, 26, 0x25);
1933 rt2800_rfcsr_write(rt2x00dev, 28, 0x13); 1942 rt2800_rfcsr_write(rt2x00dev, 27, 0x23);
1934 rt2800_rfcsr_write(rt2x00dev, 29, 0x83); 1943 rt2800_rfcsr_write(rt2x00dev, 28, 0x13);
1944 rt2800_rfcsr_write(rt2x00dev, 29, 0x83);
1945 }
1935 1946
1936 /* 1947 /*
1937 * Set RX Filter calibration for 20MHz and 40MHz 1948 * Set RX Filter calibration for 20MHz and 40MHz
@@ -3005,6 +3016,8 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
3005{ 3016{
3006 int retval; 3017 int retval;
3007 3018
3019 rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
3020
3008 rt2x00dev->priv = (void *)&rt2800pci_rt2800_ops; 3021 rt2x00dev->priv = (void *)&rt2800pci_rt2800_ops;
3009 3022
3010 /* 3023 /*