]> git.sur5r.net Git - u-boot/blobdiff - drivers/cpu/cpu-uclass.c
clk: Add Actions Semi OWL clock support
[u-boot] / drivers / cpu / cpu-uclass.c
index ab18ee2ea9346415af7ba0924929ac31dfb698a5..f362eb11e7220ab7b9ae370f14a82c64a2e7cff9 100644 (file)
@@ -1,13 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2015 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <cpu.h>
 #include <dm.h>
+#include <errno.h>
 #include <dm/lists.h>
 #include <dm/root.h>
 
@@ -25,12 +25,32 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info)
 {
        struct cpu_ops *ops = cpu_get_ops(dev);
 
-       if (!ops->get_desc)
+       if (!ops->get_info)
                return -ENOSYS;
 
        return ops->get_info(dev, info);
 }
 
+int cpu_get_count(struct udevice *dev)
+{
+       struct cpu_ops *ops = cpu_get_ops(dev);
+
+       if (!ops->get_count)
+               return -ENOSYS;
+
+       return ops->get_count(dev);
+}
+
+int cpu_get_vendor(struct udevice *dev, char *buf, int size)
+{
+       struct cpu_ops *ops = cpu_get_ops(dev);
+
+       if (!ops->get_vendor)
+               return -ENOSYS;
+
+       return ops->get_vendor(dev, buf, size);
+}
+
 U_BOOT_DRIVER(cpu_bus) = {
        .name   = "cpu_bus",
        .id     = UCLASS_SIMPLE_BUS,
@@ -40,11 +60,11 @@ U_BOOT_DRIVER(cpu_bus) = {
 static int uclass_cpu_init(struct uclass *uc)
 {
        struct udevice *dev;
-       int node;
+       ofnode node;
        int ret;
 
-       node = fdt_path_offset(gd->fdt_blob, "/cpus");
-       if (node < 0)
+       node = ofnode_path("/cpus");
+       if (!ofnode_valid(node))
                return 0;
 
        ret = device_bind_driver_to_node(dm_root(), "cpu_bus", "cpus", node,