Skip to contentSkip to conversation

ddr: altera: Configuring SDRAM extra cycles timing parameters

PATCH Superseded Chin Liang See 2 participants 7 messages Sep 15, 2016 – Sep 21, 2016

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

To enable configuration of sdr.ctrlcfg.extratime1 register which enable extra clocks for read to write command timing. This is critical to ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +7 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;
@@ -427,6 +429,10 @@ SDR_CTRLGRP_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64_MASK \
 /* Field instance: sdr::ctrlgrp::dramsts                                   */
 #define SDR_CTRLGRP_DRAMSTS_DBEERR_MASK 0x00000008
 #define SDR_CTRLGRP_DRAMSTS_SBEERR_MASK 0x00000004
+/* Register template: sdr::ctrlgrp::extratime1                             */
+#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB 20
+#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB 24
+#define SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB 28
 
 /* SDRAM width macro for configuration with ECC */
 #define SDRAM_WIDTH_32BIT_WITH_ECC	40
arch/arm/mach-socfpga/qts-filter.sh +0 -1
index 050d6ba..1148a71 100755
@@ -119,7 +119,7 @@ EOF
 # Filter out only the macros which are actually used by the code
 #
 grep_sdram_config() {
-	egrep "#define (CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMTYPE|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMBL|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ADDRORDER|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCEN|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCCORREN|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_REORDEREN|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_STARVELIMIT|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_DQSTRKEN|CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_NODMPINS|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCWL|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_AL|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCL|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TRRD|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TFAW|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TRFC|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TREFI|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TRCD|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TRP|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TWR|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TWTR|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRTP|CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRAS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DWR_CPORTRDWR|CONFIG_HPS_SDR_CTRLCFG_POR

TCFG_AUTOPCHEN|CONFIG_HPS_SDR_CTRLCFG_FPGAPORTRST|CONFIG_HPS_SDR_CTRLCFG_FIFOCFG_SYNCMODE|CONFIG_HPS_SDR_CTRLCFG_FIFOCFG_INCSYNC|CONFIG_HPS_SDR_CTRLCFG_MPPRIORITY_USERPRIORITY|CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_0_STATICWEIGHT_31_0|CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_STATICWEIGHT_49_32|CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_1_SUMOFWEIGHT_13_0|CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_2_SUMOFWEIGHT_45_14|CONFIG_HPS_SDR_CTRLCFG_MPWIEIGHT_3_SUMOFWEIGHT_63_46|CONFIG_HPS_SDR_CTRLCFG_PHYCTRL_PHYCTRL_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_0_THRESHOLD1_31_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_1_THRESHOLD1_59_32|CONFIG_HPS_SDR_CTRLCFG_MPPACING_1_THRESHOLD2_3_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_2_THRESHOLD2_35_4|CONFIG_HPS_SDR_CTRLCFG_MPPACING_3_THRESHOLD2_59_36|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_0_THRESHOLDRSTCYCLES_31_0|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_1_THRESHOLDRSTCYCLES_63_32|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64|RW_MGR_ACTIVATE_0_AND_1|RW_MGR_ACTIVATE_0_AND_1_WAIT1|RW_MGR_A!
CTIVATE_0_AND_1_WAIT2|RW_MGR_ACTIVATE_1|RW_MGR_CLEAR_DQS_ENABLE|RW_MGR_GUARANTEED_READ|RW_MGR_GUARANTEED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CTRL_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_0_THRESHOLD1_31_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_1_THRESHOLD1_59_32|CONFIG_HPS_SDR_CTRLCFG_MPPACING_1_THRESHOLD2_3_0|CONFIG_HPS_SDR_CTRLCFG_MPPACING_2_THRESHOLD2_35_4|CONFIG_HPS_SDR_CTRLCFG_MPPACING_3_THRESHOLD2_59_36|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_0_THRESHOLDRSTCYCLES_31_0|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_1_THRESHOLDRSTCYCLES_63_32|CONFIG_HPS_SDR_CTRLCFG_MPTHRESHOLDRST_2_THRESHOLDRSTCYCLES_79_64|RW_MGR_ACTIVATE_0_AND_1|RW_MGR_ACTIVATE_0_AND_1_WAIT1|RW_MGR_A!
 CTIVATE_0_AND_1_WAIT2|RW_MGR_ACTIVATE_1|RW_MGR_CLEAR_DQS_ENABLE|RW_MGR_GUARANTEED_READ|RW_MGR_GUARANTEED_READ_CONT|RW_MGR_GUARANTEED_WRITE|RW_MGR_GUARANTEED_WRITE_WAIT0|RW_MGR_GUARANTEED_WRITE_WAIT1|RW_MGR_GUARANTEED_WRITE_WAIT2|RW_MGR_GUARANTEED_WRITE_WAIT3|RW_MGR_IDLE|RW_MGR_IDLE_LOOP1|RW_MGR_IDLE_LOOP2|RW_MGR_INIT_RESET_0_CKE_0|RW_MGR_INIT_RESET_1_CKE_0|RW_MGR_LFSR_WR_RD_BANK_0|RW_MGR_LFSR_WR_RD_BANK_0_DATA|RW_MGR_LFSR_WR_RD_BANK_0_DQS|RW_MGR_LFSR_WR_RD_BANK_0_NOP|RW_MGR_LFSR_WR_RD_BANK_0_WAIT|RW_MGR_LFSR_WR_RD_BANK_0_WL_1|RW_MGR_LFSR_WR_RD_DM_BANK_0|RW_MGR_LFSR_WR_RD_DM_BANK_0_DATA|RW_MGR_LFSR_WR_RD_DM_BANK_0_D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FT_DQS_EN_WHEN_SHIFT_DQS|AFI_RATE_RATIO|CALIB_LFIFO_OFFSET|CALIB_VFIFO_OFFSET|ENABLE_SUPER_QUICK_CALIBRATION|MAX_LATENCY_COUNT_WIDTH|READ_VALID_FIFO_SIZE|REG_FILE_INIT_SEQ_SIGNATURE|TINIT_CNTR0_VAL|TINIT_CNTR1_VAL|TINIT_CNTR2_VAL|TRESET_CNTR0_VAL|TRESET_CNTR1_VAL|TRESET_CNTR2_VAL|CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_T!
 O_WR|CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_BC|CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_DIFF_CHIP)[[:space:]]"

}

