2018-07-18 04:02:30 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Freescale Semiconductor, Inc.
|
2020-03-16 21:35:59 +08:00
|
|
|
* Copyright 2020 NXP
|
2018-07-18 04:02:30 +08:00
|
|
|
* Andy Fleming <afleming@gmail.com>
|
|
|
|
*
|
|
|
|
* This file pretty much stolen from Linux's mii.h/ethtool.h/phy.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PHY_INTERFACE_H
|
|
|
|
#define _PHY_INTERFACE_H
|
|
|
|
|
2020-07-20 00:15:39 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2018-07-18 04:02:30 +08:00
|
|
|
typedef enum {
|
|
|
|
PHY_INTERFACE_MODE_MII,
|
|
|
|
PHY_INTERFACE_MODE_GMII,
|
|
|
|
PHY_INTERFACE_MODE_SGMII,
|
|
|
|
PHY_INTERFACE_MODE_SGMII_2500,
|
|
|
|
PHY_INTERFACE_MODE_QSGMII,
|
|
|
|
PHY_INTERFACE_MODE_TBI,
|
|
|
|
PHY_INTERFACE_MODE_RMII,
|
|
|
|
PHY_INTERFACE_MODE_RGMII,
|
|
|
|
PHY_INTERFACE_MODE_RGMII_ID,
|
|
|
|
PHY_INTERFACE_MODE_RGMII_RXID,
|
|
|
|
PHY_INTERFACE_MODE_RGMII_TXID,
|
|
|
|
PHY_INTERFACE_MODE_RTBI,
|
2021-05-03 14:08:44 +08:00
|
|
|
PHY_INTERFACE_MODE_1000BASEX,
|
|
|
|
PHY_INTERFACE_MODE_2500BASEX,
|
2018-07-18 04:02:30 +08:00
|
|
|
PHY_INTERFACE_MODE_XGMII,
|
|
|
|
PHY_INTERFACE_MODE_XAUI,
|
|
|
|
PHY_INTERFACE_MODE_RXAUI,
|
|
|
|
PHY_INTERFACE_MODE_SFI,
|
|
|
|
PHY_INTERFACE_MODE_INTERNAL,
|
2018-08-27 17:45:19 +08:00
|
|
|
PHY_INTERFACE_MODE_25G_AUI,
|
|
|
|
PHY_INTERFACE_MODE_XLAUI,
|
|
|
|
PHY_INTERFACE_MODE_CAUI2,
|
|
|
|
PHY_INTERFACE_MODE_CAUI4,
|
2019-06-18 09:37:18 +08:00
|
|
|
PHY_INTERFACE_MODE_NCSI,
|
2021-09-18 20:32:34 +08:00
|
|
|
PHY_INTERFACE_MODE_10GBASER,
|
2019-11-15 00:28:28 +08:00
|
|
|
PHY_INTERFACE_MODE_USXGMII,
|
2022-04-07 06:33:03 +08:00
|
|
|
PHY_INTERFACE_MODE_NA, /* Must be last */
|
2018-07-18 04:02:30 +08:00
|
|
|
|
2022-04-07 06:33:02 +08:00
|
|
|
PHY_INTERFACE_MODE_MAX,
|
2018-07-18 04:02:30 +08:00
|
|
|
} phy_interface_t;
|
|
|
|
|
|
|
|
static const char * const phy_interface_strings[] = {
|
|
|
|
[PHY_INTERFACE_MODE_MII] = "mii",
|
|
|
|
[PHY_INTERFACE_MODE_GMII] = "gmii",
|
|
|
|
[PHY_INTERFACE_MODE_SGMII] = "sgmii",
|
|
|
|
[PHY_INTERFACE_MODE_SGMII_2500] = "sgmii-2500",
|
|
|
|
[PHY_INTERFACE_MODE_QSGMII] = "qsgmii",
|
|
|
|
[PHY_INTERFACE_MODE_TBI] = "tbi",
|
|
|
|
[PHY_INTERFACE_MODE_RMII] = "rmii",
|
|
|
|
[PHY_INTERFACE_MODE_RGMII] = "rgmii",
|
|
|
|
[PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
|
|
|
|
[PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
|
|
|
|
[PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
|
|
|
|
[PHY_INTERFACE_MODE_RTBI] = "rtbi",
|
2021-05-03 14:08:44 +08:00
|
|
|
[PHY_INTERFACE_MODE_1000BASEX] = "1000base-x",
|
|
|
|
[PHY_INTERFACE_MODE_2500BASEX] = "2500base-x",
|
2018-07-18 04:02:30 +08:00
|
|
|
[PHY_INTERFACE_MODE_XGMII] = "xgmii",
|
|
|
|
[PHY_INTERFACE_MODE_XAUI] = "xaui",
|
|
|
|
[PHY_INTERFACE_MODE_RXAUI] = "rxaui",
|
|
|
|
[PHY_INTERFACE_MODE_SFI] = "sfi",
|
|
|
|
[PHY_INTERFACE_MODE_INTERNAL] = "internal",
|
2018-08-27 17:45:19 +08:00
|
|
|
[PHY_INTERFACE_MODE_25G_AUI] = "25g-aui",
|
|
|
|
[PHY_INTERFACE_MODE_XLAUI] = "xlaui4",
|
|
|
|
[PHY_INTERFACE_MODE_CAUI2] = "caui2",
|
|
|
|
[PHY_INTERFACE_MODE_CAUI4] = "caui4",
|
2019-06-18 09:37:18 +08:00
|
|
|
[PHY_INTERFACE_MODE_NCSI] = "NC-SI",
|
2021-09-18 20:32:34 +08:00
|
|
|
[PHY_INTERFACE_MODE_10GBASER] = "10gbase-r",
|
2019-11-15 00:28:28 +08:00
|
|
|
[PHY_INTERFACE_MODE_USXGMII] = "usxgmii",
|
2022-04-07 06:33:03 +08:00
|
|
|
[PHY_INTERFACE_MODE_NA] = "",
|
2018-07-18 04:02:30 +08:00
|
|
|
};
|
|
|
|
|
2020-03-16 21:35:59 +08:00
|
|
|
/* Backplane modes:
|
|
|
|
* are considered a sub-type of phy_interface_t: XGMII
|
|
|
|
* and are specified in "phy-connection-type" with one of the following strings
|
|
|
|
*/
|
|
|
|
static const char * const backplane_mode_strings[] = {
|
|
|
|
"10gbase-kr",
|
|
|
|
"40gbase-kr4",
|
|
|
|
};
|
|
|
|
|
2018-07-18 04:02:30 +08:00
|
|
|
static inline const char *phy_string_for_interface(phy_interface_t i)
|
|
|
|
{
|
|
|
|
/* Default to unknown */
|
2022-04-07 06:33:03 +08:00
|
|
|
if (i > PHY_INTERFACE_MODE_NA)
|
|
|
|
i = PHY_INTERFACE_MODE_NA;
|
2018-07-18 04:02:30 +08:00
|
|
|
|
|
|
|
return phy_interface_strings[i];
|
|
|
|
}
|
|
|
|
|
2020-03-16 21:35:59 +08:00
|
|
|
static inline bool is_backplane_mode(const char *phyconn)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!phyconn)
|
|
|
|
return false;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(backplane_mode_strings); i++) {
|
|
|
|
if (!strcmp(phyconn, backplane_mode_strings[i]))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-07-18 04:02:30 +08:00
|
|
|
#endif /* _PHY_INTERFACE_H */
|