From dd084b0a378c83e1f80785cc82049578849fb3d6 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:10 +0300 Subject: Kconfig: Convert CONFIG_SYS_SRAM_BASE to Kconfig This converts ad-hoc CONFIG_SYS_SRAM_BASE to Kconfig. Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- include/configs/pic32mzdask.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 73edd28f1a6..25b898f2e63 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -19,7 +19,6 @@ /*---------------------------------------------------------------------- * Memory Layout */ -#define CONFIG_SYS_SRAM_BASE 0x80000000 #define CONFIG_SYS_SRAM_SIZE 0x00080000 /* 512K */ /* Initial RAM for temporary stack, global data */ -- cgit v1.3.1 From 9f63f02755f4cbdb8ee39d8da605d2f643aae220 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:11 +0300 Subject: Kconfig: Convert CONFIG_SYS_SRAM_SIZE to Kconfig This converts ad-hoc CONFIG_SYS_SRAM_SIZE to Kconfig. Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- Kconfig | 7 +++++++ include/configs/devkit8000.h | 1 - include/configs/pic32mzdask.h | 2 -- include/configs/tricorder.h | 1 - scripts/config_whitelist.txt | 1 - 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/Kconfig b/Kconfig index 9f7707a6529..583d39d1a3a 100644 --- a/Kconfig +++ b/Kconfig @@ -395,6 +395,13 @@ config SYS_SRAM_BASE default 0x80000000 if TARGET_PIC32MZDASK default 0x0 +config SYS_SRAM_SIZE + hex + default 0x00080000 if TARGET_PIC32MZDASK + default 0x10000 if TARGET_DEVKIT8000 + default 0x10000 if TARGET_TRICORDER + default 0x0 + endmenu # General setup menu "Boot images" diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 5ef0fe7f924..4a287128334 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -139,7 +139,6 @@ /* SRAM config */ #define CONFIG_SYS_SRAM_START 0x40200000 -#define CONFIG_SYS_SRAM_SIZE 0x10000 /* Defines for SPL */ diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 25b898f2e63..d50edc7715f 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -19,8 +19,6 @@ /*---------------------------------------------------------------------- * Memory Layout */ -#define CONFIG_SYS_SRAM_SIZE 0x00080000 /* 512K */ - /* Initial RAM for temporary stack, global data */ #define CONFIG_SYS_INIT_RAM_SIZE 0x10000 #define CONFIG_SYS_INIT_RAM_ADDR \ diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index 02f57281afd..b3ae350b776 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -199,7 +199,6 @@ /* SRAM config */ #define CONFIG_SYS_SRAM_START 0x40200000 -#define CONFIG_SYS_SRAM_SIZE 0x10000 /* Defines for SPL */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 1345cef1349..0d526cf0455 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -3715,7 +3715,6 @@ CONFIG_SYS_SPL_LEN CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_SPR -CONFIG_SYS_SRAM_SIZE CONFIG_SYS_SRAM_START CONFIG_SYS_SRIO CONFIG_SYS_SRIO1_MEM_BASE -- cgit v1.3.1 From 9a17bfb6420bb5de1781b37b5a423f41aab29000 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:12 +0300 Subject: Kconfig: Remove CONFIG_SYS_SRAM_START Remove ad-hoc CONFIG_SYS_SRAM_START and use CONFIG_SYS_SRAM_BASE instead. Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- Kconfig | 2 ++ include/configs/devkit8000.h | 3 --- include/configs/tricorder.h | 3 --- scripts/config_whitelist.txt | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/Kconfig b/Kconfig index 583d39d1a3a..372425ed529 100644 --- a/Kconfig +++ b/Kconfig @@ -393,6 +393,8 @@ config SYS_HAS_SRAM config SYS_SRAM_BASE hex default 0x80000000 if TARGET_PIC32MZDASK + default 0x40200000 if TARGET_DEVKIT8000 + default 0x40200000 if TARGET_TRICORDER default 0x0 config SYS_SRAM_SIZE diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 4a287128334..87da4410f5b 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -137,9 +137,6 @@ /* Boot Argument Buffer Size */ -/* SRAM config */ -#define CONFIG_SYS_SRAM_START 0x40200000 - /* Defines for SPL */ /* NAND boot config */ diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index b3ae350b776..55f25857eb3 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -197,9 +197,6 @@ CONFIG_SYS_INIT_RAM_SIZE - \ GENERATED_GBL_DATA_SIZE) -/* SRAM config */ -#define CONFIG_SYS_SRAM_START 0x40200000 - /* Defines for SPL */ #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0d526cf0455..82f8f12e20b 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -3715,7 +3715,6 @@ CONFIG_SYS_SPL_LEN CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_SPR -CONFIG_SYS_SRAM_START CONFIG_SYS_SRIO CONFIG_SYS_SRIO1_MEM_BASE CONFIG_SYS_SRIO1_MEM_BUS -- cgit v1.3.1 From ba7431031f657ff18203c9598496e0288809ae17 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:14 +0300 Subject: board_f: Introduce setup_bdinfo initcall Introduce setup_bdinfo initcall as a generic routine to populate bdinfo fields. Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- common/board_f.c | 6 ++++++ include/init.h | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'include') diff --git a/common/board_f.c b/common/board_f.c index 88ff0424a7b..72446f6da50 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -598,6 +598,11 @@ static int display_new_sp(void) return 0; } +int setup_bdinfo(void) +{ + return 0; +} + #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) static int setup_board_part1(void) @@ -975,6 +980,7 @@ static const init_fnc_t init_sequence_f[] = { reserve_stacks, dram_init_banksize, show_dram_config, + setup_bdinfo, #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) setup_board_part1, diff --git a/include/init.h b/include/init.h index de408baf892..f2cd7700795 100644 --- a/include/init.h +++ b/include/init.h @@ -141,6 +141,16 @@ int arch_reserve_stacks(void); */ int arch_reserve_mmu(void); +/** + * setup_bdinfo() - Generic boardinfo setup + * + * Routine for populating various generic boardinfo fields of + * gd->bd. It is called during the generic board init sequence. + * + * Return: 0 if OK + */ +int setup_bdinfo(void); + /** * init_cache_f_r() - Turn on the cache in preparation for relocation * -- cgit v1.3.1 From 81e7cb1e71fb216589b4e2fd3eb498ec72489a09 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:15 +0300 Subject: board_f: Introduce arch_setup_bdinfo initcall Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and setup_board_part2 calls during pre-relocation init to populate gd->bd boardinfo fields. This makes the generic init sequence cluttered with arch-specific ifdefs. In order to clean these arch-specific sequences from generic init, introduce arch_setup_bdinfo weak initcall so that everyone can define their own bdinfo setup routines. Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- common/board_f.c | 7 ++++++- include/init.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/common/board_f.c b/common/board_f.c index 72446f6da50..43564314886 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -598,11 +598,16 @@ static int display_new_sp(void) return 0; } -int setup_bdinfo(void) +__weak int arch_setup_bdinfo(void) { return 0; } +int setup_bdinfo(void) +{ + return arch_setup_bdinfo(); +} + #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) static int setup_board_part1(void) diff --git a/include/init.h b/include/init.h index f2cd7700795..0f48ccb57ad 100644 --- a/include/init.h +++ b/include/init.h @@ -141,6 +141,18 @@ int arch_reserve_stacks(void); */ int arch_reserve_mmu(void); +/** + * arch_setup_bdinfo() - Architecture dependent boardinfo setup + * + * Architecture-specific routine for populating various boardinfo fields of + * gd->bd. It is called during the generic board init sequence. + * + * If an implementation is not provided, it will just be a nop stub. + * + * Return: 0 if OK + */ +int arch_setup_bdinfo(void); + /** * setup_bdinfo() - Generic boardinfo setup * -- cgit v1.3.1 From 39a192231b065bb026c170d9384b622009796a3d Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 24 Jul 2020 14:12:22 +0300 Subject: drivers: serial: Make serial_initialize return int serial_initialize is called only during the common init sequence, after relocation (in common/board_r.c). Because it has a void return value, it has to wrapped in initr_serial. In order to be able to get rid of this indirection, make serial_initialize return int. Remove extern from prototype in order to silence the following checkpatch warning: check: extern prototypes should be avoided in .h files Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- drivers/serial/serial-uclass.c | 4 ++-- drivers/serial/serial.c | 4 +++- include/serial.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index a0af0e6bfde..0027625ebfd 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -170,9 +170,9 @@ int serial_init(void) } /* Called after relocation */ -void serial_initialize(void) +int serial_initialize(void) { - serial_init(); + return serial_init(); } static void _serial_putc(struct udevice *dev, char ch) diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index da017dc5b3e..53358acb81f 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -170,7 +170,7 @@ void serial_register(struct serial_device *dev) * serial port to the serial core. That serial port is then used as a * default output. */ -void serial_initialize(void) +int serial_initialize(void) { atmel_serial_initialize(); mcf_serial_initialize(); @@ -183,6 +183,8 @@ void serial_initialize(void) mtk_serial_initialize(); serial_assign(default_serial_console()->name); + + return 0; } static int serial_stub_start(struct stdio_dev *sdev) diff --git a/include/serial.h b/include/serial.h index c590637b1f3..6d1e62c6770 100644 --- a/include/serial.h +++ b/include/serial.h @@ -42,10 +42,10 @@ extern struct serial_device eserial5_device; extern struct serial_device eserial6_device; extern void serial_register(struct serial_device *); -extern void serial_initialize(void); extern void serial_stdio_init(void); extern int serial_assign(const char *name); extern void serial_reinit_all(void); +int serial_initialize(void); /* For usbtty */ #ifdef CONFIG_USB_TTY -- cgit v1.3.1