Skip to contentSkip to conversation

ddr: socfpga: Fix IO in Arria10 DDR driver

PATCH New Marek Vasut 3 participants 6 messages Mar 6, 2019 – Mar 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ddr: socfpga: Fix IO in Arria10 DDR driver

The Altera Arria10 DDR driver was using constants in a few places instead of reading registers associated with those constants, fix this.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
---
 drivers/ddr/altera/sdram_arria10.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ddr/altera/sdram_arria10.c +3 -3
index 29ea7492f3..6724eb29f1 100644
@@ -304,7 +304,7 @@ static void sdram_mmr_init(void)
 	 *	bit[9:6] = Minor Release #
 	 *	bit[14:10] = Major Release #
 	 */
-	if ((socfpga_io48_mmr_base->niosreserve1 >> 6) & 0x1FF) {
+	if ((readl(&socfpga_io48_mmr_base->niosreserve1) >> 6) & 0x1FF) {
 		update_value = readl(&socfpga_io48_mmr_base->niosreserve0);
 		writel(((update_value & 0xFF) >> 5),
 		       &socfpga_ecc_hmc_base->ddrioctrl);
@@ -394,7 +394,7 @@ static void sdram_mmr_init(void)
 			caltim0_cfg_act_to_rdwr -
 			(ctrlcfg0_cfg_ctrl_burst_len >> 2));
 
-	io48_value = ((((socfpga_io48_mmr_base->dramtiming0 &
+	io48_value = ((((readl(&socfpga_io48_mmr_base->dramtiming0) &
 		      ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) + 2 + 15 +
 		      (ctrlcfg0_cfg_ctrl_burst_len >> 1)) >> 1) -
 		      /* Up to here was in memory cycles so divide by 2 */
@@ -424,7 +424,7 @@ static void sdram_mmr_init(void)
 		&socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_ddrmode);
 
 	/* Configure the read latency [0xFFD12414] */
-	writel(((socfpga_io48_mmr_base->dramtiming0 &
+	writel(((readl(&socfpga_io48_mmr_base->dramtiming0) &
 		ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) >> 1) +
 		DDR_READ_LATENCY_DELAY,
 		&socfpga_noc_ddr_scheduler_base->
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 ddr: socfpga: Fix newline in debug print on A10

The debug print is missing a newline, add it.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +1 -1
index 6724eb29f1..be5ce778e8 100644
@@ -270,7 +270,7 @@ static u64 sdram_size_calc(void)
 	size *= (2 << (readl(&socfpga_ecc_hmc_base->ddrioctrl) &
 		       ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK));
 
-	debug("SDRAM size=%llu", size);
+	debug("SDRAM size=%llu\n", size);
 
 	return size;
 }
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 ddr: socfpga: Fix newline in debug print on A10

Quoted 8 lines · Marek Vasut

The debug print is missing a newline, add it.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Quoted 20 lines
---
 drivers/ddr/altera/sdram_arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +1 -2
index 6724eb29f1..be5ce778e8 100644
@@ -270,7 +270,7 @@ static u64 sdram_size_calc(void)
        size *= (2 << (readl(&socfpga_ecc_hmc_base->ddrioctrl) &
                       ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK));
 
-       debug("SDRAM size=%llu", size);
+       debug("SDRAM size=%llu\n", size);
 
        return size;
 }
--

2.20.1

#3 lore raw

PATCH 2/2 ddr: socfpga: Fix newline in debug print on A10

Quoted 11 lines · Simon Goldschmidt
Quoted 9 lines · Marek Vasut

The debug print is missing a newline, add it.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Quoted 23 lines
Quoted 23 lines

---
 drivers/ddr/altera/sdram_arria10.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sdram_arria10.c +0 -0
index 6724eb29f1..be5ce778e8 100644
@@ -270,7 +270,7 @@ static u64 sdram_size_calc(void)

        size *= (2 << (readl(&socfpga_ecc_hmc_base->ddrioctrl) & ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK));

-       debug("SDRAM size=%llu", size);
+       debug("SDRAM size=%llu\n", size);

        return size;
 }
--
2.20.1

#4 lore raw

PATCH 1/2 ddr: socfpga: Fix IO in Arria10 DDR driver

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

The Altera Arria10 DDR driver was using constants in a few places instead of reading registers associated with those constants, fix this.

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Quoted 38 lines
---
 drivers/ddr/altera/sdram_arria10.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ddr/altera/sdram_arria10.c +3 -4
index 29ea7492f3..6724eb29f1 100644
@@ -304,7 +304,7 @@ static void sdram_mmr_init(void)
         *      bit[9:6] = Minor Release #
         *      bit[14:10] = Major Release #
         */
-       if ((socfpga_io48_mmr_base->niosreserve1 >> 6) & 0x1FF) {
+       if ((readl(&socfpga_io48_mmr_base->niosreserve1) >> 6) & 0x1FF) {
                update_value = readl(&socfpga_io48_mmr_base->niosreserve0);
                writel(((update_value & 0xFF) >> 5),
                       &socfpga_ecc_hmc_base->ddrioctrl);
@@ -394,7 +394,7 @@ static void sdram_mmr_init(void)
                        caltim0_cfg_act_to_rdwr -
                        (ctrlcfg0_cfg_ctrl_burst_len >> 2));
 
-       io48_value = ((((socfpga_io48_mmr_base->dramtiming0 &
+       io48_value = ((((readl(&socfpga_io48_mmr_base->dramtiming0) &
                      ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) + 2 + 15 +
                      (ctrlcfg0_cfg_ctrl_burst_len >> 1)) >> 1) -
                      /* Up to here was in memory cycles so divide by 2 */
@@ -424,7 +424,7 @@ static void sdram_mmr_init(void)
                &socfpga_noc_ddr_scheduler_base->ddr_t_main_scheduler_ddrmode);
 
        /* Configure the read latency [0xFFD12414] */
-       writel(((socfpga_io48_mmr_base->dramtiming0 &
+       writel(((readl(&socfpga_io48_mmr_base->dramtiming0) &
                ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) >> 1) +
                DDR_READ_LATENCY_DELAY,
                &socfpga_noc_ddr_scheduler_base->
--

2.20.1

#5 lore raw

PATCH 1/2 ddr: socfpga: Fix IO in Arria10 DDR driver

Quoted 7 lines · Simon Goldschmidt
Quoted 6 lines · Marek Vasut

The Altera Arria10 DDR driver was using constants in a few places instead of reading registers associated with those constants, fix this.

Quoted 6 lines
Quoted 5 lines
Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Quoted 47 lines
Quoted 47 lines

---
 drivers/ddr/altera/sdram_arria10.c | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ddr/altera/sdram_arria10.c +1 -1
index 29ea7492f3..6724eb29f1 100644
@@ -304,7 +304,7 @@ static void sdram_mmr_init(void)
          *      bit[9:6] = Minor Release #
          *      bit[14:10] = Major Release #
          */
-       if ((socfpga_io48_mmr_base->niosreserve1 >> 6) & 0x1FF) {
+       if ((readl(&socfpga_io48_mmr_base->niosreserve1) >> 6) &
 0x1FF) {

                update_value = readl(&socfpga_io48_mmr_base-

Quoted 1 line

niosreserve0);

                writel(((update_value & 0xFF) >> 5), &socfpga_ecc_hmc_base->ddrioctrl);

drivers/ddr/altera/sdram_arria10.c +0 -0
@@ -394,7 +394,7 @@ static void sdram_mmr_init(void)

                        caltim0_cfg_act_to_rdwr - (ctrlcfg0_cfg_ctrl_burst_len >> 2));

-       io48_value = ((((socfpga_io48_mmr_base->dramtiming0 & +       io48_value = ((((readl(&socfpga_io48_mmr_base->dramtiming0) &
                      ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) + 2
+ 15 +
                      (ctrlcfg0_cfg_ctrl_burst_len >> 1)) >> 1) - /* Up to here was in memory cycles so divide by 2 */

drivers/ddr/altera/sdram_arria10.c +0 -0
@@ -424,7 +424,7 @@ static void sdram_mmr_init(void)

                &socfpga_noc_ddr_scheduler_base-

Quoted 1 line

ddr_t_main_scheduler_ddrmode);

        /* Configure the read latency [0xFFD12414] */ -       writel(((socfpga_io48_mmr_base->dramtiming0 & +       writel(((readl(&socfpga_io48_mmr_base->dramtiming0) & ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK) >> 1) + DDR_READ_LATENCY_DELAY, &socfpga_noc_ddr_scheduler_base->
--
2.20.1