summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/board_r.c4
-rw-r--r--common/cyclic.c17
-rw-r--r--common/init/board_init.c7
-rw-r--r--common/spl/Kconfig15
4 files changed, 40 insertions, 3 deletions
diff --git a/common/board_r.c b/common/board_r.c
index 65ff5fb595c..980bd3813af 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -814,7 +814,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (CONFIG_IS_ENABLED(X86_64) && !IS_ENABLED(CONFIG_EFI_APP))
arch_setup_gd(new_gd);
-#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
+#if defined(CONFIG_RISCV)
+ set_gd(new_gd);
+#elif !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
gd = new_gd;
#endif
gd->flags &= ~GD_FLG_LOG_READY;
diff --git a/common/cyclic.c b/common/cyclic.c
index b695f092f52..ec952a01ee1 100644
--- a/common/cyclic.c
+++ b/common/cyclic.c
@@ -28,9 +28,23 @@ struct hlist_head *cyclic_get_list(void)
return (struct hlist_head *)&gd->cyclic_list;
}
+static bool cyclic_is_registered(const struct cyclic_info *cyclic)
+{
+ const struct cyclic_info *c;
+
+ hlist_for_each_entry(c, cyclic_get_list(), list) {
+ if (c == cyclic)
+ return true;
+ }
+
+ return false;
+}
+
void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
uint64_t delay_us, const char *name)
{
+ cyclic_unregister(cyclic);
+
memset(cyclic, 0, sizeof(*cyclic));
/* Store values in struct */
@@ -43,6 +57,9 @@ void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
void cyclic_unregister(struct cyclic_info *cyclic)
{
+ if (!cyclic_is_registered(cyclic))
+ return;
+
hlist_del(&cyclic->list);
}
diff --git a/common/init/board_init.c b/common/init/board_init.c
index a06ec1caa2c..2a6f39f51ad 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -13,8 +13,11 @@
DECLARE_GLOBAL_DATA_PTR;
-/* Unfortunately x86 or ARM can't compile this code as gd cannot be assigned */
-#if !defined(CONFIG_X86) && !defined(CONFIG_ARM)
+/*
+ * Unfortunately x86, ARM and RISC-V can't compile this code as gd is defined
+ * as macro and cannot be assigned.
+ */
+#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_RISCV)
__weak void arch_setup_gd(struct global_data *gd_ptr)
{
gd = gd_ptr;
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index a84a0f83924..be87b3e63fd 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -974,6 +974,21 @@ config SPL_NAND_SUPPORT
This enables the drivers in drivers/mtd/nand/raw as part of an SPL
build.
+config SPL_NAND_RAW_U_BOOT_USE_SECTOR
+ bool "NAND raw mode: by sector"
+ depends on SPL_NAND_SUPPORT
+ select SPL_LOAD_BLOCK
+ help
+ Use sector number for specifying U-Boot location on NAND in
+ raw mode.
+
+config SPL_NAND_RAW_U_BOOT_SECTOR
+ hex "Address on the NAND to load U-Boot from"
+ depends on SPL_NAND_RAW_U_BOOT_USE_SECTOR
+ help
+ Address on the NAND to load U-Boot from, when the NAND is being used
+ in raw mode. Units: NAND disk sectors (1 sector = 512 bytes).
+
config SPL_NAND_RAW_ONLY
bool "Support to boot only raw u-boot.bin images"
depends on SPL_NAND_SUPPORT