From: Jian Luo <Jian.Luo4@boschrexroth.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: socfpga: dm: Fix DM initialization failure after warm reset
Date: Thu, 3 Sep 2015 12:03:44 +0200 [thread overview]
Message-ID: <55E81B00.5090203@boschrexroth.de> (raw)
In-Reply-To: <201509031141.22095.marex@denx.de>
Hi!
On 03.09.2015 11:41, Marek Vasut wrote:
> On Wednesday, September 02, 2015 at 06:27:41 PM, Jian Luo wrote:
>> Hi!
>>
>> this error comes again. It isn't a compiler error after all. :(
>>
>> JTAG inspection shows that the problem is located in
>> arch/arm/mach-socfpga/spl.c line94.
>> It seems that re-enable ECC on OCRAM can cause some strange value
>> changes in SRAM.
>> Disabling ECC might also cause value changes, which I didn't test.
>>
>> On a cold (re)boot sysmgr_regs->eccgrp_ocram is 0x19 (derr|serr|en). So
>> gd keeps intact.
>>
>> In our VxWorks Image ECC on OCRAM happens to be disabled.
>> After a warm reset sysmgr_regs->eccgrp_ocram is 0x18 (derr|serr).
>> Thus after re-enable ECC, gd->dm_root turns to 0x80 every time.
>
> Ew, Dinh, can you check this please ? This is scary.
You can also reproduce the problem directly in U-Boot with 2 steps:
=> mw.l 0xFFD08144 0
=> reset
On my ade0-nano-soc it hangs even before serial output,
which means it did corrupt the SPL. I guess I just got (un)lucky with socdk.
>
>> My solution is keeping SYSMGR_ECC_OCRAM_EN bit untouched. And it works
>> for me.
>>
>> diff --git a/arch/arm/mach-socfpga/spl.c b/arch/arm/mach-socfpga/spl.c
>> index 775a827..c858406 100644
>> --- a/arch/arm/mach-socfpga/spl.c
>> +++ b/arch/arm/mach-socfpga/spl.c
>> @@ -90,12 +90,14 @@ void board_init_f(ulong dummy)
>> * and DBE might triggered during power on
>> */
>> reg = readl(&sysmgr_regs->eccgrp_ocram);
>> - if (reg & SYSMGR_ECC_OCRAM_SERR)
>> - writel(SYSMGR_ECC_OCRAM_SERR | SYSMGR_ECC_OCRAM_EN,
>> - &sysmgr_regs->eccgrp_ocram);
>> - if (reg & SYSMGR_ECC_OCRAM_DERR)
>> - writel(SYSMGR_ECC_OCRAM_DERR | SYSMGR_ECC_OCRAM_EN,
>> - &sysmgr_regs->eccgrp_ocram);
>> + if (reg & SYSMGR_ECC_OCRAM_SERR) {
>> + reg &= ~SYSMGR_ECC_OCRAM_SERR;
>> + writel(reg, &sysmgr_regs->eccgrp_ocram);
>> + }
>> + if (reg & SYSMGR_ECC_OCRAM_DERR) {
>> + reg &= ~SYSMGR_ECC_OCRAM_DERR;
>> + writel(reg, &sysmgr_regs->eccgrp_ocram);
>> + }
>>
>> memset(__bss_start, 0, __bss_end - __bss_start);
>>
>> Other solution:
>> 1. Moving OCRAM ECC setting to earlier stage: requires change in generic
>> code.
>> 2. Clear gd afterwards: requires replication of every early stage gd
>> setting.
>
> What I would be worried is that if this really happens, it likely
also corrupts
> the SPL code which is loaded in OCRAM.
>
> Can't you tune the VxWorks to keep the ECC enabled ?
Yes, I can. But U-Boot can still have problem with other Image which
disables ECC.
I found another post related to this problem
https://lkml.org/lkml/2015/2/6/685 .
Quote: To initialize ECC, the OCRAM needs to enable ECC then clear
the entire
memory to zero before using it.
Best regards,
Jian Luo
next prev parent reply other threads:[~2015-09-03 10:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-28 8:41 [U-Boot] [PATCH] arm: socfpga: dm: Fix DM initialization failure after warm reset Jian Luo
2015-08-28 9:24 ` Marek Vasut
2015-08-28 10:27 ` Jian Luo
2015-08-28 10:30 ` Marek Vasut
2015-08-28 11:40 ` Jian Luo
2015-08-28 12:01 ` Marek Vasut
2015-08-28 12:09 ` Jian Luo
2015-08-28 21:48 ` Marek Vasut
2015-08-31 13:00 ` Jian Luo
2015-08-31 13:28 ` Marek Vasut
2015-09-02 16:27 ` Jian Luo
2015-09-03 9:41 ` Marek Vasut
2015-09-03 10:03 ` Jian Luo [this message]
2015-09-03 10:09 ` Marek Vasut
2015-09-03 10:17 ` Jian Luo
2015-09-03 10:46 ` Marek Vasut
2015-09-03 11:12 ` Jian Luo
2015-09-03 11:14 ` Marek Vasut
2015-09-04 0:23 ` Simon Glass
2015-09-04 7:36 ` Jian Luo
2015-09-04 14:16 ` Simon Glass
2015-09-04 14:25 ` Marek Vasut
2015-09-04 14:26 ` Simon Glass
2015-09-04 14:32 ` Marek Vasut
2015-09-22 12:26 ` Jian Luo
2015-08-28 23:21 ` Simon Glass
2015-08-29 7:56 ` Marek Vasut
2015-08-29 14:39 ` Simon Glass
2015-08-29 14:46 ` Marek Vasut
2015-08-29 14:49 ` Simon Glass
2015-08-29 15:45 ` Marek Vasut
2015-08-29 16:54 ` Simon Glass
2015-08-29 19:19 ` Marek Vasut
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=55E81B00.5090203@boschrexroth.de \
--to=jian.luo4@boschrexroth.de \
--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.