Skip to contentSkip to conversation

ddr: altera: arria10: Convert SDRAM driver to DM

PATCH Superseded Ley Foon Tan 4 participants 32 messages Apr 15, 2020 – Apr 16, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ddr: altera: arria10: Convert SDRAM driver to DM

This patchset mainly to covert Arria 10 SDRAM driver to device model and fixes few bugs in driver. It also added RAM size check function to check valid RAM.

Ley Foon Tan (7):
ddr: altera: arria10: Fix incorrect address for mpu1
ddr: altera: arria10: Move SDRAM driver to DM
ddr: altera: arria10: Change to use reset DM function
arm: socfpga: arria10: Move sdram_arria10.h to drivers/ddr/altera
ddr: altera: arria10: Add RAM size check
ddr: altera: arria10: Change %i to %u for printf
ddr: altera: arria10: Remove call to dram_init_banksize()

 arch/arm/dts/socfpga_arria10-u-boot.dtsi      |   8 +
 .../include/mach/reset_manager_arria10.h      |   1 -
 arch/arm/mach-socfpga/include/mach/sdram.h    |   2 +-
 arch/arm/mach-socfpga/misc_arria10.c          |   2 +-
 arch/arm/mach-socfpga/reset_manager_arria10.c |   7 -
 arch/arm/mach-socfpga/spl_a10.c               |  14 +-
 drivers/ddr/altera/Kconfig                    |   4 +-
 drivers/ddr/altera/sdram_arria10.c            | 387 ++++++++++--------
 .../ddr/altera}/sdram_arria10.h               | 244 +++--------
 9 files changed, 309 insertions(+), 360 deletions(-)
 rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_arria10.h (72%)
Signature · 1 line
2.19.0
#1 lore raw

PATCH 1/7 ddr: altera: arria10: Fix incorrect address for mpu1

Remove extra "SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS" in mpu1 address.

---
 drivers/ddr/altera/sdram_arria10.c | 1 -
 1 file changed, 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -1
index 2fd50b7ae550..e0779b810fdc 100644
@@ -470,7 +470,6 @@ const struct firewall_entry firewall_table[] = {
 	},
 	{
 		"mpu1",
-		SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS +
 		SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(mpuregion1addr),
 		SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS_OFFSET(enable),
 		ALT_NOC_FW_DDR_SCR_EN_MPUREG1EN_SET_MSK
Signature · 1 line
2.19.0
#2 lore raw

PATCH 1/7 ddr: altera: arria10: Fix incorrect address for mpu1

Quoted 1 line · Ley Foon Tan

Remove extra "SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS" in mpu1 address.

I see what the patch does from the patch itself, but the commit message does not explain _why_ the patch does it. Can you add it ?

[...]

#3 lore raw

PATCH 1/7 ddr: altera: arria10: Fix incorrect address for mpu1

Quoted 10 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, April 15, 2020 8:38 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH 1/7] ddr: altera: arria10: Fix incorrect address for mpu1

Quoted 8 lines
Quoted 1 line · Ley Foon Tan

Remove extra "SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS" in mpu1

address.

I see what the patch does from the patch itself, but the commit message does not explain _why_ the patch does it. Can you add it ?

[...]

Okay.

Regards
Ley Foon

#4 lore raw

PATCH 2/7 ddr: altera: arria10: Move SDRAM driver to DM

In reply to Ley Foon Tan

Convert Arria 10 SDRAM driver to device model.

SPL is changed from calling function in SDRAM driver directly to just probing UCLASS_RAM.

---
 arch/arm/dts/socfpga_arria10-u-boot.dtsi      |   8 +
 .../mach-socfpga/include/mach/sdram_arria10.h | 244 ++++---------
 arch/arm/mach-socfpga/spl_a10.c               |  14 +-
 drivers/ddr/altera/Kconfig                    |   4 +-
 drivers/ddr/altera/sdram_arria10.c            | 334 ++++++++++--------
 5 files changed, 270 insertions(+), 334 deletions(-)
arch/arm/dts/socfpga_arria10-u-boot.dtsi +8 -0
index 6ff1ea6e5eb7..cb576f5288ea 100644
@@ -133,6 +133,14 @@
 	u-boot,dm-pre-reloc;
 };
 
+&sdr {
+	reg = <0xffcfa000 0x11C>,
+	      <0xffcfb000 0x180>,
+	      <0xffd12400 0x1030>;
+	resets = <&rst DDRSCH_RESET>;
+	u-boot,dm-pre-reloc;
+};
+
 &sysmgr {
 	u-boot,dm-pre-reloc;
 };
arch/arm/mach-socfpga/include/mach/sdram_arria10.h +59 -185

256 lines not on this page · raw message

arch/arm/mach-socfpga/spl_a10.c +12 -2
index b10be3326803..3a2080af3aa6 100644
@@ -28,6 +28,7 @@
 #include <asm/arch/fpga_manager.h>
 #include <mmc.h>
 #include <memalign.h>
+#include <dm/uclass.h>
 
 #define FPGA_BUFSIZ	16 * 1024
 
@@ -104,6 +105,8 @@ u32 spl_boot_mode(const u32 boot_device)
 
 void spl_board_init(void)
 {
+	int ret;
+	struct udevice *dev;
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, FPGA_BUFSIZ);
 
 	/* enable console uart printing */
@@ -127,9 +130,16 @@ void spl_board_init(void)
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 	}
 
+#if CONFIG_IS_ENABLED(ALTERA_SDRAM)
 	/* If the IOSSM/full FPGA is already loaded, start DDR */
