diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c index da45906b36..7f5a19b9d0 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c | |||
@@ -70,6 +70,8 @@ static int spinup_time = 0; | |||
70 | static int dma_mode = 0; | 70 | static int dma_mode = 0; |
71 | static char aligned_buffer[SECTOR_SIZE] STORAGE_ALIGN_ATTR; | 71 | static char aligned_buffer[SECTOR_SIZE] STORAGE_ALIGN_ATTR; |
72 | 72 | ||
73 | static int ata_reset(void); | ||
74 | static void ata_power_down(void); | ||
73 | 75 | ||
74 | #ifdef ATA_HAVE_BBT | 76 | #ifdef ATA_HAVE_BBT |
75 | char ata_bbt_buf[ATA_BBT_PAGES * 64]; | 77 | char ata_bbt_buf[ATA_BBT_PAGES * 64]; |
@@ -78,8 +80,6 @@ uint64_t ata_virtual_sectors; | |||
78 | uint32_t ata_last_offset; | 80 | uint32_t ata_last_offset; |
79 | uint64_t ata_last_phys; | 81 | uint64_t ata_last_phys; |
80 | 82 | ||
81 | static int ata_reset(void); | ||
82 | static void ata_power_down(void); | ||
83 | int ata_rw_sectors_internal(uint64_t sector, uint32_t count, | 83 | int ata_rw_sectors_internal(uint64_t sector, uint32_t count, |
84 | void* buffer, bool write); | 84 | void* buffer, bool write); |
85 | 85 | ||
@@ -689,7 +689,11 @@ static int ata_power_up(void) | |||
689 | dma_mode = param; | 689 | dma_mode = param; |
690 | PASS_RC(ata_set_feature(0x03, param), 3, 4); | 690 | PASS_RC(ata_set_feature(0x03, param), 3, 4); |
691 | if (ata_identify_data[82] & BIT(5)) | 691 | if (ata_identify_data[82] & BIT(5)) |
692 | #ifdef ATA_HAVE_BBT | ||
692 | PASS_RC(ata_set_feature(ata_bbt ? 0x82 : 0x02, 0), 3, 5); | 693 | PASS_RC(ata_set_feature(ata_bbt ? 0x82 : 0x02, 0), 3, 5); |
694 | #else | ||
695 | PASS_RC(ata_set_feature(0x02, 0), 3, 5); | ||
696 | #endif | ||
693 | if (ata_identify_data[82] & BIT(6)) PASS_RC(ata_set_feature(0xaa, 0), 3, 6); | 697 | if (ata_identify_data[82] & BIT(6)) PASS_RC(ata_set_feature(0xaa, 0), 3, 6); |
694 | ATA_PIO_TIME = piotime; | 698 | ATA_PIO_TIME = piotime; |
695 | ATA_MDMA_TIME = mdmatime; | 699 | ATA_MDMA_TIME = mdmatime; |
@@ -947,8 +951,8 @@ static int ata_rw_sectors(uint64_t sector, uint32_t count, void* buffer, bool wr | |||
947 | int ata_rw_sectors_internal(uint64_t sector, uint32_t count, void* buffer, bool write) | 951 | int ata_rw_sectors_internal(uint64_t sector, uint32_t count, void* buffer, bool write) |
948 | { | 952 | { |
949 | #endif | 953 | #endif |
950 | if (sector + count > ata_total_sectors) RET_ERR(0); | ||
951 | if (!ata_powered) ata_power_up(); | 954 | if (!ata_powered) ata_power_up(); |
955 | if (sector + count > ata_total_sectors) RET_ERR(0); | ||
952 | ata_set_active(); | 956 | ata_set_active(); |
953 | if (ata_dma && write) commit_dcache(); | 957 | if (ata_dma && write) commit_dcache(); |
954 | else if (ata_dma) commit_discard_dcache(); | 958 | else if (ata_dma) commit_discard_dcache(); |