net: octeontx: smi: use dt live tree API

clean up octeontx_smi_probe by using the live-tree API.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
Tim Harvey 2021-06-17 16:08:54 -07:00 committed by Ramon Fried
parent 75efe7dc99
commit 54c321f9de
1 changed files with 11 additions and 13 deletions

View File

@ -314,10 +314,12 @@ read_error:
int octeontx_smi_probe(struct udevice *dev) 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); 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); debug("SMI PCI device: %x\n", bdf);
if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM)) { if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM)) {
@ -325,14 +327,12 @@ int octeontx_smi_probe(struct udevice *dev)
return -1; return -1;
} }
node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, dev_for_each_subnode(subnode, dev) {
"cavium,thunder-8890-mdio-nexus"); if (!ofnode_device_is_compatible(subnode,
fdt_for_each_subnode(subnode, gd->fdt_blob, node) { "cavium,thunder-8890-mdio"))
ret = fdt_node_check_compatible(gd->fdt_blob, subnode, continue;
"cavium,thunder-8890-mdio"); if (ofnode_read_u64(subnode, "reg", &baseaddr))
if (ret)
continue; continue;
bus = mdio_alloc(); bus = mdio_alloc();
priv = malloc(sizeof(*priv)); priv = malloc(sizeof(*priv));
if (!bus || !priv) { if (!bus || !priv) {
@ -347,9 +347,7 @@ int octeontx_smi_probe(struct udevice *dev)
bus->priv = priv; bus->priv = priv;
priv->mode = CLAUSE22; priv->mode = CLAUSE22;
priv->baseaddr = (void __iomem *)fdtdec_get_addr(gd->fdt_blob, priv->baseaddr = (void __iomem *)baseaddr;
subnode,
"reg");
debug("mdio base addr %p\n", priv->baseaddr); debug("mdio base addr %p\n", priv->baseaddr);
/* use given name or generate its own unique name */ /* use given name or generate its own unique name */