Setting i2c bus 2 speed

I’d like to change the i2c bus 2 to 400kHz.

I see it’s currently running at 100kHz.

bone$ dmesg | grep i2c
[ 0.622594] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[ 0.623608] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[ 0.625035] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 1.357694] i2c /dev entries driver
[ 1.543350] input: tps65217_pwr_but as /devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-pwrbutton/input/input0
[ 1.544568] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz

The speed appears to be set here:

bone$ uname -a
Linux beaglebone 4.14.52-ti-rt-r60 #1 SMP PREEMPT Tue Jun 26 23:28:55 UTC 2018 armv7l GNU/Linux
bone$ cd /opt/source/dtb-4.14-ti/src/arm/

Looking in am335x-bone-common.dtsi I see:

&i2c2 {
pinctrl-names = “default”;
//pinctrl-0 = <&i2c2_pins>;
pinctrl-0 = <>;

status = “okay”;
clock-frequency = <100000>;

I assume I can change the clock-frequency to 400000.
But what do I do next? I don’t see am335x-bone-common.dtsi in /boot//boot/dtbs/4.14.52-ti-r60.

Or, is there way way to change the clock after booting?

Thanks…

–Mark

Correct, after bootup, you can't currently change that.. Some users
have been using the i2c-fast overlay from the bb.org-overlay repo..

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-FAST-00A0.dts

Regards,

Well, uboot_overlay_addr4=/lib/firmware/BB-I2C2-FAST-00A0.dtbo works!

Unfortunately I now need to use i2c bus 1 on pins P9_24 and P9_26. BB-I2C1-FAST-00A0.dtbo is set up for P9_17 and P9_18.
It’s not hard to edit the source, but how do I compile it so it find the include files?

–Mark

Give this a try..

https://gist.github.com/RobertCNelson/507ec93db7d1b8041810cc070c0d894e

Download it into:

cd /opt/source/bb.org-overlays/src/arm/
git pull
wget ^ file...
cd ../../
make
sudo make install

Regards,

That compiled and worked fine. I2C1 is now 400kHz, but I can’t config my other pins:

P9_18 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_18_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_18_pinmux/state
P9_21 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_21_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_21_pinmux/state
P9_22 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_22_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_22_pinmux/state
P9_17 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_17_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_17_pinmux/state

What did I do wrong?

–Mark

It’s working. i2c1 is now at 400kHz.

Thanks…

–Mark