From 3d5ac3536be97a679763e261c55167bfd356a412 Mon Sep 17 00:00:00 2001 From: Pragnesh Patel Date: Fri, 29 May 2020 12:14:52 +0530 Subject: riscv: sifive: fu540: Enable SiFive PWM driver This patch enables SiFive PWM driver for the SiFive Unleashed board. Signed-off-by: Pragnesh Patel Reviewed-by: Bin Meng --- board/sifive/fu540/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board') diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 86193d7668b..683668d0599 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -65,5 +65,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply SMP imply MISC imply SIFIVE_OTP + imply DM_PWM + imply PWM_SIFIVE endif -- cgit v1.2.3 From 868e295ef72535300037fc264e770cfdca3f5894 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Wed, 15 Jul 2020 15:38:58 +0530 Subject: sifive: fu540: Add runtime boot mode detection Add support to detect boot mode at runtime for SiFive FU540 boards. Signed-off-by: Jagan Teki Reviewed-by: Bin Meng Tested-by: Bin Meng --- board/sifive/fu540/fu540.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'board') diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c index 27ff52f9035..57753ba50ba 100644 --- a/board/sifive/fu540/fu540.c +++ b/board/sifive/fu540/fu540.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -128,14 +129,26 @@ int board_init(void) } #ifdef CONFIG_SPL +#define MODE_SELECT_REG 0x1000 +#define MODE_SELECT_QSPI 0x6 +#define MODE_SELECT_SD 0xb +#define MODE_SELECT_MASK GENMASK(3, 0) + u32 spl_boot_device(void) { -#ifdef CONFIG_SPL_MMC_SUPPORT - return BOOT_DEVICE_MMC1; -#else - puts("Unknown boot device\n"); - hang(); -#endif + u32 mode_select = readl((void *)MODE_SELECT_REG); + u32 boot_device = mode_select & MODE_SELECT_MASK; + + switch (boot_device) { + case MODE_SELECT_QSPI: + return BOOT_DEVICE_SPI; + case MODE_SELECT_SD: + return BOOT_DEVICE_MMC1; + default: + debug("Unsupported boot device 0x%x but trying MMC1\n", + boot_device); + return BOOT_DEVICE_MMC1; + } } #endif -- cgit v1.2.3 From 662d518e8a547038494a7e9bf50d58195174a4ef Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Wed, 15 Jul 2020 15:39:01 +0530 Subject: sifive: fu540: Mark the default env as SPI flash Mark the default U-Boot environment as SPI flash since this is an on board flash device. Reviewed-by: Bin Meng Signed-off-by: Jagan Teki Reviewed-by: Bin Meng Tested-by: Bin Meng --- board/sifive/fu540/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'board') diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 683668d0599..4aa1e4c19d9 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -27,6 +27,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select SIFIVE_FU540 select SUPPORT_SPL + select ENV_IS_IN_SPI_FLASH select RAM select SPL_RAM if SPL imply CMD_DHCP -- cgit v1.2.3 From 265d46ba137c59f83c9d2c86900960415292dbed Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sun, 19 Jul 2020 20:06:46 -0700 Subject: Revert "Revert "riscv: sifive: fu540: Add gpio-restart support"" This reverts commit 23da3c682a84a2ad67a67287979dd4f5259ff607. Now the build failure of sifive_fu540_defconfig board has been fixed, revert this "revert patch". Signed-off-by: Bin Meng --- board/sifive/fu540/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board') diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 4aa1e4c19d9..f3217f62c43 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -68,5 +68,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply SIFIVE_OTP imply DM_PWM imply PWM_SIFIVE + imply SYSRESET + imply SYSRESET_GPIO endif -- cgit v1.2.3 From a0cc38ab44b0fa8af65632cbea1b13630195f03d Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 22 Jun 2020 22:29:45 -0700 Subject: riscv: qemu: Add syscon reboot and poweroff support This adds syscon reboot and poweroff support to QEMU RISC-V. Signed-off-by: Bin Meng Reviewed-by: Pragnesh Patel --- board/emulation/qemu-riscv/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'board') diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index ad99b08b447..617c4aa33ff 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -53,5 +53,9 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply NVME imply SPL_RAM_SUPPORT imply SPL_RAM_DEVICE + imply SYSRESET + imply SYSRESET_SYSCON + imply CMD_POWEROFF + imply SYSRESET_CMD_POWEROFF endif -- cgit v1.2.3 From e8fa43182a487e7542c49408eb2499cc4c0ed53c Mon Sep 17 00:00:00 2001 From: Rick Chen Date: Fri, 17 Jul 2020 16:24:44 +0800 Subject: riscv: ae350: Use fdtdec_get_addr_size_auto_noparent to parse smc reg Use fdtdec_get_addr_size_auto_noparent to read the "reg" property instead of fdtdec_get_addr. This will increase the compatibility of dtb parsing. Signed-off-by: Rick Chen Acked-by: Leo Liang Reviewed-by: Bin Meng Tested-by: Leo Liang --- board/AndesTech/ax25-ae350/ax25-ae350.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'board') diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c index add0d56ef2d..59a43e4dcc4 100644 --- a/board/AndesTech/ax25-ae350/ax25-ae350.c +++ b/board/AndesTech/ax25-ae350/ax25-ae350.c @@ -71,7 +71,8 @@ int smc_init(void) if (node < 0) return -FDT_ERR_NOTFOUND; - addr = fdtdec_get_addr(blob, node, "reg"); + addr = fdtdec_get_addr_size_auto_noparent(blob, node, + "reg", 0, NULL, false); if (addr == FDT_ADDR_T_NONE) return -EINVAL; -- cgit v1.2.3