diff options
Diffstat (limited to 'drivers')
35 files changed, 100 insertions, 86 deletions
diff --git a/drivers/ide/aec62xx.c b/drivers/ide/aec62xx.c index 3790847361c3..57d00caefc86 100644 --- a/drivers/ide/aec62xx.c +++ b/drivers/ide/aec62xx.c | |||
@@ -81,15 +81,15 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr | |||
81 | return chipset_table->ultra_settings; | 81 | return chipset_table->ultra_settings; |
82 | } | 82 | } |
83 | 83 | ||
84 | static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | 84 | static void aec6210_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
85 | { | 85 | { |
86 | ide_hwif_t *hwif = drive->hwif; | ||
87 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 86 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
88 | struct ide_host *host = pci_get_drvdata(dev); | 87 | struct ide_host *host = pci_get_drvdata(dev); |
89 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; | 88 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; |
90 | u16 d_conf = 0; | 89 | u16 d_conf = 0; |
91 | u8 ultra = 0, ultra_conf = 0; | 90 | u8 ultra = 0, ultra_conf = 0; |
92 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 91 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
92 | const u8 speed = drive->dma_mode; | ||
93 | unsigned long flags; | 93 | unsigned long flags; |
94 | 94 | ||
95 | local_irq_save(flags); | 95 | local_irq_save(flags); |
@@ -109,15 +109,15 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
109 | local_irq_restore(flags); | 109 | local_irq_restore(flags); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | 112 | static void aec6260_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
113 | { | 113 | { |
114 | ide_hwif_t *hwif = drive->hwif; | ||
115 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 114 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
116 | struct ide_host *host = pci_get_drvdata(dev); | 115 | struct ide_host *host = pci_get_drvdata(dev); |
117 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; | 116 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; |
118 | u8 unit = drive->dn & 1; | 117 | u8 unit = drive->dn & 1; |
119 | u8 tmp1 = 0, tmp2 = 0; | 118 | u8 tmp1 = 0, tmp2 = 0; |
120 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 119 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
120 | const u8 speed = drive->dma_mode; | ||
121 | unsigned long flags; | 121 | unsigned long flags; |
122 | 122 | ||
123 | local_irq_save(flags); | 123 | local_irq_save(flags); |
@@ -137,7 +137,7 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | |||
137 | static void aec_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 137 | static void aec_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
138 | { | 138 | { |
139 | drive->dma_mode = drive->pio_mode; | 139 | drive->dma_mode = drive->pio_mode; |
140 | hwif->port_ops->set_dma_mode(drive, drive->dma_mode); | 140 | hwif->port_ops->set_dma_mode(hwif, drive); |
141 | } | 141 | } |
142 | 142 | ||
143 | static int init_chipset_aec62xx(struct pci_dev *dev) | 143 | static int init_chipset_aec62xx(struct pci_dev *dev) |
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index 28cee1055f76..6f0debae4e27 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c | |||
@@ -121,16 +121,16 @@ static u8 ali_udma_filter(ide_drive_t *drive) | |||
121 | 121 | ||
122 | /** | 122 | /** |
123 | * ali_set_dma_mode - set host controller for DMA mode | 123 | * ali_set_dma_mode - set host controller for DMA mode |
124 | * @hwif: port | ||
124 | * @drive: drive | 125 | * @drive: drive |
125 | * @speed: DMA mode | ||
126 | * | 126 | * |
127 | * Configure the hardware for the desired IDE transfer mode. | 127 | * Configure the hardware for the desired IDE transfer mode. |
128 | */ | 128 | */ |
129 | 129 | ||
130 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) | 130 | static void ali_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
131 | { | 131 | { |
132 | ide_hwif_t *hwif = drive->hwif; | ||
133 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 132 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
133 | const u8 speed = drive->dma_mode; | ||
134 | u8 speed1 = speed; | 134 | u8 speed1 = speed; |
135 | u8 unit = drive->dn & 1; | 135 | u8 unit = drive->dn & 1; |
136 | u8 tmpbyte = 0x00; | 136 | u8 tmpbyte = 0x00; |
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c index 3eee7be7ca6f..b7e105338205 100644 --- a/drivers/ide/amd74xx.c +++ b/drivers/ide/amd74xx.c | |||
@@ -79,14 +79,14 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask, | |||
79 | * to a desired transfer mode. It also can be called by upper layers. | 79 | * to a desired transfer mode. It also can be called by upper layers. |
80 | */ | 80 | */ |
81 | 81 | ||
82 | static void amd_set_drive(ide_drive_t *drive, const u8 speed) | 82 | static void amd_set_drive(ide_hwif_t *hwif, ide_drive_t *drive) |
83 | { | 83 | { |
84 | ide_hwif_t *hwif = drive->hwif; | ||
85 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 84 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
86 | ide_drive_t *peer = ide_get_pair_dev(drive); | 85 | ide_drive_t *peer = ide_get_pair_dev(drive); |
87 | struct ide_timing t, p; | 86 | struct ide_timing t, p; |
88 | int T, UT; | 87 | int T, UT; |
89 | u8 udma_mask = hwif->ultra_mask; | 88 | u8 udma_mask = hwif->ultra_mask; |
89 | const u8 speed = drive->dma_mode; | ||
90 | 90 | ||
91 | T = 1000000000 / amd_clock; | 91 | T = 1000000000 / amd_clock; |
92 | UT = (udma_mask == ATA_UDMA2) ? T : (T / 2); | 92 | UT = (udma_mask == ATA_UDMA2) ? T : (T / 2); |
@@ -110,7 +110,8 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed) | |||
110 | 110 | ||
111 | static void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 111 | static void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
112 | { | 112 | { |
113 | amd_set_drive(drive, drive->pio_mode); | 113 | drive->dma_mode = drive->pio_mode; |
114 | amd_set_drive(hwif, drive); | ||
114 | } | 115 | } |
115 | 116 | ||
116 | static void amd7409_cable_detect(struct pci_dev *dev) | 117 | static void amd7409_cable_detect(struct pci_dev *dev) |
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c index b6848dfb93b0..15f0ead89f5c 100644 --- a/drivers/ide/atiixp.c +++ b/drivers/ide/atiixp.c | |||
@@ -75,21 +75,22 @@ static void atiixp_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
75 | 75 | ||
76 | /** | 76 | /** |
77 | * atiixp_set_dma_mode - set host controller for DMA mode | 77 | * atiixp_set_dma_mode - set host controller for DMA mode |
78 | * @hwif: port | ||
78 | * @drive: drive | 79 | * @drive: drive |
79 | * @speed: DMA mode | ||
80 | * | 80 | * |
81 | * Set a ATIIXP host controller to the desired DMA mode. This involves | 81 | * Set a ATIIXP host controller to the desired DMA mode. This involves |
82 | * programming the right timing data into the PCI configuration space. | 82 | * programming the right timing data into the PCI configuration space. |
83 | */ | 83 | */ |
84 | 84 | ||
85 | static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | 85 | static void atiixp_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
86 | { | 86 | { |
87 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | 87 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
88 | unsigned long flags; | 88 | unsigned long flags; |
89 | int timing_shift = (drive->dn ^ 1) * 8; | 89 | int timing_shift = (drive->dn ^ 1) * 8; |
90 | u32 tmp32; | 90 | u32 tmp32; |
91 | u16 tmp16; | 91 | u16 tmp16; |
92 | u16 udma_ctl = 0; | 92 | u16 udma_ctl = 0; |
93 | const u8 speed = drive->dma_mode; | ||
93 | 94 | ||
94 | spin_lock_irqsave(&atiixp_lock, flags); | 95 | spin_lock_irqsave(&atiixp_lock, flags); |
95 | 96 | ||
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index c90e9b0a9f6e..e2fd378ba9de 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
@@ -160,11 +160,11 @@ static void au1xxx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
160 | au_writel(mem_stcfg,MEM_STCFG2); | 160 | au_writel(mem_stcfg,MEM_STCFG2); |
161 | } | 161 | } |
162 | 162 | ||
163 | static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) | 163 | static void auide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
164 | { | 164 | { |
165 | int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2); | 165 | int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2); |
166 | 166 | ||
167 | switch(speed) { | 167 | switch (drive->dma_mode) { |
168 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 168 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
169 | case XFER_MW_DMA_2: | 169 | case XFER_MW_DMA_2: |
170 | mem_sttime = SBC_IDE_TIMING(MDMA2); | 170 | mem_sttime = SBC_IDE_TIMING(MDMA2); |
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index 0b11745937e7..a65a69171250 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c | |||
@@ -141,12 +141,12 @@ static void cmd64x_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
141 | cmd64x_program_timings(drive, XFER_PIO_0 + pio); | 141 | cmd64x_program_timings(drive, XFER_PIO_0 + pio); |
142 | } | 142 | } |
143 | 143 | ||
144 | static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) | 144 | static void cmd64x_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
145 | { | 145 | { |
146 | ide_hwif_t *hwif = drive->hwif; | ||
147 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 146 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
148 | u8 unit = drive->dn & 0x01; | 147 | u8 unit = drive->dn & 0x01; |
149 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; | 148 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; |
149 | const u8 speed = drive->dma_mode; | ||
150 | 150 | ||
151 | pci_read_config_byte(dev, pciU, ®U); | 151 | pci_read_config_byte(dev, pciU, ®U); |
152 | regU &= ~(unit ? 0xCA : 0x35); | 152 | regU &= ~(unit ? 0xCA : 0x35); |
diff --git a/drivers/ide/cs5520.c b/drivers/ide/cs5520.c index b8094f049f3e..2c1e5f7cd261 100644 --- a/drivers/ide/cs5520.c +++ b/drivers/ide/cs5520.c | |||
@@ -81,12 +81,12 @@ static void cs5520_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
81 | (cs5520_pio_clocks[pio].assert)); | 81 | (cs5520_pio_clocks[pio].assert)); |
82 | } | 82 | } |
83 | 83 | ||
84 | static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) | 84 | static void cs5520_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
85 | { | 85 | { |
86 | printk(KERN_ERR "cs55x0: bad ide timing.\n"); | 86 | printk(KERN_ERR "cs55x0: bad ide timing.\n"); |
87 | 87 | ||
88 | drive->pio_mode = XFER_PIO_0 + 0; | 88 | drive->pio_mode = XFER_PIO_0 + 0; |
89 | cs5520_set_pio_mode(drive->hwif, drive); | 89 | cs5520_set_pio_mode(hwif, drive); |
90 | } | 90 | } |
91 | 91 | ||
92 | static const struct ide_port_ops cs5520_port_ops = { | 92 | static const struct ide_port_ops cs5520_port_ops = { |
diff --git a/drivers/ide/cs5530.c b/drivers/ide/cs5530.c index 4ced40255ad6..4dc4eb92b076 100644 --- a/drivers/ide/cs5530.c +++ b/drivers/ide/cs5530.c | |||
@@ -100,12 +100,12 @@ out: | |||
100 | return mask; | 100 | return mask; |
101 | } | 101 | } |
102 | 102 | ||
103 | static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) | 103 | static void cs5530_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
104 | { | 104 | { |
105 | unsigned long basereg; | 105 | unsigned long basereg; |
106 | unsigned int reg, timings = 0; | 106 | unsigned int reg, timings = 0; |
107 | 107 | ||
108 | switch (mode) { | 108 | switch (drive->dma_mode) { |
109 | case XFER_UDMA_0: timings = 0x00921250; break; | 109 | case XFER_UDMA_0: timings = 0x00921250; break; |
110 | case XFER_UDMA_1: timings = 0x00911140; break; | 110 | case XFER_UDMA_1: timings = 0x00911140; break; |
111 | case XFER_UDMA_2: timings = 0x00911030; break; | 111 | case XFER_UDMA_2: timings = 0x00911030; break; |
@@ -113,7 +113,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
113 | case XFER_MW_DMA_1: timings = 0x00012121; break; | 113 | case XFER_MW_DMA_1: timings = 0x00012121; break; |
114 | case XFER_MW_DMA_2: timings = 0x00002020; break; | 114 | case XFER_MW_DMA_2: timings = 0x00002020; break; |
115 | } | 115 | } |
116 | basereg = CS5530_BASEREG(drive->hwif); | 116 | basereg = CS5530_BASEREG(hwif); |
117 | reg = inl(basereg + 4); /* get drive0 config register */ | 117 | reg = inl(basereg + 4); /* get drive0 config register */ |
118 | timings |= reg & 0x80000000; /* preserve PIO format bit */ | 118 | timings |= reg & 0x80000000; /* preserve PIO format bit */ |
119 | if ((drive-> dn & 1) == 0) { /* are we configuring drive0? */ | 119 | if ((drive-> dn & 1) == 0) { /* are we configuring drive0? */ |
diff --git a/drivers/ide/cs5535.c b/drivers/ide/cs5535.c index 7974415ea89f..740002b2f3e8 100644 --- a/drivers/ide/cs5535.c +++ b/drivers/ide/cs5535.c | |||
@@ -129,15 +129,15 @@ static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) | |||
129 | 129 | ||
130 | /** | 130 | /** |
131 | * cs5535_set_dma_mode - set host controller for DMA mode | 131 | * cs5535_set_dma_mode - set host controller for DMA mode |
132 | * @hwif: port | ||
132 | * @drive: drive | 133 | * @drive: drive |
133 | * @speed: DMA mode | ||
134 | * | 134 | * |
135 | * Programs the chipset for DMA mode. | 135 | * Programs the chipset for DMA mode. |
136 | */ | 136 | */ |
137 | 137 | ||
138 | static void cs5535_set_dma_mode(ide_drive_t *drive, const u8 speed) | 138 | static void cs5535_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
139 | { | 139 | { |
140 | cs5535_set_speed(drive, speed); | 140 | cs5535_set_speed(drive, drive->dma_mode); |
141 | } | 141 | } |
142 | 142 | ||
143 | /** | 143 | /** |
diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c index b518ef0e9a35..70871fbc3c0a 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c | |||
@@ -173,11 +173,11 @@ static void cs5536_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
173 | 173 | ||
174 | /** | 174 | /** |
175 | * cs5536_set_dma_mode - DMA timing setup | 175 | * cs5536_set_dma_mode - DMA timing setup |
176 | * @hwif: ATA port | ||
176 | * @drive: ATA device | 177 | * @drive: ATA device |
177 | * @mode: DMA mode | ||
178 | */ | 178 | */ |
179 | 179 | ||
180 | static void cs5536_set_dma_mode(ide_drive_t *drive, const u8 mode) | 180 | static void cs5536_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
181 | { | 181 | { |
182 | static const u8 udma_timings[6] = { | 182 | static const u8 udma_timings[6] = { |
183 | 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, | 183 | 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, |
@@ -187,10 +187,11 @@ static void cs5536_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
187 | 0x67, 0x21, 0x20, | 187 | 0x67, 0x21, 0x20, |
188 | }; | 188 | }; |
189 | 189 | ||
190 | struct pci_dev *pdev = to_pci_dev(drive->hwif->dev); | 190 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
191 | int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT; | 191 | int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT; |
192 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | 192 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); |
193 | u32 etc; | 193 | u32 etc; |
194 | const u8 mode = drive->dma_mode; | ||
194 | 195 | ||
195 | cs5536_read(pdev, ETC, &etc); | 196 | cs5536_read(pdev, ETC, &etc); |
196 | 197 | ||
diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c index ead65c394f00..9383f67deae1 100644 --- a/drivers/ide/cy82c693.c +++ b/drivers/ide/cy82c693.c | |||
@@ -53,9 +53,9 @@ | |||
53 | * set DMA mode a specific channel for CY82C693 | 53 | * set DMA mode a specific channel for CY82C693 |
54 | */ | 54 | */ |
55 | 55 | ||
56 | static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | 56 | static void cy82c693_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
57 | { | 57 | { |
58 | ide_hwif_t *hwif = drive->hwif; | 58 | const u8 mode = drive->dma_mode; |
59 | u8 single = (mode & 0x10) >> 4, index = 0, data = 0; | 59 | u8 single = (mode & 0x10) >> 4, index = 0, data = 0; |
60 | 60 | ||
61 | index = hwif->channel ? CY82_INDEX_CHANNEL1 : CY82_INDEX_CHANNEL0; | 61 | index = hwif->channel ? CY82_INDEX_CHANNEL1 : CY82_INDEX_CHANNEL0; |
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index f1dec519a9e6..b885c1d548f5 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c | |||
@@ -627,14 +627,14 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
627 | return info->timings->clock_table[info->clock][i]; | 627 | return info->timings->clock_table[info->clock][i]; |
628 | } | 628 | } |
629 | 629 | ||
630 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | 630 | static void hpt3xx_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
631 | { | 631 | { |
632 | ide_hwif_t *hwif = drive->hwif; | ||
633 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 632 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
634 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); | 633 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
635 | struct hpt_timings *t = info->timings; | 634 | struct hpt_timings *t = info->timings; |
636 | u8 itr_addr = 0x40 + (drive->dn * 4); | 635 | u8 itr_addr = 0x40 + (drive->dn * 4); |
637 | u32 old_itr = 0; | 636 | u32 old_itr = 0; |
637 | const u8 speed = drive->dma_mode; | ||
638 | u32 new_itr = get_speed_setting(speed, info); | 638 | u32 new_itr = get_speed_setting(speed, info); |
639 | u32 itr_mask = speed < XFER_MW_DMA_0 ? t->pio_mask : | 639 | u32 itr_mask = speed < XFER_MW_DMA_0 ? t->pio_mask : |
640 | (speed < XFER_UDMA_0 ? t->dma_mask : | 640 | (speed < XFER_UDMA_0 ? t->dma_mask : |
@@ -653,7 +653,8 @@ static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | |||
653 | 653 | ||
654 | static void hpt3xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 654 | static void hpt3xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
655 | { | 655 | { |
656 | hpt3xx_set_mode(drive, drive->pio_mode); | 656 | drive->dma_mode = drive->pio_mode; |
657 | hpt3xx_set_mode(hwif, drive); | ||
657 | } | 658 | } |
658 | 659 | ||
659 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 660 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 0f67f1abbbd3..26b6c0a1f772 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
@@ -185,10 +185,11 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = { | |||
185 | * MW1 80 50 50 150 C | 185 | * MW1 80 50 50 150 C |
186 | * MW2 70 25 25 120 C | 186 | * MW2 70 25 25 120 C |
187 | */ | 187 | */ |
188 | static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) | 188 | static void icside_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
189 | { | 189 | { |
190 | unsigned long cycle_time; | 190 | unsigned long cycle_time; |
191 | int use_dma_info = 0; | 191 | int use_dma_info = 0; |
192 | const u8 xfer_mode = drive->dma_mode; | ||
192 | 193 | ||
193 | switch (xfer_mode) { | 194 | switch (xfer_mode) { |
194 | case XFER_MW_DMA_2: | 195 | case XFER_MW_DMA_2: |
diff --git a/drivers/ide/ide-xfer-mode.c b/drivers/ide/ide-xfer-mode.c index a62fb03fc1cc..9b549e4d1848 100644 --- a/drivers/ide/ide-xfer-mode.c +++ b/drivers/ide/ide-xfer-mode.c | |||
@@ -168,11 +168,11 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
168 | if (ide_config_drive_speed(drive, mode)) | 168 | if (ide_config_drive_speed(drive, mode)) |
169 | return -1; | 169 | return -1; |
170 | drive->dma_mode = mode; | 170 | drive->dma_mode = mode; |
171 | port_ops->set_dma_mode(drive, mode); | 171 | port_ops->set_dma_mode(hwif, drive); |
172 | return 0; | 172 | return 0; |
173 | } else { | 173 | } else { |
174 | drive->dma_mode = mode; | 174 | drive->dma_mode = mode; |
175 | port_ops->set_dma_mode(drive, mode); | 175 | port_ops->set_dma_mode(hwif, drive); |
176 | return ide_config_drive_speed(drive, mode); | 176 | return ide_config_drive_speed(drive, mode); |
177 | } | 177 | } |
178 | } | 178 | } |
diff --git a/drivers/ide/it8172.c b/drivers/ide/it8172.c index 9dfdc8741a7b..560e66d07659 100644 --- a/drivers/ide/it8172.c +++ b/drivers/ide/it8172.c | |||
@@ -77,14 +77,14 @@ static void it8172_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
77 | pci_write_config_dword(dev, 0x44, drive_timing); | 77 | pci_write_config_dword(dev, 0x44, drive_timing); |
78 | } | 78 | } |
79 | 79 | ||
80 | static void it8172_set_dma_mode(ide_drive_t *drive, const u8 speed) | 80 | static void it8172_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
81 | { | 81 | { |
82 | ide_hwif_t *hwif = drive->hwif; | ||
83 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 82 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
84 | int a_speed = 3 << (drive->dn * 4); | 83 | int a_speed = 3 << (drive->dn * 4); |
85 | int u_flag = 1 << drive->dn; | 84 | int u_flag = 1 << drive->dn; |
86 | int u_speed = 0; | 85 | int u_speed = 0; |
87 | u8 reg48, reg4a; | 86 | u8 reg48, reg4a; |
87 | const u8 speed = drive->dma_mode; | ||
88 | 88 | ||
89 | pci_read_config_byte(dev, 0x48, ®48); | 89 | pci_read_config_byte(dev, 0x48, ®48); |
90 | pci_read_config_byte(dev, 0x4a, ®4a); | 90 | pci_read_config_byte(dev, 0x4a, ®4a); |
diff --git a/drivers/ide/it8213.c b/drivers/ide/it8213.c index 492c07d5f4f3..46816ba26416 100644 --- a/drivers/ide/it8213.c +++ b/drivers/ide/it8213.c | |||
@@ -74,15 +74,14 @@ static void it8213_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
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 | ||
83 | static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | 83 | static 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, ®4042); | 96 | pci_read_config_word(dev, maslave, ®4042); |
97 | pci_read_config_byte(dev, 0x48, ®48); | 97 | pci_read_config_byte(dev, 0x48, ®48); |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 69becb7b9656..56b79194156b 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
@@ -393,14 +393,16 @@ static int it821x_dma_end(ide_drive_t *drive) | |||
393 | 393 | ||
394 | /** | 394 | /** |
395 | * it821x_set_dma_mode - set host controller for DMA mode | 395 | * it821x_set_dma_mode - set host controller for DMA mode |
396 | * @hwif: port | ||
396 | * @drive: drive | 397 | * @drive: drive |
397 | * @speed: DMA mode | ||
398 | * | 398 | * |
399 | * Tune the ITE chipset for the desired DMA mode. | 399 | * Tune the ITE chipset for the desired DMA mode. |
400 | */ | 400 | */ |
401 | 401 | ||
402 | static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed) | 402 | static void it821x_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
403 | { | 403 | { |
404 | const u8 speed = drive->dma_mode; | ||
405 | |||
404 | /* | 406 | /* |
405 | * MWDMA tuning is really hard because our MWDMA and PIO | 407 | * MWDMA tuning is really hard because our MWDMA and PIO |
406 | * timings are kept in the same place. We can switch in the | 408 | * timings are kept in the same place. We can switch in the |
diff --git a/drivers/ide/jmicron.c b/drivers/ide/jmicron.c index ebffb904ed24..74c2c4a6d909 100644 --- a/drivers/ide/jmicron.c +++ b/drivers/ide/jmicron.c | |||
@@ -86,13 +86,13 @@ static void jmicron_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
86 | 86 | ||
87 | /** | 87 | /** |
88 | * jmicron_set_dma_mode - set host controller for DMA mode | 88 | * jmicron_set_dma_mode - set host controller for DMA mode |
89 | * @hwif: port | ||
89 | * @drive: drive | 90 | * @drive: drive |
90 | * @mode: DMA mode | ||
91 | * | 91 | * |
92 | * As the JMicron snoops for timings we don't need to do anything here. | 92 | * As the JMicron snoops for timings we don't need to do anything here. |
93 | */ | 93 | */ |
94 | 94 | ||
95 | static void jmicron_set_dma_mode(ide_drive_t *drive, const u8 mode) | 95 | static void jmicron_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c index 0f262d07c378..35448c91b8c8 100644 --- a/drivers/ide/palm_bk3710.c +++ b/drivers/ide/palm_bk3710.c | |||
@@ -188,10 +188,11 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, | |||
188 | writel(val32, base + BK3710_REGRCVR); | 188 | writel(val32, base + BK3710_REGRCVR); |
189 | } | 189 | } |
190 | 190 | ||
191 | static void palm_bk3710_set_dma_mode(ide_drive_t *drive, u8 xferspeed) | 191 | static void palm_bk3710_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
192 | { | 192 | { |
193 | int is_slave = drive->dn & 1; | 193 | int is_slave = drive->dn & 1; |
194 | void __iomem *base = (void *)drive->hwif->dma_base; | 194 | void __iomem *base = (void *)hwif->dma_base; |
195 | const u8 xferspeed = drive->dma_mode; | ||
195 | 196 | ||
196 | if (xferspeed >= XFER_UDMA_0) { | 197 | if (xferspeed >= XFER_UDMA_0) { |
197 | palm_bk3710_setudmamode(base, is_slave, | 198 | palm_bk3710_setudmamode(base, is_slave, |
diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c index 874acd2bb6e6..9546fe2a93f7 100644 --- a/drivers/ide/pdc202xx_new.c +++ b/drivers/ide/pdc202xx_new.c | |||
@@ -129,11 +129,11 @@ static struct udma_timing { | |||
129 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ | 129 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | 132 | static void pdcnew_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
133 | { | 133 | { |
134 | ide_hwif_t *hwif = drive->hwif; | ||
135 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 134 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
136 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 135 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
136 | const u8 speed = drive->dma_mode; | ||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * IDE core issues SETFEATURES_XFER to the drive first (thanks to | 139 | * IDE core issues SETFEATURES_XFER to the drive first (thanks to |
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c index 402aab7f3baa..07cd37516ba6 100644 --- a/drivers/ide/pdc202xx_old.c +++ b/drivers/ide/pdc202xx_old.c | |||
@@ -21,11 +21,11 @@ | |||
21 | 21 | ||
22 | #define DRV_NAME "pdc202xx_old" | 22 | #define DRV_NAME "pdc202xx_old" |
23 | 23 | ||
24 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | 24 | static void pdc202xx_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
25 | { | 25 | { |
26 | ide_hwif_t *hwif = drive->hwif; | ||
27 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 26 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
28 | u8 drive_pci = 0x60 + (drive->dn << 2); | 27 | u8 drive_pci = 0x60 + (drive->dn << 2); |
28 | const u8 speed = drive->dma_mode; | ||
29 | 29 | ||
30 | u8 AP = 0, BP = 0, CP = 0; | 30 | u8 AP = 0, BP = 0, CP = 0; |
31 | u8 TA = 0, TB = 0, TC = 0; | 31 | u8 TA = 0, TB = 0, TC = 0; |
@@ -78,7 +78,8 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | |||
78 | 78 | ||
79 | static void pdc202xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 79 | static void pdc202xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
80 | { | 80 | { |
81 | pdc202xx_set_mode(drive, drive->pio_mode); | 81 | drive->dma_mode = drive->pio_mode; |
82 | pdc202xx_set_mode(hwif, drive); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | static int pdc202xx_test_irq(ide_hwif_t *hwif) | 85 | static int pdc202xx_test_irq(ide_hwif_t *hwif) |
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c index 64b3041daa60..1bdca49e5a03 100644 --- a/drivers/ide/piix.c +++ b/drivers/ide/piix.c | |||
@@ -127,16 +127,15 @@ static void piix_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
127 | 127 | ||
128 | /** | 128 | /** |
129 | * piix_set_dma_mode - set host controller for DMA mode | 129 | * piix_set_dma_mode - set host controller for DMA mode |
130 | * @hwif: port | ||
130 | * @drive: drive | 131 | * @drive: drive |
131 | * @speed: DMA mode | ||
132 | * | 132 | * |
133 | * Set a PIIX host controller to the desired DMA mode. This involves | 133 | * Set a PIIX host controller to the desired DMA mode. This involves |
134 | * programming the right timing data into the PCI configuration space. | 134 | * programming the right timing data into the PCI configuration space. |
135 | */ | 135 | */ |
136 | 136 | ||
137 | static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) | 137 | static void piix_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
138 | { | 138 | { |
139 | ide_hwif_t *hwif = drive->hwif; | ||
140 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 139 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
141 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 140 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
142 | int a_speed = 3 << (drive->dn * 4); | 141 | int a_speed = 3 << (drive->dn * 4); |
@@ -147,6 +146,7 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
147 | int sitre; | 146 | int sitre; |
148 | u16 reg4042, reg4a; | 147 | u16 reg4042, reg4a; |
149 | u8 reg48, reg54, reg55; | 148 | u8 reg48, reg54, reg55; |
149 | const u8 speed = drive->dma_mode; | ||
150 | 150 | ||
151 | pci_read_config_word(dev, maslave, ®4042); | 151 | pci_read_config_word(dev, maslave, ®4042); |
152 | sitre = (reg4042 & 0x4000) ? 1 : 0; | 152 | sitre = (reg4042 & 0x4000) ? 1 : 0; |
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index a167968a2d42..9fae1fb1468b 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c | |||
@@ -777,14 +777,14 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, | |||
777 | #endif | 777 | #endif |
778 | } | 778 | } |
779 | 779 | ||
780 | static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed) | 780 | static void pmac_ide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
781 | { | 781 | { |
782 | ide_hwif_t *hwif = drive->hwif; | ||
783 | pmac_ide_hwif_t *pmif = | 782 | pmac_ide_hwif_t *pmif = |
784 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); | 783 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); |
785 | int ret = 0; | 784 | int ret = 0; |
786 | u32 *timings, *timings2, tl[2]; | 785 | u32 *timings, *timings2, tl[2]; |
787 | u8 unit = drive->dn & 1; | 786 | u8 unit = drive->dn & 1; |
787 | const u8 speed = drive->dma_mode; | ||
788 | 788 | ||
789 | timings = &pmif->timings[unit]; | 789 | timings = &pmif->timings[unit]; |
790 | timings2 = &pmif->timings[unit+2]; | 790 | timings2 = &pmif->timings[unit+2]; |
diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c index bb0166e460ab..134f1fd13866 100644 --- a/drivers/ide/sc1200.c +++ b/drivers/ide/sc1200.c | |||
@@ -122,13 +122,13 @@ out: | |||
122 | return mask; | 122 | return mask; |
123 | } | 123 | } |
124 | 124 | ||
125 | static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | 125 | static void sc1200_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
126 | { | 126 | { |
127 | ide_hwif_t *hwif = drive->hwif; | ||
128 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 127 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
129 | unsigned int reg, timings; | 128 | unsigned int reg, timings; |
130 | unsigned short pci_clock; | 129 | unsigned short pci_clock; |
131 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; | 130 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; |
131 | const u8 mode = drive->dma_mode; | ||
132 | 132 | ||
133 | static const u32 udma_timing[3][3] = { | 133 | static const u32 udma_timing[3][3] = { |
134 | { 0x00921250, 0x00911140, 0x00911030 }, | 134 | { 0x00921250, 0x00911140, 0x00911030 }, |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 23e16e4460ee..e9d4b441d1c3 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -231,16 +231,15 @@ static void scc_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * scc_set_dma_mode - set host controller for DMA mode | 233 | * scc_set_dma_mode - set host controller for DMA mode |
234 | * @hwif: port | ||
234 | * @drive: drive | 235 | * @drive: drive |
235 | * @speed: DMA mode | ||
236 | * | 236 | * |
237 | * Load the timing settings for this device mode into the | 237 | * Load the timing settings for this device mode into the |
238 | * controller. | 238 | * controller. |
239 | */ | 239 | */ |
240 | 240 | ||
241 | static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed) | 241 | static void scc_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
242 | { | 242 | { |
243 | ide_hwif_t *hwif = drive->hwif; | ||
244 | struct scc_ports *ports = ide_get_hwifdata(hwif); | 243 | struct scc_ports *ports = ide_get_hwifdata(hwif); |
245 | unsigned long ctl_base = ports->ctl; | 244 | unsigned long ctl_base = ports->ctl; |
246 | unsigned long cckctrl_port = ctl_base + 0xff0; | 245 | unsigned long cckctrl_port = ctl_base + 0xff0; |
@@ -254,6 +253,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
254 | int offset, idx; | 253 | int offset, idx; |
255 | unsigned long reg; | 254 | unsigned long reg; |
256 | unsigned long jcactsel; | 255 | unsigned long jcactsel; |
256 | const u8 speed = drive->dma_mode; | ||
257 | 257 | ||
258 | reg = in_be32((void __iomem *)cckctrl_port); | 258 | reg = in_be32((void __iomem *)cckctrl_port); |
259 | if (reg & CCKCTRL_ATACLKOEN) { | 259 | if (reg & CCKCTRL_ATACLKOEN) { |
diff --git a/drivers/ide/serverworks.c b/drivers/ide/serverworks.c index a56bc51ae032..35fb8dabb55d 100644 --- a/drivers/ide/serverworks.c +++ b/drivers/ide/serverworks.c | |||
@@ -128,14 +128,14 @@ static void svwks_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | 131 | static void svwks_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
132 | { | 132 | { |
133 | static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; | 133 | static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; |
134 | static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; | 134 | static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; |
135 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; | 135 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; |
136 | 136 | ||
137 | ide_hwif_t *hwif = drive->hwif; | ||
138 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 137 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
138 | const u8 speed = drive->dma_mode; | ||
139 | u8 unit = drive->dn & 1; | 139 | u8 unit = drive->dn & 1; |
140 | 140 | ||
141 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 141 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index b7d61dc64096..e3ea591f66d3 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c | |||
@@ -255,7 +255,7 @@ static int sgiioc4_dma_end(ide_drive_t *drive) | |||
255 | return dma_stat; | 255 | return dma_stat; |
256 | } | 256 | } |
257 | 257 | ||
258 | static void sgiioc4_set_dma_mode(ide_drive_t *drive, const u8 speed) | 258 | static void sgiioc4_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
259 | { | 259 | { |
260 | } | 260 | } |
261 | 261 | ||
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index 97266958f744..2009ac2ff658 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c | |||
@@ -289,19 +289,18 @@ static void sil_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
289 | 289 | ||
290 | /** | 290 | /** |
291 | * sil_set_dma_mode - set host controller for DMA mode | 291 | * sil_set_dma_mode - set host controller for DMA mode |
292 | * @hwif: port | ||
292 | * @drive: drive | 293 | * @drive: drive |
293 | * @speed: DMA mode | ||
294 | * | 294 | * |
295 | * Tune the SiI chipset for the desired DMA mode. | 295 | * Tune the SiI chipset for the desired DMA mode. |
296 | */ | 296 | */ |
297 | 297 | ||
298 | static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | 298 | static void sil_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
299 | { | 299 | { |
300 | static const u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; | 300 | static const u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; |
301 | static const u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; | 301 | static const u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; |
302 | static const u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; | 302 | static const u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; |
303 | 303 | ||
304 | ide_hwif_t *hwif = drive->hwif; | ||
305 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 304 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
306 | unsigned long base = (unsigned long)hwif->hwif_data; | 305 | unsigned long base = (unsigned long)hwif->hwif_data; |
307 | u16 ultra = 0, multi = 0; | 306 | u16 ultra = 0, multi = 0; |
@@ -311,6 +310,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
311 | : (mmio ? 0xB4 : 0x80); | 310 | : (mmio ? 0xB4 : 0x80); |
312 | unsigned long ma = siimage_seldev(drive, 0x08); | 311 | unsigned long ma = siimage_seldev(drive, 0x08); |
313 | unsigned long ua = siimage_seldev(drive, 0x0C); | 312 | unsigned long ua = siimage_seldev(drive, 0x0C); |
313 | const u8 speed = drive->dma_mode; | ||
314 | 314 | ||
315 | scsc = sil_ioread8 (dev, base + (mmio ? 0x4A : 0x8A)); | 315 | scsc = sil_ioread8 (dev, base + (mmio ? 0x4A : 0x8A)); |
316 | mode = sil_ioread8 (dev, base + addr_mask); | 316 | mode = sil_ioread8 (dev, base + addr_mask); |
diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c index 5a0192060531..db7f4e761dbc 100644 --- a/drivers/ide/sis5513.c +++ b/drivers/ide/sis5513.c | |||
@@ -340,8 +340,10 @@ static void sis_program_udma_timings(ide_drive_t *drive, const u8 mode) | |||
340 | sis_ata33_program_udma_timings(drive, mode); | 340 | sis_ata33_program_udma_timings(drive, mode); |
341 | } | 341 | } |
342 | 342 | ||
343 | static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) | 343 | static void sis_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
344 | { | 344 | { |
345 | const u8 speed = drive->dma_mode; | ||
346 | |||
345 | if (speed >= XFER_UDMA_0) | 347 | if (speed >= XFER_UDMA_0) |
346 | sis_program_udma_timings(drive, speed); | 348 | sis_program_udma_timings(drive, speed); |
347 | else | 349 | else |
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index 419cd3bc6c84..f21dc2ad7682 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c | |||
@@ -92,11 +92,12 @@ static void sl82c105_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
92 | /* | 92 | /* |
93 | * Configure the chipset for DMA mode. | 93 | * Configure the chipset for DMA mode. |
94 | */ | 94 | */ |
95 | static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) | 95 | static void sl82c105_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
96 | { | 96 | { |
97 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; | 97 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; |
98 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | 98 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); |
99 | u16 drv_ctrl; | 99 | u16 drv_ctrl; |
100 | const u8 speed = drive->dma_mode; | ||
100 | 101 | ||
101 | drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0]; | 102 | drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0]; |
102 | 103 | ||
diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c index 019777522cd2..864ffe0e26d9 100644 --- a/drivers/ide/slc90e66.c +++ b/drivers/ide/slc90e66.c | |||
@@ -72,14 +72,14 @@ static void slc90e66_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
72 | spin_unlock_irqrestore(&slc90e66_lock, flags); | 72 | spin_unlock_irqrestore(&slc90e66_lock, flags); |
73 | } | 73 | } |
74 | 74 | ||
75 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | 75 | static void slc90e66_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
76 | { | 76 | { |
77 | ide_hwif_t *hwif = drive->hwif; | ||
78 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 77 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
79 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 78 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
80 | int sitre = 0, a_speed = 7 << (drive->dn * 4); | 79 | int sitre = 0, a_speed = 7 << (drive->dn * 4); |
81 | int u_speed = 0, u_flag = 1 << drive->dn; | 80 | int u_speed = 0, u_flag = 1 << drive->dn; |
82 | u16 reg4042, reg44, reg48, reg4a; | 81 | u16 reg4042, reg44, reg48, reg4a; |
82 | const u8 speed = drive->dma_mode; | ||
83 | 83 | ||
84 | pci_read_config_word(dev, maslave, ®4042); | 84 | pci_read_config_word(dev, maslave, ®4042); |
85 | sitre = (reg4042 & 0x4000) ? 1 : 0; | 85 | sitre = (reg4042 & 0x4000) ? 1 : 0; |
diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c index f2cb62bf3f22..e444d24934b3 100644 --- a/drivers/ide/tc86c001.c +++ b/drivers/ide/tc86c001.c | |||
@@ -13,11 +13,11 @@ | |||
13 | 13 | ||
14 | #define DRV_NAME "tc86c001" | 14 | #define DRV_NAME "tc86c001" |
15 | 15 | ||
16 | static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed) | 16 | static void tc86c001_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
17 | { | 17 | { |
18 | ide_hwif_t *hwif = drive->hwif; | ||
19 | unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00); | 18 | unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00); |
20 | u16 mode, scr = inw(scr_port); | 19 | u16 mode, scr = inw(scr_port); |
20 | const u8 speed = drive->dma_mode; | ||
21 | 21 | ||
22 | switch (speed) { | 22 | switch (speed) { |
23 | case XFER_UDMA_4: mode = 0x00c0; break; | 23 | case XFER_UDMA_4: mode = 0x00c0; break; |
@@ -43,7 +43,8 @@ static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed) | |||
43 | 43 | ||
44 | static void tc86c001_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 44 | static void tc86c001_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
45 | { | 45 | { |
46 | tc86c001_set_mode(drive, drive->pio_mode); | 46 | drive->dma_mode = drive->pio_mode; |
47 | tc86c001_set_mode(hwif, drive); | ||
47 | } | 48 | } |
48 | 49 | ||
49 | /* | 50 | /* |
diff --git a/drivers/ide/triflex.c b/drivers/ide/triflex.c index d34a7eecdea5..7953447eae0f 100644 --- a/drivers/ide/triflex.c +++ b/drivers/ide/triflex.c | |||
@@ -34,9 +34,8 @@ | |||
34 | 34 | ||
35 | #define DRV_NAME "triflex" | 35 | #define DRV_NAME "triflex" |
36 | 36 | ||
37 | static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | 37 | static void triflex_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
38 | { | 38 | { |
39 | ide_hwif_t *hwif = drive->hwif; | ||
40 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 39 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
41 | u32 triflex_timings = 0; | 40 | u32 triflex_timings = 0; |
42 | u16 timing = 0; | 41 | u16 timing = 0; |
@@ -44,7 +43,7 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | |||
44 | 43 | ||
45 | pci_read_config_dword(dev, channel_offset, &triflex_timings); | 44 | pci_read_config_dword(dev, channel_offset, &triflex_timings); |
46 | 45 | ||
47 | switch(speed) { | 46 | switch (drive->dma_mode) { |
48 | case XFER_MW_DMA_2: | 47 | case XFER_MW_DMA_2: |
49 | timing = 0x0103; | 48 | timing = 0x0103; |
50 | break; | 49 | break; |
@@ -84,7 +83,8 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | |||
84 | 83 | ||
85 | static void triflex_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 84 | static void triflex_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
86 | { | 85 | { |
87 | triflex_set_mode(drive, drive->pio_mode); | 86 | drive->dma_mode = drive->pio_mode; |
87 | triflex_set_mode(hwif, drive); | ||
88 | } | 88 | } |
89 | 89 | ||
90 | static const struct ide_port_ops triflex_port_ops = { | 90 | static const struct ide_port_ops triflex_port_ops = { |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 5228a4786de5..f210633a3d57 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -125,10 +125,10 @@ static void tx4939ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
125 | /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ | 125 | /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ |
126 | } | 126 | } |
127 | 127 | ||
128 | static void tx4939ide_set_dma_mode(ide_drive_t *drive, const u8 mode) | 128 | static void tx4939ide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
129 | { | 129 | { |
130 | ide_hwif_t *hwif = drive->hwif; | ||
131 | u32 mask, val; | 130 | u32 mask, val; |
131 | const u8 mode = drive->dma_mode; | ||
132 | 132 | ||
133 | /* Update Data Transfer Mode for this drive. */ | 133 | /* Update Data Transfer Mode for this drive. */ |
134 | if (mode >= XFER_UDMA_0) | 134 | if (mode >= XFER_UDMA_0) |
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c index 6d995fc9d4f5..6769fe252b07 100644 --- a/drivers/ide/via82cxxx.c +++ b/drivers/ide/via82cxxx.c | |||
@@ -169,22 +169,22 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
169 | 169 | ||
170 | /** | 170 | /** |
171 | * via_set_drive - configure transfer mode | 171 | * via_set_drive - configure transfer mode |
172 | * @hwif: port | ||
172 | * @drive: Drive to set up | 173 | * @drive: Drive to set up |
173 | * @speed: desired speed | ||
174 | * | 174 | * |
175 | * via_set_drive() computes timing values configures the chipset to | 175 | * via_set_drive() computes timing values configures the chipset to |
176 | * a desired transfer mode. It also can be called by upper layers. | 176 | * a desired transfer mode. It also can be called by upper layers. |
177 | */ | 177 | */ |
178 | 178 | ||
179 | static void via_set_drive(ide_drive_t *drive, const u8 speed) | 179 | static void via_set_drive(ide_hwif_t *hwif, ide_drive_t *drive) |
180 | { | 180 | { |
181 | ide_hwif_t *hwif = drive->hwif; | ||
182 | ide_drive_t *peer = ide_get_pair_dev(drive); | 181 | ide_drive_t *peer = ide_get_pair_dev(drive); |
183 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 182 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
184 | struct ide_host *host = pci_get_drvdata(dev); | 183 | struct ide_host *host = pci_get_drvdata(dev); |
185 | struct via82cxxx_dev *vdev = host->host_priv; | 184 | struct via82cxxx_dev *vdev = host->host_priv; |
186 | struct ide_timing t, p; | 185 | struct ide_timing t, p; |
187 | unsigned int T, UT; | 186 | unsigned int T, UT; |
187 | const u8 speed = drive->dma_mode; | ||
188 | 188 | ||
189 | T = 1000000000 / via_clock; | 189 | T = 1000000000 / via_clock; |
190 | 190 | ||
@@ -216,7 +216,8 @@ static void via_set_drive(ide_drive_t *drive, const u8 speed) | |||
216 | 216 | ||
217 | static void via_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 217 | static void via_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
218 | { | 218 | { |
219 | via_set_drive(drive, drive->pio_mode); | 219 | drive->dma_mode = drive->pio_mode; |
220 | via_set_drive(hwif, drive); | ||
220 | } | 221 | } |
221 | 222 | ||
222 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) | 223 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) |