diff options
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/Makefile | 16 | ||||
-rw-r--r-- | drivers/core/ofnode.c | 37 |
2 files changed, 43 insertions, 10 deletions
diff --git a/drivers/core/Makefile b/drivers/core/Makefile index acbd2bf2cef..9ea57911f89 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -3,19 +3,19 @@ # Copyright (c) 2013 Google, Inc obj-y += device.o fdtaddr.o lists.o root.o uclass.o util.o tag.o -obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o -obj-$(CONFIG_$(SPL_TPL_)DEVRES) += devres.o -obj-$(CONFIG_$(SPL_TPL_)DM_DEVICE_REMOVE) += device-remove.o -obj-$(CONFIG_$(SPL_)SIMPLE_BUS) += simple-bus.o +obj-$(CONFIG_$(PHASE_)ACPIGEN) += acpi.o +obj-$(CONFIG_$(PHASE_)DEVRES) += devres.o +obj-$(CONFIG_$(PHASE_)DM_DEVICE_REMOVE) += device-remove.o +obj-$(CONFIG_$(XPL_)SIMPLE_BUS) += simple-bus.o obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o obj-$(CONFIG_DM) += dump.o -obj-$(CONFIG_$(SPL_TPL_)REGMAP) += regmap.o -obj-$(CONFIG_$(SPL_TPL_)SYSCON) += syscon-uclass.o -obj-$(CONFIG_$(SPL_)OF_LIVE) += of_access.o of_addr.o +obj-$(CONFIG_$(PHASE_)REGMAP) += regmap.o +obj-$(CONFIG_$(PHASE_)SYSCON) += syscon-uclass.o +obj-$(CONFIG_$(XPL_)OF_LIVE) += of_access.o of_addr.o ifndef CONFIG_DM_DEV_READ_INLINE obj-$(CONFIG_OF_CONTROL) += read.o endif -obj-$(CONFIG_$(SPL_)OF_PLATDATA) += read.o +obj-$(CONFIG_$(XPL_)OF_PLATDATA) += read.o obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 7e3b3719d18..48ae8ce830e 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -611,7 +611,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname, out_values, sz); /* get the error right, but space is more important in SPL */ - if (!IS_ENABLED(CONFIG_SPL_BUILD)) { + if (!IS_ENABLED(CONFIG_XPL_BUILD)) { if (ret == -FDT_ERR_NOTFOUND) return -EINVAL; else if (ret == -FDT_ERR_BADLAYOUT) @@ -1468,7 +1468,7 @@ int ofnode_read_simple_size_cells(ofnode node) bool ofnode_pre_reloc(ofnode node) { -#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD) +#if defined(CONFIG_XPL_BUILD) || defined(CONFIG_TPL_BUILD) /* for SPL and TPL the remaining nodes after the fdtgrep 1st pass * had property bootph-all or bootph-pre-sram/bootph-pre-ram. * They are removed in final dtb (fdtgrep 2nd pass) @@ -1735,6 +1735,39 @@ const char *ofnode_conf_read_str(const char *prop_name) return ofnode_read_string(node, prop_name); } +bool ofnode_options_read_bool(const char *prop_name) +{ + ofnode uboot; + + uboot = ofnode_path("/options/u-boot"); + if (!ofnode_valid(uboot)) + return false; + + return ofnode_read_bool(uboot, prop_name); +} + +int ofnode_options_read_int(const char *prop_name, int default_val) +{ + ofnode uboot; + + uboot = ofnode_path("/options/u-boot"); + if (!ofnode_valid(uboot)) + return default_val; + + return ofnode_read_u32_default(uboot, prop_name, default_val); +} + +const char *ofnode_options_read_str(const char *prop_name) +{ + ofnode uboot; + + uboot = ofnode_path("/options/u-boot"); + if (!ofnode_valid(uboot)) + return NULL; + + return ofnode_read_string(uboot, prop_name); +} + int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset) { int ret; |