aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/ethtool.c')
-rw-r--r--drivers/net/wireless/libertas/ethtool.c77
1 files changed, 22 insertions, 55 deletions
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 21e6f988ea81..dcfdb404678b 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -6,7 +6,6 @@
6#include "decl.h" 6#include "decl.h"
7#include "defs.h" 7#include "defs.h"
8#include "dev.h" 8#include "dev.h"
9#include "join.h"
10#include "wext.h" 9#include "wext.h"
11#include "cmd.h" 10#include "cmd.h"
12 11
@@ -25,13 +24,14 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev,
25 struct ethtool_drvinfo *info) 24 struct ethtool_drvinfo *info)
26{ 25{
27 struct lbs_private *priv = (struct lbs_private *) dev->priv; 26 struct lbs_private *priv = (struct lbs_private *) dev->priv;
28 char fwver[32];
29
30 lbs_get_fwversion(priv, fwver, sizeof(fwver) - 1);
31 27
28 snprintf(info->fw_version, 32, "%u.%u.%u.p%u",
29 priv->fwrelease >> 24 & 0xff,
30 priv->fwrelease >> 16 & 0xff,
31 priv->fwrelease >> 8 & 0xff,
32 priv->fwrelease & 0xff);
32 strcpy(info->driver, "libertas"); 33 strcpy(info->driver, "libertas");
33 strcpy(info->version, lbs_driver_version); 34 strcpy(info->version, lbs_driver_version);
34 strcpy(info->fw_version, fwver);
35} 35}
36 36
37/* All 8388 parts have 16KiB EEPROM size at the time of writing. 37/* All 8388 parts have 16KiB EEPROM size at the time of writing.
@@ -48,61 +48,28 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
48 struct ethtool_eeprom *eeprom, u8 * bytes) 48 struct ethtool_eeprom *eeprom, u8 * bytes)
49{ 49{
50 struct lbs_private *priv = (struct lbs_private *) dev->priv; 50 struct lbs_private *priv = (struct lbs_private *) dev->priv;
51 struct lbs_ioctl_regrdwr regctrl; 51 struct cmd_ds_802_11_eeprom_access cmd;
52 char *ptr;
53 int ret; 52 int ret;
54 53
55 regctrl.action = 0; 54 lbs_deb_enter(LBS_DEB_ETHTOOL);
56 regctrl.offset = eeprom->offset;
57 regctrl.NOB = eeprom->len;
58
59 if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN)
60 return -EINVAL;
61
62// mutex_lock(&priv->mutex);
63
64 priv->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
65 if (!priv->prdeeprom)
66 return -ENOMEM;
67 memcpy(priv->prdeeprom, &regctrl, sizeof(regctrl));
68
69 /* +14 is for action, offset, and NOB in
70 * response */
71 lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
72 regctrl.action, regctrl.offset, regctrl.NOB);
73 55
74 ret = lbs_prepare_and_send_command(priv, 56 if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN ||
75 CMD_802_11_EEPROM_ACCESS, 57 eeprom->len > LBS_EEPROM_READ_LEN) {
76 regctrl.action, 58 ret = -EINVAL;
77 CMD_OPTION_WAITFORRSP, 0, 59 goto out;
78 &regctrl);
79
80 if (ret) {
81 if (priv->prdeeprom)
82 kfree(priv->prdeeprom);
83 goto done;
84 } 60 }
85 61
86 mdelay(10); 62 cmd.hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) -
87 63 LBS_EEPROM_READ_LEN + eeprom->len);
88 ptr = (char *)priv->prdeeprom; 64 cmd.action = cpu_to_le16(CMD_ACT_GET);
89 65 cmd.offset = cpu_to_le16(eeprom->offset);
90 /* skip the command header, but include the "value" u32 variable */ 66 cmd.len = cpu_to_le16(eeprom->len);
91 ptr = ptr + sizeof(struct lbs_ioctl_regrdwr) - 4; 67 ret = lbs_cmd_with_response(priv, CMD_802_11_EEPROM_ACCESS, &cmd);
92 68 if (!ret)
93 /* 69 memcpy(bytes, cmd.value, eeprom->len);
94 * Return the result back to the user 70
95 */ 71out:
96 memcpy(bytes, ptr, eeprom->len); 72 lbs_deb_leave_args(LBS_DEB_ETHTOOL, "ret %d", ret);
97
98 if (priv->prdeeprom)
99 kfree(priv->prdeeprom);
100// mutex_unlock(&priv->mutex);
101
102 ret = 0;
103
104done:
105 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
106 return ret; 73 return ret;
107} 74}
108 75