summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-10-26 15:07:57 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-10-26 15:09:10 -0400
commit3951fbf9d2b5609b44aa639f6c24e0d970cbf931 (patch)
treec01e99868bae046c4dbd5bcf0fb25f6d6b324128
parentaea4974b88bf5ea2a87fcc23d5f8bca422242dc0 (diff)
downloadrockbox-3951fbf9d2b5609b44aa639f6c24e0d970cbf931.tar.gz
rockbox-3951fbf9d2b5609b44aa639f6c24e0d970cbf931.zip
ATA: Restrict to UDMA2 if we don't detect an "80-pin" cable
Change-Id: I55861065741f3365491445f1f3f5b0041f33e1c6
-rw-r--r--apps/debug_menu.c4
-rw-r--r--firmware/drivers/ata.c7
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c18
3 files changed, 23 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 427df27e3e..32c34942e6 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1567,9 +1567,9 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1567 '0' + (i & 7)); 1567 '0' + (i & 7));
1568 } 1568 }
1569#endif /* HAVE_ATA_DMA */ 1569#endif /* HAVE_ATA_DMA */
1570 i = identify_info[0] & (1 << 15); 1570 i = identify_info[83] & (1 << 2);
1571 simplelist_addline( 1571 simplelist_addline(
1572 "CF compatible: %s", i ? "yes" : "no"); 1572 "CFA compatible: %s", i ? "yes" : "no");
1573 i = identify_info[0] & (1 << 6); 1573 i = identify_info[0] & (1 << 6);
1574 simplelist_addline( 1574 simplelist_addline(
1575 "Fixed device: %s", i ? "yes" : "no"); 1575 "Fixed device: %s", i ? "yes" : "no");
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 5331e7f589..cb857158ca 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -1116,8 +1116,13 @@ static int set_features(void)
1116 1116
1117#ifdef HAVE_ATA_DMA 1117#ifdef HAVE_ATA_DMA
1118 if (identify_info[53] & (1<<2)) { 1118 if (identify_info[53] & (1<<2)) {
1119 int max_udma = ATA_MAX_UDMA;
1120#if ATA_MAX_UDMA > 2
1121 if (!(ata_identify_data[93] & BIT(13)))
1122 max_udma = 2;
1123#endif
1119 /* Ultra DMA mode info present, find a mode */ 1124 /* Ultra DMA mode info present, find a mode */
1120 dma_mode = ata_get_best_mode(identify_info[88], ATA_MAX_UDMA, 0x40); 1125 dma_mode = ata_get_best_mode(identify_info[88], max_udma, 0x40);
1121 } 1126 }
1122 1127
1123 if (!dma_mode) { 1128 if (!dma_mode) {
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)
609static int udmatimes[ATA_MAX_UDMA + 1] = { 609static 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};
616static int mwdmatimes[ATA_MAX_MWDMA + 1] = { 622static int mwdmatimes[ATA_MAX_MWDMA + 1] = {
617 0x1c175, 623 0x1c175,
618 0x7083, 624 0x7083,
619 0x5072 625 0x5072,
620}; 626};
627
621static int ata_get_best_mode(unsigned short identword, int max, int modetype) 628static 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 }