Zephyr AXI IIC Driver Support
This page gives an overview of the AXI IIC Zephyr driver which is available as part of the zephyr-amd repo.
HW Features
AXI I2C controller
Design Notes
N/A
Implementation
Features Supported
Master operation
Slave operation
Repeated Start.
Interrupt driven.
7-bit addressing
Transmit and receive FIFOs — 16 bytes.
Dynamic Receive as a master
APIs supported
i2c_configure - Configure operation of a host controller
i2c_transfer - Perform data transfer to another I2C device in controller mode
synchronous transfer
i2c_target_register - Registers the provided config as Target device of a controller
i2c_target_unregister - Unregisters the provided config as Target device
Missing Features
Dynamic Send as a master
Multi-master operation.
10-bit addressing.
Polled operation.
APIs not supported
i2c_get_config - Get configuration of a host controller
i2c_transfer_cb - Perform data transfer to another I2C device in controller mode
asynchronously with a callback completion
i2c_iodev_submit - Submit requests to an I2C device with RTIO
i2c_recover_bus - Recover the I2C bus
Known Issues
N/A
Limitations
N/A
Kernel Configuration
CONFIG_I2C=y
The following configuration is also supported:
CONFIG_I2C_TARGET
CONFIG_I2C_TARGET (Slave Mode Support)
Device Tree
axi_i2c0: i2c@a0000000 {
compatible = "xlnx,xps-iic-2.00.a";
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL
IRQ_DEFAULT_PRIORITY>;
reg = <0xa0000000 0x1000>;
interrupt-parent = <&gic>;
};
changes with respect to Linux device tree
clocks property is not added
Lopper changes are added to generate axi-iic node
Driver Stack Size
2.1 KB (Master + Slave)
1.5 KB (Master Only)
3.0 KB (Master + Slave + Debug Log)
Test Platform
zcu102 - ZynqMp
Test SoC Architecture
R5
Testing Sequence
Build zephyr application for R5 core
west build -p -b <board> <sample application path>
Run zephyr elf on board
Example Tests
Test Name |
Example Source |
Description |
|---|---|---|
I2C custom target example |
samples/drivers/i2c/custom_target |
Setup Custom I2C Target on the I2C Interface |
I2C target example |
samples/drivers/i2c/target_eeprom |
Setup I2C Target on the I2C Interface |
EEPROM sample |
samples/drivers/eeprom/ Modified for target specific zcu102 - zephyr_zcu102_axi_iic_samples_drivers_eeprom.c (download) |
EEPROM Write and Read Sample using I2C Driver API |
AXI-I2C Master Mode Example |
zcu102 r5 - zephyr_zcu102_r5_axi_i2c_master.c (download) |
Master Mode Write, Read, Repeated Start, Dynamic Read.
|
Expected Output
R5: zcu102 test log:
zcu102 R5 AXI-I2C master log
I: Configuring i2c@a0000000 at 0xa0000000 D: Controller reinit I: initialized I: Configuring i2c@a0010000 at 0xa0010000 D: Controller reinit I: initialized *** Booting Zephyr OS build a1e5b441f39a *** I: AXI-I2C: master: init: Start I: AXI-I2C: master: device READY I: AXI-I2C: master: init: PASSED I: AXI-I2C: master: write: Start I: AXI-I2C: master: write: I2C_MUX_ADDR: Progress I: AXI-I2C: master: write: data: 01h D: Controller reinit D: Set IER to 0x17 D: ISR called for 0xa0010000, status 0x10 D: Got ISR events 0x10 I: AXI-I2C: master: write: I2C_MUX_ADDR success I: AXI-I2C: master: write: PASSED I: AXI-I2C: master: read: Start I: AXI-I2C: master: read: I2C_MUX_ADDR Progress D: Controller reinit D: Set IER to 0x09 D: ISR called for 0xa0010000, status 0x08 D: Got ISR events 0x08 D: Set IER to 0x11 D: ISR called for 0xa0010000, status 0x10 D: Got ISR events 0x10 I: AXI-I2C: master: read: I2C_MUX_ADDR success I: AXI-I2C: master: read: data: 01h 01h 01h I: AXI-I2C: master: read: PASSED I: AXI-I2C: master: write-read-repeated-start: Start I: AXI-I2C: master: write-read-repeated-start: IIC-Mux Progress I: AXI-I2C: master: write-repeated-start: data: 01h D: Controller reinit D: Set IER to 0x17 D: ISR called for 0xa0010000, status 0x04 D: Got ISR events 0x04 D: Set IER to 0x1b D: ISR called for 0xa0010000, status 0x0a D: Got ISR events 0x08 D: Set IER to 0x11 D: ISR called for 0xa0010000, status 0x10 D: Got ISR events 0x10 I: AXI-I2C: master: write-read-repeated-start: IIC-Mux success I: AXI-I2C: master: write-read-repeated-start: read data: 01h I: AXI-I2C: master: write-read-repeated-start: PASSED I: AXI-I2C: master: mode-test completed, PASSED
Code Coverage
With example Test, Code Coverage was 80.7% (Master Mode)
Performance Metric
TBA
Mainline Status
The preceding features are mainlined as of 01-Dec-2024
Driver Source Path
drivers/i2c/i2c_xilinx_axi.c
Misra C Report
Per coding guidelines of zephyr
Detailed Breakup
misra-c rule (Zephyr guideline) |
Severity |
Actual File Violations |
Kernel Utility Violations |
|---|---|---|---|
Dir 4.6 |
Advisory |
18 |
0 |
Dir 4.8 |
Advisory |
0 |
7 |
Dir 4.9 |
Advisory |
0 |
1 |
Rule 1.2 |
Advisory |
0 |
16 |
Rule 2.7 |
Advisory |
2 |
0 |
Rule 5.9 |
Advisory |
0 |
1 |
Rule 12.1 |
Advisory |
6 |
10 |
Rule 13.3 |
Advisory |
2 |
0 |
Rule 10.1 |
Required |
175 |
0 |
Rule 10.3 |
Required |
14 |
0 |
Rule 10.4 |
Required |
126 |
0 |
Rule 10.6 |
Required |
1 |
0 |
Rule 10.7 |
Required |
4 |
0 |
Rule 11.9 |
Required |
4 |
0 |
Rule 13.5 |
Required |
1 |
0 |
Rule 14.3 |
Required |
0 |
7 |
Rule 14.4 |
Required |
33 |
0 |
Rule 15.7 |
Required |
2 |
0 |
Rule 17.7 |
Required |
10 |
0 |
Rule 21.2 |
Required |
0 |
6 |
Total violations |
398 |
48 |