linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT 0/2] ar9170: initial stage 1 firmware support /  AVM fritz
@ 2009-05-28  1:48 Luis R. Rodriguez
  2009-05-28  1:48 ` [RFT 1/2] ar9170: add initial support for 1-stage firmware Luis R. Rodriguez
  2009-05-28  1:48 ` [RFT 2/2] ar9170: add AVM FRITZ devices Luis R. Rodriguez
  0 siblings, 2 replies; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28  1:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: jal2, Peter.Grabienski, Stephen.Chen, Michael.Fortin,
	Johnny.Cheng, Yuan-Gu.Wei, otus-devel, Luis R. Rodriguez

Please give this a shot with the AVM Fritz device.
At least for me I can only scan, I cannot associate to an AP
yet with the 1 stage firmware but I've been told it does seem
to work with some devices..

If you can even at least scan with the AVM fritz devices then this means
we just need to finish the 1 stage firmware support in order for them to work.
I cannot work on this more though so if someone has time and you want to pick
up the work please refer the Otus code (in staging/otus/ and ensure that the
code #ifdef'd around ZM_OTUS_LINUX_PHASE_2 is _not_ used. ar9170 and otus
are very different (which is good) but unfortunately for this exercise this
means its very difficult to find the exact calls #ifdef'd on the ar9170 port.
I may have missed one or two more.

Luis R. Rodriguez (2):
  ar9170: add initial support for 1-stage firmware
  ar9170: add AVM FRITZ devices

 drivers/net/wireless/ath/ar9170/phy.c |   13 ++++++--
 drivers/net/wireless/ath/ar9170/usb.c |   50 +++++++++++++++++++++++++++++---
 drivers/net/wireless/ath/ar9170/usb.h |    2 +
 3 files changed, 57 insertions(+), 8 deletions(-)


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

* [RFT 1/2] ar9170: add initial support for 1-stage firmware
  2009-05-28  1:48 [RFT 0/2] ar9170: initial stage 1 firmware support / AVM fritz Luis R. Rodriguez
@ 2009-05-28  1:48 ` Luis R. Rodriguez
  2009-05-28 16:03   ` Christian Lamparter
  2009-05-28  1:48 ` [RFT 2/2] ar9170: add AVM FRITZ devices Luis R. Rodriguez
  1 sibling, 1 reply; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28  1:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: jal2, Peter.Grabienski, Stephen.Chen, Michael.Fortin,
	Johnny.Cheng, Yuan-Gu.Wei, otus-devel, Luis R. Rodriguez

You can get the stage 1 firmware from here:

http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/ar9170.fw

Its license:

http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/LICENSE

It seems with some devices this works, with some others
I see only scan working. We shall not push this firmware
into the linux-firmware tree until these issues have been
resolved.

Cc: Peter Grabienski <Peter.Grabienski@Atheros.com>
Cc: Stephen Chen <Stephen.Chen@Atheros.com>
Cc: Michael Fortin <Michael.Fortin@Atheros.com>
Cc: Johnny Cheng <Johnny.Cheng@Atheros.com>
Cc: Yuan-Gu Wei <Yuan-Gu.Wei@atheros.com>
Cc: Joerg Albert <jal2@gmx.de>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ar9170/phy.c |   13 ++++++++++---
 drivers/net/wireless/ath/ar9170/usb.c |   22 +++++++++++++++++-----
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c
index 6ce2075..0675dc8 100644
--- a/drivers/net/wireless/ath/ar9170/phy.c
+++ b/drivers/net/wireless/ath/ar9170/phy.c
@@ -39,6 +39,7 @@
 #include <linux/bitrev.h>
 #include "ar9170.h"
 #include "cmd.h"
+#include "usb.h"
 
 static int ar9170_init_power_cal(struct ar9170 *ar)
 {
@@ -996,6 +997,10 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
 	int idx, i, n;
 	u8 ackpower, ackchains, f;
 	u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS];
+	struct ar9170_usb *aru;
+
+	/* All ar9170 devices are USB */
+	aru = container_of(ar, struct ar9170_usb, common);
 
 	if (freq < 3000)
 		f = freq - 2300;
@@ -1102,9 +1107,11 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
 	else
 		ackpower = ar->power_5G_leg[0] & 0x3f;
 
-	ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
-	ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
-				  ackpower << 21 | ackchains << 27);
+	if (aru->init_values)  {
+		ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
+		ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
+					  ackpower << 21 | ackchains << 27);
+	}
 
 	ar9170_regwrite_finish();
 	return ar9170_regwrite_result();
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index d7c13c0..3c97c09 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -51,6 +51,7 @@ MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Atheros AR9170 802.11n USB wireless");
+MODULE_FIRMWARE("ar9170.fw");
 MODULE_FIRMWARE("ar9170-1.fw");
 MODULE_FIRMWARE("ar9170-2.fw");
 
@@ -504,17 +505,23 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
 {
 	int err = 0;
 
-	err = request_firmware(&aru->init_values, "ar9170-1.fw",
+	err = request_firmware(&aru->firmware, "ar9170.fw",
 			       &aru->udev->dev);
-	if (err) {
-		dev_err(&aru->udev->dev, "file with init values not found.\n");
-		return err;
+	if (!err) {
+		aru->init_values = NULL;
+		return 0;
 	}
 
+	dev_err(&aru->udev->dev, "ar9170.fw firmware file "
+		"not found, trying old firmware...\n");
+
+	err = request_firmware(&aru->init_values, "ar9170-1.fw",
+			       &aru->udev->dev);
+
 	err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
 	if (err) {
 		release_firmware(aru->init_values);
-		dev_err(&aru->udev->dev, "firmware file not found.\n");
+		dev_err(&aru->udev->dev, "file with init values not found.\n");
 		return err;
 	}
 
@@ -548,6 +555,9 @@ static int ar9170_usb_upload_firmware(struct ar9170_usb *aru)
 {
 	int err;
 
+	if (!aru->init_values)
+		goto upload_fw_start;
+
 	/* First, upload initial values to device RAM */
 	err = ar9170_usb_upload(aru, aru->init_values->data,
 				aru->init_values->size, 0x102800, false);
@@ -557,6 +567,8 @@ static int ar9170_usb_upload_firmware(struct ar9170_usb *aru)
 		return err;
 	}
 
+upload_fw_start:
+
 	/* Then, upload the firmware itself and start it */
 	return ar9170_usb_upload(aru, aru->firmware->data, aru->firmware->size,
 				0x200000, true);
-- 
1.6.0.6


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

* [RFT 2/2] ar9170: add AVM FRITZ devices
  2009-05-28  1:48 [RFT 0/2] ar9170: initial stage 1 firmware support / AVM fritz Luis R. Rodriguez
  2009-05-28  1:48 ` [RFT 1/2] ar9170: add initial support for 1-stage firmware Luis R. Rodriguez
@ 2009-05-28  1:48 ` Luis R. Rodriguez
  2009-05-28  7:17   ` Marcel Holtmann
  1 sibling, 1 reply; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28  1:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: jal2, Peter.Grabienski, Stephen.Chen, Michael.Fortin,
	Johnny.Cheng, Yuan-Gu.Wei, otus-devel, Luis R. Rodriguez

This adds:

USB 0x057C:0x8401       AVM FRITZ!WLAN USB Stick N
USB 0x057C:0x8402       AVM FRITZ!WLAN USB Stick N 2.4

These devices require the 1-stage firmware, if not present we
don't continue.

Cc: Peter Grabienski <Peter.Grabienski@Atheros.com>
Cc: Stephen Chen <Stephen.Chen@Atheros.com>
Cc: Michael Fortin <Michael.Fortin@Atheros.com>
Cc: Johnny Cheng <Johnny.Cheng@Atheros.com>
Cc: Yuan-Gu Wei <Yuan-Gu.Wei@atheros.com>
Cc: Joerg Albert <jal2@gmx.de>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ar9170/usb.c |   28 ++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ar9170/usb.h |    2 ++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 3c97c09..45b5291 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -82,6 +82,10 @@ static struct usb_device_id ar9170_usb_ids[] = {
 	{ USB_DEVICE(0x2019, 0x5304) },
 	/* IO-Data WNGDNUS2 */
 	{ USB_DEVICE(0x04bb, 0x093f) },
+	/* AVM FRITZ!WLAN USB Stick N */
+	{ USB_DEVICE(0x057C, 0x8401) },
+	/* AVM FRITZ!WLAN USB Stick N 2.4 */
+	{ USB_DEVICE(0x057C, 0x8402) },
 
 	/* terminate */
 	{}
@@ -512,6 +516,12 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
 		return 0;
 	}
 
+	if (aru->req_one_stage_fw) {
+		dev_err(&aru->udev->dev, "ar9170.fw firmware file "
+			"not found and is required for this device\n");
+		return -EINVAL;
+	}
+
 	dev_err(&aru->udev->dev, "ar9170.fw firmware file "
 		"not found, trying old firmware...\n");
 
@@ -668,6 +678,22 @@ err_out:
 	return err;
 }
 
