Skip to contentSkip to conversation

i.MX6: nitrogen6x: update memory configuration files to use macros

PATCH New Eric Nelson 3 participants 6 messages Nov 14, 2013 – Nov 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

This patch updates the memory configuration files for the Nitrogen6X boards to use macros to define the output for imximage. This allows re-use of the same files of register/value pairs to be included from C as a pre-cursor to run-time detection of the memory size on a board.

---
 board/boundary/nitrogen6x/1066mhz_4x128mx16.cfg | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/1066mhz_4x256mx16.cfg | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/800mhz_2x128mx16.cfg  | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/800mhz_2x256mx16.cfg  | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/800mhz_4x128mx16.cfg  | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/800mhz_4x256mx16.cfg  | 72 ++++++++++++-------------
 board/boundary/nitrogen6x/nitrogen6dl.cfg       |  1 +
 board/boundary/nitrogen6x/nitrogen6dl2g.cfg     |  1 +
 board/boundary/nitrogen6x/nitrogen6q.cfg        |  1 +
 board/boundary/nitrogen6x/nitrogen6q2g.cfg      |  1 +
 board/boundary/nitrogen6x/nitrogen6s.cfg        |  1 +
 board/boundary/nitrogen6x/nitrogen6s1g.cfg      |  1 +
 12 files changed, 222 insertions(+), 216 deletions(-)
board/boundary/nitrogen6x/1066mhz_4x128mx16.cfg +36 -36
index 6c68146..c3d15a2 100644
@@ -4,39 +4,39 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-DATA 4, MX6_MMDC_P0_MDPDC, 0x00020036
-DATA 4, MX6_MMDC_P0_MDCFG0, 0x555A7974
-DATA 4, MX6_MMDC_P0_MDCFG1, 0xDB538F64
-DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB
-DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2
-DATA 4, MX6_MMDC_P0_MDOR, 0x005A1023
-DATA 4, MX6_MMDC_P0_MDOTC, 0x09444040
-DATA 4, MX6_MMDC_P0_MDPDC, 0x00025576
-DATA 4, MX6_MMDC_P0_MDASP, 0x00000027
-DATA 4, MX6_MMDC_P0_MDCTL, 0x831A0000
-DATA 4, MX6_MMDC_P0_MDSCR, 0x04088032
-DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033
-DATA 4, MX6_MMDC_P0_MDSCR, 0x00428031
-DATA 4, MX6_MMDC_P0_MDSCR, 0x19308030
-DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040
-DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1390003
-DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xA1390003
-DATA 4, MX6_MMDC_P0_MDREF, 0x00005800
-DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00022227
-DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00022227
-DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x42720306
-DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x026F0266
-DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x4273030A
-DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x02740240
-DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x45393B3E
-DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x403A3747
-DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x40434541
-DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x473E4A3B
-DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x0011000E
-DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x000E001B
-DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x00190015
-DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x00070018
-DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800
-DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000800
-DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000
-DATA 4, MX6_MMDC_P0_MAPSR, 0x00011006
+DCD_REG(MX6_MMDC_P0_MDPDC, 0x00020036)
+DCD_REG(MX6_MMDC_P0_MDCFG0, 0x555A7974)
+DCD_REG(MX6_MMDC_P0_MDCFG1, 0xDB538F64)
+DCD_REG(MX6_MMDC_P0_MDCFG2, 0x01FF00DB)
+DCD_REG(MX6_MMDC_P0_MDRWD, 0x000026D2)
+DCD_REG(MX6_MMDC_P0_MDOR, 0x005A1023)
+DCD_REG(MX6_MMDC_P0_MDOTC, 0x09444040)
+DCD_REG(MX6_MMDC_P0_MDPDC, 0x00025576)
+DCD_REG(MX6_MMDC_P0_MDASP, 0x00000027)
+DCD_REG(MX6_MMDC_P0_MDCTL, 0x831A0000)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x04088032)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x00008033)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x00428031)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x19308030)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x04008040)
+DCD_REG(MX6_MMDC_P0_MPZQHWCTRL, 0xA1390003)
+DCD_REG(MX6_MMDC_P1_MPZQHWCTRL, 0xA1390003)
+DCD_REG(MX6_MMDC_P0_MDREF, 0x00005800)
+DCD_REG(MX6_MMDC_P0_MPODTCTRL, 0x00022227)
+DCD_REG(MX6_MMDC_P1_MPODTCTRL, 0x00022227)
+DCD_REG(MX6_MMDC_P0_MPDGCTRL0, 0x42720306)
+DCD_REG(MX6_MMDC_P0_MPDGCTRL1, 0x026F0266)
+DCD_REG(MX6_MMDC_P1_MPDGCTRL0, 0x4273030A)
+DCD_REG(MX6_MMDC_P1_MPDGCTRL1, 0x02740240)
+DCD_REG(MX6_MMDC_P0_MPRDDLCTL, 0x45393B3E)
+DCD_REG(MX6_MMDC_P1_MPRDDLCTL, 0x403A3747)
+DCD_REG(MX6_MMDC_P0_MPWRDLCTL, 0x40434541)
+DCD_REG(MX6_MMDC_P1_MPWRDLCTL, 0x473E4A3B)
+DCD_REG(MX6_MMDC_P0_MPWLDECTRL0, 0x0011000E)
+DCD_REG(MX6_MMDC_P0_MPWLDECTRL1, 0x000E001B)
+DCD_REG(MX6_MMDC_P1_MPWLDECTRL0, 0x00190015)
+DCD_REG(MX6_MMDC_P1_MPWLDECTRL1, 0x00070018)
+DCD_REG(MX6_MMDC_P0_MPMUR0, 0x00000800)
+DCD_REG(MX6_MMDC_P1_MPMUR0, 0x00000800)
+DCD_REG(MX6_MMDC_P0_MDSCR, 0x00000000)
+DCD_REG(MX6_MMDC_P0_MAPSR, 0x00011006)
board/boundary/nitrogen6x/1066mhz_4x256mx16.cfg +36 -36

