Skip to contentSkip to conversation

configs: keystone2: Remove unused SPL_MALLOC_F_SIZE and KEYSTONE_SPL_STACK_SIZE

PATCH In review Andrew Davis 3 participants 13 messages Nov 17, 2023 – Nov 29, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 configs: keystone2: Remove unused SPL_MALLOC_F_SIZE and KEYSTONE_SPL_STACK_SIZE

These are leftover definitions. While here cleanup some leftover comments.

---
 include/configs/ti_armv7_keystone2.h | 22 ----------------------
 1 file changed, 22 deletions(-)
include/configs/ti_armv7_keystone2.h +0 -22
index 72c04d8a994..637e9e4369e 100644
@@ -9,23 +9,10 @@
 #ifndef __CONFIG_KS2_EVM_H
 #define __CONFIG_KS2_EVM_H
 
-/* U-Boot Build Configuration */
-
-/* SoC Configuration */
-
 /* Memory Configuration */
 #define CFG_SYS_LPAE_SDRAM_BASE	0x800000000
 #define CFG_MAX_RAM_BANK_SIZE	(2 << 30)       /* 2GB */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-#define SPL_MALLOC_F_SIZE	CONFIG_SYS_MALLOC_F_LEN
-#else
-#define SPL_MALLOC_F_SIZE	0
-#endif
-
-/* SPL SPI Loader Configuration */
-#define KEYSTONE_SPL_STACK_SIZE		(8 * 1024)
-
 /* SRAM scratch space entries  */
 #define SRAM_SCRATCH_SPACE_ADDR		0xc0c23fc
 
@@ -53,8 +40,6 @@
 #define CFG_KSNET_SERDES_SGMII2_BASE		KS2_SGMII_SERDES2_BASE
 #define CFG_KSNET_SERDES_LANES_PER_SGMII	KS2_LANES_PER_SGMII_SERDES
 
-/* EEPROM definitions */
-
 /* NAND Configuration */
 #define CFG_SYS_NAND_MASK_CLE		0x4000
 #define CFG_SYS_NAND_MASK_ALE		0x2000
@@ -63,13 +48,6 @@
 #define CFG_SYS_NAND_LARGEPAGE
 #define CFG_SYS_NAND_BASE_LIST		{ 0x30000000, }
 
-
-
-/* U-Boot general configuration */
-
-/* EDMA3 */
-
-
 /* Now for the remaining common defines */
 #include <configs/ti_armv7_common.h>
 
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/3 configs: keystone2: Do not include hardware.h

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
 drivers/memory/ti-aemif.c            | 1 +
 drivers/soc/ti/keystone_serdes.c     | 1 +
 include/configs/ti_armv7_keystone2.h | 1 -
 3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <asm/arch/hardware.h>
 #include <asm/ti-common/ti-aemif.h>
 
 #define AEMIF_WAITCYCLE_CONFIG		(KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +1 -0
index 2ece1a8f647..0e1bf8ff39d 100644
@@ -8,6 +8,7 @@
 
 #include <errno.h>
 #include <common.h>
+#include <asm/io.h>
 #include <asm/ti-common/keystone_serdes.h>
 #include <linux/bitops.h>
 
include/configs/ti_armv7_keystone2.h +0 -1
index 637e9e4369e..b36207cb5d1 100644
@@ -52,7 +52,6 @@
 #include <configs/ti_armv7_common.h>
 
 /* we may include files below only after all above definitions */
-#include <asm/arch/hardware.h>
 #include <asm/arch/clock.h>
 #ifndef CONFIG_SOC_K2G
 #define CFG_SYS_HZ_CLOCK		ks_clk_get_rate(KS2_CLK1_6)
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

Quoted 27 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
 drivers/memory/ti-aemif.c            | 1 +
 drivers/soc/ti/keystone_serdes.c     | 1 +
 include/configs/ti_armv7_keystone2.h | 1 -
 3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <asm/arch/hardware.h>
 #include <asm/ti-common/ti-aemif.h>
 
 #define AEMIF_WAITCYCLE_CONFIG		(KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +0 -0
index 2ece1a8f647..0e1bf8ff39d 100644

drivers/soc/ti/keystone_serdes.c line 14

Quoted 7 lines
drivers/soc/ti/keystone_serdes.c +1 -0
@@ -8,6 +8,7 @@
 
 #include <errno.h>
 #include <common.h>
