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 13/14] ARM: AM43xx: GP_EVM: Add support for DDR3
Date: Wed, 27 Nov 2013 15:04:31 +0530	[thread overview]
Message-ID: <5295BCA7.3080300@ti.com> (raw)
In-Reply-To: <CANacCWyJFBMbp_7e_v7iaC33GMyPCnb8Dfis3Sdu7rek2bOnTg@mail.gmail.com>

On Wednesday 27 November 2013 05:47 AM, Vaibhav Bedia wrote:
> On Mon, Nov 25, 2013 at 12:18 AM, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>> On Friday 22 November 2013 02:22 AM, Vaibhav Bedia wrote:
>>> On Thu, Nov 21, 2013 at 1:18 AM, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>>> [...]
>>>
>>>> -/*
>>>> - * Get SDRAM type connected to EMIF.
>>>> - * Assuming similar SDRAM parts are connected to both EMIF's
>>>> - * which is typically the case. So it is sufficient to get
>>>> - * SDRAM type from EMIF1.
>>>> - */
>>>> -u32 emif_sdram_type()
>>>> -{
>>>> -       struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
>>>> -
>>>> -       return (readl(&emif->emif_sdram_config) &
>>>> -               EMIF_REG_SDRAM_TYPE_MASK) >> EMIF_REG_SDRAM_TYPE_SHIFT;
>>>> -}
>>>> -
>>>>  static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr)
>>>>  {
>>>>         u32 mr;
>>>> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>>> index c98ab7f..646e50f 100644
>>>> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>>> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
>>>> @@ -138,6 +138,14 @@
>>>>  #define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
>>>>  #define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
>>>>
>>>> +#define  DDR3_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
>>>> +#define  DDR3_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
>>>> +#define  DDR3_ADDRCTRL_IOCTRL_VALUE   0x84
>>>> +#define  DDR3_DATA0_IOCTRL_VALUE   0x84
>>>> +#define  DDR3_DATA1_IOCTRL_VALUE   0x84
>>>> +#define  DDR3_DATA2_IOCTRL_VALUE   0x84
>>>> +#define  DDR3_DATA3_IOCTRL_VALUE   0x84
>>>> +
>>>>  /**
>>>>   * Configure DMM
>>>>   */
>>>> diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h
>>>> index ce6b229..b4a8c9f 100644
>>>> --- a/arch/arm/include/asm/emif.h
>>>> +++ b/arch/arm/include/asm/emif.h
>>>> @@ -1151,6 +1151,20 @@ static inline u32 get_emif_rev(u32 base)
>>>>                 >> EMIF_REG_MAJOR_REVISION_SHIFT;
>>>>  }
>>>>
>>>> +/*
>>>> + * Get SDRAM type connected to EMIF.
>>>> + * Assuming similar SDRAM parts are connected to both EMIF's
>>>> + * which is typically the case. So it is sufficient to get
>>>> + * SDRAM type from EMIF1.
>>>> + */
>>>> +static inline u32 emif_sdram_type(void)
>>>> +{
>>>> +       struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
>>>> +
>>>> +       return (readl(&emif->emif_sdram_config) &
>>>> +               EMIF_REG_SDRAM_TYPE_MASK) >> EMIF_REG_SDRAM_TYPE_SHIFT;
>>>> +}
>>>> +
>>>
>>> This change don't make any sense to me. How are the EMIF register bits
>>> any indication
>>> of what memory time is used especially for DDR2/3?
>> What is not making sense here ?
>> If you go and read EMIF spec, it is clearly written that on coming out of reset
>> HW sequence starts according to the value populated in SDRAM config register.
>> As far as I am concerned this is the best way to differentiate between Memories.
>>
> 
> Take a moment to think about where that register value comes from. Does it
> somehow automagically get reconfigured when the chip is put in a board with
> LPDDR2 vs DDR2 vs DDR3? While you are at it also look at the JEDEC specs
> to figure out is there's some way to probe the DDR2/3 memory types.
Ideally the default value should be exported from e-fuse values.
EMIF does some HW sequence according to the value exported here. This filed tells 
what type of memory it is.

I understand the point what if efuse is not blown. I am using this only after we write into sdarm_config register.
This can confirm that we get a correct value.
 If this is not sufficient we can hardcode the register during startup only ?
One more thing is we can get from MR registers of DDR.
But for DDR3 we cannot access MR registers. That is why I didn't go with this approach.

Currently EEPROM doesn't have any details about DDR.
Please let me know if this approach is not good enough.

Thanks and regards,
Lokesh

> 
>> Can you tell me a better way to differentiate between memories in emif file ?
>> Definitely  I should not use board_is_foo() functions.
>>
> 
> AFAIK there is none and hence this way of trying to get the memory type
> is broken.
> 
> Moreover, my understanding was that one of the prime functions of the EEPROM
> board data was to enable differentiation between the memory types.
> 

  reply	other threads:[~2013-11-27  9:34 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
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 [this message]
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=5295BCA7.3080300@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.