diff options
author | Rayagond Kokatanur <rayagond@vayavyalabs.com> | 2011-10-17 20:01:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 19:24:17 -0400 |
commit | 1db123fbe974f9b5eeb6a7083d7430e99fbd9ac1 (patch) | |
tree | c4c4128c60d6b5b40eb8c72cf00dfe32b6c963f9 /drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |
parent | 48febf7e64767c673cb84c7d9e2d1006115a0dc8 (diff) |
stmmac: use predefined macros for HW cap register fields (V4)
Signed-off-by: Rayagond Kokatanur <rayagond@vayavyalabs.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_main.c')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3c7ef7127d7..c88dc358f9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -799,33 +799,45 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) | |||
799 | u32 hw_cap = priv->hw->dma->get_hw_feature(priv->ioaddr); | 799 | u32 hw_cap = priv->hw->dma->get_hw_feature(priv->ioaddr); |
800 | 800 | ||
801 | if (likely(hw_cap)) { | 801 | if (likely(hw_cap)) { |
802 | priv->dma_cap.mbps_10_100 = (hw_cap & 0x1); | 802 | priv->dma_cap.mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); |
803 | priv->dma_cap.mbps_1000 = (hw_cap & 0x2) >> 1; | 803 | priv->dma_cap.mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; |
804 | priv->dma_cap.half_duplex = (hw_cap & 0x4) >> 2; | 804 | priv->dma_cap.half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2; |
805 | priv->dma_cap.hash_filter = (hw_cap & 0x10) >> 4; | 805 | priv->dma_cap.hash_filter = (hw_cap & DMA_HW_FEAT_HASHSEL) >> 4; |
806 | priv->dma_cap.multi_addr = (hw_cap & 0x20) >> 5; | 806 | priv->dma_cap.multi_addr = |
807 | priv->dma_cap.pcs = (hw_cap & 0x40) >> 6; | 807 | (hw_cap & DMA_HW_FEAT_ADDMACADRSEL) >> 5; |
808 | priv->dma_cap.sma_mdio = (hw_cap & 0x100) >> 8; | 808 | priv->dma_cap.pcs = (hw_cap & DMA_HW_FEAT_PCSSEL) >> 6; |
809 | priv->dma_cap.pmt_remote_wake_up = (hw_cap & 0x200) >> 9; | 809 | priv->dma_cap.sma_mdio = (hw_cap & DMA_HW_FEAT_SMASEL) >> 8; |
810 | priv->dma_cap.pmt_magic_frame = (hw_cap & 0x400) >> 10; | 810 | priv->dma_cap.pmt_remote_wake_up = |
811 | priv->dma_cap.rmon = (hw_cap & 0x800) >> 11; /* MMC */ | 811 | (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9; |
812 | priv->dma_cap.pmt_magic_frame = | ||
813 | (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10; | ||
814 | /*MMC*/ | ||
815 | priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11; | ||
812 | /* IEEE 1588-2002*/ | 816 | /* IEEE 1588-2002*/ |
813 | priv->dma_cap.time_stamp = (hw_cap & 0x1000) >> 12; | 817 | priv->dma_cap.time_stamp = |
818 | (hw_cap & DMA_HW_FEAT_TSVER1SEL) >> 12; | ||
814 | /* IEEE 1588-2008*/ | 819 | /* IEEE 1588-2008*/ |
815 | priv->dma_cap.atime_stamp = (hw_cap & 0x2000) >> 13; | 820 | priv->dma_cap.atime_stamp = |
821 | (hw_cap & DMA_HW_FEAT_TSVER2SEL) >> 13; | ||
816 | /* 802.3az - Energy-Efficient Ethernet (EEE) */ | 822 | /* 802.3az - Energy-Efficient Ethernet (EEE) */ |
817 | priv->dma_cap.eee = (hw_cap & 0x4000) >> 14; | 823 | priv->dma_cap.eee = (hw_cap & DMA_HW_FEAT_EEESEL) >> 14; |
818 | priv->dma_cap.av = (hw_cap & 0x8000) >> 15; | 824 | priv->dma_cap.av = (hw_cap & DMA_HW_FEAT_AVSEL) >> 15; |
819 | /* TX and RX csum */ | 825 | /* TX and RX csum */ |
820 | priv->dma_cap.tx_coe = (hw_cap & 0x10000) >> 16; | 826 | priv->dma_cap.tx_coe = (hw_cap & DMA_HW_FEAT_TXCOESEL) >> 16; |
821 | priv->dma_cap.rx_coe_type1 = (hw_cap & 0x20000) >> 17; | 827 | priv->dma_cap.rx_coe_type1 = |
822 | priv->dma_cap.rx_coe_type2 = (hw_cap & 0x40000) >> 18; | 828 | (hw_cap & DMA_HW_FEAT_RXTYP1COE) >> 17; |
823 | priv->dma_cap.rxfifo_over_2048 = (hw_cap & 0x80000) >> 19; | 829 | priv->dma_cap.rx_coe_type2 = |
830 | (hw_cap & DMA_HW_FEAT_RXTYP2COE) >> 18; | ||
831 | priv->dma_cap.rxfifo_over_2048 = | ||
832 | (hw_cap & DMA_HW_FEAT_RXFIFOSIZE) >> 19; | ||
824 | /* TX and RX number of channels */ | 833 | /* TX and RX number of channels */ |
825 | priv->dma_cap.number_rx_channel = (hw_cap & 0x300000) >> 20; | 834 | priv->dma_cap.number_rx_channel = |
826 | priv->dma_cap.number_tx_channel = (hw_cap & 0xc00000) >> 22; | 835 | (hw_cap & DMA_HW_FEAT_RXCHCNT) >> 20; |
836 | priv->dma_cap.number_tx_channel = | ||
837 | (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; | ||
827 | /* Alternate (enhanced) DESC mode*/ | 838 | /* Alternate (enhanced) DESC mode*/ |
828 | priv->dma_cap.enh_desc = (hw_cap & 0x1000000) >> 24; | 839 | priv->dma_cap.enh_desc = |
840 | (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; | ||
829 | 841 | ||
830 | } else | 842 | } else |
831 | pr_debug("\tNo HW DMA feature register supported"); | 843 | pr_debug("\tNo HW DMA feature register supported"); |