aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Anderson2022-03-28 18:14:37 -0400
committerSimon Glass2022-06-28 03:09:51 +0100
commit8b52f237f0f8ae63c930fa8459c39ab87367bad1 (patch)
tree30b5ce956c1f151837c796093b6646c6f00612c4
parent24057fe0a8f70ae872da0a8f4889fe7b8cfa09db (diff)
dm: core: Provide fallbacks for ofnode_conf_read_...
Because fdt_get_config_str et al. were moved/renamed to ofnode_conf_read_str, they now depend on CONFIG_DM as well as CONFIG_OF_CONTROL. Add some fallback implementations, preventing a linker error when CONFIG_SPL_OF_CONTROL and CONFIG_SPL_ENV_IS_IN_MMC are enabled and CONFIG_SPL_DM is disabled. Fixes: 7de8bd03c3 ("treewide: fdt: Move fdt_get_config_... to ofnode_conf_read...") Signed-off-by: Sean Anderson <sean.anderson@seco.com>
-rw-r--r--include/dm/ofnode.h66
1 files changed, 42 insertions, 24 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 2c4d72d77f5..bb60433124b 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1182,6 +1182,33 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value);
int ofnode_set_enabled(ofnode node, bool value);
/**
+ * ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
+ *
+ * This function parses PHY handle from the Ethernet controller's ofnode
+ * (trying all possible PHY handle property names), and returns the PHY ofnode.
+ *
+ * Before this is used, ofnode_phy_is_fixed_link() should be checked first, and
+ * if the result to that is true, this function should not be called.
+ *
+ * @eth_node: ofnode belonging to the Ethernet controller
+ * Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode
+ */
+ofnode ofnode_get_phy_node(ofnode eth_node);
+
+/**
+ * ofnode_read_phy_mode() - Read PHY connection type from a MAC node
+ *
+ * This function parses the "phy-mode" / "phy-connection-type" property and
+ * returns the corresponding PHY interface type.
+ *
+ * @mac_node: ofnode containing the property
+ * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on
+ * error
+ */
+phy_interface_t ofnode_read_phy_mode(ofnode mac_node);
+
+#if CONFIG_IS_ENABLED(DM)
+/**
* ofnode_conf_read_bool() - Read a boolean value from the U-Boot config
*
* This reads a property from the /config node of the devicetree.
@@ -1218,30 +1245,21 @@ int ofnode_conf_read_int(const char *prop_name, int default_val);
*/
const char *ofnode_conf_read_str(const char *prop_name);
-/**
- * ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
- *
- * This function parses PHY handle from the Ethernet controller's ofnode
- * (trying all possible PHY handle property names), and returns the PHY ofnode.
- *
- * Before this is used, ofnode_phy_is_fixed_link() should be checked first, and
- * if the result to that is true, this function should not be called.
- *
- * @eth_node: ofnode belonging to the Ethernet controller
- * Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode
- */
-ofnode ofnode_get_phy_node(ofnode eth_node);
+#else /* CONFIG_DM */
+static inline bool ofnode_conf_read_bool(const char *prop_name)
+{
+ return false;
+}
-/**
- * ofnode_read_phy_mode() - Read PHY connection type from a MAC node
- *
- * This function parses the "phy-mode" / "phy-connection-type" property and
- * returns the corresponding PHY interface type.
- *
- * @mac_node: ofnode containing the property
- * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on
- * error
- */
-phy_interface_t ofnode_read_phy_mode(ofnode mac_node);
+static inline int ofnode_conf_read_int(const char *prop_name, int default_val)
+{
+ return default_val;
+}
+
+static inline const char *ofnode_conf_read_str(const char *prop_name)
+{
+ return NULL;
+}
+#endif /* CONFIG_DM */
#endif