+#include <asm/io.h>
 #include <asm/ti-common/keystone_serdes.h>
 #include <linux/bitops.h>
 

Is there going to be a follow-up to remove common.h from these files then? Thanks.

Signature · 1 line
Tom
#3 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

Quoted 30 lines · Tom Rini
Quoted 28 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
  drivers/memory/ti-aemif.c            | 1 +
  drivers/soc/ti/keystone_serdes.c     | 1 +
  include/configs/ti_armv7_keystone2.h | 1 -
  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
   */
 
  #include <common.h>
+#include <asm/arch/hardware.h>
  #include <asm/ti-common/ti-aemif.h>
 
  #define AEMIF_WAITCYCLE_CONFIG		(KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +0 -0
index 2ece1a8f647..0e1bf8ff39d 100644
@@ -8,6 +8,7 @@
 
Quoted 10 lines

drivers/soc/ti/keystone_serdes.c line 14

Quoted 6 lines
drivers/soc/ti/keystone_serdes.c +1 -0
  #include <errno.h>
  #include <common.h>
+#include <asm/io.h>
  #include <asm/ti-common/keystone_serdes.h>
  #include <linux/bitops.h>
 

Is there going to be a follow-up to remove common.h from these files then? Thanks.

Yes I can take a look at that next.

Wasn't there some automation around this? Dropping headers from common.h one at a time until it disappears IIRC.

Andrew

#4 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

Quoted 37 lines · Andrew Davis
Quoted 27 lines · Tom Rini
Quoted 25 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
  drivers/memory/ti-aemif.c            | 1 +
  drivers/soc/ti/keystone_serdes.c     | 1 +
  include/configs/ti_armv7_keystone2.h | 1 -
  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
   */
  #include <common.h>
+#include <asm/arch/hardware.h>
  #include <asm/ti-common/ti-aemif.h>
  #define AEMIF_WAITCYCLE_CONFIG		(KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +0 -0
index 2ece1a8f647..0e1bf8ff39d 100644
@@ -8,6 +8,7 @@
Quoted 8 lines

drivers/soc/ti/keystone_serdes.c line 13

Quoted 5 lines
drivers/soc/ti/keystone_serdes.c +1 -0
  #include <errno.h>
  #include <common.h>
+#include <asm/io.h>
  #include <asm/ti-common/keystone_serdes.h>
  #include <linux/bitops.h>

Is there going to be a follow-up to remove common.h from these files then? Thanks.

Quoted 4 lines

Yes I can take a look at that next.

Wasn't there some automation around this? Dropping headers from common.h one at a time until it disappears IIRC.

Simon has posted a python tool he wrote that partially did this, but I wasn't quite happy with the results at the time. It might work out better now, or on top of the series I posted to remove it from include/

Signature · 1 line
Tom
#5 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

Hi Tom,

Quoted 39 lines · Tom Rini
Quoted 37 lines · Andrew Davis
Quoted 35 lines · Tom Rini
Quoted 25 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
  drivers/memory/ti-aemif.c            | 1 +
  drivers/soc/ti/keystone_serdes.c     | 1 +
  include/configs/ti_armv7_keystone2.h | 1 -
  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
   */
  #include <common.h>
+#include <asm/arch/hardware.h>
  #include <asm/ti-common/ti-aemif.h>
  #define AEMIF_WAITCYCLE_CONFIG          (KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +0 -0
index 2ece1a8f647..0e1bf8ff39d 100644

drivers/soc/ti/keystone_serdes.c line 12

Quoted 5 lines
drivers/soc/ti/keystone_serdes.c +1 -0
@@ -8,6 +8,7 @@
  #include <errno.h>
  #include <common.h>
+#include <asm/io.h>
  #include <asm/ti-common/keystone_serdes.h>
  #include <linux/bitops.h>

Is there going to be a follow-up to remove common.h from these files then? Thanks.

Quoted 8 lines
Quoted 4 lines

Yes I can take a look at that next.

Wasn't there some automation around this? Dropping headers from common.h one at a time until it disappears IIRC.

Simon has posted a python tool he wrote that partially did this, but I wasn't quite happy with the results at the time. It might work out better now, or on top of the series I posted to remove it from include/

My tool inserts #includes based on the symbols referenced in a file. For example, reference to strcpy() or memcmp() would result in the script adding '#include <linux/string.h>' to the top of the file.

