mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 11:24:42 +00:00
dm: core: migrate debug() messages to use dm_warn
Prior to that, seeing the debug() messages required to enable DM_DEBUG which defines DEBUG (and then _DEBUG) which in turn makes failing assert() calls reset U-Boot which isn't necessarily what is desired. Instead, let's migrate to dm_warn which is using log_debug when unset or log_warn when set. While at it, reword the DM_DEBUG symbol in Kconfig to explain what it now actually does. Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
29010cd31b
commit
6afdb15851
10 changed files with 149 additions and 143 deletions
|
@ -58,7 +58,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
|
||||||
|
|
||||||
ret = uclass_get(drv->id, &uc);
|
ret = uclass_get(drv->id, &uc);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("Missing uclass for driver %s\n", drv->name);
|
dm_warn("Missing uclass for driver %s\n", drv->name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <dm/device-internal.h>
|
#include <dm/device-internal.h>
|
||||||
|
#include <dm/util.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
@ -32,19 +33,19 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
|
||||||
|
|
||||||
na = fdt_address_cells(gd->fdt_blob, parent);
|
na = fdt_address_cells(gd->fdt_blob, parent);
|
||||||
if (na < 1) {
|
if (na < 1) {
|
||||||
debug("bad #address-cells\n");
|
dm_warn("bad #address-cells\n");
|
||||||
return FDT_ADDR_T_NONE;
|
return FDT_ADDR_T_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = fdt_size_cells(gd->fdt_blob, parent);
|
ns = fdt_size_cells(gd->fdt_blob, parent);
|
||||||
if (ns < 0) {
|
if (ns < 0) {
|
||||||
debug("bad #size-cells\n");
|
dm_warn("bad #size-cells\n");
|
||||||
return FDT_ADDR_T_NONE;
|
return FDT_ADDR_T_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
reg = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
|
reg = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
|
||||||
if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) {
|
if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) {
|
||||||
debug("Req index out of range\n");
|
dm_warn("Req index out of range\n");
|
||||||
return FDT_ADDR_T_NONE;
|
return FDT_ADDR_T_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
|
||||||
|
|
||||||
drv = lists_driver_lookup_name(drv_name);
|
drv = lists_driver_lookup_name(drv_name);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
debug("Cannot find driver '%s'\n", drv_name);
|
dm_warn("Cannot find driver '%s'\n", drv_name);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
ret = device_bind_with_driver_data(parent, drv, dev_name, 0 /* data */,
|
ret = device_bind_with_driver_data(parent, drv, dev_name, 0 /* data */,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <linux/bug.h>
|
#include <linux/bug.h>
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
#include <dm/of_access.h>
|
#include <dm/of_access.h>
|
||||||
|
#include <dm/util.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
|
@ -489,17 +490,17 @@ int of_read_u8(const struct device_node *np, const char *propname, u8 *outp)
|
||||||
{
|
{
|
||||||
const u8 *val;
|
const u8 *val;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
if (!np)
|
if (!np)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
val = of_find_property_value_of_size(np, propname, sizeof(*outp));
|
val = of_find_property_value_of_size(np, propname, sizeof(*outp));
|
||||||
if (IS_ERR(val)) {
|
if (IS_ERR(val)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return PTR_ERR(val);
|
return PTR_ERR(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = *val;
|
*outp = *val;
|
||||||
debug("%#x (%d)\n", *outp, *outp);
|
dm_warn("%#x (%d)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -508,17 +509,17 @@ int of_read_u16(const struct device_node *np, const char *propname, u16 *outp)
|
||||||
{
|
{
|
||||||
const __be16 *val;
|
const __be16 *val;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
if (!np)
|
if (!np)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
val = of_find_property_value_of_size(np, propname, sizeof(*outp));
|
val = of_find_property_value_of_size(np, propname, sizeof(*outp));
|
||||||
if (IS_ERR(val)) {
|
if (IS_ERR(val)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return PTR_ERR(val);
|
return PTR_ERR(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = be16_to_cpup(val);
|
*outp = be16_to_cpup(val);
|
||||||
debug("%#x (%d)\n", *outp, *outp);
|
dm_warn("%#x (%d)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -533,14 +534,14 @@ int of_read_u32_array(const struct device_node *np, const char *propname,
|
||||||
{
|
{
|
||||||
const __be32 *val;
|
const __be32 *val;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
val = of_find_property_value_of_size(np, propname,
|
val = of_find_property_value_of_size(np, propname,
|
||||||
sz * sizeof(*out_values));
|
sz * sizeof(*out_values));
|
||||||
|
|
||||||
if (IS_ERR(val))
|
if (IS_ERR(val))
|
||||||
return PTR_ERR(val);
|
return PTR_ERR(val);
|
||||||
|
|
||||||
debug("size %zd\n", sz);
|
dm_warn("size %zd\n", sz);
|
||||||
while (sz--)
|
while (sz--)
|
||||||
*out_values++ = be32_to_cpup(val++);
|
*out_values++ = be32_to_cpup(val++);
|
||||||
|
|
||||||
|
@ -552,19 +553,19 @@ int of_read_u32_index(const struct device_node *np, const char *propname,
|
||||||
{
|
{
|
||||||
const __be32 *val;
|
const __be32 *val;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
if (!np)
|
if (!np)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
val = of_find_property_value_of_size(np, propname,
|
val = of_find_property_value_of_size(np, propname,
|
||||||
sizeof(*outp) * (index + 1));
|
sizeof(*outp) * (index + 1));
|
||||||
if (IS_ERR(val)) {
|
if (IS_ERR(val)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return PTR_ERR(val);
|
return PTR_ERR(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = be32_to_cpup(val + index);
|
*outp = be32_to_cpup(val + index);
|
||||||
debug("%#x (%d)\n", *outp, *outp);
|
dm_warn("%#x (%d)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -574,20 +575,20 @@ int of_read_u64_index(const struct device_node *np, const char *propname,
|
||||||
{
|
{
|
||||||
const __be64 *val;
|
const __be64 *val;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
if (!np)
|
if (!np)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
val = of_find_property_value_of_size(np, propname,
|
val = of_find_property_value_of_size(np, propname,
|
||||||
sizeof(*outp) * (index + 1));
|
sizeof(*outp) * (index + 1));
|
||||||
if (IS_ERR(val)) {
|
if (IS_ERR(val)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return PTR_ERR(val);
|
return PTR_ERR(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = be64_to_cpup(val + index);
|
*outp = be64_to_cpup(val + index);
|
||||||
debug("%#llx (%lld)\n", (unsigned long long)*outp,
|
dm_warn("%#llx (%lld)\n", (unsigned long long)*outp,
|
||||||
(unsigned long long)*outp);
|
(unsigned long long)*outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -620,7 +621,7 @@ int of_property_match_string(const struct device_node *np, const char *propname,
|
||||||
l = strnlen(p, end - p) + 1;
|
l = strnlen(p, end - p) + 1;
|
||||||
if (p + l > end)
|
if (p + l > end)
|
||||||
return -EILSEQ;
|
return -EILSEQ;
|
||||||
debug("comparing %s with %s\n", string, p);
|
dm_warn("comparing %s with %s\n", string, p);
|
||||||
if (strcmp(string, p) == 0)
|
if (strcmp(string, p) == 0)
|
||||||
return i; /* Found it; return index */
|
return i; /* Found it; return index */
|
||||||
}
|
}
|
||||||
|
@ -707,17 +708,17 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
|
||||||
if (cells_name || cur_index == index) {
|
if (cells_name || cur_index == index) {
|
||||||
node = of_find_node_by_phandle(NULL, phandle);
|
node = of_find_node_by_phandle(NULL, phandle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
debug("%s: could not find phandle\n",
|
dm_warn("%s: could not find phandle\n",
|
||||||
np->full_name);
|
np->full_name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cells_name) {
|
if (cells_name) {
|
||||||
if (of_read_u32(node, cells_name, &count)) {
|
if (of_read_u32(node, cells_name, &count)) {
|
||||||
debug("%s: could not get %s for %s\n",
|
dm_warn("%s: could not get %s for %s\n",
|
||||||
np->full_name, cells_name,
|
np->full_name, cells_name,
|
||||||
node->full_name);
|
node->full_name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -729,8 +730,8 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
|
||||||
* remaining property data length
|
* remaining property data length
|
||||||
*/
|
*/
|
||||||
if (list + count > list_end) {
|
if (list + count > list_end) {
|
||||||
debug("%s: arguments longer than property\n",
|
dm_warn("%s: arguments longer than property\n",
|
||||||
np->full_name);
|
np->full_name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,8 +826,8 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np,
|
||||||
strncpy(ap->stem, stem, stem_len);
|
strncpy(ap->stem, stem, stem_len);
|
||||||
ap->stem[stem_len] = 0;
|
ap->stem[stem_len] = 0;
|
||||||
list_add_tail(&ap->link, &aliases_lookup);
|
list_add_tail(&ap->link, &aliases_lookup);
|
||||||
debug("adding DT alias:%s: stem=%s id=%i node=%s\n",
|
dm_warn("adding DT alias:%s: stem=%s id=%i node=%s\n",
|
||||||
ap->alias, ap->stem, ap->id, of_node_full_name(np));
|
ap->alias, ap->stem, ap->id, of_node_full_name(np));
|
||||||
}
|
}
|
||||||
|
|
||||||
int of_alias_scan(void)
|
int of_alias_scan(void)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
#include <dm/of_access.h>
|
#include <dm/of_access.h>
|
||||||
#include <dm/of_addr.h>
|
#include <dm/of_addr.h>
|
||||||
|
#include <dm/util.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
|
@ -26,7 +27,7 @@ static struct of_bus *of_match_bus(struct device_node *np);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void of_dump_addr(const char *s, const __be32 *addr, int na)
|
static void of_dump_addr(const char *s, const __be32 *addr, int na)
|
||||||
{
|
{
|
||||||
debug("%s", s);
|
dm_warn("%s", s);
|
||||||
while (na--)
|
while (na--)
|
||||||
pr_cont(" %08x", be32_to_cpu(*(addr++)));
|
pr_cont(" %08x", be32_to_cpu(*(addr++)));
|
||||||
pr_cont("\n");
|
pr_cont("\n");
|
||||||
|
@ -65,9 +66,9 @@ static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
|
||||||
s = of_read_number(range + na + pna, ns);
|
s = of_read_number(range + na + pna, ns);
|
||||||
da = of_read_number(addr, na);
|
da = of_read_number(addr, na);
|
||||||
|
|
||||||
debug("default map, cp=%llx, s=%llx, da=%llx\n",
|
dm_warn("default map, cp=%llx, s=%llx, da=%llx\n",
|
||||||
(unsigned long long)cp, (unsigned long long)s,
|
(unsigned long long)cp, (unsigned long long)s,
|
||||||
(unsigned long long)da);
|
(unsigned long long)da);
|
||||||
|
|
||||||
if (da < cp || da >= (cp + s))
|
if (da < cp || da >= (cp + s))
|
||||||
return OF_BAD_ADDR;
|
return OF_BAD_ADDR;
|
||||||
|
@ -193,17 +194,17 @@ static int of_translate_one(const struct device_node *parent,
|
||||||
ranges = of_get_property(parent, rprop, &rlen);
|
ranges = of_get_property(parent, rprop, &rlen);
|
||||||
if (ranges == NULL && !of_empty_ranges_quirk(parent) &&
|
if (ranges == NULL && !of_empty_ranges_quirk(parent) &&
|
||||||
strcmp(rprop, "dma-ranges")) {
|
strcmp(rprop, "dma-ranges")) {
|
||||||
debug("no ranges; cannot translate\n");
|
dm_warn("no ranges; cannot translate\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ranges == NULL || rlen == 0) {
|
if (ranges == NULL || rlen == 0) {
|
||||||
offset = of_read_number(addr, na);
|
offset = of_read_number(addr, na);
|
||||||
memset(addr, 0, pna * 4);
|
memset(addr, 0, pna * 4);
|
||||||
debug("empty ranges; 1:1 translation\n");
|
dm_warn("empty ranges; 1:1 translation\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("walking ranges...\n");
|
dm_warn("walking ranges...\n");
|
||||||
|
|
||||||
/* Now walk through the ranges */
|
/* Now walk through the ranges */
|
||||||
rlen /= 4;
|
rlen /= 4;
|
||||||
|
@ -214,14 +215,14 @@ static int of_translate_one(const struct device_node *parent,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (offset == OF_BAD_ADDR) {
|
if (offset == OF_BAD_ADDR) {
|
||||||
debug("not found !\n");
|
dm_warn("not found !\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
memcpy(addr, ranges + na, 4 * pna);
|
memcpy(addr, ranges + na, 4 * pna);
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
of_dump_addr("parent translation for:", addr, pna);
|
of_dump_addr("parent translation for:", addr, pna);
|
||||||
debug("with offset: %llx\n", (unsigned long long)offset);
|
dm_warn("with offset: %llx\n", (unsigned long long)offset);
|
||||||
|
|
||||||
/* Translate it into parent bus space */
|
/* Translate it into parent bus space */
|
||||||
return pbus->translate(addr, offset, pna);
|
return pbus->translate(addr, offset, pna);
|
||||||
|
@ -246,7 +247,7 @@ static u64 __of_translate_address(const struct device_node *dev,
|
||||||
int na, ns, pna, pns;
|
int na, ns, pna, pns;
|
||||||
u64 result = OF_BAD_ADDR;
|
u64 result = OF_BAD_ADDR;
|
||||||
|
|
||||||
debug("** translation for device %s **\n", of_node_full_name(dev));
|
dm_warn("** translation for device %s **\n", of_node_full_name(dev));
|
||||||
|
|
||||||
/* Increase refcount at current level */
|
/* Increase refcount at current level */
|
||||||
(void)of_node_get(dev);
|
(void)of_node_get(dev);
|
||||||
|
@ -260,13 +261,13 @@ static u64 __of_translate_address(const struct device_node *dev,
|
||||||
/* Count address cells & copy address locally */
|
/* Count address cells & copy address locally */
|
||||||
bus->count_cells(dev, &na, &ns);
|
bus->count_cells(dev, &na, &ns);
|
||||||
if (!OF_CHECK_COUNTS(na, ns)) {
|
if (!OF_CHECK_COUNTS(na, ns)) {
|
||||||
debug("Bad cell count for %s\n", of_node_full_name(dev));
|
dm_warn("Bad cell count for %s\n", of_node_full_name(dev));
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
memcpy(addr, in_addr, na * 4);
|
memcpy(addr, in_addr, na * 4);
|
||||||
|
|
||||||
debug("bus is %s (na=%d, ns=%d) on %s\n", bus->name, na, ns,
|
dm_warn("bus is %s (na=%d, ns=%d) on %s\n", bus->name, na, ns,
|
||||||
of_node_full_name(parent));
|
of_node_full_name(parent));
|
||||||
of_dump_addr("translating address:", addr, na);
|
of_dump_addr("translating address:", addr, na);
|
||||||
|
|
||||||
/* Translate */
|
/* Translate */
|
||||||
|
@ -278,7 +279,7 @@ static u64 __of_translate_address(const struct device_node *dev,
|
||||||
|
|
||||||
/* If root, we have finished */
|
/* If root, we have finished */
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
debug("reached root node\n");
|
dm_warn("reached root node\n");
|
||||||
result = of_read_number(addr, na);
|
result = of_read_number(addr, na);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -287,13 +288,13 @@ static u64 __of_translate_address(const struct device_node *dev,
|
||||||
pbus = of_match_bus(parent);
|
pbus = of_match_bus(parent);
|
||||||
pbus->count_cells(dev, &pna, &pns);
|
pbus->count_cells(dev, &pna, &pns);
|
||||||
if (!OF_CHECK_COUNTS(pna, pns)) {
|
if (!OF_CHECK_COUNTS(pna, pns)) {
|
||||||
debug("Bad cell count for %s\n",
|
dm_warn("Bad cell count for %s\n",
|
||||||
of_node_full_name(dev));
|
of_node_full_name(dev));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("parent bus is %s (na=%d, ns=%d) on %s\n", pbus->name,
|
dm_warn("parent bus is %s (na=%d, ns=%d) on %s\n", pbus->name,
|
||||||
pna, pns, of_node_full_name(parent));
|
pna, pns, of_node_full_name(parent));
|
||||||
|
|
||||||
/* Apply bus translation */
|
/* Apply bus translation */
|
||||||
if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
|
if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
|
||||||
|
@ -358,8 +359,8 @@ int of_get_dma_range(const struct device_node *dev, phys_addr_t *cpu,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev || !ranges) {
|
if (!dev || !ranges) {
|
||||||
debug("no dma-ranges found for node %s\n",
|
dm_warn("no dma-ranges found for node %s\n",
|
||||||
of_node_full_name(dev));
|
of_node_full_name(dev));
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <dm/of_access.h>
|
#include <dm/of_access.h>
|
||||||
#include <dm/of_extra.h>
|
#include <dm/of_extra.h>
|
||||||
#include <dm/ofnode.h>
|
#include <dm/ofnode.h>
|
||||||
|
#include <dm/util.h>
|
||||||
|
|
||||||
int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
|
int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
|
||||||
{
|
{
|
||||||
|
@ -16,13 +17,13 @@ int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
|
||||||
ofnode subnode;
|
ofnode subnode;
|
||||||
|
|
||||||
if (ofnode_read_u32(node, "image-pos", &entry->offset)) {
|
if (ofnode_read_u32(node, "image-pos", &entry->offset)) {
|
||||||
debug("Node '%s' has bad/missing 'image-pos' property\n",
|
dm_warn("Node '%s' has bad/missing 'image-pos' property\n",
|
||||||
ofnode_get_name(node));
|
ofnode_get_name(node));
|
||||||
return log_msg_ret("image-pos", -ENOENT);
|
return log_msg_ret("image-pos", -ENOENT);
|
||||||
}
|
}
|
||||||
if (ofnode_read_u32(node, "size", &entry->length)) {
|
if (ofnode_read_u32(node, "size", &entry->length)) {
|
||||||
debug("Node '%s' has bad/missing 'size' property\n",
|
dm_warn("Node '%s' has bad/missing 'size' property\n",
|
||||||
ofnode_get_name(node));
|
ofnode_get_name(node));
|
||||||
return log_msg_ret("size", -ENOENT);
|
return log_msg_ret("size", -ENOENT);
|
||||||
}
|
}
|
||||||
entry->used = ofnode_read_s32_default(node, "used", entry->length);
|
entry->used = ofnode_read_s32_default(node, "used", entry->length);
|
||||||
|
@ -57,17 +58,17 @@ int ofnode_decode_region(ofnode node, const char *prop_name, fdt_addr_t *basep,
|
||||||
const fdt_addr_t *cell;
|
const fdt_addr_t *cell;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
debug("%s: %s: %s\n", __func__, ofnode_get_name(node), prop_name);
|
dm_warn("%s: %s: %s\n", __func__, ofnode_get_name(node), prop_name);
|
||||||
cell = ofnode_get_property(node, prop_name, &len);
|
cell = ofnode_get_property(node, prop_name, &len);
|
||||||
if (!cell || (len < sizeof(fdt_addr_t) * 2)) {
|
if (!cell || (len < sizeof(fdt_addr_t) * 2)) {
|
||||||
debug("cell=%p, len=%d\n", cell, len);
|
dm_warn("cell=%p, len=%d\n", cell, len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*basep = fdt_addr_to_cpu(*cell);
|
*basep = fdt_addr_to_cpu(*cell);
|
||||||
*sizep = fdt_size_to_cpu(cell[1]);
|
*sizep = fdt_size_to_cpu(cell[1]);
|
||||||
debug("%s: base=%08lx, size=%lx\n", __func__, (ulong)*basep,
|
dm_warn("%s: base=%08lx, size=%lx\n", __func__, (ulong)*basep,
|
||||||
(ulong)*sizep);
|
(ulong)*sizep);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +86,7 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
||||||
if (!ofnode_valid(config_node)) {
|
if (!ofnode_valid(config_node)) {
|
||||||
config_node = ofnode_path("/config");
|
config_node = ofnode_path("/config");
|
||||||
if (!ofnode_valid(config_node)) {
|
if (!ofnode_valid(config_node)) {
|
||||||
debug("%s: Cannot find /config node\n", __func__);
|
dm_warn("%s: Cannot find /config node\n", __func__);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,14 +97,14 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
||||||
suffix);
|
suffix);
|
||||||
mem = ofnode_read_string(config_node, prop_name);
|
mem = ofnode_read_string(config_node, prop_name);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
debug("%s: No memory type for '%s', using /memory\n", __func__,
|
dm_warn("%s: No memory type for '%s', using /memory\n", __func__,
|
||||||
prop_name);
|
prop_name);
|
||||||
mem = "/memory";
|
mem = "/memory";
|
||||||
}
|
}
|
||||||
|
|
||||||
node = ofnode_path(mem);
|
node = ofnode_path(mem);
|
||||||
if (!ofnode_valid(node)) {
|
if (!ofnode_valid(node)) {
|
||||||
debug("%s: Failed to find node '%s'\n", __func__, mem);
|
dm_warn("%s: Failed to find node '%s'\n", __func__, mem);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +113,8 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
||||||
* use the first
|
* use the first
|
||||||
*/
|
*/
|
||||||
if (ofnode_decode_region(node, "reg", &base, &size)) {
|
if (ofnode_decode_region(node, "reg", &base, &size)) {
|
||||||
debug("%s: Failed to decode memory region %s\n", __func__,
|
dm_warn("%s: Failed to decode memory region %s\n", __func__,
|
||||||
mem);
|
mem);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +122,8 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
||||||
suffix);
|
suffix);
|
||||||
if (ofnode_decode_region(config_node, prop_name, &offset,
|
if (ofnode_decode_region(config_node, prop_name, &offset,
|
||||||
&offset_size)) {
|
&offset_size)) {
|
||||||
debug("%s: Failed to decode memory region '%s'\n", __func__,
|
dm_warn("%s: Failed to decode memory region '%s'\n", __func__,
|
||||||
prop_name);
|
prop_name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <dm/of_access.h>
|
#include <dm/of_access.h>
|
||||||
#include <dm/of_addr.h>
|
#include <dm/of_addr.h>
|
||||||
#include <dm/ofnode.h>
|
#include <dm/ofnode.h>
|
||||||
|
#include <dm/util.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
@ -314,7 +315,7 @@ int ofnode_read_u8(ofnode node, const char *propname, u8 *outp)
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node))
|
if (ofnode_is_np(node))
|
||||||
return of_read_u8(ofnode_to_np(node), propname, outp);
|
return of_read_u8(ofnode_to_np(node), propname, outp);
|
||||||
|
@ -322,11 +323,11 @@ int ofnode_read_u8(ofnode node, const char *propname, u8 *outp)
|
||||||
cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
|
cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
|
||||||
&len);
|
&len);
|
||||||
if (!cell || len < sizeof(*cell)) {
|
if (!cell || len < sizeof(*cell)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*outp = *cell;
|
*outp = *cell;
|
||||||
debug("%#x (%u)\n", *outp, *outp);
|
dm_warn("%#x (%u)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +346,7 @@ int ofnode_read_u16(ofnode node, const char *propname, u16 *outp)
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node))
|
if (ofnode_is_np(node))
|
||||||
return of_read_u16(ofnode_to_np(node), propname, outp);
|
return of_read_u16(ofnode_to_np(node), propname, outp);
|
||||||
|
@ -353,11 +354,11 @@ int ofnode_read_u16(ofnode node, const char *propname, u16 *outp)
|
||||||
cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
|
cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
|
||||||
&len);
|
&len);
|
||||||
if (!cell || len < sizeof(*cell)) {
|
if (!cell || len < sizeof(*cell)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*outp = be16_to_cpup(cell);
|
*outp = be16_to_cpup(cell);
|
||||||
debug("%#x (%u)\n", *outp, *outp);
|
dm_warn("%#x (%u)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +391,7 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index,
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node))
|
if (ofnode_is_np(node))
|
||||||
return of_read_u32_index(ofnode_to_np(node), propname, index,
|
return of_read_u32_index(ofnode_to_np(node), propname, index,
|
||||||
|
@ -399,17 +400,17 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index,
|
||||||
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
||||||
propname, &len);
|
propname, &len);
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < (sizeof(int) * (index + 1))) {
|
if (len < (sizeof(int) * (index + 1))) {
|
||||||
debug("(not large enough)\n");
|
dm_warn("(not large enough)\n");
|
||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = fdt32_to_cpu(cell[index]);
|
*outp = fdt32_to_cpu(cell[index]);
|
||||||
debug("%#x (%u)\n", *outp, *outp);
|
dm_warn("%#x (%u)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -429,17 +430,17 @@ int ofnode_read_u64_index(ofnode node, const char *propname, int index,
|
||||||
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
||||||
propname, &len);
|
propname, &len);
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < (sizeof(u64) * (index + 1))) {
|
if (len < (sizeof(u64) * (index + 1))) {
|
||||||
debug("(not large enough)\n");
|
dm_warn("(not large enough)\n");
|
||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
*outp = fdt64_to_cpu(cell[index]);
|
*outp = fdt64_to_cpu(cell[index]);
|
||||||
debug("%#llx (%llu)\n", *outp, *outp);
|
dm_warn("%#llx (%llu)\n", *outp, *outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +468,7 @@ int ofnode_read_u64(ofnode node, const char *propname, u64 *outp)
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node))
|
if (ofnode_is_np(node))
|
||||||
return of_read_u64(ofnode_to_np(node), propname, outp);
|
return of_read_u64(ofnode_to_np(node), propname, outp);
|
||||||
|
@ -475,12 +476,12 @@ int ofnode_read_u64(ofnode node, const char *propname, u64 *outp)
|
||||||
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
|
||||||
propname, &len);
|
propname, &len);
|
||||||
if (!cell || len < sizeof(*cell)) {
|
if (!cell || len < sizeof(*cell)) {
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*outp = fdt64_to_cpu(cell[0]);
|
*outp = fdt64_to_cpu(cell[0]);
|
||||||
debug("%#llx (%llu)\n", (unsigned long long)*outp,
|
dm_warn("%#llx (%llu)\n", (unsigned long long)*outp,
|
||||||
(unsigned long long)*outp);
|
(unsigned long long)*outp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -498,11 +499,11 @@ bool ofnode_read_bool(ofnode node, const char *propname)
|
||||||
bool prop;
|
bool prop;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
prop = ofnode_has_property(node, propname);
|
prop = ofnode_has_property(node, propname);
|
||||||
|
|
||||||
debug("%s\n", prop ? "true" : "false");
|
dm_warn("%s\n", prop ? "true" : "false");
|
||||||
|
|
||||||
return prop ? true : false;
|
return prop ? true : false;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +514,7 @@ const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep)
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node)) {
|
if (ofnode_is_np(node)) {
|
||||||
struct property *prop = of_find_property(
|
struct property *prop = of_find_property(
|
||||||
|
@ -528,7 +529,7 @@ const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep)
|
||||||
propname, &len);
|
propname, &len);
|
||||||
}
|
}
|
||||||
if (!val) {
|
if (!val) {
|
||||||
debug("<not found>\n");
|
dm_warn("<not found>\n");
|
||||||
if (sizep)
|
if (sizep)
|
||||||
*sizep = -FDT_ERR_NOTFOUND;
|
*sizep = -FDT_ERR_NOTFOUND;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -549,10 +550,10 @@ const char *ofnode_read_string(ofnode node, const char *propname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strnlen(str, len) >= len) {
|
if (strnlen(str, len) >= len) {
|
||||||
debug("<invalid>\n");
|
dm_warn("<invalid>\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
debug("%s\n", str);
|
dm_warn("%s\n", str);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +573,7 @@ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name)
|
||||||
ofnode subnode;
|
ofnode subnode;
|
||||||
|
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, subnode_name);
|
dm_warn("%s: %s: ", __func__, subnode_name);
|
||||||
|
|
||||||
if (ofnode_is_np(node)) {
|
if (ofnode_is_np(node)) {
|
||||||
struct device_node *np = ofnode_to_np(node);
|
struct device_node *np = ofnode_to_np(node);
|
||||||
|
@ -587,8 +588,8 @@ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name)
|
||||||
ofnode_to_offset(node), subnode_name);
|
ofnode_to_offset(node), subnode_name);
|
||||||
subnode = noffset_to_ofnode(node, ooffset);
|
subnode = noffset_to_ofnode(node, ooffset);
|
||||||
}
|
}
|
||||||
debug("%s\n", ofnode_valid(subnode) ?
|
dm_warn("%s\n", ofnode_valid(subnode) ?
|
||||||
ofnode_get_name(subnode) : "<none>");
|
ofnode_get_name(subnode) : "<none>");
|
||||||
|
|
||||||
return subnode;
|
return subnode;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +598,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname,
|
||||||
u32 *out_values, size_t sz)
|
u32 *out_values, size_t sz)
|
||||||
{
|
{
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
if (ofnode_is_np(node)) {
|
if (ofnode_is_np(node)) {
|
||||||
return of_read_u32_array(ofnode_to_np(node), propname,
|
return of_read_u32_array(ofnode_to_np(node), propname,
|
||||||
|
@ -669,7 +670,7 @@ ofnode ofnode_get_parent(ofnode node)
|
||||||
const char *ofnode_get_name(ofnode node)
|
const char *ofnode_get_name(ofnode node)
|
||||||
{
|
{
|
||||||
if (!ofnode_valid(node)) {
|
if (!ofnode_valid(node)) {
|
||||||
debug("%s node not valid\n", __func__);
|
dm_warn("%s node not valid\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,7 +1031,7 @@ ofnode ofnode_get_aliases_node(const char *name)
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return ofnode_null();
|
return ofnode_null();
|
||||||
|
|
||||||
debug("%s: node_path: %s\n", __func__, prop);
|
dm_warn("%s: node_path: %s\n", __func__, prop);
|
||||||
|
|
||||||
return ofnode_path(prop);
|
return ofnode_path(prop);
|
||||||
}
|
}
|
||||||
|
@ -1053,8 +1054,8 @@ static int decode_timing_property(ofnode node, const char *name,
|
||||||
|
|
||||||
length = ofnode_read_size(node, name);
|
length = ofnode_read_size(node, name);
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
debug("%s: could not find property %s\n",
|
dm_warn("%s: could not find property %s\n",
|
||||||
ofnode_get_name(node), name);
|
ofnode_get_name(node), name);
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1299,7 +1300,7 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
|
||||||
int len;
|
int len;
|
||||||
int ret = -ENOENT;
|
int ret = -ENOENT;
|
||||||
|
|
||||||
debug("%s: %s: ", __func__, propname);
|
dm_warn("%s: %s: ", __func__, propname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we follow the pci bus bindings strictly, we should check
|
* If we follow the pci bus bindings strictly, we should check
|
||||||
|
@ -1316,8 +1317,8 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
debug("pci address #%d: %08lx %08lx %08lx\n", i,
|
dm_warn("pci address #%d: %08lx %08lx %08lx\n", i,
|
||||||
(ulong)fdt32_to_cpu(cell[0]),
|
(ulong)fdt32_to_cpu(cell[0]),
|
||||||
(ulong)fdt32_to_cpu(cell[1]),
|
(ulong)fdt32_to_cpu(cell[1]),
|
||||||
(ulong)fdt32_to_cpu(cell[2]));
|
(ulong)fdt32_to_cpu(cell[2]));
|
||||||
if ((fdt32_to_cpu(*cell) & type) == type) {
|
if ((fdt32_to_cpu(*cell) & type) == type) {
|
||||||
|
@ -1346,7 +1347,7 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
debug("(not found)\n");
|
dm_warn("(not found)\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1630,7 +1631,7 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value)
|
||||||
{
|
{
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
|
|
||||||
debug("%s: %s = %s", __func__, propname, value);
|
dm_warn("%s: %s = %s", __func__, propname, value);
|
||||||
|
|
||||||
return ofnode_write_prop(node, propname, value, strlen(value) + 1,
|
return ofnode_write_prop(node, propname, value, strlen(value) + 1,
|
||||||
false);
|
false);
|
||||||
|
@ -1743,7 +1744,7 @@ int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
|
||||||
|
|
||||||
uboot = ofnode_path("/options/u-boot");
|
uboot = ofnode_path("/options/u-boot");
|
||||||
if (!ofnode_valid(uboot)) {
|
if (!ofnode_valid(uboot)) {
|
||||||
debug("%s: Missing /u-boot node\n", __func__);
|
dm_warn("%s: Missing /u-boot node\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1769,7 +1770,7 @@ int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
|
||||||
|
|
||||||
uboot = ofnode_path("/options/u-boot");
|
uboot = ofnode_path("/options/u-boot");
|
||||||
if (!ofnode_valid(uboot)) {
|
if (!ofnode_valid(uboot)) {
|
||||||
debug("%s: Missing /u-boot node\n", __func__);
|
dm_warn("%s: Missing /u-boot node\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1784,7 +1785,7 @@ int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!bootscr_flash_size) {
|
if (!bootscr_flash_size) {
|
||||||
debug("bootscr-flash-size is zero. Ignoring properties!\n");
|
dm_warn("bootscr-flash-size is zero. Ignoring properties!\n");
|
||||||
*bootscr_flash_offset = 0;
|
*bootscr_flash_offset = 0;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1831,7 +1832,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)
|
||||||
if (!strcmp(mode, phy_interface_strings[i]))
|
if (!strcmp(mode, phy_interface_strings[i]))
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
debug("%s: Invalid PHY interface '%s'\n", __func__, mode);
|
dm_warn("%s: Invalid PHY interface '%s'\n", __func__, mode);
|
||||||
|
|
||||||
return PHY_INTERFACE_MODE_NA;
|
return PHY_INTERFACE_MODE_NA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <dm/of_addr.h>
|
#include <dm/of_addr.h>
|
||||||
#include <dm/devres.h>
|
#include <dm/devres.h>
|
||||||
|
#include <dm/util.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <linux/compat.h>
|
#include <linux/compat.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
@ -139,8 +140,8 @@ static int init_range(ofnode node, struct regmap_range *range, int addr_len,
|
||||||
ret = of_address_to_resource(ofnode_to_np(node),
|
ret = of_address_to_resource(ofnode_to_np(node),
|
||||||
index, &r);
|
index, &r);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("%s: Could not read resource of range %d (ret = %d)\n",
|
dm_warn("%s: Could not read resource of range %d (ret = %d)\n",
|
||||||
ofnode_get_name(node), index, ret);
|
ofnode_get_name(node), index, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +155,8 @@ static int init_range(ofnode node, struct regmap_range *range, int addr_len,
|
||||||
addr_len, size_len,
|
addr_len, size_len,
|
||||||
&sz, true);
|
&sz, true);
|
||||||
if (range->start == FDT_ADDR_T_NONE) {
|
if (range->start == FDT_ADDR_T_NONE) {
|
||||||
debug("%s: Could not read start of range %d\n",
|
dm_warn("%s: Could not read start of range %d\n",
|
||||||
ofnode_get_name(node), index);
|
ofnode_get_name(node), index);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,15 +174,15 @@ int regmap_init_mem_index(ofnode node, struct regmap **mapp, int index)
|
||||||
|
|
||||||
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
|
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
|
||||||
if (addr_len < 0) {
|
if (addr_len < 0) {
|
||||||
debug("%s: Error while reading the addr length (ret = %d)\n",
|
dm_warn("%s: Error while reading the addr length (ret = %d)\n",
|
||||||
ofnode_get_name(node), addr_len);
|
ofnode_get_name(node), addr_len);
|
||||||
return addr_len;
|
return addr_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
|
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
|
||||||
if (size_len < 0) {
|
if (size_len < 0) {
|
||||||
debug("%s: Error while reading the size length: (ret = %d)\n",
|
dm_warn("%s: Error while reading the size length: (ret = %d)\n",
|
||||||
ofnode_get_name(node), size_len);
|
ofnode_get_name(node), size_len);
|
||||||
return size_len;
|
return size_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,36 +251,36 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
|
||||||
|
|
||||||
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
|
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
|
||||||
if (addr_len < 0) {
|
if (addr_len < 0) {
|
||||||
debug("%s: Error while reading the addr length (ret = %d)\n",
|
dm_warn("%s: Error while reading the addr length (ret = %d)\n",
|
||||||
ofnode_get_name(node), addr_len);
|
ofnode_get_name(node), addr_len);
|
||||||
return addr_len;
|
return addr_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
|
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
|
||||||
if (size_len < 0) {
|
if (size_len < 0) {
|
||||||
debug("%s: Error while reading the size length: (ret = %d)\n",
|
dm_warn("%s: Error while reading the size length: (ret = %d)\n",
|
||||||
ofnode_get_name(node), size_len);
|
ofnode_get_name(node), size_len);
|
||||||
return size_len;
|
return size_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
both_len = addr_len + size_len;
|
both_len = addr_len + size_len;
|
||||||
if (!both_len) {
|
if (!both_len) {
|
||||||
debug("%s: Both addr and size length are zero\n",
|
dm_warn("%s: Both addr and size length are zero\n",
|
||||||
ofnode_get_name(node));
|
ofnode_get_name(node));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = ofnode_read_size(node, "reg");
|
len = ofnode_read_size(node, "reg");
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
debug("%s: Error while reading reg size (ret = %d)\n",
|
dm_warn("%s: Error while reading reg size (ret = %d)\n",
|
||||||
ofnode_get_name(node), len);
|
ofnode_get_name(node), len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
len /= sizeof(fdt32_t);
|
len /= sizeof(fdt32_t);
|
||||||
count = len / both_len;
|
count = len / both_len;
|
||||||
if (!count) {
|
if (!count) {
|
||||||
debug("%s: Not enough data in reg property\n",
|
dm_warn("%s: Not enough data in reg property\n",
|
||||||
ofnode_get_name(node));
|
ofnode_get_name(node));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,8 +425,8 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
if (do_range_check() && range_num >= map->range_count) {
|
if (do_range_check() && range_num >= map->range_count) {
|
||||||
debug("%s: range index %d larger than range count\n",
|
dm_warn("%s: range index %d larger than range count\n",
|
||||||
__func__, range_num);
|
__func__, range_num);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
range = &map->ranges[range_num];
|
range = &map->ranges[range_num];
|
||||||
|
@ -433,7 +434,7 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
|
||||||
offset <<= map->reg_offset_shift;
|
offset <<= map->reg_offset_shift;
|
||||||
if (do_range_check() &&
|
if (do_range_check() &&
|
||||||
(offset + val_len > range->size || offset + val_len < offset)) {
|
(offset + val_len > range->size || offset + val_len < offset)) {
|
||||||
debug("%s: offset/size combination invalid\n", __func__);
|
dm_warn("%s: offset/size combination invalid\n", __func__);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +456,7 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
debug("%s: regmap size %zu unknown\n", __func__, val_len);
|
dm_warn("%s: regmap size %zu unknown\n", __func__, val_len);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,15 +565,15 @@ int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset,
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
if (range_num >= map->range_count) {
|
if (range_num >= map->range_count) {
|
||||||
debug("%s: range index %d larger than range count\n",
|
dm_warn("%s: range index %d larger than range count\n",
|
||||||
__func__, range_num);
|
__func__, range_num);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
range = &map->ranges[range_num];
|
range = &map->ranges[range_num];
|
||||||
|
|
||||||
offset <<= map->reg_offset_shift;
|
offset <<= map->reg_offset_shift;
|
||||||
if (offset + val_len > range->size || offset + val_len < offset) {
|
if (offset + val_len > range->size || offset + val_len < offset) {
|
||||||
debug("%s: offset/size combination invalid\n", __func__);
|
dm_warn("%s: offset/size combination invalid\n", __func__);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +595,7 @@ int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
debug("%s: regmap size %zu unknown\n", __func__, val_len);
|
dm_warn("%s: regmap size %zu unknown\n", __func__, val_len);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,8 +631,8 @@ int regmap_write(struct regmap *map, uint offset, uint val)
|
||||||
u.v64 = val;
|
u.v64 = val;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
debug("%s: regmap size %zu unknown\n", __func__,
|
dm_warn("%s: regmap size %zu unknown\n", __func__,
|
||||||
(size_t)map->width);
|
(size_t)map->width);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ static int dm_scan_fdt_node(struct udevice *parent, ofnode parent_node,
|
||||||
err = lists_bind_fdt(parent, node, NULL, NULL, pre_reloc_only);
|
err = lists_bind_fdt(parent, node, NULL, NULL, pre_reloc_only);
|
||||||
if (err && !ret) {
|
if (err && !ret) {
|
||||||
ret = err;
|
ret = err;
|
||||||
debug("%s: ret=%d\n", node_name, ret);
|
dm_warn("%s: ret=%d\n", node_name, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ int dm_extended_scan(bool pre_reloc_only)
|
||||||
|
|
||||||
ret = dm_scan_fdt(pre_reloc_only);
|
ret = dm_scan_fdt(pre_reloc_only);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("dm_scan_fdt() failed: %d\n", ret);
|
dm_warn("dm_scan_fdt() failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,8 +256,8 @@ int dm_extended_scan(bool pre_reloc_only)
|
||||||
for (i = 0; i < ARRAY_SIZE(nodes); i++) {
|
for (i = 0; i < ARRAY_SIZE(nodes); i++) {
|
||||||
ret = dm_scan_fdt_ofnode_path(nodes[i], pre_reloc_only);
|
ret = dm_scan_fdt_ofnode_path(nodes[i], pre_reloc_only);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("dm_scan_fdt() scan for %s failed: %d\n",
|
dm_warn("dm_scan_fdt() scan for %s failed: %d\n",
|
||||||
nodes[i], ret);
|
nodes[i], ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,14 +320,14 @@ static int dm_scan(bool pre_reloc_only)
|
||||||
|
|
||||||
ret = dm_scan_plat(pre_reloc_only);
|
ret = dm_scan_plat(pre_reloc_only);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("dm_scan_plat() failed: %d\n", ret);
|
dm_warn("dm_scan_plat() failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||||
ret = dm_extended_scan(pre_reloc_only);
|
ret = dm_extended_scan(pre_reloc_only);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("dm_extended_scan() failed: %d\n", ret);
|
dm_warn("dm_extended_scan() failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ int dm_init_and_scan(bool pre_reloc_only)
|
||||||
|
|
||||||
ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
|
ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("dm_init() failed: %d\n", ret);
|
dm_warn("dm_init() failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (!CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
|
if (!CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
|
||||||
|
|
|
@ -59,8 +59,8 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
|
||||||
*ucp = NULL;
|
*ucp = NULL;
|
||||||
uc_drv = lists_uclass_lookup(id);
|
uc_drv = lists_uclass_lookup(id);
|
||||||
if (!uc_drv) {
|
if (!uc_drv) {
|
||||||
debug("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
|
dm_warn("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
|
||||||
id);
|
id);
|
||||||
/*
|
/*
|
||||||
* Use a strange error to make this case easier to find. When
|
* Use a strange error to make this case easier to find. When
|
||||||
* a uclass is not available it can prevent driver model from
|
* a uclass is not available it can prevent driver model from
|
||||||
|
|
Loading…
Add table
Reference in a new issue