All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/13] board: ti: am574x-idk: Add ddr data support
Date: Tue, 19 Dec 2017 10:34:24 +0100	[thread overview]
Message-ID: <20171219103424.13c59026@jawa> (raw)
In-Reply-To: <c43c2481-b7e8-544f-0c7f-b60de392bba8@ti.com>

Hi Lokesh,

> Hi Lukas,
> 
> On Monday 18 December 2017 04:46 PM, Lukasz Majewski wrote:
> > Hi Lokesh,
> >   
> >> AM574x-idk has the following DDR parts attached:
> >> EMIF1: MT41K256M16HA (1GB with ECC)
> >> EMIF2: MT41K256M16HA (1GB without ECC)
> >>
> >> Enabling 2GB DDR without interleaving between EMIFs. And
> >> enabling ECC on EMIF1.
> >>
> >> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> >> Signed-off-by: Krunal Bhargav <k-bhargav@ti.com>
> >> ---
> >>  board/ti/am57xx/board.c | 47
> >> ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44
> >> insertions(+), 3 deletions(-)
> >>
> >> diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
> >> index 2d14ae54fe..1377c7b1fe 100644
> >> --- a/board/ti/am57xx/board.c
> >> +++ b/board/ti/am57xx/board.c
> >> @@ -89,10 +89,18 @@ static const struct dmm_lisa_map_regs
> >> am571x_idk_lisa_regs = { .is_ma_present  = 0x1
> >>  };
> >>  
> >> +static const struct dmm_lisa_map_regs am574x_idk_lisa_regs = {
> >> +	.dmm_lisa_map_2 = 0xc0600200,
> >> +	.dmm_lisa_map_3 = 0x80600100,
> >> +	.is_ma_present  = 0x1
> >> +};
> >> +
> >>  void emif_get_dmm_regs(const struct dmm_lisa_map_regs
> >> **dmm_lisa_regs) {
> >>  	if (board_is_am571x_idk())
> >>  		*dmm_lisa_regs = &am571x_idk_lisa_regs;
> >> +	else if (board_is_am574x_idk())
> >> +		*dmm_lisa_regs = &am574x_idk_lisa_regs;
> >>  	else
> >>  		*dmm_lisa_regs = &beagle_x15_lisa_regs;
> >>  }
> >> @@ -231,8 +239,8 @@ static const struct emif_regs
> >> am571x_emif1_ddr3_666mhz_emif_regs =
> >> { .ref_ctrl			=
> >> 0x0000514d, .ref_ctrl_final			=
> >> 0x0000144a, .sdram_tim1			= 0xd333887c,
> >> -	.sdram_tim2			= 0x40b37fe3,
> >> -	.sdram_tim3			= 0x409f8ada,
> >> +	.sdram_tim2			= 0x30b37fe3,
> >> +	.sdram_tim3			= 0x409f8ad8,
> >>  	.read_idle_ctrl			= 0x00050000,
> >>  	.zq_config			= 0x5007190b,
> >>  	.temp_alert_config		= 0x00000000,
> >> @@ -249,17 +257,50 @@ static const struct emif_regs
> >> am571x_emif1_ddr3_666mhz_emif_regs =
> >> { .emif_rd_wr_exec_thresh		= 0x00000305 };
> >>  
> >> +static const struct emif_regs
> >> am574x_emif1_ddr3_666mhz_emif_ecc_regs = {
> >> +	.sdram_config_init		= 0x61863332,
> >> +	.sdram_config			= 0x61863332,
> >> +	.sdram_config2			= 0x08000000,
> >> +	.ref_ctrl			= 0x0000514d,
> >> +	.ref_ctrl_final			= 0x0000144a,
> >> +	.sdram_tim1			= 0xd333887c,
> >> +	.sdram_tim2			= 0x30b37fe3,
> >> +	.sdram_tim3			= 0x409f8ad8,
> >> +	.read_idle_ctrl			= 0x00050000,
> >> +	.zq_config			= 0x5007190b,
> >> +	.temp_alert_config		= 0x00000000,
> >> +	.emif_ddr_phy_ctlr_1_init	= 0x0024400f,
> >> +	.emif_ddr_phy_ctlr_1		= 0x0e24400f,
> >> +	.emif_ddr_ext_phy_ctrl_1	= 0x10040100,
> >> +	.emif_ddr_ext_phy_ctrl_2	= 0x00910091,
> >> +	.emif_ddr_ext_phy_ctrl_3	= 0x00950095,
> >> +	.emif_ddr_ext_phy_ctrl_4	= 0x009b009b,
> >> +	.emif_ddr_ext_phy_ctrl_5	= 0x009e009e,
> >> +	.emif_rd_wr_lvl_rmp_win		= 0x00000000,
> >> +	.emif_rd_wr_lvl_rmp_ctl		= 0x80000000,
> >> +	.emif_rd_wr_lvl_ctl		= 0x00000000,
> >> +	.emif_rd_wr_exec_thresh		= 0x00000305,
> >> +	.emif_ecc_ctrl_reg		= 0xD0000001,
> >> +	.emif_ecc_address_range_1	= 0x3FFF0000,
> >> +	.emif_ecc_address_range_2	= 0x00000000
> >> +};  
> > 
> > I'm wondering if it would be possible to:
> > 
> > Embed this memory setup (even as binary blob) to SPL FIT -> Those
> > values are generated from TI supplied excel sheet (when memory
> > details are provided).
> > 
> > 
> > Pros:
> > ----
> > 
> > - Since the same EMIF controller is used, one could only adjust the
> >   binary blob, when new memory (faster, slower, from other
> > manufacturer) is used in the product.
> > 
> > - There would be no need to add such code to the board file.  
> 
> yeah, ddr is not the only thing that comes in this bucket, PMIC data
> as well can be also made in similar way. I mean all the board related
> information can be moved out.

I think that the EMIF controller configuration is a bit special.

As you pointed out - for the whole AM57xx family one EMIF controller
type is used.

> But then the binary size will still
> remain the same. 

The goal here would be to not make the binary smaller, but reducing the
maintanence effort.

Example use case - company X has a product. They are using single u-boot
(with SPL and dts). The only thing, which they need to change is the
data needed for setting up proper memory configuration (DDR2/DDR3,
speed - 1500, 1333, ECC enabled/disabled, module size, etc). This all is
done in EMIF.

With separate EMIF blob configuration they don't need to rebuild u-boot
- they only change memory configuration binary data.

This data has a separate room in the non-volatile memory (e.g. SPI-NOR
flash). 

> Also, we will need a new driver to parse these new
> binary formats.

EMIF configuration data is IIRC 128 B at most. It is even possible to
copy 1:1 the binary data to EMIF (as it is now done in the u-boot code).

Hence, the "driver" would boil down to "memcpy".

> 
> As of now, the ddr excel sheet outputs the data in the $patch format,
> so still sticking to this format.

As stated before, those Ctrl+C and Ctrl+V data are then copied (in for
loop) to the EMIF registers.

Why not wrap EMIF binary data to FIT, store on non-volatile memory and
on each reset read it and "just" copy this data to EMIF? As fallback we
can use the "from excel" structure.

> 
> Yeah, i agree that it would be nice if we can come up with the
> separate binary for all board related info(i guess DT can be re used
> here).

Not all board related info - just EMIF.

DT is not an option here - it would require re-flashing u-boot binary.

> 
> Thanks and regards,
> Lokesh
> 
> >   
> >> +
> >>  void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
> >>  {
> >>  	switch (emif_nr) {
> >>  	case 1:
> >>  		if (board_is_am571x_idk())
> >>  			*regs =
> >> &am571x_emif1_ddr3_666mhz_emif_regs;
> >> +		else if (board_is_am574x_idk())
> >> +			*regs =
> >> &am574x_emif1_ddr3_666mhz_emif_ecc_regs; else
> >>  			*regs =
> >> &beagle_x15_emif1_ddr3_532mhz_emif_regs; break;
> >>  	case 2:
> >> -		*regs = &beagle_x15_emif2_ddr3_532mhz_emif_regs;
> >> +		if (board_is_am574x_idk())
> >> +			*regs =
> >> &am571x_emif1_ddr3_666mhz_emif_regs;
> >> +		else
> >> +			*regs =
> >> &beagle_x15_emif2_ddr3_532mhz_emif_regs; break;
> >>  	}
> >>  }  
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
> > wd at denx.de 



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171219/50f8e859/attachment.sig>

  reply	other threads:[~2017-12-19  9:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  9:34 [U-Boot] [PATCH 00/13] arm: am57xx: Add support for am574-idk Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 01/13] drivers: dma: ti-edma3: add support for memory fill Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 02/13] arm: emif-common: Add ecc specific emif registers Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 03/13] arm: emif-common: Add suppport for enabling ECC Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 04/13] arm: keystone: Move cmd_ddr3 to a common place Lokesh Vutla
