From: Igor Opaniuk <igor.opaniuk@foundries.io>
To: u-boot@lists.denx.de
Subject: [PATCH v3 1/3] dm: i2c: allow disabling driver model in SPL
Date: Tue, 9 Feb 2021 13:52:43 +0200 [thread overview]
Message-ID: <20210209115245.47288-2-igor.opaniuk@gmail.com> (raw)
In-Reply-To: <20210209115245.47288-1-igor.opaniuk@gmail.com>
From: Igor Opaniuk <igor.opaniuk@foundries.io>
At present if U-Boot proper uses driver model for I2C, then SPL has to
also. While this is desirable, it places a significant barrier to moving
to driver model in some cases. For example, with a space-constrained SPL
it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves
adjusting some drivers.
This patch introduces a separate Kconfig symbols for enabling DM_I2C and
DM_I2C_GPIO support in SPL.
This will also help to get away from dirty workarounds to
achieve non-DM I2C support for SPL, which is currently used in some
board header files like:
ifdef CONFIG_SPL_BUILD
undef CONFIG_DM_I2C
endif
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
---
(no changes since v2)
Changes in v2:
- R-b tags applied (Simon and Heiko)
drivers/i2c/Kconfig | 21 +++++++++++++++++++++
drivers/i2c/Makefile | 4 ++--
drivers/misc/Makefile | 2 +-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 403602fddf..5fce14122d 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -14,6 +14,17 @@ config DM_I2C
device (bus child) info is kept as parent plat. The interface
is defined in include/i2c.h.
+config SPL_DM_I2C
+ bool "Enable Driver Model for I2C drivers in SPL"
+ depends on SPL_DM && DM_I2C
+ default y
+ help
+ Enable driver model for I2C. The I2C uclass interface: probe, read,
+ write and speed, is implemented with the bus drivers operations,
+ which provide methods for bus setting and data transfer. Each chip
+ device (bus child) info is kept as parent platdata. The interface
+ is defined in include/i2c.h.
+
config I2C_CROS_EC_TUNNEL
tristate "Chrome OS EC tunnel I2C bus"
depends on CROS_EC
@@ -61,6 +72,16 @@ config DM_I2C_GPIO
bindings are supported.
Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt
+config SPL_DM_I2C_GPIO
+ bool "Enable Driver Model for software emulated I2C bus driver in SPL"
+ depends on SPL_DM && DM_I2C_GPIO && SPL_DM_GPIO && SPL_GPIO_SUPPORT
+ default y
+ help
+ Enable the i2c bus driver emulation by using the GPIOs. The bus GPIO
+ configuration is given by the device tree. Kernel-style device tree
+ bindings are supported.
+ Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt
+
config SYS_I2C_AT91
bool "Atmel I2C driver"
depends on DM_I2C && ARCH_AT91
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 29aab0f9e3..acd27ac29d 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -2,9 +2,9 @@
#
# (C) Copyright 2000-2007
# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-obj-$(CONFIG_DM_I2C) += i2c-uclass.o
+obj-$(CONFIG_$(SPL_)DM_I2C) += i2c-uclass.o
ifdef CONFIG_ACPIGEN
-obj-$(CONFIG_DM_I2C) += acpi_i2c.o
+obj-$(CONFIG_$(SPL_)DM_I2C) += acpi_i2c.o
endif
obj-$(CONFIG_$(SPL_)DM_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index d737203704..1a49396007 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_SANDBOX) += p2sb_sandbox.o p2sb_emul.o
obj-$(CONFIG_SANDBOX) += swap_case.o
endif
-ifdef CONFIG_DM_I2C
+ifdef CONFIG_$(SPL_)DM_I2C
ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_SANDBOX) += i2c_eeprom_emul.o
endif
--
2.25.1
next prev parent reply other threads:[~2021-02-09 11:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 11:52 [PATCH v3 0/3] Allow disabling driver model for I2C in SPL Igor Opaniuk
2021-02-09 11:52 ` Igor Opaniuk [this message]
2021-02-10 17:50 ` [PATCH v3 1/3] dm: i2c: allow disabling driver model " Tom Rini
2021-02-21 7:02 ` Heiko Schocher
2021-02-09 11:52 ` [PATCH v3 2/3] board: freescale: drop CONFIG_DM_I2C undefs Igor Opaniuk
2021-02-10 17:50 ` Tom Rini
2021-02-21 7:02 ` Heiko Schocher
2021-02-09 11:52 ` [PATCH v3 3/3] dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO Igor Opaniuk
2021-02-10 17:51 ` Tom Rini
2021-02-11 10:38 ` Priyanka Jain
2021-02-21 7:02 ` Heiko Schocher
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=20210209115245.47288-2-igor.opaniuk@gmail.com \
--to=igor.opaniuk@foundries.io \
--cc=u-boot@lists.denx.de \
/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