From a7caf93f520e817b270b599ceb4b6b2912005538 Mon Sep 17 00:00:00 2001
From: Andre Heider <a.heider@gmail.com>
Date: Sun, 17 Nov 2019 18:50:15 +0100
Subject: [PATCH] btmac

---
 .../devices/H6/patches/linux/16-btbcm.patch   | 13 ++++++++
 .../devices/H6/patches/u-boot/008-btmac.patch | 31 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 projects/Allwinner/devices/H6/patches/linux/16-btbcm.patch
 create mode 100644 projects/Allwinner/devices/H6/patches/u-boot/008-btmac.patch

diff --git a/projects/Allwinner/devices/H6/patches/linux/16-btbcm.patch b/projects/Allwinner/devices/H6/patches/linux/16-btbcm.patch
new file mode 100644
index 0000000000..42e6810493
--- /dev/null
+++ b/projects/Allwinner/devices/H6/patches/linux/16-btbcm.patch
@@ -0,0 +1,13 @@
+diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
+index 2d2e6d862068..e1471777486e 100644
+--- a/drivers/bluetooth/btbcm.c
++++ b/drivers/bluetooth/btbcm.c
+@@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
+ 	    !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
+ 		bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
+ 			    &bda->bdaddr);
+-		set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
++		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+ 	}
+ 
+ 	kfree_skb(skb);
diff --git a/projects/Allwinner/devices/H6/patches/u-boot/008-btmac.patch b/projects/Allwinner/devices/H6/patches/u-boot/008-btmac.patch
new file mode 100644
index 0000000000..92fc49325f
--- /dev/null
+++ b/projects/Allwinner/devices/H6/patches/u-boot/008-btmac.patch
@@ -0,0 +1,31 @@
+diff --git a/board/sunxi/board.c b/board/sunxi/board.c
+index e3b2d13892..ac156692bf 100644
+--- a/board/sunxi/board.c
++++ b/board/sunxi/board.c
+@@ -867,6 +867,7 @@ int misc_init_r(void)
+ int ft_board_setup(void *blob, bd_t *bd)
+ {
+ 	int __maybe_unused r;
++	uchar mac[ARP_HLEN];
+ 
+ 	/*
+ 	 * Call setup_environment again in case the boot fdt has
+@@ -879,6 +880,18 @@ int ft_board_setup(void *blob, bd_t *bd)
+ 	if (r)
+ 		return r;
+ #endif
++
++	if (!of_machine_is_compatible("xunlong,orangepi-3"))
++		return 0;
++
++	if (!eth_env_get_enetaddr("ethaddr", mac))
++		return 0;
++
++	mac[0] ^= 0x01;
++
++	do_fixup_by_compat(blob, "brcm,bcm4345c5",
++			   "local-bd-address", mac, ARP_HLEN, 1);
++
+ 	return 0;
+ }
+ 
-- 
2.24.0