2017-12-18 20:03   ` Tom Rini
2017-12-19  5:01     ` Lokesh Vutla
2017-12-19 12:40       ` Tom Rini
2017-12-19 12:41       ` Tom Rini
2017-12-18  9:34 ` [U-Boot] [PATCH 05/13] arm: ti: Generalize cmd_ddr3 command Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 06/13] arm: dra762: Add support for device package identification Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 07/13] board: ti: am574x-idk: Add epprom support Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 08/13] board: ti: am574x-idk: Add hw data support Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 09/13] board: ti: am574x-idk: Add ddr " Lokesh Vutla
2017-12-18 11:16   ` Lukasz Majewski
2017-12-19  5:17     ` Lokesh Vutla
2017-12-19  9:34       ` Lukasz Majewski [this message]
2017-12-29  6:17         ` Lokesh Vutla
2018-01-02  8:52           ` Lukasz Majewski
2018-01-10 14:13           ` Tom Rini
2017-12-18  9:34 ` [U-Boot] [PATCH 10/13] board: ti: am574x-idk: Update pinmux using latest PMT Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 11/13] board: ti: am57xx: Enable CMD_DDR3 Lokesh Vutla
2017-12-18 11:18   ` Lukasz Majewski
2017-12-19  5:05     ` Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 12/13] ARM: dts: am574x-idk: Add initial support Lokesh Vutla
2017-12-18 20:04   ` Tom Rini
2017-12-22 11:25     ` Lokesh Vutla
2017-12-18  9:34 ` [U-Boot] [PATCH 13/13] env: ti: Select dtb name for dra76x and am574 Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171219103424.13c59026@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.