summaryrefslogtreecommitdiff
path: root/board/dhelectronics/common/dh_common.h
blob: a2de5b1553ecf1eef0c627a8b1a67013b1e7cb56 (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
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0+
 *
 * Copyright 2022 DENX Software Engineering GmbH, Philip Oberfichtner <pro@denx.de>
 */

/*
 * dh_mac_is_in_env - Check if MAC address is already set
 *
 * @env: name of environment variable
 * Return: true if MAC is set, false otherwise
 */
bool dh_mac_is_in_env(const char *env);

/*
 * dh_get_mac_is_enabled - Test if ethernet MAC is enabled in DT
 *
 * @alias: alias for ethernet MAC device tree node
 * Return: 0 if OK, other value on error
 */
int dh_get_mac_is_enabled(const char *alias);

/*
 * dh_get_mac_from_eeprom - Get MAC address from eeprom and write it to enetaddr
 *
 * @enetaddr: buffer where address is to be stored
 * @alias: alias for EEPROM device tree node
 * Return: 0 if OK, other value on error
 */
int dh_get_mac_from_eeprom(unsigned char *enetaddr, const char *alias);

/*
 * dh_setup_mac_address - Try to get MAC address from various locations and write it to env
 *
 * Return: 0 if OK, other value on error
 */
int dh_setup_mac_address(void);