R-Car/DT-Overlays

= Renesas Device Tree Overlays =

To aid in using DT overlays, two branches are available in the repository at git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git:
 * topic/overlays: Basic DT overlay infrastructure,
 * topic/renesas-overlays: DT overlay sources to access various devices on expansion connectors on boards with Renesas SoCs.

Note: Both branches are rebased frequently.

Kernel Configuration
Make sure to enable the following options when configuring your kernel: CONFIG_OF_OVERLAY=y CONFIG_OF_CONFIGFS=y
 * Device Tree overlays
 * Device Tree Overlay ConfigFS interface

Build DT Overlays
DT Overlay binaries (*.dtbo) are created together with normal DT binaries (*.dtb) during: make dtbs

Install DT Overlays
Copy all *.dtbo for your platform to /lib/firmware/ on the target.

Mount ConfigFS
Make sure ConfigFS is mounted. On Debian, this is taken care of automatically by /etc/init.d/mountkernfs.sh.

If needed, you can mount it manually using: mount x /sys/kernel/config -t configfs

Load and Unload DT Overlays
overlay add hscif1 overlay rm hscif1
 * Please refer to Documentation/devicetree/configfs-overlays.txt
 * Or use the helper script below, e.g.

Note: As the script uses wildcards, do not pass non-unique dtbo filename parts.

Helper Script
Copy the following to e.g. /usr/local/sbin/overlay:
 * 1) !/bin/bash

set -e

OVERLAYS=/sys/kernel/config/device-tree/overlays FIRMWARE=/lib/firmware

function add {       if [ -e $OVERLAYS/$1 ]; then echo Overlay $1 already exists exit -1 fi

mkdir $OVERLAYS/$1 echo $(basename $FIRMWARE/*$1*) > $OVERLAYS/$i/path }

function remove {       rmdir $OVERLAYS/$1 }

cmd=add

for i in $*; do       case $i in        add)                cmd=add                ;;

rm)               cmd=remove                ;;

*)               $cmd $i                ;;        esac done