浏览代码

rt2x00: rt2800lib: autodetect 5GHz band support

If the RF chip supports more than 14 channels that
indirectly means that it supports the 5GHz band.
Use this fact to enable 5GHz band support instead
of setting SUPPORT_BAND_5GHZ separately for each
RF chip.

Also move the setup code of the 2GHz band to the
same place.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Gabor Juhos 11 年之前
父节点
当前提交
53c5a099b8
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      drivers/net/wireless/rt2x00/rt2800lib.c

+ 4 - 4
drivers/net/wireless/rt2x00/rt2800lib.c

@@ -7501,7 +7501,6 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	/*
 	/*
 	 * Initialize hw_mode information.
 	 * Initialize hw_mode information.
 	 */
 	 */
-	spec->supported_bands = SUPPORT_BAND_2GHZ;
 	spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
 	spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
 
 
 	switch (rt2x00dev->chip.rf) {
 	switch (rt2x00dev->chip.rf) {
@@ -7513,7 +7512,6 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 
 	case RF2750:
 	case RF2750:
 	case RF2850:
 	case RF2850:
-		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->channels = rf_vals;
 		spec->channels = rf_vals;
 		break;
 		break;
@@ -7537,13 +7535,11 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 
 	case RF3052:
 	case RF3052:
 	case RF3053:
 	case RF3053:
-		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		spec->num_channels = ARRAY_SIZE(rf_vals_3x);
 		spec->num_channels = ARRAY_SIZE(rf_vals_3x);
 		spec->channels = rf_vals_3x;
 		spec->channels = rf_vals_3x;
 		break;
 		break;
 
 
 	case RF5592:
 	case RF5592:
-		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, &reg);
 		rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, &reg);
 		if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) {
 		if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) {
 			spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40);
 			spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40);
@@ -7558,6 +7554,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	if (WARN_ON_ONCE(!spec->channels))
 	if (WARN_ON_ONCE(!spec->channels))
 		return -ENODEV;
 		return -ENODEV;
 
 
+	spec->supported_bands = SUPPORT_BAND_2GHZ;
+	if (spec->num_channels > 14)
+		spec->supported_bands |= SUPPORT_BAND_5GHZ;
+
 	/*
 	/*
 	 * Initialize HT information.
 	 * Initialize HT information.
 	 */
 	 */