static int fs_loader_ofdata_to_platdata(struct udevice *dev) { const char *fs_loader_path; u32 phandlepart[2]; fs_loader_path = ofnode_get_chosen_prop("firmware-loader"); if (fs_loader_path) { ofnode fs_loader_node; fs_loader_node = ofnode_path(fs_loader_path); if (ofnode_valid(fs_loader_node)) { struct device_platdata *plat; plat = dev->platdata; if (!ofnode_read_u32_array(fs_loader_node, "phandlepart", phandlepart, 2)) { plat->phandlepart.phandle = phandlepart[0]; plat->phandlepart.partition = phandlepart[1]; } plat->mtdpart = (char *)ofnode_read_string( fs_loader_node, "mtdpart"); plat->ubivol = (char *)ofnode_read_string( fs_loader_node, "ubivol"); } } return 0; }
int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry) { const char *prop; u32 reg[2]; if (ofnode_read_u32_array(node, "reg", reg, 2)) { debug("Node '%s' has bad/missing 'reg' property\n", ofnode_get_name(node)); return -log_ret(ENOENT); } entry->offset = reg[0]; entry->length = reg[1]; entry->used = ofnode_read_s32_default(node, "used", entry->length); prop = ofnode_read_string(node, "compress"); entry->compress_algo = prop && !strcmp(prop, "lzo") ? FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE; 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; return 0; }
int dev_read_u32_array(struct udevice *dev, const char *propname, u32 *out_values, size_t sz) { return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz); }