Skip to content

Linux i2c bus

Michael Ambrus edited this page May 1, 2018 · 2 revisions

Linux i2c-bus "device"

EHWE support for native i2c. Device in this context means "bus". EHWE is structured around the concept that each bus is managed by a bus-device. Usually some form of USB- or serial-device.

On native systems, the "device" part is implicit - or rather, called a "controller".

To fit into EHWE code-structure, this called a "device" nevertheless.

  • Example code using native Linux code

"Devices" and HW interfaces with Linux-kernel module support

These are usable using the same EHWE "device"-driver. Below are a few selected due to simplicity, availability, runs on PC and cheapness. Many others exist however, see last sub-section for listing all

This is an actual device, but to EHWE is presents itself as a bus. The Linux-kernel device-driver for it is drivers/i2c/busses/i2c-tiny-usb.c

This is the simplest and cheapest possible HW-interface, providing you have a parallel printer-port. Driver load example:

sudo modprobe i2c-parport-light type=7 base=0xC050

All linux-kernel supported "devices"

ls linux/drivers/i2c/busses/*.c | \
	grep -Eve 'mod\.c$' | \
	sed -Ee 's/^.*i2c-//' -e 's/\.c$//' | \
	column

Could reveal something like the following:

acorn                                   ibm_iic                                 riic
ali1535                                 imx                                     rk3x
ali1563                                 iop3xx                                  robotfuzz-osif
ali15x3                                 isch                                    s3c2410
amd756                                  ismt                                    scmi
amd756-s4882                            kempld                                  sh7760
amd8111                                 mpc                                     sh_mobile
at91                                    mv64xxx                                 sibyte
au1550                                  mxs                                     simtec
bcm2835                                 nforce2                                 sirf
bcm-kona                                nforce2-s4985                           sis5595
bfin-twi                                nomadik                                 sis630
cadence                                 ocores                                  sis96x
cbus-gpio                               octeon                                  st
cpm                                     omap                                    stu300
cros-ec-tunnel                          parport                                 sun6i-p2wi
davinci                                 parport-light                           taos-evm
designware-core                         pasemi                                  tegra
designware-pcidrv                       pca-isa                                 tiny-usb
designware-platdrv                      pca-platform                            versatile
diolan-u2c                              piix4                                   via
efm32                                   pmcmsp                                  viapro
eg20t                                   pnx                                     viperboard
elektor                                 powermac                                wmt
exynos5                                 puv3                                    xiic
gpio                                    pxa                                     xlr
highlander                              pxa-pci                                 scx200_acb
hydra                                   qup
i801                                    rcar

Ditto USB

ls linux/drivers/i2c/busses/*.c | \
	grep -Eve 'mod\.c$' | \
	xargs grep -E "usb\.h" | \
	cut -f1 -d":" | \
	sed -Ee 's/^.*i2c-//' -e 's/\.c$//' | \
	column
diolan-u2c      robotfuzz-osif  tiny-usb        viperboard

HW-interfaces for the above:

This is a sidebar...

Clone this wiki locally