summaryrefslogtreecommitdiff
path: root/board/google/chameleonv3/board.c
blob: 4d3049689d3aec47b41550dd58bed2a4a40362d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright 2022 Google LLC
 */
#include <net.h>
#include <errno.h>
#include "mercury_aa1.h"

int misc_init_r(void)
{
	u8 mac[ARP_HLEN];
	int res;

	if (env_get("ethaddr"))
		return 0;

	res = mercury_aa1_read_mac(mac);
	if (res) {
		printf("couldn't read mac address: %s\n", errno_str(res));
		return 0;
	}

	if (is_valid_ethaddr(mac))
		eth_env_set_enetaddr("ethaddr", mac);

	return 0;
}