Inforce Computing Forums

inforce computing forums to discuss about inforce products

Adding new I2C device node to kernel

Questions and discussions related to Inforce 6540

by shaileshswankhede » Sat Jul 29, 2017 6:15 am

Hello,

I want to add new I2C device node so as to communicate with an I2C device from SBC. I referred to document: 'APQ8084_Configure_BLSP_Port_ApplicationNote_002308_Rev_G'. From documents its clear that I2C_0 and I2C_1 is dedicated for camera interface and can't be used for user purpose. So to add I2C_2 I did changes as per below diff file content (Unable to attach any file) (Android source lollipop LA.BF.2.1-05410-8084.0_Rel_V1.7)

After doing this /dev/i2c-2 node is generated, but when I am trying to write to any i2c device connected to this i2c-2 (pin 6 and 8 of 40 pin expansion connector), SBC is getting restarted. Where it could be going wrong? Is it some kind of memory corruption? System log at time of restart didn't help.

Diff file content:
Code: Select all
--- original/apq8084.dtsi   2017-07-26 20:29:44.917851000 +0530
+++ kernel/arch/arm/boot/dts/qcom/apq8084.dtsi   2017-07-26 20:59:17.093844948 +0530
@@ -927,22 +927,23 @@
       qcom,clk-ctl-xfer;
    };
 
-   i2c_2: i2c@f9927000 { /* BLSP1 QUP5 */
+   i2c_2: i2c@f9924000 { /* BLSP1 QUP5 */
       cell-index = <2>;
       compatible = "qcom,i2c-qup";
       #address-cells = <1>;
       #size-cells = <0>;
       reg-names = "qup_phys_addr";
-      reg = <0xf9927000 0x1000>;
+      reg = <0xf9924000 0x1000>;
       interrupt-names = "qup_err_intr";
-      interrupts = <0 99 0>;
+      interrupts = <0 96 0>;
       qcom,noise-rjct-scl = <0>;
       qcom,noise-rjct-sda = <0>;
       qcom,i2c-bus-freq = <100000>;
       qcom,i2c-src-freq = <19200000>;
-      qcom,sda-gpio = <&msmgpio 41 0>;
-      qcom,scl-gpio = <&msmgpio 42 0>;
+      qcom,sda-gpio = <&msmgpio 6 0>;
+      qcom,scl-gpio = <&msmgpio 7 0>;
       qcom,master-id = <86>;
+      qcom,clk-ctl-xfer;
    };
 
    i2c_1: i2c@f9966000 { /* BLSP2 QUP4 */


--- original/apq8084-sbc.dtsi   2017-07-26 21:12:30.753842127 +0530
+++ kernel/arch/arm/boot/dts/qcom/apq8084-sbc.dtsi   2017-07-26 20:53:26.461846195 +0530
@@ -216,7 +216,7 @@
 };
 
 &i2c_2 {
-   status = "disabled";
+   status = "ok";
 };
 
 &xhci_hsic_host {


--- original/clock-8084.c   2017-07-21 10:33:49.274700000 +0530
+++ kernel/arch/arm/mach-msm/clock-8084.c   2017-07-26 20:25:33.825852140 +0530
@@ -6000,12 +6000,15 @@
    CLK_LOOKUP("iface_clk",   gcc_blsp1_ahb_clk.c,   "f9923000.spi"),
    CLK_LOOKUP("iface_clk",   gcc_blsp1_ahb_clk.c,   "f9925000.i2c"),
    CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c,   "f9922000.uart"),
+   //Add node to BLSP1 AHB Clock
+   CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9924000.i2c"),
+   CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, "f9924000.i2c"),
    /* NFC */
    CLK_LOOKUP("iface_clk",   gcc_blsp1_ahb_clk.c,   "f9926000.i2c"),
    CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c,   "f9927000.i2c"),
    CLK_LOOKUP("",   gcc_blsp1_qup1_i2c_apps_clk.c,   ""),
    CLK_LOOKUP("core_clk",   gcc_blsp1_qup1_spi_apps_clk.c,   "f9923000.spi"),
-   CLK_LOOKUP("",   gcc_blsp1_qup2_i2c_apps_clk.c,   ""),
+   //CLK_LOOKUP("",   gcc_blsp1_qup2_i2c_apps_clk.c,   ""),
    CLK_LOOKUP("",   gcc_blsp1_qup2_spi_apps_clk.c,   ""),
    CLK_LOOKUP("core_clk",   gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"),
    CLK_LOOKUP("",   gcc_blsp1_qup3_spi_apps_clk.c,   ""),


--- original/board-8084-gpiomux.c   2017-07-21 10:33:49.274700000 +0530
+++ kernel/arch/arm/mach-msm/board-8084-gpiomux.c   2017-07-26 21:10:54.557842469 +0530
@@ -323,15 +323,15 @@
       },
    },
    {
-      .gpio      = 6,      /* BLSP1 QUP1 SPI_CS_N */
+      .gpio = 6,          //BLSP1_QUP1 I2C_SDA
       .settings = {
-         [GPIOMUX_SUSPENDED] = &gpio_spi_config,
+         [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
       },
    },
    {
-      .gpio      = 7,      /* BLSP1 QUP1 SPI_CLK */
+      .gpio = 7,          //BLSP1_QUP1 I2C_SCL
       .settings = {
-         [GPIOMUX_SUSPENDED] = &gpio_spi_config,
+         [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
       },
    },
    {


Thanks,
Shailesh
shaileshswankhede
 
Posts: 1
Joined: Tue Jul 11, 2017 7:42 am

by ashwin » Mon Nov 20, 2017 1:09 am

Hi Shailesh,

Your BLSP configuration for BLSP1_QUP2 seems correct. I'm not sure why you are facing this issue. Have you connected pullup resistors?

Regards,
Ashwin
ashwin
 
Posts: 4
Joined: Wed Jul 01, 2015 10:07 pm


Return to INFORCE 6540™

Contact Us.