Skip to contentSkip to conversation

rt2x00: Initialize rf302x RF values properly in rt2800pci.

PATCH Superseded Gertjan van Wingerde 3 participants 4 messages Nov 9, 2009 – Nov 10, 2009 Networking drivers (wireless)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00: Initialize rf302x RF values properly in rt2800pci.

Insert RF chipset values for the RF302x chipsets. Mirrored from the rt2800usb driver. Also, ensure these RF chipsets are handled properly in rt2800lib for the rt3090 chipset.

---

This one clashes with the patch series sent by Bart. However, I believe that logically this patch belongs before his patch series, as it makes the unification cleaner and clearer.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    5 +++--
 drivers/net/wireless/rt2x00/rt2800pci.c |   31 +++++++++++++++++++++++++++----
 drivers/net/wireless/rt2x00/rt2800usb.c |    8 ++++----
 3 files changed, 34 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +3 -2
index 446087e..d41b3ca 100644
@@ -806,8 +806,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	unsigned int tx_pin;
 	u8 bbp;
 
-	if (rt2x00_rt(&rt2x00dev->chip, RT3070) &&	
-           (rt2x00_rf(&rt2x00dev->chip, RF2020) ||
+	if ((rt2x00_rt(&rt2x00dev->chip, RT3070) ||
+	     rt2x00_rt(&rt2x00dev->chip, RT3090)) &&
+            (rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3020) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3021) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3022)))
drivers/net/wireless/rt2x00/rt2800pci.c +27 -4
index ac7ac57..be42558 100644
@@ -1362,6 +1362,27 @@ static const struct rf_channel rf_vals[] = {
 	{ 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
 };
 
+/*
+ * RF value list for rt302x
+ * Supports: 2.4 GHz
+ */
+static const struct rf_channel rf_vals_302x[] = {
+	{1,  241, 2, 2 },
+	{2,  241, 2, 7 },
+	{3,  242, 2, 2 },
+	{4,  242, 2, 7 },
+	{5,  243, 2, 2 },
+	{6,  243, 2, 7 },
+	{7,  244, 2, 2 },
+	{8,  244, 2, 7 },
+	{9,  245, 2, 2 },
+	{10, 245, 2, 7 },
+	{11, 246, 2, 2 },
+	{12, 246, 2, 7 },
+	{13, 247, 2, 2 },
+	{14, 248, 2, 4 },
+};
+
 static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 {
 	struct hw_mode_spec *spec = &rt2x00dev->spec;
@@ -1396,10 +1417,6 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 	if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3021) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3022) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF3052)) {
 		spec->num_channels = 14;
 		spec->channels = rf_vals;
@@ -1408,6 +1425,12 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->channels = rf_vals;
+	} else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3021) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3022) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
+		spec->channels = rf_vals_302x;
 	}
 
 	/*
drivers/net/wireless/rt2x00/rt2800usb.c +4 -4
index bd2f6e6..9aa2f7a 100644
@@ -940,10 +940,10 @@ static const struct rf_channel rf_vals[] = {
 };
 
 /*
- * RF value list for rt3070
+ * RF value list for rf302x
  * Supports: 2.4 GHz
  */
