aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.h
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2006-10-19 22:07:34 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-21 14:09:51 -0400
commit18a8e8649d2687283da51fbcf8218372dc5a8f6f (patch)
tree1961bce657aec08964c8b6ab5b270b8f962a8988 /drivers/net/ucc_geth.h
parent470ea7eba4aaa517533f9b02ac9a104e77264548 (diff)
[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes
changes due to qe_lib changes include: o removed inclusion of platform header file o removed platform_device code, replaced with of_device o removed typedefs o uint -> u32 conversions o removed following defines: QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER, BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET because they hid sizeof/in_be32/out_be32 operations from the reader. o removed irrelevant comments, added others to resemble removed BD_ defines o const'd and uncasted all get_property() assignments bugfixes, courtesy of Scott Wood, include: - Read phy_address as a u32, not u8. - Match on type == "network" as well as compatible == "ucc_geth", as device_is_compatible() will only compare up to the length of the test string, allowing "ucc_geth_phy" to match as well. - fixes the MAC setting code in ucc_geth.c. The old code was overwriting and dereferencing random stack contents. Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ucc_geth.h')
-rw-r--r--drivers/net/ucc_geth.h248
1 files changed, 123 insertions, 125 deletions
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 005965f5dd9b..a66561253593 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -36,24 +36,24 @@
36#define ENET_INIT_PARAM_MAX_ENTRIES_RX 9 36#define ENET_INIT_PARAM_MAX_ENTRIES_RX 9
37#define ENET_INIT_PARAM_MAX_ENTRIES_TX 8 37#define ENET_INIT_PARAM_MAX_ENTRIES_TX 8
38 38
39typedef struct ucc_mii_mng { 39struct ucc_mii_mng {
40 u32 miimcfg; /* MII management configuration reg */ 40 u32 miimcfg; /* MII management configuration reg */
41 u32 miimcom; /* MII management command reg */ 41 u32 miimcom; /* MII management command reg */
42 u32 miimadd; /* MII management address reg */ 42 u32 miimadd; /* MII management address reg */
43 u32 miimcon; /* MII management control reg */ 43 u32 miimcon; /* MII management control reg */
44 u32 miimstat; /* MII management status reg */ 44 u32 miimstat; /* MII management status reg */
45 u32 miimind; /* MII management indication reg */ 45 u32 miimind; /* MII management indication reg */
46} __attribute__ ((packed)) ucc_mii_mng_t; 46} __attribute__ ((packed));
47 47
48typedef struct ucc_geth { 48struct ucc_geth {
49 ucc_fast_t uccf; 49 struct ucc_fast uccf;
50 50
51 u32 maccfg1; /* mac configuration reg. 1 */ 51 u32 maccfg1; /* mac configuration reg. 1 */
52 u32 maccfg2; /* mac configuration reg. 2 */ 52 u32 maccfg2; /* mac configuration reg. 2 */
53 u32 ipgifg; /* interframe gap reg. */ 53 u32 ipgifg; /* interframe gap reg. */
54 u32 hafdup; /* half-duplex reg. */ 54 u32 hafdup; /* half-duplex reg. */
55 u8 res1[0x10]; 55 u8 res1[0x10];
56 ucc_mii_mng_t miimng; /* MII management structure */ 56 struct ucc_mii_mng miimng; /* MII management structure */
57 u32 ifctl; /* interface control reg */ 57 u32 ifctl; /* interface control reg */
58 u32 ifstat; /* interface statux reg */ 58 u32 ifstat; /* interface statux reg */
59 u32 macstnaddr1; /* mac station address part 1 reg */ 59 u32 macstnaddr1; /* mac station address part 1 reg */
@@ -111,7 +111,7 @@ typedef struct ucc_geth {
111 u32 scar; /* Statistics carry register */ 111 u32 scar; /* Statistics carry register */
112 u32 scam; /* Statistics caryy mask register */ 112 u32 scam; /* Statistics caryy mask register */
113 u8 res5[0x200 - 0x1c4]; 113 u8 res5[0x200 - 0x1c4];
114} __attribute__ ((packed)) ucc_geth_t; 114} __attribute__ ((packed));
115 115
116/* UCC GETH TEMODR Register */ 116/* UCC GETH TEMODR Register */
117#define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics 117#define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics
@@ -508,39 +508,39 @@ typedef struct ucc_geth {
508/* UCC GETH UDSR (Data Synchronization Register) */ 508/* UCC GETH UDSR (Data Synchronization Register) */
509#define UDSR_MAGIC 0x067E 509#define UDSR_MAGIC 0x067E
510 510
511typedef struct ucc_geth_thread_data_tx { 511struct ucc_geth_thread_data_tx {
512 u8 res0[104]; 512 u8 res0[104];
513} __attribute__ ((packed)) ucc_geth_thread_data_tx_t; 513} __attribute__ ((packed));
514 514
515typedef struct ucc_geth_thread_data_rx { 515struct ucc_geth_thread_data_rx {
516 u8 res0[40]; 516 u8 res0[40];
517} __attribute__ ((packed)) ucc_geth_thread_data_rx_t; 517} __attribute__ ((packed));
518 518
519/* Send Queue Queue-Descriptor */ 519/* Send Queue Queue-Descriptor */
520typedef struct ucc_geth_send_queue_qd { 520struct ucc_geth_send_queue_qd {
521 u32 bd_ring_base; /* pointer to BD ring base address */ 521 u32 bd_ring_base; /* pointer to BD ring base address */
522 u8 res0[0x8]; 522 u8 res0[0x8];
523 u32 last_bd_completed_address;/* initialize to last entry in BD ring */ 523 u32 last_bd_completed_address;/* initialize to last entry in BD ring */
524 u8 res1[0x30]; 524 u8 res1[0x30];
525} __attribute__ ((packed)) ucc_geth_send_queue_qd_t; 525} __attribute__ ((packed));
526 526
527typedef struct ucc_geth_send_queue_mem_region { 527struct ucc_geth_send_queue_mem_region {
528 ucc_geth_send_queue_qd_t sqqd[NUM_TX_QUEUES]; 528 struct ucc_geth_send_queue_qd sqqd[NUM_TX_QUEUES];
529} __attribute__ ((packed)) ucc_geth_send_queue_mem_region_t; 529} __attribute__ ((packed));
530 530
531typedef struct ucc_geth_thread_tx_pram { 531struct ucc_geth_thread_tx_pram {
532 u8 res0[64]; 532 u8 res0[64];
533} __attribute__ ((packed)) ucc_geth_thread_tx_pram_t; 533} __attribute__ ((packed));
534 534
535typedef struct ucc_geth_thread_rx_pram { 535struct ucc_geth_thread_rx_pram {
536 u8 res0[128]; 536 u8 res0[128];
537} __attribute__ ((packed)) ucc_geth_thread_rx_pram_t; 537} __attribute__ ((packed));
538 538
539#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING 64 539#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING 64
540#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8 64 540#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8 64
541#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16 96 541#define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16 96
542 542
543typedef struct ucc_geth_scheduler { 543struct ucc_geth_scheduler {
544 u16 cpucount0; /* CPU packet counter */ 544 u16 cpucount0; /* CPU packet counter */
545 u16 cpucount1; /* CPU packet counter */ 545 u16 cpucount1; /* CPU packet counter */
546 u16 cecount0; /* QE packet counter */ 546 u16 cecount0; /* QE packet counter */
@@ -574,9 +574,9 @@ typedef struct ucc_geth_scheduler {
574 /**< weight factor for queues */ 574 /**< weight factor for queues */
575 u32 minw; /* temporary variable handled by QE */ 575 u32 minw; /* temporary variable handled by QE */
576 u8 res1[0x70 - 0x64]; 576 u8 res1[0x70 - 0x64];
577} __attribute__ ((packed)) ucc_geth_scheduler_t; 577} __attribute__ ((packed));
578 578
579typedef struct ucc_geth_tx_firmware_statistics_pram { 579struct ucc_geth_tx_firmware_statistics_pram {
580 u32 sicoltx; /* single collision */ 580 u32 sicoltx; /* single collision */
581 u32 mulcoltx; /* multiple collision */ 581 u32 mulcoltx; /* multiple collision */
582 u32 latecoltxfr; /* late collision */ 582 u32 latecoltxfr; /* late collision */
@@ -596,9 +596,9 @@ typedef struct ucc_geth_tx_firmware_statistics_pram {
596 and 1518 octets */ 596 and 1518 octets */
597 u32 txpktsjumbo; /* total packets (including bad) between 1024 597 u32 txpktsjumbo; /* total packets (including bad) between 1024
598 and MAXLength octets */ 598 and MAXLength octets */
599} __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_pram_t; 599} __attribute__ ((packed));
600 600
601typedef struct ucc_geth_rx_firmware_statistics_pram { 601struct ucc_geth_rx_firmware_statistics_pram {
602 u32 frrxfcser; /* frames with crc error */ 602 u32 frrxfcser; /* frames with crc error */
603 u32 fraligner; /* frames with alignment error */ 603 u32 fraligner; /* frames with alignment error */
604 u32 inrangelenrxer; /* in range length error */ 604 u32 inrangelenrxer; /* in range length error */
@@ -630,33 +630,33 @@ typedef struct ucc_geth_rx_firmware_statistics_pram {
630 replaced */ 630 replaced */
631 u32 insertvlan; /* total frames that had their VLAN tag 631 u32 insertvlan; /* total frames that had their VLAN tag
632 inserted */ 632 inserted */
633} __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_pram_t; 633} __attribute__ ((packed));
634 634
635typedef struct ucc_geth_rx_interrupt_coalescing_entry { 635struct ucc_geth_rx_interrupt_coalescing_entry {
636 u32 interruptcoalescingmaxvalue; /* interrupt coalescing max 636 u32 interruptcoalescingmaxvalue; /* interrupt coalescing max
637 value */ 637 value */
638 u32 interruptcoalescingcounter; /* interrupt coalescing counter, 638 u32 interruptcoalescingcounter; /* interrupt coalescing counter,
639 initialize to 639 initialize to
640 interruptcoalescingmaxvalue */ 640 interruptcoalescingmaxvalue */
641} __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_entry_t; 641} __attribute__ ((packed));
642 642
643typedef struct ucc_geth_rx_interrupt_coalescing_table { 643struct ucc_geth_rx_interrupt_coalescing_table {
644 ucc_geth_rx_interrupt_coalescing_entry_t coalescingentry[NUM_RX_QUEUES]; 644 struct ucc_geth_rx_interrupt_coalescing_entry coalescingentry[NUM_RX_QUEUES];
645 /**< interrupt coalescing entry */ 645 /**< interrupt coalescing entry */
646} __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_table_t; 646} __attribute__ ((packed));
647 647
648typedef struct ucc_geth_rx_prefetched_bds { 648struct ucc_geth_rx_prefetched_bds {
649 qe_bd_t bd[NUM_BDS_IN_PREFETCHED_BDS]; /* prefetched bd */ 649 struct qe_bd bd[NUM_BDS_IN_PREFETCHED_BDS]; /* prefetched bd */
650} __attribute__ ((packed)) ucc_geth_rx_prefetched_bds_t; 650} __attribute__ ((packed));
651 651
652typedef struct ucc_geth_rx_bd_queues_entry { 652struct ucc_geth_rx_bd_queues_entry {
653 u32 bdbaseptr; /* BD base pointer */ 653 u32 bdbaseptr; /* BD base pointer */
654 u32 bdptr; /* BD pointer */ 654 u32 bdptr; /* BD pointer */
655 u32 externalbdbaseptr; /* external BD base pointer */ 655 u32 externalbdbaseptr; /* external BD base pointer */
656 u32 externalbdptr; /* external BD pointer */ 656 u32 externalbdptr; /* external BD pointer */
657} __attribute__ ((packed)) ucc_geth_rx_bd_queues_entry_t; 657} __attribute__ ((packed));
658 658
659typedef struct ucc_geth_tx_global_pram { 659struct ucc_geth_tx_global_pram {
660 u16 temoder; 660 u16 temoder;
661 u8 res0[0x38 - 0x02]; 661 u8 res0[0x38 - 0x02];
662 u32 sqptr; /* a base pointer to send queue memory region */ 662 u32 sqptr; /* a base pointer to send queue memory region */
@@ -670,15 +670,15 @@ typedef struct ucc_geth_tx_global_pram {
670 u32 tqptr; /* a base pointer to the Tx Queues Memory 670 u32 tqptr; /* a base pointer to the Tx Queues Memory
671 Region */ 671 Region */
672 u8 res2[0x80 - 0x74]; 672 u8 res2[0x80 - 0x74];
673} __attribute__ ((packed)) ucc_geth_tx_global_pram_t; 673} __attribute__ ((packed));
674 674
675/* structure representing Extended Filtering Global Parameters in PRAM */ 675/* structure representing Extended Filtering Global Parameters in PRAM */
676typedef struct ucc_geth_exf_global_pram { 676struct ucc_geth_exf_global_pram {
677 u32 l2pcdptr; /* individual address filter, high */ 677 u32 l2pcdptr; /* individual address filter, high */
678 u8 res0[0x10 - 0x04]; 678 u8 res0[0x10 - 0x04];
679} __attribute__ ((packed)) ucc_geth_exf_global_pram_t; 679} __attribute__ ((packed));
680 680
681typedef struct ucc_geth_rx_global_pram { 681struct ucc_geth_rx_global_pram {
682 u32 remoder; /* ethernet mode reg. */ 682 u32 remoder; /* ethernet mode reg. */
683 u32 rqptr; /* base pointer to the Rx Queues Memory Region*/ 683 u32 rqptr; /* base pointer to the Rx Queues Memory Region*/
684 u32 res0[0x1]; 684 u32 res0[0x1];
@@ -710,12 +710,12 @@ typedef struct ucc_geth_rx_global_pram {
710 u32 exfGlobalParam; /* base address for extended filtering global 710 u32 exfGlobalParam; /* base address for extended filtering global
711 parameters */ 711 parameters */
712 u8 res6[0x100 - 0xC4]; /* Initialize to zero */ 712 u8 res6[0x100 - 0xC4]; /* Initialize to zero */
713} __attribute__ ((packed)) ucc_geth_rx_global_pram_t; 713} __attribute__ ((packed));
714 714
715#define GRACEFUL_STOP_ACKNOWLEDGE_RX 0x01 715#define GRACEFUL_STOP_ACKNOWLEDGE_RX 0x01
716 716
717/* structure representing InitEnet command */ 717/* structure representing InitEnet command */
718typedef struct ucc_geth_init_pram { 718struct ucc_geth_init_pram {
719 u8 resinit1; 719 u8 resinit1;
720 u8 resinit2; 720 u8 resinit2;
721 u8 resinit3; 721 u8 resinit3;
@@ -729,7 +729,7 @@ typedef struct ucc_geth_init_pram {
729 u32 txglobal; /* tx global */ 729 u32 txglobal; /* tx global */
730 u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX]; /* tx threads */ 730 u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX]; /* tx threads */
731 u8 res3[0x1]; 731 u8 res3[0x1];
732} __attribute__ ((packed)) ucc_geth_init_pram_t; 732} __attribute__ ((packed));
733 733
734#define ENET_INIT_PARAM_RGF_SHIFT (32 - 4) 734#define ENET_INIT_PARAM_RGF_SHIFT (32 - 4)
735#define ENET_INIT_PARAM_TGF_SHIFT (32 - 8) 735#define ENET_INIT_PARAM_TGF_SHIFT (32 - 8)
@@ -746,27 +746,27 @@ typedef struct ucc_geth_init_pram {
746#define ENET_INIT_PARAM_MAGIC_RES_INIT5 0x0400 746#define ENET_INIT_PARAM_MAGIC_RES_INIT5 0x0400
747 747
748/* structure representing 82xx Address Filtering Enet Address in PRAM */ 748/* structure representing 82xx Address Filtering Enet Address in PRAM */
749typedef struct ucc_geth_82xx_enet_address { 749struct ucc_geth_82xx_enet_address {
750 u8 res1[0x2]; 750 u8 res1[0x2];
751 u16 h; /* address (MSB) */ 751 u16 h; /* address (MSB) */
752 u16 m; /* address */ 752 u16 m; /* address */
753 u16 l; /* address (LSB) */ 753 u16 l; /* address (LSB) */
754} __attribute__ ((packed)) ucc_geth_82xx_enet_address_t; 754} __attribute__ ((packed));
755 755
756/* structure representing 82xx Address Filtering PRAM */ 756/* structure representing 82xx Address Filtering PRAM */
757typedef struct ucc_geth_82xx_address_filtering_pram { 757struct ucc_geth_82xx_address_filtering_pram {
758 u32 iaddr_h; /* individual address filter, high */ 758 u32 iaddr_h; /* individual address filter, high */
759 u32 iaddr_l; /* individual address filter, low */ 759 u32 iaddr_l; /* individual address filter, low */
760 u32 gaddr_h; /* group address filter, high */ 760 u32 gaddr_h; /* group address filter, high */
761 u32 gaddr_l; /* group address filter, low */ 761 u32 gaddr_l; /* group address filter, low */
762 ucc_geth_82xx_enet_address_t taddr; 762 struct ucc_geth_82xx_enet_address taddr;
763 ucc_geth_82xx_enet_address_t paddr[NUM_OF_PADDRS]; 763 struct ucc_geth_82xx_enet_address paddr[NUM_OF_PADDRS];
764 u8 res0[0x40 - 0x38]; 764 u8 res0[0x40 - 0x38];
765} __attribute__ ((packed)) ucc_geth_82xx_address_filtering_pram_t; 765} __attribute__ ((packed));
766 766
767/* GETH Tx firmware statistics structure, used when calling 767/* GETH Tx firmware statistics structure, used when calling
768 UCC_GETH_GetStatistics. */ 768 UCC_GETH_GetStatistics. */
769typedef struct ucc_geth_tx_firmware_statistics { 769struct ucc_geth_tx_firmware_statistics {
770 u32 sicoltx; /* single collision */ 770 u32 sicoltx; /* single collision */
771 u32 mulcoltx; /* multiple collision */ 771 u32 mulcoltx; /* multiple collision */
772 u32 latecoltxfr; /* late collision */ 772 u32 latecoltxfr; /* late collision */
@@ -786,11 +786,11 @@ typedef struct ucc_geth_tx_firmware_statistics {
786 and 1518 octets */ 786 and 1518 octets */
787 u32 txpktsjumbo; /* total packets (including bad) between 1024 787 u32 txpktsjumbo; /* total packets (including bad) between 1024
788 and MAXLength octets */ 788 and MAXLength octets */
789} __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_t; 789} __attribute__ ((packed));
790 790
791/* GETH Rx firmware statistics structure, used when calling 791/* GETH Rx firmware statistics structure, used when calling
792 UCC_GETH_GetStatistics. */ 792 UCC_GETH_GetStatistics. */
793typedef struct ucc_geth_rx_firmware_statistics { 793struct ucc_geth_rx_firmware_statistics {
794 u32 frrxfcser; /* frames with crc error */ 794 u32 frrxfcser; /* frames with crc error */
795 u32 fraligner; /* frames with alignment error */ 795 u32 fraligner; /* frames with alignment error */
796 u32 inrangelenrxer; /* in range length error */ 796 u32 inrangelenrxer; /* in range length error */
@@ -822,11 +822,11 @@ typedef struct ucc_geth_rx_firmware_statistics {
822 replaced */ 822 replaced */
823 u32 insertvlan; /* total frames that had their VLAN tag 823 u32 insertvlan; /* total frames that had their VLAN tag
824 inserted */ 824 inserted */
825} __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_t; 825} __attribute__ ((packed));
826 826
827/* GETH hardware statistics structure, used when calling 827/* GETH hardware statistics structure, used when calling
828 UCC_GETH_GetStatistics. */ 828 UCC_GETH_GetStatistics. */
829typedef struct ucc_geth_hardware_statistics { 829struct ucc_geth_hardware_statistics {
830 u32 tx64; /* Total number of frames (including bad 830 u32 tx64; /* Total number of frames (including bad
831 frames) transmitted that were exactly of the 831 frames) transmitted that were exactly of the
832 minimal length (64 for un tagged, 68 for 832 minimal length (64 for un tagged, 68 for
@@ -871,7 +871,7 @@ typedef struct ucc_geth_hardware_statistics {
871 u32 rbca; /* Total number of frames received succesfully 871 u32 rbca; /* Total number of frames received succesfully
872 that had destination address equal to the 872 that had destination address equal to the
873 broadcast address */ 873 broadcast address */
874} __attribute__ ((packed)) ucc_geth_hardware_statistics_t; 874} __attribute__ ((packed));
875 875
876/* UCC GETH Tx errors returned via TxConf callback */ 876/* UCC GETH Tx errors returned via TxConf callback */
877#define TX_ERRORS_DEF 0x0200 877#define TX_ERRORS_DEF 0x0200
@@ -1013,21 +1013,21 @@ typedef struct ucc_geth_hardware_statistics {
1013 (MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112) 1013 (MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112)
1014 1014
1015/* Ethernet speed */ 1015/* Ethernet speed */
1016typedef enum enet_speed { 1016enum enet_speed {
1017 ENET_SPEED_10BT, /* 10 Base T */ 1017 ENET_SPEED_10BT, /* 10 Base T */
1018 ENET_SPEED_100BT, /* 100 Base T */ 1018 ENET_SPEED_100BT, /* 100 Base T */
1019 ENET_SPEED_1000BT /* 1000 Base T */ 1019 ENET_SPEED_1000BT /* 1000 Base T */
1020} enet_speed_e; 1020};
1021 1021
1022/* Ethernet Address Type. */ 1022/* Ethernet Address Type. */
1023typedef enum enet_addr_type { 1023enum enet_addr_type {
1024 ENET_ADDR_TYPE_INDIVIDUAL, 1024 ENET_ADDR_TYPE_INDIVIDUAL,
1025 ENET_ADDR_TYPE_GROUP, 1025 ENET_ADDR_TYPE_GROUP,
1026 ENET_ADDR_TYPE_BROADCAST 1026 ENET_ADDR_TYPE_BROADCAST
1027} enet_addr_type_e; 1027};
1028 1028
1029/* TBI / MII Set Register */ 1029/* TBI / MII Set Register */
1030typedef enum enet_tbi_mii_reg { 1030enum enet_tbi_mii_reg {
1031 ENET_TBI_MII_CR = 0x00, /* Control (CR ) */ 1031 ENET_TBI_MII_CR = 0x00, /* Control (CR ) */
1032 ENET_TBI_MII_SR = 0x01, /* Status (SR ) */ 1032 ENET_TBI_MII_SR = 0x01, /* Status (SR ) */
1033 ENET_TBI_MII_ANA = 0x04, /* AN advertisement (ANA ) */ 1033 ENET_TBI_MII_ANA = 0x04, /* AN advertisement (ANA ) */
@@ -1040,10 +1040,10 @@ typedef enum enet_tbi_mii_reg {
1040 ENET_TBI_MII_EXST = 0x0F, /* Extended status (EXST ) */ 1040 ENET_TBI_MII_EXST = 0x0F, /* Extended status (EXST ) */
1041 ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics (JD ) */ 1041 ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics (JD ) */
1042 ENET_TBI_MII_TBICON = 0x11 /* TBI control (TBICON ) */ 1042 ENET_TBI_MII_TBICON = 0x11 /* TBI control (TBICON ) */
1043} enet_tbi_mii_reg_e; 1043};
1044 1044
1045/* UCC GETH 82xx Ethernet Address Recognition Location */ 1045/* UCC GETH 82xx Ethernet Address Recognition Location */
1046typedef enum ucc_geth_enet_address_recognition_location { 1046enum ucc_geth_enet_address_recognition_location {
1047 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station 1047 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station
1048 address */ 1048 address */
1049 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST, /* additional 1049 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST, /* additional
@@ -1065,10 +1065,10 @@ typedef enum ucc_geth_enet_address_recognition_location {
1065 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH, /* group hash */ 1065 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH, /* group hash */
1066 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual 1066 UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual
1067 hash */ 1067 hash */
1068} ucc_geth_enet_address_recognition_location_e; 1068};
1069 1069
1070/* UCC GETH vlan operation tagged */ 1070/* UCC GETH vlan operation tagged */
1071typedef enum ucc_geth_vlan_operation_tagged { 1071enum ucc_geth_vlan_operation_tagged {
1072 UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0, /* Tagged - nop */ 1072 UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0, /* Tagged - nop */
1073 UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG 1073 UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG
1074 = 0x1, /* Tagged - replace vid portion of q tag */ 1074 = 0x1, /* Tagged - replace vid portion of q tag */
@@ -1076,18 +1076,18 @@ typedef enum ucc_geth_vlan_operation_tagged {
1076 = 0x2, /* Tagged - if vid0 replace vid with default value */ 1076 = 0x2, /* Tagged - if vid0 replace vid with default value */
1077 UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME 1077 UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME
1078 = 0x3 /* Tagged - extract q tag from frame */ 1078 = 0x3 /* Tagged - extract q tag from frame */
1079} ucc_geth_vlan_operation_tagged_e; 1079};
1080 1080
1081/* UCC GETH vlan operation non-tagged */ 1081/* UCC GETH vlan operation non-tagged */
1082typedef enum ucc_geth_vlan_operation_non_tagged { 1082enum ucc_geth_vlan_operation_non_tagged {
1083 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0, /* Non tagged - nop */ 1083 UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0, /* Non tagged - nop */
1084 UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1 /* Non tagged - 1084 UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1 /* Non tagged -
1085 q tag insert 1085 q tag insert
1086 */ 1086 */
1087} ucc_geth_vlan_operation_non_tagged_e; 1087};
1088 1088
1089/* UCC GETH Rx Quality of Service Mode */ 1089/* UCC GETH Rx Quality of Service Mode */
1090typedef enum ucc_geth_qos_mode { 1090enum ucc_geth_qos_mode {
1091 UCC_GETH_QOS_MODE_DEFAULT = 0x0, /* default queue */ 1091 UCC_GETH_QOS_MODE_DEFAULT = 0x0, /* default queue */
1092 UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1, /* queue 1092 UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1, /* queue
1093 determined 1093 determined
@@ -1097,11 +1097,11 @@ typedef enum ucc_geth_qos_mode {
1097 determined 1097 determined
1098 by L3 1098 by L3
1099 criteria */ 1099 criteria */
1100} ucc_geth_qos_mode_e; 1100};
1101 1101
1102/* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together 1102/* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together
1103 for combined functionality */ 1103 for combined functionality */
1104typedef enum ucc_geth_statistics_gathering_mode { 1104enum ucc_geth_statistics_gathering_mode {
1105 UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000, /* No 1105 UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000, /* No
1106 statistics 1106 statistics
1107 gathering */ 1107 gathering */
@@ -1122,10 +1122,10 @@ typedef enum ucc_geth_statistics_gathering_mode {
1122 statistics 1122 statistics
1123 gathering 1123 gathering
1124 */ 1124 */
1125} ucc_geth_statistics_gathering_mode_e; 1125};
1126 1126
1127/* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */ 1127/* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */
1128typedef enum ucc_geth_maccfg2_pad_and_crc_mode { 1128enum ucc_geth_maccfg2_pad_and_crc_mode {
1129 UCC_GETH_PAD_AND_CRC_MODE_NONE 1129 UCC_GETH_PAD_AND_CRC_MODE_NONE
1130 = MACCFG2_PAD_AND_CRC_MODE_NONE, /* Neither Padding 1130 = MACCFG2_PAD_AND_CRC_MODE_NONE, /* Neither Padding
1131 short frames 1131 short frames
@@ -1135,61 +1135,59 @@ typedef enum ucc_geth_maccfg2_pad_and_crc_mode {
1135 CRC only */ 1135 CRC only */
1136 UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC = 1136 UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC =
1137 MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC 1137 MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC
1138} ucc_geth_maccfg2_pad_and_crc_mode_e; 1138};
1139 1139
1140/* UCC GETH upsmr Flow Control Mode */ 1140/* UCC GETH upsmr Flow Control Mode */
1141typedef enum ucc_geth_flow_control_mode { 1141enum ucc_geth_flow_control_mode {
1142 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000, /* No automatic 1142 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000, /* No automatic
1143 flow control 1143 flow control
1144 */ 1144 */
1145 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY 1145 UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY
1146 = 0x00004000 /* Send pause frame when RxFIFO reaches its 1146 = 0x00004000 /* Send pause frame when RxFIFO reaches its
1147 emergency threshold */ 1147 emergency threshold */
1148} ucc_geth_flow_control_mode_e; 1148};
1149 1149
1150/* UCC GETH number of threads */ 1150/* UCC GETH number of threads */
1151typedef enum ucc_geth_num_of_threads { 1151enum ucc_geth_num_of_threads {
1152 UCC_GETH_NUM_OF_THREADS_1 = 0x1, /* 1 */ 1152 UCC_GETH_NUM_OF_THREADS_1 = 0x1, /* 1 */
1153 UCC_GETH_NUM_OF_THREADS_2 = 0x2, /* 2 */ 1153 UCC_GETH_NUM_OF_THREADS_2 = 0x2, /* 2 */
1154 UCC_GETH_NUM_OF_THREADS_4 = 0x0, /* 4 */ 1154 UCC_GETH_NUM_OF_THREADS_4 = 0x0, /* 4 */
1155 UCC_GETH_NUM_OF_THREADS_6 = 0x3, /* 6 */ 1155 UCC_GETH_NUM_OF_THREADS_6 = 0x3, /* 6 */
1156 UCC_GETH_NUM_OF_THREADS_8 = 0x4 /* 8 */ 1156 UCC_GETH_NUM_OF_THREADS_8 = 0x4 /* 8 */
1157} ucc_geth_num_of_threads_e; 1157};
1158 1158
1159/* UCC GETH number of station addresses */ 1159/* UCC GETH number of station addresses */
1160typedef enum ucc_geth_num_of_station_addresses { 1160enum ucc_geth_num_of_station_addresses {
1161 UCC_GETH_NUM_OF_STATION_ADDRESSES_1, /* 1 */ 1161 UCC_GETH_NUM_OF_STATION_ADDRESSES_1, /* 1 */
1162 UCC_GETH_NUM_OF_STATION_ADDRESSES_5 /* 5 */ 1162 UCC_GETH_NUM_OF_STATION_ADDRESSES_5 /* 5 */
1163} ucc_geth_num_of_station_addresses_e; 1163};
1164
1165typedef u8 enet_addr_t[ENET_NUM_OCTETS_PER_ADDRESS];
1166 1164
1167/* UCC GETH 82xx Ethernet Address Container */ 1165/* UCC GETH 82xx Ethernet Address Container */
1168typedef struct enet_addr_container { 1166struct enet_addr_container {
1169 enet_addr_t address; /* ethernet address */ 1167 u8 address[ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */
1170 ucc_geth_enet_address_recognition_location_e location; /* location in 1168 enum ucc_geth_enet_address_recognition_location location; /* location in
1171 82xx address 1169 82xx address
1172 recognition 1170 recognition
1173 hardware */ 1171 hardware */
1174 struct list_head node; 1172 struct list_head node;
1175} enet_addr_container_t; 1173};
1176 1174
1177#define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, enet_addr_container_t, node) 1175#define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, struct enet_addr_container, node)
1178 1176
1179/* UCC GETH Termination Action Descriptor (TAD) structure. */ 1177/* UCC GETH Termination Action Descriptor (TAD) structure. */
1180typedef struct ucc_geth_tad_params { 1178struct ucc_geth_tad_params {
1181 int rx_non_dynamic_extended_features_mode; 1179 int rx_non_dynamic_extended_features_mode;
1182 int reject_frame; 1180 int reject_frame;
1183 ucc_geth_vlan_operation_tagged_e vtag_op; 1181 enum ucc_geth_vlan_operation_tagged vtag_op;
1184 ucc_geth_vlan_operation_non_tagged_e vnontag_op; 1182 enum ucc_geth_vlan_operation_non_tagged vnontag_op;
1185 ucc_geth_qos_mode_e rqos; 1183 enum ucc_geth_qos_mode rqos;
1186 u8 vpri; 1184 u8 vpri;
1187 u16 vid; 1185 u16 vid;
1188} ucc_geth_tad_params_t; 1186};
1189 1187
1190/* GETH protocol initialization structure */ 1188/* GETH protocol initialization structure */
1191typedef struct ucc_geth_info { 1189struct ucc_geth_info {
1192 ucc_fast_info_t uf_info; 1190 struct ucc_fast_info uf_info;
1193 u8 numQueuesTx; 1191 u8 numQueuesTx;
1194 u8 numQueuesRx; 1192 u8 numQueuesRx;
1195 int ipCheckSumCheck; 1193 int ipCheckSumCheck;
@@ -1251,51 +1249,51 @@ typedef struct ucc_geth_info {
1251 u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX]; 1249 u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
1252 u16 bdRingLenTx[NUM_TX_QUEUES]; 1250 u16 bdRingLenTx[NUM_TX_QUEUES];
1253 u16 bdRingLenRx[NUM_RX_QUEUES]; 1251 u16 bdRingLenRx[NUM_RX_QUEUES];
1254 enet_interface_e enet_interface; 1252 enum enet_interface enet_interface;
1255 ucc_geth_num_of_station_addresses_e numStationAddresses; 1253 enum ucc_geth_num_of_station_addresses numStationAddresses;
1256 qe_fltr_largest_external_tbl_lookup_key_size_e 1254 enum qe_fltr_largest_external_tbl_lookup_key_size
1257 largestexternallookupkeysize; 1255 largestexternallookupkeysize;
1258 ucc_geth_statistics_gathering_mode_e statisticsMode; 1256 enum ucc_geth_statistics_gathering_mode statisticsMode;
1259 ucc_geth_vlan_operation_tagged_e vlanOperationTagged; 1257 enum ucc_geth_vlan_operation_tagged vlanOperationTagged;
1260 ucc_geth_vlan_operation_non_tagged_e vlanOperationNonTagged; 1258 enum ucc_geth_vlan_operation_non_tagged vlanOperationNonTagged;
1261 ucc_geth_qos_mode_e rxQoSMode; 1259 enum ucc_geth_qos_mode rxQoSMode;
1262 ucc_geth_flow_control_mode_e aufc; 1260 enum ucc_geth_flow_control_mode aufc;
1263 ucc_geth_maccfg2_pad_and_crc_mode_e padAndCrc; 1261 enum ucc_geth_maccfg2_pad_and_crc_mode padAndCrc;
1264 ucc_geth_num_of_threads_e numThreadsTx; 1262 enum ucc_geth_num_of_threads numThreadsTx;
1265 ucc_geth_num_of_threads_e numThreadsRx; 1263 enum ucc_geth_num_of_threads numThreadsRx;
1266 qe_risc_allocation_e riscTx; 1264 enum qe_risc_allocation riscTx;
1267 qe_risc_allocation_e riscRx; 1265 enum qe_risc_allocation riscRx;
1268} ucc_geth_info_t; 1266};
1269 1267
1270/* structure representing UCC GETH */ 1268/* structure representing UCC GETH */
1271typedef struct ucc_geth_private { 1269struct ucc_geth_private {
1272 ucc_geth_info_t *ug_info; 1270 struct ucc_geth_info *ug_info;
1273 ucc_fast_private_t *uccf; 1271 struct ucc_fast_private *uccf;
1274 struct net_device *dev; 1272 struct net_device *dev;
1275 struct net_device_stats stats; /* linux network statistics */ 1273 struct net_device_stats stats; /* linux network statistics */
1276 ucc_geth_t *ug_regs; 1274 struct ucc_geth *ug_regs;
1277 ucc_geth_init_pram_t *p_init_enet_param_shadow; 1275 struct ucc_geth_init_pram *p_init_enet_param_shadow;
1278 ucc_geth_exf_global_pram_t *p_exf_glbl_param; 1276 struct ucc_geth_exf_global_pram *p_exf_glbl_param;
1279 u32 exf_glbl_param_offset; 1277 u32 exf_glbl_param_offset;
1280 ucc_geth_rx_global_pram_t *p_rx_glbl_pram; 1278 struct ucc_geth_rx_global_pram *p_rx_glbl_pram;
1281 u32 rx_glbl_pram_offset; 1279 u32 rx_glbl_pram_offset;
1282 ucc_geth_tx_global_pram_t *p_tx_glbl_pram; 1280 struct ucc_geth_tx_global_pram *p_tx_glbl_pram;
1283 u32 tx_glbl_pram_offset; 1281 u32 tx_glbl_pram_offset;
1284 ucc_geth_send_queue_mem_region_t *p_send_q_mem_reg; 1282 struct ucc_geth_send_queue_mem_region *p_send_q_mem_reg;
1285 u32 send_q_mem_reg_offset; 1283 u32 send_q_mem_reg_offset;
1286 ucc_geth_thread_data_tx_t *p_thread_data_tx; 1284 struct ucc_geth_thread_data_tx *p_thread_data_tx;
1287 u32 thread_dat_tx_offset; 1285 u32 thread_dat_tx_offset;
1288 ucc_geth_thread_data_rx_t *p_thread_data_rx; 1286 struct ucc_geth_thread_data_rx *p_thread_data_rx;
1289 u32 thread_dat_rx_offset; 1287 u32 thread_dat_rx_offset;
1290 ucc_geth_scheduler_t *p_scheduler; 1288 struct ucc_geth_scheduler *p_scheduler;
1291 u32 scheduler_offset; 1289 u32 scheduler_offset;
1292 ucc_geth_tx_firmware_statistics_pram_t *p_tx_fw_statistics_pram; 1290 struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram;
1293 u32 tx_fw_statistics_pram_offset; 1291 u32 tx_fw_statistics_pram_offset;
1294 ucc_geth_rx_firmware_statistics_pram_t *p_rx_fw_statistics_pram; 1292 struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram;
1295 u32 rx_fw_statistics_pram_offset; 1293 u32 rx_fw_statistics_pram_offset;
1296 ucc_geth_rx_interrupt_coalescing_table_t *p_rx_irq_coalescing_tbl; 1294 struct ucc_geth_rx_interrupt_coalescing_table *p_rx_irq_coalescing_tbl;
1297 u32 rx_irq_coalescing_tbl_offset; 1295 u32 rx_irq_coalescing_tbl_offset;
1298 ucc_geth_rx_bd_queues_entry_t *p_rx_bd_qs_tbl; 1296 struct ucc_geth_rx_bd_queues_entry *p_rx_bd_qs_tbl;
1299 u32 rx_bd_qs_tbl_offset; 1297 u32 rx_bd_qs_tbl_offset;
1300 u8 *p_tx_bd_ring[NUM_TX_QUEUES]; 1298 u8 *p_tx_bd_ring[NUM_TX_QUEUES];
1301 u32 tx_bd_ring_offset[NUM_TX_QUEUES]; 1299 u32 tx_bd_ring_offset[NUM_TX_QUEUES];
@@ -1308,7 +1306,7 @@ typedef struct ucc_geth_private {
1308 u16 cpucount[NUM_TX_QUEUES]; 1306 u16 cpucount[NUM_TX_QUEUES];
1309 volatile u16 *p_cpucount[NUM_TX_QUEUES]; 1307 volatile u16 *p_cpucount[NUM_TX_QUEUES];
1310 int indAddrRegUsed[NUM_OF_PADDRS]; 1308 int indAddrRegUsed[NUM_OF_PADDRS];
1311 enet_addr_t paddr[NUM_OF_PADDRS]; 1309 u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */
1312 u8 numGroupAddrInHash; 1310 u8 numGroupAddrInHash;
1313 u8 numIndAddrInHash; 1311 u8 numIndAddrInHash;
1314 u8 numIndAddrInReg; 1312 u8 numIndAddrInReg;
@@ -1334,6 +1332,6 @@ typedef struct ucc_geth_private {
1334 int oldspeed; 1332 int oldspeed;
1335 int oldduplex; 1333 int oldduplex;
1336 int oldlink; 1334 int oldlink;
1337} ucc_geth_private_t; 1335};
1338 1336
1339#endif /* __UCC_GETH_H__ */ 1337#endif /* __UCC_GETH_H__ */