summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ata-target.h
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2010-01-31 11:07:29 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2010-01-31 11:07:29 +0000
commit533cf7737bae4363edefbfb202cb44e9eb30cd3f (patch)
treeabfb69b76b46fc8d22c14023969ba3fcaad4809d /firmware/target/arm/ata-target.h
parentc0e2d9fe1bb87730d9a8a7cac3cb8f6cd39ce630 (diff)
downloadrockbox-533cf7737bae4363edefbfb202cb44e9eb30cd3f.tar.gz
rockbox-533cf7737bae4363edefbfb202cb44e9eb30cd3f.zip
Enable ATA DMA on pp5020 based players with ATA drives.
DMA is only used for reading because writing seems to be slower with DMA. Only requests which are cacheline aligned (16 bytes) will use DMA, so many requests will still use PIO at this point; a later change will align more reads. Part of FS#9708, original DMA code by Boris Gjenero (dreamlayers). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24405 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ata-target.h')
-rw-r--r--firmware/target/arm/ata-target.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/firmware/target/arm/ata-target.h b/firmware/target/arm/ata-target.h
index 0881aaef35..82c5a5f555 100644
--- a/firmware/target/arm/ata-target.h
+++ b/firmware/target/arm/ata-target.h
@@ -81,3 +81,37 @@ void copy_write_sectors(const unsigned char* buf, int wordcount);
81void ata_reset(void); 81void ata_reset(void);
82bool ata_is_coldstart(void); 82bool ata_is_coldstart(void);
83void ata_device_init(void); 83void ata_device_init(void);
84
85#ifdef HAVE_ATA_DMA
86
87/* IDE DMA controller registers */
88#define IDE_DMA_CONTROL (*(volatile unsigned long *)(0xc3000400))
89#define IDE_DMA_LENGTH (*(volatile unsigned long *)(0xc3000408))
90#define IDE_DMA_ADDR (*(volatile unsigned long *)(0xc300040C))
91
92/* Maximum multi-word DMA mode supported by the controller */
93#define ATA_MAX_MWDMA 2
94
95#ifndef BOOTLOADER
96/* The PP5020 supports UDMA 4, but it needs cpu boosting and only
97 * improves performance by ~10% with a stock disk.
98 * UDMA 2 is stable at 30 Mhz.
99 * UDMA 1 is stable at 24 Mhz.
100 */
101#if CPUFREQ_NORMAL >= 30000000
102#define ATA_MAX_UDMA 2
103#elif CPUFREQ_NORMAL >= 24000000
104#define ATA_MAX_UDMA 1
105#else
106#error "CPU speeds under 24Mhz have not been tested with DMA"
107#endif
108#else
109/* The bootloader runs at 24 Mhz and needs a slower mode */
110#define ATA_MAX_UDMA 1
111#endif
112
113void ata_dma_set_mode(unsigned char mode);
114bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
115bool ata_dma_finish(void);
116
117#endif /* HAVE_ATA_DMA */