From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 5/6] arm: atmel: add ddr2 initialization function
Date: Thu, 14 Nov 2013 08:42:22 +0100 [thread overview]
Message-ID: <52847EDE.5040107@gmail.com> (raw)
In-Reply-To: <52847053.7060705@atmel.com>
Hi Bo,
On 11/14/2013 07:40 AM, Bo Shen wrote:
> On 11/13/2013 09:03 PM, Andreas Bie?mann wrote:
>> On 11/06/2013 06:29 AM, Bo Shen wrote:
<snip>
>>> +static void atmel_mpddr_op(int mode, u32 ram_address)
>>
>> static inline, could give the compiler a hint to optimize here.
>
> I am not sure whether the write(0, ram_address) will be optimized.
> Because this must excute later than write mode to let it work.
well, I don't mean reordering for optimization here.
The point is the atmel_mpddr_op will get two mostly static values (it is
not fully true cause ram_address will be calculated, but didn't knew
when writing). So when using the function we need to setup two
registers, branch (and do all the stuff involved: saving to the stack
a.s.o.) and write the register content to two different addresses.
If we instruct the compiler to inline atmel_mpddr_op() he could decide
to just take the const value given into ddr2_init to be written to the
relevant address. I think that is optimization too. It could however
increase the text segment by some bytes also, that is to be checked
(cause it would be getting worse and that would be no optimization).
>>> +{
>>> + struct atmel_mpddr *mpddr = (struct atmel_mpddr
>>> *)ATMEL_BASE_MPDDRC;
>>> +
>>> + writel(mode, &mpddr->mr);
>>> + writel(0, ram_address);
>>> +}
>>> +
>>> +int ddr2_init(u32 ram_address, struct atmel_mpddr *mpddr_value)
>>
>> could you please constify mpddr_value for the very same reason?
>
> OK.
I think ram_address should also be declared const.
<snip>
>>> +#ifndef __ATMEL_MPDDRC_H__
>>> +#define __ATMEL_MPDDRC_H__
>>> +
>>> +struct atmel_mpddr {
>>> + u32 mr;
>>> + u32 rtr;
>>> + u32 cr;
>>> + u32 tp0r;
>>
>> Datasheet names them tprX
>
> Actually, this name is Timing Parameter 0 Register,
> Timing Parameter 1 Register.
Well, I know. But my data sheet names it MPDDRC_TPR0 (the abbreviation
in table 28-13). I think we should use the names in data sheet here. I
often search the data sheet for the given name. mpddr will point to the
correct subsystem in SoC, that is good. But tp0r will find nothing. This
just consumes time when looking up the spec and is IMHO annoying.
>>> + u32 tp1r;
>>> + u32 tp2r;
>>> + u32 reserved[2];
>>> + u32 mdr;
>>
>> Datasheet names it just md.
>
> All other registers with "r" suffix, so, add r to this register name too.
But the name in data sheet is MPDDRC_MD ...
Best regards
Andreas Bie?mann
next prev parent reply other threads:[~2013-11-14 7:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 5:29 [U-Boot] [PATCH v3 0/6] arm: atmel: sama5d3: enable spl boot from SD card Bo Shen
2013-11-06 5:29 ` [U-Boot] [PATCH v3 1/6] arm: atmel: sama5d3: correct the ID for DBGU and PIT Bo Shen
2013-11-13 12:01 ` Andreas Bießmann
2013-11-06 5:29 ` [U-Boot] [PATCH v3 2/6] arm: atmel: sama5d3: correct the error define of DIV Bo Shen
2013-11-13 12:20 ` Andreas Bießmann
2013-11-14 6:31 ` Bo Shen
2013-11-06 5:29 ` [U-Boot] [PATCH v3 3/6] arm: atmel: sama5d3: the offset of MULA is 18 Bo Shen
2013-11-13 12:23 ` Andreas Bießmann
2013-11-06 5:29 ` [U-Boot] [PATCH v3 4/6] arm: atmel: sama5d3: early enable PIO peripherals Bo Shen
2013-11-13 12:28 ` Andreas Bießmann
2013-11-06 5:29 ` [U-Boot] [PATCH v3 5/6] arm: atmel: add ddr2 initialization function Bo Shen
2013-11-13 13:03 ` Andreas Bießmann
2013-11-14 6:40 ` Bo Shen
2013-11-14 7:42 ` Andreas Bießmann [this message]
2013-11-14 10:16 ` Bo Shen
2013-11-06 5:29 ` [U-Boot] [PATCH v3 6/6] arm: atmel: sama5d3: spl boot from fat fs SD card Bo Shen
2013-11-13 13:34 ` Andreas Bießmann
2013-11-14 5:52 ` Heiko Schocher
2013-11-14 6:28 ` Andreas Bießmann
2013-11-14 6:53 ` Bo Shen
2013-11-14 7:49 ` Andreas Bießmann
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=52847EDE.5040107@gmail.com \
--to=andreas.devel@googlemail.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