arm64: binman: use binman symbols for imx
Subsystems (2)
v2 cover arm64: binman: use binman symbols for imx
From: Peng Fan <[email protected]>
V2:
resolve some CI failure
include patch 7
binman symbol is a good feature, but only used on X86 for now. This patchset is to use it for i.MX8M platform.
The current imx8m ddr phy firmware consumes lots of space, because we pad them to the largest 32KB and 16KB for IMEM and DMEM.
With this patchset we use binman symbols to get firmware location and size, we could save near 36KB with i.MX8MP-EVK.
Please help check and test
Peng Fan (7):
spl: guard u_boot_any with X86
arm: dts: imx8m: update binman ddr firmware node name
armv8: u-boot-spl.lds: mark __image_copy_start as symbol
tools: binman: section: replace @ with -
ddr: imx8m: helper: load ddr firmware according to binman symbols
arm: dts: imx8m: shrink ddr firmware size to actual file size
binman_sym: guard with CONFIG_SPL_BINMAN_SYMBOLS
arch/arm/cpu/armv8/u-boot-spl.lds | 2 +- arch/arm/dts/imx8mm-u-boot.dtsi | 16 +++--- arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi | 8 +-- .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 4 +- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 8 +-- arch/arm/dts/imx8mn-evk-u-boot.dtsi | 8 +-- .../dts/imx8mn-var-som-symphony-u-boot.dtsi | 8 +-- arch/arm/dts/imx8mn-venice-u-boot.dtsi | 16 +++--- arch/arm/dts/imx8mp-u-boot.dtsi | 8 +-- arch/arm/dts/imx8mq-cm-u-boot.dtsi | 8 +-- arch/arm/dts/imx8mq-u-boot.dtsi | 16 +++--- common/spl/spl.c | 8 ++- common/spl/spl_ram.c | 4 ++ drivers/ddr/imx/imx8m/helper.c | 53 +++++++++++++++---- include/binman_sym.h | 2 +- tools/binman/etype/section.py | 2 +- tools/binman/test/u_boot_binman_syms.c | 1 + tools/binman/test/u_boot_binman_syms_size.c | 1 + 18 files changed, 109 insertions(+), 64 deletions(-)
Signature · 1 line
2.36.0
PATCH v2 1/7 spl: guard u_boot_any with X86
From: Peng Fan <[email protected]>
set the symbol as weak not work if LTO is enabled. Since u_boot_any is only used on X86 for now, so guard it with X86, otherwise build break if we use BINMAN_SYMBOLS on i.MX.
--- common/spl/spl.c | 8 ++++++-- common/spl/spl_ram.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-)
common/spl/spl.c +6 -2
@@ -50,7 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;u32 *boot_params_ptr =NULL ; -#if CONFIG_IS_ENABLED (BINMAN_SYMBOLS ) +#if CONFIG_IS_ENABLED (BINMAN_SYMBOLS ) &&CONFIG_IS_ENABLED (X86 )/* See spl.h for information about this */ binman_sym_declare (ulong, u_boot_any, image_pos);binman_sym_declare (ulong, u_boot_any, size);
@@ -148,7 +148,7 @@ void spl_fixup_fdt(void *fdt_blob)#endif } -#if CONFIG_IS_ENABLED (BINMAN_SYMBOLS ) +#if CONFIG_IS_ENABLED (BINMAN_SYMBOLS ) &&CONFIG_IS_ENABLED (X86 )ulong spl_get_image_pos (void ) {#ifdef CONFIG_VPL
@@ -221,7 +221,11 @@ __weak struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)void spl_set_header_raw_uboot (struct spl_image_info *spl_image) { +#if CONFIG_IS_ENABLED (X86 )ulong u_boot_pos =binman_sym (ulong, u_boot_any, image_pos); +#else +ulong u_boot_pos =BINMAN_SYM_MISSING ; +#endif spl_image->size =CONFIG_SYS_MONITOR_LEN ;
common/spl/spl_ram.c +4 -0
@@ -70,7 +70,11 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, load.read = spl_ram_load_read;spl_load_simple_fit (spl_image, &load,0 , header); }else { +#if CONFIG_IS_ENABLED (X86 )ulong u_boot_pos =binman_sym (ulong, u_boot_any, image_pos); +#else +ulong u_boot_pos =BINMAN_SYM_MISSING ; +#endif debug ("Legacy image\n" );/*
Signature · 1 line
2.36.0
PATCH v2 2/7 arm: dts: imx8m: update binman ddr firmware node name
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
We are migrating to use BINMAN SYMBOLS, the current name is not a valid binman type, so update to use blob-ext@[1,2,3,4].
--- arch/arm/dts/imx8mm-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 4 ++-- arch/arm/dts/imx8mn-venice-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mq-u-boot.dtsi | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +4 -4
@@ -39,25 +39,25 @@ filename = "u-boot-spl.bin"; }; - 1d-imem { + imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 1d-dmem { + dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; size = <0x4000>; type = "blob-ext"; }; - 2d-imem { + imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 2d-dmem { + dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; size = <0x4000>; type = "blob-ext";
arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi +2 -2
@@ -111,13 +111,13 @@ filename = "u-boot-spl.bin"; }; - 1d-imem { + imem_1d: blob-ext@1 { filename = "ddr3_imem_1d.bin"; size = <0x8000>; type = "blob-ext"; }; - 1d_dmem { + dmem_1d: blob-ext@2 { filename = "ddr3_dmem_1d.bin"; size = <0x4000>; type = "blob-ext";
arch/arm/dts/imx8mn-venice-u-boot.dtsi +4 -4
@@ -126,25 +126,25 @@ filename = "u-boot-spl.bin"; }; - 1d-imem { + imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 1d_dmem { + dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; size = <0x4000>; type = "blob-ext"; }; - 2d_imem { + imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 2d_dmem { + dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; size = <0x4000>; type = "blob-ext";
arch/arm/dts/imx8mq-u-boot.dtsi +4 -4
@@ -46,25 +46,25 @@ filename = "u-boot-spl.bin"; }; - 1d-imem { + imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 1d-dmem { + dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; size = <0x4000>; type = "blob-ext"; }; - 2d-imem { + imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; size = <0x8000>; type = "blob-ext"; }; - 2d-dmem { + dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; size = <0x4000>; type = "blob-ext";
Signature · 1 line
2.36.0
PATCH v2 3/7 armv8: u-boot-spl.lds: mark __image_copy_start as symbol
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
In arch/arm/lib/sections.c there is below code:
char __image_copy_start[0] __section(".__image_copy_start"); But actually 'objdump -t spl/u-boot-spl' not able to find out symbol '__image_copy_start' for binman update image-pos/size.
So update link file
--- arch/arm/cpu/armv8/u-boot-spl.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/u-boot-spl.lds +1 -1
@@ -23,7 +23,7 @@ SECTIONS { .text : { . = ALIGN(8); - *(.__image_copy_start) + __image_copy_start = .; CPUDIR/start.o (.text*) *(.text*) } >.sram
Signature · 1 line
2.36.0
PATCH v2 4/7 tools: binman: section: replace @ with -
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
In arch/arm/dts/imx8mp-u-boot.dtsi, there are blob-ext@1, blob-ext@2 and etc which is for packing ddr phy firmware. However we could not declare symbol name such as 'binman_sym_declare(ulong, blob_ext@1, image_pos)', because '@' is not allowed, so we choose to declare the symbol 'binman_sym_declare(ulong, blob_ext_1, image_pos);' with '@' replaced with '_'. It does not impact if there is no '@' in section name.
--- tools/binman/etype/section.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/section.py +1 -1
@@ -875,7 +875,7 @@ class Entry_section(Entry): entries[entry.GetPath()] = entry for entry in to_add.values(): self._CollectEntries(entries, entries_by_name, entry) - entries_by_name[add_entry.name] = add_entry + entries_by_name[add_entry.name.replace('@', '-')] = add_entry def MissingArgs(self, entry, missing): """Report a missing argument, if enabled
Signature · 1 line
2.36.0
Re: [PATCH V2 4/7] tools: binman: section: replace @ with -
Quoted 10 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
In
arch/arm/dts/imx8mp-u-boot.dtsi, there are blob-ext@1, blob-ext@2 and etc which is for packing ddr phy firmware. However we could not declare symbol name such as 'binman_sym_declare(ulong, blob_ext@1, image_pos)', because '@' is not allowed, so we choose to declare the symbol 'binman_sym_declare(ulong, blob_ext_1, image_pos);' with '@' replaced with '_'. It does not impact if there is no '@' in section name.Signed-off-by Peng Fan <[email protected]>
Signature · 1 line
Tom
PATCH v2 5/7 ddr: imx8m: helper: load ddr firmware according to binman symbols
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
By reading binman symbols, we no need hard coded IMEM_LEN/DMEM_LEN after we update the binman dtsi to drop 0x8000/0x4000 length for the firmware.
And that could save binary size for many KBs.
--- drivers/ddr/imx/imx8m/helper.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)
drivers/ddr/imx/imx8m/helper.c +44 -9
@@ -4,6 +4,7 @@*/ #include <common.h> +#include <binman_sym.h> #include <log.h> #include <spl.h> #include <asm/global_data.h>
@@ -25,15 +26,30 @@ DECLARE_GLOBAL_DATA_PTR;#define DMEM_OFFSET_ADDR 0x00054000#define DDR_TRAIN_CODE_BASE_ADDR IP2APB_DDRPHY_IPS_BASE_ADDR(0) +binman_sym_declare (ulong, blob_ext_1, image_pos); +binman_sym_declare (ulong, blob_ext_1, size); + +binman_sym_declare (ulong, blob_ext_2, image_pos); +binman_sym_declare (ulong, blob_ext_2, size); + +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) +binman_sym_declare (ulong, blob_ext_3, image_pos); +binman_sym_declare (ulong, blob_ext_3, size); + +binman_sym_declare (ulong, blob_ext_4, image_pos); +binman_sym_declare (ulong, blob_ext_4, size); +#endif +/* We need PHY iMEM PHY is 32KB padded */ void ddr_load_train_firmware (enum fw_type type) {u32 tmp32, i;u32 error =0 ; -unsigned long pr_to32, pr_from32; -unsigned long fw_offset = type ?IMEM_2D_OFFSET :0 ; -unsigned long imem_start = (unsigned long )&_end + fw_offset; -unsigned long dmem_start; +uint32_t pr_to32, pr_from32; +uint32_t fw_offset = type ?IMEM_2D_OFFSET :0 ; +uint32_t imem_start = (uint32_t )&_end + fw_offset; +uint32_t dmem_start; +uint32_t imem_len =IMEM_LEN , dmem_len =DMEM_LEN ;#ifdef CONFIG_SPL_OF_CONTROL if (gd->fdt_blob && !fdt_check_header (gd->fdt_blob)) {
@@ -43,11 +59,30 @@ void ddr_load_train_firmware(enum fw_type type) }#endif - dmem_start = imem_start +IMEM_LEN ; +if (CONFIG_IS_ENABLED (BINMAN_SYMBOLS )) { +switch (type) { +case FW_1D_IMAGE : + imem_start =binman_sym (ulong, blob_ext_1, image_pos); + imem_len =binman_sym (ulong, blob_ext_1, size); + dmem_start =binman_sym (ulong, blob_ext_2, image_pos); + dmem_len =binman_sym (ulong, blob_ext_2, size); +break ; +case FW_2D_IMAGE : +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) + imem_start =binman_sym (ulong, blob_ext_3, image_pos); + imem_len =binman_sym (ulong, blob_ext_3, size); + dmem_start =binman_sym (ulong, blob_ext_4, image_pos); + dmem_len =binman_sym (ulong, blob_ext_4, size); +#endif +break ; + } + } + + dmem_start = imem_start + imem_len; pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;
@@ -59,7 +94,7 @@ void ddr_load_train_firmware(enum fw_type type) pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ; ) { +for (i =0x0 ; i < dmem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;
@@ -72,7 +107,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr_pmu_train_imem code\n" ); pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 );
@@ -93,7 +128,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr4_pmu_train_dmem code\n" ); pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ;) { +for (i =0x0 ; i < dmem_len;) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 );
Signature · 1 line
2.36.0
Re: [PATCH V2 5/7] ddr: imx8m: helper: load ddr firmware according to binman symbols
Quoted 121 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
By reading binman symbols, we no need hard coded IMEM_LEN/DMEM_LEN after we update the binman dtsi to drop 0x8000/0x4000 length for the firmware.
And that could save binary size for many KBs.
Signed-off-by Peng Fan <[email protected]>--- drivers/ddr/imx/imx8m/helper.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)drivers/ddr/imx/imx8m/helper.c +44
-10@@ -4,6 +4,7 @@*/ #include <common.h> +#include <binman_sym.h> #include <log.h> #include <spl.h> #include <asm/global_data.h> @@ -25,15 +26,30 @@ DECLARE_GLOBAL_DATA_PTR;#define DMEM_OFFSET_ADDR 0x00054000#define DDR_TRAIN_CODE_BASE_ADDR IP2APB_DDRPHY_IPS_BASE_ADDR(0) +binman_sym_declare (ulong, blob_ext_1, image_pos); +binman_sym_declare (ulong, blob_ext_1, size); + +binman_sym_declare (ulong, blob_ext_2, image_pos); +binman_sym_declare (ulong, blob_ext_2, size); + +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) +binman_sym_declare (ulong, blob_ext_3, image_pos); +binman_sym_declare (ulong, blob_ext_3, size); + +binman_sym_declare (ulong, blob_ext_4, image_pos); +binman_sym_declare (ulong, blob_ext_4, size); +#endif +/* We need PHY iMEM PHY is 32KB padded */ void ddr_load_train_firmware (enum fw_type type) {u32 tmp32, i;u32 error =0 ; -unsigned long pr_to32, pr_from32; -unsigned long fw_offset = type ?IMEM_2D_OFFSET :0 ; -unsigned long imem_start = (unsigned long )&_end + fw_offset; -unsigned long dmem_start; +uint32_t pr_to32, pr_from32; +uint32_t fw_offset = type ?IMEM_2D_OFFSET :0 ; +uint32_t imem_start = (uint32_t )&_end + fw_offset; +uint32_t dmem_start; +uint32_t imem_len =IMEM_LEN , dmem_len =DMEM_LEN ;#ifdef CONFIG_SPL_OF_CONTROL if (gd->fdt_blob && !fdt_check_header (gd->fdt_blob)) {@@ -43,11 +59,30 @@ void ddr_load_train_firmware(enum fw_type type) }#endif - dmem_start = imem_start +IMEM_LEN ; +if (CONFIG_IS_ENABLED (BINMAN_SYMBOLS )) { +switch (type) { +case FW_1D_IMAGE : + imem_start =binman_sym (ulong, blob_ext_1, image_pos); + imem_len =binman_sym (ulong, blob_ext_1, size); + dmem_start =binman_sym (ulong, blob_ext_2, image_pos); + dmem_len =binman_sym (ulong, blob_ext_2, size); +break ; +case FW_2D_IMAGE : +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) + imem_start =binman_sym (ulong, blob_ext_3, image_pos); + imem_len =binman_sym (ulong, blob_ext_3, size); + dmem_start =binman_sym (ulong, blob_ext_4, image_pos); + dmem_len =binman_sym (ulong, blob_ext_4, size); +#endif +break ; + } + } + + dmem_start = imem_start + imem_len; pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;@@ -59,7 +94,7 @@ void ddr_load_train_firmware(enum fw_type type) pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ; ) { +for (i =0x0 ; i < dmem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;@@ -72,7 +107,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr_pmu_train_imem code\n" ); pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 );@@ -93,7 +128,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr4_pmu_train_dmem code\n" ); pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ;) { +for (i =0x0 ; i < dmem_len;) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); --
Quoted 2 lines
2.36.0
Peng,
While this compiles and works, it generates a lot of warnings due to cating from pointer to integer of diff size:
CC spl/drivers/ddr/imx/imx8m/helper.odrivers/ddr/imx/imx8m/helper.c: In function ‘ddr_load_train_firmware’:drivers/ddr/imx/imx8m/helper.c:50:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
uint32_t imem_start = (uint32_t)&_end + fw_offset;
^
In file included from drivers/ddr/imx/imx8m/helper.c:11:
./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getl(a) (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’
#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:86:11: note: in expansion of macro ‘readl’
tmp32 = readl(pr_from32);
^~~~~
./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
^
./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’
#define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
^~~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:87:3: note: in expansion of macro ‘writew’
writew(tmp32 & 0x0000ffff, pr_to32);
^~~~~~./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
^
./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’
#define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
^~~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:89:3: note: in expansion of macro ‘writew’
writew((tmp32 >> 16) & 0x0000ffff, pr_to32);
^~~~~~./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define __arch_getl(a) (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’
#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:98:11: note: in expansion of macro ‘readl’
tmp32 = readl(pr_from32);
^~~~~
./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
^
./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’
#define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
^~~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:99:3: note: in expansion of macro ‘writew’
writew(tmp32 & 0x0000ffff, pr_to32);
^~~~~~./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
^
./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’
#define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
^~~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:101:3: note: in expansion of macro ‘writew’
writew((tmp32 >> 16) & 0x0000ffff, pr_to32);
^~~~~~./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define __arch_getw(a) (*(volatile unsigned short *)(a))
^
./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’
#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:111:12: note: in expansion of macro ‘readw’
tmp32 = (readw(pr_to32) & 0x0000ffff);
^~~~~
./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getw(a) (*(volatile unsigned short *)(a))
^
./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’
#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:113:14: note: in expansion of macro ‘readw’
tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16);
^~~~~
./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getl(a) (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’
#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:115:16: note: in expansion of macro ‘readl’
if (tmp32 != readl(pr_from32)) {
^~~~~
In file included from include/linux/printk.h:4,
from include/linux/kernel.h:5,
from include/linux/bitops.h:22,
from ./arch/arm/include/asm/arch/imx-regs.h:87,
from include/configs/imx8m.h:11,
from include/configs/imx8mm_venice.h:9,
from include/config.h:4,
from include/common.h:16,
from drivers/ddr/imx/imx8m/helper.c:6:
drivers/ddr/imx/imx8m/helper.c:116:10: warning: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 2 has type
‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=]
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~~~~~~~
include/log.h:165:21: note: in definition of macro ‘pr_fmt’
#define pr_fmt(fmt) fmt
^~~include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:116:4: note: in expansion of macro ‘debug’
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~
drivers/ddr/imx/imx8m/helper.c:116:10: warning: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 3 has type
‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=]
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~~~~~~~
include/log.h:165:21: note: in definition of macro ‘pr_fmt’
#define pr_fmt(fmt) fmt
^~~include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:116:4: note: in expansion of macro ‘debug’
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~
In file included from drivers/ddr/imx/imx8m/helper.c:11:
./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getw(a) (*(volatile unsigned short *)(a))
^
./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’
#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:132:12: note: in expansion of macro ‘readw’
tmp32 = (readw(pr_to32) & 0x0000ffff);
^~~~~
./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getw(a) (*(volatile unsigned short *)(a))
^
./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’
#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:134:14: note: in expansion of macro ‘readw’
tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16);
^~~~~
./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
#define __arch_getl(a) (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’
#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
^~~~~~~~~~~
drivers/ddr/imx/imx8m/helper.c:135:16: note: in expansion of macro ‘readl’
if (tmp32 != readl(pr_from32)) {
^~~~~
In file included from include/linux/printk.h:4,
from include/linux/kernel.h:5,
from include/linux/bitops.h:22,
from ./arch/arm/include/asm/arch/imx-regs.h:87,
from include/configs/imx8m.h:11,
from include/configs/imx8mm_venice.h:9,
from include/config.h:4,
from include/common.h:16,
from drivers/ddr/imx/imx8m/helper.c:6:
drivers/ddr/imx/imx8m/helper.c:136:10: warning: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 2 has type
‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=]
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~~~~~~~
include/log.h:165:21: note: in definition of macro ‘pr_fmt’
#define pr_fmt(fmt) fmt
^~~include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:136:4: note: in expansion of macro ‘debug’
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~
drivers/ddr/imx/imx8m/helper.c:136:10: warning: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 3 has type
‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=]
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~~~~~~~
include/log.h:165:21: note: in definition of macro ‘pr_fmt’
#define pr_fmt(fmt) fmt
^~~include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:136:4: note: in expansion of macro ‘debug’
debug("%lx %lx\n", pr_from32, pr_to32);
^~~~~Best Regards,
Tim
RE: [PATCH V2 5/7] ddr: imx8m: helper: load ddr firmware according to binman symbols
Tim,
Quoted 131 lines
Subject: Re: [PATCH V2 5/7] ddr: imx8m: helper: load ddr firmware according to binman symbols
Quoted 5 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
By reading binman symbols, we no need hard coded IMEM_LEN/DMEM_LEN after we update the binman dtsi to drop 0x8000/0x4000 length for the
firmware.
drivers/ddr/imx/imx8m/helper.c DECLARE_GLOBAL_DATA_PTR; #define
Quoted 22 lines
And that could save binary size for many KBs.
Signed-off-by Peng Fan <[email protected]>--- drivers/ddr/imx/imx8m/helper.c | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/ddr/imx/imx8m/helper.cindexf23904bf712..b10ba602665100644drivers/ddr/imx/imx8m/helper.c +1
-0@@ -4,6 +4,7 @@*/ #include <common.h> +#include <binman_sym.h> #include <log.h> #include <spl.h> #include <asm/global_data.h> @@ -25,15 +26,30 @@ DECLARE_GLOBAL_DATA_PTR; #define
DMEM_OFFSET_ADDRQuoted 93 lines
0x00054000#defineDDR_TRAIN_CODE_BASE_ADDRIP2APB_DDRPHY_IPS_BASE_ADDR(0)drivers/ddr/imx/imx8m/helper.c +13
-0+binman_sym_declare (ulong, blob_ext_1, image_pos); +binman_sym_declare (ulong, blob_ext_1, size); + +binman_sym_declare (ulong, blob_ext_2, image_pos); +binman_sym_declare (ulong, blob_ext_2, size); + +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) +binman_sym_declare (ulong, blob_ext_3, image_pos); +binman_sym_declare (ulong, blob_ext_3, size); + +binman_sym_declare (ulong, blob_ext_4, image_pos); +binman_sym_declare (ulong, blob_ext_4, size);#endif +/* We need PHY iMEM PHY is 32KB padded */ void ddr_load_train_firmware(enum fw_type type) { u32 tmp32, i; u32 error = 0;drivers/ddr/imx/imx8m/helper.c +29
-12-unsigned long pr_to32, pr_from32; -unsigned long fw_offset = type ?IMEM_2D_OFFSET :0 ; -unsigned long imem_start = (unsigned long )&_end + fw_offset; -unsigned long dmem_start; +uint32_t pr_to32, pr_from32; +uint32_t fw_offset = type ?IMEM_2D_OFFSET :0 ; +uint32_t imem_start = (uint32_t )&_end + fw_offset; +uint32_t dmem_start; +uint32_t imem_len =IMEM_LEN , dmem_len =DMEM_LEN ;#ifdef CONFIG_SPL_OF_CONTROL if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) { @@ -43,11 +59,30 @@ void ddr_load_train_firmware(enum fw_type type) }#endif - dmem_start = imem_start +IMEM_LEN ; +if (CONFIG_IS_ENABLED (BINMAN_SYMBOLS )) { +switch (type) { +case FW_1D_IMAGE : + imem_start =binman_sym (ulong, blob_ext_1, image_pos); + imem_len =binman_sym (ulong, blob_ext_1, size); + dmem_start =binman_sym (ulong, blob_ext_2, image_pos); + dmem_len =binman_sym (ulong, blob_ext_2, size); +break ; +case FW_2D_IMAGE : +#if !IS_ENABLED (CONFIG_IMX8M_DDR3L ) + imem_start =binman_sym (ulong, blob_ext_3, image_pos); + imem_len =binman_sym (ulong, blob_ext_3, size); + dmem_start =binman_sym (ulong, blob_ext_4, image_pos); + dmem_len =binman_sym (ulong, blob_ext_4, +size);#endif +break ; + } + } + + dmem_start = imem_start + imem_len; pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;@@ -59,7 +94,7 @@ void ddr_load_train_firmware(enum fw_type type) pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ; ) { +for (i =0x0 ; i < dmem_len; ) { tmp32 =readl (pr_from32);writew (tmp32 &0x0000ffff , pr_to32); pr_to32 +=4 ;@@ -72,7 +107,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr_pmu_train_imem code\n" ); pr_from32 = imem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; -for (i =0x0 ; i <IMEM_LEN ; ) { +for (i =0x0 ; i < imem_len; ) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16); @@ -93,7 +128,7 @@ void ddr_load_train_firmware(enum fw_type type)debug ("check ddr4_pmu_train_dmem code\n" ); pr_from32 = dmem_start; pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; -for (i =0x0 ; i <DMEM_LEN ;) { +for (i =0x0 ; i < dmem_len;) { tmp32 = (readw (pr_to32) &0x0000ffff ); pr_to32 +=4 ; tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); --Quoted 2 lines
2.36.0
Peng,
Quoted 7 lines
While this compiles and works, it generates a lot of warnings due to cating from pointer to integer of diff size:
CCspl/drivers/ddr/imx/imx8m/helper.odrivers/ddr/imx/imx8m/helper.c: In function ‘ddr_load_train_firmware’:drivers/ddr/imx/imx8m/helper.c:50:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
uint32_timem_start= (uint32_t)&_end +fw_offset;
I not met this warning. Maybe toolchain version, anyway let me check.
Thanks,
Peng.
Quoted 201 lines
^ In file included from drivers/ddr/imx/imx8m/helper.c:11: ./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getl(a) (*(volatile unsigned int *)(a)) ^ ./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’ #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:86:11: note: in expansion of macro ‘readl’ tmp32 = readl(pr_from32); ^~~~~ ./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) ^ ./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’ #define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:87:3: note: in expansion of macro ‘writew’ writew(tmp32 & 0x0000ffff, pr_to32); ^~~~~~ ./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) ^ ./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’ #define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:89:3: note: in expansion of macro ‘writew’ writew((tmp32 >> 16) & 0x0000ffff, pr_to32); ^~~~~~ ./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getl(a) (*(volatile unsigned int *)(a)) ^ ./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’ #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:98:11: note: in expansion of macro ‘readl’ tmp32 = readl(pr_from32); ^~~~~ ./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) ^ ./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’ #define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:99:3: note: in expansion of macro ‘writew’ writew(tmp32 & 0x0000ffff, pr_to32); ^~~~~~ ./arch/arm/include/asm/io.h:30:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) ^ ./arch/arm/include/asm/io.h:102:48: note: in expansion of macro ‘__arch_putw’ #define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:101:3: note: in expansion of macro ‘writew’ writew((tmp32 >> 16) & 0x0000ffff, pr_to32); ^~~~~~ ./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getw(a) (*(volatile unsigned short *)(a)) ^ ./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’ #define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:111:12: note: in expansion of macro ‘readw’ tmp32 = (readw(pr_to32) & 0x0000ffff); ^~~~~ ./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getw(a) (*(volatile unsigned short *)(a)) ^ ./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’ #define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:113:14: note: in expansion of macro ‘readw’ tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16); ^~~~~ ./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getl(a) (*(volatile unsigned int *)(a)) ^ ./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’ #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:115:16: note: in expansion of macro ‘readl’ if (tmp32 != readl(pr_from32)) { ^~~~~ In file included from include/linux/printk.h:4, from include/linux/kernel.h:5, from include/linux/bitops.h:22, from ./arch/arm/include/asm/arch/imx-regs.h:87, from include/configs/imx8m.h:11, from include/configs/imx8mm_venice.h:9, from include/config.h:4, from include/common.h:16, from drivers/ddr/imx/imx8m/helper.c:6: drivers/ddr/imx/imx8m/helper.c:116:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=] debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~~~~~~~ include/log.h:165:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~
include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:116:4: note: in expansion of macro ‘debug’debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~ drivers/ddr/imx/imx8m/helper.c:116:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=] debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~~~~~~~ include/log.h:165:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~
include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:116:4: note: in expansion of macro ‘debug’debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~ In file included from drivers/ddr/imx/imx8m/helper.c:11: ./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getw(a) (*(volatile unsigned short *)(a)) ^ ./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’ #define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:132:12: note: in expansion of macro ‘readw’ tmp32 = (readw(pr_to32) & 0x0000ffff); ^~~~~ ./arch/arm/include/asm/io.h:25:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getw(a) (*(volatile unsigned short *)(a)) ^ ./arch/arm/include/asm/io.h:107:31: note: in expansion of macro ‘__arch_getw’ #define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:134:14: note: in expansion of macro ‘readw’ tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16); ^~~~~ ./arch/arm/include/asm/io.h:26:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define __arch_getl(a) (*(volatile unsigned int *)(a)) ^ ./arch/arm/include/asm/io.h:108:31: note: in expansion of macro ‘__arch_getl’ #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) ^~~~~~~~~~~ drivers/ddr/imx/imx8m/helper.c:135:16: note: in expansion of macro ‘readl’ if (tmp32 != readl(pr_from32)) { ^~~~~ In file included from include/linux/printk.h:4, from include/linux/kernel.h:5, from include/linux/bitops.h:22, from ./arch/arm/include/asm/arch/imx-regs.h:87, from include/configs/imx8m.h:11, from include/configs/imx8mm_venice.h:9, from include/config.h:4, from include/common.h:16, from drivers/ddr/imx/imx8m/helper.c:6: drivers/ddr/imx/imx8m/helper.c:136:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=] debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~~~~~~~ include/log.h:165:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~
include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:136:4: note: in expansion of macro ‘debug’debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~ drivers/ddr/imx/imx8m/helper.c:136:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned in ’} [-Wformat=] debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~~~~~~~ include/log.h:165:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~
include/log.h:285:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/ddr/imx/imx8m/helper.c:136:4: note: in expansion of macro ‘debug’debug("%lx %lx\n", pr_from32, pr_to32); ^~~~~Best Regards,
Tim
PATCH v2 6/7 arm: dts: imx8m: shrink ddr firmware size to actual file size
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
After we switch to use BINMAN_SYMBOLS, there is no need to pad the file size to 0x8000 and 0x4000. After we use BINMAN_SYMBOLS, the u-boot-spl-ddr.bin shrink about 36KB with i.MX8MP-EVK.
--- arch/arm/dts/imx8mm-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-evk-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mn-venice-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mp-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mq-cm-u-boot.dtsi | 8 ++++---- arch/arm/dts/imx8mq-u-boot.dtsi | 8 ++++---- 9 files changed, 36 insertions(+), 36 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +4 -4
@@ -41,25 +41,25 @@ imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; };
arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi +4 -4
@@ -149,22 +149,22 @@ blob_1: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_2: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; blob_3: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_4: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; };
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +4 -4
@@ -157,22 +157,22 @@ blob_1: blob-ext@1 { filename = "ddr4_imem_1d_201810.bin"; - size = <0x8000>; + align-end = <4>; }; blob_2: blob-ext@2 { filename = "ddr4_dmem_1d_201810.bin"; - size = <0x4000>; + align-end = <4>; }; blob_3: blob-ext@3 { filename = "ddr4_imem_2d_201810.bin"; - size = <0x8000>; + align-end = <4>; }; blob_4: blob-ext@4 { filename = "ddr4_dmem_2d_201810.bin"; - size = <0x4000>; + align-end = <4>; }; };
arch/arm/dts/imx8mn-evk-u-boot.dtsi +4 -4
@@ -38,22 +38,22 @@ blob_1: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_2: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; blob_3: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_4: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; };
arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi +4 -4
@@ -132,25 +132,25 @@ 1d-imem { filename = "ddr4_imem_1d.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; 1d_dmem { filename = "ddr4_dmem_1d.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; 2d_imem { filename = "ddr4_imem_2d.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; 2d_dmem { filename = "ddr4_dmem_2d.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; };
arch/arm/dts/imx8mn-venice-u-boot.dtsi +4 -4
@@ -128,25 +128,25 @@ imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; };
arch/arm/dts/imx8mp-u-boot.dtsi +4 -4
@@ -63,22 +63,22 @@ blob_1: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem_202006.bin"; - size = <0x8000>; + align-end = <4>; }; blob_2: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem_202006.bin"; - size = <0x4000>; + align-end = <4>; }; blob_3: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem_202006.bin"; - size = <0x8000>; + align-end = <4>; }; blob_4: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem_202006.bin"; - size = <0x4000>; + align-end = <4>; }; };
arch/arm/dts/imx8mq-cm-u-boot.dtsi +4 -4
@@ -30,22 +30,22 @@ blob_1: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_2: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; blob_3: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; }; blob_4: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; }; };
arch/arm/dts/imx8mq-u-boot.dtsi +4 -4
@@ -48,25 +48,25 @@ imem_1d: blob-ext@1 { filename = "lpddr4_pmu_train_1d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_1d: blob-ext@2 { filename = "lpddr4_pmu_train_1d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; imem_2d: blob-ext@3 { filename = "lpddr4_pmu_train_2d_imem.bin"; - size = <0x8000>; + align-end = <4>; type = "blob-ext"; }; dmem_2d: blob-ext@4 { filename = "lpddr4_pmu_train_2d_dmem.bin"; - size = <0x4000>; + align-end = <4>; type = "blob-ext"; }; };
Signature · 1 line
2.36.0
PATCH v2 7/7 binman_sym: guard with CONFIG_SPL_BINMAN_SYMBOLS
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.
--- include/binman_sym.h | 2 +- tools/binman/test/u_boot_binman_syms.c | 1 + tools/binman/test/u_boot_binman_syms_size.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
include/binman_sym.h +1 -1
@@ -13,7 +13,7 @@#define BINMAN_SYM_MISSING (-1UL) -#ifdef CONFIG_BINMAN +#ifdef CONFIG_SPL_BINMAN_SYMBOLS /** * binman_symname() - Internal function to get a binman symbol name
tools/binman/test/u_boot_binman_syms.c +1 -0
@@ -6,6 +6,7 @@*/ #define CONFIG_BINMAN +#define CONFIG_SPL_BINMAN_SYMBOLS #include <binman_sym.h> binman_sym_declare(unsigned long, u_boot_spl_any, offset);
tools/binman/test/u_boot_binman_syms_size.c +1 -0
@@ -6,6 +6,7 @@*/ #define CONFIG_BINMAN +#define CONFIG_SPL_BINMAN_SYMBOLS #include <binman_sym.h> binman_sym_declare (char, u_boot_spl, pos);
Signature · 1 line
2.36.0
Re: [PATCH V2 7/7] binman_sym: guard with CONFIG_SPL_BINMAN_SYMBOLS
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
There is case that
CONFIG_BINMANis defined, butCONFIG_SPL_BINMAN_SYMBOLSis not defined. In that case, there will be build failure. So useCONFIG_SPL_BINMAN_SYMBOLSto guard the macros, and defineCONFIG_SPL_BINMAN_SYMBOLSin binman syms test.Signed-off-by Peng Fan <[email protected]>
Signature · 1 line
Tom