diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:40 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:40 -0400 |
commit | 123995b97136cb41fa282f0ed2385f2c8066df96 (patch) | |
tree | 39b994f29bac4dc931be9abdde1e7f5412692856 /drivers/ide/pci | |
parent | 8595259ccb6a13b9aab31832ce874d157064d256 (diff) |
ide: use 'drive->dn & 1' instead of drive->select.b.unit
* Call ide_port_init_devices() in ide_host_register()
also if 'struct ide_port_info *d' is not available.
* Init drive->dn in ide_port_init_devices() instead of
ide_probe_port() so it is valid also in ->init_dev.
* Pass device number to ide_dev_apply_params().
* Use 'drive->dn & 1' instead of drive->select.b.unit.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/aec62xx.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 7 | ||||
-rw-r--r-- | drivers/ide/pci/cmd640.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/cs5535.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/cy82c693.c | 7 | ||||
-rw-r--r-- | drivers/ide/pci/it821x.c | 36 | ||||
-rw-r--r-- | drivers/ide/pci/ns87415.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/opti621.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/sc1200.c | 3 | ||||
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/serverworks.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/siimage.c | 9 | ||||
-rw-r--r-- | drivers/ide/pci/triflex.c | 9 |
13 files changed, 41 insertions, 48 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index e7475ba559c7..c294b19f5552 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -115,7 +115,7 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | |||
115 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 115 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
116 | struct ide_host *host = pci_get_drvdata(dev); | 116 | struct ide_host *host = pci_get_drvdata(dev); |
117 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; | 117 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; |
118 | u8 unit = (drive->select.b.unit & 0x01); | 118 | u8 unit = drive->dn & 1; |
119 | u8 tmp1 = 0, tmp2 = 0; | 119 | u8 tmp1 = 0, tmp2 = 0; |
120 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 120 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
121 | unsigned long flags; | 121 | unsigned long flags; |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 053c75263918..f1c57f72bbdb 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -77,8 +77,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
77 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; | 77 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; |
78 | int port = hwif->channel ? 0x5c : 0x58; | 78 | int port = hwif->channel ? 0x5c : 0x58; |
79 | int portFIFO = hwif->channel ? 0x55 : 0x54; | 79 | int portFIFO = hwif->channel ? 0x55 : 0x54; |
80 | u8 cd_dma_fifo = 0; | 80 | u8 cd_dma_fifo = 0, unit = drive->dn & 1; |
81 | int unit = drive->select.b.unit & 1; | ||
82 | 81 | ||
83 | if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) | 82 | if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) |
84 | s_clc = 0; | 83 | s_clc = 0; |
@@ -112,7 +111,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
112 | } | 111 | } |
113 | 112 | ||
114 | pci_write_config_byte(dev, port, s_clc); | 113 | pci_write_config_byte(dev, port, s_clc); |
115 | pci_write_config_byte(dev, port+drive->select.b.unit+2, (a_clc << 4) | r_clc); | 114 | pci_write_config_byte(dev, port + unit + 2, (a_clc << 4) | r_clc); |
116 | local_irq_restore(flags); | 115 | local_irq_restore(flags); |
117 | } | 116 | } |
118 | 117 | ||
@@ -154,7 +153,7 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
154 | ide_hwif_t *hwif = HWIF(drive); | 153 | ide_hwif_t *hwif = HWIF(drive); |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 154 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
156 | u8 speed1 = speed; | 155 | u8 speed1 = speed; |
157 | u8 unit = (drive->select.b.unit & 0x01); | 156 | u8 unit = drive->dn & 1; |
158 | u8 tmpbyte = 0x00; | 157 | u8 tmpbyte = 0x00; |
159 | int m5229_udma = (hwif->channel) ? 0x57 : 0x56; | 158 | int m5229_udma = (hwif->channel) ? 0x57 : 0x56; |
160 | 159 | ||
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index d3afdffcb07a..e4306647d00d 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -468,7 +468,7 @@ static void program_drive_counts(ide_drive_t *drive, unsigned int index) | |||
468 | */ | 468 | */ |
469 | if (index > 1) { | 469 | if (index > 1) { |
470 | ide_hwif_t *hwif = drive->hwif; | 470 | ide_hwif_t *hwif = drive->hwif; |
471 | ide_drive_t *peer = &hwif->drives[!drive->select.b.unit]; | 471 | ide_drive_t *peer = &hwif->drives[!(drive->dn & 1)]; |
472 | unsigned int mate = index ^ 1; | 472 | unsigned int mate = index ^ 1; |
473 | 473 | ||
474 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { | 474 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { |
@@ -607,7 +607,7 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
607 | 607 | ||
608 | static void cmd640_init_dev(ide_drive_t *drive) | 608 | static void cmd640_init_dev(ide_drive_t *drive) |
609 | { | 609 | { |
610 | unsigned int i = drive->hwif->channel * 2 + drive->select.b.unit; | 610 | unsigned int i = drive->hwif->channel * 2 + (drive->dn & 1); |
611 | 611 | ||
612 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 612 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
613 | /* | 613 | /* |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 1e5bc59ea2fb..fa6dca9f3287 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -76,7 +76,7 @@ static unsigned int cs5535_udma_timings[5] = | |||
76 | static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) | 76 | static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) |
77 | { | 77 | { |
78 | u32 reg = 0, dummy; | 78 | u32 reg = 0, dummy; |
79 | int unit = drive->select.b.unit; | 79 | u8 unit = drive->dn & 1; |
80 | 80 | ||
81 | /* Set the PIO timings */ | 81 | /* Set the PIO timings */ |
82 | if (speed < XFER_SW_DMA_0) { | 82 | if (speed < XFER_SW_DMA_0) { |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 5241ef74f8d9..e5f8fc0ed318 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -178,8 +178,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
178 | 178 | ||
179 | #if CY82C693_DEBUG_INFO | 179 | #if CY82C693_DEBUG_INFO |
180 | printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", | 180 | printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", |
181 | drive->name, HWIF(drive)->channel, drive->select.b.unit, | 181 | drive->name, hwif->channel, drive->dn & 1, mode & 3, single); |
182 | mode & 3, single); | ||
183 | #endif /* CY82C693_DEBUG_INFO */ | 182 | #endif /* CY82C693_DEBUG_INFO */ |
184 | 183 | ||
185 | /* | 184 | /* |
@@ -224,7 +223,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
224 | compute_clocks(pio, &pclk); | 223 | compute_clocks(pio, &pclk); |
225 | 224 | ||
226 | /* now let's write the clocks registers */ | 225 | /* now let's write the clocks registers */ |
227 | if (drive->select.b.unit == 0) { | 226 | if ((drive->dn & 1) == 0) { |
228 | /* | 227 | /* |
229 | * set master drive | 228 | * set master drive |
230 | * address setup control register | 229 | * address setup control register |
@@ -266,7 +265,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
266 | #if CY82C693_DEBUG_INFO | 265 | #if CY82C693_DEBUG_INFO |
267 | printk(KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to " | 266 | printk(KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to " |
268 | "(addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", | 267 | "(addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n", |
269 | drive->name, hwif->channel, drive->select.b.unit, | 268 | drive->name, hwif->channel, drive->dn & 1, |
270 | addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8); | 269 | addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8); |
271 | #endif /* CY82C693_DEBUG_INFO */ | 270 | #endif /* CY82C693_DEBUG_INFO */ |
272 | } | 271 | } |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index b761015ee190..1aada445a9c8 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -138,8 +138,7 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing) | |||
138 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 138 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
139 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 139 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
140 | int channel = hwif->channel; | 140 | int channel = hwif->channel; |
141 | int unit = drive->select.b.unit; | 141 | u8 unit = drive->dn & 1, conf; |
142 | u8 conf; | ||
143 | 142 | ||
144 | /* Program UDMA timing bits */ | 143 | /* Program UDMA timing bits */ |
145 | if(itdev->clock_mode == ATA_66) | 144 | if(itdev->clock_mode == ATA_66) |
@@ -168,13 +167,11 @@ static void it821x_clock_strategy(ide_drive_t *drive) | |||
168 | ide_hwif_t *hwif = drive->hwif; | 167 | ide_hwif_t *hwif = drive->hwif; |
169 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 168 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
170 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 169 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
170 | ide_drive_t *pair; | ||
171 | int clock, altclock, sel = 0; | ||
172 | u8 unit = drive->dn & 1, v; | ||
171 | 173 | ||
172 | u8 unit = drive->select.b.unit; | 174 | pair = &hwif->drives[1 - unit]; |
173 | ide_drive_t *pair = &hwif->drives[1-unit]; | ||
174 | |||
175 | int clock, altclock; | ||
176 | u8 v; | ||
177 | int sel = 0; | ||
178 | 175 | ||
179 | if(itdev->want[0][0] > itdev->want[1][0]) { | 176 | if(itdev->want[0][0] > itdev->want[1][0]) { |
180 | clock = itdev->want[0][1]; | 177 | clock = itdev->want[0][1]; |
@@ -240,16 +237,17 @@ static void it821x_clock_strategy(ide_drive_t *drive) | |||
240 | 237 | ||
241 | static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio) | 238 | static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio) |
242 | { | 239 | { |
243 | ide_hwif_t *hwif = drive->hwif; | 240 | ide_hwif_t *hwif = drive->hwif; |
244 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 241 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
245 | int unit = drive->select.b.unit; | 242 | ide_drive_t *pair; |
246 | ide_drive_t *pair = &hwif->drives[1 - unit]; | 243 | u8 unit = drive->dn & 1, set_pio = pio; |
247 | u8 set_pio = pio; | ||
248 | 244 | ||
249 | /* Spec says 89 ref driver uses 88 */ | 245 | /* Spec says 89 ref driver uses 88 */ |
250 | static u16 pio_timings[]= { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 }; | 246 | static u16 pio_timings[]= { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 }; |
251 | static u8 pio_want[] = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY }; | 247 | static u8 pio_want[] = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY }; |
252 | 248 | ||
249 | pair = &hwif->drives[1 - unit]; | ||
250 | |||
253 | /* | 251 | /* |
254 | * Compute the best PIO mode we can for a given device. We must | 252 | * Compute the best PIO mode we can for a given device. We must |
255 | * pick a speed that does not cause problems with the other device | 253 | * pick a speed that does not cause problems with the other device |
@@ -286,9 +284,7 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | |||
286 | ide_hwif_t *hwif = drive->hwif; | 284 | ide_hwif_t *hwif = drive->hwif; |
287 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 285 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
288 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); | 286 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); |
289 | int unit = drive->select.b.unit; | 287 | u8 unit = drive->dn & 1, channel = hwif->channel, conf; |
290 | int channel = hwif->channel; | ||
291 | u8 conf; | ||
292 | 288 | ||
293 | static u16 dma[] = { 0x8866, 0x3222, 0x3121 }; | 289 | static u16 dma[] = { 0x8866, 0x3222, 0x3121 }; |
294 | static u8 mwdma_want[] = { ATA_ANY, ATA_66, ATA_ANY }; | 290 | static u8 mwdma_want[] = { ATA_ANY, ATA_66, ATA_ANY }; |
@@ -325,9 +321,7 @@ static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) | |||
325 | ide_hwif_t *hwif = drive->hwif; | 321 | ide_hwif_t *hwif = drive->hwif; |
326 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 322 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
327 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 323 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
328 | int unit = drive->select.b.unit; | 324 | u8 unit = drive->dn & 1, channel = hwif->channel, conf; |
329 | int channel = hwif->channel; | ||
330 | u8 conf; | ||
331 | 325 | ||
332 | static u16 udma[] = { 0x4433, 0x4231, 0x3121, 0x2121, 0x1111, 0x2211, 0x1111 }; | 326 | static u16 udma[] = { 0x4433, 0x4231, 0x3121, 0x2121, 0x1111, 0x2211, 0x1111 }; |
333 | static u8 udma_want[] = { ATA_ANY, ATA_50, ATA_ANY, ATA_66, ATA_66, ATA_50, ATA_66 }; | 327 | static u8 udma_want[] = { ATA_ANY, ATA_50, ATA_ANY, ATA_66, ATA_66, ATA_50, ATA_66 }; |
@@ -369,7 +363,8 @@ static void it821x_dma_start(ide_drive_t *drive) | |||
369 | { | 363 | { |
370 | ide_hwif_t *hwif = drive->hwif; | 364 | ide_hwif_t *hwif = drive->hwif; |
371 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 365 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
372 | int unit = drive->select.b.unit; | 366 | u8 unit = drive->dn & 1; |
367 | |||
373 | if(itdev->mwdma[unit] != MWDMA_OFF) | 368 | if(itdev->mwdma[unit] != MWDMA_OFF) |
374 | it821x_program(drive, itdev->mwdma[unit]); | 369 | it821x_program(drive, itdev->mwdma[unit]); |
375 | else if(itdev->udma[unit] != UDMA_OFF && itdev->timing10) | 370 | else if(itdev->udma[unit] != UDMA_OFF && itdev->timing10) |
@@ -389,9 +384,10 @@ static void it821x_dma_start(ide_drive_t *drive) | |||
389 | static int it821x_dma_end(ide_drive_t *drive) | 384 | static int it821x_dma_end(ide_drive_t *drive) |
390 | { | 385 | { |
391 | ide_hwif_t *hwif = drive->hwif; | 386 | ide_hwif_t *hwif = drive->hwif; |
392 | int unit = drive->select.b.unit; | ||
393 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 387 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
394 | int ret = __ide_dma_end(drive); | 388 | int ret = __ide_dma_end(drive); |
389 | u8 unit = drive->dn & 1; | ||
390 | |||
395 | if(itdev->mwdma[unit] != MWDMA_OFF) | 391 | if(itdev->mwdma[unit] != MWDMA_OFF) |
396 | it821x_program(drive, itdev->pio[unit]); | 392 | it821x_program(drive, itdev->pio[unit]); |
397 | return ret; | 393 | return ret; |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 99e98e5e271c..61a143661ee0 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -160,8 +160,8 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
160 | new |= bit; | 160 | new |= bit; |
161 | 161 | ||
162 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ | 162 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ |
163 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); | 163 | bit = 1 << (20 + (drive->dn & 1) + (hwif->channel << 1)); |
164 | other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->channel << 1)); | 164 | other = 1 << (20 + (1 - (drive->dn & 1)) + (hwif->channel << 1)); |
165 | new = use_dma ? ((new & ~other) | bit) : (new & ~bit); | 165 | new = use_dma ? ((new & ~other) | bit) : (new & ~bit); |
166 | 166 | ||
167 | if (new != *old) { | 167 | if (new != *old) { |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 3de11ddcf863..f0db38bd70e3 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -179,7 +179,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
179 | misc = addr_timings[clk][addr_pio]; | 179 | misc = addr_timings[clk][addr_pio]; |
180 | 180 | ||
181 | /* select Index-0/1 for Register-A/B */ | 181 | /* select Index-0/1 for Register-A/B */ |
182 | write_reg(drive->select.b.unit, MISC_REG); | 182 | write_reg(drive->dn & 1, MISC_REG); |
183 | /* set read cycle timings */ | 183 | /* set read cycle timings */ |
184 | write_reg(tim, READ_REG); | 184 | write_reg(tim, READ_REG); |
185 | /* set write cycle timings */ | 185 | /* set write cycle timings */ |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 50405ed6f0cb..79eeeadad655 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -126,7 +126,6 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
126 | { | 126 | { |
127 | ide_hwif_t *hwif = HWIF(drive); | 127 | ide_hwif_t *hwif = HWIF(drive); |
128 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 128 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
129 | int unit = drive->select.b.unit; | ||
130 | unsigned int reg, timings; | 129 | unsigned int reg, timings; |
131 | unsigned short pci_clock; | 130 | unsigned short pci_clock; |
132 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; | 131 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; |
@@ -155,7 +154,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
155 | else | 154 | else |
156 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; | 155 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; |
157 | 156 | ||
158 | if (unit == 0) { /* are we configuring drive0? */ | 157 | if ((drive->dn & 1) == 0) { |
159 | pci_read_config_dword(dev, basereg + 4, ®); | 158 | pci_read_config_dword(dev, basereg + 4, ®); |
160 | timings |= reg & 0x80000000; /* preserve PIO format bit */ | 159 | timings |= reg & 0x80000000; /* preserve PIO format bit */ |
161 | pci_write_config_dword(dev, basereg + 4, timings); | 160 | pci_write_config_dword(dev, basereg + 4, timings); |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 62fa31409a33..0eced0ae2e86 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -291,7 +291,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
291 | static void scc_dma_host_set(ide_drive_t *drive, int on) | 291 | static void scc_dma_host_set(ide_drive_t *drive, int on) |
292 | { | 292 | { |
293 | ide_hwif_t *hwif = drive->hwif; | 293 | ide_hwif_t *hwif = drive->hwif; |
294 | u8 unit = (drive->select.b.unit & 0x01); | 294 | u8 unit = drive->dn & 1; |
295 | u8 dma_stat = scc_ide_inb(hwif->dma_base + 4); | 295 | u8 dma_stat = scc_ide_inb(hwif->dma_base + 4); |
296 | 296 | ||
297 | if (on) | 297 | if (on) |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 3dff2aea317e..7fac80192f3b 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -153,7 +153,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
153 | 153 | ||
154 | ide_hwif_t *hwif = HWIF(drive); | 154 | ide_hwif_t *hwif = HWIF(drive); |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 155 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
156 | u8 unit = (drive->select.b.unit & 0x01); | 156 | u8 unit = drive->dn & 1; |
157 | 157 | ||
158 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 158 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
159 | 159 | ||
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 174a873b4c64..134868c71c34 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -116,13 +116,14 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) | |||
116 | { | 116 | { |
117 | ide_hwif_t *hwif = HWIF(drive); | 117 | ide_hwif_t *hwif = HWIF(drive); |
118 | unsigned long base = (unsigned long)hwif->hwif_data; | 118 | unsigned long base = (unsigned long)hwif->hwif_data; |
119 | u8 unit = drive->dn & 1; | ||
119 | 120 | ||
120 | base += 0xA0 + r; | 121 | base += 0xA0 + r; |
121 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 122 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
122 | base += hwif->channel << 6; | 123 | base += hwif->channel << 6; |
123 | else | 124 | else |
124 | base += hwif->channel << 4; | 125 | base += hwif->channel << 4; |
125 | base |= drive->select.b.unit << drive->select.b.unit; | 126 | base |= unit << unit; |
126 | return base; | 127 | return base; |
127 | } | 128 | } |
128 | 129 | ||
@@ -255,7 +256,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
255 | u8 addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84) | 256 | u8 addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84) |
256 | : (mmio ? 0xB4 : 0x80); | 257 | : (mmio ? 0xB4 : 0x80); |
257 | u8 mode = 0; | 258 | u8 mode = 0; |
258 | u8 unit = drive->select.b.unit; | 259 | u8 unit = drive->dn & 1; |
259 | 260 | ||
260 | /* trim *taskfile* PIO to the slowest of the master/slave */ | 261 | /* trim *taskfile* PIO to the slowest of the master/slave */ |
261 | if (pair) { | 262 | if (pair) { |
@@ -301,9 +302,9 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
301 | 302 | ||
302 | ide_hwif_t *hwif = HWIF(drive); | 303 | ide_hwif_t *hwif = HWIF(drive); |
303 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 304 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
304 | u16 ultra = 0, multi = 0; | ||
305 | u8 mode = 0, unit = drive->select.b.unit; | ||
306 | unsigned long base = (unsigned long)hwif->hwif_data; | 305 | unsigned long base = (unsigned long)hwif->hwif_data; |
306 | u16 ultra = 0, multi = 0; | ||
307 | u8 mode = 0, unit = drive->dn & 1; | ||
307 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 308 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
308 | u8 scsc = 0, addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84) | 309 | u8 scsc = 0, addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84) |
309 | : (mmio ? 0xB4 : 0x80); | 310 | : (mmio ? 0xB4 : 0x80); |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index be8715dcee05..42fb98f268d5 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -38,13 +38,12 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | |||
38 | { | 38 | { |
39 | ide_hwif_t *hwif = HWIF(drive); | 39 | ide_hwif_t *hwif = HWIF(drive); |
40 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 40 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
41 | u8 channel_offset = hwif->channel ? 0x74 : 0x70; | ||
42 | u16 timing = 0; | ||
43 | u32 triflex_timings = 0; | 41 | u32 triflex_timings = 0; |
44 | u8 unit = (drive->select.b.unit & 0x01); | 42 | u16 timing = 0; |
45 | 43 | u8 channel_offset = hwif->channel ? 0x74 : 0x70, unit = drive->dn & 1; | |
44 | |||
46 | pci_read_config_dword(dev, channel_offset, &triflex_timings); | 45 | pci_read_config_dword(dev, channel_offset, &triflex_timings); |
47 | 46 | ||
48 | switch(speed) { | 47 | switch(speed) { |
49 | case XFER_MW_DMA_2: | 48 | case XFER_MW_DMA_2: |
50 | timing = 0x0103; | 49 | timing = 0x0103; |