forked from len0rd/rockbox
pp5020: use ipod firmware timings for ATA PIO.
Some mSATA adapters seem to have trouble working with Rockbox using our normal PIO timings; the timing value we use is probably out of spec and is different to the OF. Switch to using the OF's timings according to which PIO mode we select. This may not completely resolve problems with these adapters but allows Rockbox to boot and play audio. Change-Id: If73210700eb4af01864b373709ee1d15c775fb11
This commit is contained in:
parent
090bd9592d
commit
5db83c155a
4 changed files with 43 additions and 28 deletions
|
@ -332,7 +332,7 @@ static ICODE_ATTR void copy_write_sectors(const unsigned char* buf,
|
||||||
}
|
}
|
||||||
#endif /* !ATA_OPTIMIZED_WRITING */
|
#endif /* !ATA_OPTIMIZED_WRITING */
|
||||||
|
|
||||||
static inline int ata_disk_isssd(void)
|
int ata_disk_isssd(void)
|
||||||
{
|
{
|
||||||
/* offset 217 is "Nominal Rotation rate"
|
/* offset 217 is "Nominal Rotation rate"
|
||||||
0x0000 == Not reported
|
0x0000 == Not reported
|
||||||
|
|
|
@ -165,6 +165,9 @@ int ata_num_drives(int first_drive);
|
||||||
long ata_last_disk_activity(void);
|
long ata_last_disk_activity(void);
|
||||||
int ata_spinup_time(void); /* ticks */
|
int ata_spinup_time(void); /* ticks */
|
||||||
|
|
||||||
|
/* Returns 1 if drive is solid-state */
|
||||||
|
int ata_disk_isssd(void);
|
||||||
|
|
||||||
#ifdef HAVE_ATA_DMA
|
#ifdef HAVE_ATA_DMA
|
||||||
/* Returns current DMA mode */
|
/* Returns current DMA mode */
|
||||||
int ata_get_dma_mode(void);
|
int ata_get_dma_mode(void);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "ata-driver.h"
|
#include "ata-driver.h"
|
||||||
|
#include "ata.h"
|
||||||
|
|
||||||
void ata_reset()
|
void ata_reset()
|
||||||
{
|
{
|
||||||
|
@ -43,6 +44,17 @@ bool ata_is_coldstart()
|
||||||
/* TODO: Implement coldstart variable */
|
/* TODO: Implement coldstart variable */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* These are PIO timings for 80 Mhz. At 24 Mhz, the first value is 0 but the
|
||||||
|
rest are the same. They go in IDE0_PRI_TIMING0.
|
||||||
|
|
||||||
|
Rockbox used to use 0x10, and test_disk shows that leads to faster PIO.
|
||||||
|
However on some disks connected with mSATA adapters this causes corrupt data
|
||||||
|
so we now just use these timings from the OF.
|
||||||
|
*/
|
||||||
|
static const unsigned long pio80mhz[] = {
|
||||||
|
0xC293, 0x43A2, 0x11A1, 0x7232, 0x3131
|
||||||
|
};
|
||||||
|
|
||||||
void ata_device_init()
|
void ata_device_init()
|
||||||
{
|
{
|
||||||
#ifdef SAMSUNG_YH920
|
#ifdef SAMSUNG_YH920
|
||||||
|
@ -64,20 +76,18 @@ void ata_device_init()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IDE0_PRI_TIMING0 = 0x10;
|
IDE0_PRI_TIMING0 = pio80mhz[0];
|
||||||
IDE0_PRI_TIMING1 = 0x80002150;
|
IDE0_PRI_TIMING1 = 0x80002150;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These are PIO timings for 80 Mhz. At 24 Mhz,
|
/* Setup the timing for PIO mode */
|
||||||
the first value is 0 but the rest are the same.
|
void ata_set_pio_timings(int mode)
|
||||||
They go in IDE0_PRI_TIMING0.
|
{
|
||||||
|
if (ata_disk_isssd())
|
||||||
Rockbox used 0x10, and test_disk shows that leads to faster PIO.
|
IDE0_PRI_TIMING0 = pio80mhz[mode];
|
||||||
If 0x10 is incorrect, these timings may be needed with some devices.
|
else
|
||||||
static const unsigned long pio80mhz[] = {
|
IDE0_PRI_TIMING0 = 0x10;
|
||||||
0xC293, 0x43A2, 0x11A1, 0x7232, 0x3131
|
}
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_ATA_DMA
|
#ifdef HAVE_ATA_DMA
|
||||||
/* Timings for multi-word and ultra DMA modes.
|
/* Timings for multi-word and ultra DMA modes.
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
#define ATA_OPTIMIZED_READING
|
#define ATA_OPTIMIZED_READING
|
||||||
#define ATA_OPTIMIZED_WRITING
|
#define ATA_OPTIMIZED_WRITING
|
||||||
|
|
||||||
|
#define ATA_SET_PIO_TIMING
|
||||||
|
|
||||||
#endif /* CONFIG_CPU */
|
#endif /* CONFIG_CPU */
|
||||||
|
|
||||||
#ifdef HAVE_ATA_DMA
|
#ifdef HAVE_ATA_DMA
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue