blob: 73f3a3679ceb70cf8eea0663411d270701072f8d [file] [log] [blame]
Joe Hershbergerf5581fb2018-07-17 15:02:30 -05001/* 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
12typedef 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,
Priyanka Jainafaa0cb2018-08-27 15:15:19 +053030 PHY_INTERFACE_MODE_25G_AUI,
31 PHY_INTERFACE_MODE_XLAUI,
32 PHY_INTERFACE_MODE_CAUI2,
33 PHY_INTERFACE_MODE_CAUI4,
Alex Marginean5219f682019-11-14 18:28:28 +020034 PHY_INTERFACE_MODE_XFI,
35 PHY_INTERFACE_MODE_USXGMII,
Joe Hershbergerf5581fb2018-07-17 15:02:30 -050036 PHY_INTERFACE_MODE_NONE, /* Must be last */
37
38 PHY_INTERFACE_MODE_COUNT,
39} phy_interface_t;
40
41static const char * const phy_interface_strings[] = {
42 [PHY_INTERFACE_MODE_MII] = "mii",
43 [PHY_INTERFACE_MODE_GMII] = "gmii",
44 [PHY_INTERFACE_MODE_SGMII] = "sgmii",
45 [PHY_INTERFACE_MODE_SGMII_2500] = "sgmii-2500",
46 [PHY_INTERFACE_MODE_QSGMII] = "qsgmii",
47 [PHY_INTERFACE_MODE_TBI] = "tbi",
48 [PHY_INTERFACE_MODE_RMII] = "rmii",
49 [PHY_INTERFACE_MODE_RGMII] = "rgmii",
50 [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
51 [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
52 [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
53 [PHY_INTERFACE_MODE_RTBI] = "rtbi",
54 [PHY_INTERFACE_MODE_XGMII] = "xgmii",
55 [PHY_INTERFACE_MODE_XAUI] = "xaui",
56 [PHY_INTERFACE_MODE_RXAUI] = "rxaui",
57 [PHY_INTERFACE_MODE_SFI] = "sfi",
58 [PHY_INTERFACE_MODE_INTERNAL] = "internal",
Priyanka Jainafaa0cb2018-08-27 15:15:19 +053059 [PHY_INTERFACE_MODE_25G_AUI] = "25g-aui",
60 [PHY_INTERFACE_MODE_XLAUI] = "xlaui4",
61 [PHY_INTERFACE_MODE_CAUI2] = "caui2",
62 [PHY_INTERFACE_MODE_CAUI4] = "caui4",
Alex Marginean5219f682019-11-14 18:28:28 +020063 [PHY_INTERFACE_MODE_XFI] = "xfi",
64 [PHY_INTERFACE_MODE_USXGMII] = "usxgmii",
Joe Hershbergerf5581fb2018-07-17 15:02:30 -050065 [PHY_INTERFACE_MODE_NONE] = "",
66};
67
68static inline const char *phy_string_for_interface(phy_interface_t i)
69{
70 /* Default to unknown */
71 if (i > PHY_INTERFACE_MODE_NONE)
72 i = PHY_INTERFACE_MODE_NONE;
73
74 return phy_interface_strings[i];
75}
76
77#endif /* _PHY_INTERFACE_H */