-	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode())
-		ddr_calibration_sequence();
+	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode()) {
+		ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+		if (ret) {
+			debug("DRAM init failed: %d\n", ret);
+			hang();
+		}
+	}
+#endif
 
 	if (!is_fpgamgr_user_mode())
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
drivers/ddr/altera/Kconfig +2 -2
index 8f590dc5f611..30ee884dcf47 100644
@@ -2,7 +2,7 @@ config SPL_ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver in SPL"
 	depends on SPL
 	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	select RAM
+	select SPL_RAM
 	help
 	  Enable DDR SDRAM controller for the SoCFPGA devices.
drivers/ddr/altera/sdram_arria10.c +189 -145

621 lines not on this page · raw message

Signature · 1 line
2.19.0
#5 lore raw

PATCH 2/7 ddr: altera: arria10: Move SDRAM driver to DM

On 4/15/20 11:00 AM, Ley Foon Tan wrote:
[...]

Quoted 2 lines

+++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h

(quoted diff) +0 -0
@@ -6,76 +6,65 @@

[...]

arch/arm/mach-socfpga/include/mach/sdram_arria10.h line 44

Quoted 6 lines
arch/arm/mach-socfpga/include/mach/sdram_arria10.h +6 -0
+/* FW DDR MPU F2S SCR */
+#define FW_DDR_MPU_F2S_SCR_EN		0x00
+#define FW_DDR_MPU_F2S_SCR_MPUR0	0x10
+#define FW_DDR_MPU_F2S_SCR_MPUR1	0x14
+#define FW_DDR_MPU_F2S_SCR_MPUR2	0x18
+#define FW_DDR_MPU_F2S_SCR_MPUR3	0x1c

These can be:
#define FW_DDR_MPU_F2S_SCR_MPUR(n) (0x10 + (n) * 4)

and the other macros can be reduced in a similar manner.

Quoted 23 lines
arch/arm/mach-socfpga/include/mach/sdram_arria10.h +23 -0
+#define FW_DDR_MPU_F2S_SCR_F2S0_R0	0x20
+#define FW_DDR_MPU_F2S_SCR_F2S0_R1	0x24
+#define FW_DDR_MPU_F2S_SCR_F2S0_R2	0x28
+#define FW_DDR_MPU_F2S_SCR_F2S0_R3	0x2c
+#define FW_DDR_MPU_F2S_SCR_F2S1_R0	0x30
+#define FW_DDR_MPU_F2S_SCR_F2S1_R1	0x34
+#define FW_DDR_MPU_F2S_SCR_F2S1_R2	0x38
+#define FW_DDR_MPU_F2S_SCR_F2S1_R3	0x3c
+#define FW_DDR_MPU_F2S_SCR_F2S2_R0	0x40
+#define FW_DDR_MPU_F2S_SCR_F2S2_R1	0x44
+#define FW_DDR_MPU_F2S_SCR_F2S2_R2	0x48
+#define FW_DDR_MPU_F2S_SCR_F2S2_R3	0x4c
+
+/* FW DDR L3 DDR SCR */
+#define FW_DDR_L3_SCR_EN		0x00
+#define FW_DDR_L3_SCR_HPS_R0_ADDR	0x0c
+#define FW_DDR_L3_SCR_HPS_R1_ADDR	0x10
+#define FW_DDR_L3_SCR_HPS_R2_ADDR	0x14
+#define FW_DDR_L3_SCR_HPS_R3_ADDR	0x18
+#define FW_DDR_L3_SCR_HPS_R4_ADDR	0x1c
+#define FW_DDR_L3_SCR_HPS_R5_ADDR	0x20
+#define FW_DDR_L3_SCR_HPS_R6_ADDR	0x24
+#define FW_DDR_L3_SCR_HPS_R7_ADDR	0x28

[...]

arch/arm/mach-socfpga/spl_a10.c void spl_board_init(void) · line 138

Quoted 8 lines
arch/arm/mach-socfpga/spl_a10.c +5 -2
+#if CONFIG_IS_ENABLED(ALTERA_SDRAM)
 	/* If the IOSSM/full FPGA is already loaded, start DDR */
-	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode())
-		ddr_calibration_sequence();
+	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode()) {
+		ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+		if (ret) {
+			debug("DRAM init failed: %d\n", ret);

This should be printf(), since it's an error, no ?

Quoted 12 lines
arch/arm/mach-socfpga/spl_a10.c +4 -0
+			hang();
+		}
+	}
+#endif
 
 	if (!is_fpgamgr_user_mode())
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
drivers/ddr/altera/Kconfig +0 -0
index 8f590dc5f611..30ee884dcf47 100644

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 6

Quoted 7 lines
drivers/ddr/altera/Kconfig +2 -2
@@ -2,7 +2,7 @@ config SPL_ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver in SPL"
 	depends on SPL
 	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	select RAM
+	select SPL_RAM

Shouldn't this be selected for Arria 10 only ?

[...]

#6 lore raw

PATCH 2/7 ddr: altera: arria10: Move SDRAM driver to DM

Quoted 30 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, April 15, 2020 8:42 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH 2/7] ddr: altera: arria10: Move SDRAM driver to DM

On 4/15/20 11:00 AM, Ley Foon Tan wrote:
[...]

Quoted 2 lines

+++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h

(quoted diff) +0 -0
@@ -6,76 +6,65 @@

[...]

arch/arm/mach-socfpga/include/mach/sdram_arria10.h line 44

Quoted 6 lines
arch/arm/mach-socfpga/include/mach/sdram_arria10.h +6 -0
+/* FW DDR MPU F2S SCR */
+#define FW_DDR_MPU_F2S_SCR_EN		0x00
+#define FW_DDR_MPU_F2S_SCR_MPUR0	0x10
+#define FW_DDR_MPU_F2S_SCR_MPUR1	0x14
+#define FW_DDR_MPU_F2S_SCR_MPUR2	0x18
+#define FW_DDR_MPU_F2S_SCR_MPUR3	0x1c

