From 9c9eeb6e37035f237a24b3e7fca3a38121dd747f Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 11 Jun 2024 11:52:38 +0200 Subject: stm32mp1: spl: Fix compilation warnings Fix the following compilation warnings : ../arch/arm/mach-stm32mp/stm32mp1/spl.c: In function 'stm32_init_tzc_for_optee': ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_size' may be used uninitialized [-Wmaybe-uninitialized] 148 | tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE; | ~~~~~~~~~~~^~~~~~~~~~~~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:30: note: 'optee_size' was declared here 137 | uint32_t optee_base, optee_size, tee_shmem_base; | ^~~~~~~~~~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:148:37: warning: 'optee_base' may be used uninitialized [-Wmaybe-uninitialized] 148 | tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE; | ~~~~~~~~~~~^~~~~~~~~~~~ ../arch/arm/mach-stm32mp/stm32mp1/spl.c:137:18: note: 'optee_base' was declared here 137 | uint32_t optee_base, optee_size, tee_shmem_base; | ^~~~~~~~~~ Fix also the following checkpatch "check" : CHECK: Prefer kernel type 'u32' over 'uint32_t' 37: FILE: arch/arm/mach-stm32mp/stm32mp1/spl.c:137: + uint32_t optee_base = 0, optee_size = 0, tee_shmem_base; Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c index 6c79259b2c8..10abbed87f0 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c @@ -134,7 +134,7 @@ void stm32_init_tzc_for_optee(void) { const uint32_t dram_size = stm32mp_get_dram_size(); const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1); - uint32_t optee_base, optee_size, tee_shmem_base; + u32 optee_base = 0, optee_size = 0, tee_shmem_base; const uintptr_t tzc = STM32_TZC_BASE; int ret; -- cgit v1.3.1 From 12dfaa101b852b026ae5a7d14faeec08c73a279b Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 11 Jun 2024 11:52:39 +0200 Subject: stm32mp1: spl: Update optee_get_reserved_memory() return value In case node "/reserved-memory/optee" is not found, return -ENOENT instead of 0. Signed-off-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c index 10abbed87f0..beda69f3359 100644 --- a/arch/arm/mach-stm32mp/stm32mp1/spl.c +++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c @@ -118,7 +118,7 @@ static int optee_get_reserved_memory(uint32_t *start, uint32_t *size) node = ofnode_path("/reserved-memory/optee"); if (!ofnode_valid(node)) - return 0; + return -ENOENT; fdt_start = ofnode_get_addr_size(node, "reg", &fdt_mem_size); *start = fdt_start; -- cgit v1.3.1 From 55df13d930f4f191f458a6454f4b8e614e19c215 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 6 Jun 2024 15:02:46 +0200 Subject: ARM: stm32: Fix livetree conversion on STM32MP15xx DHSOM Unlike fdt_node_check_compatible() which returns 0 if node is compatible, ofnode_device_is_compatible() return true which is non-zero if node is compatible. The intention of the code is to exit from the function in case the node is not compatible with "micrel,ks8851-mll". Add the missing invert into the conditional to reinstate original behavior. This exposes a follow up problem caused by conversion to DM based FMC2 EBI driver, where the FMC2 EBI is not configured when accessed by this code. Probe the KS8851 MAC, which also configures the FMC2 EBI as a dependency, so that the KS8851 MAC CCR register can be accessed over the FMC2 EBI bus and checked for EEPROM present bit. Fixes: 5a605b7c8615 ("board: dhelectronics: stm32mp1: convert to livetree") Signed-off-by: Marek Vasut Reviewed-by: Patrice Chotard --- board/dhelectronics/dh_stm32mp1/board.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index 22af423536d..acfdf2e87c0 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -76,14 +76,25 @@ static bool dh_stm32_mac_is_in_ks8851(void) { - ofnode node; + struct udevice *udev; u32 reg, cider, ccr; + char path[256]; + ofnode node; + int ret; node = ofnode_path("ethernet1"); if (!ofnode_valid(node)) return false; - if (ofnode_device_is_compatible(node, "micrel,ks8851-mll")) + ret = ofnode_get_path(node, path, sizeof(path)); + if (ret) + return false; + + ret = uclass_get_device_by_of_path(UCLASS_ETH, path, &udev); + if (ret) + return false; + + if (!ofnode_device_is_compatible(node, "micrel,ks8851-mll")) return false; /* -- cgit v1.3.1