xref: /openbmc/u-boot/include/phy_interface.h (revision d30ba231)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2011 Freescale Semiconductor, Inc.
4  *	Andy Fleming <afleming@gmail.com>
5  *
6  * This file pretty much stolen from Linux's mii.h/ethtool.h/phy.h
7  */
8 
9 #ifndef _PHY_INTERFACE_H
10 #define _PHY_INTERFACE_H
11 
12 typedef enum {
13 	PHY_INTERFACE_MODE_MII,
14 	PHY_INTERFACE_MODE_GMII,
15 	PHY_INTERFACE_MODE_SGMII,
16 	PHY_INTERFACE_MODE_SGMII_2500,
17 	PHY_INTERFACE_MODE_QSGMII,
18 	PHY_INTERFACE_MODE_TBI,
19 	PHY_INTERFACE_MODE_RMII,
20 	PHY_INTERFACE_MODE_RGMII,
21 	PHY_INTERFACE_MODE_RGMII_ID,
22 	PHY_INTERFACE_MODE_RGMII_RXID,
23 	PHY_INTERFACE_MODE_RGMII_TXID,
24 	PHY_INTERFACE_MODE_RTBI,
25 	PHY_INTERFACE_MODE_XGMII,
26 	PHY_INTERFACE_MODE_XAUI,
27 	PHY_INTERFACE_MODE_RXAUI,
28 	PHY_INTERFACE_MODE_SFI,
29 	PHY_INTERFACE_MODE_INTERNAL,
30 	PHY_INTERFACE_MODE_NONE,	/* Must be last */
31 
32 	PHY_INTERFACE_MODE_COUNT,
33 } phy_interface_t;
34 
35 static const char * const phy_interface_strings[] = {
36 	[PHY_INTERFACE_MODE_MII]		= "mii",
37 	[PHY_INTERFACE_MODE_GMII]		= "gmii",
38 	[PHY_INTERFACE_MODE_SGMII]		= "sgmii",
39 	[PHY_INTERFACE_MODE_SGMII_2500]		= "sgmii-2500",
40 	[PHY_INTERFACE_MODE_QSGMII]		= "qsgmii",
41 	[PHY_INTERFACE_MODE_TBI]		= "tbi",
42 	[PHY_INTERFACE_MODE_RMII]		= "rmii",
43 	[PHY_INTERFACE_MODE_RGMII]		= "rgmii",
44 	[PHY_INTERFACE_MODE_RGMII_ID]		= "rgmii-id",
45 	[PHY_INTERFACE_MODE_RGMII_RXID]		= "rgmii-rxid",
46 	[PHY_INTERFACE_MODE_RGMII_TXID]		= "rgmii-txid",
47 	[PHY_INTERFACE_MODE_RTBI]		= "rtbi",
48 	[PHY_INTERFACE_MODE_XGMII]		= "xgmii",
49 	[PHY_INTERFACE_MODE_XAUI]		= "xaui",
50 	[PHY_INTERFACE_MODE_RXAUI]		= "rxaui",
51 	[PHY_INTERFACE_MODE_SFI]		= "sfi",
52 	[PHY_INTERFACE_MODE_INTERNAL]		= "internal",
53 	[PHY_INTERFACE_MODE_NONE]		= "",
54 };
55 
56 static inline const char *phy_string_for_interface(phy_interface_t i)
57 {
58 	/* Default to unknown */
59 	if (i > PHY_INTERFACE_MODE_NONE)
60 		i = PHY_INTERFACE_MODE_NONE;
61 
62 	return phy_interface_strings[i];
63 }
64 
65 #endif /* _PHY_INTERFACE_H */
66