From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/10] sunxi: Add a33 dram init code
Date: Sun, 26 Apr 2015 20:31:15 +0200 [thread overview]
Message-ID: <553D2EF3.2090609@redhat.com> (raw)
In-Reply-To: <1429175350.25195.43.camel@hellion.org.uk>
Hi,
On 04/16/2015 11:09 AM, Ian Campbell wrote:
> On Thu, 2015-04-16 at 09:27 +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 15-04-15 21:56, Ian Campbell wrote:
>>> On Tue, 2015-04-14 at 18:06 +0200, Hans de Goede wrote:
>>>> From: Vishnu Patekar <vishnupatekar0510@gmail.com>
>>>>
>>>> Based on Allwinner dram init code from the a33 bsp:
>>>> https://github.com/allwinner-zh/bootloader/blob/master/basic_loader/bsp/bsp_for_a33/init_dram/mctl_hal.c
>>>>
>>>> Initial u-boot port by Vishnu Patekar, major cleanup / rewrite by
>>>> Hans de Goede.
>>>>
>>>> Signed-off-by: Vishnu Patekar <vishnupatekar0510@gmail.com>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>
>>>> + /* Set dram timing */
>>>> + reg_val = (twtp << 24) | (tfaw << 16) | (trasmax << 8) | (tras << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg0);
>>>> + reg_val = (txp << 16) | (trtp << 8) | (trc << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg1);
>>>> + reg_val = (tcwl << 24) | (tcl << 16) | (trd2wr << 8) | (twr2rd << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg2);
>>>> + reg_val = (tmrw << 16) | (tmrd << 12) | (tmod << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg3);
>>>> + reg_val = (trcd << 24) | (tccd << 16) | (trrd << 8) | (trp << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg4);
>>>> + reg_val = (tcksrx << 24) | (tcksre << 16) | (tckesr << 8) | (tcke << 0);
>>>> + writel(reg_val, &mctl_ctl->dramtmg5);
>>>
>>> There's a lot of magic numbers here (and in the following code),
>>> although in this particular context (with the named var) unless they are
>>> the same elsewhere I'm not sure #defines would improve things much, but
>>> I think some of the other stuff likely would.
>>>
>>> Assuming you have any idea what the bits are, I suppose that per usual
>>> we don't really know because -ENODOC?
>>
>> Right the problem here is -ENODOC, the magic values come from the allwinnner
>> code and in the cases where we do not have named variables (as we do in
>> the above blurb) we've no clue what we're doing really, so I think adding
>> defines there will only obfuscate things.
>>
>> Can you give a short description of the cases where you believe that
>> adding defines would be a good idea ?
>
> Anywhere where we know the meanings ;-) If that's nowhere then the magic
> numbers are fine (which is what my final paragraph was trying to say,
> but not very clearly).
Ok, so I've gone over the entire dram init code another time, and I've
not been able to find a single place where I can add a define with a
meaningful name to replace the magic values.
So no v2 for this patch, can I get an ack for v1 ?
Regards,
Hans
next prev parent reply other threads:[~2015-04-26 18:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 16:06 [U-Boot] [PATCH 01/10] sunxi: Also set Auxiliary Ctl SMP bit in SPL Hans de Goede
2015-04-14 16:06 ` [U-Boot] [PATCH 02/10] sunxi: usbc: Remove unused irq field Hans de Goede
2015-04-15 19:41 ` Ian Campbell
2015-04-14 16:06 ` [U-Boot] [PATCH 03/10] sunxi: Introduce a hidden ARCH_SUN6I Kconfig bool Hans de Goede
2015-04-15 6:51 ` Michal Suchanek
2015-04-15 7:35 ` Hans de Goede
2015-04-15 8:01 ` Michal Suchanek
2015-04-15 8:07 ` Hans de Goede
2015-04-15 8:45 ` Michal Suchanek
2015-04-15 19:47 ` Ian Campbell
2015-04-16 7:23 ` Hans de Goede
2015-04-17 11:06 ` Ian Campbell
2015-04-15 7:00 ` Michal Suchanek
2015-04-15 7:36 ` Hans de Goede
2015-04-14 16:06 ` [U-Boot] [PATCH 04/10] sunxi: s/sun8i/sun8i_a23/ Hans de Goede
2015-04-15 19:49 ` Ian Campbell
2015-04-16 7:24 ` Hans de Goede
2015-04-14 16:06 ` [U-Boot] [PATCH 05/10] sunxi: Add support for A33 PLL11 (second DRAM pll) Hans de Goede
2015-04-15 19:50 ` Ian Campbell
2015-04-14 16:06 ` [U-Boot] [PATCH 06/10] sunxi: Add a33 dram init code Hans de Goede
2015-04-15 19:56 ` Ian Campbell
2015-04-16 7:27 ` Hans de Goede
2015-04-16 9:09 ` Ian Campbell
2015-04-26 18:31 ` Hans de Goede [this message]
2015-05-02 13:37 ` Ian Campbell
2015-04-14 16:06 ` [U-Boot] [PATCH 07/10] sunxi: Fix end of kernel memory alignment for A33 Hans de Goede
2015-04-15 19:57 ` Ian Campbell
2015-04-16 7:32 ` Hans de Goede
2015-04-16 17:35 ` Mark Rutland
2015-04-16 19:12 ` Hans de Goede
2015-04-17 10:20 ` Mark Rutland
2015-04-24 18:32 ` Hans de Goede
2015-04-28 9:33 ` Mark Rutland
2015-04-14 16:06 ` [U-Boot] [PATCH 08/10] sunxi: Add basic A33 basic support Hans de Goede
2015-04-15 20:00 ` Ian Campbell
2015-04-16 7:35 ` Hans de Goede
2015-04-17 11:07 ` Ian Campbell
2015-04-14 16:07 ` [U-Boot] [PATCH 09/10] sunxi: Add softwinner astar mid756 A33 tablet board defconfig Hans de Goede
2015-04-15 20:01 ` Ian Campbell
2015-05-04 15:48 ` Chen-Yu Tsai
2015-05-04 16:54 ` Hans de Goede
2015-04-14 16:07 ` [U-Boot] [PATCH 10/10] sunxi: Add Ippo_q8h_v1_2_a33_1024x600 defconfig Hans de Goede
2015-04-15 20:01 ` Ian Campbell
2015-04-15 19:41 ` [U-Boot] [PATCH 01/10] sunxi: Also set Auxiliary Ctl SMP bit in SPL Ian Campbell
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=553D2EF3.2090609@redhat.com \
--to=hdegoede@redhat.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