All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set
@ 2020-05-09 20:37 Marek Vasut
  2020-05-09 20:37 ` [PATCH 2/5] serial: sh: Improve FIFO empty check on RX Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marek Vasut @ 2020-05-09 20:37 UTC (permalink / raw)
  To: u-boot

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 <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/5] serial: sh: Improve FIFO empty check on RX
  2020-05-09 20:37 [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Marek Vasut
@ 2020-05-09 20:37 ` Marek Vasut
  2020-05-09 20:38 ` [PATCH 3/5] sh: r2dplus: Add SCIF1 to the basic DT Marek Vasut
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-05-09 20:37 UTC (permalink / raw)
  To: u-boot

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 <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 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)
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/5] sh: r2dplus: Add SCIF1 to the basic DT
  2020-05-09 20:37 [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Marek Vasut
  2020-05-09 20:37 ` [PATCH 2/5] serial: sh: Improve FIFO empty check on RX Marek Vasut
@ 2020-05-09 20:38 ` Marek Vasut
  2020-05-09 20:38 ` [PATCH 4/5] sh: r2dplus: Enable DM_SERIAL and DM_CLK Marek Vasut
  2020-05-09 20:38 ` [PATCH 5/5] sh: r2dplus: Enable HUSH Marek Vasut
  3 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-05-09 20:38 UTC (permalink / raw)
  To: u-boot

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 <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 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";
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/5] sh: r2dplus: Enable DM_SERIAL and DM_CLK
  2020-05-09 20:37 [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Marek Vasut
  2020-05-09 20:37 ` [PATCH 2/5] serial: sh: Improve FIFO empty check on RX Marek Vasut
  2020-05-09 20:38 ` [PATCH 3/5] sh: r2dplus: Add SCIF1 to the basic DT Marek Vasut
@ 2020-05-09 20:38 ` Marek Vasut
  2020-05-09 20:38 ` [PATCH 5/5] sh: r2dplus: Enable HUSH Marek Vasut
  3 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-05-09 20:38 UTC (permalink / raw)
  To: u-boot

Switch r2dplus to DM and DT probing for serial and clock.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 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 */
 
 /*
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 5/5] sh: r2dplus: Enable HUSH
  2020-05-09 20:37 [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Marek Vasut
                   ` (2 preceding siblings ...)
  2020-05-09 20:38 ` [PATCH 4/5] sh: r2dplus: Enable DM_SERIAL and DM_CLK Marek Vasut
@ 2020-05-09 20:38 ` Marek Vasut
  3 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-05-09 20:38 UTC (permalink / raw)
  To: u-boot

Enable richer HUSH shell to make working with the board more pleasant.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-09 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 20:37 [PATCH 1/5] sh: Set gd->malloc_base if MALLOC_F_LEN is set Marek Vasut
2020-05-09 20:37 ` [PATCH 2/5] serial: sh: Improve FIFO empty check on RX Marek Vasut
2020-05-09 20:38 ` [PATCH 3/5] sh: r2dplus: Add SCIF1 to the basic DT Marek Vasut
2020-05-09 20:38 ` [PATCH 4/5] sh: r2dplus: Enable DM_SERIAL and DM_CLK Marek Vasut
2020-05-09 20:38 ` [PATCH 5/5] sh: r2dplus: Enable HUSH Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.