]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
phy: Break include cycle
authorJoe Hershberger <joe.hershberger@ni.com>
Tue, 17 Jul 2018 20:02:30 +0000 (15:02 -0500)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 26 Jul 2018 19:08:22 +0000 (14:08 -0500)
Because some phy wants to export some functions [1], export.h was
including the whole phy subsystem which pulls in lots of stuff that
causes some ordering and redefinition issues. Split out the only part
that is actually needed in export.h and include it there and in phy.h.

[1] commit 95279315076c ("board/ls2085rdb: Export functions for
  standalone AQ FW load apps")

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
include/exports.h
include/phy.h
include/phy_interface.h [new file with mode: 0644]

index ebe81d914cb226256730bece027cc6fceb28dc68..a4b862f19178d561db3d1eda7d27ae5da937bc82 100644 (file)
@@ -3,8 +3,7 @@
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PHY_AQUANTIA
-#include <miiphy.h>
-#include <phy.h>
+#include <phy_interface.h>
 #endif
 
 struct spi_slave;
index 7c3fc5ce40cce94f21ad79da6a8ebcc1e6f84fe8..09645a8ddb0cf26e135cf5cecdececb3084a5ce2 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/mdio.h>
+#include <phy_interface.h>
 
 #define PHY_FIXED_ID           0xa5a55a5a
 
 #endif
 
 
-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,
-       PHY_INTERFACE_MODE_XGMII,
-       PHY_INTERFACE_MODE_XAUI,
-       PHY_INTERFACE_MODE_RXAUI,
-       PHY_INTERFACE_MODE_SFI,
-       PHY_INTERFACE_MODE_INTERNAL,
-       PHY_INTERFACE_MODE_NONE,        /* Must be last */
-
-       PHY_INTERFACE_MODE_COUNT,
-} phy_interface_t;
-
-static const char *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",
-       [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",
-       [PHY_INTERFACE_MODE_NONE]               = "",
-};
-
-static inline const char *phy_string_for_interface(phy_interface_t i)
-{
-       /* Default to unknown */
-       if (i > PHY_INTERFACE_MODE_NONE)
-               i = PHY_INTERFACE_MODE_NONE;
-
-       return phy_interface_strings[i];
-}
-
-
 struct phy_device;
 
 #define MDIO_NAME_LEN 32
diff --git a/include/phy_interface.h b/include/phy_interface.h
new file mode 100644 (file)
index 0000000..0760d65
--- /dev/null
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ *     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
+
+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,
+       PHY_INTERFACE_MODE_XGMII,
+       PHY_INTERFACE_MODE_XAUI,
+       PHY_INTERFACE_MODE_RXAUI,
+       PHY_INTERFACE_MODE_SFI,
+       PHY_INTERFACE_MODE_INTERNAL,
+       PHY_INTERFACE_MODE_NONE,        /* Must be last */
+
+       PHY_INTERFACE_MODE_COUNT,
+} 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",
+       [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",
+       [PHY_INTERFACE_MODE_NONE]               = "",
+};
+
+static inline const char *phy_string_for_interface(phy_interface_t i)
+{
+       /* Default to unknown */
+       if (i > PHY_INTERFACE_MODE_NONE)
+               i = PHY_INTERFACE_MODE_NONE;
+
+       return phy_interface_strings[i];
+}
+
+#endif /* _PHY_INTERFACE_H */