75 lines not on this page · raw message

board/boundary/nitrogen6x/800mhz_2x128mx16.cfg +36 -36

75 lines not on this page · raw message

board/boundary/nitrogen6x/800mhz_2x256mx16.cfg +36 -36

75 lines not on this page · raw message

board/boundary/nitrogen6x/800mhz_4x128mx16.cfg +36 -36

75 lines not on this page · raw message

board/boundary/nitrogen6x/800mhz_4x256mx16.cfg +36 -36

75 lines not on this page · raw message

board/boundary/nitrogen6x/nitrogen6dl.cfg +1 -0
index 97ae0c2..b7b1609 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "800mhz_4x128mx16.cfg"
 #include "clocks.cfg"
board/boundary/nitrogen6x/nitrogen6dl2g.cfg +1 -0
index 82f837e..85ab85c 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "800mhz_4x256mx16.cfg"
 #include "clocks.cfg"
board/boundary/nitrogen6x/nitrogen6q.cfg +1 -0
index b6f1518..cf77be3 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "1066mhz_4x128mx16.cfg"
 #include "clocks.cfg"
board/boundary/nitrogen6x/nitrogen6q2g.cfg +1 -0
index 8d7ff25..623fb3c 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "1066mhz_4x256mx16.cfg"
 #include "clocks.cfg"
board/boundary/nitrogen6x/nitrogen6s.cfg +1 -0
index 34fb9d0..34f0c18 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "800mhz_2x128mx16.cfg"
 #include "clocks.cfg"
board/boundary/nitrogen6x/nitrogen6s1g.cfg +1 -0
index d61453c..dedc078 100644
@@ -25,5 +25,6 @@ BOOT_FROM      sd
 #include "asm/arch/crm_regs.h"
 
 #include "ddr-setup.cfg"
