public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Aneesh V <aneesh@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2 V2] arm926: Flush the data cache before disabling it.
Date: Fri, 13 Jan 2012 23:49:57 +0530	[thread overview]
Message-ID: <4F1075CD.5020507@ti.com> (raw)
In-Reply-To: <20120113173821.GC4482@Hardy>

On Friday 13 January 2012 11:08 PM, Sughosh Ganu wrote:
> hi Heiko,
>
> On Fri Jan 13, 2012 at 04:29:29PM +0100, Heiko Schocher wrote:
>> Hello Sugosh,
>>
>> Sughosh Ganu wrote:
>>> hi Christian,
>>>
>>> On Fri Jan 13, 2012 at 09:06:26AM +0100, Christian Riesch wrote:
>>>> Hi Sughosh,
>>>> I had a look at the patch and I tried to understand what's going on
>>>> here (I must confess that I didn't know anything about this cache
>>>> stuff).
>>>
>>>    Ok, thanks for taking time off to understand this issue.
>>>
>>>> On Tue, Jan 10, 2012 at 7:12 PM, Sughosh Ganu<urwithsughosh@gmail.com>  wrote:
>>>>> The current implementation invalidates the cache instead of flushing
>>>>> it. This causes problems on platforms where the spl/u-boot is already
>>>>> loaded to the RAM, with caches enabled by a first stage bootloader.
>>
>> Hmm.. how did u-boot work on such boards? How can u-boot work with D-Cache
>> enabled, if u-boot is not initializing it? (And I think, on davinci SoC
>> we have a none working uboot ethernet driver if d-cache is enabled too).
>> There must be a page_table in DRAM for using D-Cache in U-Boot, if u-boot
>> don't initialize it, it maybe overrides it ... or miss I something?
>
>    Well, there is some data in the cache, which if not flushed creates
>    problems on my board. I get the board to boot just by commenting out
>    cpu_init_crit call. My hypothesis that the D-cache is enabled is
>    simply because cache invalidation followed by cache disabling breaks
>    the board, while flushing it prior to disabling gets it to boot
>    fine. This(invalidation) would not have been a problem if the cache
>    was in the disabled state.

It would have affected if the state of dirty bits and valid bits are
not guaranteed at reset. But looks like cache entries are guaranteed to
be invalidated on reset in ARM926ejs per the spec (which is not the
case in ARMv7). In this case, I agree that flush shouldn't harm
anything ideally.

>
>>
>> Are you sure, the RBL enables the D-Cache on your board? Nevertheless,
>> I think, we must disable the D-Cache here with "cleaning" it (as your
>> patch did) instead only invalidating it, as current code did.
>
>    I am not sure, this is just my guess. By default, the caches are
>    disabled on reset, so the only possible source is the rbl. But I
>    don't have access to the rbl code to say for sure. Unfortunately i
>    also don't have JTAG or any other debugger to dig more into

I will be surprised too if D-cache is enabled by ROM code. But I agree
that your problem and the solution seems to indicate something like
that. To be sure can you check the value of CP15 System control
register on SPL entry? You are already reading it. Can you save it
somewhere and spit it out later?

>    this. But yes, like you mention, we must be cleaning the cache
>    before disabling it, so this fix is correct.

I think it will be good to add an invalidate of I-cache too. You have
replaced an invalidate of I & D cache with a flush of only D-cache.

