From 18e8f438ded6606a149d6caaa75567e0602eb950 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Fri, 18 Jul 2014 22:17:40 +0200 Subject: gpio-export: add recipe for userspace export of gpios --- recipes-bsp/gpio-export/files/COPYING | 5 +++ .../gpio-export/files/apalis-imx6/gpio-export.sh | 44 ++++++++++++++++++++++ recipes-bsp/gpio-export/files/gpio-export.service | 12 ++++++ recipes-bsp/gpio-export/files/gpio-export.sh | 4 ++ recipes-bsp/gpio-export/gpio-export_1.0.bb | 30 +++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 recipes-bsp/gpio-export/files/COPYING create mode 100644 recipes-bsp/gpio-export/files/apalis-imx6/gpio-export.sh create mode 100644 recipes-bsp/gpio-export/files/gpio-export.service create mode 100644 recipes-bsp/gpio-export/files/gpio-export.sh create mode 100644 recipes-bsp/gpio-export/gpio-export_1.0.bb diff --git a/recipes-bsp/gpio-export/files/COPYING b/recipes-bsp/gpio-export/files/COPYING new file mode 100644 index 0000000..040e990 --- /dev/null +++ b/recipes-bsp/gpio-export/files/COPYING @@ -0,0 +1,5 @@ +This piece is software is provided by Toradex AG as sample code. +There is no warranty for the program. +Toradex AG put this program in public domain, uncopyrighted. + +Renens, Swizterland, 2008-10-23 diff --git a/recipes-bsp/gpio-export/files/apalis-imx6/gpio-export.sh b/recipes-bsp/gpio-export/files/apalis-imx6/gpio-export.sh new file mode 100644 index 0000000..bdfdcab --- /dev/null +++ b/recipes-bsp/gpio-export/files/apalis-imx6/gpio-export.sh @@ -0,0 +1,44 @@ +#!/bin/sh +#export gpios to userspace + +case "$1" in + start) + CTRL=/sys/class/gpio/export + ;; + + stop) + CTRL=/sys/class/gpio/unexport + ;; +esac + +#Apalis GPIO - i.MX6 Ball name - GPIO# + +#GPIO1 NAND_DATA04 36 +echo 36 > $CTRL +#cat /sys/class/gpio/gpio36/value +#echo low > /sys/class/gpio/gpio36/direction +#echo 1 > /sys/class/gpio/gpio36/value + +#GPIO2 NAND_DATA05 37 +echo 37 > $CTRL + +#GPIO3 NAND_DATA06 38 +echo 38 > $CTRL + +#GPIO4 NAND_DATA07 39 +echo 39 > $CTRL + +#GPIO5 NAND_READY 170 +#used by optional fusion_F0710A kernel module +#echo 170 > $CTRL + +#GPIO6 NAND_WP_B 169 +#used by optional fusion_F0710A kernel module +#echo 169 > $CTRL + +#GPIO7 GPIO02 2 +#used by PCIe for reset of switch on the Apalis Evaluation Board +#echo 2 > $CTRL + +#GPIO8 GPIO06 6 +echo 6 > $CTRL diff --git a/recipes-bsp/gpio-export/files/gpio-export.service b/recipes-bsp/gpio-export/files/gpio-export.service new file mode 100644 index 0000000..2dccc29 --- /dev/null +++ b/recipes-bsp/gpio-export/files/gpio-export.service @@ -0,0 +1,12 @@ +[Unit] +Description=Export GPIOs to user space +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/export-gpio.sh start +ExecStop=/usr/bin/export-gpio.sh stop + +[Install] +WantedBy=basic.target diff --git a/recipes-bsp/gpio-export/files/gpio-export.sh b/recipes-bsp/gpio-export/files/gpio-export.sh new file mode 100644 index 0000000..6a477c6 --- /dev/null +++ b/recipes-bsp/gpio-export/files/gpio-export.sh @@ -0,0 +1,4 @@ +#!/bin/sh +#empty placeholder for machines not using that feature + +: diff --git a/recipes-bsp/gpio-export/gpio-export_1.0.bb b/recipes-bsp/gpio-export/gpio-export_1.0.bb new file mode 100644 index 0000000..02d0fd7 --- /dev/null +++ b/recipes-bsp/gpio-export/gpio-export_1.0.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "Scripts and systemd service file to export unused GPIO to Userspace" +LICENSE = "Public Domain" +PR = "r2" + +inherit systemd + +SRC_URI = " \ + file://gpio-export.sh \ + file://gpio-export.service \ + file://COPYING \ +" + +LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYING;md5=1c3a7fb45253c11c74434676d84fe7dd" + +do_compile () { +} + +do_install () { + install -d ${D}/${bindir} + install -m 0755 ${WORKDIR}/*.sh ${D}/${bindir} + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/gpio-export.service ${D}${systemd_unitdir}/system +} + +NATIVE_SYSTEMD_SUPPORT = "1" +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "gpio-export.service" + +PACKAGE_ARCH = "${MACHINE_ARCH}" \ No newline at end of file -- cgit v1.2.3