All of lore.kernel.org
 help / color / mirror / Atom feed
* [master/thud/ti2019.03 1/4] tiovx-sys-iface: add interface header files between TIOVX library and IPC implementation
@ 2019-09-23 19:21 Hongmei Gou
  2019-09-23 19:21 ` [master/thud/ti2019.03 2/4] tiovx-lib-host: add recipe for TI OpenVX library, host side Hongmei Gou
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hongmei Gou @ 2019-09-23 19:21 UTC (permalink / raw)
  To: meta-arago; +Cc: Hongmei Gou, d-senicic1, Djordje Senicic

* Use update-alternatives for the firmware
* Add reload-dsp-fw.sh to enable run-time firmware switch between opencl and tiovx

Signed-off-by: Djordje Senicic <x0157990@ti.com>
Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
Signed-off-by: Hongmei Gou <a0271529@ti.com>
---
 .../recipes-ti/tiovx/files/reload-dsp-fw.sh   | 66 +++++++++++++++++++
 .../recipes-ti/tiovx/tiovx-sys-iface.bb       | 49 ++++++++++++++
 .../recipes-ti/tiovx/tiovx-sys.inc            |  5 ++
 3 files changed, 120 insertions(+)
 create mode 100755 meta-arago-extras/recipes-ti/tiovx/files/reload-dsp-fw.sh
 create mode 100644 meta-arago-extras/recipes-ti/tiovx/tiovx-sys-iface.bb
 create mode 100644 meta-arago-extras/recipes-ti/tiovx/tiovx-sys.inc

diff --git a/meta-arago-extras/recipes-ti/tiovx/files/reload-dsp-fw.sh b/meta-arago-extras/recipes-ti/tiovx/files/reload-dsp-fw.sh
new file mode 100755
index 00000000..198fd60f
--- /dev/null
+++ b/meta-arago-extras/recipes-ti/tiovx/files/reload-dsp-fw.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+usage() {
+    cat << EOF
+
+  Usage:
+         $0 <fw-type: opencl, tiovx>
+
+EOF
+}
+
+if [ "$1" ]; then
+case "$1" in
+    opencl) echo "Reload opencl firmware to DSP"
+        ;;
+    tiovx) echo "Reload tiovx firmware to DSP"
+        ;;
+    *) echo "Wrong argument $1"
+       usage
+       exit
+        ;;
+esac
+else
+       usage
+       exit
+fi
+
+fw="${1}"
+
+if [[ ${fw} == opencl ]]; then
+    #Start OpenCL CMEM memory allocation daemon
+    if pgrep -x "ti-mctd" > /dev/null
+    then
+        echo "ti-mctd is running"
+    else
+        echo "Starting ti-mctd..."
+        ti-mctd
+    fi
+    # Link opencl monitor firmware for DSPs
+    ln -s -f /lib/firmware/dra7-dsp1-fw.xe66.opencl-monitor /lib/firmware/dra7-dsp1-fw.xe66
+    ln -s -f /lib/firmware/dra7-dsp2-fw.xe66.opencl-monitor /lib/firmware/dra7-dsp2-fw.xe66
+fi
+
+if [[ ${fw} == tiovx ]]; then
+    # Kill CMEM multi-process daemon. This releases all CMEM memory used by OpenCL memory allocation
+    pkill ti-mctd
+
+    # Link tiovx firmware for DSPs
+    ln -s -f /lib/firmware/dra7-dsp1-fw.xe66.openvx /lib/firmware/dra7-dsp1-fw.xe66
+    ln -s -f /lib/firmware/dra7-dsp2-fw.xe66.openvx /lib/firmware/dra7-dsp2-fw.xe66
+fi
+
+cd /sys/bus/platform/drivers/omap-rproc/
+
+# release DSPs
+echo "Releasing DSPs..."
+echo 40800000.dsp > unbind
+
+echo 41000000.dsp > unbind
+
+# reload firmware for DSPs
+echo "Reloading firmware for DSPs..."
+echo 40800000.dsp > bind
+
+echo 41000000.dsp > bind
+
+cd ~-
diff --git a/meta-arago-extras/recipes-ti/tiovx/tiovx-sys-iface.bb b/meta-arago-extras/recipes-ti/tiovx/tiovx-sys-iface.bb
new file mode 100644
index 00000000..84d2934b
--- /dev/null
+++ b/meta-arago-extras/recipes-ti/tiovx/tiovx-sys-iface.bb
@@ -0,0 +1,49 @@
+SUMMARY = "TI OpenVX interface header files between TIOVX library and HOST, DSP IPC side implementation "
+DESCRIPTION = "Collection of header files needed to defined interface between TIOVX library and HOST and DSP IPC side implementation. In order to maintain source compatibility, directory structure follows VSDK source tree layout."
+
+LICENSE = "TI-TSPA"
+LIC_FILES_CHKSUM = "file://iface/VSDK/docs/TIOVX-SYS-IFACE_1.0.0.0_manifest.html;md5=10904cbdb4f065c025a63ca71ae7de2d"
+
+require recipes-ti/includes/tisdk-paths.inc
+require tiovx-sys.inc
+
+PR = "r1"
+
+COMPATIBLE_MACHINE = "dra7xx"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+inherit update-alternatives
+
+SRC_URI_append += "\
+     file://reload-dsp-fw.sh \
+"
+
+S = "${WORKDIR}/git"
+
+do_install () {
+#   Install the header files
+    CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
+    install -d ${D}${TIOVX_INSTALL_DIR_RECIPE}/sys-iface
+    cp ${CP_ARGS} ${S}/iface/VSDK/* ${D}${TIOVX_INSTALL_DIR_RECIPE}/sys-iface
+#   Install the firmware
+    install -d ${D}/${base_libdir}/firmware
+    install -m 0644 ${S}/firmware/tiovx_dsp1.xe66 ${D}/${base_libdir}/firmware/dra7-dsp1-fw.xe66.openvx
+    install -m 0644 ${S}/firmware/tiovx_dsp2.xe66 ${D}/${base_libdir}/firmware/dra7-dsp2-fw.xe66.openvx
+#   Install the scripts for loading dsp firmware
+    install -d ${D}${bindir}/
+    install -m 0755 ${WORKDIR}/reload-dsp-fw.sh ${D}${bindir}
+}
+
+ALTERNATIVE_${PN} = "dra7-dsp1-fw.xe66 dra7-dsp2-fw.xe66"
+ALTERNATIVE_LINK_NAME[dra7-dsp1-fw.xe66] = "${base_libdir}/firmware/dra7-dsp1-fw.xe66"
+ALTERNATIVE_TARGET[dra7-dsp1-fw.xe66] = "${base_libdir}/firmware/dra7-dsp1-fw.xe66.openvx"
+ALTERNATIVE_LINK_NAME[dra7-dsp2-fw.xe66] = "${base_libdir}/firmware/dra7-dsp2-fw.xe66"
+ALTERNATIVE_TARGET[dra7-dsp2-fw.xe66] = "${base_libdir}/firmware/dra7-dsp2-fw.xe66.openvx"
+ALTERNATIVE_PRIORITY = "20"
+
+FILES_${PN} += "${TIOVX_INSTALL_DIR_RECIPE}/sys-iface/* "
+PACKAGES =+ "${PN}-firmware"
+FILES_${PN}-firmware = "${base_libdir}/firmware/*"
+
+INSANE_SKIP_${PN}-firmware = "arch"
+
diff --git a/meta-arago-extras/recipes-ti/tiovx/tiovx-sys.inc b/meta-arago-extras/recipes-ti/tiovx/tiovx-sys.inc
new file mode 100644
index 00000000..becf0cc1
--- /dev/null
+++ b/meta-arago-extras/recipes-ti/tiovx/tiovx-sys.inc
@@ -0,0 +1,5 @@
+PV = "01.00.01.00"
+
+BRANCH="master"
+SRCREV = "5be60aee8d013907a4d8a6cc8af35a517a33b49e"
+SRC_URI = "git://git.ti.com/processor-sdk/tiovx-app.git;protocol=git;branch=${BRANCH}"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-07 22:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 19:21 [master/thud/ti2019.03 1/4] tiovx-sys-iface: add interface header files between TIOVX library and IPC implementation Hongmei Gou
2019-09-23 19:21 ` [master/thud/ti2019.03 2/4] tiovx-lib-host: add recipe for TI OpenVX library, host side Hongmei Gou
2019-10-01 20:03   ` Denys Dmytriyenko
2019-10-07 20:19     ` Denys Dmytriyenko
2019-10-07 22:34       ` Gou, Hongmei
2019-09-23 19:21 ` [master/thud/ti2019.03 3/4] tiovx-app-host: TI OpenVX IPC HOST implementation and sample applications Hongmei Gou
2019-09-23 19:21 ` [master/thud/ti2019.03 4/4] ti-tisdk-makefile: include source for tiovx-app-host and add it to the top-level makefile Hongmei Gou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.