Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging
authorTom Rini <trini@ti.com>
Fri, 21 Sep 2012 23:22:18 +0000 (16:22 -0700)
committerTom Rini <trini@ti.com>
Fri, 21 Sep 2012 23:22:18 +0000 (16:22 -0700)
1  2 
include/fdtdec.h
lib/fdtdec.c

diff --combined include/fdtdec.h
@@@ -19,6 -19,8 +19,8 @@@
   * MA 02111-1307 USA
   */
  
+ #ifndef __fdtdec_h
+ #define __fdtdec_h
  
  /*
   * This file contains convenience functions for decoding useful and
@@@ -63,7 -65,6 +65,7 @@@ enum fdt_compat_id 
        COMPAT_NVIDIA_TEGRA20_EMC,      /* Tegra20 memory controller */
        COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */
        COMPAT_NVIDIA_TEGRA20_KBC,      /* Tegra20 Keyboard */
 +      COMPAT_NVIDIA_TEGRA20_NAND,     /* Tegra2 NAND controller */
  
        COMPAT_COUNT,
  };
@@@ -383,3 -384,4 +385,4 @@@ int fdtdec_get_byte_array(const void *b
   */
  const u8 *fdtdec_locate_byte_array(const void *blob, int node,
                             const char *prop_name, int count);
+ #endif
diff --combined lib/fdtdec.c
@@@ -42,7 -42,6 +42,7 @@@ static const char * const compat_names[
        COMPAT(NVIDIA_TEGRA20_EMC, "nvidia,tegra20-emc"),
        COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
        COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
 +      COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
  };
  
  const char *fdtdec_get_compatible(enum fdt_compat_id id)
@@@ -80,11 -79,16 +80,16 @@@ fdt_addr_t fdtdec_get_addr(const void *
        const fdt_addr_t *cell;
        int len;
  
-       debug("get_addr: %s\n", prop_name);
+       debug("%s: %s: ", __func__, prop_name);
        cell = fdt_getprop(blob, node, prop_name, &len);
        if (cell && (len == sizeof(fdt_addr_t) ||
-                       len == sizeof(fdt_addr_t) * 2))
-               return fdt_addr_to_cpu(*cell);
+                       len == sizeof(fdt_addr_t) * 2)) {
+               fdt_addr_t addr = fdt_addr_to_cpu(*cell);
+               debug("%p\n", (void *)addr);
+               return addr;
+       }
+       debug("(not found)\n");
        return FDT_ADDR_T_NONE;
  }
  
@@@ -94,10 -98,15 +99,15 @@@ s32 fdtdec_get_int(const void *blob, in
        const s32 *cell;
        int len;
  
-       debug("get_size: %s\n", prop_name);
+       debug("%s: %s: ", __func__, prop_name);
        cell = fdt_getprop(blob, node, prop_name, &len);
-       if (cell && len >= sizeof(s32))
-               return fdt32_to_cpu(cell[0]);
+       if (cell && len >= sizeof(s32)) {
+               s32 val = fdt32_to_cpu(cell[0]);
+               debug("%#x (%d)\n", val, val);
+               return val;
+       }
+       debug("(not found)\n");
        return default_val;
  }
  
@@@ -329,6 -338,7 +339,7 @@@ int fdtdec_lookup_phandle(const void *b
        const u32 *phandle;
        int lookup;
  
+       debug("%s: %s\n", __func__, prop_name);
        phandle = fdt_getprop(blob, node, prop_name, NULL);
        if (!phandle)
                return -FDT_ERR_NOTFOUND;
@@@ -428,7 -438,7 +439,7 @@@ static int fdtdec_decode_gpios(const vo
        assert(max_count > 0);
        prop = fdt_get_property(blob, node, prop_name, &len);
        if (!prop) {
-               debug("FDT: %s: property '%s' missing\n", __func__, prop_name);
+               debug("%s: property '%s' missing\n", __func__, prop_name);
                return -FDT_ERR_NOTFOUND;
        }
  
        cell = (u32 *)prop->data;
        len /= sizeof(u32) * 3;         /* 3 cells per GPIO record */
        if (len > max_count) {
-               debug("FDT: %s: too many GPIOs / cells for "
+               debug(" %s: too many GPIOs / cells for "
                        "property '%s'\n", __func__, prop_name);
                return -FDT_ERR_BADLAYOUT;
        }