Skip to content

Commit

Permalink
db410c: Add spidev enablement script
Browse files Browse the repository at this point in the history
Currently there is no script to enable spidev. Add one (tested
on 18.01).

Signed-off-by: Daniel Thompson <[email protected]>
  • Loading branch information
daniel-thompson authored and loicpoulain committed May 25, 2018
1 parent 4275ca3 commit 6f39447
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/db410c/enable-spidev.sh
Original file line number Diff line number Diff line change
@@ -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
Binary file added scripts/db410c/overlays/db410c-spidev.dtbo
Binary file not shown.
29 changes: 29 additions & 0 deletions scripts/db410c/overlays/db410c-spidev.dts
Original file line number Diff line number Diff line change
@@ -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>;
};
};
};
};

0 comments on commit 6f39447

Please sign in to comment.