I still believe this is a reasonable approach. My original series to handle this was posted at [1] over 3 years ago. It foundered in part due to the number of files it touched, but I still believe the principle of 'include what you use' makes sense in U-Boot.

Other problems are that in a few cases it results in some ugly code, or misordering of includes

On the plus side, it gets us past this problem. We shouldn't make perfect an enemy of good and I am disappointed that we are still trying to get this over the line.

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=193754&state=*

#6 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

Quoted 47 lines · Simon Glass

Hi Tom,

Quoted 44 lines · Tom Rini
Quoted 41 lines · Andrew Davis
Quoted 27 lines · Tom Rini
Quoted 25 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

---
  drivers/memory/ti-aemif.c            | 1 +
  drivers/soc/ti/keystone_serdes.c     | 1 +
  include/configs/ti_armv7_keystone2.h | 1 -
  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/memory/ti-aemif.c +1 -0
index c4bc88c1510..41325eb0f94 100644
@@ -7,6 +7,7 @@
   */
  #include <common.h>
+#include <asm/arch/hardware.h>
  #include <asm/ti-common/ti-aemif.h>
  #define AEMIF_WAITCYCLE_CONFIG          (KS2_AEMIF_CNTRL_BASE + 0x4)
drivers/soc/ti/keystone_serdes.c +0 -0
index 2ece1a8f647..0e1bf8ff39d 100644
@@ -8,6 +8,7 @@
Quoted 8 lines

drivers/soc/ti/keystone_serdes.c line 13

Quoted 5 lines
drivers/soc/ti/keystone_serdes.c +1 -0
  #include <errno.h>
  #include <common.h>
+#include <asm/io.h>
  #include <asm/ti-common/keystone_serdes.h>
  #include <linux/bitops.h>

Is there going to be a follow-up to remove common.h from these files then? Thanks.

Yes I can take a look at that next.

Wasn't there some automation around this? Dropping headers from common.h one at a time until it disappears IIRC.

Quoted 7 lines
Quoted 3 lines

Simon has posted a python tool he wrote that partially did this, but I wasn't quite happy with the results at the time. It might work out better now, or on top of the series I posted to remove it from include/

My tool inserts #includes based on the symbols referenced in a file. For example, reference to strcpy() or memcmp() would result in the script adding '#include <linux/string.h>' to the top of the file.

But that's not how we typically work, nor is it how the kernel works. In a semi-current kernel tree:

$ git grep -l '<linux/string.h>' *.c | wc -l
2177
$ git grep -l '<linux/string.h>' *.h | wc -l
146
$ git grep -l 'memset(' *.c | wc -l
6957

So most C files that call memset(..) get <linux/string.h> indirectly. Which is why I'm trying to clean up the header files first.

Quoted 11 lines

I still believe this is a reasonable approach. My original series to handle this was posted at [1] over 3 years ago. It foundered in part due to the number of files it touched, but I still believe the principle of 'include what you use' makes sense in U-Boot.

Other problems are that in a few cases it results in some ugly code, or misordering of includes

On the plus side, it gets us past this problem. We shouldn't make perfect an enemy of good and I am disappointed that we are still trying to get this over the line.

What makes this hard to get over the line is the less clear examples. Dealing with <config.h> and CFG symbols gets pretty odd. And the failure in https://source.denx.de/u-boot/u-boot/-/jobs/739662 was just really odd.

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH 2/3] configs: keystone2: Do not include hardware.h

In reply to Andrew Davis
Quoted 4 lines · Andrew Davis

This is a hacky way to have this file included in all source files that include common.h, instead just include from the files that need it.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
#8 lore raw

PATCH 3/3 ARM: keystone2: Remove unneeded inclusions of common.h

In reply to Andrew Davis
---
 arch/arm/mach-keystone/clock.c                | 1 -
 arch/arm/mach-keystone/cmd_clock.c            | 2 +-
 arch/arm/mach-keystone/cmd_mon.c              | 1 -
 arch/arm/mach-keystone/cmd_poweroff.c         | 1 -
 arch/arm/mach-keystone/ddr3.c                 | 2 +-
 arch/arm/mach-keystone/ddr3_spd.c             | 2 +-
 arch/arm/mach-keystone/include/mach/mux-k2g.h | 1 -
 arch/arm/mach-keystone/init.c                 | 1 -
 arch/arm/mach-keystone/keystone.c             | 1 -
 arch/arm/mach-keystone/mon.c                  | 1 -
 arch/arm/mach-keystone/msmc.c                 | 1 -
 arch/arm/mach-keystone/psc.c                  | 1 -
 12 files changed, 3 insertions(+), 12 deletions(-)
