diff --git a/balena-yocto-scripts b/balena-yocto-scripts index 84c60eb..dcb55b4 160000 --- a/balena-yocto-scripts +++ b/balena-yocto-scripts @@ -1 +1 @@ -Subproject commit 84c60eba818d4276d449692a3084f2c20e0eaae8 +Subproject commit dcb55b47395af9e2aaa6d6aed0843d31262b107a diff --git a/layers/meta-resin b/layers/meta-resin index aa87658..64859b0 160000 --- a/layers/meta-resin +++ b/layers/meta-resin @@ -1 +1 @@ -Subproject commit aa876586512dfca97fcf2e5d5ef536e9fbc41fa1 +Subproject commit 64859b0669d525b046367afe5e32bccb3dcbf0b1 diff --git a/layers/meta-resin-allwinner/recipes-bsp/brcm-patchram-plus/brcm-patchram-plus.bb b/layers/meta-resin-allwinner/recipes-bsp/brcm-patchram-plus/brcm-patchram-plus.bb new file mode 100644 index 0000000..3a03f2a --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/brcm-patchram-plus/brcm-patchram-plus.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Broadcom Bluetooth patch utility" +SECTION = "connectivity" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRCREV = "6e6506eb74c918e761f9ba08a6c71897334747c1" +SRC_URI = " git://android.googlesource.com/platform/system/bluetooth.git;protocol=https" + +S = "${WORKDIR}/git/brcm_patchram_plus" + +do_compile() { + ${CC} ${LDFLAGS} brcm_patchram_plus.c -o brcm_patchram_plus +} + +do_install() { + mkdir -p ${D}/${bindir}/ + install -m 0755 ${S}/brcm_patchram_plus ${D}/${bindir} +} + +FILES_${PN}-dbg += "${sysconfdir}/bluetooth/.debug" +FILES_${PN} += "${bindir}/brcm_patchram_plus" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + diff --git a/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt.bb b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt.bb new file mode 100644 index 0000000..b86c516 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt.bb @@ -0,0 +1,32 @@ +SUMMARY = "Enable bluetooth on Nanopi Neo Air boards" + +LICENSE="Apache-2.0" +LIC_FILES_CHKSUM = "file://${RESIN_COREBASE}/COPYING.Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +DESCRIPTION = "Package contains udev rule, systemd service and a script to init the Ampak 6212A \ +bluetooth chip for the Nanopi Neo Air board" + +S = "${WORKDIR}" + +SRC_URI = "file://99-nanopi-air-bt.rules \ + file://nanopi-air-bt@.service \ + file://nanopi-air-bt-start \ +" + +do_install() { + mkdir -p ${D}/usr/bin + mkdir -p ${D}/lib/udev/rules.d + install -m 0644 99-nanopi-air-bt.rules ${D}/lib/udev/rules.d + install -m 0744 nanopi-air-bt-start ${D}/usr/bin + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/nanopi-air-bt@.service ${D}${systemd_unitdir}/system + fi +} + +FILES_${PN} = " \ + /lib/udev/rules.d/99-nanopi-air-bt.rules \ + /lib/systemd/system/nanopi-air-bt@.service \ + /usr/bin/nanopi-air-bt-start \ +" diff --git a/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/99-nanopi-air-bt.rules b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/99-nanopi-air-bt.rules new file mode 100644 index 0000000..61d7e6b --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/99-nanopi-air-bt.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="tty", ATTR{iomem_base}=="0x1C28C00", TAG+="systemd", ENV{SYSTEMD_WANTS}="nanopi-air-bt@'%E{DEVNAME}'.service" diff --git a/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt-start b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt-start new file mode 100755 index 0000000..d1b2b5f --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt-start @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "Interface argument missing ... /dev/ttyX" + exit 1 +fi + +echo 205 > /sys/class/gpio/export +echo out > /sys/class/gpio/gpio205/direction + +# Reset BT +echo "Resetting BT chip" +echo 0 > /sys/class/gpio/gpio205/value +echo 1 > /sys/class/gpio/gpio205/value + +/usr/bin/brcm_patchram_plus -d --patchram /lib/firmware/brcm/bcm43438a1.hcd --no2bytes --tosleep 5000 $1 > /tmp/brcm_log 2>&1 +hciattach -n $1 bcm43xx 115200 flow diff --git a/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt@.service b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt@.service new file mode 100644 index 0000000..40f7b29 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/nanopi-air-bt/nanopi-air-bt/nanopi-air-bt@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Ampak AP6212A Bluetooth HCI on Nanopi Neo Air + +[Service] +Type=simple +ExecStart=/bin/bash /usr/bin/nanopi-air-bt-start %I + +[Install] +WantedBy=multi-user.target diff --git a/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin.bbappend b/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin.bbappend new file mode 100644 index 0000000..35f8f2c --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin.bbappend @@ -0,0 +1,3 @@ +RDEPENDS_${PN}_append_nanopi-neo-air = " brcm-patchram-plus \ + nanopi-air-bt \ +" diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a0.hcd b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a0.hcd new file mode 100644 index 0000000..1fc806e Binary files /dev/null and b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a0.hcd differ diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a1.hcd b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a1.hcd new file mode 100644 index 0000000..c4a4b55 Binary files /dev/null and b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/bcm43438a1.hcd differ diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend index f38511b..e205995 100644 --- a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend +++ b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -10,6 +10,8 @@ SRC_URI_append = " \ file://config.txt \ file://brcmfmac43362-sdio.txt \ file://brcmfmac43430-sdio.txt \ + file://bcm43438a0.hcd \ + file://bcm43438a1.hcd \ " do_install_append() { @@ -26,6 +28,8 @@ do_install_append() { do_install_append_nanopi-neo-air() { mkdir -p ${D}/${nonarch_base_libdir}/firmware/brcm install -m 0644 ${WORKDIR}/brcmfmac43430-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm + install -m 0644 ${WORKDIR}/bcm43438a0.hcd ${D}${nonarch_base_libdir}/firmware/brcm + install -m 0644 ${WORKDIR}/bcm43438a1.hcd ${D}${nonarch_base_libdir}/firmware/brcm } PACKAGES =+ "${PN}-ap6212 ${PN}-brcm43362" @@ -37,6 +41,8 @@ FILES_${PN}-ap6212 = " \ /lib/firmware/brcm/brcmfmac43430a0-sdio.bin \ /lib/firmware/brcm/brcmfmac43430a0-sdio.txt \ /lib/firmware/brcm/config.txt \ + /lib/firmware/brcm/bcm43438a0.hcd \ + /lib/firmware/brcm/bcm43438a1.hcd \ " FILES_${PN}-brcm43362 = " \ diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline/0001-Enable-uart3-for-NanoPi-Neo-Air-used-by-BT.patch b/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline/0001-Enable-uart3-for-NanoPi-Neo-Air-used-by-BT.patch new file mode 100644 index 0000000..b39d5a1 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline/0001-Enable-uart3-for-NanoPi-Neo-Air-used-by-BT.patch @@ -0,0 +1,31 @@ +From b093d275ba1bec4d8ee91f18609ef0266fa5cbbb Mon Sep 17 00:00:00 2001 +From: Sebastian Panceac +Date: Wed, 27 Feb 2019 10:13:31 +0100 +Subject: [PATCH] Enable uart3 for NanoPi Neo Air used by BT + +Upstream-status: Pending +Signed-off-by: Sebastian Panceac +--- + arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts +index a9331fe67..99e34f0a1 100644 +--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts ++++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts +@@ -124,6 +124,12 @@ + status = "okay"; + }; + ++&uart3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart3_pins>, <&uart3_rts_cts_pins>; ++ status = "okay"; ++}; ++ + &usbphy { + /* USB VBUS is always on */ + status = "okay"; +-- +2.17.1 + diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline_%.bbappend b/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline_%.bbappend index b897662..2e47bb5 100644 --- a/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline_%.bbappend +++ b/layers/meta-resin-allwinner/recipes-kernel/linux/linux-mainline_%.bbappend @@ -1,5 +1,10 @@ inherit kernel-resin +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-mainline:" + +SRC_URI_append = " file://0001-Enable-uart3-for-NanoPi-Neo-Air-used-by-BT.patch \ +" + do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot" do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot" do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"