From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Jander Date: Wed, 20 Jul 2011 08:29:02 +0200 Subject: [U-Boot] i.MX51: FEC: Cache coherency problem? In-Reply-To: <20110719141048.72d67cb3@archvile> References: <20110718171836.67bfe605@archvile> <4E245C5C.4030303@ti.com> <4E256588.4010301@arcor.de> <20110719131744.403a81e6@archvile> <20110719112026.C303D17E88C9@gemini.denx.de> <20110719141048.72d67cb3@archvile> Message-ID: <20110720082902.0d544f00@archvile> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 19 Jul 2011 14:10:48 +0200 David Jander wrote: > On Tue, 19 Jul 2011 13:20:26 +0200 > Wolfgang Denk wrote: > > > Dear David Jander, > > > > In message <20110719131744.403a81e6@archvile> you wrote: > > > > > > Now I finally know what's wrong and am working on a proposed fix to make > > > this one driver cache-aware. > > > > I would just like to point out that these efforts are highly > > appreciated! > > Thanks. > I'll try my best, but I am running out of time, and it is still not as it > should. I still have trouble identifying the right place where receive buffer > descriptors should be cache-invalidated. At one point, a magic > flush_dcache_all() at a certain place in code made it work, but that can't be > entirely correct, and if I replace it with only the necessary ranges, it > doesn't work correctly anymore, so I guess this flush is also invalidating > something I need elsewhere :-( > I keep searching.... through the IMO fairly convoluted network code. Ok, that was not such a problem. I found few nice spots, where cache-maintenance code should go IMO: In fec_rx_task_enable() cleaned RX BD's should be flushed. In fec_tx_task_enable() dirty TX BD's should be flushed, as well as data buffers. In fec_send() Invalidate BD status fields before reading, also in the while loop. In fec_recv() Invalidate BD and data buffers just before every read. And of course align all buffers to cache-line size and pad around the end of each buffer to cache-line size. Problem: It doesn't work (tftp transfer stops after a few packets)! :-( I am giving up! Plan B: I'll now try to allocate all buffers in internal RAM (which is not cached AFAIK). Any ideas? Best regards, -- David Jander Protonic Holland.