linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2x00: Properly detect Ralink RT3070 devices.
@ 2009-11-09 21:59 Gertjan van Wingerde
  2009-11-09 22:04 ` Gábor Stefanik
  0 siblings, 1 reply; 3+ messages in thread
From: Gertjan van Wingerde @ 2009-11-09 21:59 UTC (permalink / raw)
  To: users, linux-wireless
  Cc: Ivo van Doorn, Bartlomiej Zolnierkiewicz, Gertjan van Wingerde

Allow rt2800usb to properly detect RT307X based devices, and set the appropriate chipset values.

Signed-off-by: Gertjan van Wingede <gwingerde@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2800usb.c |   21 ++++++++++++++-------
 drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index d22ab64..bd2f6e6 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -790,16 +790,19 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	 */
 	value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
 	rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
-	rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
+	rt2x00_set_chip_rf(rt2x00dev, value, reg);
 
 	/*
 	 * The check for rt2860 is not a typo, some rt2870 hardware
 	 * identifies itself as rt2860 in the CSR register.
 	 */
-	if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) &&
-	    !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) &&
-	    !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) &&
-	    !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) {
+	if (rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) ||
+	    rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) ||
+	    rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000)) {
+		rt2x00_set_chip_rt(rt2x00dev, RT3070);
+	} else if (rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x30700000)) {
+		rt2x00_set_chip_rt(rt2x00dev, RT3070);
+	} else {
 		ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
 		return -ENODEV;
 	}
@@ -809,7 +812,9 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	    !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
 	    !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
 	    !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
-	    !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+	    !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
+	    !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
+	    !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
 		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
 		return -ENODEV;
 	}
@@ -1028,7 +1033,9 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		spec->num_channels = ARRAY_SIZE(rf_vals);
 		spec->channels = rf_vals;
 	} else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-		   rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+		   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;
 	}
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index fd13264..181496e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -172,6 +172,7 @@ struct rt2x00_chip {
 #define RT3052		0x3052	/* WSOC */
 #define RT3090		0x3090	/* 2.4GHz PCIe */
 #define RT2870		0x1600
+#define RT3070		0x1800
 
 	u16 rf;
 	u32 rev;
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt2x00: Properly detect Ralink RT3070 devices.
  2009-11-09 21:59 [PATCH] rt2x00: Properly detect Ralink RT3070 devices Gertjan van Wingerde
@ 2009-11-09 22:04 ` Gábor Stefanik
  2009-11-09 22:11   ` Gertjan van Wingerde
  0 siblings, 1 reply; 3+ messages in thread
From: Gábor Stefanik @ 2009-11-09 22:04 UTC (permalink / raw)
  To: Gertjan van Wingerde
  Cc: users, linux-wireless, Ivo van Doorn, Bartlomiej Zolnierkiewicz

On Mon, Nov 9, 2009 at 10:59 PM, Gertjan van Wingerde
<gwingerde@gmail.com> wrote:
> Allow rt2800usb to properly detect RT307X based devices, and set the appropriate chipset values.
>
> Signed-off-by: Gertjan van Wingede <gwingerde@gmail.com>
> ---
>  drivers/net/wireless/rt2x00/rt2800usb.c |   21 ++++++++++++++-------
>  drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
>  2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
> index d22ab64..bd2f6e6 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -790,16 +790,19 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
>         */
>        value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
>        rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
> -       rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
> +       rt2x00_set_chip_rf(rt2x00dev, value, reg);
>
>        /*
>         * The check for rt2860 is not a typo, some rt2870 hardware
>         * identifies itself as rt2860 in the CSR register.
>         */
> -       if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) &&
> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) &&
> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) &&
> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) {
> +       if (rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) ||
> +           rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) ||
> +           rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000)) {
> +               rt2x00_set_chip_rt(rt2x00dev, RT3070);

Typo?

> +       } else if (rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x30700000)) {
> +               rt2x00_set_chip_rt(rt2x00dev, RT3070);
> +       } else {
>                ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
>                return -ENODEV;
>        }
> @@ -809,7 +812,9 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
>            !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
>            !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
>            !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
> -           !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> +           !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
> +           !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
> +           !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
>                ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
>                return -ENODEV;
>        }
> @@ -1028,7 +1033,9 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
>                spec->num_channels = ARRAY_SIZE(rf_vals);
>                spec->channels = rf_vals;
>        } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
> -                  rt2x00_rf(&rt2x00dev->chip, RF2020)) {
> +                  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;
>        }
> diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
> index fd13264..181496e 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00.h
> +++ b/drivers/net/wireless/rt2x00/rt2x00.h
> @@ -172,6 +172,7 @@ struct rt2x00_chip {
>  #define RT3052         0x3052  /* WSOC */
>  #define RT3090         0x3090  /* 2.4GHz PCIe */
>  #define RT2870         0x1600
> +#define RT3070         0x1800
>
>        u16 rf;
>        u32 rev;
> --
> 1.6.5.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt2x00: Properly detect Ralink RT3070 devices.
  2009-11-09 22:04 ` Gábor Stefanik
@ 2009-11-09 22:11   ` Gertjan van Wingerde
  0 siblings, 0 replies; 3+ messages in thread
From: Gertjan van Wingerde @ 2009-11-09 22:11 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: users, linux-wireless, Ivo van Doorn, Bartlomiej Zolnierkiewicz

On 11/09/09 23:04, Gábor Stefanik wrote:
> On Mon, Nov 9, 2009 at 10:59 PM, Gertjan van Wingerde
> <gwingerde@gmail.com> wrote:
>> Allow rt2800usb to properly detect RT307X based devices, and set the appropriate chipset values.
>>
>> Signed-off-by: Gertjan van Wingede <gwingerde@gmail.com>
>> ---
>>  drivers/net/wireless/rt2x00/rt2800usb.c |   21 ++++++++++++++-------
>>  drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
>>  2 files changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
>> index d22ab64..bd2f6e6 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
>> @@ -790,16 +790,19 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
>>         */
>>        value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
>>        rt2800_register_read(rt2x00dev, MAC_CSR0, &reg);
>> -       rt2x00_set_chip(rt2x00dev, RT2870, value, reg);
>> +       rt2x00_set_chip_rf(rt2x00dev, value, reg);
>>
>>        /*
>>         * The check for rt2860 is not a typo, some rt2870 hardware
>>         * identifies itself as rt2860 in the CSR register.
>>         */
>> -       if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) &&
>> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) &&
>> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) &&
>> -           !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) {
>> +       if (rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) ||
>> +           rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) ||
>> +           rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000)) {
>> +               rt2x00_set_chip_rt(rt2x00dev, RT3070);
> 
> Typo?
> 

Doh. You're right. And I did even test this on a RT2870 device :-(

Thanks for noticing this.

I'll resend the patch with this fixed.

But first, I need to find a brown paper bag somewhere. ;-)

---
Gertjan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-09 22:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 21:59 [PATCH] rt2x00: Properly detect Ralink RT3070 devices Gertjan van Wingerde
2009-11-09 22:04 ` Gábor Stefanik
2009-11-09 22:11   ` Gertjan van Wingerde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).