I2C nunchuk driver

Hello.
I built using mainline kernel 4.19.2 and add am335x-customboneblack.dts in the source tree.

This is the output of dmesg:

dmesg | grep i2c

[ 0.333709] i2c i2c-0: of_i2c: modalias failure on /ocp/i2c@4802a000/pinmux_i2c1_pins
[ 0.333746] i2c i2c-0: Failed to create I2C device for /ocp/i2c@4802a000/pinmux_i2c1_pins
[ 0.333789] omap_i2c 4802a000.i2c: bus 0 rev0.11 at 100 kHz
[ 1.711959] i2c /dev entries driver
[ 2.271800] omap_i2c 44e0b000.i2c: bus 1 rev0.11 at 400 kHz
[ 2.281681] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz

Would you like to explain it?
Best Regards.

Zulham

Hello.
I built using mainline kernel 4.19.2 and add am335x-customboneblack.dts in the source tree.
This is the output of dmesg:

# dmesg | grep i2c
[ 0.333709] i2c i2c-0: of_i2c: modalias failure on /ocp/i2c@4802a000/pinmux_i2c1_pins
[ 0.333746] i2c i2c-0: Failed to create I2C device for /ocp/i2c@4802a000/pinmux_i2c1_pins
[ 0.333789] omap_i2c 4802a000.i2c: bus 0 rev0.11 at 100 kHz
[ 1.711959] i2c /dev entries driver
[ 2.271800] omap_i2c 44e0b000.i2c: bus 1 rev0.11 at 400 kHz
[ 2.281681] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz

Would you like to explain it?

I would not..

Best Regards.

Did you load the correct driver module?

How did you wire the remote?

Regards,

Hi Robert,
First I create am335x-customboneblack.dts:
#include “am33xx.dtsi”
#include “am335x-bone-common.dtsi”
#include “am335x-boneblack-common.dtsi”
/ {
model = “TI AM335x BeagleBone Black”;
compatible = “ti,am335x-bone-black”, “ti,am335x-bone”, “ti,am33xx”;
};

&cpu0_opp_table {
/*

  • All PG 2.0 silicon may not support 1GHz but some of the early
  • BeagleBone Blacks have PG 2.0 silicon which is guaranteed
  • to support 1GHz OPP so enable it for PG 2.0 on this board.
    */
    oppnitro-1000000000 {
    opp-supported-hw = <0x06 0x0100>;
    };
    };

&i2c1 {
status = “okay”;
clock-frequency = <100000>;
nunchuk@52 {
model = “Nintendo Wiichuk”;
compatible = “nintendo,nunchuk”;
reg = <0x52>;
};

};

&am33xx_pinmux {
i2c1_pins: pinmux_i2c1_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda /
AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2) /
spi0_cs0.i2c1_scl */

;
};
};

After that the dmesg doesn’t show the modalias failure anymore.
The dmesg shows:
[ 0.334015] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[ 1.702369] i2c /dev entries driver
[ 2.240387] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 2.256890] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz

But when I do i2cdetect -r 1, the output:
root@beaglebone:~# i2cdetect -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] [ 37.715246]
y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: [ 42.169348] omap_i2c 4802a000.i2c: timeout waiting for bus ready
– [ 43.189199] omap_i2c 4802a000.i2c: timeout waiting for bus ready
– [ 44.209016] omap_i2c 4802a000.i2c: timeout waiting for bus ready
– [ 45.229050] omap_i2c 4802a000.i2c: timeout waiting for bus ready

Then I compile the nunchuk driver from this link: https://github.com/martingkelly/nunchuk/blob/master/drivers/misc/nunchuk/nunchuk.c
Then insmod shows this output:
[ 138.005236] nunchuk: loading out-of-tree module taints kernel.
[ 139.029395] omap_i2c 4802a000.i2c: timeout waiting for bus ready
[ 139.036451] nunchuk 1-0052: nunchuk bailed: 0xfffffff0!
[ 139.042327] nunchuk: probe of 1-0052 failed with error -16

Please help me to solve it.
Best Regards.

Zulham

Hi Robert,
I have succeeded to install the i2c nunchuk on BBB. I changed the am335x-customboneblack.dts to be:
/dts-v1/;
#include “am33xx.dtsi”
#include “am335x-bone-common.dtsi”
#include “am335x-boneblack-common.dtsi”
/ {
model = “TI AM335x BeagleBone Black”;
compatible = “ti,am335x-bone-black”, “ti,am335x-bone”, “ti,am33xx”;
};

&cpu0_opp_table {
/*

  • All PG 2.0 silicon may not support 1GHz but some of the early
  • BeagleBone Blacks have PG 2.0 silicon which is guaranteed
  • to support 1GHz OPP so enable it for PG 2.0 on this board.
    */
    oppnitro-1000000000 {
    opp-supported-hw = <0x06 0x0100>;
    };
    };

&i2c1 {
status = “okay”;
clock-frequency = <100000>;
nunchuk@52 {
//model = “Nintendo Wiichuk”;
compatible = “nintendo,nunchuk”;
reg = <0x52>;
};

};

&am33xx_pinmux {
pinctrl-names = “default”;
pinctrl-0 = <&i2c1_pins>;
i2c1_pins: pinmux_i2c1_pins {
pinctrl-single,pins = <
//AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda /
//AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2) /
spi0_cs0.i2c1_scl /
0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /
spi0_d1.i2c1_sda /
0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /
spi0_cs0.i2c1_scl */

;
};
};

The rest (I mean source code, etc) are the same.

Best Regards.
Zulham