+#define DCD_REG(name,val) DATA 4 name val
 #include "800mhz_2x256mx16.cfg"
 #include "clocks.cfg"
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

Dear Eric Nelson,

Quoted 16 lines

This patch updates the memory configuration files for the Nitrogen6X boards to use macros to define the output for imximage. This allows re-use of the same files of register/value pairs to be included from C as a pre-cursor to run-time detection of the memory size on a board.

---
 board/boundary/nitrogen6x/1066mhz_4x128mx16.cfg | 72

++++++++++++------------- board/boundary/nitrogen6x/1066mhz_4x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_2x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_2x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_4x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_4x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/nitrogen6dl.cfg

Quoted 7 lines
    |  1 +
 board/boundary/nitrogen6x/nitrogen6dl2g.cfg     |  1 +
 board/boundary/nitrogen6x/nitrogen6q.cfg        |  1 +
 board/boundary/nitrogen6x/nitrogen6q2g.cfg      |  1 +
 board/boundary/nitrogen6x/nitrogen6s.cfg        |  1 +
 board/boundary/nitrogen6x/nitrogen6s1g.cfg      |  1 +
 12 files changed, 222 insertions(+), 216 deletions(-)

I dont mind either way, but just an idea for discussion:

What do you say to implementing the DRAM controller programming in SPL? That way, we can even do proper DRAM calibration on boot and other such nice things. And we'd also get rid of these static magic numbers all around.

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

Hi Marek,

Quoted 26 lines · Marek Vasut

Dear Eric Nelson,

Quoted 16 lines

This patch updates the memory configuration files for the Nitrogen6X boards to use macros to define the output for imximage. This allows re-use of the same files of register/value pairs to be included from C as a pre-cursor to run-time detection of the memory size on a board.

---
  board/boundary/nitrogen6x/1066mhz_4x128mx16.cfg | 72

++++++++++++------------- board/boundary/nitrogen6x/1066mhz_4x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_2x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_2x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_4x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_4x256mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/nitrogen6dl.cfg

Quoted 7 lines
     |  1 +
  board/boundary/nitrogen6x/nitrogen6dl2g.cfg     |  1 +
  board/boundary/nitrogen6x/nitrogen6q.cfg        |  1 +
  board/boundary/nitrogen6x/nitrogen6q2g.cfg      |  1 +
  board/boundary/nitrogen6x/nitrogen6s.cfg        |  1 +
  board/boundary/nitrogen6x/nitrogen6s1g.cfg      |  1 +
  12 files changed, 222 insertions(+), 216 deletions(-)
Quoted 6 lines

I dont mind either way, but just an idea for discussion:

What do you say to implementing the DRAM controller programming in SPL? That way, we can even do proper DRAM calibration on boot and other such nice things. And we'd also get rid of these static magic numbers all around.

We can (and hopefully will very soon) implement some of the configuration in C under SPL, but we can't (and shouldn't) get rid of all of the magic numbers.

Some of these numbers come from testing large numbers of devices under a variety of temperature conditions. The best that the automagic calibration facilities can do is set things up based on nominal current conditions.

That said, I'm sure we can cut down on the total number.

My immediate goal is simply to set the stage for SPL and a single binary.

Regards,

Eric

#3 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

Dear Eric Nelson,

Quoted 41 lines

Hi Marek,

Quoted 38 lines · Marek Vasut

Dear Eric Nelson,

Quoted 25 lines

This patch updates the memory configuration files for the Nitrogen6X boards to use macros to define the output for imximage. This allows re-use of the same files of register/value pairs to be included from C as a pre-cursor to run-time detection of the memory size on a board.

---

  board/boundary/nitrogen6x/1066mhz_4x128mx16.cfg | 72

++++++++++++-------------
board/boundary/nitrogen6x/1066mhz_4x256mx16.cfg

| 72 ++++++++++++-------------

board/boundary/nitrogen6x/800mhz_2x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_2x256mx16.cfg

