aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-04-07 11:00:15 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:03 -0400
commit72018b223dcacb631f140d4c8fada3790bd1b03c (patch)
treefbe954ad79bd8496c8f549f1381749cb0d6bb1c5 /drivers/net
parentdc536a706951e23d3c81d0aa81414dc9f2c34ce5 (diff)
[PATCH] zd1211rw: rework band edge patching
This change allows RF drivers to provide their own 6M band edge patching implementation, while providing a generic implementation shared by most currently supported RF's. The upcoming ZD1211B/AL7230B code will use this to define its own patching function, which is different from the other RF configurations. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h1
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.c14
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.h9
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al7230b.c2
6 files changed, 33 insertions, 11 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index e2cfdda20a0f..95b4a2a26707 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -615,16 +615,24 @@ static int patch_cr157(struct zd_chip *chip)
615 * Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge 615 * Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge
616 * bit (for AL2230, AL2230S) 616 * bit (for AL2230, AL2230S)
617 */ 617 */
618static int patch_6m_band_edge(struct zd_chip *chip, int channel) 618static int patch_6m_band_edge(struct zd_chip *chip, u8 channel)
619{
620 ZD_ASSERT(mutex_is_locked(&chip->mutex));
621 if (!chip->patch_6m_band_edge)
622 return 0;
623
624 return zd_rf_patch_6m_band_edge(&chip->rf, channel);
625}
626
627/* Generic implementation of 6M band edge patching, used by most RFs via
628 * zd_rf_generic_patch_6m() */
629int zd_chip_generic_patch_6m_band(struct zd_chip *chip, int channel)
619{ 630{
620 struct zd_ioreq16 ioreqs[] = { 631 struct zd_ioreq16 ioreqs[] = {
621 { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 }, 632 { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 },
622 { CR47, 0x1e }, 633 { CR47, 0x1e },
623 }; 634 };
624 635
625 if (!chip->patch_6m_band_edge || !chip->rf.patch_6m_band_edge)
626 return 0;
627
628 /* FIXME: Channel 11 is not the edge for all regulatory domains. */ 636 /* FIXME: Channel 11 is not the edge for all regulatory domains. */
629 if (channel == 1 || channel == 11) 637 if (channel == 1 || channel == 11)
630 ioreqs[0].value = 0x12; 638 ioreqs[0].value = 0x12;
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index e57ed75d9425..ce0a5f6da0d2 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -833,6 +833,7 @@ int zd_chip_enable_rx(struct zd_chip *chip);
833void zd_chip_disable_rx(struct zd_chip *chip); 833void zd_chip_disable_rx(struct zd_chip *chip);
834int zd_chip_enable_hwint(struct zd_chip *chip); 834int zd_chip_enable_hwint(struct zd_chip *chip);
835int zd_chip_disable_hwint(struct zd_chip *chip); 835int zd_chip_disable_hwint(struct zd_chip *chip);
836int zd_chip_generic_patch_6m_band(struct zd_chip *chip, int channel);
836 837
837int zd_chip_set_rts_cts_rate_locked(struct zd_chip *chip, 838int zd_chip_set_rts_cts_rate_locked(struct zd_chip *chip,
838 u8 rts_rate, int preamble); 839 u8 rts_rate, int preamble);
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
index 4ddc2cb60d2b..549c23bcd6cc 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf.c
@@ -154,3 +154,17 @@ int zd_switch_radio_off(struct zd_rf *rf)
154 r = t; 154 r = t;
155 return r; 155 return r;
156} 156}
157
158int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel)
159{
160 if (!rf->patch_6m_band_edge)
161 return 0;
162
163 return rf->patch_6m_band_edge(rf, channel);
164}
165
166int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel)
167{
168 return zd_chip_generic_patch_6m_band(zd_rf_to_chip(rf), channel);
169}
170
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h
index ee8ac3a95b9e..aa9cc105ce60 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.h
+++ b/drivers/net/wireless/zd1211rw/zd_rf.h
@@ -47,17 +47,13 @@ struct zd_rf {
47 u8 type; 47 u8 type;
48 48
49 u8 channel; 49 u8 channel;
50 /*
51 * Whether this RF should patch the 6M band edge
52 * (assuming E2P_POD agrees)
53 */
54 u8 patch_6m_band_edge:1;
55 50
56 /* RF-specific functions */ 51 /* RF-specific functions */
57 int (*init_hw)(struct zd_rf *rf); 52 int (*init_hw)(struct zd_rf *rf);
58 int (*set_channel)(struct zd_rf *rf, u8 channel); 53 int (*set_channel)(struct zd_rf *rf, u8 channel);
59 int (*switch_radio_on)(struct zd_rf *rf); 54 int (*switch_radio_on)(struct zd_rf *rf);
60 int (*switch_radio_off)(struct zd_rf *rf); 55 int (*switch_radio_off)(struct zd_rf *rf);
56 int (*patch_6m_band_edge)(struct zd_rf *rf, u8 channel);
61}; 57};
62 58
63const char *zd_rf_name(u8 type); 59const char *zd_rf_name(u8 type);
@@ -72,6 +68,9 @@ int zd_rf_set_channel(struct zd_rf *rf, u8 channel);
72int zd_switch_radio_on(struct zd_rf *rf); 68int zd_switch_radio_on(struct zd_rf *rf);
73int zd_switch_radio_off(struct zd_rf *rf); 69int zd_switch_radio_off(struct zd_rf *rf);
74 70
71int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel);
72int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel);
73
75/* Functions for individual RF chips */ 74/* Functions for individual RF chips */
76 75
77int zd_rf_init_rf2959(struct zd_rf *rf); 76int zd_rf_init_rf2959(struct zd_rf *rf);
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index 85a9ad2cf75b..511392acfedf 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -431,6 +431,6 @@ int zd_rf_init_al2230(struct zd_rf *rf)
431 rf->set_channel = zd1211_al2230_set_channel; 431 rf->set_channel = zd1211_al2230_set_channel;
432 rf->switch_radio_on = zd1211_al2230_switch_radio_on; 432 rf->switch_radio_on = zd1211_al2230_switch_radio_on;
433 } 433 }
434 rf->patch_6m_band_edge = 1; 434 rf->patch_6m_band_edge = zd_rf_generic_patch_6m;
435 return 0; 435 return 0;
436} 436}
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
index bd07c9bce8c8..d2c3ee69df8a 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
@@ -269,6 +269,6 @@ int zd_rf_init_al7230b(struct zd_rf *rf)
269 rf->set_channel = al7230b_set_channel; 269 rf->set_channel = al7230b_set_channel;
270 rf->switch_radio_on = al7230b_switch_radio_on; 270 rf->switch_radio_on = al7230b_switch_radio_on;
271 rf->switch_radio_off = al7230b_switch_radio_off; 271 rf->switch_radio_off = al7230b_switch_radio_off;
272 rf->patch_6m_band_edge = 1; 272 rf->patch_6m_band_edge = zd_rf_generic_patch_6m;
273 return 0; 273 return 0;
274} 274}