Skip to contentSkip to conversation

Improvements for ARC UART

PATCH New Alexey Brodkin 2 participants 6 messages May 21, 2018 – May 24, 2018

lore
Share & tools
lore
#0 lore raw

cover Improvements for ARC UART

* Move ARC_SERIAL to Kconfig
* Implement DEBUG_SERIAL in ARC_UART and
* Enable DEBUG_UART in nSIM boards

Alexey Brodkin (3):
serial: Convert ARC_SERIAL to Kconfig
serial/serial_arc: Implement debug serial
ARC: Enable debug UART on nSIM boards

 configs/nsim_700_defconfig    |  5 +++++
 configs/nsim_700be_defconfig  |  5 +++++
 configs/nsim_hs38_defconfig   |  5 +++++
 configs/nsim_hs38be_defconfig |  5 +++++
 drivers/serial/Kconfig        | 16 ++++++++++++++++
 drivers/serial/serial_arc.c   | 26 ++++++++++++++++++++++++++
 include/configs/nsim.h        | 10 ----------
 scripts/config_whitelist.txt  |  1 -
 8 files changed, 62 insertions(+), 11 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/3 serial: Convert ARC_SERIAL to Kconfig

One step closer to completely Kconfig-driven target configuration in U-Boot :)

---
 configs/nsim_700_defconfig    |  1 +
 configs/nsim_700be_defconfig  |  1 +
 configs/nsim_hs38_defconfig   |  1 +
 configs/nsim_hs38be_defconfig |  1 +
 drivers/serial/Kconfig        |  7 +++++++
 include/configs/nsim.h        | 10 ----------
 scripts/config_whitelist.txt  |  1 -
 7 files changed, 11 insertions(+), 11 deletions(-)
configs/nsim_700_defconfig +1 -0
index 12fe5f77c64f..01a461b851d9 100644
@@ -13,4 +13,5 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_700be_defconfig +1 -0
index 6c0dba7c6d05..9188ab24d772 100644
@@ -14,4 +14,5 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_hs38_defconfig +1 -0
index bb31adb381df..58ada454e75c 100644
@@ -14,4 +14,5 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_hs38be_defconfig +1 -0
index a2cc238433f7..53feb29a48ef 100644
@@ -15,4 +15,5 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
drivers/serial/Kconfig +7 -0
index 5937910e5bf9..1aab0320f676 100644
@@ -425,6 +425,13 @@ config AR933X_UART
 	  tree binding to operate, please refer to the document at
 	  doc/device-tree-bindings/serial/qca,ar9330-uart.txt.
 
+config ARC_SERIAL
+	bool "ARC UART support"
+	depends on DM_SERIAL
+	help
+	  Select this to enable support for ARC UART now typically
+	  only used in Synopsys DesignWare ARC simulators like nSIM.
+
 config ATMEL_USART
 	bool "Atmel USART support"
 	help
include/configs/nsim.h +0 -10
index 0f22606feed5..c3f34a91e433 100644
@@ -24,16 +24,6 @@
 #define CONFIG_SYS_BOOTM_LEN		SZ_32M
 #define CONFIG_SYS_LOAD_ADDR		0x82000000
 
-/*
- * UART configuration
- *
- */
-#define CONFIG_ARC_SERIAL
-
-/*
- * Command line configuration
- */
-
 /*
  * Environment settings
  */
scripts/config_whitelist.txt +0 -1
index 832779817928..2ed737c2b404 100644
@@ -47,7 +47,6 @@ CONFIG_ARCH_RMOBILE_EXTRAM_BOOT
 CONFIG_ARCH_TEGRA
 CONFIG_ARCH_USE_BUILTIN_BSWAP
 CONFIG_ARC_MMU_VER
-CONFIG_ARC_SERIAL
 CONFIG_ARIES_M28_V10
 CONFIG_ARMADA100
 CONFIG_ARMADA100_FEC
Signature · 1 line
2.17.0
#2 lore raw

PATCH 2/3 serial/serial_arc: Implement debug serial

In reply to Alexey Brodkin
---
 drivers/serial/Kconfig      |  9 +++++++++
 drivers/serial/serial_arc.c | 26 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
drivers/serial/Kconfig +9 -0
index 1aab0320f676..877790986081 100644
@@ -197,6 +197,15 @@ config DEBUG_UART_AR933X
 	  driver will be available until the real driver model serial is
 	  running.
 
+config DEBUG_ARC_SERIAL
+	bool "ARC UART"
+	depends on ARC_SERIAL
+	help
+	  Select this to enable a debug UART using the ARC UART driver.
+	  You will need to provide parameters to make this work. The
+	  driver will be available until the real driver model serial is
+	  running.
+
 config DEBUG_UART_ATMEL
 	bool "Atmel USART"
 	help
drivers/serial/serial_arc.c +26 -0
index da4a07ab2f66..925f0c255544 100644
@@ -130,3 +130,29 @@ U_BOOT_DRIVER(serial_arc) = {
 	.ops	= &arc_serial_ops,
 	.flags = DM_FLAG_PRE_RELOC,
 };