br,
Aneesh

  reply	other threads:[~2012-01-13 18:19 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 18:25 [U-Boot] [PATCH 1/2] Flush the date cache before disabling it Sughosh Ganu
2012-01-09 18:41 ` Mike Frysinger
2012-01-09 18:51   ` Sughosh Ganu
2012-01-10 18:12 ` [U-Boot] [PATCH 1/2 V2] arm926: Flush the data " Sughosh Ganu
2012-01-10 20:07   ` Marek Vasut
2012-01-11  6:20     ` Sughosh Ganu
2012-01-11 10:47       ` Marek Vasut
2012-01-11 12:11         ` Sughosh Ganu
2012-01-11 12:42           ` Marek Vasut
2012-01-11 13:31             ` Sughosh Ganu
2012-01-11 13:51               ` Marek Vasut
2012-01-11 13:52                 ` Marek Vasut
2012-01-11 14:50                   ` Sughosh Ganu
2012-01-11 15:01                     ` Marek Vasut
2012-01-11 15:09                       ` Sughosh Ganu
2012-01-11 18:50                         ` Marek Vasut
2012-01-11 21:07                           ` Christian Riesch
2012-01-11 22:13                             ` Marek Vasut
2012-01-12  5:56                               ` Christian Riesch
2012-01-12  6:29                                 ` Sughosh Ganu
2012-01-14  9:09                                   ` Albert ARIBAUD
2012-01-14 17:18                                     ` Christian Riesch
2012-01-12 12:03   ` Christian Riesch
2012-01-12 13:53     ` Sughosh Ganu
2012-01-12 14:04       ` Christian Riesch
2012-01-12 14:43         ` Sughosh Ganu
2012-01-14 17:20           ` Christian Riesch
2012-01-14 18:02             ` Sughosh Ganu
2012-01-13  8:06   ` Christian Riesch
2012-01-13  8:26     ` Sughosh Ganu
2012-01-13 14:41       ` Tom Rini
2012-01-13 17:23         ` Sughosh Ganu
2012-01-13 15:29       ` Heiko Schocher
2012-01-13 17:38         ` Sughosh Ganu
2012-01-13 18:19           ` Aneesh V [this message]
2012-01-14  7:45             ` Sughosh Ganu
2012-01-15  8:13           ` Heiko Schocher
2012-01-16 17:57           ` Tom Rini
2012-01-17  6:39             ` Heiko Schocher
2012-01-17  6:46             ` Sughosh Ganu
2012-01-17 15:27               ` Tom Rini
2012-01-19  6:53                 ` Sughosh Ganu
2012-01-19 10:17                   ` Aneesh V
2012-01-19 11:30                     ` Christian Riesch
2012-01-19 11:54                       ` Aneesh V
2012-01-20  7:28                         ` Christian Riesch
2012-01-20  8:52                           ` Aneesh V
2012-01-20  9:21                             ` Christian Riesch
2012-01-20 12:13                               ` Aneesh V
2012-01-20 12:48                                 ` Christian Riesch
2012-01-20 13:06                                   ` Aneesh V
2012-01-27 18:33                                     ` Tom Rini
2012-01-29 13:36                                       ` Christian Riesch
2012-01-30  6:39                                         ` Heiko Schocher
2012-01-30  8:10                                           ` Christian Riesch
2012-01-30  9:04                                             ` Sughosh Ganu
2012-01-30 10:38                                           ` Christian Riesch
2012-01-30  7:06                                         ` Sughosh Ganu
2012-01-30 17:03                                         ` Tom Rini
2012-01-31  4:09                                           ` Sughosh Ganu
2012-01-31 13:58                                           ` Christian Riesch
2012-01-20 11:56                           ` Tom Rini
2012-01-13 15:06     ` Heiko Schocher
2012-01-13 17:22       ` Sughosh Ganu
2012-01-14  7:49   ` [U-Boot] [PATCH 1/2 V3] " Sughosh Ganu
2012-01-14  9:02     ` Albert ARIBAUD
2012-01-14  9:21       ` Sughosh Ganu
2012-01-14 10:34         ` Albert ARIBAUD
2012-01-14 14:02     ` [U-Boot] [PATCH 1/2 V4] " Sughosh Ganu
2012-02-18 15:41       ` Albert ARIBAUD
2012-02-18 18:51         ` [U-Boot] [PATCH 1/2 V3] " Christian Riesch
2012-02-19  8:31           ` Albert ARIBAUD
2012-01-20  9:22   ` [U-Boot] [PATCH 1/2 V2] " James W.

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=4F1075CD.5020507@ti.com \
    --to=aneesh@ti.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