#

arch/arm/mach-socfpga/wrap_sdram_config.c +9 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)			|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR
+	.extratime1 =
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB)		|
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_BC <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB)		|
+(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_DIFF_CHIP <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB),
+#endif
 	.dram_addrw =
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_COLBITS <<
 			SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB)		|
drivers/ddr/altera/sdram.c +3 -0
index 7e4606d..e74c5b0 100644
@@ -418,6 +418,9 @@ static void sdr_load_regs(const struct socfpga_sdram_config *cfg)
 
 	debug("Configuring DRAMODT\n");
 	writel(cfg->dram_odt, &sdr_ctrl->dram_odt);
+
+	debug("Configuring EXTRATIME1\n");
+	writel(cfg->extratime1, &sdr_ctrl->extratime1);
 }
 
 /**
Signature · 1 line
2.2.2
#1 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

Quoted 27 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which enable extra clocks for read to write command timing. This is critical to ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 7 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really correct and was this really tested on AV SoCDK ?

[...]

arch/arm/mach-socfpga/wrap_sdram_config.c static const struct socfpga_sdram_config sdram_config = { · line 84

Quoted 9 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)			|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR

How come this is not always defined for all boards ?

Quoted 26 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +8 -0
+	.extratime1 =
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB)		|
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_BC <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB)		|
+(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_DIFF_CHIP <<
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB),
+#endif
 	.dram_addrw =
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_COLBITS <<
 			SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB)		|
drivers/ddr/altera/sdram.c +3 -0
index 7e4606d..e74c5b0 100644
@@ -418,6 +418,9 @@ static void sdr_load_regs(const struct socfpga_sdram_config *cfg)
 
 	debug("Configuring DRAMODT\n");
 	writel(cfg->dram_odt, &sdr_ctrl->dram_odt);
+
+	debug("Configuring EXTRATIME1\n");
+	writel(cfg->extratime1, &sdr_ctrl->extratime1);
 }
 
 /**
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which enable
extra clocks for read to write command timing. This is critical to ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
Quoted 8 lines

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 5 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really correct and was this really tested on AV SoCDK ?

Previously its treated unused register as default value is good enough. But this not true anymore for LPDDR2 and we are exposing extratime1 register.

While for testing, I tested both CV and AV SoCDK few times as I also worried even they are using DDR3 instead LPDDR2.

Quoted 18 lines

[...]

Quoted 12 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config
 sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)		
 	|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef
Quoted 1 line

CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR

How come this is not always defined for all boards ?

This is to ensure it still works if users are using older SOCEDS instead of SOCEDS 16.1. Besides that, this is only applicable for LPDDR2. With that, patches #2 to #9 are not needed.

Thanks
Chin Liang

Quoted 37 lines
Quoted 35 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +2 -0
+	.extratime1 =
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO

_WR <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB)	
	|
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO

_WR_BC <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB)	
	|

+(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_DIFF _CHIP <<

arch/arm/mach-socfpga/wrap_sdram_config.c +2 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB),
+#endif
 	.dram_addrw =
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_COLBITS <<
 			SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB)		

|

drivers/ddr/altera/sdram.c +3 -0
index 7e4606d..e74c5b0 100644
@@ -418,6 +418,9 @@ static void sdr_load_regs(const struct
 socfpga_sdram_config *cfg)
 
 	debug("Configuring DRAMODT\n");
 	writel(cfg->dram_odt, &sdr_ctrl->dram_odt);
+
+	debug("Configuring EXTRATIME1\n");
+	writel(cfg->extratime1, &sdr_ctrl->extratime1);
 }
 

/**

#3 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

Quoted 42 lines · Chin Liang See
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which enable
extra clocks for read to write command timing. This is critical to ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
Quoted 8 lines

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 5 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really correct and was this really tested on AV SoCDK ?

Quoted 3 lines

Previously its treated unused register as default value is good enough. But this not true anymore for LPDDR2 and we are exposing extratime1 register.

I mean the later one , which adds an entry and moves the other registers by 4 bytes.

Quoted 2 lines

While for testing, I tested both CV and AV SoCDK few times as I also worried even they are using DDR3 instead LPDDR2.

Yes, they do, it's in the documentation ;-)

Quoted 63 lines
Quoted 18 lines

[...]

Quoted 12 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config
 sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)		
 	|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef
Quoted 1 line

CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR

How come this is not always defined for all boards ?

This is to ensure it still works if users are using older SOCEDS instead of SOCEDS 16.1. Besides that, this is only applicable for LPDDR2. With that, patches #2 to #9 are not needed.

Thanks
Chin Liang

Quoted 37 lines
Quoted 35 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +2 -0
+	.extratime1 =
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO

_WR <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB)	
	|
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO

_WR_BC <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB)	
	|

+(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_DIFF _CHIP <<

arch/arm/mach-socfpga/wrap_sdram_config.c +2 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_LSB),
+#endif
 	.dram_addrw =
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_COLBITS <<
 			SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB)		

|

drivers/ddr/altera/sdram.c +3 -0
index 7e4606d..e74c5b0 100644
@@ -418,6 +418,9 @@ static void sdr_load_regs(const struct
 socfpga_sdram_config *cfg)
 
 	debug("Configuring DRAMODT\n");
 	writel(cfg->dram_odt, &sdr_ctrl->dram_odt);
+
+	debug("Configuring EXTRATIME1\n");
+	writel(cfg->extratime1, &sdr_ctrl->extratime1);
 }
 

/**

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

Quoted 47 lines · Marek Vasut
Quoted 42 lines · Chin Liang See
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which enable
extra clocks for read to write command timing. This is critical to ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
Quoted 8 lines

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 5 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really correct and was this really tested on AV SoCDK ?

Quoted 3 lines

Previously its treated unused register as default value is good enough. But this not true anymore for LPDDR2 and we are exposing extratime1 register.

Quoted 30 lines

I mean the later one , which adds an entry and moves the other registers by 4 bytes.

Quoted 2 lines

While for testing, I tested both CV and AV SoCDK few times as I also worried even they are using DDR3 instead LPDDR2.

Yes, they do, it's in the documentation ;-)

Quoted 22 lines
Quoted 18 lines

[...]

Quoted 12 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config
 sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)		
 	|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef
Quoted 1 line

CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR

How come this is not always defined for all boards ?

This is to ensure it still works if users are using older SOCEDS instead of SOCEDS 16.1. Besides that, this is only applicable for LPDDR2. With that, patches #2 to #9 are not needed.

We don't support old crap :)

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

In reply to Marek Vasut
Quoted 46 lines · Marek Vasut
Quoted 45 lines · Chin Liang See
Quoted 43 lines · Marek Vasut
Quoted 31 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which
enable
extra clocks for read to write command timing. This is critical to
ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 7 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
 	u32	dram_odt;
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really
correct and was this really tested on AV SoCDK ?

Quoted 8 lines
Quoted 4 lines

Previously its treated unused register as default value is good enough.
But this not true anymore for LPDDR2 and we are exposing extratime1 register.

I mean the later one , which adds an entry and moves the other registers
by 4 bytes.

Oh you referring to socfpga_sdram_config. That structure is used to store the handoff value. The address of register is actually pointed by structure socfpga_sdr_ctrl.

Quoted 6 lines
Quoted 4 lines

While for testing, I tested both CV and AV SoCDK few times as I also
worried even they are using DDR3 instead LPDDR2.

Yes, they do, it's in the documentation ;-)

Oh actually I meant that this patch should not impact existing boards which are using DDR3.

Thanks
Chin Liang

Quoted 72 lines
Quoted 70 lines
Quoted 4 lines

[...]

Quoted 15 lines
Quoted 12 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
index 31cc7de..d72f5e1 100644
@@ -81,6 +81,15 @@ static const struct socfpga_sdram_config
 sdram_config = {
 			SDR_CTRLGRP_DRAMODT_READ_LSB)		
 	|
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE <<
 			SDR_CTRLGRP_DRAMODT_WRITE_LSB),
+#ifdef
Quoted 1 line

CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR

How come this is not always defined for all boards ?

This is to ensure it still works if users are using older SOCEDS instead of SOCEDS 16.1. Besides that, this is only applicable for LPDDR2. With that, patches #2 to #9 are not needed.

Thanks
Chin Liang

Quoted 43 lines
Quoted 41 lines
arch/arm/mach-socfpga/wrap_sdram_config.c +2 -0
+	.extratime1 =
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_R

D_TO
_WR <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_LSB)	
	|
arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+	(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_R

D_TO
_WR_BC <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_BC_LSB

)

	|

+(CONFIG_HPS_SDR_CTRLCFG_EXTRATIME1_CFG_EXTRA_CTL_CLK_RD_TO_WR_ DIFF
_CHIP <<

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+			SDR_CTRLGRP_EXTRATIME1_RD_TO_WR_DIFF_L

SB),

arch/arm/mach-socfpga/wrap_sdram_config.c +1 -0
+#endif
 	.dram_addrw =
 		(CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_COLBITS <<
 			SDR_CTRLGRP_DRAMADDRW_COLBITS_LSB)	
Quoted 2 lines
drivers/ddr/altera/sdram.c +3 -0
index 7e4606d..e74c5b0 100644
@@ -418,6 +418,9 @@ static void sdr_load_regs(const struct
 socfpga_sdram_config *cfg)
 
 	debug("Configuring DRAMODT\n");
 	writel(cfg->dram_odt, &sdr_ctrl->dram_odt);
+
+	debug("Configuring EXTRATIME1\n");
+	writel(cfg->extratime1, &sdr_ctrl->extratime1);
 }
 

/**

#6 lore raw

PATCH 1/9 ddr: altera: Configuring SDRAM extra cycles timing parameters

Quoted 52 lines · Chin Liang See
Quoted 51 lines · Marek Vasut
Quoted 49 lines · Chin Liang See
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Chin Liang See

To enable configuration of sdr.ctrlcfg.extratime1 register which
enable
extra clocks for read to write command timing. This is critical to
ensure successful LPDDR2 interface

---
 arch/arm/mach-socfpga/include/mach/sdram.h | 8 +++++++-
 arch/arm/mach-socfpga/qts-filter.sh        | 2 +-
 arch/arm/mach-socfpga/wrap_sdram_config.c  | 9 +++++++++
 drivers/ddr/altera/sdram.c                 | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/sdram.h +2 -1
index f12bb84..b11228f 100644
@@ -30,7 +30,8 @@ struct socfpga_sdr_ctrl {
 	u32	dram_timing4;	/* 0x10 */
 	u32	lowpwr_timing;
 	u32	dram_odt;
