aboutsummaryrefslogtreecommitdiff
path: root/include/phy_interface.h
diff options
context:
space:
mode:
authorMarek BehĂșn2022-04-07 00:33:04 +0200
committerRamon Fried2022-04-10 08:44:13 +0300
commitc677fb1e3196e1be1fcbbdb04650eed262708317 (patch)
tree533645f460f73b67a9444c2325083ed35bd6b1dc /include/phy_interface.h
parentffb0f6f488b9eee2822c3c691778a26e1590694c (diff)
phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition
Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition to make it have zero value. This makes it possible (although not encouraged) to test for invalid/nonexistent interface mode with !val instead of val == PHY_INTERFACE_MODE_NA. The comment near the definition says "Must be last", because when the constant was introduced in commit 5f184715ecd3 ("Create PHY Lib for U-Boot"), it was used as the maximum value when interating over the constants. But this is no longer true - we use PHY_INTERFACE_MODE_MAX for that now, and so we can move it. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'include/phy_interface.h')
-rw-r--r--include/phy_interface.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/phy_interface.h b/include/phy_interface.h
index 59e119a6399..ce3b5004ec2 100644
--- a/include/phy_interface.h
+++ b/include/phy_interface.h
@@ -13,6 +13,7 @@
#include <string.h>
typedef enum {
+ PHY_INTERFACE_MODE_NA, /* don't touch */
PHY_INTERFACE_MODE_MII,
PHY_INTERFACE_MODE_GMII,
PHY_INTERFACE_MODE_SGMII,
@@ -39,12 +40,11 @@ typedef enum {
PHY_INTERFACE_MODE_NCSI,
PHY_INTERFACE_MODE_10GBASER,
PHY_INTERFACE_MODE_USXGMII,
- PHY_INTERFACE_MODE_NA, /* Must be last */
-
PHY_INTERFACE_MODE_MAX,
} phy_interface_t;
static const char * const phy_interface_strings[] = {
+ [PHY_INTERFACE_MODE_NA] = "",
[PHY_INTERFACE_MODE_MII] = "mii",
[PHY_INTERFACE_MODE_GMII] = "gmii",
[PHY_INTERFACE_MODE_SGMII] = "sgmii",
@@ -71,7 +71,6 @@ static const char * const phy_interface_strings[] = {
[PHY_INTERFACE_MODE_NCSI] = "NC-SI",
[PHY_INTERFACE_MODE_10GBASER] = "10gbase-r",
[PHY_INTERFACE_MODE_USXGMII] = "usxgmii",
- [PHY_INTERFACE_MODE_NA] = "",
};
/* Backplane modes: