aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/it8213.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/it8213.c')
-rw-r--r--drivers/ide/it8213.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/ide/it8213.c b/drivers/ide/it8213.c
index 47976167796a..46816ba26416 100644
--- a/drivers/ide/it8213.c
+++ b/drivers/ide/it8213.c
@@ -17,15 +17,14 @@
17 17
18/** 18/**
19 * it8213_set_pio_mode - set host controller for PIO mode 19 * it8213_set_pio_mode - set host controller for PIO mode
20 * @hwif: port
20 * @drive: drive 21 * @drive: drive
21 * @pio: PIO mode number
22 * 22 *
23 * Set the interface PIO mode. 23 * Set the interface PIO mode.
24 */ 24 */
25 25
26static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) 26static void it8213_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
27{ 27{
28 ide_hwif_t *hwif = drive->hwif;
29 struct pci_dev *dev = to_pci_dev(hwif->dev); 28 struct pci_dev *dev = to_pci_dev(hwif->dev);
30 int is_slave = drive->dn & 1; 29 int is_slave = drive->dn & 1;
31 int master_port = 0x40; 30 int master_port = 0x40;
@@ -35,6 +34,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio)
35 u8 slave_data; 34 u8 slave_data;
36 static DEFINE_SPINLOCK(tune_lock); 35 static DEFINE_SPINLOCK(tune_lock);
37 int control = 0; 36 int control = 0;
37 const u8 pio = drive->pio_mode - XFER_PIO_0;
38 38
39 static const u8 timings[][2] = { 39 static const u8 timings[][2] = {
40 { 0, 0 }, 40 { 0, 0 },
@@ -74,15 +74,14 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio)
74 74
75/** 75/**
76 * it8213_set_dma_mode - set host controller for DMA mode 76 * it8213_set_dma_mode - set host controller for DMA mode
77 * @hwif: port
77 * @drive: drive 78 * @drive: drive
78 * @speed: DMA mode
79 * 79 *
80 * Tune the ITE chipset for the DMA mode. 80 * Tune the ITE chipset for the DMA mode.
81 */ 81 */
82 82
83static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) 83static void it8213_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
84{ 84{
85 ide_hwif_t *hwif = drive->hwif;
86 struct pci_dev *dev = to_pci_dev(hwif->dev); 85 struct pci_dev *dev = to_pci_dev(hwif->dev);
87 u8 maslave = 0x40; 86 u8 maslave = 0x40;
88 int a_speed = 3 << (drive->dn * 4); 87 int a_speed = 3 << (drive->dn * 4);
@@ -92,6 +91,7 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
92 int u_speed = 0; 91 int u_speed = 0;
93 u16 reg4042, reg4a; 92 u16 reg4042, reg4a;
94 u8 reg48, reg54, reg55; 93 u8 reg48, reg54, reg55;
94 const u8 speed = drive->dma_mode;
95 95
96 pci_read_config_word(dev, maslave, &reg4042); 96 pci_read_config_word(dev, maslave, &reg4042);
97 pci_read_config_byte(dev, 0x48, &reg48); 97 pci_read_config_byte(dev, 0x48, &reg48);
@@ -120,7 +120,6 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
120 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); 120 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
121 } else { 121 } else {
122 const u8 mwdma_to_pio[] = { 0, 3, 4 }; 122 const u8 mwdma_to_pio[] = { 0, 3, 4 };
123 u8 pio;
124 123
125 if (reg48 & u_flag) 124 if (reg48 & u_flag)
126 pci_write_config_byte(dev, 0x48, reg48 & ~u_flag); 125 pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
@@ -132,11 +131,12 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
132 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); 131 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
133 132
134 if (speed >= XFER_MW_DMA_0) 133 if (speed >= XFER_MW_DMA_0)
135 pio = mwdma_to_pio[speed - XFER_MW_DMA_0]; 134 drive->pio_mode =
135 mwdma_to_pio[speed - XFER_MW_DMA_0] + XFER_PIO_0;
136 else 136 else
137 pio = 2; /* only SWDMA2 is allowed */ 137 drive->pio_mode = XFER_PIO_2; /* for SWDMA2 */
138 138
139 it8213_set_pio_mode(drive, pio); 139 it8213_set_pio_mode(hwif, drive);
140 } 140 }
141} 141}
142 142