/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * stmmac_pcs.h: Physical Coding Sublayer Header File * * Copyright (C) 2016 STMicroelectronics (R&D) Limited * Author: Giuseppe Cavallaro <[email protected]> */ #ifndef __STMMAC_PCS_H__ #define __STMMAC_PCS_H__ #include <linux/slab.h> #include <linux/io.h> #include "common.h" /* PCS registers (AN/TBI/SGMII/RGMII) offsets */ #define GMAC_AN_CTRL(x) … #define GMAC_AN_STATUS(x) … #define GMAC_ANE_ADV(x) … #define GMAC_ANE_LPA(x) … #define GMAC_ANE_EXP(x) … #define GMAC_TBI(x) … /* AN Configuration defines */ #define GMAC_AN_CTRL_RAN … #define GMAC_AN_CTRL_ANE … #define GMAC_AN_CTRL_ELE … #define GMAC_AN_CTRL_ECD … #define GMAC_AN_CTRL_LR … #define GMAC_AN_CTRL_SGMRAL … /* AN Status defines */ #define GMAC_AN_STATUS_LS … #define GMAC_AN_STATUS_ANA … #define GMAC_AN_STATUS_ANC … #define GMAC_AN_STATUS_ES … /* ADV and LPA defines */ #define GMAC_ANE_FD … #define GMAC_ANE_HD … #define GMAC_ANE_PSE … #define GMAC_ANE_PSE_SHIFT … #define GMAC_ANE_RFE … #define GMAC_ANE_RFE_SHIFT … #define GMAC_ANE_ACK … /** * dwmac_pcs_isr - TBI, RTBI, or SGMII PHY ISR * @ioaddr: IO registers pointer * @reg: Base address of the AN Control Register. * @intr_status: GMAC core interrupt status * @x: pointer to log these events as stats * Description: it is the ISR for PCS events: Auto-Negotiation Completed and * Link status. */ static inline void dwmac_pcs_isr(void __iomem *ioaddr, u32 reg, unsigned int intr_status, struct stmmac_extra_stats *x) { … } /** * dwmac_ctrl_ane - To program the AN Control Register. * @ioaddr: IO registers pointer * @reg: Base address of the AN Control Register. * @ane: to enable the auto-negotiation * @srgmi_ral: to manage MAC-2-MAC SGMII connections. * @loopback: to cause the PHY to loopback tx data into rx path. * Description: this is the main function to configure the AN control register * and init the ANE, select loopback (usually for debugging purpose) and * configure SGMII RAL. */ static inline void dwmac_ctrl_ane(void __iomem *ioaddr, u32 reg, bool ane, bool srgmi_ral, bool loopback) { … } /** * dwmac_get_adv_lp - Get ADV and LP cap * @ioaddr: IO registers pointer * @reg: Base address of the AN Control Register. * @adv_lp: structure to store the adv,lp status * Description: this is to expose the ANE advertisement and Link partner ability * status to ethtool support. */ static inline void dwmac_get_adv_lp(void __iomem *ioaddr, u32 reg, struct rgmii_adv *adv_lp) { … } #endif /* __STMMAC_PCS_H__ */