Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pata_atiixp: fix second channel support

PIO and MWDMA timings are never programmed for the second channel
because timing registers are treated as 16-bit long ones.

The bug is an attixp -> pata_atiixp regression and goes back to:

commit 669a5db411d85a14f86cd92bc16bf7ab5b8aa235
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Aug 29 18:12:40 2006 -0400

[libata] Add a bunch of PATA drivers.

Cc: Krystian Juskowiak <jusko@tlen.pl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Robert Hancock <hancockrwd@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Bartlomiej Zolnierkiewicz and committed by
Jeff Garzik
1fd4bbec df9eba8c

+10 -9
+10 -9
drivers/ata/pata_atiixp.c
··· 1 1 /* 2 2 * pata_atiixp.c - ATI PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 + * (C) 2009 Bartlomiej Zolnierkiewicz 4 5 * 5 6 * Based on 6 7 * ··· 62 61 63 62 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 64 63 int dn = 2 * ap->port_no + adev->devno; 65 - 66 - /* Check this is correct - the order is odd in both drivers */ 67 64 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 68 - u16 pio_mode_data, pio_timing_data; 65 + u32 pio_timing_data; 66 + u16 pio_mode_data; 69 67 70 68 pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); 71 69 pio_mode_data &= ~(0x7 << (4 * dn)); 72 70 pio_mode_data |= pio << (4 * dn); 73 71 pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); 74 72 75 - pci_read_config_word(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); 73 + pci_read_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); 76 74 pio_timing_data &= ~(0xFF << timing_shift); 77 75 pio_timing_data |= (pio_timings[pio] << timing_shift); 78 - pci_write_config_word(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); 76 + pci_write_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); 79 77 } 80 78 81 79 /** ··· 119 119 udma_mode_data |= dma << (4 * dn); 120 120 pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); 121 121 } else { 122 - u16 mwdma_timing_data; 123 - /* Check this is correct - the order is odd in both drivers */ 124 122 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 123 + u32 mwdma_timing_data; 125 124 126 125 dma -= XFER_MW_DMA_0; 127 126 128 - pci_read_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, &mwdma_timing_data); 127 + pci_read_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, 128 + &mwdma_timing_data); 129 129 mwdma_timing_data &= ~(0xFF << timing_shift); 130 130 mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); 131 - pci_write_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, mwdma_timing_data); 131 + pci_write_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, 132 + mwdma_timing_data); 132 133 } 133 134 /* 134 135 * We must now look at the PIO mode situation. We may need to