All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 12/14] ARM: AM43xx: EPOS_EVM: Add support for LPDDR2
Date: Mon, 25 Nov 2013 10:43:11 +0530	[thread overview]
Message-ID: <5292DC67.6030409@ti.com> (raw)
In-Reply-To: <CANacCWwf_bn2pYu+hwd8A416UxajnSx1fNB3=OZPxDd_NF5zUw@mail.gmail.com>

On Friday 22 November 2013 02:16 AM, Vaibhav Bedia wrote:
> On Thu, Nov 21, 2013 at 1:18 AM, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>> AM4372 EPOS EVM has 1GB LPDDR2(Part no: MT42L256M32D2LG-25 WT:A)
>> Adding LPDDR2 init sequence and register details for the same.
>> Below is the brief description of LPDDR2 init sequence:
>> -> Configure VTP
>> -> Configure DDR IO settings
>> -> Disable initialization and refreshes until EMIF registers are programmed.
>> -> Program Timing registers
>> -> Program PHY control and Temp alert and ZQ config registers.
>> -> Enable initialization and refreshes and configure SDRAM CONFIG register
>> -> Wait till initialization is complete and the configure MR registers.
>>
> 
> This patch does too many things, some of which affects AM335x and needs to be
> split up. I lost track of what you were doing as i scrolled down :\
It does only two things. Update IO settings and emif configuration.
I wanted to keep these things in a single patch so that if some functionality
breaks down I can burn down to this patch.
> 
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
>> ---
>>  arch/arm/cpu/armv7/am33xx/ddr.c                    |  147 +++++++++++++++++++-
>>  arch/arm/cpu/armv7/am33xx/emif4.c                  |   25 +++-
>>  arch/arm/include/asm/arch-am33xx/clocks_am33xx.h   |    3 +
>>  arch/arm/include/asm/arch-am33xx/cpu.h             |    5 +
>>  arch/arm/include/asm/arch-am33xx/ddr_defs.h        |   33 ++++-
>>  arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    1 +
>>  arch/arm/include/asm/emif.h                        |   12 ++
>>  board/isee/igep0033/board.c                        |   10 +-
>>  board/phytec/pcm051/board.c                        |   12 +-
>>  board/siemens/dxr2/board.c                         |   10 +-
>>  board/siemens/pxm2/board.c                         |   10 +-
>>  board/siemens/rut/board.c                          |   10 +-
>>  board/ti/am335x/board.c                            |   40 +++++-
>>  board/ti/am43xx/board.c                            |   66 +++++++++
>>  board/ti/ti814x/evm.c                              |    4 +-
>>  board/ti/ti816x/evm.c                              |   12 +-
>>  16 files changed, 373 insertions(+), 27 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
>> index fa697c7..fbee51d 100644
>> --- a/arch/arm/cpu/armv7/am33xx/ddr.c
>> +++ b/arch/arm/cpu/armv7/am33xx/ddr.c
>> @@ -36,6 +36,74 @@ static struct ddr_data_regs *ddr_data_reg[2] = {
>>  static struct ddr_cmdtctrl *ioctrl_reg = {
>>                         (struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};
>>
>> +static inline u32 get_mr(int nr, u32 cs, u32 mr_addr)
>> +{
>> +       u32 mr;
>> +
>> +       mr_addr |= cs << EMIF_REG_CS_SHIFT;
>> +       writel(mr_addr, &emif_reg[nr]->emif_lpddr2_mode_reg_cfg);
>> +
>> +       mr = readl(&emif_reg[nr]->emif_lpddr2_mode_reg_data);
>> +       debug("get_mr: EMIF1 cs %d mr %08x val 0x%x\n", cs, mr_addr, mr);
>> +       if (((mr & 0x0000ff00) >>  8) == (mr & 0xff) &&
>> +           ((mr & 0x00ff0000) >> 16) == (mr & 0xff) &&
>> +           ((mr & 0xff000000) >> 24) == (mr & 0xff))
>> +               return mr & 0xff;
>> +       else
>> +               return mr;
>> +}
>> +
>> +static inline void set_mr(int nr, u32 cs, u32 mr_addr, u32 mr_val)
>> +{
>> +       mr_addr |= cs << EMIF_REG_CS_SHIFT;
>> +       writel(mr_addr, &emif_reg[nr]->emif_lpddr2_mode_reg_cfg);
>> +       writel(mr_val, &emif_reg[nr]->emif_lpddr2_mode_reg_data);
>> +}
>> +
>> +static void configure_mr(int nr, u32 cs)
>> +{
>> +       u32 mr_addr;
>> +
>> +       while (get_mr(nr, cs, LPDDR2_MR0) & LPDDR2_MR0_DAI_MASK)
>> +               ;
>> +       set_mr(nr, cs, LPDDR2_MR10, 0x56);
>> +
>> +       set_mr(nr, cs, LPDDR2_MR1, 0x43);
>> +       set_mr(nr, cs, LPDDR2_MR2, 0x2);
>> +
>> +       mr_addr = LPDDR2_MR2 | EMIF_REG_REFRESH_EN_MASK;
>> +       set_mr(nr, cs, mr_addr, 0x2);
>> +}
>> +
>> +/*
>> + * Configure EMIF4D5 registers and MR registers
>> + */
>> +void config_sdram_emif4d5(const struct emif_regs *regs, int nr)
>> +{
>> +       writel(0x0, &emif_reg[nr]->emif_pwr_mgmt_ctrl);
>> +       writel(0x0, &emif_reg[nr]->emif_pwr_mgmt_ctrl_shdw);
>> +       writel(0x1, &emif_reg[nr]->emif_iodft_tlgc);
>> +       writel(regs->zq_config, &emif_reg[nr]->emif_zq_config);
>> +
>> +       writel(regs->temp_alert_config, &emif_reg[nr]->emif_temp_alert_config);
>> +       writel(regs->emif_rd_wr_lvl_rmp_win,
>> +              &emif_reg[nr]->emif_rd_wr_lvl_rmp_win);
>> +       writel(regs->emif_rd_wr_lvl_rmp_ctl,
>> +              &emif_reg[nr]->emif_rd_wr_lvl_rmp_ctl);
>> +       writel(regs->emif_rd_wr_lvl_ctl, &emif_reg[nr]->emif_rd_wr_lvl_ctl);
>> +       writel(regs->emif_rd_wr_exec_thresh,
>> +              &emif_reg[nr]->emif_rd_wr_exec_thresh);
>> +
>> +       clrbits_le32(&emif_reg[nr]->emif_sdram_ref_ctrl,
>> +                    EMIF_REG_INITREF_DIS_MASK);
>> +
>> +       writel(regs->sdram_config, &emif_reg[nr]->emif_sdram_config);
>> +       writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl);
>> +
>> +       configure_mr(nr, 0);
>> +       configure_mr(nr, 1);
>> +}
>> +
> 
> Why can't this portion be shared with the other OMAPs? It looks to be
> following a recommended sequence and i can't see why that would vary.
Yes, my ultimate goal is to have a single emif file, but with the current position
of emif file for OMAP's I can't reuse. 
This is in my To do list. I have already discussed this with Tom

Thanks
Lokesh
> 
> It's just too hard to review so many changes in a single patch so i'll stop
> here, sorry.
> 

  reply	other threads:[~2013-11-25  5:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  6:18 [U-Boot] [PATCH V2 00/14] ARM: AM43xx: Update support for AM4372 SoC Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 01/14] ARM: AM43xx: Update the base addresses of modules Lokesh Vutla
2013-11-21 20:20   ` Vaibhav Bedia
2013-11-25  9:26     ` Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 02/14] ARM: AM43xx: Adapt to ti_armv7_common.h config file Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 03/14] ARM: AM43xx: Add L2 Support Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 04/14] ARM: AM43xx: Add extra ENV settings Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 05/14] ARM: AM43XX: board: add support for reading onboard EEPROM Lokesh Vutla
2013-11-21 20:26   ` Vaibhav Bedia
2013-11-25  4:46     ` Lokesh Vutla
2013-11-26 23:49       ` Vaibhav Bedia
2013-11-21  6:18 ` [U-Boot] [PATCH V2 06/14] ARM: AM43XX: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support Lokesh Vutla
2013-11-21 20:28   ` Vaibhav Bedia
2013-11-25  4:48     ` Lokesh Vutla
2013-11-26 23:51       ` Vaibhav Bedia
2013-11-21  6:18 ` [U-Boot] [PATCH V2 07/14] ARM: AM43xx: Select clk source for Timer2 Lokesh Vutla
2013-11-21 20:31   ` Vaibhav Bedia
2013-11-25  4:53     ` Lokesh Vutla
2013-11-26 23:56       ` Vaibhav Bedia
2013-11-21  6:18 ` [U-Boot] [PATCH V2 08/14] ARM: AM43xx: Update Current Booting devices list Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 09/14] ARM: AM43xx: mux: Update mux data Lokesh Vutla
2013-11-21 20:34   ` Vaibhav Bedia
2013-11-25  4:59     ` Lokesh Vutla
2013-11-26 23:58       ` Vaibhav Bedia
2013-11-21  6:18 ` [U-Boot] [PATCH V2 10/14] ARM: AM43xx: clocks: Update DPLL details for EPOS EVM Lokesh Vutla
2013-11-21 20:37   ` Vaibhav Bedia
2013-11-25  5:08     ` Lokesh Vutla
2013-11-27  0:06       ` Vaibhav Bedia
2013-11-27  6:58         ` Lokesh Vutla
2013-11-27 22:48           ` Vaibhav Bedia
2013-12-02  3:53             ` Lokesh Vutla
2013-12-04  3:20               ` Vaibhav Bedia
2013-12-04 17:39                 ` Sekhar Nori
2013-11-21  6:18 ` [U-Boot] [PATCH V2 11/14] ARM: AM43xx: clocks: Add DPLL data for GP EVM Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 12/14] ARM: AM43xx: EPOS_EVM: Add support for LPDDR2 Lokesh Vutla
2013-11-21 20:46   ` Vaibhav Bedia
2013-11-25  5:13     ` Lokesh Vutla [this message]
2013-11-27  0:12       ` Vaibhav Bedia
2013-11-27  4:48         ` Lokesh Vutla
2013-11-21  6:18 ` [U-Boot] [PATCH V2 13/14] ARM: AM43xx: GP_EVM: Add support for DDR3 Lokesh Vutla
2013-11-21 20:52   ` Vaibhav Bedia
2013-11-25  5:18     ` Lokesh Vutla
2013-11-27  0:17       ` Vaibhav Bedia
2013-11-27  9:34         ` Lokesh Vutla
2013-11-27 23:03           ` Vaibhav Bedia
2013-12-02  4:21             ` Lokesh Vutla
2013-12-04  3:24               ` Vaibhav Bedia
2013-11-21  6:18 ` [U-Boot] [PATCH V2 14/14] ARM: AM43xx: Add Maintainer 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=5292DC67.6030409@ti.com \
    --to=lokeshvutla@ti.com \
    --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.