aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-09-03 06:12:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-08 14:00:16 -0400
commitcb24f57fe6f94a445fad8fab6ebdde7c51857895 (patch)
tree33e61e709af26c641632ebc4da74c3a5ad457562 /drivers/net/wireless/b43
parent2b80848e3818fb1c8ccddc105b065a86c68afa9d (diff)
b43: Move Analog switching into phy code
This moves the Analog switching code into the PHY files. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/main.c23
-rw-r--r--drivers/net/wireless/b43/phy_a.c1
-rw-r--r--drivers/net/wireless/b43/phy_common.c5
-rw-r--r--drivers/net/wireless/b43/phy_common.h12
-rw-r--r--drivers/net/wireless/b43/phy_g.c1
-rw-r--r--drivers/net/wireless/b43/phy_lp.c1
-rw-r--r--drivers/net/wireless/b43/phy_n.c7
7 files changed, 30 insertions, 20 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 156e8f3151d5..ab9fa8126b7b 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1052,23 +1052,6 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
1052 } 1052 }
1053} 1053}
1054 1054
1055/* Turn the Analog ON/OFF */
1056static void b43_switch_analog(struct b43_wldev *dev, int on)
1057{
1058 switch (dev->phy.type) {
1059 case B43_PHYTYPE_A:
1060 case B43_PHYTYPE_G:
1061 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
1062 break;
1063 case B43_PHYTYPE_N:
1064 b43_phy_write(dev, B43_NPHY_AFECTL_OVER,
1065 on ? 0 : 0x7FFF);
1066 break;
1067 default:
1068 B43_WARN_ON(1);
1069 }
1070}
1071
1072void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1055void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
1073{ 1056{
1074 u32 tmslow; 1057 u32 tmslow;
@@ -1096,7 +1079,7 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
1096 * PHY-type, yet. wireless_core_reset will be called once again later, 1079 * PHY-type, yet. wireless_core_reset will be called once again later,
1097 * when we know the PHY-type. */ 1080 * when we know the PHY-type. */
1098 if (dev->phy.ops) 1081 if (dev->phy.ops)
1099 b43_switch_analog(dev, 1); 1082 dev->phy.ops->switch_analog(dev, 1);
1100 1083
1101 macctl = b43_read32(dev, B43_MMIO_MACCTL); 1084 macctl = b43_read32(dev, B43_MMIO_MACCTL);
1102 macctl &= ~B43_MACCTL_GMODE; 1085 macctl &= ~B43_MACCTL_GMODE;
@@ -3952,7 +3935,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3952 b43_dma_free(dev); 3935 b43_dma_free(dev);
3953 b43_pio_free(dev); 3936 b43_pio_free(dev);
3954 b43_chip_exit(dev); 3937 b43_chip_exit(dev);
3955 b43_switch_analog(dev, 0); 3938 dev->phy.ops->switch_analog(dev, 0);
3956 if (dev->wl->current_beacon) { 3939 if (dev->wl->current_beacon) {
3957 dev_kfree_skb_any(dev->wl->current_beacon); 3940 dev_kfree_skb_any(dev->wl->current_beacon);
3958 dev->wl->current_beacon = NULL; 3941 dev->wl->current_beacon = NULL;
@@ -4437,7 +4420,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4437 wl->current_dev = dev; 4420 wl->current_dev = dev;
4438 INIT_WORK(&dev->restart_work, b43_chip_reset); 4421 INIT_WORK(&dev->restart_work, b43_chip_reset);
4439 4422
4440 b43_switch_analog(dev, 0); 4423 dev->phy.ops->switch_analog(dev, 0);
4441 ssb_device_disable(dev->dev, 0); 4424 ssb_device_disable(dev->dev, 0);
4442 ssb_bus_may_powerdown(bus); 4425 ssb_bus_may_powerdown(bus);
4443 4426
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index c9f00ace46ad..0f1a84c9de61 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -632,6 +632,7 @@ const struct b43_phy_operations b43_phyops_a = {
632 .radio_write = b43_aphy_op_radio_write, 632 .radio_write = b43_aphy_op_radio_write,
633 .supports_hwpctl = b43_aphy_op_supports_hwpctl, 633 .supports_hwpctl = b43_aphy_op_supports_hwpctl,
634 .software_rfkill = b43_aphy_op_software_rfkill, 634 .software_rfkill = b43_aphy_op_software_rfkill,
635 .switch_analog = b43_phyop_switch_analog_generic,
635 .switch_channel = b43_aphy_op_switch_channel, 636 .switch_channel = b43_aphy_op_switch_channel,
636 .get_default_chan = b43_aphy_op_get_default_chan, 637 .get_default_chan = b43_aphy_op_get_default_chan,
637 .set_rx_antenna = b43_aphy_op_set_rx_antenna, 638 .set_rx_antenna = b43_aphy_op_set_rx_antenna,
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index e12fca69a970..4d4345d76abf 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -374,3 +374,8 @@ int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset)
374 374
375 return average; 375 return average;
376} 376}
377
378void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on)
379{
380 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
381}
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index 4a1795f5fc21..c9f5430d1d7d 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -108,6 +108,8 @@ enum b43_txpwr_result {
108 * RFKILL_STATE_SOFT_BLOCKED or 108 * RFKILL_STATE_SOFT_BLOCKED or
109 * RFKILL_STATE_UNBLOCKED 109 * RFKILL_STATE_UNBLOCKED
110 * Must not be NULL. 110 * Must not be NULL.
111 * @switch_analog: Turn the Analog on/off.
112 * Must not be NULL.
111 * @switch_channel: Switch the radio to another channel. 113 * @switch_channel: Switch the radio to another channel.
112 * Must not be NULL. 114 * Must not be NULL.
113 * @get_default_chan: Just returns the default channel number. 115 * @get_default_chan: Just returns the default channel number.
@@ -158,6 +160,7 @@ struct b43_phy_operations {
158 /* Radio */ 160 /* Radio */
159 bool (*supports_hwpctl)(struct b43_wldev *dev); 161 bool (*supports_hwpctl)(struct b43_wldev *dev);
160 void (*software_rfkill)(struct b43_wldev *dev, enum rfkill_state state); 162 void (*software_rfkill)(struct b43_wldev *dev, enum rfkill_state state);
163 void (*switch_analog)(struct b43_wldev *dev, bool on);
161 int (*switch_channel)(struct b43_wldev *dev, unsigned int new_channel); 164 int (*switch_channel)(struct b43_wldev *dev, unsigned int new_channel);
162 unsigned int (*get_default_chan)(struct b43_wldev *dev); 165 unsigned int (*get_default_chan)(struct b43_wldev *dev);
163 void (*set_rx_antenna)(struct b43_wldev *dev, int antenna); 166 void (*set_rx_antenna)(struct b43_wldev *dev, int antenna);
@@ -397,5 +400,14 @@ void b43_phy_txpower_adjust_work(struct work_struct *work);
397 */ 400 */
398int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset); 401int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset);
399 402
403/**
404 * b43_phy_switch_analog_generic - Generic PHY operation for switching the Analog.
405 *
406 * It does the switching based on the PHY0 core register.
407 * Do _not_ call this directly. Only use it as a switch_analog callback
408 * for struct b43_phy_operations.
409 */
410void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on);
411
400 412
401#endif /* LINUX_B43_PHY_COMMON_H_ */ 413#endif /* LINUX_B43_PHY_COMMON_H_ */
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index b44740b24e71..e8c012c9abb0 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -3271,6 +3271,7 @@ const struct b43_phy_operations b43_phyops_g = {
3271 .radio_write = b43_gphy_op_radio_write, 3271 .radio_write = b43_gphy_op_radio_write,
3272 .supports_hwpctl = b43_gphy_op_supports_hwpctl, 3272 .supports_hwpctl = b43_gphy_op_supports_hwpctl,
3273 .software_rfkill = b43_gphy_op_software_rfkill, 3273 .software_rfkill = b43_gphy_op_software_rfkill,
3274 .switch_analog = b43_phyop_switch_analog_generic,
3274 .switch_channel = b43_gphy_op_switch_channel, 3275 .switch_channel = b43_gphy_op_switch_channel,
3275 .get_default_chan = b43_gphy_op_get_default_chan, 3276 .get_default_chan = b43_gphy_op_get_default_chan,
3276 .set_rx_antenna = b43_gphy_op_set_rx_antenna, 3277 .set_rx_antenna = b43_gphy_op_set_rx_antenna,
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 41994f1f0f0e..c5d9dc3667c0 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -146,6 +146,7 @@ const struct b43_phy_operations b43_phyops_lp = {
146 .radio_read = b43_lpphy_op_radio_read, 146 .radio_read = b43_lpphy_op_radio_read,
147 .radio_write = b43_lpphy_op_radio_write, 147 .radio_write = b43_lpphy_op_radio_write,
148 .software_rfkill = b43_lpphy_op_software_rfkill, 148 .software_rfkill = b43_lpphy_op_software_rfkill,
149 .switch_analog = b43_phyop_switch_analog_generic,
149 .switch_channel = b43_lpphy_op_switch_channel, 150 .switch_channel = b43_lpphy_op_switch_channel,
150 .get_default_chan = b43_lpphy_op_get_default_chan, 151 .get_default_chan = b43_lpphy_op_get_default_chan,
151 .set_rx_antenna = b43_lpphy_op_set_rx_antenna, 152 .set_rx_antenna = b43_lpphy_op_set_rx_antenna,
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 617724dc6aa8..8bcfda5f3f07 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -583,6 +583,12 @@ static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
583{//TODO 583{//TODO
584} 584}
585 585
586static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
587{
588 b43_phy_write(dev, B43_NPHY_AFECTL_OVER,
589 on ? 0 : 0x7FFF);
590}
591
586static int b43_nphy_op_switch_channel(struct b43_wldev *dev, 592static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
587 unsigned int new_channel) 593 unsigned int new_channel)
588{ 594{
@@ -614,6 +620,7 @@ const struct b43_phy_operations b43_phyops_n = {
614 .radio_read = b43_nphy_op_radio_read, 620 .radio_read = b43_nphy_op_radio_read,
615 .radio_write = b43_nphy_op_radio_write, 621 .radio_write = b43_nphy_op_radio_write,
616 .software_rfkill = b43_nphy_op_software_rfkill, 622 .software_rfkill = b43_nphy_op_software_rfkill,
623 .switch_analog = b43_nphy_op_switch_analog,
617 .switch_channel = b43_nphy_op_switch_channel, 624 .switch_channel = b43_nphy_op_switch_channel,
618 .get_default_chan = b43_nphy_op_get_default_chan, 625 .get_default_chan = b43_nphy_op_get_default_chan,
619 .recalc_txpower = b43_nphy_op_recalc_txpower, 626 .recalc_txpower = b43_nphy_op_recalc_txpower,