diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-10-26 15:07:57 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-10-26 15:09:10 -0400 |
commit | 3951fbf9d2b5609b44aa639f6c24e0d970cbf931 (patch) | |
tree | c01e99868bae046c4dbd5bcf0fb25f6d6b324128 /firmware/target/arm/s5l8702/ipod6g | |
parent | aea4974b88bf5ea2a87fcc23d5f8bca422242dc0 (diff) | |
download | rockbox-3951fbf9d2b5609b44aa639f6c24e0d970cbf931.tar.gz rockbox-3951fbf9d2b5609b44aa639f6c24e0d970cbf931.zip |
ATA: Restrict to UDMA2 if we don't detect an "80-pin" cable
Change-Id: I55861065741f3365491445f1f3f5b0041f33e1c6
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c index 97a55eba10..87450aca73 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c | |||
@@ -609,15 +609,22 @@ static int ata_set_feature(uint32_t feature, uint32_t param) | |||
609 | static int udmatimes[ATA_MAX_UDMA + 1] = { | 609 | static int udmatimes[ATA_MAX_UDMA + 1] = { |
610 | 0x4071152, | 610 | 0x4071152, |
611 | 0x2050d52, | 611 | 0x2050d52, |
612 | #if ATA_MAX_UDMA >= 2 | ||
612 | 0x2030a52, | 613 | 0x2030a52, |
614 | #endif | ||
615 | #if ATA_MAX_UDMA >= 3 | ||
613 | 0x1020a52, | 616 | 0x1020a52, |
614 | 0x1010a52 | 617 | #endif |
618 | #if ATA_MAX_UDMA >= 4 | ||
619 | 0x1010a52, | ||
620 | #endif | ||
615 | }; | 621 | }; |
616 | static int mwdmatimes[ATA_MAX_MWDMA + 1] = { | 622 | static int mwdmatimes[ATA_MAX_MWDMA + 1] = { |
617 | 0x1c175, | 623 | 0x1c175, |
618 | 0x7083, | 624 | 0x7083, |
619 | 0x5072 | 625 | 0x5072, |
620 | }; | 626 | }; |
627 | |||
621 | static int ata_get_best_mode(unsigned short identword, int max, int modetype) | 628 | static int ata_get_best_mode(unsigned short identword, int max, int modetype) |
622 | { | 629 | { |
623 | unsigned short testbit = BIT_N(max); | 630 | unsigned short testbit = BIT_N(max); |
@@ -719,7 +726,12 @@ static int ata_power_up(void) | |||
719 | #ifdef HAVE_ATA_DMA | 726 | #ifdef HAVE_ATA_DMA |
720 | if ((ata_identify_data[53] & BIT(2)) && (ata_identify_data[88] & BITRANGE(0, 4))) /* Any UDMA */ | 727 | if ((ata_identify_data[53] & BIT(2)) && (ata_identify_data[88] & BITRANGE(0, 4))) /* Any UDMA */ |
721 | { | 728 | { |
722 | param = ata_get_best_mode(ata_identify_data[88], ATA_MAX_UDMA, 0x40); | 729 | int max_udma = ATA_MAX_UDMA; |
730 | #if ATA_MAX_UDMA > 2 | ||
731 | if (!(ata_identify_data[93] & BIT(13))) | ||
732 | max_udma = 2; | ||
733 | #endif | ||
734 | param = ata_get_best_mode(ata_identify_data[88], max_udma, 0x40); | ||
723 | ATA_UDMA_TIME = udmatimes[param & 0xf]; | 735 | ATA_UDMA_TIME = udmatimes[param & 0xf]; |
724 | ata_dma_flags = BIT(2) | BIT(3) | BIT(9) | BIT(10); | 736 | ata_dma_flags = BIT(2) | BIT(3) | BIT(9) | BIT(10); |
725 | } | 737 | } |