pata_atiixp: fix slave device support
PATCH 1/1 pata_atiixp: fix slave device support
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] pata_atiixp: fix slave device support
PIO and MWDMA timings are never programmed for the slave device 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 <[email protected]> Date: Tue Aug 29 18:12:40 2006 -0400 [libata] Add a bunch of PATA drivers.
The patch should fix:
http://bugzilla.kernel.org/show_bug.cgi?id=13921
---
After this patch pata_atiixp still has two bugs (+ few superfluous oddities) not present in atiixp (although not as severe as this one)..
drivers/ata/pata_atiixp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/ata/pata_atiixp.c +10 -9
@@ -1,6 +1,7 @@/* * pata_atiixp.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc +* (C) 2009 Bartlomiej Zolnierkiewicz * * Based on *
@@ -61,20 +62,19 @@ static void atiixp_set_pio_timing(structstruct pci_dev *pdev =to_pci_dev (ap->host->dev);int dn =2 * ap->port_no + adev->devno; - -/* Check this is correct - the order is odd in both drivers */ int timing_shift = (16 * ap->port_no) +8 * (adev->devno ^1 ); -u16 pio_mode_data, pio_timing_data; +u32 pio_timing_data; +u16 pio_mode_data;pci_read_config_word (pdev,ATIIXP_IDE_PIO_MODE , &pio_mode_data); pio_mode_data &= ~(0x7 << (4 * dn)); pio_mode_data |= pio << (4 * dn);pci_write_config_word (pdev,ATIIXP_IDE_PIO_MODE , pio_mode_data); -pci_read_config_word (pdev,ATIIXP_IDE_PIO_TIMING , &pio_timing_data); +pci_read_config_dword (pdev,ATIIXP_IDE_PIO_TIMING , &pio_timing_data); pio_timing_data &= ~(0xFF << timing_shift); pio_timing_data |= (pio_timings[pio] << timing_shift); -pci_write_config_word (pdev,ATIIXP_IDE_PIO_TIMING , pio_timing_data); +pci_write_config_dword (pdev,ATIIXP_IDE_PIO_TIMING , pio_timing_data); }/**
@@ -119,16 +119,17 @@ static void atiixp_set_dmamode(struct at udma_mode_data |= dma << (4 * dn);pci_write_config_word (pdev,ATIIXP_IDE_UDMA_MODE , udma_mode_data); }else { -u16 mwdma_timing_data; -/* Check this is correct - the order is odd in both drivers */ int timing_shift = (16 * ap->port_no) +8 * (adev->devno ^1 ); +u32 mwdma_timing_data; dma -=XFER_MW_DMA_0 ; -pci_read_config_word (pdev,ATIIXP_IDE_MWDMA_TIMING , &mwdma_timing_data); +pci_read_config_dword (pdev,ATIIXP_IDE_MWDMA_TIMING , + &mwdma_timing_data); mwdma_timing_data &= ~(0xFF << timing_shift); mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); -pci_write_config_word (pdev,ATIIXP_IDE_MWDMA_TIMING , mwdma_timing_data); +pci_write_config_dword (pdev,ATIIXP_IDE_MWDMA_TIMING , + mwdma_timing_data); }/* * We must now look at the PIO mode situation. We may need to
Quoted 2 lines · On Thursday 06 August 2009 17:40:15 Bartlomiej Zolnierkiewicz wrote:
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH]pata_atiixp: fix slave device support
Argh, I pushed the "Send" button too quick..
Below version with the correct patch description (I doubt that this fix will help with bug #13921)..
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH v2] 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 <[email protected]> Date: Tue Aug 29 18:12:40 2006 -0400 [libata] Add a bunch of PATA drivers.
---
After this patch pata_atiixp still have two bugs (+ few superfluous oddities) not present in atiixp (although not as severe as this one)..
drivers/ata/pata_atiixp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/ata/pata_atiixp.c +10 -9
@@ -1,6 +1,7 @@/* * pata_atiixp.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc +* (C) 2009 Bartlomiej Zolnierkiewicz * * Based on *
@@ -61,20 +62,19 @@ static void atiixp_set_pio_timing(structstruct pci_dev *pdev =to_pci_dev (ap->host->dev);int dn =2 * ap->port_no + adev->devno; - -/* Check this is correct - the order is odd in both drivers */ int timing_shift = (16 * ap->port_no) +8 * (adev->devno ^1 ); -u16 pio_mode_data, pio_timing_data; +u32 pio_timing_data; +u16 pio_mode_data;pci_read_config_word (pdev,ATIIXP_IDE_PIO_MODE , &pio_mode_data); pio_mode_data &= ~(0x7 << (4 * dn)); pio_mode_data |= pio << (4 * dn);pci_write_config_word (pdev,ATIIXP_IDE_PIO_MODE , pio_mode_data); -pci_read_config_word (pdev,ATIIXP_IDE_PIO_TIMING , &pio_timing_data); +pci_read_config_dword (pdev,ATIIXP_IDE_PIO_TIMING , &pio_timing_data); pio_timing_data &= ~(0xFF << timing_shift); pio_timing_data |= (pio_timings[pio] << timing_shift); -pci_write_config_word (pdev,ATIIXP_IDE_PIO_TIMING , pio_timing_data); +pci_write_config_dword (pdev,ATIIXP_IDE_PIO_TIMING , pio_timing_data); }/**
@@ -119,16 +119,17 @@ static void atiixp_set_dmamode(struct at udma_mode_data |= dma << (4 * dn);pci_write_config_word (pdev,ATIIXP_IDE_UDMA_MODE , udma_mode_data); }else { -u16 mwdma_timing_data; -/* Check this is correct - the order is odd in both drivers */ int timing_shift = (16 * ap->port_no) +8 * (adev->devno ^1 ); +u32 mwdma_timing_data; dma -=XFER_MW_DMA_0 ; -pci_read_config_word (pdev,ATIIXP_IDE_MWDMA_TIMING , &mwdma_timing_data); +pci_read_config_dword (pdev,ATIIXP_IDE_MWDMA_TIMING , + &mwdma_timing_data); mwdma_timing_data &= ~(0xFF << timing_shift); mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); -pci_write_config_word (pdev,ATIIXP_IDE_MWDMA_TIMING , mwdma_timing_data); +pci_write_config_dword (pdev,ATIIXP_IDE_MWDMA_TIMING , + mwdma_timing_data); }/* * We must now look at the PIO mode situation. We may need to
Jeff Garzik
AppliedQuoted 28 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines · On Thursday 06 August 2009 17:40:15 Bartlomiej Zolnierkiewicz wrote:
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH]pata_atiixp: fix slave device supportArgh, I pushed the "Send" button too quick..
Below version with the correct patch description (I doubt that this fix will help with bug #13921)..
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH v2]pata_atiixp: fix second channel supportPIO 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_atiixpregression and goes back to:commit 669a5db411d85a14f86cd92bc16bf7ab5b8aa235 Author: Jeff Garzik <[email protected]> Date: Tue Aug 29 18:12:40 2006 -0400 [libata] Add a bunch of PATA drivers.Cc Krystian Juskowiak <[email protected]>Cc Andrew Morton <[email protected]>Cc Borislav Petkov <[email protected]>Cc Robert Hancock <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 6 lines
---
After this patchpata_atiixpstill have two bugs (+ few superfluous oddities) not present in atiixp (although not as severe as this one)..drivers/ata/pata_atiixp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
applied