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/it821x.c | |
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/it821x.c')
-rw-r--r-- | drivers/ide/pci/it821x.c | 36 |
1 files changed, 16 insertions, 20 deletions
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; |