projects
/
carl9170fw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kconfig: refactor end token rules
[carl9170fw.git]
/
carlfw
/
src
/
rf.c
diff --git
a/carlfw/src/rf.c
b/carlfw/src/rf.c
index 7bcff275fc22232029322b294273ee74781eab94..5e8d3d86483159fd7809229ca5a7760bc7718d64 100644
(file)
--- a/
carlfw/src/rf.c
+++ b/
carlfw/src/rf.c
@@
-6,7
+6,7
@@
* Copyright (c) 2000-2005 ZyDAS Technology Corporation
* Copyright (c) 2007-2009 Atheros Communications, Inc.
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
* Copyright (c) 2000-2005 ZyDAS Technology Corporation
* Copyright (c) 2007-2009 Atheros Communications, Inc.
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
- * Copyright 2009
, 2010
Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright 2009
-2011
Christian Lamparter <chunkeey@googlemail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-19,8
+19,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#include "carl9170.h"
*/
#include "carl9170.h"
@@
-30,15
+29,6
@@
#include "shared/phy.h"
#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
#include "shared/phy.h"
#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
-static void set_channel_start(void)
-{
- /* Manipulate CCA threshold to stop transmission */
- set(AR9170_PHY_REG_CCA_THRESHOLD, 0x300);
- /* Enable Virtual CCA */
- orl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
- AR9170_MAC_VIRTUAL_CCA_ALL);
-}
-
static void set_channel_end(void)
{
/* Manipulate CCA threshold to resume transmission */
static void set_channel_end(void)
{
/* Manipulate CCA threshold to resume transmission */
@@
-46,11
+36,23
@@
static void set_channel_end(void)
/* Disable Virtual CCA */
andl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
~AR9170_MAC_VIRTUAL_CCA_ALL);
/* Disable Virtual CCA */
andl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
~AR9170_MAC_VIRTUAL_CCA_ALL);
+
+ fw.phy.state = CARL9170_PHY_ON;
}
void rf_notify_set_channel(void)
{
}
void rf_notify_set_channel(void)
{
- set_channel_start();
+ /* Manipulate CCA threshold to stop transmission */
+ set(AR9170_PHY_REG_CCA_THRESHOLD, 0x300);
+ /* Enable Virtual CCA */
+ orl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
+ AR9170_MAC_VIRTUAL_CCA_ALL);
+
+ /* reset CCA stats */
+ fw.tally.active = 0;
+ fw.tally.cca = 0;
+ fw.tally.tx_time = 0;
+ fw.phy.state = CARL9170_PHY_OFF;
}
/*
}
/*
@@
-181,10
+183,6
@@
static uint32_t rf_init(const uint32_t delta_slope_coeff_exp,
set(AR9170_PHY_REG_ANALOG_SWAP, AR9170_PHY_ANALOG_SWAP_AB |
AR9170_PHY_ANALOG_SWAP_ALT_CHAIN);
set(AR9170_PHY_REG_ANALOG_SWAP, AR9170_PHY_ANALOG_SWAP_AB |
AR9170_PHY_ANALOG_SWAP_ALT_CHAIN);
- /* configure mask */
- set(AR9170_PHY_REG_RX_CHAINMASK, 0x5); /* chain 0 + chain 2 */
- set(AR9170_PHY_REG_CAL_CHAINMASK, 0x5); /* chain 0 + chain 2 */
-
/* Activate BB */
set(AR9170_PHY_REG_ACTIVE, AR9170_PHY_ACTIVE_EN);
delay(10);
/* Activate BB */
set(AR9170_PHY_REG_ACTIVE, AR9170_PHY_ACTIVE_EN);
delay(10);
@@
-203,10
+201,17
@@
void rf_cmd(const struct carl9170_cmd *cmd, struct carl9170_rsp *resp)
fw.phy.ht_settings = cmd->rf_init.ht_settings;
fw.phy.frequency = cmd->rf_init.freq;
fw.phy.ht_settings = cmd->rf_init.ht_settings;
fw.phy.frequency = cmd->rf_init.freq;
+ /*
+ * Is the clock controlled by the PHY?
+ */
+#ifdef CONFIG_CARL9170FW_80MHZ_CLOCK
if ((fw.phy.ht_settings & EIGHTY_FLAG) == EIGHTY_FLAG)
if ((fw.phy.ht_settings & EIGHTY_FLAG) == EIGHTY_FLAG)
- clock_set(
true, AHB_80_88MHZ
);
+ clock_set(
AHB_80_88MHZ, true
);
else
else
- clock_set(true, AHB_40_44MHZ);
+ clock_set(AHB_40_44MHZ, true);
+#else
+ clock_set(AHB_40_44MHZ, true);
+#endif
ret = rf_init(le32_to_cpu(cmd->rf_init.delta_slope_coeff_exp),
le32_to_cpu(cmd->rf_init.delta_slope_coeff_man),
ret = rf_init(le32_to_cpu(cmd->rf_init.delta_slope_coeff_exp),
le32_to_cpu(cmd->rf_init.delta_slope_coeff_man),
@@
-219,15
+224,10
@@
void rf_cmd(const struct carl9170_cmd *cmd, struct carl9170_rsp *resp)
resp->rf_init_res.ret = cpu_to_le32(ret);
}
resp->rf_init_res.ret = cpu_to_le32(ret);
}
-#ifdef CONFIG_CARL9170FW_PSM
void rf_psm(void)
{
u32 bank3;
void rf_psm(void)
{
u32 bank3;
- /*
- * FIXME: Does not work on 5GHz band!
- */
-
if (fw.phy.psm.state == CARL9170_PSM_SOFTWARE) {
/* not enabled by the driver */
return;
if (fw.phy.psm.state == CARL9170_PSM_SOFTWARE) {
/* not enabled by the driver */
return;
@@
-248,7
+248,7
@@
void rf_psm(void)
/* Synthesizer off + RX off */
bank3 = 0x00400018;
/* Synthesizer off + RX off */
bank3 = 0x00400018;
-
clock_set(true, AHB_20_22MHZ)
;
+
fw.phy.state = CARL9170_PHY_OFF
;
} else {
/* advance to the next PSM step */
fw.phy.psm.state--;
} else {
/* advance to the next PSM step */
fw.phy.psm.state--;
@@
-265,20
+265,16
@@
void rf_psm(void)
/* Synthesizer on + RX on */
bank3 = 0x01420098;
/* Synthesizer on + RX on */
bank3 = 0x01420098;
- if ((fw.phy.ht_settings & EIGHTY_FLAG) == EIGHTY_FLAG)
- clock_set(true, AHB_80_88MHZ);
- else
- clock_set(true, AHB_40_44MHZ);
+ fw.phy.state = CARL9170_PHY_ON;
} else {
return ;
}
}
} else {
return ;
}
}
- if (fw.phy.frequency < 3000000
0
)
+ if (fw.phy.frequency < 3000000)
bank3 |= 0x00800000;
set(0x1c58f0, bank3);
}
bank3 |= 0x00800000;
set(0x1c58f0, bank3);
}
-#endif /* CONFIG_CARL9170FW_PSM */
#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */