From 7de8bd03c37af6120cf5bba9bf1adb492ed56868 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:01 -0600 Subject: treewide: fdt: Move fdt_get_config_... to ofnode_conf_read... The current API is outdated as it requires a devicetree pointer. Move these functions to use the ofnode API and update this globally. Add some tests while we are here. Correct the call in exynos_dsim_config_parse_dt() which is obviously wrong. Signed-off-by: Simon Glass --- arch/arm/mach-rockchip/rk3188/rk3188.c | 4 +-- arch/sandbox/dts/test.dts | 3 ++ arch/x86/cpu/coreboot/coreboot.c | 5 ++- board/dhelectronics/dh_stm32mp1/board.c | 5 +-- board/firefly/firefly-rk3288/firefly-rk3288.c | 4 +-- board/st/stm32mp1/stm32mp1.c | 5 +-- common/autoboot.c | 8 ++--- common/board_r.c | 4 +-- common/cli.c | 7 ++--- common/spl/spl_spi.c | 8 ++--- disk/part_efi.c | 8 ++--- doc/device-tree-bindings/config.txt | 4 +-- drivers/core/ofnode.c | 33 ++++++++++++++++++++ drivers/video/cfb_console.c | 4 +-- drivers/video/exynos/exynos_mipi_dsi.c | 4 +-- env/mmc.c | 5 +-- include/dm/ofnode.h | 37 ++++++++++++++++++++++ include/fdtdec.h | 33 -------------------- lib/fdtdec.c | 44 --------------------------- test/dm/ofnode.c | 15 +++++++++ 20 files changed, 124 insertions(+), 116 deletions(-) diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c index ad8c6cd..5a02914 100644 --- a/arch/arm/mach-rockchip/rk3188/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define GRF_BASE 0x20008000 @@ -107,7 +108,6 @@ int rk_board_late_init(void) } #ifdef CONFIG_SPL_BUILD -DECLARE_GLOBAL_DATA_PTR; static int setup_led(void) { #ifdef CONFIG_SPL_LED @@ -115,7 +115,7 @@ static int setup_led(void) char *led_name; int ret; - led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led"); + led_name = ofnode_conf_read_str("u-boot,boot-led"); if (!led_name) return 0; ret = led_get_by_label(led_name, &dev); diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index b36447c..2dfae1c 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -62,6 +62,9 @@ }; config { + testing-bool; + testing-int = <123>; + testing-str = "testing"; environment { from_fdt = "yes"; fdt_env_path = ""; diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 69cf8f4..aaa5ae1 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -16,8 +16,7 @@ #include #include #include - -DECLARE_GLOBAL_DATA_PTR; +#include int arch_cpu_init(void) { @@ -65,7 +64,7 @@ static void board_final_init(void) mtrr_close(&state, true); } - if (!fdtdec_get_config_bool(gd->fdt_blob, "u-boot,no-apm-finalize")) { + if (!ofnode_conf_read_bool("u-boot,no-apm-finalize")) { /* * Issue SMI to coreboot to lock down ME and registers * when allowed via device tree diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index d7c1857..4b3167f 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "../../st/common/stpmic1.h" /* SYSCFG registers */ @@ -382,10 +383,10 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) #ifdef CONFIG_LED static int get_led(struct udevice **dev, char *led_string) { - char *led_name; + const char *led_name; int ret; - led_name = fdtdec_get_config_string(gd->fdt_blob, led_string); + led_name = ofnode_conf_read_str(led_string); if (!led_name) { pr_debug("%s: could not find %s config string\n", __func__, led_string); diff --git a/board/firefly/firefly-rk3288/firefly-rk3288.c b/board/firefly/firefly-rk3288/firefly-rk3288.c index 41c49e5..95d8b00 100644 --- a/board/firefly/firefly-rk3288/firefly-rk3288.c +++ b/board/firefly/firefly-rk3288/firefly-rk3288.c @@ -8,9 +8,9 @@ #include #include #include +#include #ifdef CONFIG_SPL_BUILD -DECLARE_GLOBAL_DATA_PTR; static int setup_led(void) { #ifdef CONFIG_SPL_LED @@ -18,7 +18,7 @@ static int setup_led(void) char *led_name; int ret; - led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led"); + led_name = ofnode_conf_read_str("u-boot,boot-led"); if (!led_name) return 0; ret = led_get_by_label(led_name, &dev); diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 032f08d..1d4d7b4 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -235,10 +236,10 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) static int get_led(struct udevice **dev, char *led_string) { - char *led_name; + const char *led_name; int ret; - led_name = fdtdec_get_config_string(gd->fdt_blob, led_string); + led_name = ofnode_conf_read_str(led_string); if (!led_name) { log_debug("could not find %s config string\n", led_string); return -ENOENT; diff --git a/common/autoboot.c b/common/autoboot.c index 5bb2e19..6251c68 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -24,6 +24,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -424,12 +425,12 @@ static void process_fdt_options(const void *blob) ulong addr; /* Add an env variable to point to a kernel payload, if available */ - addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0); + addr = ofnode_conf_read_int("kernel-offset", 0); if (addr) env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); /* Add an env variable to point to a root disk, if available */ - addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); + addr = ofnode_conf_read_int("rootdisk-offset", 0); if (addr) env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); #endif /* CONFIG_SYS_TEXT_BASE */ @@ -446,8 +447,7 @@ const char *bootdelay_process(void) bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; if (IS_ENABLED(CONFIG_OF_CONTROL)) - bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay", - bootdelay); + bootdelay = ofnode_conf_read_int("bootdelay", bootdelay); debug("### main_loop entered: bootdelay=%d\n\n", bootdelay); diff --git a/common/board_r.c b/common/board_r.c index 0cbe5f7..31a59c5 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -67,6 +67,7 @@ #endif #include #include +#include #include #include #include @@ -448,8 +449,7 @@ static int initr_pvblock(void) static int should_load_env(void) { if (IS_ENABLED(CONFIG_OF_CONTROL)) - return fdtdec_get_config_int(gd->fdt_blob, - "load-environment", 1); + return ofnode_conf_read_int("load-environment", 1); if (IS_ENABLED(CONFIG_DELAY_ENVIRONMENT)) return 0; diff --git a/common/cli.c b/common/cli.c index 048eacb..d86046a 100644 --- a/common/cli.c +++ b/common/cli.c @@ -19,8 +19,7 @@ #include #include #include - -DECLARE_GLOBAL_DATA_PTR; +#include #ifdef CONFIG_CMDLINE /* @@ -157,7 +156,7 @@ int do_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bool cli_process_fdt(const char **cmdp) { /* Allow the fdt to override the boot command */ - char *env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); + const char *env = ofnode_conf_read_str("bootcmd"); if (env) *cmdp = env; /* @@ -165,7 +164,7 @@ bool cli_process_fdt(const char **cmdp) * Always use 'env' in this case, since bootsecure requres that the * bootcmd was specified in the FDT too. */ - return fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0) != 0; + return ofnode_conf_read_int("bootsecure", 0); } /* diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 9884e7c..f92ce37 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -16,8 +16,7 @@ #include #include #include - -DECLARE_GLOBAL_DATA_PTR; +#include #ifdef CONFIG_SPL_OS_BOOT /* @@ -104,9 +103,8 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) - payload_offs = fdtdec_get_config_int(gd->fdt_blob, - "u-boot,spl-payload-offset", - payload_offs); + payload_offs = ofnode_conf_read_int("u-boot,spl-payload-offset", + payload_offs); #endif #ifdef CONFIG_SPL_OS_BOOT diff --git a/disk/part_efi.c b/disk/part_efi.c index fdca91a..0ca7eff 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -23,12 +23,11 @@ #include #include #include +#include #include #include #include -DECLARE_GLOBAL_DATA_PTR; - #ifdef CONFIG_HAVE_BLOCK_DEVICE /* GUID for basic data partitons */ @@ -563,9 +562,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc) * from the start of the device) to be specified as a property * of the device tree '/config' node. */ - config_offset = fdtdec_get_config_int(gd->fdt_blob, - "u-boot,efi-partition-entries-offset", - -EINVAL); + config_offset = ofnode_conf_read_int( + "u-boot,efi-partition-entries-offset", -EINVAL); if (config_offset != -EINVAL) { offset_bytes = PAD_TO_BLOCKSIZE(config_offset, dev_desc); offset_blks = offset_bytes / dev_desc->blksz; diff --git a/doc/device-tree-bindings/config.txt b/doc/device-tree-bindings/config.txt index 85379fb..3151778 100644 --- a/doc/device-tree-bindings/config.txt +++ b/doc/device-tree-bindings/config.txt @@ -2,8 +2,8 @@ The /config node (Configuration Options) ---------------------------------------- A number of run-time configuration options are provided in the /config node -of the control device tree. You can access these using fdtdec_get_config_int(), -fdtdec_get_config_bool() and fdtdec_get_config_string(). +of the control device tree. You can access these using ofnode_conf_read_int(), +ofnode_conf_read_bool() and ofnode_conf_read_str(). These options are designed to affect the operation of U-Boot at runtime. Runtime-configuration items can help avoid proliferation of different builds diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 701b23e..08705ef 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -1103,3 +1103,36 @@ int ofnode_set_enabled(ofnode node, bool value) else return ofnode_write_string(node, "status", "disabled"); } + +bool ofnode_conf_read_bool(const char *prop_name) +{ + ofnode node; + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) + return false; + + return ofnode_read_bool(node, prop_name); +} + +int ofnode_conf_read_int(const char *prop_name, int default_val) +{ + ofnode node; + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) + return default_val; + + return ofnode_read_u32_default(node, prop_name, default_val); +} + +const char *ofnode_conf_read_str(const char *prop_name) +{ + ofnode node; + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) + return NULL; + + return ofnode_read_string(node, prop_name); +} diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 830ea80..566fc1e 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #if defined(CONFIG_VIDEO_MXS) @@ -2137,8 +2138,7 @@ int drv_video_init(void) #if defined(CONFIG_VGA_AS_SINGLE_DEVICE) have_keyboard = false; #elif defined(CONFIG_OF_CONTROL) - have_keyboard = !fdtdec_get_config_bool(gd->fdt_blob, - "u-boot,no-keyboard"); + have_keyboard = !ofnode_conf_read_bool("u-boot,no-keyboard"); #else have_keyboard = true; #endif diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index c56eadc..804fcd0 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -288,8 +288,8 @@ int exynos_dsim_config_parse_dt(const void *blob, struct mipi_dsim_config *dt, dt->rx_timeout = fdtdec_get_int(blob, node, "samsung,dsim-config-rx-timeout", 0); - lcd_dt->name = fdtdec_get_config_string(blob, - "samsung,dsim-device-name"); + lcd_dt->name = fdt_getprop(blob, node, "samsung,dsim-device-name", + NULL); lcd_dt->id = fdtdec_get_int(blob, node, "samsung,dsim-device-id", 0); diff --git a/env/mmc.c b/env/mmc.c index 09e94f0..c4cb163 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -19,6 +19,7 @@ #include #include #include +#include #define __STR(X) #X #define STR(X) __STR(X) @@ -73,7 +74,7 @@ static inline s64 mmc_offset(int copy) int err; /* look for the partition in mmc CONFIG_SYS_MMC_ENV_DEV */ - str = fdtdec_get_config_string(gd->fdt_blob, dt_prop.partition); + str = ofnode_conf_read_str(dt_prop.partition); if (str) { /* try to place the environment at end of the partition */ err = mmc_offset_try_partition(str, copy, &val); @@ -90,7 +91,7 @@ static inline s64 mmc_offset(int copy) propname = dt_prop.offset_redund; } #endif - return fdtdec_get_config_int(gd->fdt_blob, propname, defvalue); + return ofnode_conf_read_int(propname, defvalue); } #else static inline s64 mmc_offset(int copy) diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 4e1a844..6a714d0 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -1117,4 +1117,41 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value); */ int ofnode_set_enabled(ofnode node, bool value); +/** + * ofnode_conf_read_bool() - Read a boolean value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name property name to look up + * @return true, if it exists, false if not + */ +bool ofnode_conf_read_bool(const char *prop_name); + +/** + * ofnode_conf_read_int() - Read an integer value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name: property name to look up + * @default_val: default value to return if the property is not found + * @return integer value, if found, or @default_val if not + */ +int ofnode_conf_read_int(const char *prop_name, int default_val); + +/** + * ofnode_conf_read_str() - Read a string value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name: property name to look up + * @return string value, if found, or NULL if not + */ +const char *ofnode_conf_read_str(const char *prop_name); + #endif diff --git a/include/fdtdec.h b/include/fdtdec.h index 8ac20c9..23efbe7 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -746,39 +746,6 @@ int fdtdec_get_bool(const void *blob, int node, const char *prop_name); */ int fdtdec_get_child_count(const void *blob, int node); -/** - * Look in the FDT for a config item with the given name and return its value - * as a 32-bit integer. The property must have at least 4 bytes of data. The - * value of the first cell is returned. - * - * @param blob FDT blob to use - * @param prop_name Node property name - * @param default_val default value to return if the property is not found - * @return integer value, if found, or default_val if not - */ -int fdtdec_get_config_int(const void *blob, const char *prop_name, - int default_val); - -/** - * Look in the FDT for a config item with the given name - * and return whether it exists. - * - * @param blob FDT blob - * @param prop_name property name to look up - * @return 1, if it exists, or 0 if not - */ -int fdtdec_get_config_bool(const void *blob, const char *prop_name); - -/** - * Look in the FDT for a config item with the given name and return its value - * as a string. - * - * @param blob FDT blob - * @param prop_name property name to look up - * @returns property string, NULL on error. - */ -char *fdtdec_get_config_string(const void *blob, const char *prop_name); - /* * Look up a property in a node and return its contents in a byte * array of given length. The property must have at least enough data for diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 7358cb6..af92e65 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -870,50 +870,6 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node, return cell; } -int fdtdec_get_config_int(const void *blob, const char *prop_name, - int default_val) -{ - int config_node; - - debug("%s: %s\n", __func__, prop_name); - config_node = fdt_path_offset(blob, "/config"); - if (config_node < 0) - return default_val; - return fdtdec_get_int(blob, config_node, prop_name, default_val); -} - -int fdtdec_get_config_bool(const void *blob, const char *prop_name) -{ - int config_node; - const void *prop; - - debug("%s: %s\n", __func__, prop_name); - config_node = fdt_path_offset(blob, "/config"); - if (config_node < 0) - return 0; - prop = fdt_get_property(blob, config_node, prop_name, NULL); - - return prop != NULL; -} - -char *fdtdec_get_config_string(const void *blob, const char *prop_name) -{ - const char *nodep; - int nodeoffset; - int len; - - debug("%s: %s\n", __func__, prop_name); - nodeoffset = fdt_path_offset(blob, "/config"); - if (nodeoffset < 0) - return NULL; - - nodep = fdt_getprop(blob, nodeoffset, prop_name, &len); - if (!nodep) - return NULL; - - return (char *)nodep; -} - u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells) { u64 number = 0; diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 44e51de..49efabe 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -318,3 +318,18 @@ static int dm_test_ofnode_get_path(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_get_path, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +static int dm_test_ofnode_conf(struct unit_test_state *uts) +{ + ut_assert(!ofnode_conf_read_bool("missing")); + ut_assert(ofnode_conf_read_bool("testing-bool")); + + ut_asserteq(123, ofnode_conf_read_int("testing-int", 0)); + ut_asserteq(6, ofnode_conf_read_int("missing", 6)); + + ut_assertnull(ofnode_conf_read_str("missing")); + ut_asserteq_str("testing", ofnode_conf_read_str("testing-str")); + + return 0; +} +DM_TEST(dm_test_ofnode_conf, 0); -- cgit v1.1 From eaad01a3d018a8a5b1003ab2d28e9e23e2b2db3f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:02 -0600 Subject: fdt: Create a new OF_REAL Kconfig The condition to indicate whether there is a runtime devicetree available is OF_CONTROL && !OF_PLATDATA. This is a bit unweidly and is repeated in a lot of places. Add a new OF_REAL Kconfig which provides this information directly. Note: This is similar in effect to LIBFDT. We might consider dropping LIBFDT and using this instead, but this is left for now as we also have OF_LIBFDT_OVERLAY which it would not make sense to change. Signed-off-by: Simon Glass --- dts/Kconfig | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/dts/Kconfig b/dts/Kconfig index dabe008..d853aaa 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -48,6 +48,14 @@ config OF_CONTROL This feature provides for run-time configuration of U-Boot via a flattened device tree. +config OF_REAL + def_bool y + help + Indicates that a real devicetree is available which can be accessed + at runtime. This means that dev_read_...() functions can be used to + read data from the devicetree for each device. This is true if + OF_CONTROL is enabled in U-Boot proper. + config OF_BOARD_FIXUP bool "Board-specific manipulation of Device Tree" help @@ -62,6 +70,7 @@ config SPL_OF_CONTROL bool "Enable run-time configuration via Device Tree in SPL" depends on SPL && OF_CONTROL select SPL_OF_LIBFDT if !SPL_OF_PLATDATA + select SPL_OF_REAL if !SPL_OF_PLATDATA help Some boards use device tree in U-Boot but only have 4KB of SRAM which is not enough to support device tree. Disable this option to @@ -71,6 +80,7 @@ config TPL_OF_CONTROL bool "Enable run-time configuration via Device Tree in TPL" depends on TPL && OF_CONTROL select TPL_OF_LIBFDT if !TPL_OF_PLATDATA + select TPL_OF_REAL if !TPL_OF_PLATDATA help Some boards use device tree in U-Boot but only have 4KB of SRAM which is not enough to support device tree. Enable this option to @@ -236,7 +246,7 @@ config MULTI_DTB_FIT config SPL_MULTI_DTB_FIT - depends on SPL_LOAD_FIT && SPL_OF_CONTROL && !SPL_OF_PLATDATA + depends on SPL_LOAD_FIT && SPL_OF_REAL bool "Support embedding several DTBs in a FIT image for the SPL" help This option provides the SPL with the ability to select its own @@ -374,6 +384,14 @@ config SPL_OF_PLATDATA compatible string, then adding platform data and U_BOOT_DRVINFO declarations for each node. See of-plat.txt for more information. +config SPL_OF_REAL + bool + help + Indicates that a real devicetree is available which can be accessed + at runtime. This means that dev_read_...() functions can be used to + read data from the devicetree for each device. This is true if + SPL_OF_CONTROL is enabled and not SPL_OF_PLATDATA + if SPL_OF_PLATDATA config SPL_OF_PLATDATA_PARENT @@ -421,6 +439,14 @@ config SPL_OF_PLATDATA_DRIVER_RT endif +config TPL_OF_REAL + bool + help + Indicates that a real devicetree is available which can be accessed + at runtime. This means that dev_read_...() functions can be used to + read data from the devicetree for each device. This is true if + TPL_OF_CONTROL is enabled and not TPL_OF_PLATDATA + config TPL_OF_PLATDATA bool "Generate platform data for use in TPL" depends on TPL_OF_CONTROL -- cgit v1.1 From 414cc15144f69b66d12aa8881192e34862bc6042 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:03 -0600 Subject: treewide: Simply conditions with the new OF_REAL Use this new Kconfig to simplify the compilation conditions where appropriate. Signed-off-by: Simon Glass --- arch/x86/lib/lpc-uclass.c | 2 +- common/spl/spl.c | 2 +- common/spl/spl_spi.c | 8 ++++---- drivers/clk/clk-uclass.c | 10 +++++----- drivers/clk/rockchip/clk_px30.c | 4 ++-- drivers/clk/rockchip/clk_rk3288.c | 2 +- drivers/clk/rockchip/clk_rk3308.c | 4 ++-- drivers/clk/rockchip/clk_rk3368.c | 2 +- drivers/clk/rockchip/clk_rk3399.c | 2 +- drivers/core/device.c | 4 ++-- drivers/core/fdtaddr.c | 2 +- drivers/core/lists.c | 2 +- drivers/core/root.c | 4 ++-- drivers/core/uclass.c | 2 +- drivers/firmware/firmware-uclass.c | 2 +- drivers/gpio/mxs_gpio.c | 4 ++-- drivers/gpio/omap_gpio.c | 2 +- drivers/i2c/i2c-uclass.c | 10 +++++----- drivers/i2c/omap24xx_i2c.c | 4 ++-- drivers/misc/misc-uclass.c | 2 +- drivers/mmc/mxsmmc.c | 4 ++-- drivers/mmc/omap_hsmmc.c | 6 +++--- drivers/pch/pch-uclass.c | 2 +- drivers/pinctrl/pinctrl-qe-io.c | 2 +- drivers/power/domain/power-domain-uclass.c | 4 ++-- drivers/serial/ns16550.c | 8 ++++---- drivers/serial/serial_omap.c | 6 +++--- drivers/spi/cf_spi.c | 4 ++-- drivers/spi/davinci_spi.c | 4 ++-- drivers/spi/fsl_espi.c | 4 ++-- drivers/spi/mxs_spi.c | 4 ++-- drivers/spi/omap3_spi.c | 4 ++-- drivers/spi/spi-uclass.c | 2 +- drivers/tpm/tpm-uclass.c | 2 +- dts/Kconfig | 3 ++- include/clk.h | 4 +--- include/dm/device.h | 2 +- include/power-domain.h | 6 ++---- 38 files changed, 71 insertions(+), 74 deletions(-) diff --git a/arch/x86/lib/lpc-uclass.c b/arch/x86/lib/lpc-uclass.c index 1302a6e..67b931d 100644 --- a/arch/x86/lib/lpc-uclass.c +++ b/arch/x86/lib/lpc-uclass.c @@ -10,7 +10,7 @@ UCLASS_DRIVER(lpc) = { .id = UCLASS_LPC, .name = "lpc", -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/common/spl/spl.c b/common/spl/spl.c index 31516e1..ed94d51 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -489,7 +489,7 @@ static int spl_common_init(bool setup_malloc) return ret; } #endif - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { + if (CONFIG_IS_ENABLED(OF_REAL)) { ret = fdtdec_setup(); if (ret) { debug("fdtdec_setup() returned error %d\n", ret); diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index f92ce37..46ee405 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -102,10 +102,10 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) - payload_offs = ofnode_conf_read_int("u-boot,spl-payload-offset", - payload_offs); -#endif + if (CONFIG_IS_ENABLED(OF_REAL)) { + payload_offs = ofnode_conf_read_int("u-boot,spl-payload-offset", + payload_offs); + } #ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header)) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index cea38a4..7b1ea07 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -35,8 +35,7 @@ struct clk *dev_get_clk_ptr(struct udevice *dev) return (struct clk *)dev_get_uclass_priv(dev); } -#if CONFIG_IS_ENABLED(OF_CONTROL) -# if CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_PLATDATA) int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, struct clk *clk) { @@ -49,7 +48,9 @@ int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, return 0; } -# else +#endif + +#if CONFIG_IS_ENABLED(OF_REAL) static int clk_of_xlate_default(struct clk *clk, struct ofnode_phandle_args *args) { @@ -412,7 +413,6 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk) return clk_get_by_index(dev, index, clk); } -# endif /* OF_PLATDATA */ int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk) { @@ -465,7 +465,7 @@ int clk_release_all(struct clk *clk, int count) return 0; } -#endif /* OF_CONTROL */ +#endif /* OF_REAL */ int clk_request(struct udevice *dev, struct clk *clk) { diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c index a49b6f1..617ce0d 100644 --- a/drivers/clk/rockchip/clk_px30.c +++ b/drivers/clk/rockchip/clk_px30.c @@ -1367,7 +1367,7 @@ static ulong px30_clk_set_rate(struct clk *clk, ulong rate) return ret; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int px30_gmac_set_parent(struct clk *clk, struct clk *parent) { struct px30_clk_priv *priv = dev_get_priv(clk->dev); @@ -1418,7 +1418,7 @@ static int px30_clk_enable(struct clk *clk) static struct clk_ops px30_clk_ops = { .get_rate = px30_clk_get_rate, .set_rate = px30_clk_set_rate, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .set_parent = px30_clk_set_parent, #endif .enable = px30_clk_enable, diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index 221a5bd..e61bd6f 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -950,7 +950,7 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par static struct clk_ops rk3288_clk_ops = { .get_rate = rk3288_clk_get_rate, .set_rate = rk3288_clk_set_rate, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .set_parent = rk3288_clk_set_parent, #endif }; diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c index 5248e59..2876643 100644 --- a/drivers/clk/rockchip/clk_rk3308.c +++ b/drivers/clk/rockchip/clk_rk3308.c @@ -939,7 +939,7 @@ static ulong rk3308_clk_set_rate(struct clk *clk, ulong rate) return ret; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int __maybe_unused rk3308_mac_set_parent(struct clk *clk, struct clk *parent) { struct rk3308_clk_priv *priv = dev_get_priv(clk->dev); @@ -976,7 +976,7 @@ static int __maybe_unused rk3308_clk_set_parent(struct clk *clk, struct clk *par static struct clk_ops rk3308_clk_ops = { .get_rate = rk3308_clk_get_rate, .set_rate = rk3308_clk_set_rate, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .set_parent = rk3308_clk_set_parent, #endif }; diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index 698fc3f..a0887b5 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -574,7 +574,7 @@ static int __maybe_unused rk3368_clk_set_parent(struct clk *clk, struct clk *par static struct clk_ops rk3368_clk_ops = { .get_rate = rk3368_clk_get_rate, .set_rate = rk3368_clk_set_rate, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .set_parent = rk3368_clk_set_parent, #endif }; diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index f8cbda4..75b6fbf 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1289,7 +1289,7 @@ static int rk3399_clk_disable(struct clk *clk) static struct clk_ops rk3399_clk_ops = { .get_rate = rk3399_clk_get_rate, .set_rate = rk3399_clk_set_rate, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .set_parent = rk3399_clk_set_parent, #endif .enable = rk3399_clk_enable, diff --git a/drivers/core/device.c b/drivers/core/device.c index 29668f6..42ba2dc 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -670,7 +670,7 @@ static int device_get_device_tail(struct udevice *dev, int ret, return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /** * device_find_by_ofnode() - Return device associated with given ofnode * @@ -1074,7 +1074,7 @@ void dev_set_uclass_plat(struct udevice *dev, void *uclass_plat) dev->uclass_plat_ = uclass_plat; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) bool device_is_compatible(const struct udevice *dev, const char *compat) { return ofnode_device_is_compatible(dev_ofnode(dev), compat); diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 4ffbd6b..6dfda20 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR; fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index) { -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) fdt_addr_t addr; if (CONFIG_IS_ENABLED(OF_TRANSLATE)) { diff --git a/drivers/core/lists.c b/drivers/core/lists.c index e214306..350b9d3 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -154,7 +154,7 @@ int device_bind_driver_to_node(struct udevice *parent, const char *drv_name, return ret; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /** * driver_check_compatible() - Check if a driver matches a compatible string * diff --git a/drivers/core/root.c b/drivers/core/root.c index 78eee08..fecdcb5 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -245,7 +245,7 @@ int dm_scan_plat(bool pre_reloc_only) return ret; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /** * dm_scan_fdt_node() - Scan the device tree and bind drivers for a node * @@ -372,7 +372,7 @@ static int dm_scan(bool pre_reloc_only) return ret; } - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { + if (CONFIG_IS_ENABLED(OF_REAL)) { ret = dm_extended_scan(pre_reloc_only); if (ret) { debug("dm_extended_scan() failed: %d\n", ret); diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 3146dfd..c5a5095 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -397,7 +397,7 @@ done: return ret; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, const char *name, struct udevice **devp) { diff --git a/drivers/firmware/firmware-uclass.c b/drivers/firmware/firmware-uclass.c index bfaf283..e83a147 100644 --- a/drivers/firmware/firmware-uclass.c +++ b/drivers/firmware/firmware-uclass.c @@ -9,7 +9,7 @@ UCLASS_DRIVER(firmware) = { .id = UCLASS_FIRMWARE, .name = "firmware", -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index 7b9d88a..1356f89 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -262,7 +262,7 @@ static int mxs_gpio_probe(struct udevice *dev) return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int mxs_of_to_plat(struct udevice *dev) { struct mxs_gpio_plat *plat = dev_get_plat(dev); @@ -301,7 +301,7 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = { .probe = mxs_gpio_probe, .priv_auto = sizeof(struct mxs_gpio_priv), .plat_auto = sizeof(struct mxs_gpio_plat), -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = mxs_gpio_ids, .of_to_plat = mxs_of_to_plat, #endif diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index 316a28e..eee3645 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -336,7 +336,7 @@ static int omap_gpio_bind(struct udevice *dev) } #endif -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id omap_gpio_ids[] = { { .compatible = "ti,omap3-gpio" }, { .compatible = "ti,omap4-gpio" }, diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index db1c9d9..71bc2b5 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -633,7 +633,7 @@ int i2c_deblock(struct udevice *bus) return ops->deblock(bus); } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip) { int addr; @@ -655,7 +655,7 @@ int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip) static int i2c_pre_probe(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev); unsigned int max = 0; ofnode node; @@ -678,7 +678,7 @@ static int i2c_pre_probe(struct udevice *dev) static int i2c_post_probe(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev); i2c->speed_hz = dev_read_u32_default(dev, "clock-frequency", @@ -692,7 +692,7 @@ static int i2c_post_probe(struct udevice *dev) static int i2c_child_post_bind(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct dm_i2c_chip *plat = dev_get_parent_plat(dev); if (!dev_has_ofnode(dev)) @@ -709,7 +709,7 @@ static int i2c_post_bind(struct udevice *dev) debug("%s: %s, seq=%d\n", __func__, dev->name, dev_seq(dev)); -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) ret = dm_scan_fdt_dev(dev); #endif return ret; diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index e2c8c00..a767dee 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -1034,7 +1034,7 @@ static int omap_i2c_probe(struct udevice *bus) return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int omap_i2c_of_to_plat(struct udevice *bus) { struct omap_i2c_plat *plat = dev_get_plat(bus); @@ -1063,7 +1063,7 @@ static const struct dm_i2c_ops omap_i2c_ops = { U_BOOT_DRIVER(i2c_omap) = { .name = "i2c_omap", .id = UCLASS_I2C, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = omap_i2c_ids, .of_to_plat = omap_i2c_of_to_plat, .plat_auto = sizeof(struct omap_i2c_plat), diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c index 72720b0..cbfacc3 100644 --- a/drivers/misc/misc-uclass.c +++ b/drivers/misc/misc-uclass.c @@ -70,7 +70,7 @@ int misc_set_enabled(struct udevice *dev, bool val) UCLASS_DRIVER(misc) = { .id = UCLASS_MISC, .name = "misc", -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 8fd4176..35a8e21 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -665,7 +665,7 @@ static const struct dm_mmc_ops mxsmmc_ops = { .set_ios = mxsmmc_set_ios, }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int mxsmmc_of_to_plat(struct udevice *bus) { struct mxsmmc_plat *plat = dev_get_plat(bus); @@ -709,7 +709,7 @@ static const struct udevice_id mxsmmc_ids[] = { U_BOOT_DRIVER(fsl_imx23_mmc) = { .name = "fsl_imx23_mmc", .id = UCLASS_MMC, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = mxsmmc_ids, .of_to_plat = mxsmmc_of_to_plat, #endif diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 306ce0f..d267dc6 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -1891,7 +1891,7 @@ static int omap_hsmmc_get_pinctrl_state(struct mmc *mmc) } #endif -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) #ifdef CONFIG_OMAP54XX __weak const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr) { @@ -2009,7 +2009,7 @@ static int omap_hsmmc_probe(struct udevice *dev) return omap_hsmmc_init_setup(mmc); } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct omap_mmc_of_data dra7_mmc_of_data = { .controller_flags = OMAP_HSMMC_REQUIRE_IODELAY, @@ -2027,7 +2027,7 @@ static const struct udevice_id omap_hsmmc_ids[] = { U_BOOT_DRIVER(omap_hsmmc) = { .name = "omap_hsmmc", .id = UCLASS_MMC, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = omap_hsmmc_ids, .of_to_plat = omap_hsmmc_of_to_plat, .plat_auto = sizeof(struct omap_hsmmc_plat), diff --git a/drivers/pch/pch-uclass.c b/drivers/pch/pch-uclass.c index 7bc2372..af028f9 100644 --- a/drivers/pch/pch-uclass.c +++ b/drivers/pch/pch-uclass.c @@ -66,7 +66,7 @@ int pch_ioctl(struct udevice *dev, ulong req, void *data, int size) UCLASS_DRIVER(pch) = { .id = UCLASS_PCH, .name = "pch", -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/drivers/pinctrl/pinctrl-qe-io.c b/drivers/pinctrl/pinctrl-qe-io.c index e129ab2..dc0be7c 100644 --- a/drivers/pinctrl/pinctrl-qe-io.c +++ b/drivers/pinctrl/pinctrl-qe-io.c @@ -248,7 +248,7 @@ U_BOOT_DRIVER(par_io_pinctrl) = { .of_to_plat = qe_io_of_to_plat, .plat_auto = sizeof(struct qe_io_plat), .ops = &par_io_pinctrl_ops, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .flags = DM_FLAG_PRE_RELOC, #endif }; diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c index 00d1489..33f9206 100644 --- a/drivers/power/domain/power-domain-uclass.c +++ b/drivers/power/domain/power-domain-uclass.c @@ -112,7 +112,7 @@ int power_domain_off(struct power_domain *power_domain) return ops->off(power_domain); } -#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) +#if CONFIG_IS_ENABLED(OF_REAL) static int dev_power_domain_ctrl(struct udevice *dev, bool on) { struct power_domain pd; @@ -162,7 +162,7 @@ int dev_power_domain_off(struct udevice *dev) { return dev_power_domain_ctrl(dev, false); } -#endif +#endif /* OF_REAL */ UCLASS_DRIVER(power_domain) = { .id = UCLASS_POWER_DOMAIN, diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index cc121ee..953c2fb 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -533,7 +533,7 @@ enum { }; #endif -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int ns16550_serial_of_to_plat(struct udevice *dev) { struct ns16550_plat *plat = dev_get_plat(dev); @@ -588,7 +588,7 @@ const struct dm_serial_ops ns16550_serial_ops = { .getinfo = ns16550_serial_getinfo, }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /* * Please consider existing compatible strings before adding a new * one to keep this table compact. Or you may add a generic "ns16550" @@ -602,7 +602,7 @@ static const struct udevice_id ns16550_serial_ids[] = { { .compatible = "snps,dw-apb-uart", .data = PORT_NS16550 }, {} }; -#endif /* OF_CONTROL && !OF_PLATDATA */ +#endif /* OF_REAL */ #if CONFIG_IS_ENABLED(SERIAL_PRESENT) @@ -611,7 +611,7 @@ static const struct udevice_id ns16550_serial_ids[] = { U_BOOT_DRIVER(ns16550_serial) = { .name = "ns16550_serial", .id = UCLASS_SERIAL, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = ns16550_serial_ids, .of_to_plat = ns16550_serial_of_to_plat, .plat_auto = sizeof(struct ns16550_plat), diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index 2b23ece..ee938f6 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -98,7 +98,7 @@ DEBUG_UART_FUNCS #if CONFIG_IS_ENABLED(DM_SERIAL) -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int omap_serial_of_to_plat(struct udevice *dev) { struct ns16550_plat *plat = dev_get_plat(dev); @@ -149,13 +149,13 @@ static const struct udevice_id omap_serial_ids[] = { { .compatible = "ti,am654-uart", }, {} }; -#endif /* OF_CONTROL && !OF_PLATDATA */ +#endif /* OF_REAL */ #if CONFIG_IS_ENABLED(SERIAL_PRESENT) U_BOOT_DRIVER(omap_serial) = { .name = "omap_serial", .id = UCLASS_SERIAL, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = omap_serial_ids, .of_to_plat = omap_serial_of_to_plat, .plat_auto = sizeof(struct ns16550_plat), diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c index 6511c0e..ea23357 100644 --- a/drivers/spi/cf_spi.c +++ b/drivers/spi/cf_spi.c @@ -384,7 +384,7 @@ static int coldfire_spi_probe(struct udevice *bus) return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int coldfire_dspi_of_to_plat(struct udevice *bus) { fdt_addr_t addr; @@ -450,7 +450,7 @@ static const struct dm_spi_ops coldfire_spi_ops = { U_BOOT_DRIVER(coldfire_spi) = { .name = "spi_coldfire", .id = UCLASS_SPI, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = coldfire_spi_ids, .of_to_plat = coldfire_dspi_of_to_plat, .plat_auto = sizeof(struct coldfire_spi_plat), diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 15557a6..0ee6171 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -391,7 +391,7 @@ static int davinci_spi_probe(struct udevice *bus) return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int davinci_ofdata_to_platadata(struct udevice *bus) { struct davinci_spi_plat *plat = dev_get_plat(bus); @@ -418,7 +418,7 @@ static const struct udevice_id davinci_spi_ids[] = { U_BOOT_DRIVER(davinci_spi) = { .name = "davinci_spi", .id = UCLASS_SPI, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = davinci_spi_ids, .of_to_plat = davinci_ofdata_to_platadata, .plat_auto = sizeof(struct davinci_spi_plat), diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 387b547..c7a6926 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -541,7 +541,7 @@ static const struct dm_spi_ops fsl_espi_ops = { .set_mode = fsl_espi_set_mode, }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int fsl_espi_of_to_plat(struct udevice *bus) { fdt_addr_t addr; @@ -572,7 +572,7 @@ static const struct udevice_id fsl_espi_ids[] = { U_BOOT_DRIVER(fsl_espi) = { .name = "fsl_espi", .id = UCLASS_SPI, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = fsl_espi_ids, .of_to_plat = fsl_espi_of_to_plat, #endif diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index d41352a..773e26b 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -440,7 +440,7 @@ static const struct dm_spi_ops mxs_spi_ops = { */ }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int mxs_of_to_plat(struct udevice *bus) { struct mxs_spi_plat *plat = dev_get_plat(bus); @@ -483,7 +483,7 @@ static const struct udevice_id mxs_spi_ids[] = { U_BOOT_DRIVER(fsl_imx23_spi) = { .name = "fsl_imx23_spi", .id = UCLASS_SPI, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = mxs_spi_ids, .of_to_plat = mxs_of_to_plat, #endif diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index c69f8fe..ea38a0f 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -481,7 +481,7 @@ static const struct dm_spi_ops omap3_spi_ops = { */ }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static struct omap2_mcspi_platform_config omap2_pdata = { .regs_offset = 0, }; @@ -516,7 +516,7 @@ U_BOOT_DRIVER(omap3_spi) = { .name = "omap3_spi", .id = UCLASS_SPI, .flags = DM_FLAG_PRE_RELOC, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = omap3_spi_ids, .of_to_plat = omap3_spi_of_to_plat, .plat_auto = sizeof(struct omap3_spi_plat), diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index d867b27..5a2a743 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -531,7 +531,7 @@ UCLASS_DRIVER(spi) = { .id = UCLASS_SPI, .name = "spi", .flags = DM_UC_FLAG_SEQ_ALIAS, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif .post_probe = spi_post_probe, diff --git a/drivers/tpm/tpm-uclass.c b/drivers/tpm/tpm-uclass.c index 35774a6..f67fe10 100644 --- a/drivers/tpm/tpm-uclass.c +++ b/drivers/tpm/tpm-uclass.c @@ -140,7 +140,7 @@ UCLASS_DRIVER(tpm) = { .id = UCLASS_TPM, .name = "tpm", .flags = DM_UC_FLAG_SEQ_ALIAS, -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif .per_device_auto = sizeof(struct tpm_chip_priv), diff --git a/dts/Kconfig b/dts/Kconfig index d853aaa..0cc562c 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -44,12 +44,13 @@ config OF_CONTROL bool "Run-time configuration via Device Tree" select DTC select OF_LIBFDT if !OF_PLATDATA + select OF_REAL if !OF_PLATDATA help This feature provides for run-time configuration of U-Boot via a flattened device tree. config OF_REAL - def_bool y + bool help Indicates that a real devicetree is available which can be accessed at runtime. This means that dev_read_...() functions can be used to diff --git a/include/clk.h b/include/clk.h index f3c88fe..f34401f 100644 --- a/include/clk.h +++ b/include/clk.h @@ -300,9 +300,7 @@ enum clk_defaults_stage { CLK_DEFAULTS_POST_FORCE, }; -#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \ - CONFIG_IS_ENABLED(CLK) - +#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(CLK) /** * clk_set_defaults - Process 'assigned-{clocks/clock-parents/clock-rates}' * properties to configure clocks diff --git a/include/dm/device.h b/include/dm/device.h index ef6241b..68986dd 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -300,7 +300,7 @@ struct udevice_id { ulong data; }; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) #define of_match_ptr(_ptr) (_ptr) #else #define of_match_ptr(_ptr) NULL diff --git a/include/power-domain.h b/include/power-domain.h index 72ff2ff..62ff199 100644 --- a/include/power-domain.h +++ b/include/power-domain.h @@ -162,8 +162,7 @@ static inline int power_domain_off(struct power_domain *power_domain) * * @return 0 if OK, or a negative error code. */ -#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \ - CONFIG_IS_ENABLED(POWER_DOMAIN) +#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN) int dev_power_domain_on(struct udevice *dev); #else static inline int dev_power_domain_on(struct udevice *dev) @@ -179,8 +178,7 @@ static inline int dev_power_domain_on(struct udevice *dev) * * @return 0 if OK, or a negative error code. */ -#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \ - CONFIG_IS_ENABLED(POWER_DOMAIN) +#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN) int dev_power_domain_off(struct udevice *dev); #else static inline int dev_power_domain_off(struct udevice *dev) -- cgit v1.1 From 95397385091da9d0d3acd7e69199ae23114ac22c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:04 -0600 Subject: treewide: Use OF_REAL instead of !OF_PLATDATA Now that we have a 'positive' Kconfig option, use this instead of the negative one, which is harder to understand. Signed-off-by: Simon Glass --- arch/arm/mach-rockchip/rk3399/syscon_rk3399.c | 2 +- arch/arm/mach-rockchip/rk3568/syscon_rk3568.c | 2 +- arch/x86/cpu/apollolake/hostbridge.c | 4 ++-- arch/x86/cpu/apollolake/lpc.c | 2 +- arch/x86/cpu/apollolake/pch.c | 2 +- arch/x86/cpu/apollolake/pmc.c | 4 ++-- arch/x86/cpu/apollolake/uart.c | 2 +- arch/x86/cpu/intel_common/itss.c | 2 +- arch/x86/cpu/intel_common/p2sb.c | 6 +++--- arch/x86/lib/tpl.c | 2 +- board/google/chromebook_coral/coral.c | 2 +- board/sandbox/sandbox.c | 5 ++++- doc/develop/driver-model/of-plat.rst | 2 +- drivers/clk/clk_fixed_factor.c | 2 +- drivers/clk/clk_fixed_rate.c | 2 +- drivers/clk/rockchip/clk_rk3188.c | 2 +- drivers/clk/rockchip/clk_rk3288.c | 2 +- drivers/clk/rockchip/clk_rk3368.c | 2 +- drivers/clk/rockchip/clk_rk3399.c | 4 ++-- drivers/core/simple-bus.c | 2 +- drivers/core/syscon-uclass.c | 2 +- drivers/core/util.c | 2 +- drivers/gpio/gpio-uclass.c | 2 +- drivers/gpio/intel_gpio.c | 2 +- drivers/gpio/omap_gpio.c | 2 +- drivers/i2c/i2c-emul-uclass.c | 2 +- drivers/misc/cros_ec.c | 2 +- drivers/misc/p2sb-uclass.c | 2 +- drivers/mmc/fsl_esdhc_imx.c | 4 ++-- drivers/mmc/ftsdc010_mci.c | 2 +- drivers/mmc/rockchip_dw_mmc.c | 2 +- drivers/pinctrl/intel/pinctrl_apl.c | 4 ++-- drivers/pinctrl/nxp/pinctrl-mxs.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/pinctrl/rockchip/pinctrl-px30.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3036.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3128.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3188.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk322x.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3288.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3308.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3368.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +- drivers/pinctrl/rockchip/pinctrl-rv1108.c | 2 +- drivers/ram/rockchip/dmc-rk3368.c | 2 +- drivers/ram/rockchip/sdram_rk3188.c | 2 +- drivers/ram/rockchip/sdram_rk322x.c | 2 +- drivers/ram/rockchip/sdram_rk3288.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 4 ++-- drivers/ram/rockchip/sdram_rk3399.c | 4 ++-- drivers/rtc/rtc-uclass.c | 2 +- drivers/serial/sandbox.c | 2 +- drivers/serial/serial_mt7620.c | 4 ++-- drivers/spi/ich.c | 6 +++--- drivers/spi/pl022_spi.c | 4 ++-- drivers/spi/rk_spi.c | 2 +- drivers/spi/spi-uclass.c | 6 +++--- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/timer/rockchip_timer.c | 4 ++-- drivers/timer/timer-uclass.c | 4 ++-- drivers/timer/tsc_timer.c | 2 +- include/dm/device.h | 10 +++++----- 63 files changed, 87 insertions(+), 84 deletions(-) diff --git a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c index b360ca7..2b5746c 100644 --- a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c @@ -21,7 +21,7 @@ static const struct udevice_id rk3399_syscon_ids[] = { U_BOOT_DRIVER(syscon_rk3399) = { .name = "rk3399_syscon", .id = UCLASS_SYSCON, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .of_match = rk3399_syscon_ids, diff --git a/arch/arm/mach-rockchip/rk3568/syscon_rk3568.c b/arch/arm/mach-rockchip/rk3568/syscon_rk3568.c index 20adfd1..5407e78 100644 --- a/arch/arm/mach-rockchip/rk3568/syscon_rk3568.c +++ b/arch/arm/mach-rockchip/rk3568/syscon_rk3568.c @@ -18,7 +18,7 @@ U_BOOT_DRIVER(syscon_rk3568) = { .name = "rk3568_syscon", .id = UCLASS_SYSCON, .of_match = rk3568_syscon_ids, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif }; diff --git a/arch/x86/cpu/apollolake/hostbridge.c b/arch/x86/cpu/apollolake/hostbridge.c index 9decab7..2405dec 100644 --- a/arch/x86/cpu/apollolake/hostbridge.c +++ b/arch/x86/cpu/apollolake/hostbridge.c @@ -220,7 +220,7 @@ static int apl_hostbridge_of_to_plat(struct udevice *dev) ret = uclass_first_device_err(UCLASS_PINCTRL, &pinctrl); if (ret) return log_msg_ret("no hostbridge PINCTRL", ret); -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int root; /* Get length of PCI Express Region */ @@ -375,7 +375,7 @@ struct acpi_ops apl_hostbridge_acpi_ops = { #endif }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_hostbridge_ids[] = { { .compatible = "intel,apl-hostbridge" }, { } diff --git a/arch/x86/cpu/apollolake/lpc.c b/arch/x86/cpu/apollolake/lpc.c index e085890..4be6366 100644 --- a/arch/x86/cpu/apollolake/lpc.c +++ b/arch/x86/cpu/apollolake/lpc.c @@ -128,7 +128,7 @@ struct acpi_ops apl_lpc_acpi_ops = { .inject_dsdt = southbridge_inject_dsdt, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_lpc_ids[] = { { .compatible = "intel,apl-lpc" }, { } diff --git a/arch/x86/cpu/apollolake/pch.c b/arch/x86/cpu/apollolake/pch.c index 39d6ad5..a0f9b03 100644 --- a/arch/x86/cpu/apollolake/pch.c +++ b/arch/x86/cpu/apollolake/pch.c @@ -23,7 +23,7 @@ static const struct pch_ops apl_pch_ops = { .set_spi_protect = apl_set_spi_protect, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_pch_ids[] = { { .compatible = "intel,apl-pch" }, { } diff --git a/arch/x86/cpu/apollolake/pmc.c b/arch/x86/cpu/apollolake/pmc.c index 1d21187..163119e 100644 --- a/arch/x86/cpu/apollolake/pmc.c +++ b/arch/x86/cpu/apollolake/pmc.c @@ -107,7 +107,7 @@ int apl_pmc_ofdata_to_uc_plat(struct udevice *dev) struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(dev); struct apl_pmc_plat *plat = dev_get_plat(dev); -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) u32 base[6]; int size; int ret; @@ -206,7 +206,7 @@ static const struct acpi_pmc_ops apl_pmc_ops = { .global_reset_set_enable = apl_global_reset_set_enable, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_pmc_ids[] = { { .compatible = "intel,apl-pmc" }, { } diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uart.c index 876fa59..a936243 100644 --- a/arch/x86/cpu/apollolake/uart.c +++ b/arch/x86/cpu/apollolake/uart.c @@ -123,7 +123,7 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) return 0; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_ns16550_serial_ids[] = { { .compatible = "intel,apl-ns16550" }, { }, diff --git a/arch/x86/cpu/intel_common/itss.c b/arch/x86/cpu/intel_common/itss.c index 1eff030..ec73b3d 100644 --- a/arch/x86/cpu/intel_common/itss.c +++ b/arch/x86/cpu/intel_common/itss.c @@ -213,7 +213,7 @@ static const struct irq_ops itss_ops = { #endif }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id itss_ids[] = { { .compatible = "intel,itss", .data = X86_IRQT_ITSS }, { } diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c index d73ae43..5dc8163 100644 --- a/arch/x86/cpu/intel_common/p2sb.c +++ b/arch/x86/cpu/intel_common/p2sb.c @@ -88,7 +88,7 @@ int p2sb_of_to_plat(struct udevice *dev) struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev); struct p2sb_plat *plat = dev_get_plat(dev); -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int ret; u32 base[2]; @@ -159,7 +159,7 @@ static int p2sb_remove(struct udevice *dev) static int p2sb_child_post_bind(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); int ret; u32 pid; @@ -177,7 +177,7 @@ static const struct p2sb_ops p2sb_ops = { .set_hide = intel_p2sb_set_hide, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id p2sb_ids[] = { { .compatible = "intel,p2sb" }, { } diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c index b3e5f9c..5b57e53 100644 --- a/arch/x86/lib/tpl.c +++ b/arch/x86/lib/tpl.c @@ -139,7 +139,7 @@ void spl_board_init(void) * for devices, so the TPL BARs continue to be used. Once U-Boot starts it does * the auto allocation (after relocation). */ -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id tpl_fake_pci_ids[] = { { .compatible = "pci-x86" }, { } diff --git a/board/google/chromebook_coral/coral.c b/board/google/chromebook_coral/coral.c index 85cba50..53c5171 100644 --- a/board/google/chromebook_coral/coral.c +++ b/board/google/chromebook_coral/coral.c @@ -300,7 +300,7 @@ struct sysinfo_ops coral_sysinfo_ops = { .get_str = coral_get_str, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id coral_ids[] = { { .compatible = "google,coral" }, { } diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index dcd7345..5d9a945 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -26,7 +26,10 @@ gd_t *gd; #if !CONFIG_IS_ENABLED(OF_PLATDATA) -/* Add a simple GPIO device */ +/* + * Add a simple GPIO device (don't use with of-platdata as it interferes with + * the auto-generated devices) + */ U_BOOT_DRVINFO(gpio_sandbox) = { .name = "sandbox_gpio", }; diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 0bd9787..8b16f55 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -215,7 +215,7 @@ For example: static int mmc_of_to_plat(struct udevice *dev) { - #if !CONFIG_IS_ENABLED(OF_PLATDATA) + #if CONFIG_IS_ENABLED(OF_REAL) /* Decode the devicetree data */ struct mmc_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index e51f94a..04871b4 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -40,7 +40,7 @@ const struct clk_ops clk_fixed_factor_ops = { static int clk_fixed_factor_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int err; struct clk_fixed_factor *ff = to_clk_fixed_factor(dev); diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index 325a9b2..d0f2594 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -32,7 +32,7 @@ void clk_fixed_rate_ofdata_to_plat_(struct udevice *dev, struct clk_fixed_rate *plat) { struct clk *clk = &plat->clk; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency", 0); #endif /* Make fixed rate clock accessible from higher level struct clk */ diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c index 1b62d8d..1751672 100644 --- a/drivers/clk/rockchip/clk_rk3188.c +++ b/drivers/clk/rockchip/clk_rk3188.c @@ -540,7 +540,7 @@ static struct clk_ops rk3188_clk_ops = { static int rk3188_clk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3188_clk_priv *priv = dev_get_priv(dev); priv->cru = dev_read_addr_ptr(dev); diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index e61bd6f..ee22221 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -957,7 +957,7 @@ static struct clk_ops rk3288_clk_ops = { static int rk3288_clk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3288_clk_priv *priv = dev_get_priv(dev); priv->cru = dev_read_addr_ptr(dev); diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index a0887b5..d0d0046 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -596,7 +596,7 @@ static int rk3368_clk_probe(struct udevice *dev) static int rk3368_clk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3368_clk_priv *priv = dev_get_priv(dev); priv->cru = dev_read_addr_ptr(dev); diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 75b6fbf..209c726 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1402,7 +1402,7 @@ static int rk3399_clk_probe(struct udevice *dev) static int rk3399_clk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3399_clk_priv *priv = dev_get_priv(dev); priv->cru = dev_read_addr_ptr(dev); @@ -1614,7 +1614,7 @@ static int rk3399_pmuclk_probe(struct udevice *dev) static int rk3399_pmuclk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3399_pmuclk_priv *priv = dev_get_priv(dev); priv->pmucru = dev_read_addr_ptr(dev); diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index abc55c2..6022e75 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -65,7 +65,7 @@ UCLASS_DRIVER(simple_bus) = { .per_device_plat_auto = sizeof(struct simple_bus_plat), }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id generic_simple_bus_ids[] = { { .compatible = "simple-bus" }, { .compatible = "simple-mfd" }, diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index cb33fac..25fdb66 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -186,7 +186,7 @@ static const struct udevice_id generic_syscon_ids[] = { U_BOOT_DRIVER(generic_syscon) = { .name = "syscon", .id = UCLASS_SYSCON, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .of_match = generic_syscon_ids, diff --git a/drivers/core/util.c b/drivers/core/util.c index 5be4ee7..aa60fdd 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -22,7 +22,7 @@ int list_count_items(struct list_head *head) return count; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) int pci_get_devfn(struct udevice *dev) { struct fdt_pci_addr addr; diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 8c77777..e0d3ae6 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -1137,7 +1137,7 @@ err: return ret; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int _gpio_request_by_name_nodev(ofnode node, const char *list_name, int index, struct gpio_desc *desc, int flags, bool add_index) diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index f15ce7b..4a3ec6d 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -204,7 +204,7 @@ static const struct dm_gpio_ops gpio_intel_ops = { #endif }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id intel_intel_gpio_ids[] = { { .compatible = "intel,gpio" }, { } diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index eee3645..50c4f75 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -362,7 +362,7 @@ U_BOOT_DRIVER(gpio_omap) = { .name = "gpio_omap", .id = UCLASS_GPIO, #if CONFIG_IS_ENABLED(OF_CONTROL) -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = omap_gpio_ids, .of_to_plat = of_match_ptr(omap_gpio_of_to_plat), .plat_auto = sizeof(struct omap_gpio_plat), diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c index aeec6aa..1107cf3 100644 --- a/drivers/i2c/i2c-emul-uclass.c +++ b/drivers/i2c/i2c-emul-uclass.c @@ -79,7 +79,7 @@ UCLASS_DRIVER(i2c_emul) = { UCLASS_DRIVER(i2c_emul_parent) = { .id = UCLASS_I2C_EMUL_PARENT, .name = "i2c_emul_parent", -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 2a15094..1bbc0f9 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1671,7 +1671,7 @@ UCLASS_DRIVER(cros_ec) = { .id = UCLASS_CROS_EC, .name = "cros-ec", .per_device_auto = sizeof(struct cros_ec_dev), -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif .flags = DM_UC_FLAG_ALLOC_PRIV_DMA, diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c index 94d273d..98d58b3 100644 --- a/drivers/misc/p2sb-uclass.c +++ b/drivers/misc/p2sb-uclass.c @@ -183,7 +183,7 @@ int p2sb_set_port_id(struct udevice *dev, int portid) static int p2sb_child_post_bind(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); int ret; u32 pid; diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index aabf395..2f6156e 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1411,7 +1411,7 @@ __weak void init_clk_usdhc(u32 index) static int fsl_esdhc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct fsl_esdhc_priv *priv = dev_get_priv(dev); #if CONFIG_IS_ENABLED(DM_REGULATOR) struct udevice *vqmmc_dev; @@ -1598,7 +1598,7 @@ static int fsl_esdhc_probe(struct udevice *dev) return ret; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) ret = mmc_of_parse(dev, &plat->cfg); if (ret) return ret; diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index 0fa0372..221fba3 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -392,7 +392,7 @@ static void ftsdc_setup_cfg(struct mmc_config *cfg, const char *name, int buswid static int ftsdc010_mmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct ftsdc_priv *priv = dev_get_priv(dev); struct ftsdc010_chip *chip = &priv->chip; chip->name = dev->name; diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index d7d5361..fa297a0 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -52,7 +52,7 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq) static int rockchip_dwmmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c index acaa55d..181a6ff 100644 --- a/drivers/pinctrl/intel/pinctrl_apl.c +++ b/drivers/pinctrl/intel/pinctrl_apl.c @@ -155,7 +155,7 @@ static int apl_pinctrl_of_to_plat(struct udevice *dev) return intel_pinctrl_of_to_plat(dev, comm, 2); } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id apl_gpio_ids[] = { { .compatible = "intel,apl-pinctrl"}, { } @@ -168,7 +168,7 @@ U_BOOT_DRIVER(intel_apl_pinctrl) = { .of_match = of_match_ptr(apl_gpio_ids), .probe = intel_pinctrl_probe, .ops = &intel_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .of_to_plat = apl_pinctrl_of_to_plat, diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c index e6b10a3..9a54b8b 100644 --- a/drivers/pinctrl/nxp/pinctrl-mxs.c +++ b/drivers/pinctrl/nxp/pinctrl-mxs.c @@ -186,7 +186,7 @@ U_BOOT_DRIVER(fsl_imx23_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(mxs_pinctrl_match), .probe = mxs_pinctrl_probe, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .priv_auto = sizeof(struct mxs_pinctrl_priv), diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index dfe60b6..4462ed2 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -421,7 +421,7 @@ static int __maybe_unused pinctrl_post_bind(struct udevice *dev) UCLASS_DRIVER(pinctrl) = { .id = UCLASS_PINCTRL, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = pinctrl_post_bind, #endif .flags = DM_UC_FLAG_SEQ_ALIAS, diff --git a/drivers/pinctrl/rockchip/pinctrl-px30.c b/drivers/pinctrl/rockchip/pinctrl-px30.c index 6058d0f..9de29c0 100644 --- a/drivers/pinctrl/rockchip/pinctrl-px30.c +++ b/drivers/pinctrl/rockchip/pinctrl-px30.c @@ -363,7 +363,7 @@ U_BOOT_DRIVER(pinctrl_px30) = { .of_match = px30_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3036.c b/drivers/pinctrl/rockchip/pinctrl-rk3036.c index 9ccee46..afcd343 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3036.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3036.c @@ -103,7 +103,7 @@ U_BOOT_DRIVER(pinctrl_rockchip) = { .of_match = rk3036_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3128.c b/drivers/pinctrl/rockchip/pinctrl-rk3128.c index 85c2e61..e6dc1af 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3128.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3128.c @@ -205,7 +205,7 @@ U_BOOT_DRIVER(pinctrl_rk3128) = { .of_match = rk3128_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3188.c b/drivers/pinctrl/rockchip/pinctrl-rk3188.c index 06d53e2..9a982cb 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3188.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3188.c @@ -126,7 +126,7 @@ U_BOOT_DRIVER(rockchip_rk3188_pinctrl) = { .of_match = rk3188_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk322x.c b/drivers/pinctrl/rockchip/pinctrl-rk322x.c index fe38693..7c58f40 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk322x.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk322x.c @@ -292,7 +292,7 @@ U_BOOT_DRIVER(pinctrl_rk3228) = { .of_match = rk3228_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c index fc28102..5894f47 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c @@ -248,7 +248,7 @@ U_BOOT_DRIVER(rockchip_rk3288_pinctrl) = { .of_match = rk3288_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3308.c b/drivers/pinctrl/rockchip/pinctrl-rk3308.c index a9b87b7..83186f4 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3308.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3308.c @@ -459,7 +459,7 @@ U_BOOT_DRIVER(pinctrl_rk3308) = { .of_match = rk3308_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3328.c b/drivers/pinctrl/rockchip/pinctrl-rk3328.c index aa8bd76..1c3c598 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3328.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3328.c @@ -323,7 +323,7 @@ U_BOOT_DRIVER(rockchip_rk3328_pinctrl) = { .of_match = rk3328_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3368.c b/drivers/pinctrl/rockchip/pinctrl-rk3368.c index 18d3e3a..ba867a8 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3368.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3368.c @@ -177,7 +177,7 @@ U_BOOT_DRIVER(rockchip_rk3368_pinctrl) = { .of_match = rk3368_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3399.c b/drivers/pinctrl/rockchip/pinctrl-rk3399.c index 0c1adc3..caa9220 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3399.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3399.c @@ -317,7 +317,7 @@ U_BOOT_DRIVER(pinctrl_rk3399) = { .of_match = rk3399_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/pinctrl/rockchip/pinctrl-rv1108.c b/drivers/pinctrl/rockchip/pinctrl-rv1108.c index d35425b..5b70b50 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rv1108.c +++ b/drivers/pinctrl/rockchip/pinctrl-rv1108.c @@ -291,7 +291,7 @@ U_BOOT_DRIVER(pinctrl_rv1108) = { .of_match = rv1108_pinctrl_ids, .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .bind = dm_scan_fdt_dev, #endif .probe = rockchip_pinctrl_probe, diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index a9d0518..5a72283 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -883,7 +883,7 @@ static int rk3368_dmc_of_to_plat(struct udevice *dev) { int ret = 0; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3368_sdram_params *plat = dev_get_plat(dev); ret = regmap_init_mem(dev_ofnode(dev), &plat->map); diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c index 25ae69e..38d25c8 100644 --- a/drivers/ram/rockchip/sdram_rk3188.c +++ b/drivers/ram/rockchip/sdram_rk3188.c @@ -816,7 +816,7 @@ static int setup_sdram(struct udevice *dev) static int rk3188_dmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3188_sdram_params *params = dev_get_plat(dev); int ret; diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c index 9057cca..fd12008 100644 --- a/drivers/ram/rockchip/sdram_rk322x.c +++ b/drivers/ram/rockchip/sdram_rk322x.c @@ -716,7 +716,7 @@ out: static int rk322x_dmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk322x_sdram_params *params = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index a933abf..2cb034f 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -973,7 +973,7 @@ static int setup_sdram(struct udevice *dev) static int rk3288_dmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3288_sdram_params *params = dev_get_plat(dev); int ret; diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c index 9af4c37..9c6798f 100644 --- a/drivers/ram/rockchip/sdram_rk3328.c +++ b/drivers/ram/rockchip/sdram_rk3328.c @@ -517,7 +517,7 @@ static int rk3328_dmc_init(struct udevice *dev) struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3328_sdram_params *params = &plat->sdram_params; #else struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat; @@ -549,7 +549,7 @@ static int rk3328_dmc_init(struct udevice *dev) static int rk3328_dmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index a83a670..c9631af 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -3013,7 +3013,7 @@ static int sdram_init(struct dram_info *dram, static int rk3399_dmc_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; @@ -3068,7 +3068,7 @@ static int rk3399_dmc_init(struct udevice *dev) struct dram_info *priv = dev_get_priv(dev); struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rk3399_sdram_params *params = &plat->sdram_params; #else struct dtd_rockchip_rk3399_dmc *dtplat = &plat->dtplat; diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c index 321b873..e5ae6ea 100644 --- a/drivers/rtc/rtc-uclass.c +++ b/drivers/rtc/rtc-uclass.c @@ -177,7 +177,7 @@ UCLASS_DRIVER(rtc) = { .name = "rtc", .id = UCLASS_RTC, .flags = DM_UC_FLAG_SEQ_ALIAS, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .post_bind = dm_scan_fdt_dev, #endif }; diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index 5243c95..dbbcea5 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -237,7 +237,7 @@ U_BOOT_DRIVER(sandbox_serial) = { .flags = DM_FLAG_PRE_RELOC, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct sandbox_serial_plat platdata_non_fdt = { .colour = -1, }; diff --git a/drivers/serial/serial_mt7620.c b/drivers/serial/serial_mt7620.c index 826a14b..76ecc2b 100644 --- a/drivers/serial/serial_mt7620.c +++ b/drivers/serial/serial_mt7620.c @@ -145,7 +145,7 @@ static int mt7620_serial_probe(struct udevice *dev) return 0; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int mt7620_serial_of_to_plat(struct udevice *dev) { struct mt7620_serial_plat *plat = dev_get_plat(dev); @@ -200,7 +200,7 @@ static const struct dm_serial_ops mt7620_serial_ops = { U_BOOT_DRIVER(serial_mt7620) = { .name = "serial_mt7620", .id = UCLASS_SERIAL, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = mt7620_serial_ids, .of_to_plat = mt7620_serial_of_to_plat, #endif diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c index 08d54e8..42071bb 100644 --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -604,7 +604,7 @@ static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op) return ret; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /** * ich_spi_get_basics() - Get basic information about the ICH device * @@ -672,7 +672,7 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep, uint *map_sizep, uint *offsetp) { pci_dev_t spi_bdf; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) if (device_is_on_pci_bus(bus)) { struct pci_child_plat *pplat; @@ -940,7 +940,7 @@ static int ich_spi_of_to_plat(struct udevice *dev) { struct ich_spi_plat *plat = dev_get_plat(dev); -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct ich_spi_priv *priv = dev_get_priv(dev); int ret; diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c index 9856a56..ea16914 100644 --- a/drivers/spi/pl022_spi.c +++ b/drivers/spi/pl022_spi.c @@ -286,7 +286,7 @@ static const struct dm_spi_ops pl022_spi_ops = { .cs_info = pl022_cs_info, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int pl022_spi_of_to_plat(struct udevice *bus) { struct pl022_spi_pdata *plat = dev_get_plat(bus); @@ -315,7 +315,7 @@ static const struct udevice_id pl022_spi_ids[] = { U_BOOT_DRIVER(pl022_spi) = { .name = "pl022_spi", .id = UCLASS_SPI, -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = pl022_spi_ids, .of_to_plat = pl022_spi_of_to_plat, #endif diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 40bd885..e504e30 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -193,7 +193,7 @@ static int conv_of_plat(struct udevice *dev) static int rockchip_spi_of_to_plat(struct udevice *bus) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); int ret; diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 5a2a743..655fb14 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -162,7 +162,7 @@ int spi_write_then_read(struct spi_slave *slave, const u8 *opcode, return ret; } -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static int spi_child_post_bind(struct udevice *dev) { struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); @@ -176,7 +176,7 @@ static int spi_child_post_bind(struct udevice *dev) static int spi_post_probe(struct udevice *bus) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct dm_spi_bus *spi = dev_get_uclass_priv(bus); spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0); @@ -539,7 +539,7 @@ UCLASS_DRIVER(spi) = { .per_device_auto = sizeof(struct dm_spi_bus), .per_child_auto = sizeof(struct spi_slave), .per_child_plat_auto = sizeof(struct dm_spi_slave_plat), -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) .child_post_bind = spi_child_post_bind, #endif }; diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c index 0868582..0ee286c 100644 --- a/drivers/sysreset/sysreset_sandbox.c +++ b/drivers/sysreset/sysreset_sandbox.c @@ -133,7 +133,7 @@ U_BOOT_DRIVER(warm_sysreset_sandbox) = { .ops = &sandbox_warm_sysreset_ops, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /* This is here in case we don't have a device tree */ U_BOOT_DRVINFO(sysreset_sandbox_non_fdt) = { .name = "sysreset_sandbox", diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 18c6145..9662147 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -55,7 +55,7 @@ ulong timer_get_boot_us(void) /* The timer is available */ rate = timer_get_rate(gd->timer); timer_get_count(gd->timer, &ticks); -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) } else if (ret == -EAGAIN) { /* We have been called so early that the DM is not ready,... */ ofnode node = offset_to_ofnode(-1); @@ -100,7 +100,7 @@ static u64 rockchip_timer_get_count(struct udevice *dev) static int rockchip_clk_of_to_plat(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_timer_priv *priv = dev_get_priv(dev); priv->timer = dev_read_addr_ptr(dev); diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index c8e8419..52bddb9 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -50,7 +50,7 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk timer_clk; int err; @@ -136,7 +136,7 @@ int notrace dm_timer_init(void) if (gd->dm_root == NULL) return -EAGAIN; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) /* Check for a chosen timer to be used for tick */ node = ofnode_get_chosen_node("tick-timer"); diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index adef50c..192c7b7 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -479,7 +479,7 @@ static const struct timer_ops tsc_timer_ops = { .get_count = tsc_timer_get_count, }; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) static const struct udevice_id tsc_timer_ids[] = { { .compatible = "x86,tsc-timer", }, { } diff --git a/include/dm/device.h b/include/dm/device.h index 68986dd..fac9961 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -181,7 +181,7 @@ struct udevice { u32 flags_; #endif int seq_; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) ofnode node_; #endif #ifdef CONFIG_DEVRES @@ -242,7 +242,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic) */ static inline ofnode dev_ofnode(const struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) return dev->node_; #else return ofnode_null(); @@ -262,7 +262,7 @@ static inline ofnode dev_ofnode(const struct udevice *dev) static inline int dev_of_offset(const struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) return ofnode_to_offset(dev_ofnode(dev)); #else return -1; @@ -271,7 +271,7 @@ static inline int dev_of_offset(const struct udevice *dev) static inline bool dev_has_ofnode(const struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) return ofnode_valid(dev_ofnode(dev)); #else return false; @@ -280,7 +280,7 @@ static inline bool dev_has_ofnode(const struct udevice *dev) static inline void dev_set_ofnode(struct udevice *dev, ofnode node) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_REAL) dev->node_ = node; #endif } -- cgit v1.1 From 62470afed14a598d36d055c60ccc3ffab6967dcc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:05 -0600 Subject: mmc: nds32: ftsdc010: Convert to livetree Use the livetree API for this driver. Signed-off-by: Simon Glass Reviewed-by: Rick Chen Reviewed-by: Jaehoon Chung --- drivers/mmc/ftsdc010_mci.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index 221fba3..b30da5b 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -30,8 +30,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - #define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 4) /* 250 ms */ #define CFG_RST_TIMEOUT CONFIG_SYS_HZ /* 1 sec reset timeout */ @@ -395,24 +393,18 @@ static int ftsdc010_mmc_of_to_plat(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_REAL) struct ftsdc_priv *priv = dev_get_priv(dev); struct ftsdc010_chip *chip = &priv->chip; + chip->name = dev->name; chip->ioaddr = dev_read_addr_ptr(dev); - chip->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "bus-width", 4); + chip->buswidth = dev_read_u32_default(dev, "bus-width", 4); chip->priv = dev; - priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "fifo-depth", 0); - priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), - "fifo-mode"); - if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), - "clock-freq-min-max", priv->minmax, 2)) { - int val = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "max-frequency", -EINVAL); - if (val < 0) - return val; + priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); + priv->fifo_mode = dev_read_bool(dev, "fifo-mode"); + if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) { + if (dev_read_u32(dev, "max-frequency", &priv->minmax[1])) + return -EINVAL; priv->minmax[0] = 400000; /* 400 kHz */ - priv->minmax[1] = val; } else { debug("%s: 'clock-freq-min-max' property was deprecated.\n", __func__); -- cgit v1.1 From dcfc42b12f95fecffbf4692854acd4193240d86a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:06 -0600 Subject: treewide: Try to avoid the preprocessor with OF_REAL Convert some of these occurences to C code, where it is easy to do. This should help encourage this approach to be used in new code. Signed-off-by: Simon Glass --- arch/x86/cpu/intel_common/p2sb.c | 20 +++++------ doc/develop/driver-model/of-plat.rst | 6 ++-- drivers/clk/clk_fixed_factor.c | 18 +++++----- drivers/clk/clk_fixed_rate.c | 7 ++-- drivers/clk/rockchip/clk_rk3188.c | 8 ++--- drivers/clk/rockchip/clk_rk3288.c | 8 ++--- drivers/clk/rockchip/clk_rk3368.c | 8 ++--- drivers/clk/rockchip/clk_rk3399.c | 18 +++++----- drivers/misc/p2sb-uclass.c | 20 +++++------ drivers/mmc/fsl_esdhc_imx.c | 17 ++++----- drivers/mmc/ftsdc010_mci.c | 33 ++++++++--------- drivers/mmc/rockchip_dw_mmc.c | 6 ++-- drivers/ram/rockchip/dmc-rk3368.c | 12 +++---- drivers/ram/rockchip/sdram_rk3188.c | 5 +-- drivers/ram/rockchip/sdram_rk322x.c | 5 +-- drivers/ram/rockchip/sdram_rk3288.c | 5 +-- drivers/ram/rockchip/sdram_rk3399.c | 5 +-- drivers/spi/rk_spi.c | 36 +++++++++---------- drivers/spi/spi-uclass.c | 8 ++--- drivers/timer/rockchip_timer.c | 16 ++++----- drivers/timer/timer-uclass.c | 68 +++++++++++++++++++----------------- 21 files changed, 170 insertions(+), 159 deletions(-) diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c index 5dc8163..5a7b30d 100644 --- a/arch/x86/cpu/intel_common/p2sb.c +++ b/arch/x86/cpu/intel_common/p2sb.c @@ -159,16 +159,16 @@ static int p2sb_remove(struct udevice *dev) static int p2sb_child_post_bind(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); - int ret; - u32 pid; - - ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid); - if (ret) - return ret; - pplat->pid = pid; -#endif + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); + int ret; + u32 pid; + + ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid); + if (ret) + return ret; + pplat->pid = pid; + } return 0; } diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 8b16f55..507731a 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -215,16 +215,16 @@ For example: static int mmc_of_to_plat(struct udevice *dev) { - #if CONFIG_IS_ENABLED(OF_REAL) + if (CONFIG_IS_ENABLED(OF_REAL)) { /* Decode the devicetree data */ struct mmc_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); plat->fifo_depth = fdtdec_get_int(blob, node, "fifo-depth", 0); - #endif + } - return 0; + return 0; } static int mmc_probe(struct udevice *dev) diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index 04871b4..41b0d9c 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -40,17 +40,17 @@ const struct clk_ops clk_fixed_factor_ops = { static int clk_fixed_factor_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - int err; - struct clk_fixed_factor *ff = to_clk_fixed_factor(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + int err; + struct clk_fixed_factor *ff = to_clk_fixed_factor(dev); - err = clk_get_by_index(dev, 0, &ff->parent); - if (err) - return err; + err = clk_get_by_index(dev, 0, &ff->parent); + if (err) + return err; - ff->div = dev_read_u32_default(dev, "clock-div", 1); - ff->mult = dev_read_u32_default(dev, "clock-mult", 1); -#endif + ff->div = dev_read_u32_default(dev, "clock-div", 1); + ff->mult = dev_read_u32_default(dev, "clock-mult", 1); + } return 0; } diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index d0f2594..e0dc4ab 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -32,9 +32,10 @@ void clk_fixed_rate_ofdata_to_plat_(struct udevice *dev, struct clk_fixed_rate *plat) { struct clk *clk = &plat->clk; -#if CONFIG_IS_ENABLED(OF_REAL) - plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency", 0); -#endif + if (CONFIG_IS_ENABLED(OF_REAL)) + plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency", + 0); + /* Make fixed rate clock accessible from higher level struct clk */ /* FIXME: This is not allowed */ dev_set_uclass_priv(dev, clk); diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c index 1751672..038cb55 100644 --- a/drivers/clk/rockchip/clk_rk3188.c +++ b/drivers/clk/rockchip/clk_rk3188.c @@ -540,11 +540,11 @@ static struct clk_ops rk3188_clk_ops = { static int rk3188_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3188_clk_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3188_clk_priv *priv = dev_get_priv(dev); - priv->cru = dev_read_addr_ptr(dev); -#endif + priv->cru = dev_read_addr_ptr(dev); + } return 0; } diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index ee22221..3b29992 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -957,11 +957,11 @@ static struct clk_ops rk3288_clk_ops = { static int rk3288_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3288_clk_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3288_clk_priv *priv = dev_get_priv(dev); - priv->cru = dev_read_addr_ptr(dev); -#endif + priv->cru = dev_read_addr_ptr(dev); + } return 0; } diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index d0d0046..39caf23 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -596,11 +596,11 @@ static int rk3368_clk_probe(struct udevice *dev) static int rk3368_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3368_clk_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3368_clk_priv *priv = dev_get_priv(dev); - priv->cru = dev_read_addr_ptr(dev); -#endif + priv->cru = dev_read_addr_ptr(dev); + } return 0; } diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 209c726..7d31a9f 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1402,11 +1402,12 @@ static int rk3399_clk_probe(struct udevice *dev) static int rk3399_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3399_clk_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3399_clk_priv *priv = dev_get_priv(dev); + + priv->cru = dev_read_addr_ptr(dev); + } - priv->cru = dev_read_addr_ptr(dev); -#endif return 0; } @@ -1614,11 +1615,12 @@ static int rk3399_pmuclk_probe(struct udevice *dev) static int rk3399_pmuclk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3399_pmuclk_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3399_pmuclk_priv *priv = dev_get_priv(dev); + + priv->pmucru = dev_read_addr_ptr(dev); + } - priv->pmucru = dev_read_addr_ptr(dev); -#endif return 0; } diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c index 98d58b3..f24857a 100644 --- a/drivers/misc/p2sb-uclass.c +++ b/drivers/misc/p2sb-uclass.c @@ -183,16 +183,16 @@ int p2sb_set_port_id(struct udevice *dev, int portid) static int p2sb_child_post_bind(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); - int ret; - u32 pid; - - ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid); - if (ret) - return ret; - pplat->pid = pid; -#endif + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); + int ret; + u32 pid; + + ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid); + if (ret) + return ret; + pplat->pid = pid; + } return 0; } diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 2f6156e..5dfd484 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1411,7 +1411,6 @@ __weak void init_clk_usdhc(u32 index) static int fsl_esdhc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct fsl_esdhc_priv *priv = dev_get_priv(dev); #if CONFIG_IS_ENABLED(DM_REGULATOR) struct udevice *vqmmc_dev; @@ -1419,10 +1418,12 @@ static int fsl_esdhc_of_to_plat(struct udevice *dev) #endif const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); - fdt_addr_t addr; unsigned int val; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + addr = dev_read_addr(dev); if (addr == FDT_ADDR_T_NONE) return -EINVAL; @@ -1494,7 +1495,7 @@ static int fsl_esdhc_of_to_plat(struct udevice *dev) priv->vs18_enable = 1; } #endif -#endif + return 0; } @@ -1598,11 +1599,11 @@ static int fsl_esdhc_probe(struct udevice *dev) return ret; } -#if CONFIG_IS_ENABLED(OF_REAL) - ret = mmc_of_parse(dev, &plat->cfg); - if (ret) - return ret; -#endif + if (CONFIG_IS_ENABLED(OF_REAL)) { + ret = mmc_of_parse(dev, &plat->cfg); + if (ret) + return ret; + } mmc = &plat->mmc; mmc->cfg = &plat->cfg; diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index b30da5b..b8cafeb 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -390,28 +390,29 @@ static void ftsdc_setup_cfg(struct mmc_config *cfg, const char *name, int buswid static int ftsdc010_mmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct ftsdc_priv *priv = dev_get_priv(dev); struct ftsdc010_chip *chip = &priv->chip; - chip->name = dev->name; - chip->ioaddr = dev_read_addr_ptr(dev); - chip->buswidth = dev_read_u32_default(dev, "bus-width", 4); - chip->priv = dev; - priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); - priv->fifo_mode = dev_read_bool(dev, "fifo-mode"); - if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) { - if (dev_read_u32(dev, "max-frequency", &priv->minmax[1])) - return -EINVAL; - - priv->minmax[0] = 400000; /* 400 kHz */ - } else { - debug("%s: 'clock-freq-min-max' property was deprecated.\n", - __func__); + if (CONFIG_IS_ENABLED(OF_REAL)) { + chip->name = dev->name; + chip->ioaddr = dev_read_addr_ptr(dev); + chip->buswidth = dev_read_u32_default(dev, "bus-width", 4); + chip->priv = dev; + priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); + priv->fifo_mode = dev_read_bool(dev, "fifo-mode"); + if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) { + if (dev_read_u32(dev, "max-frequency", &priv->minmax[1])) + return -EINVAL; + + priv->minmax[0] = 400000; /* 400 kHz */ + } else { + debug("%s: 'clock-freq-min-max' property was deprecated.\n", + __func__); + } } -#endif chip->sclk = priv->minmax[1]; chip->regs = chip->ioaddr; + return 0; } diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index fa297a0..855c0e7 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -52,10 +52,12 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq) static int rockchip_dwmmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + host->name = dev->name; host->ioaddr = dev_read_addr_ptr(dev); host->buswidth = dev_read_u32_default(dev, "bus-width", 4); @@ -95,7 +97,7 @@ static int rockchip_dwmmc_of_to_plat(struct udevice *dev) debug("%s: 'clock-freq-min-max' property was deprecated.\n", __func__); } -#endif + return 0; } diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index 5a72283..69c454a 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -883,13 +883,13 @@ static int rk3368_dmc_of_to_plat(struct udevice *dev) { int ret = 0; -#if CONFIG_IS_ENABLED(OF_REAL) - struct rk3368_sdram_params *plat = dev_get_plat(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rk3368_sdram_params *plat = dev_get_plat(dev); - ret = regmap_init_mem(dev_ofnode(dev), &plat->map); - if (ret) - return ret; -#endif + ret = regmap_init_mem(dev_ofnode(dev), &plat->map); + if (ret) + return ret; + } return ret; } diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c index 38d25c8..d9ed8ad 100644 --- a/drivers/ram/rockchip/sdram_rk3188.c +++ b/drivers/ram/rockchip/sdram_rk3188.c @@ -816,10 +816,12 @@ static int setup_sdram(struct udevice *dev) static int rk3188_dmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rk3188_sdram_params *params = dev_get_plat(dev); int ret; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + /* rk3188 supports only one-channel */ params->num_channels = 1; ret = dev_read_u32_array(dev, "rockchip,pctl-timing", @@ -846,7 +848,6 @@ static int rk3188_dmc_of_to_plat(struct udevice *dev) ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map); if (ret) return ret; -#endif return 0; } diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c index fd12008..30e9c3d 100644 --- a/drivers/ram/rockchip/sdram_rk322x.c +++ b/drivers/ram/rockchip/sdram_rk322x.c @@ -716,12 +716,14 @@ out: static int rk322x_dmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rk322x_sdram_params *params = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); int ret; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + params->num_channels = 1; ret = fdtdec_get_int_array(blob, node, "rockchip,pctl-timing", @@ -748,7 +750,6 @@ static int rk322x_dmc_of_to_plat(struct udevice *dev) ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map); if (ret) return ret; -#endif return 0; } diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index 2cb034f..f3e4a28 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -973,10 +973,12 @@ static int setup_sdram(struct udevice *dev) static int rk3288_dmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rk3288_sdram_params *params = dev_get_plat(dev); int ret; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + /* Rk3288 supports dual-channel, set default channel num to 2 */ params->num_channels = 2; ret = dev_read_u32_array(dev, "rockchip,pctl-timing", @@ -1008,7 +1010,6 @@ static int rk3288_dmc_of_to_plat(struct udevice *dev) ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map); if (ret) return ret; -#endif return 0; } diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index c9631af..ce33fbb 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -3013,10 +3013,12 @@ static int sdram_init(struct dram_info *dram, static int rk3399_dmc_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; + if (!CONFIG_IS_ENABLED(OF_REAL)) + return 0; + ret = dev_read_u32_array(dev, "rockchip,sdram-params", (u32 *)&plat->sdram_params, sizeof(plat->sdram_params) / sizeof(u32)); @@ -3029,7 +3031,6 @@ static int rk3399_dmc_of_to_plat(struct udevice *dev) if (ret) printf("%s: regmap failed %d\n", __func__, ret); -#endif return 0; } diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index e504e30..8309a53 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -193,31 +193,31 @@ static int conv_of_plat(struct udevice *dev) static int rockchip_spi_of_to_plat(struct udevice *bus) { -#if CONFIG_IS_ENABLED(OF_REAL) struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); int ret; - plat->base = dev_read_addr(bus); + if (CONFIG_IS_ENABLED(OF_REAL)) { + plat->base = dev_read_addr(bus); - ret = clk_get_by_index(bus, 0, &priv->clk); - if (ret < 0) { - debug("%s: Could not get clock for %s: %d\n", __func__, - bus->name, ret); - return ret; - } + ret = clk_get_by_index(bus, 0, &priv->clk); + if (ret < 0) { + debug("%s: Could not get clock for %s: %d\n", __func__, + bus->name, ret); + return ret; + } - plat->frequency = - dev_read_u32_default(bus, "spi-max-frequency", 50000000); - plat->deactivate_delay_us = - dev_read_u32_default(bus, "spi-deactivate-delay", 0); - plat->activate_delay_us = - dev_read_u32_default(bus, "spi-activate-delay", 0); + plat->frequency = dev_read_u32_default(bus, "spi-max-frequency", + 50000000); + plat->deactivate_delay_us = + dev_read_u32_default(bus, "spi-deactivate-delay", 0); + plat->activate_delay_us = + dev_read_u32_default(bus, "spi-activate-delay", 0); - debug("%s: base=%x, max-frequency=%d, deactivate_delay=%d\n", - __func__, (uint)plat->base, plat->frequency, - plat->deactivate_delay_us); -#endif + debug("%s: base=%x, max-frequency=%d, deactivate_delay=%d\n", + __func__, (uint)plat->base, plat->frequency, + plat->deactivate_delay_us); + } return 0; } diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 655fb14..f8ec312 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -176,11 +176,11 @@ static int spi_child_post_bind(struct udevice *dev) static int spi_post_probe(struct udevice *bus) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct dm_spi_bus *spi = dev_get_uclass_priv(bus); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct dm_spi_bus *spi = dev_get_uclass_priv(bus); - spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0); -#endif + spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0); + } #if defined(CONFIG_NEEDS_MANUAL_RELOC) struct dm_spi_ops *ops = spi_get_ops(bus); static int reloc_done; diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 9662147..62eacb9 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -55,8 +55,7 @@ ulong timer_get_boot_us(void) /* The timer is available */ rate = timer_get_rate(gd->timer); timer_get_count(gd->timer, &ticks); -#if CONFIG_IS_ENABLED(OF_REAL) - } else if (ret == -EAGAIN) { + } else if (CONFIG_IS_ENABLED(OF_REAL) && ret == -EAGAIN) { /* We have been called so early that the DM is not ready,... */ ofnode node = offset_to_ofnode(-1); struct rk_timer *timer = NULL; @@ -79,7 +78,6 @@ ulong timer_get_boot_us(void) debug("%s: could not read clock-frequency\n", __func__); return 0; } -#endif } else { return 0; } @@ -100,13 +98,13 @@ static u64 rockchip_timer_get_count(struct udevice *dev) static int rockchip_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rockchip_timer_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rockchip_timer_priv *priv = dev_get_priv(dev); - priv->timer = dev_read_addr_ptr(dev); - if (!priv->timer) - return -ENOENT; -#endif + priv->timer = dev_read_addr_ptr(dev); + if (!priv->timer) + return -ENOENT; + } return 0; } diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 52bddb9..6ea9e39 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -50,27 +50,29 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct clk timer_clk; - int err; - ulong ret; + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct clk timer_clk; + int err; + ulong ret; - /* It is possible that a timer device has a null ofnode */ - if (!dev_has_ofnode(dev)) - return 0; + /* + * It is possible that a timer device has a null ofnode + */ + if (!dev_has_ofnode(dev)) + return 0; - err = clk_get_by_index(dev, 0, &timer_clk); - if (!err) { - ret = clk_get_rate(&timer_clk); - if (IS_ERR_VALUE(ret)) - return ret; - uc_priv->clock_rate = ret; - } else { - uc_priv->clock_rate = - dev_read_u32_default(dev, "clock-frequency", 0); + err = clk_get_by_index(dev, 0, &timer_clk); + if (!err) { + ret = clk_get_rate(&timer_clk); + if (IS_ERR_VALUE(ret)) + return ret; + uc_priv->clock_rate = ret; + } else { + uc_priv->clock_rate = + dev_read_u32_default(dev, "clock-frequency", 0); + } } -#endif return 0; } @@ -136,23 +138,23 @@ int notrace dm_timer_init(void) if (gd->dm_root == NULL) return -EAGAIN; -#if CONFIG_IS_ENABLED(OF_REAL) - /* Check for a chosen timer to be used for tick */ - node = ofnode_get_chosen_node("tick-timer"); - - if (ofnode_valid(node) && - uclass_get_device_by_ofnode(UCLASS_TIMER, node, &dev)) { - /* - * If the timer is not marked to be bound before - * relocation, bind it anyway. - */ - if (!lists_bind_fdt(dm_root(), node, &dev, false)) { - ret = device_probe(dev); - if (ret) - return ret; + if (CONFIG_IS_ENABLED(OF_REAL)) { + /* Check for a chosen timer to be used for tick */ + node = ofnode_get_chosen_node("tick-timer"); + + if (ofnode_valid(node) && + uclass_get_device_by_ofnode(UCLASS_TIMER, node, &dev)) { + /* + * If the timer is not marked to be bound before + * relocation, bind it anyway. + */ + if (!lists_bind_fdt(dm_root(), node, &dev, false)) { + ret = device_probe(dev); + if (ret) + return ret; + } } } -#endif if (!dev) { /* Fall back to the first available timer */ -- cgit v1.1 From f99cbe4e867f75f8e90917b997c338e20c7f7831 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:07 -0600 Subject: fdt: Update Makefile rules with the new OF_REAL Kconfig Simplify some of the Makefile rules using this Kconfig. Signed-off-by: Simon Glass --- Makefile | 7 ++----- lib/Makefile | 5 +---- scripts/Makefile.spl | 9 +++------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a09f48f..5ad06b8 100644 --- a/Makefile +++ b/Makefile @@ -1292,10 +1292,6 @@ u-boot.ldr: u-boot # Use 'make BINMAN_VERBOSE=3' to set vebosity level default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE)) -# Tell binman whether we have a devicetree for SPL and TPL -have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL)) -have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL)) - quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ --toolpath $(objtree)/tools \ @@ -1309,7 +1305,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -a scp-path=$(SCP) \ -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \ -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ - -a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \ + -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ + -a tpl-dtb=$(CONFIG_SPL_OF_REAL) \ $(BINMAN_$(@F)) OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex diff --git a/lib/Makefile b/lib/Makefile index dfe772a..09e380e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -80,10 +80,7 @@ obj-$(CONFIG_$(SPL_)LIB_RATIONAL) += rational.o obj-$(CONFIG_LIBAVB) += libavb/ obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/ -ifneq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)OF_PLATDATA),yy) -obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += fdtdec_common.o -obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += fdtdec.o -endif +obj-$(CONFIG_$(SPL_TPL_)OF_REAL) += fdtdec_common.o fdtdec.o ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 7f8c5f0..6f26eb1 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -295,18 +295,15 @@ else FINAL_DTB_CONTAINER = $(obj)/$(SPL_BIN).multidtb.fit endif -# Build the .dtb file if: -# - we are not using OF_PLATDATA -# - we are using OF_CONTROL +# Build the .dtb file if needed +# - OF_REAL is enabled # - we have either OF_SEPARATE or OF_HOSTFILE build_dtb := -ifeq ($(CONFIG_$(SPL_TPL_)OF_PLATDATA),) -ifneq ($(CONFIG_$(SPL_TPL_)OF_CONTROL),) +ifneq ($(CONFIG_$(SPL_TPL_)OF_REAL),) ifeq ($(CONFIG_OF_SEPARATE)$(CONFIG_OF_HOSTFILE),y) build_dtb := y endif endif -endif ifneq ($(build_dtb),) $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \ -- cgit v1.1 From 4ee0cc89dbbeb2d6b08e702afc1332f7dec8a38f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:08 -0600 Subject: dm: Add comments to dt-structs contents These structs do not have comments at present. Add them. Signed-off-by: Simon Glass --- include/dt-structs.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/dt-structs.h b/include/dt-structs.h index f9ccaf5..fa1622c 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -10,16 +10,43 @@ #if CONFIG_IS_ENABLED(OF_PLATDATA) struct driver_info; +/** + * struct phandle_0_arg - hold a phandle record with no arguments + * + * This holds a phandle pointing to another device. See 'Indexes' in the + * of-plat-rst documentation. + * + * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST) + * @arg: arguments + */ struct phandle_0_arg { uint idx; int arg[0]; }; +/** + * struct phandle_2_arg - hold a phandle record with up to one argument + * + * This holds a phandle pointing to another device. See 'Indexes' in the + * of-plat-rst documentation. + * + * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST) + * @arg: arguments + */ struct phandle_1_arg { uint idx; int arg[1]; }; +/** + * struct phandle_2_arg - hold a phandle record with up to two arguments + * + * This holds a phandle pointing to another device. See 'Indexes' in the + * of-plat-rst documentation. + * + * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST) + * @arg: arguments + */ struct phandle_2_arg { uint idx; int arg[2]; -- cgit v1.1 From f0ab8f9fbe73f2243a959641c909314494b771b6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:09 -0600 Subject: clk: Rename clk_get_by_driver_info() This is actually a misnomer now, since the phandle info may contain a driver_info index or a udevice index. Rename it to use the word 'phandle', which seems more accurate. Add a comment while we are here. Also add a test for this function. Signed-off-by: Simon Glass --- drivers/clk/clk-uclass.c | 7 +++---- drivers/mmc/ftsdc010_mci.c | 2 +- drivers/mmc/rockchip_dw_mmc.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- drivers/spi/rk_spi.c | 2 +- include/clk.h | 31 ++++++++++++++++++++++++++++--- test/dm/of_platdata.c | 19 +++++++++++++++++++ 7 files changed, 54 insertions(+), 11 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 7b1ea07..493018b 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -36,8 +36,8 @@ struct clk *dev_get_clk_ptr(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, - struct clk *clk) +int clk_get_by_phandle(struct udevice *dev, const struct phandle_1_arg *cells, + struct clk *clk) { int ret; @@ -413,6 +413,7 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk) return clk_get_by_index(dev, index, clk); } +#endif /* OF_REAL */ int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk) { @@ -465,8 +466,6 @@ int clk_release_all(struct clk *clk, int count) return 0; } -#endif /* OF_REAL */ - int clk_request(struct udevice *dev, struct clk *clk) { const struct clk_ops *ops; diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index b8cafeb..570d54c 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -433,7 +433,7 @@ static int ftsdc010_mmc_probe(struct udevice *dev) chip->priv = dev; chip->dev_index = 1; memcpy(priv->minmax, dtplat->clock_freq_min_max, sizeof(priv->minmax)); - ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk); + ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->clk); if (ret < 0) return ret; #endif diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 855c0e7..7f8dea1 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -123,7 +123,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev) priv->minmax[0] = 400000; /* 400 kHz */ priv->minmax[1] = dtplat->max_frequency; - ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk); + ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->clk); if (ret < 0) return ret; #else diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index ce33fbb..c0a06dc 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -3107,7 +3107,7 @@ static int rk3399_dmc_init(struct udevice *dev) priv->cic, priv->pmugrf, priv->pmusgrf, priv->pmucru, priv->pmu); #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->ddr_clk); + ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->ddr_clk); #else ret = clk_get_by_index(dev, 0, &priv->ddr_clk); #endif diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 8309a53..cb80be7 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -183,7 +183,7 @@ static int conv_of_plat(struct udevice *dev) plat->base = dtplat->reg[0]; plat->frequency = 20000000; - ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk); + ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->clk); if (ret < 0) return ret; diff --git a/include/clk.h b/include/clk.h index f34401f..a928879 100644 --- a/include/clk.h +++ b/include/clk.h @@ -89,11 +89,36 @@ struct clk_bulk { #if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK) struct phandle_1_arg; -int clk_get_by_driver_info(struct udevice *dev, - struct phandle_1_arg *cells, struct clk *clk); +/** + * clk_get_by_phandle() - Get a clock by its phandle information (of-platadata) + * + * This function is used when of-platdata is enabled. + * + * This looks up a clock using the phandle info. With dtoc, each phandle in the + * 'clocks' property is transformed into an idx representing the device. For + * example: + * + * clocks = <&dpll_mpu_ck 23>; + * + * might result in: + * + * .clocks = {1, {23}},}, + * + * indicating that the clock is udevice idx 1 in dt-plat.c with an argument of + * 23. This function can return a valid clock given the above information. In + * this example it would return a clock containing the 'dpll_mpu_ck' device and + * the clock ID 23. + * + * @dev: Device containing the phandle + * @cells: Phandle info + * @clock: A pointer to a clock struct to initialise + * @return 0 if OK, or a negative error code. + */ +int clk_get_by_phandle(struct udevice *dev, const struct phandle_1_arg *cells, + struct clk *clk); /** - * clk_get_by_index - Get/request a clock by integer index. + * clk_get_by_index() - Get/request a clock by integer index. * * This looks up and requests a clock. The index is relative to the client * device; each device is assumed to have n clocks associated with it somehow, diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c index 0463cf0..c4a2d11 100644 --- a/test/dm/of_platdata.c +++ b/test/dm/of_platdata.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include +#include #include #include #include @@ -222,3 +223,21 @@ static int dm_test_of_plat_parent(struct unit_test_state *uts) } DM_TEST(dm_test_of_plat_parent, UT_TESTF_SCAN_PDATA); #endif + +/* Test clocks with of-platdata */ +static int dm_test_of_plat_clk(struct unit_test_state *uts) +{ + struct dtd_sandbox_clk_test *plat; + struct udevice *dev; + struct clk clk; + + ut_assertok(uclass_first_device_err(UCLASS_MISC, &dev)); + ut_asserteq_str("sandbox_clk_test", dev->name); + plat = dev_get_plat(dev); + + ut_assertok(clk_get_by_phandle(dev, &plat->clocks[0], &clk)); + ut_asserteq_str("sandbox_fixed_clock", clk.dev->name); + + return 0; +} +DM_TEST(dm_test_of_plat_clk, UT_TESTF_SCAN_PDATA); -- cgit v1.1 From f521be6083db98e8e17b5b05626bfa6a0d5acf9b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:10 -0600 Subject: dm: doc: Add a note about of-platdata header files This error can be confusing so mention it specifically in the documentation. Signed-off-by: Simon Glass --- doc/develop/driver-model/of-plat.rst | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 507731a..237af38 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -642,7 +642,7 @@ Missing .compatible or Missing .id ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Various things can cause dtoc to fail to find the driver and it tries to -warn about these. For example: +warn about these. For example:: rockchip_rk3188_uart: Missing .compatible in drivers/serial/serial_rockchip.c : WARNING: the driver rockchip_rk3188_uart was not found in the driver list @@ -733,6 +733,54 @@ The fix above would fix this error too. But if you do want this uclass in the build, check your Kconfig settings to make sure the uclass is being built (CONFIG_MISC in this case). +Another error that can crop up is something like:: + + spl/dts/dt-device.c:257:38: error: invalid application of ‘sizeof’ to + incomplete type ‘struct sandbox_irq_priv’ + 257 | u8 _sandbox_irq_priv_irq_sbox[sizeof(struct sandbox_irq_priv)] + | ^~~~~~ + +This indicates that `struct sandbox_irq_priv` is not defined anywhere. The +solution is to add a DM_HEADER() line, as below, so this is included in the +dt-device.c file:: + + U_BOOT_DRIVER(sandbox_irq) = { + .name = "sandbox_irq", + .id = UCLASS_IRQ, + .of_match = sandbox_irq_ids, + .ops = &sandbox_irq_ops, + .priv_auto = sizeof(struct sandbox_irq_priv), + DM_HEADER() + }; + +Note that there is no dependency checking on the above, so U-Boot will not +regenerate the dt-device.c file when you update the source file (here, +`irq_sandbox.c`). You need to run `make mrproper` first to get a fresh build. + +Another error that can crop up is something like:: + + spl/dts/dt-device.c:257:38: error: invalid application of ‘sizeof’ to + incomplete type ‘struct sandbox_irq_priv’ + 257 | u8 _sandbox_irq_priv_irq_sbox[sizeof(struct sandbox_irq_priv)] + | ^~~~~~ + +This indicates that `struct sandbox_irq_priv` is not defined anywhere. The +solution is to add a DM_HEADER() line, as below, so this is included in the +dt-device.c file:: + + U_BOOT_DRIVER(sandbox_irq) = { + .name = "sandbox_irq", + .id = UCLASS_IRQ, + .of_match = sandbox_irq_ids, + .ops = &sandbox_irq_ops, + .priv_auto = sizeof(struct sandbox_irq_priv), + DM_HEADER() + }; + +Note that there is no dependency checking on the above, so U-Boot will not +regenerate the dt-device.c file when you update the source file (here, +`irq_sandbox.c`). You need to run `make mrproper` first to get a fresh build. + Caveats ------- -- cgit v1.1 From 3e57ad907caa55bab8ba52ef87ddbc5130aede2c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:11 -0600 Subject: irq: Tidy up of-platdata irq support This function is available but not exported. More generally it does not really work as intended. Reimplement it and add a sandbox test too. Signed-off-by: Simon Glass --- arch/sandbox/dts/sandbox.dtsi | 13 +++++++++++++ arch/sandbox/include/asm/irq.h | 20 ++++++++++++++++++++ drivers/misc/Makefile | 2 +- drivers/misc/irq-uclass.c | 10 ++++++++-- drivers/misc/irq_sandbox.c | 15 +++------------ drivers/misc/irq_sandbox_test.c | 22 ++++++++++++++++++++++ include/irq.h | 29 +++++++++++++++++++++++++++++ test/dm/of_platdata.c | 26 ++++++++++++++++++++++---- tools/dtoc/dtb_platdata.py | 1 + 9 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 arch/sandbox/include/asm/irq.h create mode 100644 drivers/misc/irq_sandbox_test.c diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 6cf5f14..1fc9c9b 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -124,6 +124,19 @@ #sound-dai-cells = <1>; }; + irq_sandbox: irq-sbox { + u-boot,dm-spl; + compatible = "sandbox,irq"; + interrupt-controller; + #interrupt-cells = <2>; + }; + + irq-test { + u-boot,dm-spl; + compatible = "sandbox,irq-test"; + interrupts-extended = <&irq_sandbox 3 0>; + }; + lcd { u-boot,dm-pre-proper; compatible = "sandbox,lcd-sdl"; diff --git a/arch/sandbox/include/asm/irq.h b/arch/sandbox/include/asm/irq.h new file mode 100644 index 0000000..f73fec7 --- /dev/null +++ b/arch/sandbox/include/asm/irq.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2021 Google LLC + */ + +#ifndef __SANDBOX_IRQ_H +#define __SANDBOX_IRQ_H + +/** + * struct sandbox_irq_priv - private data for this driver + * + * @count: Counts the number calls to the read_and_clear() method + * @pending: true if an interrupt is pending, else false + */ +struct sandbox_irq_priv { + int count; + bool pending; +}; + +#endif /* __SANDBOX_IRQ_H */ diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index b64cd2a..c16a77c 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -42,7 +42,7 @@ obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o obj-$(CONFIG_IRQ) += irq-uclass.o -obj-$(CONFIG_SANDBOX) += irq_sandbox.o +obj-$(CONFIG_SANDBOX) += irq_sandbox.o irq_sandbox_test.o obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/ diff --git a/drivers/misc/irq-uclass.c b/drivers/misc/irq-uclass.c index 3aa26f6..eb9f3b9 100644 --- a/drivers/misc/irq-uclass.c +++ b/drivers/misc/irq-uclass.c @@ -64,8 +64,8 @@ int irq_read_and_clear(struct irq *irq) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -int irq_get_by_driver_info(struct udevice *dev, - struct phandle_1_arg *cells, struct irq *irq) +int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells, + struct irq *irq) { int ret; @@ -74,6 +74,12 @@ int irq_get_by_driver_info(struct udevice *dev, return ret; irq->id = cells->arg[0]; + /* + * Note: we could call irq_of_xlate_default() here to do this properly. + * For now, this is good enough for existing cases. + */ + irq->flags = cells->arg[1]; + return 0; } #else diff --git a/drivers/misc/irq_sandbox.c b/drivers/misc/irq_sandbox.c index 1f7e62e..8b5573f 100644 --- a/drivers/misc/irq_sandbox.c +++ b/drivers/misc/irq_sandbox.c @@ -9,19 +9,9 @@ #include #include #include +#include #include -/** - * struct sandbox_irq_priv - private data for this driver - * - * @count: Counts the number calls to the read_and_clear() method - * @pending: true if an interrupt is pending, else false - */ -struct sandbox_irq_priv { - int count; - bool pending; -}; - static int sandbox_set_polarity(struct udevice *dev, uint irq, bool active_low) { if (irq > 10) @@ -103,10 +93,11 @@ static const struct udevice_id sandbox_irq_ids[] = { { } }; -U_BOOT_DRIVER(sandbox_irq_drv) = { +U_BOOT_DRIVER(sandbox_irq) = { .name = "sandbox_irq", .id = UCLASS_IRQ, .of_match = sandbox_irq_ids, .ops = &sandbox_irq_ops, .priv_auto = sizeof(struct sandbox_irq_priv), + DM_HEADER() }; diff --git a/drivers/misc/irq_sandbox_test.c b/drivers/misc/irq_sandbox_test.c new file mode 100644 index 0000000..95c45c2 --- /dev/null +++ b/drivers/misc/irq_sandbox_test.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Sandbox driver for testing interrupts with of-platdata + * + * Copyright 2021 Google LLC + */ + +#include +#include +#include +#include + +static const struct udevice_id sandbox_irq_test_ids[] = { + { .compatible = "sandbox,irq-test" }, + { } +}; + +U_BOOT_DRIVER(sandbox_irq_test) = { + .name = "sandbox_irq_test", + .id = UCLASS_MISC, + .of_match = sandbox_irq_test_ids, +}; diff --git a/include/irq.h b/include/irq.h index 8527e4d..a0965e4 100644 --- a/include/irq.h +++ b/include/irq.h @@ -200,6 +200,35 @@ int irq_restore_polarities(struct udevice *dev); */ int irq_read_and_clear(struct irq *irq); +struct phandle_2_arg; +/** + * irq_get_by_phandle() - Get an irq by its phandle information (of-platadata) + * + * This function is used when of-platdata is enabled. + * + * This looks up an irq using the phandle info. With dtoc, each phandle in the + * 'interrupts-extended ' property is transformed into an idx representing the + * device. For example: + * + * interrupts-extended = <&acpi_gpe 0x3c 0>; + * + * might result in: + * + * .interrupts_extended = {6, {0x3c, 0}},}, + * + * indicating that the irq is udevice idx 6 in dt-plat.c with a arguments of + * 0x3c and 0.This function can return a valid irq given the above + * information. In this example it would return an irq containing the + * 'acpi_gpe' device and the irq ID 0x3c. + * + * @dev: Device containing the phandle + * @cells: Phandle info + * @irq: A pointer to a irq struct to initialise + * @return 0 if OK, or a negative error code + */ +int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells, + struct irq *irq); + /** * irq_get_by_index - Get/request an irq by integer index. * diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c index c4a2d11..0829890 100644 --- a/test/dm/of_platdata.c +++ b/test/dm/of_platdata.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -28,11 +29,9 @@ static int dm_test_of_plat_props(struct unit_test_state *uts) struct udevice *dev; int i; - /* Skip the clock */ - ut_assertok(uclass_first_device_err(UCLASS_MISC, &dev)); - ut_asserteq_str("sandbox_clk_test", dev->name); + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_spl_test", + &dev)); - ut_assertok(uclass_next_device_err(&dev)); plat = dev_get_plat(dev); ut_assert(plat->boolval); ut_asserteq(1, plat->intval); @@ -241,3 +240,22 @@ static int dm_test_of_plat_clk(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_of_plat_clk, UT_TESTF_SCAN_PDATA); + +/* Test irqs with of-platdata */ +static int dm_test_of_plat_irq(struct unit_test_state *uts) +{ + struct dtd_sandbox_irq_test *plat; + struct udevice *dev; + struct irq irq; + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_irq_test", + &dev)); + plat = dev_get_plat(dev); + + ut_assertok(irq_get_by_phandle(dev, &plat->interrupts_extended[0], + &irq)); + ut_asserteq_str("sandbox_irq", irq.dev->name); + + return 0; +} +DM_TEST(dm_test_of_plat_irq, UT_TESTF_SCAN_PDATA); diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 869c92b..3bb5c68 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -62,6 +62,7 @@ VAL_PREFIX = 'dtv_' # a phandle property. PHANDLE_PROPS = { 'clocks': '#clock-cells', + 'interrupts-extended': '#interrupt-cells', 'gpios': '#gpio-cells', 'sandbox,emul': '#emul-cells', } -- cgit v1.1 From 48609d0789f811014b33e6eefc2c27c99be7fea7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:12 -0600 Subject: dm: gpio: Add of-platdata support Add support for accessing GPIOs using of-plata. This uses the same mechanism as for clocks, but allows use of the xlate() method so that the driver can interpret the parameters. Update the condition for GPIO_HOG so that it is not built into SPL, since it needs SPL_OF_REAL which is not enabled in sandbox_spl. Signed-off-by: Simon Glass --- arch/sandbox/dts/sandbox.dtsi | 8 +++++++- configs/sandbox_noinst_defconfig | 2 ++ configs/sandbox_spl_defconfig | 2 ++ drivers/gpio/Makefile | 4 ++-- drivers/gpio/gpio-uclass.c | 26 ++++++++++++++++++++++++-- drivers/gpio/sandbox.c | 14 ++++++++++---- drivers/gpio/sandbox_test.c | 21 +++++++++++++++++++++ include/asm-generic/gpio.h | 5 +++++ test/dm/of_platdata.c | 20 ++++++++++++++++++++ 9 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 drivers/gpio/sandbox_test.c diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 1fc9c9b..66b813f 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -66,7 +66,7 @@ }; gpio_b: gpios@1 { - u-boot,dm-pre-proper; + u-boot,dm-spl; gpio-controller; compatible = "sandbox,gpio"; #gpio-cells = <2>; @@ -74,6 +74,12 @@ sandbox,gpio-count = <10>; }; + gpio-test { + u-boot,dm-spl; + compatible = "sandbox,gpio-test"; + test-gpios = <&gpio_b 3 0>; + }; + hexagon { compatible = "demo-simple"; colour = "white"; diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 6469260..b358456 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -1,4 +1,5 @@ CONFIG_SYS_TEXT_BASE=0x200000 +CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 @@ -122,6 +123,7 @@ CONFIG_SANDBOX_GPIO=y CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_I2C_CROS_EC_LDO=y CONFIG_DM_I2C_GPIO=y +# CONFIG_SPL_DM_I2C_GPIO is not set CONFIG_SYS_I2C_SANDBOX=y CONFIG_I2C_MUX=y CONFIG_I2C_ARB_GPIO_CHALLENGE=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 3e9877c..73cf5dd 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -1,4 +1,5 @@ CONFIG_SYS_TEXT_BASE=0x200000 +CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 @@ -124,6 +125,7 @@ CONFIG_SANDBOX_GPIO=y CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_I2C_CROS_EC_LDO=y CONFIG_DM_I2C_GPIO=y +# CONFIG_SPL_DM_I2C_GPIO is not set CONFIG_SYS_I2C_SANDBOX=y CONFIG_I2C_MUX=y CONFIG_I2C_ARB_GPIO_CHALLENGE=y diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 58f4704..1891748 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -33,7 +33,7 @@ obj-$(CONFIG_ROCKCHIP_GPIO) += rk_gpio.o obj-$(CONFIG_RCAR_GPIO) += gpio-rcar.o obj-$(CONFIG_RZA1_GPIO) += gpio-rza1.o obj-$(CONFIG_S5P) += s5p_gpio.o -obj-$(CONFIG_SANDBOX_GPIO) += sandbox.o +obj-$(CONFIG_SANDBOX_GPIO) += sandbox.o sandbox_test.o obj-$(CONFIG_TEGRA_GPIO) += tegra_gpio.o obj-$(CONFIG_TEGRA186_GPIO) += tegra186_gpio.o obj-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o @@ -62,7 +62,7 @@ obj-$(CONFIG_OCTEON_GPIO) += octeon_gpio.o obj-$(CONFIG_MVEBU_GPIO) += mvebu_gpio.o obj-$(CONFIG_MSM_GPIO) += msm_gpio.o obj-$(CONFIG_$(SPL_)PCF8575_GPIO) += pcf8575_gpio.o -obj-$(CONFIG_PM8916_GPIO) += pm8916_gpio.o +obj-$(CONFIG_$(SPL_TPL_)PM8916_GPIO) += pm8916_gpio.o obj-$(CONFIG_MT7620_GPIO) += mt7620_gpio.o obj-$(CONFIG_MT7621_GPIO) += mt7621_gpio.o obj-$(CONFIG_MSCC_SGPIO) += mscc_sgpio.o diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index e0d3ae6..bb2f232 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -231,7 +232,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc, return gpio_xlate_offs_flags(desc->dev, desc, args); } -#if defined(CONFIG_GPIO_HOG) +#if CONFIG_IS_ENABLED(GPIO_HOG) struct gpio_hog_priv { struct gpio_desc gpiod; @@ -1226,6 +1227,27 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name) } #endif /* OF_PLATDATA */ +#if CONFIG_IS_ENABLED(OF_PLATDATA) +int gpio_request_by_phandle(struct udevice *dev, + const struct phandle_2_arg *cells, + struct gpio_desc *desc, int flags) +{ + struct ofnode_phandle_args args; + struct udevice *gpio_dev; + const int index = 0; + int ret; + + ret = device_get_by_ofplat_idx(cells->idx, &gpio_dev); + if (ret) + return ret; + args.args[0] = cells->arg[0]; + args.args[1] = cells->arg[1]; + + return gpio_request_tail(ret, NULL, &args, NULL, index, desc, flags, + index > 0, gpio_dev); +} +#endif + int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc) { /* For now, we don't do any checking of dev */ @@ -1430,7 +1452,7 @@ static int gpio_post_bind(struct udevice *dev) } #endif - if (IS_ENABLED(CONFIG_GPIO_HOG)) { + if (CONFIG_IS_ENABLED(OF_REAL) && IS_ENABLED(CONFIG_GPIO_HOG)) { dev_for_each_subnode(node, dev) { if (ofnode_read_bool(node, "gpio-hog")) { const char *name = ofnode_get_name(node); diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index d008fdd..106b2a7 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -323,11 +323,13 @@ static const struct dm_gpio_ops gpio_sandbox_ops = { static int sandbox_gpio_of_to_plat(struct udevice *dev) { - struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - uc_priv->gpio_count = dev_read_u32_default(dev, "sandbox,gpio-count", - 0); - uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name"); + uc_priv->gpio_count = + dev_read_u32_default(dev, "sandbox,gpio-count", 0); + uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name"); + } return 0; } @@ -371,6 +373,8 @@ U_BOOT_DRIVER(sandbox_gpio) = { DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) +#if CONFIG_IS_ENABLED(PINCTRL) + /* pincontrol: used only to check GPIO pin configuration (pinmux command) */ struct sb_pinctrl_priv { @@ -579,3 +583,5 @@ U_BOOT_DRIVER(sandbox_pinctrl_gpio) = { .priv_auto = sizeof(struct sb_pinctrl_priv), ACPI_OPS_PTR(&pinctrl_sandbox_acpi_ops) }; + +#endif /* PINCTRL */ diff --git a/drivers/gpio/sandbox_test.c b/drivers/gpio/sandbox_test.c new file mode 100644 index 0000000..c76e199 --- /dev/null +++ b/drivers/gpio/sandbox_test.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Sandbox driver for testing GPIOs with of-platdata + * + * Copyright 2021 Google LLC + */ + +#include +#include +#include + +static const struct udevice_id sandbox_gpio_test_ids[] = { + { .compatible = "sandbox,gpio-test" }, + { } +}; + +U_BOOT_DRIVER(sandbox_gpio_test) = { + .name = "sandbox_gpio_test", + .id = UCLASS_MISC, + .of_match = sandbox_gpio_test_ids, +}; diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index e33cde7..6de13d9 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -608,6 +608,11 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name, */ int dm_gpio_request(struct gpio_desc *desc, const char *label); +struct phandle_2_arg; +int gpio_request_by_phandle(struct udevice *dev, + const struct phandle_2_arg *cells, + struct gpio_desc *desc, int flags); + /** * gpio_get_list_count() - Returns the number of GPIOs in a list * diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c index 0829890..ec41087 100644 --- a/test/dm/of_platdata.c +++ b/test/dm/of_platdata.c @@ -8,6 +8,7 @@ #include #include #include +#include #include /* Test that we can find a device using of-platdata */ @@ -259,3 +260,22 @@ static int dm_test_of_plat_irq(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_of_plat_irq, UT_TESTF_SCAN_PDATA); + +/* Test GPIOs with of-platdata */ +static int dm_test_of_plat_gpio(struct unit_test_state *uts) +{ + struct dtd_sandbox_gpio_test *plat; + struct udevice *dev; + struct gpio_desc desc; + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_gpio_test", + &dev)); + plat = dev_get_plat(dev); + + ut_assertok(gpio_request_by_phandle(dev, &plat->test_gpios[0], &desc, + GPIOD_IS_OUT)); + ut_asserteq_str("sandbox_gpio", desc.dev->name); + + return 0; +} +DM_TEST(dm_test_of_plat_gpio, UT_TESTF_SCAN_PDATA); -- cgit v1.1 From 8ae8da10b339349586daad0ceb5c0cb655b5ef6d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 28 Aug 2021 11:42:08 +0200 Subject: sandbox: correct cpu nodes The cpu nodes in arch/sandbox/dts/test.dts should conform to the devicetree specification: * property device_type must be set to "cpu" * the reg property must be provided * the cpu nodes must have an address Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- arch/sandbox/dts/test.dts | 14 +++++++++++--- drivers/cpu/cpu_sandbox.c | 2 +- test/dm/cpu.c | 2 +- test/dm/timer.c | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 2dfae1c..e27d106 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -824,19 +824,27 @@ }; cpus { + #address-cells = <1>; + #size-cells = <0>; timebase-frequency = <2000000>; - cpu-test1 { + cpu1: cpu@1 { + device_type = "cpu"; + reg = <0x1>; timebase-frequency = <3000000>; compatible = "sandbox,cpu_sandbox"; u-boot,dm-pre-reloc; }; - cpu-test2 { + cpu2: cpu@2 { + device_type = "cpu"; + reg = <0x2>; compatible = "sandbox,cpu_sandbox"; u-boot,dm-pre-reloc; }; - cpu-test3 { + cpu3: cpu@3 { + device_type = "cpu"; + reg = <0x3>; compatible = "sandbox,cpu_sandbox"; u-boot,dm-pre-reloc; }; diff --git a/drivers/cpu/cpu_sandbox.c b/drivers/cpu/cpu_sandbox.c index fe6772b..2e871fe3 100644 --- a/drivers/cpu/cpu_sandbox.c +++ b/drivers/cpu/cpu_sandbox.c @@ -38,7 +38,7 @@ static int cpu_sandbox_get_vendor(const struct udevice *dev, char *buf, return 0; } -static const char *cpu_current = "cpu-test1"; +static const char *cpu_current = "cpu@1"; void cpu_sandbox_set_current(const char *name) { diff --git a/test/dm/cpu.c b/test/dm/cpu.c index ed12caf..d7e596ee 100644 --- a/test/dm/cpu.c +++ b/test/dm/cpu.c @@ -27,7 +27,7 @@ static int dm_test_cpu(struct unit_test_state *uts) uclass_find_next_device(&dev)) ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED); - ut_assertok(uclass_get_device_by_name(UCLASS_CPU, "cpu-test1", &dev)); + ut_assertok(uclass_get_device_by_name(UCLASS_CPU, "cpu@1", &dev)); ut_asserteq_ptr(cpu_get_current_dev(), dev); ut_asserteq(cpu_is_current(dev), 1); diff --git a/test/dm/timer.c b/test/dm/timer.c index 70043b9..9f94d47 100644 --- a/test/dm/timer.c +++ b/test/dm/timer.c @@ -33,16 +33,16 @@ static int dm_test_timer_timebase_fallback(struct unit_test_state *uts) { struct udevice *dev; - cpu_sandbox_set_current("cpu-test1"); + cpu_sandbox_set_current("cpu@1"); ut_assertok(uclass_get_device_by_name(UCLASS_TIMER, "timer@1", &dev)); ut_asserteq(3000000, timer_get_rate(dev)); ut_assertok(device_remove(dev, DM_REMOVE_NORMAL)); - cpu_sandbox_set_current("cpu-test2"); + cpu_sandbox_set_current("cpu@2"); ut_assertok(uclass_get_device_by_name(UCLASS_TIMER, "timer@1", &dev)); ut_asserteq(2000000, timer_get_rate(dev)); - cpu_sandbox_set_current("cpu-test1"); + cpu_sandbox_set_current("cpu@1"); return 0; } -- cgit v1.1 From 2348e72d6d56129cf84c5c98cf9d5631efb098e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 7 Sep 2021 18:07:08 +0200 Subject: dm: pci: Fix handling of errors when scanning device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some PCIe controller's read_config() method support indicating error directly via return value, but some cannot distinguish all-ones (or all-zeros) read response from an error. The current code in pci_bind_bus_devices() interprets all-ones / all-zeros in PCI_VENDOR_ID register as "nothing connected", and continues the cycle, but an error returned via return value breaks the cycle. This is wrong for the PCIe controllers which return this error via return value. Handle all errors when reading PCI_VENDOR_ID the same way. This fixes enumeration of PCI devices for example when there is a PCI bridge connected behind another PCI bridge and not all ports are connected to a device, and the controller (for example Aardvark) translates the UR error (Unsupported Request) as -EOPNOTSUPP. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Bin Meng Reviewed-by: Stefan Roese --- drivers/pci/pci-uclass.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index ce2eb5d..4d0e938 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -856,10 +856,7 @@ int pci_bind_bus_devices(struct udevice *bus) /* Check only the first access, we don't expect problems */ ret = pci_bus_read_config(bus, bdf, PCI_VENDOR_ID, &vendor, PCI_SIZE_16); - if (ret) - goto error; - - if (vendor == 0xffff || vendor == 0x0000) + if (ret || vendor == 0xffff || vendor == 0x0000) continue; pci_bus_read_config(bus, bdf, PCI_HEADER_TYPE, @@ -940,10 +937,6 @@ int pci_bind_bus_devices(struct udevice *bus) } return 0; -error: - printf("Cannot read bus configuration: %d\n", ret); - - return ret; } static void decode_regions(struct pci_controller *hose, ofnode parent_node, -- cgit v1.1 From 933bf2644591281ed96f9d5771cbb35fe95bcb00 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sat, 18 Sep 2021 17:37:23 +0800 Subject: fdt_support.h: Remove duplicated declarations There are two duplicated declarations for ft_cpu_setup() and ft_pci_setup(). Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- include/fdt_support.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/fdt_support.h b/include/fdt_support.h index f6f46bb..72a5b90 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -203,8 +203,6 @@ char *board_fdt_chosen_bootargs(void); * called at the end of the image_setup_libfdt() is to do that convertion. */ void ft_board_setup_ex(void *blob, struct bd_info *bd); -void ft_cpu_setup(void *blob, struct bd_info *bd); -void ft_pci_setup(void *blob, struct bd_info *bd); /** * Add system-specific data to the FDT before booting the OS. -- cgit v1.1