-static const struct rf_channel rf_vals_3070[] = {
+static const struct rf_channel rf_vals_302x[] = {
 	{1,  241, 2, 2 },
 	{2,  241, 2, 7 },
 	{3,  242, 2, 2 },
@@ -1036,8 +1036,8 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		   rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 		   rt2x00_rf(&rt2x00dev->chip, RF3021) ||
 		   rt2x00_rf(&rt2x00dev->chip, RF3022)) {
-		spec->num_channels = ARRAY_SIZE(rf_vals_3070);
-		spec->channels = rf_vals_3070;
+		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
+		spec->channels = rf_vals_302x;
 	}
 
 	/*
Signature · 1 line
1.6.5.2
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Gertjan van Wingerde

Insert RF chipset values for the RF302x chipsets. Mirrored from the rt2800usb driver. Also, ensure these RF chipsets are handled properly in rt2800lib for the rt3090 chipset.

Quoted 111 lines

---

This one clashes with the patch series sent by Bart. However, I believe that logically this patch belongs before his patch series, as it makes the unification cleaner and clearer.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    5 +++--
 drivers/net/wireless/rt2x00/rt2800pci.c |   31 +++++++++++++++++++++++++++----
 drivers/net/wireless/rt2x00/rt2800usb.c |    8 ++++----
 3 files changed, 34 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +3 -2
index 446087e..d41b3ca 100644
@@ -806,8 +806,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	unsigned int tx_pin;
 	u8 bbp;
 
-	if (rt2x00_rt(&rt2x00dev->chip, RT3070) &&	
-           (rt2x00_rf(&rt2x00dev->chip, RF2020) ||
+	if ((rt2x00_rt(&rt2x00dev->chip, RT3070) ||
+	     rt2x00_rt(&rt2x00dev->chip, RT3090)) &&
+            (rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3020) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3021) ||
 	     rt2x00_rf(&rt2x00dev->chip, RF3022)))
drivers/net/wireless/rt2x00/rt2800pci.c +27 -4
index ac7ac57..be42558 100644
@@ -1362,6 +1362,27 @@ static const struct rf_channel rf_vals[] = {
 	{ 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
 };
 
+/*
+ * RF value list for rt302x
+ * Supports: 2.4 GHz
+ */
+static const struct rf_channel rf_vals_302x[] = {
+	{1,  241, 2, 2 },
+	{2,  241, 2, 7 },
+	{3,  242, 2, 2 },
+	{4,  242, 2, 7 },
+	{5,  243, 2, 2 },
+	{6,  243, 2, 7 },
+	{7,  244, 2, 2 },
+	{8,  244, 2, 7 },
+	{9,  245, 2, 2 },
+	{10, 245, 2, 7 },
+	{11, 246, 2, 2 },
+	{12, 246, 2, 7 },
+	{13, 247, 2, 2 },
+	{14, 248, 2, 4 },
+};
+
 static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 {
 	struct hw_mode_spec *spec = &rt2x00dev->spec;
@@ -1396,10 +1417,6 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 	if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3021) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3022) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF3052)) {
 		spec->num_channels = 14;
 		spec->channels = rf_vals;
@@ -1408,6 +1425,12 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->channels = rf_vals;
+	} else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3021) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3022) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
+		spec->channels = rf_vals_302x;
 	}
 
 	/*
drivers/net/wireless/rt2x00/rt2800usb.c +4 -4
index bd2f6e6..9aa2f7a 100644
@@ -940,10 +940,10 @@ static const struct rf_channel rf_vals[] = {
 };
 
 /*
- * RF value list for rt3070
+ * RF value list for rf302x
  * Supports: 2.4 GHz
  */
