mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-14 11:17:07 +00:00
kboot: Provide antenna SKU in device tree
Read the antenna SKU from the ADT and store it in a "apple,antenna-sku" property on the relevant node in the FDT. Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
This commit is contained in:
parent
054e437c31
commit
36954d51fd
1 changed files with 28 additions and 0 deletions
28
src/kboot.c
28
src/kboot.c
|
@ -293,6 +293,32 @@ static int dt_set_mac_addresses(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dt_set_antenna(void)
|
||||
{
|
||||
int anode = adt_path_offset(adt, "/arm-io/wlan");
|
||||
|
||||
if (anode < 0)
|
||||
bail("ADT: /arm-io/wlan not found\n");
|
||||
|
||||
uint8_t info[16];
|
||||
if (ADT_GETPROP_ARRAY(adt, anode, "wifi-antenna-sku-info", info) < 0)
|
||||
bail("ADT: Failed to get wifi-antenna-sku-info");
|
||||
|
||||
const char *path = fdt_get_alias(dt, "wifi0");
|
||||
if (path == NULL)
|
||||
return 0;
|
||||
|
||||
int node = fdt_path_offset(dt, path);
|
||||
if (node < 0)
|
||||
return 0;
|
||||
|
||||
char antenna[8];
|
||||
memcpy(antenna, &info[8], sizeof(antenna));
|
||||
fdt_setprop_string(dt, node, "apple,antenna-sku", antenna);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dt_disable_missing_devs(const char *adt_prefix, const char *dt_prefix, int max_devs)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -451,6 +477,8 @@ int kboot_prepare_dt(void *fdt)
|
|||
return -1;
|
||||
if (dt_set_mac_addresses())
|
||||
return -1;
|
||||
if (dt_set_antenna())
|
||||
return -1;
|
||||
if (dt_disable_missing_devs("usb-drd", "usb@", 8))
|
||||
return -1;
|
||||
if (dt_disable_missing_devs("i2c", "i2c@", 8))
|
||||
|
|
Loading…
Reference in a new issue