8 #define PFX KBUILD_MODNAME ": "
10 static inline u32 agnx_read32(void __iomem *mem_region, u32 offset)
12 return ioread32(mem_region + offset);
15 static inline void agnx_write32(void __iomem *mem_region, u32 offset, u32 val)
17 iowrite32(val, mem_region + offset);
20 /* static const struct ieee80211_rate agnx_rates_80211b[] = { */
23 /* .flags = IEEE80211_RATE_CCK }, */
26 /* .hw_value = -0x14, */
27 /* .flags = IEEE80211_RATE_CCK_2 }, */
31 /* .flags = IEEE80211_RATE_CCK_2 }, */
35 /* .flags = IEEE80211_RATE_CCK_2 } */
39 static const struct ieee80211_rate agnx_rates_80211g[] = {
40 /* { .bitrate = 10, .hw_value = 1, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, */
41 /* { .bitrate = 20, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, */
42 /* { .bitrate = 55, .hw_value = 3, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, */
43 /* { .bitrate = 110, .hw_value = 4, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, */
44 { .bitrate = 10, .hw_value = 1, },
45 { .bitrate = 20, .hw_value = 2, },
46 { .bitrate = 55, .hw_value = 3, },
47 { .bitrate = 110, .hw_value = 4,},
49 { .bitrate = 60, .hw_value = 0xB, },
50 { .bitrate = 90, .hw_value = 0xF, },
51 { .bitrate = 120, .hw_value = 0xA },
52 { .bitrate = 180, .hw_value = 0xE, },
53 /* { .bitrate = 240, .hw_value = 0xd, }, */
54 { .bitrate = 360, .hw_value = 0xD, },
55 { .bitrate = 480, .hw_value = 0x8, },
56 { .bitrate = 540, .hw_value = 0xC, },
59 static const struct ieee80211_channel agnx_channels[] = {
60 { .center_freq = 2412, .hw_value = 1, },
61 { .center_freq = 2417, .hw_value = 2, },
62 { .center_freq = 2422, .hw_value = 3, },
63 { .center_freq = 2427, .hw_value = 4, },
64 { .center_freq = 2432, .hw_value = 5, },
65 { .center_freq = 2437, .hw_value = 6, },
66 { .center_freq = 2442, .hw_value = 7, },
67 { .center_freq = 2447, .hw_value = 8, },
68 { .center_freq = 2452, .hw_value = 9, },
69 { .center_freq = 2457, .hw_value = 10, },
70 { .center_freq = 2462, .hw_value = 11, },
71 { .center_freq = 2467, .hw_value = 12, },
72 { .center_freq = 2472, .hw_value = 13, },
73 { .center_freq = 2484, .hw_value = 14, },
76 #define NUM_DRIVE_MODES 2
77 /* Agnx operate mode */
81 AGNX_MODE_80211A_MIMO,
82 AGNX_MODE_80211B_SHORT,
83 AGNX_MODE_80211B_LONG,
86 AGNX_MODE_80211G_MIMO,
97 struct ieee80211_hw *hw;
101 unsigned int init_status;
103 void __iomem *ctl; /* pointer to base ram address */
104 void __iomem *data; /* pointer to mem region #2 */
107 struct agnx_ring txm;
108 struct agnx_ring txd;
113 struct delayed_work periodic_work; /* Periodic tasks like recalibrate */
114 struct ieee80211_low_level_stats stats;
116 /* unsigned int phymode; */
121 u8 mac_addr[ETH_ALEN];
124 struct ieee80211_supported_band band;
128 #define AGNX_CHAINS_MAX 6
129 #define AGNX_PERIODIC_DELAY 60000 /* unit: ms */
130 #define LOCAL_STAID 0 /* the station entry for the card itself */
131 #define BSSID_STAID 1 /* the station entry for the bsssid AP */
132 #define spi_delay() udelay(40)
133 #define eeprom_delay() udelay(40)
134 #define routing_table_delay() udelay(50)
136 /* PDU pool MEM region #2 */
137 #define AGNX_PDUPOOL 0x40000 /* PDU pool */
138 #define AGNX_PDUPOOL_SIZE 0x8000 /* PDU pool size*/
139 #define AGNX_PDU_TX_WQ 0x41000 /* PDU list TX workqueue */
140 #define AGNX_PDU_FREE 0x41800 /* Free Pool */
141 #define PDU_SIZE 0x80 /* Free Pool node size */
142 #define PDU_FREE_CNT 0xd0 /* Free pool node count */
146 extern void rf_chips_init(struct agnx_priv *priv);
147 extern void spi_rc_write(void __iomem *mem_region, u32 chip_ids, u32 sw);
148 extern void calibrate_oscillator(struct agnx_priv *priv);
149 extern void do_calibration(struct agnx_priv *priv);
150 extern void antenna_calibrate(struct agnx_priv *priv);
151 extern void __antenna_calibrate(struct agnx_priv *priv);
152 extern void print_offsets(struct agnx_priv *priv);
153 extern int agnx_set_channel(struct agnx_priv *priv, unsigned int channel);