From patchwork Sat May 9 20:37:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245402 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 9 May 2020 22:37:58 +0200 Subject: [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Message-ID: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> The gd->malloc_base must be set before the C runtime if the MALLOC_F_LEN is non-zero, otherwise we hit assertion in dlmalloc.c initf_malloc(). So set it. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/lib/start.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S index f9f26d3779..d6342a16da 100644 --- a/arch/sh/lib/start.S +++ b/arch/sh/lib/start.S @@ -53,7 +53,10 @@ _start: mov.l ._gd_init, r13 /* global data */ mov.l ._stack_init, r15 /* stack */ - +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + mov.l ._gd_malloc_base, r14 + mov.l r15, @r14 +#endif mov.l ._sh_generic_init, r0 jsr @r0 mov #0, r4 @@ -70,5 +73,6 @@ loop: ._bss_start: .long bss_start ._bss_end: .long bss_end ._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE) +._gd_malloc_base: .long (_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE) ._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) ._sh_generic_init: .long board_init_f From patchwork Sat May 9 20:37:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245403 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 9 May 2020 22:37:59 +0200 Subject: [PATCH 2/5] serial: sh: Improve FIFO empty check on RX In-Reply-To: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> References: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> Message-ID: <20200509203802.821856-2-marek.vasut+renesas@gmail.com> If the SCIF is receiving data quickly enough, it may happen that the SCxSR_RDxF flag is cleared in sh_serial_getc_generic(), while the FIFO still contains data. If that happens, the serial_getc_check() reports no data in the FIFO as the flag is no longer set. Add one more check, if the SCxSR_RDxF is not set, read out the FIFO level and if there are still characters in the FIFO, permit reading them out. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- drivers/serial/serial_sh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index acfcc2954a..0a4dfdc377 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -115,7 +115,10 @@ static int serial_getc_check(struct uart_port *port) handle_error(port); if (sci_in(port, SCLSR) & SCxSR_ORER(port)) handle_error(port); - return status & (SCIF_DR | SCxSR_RDxF(port)); + status &= (SCIF_DR | SCxSR_RDxF(port)); + if (status) + return status; + return scif_rxfill(port); } static int sh_serial_getc_generic(struct uart_port *port) From patchwork Sat May 9 20:38:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245404 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 9 May 2020 22:38:00 +0200 Subject: [PATCH 3/5] sh: r2dplus: Add SCIF1 to the basic DT In-Reply-To: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> References: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> Message-ID: <20200509203802.821856-3-marek.vasut+renesas@gmail.com> Add simple DT and clock bindings to r2dplus DT to permit U-Boot to bind the SCIF driver via DT probing instead of hard-coded config options. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/dts/sh7751-r2dplus.dts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts index efaeb33e36..f0ed0e7d45 100644 --- a/arch/sh/dts/sh7751-r2dplus.dts +++ b/arch/sh/dts/sh7751-r2dplus.dts @@ -10,6 +10,29 @@ model = "R2D"; compatible = "renesas,r2d", "renesas,sh7751"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + serial0 = &scif1; + }; + + scif_clks: scif60 { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <60000000>; + u-boot,dm-pre-reloc; + }; + + scif1: serial at ffe80000 { + compatible = "renesas,scif"; + reg = <0xffe80000 0x1000>; + clocks = <&scif_clks>; + clock-names = "fck"; + status = "okay"; + u-boot,dm-pre-reloc; + }; + pci at fe200000 { compatible = "renesas,pci-sh7751"; device_type = "pci"; From patchwork Sat May 9 20:38:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245405 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 9 May 2020 22:38:01 +0200 Subject: [PATCH 4/5] sh: r2dplus: Enable DM_SERIAL and DM_CLK In-Reply-To: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> References: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> Message-ID: <20200509203802.821856-4-marek.vasut+renesas@gmail.com> Switch r2dplus to DM and DT probing for serial and clock. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- configs/r2dplus_defconfig | 5 ++++- include/configs/r2dplus.h | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig index 1aed84905f..b770fd2493 100644 --- a/configs/r2dplus_defconfig +++ b/configs/r2dplus_defconfig @@ -3,7 +3,6 @@ CONFIG_SYS_TEXT_BASE=0x8FE00000 CONFIG_ENV_SIZE=0x40000 CONFIG_ENV_SECT_SIZE=0x40000 CONFIG_TARGET_R2DPLUS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_BOOTDELAY=-1 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttySC0,115200" @@ -24,6 +23,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sh7751-r2dplus" CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0xA0040000 CONFIG_DM=y +CONFIG_CLK=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_CFI=y @@ -31,5 +31,8 @@ CONFIG_DM_ETH=y CONFIG_RTL8139=y CONFIG_PCI=y CONFIG_DM_PCI=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SERIAL_RX_BUFFER=y CONFIG_SCIF_CONSOLE=y CONFIG_USE_PRIVATE_LIBGCC=y diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index a8886251e0..4cd22bb407 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -37,7 +37,6 @@ * SuperH Clock setting */ #define CONFIG_SYS_CLK_FREQ 60000000 -#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SYS_PLL_SETTLING_TIME 100/* in us */ /* From patchwork Sat May 9 20:38:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 245406 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 9 May 2020 22:38:02 +0200 Subject: [PATCH 5/5] sh: r2dplus: Enable HUSH In-Reply-To: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> References: <20200509203802.821856-1-marek.vasut+renesas@gmail.com> Message-ID: <20200509203802.821856-5-marek.vasut+renesas@gmail.com> Enable richer HUSH shell to make working with the board more pleasant. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- configs/r2dplus_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig index b770fd2493..25f0f3b0a4 100644 --- a/configs/r2dplus_defconfig +++ b/configs/r2dplus_defconfig @@ -6,8 +6,7 @@ CONFIG_TARGET_R2DPLUS=y CONFIG_BOOTDELAY=-1 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttySC0,115200" -# CONFIG_CMDLINE_EDITING is not set -# CONFIG_AUTO_COMPLETE is not set +CONFIG_HUSH_PARSER=y CONFIG_CMD_IMLS=y CONFIG_CMD_DM=y CONFIG_CMD_IDE=y