x86: fix bootup crash in native_read_tsc()
[wrt350n-kernel.git] / drivers / net / wireless / bcm43xx / bcm43xx_radio.h
blob77a98a53a2e2f4e7c85a952135a0783cfd581205
1 /*
3 Broadcom BCM43xx wireless driver
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <st3@riseup.net>
7 Michael Buesch <mbuesch@freenet.de>
8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 Some parts of the code in this file are derived from the ipw2200
12 driver Copyright(c) 2003 - 2004 Intel Corporation.
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; see the file COPYING. If not, write to
26 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
27 Boston, MA 02110-1301, USA.
31 #ifndef BCM43xx_RADIO_H_
32 #define BCM43xx_RADIO_H_
34 #include "bcm43xx.h"
37 #define BCM43xx_RADIO_DEFAULT_CHANNEL_A 36
38 #define BCM43xx_RADIO_DEFAULT_CHANNEL_BG 6
40 /* Force antenna 0. */
41 #define BCM43xx_RADIO_TXANTENNA_0 0
42 /* Force antenna 1. */
43 #define BCM43xx_RADIO_TXANTENNA_1 1
44 /* Use the RX antenna, that was selected for the most recently
45 * received good PLCP header.
47 #define BCM43xx_RADIO_TXANTENNA_LASTPLCP 3
48 #define BCM43xx_RADIO_TXANTENNA_DEFAULT BCM43xx_RADIO_TXANTENNA_LASTPLCP
50 #define BCM43xx_RADIO_INTERFMODE_NONE 0
51 #define BCM43xx_RADIO_INTERFMODE_NONWLAN 1
52 #define BCM43xx_RADIO_INTERFMODE_MANUALWLAN 2
53 #define BCM43xx_RADIO_INTERFMODE_AUTOWLAN 3
56 void bcm43xx_radio_lock(struct bcm43xx_private *bcm);
57 void bcm43xx_radio_unlock(struct bcm43xx_private *bcm);
59 u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset);
60 void bcm43xx_radio_write16(struct bcm43xx_private *bcm, u16 offset, u16 val);
62 u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm);
63 void bcm43xx_radio_init2060(struct bcm43xx_private *bcm);
65 void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm);
66 void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm);
68 static inline
69 int bcm43xx_is_hw_radio_enabled(struct bcm43xx_private *bcm)
71 /* function to return state of hardware enable of radio
72 * returns 0 if radio disabled, 1 if radio enabled
74 if (bcm->current_core->rev >= 3)
75 return ((bcm43xx_read32(bcm, BCM43xx_MMIO_RADIO_HWENABLED_HI)
76 & BCM43xx_MMIO_RADIO_HWENABLED_HI_MASK)
77 == 0) ? 1 : 0;
78 else
79 return ((bcm43xx_read16(bcm, BCM43xx_MMIO_RADIO_HWENABLED_LO)
80 & BCM43xx_MMIO_RADIO_HWENABLED_LO_MASK)
81 == 0) ? 0 : 1;
84 int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm, u8 channel,
85 int synthetic_pu_workaround);
87 void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower);
88 void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm,
89 u16 baseband_attenuation, u16 attenuation,
90 u16 txpower);
92 u16 bcm43xx_default_baseband_attenuation(struct bcm43xx_private *bcm);
93 u16 bcm43xx_default_radio_attenuation(struct bcm43xx_private *bcm);
94 u16 bcm43xx_default_txctl1(struct bcm43xx_private *bcm);
96 void bcm43xx_radio_set_txantenna(struct bcm43xx_private *bcm, u32 val);
98 void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm);
100 u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel);
101 u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm);
103 int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm, int mode);
105 void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm);
106 void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm);
107 s16 bcm43xx_nrssi_hw_read(struct bcm43xx_private *bcm, u16 offset);
108 void bcm43xx_nrssi_hw_write(struct bcm43xx_private *bcm, u16 offset, s16 val);
109 void bcm43xx_nrssi_hw_update(struct bcm43xx_private *bcm, u16 val);
110 void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm);
112 void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm);
113 u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm);
115 #endif /* BCM43xx_RADIO_H_ */