aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-04-11 11:55:45 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-11 11:55:45 -0400
commitcec34dda71bd8bb1df61579d6a1440723baec9f7 (patch)
treeb2c684c8ccd8aec71470cbf423e686693e8bbffd /drivers/net
parent4b2281c7aa6a6e2615b35f8cebd93656dc6d714c (diff)
parentec759a2b383b50950be37fbe470c4cc2ca18e2ce (diff)
Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream-fixes
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c20
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c57
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c12
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c6
5 files changed, 63 insertions, 36 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 80cb88eb98c6..a38e7eec0e62 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -946,6 +946,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
946 u8 channel; 946 u8 channel;
947 struct bcm43xx_phyinfo *phy; 947 struct bcm43xx_phyinfo *phy;
948 const char *iso_country; 948 const char *iso_country;
949 u8 max_bg_channel;
949 950
950 geo = kzalloc(sizeof(*geo), GFP_KERNEL); 951 geo = kzalloc(sizeof(*geo), GFP_KERNEL);
951 if (!geo) 952 if (!geo)
@@ -967,6 +968,23 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
967 } 968 }
968 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 969 iso_country = bcm43xx_locale_iso(bcm->sprom.locale);
969 970
971/* set the maximum channel based on locale set in sprom or witle locale option */
972 switch (bcm->sprom.locale) {
973 case BCM43xx_LOCALE_THAILAND:
974 case BCM43xx_LOCALE_ISRAEL:
975 case BCM43xx_LOCALE_JORDAN:
976 case BCM43xx_LOCALE_USA_CANADA_ANZ:
977 case BCM43xx_LOCALE_USA_LOW:
978 max_bg_channel = 11;
979 break;
980 case BCM43xx_LOCALE_JAPAN:
981 case BCM43xx_LOCALE_JAPAN_HIGH:
982 max_bg_channel = 14;
983 break;
984 default:
985 max_bg_channel = 13;
986 }
987
970 if (have_a) { 988 if (have_a) {
971 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 989 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL;
972 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { 990 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) {
@@ -978,7 +996,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
978 } 996 }
979 if (have_bg) { 997 if (have_bg) {
980 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 998 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL;
981 channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { 999 channel <= max_bg_channel; channel++) {
982 chan = &geo->bg[i++]; 1000 chan = &geo->bg[i++];
983 chan->freq = bcm43xx_channel_to_freq_bg(channel); 1001 chan->freq = bcm43xx_channel_to_freq_bg(channel);
984 chan->channel = channel; 1002 chan->channel = channel;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index d1e89be965cd..72529a440f15 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
978{ 978{
979 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 979 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
980 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 980 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
981 u16 backup_phy[15]; 981 u16 backup_phy[15] = {0};
982 u16 backup_radio[3]; 982 u16 backup_radio[3];
983 u16 backup_bband; 983 u16 backup_bband;
984 u16 i; 984 u16 i;
@@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
989 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); 989 backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001);
990 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); 990 backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811);
991 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); 991 backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812);
992 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); 992 if (phy->rev != 1) {
993 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); 993 backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814);
994 backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815);
995 }
994 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); 996 backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A);
995 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); 997 backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059);
996 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); 998 backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058);
@@ -1018,14 +1020,16 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1018 bcm43xx_phy_read(bcm, 0x0811) | 0x0001); 1020 bcm43xx_phy_read(bcm, 0x0811) | 0x0001);
1019 bcm43xx_phy_write(bcm, 0x0812, 1021 bcm43xx_phy_write(bcm, 0x0812,
1020 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); 1022 bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE);
1021 bcm43xx_phy_write(bcm, 0x0814, 1023 if (phy->rev != 1) {
1022 bcm43xx_phy_read(bcm, 0x0814) | 0x0001); 1024 bcm43xx_phy_write(bcm, 0x0814,
1023 bcm43xx_phy_write(bcm, 0x0815, 1025 bcm43xx_phy_read(bcm, 0x0814) | 0x0001);
1024 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); 1026 bcm43xx_phy_write(bcm, 0x0815,
1025 bcm43xx_phy_write(bcm, 0x0814, 1027 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE);
1026 bcm43xx_phy_read(bcm, 0x0814) | 0x0002); 1028 bcm43xx_phy_write(bcm, 0x0814,
1027 bcm43xx_phy_write(bcm, 0x0815, 1029 bcm43xx_phy_read(bcm, 0x0814) | 0x0002);
1028 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); 1030 bcm43xx_phy_write(bcm, 0x0815,
1031 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD);
1032 }
1029 bcm43xx_phy_write(bcm, 0x0811, 1033 bcm43xx_phy_write(bcm, 0x0811,
1030 bcm43xx_phy_read(bcm, 0x0811) | 0x000C); 1034 bcm43xx_phy_read(bcm, 0x0811) | 0x000C);
1031 bcm43xx_phy_write(bcm, 0x0812, 1035 bcm43xx_phy_write(bcm, 0x0812,
@@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1048 bcm43xx_phy_read(bcm, 0x000A) 1052 bcm43xx_phy_read(bcm, 0x000A)
1049 | 0x2000); 1053 | 0x2000);
1050 } 1054 }
1051 bcm43xx_phy_write(bcm, 0x0814, 1055 if (phy->rev != 1) {
1052 bcm43xx_phy_read(bcm, 0x0814) | 0x0004); 1056 bcm43xx_phy_write(bcm, 0x0814,
1053 bcm43xx_phy_write(bcm, 0x0815, 1057 bcm43xx_phy_read(bcm, 0x0814) | 0x0004);
1054 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); 1058 bcm43xx_phy_write(bcm, 0x0815,
1059 bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB);
1060 }
1055 bcm43xx_phy_write(bcm, 0x0003, 1061 bcm43xx_phy_write(bcm, 0x0003,
1056 (bcm43xx_phy_read(bcm, 0x0003) 1062 (bcm43xx_phy_read(bcm, 0x0003)
1057 & 0xFF9F) | 0x0040); 1063 & 0xFF9F) | 0x0040);
@@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1138 } 1144 }
1139 } 1145 }
1140 1146
1141 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); 1147 if (phy->rev != 1) {
1142 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); 1148 bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]);
1149 bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]);
1150 }
1143 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); 1151 bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]);
1144 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); 1152 bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]);
1145 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); 1153 bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]);
@@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1188 bcm43xx_phy_write(bcm, 0x0811, 0x0000); 1196 bcm43xx_phy_write(bcm, 0x0811, 0x0000);
1189 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1197 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1190 } 1198 }
1191 if (phy->rev >= 3) { 1199 if (phy->rev > 5) {
1192 bcm43xx_phy_write(bcm, 0x0811, 0x0400); 1200 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1193 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1201 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1194 } 1202 }
1195 if (phy->rev >= 2 && phy->connected) { 1203 if (phy->rev >= 2 && phy->connected) {
1196 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; 1204 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
1197 if (tmp < 6) { 1205 if (tmp ==3 || tmp == 5) {
1198 bcm43xx_phy_write(bcm, 0x04C2, 0x1816); 1206 bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
1199 bcm43xx_phy_write(bcm, 0x04C3, 0x8006); 1207 bcm43xx_phy_write(bcm, 0x04C3, 0x8006);
1200 if (tmp != 3) { 1208 if (tmp == 5) {
1201 bcm43xx_phy_write(bcm, 0x04CC, 1209 bcm43xx_phy_write(bcm, 0x04CC,
1202 (bcm43xx_phy_read(bcm, 0x04CC) 1210 (bcm43xx_phy_read(bcm, 0x04CC)
1203 & 0x00FF) | 0x1F00); 1211 & 0x00FF) | 0x1F00);
1204 } 1212 }
1205 } 1213 }
1206 }
1207 if (phy->rev < 3 && phy->connected)
1208 bcm43xx_phy_write(bcm, 0x047E, 0x0078); 1214 bcm43xx_phy_write(bcm, 0x047E, 0x0078);
1215 }
1209 if (radio->revision == 8) { 1216 if (radio->revision == 8) {
1210 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); 1217 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080);
1211 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); 1218 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004);
@@ -1232,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1232 if (phy->rev >= 6) { 1239 if (phy->rev >= 6) {
1233 bcm43xx_phy_write(bcm, 0x0036, 1240 bcm43xx_phy_write(bcm, 0x0036,
1234 (bcm43xx_phy_read(bcm, 0x0036) 1241 (bcm43xx_phy_read(bcm, 0x0036)
1235 & 0xF000) | (radio->txctl2 << 12)); 1242 & 0x0FFF) | (radio->txctl2 << 12));
1236 } 1243 }
1237 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) 1244 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
1238 bcm43xx_phy_write(bcm, 0x002E, 0x8075); 1245 bcm43xx_phy_write(bcm, 0x002E, 0x8075);
@@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1243 else 1250 else
1244 bcm43xx_phy_write(bcm, 0x002F, 0x0202); 1251 bcm43xx_phy_write(bcm, 0x002F, 0x0202);
1245 } 1252 }
1246 if (phy->connected) { 1253 if (phy->connected || phy->rev >= 2) {
1247 bcm43xx_phy_lo_adjust(bcm, 0); 1254 bcm43xx_phy_lo_adjust(bcm, 0);
1248 bcm43xx_phy_write(bcm, 0x080F, 0x8078); 1255 bcm43xx_phy_write(bcm, 0x080F, 0x8078);
1249 } 1256 }
@@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1257 */ 1264 */
1258 bcm43xx_nrssi_hw_update(bcm, 0xFFFF); 1265 bcm43xx_nrssi_hw_update(bcm, 0xFFFF);
1259 bcm43xx_calc_nrssi_threshold(bcm); 1266 bcm43xx_calc_nrssi_threshold(bcm);
1260 } else if (phy->connected) { 1267 } else if (phy->connected || phy->rev >= 2) {
1261 if (radio->nrssi[0] == -1000) { 1268 if (radio->nrssi[0] == -1000) {
1262 assert(radio->nrssi[1] == -1000); 1269 assert(radio->nrssi[1] == -1000);
1263 bcm43xx_calc_nrssi_slope(bcm); 1270 bcm43xx_calc_nrssi_slope(bcm);
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 9c64f894b71b..87ee3ee020fe 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -337,6 +337,7 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type)
337 chip->patch_cr157 = (value >> 13) & 0x1; 337 chip->patch_cr157 = (value >> 13) & 0x1;
338 chip->patch_6m_band_edge = (value >> 21) & 0x1; 338 chip->patch_6m_band_edge = (value >> 21) & 0x1;
339 chip->new_phy_layout = (value >> 31) & 0x1; 339 chip->new_phy_layout = (value >> 31) & 0x1;
340 chip->al2230s_bit = (value >> 7) & 0x1;
340 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; 341 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2;
341 chip->supports_tx_led = 1; 342 chip->supports_tx_led = 1;
342 if (value & (1 << 24)) { /* LED scenario */ 343 if (value & (1 << 24)) { /* LED scenario */
@@ -591,16 +592,16 @@ int zd_chip_unlock_phy_regs(struct zd_chip *chip)
591 return r; 592 return r;
592} 593}
593 594
594/* CR157 can be optionally patched by the EEPROM */ 595/* CR157 can be optionally patched by the EEPROM for original ZD1211 */
595static int patch_cr157(struct zd_chip *chip) 596static int patch_cr157(struct zd_chip *chip)
596{ 597{
597 int r; 598 int r;
598 u32 value; 599 u16 value;
599 600
600 if (!chip->patch_cr157) 601 if (!chip->patch_cr157)
601 return 0; 602 return 0;
602 603
603 r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); 604 r = zd_ioread16_locked(chip, &value, E2P_PHY_REG);
604 if (r) 605 if (r)
605 return r; 606 return r;
606 607
@@ -790,11 +791,6 @@ static int zd1211b_hw_reset_phy(struct zd_chip *chip)
790 goto out; 791 goto out;
791 792
792 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 793 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
793 if (r)
794 goto unlock;
795
796 r = patch_cr157(chip);
797unlock:
798 t = zd_chip_unlock_phy_regs(chip); 794 t = zd_chip_unlock_phy_regs(chip);
799 if (t && !r) 795 if (t && !r)
800 r = t; 796 r = t;
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index b07569e391ee..e57ed75d9425 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -641,8 +641,8 @@ enum {
641 * also only 11 channels. */ 641 * also only 11 channels. */
642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) 642#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18)
643 643
644#define E2P_PHY_REG E2P_DATA(0x1a)
645#define E2P_DEVICE_VER E2P_DATA(0x20) 644#define E2P_DEVICE_VER E2P_DATA(0x20)
645#define E2P_PHY_REG E2P_DATA(0x25)
646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) 646#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28)
647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) 647#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a)
648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) 648#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c)
@@ -711,7 +711,7 @@ struct zd_chip {
711 u16 link_led; 711 u16 link_led;
712 unsigned int pa_type:4, 712 unsigned int pa_type:4,
713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, 713 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1,
714 new_phy_layout:1, 714 new_phy_layout:1, al2230s_bit:1,
715 is_zd1211b:1, supports_tx_led:1; 715 is_zd1211b:1, supports_tx_led:1;
716}; 716};
717 717
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index 25323a13a3db..5235a7827ac5 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -358,6 +358,12 @@ int zd_rf_init_al2230(struct zd_rf *rf)
358{ 358{
359 struct zd_chip *chip = zd_rf_to_chip(rf); 359 struct zd_chip *chip = zd_rf_to_chip(rf);
360 360
361 if (chip->al2230s_bit) {
362 dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
363 "supported by this driver.\n");
364 return -ENODEV;
365 }
366
361 rf->switch_radio_off = al2230_switch_radio_off; 367 rf->switch_radio_off = al2230_switch_radio_off;
362 if (chip->is_zd1211b) { 368 if (chip->is_zd1211b) {
363 rf->init_hw = zd1211b_al2230_init_hw; 369 rf->init_hw = zd1211b_al2230_init_hw;