This is a cache of https://discuss.96boards.org/t/set-dts-for-i2c2-as-a-normal-i2c-device/1049. It is a snapshot of the page at 2024-09-19T04:45:48.130+0000.
Set DTS for <strong>i2c</strong>2 as a normal <strong>i2c</strong> device - DragonBoard410c - 96Boards Forum

Set DTS for i2c2 as a normal i2c device

Hello everyone,

As you known, i2c2 (APQ_GPIO_29 & APQ_GPIO_30) is designed for CCI function.
However, if I want to use it as a normal i2c device (/dev/i2c-x), is it possible?
How to configure the dts to achieve this?

Currently, the dts settings for i2c2 in 16.09 is as below.
But, it does not generate the i2c device in /dev/i2c-x.


cci: qcom,cci@1b0c000 {
 cell-index = &lt;0&gt;;
 compatible = &quot;qcom,cci&quot;;
 reg = &lt;0x1b0c000 0x1000&gt;;
 #address-cells = &lt;1&gt;;
 #size-cells = &lt;0&gt;;
 reg-names = &quot;cci&quot;;
 interrupts = &lt;GIC_SPI 50 0&gt;;
 interrupt-names = &quot;cci&quot;;
 clocks = &lt;&amp;gcc GCC_CAMSS_TOP_AHB_CLK&gt;,
      &lt;&amp;gcc CCI_CLK_SRC&gt;,
      &lt;&amp;gcc GCC_CAMSS_CCI_AHB_CLK&gt;,
      &lt;&amp;gcc GCC_CAMSS_CCI_CLK&gt;,
      &lt;&amp;gcc GCC_CAMSS_AHB_CLK&gt;;
 clock-names = &quot;camss_top_ahb_clk&quot;,
         &quot;cci_src_clk&quot;,
                &quot;cci_ahb_clk&quot;,
                &quot;cci_clk&quot;,
                &quot;camss_ahb_clk&quot;;
  qcom,clock-rates = &lt;0 19200000 80000000 0 0&gt;;
  pinctrl-names = &quot;default&quot;, &quot;sleep&quot;;
  pinctrl-0 = &lt;&amp;cci0_default&gt;;
  pinctrl-1 = &lt;&amp;cci0_sleep&gt;;
 ...

The normal i2c devices should set “qcom,i2c-qup-v2.2.1” compatible and corresponding “iface” & “core” clocks.


 blsp_i2c2: i2c@78b6000 {
 compatible = &quot;qcom,i2c-qup-v2.2.1&quot;;
 reg = &lt;0x78b6000 0x1000&gt;;
 interrupts = &lt;GIC_SPI 96 0&gt;;
 clocks = &lt;&amp;gcc GCC_BLSP1_AHB_CLK&gt;,
           &lt;&amp;gcc GCC_BLSP1_QUP2_i2c_APPS_CLK&gt;;
 clock-names = &quot;iface&quot;, &quot;core&quot;;

Badly, I don’t know what clock source I should set for i2c2.
Anyone can help for this?

Thanks,
Daniel

Hi Daniel,

The “qcom,cci” vs “qcom,i2c-qup” relates to which hardware block that implements the i2c adapter. The i2c you’re looking at is hooked up to the cci block and as such a driver for that block needs to be used (not the QUP)

I do believe that the cci specification share enough with the i2c specification that you should be able to hook up non-camera related i2c clients on the CCI bus (but I’m not a HW guy). The current cci driver is however not implemented as a standard i2c adapter driver, so you will not be able to use your standard drivers or interfaces.

I do see reasons for implementing a proper i2c adapter driver for the cci block, if this happens you should be able to access your i2c clients through i2c-dev.

Regards,
Bjorn