With newer kernels (>=3.18) that supports device-trees I2C
should be enabled with device-trees.

This is now support by adding:
ENABLE_I2C = "1"
in local.conf

This will enable the dtparams:
i2c1
i2c_arm

Signed-off-by: Petter Mabäcker <pet...@technux.se>
---
 README                                  | 21 +++++++++++++--------
 recipes-bsp/bootfiles/rpi-config_git.bb |  6 ++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/README b/README
index a168692..8ef4e7a 100644
--- a/README
+++ b/README
@@ -21,10 +21,11 @@ Contents:
     2.G. Optional - Enable offline compositing support
     2.H. Optional - Enable kgdb over console support
     2.I. Optional - Enable SPI bus
-    2.J. Images
-    2.K. Boot to U-Boot
-    2.L. Image with Initramfs
-    2.M. Device tree support
+    2.J. Optional - Enable I2C
+    2.K. Images
+    2.L. Boot to U-Boot
+    2.M. Image with Initramfs
+    2.N. Device tree support
 3. Extra apps
     3.A. omxplayer
 4. Source code and mirrors
@@ -151,8 +152,12 @@ ENABLE_KGDB = "1"
 When using device tree kernels, set this variable to enable the SPI bus
 ENABLE_SPI_BUS = "1"
 
+2.J. Optional - Enable I2C
+==========================
+When using device tree kernels, set this variable to enable I2C
+ENABLE_I2C = "1"
 
-2.J. Images
+2.K. Images
 ===========
 * rpi-hwup-image
     Hardware up image
@@ -162,7 +167,7 @@ ENABLE_SPI_BUS = "1"
     Image based on rpi-basic-image which includes most of the packages in this
     layer and some media samples.
 
-2.K. Boot to U-Boot
+2.L. Boot to U-Boot
 ===================
 To have u-boot load kernel image, set in your local.conf
 KERNEL_IMAGETYPE = "uImage"
@@ -170,7 +175,7 @@ KERNEL_IMAGETYPE = "uImage"
 This will make kernel.img be u-boot image which will load uImage.
 By default, kernel.img is the actual kernel image (ex. Image).
 
-2.L. Image with Initramfs
+2.M. Image with Initramfs
 =========================
 To build an initramfs image :
     * Set this 3 kernel variables (in linux-raspberrypi.inc for example)
@@ -183,7 +188,7 @@ To build an initramfs image :
     * Set the meta-rasberrypi variable (in raspberrypi.conf for example)
         - KERNEL_INITRAMFS = "-initramfs"
 
-2.M. Device tree support
+2.N. Device tree support
 =========================
 Device tree for RPi is only supported when using linux-raspberrypi 3.18+
 kernels.
diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb 
b/recipes-bsp/bootfiles/rpi-config_git.bb
index aa11b25..ccb9b7f 100644
--- a/recipes-bsp/bootfiles/rpi-config_git.bb
+++ b/recipes-bsp/bootfiles/rpi-config_git.bb
@@ -72,6 +72,12 @@ do_deploy() {
         echo "# Enable SPI bus" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "dtparam=spi=on" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
+
+    if [ -n "${ENABLE_I2C}" ]; then
+        echo "# Enable I2C" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        echo "dtparam=i2c1=on" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        echo "dtparam=i2c_arm=on" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
 }
 
 addtask deploy before do_package after do_install
-- 
1.9.1

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to