From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v8 10/17] lib: utils/i2c: Use kconfig for enabling/disabling drivers
Date: Mon, 8 Aug 2022 09:27:33 +0530 [thread overview]
Message-ID: <20220808035740.69335-11-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220808035740.69335-1-apatel@ventanamicro.com>
We update i2c drivers makefile to use kconfig for enabling/disabling
drivers. To avoid compile errors, we also enable appropriate i2c
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>
---
lib/utils/Kconfig | 2 ++
lib/utils/i2c/Kconfig | 22 ++++++++++++++++++++++
lib/utils/i2c/objects.mk | 10 +++++-----
platform/generic/configs/defconfig | 2 ++
4 files changed, 31 insertions(+), 5 deletions(-)
create mode 100644 lib/utils/i2c/Kconfig
diff --git a/lib/utils/Kconfig b/lib/utils/Kconfig
index 3f315fd..39452d5 100644
--- a/lib/utils/Kconfig
+++ b/lib/utils/Kconfig
@@ -2,6 +2,8 @@
menu "Utils and Drivers Support"
+source "$(OPENSBI_SRC_DIR)/lib/utils/i2c/Kconfig"
+
source "$(OPENSBI_SRC_DIR)/lib/utils/ipi/Kconfig"
source "$(OPENSBI_SRC_DIR)/lib/utils/irqchip/Kconfig"
diff --git a/lib/utils/i2c/Kconfig b/lib/utils/i2c/Kconfig
new file mode 100644
index 0000000..16c4453
--- /dev/null
+++ b/lib/utils/i2c/Kconfig
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+menu "I2C Support"
+
+config FDT_I2C
+ bool "FDT based I2C drivers"
+ select I2C
+ default n
+
+if FDT_I2C
+
+config FDT_I2C_SIFIVE
+ bool "SiFive I2C FDT driver"
+ default n
+
+endif
+
+config I2C
+ bool "I2C support"
+ default n
+
+endmenu
diff --git a/lib/utils/i2c/objects.mk b/lib/utils/i2c/objects.mk
index bb0d6d5..a0fbbb5 100644
--- a/lib/utils/i2c/objects.mk
+++ b/lib/utils/i2c/objects.mk
@@ -7,10 +7,10 @@
# Nikita Shubin <n.shubin@yadro.com>
#
-libsbiutils-objs-y += i2c/i2c.o
+libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o
-libsbiutils-objs-y += i2c/fdt_i2c.o
-libsbiutils-objs-y += i2c/fdt_i2c_adapter_drivers.o
+libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o
+libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o
-carray-fdt_i2c_adapter_drivers-y += fdt_i2c_adapter_sifive
-libsbiutils-objs-y += i2c/fdt_i2c_sifive.o
+carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive
+libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.o
diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig
index ad66a63..c9c221e 100644
--- a/platform/generic/configs/defconfig
+++ b/platform/generic/configs/defconfig
@@ -1,3 +1,5 @@
+CONFIG_FDT_I2C=y
+CONFIG_FDT_I2C_SIFIVE=y
CONFIG_FDT_IPI=y
CONFIG_FDT_IPI_MSWI=y
CONFIG_FDT_IRQCHIP=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 ` [PATCH v8 04/17] lib: utils/serial: Use kconfig for enabling/disabling drivers Anup Patel
2022-08-08 3:57 ` [PATCH v8 05/17] lib: utils/reset: " 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 ` Anup Patel [this message]
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-11-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