RobertCNelson / bb-kernel

MIT License
130 stars 102 forks source link

I2C device name mismatch #20

Open QuickJack opened 8 years ago

QuickJack commented 8 years ago

I am testing branch am33x-rt-v4.1 (4.1.3-bone-rt-r15). After booting the kernel on a BeagleBone Black I did "ls -l /dev/i2c*" to list the available i2c devices. The result was:

/dev/i2c-0 /dev/i2c-2

Doing the same thing with kernel 3.8.13 the result is:

/dev/i2c-0 /dev/i2c-1

This will cause trouble for all capes that using /dev/i2c-1.

What is currently the best kernel to use to have PREEMPT_RT as well as Cape Manager?

RobertCNelson commented 8 years ago

This is a bug in 3.8.13, 4.1.x is showing the proper behavior..

For 4.1.x:

linux-image-4.1.15-ti-rt-r42
or
linux-image-4.1.15-bone-rt-r18

Got 4.4.x + RT booting yesterday, not 100% ready.. Regards,

QuickJack commented 8 years ago

Can you explain it in a bit more detail as to why it is a bug to number devices 0,1,2... compared to 0,2,4...? This effect will force all i2c based applications to have a configuration option to change the i2c master device if they want to support both kernel architectures.

Why exactly do you prefer the ti kernel over the bb-kernel? I always thought the bb-kernel would be the better choice.

RobertCNelson commented 8 years ago

You need to load an overlay that needs i2c-1 to see what's really going on.. (and thus there is no bug.. ;) )

dmesg | grep omap_i2c
[    2.969573] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[    2.969631] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring probe
[    3.867737] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    3.871669] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz

ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-2

Then load an i2c-1 overlay (doesn't matter if you don't have this cape installed on the board)

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

sudo sh -c "echo 'BB-I2C1-PCA9685' > /sys/devices/platform/bone_capemgr/slots"

Then recheck:

dmesg | grep omap_i2c
[    2.969573] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[    2.969631] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring probe
[    3.867737] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    3.871669] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[  414.833998] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz

ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

ti vs bone..

For the am335x (4.1.x branch)

bone = uio_pruss, sgx with 5.01.01.02 ti = remote_proc, edma re-write, sgx with ti's new stack (not working yet)

(everything else i keep in sync with bone vs ti that i can..)

Regards,

QuickJack commented 8 years ago

I am currently trying to rewrite to gpmc driver for the Logibone cape to support Kernel 4.1.x+. This driver is using the EDMA as well. The EDMA rewrite sounds interesting. I will test this kernel soon.

I did this https://github.com/QuickJack/logi-kernel/commit/be0e98a394807055992ae36fb6be612108188eee to compensate for the I2C device name change. Every cape that uses I2C has to implement similar changes to support newer kernels.

QuickJack commented 8 years ago

/dev/i2c-2 is working fine. I have created issue #21 to discuss the GPMC related problems.