+static bool ar9170_requires_one_stage(const struct usb_device_id *id)
+{
+	/* AVM FRITZ only */
+	if (id->idVendor != 0x057C)
+		return false;
+
+	switch (id->idProduct) {
+		case 0x8401: /* AVM FRITZ!WLAN USB Stick N */
+		case 0x8402: /* AVM FRITZ!WLAN USB Stick N 2.4 */
+			return true;
+		default:
+			return false;
+	}
+	return false;
+}
+
 static int ar9170_usb_probe(struct usb_interface *intf,
 			const struct usb_device_id *id)
 {
@@ -688,6 +714,8 @@ static int ar9170_usb_probe(struct usb_interface *intf,
 	aru->intf = intf;
 	ar = &aru->common;
 
+	aru->req_one_stage_fw = ar9170_requires_one_stage(id);
+
 	usb_set_intfdata(intf, aru);
 	SET_IEEE80211_DEV(ar->hw, &udev->dev);
 
diff --git a/drivers/net/wireless/ath/ar9170/usb.h b/drivers/net/wireless/ath/ar9170/usb.h
index ac42586..69f4bce 100644
--- a/drivers/net/wireless/ath/ar9170/usb.h
+++ b/drivers/net/wireless/ath/ar9170/usb.h
@@ -62,6 +62,8 @@ struct ar9170_usb {
 	struct usb_anchor rx_submitted;
 	struct usb_anchor tx_submitted;
 
+	bool req_one_stage_fw;
+
 	spinlock_t cmdlock;
 	struct completion cmd_wait;
 	int readlen;
-- 
1.6.0.6


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

* Re: [RFT 2/2] ar9170: add AVM FRITZ devices
  2009-05-28  1:48 ` [RFT 2/2] ar9170: add AVM FRITZ devices Luis R. Rodriguez
@ 2009-05-28  7:17   ` Marcel Holtmann
  2009-05-28 15:22     ` Pavel Roskin
  0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2009-05-28  7:17 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linux-wireless, jal2, Peter.Grabienski, Stephen.Chen,
	Michael.Fortin, Johnny.Cheng, Yuan-Gu.Wei, otus-devel

Hi Luis,

> This adds:
> 
> USB 0x057C:0x8401       AVM FRITZ!WLAN USB Stick N
> USB 0x057C:0x8402       AVM FRITZ!WLAN USB Stick N 2.4
> 
> These devices require the 1-stage firmware, if not present we
> don't continue.
> 
> Cc: Peter Grabienski <Peter.Grabienski@Atheros.com>
> Cc: Stephen Chen <Stephen.Chen@Atheros.com>
> Cc: Michael Fortin <Michael.Fortin@Atheros.com>
> Cc: Johnny Cheng <Johnny.Cheng@Atheros.com>
> Cc: Yuan-Gu Wei <Yuan-Gu.Wei@atheros.com>
> Cc: Joerg Albert <jal2@gmx.de>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>  drivers/net/wireless/ath/ar9170/usb.c |   28 ++++++++++++++++++++++++++++
>  drivers/net/wireless/ath/ar9170/usb.h |    2 ++
>  2 files changed, 30 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
> index 3c97c09..45b5291 100644
> --- a/drivers/net/wireless/ath/ar9170/usb.c
> +++ b/drivers/net/wireless/ath/ar9170/usb.c
> @@ -82,6 +82,10 @@ static struct usb_device_id ar9170_usb_ids[] = {
>  	{ USB_DEVICE(0x2019, 0x5304) },
>  	/* IO-Data WNGDNUS2 */
>  	{ USB_DEVICE(0x04bb, 0x093f) },
> +	/* AVM FRITZ!WLAN USB Stick N */
> +	{ USB_DEVICE(0x057C, 0x8401) },
> +	/* AVM FRITZ!WLAN USB Stick N 2.4 */
> +	{ USB_DEVICE(0x057C, 0x8402) },
>  
>  	/* terminate */
>  	{}
> @@ -512,6 +516,12 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
>  		return 0;
>  	}
>  
> +	if (aru->req_one_stage_fw) {
> +		dev_err(&aru->udev->dev, "ar9170.fw firmware file "
> +			"not found and is required for this device\n");
> +		return -EINVAL;
> +	}
> +
>  	dev_err(&aru->udev->dev, "ar9170.fw firmware file "
>  		"not found, trying old firmware...\n");
>  
> @@ -668,6 +678,22 @@ err_out:
>  	return err;
>  }
>  
> +static bool ar9170_requires_one_stage(const struct usb_device_id *id)
> +{
> +	/* AVM FRITZ only */
> +	if (id->idVendor != 0x057C)
> +		return false;
> +
> +	switch (id->idProduct) {
> +		case 0x8401: /* AVM FRITZ!WLAN USB Stick N */
> +		case 0x8402: /* AVM FRITZ!WLAN USB Stick N 2.4 */
> +			return true;
> +		default:
> +			return false;
> +	}
> +	return false;
> +}
> +

can't you make this part of use_device_id table? Syncing up with product
ids in two places is not a good idea.

Regards

Marcel



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

* Re: [RFT 2/2] ar9170: add AVM FRITZ devices
  2009-05-28  7:17   ` Marcel Holtmann
@ 2009-05-28 15:22     ` Pavel Roskin
  2009-05-28 19:29       ` Luis R. Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: Pavel Roskin @ 2009-05-28 15:22 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Luis R. Rodriguez, linux-wireless, jal2, Peter.Grabienski,
	Stephen.Chen, Michael.Fortin, Johnny.Cheng, Yuan-Gu.Wei,
	otus-devel

On Thu, 2009-05-28 at 09:17 +0200, Marcel Holtmann wrote:

> can't you make this part of use_device_id table? Syncing up with product
> ids in two places is not a good idea.

It would be even better to use an internal chip ID, an equivalent to the
SREV register in ath5k and ath9k, if it exists in ar9170.

-- 
Regards,
Pavel Roskin

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

* Re: [RFT 1/2] ar9170: add initial support for 1-stage firmware
  2009-05-28  1:48 ` [RFT 1/2] ar9170: add initial support for 1-stage firmware Luis R. Rodriguez
@ 2009-05-28 16:03   ` Christian Lamparter
  2009-05-28 19:26     ` Luis R. Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Lamparter @ 2009-05-28 16:03 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linux-wireless, jal2, Peter.Grabienski, Stephen.Chen,
	Michael.Fortin, Johnny.Cheng, Yuan-Gu.Wei, otus-devel

On Thursday 28 May 2009 03:48:45 Luis R. Rodriguez wrote:
> You can get the stage 1 firmware from here:
> 
> http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/ar9170.fw
> 
> Its license:
> 
> http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/LICENSE
> 
> It seems with some devices this works, with some others
> I see only scan working. We shall not push this firmware
> into the linux-firmware tree until these issues have been
> resolved.
> 
> Cc: Peter Grabienski <Peter.Grabienski@Atheros.com>
> Cc: Stephen Chen <Stephen.Chen@Atheros.com>
> Cc: Michael Fortin <Michael.Fortin@Atheros.com>
> Cc: Johnny Cheng <Johnny.Cheng@Atheros.com>
> Cc: Yuan-Gu Wei <Yuan-Gu.Wei@atheros.com>
> Cc: Joerg Albert <jal2@gmx.de>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>  drivers/net/wireless/ath/ar9170/phy.c |   13 ++++++++++---
>  drivers/net/wireless/ath/ar9170/usb.c |   22 +++++++++++++++++-----
>  2 files changed, 27 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c
> index 6ce2075..0675dc8 100644
> --- a/drivers/net/wireless/ath/ar9170/phy.c
> +++ b/drivers/net/wireless/ath/ar9170/phy.c
> @@ -39,6 +39,7 @@
>  #include <linux/bitrev.h>
>  #include "ar9170.h"
>  #include "cmd.h"
> +#include "usb.h"
>  
>  static int ar9170_init_power_cal(struct ar9170 *ar)
>  {
> @@ -996,6 +997,10 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
>  	int idx, i, n;
>  	u8 ackpower, ackchains, f;
>  	u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS];
> +	struct ar9170_usb *aru;
> +
> +	/* All ar9170 devices are USB */
> +	aru = container_of(ar, struct ar9170_usb, common);
>  
>  	if (freq < 3000)
>  		f = freq - 2300;
> @@ -1102,9 +1107,11 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
>  	else
>  		ackpower = ar->power_5G_leg[0] & 0x3f;
>  
> -	ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
> -	ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
> -				  ackpower << 21 | ackchains << 27);
> +	if (aru->init_values)  {
> +		ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
> +		ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
> +					  ackpower << 21 | ackchains << 27);
> +	}
>  
>  	ar9170_regwrite_finish();
>  	return ar9170_regwrite_result();
I guess you can drop this changes. see hpmain.c line 4039, 4061, 4069

--> #if_N_def ZM_OTUS_LINUX_PHASE_2 <--
zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x2g[0]&0x3f) << 20) | (0x5<<26));
zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x2g[0]&0x3f) << 5 ) | (0x5<<11) |
                                           ((hpPriv->tPow2x2g[0]&0x3f) << 21) | (0x5<<27)  );
#endif

so, the current ar9170 code is actually _wrong_ (but works!)...
and we should not touch these fields with the 2-stage firmware.

OT: since the firmware will (inevitably end up in the firmware-git-tree)
we should convert it to ihex, so it can be downloaded with the git-web.
(this can be done by: objcopy -I binary -O ihex ar9170.fw ar9170.fw.ihex )

And for future: it might be a good idea to add a little header/tail on the
firmware files. e.g.: 
	- firmware version and variant (e.g. 1-stage or 2-stage firmware)
	- supported hardware variants/interfaces
	- maybe API revision / feature bitmap
	- maybe more: e.g: vendor string / build / build-date / build no. etc.

Regards,
	Chr

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

* Re: [RFT 1/2] ar9170: add initial support for 1-stage firmware
  2009-05-28 16:03   ` Christian Lamparter
@ 2009-05-28 19:26     ` Luis R. Rodriguez
  2009-05-28 21:16       ` [otus-devel] " Luis R. Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28 19:26 UTC (permalink / raw)
  To: Christian Lamparter
  Cc: Luis Rodriguez, linux-wireless@vger.kernel.org, jal2@gmx.de,
	Peter Grabienski, Stephen Chen, Michael Fortin, Johnny Cheng,
	Yuan-Gu Wei, otus-devel@lists.madwifi-project.org

On Thu, May 28, 2009 at 09:03:43AM -0700, Christian Lamparter wrote:
> On Thursday 28 May 2009 03:48:45 Luis R. Rodriguez wrote:
> > You can get the stage 1 firmware from here:
> >
> > http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/ar9170.fw
> >
> > Its license:
> >
> > http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170/LICENSE
> >
> > It seems with some devices this works, with some others
> > I see only scan working. We shall not push this firmware
> > into the linux-firmware tree until these issues have been
> > resolved.
> >
> > Cc: Peter Grabienski <Peter.Grabienski@Atheros.com>
> > Cc: Stephen Chen <Stephen.Chen@Atheros.com>
> > Cc: Michael Fortin <Michael.Fortin@Atheros.com>
> > Cc: Johnny Cheng <Johnny.Cheng@Atheros.com>
> > Cc: Yuan-Gu Wei <Yuan-Gu.Wei@atheros.com>
> > Cc: Joerg Albert <jal2@gmx.de>
> > Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> > ---
> >  drivers/net/wireless/ath/ar9170/phy.c |   13 ++++++++++---
> >  drivers/net/wireless/ath/ar9170/usb.c |   22 +++++++++++++++++-----
> >  2 files changed, 27 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath/ar9170/phy.c b/drivers/net/wireless/ath/ar9170/phy.c
> > index 6ce2075..0675dc8 100644
> > --- a/drivers/net/wireless/ath/ar9170/phy.c
> > +++ b/drivers/net/wireless/ath/ar9170/phy.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/bitrev.h>
> >  #include "ar9170.h"
> >  #include "cmd.h"
> > +#include "usb.h"
> >
> >  static int ar9170_init_power_cal(struct ar9170 *ar)
> >  {
> > @@ -996,6 +997,10 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
> >       int idx, i, n;
> >       u8 ackpower, ackchains, f;
> >       u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS];
> > +     struct ar9170_usb *aru;
> > +
> > +     /* All ar9170 devices are USB */
> > +     aru = container_of(ar, struct ar9170_usb, common);
> >
> >       if (freq < 3000)
> >               f = freq - 2300;
> > @@ -1102,9 +1107,11 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
> >       else
> >               ackpower = ar->power_5G_leg[0] & 0x3f;
> >
> > -     ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
> > -     ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
> > -                               ackpower << 21 | ackchains << 27);
> > +     if (aru->init_values)  {
> > +             ar9170_regwrite(0x1c3694, ackpower << 20 | ackchains << 26);
> > +             ar9170_regwrite(0x1c3bb4, ackpower << 5 | ackchains << 11 |
> > +                                       ackpower << 21 | ackchains << 27);
> > +     }
> >
> >       ar9170_regwrite_finish();
> >       return ar9170_regwrite_result();
> I guess you can drop this changes. see hpmain.c line 4039, 4061, 4069
> 
> --> #if_N_def ZM_OTUS_LINUX_PHASE_2 <--
> zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x2g[0]&0x3f) << 20) | (0x5<<26));
> zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x2g[0]&0x3f) << 5 ) | (0x5<<11) |
>                                            ((hpPriv->tPow2x2g[0]&0x3f) << 21) | (0x5<<27)  );
> #endif
> so, the current ar9170 code is actually _wrong_ (but works!)...
> and we should not touch these fields with the 2-stage firmware.

