diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-06-18 18:21:19 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:43 -0400 |
commit | e9e3d0100eae5f254024bd59229ef1be2b719b84 (patch) | |
tree | 61baee2156fa2756b39e1c3de1fbdf8b608e9d46 /drivers/net/wireless/orinoco/main.c | |
parent | a2d1a42a4b44c97fb83c5bf53af8cd6ab4c6c110 (diff) |
orinoco: Move card reading code into hw.c
This is part of refactorring the initialisation code so that we can
load the firmware before registerring with netdev.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/main.c')
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 102 |
1 files changed, 2 insertions, 100 deletions
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 33326d6ef815..0fe9420c4905 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -2100,9 +2100,6 @@ static int orinoco_init(struct net_device *dev) | |||
2100 | struct orinoco_private *priv = netdev_priv(dev); | 2100 | struct orinoco_private *priv = netdev_priv(dev); |
2101 | hermes_t *hw = &priv->hw; | 2101 | hermes_t *hw = &priv->hw; |
2102 | int err = 0; | 2102 | int err = 0; |
2103 | struct hermes_idstring nickbuf; | ||
2104 | u16 reclen; | ||
2105 | int len; | ||
2106 | 2103 | ||
2107 | /* No need to lock, the hw_unavailable flag is already set in | 2104 | /* No need to lock, the hw_unavailable flag is already set in |
2108 | * alloc_orinocodev() */ | 2105 | * alloc_orinocodev() */ |
@@ -2166,34 +2163,9 @@ static int orinoco_init(struct net_device *dev) | |||
2166 | goto out; | 2163 | goto out; |
2167 | orinoco_bss_data_init(priv); | 2164 | orinoco_bss_data_init(priv); |
2168 | 2165 | ||
2169 | /* Get the MAC address */ | 2166 | err = orinoco_hw_read_card_settings(priv, dev->dev_addr); |
2170 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, | 2167 | if (err) |
2171 | ETH_ALEN, NULL, dev->dev_addr); | ||
2172 | if (err) { | ||
2173 | printk(KERN_WARNING "%s: failed to read MAC address!\n", | ||
2174 | dev->name); | ||
2175 | goto out; | ||
2176 | } | ||
2177 | |||
2178 | printk(KERN_DEBUG "%s: MAC address %pM\n", | ||
2179 | dev->name, dev->dev_addr); | ||
2180 | |||
2181 | /* Get the station name */ | ||
2182 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, | ||
2183 | sizeof(nickbuf), &reclen, &nickbuf); | ||
2184 | if (err) { | ||
2185 | printk(KERN_ERR "%s: failed to read station name\n", | ||
2186 | dev->name); | ||
2187 | goto out; | 2168 | goto out; |
2188 | } | ||
2189 | if (nickbuf.len) | ||
2190 | len = min(IW_ESSID_MAX_SIZE, (int)le16_to_cpu(nickbuf.len)); | ||
2191 | else | ||
2192 | len = min(IW_ESSID_MAX_SIZE, 2 * reclen); | ||
2193 | memcpy(priv->nick, &nickbuf.val, len); | ||
2194 | priv->nick[len] = '\0'; | ||
2195 | |||
2196 | printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick); | ||
2197 | 2169 | ||
2198 | err = orinoco_allocate_fid(dev); | 2170 | err = orinoco_allocate_fid(dev); |
2199 | if (err) { | 2171 | if (err) { |
@@ -2202,76 +2174,6 @@ static int orinoco_init(struct net_device *dev) | |||
2202 | goto out; | 2174 | goto out; |
2203 | } | 2175 | } |
2204 | 2176 | ||
2205 | /* Get allowed channels */ | ||
2206 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, | ||
2207 | &priv->channel_mask); | ||
2208 | if (err) { | ||
2209 | printk(KERN_ERR "%s: failed to read channel list!\n", | ||
2210 | dev->name); | ||
2211 | goto out; | ||
2212 | } | ||
2213 | |||
2214 | /* Get initial AP density */ | ||
2215 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE, | ||
2216 | &priv->ap_density); | ||
2217 | if (err || priv->ap_density < 1 || priv->ap_density > 3) | ||
2218 | priv->has_sensitivity = 0; | ||
2219 | |||
2220 | /* Get initial RTS threshold */ | ||
2221 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD, | ||
2222 | &priv->rts_thresh); | ||
2223 | if (err) { | ||
2224 | printk(KERN_ERR "%s: failed to read RTS threshold!\n", | ||
2225 | dev->name); | ||
2226 | goto out; | ||
2227 | } | ||
2228 | |||
2229 | /* Get initial fragmentation settings */ | ||
2230 | if (priv->has_mwo) | ||
2231 | err = hermes_read_wordrec(hw, USER_BAP, | ||
2232 | HERMES_RID_CNFMWOROBUST_AGERE, | ||
2233 | &priv->mwo_robust); | ||
2234 | else | ||
2235 | err = hermes_read_wordrec(hw, USER_BAP, | ||
2236 | HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, | ||
2237 | &priv->frag_thresh); | ||
2238 | if (err) { | ||
2239 | printk(KERN_ERR "%s: failed to read fragmentation settings!\n", | ||
2240 | dev->name); | ||
2241 | goto out; | ||
2242 | } | ||
2243 | |||
2244 | /* Power management setup */ | ||
2245 | if (priv->has_pm) { | ||
2246 | priv->pm_on = 0; | ||
2247 | priv->pm_mcast = 1; | ||
2248 | err = hermes_read_wordrec(hw, USER_BAP, | ||
2249 | HERMES_RID_CNFMAXSLEEPDURATION, | ||
2250 | &priv->pm_period); | ||
2251 | if (err) { | ||
2252 | printk(KERN_ERR "%s: failed to read power management period!\n", | ||
2253 | dev->name); | ||
2254 | goto out; | ||
2255 | } | ||
2256 | err = hermes_read_wordrec(hw, USER_BAP, | ||
2257 | HERMES_RID_CNFPMHOLDOVERDURATION, | ||
2258 | &priv->pm_timeout); | ||
2259 | if (err) { | ||
2260 | printk(KERN_ERR "%s: failed to read power management timeout!\n", | ||
2261 | dev->name); | ||
2262 | goto out; | ||
2263 | } | ||
2264 | } | ||
2265 | |||
2266 | /* Preamble setup */ | ||
2267 | if (priv->has_preamble) { | ||
2268 | err = hermes_read_wordrec(hw, USER_BAP, | ||
2269 | HERMES_RID_CNFPREAMBLE_SYMBOL, | ||
2270 | &priv->preamble); | ||
2271 | if (err) | ||
2272 | goto out; | ||
2273 | } | ||
2274 | |||
2275 | /* Set up the default configuration */ | 2177 | /* Set up the default configuration */ |
2276 | priv->iw_mode = IW_MODE_INFRA; | 2178 | priv->iw_mode = IW_MODE_INFRA; |
2277 | /* By default use IEEE/IBSS ad-hoc mode if we have it */ | 2179 | /* By default use IEEE/IBSS ad-hoc mode if we have it */ |