diff options
author | John W. Linville <linville@tuxdriver.com> | 2006-05-05 16:56:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-05-05 16:56:24 -0400 |
commit | fd5226a72694d1c0abe1cc39711a86f1754e637d (patch) | |
tree | 1d90b27c392fb2ef9859f2652dee7640916ed806 /drivers/net/wireless | |
parent | aad61439e6a00bdb72cb649e11f6e166590c5f66 (diff) | |
parent | 178e0cc5ff249965c6cfbd78b1af6a5e614d837c (diff) |
Merge branch 'upstream-fixes' into upstream
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 45 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 7 |
4 files changed, 37 insertions, 23 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 198528660721..8d0f61816c19 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -939,9 +939,9 @@ static int bcm43xx_sprom_extract(struct bcm43xx_private *bcm) | |||
939 | return 0; | 939 | return 0; |
940 | } | 940 | } |
941 | 941 | ||
942 | static void bcm43xx_geo_init(struct bcm43xx_private *bcm) | 942 | static int bcm43xx_geo_init(struct bcm43xx_private *bcm) |
943 | { | 943 | { |
944 | struct ieee80211_geo geo; | 944 | struct ieee80211_geo *geo; |
945 | struct ieee80211_channel *chan; | 945 | struct ieee80211_channel *chan; |
946 | int have_a = 0, have_bg = 0; | 946 | int have_a = 0, have_bg = 0; |
947 | int i; | 947 | int i; |
@@ -949,7 +949,10 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
949 | struct bcm43xx_phyinfo *phy; | 949 | struct bcm43xx_phyinfo *phy; |
950 | const char *iso_country; | 950 | const char *iso_country; |
951 | 951 | ||
952 | memset(&geo, 0, sizeof(geo)); | 952 | geo = kzalloc(sizeof(*geo), GFP_KERNEL); |
953 | if (!geo) | ||
954 | return -ENOMEM; | ||
955 | |||
953 | for (i = 0; i < bcm->nr_80211_available; i++) { | 956 | for (i = 0; i < bcm->nr_80211_available; i++) { |
954 | phy = &(bcm->core_80211_ext[i].phy); | 957 | phy = &(bcm->core_80211_ext[i].phy); |
955 | switch (phy->type) { | 958 | switch (phy->type) { |
@@ -967,31 +970,36 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
967 | iso_country = bcm43xx_locale_iso(bcm->sprom.locale); | 970 | iso_country = bcm43xx_locale_iso(bcm->sprom.locale); |
968 | 971 | ||
969 | if (have_a) { | 972 | if (have_a) { |
970 | for (i = 0, channel = 0; channel < 201; channel++) { | 973 | for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; |
971 | chan = &geo.a[i++]; | 974 | channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { |
975 | chan = &geo->a[i++]; | ||
972 | chan->freq = bcm43xx_channel_to_freq_a(channel); | 976 | chan->freq = bcm43xx_channel_to_freq_a(channel); |
973 | chan->channel = channel; | 977 | chan->channel = channel; |
974 | } | 978 | } |
975 | geo.a_channels = i; | 979 | geo->a_channels = i; |
976 | } | 980 | } |
977 | if (have_bg) { | 981 | if (have_bg) { |
978 | for (i = 0, channel = 1; channel < 15; channel++) { | 982 | for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; |
979 | chan = &geo.bg[i++]; | 983 | channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { |
984 | chan = &geo->bg[i++]; | ||
980 | chan->freq = bcm43xx_channel_to_freq_bg(channel); | 985 | chan->freq = bcm43xx_channel_to_freq_bg(channel); |
981 | chan->channel = channel; | 986 | chan->channel = channel; |
982 | } | 987 | } |
983 | geo.bg_channels = i; | 988 | geo->bg_channels = i; |
984 | } | 989 | } |
985 | memcpy(geo.name, iso_country, 2); | 990 | memcpy(geo->name, iso_country, 2); |
986 | if (0 /*TODO: Outdoor use only */) | 991 | if (0 /*TODO: Outdoor use only */) |
987 | geo.name[2] = 'O'; | 992 | geo->name[2] = 'O'; |
988 | else if (0 /*TODO: Indoor use only */) | 993 | else if (0 /*TODO: Indoor use only */) |
989 | geo.name[2] = 'I'; | 994 | geo->name[2] = 'I'; |
990 | else | 995 | else |
991 | geo.name[2] = ' '; | 996 | geo->name[2] = ' '; |
992 | geo.name[3] = '\0'; | 997 | geo->name[3] = '\0'; |
998 | |||
999 | ieee80211_set_geo(bcm->ieee, geo); | ||
1000 | kfree(geo); | ||
993 | 1001 | ||
994 | ieee80211_set_geo(bcm->ieee, &geo); | 1002 | return 0; |
995 | } | 1003 | } |
996 | 1004 | ||
997 | /* DummyTransmission function, as documented on | 1005 | /* DummyTransmission function, as documented on |
@@ -3464,16 +3472,17 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3464 | goto err_80211_unwind; | 3472 | goto err_80211_unwind; |
3465 | bcm43xx_wireless_core_disable(bcm); | 3473 | bcm43xx_wireless_core_disable(bcm); |
3466 | } | 3474 | } |
3475 | err = bcm43xx_geo_init(bcm); | ||
3476 | if (err) | ||
3477 | goto err_80211_unwind; | ||
3467 | bcm43xx_pctl_set_crystal(bcm, 0); | 3478 | bcm43xx_pctl_set_crystal(bcm, 0); |
3468 | 3479 | ||
3469 | /* Set the MAC address in the networking subsystem */ | 3480 | /* Set the MAC address in the networking subsystem */ |
3470 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) | 3481 | if (is_valid_ether_addr(bcm->sprom.et1macaddr)) |
3471 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); | 3482 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); |
3472 | else | 3483 | else |
3473 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); | 3484 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); |
3474 | 3485 | ||
3475 | bcm43xx_geo_init(bcm); | ||
3476 | |||
3477 | snprintf(bcm->nick, IW_ESSID_MAX_SIZE, | 3486 | snprintf(bcm->nick, IW_ESSID_MAX_SIZE, |
3478 | "Broadcom %04X", bcm->chip_id); | 3487 | "Broadcom %04X", bcm->chip_id); |
3479 | 3488 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/bcm43xx/bcm43xx_main.h index eca79a38594a..30a202b258b5 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.h | |||
@@ -118,12 +118,14 @@ int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm, | |||
118 | static inline | 118 | static inline |
119 | int bcm43xx_is_valid_channel_a(u8 channel) | 119 | int bcm43xx_is_valid_channel_a(u8 channel) |
120 | { | 120 | { |
121 | return (channel <= 200); | 121 | return (channel >= IEEE80211_52GHZ_MIN_CHANNEL |
122 | && channel <= IEEE80211_52GHZ_MAX_CHANNEL); | ||
122 | } | 123 | } |
123 | static inline | 124 | static inline |
124 | int bcm43xx_is_valid_channel_bg(u8 channel) | 125 | int bcm43xx_is_valid_channel_bg(u8 channel) |
125 | { | 126 | { |
126 | return (channel >= 1 && channel <= 14); | 127 | return (channel >= IEEE80211_24GHZ_MIN_CHANNEL |
128 | && channel <= IEEE80211_24GHZ_MAX_CHANNEL); | ||
127 | } | 129 | } |
128 | static inline | 130 | static inline |
129 | int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, | 131 | int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index 33137165727f..b0abac515530 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -1287,7 +1287,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1287 | if (radio->revision == 8) | 1287 | if (radio->revision == 8) |
1288 | bcm43xx_phy_write(bcm, 0x0805, 0x3230); | 1288 | bcm43xx_phy_write(bcm, 0x0805, 0x3230); |
1289 | bcm43xx_phy_init_pctl(bcm); | 1289 | bcm43xx_phy_init_pctl(bcm); |
1290 | if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { | 1290 | if (bcm->chip_id == 0x4306 && bcm->chip_package == 2) { |
1291 | bcm43xx_phy_write(bcm, 0x0429, | 1291 | bcm43xx_phy_write(bcm, 0x0429, |
1292 | bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); | 1292 | bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); |
1293 | bcm43xx_phy_write(bcm, 0x04C3, | 1293 | bcm43xx_phy_write(bcm, 0x04C3, |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 3edbb481a0a0..b45063974ae9 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -182,8 +182,11 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev, | |||
182 | mode = BCM43xx_INITIAL_IWMODE; | 182 | mode = BCM43xx_INITIAL_IWMODE; |
183 | 183 | ||
184 | bcm43xx_lock_mmio(bcm, flags); | 184 | bcm43xx_lock_mmio(bcm, flags); |
185 | if (bcm->ieee->iw_mode != mode) | 185 | if (bcm->initialized) { |
186 | bcm43xx_set_iwmode(bcm, mode); | 186 | if (bcm->ieee->iw_mode != mode) |
187 | bcm43xx_set_iwmode(bcm, mode); | ||
188 | } else | ||
189 | bcm->ieee->iw_mode = mode; | ||
187 | bcm43xx_unlock_mmio(bcm, flags); | 190 | bcm43xx_unlock_mmio(bcm, flags); |
188 | 191 | ||
189 | return 0; | 192 | return 0; |