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] i.MX51: FEC: Cache coherency problem?
Date: Tue, 19 Jul 2011 17:12:52 +0530	[thread overview]
Message-ID: <4E256DBC.1060303@ti.com> (raw)
In-Reply-To: <20110719105857.21861c05@archvile>

On Tuesday 19 July 2011 02:28 PM, David Jander wrote:
>
> Dear Aneesh,
>
> Thanks a lot for your replies.
>
> On Tue, 19 Jul 2011 14:13:34 +0530
> Aneesh V<aneesh@ti.com>  wrote:
>> On Tuesday 19 July 2011 02:07 PM, David Jander wrote:
>>> On Tue, 19 Jul 2011 10:21:12 +0200
>>> Albert ARIBAUD<albert.u.boot@aribaud.net>   wrote:
>>>
>>>> Hi David,
>>>>
>>>> Le 19/07/2011 09:44, David Jander a ?crit :
>>>>>
>>>>> Hi Stefano,
>>>>>
>>>>> On Mon, 18 Jul 2011 18:55:05 +0200
>>>>> Stefano Babic<sbabic@denx.de>    wrote:
>>>>>
>>>>>> On 07/18/2011 05:18 PM, David Jander wrote:
>>>>>>>
>>>>>>> Hi all,
>>>>>>
>>>>>> Hi David,
>>>>>>
>>>>>>> What is going on here? Why did this work with caches enabled before??
>>>>>>
>>>>>> I think cache was always disabled..
>>>>>
>>>>> I had even L2-caches enabled in u-boot (copied/adapted some code from
>>>>> OMAP cache.S), and called i/dcache_enable() from board code like this:
>>>>>
>>>>> int board_late_init(void)
>>>>> {
>>>>>            power_init();
>>>>>            probe_board_type();
>>>>>            icache_enable();
>>>>>            dcache_enable();
>>>>>
>>>>>            return 0;
>>>>> }
>>>>>
>>>>> Is there a reason this wouldn't have worked before?
>>>>>
>>>>> Suppose it didn't. Does that mean we need to use the MMU to properly mark
>>>>> regions of register space and specially FEC BD's as not-cached? Or do we
>>>>> need to flash caches manually each time such a memory region is accessed?
>>>>> I am kind of a CPU-speed-junkie, so I am not sure I want to live without
>>>>> caches enabled in u-boot ;-)
>>
>> Are you talking about some memory-mapped IO region(register space). If
>> that is the case, that region won't be cached. ARM mmu implementation
>> makes only the SDRAM region cached. Rest is non-cached non-buffered.
>
> Ah, thanks for pointing out. I already suspected something like that...
>
>>>> You would have to flush (before sending packets / starting external
>>>> memory-to-device DMA) and invalidate (before reading received packets /
>>>> after external device-to-memory DMA is done); using MMU and mapping
>>>> cached/non-cached areas is IMO overkill, and will hurt CPU accesses to
>>>> the xmit/receive buffers and descriptors.
>>>
>>> So, you say actually what I did while exploring the problem would have
>>> been a correct way of solving this problem?
>>>
>>> Like this:
>>>
>>> 587         flush_cache(&fec->tbd_base[fec->tbd_index], 4);
>>
>> This is what is needed assuming the below is initiating a memory to
>> peripheral DMA. Is your buffer only 4 bytes long?
>
> No it isn't. I know, I should flush the whole buffer area, but this was just
> enough to get the status field flushed, so the FEC started transmitting, and
> the while loop ended eventually. The result was still not correct, but at
> least it won't hang.
> What would be more expensive, flushing just the buffer area, or
> flush_dcache_all()?

That depends on the buffer size. If the buffer size is really big
(comparable to L2$ size) flush_dcache_all() may turn out to be better.

>
>> Also, please check if flush_cache() is correctly supported for your
>> CPU. The default implementation in in arch/arm/lib/cache.c has support
>> for only a handful of cpus. AFAIK, only armv7 is over-riding this
>> default implementation at the moment.
>
> There is cache_v7.c which implements these... they are supposed to work
> correctly I guess?

Oops! I didn't notice that your CPU is armv7.
Yes, it's supposed to work correctly.

best regards,
Aneesh

  parent reply	other threads:[~2011-07-19 11:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 15:18 [U-Boot] i.MX51: FEC: Cache coherency problem? David Jander
2011-07-18 16:16 ` Aneesh V
2011-07-19  7:26   ` David Jander
2011-07-19 11:07   ` Matthias Weißer
2011-07-19 11:17     ` David Jander
2011-07-19 11:20       ` Wolfgang Denk
2011-07-19 12:10         ` David Jander
2011-07-20  6:29           ` David Jander
2011-07-20  8:56             ` Albert ARIBAUD
2011-07-20  9:21               ` David Jander
2011-07-20 10:29                 ` Aneesh V
2011-07-20 11:31                   ` David Jander
2011-07-20 12:05                     ` Aneesh V
2011-07-19 11:19     ` Wolfgang Denk
2011-07-19 14:31       ` Matthias Weißer
2011-07-19 11:51     ` Aneesh V
2011-07-18 16:55 ` Stefano Babic
2011-07-19  7:44   ` David Jander
2011-07-19  8:21     ` Albert ARIBAUD
2011-07-19  8:37       ` David Jander
2011-07-19  8:43         ` Aneesh V
2011-07-19  8:58           ` David Jander
2011-07-19  9:11             ` Albert ARIBAUD
2011-07-19 11:50               ` Aneesh V
2011-07-19 11:42             ` Aneesh V [this message]
2011-07-19  9:05           ` Albert ARIBAUD
2011-07-19 14:36             ` J. William Campbell
2011-07-19 15:17               ` David Jander
2011-07-19 18:14               ` Anton Staaf
2011-07-19 20:11                 ` J. William Campbell
2011-07-20 13:02                   ` Albert ARIBAUD
     [not found]                     ` <4E26DF9D.5070709@comcast.net>
     [not found]                       ` <4E26E7AA.9070001@aribaud.net>
2011-07-20 15:36                         ` J. William Campbell
2011-07-21  6:48                           ` David Jander
2011-07-23 13:04                             ` Albert ARIBAUD
2011-07-23 15:35                               ` J. William Campbell
2011-07-20  8:37                 ` Aneesh V

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=4E256DBC.1060303@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