From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v8 04/17] lib: utils/serial: Use kconfig for enabling/disabling drivers
Date: Mon, 8 Aug 2022 09:27:27 +0530 [thread overview]
Message-ID: <20220808035740.69335-5-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220808035740.69335-1-apatel@ventanamicro.com>
We update serial drivers makefile to use kconfig for enabling/disabling
drivers. To avoid compile errors, we also enable appropriate serial
drivers for each platform.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Tested-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Atish Patra <atishp@rivosinc.com>
Tested-by: Atish Patra <atishp@rivosinc.com>
---
include/sbi_utils/serial/fdt_serial.h | 8 +++
lib/utils/Kconfig | 6 +++
lib/utils/serial/Kconfig | 71 +++++++++++++++++++++++++++
lib/utils/serial/objects.mk | 44 ++++++++---------
platform/andes/ae350/Kconfig | 1 +
platform/fpga/ariane/Kconfig | 1 +
platform/fpga/openpiton/Kconfig | 1 +
platform/generic/configs/defconfig | 8 +++
platform/kendryte/k210/Kconfig | 1 +
platform/nuclei/ux600/Kconfig | 1 +
platform/template/Kconfig | 1 +
11 files changed, 121 insertions(+), 22 deletions(-)
create mode 100644 lib/utils/serial/Kconfig
diff --git a/include/sbi_utils/serial/fdt_serial.h b/include/sbi_utils/serial/fdt_serial.h
index 6451c23..daa2e4f 100644
--- a/include/sbi_utils/serial/fdt_serial.h
+++ b/include/sbi_utils/serial/fdt_serial.h
@@ -12,6 +12,8 @@
#include <sbi/sbi_types.h>
+#ifdef CONFIG_FDT_SERIAL
+
struct fdt_serial {
const struct fdt_match *match_table;
int (*init)(void *fdt, int nodeoff, const struct fdt_match *match);
@@ -19,4 +21,10 @@ struct fdt_serial {
int fdt_serial_init(void);
+#else
+
+static inline int fdt_serial_init(void) { return 0; }
+
+#endif
+
#endif
diff --git a/lib/utils/Kconfig b/lib/utils/Kconfig
index d6e0506..4524a3f 100644
--- a/lib/utils/Kconfig
+++ b/lib/utils/Kconfig
@@ -1 +1,7 @@
# SPDX-License-Identifier: BSD-2-Clause
+
+menu "Utils and Drivers Support"
+
+source "$(OPENSBI_SRC_DIR)/lib/utils/serial/Kconfig"
+
+endmenu
diff --git a/lib/utils/serial/Kconfig b/lib/utils/serial/Kconfig
new file mode 100644
index 0000000..e114f26
--- /dev/null
+++ b/lib/utils/serial/Kconfig
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+menu "Serial Device Support"
+
+config FDT_SERIAL
+ bool "FDT based serial drivers"
+ default n
+
+if FDT_SERIAL
+
+config FDT_SERIAL_GAISLER
+ bool "Gaisler UART FDT driver"
+ select SERIAL_GAISLER
+ default n
+
+config FDT_SERIAL_HTIF
+ bool "Host transfer interface (HTIF) UART FDT driver"
+ default n
+
+config FDT_SERIAL_SHAKTI
+ bool "Shakti UART FDT driver"
+ select SERIAL_SHAKTI
+ default n
+
+config FDT_SERIAL_SIFIVE
+ bool "SiFive UART FDT driver"
+ select SERIAL_SIFIVE
+ default n
+
+config FDT_SERIAL_LITEX
+ bool "LiteX UART FDT driver"
+ select SERIAL_LITEX
+ default n
+
+config FDT_SERIAL_UART8250
+ bool "8250 UART FDT driver"
+ select SERIAL_UART8250
+ default n
+
+config FDT_SERIAL_XILINX_UARTLITE
+ bool "Xilinx UART Lite FDT driver"
+ select SERIAL_XILINX_UARTLITE
+ default n
+
+endif
+
+config SERIAL_GAISLER
+ bool "Gaisler UART support"
+ default n
+
+config SERIAL_SHAKTI
+ bool "Shakti UART support"
+ default n
+
+config SERIAL_SIFIVE
+ bool "SiFive UART support"
+ default n
+
+config SERIAL_LITEX
+ bool "LiteX UART support"
+ default n
+
+config SERIAL_UART8250
+ bool "8250 UART support"
+ default n
+
+config SERIAL_XILINX_UARTLITE
+ bool "Xilinx UART Lite support"
+ default n
+
+endmenu
diff --git a/lib/utils/serial/objects.mk b/lib/utils/serial/objects.mk
index d26a74e..fa9f5a3 100644
--- a/lib/utils/serial/objects.mk
+++ b/lib/utils/serial/objects.mk
@@ -7,33 +7,33 @@
# Anup Patel <anup.patel@wdc.com>
#
-libsbiutils-objs-y += serial/fdt_serial.o
-libsbiutils-objs-y += serial/fdt_serial_drivers.o
+libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o
+libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o
-carray-fdt_serial_drivers-y += fdt_serial_gaisler
-libsbiutils-objs-y += serial/fdt_serial_gaisler.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_GAISLER) += fdt_serial_gaisler
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_GAISLER) += serial/fdt_serial_gaisler.o
-carray-fdt_serial_drivers-y += fdt_serial_htif
-libsbiutils-objs-y += serial/fdt_serial_htif.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_HTIF) += fdt_serial_htif
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_HTIF) += serial/fdt_serial_htif.o
-carray-fdt_serial_drivers-y += fdt_serial_shakti
-libsbiutils-objs-y += serial/fdt_serial_shakti.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_SHAKTI) += fdt_serial_shakti
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_SHAKTI) += serial/fdt_serial_shakti.o
-carray-fdt_serial_drivers-y += fdt_serial_sifive
-libsbiutils-objs-y += serial/fdt_serial_sifive.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_SIFIVE) += fdt_serial_sifive
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_SIFIVE) += serial/fdt_serial_sifive.o
-carray-fdt_serial_drivers-y += fdt_serial_litex
-libsbiutils-objs-y += serial/fdt_serial_litex.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_LITEX) += fdt_serial_litex
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_LITEX) += serial/fdt_serial_litex.o
-carray-fdt_serial_drivers-y += fdt_serial_uart8250
-libsbiutils-objs-y += serial/fdt_serial_uart8250.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_UART8250) += fdt_serial_uart8250
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_UART8250) += serial/fdt_serial_uart8250.o
-carray-fdt_serial_drivers-y += fdt_serial_xlnx_uartlite
-libsbiutils-objs-y += serial/fdt_serial_xlnx_uartlite.o
+carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_XILINX_UARTLITE) += fdt_serial_xlnx_uartlite
+libsbiutils-objs-$(CONFIG_FDT_SERIAL_XILINX_UARTLITE) += serial/fdt_serial_xlnx_uartlite.o
-libsbiutils-objs-y += serial/gaisler-uart.o
-libsbiutils-objs-y += serial/shakti-uart.o
-libsbiutils-objs-y += serial/sifive-uart.o
-libsbiutils-objs-y += serial/litex-uart.o
-libsbiutils-objs-y += serial/uart8250.o
-libsbiutils-objs-y += serial/xlnx-uartlite.o
+libsbiutils-objs-$(CONFIG_SERIAL_GAISLER) += serial/gaisler-uart.o
+libsbiutils-objs-$(CONFIG_SERIAL_SHAKTI) += serial/shakti-uart.o
+libsbiutils-objs-$(CONFIG_SERIAL_SIFIVE) += serial/sifive-uart.o
+libsbiutils-objs-$(CONFIG_SERIAL_LITEX) += serial/litex-uart.o
+libsbiutils-objs-$(CONFIG_SERIAL_UART8250) += serial/uart8250.o
+libsbiutils-objs-$(CONFIG_SERIAL_XILINX_UARTLITE) += serial/xlnx-uartlite.o
diff --git a/platform/andes/ae350/Kconfig b/platform/andes/ae350/Kconfig
index 4b73c76..162d19c 100644
--- a/platform/andes/ae350/Kconfig
+++ b/platform/andes/ae350/Kconfig
@@ -2,4 +2,5 @@
config PLATFORM_ANDES_AE350
bool
+ select SERIAL_UART8250
default y
diff --git a/platform/fpga/ariane/Kconfig b/platform/fpga/ariane/Kconfig
index 70d2004..3ce0ec1 100644
--- a/platform/fpga/ariane/Kconfig
+++ b/platform/fpga/ariane/Kconfig
@@ -2,4 +2,5 @@
config PLATFORM_ARIANE_FPGA
bool
+ select SERIAL_UART8250
default y
diff --git a/platform/fpga/openpiton/Kconfig b/platform/fpga/openpiton/Kconfig
index 81e4b76..4dd752d 100644
--- a/platform/fpga/openpiton/Kconfig
+++ b/platform/fpga/openpiton/Kconfig
@@ -2,4 +2,5 @@
config PLATFORM_OPENPITON_FPGA
bool
+ select SERIAL_UART8250
default y
diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig
index e69de29..ce70c59 100644
--- a/platform/generic/configs/defconfig
+++ b/platform/generic/configs/defconfig
@@ -0,0 +1,8 @@
+CONFIG_FDT_SERIAL=y
+CONFIG_FDT_SERIAL_GAISLER=y
+CONFIG_FDT_SERIAL_HTIF=y
+CONFIG_FDT_SERIAL_SHAKTI=y
+CONFIG_FDT_SERIAL_SIFIVE=y
+CONFIG_FDT_SERIAL_LITEX=y
+CONFIG_FDT_SERIAL_UART8250=y
+CONFIG_FDT_SERIAL_XILINX_UARTLITE=y
diff --git a/platform/kendryte/k210/Kconfig b/platform/kendryte/k210/Kconfig
index 889f16b..adc7613 100644
--- a/platform/kendryte/k210/Kconfig
+++ b/platform/kendryte/k210/Kconfig
@@ -2,4 +2,5 @@
config PLATFORM_KENDRYTE_K210
bool
+ select SERIAL_SIFIVE
default y
diff --git a/platform/nuclei/ux600/Kconfig b/platform/nuclei/ux600/Kconfig
index c368ef4..69fe8f8 100644
--- a/platform/nuclei/ux600/Kconfig
+++ b/platform/nuclei/ux600/Kconfig
@@ -2,4 +2,5 @@
config PLATFORM_NUCLEI_UX600
bool
+ select SERIAL_SIFIVE
default y
diff --git a/platform/template/Kconfig b/platform/template/Kconfig
index 6fbb567..f080729 100644
--- a/platform/template/Kconfig
+++ b/platform/template/Kconfig
@@ -9,4 +9,5 @@
#
config PLATFORM_TEMPLATE
bool
+ select SERIAL_UART8250
default y
--
2.34.1
next prev parent reply other threads:[~2022-08-08 3:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 3:57 [PATCH v8 00/17] OpenSBI Kconfig Support Anup Patel
2022-08-08 3:57 ` [PATCH v8 01/17] scripts: Add Kconfiglib v14.1.0 under scripts directory Anup Patel
2022-08-08 3:57 ` [PATCH v8 02/17] Makefile: Add initial kconfig support for each platform Anup Patel
2022-08-08 3:57 ` [PATCH v8 03/17] Makefile: Compile lib/utils sources separately " Anup Patel
2022-08-08 3:57 ` Anup Patel [this message]
2022-08-08 3:57 ` [PATCH v8 05/17] lib: utils/reset: Use kconfig for enabling/disabling drivers Anup Patel
2022-08-08 3:57 ` [PATCH v8 06/17] lib: utils/sys: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 07/17] lib: utils/timer: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 08/17] lib: utils/ipi: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 09/17] lib: utils/irqchip: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 10/17] lib: utils/i2c: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 11/17] lib: utils/gpio: " Anup Patel
2022-08-08 3:57 ` [PATCH v8 12/17] lib: utils/fdt: Use kconfig for enabling/disabling Anup Patel
2022-08-08 3:57 ` [PATCH v8 13/17] platform: generic: Use kconfig for enabling/disabling overrides Anup Patel
2022-08-08 3:57 ` [PATCH v8 14/17] platform: generic: Use kconfig to set platform version and default name Anup Patel
2022-08-08 3:57 ` [PATCH v8 15/17] platform: Remove redundant config.mk from all platforms Anup Patel
2022-08-08 3:57 ` [PATCH v8 16/17] docs: Update documentation for kconfig support Anup Patel
2022-08-08 3:57 ` [PATCH v8 17/17] Makefile: Fix typo related to object.mk Anup Patel
2022-08-08 4:06 ` [PATCH v8 00/17] OpenSBI Kconfig Support Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220808035740.69335-5-apatel@ventanamicro.com \
--to=apatel@ventanamicro.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox