Hi! Thank you for clarifying this one! That was probably a life saver. I should have google'd the acronym XTAL=Crystal...
So: I'm wondering why it's done in SwitchChannel and not during initialization in the vendor driver (as it won't ever change in run-time, if I got it right now...) If this depends on the choice of an external crystal and therefore is a constant specific to the board, it can probably be probed in arch/mips/ramips/... and be passed to rt2x00 via platform_data. (Gabor: right?) Cheers Daniel On 12/11/12 05:33, Сергей Василюгин wrote: > Hi, Daniel > > > And no, No, NO! :) > > I pooly explain or you don't pay attention. Xtal20/40MHz external clock/tick > generator have no direct relation to HT20/HT40 > but precision of channel frequency only. So for that case we use corrected > frequency rf_vals table. And Xtal20/40MHz really must > be read from SYSC_CFG_REG as in original patch. In my dir-620 d1 Xtal20MHz > really exist. rt3050/rt3052 use xtal40MHz (in specs, > I don't check in my dir-620 a1 (rt3052), tonight I'll check it). > I think no need to differentiate ht20/ht40. > > 12.11.2012, 07:06, "Daniel Golle" <dgo...@allnet.de>: > >> Recent Ralink RFs need different rf_vals depending on whether HT20 or HT40 >> is >> being used. >> >> Signed-off-by: Daniel Golle <dgo...@allnet.de> >> >> create mode 100644 package/mac80211/patches/623-differentiate-rf_vals.patch >> >> diff --git a/package/mac80211/patches/622-rt2x00-fix-rt3352-ext-pa.patch >> b/package/mac80211/patches/622-rt2x00-fix-rt3352-ext-pa.patch >> index 17beaa0..ab4f7b3 100644 >> --- a/package/mac80211/patches/622-rt2x00-fix-rt3352-ext-pa.patch >> +++ b/package/mac80211/patches/622-rt2x00-fix-rt3352-ext-pa.patch >> @@ -119,7 +119,7 @@ >> EIRP_MAX_TX_POWER_LIMIT) >> __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags); >> >> -+ if (rt2x00_rt(rt2x00dev, RT3352) { >> ++ if (rt2x00_rt(rt2x00dev, RT3352)) { >> + if (!rt2x00_get_field16(eeprom, >> + EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) >> + __set_bit(CAPABILITY_INTERNAL_PA_TX0, >> diff --git a/package/mac80211/patches/623-differentiate-rf_vals.patch >> b/package/mac80211/patches/623-differentiate-rf_vals.patch >> new file mode 100644 >> index 0000000..8e569d6 >> --- /dev/null >> +++ b/package/mac80211/patches/623-differentiate-rf_vals.patch >> @@ -0,0 +1,211 @@ >> +--- a/drivers/net/wireless/rt2x00/rt2400pci.c >> ++++ b/drivers/net/wireless/rt2x00/rt2400pci.c >> +@@ -1588,7 +1588,7 @@ static int rt2400pci_probe_hw_mode(struc >> + spec->supported_rates = SUPPORT_RATE_CCK; >> + >> + spec->num_channels = ARRAY_SIZE(rf_vals_b); >> +- spec->channels = rf_vals_b; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_b; >> + >> + /* >> + * Create channel information array >> +--- a/drivers/net/wireless/rt2x00/rt2500pci.c >> ++++ b/drivers/net/wireless/rt2x00/rt2500pci.c >> +@@ -1882,23 +1882,23 @@ static int rt2500pci_probe_hw_mode(struc >> + >> + if (rt2x00_rf(rt2x00dev, RF2522)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); >> +- spec->channels = rf_vals_bg_2522; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2522; >> + } else if (rt2x00_rf(rt2x00dev, RF2523)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); >> +- spec->channels = rf_vals_bg_2523; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2523; >> + } else if (rt2x00_rf(rt2x00dev, RF2524)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); >> +- spec->channels = rf_vals_bg_2524; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2524; >> + } else if (rt2x00_rf(rt2x00dev, RF2525)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); >> +- spec->channels = rf_vals_bg_2525; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2525; >> + } else if (rt2x00_rf(rt2x00dev, RF2525E)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); >> +- spec->channels = rf_vals_bg_2525e; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2525e; >> + } else if (rt2x00_rf(rt2x00dev, RF5222)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals_5222); >> +- spec->channels = rf_vals_5222; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_5222; >> + } >> + >> + /* >> +--- a/drivers/net/wireless/rt2x00/rt2500usb.c >> ++++ b/drivers/net/wireless/rt2x00/rt2500usb.c >> +@@ -1721,23 +1721,23 @@ static int rt2500usb_probe_hw_mode(struc >> + >> + if (rt2x00_rf(rt2x00dev, RF2522)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); >> +- spec->channels = rf_vals_bg_2522; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2522; >> + } else if (rt2x00_rf(rt2x00dev, RF2523)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); >> +- spec->channels = rf_vals_bg_2523; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2523; >> + } else if (rt2x00_rf(rt2x00dev, RF2524)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); >> +- spec->channels = rf_vals_bg_2524; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2524; >> + } else if (rt2x00_rf(rt2x00dev, RF2525)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); >> +- spec->channels = rf_vals_bg_2525; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2525; >> + } else if (rt2x00_rf(rt2x00dev, RF2525E)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); >> +- spec->channels = rf_vals_bg_2525e; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2525e; >> + } else if (rt2x00_rf(rt2x00dev, RF5222)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals_5222); >> +- spec->channels = rf_vals_5222; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_5222; >> + } >> + >> + /* >> +--- a/drivers/net/wireless/rt2x00/rt2800lib.c >> ++++ b/drivers/net/wireless/rt2x00/rt2800lib.c >> +@@ -5132,12 +5132,12 @@ static int rt2800_probe_hw_mode(struct r >> + if (rt2x00_rf(rt2x00dev, RF2820) || >> + rt2x00_rf(rt2x00dev, RF2720)) { >> + spec->num_channels = 14; >> +- spec->channels = rf_vals; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals; >> + } else if (rt2x00_rf(rt2x00dev, RF2850) || >> + rt2x00_rf(rt2x00dev, RF2750)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals); >> +- spec->channels = rf_vals; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals; >> + } else if (rt2x00_rf(rt2x00dev, RF3020) || >> + rt2x00_rf(rt2x00dev, RF2020) || >> + rt2x00_rf(rt2x00dev, RF3021) || >> +@@ -5151,11 +5151,11 @@ static int rt2800_probe_hw_mode(struct r >> + rt2x00_rf(rt2x00dev, RF5390) || >> + rt2x00_rf(rt2x00dev, RF5392)) { >> + spec->num_channels = 14; >> +- spec->channels = rf_vals_3x; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_3x; >> + } else if (rt2x00_rf(rt2x00dev, RF3052)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals_3x); >> +- spec->channels = rf_vals_3x; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_3x; >> + } >> + >> + /* >> +--- a/drivers/net/wireless/rt2x00/rt2x00.h >> ++++ b/drivers/net/wireless/rt2x00/rt2x00.h >> +@@ -433,7 +433,8 @@ struct hw_mode_spec { >> + #define SUPPORT_RATE_OFDM 0x00000002 >> + >> + unsigned int num_channels; >> +- const struct rf_channel *channels; >> ++ const struct rf_channel *channels_ht20; >> ++ const struct rf_channel *channels_ht40; >> + const struct channel_info *channels_info; >> + >> + struct ieee80211_sta_ht_cap ht; >> +--- a/drivers/net/wireless/rt2x00/rt2x00config.c >> ++++ b/drivers/net/wireless/rt2x00/rt2x00config.c >> +@@ -184,7 +184,7 @@ static u16 rt2x00ht_center_channel(struc >> + /* >> + * Initialize center channel to current channel. >> + */ >> +- center_channel = spec->channels[conf->channel->hw_value].channel; >> ++ center_channel = spec->channels_ht40[conf->channel->hw_value].channel; >> + >> + /* >> + * Adjust center channel to HT40+ and HT40- operation. >> +@@ -195,7 +195,7 @@ static u16 rt2x00ht_center_channel(struc >> + center_channel -= (center_channel == 14) ? 1 : 2; >> + >> + for (i = 0; i < spec->num_channels; i++) >> +- if (spec->channels[i].channel == center_channel) >> ++ if (spec->channels_ht40[i].channel == center_channel) >> + return i; >> + >> + WARN_ON(1); >> +@@ -225,15 +225,17 @@ void rt2x00lib_config(struct rt2x00_dev >> + if (conf_is_ht40(conf)) { >> + set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); >> + hw_value = rt2x00ht_center_channel(rt2x00dev, conf); >> ++ memcpy(&libconf.rf, >> ++ &rt2x00dev->spec.channels_ht40[hw_value], >> ++ sizeof(libconf.rf)); >> + } else { >> + clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); >> + hw_value = conf->channel->hw_value; >> ++ memcpy(&libconf.rf, >> ++ &rt2x00dev->spec.channels_ht20[hw_value], >> ++ sizeof(libconf.rf)); >> + } >> + >> +- memcpy(&libconf.rf, >> +- &rt2x00dev->spec.channels[hw_value], >> +- sizeof(libconf.rf)); >> +- >> + memcpy(&libconf.channel, >> + &rt2x00dev->spec.channels_info[hw_value], >> + sizeof(libconf.channel)); >> +--- a/drivers/net/wireless/rt2x00/rt2x00dev.c >> ++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c >> +@@ -887,7 +887,7 @@ static int rt2x00lib_probe_hw_modes(stru >> + */ >> + for (i = 0; i < spec->num_channels; i++) { >> + rt2x00lib_channel(&channels[i], >> +- spec->channels[i].channel, >> ++ spec->channels_ht20[i].channel, >> + spec->channels_info[i].max_power, i); >> + } >> + >> +--- a/drivers/net/wireless/rt2x00/rt61pci.c >> ++++ b/drivers/net/wireless/rt2x00/rt61pci.c >> +@@ -2797,10 +2797,10 @@ static int rt61pci_probe_hw_mode(struct >> + >> + if (!test_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags)) { >> + spec->num_channels = 14; >> +- spec->channels = rf_vals_noseq; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_noseq; >> + } else { >> + spec->num_channels = 14; >> +- spec->channels = rf_vals_seq; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_seq; >> + } >> + >> + if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) { >> +--- a/drivers/net/wireless/rt2x00/rt73usb.c >> ++++ b/drivers/net/wireless/rt2x00/rt73usb.c >> +@@ -2134,18 +2134,18 @@ static int rt73usb_probe_hw_mode(struct >> + >> + if (rt2x00_rf(rt2x00dev, RF2528)) { >> + spec->num_channels = ARRAY_SIZE(rf_vals_bg_2528); >> +- spec->channels = rf_vals_bg_2528; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_bg_2528; >> + } else if (rt2x00_rf(rt2x00dev, RF5226)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals_5226); >> +- spec->channels = rf_vals_5226; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_5226; >> + } else if (rt2x00_rf(rt2x00dev, RF2527)) { >> + spec->num_channels = 14; >> +- spec->channels = rf_vals_5225_2527; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_5225_2527; >> + } else if (rt2x00_rf(rt2x00dev, RF5225)) { >> + spec->supported_bands |= SUPPORT_BAND_5GHZ; >> + spec->num_channels = ARRAY_SIZE(rf_vals_5225_2527); >> +- spec->channels = rf_vals_5225_2527; >> ++ spec->channels_ht20 = spec->channels_ht40 = rf_vals_5225_2527; >> + } >> + >> + /* >> -- >> 1.8.0 > > --- > serge > -- ALLNET GmbH ; Maistr. 2 ; D-82110 Germering ; Germany Tel. +49-89-89422217 - Fax +49-89-89422233 http://www.allnet.de email: Daniel Golle <dgo...@allnet.de> Schulungs-/Veranstaltungsprogramm: http://www.802lab.de<http://www.802lab.de/> Geschäftsführer: Wolfgang Marcus Bauer Handelsregister München B 95922 ; UST-ID-Nr. DE 128214294 ; St.-Nr.117/115/00164 WEEE-Reg.-NR. DE 13101093 Bankverbindung: Sparkasse Fürstenfeldbruck KTO: 2774594 ; BLZ: 70053070 Swift-Code: BYLADEM1FFB ; IBAN: DE61700530700002774594 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel