]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - lib/fdtdec.c
Merge git://git.denx.de/u-boot-fdt
[karo-tx-uboot.git] / lib / fdtdec.c
index 9c332ad903ee63608f7ffd97e97bdb2240f97b44..7c7e673aeb79e975f0a725967eb298da4212d99d 100644 (file)
@@ -73,6 +73,8 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(SAMSUNG_EXYNOS_SYSMMU, "samsung,sysmmu-v3.3"),
        COMPAT(PARADE_PS8625, "parade,ps8625"),
        COMPAT(COMPAT_INTEL_LPC, "intel,lpc"),
+       COMPAT(INTEL_MICROCODE, "intel,microcode"),
+       COMPAT(MEMORY_SPD, "memory-spd"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
@@ -355,9 +357,9 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
                slash = strrchr(prop, '/');
                if (strcmp(slash + 1, find_name))
                        continue;
-               for (p = name; *p; p++) {
-                       if (isdigit(*p)) {
-                               *seqp = simple_strtoul(p, NULL, 10);
+               for (p = name + strlen(name) - 1; p > name; p--) {
+                       if (!isdigit(*p)) {
+                               *seqp = simple_strtoul(p + 1, NULL, 10);
                                debug("Found seq %d\n", *seqp);
                                return 0;
                        }
@@ -485,6 +487,26 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
        return err;
 }
 
+int fdtdec_get_int_array_count(const void *blob, int node,
+                              const char *prop_name, u32 *array, int count)
+{
+       const u32 *cell;
+       int len, elems;
+       int i;
+
+       debug("%s: %s\n", __func__, prop_name);
+       cell = fdt_getprop(blob, node, prop_name, &len);
+       if (!cell)
+               return -FDT_ERR_NOTFOUND;
+       elems = len / sizeof(u32);
+       if (count > elems)
+               count = elems;
+       for (i = 0; i < count; i++)
+               array[i] = fdt32_to_cpu(cell[i]);
+
+       return count;
+}
+
 const u32 *fdtdec_locate_array(const void *blob, int node,
                               const char *prop_name, int count)
 {