@@ -14,6 +14,8 @@ obj-$(CONFIG_OF_LIVE) += of_access.o of_addr.o
ifndef CONFIG_DM_DEV_READ_INLINE
obj-$(CONFIG_OF_CONTROL) += read.o
endif
-obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o
+ifdef CONFIG_$(SPL_TPL_)OF_LIBFDT
+obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += of_extra.o ofnode.o read_extra.o
+endif
ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG
@@ -43,8 +43,7 @@ static inline bool dev_of_valid(const struct udevice *dev)
return ofnode_valid(dev_ofnode(dev));
}
-#ifndef CONFIG_DM_DEV_READ_INLINE
-
+#if !defined(CONFIG_DM_DEV_READ_INLINE) || CONFIG_IS_ENABLED(OF_PLATDATA)
/**
* dev_read_u32() - read a 32-bit integer from a device's DT property
*
@@ -467,7 +467,7 @@ static int eth_pre_unbind(struct udevice *dev)
static bool eth_dev_get_mac_address(struct udevice *dev, u8 mac[ARP_HLEN])
{
-#if IS_ENABLED(CONFIG_OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL)
const uint8_t *p;
p = dev_read_u8_array_ptr(dev, "mac-address", ARP_HLEN);
These functions cannot work with of-platdata since libfdt is not available. At present when dev_read_...() functions are used it produces error messages about ofnode which is confusing. Adjust the Makefile and header to produce an error message for the actual dev_read...() function which is called. This makes it easier to see what code needs to be converted for use with of-platdata. Signed-off-by: Simon Glass <sjg at chromium.org> --- Changes in v5: None Changes in v4: None Changes in v3: - Fix eth_dev_get_mac_address() call dev_read...() only when available drivers/core/Makefile | 4 +++- include/dm/read.h | 3 +-- net/eth-uclass.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)