Utilizing /dev/i2c-1 on Colibri VF61

Hello

I am Updating an Image, for which there is no form of Documentation, to use branch LinuxImageV2.7. I created a new Image, following your tutorial like so:

mkdir oe-core
cd oe-core
repo init -u http://git.toradex.com/toradex-bsp-platform.git -b LinuxImageV2.7
repo sync.

Then i created my own layer, added it to bblayers.conf and portet the recepies to it. Things seem mostly fine, and quite a good deal is already working, but one thing irritates me. With the old Image i got /dev/i2c-0 and /dev/i2c-1. Now with the new image, /dev/i2c-1 is gone. This is bad, since the software needs that one.

  1. Copy the same vf610-colibri-ifm-v1.dts from the last Image into the kernel recipe. Patching the makefile to include the dtb of it.
  2. Patch u-boot’s colibri_vf.h to default to the new dtb.

With that, the Image contains signs of my new dtb, but im unsure how to really test it. Also the i2c-1 device is still missing.

&i2c0 {
        status = "okay";
};

&i2c1 {
        status = "okay";
        clock-frequency = <400000>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c1>;

        rtc: pcf8523@68 {
                compatible = "nxp,pcf8523";
                reg = <0x68>;
        };
};

&iomuxc {
        vf610-colibri {

                pinctrl_can_int: can_int {
                        fsl,pins = <
                                VF610_PAD_PTB21__GPIO_43        0x22ed
                        >;
                };

                pinctrl_gpiokeys: gpiokeys {
                        fsl,pins = <
                                VF610_PAD_PTB19__GPIO_41        0x218d
                        >;
                };

                pinctrl_gpiotouch: touchgpios {
                        fsl,pins = <
                                VF610_PAD_PTB8__GPIO_30         0x6f
                                VF610_PAD_PTB1__GPIO_23         0x4f
                        >;
                };

                pinctrl_i2c1: i2c1grp {
                        fsl,pins = <
                                VF610_PAD_PTB16__I2C1_SCL               0x37ff
                                VF610_PAD_PTB17__I2C1_SDA               0x37ff
                        >;
                };
        };
};

Since i dont understand the above, please point me into the right direction to make this work. How can i make use of the second i2c-1 interface of the colibri-vf board?

Source1: http://developer.toradex.com/knowledge-base/i2c-(linux)

There has been some changes to pinmuxing in the base device trees (vf-colibri.dts) which might influence your device tree. Check the kernel log (e.g. using dmesg) whether there are pinmux conflicts reported.

E.g. with the last release we now pinmux all GPIO’s explicitly. You might need to undo that by setting the pinctrl-0 property explicitly, as we did with the dual Ethernet device tree:
http://git.toradex.com/cgit/linux-toradex.git/commit/?h=toradex_vf_4.4-next&id=f51c4865a7a910c1e4bafac6f3a84f48e5136184

I did find that my bbappend was for the wrong u-boot version, and therefore my dts did not apply. Since i changed that, i can see my file utilized when flashing the board:

reading colibri_vf/vf610-colibri-ifm-v1.dtb

That beeing said, now the system wont boot anymore.

Starting kernel ...

So thanks for your response. I will try creating a new dts based on the eval file.

UPDATE

I created a new dts based on the eval board. With this, /dev/i2c-1 is available.
Problem is, the interface does not seem to work.

dmesg:

[    0.141071] i2c i2c-0: IMX I2C adapter registered
[    0.141203] i2c i2c-0: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
[    0.141407] vf610-pinctrl 40048000.iomuxc: pin VF610_PAD_PTB16 already requested by 40048000.iomuxc; cannot claim for 40067000.i2c
[    0.141500] vf610-pinctrl 40048000.iomuxc: pin-38 (40067000.i2c) status -22
[    0.141561] vf610-pinctrl 40048000.iomuxc: could not request pin 38 (VF610_PAD_PTB16) from group i2c1grp  on device 40048000.iomuxc
[    0.141646] imx-i2c 40067000.i2c: Error applying setting, reverse things back
[    0.142389] i2c i2c-1: IMX I2C adapter registered
[    0.142486] i2c i2c-1: using dma0chan2 (tx) and dma0chan3 (rx) for DMA transfers

