Skip to content

Commit

Permalink
Orange Pi 3B: Update board config to support v2.1 boards
Browse files Browse the repository at this point in the history
  • Loading branch information
dust-7 authored and igorpecovnik committed Sep 16, 2024
1 parent 2cf702a commit 9d4edae
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
23 changes: 13 additions & 10 deletions config/boards/orangepi3b.csc
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# Rockchip RK3566 quad core 4/8GB RAM SoC WIFI/BT eMMC USB2 USB3 NVMe PCIe GbE HDMI SPI
BOARD_NAME="orangepi3b"
BOARD_NAME="Orange Pi 3B"
BOARDFAMILY="rk35xx"
BOARD_MAINTAINER=""
BOOTCONFIG="orangepi-3b-rk3566_defconfig"
BOOT_SOC="rk3566"
KERNEL_TARGET="vendor,edge"
FULL_DESKTOP="yes"
BOOT_LOGO="desktop"
BOOT_FDT_FILE="rockchip/rk3566-orangepi-3b.dtb"
IMAGE_PARTITION_TABLE="gpt"
BOOT_SCENARIO="spl-blobs"
BOOT_SUPPORT_SPI="yes"
BOOT_SPI_RKSPI_LOADER="yes"
MODULES="sprdbt_tty sprdwl_ng"
MODULES_BLACKLIST_LEGACY="bcmdhd"

function post_family_config_branch_edge__orangepi3b_use_patched_dtb() {
# orangepi 3b dtbs are coming to mainline in v6.11
# until then, v1.1 boards can continue to use patched dtb
BOOT_FDT_FILE="rockchip/rk3566-orangepi-3b.dtb"
}

# Override family config for this board; let's avoid conditionals in family config.
function post_family_config__orangepi3b_use_mainline_uboot() {
display_alert "$BOARD" "mainline (Kwiboo's tree) u-boot overrides" "info"
display_alert "$BOARD" "mainline u-boot overrides" "info"

BOOTSOURCE='https://github.com/u-boot/u-boot'
BOOTBRANCH="tag:v2024.10-rc3"
Expand Down Expand Up @@ -45,22 +48,22 @@ function post_family_config__orangepi3b_use_mainline_uboot() {
fi
flashcp "${extra_opts_flashcp[@]}" "${1}/u-boot-rockchip-spi.bin" /dev/mtd0
}

}

function post_family_tweaks_bsp__orangepi3b() {
display_alert "$BOARD" "Installing sprd-bluetooth.service" "info"
display_alert "$BOARD" "Installing orangepi3b-sprd-bluetooth.service" "info"

# Bluetooth on orangepi3b board is handled by a Spreadtrum (sprd) chip and requires
# a custom hciattach_opi binary, plus a systemd service to run it at boot time
install -m 755 $SRC/packages/bsp/rk3399/hciattach_opi $destination/usr/bin
cp $SRC/packages/bsp/rk3399/sprd-bluetooth.service $destination/lib/systemd/system/
install -m 755 $SRC/packages/bsp/orangepi3b/orangepi3b-sprd-bluetooth $destination/usr/bin/
cp $SRC/packages/bsp/orangepi3b/orangepi3b-sprd-bluetooth.service $destination/lib/systemd/system/

return 0
}

function post_family_tweaks__orangepi3b_enable_services() {
display_alert "$BOARD" "Enabling sprd-bluetooth.service" "info"
chroot_sdcard systemctl enable sprd-bluetooth.service
display_alert "$BOARD" "Enabling orangepi3b-sprd-bluetooth.service" "info"
chroot_sdcard systemctl enable orangepi3b-sprd-bluetooth.service
return 0
}
14 changes: 14 additions & 0 deletions packages/bsp/orangepi3b/orangepi3b-sprd-bluetooth
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# only run this for boards with sprd bluetooth chip (i.e. v1.1 boards)
if [[ ! -d /proc/device-tree/sprd-mtty ]]; then
systemctl disable orangepi3b-sprd-bluetooth.service

exit 0
fi

modprobe -a sprdbt_tty sprdwl_ng
rfkill unblock all
/usr/bin/hciattach_opi -n -s 1500000 /dev/ttyBT0 sprd

exit 0
11 changes: 11 additions & 0 deletions packages/bsp/orangepi3b/orangepi3b-sprd-bluetooth.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Spreadtrum (sprd) bluetooth support for Orange Pi 3B v1.1
Before=bluetooth.service

[Service]
Type=simple
RemainAfterExit=Yes
ExecStart=/usr/bin/orangepi3b-sprd-bluetooth

[Install]
WantedBy=multi-user.target

0 comments on commit 9d4edae

Please sign in to comment.