diff options
Diffstat (limited to 'drivers/net/wireless/b43/phy_g.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_g.c | 92 |
1 files changed, 45 insertions, 47 deletions
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c index e4c9b4658d3e..8e157bc213f3 100644 --- a/drivers/net/wireless/b43/phy_g.c +++ b/drivers/net/wireless/b43/phy_g.c | |||
@@ -718,7 +718,7 @@ static void b43_calc_nrssi_threshold(struct b43_wldev *dev) | |||
718 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); | 718 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); |
719 | 719 | ||
720 | if (!phy->gmode || | 720 | if (!phy->gmode || |
721 | !(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { | 721 | !(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) { |
722 | tmp16 = b43_nrssi_hw_read(dev, 0x20); | 722 | tmp16 = b43_nrssi_hw_read(dev, 0x20); |
723 | if (tmp16 >= 0x20) | 723 | if (tmp16 >= 0x20) |
724 | tmp16 -= 0x40; | 724 | tmp16 -= 0x40; |
@@ -1114,7 +1114,7 @@ static u16 radio2050_rfover_val(struct b43_wldev *dev, | |||
1114 | { | 1114 | { |
1115 | struct b43_phy *phy = &dev->phy; | 1115 | struct b43_phy *phy = &dev->phy; |
1116 | struct b43_phy_g *gphy = phy->g; | 1116 | struct b43_phy_g *gphy = phy->g; |
1117 | struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); | 1117 | struct ssb_sprom *sprom = dev->dev->bus_sprom; |
1118 | 1118 | ||
1119 | if (!phy->gmode) | 1119 | if (!phy->gmode) |
1120 | return 0; | 1120 | return 0; |
@@ -1491,7 +1491,6 @@ static u16 b43_radio_init2050(struct b43_wldev *dev) | |||
1491 | 1491 | ||
1492 | static void b43_phy_initb5(struct b43_wldev *dev) | 1492 | static void b43_phy_initb5(struct b43_wldev *dev) |
1493 | { | 1493 | { |
1494 | struct ssb_bus *bus = dev->sdev->bus; | ||
1495 | struct b43_phy *phy = &dev->phy; | 1494 | struct b43_phy *phy = &dev->phy; |
1496 | struct b43_phy_g *gphy = phy->g; | 1495 | struct b43_phy_g *gphy = phy->g; |
1497 | u16 offset, value; | 1496 | u16 offset, value; |
@@ -1500,8 +1499,8 @@ static void b43_phy_initb5(struct b43_wldev *dev) | |||
1500 | if (phy->analog == 1) { | 1499 | if (phy->analog == 1) { |
1501 | b43_radio_set(dev, 0x007A, 0x0050); | 1500 | b43_radio_set(dev, 0x007A, 0x0050); |
1502 | } | 1501 | } |
1503 | if ((bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM) && | 1502 | if ((dev->dev->board_vendor != SSB_BOARDVENDOR_BCM) && |
1504 | (bus->boardinfo.type != SSB_BOARD_BU4306)) { | 1503 | (dev->dev->board_type != SSB_BOARD_BU4306)) { |
1505 | value = 0x2120; | 1504 | value = 0x2120; |
1506 | for (offset = 0x00A8; offset < 0x00C7; offset++) { | 1505 | for (offset = 0x00A8; offset < 0x00C7; offset++) { |
1507 | b43_phy_write(dev, offset, value); | 1506 | b43_phy_write(dev, offset, value); |
@@ -1620,7 +1619,7 @@ static void b43_phy_initb6(struct b43_wldev *dev) | |||
1620 | b43_radio_write16(dev, 0x5A, 0x88); | 1619 | b43_radio_write16(dev, 0x5A, 0x88); |
1621 | b43_radio_write16(dev, 0x5B, 0x6B); | 1620 | b43_radio_write16(dev, 0x5B, 0x6B); |
1622 | b43_radio_write16(dev, 0x5C, 0x0F); | 1621 | b43_radio_write16(dev, 0x5C, 0x0F); |
1623 | if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) { | 1622 | if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_ALTIQ) { |
1624 | b43_radio_write16(dev, 0x5D, 0xFA); | 1623 | b43_radio_write16(dev, 0x5D, 0xFA); |
1625 | b43_radio_write16(dev, 0x5E, 0xD8); | 1624 | b43_radio_write16(dev, 0x5E, 0xD8); |
1626 | } else { | 1625 | } else { |
@@ -1787,7 +1786,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev) | |||
1787 | b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); | 1786 | b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); |
1788 | b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); | 1787 | b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); |
1789 | 1788 | ||
1790 | if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) { | 1789 | if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA) { |
1791 | if (phy->rev >= 7) { | 1790 | if (phy->rev >= 7) { |
1792 | b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); | 1791 | b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); |
1793 | b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); | 1792 | b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); |
@@ -1922,7 +1921,6 @@ static void b43_hardware_pctl_init_gphy(struct b43_wldev *dev) | |||
1922 | /* Initialize B/G PHY power control */ | 1921 | /* Initialize B/G PHY power control */ |
1923 | static void b43_phy_init_pctl(struct b43_wldev *dev) | 1922 | static void b43_phy_init_pctl(struct b43_wldev *dev) |
1924 | { | 1923 | { |
1925 | struct ssb_bus *bus = dev->sdev->bus; | ||
1926 | struct b43_phy *phy = &dev->phy; | 1924 | struct b43_phy *phy = &dev->phy; |
1927 | struct b43_phy_g *gphy = phy->g; | 1925 | struct b43_phy_g *gphy = phy->g; |
1928 | struct b43_rfatt old_rfatt; | 1926 | struct b43_rfatt old_rfatt; |
@@ -1931,8 +1929,8 @@ static void b43_phy_init_pctl(struct b43_wldev *dev) | |||
1931 | 1929 | ||
1932 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); | 1930 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); |
1933 | 1931 | ||
1934 | if ((bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && | 1932 | if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) && |
1935 | (bus->boardinfo.type == SSB_BOARD_BU4306)) | 1933 | (dev->dev->board_type == SSB_BOARD_BU4306)) |
1936 | return; | 1934 | return; |
1937 | 1935 | ||
1938 | b43_phy_write(dev, 0x0028, 0x8018); | 1936 | b43_phy_write(dev, 0x0028, 0x8018); |
@@ -2053,7 +2051,7 @@ static void b43_phy_initg(struct b43_wldev *dev) | |||
2053 | if (phy->rev >= 6) { | 2051 | if (phy->rev >= 6) { |
2054 | b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); | 2052 | b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); |
2055 | } | 2053 | } |
2056 | if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) | 2054 | if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) |
2057 | b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); | 2055 | b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); |
2058 | else | 2056 | else |
2059 | b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); | 2057 | b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); |
@@ -2066,7 +2064,7 @@ static void b43_phy_initg(struct b43_wldev *dev) | |||
2066 | b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); | 2064 | b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); |
2067 | } | 2065 | } |
2068 | 2066 | ||
2069 | if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { | 2067 | if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) { |
2070 | /* The specs state to update the NRSSI LT with | 2068 | /* The specs state to update the NRSSI LT with |
2071 | * the value 0x7FFFFFFF here. I think that is some weird | 2069 | * the value 0x7FFFFFFF here. I think that is some weird |
2072 | * compiler optimization in the original driver. | 2070 | * compiler optimization in the original driver. |
@@ -2088,8 +2086,8 @@ static void b43_phy_initg(struct b43_wldev *dev) | |||
2088 | /* FIXME: The spec says in the following if, the 0 should be replaced | 2086 | /* FIXME: The spec says in the following if, the 0 should be replaced |
2089 | 'if OFDM may not be used in the current locale' | 2087 | 'if OFDM may not be used in the current locale' |
2090 | but OFDM is legal everywhere */ | 2088 | but OFDM is legal everywhere */ |
2091 | if ((dev->sdev->bus->chip_id == 0x4306 | 2089 | if ((dev->dev->chip_id == 0x4306 |
2092 | && dev->sdev->bus->chip_package == 2) || 0) { | 2090 | && dev->dev->chip_pkg == 2) || 0) { |
2093 | b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); | 2091 | b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); |
2094 | b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); | 2092 | b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); |
2095 | } | 2093 | } |
@@ -2105,7 +2103,7 @@ void b43_gphy_channel_switch(struct b43_wldev *dev, | |||
2105 | b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); | 2103 | b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); |
2106 | 2104 | ||
2107 | if (channel == 14) { | 2105 | if (channel == 14) { |
2108 | if (dev->sdev->bus->sprom.country_code == | 2106 | if (dev->dev->bus_sprom->country_code == |
2109 | SSB_SPROM1CCODE_JAPAN) | 2107 | SSB_SPROM1CCODE_JAPAN) |
2110 | b43_hf_write(dev, | 2108 | b43_hf_write(dev, |
2111 | b43_hf_read(dev) & ~B43_HF_ACPR); | 2109 | b43_hf_read(dev) & ~B43_HF_ACPR); |
@@ -2136,17 +2134,17 @@ static void default_baseband_attenuation(struct b43_wldev *dev, | |||
2136 | static void default_radio_attenuation(struct b43_wldev *dev, | 2134 | static void default_radio_attenuation(struct b43_wldev *dev, |
2137 | struct b43_rfatt *rf) | 2135 | struct b43_rfatt *rf) |
2138 | { | 2136 | { |
2139 | struct ssb_bus *bus = dev->sdev->bus; | 2137 | struct b43_bus_dev *bdev = dev->dev; |
2140 | struct b43_phy *phy = &dev->phy; | 2138 | struct b43_phy *phy = &dev->phy; |
2141 | 2139 | ||
2142 | rf->with_padmix = 0; | 2140 | rf->with_padmix = 0; |
2143 | 2141 | ||
2144 | if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM && | 2142 | if (dev->dev->board_vendor == SSB_BOARDVENDOR_BCM && |
2145 | bus->boardinfo.type == SSB_BOARD_BCM4309G) { | 2143 | dev->dev->board_type == SSB_BOARD_BCM4309G) { |
2146 | if (bus->boardinfo.rev < 0x43) { | 2144 | if (dev->dev->board_rev < 0x43) { |
2147 | rf->att = 2; | 2145 | rf->att = 2; |
2148 | return; | 2146 | return; |
2149 | } else if (bus->boardinfo.rev < 0x51) { | 2147 | } else if (dev->dev->board_rev < 0x51) { |
2150 | rf->att = 3; | 2148 | rf->att = 3; |
2151 | return; | 2149 | return; |
2152 | } | 2150 | } |
@@ -2172,21 +2170,21 @@ static void default_radio_attenuation(struct b43_wldev *dev, | |||
2172 | return; | 2170 | return; |
2173 | case 1: | 2171 | case 1: |
2174 | if (phy->type == B43_PHYTYPE_G) { | 2172 | if (phy->type == B43_PHYTYPE_G) { |
2175 | if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM | 2173 | if (bdev->board_vendor == SSB_BOARDVENDOR_BCM |
2176 | && bus->boardinfo.type == SSB_BOARD_BCM4309G | 2174 | && bdev->board_type == SSB_BOARD_BCM4309G |
2177 | && bus->boardinfo.rev >= 30) | 2175 | && bdev->board_rev >= 30) |
2178 | rf->att = 3; | 2176 | rf->att = 3; |
2179 | else if (bus->boardinfo.vendor == | 2177 | else if (bdev->board_vendor == |
2180 | SSB_BOARDVENDOR_BCM | 2178 | SSB_BOARDVENDOR_BCM |
2181 | && bus->boardinfo.type == | 2179 | && bdev->board_type == |
2182 | SSB_BOARD_BU4306) | 2180 | SSB_BOARD_BU4306) |
2183 | rf->att = 3; | 2181 | rf->att = 3; |
2184 | else | 2182 | else |
2185 | rf->att = 1; | 2183 | rf->att = 1; |
2186 | } else { | 2184 | } else { |
2187 | if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM | 2185 | if (bdev->board_vendor == SSB_BOARDVENDOR_BCM |
2188 | && bus->boardinfo.type == SSB_BOARD_BCM4309G | 2186 | && bdev->board_type == SSB_BOARD_BCM4309G |
2189 | && bus->boardinfo.rev >= 30) | 2187 | && bdev->board_rev >= 30) |
2190 | rf->att = 7; | 2188 | rf->att = 7; |
2191 | else | 2189 | else |
2192 | rf->att = 6; | 2190 | rf->att = 6; |
@@ -2194,16 +2192,16 @@ static void default_radio_attenuation(struct b43_wldev *dev, | |||
2194 | return; | 2192 | return; |
2195 | case 2: | 2193 | case 2: |
2196 | if (phy->type == B43_PHYTYPE_G) { | 2194 | if (phy->type == B43_PHYTYPE_G) { |
2197 | if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM | 2195 | if (bdev->board_vendor == SSB_BOARDVENDOR_BCM |
2198 | && bus->boardinfo.type == SSB_BOARD_BCM4309G | 2196 | && bdev->board_type == SSB_BOARD_BCM4309G |
2199 | && bus->boardinfo.rev >= 30) | 2197 | && bdev->board_rev >= 30) |
2200 | rf->att = 3; | 2198 | rf->att = 3; |
2201 | else if (bus->boardinfo.vendor == | 2199 | else if (bdev->board_vendor == |
2202 | SSB_BOARDVENDOR_BCM | 2200 | SSB_BOARDVENDOR_BCM |
2203 | && bus->boardinfo.type == | 2201 | && bdev->board_type == |
2204 | SSB_BOARD_BU4306) | 2202 | SSB_BOARD_BU4306) |
2205 | rf->att = 5; | 2203 | rf->att = 5; |
2206 | else if (bus->chip_id == 0x4320) | 2204 | else if (bdev->chip_id == 0x4320) |
2207 | rf->att = 4; | 2205 | rf->att = 4; |
2208 | else | 2206 | else |
2209 | rf->att = 3; | 2207 | rf->att = 3; |
@@ -2384,11 +2382,11 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) | |||
2384 | struct b43_phy_g *gphy = phy->g; | 2382 | struct b43_phy_g *gphy = phy->g; |
2385 | s16 pab0, pab1, pab2; | 2383 | s16 pab0, pab1, pab2; |
2386 | 2384 | ||
2387 | pab0 = (s16) (dev->sdev->bus->sprom.pa0b0); | 2385 | pab0 = (s16) (dev->dev->bus_sprom->pa0b0); |
2388 | pab1 = (s16) (dev->sdev->bus->sprom.pa0b1); | 2386 | pab1 = (s16) (dev->dev->bus_sprom->pa0b1); |
2389 | pab2 = (s16) (dev->sdev->bus->sprom.pa0b2); | 2387 | pab2 = (s16) (dev->dev->bus_sprom->pa0b2); |
2390 | 2388 | ||
2391 | B43_WARN_ON((dev->sdev->bus->chip_id == 0x4301) && | 2389 | B43_WARN_ON((dev->dev->chip_id == 0x4301) && |
2392 | (phy->radio_ver != 0x2050)); /* Not supported anymore */ | 2390 | (phy->radio_ver != 0x2050)); /* Not supported anymore */ |
2393 | 2391 | ||
2394 | gphy->dyn_tssi_tbl = 0; | 2392 | gphy->dyn_tssi_tbl = 0; |
@@ -2396,10 +2394,10 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) | |||
2396 | if (pab0 != 0 && pab1 != 0 && pab2 != 0 && | 2394 | if (pab0 != 0 && pab1 != 0 && pab2 != 0 && |
2397 | pab0 != -1 && pab1 != -1 && pab2 != -1) { | 2395 | pab0 != -1 && pab1 != -1 && pab2 != -1) { |
2398 | /* The pabX values are set in SPROM. Use them. */ | 2396 | /* The pabX values are set in SPROM. Use them. */ |
2399 | if ((s8) dev->sdev->bus->sprom.itssi_bg != 0 && | 2397 | if ((s8) dev->dev->bus_sprom->itssi_bg != 0 && |
2400 | (s8) dev->sdev->bus->sprom.itssi_bg != -1) { | 2398 | (s8) dev->dev->bus_sprom->itssi_bg != -1) { |
2401 | gphy->tgt_idle_tssi = | 2399 | gphy->tgt_idle_tssi = |
2402 | (s8) (dev->sdev->bus->sprom.itssi_bg); | 2400 | (s8) (dev->dev->bus_sprom->itssi_bg); |
2403 | } else | 2401 | } else |
2404 | gphy->tgt_idle_tssi = 62; | 2402 | gphy->tgt_idle_tssi = 62; |
2405 | gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, | 2403 | gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, |
@@ -2537,7 +2535,7 @@ static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev) | |||
2537 | b43_wireless_core_reset(dev, 0); | 2535 | b43_wireless_core_reset(dev, 0); |
2538 | b43_phy_initg(dev); | 2536 | b43_phy_initg(dev); |
2539 | phy->gmode = 1; | 2537 | phy->gmode = 1; |
2540 | b43_wireless_core_reset(dev, B43_TMSLOW_GMODE); | 2538 | b43_wireless_core_reset(dev, 1); |
2541 | } | 2539 | } |
2542 | 2540 | ||
2543 | return 0; | 2541 | return 0; |
@@ -2840,7 +2838,7 @@ static void b43_gphy_op_adjust_txpower(struct b43_wldev *dev) | |||
2840 | B43_TXCTL_TXMIX; | 2838 | B43_TXCTL_TXMIX; |
2841 | rfatt += 2; | 2839 | rfatt += 2; |
2842 | bbatt += 2; | 2840 | bbatt += 2; |
2843 | } else if (dev->sdev->bus->sprom. | 2841 | } else if (dev->dev->bus_sprom-> |
2844 | boardflags_lo & | 2842 | boardflags_lo & |
2845 | B43_BFL_PACTRL) { | 2843 | B43_BFL_PACTRL) { |
2846 | bbatt += 4 * (rfatt - 2); | 2844 | bbatt += 4 * (rfatt - 2); |
@@ -2914,14 +2912,14 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev, | |||
2914 | estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); | 2912 | estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); |
2915 | 2913 | ||
2916 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); | 2914 | B43_WARN_ON(phy->type != B43_PHYTYPE_G); |
2917 | max_pwr = dev->sdev->bus->sprom.maxpwr_bg; | 2915 | max_pwr = dev->dev->bus_sprom->maxpwr_bg; |
2918 | if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) | 2916 | if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) |
2919 | max_pwr -= 3; /* minus 0.75 */ | 2917 | max_pwr -= 3; /* minus 0.75 */ |
2920 | if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { | 2918 | if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { |
2921 | b43warn(dev->wl, | 2919 | b43warn(dev->wl, |
2922 | "Invalid max-TX-power value in SPROM.\n"); | 2920 | "Invalid max-TX-power value in SPROM.\n"); |
2923 | max_pwr = INT_TO_Q52(20); /* fake it */ | 2921 | max_pwr = INT_TO_Q52(20); /* fake it */ |
2924 | dev->sdev->bus->sprom.maxpwr_bg = max_pwr; | 2922 | dev->dev->bus_sprom->maxpwr_bg = max_pwr; |
2925 | } | 2923 | } |
2926 | 2924 | ||
2927 | /* Get desired power (in Q5.2) */ | 2925 | /* Get desired power (in Q5.2) */ |
@@ -3014,7 +3012,7 @@ static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev) | |||
3014 | { | 3012 | { |
3015 | struct b43_phy *phy = &dev->phy; | 3013 | struct b43_phy *phy = &dev->phy; |
3016 | 3014 | ||
3017 | if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) | 3015 | if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) |
3018 | return; | 3016 | return; |
3019 | 3017 | ||
3020 | b43_mac_suspend(dev); | 3018 | b43_mac_suspend(dev); |