- fdt_for_each_subnode(node, blob, node) {
- ret = fdtdec_get_byte_array(blob, node, "st,sdram-control",
- (u8 *)¶ms->sdram_control,
- sizeof(params->sdram_control));
- if (ret)
- return ret;
- ret = fdtdec_get_byte_array(blob, node, "st,sdram-timing",
- (u8 *)¶ms->sdram_timing,
- sizeof(params->sdram_timing));
- if (ret)
- return ret;
-
- params->sdram_ref_count = fdtdec_get_int(blob, node,
+ dev_for_each_subnode(bank_node, dev) {
+ params->sdram_control = (struct stm32_sdram_control *)
+ ofnode_read_u8_array_ptr(bank_node,
+ "st,sdram-control",
+ sizeof(struct stm32_sdram_control));
+
+ if (!params->sdram_control) {
+ error("st,sdram-control not found for device: %s",
+ dev->name);
+ return -EINVAL;
+ }
+
+ params->sdram_timing = (struct stm32_sdram_timing *)
+ ofnode_read_u8_array_ptr(bank_node,
+ "st,sdram-timing",
+ sizeof(struct stm32_sdram_timing));
+
+ if (!params->sdram_timing) {
+ error("st,sdram-timing not found for device: %s",
+ dev->name);
+ return -EINVAL;
+ }
+
+ params->sdram_ref_count = ofnode_read_u32_default(bank_node,