18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* $Date: 2005/03/07 23:59:05 $ $RCSfile: mv88e1xxx.h,v $ $Revision: 1.13 $ */
38c2ecf20Sopenharmony_ci#ifndef CHELSIO_MV8E1XXX_H
48c2ecf20Sopenharmony_ci#define CHELSIO_MV8E1XXX_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef BMCR_SPEED1000
78c2ecf20Sopenharmony_ci# define BMCR_SPEED1000 0x40
88c2ecf20Sopenharmony_ci#endif
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef ADVERTISE_PAUSE
118c2ecf20Sopenharmony_ci# define ADVERTISE_PAUSE 0x400
128c2ecf20Sopenharmony_ci#endif
138c2ecf20Sopenharmony_ci#ifndef ADVERTISE_PAUSE_ASYM
148c2ecf20Sopenharmony_ci# define ADVERTISE_PAUSE_ASYM 0x800
158c2ecf20Sopenharmony_ci#endif
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Gigabit MII registers */
188c2ecf20Sopenharmony_ci#define MII_GBCR 9       /* 1000Base-T control register */
198c2ecf20Sopenharmony_ci#define MII_GBSR 10      /* 1000Base-T status register */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* 1000Base-T control register fields */
228c2ecf20Sopenharmony_ci#define GBCR_ADV_1000HALF         0x100
238c2ecf20Sopenharmony_ci#define GBCR_ADV_1000FULL         0x200
248c2ecf20Sopenharmony_ci#define GBCR_PREFER_MASTER        0x400
258c2ecf20Sopenharmony_ci#define GBCR_MANUAL_AS_MASTER     0x800
268c2ecf20Sopenharmony_ci#define GBCR_MANUAL_CONFIG_ENABLE 0x1000
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* 1000Base-T status register fields */
298c2ecf20Sopenharmony_ci#define GBSR_LP_1000HALF  0x400
308c2ecf20Sopenharmony_ci#define GBSR_LP_1000FULL  0x800
318c2ecf20Sopenharmony_ci#define GBSR_REMOTE_OK    0x1000
328c2ecf20Sopenharmony_ci#define GBSR_LOCAL_OK     0x2000
338c2ecf20Sopenharmony_ci#define GBSR_LOCAL_MASTER 0x4000
348c2ecf20Sopenharmony_ci#define GBSR_MASTER_FAULT 0x8000
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Marvell PHY interrupt status bits. */
378c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_JABBER          0x0001
388c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_POLARITY_CHNG   0x0002
398c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_ENG_DETECT_CHNG 0x0010
408c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_DOWNSHIFT       0x0020
418c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_MDI_XOVER_CHNG  0x0040
428c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_FIFO_OVER_UNDER 0x0080
438c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_FALSE_CARRIER   0x0100
448c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_SYMBOL_ERROR    0x0200
458c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_LINK_CHNG       0x0400
468c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_AUTONEG_DONE    0x0800
478c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_PAGE_RECV       0x1000
488c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_DUPLEX_CHNG     0x2000
498c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_SPEED_CHNG      0x4000
508c2ecf20Sopenharmony_ci#define MV88E1XXX_INTR_AUTONEG_ERR     0x8000
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Marvell PHY specific registers. */
538c2ecf20Sopenharmony_ci#define MV88E1XXX_SPECIFIC_CNTRL_REGISTER               16
548c2ecf20Sopenharmony_ci#define MV88E1XXX_SPECIFIC_STATUS_REGISTER              17
558c2ecf20Sopenharmony_ci#define MV88E1XXX_INTERRUPT_ENABLE_REGISTER             18
568c2ecf20Sopenharmony_ci#define MV88E1XXX_INTERRUPT_STATUS_REGISTER             19
578c2ecf20Sopenharmony_ci#define MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_REGISTER       20
588c2ecf20Sopenharmony_ci#define MV88E1XXX_RECV_ERR_CNTR_REGISTER                21
598c2ecf20Sopenharmony_ci#define MV88E1XXX_RES_REGISTER                          22
608c2ecf20Sopenharmony_ci#define MV88E1XXX_GLOBAL_STATUS_REGISTER                23
618c2ecf20Sopenharmony_ci#define MV88E1XXX_LED_CONTROL_REGISTER                  24
628c2ecf20Sopenharmony_ci#define MV88E1XXX_MANUAL_LED_OVERRIDE_REGISTER          25
638c2ecf20Sopenharmony_ci#define MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_2_REGISTER     26
648c2ecf20Sopenharmony_ci#define MV88E1XXX_EXT_PHY_SPECIFIC_STATUS_REGISTER      27
658c2ecf20Sopenharmony_ci#define MV88E1XXX_VIRTUAL_CABLE_TESTER_REGISTER         28
668c2ecf20Sopenharmony_ci#define MV88E1XXX_EXTENDED_ADDR_REGISTER                29
678c2ecf20Sopenharmony_ci#define MV88E1XXX_EXTENDED_REGISTER                     30
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* PHY specific control register fields */
708c2ecf20Sopenharmony_ci#define S_PSCR_MDI_XOVER_MODE    5
718c2ecf20Sopenharmony_ci#define M_PSCR_MDI_XOVER_MODE    0x3
728c2ecf20Sopenharmony_ci#define V_PSCR_MDI_XOVER_MODE(x) ((x) << S_PSCR_MDI_XOVER_MODE)
738c2ecf20Sopenharmony_ci#define G_PSCR_MDI_XOVER_MODE(x) (((x) >> S_PSCR_MDI_XOVER_MODE) & M_PSCR_MDI_XOVER_MODE)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* Extended PHY specific control register fields */
768c2ecf20Sopenharmony_ci#define S_DOWNSHIFT_ENABLE 8
778c2ecf20Sopenharmony_ci#define V_DOWNSHIFT_ENABLE (1 << S_DOWNSHIFT_ENABLE)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define S_DOWNSHIFT_CNT    9
808c2ecf20Sopenharmony_ci#define M_DOWNSHIFT_CNT    0x7
818c2ecf20Sopenharmony_ci#define V_DOWNSHIFT_CNT(x) ((x) << S_DOWNSHIFT_CNT)
828c2ecf20Sopenharmony_ci#define G_DOWNSHIFT_CNT(x) (((x) >> S_DOWNSHIFT_CNT) & M_DOWNSHIFT_CNT)
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/* PHY specific status register fields */
858c2ecf20Sopenharmony_ci#define S_PSSR_JABBER 0
868c2ecf20Sopenharmony_ci#define V_PSSR_JABBER (1 << S_PSSR_JABBER)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define S_PSSR_POLARITY 1
898c2ecf20Sopenharmony_ci#define V_PSSR_POLARITY (1 << S_PSSR_POLARITY)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define S_PSSR_RX_PAUSE 2
928c2ecf20Sopenharmony_ci#define V_PSSR_RX_PAUSE (1 << S_PSSR_RX_PAUSE)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define S_PSSR_TX_PAUSE 3
958c2ecf20Sopenharmony_ci#define V_PSSR_TX_PAUSE (1 << S_PSSR_TX_PAUSE)
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define S_PSSR_ENERGY_DETECT 4
988c2ecf20Sopenharmony_ci#define V_PSSR_ENERGY_DETECT (1 << S_PSSR_ENERGY_DETECT)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define S_PSSR_DOWNSHIFT_STATUS 5
1018c2ecf20Sopenharmony_ci#define V_PSSR_DOWNSHIFT_STATUS (1 << S_PSSR_DOWNSHIFT_STATUS)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define S_PSSR_MDI 6
1048c2ecf20Sopenharmony_ci#define V_PSSR_MDI (1 << S_PSSR_MDI)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define S_PSSR_CABLE_LEN    7
1078c2ecf20Sopenharmony_ci#define M_PSSR_CABLE_LEN    0x7
1088c2ecf20Sopenharmony_ci#define V_PSSR_CABLE_LEN(x) ((x) << S_PSSR_CABLE_LEN)
1098c2ecf20Sopenharmony_ci#define G_PSSR_CABLE_LEN(x) (((x) >> S_PSSR_CABLE_LEN) & M_PSSR_CABLE_LEN)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define S_PSSR_LINK 10
1128c2ecf20Sopenharmony_ci#define V_PSSR_LINK (1 << S_PSSR_LINK)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define S_PSSR_STATUS_RESOLVED 11
1158c2ecf20Sopenharmony_ci#define V_PSSR_STATUS_RESOLVED (1 << S_PSSR_STATUS_RESOLVED)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define S_PSSR_PAGE_RECEIVED 12
1188c2ecf20Sopenharmony_ci#define V_PSSR_PAGE_RECEIVED (1 << S_PSSR_PAGE_RECEIVED)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define S_PSSR_DUPLEX 13
1218c2ecf20Sopenharmony_ci#define V_PSSR_DUPLEX (1 << S_PSSR_DUPLEX)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define S_PSSR_SPEED    14
1248c2ecf20Sopenharmony_ci#define M_PSSR_SPEED    0x3
1258c2ecf20Sopenharmony_ci#define V_PSSR_SPEED(x) ((x) << S_PSSR_SPEED)
1268c2ecf20Sopenharmony_ci#define G_PSSR_SPEED(x) (((x) >> S_PSSR_SPEED) & M_PSSR_SPEED)
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#endif
129