enndubyu / omap_i2c_slave

Slave support for i2c-omap linux driver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I2C Slave/Multimaster Driver for Linux on TI OMAP/Sitara

This patch adds multi-master and slave support to Linux's i2c-omap bus driver (for Texas Instruments' Sitara and OMAP SoCs), enabling full I2C support for the BeagleBone Black and many other SBCs/SoMs supported by this driver.

Contents

Requirements:

  • Kernel Version 4.13+
  • KConfig
    • CONFIG_I2C_SLAVE
    • CONFIG_ARCH_OMAP2PLUS 1

Building/Installing

Applying Patch Manually

First, obtain a copy of the kernel sources from Linus' github or your BSP:

Now you can simply clone this repo, apply the patch file from the root of the kernel source tree, add I2C_SLAVE to the .config, (re)build, and deploy the kernel as normal.

git clone git@github.com:enndubyu/omap_i2c_slave.git
cd linux

# Apply patch
git apply ../omap_i2c_slave/0001-i2c-omap-add-slave-support.patch

# Select I2C_SLAVE=y and any desired backend drivers (e.g. I2C_SLAVE_EEPROM=m)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- all

Yocto

You can extend the kernel recipe with a .bbappend that applies this patch and adds the required options to your .config. See the yocto manual for details.

Usage

Acting as a slave on an I2C bus requires slave support in the bus driver and a backend driver providing the actual functionality. This patch adds the former. For the backend driver, the kernel already includes a couple of existing drivers that might serve your needs, but most applications will require a custom driver. See the kernel documentation and the examples listed below for details on how to use the slave interface in a backend driver.

Slave drivers in mainline kernel

Footnotes

  1. Rev. 1 IP (used in first-generation devices such as OMAP1510 and OMAP310) is not supported by this patch.

About

Slave support for i2c-omap linux driver.

License:GNU General Public License v2.0