aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/Makefile2
-rw-r--r--drivers/ide/legacy/ali14xx.c10
-rw-r--r--drivers/ide/legacy/dtc2278.c6
-rw-r--r--drivers/ide/legacy/ht6560b.c11
-rw-r--r--drivers/ide/legacy/ide_platform.c182
-rw-r--r--drivers/ide/legacy/qd65xx.c60
-rw-r--r--drivers/ide/legacy/umc8672.c7
7 files changed, 231 insertions, 47 deletions
diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile
index c7971061767e..409822349f10 100644
--- a/drivers/ide/legacy/Makefile
+++ b/drivers/ide/legacy/Makefile
@@ -7,6 +7,8 @@ obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o
7 7
8obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o 8obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o
9 9
10obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o
11
10# Last of all 12# Last of all
11obj-$(CONFIG_BLK_DEV_HD) += hd.o 13obj-$(CONFIG_BLK_DEV_HD) += hd.o
12 14
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 9b9c4761cb7d..2f0ef9b44033 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -68,8 +68,6 @@ static RegInitializer initData[] __initdata = {
68 {0x35, 0x03}, {0x00, 0x00} 68 {0x35, 0x03}, {0x00, 0x00}
69}; 69};
70 70
71#define ALI_MAX_PIO 4
72
73/* timing parameter registers for each drive */ 71/* timing parameter registers for each drive */
74static struct { u8 reg1, reg2, reg3, reg4; } regTab[4] = { 72static struct { u8 reg1, reg2, reg3, reg4; } regTab[4] = {
75 {0x03, 0x26, 0x04, 0x27}, /* drive 0 */ 73 {0x03, 0x26, 0x04, 0x27}, /* drive 0 */
@@ -109,7 +107,7 @@ static void outReg (u8 data, u8 reg)
109 * This function computes timing parameters 107 * This function computes timing parameters
110 * and sets controller registers accordingly. 108 * and sets controller registers accordingly.
111 */ 109 */
112static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio) 110static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
113{ 111{
114 int driveNum; 112 int driveNum;
115 int time1, time2; 113 int time1, time2;
@@ -117,8 +115,6 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
117 unsigned long flags; 115 unsigned long flags;
118 int bus_speed = system_bus_clock(); 116 int bus_speed = system_bus_clock();
119 117
120 pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO);
121
122 /* calculate timing, according to PIO mode */ 118 /* calculate timing, according to PIO mode */
123 time1 = ide_pio_cycle_time(drive, pio); 119 time1 = ide_pio_cycle_time(drive, pio);
124 time2 = ide_pio_timings[pio].active_time; 120 time2 = ide_pio_timings[pio].active_time;
@@ -212,12 +208,12 @@ static int __init ali14xx_probe(void)
212 208
213 hwif->chipset = ide_ali14xx; 209 hwif->chipset = ide_ali14xx;
214 hwif->pio_mask = ATA_PIO4; 210 hwif->pio_mask = ATA_PIO4;
215 hwif->tuneproc = &ali14xx_tune_drive; 211 hwif->set_pio_mode = &ali14xx_set_pio_mode;
216 hwif->mate = mate; 212 hwif->mate = mate;
217 213
218 mate->chipset = ide_ali14xx; 214 mate->chipset = ide_ali14xx;
219 mate->pio_mask = ATA_PIO4; 215 mate->pio_mask = ATA_PIO4;
220 mate->tuneproc = &ali14xx_tune_drive; 216 mate->set_pio_mode = &ali14xx_set_pio_mode;
221 mate->mate = hwif; 217 mate->mate = hwif;
222 mate->channel = 1; 218 mate->channel = 1;
223 219
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 6c01d951d074..f16521254867 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -67,12 +67,10 @@ static void sub22 (char b, char c)
67 } 67 }
68} 68}
69 69
70static void tune_dtc2278 (ide_drive_t *drive, u8 pio) 70static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
71{ 71{
72 unsigned long flags; 72 unsigned long flags;
73 73
74 pio = ide_get_best_pio_mode(drive, pio, 4);
75
76 if (pio >= 3) { 74 if (pio >= 3) {
77 spin_lock_irqsave(&ide_lock, flags); 75 spin_lock_irqsave(&ide_lock, flags);
78 /* 76 /*
@@ -124,7 +122,7 @@ static int __init dtc2278_probe(void)
124 hwif->serialized = 1; 122 hwif->serialized = 1;
125 hwif->chipset = ide_dtc2278; 123 hwif->chipset = ide_dtc2278;
126 hwif->pio_mask = ATA_PIO4; 124 hwif->pio_mask = ATA_PIO4;
127 hwif->tuneproc = &tune_dtc2278; 125 hwif->set_pio_mode = &dtc2278_set_pio_mode;
128 hwif->drives[0].no_unmask = 1; 126 hwif->drives[0].no_unmask = 1;
129 hwif->drives[1].no_unmask = 1; 127 hwif->drives[1].no_unmask = 1;
130 hwif->mate = mate; 128 hwif->mate = mate;
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index bfaa2025173b..2e5a9cc5c0f7 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -199,7 +199,7 @@ static int __init try_to_init_ht6560b(void)
199 return 1; 199 return 1;
200} 200}
201 201
202static u8 ht_pio2timings(ide_drive_t *drive, u8 pio) 202static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
203{ 203{
204 int active_time, recovery_time; 204 int active_time, recovery_time;
205 int active_cycles, recovery_cycles; 205 int active_cycles, recovery_cycles;
@@ -208,7 +208,6 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)
208 if (pio) { 208 if (pio) {
209 unsigned int cycle_time; 209 unsigned int cycle_time;
210 210
211 pio = ide_get_best_pio_mode(drive, pio, 5);
212 cycle_time = ide_pio_cycle_time(drive, pio); 211 cycle_time = ide_pio_cycle_time(drive, pio);
213 212
214 /* 213 /*
@@ -277,7 +276,7 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
277#endif 276#endif
278} 277}
279 278
280static void tune_ht6560b (ide_drive_t *drive, u8 pio) 279static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
281{ 280{
282 unsigned long flags; 281 unsigned long flags;
283 u8 timing; 282 u8 timing;
@@ -333,15 +332,17 @@ int __init ht6560b_init(void)
333 332
334 hwif->chipset = ide_ht6560b; 333 hwif->chipset = ide_ht6560b;
335 hwif->selectproc = &ht6560b_selectproc; 334 hwif->selectproc = &ht6560b_selectproc;
335 hwif->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
336 hwif->pio_mask = ATA_PIO5; 336 hwif->pio_mask = ATA_PIO5;
337 hwif->tuneproc = &tune_ht6560b; 337 hwif->set_pio_mode = &ht6560b_set_pio_mode;
338 hwif->serialized = 1; /* is this needed? */ 338 hwif->serialized = 1; /* is this needed? */
339 hwif->mate = mate; 339 hwif->mate = mate;
340 340
341 mate->chipset = ide_ht6560b; 341 mate->chipset = ide_ht6560b;
342 mate->selectproc = &ht6560b_selectproc; 342 mate->selectproc = &ht6560b_selectproc;
343 mate->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
343 mate->pio_mask = ATA_PIO5; 344 mate->pio_mask = ATA_PIO5;
344 mate->tuneproc = &tune_ht6560b; 345 mate->set_pio_mode = &ht6560b_set_pio_mode;
345 mate->serialized = 1; /* is this needed? */ 346 mate->serialized = 1; /* is this needed? */
346 mate->mate = hwif; 347 mate->mate = hwif;
347 mate->channel = 1; 348 mate->channel = 1;
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
new file mode 100644
index 000000000000..ccfb9893a467
--- /dev/null
+++ b/drivers/ide/legacy/ide_platform.c
@@ -0,0 +1,182 @@
1/*
2 * Platform IDE driver
3 *
4 * Copyright (C) 2007 MontaVista Software
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/ide.h>
18#include <linux/ioport.h>
19#include <linux/module.h>
20#include <linux/pata_platform.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23
24static struct {
25 void __iomem *plat_ide_mapbase;
26 void __iomem *plat_ide_alt_mapbase;
27 ide_hwif_t *hwif;
28 int index;
29} hwif_prop;
30
31static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
32 void __iomem *ctrl, struct pata_platform_info *pdata, int irq,
33 int mmio)
34{
35 unsigned long port = (unsigned long)base;
36 ide_hwif_t *hwif;
37 int index, i;
38
39 for (index = 0; index < MAX_HWIFS; ++index) {
40 hwif = ide_hwifs + index;
41 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
42 goto found;
43 }
44
45 for (index = 0; index < MAX_HWIFS; ++index) {
46 hwif = ide_hwifs + index;
47 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
48 goto found;
49 }
50
51 return NULL;
52
53found:
54
55 hwif->hw.io_ports[IDE_DATA_OFFSET] = port;
56
57 port += (1 << pdata->ioport_shift);
58 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET;
59 i++, port += (1 << pdata->ioport_shift))
60 hwif->hw.io_ports[i] = port;
61
62 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
63
64 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
65 hwif->hw.irq = hwif->irq = irq;
66
67 hwif->hw.dma = NO_DMA;
68 hwif->hw.chipset = ide_generic;
69
70 if (mmio) {
71 hwif->mmio = 1;
72 default_hwif_mmiops(hwif);
73 }
74
75 hwif_prop.hwif = hwif;
76 hwif_prop.index = index;
77
78 return hwif;
79}
80
81static int __devinit plat_ide_probe(struct platform_device *pdev)
82{
83 struct resource *res_base, *res_alt, *res_irq;
84 ide_hwif_t *hwif;
85 struct pata_platform_info *pdata;
86 int ret = 0;
87 int mmio = 0;
88
89 pdata = pdev->dev.platform_data;
90
91 /* get a pointer to the register memory */
92 res_base = platform_get_resource(pdev, IORESOURCE_IO, 0);
93 res_alt = platform_get_resource(pdev, IORESOURCE_IO, 1);
94
95 if (!res_base || !res_alt) {
96 res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
97 res_alt = platform_get_resource(pdev, IORESOURCE_MEM, 1);
98 if (!res_base || !res_alt) {
99 ret = -ENOMEM;
100 goto out;
101 }
102 mmio = 1;
103 }
104
105 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
106 if (!res_irq) {
107 ret = -EINVAL;
108 goto out;
109 }
110
111 if (mmio) {
112 hwif_prop.plat_ide_mapbase = devm_ioremap(&pdev->dev,
113 res_base->start, res_base->end - res_base->start + 1);
114 hwif_prop.plat_ide_alt_mapbase = devm_ioremap(&pdev->dev,
115 res_alt->start, res_alt->end - res_alt->start + 1);
116 } else {
117 hwif_prop.plat_ide_mapbase = devm_ioport_map(&pdev->dev,
118 res_base->start, res_base->end - res_base->start + 1);
119 hwif_prop.plat_ide_alt_mapbase = devm_ioport_map(&pdev->dev,
120 res_alt->start, res_alt->end - res_alt->start + 1);
121 }
122
123 hwif = plat_ide_locate_hwif(hwif_prop.plat_ide_mapbase,
124 hwif_prop.plat_ide_alt_mapbase, pdata, res_irq->start, mmio);
125
126 if (!hwif) {
127 ret = -ENODEV;
128 goto out;
129 }
130 hwif->gendev.parent = &pdev->dev;
131 hwif->noprobe = 0;
132
133 probe_hwif_init(hwif);
134
135 platform_set_drvdata(pdev, hwif);
136 ide_proc_register_port(hwif);
137
138 return 0;
139
140out:
141 return ret;
142}
143
144static int __devexit plat_ide_remove(struct platform_device *pdev)
145{
146 ide_hwif_t *hwif = pdev->dev.driver_data;
147
148 if (hwif != hwif_prop.hwif) {
149 dev_printk(KERN_DEBUG, &pdev->dev, "%s: hwif value error",
150 pdev->name);
151 } else {
152 ide_unregister(hwif_prop.index);
153 hwif_prop.index = 0;
154 hwif_prop.hwif = NULL;
155 }
156
157 return 0;
158}
159
160static struct platform_driver platform_ide_driver = {
161 .driver = {
162 .name = "pata_platform",
163 },
164 .probe = plat_ide_probe,
165 .remove = __devexit_p(plat_ide_remove),
166};
167
168static int __init platform_ide_init(void)
169{
170 return platform_driver_register(&platform_ide_driver);
171}
172
173static void __exit platform_ide_exit(void)
174{
175 platform_driver_unregister(&platform_ide_driver);
176}
177
178MODULE_DESCRIPTION("Platform IDE driver");
179MODULE_LICENSE("GPL");
180
181module_init(platform_ide_init);
182module_exit(platform_ide_exit);
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 8b87a424094a..0c81d2d0b941 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -224,15 +224,14 @@ static void qd_set_timing (ide_drive_t *drive, u8 timing)
224 printk(KERN_DEBUG "%s: %#x\n", drive->name, timing); 224 printk(KERN_DEBUG "%s: %#x\n", drive->name, timing);
225} 225}
226 226
227/* 227static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio)
228 * qd6500_tune_drive
229 */
230
231static void qd6500_tune_drive (ide_drive_t *drive, u8 pio)
232{ 228{
233 int active_time = 175; 229 int active_time = 175;
234 int recovery_time = 415; /* worst case values from the dos driver */ 230 int recovery_time = 415; /* worst case values from the dos driver */
235 231
232 /*
233 * FIXME: use "pio" value
234 */
236 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time) 235 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)
237 && drive->id->tPIO && (drive->id->field_valid & 0x02) 236 && drive->id->tPIO && (drive->id->field_valid & 0x02)
238 && drive->id->eide_pio >= 240) { 237 && drive->id->eide_pio >= 240) {
@@ -246,11 +245,7 @@ static void qd6500_tune_drive (ide_drive_t *drive, u8 pio)
246 qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); 245 qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time));
247} 246}
248 247
249/* 248static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
250 * qd6580_tune_drive
251 */
252
253static void qd6580_tune_drive (ide_drive_t *drive, u8 pio)
254{ 249{
255 int base = HWIF(drive)->select_data; 250 int base = HWIF(drive)->select_data;
256 unsigned int cycle_time; 251 unsigned int cycle_time;
@@ -258,7 +253,6 @@ static void qd6580_tune_drive (ide_drive_t *drive, u8 pio)
258 int recovery_time = 415; /* worst case values from the dos driver */ 253 int recovery_time = 415; /* worst case values from the dos driver */
259 254
260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { 255 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) {
261 pio = ide_get_best_pio_mode(drive, pio, 4);
262 cycle_time = ide_pio_cycle_time(drive, pio); 256 cycle_time = ide_pio_cycle_time(drive, pio);
263 257
264 switch (pio) { 258 switch (pio) {
@@ -335,8 +329,7 @@ static int __init qd_testreg(int port)
335 */ 329 */
336 330
337static void __init qd_setup(ide_hwif_t *hwif, int base, int config, 331static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
338 unsigned int data0, unsigned int data1, 332 unsigned int data0, unsigned int data1)
339 void (*tuneproc) (ide_drive_t *, u8 pio))
340{ 333{
341 hwif->chipset = ide_qd65xx; 334 hwif->chipset = ide_qd65xx;
342 hwif->channel = hwif->index; 335 hwif->channel = hwif->index;
@@ -347,8 +340,6 @@ static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
347 hwif->drives[0].io_32bit = 340 hwif->drives[0].io_32bit =
348 hwif->drives[1].io_32bit = 1; 341 hwif->drives[1].io_32bit = 1;
349 hwif->pio_mask = ATA_PIO4; 342 hwif->pio_mask = ATA_PIO4;
350 hwif->tuneproc = tuneproc;
351 probe_hwif_init(hwif);
352} 343}
353 344
354/* 345/*
@@ -361,7 +352,7 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
361{ 352{
362 u8 config = hwif->config_data; 353 u8 config = hwif->config_data;
363 int base = hwif->select_data; 354 int base = hwif->select_data;
364 void *tuneproc = (void *) hwif->tuneproc; 355 void *set_pio_mode = (void *)hwif->set_pio_mode;
365 356
366 if (hwif->chipset != ide_qd65xx) 357 if (hwif->chipset != ide_qd65xx)
367 return; 358 return;
@@ -369,12 +360,12 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
369 printk(KERN_NOTICE "%s: back to defaults\n", hwif->name); 360 printk(KERN_NOTICE "%s: back to defaults\n", hwif->name);
370 361
371 hwif->selectproc = NULL; 362 hwif->selectproc = NULL;
372 hwif->tuneproc = NULL; 363 hwif->set_pio_mode = NULL;
373 364
374 if (tuneproc == (void *) qd6500_tune_drive) { 365 if (set_pio_mode == (void *)qd6500_set_pio_mode) {
375 // will do it for both 366 // will do it for both
376 qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 367 qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
377 } else if (tuneproc == (void *) qd6580_tune_drive) { 368 } else if (set_pio_mode == (void *)qd6580_set_pio_mode) {
378 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { 369 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
379 qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 370 qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
380 qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); 371 qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
@@ -424,8 +415,11 @@ static int __init qd_probe(int base)
424 return 1; 415 return 1;
425 } 416 }
426 417
427 qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA, 418 qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA);
428 &qd6500_tune_drive); 419
420 hwif->set_pio_mode = &qd6500_set_pio_mode;
421
422 probe_hwif_init(hwif);
429 423
430 ide_proc_register_port(hwif); 424 ide_proc_register_port(hwif);
431 425
@@ -455,8 +449,12 @@ static int __init qd_probe(int base)
455 printk(KERN_INFO "%s: qd6580: single IDE board\n", 449 printk(KERN_INFO "%s: qd6580: single IDE board\n",
456 hwif->name); 450 hwif->name);
457 qd_setup(hwif, base, config | (control << 8), 451 qd_setup(hwif, base, config | (control << 8),
458 QD6580_DEF_DATA, QD6580_DEF_DATA2, 452 QD6580_DEF_DATA, QD6580_DEF_DATA2);
459 &qd6580_tune_drive); 453
454 hwif->set_pio_mode = &qd6580_set_pio_mode;
455
456 probe_hwif_init(hwif);
457
460 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 458 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
461 459
462 ide_proc_register_port(hwif); 460 ide_proc_register_port(hwif);
@@ -472,11 +470,19 @@ static int __init qd_probe(int base)
472 hwif->name, mate->name); 470 hwif->name, mate->name);
473 471
474 qd_setup(hwif, base, config | (control << 8), 472 qd_setup(hwif, base, config | (control << 8),
475 QD6580_DEF_DATA, QD6580_DEF_DATA, 473 QD6580_DEF_DATA, QD6580_DEF_DATA);
476 &qd6580_tune_drive); 474
475 hwif->set_pio_mode = &qd6580_set_pio_mode;
476
477 probe_hwif_init(hwif);
478
477 qd_setup(mate, base, config | (control << 8), 479 qd_setup(mate, base, config | (control << 8),
478 QD6580_DEF_DATA2, QD6580_DEF_DATA2, 480 QD6580_DEF_DATA2, QD6580_DEF_DATA2);
479 &qd6580_tune_drive); 481
482 mate->set_pio_mode = &qd6580_set_pio_mode;
483
484 probe_hwif_init(mate);
485
480 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 486 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
481 487
482 ide_proc_register_port(hwif); 488 ide_proc_register_port(hwif);
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index d2862e638bc5..1151c92dd531 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -105,12 +105,11 @@ static void umc_set_speeds (u8 speeds[])
105 speeds[0], speeds[1], speeds[2], speeds[3]); 105 speeds[0], speeds[1], speeds[2], speeds[3]);
106} 106}
107 107
108static void tune_umc (ide_drive_t *drive, u8 pio) 108static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
109{ 109{
110 unsigned long flags; 110 unsigned long flags;
111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; 111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup;
112 112
113 pio = ide_get_best_pio_mode(drive, pio, 4);
114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", 113 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n",
115 drive->name, pio, pio_to_umc[pio]); 114 drive->name, pio, pio_to_umc[pio]);
116 spin_lock_irqsave(&ide_lock, flags); 115 spin_lock_irqsave(&ide_lock, flags);
@@ -150,12 +149,12 @@ static int __init umc8672_probe(void)
150 149
151 hwif->chipset = ide_umc8672; 150 hwif->chipset = ide_umc8672;
152 hwif->pio_mask = ATA_PIO4; 151 hwif->pio_mask = ATA_PIO4;
153 hwif->tuneproc = &tune_umc; 152 hwif->set_pio_mode = &umc_set_pio_mode;
154 hwif->mate = mate; 153 hwif->mate = mate;
155 154
156 mate->chipset = ide_umc8672; 155 mate->chipset = ide_umc8672;
157 mate->pio_mask = ATA_PIO4; 156 mate->pio_mask = ATA_PIO4;
158 mate->tuneproc = &tune_umc; 157 mate->set_pio_mode = &umc_set_pio_mode;
159 mate->mate = hwif; 158 mate->mate = hwif;
160 mate->channel = 1; 159 mate->channel = 1;
161 160