I’m guessing these are those pinmux problems you mentioned.

UPDATE
Here is the working dts:

/*
 * Copyright 2014 Toradex AG
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <dt-bindings/input/input.h>

/ {
        chosen {
                stdout-path = "serial0:115200n8";
        };

        aliases {
                ethernet0 = &fec1;
                ethernet1 = &fec0;
        };

        clk16m: clk16m {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <16000000>;
        };

        panel: panel {
                compatible = "edt,et057090dhu";
                backlight = <&bl>;
                power-supply =  <&reg_3v3>;
        };

        extcon_usbc_det: usbc_det {
                compatible = "linux,extcon-usb-gpio";
                debounce = <25>;
                id-gpio = <&gpio3 6 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_usbc_det>;
        };

        reg_3v3: regulator-3v3 {
                compatible = "regulator-fixed";
                regulator-name = "3.3V";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                regulator-always-on;
        };

        reg_5v0: regulator-5v0 {
                compatible = "regulator-fixed";
                regulator-name = "5V";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                regulator-always-on;
        };
        reg_usbh_vbus: regulator-usbh-vbus {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_usbh1_reg>;
                regulator-name = "VCC_USB[1-4]";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                gpio = <&gpio2 19 GPIO_ACTIVE_LOW>; /* USBH_PEN resp. USBH_P_EN */
                vin-supply = <&reg_5v0>;
        };

        gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_gpiokeys>;

                power {
                        label = "Wake-Up";
                        gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
                        linux,code = <KEY_WAKEUP>;
                        debounce-interval = <10>;
                        gpio-key,wakeup;
                };
        };
};

&bl {
        brightness-levels = <0 4 8 16 32 64 128 255>;
        default-brightness-level = <6>;
        power-supply =  <&reg_3v3>;
        status  = "disabled";
};

&dcu0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_dcu0_1>;
        fsl,panel = <&panel>;
        status = "disabled";
};

&dspi1 {
        status = "disabled";
};

&esdhc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_esdhc1>;
        bus-width = <4>;
        status = "okay";
};

&fec1 {
        phy-mode = "rmii";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";
};

&i2c0 {
        status = "okay";
};

&i2c1 {
        status = "okay";
        clock-frequency = <400000>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c1>;

        rtc: pcf8523@68 {
                compatible = "nxp,pcf8523";
                reg = <0x68>;
        };
};

&pwm0 {
        status = "disabled";
};

&pwm1 {
        status = "disabled";
};

&reg_module_3v3 {
        vin-supply = <&reg_3v3>;
};

&tcon0 {
        status = "okay";
};

&uart0 {
        status = "okay";
};

&uart1 {
        status = "okay";
};

&uart2 {
        status = "okay";
};

&usbdev0 {
        extcon = <&extcon_usbc_det>, <&extcon_usbc_det>;
};

&usbh1 {
        vbus-supply = <&reg_usbh_vbus>;
};

&iomuxc {
        pinctrl-0 = <&pinctrl_hog_1>;

        vf610-colibri {
                pinctrl_can_int: can_int {
                        fsl,pins = <
                                VF610_PAD_PTB21__GPIO_43        0x22ed
                        >;
                };

                pinctrl_gpiokeys: gpiokeys {
                        fsl,pins = <
                                VF610_PAD_PTB19__GPIO_41        0x218d
                        >;
                };

                pinctrl_gpiotouch: touchgpios {
                        fsl,pins = <
                                VF610_PAD_PTB8__GPIO_30         0x6f
                                VF610_PAD_PTB1__GPIO_23         0x4f
                        >;
                };

                pinctrl_i2c1: i2c1grp {
                        fsl,pins = <
                                VF610_PAD_PTB16__I2C1_SCL               0x37ff
                                VF610_PAD_PTB17__I2C1_SDA               0x37ff
                        >;
                };
        };
};

To just resolve kernel/dtb issues I would recommend to build/patch the kernel outside of OpenEmbedded and boot the zImage/dtb over tftp:
http://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code

Thanks for your update, glad it works now.