-	u32	__padding0[4];
+	u32	extratime1;
+	u32	__padding0[3];
 	u32	dram_addrw;	/* 0x2c */
 	u32	dram_if_width;	/* 0x30 */
 	u32	dram_dev_width;
@@ -88,6 +89,7 @@ struct socfpga_sdram_config {
 	u32	dram_timing4;
 	u32	lowpwr_timing;
 	u32	dram_odt;
Quoted 8 lines

arch/arm/mach-socfpga/include/mach/sdram.h struct socfpga_sdram_config { · line 95

Quoted 4 lines
arch/arm/mach-socfpga/include/mach/sdram.h +1 -0
+	u32	extratime1;
 	u32	dram_addrw;
 	u32	dram_if_width;
 	u32	dram_dev_width;

This seems to be changing the DRAM register layout, is this really
correct and was this really tested on AV SoCDK ?

Previously its treated unused register as default value is good enough.
But this not true anymore for LPDDR2 and we are exposing extratime1 register.

Quoted 7 lines
Quoted 3 lines

I mean the later one , which adds an entry and moves the other registers
by 4 bytes.

Oh you referring to socfpga_sdram_config. That structure is used to store the handoff value. The address of register is actually pointed by structure socfpga_sdr_ctrl.

Ah, missed that one, sorry.

[...]

Signature · 2 lines
Best regards,
Marek Vasut