net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe
Subsystems (4)
PATCH v9 4/7 net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe
From: Girish K S <[email protected]>
Added support for the EEE(Energy Efficient Ethernet) in 10G ethernet driver.
Signed-off-by Girish K S <[email protected]>
Neatening-by Joe Perches <[email protected]>
Signed-off-by Byungho An <[email protected]>
--- drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h | 53 +++++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c | 86 +++++++++- drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c | 47 ++++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 165 +++++++++++++++++++- .../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 4 + drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h | 5 + 6 files changed, 358 insertions(+), 2 deletions(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h +53 -0
@@ -115,6 +115,33 @@ struct sxgbe_mtl_ops;#define RX_PTP_SIGNAL 0x0A#define RX_PTP_RESV_MSG 0x0F +/* EEE-LPI mode flags*/ +#define TX_ENTRY_LPI_MODE 0x10 +#define TX_EXIT_LPI_MODE 0x20 +#define RX_ENTRY_LPI_MODE 0x40 +#define RX_EXIT_LPI_MODE 0x80 + +/* EEE-LPI Interrupt status flag */ +#define LPI_INT_STATUS BIT(5) + +/* EEE-LPI Default timer values */ +#define LPI_LINK_STATUS_TIMER 0x3E8 +#define LPI_MAC_WAIT_TIMER 0x00 + +/* EEE-LPI Control and status definitions */ +#define LPI_CTRL_STATUS_TXA BIT(19) +#define LPI_CTRL_STATUS_PLSDIS BIT(18) +#define LPI_CTRL_STATUS_PLS BIT(17) +#define LPI_CTRL_STATUS_LPIEN BIT(16) +#define LPI_CTRL_STATUS_TXRSTP BIT(11) +#define LPI_CTRL_STATUS_RXRSTP BIT(10) +#define LPI_CTRL_STATUS_RLPIST BIT(9) +#define LPI_CTRL_STATUS_TLPIST BIT(8) +#define LPI_CTRL_STATUS_RLPIEX BIT(3) +#define LPI_CTRL_STATUS_RLPIEN BIT(2) +#define LPI_CTRL_STATUS_TLPIEX BIT(1) +#define LPI_CTRL_STATUS_TLPIEN BIT(0) +enum dma_irq_status { tx_hard_error =BIT (0 ), tx_bump_tc =BIT (1 ),
@@ -199,6 +226,13 @@ struct sxgbe_extra_stats {unsigned long rx_buffer_access_err;unsigned long rx_data_transfer_err; +/* EEE-LPI stats */ +unsigned long tx_lpi_entry_n; +unsigned long tx_lpi_exit_n; +unsigned long rx_lpi_entry_n; +unsigned long rx_lpi_exit_n; +unsigned long eee_wakeup_error_n; +/* RX specific */ /* L2 error */ unsigned long rx_code_gmii_err;
@@ -296,6 +330,13 @@ struct sxgbe_core_ops { unsigned char feature_index);/* adjust SXGBE speed */ void (*set_speed)(void __iomem *ioaddr,unsigned char speed); + +/* EEE-LPI specific operations */ +void (*set_eee_mode)(void __iomem *ioaddr); +void (*reset_eee_mode)(void __iomem *ioaddr); +void (*set_eee_timer)(void __iomem *ioaddr,const int ls, +const int tw); +void (*set_eee_pls)(void __iomem *ioaddr,const int link); };const struct sxgbe_core_ops *sxgbe_get_core_ops (void );
@@ -352,6 +393,8 @@ struct sxgbe_hw_features {/* IEEE 1588-2008 */ unsigned int atime_stamp; +unsigned int eee; +unsigned int tx_csum_offload;unsigned int rx_csum_offload;unsigned int multi_macaddr;
@@ -435,6 +478,13 @@ struct sxgbe_priv_data {/* tc control */ int tx_tc;int rx_tc; +/* EEE-LPI specific members */ +struct timer_list eee_ctrl_timer; +bool tx_path_in_lpi_mode; +int lpi_irq; +int eee_enabled; +int eee_active; +int tx_lpi_timer; };/* Function prototypes */
@@ -457,4 +507,7 @@ int sxgbe_restore(struct net_device *ndev);const struct sxgbe_mtl_ops *sxgbe_get_mtl_ops (void ); +void sxgbe_disable_eee_mode (struct sxgbe_priv_data *const priv); +bool sxgbe_eee_init (struct sxgbe_priv_data *const priv); +#endif /* __SXGBE_COMMON_H__ */
drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c +85 -1
108 lines not on this page · raw message
drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c +47 -0
57 lines not on this page · raw message
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +164 -1
250 lines not on this page · raw message
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +4 -0
@@ -160,6 +160,10 @@ static int sxgbe_platform_probe(struct platform_device *pdev) } } + priv->lpi_irq =irq_of_parse_and_map (dev->of_node, loop++); +if (priv->lpi_irq == -ENXIO ) + priv->lpi_irq = priv->dev->irq; +platform_set_drvdata (pdev, priv->dev);pr_debug ("platform driver registration completed\n" );
drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h +5 -0
@@ -25,6 +25,11 @@#define SXGBE_CORE_HASH_TABLE_REG5 0x0024#define SXGBE_CORE_HASH_TABLE_REG6 0x0028#define SXGBE_CORE_HASH_TABLE_REG7 0x002C + +/* EEE-LPI Registers */ +#define SXGBE_CORE_LPI_CTRL_STATUS 0x00D0 +#define SXGBE_CORE_LPI_TIMER_CTRL 0x00D4 +/* VLAN Specific Registers */ #define SXGBE_CORE_VLAN_TAG_REG 0x0050#define SXGBE_CORE_VLAN_HASHTAB_REG 0x0058
Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html