18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Driver for the Texas Instruments DP83867 PHY 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2015 Texas Instruments Inc. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/ethtool.h> 88c2ecf20Sopenharmony_ci#include <linux/kernel.h> 98c2ecf20Sopenharmony_ci#include <linux/mii.h> 108c2ecf20Sopenharmony_ci#include <linux/module.h> 118c2ecf20Sopenharmony_ci#include <linux/of.h> 128c2ecf20Sopenharmony_ci#include <linux/phy.h> 138c2ecf20Sopenharmony_ci#include <linux/delay.h> 148c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 158c2ecf20Sopenharmony_ci#include <linux/etherdevice.h> 168c2ecf20Sopenharmony_ci#include <linux/bitfield.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <dt-bindings/net/ti-dp83867.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define DP83867_PHY_ID 0x2000a231 218c2ecf20Sopenharmony_ci#define DP83867_DEVADDR 0x1f 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define MII_DP83867_PHYCTRL 0x10 248c2ecf20Sopenharmony_ci#define MII_DP83867_PHYSTS 0x11 258c2ecf20Sopenharmony_ci#define MII_DP83867_MICR 0x12 268c2ecf20Sopenharmony_ci#define MII_DP83867_ISR 0x13 278c2ecf20Sopenharmony_ci#define DP83867_CFG2 0x14 288c2ecf20Sopenharmony_ci#define DP83867_CFG3 0x1e 298c2ecf20Sopenharmony_ci#define DP83867_CTRL 0x1f 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* Extended Registers */ 328c2ecf20Sopenharmony_ci#define DP83867_FLD_THR_CFG 0x002e 338c2ecf20Sopenharmony_ci#define DP83867_CFG4 0x0031 348c2ecf20Sopenharmony_ci#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6)) 358c2ecf20Sopenharmony_ci#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5) 368c2ecf20Sopenharmony_ci#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5) 378c2ecf20Sopenharmony_ci#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5) 388c2ecf20Sopenharmony_ci#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define DP83867_RGMIICTL 0x0032 418c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS1 0x006E 428c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2 0x006f 438c2ecf20Sopenharmony_ci#define DP83867_RGMIIDCTL 0x0086 448c2ecf20Sopenharmony_ci#define DP83867_DSP_FFE_CFG 0x012c 458c2ecf20Sopenharmony_ci#define DP83867_RXFCFG 0x0134 468c2ecf20Sopenharmony_ci#define DP83867_RXFPMD1 0x0136 478c2ecf20Sopenharmony_ci#define DP83867_RXFPMD2 0x0137 488c2ecf20Sopenharmony_ci#define DP83867_RXFPMD3 0x0138 498c2ecf20Sopenharmony_ci#define DP83867_RXFSOP1 0x0139 508c2ecf20Sopenharmony_ci#define DP83867_RXFSOP2 0x013A 518c2ecf20Sopenharmony_ci#define DP83867_RXFSOP3 0x013B 528c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG 0x0170 538c2ecf20Sopenharmony_ci#define DP83867_SGMIICTL 0x00D3 548c2ecf20Sopenharmony_ci#define DP83867_10M_SGMII_CFG 0x016F 558c2ecf20Sopenharmony_ci#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define DP83867_SW_RESET BIT(15) 588c2ecf20Sopenharmony_ci#define DP83867_SW_RESTART BIT(14) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* MICR Interrupt bits */ 618c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_AN_ERR_INT_EN BIT(15) 628c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_SPEED_CHNG_INT_EN BIT(14) 638c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN BIT(13) 648c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_PAGE_RXD_INT_EN BIT(12) 658c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_AUTONEG_COMP_INT_EN BIT(11) 668c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_LINK_STS_CHNG_INT_EN BIT(10) 678c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_FALSE_CARRIER_INT_EN BIT(8) 688c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN BIT(4) 698c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_WOL_INT_EN BIT(3) 708c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_XGMII_ERR_INT_EN BIT(2) 718c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_POL_CHNG_INT_EN BIT(1) 728c2ecf20Sopenharmony_ci#define MII_DP83867_MICR_JABBER_INT_EN BIT(0) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* RGMIICTL bits */ 758c2ecf20Sopenharmony_ci#define DP83867_RGMII_TX_CLK_DELAY_EN BIT(1) 768c2ecf20Sopenharmony_ci#define DP83867_RGMII_RX_CLK_DELAY_EN BIT(0) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci/* SGMIICTL bits */ 798c2ecf20Sopenharmony_ci#define DP83867_SGMII_TYPE BIT(14) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* RXFCFG bits*/ 828c2ecf20Sopenharmony_ci#define DP83867_WOL_MAGIC_EN BIT(0) 838c2ecf20Sopenharmony_ci#define DP83867_WOL_BCAST_EN BIT(2) 848c2ecf20Sopenharmony_ci#define DP83867_WOL_UCAST_EN BIT(4) 858c2ecf20Sopenharmony_ci#define DP83867_WOL_SEC_EN BIT(5) 868c2ecf20Sopenharmony_ci#define DP83867_WOL_ENH_MAC BIT(7) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* STRAP_STS1 bits */ 898c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS1_RESERVED BIT(11) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* STRAP_STS2 bits */ 928c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_CLK_SKEW_TX_MASK GENMASK(6, 4) 938c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_CLK_SKEW_TX_SHIFT 4 948c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_CLK_SKEW_RX_MASK GENMASK(2, 0) 958c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_CLK_SKEW_RX_SHIFT 0 968c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_CLK_SKEW_NONE BIT(2) 978c2ecf20Sopenharmony_ci#define DP83867_STRAP_STS2_STRAP_FLD BIT(10) 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* PHY CTRL bits */ 1008c2ecf20Sopenharmony_ci#define DP83867_PHYCR_TX_FIFO_DEPTH_SHIFT 14 1018c2ecf20Sopenharmony_ci#define DP83867_PHYCR_RX_FIFO_DEPTH_SHIFT 12 1028c2ecf20Sopenharmony_ci#define DP83867_PHYCR_FIFO_DEPTH_MAX 0x03 1038c2ecf20Sopenharmony_ci#define DP83867_PHYCR_TX_FIFO_DEPTH_MASK GENMASK(15, 14) 1048c2ecf20Sopenharmony_ci#define DP83867_PHYCR_RX_FIFO_DEPTH_MASK GENMASK(13, 12) 1058c2ecf20Sopenharmony_ci#define DP83867_PHYCR_RESERVED_MASK BIT(11) 1068c2ecf20Sopenharmony_ci#define DP83867_PHYCR_FORCE_LINK_GOOD BIT(10) 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci/* RGMIIDCTL bits */ 1098c2ecf20Sopenharmony_ci#define DP83867_RGMII_TX_CLK_DELAY_MAX 0xf 1108c2ecf20Sopenharmony_ci#define DP83867_RGMII_TX_CLK_DELAY_SHIFT 4 1118c2ecf20Sopenharmony_ci#define DP83867_RGMII_TX_CLK_DELAY_INV (DP83867_RGMII_TX_CLK_DELAY_MAX + 1) 1128c2ecf20Sopenharmony_ci#define DP83867_RGMII_RX_CLK_DELAY_MAX 0xf 1138c2ecf20Sopenharmony_ci#define DP83867_RGMII_RX_CLK_DELAY_SHIFT 0 1148c2ecf20Sopenharmony_ci#define DP83867_RGMII_RX_CLK_DELAY_INV (DP83867_RGMII_RX_CLK_DELAY_MAX + 1) 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci/* IO_MUX_CFG bits */ 1178c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MASK 0x1f 1188c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX 0x0 1198c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN 0x1f 1208c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_CLK_O_DISABLE BIT(6) 1218c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_CLK_O_SEL_MASK (0x1f << 8) 1228c2ecf20Sopenharmony_ci#define DP83867_IO_MUX_CFG_CLK_O_SEL_SHIFT 8 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* PHY STS bits */ 1258c2ecf20Sopenharmony_ci#define DP83867_PHYSTS_1000 BIT(15) 1268c2ecf20Sopenharmony_ci#define DP83867_PHYSTS_100 BIT(14) 1278c2ecf20Sopenharmony_ci#define DP83867_PHYSTS_DUPLEX BIT(13) 1288c2ecf20Sopenharmony_ci#define DP83867_PHYSTS_LINK BIT(10) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* CFG2 bits */ 1318c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_EN (BIT(8) | BIT(9)) 1328c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_ATTEMPT_MASK (BIT(10) | BIT(11)) 1338c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_1_COUNT_VAL 0 1348c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_2_COUNT_VAL 1 1358c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_4_COUNT_VAL 2 1368c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_8_COUNT_VAL 3 1378c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_1_COUNT 1 1388c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_2_COUNT 2 1398c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_4_COUNT 4 1408c2ecf20Sopenharmony_ci#define DP83867_DOWNSHIFT_8_COUNT 8 1418c2ecf20Sopenharmony_ci#define DP83867_SGMII_AUTONEG_EN BIT(7) 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/* CFG3 bits */ 1448c2ecf20Sopenharmony_ci#define DP83867_CFG3_INT_OE BIT(7) 1458c2ecf20Sopenharmony_ci#define DP83867_CFG3_ROBUST_AUTO_MDIX BIT(9) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* CFG4 bits */ 1488c2ecf20Sopenharmony_ci#define DP83867_CFG4_PORT_MIRROR_EN BIT(0) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci/* FLD_THR_CFG */ 1518c2ecf20Sopenharmony_ci#define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cienum { 1548c2ecf20Sopenharmony_ci DP83867_PORT_MIRROING_KEEP, 1558c2ecf20Sopenharmony_ci DP83867_PORT_MIRROING_EN, 1568c2ecf20Sopenharmony_ci DP83867_PORT_MIRROING_DIS, 1578c2ecf20Sopenharmony_ci}; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_cistruct dp83867_private { 1608c2ecf20Sopenharmony_ci u32 rx_id_delay; 1618c2ecf20Sopenharmony_ci u32 tx_id_delay; 1628c2ecf20Sopenharmony_ci u32 tx_fifo_depth; 1638c2ecf20Sopenharmony_ci u32 rx_fifo_depth; 1648c2ecf20Sopenharmony_ci int io_impedance; 1658c2ecf20Sopenharmony_ci int port_mirroring; 1668c2ecf20Sopenharmony_ci bool rxctrl_strap_quirk; 1678c2ecf20Sopenharmony_ci bool set_clk_output; 1688c2ecf20Sopenharmony_ci u32 clk_output_sel; 1698c2ecf20Sopenharmony_ci bool sgmii_ref_clk_en; 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_cistatic int dp83867_ack_interrupt(struct phy_device *phydev) 1738c2ecf20Sopenharmony_ci{ 1748c2ecf20Sopenharmony_ci int err = phy_read(phydev, MII_DP83867_ISR); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci if (err < 0) 1778c2ecf20Sopenharmony_ci return err; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci return 0; 1808c2ecf20Sopenharmony_ci} 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_cistatic int dp83867_set_wol(struct phy_device *phydev, 1838c2ecf20Sopenharmony_ci struct ethtool_wolinfo *wol) 1848c2ecf20Sopenharmony_ci{ 1858c2ecf20Sopenharmony_ci struct net_device *ndev = phydev->attached_dev; 1868c2ecf20Sopenharmony_ci u16 val_rxcfg, val_micr; 1878c2ecf20Sopenharmony_ci u8 *mac; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci val_rxcfg = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RXFCFG); 1908c2ecf20Sopenharmony_ci val_micr = phy_read(phydev, MII_DP83867_MICR); 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_UCAST | 1938c2ecf20Sopenharmony_ci WAKE_BCAST)) { 1948c2ecf20Sopenharmony_ci val_rxcfg |= DP83867_WOL_ENH_MAC; 1958c2ecf20Sopenharmony_ci val_micr |= MII_DP83867_MICR_WOL_INT_EN; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci if (wol->wolopts & WAKE_MAGIC) { 1988c2ecf20Sopenharmony_ci mac = (u8 *)ndev->dev_addr; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci if (!is_valid_ether_addr(mac)) 2018c2ecf20Sopenharmony_ci return -EINVAL; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFPMD1, 2048c2ecf20Sopenharmony_ci (mac[1] << 8 | mac[0])); 2058c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFPMD2, 2068c2ecf20Sopenharmony_ci (mac[3] << 8 | mac[2])); 2078c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFPMD3, 2088c2ecf20Sopenharmony_ci (mac[5] << 8 | mac[4])); 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci val_rxcfg |= DP83867_WOL_MAGIC_EN; 2118c2ecf20Sopenharmony_ci } else { 2128c2ecf20Sopenharmony_ci val_rxcfg &= ~DP83867_WOL_MAGIC_EN; 2138c2ecf20Sopenharmony_ci } 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci if (wol->wolopts & WAKE_MAGICSECURE) { 2168c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, 2178c2ecf20Sopenharmony_ci (wol->sopass[1] << 8) | wol->sopass[0]); 2188c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP2, 2198c2ecf20Sopenharmony_ci (wol->sopass[3] << 8) | wol->sopass[2]); 2208c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP3, 2218c2ecf20Sopenharmony_ci (wol->sopass[5] << 8) | wol->sopass[4]); 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci val_rxcfg |= DP83867_WOL_SEC_EN; 2248c2ecf20Sopenharmony_ci } else { 2258c2ecf20Sopenharmony_ci val_rxcfg &= ~DP83867_WOL_SEC_EN; 2268c2ecf20Sopenharmony_ci } 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci if (wol->wolopts & WAKE_UCAST) 2298c2ecf20Sopenharmony_ci val_rxcfg |= DP83867_WOL_UCAST_EN; 2308c2ecf20Sopenharmony_ci else 2318c2ecf20Sopenharmony_ci val_rxcfg &= ~DP83867_WOL_UCAST_EN; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci if (wol->wolopts & WAKE_BCAST) 2348c2ecf20Sopenharmony_ci val_rxcfg |= DP83867_WOL_BCAST_EN; 2358c2ecf20Sopenharmony_ci else 2368c2ecf20Sopenharmony_ci val_rxcfg &= ~DP83867_WOL_BCAST_EN; 2378c2ecf20Sopenharmony_ci } else { 2388c2ecf20Sopenharmony_ci val_rxcfg &= ~DP83867_WOL_ENH_MAC; 2398c2ecf20Sopenharmony_ci val_micr &= ~MII_DP83867_MICR_WOL_INT_EN; 2408c2ecf20Sopenharmony_ci } 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFCFG, val_rxcfg); 2438c2ecf20Sopenharmony_ci phy_write(phydev, MII_DP83867_MICR, val_micr); 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci return 0; 2468c2ecf20Sopenharmony_ci} 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_cistatic void dp83867_get_wol(struct phy_device *phydev, 2498c2ecf20Sopenharmony_ci struct ethtool_wolinfo *wol) 2508c2ecf20Sopenharmony_ci{ 2518c2ecf20Sopenharmony_ci u16 value, sopass_val; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci wol->supported = (WAKE_UCAST | WAKE_BCAST | WAKE_MAGIC | 2548c2ecf20Sopenharmony_ci WAKE_MAGICSECURE); 2558c2ecf20Sopenharmony_ci wol->wolopts = 0; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci value = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RXFCFG); 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci if (value & DP83867_WOL_UCAST_EN) 2608c2ecf20Sopenharmony_ci wol->wolopts |= WAKE_UCAST; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci if (value & DP83867_WOL_BCAST_EN) 2638c2ecf20Sopenharmony_ci wol->wolopts |= WAKE_BCAST; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci if (value & DP83867_WOL_MAGIC_EN) 2668c2ecf20Sopenharmony_ci wol->wolopts |= WAKE_MAGIC; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci if (value & DP83867_WOL_SEC_EN) { 2698c2ecf20Sopenharmony_ci sopass_val = phy_read_mmd(phydev, DP83867_DEVADDR, 2708c2ecf20Sopenharmony_ci DP83867_RXFSOP1); 2718c2ecf20Sopenharmony_ci wol->sopass[0] = (sopass_val & 0xff); 2728c2ecf20Sopenharmony_ci wol->sopass[1] = (sopass_val >> 8); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci sopass_val = phy_read_mmd(phydev, DP83867_DEVADDR, 2758c2ecf20Sopenharmony_ci DP83867_RXFSOP2); 2768c2ecf20Sopenharmony_ci wol->sopass[2] = (sopass_val & 0xff); 2778c2ecf20Sopenharmony_ci wol->sopass[3] = (sopass_val >> 8); 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci sopass_val = phy_read_mmd(phydev, DP83867_DEVADDR, 2808c2ecf20Sopenharmony_ci DP83867_RXFSOP3); 2818c2ecf20Sopenharmony_ci wol->sopass[4] = (sopass_val & 0xff); 2828c2ecf20Sopenharmony_ci wol->sopass[5] = (sopass_val >> 8); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci wol->wolopts |= WAKE_MAGICSECURE; 2858c2ecf20Sopenharmony_ci } 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci if (!(value & DP83867_WOL_ENH_MAC)) 2888c2ecf20Sopenharmony_ci wol->wolopts = 0; 2898c2ecf20Sopenharmony_ci} 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_cistatic int dp83867_config_intr(struct phy_device *phydev) 2928c2ecf20Sopenharmony_ci{ 2938c2ecf20Sopenharmony_ci int micr_status; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 2968c2ecf20Sopenharmony_ci micr_status = phy_read(phydev, MII_DP83867_MICR); 2978c2ecf20Sopenharmony_ci if (micr_status < 0) 2988c2ecf20Sopenharmony_ci return micr_status; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci micr_status |= 3018c2ecf20Sopenharmony_ci (MII_DP83867_MICR_AN_ERR_INT_EN | 3028c2ecf20Sopenharmony_ci MII_DP83867_MICR_SPEED_CHNG_INT_EN | 3038c2ecf20Sopenharmony_ci MII_DP83867_MICR_AUTONEG_COMP_INT_EN | 3048c2ecf20Sopenharmony_ci MII_DP83867_MICR_LINK_STS_CHNG_INT_EN | 3058c2ecf20Sopenharmony_ci MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN | 3068c2ecf20Sopenharmony_ci MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci return phy_write(phydev, MII_DP83867_MICR, micr_status); 3098c2ecf20Sopenharmony_ci } 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci micr_status = 0x0; 3128c2ecf20Sopenharmony_ci return phy_write(phydev, MII_DP83867_MICR, micr_status); 3138c2ecf20Sopenharmony_ci} 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_cistatic int dp83867_read_status(struct phy_device *phydev) 3168c2ecf20Sopenharmony_ci{ 3178c2ecf20Sopenharmony_ci int status = phy_read(phydev, MII_DP83867_PHYSTS); 3188c2ecf20Sopenharmony_ci int ret; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci ret = genphy_read_status(phydev); 3218c2ecf20Sopenharmony_ci if (ret) 3228c2ecf20Sopenharmony_ci return ret; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci if (status < 0) 3258c2ecf20Sopenharmony_ci return status; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci if (status & DP83867_PHYSTS_DUPLEX) 3288c2ecf20Sopenharmony_ci phydev->duplex = DUPLEX_FULL; 3298c2ecf20Sopenharmony_ci else 3308c2ecf20Sopenharmony_ci phydev->duplex = DUPLEX_HALF; 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci if (status & DP83867_PHYSTS_1000) 3338c2ecf20Sopenharmony_ci phydev->speed = SPEED_1000; 3348c2ecf20Sopenharmony_ci else if (status & DP83867_PHYSTS_100) 3358c2ecf20Sopenharmony_ci phydev->speed = SPEED_100; 3368c2ecf20Sopenharmony_ci else 3378c2ecf20Sopenharmony_ci phydev->speed = SPEED_10; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci return 0; 3408c2ecf20Sopenharmony_ci} 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_cistatic int dp83867_get_downshift(struct phy_device *phydev, u8 *data) 3438c2ecf20Sopenharmony_ci{ 3448c2ecf20Sopenharmony_ci int val, cnt, enable, count; 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci val = phy_read(phydev, DP83867_CFG2); 3478c2ecf20Sopenharmony_ci if (val < 0) 3488c2ecf20Sopenharmony_ci return val; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci enable = FIELD_GET(DP83867_DOWNSHIFT_EN, val); 3518c2ecf20Sopenharmony_ci cnt = FIELD_GET(DP83867_DOWNSHIFT_ATTEMPT_MASK, val); 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci switch (cnt) { 3548c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_1_COUNT_VAL: 3558c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_1_COUNT; 3568c2ecf20Sopenharmony_ci break; 3578c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_2_COUNT_VAL: 3588c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_2_COUNT; 3598c2ecf20Sopenharmony_ci break; 3608c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_4_COUNT_VAL: 3618c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_4_COUNT; 3628c2ecf20Sopenharmony_ci break; 3638c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_8_COUNT_VAL: 3648c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_8_COUNT; 3658c2ecf20Sopenharmony_ci break; 3668c2ecf20Sopenharmony_ci default: 3678c2ecf20Sopenharmony_ci return -EINVAL; 3688c2ecf20Sopenharmony_ci } 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci *data = enable ? count : DOWNSHIFT_DEV_DISABLE; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci return 0; 3738c2ecf20Sopenharmony_ci} 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistatic int dp83867_set_downshift(struct phy_device *phydev, u8 cnt) 3768c2ecf20Sopenharmony_ci{ 3778c2ecf20Sopenharmony_ci int val, count; 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci if (cnt > DP83867_DOWNSHIFT_8_COUNT) 3808c2ecf20Sopenharmony_ci return -E2BIG; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci if (!cnt) 3838c2ecf20Sopenharmony_ci return phy_clear_bits(phydev, DP83867_CFG2, 3848c2ecf20Sopenharmony_ci DP83867_DOWNSHIFT_EN); 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci switch (cnt) { 3878c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_1_COUNT: 3888c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_1_COUNT_VAL; 3898c2ecf20Sopenharmony_ci break; 3908c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_2_COUNT: 3918c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_2_COUNT_VAL; 3928c2ecf20Sopenharmony_ci break; 3938c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_4_COUNT: 3948c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_4_COUNT_VAL; 3958c2ecf20Sopenharmony_ci break; 3968c2ecf20Sopenharmony_ci case DP83867_DOWNSHIFT_8_COUNT: 3978c2ecf20Sopenharmony_ci count = DP83867_DOWNSHIFT_8_COUNT_VAL; 3988c2ecf20Sopenharmony_ci break; 3998c2ecf20Sopenharmony_ci default: 4008c2ecf20Sopenharmony_ci phydev_err(phydev, 4018c2ecf20Sopenharmony_ci "Downshift count must be 1, 2, 4 or 8\n"); 4028c2ecf20Sopenharmony_ci return -EINVAL; 4038c2ecf20Sopenharmony_ci } 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci val = DP83867_DOWNSHIFT_EN; 4068c2ecf20Sopenharmony_ci val |= FIELD_PREP(DP83867_DOWNSHIFT_ATTEMPT_MASK, count); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci return phy_modify(phydev, DP83867_CFG2, 4098c2ecf20Sopenharmony_ci DP83867_DOWNSHIFT_EN | DP83867_DOWNSHIFT_ATTEMPT_MASK, 4108c2ecf20Sopenharmony_ci val); 4118c2ecf20Sopenharmony_ci} 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_cistatic int dp83867_get_tunable(struct phy_device *phydev, 4148c2ecf20Sopenharmony_ci struct ethtool_tunable *tuna, void *data) 4158c2ecf20Sopenharmony_ci{ 4168c2ecf20Sopenharmony_ci switch (tuna->id) { 4178c2ecf20Sopenharmony_ci case ETHTOOL_PHY_DOWNSHIFT: 4188c2ecf20Sopenharmony_ci return dp83867_get_downshift(phydev, data); 4198c2ecf20Sopenharmony_ci default: 4208c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 4218c2ecf20Sopenharmony_ci } 4228c2ecf20Sopenharmony_ci} 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_cistatic int dp83867_set_tunable(struct phy_device *phydev, 4258c2ecf20Sopenharmony_ci struct ethtool_tunable *tuna, const void *data) 4268c2ecf20Sopenharmony_ci{ 4278c2ecf20Sopenharmony_ci switch (tuna->id) { 4288c2ecf20Sopenharmony_ci case ETHTOOL_PHY_DOWNSHIFT: 4298c2ecf20Sopenharmony_ci return dp83867_set_downshift(phydev, *(const u8 *)data); 4308c2ecf20Sopenharmony_ci default: 4318c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 4328c2ecf20Sopenharmony_ci } 4338c2ecf20Sopenharmony_ci} 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_cistatic int dp83867_config_port_mirroring(struct phy_device *phydev) 4368c2ecf20Sopenharmony_ci{ 4378c2ecf20Sopenharmony_ci struct dp83867_private *dp83867 = 4388c2ecf20Sopenharmony_ci (struct dp83867_private *)phydev->priv; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci if (dp83867->port_mirroring == DP83867_PORT_MIRROING_EN) 4418c2ecf20Sopenharmony_ci phy_set_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, 4428c2ecf20Sopenharmony_ci DP83867_CFG4_PORT_MIRROR_EN); 4438c2ecf20Sopenharmony_ci else 4448c2ecf20Sopenharmony_ci phy_clear_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, 4458c2ecf20Sopenharmony_ci DP83867_CFG4_PORT_MIRROR_EN); 4468c2ecf20Sopenharmony_ci return 0; 4478c2ecf20Sopenharmony_ci} 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistatic int dp83867_verify_rgmii_cfg(struct phy_device *phydev) 4508c2ecf20Sopenharmony_ci{ 4518c2ecf20Sopenharmony_ci struct dp83867_private *dp83867 = phydev->priv; 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci /* Existing behavior was to use default pin strapping delay in rgmii 4548c2ecf20Sopenharmony_ci * mode, but rgmii should have meant no delay. Warn existing users. 4558c2ecf20Sopenharmony_ci */ 4568c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { 4578c2ecf20Sopenharmony_ci const u16 val = phy_read_mmd(phydev, DP83867_DEVADDR, 4588c2ecf20Sopenharmony_ci DP83867_STRAP_STS2); 4598c2ecf20Sopenharmony_ci const u16 txskew = (val & DP83867_STRAP_STS2_CLK_SKEW_TX_MASK) >> 4608c2ecf20Sopenharmony_ci DP83867_STRAP_STS2_CLK_SKEW_TX_SHIFT; 4618c2ecf20Sopenharmony_ci const u16 rxskew = (val & DP83867_STRAP_STS2_CLK_SKEW_RX_MASK) >> 4628c2ecf20Sopenharmony_ci DP83867_STRAP_STS2_CLK_SKEW_RX_SHIFT; 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci if (txskew != DP83867_STRAP_STS2_CLK_SKEW_NONE || 4658c2ecf20Sopenharmony_ci rxskew != DP83867_STRAP_STS2_CLK_SKEW_NONE) 4668c2ecf20Sopenharmony_ci phydev_warn(phydev, 4678c2ecf20Sopenharmony_ci "PHY has delays via pin strapping, but phy-mode = 'rgmii'\n" 4688c2ecf20Sopenharmony_ci "Should be 'rgmii-id' to use internal delays txskew:%x rxskew:%x\n", 4698c2ecf20Sopenharmony_ci txskew, rxskew); 4708c2ecf20Sopenharmony_ci } 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci /* RX delay *must* be specified if internal delay of RX is used. */ 4738c2ecf20Sopenharmony_ci if ((phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || 4748c2ecf20Sopenharmony_ci phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) && 4758c2ecf20Sopenharmony_ci dp83867->rx_id_delay == DP83867_RGMII_RX_CLK_DELAY_INV) { 4768c2ecf20Sopenharmony_ci phydev_err(phydev, "ti,rx-internal-delay must be specified\n"); 4778c2ecf20Sopenharmony_ci return -EINVAL; 4788c2ecf20Sopenharmony_ci } 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci /* TX delay *must* be specified if internal delay of TX is used. */ 4818c2ecf20Sopenharmony_ci if ((phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || 4828c2ecf20Sopenharmony_ci phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) && 4838c2ecf20Sopenharmony_ci dp83867->tx_id_delay == DP83867_RGMII_TX_CLK_DELAY_INV) { 4848c2ecf20Sopenharmony_ci phydev_err(phydev, "ti,tx-internal-delay must be specified\n"); 4858c2ecf20Sopenharmony_ci return -EINVAL; 4868c2ecf20Sopenharmony_ci } 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci return 0; 4898c2ecf20Sopenharmony_ci} 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_OF_MDIO) 4928c2ecf20Sopenharmony_cistatic int dp83867_of_init(struct phy_device *phydev) 4938c2ecf20Sopenharmony_ci{ 4948c2ecf20Sopenharmony_ci struct dp83867_private *dp83867 = phydev->priv; 4958c2ecf20Sopenharmony_ci struct device *dev = &phydev->mdio.dev; 4968c2ecf20Sopenharmony_ci struct device_node *of_node = dev->of_node; 4978c2ecf20Sopenharmony_ci int ret; 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci if (!of_node) 5008c2ecf20Sopenharmony_ci return -ENODEV; 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci /* Optional configuration */ 5038c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "ti,clk-output-sel", 5048c2ecf20Sopenharmony_ci &dp83867->clk_output_sel); 5058c2ecf20Sopenharmony_ci /* If not set, keep default */ 5068c2ecf20Sopenharmony_ci if (!ret) { 5078c2ecf20Sopenharmony_ci dp83867->set_clk_output = true; 5088c2ecf20Sopenharmony_ci /* Valid values are 0 to DP83867_CLK_O_SEL_REF_CLK or 5098c2ecf20Sopenharmony_ci * DP83867_CLK_O_SEL_OFF. 5108c2ecf20Sopenharmony_ci */ 5118c2ecf20Sopenharmony_ci if (dp83867->clk_output_sel > DP83867_CLK_O_SEL_REF_CLK && 5128c2ecf20Sopenharmony_ci dp83867->clk_output_sel != DP83867_CLK_O_SEL_OFF) { 5138c2ecf20Sopenharmony_ci phydev_err(phydev, "ti,clk-output-sel value %u out of range\n", 5148c2ecf20Sopenharmony_ci dp83867->clk_output_sel); 5158c2ecf20Sopenharmony_ci return -EINVAL; 5168c2ecf20Sopenharmony_ci } 5178c2ecf20Sopenharmony_ci } 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci if (of_property_read_bool(of_node, "ti,max-output-impedance")) 5208c2ecf20Sopenharmony_ci dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX; 5218c2ecf20Sopenharmony_ci else if (of_property_read_bool(of_node, "ti,min-output-impedance")) 5228c2ecf20Sopenharmony_ci dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN; 5238c2ecf20Sopenharmony_ci else 5248c2ecf20Sopenharmony_ci dp83867->io_impedance = -1; /* leave at default */ 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci dp83867->rxctrl_strap_quirk = of_property_read_bool(of_node, 5278c2ecf20Sopenharmony_ci "ti,dp83867-rxctrl-strap-quirk"); 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci dp83867->sgmii_ref_clk_en = of_property_read_bool(of_node, 5308c2ecf20Sopenharmony_ci "ti,sgmii-ref-clock-output-enable"); 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_ci dp83867->rx_id_delay = DP83867_RGMII_RX_CLK_DELAY_INV; 5338c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "ti,rx-internal-delay", 5348c2ecf20Sopenharmony_ci &dp83867->rx_id_delay); 5358c2ecf20Sopenharmony_ci if (!ret && dp83867->rx_id_delay > DP83867_RGMII_RX_CLK_DELAY_MAX) { 5368c2ecf20Sopenharmony_ci phydev_err(phydev, 5378c2ecf20Sopenharmony_ci "ti,rx-internal-delay value of %u out of range\n", 5388c2ecf20Sopenharmony_ci dp83867->rx_id_delay); 5398c2ecf20Sopenharmony_ci return -EINVAL; 5408c2ecf20Sopenharmony_ci } 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_ci dp83867->tx_id_delay = DP83867_RGMII_TX_CLK_DELAY_INV; 5438c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "ti,tx-internal-delay", 5448c2ecf20Sopenharmony_ci &dp83867->tx_id_delay); 5458c2ecf20Sopenharmony_ci if (!ret && dp83867->tx_id_delay > DP83867_RGMII_TX_CLK_DELAY_MAX) { 5468c2ecf20Sopenharmony_ci phydev_err(phydev, 5478c2ecf20Sopenharmony_ci "ti,tx-internal-delay value of %u out of range\n", 5488c2ecf20Sopenharmony_ci dp83867->tx_id_delay); 5498c2ecf20Sopenharmony_ci return -EINVAL; 5508c2ecf20Sopenharmony_ci } 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci if (of_property_read_bool(of_node, "enet-phy-lane-swap")) 5538c2ecf20Sopenharmony_ci dp83867->port_mirroring = DP83867_PORT_MIRROING_EN; 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci if (of_property_read_bool(of_node, "enet-phy-lane-no-swap")) 5568c2ecf20Sopenharmony_ci dp83867->port_mirroring = DP83867_PORT_MIRROING_DIS; 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "ti,fifo-depth", 5598c2ecf20Sopenharmony_ci &dp83867->tx_fifo_depth); 5608c2ecf20Sopenharmony_ci if (ret) { 5618c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "tx-fifo-depth", 5628c2ecf20Sopenharmony_ci &dp83867->tx_fifo_depth); 5638c2ecf20Sopenharmony_ci if (ret) 5648c2ecf20Sopenharmony_ci dp83867->tx_fifo_depth = 5658c2ecf20Sopenharmony_ci DP83867_PHYCR_FIFO_DEPTH_4_B_NIB; 5668c2ecf20Sopenharmony_ci } 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci if (dp83867->tx_fifo_depth > DP83867_PHYCR_FIFO_DEPTH_MAX) { 5698c2ecf20Sopenharmony_ci phydev_err(phydev, "tx-fifo-depth value %u out of range\n", 5708c2ecf20Sopenharmony_ci dp83867->tx_fifo_depth); 5718c2ecf20Sopenharmony_ci return -EINVAL; 5728c2ecf20Sopenharmony_ci } 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci ret = of_property_read_u32(of_node, "rx-fifo-depth", 5758c2ecf20Sopenharmony_ci &dp83867->rx_fifo_depth); 5768c2ecf20Sopenharmony_ci if (ret) 5778c2ecf20Sopenharmony_ci dp83867->rx_fifo_depth = DP83867_PHYCR_FIFO_DEPTH_4_B_NIB; 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci if (dp83867->rx_fifo_depth > DP83867_PHYCR_FIFO_DEPTH_MAX) { 5808c2ecf20Sopenharmony_ci phydev_err(phydev, "rx-fifo-depth value %u out of range\n", 5818c2ecf20Sopenharmony_ci dp83867->rx_fifo_depth); 5828c2ecf20Sopenharmony_ci return -EINVAL; 5838c2ecf20Sopenharmony_ci } 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_ci return 0; 5868c2ecf20Sopenharmony_ci} 5878c2ecf20Sopenharmony_ci#else 5888c2ecf20Sopenharmony_cistatic int dp83867_of_init(struct phy_device *phydev) 5898c2ecf20Sopenharmony_ci{ 5908c2ecf20Sopenharmony_ci return 0; 5918c2ecf20Sopenharmony_ci} 5928c2ecf20Sopenharmony_ci#endif /* CONFIG_OF_MDIO */ 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_cistatic int dp83867_probe(struct phy_device *phydev) 5958c2ecf20Sopenharmony_ci{ 5968c2ecf20Sopenharmony_ci struct dp83867_private *dp83867; 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867), 5998c2ecf20Sopenharmony_ci GFP_KERNEL); 6008c2ecf20Sopenharmony_ci if (!dp83867) 6018c2ecf20Sopenharmony_ci return -ENOMEM; 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci phydev->priv = dp83867; 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_ci return dp83867_of_init(phydev); 6068c2ecf20Sopenharmony_ci} 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_cistatic int dp83867_config_init(struct phy_device *phydev) 6098c2ecf20Sopenharmony_ci{ 6108c2ecf20Sopenharmony_ci struct dp83867_private *dp83867 = phydev->priv; 6118c2ecf20Sopenharmony_ci int ret, val, bs; 6128c2ecf20Sopenharmony_ci u16 delay; 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci /* Force speed optimization for the PHY even if it strapped */ 6158c2ecf20Sopenharmony_ci ret = phy_modify(phydev, DP83867_CFG2, DP83867_DOWNSHIFT_EN, 6168c2ecf20Sopenharmony_ci DP83867_DOWNSHIFT_EN); 6178c2ecf20Sopenharmony_ci if (ret) 6188c2ecf20Sopenharmony_ci return ret; 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci ret = dp83867_verify_rgmii_cfg(phydev); 6218c2ecf20Sopenharmony_ci if (ret) 6228c2ecf20Sopenharmony_ci return ret; 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci /* RX_DV/RX_CTRL strapped in mode 1 or mode 2 workaround */ 6258c2ecf20Sopenharmony_ci if (dp83867->rxctrl_strap_quirk) 6268c2ecf20Sopenharmony_ci phy_clear_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, 6278c2ecf20Sopenharmony_ci BIT(7)); 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci bs = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_STRAP_STS2); 6308c2ecf20Sopenharmony_ci if (bs & DP83867_STRAP_STS2_STRAP_FLD) { 6318c2ecf20Sopenharmony_ci /* When using strap to enable FLD, the ENERGY_LOST_FLD_THR will 6328c2ecf20Sopenharmony_ci * be set to 0x2. This may causes the PHY link to be unstable - 6338c2ecf20Sopenharmony_ci * the default value 0x1 need to be restored. 6348c2ecf20Sopenharmony_ci */ 6358c2ecf20Sopenharmony_ci ret = phy_modify_mmd(phydev, DP83867_DEVADDR, 6368c2ecf20Sopenharmony_ci DP83867_FLD_THR_CFG, 6378c2ecf20Sopenharmony_ci DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK, 6388c2ecf20Sopenharmony_ci 0x1); 6398c2ecf20Sopenharmony_ci if (ret) 6408c2ecf20Sopenharmony_ci return ret; 6418c2ecf20Sopenharmony_ci } 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci if (phy_interface_is_rgmii(phydev) || 6448c2ecf20Sopenharmony_ci phydev->interface == PHY_INTERFACE_MODE_SGMII) { 6458c2ecf20Sopenharmony_ci val = phy_read(phydev, MII_DP83867_PHYCTRL); 6468c2ecf20Sopenharmony_ci if (val < 0) 6478c2ecf20Sopenharmony_ci return val; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci val &= ~DP83867_PHYCR_TX_FIFO_DEPTH_MASK; 6508c2ecf20Sopenharmony_ci val |= (dp83867->tx_fifo_depth << 6518c2ecf20Sopenharmony_ci DP83867_PHYCR_TX_FIFO_DEPTH_SHIFT); 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { 6548c2ecf20Sopenharmony_ci val &= ~DP83867_PHYCR_RX_FIFO_DEPTH_MASK; 6558c2ecf20Sopenharmony_ci val |= (dp83867->rx_fifo_depth << 6568c2ecf20Sopenharmony_ci DP83867_PHYCR_RX_FIFO_DEPTH_SHIFT); 6578c2ecf20Sopenharmony_ci } 6588c2ecf20Sopenharmony_ci 6598c2ecf20Sopenharmony_ci ret = phy_write(phydev, MII_DP83867_PHYCTRL, val); 6608c2ecf20Sopenharmony_ci if (ret) 6618c2ecf20Sopenharmony_ci return ret; 6628c2ecf20Sopenharmony_ci } 6638c2ecf20Sopenharmony_ci 6648c2ecf20Sopenharmony_ci if (phy_interface_is_rgmii(phydev)) { 6658c2ecf20Sopenharmony_ci val = phy_read(phydev, MII_DP83867_PHYCTRL); 6668c2ecf20Sopenharmony_ci if (val < 0) 6678c2ecf20Sopenharmony_ci return val; 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci /* The code below checks if "port mirroring" N/A MODE4 has been 6708c2ecf20Sopenharmony_ci * enabled during power on bootstrap. 6718c2ecf20Sopenharmony_ci * 6728c2ecf20Sopenharmony_ci * Such N/A mode enabled by mistake can put PHY IC in some 6738c2ecf20Sopenharmony_ci * internal testing mode and disable RGMII transmission. 6748c2ecf20Sopenharmony_ci * 6758c2ecf20Sopenharmony_ci * In this particular case one needs to check STRAP_STS1 6768c2ecf20Sopenharmony_ci * register's bit 11 (marked as RESERVED). 6778c2ecf20Sopenharmony_ci */ 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci bs = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_STRAP_STS1); 6808c2ecf20Sopenharmony_ci if (bs & DP83867_STRAP_STS1_RESERVED) 6818c2ecf20Sopenharmony_ci val &= ~DP83867_PHYCR_RESERVED_MASK; 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci ret = phy_write(phydev, MII_DP83867_PHYCTRL, val); 6848c2ecf20Sopenharmony_ci if (ret) 6858c2ecf20Sopenharmony_ci return ret; 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci /* If rgmii mode with no internal delay is selected, we do NOT use 6888c2ecf20Sopenharmony_ci * aligned mode as one might expect. Instead we use the PHY's default 6898c2ecf20Sopenharmony_ci * based on pin strapping. And the "mode 0" default is to *use* 6908c2ecf20Sopenharmony_ci * internal delay with a value of 7 (2.00 ns). 6918c2ecf20Sopenharmony_ci * 6928c2ecf20Sopenharmony_ci * Set up RGMII delays 6938c2ecf20Sopenharmony_ci */ 6948c2ecf20Sopenharmony_ci val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIICTL); 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_ci val &= ~(DP83867_RGMII_TX_CLK_DELAY_EN | DP83867_RGMII_RX_CLK_DELAY_EN); 6978c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) 6988c2ecf20Sopenharmony_ci val |= (DP83867_RGMII_TX_CLK_DELAY_EN | DP83867_RGMII_RX_CLK_DELAY_EN); 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) 7018c2ecf20Sopenharmony_ci val |= DP83867_RGMII_TX_CLK_DELAY_EN; 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) 7048c2ecf20Sopenharmony_ci val |= DP83867_RGMII_RX_CLK_DELAY_EN; 7058c2ecf20Sopenharmony_ci 7068c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIICTL, val); 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci delay = 0; 7098c2ecf20Sopenharmony_ci if (dp83867->rx_id_delay != DP83867_RGMII_RX_CLK_DELAY_INV) 7108c2ecf20Sopenharmony_ci delay |= dp83867->rx_id_delay; 7118c2ecf20Sopenharmony_ci if (dp83867->tx_id_delay != DP83867_RGMII_TX_CLK_DELAY_INV) 7128c2ecf20Sopenharmony_ci delay |= dp83867->tx_id_delay << 7138c2ecf20Sopenharmony_ci DP83867_RGMII_TX_CLK_DELAY_SHIFT; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIIDCTL, 7168c2ecf20Sopenharmony_ci delay); 7178c2ecf20Sopenharmony_ci } 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci /* If specified, set io impedance */ 7208c2ecf20Sopenharmony_ci if (dp83867->io_impedance >= 0) 7218c2ecf20Sopenharmony_ci phy_modify_mmd(phydev, DP83867_DEVADDR, DP83867_IO_MUX_CFG, 7228c2ecf20Sopenharmony_ci DP83867_IO_MUX_CFG_IO_IMPEDANCE_MASK, 7238c2ecf20Sopenharmony_ci dp83867->io_impedance); 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { 7268c2ecf20Sopenharmony_ci /* For support SPEED_10 in SGMII mode 7278c2ecf20Sopenharmony_ci * DP83867_10M_SGMII_RATE_ADAPT bit 7288c2ecf20Sopenharmony_ci * has to be cleared by software. That 7298c2ecf20Sopenharmony_ci * does not affect SPEED_100 and 7308c2ecf20Sopenharmony_ci * SPEED_1000. 7318c2ecf20Sopenharmony_ci */ 7328c2ecf20Sopenharmony_ci ret = phy_modify_mmd(phydev, DP83867_DEVADDR, 7338c2ecf20Sopenharmony_ci DP83867_10M_SGMII_CFG, 7348c2ecf20Sopenharmony_ci DP83867_10M_SGMII_RATE_ADAPT_MASK, 7358c2ecf20Sopenharmony_ci 0); 7368c2ecf20Sopenharmony_ci if (ret) 7378c2ecf20Sopenharmony_ci return ret; 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_ci /* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 7408c2ecf20Sopenharmony_ci * are 01). That is not enough to finalize autoneg on some 7418c2ecf20Sopenharmony_ci * devices. Increase this timer duration to maximum 16ms. 7428c2ecf20Sopenharmony_ci */ 7438c2ecf20Sopenharmony_ci ret = phy_modify_mmd(phydev, DP83867_DEVADDR, 7448c2ecf20Sopenharmony_ci DP83867_CFG4, 7458c2ecf20Sopenharmony_ci DP83867_CFG4_SGMII_ANEG_MASK, 7468c2ecf20Sopenharmony_ci DP83867_CFG4_SGMII_ANEG_TIMER_16MS); 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_ci if (ret) 7498c2ecf20Sopenharmony_ci return ret; 7508c2ecf20Sopenharmony_ci 7518c2ecf20Sopenharmony_ci val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_SGMIICTL); 7528c2ecf20Sopenharmony_ci /* SGMII type is set to 4-wire mode by default. 7538c2ecf20Sopenharmony_ci * If we place appropriate property in dts (see above) 7548c2ecf20Sopenharmony_ci * switch on 6-wire mode. 7558c2ecf20Sopenharmony_ci */ 7568c2ecf20Sopenharmony_ci if (dp83867->sgmii_ref_clk_en) 7578c2ecf20Sopenharmony_ci val |= DP83867_SGMII_TYPE; 7588c2ecf20Sopenharmony_ci else 7598c2ecf20Sopenharmony_ci val &= ~DP83867_SGMII_TYPE; 7608c2ecf20Sopenharmony_ci phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_SGMIICTL, val); 7618c2ecf20Sopenharmony_ci 7628c2ecf20Sopenharmony_ci /* This is a SW workaround for link instability if RX_CTRL is 7638c2ecf20Sopenharmony_ci * not strapped to mode 3 or 4 in HW. This is required for SGMII 7648c2ecf20Sopenharmony_ci * in addition to clearing bit 7, handled above. 7658c2ecf20Sopenharmony_ci */ 7668c2ecf20Sopenharmony_ci if (dp83867->rxctrl_strap_quirk) 7678c2ecf20Sopenharmony_ci phy_set_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, 7688c2ecf20Sopenharmony_ci BIT(8)); 7698c2ecf20Sopenharmony_ci } 7708c2ecf20Sopenharmony_ci 7718c2ecf20Sopenharmony_ci val = phy_read(phydev, DP83867_CFG3); 7728c2ecf20Sopenharmony_ci /* Enable Interrupt output INT_OE in CFG3 register */ 7738c2ecf20Sopenharmony_ci if (phy_interrupt_is_valid(phydev)) 7748c2ecf20Sopenharmony_ci val |= DP83867_CFG3_INT_OE; 7758c2ecf20Sopenharmony_ci 7768c2ecf20Sopenharmony_ci val |= DP83867_CFG3_ROBUST_AUTO_MDIX; 7778c2ecf20Sopenharmony_ci phy_write(phydev, DP83867_CFG3, val); 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci if (dp83867->port_mirroring != DP83867_PORT_MIRROING_KEEP) 7808c2ecf20Sopenharmony_ci dp83867_config_port_mirroring(phydev); 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ci /* Clock output selection if muxing property is set */ 7838c2ecf20Sopenharmony_ci if (dp83867->set_clk_output) { 7848c2ecf20Sopenharmony_ci u16 mask = DP83867_IO_MUX_CFG_CLK_O_DISABLE; 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci if (dp83867->clk_output_sel == DP83867_CLK_O_SEL_OFF) { 7878c2ecf20Sopenharmony_ci val = DP83867_IO_MUX_CFG_CLK_O_DISABLE; 7888c2ecf20Sopenharmony_ci } else { 7898c2ecf20Sopenharmony_ci mask |= DP83867_IO_MUX_CFG_CLK_O_SEL_MASK; 7908c2ecf20Sopenharmony_ci val = dp83867->clk_output_sel << 7918c2ecf20Sopenharmony_ci DP83867_IO_MUX_CFG_CLK_O_SEL_SHIFT; 7928c2ecf20Sopenharmony_ci } 7938c2ecf20Sopenharmony_ci 7948c2ecf20Sopenharmony_ci phy_modify_mmd(phydev, DP83867_DEVADDR, DP83867_IO_MUX_CFG, 7958c2ecf20Sopenharmony_ci mask, val); 7968c2ecf20Sopenharmony_ci } 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci return 0; 7998c2ecf20Sopenharmony_ci} 8008c2ecf20Sopenharmony_ci 8018c2ecf20Sopenharmony_cistatic int dp83867_phy_reset(struct phy_device *phydev) 8028c2ecf20Sopenharmony_ci{ 8038c2ecf20Sopenharmony_ci int err; 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_ci err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET); 8068c2ecf20Sopenharmony_ci if (err < 0) 8078c2ecf20Sopenharmony_ci return err; 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci usleep_range(10, 20); 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_ci err = phy_modify(phydev, MII_DP83867_PHYCTRL, 8128c2ecf20Sopenharmony_ci DP83867_PHYCR_FORCE_LINK_GOOD, 0); 8138c2ecf20Sopenharmony_ci if (err < 0) 8148c2ecf20Sopenharmony_ci return err; 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_ci /* Configure the DSP Feedforward Equalizer Configuration register to 8178c2ecf20Sopenharmony_ci * improve short cable (< 1 meter) performance. This will not affect 8188c2ecf20Sopenharmony_ci * long cable performance. 8198c2ecf20Sopenharmony_ci */ 8208c2ecf20Sopenharmony_ci err = phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_DSP_FFE_CFG, 8218c2ecf20Sopenharmony_ci 0x0e81); 8228c2ecf20Sopenharmony_ci if (err < 0) 8238c2ecf20Sopenharmony_ci return err; 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_ci err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART); 8268c2ecf20Sopenharmony_ci if (err < 0) 8278c2ecf20Sopenharmony_ci return err; 8288c2ecf20Sopenharmony_ci 8298c2ecf20Sopenharmony_ci usleep_range(10, 20); 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_ci return 0; 8328c2ecf20Sopenharmony_ci} 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_cistatic void dp83867_link_change_notify(struct phy_device *phydev) 8358c2ecf20Sopenharmony_ci{ 8368c2ecf20Sopenharmony_ci /* There is a limitation in DP83867 PHY device where SGMII AN is 8378c2ecf20Sopenharmony_ci * only triggered once after the device is booted up. Even after the 8388c2ecf20Sopenharmony_ci * PHY TPI is down and up again, SGMII AN is not triggered and 8398c2ecf20Sopenharmony_ci * hence no new in-band message from PHY to MAC side SGMII. 8408c2ecf20Sopenharmony_ci * This could cause an issue during power up, when PHY is up prior 8418c2ecf20Sopenharmony_ci * to MAC. At this condition, once MAC side SGMII is up, MAC side 8428c2ecf20Sopenharmony_ci * SGMII wouldn`t receive new in-band message from TI PHY with 8438c2ecf20Sopenharmony_ci * correct link status, speed and duplex info. 8448c2ecf20Sopenharmony_ci * Thus, implemented a SW solution here to retrigger SGMII Auto-Neg 8458c2ecf20Sopenharmony_ci * whenever there is a link change. 8468c2ecf20Sopenharmony_ci */ 8478c2ecf20Sopenharmony_ci if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { 8488c2ecf20Sopenharmony_ci int val = 0; 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_ci val = phy_clear_bits(phydev, DP83867_CFG2, 8518c2ecf20Sopenharmony_ci DP83867_SGMII_AUTONEG_EN); 8528c2ecf20Sopenharmony_ci if (val < 0) 8538c2ecf20Sopenharmony_ci return; 8548c2ecf20Sopenharmony_ci 8558c2ecf20Sopenharmony_ci phy_set_bits(phydev, DP83867_CFG2, 8568c2ecf20Sopenharmony_ci DP83867_SGMII_AUTONEG_EN); 8578c2ecf20Sopenharmony_ci } 8588c2ecf20Sopenharmony_ci} 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_cistatic struct phy_driver dp83867_driver[] = { 8618c2ecf20Sopenharmony_ci { 8628c2ecf20Sopenharmony_ci .phy_id = DP83867_PHY_ID, 8638c2ecf20Sopenharmony_ci .phy_id_mask = 0xfffffff0, 8648c2ecf20Sopenharmony_ci .name = "TI DP83867", 8658c2ecf20Sopenharmony_ci /* PHY_GBIT_FEATURES */ 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ci .probe = dp83867_probe, 8688c2ecf20Sopenharmony_ci .config_init = dp83867_config_init, 8698c2ecf20Sopenharmony_ci .soft_reset = dp83867_phy_reset, 8708c2ecf20Sopenharmony_ci 8718c2ecf20Sopenharmony_ci .read_status = dp83867_read_status, 8728c2ecf20Sopenharmony_ci .get_tunable = dp83867_get_tunable, 8738c2ecf20Sopenharmony_ci .set_tunable = dp83867_set_tunable, 8748c2ecf20Sopenharmony_ci 8758c2ecf20Sopenharmony_ci .get_wol = dp83867_get_wol, 8768c2ecf20Sopenharmony_ci .set_wol = dp83867_set_wol, 8778c2ecf20Sopenharmony_ci 8788c2ecf20Sopenharmony_ci /* IRQ related */ 8798c2ecf20Sopenharmony_ci .ack_interrupt = dp83867_ack_interrupt, 8808c2ecf20Sopenharmony_ci .config_intr = dp83867_config_intr, 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci .suspend = genphy_suspend, 8838c2ecf20Sopenharmony_ci .resume = genphy_resume, 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_ci .link_change_notify = dp83867_link_change_notify, 8868c2ecf20Sopenharmony_ci }, 8878c2ecf20Sopenharmony_ci}; 8888c2ecf20Sopenharmony_cimodule_phy_driver(dp83867_driver); 8898c2ecf20Sopenharmony_ci 8908c2ecf20Sopenharmony_cistatic struct mdio_device_id __maybe_unused dp83867_tbl[] = { 8918c2ecf20Sopenharmony_ci { DP83867_PHY_ID, 0xfffffff0 }, 8928c2ecf20Sopenharmony_ci { } 8938c2ecf20Sopenharmony_ci}; 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(mdio, dp83867_tbl); 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Texas Instruments DP83867 PHY driver"); 8988c2ecf20Sopenharmony_ciMODULE_AUTHOR("Dan Murphy <dmurphy@ti.com"); 8998c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 900