Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: ATA Ultra DMA on the PP5020

ATA Ultra DMA on the PP5020

From: Boris Gjenero <boris.gjenero_at_gmail.com>
Date: Wed, 24 Dec 2008 00:44:39 -0500

Hi,

I just subscribed here because this seems more appropriate than the
forums for development-related discussion. I'm Boris Gjenero,
dreamlayers on the forums and in the tracker.

I got Ultra DMA working on my 5th generation 30 gig iPod. Mode 2 (33.3
MB/s) seems stable, and it doesn't need CPU frequency boost. I've also
used mode 4 (66.7 MB/s), but that required boosting and I didn't test it
extensively.

While implementing this I significantly altered firmware/drivers/ata.c.
  I merged the read and write functions into a transfer function which
can do both reads and writes with both PIO and DMA. This removes some
code duplication and IMHO enhances writes by using "write multiple" and
doing retries if needed.

The main benefit I can see from DMA is somewhat faster buffer filling.
For example, with one large unfragmented FLAC file and the FS#9621 FAT
read-ahead patch, the initial load is about twice as fast with DMA.
Test_disk says 1 meg reads are 14102 KB/s and writes aren't sped up. I
suspect the reported read speed is from the drive's cache, not the
media. (BTW. Why are PIO reads slower than PIO writes in test_disk?)

The main cost of DMA is having to flush and invalidate the cache. It
might be possible to only do that to part of the cache, but I haven't
figured this out yet. I guess DMA might not decrease the PP5020's power
consumption because the CPU is busy anyways due to polling, and the DMA
hardware also uses power. I'm thinking about working toward interrupt
support now, though I wonder how many other things are also polling.
Buffering could also be optimized for DMA, requesting in larger chunks
or even a single chunk if DMA is available.

I also noticed that Rockbox writes the weird value of 0x10 to the PIO
timing register, IDE0_PRI_TIMING0. (IDE0_PRI_TIMING1 is for DMA, with
the high order bit meaning Ultra DMA.) However, it works and it may be
a bit faster than what the code in flash uses.

I'm wondering how to proceed now. Is there interest in this, or is the
current way good enough? Should I continue to work on my modified
ata.c? Should I merge the DMA code with Rockbox with a minimum of
change to ata.c and create a patch based on that?

-- 
Boris
Received on 2008-12-24

Page was last modified "Jan 10 2012" The Rockbox Crew
aaa