Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2015 Broadcom Corporation
0004  */
0005 
0006 #ifndef _LINUX_BCM_PHY_LIB_H
0007 #define _LINUX_BCM_PHY_LIB_H
0008 
0009 #include <linux/brcmphy.h>
0010 #include <linux/phy.h>
0011 
0012 /* 28nm only register definitions */
0013 #define MISC_ADDR(base, channel)    base, channel
0014 
0015 #define DSP_TAP10           MISC_ADDR(0x0a, 0)
0016 #define PLL_PLLCTRL_1           MISC_ADDR(0x32, 1)
0017 #define PLL_PLLCTRL_2           MISC_ADDR(0x32, 2)
0018 #define PLL_PLLCTRL_4           MISC_ADDR(0x33, 0)
0019 
0020 #define AFE_RXCONFIG_0          MISC_ADDR(0x38, 0)
0021 #define AFE_RXCONFIG_1          MISC_ADDR(0x38, 1)
0022 #define AFE_RXCONFIG_2          MISC_ADDR(0x38, 2)
0023 #define AFE_RX_LP_COUNTER       MISC_ADDR(0x38, 3)
0024 #define AFE_TX_CONFIG           MISC_ADDR(0x39, 0)
0025 #define AFE_VDCA_ICTRL_0        MISC_ADDR(0x39, 1)
0026 #define AFE_VDAC_OTHERS_0       MISC_ADDR(0x39, 3)
0027 #define AFE_HPF_TRIM_OTHERS     MISC_ADDR(0x3a, 0)
0028 
0029 
0030 int __bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val);
0031 int __bcm_phy_read_exp(struct phy_device *phydev, u16 reg);
0032 int __bcm_phy_modify_exp(struct phy_device *phydev, u16 reg, u16 mask, u16 set);
0033 int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val);
0034 int bcm_phy_read_exp(struct phy_device *phydev, u16 reg);
0035 int bcm_phy_modify_exp(struct phy_device *phydev, u16 reg, u16 mask, u16 set);
0036 
0037 static inline int bcm_phy_write_exp_sel(struct phy_device *phydev,
0038                     u16 reg, u16 val)
0039 {
0040     return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val);
0041 }
0042 
0043 int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val);
0044 int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum);
0045 
0046 int bcm_phy_write_misc(struct phy_device *phydev,
0047                u16 reg, u16 chl, u16 value);
0048 int bcm_phy_read_misc(struct phy_device *phydev,
0049               u16 reg, u16 chl);
0050 
0051 int bcm_phy_write_shadow(struct phy_device *phydev, u16 shadow,
0052              u16 val);
0053 int bcm_phy_read_shadow(struct phy_device *phydev, u16 shadow);
0054 
0055 int __bcm_phy_write_rdb(struct phy_device *phydev, u16 rdb, u16 val);
0056 int bcm_phy_write_rdb(struct phy_device *phydev, u16 rdb, u16 val);
0057 int __bcm_phy_read_rdb(struct phy_device *phydev, u16 rdb);
0058 int bcm_phy_read_rdb(struct phy_device *phydev, u16 rdb);
0059 int __bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask,
0060              u16 set);
0061 int bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask,
0062                u16 set);
0063 
0064 int bcm_phy_ack_intr(struct phy_device *phydev);
0065 int bcm_phy_config_intr(struct phy_device *phydev);
0066 irqreturn_t bcm_phy_handle_interrupt(struct phy_device *phydev);
0067 
0068 int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
0069 
0070 int bcm_phy_set_eee(struct phy_device *phydev, bool enable);
0071 
0072 int bcm_phy_downshift_get(struct phy_device *phydev, u8 *count);
0073 
0074 int bcm_phy_downshift_set(struct phy_device *phydev, u8 count);
0075 
0076 int bcm_phy_get_sset_count(struct phy_device *phydev);
0077 void bcm_phy_get_strings(struct phy_device *phydev, u8 *data);
0078 void bcm_phy_get_stats(struct phy_device *phydev, u64 *shadow,
0079                struct ethtool_stats *stats, u64 *data);
0080 void bcm_phy_r_rc_cal_reset(struct phy_device *phydev);
0081 int bcm_phy_28nm_a0b0_afe_config_init(struct phy_device *phydev);
0082 int bcm_phy_enable_jumbo(struct phy_device *phydev);
0083 
0084 int bcm_phy_cable_test_get_status_rdb(struct phy_device *phydev,
0085                       bool *finished);
0086 int bcm_phy_cable_test_start_rdb(struct phy_device *phydev);
0087 int bcm_phy_cable_test_start(struct phy_device *phydev);
0088 int bcm_phy_cable_test_get_status(struct phy_device *phydev, bool *finished);
0089 
0090 #if IS_ENABLED(CONFIG_BCM_NET_PHYPTP)
0091 struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev);
0092 void bcm_ptp_config_init(struct phy_device *phydev);
0093 void bcm_ptp_stop(struct bcm_ptp_private *priv);
0094 #else
0095 static inline struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev)
0096 {
0097     return NULL;
0098 }
0099 
0100 static inline void bcm_ptp_config_init(struct phy_device *phydev)
0101 {
0102 }
0103 
0104 static inline void bcm_ptp_stop(struct bcm_ptp_private *priv)
0105 {
0106 }
0107 #endif
0108 
0109 #endif /* _LINUX_BCM_PHY_LIB_H */