Commit Graph

1249 Commits

Author SHA1 Message Date
Hao Luo
8b60fa834c drivers: mfd: Add ambiq iom binding file
This commit adds ambiq iom binding file to consolidate
spi and i2c that share the same IO Master module on
Apollo MCUs

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-02 19:02:56 +02:00
Etienne Carriere
0103de7b51 drivers: i2c: stm32: support DMA when CONFIG_MEM_ATTR=n
Allow STM32 I2C driver v2 to operate with DMA support even when
CONFIG_MEM_ATTR is disabled which happen when CONFIG_ARM_MPU is
intentionally disabled despite the CPU supports MPU.

By the way, remove a #ifdef directive on header files inclusion
that adds noise in the header file inclusion section without any
benefit.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-04-02 12:54:50 +02:00
Etienne Carriere
d0d8fa444f drivers: i2c: stm32: don't manage cache aside DMA support
Fix STM32 I2C driver to not call cache management related functions
when DMA is not used. This change fixes an issue introduced by
commit 42c3a78148 ("i2c: stm32: Add cache memory support"). The issue
makes boards embedding this driver with both CONFIG_I2C_STM32_V2_DMA
and CONFIG_ARCH_MPU disabled to fail to build with an error trace message
like the below:
   .../i2c_ll_stm32_v2.c:701: undefined reference to `mem_attr_check_buf'

Fixes: 42c3a78148
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-03-27 21:33:53 +01:00
Andrzej Kuros
d15c9fe9a6 drivers: i2c_nrfx_twim: add exclusive access API
This commit provides an extension to the i2c_nrfx_twim driver.
It introduces possibility to acquire/release exclusive access to the
i2c bus. While the exclusive access to the i2c bus is acquired
you can access the underlying nrfx_twim driver directly.

Signed-off-by: Andrzej Kuros <andrzej.kuros@nordicsemi.no>
2025-03-27 17:17:32 +01:00
Fin Maaß
2260111cc6 drivers: i2c: litex: add mutex in litei2c
add mutex for the litei2c driver

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-27 14:01:11 +01:00
Fin Maaß
f7a0a54c31 drivers: i2c: litex: add driver for litei2c
add driver for litei2c.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-03-27 14:01:11 +01:00
Alvis Sun
79b526f65a drivers: i2c: npcx: add support for multi-address in target mode
This commit introduces support for the NPCX I2C driver to handle up to
8 addresses in target mode

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
2025-03-25 08:43:52 +01:00
Hao Luo
a460479ff7 drivers: ambiq: Correct peripheral instance calculation
This commit corrected ambiq peripheral instance calculations

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-03-25 05:59:42 +01:00
Pisit Sawangvonganan
a89060be0d drivers: i2c: shell: use shell_fprintf_normal instead of shell_fprintf
Due to the introduction of `shell_fprintf_normal` in PR #77192, we can
minimize caller overhead by eliminating direct `color` parameter passing.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-03-25 00:31:48 +01:00
Pisit Sawangvonganan
1991e57814 drivers: i2c: shell: align struct shell * argument name to sh
Aligned the `struct shell *` argument name from `shell_ctx` to `sh`
for consistency with other drivers' usage of `sh`, and to match
the `shell_cmd_handler` argument name.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-03-25 00:31:48 +01:00
Khoa Tran
d0c0f1d036 drivers: i2c: initial support for i2c sci-b driver on Renesas RA family
First commit to add support for Renesas RA i2c sci-b driver

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2025-03-24 19:22:18 +01:00
Hao Luo
4744d138c2 drivers: ambiq: Change the way to power on ambiq drivers
This commit changes to use ambiq hal power control APIs
to replace the previous register settings to power on
ambiq drivers.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-03-24 09:54:17 +01:00
Simon Gilbert
42c3a78148 i2c: stm32: Add cache memory support
Add basic cache memory support

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Simon Gilbert
26a8b36513 i2c: stm32: Added DMA stop for various i2c comms conditions
Added stop DMA fot transmit complete or other master end conditions

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Simon Gilbert
446a5ec49d i2c: stm32: Minor refactor of i2c_stm32_transfer function
Tidy up of i2c_stm32_transfer and added TX and RX semaphore inits

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Simon Gilbert
8dbc30a0d5 i2c: stm32: Add macros to get settings from device tree
Add macrobatics to pull DMA settings from device tree

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Simon Gilbert
ce0358692a i2c: stm32: Add dma settings structs to config and data structs
Add initial DMA settings structs to stm32 i2c config and data structs

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Simon Gilbert
5fb27671fa i2c: stm32: Add config option to enable DMA support
Add option to enable DMA support

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
2025-03-20 12:17:50 +01:00
Hao Luo
3b0d11dc65 drivers: i2c: Add cache support for ambiq i2c driver
This commit adds cache support for ambiq i2c driver

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-03-20 09:33:02 +01:00
TOKITA Hiroshi
0206dc2aaf drivers: i2c: dw: Enable PINCTRL conjuction with dt prop 'pinctrl-0'
If there is a pinctrl-0 property, PINCTRL will be enabled in
conjunction with it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-20 07:21:03 +01:00
Corey Wharton
1dd9308e2f drivers: i2c_dw: issue transfer abort on timeout
On timeout, it's possible for the controller to be in a bad state.
This change initiates the transfer abort sequence which can recover
from these cases and make the bus usable again.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-03-19 20:31:25 +01:00
Ajay Neeli
d012b14f17 drivers: i2c: xilinx_axi: Remove nested spinlock
Removed nested spinlock acquisition in i2c_xilinx_axi_write to prevent
ztest failures due to invalid spinlock usage.
Ensured spinlocks are not consecutively acquired without unlocking,
preventing potential deadlocks.

Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
2025-03-17 02:20:20 +01:00
Sven Ginka
046fbdecfa drivers: i2c: sy1xx add support for i2c
Add i2c support for the sensry soc sy1xx.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-03-14 14:39:55 +01:00
Jun Lin
a4ea1a1ac8 drivers: i2c: npcx: enhance the transfer efficiency
The i2c_transfer() API allows multiple msgs objects to be carried in a
transaction. After handling the current msgs object in the interrupt
context, the driver notifies the calling thread to buffer the next
msgs object and generate the Re-Start if required.
However, if the calling thread is preempted by higher priority threads,
the I2C transaction time may become non-deterministic (depending on the
execution time of higher-priority threads). This commits modifies the
driver to handle msgs objects entirely in the interrupt context to
improve the I2C transfer efficiency..

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-03-14 09:17:13 +01:00
Ajay Neeli
d2519c1192 drivers: i2c: Add Cadence I2C support
This patch adds support for Cadence I2C Controller
 - Enables I2C Master Mode functionality

Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
2025-03-12 19:02:04 +01:00
Erwan Gouriou
a28a338024 i2c: stm32: Fix return type declaration of 2 private functions
Return type should be int, no need for int32_t.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-03-12 09:53:32 +01:00
Hoang Nguyen
1d7faca97e drivers: i2c: Initial support for RZ/G3S
Add I2C driver support for Renesas RZ/G3S

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Binh Nguyen <binh.nguyen.xw@renesas.com>
2025-03-07 19:45:11 +01:00
Florian Weber
4e9bd00dfb drivers: i2c: rtio
extend i2c library to create rtio sqes for reading and writing bytes

Signed-off-by: Florian Weber <Florian.Weber@live.de>
2025-03-07 19:43:22 +01:00
Khoa Nguyen
c768144002 drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of
"ELC_EVENT" (which is currently used) to input into
the IELSR register, the ek_ra2l1 board cannot assign
any interrupts for any driver.

This commit aim to correct the Event macro to input correct
value for IELSR register on all the Renesas SoC by using
"BSP_PRV_IELS_ENUM" macro.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-28 18:29:17 +01:00
Tahsin Mutlugun
391b9282e9 drivers: i2c: i2c_max32: Respect message flags in DMA mode
Send STOP or RESTART after a message only if they are enabled in message
flags. For reads, however, controller sends a NACK after last byte so a
restart is required even if I2C_MSG_RESTART flag is not set.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-02-21 18:02:41 +00:00
Anas Nashif
470682d1a3 drivers: i2c: I2C_SAM0_TRANSFER_TIMEOUT depends on I2C_SAM0
I2C_SAM0_TRANSFER_TIMEOUT should depend on I2C_SAM0.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-02-19 14:51:04 +00:00
Bjarki Arge Andreasen
125752e7cc drivers: i2c: nrfx_twim_rtio: use msg_buf for rx if required
The DMA buffer needs to be used both for tx and rx if required.
Extend RTIO driver variant to use DMA buffer and copy received
data from it to user buffer.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-02-17 14:07:55 +01:00
Bjarki Arge Andreasen
62815dd9e7 drivers: i2c: nrfx_twim_rtio: fix dma buf section attr
The buffer used for the TWIM DMA needs to be allocated to the
section provided with the memory-regions dt prop. The macros for
doing this where malformed. This commit fixes and cleans up the
macros.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-02-17 14:07:55 +01:00
Daniel Schultz
68dc1b5ebf drivers: i2c: i2c_omap: Add pinctrl
Extend the I2c OMAP driver to automatically mux pins require by this
interfaces.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2025-02-14 13:36:26 +01:00
Bjarki Arge Andreasen
bb2833de54 drivers: i2c: i2c_nrfx_twis: patch dma buf mem section
The macros placing the DMA memory buffer in the appropriate
section in RAM was malformed. This PR fixes it.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-02-10 14:32:52 +01:00
Fabio Baltieri
3a66b3853e drivers,test: use the new DT_FOREACH_PROP_ELEM_SEP
Use the new DT_FOREACH_PROP_ELEM_SEP macro instead of
DEVICE_DT_GET(DT_PHANDLE_BY_IDX(...)).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-04 09:18:55 +01:00
Jiafei Pan
b97c1d7999 drivers: i2c: add NXP i2c driver used on imx8m platforms
This native i2c driver works together with ii2c drive in hal_nxp.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-01-24 19:15:57 +01:00
Fabio Baltieri
35abb31284 i2c_shell: add missing i3c include
This is necessary for the I3C device type check, tested with:

west build -p -b nucleo_h563zi samples/subsys/shell/shell_module
-DCONFIG_I2C=y -DCONFIG_I2C_SHELL=y -DCONFIG_I3C=y

and

west build -p -b nucleo_h563zi samples/subsys/shell/shell_module
-DCONFIG_I2C=y -DCONFIG_I2C_SHELL=y -DCONFIG_I3C=n

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-24 15:43:33 +01:00
Fabio Baltieri
9d34d5c104 i2c_shell: only include i3c if I3C=y
Only lookup for i3c devices if I3C=y, fixes a build error:

zephyr/drivers/i2c/i2c_shell.c:
In function 'device_is_i2c':
zephyr/drivers/i2c/i2c_shell.c:341:43:
error: array type has incomplete element type 'struct i3c_driver_api'
341 |         return DEVICE_API_IS(i2c, dev) || DEVICE_API_IS(i3c, dev);

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-23 08:26:21 +01:00
Fabio Baltieri
0b2648ff40 i2c_shell: add device filtering
Add shell device name filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-22 05:40:11 +01:00
Declan Snyder
4f9eda6981 i2c_mcux_lpspi: LPflexcomm determine by inst
Determine if lpflexcomm wrapped lpi2c by instance and connect
irq differently dependending on that to support platforms with
both flexcomm wrapped and unwrapped lpi2c's.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Mulin Chao
47f472aa5c drivers: i2c: npcx: add support to wake up from sleep mode
Add support to wake up from sleep mode by START condition when i2c
is configured to target mode.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2025-01-20 07:05:48 +01:00
Nazar Palamar
415cc17c54 drivers: ifx_cat1: Updates to support latest version of HAL/PDL
- Refactoring to support latest versions of HAL/PDL

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2025-01-14 20:49:14 +01:00
Gerson Fernando Budke
ea7922195b clocks: atmel: sam0: Fix gclk and mclk clock bindings
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and
MCLK. The old devices had defined the peripheral clock enable bit at PM.
On the newer devices this was extracted on a dedicated memory section
called Master Clock (MCLK). This change excludes the dedicated bindings
in favor of a generic approach that cover all cases.

Now the clocks properties is complemented by the atmel,assigned-clocks
property. It gives the liberty to user to customize the clock source
from a generic clock or configure the direct connections.

All peripherals drivers were reworked with the newer solution.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-01-14 20:49:03 +01:00
Lorenz Clijnen
31855964f1 drivers: i2c: cc13xx_cc26xx: Add support for I2C_MSG_RESTART
Add support for the I2C_MSG_RESTART flag to be able to use a
repeated start in between chained transactions.
The driver now uses the stop/restart flags set in the i2c_msg,
instead of starting and stopping for each transaction in the chain.

Signed-off-by: Lorenz Clijnen <github@lorc.be>
2025-01-14 17:57:40 +01:00
Bjarki Arge Andreasen
2e0092356f drivers: i2c: nrfx_twim_rtio: cast buf to non-const
RTIO correctly declares tx buffers as const, however, the
existing I2C API and NRFX (SDK) drivers don't. Therefor cast the
const buf to non-const when passing the tx buf to the twim driver
from the RTIO call to avoid the const warning.

The tx buffer is being treated as const data naturally in the
NRFX driver, its just not declared as such since we reuse the
buffer for both RX and TX data.

Alternatively the SDK and "shim" drivers built on top of it need
to be updated, which is quite a bit of work :)

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-01-13 20:23:36 +01:00
Dhruv Menon
83024740b0 drivers: i2c: Added Bus recovery support to OMAP I2C.
The bus recovery feature utilizing bit-bang operations, which sends
SCL clock pulses to recover the bus and checks if the line is down.
Upon recovery, it disables the system test register before resuming
the transactions.

Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
2025-01-09 23:26:23 +01:00
Dhruv Menon
1d8ea45a8d drivers: i2c: Base OMAP I2C support for TI-K3 processor
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>
2025-01-09 23:26:23 +01:00
Dong Wang
6ab5c00336 drivers: sedi: Update device definition macros to use DT_INST variants
Updated various device definition macros to use the DT_INST variants for
consistency and improved readability.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2025-01-08 19:10:52 +01:00
Johan Carlsson
86de2d69ad drivers: i2c_mcux_flexcomm: add support for bus recovery.
use the bit bang driver to recover the i2c bus using gpio.

Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
2025-01-08 09:33:16 +01:00