+
+#ifdef CONFIG_DEBUG_ARC_SERIAL
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+	struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
+	int arc_console_baud = CONFIG_DEBUG_UART_CLOCK / (CONFIG_BAUDRATE * 4) - 1;
+
+	writeb(arc_console_baud & 0xff, &regs->baudl);
+	writeb((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+}
+
+static inline void _debug_uart_putc(int c)
+{
+	struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
+
+	while (!(readb(&regs->status) & UART_TXEMPTY))
+		;
+
+	writeb(c, &regs->data);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
Signature · 1 line
2.17.0
#3 lore raw

PATCH 3/3 ARC: Enable debug UART on nSIM boards

In reply to Alexey Brodkin
---
 configs/nsim_700_defconfig    | 4 ++++
 configs/nsim_700be_defconfig  | 4 ++++
 configs/nsim_hs38_defconfig   | 4 ++++
 configs/nsim_hs38be_defconfig | 4 ++++
 4 files changed, 16 insertions(+)
configs/nsim_700_defconfig +4 -0
index 01a461b851d9..b10044986faa 100644
@@ -3,6 +3,7 @@ CONFIG_TARGET_NSIM=y
 CONFIG_SYS_TEXT_BASE=0x81000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEFAULT_DEVICE_TREE="nsim"
+CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyARC0,115200n8"
@@ -13,5 +14,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_ARC_SERIAL=y
+CONFIG_DEBUG_UART_BASE=0xc0fc1000
+CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_700be_defconfig +4 -0
index 9188ab24d772..6f03145517d6 100644
@@ -4,6 +4,7 @@ CONFIG_TARGET_NSIM=y
 CONFIG_SYS_TEXT_BASE=0x81000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEFAULT_DEVICE_TREE="nsim"
+CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyARC0,115200n8"
@@ -14,5 +15,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_ARC_SERIAL=y
+CONFIG_DEBUG_UART_BASE=0xc0fc1000
+CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_hs38_defconfig +4 -0
index 58ada454e75c..526dd3e5e245 100644
@@ -4,6 +4,7 @@ CONFIG_TARGET_NSIM=y
 CONFIG_SYS_TEXT_BASE=0x81000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEFAULT_DEVICE_TREE="nsim"
+CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyARC0,115200n8"
@@ -14,5 +15,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_ARC_SERIAL=y
+CONFIG_DEBUG_UART_BASE=0xc0fc1000
+CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/nsim_hs38be_defconfig +4 -0
index 53feb29a48ef..141051ded1fb 100644
@@ -5,6 +5,7 @@ CONFIG_TARGET_NSIM=y
 CONFIG_SYS_TEXT_BASE=0x81000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEFAULT_DEVICE_TREE="nsim"
+CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyARC0,115200n8"
@@ -15,5 +16,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_ARC_SERIAL=y
+CONFIG_DEBUG_UART_BASE=0xc0fc1000
+CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_ARC_SERIAL=y
 CONFIG_USE_PRIVATE_LIBGCC=y
Signature · 1 line
2.17.0
#4 lore raw

cover Improvements for ARC UART

In reply to Alexey Brodkin

Hi Tom,

Quoted 9 lines · Alexey Brodkin

* Move ARC_SERIAL to Kconfig
* Implement DEBUG_SERIAL in ARC_UART and
* Enable DEBUG_UART in nSIM boards

Alexey Brodkin (3):
serial: Convert ARC_SERIAL to Kconfig
serial/serial_arc: Implement debug serial
ARC: Enable debug UART on nSIM boards

Quoted 9 lines
 configs/nsim_700_defconfig    |  5 +++++
 configs/nsim_700be_defconfig  |  5 +++++
 configs/nsim_hs38_defconfig   |  5 +++++
 configs/nsim_hs38be_defconfig |  5 +++++
 drivers/serial/Kconfig        | 16 ++++++++++++++++
 drivers/serial/serial_arc.c   | 26 ++++++++++++++++++++++++++
 include/configs/nsim.h        | 10 ----------
 scripts/config_whitelist.txt  |  1 -
 8 files changed, 62 insertions(+), 11 deletions(-)

Do you want to pull this series yourself or I may push it via my tree (in which case I'll add another similar series from Eugeniy, see
https://patchwork.ozlabs.org/project/uboot/list/?series=42321
which BTW is a pre-requisite because of generic ARC fixup in
https://patchwork.ozlabs.org/patch/907993/).

-Alexey

#5 lore raw

cover Improvements for ARC UART

Quoted 22 lines · Alexey Brodkin

Hi Tom,

Quoted 9 lines · Alexey Brodkin

* Move ARC_SERIAL to Kconfig
* Implement DEBUG_SERIAL in ARC_UART and
* Enable DEBUG_UART in nSIM boards

Alexey Brodkin (3):
serial: Convert ARC_SERIAL to Kconfig
serial/serial_arc: Implement debug serial
ARC: Enable debug UART on nSIM boards

Quoted 9 lines
 configs/nsim_700_defconfig    |  5 +++++
 configs/nsim_700be_defconfig  |  5 +++++
 configs/nsim_hs38_defconfig   |  5 +++++
 configs/nsim_hs38be_defconfig |  5 +++++
 drivers/serial/Kconfig        | 16 ++++++++++++++++
 drivers/serial/serial_arc.c   | 26 ++++++++++++++++++++++++++
 include/configs/nsim.h        | 10 ----------
 scripts/config_whitelist.txt  |  1 -
 8 files changed, 62 insertions(+), 11 deletions(-)
Quoted 6 lines

Do you want to pull this series yourself or I may push it via my tree (in which case I'll add another similar series from Eugeniy, see
https://patchwork.ozlabs.org/project/uboot/list/?series=42321
which BTW is a pre-requisite because of generic ARC fixup in
https://patchwork.ozlabs.org/patch/907993/).

You can do this via the your tree, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180524/eb0cdb01/attachment.sig>