diff options
-rw-r--r-- | drivers/staging/et131x/et1310_eeprom.c | 192 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_mac.c | 12 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_phy.c | 238 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_phy.h | 12 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_rx.c | 136 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_tx.c | 92 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_adapter.h | 18 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_initpci.c | 70 |
8 files changed, 377 insertions, 393 deletions
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c index 29d1c0ef5c31..94538624c103 100644 --- a/drivers/staging/et131x/et1310_eeprom.c +++ b/drivers/staging/et131x/et1310_eeprom.c | |||
@@ -137,34 +137,34 @@ | |||
137 | * Define macros that allow individual register values to be extracted from a | 137 | * Define macros that allow individual register values to be extracted from a |
138 | * DWORD1 register grouping | 138 | * DWORD1 register grouping |
139 | */ | 139 | */ |
140 | #define EXTRACT_DATA_REGISTER(x) (uint8_t)(x & 0xFF) | 140 | #define EXTRACT_DATA_REGISTER(x) (u8)(x & 0xFF) |
141 | #define EXTRACT_STATUS_REGISTER(x) (uint8_t)((x >> 16) & 0xFF) | 141 | #define EXTRACT_STATUS_REGISTER(x) (u8)((x >> 16) & 0xFF) |
142 | #define EXTRACT_CONTROL_REG(x) (uint8_t)((x >> 8) & 0xFF) | 142 | #define EXTRACT_CONTROL_REG(x) (u8)((x >> 8) & 0xFF) |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * EepromWriteByte - Write a byte to the ET1310's EEPROM | 145 | * EepromWriteByte - Write a byte to the ET1310's EEPROM |
146 | * @etdev: pointer to our private adapter structure | 146 | * @etdev: pointer to our private adapter structure |
147 | * @unAddress: the address to write | 147 | * @addr: the address to write |
148 | * @bData: the value to write | 148 | * @data: the value to write |
149 | * @unEepronId: the ID of the EEPROM | 149 | * @eeprom_id: the ID of the EEPROM |
150 | * @unAddressingMode: how the EEPROM is to be accessed | 150 | * @addrmode: how the EEPROM is to be accessed |
151 | * | 151 | * |
152 | * Returns SUCCESS or FAILURE | 152 | * Returns SUCCESS or FAILURE |
153 | */ | 153 | */ |
154 | int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, | 154 | int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, |
155 | uint8_t bData, uint32_t unEepromId, | 155 | u8 data, u32 eeprom_id, |
156 | uint32_t unAddressingMode) | 156 | u32 addrmode) |
157 | { | 157 | { |
158 | struct pci_dev *pdev = etdev->pdev; | 158 | struct pci_dev *pdev = etdev->pdev; |
159 | int32_t nIndex; | 159 | int index; |
160 | int32_t nRetries; | 160 | int retries; |
161 | int32_t nError = false; | 161 | int err = 0; |
162 | int32_t nI2CWriteActive = 0; | 162 | int i2c_wack = 0; |
163 | int32_t nWriteSuccessful = 0; | 163 | int writeok = 0; |
164 | uint8_t bControl; | 164 | u8 control; |
165 | uint8_t bStatus = 0; | 165 | u8 status = 0; |
166 | uint32_t unDword1 = 0; | 166 | u32 dword1 = 0; |
167 | uint32_t unData = 0; | 167 | u32 val = 0; |
168 | 168 | ||
169 | /* | 169 | /* |
170 | * The following excerpt is from "Serial EEPROM HW Design | 170 | * The following excerpt is from "Serial EEPROM HW Design |
@@ -215,89 +215,89 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, | |||
215 | */ | 215 | */ |
216 | 216 | ||
217 | /* Step 1: */ | 217 | /* Step 1: */ |
218 | for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) { | 218 | for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { |
219 | /* Read registers grouped in DWORD1 */ | 219 | /* Read registers grouped in DWORD1 */ |
220 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, | 220 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, |
221 | &unDword1)) { | 221 | &dword1)) { |
222 | nError = 1; | 222 | err = 1; |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | 225 | ||
226 | bStatus = EXTRACT_STATUS_REGISTER(unDword1); | 226 | status = EXTRACT_STATUS_REGISTER(dword1); |
227 | 227 | ||
228 | if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && | 228 | if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && |
229 | bStatus & LBCIF_STATUS_I2C_IDLE) | 229 | status & LBCIF_STATUS_I2C_IDLE) |
230 | /* bits 1:0 are equal to 1 */ | 230 | /* bits 1:0 are equal to 1 */ |
231 | break; | 231 | break; |
232 | } | 232 | } |
233 | 233 | ||
234 | if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) | 234 | if (err || (index >= MAX_NUM_REGISTER_POLLS)) |
235 | return FAILURE; | 235 | return FAILURE; |
236 | 236 | ||
237 | /* Step 2: */ | 237 | /* Step 2: */ |
238 | bControl = 0; | 238 | control = 0; |
239 | bControl |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE; | 239 | control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE; |
240 | 240 | ||
241 | if (unAddressingMode == DUAL_BYTE) | 241 | if (addrmode == DUAL_BYTE) |
242 | bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR; | 242 | control |= LBCIF_CONTROL_TWO_BYTE_ADDR; |
243 | 243 | ||
244 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, | 244 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, |
245 | bControl)) { | 245 | control)) { |
246 | return FAILURE; | 246 | return FAILURE; |
247 | } | 247 | } |
248 | 248 | ||
249 | nI2CWriteActive = 1; | 249 | i2c_wack = 1; |
250 | 250 | ||
251 | /* Prepare EEPROM address for Step 3 */ | 251 | /* Prepare EEPROM address for Step 3 */ |
252 | unAddress |= (unAddressingMode == DUAL_BYTE) ? | 252 | addr |= (addrmode == DUAL_BYTE) ? |
253 | (unEepromId << 16) : (unEepromId << 8); | 253 | (eeprom_id << 16) : (eeprom_id << 8); |
254 | 254 | ||
255 | for (nRetries = 0; nRetries < MAX_NUM_WRITE_RETRIES; nRetries++) { | 255 | for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) { |
256 | /* Step 3:*/ | 256 | /* Step 3:*/ |
257 | if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, | 257 | if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, |
258 | unAddress)) { | 258 | addr)) { |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | 261 | ||
262 | /* Step 4: */ | 262 | /* Step 4: */ |
263 | if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET, | 263 | if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET, |
264 | bData)) { | 264 | data)) { |
265 | break; | 265 | break; |
266 | } | 266 | } |
267 | 267 | ||
268 | /* Step 5: */ | 268 | /* Step 5: */ |
269 | for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) { | 269 | for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { |
270 | /* Read registers grouped in DWORD1 */ | 270 | /* Read registers grouped in DWORD1 */ |
271 | if (pci_read_config_dword(pdev, | 271 | if (pci_read_config_dword(pdev, |
272 | LBCIF_DWORD1_GROUP_OFFSET, | 272 | LBCIF_DWORD1_GROUP_OFFSET, |
273 | &unDword1)) { | 273 | &dword1)) { |
274 | nError = 1; | 274 | err = 1; |
275 | break; | 275 | break; |
276 | } | 276 | } |
277 | 277 | ||
278 | bStatus = EXTRACT_STATUS_REGISTER(unDword1); | 278 | status = EXTRACT_STATUS_REGISTER(dword1); |
279 | 279 | ||
280 | if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && | 280 | if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && |
281 | bStatus & LBCIF_STATUS_I2C_IDLE) { | 281 | status & LBCIF_STATUS_I2C_IDLE) { |
282 | /* I2C write complete */ | 282 | /* I2C write complete */ |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) | 287 | if (err || (index >= MAX_NUM_REGISTER_POLLS)) |
288 | break; | 288 | break; |
289 | 289 | ||
290 | /* | 290 | /* |
291 | * Step 6: Don't break here if we are revision 1, this is | 291 | * Step 6: Don't break here if we are revision 1, this is |
292 | * so we do a blind write for load bug. | 292 | * so we do a blind write for load bug. |
293 | */ | 293 | */ |
294 | if (bStatus & LBCIF_STATUS_GENERAL_ERROR | 294 | if (status & LBCIF_STATUS_GENERAL_ERROR |
295 | && etdev->pdev->revision == 0) { | 295 | && etdev->pdev->revision == 0) { |
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | 298 | ||
299 | /* Step 7 */ | 299 | /* Step 7 */ |
300 | if (bStatus & LBCIF_STATUS_ACK_ERROR) { | 300 | if (status & LBCIF_STATUS_ACK_ERROR) { |
301 | /* | 301 | /* |
302 | * This could be due to an actual hardware failure | 302 | * This could be due to an actual hardware failure |
303 | * or the EEPROM may still be in its internal write | 303 | * or the EEPROM may still be in its internal write |
@@ -308,19 +308,19 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, | |||
308 | continue; | 308 | continue; |
309 | } | 309 | } |
310 | 310 | ||
311 | nWriteSuccessful = 1; | 311 | writeok = 1; |
312 | break; | 312 | break; |
313 | } | 313 | } |
314 | 314 | ||
315 | /* Step 8: */ | 315 | /* Step 8: */ |
316 | udelay(10); | 316 | udelay(10); |
317 | nIndex = 0; | 317 | index = 0; |
318 | while (nI2CWriteActive) { | 318 | while (i2c_wack) { |
319 | bControl &= ~LBCIF_CONTROL_I2C_WRITE; | 319 | control &= ~LBCIF_CONTROL_I2C_WRITE; |
320 | 320 | ||
321 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, | 321 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, |
322 | bControl)) { | 322 | control)) { |
323 | nWriteSuccessful = 0; | 323 | writeok = 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | /* Do read until internal ACK_ERROR goes away meaning write | 326 | /* Do read until internal ACK_ERROR goes away meaning write |
@@ -329,44 +329,44 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, | |||
329 | do { | 329 | do { |
330 | pci_write_config_dword(pdev, | 330 | pci_write_config_dword(pdev, |
331 | LBCIF_ADDRESS_REGISTER_OFFSET, | 331 | LBCIF_ADDRESS_REGISTER_OFFSET, |
332 | unAddress); | 332 | addr); |
333 | do { | 333 | do { |
334 | pci_read_config_dword(pdev, | 334 | pci_read_config_dword(pdev, |
335 | LBCIF_DATA_REGISTER_OFFSET, &unData); | 335 | LBCIF_DATA_REGISTER_OFFSET, &val); |
336 | } while ((unData & 0x00010000) == 0); | 336 | } while ((val & 0x00010000) == 0); |
337 | } while (unData & 0x00040000); | 337 | } while (val & 0x00040000); |
338 | 338 | ||
339 | bControl = EXTRACT_CONTROL_REG(unData); | 339 | control = EXTRACT_CONTROL_REG(val); |
340 | 340 | ||
341 | if (bControl != 0xC0 || nIndex == 10000) | 341 | if (control != 0xC0 || index == 10000) |
342 | break; | 342 | break; |
343 | 343 | ||
344 | nIndex++; | 344 | index++; |
345 | } | 345 | } |
346 | 346 | ||
347 | return nWriteSuccessful ? SUCCESS : FAILURE; | 347 | return writeok ? SUCCESS : FAILURE; |
348 | } | 348 | } |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * EepromReadByte - Read a byte from the ET1310's EEPROM | 351 | * EepromReadByte - Read a byte from the ET1310's EEPROM |
352 | * @etdev: pointer to our private adapter structure | 352 | * @etdev: pointer to our private adapter structure |
353 | * @unAddress: the address from which to read | 353 | * @addr: the address from which to read |
354 | * @pbData: a pointer to a byte in which to store the value of the read | 354 | * @pdata: a pointer to a byte in which to store the value of the read |
355 | * @unEepronId: the ID of the EEPROM | 355 | * @eeprom_id: the ID of the EEPROM |
356 | * @unAddressingMode: how the EEPROM is to be accessed | 356 | * @addrmode: how the EEPROM is to be accessed |
357 | * | 357 | * |
358 | * Returns SUCCESS or FAILURE | 358 | * Returns SUCCESS or FAILURE |
359 | */ | 359 | */ |
360 | int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress, | 360 | int EepromReadByte(struct et131x_adapter *etdev, u32 addr, |
361 | uint8_t *pbData, uint32_t unEepromId, | 361 | u8 *pdata, u32 eeprom_id, |
362 | uint32_t unAddressingMode) | 362 | u32 addrmode) |
363 | { | 363 | { |
364 | struct pci_dev *pdev = etdev->pdev; | 364 | struct pci_dev *pdev = etdev->pdev; |
365 | int32_t nIndex; | 365 | int index; |
366 | int32_t nError = 0; | 366 | int err = 0; |
367 | uint8_t bControl; | 367 | u8 control; |
368 | uint8_t bStatus = 0; | 368 | u8 status = 0; |
369 | uint32_t unDword1 = 0; | 369 | u32 dword1 = 0; |
370 | 370 | ||
371 | /* | 371 | /* |
372 | * The following excerpt is from "Serial EEPROM HW Design | 372 | * The following excerpt is from "Serial EEPROM HW Design |
@@ -403,70 +403,70 @@ int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress, | |||
403 | */ | 403 | */ |
404 | 404 | ||
405 | /* Step 1: */ | 405 | /* Step 1: */ |
406 | for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) { | 406 | for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { |
407 | /* Read registers grouped in DWORD1 */ | 407 | /* Read registers grouped in DWORD1 */ |
408 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, | 408 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, |
409 | &unDword1)) { | 409 | &dword1)) { |
410 | nError = 1; | 410 | err = 1; |
411 | break; | 411 | break; |
412 | } | 412 | } |
413 | 413 | ||
414 | bStatus = EXTRACT_STATUS_REGISTER(unDword1); | 414 | status = EXTRACT_STATUS_REGISTER(dword1); |
415 | 415 | ||
416 | if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && | 416 | if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && |
417 | bStatus & LBCIF_STATUS_I2C_IDLE) { | 417 | status & LBCIF_STATUS_I2C_IDLE) { |
418 | /* bits 1:0 are equal to 1 */ | 418 | /* bits 1:0 are equal to 1 */ |
419 | break; | 419 | break; |
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) | 423 | if (err || (index >= MAX_NUM_REGISTER_POLLS)) |
424 | return FAILURE; | 424 | return FAILURE; |
425 | 425 | ||
426 | /* Step 2: */ | 426 | /* Step 2: */ |
427 | bControl = 0; | 427 | control = 0; |
428 | bControl |= LBCIF_CONTROL_LBCIF_ENABLE; | 428 | control |= LBCIF_CONTROL_LBCIF_ENABLE; |
429 | 429 | ||
430 | if (unAddressingMode == DUAL_BYTE) | 430 | if (addrmode == DUAL_BYTE) |
431 | bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR; | 431 | control |= LBCIF_CONTROL_TWO_BYTE_ADDR; |
432 | 432 | ||
433 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, | 433 | if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, |
434 | bControl)) { | 434 | control)) { |
435 | return FAILURE; | 435 | return FAILURE; |
436 | } | 436 | } |
437 | 437 | ||
438 | /* Step 3: */ | 438 | /* Step 3: */ |
439 | unAddress |= (unAddressingMode == DUAL_BYTE) ? | 439 | addr |= (addrmode == DUAL_BYTE) ? |
440 | (unEepromId << 16) : (unEepromId << 8); | 440 | (eeprom_id << 16) : (eeprom_id << 8); |
441 | 441 | ||
442 | if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, | 442 | if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, |
443 | unAddress)) { | 443 | addr)) { |
444 | return FAILURE; | 444 | return FAILURE; |
445 | } | 445 | } |
446 | 446 | ||
447 | /* Step 4: */ | 447 | /* Step 4: */ |
448 | for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) { | 448 | for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { |
449 | /* Read registers grouped in DWORD1 */ | 449 | /* Read registers grouped in DWORD1 */ |
450 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, | 450 | if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, |
451 | &unDword1)) { | 451 | &dword1)) { |
452 | nError = 1; | 452 | err = 1; |
453 | break; | 453 | break; |
454 | } | 454 | } |
455 | 455 | ||
456 | bStatus = EXTRACT_STATUS_REGISTER(unDword1); | 456 | status = EXTRACT_STATUS_REGISTER(dword1); |
457 | 457 | ||
458 | if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL | 458 | if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL |
459 | && bStatus & LBCIF_STATUS_I2C_IDLE) { | 459 | && status & LBCIF_STATUS_I2C_IDLE) { |
460 | /* I2C read complete */ | 460 | /* I2C read complete */ |
461 | break; | 461 | break; |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) | 465 | if (err || (index >= MAX_NUM_REGISTER_POLLS)) |
466 | return FAILURE; | 466 | return FAILURE; |
467 | 467 | ||
468 | /* Step 6: */ | 468 | /* Step 6: */ |
469 | *pbData = EXTRACT_DATA_REGISTER(unDword1); | 469 | *pdata = EXTRACT_DATA_REGISTER(dword1); |
470 | 470 | ||
471 | return (bStatus & LBCIF_STATUS_ACK_ERROR) ? FAILURE : SUCCESS; | 471 | return (status & LBCIF_STATUS_ACK_ERROR) ? FAILURE : SUCCESS; |
472 | } | 472 | } |
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 9461a2d25217..b2123d0a8b0b 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c | |||
@@ -195,7 +195,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) | |||
195 | cfg2.value = readl(&pMac->cfg2.value); | 195 | cfg2.value = readl(&pMac->cfg2.value); |
196 | ifctrl.value = readl(&pMac->if_ctrl.value); | 196 | ifctrl.value = readl(&pMac->if_ctrl.value); |
197 | 197 | ||
198 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) { | 198 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { |
199 | cfg2.bits.if_mode = 0x2; | 199 | cfg2.bits.if_mode = 0x2; |
200 | ifctrl.bits.phy_mode = 0x0; | 200 | ifctrl.bits.phy_mode = 0x0; |
201 | } else { | 201 | } else { |
@@ -241,8 +241,8 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) | |||
241 | } | 241 | } |
242 | 242 | ||
243 | /* 1 - full duplex, 0 - half-duplex */ | 243 | /* 1 - full duplex, 0 - half-duplex */ |
244 | cfg2.bits.full_duplex = etdev->uiDuplexMode; | 244 | cfg2.bits.full_duplex = etdev->duplex_mode; |
245 | ifctrl.bits.ghd_mode = !etdev->uiDuplexMode; | 245 | ifctrl.bits.ghd_mode = !etdev->duplex_mode; |
246 | 246 | ||
247 | writel(ifctrl.value, &pMac->if_ctrl.value); | 247 | writel(ifctrl.value, &pMac->if_ctrl.value); |
248 | writel(cfg2.value, &pMac->cfg2.value); | 248 | writel(cfg2.value, &pMac->cfg2.value); |
@@ -262,7 +262,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) | |||
262 | 262 | ||
263 | DBG_TRACE(et131x_dbginfo, | 263 | DBG_TRACE(et131x_dbginfo, |
264 | "Speed %d, Dup %d, CFG1 0x%08x, CFG2 0x%08x, if_ctrl 0x%08x\n", | 264 | "Speed %d, Dup %d, CFG1 0x%08x, CFG2 0x%08x, if_ctrl 0x%08x\n", |
265 | etdev->uiLinkSpeed, etdev->uiDuplexMode, | 265 | etdev->linkspeed, etdev->duplex_mode, |
266 | readl(&pMac->cfg1.value), readl(&pMac->cfg2.value), | 266 | readl(&pMac->cfg1.value), readl(&pMac->cfg2.value), |
267 | readl(&pMac->if_ctrl.value)); | 267 | readl(&pMac->if_ctrl.value)); |
268 | 268 | ||
@@ -408,7 +408,7 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) | |||
408 | * bit 16: Receive frame truncated. | 408 | * bit 16: Receive frame truncated. |
409 | * bit 17: Drop packet enable | 409 | * bit 17: Drop packet enable |
410 | */ | 410 | */ |
411 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) | 411 | if (etdev->linkspeed == TRUEPHY_SPEED_100MBPS) |
412 | writel(0x30038, &pRxMac->mif_ctrl.value); | 412 | writel(0x30038, &pRxMac->mif_ctrl.value); |
413 | else | 413 | else |
414 | writel(0x30030, &pRxMac->mif_ctrl.value); | 414 | writel(0x30030, &pRxMac->mif_ctrl.value); |
@@ -540,7 +540,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev) | |||
540 | 540 | ||
541 | void ConfigFlowControl(struct et131x_adapter *etdev) | 541 | void ConfigFlowControl(struct et131x_adapter *etdev) |
542 | { | 542 | { |
543 | if (etdev->uiDuplexMode == 0) { | 543 | if (etdev->duplex_mode == 0) { |
544 | etdev->FlowControl = None; | 544 | etdev->FlowControl = None; |
545 | } else { | 545 | } else { |
546 | char RemotePause, RemoteAsyncPause; | 546 | char RemotePause, RemoteAsyncPause; |
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index d0a3c831ca07..a16ce16cfede 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c | |||
@@ -477,13 +477,13 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter) | |||
477 | void et131x_Mii_check(struct et131x_adapter *etdev, | 477 | void et131x_Mii_check(struct et131x_adapter *etdev, |
478 | MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints) | 478 | MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints) |
479 | { | 479 | { |
480 | uint8_t ucLinkStatus; | 480 | uint8_t link_status; |
481 | uint32_t uiAutoNegStatus; | 481 | uint32_t autoneg_status; |
482 | uint32_t uiSpeed; | 482 | uint32_t speed; |
483 | uint32_t uiDuplex; | 483 | uint32_t duplex; |
484 | uint32_t uiMdiMdix; | 484 | uint32_t mdi_mdix; |
485 | uint32_t uiMasterSlave; | 485 | uint32_t masterslave; |
486 | uint32_t uiPolarity; | 486 | uint32_t polarity; |
487 | unsigned long flags; | 487 | unsigned long flags; |
488 | 488 | ||
489 | DBG_ENTER(et131x_dbginfo); | 489 | DBG_ENTER(et131x_dbginfo); |
@@ -509,7 +509,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, | |||
509 | DBG_WARNING(et131x_dbginfo, | 509 | DBG_WARNING(et131x_dbginfo, |
510 | "Link down cable problem\n"); | 510 | "Link down cable problem\n"); |
511 | 511 | ||
512 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) { | 512 | if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { |
513 | /* NOTE - Is there a way to query this without | 513 | /* NOTE - Is there a way to query this without |
514 | * TruePHY? | 514 | * TruePHY? |
515 | * && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) { | 515 | * && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) { |
@@ -546,8 +546,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev, | |||
546 | netif_carrier_off(etdev->netdev); | 546 | netif_carrier_off(etdev->netdev); |
547 | } | 547 | } |
548 | 548 | ||
549 | etdev->uiLinkSpeed = 0; | 549 | etdev->linkspeed = 0; |
550 | etdev->uiDuplexMode = 0; | 550 | etdev->duplexMode = 0; |
551 | 551 | ||
552 | /* Free the packets being actively sent & stopped */ | 552 | /* Free the packets being actively sent & stopped */ |
553 | et131x_free_busy_send_packets(etdev); | 553 | et131x_free_busy_send_packets(etdev); |
@@ -581,21 +581,21 @@ void et131x_Mii_check(struct et131x_adapter *etdev, | |||
581 | (etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) { | 581 | (etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) { |
582 | if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) { | 582 | if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) { |
583 | ET1310_PhyLinkStatus(etdev, | 583 | ET1310_PhyLinkStatus(etdev, |
584 | &ucLinkStatus, &uiAutoNegStatus, | 584 | &link_status, &autoneg_status, |
585 | &uiSpeed, &uiDuplex, &uiMdiMdix, | 585 | &speed, &duplex, &mdi_mdix, |
586 | &uiMasterSlave, &uiPolarity); | 586 | &masterslave, &polarity); |
587 | 587 | ||
588 | etdev->uiLinkSpeed = uiSpeed; | 588 | etdev->linkspeed = speed; |
589 | etdev->uiDuplexMode = uiDuplex; | 589 | etdev->duplex_mode = duplex; |
590 | 590 | ||
591 | DBG_TRACE(et131x_dbginfo, | 591 | DBG_TRACE(et131x_dbginfo, |
592 | "etdev->uiLinkSpeed 0x%04x, etdev->uiDuplex 0x%08x\n", | 592 | "etdev->linkspeed 0x%04x, etdev->duplex_mode 0x%08x\n", |
593 | etdev->uiLinkSpeed, | 593 | etdev->linkspeed, |
594 | etdev->uiDuplexMode); | 594 | etdev->duplex_mode); |
595 | 595 | ||
596 | etdev->PoMgmt.TransPhyComaModeOnBoot = 20; | 596 | etdev->PoMgmt.TransPhyComaModeOnBoot = 20; |
597 | 597 | ||
598 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) { | 598 | if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { |
599 | /* | 599 | /* |
600 | * NOTE - Is there a way to query this without | 600 | * NOTE - Is there a way to query this without |
601 | * TruePHY? | 601 | * TruePHY? |
@@ -612,7 +612,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, | |||
612 | 612 | ||
613 | ConfigFlowControl(etdev); | 613 | ConfigFlowControl(etdev); |
614 | 614 | ||
615 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS && | 615 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS && |
616 | etdev->RegistryJumboPacket > 2048) | 616 | etdev->RegistryJumboPacket > 2048) |
617 | ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff, | 617 | ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff, |
618 | 0x2000); | 618 | 0x2000); |
@@ -905,67 +905,67 @@ static const uint16_t ConfigPhy[25][2] = { | |||
905 | /* condensed version of the phy initialization routine */ | 905 | /* condensed version of the phy initialization routine */ |
906 | void ET1310_PhyInit(struct et131x_adapter *etdev) | 906 | void ET1310_PhyInit(struct et131x_adapter *etdev) |
907 | { | 907 | { |
908 | uint16_t usData, usIndex; | 908 | uint16_t data, index; |
909 | 909 | ||
910 | if (etdev == NULL) | 910 | if (etdev == NULL) |
911 | return; | 911 | return; |
912 | 912 | ||
913 | /* get the identity (again ?) */ | 913 | /* get the identity (again ?) */ |
914 | MiRead(etdev, PHY_ID_1, &usData); | 914 | MiRead(etdev, PHY_ID_1, &data); |
915 | MiRead(etdev, PHY_ID_2, &usData); | 915 | MiRead(etdev, PHY_ID_2, &data); |
916 | 916 | ||
917 | /* what does this do/achieve ? */ | 917 | /* what does this do/achieve ? */ |
918 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */ | 918 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ |
919 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); | 919 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); |
920 | 920 | ||
921 | /* read modem register 0402, should I do something with the return | 921 | /* read modem register 0402, should I do something with the return |
922 | data ? */ | 922 | data ? */ |
923 | MiWrite(etdev, PHY_INDEX_REG, 0x0402); | 923 | MiWrite(etdev, PHY_INDEX_REG, 0x0402); |
924 | MiRead(etdev, PHY_DATA_REG, &usData); | 924 | MiRead(etdev, PHY_DATA_REG, &data); |
925 | 925 | ||
926 | /* what does this do/achieve ? */ | 926 | /* what does this do/achieve ? */ |
927 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); | 927 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); |
928 | 928 | ||
929 | /* get the identity (again ?) */ | 929 | /* get the identity (again ?) */ |
930 | MiRead(etdev, PHY_ID_1, &usData); | 930 | MiRead(etdev, PHY_ID_1, &data); |
931 | MiRead(etdev, PHY_ID_2, &usData); | 931 | MiRead(etdev, PHY_ID_2, &data); |
932 | 932 | ||
933 | /* what does this achieve ? */ | 933 | /* what does this achieve ? */ |
934 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */ | 934 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ |
935 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); | 935 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); |
936 | 936 | ||
937 | /* read modem register 0402, should I do something with | 937 | /* read modem register 0402, should I do something with |
938 | the return data? */ | 938 | the return data? */ |
939 | MiWrite(etdev, PHY_INDEX_REG, 0x0402); | 939 | MiWrite(etdev, PHY_INDEX_REG, 0x0402); |
940 | MiRead(etdev, PHY_DATA_REG, &usData); | 940 | MiRead(etdev, PHY_DATA_REG, &data); |
941 | 941 | ||
942 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); | 942 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); |
943 | 943 | ||
944 | /* what does this achieve (should return 0x1040) */ | 944 | /* what does this achieve (should return 0x1040) */ |
945 | MiRead(etdev, PHY_CONTROL, &usData); | 945 | MiRead(etdev, PHY_CONTROL, &data); |
946 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */ | 946 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ |
947 | MiWrite(etdev, PHY_CONTROL, 0x1840); | 947 | MiWrite(etdev, PHY_CONTROL, 0x1840); |
948 | 948 | ||
949 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007); | 949 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007); |
950 | 950 | ||
951 | /* here the writing of the array starts.... */ | 951 | /* here the writing of the array starts.... */ |
952 | usIndex = 0; | 952 | index = 0; |
953 | while (ConfigPhy[usIndex][0] != 0x0000) { | 953 | while (ConfigPhy[index][0] != 0x0000) { |
954 | /* write value */ | 954 | /* write value */ |
955 | MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]); | 955 | MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); |
956 | MiWrite(etdev, PHY_DATA_REG, ConfigPhy[usIndex][1]); | 956 | MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]); |
957 | 957 | ||
958 | /* read it back */ | 958 | /* read it back */ |
959 | MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]); | 959 | MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); |
960 | MiRead(etdev, PHY_DATA_REG, &usData); | 960 | MiRead(etdev, PHY_DATA_REG, &data); |
961 | 961 | ||
962 | /* do a check on the value read back ? */ | 962 | /* do a check on the value read back ? */ |
963 | usIndex++; | 963 | index++; |
964 | } | 964 | } |
965 | /* here the writing of the array ends... */ | 965 | /* here the writing of the array ends... */ |
966 | 966 | ||
967 | MiRead(etdev, PHY_CONTROL, &usData); /* 0x1840 */ | 967 | MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */ |
968 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData);/* should read 0007 */ | 968 | MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */ |
969 | MiWrite(etdev, PHY_CONTROL, 0x1040); | 969 | MiWrite(etdev, PHY_CONTROL, 0x1040); |
970 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); | 970 | MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); |
971 | } | 971 | } |
@@ -977,64 +977,64 @@ void ET1310_PhyReset(struct et131x_adapter *etdev) | |||
977 | 977 | ||
978 | void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) | 978 | void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) |
979 | { | 979 | { |
980 | uint16_t usData; | 980 | uint16_t data; |
981 | 981 | ||
982 | MiRead(etdev, PHY_CONTROL, &usData); | 982 | MiRead(etdev, PHY_CONTROL, &data); |
983 | 983 | ||
984 | if (down == false) { | 984 | if (down == false) { |
985 | /* Power UP */ | 985 | /* Power UP */ |
986 | usData &= ~0x0800; | 986 | data &= ~0x0800; |
987 | MiWrite(etdev, PHY_CONTROL, usData); | 987 | MiWrite(etdev, PHY_CONTROL, data); |
988 | } else { | 988 | } else { |
989 | /* Power DOWN */ | 989 | /* Power DOWN */ |
990 | usData |= 0x0800; | 990 | data |= 0x0800; |
991 | MiWrite(etdev, PHY_CONTROL, usData); | 991 | MiWrite(etdev, PHY_CONTROL, data); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | 994 | ||
995 | void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) | 995 | void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) |
996 | { | 996 | { |
997 | uint16_t usData; | 997 | uint16_t data; |
998 | 998 | ||
999 | MiRead(etdev, PHY_CONTROL, &usData); | 999 | MiRead(etdev, PHY_CONTROL, &data); |
1000 | 1000 | ||
1001 | if (enable == true) { | 1001 | if (enable == true) { |
1002 | /* Autonegotiation ON */ | 1002 | /* Autonegotiation ON */ |
1003 | usData |= 0x1000; | 1003 | data |= 0x1000; |
1004 | MiWrite(etdev, PHY_CONTROL, usData); | 1004 | MiWrite(etdev, PHY_CONTROL, data); |
1005 | } else { | 1005 | } else { |
1006 | /* Autonegotiation OFF */ | 1006 | /* Autonegotiation OFF */ |
1007 | usData &= ~0x1000; | 1007 | data &= ~0x1000; |
1008 | MiWrite(etdev, PHY_CONTROL, usData); | 1008 | MiWrite(etdev, PHY_CONTROL, data); |
1009 | } | 1009 | } |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, uint16_t duplex) | 1012 | void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, uint16_t duplex) |
1013 | { | 1013 | { |
1014 | uint16_t usData; | 1014 | uint16_t data; |
1015 | 1015 | ||
1016 | MiRead(etdev, PHY_CONTROL, &usData); | 1016 | MiRead(etdev, PHY_CONTROL, &data); |
1017 | 1017 | ||
1018 | if (duplex == TRUEPHY_DUPLEX_FULL) { | 1018 | if (duplex == TRUEPHY_DUPLEX_FULL) { |
1019 | /* Set Full Duplex */ | 1019 | /* Set Full Duplex */ |
1020 | usData |= 0x100; | 1020 | data |= 0x100; |
1021 | MiWrite(etdev, PHY_CONTROL, usData); | 1021 | MiWrite(etdev, PHY_CONTROL, data); |
1022 | } else { | 1022 | } else { |
1023 | /* Set Half Duplex */ | 1023 | /* Set Half Duplex */ |
1024 | usData &= ~0x100; | 1024 | data &= ~0x100; |
1025 | MiWrite(etdev, PHY_CONTROL, usData); | 1025 | MiWrite(etdev, PHY_CONTROL, data); |
1026 | } | 1026 | } |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed) | 1029 | void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed) |
1030 | { | 1030 | { |
1031 | uint16_t usData; | 1031 | uint16_t data; |
1032 | 1032 | ||
1033 | /* Read the PHY control register */ | 1033 | /* Read the PHY control register */ |
1034 | MiRead(etdev, PHY_CONTROL, &usData); | 1034 | MiRead(etdev, PHY_CONTROL, &data); |
1035 | 1035 | ||
1036 | /* Clear all Speed settings (Bits 6, 13) */ | 1036 | /* Clear all Speed settings (Bits 6, 13) */ |
1037 | usData &= ~0x2040; | 1037 | data &= ~0x2040; |
1038 | 1038 | ||
1039 | /* Reset the speed bits based on user selection */ | 1039 | /* Reset the speed bits based on user selection */ |
1040 | switch (speed) { | 1040 | switch (speed) { |
@@ -1044,29 +1044,29 @@ void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed) | |||
1044 | 1044 | ||
1045 | case TRUEPHY_SPEED_100MBPS: | 1045 | case TRUEPHY_SPEED_100MBPS: |
1046 | /* 100M == Set bit 13 */ | 1046 | /* 100M == Set bit 13 */ |
1047 | usData |= 0x2000; | 1047 | data |= 0x2000; |
1048 | break; | 1048 | break; |
1049 | 1049 | ||
1050 | case TRUEPHY_SPEED_1000MBPS: | 1050 | case TRUEPHY_SPEED_1000MBPS: |
1051 | default: | 1051 | default: |
1052 | usData |= 0x0040; | 1052 | data |= 0x0040; |
1053 | break; | 1053 | break; |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | /* Write back the new speed */ | 1056 | /* Write back the new speed */ |
1057 | MiWrite(etdev, PHY_CONTROL, usData); | 1057 | MiWrite(etdev, PHY_CONTROL, data); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, | 1060 | void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, |
1061 | uint16_t duplex) | 1061 | uint16_t duplex) |
1062 | { | 1062 | { |
1063 | uint16_t usData; | 1063 | uint16_t data; |
1064 | 1064 | ||
1065 | /* Read the PHY 1000 Base-T Control Register */ | 1065 | /* Read the PHY 1000 Base-T Control Register */ |
1066 | MiRead(etdev, PHY_1000_CONTROL, &usData); | 1066 | MiRead(etdev, PHY_1000_CONTROL, &data); |
1067 | 1067 | ||
1068 | /* Clear Bits 8,9 */ | 1068 | /* Clear Bits 8,9 */ |
1069 | usData &= ~0x0300; | 1069 | data &= ~0x0300; |
1070 | 1070 | ||
1071 | switch (duplex) { | 1071 | switch (duplex) { |
1072 | case TRUEPHY_ADV_DUPLEX_NONE: | 1072 | case TRUEPHY_ADV_DUPLEX_NONE: |
@@ -1075,34 +1075,34 @@ void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, | |||
1075 | 1075 | ||
1076 | case TRUEPHY_ADV_DUPLEX_FULL: | 1076 | case TRUEPHY_ADV_DUPLEX_FULL: |
1077 | /* Set Bit 9 */ | 1077 | /* Set Bit 9 */ |
1078 | usData |= 0x0200; | 1078 | data |= 0x0200; |
1079 | break; | 1079 | break; |
1080 | 1080 | ||
1081 | case TRUEPHY_ADV_DUPLEX_HALF: | 1081 | case TRUEPHY_ADV_DUPLEX_HALF: |
1082 | /* Set Bit 8 */ | 1082 | /* Set Bit 8 */ |
1083 | usData |= 0x0100; | 1083 | data |= 0x0100; |
1084 | break; | 1084 | break; |
1085 | 1085 | ||
1086 | case TRUEPHY_ADV_DUPLEX_BOTH: | 1086 | case TRUEPHY_ADV_DUPLEX_BOTH: |
1087 | default: | 1087 | default: |
1088 | usData |= 0x0300; | 1088 | data |= 0x0300; |
1089 | break; | 1089 | break; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | /* Write back advertisement */ | 1092 | /* Write back advertisement */ |
1093 | MiWrite(etdev, PHY_1000_CONTROL, usData); | 1093 | MiWrite(etdev, PHY_1000_CONTROL, data); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, | 1096 | void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, |
1097 | uint16_t duplex) | 1097 | uint16_t duplex) |
1098 | { | 1098 | { |
1099 | uint16_t usData; | 1099 | uint16_t data; |
1100 | 1100 | ||
1101 | /* Read the Autonegotiation Register (10/100) */ | 1101 | /* Read the Autonegotiation Register (10/100) */ |
1102 | MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData); | 1102 | MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); |
1103 | 1103 | ||
1104 | /* Clear bits 7,8 */ | 1104 | /* Clear bits 7,8 */ |
1105 | usData &= ~0x0180; | 1105 | data &= ~0x0180; |
1106 | 1106 | ||
1107 | switch (duplex) { | 1107 | switch (duplex) { |
1108 | case TRUEPHY_ADV_DUPLEX_NONE: | 1108 | case TRUEPHY_ADV_DUPLEX_NONE: |
@@ -1111,35 +1111,35 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, | |||
1111 | 1111 | ||
1112 | case TRUEPHY_ADV_DUPLEX_FULL: | 1112 | case TRUEPHY_ADV_DUPLEX_FULL: |
1113 | /* Set Bit 8 */ | 1113 | /* Set Bit 8 */ |
1114 | usData |= 0x0100; | 1114 | data |= 0x0100; |
1115 | break; | 1115 | break; |
1116 | 1116 | ||
1117 | case TRUEPHY_ADV_DUPLEX_HALF: | 1117 | case TRUEPHY_ADV_DUPLEX_HALF: |
1118 | /* Set Bit 7 */ | 1118 | /* Set Bit 7 */ |
1119 | usData |= 0x0080; | 1119 | data |= 0x0080; |
1120 | break; | 1120 | break; |
1121 | 1121 | ||
1122 | case TRUEPHY_ADV_DUPLEX_BOTH: | 1122 | case TRUEPHY_ADV_DUPLEX_BOTH: |
1123 | default: | 1123 | default: |
1124 | /* Set Bits 7,8 */ | 1124 | /* Set Bits 7,8 */ |
1125 | usData |= 0x0180; | 1125 | data |= 0x0180; |
1126 | break; | 1126 | break; |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | /* Write back advertisement */ | 1129 | /* Write back advertisement */ |
1130 | MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData); | 1130 | MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, | 1133 | void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, |
1134 | uint16_t duplex) | 1134 | uint16_t duplex) |
1135 | { | 1135 | { |
1136 | uint16_t usData; | 1136 | uint16_t data; |
1137 | 1137 | ||
1138 | /* Read the Autonegotiation Register (10/100) */ | 1138 | /* Read the Autonegotiation Register (10/100) */ |
1139 | MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData); | 1139 | MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); |
1140 | 1140 | ||
1141 | /* Clear bits 5,6 */ | 1141 | /* Clear bits 5,6 */ |
1142 | usData &= ~0x0060; | 1142 | data &= ~0x0060; |
1143 | 1143 | ||
1144 | switch (duplex) { | 1144 | switch (duplex) { |
1145 | case TRUEPHY_ADV_DUPLEX_NONE: | 1145 | case TRUEPHY_ADV_DUPLEX_NONE: |
@@ -1148,75 +1148,75 @@ void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, | |||
1148 | 1148 | ||
1149 | case TRUEPHY_ADV_DUPLEX_FULL: | 1149 | case TRUEPHY_ADV_DUPLEX_FULL: |
1150 | /* Set Bit 6 */ | 1150 | /* Set Bit 6 */ |
1151 | usData |= 0x0040; | 1151 | data |= 0x0040; |
1152 | break; | 1152 | break; |
1153 | 1153 | ||
1154 | case TRUEPHY_ADV_DUPLEX_HALF: | 1154 | case TRUEPHY_ADV_DUPLEX_HALF: |
1155 | /* Set Bit 5 */ | 1155 | /* Set Bit 5 */ |
1156 | usData |= 0x0020; | 1156 | data |= 0x0020; |
1157 | break; | 1157 | break; |
1158 | 1158 | ||
1159 | case TRUEPHY_ADV_DUPLEX_BOTH: | 1159 | case TRUEPHY_ADV_DUPLEX_BOTH: |
1160 | default: | 1160 | default: |
1161 | /* Set Bits 5,6 */ | 1161 | /* Set Bits 5,6 */ |
1162 | usData |= 0x0060; | 1162 | data |= 0x0060; |
1163 | break; | 1163 | break; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | /* Write back advertisement */ | 1166 | /* Write back advertisement */ |
1167 | MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData); | 1167 | MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, | 1170 | void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, |
1171 | uint8_t *ucLinkStatus, | 1171 | uint8_t *link_status, |
1172 | uint32_t *uiAutoNeg, | 1172 | uint32_t *autoneg, |
1173 | uint32_t *uiLinkSpeed, | 1173 | uint32_t *linkspeed, |
1174 | uint32_t *uiDuplexMode, | 1174 | uint32_t *duplex_mode, |
1175 | uint32_t *uiMdiMdix, | 1175 | uint32_t *mdi_mdix, |
1176 | uint32_t *uiMasterSlave, uint32_t *uiPolarity) | 1176 | uint32_t *masterslave, uint32_t *polarity) |
1177 | { | 1177 | { |
1178 | uint16_t usMiStatus = 0; | 1178 | uint16_t mistatus = 0; |
1179 | uint16_t us1000BaseT = 0; | 1179 | uint16_t is1000BaseT = 0; |
1180 | uint16_t usVmiPhyStatus = 0; | 1180 | uint16_t vmi_phystatus = 0; |
1181 | uint16_t usControl = 0; | 1181 | uint16_t control = 0; |
1182 | 1182 | ||
1183 | MiRead(etdev, PHY_STATUS, &usMiStatus); | 1183 | MiRead(etdev, PHY_STATUS, &mistatus); |
1184 | MiRead(etdev, PHY_1000_STATUS, &us1000BaseT); | 1184 | MiRead(etdev, PHY_1000_STATUS, &is1000BaseT); |
1185 | MiRead(etdev, PHY_PHY_STATUS, &usVmiPhyStatus); | 1185 | MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus); |
1186 | MiRead(etdev, PHY_CONTROL, &usControl); | 1186 | MiRead(etdev, PHY_CONTROL, &control); |
1187 | 1187 | ||
1188 | if (ucLinkStatus) { | 1188 | if (link_status) { |
1189 | *ucLinkStatus = | 1189 | *link_status = |
1190 | (unsigned char)((usVmiPhyStatus & 0x0040) ? 1 : 0); | 1190 | (unsigned char)((vmi_phystatus & 0x0040) ? 1 : 0); |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | if (uiAutoNeg) { | 1193 | if (autoneg) { |
1194 | *uiAutoNeg = | 1194 | *autoneg = |
1195 | (usControl & 0x1000) ? ((usVmiPhyStatus & 0x0020) ? | 1195 | (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? |
1196 | TRUEPHY_ANEG_COMPLETE : | 1196 | TRUEPHY_ANEG_COMPLETE : |
1197 | TRUEPHY_ANEG_NOT_COMPLETE) : | 1197 | TRUEPHY_ANEG_NOT_COMPLETE) : |
1198 | TRUEPHY_ANEG_DISABLED; | 1198 | TRUEPHY_ANEG_DISABLED; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | if (uiLinkSpeed) | 1201 | if (linkspeed) |
1202 | *uiLinkSpeed = (usVmiPhyStatus & 0x0300) >> 8; | 1202 | *linkspeed = (vmi_phystatus & 0x0300) >> 8; |
1203 | 1203 | ||
1204 | if (uiDuplexMode) | 1204 | if (duplex_mode) |
1205 | *uiDuplexMode = (usVmiPhyStatus & 0x0080) >> 7; | 1205 | *duplex_mode = (vmi_phystatus & 0x0080) >> 7; |
1206 | 1206 | ||
1207 | if (uiMdiMdix) | 1207 | if (mdi_mdix) |
1208 | /* NOTE: Need to complete this */ | 1208 | /* NOTE: Need to complete this */ |
1209 | *uiMdiMdix = 0; | 1209 | *mdi_mdix = 0; |
1210 | 1210 | ||
1211 | if (uiMasterSlave) { | 1211 | if (masterslave) { |
1212 | *uiMasterSlave = | 1212 | *masterslave = |
1213 | (us1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER : | 1213 | (is1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER : |
1214 | TRUEPHY_CFG_SLAVE; | 1214 | TRUEPHY_CFG_SLAVE; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | if (uiPolarity) { | 1217 | if (polarity) { |
1218 | *uiPolarity = | 1218 | *polarity = |
1219 | (usVmiPhyStatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED : | 1219 | (vmi_phystatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED : |
1220 | TRUEPHY_POLARITY_NORMAL; | 1220 | TRUEPHY_POLARITY_NORMAL; |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h index 34e08e889ef7..aec0a7b432eb 100644 --- a/drivers/staging/et131x/et1310_phy.h +++ b/drivers/staging/et131x/et1310_phy.h | |||
@@ -895,12 +895,12 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *adapter, | |||
895 | void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter, | 895 | void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter, |
896 | u16 duplex); | 896 | u16 duplex); |
897 | void ET1310_PhyLinkStatus(struct et131x_adapter *adapter, | 897 | void ET1310_PhyLinkStatus(struct et131x_adapter *adapter, |
898 | u8 *ucLinkStatus, | 898 | u8 *Link_status, |
899 | u32 *uiAutoNeg, | 899 | u32 *autoneg, |
900 | u32 *uiLinkSpeed, | 900 | u32 *linkspeed, |
901 | u32 *uiDuplexMode, | 901 | u32 *duplex_mode, |
902 | u32 *uiMdiMdix, | 902 | u32 *mdi_mdix, |
903 | u32 *uiMasterSlave, u32 *uiPolarity); | 903 | u32 *masterslave, u32 *polarity); |
904 | void ET1310_PhyAndOrReg(struct et131x_adapter *adapter, | 904 | void ET1310_PhyAndOrReg(struct et131x_adapter *adapter, |
905 | u16 regnum, u16 andMask, u16 orMask); | 905 | u16 regnum, u16 andMask, u16 orMask); |
906 | void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter, | 906 | void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter, |
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 53efa081274c..7f36de04703b 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
@@ -680,10 +680,10 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd) | |||
680 | */ | 680 | */ |
681 | void ConfigRxDmaRegs(struct et131x_adapter *etdev) | 681 | void ConfigRxDmaRegs(struct et131x_adapter *etdev) |
682 | { | 682 | { |
683 | struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma; | 683 | struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma; |
684 | struct _rx_ring_t *pRxLocal = &etdev->RxRing; | 684 | struct _rx_ring_t *pRxLocal = &etdev->RxRing; |
685 | PFBR_DESC_t pFbrEntry; | 685 | PFBR_DESC_t fbr_entry; |
686 | uint32_t iEntry; | 686 | uint32_t entry; |
687 | RXDMA_PSR_NUM_DES_t psr_num_des; | 687 | RXDMA_PSR_NUM_DES_t psr_num_des; |
688 | unsigned long flags; | 688 | unsigned long flags; |
689 | 689 | ||
@@ -700,8 +700,8 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
700 | * before storing the adjusted address. | 700 | * before storing the adjusted address. |
701 | */ | 701 | */ |
702 | writel((uint32_t) (pRxLocal->RxStatusRealPA >> 32), | 702 | writel((uint32_t) (pRxLocal->RxStatusRealPA >> 32), |
703 | &pRxDma->dma_wb_base_hi); | 703 | &rx_dma->dma_wb_base_hi); |
704 | writel((uint32_t) pRxLocal->RxStatusRealPA, &pRxDma->dma_wb_base_lo); | 704 | writel((uint32_t) pRxLocal->RxStatusRealPA, &rx_dma->dma_wb_base_lo); |
705 | 705 | ||
706 | memset(pRxLocal->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t)); | 706 | memset(pRxLocal->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t)); |
707 | 707 | ||
@@ -709,14 +709,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
709 | * 1310's registers | 709 | * 1310's registers |
710 | */ | 710 | */ |
711 | writel((uint32_t) (pRxLocal->pPSRingRealPa >> 32), | 711 | writel((uint32_t) (pRxLocal->pPSRingRealPa >> 32), |
712 | &pRxDma->psr_base_hi); | 712 | &rx_dma->psr_base_hi); |
713 | writel((uint32_t) pRxLocal->pPSRingRealPa, &pRxDma->psr_base_lo); | 713 | writel((uint32_t) pRxLocal->pPSRingRealPa, &rx_dma->psr_base_lo); |
714 | writel(pRxLocal->PsrNumEntries - 1, &pRxDma->psr_num_des.value); | 714 | writel(pRxLocal->PsrNumEntries - 1, &rx_dma->psr_num_des.value); |
715 | writel(0, &pRxDma->psr_full_offset.value); | 715 | writel(0, &rx_dma->psr_full_offset.value); |
716 | 716 | ||
717 | psr_num_des.value = readl(&pRxDma->psr_num_des.value); | 717 | psr_num_des.value = readl(&rx_dma->psr_num_des.value); |
718 | writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100, | 718 | writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100, |
719 | &pRxDma->psr_min_des.value); | 719 | &rx_dma->psr_min_des.value); |
720 | 720 | ||
721 | spin_lock_irqsave(&etdev->RcvLock, flags); | 721 | spin_lock_irqsave(&etdev->RcvLock, flags); |
722 | 722 | ||
@@ -725,27 +725,27 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
725 | pRxLocal->local_psr_full.bits.psr_full_wrap = 0; | 725 | pRxLocal->local_psr_full.bits.psr_full_wrap = 0; |
726 | 726 | ||
727 | /* Now's the best time to initialize FBR1 contents */ | 727 | /* Now's the best time to initialize FBR1 contents */ |
728 | pFbrEntry = (PFBR_DESC_t) pRxLocal->pFbr1RingVa; | 728 | fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr1RingVa; |
729 | for (iEntry = 0; iEntry < pRxLocal->Fbr1NumEntries; iEntry++) { | 729 | for (entry = 0; entry < pRxLocal->Fbr1NumEntries; entry++) { |
730 | pFbrEntry->addr_hi = pRxLocal->Fbr[1]->PAHigh[iEntry]; | 730 | fbr_entry->addr_hi = pRxLocal->Fbr[1]->PAHigh[entry]; |
731 | pFbrEntry->addr_lo = pRxLocal->Fbr[1]->PALow[iEntry]; | 731 | fbr_entry->addr_lo = pRxLocal->Fbr[1]->PALow[entry]; |
732 | pFbrEntry->word2.bits.bi = iEntry; | 732 | fbr_entry->word2.bits.bi = entry; |
733 | pFbrEntry++; | 733 | fbr_entry++; |
734 | } | 734 | } |
735 | 735 | ||
736 | /* Set the address and parameters of Free buffer ring 1 (and 0 if | 736 | /* Set the address and parameters of Free buffer ring 1 (and 0 if |
737 | * required) into the 1310's registers | 737 | * required) into the 1310's registers |
738 | */ | 738 | */ |
739 | writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &pRxDma->fbr1_base_hi); | 739 | writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); |
740 | writel((uint32_t) pRxLocal->Fbr1Realpa, &pRxDma->fbr1_base_lo); | 740 | writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo); |
741 | writel(pRxLocal->Fbr1NumEntries - 1, &pRxDma->fbr1_num_des.value); | 741 | writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); |
742 | 742 | ||
743 | { | 743 | { |
744 | DMA10W_t fbr1_full = { 0 }; | 744 | DMA10W_t fbr1_full = { 0 }; |
745 | 745 | ||
746 | fbr1_full.bits.val = 0; | 746 | fbr1_full.bits.val = 0; |
747 | fbr1_full.bits.wrap = 1; | 747 | fbr1_full.bits.wrap = 1; |
748 | writel(fbr1_full.value, &pRxDma->fbr1_full_offset.value); | 748 | writel(fbr1_full.value, &rx_dma->fbr1_full_offset.value); |
749 | } | 749 | } |
750 | 750 | ||
751 | /* This variable tracks the free buffer ring 1 full position, so it | 751 | /* This variable tracks the free buffer ring 1 full position, so it |
@@ -754,28 +754,28 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
754 | pRxLocal->local_Fbr1_full.bits.val = 0; | 754 | pRxLocal->local_Fbr1_full.bits.val = 0; |
755 | pRxLocal->local_Fbr1_full.bits.wrap = 1; | 755 | pRxLocal->local_Fbr1_full.bits.wrap = 1; |
756 | writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 756 | writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
757 | &pRxDma->fbr1_min_des.value); | 757 | &rx_dma->fbr1_min_des.value); |
758 | 758 | ||
759 | #ifdef USE_FBR0 | 759 | #ifdef USE_FBR0 |
760 | /* Now's the best time to initialize FBR0 contents */ | 760 | /* Now's the best time to initialize FBR0 contents */ |
761 | pFbrEntry = (PFBR_DESC_t) pRxLocal->pFbr0RingVa; | 761 | fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr0RingVa; |
762 | for (iEntry = 0; iEntry < pRxLocal->Fbr0NumEntries; iEntry++) { | 762 | for (entry = 0; entry < pRxLocal->Fbr0NumEntries; entry++) { |
763 | pFbrEntry->addr_hi = pRxLocal->Fbr[0]->PAHigh[iEntry]; | 763 | fbr_entry->addr_hi = pRxLocal->Fbr[0]->PAHigh[entry]; |
764 | pFbrEntry->addr_lo = pRxLocal->Fbr[0]->PALow[iEntry]; | 764 | fbr_entry->addr_lo = pRxLocal->Fbr[0]->PALow[entry]; |
765 | pFbrEntry->word2.bits.bi = iEntry; | 765 | fbr_entry->word2.bits.bi = entry; |
766 | pFbrEntry++; | 766 | fbr_entry++; |
767 | } | 767 | } |
768 | 768 | ||
769 | writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &pRxDma->fbr0_base_hi); | 769 | writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); |
770 | writel((uint32_t) pRxLocal->Fbr0Realpa, &pRxDma->fbr0_base_lo); | 770 | writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo); |
771 | writel(pRxLocal->Fbr0NumEntries - 1, &pRxDma->fbr0_num_des.value); | 771 | writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); |
772 | 772 | ||
773 | { | 773 | { |
774 | DMA10W_t fbr0_full = { 0 }; | 774 | DMA10W_t fbr0_full = { 0 }; |
775 | 775 | ||
776 | fbr0_full.bits.val = 0; | 776 | fbr0_full.bits.val = 0; |
777 | fbr0_full.bits.wrap = 1; | 777 | fbr0_full.bits.wrap = 1; |
778 | writel(fbr0_full.value, &pRxDma->fbr0_full_offset.value); | 778 | writel(fbr0_full.value, &rx_dma->fbr0_full_offset.value); |
779 | } | 779 | } |
780 | 780 | ||
781 | /* This variable tracks the free buffer ring 0 full position, so it | 781 | /* This variable tracks the free buffer ring 0 full position, so it |
@@ -784,7 +784,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
784 | pRxLocal->local_Fbr0_full.bits.val = 0; | 784 | pRxLocal->local_Fbr0_full.bits.val = 0; |
785 | pRxLocal->local_Fbr0_full.bits.wrap = 1; | 785 | pRxLocal->local_Fbr0_full.bits.wrap = 1; |
786 | writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 786 | writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
787 | &pRxDma->fbr0_min_des.value); | 787 | &rx_dma->fbr0_min_des.value); |
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | /* Program the number of packets we will receive before generating an | 790 | /* Program the number of packets we will receive before generating an |
@@ -792,14 +792,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
792 | * For version B silicon, this value gets updated once autoneg is | 792 | * For version B silicon, this value gets updated once autoneg is |
793 | *complete. | 793 | *complete. |
794 | */ | 794 | */ |
795 | writel(PARM_RX_NUM_BUFS_DEF, &pRxDma->num_pkt_done.value); | 795 | writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done.value); |
796 | 796 | ||
797 | /* The "time_done" is not working correctly to coalesce interrupts | 797 | /* The "time_done" is not working correctly to coalesce interrupts |
798 | * after a given time period, but rather is giving us an interrupt | 798 | * after a given time period, but rather is giving us an interrupt |
799 | * regardless of whether we have received packets. | 799 | * regardless of whether we have received packets. |
800 | * This value gets updated once autoneg is complete. | 800 | * This value gets updated once autoneg is complete. |
801 | */ | 801 | */ |
802 | writel(PARM_RX_TIME_INT_DEF, &pRxDma->max_pkt_time.value); | 802 | writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time.value); |
803 | 803 | ||
804 | spin_unlock_irqrestore(&etdev->RcvLock, flags); | 804 | spin_unlock_irqrestore(&etdev->RcvLock, flags); |
805 | 805 | ||
@@ -815,8 +815,8 @@ void SetRxDmaTimer(struct et131x_adapter *etdev) | |||
815 | /* For version B silicon, we do not use the RxDMA timer for 10 and 100 | 815 | /* For version B silicon, we do not use the RxDMA timer for 10 and 100 |
816 | * Mbits/s line rates. We do not enable and RxDMA interrupt coalescing. | 816 | * Mbits/s line rates. We do not enable and RxDMA interrupt coalescing. |
817 | */ | 817 | */ |
818 | if ((etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) || | 818 | if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) || |
819 | (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS)) { | 819 | (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) { |
820 | writel(0, &etdev->regs->rxdma.max_pkt_time.value); | 820 | writel(0, &etdev->regs->rxdma.max_pkt_time.value); |
821 | writel(1, &etdev->regs->rxdma.num_pkt_done.value); | 821 | writel(1, &etdev->regs->rxdma.num_pkt_done.value); |
822 | } | 822 | } |
@@ -1032,8 +1032,8 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) | |||
1032 | 1032 | ||
1033 | spin_unlock_irqrestore(&etdev->RcvLock, flags); | 1033 | spin_unlock_irqrestore(&etdev->RcvLock, flags); |
1034 | 1034 | ||
1035 | pMpRfd->iBufferIndex = bufferIndex; | 1035 | pMpRfd->bufferindex = bufferIndex; |
1036 | pMpRfd->iRingIndex = ringIndex; | 1036 | pMpRfd->ringindex = ringIndex; |
1037 | 1037 | ||
1038 | /* In V1 silicon, there is a bug which screws up filtering of | 1038 | /* In V1 silicon, there is a bug which screws up filtering of |
1039 | * runt packets. Therefore runt packet filtering is disabled | 1039 | * runt packets. Therefore runt packet filtering is disabled |
@@ -1289,10 +1289,10 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) | |||
1289 | */ | 1289 | */ |
1290 | void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | 1290 | void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) |
1291 | { | 1291 | { |
1292 | struct _rx_ring_t *pRxLocal = &etdev->RxRing; | 1292 | struct _rx_ring_t *rx_local = &etdev->RxRing; |
1293 | struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma; | 1293 | struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma; |
1294 | uint16_t bi = pMpRfd->iBufferIndex; | 1294 | uint16_t bi = pMpRfd->bufferindex; |
1295 | uint8_t ri = pMpRfd->iRingIndex; | 1295 | uint8_t ri = pMpRfd->ringindex; |
1296 | unsigned long flags; | 1296 | unsigned long flags; |
1297 | 1297 | ||
1298 | DBG_RX_ENTER(et131x_dbginfo); | 1298 | DBG_RX_ENTER(et131x_dbginfo); |
@@ -1302,55 +1302,55 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | |||
1302 | */ | 1302 | */ |
1303 | if ( | 1303 | if ( |
1304 | #ifdef USE_FBR0 | 1304 | #ifdef USE_FBR0 |
1305 | (ri == 0 && bi < pRxLocal->Fbr0NumEntries) || | 1305 | (ri == 0 && bi < rx_local->Fbr0NumEntries) || |
1306 | #endif | 1306 | #endif |
1307 | (ri == 1 && bi < pRxLocal->Fbr1NumEntries)) { | 1307 | (ri == 1 && bi < rx_local->Fbr1NumEntries)) { |
1308 | spin_lock_irqsave(&etdev->FbrLock, flags); | 1308 | spin_lock_irqsave(&etdev->FbrLock, flags); |
1309 | 1309 | ||
1310 | if (ri == 1) { | 1310 | if (ri == 1) { |
1311 | PFBR_DESC_t pNextDesc = | 1311 | PFBR_DESC_t pNextDesc = |
1312 | (PFBR_DESC_t) (pRxLocal->pFbr1RingVa) + | 1312 | (PFBR_DESC_t) (rx_local->pFbr1RingVa) + |
1313 | pRxLocal->local_Fbr1_full.bits.val; | 1313 | rx_local->local_Fbr1_full.bits.val; |
1314 | 1314 | ||
1315 | /* Handle the Free Buffer Ring advancement here. Write | 1315 | /* Handle the Free Buffer Ring advancement here. Write |
1316 | * the PA / Buffer Index for the returned buffer into | 1316 | * the PA / Buffer Index for the returned buffer into |
1317 | * the oldest (next to be freed)FBR entry | 1317 | * the oldest (next to be freed)FBR entry |
1318 | */ | 1318 | */ |
1319 | pNextDesc->addr_hi = pRxLocal->Fbr[1]->PAHigh[bi]; | 1319 | pNextDesc->addr_hi = rx_local->Fbr[1]->PAHigh[bi]; |
1320 | pNextDesc->addr_lo = pRxLocal->Fbr[1]->PALow[bi]; | 1320 | pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi]; |
1321 | pNextDesc->word2.value = bi; | 1321 | pNextDesc->word2.value = bi; |
1322 | 1322 | ||
1323 | if (++pRxLocal->local_Fbr1_full.bits.val > | 1323 | if (++rx_local->local_Fbr1_full.bits.val > |
1324 | (pRxLocal->Fbr1NumEntries - 1)) { | 1324 | (rx_local->Fbr1NumEntries - 1)) { |
1325 | pRxLocal->local_Fbr1_full.bits.val = 0; | 1325 | rx_local->local_Fbr1_full.bits.val = 0; |
1326 | pRxLocal->local_Fbr1_full.bits.wrap ^= 1; | 1326 | rx_local->local_Fbr1_full.bits.wrap ^= 1; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | writel(pRxLocal->local_Fbr1_full.value, | 1329 | writel(rx_local->local_Fbr1_full.value, |
1330 | &pRxDma->fbr1_full_offset.value); | 1330 | &rx_dma->fbr1_full_offset.value); |
1331 | } | 1331 | } |
1332 | #ifdef USE_FBR0 | 1332 | #ifdef USE_FBR0 |
1333 | else { | 1333 | else { |
1334 | PFBR_DESC_t pNextDesc = | 1334 | PFBR_DESC_t pNextDesc = |
1335 | (PFBR_DESC_t) pRxLocal->pFbr0RingVa + | 1335 | (PFBR_DESC_t) rx_local->pFbr0RingVa + |
1336 | pRxLocal->local_Fbr0_full.bits.val; | 1336 | rx_local->local_Fbr0_full.bits.val; |
1337 | 1337 | ||
1338 | /* Handle the Free Buffer Ring advancement here. Write | 1338 | /* Handle the Free Buffer Ring advancement here. Write |
1339 | * the PA / Buffer Index for the returned buffer into | 1339 | * the PA / Buffer Index for the returned buffer into |
1340 | * the oldest (next to be freed) FBR entry | 1340 | * the oldest (next to be freed) FBR entry |
1341 | */ | 1341 | */ |
1342 | pNextDesc->addr_hi = pRxLocal->Fbr[0]->PAHigh[bi]; | 1342 | pNextDesc->addr_hi = rx_local->Fbr[0]->PAHigh[bi]; |
1343 | pNextDesc->addr_lo = pRxLocal->Fbr[0]->PALow[bi]; | 1343 | pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi]; |
1344 | pNextDesc->word2.value = bi; | 1344 | pNextDesc->word2.value = bi; |
1345 | 1345 | ||
1346 | if (++pRxLocal->local_Fbr0_full.bits.val > | 1346 | if (++rx_local->local_Fbr0_full.bits.val > |
1347 | (pRxLocal->Fbr0NumEntries - 1)) { | 1347 | (rx_local->Fbr0NumEntries - 1)) { |
1348 | pRxLocal->local_Fbr0_full.bits.val = 0; | 1348 | rx_local->local_Fbr0_full.bits.val = 0; |
1349 | pRxLocal->local_Fbr0_full.bits.wrap ^= 1; | 1349 | rx_local->local_Fbr0_full.bits.wrap ^= 1; |
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | writel(pRxLocal->local_Fbr0_full.value, | 1352 | writel(rx_local->local_Fbr0_full.value, |
1353 | &pRxDma->fbr0_full_offset.value); | 1353 | &rx_dma->fbr0_full_offset.value); |
1354 | } | 1354 | } |
1355 | #endif | 1355 | #endif |
1356 | spin_unlock_irqrestore(&etdev->FbrLock, flags); | 1356 | spin_unlock_irqrestore(&etdev->FbrLock, flags); |
@@ -1363,10 +1363,10 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) | |||
1363 | * our list | 1363 | * our list |
1364 | */ | 1364 | */ |
1365 | spin_lock_irqsave(&etdev->RcvLock, flags); | 1365 | spin_lock_irqsave(&etdev->RcvLock, flags); |
1366 | list_add_tail(&pMpRfd->list_node, &pRxLocal->RecvList); | 1366 | list_add_tail(&pMpRfd->list_node, &rx_local->RecvList); |
1367 | pRxLocal->nReadyRecv++; | 1367 | rx_local->nReadyRecv++; |
1368 | spin_unlock_irqrestore(&etdev->RcvLock, flags); | 1368 | spin_unlock_irqrestore(&etdev->RcvLock, flags); |
1369 | 1369 | ||
1370 | DBG_ASSERT(pRxLocal->nReadyRecv <= pRxLocal->NumRfd); | 1370 | DBG_ASSERT(rx_local->nReadyRecv <= rx_local->NumRfd); |
1371 | DBG_RX_LEAVE(et131x_dbginfo); | 1371 | DBG_RX_LEAVE(et131x_dbginfo); |
1372 | } | 1372 | } |
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 8472c1b33f33..16aef44d9e0d 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c | |||
@@ -246,22 +246,22 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) | |||
246 | 246 | ||
247 | /** | 247 | /** |
248 | * ConfigTxDmaRegs - Set up the tx dma section of the JAGCore. | 248 | * ConfigTxDmaRegs - Set up the tx dma section of the JAGCore. |
249 | * @adapter: pointer to our private adapter structure | 249 | * @etdev: pointer to our private adapter structure |
250 | */ | 250 | */ |
251 | void ConfigTxDmaRegs(struct et131x_adapter *etdev) | 251 | void ConfigTxDmaRegs(struct et131x_adapter *etdev) |
252 | { | 252 | { |
253 | struct _TXDMA_t __iomem *pTxDma = &etdev->regs->txdma; | 253 | struct _TXDMA_t __iomem *txdma = &etdev->regs->txdma; |
254 | 254 | ||
255 | DBG_ENTER(et131x_dbginfo); | 255 | DBG_ENTER(et131x_dbginfo); |
256 | 256 | ||
257 | /* Load the hardware with the start of the transmit descriptor ring. */ | 257 | /* Load the hardware with the start of the transmit descriptor ring. */ |
258 | writel((uint32_t) (etdev->TxRing.pTxDescRingAdjustedPa >> 32), | 258 | writel((uint32_t) (etdev->TxRing.pTxDescRingAdjustedPa >> 32), |
259 | &pTxDma->pr_base_hi); | 259 | &txdma->pr_base_hi); |
260 | writel((uint32_t) etdev->TxRing.pTxDescRingAdjustedPa, | 260 | writel((uint32_t) etdev->TxRing.pTxDescRingAdjustedPa, |
261 | &pTxDma->pr_base_lo); | 261 | &txdma->pr_base_lo); |
262 | 262 | ||
263 | /* Initialise the transmit DMA engine */ | 263 | /* Initialise the transmit DMA engine */ |
264 | writel(NUM_DESC_PER_RING_TX - 1, &pTxDma->pr_num_des.value); | 264 | writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value); |
265 | 265 | ||
266 | /* Load the completion writeback physical address | 266 | /* Load the completion writeback physical address |
267 | * | 267 | * |
@@ -270,12 +270,12 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) | |||
270 | * are ever returned, make sure the high part is retrieved here before | 270 | * are ever returned, make sure the high part is retrieved here before |
271 | * storing the adjusted address. | 271 | * storing the adjusted address. |
272 | */ | 272 | */ |
273 | writel(0, &pTxDma->dma_wb_base_hi); | 273 | writel(0, &txdma->dma_wb_base_hi); |
274 | writel(etdev->TxRing.pTxStatusPa, &pTxDma->dma_wb_base_lo); | 274 | writel(etdev->TxRing.pTxStatusPa, &txdma->dma_wb_base_lo); |
275 | 275 | ||
276 | memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); | 276 | memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); |
277 | 277 | ||
278 | writel(0, &pTxDma->service_request.value); | 278 | writel(0, &txdma->service_request.value); |
279 | etdev->TxRing.txDmaReadyToSend.value = 0; | 279 | etdev->TxRing.txDmaReadyToSend.value = 0; |
280 | 280 | ||
281 | DBG_LEAVE(et131x_dbginfo); | 281 | DBG_LEAVE(et131x_dbginfo); |
@@ -461,7 +461,7 @@ static int et131x_send_packet(struct sk_buff *skb, | |||
461 | { | 461 | { |
462 | int status = 0; | 462 | int status = 0; |
463 | PMP_TCB pMpTcb = NULL; | 463 | PMP_TCB pMpTcb = NULL; |
464 | uint16_t *pShBufVa; | 464 | uint16_t *shbufva; |
465 | unsigned long flags; | 465 | unsigned long flags; |
466 | 466 | ||
467 | DBG_TX_ENTER(et131x_dbginfo); | 467 | DBG_TX_ENTER(et131x_dbginfo); |
@@ -506,12 +506,12 @@ static int et131x_send_packet(struct sk_buff *skb, | |||
506 | pMpTcb->Packet = skb; | 506 | pMpTcb->Packet = skb; |
507 | 507 | ||
508 | if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { | 508 | if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { |
509 | pShBufVa = (uint16_t *) skb->data; | 509 | shbufva = (uint16_t *) skb->data; |
510 | 510 | ||
511 | if ((pShBufVa[0] == 0xffff) && | 511 | if ((shbufva[0] == 0xffff) && |
512 | (pShBufVa[1] == 0xffff) && (pShBufVa[2] == 0xffff)) { | 512 | (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { |
513 | MP_SET_FLAG(pMpTcb, fMP_DEST_BROAD); | 513 | MP_SET_FLAG(pMpTcb, fMP_DEST_BROAD); |
514 | } else if ((pShBufVa[0] & 0x3) == 0x0001) { | 514 | } else if ((shbufva[0] & 0x3) == 0x0001) { |
515 | MP_SET_FLAG(pMpTcb, fMP_DEST_MULTI); | 515 | MP_SET_FLAG(pMpTcb, fMP_DEST_MULTI); |
516 | } | 516 | } |
517 | } | 517 | } |
@@ -558,7 +558,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
558 | uint32_t loopIndex; | 558 | uint32_t loopIndex; |
559 | TX_DESC_ENTRY_t CurDesc[24]; | 559 | TX_DESC_ENTRY_t CurDesc[24]; |
560 | uint32_t FragmentNumber = 0; | 560 | uint32_t FragmentNumber = 0; |
561 | uint32_t iThisCopy, iRemainder; | 561 | uint32_t thiscopy, remainder; |
562 | struct sk_buff *pPacket = pMpTcb->Packet; | 562 | struct sk_buff *pPacket = pMpTcb->Packet; |
563 | uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1; | 563 | uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1; |
564 | struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0]; | 564 | struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0]; |
@@ -710,7 +710,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
710 | return -EIO; | 710 | return -EIO; |
711 | } | 711 | } |
712 | 712 | ||
713 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) { | 713 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { |
714 | if (++etdev->TxRing.TxPacketsSinceLastinterrupt == | 714 | if (++etdev->TxRing.TxPacketsSinceLastinterrupt == |
715 | PARM_TX_NUM_BUFS_DEF) { | 715 | PARM_TX_NUM_BUFS_DEF) { |
716 | CurDesc[FragmentNumber - 1].word3.value = 0x5; | 716 | CurDesc[FragmentNumber - 1].word3.value = 0x5; |
@@ -729,21 +729,21 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
729 | 729 | ||
730 | spin_lock_irqsave(&etdev->SendHWLock, flags); | 730 | spin_lock_irqsave(&etdev->SendHWLock, flags); |
731 | 731 | ||
732 | iThisCopy = | 732 | thiscopy = |
733 | NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val; | 733 | NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val; |
734 | 734 | ||
735 | if (iThisCopy >= FragmentNumber) { | 735 | if (thiscopy >= FragmentNumber) { |
736 | iRemainder = 0; | 736 | remainder = 0; |
737 | iThisCopy = FragmentNumber; | 737 | thiscopy = FragmentNumber; |
738 | } else { | 738 | } else { |
739 | iRemainder = FragmentNumber - iThisCopy; | 739 | remainder = FragmentNumber - thiscopy; |
740 | } | 740 | } |
741 | 741 | ||
742 | memcpy(etdev->TxRing.pTxDescRingVa + | 742 | memcpy(etdev->TxRing.pTxDescRingVa + |
743 | etdev->TxRing.txDmaReadyToSend.bits.val, CurDesc, | 743 | etdev->TxRing.txDmaReadyToSend.bits.val, CurDesc, |
744 | sizeof(TX_DESC_ENTRY_t) * iThisCopy); | 744 | sizeof(TX_DESC_ENTRY_t) * thiscopy); |
745 | 745 | ||
746 | etdev->TxRing.txDmaReadyToSend.bits.val += iThisCopy; | 746 | etdev->TxRing.txDmaReadyToSend.bits.val += thiscopy; |
747 | 747 | ||
748 | if ((etdev->TxRing.txDmaReadyToSend.bits.val == 0) || | 748 | if ((etdev->TxRing.txDmaReadyToSend.bits.val == 0) || |
749 | (etdev->TxRing.txDmaReadyToSend.bits.val == | 749 | (etdev->TxRing.txDmaReadyToSend.bits.val == |
@@ -754,12 +754,12 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
754 | etdev->TxRing.txDmaReadyToSend.value = 0x400; | 754 | etdev->TxRing.txDmaReadyToSend.value = 0x400; |
755 | } | 755 | } |
756 | 756 | ||
757 | if (iRemainder) { | 757 | if (remainder) { |
758 | memcpy(etdev->TxRing.pTxDescRingVa, | 758 | memcpy(etdev->TxRing.pTxDescRingVa, |
759 | CurDesc + iThisCopy, | 759 | CurDesc + thiscopy, |
760 | sizeof(TX_DESC_ENTRY_t) * iRemainder); | 760 | sizeof(TX_DESC_ENTRY_t) * remainder); |
761 | 761 | ||
762 | etdev->TxRing.txDmaReadyToSend.bits.val += iRemainder; | 762 | etdev->TxRing.txDmaReadyToSend.bits.val += remainder; |
763 | } | 763 | } |
764 | 764 | ||
765 | if (etdev->TxRing.txDmaReadyToSend.bits.val == 0) { | 765 | if (etdev->TxRing.txDmaReadyToSend.bits.val == 0) { |
@@ -794,7 +794,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
794 | /* For Gig only, we use Tx Interrupt coalescing. Enable the software | 794 | /* For Gig only, we use Tx Interrupt coalescing. Enable the software |
795 | * timer to wake us up if this packet isn't followed by N more. | 795 | * timer to wake us up if this packet isn't followed by N more. |
796 | */ | 796 | */ |
797 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) { | 797 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { |
798 | writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, | 798 | writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, |
799 | &etdev->regs->global.watchdog_timer); | 799 | &etdev->regs->global.watchdog_timer); |
800 | } | 800 | } |
@@ -824,7 +824,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
824 | static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | 824 | static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) |
825 | { | 825 | { |
826 | uint32_t loopIndex, fragIndex, loopEnd; | 826 | uint32_t loopIndex, fragIndex, loopEnd; |
827 | uint32_t iSplitFirstElement = 0; | 827 | uint32_t splitfirstelem = 0; |
828 | uint32_t SegmentSize = 0; | 828 | uint32_t SegmentSize = 0; |
829 | TX_DESC_ENTRY_t CurDesc; | 829 | TX_DESC_ENTRY_t CurDesc; |
830 | TX_DESC_ENTRY_t *CurDescPostCopy = NULL; | 830 | TX_DESC_ENTRY_t *CurDescPostCopy = NULL; |
@@ -857,21 +857,21 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
857 | DBG_TX(et131x_dbginfo, | 857 | DBG_TX(et131x_dbginfo, |
858 | "pMpTcb->PacketLength: %d\n", pMpTcb->PacketLength); | 858 | "pMpTcb->PacketLength: %d\n", pMpTcb->PacketLength); |
859 | 859 | ||
860 | if ((etdev->uiDuplexMode == 0) | 860 | if ((etdev->duplex_mode == 0) |
861 | && (pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE)) { | 861 | && (pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE)) { |
862 | DBG_TX(et131x_dbginfo, | 862 | DBG_TX(et131x_dbginfo, |
863 | "HALF DUPLEX mode AND len < MIN_PKT_SIZE\n"); | 863 | "HALF DUPLEX mode AND len < MIN_PKT_SIZE\n"); |
864 | if ((FragListCount & 0x1) == 0) { | 864 | if ((FragListCount & 0x1) == 0) { |
865 | DBG_TX(et131x_dbginfo, | 865 | DBG_TX(et131x_dbginfo, |
866 | "Even number of descs, split 1st elem\n"); | 866 | "Even number of descs, split 1st elem\n"); |
867 | iSplitFirstElement = 1; | 867 | splitfirstelem = 1; |
868 | /* SegmentSize = pFragList[0].size / 2; */ | 868 | /* SegmentSize = pFragList[0].size / 2; */ |
869 | SegmentSize = (pPacket->len - pPacket->data_len) / 2; | 869 | SegmentSize = (pPacket->len - pPacket->data_len) / 2; |
870 | } | 870 | } |
871 | } else if (FragListCount & 0x1) { | 871 | } else if (FragListCount & 0x1) { |
872 | DBG_TX(et131x_dbginfo, "Odd number of descs, split 1st elem\n"); | 872 | DBG_TX(et131x_dbginfo, "Odd number of descs, split 1st elem\n"); |
873 | 873 | ||
874 | iSplitFirstElement = 1; | 874 | splitfirstelem = 1; |
875 | /* SegmentSize = pFragList[0].size / 2; */ | 875 | /* SegmentSize = pFragList[0].size / 2; */ |
876 | SegmentSize = (pPacket->len - pPacket->data_len) / 2; | 876 | SegmentSize = (pPacket->len - pPacket->data_len) / 2; |
877 | } | 877 | } |
@@ -894,26 +894,26 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
894 | etdev->TxRing.txDmaReadyToSend.bits.serv_req; | 894 | etdev->TxRing.txDmaReadyToSend.bits.serv_req; |
895 | } | 895 | } |
896 | 896 | ||
897 | if ((FragListCount + iSplitFirstElement) > SlotsAvailable) { | 897 | if ((FragListCount + splitfirstelem) > SlotsAvailable) { |
898 | DBG_WARNING(et131x_dbginfo, | 898 | DBG_WARNING(et131x_dbginfo, |
899 | "Not Enough Space in Tx Desc Ring\n"); | 899 | "Not Enough Space in Tx Desc Ring\n"); |
900 | spin_unlock_irqrestore(&etdev->SendHWLock, flags); | 900 | spin_unlock_irqrestore(&etdev->SendHWLock, flags); |
901 | return -ENOMEM; | 901 | return -ENOMEM; |
902 | } | 902 | } |
903 | 903 | ||
904 | loopEnd = (FragListCount) + iSplitFirstElement; | 904 | loopEnd = (FragListCount) + splitfirstelem; |
905 | fragIndex = 0; | 905 | fragIndex = 0; |
906 | 906 | ||
907 | DBG_TX(et131x_dbginfo, | 907 | DBG_TX(et131x_dbginfo, |
908 | "TCB : 0x%p\n" | 908 | "TCB : 0x%p\n" |
909 | "Packet (SKB) : 0x%p\t Packet->len: %d\t Packet->data_len: %d\n" | 909 | "Packet (SKB) : 0x%p\t Packet->len: %d\t Packet->data_len: %d\n" |
910 | "FragListCount : %d\t iSplitFirstElement: %d\t loopEnd:%d\n", | 910 | "FragListCount : %d\t splitfirstelem: %d\t loopEnd:%d\n", |
911 | pMpTcb, | 911 | pMpTcb, |
912 | pPacket, pPacket->len, pPacket->data_len, | 912 | pPacket, pPacket->len, pPacket->data_len, |
913 | FragListCount, iSplitFirstElement, loopEnd); | 913 | FragListCount, splitfirstelem, loopEnd); |
914 | 914 | ||
915 | for (loopIndex = 0; loopIndex < loopEnd; loopIndex++) { | 915 | for (loopIndex = 0; loopIndex < loopEnd; loopIndex++) { |
916 | if (loopIndex > iSplitFirstElement) | 916 | if (loopIndex > splitfirstelem) |
917 | fragIndex++; | 917 | fragIndex++; |
918 | 918 | ||
919 | DBG_TX(et131x_dbginfo, | 919 | DBG_TX(et131x_dbginfo, |
@@ -945,7 +945,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
945 | CurDesc.word3.value = 0; | 945 | CurDesc.word3.value = 0; |
946 | 946 | ||
947 | if (fragIndex == 0) { | 947 | if (fragIndex == 0) { |
948 | if (iSplitFirstElement) { | 948 | if (splitfirstelem) { |
949 | DBG_TX(et131x_dbginfo, | 949 | DBG_TX(et131x_dbginfo, |
950 | "Split first element: YES\n"); | 950 | "Split first element: YES\n"); |
951 | 951 | ||
@@ -1055,13 +1055,13 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | if ((loopIndex == (loopEnd - 1)) && | 1057 | if ((loopIndex == (loopEnd - 1)) && |
1058 | (etdev->uiDuplexMode || | 1058 | (etdev->duplex_mode || |
1059 | (pMpTcb->PacketLength >= NIC_MIN_PACKET_SIZE))) { | 1059 | (pMpTcb->PacketLength >= NIC_MIN_PACKET_SIZE))) { |
1060 | /* This is the Last descriptor of the packet */ | 1060 | /* This is the Last descriptor of the packet */ |
1061 | DBG_TX(et131x_dbginfo, | 1061 | DBG_TX(et131x_dbginfo, |
1062 | "THIS is our LAST descriptor\n"); | 1062 | "THIS is our LAST descriptor\n"); |
1063 | 1063 | ||
1064 | if (etdev->uiLinkSpeed == | 1064 | if (etdev->linkspeed == |
1065 | TRUEPHY_SPEED_1000MBPS) { | 1065 | TRUEPHY_SPEED_1000MBPS) { |
1066 | if (++etdev->TxRing. | 1066 | if (++etdev->TxRing. |
1067 | TxPacketsSinceLastinterrupt >= | 1067 | TxPacketsSinceLastinterrupt >= |
@@ -1124,14 +1124,14 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
1124 | } | 1124 | } |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | if (etdev->uiDuplexMode == 0 && | 1127 | if (etdev->duplex_mode == 0 && |
1128 | pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE) { | 1128 | pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE) { |
1129 | /* NOTE - Same 32/64-bit issue as above... */ | 1129 | /* NOTE - Same 32/64-bit issue as above... */ |
1130 | CurDesc.DataBufferPtrHigh = 0x0; | 1130 | CurDesc.DataBufferPtrHigh = 0x0; |
1131 | CurDesc.DataBufferPtrLow = etdev->TxRing.pTxDummyBlkPa; | 1131 | CurDesc.DataBufferPtrLow = etdev->TxRing.pTxDummyBlkPa; |
1132 | CurDesc.word2.value = 0; | 1132 | CurDesc.word2.value = 0; |
1133 | 1133 | ||
1134 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) { | 1134 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { |
1135 | if (++etdev->TxRing.TxPacketsSinceLastinterrupt >= | 1135 | if (++etdev->TxRing.TxPacketsSinceLastinterrupt >= |
1136 | PARM_TX_NUM_BUFS_DEF) { | 1136 | PARM_TX_NUM_BUFS_DEF) { |
1137 | CurDesc.word3.value = 0x5; | 1137 | CurDesc.word3.value = 0x5; |
@@ -1212,7 +1212,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) | |||
1212 | /* For Gig only, we use Tx Interrupt coalescing. Enable the software | 1212 | /* For Gig only, we use Tx Interrupt coalescing. Enable the software |
1213 | * timer to wake us up if this packet isn't followed by N more. | 1213 | * timer to wake us up if this packet isn't followed by N more. |
1214 | */ | 1214 | */ |
1215 | if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) { | 1215 | if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { |
1216 | writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, | 1216 | writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, |
1217 | &etdev->regs->global.watchdog_timer); | 1217 | &etdev->regs->global.watchdog_timer); |
1218 | } | 1218 | } |
@@ -1339,7 +1339,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, | |||
1339 | void et131x_free_busy_send_packets(struct et131x_adapter *etdev) | 1339 | void et131x_free_busy_send_packets(struct et131x_adapter *etdev) |
1340 | { | 1340 | { |
1341 | PMP_TCB pMpTcb; | 1341 | PMP_TCB pMpTcb; |
1342 | struct list_head *pEntry; | 1342 | struct list_head *entry; |
1343 | unsigned long flags; | 1343 | unsigned long flags; |
1344 | uint32_t FreeCounter = 0; | 1344 | uint32_t FreeCounter = 0; |
1345 | 1345 | ||
@@ -1351,7 +1351,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) | |||
1351 | etdev->TxRing.nWaitSend--; | 1351 | etdev->TxRing.nWaitSend--; |
1352 | spin_unlock_irqrestore(&etdev->SendWaitLock, flags); | 1352 | spin_unlock_irqrestore(&etdev->SendWaitLock, flags); |
1353 | 1353 | ||
1354 | pEntry = etdev->TxRing.SendWaitQueue.next; | 1354 | entry = etdev->TxRing.SendWaitQueue.next; |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | etdev->TxRing.nWaitSend = 0; | 1357 | etdev->TxRing.nWaitSend = 0; |
@@ -1496,11 +1496,11 @@ static void et131x_check_send_wait_list(struct et131x_adapter *etdev) | |||
1496 | 1496 | ||
1497 | while (!list_empty(&etdev->TxRing.SendWaitQueue) && | 1497 | while (!list_empty(&etdev->TxRing.SendWaitQueue) && |
1498 | MP_TCB_RESOURCES_AVAILABLE(etdev)) { | 1498 | MP_TCB_RESOURCES_AVAILABLE(etdev)) { |
1499 | struct list_head *pEntry; | 1499 | struct list_head *entry; |
1500 | 1500 | ||
1501 | DBG_VERBOSE(et131x_dbginfo, "Tx packets on the wait queue\n"); | 1501 | DBG_VERBOSE(et131x_dbginfo, "Tx packets on the wait queue\n"); |
1502 | 1502 | ||
1503 | pEntry = etdev->TxRing.SendWaitQueue.next; | 1503 | entry = etdev->TxRing.SendWaitQueue.next; |
1504 | 1504 | ||
1505 | etdev->TxRing.nWaitSend--; | 1505 | etdev->TxRing.nWaitSend--; |
1506 | 1506 | ||
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 63d7c8afada8..3ac2343d4288 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h | |||
@@ -133,8 +133,8 @@ typedef struct _MP_RFD { | |||
133 | struct list_head list_node; | 133 | struct list_head list_node; |
134 | struct sk_buff *Packet; | 134 | struct sk_buff *Packet; |
135 | u32 PacketSize; /* total size of receive frame */ | 135 | u32 PacketSize; /* total size of receive frame */ |
136 | u16 iBufferIndex; | 136 | u16 bufferindex; |
137 | u8 iRingIndex; | 137 | u8 ringindex; |
138 | } MP_RFD, *PMP_RFD; | 138 | } MP_RFD, *PMP_RFD; |
139 | 139 | ||
140 | /* Enum for Flow Control */ | 140 | /* Enum for Flow Control */ |
@@ -214,8 +214,7 @@ struct et131x_adapter { | |||
214 | /* Configuration */ | 214 | /* Configuration */ |
215 | u8 PermanentAddress[ETH_ALEN]; | 215 | u8 PermanentAddress[ETH_ALEN]; |
216 | u8 CurrentAddress[ETH_ALEN]; | 216 | u8 CurrentAddress[ETH_ALEN]; |
217 | bool bOverrideAddress; | 217 | bool has_eeprom; |
218 | bool bEepromPresent; | ||
219 | u8 eepromData[2]; | 218 | u8 eepromData[2]; |
220 | 219 | ||
221 | /* Spinlocks */ | 220 | /* Spinlocks */ |
@@ -234,11 +233,8 @@ struct et131x_adapter { | |||
234 | 233 | ||
235 | /* Packet Filter and look ahead size */ | 234 | /* Packet Filter and look ahead size */ |
236 | u32 PacketFilter; | 235 | u32 PacketFilter; |
237 | u32 ulLookAhead; | 236 | u32 linkspeed; |
238 | u32 uiLinkSpeed; | 237 | u32 duplex_mode; |
239 | u32 uiDuplexMode; | ||
240 | u32 uiAutoNegStatus; | ||
241 | u8 ucLinkStatus; | ||
242 | 238 | ||
243 | /* multicast list */ | 239 | /* multicast list */ |
244 | u32 MCAddressCount; | 240 | u32 MCAddressCount; |
@@ -275,11 +271,7 @@ struct et131x_adapter { | |||
275 | u8 DriverNoPhyAccess; | 271 | u8 DriverNoPhyAccess; |
276 | 272 | ||
277 | /* Minimize init-time */ | 273 | /* Minimize init-time */ |
278 | bool bQueryPending; | ||
279 | bool bSetPending; | ||
280 | bool bResetPending; | ||
281 | struct timer_list ErrorTimer; | 274 | struct timer_list ErrorTimer; |
282 | bool bLinkTimerActive; | ||
283 | MP_POWER_MGMT PoMgmt; | 275 | MP_POWER_MGMT PoMgmt; |
284 | INTERRUPT_t CachedMaskValue; | 276 | INTERRUPT_t CachedMaskValue; |
285 | 277 | ||
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 34737d163808..a719e903eed9 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c | |||
@@ -330,14 +330,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) | |||
330 | return -EIO; | 330 | return -EIO; |
331 | } else if (rev == 0x01) { | 331 | } else if (rev == 0x01) { |
332 | int32_t nLoop; | 332 | int32_t nLoop; |
333 | uint8_t ucTemp[4] = { 0xFE, 0x13, 0x10, 0xFF }; | 333 | uint8_t temp[4] = { 0xFE, 0x13, 0x10, 0xFF }; |
334 | 334 | ||
335 | /* Re-write the first 4 bytes if we have an eeprom | 335 | /* Re-write the first 4 bytes if we have an eeprom |
336 | * present and the revision id is 1, this fixes the | 336 | * present and the revision id is 1, this fixes the |
337 | * corruption seen with 1310 B Silicon | 337 | * corruption seen with 1310 B Silicon |
338 | */ | 338 | */ |
339 | for (nLoop = 0; nLoop < 3; nLoop++) { | 339 | for (nLoop = 0; nLoop < 3; nLoop++) { |
340 | EepromWriteByte(adapter, nLoop, ucTemp[nLoop], | 340 | EepromWriteByte(adapter, nLoop, temp[nLoop], |
341 | 0, SINGLE_BYTE); | 341 | 0, SINGLE_BYTE); |
342 | } | 342 | } |
343 | } | 343 | } |
@@ -351,14 +351,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) | |||
351 | * information that normally would come from the eeprom, like | 351 | * information that normally would come from the eeprom, like |
352 | * MAC Address | 352 | * MAC Address |
353 | */ | 353 | */ |
354 | adapter->bEepromPresent = false; | 354 | adapter->has_eeprom = 0; |
355 | 355 | ||
356 | DBG_LEAVE(et131x_dbginfo); | 356 | DBG_LEAVE(et131x_dbginfo); |
357 | return -EIO; | 357 | return -EIO; |
358 | } else { | 358 | } else { |
359 | DBG_TRACE(et131x_dbginfo, "EEPROM Status Code - 0x%04x\n", | 359 | DBG_TRACE(et131x_dbginfo, "EEPROM Status Code - 0x%04x\n", |
360 | eepromStat); | 360 | eepromStat); |
361 | adapter->bEepromPresent = true; | 361 | adapter->has_eeprom = 1; |
362 | } | 362 | } |
363 | 363 | ||
364 | /* Read the EEPROM for information regarding LED behavior. Refer to | 364 | /* Read the EEPROM for information regarding LED behavior. Refer to |
@@ -445,7 +445,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) | |||
445 | /* Get MAC address from config space if an eeprom exists, otherwise | 445 | /* Get MAC address from config space if an eeprom exists, otherwise |
446 | * the MAC address there will not be valid | 446 | * the MAC address there will not be valid |
447 | */ | 447 | */ |
448 | if (adapter->bEepromPresent) { | 448 | if (adapter->has_eeprom) { |
449 | int i; | 449 | int i; |
450 | 450 | ||
451 | for (i = 0; i < ETH_ALEN; i++) { | 451 | for (i = 0; i < ETH_ALEN; i++) { |
@@ -520,9 +520,6 @@ void et131x_link_detection_handler(unsigned long data) | |||
520 | struct et131x_adapter *etdev = (struct et131x_adapter *) data; | 520 | struct et131x_adapter *etdev = (struct et131x_adapter *) data; |
521 | unsigned long flags; | 521 | unsigned long flags; |
522 | 522 | ||
523 | /* Let everyone know that we have run */ | ||
524 | etdev->bLinkTimerActive = false; | ||
525 | |||
526 | if (etdev->MediaState == 0) { | 523 | if (etdev->MediaState == 0) { |
527 | spin_lock_irqsave(&etdev->Lock, flags); | 524 | spin_lock_irqsave(&etdev->Lock, flags); |
528 | 525 | ||
@@ -532,8 +529,6 @@ void et131x_link_detection_handler(unsigned long data) | |||
532 | spin_unlock_irqrestore(&etdev->Lock, flags); | 529 | spin_unlock_irqrestore(&etdev->Lock, flags); |
533 | 530 | ||
534 | netif_carrier_off(etdev->netdev); | 531 | netif_carrier_off(etdev->netdev); |
535 | |||
536 | etdev->bSetPending = false; | ||
537 | } | 532 | } |
538 | } | 533 | } |
539 | 534 | ||
@@ -608,35 +603,32 @@ void et131x_setup_hardware_properties(struct et131x_adapter *adapter) | |||
608 | * EEPROM then we need to generate the last octet and set it on the | 603 | * EEPROM then we need to generate the last octet and set it on the |
609 | * device | 604 | * device |
610 | */ | 605 | */ |
611 | if (!adapter->bOverrideAddress) { | 606 | if (adapter->PermanentAddress[0] == 0x00 && |
612 | if (adapter->PermanentAddress[0] == 0x00 && | 607 | adapter->PermanentAddress[1] == 0x00 && |
613 | adapter->PermanentAddress[1] == 0x00 && | 608 | adapter->PermanentAddress[2] == 0x00 && |
614 | adapter->PermanentAddress[2] == 0x00 && | 609 | adapter->PermanentAddress[3] == 0x00 && |
615 | adapter->PermanentAddress[3] == 0x00 && | 610 | adapter->PermanentAddress[4] == 0x00 && |
616 | adapter->PermanentAddress[4] == 0x00 && | 611 | adapter->PermanentAddress[5] == 0x00) { |
617 | adapter->PermanentAddress[5] == 0x00) { | 612 | /* |
618 | /* | 613 | * We need to randomly generate the last octet so we |
619 | * We need to randomly generate the last octet so we | 614 | * decrease our chances of setting the mac address to |
620 | * decrease our chances of setting the mac address to | 615 | * same as another one of our cards in the system |
621 | * same as another one of our cards in the system | 616 | */ |
622 | */ | 617 | get_random_bytes(&adapter->CurrentAddress[5], 1); |
623 | get_random_bytes(&adapter->CurrentAddress[5], 1); | 618 | /* |
624 | 619 | * We have the default value in the register we are | |
625 | /* | 620 | * working with so we need to copy the current |
626 | * We have the default value in the register we are | 621 | * address into the permanent address |
627 | * working with so we need to copy the current | 622 | */ |
628 | * address into the permanent address | 623 | memcpy(adapter->PermanentAddress, |
629 | */ | 624 | adapter->CurrentAddress, ETH_ALEN); |
630 | memcpy(adapter->PermanentAddress, | 625 | } else { |
631 | adapter->CurrentAddress, ETH_ALEN); | 626 | /* We do not have an override address, so set the |
632 | } else { | 627 | * current address to the permanent address and add |
633 | /* We do not have an override address, so set the | 628 | * it to the device |
634 | * current address to the permanent address and add | 629 | */ |
635 | * it to the device | 630 | memcpy(adapter->CurrentAddress, |
636 | */ | 631 | adapter->PermanentAddress, ETH_ALEN); |
637 | memcpy(adapter->CurrentAddress, | ||
638 | adapter->PermanentAddress, ETH_ALEN); | ||
639 | } | ||
640 | } | 632 | } |
641 | 633 | ||
642 | DBG_LEAVE(et131x_dbginfo); | 634 | DBG_LEAVE(et131x_dbginfo); |