aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-03-31 14:15:32 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:32 -0400
commitabb596b25edac1ec1acc4ef53df190771661c3d2 (patch)
treed20ea24960358ce03e0f27eefd2e6911afd1309c
parent0f861e8c47ede537a8ad280c61d5d00d541f04db (diff)
ide: turn selectproc() method into dev_select() method (take 5)
Turn selectproc() method into dev_select() method by teaching it to write to the device register and moving it from 'struct ide_port_ops' to 'struct ide_tp_ops'. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: benh@kernel.crashing.org Cc: petkovbb@gmail.com [bart: add ->dev_select to at91_ide.c and tx4939.c (__BIG_ENDIAN case)] Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/at91_ide.c1
-rw-r--r--drivers/ide/au1xxx-ide.c1
-rw-r--r--drivers/ide/falconide.c1
-rw-r--r--drivers/ide/ht6560b.c20
-rw-r--r--drivers/ide/ide-h8300.c1
-rw-r--r--drivers/ide/ide-io-std.c13
-rw-r--r--drivers/ide/ide-iops.c12
-rw-r--r--drivers/ide/ns87415.c25
-rw-r--r--drivers/ide/pmac.c58
-rw-r--r--drivers/ide/q40ide.c1
-rw-r--r--drivers/ide/qd65xx.c21
-rw-r--r--drivers/ide/scc_pata.c1
-rw-r--r--drivers/ide/sgiioc4.c1
-rw-r--r--drivers/ide/trm290.c20
-rw-r--r--drivers/ide/tx4938ide.c1
-rw-r--r--drivers/ide/tx4939ide.c4
-rw-r--r--include/linux/ide.h6
17 files changed, 139 insertions, 48 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index 04b39ff02d76..8eda552326e9 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -283,6 +283,7 @@ static const struct ide_tp_ops at91_ide_tp_ops = {
283 .read_altstatus = ide_read_altstatus, 283 .read_altstatus = ide_read_altstatus,
284 .write_devctl = ide_write_devctl, 284 .write_devctl = ide_write_devctl,
285 285
286 .dev_select = ide_dev_select,
286 .tf_load = at91_ide_tf_load, 287 .tf_load = at91_ide_tf_load,
287 .tf_read = at91_ide_tf_read, 288 .tf_read = at91_ide_tf_read,
288 289
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 2ca10d533dad..46013644c965 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -469,6 +469,7 @@ static const struct ide_tp_ops au1xxx_tp_ops = {
469 .read_altstatus = ide_read_altstatus, 469 .read_altstatus = ide_read_altstatus,
470 .write_devctl = ide_write_devctl, 470 .write_devctl = ide_write_devctl,
471 471
472 .dev_select = ide_dev_select,
472 .tf_load = ide_tf_load, 473 .tf_load = ide_tf_load,
473 .tf_read = ide_tf_read, 474 .tf_read = ide_tf_read,
474 475
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 5063be85dc33..afa2af9a362b 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -91,6 +91,7 @@ static const struct ide_tp_ops falconide_tp_ops = {
91 .read_altstatus = ide_read_altstatus, 91 .read_altstatus = ide_read_altstatus,
92 .write_devctl = ide_write_devctl, 92 .write_devctl = ide_write_devctl,
93 93
94 .dev_select = ide_dev_select,
94 .tf_load = ide_tf_load, 95 .tf_load = ide_tf_load,
95 .tf_read = ide_tf_read, 96 .tf_read = ide_tf_read,
96 97
diff --git a/drivers/ide/ht6560b.c b/drivers/ide/ht6560b.c
index c7e5c2246b79..2fb0f2965009 100644
--- a/drivers/ide/ht6560b.c
+++ b/drivers/ide/ht6560b.c
@@ -103,7 +103,7 @@
103/* 103/*
104 * This routine is invoked from ide.c to prepare for access to a given drive. 104 * This routine is invoked from ide.c to prepare for access to a given drive.
105 */ 105 */
106static void ht6560b_selectproc (ide_drive_t *drive) 106static void ht6560b_dev_select(ide_drive_t *drive)
107{ 107{
108 ide_hwif_t *hwif = drive->hwif; 108 ide_hwif_t *hwif = drive->hwif;
109 unsigned long flags; 109 unsigned long flags;
@@ -143,6 +143,8 @@ static void ht6560b_selectproc (ide_drive_t *drive)
143#endif 143#endif
144 } 144 }
145 local_irq_restore(flags); 145 local_irq_restore(flags);
146
147 outb(drive->select | ATA_DEVICE_OBS, hwif->io_ports.device_addr);
146} 148}
147 149
148/* 150/*
@@ -305,15 +307,29 @@ static int probe_ht6560b;
305module_param_named(probe, probe_ht6560b, bool, 0); 307module_param_named(probe, probe_ht6560b, bool, 0);
306MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); 308MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
307 309
310static const struct ide_tp_ops ht6560b_tp_ops = {
311 .exec_command = ide_exec_command,
312 .read_status = ide_read_status,
313 .read_altstatus = ide_read_altstatus,
314 .write_devctl = ide_write_devctl,
315
316 .dev_select = ht6560b_dev_select,
317 .tf_load = ide_tf_load,
318 .tf_read = ide_tf_read,
319
320 .input_data = ide_input_data,
321 .output_data = ide_output_data,
322};
323
308static const struct ide_port_ops ht6560b_port_ops = { 324static const struct ide_port_ops ht6560b_port_ops = {
309 .init_dev = ht6560b_init_dev, 325 .init_dev = ht6560b_init_dev,
310 .set_pio_mode = ht6560b_set_pio_mode, 326 .set_pio_mode = ht6560b_set_pio_mode,
311 .selectproc = ht6560b_selectproc,
312}; 327};
313 328
314static const struct ide_port_info ht6560b_port_info __initdata = { 329static const struct ide_port_info ht6560b_port_info __initdata = {
315 .name = DRV_NAME, 330 .name = DRV_NAME,
316 .chipset = ide_ht6560b, 331 .chipset = ide_ht6560b,
332 .tp_ops = &ht6560b_tp_ops,
317 .port_ops = &ht6560b_port_ops, 333 .port_ops = &ht6560b_port_ops,
318 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */ 334 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */
319 IDE_HFLAG_NO_DMA | 335 IDE_HFLAG_NO_DMA |
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index 8541a9abd7ac..dac9a6d44963 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -151,6 +151,7 @@ static const struct ide_tp_ops h8300_tp_ops = {
151 .read_altstatus = ide_read_altstatus, 151 .read_altstatus = ide_read_altstatus,
152 .write_devctl = ide_write_devctl, 152 .write_devctl = ide_write_devctl,
153 153
154 .dev_select = ide_dev_select,
154 .tf_load = h8300_tf_load, 155 .tf_load = h8300_tf_load,
155 .tf_read = h8300_tf_read, 156 .tf_read = h8300_tf_read,
156 157
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c
index 7f77bb7db488..9cac281d82c4 100644
--- a/drivers/ide/ide-io-std.c
+++ b/drivers/ide/ide-io-std.c
@@ -73,6 +73,18 @@ void ide_write_devctl(ide_hwif_t *hwif, u8 ctl)
73} 73}
74EXPORT_SYMBOL_GPL(ide_write_devctl); 74EXPORT_SYMBOL_GPL(ide_write_devctl);
75 75
76void ide_dev_select(ide_drive_t *drive)
77{
78 ide_hwif_t *hwif = drive->hwif;
79 u8 select = drive->select | ATA_DEVICE_OBS;
80
81 if (hwif->host_flags & IDE_HFLAG_MMIO)
82 writeb(select, (void __iomem *)hwif->io_ports.device_addr);
83 else
84 outb(select, hwif->io_ports.device_addr);
85}
86EXPORT_SYMBOL_GPL(ide_dev_select);
87
76void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) 88void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
77{ 89{
78 ide_hwif_t *hwif = drive->hwif; 90 ide_hwif_t *hwif = drive->hwif;
@@ -280,6 +292,7 @@ const struct ide_tp_ops default_tp_ops = {
280 .read_altstatus = ide_read_altstatus, 292 .read_altstatus = ide_read_altstatus,
281 .write_devctl = ide_write_devctl, 293 .write_devctl = ide_write_devctl,
282 294
295 .dev_select = ide_dev_select,
283 .tf_load = ide_tf_load, 296 .tf_load = ide_tf_load,
284 .tf_read = ide_tf_read, 297 .tf_read = ide_tf_read,
285 298
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 6f363a26700d..dfb0ec317fa3 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -29,17 +29,7 @@
29 29
30void SELECT_DRIVE(ide_drive_t *drive) 30void SELECT_DRIVE(ide_drive_t *drive)
31{ 31{
32 ide_hwif_t *hwif = drive->hwif; 32 drive->hwif->tp_ops->dev_select(drive);
33 const struct ide_port_ops *port_ops = hwif->port_ops;
34 struct ide_cmd cmd;
35
36 if (port_ops && port_ops->selectproc)
37 port_ops->selectproc(drive);
38
39 memset(&cmd, 0, sizeof(cmd));
40 cmd.tf_flags = IDE_TFLAG_OUT_DEVICE;
41
42 drive->hwif->tp_ops->tf_load(drive, &cmd);
43} 33}
44 34
45void SELECT_MASK(ide_drive_t *drive, int mask) 35void SELECT_MASK(ide_drive_t *drive, int mask)
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index 9f6dff83b141..af1b421eb450 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -98,12 +98,15 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
98 } 98 }
99} 99}
100 100
101static void ns87415_dev_select(ide_drive_t *drive);
102
101static const struct ide_tp_ops superio_tp_ops = { 103static const struct ide_tp_ops superio_tp_ops = {
102 .exec_command = ide_exec_command, 104 .exec_command = ide_exec_command,
103 .read_status = superio_read_status, 105 .read_status = superio_read_status,
104 .read_altstatus = ide_read_altstatus, 106 .read_altstatus = ide_read_altstatus,
105 .write_devctl = ide_write_devctl, 107 .write_devctl = ide_write_devctl,
106 108
109 .dev_select = ns87415_dev_select,
107 .tf_load = ide_tf_load, 110 .tf_load = ide_tf_load,
108 .tf_read = superio_tf_read, 111 .tf_read = superio_tf_read,
109 112
@@ -182,10 +185,12 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
182 local_irq_restore(flags); 185 local_irq_restore(flags);
183} 186}
184 187
185static void ns87415_selectproc (ide_drive_t *drive) 188static void ns87415_dev_select(ide_drive_t *drive)
186{ 189{
187 ns87415_prepare_drive(drive, 190 ns87415_prepare_drive(drive,
188 !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); 191 !!(drive->dev_flags & IDE_DFLAG_USING_DMA));
192
193 outb(drive->select | ATA_DEVICE_OBS, drive->hwif->io_ports.device_addr);
189} 194}
190 195
191static void ns87415_dma_start(ide_drive_t *drive) 196static void ns87415_dma_start(ide_drive_t *drive)
@@ -229,7 +234,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
229 * Also, leave IRQ masked during drive probing, to prevent infinite 234 * Also, leave IRQ masked during drive probing, to prevent infinite
230 * interrupts from a potentially floating INTA.. 235 * interrupts from a potentially floating INTA..
231 * 236 *
232 * IRQs get unmasked in selectproc when drive is first used. 237 * IRQs get unmasked in dev_select() when drive is first used.
233 */ 238 */
234 (void) pci_read_config_dword(dev, 0x40, &ctrl); 239 (void) pci_read_config_dword(dev, 0x40, &ctrl);
235 (void) pci_read_config_byte(dev, 0x09, &progif); 240 (void) pci_read_config_byte(dev, 0x09, &progif);
@@ -281,8 +286,18 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
281 outb(0x60, hwif->dma_base + ATA_DMA_STATUS); 286 outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
282} 287}
283 288
284static const struct ide_port_ops ns87415_port_ops = { 289static const struct ide_tp_ops ns87415_tp_ops = {
285 .selectproc = ns87415_selectproc, 290 .exec_command = ide_exec_command,
291 .read_status = ide_read_status,
292 .read_altstatus = ide_read_altstatus,
293 .write_devctl = ide_write_devctl,
294
295 .dev_select = ns87415_dev_select,
296 .tf_load = ide_tf_load,
297 .tf_read = ide_tf_read,
298
299 .input_data = ide_input_data,
300 .output_data = ide_output_data,
286}; 301};
287 302
288static const struct ide_dma_ops ns87415_dma_ops = { 303static const struct ide_dma_ops ns87415_dma_ops = {
@@ -299,7 +314,7 @@ static const struct ide_dma_ops ns87415_dma_ops = {
299static const struct ide_port_info ns87415_chipset __devinitdata = { 314static const struct ide_port_info ns87415_chipset __devinitdata = {
300 .name = DRV_NAME, 315 .name = DRV_NAME,
301 .init_hwif = init_hwif_ns87415, 316 .init_hwif = init_hwif_ns87415,
302 .port_ops = &ns87415_port_ops, 317 .tp_ops = &ns87415_tp_ops,
303 .dma_ops = &ns87415_dma_ops, 318 .dma_ops = &ns87415_dma_ops,
304 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | 319 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
305 IDE_HFLAG_NO_ATAPI_DMA, 320 IDE_HFLAG_NO_ATAPI_DMA,
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index 7aa45ea37eeb..24ce1f805cd7 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -404,8 +404,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
404#define IDE_WAKEUP_DELAY (1*HZ) 404#define IDE_WAKEUP_DELAY (1*HZ)
405 405
406static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); 406static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *);
407static void pmac_ide_selectproc(ide_drive_t *drive);
408static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
409 407
410#define PMAC_IDE_REG(x) \ 408#define PMAC_IDE_REG(x) \
411 ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x))) 409 ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x)))
@@ -415,8 +413,7 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
415 * timing register when selecting that unit. This version is for 413 * timing register when selecting that unit. This version is for
416 * ASICs with a single timing register 414 * ASICs with a single timing register
417 */ 415 */
418static void 416static void pmac_ide_apply_timings(ide_drive_t *drive)
419pmac_ide_selectproc(ide_drive_t *drive)
420{ 417{
421 ide_hwif_t *hwif = drive->hwif; 418 ide_hwif_t *hwif = drive->hwif;
422 pmac_ide_hwif_t *pmif = 419 pmac_ide_hwif_t *pmif =
@@ -434,8 +431,7 @@ pmac_ide_selectproc(ide_drive_t *drive)
434 * timing register when selecting that unit. This version is for 431 * timing register when selecting that unit. This version is for
435 * ASICs with a dual timing register (Kauai) 432 * ASICs with a dual timing register (Kauai)
436 */ 433 */
437static void 434static void pmac_ide_kauai_apply_timings(ide_drive_t *drive)
438pmac_ide_kauai_selectproc(ide_drive_t *drive)
439{ 435{
440 ide_hwif_t *hwif = drive->hwif; 436 ide_hwif_t *hwif = drive->hwif;
441 pmac_ide_hwif_t *pmif = 437 pmac_ide_hwif_t *pmif =
@@ -464,9 +460,25 @@ pmac_ide_do_update_timings(ide_drive_t *drive)
464 if (pmif->kind == controller_sh_ata6 || 460 if (pmif->kind == controller_sh_ata6 ||
465 pmif->kind == controller_un_ata6 || 461 pmif->kind == controller_un_ata6 ||
466 pmif->kind == controller_k2_ata6) 462 pmif->kind == controller_k2_ata6)
467 pmac_ide_kauai_selectproc(drive); 463 pmac_ide_kauai_apply_timings(drive);
468 else 464 else
469 pmac_ide_selectproc(drive); 465 pmac_ide_apply_timings(drive);
466}
467
468static void pmac_dev_select(ide_drive_t *drive)
469{
470 pmac_ide_apply_timings(drive);
471
472 writeb(drive->select | ATA_DEVICE_OBS,
473 (void __iomem *)drive->hwif->io_ports.device_addr);
474}
475
476static void pmac_kauai_dev_select(ide_drive_t *drive)
477{
478 pmac_ide_kauai_apply_timings(drive);
479
480 writeb(drive->select | ATA_DEVICE_OBS,
481 (void __iomem *)drive->hwif->io_ports.device_addr);
470} 482}
471 483
472static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd) 484static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd)
@@ -947,6 +959,7 @@ static const struct ide_tp_ops pmac_tp_ops = {
947 .read_altstatus = ide_read_altstatus, 959 .read_altstatus = ide_read_altstatus,
948 .write_devctl = pmac_write_devctl, 960 .write_devctl = pmac_write_devctl,
949 961
962 .dev_select = pmac_dev_select,
950 .tf_load = ide_tf_load, 963 .tf_load = ide_tf_load,
951 .tf_read = ide_tf_read, 964 .tf_read = ide_tf_read,
952 965
@@ -954,19 +967,24 @@ static const struct ide_tp_ops pmac_tp_ops = {
954 .output_data = ide_output_data, 967 .output_data = ide_output_data,
955}; 968};
956 969
957static const struct ide_port_ops pmac_ide_ata6_port_ops = { 970static const struct ide_tp_ops pmac_ata6_tp_ops = {
958 .init_dev = pmac_ide_init_dev, 971 .exec_command = pmac_exec_command,
959 .set_pio_mode = pmac_ide_set_pio_mode, 972 .read_status = ide_read_status,
960 .set_dma_mode = pmac_ide_set_dma_mode, 973 .read_altstatus = ide_read_altstatus,
961 .selectproc = pmac_ide_kauai_selectproc, 974 .write_devctl = pmac_write_devctl,
962 .cable_detect = pmac_ide_cable_detect, 975
976 .dev_select = pmac_kauai_dev_select,
977 .tf_load = ide_tf_load,
978 .tf_read = ide_tf_read,
979
980 .input_data = ide_input_data,
981 .output_data = ide_output_data,
963}; 982};
964 983
965static const struct ide_port_ops pmac_ide_ata4_port_ops = { 984static const struct ide_port_ops pmac_ide_ata4_port_ops = {
966 .init_dev = pmac_ide_init_dev, 985 .init_dev = pmac_ide_init_dev,
967 .set_pio_mode = pmac_ide_set_pio_mode, 986 .set_pio_mode = pmac_ide_set_pio_mode,
968 .set_dma_mode = pmac_ide_set_dma_mode, 987 .set_dma_mode = pmac_ide_set_dma_mode,
969 .selectproc = pmac_ide_selectproc,
970 .cable_detect = pmac_ide_cable_detect, 988 .cable_detect = pmac_ide_cable_detect,
971}; 989};
972 990
@@ -974,7 +992,6 @@ static const struct ide_port_ops pmac_ide_port_ops = {
974 .init_dev = pmac_ide_init_dev, 992 .init_dev = pmac_ide_init_dev,
975 .set_pio_mode = pmac_ide_set_pio_mode, 993 .set_pio_mode = pmac_ide_set_pio_mode,
976 .set_dma_mode = pmac_ide_set_dma_mode, 994 .set_dma_mode = pmac_ide_set_dma_mode,
977 .selectproc = pmac_ide_selectproc,
978}; 995};
979 996
980static const struct ide_dma_ops pmac_dma_ops; 997static const struct ide_dma_ops pmac_dma_ops;
@@ -1011,15 +1028,18 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1011 pmif->broken_dma = pmif->broken_dma_warn = 0; 1028 pmif->broken_dma = pmif->broken_dma_warn = 0;
1012 if (of_device_is_compatible(np, "shasta-ata")) { 1029 if (of_device_is_compatible(np, "shasta-ata")) {
1013 pmif->kind = controller_sh_ata6; 1030 pmif->kind = controller_sh_ata6;
1014 d.port_ops = &pmac_ide_ata6_port_ops; 1031 d.tp_ops = &pmac_ata6_tp_ops;
1032 d.port_ops = &pmac_ide_ata4_port_ops;
1015 d.udma_mask = ATA_UDMA6; 1033 d.udma_mask = ATA_UDMA6;
1016 } else if (of_device_is_compatible(np, "kauai-ata")) { 1034 } else if (of_device_is_compatible(np, "kauai-ata")) {
1017 pmif->kind = controller_un_ata6; 1035 pmif->kind = controller_un_ata6;
1018 d.port_ops = &pmac_ide_ata6_port_ops; 1036 d.tp_ops = &pmac_ata6_tp_ops;
1037 d.port_ops = &pmac_ide_ata4_port_ops;
1019 d.udma_mask = ATA_UDMA5; 1038 d.udma_mask = ATA_UDMA5;
1020 } else if (of_device_is_compatible(np, "K2-UATA")) { 1039 } else if (of_device_is_compatible(np, "K2-UATA")) {
1021 pmif->kind = controller_k2_ata6; 1040 pmif->kind = controller_k2_ata6;
1022 d.port_ops = &pmac_ide_ata6_port_ops; 1041 d.tp_ops = &pmac_ata6_tp_ops;
1042 d.port_ops = &pmac_ide_ata4_port_ops;
1023 d.udma_mask = ATA_UDMA5; 1043 d.udma_mask = ATA_UDMA5;
1024 } else if (of_device_is_compatible(np, "keylargo-ata")) { 1044 } else if (of_device_is_compatible(np, "keylargo-ata")) {
1025 if (strcmp(np->name, "ata-4") == 0) { 1045 if (strcmp(np->name, "ata-4") == 0) {
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
index 7fddfd34fcce..d007e7f66598 100644
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -101,6 +101,7 @@ static const struct ide_tp_ops q40ide_tp_ops = {
101 .read_altstatus = ide_read_altstatus, 101 .read_altstatus = ide_read_altstatus,
102 .write_devctl = ide_write_devctl, 102 .write_devctl = ide_write_devctl,
103 103
104 .dev_select = ide_dev_select,
104 .tf_load = ide_tf_load, 105 .tf_load = ide_tf_load,
105 .tf_read = ide_tf_read, 106 .tf_read = ide_tf_read,
106 107
diff --git a/drivers/ide/qd65xx.c b/drivers/ide/qd65xx.c
index 08c4fa35e9b1..c9a134986891 100644
--- a/drivers/ide/qd65xx.c
+++ b/drivers/ide/qd65xx.c
@@ -90,13 +90,15 @@ static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
90 * This routine is invoked to prepare for access to a given drive. 90 * This routine is invoked to prepare for access to a given drive.
91 */ 91 */
92 92
93static void qd65xx_select(ide_drive_t *drive) 93static void qd65xx_dev_select(ide_drive_t *drive)
94{ 94{
95 u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) | 95 u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) |
96 (QD_TIMREG(drive) & 0x02); 96 (QD_TIMREG(drive) & 0x02);
97 97
98 if (timings[index] != QD_TIMING(drive)) 98 if (timings[index] != QD_TIMING(drive))
99 outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); 99 outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive));
100
101 outb(drive->select | ATA_DEVICE_OBS, drive->hwif->io_ports.device_addr);
100} 102}
101 103
102/* 104/*
@@ -309,20 +311,33 @@ static void __init qd6580_init_dev(ide_drive_t *drive)
309 drive->drive_data = (drive->dn & 1) ? t2 : t1; 311 drive->drive_data = (drive->dn & 1) ? t2 : t1;
310} 312}
311 313
314static const struct ide_tp_ops qd65xx_tp_ops = {
315 .exec_command = ide_exec_command,
316 .read_status = ide_read_status,
317 .read_altstatus = ide_read_altstatus,
318 .write_devctl = ide_write_devctl,
319
320 .dev_select = qd65xx_dev_select,
321 .tf_load = ide_tf_load,
322 .tf_read = ide_tf_read,
323
324 .input_data = ide_input_data,
325 .output_data = ide_output_data,
326};
327
312static const struct ide_port_ops qd6500_port_ops = { 328static const struct ide_port_ops qd6500_port_ops = {
313 .init_dev = qd6500_init_dev, 329 .init_dev = qd6500_init_dev,
314 .set_pio_mode = qd6500_set_pio_mode, 330 .set_pio_mode = qd6500_set_pio_mode,
315 .selectproc = qd65xx_select,
316}; 331};
317 332
318static const struct ide_port_ops qd6580_port_ops = { 333static const struct ide_port_ops qd6580_port_ops = {
319 .init_dev = qd6580_init_dev, 334 .init_dev = qd6580_init_dev,
320 .set_pio_mode = qd6580_set_pio_mode, 335 .set_pio_mode = qd6580_set_pio_mode,
321 .selectproc = qd65xx_select,
322}; 336};
323 337
324static const struct ide_port_info qd65xx_port_info __initdata = { 338static const struct ide_port_info qd65xx_port_info __initdata = {
325 .name = DRV_NAME, 339 .name = DRV_NAME,
340 .tp_ops = &qd65xx_tp_ops,
326 .chipset = ide_qd65xx, 341 .chipset = ide_qd65xx,
327 .host_flags = IDE_HFLAG_IO_32BIT | 342 .host_flags = IDE_HFLAG_IO_32BIT |
328 IDE_HFLAG_NO_DMA, 343 IDE_HFLAG_NO_DMA,
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 97f8e0ef21b1..6d8dbd9c10bc 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -825,6 +825,7 @@ static const struct ide_tp_ops scc_tp_ops = {
825 .read_altstatus = scc_read_altstatus, 825 .read_altstatus = scc_read_altstatus,
826 .write_devctl = scc_write_devctl, 826 .write_devctl = scc_write_devctl,
827 827
828 .dev_select = ide_dev_select,
828 .tf_load = scc_tf_load, 829 .tf_load = scc_tf_load,
829 .tf_read = scc_tf_read, 830 .tf_read = scc_tf_read,
830 831
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index 58980fcafc3b..e5d2a48a84de 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -505,6 +505,7 @@ static const struct ide_tp_ops sgiioc4_tp_ops = {
505 .read_altstatus = ide_read_altstatus, 505 .read_altstatus = ide_read_altstatus,
506 .write_devctl = ide_write_devctl, 506 .write_devctl = ide_write_devctl,
507 507
508 .dev_select = ide_dev_select,
508 .tf_load = ide_tf_load, 509 .tf_load = ide_tf_load,
509 .tf_read = ide_tf_read, 510 .tf_read = ide_tf_read,
510 511
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c
index c0528f27fcae..4b42ca091534 100644
--- a/drivers/ide/trm290.c
+++ b/drivers/ide/trm290.c
@@ -171,9 +171,11 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
171 local_irq_restore(flags); 171 local_irq_restore(flags);
172} 172}
173 173
174static void trm290_selectproc (ide_drive_t *drive) 174static void trm290_dev_select(ide_drive_t *drive)
175{ 175{
176 trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); 176 trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA));
177
178 outb(drive->select | ATA_DEVICE_OBS, drive->hwif->io_ports.device_addr);
177} 179}
178 180
179static int trm290_dma_check(ide_drive_t *drive, struct ide_cmd *cmd) 181static int trm290_dma_check(ide_drive_t *drive, struct ide_cmd *cmd)
@@ -298,8 +300,18 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
298#endif 300#endif
299} 301}
300 302
301static const struct ide_port_ops trm290_port_ops = { 303static const struct ide_tp_ops trm290_tp_ops = {
302 .selectproc = trm290_selectproc, 304 .exec_command = ide_exec_command,
305 .read_status = ide_read_status,
306 .read_altstatus = ide_read_altstatus,
307 .write_devctl = ide_write_devctl,
308
309 .dev_select = trm290_dev_select,
310 .tf_load = ide_tf_load,
311 .tf_read = ide_tf_read,
312
313 .input_data = ide_input_data,
314 .output_data = ide_output_data,
303}; 315};
304 316
305static struct ide_dma_ops trm290_dma_ops = { 317static struct ide_dma_ops trm290_dma_ops = {
@@ -315,7 +327,7 @@ static struct ide_dma_ops trm290_dma_ops = {
315static const struct ide_port_info trm290_chipset __devinitdata = { 327static const struct ide_port_info trm290_chipset __devinitdata = {
316 .name = DRV_NAME, 328 .name = DRV_NAME,
317 .init_hwif = init_hwif_trm290, 329 .init_hwif = init_hwif_trm290,
318 .port_ops = &trm290_port_ops, 330 .tp_ops = &trm290_tp_ops,
319 .dma_ops = &trm290_dma_ops, 331 .dma_ops = &trm290_dma_ops,
320 .host_flags = IDE_HFLAG_TRM290 | 332 .host_flags = IDE_HFLAG_TRM290 |
321 IDE_HFLAG_NO_ATAPI_DMA | 333 IDE_HFLAG_NO_ATAPI_DMA |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index be391b615963..4cb79c4c2604 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -189,6 +189,7 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
189 .read_altstatus = ide_read_altstatus, 189 .read_altstatus = ide_read_altstatus,
190 .write_devctl = ide_write_devctl, 190 .write_devctl = ide_write_devctl,
191 191
192 .dev_select = ide_dev_select,
192 .tf_load = tx4938ide_tf_load, 193 .tf_load = tx4938ide_tf_load,
193 .tf_read = tx4938ide_tf_read, 194 .tf_read = tx4938ide_tf_read,
194 195
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 5a614d1c94f1..0040a9a3e26e 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -429,7 +429,7 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive)
429 * Fix ATA100 CORE System Control Register. (The write to the 429 * Fix ATA100 CORE System Control Register. (The write to the
430 * Device/Head register may write wrong data to the System 430 * Device/Head register may write wrong data to the System
431 * Control Register) 431 * Control Register)
432 * While Sys_Ctl is written here, selectproc is not needed. 432 * While Sys_Ctl is written here, dev_select() is not needed.
433 */ 433 */
434 tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); 434 tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl);
435} 435}
@@ -556,6 +556,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
556 .read_altstatus = ide_read_altstatus, 556 .read_altstatus = ide_read_altstatus,
557 .write_devctl = ide_write_devctl, 557 .write_devctl = ide_write_devctl,
558 558
559 .dev_select = ide_dev_select,
559 .tf_load = tx4939ide_tf_load, 560 .tf_load = tx4939ide_tf_load,
560 .tf_read = tx4939ide_tf_read, 561 .tf_read = tx4939ide_tf_read,
561 562
@@ -579,6 +580,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
579 .read_altstatus = ide_read_altstatus, 580 .read_altstatus = ide_read_altstatus,
580 .write_devctl = ide_write_devctl, 581 .write_devctl = ide_write_devctl,
581 582
583 .dev_select = ide_dev_select,
582 .tf_load = tx4939ide_tf_load, 584 .tf_load = tx4939ide_tf_load,
583 .tf_read = ide_tf_read, 585 .tf_read = ide_tf_read,
584 586
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e919c865f0c7..c69181c61fd8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -603,7 +603,7 @@ struct ide_drive_s {
603 603
604 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 604 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
605 unsigned int cyl; /* "real" number of cyls */ 605 unsigned int cyl; /* "real" number of cyls */
606 unsigned int drive_data; /* used by set_pio_mode/selectproc */ 606 unsigned int drive_data; /* used by set_pio_mode/dev_select() */
607 unsigned int failures; /* current failure count */ 607 unsigned int failures; /* current failure count */
608 unsigned int max_failures; /* maximum allowed failure count */ 608 unsigned int max_failures; /* maximum allowed failure count */
609 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 609 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -661,6 +661,7 @@ struct ide_tp_ops {
661 u8 (*read_altstatus)(struct hwif_s *); 661 u8 (*read_altstatus)(struct hwif_s *);
662 void (*write_devctl)(struct hwif_s *, u8); 662 void (*write_devctl)(struct hwif_s *, u8);
663 663
664 void (*dev_select)(ide_drive_t *);
664 void (*tf_load)(ide_drive_t *, struct ide_cmd *); 665 void (*tf_load)(ide_drive_t *, struct ide_cmd *);
665 void (*tf_read)(ide_drive_t *, struct ide_cmd *); 666 void (*tf_read)(ide_drive_t *, struct ide_cmd *);
666 667
@@ -678,7 +679,6 @@ extern const struct ide_tp_ops default_tp_ops;
678 * @init_dev: host specific initialization of a device 679 * @init_dev: host specific initialization of a device
679 * @set_pio_mode: routine to program host for PIO mode 680 * @set_pio_mode: routine to program host for PIO mode
680 * @set_dma_mode: routine to program host for DMA mode 681 * @set_dma_mode: routine to program host for DMA mode
681 * @selectproc: tweaks hardware to select drive
682 * @reset_poll: chipset polling based on hba specifics 682 * @reset_poll: chipset polling based on hba specifics
683 * @pre_reset: chipset specific changes to default for device-hba resets 683 * @pre_reset: chipset specific changes to default for device-hba resets
684 * @resetproc: routine to reset controller after a disk reset 684 * @resetproc: routine to reset controller after a disk reset
@@ -695,7 +695,6 @@ struct ide_port_ops {
695 void (*init_dev)(ide_drive_t *); 695 void (*init_dev)(ide_drive_t *);
696 void (*set_pio_mode)(ide_drive_t *, const u8); 696 void (*set_pio_mode)(ide_drive_t *, const u8);
697 void (*set_dma_mode)(ide_drive_t *, const u8); 697 void (*set_dma_mode)(ide_drive_t *, const u8);
698 void (*selectproc)(ide_drive_t *);
699 int (*reset_poll)(ide_drive_t *); 698 int (*reset_poll)(ide_drive_t *);
700 void (*pre_reset)(ide_drive_t *); 699 void (*pre_reset)(ide_drive_t *);
701 void (*resetproc)(ide_drive_t *); 700 void (*resetproc)(ide_drive_t *);
@@ -1170,6 +1169,7 @@ u8 ide_read_status(ide_hwif_t *);
1170u8 ide_read_altstatus(ide_hwif_t *); 1169u8 ide_read_altstatus(ide_hwif_t *);
1171void ide_write_devctl(ide_hwif_t *, u8); 1170void ide_write_devctl(ide_hwif_t *, u8);
1172 1171
1172void ide_dev_select(ide_drive_t *);
1173void ide_tf_load(ide_drive_t *, struct ide_cmd *); 1173void ide_tf_load(ide_drive_t *, struct ide_cmd *);
1174void ide_tf_read(ide_drive_t *, struct ide_cmd *); 1174void ide_tf_read(ide_drive_t *, struct ide_cmd *);
1175 1175