From 77007f9543a0fac8c4f60800de6ddccfacd9af5d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 31 May 2020 13:44:51 +0000 Subject: log: check argument of 'log level' command Check that the argument provided to the 'log level' command is in the range between zero and CONFIG_LOG_MAX_LEVEL. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/log.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/log.c b/cmd/log.c index 664f7bd7ac4..78352b2cb91 100644 --- a/cmd/log.c +++ b/cmd/log.c @@ -14,10 +14,18 @@ static char log_fmt_chars[LOGF_COUNT] = "clFLfm"; static int do_log_level(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - if (argc > 1) - gd->default_log_level = simple_strtol(argv[1], NULL, 10); - else + if (argc > 1) { + long log_level = simple_strtol(argv[1], NULL, 10); + + if (log_level < 0 || log_level > _LOG_MAX_LEVEL) { + printf("Only log levels <= %d are supported\n", + _LOG_MAX_LEVEL); + return CMD_RET_FAILURE; + } + gd->default_log_level = log_level; + } else { printf("Default log level: %d\n", gd->default_log_level); + } return 0; } -- cgit v1.3.1 From 808f13d8fc38959dc90de7243029141e758a5c0a Mon Sep 17 00:00:00 2001 From: "Krebs, Olaf" Date: Mon, 9 Mar 2020 14:27:55 +0000 Subject: net: Fix error if some network features are disabled If 'CONFIG_CMD_TFTPBOOT' or 'CONFIG_CMD_BOOTP' are disabled, the usage must be disabled, too! Signed-off-by: Olaf Krebs CC: Joe Hershberger --- cmd/net.c | 6 ++++++ net/net.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/net.c b/cmd/net.c index 25390b0474f..9bbcdbcfe07 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -135,11 +135,15 @@ static void netboot_update_env(void) env_set("netmask", tmp); } +#ifdef CONFIG_CMD_BOOTP if (net_hostname[0]) env_set("hostname", net_hostname); +#endif +#ifdef CONFIG_CMD_BOOTP if (net_root_path[0]) env_set("rootpath", net_root_path); +#endif if (net_ip.s_addr) { ip_to_string(net_ip, tmp); @@ -165,8 +169,10 @@ static void netboot_update_env(void) env_set("dnsip2", tmp); } #endif +#ifdef CONFIG_CMD_BOOTP if (net_nis_domain[0]) env_set("domain", net_nis_domain); +#endif #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET) if (net_ntp_time_offset) { diff --git a/net/net.c b/net/net.c index 37932919d04..11683dd6d09 100644 --- a/net/net.c +++ b/net/net.c @@ -456,6 +456,7 @@ restart: net_dev_exists = 1; net_boot_file_size = 0; switch (protocol) { +#ifdef CONFIG_CMD_TFTPBOOT case TFTPGET: #ifdef CONFIG_CMD_TFTPPUT case TFTPPUT: @@ -463,6 +464,7 @@ restart: /* always use ARP to get server ethernet address */ tftp_start(protocol); break; +#endif #ifdef CONFIG_CMD_TFTPSRV case TFTPSRV: tftp_start_server(); @@ -480,13 +482,13 @@ restart: dhcp_request(); /* Basically same as BOOTP */ break; #endif - +#if defined(CONFIG_CMD_BOOTP) case BOOTP: bootp_reset(); net_ip.s_addr = 0; bootp_request(); break; - +#endif #if defined(CONFIG_CMD_RARP) case RARP: rarp_try = 0; -- cgit v1.3.1 From 1af9756db8f04ea5c3243929a157058d32e293bf Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:28 -0600 Subject: bdinfo: xtensa: Create a generic do_bdinfo for xtensa This arch uses only the generic function. It would be nice if all the archs did the same. As a first step, create a new generic function for the 'bd' command and make xtensa use it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index dba552b03fb..83fea50ac17 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -476,14 +476,20 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #elif defined(CONFIG_XTENSA) +#define USE_GENERIC + +#else + #error "a case for this architecture does not exist!" +#endif + +/* Temporary check for archs that use generic bdinfo. Eventually all will */ +#ifdef USE_GENERIC int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { print_std_bdinfo(gd->bd); + return 0; } - -#else - #error "a case for this architecture does not exist!" #endif /* -------------------------------------------------------------------- */ -- cgit v1.3.1 From df529b5a77876481725642bf4aa83869ffc7f492 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:29 -0600 Subject: bdinfo: mips: Use the generic bd command MIPS currently has a few extra things which are generally useful. Add them to the generic function and move MIPS over to use it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Daniel Schwierzeck --- cmd/bdinfo.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 83fea50ac17..761bcc18621 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -301,15 +301,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #elif defined(CONFIG_MIPS) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - print_std_bdinfo(gd->bd); - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_ARM) @@ -487,6 +479,9 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { print_std_bdinfo(gd->bd); + print_num("relocaddr", gd->relocaddr); + print_num("reloc off", gd->reloc_off); + print_cpu_word_size(); return 0; } -- cgit v1.3.1 From 08c56d19175aad4824b16d4312f8486646a53ed1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:30 -0600 Subject: bdinfo: nios2: Use the generic bd command Nios2 currently has some code to output SRAM information which is behind an #ifdef. No nios2 boards define this option, so the code can be removed. Move Nios2 over to use the generic function. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 761bcc18621..a8f25cc2fbf 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -222,24 +222,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #elif defined(CONFIG_NIOS2) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_dram(bd); - print_bi_flash(bd); - -#if defined(CONFIG_SYS_SRAM_BASE) - print_num ("sram start", (ulong)bd->bi_sramstart); - print_num ("sram size", (ulong)bd->bi_sramsize); -#endif - - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_MICROBLAZE) -- cgit v1.3.1 From 271db508cc9c6490f6aee2da2f8707c52738c738 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:31 -0600 Subject: bdinfo: microblaze: Use the generic bd command Microblaze prints out ethernet and FDT information. This is useful to most archs, so move it into the generic code and move microblaze over to use it. Note that FDT information is shown for all boards, since they should be using device tree by now. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index a8f25cc2fbf..16e7ad0fa5a 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -226,29 +226,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #elif defined(CONFIG_MICROBLAZE) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_dram(bd); - print_bi_flash(bd); -#if defined(CONFIG_SYS_SRAM_BASE) - print_num("sram start ", (ulong)bd->bi_sramstart); - print_num("sram size ", (ulong)bd->bi_sramsize); -#endif -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) - print_eths(); -#endif - print_baudrate(); - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); - print_num("fdt_blob", (ulong)gd->fdt_blob); - print_num("new_fdt", (ulong)gd->new_fdt); - print_num("fdt_size", (ulong)gd->fdt_size); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_M68K) @@ -465,6 +443,12 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); print_cpu_word_size(); +#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) + print_eths(); +#endif + print_num("fdt_blob", (ulong)gd->fdt_blob); + print_num("new_fdt", (ulong)gd->new_fdt); + print_num("fdt_size", (ulong)gd->fdt_size); return 0; } -- cgit v1.3.1 From f41b830f24095a2d4aebd6e559d2153f0ccc07b1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:32 -0600 Subject: bdinfo: sh: Use the generic bd command This arch has no code that is not already in the generic function. Drop the arch-specific function and change sh over to use the generic one. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 16e7ad0fa5a..65c64786c0f 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -327,18 +327,7 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #elif defined(CONFIG_SH) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_mem(bd); - print_bi_flash(bd); - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_X86) -- cgit v1.3.1 From 41ec71d184f958ed01a6037536892fd4e645d562 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:33 -0600 Subject: bdinfo: x86: Use the generic bd command This arch shows 'ethspeed' info but only the freescale drivers use it, so it can be dropped. It also calls print_bi_dram() which is safe to call from any arch since it has an #ifdef inside it. Add this to the generic do_bdinfo() and move x86 over to use it. Put it first since pytests rely on seeing it before memstart in find_ram_base(). Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 65c64786c0f..41d396a170a 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -331,25 +331,7 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #elif defined(CONFIG_X86) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_boot_params(bd); - - print_bi_dram(bd); - - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); -#if defined(CONFIG_CMD_NET) - print_eth_ip_addr(); - print_mhz("ethspeed", bd->bi_ethspeed); -#endif - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_SANDBOX) @@ -428,6 +410,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #ifdef USE_GENERIC int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + print_bi_dram(gd->bd); print_std_bdinfo(gd->bd); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); -- cgit v1.3.1 From c66981ccbda837f556ef4ed89d9f9ce93d2adf12 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:34 -0600 Subject: bdinfo: sandbox: Use the generic bd command Sandbox has a printout of 'FB base' but this code is not used since sandbox uses driver model for everything. Move sandbox over to use the generic do_bdinfo(). Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 41d396a170a..8d1aeefa8ea 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -335,21 +335,7 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #elif defined(CONFIG_SANDBOX) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_boot_params(bd); - print_bi_dram(bd); - print_eth_ip_addr(); - -#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) - print_num("FB base ", gd->fb_base); -#endif - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_NDS32) -- cgit v1.3.1 From aa6b898fb13e978e17f0cd2010408886438357ce Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:35 -0600 Subject: bdinfo: nds32: Use the generic bd command This arch has none of its own info to show. Move it over to use the generic do_bdinfo(). Signed-off-by: Simon Glass Reviewed-by: Rick Chen Reviewed-by: Bin Meng --- cmd/bdinfo.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 8d1aeefa8ea..a3e15b15554 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -339,19 +339,7 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #elif defined(CONFIG_NDS32) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_num("arch_number", bd->bi_arch_number); - print_bi_boot_params(bd); - print_bi_dram(bd); - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_RISCV) -- cgit v1.3.1 From 628c85aec0a2034e69f56a876132e66c9eb864ff Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:36 -0600 Subject: bdinfo: riscv: Use the generic bd command This arch has none of its own info to show. Move it over to use the generic do_bdinfo(). Signed-off-by: Simon Glass Reviewed-by: Rick Chen Reviewed-by: Bin Meng --- cmd/bdinfo.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index a3e15b15554..c1865d6d3e9 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -343,20 +343,7 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #elif defined(CONFIG_RISCV) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_boot_params(bd); - print_bi_dram(bd); - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_ARC) -- cgit v1.3.1 From 2e0fa21785ad24da212f49553a7d1775f4eaca95 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:37 -0600 Subject: bdinfo: powerpc: Use the generic bd command Unfortunately PowerPC has a lot of special stuff. Move it into the generic function for now, so we can have it all in one place. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 89 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 48 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index c1865d6d3e9..5ff11db9af5 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -172,53 +172,8 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) } #if defined(CONFIG_PPC) -void __weak board_detail(void) -{ - /* Please define board_detail() for your platform */ -} - -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - -#ifdef DEBUG - print_num("bd address", (ulong)bd); -#endif - print_bi_mem(bd); - print_bi_flash(bd); - print_num("sramstart", bd->bi_sramstart); - print_num("sramsize", bd->bi_sramsize); -#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) - print_num("immr_base", bd->bi_immr_base); -#endif - print_num("bootflags", bd->bi_bootflags); -#if defined(CONFIG_CPM2) - print_mhz("vco", bd->bi_vco); - print_mhz("sccfreq", bd->bi_sccfreq); - print_mhz("brgfreq", bd->bi_brgfreq); -#endif - print_mhz("intfreq", bd->bi_intfreq); -#if defined(CONFIG_CPM2) - print_mhz("cpmfreq", bd->bi_cpmfreq); -#endif - print_mhz("busfreq", bd->bi_busfreq); - -#ifdef CONFIG_ENABLE_36BIT_PHYS -#ifdef CONFIG_PHYS_64BIT - puts("addressing = 36-bit\n"); -#else - puts("addressing = 32-bit\n"); -#endif -#endif - - print_eth_ip_addr(); - print_baudrate(); - print_num("relocaddr", gd->relocaddr); - board_detail(); - print_cpu_word_size(); - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_NIOS2) @@ -369,10 +324,20 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) /* Temporary check for archs that use generic bdinfo. Eventually all will */ #ifdef USE_GENERIC +void __weak board_detail(void) +{ + /* Please define board_detail() for your PPC platform */ +} + int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - print_bi_dram(gd->bd); - print_std_bdinfo(gd->bd); + bd_t *bd = gd->bd; + +#ifdef DEBUG + print_num("bd address", (ulong)bd); +#endif + print_bi_dram(bd); + print_std_bdinfo(bd); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); print_cpu_word_size(); @@ -383,6 +348,34 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("new_fdt", (ulong)gd->new_fdt); print_num("fdt_size", (ulong)gd->fdt_size); + /* This section is used only by ppc */ +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) + print_num("immr_base", bd->bi_immr_base); +#endif + if (IS_ENABLED(CONFIG_PPC)) { + print_num("bootflags", bd->bi_bootflags); + print_mhz("intfreq", bd->bi_intfreq); +#ifdef CONFIG_ENABLE_36BIT_PHYS + if (IS_ENABLED(CONFIG_PHYS_64BIT)) + puts("addressing = 36-bit\n"); + else + puts("addressing = 32-bit\n"); +#endif + print_mhz("busfreq", bd->bi_busfreq); + board_detail(); + } +#if defined(CONFIG_CPM2) + print_mhz("cpmfreq", bd->bi_cpmfreq); + print_mhz("vco", bd->bi_vco); + print_mhz("sccfreq", bd->bi_sccfreq); + print_mhz("brgfreq", bd->bi_brgfreq); +#endif + +#if defined(CONFIG_SYS_INIT_RAM_ADDR) + print_num("sramstart", (ulong)bd->bi_sramstart); + print_num("sramsize", (ulong)bd->bi_sramsize); +#endif + return 0; } #endif -- cgit v1.3.1 From 67145d19412695b3299f093a2d9d1b3feb028b23 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:38 -0600 Subject: bdinfo: m68k: Use the generic bd command Unfortunately m68k has a lot of special stuff. Move it into the generic function for now, so we can have it all in one place. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 5ff11db9af5..9585d6a37ae 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -185,35 +185,7 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) #elif defined(CONFIG_M68K) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_mem(bd); - print_bi_flash(bd); -#if defined(CONFIG_SYS_INIT_RAM_ADDR) - print_num("sramstart", (ulong)bd->bi_sramstart); - print_num("sramsize", (ulong)bd->bi_sramsize); -#endif -#if defined(CONFIG_SYS_MBAR) - print_num("mbar", bd->bi_mbar_base); -#endif - print_mhz("cpufreq", bd->bi_intfreq); - print_mhz("busfreq", bd->bi_busfreq); -#ifdef CONFIG_PCI - print_mhz("pcifreq", bd->bi_pcifreq); -#endif -#ifdef CONFIG_EXTRA_CLOCK - print_mhz("flbfreq", bd->bi_flbfreq); - print_mhz("inpfreq", bd->bi_inpfreq); - print_mhz("vcofreq", bd->bi_vcofreq); -#endif - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_MIPS) @@ -361,7 +333,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) else puts("addressing = 32-bit\n"); #endif - print_mhz("busfreq", bd->bi_busfreq); board_detail(); } #if defined(CONFIG_CPM2) @@ -371,9 +342,27 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_mhz("brgfreq", bd->bi_brgfreq); #endif + /* This is used by m68k and ppc */ #if defined(CONFIG_SYS_INIT_RAM_ADDR) print_num("sramstart", (ulong)bd->bi_sramstart); print_num("sramsize", (ulong)bd->bi_sramsize); +#endif + if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K)) + print_mhz("busfreq", bd->bi_busfreq); + + /* The rest are used only by m68k */ +#ifdef CONFIG_M68K +#if defined(CONFIG_SYS_MBAR) + print_num("mbar", bd->bi_mbar_base); +#endif + print_mhz("cpufreq", bd->bi_intfreq); + if (IS_ENABLED(CONFIG_PCI)) + print_mhz("pcifreq", bd->bi_pcifreq); +#ifdef CONFIG_EXTRA_CLOCK + print_mhz("flbfreq", bd->bi_flbfreq); + print_mhz("inpfreq", bd->bi_inpfreq); + print_mhz("vcofreq", bd->bi_vcofreq); +#endif #endif return 0; -- cgit v1.3.1 From 1aeeaeb56e03610250075943b546b9e913b099b0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:39 -0600 Subject: bdinfo: arm: Use the generic bd command Unfortunately ARM has a lot of special stuff. Move it into the generic function for now, so we can have it all in one place. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 102 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 44 insertions(+), 58 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 9585d6a37ae..996fb5d06fa 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -193,64 +193,7 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) #elif defined(CONFIG_ARM) -static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_num("arch_number", bd->bi_arch_number); - print_bi_boot_params(bd); - print_bi_dram(bd); - -#ifdef CONFIG_SYS_MEM_RESERVE_SECURE - if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) { - print_num("Secure ram", - gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK); - } -#endif -#ifdef CONFIG_RESV_RAM - if (gd->arch.resv_ram) - print_num("Reserved ram", gd->arch.resv_ram); -#endif -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) - print_eths(); -#endif - print_baudrate(); -#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) - print_num("TLB addr", gd->arch.tlb_addr); -#endif - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); - print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ - print_num("sp start ", gd->start_addr_sp); -#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) - print_num("FB base ", gd->fb_base); -#endif - /* - * TODO: Currently only support for davinci SOC's is added. - * Remove this check once all the board implement this. - */ -#ifdef CONFIG_CLOCKS - printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq); - printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq); - printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq); -#endif -#ifdef CONFIG_BOARD_TYPES - printf("Board Type = %ld\n", gd->board_type); -#endif -#if CONFIG_VAL(SYS_MALLOC_F_LEN) - printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr, - CONFIG_VAL(SYS_MALLOC_F_LEN)); -#endif -#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) - print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); -#endif - if (gd->fdt_blob) - print_num("fdt_blob", (ulong)gd->fdt_blob); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_SH) @@ -308,6 +251,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #ifdef DEBUG print_num("bd address", (ulong)bd); #endif + if (IS_ENABLED(CONFIG_ARM)) + print_num("arch_number", bd->bi_arch_number); print_bi_dram(bd); print_std_bdinfo(bd); print_num("relocaddr", gd->relocaddr); @@ -319,6 +264,47 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("fdt_blob", (ulong)gd->fdt_blob); print_num("new_fdt", (ulong)gd->new_fdt); print_num("fdt_size", (ulong)gd->fdt_size); +#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) + print_num("FB base ", gd->fb_base); +#endif + + /* This section is used only by ARM */ +#ifdef CONFIG_ARM +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE + if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) { + print_num("Secure ram", + gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK); + } +#endif +#ifdef CONFIG_RESV_RAM + if (gd->arch.resv_ram) + print_num("Reserved ram", gd->arch.resv_ram); +#endif +#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) + print_num("TLB addr", gd->arch.tlb_addr); +#endif + print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ + print_num("sp start ", gd->start_addr_sp); + /* + * TODO: Currently only support for davinci SOC's is added. + * Remove this check once all the board implement this. + */ +#ifdef CONFIG_CLOCKS + printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq); + printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq); + printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq); +#endif +#ifdef CONFIG_BOARD_TYPES + printf("Board Type = %ld\n", gd->board_type); +#endif +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr, + CONFIG_VAL(SYS_MALLOC_F_LEN)); +#endif +#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) + print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); +#endif +#endif /* CONFIG_ARM */ /* This section is used only by ppc */ #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) -- cgit v1.3.1 From e227c27393d9d3391288e68623751a448a973b79 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:40 -0600 Subject: bdinfo: arc: Use the generic bd command There is nothing new in the arc 'bd' command beyond what is already there. Switch it over to use the generic code. Signed-off-by: Simon Glass Acked-by: Alexey Brodkin Reviewed-by: Bin Meng --- cmd/bdinfo.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 996fb5d06fa..d2dcda91abb 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -217,17 +217,7 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) #elif defined(CONFIG_ARC) -int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - bd_t *bd = gd->bd; - - print_bi_mem(bd); - print_eth_ip_addr(); - print_baudrate(); - print_cpu_word_size(); - - return 0; -} +#define USE_GENERIC #elif defined(CONFIG_XTENSA) -- cgit v1.3.1 From e01ce34bb0cb33aad17f5df15d74cd8846f80c23 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:41 -0600 Subject: bdinfo: Drop the option to not use the generic 'bd' command Now that all architectures are using the generic do_bdinfo(), drop the option to not use it. When new architectures are added, they will get at least some useful information from the generic implementation. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 59 ----------------------------------------------------------- 1 file changed, 59 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index d2dcda91abb..df24994929e 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -171,64 +171,6 @@ static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) print_baudrate(); } -#if defined(CONFIG_PPC) - -#define USE_GENERIC - -#elif defined(CONFIG_NIOS2) - -#define USE_GENERIC - -#elif defined(CONFIG_MICROBLAZE) - -#define USE_GENERIC - -#elif defined(CONFIG_M68K) - -#define USE_GENERIC - -#elif defined(CONFIG_MIPS) - -#define USE_GENERIC - -#elif defined(CONFIG_ARM) - -#define USE_GENERIC - -#elif defined(CONFIG_SH) - -#define USE_GENERIC - -#elif defined(CONFIG_X86) - -#define USE_GENERIC - -#elif defined(CONFIG_SANDBOX) - -#define USE_GENERIC - -#elif defined(CONFIG_NDS32) - -#define USE_GENERIC - -#elif defined(CONFIG_RISCV) - -#define USE_GENERIC - -#elif defined(CONFIG_ARC) - -#define USE_GENERIC - -#elif defined(CONFIG_XTENSA) - -#define USE_GENERIC - -#else - #error "a case for this architecture does not exist!" -#endif - -/* Temporary check for archs that use generic bdinfo. Eventually all will */ -#ifdef USE_GENERIC void __weak board_detail(void) { /* Please define board_detail() for your PPC platform */ @@ -343,7 +285,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 0; } -#endif /* -------------------------------------------------------------------- */ -- cgit v1.3.1 From 7d81641ba9984db472798b1c9b059e019c8b1bc0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:42 -0600 Subject: bdinfo: Drop unused __maybe_unused Some of these are not needed now. Drop them to avoid cluttering the code. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index df24994929e..96888c5fed7 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -17,12 +17,11 @@ DECLARE_GLOBAL_DATA_PTR; -__maybe_unused void print_cpu_word_size(void) +void print_cpu_word_size(void) { printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); } -__maybe_unused static void print_num(const char *name, ulong value) { printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value); @@ -63,13 +62,11 @@ static void print_eths(void) } #endif -__maybe_unused static void print_lnum(const char *name, unsigned long long value) { printf("%-12s= 0x%.8llX\n", name, value); } -__maybe_unused static void print_mhz(const char *name, unsigned long hz) { char buf[32]; @@ -162,7 +159,7 @@ static inline void print_baudrate(void) #endif } -static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) +static inline void print_std_bdinfo(const bd_t *bd) { print_bi_boot_params(bd); print_bi_mem(bd); -- cgit v1.3.1 From 566ffde8e19ac683e9d0836716de8ee090a56bf8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:43 -0600 Subject: bdinfo: microblaze: sh: nios2: Drop arch-specific flash info The differences these architectures have are minor and not worth the extra code. Use the generic version always. Tidy up the code style by removing unnecessary tabs. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 96888c5fed7..228835d0564 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -111,20 +111,9 @@ static inline void print_bi_dram(const bd_t *bd) static inline void print_bi_flash(const bd_t *bd) { -#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_SH) - print_num("flash start ", (ulong)bd->bi_flashstart); - print_num("flash size ", (ulong)bd->bi_flashsize); - print_num("flash offset ", (ulong)bd->bi_flashoffset); - -#elif defined(CONFIG_NIOS2) - print_num("flash start", (ulong)bd->bi_flashstart); - print_num("flash size", (ulong)bd->bi_flashsize); - print_num("flash offset", (ulong)bd->bi_flashoffset); -#else - print_num("flashstart", (ulong)bd->bi_flashstart); - print_num("flashsize", (ulong)bd->bi_flashsize); - print_num("flashoffset", (ulong)bd->bi_flashoffset); -#endif + print_num("flashstart", (ulong)bd->bi_flashstart); + print_num("flashsize", (ulong)bd->bi_flashsize); + print_num("flashoffset", (ulong)bd->bi_flashoffset); } static inline void print_eth_ip_addr(void) -- cgit v1.3.1 From d67de00eb6d62b52d0ccafb2d80c290079a6f0f6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:44 -0600 Subject: bdinfo: Drop unnecessary inline on functions This serves no purpose since the compiler will inline the functions automatically. Drop use of inline in this file. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 228835d0564..f4f1ba711ea 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -75,12 +75,12 @@ static void print_mhz(const char *name, unsigned long hz) } -static inline void print_bi_boot_params(const bd_t *bd) +static void print_bi_boot_params(const bd_t *bd) { print_num("boot_params", (ulong)bd->bi_boot_params); } -static inline void print_bi_mem(const bd_t *bd) +static void print_bi_mem(const bd_t *bd) { #if defined(CONFIG_SH) print_num("mem start ", (ulong)bd->bi_memstart); @@ -94,7 +94,7 @@ static inline void print_bi_mem(const bd_t *bd) #endif } -static inline void print_bi_dram(const bd_t *bd) +static void print_bi_dram(const bd_t *bd) { #ifdef CONFIG_NR_DRAM_BANKS int i; @@ -109,14 +109,14 @@ static inline void print_bi_dram(const bd_t *bd) #endif } -static inline void print_bi_flash(const bd_t *bd) +static void print_bi_flash(const bd_t *bd) { print_num("flashstart", (ulong)bd->bi_flashstart); print_num("flashsize", (ulong)bd->bi_flashsize); print_num("flashoffset", (ulong)bd->bi_flashoffset); } -static inline void print_eth_ip_addr(void) +static void print_eth_ip_addr(void) { #if defined(CONFIG_CMD_NET) print_eth(0); @@ -139,7 +139,7 @@ static inline void print_eth_ip_addr(void) #endif } -static inline void print_baudrate(void) +static void print_baudrate(void) { #if defined(CONFIG_PPC) printf("baudrate = %6u bps\n", gd->baudrate); @@ -148,7 +148,7 @@ static inline void print_baudrate(void) #endif } -static inline void print_std_bdinfo(const bd_t *bd) +static void print_std_bdinfo(const bd_t *bd) { print_bi_boot_params(bd); print_bi_mem(bd); -- cgit v1.3.1 From 9e24e10b7bfe1fc7ca3971dbb5c8e3e781dd6db3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:45 -0600 Subject: bdinfo: Drop print_std_bdinfo() Everything in this function is standard now so it serves no purpose. Move it into the generic do_bdinfo() function. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index f4f1ba711ea..77a0cf14e08 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -148,15 +148,6 @@ static void print_baudrate(void) #endif } -static void print_std_bdinfo(const bd_t *bd) -{ - print_bi_boot_params(bd); - print_bi_mem(bd); - print_bi_flash(bd); - print_eth_ip_addr(); - print_baudrate(); -} - void __weak board_detail(void) { /* Please define board_detail() for your PPC platform */ @@ -171,8 +162,12 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #endif if (IS_ENABLED(CONFIG_ARM)) print_num("arch_number", bd->bi_arch_number); + print_bi_boot_params(bd); print_bi_dram(bd); - print_std_bdinfo(bd); + print_bi_mem(bd); + print_bi_flash(bd); + print_eth_ip_addr(); + print_baudrate(); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); print_cpu_word_size(); -- cgit v1.3.1 From 3e1cca2a2f6245a98b86e23222908dee234542e2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:46 -0600 Subject: bdinfo: ppc: Drop arch-specific print_baudrate() This function outputs the same basic info. Since the baud rate is commonly 115200 these is often no difference. Drop the arch-specific code and inline it to avoid a one-line function. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Stefan Roese --- cmd/bdinfo.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 77a0cf14e08..60bfb4e1da9 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -139,15 +139,6 @@ static void print_eth_ip_addr(void) #endif } -static void print_baudrate(void) -{ -#if defined(CONFIG_PPC) - printf("baudrate = %6u bps\n", gd->baudrate); -#else - printf("baudrate = %u bps\n", gd->baudrate); -#endif -} - void __weak board_detail(void) { /* Please define board_detail() for your PPC platform */ @@ -167,7 +158,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_bi_mem(bd); print_bi_flash(bd); print_eth_ip_addr(); - print_baudrate(); + printf("baudrate = %u bps\n", gd->baudrate); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); print_cpu_word_size(); -- cgit v1.3.1 From 537cb0dfd2fbf40491595f55b2e03ce898b3896c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:47 -0600 Subject: bdinfo: sh: arc: Drop arch-specific print_bi_mem() It isn't worth having arch-specific code for such minor output differences. In fact it is better if all archs are consistent. Drop the arch-specific code in print_bi_mem() and inline it to avoid a two-line function. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Acked-by: Alexey Brodkin --- cmd/bdinfo.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 60bfb4e1da9..9746433c23b 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -80,20 +80,6 @@ static void print_bi_boot_params(const bd_t *bd) print_num("boot_params", (ulong)bd->bi_boot_params); } -static void print_bi_mem(const bd_t *bd) -{ -#if defined(CONFIG_SH) - print_num("mem start ", (ulong)bd->bi_memstart); - print_lnum("mem size ", (u64)bd->bi_memsize); -#elif defined(CONFIG_ARC) - print_num("mem start", (ulong)bd->bi_memstart); - print_lnum("mem size", (u64)bd->bi_memsize); -#else - print_num("memstart", (ulong)bd->bi_memstart); - print_lnum("memsize", (u64)bd->bi_memsize); -#endif -} - static void print_bi_dram(const bd_t *bd) { #ifdef CONFIG_NR_DRAM_BANKS @@ -155,7 +141,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("arch_number", bd->bi_arch_number); print_bi_boot_params(bd); print_bi_dram(bd); - print_bi_mem(bd); + print_num("memstart", (ulong)bd->bi_memstart); + print_lnum("memsize", (u64)bd->bi_memsize); print_bi_flash(bd); print_eth_ip_addr(); printf("baudrate = %u bps\n", gd->baudrate); -- cgit v1.3.1 From 3cfbe22bf278163fd86d5005ca4d16f354e1e187 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:48 -0600 Subject: bdinfo: Drop print_bi_boot_params() This function only has one line of code in it so inline it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 9746433c23b..8480c8d8ff9 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -74,12 +74,6 @@ static void print_mhz(const char *name, unsigned long hz) printf("%-12s= %6s MHz\n", name, strmhz(buf, hz)); } - -static void print_bi_boot_params(const bd_t *bd) -{ - print_num("boot_params", (ulong)bd->bi_boot_params); -} - static void print_bi_dram(const bd_t *bd) { #ifdef CONFIG_NR_DRAM_BANKS @@ -139,7 +133,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #endif if (IS_ENABLED(CONFIG_ARM)) print_num("arch_number", bd->bi_arch_number); - print_bi_boot_params(bd); + print_num("boot_params", (ulong)bd->bi_boot_params); print_bi_dram(bd); print_num("memstart", (ulong)bd->bi_memstart); print_lnum("memsize", (u64)bd->bi_memsize); -- cgit v1.3.1 From aa8b758a88cccddb4f6eab3b90dbc7ab9ed43355 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:49 -0600 Subject: bdinfo: Drop print_bi_flash() This function only has three lines of code in it so inline it. This helps to put all the code in one place for future partitioning. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 8480c8d8ff9..15eadef19bd 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -89,13 +89,6 @@ static void print_bi_dram(const bd_t *bd) #endif } -static void print_bi_flash(const bd_t *bd) -{ - print_num("flashstart", (ulong)bd->bi_flashstart); - print_num("flashsize", (ulong)bd->bi_flashsize); - print_num("flashoffset", (ulong)bd->bi_flashoffset); -} - static void print_eth_ip_addr(void) { #if defined(CONFIG_CMD_NET) @@ -137,7 +130,9 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_bi_dram(bd); print_num("memstart", (ulong)bd->bi_memstart); print_lnum("memsize", (u64)bd->bi_memsize); - print_bi_flash(bd); + print_num("flashstart", (ulong)bd->bi_flashstart); + print_num("flashsize", (ulong)bd->bi_flashsize); + print_num("flashoffset", (ulong)bd->bi_flashoffset); print_eth_ip_addr(); printf("baudrate = %u bps\n", gd->baudrate); print_num("relocaddr", gd->relocaddr); -- cgit v1.3.1 From db76c9bece679298668e5c1ce43af820fe99a65b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:50 -0600 Subject: bdinfo: Drop print_cpu_word_size() This function only has one line of code in it so inline it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 15eadef19bd..a7bbd073c5a 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -17,11 +17,6 @@ DECLARE_GLOBAL_DATA_PTR; -void print_cpu_word_size(void) -{ - printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); -} - static void print_num(const char *name, ulong value) { printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value); @@ -137,7 +132,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) printf("baudrate = %u bps\n", gd->baudrate); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); - print_cpu_word_size(); + printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) print_eths(); #endif -- cgit v1.3.1 From 3c89c4c8562754fe1540938ec0ddbb41e7d130a8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:52 -0600 Subject: bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn These config options have not been migrated to Kconfig. This should be handled using driver model, iterating over the available Ethernet devices. For now, remove the code. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Stefan Roese --- cmd/bdinfo.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index a7bbd073c5a..1a08e14d081 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -88,21 +88,6 @@ static void print_eth_ip_addr(void) { #if defined(CONFIG_CMD_NET) print_eth(0); -#if defined(CONFIG_HAS_ETH1) - print_eth(1); -#endif -#if defined(CONFIG_HAS_ETH2) - print_eth(2); -#endif -#if defined(CONFIG_HAS_ETH3) - print_eth(3); -#endif -#if defined(CONFIG_HAS_ETH4) - print_eth(4); -#endif -#if defined(CONFIG_HAS_ETH5) - print_eth(5); -#endif printf("IP addr = %s\n", env_get("ipaddr")); #endif } -- cgit v1.3.1 From 441539f90a21156c69e870fcbda13157ce69a1dc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:53 -0600 Subject: bdinfo: net: Drop legacy ethernet bdinfo This code pre-dates driver model and the migration date is nearly upon us. Pare the print_eths() function down and enable it for driver model, since it works correctly. The IP address is already printed in print_eth_ip_addr() so we can remove that. Since this results in a one-line print_eths() function, inline it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 1a08e14d081..f1d6a013f52 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -36,27 +36,6 @@ static void print_eth(int idx) printf("%-12s= %s\n", name, val); } -#ifndef CONFIG_DM_ETH -__maybe_unused -static void print_eths(void) -{ - struct eth_device *dev; - int i = 0; - - do { - dev = eth_get_dev_by_index(i); - if (dev) { - printf("eth%dname = %s\n", i, dev->name); - print_eth(i); - i++; - } - } while (dev); - - printf("current eth = %s\n", eth_get_name()); - printf("ip_addr = %s\n", env_get("ipaddr")); -} -#endif - static void print_lnum(const char *name, unsigned long long value) { printf("%-12s= 0x%.8llX\n", name, value); @@ -118,9 +97,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); -#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) - print_eths(); -#endif + if (IS_ENABLED(CONFIG_CMD_NET)) + printf("current eth = %s\n", eth_get_name()); print_num("fdt_blob", (ulong)gd->fdt_blob); print_num("new_fdt", (ulong)gd->new_fdt); print_num("fdt_size", (ulong)gd->fdt_size); -- cgit v1.3.1 From 8a2ba581dc27d2ae1f22eae9d6fee0ec45e075f7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:54 -0600 Subject: bdinfo: net: Inline print_eth_ip_addr() This function only has two lines of code now, so inline it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index f1d6a013f52..a11f3884137 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -22,7 +22,6 @@ static void print_num(const char *name, ulong value) printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value); } -__maybe_unused static void print_eth(int idx) { char name[10], *val; @@ -63,14 +62,6 @@ static void print_bi_dram(const bd_t *bd) #endif } -static void print_eth_ip_addr(void) -{ -#if defined(CONFIG_CMD_NET) - print_eth(0); - printf("IP addr = %s\n", env_get("ipaddr")); -#endif -} - void __weak board_detail(void) { /* Please define board_detail() for your PPC platform */ @@ -92,13 +83,15 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("flashstart", (ulong)bd->bi_flashstart); print_num("flashsize", (ulong)bd->bi_flashsize); print_num("flashoffset", (ulong)bd->bi_flashoffset); - print_eth_ip_addr(); printf("baudrate = %u bps\n", gd->baudrate); print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); - if (IS_ENABLED(CONFIG_CMD_NET)) + if (IS_ENABLED(CONFIG_CMD_NET)) { printf("current eth = %s\n", eth_get_name()); + print_eth(0); + printf("IP addr = %s\n", env_get("ipaddr")); + } print_num("fdt_blob", (ulong)gd->fdt_blob); print_num("new_fdt", (ulong)gd->new_fdt); print_num("fdt_size", (ulong)gd->fdt_size); -- cgit v1.3.1 From 655f17ff7d8631ca9344a4bff5918243e5bfed37 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:55 -0600 Subject: bdinfo: Export some basic printing functions At present the functions to print a number and a frequency are static. We want to move some of the code in here to an arch-specific file. For consistency that code should use these same functions. So export them with an appropriate name. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 78 +++++++++++++++++++++++++++++----------------------------- include/init.h | 6 +++++ 2 files changed, 45 insertions(+), 39 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index a11f3884137..4fadfd2ac7d 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; -static void print_num(const char *name, ulong value) +void bdinfo_print_num(const char *name, ulong value) { printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value); } @@ -40,7 +40,7 @@ static void print_lnum(const char *name, unsigned long long value) printf("%-12s= 0x%.8llX\n", name, value); } -static void print_mhz(const char *name, unsigned long hz) +void bdinfo_print_mhz(const char *name, unsigned long hz) { char buf[32]; @@ -54,9 +54,9 @@ static void print_bi_dram(const bd_t *bd) for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { if (bd->bi_dram[i].size) { - print_num("DRAM bank", i); - print_num("-> start", bd->bi_dram[i].start); - print_num("-> size", bd->bi_dram[i].size); + bdinfo_print_num("DRAM bank", i); + bdinfo_print_num("-> start", bd->bi_dram[i].start); + bdinfo_print_num("-> size", bd->bi_dram[i].size); } } #endif @@ -72,50 +72,50 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bd_t *bd = gd->bd; #ifdef DEBUG - print_num("bd address", (ulong)bd); + bdinfo_print_num("bd address", (ulong)bd); #endif if (IS_ENABLED(CONFIG_ARM)) - print_num("arch_number", bd->bi_arch_number); - print_num("boot_params", (ulong)bd->bi_boot_params); + bdinfo_print_num("arch_number", bd->bi_arch_number); + bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params); print_bi_dram(bd); - print_num("memstart", (ulong)bd->bi_memstart); + bdinfo_print_num("memstart", (ulong)bd->bi_memstart); print_lnum("memsize", (u64)bd->bi_memsize); - print_num("flashstart", (ulong)bd->bi_flashstart); - print_num("flashsize", (ulong)bd->bi_flashsize); - print_num("flashoffset", (ulong)bd->bi_flashoffset); + bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart); + bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize); + bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset); printf("baudrate = %u bps\n", gd->baudrate); - print_num("relocaddr", gd->relocaddr); - print_num("reloc off", gd->reloc_off); + bdinfo_print_num("relocaddr", gd->relocaddr); + bdinfo_print_num("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); if (IS_ENABLED(CONFIG_CMD_NET)) { printf("current eth = %s\n", eth_get_name()); print_eth(0); printf("IP addr = %s\n", env_get("ipaddr")); } - print_num("fdt_blob", (ulong)gd->fdt_blob); - print_num("new_fdt", (ulong)gd->new_fdt); - print_num("fdt_size", (ulong)gd->fdt_size); + bdinfo_print_num("fdt_blob", (ulong)gd->fdt_blob); + bdinfo_print_num("new_fdt", (ulong)gd->new_fdt); + bdinfo_print_num("fdt_size", (ulong)gd->fdt_size); #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) - print_num("FB base ", gd->fb_base); + bdinfo_print_num("FB base ", gd->fb_base); #endif /* This section is used only by ARM */ #ifdef CONFIG_ARM #ifdef CONFIG_SYS_MEM_RESERVE_SECURE if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) { - print_num("Secure ram", + bdinfo_print_num("Secure ram", gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK); } #endif #ifdef CONFIG_RESV_RAM if (gd->arch.resv_ram) - print_num("Reserved ram", gd->arch.resv_ram); + bdinfo_print_num("Reserved ram", gd->arch.resv_ram); #endif #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) - print_num("TLB addr", gd->arch.tlb_addr); + bdinfo_print_num("TLB addr", gd->arch.tlb_addr); #endif - print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ - print_num("sp start ", gd->start_addr_sp); + bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ + bdinfo_print_num("sp start ", gd->start_addr_sp); /* * TODO: Currently only support for davinci SOC's is added. * Remove this check once all the board implement this. @@ -133,17 +133,17 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) CONFIG_VAL(SYS_MALLOC_F_LEN)); #endif #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) - print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); + bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); #endif #endif /* CONFIG_ARM */ /* This section is used only by ppc */ #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) - print_num("immr_base", bd->bi_immr_base); + bdinfo_print_num("immr_base", bd->bi_immr_base); #endif if (IS_ENABLED(CONFIG_PPC)) { - print_num("bootflags", bd->bi_bootflags); - print_mhz("intfreq", bd->bi_intfreq); + bdinfo_print_num("bootflags", bd->bi_bootflags); + bdinfo_print_mhz("intfreq", bd->bi_intfreq); #ifdef CONFIG_ENABLE_36BIT_PHYS if (IS_ENABLED(CONFIG_PHYS_64BIT)) puts("addressing = 36-bit\n"); @@ -153,32 +153,32 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) board_detail(); } #if defined(CONFIG_CPM2) - print_mhz("cpmfreq", bd->bi_cpmfreq); - print_mhz("vco", bd->bi_vco); - print_mhz("sccfreq", bd->bi_sccfreq); - print_mhz("brgfreq", bd->bi_brgfreq); + bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq); + bdinfo_print_mhz("vco", bd->bi_vco); + bdinfo_print_mhz("sccfreq", bd->bi_sccfreq); + bdinfo_print_mhz("brgfreq", bd->bi_brgfreq); #endif /* This is used by m68k and ppc */ #if defined(CONFIG_SYS_INIT_RAM_ADDR) - print_num("sramstart", (ulong)bd->bi_sramstart); - print_num("sramsize", (ulong)bd->bi_sramsize); + bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart); + bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize); #endif if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K)) - print_mhz("busfreq", bd->bi_busfreq); + bdinfo_print_mhz("busfreq", bd->bi_busfreq); /* The rest are used only by m68k */ #ifdef CONFIG_M68K #if defined(CONFIG_SYS_MBAR) print_num("mbar", bd->bi_mbar_base); #endif - print_mhz("cpufreq", bd->bi_intfreq); + bdinfo_print_mhz("cpufreq", bd->bi_intfreq); if (IS_ENABLED(CONFIG_PCI)) - print_mhz("pcifreq", bd->bi_pcifreq); + bdinfo_print_mhz("pcifreq", bd->bi_pcifreq); #ifdef CONFIG_EXTRA_CLOCK - print_mhz("flbfreq", bd->bi_flbfreq); - print_mhz("inpfreq", bd->bi_inpfreq); - print_mhz("vcofreq", bd->bi_vcofreq); + bdinfo_print_mhz("flbfreq", bd->bi_flbfreq); + bdinfo_print_mhz("inpfreq", bd->bi_inpfreq); + bdinfo_print_mhz("vcofreq", bd->bi_vcofreq); #endif #endif diff --git a/include/init.h b/include/init.h index b5a167b6edb..af4deed566d 100644 --- a/include/init.h +++ b/include/init.h @@ -261,6 +261,12 @@ void relocate_code(ulong start_addr_sp, struct global_data *new_gd, __attribute__ ((noreturn)); #endif +/* Print a numeric value (for use in arch_print_bdinfo()) */ +void bdinfo_print_num(const char *name, ulong value); + +/* Print a clock speed in MHz */ +void bdinfo_print_mhz(const char *name, unsigned long hz); + #endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */ -- cgit v1.3.1 From 59b0d7d839f135bc44d3459784337a657149f8b3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:56 -0600 Subject: bdinfo: arm: Move ARM-specific info into its own file We don't really want to have ARM-specific code in a generic file. Create a new arch-specific function to hold it, and move it into that. Make the function weak so that any arch can implement it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/arm/lib/Makefile | 1 + arch/arm/lib/bdinfo.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ cmd/bdinfo.c | 45 +++++++-------------------------------------- include/init.h | 3 +++ 4 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 arch/arm/lib/bdinfo.c (limited to 'cmd') diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index b839aa7a509..27b12e7f2bb 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o obj-$(CONFIG_SEMIHOSTING) += semihosting.o +obj-y += bdinfo.o obj-y += sections.o obj-y += stack.o ifdef CONFIG_CPU_V7M diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c new file mode 100644 index 00000000000..81c92915847 --- /dev/null +++ b/arch/arm/lib/bdinfo.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * ARM-specific information for the 'bd' command + * + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +void arch_print_bdinfo(void) +{ + bd_t *bd = gd->bd; + + bdinfo_print_num("arch_number", bd->bi_arch_number); +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE + if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) { + bdinfo_print_num("Secure ram", + gd->arch.secure_ram & + MEM_RESERVE_SECURE_ADDR_MASK); + } +#endif +#ifdef CONFIG_RESV_RAM + if (gd->arch.resv_ram) + bdinfo_print_num("Reserved ram", gd->arch.resv_ram); +#endif +#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) + bdinfo_print_num("TLB addr", gd->arch.tlb_addr); +#endif + bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ + bdinfo_print_num("sp start ", gd->start_addr_sp); + /* + * TODO: Currently only support for davinci SOC's is added. + * Remove this check once all the board implement this. + */ +#ifdef CONFIG_CLOCKS + printf("ARM frequency = %ld MHz\n", bd->bi_arm_freq); + printf("DSP frequency = %ld MHz\n", bd->bi_dsp_freq); + printf("DDR frequency = %ld MHz\n", bd->bi_ddr_freq); +#endif +#ifdef CONFIG_BOARD_TYPES + printf("Board Type = %ld\n", gd->board_type); +#endif +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr, + CONFIG_VAL(SYS_MALLOC_F_LEN)); +#endif +} diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 4fadfd2ac7d..6aa23e6a438 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -67,6 +67,10 @@ void __weak board_detail(void) /* Please define board_detail() for your PPC platform */ } +__weak void arch_print_bdinfo(void) +{ +} + int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { bd_t *bd = gd->bd; @@ -74,8 +78,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #ifdef DEBUG bdinfo_print_num("bd address", (ulong)bd); #endif - if (IS_ENABLED(CONFIG_ARM)) - bdinfo_print_num("arch_number", bd->bi_arch_number); bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params); print_bi_dram(bd); bdinfo_print_num("memstart", (ulong)bd->bi_memstart); @@ -98,44 +100,11 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) bdinfo_print_num("FB base ", gd->fb_base); #endif - - /* This section is used only by ARM */ -#ifdef CONFIG_ARM -#ifdef CONFIG_SYS_MEM_RESERVE_SECURE - if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) { - bdinfo_print_num("Secure ram", - gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK); - } -#endif -#ifdef CONFIG_RESV_RAM - if (gd->arch.resv_ram) - bdinfo_print_num("Reserved ram", gd->arch.resv_ram); -#endif -#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) - bdinfo_print_num("TLB addr", gd->arch.tlb_addr); -#endif - bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ - bdinfo_print_num("sp start ", gd->start_addr_sp); - /* - * TODO: Currently only support for davinci SOC's is added. - * Remove this check once all the board implement this. - */ -#ifdef CONFIG_CLOCKS - printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq); - printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq); - printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq); -#endif -#ifdef CONFIG_BOARD_TYPES - printf("Board Type = %ld\n", gd->board_type); -#endif -#if CONFIG_VAL(SYS_MALLOC_F_LEN) - printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr, - CONFIG_VAL(SYS_MALLOC_F_LEN)); -#endif #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); #endif -#endif /* CONFIG_ARM */ + + arch_print_bdinfo(); /* This section is used only by ppc */ #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) @@ -170,7 +139,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) /* The rest are used only by m68k */ #ifdef CONFIG_M68K #if defined(CONFIG_SYS_MBAR) - print_num("mbar", bd->bi_mbar_base); + bdinfo_print_num("mbar", bd->bi_mbar_base); #endif bdinfo_print_mhz("cpufreq", bd->bi_intfreq); if (IS_ENABLED(CONFIG_PCI)) diff --git a/include/init.h b/include/init.h index af4deed566d..e727031514c 100644 --- a/include/init.h +++ b/include/init.h @@ -267,6 +267,9 @@ void bdinfo_print_num(const char *name, ulong value); /* Print a clock speed in MHz */ void bdinfo_print_mhz(const char *name, unsigned long hz); +/* Show arch-specific information for the 'bd' command */ +void arch_print_bdinfo(void); + #endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */ -- cgit v1.3.1 From 79d074d30196811478eb7242121f97cac405b6aa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:57 -0600 Subject: bdinfo: ppc: Move PPC-specific info into its own file We don't really want to have PPC-specific code in a generic file. Create a new arch-specific function to hold it, and move it into that. Make the function weak so that any arch can implement it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Stefan Roese --- arch/powerpc/lib/Makefile | 2 ++ arch/powerpc/lib/bdinfo.c | 41 +++++++++++++++++++++++++++++++++++++++++ cmd/bdinfo.c | 27 --------------------------- 3 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 arch/powerpc/lib/bdinfo.c (limited to 'cmd') diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 01c9dd51be8..f61809ab057 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -15,6 +15,8 @@ MINIMAL=y endif endif +obj-y += bdinfo.o + ifdef MINIMAL obj-y += cache.o time.o ifndef CONFIG_TIMER diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c new file mode 100644 index 00000000000..da09bb276f6 --- /dev/null +++ b/arch/powerpc/lib/bdinfo.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * PPC-specific information for the 'bd' command + * + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +void __weak board_detail(void) +{ + /* Please define board_detail() for your PPC platform */ +} + +void arch_print_bdinfo(void) +{ + bd_t *bd = gd->bd; + +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) + bdinfo_print_num("immr_base", bd->bi_immr_base); +#endif + bdinfo_print_num("bootflags", bd->bi_bootflags); + bdinfo_print_mhz("intfreq", bd->bi_intfreq); +#ifdef CONFIG_ENABLE_36BIT_PHYS + if (IS_ENABLED(CONFIG_PHYS_64BIT)) + puts("addressing = 36-bit\n"); + else + puts("addressing = 32-bit\n"); +#endif + board_detail(); +#if defined(CONFIG_CPM2) + bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq); + bdinfo_print_mhz("vco", bd->bi_vco); + bdinfo_print_mhz("sccfreq", bd->bi_sccfreq); + bdinfo_print_mhz("brgfreq", bd->bi_brgfreq); +#endif +} diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 6aa23e6a438..524677edd2f 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -62,11 +62,6 @@ static void print_bi_dram(const bd_t *bd) #endif } -void __weak board_detail(void) -{ - /* Please define board_detail() for your PPC platform */ -} - __weak void arch_print_bdinfo(void) { } @@ -106,28 +101,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) arch_print_bdinfo(); - /* This section is used only by ppc */ -#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) - bdinfo_print_num("immr_base", bd->bi_immr_base); -#endif - if (IS_ENABLED(CONFIG_PPC)) { - bdinfo_print_num("bootflags", bd->bi_bootflags); - bdinfo_print_mhz("intfreq", bd->bi_intfreq); -#ifdef CONFIG_ENABLE_36BIT_PHYS - if (IS_ENABLED(CONFIG_PHYS_64BIT)) - puts("addressing = 36-bit\n"); - else - puts("addressing = 32-bit\n"); -#endif - board_detail(); - } -#if defined(CONFIG_CPM2) - bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq); - bdinfo_print_mhz("vco", bd->bi_vco); - bdinfo_print_mhz("sccfreq", bd->bi_sccfreq); - bdinfo_print_mhz("brgfreq", bd->bi_brgfreq); -#endif - /* This is used by m68k and ppc */ #if defined(CONFIG_SYS_INIT_RAM_ADDR) bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart); -- cgit v1.3.1 From 1a520d949b00a0468746a5d4f14920f54c8f6766 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:58 -0600 Subject: bdinfo: m68k: Move m68k-specific info into its own file We don't really want to have m68k-specific code in a generic file. Create a new arch-specific function to hold it, and move it into that. Make the function weak so that any arch can implement it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Angelo Dureghello Tested-by: Angelo Dureghello --- arch/m68k/lib/Makefile | 1 + arch/m68k/lib/bdinfo.c | 29 +++++++++++++++++++++++++++++ cmd/bdinfo.c | 15 --------------- 3 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 arch/m68k/lib/bdinfo.c (limited to 'cmd') diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index a040f40eb87..b66d66afd29 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -7,6 +7,7 @@ ## if the user asked for it lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o +obj-y += bdinfo.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += cache.o obj-y += interrupts.o diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c new file mode 100644 index 00000000000..09a1abfc217 --- /dev/null +++ b/arch/m68k/lib/bdinfo.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * PPC-specific information for the 'bd' command + * + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +void arch_print_bdinfo(void) +{ + bd_t *bd = gd->bd; + +#if defined(CONFIG_SYS_MBAR) + bdinfo_print_num("mbar", bd->bi_mbar_base); +#endif + bdinfo_print_mhz("cpufreq", bd->bi_intfreq); + if (IS_ENABLED(CONFIG_PCI)) + bdinfo_print_mhz("pcifreq", bd->bi_pcifreq); +#ifdef CONFIG_EXTRA_CLOCK + bdinfo_print_mhz("flbfreq", bd->bi_flbfreq); + bdinfo_print_mhz("inpfreq", bd->bi_inpfreq); + bdinfo_print_mhz("vcofreq", bd->bi_vcofreq); +#endif +} diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 524677edd2f..097a31416b0 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -109,21 +109,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K)) bdinfo_print_mhz("busfreq", bd->bi_busfreq); - /* The rest are used only by m68k */ -#ifdef CONFIG_M68K -#if defined(CONFIG_SYS_MBAR) - bdinfo_print_num("mbar", bd->bi_mbar_base); -#endif - bdinfo_print_mhz("cpufreq", bd->bi_intfreq); - if (IS_ENABLED(CONFIG_PCI)) - bdinfo_print_mhz("pcifreq", bd->bi_pcifreq); -#ifdef CONFIG_EXTRA_CLOCK - bdinfo_print_mhz("flbfreq", bd->bi_flbfreq); - bdinfo_print_mhz("inpfreq", bd->bi_inpfreq); - bdinfo_print_mhz("vcofreq", bd->bi_vcofreq); -#endif -#endif - return 0; } -- cgit v1.3.1 From 64791981ebbfbfc150f132081f2471c21b485076 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:16:59 -0600 Subject: bdinfo: m68k: ppc: Move arch-specific code from bdinfo We don't have an easy way to share these three lines of code with two architectures. We also want to make it clear that this code is actually arch-specific. So just duplicate it in each arch-specific file. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Stefan Roese --- arch/m68k/lib/bdinfo.c | 5 +++++ arch/powerpc/lib/bdinfo.c | 5 +++++ cmd/bdinfo.c | 8 -------- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'cmd') diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c index 09a1abfc217..971c47c3064 100644 --- a/arch/m68k/lib/bdinfo.c +++ b/arch/m68k/lib/bdinfo.c @@ -15,6 +15,11 @@ void arch_print_bdinfo(void) { bd_t *bd = gd->bd; +#if defined(CONFIG_SYS_INIT_RAM_ADDR) + bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart); + bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize); +#endif + bdinfo_print_mhz("busfreq", bd->bi_busfreq); #if defined(CONFIG_SYS_MBAR) bdinfo_print_num("mbar", bd->bi_mbar_base); #endif diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c index da09bb276f6..d8c64155f08 100644 --- a/arch/powerpc/lib/bdinfo.c +++ b/arch/powerpc/lib/bdinfo.c @@ -20,6 +20,11 @@ void arch_print_bdinfo(void) { bd_t *bd = gd->bd; +#if defined(CONFIG_SYS_INIT_RAM_ADDR) + bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart); + bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize); +#endif + bdinfo_print_mhz("busfreq", bd->bi_busfreq); #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) bdinfo_print_num("immr_base", bd->bi_immr_base); #endif diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 097a31416b0..420423a81bd 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -101,14 +101,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) arch_print_bdinfo(); - /* This is used by m68k and ppc */ -#if defined(CONFIG_SYS_INIT_RAM_ADDR) - bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart); - bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize); -#endif - if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K)) - bdinfo_print_mhz("busfreq", bd->bi_busfreq); - return 0; } -- cgit v1.3.1 From bda8909fcc813cd5d4175287f53237911c96e316 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 May 2020 14:17:00 -0600 Subject: bdinfo: Update the file comments Update the comment at the top of the file to indicate what this file does. Also drop the line at the bottom and an unnecessary header include. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 420423a81bd..b7f5f710b49 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -1,19 +1,17 @@ // SPDX-License-Identifier: GPL-2.0+ /* + * Implements the 'bd' command to show board information + * * (C) Copyright 2003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ -/* - * Boot support - */ #include #include #include #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -104,8 +102,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 0; } -/* -------------------------------------------------------------------- */ - U_BOOT_CMD( bdinfo, 1, 1, do_bdinfo, "print Board Info structure", -- cgit v1.3.1 From 56c404603825a4e3229dcf0d3d88318b20493fa6 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Thu, 4 Jun 2020 23:11:53 +0800 Subject: spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI* This change allows more fine tuning of driver model based SPI support in SPL and TPL. It is now possible to explicitly enable/disable the DM_SPI support in SPL and TPL via Kconfig option. Before this change it was necessary to use: /* SPI Flash Configs */ #if defined(CONFIG_SPL_BUILD) #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH #undef CONFIG_SPI_FLASH_MTD #endif in the ./include/configs/.h, which is error prone and shall be avoided when we strive to switch to Kconfig. The goal of this patch: Provide distinction for DM_SPI support in both U-Boot proper and SPL (TPL). Valid use case is when U-Boot proper wants to use DM_SPI, but SPL must still support non DM driver. Another use case is the conversion of non DM/DTS SPI driver to support DM/DTS. When such driver needs to work in both SPL and U-Boot proper, the distinction is needed in Kconfig (also if SPL version of the driver supports OF_PLATDATA). In the end of the day one would have to support following use cases (in single driver file - e.g. mxs_spi.c): - U-Boot proper driver supporting DT/DTS - U-Boot proper driver without DT/DTS support (deprecated) - SPL driver without DT/DTS support - SPL (and TPL) driver with DT/DTS (when the SoC has enough resources to run full blown DT/DTS) - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have constrained environment with no fitImage and OF_LIBFDT support). Some boards do require SPI support (with DM) in SPL (TPL) and some only have DM_SPI{_FLASH} defined to allow compiling SPL. This patch converts #ifdef CONFIG_DM_SPI* to #if CONFIG_IS_ENABLED(DM_SPI) and provides corresponding defines in Kconfig. Signed-off-by: Lukasz Majewski Tested-by: Adam Ford #da850-evm Signed-off-by: Hou Zhiqiang [trini: Fixup a few platforms] Signed-off-by: Tom Rini --- arch/arm/Kconfig | 11 +++++++++++ board/l+g/vinco/vinco.c | 4 ++-- cmd/sf.c | 4 ++-- cmd/spi.c | 6 +++--- common/spl/Kconfig | 20 ++++++++++++++++++++ configs/am57xx_evm_defconfig | 2 ++ configs/am57xx_hs_evm_defconfig | 2 ++ configs/am57xx_hs_evm_usb_defconfig | 2 ++ configs/am65x_evm_a53_defconfig | 1 + configs/am65x_evm_r5_defconfig | 1 + configs/am65x_hs_evm_a53_defconfig | 1 + configs/am65x_hs_evm_r5_defconfig | 1 + configs/axm_defconfig | 2 ++ configs/brppt1_spi_defconfig | 1 + configs/brppt2_defconfig | 1 + configs/brsmarc1_defconfig | 1 + configs/chromebook_coral_defconfig | 1 + configs/chromebook_link64_defconfig | 2 ++ configs/chromebook_samus_tpl_defconfig | 4 ++++ configs/cm_t43_defconfig | 1 + configs/da850evm_defconfig | 1 + configs/dra7xx_evm_defconfig | 2 ++ configs/dra7xx_hs_evm_defconfig | 2 ++ configs/dra7xx_hs_evm_usb_defconfig | 2 ++ configs/imx28_xea_defconfig | 1 + configs/j721e_evm_a72_defconfig | 2 ++ configs/j721e_evm_r5_defconfig | 2 ++ configs/j721e_hs_evm_a72_defconfig | 1 + configs/j721e_hs_evm_r5_defconfig | 1 + configs/k2e_evm_defconfig | 1 + configs/k2hk_evm_defconfig | 1 + configs/k2l_evm_defconfig | 1 + configs/ls1021aiot_qspi_defconfig | 2 ++ configs/ls1021aiot_sdcard_defconfig | 2 ++ configs/ls1021aqds_qspi_defconfig | 1 + configs/ls1021aqds_sdcard_qspi_defconfig | 1 + configs/ls1021atwr_qspi_defconfig | 1 + configs/qemu-x86_64_defconfig | 1 + configs/sama5d27_wlsom1_ek_qspiflash_defconfig | 1 + configs/sama5d2_xplained_spiflash_defconfig | 2 ++ configs/sama5d3xek_spiflash_defconfig | 2 ++ configs/sama5d4_xplained_spiflash_defconfig | 2 ++ configs/sama5d4ek_spiflash_defconfig | 2 ++ configs/stm32mp15_basic_defconfig | 2 ++ configs/stm32mp15_dhcom_basic_defconfig | 1 + configs/stm32mp15_dhcor_basic_defconfig | 1 + configs/taurus_defconfig | 2 ++ drivers/mtd/spi/Makefile | 4 ++-- drivers/mtd/spi/sf_probe.c | 2 +- drivers/net/fm/fm.c | 4 ++-- drivers/spi/Makefile | 2 +- drivers/spi/kirkwood_spi.c | 2 +- drivers/spi/mxc_spi.c | 6 +++--- drivers/spi/omap3_spi.c | 4 ++-- drivers/spi/sh_qspi.c | 4 ++-- env/sf.c | 2 +- include/spi.h | 8 ++++---- include/spi_flash.h | 2 +- test/dm/spi.c | 2 +- 59 files changed, 122 insertions(+), 28 deletions(-) (limited to 'cmd') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 54d65f84889..73a27316dfb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -549,6 +549,7 @@ config TARGET_GPLUGD config ARCH_DAVINCI bool "TI DaVinci" select CPU_ARM926EJS + select SPL_DM_SPI if SPL imply CMD_SAVES help Support for TI's DaVinci platform. @@ -566,6 +567,8 @@ config ARCH_MVEBU select DM_SERIAL select DM_SPI select DM_SPI_FLASH + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select OF_CONTROL select OF_SEPARATE select SPI @@ -985,6 +988,8 @@ config ARCH_SOCFPGA imply FAT_WRITE imply SPL imply SPL_DM + imply SPL_DM_SPI + imply SPL_DM_SPI_FLASH imply SPL_LIBDISK_SUPPORT imply SPL_MMC_SUPPORT imply SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION @@ -1093,6 +1098,8 @@ config ARCH_ZYNQ select SPL_BOARD_INIT if SPL select SPL_CLK if SPL select SPL_DM if SPL + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select SPL_OF_CONTROL if SPL select SPL_SEPARATE_BSS if SPL select SUPPORT_SPL @@ -1131,6 +1138,8 @@ config ARCH_ZYNQMP select OF_CONTROL select SPL_BOARD_INIT if SPL select SPL_CLK if SPL + select SPL_DM_SPI if SPI + select SPL_DM_SPI_FLASH if SPL_DM_SPI select SPL_DM_MAILBOX if SPL select SPL_FIRMWARE if SPL select SPL_SEPARATE_BSS if SPL @@ -1680,6 +1689,8 @@ config ARCH_ROCKCHIP select OF_CONTROL select SPI select SPL_DM if SPL + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select SYS_MALLOC_F select SYS_THUMB_BUILD if !ARM64 imply ADC diff --git a/board/l+g/vinco/vinco.c b/board/l+g/vinco/vinco.c index 5a998e37d8a..440838c1124 100644 --- a/board/l+g/vinco/vinco.c +++ b/board/l+g/vinco/vinco.c @@ -34,7 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; /* FIXME gpio code here need to handle through DM_GPIO */ -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs == 0; @@ -167,7 +167,7 @@ int board_init(void) /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) vinco_spi0_hw_init(); #endif diff --git a/cmd/sf.c b/cmd/sf.c index d18f6a888ce..c0d6a8f8a06 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -91,7 +91,7 @@ static int do_spi_flash_probe(int argc, char *const argv[]) unsigned int speed = CONFIG_SF_DEFAULT_SPEED; unsigned int mode = CONFIG_SF_DEFAULT_MODE; char *endp; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new, *bus_dev; int ret; #else @@ -124,7 +124,7 @@ static int do_spi_flash_probe(int argc, char *const argv[]) return -1; } -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) /* Remove the old device, otherwise probe will just be a nop */ ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new); if (!ret) { diff --git a/cmd/spi.c b/cmd/spi.c index aec912167c6..4aea1914129 100644 --- a/cmd/spi.c +++ b/cmd/spi.c @@ -38,7 +38,7 @@ static int do_spi_xfer(int bus, int cs) struct spi_slave *slave; int ret = 0; -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) char name[30], *str; struct udevice *dev; @@ -63,7 +63,7 @@ static int do_spi_xfer(int bus, int cs) goto done; ret = spi_xfer(slave, bitlen, dout, din, SPI_XFER_BEGIN | SPI_XFER_END); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) /* We don't get an error code in this case */ if (ret) ret = -EIO; @@ -79,7 +79,7 @@ static int do_spi_xfer(int bus, int cs) } done: spi_release_bus(slave); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) spi_free_slave(slave); #endif diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 3eae65ebc19..d09e52e88bf 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -756,6 +756,11 @@ config SPL_DM_SPI help Enable support for SPI DM drivers in SPL. +config SPL_DM_SPI_FLASH + bool "Support SPI DM FLASH drivers in SPL" + help + Enable support for SPI DM flash drivers in SPL. + endif if SPL_UBI config SPL_UBI_LOAD_BY_VOLNAME @@ -1092,6 +1097,11 @@ config SPL_SPI_FLASH_SFDP_SUPPORT SPI NOR flashes using Serial Flash Discoverable Parameters (SFDP) tables as per JESD216 standard in SPL. +config SPL_SPI_FLASH_MTD + bool "Support for SPI flash MTD drivers in SPL" + help + Enable support for SPI flash MTD drivers in SPL. + config SPL_SPI_LOAD bool "Support loading from SPI flash" help @@ -1499,6 +1509,16 @@ config TPL_SPI_SUPPORT Enable support for using SPI in TPL. See SPL_SPI_SUPPORT for details. +config TPL_DM_SPI + bool "Support SPI DM drivers in TPL" + help + Enable support for SPI DM drivers in TPL. + +config TPL_DM_SPI_FLASH + bool "Support SPI DM FLASH drivers in TPL" + help + Enable support for SPI DM flash drivers in TPL. + config TPL_YMODEM_SUPPORT bool "Support loading using Ymodem" depends on TPL_SERIAL_SUPPORT diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index 7c907fd3f49..cefed5b0600 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -78,6 +78,7 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_SPANSION=y @@ -96,6 +97,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index 81bac5592eb..081a48f0380 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -74,6 +74,7 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_SPANSION=y @@ -92,6 +93,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig index ea5215e8cf3..154154c68fb 100644 --- a/configs/am57xx_hs_evm_usb_defconfig +++ b/configs/am57xx_hs_evm_usb_defconfig @@ -80,6 +80,7 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_BAR=y @@ -99,6 +100,7 @@ CONFIG_DM_REGULATOR_PALMAS=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig index 9d97a488db2..3f2f4e45e32 100644 --- a/configs/am65x_evm_a53_defconfig +++ b/configs/am65x_evm_a53_defconfig @@ -37,6 +37,7 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_MTD_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_DOMAIN=y # CONFIG_SPL_SPI_FLASH_TINY is not set diff --git a/configs/am65x_evm_r5_defconfig b/configs/am65x_evm_r5_defconfig index 1e7a7d1e6ee..14466465ab4 100644 --- a/configs/am65x_evm_r5_defconfig +++ b/configs/am65x_evm_r5_defconfig @@ -33,6 +33,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400 CONFIG_SPL_DMA=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig index 49fe5a5b6da..373eb4b0093 100644 --- a/configs/am65x_hs_evm_a53_defconfig +++ b/configs/am65x_hs_evm_a53_defconfig @@ -40,6 +40,7 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y CONFIG_SPL_MTD_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_DOMAIN=y # CONFIG_SPL_SPI_FLASH_TINY is not set diff --git a/configs/am65x_hs_evm_r5_defconfig b/configs/am65x_hs_evm_r5_defconfig index 9977e97f2b0..6e83f333793 100644 --- a/configs/am65x_hs_evm_r5_defconfig +++ b/configs/am65x_hs_evm_r5_defconfig @@ -35,6 +35,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400 CONFIG_SPL_DMA=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y diff --git a/configs/axm_defconfig b/configs/axm_defconfig index 6a3336c256b..ce3ad9f8b48 100644 --- a/configs/axm_defconfig +++ b/configs/axm_defconfig @@ -65,6 +65,8 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y diff --git a/configs/brppt1_spi_defconfig b/configs/brppt1_spi_defconfig index aea67c25dc2..be527fd7257 100644 --- a/configs/brppt1_spi_defconfig +++ b/configs/brppt1_spi_defconfig @@ -39,6 +39,7 @@ CONFIG_SPL_SEPARATE_BSS=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set CONFIG_SPL_I2C_SUPPORT=y # CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_WATCHDOG_SUPPORT=y diff --git a/configs/brppt2_defconfig b/configs/brppt2_defconfig index c4eb03bde07..3bfe882c98e 100644 --- a/configs/brppt2_defconfig +++ b/configs/brppt2_defconfig @@ -33,6 +33,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_BOARD_INIT=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_SPI_LOAD=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y diff --git a/configs/brsmarc1_defconfig b/configs/brsmarc1_defconfig index aac8d17876b..a7778674c0f 100644 --- a/configs/brsmarc1_defconfig +++ b/configs/brsmarc1_defconfig @@ -39,6 +39,7 @@ CONFIG_SPL_SEPARATE_BSS=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set CONFIG_SPL_I2C_SUPPORT=y # CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index 6cc3a8469fe..79f9b5a2321 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -37,6 +37,7 @@ CONFIG_HANDOFF=y CONFIG_TPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_CPU_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_PCI=y # CONFIG_SPL_SPI_FLASH_TINY is not set CONFIG_HUSH_PARSER=y diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig index a80225a11f3..3e760e75ddd 100644 --- a/configs/chromebook_link64_defconfig +++ b/configs/chromebook_link64_defconfig @@ -31,6 +31,8 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_CPU_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig index 95c9b6e6af5..422bcfd8af4 100644 --- a/configs/chromebook_samus_tpl_defconfig +++ b/configs/chromebook_samus_tpl_defconfig @@ -32,11 +32,15 @@ CONFIG_BLOBLIST_SIZE=0x1000 CONFIG_BLOBLIST_ADDR=0xff7c0000 CONFIG_HANDOFF=y CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y CONFIG_TPL_PCI=y CONFIG_TPL_PCH_SUPPORT=y +CONFIG_TPL_DM_SPI=y +CONFIG_TPL_DM_SPI_FLASH=y CONFIG_HUSH_PARSER=y CONFIG_CMD_CPU=y CONFIG_CMD_GPIO=y diff --git a/configs/cm_t43_defconfig b/configs/cm_t43_defconfig index 4232aaca002..98c50954b6b 100644 --- a/configs/cm_t43_defconfig +++ b/configs/cm_t43_defconfig @@ -31,6 +31,7 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_MTD_SUPPORT=y # CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_PROMPT="CM-T43 # " diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig index 12768065f3a..2e87637f7e4 100644 --- a/configs/da850evm_defconfig +++ b/configs/da850evm_defconfig @@ -30,6 +30,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SEPARATE_BSS=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_SPI_LOAD=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot > " diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index f117077111e..022dfaeb378 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -84,6 +84,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_SPANSION=y @@ -106,6 +107,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index 6fa117cfae0..e15f62eded9 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -87,6 +87,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_SPANSION=y @@ -109,6 +110,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig index 53cf7047553..91e28618923 100644 --- a/configs/dra7xx_hs_evm_usb_defconfig +++ b/configs/dra7xx_hs_evm_usb_defconfig @@ -84,6 +84,7 @@ CONFIG_SPL_MMC_HS200_SUPPORT=y CONFIG_MMC_OMAP_HS=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 CONFIG_SPI_FLASH_BAR=y @@ -106,6 +107,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig index 592f3e387cc..0001f468ddd 100644 --- a/configs/imx28_xea_defconfig +++ b/configs/imx28_xea_defconfig @@ -33,6 +33,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0 CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y CONFIG_SPL_DMA=y CONFIG_SPL_MMC_TINY=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_OS_BOOT=y CONFIG_SPL_SPI_LOAD=y CONFIG_HUSH_PARSER=y diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 9bf07570b14..7c7b9905f94 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -121,6 +121,7 @@ CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y CONFIG_HBMC_AM654=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_SPI_FLASH_MTD=y @@ -147,6 +148,7 @@ CONFIG_DM_SERIAL=y CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index c597f830923..822d1fc4869 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -90,6 +90,7 @@ CONFIG_SPL_MMC_SDHCI_ADMA=y CONFIG_MMC_SDHCI_AM654=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PINCTRL=y @@ -113,6 +114,7 @@ CONFIG_DM_SERIAL=y CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig index ef4b1149e5c..0bfa4ff23d4 100644 --- a/configs/j721e_hs_evm_a72_defconfig +++ b/configs/j721e_hs_evm_a72_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y diff --git a/configs/j721e_hs_evm_r5_defconfig b/configs/j721e_hs_evm_r5_defconfig index 7bdf3401a1a..b1ee4755754 100644 --- a/configs/j721e_hs_evm_r5_defconfig +++ b/configs/j721e_hs_evm_r5_defconfig @@ -34,6 +34,7 @@ CONFIG_SPL_DMA=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_DM_MAILBOX=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_DM_RESET=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_POWER_DOMAIN=y diff --git a/configs/k2e_evm_defconfig b/configs/k2e_evm_defconfig index ae07f860e3a..f37644fe2cf 100644 --- a/configs/k2e_evm_defconfig +++ b/configs/k2e_evm_defconfig @@ -24,6 +24,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/k2hk_evm_defconfig b/configs/k2hk_evm_defconfig index 9f992055cae..a14db7db399 100644 --- a/configs/k2hk_evm_defconfig +++ b/configs/k2hk_evm_defconfig @@ -24,6 +24,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/k2l_evm_defconfig b/configs/k2l_evm_defconfig index 3311587c2c1..7180c23cc26 100644 --- a/configs/k2l_evm_defconfig +++ b/configs/k2l_evm_defconfig @@ -24,6 +24,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/ls1021aiot_qspi_defconfig b/configs/ls1021aiot_qspi_defconfig index 85ceeb480ad..f0bf8abaeee 100644 --- a/configs/ls1021aiot_qspi_defconfig +++ b/configs/ls1021aiot_qspi_defconfig @@ -23,6 +23,7 @@ CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y +CONFIG_CMD_SF=y CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="ls1021a-iot-duart" CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -50,6 +51,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aiot_sdcard_defconfig b/configs/ls1021aiot_sdcard_defconfig index 11ccf57aad1..9c5dd8a5a16 100644 --- a/configs/ls1021aiot_sdcard_defconfig +++ b/configs/ls1021aiot_sdcard_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y +CONFIG_CMD_SF=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="ls1021a-iot-duart" @@ -56,6 +57,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aqds_qspi_defconfig b/configs/ls1021aqds_qspi_defconfig index f91534cfdd6..0542c5c3036 100644 --- a/configs/ls1021aqds_qspi_defconfig +++ b/configs/ls1021aqds_qspi_defconfig @@ -64,6 +64,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aqds_sdcard_qspi_defconfig b/configs/ls1021aqds_sdcard_qspi_defconfig index 9871c8edf44..fd499175059 100644 --- a/configs/ls1021aqds_sdcard_qspi_defconfig +++ b/configs/ls1021aqds_sdcard_qspi_defconfig @@ -76,6 +76,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPIy=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig index 4c82d668998..8ef05893342 100644 --- a/configs/ls1021atwr_qspi_defconfig +++ b/configs/ls1021atwr_qspi_defconfig @@ -62,6 +62,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPI_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index a5be09b2ba1..ec126b2d9ae 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -32,6 +32,7 @@ CONFIG_PCI_INIT_R=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_CPU_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y diff --git a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig index 58b906ad592..cf949cd7419 100644 --- a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig +++ b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig @@ -33,6 +33,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_DISPLAY_PRINT=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_AT91_MCK_BYPASS=y CONFIG_HUSH_PARSER=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index e5227b11f50..320175b517a 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -67,6 +67,8 @@ CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y CONFIG_MTD=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index b3bc4b4fe59..8db078abaf7 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -23,6 +23,7 @@ CONFIG_DEBUG_UART_CLOCK=132000000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_SPL_TEXT_BASE=0x300000 +CONFIG_SPL_DM_SPI=y CONFIG_DEBUG_UART=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y @@ -31,6 +32,7 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256K(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=6 root=ubi0:rootfs" # CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_SPI_LOAD=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig index 2799b69a5d2..4239c050304 100644 --- a/configs/sama5d4_xplained_spiflash_defconfig +++ b/configs/sama5d4_xplained_spiflash_defconfig @@ -68,6 +68,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y CONFIG_DM_ETH=y @@ -80,6 +81,7 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig index 4b7e825ce02..3e5b2fd8b61 100644 --- a/configs/sama5d4ek_spiflash_defconfig +++ b/configs/sama5d4ek_spiflash_defconfig @@ -65,6 +65,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y CONFIG_DM_ETH=y @@ -77,6 +78,7 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 668cd434f1e..f0abc89a43b 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -91,6 +91,7 @@ CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_MTD_SPI_NAND=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y @@ -121,6 +122,7 @@ CONFIG_RTC_STM32=y CONFIG_SERIAL_RX_BUFFER=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_STM32_QSPI=y CONFIG_STM32_SPI=y CONFIG_USB=y diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index 1ac07c5865b..be5926d03a8 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -93,6 +93,7 @@ CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index 225d0449794..0344f07daee 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -89,6 +89,7 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/taurus_defconfig b/configs/taurus_defconfig index 953f7784be4..229c97ead5a 100644 --- a/configs/taurus_defconfig +++ b/configs/taurus_defconfig @@ -73,6 +73,8 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index b5dfa300de4..952fd1e45a1 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -3,7 +3,7 @@ # (C) Copyright 2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_DM_SPI_FLASH) += sf-uclass.o +obj-$(CONFIG_$(SPL_TPL_)DM_SPI_FLASH) += sf-uclass.o spi-nor-y := sf_probe.o spi-nor-ids.o ifdef CONFIG_SPL_BUILD @@ -19,5 +19,5 @@ endif obj-$(CONFIG_SPI_FLASH) += spi-nor.o obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o -obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o +obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_MTD) += sf_mtd.o obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 3548d6319b3..afda241dd06 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -53,7 +53,7 @@ err_read_id: return ret; } -#ifndef CONFIG_DM_SPI_FLASH +#if !CONFIG_IS_ENABLED(DM_SPI_FLASH) struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode) { diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 8ab18163954..bbb1738c4bd 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -383,7 +383,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); int ret = 0; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; /* speed and mode will be read from DT */ @@ -470,7 +470,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); int ret = 0; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; /* speed and mode will be read from DT */ diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 54881a74124..9559e938d26 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -4,7 +4,7 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # There are many options which enable SPI, so make this library available -ifdef CONFIG_DM_SPI +ifdef CONFIG_$(SPL_TPL_)DM_SPI obj-y += spi-uclass.o obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o obj-$(CONFIG_SOFT_SPI) += soft_spi.o diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index 3986b06b25c..c03923f8749 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -94,7 +94,7 @@ static int _spi_xfer(struct kwspi_registers *reg, unsigned int bitlen, return 0; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static struct kwspi_registers *spireg = (struct kwspi_registers *)MVEBU_SPI_BASE; diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index f52ebf4d67c..aad37803655 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -67,7 +67,7 @@ static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave) static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs) { -#if defined(CONFIG_DM_SPI) +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); @@ -85,7 +85,7 @@ static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs) static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs) { -#if defined(CONFIG_DM_SPI) +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); @@ -415,7 +415,7 @@ static int mxc_spi_claim_bus_internal(struct mxc_spi_slave *mxcs, int cs) return 0; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index 6a615d1498e..ae08531f1ed 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -109,7 +109,7 @@ struct mcspi { }; struct omap3_spi_priv { -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct spi_slave slave; #endif struct mcspi *regs; @@ -455,7 +455,7 @@ static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv) writel(conf, &priv->regs->modulctrl); } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static inline struct omap3_spi_priv *to_omap3_spi(struct spi_slave *slave) { diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c index 2839dd1cebd..aa1c03047e2 100644 --- a/drivers/spi/sh_qspi.c +++ b/drivers/spi/sh_qspi.c @@ -68,7 +68,7 @@ struct sh_qspi_regs { }; struct sh_qspi_slave { -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct spi_slave slave; #endif struct sh_qspi_regs *regs; @@ -223,7 +223,7 @@ static int sh_qspi_xfer_common(struct sh_qspi_slave *ss, unsigned int bitlen, return ret; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static inline struct sh_qspi_slave *to_sh_qspi(struct spi_slave *slave) { return container_of(slave, struct sh_qspi_slave, slave); diff --git a/env/sf.c b/env/sf.c index 02ed846fc73..3e524f29479 100644 --- a/env/sf.c +++ b/env/sf.c @@ -38,7 +38,7 @@ static struct spi_flash *env_flash; static int setup_flash_device(void) { -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; int ret; diff --git a/include/spi.h b/include/spi.h index 5cc6d6e0087..9b4fb8dc0b2 100644 --- a/include/spi.h +++ b/include/spi.h @@ -39,7 +39,7 @@ #define SPI_DEFAULT_WORDLEN 8 -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) /* TODO(sjg@chromium.org): Remove this and use max_hz from struct spi_slave */ struct dm_spi_bus { uint max_hz; @@ -131,7 +131,7 @@ enum spi_polarity { * @flags: Indication of SPI flags. */ struct spi_slave { -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev; /* struct spi_slave is dev->parentdata */ uint max_hz; uint speed; @@ -317,7 +317,7 @@ void spi_flash_copy_mmap(void *data, void *offset, size_t len); */ int spi_cs_is_valid(unsigned int bus, unsigned int cs); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) /** * Activate a SPI chipselect. * This function is provided by the board code when using a driver @@ -367,7 +367,7 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte) return ret < 0 ? ret : din[1]; } -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) /** * struct spi_cs_info - Information about a bus chip select diff --git a/include/spi_flash.h b/include/spi_flash.h index d9b2af856c0..b3366194876 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -39,7 +39,7 @@ struct dm_spi_flash_ops { /* Access the serial operations for a device */ #define sf_get_ops(dev) ((struct dm_spi_flash_ops *)(dev)->driver->ops) -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) /** * spi_flash_read_dm() - Read data from SPI flash * diff --git a/test/dm/spi.c b/test/dm/spi.c index 8e417acc5f2..474008cde0d 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -117,7 +117,7 @@ static int dm_test_spi_xfer(struct unit_test_state *uts) * Since we are about to destroy all devices, we must tell sandbox * to forget the emulation device */ -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) sandbox_sf_unbind_emul(state_get_current(), busnum, cs); #endif -- cgit v1.3.1