aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/device.c9
-rw-r--r--drivers/core/of_extra.c21
2 files changed, 21 insertions, 9 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index aeab3836ed..8629df8def 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -462,6 +462,15 @@ int device_probe(struct udevice *dev)
* continue regardless of the result of pinctrl. Don't process pinctrl
* settings for pinctrl devices since the device may not yet be
* probed.
+ *
+ * This call can produce some non-intuitive results. For example, on an
+ * x86 device where dev is the main PCI bus, the pinctrl device may be
+ * child or grandchild of that bus, meaning that the child will be
+ * probed here. If the child happens to be the P2SB and the pinctrl
+ * device is a child of that, then both the pinctrl and P2SB will be
+ * probed by this call. This works because the DM_FLAG_ACTIVATED flag
+ * is set just above. However, the PCI bus' probe() method and
+ * associated uclass methods have not yet been called.
*/
if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
pinctrl_select_state(dev, "default");
diff --git a/drivers/core/of_extra.c b/drivers/core/of_extra.c
index 6420e6ec44..653344529e 100644
--- a/drivers/core/of_extra.c
+++ b/drivers/core/of_extra.c
@@ -14,16 +14,17 @@
int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
{
const char *prop;
+ ofnode subnode;
if (ofnode_read_u32(node, "image-pos", &entry->offset)) {
debug("Node '%s' has bad/missing 'image-pos' property\n",
ofnode_get_name(node));
- return log_ret(-ENOENT);
+ return log_msg_ret("image-pos", -ENOENT);
}
if (ofnode_read_u32(node, "size", &entry->length)) {
debug("Node '%s' has bad/missing 'size' property\n",
ofnode_get_name(node));
- return log_ret(-ENOENT);
+ return log_msg_ret("size", -ENOENT);
}
entry->used = ofnode_read_s32_default(node, "used", entry->length);
prop = ofnode_read_string(node, "compress");
@@ -31,18 +32,20 @@ int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
if (!strcmp(prop, "lz4"))
entry->compress_algo = FMAP_COMPRESS_LZ4;
else
- return log_msg_ret("Unknown compression algo",
- -EINVAL);
+ return log_msg_ret("compression algo", -EINVAL);
} else {
entry->compress_algo = FMAP_COMPRESS_NONE;
}
entry->unc_length = ofnode_read_s32_default(node, "uncomp-size",
entry->length);
- prop = ofnode_read_string(node, "hash");
- if (prop)
- entry->hash_size = strlen(prop);
- entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE;
- entry->hash = (uint8_t *)prop;
+ subnode = ofnode_find_subnode(node, "hash");
+ if (ofnode_valid(subnode)) {
+ prop = ofnode_read_prop(subnode, "value", &entry->hash_size);
+
+ /* Assume it is sha256 */
+ entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE;
+ entry->hash = (uint8_t *)prop;
+ }
return 0;
}