Oh, hm, yeah good catch, but to match would actually need to call it
when stage-1 firmware is used.

> OT: since the firmware will (inevitably end up in the firmware-git-tree)
> we should convert it to ihex, so it can be downloaded with the git-web.
> (this can be done by: objcopy -I binary -O ihex ar9170.fw ar9170.fw.ihex )

Sure, whatever works best. If you download it from gitweb you then
have to do the conversion back though.

> And for future: it might be a good idea to add a little header/tail on the
> firmware files. e.g.:
>         - firmware version and variant (e.g. 1-stage or 2-stage firmware)
>         - supported hardware variants/interfaces
>         - maybe API revision / feature bitmap
>         - maybe more: e.g: vendor string / build / build-date / build no. etc.

I think some version strings exist, but yeah you're right.

  Luis

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

* Re: [RFT 2/2] ar9170: add AVM FRITZ devices
  2009-05-28 15:22     ` Pavel Roskin
@ 2009-05-28 19:29       ` Luis R. Rodriguez
  0 siblings, 0 replies; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28 19:29 UTC (permalink / raw)
  To: Pavel Roskin
  Cc: Marcel Holtmann, Luis Rodriguez, linux-wireless@vger.kernel.org,
	jal2@gmx.de, Peter Grabienski, Stephen Chen, Michael Fortin,
	Johnny Cheng, Yuan-Gu Wei, otus-devel@lists.madwifi-project.org

