[PATCH v2 3/7] am65x: Use map_to_sysmem() to convert from pointer
Tom Rini
trini at konsulko.com
Sat Oct 12 03:37:13 CEST 2024
On Fri, Oct 11, 2024 at 03:40:27PM -0600, Simon Glass wrote:
> The board_init_f() function for am65x is a bit confusing, since it uses
> the variable name 'pool_addr' to hold a pointer. It then casts it to an
> address to pass to mem_alloc_init()
>
> Rename the variable and use mapmem to convert to an address.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
> arch/arm/mach-k3/am65x/am654_init.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-k3/am65x/am654_init.c b/arch/arm/mach-k3/am65x/am654_init.c
> index a4f038029d7..ddcc1355210 100644
> --- a/arch/arm/mach-k3/am65x/am654_init.c
> +++ b/arch/arm/mach-k3/am65x/am654_init.c
> @@ -8,6 +8,7 @@
>
> #include <fdt_support.h>
> #include <init.h>
> +#include <mapmem.h>
> #include <asm/global_data.h>
> #include <asm/io.h>
> #include <spl.h>
> @@ -165,7 +166,7 @@ void board_init_f(ulong dummy)
> #if defined(CONFIG_K3_LOAD_SYSFW) || defined(CONFIG_K3_AM654_DDRSS)
> struct udevice *dev;
> size_t pool_size;
> - void *pool_addr;
> + void *pool;
> int ret;
> #endif
> /*
> @@ -204,14 +205,14 @@ void board_init_f(ulong dummy)
> * malloc pool of which we use all that's left.
> */
> pool_size = CONFIG_VAL(SYS_MALLOC_F_LEN) - gd->malloc_ptr;
> - pool_addr = malloc(pool_size);
> - if (!pool_addr)
> + pool = malloc(pool_size);
> + if (!pool)
> panic("ERROR: Can't allocate full malloc pool!\n");
>
> - mem_malloc_init((ulong)pool_addr, (ulong)pool_size);
> + mem_malloc_init(map_to_sysmem(pool), (ulong)pool_size);
> gd->flags |= GD_FLG_FULL_MALLOC_INIT;
> debug("%s: initialized an early full malloc pool at 0x%08lx of 0x%lx bytes\n",
> - __func__, (unsigned long)pool_addr, (unsigned long)pool_size);
> + __func__, (unsigned long)pool, (unsigned long)pool_size);
> /*
> * Process pinctrl for the serial0 a.k.a. WKUP_UART0 module and continue
> * regardless of the result of pinctrl. Do this without probing the
I'm confused since I thought patch 2 removed the need for doing
map_to_sysmem() games more widely. You also forgot to CC anyone from TI
that might have comments on if they find "pool" rather than "pool_addr"
more or less confusing and given the recent patch from them about what's
printed out about memory size, I would think their feedback would
be important.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20241011/09d6cd85/attachment.sig>
More information about the U-Boot
mailing list