From: kilroyd@googlemail.com
To: linux-wireless@vger.kernel.org
Cc: proski@gnu.org, orinoco-devel@lists.sourceforge.net,
David Kilroy <kilroyd@gmail.com>
Subject: [RFC PATCH 05/19] orinoco: Add function to execute Hermes initialisation commands synchronously
Date: Sat, 28 Jun 2008 19:38:11 +0100 [thread overview]
Message-ID: <1214678305-7057-6-git-send-email-kilroyd@gmail.com> (raw)
In-Reply-To: <1214678305-7057-5-git-send-email-kilroyd@gmail.com>
The current synchronous execution function doesn't work
for certain Hermes commands which clear the MAGIC number from
SWSUPPORT0. These commands seem to be related to initialisation or
programming, for example HERMES_CMD_INIT.
Replicate hermes_docmd_wait for commands which clear the MAGIC number
from SWSUPPORT0. This version accepts two extra arguments which are
passed straight to the firmware.
Functionality copied out of hermes_init.
Signed-off-by: David Kilroy <kilroyd@gmail.com>
---
drivers/net/wireless/hermes.c | 94 +++++++++++++++++++++++++----------------
drivers/net/wireless/hermes.h | 3 +
2 files changed, 60 insertions(+), 37 deletions(-)
diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c
index aa95349..13072d0 100644
--- a/drivers/net/wireless/hermes.c
+++ b/drivers/net/wireless/hermes.c
@@ -116,6 +116,61 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
* Function definitions
*/
+/* For doing cmds that wipe the magic constant in SWSUPPORT0 */
+int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
+ u16 parm0, u16 parm1, u16 parm2,
+ struct hermes_response *resp)
+{
+ int err = 0;
+ int k;
+ u16 status, reg;
+
+ err = hermes_issue_cmd(hw, cmd, parm0, parm1, parm2);
+ if (err)
+ return err;
+
+ reg = hermes_read_regn(hw, EVSTAT);
+ k = CMD_INIT_TIMEOUT;
+ while ((!(reg & HERMES_EV_CMD)) && k) {
+ k--;
+ udelay(10);
+ reg = hermes_read_regn(hw, EVSTAT);
+ }
+
+ hermes_write_regn(hw, SWSUPPORT0, HERMES_MAGIC);
+
+ if (!hermes_present(hw)) {
+ DEBUG(0, "hermes @ 0x%x: Card removed during reset.\n",
+ hw->iobase);
+ err = -ENODEV;
+ goto out;
+ }
+
+ if (!(reg & HERMES_EV_CMD)) {
+ printk(KERN_ERR "hermes @ %p: "
+ "Timeout waiting for card to reset (reg=0x%04x)!\n",
+ hw->iobase, reg);
+ err = -ETIMEDOUT;
+ goto out;
+ }
+
+ status = hermes_read_regn(hw, STATUS);
+ if (resp) {
+ resp->status = status;
+ resp->resp0 = hermes_read_regn(hw, RESP0);
+ resp->resp1 = hermes_read_regn(hw, RESP1);
+ resp->resp2 = hermes_read_regn(hw, RESP2);
+ }
+
+ hermes_write_regn(hw, EVACK, HERMES_EV_CMD);
+
+ if (status & HERMES_STATUS_RESULT)
+ err = -EIO;
+out:
+ return err;
+}
+EXPORT_SYMBOL(hermes_doicmd_wait);
+
void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
{
hw->iobase = address;
@@ -126,7 +181,7 @@ EXPORT_SYMBOL(hermes_struct_init);
int hermes_init(hermes_t *hw)
{
- u16 status, reg;
+ u16 reg;
int err = 0;
int k;
@@ -164,43 +219,8 @@ int hermes_init(hermes_t *hw)
/* We don't use hermes_docmd_wait here, because the reset wipes
the magic constant in SWSUPPORT0 away, and it gets confused */
- err = hermes_issue_cmd(hw, HERMES_CMD_INIT, 0, 0, 0);
- if (err)
- return err;
-
- reg = hermes_read_regn(hw, EVSTAT);
- k = CMD_INIT_TIMEOUT;
- while ( (! (reg & HERMES_EV_CMD)) && k) {
- k--;
- udelay(10);
- reg = hermes_read_regn(hw, EVSTAT);
- }
-
- hermes_write_regn(hw, SWSUPPORT0, HERMES_MAGIC);
-
- if (! hermes_present(hw)) {
- DEBUG(0, "hermes @ 0x%x: Card removed during reset.\n",
- hw->iobase);
- err = -ENODEV;
- goto out;
- }
-
- if (! (reg & HERMES_EV_CMD)) {
- printk(KERN_ERR "hermes @ %p: "
- "Timeout waiting for card to reset (reg=0x%04x)!\n",
- hw->iobase, reg);
- err = -ETIMEDOUT;
- goto out;
- }
-
- status = hermes_read_regn(hw, STATUS);
-
- hermes_write_regn(hw, EVACK, HERMES_EV_CMD);
+ err = hermes_doicmd_wait(hw, HERMES_CMD_INIT, 0, 0, 0, NULL);
- if (status & HERMES_STATUS_RESULT)
- err = -EIO;
-
- out:
return err;
}
EXPORT_SYMBOL(hermes_init);
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
index 8e3f0e3..287f536 100644
--- a/drivers/net/wireless/hermes.h
+++ b/drivers/net/wireless/hermes.h
@@ -353,6 +353,9 @@ void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
int hermes_init(hermes_t *hw);
int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
struct hermes_response *resp);
+int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
+ u16 parm0, u16 parm1, u16 parm2,
+ struct hermes_response *resp);
int hermes_allocate(hermes_t *hw, u16 size, u16 *fid);
int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
--
1.5.4.5
next prev parent reply other threads:[~2008-06-28 18:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-28 18:38 [RFC PATCH 00/19] orinoco: WPA for Agere based cards kilroyd
2008-06-28 18:38 ` [RFC PATCH 01/19] orinoco: Add ESSID specific scanning for Agere fw kilroyd
2008-06-28 18:38 ` [RFC PATCH 02/19] orinoco: Update scan translation kilroyd
2008-06-28 18:38 ` [RFC PATCH 03/19] orinoco: Specify all three parameters to every Hermes command kilroyd
2008-06-28 18:38 ` [RFC PATCH 04/19] orinoco: Move EXPORT_SYMBOL declarations next to exported function kilroyd
2008-06-28 18:38 ` kilroyd [this message]
2008-06-28 18:38 ` [RFC PATCH 06/19] orinoco: Move firmware download functionality into new module kilroyd
2008-06-28 18:38 ` [RFC PATCH 07/19] orinoco: Make firmware download logic more generic kilroyd
2008-06-28 18:38 ` [RFC PATCH 08/19] orinoco: Extend hermes_dld routines for Agere firmware kilroyd
2008-06-28 18:38 ` [RFC PATCH 09/19] orinoco: Invoke firmware download in main driver kilroyd
2008-06-28 18:38 ` [RFC PATCH 10/19] orinoco: Fix transmit for Agere/Lucent with fw 9.x kilroyd
2008-06-28 18:38 ` [RFC PATCH 11/19] orinoco: address checkpatch typedef warning kilroyd
2008-06-28 18:38 ` [RFC PATCH 12/19] orinoco: Use extended Agere scans available on 9.x series firmwares kilroyd
2008-06-28 18:38 ` [RFC PATCH 13/19] orinoco: Don't use boolean parameter to record encoding type kilroyd
2008-06-28 18:38 ` [RFC PATCH 14/19] orinoco: Split wevent work thread from wevent sending kilroyd
2008-06-28 18:38 ` [RFC PATCH 15/19] orinoco: Use a macro to define wireless handlers kilroyd
2008-06-28 18:38 ` [RFC PATCH 16/19] orinoco: Add WE-18 ioctls for WPA kilroyd
2008-06-28 18:38 ` [RFC PATCH 17/19] orinoco: Send association events to userspace kilroyd
2008-06-28 18:38 ` [RFC PATCH 18/19] orinoco: Process bulk of receive interrupt in a tasklet kilroyd
2008-06-28 18:38 ` [RFC PATCH 19/19] orinoco: Add MIC on TX and check on RX kilroyd
2008-06-29 21:56 ` Harvey Harrison
2008-06-30 11:06 ` Johannes Berg
2008-06-30 18:09 ` Dave
2008-06-30 19:28 ` [RFC PATCH 00/19] orinoco: WPA for Agere based cards John W. Linville
2008-06-30 20:16 ` Dave
2008-08-01 23:49 ` [Orinoco-devel] " Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1214678305-7057-6-git-send-email-kilroyd@gmail.com \
--to=kilroyd@googlemail.com \
--cc=kilroyd@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=orinoco-devel@lists.sourceforge.net \
--cc=proski@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).