Merge tag 'u-boot-rockchip-20200531' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / cpu / riscv_cpu.c
index f77c12649964ddc048dd8985b2899e4a2180b210..cb04f5638db16b69c9625617456fc7684fe285ab 100644 (file)
@@ -7,8 +7,10 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -46,6 +48,10 @@ static int riscv_cpu_get_count(struct udevice *dev)
        ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
                const char *device_type;
 
+               /* skip if hart is marked as not available in the device tree */
+               if (!ofnode_is_available(node))
+                       continue;
+
                device_type = ofnode_read_string(node, "device_type");
                if (!device_type)
                        continue;