1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-08-31 08:12:06 +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 bcf897e937
commit bb1f39e0c9
2 changed files with 25 additions and 31 deletions

View File

@@ -1014,7 +1014,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

@@ -794,6 +794,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);
@@ -849,6 +850,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(fdt, CONFIG_FIXUP_BDADDR,
"local-bd-address", bdaddr,
ETH_ALEN, 1);
}
#endif
}
}
@@ -881,34 +906,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;
@@ -919,8 +916,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)