amd-xgbe: AMD XGBE driver updates 2016-11-01
Subsystems (4)
cover amd-xgbe: AMD XGBE driver updates 2016-11-01
The majority of changes in this patch series is in preparation for and adding support for a new PCI version of the hardware that has additional features and function (Increased channels/queues, SFP+ support, re-driver support, etc.).
The following updates and fixes are included in this driver update series:
- Fix formatting of PCS debug register dump
- Prepare for priority-based FIFO allocation
- Implement priority-based FIFO allocation
- Prepare for working with more than one type of PCS/PHY
- Prepare for the introduction of clause 37 auto-negotiation
- Add support for clause 37 auto-negotiation
- Prepare for supporting a new PCS register access method
- Add support for 64-bit management counter registers
- Update DMA channel status determination
- Prepare for supporting PCI devices in addition to platform devices
- Add a soft reset hardware workaround
- Add a Tx timestamp hardware workaround
- Add support for new PCI devices
- Allow for a greater number of Rx queues to be used
- Add support for a new DMA interrupt mode
- Add support for FIFO and descriptor cache ECC status
- Add I2C support in prep for SFP+ support
- Expose the phylib phy_aneg_done API call
- Add support for SFP+
- Add support for MDIO attached PHYs
- Add support for a KR re-driver
This patch series is based on net-next.
---
Tom Lendacky (21):
amd-xgbe: Fix formatting of PCS register dump
amd-xgbe: Prepare for priority-based FIFO allocation
amd-xgbe: Perform priority-based hardware FIFO allocation
amd-xgbe: Prepare for working with more than one type of phy
amd-xgbe: Prepare for introduction of clause 37 autoneg
amd-xgbe: Add support for clause 37 auto-negotiation
amd-xgbe: Prepare for a new PCS register access method
amd-xgbe: Support for 64-bit management counter registers
amd-xgbe: Update how to determine DMA channel status
amd-xgbe: Prepare for supporting PCI devices
amd-xgbe: Guard against incorrectly generated interrupts
amd-xgbe: Add a workaround for Tx timestamp issue
amd-xgbe: Add PCI device support
amd-xgbe: Allow for a greater number of Rx queues
amd-xgbe: Add support for new DMA interrupt mode
amd-xgbe: Add ECC status support for the device memory
amd-xgbe: Add I2C support for determining SFP media types
net: phy: expose phy_aneg_done API for use by drivers
amd-xgbe: Add support for SFP+ modules
amd-xgbe: Add support for MDIO attached PHYs
amd-xgbe: Add support for a KR redriver
drivers/net/ethernet/amd/Kconfig | 10 drivers/net/ethernet/amd/xgbe/Makefile | 5 drivers/net/ethernet/amd/xgbe/xgbe-common.h | 385 +++ drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 152 + drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 1140 +++++++-- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 346 ++- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 19 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 492 ++++ drivers/net/ethernet/amd/xgbe/xgbe-main.c | 698 +----- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1130 +++++---- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 507 ++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 845 +++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 3083 +++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 642 +++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 386 +++ drivers/net/phy/phy.c | 3 include/linux/phy.h | 1 17 files changed, 8390 insertions(+), 1454 deletions(-) create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-pci.c create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-platform.c
Signature · 1 line
Tom Lendacky
PATCH 1/21 amd-xgbe: Fix formatting of PCS register dump
Fix the length value used for the PCS register dump so that the full value can be displayed.
--- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +12 -12
@@ -1257,33 +1257,33 @@ static void xgbe_dump_phy_registers(struct xgbe_prv_data *pdata)dev_dbg (dev,"\n************* PHY Reg dump **********************\n" ); -dev_dbg (dev,"PCS Control Reg (%#04x) = %#04x\n" ,MDIO_CTRL1 , +dev_dbg (dev,"PCS Control Reg (%#06x) = %#06x\n" ,MDIO_CTRL1 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_CTRL1 )); -dev_dbg (dev,"PCS Status Reg (%#04x) = %#04x\n" ,MDIO_STAT1 , +dev_dbg (dev,"PCS Status Reg (%#06x) = %#06x\n" ,MDIO_STAT1 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_STAT1 )); -dev_dbg (dev,"Phy Id (PHYS ID 1 %#04x)= %#04x\n" ,MDIO_DEVID1 , +dev_dbg (dev,"Phy Id (PHYS ID 1 %#06x)= %#06x\n" ,MDIO_DEVID1 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_DEVID1 )); -dev_dbg (dev,"Phy Id (PHYS ID 2 %#04x)= %#04x\n" ,MDIO_DEVID2 , +dev_dbg (dev,"Phy Id (PHYS ID 2 %#06x)= %#06x\n" ,MDIO_DEVID2 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_DEVID2 )); -dev_dbg (dev,"Devices in Package (%#04x)= %#04x\n" ,MDIO_DEVS1 , +dev_dbg (dev,"Devices in Package (%#06x)= %#06x\n" ,MDIO_DEVS1 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_DEVS1 )); -dev_dbg (dev,"Devices in Package (%#04x)= %#04x\n" ,MDIO_DEVS2 , +dev_dbg (dev,"Devices in Package (%#06x)= %#06x\n" ,MDIO_DEVS2 ,XMDIO_READ (pdata,MDIO_MMD_PCS ,MDIO_DEVS2 )); -dev_dbg (dev,"Auto-Neg Control Reg (%#04x) = %#04x\n" ,MDIO_CTRL1 , +dev_dbg (dev,"Auto-Neg Control Reg (%#06x) = %#06x\n" ,MDIO_CTRL1 ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_CTRL1 )); -dev_dbg (dev,"Auto-Neg Status Reg (%#04x) = %#04x\n" ,MDIO_STAT1 , +dev_dbg (dev,"Auto-Neg Status Reg (%#06x) = %#06x\n" ,MDIO_STAT1 ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_STAT1 )); -dev_dbg (dev,"Auto-Neg Ad Reg 1 (%#04x) = %#04x\n" , +dev_dbg (dev,"Auto-Neg Ad Reg 1 (%#06x) = %#06x\n" ,MDIO_AN_ADVERTISE ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_AN_ADVERTISE )); -dev_dbg (dev,"Auto-Neg Ad Reg 2 (%#04x) = %#04x\n" , +dev_dbg (dev,"Auto-Neg Ad Reg 2 (%#06x) = %#06x\n" ,MDIO_AN_ADVERTISE +1 ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_AN_ADVERTISE +1 )); -dev_dbg (dev,"Auto-Neg Ad Reg 3 (%#04x) = %#04x\n" , +dev_dbg (dev,"Auto-Neg Ad Reg 3 (%#06x) = %#06x\n" ,MDIO_AN_ADVERTISE +2 ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_AN_ADVERTISE +2 )); -dev_dbg (dev,"Auto-Neg Completion Reg (%#04x) = %#04x\n" , +dev_dbg (dev,"Auto-Neg Completion Reg (%#06x) = %#06x\n" ,MDIO_AN_COMP_STAT ,XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_AN_COMP_STAT ));
PATCH 2/21 amd-xgbe: Prepare for priority-based FIFO allocation
In reply to Tom LendackyCurrently, the Rx and Tx fifos are evenly allocated between the hardware queues of the device. As more queues are instantiated, the fifo memory needs to be able to be allocated based on queue priority. This allows for higher priority queues to have more fifo memory than lower priority queues. Prepare for this by modifying the current fifo calculation to assign the fifo queue allocation in an array that is then used to program the hardware.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 57 ++++++++++++++++++++++-------- drivers/net/ethernet/amd/xgbe/xgbe.h | 3 +- 2 files changed, 43 insertions(+), 17 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +41 -16
@@ -2000,19 +2000,37 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata)XGMAC_IOWRITE_BITS (pdata,MTL_OMR ,RAA ,MTL_RAA_SP ); } -static unsigned int xgbe_calculate_per_queue_fifo (unsigned int fifo_size, -unsigned int queue_count) +static unsigned int xgbe_get_tx_fifo_size (struct xgbe_prv_data *pdata) { -unsigned int q_fifo_size; -unsigned int p_fifo; +unsigned int fifo_size; + +/* Calculate the configured fifo size */ + fifo_size =1 << (pdata->hw_feat.tx_fifo_size +7 ); + +/* The configured value may not be the actual amount of fifo RAM */ + return min_t(unsigned int, XGMAC_FIFO_TX_MAX, fifo_size); +} + +static unsigned int xgbe_get_rx_fifo_size (struct xgbe_prv_data *pdata) +{ +unsigned int fifo_size;/* Calculate the configured fifo size */ - q_fifo_size =1 << (fifo_size +7 ); + fifo_size =1 << (pdata->hw_feat.rx_fifo_size +7 );/* The configured value may not be the actual amount of fifo RAM */ - q_fifo_size = min_t(unsigned int, XGBE_FIFO_MAX, q_fifo_size); + return min_t(unsigned int, XGMAC_FIFO_RX_MAX, fifo_size); +} + +static void xgbe_calculate_equal_fifo (unsigned int fifo_size, +unsigned int queue_count, +unsigned int *fifo) +{ +unsigned int q_fifo_size; +unsigned int p_fifo; +unsigned int i; - q_fifo_size = q_fifo_size / queue_count; + q_fifo_size = fifo_size / queue_count;/* Each increment in the queue fifo size represents 256 bytes of * fifo, with 0 representing 256 bytes. Distribute the fifo equally
@@ -2022,39 +2040,46 @@ static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size,if (p_fifo) p_fifo--; -return p_fifo; +for (i =0 ; i < queue_count; i++) + fifo[i] = p_fifo; + +return ; }static void xgbe_config_tx_fifo_size (struct xgbe_prv_data *pdata) {unsigned int fifo_size; +unsigned int fifo[XGBE_MAX_QUEUES ];unsigned int i; - fifo_size =xgbe_calculate_per_queue_fifo (pdata->hw_feat.tx_fifo_size, - pdata->tx_q_count); + fifo_size =xgbe_get_tx_fifo_size (pdata); + +xgbe_calculate_equal_fifo (fifo_size, pdata->tx_q_count, fifo);for (i =0 ; i < pdata->tx_q_count; i++) -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_TQOMR ,TQS , fifo_size); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_TQOMR ,TQS , fifo[i]);netif_info (pdata, drv, pdata->netdev,"%d Tx hardware queues, %d byte fifo per queue\n" , - pdata->tx_q_count, ((fifo_size +1 ) *256 )); + pdata->tx_q_count, ((fifo[0 ] +1 ) *256 )); }static void xgbe_config_rx_fifo_size (struct xgbe_prv_data *pdata) {unsigned int fifo_size; +unsigned int fifo[XGBE_MAX_QUEUES ];unsigned int i; - fifo_size =xgbe_calculate_per_queue_fifo (pdata->hw_feat.rx_fifo_size, - pdata->rx_q_count); + fifo_size =xgbe_get_rx_fifo_size (pdata); + +xgbe_calculate_equal_fifo (fifo_size, pdata->rx_q_count, fifo);for (i =0 ; i < pdata->rx_q_count; i++) -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQOMR ,RQS , fifo_size); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQOMR ,RQS , fifo[i]);netif_info (pdata, drv, pdata->netdev,"%d Rx hardware queues, %d byte fifo per queue\n" , - pdata->rx_q_count, ((fifo_size +1 ) *256 )); + pdata->rx_q_count, ((fifo[0 ] +1 ) *256 )); }static void xgbe_config_queue_mapping (struct xgbe_prv_data *pdata)
drivers/net/ethernet/amd/xgbe/xgbe.h +2 -1
@@ -208,7 +208,8 @@#define XGMAC_DRIVER_CONTEXT 1#define XGMAC_IOCTL_CONTEXT 2 -#define XGBE_FIFO_MAX 81920 +#define XGMAC_FIFO_RX_MAX 81920 +#define XGMAC_FIFO_TX_MAX 81920#define XGBE_TC_MIN_QUANTUM 10
RE: [PATCH net-next v1 02/21] amd-xgbe: Prepare for priority-based FIFO allocation
Quoted 4 lines
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +4
-0+static void xgbe_calculate_equal_fifo (unsigned int fifo_size, +unsigned int queue_count, +unsigned int *fifo) +{
...
drivers/net/ethernet/amd/xgbe/xgbe-dev.c static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size, · line 2047
Quoted 3 lines
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +2
-0+ +return ; }
No need for explicit return.
Re: [PATCH net-next v1 02/21] amd-xgbe: Prepare for priority-based FIFO allocation
Quoted 11 lines · Yuval
Quoted 4 lines
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +4
-0+static void xgbe_calculate_equal_fifo (unsigned int fifo_size, +unsigned int queue_count, +unsigned int *fifo) +{...
drivers/net/ethernet/amd/xgbe/xgbe-dev.c static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size, · line 2047
Quoted 3 lines
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +2
-0+ +return ; }No need for explicit return.
Ok, if there's feedback that requires a v2 I'll remove the return, otherwise I plan to submit a checkpatch cleanup series as a follow-up to fix some of the new warnings issued by the newer version of checkpatch.
Thanks,
Tom
PATCH 3/21 amd-xgbe: Perform priority-based hardware FIFO allocation
In reply to Tom LendackyAllocate the FIFO across the hardware Rx queues based on the priority of the queues. Giving more FIFO resources to queues with a higher priority. If PFC is active but not enabled for a queue, then less resources can allocated to the queue.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 547 ++++++++++++++++++++++-------- drivers/net/ethernet/amd/xgbe/xgbe.h | 26 + 2 files changed, 434 insertions(+), 139 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +408 -139
@@ -123,6 +123,11 @@#include "xgbe.h" #include "xgbe-common.h" +static inline unsigned int xgbe_get_max_frame (struct xgbe_prv_data *pdata) +{ +return pdata->netdev->mtu +ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ; +} +static unsigned int xgbe_usec_to_riwt (struct xgbe_prv_data *pdata,unsigned int usec) {
@@ -491,6 +496,27 @@ static void xgbe_config_rss(struct xgbe_prv_data *pdata) "error configuring RSS, RSS disabled\n"); } +static bool xgbe_is_pfc_queue (struct xgbe_prv_data *pdata, +unsigned int queue) +{ +unsigned int prio, tc; + +for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) { +/* Does this queue handle the priority? */ +if (pdata->prio2q_map[prio] != queue) +continue ; + +/* Get the Traffic Class for this priority */ + tc = pdata->ets->prio_tc[prio]; + +/* Check if PFC is enabled for this traffic class */ +if (pdata->pfc->pfc_en & (1 << tc)) +return true; + } + +return false; +} +static int xgbe_disable_tx_flow_control (struct xgbe_prv_data *pdata) {unsigned int max_q_count, q_count;
@@ -528,27 +554,14 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata)for (i =0 ; i < pdata->rx_q_count; i++) {unsigned int ehfc =0 ; -if (pfc && ets) { -unsigned int prio; - -for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) { -unsigned int tc; - -/* Does this queue handle the priority? */ -if (pdata->prio2q_map[prio] != i) -continue ; - -/* Get the Traffic Class for this priority */ - tc = ets->prio_tc[prio]; - -/* Check if flow control should be enabled */ -if (pfc->pfc_en & (1 << tc)) { +if (pdata->rx_rfd[i]) { +/* Flow control thresholds are established */ +if (pfc && ets) { +if (xgbe_is_pfc_queue (pdata, i)) ehfc =1 ; -break ; - } + }else { + ehfc =1 ; } - }else { - ehfc =1 ; }XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQOMR ,EHFC , ehfc);
@@ -1327,106 +1340,6 @@ static int xgbe_config_tstamp(struct xgbe_prv_data *pdata,return 0 ; } -static void xgbe_config_tc (struct xgbe_prv_data *pdata) -{ -unsigned int offset, queue, prio; -u8 i; - -netdev_reset_tc (pdata->netdev); -if (!pdata->num_tcs) -return ; - -netdev_set_num_tc (pdata->netdev, pdata->num_tcs); - -for (i =0 , queue =0 , offset =0 ; i < pdata->num_tcs; i++) { -while ((queue < pdata->tx_q_count) && - (pdata->q2tc_map[queue] == i)) - queue++; - -netif_dbg (pdata, drv, pdata->netdev,"TC%u using TXq%u-%u\n" , - i, offset, queue -1 ); -netdev_set_tc_queue (pdata->netdev, i, queue - offset, offset); - offset = queue; - } - -if (!pdata->ets) -return ; - -for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) -netdev_set_prio_tc_map (pdata->netdev, prio, - pdata->ets->prio_tc[prio]); -} - -static void xgbe_config_dcb_tc (struct xgbe_prv_data *pdata) -{ -struct ieee_ets *ets = pdata->ets; -unsigned int total_weight, min_weight, weight; -unsigned int mask, reg, reg_val; -unsigned int i, prio; - -if (!ets) -return ; - -/* Set Tx to deficit weighted round robin scheduling algorithm (when -* traffic class is using ETS algorithm) -*/ -XGMAC_IOWRITE_BITS (pdata,MTL_OMR ,ETSALG ,MTL_ETSALG_DWRR ); - -/* Set Traffic Class algorithms */ - total_weight = pdata->netdev->mtu * pdata->hw_feat.tc_cnt; - min_weight = total_weight /100 ; -if (!min_weight) - min_weight =1 ; - -for (i =0 ; i < pdata->hw_feat.tc_cnt; i++) { -/* Map the priorities to the traffic class */ - mask =0 ; -for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) { -if (ets->prio_tc[prio] == i) - mask |= (1 << prio); - } - mask &=0xff ; - -netif_dbg (pdata, drv, pdata->netdev,"TC%u PRIO mask=%#x\n" , - i, mask); - reg =MTL_TCPM0R + (MTL_TCPM_INC * (i /MTL_TCPM_TC_PER_REG )); - reg_val =XGMAC_IOREAD (pdata, reg); - - reg_val &= ~(0xff << ((i %MTL_TCPM_TC_PER_REG ) <<3 )); - reg_val |= (mask << ((i %MTL_TCPM_TC_PER_REG ) <<3 )); - -XGMAC_IOWRITE (pdata, reg, reg_val); - -/* Set the traffic class algorithm */ -switch (ets->tc_tsa[i]) { -case IEEE_8021QAZ_TSA_STRICT : -netif_dbg (pdata, drv, pdata->netdev, -"TC%u using SP\n" , i); -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_ETSCR ,TSA , -MTL_TSA_SP ); -break ; -case IEEE_8021QAZ_TSA_ETS : - weight = total_weight * ets->tc_tx_bw[i] /100 ; - weight =clamp (weight, min_weight, total_weight); - -netif_dbg (pdata, drv, pdata->netdev, -"TC%u using DWRR (weight %u)\n" , i, weight); -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_ETSCR ,TSA , -MTL_TSA_ETS ); -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_QWR ,QW , - weight); -break ; - } - } - -xgbe_config_tc (pdata); -} - -static void xgbe_config_dcb_pfc (struct xgbe_prv_data *pdata) -{ -xgbe_config_flow_control (pdata); -} -static void xgbe_tx_start_xmit (struct xgbe_channel *channel,struct xgbe_ring *ring) {
@@ -2000,6 +1913,96 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata)XGMAC_IOWRITE_BITS (pdata,MTL_OMR ,RAA ,MTL_RAA_SP ); } +static void xgbe_queue_flow_control_threshold (struct xgbe_prv_data *pdata, +unsigned int queue, +unsigned int q_fifo_size) +{ +unsigned int frame_fifo_size; +unsigned int rfa, rfd; + + frame_fifo_size =XGMAC_FLOW_CONTROL_ALIGN (xgbe_get_max_frame (pdata)); + +if (pdata->pfcq[queue] && (q_fifo_size > pdata->pfc_rfa)) { +/* PFC is active for this queue */ + rfa = pdata->pfc_rfa; + rfd = rfa + frame_fifo_size; +if (rfd >XGMAC_FLOW_CONTROL_MAX ) + rfd =XGMAC_FLOW_CONTROL_MAX ; +if (rfa >=XGMAC_FLOW_CONTROL_MAX ) + rfa =XGMAC_FLOW_CONTROL_MAX -XGMAC_FLOW_CONTROL_UNIT ; + }else { +/* This path deals with just maximum frame sizes which are +* limited to a jumbo frame of 9,000 (plus headers, etc.) +* so we can never exceed the maximum allowable RFA/RFD +* values. +*/ +if (q_fifo_size <=2048 ) { +/* rx_rfd to zero to signal no flow control */ + pdata->rx_rfa[queue] =0 ; + pdata->rx_rfd[queue] =0 ; +return ; + } + +if (q_fifo_size <=4096 ) { +/* Between 2048 and 4096 */ + pdata->rx_rfa[queue] =0 ;/* Full - 1024 bytes */ + pdata->rx_rfd[queue] =1 ;/* Full - 1536 bytes */ +return ; + } + +if (q_fifo_size <= frame_fifo_size) { +/* Between 4096 and max-frame */ + pdata->rx_rfa[queue] =2 ;/* Full - 2048 bytes */ + pdata->rx_rfd[queue] =5 ;/* Full - 3584 bytes */ +return ; + } + +if (q_fifo_size <= (frame_fifo_size *3 )) { +/* Between max-frame and 3 max-frames, +* trigger if we get just over a frame of data and +* resume when we have just under half a frame left. +*/ + rfa = q_fifo_size - frame_fifo_size; + rfd = rfa + (frame_fifo_size /2 ); + }else { +/* Above 3 max-frames - trigger when just over +* 2 frames of space available +*/ + rfa = frame_fifo_size *2 ; + rfa +=XGMAC_FLOW_CONTROL_UNIT ; + rfd = rfa + frame_fifo_size; + } + } + + pdata->rx_rfa[queue] =XGMAC_FLOW_CONTROL_VALUE (rfa); + pdata->rx_rfd[queue] =XGMAC_FLOW_CONTROL_VALUE (rfd); +} + +static void xgbe_calculate_flow_control_threshold (struct xgbe_prv_data *pdata, +unsigned int *fifo) +{ +unsigned int q_fifo_size; +unsigned int i; + +for (i =0 ; i < pdata->rx_q_count; i++) { + q_fifo_size = (fifo[i] +1 ) *XGMAC_FIFO_UNIT ; + +xgbe_queue_flow_control_threshold (pdata, i, q_fifo_size); + } +} + +static void xgbe_config_flow_control_threshold (struct xgbe_prv_data *pdata) +{ +unsigned int i; + +for (i =0 ; i < pdata->rx_q_count; i++) { +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQFCR ,RFA , + pdata->rx_rfa[i]); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQFCR ,RFD , + pdata->rx_rfd[i]); + } +} +static unsigned int xgbe_get_tx_fifo_size (struct xgbe_prv_data *pdata) {unsigned int fifo_size;
@@ -2032,20 +2035,160 @@ static void xgbe_calculate_equal_fifo(unsigned int fifo_size, q_fifo_size = fifo_size / queue_count; -/* Each increment in the queue fifo size represents 256 bytes of -* fifo, with 0 representing 256 bytes. Distribute the fifo equally -* between the queues. +/* Calculate the fifo setting by dividing the queue's fifo size +* by the fifo allocation increment (with 0 representing the +* base allocation increment so decrement the result by 1). */ - p_fifo = q_fifo_size /256 ; + p_fifo = q_fifo_size /XGMAC_FIFO_UNIT ;if (p_fifo) p_fifo--; +/* Distribute the fifo equally amongst the queues */ for (i =0 ; i < queue_count; i++) fifo[i] = p_fifo;return ; } +static unsigned int xgbe_set_nonprio_fifos (unsigned int fifo_size, +unsigned int queue_count, +unsigned int *fifo) +{ +unsigned int i; + +BUILD_BUG_ON_NOT_POWER_OF_2 (XGMAC_FIFO_MIN_ALLOC ); + +if (queue_count <=IEEE_8021QAZ_MAX_TCS ) +return fifo_size; + +/* Rx queues 9 and up are for specialized packets, +* such as PTP or DCB control packets, etc. and +* don't require a large fifo +*/ +for (i =IEEE_8021QAZ_MAX_TCS ; i < queue_count; i++) { + fifo[i] = (XGMAC_FIFO_MIN_ALLOC /XGMAC_FIFO_UNIT ) -1 ; + fifo_size -=XGMAC_FIFO_MIN_ALLOC ; + } + +return fifo_size; +} + +static unsigned int xgbe_get_pfc_delay (struct xgbe_prv_data *pdata) +{ +unsigned int delay; + +/* If a delay has been provided, use that */ +if (pdata->pfc->delay) +return pdata->pfc->delay /8 ; + +/* Allow for two maximum size frames */ + delay =xgbe_get_max_frame (pdata); + delay +=XGMAC_ETH_PREAMBLE ; + delay *=2 ; + +/* Allow for PFC frame */ + delay +=XGMAC_PFC_DATA_LEN ; + delay +=ETH_HLEN +ETH_FCS_LEN ; + delay +=XGMAC_ETH_PREAMBLE ; + +/* Allow for miscellaneous delays (LPI exit, cable, etc.) */ + delay +=XGMAC_PFC_DELAYS ; + +return delay; +} + +static unsigned int xgbe_get_pfc_queues (struct xgbe_prv_data *pdata) +{ +unsigned int count, prio_queues; +unsigned int i; + +if (!pdata->pfc->pfc_en) +return 0 ; + + count =0 ; + prio_queues =XGMAC_PRIO_QUEUES (pdata->rx_q_count); +for (i =0 ; i < prio_queues; i++) { +if (!xgbe_is_pfc_queue (pdata, i)) +continue ; + + pdata->pfcq[i] =1 ; + count++; + } + +return count; +} + +static void xgbe_calculate_dcb_fifo (struct xgbe_prv_data *pdata, +unsigned int fifo_size, +unsigned int *fifo) +{ +unsigned int q_fifo_size, rem_fifo, addn_fifo; +unsigned int prio_queues; +unsigned int pfc_count; +unsigned int i; + + q_fifo_size =XGMAC_FIFO_ALIGN (xgbe_get_max_frame (pdata)); + prio_queues =XGMAC_PRIO_QUEUES (pdata->rx_q_count); + pfc_count =xgbe_get_pfc_queues (pdata); + +if (!pfc_count || ((q_fifo_size * prio_queues) > fifo_size)) { +/* No traffic classes with PFC enabled or can't do lossless */ +xgbe_calculate_equal_fifo (fifo_size, prio_queues, fifo); +return ; + } + +/* Calculate how much fifo we have to play with */ + rem_fifo = fifo_size - (q_fifo_size * prio_queues); + +/* Calculate how much more than base fifo PFC needs, which also +* becomes the threshold activation point (RFA) +*/ + pdata->pfc_rfa =xgbe_get_pfc_delay (pdata); + pdata->pfc_rfa =XGMAC_FLOW_CONTROL_ALIGN (pdata->pfc_rfa); + +if (pdata->pfc_rfa > q_fifo_size) { + addn_fifo = pdata->pfc_rfa - q_fifo_size; + addn_fifo =XGMAC_FIFO_ALIGN (addn_fifo); + }else { + addn_fifo =0 ; + } + +/* Calculate DCB fifo settings: +* - distribute remaining fifo between the VLAN priority +* queues based on traffic class PFC enablement and overall +* priority (0 is lowest priority, so start at highest) +*/ + i = prio_queues; +while (i >0 ) { + i--; + + fifo[i] = (q_fifo_size /XGMAC_FIFO_UNIT ) -1 ; + +if (!pdata->pfcq[i] || !addn_fifo) +continue ; + +if (addn_fifo > rem_fifo) { +netdev_warn (pdata->netdev, +"RXq%u cannot set needed fifo size\n" , i); +if (!rem_fifo) +continue ; + + addn_fifo = rem_fifo; + } + + fifo[i] += (addn_fifo /XGMAC_FIFO_UNIT ); + rem_fifo -= addn_fifo; + } + +if (rem_fifo) { +unsigned int inc_fifo = rem_fifo / prio_queues; + +/* Distribute remaining fifo across queues */ +for (i =0 ; i < prio_queues; i++) + fifo[i] += (inc_fifo /XGMAC_FIFO_UNIT ); + } +} +static void xgbe_config_tx_fifo_size (struct xgbe_prv_data *pdata) {unsigned int fifo_size;
@@ -2061,25 +2204,50 @@ static void xgbe_config_tx_fifo_size(struct xgbe_prv_data *pdata)netif_info (pdata, drv, pdata->netdev,"%d Tx hardware queues, %d byte fifo per queue\n" , - pdata->tx_q_count, ((fifo[0 ] +1 ) *256 )); + pdata->tx_q_count, ((fifo[0 ] +1 ) *XGMAC_FIFO_UNIT )); }static void xgbe_config_rx_fifo_size (struct xgbe_prv_data *pdata) {unsigned int fifo_size;unsigned int fifo[XGBE_MAX_QUEUES ]; +unsigned int prio_queues;unsigned int i; +/* Clear any DCB related fifo/queue information */ +memset (pdata->pfcq,0 ,sizeof (pdata->pfcq)); + pdata->pfc_rfa =0 ; + fifo_size =xgbe_get_rx_fifo_size (pdata); + prio_queues =XGMAC_PRIO_QUEUES (pdata->rx_q_count); + +/* Assign a minimum fifo to the non-VLAN priority queues */ + fifo_size =xgbe_set_nonprio_fifos (fifo_size, pdata->rx_q_count, fifo); -xgbe_calculate_equal_fifo (fifo_size, pdata->rx_q_count, fifo); +if (pdata->pfc && pdata->ets) +xgbe_calculate_dcb_fifo (pdata, fifo_size, fifo); +else +xgbe_calculate_equal_fifo (fifo_size, prio_queues, fifo);for (i =0 ; i < pdata->rx_q_count; i++)XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQOMR ,RQS , fifo[i]); -netif_info (pdata, drv, pdata->netdev, -"%d Rx hardware queues, %d byte fifo per queue\n" , - pdata->rx_q_count, ((fifo[0 ] +1 ) *256 )); +xgbe_calculate_flow_control_threshold (pdata, fifo); +xgbe_config_flow_control_threshold (pdata); + +if (pdata->pfc && pdata->ets && pdata->pfc->pfc_en) { +netif_info (pdata, drv, pdata->netdev, +"%u Rx hardware queues\n" , pdata->rx_q_count); +for (i =0 ; i < pdata->rx_q_count; i++) +netif_info (pdata, drv, pdata->netdev, +"RxQ%u, %u byte fifo queue\n" , i, + ((fifo[i] +1 ) *XGMAC_FIFO_UNIT )); + }else { +netif_info (pdata, drv, pdata->netdev, +"%u Rx hardware queues, %u byte fifo per queue\n" , + pdata->rx_q_count, + ((fifo[0 ] +1 ) *XGMAC_FIFO_UNIT )); + } }static void xgbe_config_queue_mapping (struct xgbe_prv_data *pdata)
@@ -2115,8 +2283,7 @@ static void xgbe_config_queue_mapping(struct xgbe_prv_data *pdata) }/* Map the 8 VLAN priority values to available MTL Rx queues */ - prio_queues = min_t(unsigned int, IEEE_8021QAZ_MAX_TCS, - pdata->rx_q_count); + prio_queues =XGMAC_PRIO_QUEUES (pdata->rx_q_count); ppq =IEEE_8021QAZ_MAX_TCS / prio_queues; ppq_extra =IEEE_8021QAZ_MAX_TCS % prio_queues;
@@ -2164,16 +2331,120 @@ static void xgbe_config_queue_mapping(struct xgbe_prv_data *pdata) } } -static void xgbe_config_flow_control_threshold (struct xgbe_prv_data *pdata) +static void xgbe_config_tc (struct xgbe_prv_data *pdata) { -unsigned int i; +unsigned int offset, queue, prio; +u8 i; -for (i =0 ; i < pdata->rx_q_count; i++) { -/* Activate flow control when less than 4k left in fifo */ -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQFCR ,RFA ,2 ); +netdev_reset_tc (pdata->netdev); +if (!pdata->num_tcs) +return ; + +netdev_set_num_tc (pdata->netdev, pdata->num_tcs); + +for (i =0 , queue =0 , offset =0 ; i < pdata->num_tcs; i++) { +while ((queue < pdata->tx_q_count) && + (pdata->q2tc_map[queue] == i)) + queue++; + +netif_dbg (pdata, drv, pdata->netdev,"TC%u using TXq%u-%u\n" , + i, offset, queue -1 ); +netdev_set_tc_queue (pdata->netdev, i, queue - offset, offset); + offset = queue; + } + +if (!pdata->ets) +return ; + +for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) +netdev_set_prio_tc_map (pdata->netdev, prio, + pdata->ets->prio_tc[prio]); +} + +static void xgbe_config_dcb_tc (struct xgbe_prv_data *pdata) +{ +struct ieee_ets *ets = pdata->ets; +unsigned int total_weight, min_weight, weight; +unsigned int mask, reg, reg_val; +unsigned int i, prio; + +if (!ets) +return ; + +/* Set Tx to deficit weighted round robin scheduling algorithm (when +* traffic class is using ETS algorithm) +*/ +XGMAC_IOWRITE_BITS (pdata,MTL_OMR ,ETSALG ,MTL_ETSALG_DWRR ); + +/* Set Traffic Class algorithms */ + total_weight = pdata->netdev->mtu * pdata->hw_feat.tc_cnt; + min_weight = total_weight /100 ; +if (!min_weight) + min_weight =1 ; + +for (i =0 ; i < pdata->hw_feat.tc_cnt; i++) { +/* Map the priorities to the traffic class */ + mask =0 ; +for (prio =0 ; prio <IEEE_8021QAZ_MAX_TCS ; prio++) { +if (ets->prio_tc[prio] == i) + mask |= (1 << prio); + } + mask &=0xff ; + +netif_dbg (pdata, drv, pdata->netdev,"TC%u PRIO mask=%#x\n" , + i, mask); + reg =MTL_TCPM0R + (MTL_TCPM_INC * (i /MTL_TCPM_TC_PER_REG )); + reg_val =XGMAC_IOREAD (pdata, reg); -/* De-activate flow control when more than 6k left in fifo */ -XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_Q_RQFCR ,RFD ,4 ); + reg_val &= ~(0xff << ((i %MTL_TCPM_TC_PER_REG ) <<3 )); + reg_val |= (mask << ((i %MTL_TCPM_TC_PER_REG ) <<3 )); + +XGMAC_IOWRITE (pdata, reg, reg_val); + +/* Set the traffic class algorithm */ +switch (ets->tc_tsa[i]) { +case IEEE_8021QAZ_TSA_STRICT : +netif_dbg (pdata, drv, pdata->netdev, +"TC%u using SP\n" , i); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_ETSCR ,TSA , +MTL_TSA_SP ); +break ; +case IEEE_8021QAZ_TSA_ETS : + weight = total_weight * ets->tc_tx_bw[i] /100 ; + weight =clamp (weight, min_weight, total_weight); + +netif_dbg (pdata, drv, pdata->netdev, +"TC%u using DWRR (weight %u)\n" , i, weight); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_ETSCR ,TSA , +MTL_TSA_ETS ); +XGMAC_MTL_IOWRITE_BITS (pdata, i,MTL_TC_QWR ,QW , + weight); +break ; + } + } + +xgbe_config_tc (pdata); +} + +static void xgbe_config_dcb_pfc (struct xgbe_prv_data *pdata) +{ +if (!test_bit (XGBE_DOWN , &pdata->dev_state)) { +/* Just stop the Tx queues while Rx fifo is changed */ +netif_tx_stop_all_queues (pdata->netdev); + +/* Suspend Rx so that fifo's can be adjusted */ + pdata->hw_if.disable_rx (pdata); + } + +xgbe_config_rx_fifo_size (pdata); +xgbe_config_flow_control (pdata); + +if (!test_bit (XGBE_DOWN , &pdata->dev_state)) { +/* Resume Rx */ + pdata->hw_if.enable_rx (pdata); + +/* Resume Tx queues */ +netif_tx_start_all_queues (pdata->netdev); } }
@@ -2881,12 +3152,10 @@ static int xgbe_init(struct xgbe_prv_data *pdata)xgbe_config_rx_threshold (pdata, pdata->rx_threshold);xgbe_config_tx_fifo_size (pdata);xgbe_config_rx_fifo_size (pdata); -xgbe_config_flow_control_threshold (pdata);/*TODO: Error Packet and undersized good Packet forwarding enable (FEP and FUP) */ xgbe_config_dcb_tc (pdata); -xgbe_config_dcb_pfc (pdata);xgbe_enable_mtl_interrupts (pdata);/*
drivers/net/ethernet/amd/xgbe/xgbe.h +26 -0
@@ -158,6 +158,7 @@#define XGBE_MAX_DMA_CHANNELS 16#define XGBE_MAX_QUEUES 16 +#define XGBE_PRIORITY_QUEUES 8#define XGBE_DMA_STOP_TIMEOUT 5/* DMA cache settings - Outer sharable, write-back, write-allocate */
@@ -177,6 +178,13 @@#define XGMAC_MAX_STD_PACKET 1518#define XGMAC_JUMBO_PACKET_MTU 9000#define XGMAC_MAX_JUMBO_PACKET 9018 +#define XGMAC_ETH_PREAMBLE (12 + 8)/* Inter-frame gap + preamble */ + +#define XGMAC_PFC_DATA_LEN 46 +#define XGMAC_PFC_DELAYS 14000 + +#define XGMAC_PRIO_QUEUES (_cnt) \ + min_t(unsigned int, IEEE_8021QAZ_MAX_TCS, (_cnt))/* Common property names */ #define XGBE_MAC_ADDR_PROPERTY "mac-address"
@@ -210,6 +218,12 @@#define XGMAC_FIFO_RX_MAX 81920#define XGMAC_FIFO_TX_MAX 81920 +#define XGMAC_FIFO_MIN_ALLOC 2048 +#define XGMAC_FIFO_UNIT 256 +#define XGMAC_FIFO_ALIGN (_x) \ + (((_x) + XGMAC_FIFO_UNIT - 1) & ~(XGMAC_FIFO_UNIT - 1)) +#define XGMAC_FIFO_FC_OFF 2048 +#define XGMAC_FIFO_FC_MIN 4096#define XGBE_TC_MIN_QUANTUM 10
@@ -234,6 +248,14 @@/* Flow control queue count */ #define XGMAC_MAX_FLOW_CONTROL_QUEUES 8 +/* Flow control threshold units */ +#define XGMAC_FLOW_CONTROL_UNIT 512 +#define XGMAC_FLOW_CONTROL_ALIGN (_x) \ + (((_x) + XGMAC_FLOW_CONTROL_UNIT - 1) & ~(XGMAC_FLOW_CONTROL_UNIT - 1)) +#define XGMAC_FLOW_CONTROL_VALUE (_x) \ + (((_x) < 1024) ? 0 : ((_x) / XGMAC_FLOW_CONTROL_UNIT) - 2) +#define XGMAC_FLOW_CONTROL_MAX 33280 +/* Maximum MAC address hash table size (256 bits = 8 bytes) */ #define XGBE_MAC_HASH_TABLE_SIZE 8
@@ -843,6 +865,8 @@ struct xgbe_prv_data {unsigned int pause_autoneg;unsigned int tx_pause;unsigned int rx_pause; +unsigned int rx_rfa[XGBE_MAX_QUEUES ]; +unsigned int rx_rfd[XGBE_MAX_QUEUES ];/* Receive Side Scaling settings */ u8 rss_key[XGBE_RSS_HASH_KEY_SIZE ];
@@ -882,6 +906,8 @@ struct xgbe_prv_data {struct ieee_pfc *pfc;unsigned int q2tc_map[XGBE_MAX_QUEUES ];unsigned int prio2q_map[IEEE_8021QAZ_MAX_TCS ]; +unsigned int pfcq[XGBE_MAX_QUEUES ]; +unsigned int pfc_rfa;u8 num_tcs;/* Hardware features of the device */
PATCH 4/21 amd-xgbe: Prepare for working with more than one type of phy
In reply to Tom LendackyPrepare the code to be able to work with more than one type of phy by adding additional callable functions into the phy interface and removing phy specific settings/functions from non-phy related files.
--- drivers/net/ethernet/amd/xgbe/Makefile | 3 drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 58 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 6 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 19 - drivers/net/ethernet/amd/xgbe/xgbe-main.c | 214 ++----- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 549 +++++------------ drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 821 ++++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 130 ++-- 8 files changed, 1140 insertions(+), 660 deletions(-) create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c
drivers/net/ethernet/amd/xgbe/Makefile +2 -1
@@ -2,7 +2,8 @@ obj-$(CONFIG_AMD_XGBE) += amd-xgbe.o amd-xgbe-objs := xgbe-main.o xgbe-drv.o xgbe-dev.o \ xgbe-desc.o xgbe-ethtool.o xgbe-mdio.o \ - xgbe-ptp.o + xgbe-ptp.o \ + xgbe-phy-v1.o amd-xgbe-$(CONFIG_AMD_XGBE_DCB) += xgbe-dcb.o amd-xgbe-$(CONFIG_DEBUG_FS) += xgbe-debugfs.o
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +19 -39
79 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +3 -3
@@ -778,7 +778,7 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)DBGPR ("<--xgbe_free_rx_data\n" ); } -static int xgbe_phy_init (struct xgbe_prv_data *pdata) +static int xgbe_phy_reset (struct xgbe_prv_data *pdata) { pdata->phy_link =-1 ; pdata->phy_speed =SPEED_UNKNOWN ;
@@ -1292,8 +1292,8 @@ static int xgbe_open(struct net_device *netdev)DBGPR ("-->xgbe_open\n" ); -/* Initialize the phy */ - ret =xgbe_phy_init (pdata); +/* Reset the phy settings */ + ret =xgbe_phy_reset (pdata);if (ret)return ret;
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1 -18
@@ -316,24 +316,7 @@ static int xgbe_set_settings(struct net_device *netdev, }if (cmd->autoneg ==AUTONEG_DISABLE ) { -switch (speed) { -case SPEED_10000 : -break ; -case SPEED_2500 : -if (pdata->speed_set !=XGBE_SPEEDSET_2500_10000 ) { -netdev_err (netdev,"unsupported speed %u\n" , - speed); -return -EINVAL ; - } -break ; -case SPEED_1000 : -if (pdata->speed_set !=XGBE_SPEEDSET_1000_10000 ) { -netdev_err (netdev,"unsupported speed %u\n" , - speed); -return -EINVAL ; - } -break ; -default : +if (!pdata->phy_if.phy_valid_speed (pdata, speed)) {netdev_err (netdev,"unsupported speed %u\n" , speed);return -EINVAL ; }
drivers/net/ethernet/amd/xgbe/xgbe-main.c +62 -152
319 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +165 -384
762 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c new file +821 -0
821 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +67 -63
202 lines not on this page · raw message
PATCH 5/21 amd-xgbe: Prepare for introduction of clause 37 autoneg
In reply to Tom LendackyPrepare for the future introduction of clause 37 auto-negotiation by updating the current auto-negotiation related functions to identify them as clause 73 functions. Move interrupt enablement to the enable/disable auto-negotiation functions. Update what will be common routines to check for the current type of AN and process accordingly.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 5 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 235 ++++++++++++++++++--------- drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 7 + drivers/net/ethernet/amd/xgbe/xgbe.h | 14 +- 4 files changed, 176 insertions(+), 85 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +5 -0
@@ -1052,6 +1052,11 @@#endif /* MDIO mask values */ +#define XGBE_AN_CL73_INT_CMPLT BIT(0) +#define XGBE_AN_CL73_INC_LINK BIT(1) +#define XGBE_AN_CL73_PG_RCV BIT(2) +#define XGBE_AN_CL73_INT_MASK 0x07 +#define XGBE_XNP_MCF_NULL_MESSAGE 0x001#define XGBE_XNP_ACK_PROCESSED BIT(12)#define XGBE_XNP_MP_FORMATTED BIT(13)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +155 -80
464 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c +7 -0
@@ -295,6 +295,11 @@ static enum xgbe_mode xgbe_phy_an_outcome(struct xgbe_prv_data *pdata)return mode; } +static enum xgbe_an_mode xgbe_phy_an_mode (struct xgbe_prv_data *pdata) +{ +return XGBE_AN_MODE_CL73 ; +} +static void xgbe_phy_pcs_power_cycle (struct xgbe_prv_data *pdata) {unsigned int reg;
@@ -814,6 +819,8 @@ void xgbe_init_function_ptrs_phy_v1(struct xgbe_phy_if *phy_if) phy_impl->switch_mode = xgbe_phy_switch_mode; phy_impl->cur_mode = xgbe_phy_cur_mode; + phy_impl->an_mode = xgbe_phy_an_mode; + phy_impl->an_outcome = xgbe_phy_an_outcome; phy_impl->kr_training_pre = xgbe_phy_kr_training_pre;
drivers/net/ethernet/amd/xgbe/xgbe.h +9 -5
@@ -263,11 +263,6 @@#define XGBE_AN_MS_TIMEOUT 500#define XGBE_LINK_TIMEOUT 10 -#define XGBE_AN_INT_CMPLT 0x01 -#define XGBE_AN_INC_LINK 0x02 -#define XGBE_AN_PG_RCV 0x04 -#define XGBE_AN_INT_MASK 0x07 -struct xgbe_prv_data ;struct xgbe_packet_data {
@@ -470,6 +465,11 @@ enum xgbe_speed { XGBE_SPEEDS, }; +enum xgbe_an_mode { +XGBE_AN_MODE_CL73 =0 , +XGBE_AN_MODE_NONE , +}; +enum xgbe_an {XGBE_AN_READY =0 ,XGBE_AN_PAGE_RECEIVED ,
@@ -699,6 +699,9 @@ struct xgbe_phy_impl_if {/* Retrieve current mode */ enum xgbe_mode (*cur_mode)(struct xgbe_prv_data *); +/* Retrieve current auto-negotiation mode */ +enum xgbe_an_mode (*an_mode)(struct xgbe_prv_data *); +/* Process results of auto-negotiation */ enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *);
@@ -968,6 +971,7 @@ struct xgbe_prv_data {unsigned int parallel_detect;unsigned int fec_ability;unsigned long an_start; +enum xgbe_an_mode an_mode;unsigned int lpm_ctrl;/* CTRL1 for resume */
PATCH 6/21 amd-xgbe: Add support for clause 37 auto-negotiation
In reply to Tom LendackyAdd support to be able to use clause 37 auto-negotiation.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 41 +++++ drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 242 ++++++++++++++++++++++++++- drivers/net/ethernet/amd/xgbe/xgbe.h | 11 + 3 files changed, 286 insertions(+), 8 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +41 -0
@@ -1027,6 +1027,10 @@#define MDIO_PMA_10GBR_FECCTRL 0x00ab#endif +#ifndef MDIO_PCS_DIG_CTRL +#define MDIO_PCS_DIG_CTRL 0x8000 +#endif +#ifndef MDIO_AN_XNP #define MDIO_AN_XNP 0x0016#endif
@@ -1047,10 +1051,34 @@#define MDIO_AN_INT 0x8002#endif +#ifndef MDIO_VEND2_AN_ADVERTISE +#define MDIO_VEND2_AN_ADVERTISE 0x0004 +#endif + +#ifndef MDIO_VEND2_AN_LP_ABILITY +#define MDIO_VEND2_AN_LP_ABILITY 0x0005 +#endif + +#ifndef MDIO_VEND2_AN_CTRL +#define MDIO_VEND2_AN_CTRL 0x8001 +#endif + +#ifndef MDIO_VEND2_AN_STAT +#define MDIO_VEND2_AN_STAT 0x8002 +#endif +#ifndef MDIO_CTRL1_SPEED1G #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)#endif +#ifndef MDIO_VEND2_CTRL1_AN_ENABLE +#define MDIO_VEND2_CTRL1_AN_ENABLE BIT(12) +#endif + +#ifndef MDIO_VEND2_CTRL1_AN_RESTART +#define MDIO_VEND2_CTRL1_AN_RESTART BIT(9) +#endif +/* MDIO mask values */ #define XGBE_AN_CL73_INT_CMPLT BIT(0)#define XGBE_AN_CL73_INC_LINK BIT(1)
@@ -1065,6 +1093,19 @@#define XGBE_KR_TRAINING_START BIT(0)#define XGBE_KR_TRAINING_ENABLE BIT(1) +#define XGBE_PCS_CL37_BP BIT(12) + +#define XGBE_AN_CL37_INT_CMPLT BIT(0) +#define XGBE_AN_CL37_INT_MASK 0x01 + +#define XGBE_AN_CL37_HD_MASK 0x40 +#define XGBE_AN_CL37_FD_MASK 0x20 + +#define XGBE_AN_CL37_PCS_MODE_MASK 0x06 +#define XGBE_AN_CL37_PCS_MODE_BASEX 0x00 +#define XGBE_AN_CL37_PCS_MODE_SGMII 0x04 +#define XGBE_AN_CL37_TX_CONFIG_MASK 0x08 +/* Bit setting and getting macros * The get macro will extract the current bit field value from within * the variable
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +235 -7
346 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +10 -1
@@ -261,7 +261,13 @@/* Auto-negotiation */ #define XGBE_AN_MS_TIMEOUT 500 -#define XGBE_LINK_TIMEOUT 10 +#define XGBE_LINK_TIMEOUT 5 + +#define XGBE_SGMII_AN_LINK_STATUS BIT(1) +#define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3)) +#define XGBE_SGMII_AN_LINK_SPEED_100 0x04 +#define XGBE_SGMII_AN_LINK_SPEED_1000 0x08 +#define XGBE_SGMII_AN_LINK_DUPLEX BIT(4)struct xgbe_prv_data ;
@@ -467,6 +473,8 @@ enum xgbe_speed {enum xgbe_an_mode {XGBE_AN_MODE_CL73 =0 , +XGBE_AN_MODE_CL37 , +XGBE_AN_MODE_CL37_SGMII ,XGBE_AN_MODE_NONE , };
@@ -961,6 +969,7 @@ struct xgbe_prv_data {/* Auto-negotiation state machine support */ unsigned int an_int; +unsigned int an_status;struct mutex an_mutex;enum xgbe_an an_result;enum xgbe_an an_state;
PATCH 7/21 amd-xgbe: Prepare for a new PCS register access method
In reply to Tom LendackyPrepare the code to be able to support accessing of the PCS registers in a new way, while maintaining the current access method. Provide a version specific field that indicates the method to use.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 21 +++-- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 107 +++++++++++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 1 drivers/net/ethernet/amd/xgbe/xgbe.h | 9 ++ 4 files changed, 119 insertions(+), 19 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +11 -10
@@ -852,14 +852,9 @@#define MTL_TSA_SP 0x00#define MTL_TSA_ETS 0x02 -/* PCS MMD select register offset -* The MMD select register is used for accessing PCS registers -* when the underlying APB3 interface is using indirect addressing. -* Indirect addressing requires accessing registers in two phases, -* an address phase and a data phase. The address phases requires -* writing an address selection value to the MMD select regiesters. -*/ -#define PCS_MMD_SELECT 0xff +/* PCS register offsets */ +#define PCS_V1_WINDOW_SELECT 0x03fc +#define PCS_V2_WINDOW_SELECT 0x9064/* SerDes integration register offsets */ #define SIR0_KR_RT_1 0x002c
@@ -1241,12 +1236,18 @@/* Macros for building, reading or writing register values or bits * within the register values of XPCS registers. */ -#define XPCS_IOWRITE (_pdata, _off, _val) \ +#define XPCS32_IOWRITE (_pdata, _off, _val) \ iowrite32(_val, (_pdata)->xpcs_regs + (_off)) -#define XPCS_IOREAD (_pdata, _off) \ +#define XPCS32_IOREAD (_pdata, _off) \ ioread32((_pdata)->xpcs_regs + (_off)) +#define XPCS16_IOWRITE (_pdata, _off, _val) \ + iowrite16(_val, (_pdata)->xpcs_regs + (_off)) + +#define XPCS16_IOREAD (_pdata, _off) \ + ioread16((_pdata)->xpcs_regs + (_off)) +/* Macros for building, reading or writing register values or bits * within the register values of SerDes integration registers. */
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +98 -9
135 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-main.c +1 -0
@@ -785,6 +785,7 @@ static int xgbe_resume(struct device *dev)static const struct xgbe_version_data xgbe_v1 = { .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v1, + .xpcs_access =XGBE_XPCS_ACCESS_V1 , };#ifdef CONFIG_ACPI
drivers/net/ethernet/amd/xgbe/xgbe.h +9 -0
@@ -471,6 +471,11 @@ enum xgbe_speed { XGBE_SPEEDS, }; +enum xgbe_xpcs_access { +XGBE_XPCS_ACCESS_V1 =0 , +XGBE_XPCS_ACCESS_V2 , +}; +enum xgbe_an_mode {XGBE_AN_MODE_CL73 =0 ,XGBE_AN_MODE_CL37 ,
@@ -798,6 +803,7 @@ struct xgbe_hw_features {struct xgbe_version_data {void (*init_function_ptrs_phy_impl)(struct xgbe_phy_if *); +enum xgbe_xpcs_access xpcs_access; };struct xgbe_prv_data {
@@ -826,6 +832,9 @@ struct xgbe_prv_data {/* XPCS indirect addressing lock */ spinlock_t xpcs_lock; +unsigned int xpcs_window; +unsigned int xpcs_window_size; +unsigned int xpcs_window_mask;/* RSS addressing mutex */ struct mutex rss_mutex;
PATCH 8/21 amd-xgbe: Support for 64-bit management counter registers
In reply to Tom LendackyAdd support for reading all management counter registers as 64-bit values. The indication of whether to read the high 32-bits to form a 64-bit value is indicated in the version data.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 36 ++++++++++++++++++++++-------- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 + 2 files changed, 27 insertions(+), 10 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +26 -10
@@ -2590,17 +2590,33 @@ static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo)bool read_hi;u64 val; -switch (reg_lo) { -/* These registers are always 64 bit */ -case MMC_TXOCTETCOUNT_GB_LO : -case MMC_TXOCTETCOUNT_G_LO : -case MMC_RXOCTETCOUNT_GB_LO : -case MMC_RXOCTETCOUNT_G_LO : - read_hi = true; -break ; +if (pdata->vdata->mmc_64bit) { +switch (reg_lo) { +/* These registers are always 32 bit */ +case MMC_RXRUNTERROR : +case MMC_RXJABBERERROR : +case MMC_RXUNDERSIZE_G : +case MMC_RXOVERSIZE_G : +case MMC_RXWATCHDOGERROR : + read_hi = false; +break ; -default : - read_hi = false; +default : + read_hi = true; + } + }else { +switch (reg_lo) { +/* These registers are always 64 bit */ +case MMC_TXOCTETCOUNT_GB_LO : +case MMC_TXOCTETCOUNT_G_LO : +case MMC_RXOCTETCOUNT_GB_LO : +case MMC_RXOCTETCOUNT_G_LO : + read_hi = true; +break ; + +default : + read_hi = false; + } } val =XGMAC_IOREAD (pdata, reg_lo);
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -804,6 +804,7 @@ struct xgbe_hw_features {struct xgbe_version_data {void (*init_function_ptrs_phy_impl)(struct xgbe_phy_if *);enum xgbe_xpcs_access xpcs_access; +unsigned int mmc_64bit; };struct xgbe_prv_data {
PATCH 9/21 amd-xgbe: Update how to determine DMA channel status
In reply to Tom LendackyTx and Rx DMA channel status determiniation is different depending on the version of the hardware. Update the channel status processing code to account for the change. Also, reduce the timeout value used when stopping the channels.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 4 ++ drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 58 ++++++++++++++++++--------- drivers/net/ethernet/amd/xgbe/xgbe.h | 2 - 3 files changed, 43 insertions(+), 21 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +4 -0
@@ -790,6 +790,10 @@#define MTL_Q_RQOMR_RSF_WIDTH 1#define MTL_Q_RQOMR_RTC_INDEX 0#define MTL_Q_RQOMR_RTC_WIDTH 2 +#define MTL_Q_TQDR_TRCSTS_INDEX 1 +#define MTL_Q_TQDR_TRCSTS_WIDTH 2 +#define MTL_Q_TQDR_TXQSTS_INDEX 4 +#define MTL_Q_TQDR_TXQSTS_WIDTH 1#define MTL_Q_TQOMR_FTQ_INDEX 0#define MTL_Q_TQOMR_FTQ_WIDTH 1#define MTL_Q_TQOMR_Q2TCMAP_INDEX 8
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +38 -20
91 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -1
@@ -159,7 +159,7 @@#define XGBE_MAX_DMA_CHANNELS 16#define XGBE_MAX_QUEUES 16#define XGBE_PRIORITY_QUEUES 8 -#define XGBE_DMA_STOP_TIMEOUT 5 +#define XGBE_DMA_STOP_TIMEOUT 1/* DMA cache settings - Outer sharable, write-back, write-allocate */ #define XGBE_DMA_OS_AXDOMAIN 0x2
PATCH 10/21 amd-xgbe: Prepare for supporting PCI devices
In reply to Tom LendackyUpdate the driver framework to separate out platform/ACPI specific code from general code during device initialization. This will allow for the introduction of PCI device support.
--- drivers/net/ethernet/amd/xgbe/Makefile | 3 drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 16 - drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 22 - drivers/net/ethernet/amd/xgbe/xgbe-main.c | 569 ++++------------------- drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 632 +++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 23 + 6 files changed, 755 insertions(+), 510 deletions(-) create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-platform.c
drivers/net/ethernet/amd/xgbe/Makefile +2 -1
@@ -3,7 +3,8 @@ obj-$(CONFIG_AMD_XGBE) += amd-xgbe.o amd-xgbe-objs := xgbe-main.o xgbe-drv.o xgbe-dev.o \ xgbe-desc.o xgbe-ethtool.o xgbe-mdio.o \ xgbe-ptp.o \ - xgbe-phy-v1.o + xgbe-phy-v1.o \ + xgbe-platform.o amd-xgbe-$(CONFIG_AMD_XGBE_DCB) += xgbe-dcb.o amd-xgbe-$(CONFIG_DEBUG_FS) += xgbe-debugfs.o
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +4 -12
@@ -2088,24 +2088,16 @@ static void xgbe_config_flow_control_threshold(struct xgbe_prv_data *pdata)static unsigned int xgbe_get_tx_fifo_size (struct xgbe_prv_data *pdata) { -unsigned int fifo_size; - -/* Calculate the configured fifo size */ - fifo_size =1 << (pdata->hw_feat.tx_fifo_size +7 ); -/* The configured value may not be the actual amount of fifo RAM */ - return min_t(unsigned int, XGMAC_FIFO_TX_MAX, fifo_size); + return min_t(unsigned int, pdata->tx_max_fifo_size, + pdata->hw_feat.tx_fifo_size); }static unsigned int xgbe_get_rx_fifo_size (struct xgbe_prv_data *pdata) { -unsigned int fifo_size; - -/* Calculate the configured fifo size */ - fifo_size =1 << (pdata->hw_feat.rx_fifo_size +7 ); -/* The configured value may not be the actual amount of fifo RAM */ - return min_t(unsigned int, XGMAC_FIFO_RX_MAX, fifo_size); + return min_t(unsigned int, pdata->rx_max_fifo_size, + pdata->hw_feat.rx_fifo_size); } static void xgbe_calculate_equal_fifo(unsigned int fifo_size,
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +6 -16
@@ -114,7 +114,6 @@* THE POSSIBILITY OF SUCH DAMAGE. */ -#include <linux/platform_device.h> #include <linux/spinlock.h> #include <linux/tcp.h> #include <linux/if_vlan.h>
@@ -160,18 +159,8 @@ static int xgbe_alloc_channels(struct xgbe_prv_data *pdata) channel->dma_regs = pdata->xgmac_regs +DMA_CH_BASE + (DMA_CH_INC * i); -if (pdata->per_channel_irq) { -/* Get the DMA interrupt (offset 1) */ - ret =platform_get_irq (pdata->pdev, i +1 ); -if (ret <0 ) { -netdev_err (pdata->netdev, -"platform_get_irq %u failed\n" , - i +1 ); - goto err_irq; - } - - channel->dma_irq = ret; - } +if (pdata->per_channel_irq) + channel->dma_irq = pdata->channel_irq[i];if (i < pdata->tx_ring_count) {spin_lock_init (&tx_ring->lock);
@@ -194,9 +183,6 @@ static int xgbe_alloc_channels(struct xgbe_prv_data *pdata)return 0 ; -err_irq: -kfree (rx_ring); - err_rx_ring:kfree (tx_ring);
@@ -590,6 +576,10 @@ void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata) hw_feat->tx_ch_cnt++; hw_feat->tc_cnt++; +/* Translate the fifo sizes into actual numbers */ + hw_feat->rx_fifo_size =1 << (hw_feat->rx_fifo_size +7 ); + hw_feat->tx_fifo_size =1 << (hw_feat->tx_fifo_size +7 ); +DBGPR ("<--xgbe_get_all_hw_features\n" ); }
drivers/net/ethernet/amd/xgbe/xgbe-main.c +92 -477
678 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-platform.c new file +632 -0
632 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +19 -4
@@ -210,8 +210,6 @@#define XGMAC_DRIVER_CONTEXT 1#define XGMAC_IOCTL_CONTEXT 2 -#define XGMAC_FIFO_RX_MAX 81920 -#define XGMAC_FIFO_TX_MAX 81920#define XGMAC_FIFO_MIN_ALLOC 2048#define XGMAC_FIFO_UNIT 256#define XGMAC_FIFO_ALIGN (_x) \
@@ -805,14 +803,16 @@ struct xgbe_version_data {void (*init_function_ptrs_phy_impl)(struct xgbe_phy_if *);enum xgbe_xpcs_access xpcs_access;unsigned int mmc_64bit; +unsigned int tx_max_fifo_size; +unsigned int rx_max_fifo_size; };struct xgbe_prv_data {struct net_device *netdev; -struct platform_device *pdev; +struct platform_device *platdev;struct acpi_device *adev;struct device *dev; -struct platform_device *phy_pdev; +struct platform_device *phy_platdev;struct device *phy_dev;/* Version related data */
@@ -845,6 +845,7 @@ struct xgbe_prv_data {int dev_irq;unsigned int per_channel_irq; +int channel_irq[XGBE_MAX_DMA_CHANNELS ];struct xgbe_hw_if hw_if;struct xgbe_phy_if phy_if;
@@ -863,12 +864,16 @@ struct xgbe_prv_data {/* Rings for Tx/Rx on a DMA channel */ struct xgbe_channel *channel; +unsigned int tx_max_channel_count; +unsigned int rx_max_channel_count;unsigned int channel_count;unsigned int tx_ring_count;unsigned int tx_desc_count;unsigned int rx_ring_count;unsigned int rx_desc_count; +unsigned int tx_max_q_count; +unsigned int rx_max_q_count;unsigned int tx_q_count;unsigned int rx_q_count;
@@ -880,11 +885,13 @@ struct xgbe_prv_data {unsigned int tx_threshold;unsigned int tx_pbl;unsigned int tx_osp_mode; +unsigned int tx_max_fifo_size;/* Rx settings */ unsigned int rx_sf_mode;unsigned int rx_threshold;unsigned int rx_pbl; +unsigned int rx_max_fifo_size;/* Tx coalescing settings */ unsigned int tx_usecs;
@@ -1005,6 +1012,14 @@ struct xgbe_prv_data { };/* Function prototypes*/ +struct xgbe_prv_data *xgbe_alloc_pdata (struct device *); +void xgbe_free_pdata (struct xgbe_prv_data *); +void xgbe_set_counts (struct xgbe_prv_data *); +int xgbe_config_netdev (struct xgbe_prv_data *); +void xgbe_deconfig_netdev (struct xgbe_prv_data *); + +int xgbe_platform_init (void ); +void xgbe_platform_exit (void );void xgbe_init_function_ptrs_dev (struct xgbe_hw_if *);void xgbe_init_function_ptrs_phy (struct xgbe_phy_if *);
PATCH 11/21 amd-xgbe: Guard against incorrectly generated interrupts
In reply to Tom LendackyDue to a hardware issue, it is possible for interrupt events to be incorrectly generated when performing a soft reset. To guard against this, perform the soft reset twice.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +15 -1
@@ -1897,7 +1897,7 @@ static int xgbe_disable_int(struct xgbe_channel *channel,return 0 ; } -static int xgbe_exit (struct xgbe_prv_data *pdata) +static int __xgbe_exit (struct xgbe_prv_data *pdata) {unsigned int count =2000 ;
@@ -1919,6 +1919,20 @@ static int xgbe_exit(struct xgbe_prv_data *pdata)return 0 ; } +static int xgbe_exit (struct xgbe_prv_data *pdata) +{ +int ret; + +/* To guard against possible incorrectly generated interrupts, +* issue the software reset twice. +*/ + ret =__xgbe_exit (pdata); +if (ret) +return ret; + +return __xgbe_exit (pdata); +} +static int xgbe_flush_tx_queues (struct xgbe_prv_data *pdata) {unsigned int i, count;
PATCH 12/21 amd-xgbe: Add a workaround for Tx timestamp issue
In reply to Tom LendackyUpdate the reading of the Tx timestamp to account for a hardware issue on how the fields and interrupt are cleared. The "seconds" portion of the timestamp should be read first, followed by the "nanoseconds" portion. Reading the "nanoseconds" portion should clear the timestamp data and the interrupt. Because of an issue with the hardware this order is reversed and reading the "seconds" portion actually clears the timestamp. The code currently follows this workaround, but to guard against future versions where this is fixed add a field to the version data to indicate if the workaround is required or not.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 13 ++++++++++--- drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 1 + drivers/net/ethernet/amd/xgbe/xgbe.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +10 -3
@@ -1360,14 +1360,21 @@ static u64 xgbe_get_tstamp_time(struct xgbe_prv_data *pdata)static u64 xgbe_get_tx_tstamp (struct xgbe_prv_data *pdata) { -unsigned int tx_snr; +unsigned int tx_snr, tx_ssr;u64 nsec; - tx_snr =XGMAC_IOREAD (pdata,MAC_TXSNR ); +if (pdata->vdata->tx_tstamp_workaround) { + tx_snr =XGMAC_IOREAD (pdata,MAC_TXSNR ); + tx_ssr =XGMAC_IOREAD (pdata,MAC_TXSSR ); + }else { + tx_ssr =XGMAC_IOREAD (pdata,MAC_TXSSR ); + tx_snr =XGMAC_IOREAD (pdata,MAC_TXSNR ); + } +if (XGMAC_GET_BITS (tx_snr,MAC_TXSNR ,TXTSSTSMIS ))return 0 ; - nsec =XGMAC_IOREAD (pdata,MAC_TXSSR ); + nsec = tx_ssr; nsec *=NSEC_PER_SEC ; nsec += tx_snr;
drivers/net/ethernet/amd/xgbe/xgbe-platform.c +1 -0
@@ -581,6 +581,7 @@ static int xgbe_platform_resume(struct device *dev) .xpcs_access = XGBE_XPCS_ACCESS_V1, .tx_max_fifo_size = 81920, .rx_max_fifo_size = 81920, + .tx_tstamp_workaround = 1, };#ifdef CONFIG_ACPI
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -805,6 +805,7 @@ struct xgbe_version_data {unsigned int mmc_64bit;unsigned int tx_max_fifo_size;unsigned int rx_max_fifo_size; +unsigned int tx_tstamp_workaround; };struct xgbe_prv_data {
PATCH 13/21 amd-xgbe: Add PCI device support
In reply to Tom LendackyAdd support for new PCI devices to the driver.
--- drivers/net/ethernet/amd/Kconfig | 4 drivers/net/ethernet/amd/xgbe/Makefile | 3 drivers/net/ethernet/amd/xgbe/xgbe-common.h | 99 +++ drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 76 ++ drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 18 - drivers/net/ethernet/amd/xgbe/xgbe-main.c | 24 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 28 + drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 501 +++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 854 +++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 9 drivers/net/ethernet/amd/xgbe/xgbe.h | 39 + 11 files changed, 1635 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-pci.c create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
drivers/net/ethernet/amd/Kconfig +2 -2
@@ -173,8 +173,8 @@ config SUNLANCE config AMD_XGBE tristate "AMD 10GbE Ethernet driver" - depends on ((OF_NET && OF_ADDRESS) || ACPI) && HAS_IOMEM && HAS_DMA - depends on ARM64 || COMPILE_TEST + depends on ((OF_NET && OF_ADDRESS) || ACPI || PCI) && HAS_IOMEM && HAS_DMA + depends on X86 || ARM64 || COMPILE_TEST select BITREVERSE select CRC32 select PTP_1588_CLOCK
drivers/net/ethernet/amd/xgbe/Makefile +2 -1
@@ -3,8 +3,9 @@ obj-$(CONFIG_AMD_XGBE) += amd-xgbe.o amd-xgbe-objs := xgbe-main.o xgbe-drv.o xgbe-dev.o \ xgbe-desc.o xgbe-ethtool.o xgbe-mdio.o \ xgbe-ptp.o \ - xgbe-phy-v1.o \ + xgbe-phy-v1.o xgbe-phy-v2.o \ xgbe-platform.o +amd-xgbe-$(CONFIG_PCI) += xgbe-pci.o amd-xgbe-$(CONFIG_AMD_XGBE_DCB) += xgbe-dcb.o amd-xgbe-$(CONFIG_DEBUG_FS) += xgbe-debugfs.o
drivers/net/ethernet/amd/xgbe/xgbe-common.h +99 -0
125 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +76 -0
88 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +11 -7
@@ -374,6 +374,10 @@ static irqreturn_t xgbe_isr(int irq, void *data) } } +/* If there is not a separate AN irq, handle it here */ +if (pdata->dev_irq == pdata->an_irq) + pdata->phy_if.an_isr (irq, pdata); + isr_done:return IRQ_HANDLED ; }
@@ -864,16 +868,16 @@ static int xgbe_start(struct xgbe_prv_data *pdata) hw_if->init (pdata); - ret = phy_if->phy_start (pdata); -if (ret) - goto err_phy; -xgbe_napi_enable (pdata,1 ); ret =xgbe_request_irqs (pdata);if (ret) goto err_napi; + ret = phy_if->phy_start (pdata); +if (ret) + goto err_irqs; + hw_if->enable_tx (pdata); hw_if->enable_rx (pdata);
@@ -886,12 +890,12 @@ static int xgbe_start(struct xgbe_prv_data *pdata)return 0 ; +err_irqs: +xgbe_free_irqs (pdata); + err_napi:xgbe_napi_disable (pdata,1 ); - phy_if->phy_stop (pdata); - -err_phy: hw_if->exit (pdata);return ret;
drivers/net/ethernet/amd/xgbe/xgbe-main.c +24 -0
@@ -291,6 +291,19 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)BUILD_BUG_ON_NOT_POWER_OF_2 (XGBE_RX_DESC_CNT ); pdata->rx_desc_count =XGBE_RX_DESC_CNT ; +/* Adjust the number of queues based on interrupts assigned */ +if (pdata->channel_irq_count) { + pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, + pdata->channel_irq_count); + pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, + pdata->channel_irq_count); + +if (netif_msg_probe (pdata)) +dev_dbg (pdata->dev, +"adjusted TX/RX DMA channel count = %u/%u\n" , + pdata->tx_ring_count, pdata->rx_ring_count); + } +/* Set the number of queues */ ret =netif_set_real_num_tx_queues (netdev, pdata->tx_ring_count);if (ret) {
@@ -393,6 +406,11 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)xgbe_debugfs_init (pdata); +netif_dbg (pdata, drv, pdata->netdev,"%u Tx software queues\n" , + pdata->tx_ring_count); +netif_dbg (pdata, drv, pdata->netdev,"%u Rx software queues\n" , + pdata->rx_ring_count); +return 0 ; err_wq:
@@ -431,11 +449,17 @@ static int __init xgbe_mod_init(void)if (ret)return ret; + ret =xgbe_pci_init (); +if (ret) +return ret; +return 0 ; } static void __exit xgbe_mod_exit(void) { +xgbe_pci_exit (); +xgbe_platform_exit (); }
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +20 -8
@@ -640,6 +640,11 @@ static irqreturn_t xgbe_an_isr(int irq, void *data)return IRQ_HANDLED ; } +static irqreturn_t xgbe_an_combined_isr (int irq,struct xgbe_prv_data *pdata) +{ +return xgbe_an_isr (irq, pdata); +} +static void xgbe_an_irq_work (struct work_struct *work) { struct xgbe_prv_data *pdata = container_of(work,
@@ -1237,7 +1242,8 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata)/* Disable auto-negotiation */ xgbe_an_disable_all (pdata); -devm_free_irq (pdata->dev, pdata->an_irq, pdata); +if (pdata->dev_irq != pdata->an_irq) +devm_free_irq (pdata->dev, pdata->an_irq, pdata); pdata->phy_if.phy_impl.stop (pdata);
@@ -1258,12 +1264,15 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)if (ret)return ret; - ret =devm_request_irq (pdata->dev, pdata->an_irq, - xgbe_an_isr,0 , pdata->an_name, - pdata); -if (ret) { -netdev_err (netdev,"phy irq request failed\n" ); - goto err_stop; +/* If we have a separate AN irq, enable it */ +if (pdata->dev_irq != pdata->an_irq) { + ret =devm_request_irq (pdata->dev, pdata->an_irq, + xgbe_an_isr,0 , pdata->an_name, + pdata); +if (ret) { +netdev_err (netdev,"phy irq request failed\n" ); + goto err_stop; + } }/* Set initial mode - call the mode setting routines
@@ -1289,7 +1298,8 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)return xgbe_phy_config_aneg (pdata); err_irq: -devm_free_irq (pdata->dev, pdata->an_irq, pdata); +if (pdata->dev_irq != pdata->an_irq) +devm_free_irq (pdata->dev, pdata->an_irq, pdata); err_stop: pdata->phy_if.phy_impl.stop (pdata);
@@ -1442,4 +1452,6 @@ void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *phy_if) phy_if->phy_config_aneg = xgbe_phy_config_aneg; phy_if->phy_valid_speed = xgbe_phy_valid_speed; + + phy_if->an_isr = xgbe_an_combined_isr; }
drivers/net/ethernet/amd/xgbe/xgbe-pci.c new file +501 -0
501 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c new file +854 -0
854 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-platform.c +8 -1
@@ -462,6 +462,9 @@ static int xgbe_platform_probe(struct platform_device *pdev)/* Set the hardware channel and queue counts */ xgbe_set_counts (pdata); +/* Always have XGMAC and XPCS (auto-negotiation) interrupts */ + pdata->irq_count =2 ; +/* Get the device interrupt */ ret =platform_get_irq (pdev,0 );if (ret <0 ) {
@@ -485,6 +488,10 @@ static int xgbe_platform_probe(struct platform_device *pdev) pdata->channel_irq[i] = ret; } + + pdata->channel_irq_count = max; + + pdata->irq_count += max; }/* Get the auto-negotiation interrupt */
@@ -609,7 +616,7 @@ static SIMPLE_DEV_PM_OPS(xgbe_platform_pm_ops,static struct platform_driver xgbe_driver = { .driver = { - .name ="amd-xgbe" , + .name =XGBE_DRV_NAME , #ifdef CONFIG_ACPI .acpi_match_table = xgbe_acpi_match, #endif
drivers/net/ethernet/amd/xgbe/xgbe.h +38 -1
@@ -200,6 +200,20 @@#define XGBE_ACPI_DMA_FREQ "amd,dma-freq"#define XGBE_ACPI_PTP_FREQ "amd,ptp-freq" +/* PCI BAR mapping */ +#define XGBE_XGMAC_BAR 0 +#define XGBE_XPCS_BAR 1 +#define XGBE_MAC_CTRL_OFFSET 0x1d000 +#define XGBE_I2C_CTRL_OFFSET 0x1e000 + +/* PCI MSIx support */ +#define XGBE_MSIX_BASE_COUNT 4 +#define XGBE_MSIX_MIN_COUNT (XGBE_MSIX_BASE_COUNT + 1) + +/* PCI clock frequencies */ +#define XGBE_V2_DMA_CLOCK_FREQ 500000000/* 500 MHz */ +#define XGBE_V2_PTP_CLOCK_FREQ 125000000/* 125 MHz */ +/* Timestamp support - values based on 50MHz PTP clock * 50MHz => 20 nsec */
@@ -738,6 +752,9 @@ struct xgbe_phy_if {/* For PHY settings validation */ bool (*phy_valid_speed)(struct xgbe_prv_data *,int ); +/* For single interrupt support */ +irqreturn_t (*an_isr)(int ,struct xgbe_prv_data *); +/* PHY implementation specific services */ struct xgbe_phy_impl_if phy_impl; };
@@ -810,6 +827,7 @@ struct xgbe_version_data {struct xgbe_prv_data {struct net_device *netdev; +struct pci_dev *pcidev;struct platform_device *platdev;struct acpi_device *adev;struct device *dev;
@@ -828,6 +846,8 @@ struct xgbe_prv_data {void __iomem *rxtx_regs;/* SerDes Rx/Tx CSRs */ void __iomem *sir0_regs;/* SerDes integration registers (1/2) */ void __iomem *sir1_regs;/* SerDes integration registers (2/2) */ +void __iomem *xprop_regs;/* XGBE property registers */ +void __iomem *xi2c_regs;/* XGBE I2C CSRs */ /* Overall device lock */ spinlock_t lock;
@@ -844,10 +864,17 @@ struct xgbe_prv_data {/* Flags representing xgbe_state */ unsigned long dev_state; +struct msix_entry *msix_entries;int dev_irq; -unsigned int per_channel_irq; +int smu_irq; +int i2c_irq;int channel_irq[XGBE_MAX_DMA_CHANNELS ]; +unsigned int per_channel_irq; +unsigned int irq_shared; +unsigned int irq_count; +unsigned int channel_irq_count; +struct xgbe_hw_if hw_if;struct xgbe_phy_if phy_if;struct xgbe_desc_if desc_if;
@@ -1009,6 +1036,8 @@ struct xgbe_prv_data {unsigned int debugfs_xpcs_mmd;unsigned int debugfs_xpcs_reg; + +unsigned int debugfs_xprop_reg;#endif };
@@ -1021,10 +1050,18 @@ struct xgbe_prv_data {int xgbe_platform_init (void );void xgbe_platform_exit (void ); +#ifdef CONFIG_PCI +int xgbe_pci_init (void ); +void xgbe_pci_exit (void ); +#else +static inline int xgbe_pci_init (void ) {return 0 ; } +static inline void xgbe_pci_exit (void ) { } +#endif void xgbe_init_function_ptrs_dev (struct xgbe_hw_if *);void xgbe_init_function_ptrs_phy (struct xgbe_phy_if *);void xgbe_init_function_ptrs_phy_v1 (struct xgbe_phy_if *); +void xgbe_init_function_ptrs_phy_v2 (struct xgbe_phy_if *);void xgbe_init_function_ptrs_desc (struct xgbe_desc_if *);const struct net_device_ops *xgbe_get_netdev_ops (void );const struct ethtool_ops *xgbe_get_ethtool_ops (void );
PATCH 14/21 amd-xgbe: Allow for a greater number of Rx queues
In reply to Tom LendackyRemove the call to netif_get_num_default_rss_queues() and replace it with num_online_cpus() to allow for the possibility of using all of the hardware DMA channels available.
--- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-main.c +1 -2
@@ -236,8 +236,7 @@ void xgbe_set_counts(struct xgbe_prv_data *pdata) pdata->tx_q_count = pdata->tx_ring_count; - pdata->rx_ring_count = min_t(unsigned int, -netif_get_num_default_rss_queues (), + pdata->rx_ring_count = min_t(unsigned int, num_online_cpus(), pdata->hw_feat.rx_ch_cnt); pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, pdata->rx_max_channel_count);
PATCH 15/21 amd-xgbe: Add support for new DMA interrupt mode
In reply to Tom LendackyThe current per channel DMA interrupt support is based on an edge triggered interrupt that is not maskable. This results in having to call the disable_irq/enable_irq functions in order to prevent interrupts during napi processing. The hardware now has a way to configure the per channel DMA interrupt that will allow for masking the interrupt which prevents calling disable_irq/enable_irq now. This patch makes use of this support.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 2 + drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 15 +++- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 99 +++++++++++++++++-------- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 2 + drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 4 + drivers/net/ethernet/amd/xgbe/xgbe.h | 5 + 6 files changed, 91 insertions(+), 36 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +2 -0
@@ -159,6 +159,8 @@#define DMA_ISR_MACIS_WIDTH 1#define DMA_ISR_MTLIS_INDEX 16#define DMA_ISR_MTLIS_WIDTH 1 +#define DMA_MR_INTM_INDEX 12 +#define DMA_MR_INTM_WIDTH 2#define DMA_MR_SWR_INDEX 0#define DMA_MR_SWR_WIDTH 1#define DMA_SBMR_EAME_INDEX 11
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +11 -4
@@ -646,6 +646,11 @@ static void xgbe_enable_dma_interrupts(struct xgbe_prv_data *pdata)unsigned int dma_ch_isr, dma_ch_ier;unsigned int i; +/* Set the interrupt mode if supported */ +if (pdata->channel_irq_mode) +XGMAC_IOWRITE_BITS (pdata,DMA_MR ,INTM , + pdata->channel_irq_mode); + channel = pdata->channel;for (i =0 ; i < pdata->channel_count; i++, channel++) {/* Clear all the interrupts which are set */
@@ -667,19 +672,21 @@ static void xgbe_enable_dma_interrupts(struct xgbe_prv_data *pdata)if (channel->tx_ring) {/* Enable the following Tx interrupts * TIE - Transmit Interrupt Enable (unless using -* per channel interrupts) +* per channel interrupts in edge triggered +* mode) */ -if (!pdata->per_channel_irq) +if (!pdata->per_channel_irq || pdata->channel_irq_mode)XGMAC_SET_BITS (dma_ch_ier,DMA_CH_IER ,TIE ,1 ); }if (channel->rx_ring) {/* Enable following Rx interrupts * RBUE - Receive Buffer Unavailable Enable * RIE - Receive Interrupt Enable (unless using -* per channel interrupts) +* per channel interrupts in edge triggered +* mode) */ XGMAC_SET_BITS (dma_ch_ier,DMA_CH_IER ,RBUE ,1 ); -if (!pdata->per_channel_irq) +if (!pdata->per_channel_irq || pdata->channel_irq_mode)XGMAC_SET_BITS (dma_ch_ier,DMA_CH_IER ,RIE ,1 ); }
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +68 -31
167 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-pci.c +2 -0
@@ -163,6 +163,7 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata) pdata->channel_irq_count = j; pdata->per_channel_irq =1 ; + pdata->channel_irq_mode =XGBE_IRQ_MODE_LEVEL ; }else { pdata->smu_irq = pdata->pcidev->irq; pdata->i2c_irq = pdata->pcidev->irq;
@@ -215,6 +216,7 @@ static int xgbe_config_msix(struct xgbe_prv_data *pdata) pdata->channel_irq_count = j; pdata->per_channel_irq =1 ; + pdata->channel_irq_mode =XGBE_IRQ_MODE_LEVEL ;if (netif_msg_probe (pdata))dev_dbg (pdata->dev,"MSI-X interrupts enabled\n" );
drivers/net/ethernet/amd/xgbe/xgbe-platform.c +3 -1
@@ -426,8 +426,10 @@ static int xgbe_platform_probe(struct platform_device *pdev) pdata->phy_mode =PHY_INTERFACE_MODE_XGMII ;/* Check for per channel interrupt support */ -if (device_property_present (dev,XGBE_DMA_IRQS_PROPERTY )) +if (device_property_present (dev,XGBE_DMA_IRQS_PROPERTY )) { pdata->per_channel_irq =1 ; + pdata->channel_irq_mode =XGBE_IRQ_MODE_EDGE ; + }/* Obtain device settings unique to ACPI/OF */ if (pdata->use_acpi)
drivers/net/ethernet/amd/xgbe/xgbe.h +5 -0
@@ -171,6 +171,10 @@#define XGBE_DMA_SYS_ARCACHE 0x0#define XGBE_DMA_SYS_AWCACHE 0x0 +/* DMA channel interrupt modes */ +#define XGBE_IRQ_MODE_EDGE 0 +#define XGBE_IRQ_MODE_LEVEL 1 +#define XGBE_DMA_INTERRUPT_MASK 0x31c7#define XGMAC_MIN_PACKET 60
@@ -874,6 +878,7 @@ struct xgbe_prv_data {unsigned int irq_shared;unsigned int irq_count;unsigned int channel_irq_count; +unsigned int channel_irq_mode;struct xgbe_hw_if hw_if;struct xgbe_phy_if phy_if;
PATCH 16/21 amd-xgbe: Add ECC status support for the device memory
In reply to Tom LendackySome versions of the amd-xgbe device are capable of reporting ECC error information back to the driver. Add support to process, track and report on this information.
--- drivers/net/ethernet/amd/Kconfig | 5 + drivers/net/ethernet/amd/xgbe/xgbe-common.h | 40 ++++++ drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 64 +++++++++ drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 182 +++++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-main.c | 13 ++ drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 12 +- drivers/net/ethernet/amd/xgbe/xgbe.h | 37 +++++ 7 files changed, 344 insertions(+), 9 deletions(-)
drivers/net/ethernet/amd/Kconfig +5 -0
@@ -178,6 +178,7 @@ config AMD_XGBE select BITREVERSE select CRC32 select PTP_1588_CLOCK + select AMD_XGBE_HAVE_ECC if X86 ---help--- This driver supports the AMD 10GbE Ethernet device found on an AMD SoC.
@@ -195,4 +196,8 @@ config AMD_XGBE_DCB If unsure, say N. +config AMD_XGBE_HAVE_ECC + bool + default n + endif # NET_VENDOR_AMD
drivers/net/ethernet/amd/xgbe/xgbe-common.h +40 -0
@@ -920,6 +920,10 @@#define XP_PROP_5 0x0014#define XP_MAC_ADDR_LO 0x0020#define XP_MAC_ADDR_HI 0x0024 +#define XP_ECC_ISR 0x0030 +#define XP_ECC_IER 0x0034 +#define XP_ECC_CNT0 0x003c +#define XP_ECC_CNT1 0x0040#define XP_DRIVER_INT_REQ 0x0060#define XP_DRIVER_INT_RO 0x0064#define XP_DRIVER_SCRATCH_0 0x0068
@@ -935,6 +939,42 @@#define XP_DRIVER_SCRATCH_0_COMMAND_WIDTH 8#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_INDEX 8#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_WIDTH 8 +#define XP_ECC_CNT0_RX_DED_INDEX 24 +#define XP_ECC_CNT0_RX_DED_WIDTH 8 +#define XP_ECC_CNT0_RX_SEC_INDEX 16 +#define XP_ECC_CNT0_RX_SEC_WIDTH 8 +#define XP_ECC_CNT0_TX_DED_INDEX 8 +#define XP_ECC_CNT0_TX_DED_WIDTH 8 +#define XP_ECC_CNT0_TX_SEC_INDEX 0 +#define XP_ECC_CNT0_TX_SEC_WIDTH 8 +#define XP_ECC_CNT1_DESC_DED_INDEX 8 +#define XP_ECC_CNT1_DESC_DED_WIDTH 8 +#define XP_ECC_CNT1_DESC_SEC_INDEX 0 +#define XP_ECC_CNT1_DESC_SEC_WIDTH 8 +#define XP_ECC_IER_DESC_DED_INDEX 0 +#define XP_ECC_IER_DESC_DED_WIDTH 1 +#define XP_ECC_IER_DESC_SEC_INDEX 1 +#define XP_ECC_IER_DESC_SEC_WIDTH 1 +#define XP_ECC_IER_RX_DED_INDEX 2 +#define XP_ECC_IER_RX_DED_WIDTH 1 +#define XP_ECC_IER_RX_SEC_INDEX 3 +#define XP_ECC_IER_RX_SEC_WIDTH 1 +#define XP_ECC_IER_TX_DED_INDEX 4 +#define XP_ECC_IER_TX_DED_WIDTH 1 +#define XP_ECC_IER_TX_SEC_INDEX 5 +#define XP_ECC_IER_TX_SEC_WIDTH 1 +#define XP_ECC_ISR_DESC_DED_INDEX 0 +#define XP_ECC_ISR_DESC_DED_WIDTH 1 +#define XP_ECC_ISR_DESC_SEC_INDEX 1 +#define XP_ECC_ISR_DESC_SEC_WIDTH 1 +#define XP_ECC_ISR_RX_DED_INDEX 2 +#define XP_ECC_ISR_RX_DED_WIDTH 1 +#define XP_ECC_ISR_RX_SEC_INDEX 3 +#define XP_ECC_ISR_RX_SEC_WIDTH 1 +#define XP_ECC_ISR_TX_DED_INDEX 4 +#define XP_ECC_ISR_TX_DED_WIDTH 1 +#define XP_ECC_ISR_TX_SEC_INDEX 5 +#define XP_ECC_ISR_TX_SEC_WIDTH 1#define XP_MAC_ADDR_HI_VALID_INDEX 31#define XP_MAC_ADDR_HI_VALID_WIDTH 1#define XP_PROP_0_CONN_TYPE_INDEX 28
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +64 -0
81 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +180 -2
262 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-main.c +13 -0
@@ -190,6 +190,7 @@ struct xgbe_prv_data *xgbe_alloc_pdata(struct device *dev) pdata->msg_enable =netif_msg_init (debug, default_msg_level);set_bit (XGBE_DOWN , &pdata->dev_state); +set_bit (XGBE_STOPPED , &pdata->dev_state);return pdata; }
@@ -263,6 +264,14 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) netdev->base_addr = (unsigned long )pdata->xgmac_regs;memcpy (netdev->dev_addr, pdata->mac_addr, netdev->addr_len); +/* Initialize ECC timestamps */ + pdata->tx_sec_period = jiffies; + pdata->tx_ded_period = jiffies; + pdata->rx_sec_period = jiffies; + pdata->rx_ded_period = jiffies; + pdata->desc_sec_period = jiffies; + pdata->desc_ded_period = jiffies; +/* Issue software reset to device */ pdata->hw_if.exit (pdata);
@@ -384,6 +393,10 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)snprintf (pdata->an_name,sizeof (pdata->an_name) -1 ,"%s-pcs" ,netdev_name (netdev)); +/* Create the SMU name based on netdev name */ +snprintf (pdata->ecc_name,sizeof (pdata->ecc_name) -1 ,"%s-ecc" , +netdev_name (netdev)); +/* Create workqueues */ pdata->dev_workqueue =create_singlethread_workqueue (netdev_name (netdev));
drivers/net/ethernet/amd/xgbe/xgbe-pci.c +7 -5
@@ -152,7 +152,7 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata) pdata->dev_irq = pdata->pcidev->irq;if (msi_count >1 ) { - pdata->smu_irq = pdata->pcidev->irq +1 ; + pdata->ecc_irq = pdata->pcidev->irq +1 ; pdata->i2c_irq = pdata->pcidev->irq +2 ; pdata->an_irq = pdata->pcidev->irq +3 ;
@@ -165,7 +165,7 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata) pdata->per_channel_irq =1 ; pdata->channel_irq_mode =XGBE_IRQ_MODE_LEVEL ; }else { - pdata->smu_irq = pdata->pcidev->irq; + pdata->ecc_irq = pdata->pcidev->irq; pdata->i2c_irq = pdata->pcidev->irq; pdata->an_irq = pdata->pcidev->irq; }
@@ -207,7 +207,7 @@ static int xgbe_config_msix(struct xgbe_prv_data *pdata) pdata->irq_count = ret; pdata->dev_irq = pdata->msix_entries[0 ].vector; - pdata->smu_irq = pdata->msix_entries[1 ].vector; + pdata->ecc_irq = pdata->msix_entries[1 ].vector; pdata->i2c_irq = pdata->msix_entries[2 ].vector; pdata->an_irq = pdata->msix_entries[3 ].vector;
@@ -240,7 +240,7 @@ static int xgbe_config_irqs(struct xgbe_prv_data *pdata) pdata->irq_shared =1 ; pdata->dev_irq = pdata->pcidev->irq; - pdata->smu_irq = pdata->pcidev->irq; + pdata->ecc_irq = pdata->pcidev->irq; pdata->i2c_irq = pdata->pcidev->irq; pdata->an_irq = pdata->pcidev->irq;
@@ -249,7 +249,7 @@ static int xgbe_config_irqs(struct xgbe_prv_data *pdata)unsigned int i;dev_dbg (pdata->dev," dev irq=%d\n" , pdata->dev_irq); -dev_dbg (pdata->dev," smu irq=%d\n" , pdata->smu_irq); +dev_dbg (pdata->dev," ecc irq=%d\n" , pdata->ecc_irq);dev_dbg (pdata->dev," i2c irq=%d\n" , pdata->i2c_irq);dev_dbg (pdata->dev," an irq=%d\n" , pdata->an_irq);for (i =0 ; i < pdata->channel_irq_count; i++)
@@ -460,6 +460,7 @@ static int xgbe_pci_resume(struct pci_dev *pdev) .tx_max_fifo_size = 229376, .rx_max_fifo_size = 229376, .tx_tstamp_workaround = 1, + .ecc_support = 1, };static const struct xgbe_version_data xgbe_v2b = {
@@ -469,6 +470,7 @@ static int xgbe_pci_resume(struct pci_dev *pdev) .tx_max_fifo_size = 65536, .rx_max_fifo_size = 65536, .tx_tstamp_workaround = 1, + .ecc_support = 1, };static const struct pci_device_id xgbe_pci_table[] = {
drivers/net/ethernet/amd/xgbe/xgbe.h +35 -2
@@ -285,6 +285,9 @@#define XGBE_SGMII_AN_LINK_SPEED_1000 0x08#define XGBE_SGMII_AN_LINK_DUPLEX BIT(4) +/* ECC correctable error notification window (seconds) */ +#define XGBE_ECC_LIMIT 60 +struct xgbe_prv_data ;struct xgbe_packet_data {
@@ -461,6 +464,7 @@ enum xgbe_state {XGBE_DOWN ,XGBE_LINK_INIT ,XGBE_LINK_ERR , + XGBE_STOPPED, }; enum xgbe_int {
@@ -480,6 +484,12 @@ enum xgbe_int_state { XGMAC_INT_STATE_RESTORE, }; +enum xgbe_ecc_sec { +XGBE_ECC_SEC_TX , +XGBE_ECC_SEC_RX , +XGBE_ECC_SEC_DESC , +}; +enum xgbe_speed {XGBE_SPEED_1000 =0 ,XGBE_SPEED_2500 ,
@@ -694,6 +704,10 @@ struct xgbe_hw_if {int (*disable_rss)(struct xgbe_prv_data *);int (*set_rss_hash_key)(struct xgbe_prv_data *,const u8 *);int (*set_rss_lookup_table)(struct xgbe_prv_data *,const u32 *); + +/* For ECC */ +void (*disable_ecc_ded)(struct xgbe_prv_data *); +void (*disable_ecc_sec)(struct xgbe_prv_data *,enum xgbe_ecc_sec ); };/* This structure represents implementation specific routines for an
@@ -827,6 +841,7 @@ struct xgbe_version_data {unsigned int tx_max_fifo_size;unsigned int rx_max_fifo_size;unsigned int tx_tstamp_workaround; +unsigned int ecc_support; };struct xgbe_prv_data {
@@ -868,9 +883,24 @@ struct xgbe_prv_data {/* Flags representing xgbe_state */ unsigned long dev_state; +/* ECC support */ +unsigned long tx_sec_period; +unsigned long tx_ded_period; +unsigned long rx_sec_period; +unsigned long rx_ded_period; +unsigned long desc_sec_period; +unsigned long desc_ded_period; + +unsigned int tx_sec_count; +unsigned int tx_ded_count; +unsigned int rx_sec_count; +unsigned int rx_ded_count; +unsigned int desc_ded_count; +unsigned int desc_sec_count; +struct msix_entry *msix_entries;int dev_irq; -int smu_irq; +int ecc_irq;int i2c_irq;int channel_irq[XGBE_MAX_DMA_CHANNELS ];
@@ -880,6 +910,8 @@ struct xgbe_prv_data {unsigned int channel_irq_count;unsigned int channel_irq_mode; +char ecc_name[IFNAMSIZ +32 ]; +struct xgbe_hw_if hw_if;struct xgbe_phy_if phy_if;struct xgbe_desc_if desc_if;
@@ -990,8 +1022,9 @@ struct xgbe_prv_data {/* Hardware features of the device */ struct xgbe_hw_features hw_feat; -/* Device restart work structure */ +/* Device work structures */ struct work_struct restart_work; +struct work_struct stopdev_work;/* Keeps track of power mode */ unsigned int power_down;
PATCH 17/21 amd-xgbe: Add I2C support for determining SFP media types
In reply to Tom LendackyAdd support to initialize and use the I2C controller within the hardware in order to determine the SFP media type that is installed.
--- drivers/net/ethernet/amd/xgbe/Makefile | 2 drivers/net/ethernet/amd/xgbe/xgbe-common.h | 92 +++++ drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 76 ++++ drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 492 ++++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe-main.c | 7 drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 2 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 15 + drivers/net/ethernet/amd/xgbe/xgbe.h | 64 +++ 9 files changed, 753 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c
drivers/net/ethernet/amd/xgbe/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-$(CONFIG_AMD_XGBE) += amd-xgbe.o amd-xgbe-objs := xgbe-main.o xgbe-drv.o xgbe-dev.o \ xgbe-desc.o xgbe-ethtool.o xgbe-mdio.o \ xgbe-ptp.o \ - xgbe-phy-v1.o xgbe-phy-v2.o \ + xgbe-i2c.o xgbe-phy-v1.o xgbe-phy-v2.o \ xgbe-platform.o amd-xgbe-$(CONFIG_PCI) += xgbe-pci.o
drivers/net/ethernet/amd/xgbe/xgbe-common.h +92 -0
104 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +76 -0
88 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +4 -0
@@ -532,6 +532,10 @@ static irqreturn_t xgbe_isr(int irq, void *data)if (pdata->vdata->ecc_support && (pdata->dev_irq == pdata->ecc_irq))xgbe_ecc_isr (irq, pdata); +/* If there is not a separate I2C irq, handle it here */ +if (pdata->vdata->i2c_support && (pdata->dev_irq == pdata->i2c_irq)) + pdata->i2c_if.i2c_isr (irq, pdata); + isr_done:return IRQ_HANDLED ; }
drivers/net/ethernet/amd/xgbe/xgbe-i2c.c new file +492 -0
492 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-main.c +7 -0
@@ -161,6 +161,7 @@ static void xgbe_init_all_fptrs(struct xgbe_prv_data *pdata) {xgbe_init_function_ptrs_dev (&pdata->hw_if);xgbe_init_function_ptrs_phy (&pdata->phy_if); +xgbe_init_function_ptrs_i2c (&pdata->i2c_if);xgbe_init_function_ptrs_desc (&pdata->desc_if); pdata->vdata->init_function_ptrs_phy_impl (&pdata->phy_if);
@@ -186,6 +187,8 @@ struct xgbe_prv_data *xgbe_alloc_pdata(struct device *dev)spin_lock_init (&pdata->xpcs_lock);mutex_init (&pdata->rss_mutex);spin_lock_init (&pdata->tstamp_lock); +mutex_init (&pdata->i2c_mutex); +init_completion (&pdata->i2c_complete); pdata->msg_enable =netif_msg_init (debug, default_msg_level);
@@ -397,6 +400,10 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)snprintf (pdata->ecc_name,sizeof (pdata->ecc_name) -1 ,"%s-ecc" ,netdev_name (netdev)); +/* Create the I2C name based on netdev name */ +snprintf (pdata->i2c_name,sizeof (pdata->i2c_name) -1 ,"%s-i2c" , +netdev_name (netdev)); +/* Create workqueues */ pdata->dev_workqueue =create_singlethread_workqueue (netdev_name (netdev));
drivers/net/ethernet/amd/xgbe/xgbe-pci.c +2 -0
@@ -461,6 +461,7 @@ static int xgbe_pci_resume(struct pci_dev *pdev) .rx_max_fifo_size = 229376, .tx_tstamp_workaround = 1, .ecc_support = 1, + .i2c_support = 1, };static const struct xgbe_version_data xgbe_v2b = {
@@ -471,6 +472,7 @@ static int xgbe_pci_resume(struct pci_dev *pdev) .rx_max_fifo_size = 65536, .tx_tstamp_workaround = 1, .ecc_support = 1, + .i2c_support = 1, };static const struct pci_device_id xgbe_pci_table[] = {
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +15 -0
@@ -710,11 +710,20 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata) {/* Power off the PHY */ xgbe_phy_power_off (pdata); + +/* Stop the I2C controller */ + pdata->i2c_if.i2c_stop (pdata); }static int xgbe_phy_start (struct xgbe_prv_data *pdata) {struct xgbe_phy_data *phy_data = pdata->phy_data; +int ret; + +/* Start the I2C controller */ + ret = pdata->i2c_if.i2c_start (pdata); +if (ret) +return ret;/* Start in highest supported mode */ xgbe_phy_set_mode (pdata, phy_data->start_mode);
@@ -744,6 +753,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) {struct xgbe_phy_data *phy_data;unsigned int reg; +int ret;/* Check if enabled */ if (!xgbe_phy_port_enabled (pdata)) {
@@ -751,6 +761,11 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)return -ENODEV ; } +/* Initialize the I2C controller */ + ret = pdata->i2c_if.i2c_init (pdata); +if (ret) +return ret; + phy_data =devm_kzalloc (pdata->dev,sizeof (*phy_data),GFP_KERNEL );if (!phy_data)return -ENOMEM ;
drivers/net/ethernet/amd/xgbe/xgbe.h +64 -0
112 lines not on this page · raw message
Andrew Lunn
maintainerRe: [PATCH net-next v1 17/21] amd-xgbe: Add I2C support for determining SFP media types
Quoted 2 lines · Tom Lendacky
Add support to initialize and use the I2C controller within the hardware in order to determine the SFP media type that is installed.
Hi Tom
Did you see the work Russell King did for phylink?
https://lwn.net/Articles/667055/
Rather than doing your own proprietary i2c infrastructure, use the standard Linux i2c infrastructure. The SFP modules are then just normal i2c devices on a normal i2c bus. The work Russell did can then access them, export them to user space, get the PHY modes correctly setup, etc.
Andrew
Re: [PATCH net-next v1 17/21] amd-xgbe: Add I2C support for determining SFP media types
Quoted 5 lines · Andrew Lunn
Quoted 2 lines · Tom Lendacky
Add support to initialize and use the I2C controller within the hardware in order to determine the SFP media type that is installed.
Hi Tom
Hi Andrew
Quoted 10 lines
Did you see the work Russell King did for phylink?
https://lwn.net/Articles/667055/
Rather than doing your own proprietary i2c infrastructure, use the standard Linux i2c infrastructure. The SFP modules are then just normal i2c devices on a normal i2c bus. The work Russell did can then access them, export them to user space, get the PHY modes correctly setup, etc.
There are a couple of things about this. Russel's work isn't part of the kernel yet so I can't make use of it. Additionally, the I2C device is integrated into the IP of the network device with register addresses being offsets of the network device BAR so I'm not sure how I would go about getting it setup in order to use the i2c infrastructure.
Thanks,
Tom
Quoted 3 lines
Andrew
Andrew Lunn
maintainerRe: [PATCH net-next v1 17/21] amd-xgbe: Add I2C support for determining SFP media types
Quoted 2 lines
There are a couple of things about this. Russel's work isn't part of the kernel yet so I can't make use of it.
Well, you could guide it into the kernel. Part of it has already made the way in. And i know of other platforms which would benefit from it.
Quoted 4 lines
Additionally, the I2C device is integrated into the IP of the network device with register addresses being offsets of the network device BAR so I'm not sure how I would go about getting it setup in order to use the i2c infrastructure.
Have you looked at the core i2c stuff? All you need is an i2c_algorithim structure:
http://lxr.free-electrons.com/source/include/linux/i2c.h#L407
and an i2c_adaptor structure:
http://lxr.free-electrons.com/source/include/linux/i2c.h#L532
and then you can call i2c_add_adapter() to register your i2c bus with the i2c core. Embedded such an i2c driver inside another driver is not a problem.
Andrew
Re: [PATCH net-next v1 17/21] amd-xgbe: Add I2C support for determining SFP media types
Quoted 16 lines · Andrew Lunn
Quoted 2 lines
There are a couple of things about this. Russel's work isn't part of the kernel yet so I can't make use of it.
Well, you could guide it into the kernel. Part of it has already made the way in. And i know of other platforms which would benefit from it.
Quoted 4 lines
Additionally, the I2C device is integrated into the IP of the network device with register addresses being offsets of the network device BAR so I'm not sure how I would go about getting it setup in order to use the i2c infrastructure.
Have you looked at the core i2c stuff? All you need is an
i2c_algorithimstructure:http://lxr.free-electrons.com/source/include/linux/i2c.h#L407
Quoted 7 lines
and an
i2c_adaptorstructure:http://lxr.free-electrons.com/source/include/linux/i2c.h#L532
and then you can call
i2c_add_adapter()to register your i2c bus with the i2c core. Embedded such an i2c driver inside another driver is not a problem.
I looked into this but I need to investigate this more. The I2C bus for this device is dedicated to multiple instances of this device which requires obtaining a hardware mutex before using it. I see how the locking is done, but I might need additional mutexes to protect certain scenarios and it could affect performance if I have to obtain and release the hardware mutex more than is needed.
I'd like to stay with what I have for now in order to enable the driver and then come back and look at what it would take to integrate this support into the driver knowing that userspace could be accessing the bus, also.
Thanks,
Tom
Quoted 3 lines
Andrew
PATCH 18/21 net: phy: expose phy_aneg_done API for use by drivers
In reply to Tom LendackyMake phy_aneg_done() available to drivers so that the result of the auto-negotiation initiated by phy_start_aneg() can be determined.
--- drivers/net/phy/phy.c | 3 ++- include/linux/phy.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
@@ -143,13 +143,14 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)* Returns > 0 on success or < 0 on error. 0 means that auto-negotiation * is still pending. */ -static inline int phy_aneg_done (struct phy_device *phydev) +int phy_aneg_done (struct phy_device *phydev) {if (phydev->drv->aneg_done)return phydev->drv->aneg_done (phydev);return genphy_aneg_done (phydev); } +EXPORT_SYMBOL (phy_aneg_done);/* A structure for mapping a particular speed and duplex * combination to a particular SUPPORTED and ADVERTISED value
include/linux/phy.h +1 -0
@@ -786,6 +786,7 @@ struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,void phy_start (struct phy_device *phydev);void phy_stop (struct phy_device *phydev);int phy_start_aneg (struct phy_device *phydev); +int phy_aneg_done (struct phy_device *phydev);int phy_stop_interrupts (struct phy_device *phydev);
kbuild test robot
build botRe: [PATCH net-next v1 18/21] net: phy: expose phy_aneg_done API for use by drivers
url: https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344 config: sparc-allyesconfig (attached as .config) compiler…
Hi Tom,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declaration
static inline int phy_aneg_done(struct phy_device *phydev)
^~~~~~~~~~~~~
In file included from include/net/dsa.h:19:0,
from include/linux/netdevice.h:44,
from drivers/net/ethernet/aeroflex/greth.c:29:
include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here
int phy_aneg_done(struct phy_device *phydev);
^~~~~~~~~~~~~vim +/phy_aneg_done +1293 drivers/net/ethernet/aeroflex/greth.c
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1287 greth->speed = 0;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1288 greth->duplex = -1;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1289
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1290 return 0;
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1291 }
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1292
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 @1293 static inline int phy_aneg_done(struct phy_device *phydev)
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1294 {
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1295 int retval;d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1296
:::::: The code at line 1293 was first introduced by commit
:::::: d4c41139df6e74c6fff0cbac43e51cab782133be net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver
:::::: TO: Kristoffer Glembo <[email protected]> :::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH net-next v1 18/21] net: phy: expose phy_aneg_done API for use by drivers
Quoted 21 lines · kbuild test robot
Hi Tom,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparcAll errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declarationstatic inline int
phy_aneg_done(struct phy_device *phydev)
^~~~~~~~~~~~~
In file included frominclude/net/dsa.h:19:0,
frominclude/linux/netdevice.h:44, fromdrivers/net/ethernet/aeroflex/greth.c:29:
Quoted 6 lines
include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here int phy_aneg_done(struct phy_device *phydev); ^~~~~~~~~~~~~vim +/phy_aneg_done +1293
drivers/net/ethernet/aeroflex/greth.c
Hi Andreas/Kristoffer,
Kbuild generated an error for this driver when I exposed the phylib phy_aneg_done() function in the first version of my patches. For this driver, I have two choices:
- Remove the phy_aneg_done() function from the aeroflex driver and have it use the phylib version which is now exported
- Rename the current phy_aneg_done() function in the aeroflex driver and have the driver continue to use its version.
I think the first option is the way to go, but I don't have a sparc machine on which to test it. Let me know which you would prefer and I will include that in the second version of the patch submission.
Thanks,
Tom
Quoted 21 lines
d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1287 greth->speed = 0; d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1288 greth->duplex = -1; d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1289 d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1290 return 0; d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1291 } d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1292 d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 @1293 static inline int phy_aneg_done(struct phy_device *phydev) d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1294 { d4c41139 drivers/net/greth.c Kristoffer Glembo 2010-02-15 1295 int retval;
d4c41139drivers/net/greth.cKristoffer Glembo 2010-02-15 1296:::::: The code at line 1293 was first introduced by commit
::::::d4c41139df6e74c6fff0cbac43e51cab782133benet: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver:::::: TO: Kristoffer Glembo <[email protected]> :::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH net-next v1 18/21] net: phy: expose phy_aneg_done API for use by drivers
Quoted 38 lines · Tom Lendacky
Quoted 25 lines · kbuild test robot
Hi Tom,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Tom-Lendacky/amd-xgbe-AMD-XGBE-driver-updates-2016-11-01/20161103-222344
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparcAll errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/net/ethernet/aeroflex/greth.c:1293:19: error: static declaration of 'phy_aneg_done' follows non-static declarationstatic inline int
phy_aneg_done(struct phy_device *phydev)
^~~~~~~~~~~~~
In file included frominclude/net/dsa.h:19:0,
frominclude/linux/netdevice.h:44,
fromdrivers/net/ethernet/aeroflex/greth.c:29:
include/linux/phy.h:789:5: note: previous declaration of 'phy_aneg_done' was here
intphy_aneg_done(struct phy_device *phydev);
^~~~~~~~~~~~~Quoted 2 lines
vim +/phy_aneg_done +1293
drivers/net/ethernet/aeroflex/greth.cHi Andreas/Kristoffer,
Kbuildgenerated an error for this driver when I exposed the phylibphy_aneg_done()function in the first version of my patches. For this driver, I have two choices:- Remove the
phy_aneg_done()function from the aeroflex driver and have it use the phylib version which is now exported
Quoted 6 lines
- Rename the current
phy_aneg_done()function in the aeroflex driver and have the driver continue to use its version.I think the first option is the way to go, but I don't have a sparc machine on which to test it. Let me know which you would prefer and I will include that in the second version of the patch submission.
Hi Tom,
Yes, the first option is the way to go.
Best regards,
Andreas Larsson
PATCH 19/21 amd-xgbe: Add support for SFP+ modules
In reply to Tom LendackyAdd support for recognizing and using SFP+ modules directly. This includes using the I2C support to read and interpret the information returned from an SFP+ module and configuring things properly.
--- drivers/net/ethernet/amd/Kconfig | 1 drivers/net/ethernet/amd/xgbe/xgbe-common.h | 34 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 109 ++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 12 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 1499 +++++++++++++++++++++++++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 15 6 files changed, 1652 insertions(+), 18 deletions(-)
drivers/net/ethernet/amd/Kconfig +1 -0
@@ -178,6 +178,7 @@ config AMD_XGBE select BITREVERSE select CRC32 select PTP_1588_CLOCK + select PHYLIB select AMD_XGBE_HAVE_ECC if X86 ---help--- This driver supports the AMD 10GbE Ethernet device found on an
drivers/net/ethernet/amd/xgbe/xgbe-common.h +34 -0
@@ -929,6 +929,8 @@#define XP_DRIVER_SCRATCH_0 0x0068#define XP_DRIVER_SCRATCH_1 0x006c#define XP_INT_EN 0x0078 +#define XP_I2C_MUTEX 0x0080 +#define XP_MDIO_MUTEX 0x0084/* MAC Control register entry bit positions and sizes */ #define XP_DRIVER_INT_REQ_REQUEST_INDEX 0
@@ -975,6 +977,12 @@#define XP_ECC_ISR_TX_DED_WIDTH 1#define XP_ECC_ISR_TX_SEC_INDEX 5#define XP_ECC_ISR_TX_SEC_WIDTH 1 +#define XP_I2C_MUTEX_BUSY_INDEX 31 +#define XP_I2C_MUTEX_BUSY_WIDTH 1 +#define XP_I2C_MUTEX_ID_INDEX 29 +#define XP_I2C_MUTEX_ID_WIDTH 2 +#define XP_I2C_MUTEX_ACTIVE_INDEX 0 +#define XP_I2C_MUTEX_ACTIVE_WIDTH 1#define XP_MAC_ADDR_HI_VALID_INDEX 31#define XP_MAC_ADDR_HI_VALID_WIDTH 1#define XP_PROP_0_CONN_TYPE_INDEX 28
@@ -999,6 +1007,24 @@#define XP_PROP_2_RX_FIFO_SIZE_WIDTH 16#define XP_PROP_2_TX_FIFO_SIZE_INDEX 0#define XP_PROP_2_TX_FIFO_SIZE_WIDTH 16 +#define XP_PROP_3_GPIO_MASK_INDEX 28 +#define XP_PROP_3_GPIO_MASK_WIDTH 4 +#define XP_PROP_3_GPIO_MOD_ABS_INDEX 20 +#define XP_PROP_3_GPIO_MOD_ABS_WIDTH 4 +#define XP_PROP_3_GPIO_RATE_SELECT_INDEX 16 +#define XP_PROP_3_GPIO_RATE_SELECT_WIDTH 4 +#define XP_PROP_3_GPIO_RX_LOS_INDEX 24 +#define XP_PROP_3_GPIO_RX_LOS_WIDTH 4 +#define XP_PROP_3_GPIO_TX_FAULT_INDEX 12 +#define XP_PROP_3_GPIO_TX_FAULT_WIDTH 4 +#define XP_PROP_3_GPIO_ADDR_INDEX 8 +#define XP_PROP_3_GPIO_ADDR_WIDTH 3 +#define XP_PROP_4_MUX_ADDR_HI_INDEX 8 +#define XP_PROP_4_MUX_ADDR_HI_WIDTH 5 +#define XP_PROP_4_MUX_ADDR_LO_INDEX 0 +#define XP_PROP_4_MUX_ADDR_LO_WIDTH 3 +#define XP_PROP_4_MUX_CHAN_INDEX 4 +#define XP_PROP_4_MUX_CHAN_WIDTH 3/* I2C Control register offsets */ #define IC_CON 0x0000
@@ -1235,6 +1261,14 @@#define MDIO_VEND2_CTRL1_AN_RESTART BIT(9)#endif +#ifndef MDIO_VEND2_CTRL1_SS6 +#define MDIO_VEND2_CTRL1_SS6 BIT(6) +#endif + +#ifndef MDIO_VEND2_CTRL1_SS13 +#define MDIO_VEND2_CTRL1_SS13 BIT(13) +#endif +/* MDIO mask values */ #define XGBE_AN_CL73_INT_CMPLT BIT(0)#define XGBE_AN_CL73_INC_LINK BIT(1)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +108 -1
189 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c +11 -1
@@ -295,6 +295,12 @@ static enum xgbe_mode xgbe_phy_an_outcome(struct xgbe_prv_data *pdata)return mode; } +static int xgbe_phy_an_config (struct xgbe_prv_data *pdata) +{ +/* Nothing uniquely required for an configuration */ +return 0 ; +} +static enum xgbe_an_mode xgbe_phy_an_mode (struct xgbe_prv_data *pdata) {return XGBE_AN_MODE_CL73 ;
@@ -607,10 +613,12 @@ static bool xgbe_phy_valid_speed(struct xgbe_prv_data *pdata, int speed) } } -static int xgbe_phy_link_status (struct xgbe_prv_data *pdata) +static int xgbe_phy_link_status (struct xgbe_prv_data *pdata,int *an_restart) {unsigned int reg; + *an_restart =0 ; +/* Link status is latched low, so read once to clear * and then read again to get current state */
@@ -821,6 +829,8 @@ void xgbe_init_function_ptrs_phy_v1(struct xgbe_phy_if *phy_if) phy_impl->an_mode = xgbe_phy_an_mode; + phy_impl->an_config = xgbe_phy_an_config; + phy_impl->an_outcome = xgbe_phy_an_outcome; phy_impl->kr_training_pre = xgbe_phy_kr_training_pre;
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +1484 -15
1,664 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +14 -1
@@ -530,6 +530,10 @@ enum xgbe_mode {XGBE_MODE_KX_1000 =0 ,XGBE_MODE_KX_2500 ,XGBE_MODE_KR , +XGBE_MODE_X , +XGBE_MODE_SGMII_100 , +XGBE_MODE_SGMII_1000 , +XGBE_MODE_SFI , XGBE_MODE_UNKNOWN, };
@@ -538,6 +542,12 @@ enum xgbe_speedset { XGBE_SPEEDSET_2500_10000, }; +enum xgbe_mdio_mode { +XGBE_MDIO_MODE_NONE =0 , +XGBE_MDIO_MODE_CL22 , +XGBE_MDIO_MODE_CL45 , +}; +struct xgbe_phy {u32 supported;u32 advertising;
@@ -764,7 +774,7 @@ struct xgbe_phy_impl_if {void (*stop)(struct xgbe_prv_data *);/* Return the link status */ -int (*link_status)(struct xgbe_prv_data *); +int (*link_status)(struct xgbe_prv_data *,int *);/* Indicate if a particular speed is valid */ bool (*valid_speed)(struct xgbe_prv_data *,int );
@@ -783,6 +793,9 @@ struct xgbe_phy_impl_if {/* Retrieve current auto-negotiation mode */ enum xgbe_an_mode (*an_mode)(struct xgbe_prv_data *); +/* Configure auto-negotiation settings */ +int (*an_config)(struct xgbe_prv_data *); +/* Process results of auto-negotiation */ enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *);
PATCH 20/21 amd-xgbe: Add support for MDIO attached PHYs
In reply to Tom LendackyUse the phylib support in the kernel to communicate with and control an MDIO attached PHY. Use the hardware's MDIO communication mechanism to communicate with the PHY.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 37 +++ drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 113 ++++++++ drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 19 + drivers/net/ethernet/amd/xgbe/xgbe-main.c | 1 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 386 ++++++++++++++++++++++++++- drivers/net/ethernet/amd/xgbe/xgbe.h | 12 + 6 files changed, 557 insertions(+), 11 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +37 -0
@@ -311,6 +311,11 @@#define MAC_HWF0R 0x011c#define MAC_HWF1R 0x0120#define MAC_HWF2R 0x0124 +#define MAC_MDIOSCAR 0x0200 +#define MAC_MDIOSCCDR 0x0204 +#define MAC_MDIOISR 0x0214 +#define MAC_MDIOIER 0x0218 +#define MAC_MDIOCL22R 0x0220#define MAC_GPIOCR 0x0278#define MAC_GPIOSR 0x027c#define MAC_MACA0HR 0x0300
@@ -411,10 +416,34 @@#define MAC_ISR_MMCTXIS_WIDTH 1#define MAC_ISR_PMTIS_INDEX 4#define MAC_ISR_PMTIS_WIDTH 1 +#define MAC_ISR_SMI_INDEX 1 +#define MAC_ISR_SMI_WIDTH 1#define MAC_ISR_TSIS_INDEX 12#define MAC_ISR_TSIS_WIDTH 1#define MAC_MACA1HR_AE_INDEX 31#define MAC_MACA1HR_AE_WIDTH 1 +#define MAC_MDIOIER_SNGLCOMPIE_INDEX 12 +#define MAC_MDIOIER_SNGLCOMPIE_WIDTH 1 +#define MAC_MDIOISR_SNGLCOMPINT_INDEX 12 +#define MAC_MDIOISR_SNGLCOMPINT_WIDTH 1 +#define MAC_MDIOSCAR_DA_INDEX 21 +#define MAC_MDIOSCAR_DA_WIDTH 5 +#define MAC_MDIOSCAR_PA_INDEX 16 +#define MAC_MDIOSCAR_PA_WIDTH 5 +#define MAC_MDIOSCAR_RA_INDEX 0 +#define MAC_MDIOSCAR_RA_WIDTH 16 +#define MAC_MDIOSCAR_REG_INDEX 0 +#define MAC_MDIOSCAR_REG_WIDTH 21 +#define MAC_MDIOSCCDR_BUSY_INDEX 22 +#define MAC_MDIOSCCDR_BUSY_WIDTH 1 +#define MAC_MDIOSCCDR_CMD_INDEX 16 +#define MAC_MDIOSCCDR_CMD_WIDTH 2 +#define MAC_MDIOSCCDR_CR_INDEX 19 +#define MAC_MDIOSCCDR_CR_WIDTH 3 +#define MAC_MDIOSCCDR_DATA_INDEX 0 +#define MAC_MDIOSCCDR_DATA_WIDTH 16 +#define MAC_MDIOSCCDR_SADDR_INDEX 18 +#define MAC_MDIOSCCDR_SADDR_WIDTH 1#define MAC_PFR_HMC_INDEX 2#define MAC_PFR_HMC_WIDTH 1#define MAC_PFR_HPF_INDEX 10
@@ -1019,6 +1048,14 @@#define XP_PROP_3_GPIO_TX_FAULT_WIDTH 4#define XP_PROP_3_GPIO_ADDR_INDEX 8#define XP_PROP_3_GPIO_ADDR_WIDTH 3 +#define XP_PROP_3_MDIO_RESET_INDEX 0 +#define XP_PROP_3_MDIO_RESET_WIDTH 2 +#define XP_PROP_3_MDIO_RESET_I2C_ADDR_INDEX 8 +#define XP_PROP_3_MDIO_RESET_I2C_ADDR_WIDTH 3 +#define XP_PROP_3_MDIO_RESET_I2C_GPIO_INDEX 12 +#define XP_PROP_3_MDIO_RESET_I2C_GPIO_WIDTH 4 +#define XP_PROP_3_MDIO_RESET_INT_GPIO_INDEX 4 +#define XP_PROP_3_MDIO_RESET_INT_GPIO_WIDTH 2#define XP_PROP_4_MUX_ADDR_HI_INDEX 8#define XP_PROP_4_MUX_ADDR_HI_WIDTH 5#define XP_PROP_4_MUX_ADDR_LO_INDEX 0
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +113 -0
137 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +18 -1
@@ -445,7 +445,7 @@ static irqreturn_t xgbe_isr(int irq, void *data)struct xgbe_hw_if *hw_if = &pdata->hw_if;struct xgbe_channel *channel;unsigned int dma_isr, dma_ch_isr; -unsigned int mac_isr, mac_tssr; +unsigned int mac_isr, mac_tssr, mac_mdioisr;unsigned int i;/* The DMA interrupt status register also reports MAC and MTL
@@ -505,6 +505,9 @@ static irqreturn_t xgbe_isr(int irq, void *data)if (XGMAC_GET_BITS (dma_isr,DMA_ISR ,MACIS )) { mac_isr =XGMAC_IOREAD (pdata,MAC_ISR ); +netif_dbg (pdata, intr, pdata->netdev,"MAC_ISR=%#010x\n" , + mac_isr); +if (XGMAC_GET_BITS (mac_isr,MAC_ISR ,MMCTXIS )) hw_if->tx_mmc_int (pdata);
@@ -514,6 +517,9 @@ static irqreturn_t xgbe_isr(int irq, void *data)if (XGMAC_GET_BITS (mac_isr,MAC_ISR ,TSIS )) { mac_tssr =XGMAC_IOREAD (pdata,MAC_TSSR ); +netif_dbg (pdata, intr, pdata->netdev, +"MAC_TSSR=%#010x\n" , mac_tssr); +if (XGMAC_GET_BITS (mac_tssr,MAC_TSSR ,TXTSC )) {/* Read Tx Timestamp to clear interrupt */ pdata->tx_tstamp =
@@ -522,6 +528,17 @@ static irqreturn_t xgbe_isr(int irq, void *data) &pdata->tx_tstamp_work); } } + +if (XGMAC_GET_BITS (mac_isr,MAC_ISR ,SMI )) { + mac_mdioisr =XGMAC_IOREAD (pdata,MAC_MDIOISR ); + +netif_dbg (pdata, intr, pdata->netdev, +"MAC_MDIOISR=%#010x\n" , mac_mdioisr); + +if (XGMAC_GET_BITS (mac_mdioisr,MAC_MDIOISR , +SNGLCOMPINT )) +complete (&pdata->mdio_complete); + } }/* If there is not a separate AN irq, handle it here */
drivers/net/ethernet/amd/xgbe/xgbe-main.c +1 -0
@@ -189,6 +189,7 @@ struct xgbe_prv_data *xgbe_alloc_pdata(struct device *dev)spin_lock_init (&pdata->tstamp_lock);mutex_init (&pdata->i2c_mutex);init_completion (&pdata->i2c_complete); +init_completion (&pdata->mdio_complete); pdata->msg_enable =netif_msg_init (debug, default_msg_level);
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +376 -10
538 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +12 -0
@@ -289,6 +289,9 @@/* ECC correctable error notification window (seconds) */ #define XGBE_ECC_LIMIT 60 +/* MDIO port types */ +#define XGMAC_MAX_C22_PORT 3 +struct xgbe_prv_data ;struct xgbe_packet_data {
@@ -675,6 +678,14 @@ struct xgbe_hw_if {void (*write_mmd_regs)(struct xgbe_prv_data *,int ,int ,int );int (*set_speed)(struct xgbe_prv_data *,int ); +int (*set_ext_mii_mode)(struct xgbe_prv_data *,unsigned int , +enum xgbe_mdio_mode ); +int (*read_ext_mii_regs)(struct xgbe_prv_data *,int ,int ); +int (*write_ext_mii_regs)(struct xgbe_prv_data *,int ,int ,u16 ); + +int (*set_gpio)(struct xgbe_prv_data *,unsigned int ); +int (*clr_gpio)(struct xgbe_prv_data *,unsigned int ); +void (*enable_tx)(struct xgbe_prv_data *);void (*disable_tx)(struct xgbe_prv_data *);void (*enable_rx)(struct xgbe_prv_data *);
@@ -1111,6 +1122,7 @@ struct xgbe_prv_data {struct xgbe_phy phy;int mdio_mmd;unsigned long link_check; +struct completion mdio_complete;char an_name[IFNAMSIZ +32 ];struct workqueue_struct *an_workqueue;
PATCH 21/21 amd-xgbe: Add support for a KR redriver
In reply to Tom LendackyThis patch provides support for the presence of a KR redriver chip in between the device PCS and an external PHY. When a redriver chip is present the device must perform clause 73 auto-negotiation in order to set the redriver chip for the downstream connection.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 10 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 45 ++- drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 7 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 427 +++++++++++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 6 5 files changed, 458 insertions(+), 37 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +10 -0
@@ -1062,6 +1062,16 @@#define XP_PROP_4_MUX_ADDR_LO_WIDTH 3#define XP_PROP_4_MUX_CHAN_INDEX 4#define XP_PROP_4_MUX_CHAN_WIDTH 3 +#define XP_PROP_4_REDRV_ADDR_INDEX 16 +#define XP_PROP_4_REDRV_ADDR_WIDTH 7 +#define XP_PROP_4_REDRV_IF_INDEX 23 +#define XP_PROP_4_REDRV_IF_WIDTH 1 +#define XP_PROP_4_REDRV_LANE_INDEX 24 +#define XP_PROP_4_REDRV_LANE_WIDTH 3 +#define XP_PROP_4_REDRV_MODEL_INDEX 28 +#define XP_PROP_4_REDRV_MODEL_WIDTH 3 +#define XP_PROP_4_REDRV_PRESENT_INDEX 31 +#define XP_PROP_4_REDRV_PRESENT_WIDTH 1/* I2C Control register offsets */ #define IC_CON 0x0000
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +32 -13
136 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c +7 -0
@@ -295,6 +295,11 @@ static enum xgbe_mode xgbe_phy_an_outcome(struct xgbe_prv_data *pdata)return mode; } +static unsigned int xgbe_phy_an_advertising (struct xgbe_prv_data *pdata) +{ +return pdata->phy.advertising; +} +static int xgbe_phy_an_config (struct xgbe_prv_data *pdata) {/* Nothing uniquely required for an configuration */
@@ -831,6 +836,8 @@ void xgbe_init_function_ptrs_phy_v1(struct xgbe_phy_if *phy_if) phy_impl->an_config = xgbe_phy_an_config; + phy_impl->an_advertising = xgbe_phy_an_advertising; + phy_impl->an_outcome = xgbe_phy_an_outcome; phy_impl->kr_training_pre = xgbe_phy_kr_training_pre;
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +403 -24
560 lines not on this page · raw message
drivers/net/ethernet/amd/xgbe/xgbe.h +6 -0
@@ -508,6 +508,7 @@ enum xgbe_xpcs_access {enum xgbe_an_mode {XGBE_AN_MODE_CL73 =0 , +XGBE_AN_MODE_CL73_REDRV ,XGBE_AN_MODE_CL37 ,XGBE_AN_MODE_CL37_SGMII ,XGBE_AN_MODE_NONE ,
@@ -807,6 +808,9 @@ struct xgbe_phy_impl_if {/* Configure auto-negotiation settings */ int (*an_config)(struct xgbe_prv_data *); +/* Set/override auto-negotiation advertisement settings */ +unsigned int (*an_advertising)(struct xgbe_prv_data *); +/* Process results of auto-negotiation */ enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *);
@@ -1124,6 +1128,8 @@ struct xgbe_prv_data {unsigned long link_check;struct completion mdio_complete; +unsigned int kr_redrv; +char an_name[IFNAMSIZ +32 ];struct workqueue_struct *an_workqueue;
David Miller
maintainer20+ patches is too many to submit at one time.
Making huge patch series submissions puts an unreasonable burdon on those developers who might decide to review your work, including me.
Please keep your series down to a small, reasonable, size. Perhaps 10-15 patches maximum.
I will not be looking at nor applying this series.
Quoted 8 lines · David Miller
20+ patches is too many to submit at one time.
Making huge patch series submissions puts an unreasonable burdon on those developers who might decide to review your work, including me.
Please keep your series down to a small, reasonable, size. Perhaps 10-15 patches maximum.
Ok, I'll break this up into smaller submissions - new device prep work and then the new device support.
Thanks,
Tom
Quoted 3 lines
I will not be looking at nor applying this series.