From db5489f4be000cbb7e7ce9cc1a264c5d3d25b56f Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 9 Dec 2022 23:04:36 +0800 Subject: riscv: Implement semihost.h for earlycon semihost driver Per RISC-V semihosting spec [1], implement semihost.h for the existing Arm semihosting earlycon driver to work on RISC-V. Link: https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc [1] Signed-off-by: Bin Meng Tested-by: Sergey Matyukevich Acked-by: Palmer Dabbelt Link: https://lore.kernel.org/r/20221209150437.795918-3-bmeng@tinylab.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/tty/serial/Kconfig') diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index c55b947f3cdb..5a2cf9686b20 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -75,7 +75,7 @@ config SERIAL_AMBA_PL011_CONSOLE config SERIAL_EARLYCON_ARM_SEMIHOST bool "Early console using ARM semihosting" - depends on ARM64 || ARM + depends on ARM64 || ARM || RISCV select SERIAL_CORE select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON -- cgit v1.2.3 From 359fb3f870465cc3b9a77728d09e033a248b40b6 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 9 Dec 2022 23:04:37 +0800 Subject: serial: Rename earlycon semihost driver Now that earlycon semihost driver works on RISC-V too, let's use a much more generic name for the driver. Signed-off-by: Bin Meng Tested-by: Sergey Matyukevich Acked-by: Palmer Dabbelt Link: https://lore.kernel.org/r/20221209150437.795918-4-bmeng@tinylab.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 12 ++++++------ drivers/tty/serial/Makefile | 2 +- drivers/tty/serial/earlycon-arm-semihost.c | 28 ---------------------------- drivers/tty/serial/earlycon-semihost.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 drivers/tty/serial/earlycon-arm-semihost.c create mode 100644 drivers/tty/serial/earlycon-semihost.c (limited to 'drivers/tty/serial/Kconfig') diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 5a2cf9686b20..fc99bb09e045 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -73,17 +73,17 @@ config SERIAL_AMBA_PL011_CONSOLE your boot loader (lilo or loadlin) about how to pass options to the kernel at boot time.) -config SERIAL_EARLYCON_ARM_SEMIHOST - bool "Early console using ARM semihosting" +config SERIAL_EARLYCON_SEMIHOST + bool "Early console using Arm compatible semihosting" depends on ARM64 || ARM || RISCV select SERIAL_CORE select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON help - Support for early debug console using ARM semihosting. This enables - the console before standard serial driver is probed. This is enabled - with "earlycon=smh" on the kernel command line. The console is - enabled when early_param is processed. + Support for early debug console using Arm compatible semihosting. + This enables the console before standard serial driver is probed. + This is enabled with "earlycon=smh" on the kernel command line. + The console is enabled when early_param is processed. config SERIAL_EARLYCON_RISCV_SBI bool "Early console using RISC-V SBI" diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 238a9557b487..cd9afd9e3018 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o -obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o +obj-$(CONFIG_SERIAL_EARLYCON_SEMIHOST) += earlycon-semihost.o obj-$(CONFIG_SERIAL_EARLYCON_RISCV_SBI) += earlycon-riscv-sbi.o # These Sparc drivers have to appear before others such as 8250 diff --git a/drivers/tty/serial/earlycon-arm-semihost.c b/drivers/tty/serial/earlycon-arm-semihost.c deleted file mode 100644 index e4692a8433f9..000000000000 --- a/drivers/tty/serial/earlycon-arm-semihost.c +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2012 ARM Ltd. - * Author: Marc Zyngier - * - * Adapted for ARM and earlycon: - * Copyright (C) 2014 Linaro Ltd. - * Author: Rob Herring - */ -#include -#include -#include -#include -#include - -static void smh_write(struct console *con, const char *s, unsigned n) -{ - struct earlycon_device *dev = con->data; - uart_console_write(&dev->port, s, n, smh_putc); -} - -static int -__init early_smh_setup(struct earlycon_device *device, const char *opt) -{ - device->con->write = smh_write; - return 0; -} -EARLYCON_DECLARE(smh, early_smh_setup); diff --git a/drivers/tty/serial/earlycon-semihost.c b/drivers/tty/serial/earlycon-semihost.c new file mode 100644 index 000000000000..e4692a8433f9 --- /dev/null +++ b/drivers/tty/serial/earlycon-semihost.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2012 ARM Ltd. + * Author: Marc Zyngier + * + * Adapted for ARM and earlycon: + * Copyright (C) 2014 Linaro Ltd. + * Author: Rob Herring + */ +#include +#include +#include +#include +#include + +static void smh_write(struct console *con, const char *s, unsigned n) +{ + struct earlycon_device *dev = con->data; + uart_console_write(&dev->port, s, n, smh_putc); +} + +static int +__init early_smh_setup(struct earlycon_device *device, const char *opt) +{ + device->con->write = smh_write; + return 0; +} +EARLYCON_DECLARE(smh, early_smh_setup); -- cgit v1.2.3 From 98a59cd26e22e34ecae6af769cfc9f3b4ecd6c72 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 25 Nov 2022 14:27:56 +0100 Subject: serial: liteuart: drop obsolete dependency on COMPILE_TEST Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it is possible to test-build any driver which depends on OF on any architecture by explicitly selecting OF. Therefore depending on COMPILE_TEST as an alternative is no longer needed. It is actually better to always build such drivers with OF enabled, so that the test builds are closer to how each driver will actually be built on its intended target. Building them without OF may not test much as the compiler will optimize out potentially large parts of the code. In the worst case, this could even pop false positive warnings. Dropping COMPILE_TEST here improves the quality of our testing and avoids wasting time on non-existent issues. Signed-off-by: Jean Delvare Cc: Karol Gugala Cc: Mateusz Holenko Cc: Gabriel Somlo Cc: Joel Stanley Cc: Greg Kroah-Hartman Acked-by: Gabriel Somlo Link: https://lore.kernel.org/r/20221125142756.3e51a28d@endymion.delvare Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/tty/serial/Kconfig') diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index fc99bb09e045..eb236f7ca7f9 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1507,7 +1507,7 @@ config SERIAL_MILBEAUT_USIO_CONSOLE config SERIAL_LITEUART tristate "LiteUART serial port support" depends on HAS_IOMEM - depends on OF || COMPILE_TEST + depends on OF depends on LITEX || COMPILE_TEST select SERIAL_CORE help -- cgit v1.2.3