1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

board: sunxi: Fix bdaddr generation for TBS A711

It doesn't have ethernet.

Signed-off-by: Ondrej Jirman <megous@megous.com>
This commit is contained in:
Ondrej Jirman
2019-11-26 12:02:46 +01:00
parent c2dd27592d
commit df82e77320
2 changed files with 26 additions and 31 deletions

View File

@@ -1018,7 +1018,6 @@ config PINE64_DT_SELECTION
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

View File

@@ -38,6 +38,7 @@
#include <u-boot/crc.h>
#include <env_internal.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <nand.h>
#include <net.h>
#include <spl.h>
@@ -800,6 +801,7 @@ static void setup_environment(const void *fdt)
unsigned int sid[4];
uint8_t mac_addr[6];
char ethaddr[16];
uchar tmp[ETH_ALEN], bdaddr[ETH_ALEN];
int i, ret;
ret = sunxi_get_sid(sid);
@@ -855,6 +857,30 @@ static void setup_environment(const void *fdt)
env_set("serial#", serial_string);
}
/* Some devices ship with a Bluetooth controller default address.
* Set a valid address through the device tree.
*/
#ifdef CONFIG_FIXUP_BDADDR
if (CONFIG_FIXUP_BDADDR[0]) {
if (!eth_env_get_enetaddr("bdaddr", tmp)) {
tmp[0] = (5 << 4) | 0x02;
tmp[1] = (sid[0] >> 0) & 0xff;
tmp[2] = (sid[3] >> 24) & 0xff;
tmp[3] = (sid[3] >> 16) & 0xff;
tmp[4] = (sid[3] >> 8) & 0xff;
tmp[5] = (sid[3] >> 0) & 0xff;
}
/* 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((void*)fdt, CONFIG_FIXUP_BDADDR,
"local-bd-address", bdaddr,
ETH_ALEN, 1);
}
#endif
}
}
@@ -887,34 +913,6 @@ int misc_init_r(void)
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 __maybe_unused r;
@@ -925,8 +923,6 @@ int ft_board_setup(void *blob, bd_t *bd)
*/
setup_environment(blob);
fixup_bd_address(blob);
#ifdef CONFIG_VIDEO_DT_SIMPLEFB
r = sunxi_simplefb_setup(blob);
if (r)