These can be:
#define FW_DDR_MPU_F2S_SCR_MPUR(n) (0x10 + (n) * 4)

Quoted 1 line

and the other macros can be reduced in a similar manner.

Okay.

Quoted 4 lines

[...]

Quoted 10 lines

arch/arm/mach-socfpga/spl_a10.c void spl_board_init(void) · line 138

Quoted 8 lines
arch/arm/mach-socfpga/spl_a10.c +5 -2
+#if CONFIG_IS_ENABLED(ALTERA_SDRAM)
 	/* If the IOSSM/full FPGA is already loaded, start DDR */
-	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode())
-		ddr_calibration_sequence();
+	if (is_fpgamgr_early_user_mode() || is_fpgamgr_user_mode()) {
+		ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+		if (ret) {
+			debug("DRAM init failed: %d\n", ret);

This should be printf(), since it's an error, no ?

Yes, should use printf().

Quoted 21 lines
Quoted 13 lines
arch/arm/mach-socfpga/spl_a10.c +4 -0
+			hang();
+		}
+	}
+#endif
 
 	if (!is_fpgamgr_user_mode())
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0); diff --git

a/drivers/ddr/altera/Kconfig b/drivers/ddr/altera/Kconfig index 8f590dc5f611..30ee884dcf47 100644

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 4

Quoted 3 lines
drivers/ddr/altera/Kconfig +0 -0
@@ -2,7 +2,7 @@ config SPL_ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver in SPL"
 	depends on SPL
 	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
|| TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
> -	select RAM if TARGET_SOCFPGA_GEN5 ||
TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
> -	select SPL_RAM if TARGET_SOCFPGA_GEN5 ||
TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
Quoted 4 lines

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 6

Quoted 2 lines
drivers/ddr/altera/Kconfig +2 -0
+	select RAM
+	select SPL_RAM

Shouldn't this be selected for Arria 10 only ?

Previously, we select SPL_RAM and RAM for Gen5, S10 and Agilex only. They support device model.
Now, we convert A10 SDRAM driver support device model, so we just need to select SPL_RAM and RAM always, regardless of TARGET.

Regards
Ley Foon

#7 lore raw

PATCH 2/7 ddr: altera: arria10: Move SDRAM driver to DM

On 4/16/20 3:41 AM, Tan, Ley Foon wrote:
[...]

Quoted 11 lines
Quoted 11 lines

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 4

Quoted 8 lines

a/drivers/ddr/altera/Kconfig b/drivers/ddr/altera/Kconfig index 8f590dc5f611..30ee884dcf47 100644

drivers/ddr/altera/Kconfig +0 -0
@@ -2,7 +2,7 @@ config SPL_ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver in SPL"
 	depends on SPL
 	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
|| TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
> -	select RAM if TARGET_SOCFPGA_GEN5 ||
TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
Quoted 8 lines
Quoted 6 lines

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 5

Quoted 1 line
drivers/ddr/altera/Kconfig +0 -1
-	select SPL_RAM if TARGET_SOCFPGA_GEN5 ||

TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX

drivers/ddr/altera/Kconfig config SPL_ALTERA_SDRAM · line 6

Quoted 2 lines
drivers/ddr/altera/Kconfig +2 -0
+	select RAM
+	select SPL_RAM

Shouldn't this be selected for Arria 10 only ?

Previously, we select SPL_RAM and RAM for Gen5, S10 and Agilex only. They support device model.
Now, we convert A10 SDRAM driver support device model, so we just need to select SPL_RAM and RAM always, regardless of TARGET.

All right, I see.

#8 lore raw

PATCH 3/7 ddr: altera: arria10: Change to use reset DM function

In reply to Ley Foon Tan

Change to use reset DM function and remove unused
socfpga_reset_deassert_noc_ddr_scheduler().

---
 .../include/mach/reset_manager_arria10.h      |  1 -
 arch/arm/mach-socfpga/reset_manager_arria10.c |  7 ------
 drivers/ddr/altera/sdram_arria10.c            | 25 ++++++++++---------
 3 files changed, 13 insertions(+), 20 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +0 -1
index 22e4eb33de88..a0fad7c1e2fc 100644
@@ -9,7 +9,6 @@
 #include <dt-bindings/reset/altr,rst-mgr-a10.h>
 
 void socfpga_watchdog_disable(void);
-void socfpga_reset_deassert_noc_ddr_scheduler(void);
 int socfpga_reset_deassert_bridges_handoff(void);
 void socfpga_reset_deassert_osc1wd0(void);
 int socfpga_bridges_reset(void);
arch/arm/mach-socfpga/reset_manager_arria10.c +0 -7
index aa5299415a74..edfe250ec0bc 100644
@@ -62,13 +62,6 @@ void socfpga_watchdog_disable(void)
 		     ALT_RSTMGR_PER1MODRST_WD0_SET_MSK);
 }
 
-/* Release NOC ddr scheduler from reset */
-void socfpga_reset_deassert_noc_ddr_scheduler(void)
-{
-	clrbits_le32(socfpga_get_rstmgr_addr() + RSTMGR_A10_BRGMODRST,
-		     ALT_RSTMGR_BRGMODRST_DDRSCH_SET_MSK);
-}
-
 static int get_bridge_init_val(const void *blob, int compat_id)
 {
 	int node;
drivers/ddr/altera/sdram_arria10.c +13 -12
index a31d45a5bb8e..794c13acfa93 100644
@@ -10,19 +10,21 @@
 #include <fdtdec.h>
 #include <malloc.h>
 #include <ram.h>
+#include <reset.h>
 #include <wait_bit.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
-#include <asm/arch/reset_manager.h>
 #include <asm/arch/sdram.h>
+#include <dm/device_compat.h>
 #include <linux/kernel.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 struct altera_sdram_priv {
 	struct ram_info info;
+	struct reset_ctl_bulk resets;
 };
 
 struct altera_sdram_platdata {
@@ -152,7 +154,7 @@ static int emif_reset(struct altera_sdram_platdata *plat)
 	return 0;
 }
 
