Lines Matching +full:mac +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0-only
16 * of_get_phy_mode - Get phy mode for given device_node
20 * The function gets phy interface string from property 'phy-mode' or
21 * 'phy-connection-type'. The index in phy_modes table is set in
23 * PHY_INTERFACE_MODE_NA and an errno is returned, e.g. -ENODEV.
32 err = of_property_read_string(np, "phy-mode", &pm); in of_get_phy_mode()
34 err = of_property_read_string(np, "phy-connection-type", &pm); in of_get_phy_mode()
44 return -ENODEV; in of_get_phy_mode()
52 if (pp && pp->length == ETH_ALEN && is_valid_ether_addr(pp->value)) in of_get_mac_addr()
53 return pp->value; in of_get_mac_addr()
60 const void *mac; in of_get_mac_addr_nvmem() local
65 return ERR_PTR(-ENODEV); in of_get_mac_addr_nvmem()
67 ret = nvmem_get_mac_address(&pdev->dev, &nvmem_mac); in of_get_mac_addr_nvmem()
69 put_device(&pdev->dev); in of_get_mac_addr_nvmem()
73 mac = devm_kmemdup(&pdev->dev, nvmem_mac, ETH_ALEN, GFP_KERNEL); in of_get_mac_addr_nvmem()
74 put_device(&pdev->dev); in of_get_mac_addr_nvmem()
75 if (!mac) in of_get_mac_addr_nvmem()
76 return ERR_PTR(-ENOMEM); in of_get_mac_addr_nvmem()
78 return mac; in of_get_mac_addr_nvmem()
82 * Search the device tree for the best MAC address to use. 'mac-address' is
83 * checked first, because that is supposed to contain to "most recent" MAC
84 * address. If that isn't set, then 'local-mac-address' is checked next,
87 * of the above isn't set, then try to get MAC address from nvmem cell named
88 * 'mac-address'.
92 * MAC address.
94 * All-zero MAC addresses are rejected, because those could be properties that
95 * exist in the device tree, but were not set by U-Boot. For example, the
96 * DTS could define 'mac-address' and 'local-mac-address', with zero MAC
97 * addresses. Some older U-Boots only initialized 'local-mac-address'. In
98 * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
107 addr = of_get_mac_addr(np, "mac-address"); in of_get_mac_address()
111 addr = of_get_mac_addr(np, "local-mac-address"); in of_get_mac_address()