Add a driver for the VIRTIO I2C adapter device (virtio spec 1.3, section
5.16), letting a Zephyr guest drive an I2C bus exposed by a hypervisor or
a vhost-user backend.
One i2c_msg is one descriptor chain, and the whole batch is queued before
the device is notified, so a multi-message transfer costs one round trip
instead of one per message. FAIL_NEXT groups the messages the device runs
back to back; a message that ends in a stop closes its group, so a failure
takes the rest of that group with it.
Every operation is a round trip to the device, so the I2C API can only be
used from a thread. VIRTIO_I2C_F_ZERO_LENGTH_REQUEST is mandatory, so a
device that does not offer it is refused. 10-bit addressing is not
supported, and the bus speed is accepted and ignored.
Assisted-by: Claude Code:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Since recover-bus-on-init DT property if of boolean type, use of
dt_compat_any_has_prop() without an explicit value argument of True
makes that function to always return true and
CONFIG_I2C_MCUX_LPI2C_BUS_RECOVERY and
CONFIG_I2C_MCUX_FLEXCOMM_BUS_RECOVERY configuration options always enabled
(when their dependencies are met).
Set function argument value to True to get the expected behavior.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
- Kconfigs in modules/ should not define configs with an SOC_ prefix.
Furthermore, these options are SDK specific, not SoC specific.
- The simplicity_sdk configs do the same.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Fix devicetree coding style regarding whitespaces through the tree.
This affects code snippets inside documentation, comments, error messages
as to encourage a style that passes CI. Follow-up of #101619
Signed-off-by: Josuah Demangeon <me@josuah.net>
Add a generic I2C_TRANSFER_TIMEOUT_MS option, not tied to any specific
driver, as well as a I2C_TRANSFER_TIMEOUT helper to handle conversions
and infinite timeout and a helper for driver that only supports finite
timeouts.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Introduce a new Kconfig option `I2C_BUS_RECOVERY` to provide
a common switch for enabling I2C bus recovery support.
This ensures consistent behavior across drivers and simplifies
configuration for platforms requiring i2c bus recovery.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Add I2C driver support for Realtek Bee series SoCs,
including RTL87x2G and RTL8752H.
This driver supports:
- Master mode operation
- 7-bit and 10-bit addressing
- Standard and Fast mode speeds
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
We modified the Microchip XEC/MEC version 2 I2C byte mode driver
to work on v3.8 I2C hardware in MEC174x/5x/165x SoCs. The changes
are as follows:
1. Add a local header file containing register and bit field definitions
2. Use Zephyr inline register access functions (sys_read/write)
instead of CMSIS register structures.
3. Change DT bindings to require GPIO references for the SCL and SDA
pins. MEC172x will use GPIO driver to get line states. MEC174x/5x
have v3.8 I2C hardware with read-only live values of SCL/SDA pin
states in the bit-bang control register. The MEC172x SoC code to
read I2C GPIO's is no longer needed and is removed in a later
commit in this series.
4. Use WAIT_FOR macro in place of custom spin loops.
5. SonarQube code check recommendations except WAIT_FOR macro which is
based on a GNU compiler extension.
Signed-off-by: Scott Worley <scott.worley@microchip.com>
The option CONFIG_I2C_DUMP_MESSAGES_ALLOWLIST should automatically be
turned on if the depedencies are satisfied.
Signed-off-by: Keith Short <keithshort@google.com>
Add a Kconfig option to tweak the i2c shell command buffer size,
similarly to other shell commands.
This is allocated on the stack so add a note about it.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
- Add I2C driver for Microchip SERCOM g1.
- Add and update Kconfig files to support the driver.
- Update CMakeLists.txt to include the new driver.
Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
Add initial support for i2c on Renesas RX MCU
This driver is controlling the RIIC HW of RX MCU for i2c bus
interface on Zephyr
Only master mode is supported
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
base on DesignWare I2C driver to implement RTS5912 I2C driver.
1. support customize bus recovery function.
2. fix isr timing issue by enable tx empty control.
3. support stuck at low handle by enable bus clear feature.
4. support custom stuck at low timeout set from dts
5. disable block mode in rts5912 i2c.
6. support I2C_ALLOW_NO_STOP_TRANSACTIONS
Signed-off-by: Titan Chen <titan.chen@realtek.com>
Implement the functions of I2C host and target.
I2CM: supports nine hosts and each one able located at I2C interface
0~12.
supports two 32 bytes dedicated FIFO mode for read and write.
I2CS: supports three targets and each one able located at I2C
interface 0~8.
supports 16 bytes dedicated FIFO mode that only supports write or
read mode and the maximum buffer size is 256 bytes.
support non-FIFO write to shared FIFO read mode. The maximum
shared FIFO size for read is 256 bytes.
The APIs test include: i2c_write(), i2c_read(), i2c_burst_read(),
i2c_burst_write(), i2c_write_read()
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
The OMAP I2C provides support for I2C serial interface on TI K3 series.
It is compatible with Philips I2C physical layer.
The commit includes:
Zephyr i2c api implementation
Polling Mode
Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
The previous re-organization has the zephyr-keep-sorted defines
missing. Add them for the I2C drivers and targets. Also
moved lines to fix out-of-order violations.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.
Fixes#78619
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Transactions from RTIO should result in single calls to i2c_transfer.
This corrects the default handler to first count the number of
submissions in the transaction, allocate on the stack, and then copy
over each submission to an equivalent i2c_msg.
It also cleans up the helper functions to be infallible, taking only the
submission and msg to copy to.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.
Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
The I2C transfer API has been recently changed to always automatically
set a STOP on the last message, which was well documented but
implemented only by few drivers.
Unfortunately, while documented, this is a change in the current
behavior and it turns out that some applications depended on it for some
complex operations.
Add a flag to temporarily restore the old behavior, buying time to fix
the application code depending on this.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Use the RTIO work queue to fake the i2c submit calls for drivers which
haven't yet implemented the API. Applications can change the size of
the work queue pool depending on how much traffic they have on the buses.
Signed-off-by: Yuval Peress <peress@google.com>
This config should be selected by any driver that supports the RTIO
interface and can then be checked on by things like tests or drivers
that subsequently require the feature exist.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Implementing RTIO drivers, in theory, should be as simple as the normal
i2c drivers and generally be more consistent across implementations. To
do that some common code that calls driver specific code is needed much
like the venerable spi_context and its helpers.
This adds struct i2c_rtio as well as helpers to perform blocking i2c
transfers, i2c bus recovery, and similar such tasks.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Rather than a depends on, which leaves it up to every single usage
of I2C_RTIO to then go and select RTIO, by selecting I2C_RTIO Kconfig
inherently selects RTIO now.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
RAM allows for very fast reads and writes and lets us explore most of
the I2C controller APIs including RTIO. Theoretically supports any form
of i2c connected RAM but requires some tweaking to work with specific
parts potentially. Tested with Fujitsu's MB85 FeRAM part using an
arduino breakout.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
With the device_sync_sem semaphore, there is the possibility of
the code not returning to give it back
(mcux_flexcomm_master_transfer_callback is never called),
causing it to get stuck in k_sem_take(&data->device_sync_sem, K_FOREVER)
in subsequent calls.
The i2c driver recovers by other means
(enabling FSL_FEATURE_I2C_TIMEOUT_RECOVERY)
but the callback might not return.
Adding a timeout option allows for this occurrence to be avoided.
Signed-off-by: Guilherme Casa Nova <guilherme.casa_nova@dell.com>