| 72 ++++++++++++-------------

board/boundary/nitrogen6x/800mhz_4x128mx16.cfg | 72 ++++++++++++------------- board/boundary/nitrogen6x/800mhz_4x256mx16.cfg

| 72 ++++++++++++------------- board/boundary/nitrogen6x/nitrogen6dl.cfg |

Quoted 8 lines
     |  1 +
  board/boundary/nitrogen6x/nitrogen6dl2g.cfg     |  1 +
  board/boundary/nitrogen6x/nitrogen6q.cfg        |  1 +
  board/boundary/nitrogen6x/nitrogen6q2g.cfg      |  1 +
  board/boundary/nitrogen6x/nitrogen6s.cfg        |  1 +
  board/boundary/nitrogen6x/nitrogen6s1g.cfg      |  1 +
  12 files changed, 222 insertions(+), 216 deletions(-)

I dont mind either way, but just an idea for discussion:

Quoted 8 lines
Quoted 4 lines

What do you say to implementing the DRAM controller programming in SPL? That way, we can even do proper DRAM calibration on boot and other such nice things. And we'd also get rid of these static magic numbers all around.

We can (and hopefully will very soon) implement some of the configuration in C under SPL, but we can't (and shouldn't) get rid of all of the magic numbers.

That would be really nice.

Quoted 4 lines

Some of these numbers come from testing large numbers of devices under a variety of temperature conditions. The best that the automagic calibration facilities can do is set things up based on nominal current conditions.

This is what I'm concerned about. On the other hand, the DRAM controller in iMXes does run-time recalibration of the DDR, does it not ?

Quoted 1 line

That said, I'm sure we can cut down on the total number.

Absolutely. And if we cannot do runtime calibration, we could at least have support for multiple boards in a single image.

Quoted 2 lines

My immediate goal is simply to set the stage for SPL and a single binary.

Full ACK on this course ;-)

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

In reply to Eric Nelson

Hi Eric,

Quoted 18 lines · Eric Nelson
Quoted 8 lines

I dont mind either way, but just an idea for discussion:

What do you say to implementing the DRAM controller programming in SPL? That
way, we can even do proper DRAM calibration on boot and other such nice things.
And we'd also get rid of these static magic numbers all around.

We can (and hopefully will very soon) implement some of the configuration in C under SPL, but we can't (and shouldn't) get rid of all of the magic numbers.

Some of these numbers come from testing large numbers of devices under a variety of temperature conditions. The best that the automagic calibration facilities can do is set things up based on nominal current conditions.

Quoted 4 lines

That said, I'm sure we can cut down on the total number.

My immediate goal is simply to set the stage for SPL and a single binary.

I agree on this roadmap. Of course, it will be very nice to allow runtime DDR calibration, but we can do this in a second step.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH 1/1 i.MX6: nitrogen6x: update memory configuration files to use macros

Quoted 21 lines · Stefano Babic

Hi Eric,

Quoted 18 lines · Eric Nelson
Quoted 8 lines

I dont mind either way, but just an idea for discussion:

What do you say to implementing the DRAM controller programming in SPL? That
way, we can even do proper DRAM calibration on boot and other such nice things.
And we'd also get rid of these static magic numbers all around.

We can (and hopefully will very soon) implement some of the configuration in C under SPL, but we can't (and shouldn't) get rid of all of the magic numbers.

Some of these numbers come from testing large numbers of devices under a variety of temperature conditions. The best that the automagic calibration facilities can do is set things up based on nominal current conditions.

Quoted 8 lines
Quoted 4 lines

That said, I'm sure we can cut down on the total number.

My immediate goal is simply to set the stage for SPL and a single binary.

I agree on this roadmap. Of course, it will be very nice to allow runtime DDR calibration, but we can do this in a second step.

Thanks Stefano,

BTW, I did some additional work yesterday to complete the compilation of a single SPL image with multiple DDR configurations.

A V2 of this patch will be needed.

Regards,

Eric