#include <errno.h>
#include <serial.h>
#include <libfdt.h>
+#include <fdt_support.h>
#include <fdtdec.h>
#include <asm/sections.h>
#include <linux/ctype.h>
COMPAT(INTEL_MICROCODE, "intel,microcode"),
COMPAT(AMS_AS3722, "ams,as3722"),
COMPAT(INTEL_QRK_MRC, "intel,quark-mrc"),
- COMPAT(SOCIONEXT_XHCI, "socionext,uniphier-xhci"),
COMPAT(ALTERA_SOCFPGA_DWMAC, "altr,socfpga-stmmac"),
COMPAT(ALTERA_SOCFPGA_DWMMC, "altr,socfpga-dw-mshc"),
COMPAT(ALTERA_SOCFPGA_DWC2USB, "snps,dwc2"),
fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node,
const char *prop_name, int index, int na, int ns,
- fdt_size_t *sizep)
+ fdt_size_t *sizep, bool translate)
{
const fdt32_t *prop, *prop_end;
const fdt32_t *prop_addr, *prop_size, *prop_after_size;
return FDT_ADDR_T_NONE;
}
- addr = fdtdec_get_number(prop_addr, na);
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_OF_LIBFDT)
+ if (translate)
+ addr = fdt_translate_address(blob, node, prop_addr);
+ else
+#endif
+ addr = fdtdec_get_number(prop_addr, na);
if (sizep) {
*sizep = fdtdec_get_number(prop_size, ns);
}
fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent,
- int node, const char *prop_name, int index, fdt_size_t *sizep)
+ int node, const char *prop_name, int index, fdt_size_t *sizep,
+ bool translate)
{
int na, ns;
debug("na=%d, ns=%d, ", na, ns);
return fdtdec_get_addr_size_fixed(blob, node, prop_name, index, na,
- ns, sizep);
+ ns, sizep, translate);
}
fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node,
- const char *prop_name, int index, fdt_size_t *sizep)
+ const char *prop_name, int index, fdt_size_t *sizep,
+ bool translate)
{
int parent;
}
return fdtdec_get_addr_size_auto_parent(blob, parent, node, prop_name,
- index, sizep);
+ index, sizep, translate);
}
fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
return fdtdec_get_addr_size_fixed(blob, node, prop_name, 0,
sizeof(fdt_addr_t) / sizeof(fdt32_t),
- ns, sizep);
+ ns, sizep, false);
}
fdt_addr_t fdtdec_get_addr(const void *blob, int node,
node = fdt_node_offset_by_phandle(blob,
phandle);
if (!node) {
- debug("%s: could not find phandle\n",
- fdt_get_name(blob, src_node,
+ printf("%s: could not find phandle\n",
+ fdt_get_name(blob, src_node,
NULL));
goto err;
}
count = fdtdec_get_int(blob, node, cells_name,
-1);
if (count == -1) {
- debug("%s: could not get %s for %s\n",
- fdt_get_name(blob, src_node,
- NULL),
- cells_name,
- fdt_get_name(blob, node,
- NULL));
+ printf("%s: could not get %s for %s\n",
+ fdt_get_name(blob, src_node,
+ NULL),
+ cells_name,
+ fdt_get_name(blob, node,
+ NULL));
goto err;
}
} else {
* remaining property data length
*/
if (list + count > list_end) {
- debug("%s: arguments longer than property\n",
+ printf("%s: arguments longer than property\n",
fdt_get_name(blob, src_node, NULL));
goto err;
}
int i;
if (count > MAX_PHANDLE_ARGS) {
- debug("%s: too many arguments %d\n",
- fdt_get_name(blob, src_node,
- NULL), count);
+ printf("%s: too many arguments %d\n",
+ fdt_get_name(blob, src_node,
+ NULL), count);
count = MAX_PHANDLE_ARGS;
}
out_args->node = node;
u32 reg[2];
if (fdtdec_get_int_array(blob, node, "reg", reg, 2)) {
- debug("Node '%s' has bad/missing 'reg' property\n", name);
+ printf("Node '%s' has bad/missing 'reg' property\n", name);
return -FDT_ERR_NOTFOUND;
}
entry->offset = reg[0];
if (config_node == -1) {
config_node = fdt_path_offset(blob, "/config");
if (config_node < 0) {
- debug("%s: Cannot find /config node\n", __func__);
+ printf("%s: Cannot find /config node\n", __func__);
return -ENOENT;
}
}
suffix);
mem = fdt_getprop(blob, config_node, prop_name, NULL);
if (!mem) {
- debug("%s: No memory type for '%s', using /memory\n", __func__,
- prop_name);
+ printf("%s: No memory type for '%s', using /memory\n", __func__,
+ prop_name);
mem = "/memory";
}
node = fdt_path_offset(blob, mem);
if (node < 0) {
- debug("%s: Failed to find node '%s': %s\n", __func__, mem,
- fdt_strerror(node));
+ printf("%s: Failed to find node '%s': %s\n", __func__, mem,
+ fdt_strerror(node));
return -ENOENT;
}
* use the first
*/
if (fdtdec_decode_region(blob, node, "reg", &base, &size)) {
- debug("%s: Failed to decode memory region %s\n", __func__,
- mem);
+ printf("%s: Failed to decode memory region %s\n", __func__,
+ mem);
return -EINVAL;
}
suffix);
if (fdtdec_decode_region(blob, config_node, prop_name, &offset,
&offset_size)) {
- debug("%s: Failed to decode memory region '%s'\n", __func__,
- prop_name);
+ printf("%s: Failed to decode memory region '%s'\n", __func__,
+ prop_name);
return -EINVAL;
}
prop = fdt_getprop(blob, node, name, &length);
if (!prop) {
- debug("%s: could not find property %s\n",
- fdt_get_name(blob, node, NULL), name);
+ printf("%s: could not find property %s\n",
+ fdt_get_name(blob, node, NULL), name);
return length;
}