arch/arm/mach-keystone/clock.c +0 -1
index 0c59515d2eb..4f193794efb 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clock_defs.h>
 #include <linux/bitops.h>
arch/arm/mach-keystone/cmd_clock.c +1 -1
index 72dc394df5f..e9ecc05953a 100644
@@ -6,7 +6,7 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
+#include <vsprintf.h>
 #include <command.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/clock.h>
arch/arm/mach-keystone/cmd_mon.c +0 -1
index dc97bac8550..c6e7e2c3097 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <command.h>
 #include <image.h>
 #include <mach/mon.h>
arch/arm/mach-keystone/cmd_poweroff.c +0 -1
index f0ad9173b96..0ad31ef4e28 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <command.h>
 #include <asm/arch/mon.h>
 #include <asm/arch/psc_defs.h>
arch/arm/mach-keystone/ddr3.c +1 -1
index ea7d0b903cf..ca0fb702d54 100644
@@ -9,7 +9,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <asm/io.h>
-#include <common.h>
+#include <vsprintf.h>
 #include <asm/arch/msmc.h>
 #include <asm/arch/ddr3.h>
 #include <asm/arch/psc_defs.h>
arch/arm/mach-keystone/ddr3_spd.c +1 -1
index 6f7f8ab7b40..d4ff442175b 100644
@@ -5,8 +5,8 @@
  * (C) Copyright 2015-2016 Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <log.h>
+#include <string.h>
 
 #include <i2c.h>
 #include <ddr_spd.h>
arch/arm/mach-keystone/include/mach/mux-k2g.h +0 -1
index 67d47f81721..dfb5ad43506 100644
@@ -9,7 +9,6 @@
 #ifndef __ASM_ARCH_MUX_K2G_H
 #define __ASM_ARCH_MUX_K2G_H
 
-#include <common.h>
 #include <asm/io.h>
 
 #define K2G_PADCFG_REG	(KS2_DEVICE_STATE_CTRL_BASE + 0x1000)
arch/arm/mach-keystone/init.c +0 -1
index 1954e69e9f0..39afaaa63d6 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <cpu_func.h>
 #include <init.h>
 #include <ns16550.h>
arch/arm/mach-keystone/keystone.c +0 -1
index efaabca5a7e..8846df3af48 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <env.h>
 #include <init.h>
 #include <asm/io.h>
arch/arm/mach-keystone/mon.c +0 -1
index e91b0d68f4d..b945e19ec77 100644
@@ -8,7 +8,6 @@
 #include <hang.h>
 #include <image.h>
 #include <asm/unaligned.h>
-#include <common.h>
 #include <command.h>
 #include <mach/mon.h>
 #include <spl.h>
arch/arm/mach-keystone/msmc.c +0 -1
index f5cadfbf669..a20e0c98865 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <asm/arch/msmc.h>
 
 struct mpax {
arch/arm/mach-keystone/psc.c +0 -1
index 145aff8ac66..84d64f3bc40 100644
@@ -6,7 +6,6 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
-#include <common.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
Signature · 1 line
2.39.2
Reviewed-by on v1 3/3
#9 lore raw

Re: [PATCH 3/3] ARM: keystone2: Remove unneeded inclusions of common.h

Quoted 16 lines · Andrew Davis
---
 arch/arm/mach-keystone/clock.c                | 1 -
 arch/arm/mach-keystone/cmd_clock.c            | 2 +-
 arch/arm/mach-keystone/cmd_mon.c              | 1 -
 arch/arm/mach-keystone/cmd_poweroff.c         | 1 -
 arch/arm/mach-keystone/ddr3.c                 | 2 +-
 arch/arm/mach-keystone/ddr3_spd.c             | 2 +-
 arch/arm/mach-keystone/include/mach/mux-k2g.h | 1 -
 arch/arm/mach-keystone/init.c                 | 1 -
 arch/arm/mach-keystone/keystone.c             | 1 -
 arch/arm/mach-keystone/mon.c                  | 1 -
 arch/arm/mach-keystone/msmc.c                 | 1 -
 arch/arm/mach-keystone/psc.c                  | 1 -
 12 files changed, 3 insertions(+), 12 deletions(-)

missing commit message