On Thu, May 28, 2009 at 08:22:38AM -0700, Pavel Roskin wrote:
> On Thu, 2009-05-28 at 09:17 +0200, Marcel Holtmann wrote:
> 
> > can't you make this part of use_device_id table? Syncing up with product
> > ids in two places is not a good idea.

I take it you mean usb_device_id, and sure driver_info.

> It would be even better to use an internal chip ID, an equivalent to the
> SREV register in ath5k and ath9k, if it exists in ar9170.

Not sure if such things exists.

  Luis

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

* Re: [otus-devel] [RFT 1/2] ar9170: add initial support for 1-stage firmware
  2009-05-28 19:26     ` Luis R. Rodriguez
@ 2009-05-28 21:16       ` Luis R. Rodriguez
  0 siblings, 0 replies; 9+ messages in thread
From: Luis R. Rodriguez @ 2009-05-28 21:16 UTC (permalink / raw)
  To: Christian Lamparter
  Cc: otus-devel@lists.madwifi-project.org, Yuan-Gu Wei, Johnny Cheng,
	Stephen Chen, linux-wireless@vger.kernel.org, Peter Grabienski,
	Michael Fortin, Luis Rodriguez

On Thu, May 28, 2009 at 12:26 PM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> On Thu, May 28, 2009 at 09:03:43AM -0700, Christian Lamparter wrote:

