Skip to content

Commit 4b4ddb5

Browse files
authored
sun60iw2: bring up AIC8800 UART Bluetooth on the Orange Pi A733 boards (#10149)
The AIC8800D80 combo's BT is UART HCI on ttyS1. Its firmware (loaded over SDIO by aic8800_bsp) idles the BT core in low-power until BT_WAKE is asserted, so a plain hciattach times out waiting for HCI_Reset. Assert the wake via the btlpm sysfs knob, then attach the generic H4 line discipline. Adds aic8800-bluetooth.service (stock bluez hciattach, no vendor blob), installed and enabled by the family for boards that set SUN60IW2_UART_BT (both Orange Pi A733 boards). Validated on the Zero 3W.
1 parent 876ba7c commit 4b4ddb5

4 files changed

Lines changed: 31 additions & 0 deletions

File tree

config/boards/orangepi4pro.csc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ SUNXI_BOOT0_SDCARD_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/boot0_sdcard_orange
1313
SUNXI_BOOT0_SPINOR_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/boot0_spinor_orangepi4pro.fex"
1414
SUNXI_SYS_CONFIG_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/sys_config_orangepi.fex"
1515

16+
# AIC8800D80 combo: BT is UART HCI on ttyS1 and needs userspace bring-up
17+
SUN60IW2_UART_BT="yes"
18+
1619
# Invalidate U-Boot cache if any of the blobs change
1720
UBOOT_HASH_EXTRA="$(cat "${SUNXI_BOOT0_SDCARD_FEX}" "${SUNXI_BOOT0_SPINOR_FEX}" "${SUNXI_SYS_CONFIG_FEX}" | sha256sum | cut -d' ' -f1)"
1821

config/boards/orangepizero3w.csc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ SUNXI_BOOT0_SDCARD_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/boot0_sdcard_orange
1313
SUNXI_BOOT0_SPINOR_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/boot0_sdcard_orangepizero3w.fex"
1414
SUNXI_SYS_CONFIG_FEX="${SRC}/packages/blobs/sunxi/sun60iw2/sys_config_orangepi.fex"
1515

16+
# AIC8800D80 combo: BT is UART HCI on ttyS1 and needs userspace bring-up
17+
SUN60IW2_UART_BT="yes"
18+
1619
# Invalidate U-Boot cache if any of the blobs change
1720
UBOOT_HASH_EXTRA="$(cat "${SUNXI_BOOT0_SDCARD_FEX}" "${SUNXI_SYS_CONFIG_FEX}" | sha256sum | cut -d' ' -f1)"

config/sources/families/sun60iw2.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ function post_family_tweaks__sun60iw2() {
163163
fi
164164

165165
chroot_sdcard_apt_get_install mtd-utils # MTD flash flash_erase/mtd_debug
166+
167+
# AIC8800D80 combo: BT is UART HCI on ttyS1 and needs userspace bring-up
168+
# (bluez + the wake/hciattach service installed by the family).
169+
if [[ "${SUN60IW2_UART_BT:-no}" == "yes" ]]; then
170+
chroot_sdcard_apt_get_install bluez rfkill
171+
run_host_command_logged install -m 644 "${SRC}/packages/bsp/sunxi/aic8800-bluetooth.service" "${SDCARD}/lib/systemd/system/aic8800-bluetooth.service"
172+
chroot_sdcard systemctl --no-reload enable aic8800-bluetooth.service
173+
fi
166174
}
167175

168176
# Add Orange Pi's proprietary kernel headers from bsp/ to the linux-headers package.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=AIC8800 Bluetooth (UART HCI on ttyS1)
3+
After=bluetooth.service
4+
Wants=bluetooth.service
5+
6+
[Service]
7+
# AIC8800D80 BT is UART HCI; the SDIO-loaded combo firmware idles the BT core in
8+
# low-power until BT_WAKE is asserted, so wake it before attaching the H4 ldisc.
9+
Type=simple
10+
ExecStartPre=/usr/sbin/rfkill unblock all
11+
ExecStartPre=/bin/sh -c 'for i in $(seq 1 10); do [ -e /proc/bluetooth/sleep/btwrite ] && break; sleep 1; done; echo 1 > /proc/bluetooth/sleep/btwrite'
12+
ExecStart=/usr/bin/hciattach -n -s 1500000 /dev/ttyS1 any 1500000 flow nosleep
13+
Restart=on-failure
14+
RestartSec=2
15+
16+
[Install]
17+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)