From 6f394479cef723549ae3adf6c670196baf95f4e5 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Fri, 25 May 2018 14:44:13 +0100 Subject: [PATCH] db410c: Add spidev enablement script Currently there is no script to enable spidev. Add one (tested on 18.01). Signed-off-by: Daniel Thompson --- scripts/db410c/enable-spidev.sh | 19 ++++++++++++++ scripts/db410c/overlays/db410c-spidev.dtbo | Bin 0 -> 409 bytes scripts/db410c/overlays/db410c-spidev.dts | 29 +++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100755 scripts/db410c/enable-spidev.sh create mode 100644 scripts/db410c/overlays/db410c-spidev.dtbo create mode 100644 scripts/db410c/overlays/db410c-spidev.dts diff --git a/scripts/db410c/enable-spidev.sh b/scripts/db410c/enable-spidev.sh new file mode 100755 index 0000000..9a77499 --- /dev/null +++ b/scripts/db410c/enable-spidev.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +BOOTIMG=${1:-/dev/disk/by-partlabel/boot} +DT_ROOT=`dirname $0`/../.. +DBOOTIMG=`which dbootimg` +DBOOTIMG=${DBOOTIMG:-${DT_ROOT}/tools/dbootimg/dbootimg} +DTBTOOL=`which dtbtool` +DTBTOOL=${DTBTOOL:-${DT_ROOT}/tools/dtbtool/dtbtool} +OVERLAY=`dirname $0`/overlays/db410c-spidev.dtbo + +${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -m ${OVERLAY} | ${DBOOTIMG} ${BOOTIMG} -u dtb + +if [ "$?" -ne 0 ]; then + echo "Failed to update DTB" + exit 1 +fi + +echo "spidev enabled, please reboot" +sync diff --git a/scripts/db410c/overlays/db410c-spidev.dtbo b/scripts/db410c/overlays/db410c-spidev.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..aeb035a5c862e6fe6eb2bd7920058340b4b9fbde GIT binary patch literal 409 zcmcb>`|m9S1LI5v1_lctodcvbfLIWS1%Ma?bb;a~5GD%A2<0&YXaMxb0uY8g}q z0|Q78J4gZ|4q}1DSb(%R1N%Y+B)%q)4FXI^7~uv(upF`*AR@GP1IRs`z~CuJEXhpD mNo6QWEJ{x;(FJldK;F{LO{~yOD@rXaP0dTLWGG5aX8-_SFFH>E literal 0 HcmV?d00001 diff --git a/scripts/db410c/overlays/db410c-spidev.dts b/scripts/db410c/overlays/db410c-spidev.dts new file mode 100644 index 0000000..b59836d --- /dev/null +++ b/scripts/db410c/overlays/db410c-spidev.dts @@ -0,0 +1,29 @@ +/dts-v1/; +/plugin/; +/ { + compatible = "qcom,msm8916"; + + /* On Low speed expansion header */ + fragment@0 { + target-path = "spi0"; + __overlay__ { + spidev@0 { + compatible = "spidev"; + spi-max-frequency = <500000>; + reg = <0>; + }; + }; + }; + + /* On High speed expansion header */ + fragment@1 { + target-path = "spi1"; + __overlay__ { + spidev@0 { + compatible = "spidev"; + spi-max-frequency = <500000>; + reg = <0>; + }; + }; + }; +};