aboutsummaryrefslogtreecommitdiff
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-06-08 15:14:29 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-06-08 15:14:29 +0200
commit0380dad45e4f5a606025cc4df2a2cd26af08796b (patch)
treec135a4a5527ce98bb3473342061f3990feef7d42 /drivers/ide/pci
parent1abb8a8b841354e7a09ba2009376f0a6368b5cec (diff)
it821x: RAID mode fixes
The DMA support for RAID mode broke after: commit 71ef51cc1756d1c56b57c70e7cc27a3559c81ee6 Author: Jens Axboe <axboe@suse.de> Date:   Fri Jul 28 09:02:17 2006 +0200     [PATCH] it821x: fix ide dma setup bug     Only enable dma for a valid speed setting.     Signed-off-by: Jens Axboe <axboe@suse.de> commit 0a8348d08677ad77ee353f96eb8745c693a05a13 Author: Jens Axboe <axboe@suse.de> Date:   Fri Jul 28 08:58:26 2006 +0200     [PATCH] ide: if the id fields looks screwy, disable DMA     It's the safer choice. Originally due to a bug in itx821x, but a     generally sound thing to do.     Signed-off-by: Jens Axboe <axboe@suse.de> However it worked by pure luck before Jens' fixes: bogus ide_dma_enable() usage in it821x driver combined with loosy check in ide_dma_verbose() allowed the hardware to operate in DMA mode. When these problems were fixed the DMA support broke... The source root for the regression turned out to be that the it821x.c code was clearing too much of id->field_valid. The IDE core code was using the original value of id->field_valid to do the tuning but later DMA got disabled in ide_dma_verbose() because of the incorrect id->field_valid fixup. Fix it. While at it: * Do fixup() after probing the drives but before tuning them (which is also OK w.r.t. ide_undecoded_slave() fixup). This change fixes device IDENTIFY data to be consistent before/after the tuning and allows us to remove extra re-tuning of drives from it821x_fixups(). * Fake MWDMA0 enabled/supported bits in IDENTIFY data if the device has DMA capable bit set (this is just to tell the IDE core that DMA is supported since it821x firmware takes care of DMA mode programming). * Don't touch timing registers and don't program transfer modes on devices et all when in RAID mode - depend solely on firmware to do the tuning (as suggested by Alan Cox and done in libata pata_it821x driver). Thanks for testing the patch goes out to Thomas Kuther. Cc: Thomas Kuther <gimpel@sonnenkinder.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/it821x.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 5faaff87d58..4bd4bf02e91 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -1,6 +1,6 @@
/*
- * linux/drivers/ide/pci/it821x.c Version 0.10 Mar 10 2007
+ * linux/drivers/ide/pci/it821x.c Version 0.15 Jun 2 2007
*
* Copyright (C) 2004 Red Hat <alan@redhat.com>
* Copyright (C) 2007 Bartlomiej Zolnierkiewicz
@@ -262,7 +262,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
}
if (itdev->smart)
- goto set_drive_speed;
+ return 0;
/* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
itdev->want[unit][1] = pio_want[set_pio];
@@ -271,7 +271,6 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
it821x_clock_strategy(drive);
it821x_program(drive, itdev->pio[unit]);
-set_drive_speed:
return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
}
@@ -455,12 +454,12 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
default:
return 1;
}
+
+ return ide_config_drive_speed(drive, speed);
}
- /*
- * In smart mode the clocking is done by the host controller
- * snooping the mode we picked. The rest of it is not our problem
- */
- return ide_config_drive_speed(drive, speed);
+
+ /* don't touch anything in the smart mode */
+ return 0;
}
/**
@@ -559,17 +558,10 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
if(idbits[129] != 1)
printk("(%dK stripe)", idbits[146]);
printk(".\n");
- /* Now the core code will have wrongly decided no DMA
- so we need to fix this */
- hwif->dma_off_quietly(drive);
-#ifdef CONFIG_IDEDMA_ONLYDISK
- if (drive->media == ide_disk)
-#endif
- ide_set_dma(drive);
} else {
/* Non RAID volume. Fixups to stop the core code
doing unsupported things */
- id->field_valid &= 1;
+ id->field_valid &= 3;
id->queue_depth = 0;
id->command_set_1 = 0;
id->command_set_2 &= 0xC400;
@@ -584,6 +576,16 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
printk(KERN_INFO "%s: Performing identify fixups.\n",
drive->name);
}
+
+ /*
+ * Set MWDMA0 mode as enabled/support - just to tell
+ * IDE core that DMA is supported (it821x hardware
+ * takes care of DMA mode programming).
+ */
+ if (id->capability & 1) {
+ id->dma_mword |= 0x0101;
+ drive->current_speed = XFER_MW_DMA_0;
+ }
}
}