From: Eric Nelson <eric@nelint.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Allowing rtt_nom to be configurable to all possible values
Date: Tue, 5 Jan 2016 10:54:45 -0700 [thread overview]
Message-ID: <568C0365.8030708@nelint.com> (raw)
In-Reply-To: <CAOMZO5DrW=HRedSQhOP5CxZk48MriHJJwJoSrYys_sOZCSNa+Q@mail.gmail.com>
Hi Fabio,
On 01/05/2016 08:07 AM, Fabio Estevam wrote:
> Hi,
>
> Currently we have in arch/arm/cpu/armv7/mx6/ddr.c:
>
> /* MMDC Termination: rtt_nom:2 RZQ/2(120ohm), rtt_nom:1 RZQ/4(60ohm) */
> val = (sysinfo->rtt_nom == 2) ? 0x00011117 : 0x00022227;
>
> ,but the mx6 reference manual states
>
> rtt_nom = 1 ---> 120 ohm
> rtt_nom = 2 ---> 60 ohm
>
> which is the opposite of what the code and comment do.
>
> Also, it is currently not possible to set rtt_nom to any other values
> other than 1 and 2.
>
> On mx6sl evk, for example, we need rtt_nom = 0, which is not possible
> to be achieved currently.
>
> Shouldn't we do like this instead?
>
Yes.
> --- a/arch/arm/cpu/armv7/mx6/ddr.c
> +++ b/arch/arm/cpu/armv7/mx6/ddr.c
> @@ -834,11 +834,12 @@ void mx6_ddr3_cfg(const struct mx6_ddr_sysinfo *sysinfo,
> MMDC1(mprddqby3dl, 0x33333333);
> }
>
> - /* MMDC Termination: rtt_nom:2 RZQ/2(120ohm), rtt_nom:1 RZQ/4(60ohm) */
> - val = (sysinfo->rtt_nom == 2) ? 0x00011117 : 0x00022227;
> - mmdc0->mpodtctrl = val;
> + /* MMDC Termination */
> + val = sysinfo->rtt_nom;
> + mmdc0->mpodtctrl = (val << 16) | (val << 12) | (val << 8) | (val << 4) |
> + 0x7;
> if (sysinfo->dsize > 1)
> - MMDC1(mpodtctrl, val);
> + MMDC1(mpodtctrl, mmdc0->mpodtctrl);
>
The only thing I would add here is a set of constants to prevent the
need to refer to the manual.
The values differ in the i.MX6SDL to allow different meanings for DDR2,
so this should suffice:
#define RTT_NOM_Disabled 0
#define RTT_NOM_120_OHM_75_OHM_DDR2 1
#define RTT_NOM_60_OHM_150_OHM_DDR2 2
#define RTT_NOM_40_OHM_50_OHM_DDR2 3
#define RTT_NOM_30_OHM_37.5_OHM_DDR2 4
#define RTT_NOM_24_OHM_30_OHM_DDR2 5
#define RTT_NOM_20_OHM_25_OHM_DDR2 6
#define RTT_NOM_17_OHM_21_OHM_DDR2 7
(or an enum of the same)...
Regards,
Eric
next prev parent reply other threads:[~2016-01-05 17:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 15:07 [U-Boot] Allowing rtt_nom to be configurable to all possible values Fabio Estevam
2016-01-05 17:54 ` Eric Nelson [this message]
2016-01-05 18:00 ` Fabio Estevam
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=568C0365.8030708@nelint.com \
--to=eric@nelint.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox