提交 eee326fd 编写于 作者: D David Daney 提交者: David S. Miller

net: thunderx: bgx: Use standard firmware node infrastructure.

In the case of OF device tree, the firmware information is attached to
the BGX device structure in the standard manner, so use the firmware
iterators and accessors where possible.
Signed-off-by: NDavid Daney <david.daney@cavium.com>
Signed-off-by: NSunil Goutham <sgoutham@cavium.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fb4b7d98
...@@ -968,26 +968,27 @@ static int bgx_init_acpi_phy(struct bgx *bgx) ...@@ -968,26 +968,27 @@ static int bgx_init_acpi_phy(struct bgx *bgx)
static int bgx_init_of_phy(struct bgx *bgx) static int bgx_init_of_phy(struct bgx *bgx)
{ {
struct device_node *np; struct fwnode_handle *fwn;
struct device_node *np_child;
u8 lmac = 0; u8 lmac = 0;
char bgx_sel[5];
const char *mac; const char *mac;
/* Get BGX node from DT */ device_for_each_child_node(&bgx->pdev->dev, fwn) {
snprintf(bgx_sel, 5, "bgx%d", bgx->bgx_id); struct device_node *phy_np;
np = of_find_node_by_name(NULL, bgx_sel); struct device_node *node = to_of_node(fwn);
if (!np)
return -ENODEV; /* If it is not an OF node we cannot handle it yet, so
* exit the loop.
*/
if (!node)
break;
for_each_child_of_node(np, np_child) { phy_np = of_parse_phandle(node, "phy-handle", 0);
struct device_node *phy_np = of_parse_phandle(np_child,
"phy-handle", 0);
if (!phy_np) if (!phy_np)
continue; continue;
bgx->lmac[lmac].phydev = of_phy_find_device(phy_np); bgx->lmac[lmac].phydev = of_phy_find_device(phy_np);
mac = of_get_mac_address(np_child); mac = of_get_mac_address(node);
if (mac) if (mac)
ether_addr_copy(bgx->lmac[lmac].mac, mac); ether_addr_copy(bgx->lmac[lmac].mac, mac);
...@@ -995,7 +996,7 @@ static int bgx_init_of_phy(struct bgx *bgx) ...@@ -995,7 +996,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
bgx->lmac[lmac].lmacid = lmac; bgx->lmac[lmac].lmacid = lmac;
lmac++; lmac++;
if (lmac == MAX_LMAC_PER_BGX) { if (lmac == MAX_LMAC_PER_BGX) {
of_node_put(np_child); of_node_put(node);
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册