Part Number: AM623
Tool/software:
How to configure I2C from interrupt to polling mode in dts?

there is polling mode in driver, but did not find how to config in dts.

This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: AM623
Tool/software:
How to configure I2C from interrupt to polling mode in dts?

there is polling mode in driver, but did not find how to config in dts.

Hello Tony,
I did not have time to look at this thread today. Please ping the thread if I have not responded by Thursday.
Regards,
Nick
Hello Tony,
Thank you for the ping.
I know for sure that the CAN interface can be used in interrupt or polling mode (in fact, on AM62x Linux can only interact with the MCU domain CAN with polling mode). For that particular driver & set of devicetree nodes, you simply remove the interrupts & interrupt-names entries from the devicetree file:
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml
// Example with interrupts
#include <dt-bindings/clock/imx6sx-clock.h>
can@20e8000 {
compatible = "bosch,m_can";
reg = <0x020e8000 0x4000>, <0x02298000 0x4000>;
reg-names = "m_can", "message_ram";
interrupts = <0 114 0x04>, <0 114 0x04>;
interrupt-names = "int0", "int1";
clocks = <&clks IMX6SX_CLK_CANFD>,
<&clks IMX6SX_CLK_CANFD>;
clock-names = "hclk", "cclk";
bosch,mram-cfg = <0x0 0 0 32 0 0 0 1>;
can-transceiver {
max-bitrate = <5000000>;
};
};
- |
// Example with timer polling
#include <dt-bindings/clock/imx6sx-clock.h>
can@20e8000 {
compatible = "bosch,m_can";
reg = <0x020e8000 0x4000>, <0x02298000 0x4000>;
reg-names = "m_can", "message_ram";
clocks = <&clks IMX6SX_CLK_CANFD>,
<&clks IMX6SX_CLK_CANFD>;
clock-names = "hclk", "cclk";
bosch,mram-cfg = <0x0 0 0 32 0 0 0 1>;
can-transceiver {
max-bitrate = <5000000>;
};
};
On the other hand, the I2C bindings documentation claims that interrupts are a required property of the devicetree node:
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml
The i2c-omap.c driver itself definitely has a call for doing polling, as you identified.
The i2c-omap driver is a low-level driver to interact with the I2C peripheral, and the customer will need to use a higher-level driver to actually interact with their I2C peripheral. My expectation is that the calls in the higher-level driver will dictate whether polling or interrupts are used - even if interrupts are enabled for I2C, if the higher level driver makes a call that translates into master_xfer_atomic, then I would expect the polling method to be used.
Regards,
Nick