diff options
Diffstat (limited to 'drivers/net/wireless/ath5k/phy.c')
-rw-r--r-- | drivers/net/wireless/ath5k/phy.c | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c index 66af70bd14e7..cbc362d20719 100644 --- a/drivers/net/wireless/ath5k/phy.c +++ b/drivers/net/wireless/ath5k/phy.c | |||
@@ -1898,9 +1898,6 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
1898 | data = data0 = data1 = data2 = 0; | 1898 | data = data0 = data1 = data2 = 0; |
1899 | c = channel->center_freq; | 1899 | c = channel->center_freq; |
1900 | 1900 | ||
1901 | /* | ||
1902 | * Set the channel on the RF5112 or newer | ||
1903 | */ | ||
1904 | if (c < 4800) { | 1901 | if (c < 4800) { |
1905 | if (!((c - 2224) % 5)) { | 1902 | if (!((c - 2224) % 5)) { |
1906 | data0 = ((2 * (c - 704)) - 3040) / 10; | 1903 | data0 = ((2 * (c - 704)) - 3040) / 10; |
@@ -1912,7 +1909,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
1912 | return -EINVAL; | 1909 | return -EINVAL; |
1913 | 1910 | ||
1914 | data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); | 1911 | data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); |
1915 | } else { | 1912 | } else if ((c - (c % 5)) != 2 || c > 5435) { |
1916 | if (!(c % 20) && c >= 5120) { | 1913 | if (!(c % 20) && c >= 5120) { |
1917 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); | 1914 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); |
1918 | data2 = ath5k_hw_bitswap(3, 2); | 1915 | data2 = ath5k_hw_bitswap(3, 2); |
@@ -1924,6 +1921,9 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
1924 | data2 = ath5k_hw_bitswap(1, 2); | 1921 | data2 = ath5k_hw_bitswap(1, 2); |
1925 | } else | 1922 | } else |
1926 | return -EINVAL; | 1923 | return -EINVAL; |
1924 | } else { | ||
1925 | data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); | ||
1926 | data2 = ath5k_hw_bitswap(0, 2); | ||
1927 | } | 1927 | } |
1928 | 1928 | ||
1929 | data = (data0 << 4) | (data1 << 1) | (data2 << 2) | 0x1001; | 1929 | data = (data0 << 4) | (data1 << 1) | (data2 << 2) | 0x1001; |
@@ -1935,6 +1935,45 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, | |||
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | /* | 1937 | /* |
1938 | * Set the channel on the RF2425 | ||
1939 | */ | ||
1940 | static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah, | ||
1941 | struct ieee80211_channel *channel) | ||
1942 | { | ||
1943 | u32 data, data0, data2; | ||
1944 | u16 c; | ||
1945 | |||
1946 | data = data0 = data2 = 0; | ||
1947 | c = channel->center_freq; | ||
1948 | |||
1949 | if (c < 4800) { | ||
1950 | data0 = ath5k_hw_bitswap((c - 2272), 8); | ||
1951 | data2 = 0; | ||
1952 | /* ? 5GHz ? */ | ||
1953 | } else if ((c - (c % 5)) != 2 || c > 5435) { | ||
1954 | if (!(c % 20) && c < 5120) | ||
1955 | data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); | ||
1956 | else if (!(c % 10)) | ||
1957 | data0 = ath5k_hw_bitswap(((c - 4800) / 10 << 1), 8); | ||
1958 | else if (!(c % 5)) | ||
1959 | data0 = ath5k_hw_bitswap((c - 4800) / 5, 8); | ||
1960 | else | ||
1961 | return -EINVAL; | ||
1962 | data2 = ath5k_hw_bitswap(1, 2); | ||
1963 | } else { | ||
1964 | data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8); | ||
1965 | data2 = ath5k_hw_bitswap(0, 2); | ||
1966 | } | ||
1967 | |||
1968 | data = (data0 << 4) | data2 << 2 | 0x1001; | ||
1969 | |||
1970 | ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER); | ||
1971 | ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5); | ||
1972 | |||
1973 | return 0; | ||
1974 | } | ||
1975 | |||
1976 | /* | ||
1938 | * Set a channel on the radio chip | 1977 | * Set a channel on the radio chip |
1939 | */ | 1978 | */ |
1940 | int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) | 1979 | int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) |
@@ -1963,6 +2002,9 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) | |||
1963 | case AR5K_RF5111: | 2002 | case AR5K_RF5111: |
1964 | ret = ath5k_hw_rf5111_channel(ah, channel); | 2003 | ret = ath5k_hw_rf5111_channel(ah, channel); |
1965 | break; | 2004 | break; |
2005 | case AR5K_RF2425: | ||
2006 | ret = ath5k_hw_rf2425_channel(ah, channel); | ||
2007 | break; | ||
1966 | default: | 2008 | default: |
1967 | ret = ath5k_hw_rf5112_channel(ah, channel); | 2009 | ret = ath5k_hw_rf5112_channel(ah, channel); |
1968 | break; | 2010 | break; |
@@ -1971,6 +2013,15 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) | |||
1971 | if (ret) | 2013 | if (ret) |
1972 | return ret; | 2014 | return ret; |
1973 | 2015 | ||
2016 | /* Set JAPAN setting for channel 14 */ | ||
2017 | if (channel->center_freq == 2484) { | ||
2018 | AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, | ||
2019 | AR5K_PHY_CCKTXCTL_JAPAN); | ||
2020 | } else { | ||
2021 | AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, | ||
2022 | AR5K_PHY_CCKTXCTL_WORLD); | ||
2023 | } | ||
2024 | |||
1974 | ah->ah_current_channel.center_freq = channel->center_freq; | 2025 | ah->ah_current_channel.center_freq = channel->center_freq; |
1975 | ah->ah_current_channel.hw_value = channel->hw_value; | 2026 | ah->ah_current_channel.hw_value = channel->hw_value; |
1976 | ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false; | 2027 | ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false; |