Commit graph

23 commits

Author SHA1 Message Date
Hao Luo
f1348d3954 drivers: i2c: ambiq: buffer overflow issue fixed
Bugfix for possible out-of-bounds operation when buffer address
is not 4 bytes aligned

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-06-19 22:31:06 -07:00
Hao Luo
37134f5a4e drivers: i2c: ambiq: optimize ambiq i2c device pm
This commit optimizes the device pm for ambiq i2c driver
by adding pinctrl sleep/resume.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-06-17 07:22:44 +02:00
Alberto Escolar Piedras
5d31bce072 drivers/i2c/i2c_ambiq: Fix code compliance issues
Fix 4 issues detected by checkpatch

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-21 12:35:28 +02:00
Hao Luo
d89c61bd64 drivers: iom: define ambiq spi/i2c dma mode as a binding property
Changed to define ambiq spi/i2c dma mode as a binding property
instead of kconfig macros, making it more flexible for different
spi/i2c instances.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-05-13 16:23:26 +02:00
Swift Tian
389103dfec drivers: ambiq: rework ambiq spi and i2c drivers cache handling
1. rework IOM cmdq buffer instantiation
2. rework spi and i2c cache handling as it is incorrect.
3. buffers need to be aligned with DCACHE on

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-05-08 14:00:52 +02:00
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Hao Luo
5d62f96d8d drivers: i2c: ambiq: Optimized i2c_ambiq_transfer to handle frame header
Need to send the device address together with data in one transaction,
instead of splitting into two.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-14 16:07:54 +02:00
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
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
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
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
Pieter De Gendt
ee6f51537a drivers: i2c: Place API into iterable section
Add wrapper DEVICE_API macro to all i2c_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-16 18:25:36 +01:00
Hao Luo
8b107ab5f1 drivers: i2c: add bus recovery
Added bus recovery support for ambiq i2c

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-22 20:40:29 +02:00
Hao Luo
a1cd2d6c83 drivers: pm: add pm_policy_state_lock for drivers
Added pm_policy_state_lock to prevent memory power
off during data transfer

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-22 14:14:34 +02:00
Hao Luo
e7a64f74a8 drivers: i2c: add runtime put for error path
The previous error path incorrectly returned without
calling runtime put async

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-10-16 12:26:17 +02:00
Yuval Peress
8974c248cf rtio: Add default i2c submit handler
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>
2024-09-04 21:28:26 +02:00
Zhengwei Wang
2cbf3b9365 drivers: i2c: pm: Add power management support for Ambiq Apollo3 SoCs I2C
Add power management support for Apollo3/Apollo3P I2C, and
automatically enables device runtime power management

Signed-off-by: Zhengwei Wang <zwang@ambiq.com>
2024-08-20 10:32:52 +02:00
Richard Wheatley
188fc58c72 drivers: update AMBIQ drivers to use proper base address
REG_X_BASEADDR will be removed from all hal files.
This forces the use of the peripheral base address
Define MSPI_PORT macro for chip drivers

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-08-11 19:18:09 -05:00
Hao Luo
faa5fa1ab0 drivers: i2c: bugfix for ambiq i2c driver
Added k_sem_give for error return case.
Changed enabled interrupt bits.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-01 09:06:05 -04:00
Hao Luo
c8ae26549d drivers: i2c: Add support for Apollo3 SoCs I2C
This commit adds support for the I2C which
can be found in Apollo3 SoCs, it can work in
both DMA and non-DMA modes

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-05-21 20:55:34 -04:00
Pisit Sawangvonganan
ab2c9437d9 drivers: i2c: set 'i2c_driver_api' as 'static const'
This change marks each instance of the 'i2c_driver_api' as 'static const'.
The rationale is that 'i2c_driver_api' is used for declaring internal
module interfaces and is not intended to be modified at runtime.
By using 'static const', we ensure immutability, leading to usage of only
.rodata and a reduction in the .data area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-17 16:09:01 +00:00
Bryan Zhu
b493d51bb1 drivers: i2c: i2c_ambiq: fixing error in bitrate setting
During init i2c_ambiq device, the bitrate calculation is not correct,
results in incorrect  device speed, or failed to configure i2c device
if clock-frequency is set to higher than I2C_BITRATE_STANDARD

Signed-off-by: Bryan Zhu <bzhu@ambiq.com>
2023-12-08 20:20:11 +00:00
Mateusz Sierszulski
47d0e79444 drivers: i2c: Add Ambiq I2C driver
This commit adds I2C master driver for Apollo4 SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-17 15:15:45 +02:00