[U-Boot] [PATCH 0/3] 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(-)

One step closer to completely Kconfig-driven target configuration in U-Boot :)
Signed-off-by: Alexey Brodkin abrodkin@synopsys.com --- 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(-)
diff --git a/configs/nsim_700_defconfig b/configs/nsim_700_defconfig index 12fe5f77c64f..01a461b851d9 100644 --- a/configs/nsim_700_defconfig +++ b/configs/nsim_700_defconfig @@ -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 diff --git a/configs/nsim_700be_defconfig b/configs/nsim_700be_defconfig index 6c0dba7c6d05..9188ab24d772 100644 --- a/configs/nsim_700be_defconfig +++ b/configs/nsim_700be_defconfig @@ -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 diff --git a/configs/nsim_hs38_defconfig b/configs/nsim_hs38_defconfig index bb31adb381df..58ada454e75c 100644 --- a/configs/nsim_hs38_defconfig +++ b/configs/nsim_hs38_defconfig @@ -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 diff --git a/configs/nsim_hs38be_defconfig b/configs/nsim_hs38be_defconfig index a2cc238433f7..53feb29a48ef 100644 --- a/configs/nsim_hs38be_defconfig +++ b/configs/nsim_hs38be_defconfig @@ -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 diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 5937910e5bf9..1aab0320f676 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -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 diff --git a/include/configs/nsim.h b/include/configs/nsim.h index 0f22606feed5..c3f34a91e433 100644 --- a/include/configs/nsim.h +++ b/include/configs/nsim.h @@ -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 */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 832779817928..2ed737c2b404 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -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

Signed-off-by: Alexey Brodkin abrodkin@synopsys.com --- drivers/serial/Kconfig | 9 +++++++++ drivers/serial/serial_arc.c | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 1aab0320f676..877790986081 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -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 diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index da4a07ab2f66..925f0c255544 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -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, ®s->baudl); + writeb((arc_console_baud & 0xff00) >> 8, ®s->baudh); +} + +static inline void _debug_uart_putc(int c) +{ + struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE; + + while (!(readb(®s->status) & UART_TXEMPTY)) + ; + + writeb(c, ®s->data); +} + +DEBUG_UART_FUNCS + +#endif

Signed-off-by: Alexey Brodkin abrodkin@synopsys.com --- 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(+)
diff --git a/configs/nsim_700_defconfig b/configs/nsim_700_defconfig index 01a461b851d9..b10044986faa 100644 --- a/configs/nsim_700_defconfig +++ b/configs/nsim_700_defconfig @@ -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 diff --git a/configs/nsim_700be_defconfig b/configs/nsim_700be_defconfig index 9188ab24d772..6f03145517d6 100644 --- a/configs/nsim_700be_defconfig +++ b/configs/nsim_700be_defconfig @@ -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 diff --git a/configs/nsim_hs38_defconfig b/configs/nsim_hs38_defconfig index 58ada454e75c..526dd3e5e245 100644 --- a/configs/nsim_hs38_defconfig +++ b/configs/nsim_hs38_defconfig @@ -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 diff --git a/configs/nsim_hs38be_defconfig b/configs/nsim_hs38be_defconfig index 53feb29a48ef..141051ded1fb 100644 --- a/configs/nsim_hs38be_defconfig +++ b/configs/nsim_hs38be_defconfig @@ -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

Hi Tom,
On Mon, 2018-05-21 at 17:03 +0300, Alexey Brodkin wrote:
- 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(-)
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

On Thu, May 24, 2018 at 12:40:30PM +0000, Alexey Brodkin wrote:
Hi Tom,
On Mon, 2018-05-21 at 17:03 +0300, Alexey Brodkin wrote:
- 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(-)
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!
participants (2)
-
Alexey Brodkin
-
Tom Rini