-static const struct rf_channel rf_vals_3070[] = {
+static const struct rf_channel rf_vals_302x[] = {
 	{1,  241, 2, 2 },
 	{2,  241, 2, 7 },
 	{3,  242, 2, 2 },
@@ -1036,8 +1036,8 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		   rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 		   rt2x00_rf(&rt2x00dev->chip, RF3021) ||
 		   rt2x00_rf(&rt2x00dev->chip, RF3022)) {
-		spec->num_channels = ARRAY_SIZE(rf_vals_3070);
-		spec->channels = rf_vals_3070;
+		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
+		spec->channels = rf_vals_302x;
 	}
 
 	/*
#2 lore raw
In reply to Gertjan van Wingerde

Hi Gertjan,

Quoted 8 lines · On Monday 09 November 2009 23:00:17 Gertjan van Wingerde wrote:

Insert RF chipset values for the RF302x chipsets. Mirrored from the rt2800usb driver. Also, ensure these RF chipsets are handled properly in rt2800lib for the rt3090 chipset.

---

This one clashes with the patch series sent by Bart. However, I believe that logically this patch belongs before his patch series, as it makes the unification cleaner and clearer.

The change itself is correct and much welcomed but please take a look at the diffstat below:

Quoted 5 lines
---
 drivers/net/wireless/rt2x00/rt2800lib.c |    5 +++--
 drivers/net/wireless/rt2x00/rt2800pci.c |   31 +++++++++++++++++++++++++++----
 drivers/net/wireless/rt2x00/rt2800usb.c |    8 ++++----
 3 files changed, 34 insertions(+), 10 deletions(-)

I worry that applying this patch before unification will not make anything cleaner, especially since it duplicates code that unification patch will now have to also remove:

Quoted 14 lines
drivers/net/wireless/rt2x00/rt2800pci.c +10 -0
@@ -1362,6 +1362,27 @@ static const struct rf_channel rf_vals[] = {
 	{ 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
 };
 
+/*
+ * RF value list for rt302x
+ * Supports: 2.4 GHz
+ */
+static const struct rf_channel rf_vals_302x[] = {
+	{1,  241, 2, 2 },
+	{2,  241, 2, 7 },
+	{3,  242, 2, 2 },
+	{4,  242, 2, 7 },
+	{5,  243, 2, 2 },

drivers/net/wireless/rt2x00/rt2800pci.c static const struct rf_channel rf_vals[] = { · line 1384

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2800pci.c +10 -0
+	{6,  243, 2, 7 },
+	{7,  244, 2, 2 },
+	{8,  244, 2, 7 },
+	{9,  245, 2, 2 },
+	{10, 245, 2, 7 },
+	{11, 246, 2, 2 },
+	{12, 246, 2, 7 },
+	{13, 247, 2, 2 },
+	{14, 248, 2, 4 },
+};

Some previous patches also cleaned up the code below (by using 'chip' variable) so this patch could have been smaller and easier to review by simply basing it on the previous work.

Quoted 12 lines
drivers/net/wireless/rt2x00/rt2800pci.c +0 -4
@@ -1396,10 +1417,6 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 	if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3021) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF3022) ||
-	    rt2x00_rf(&rt2x00dev->chip, RF2020) ||
 	    rt2x00_rf(&rt2x00dev->chip, RF3052)) {
 		spec->num_channels = 14;
 		spec->channels = rf_vals;

drivers/net/wireless/rt2x00/rt2800pci.c static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) · line 1433

Quoted 9 lines
drivers/net/wireless/rt2x00/rt2800pci.c +6 -0
@@ -1408,6 +1425,12 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		spec->supported_bands |= SUPPORT_BAND_5GHZ;
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->channels = rf_vals;
+	} else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3021) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF3022) ||
+		   rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
+		spec->channels = rf_vals_302x;

Please also note that previous patches were tested, reviewed and many agreed on already (i.e. unification patch has Ivo's ACK) so unfortunate side effect of not doing changes in the incremental fashion is that people will be needlessly required to invest time on testing & reviewing modified patches..

Please reconsider re-basing your work on top of changes from:

	git://git.kernel.org/pub/scm/linux/kernel/git/bart/misc.git rt2800

Thanks.

Signature · 1 line
Bartlomiej Zolnierkiewicz
#3 lore raw
Quoted 22 lines · Bartlomiej Zolnierkiewicz

Hi Gertjan,

Quoted 8 lines · On Monday 09 November 2009 23:00:17 Gertjan van Wingerde wrote:

Insert RF chipset values for the RF302x chipsets. Mirrored from the rt2800usb driver. Also, ensure these RF chipsets are handled properly in rt2800lib for the rt3090 chipset.

---

This one clashes with the patch series sent by Bart. However, I believe that logically this patch belongs before his patch series, as it makes the unification cleaner and clearer.

The change itself is correct and much welcomed but please take a look at the diffstat below:

Quoted 5 lines
---
 drivers/net/wireless/rt2x00/rt2800lib.c |    5 +++--
 drivers/net/wireless/rt2x00/rt2800pci.c |   31 +++++++++++++++++++++++++++----
 drivers/net/wireless/rt2x00/rt2800usb.c |    8 ++++----
 3 files changed, 34 insertions(+), 10 deletions(-)
Quoted 4 lines

I worry that applying this patch before unification will not make anything cleaner, especially since it duplicates code that unification patch will now have to also remove:

I agree that the patch in itself won't make things cleaner. However, my argument was that applying this patch before unification would make the unification patch cleaner and clearer (i.e. it would be more obvious that there is a large degree of overlap).

However, since I am such a nice guy, I will respin my 2 of my patches (the RT3070 detection for rt2800usb and this one) to apply on top of your patch series.

---
Gertjan.