Skip to content

Commit

Permalink
net: octeontx: smi: use dt live tree API
Browse files Browse the repository at this point in the history
clean up octeontx_smi_probe by using the live-tree API.

Signed-off-by: Tim Harvey <[email protected]>
Reviewed-by: Stefan Roese <[email protected]>
Reviewed-by: Ramon Fried <[email protected]>
  • Loading branch information
Gateworks authored and mellowcandle committed Jun 18, 2021
1 parent 75efe7d commit 54c321f
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions drivers/net/octeontx/smi.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,25 @@ int rxaui_phy_xs_init(struct mii_dev *bus, int phy_addr)

int octeontx_smi_probe(struct udevice *dev)
{
int ret, subnode, cnt = 0, node = dev_ofnode(dev).of_offset;
struct mii_dev *bus;
struct octeontx_smi_priv *priv;
pci_dev_t bdf = dm_pci_get_bdf(dev);
struct octeontx_smi_priv *priv;
struct mii_dev *bus;
int ret, cnt = 0;
ofnode subnode;
u64 baseaddr;

debug("SMI PCI device: %x\n", bdf);
if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM)) {
printf("Failed to map PCI region for bdf %x\n", bdf);
return -1;
}

node = fdt_node_offset_by_compatible(gd->fdt_blob, -1,
"cavium,thunder-8890-mdio-nexus");
fdt_for_each_subnode(subnode, gd->fdt_blob, node) {
ret = fdt_node_check_compatible(gd->fdt_blob, subnode,
"cavium,thunder-8890-mdio");
if (ret)
dev_for_each_subnode(subnode, dev) {
if (!ofnode_device_is_compatible(subnode,
"cavium,thunder-8890-mdio"))
continue;
if (ofnode_read_u64(subnode, "reg", &baseaddr))
continue;

bus = mdio_alloc();
priv = malloc(sizeof(*priv));
if (!bus || !priv) {
Expand All @@ -347,9 +347,7 @@ int octeontx_smi_probe(struct udevice *dev)
bus->priv = priv;

priv->mode = CLAUSE22;
priv->baseaddr = (void __iomem *)fdtdec_get_addr(gd->fdt_blob,
subnode,
"reg");
priv->baseaddr = (void __iomem *)baseaddr;
debug("mdio base addr %p\n", priv->baseaddr);

/* use given name or generate its own unique name */
Expand Down

0 comments on commit 54c321f

Please sign in to comment.