I2C0 not available on Ubuntu


#1

Hi all,

I wanted to do some tests with the I2C0 port in the 40 pin low speed connector. But it is not working. I am using Ubuntu server image.

I had a look at schematics. I saw that I2C0 port is connected to RK3399 I2C6 port (see images below).

sch_con

sch_rk3399

From Rock960 console, I did:

$ ls /dev/i2c*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2  /dev/i2c-4  /dev/i2c-7  /dev/i2c-9

I was a bit surprised because there was no /dev/i2c-6. I checked device tree file like:

$ dtc -I fs ./sys/firmware/devicetree/base/

And I got:

	i2c@ff110000 {
		reg = <0x0 0xff110000 0x0 0x1000>;
		interrupts = <0x0 0x3b 0x4 0x0>;
		pinctrl-0 = <0x3a>;
		compatible = "rockchip,rk3399-i2c";
		clock-names = "i2c", "pclk";
		clocks = <0x8 0x41 0x8 0x155>;
		status = "okay";
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		pinctrl-names = "default";
	};

	i2c@ff150000 {
		reg = <0x0 0xff150000 0x0 0x1000>;
		interrupts = <0x0 0x25 0x4 0x0>;
		pinctrl-0 = <0x42>;
		compatible = "rockchip,rk3399-i2c";
		clock-names = "i2c", "pclk";
		clocks = <0x8 0x45 0x8 0x159>;
		status = "disabled";
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		pinctrl-names = "default";
	};

Here’s the memory map:

memory_map

So:

  • i2c@ff110000 is for I2C1in 40 pin low speed connector, and has: status=“okay”
  • i2c@ff150000 is for i2C0 in 40 pin low speed connector, and has: status=“disabled”

How can I use I2C0?

Thank you


New linux images for all versions of Rock960?
#2

Everything you said makes sense.
I don’t know why this I2c is not enabled by default. @hipboi, any info?

You need to modify and rebuild the device tree blob.
At runtime, on your board, you can also use dtbtool to update the dtb:

apt-get install gcc make
wget https://github.com/96boards/dt-update/archive/master.zip
unzip master.zip
cd dt-update-master
make && make install

mount /dev/mmcblk1p4 /mnt/
dtbtool /mnt/rock960-linux.dtb -n i2c@ff150000 -s status="okay"
sync
reboot

#3

yes, the i2c was not enabled in the ubuntu server image by mistake. You can download the latest rock960 model a/b dtb from this link:

https://dl.vamrs.com/products/rock960/images/ubuntu/partitions/kernel/rock960-model-ab-linux.dtb

Replace it with the following steps:

mount /dev/mmcblk1p4 /mnt
cp rock960-model-ab-linux.dtb /mnt

edit /mnt/extlinux/extlinux.conf and replace fdt line to

fdt /rock960-model-ab-linux.dtb

save, sync and reboot