From 1fbf847eedd90b6f3e40decd64e1094d7a7dc383 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 3 Aug 2007 09:34:42 +0000 Subject: PP5002 ATA driver needs to wait for the controller to be ready again before writing the next control register value. Makes check_registers() not fail in the bootloader. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14153 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ata-target.h | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/firmware/target/arm/ata-target.h b/firmware/target/arm/ata-target.h index f8755c38b3..a029d457ce 100644 --- a/firmware/target/arm/ata-target.h +++ b/firmware/target/arm/ata-target.h @@ -19,20 +19,6 @@ #ifdef CPU_PP -#if (CONFIG_CPU == PP5002) - -/* Plain C reading and writing. See comment in ata-as-arm.S */ - -#elif defined CPU_PP502x - -/* asm optimized reading and writing */ -#define ATA_OPTIMIZED_READING -#define ATA_OPTIMIZED_WRITING -void copy_read_sectors(unsigned char* buf, int wordcount); -void copy_write_sectors(const unsigned char* buf, int wordcount); - -#endif /* CONFIG_CPU */ - /* primary channel */ #define ATA_DATA (*((volatile unsigned short*)(IDE_BASE + 0x1e0))) #define ATA_ERROR (*((volatile unsigned char*)(IDE_BASE + 0x1e4))) @@ -66,9 +52,28 @@ void copy_write_sectors(const unsigned char* buf, int wordcount); #define READ_PATTERN3_MASK 0xff #define READ_PATTERN4_MASK 0xff +#if (CONFIG_CPU == PP5002) + +#define SET_REG(reg,val) do { reg = (val); \ + while (!(IDE_CFG_STATUS & 0x40)); \ + } while (0) +#define SET_16BITREG(reg,val) reg = (val) + +/* Plain C reading and writing. See comment in ata-as-arm.S */ + +#elif defined CPU_PP502x + #define SET_REG(reg,val) reg = (val) #define SET_16BITREG(reg,val) reg = (val) +/* asm optimized reading and writing */ +#define ATA_OPTIMIZED_READING +#define ATA_OPTIMIZED_WRITING +void copy_read_sectors(unsigned char* buf, int wordcount); +void copy_write_sectors(const unsigned char* buf, int wordcount); + +#endif /* CONFIG_CPU */ + #endif void ata_reset(void); -- cgit v1.2.3