1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-05 02:32:11 +02:00

arm: sunxi: add a config option to fixup a Bluetooth address

Some Bluetooth controllers, like the BCM4345C5 of the Orange Pi 3,
ship with the controller default address.

Add a config option to fix it up so it can function properly.

Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
Andre Heider
2019-11-26 09:16:00 +01:00
committed by Ondrej Jirman
parent 4e7a7ef249
commit c2dd27592d
2 changed files with 42 additions and 0 deletions

View File

@@ -1016,4 +1016,16 @@ config PINE64_DT_SELECTION
option, the device tree selection code specific to Pine64 which option, the device tree selection code specific to Pine64 which
utilizes the DRAM size will be enabled. utilizes the DRAM size will be enabled.
config FIXUP_BDADDR
string "Fixup the Bluetooth controller address"
depends on MACH_SUN50I_H6
default ""
help
This option specifies the DT compatible name of the Bluetooth
controller for which to set the "local-bd-address" property.
Set this option if your device ships with the Bluetooth controller
default address.
The used address is "bdaddr" if set, and "ethaddr" with the LSB
flipped elsewise.
endif endif

View File

@@ -887,6 +887,34 @@ int misc_init_r(void)
return 0; return 0;
} }
static void fixup_bd_address(void *blob)
{
#ifdef CONFIG_FIXUP_BDADDR
/* Some devices ship with a Bluetooth controller default address.
* Set a valid address through the device tree.
*/
uchar tmp[ETH_ALEN], bdaddr[ETH_ALEN];
int i;
if (strlen(CONFIG_FIXUP_BDADDR) < 1)
return;
if (!eth_env_get_enetaddr("bdaddr", tmp)) {
if (!eth_env_get_enetaddr("ethaddr", tmp))
return;
tmp[ETH_ALEN - 1] ^= 1;
}
/* Addresses need to be in the binary format of the corresponding stack */
for (i = 0; i < ETH_ALEN; ++i)
bdaddr[i] = tmp[ETH_ALEN - i - 1];
do_fixup_by_compat(blob, CONFIG_FIXUP_BDADDR,
"local-bd-address", bdaddr, ETH_ALEN, 1);
#endif
}
int ft_board_setup(void *blob, bd_t *bd) int ft_board_setup(void *blob, bd_t *bd)
{ {
int __maybe_unused r; int __maybe_unused r;
@@ -897,6 +925,8 @@ int ft_board_setup(void *blob, bd_t *bd)
*/ */
setup_environment(blob); setup_environment(blob);
fixup_bd_address(blob);
#ifdef CONFIG_VIDEO_DT_SIMPLEFB #ifdef CONFIG_VIDEO_DT_SIMPLEFB
r = sunxi_simplefb_setup(blob); r = sunxi_simplefb_setup(blob);
if (r) if (r)