diff options
author | Alan Cox <alan@linux.intel.com> | 2009-11-18 09:07:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 15:23:21 -0500 |
commit | 2e5e0b890d4f6f2e9e836c2c21157fbb085c3ed9 (patch) | |
tree | db3528f8bc1c4f9b390356b4b12d95b4709af7a7 | |
parent | 6794712519265bb64aa20fe61f4da36bf8adbded (diff) |
Staging: et131x: Clean up number fields
Lots of RX typedefs are just low bits of a u32, so clean them all up in one
go and just work them directly.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/et131x/et1310_address_map.h | 123 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_rx.c | 22 |
2 files changed, 47 insertions, 98 deletions
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index c447e9a3ed92..019588d13127 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h | |||
@@ -339,19 +339,10 @@ typedef union _RXDMA_CSR_t { | |||
339 | /* | 339 | /* |
340 | * structure for number of packets done reg in rxdma address map | 340 | * structure for number of packets done reg in rxdma address map |
341 | * located at address 0x200C | 341 | * located at address 0x200C |
342 | * | ||
343 | * 31-8: unused | ||
344 | * 7-0: num done | ||
342 | */ | 345 | */ |
343 | typedef union _RXDMA_NUM_PKT_DONE_t { | ||
344 | u32 value; | ||
345 | struct { | ||
346 | #ifdef _BIT_FIELDS_HTOL | ||
347 | u32 unused:24; /* bits 8-31 */ | ||
348 | u32 num_done:8; /* bits 0-7 */ | ||
349 | #else | ||
350 | u32 num_done:8; /* bits 0-7 */ | ||
351 | u32 unused:24; /* bits 8-31 */ | ||
352 | #endif | ||
353 | } bits; | ||
354 | } RXDMA_NUM_PKT_DONE_t, *PRXDMA_NUM_PKT_DONE_t; | ||
355 | 346 | ||
356 | /* | 347 | /* |
357 | * structure for max packet time reg in rxdma address map | 348 | * structure for max packet time reg in rxdma address map |
@@ -394,19 +385,10 @@ typedef union _RXDMA_NUM_PKT_DONE_t { | |||
394 | /* | 385 | /* |
395 | * structure for packet status ring number of descriptors reg in rxdma address | 386 | * structure for packet status ring number of descriptors reg in rxdma address |
396 | * map. Located at address 0x2028 | 387 | * map. Located at address 0x2028 |
388 | * | ||
389 | * 31-12: unused | ||
390 | * 11-0: psr ndes | ||
397 | */ | 391 | */ |
398 | typedef union _RXDMA_PSR_NUM_DES_t { | ||
399 | u32 value; | ||
400 | struct { | ||
401 | #ifdef _BIT_FIELDS_HTOL | ||
402 | u32 unused:20; /* bits 12-31 */ | ||
403 | u32 psr_ndes:12; /* bit 0-11 */ | ||
404 | #else | ||
405 | u32 psr_ndes:12; /* bit 0-11 */ | ||
406 | u32 unused:20; /* bits 12-31 */ | ||
407 | #endif | ||
408 | } bits; | ||
409 | } RXDMA_PSR_NUM_DES_t, *PRXDMA_PSR_NUM_DES_t; | ||
410 | 392 | ||
411 | /* | 393 | /* |
412 | * structure for packet status ring available offset reg in rxdma address map | 394 | * structure for packet status ring available offset reg in rxdma address map |
@@ -449,36 +431,18 @@ typedef union _RXDMA_PSR_FULL_OFFSET_t { | |||
449 | /* | 431 | /* |
450 | * structure for packet status ring access index reg in rxdma address map | 432 | * structure for packet status ring access index reg in rxdma address map |
451 | * located at address 0x2034 | 433 | * located at address 0x2034 |
434 | * | ||
435 | * 31-5: unused | ||
436 | * 4-0: psr_ai | ||
452 | */ | 437 | */ |
453 | typedef union _RXDMA_PSR_ACCESS_INDEX_t { | ||
454 | u32 value; | ||
455 | struct { | ||
456 | #ifdef _BIT_FIELDS_HTOL | ||
457 | u32 unused:27; /* bits 5-31 */ | ||
458 | u32 psr_ai:5; /* bits 0-4 */ | ||
459 | #else | ||
460 | u32 psr_ai:5; /* bits 0-4 */ | ||
461 | u32 unused:27; /* bits 5-31 */ | ||
462 | #endif | ||
463 | } bits; | ||
464 | } RXDMA_PSR_ACCESS_INDEX_t, *PRXDMA_PSR_ACCESS_INDEX_t; | ||
465 | 438 | ||
466 | /* | 439 | /* |
467 | * structure for packet status ring minimum descriptors reg in rxdma address | 440 | * structure for packet status ring minimum descriptors reg in rxdma address |
468 | * map. Located at address 0x2038 | 441 | * map. Located at address 0x2038 |
442 | * | ||
443 | * 31-12: unused | ||
444 | * 11-0: psr_min | ||
469 | */ | 445 | */ |
470 | typedef union _RXDMA_PSR_MIN_DES_t { | ||
471 | u32 value; | ||
472 | struct { | ||
473 | #ifdef _BIT_FIELDS_HTOL | ||
474 | u32 unused:20; /* bits 12-31 */ | ||
475 | u32 psr_min:12; /* bits 0-11 */ | ||
476 | #else | ||
477 | u32 psr_min:12; /* bits 0-11 */ | ||
478 | u32 unused:20; /* bits 12-31 */ | ||
479 | #endif | ||
480 | } bits; | ||
481 | } RXDMA_PSR_MIN_DES_t, *PRXDMA_PSR_MIN_DES_t; | ||
482 | 446 | ||
483 | /* | 447 | /* |
484 | * structure for free buffer ring base lo address reg in rxdma address map | 448 | * structure for free buffer ring base lo address reg in rxdma address map |
@@ -495,6 +459,9 @@ typedef union _RXDMA_PSR_MIN_DES_t { | |||
495 | /* | 459 | /* |
496 | * structure for free buffer ring number of descriptors reg in rxdma address | 460 | * structure for free buffer ring number of descriptors reg in rxdma address |
497 | * map. Located at address 0x2044 | 461 | * map. Located at address 0x2044 |
462 | * | ||
463 | * 31-10: unused | ||
464 | * 9-0: fbr ndesc | ||
498 | */ | 465 | */ |
499 | typedef union _RXDMA_FBR_NUM_DES_t { | 466 | typedef union _RXDMA_FBR_NUM_DES_t { |
500 | u32 value; | 467 | u32 value; |
@@ -524,36 +491,18 @@ typedef union _RXDMA_FBR_NUM_DES_t { | |||
524 | /* | 491 | /* |
525 | * structure for free buffer cache 0 full offset reg in rxdma address map | 492 | * structure for free buffer cache 0 full offset reg in rxdma address map |
526 | * located at address 0x2050 | 493 | * located at address 0x2050 |
494 | * | ||
495 | * 31-5: unused | ||
496 | * 4-0: fbc rdi | ||
527 | */ | 497 | */ |
528 | typedef union _RXDMA_FBC_RD_INDEX_t { | ||
529 | u32 value; | ||
530 | struct { | ||
531 | #ifdef _BIT_FIELDS_HTOL | ||
532 | u32 unused:27; /* bits 5-31 */ | ||
533 | u32 fbc_rdi:5; /* bit 0-4 */ | ||
534 | #else | ||
535 | u32 fbc_rdi:5; /* bit 0-4 */ | ||
536 | u32 unused:27; /* bits 5-31 */ | ||
537 | #endif | ||
538 | } bits; | ||
539 | } RXDMA_FBC_RD_INDEX_t, *PRXDMA_FBC_RD_INDEX_t; | ||
540 | 498 | ||
541 | /* | 499 | /* |
542 | * structure for free buffer ring 0 minimum descriptor reg in rxdma address map | 500 | * structure for free buffer ring 0 minimum descriptor reg in rxdma address map |
543 | * located at address 0x2054 | 501 | * located at address 0x2054 |
502 | * | ||
503 | * 31-10: unused | ||
504 | * 9-0: fbr min | ||
544 | */ | 505 | */ |
545 | typedef union _RXDMA_FBR_MIN_DES_t { | ||
546 | u32 value; | ||
547 | struct { | ||
548 | #ifdef _BIT_FIELDS_HTOL | ||
549 | u32 unused:22; /* bits 10-31 */ | ||
550 | u32 fbr_min:10; /* bits 0-9 */ | ||
551 | #else | ||
552 | u32 fbr_min:10; /* bits 0-9 */ | ||
553 | u32 unused:22; /* bits 10-31 */ | ||
554 | #endif | ||
555 | } bits; | ||
556 | } RXDMA_FBR_MIN_DES_t, *PRXDMA_FBR_MIN_DES_t; | ||
557 | 506 | ||
558 | /* | 507 | /* |
559 | * structure for free buffer ring 1 base address lo reg in rxdma address map | 508 | * structure for free buffer ring 1 base address lo reg in rxdma address map |
@@ -599,32 +548,32 @@ typedef struct _RXDMA_t { /* Location: */ | |||
599 | RXDMA_CSR_t csr; /* 0x2000 */ | 548 | RXDMA_CSR_t csr; /* 0x2000 */ |
600 | u32 dma_wb_base_lo; /* 0x2004 */ | 549 | u32 dma_wb_base_lo; /* 0x2004 */ |
601 | u32 dma_wb_base_hi; /* 0x2008 */ | 550 | u32 dma_wb_base_hi; /* 0x2008 */ |
602 | RXDMA_NUM_PKT_DONE_t num_pkt_done; /* 0x200C */ | 551 | u32 num_pkt_done; /* 0x200C */ |
603 | u32 max_pkt_time; /* 0x2010 */ | 552 | u32 max_pkt_time; /* 0x2010 */ |
604 | u32 rxq_rd_addr; /* 0x2014 */ | 553 | u32 rxq_rd_addr; /* 0x2014 */ |
605 | u32 rxq_rd_addr_ext; /* 0x2018 */ | 554 | u32 rxq_rd_addr_ext; /* 0x2018 */ |
606 | u32 rxq_wr_addr; /* 0x201C */ | 555 | u32 rxq_wr_addr; /* 0x201C */ |
607 | u32 psr_base_lo; /* 0x2020 */ | 556 | u32 psr_base_lo; /* 0x2020 */ |
608 | u32 psr_base_hi; /* 0x2024 */ | 557 | u32 psr_base_hi; /* 0x2024 */ |
609 | RXDMA_PSR_NUM_DES_t psr_num_des; /* 0x2028 */ | 558 | u32 psr_num_des; /* 0x2028 */ |
610 | RXDMA_PSR_AVAIL_OFFSET_t psr_avail_offset; /* 0x202C */ | 559 | RXDMA_PSR_AVAIL_OFFSET_t psr_avail_offset; /* 0x202C */ |
611 | RXDMA_PSR_FULL_OFFSET_t psr_full_offset; /* 0x2030 */ | 560 | RXDMA_PSR_FULL_OFFSET_t psr_full_offset; /* 0x2030 */ |
612 | RXDMA_PSR_ACCESS_INDEX_t psr_access_index; /* 0x2034 */ | 561 | u32 psr_access_index; /* 0x2034 */ |
613 | RXDMA_PSR_MIN_DES_t psr_min_des; /* 0x2038 */ | 562 | u32 psr_min_des; /* 0x2038 */ |
614 | u32 fbr0_base_lo; /* 0x203C */ | 563 | u32 fbr0_base_lo; /* 0x203C */ |
615 | u32 fbr0_base_hi; /* 0x2040 */ | 564 | u32 fbr0_base_hi; /* 0x2040 */ |
616 | RXDMA_FBR_NUM_DES_t fbr0_num_des; /* 0x2044 */ | 565 | u32 fbr0_num_des; /* 0x2044 */ |
617 | u32 fbr0_avail_offset; /* 0x2048 */ | 566 | u32 fbr0_avail_offset; /* 0x2048 */ |
618 | u32 fbr0_full_offset; /* 0x204C */ | 567 | u32 fbr0_full_offset; /* 0x204C */ |
619 | RXDMA_FBC_RD_INDEX_t fbr0_rd_index; /* 0x2050 */ | 568 | u32 fbr0_rd_index; /* 0x2050 */ |
620 | RXDMA_FBR_MIN_DES_t fbr0_min_des; /* 0x2054 */ | 569 | u32 fbr0_min_des; /* 0x2054 */ |
621 | u32 fbr1_base_lo; /* 0x2058 */ | 570 | u32 fbr1_base_lo; /* 0x2058 */ |
622 | u32 fbr1_base_hi; /* 0x205C */ | 571 | u32 fbr1_base_hi; /* 0x205C */ |
623 | RXDMA_FBR_NUM_DES_t fbr1_num_des; /* 0x2060 */ | 572 | u32 fbr1_num_des; /* 0x2060 */ |
624 | u32 fbr1_avail_offset; /* 0x2064 */ | 573 | u32 fbr1_avail_offset; /* 0x2064 */ |
625 | u32 fbr1_full_offset; /* 0x2068 */ | 574 | u32 fbr1_full_offset; /* 0x2068 */ |
626 | RXDMA_FBC_RD_INDEX_t fbr1_rd_index; /* 0x206C */ | 575 | u32 fbr1_rd_index; /* 0x206C */ |
627 | RXDMA_FBR_MIN_DES_t fbr1_min_des; /* 0x2070 */ | 576 | u32 fbr1_min_des; /* 0x2070 */ |
628 | } RXDMA_t, *PRXDMA_t; | 577 | } RXDMA_t, *PRXDMA_t; |
629 | 578 | ||
630 | /* END OF RXDMA REGISTER ADDRESS MAP */ | 579 | /* END OF RXDMA REGISTER ADDRESS MAP */ |
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 48f1ffc3df6a..c3778d2c5df5 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
@@ -598,7 +598,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
598 | struct _rx_ring_t *rx_local = &etdev->RxRing; | 598 | struct _rx_ring_t *rx_local = &etdev->RxRing; |
599 | PFBR_DESC_t fbr_entry; | 599 | PFBR_DESC_t fbr_entry; |
600 | u32 entry; | 600 | u32 entry; |
601 | RXDMA_PSR_NUM_DES_t psr_num_des; | 601 | u32 psr_num_des; |
602 | unsigned long flags; | 602 | unsigned long flags; |
603 | 603 | ||
604 | /* Halt RXDMA to perform the reconfigure. */ | 604 | /* Halt RXDMA to perform the reconfigure. */ |
@@ -623,12 +623,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
623 | writel((u32) ((u64)rx_local->pPSRingPa >> 32), | 623 | writel((u32) ((u64)rx_local->pPSRingPa >> 32), |
624 | &rx_dma->psr_base_hi); | 624 | &rx_dma->psr_base_hi); |
625 | writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo); | 625 | writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo); |
626 | writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des.value); | 626 | writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des); |
627 | writel(0, &rx_dma->psr_full_offset.value); | 627 | writel(0, &rx_dma->psr_full_offset.value); |
628 | 628 | ||
629 | psr_num_des.value = readl(&rx_dma->psr_num_des.value); | 629 | psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF; |
630 | writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100, | 630 | writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, |
631 | &rx_dma->psr_min_des.value); | 631 | &rx_dma->psr_min_des); |
632 | 632 | ||
633 | spin_lock_irqsave(&etdev->RcvLock, flags); | 633 | spin_lock_irqsave(&etdev->RcvLock, flags); |
634 | 634 | ||
@@ -650,7 +650,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
650 | */ | 650 | */ |
651 | writel((u32) (rx_local->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); | 651 | writel((u32) (rx_local->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); |
652 | writel((u32) rx_local->Fbr1Realpa, &rx_dma->fbr1_base_lo); | 652 | writel((u32) rx_local->Fbr1Realpa, &rx_dma->fbr1_base_lo); |
653 | writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); | 653 | writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des); |
654 | writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); | 654 | writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); |
655 | 655 | ||
656 | /* This variable tracks the free buffer ring 1 full position, so it | 656 | /* This variable tracks the free buffer ring 1 full position, so it |
@@ -658,7 +658,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
658 | */ | 658 | */ |
659 | rx_local->local_Fbr1_full = ET_DMA10_WRAP; | 659 | rx_local->local_Fbr1_full = ET_DMA10_WRAP; |
660 | writel(((rx_local->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 660 | writel(((rx_local->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
661 | &rx_dma->fbr1_min_des.value); | 661 | &rx_dma->fbr1_min_des); |
662 | 662 | ||
663 | #ifdef USE_FBR0 | 663 | #ifdef USE_FBR0 |
664 | /* Now's the best time to initialize FBR0 contents */ | 664 | /* Now's the best time to initialize FBR0 contents */ |
@@ -672,7 +672,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
672 | 672 | ||
673 | writel((u32) (rx_local->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); | 673 | writel((u32) (rx_local->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); |
674 | writel((u32) rx_local->Fbr0Realpa, &rx_dma->fbr0_base_lo); | 674 | writel((u32) rx_local->Fbr0Realpa, &rx_dma->fbr0_base_lo); |
675 | writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); | 675 | writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des); |
676 | writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); | 676 | writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); |
677 | 677 | ||
678 | /* This variable tracks the free buffer ring 0 full position, so it | 678 | /* This variable tracks the free buffer ring 0 full position, so it |
@@ -680,7 +680,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
680 | */ | 680 | */ |
681 | rx_local->local_Fbr0_full = ET_DMA10_WRAP; | 681 | rx_local->local_Fbr0_full = ET_DMA10_WRAP; |
682 | writel(((rx_local->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 682 | writel(((rx_local->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
683 | &rx_dma->fbr0_min_des.value); | 683 | &rx_dma->fbr0_min_des); |
684 | #endif | 684 | #endif |
685 | 685 | ||
686 | /* Program the number of packets we will receive before generating an | 686 | /* Program the number of packets we will receive before generating an |
@@ -688,7 +688,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) | |||
688 | * For version B silicon, this value gets updated once autoneg is | 688 | * For version B silicon, this value gets updated once autoneg is |
689 | *complete. | 689 | *complete. |
690 | */ | 690 | */ |
691 | writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done.value); | 691 | writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done); |
692 | 692 | ||
693 | /* The "time_done" is not working correctly to coalesce interrupts | 693 | /* The "time_done" is not working correctly to coalesce interrupts |
694 | * after a given time period, but rather is giving us an interrupt | 694 | * after a given time period, but rather is giving us an interrupt |
@@ -712,7 +712,7 @@ void SetRxDmaTimer(struct et131x_adapter *etdev) | |||
712 | if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) || | 712 | if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) || |
713 | (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) { | 713 | (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) { |
714 | writel(0, &etdev->regs->rxdma.max_pkt_time); | 714 | writel(0, &etdev->regs->rxdma.max_pkt_time); |
715 | writel(1, &etdev->regs->rxdma.num_pkt_done.value); | 715 | writel(1, &etdev->regs->rxdma.num_pkt_done); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||