dm: core: Add address translation in fdt_get_resource
[platform/kernel/u-boot.git] / drivers / net / mscc_eswitch / serval_switch.c
index f05fa42..c4b81f7 100644 (file)
@@ -6,10 +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>
@@ -371,7 +373,7 @@ static int serval_initialize(struct serval_private *priv)
 static int serval_write_hwaddr(struct udevice *dev)
 {
        struct serval_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], serval_regs_ana_table,
                           pdata->enetaddr, PGID_UNICAST);
@@ -384,7 +386,7 @@ static int serval_write_hwaddr(struct udevice *dev)
 static int serval_start(struct udevice *dev)
 {
        struct serval_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;
@@ -480,7 +482,6 @@ static int serval_probe(struct udevice *dev)
        struct serval_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;
@@ -531,9 +532,8 @@ static int serval_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 */
@@ -602,6 +602,6 @@ U_BOOT_DRIVER(serval) = {
        .probe                          = serval_probe,
        .remove                         = serval_remove,
        .ops                            = &serval_ops,
-       .priv_auto_alloc_size           = sizeof(struct serval_private),
-       .platdata_auto_alloc_size       = sizeof(struct eth_pdata),
+       .priv_auto              = sizeof(struct serval_private),
+       .plat_auto      = sizeof(struct eth_pdata),
 };