dm: core: Add address translation in fdt_get_resource
[platform/kernel/u-boot.git] / drivers / net / mscc_eswitch / ocelot_switch.c
index 0ba84ab..d1d0a48 100644 (file)
@@ -6,9 +6,12 @@
 #include <common.h>
 #include <config.h>
 #include <dm.h>
+#include <log.h>
+#include <malloc.h>
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
@@ -417,7 +420,7 @@ static int ocelot_initialize(struct ocelot_private *priv)
 static int ocelot_write_hwaddr(struct udevice *dev)
 {
        struct ocelot_private *priv = dev_get_priv(dev);
-       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct eth_pdata *pdata = dev_get_plat(dev);
 
        mscc_mac_table_add(priv->regs[ANA], ocelot_regs_ana_table,
                           pdata->enetaddr, PGID_UNICAST);
@@ -430,7 +433,7 @@ static int ocelot_write_hwaddr(struct udevice *dev)
 static int ocelot_start(struct udevice *dev)
 {
        struct ocelot_private *priv = dev_get_priv(dev);
-       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct eth_pdata *pdata = dev_get_plat(dev);
        const unsigned char mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff,
                                              0xff };
        int ret;
@@ -527,7 +530,6 @@ static int ocelot_probe(struct udevice *dev)
        struct ocelot_private *priv = dev_get_priv(dev);
        int i, ret;
        struct resource res;
-       fdt32_t faddr;
        phys_addr_t addr_base;
        unsigned long addr_size;
        ofnode eth_node, node, mdio_node;
@@ -575,9 +577,8 @@ static int ocelot_probe(struct udevice *dev)
 
                if (ofnode_read_resource(mdio_node, 0, &res))
                        return -ENOMEM;
-               faddr = cpu_to_fdt32(res.start);
 
-               addr_base = ofnode_translate_address(mdio_node, &faddr);
+               addr_base = res.start;
                addr_size = res.end - res.start;
 
                /* If the bus is new then create a new bus */
@@ -648,6 +649,6 @@ U_BOOT_DRIVER(ocelot) = {
        .probe    = ocelot_probe,
        .remove   = ocelot_remove,
        .ops      = &ocelot_ops,
-       .priv_auto_alloc_size = sizeof(struct ocelot_private),
-       .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+       .priv_auto      = sizeof(struct ocelot_private),
+       .plat_auto      = sizeof(struct eth_pdata),
 };