diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-10-07 17:23:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:47:47 -0400 |
commit | 3414fc3f527ce74cfca543c37bcb52c8e63b915e (patch) | |
tree | fbf1f09666e9a9f2cbb0c65cebadc401bb4a6ba4 /drivers/net/wireless/orinoco | |
parent | 6226811f4eec35c509b931ac900ac074336103f5 (diff) |
orinoco: use cfg80211 ethtool ops
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco')
-rw-r--r-- | drivers/net/wireless/orinoco/hw.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/hw.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco.h | 1 |
4 files changed, 32 insertions, 38 deletions
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 359652d35e63..404830f47ab2 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -60,8 +60,15 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id) | |||
60 | /* Set priv->firmware type, determine firmware properties | 60 | /* Set priv->firmware type, determine firmware properties |
61 | * This function can be called before we have registerred with netdev, | 61 | * This function can be called before we have registerred with netdev, |
62 | * so all errors go out with dev_* rather than printk | 62 | * so all errors go out with dev_* rather than printk |
63 | * | ||
64 | * If non-NULL stores a firmware description in fw_name. | ||
65 | * If non-NULL stores a HW version in hw_ver | ||
66 | * | ||
67 | * These are output via generic cfg80211 ethtool support. | ||
63 | */ | 68 | */ |
64 | int determine_fw_capabilities(struct orinoco_private *priv) | 69 | int determine_fw_capabilities(struct orinoco_private *priv, |
70 | char *fw_name, size_t fw_name_len, | ||
71 | u32 *hw_ver) | ||
65 | { | 72 | { |
66 | struct device *dev = priv->dev; | 73 | struct device *dev = priv->dev; |
67 | hermes_t *hw = &priv->hw; | 74 | hermes_t *hw = &priv->hw; |
@@ -85,6 +92,12 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
85 | dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", | 92 | dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", |
86 | nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); | 93 | nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); |
87 | 94 | ||
95 | if (hw_ver) | ||
96 | *hw_ver = (((nic_id.id & 0xff) << 24) | | ||
97 | ((nic_id.variant & 0xff) << 16) | | ||
98 | ((nic_id.major & 0xff) << 8) | | ||
99 | (nic_id.minor & 0xff)); | ||
100 | |||
88 | priv->firmware_type = determine_firmware_type(&nic_id); | 101 | priv->firmware_type = determine_firmware_type(&nic_id); |
89 | 102 | ||
90 | /* Get the firmware version */ | 103 | /* Get the firmware version */ |
@@ -135,8 +148,9 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
135 | case FIRMWARE_TYPE_AGERE: | 148 | case FIRMWARE_TYPE_AGERE: |
136 | /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, | 149 | /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, |
137 | ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ | 150 | ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ |
138 | snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, | 151 | if (fw_name) |
139 | "Lucent/Agere %d.%02d", sta_id.major, sta_id.minor); | 152 | snprintf(fw_name, fw_name_len, "Lucent/Agere %d.%02d", |
153 | sta_id.major, sta_id.minor); | ||
140 | 154 | ||
141 | firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor; | 155 | firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor; |
142 | 156 | ||
@@ -185,8 +199,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
185 | tmp[SYMBOL_MAX_VER_LEN] = '\0'; | 199 | tmp[SYMBOL_MAX_VER_LEN] = '\0'; |
186 | } | 200 | } |
187 | 201 | ||
188 | snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, | 202 | if (fw_name) |
189 | "Symbol %s", tmp); | 203 | snprintf(fw_name, fw_name_len, "Symbol %s", tmp); |
190 | 204 | ||
191 | priv->has_ibss = (firmver >= 0x20000); | 205 | priv->has_ibss = (firmver >= 0x20000); |
192 | priv->has_wep = (firmver >= 0x15012); | 206 | priv->has_wep = (firmver >= 0x15012); |
@@ -224,9 +238,9 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
224 | * different and less well tested */ | 238 | * different and less well tested */ |
225 | /* D-Link MAC : 00:40:05:* */ | 239 | /* D-Link MAC : 00:40:05:* */ |
226 | /* Addtron MAC : 00:90:D1:* */ | 240 | /* Addtron MAC : 00:90:D1:* */ |
227 | snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, | 241 | if (fw_name) |
228 | "Intersil %d.%d.%d", sta_id.major, sta_id.minor, | 242 | snprintf(fw_name, fw_name_len, "Intersil %d.%d.%d", |
229 | sta_id.variant); | 243 | sta_id.major, sta_id.minor, sta_id.variant); |
230 | 244 | ||
231 | firmver = ((unsigned long)sta_id.major << 16) | | 245 | firmver = ((unsigned long)sta_id.major << 16) | |
232 | ((unsigned long)sta_id.minor << 8) | sta_id.variant; | 246 | ((unsigned long)sta_id.minor << 8) | sta_id.variant; |
@@ -245,7 +259,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
245 | } | 259 | } |
246 | break; | 260 | break; |
247 | } | 261 | } |
248 | dev_info(dev, "Firmware determined as %s\n", priv->fw_name); | 262 | if (fw_name) |
263 | dev_info(dev, "Firmware determined as %s\n", fw_name); | ||
249 | 264 | ||
250 | return 0; | 265 | return 0; |
251 | } | 266 | } |
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h index 8df6e8752be6..e2f7fdc4d45a 100644 --- a/drivers/net/wireless/orinoco/hw.h +++ b/drivers/net/wireless/orinoco/hw.h | |||
@@ -24,7 +24,8 @@ | |||
24 | struct orinoco_private; | 24 | struct orinoco_private; |
25 | struct dev_addr_list; | 25 | struct dev_addr_list; |
26 | 26 | ||
27 | int determine_fw_capabilities(struct orinoco_private *priv); | 27 | int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name, |
28 | size_t fw_name_len, u32 *hw_ver); | ||
28 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); | 29 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); |
29 | int orinoco_hw_allocate_fid(struct orinoco_private *priv); | 30 | int orinoco_hw_allocate_fid(struct orinoco_private *priv); |
30 | int orinoco_get_bitratemode(int bitrate, int automatic); | 31 | int orinoco_get_bitratemode(int bitrate, int automatic); |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 5fdc59c594f2..753a1804eee7 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -83,7 +83,6 @@ | |||
83 | #include <linux/device.h> | 83 | #include <linux/device.h> |
84 | #include <linux/netdevice.h> | 84 | #include <linux/netdevice.h> |
85 | #include <linux/etherdevice.h> | 85 | #include <linux/etherdevice.h> |
86 | #include <linux/ethtool.h> | ||
87 | #include <linux/suspend.h> | 86 | #include <linux/suspend.h> |
88 | #include <linux/if_arp.h> | 87 | #include <linux/if_arp.h> |
89 | #include <linux/wireless.h> | 88 | #include <linux/wireless.h> |
@@ -162,8 +161,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; | |||
162 | | HERMES_EV_WTERR | HERMES_EV_INFO \ | 161 | | HERMES_EV_WTERR | HERMES_EV_INFO \ |
163 | | HERMES_EV_INFDROP) | 162 | | HERMES_EV_INFDROP) |
164 | 163 | ||
165 | static const struct ethtool_ops orinoco_ethtool_ops; | ||
166 | |||
167 | /********************************************************************/ | 164 | /********************************************************************/ |
168 | /* Data types */ | 165 | /* Data types */ |
169 | /********************************************************************/ | 166 | /********************************************************************/ |
@@ -1994,7 +1991,9 @@ int orinoco_init(struct orinoco_private *priv) | |||
1994 | goto out; | 1991 | goto out; |
1995 | } | 1992 | } |
1996 | 1993 | ||
1997 | err = determine_fw_capabilities(priv); | 1994 | err = determine_fw_capabilities(priv, wiphy->fw_version, |
1995 | sizeof(wiphy->fw_version), | ||
1996 | &wiphy->hw_version); | ||
1998 | if (err != 0) { | 1997 | if (err != 0) { |
1999 | dev_err(dev, "Incompatible firmware, aborting\n"); | 1998 | dev_err(dev, "Incompatible firmware, aborting\n"); |
2000 | goto out; | 1999 | goto out; |
@@ -2010,7 +2009,9 @@ int orinoco_init(struct orinoco_private *priv) | |||
2010 | priv->do_fw_download = 0; | 2009 | priv->do_fw_download = 0; |
2011 | 2010 | ||
2012 | /* Check firmware version again */ | 2011 | /* Check firmware version again */ |
2013 | err = determine_fw_capabilities(priv); | 2012 | err = determine_fw_capabilities(priv, wiphy->fw_version, |
2013 | sizeof(wiphy->fw_version), | ||
2014 | &wiphy->hw_version); | ||
2014 | if (err != 0) { | 2015 | if (err != 0) { |
2015 | dev_err(dev, "Incompatible firmware, aborting\n"); | 2016 | dev_err(dev, "Incompatible firmware, aborting\n"); |
2016 | goto out; | 2017 | goto out; |
@@ -2212,7 +2213,6 @@ int orinoco_if_add(struct orinoco_private *priv, | |||
2212 | dev->ieee80211_ptr = wdev; | 2213 | dev->ieee80211_ptr = wdev; |
2213 | dev->netdev_ops = &orinoco_netdev_ops; | 2214 | dev->netdev_ops = &orinoco_netdev_ops; |
2214 | dev->watchdog_timeo = HZ; /* 1 second timeout */ | 2215 | dev->watchdog_timeo = HZ; /* 1 second timeout */ |
2215 | dev->ethtool_ops = &orinoco_ethtool_ops; | ||
2216 | dev->wireless_handlers = &orinoco_handler_def; | 2216 | dev->wireless_handlers = &orinoco_handler_def; |
2217 | #ifdef WIRELESS_SPY | 2217 | #ifdef WIRELESS_SPY |
2218 | dev->wireless_data = &priv->wireless_data; | 2218 | dev->wireless_data = &priv->wireless_data; |
@@ -2349,27 +2349,6 @@ void orinoco_down(struct orinoco_private *priv) | |||
2349 | } | 2349 | } |
2350 | EXPORT_SYMBOL(orinoco_down); | 2350 | EXPORT_SYMBOL(orinoco_down); |
2351 | 2351 | ||
2352 | static void orinoco_get_drvinfo(struct net_device *dev, | ||
2353 | struct ethtool_drvinfo *info) | ||
2354 | { | ||
2355 | struct orinoco_private *priv = ndev_priv(dev); | ||
2356 | |||
2357 | strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); | ||
2358 | strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1); | ||
2359 | strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1); | ||
2360 | if (dev->dev.parent) | ||
2361 | strncpy(info->bus_info, dev_name(dev->dev.parent), | ||
2362 | sizeof(info->bus_info) - 1); | ||
2363 | else | ||
2364 | snprintf(info->bus_info, sizeof(info->bus_info) - 1, | ||
2365 | "PCMCIA %p", priv->hw.iobase); | ||
2366 | } | ||
2367 | |||
2368 | static const struct ethtool_ops orinoco_ethtool_ops = { | ||
2369 | .get_drvinfo = orinoco_get_drvinfo, | ||
2370 | .get_link = ethtool_op_get_link, | ||
2371 | }; | ||
2372 | |||
2373 | /********************************************************************/ | 2352 | /********************************************************************/ |
2374 | /* Module initialization */ | 2353 | /* Module initialization */ |
2375 | /********************************************************************/ | 2354 | /********************************************************************/ |
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h index 9ac6f1dda4b0..665ef56f8382 100644 --- a/drivers/net/wireless/orinoco/orinoco.h +++ b/drivers/net/wireless/orinoco/orinoco.h | |||
@@ -93,7 +93,6 @@ struct orinoco_private { | |||
93 | 93 | ||
94 | /* Capabilities of the hardware/firmware */ | 94 | /* Capabilities of the hardware/firmware */ |
95 | fwtype_t firmware_type; | 95 | fwtype_t firmware_type; |
96 | char fw_name[32]; | ||
97 | int ibss_port; | 96 | int ibss_port; |
98 | int nicbuf_size; | 97 | int nicbuf_size; |
99 | u16 channel_mask; | 98 | u16 channel_mask; |