18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: BSD-3-Clause */ 28c2ecf20Sopenharmony_ci/* Copyright 2020, NXP Semiconductors 38c2ecf20Sopenharmony_ci */ 48c2ecf20Sopenharmony_ci#ifndef _SJA1105_SGMII_H 58c2ecf20Sopenharmony_ci#define _SJA1105_SGMII_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define SJA1105_SGMII_PORT 4 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* DIGITAL_CONTROL_1 (address 1f8000h) */ 108c2ecf20Sopenharmony_ci#define SJA1105_DC1 0x8000 118c2ecf20Sopenharmony_ci#define SJA1105_DC1_VS_RESET BIT(15) 128c2ecf20Sopenharmony_ci#define SJA1105_DC1_REMOTE_LOOPBACK BIT(14) 138c2ecf20Sopenharmony_ci#define SJA1105_DC1_EN_VSMMD1 BIT(13) 148c2ecf20Sopenharmony_ci#define SJA1105_DC1_POWER_SAVE BIT(11) 158c2ecf20Sopenharmony_ci#define SJA1105_DC1_CLOCK_STOP_EN BIT(10) 168c2ecf20Sopenharmony_ci#define SJA1105_DC1_MAC_AUTO_SW BIT(9) 178c2ecf20Sopenharmony_ci#define SJA1105_DC1_INIT BIT(8) 188c2ecf20Sopenharmony_ci#define SJA1105_DC1_TX_DISABLE BIT(4) 198c2ecf20Sopenharmony_ci#define SJA1105_DC1_AUTONEG_TIMER_OVRR BIT(3) 208c2ecf20Sopenharmony_ci#define SJA1105_DC1_BYP_POWERUP BIT(1) 218c2ecf20Sopenharmony_ci#define SJA1105_DC1_PHY_MODE_CONTROL BIT(0) 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* DIGITAL_CONTROL_2 register (address 1f80E1h) */ 248c2ecf20Sopenharmony_ci#define SJA1105_DC2 0x80e1 258c2ecf20Sopenharmony_ci#define SJA1105_DC2_TX_POL_INV_DISABLE BIT(4) 268c2ecf20Sopenharmony_ci#define SJA1105_DC2_RX_POL_INV BIT(0) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* DIGITAL_ERROR_CNT register (address 1f80E2h) */ 298c2ecf20Sopenharmony_ci#define SJA1105_DEC 0x80e2 308c2ecf20Sopenharmony_ci#define SJA1105_DEC_ICG_EC_ENA BIT(4) 318c2ecf20Sopenharmony_ci#define SJA1105_DEC_CLEAR_ON_READ BIT(0) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* AUTONEG_CONTROL register (address 1f8001h) */ 348c2ecf20Sopenharmony_ci#define SJA1105_AC 0x8001 358c2ecf20Sopenharmony_ci#define SJA1105_AC_MII_CONTROL BIT(8) 368c2ecf20Sopenharmony_ci#define SJA1105_AC_SGMII_LINK BIT(4) 378c2ecf20Sopenharmony_ci#define SJA1105_AC_PHY_MODE BIT(3) 388c2ecf20Sopenharmony_ci#define SJA1105_AC_AUTONEG_MODE(x) (((x) << 1) & GENMASK(2, 1)) 398c2ecf20Sopenharmony_ci#define SJA1105_AC_AUTONEG_MODE_SGMII SJA1105_AC_AUTONEG_MODE(2) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* AUTONEG_INTR_STATUS register (address 1f8002h) */ 428c2ecf20Sopenharmony_ci#define SJA1105_AIS 0x8002 438c2ecf20Sopenharmony_ci#define SJA1105_AIS_LINK_STATUS(x) (!!((x) & BIT(4))) 448c2ecf20Sopenharmony_ci#define SJA1105_AIS_SPEED(x) (((x) & GENMASK(3, 2)) >> 2) 458c2ecf20Sopenharmony_ci#define SJA1105_AIS_DUPLEX_MODE(x) (!!((x) & BIT(1))) 468c2ecf20Sopenharmony_ci#define SJA1105_AIS_COMPLETE(x) (!!((x) & BIT(0))) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* DEBUG_CONTROL register (address 1f8005h) */ 498c2ecf20Sopenharmony_ci#define SJA1105_DC 0x8005 508c2ecf20Sopenharmony_ci#define SJA1105_DC_SUPPRESS_LOS BIT(4) 518c2ecf20Sopenharmony_ci#define SJA1105_DC_RESTART_SYNC BIT(0) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#endif 54