From 4960a3b753b6fbbfe179b1c2b69bd5b8b4bc397e Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 16 Sep 2025 10:58:13 -0400 Subject: [PATCH] ipod: Turn on SMART support for all PP502x-based iPods Unless you've modded the device with modern CF or mSATA storage, it's not likely to achieve anything. the original hard drives (supposedly) lack SMART support, and none of the SD adapters bother to emulate it. Change-Id: Id3cbe717c64947faf4b23d8c84a04b822cfb35da --- firmware/drivers/ata.c | 7 ++++--- firmware/export/config/ipod3g.h | 3 +++ firmware/export/config/ipod4g.h | 3 +++ firmware/export/config/ipodcolor.h | 3 +++ firmware/export/config/ipodmini1g.h | 3 +++ firmware/export/config/ipodmini2g.h | 3 +++ firmware/export/config/ipodvideo.h | 3 +++ 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 9440053303..9c7b8cb974 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -742,9 +742,9 @@ static int ata_smart(uint16_t *buf, uint8_t cmd) return -1; } - ATA_OUT8(&ATA_PIO_FED, cmd); - ATA_OUT8(&ATA_PIO_HCYL, 0xc2); - ATA_OUT8(&ATA_PIO_LCYL, 0x4f); + ATA_OUT8(ATA_FEATURE, cmd); + ATA_OUT8(ATA_HCYL, 0xc2); + ATA_OUT8(ATA_LCYL, 0x4f); ATA_OUT8(ATA_SELECT, SELECT_LBA | ata_device); ATA_OUT8(ATA_COMMAND, CMD_SMART); @@ -759,6 +759,7 @@ static int ata_smart(uint16_t *buf, uint8_t cmd) this info differently that normal sector data */ buf[i] = ATA_SWAP_IDENTIFY(ATA_IN16(ATA_DATA)); } + return 0; } int ata_read_smart(struct ata_smart_values* smart_data, uint8_t cmd) { diff --git a/firmware/export/config/ipod3g.h b/firmware/export/config/ipod3g.h index b5037d87a7..adf8f2d508 100644 --- a/firmware/export/config/ipod3g.h +++ b/firmware/export/config/ipod3g.h @@ -153,6 +153,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* Define this if you want to use the PP5002 i2c interface */ #define CONFIG_I2C I2C_PP5002 diff --git a/firmware/export/config/ipod4g.h b/firmware/export/config/ipod4g.h index 6082213dd8..05271f836c 100644 --- a/firmware/export/config/ipod4g.h +++ b/firmware/export/config/ipod4g.h @@ -175,6 +175,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config/ipodcolor.h b/firmware/export/config/ipodcolor.h index 071084ac8c..fe6c7c129d 100644 --- a/firmware/export/config/ipodcolor.h +++ b/firmware/export/config/ipodcolor.h @@ -162,6 +162,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config/ipodmini1g.h b/firmware/export/config/ipodmini1g.h index 358589b413..26cb0e8da2 100644 --- a/firmware/export/config/ipodmini1g.h +++ b/firmware/export/config/ipodmini1g.h @@ -171,6 +171,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config/ipodmini2g.h b/firmware/export/config/ipodmini2g.h index 382612a7ca..73928f9c0c 100644 --- a/firmware/export/config/ipodmini2g.h +++ b/firmware/export/config/ipodmini2g.h @@ -172,6 +172,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* define this if the hardware can be powered off while charging */ /*#define HAVE_POWEROFF_WHILE_CHARGING */ diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h index 8ae9959397..56238db755 100644 --- a/firmware/export/config/ipodvideo.h +++ b/firmware/export/config/ipodvideo.h @@ -182,6 +182,9 @@ /* We're able to shut off power to the HDD */ #define HAVE_ATA_POWER_OFF +/* Turn on SMART support */ +#define HAVE_ATA_SMART + /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING