]> git.sur5r.net Git - u-boot/blobdiff - lib/fdtdec.c
Merge branch 'master' of git://git.denx.de/u-boot-spi
[u-boot] / lib / fdtdec.c
index 9c332ad903ee63608f7ffd97e97bdb2240f97b44..745b39083672f47497d68f4fd95a63c33b385419 100644 (file)
@@ -41,6 +41,10 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
        COMPAT(NVIDIA_TEGRA20_SLINK, "nvidia,tegra20-slink"),
        COMPAT(NVIDIA_TEGRA114_SPI, "nvidia,tegra114-spi"),
+       COMPAT(NVIDIA_TEGRA124_PCIE, "nvidia,tegra124-pcie"),
+       COMPAT(NVIDIA_TEGRA30_PCIE, "nvidia,tegra30-pcie"),
+       COMPAT(NVIDIA_TEGRA20_PCIE, "nvidia,tegra20-pcie"),
+       COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
        COMPAT(SMSC_LAN9215, "smsc,lan9215"),
        COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
        COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"),
@@ -73,6 +77,12 @@ 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"),
+       COMPAT(INTEL_PANTHERPOINT_AHCI, "intel,pantherpoint-ahci"),
+       COMPAT(INTEL_MODEL_206AX, "intel,model-206ax"),
+       COMPAT(INTEL_GMA, "intel,gma"),
+       COMPAT(AMS_AS3722, "ams,as3722"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
@@ -355,9 +365,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;
                        }
@@ -368,21 +378,6 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
        return -ENOENT;
 }
 
-int fdtdec_get_alias_node(const void *blob, const char *name)
-{
-       const char *prop;
-       int alias_node;
-       int len;
-
-       if (!blob)
-               return -FDT_ERR_NOTFOUND;
-       alias_node = fdt_path_offset(blob, "/aliases");
-       prop = fdt_getprop(blob, alias_node, name, &len);
-       if (!prop)
-               return -FDT_ERR_NOTFOUND;
-       return fdt_path_offset(blob, prop);
-}
-
 int fdtdec_get_chosen_node(const void *blob, const char *name)
 {
        const char *prop;
@@ -485,6 +480,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)
 {