Lines Matching +full:cell +full:- +full:value

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/nvmem-consumer.h>
17 * of_get_phy_mode - Get phy mode for given device_node
21 * The function gets phy interface string from property 'phy-mode' or
22 * 'phy-connection-type'. The index in phy_modes table is set in
24 * PHY_INTERFACE_MODE_NA and an errno is returned, e.g. -ENODEV.
33 err = of_property_read_string(np, "phy-mode", &pm); in of_get_phy_mode()
35 err = of_property_read_string(np, "phy-connection-type", &pm); in of_get_phy_mode()
45 return -ENODEV; in of_get_phy_mode()
53 if (pp && pp->length == ETH_ALEN && is_valid_ether_addr(pp->value)) { in of_get_mac_addr()
54 memcpy(addr, pp->value, ETH_ALEN); in of_get_mac_addr()
57 return -ENODEV; in of_get_mac_addr()
63 struct nvmem_cell *cell; in of_get_mac_addr_nvmem() local
72 ret = nvmem_get_mac_address(&pdev->dev, addr); in of_get_mac_addr_nvmem()
73 put_device(&pdev->dev); in of_get_mac_addr_nvmem()
77 cell = of_nvmem_cell_get(np, "mac-address"); in of_get_mac_addr_nvmem()
78 if (IS_ERR(cell)) in of_get_mac_addr_nvmem()
79 return PTR_ERR(cell); in of_get_mac_addr_nvmem()
81 mac = nvmem_cell_read(cell, &len); in of_get_mac_addr_nvmem()
82 nvmem_cell_put(cell); in of_get_mac_addr_nvmem()
89 return -EINVAL; in of_get_mac_addr_nvmem()
101 * @addr: Pointer to a six-byte array for the result
103 * Search the device tree for the best MAC address to use. 'mac-address' is
105 * address. If that isn't set, then 'local-mac-address' is checked next,
108 * of the above isn't set, then try to get MAC address from nvmem cell named
109 * 'mac-address'.
115 * All-zero MAC addresses are rejected, because those could be properties that
116 * exist in the device tree, but were not set by U-Boot. For example, the
117 * DTS could define 'mac-address' and 'local-mac-address', with zero MAC
118 * addresses. Some older U-Boots only initialized 'local-mac-address'. In
119 * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
129 return -ENODEV; in of_get_mac_address()
131 ret = of_get_mac_addr(np, "mac-address", addr); in of_get_mac_address()
135 ret = of_get_mac_addr(np, "local-mac-address", addr); in of_get_mac_address()