summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-05-15 02:11:32 +0200
committerCástor Muñoz <cmvidal@gmail.com>2016-05-15 21:38:37 +0200
commitdbcde01835f73285d1a4a61a2dc55add92ad25de (patch)
treefeeba4ea4953f41e19c59a7b3d8e3127d2494f78 /firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
parent469d64539007584241ccd475e81038ea4166f17b (diff)
downloadrockbox-dbcde01835f73285d1a4a61a2dc55add92ad25de.tar.gz
rockbox-dbcde01835f73285d1a4a61a2dc55add92ad25de.zip
iPod Classic: remove emCORE HDD endianess warning
Change-Id: I91aa2dca7e748fe043c16014661985c42ab84b1a
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c')
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
index 403946bfa6..48197cb085 100644
--- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
@@ -33,9 +33,6 @@
33#include "led.h" 33#include "led.h"
34#include "ata_idle_notify.h" 34#include "ata_idle_notify.h"
35#include "disk_cache.h" 35#include "disk_cache.h"
36#ifdef CHECK_ATA_SWAP
37#include "splash.h"
38#endif
39 36
40 37
41#ifndef ATA_RETRIES 38#ifndef ATA_RETRIES
@@ -53,9 +50,6 @@
53static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR; 50static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR;
54static uint16_t ata_identify_data[0x100] STORAGE_ALIGN_ATTR; 51static uint16_t ata_identify_data[0x100] STORAGE_ALIGN_ATTR;
55static bool ceata; 52static bool ceata;
56#ifdef CHECK_ATA_SWAP
57static bool ata_swap;
58#endif
59static bool ata_lba48; 53static bool ata_lba48;
60static bool ata_dma; 54static bool ata_dma;
61static uint64_t ata_total_sectors; 55static uint64_t ata_total_sectors;
@@ -536,18 +530,11 @@ static int ata_identify(uint16_t* buf)
536 } 530 }
537 else 531 else
538 { 532 {
539#ifdef CHECK_ATA_SWAP
540 uint32_t old = ATA_CFG;
541 ATA_CFG |= BIT(6);
542#endif
543 PASS_RC(ata_wait_for_not_bsy(10000000), 1, 0); 533 PASS_RC(ata_wait_for_not_bsy(10000000), 1, 0);
544 ata_write_cbr(&ATA_PIO_DVR, 0); 534 ata_write_cbr(&ATA_PIO_DVR, 0);
545 ata_write_cbr(&ATA_PIO_CSD, 0xec); 535 ata_write_cbr(&ATA_PIO_CSD, 0xec);
546 PASS_RC(ata_wait_for_start_of_transfer(10000000), 1, 1); 536 PASS_RC(ata_wait_for_start_of_transfer(10000000), 1, 1);
547 for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR); 537 for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR);
548#ifdef CHECK_ATA_SWAP
549 ATA_CFG = old;
550#endif
551 } 538 }
552 return 0; 539 return 0;
553} 540}
@@ -636,11 +623,7 @@ static int ata_power_up(void)
636 sleep(HZ / 5); 623 sleep(HZ / 5);
637 ATA_PIO_TIME = 0x191f7; 624 ATA_PIO_TIME = 0x191f7;
638 ATA_PIO_LHR = 0; 625 ATA_PIO_LHR = 0;
639#ifdef CHECK_ATA_SWAP
640 if (!ata_swap) ATA_CFG = BIT(6);
641#else
642 ATA_CFG = BIT(6); 626 ATA_CFG = BIT(6);
643#endif
644 while (!(ATA_PIO_READY & BIT(1))) yield(); 627 while (!(ATA_PIO_READY & BIT(1))) yield();
645 PASS_RC(ata_identify(ata_identify_data), 3, 3); 628 PASS_RC(ata_identify(ata_identify_data), 3, 3);
646 uint32_t piotime = 0x11f3; 629 uint32_t piotime = 0x11f3;
@@ -1196,44 +1179,17 @@ int ata_init(void)
1196 semaphore_init(&mmc_wakeup, 1, 0); 1179 semaphore_init(&mmc_wakeup, 1, 0);
1197 semaphore_init(&mmc_comp_wakeup, 1, 0); 1180 semaphore_init(&mmc_comp_wakeup, 1, 0);
1198 ceata = PDAT(11) & BIT(1); 1181 ceata = PDAT(11) & BIT(1);
1199#ifdef CHECK_ATA_SWAP
1200 ata_swap = false;
1201#endif
1202 ata_powered = false; 1182 ata_powered = false;
1203 ata_total_sectors = 0; 1183 ata_total_sectors = 0;
1204#ifdef ATA_HAVE_BBT 1184#ifdef ATA_HAVE_BBT
1205 PASS_RC(ata_bbt_reload(), 0, 0); 1185 PASS_RC(ata_bbt_reload(), 0, 0);
1206#endif
1207
1208#ifdef CHECK_ATA_SWAP
1209 /* HDD data endianness check:
1210 During the transition period Rockbox needs to detect the HDD data
1211 endianness automatically and support both. We're now using the correct
1212 endianness by default and only switching back to swapped bytes if we
1213 find a reversed MBR signature.
1214 To make this warning go away, update your emCORE version. The HDD will
1215 be reformatted with the correct endianness during the process.
1216 Once most users have switched over, this code may be removed again.
1217 -- Michael Sparmann (theseven), 2011-10-22 */
1218 if (!ceata)
1219 {
1220 unsigned char* sector = aligned_buffer;
1221 ata_rw_sectors(0, 1, sector, false);
1222 if (sector[510] == 0xaa && sector[511] == 0x55)
1223 {
1224 ata_swap = true;
1225 splashf(5000, "Wrong HDD endianness, please update your emCORE version!");
1226 }
1227 }
1228#else 1186#else
1229#ifndef ATA_HAVE_BBT
1230 /* get ata_identify_data */ 1187 /* get ata_identify_data */
1231 mutex_lock(&ata_mutex); 1188 mutex_lock(&ata_mutex);
1232 int rc = ata_power_up(); 1189 int rc = ata_power_up();
1233 mutex_unlock(&ata_mutex); 1190 mutex_unlock(&ata_mutex);
1234 if (IS_ERR(rc)) return rc; 1191 if (IS_ERR(rc)) return rc;
1235#endif 1192#endif
1236#endif
1237 1193
1238 create_thread(ata_thread, ata_stack, 1194 create_thread(ata_thread, ata_stack,
1239 sizeof(ata_stack), 0, "ATA idle monitor" 1195 sizeof(ata_stack), 0, "ATA idle monitor"
@@ -1267,10 +1223,6 @@ static int ata_smart(uint16_t* buf)
1267 else 1223 else
1268 { 1224 {
1269 int i; 1225 int i;
1270#ifdef CHECK_ATA_SWAP
1271 uint32_t old = ATA_CFG;
1272 ATA_CFG |= BIT(6); /* 16bit big-endian */
1273#endif
1274 PASS_RC(ata_wait_for_not_bsy(10000000), 3, 6); 1226 PASS_RC(ata_wait_for_not_bsy(10000000), 3, 6);
1275 ata_write_cbr(&ATA_PIO_FED, 0xd0); 1227 ata_write_cbr(&ATA_PIO_FED, 0xd0);
1276 ata_write_cbr(&ATA_PIO_LMR, 0x4f); 1228 ata_write_cbr(&ATA_PIO_LMR, 0x4f);
@@ -1279,9 +1231,6 @@ static int ata_smart(uint16_t* buf)
1279 ata_write_cbr(&ATA_PIO_CSD, 0xb0); 1231 ata_write_cbr(&ATA_PIO_CSD, 0xb0);
1280 PASS_RC(ata_wait_for_start_of_transfer(10000000), 3, 7); 1232 PASS_RC(ata_wait_for_start_of_transfer(10000000), 3, 7);
1281 for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR); 1233 for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR);
1282#ifdef CHECK_ATA_SWAP
1283 ATA_CFG = old;
1284#endif
1285 } 1234 }
1286 ata_set_active(); 1235 ata_set_active();
1287 return 0; 1236 return 0;