1
0
Fork 0
forked from len0rd/rockbox

ipod6g: Wrap more DMA functionality with HAVE_ATA_DMA

No functional change.

We always have it turned in for ipod6g, but this makes some of the
flow/logic easier to follow.

Change-Id: I3abeace4f70afb197e819e0944e0e76f4edc4800
This commit is contained in:
Solomon Peachy 2024-11-12 07:58:00 -05:00
parent cb7b6fd572
commit 3d1dcebebb

View file

@ -71,7 +71,6 @@ static uint64_t ata_total_sectors;
static uint32_t log_sector_size; static uint32_t log_sector_size;
static struct mutex ata_mutex; static struct mutex ata_mutex;
static struct semaphore ata_wakeup; static struct semaphore ata_wakeup;
static uint32_t ata_dma_flags;
static long ata_last_activity_value = -1; static long ata_last_activity_value = -1;
static long ata_sleep_timeout = 7 * HZ; static long ata_sleep_timeout = 7 * HZ;
static bool ata_powered; static bool ata_powered;
@ -79,7 +78,10 @@ static bool canflush = true;
static struct semaphore mmc_wakeup; static struct semaphore mmc_wakeup;
static struct semaphore mmc_comp_wakeup; static struct semaphore mmc_comp_wakeup;
static int spinup_time = 0; static int spinup_time = 0;
#ifdef HAVE_ATA_DMA
static int dma_mode = 0; static int dma_mode = 0;
static uint32_t ata_dma_flags;
#endif
static const int ata_retries = ATA_RETRIES; static const int ata_retries = ATA_RETRIES;
static const bool ata_error_srst = true; static const bool ata_error_srst = true;
@ -656,7 +658,9 @@ static int ata_power_up(void)
if (ceata) { if (ceata) {
ata_lba48 = true; ata_lba48 = true;
ata_dma = true; ata_dma = true;
#ifdef HAVE_ATA_DMA
dma_mode = 0xff; /* Canary */ dma_mode = 0xff; /* Canary */
#endif
PCON(8) = 0x33333333; PCON(8) = 0x33333333;
PCON(9) = 0x00000033; PCON(9) = 0x00000033;
PCON(11) |= 0xf; PCON(11) |= 0xf;
@ -711,8 +715,8 @@ static int ata_power_up(void)
ATA_PIO_TIME = piotime; ATA_PIO_TIME = piotime;
uint32_t param = 0; uint32_t param = 0;
ata_dma_flags = 0;
#ifdef HAVE_ATA_DMA #ifdef HAVE_ATA_DMA
ata_dma_flags = 0;
if ((identify_info[53] & BIT(2)) && (identify_info[88] & BITRANGE(0, 4))) /* Any UDMA */ if ((identify_info[53] & BIT(2)) && (identify_info[88] & BITRANGE(0, 4))) /* Any UDMA */
{ {
int max_udma = ATA_MAX_UDMA; int max_udma = ATA_MAX_UDMA;
@ -730,9 +734,9 @@ static int ata_power_up(void)
ATA_MDMA_TIME = mwdmatimes[param & 0xf]; ATA_MDMA_TIME = mwdmatimes[param & 0xf];
ata_dma_flags = BIT(3) | BIT(10); ata_dma_flags = BIT(3) | BIT(10);
} }
dma_mode = param;
#endif /* HAVE_ATA_DMA */ #endif /* HAVE_ATA_DMA */
ata_dma = param ? true : false; ata_dma = param ? true : false;
dma_mode = param;
PASS_RC(ata_set_feature(0x03, param), 3, 4); /* Transfer mode */ PASS_RC(ata_set_feature(0x03, param), 3, 4); /* Transfer mode */
/* SET_FEATURE only supported on PATA, not CE-ATA */ /* SET_FEATURE only supported on PATA, not CE-ATA */
@ -1145,7 +1149,7 @@ int ata_init(void)
/* get identify_info */ /* get identify_info */
mutex_lock(&ata_mutex); mutex_lock(&ata_mutex);
int rc = ata_power_up(); /* Include identify() call */ int rc = ata_power_up(); /* Includes identify() call */
mutex_unlock(&ata_mutex); mutex_unlock(&ata_mutex);
if (IS_ERR(rc)) if (IS_ERR(rc))
return rc; return rc;