23 #include <linux/pci.h>
30 static const u32 sa2400_chan[] = {
53 phy_config = 0xb0000000;
55 phy_config |= ((
u32)(addr & 0xf)) << 24;
56 phy_config |= data & 0xffffff;
58 rtl818x_iowrite32(priv,
79 static u8 sa2400_rf_rssi_map[] = {
80 0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
81 0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
82 0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
83 0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
84 0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
85 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
86 0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
87 0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
88 0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
89 0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02,
92 static u8 sa2400_rf_calc_rssi(
u8 agc,
u8 sq)
101 return 65 * sa2400_rf_rssi_map[sq] / 100;
104 static void sa2400_rf_set_channel(
struct ieee80211_hw *dev,
109 u32 txpw = priv->
channels[channel - 1].hw_value & 0xFF;
110 u32 chan = sa2400_chan[channel - 1];
112 write_sa2400(dev, 7, txpw);
114 sa2400_write_phy_antenna(dev, channel);
116 write_sa2400(dev, 0, chan);
117 write_sa2400(dev, 1, 0xbb50);
118 write_sa2400(dev, 2, 0x80);
119 write_sa2400(dev, 3, 0);
124 write_sa2400(dev, 4, 0);
150 write_sa2400(dev, 0, sa2400_chan[0]);
151 write_sa2400(dev, 1, 0xbb50);
152 write_sa2400(dev, 2, 0x80);
153 write_sa2400(dev, 3, 0);
154 write_sa2400(dev, 4, 0x19340 | firdac);
156 write_sa2400(dev, 4, 0x19348 | firdac);
159 write_sa2400(dev, 4, 0x1938c);
161 write_sa2400(dev, 4, 0x19340 | firdac);
163 write_sa2400(dev, 0, sa2400_chan[0]);
164 write_sa2400(dev, 1, 0xbb50);
165 write_sa2400(dev, 2, 0x80);
166 write_sa2400(dev, 3, 0);
167 write_sa2400(dev, 4, 0x19344 | firdac);
170 write_sa2400(dev, 6, 0x13ff | (1 << 23));
171 write_sa2400(dev, 8, 0);
177 txconf = rtl818x_ioread32(priv, &priv->
map->TX_CONF);
178 rtl818x_iowrite32(priv, &priv->
map->TX_CONF,
181 write_sa2400(dev, 4, 0x19341);
185 write_sa2400(dev, 4, 0x19345);
190 rtl818x_iowrite32(priv, &priv->
map->TX_CONF, txconf);
196 write_sa2400(dev, 4, 0x19341 | firdac);
206 sa2400_write_phy_antenna(dev, 1);
210 if (rtl818x_ioread8(priv, &priv->
map->CONFIG2) &
224 .init = sa2400_rf_init,
225 .stop = sa2400_rf_stop,
226 .set_chan = sa2400_rf_set_channel,
227 .calc_rssi = sa2400_rf_calc_rssi,