diff options
author | toolmmy <toolmmy@gmail.com> | 2016-04-09 13:53:24 +0200 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.ro> | 2016-04-22 16:41:33 +0200 |
commit | 1317a894faa671c82193c1f18074d84db2cb9e35 (patch) | |
tree | c56be431a3a91bb22da8bbff49c6fe5c39767c1c /recipes-connectivity | |
parent | 6cdb2becac99311cb7375b08876d2370e033daee (diff) | |
download | meta-raspberrypi-1317a894faa671c82193c1f18074d84db2cb9e35.tar.gz |
bluez5: Add bluez5 support for brcm43438 on raspberrypi3.
This patch adds the bluetooth support for the brcm43438 module on the raspberrypi3 by
deploying the modules firmware and changing the targeting firmware path. In addition
the brcm43438.service adds the automatically attaching (hciattach) for systemd environments.
The following steps can be used to manually configure the brcm43438:
root@raspberrypi3:~# hciattach /dev/ttyAMA0 bcm43xx-3wire
bcm43xx_init
Flash firmware /lib/firmware/brcm/BCM43430A1.hcd
Set Controller UART speed to 3000000 bit/s
Device setup complete
root@raspberrypi3:~# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: B8:27:EB:6C:85:BE ACL MTU: 1021:8 SCO MTU: 64:1
DOWN
RX bytes:983 acl:0 sco:0 events:33 errors:0
TX bytes:887 acl:0 sco:0 commands:33 errors:0
root@raspberrypi3:~# /usr/lib/bluez5/bluetooth/bluetoothd -e -n -E
root@raspberrypi3:~# bluetoothctl
[NEW] Controller B8:27:EB:6C:85:BE raspberrypi3 [default]
[bluetooth]# power on
[CHG] Controller B8:27:EB:6C:85:BE Class: 0x400000
Changing power on succeeded
[CHG] Controller B8:27:EB:6C:85:BE Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:6C:85:BE Discovering: yes
[NEW] Device 00:1C:05:FF:F9:F8 Nonin3230_501585326
NOTE: SERIAL_CONSOLE must configured to ttyS0 instead of ttyAMA0 (used by the brcm43438). See pending patch from Martin Bergek
Signed-off-by: Tom Doehring <toolmmy@gmail.com>
Diffstat (limited to 'recipes-connectivity')
7 files changed, 151 insertions, 0 deletions
diff --git a/recipes-connectivity/bluez5/bluez5/0001-bcm43xx-Add-bcm43xx-3wire-variant.patch b/recipes-connectivity/bluez5/bluez5/0001-bcm43xx-Add-bcm43xx-3wire-variant.patch new file mode 100644 index 0000000..3bc02c4 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0001-bcm43xx-Add-bcm43xx-3wire-variant.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From b4f2b77472aeb967d3a7595e8a965785c7a37c87 Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Elwell <phil@raspberrypi.org> | ||
3 | Date: Tue, 16 Feb 2016 16:40:46 +0000 | ||
4 | Subject: [PATCH 1/4] bcm43xx: Add bcm43xx-3wire variant | ||
5 | |||
6 | --- | ||
7 | tools/hciattach.c | 3 +++ | ||
8 | 1 file changed, 3 insertions(+) | ||
9 | |||
10 | diff --git a/tools/hciattach.c b/tools/hciattach.c | ||
11 | index 59a76a7..5861d33 100644 | ||
12 | --- a/tools/hciattach.c | ||
13 | +++ b/tools/hciattach.c | ||
14 | @@ -1144,6 +1144,9 @@ struct uart_t uart[] = { | ||
15 | { "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000, | ||
16 | FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL }, | ||
17 | |||
18 | + { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000, | ||
19 | + 0, DISABLE_PM, NULL, bcm43xx, NULL }, | ||
20 | + | ||
21 | { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, | ||
22 | FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, | ||
23 | |||
24 | -- | ||
25 | 1.9.1 | ||
26 | |||
diff --git a/recipes-connectivity/bluez5/bluez5/0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch b/recipes-connectivity/bluez5/bluez5/0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch new file mode 100644 index 0000000..5a0a434 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From e145c9621f976063e5c573db1f2053d906f63427 Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Elwell <phil@raspberrypi.org> | ||
3 | Date: Tue, 16 Feb 2016 16:39:09 +0000 | ||
4 | Subject: [PATCH 2/4] bcm43xx: The UART speed must be reset after the firmware download | ||
5 | |||
6 | --- | ||
7 | tools/hciattach_bcm43xx.c | 6 ++---- | ||
8 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
9 | |||
10 | diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c | ||
11 | index 81f38cb..0b792e0 100644 | ||
12 | --- a/tools/hciattach_bcm43xx.c | ||
13 | +++ b/tools/hciattach_bcm43xx.c | ||
14 | @@ -366,11 +366,8 @@ int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, | ||
15 | return -1; | ||
16 | |||
17 | if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { | ||
18 | - fprintf(stderr, "Patch not found, continue anyway\n"); | ||
19 | + fprintf(stderr, "Patch not found for %s, continue anyway\n", chip_name); | ||
20 | } else { | ||
21 | - if (bcm43xx_set_speed(fd, ti, speed)) | ||
22 | - return -1; | ||
23 | - | ||
24 | if (bcm43xx_load_firmware(fd, fw_path)) | ||
25 | return -1; | ||
26 | |||
27 | @@ -380,6 +377,7 @@ int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, | ||
28 | return -1; | ||
29 | } | ||
30 | |||
31 | + sleep(1); | ||
32 | if (bcm43xx_reset(fd)) | ||
33 | return -1; | ||
34 | } | ||
35 | -- | ||
36 | 1.9.1 | ||
37 | |||
diff --git a/recipes-connectivity/bluez5/bluez5/0003-Increase-firmware-load-timeout-to-30s.patch b/recipes-connectivity/bluez5/bluez5/0003-Increase-firmware-load-timeout-to-30s.patch new file mode 100644 index 0000000..f9f09eb --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0003-Increase-firmware-load-timeout-to-30s.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | From d41dc2046dd08d8c95197f677e224506f5b39bdd Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Elwell <phil@raspberrypi.org> | ||
3 | Date: Wed, 20 Jan 2016 16:00:37 +0000 | ||
4 | Subject: [PATCH 3/4] Increase firmware load timeout to 30s | ||
5 | |||
6 | --- | ||
7 | tools/hciattach.c | 2 +- | ||
8 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/tools/hciattach.c b/tools/hciattach.c | ||
11 | index 5861d33..4141796 100644 | ||
12 | --- a/tools/hciattach.c | ||
13 | +++ b/tools/hciattach.c | ||
14 | @@ -1293,7 +1293,7 @@ int main(int argc, char *argv[]) | ||
15 | { | ||
16 | struct uart_t *u = NULL; | ||
17 | int detach, printpid, raw, opt, i, n, ld, err; | ||
18 | - int to = 10; | ||
19 | + int to = 30; | ||
20 | int init_speed = 0; | ||
21 | int send_break = 0; | ||
22 | pid_t pid; | ||
23 | -- | ||
24 | 1.9.1 | ||
25 | |||
diff --git a/recipes-connectivity/bluez5/bluez5/0004-Move-the-43xx-firmware-into-lib-firmware.patch b/recipes-connectivity/bluez5/bluez5/0004-Move-the-43xx-firmware-into-lib-firmware.patch new file mode 100644 index 0000000..dadce35 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/0004-Move-the-43xx-firmware-into-lib-firmware.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | From 76681284b0ea49852041fdb97a35175089a08781 Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Elwell <phil@raspberrypi.org> | ||
3 | Date: Tue, 23 Feb 2016 17:52:29 +0000 | ||
4 | Subject: [PATCH 4/4] Move the 43xx firmware into /lib/firmware | ||
5 | |||
6 | --- | ||
7 | tools/hciattach_bcm43xx.c | 2 +- | ||
8 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c | ||
11 | index 0b792e0..207f668 100644 | ||
12 | --- a/tools/hciattach_bcm43xx.c | ||
13 | +++ b/tools/hciattach_bcm43xx.c | ||
14 | @@ -43,7 +43,7 @@ | ||
15 | #include "hciattach.h" | ||
16 | |||
17 | #ifndef FIRMWARE_DIR | ||
18 | -#define FIRMWARE_DIR "/etc/firmware" | ||
19 | +#define FIRMWARE_DIR "/lib/firmware" | ||
20 | #endif | ||
21 | |||
22 | #define FW_EXT ".hcd" | ||
23 | -- | ||
24 | 1.9.1 | ||
25 | |||
diff --git a/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd b/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd new file mode 100644 index 0000000..162275a --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd | |||
Binary files differ | |||
diff --git a/recipes-connectivity/bluez5/bluez5/brcm43438.service b/recipes-connectivity/bluez5/bluez5/brcm43438.service new file mode 100644 index 0000000..d57125c --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5/brcm43438.service | |||
@@ -0,0 +1,12 @@ | |||
1 | [Unit] | ||
2 | Description=Broadcom BCM43438 bluetooth HCI | ||
3 | ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins | ||
4 | Before=bluetooth.service | ||
5 | After=dev-ttyAMA0.device | ||
6 | |||
7 | [Service] | ||
8 | Type=simple | ||
9 | ExecStart=/usr/bin/hciattach -n /dev/ttyAMA0 bcm43xx 921600 noflow - | ||
10 | |||
11 | [Install] | ||
12 | WantedBy=multi-user.target | ||
diff --git a/recipes-connectivity/bluez5/bluez5_%.bbappend b/recipes-connectivity/bluez5/bluez5_%.bbappend new file mode 100644 index 0000000..eec52e0 --- /dev/null +++ b/recipes-connectivity/bluez5/bluez5_%.bbappend | |||
@@ -0,0 +1,26 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
2 | |||
3 | SRC_URI_append_raspberrypi3 = " \ | ||
4 | file://BCM43430A1.hcd \ | ||
5 | file://0001-bcm43xx-Add-bcm43xx-3wire-variant.patch \ | ||
6 | file://0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch \ | ||
7 | file://0003-Increase-firmware-load-timeout-to-30s.patch \ | ||
8 | file://0004-Move-the-43xx-firmware-into-lib-firmware.patch \ | ||
9 | file://brcm43438.service \ | ||
10 | " | ||
11 | |||
12 | do_install_append_raspberrypi3() { | ||
13 | install -d ${D}/lib/firmware/brcm/ | ||
14 | install -m 0644 ${WORKDIR}/BCM43430A1.hcd ${D}/lib/firmware/brcm/BCM43430A1.hcd | ||
15 | |||
16 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
17 | install -d ${D}${systemd_unitdir}/system | ||
18 | install -m 0644 ${WORKDIR}/brcm43438.service ${D}${systemd_unitdir}/system | ||
19 | fi | ||
20 | } | ||
21 | |||
22 | FILES_${PN}_append_raspberrypi3 = " \ | ||
23 | /lib/firmware/brcm/BCM43430A1.hcd \ | ||
24 | " | ||
25 | |||
26 | SYSTEMD_SERVICE_${PN}_raspberrypi3 += "brcm43438.service" | ||