]> git.sur5r.net Git - u-boot/blobdiff - drivers/clk/at91/pmc.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / drivers / clk / at91 / pmc.c
index 76ba91af81209296585eae984e6143b3719c0db0..7cfbabc96d3482d46f1217bfda51dd601d1981f4 100644 (file)
@@ -1,20 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Atmel Corporation
  *               Wenyou.Yang <wenyou.yang@atmel.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <clk-uclass.h>
-#include <dm/device.h>
+#include <dm.h>
 #include <dm/lists.h>
-#include <dm/root.h>
+#include <dm/util.h>
 #include "pmc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 static const struct udevice_id at91_pmc_match[] = {
+       { .compatible = "atmel,at91rm9200-pmc" },
+       { .compatible = "atmel,at91sam9260-pmc" },
+       { .compatible = "atmel,at91sam9g45-pmc" },
+       { .compatible = "atmel,at91sam9n12-pmc" },
+       { .compatible = "atmel,at91sam9x5-pmc" },
+       { .compatible = "atmel,sama5d3-pmc" },
        { .compatible = "atmel,sama5d2-pmc" },
        {}
 };
@@ -33,7 +38,7 @@ int at91_pmc_core_probe(struct udevice *dev)
 
        dev = dev_get_parent(dev);
 
-       plat->reg_base = (struct at91_pmc *)dev_get_addr_ptr(dev);
+       plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev);
 
        return 0;
 }
@@ -47,7 +52,7 @@ int at91_pmc_core_probe(struct udevice *dev)
 int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
 {
        const void *fdt = gd->fdt_blob;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC);
        const char *name;
        int ret;
@@ -56,7 +61,7 @@ int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
             offset > 0;
             offset = fdt_next_subnode(fdt, offset)) {
                if (pre_reloc_only &&
-                   !fdt_getprop(fdt, offset, "u-boot,dm-pre-reloc", NULL))
+                   !dm_fdt_pre_reloc(fdt, offset))
                        continue;
                /*
                 * If this node has "compatible" property, this is not
@@ -73,7 +78,7 @@ int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
                if (!name)
                        return -EINVAL;
                ret = device_bind_driver_to_node(dev, drv_name, name,
-                                                offset, NULL);
+                                       offset_to_ofnode(offset), NULL);
                if (ret)
                        return ret;
        }
@@ -81,7 +86,7 @@ int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
        return 0;
 }
 
-int at91_clk_of_xlate(struct clk *clk, struct fdtdec_phandle_args *args)
+int at91_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args)
 {
        int periph;
 
@@ -90,7 +95,8 @@ int at91_clk_of_xlate(struct clk *clk, struct fdtdec_phandle_args *args)
                return -EINVAL;
        }
 
-       periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
+       periph = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(clk->dev), "reg",
+                                -1);
        if (periph < 0)
                return -EINVAL;
 
@@ -107,7 +113,7 @@ int at91_clk_probe(struct udevice *dev)
        dev_periph_container = dev_get_parent(dev);
        dev_pmc = dev_get_parent(dev_periph_container);
 
-       plat->reg_base = (struct at91_pmc *)dev_get_addr_ptr(dev_pmc);
+       plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev_pmc);
 
        return 0;
 }