aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-08-27 06:00:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:02:27 -0400
commit94831463690c2a1bab2bcb9d6637e469b63d5536 (patch)
treed5f7dde01fd2d79e71862b9b7b047e1d00ddf89b
parentc2557177f16cc0b63115a1ea09c732e3ace14d5f (diff)
Staging: et131x: attack the config stuff
Prune this back as most of it isn't relevant or used Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/et131x/et131x_adapter.h2
-rw-r--r--drivers/staging/et131x/et131x_config.c110
-rw-r--r--drivers/staging/et131x/et131x_initpci.c7
3 files changed, 23 insertions, 96 deletions
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index bbbada027cd0..63d7c8afada8 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -256,8 +256,6 @@ struct et131x_adapter {
256 u8 RegistryPhyComa; /* Phy Coma mode enable/disable */ 256 u8 RegistryPhyComa; /* Phy Coma mode enable/disable */
257 257
258 u32 RegistryRxMemEnd; /* Size of internal rx memory */ 258 u32 RegistryRxMemEnd; /* Size of internal rx memory */
259 u8 RegistryMACStat; /* If set, read MACSTAT, else don't */
260 u32 RegistryVlanTag; /* 802.1q Vlan TAG */
261 u32 RegistryJumboPacket; /* Max supported ethernet packet size */ 259 u32 RegistryJumboPacket; /* Max supported ethernet packet size */
262 260
263 /* Validation helpers */ 261 /* Validation helpers */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index a31f82aea0e3..358e6f699356 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -105,22 +105,10 @@ extern dbg_info_t *et131x_dbginfo;
105#define PARM_SPEED_DUPLEX_MIN 0 105#define PARM_SPEED_DUPLEX_MIN 0
106#define PARM_SPEED_DUPLEX_MAX 5 106#define PARM_SPEED_DUPLEX_MAX 5
107 107
108#define PARM_VLAN_TAG_DEF 0
109#define PARM_VLAN_TAG_MIN 0
110#define PARM_VLAN_TAG_MAX 4095
111
112#define PARM_FLOW_CTL_DEF 0 108#define PARM_FLOW_CTL_DEF 0
113#define PARM_FLOW_CTL_MIN 0 109#define PARM_FLOW_CTL_MIN 0
114#define PARM_FLOW_CTL_MAX 3 110#define PARM_FLOW_CTL_MAX 3
115 111
116#define PARM_WOL_LINK_DEF 3
117#define PARM_WOL_LINK_MIN 0
118#define PARM_WOL_LINK_MAX 3
119
120#define PARM_WOL_MATCH_DEF 7
121#define PARM_WOL_MATCH_MIN 0
122#define PARM_WOL_MATCH_MAX 7
123
124#define PARM_JUMBO_PKT_DEF 1514 112#define PARM_JUMBO_PKT_DEF 1514
125#define PARM_JUMBO_PKT_MIN 1514 113#define PARM_JUMBO_PKT_MIN 1514
126#define PARM_JUMBO_PKT_MAX 9216 114#define PARM_JUMBO_PKT_MAX 9216
@@ -129,10 +117,6 @@ extern dbg_info_t *et131x_dbginfo;
129#define PARM_PHY_COMA_MIN 0 117#define PARM_PHY_COMA_MIN 0
130#define PARM_PHY_COMA_MAX 1 118#define PARM_PHY_COMA_MAX 1
131 119
132#define PARM_MAC_STAT_DEF 1
133#define PARM_MAC_STAT_MIN 0
134#define PARM_MAC_STAT_MAX 1
135
136#define PARM_SC_GAIN_DEF 7 120#define PARM_SC_GAIN_DEF 7
137#define PARM_SC_GAIN_MIN 0 121#define PARM_SC_GAIN_MIN 0
138#define PARM_SC_GAIN_MAX 7 122#define PARM_SC_GAIN_MAX 7
@@ -145,13 +129,7 @@ extern dbg_info_t *et131x_dbginfo;
145#define PARM_NMI_DISABLE_MIN 0 129#define PARM_NMI_DISABLE_MIN 0
146#define PARM_NMI_DISABLE_MAX 2 130#define PARM_NMI_DISABLE_MAX 2
147 131
148#define PARM_DMA_CACHE_DEF 0
149
150#define PARM_PHY_LOOPBK_DEF 0
151#define PARM_PHY_LOOPBK_MIN 0
152#define PARM_PHY_LOOPBK_MAX 1
153 132
154#define PARM_MAC_ADDRESS_DEF { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 }
155 133
156/* Module parameter for disabling NMI 134/* Module parameter for disabling NMI
157 * et131x_speed_set : 135 * et131x_speed_set :
@@ -184,109 +162,61 @@ MODULE_PARM_DESC(et131x_speed_set,
184 * @etdev: pointer to the private adapter struct 162 * @etdev: pointer to the private adapter struct
185 * 163 *
186 * Parses a configuration from some location (module parameters, for example) 164 * Parses a configuration from some location (module parameters, for example)
187 * into the private adapter struct 165 * into the private adapter struct. This really has no sensible analogy in
166 * Linux as sysfs parameters are dynamic. Several things that were hee could
167 * go into sysfs, but other stuff like speed handling is part of the mii
168 * interfaces/ethtool.
188 */ 169 */
189void et131x_config_parse(struct et131x_adapter *etdev) 170void et131x_config_parse(struct et131x_adapter *etdev)
190{ 171{
191 uint8_t macAddrDef[] = PARM_MAC_ADDRESS_DEF; 172 static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 };
173 static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 };
174 static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 };
192 175
193 DBG_ENTER(et131x_dbginfo); 176 DBG_ENTER(et131x_dbginfo);
194 177
195 /* 178 etdev->SpeedDuplex = et131x_speed_set;
196 * The NDIS driver uses the registry to store persistent per-device
197 * configuration, and reads this configuration into the appropriate
198 * elements of the private adapter structure on initialization.
199 * Because Linux has no analog to the registry, use this function to
200 * initialize the private adapter structure with a default
201 * configuration.
202 *
203 * One other possibility is to use a series of module parameters which
204 * can be passed in by the caller when the module is initialized.
205 * However, this implementation does not allow for seperate
206 * configurations in the event multiple devices are present, and hence
207 * will not suffice.
208 *
209 * If another method is derived which addresses this problem, this is
210 * where it should be implemented.
211 */
212 179
213 /* Set the private adapter struct with default values for the 180 if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
214 * corresponding parameters 181 et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
215 */ 182 dev_warn(&etdev->pdev->dev, "invalid speed setting ignored.\n");
216 if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF) { 183 et131x_speed_set = PARM_SPEED_DUPLEX_DEF;
184 }
185 else if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF)
217 DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n", 186 DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
218 et131x_speed_set); 187 et131x_speed_set);
219 etdev->SpeedDuplex = et131x_speed_set;
220 } else {
221 etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
222 }
223 188
224 /* etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */ 189 /* etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */
225 190
226 etdev->RegistryVlanTag = PARM_VLAN_TAG_DEF;
227 etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF; 191 etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
228 etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF; 192 etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
229 etdev->RegistryPhyComa = PARM_PHY_COMA_DEF; 193 etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
230 etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
231 194
232 if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF) 195 if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
233 etdev->RegistryNMIDisable = et131x_nmi_disable; 196 etdev->RegistryNMIDisable = et131x_nmi_disable;
234 else 197 else
235 etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF; 198 etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
236 199
237 etdev->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF; 200 etdev->RegistryPhyLoopbk = 0; /* 0 off 1 on */
238 201
239 /* Set the MAC address to a default */ 202 /* Set the MAC address to a default */
240 memcpy(etdev->CurrentAddress, macAddrDef, ETH_ALEN); 203 memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN);
241 etdev->bOverrideAddress = false; 204 etdev->bOverrideAddress = false;
242 205
243 DBG_TRACE(et131x_dbginfo,
244 "Default MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n",
245 etdev->CurrentAddress[0], etdev->CurrentAddress[1],
246 etdev->CurrentAddress[2], etdev->CurrentAddress[3],
247 etdev->CurrentAddress[4], etdev->CurrentAddress[5]);
248
249 /* Decode SpeedDuplex 206 /* Decode SpeedDuplex
250 * 207 *
251 * Set up as if we are auto negotiating always and then change if we 208 * Set up as if we are auto negotiating always and then change if we
252 * go into force mode 209 * go into force mode
253 */ 210 *
254 etdev->AiForceSpeed = 0; /* Auto speed */ 211 * If we are the 10/100 device, and gigabit is somehow requested then
255 etdev->AiForceDpx = 0; /* Auto FDX */
256
257 /* If we are the 10/100 device, and gigabit is somehow requested then
258 * knock it down to 100 full. 212 * knock it down to 100 full.
259 */ 213 */
260 if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST && 214 if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
261 etdev->SpeedDuplex == 5) 215 etdev->SpeedDuplex == 5)
262 etdev->SpeedDuplex = 4; 216 etdev->SpeedDuplex = 4;
263 217
264 switch (etdev->SpeedDuplex) { 218 etdev->AiForceSpeed = speed[etdev->SpeedDuplex];
265 case 1: /* 10Mb Half-Duplex */ 219 etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */
266 etdev->AiForceSpeed = 10;
267 etdev->AiForceDpx = 1;
268 break;
269
270 case 2: /* 10Mb Full-Duplex */
271 etdev->AiForceSpeed = 10;
272 etdev->AiForceDpx = 2;
273 break;
274
275 case 3: /* 100Mb Half-Duplex */
276 etdev->AiForceSpeed = 100;
277 etdev->AiForceDpx = 1;
278 break;
279
280 case 4: /* 100Mb Full-Duplex */
281 etdev->AiForceSpeed = 100;
282 etdev->AiForceDpx = 2;
283 break;
284
285 case 5: /* 1000Mb Full-Duplex */
286 etdev->AiForceSpeed = 1000;
287 etdev->AiForceDpx = 2;
288 break;
289 }
290 220
291 DBG_LEAVE(et131x_dbginfo); 221 DBG_LEAVE(et131x_dbginfo);
292} 222}
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 4d4594198621..c489090178be 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -442,10 +442,9 @@ void et131x_error_timer_handler(unsigned long data)
442 442
443 pm_csr.value = readl(&etdev->regs->global.pm_csr.value); 443 pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
444 444
445 if (pm_csr.bits.pm_phy_sw_coma == 0) { 445 if (pm_csr.bits.pm_phy_sw_coma == 0)
446 if (etdev->RegistryMACStat) 446 UpdateMacStatHostCounters(etdev);
447 UpdateMacStatHostCounters(etdev); 447 else
448 } else
449 DBG_VERBOSE(et131x_dbginfo, 448 DBG_VERBOSE(et131x_dbginfo,
450 "No interrupts, in PHY coma, pm_csr = 0x%x\n", 449 "No interrupts, in PHY coma, pm_csr = 0x%x\n",
451 pm_csr.value); 450 pm_csr.value);