From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 04/14] lib: utils/reset: Use kconfig for enabling/disabling drivers
Date: Mon, 18 Jul 2022 20:26:01 +0530 [thread overview]
Message-ID: <20220718145611.2211638-5-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220718145611.2211638-1-apatel@ventanamicro.com>
We update reset drivers makefile to use kconfig for enabling/disabling
drivers. To avoid compile errors, we also enable appropriate reset
drivers for each platform.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
include/sbi_utils/reset/fdt_reset.h | 12 +++++++++++
lib/utils/Kconfig | 2 ++
lib/utils/reset/Kconfig | 33 +++++++++++++++++++++++++++++
lib/utils/reset/objects.mk | 28 ++++++++++++------------
platform/generic/configs/defconfig | 6 ++++++
5 files changed, 67 insertions(+), 14 deletions(-)
create mode 100644 lib/utils/reset/Kconfig
diff --git a/include/sbi_utils/reset/fdt_reset.h b/include/sbi_utils/reset/fdt_reset.h
index e7f7350..ea8063b 100644
--- a/include/sbi_utils/reset/fdt_reset.h
+++ b/include/sbi_utils/reset/fdt_reset.h
@@ -17,6 +17,8 @@ struct fdt_reset {
int (*init)(void *fdt, int nodeoff, const struct fdt_match *match);
};
+#ifdef CONFIG_FDT_RESET
+
/**
* fdt_reset_driver_init() - initialize reset driver based on the device-tree
*/
@@ -29,4 +31,14 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv);
*/
void fdt_reset_init(void);
+#else
+
+static inline int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
+{
+ return 0;
+}
+static inline void fdt_reset_init(void) { }
+
+#endif
+
#endif
diff --git a/lib/utils/Kconfig b/lib/utils/Kconfig
index 0341fa7..3a6389b 100644
--- a/lib/utils/Kconfig
+++ b/lib/utils/Kconfig
@@ -2,6 +2,8 @@
menu "Utils and Drivers Support"
+source "$OPENSBI_SRC_DIR/lib/utils/reset/Kconfig"
+
source "$OPENSBI_SRC_DIR/lib/utils/serial/Kconfig"
endmenu
diff --git a/lib/utils/reset/Kconfig b/lib/utils/reset/Kconfig
new file mode 100644
index 0000000..845a1ae
--- /dev/null
+++ b/lib/utils/reset/Kconfig
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+menu "System Reset Support"
+
+config FDT_RESET
+ bool "FDT based reset drivers"
+ default n
+
+if FDT_RESET
+
+config FDT_RESET_GPIO
+ bool "GPIO FDT reset driver"
+ default n
+
+config FDT_RESET_HTIF
+ bool "Host transfer interface (HTIF) FDT reset driver"
+ default n
+
+config FDT_RESET_SIFIVE_TEST
+ bool "SiFive Test FDT reset driver"
+ default n
+
+config FDT_RESET_SUNXI_WDT
+ bool "Sunxi WDT FDT reset driver"
+ default n
+
+config FDT_RESET_THEAD
+ bool "T-HEAD FDT reset driver"
+ default n
+
+endif
+
+endmenu
diff --git a/lib/utils/reset/objects.mk b/lib/utils/reset/objects.mk
index 8cddcdf..8a50dd0 100644
--- a/lib/utils/reset/objects.mk
+++ b/lib/utils/reset/objects.mk
@@ -7,22 +7,22 @@
# Anup Patel <anup.patel@wdc.com>
#
-libsbiutils-objs-y += reset/fdt_reset.o
-libsbiutils-objs-y += reset/fdt_reset_drivers.o
+libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o
+libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o
-carray-fdt_reset_drivers-y += fdt_poweroff_gpio
-carray-fdt_reset_drivers-y += fdt_reset_gpio
-libsbiutils-objs-y += reset/fdt_reset_gpio.o
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_poweroff_gpio
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_reset_gpio
+libsbiutils-objs-$(CONFIG_FDT_RESET_GPIO) += reset/fdt_reset_gpio.o
-carray-fdt_reset_drivers-y += fdt_reset_htif
-libsbiutils-objs-y += reset/fdt_reset_htif.o
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_HTIF) += fdt_reset_htif
+libsbiutils-objs-$(CONFIG_FDT_RESET_HTIF) += reset/fdt_reset_htif.o
-carray-fdt_reset_drivers-y += fdt_reset_sifive_test
-libsbiutils-objs-y += reset/fdt_reset_sifive_test.o
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SIFIVE_TEST) += fdt_reset_sifive_test
+libsbiutils-objs-$(CONFIG_FDT_RESET_SIFIVE_TEST) += reset/fdt_reset_sifive_test.o
-carray-fdt_reset_drivers-y += fdt_reset_sunxi_wdt
-libsbiutils-objs-y += reset/fdt_reset_sunxi_wdt.o
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SUNXI_WDT) += fdt_reset_sunxi_wdt
+libsbiutils-objs-$(CONFIG_FDT_RESET_SUNXI_WDT) += reset/fdt_reset_sunxi_wdt.o
-carray-fdt_reset_drivers-y += fdt_reset_thead
-libsbiutils-objs-y += reset/fdt_reset_thead.o
-libsbiutils-objs-y += reset/fdt_reset_thead_asm.o
+carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_THEAD) += fdt_reset_thead
+libsbiutils-objs-$(CONFIG_FDT_RESET_THEAD) += reset/fdt_reset_thead.o
+libsbiutils-objs-$(CONFIG_FDT_RESET_THEAD) += reset/fdt_reset_thead_asm.o
diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig
index ce70c59..9778665 100644
--- a/platform/generic/configs/defconfig
+++ b/platform/generic/configs/defconfig
@@ -1,3 +1,9 @@
+CONFIG_FDT_RESET=y
+CONFIG_FDT_RESET_GPIO=y
+CONFIG_FDT_RESET_HTIF=y
+CONFIG_FDT_RESET_SIFIVE_TEST=y
+CONFIG_FDT_RESET_SUNXI_WDT=y
+CONFIG_FDT_RESET_THEAD=y
CONFIG_FDT_SERIAL=y
CONFIG_FDT_SERIAL_GAISLER=y
CONFIG_FDT_SERIAL_HTIF=y
--
2.34.1
next prev parent reply other threads:[~2022-07-18 14:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 14:55 [PATCH v2 00/14] OpenSBI Kconfig Support Anup Patel
2022-07-18 14:55 ` [PATCH v2 01/14] Makefile: Add initial kconfig support for each platform Anup Patel
2022-07-18 14:55 ` [PATCH v2 02/14] Makefile: Compile lib/utils sources separately " Anup Patel
2022-07-18 14:56 ` [PATCH v2 03/14] lib: utils/serial: Use kconfig for enabling/disabling drivers Anup Patel
2022-07-18 14:56 ` Anup Patel [this message]
2022-07-18 14:56 ` [PATCH v2 05/14] lib: utils/sys: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 06/14] lib: utils/timer: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 07/14] lib: utils/ipi: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 08/14] lib: utils/irqchip: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 09/14] lib: utils/i2c: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 10/14] lib: utils/gpio: " Anup Patel
2022-07-18 14:56 ` [PATCH v2 11/14] lib: utils/fdt: Use kconfig for enabling/disabling Anup Patel
2022-07-18 14:56 ` [PATCH v2 12/14] platform: generic: Use kconfig for enabling/disabling overrides Anup Patel
2022-07-18 14:56 ` [PATCH v2 13/14] platform: Remove redundant config.mk from all platforms Anup Patel
2022-07-18 14:56 ` [PATCH v2 14/14] docs: Update documentation for kconfig support Anup Patel
2022-07-18 18:48 ` [PATCH v2 00/14] OpenSBI Kconfig Support Andrew Jones
2022-07-18 21:34 ` David Abdurachmanov
2022-07-19 4:04 ` Anup Patel
2022-07-19 4:17 ` Anup Patel
2022-07-19 6:21 ` Heinrich Schuchardt
2022-07-19 7:41 ` Andreas Schwab
2022-07-19 9:05 ` Anup Patel
2022-07-19 9:27 ` Heinrich Schuchardt
2022-07-19 12:59 ` Anup Patel
2022-07-19 3:55 ` Anup Patel
2022-07-19 9:00 ` Andrew Jones
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=20220718145611.2211638-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 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.