aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt3x2n.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-11-27 13:29:02 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-12-03 14:36:16 -0500
commit5600c70e576199a7552e1c0fff43f3fe16f5566e (patch)
tree811a21c65c52b1b166cc518b5200fab1d9991d73 /drivers/ata/pata_hpt3x2n.c
parent8e182a90f91456335756d2ce304ad470795d98e1 (diff)
pata_hpt{37x|3x2n}: fix timing register masks (take 2)
These drivers inherited from the older 'hpt366' IDE driver the buggy timing register masks in their set_piomode() metods. As a result, too low command cycle active time is programmed for slow PIO modes. Quite fortunately, it's later "fixed up" by the set_dmamode() methods which also "helpfully" reprogram the command timings, usually to PIO mode 4; unfortunately, setting an UltraDMA mode #N also reprograms already set PIO data timings, usually to MWDMA mode # max(N, 2) timings... However, the drivers added some breakage of their own too: the bit that they set/clear to control the FIFO is sometimes wrong -- it's actually the MSB of the command cycle setup time; also, setting it in DMA mode is wrong as this bit is only for PIO actually and clearing it for PIO modes is not needed as no mode in any timing table has it set... Fix all this, inverting the masks while at it, like in the 'hpt366' and 'pata_hpt366' drivers; bump the drivers' versions, accounting for recent patches that forgot to do it... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: stable@kernel.org Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_hpt3x2n.c')
-rw-r--r--drivers/ata/pata_hpt3x2n.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 8d63eba782ff..26f50af0ad89 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.4" 28#define DRV_VERSION "0.3.7"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -188,9 +188,8 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
188 188
189 pci_read_config_dword(pdev, addr1, &reg); 189 pci_read_config_dword(pdev, addr1, &reg);
190 mode = hpt3x2n_find_mode(ap, adev->pio_mode); 190 mode = hpt3x2n_find_mode(ap, adev->pio_mode);
191 mode &= ~0x8000000; /* No FIFO in PIO */ 191 mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
192 mode &= ~0x30070000; /* Leave config bits alone */ 192 reg &= ~0xCFC3FFFF; /* Strip timing bits */
193 reg &= 0x30070000; /* Strip timing bits */
194 pci_write_config_dword(pdev, addr1, reg | mode); 193 pci_write_config_dword(pdev, addr1, reg | mode);
195} 194}
196 195
@@ -207,8 +206,7 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
207{ 206{
208 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 207 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
209 u32 addr1, addr2; 208 u32 addr1, addr2;
210 u32 reg; 209 u32 reg, mode, mask;
211 u32 mode;
212 u8 fast; 210 u8 fast;
213 211
214 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 212 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
@@ -219,11 +217,12 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
219 fast &= ~0x07; 217 fast &= ~0x07;
220 pci_write_config_byte(pdev, addr2, fast); 218 pci_write_config_byte(pdev, addr2, fast);
221 219
220 mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
221
222 pci_read_config_dword(pdev, addr1, &reg); 222 pci_read_config_dword(pdev, addr1, &reg);
223 mode = hpt3x2n_find_mode(ap, adev->dma_mode); 223 mode = hpt3x2n_find_mode(ap, adev->dma_mode);
224 mode |= 0x8000000; /* FIFO in MWDMA or UDMA */ 224 mode &= mask;
225 mode &= ~0xC0000000; /* Leave config bits alone */ 225 reg &= ~mask;
226 reg &= 0xC0000000; /* Strip timing bits */
227 pci_write_config_dword(pdev, addr1, reg | mode); 226 pci_write_config_dword(pdev, addr1, reg | mode);
228} 227}
229 228