diff --git a/plat/st/common/stm32mp_dt.c b/plat/st/common/stm32mp_dt.c index 44376cdea..c9efeb533 100644 --- a/plat/st/common/stm32mp_dt.c +++ b/plat/st/common/stm32mp_dt.c @@ -326,48 +326,32 @@ const char *dt_get_board_model(void) int dt_find_otp_name(const char *name, uint32_t *otp, uint32_t *otp_len) { int node; - int index, len; + int len; const fdt32_t *cuint; if ((name == NULL) || (otp == NULL)) { return -FDT_ERR_BADVALUE; } - node = fdt_node_offset_by_compatible(fdt, -1, DT_NVMEM_LAYOUT_COMPAT); + node = fdt_node_offset_by_compatible(fdt, -1, DT_BSEC_COMPAT); if (node < 0) { return node; } - index = fdt_stringlist_search(fdt, node, "nvmem-cell-names", name); - if (index < 0) { - return index; - } - - cuint = fdt_getprop(fdt, node, "nvmem-cells", &len); - if (cuint == NULL) { - return -FDT_ERR_NOTFOUND; - } - - if ((index * (int)sizeof(uint32_t)) > len) { - return -FDT_ERR_BADVALUE; - } - - cuint += index; - - node = fdt_node_offset_by_phandle(fdt, fdt32_to_cpu(*cuint)); + node = fdt_subnode_offset(fdt, node, name); if (node < 0) { - ERROR("Malformed nvmem_layout node: ignored\n"); + ERROR("nvmem node %s not found\n", name); return node; } cuint = fdt_getprop(fdt, node, "reg", &len); if ((cuint == NULL) || (len != (2 * (int)sizeof(uint32_t)))) { - ERROR("Malformed nvmem_layout node: ignored\n"); + ERROR("Malformed nvmem node %s: ignored\n", name); return -FDT_ERR_BADVALUE; } if (fdt32_to_cpu(*cuint) % sizeof(uint32_t)) { - ERROR("Misaligned nvmem_layout element: ignored\n"); + ERROR("Misaligned nvmem %s element: ignored\n", name); return -FDT_ERR_BADVALUE; } diff --git a/plat/st/stm32mp1/stm32mp1_def.h b/plat/st/stm32mp1/stm32mp1_def.h index d8699784f..017e3b18d 100644 --- a/plat/st/stm32mp1/stm32mp1_def.h +++ b/plat/st/stm32mp1/stm32mp1_def.h @@ -621,7 +621,6 @@ static inline uintptr_t tamp_bkpr(uint32_t idx) #define DT_DDR_COMPAT "st,stm32mp1-ddr" #endif #define DT_IWDG_COMPAT "st,stm32mp1-iwdg" -#define DT_NVMEM_LAYOUT_COMPAT "st,stm32-nvmem-layout" #define DT_PWR_COMPAT "st,stm32mp1,pwr-reg" #if STM32MP13 #define DT_RCC_CLK_COMPAT "st,stm32mp13-rcc"