From: Alex G. <mr.nuke.me@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support
Date: Fri, 14 Mar 2014 12:23:50 -0500 [thread overview]
Message-ID: <53233B26.2070904@gmail.com> (raw)
In-Reply-To: <20140314141707.GG16360@bill-the-cat>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/14/2014 09:17 AM, Tom Rini wrote:
> On Fri, Mar 14, 2014 at 10:33:45AM +0000, Ian Campbell wrote:
>
> [snip]
>> +static void mctl_ddr3_reset(void) +{ + struct sunxi_dram_reg
>> *dram = + (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE; + + { +
>> clrbits_le32(&dram->mcr, DRAM_MCR_RESET); + udelay(2); +
>> setbits_le32(&dram->mcr, DRAM_MCR_RESET); + }
>
> That seems like an odd construction, why the extra braces?
>
This originally had a conditional depending on the SoC family. (Yeah,
they need to reset the ram differently). It seems it wasn't removed
properly.
> And as for the rest of the code, lots of magic numbers to #define
> what/why (why udelay(2) and 22?)
>
Before going into more detail, remember this is ram initialization
code. That's always going to be a pain :(.
There's nothing magic here. It's just a fact of life. Every step is
going to need a different delay. No need to bloat the headers by
#defining each. It also makes raminit code more unreadable.
We got these numbers from allwinner code dumps. We used to have these
as sdelay() numbers, which usually meant units of 2 clock cycles. So
we had to convert them to udelay() to at least make the delays
independent of CPU clock. The old sdelay() numbers made no sense either.
Alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJTIzsgAAoJEL0kPHNPXJJKasUQAKygf9UpJc6IINH41LKOFnBf
fBEVB8ECIu96JWUDE9r0BQw0l6Pc82Mqx+XUZdbNhhZNhhVf8EJ/9koHQrP/X8By
J8MninT7pgDi7IH9Y+U5GfuHEA1nDQT0kf+nYMNrUIx1b9cuv5vLvhpeKL0AJotb
DE8miBRCcuRcAivCjERjlVFKCicMERKx1cTrris7+aQyNAxPEGrFj0pS8RBpSgBF
j+NkRSjbdnAOKHOfpXZi7VMqhHIt6NDxsuSrM0roSJz1v79+J5TGqUdPFKvGVZro
BbsWB3pRq8zSdO6OYvojUjyWPG95PfhDQvLSlvKA5Z1AlgNHu32YGkFWGbUve/z7
8dn057RjY4KtrAn+jVOL8+sBAj6yr0VIJmxqa1xPqGOMBAn0Cn+JJZ6auCNPZGqx
yt5glg0B5lHsVgCnmDGvoKs8SAv7n7IQfmiF+gvD8Pn0/NC31UQ2WA3khJoPt6Gp
9G5q+sn6BRrUpQOiQmhJTPX4W3g3nmXFqWYkd+VAWEHeEfHTIuqOlcfgdwMmP4Ti
hrhrk/CWSOPjtYuI5yByA6RCZ93smb4uexSmrzzafzuYrdwK/DmP+TumFrE8pycT
cMsxAx40UEElJ5OHN7YaWtt6NNhCT6BVlo76awqFY/vGme0cef74SQqB8EdyVYSE
PDoq+Sog13y4A8OjQ5rT
=e7kN
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2014-03-14 17:23 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 10:33 [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort Ian Campbell
2014-03-14 10:33 ` [U-Boot] [PATCH v1 1/9] sunxi: initial sun7i clocks and timer support Ian Campbell
2014-03-14 14:16 ` Tom Rini
2014-03-14 10:33 ` [U-Boot] [PATCH v1 2/9] sunxi: initial sun7i pinmux and gpio support Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-14 10:33 ` [U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-14 16:28 ` [U-Boot] [linux-sunxi] " Henrik Nordström
2014-03-14 17:24 ` Luke Kenneth Casson Leighton
2014-03-17 13:16 ` [U-Boot] " Stefan
2014-03-17 14:56 ` [U-Boot] [linux-sunxi] " Ian Campbell
2014-03-14 17:23 ` Alex G. [this message]
2014-03-14 18:59 ` [U-Boot] " Tom Rini
2014-03-14 10:33 ` [U-Boot] [PATCH v1 4/9] sunxi: initial generic sun7i cpu, board and start of day support Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-15 15:57 ` Alex G.
2014-03-14 10:33 ` [U-Boot] [PATCH v1 5/9] sunxi: generic sun7i build infrastructure Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-16 13:25 ` Ian Campbell
2014-03-17 15:04 ` Tom Rini
2014-03-17 15:24 ` Ian Campbell
2014-03-14 10:33 ` [U-Boot] [PATCH v1 6/9] sunxi: add support for Cubietruck booting in FEL mode Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-14 10:33 ` [U-Boot] [PATCH v1 7/9] sunxi: mmc support Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-14 15:36 ` Pantelis Antoniou
2014-03-16 20:38 ` Ian Campbell
2014-03-17 2:13 ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2014-03-14 10:33 ` [U-Boot] [PATCH v1 8/9] sunxi: non-FEL SPL boot support for sun7i Ian Campbell
2014-03-14 14:17 ` Tom Rini
2014-03-14 18:50 ` Hans de Goede
2014-03-14 19:03 ` Tom Rini
2014-03-16 15:19 ` Ian Campbell
2014-03-16 16:45 ` Ian Campbell
2014-03-17 15:20 ` Tom Rini
2014-03-17 15:29 ` Ian Campbell
2014-03-17 15:36 ` Tom Rini
2014-03-17 19:33 ` Tom Rini
2014-03-18 8:22 ` [U-Boot] [linux-sunxi] " Maxime Ripard
2014-03-21 14:58 ` Tom Rini
2014-03-20 19:57 ` [U-Boot] " Ian Campbell
2014-03-14 10:33 ` [U-Boot] [PATCH v1 9/9] sunxi: add gmac Ethernet support Ian Campbell
2014-03-14 11:11 ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2014-03-14 11:28 ` Ian Campbell
2014-03-14 14:22 ` Tom Rini
2014-03-16 15:09 ` Ian Campbell
2014-03-17 15:06 ` Tom Rini
2014-03-14 14:17 ` [U-Boot] " Tom Rini
2014-03-14 12:55 ` [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort Tom Rini
2014-03-14 13:59 ` Ian Campbell
2014-03-14 14:19 ` Tom Rini
2014-03-14 15:01 ` Albert ARIBAUD
2014-03-14 19:07 ` Hans de Goede
2014-03-14 19:11 ` Hans de Goede
2014-03-14 13:02 ` Albert ARIBAUD
2014-03-14 13:13 ` Maxime Ripard
2014-03-14 14:03 ` Ian Campbell
2014-03-14 14:16 ` Tom Rini
2014-03-14 15:04 ` Ian Campbell
2014-03-14 15:13 ` Tom Rini
2014-03-14 20:17 ` Dennis Gilmore
2014-03-15 16:02 ` Hans de Goede
2014-03-16 7:49 ` Ian Campbell
2014-03-14 14:31 ` Marek Vasut
2014-03-14 15:21 ` Henrik Nordström
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=53233B26.2070904@gmail.com \
--to=mr.nuke.me@gmail.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