-static int ddr_setup(struct altera_sdram_platdata *plat)
+static int sdram_startup(struct altera_sdram_platdata *plat)
 {
 	int i, ret;
 
@@ -198,16 +200,6 @@ static void sdram_init_ecc_bits(u32 size)
 	dcache_disable();
 }
 
-/* Function to startup the SDRAM*/
-static int sdram_startup(struct altera_sdram_platdata *plat)
-{
-	/* Release NOC ddr scheduler from reset */
-	socfpga_reset_deassert_noc_ddr_scheduler();
-
-	/* Bringup the DDR (calibration and configuration) */
-	return ddr_setup(plat);
-}
-
 static u64 sdram_size_calc(struct altera_sdram_platdata *plat)
 {
 	u32 dramaddrw = readl(plat->iohmc + DRAMADDRW);
@@ -703,8 +695,17 @@ static int altera_sdram_ofdata_to_platdata(struct udevice *dev)
 
 static int altera_sdram_probe(struct udevice *dev)
 {
+	int ret;
 	struct altera_sdram_priv *priv = dev_get_priv(dev);
 
+	ret = reset_get_bulk(dev, &priv->resets);
+	if (ret) {
+		dev_err(dev, "Can't get reset: %d\n", ret);
+		return -ENODEV;
+	}
+
+	reset_deassert_bulk(&priv->resets);
+
 	if (ddr_calibration_sequence(dev->platdata) != 0) {
 		puts("SDRAM init failed.\n");
 		goto failed;
Signature · 1 line
2.19.0
#9 lore raw

PATCH 3/7 ddr: altera: arria10: Change to use reset DM function

Quoted 102 lines · Ley Foon Tan

Change to use reset DM function and remove unused
socfpga_reset_deassert_noc_ddr_scheduler().

---
 .../include/mach/reset_manager_arria10.h      |  1 -
 arch/arm/mach-socfpga/reset_manager_arria10.c |  7 ------
 drivers/ddr/altera/sdram_arria10.c            | 25 ++++++++++---------
 3 files changed, 13 insertions(+), 20 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +0 -1
index 22e4eb33de88..a0fad7c1e2fc 100644
@@ -9,7 +9,6 @@
 #include <dt-bindings/reset/altr,rst-mgr-a10.h>
 
 void socfpga_watchdog_disable(void);
-void socfpga_reset_deassert_noc_ddr_scheduler(void);
 int socfpga_reset_deassert_bridges_handoff(void);
 void socfpga_reset_deassert_osc1wd0(void);
 int socfpga_bridges_reset(void);
arch/arm/mach-socfpga/reset_manager_arria10.c +0 -7
index aa5299415a74..edfe250ec0bc 100644
@@ -62,13 +62,6 @@ void socfpga_watchdog_disable(void)
 		     ALT_RSTMGR_PER1MODRST_WD0_SET_MSK);
 }
 
-/* Release NOC ddr scheduler from reset */
-void socfpga_reset_deassert_noc_ddr_scheduler(void)
-{
-	clrbits_le32(socfpga_get_rstmgr_addr() + RSTMGR_A10_BRGMODRST,
-		     ALT_RSTMGR_BRGMODRST_DDRSCH_SET_MSK);
-}
-
 static int get_bridge_init_val(const void *blob, int compat_id)
 {
 	int node;
drivers/ddr/altera/sdram_arria10.c +6 -12
index a31d45a5bb8e..794c13acfa93 100644
@@ -10,19 +10,21 @@
 #include <fdtdec.h>
 #include <malloc.h>
 #include <ram.h>
+#include <reset.h>
 #include <wait_bit.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
-#include <asm/arch/reset_manager.h>
 #include <asm/arch/sdram.h>
+#include <dm/device_compat.h>
 #include <linux/kernel.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 struct altera_sdram_priv {
 	struct ram_info info;
+	struct reset_ctl_bulk resets;
 };
 
 struct altera_sdram_platdata {
@@ -152,7 +154,7 @@ static int emif_reset(struct altera_sdram_platdata *plat)
 	return 0;
 }
 
-static int ddr_setup(struct altera_sdram_platdata *plat)
+static int sdram_startup(struct altera_sdram_platdata *plat)
 {
 	int i, ret;
 
@@ -198,16 +200,6 @@ static void sdram_init_ecc_bits(u32 size)
 	dcache_disable();
 }
 
-/* Function to startup the SDRAM*/
-static int sdram_startup(struct altera_sdram_platdata *plat)
-{
-	/* Release NOC ddr scheduler from reset */
-	socfpga_reset_deassert_noc_ddr_scheduler();
-
-	/* Bringup the DDR (calibration and configuration) */
-	return ddr_setup(plat);
-}
-
 static u64 sdram_size_calc(struct altera_sdram_platdata *plat)
 {
 	u32 dramaddrw = readl(plat->iohmc + DRAMADDRW);
@@ -703,8 +695,17 @@ static int altera_sdram_ofdata_to_platdata(struct udevice *dev)
 
 static int altera_sdram_probe(struct udevice *dev)
 {
+	int ret;
 	struct altera_sdram_priv *priv = dev_get_priv(dev);
 
+	ret = reset_get_bulk(dev, &priv->resets);

drivers/ddr/altera/sdram_arria10.c static int altera_sdram_ofdata_to_platdata(struct udevice *dev) · line 711

Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c +7 -0
+	if (ret) {
+		dev_err(dev, "Can't get reset: %d\n", ret);
+		return -ENODEV;
+	}
+
+	reset_deassert_bulk(&priv->resets);
+
 	if (ddr_calibration_sequence(dev->platdata) != 0) {
 		puts("SDRAM init failed.\n");
 		goto failed;

I think you need to re-assert the reset in the failed: fail path.

#10 lore raw

PATCH 3/7 ddr: altera: arria10: Change to use reset DM function

Quoted 37 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, April 15, 2020 8:43 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH 3/7] ddr: altera: arria10: Change to use reset DM function

Quoted 23 lines · Ley Foon Tan

Change to use reset DM function and remove unused
socfpga_reset_deassert_noc_ddr_scheduler().

---
 .../include/mach/reset_manager_arria10.h      |  1 -
 arch/arm/mach-socfpga/reset_manager_arria10.c |  7 ------
 drivers/ddr/altera/sdram_arria10.c            | 25 ++++++++++---------
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h index 22e4eb33de88..a0fad7c1e2fc 100644

arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +1 -0
@@ -9,7 +9,6 @@
 static int altera_sdram_ofdata_to_platdata(struct udevice *dev)
 
 static int altera_sdram_probe(struct udevice *dev)  {
+	int ret;
 	struct altera_sdram_priv *priv = dev_get_priv(dev);
 
Quoted 14 lines

arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h

Quoted 12 lines
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +8 -0
+	ret = reset_get_bulk(dev, &priv->resets);
+	if (ret) {
+		dev_err(dev, "Can't get reset: %d\n", ret);
+		return -ENODEV;
+	}
+
+	reset_deassert_bulk(&priv->resets);
+
 	if (ddr_calibration_sequence(dev->platdata) != 0) {
 		puts("SDRAM init failed.\n");
 		goto failed;

I think you need to re-assert the reset in the failed: fail path.

Okay.

Thanks.
Regards
Ley Foon

#11 lore raw

PATCH 4/7 arm: socfpga: arria10: Move sdram_arria10.h to drivers/ddr/altera

In reply to Ley Foon Tan

Move sdram_arria10.h to drivers/ddr/altera directory. No functionality change.

---
 arch/arm/mach-socfpga/include/mach/sdram.h                     | 2 +-
 arch/arm/mach-socfpga/misc_arria10.c                           | 2 +-
 drivers/ddr/altera/sdram_arria10.c                             | 3 ++-
 .../include/mach => drivers/ddr/altera}/sdram_arria10.h        | 0
 4 files changed, 4 insertions(+), 3 deletions(-)
 rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_arria10.h (100%)
arch/arm/mach-socfpga/include/mach/sdram.h +1 -1
index 79cb9e6064a2..0a52c1078b5f 100644
@@ -10,7 +10,7 @@
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #include <asm/arch/sdram_gen5.h>
 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
-#include <asm/arch/sdram_arria10.h>
+#include "../../../../../drivers/ddr/altera/sdram_arria10.h"
 #endif
 
 #endif
arch/arm/mach-socfpga/misc_arria10.c +1 -1
index d56349b7f3ea..1ddffaa0ac55 100644
@@ -15,7 +15,7 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/reset_manager_arria10.h>
-#include <asm/arch/sdram_arria10.h>
+#include <asm/arch/sdram.h>
 #include <asm/arch/system_manager.h>
 #include <asm/arch/nic301.h>
 #include <asm/io.h>
drivers/ddr/altera/sdram_arria10.c +2 -1
index 794c13acfa93..6b74423ea789 100644
@@ -16,10 +16,11 @@
 #include <asm/io.h>
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
-#include <asm/arch/sdram.h>
 #include <dm/device_compat.h>
 #include <linux/kernel.h>
 
+#include "sdram_arria10.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 struct altera_sdram_priv {
drivers/ddr/altera/sdram_arria10.h renamed from arch/arm/mach-socfpga/include/mach/sdram_arria10.h +0 -0
similarity index 100%
rename from arch/arm/mach-socfpga/include/mach/sdram_arria10.h
rename to drivers/ddr/altera/sdram_arria10.h
Signature · 1 line
2.19.0
#12 lore raw

PATCH 5/7 ddr: altera: arria10: Add RAM size check

In reply to Ley Foon Tan

Add call to get_ram_size() function to check memory range for valid RAM.

---
 drivers/ddr/altera/sdram_arria10.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +24 -1
index 6b74423ea789..e3f11984a978 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <hang.h>
 #include <malloc.h>
 #include <ram.h>
 #include <reset.h>
@@ -17,7 +18,7 @@
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
 #include <dm/device_compat.h>
-#include <linux/kernel.h>
+#include <linux/sizes.h>
 
 #include "sdram_arria10.h"
 
@@ -671,6 +672,27 @@ static int ddr_calibration_sequence(struct altera_sdram_platdata *plat)
 	return 0;
 }
 
+static void sdram_size_check(struct ram_info *ram)
+{
+	phys_size_t ram_check = 0;
+	phys_size_t size = ram->size;
+	phys_addr_t base = ram->base;
+
+	debug("DDR: Running SDRAM size sanity check\n");
+
+	while (ram_check < size) {
+		ram_check += get_ram_size((void *)(base + ram_check),
+					 (phys_size_t)SZ_1G);
+	}
+
+	if (ram_check != size) {
+		puts("DDR: SDRAM size check failed!\n");
+		hang();
+	}
+
+	debug("DDR: SDRAM size check passed!\n");
+}
+
 static int altera_sdram_ofdata_to_platdata(struct udevice *dev)
 {
 	struct altera_sdram_platdata *plat = dev->platdata;
@@ -715,6 +737,7 @@ static int altera_sdram_probe(struct udevice *dev)
 	priv->info.base = gd->bd->bi_dram[0].start;
 	priv->info.size = gd->ram_size;
 
+	sdram_size_check(&priv->info);
 	return 0;
 
 failed:
Signature · 1 line
2.19.0
#13 lore raw

PATCH 5/7 ddr: altera: arria10: Add RAM size check

Quoted 34 lines · Ley Foon Tan

Add call to get_ram_size() function to check memory range for valid RAM.

---
 drivers/ddr/altera/sdram_arria10.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +3 -1
index 6b74423ea789..e3f11984a978 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <hang.h>
 #include <malloc.h>
 #include <ram.h>
 #include <reset.h>
@@ -17,7 +18,7 @@
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
 #include <dm/device_compat.h>
-#include <linux/kernel.h>
+#include <linux/sizes.h>
 
 #include "sdram_arria10.h"
 
@@ -671,6 +672,27 @@ static int ddr_calibration_sequence(struct altera_sdram_platdata *plat)
 	return 0;
 }
 
+static void sdram_size_check(struct ram_info *ram)

drivers/ddr/altera/sdram_arria10.c static int ddr_calibration_sequence(struct altera_sdram_platdata *plat) · line 685

Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c +10 -0
+{
+	phys_size_t ram_check = 0;
+	phys_size_t size = ram->size;
+	phys_addr_t base = ram->base;
+
+	debug("DDR: Running SDRAM size sanity check\n");
+
+	while (ram_check < size) {
+		ram_check += get_ram_size((void *)(base + ram_check),
+					 (phys_size_t)SZ_1G);

Why is it running in 1 GiB steps ?

#14 lore raw

PATCH 5/7 ddr: altera: arria10: Add RAM size check

Quoted 46 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, April 15, 2020 8:44 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH 5/7] ddr: altera: arria10: Add RAM size check

drivers/ddr/altera/sdram_arria10.c static int ddr_calibration_sequence(struct

Quoted 31 lines · Ley Foon Tan

Add call to get_ram_size() function to check memory range for valid RAM.

---
 drivers/ddr/altera/sdram_arria10.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +2 -1
index 6b74423ea789..e3f11984a978 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <hang.h>
 #include <malloc.h>
 #include <ram.h>
 #include <reset.h>
@@ -17,7 +18,7 @@
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
 #include <dm/device_compat.h>
-#include <linux/kernel.h>
+#include <linux/sizes.h>
 
 #include "sdram_arria10.h"
 
@@ -671,6 +672,27 @@ static int ddr_calibration_sequence(struct

altera_sdram_platdata *plat)

Quoted 3 lines
drivers/ddr/altera/sdram_arria10.c +0 -0
 	return 0;
 }
 
Quoted 12 lines

drivers/ddr/altera/sdram_arria10.c static int ddr_calibration_sequence(struct altera_sdram_platdata *plat) · line 685

Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c +10 -0
+static void sdram_size_check(struct ram_info *ram) {
+	phys_size_t ram_check = 0;
+	phys_size_t size = ram->size;
+	phys_addr_t base = ram->base;
+
+	debug("DDR: Running SDRAM size sanity check\n");
+
+	while (ram_check < size) {
+		ram_check += get_ram_size((void *)(base + ram_check),
+					 (phys_size_t)SZ_1G);

Why is it running in 1 GiB steps ?

Don't have any special reason. I'm following S10/Agilex's implementation. Do you prefer use smaller step size?

Regards
Ley Foon

#15 lore raw

PATCH 5/7 ddr: altera: arria10: Add RAM size check

On 4/16/20 3:34 AM, Tan, Ley Foon wrote:
[...]

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/ddr/altera/sdram_arria10.c +4 -0
+static void sdram_size_check(struct ram_info *ram) {
+	phys_size_t ram_check = 0;
+	phys_size_t size = ram->size;
+	phys_addr_t base = ram->base;
Quoted 8 lines

drivers/ddr/altera/sdram_arria10.c static int ddr_calibration_sequence(struct altera_sdram_platdata *plat) · line 685

Quoted 6 lines
drivers/ddr/altera/sdram_arria10.c +6 -0
+
+	debug("DDR: Running SDRAM size sanity check\n");
+
+	while (ram_check < size) {
+		ram_check += get_ram_size((void *)(base + ram_check),
+					 (phys_size_t)SZ_1G);

Why is it running in 1 GiB steps ?

Quoted 2 lines

Don't have any special reason. I'm following S10/Agilex's implementation. Do you prefer use smaller step size?

Rather, why doesn't it use the entire DRAM size, without the while loop?

#16 lore raw

PATCH 5/7 ddr: altera: arria10: Add RAM size check

Quoted 24 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, April 16, 2020 4:52 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH 5/7] ddr: altera: arria10: Add RAM size check

On 4/16/20 3:34 AM, Tan, Ley Foon wrote:
[...]

Quoted 12 lines
Quoted 12 lines

drivers/ddr/altera/sdram_arria10.c static int ddr_calibration_sequence(struct altera_sdram_platdata *plat) · line 685

Quoted 10 lines
drivers/ddr/altera/sdram_arria10.c +10 -0
+static void sdram_size_check(struct ram_info *ram) {
+	phys_size_t ram_check = 0;
+	phys_size_t size = ram->size;
+	phys_addr_t base = ram->base;
+
+	debug("DDR: Running SDRAM size sanity check\n");
+
+	while (ram_check < size) {
+		ram_check += get_ram_size((void *)(base + ram_check),
+					 (phys_size_t)SZ_1G);

Why is it running in 1 GiB steps ?

Quoted 4 lines
Quoted 2 lines

Don't have any special reason. I'm following S10/Agilex's implementation. Do you prefer use smaller step size?

Rather, why doesn't it use the entire DRAM size, without the while loop?

Yes, can change to entire DRAM size. Will change it.
S10/Agilex have 2 banks of memory, that's why we have the while loop for 2 banks checking. But, A10 only have 1 bank.

Regards
Ley Foon

#17 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

In reply to Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +1 -1
index e3f11984a978..8acf324117af 100644
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");
Signature · 1 line
2.19.0
#18 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 13 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

#19 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 16 lines · Marek Vasut
Quoted 15 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
Quoted 8 lines

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Yes, limited by design, thanks for changing.

Signature · 8 lines
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/20200415/574b3cf1/attachment.sig>
#20 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 26 lines · Tom Rini
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
Quoted 8 lines

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

#21 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Signature · 8 lines
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/20200415/4402a4de/attachment.sig>
#22 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 28 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

#23 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 31 lines · Marek Vasut
Quoted 30 lines · Tom Rini
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Tom Rini
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
Quoted 8 lines

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Yes, limited by design, thanks for changing.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

Signature · 8 lines
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/20200415/4ac1811b/attachment.sig>
#24 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Quoted 6 lines
Quoted 2 lines

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

#25 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 46 lines · Marek Vasut
Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Quoted 6 lines
Quoted 2 lines

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

Quoted 5 lines

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

I hear you saying "I type %i not %d without thinking about it", but I'm telling you, think about it. I will not grow 200+ boards when there's an easy way not to.

Signature · 8 lines
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/20200416/d0897cfd/attachment.sig>
#26 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 47 lines · Tom Rini
Quoted 46 lines · Marek Vasut
Quoted 44 lines · Tom Rini
Quoted 31 lines · Marek Vasut
Quoted 30 lines · Tom Rini
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Tom Rini
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
Quoted 8 lines

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 5 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Yes, limited by design, thanks for changing.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

Quoted 8 lines
Quoted 5 lines

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

I hear you saying "I type %i not %d without thinking about it", but I'm telling you, think about it.

No, it works everywhere else just fine, except U-Boot SPL is special. This is a tiny-printf bug, period.

Quoted 2 lines

I will not grow 200+ boards when there's
an easy way not to.

By ~6 bytes, which happens with almost every DM patch. I am not buying the size argument.

#27 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 54 lines · Marek Vasut
Quoted 53 lines · Tom Rini
Quoted 51 lines · Marek Vasut
Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Quoted 6 lines
Quoted 2 lines

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

Quoted 4 lines
Quoted 2 lines

I hear you saying "I type %i not %d without thinking about it", but I'm telling you, think about it.

No, it works everywhere else just fine, except U-Boot SPL is special.

It works fine in SPL when we use the full printf, which is still a good percent of the boards.

Quoted 1 line

This is a tiny-printf bug, period.

It's a feature of the explicitly reduced functionality printf. It's the whole point of the feature, provide as much output with as little code as we can.

Quoted 6 lines
Quoted 3 lines

I will not grow 200+ boards when there's
an easy way not to.

By ~6 bytes, which happens with almost every DM patch. I am not buying the size argument.

Nope, not true. Boards with tiny printf rarely grow their SPL size from general changes (SoC trees only get scrutiny over growth in platforms outside their area) because I get this annoying about why they grow in size.

Signature · 8 lines
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/20200416/ccb10a68/attachment.sig>
#28 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 60 lines · Tom Rini
Quoted 54 lines · Marek Vasut
Quoted 53 lines · Tom Rini
Quoted 51 lines · Marek Vasut
Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Quoted 6 lines
Quoted 2 lines

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

Quoted 4 lines
Quoted 2 lines

I hear you saying "I type %i not %d without thinking about it", but I'm telling you, think about it.

No, it works everywhere else just fine, except U-Boot SPL is special.

Quoted 8 lines

It works fine in SPL when we use the full printf, which is still a good percent of the boards.

Quoted 1 line

This is a tiny-printf bug, period.

It's a feature of the explicitly reduced functionality printf. It's the whole point of the feature, provide as much output with as little code as we can.

Not supporting standard features is a bug, because it makes SPL behavior non-standard.

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

I will not grow 200+ boards when there's
an easy way not to.

By ~6 bytes, which happens with almost every DM patch. I am not buying the size argument.

Nope, not true. Boards with tiny printf rarely grow their SPL size from general changes (SoC trees only get scrutiny over growth in platforms outside their area) because I get this annoying about why they grow in size.

OK, so look at socfpga_cyclone5_defconfig for example, which grew by 32 bytes between 2020.04 and u-boot/master thanks to:

commit 0486497e2b5f4d36fa968a1a60fea358cbf70b65
lib: Improve _parse_integer_fixup_radix base 16 detection

It uses tiny-printf, it grew from general change, and it came from SoC tree:
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze/-/commits/xilinx-for-v2020.07

It didn't take too long to find a counter-example ...

#29 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

Quoted 64 lines · Marek Vasut
Quoted 63 lines · Tom Rini
Quoted 54 lines · Marek Vasut
Quoted 53 lines · Tom Rini
Quoted 51 lines · Marek Vasut
Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 24 lines · Marek Vasut
Quoted 12 lines · Ley Foon Tan

Tiny printf doesn't support %i, change to %u.

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index e3f11984a978..8acf324117af 100644

drivers/ddr/altera/sdram_arria10.c static void sdram_init_ecc_bits(u32 size) · line 201

Quoted 8 lines
drivers/ddr/altera/sdram_arria10.c +1 -1
@@ -195,7 +195,7 @@ static void sdram_init_ecc_bits(u32 size)
 
 	dcache_enable();
 
-	printf("DDRCAL: Scrubbing ECC RAM (%i MiB).\n", size >> 20);
+	printf("DDRCAL: Scrubbing ECC RAM (%u MiB).\n", size >> 20);
 	memset((void *)0x8000, 0, size - 0x8000);
 	flush_dcache_all();
 	printf("DDRCAL: Scrubbing ECC RAM done.\n");

Yes, sadly, tiny printf is broken so we need to patch code to work around that breakage.

Quoted 3 lines
Quoted 1 line

Yes, limited by design, thanks for changing.

This code could be used without tiny printf, so this change is unnecessary.

You've got it backwards. Code that could be used by tiny printf needs to use the more limited set of formats. But this should have been using %u all along? %i is for int, %u is unsigned int.

Quoted 6 lines
Quoted 2 lines

That would mean most of U-Boot needs to be limited to the subset of formatting characters supported by tiny printf, which is unrealistic.

Not at all. Only the code that's used in SPL and in tiny printf situations needs to be limited to reduced set. Which is why we're at 4.5 years in and just now "oh, %i doesn't work?".

I keep running into "oh, %i, such a basic C printf() feature, doesn't work" again and again, and it makes my work with U-Boot real annoying. This should be fixed in the printf implementation, not all over the code base. Also, it prevents sane code reuse, unless we start adding #ifdef TINY_PRINTF all over the place, which is just ew ...

Quoted 4 lines
Quoted 2 lines

I hear you saying "I type %i not %d without thinking about it", but I'm telling you, think about it.

No, it works everywhere else just fine, except U-Boot SPL is special.

It works fine in SPL when we use the full printf, which is still a good percent of the boards.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This is a tiny-printf bug, period.

It's a feature of the explicitly reduced functionality printf. It's the whole point of the feature, provide as much output with as little code as we can.

Not supporting standard features is a bug, because it makes SPL behavior non-standard.

It's a non-standard function. There's all sorts of standard printf formats it does not support, on purpose.

Quoted 14 lines
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

I will not grow 200+ boards when there's
an easy way not to.

By ~6 bytes, which happens with almost every DM patch. I am not buying the size argument.

Nope, not true. Boards with tiny printf rarely grow their SPL size from general changes (SoC trees only get scrutiny over growth in platforms outside their area) because I get this annoying about why they grow in size.

OK, so look at socfpga_cyclone5_defconfig for example, which grew by 32 bytes between 2020.04 and u-boot/master thanks to:

Quoted 7 lines

commit 0486497e2b5f4d36fa968a1a60fea358cbf70b65
lib: Improve _parse_integer_fixup_radix base 16 detection

It uses tiny-printf, it grew from general change, and it came from SoC tree:
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze/-/commits/xilinx-for-v2020.07

It didn't take too long to find a counter-example ...

Yup, it grew for a bugfix. The full growth is:
spl-u-boot-spl: add: 0/0, grow: 3/0 bytes: 56/0 (56)
function old new delta
_parse_integer_fixup_radix 92 120 +28
ns16550_serial_ofdata_to_platdata 104 128 +24
ns16550_serial_probe 76 80 +4

For other bugfixes too. Any of those bugfixes that can be done with zero size growth would be appreciated.

Signature · 8 lines
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/20200416/42e83785/attachment.sig>
#30 lore raw

PATCH 6/7 ddr: altera: arria10: Change %i to %u for printf

On 4/16/20 8:02 PM, Tom Rini wrote:
[...]

Quoted 29 lines
Quoted 14 lines
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

I will not grow 200+ boards when there's
an easy way not to.

By ~6 bytes, which happens with almost every DM patch. I am not buying the size argument.

Nope, not true. Boards with tiny printf rarely grow their SPL size from general changes (SoC trees only get scrutiny over growth in platforms outside their area) because I get this annoying about why they grow in size.

OK, so look at socfpga_cyclone5_defconfig for example, which grew by 32 bytes between 2020.04 and u-boot/master thanks to:

Quoted 7 lines

commit 0486497e2b5f4d36fa968a1a60fea358cbf70b65
lib: Improve _parse_integer_fixup_radix base 16 detection

It uses tiny-printf, it grew from general change, and it came from SoC tree:
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze/-/commits/xilinx-for-v2020.07

It didn't take too long to find a counter-example ...

Yup, it grew for a bugfix. The full growth is:
spl-u-boot-spl: add: 0/0, grow: 3/0 bytes: 56/0 (56)
function old new delta
_parse_integer_fixup_radix 92 120 +28
ns16550_serial_ofdata_to_platdata 104 128 +24
ns16550_serial_probe 76 80 +4

Quoted 2 lines

For other bugfixes too. Any of those bugfixes that can be done with zero size growth would be appreciated.

So, how is this bugfix applicable, while a bugfix which fixes tiny printf to behave sane is not ? I don't really see a distinction here, sorry.

And you should have rejected the above and asked for a more optimized version, based on 'I get this annoying about why they grow in size.'

#31 lore raw

PATCH 7/7 ddr: altera: arria10: Remove call to dram_init_banksize()

In reply to Ley Foon Tan

dram_init_banksize() is called in board_init_f() boot sequences in Uboot, remove it from SDRAM driver.

---
 drivers/ddr/altera/sdram_arria10.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/ddr/altera/sdram_arria10.c +0 -3
index 8acf324117af..a7d0eefe9195 100644
@@ -660,9 +660,6 @@ static int ddr_calibration_sequence(struct altera_sdram_platdata *plat)
 	else
 		gd->ram_size = (u32)size;
 
-	/* setup the dram info within bd */
-	dram_init_banksize();
-
 	if (of_sdram_firewall_setup(gd->fdt_blob))
 		puts("FW: Error Configuring Firewall\n");
 
Signature · 1 line
2.19.0