>> --> #if_N_def ZM_OTUS_LINUX_PHASE_2 <--
>> zfDelayWriteInternalReg(dev, 0x1c3694, ((hpPriv->tPow2x2g[0]&0x3f) << 20) | (0x5<<26));
>> zfDelayWriteInternalReg(dev, 0x1c3bb4, ((hpPriv->tPow2x2g[0]&0x3f) << 5 ) | (0x5<<11) |
>>                                            ((hpPriv->tPow2x2g[0]&0x3f) << 21) | (0x5<<27)  );
>> #endif
>> so, the current ar9170 code is actually _wrong_ (but works!)...
>> and we should not touch these fields with the 2-stage firmware.
>
> Oh, hm, yeah good catch, but to match would actually need to call it
> when stage-1 firmware is used.
>
>> OT: since the firmware will (inevitably end up in the firmware-git-tree)
>> we should convert it to ihex, so it can be downloaded with the git-web.
>> (this can be done by: objcopy -I binary -O ihex ar9170.fw ar9170.fw.ihex )
>
> Sure, whatever works best. If you download it from gitweb you then
> have to do the conversion back though.

I noticed some difference in performance wit this removed so I think
for now its best to leave it in for both -- it seems this sets the ACK
power.

  Luis

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

end of thread, other threads:[~2009-05-28 21:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28  1:48 [RFT 0/2] ar9170: initial stage 1 firmware support / AVM fritz Luis R. Rodriguez
2009-05-28  1:48 ` [RFT 1/2] ar9170: add initial support for 1-stage firmware Luis R. Rodriguez
2009-05-28 16:03   ` Christian Lamparter
2009-05-28 19:26     ` Luis R. Rodriguez
2009-05-28 21:16       ` [otus-devel] " Luis R. Rodriguez
2009-05-28  1:48 ` [RFT 2/2] ar9170: add AVM FRITZ devices Luis R. Rodriguez
2009-05-28  7:17   ` Marcel Holtmann
2009-05-28 15:22     ` Pavel Roskin
2009-05-28 19:29       ` Luis R. Rodriguez

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).