Unable to enable I2C1 on the I.MX6

Discussion in 'UDOO QUAD' started by Tball, Jun 17, 2017.

  1. Tball

    Tball New Member

    Joined:
    Jun 17, 2017
    Messages:
    3
    Likes Received:
    0
    Hi all

    I have trouble enabling I2C1 on the EIM_D20 (GPIO85) and EIM_D28 (GPIO92) pins on the I.MX6.

    After a lot of reading I realize that I need to enable I2C1 through the kernel device tree.

    I am using ArchLinux Armv7. I have tried the following:

    1. I checked the current kernel source out with ABS
    2. Changed the arch/arm/boot/dts/imx6qdl-udoo.dtsi by adding this I2C1 interface in the same way as I2C2 and I2C3 are defined.
    &i2c1 {
    clock-frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c1>;
    status = "okay";
    };

    pinctrl_i2c1: i2c1grp {
    fsl,pins = <
    MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
    MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
    >;
    };

    3. Then I can the following command:
    make ARCH=arm imx6q-udoo.dtb

    which is succesfully creating the .dtb file.

    4. I copy the said .dtb file to /boot/dbts/ directory.

    Now it freezes while booting. Does any have experience in this issue?

    End of the boot log where it freezes:
    [ 3.133071] Btrfs loaded, crc32c=crc32c-generic␍␊
    [ 3.141965] mmc0: host does not support reading read-only switch, assuming write-enable␍␊
    [ 3.147573] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().␍␊
    [ 3.147772] imx_thermal 2000000.aips-bus:tempmon: Extended Commercial CPU temperature grade - max:105C critical:100C passive:95C␍␊
    [ 3.149998] snvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01 00:00:00 UTC (0)␍␊
    [ 3.150005] sr_init: No PMIC hook to init smartreflex␍␊
    [ 3.150106] sr_init: platform driver register failed for SR␍␊
    [ 3.150626] lcd_panel: disabling␍␊
    [ 3.150629] ALSA device list:␍␊
    [ 3.150632] No soundcards found.␍␊

    A boot log with the working dtb:
    [ 3.105720] Btrfs loaded, crc32c=crc32c-generic␍␊
    [ 3.110319] mmc0: host does not support reading read-only switch, assuming write-enable␍␊
    [ 3.120138] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().␍␊
    [ 3.132589] imx_thermal 2000000.aips-bus:tempmon: Extended Commercial CPU temperature grade - max:105C critical:100C passive:95C␍␊
    [ 3.145462] mmc0: new high speed SDHC card at address aaaa␍␊
    [ 3.151595] snvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 2017-06-17 12:09:42 UTC (1497701382)␍␊
    [ 3.151605] mmcblk0: mmc0:aaaa SU08G 7.40 GiB ␍␊
    [ 3.165825] sr_init: No PMIC hook to init smartreflex␍␊
    [ 3.170204] mmcblk0: p1␍␊
    [ 3.173581] sr_init: platform driver register failed for SR␍␊
    [ 3.179651] lcd_panel: disabling␍␊
    [ 3.182886] ALSA device list:␍␊
    [ 3.185874] No soundcards found.␍␊
    [ 3.190325] Freeing unused kernel memory: 1024K␍␊
    [ 3.195316] usb 1-1: new high-speed USB device number 2 using ci_hdrc␍␊
    it continues until done.

    I noticed that the newly generated dtb file is a bit smaller than the original dtb file, so I decompiled both using dtc.
    The difference is a lot of:
    linux,phandle = <0x56>;
    phandle = <0x56>;
    in the working dtb, which are missing in the new dtb file?

    Example old dtb:
    ecspi@02010000 {
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
    reg = <0x2010000 0x4000>;
    interrupts = <0x0 0x21 0x4>;
    clocks = <0x2 0x72 0x2 0x72>;
    clock-names = "ipg", "per";
    dmas = <0xb 0x7 0x8 0x1 0xb 0x8 0x8 0x2>;
    dma-names = "rx", "tx";
    status = "disabled";
    linux,phandle = <0x56>;
    phandle = <0x56>;
    };

    New dtb:
    ecspi@02010000 {
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
    reg = <0x2010000 0x4000>;
    interrupts = <0x0 0x21 0x4>;
    clocks = <0x2 0x72 0x2 0x72>;
    clock-names = "ipg", "per";
    dmas = <0xb 0x7 0x8 0x1 0xb 0x8 0x8 0x2>;
    dma-names = "rx", "tx";
    status = "disabled";
    };

    Please note that I have tried compiling a vanilla .dts file without the i2c1 changes and it doesn't work! So I must be doing something wrong in the compilation process?

    Thank you so much for your help. I have used too much time on this.
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I am not an expert at all on this topic. But perhaps a workaround that was advised to others:
    When you use Udoobuntu 2 you can enable I2C-1 through the Device Tree Editor. It will modify and compile the device tree. You can then copy the modified or new created dtsi/dtsb files to your Arch Linux environment.
     
  3. Tball

    Tball New Member

    Joined:
    Jun 17, 2017
    Messages:
    3
    Likes Received:
    0
    Hi Waltervl
    Thank you for your advice.
    Do you think that it will solve my problem, when I can't even compile a non-changed dts? Should I use a dts from ubuntu?

    Did others have similar problem?
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    You're right.
    If I look here in the Quad documentation is see
    Code:
    Compile Device Trees
    ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs -j5
    
     
  5. Tball

    Tball New Member

    Joined:
    Jun 17, 2017
    Messages:
    3
    Likes Received:
    0
    waltervl: Thank you
    I ended up installing Udoobuntu.
    Now everyting works as expected. Something must have been going on in my arch installation.
     

Share This Page