aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
commitac95beedf8bc97b24f9540d4da9952f07221c023 (patch)
treec29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/legacy
parent4a27214d7be31e122db4102166f49ec15958e8e9 (diff)
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to 'struct ide_port_ops'. * Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info' and ide_hwif_t. * Update host drivers and core code accordingly. While at it: * Rename ata66_*() cable detect functions to *_cable_detect() to match the standard naming. (Suggested by Sergei Shtylyov) v2: * Fix build for bast-ide. (Noticed by Andrew Morton) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/ali14xx.c7
-rw-r--r--drivers/ide/legacy/dtc2278.c6
-rw-r--r--drivers/ide/legacy/ht6560b.c13
-rw-r--r--drivers/ide/legacy/ide-cs.c6
-rw-r--r--drivers/ide/legacy/qd65xx.c33
-rw-r--r--drivers/ide/legacy/umc8672.c7
6 files changed, 43 insertions, 29 deletions
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 33bb7b87be5d..a940784d5796 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -192,8 +192,13 @@ static int __init initRegisters(void)
192 return t; 192 return t;
193} 193}
194 194
195static const struct ide_port_ops ali14xx_port_ops = {
196 .set_pio_mode = ali14xx_set_pio_mode,
197};
198
195static const struct ide_port_info ali14xx_port_info = { 199static const struct ide_port_info ali14xx_port_info = {
196 .chipset = ide_ali14xx, 200 .chipset = ide_ali14xx,
201 .port_ops = &ali14xx_port_ops,
197 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, 202 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
198 .pio_mask = ATA_PIO4, 203 .pio_mask = ATA_PIO4,
199}; 204};
@@ -224,14 +229,12 @@ static int __init ali14xx_probe(void)
224 hwif = ide_find_port(); 229 hwif = ide_find_port();
225 if (hwif) { 230 if (hwif) {
226 ide_init_port_hw(hwif, &hw[0]); 231 ide_init_port_hw(hwif, &hw[0]);
227 hwif->set_pio_mode = &ali14xx_set_pio_mode;
228 idx[0] = hwif->index; 232 idx[0] = hwif->index;
229 } 233 }
230 234
231 mate = ide_find_port(); 235 mate = ide_find_port();
232 if (mate) { 236 if (mate) {
233 ide_init_port_hw(mate, &hw[1]); 237 ide_init_port_hw(mate, &hw[1]);
234 mate->set_pio_mode = &ali14xx_set_pio_mode;
235 idx[1] = mate->index; 238 idx[1] = mate->index;
236 } 239 }
237 240
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 9c6b3249a004..a14abb2c23ed 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -86,8 +86,13 @@ static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
86 } 86 }
87} 87}
88 88
89static const struct ide_port_ops dtc2278_port_ops = {
90 .set_pio_mode = dtc2278_set_pio_mode,
91};
92
89static const struct ide_port_info dtc2278_port_info __initdata = { 93static const struct ide_port_info dtc2278_port_info __initdata = {
90 .chipset = ide_dtc2278, 94 .chipset = ide_dtc2278,
95 .port_ops = &dtc2278_port_ops,
91 .host_flags = IDE_HFLAG_SERIALIZE | 96 .host_flags = IDE_HFLAG_SERIALIZE |
92 IDE_HFLAG_NO_UNMASK_IRQS | 97 IDE_HFLAG_NO_UNMASK_IRQS |
93 IDE_HFLAG_IO_32BIT | 98 IDE_HFLAG_IO_32BIT |
@@ -134,7 +139,6 @@ static int __init dtc2278_probe(void)
134 hwif = ide_find_port(); 139 hwif = ide_find_port();
135 if (hwif) { 140 if (hwif) {
136 ide_init_port_hw(hwif, &hw[0]); 141 ide_init_port_hw(hwif, &hw[0]);
137 hwif->set_pio_mode = dtc2278_set_pio_mode;
138 idx[0] = hwif->index; 142 idx[0] = hwif->index;
139 } 143 }
140 144
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 60f52f5158c9..9d45ed3bffaa 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -328,8 +328,15 @@ int probe_ht6560b = 0;
328module_param_named(probe, probe_ht6560b, bool, 0); 328module_param_named(probe, probe_ht6560b, bool, 0);
329MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); 329MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
330 330
331static const struct ide_port_ops ht6560b_port_ops = {
332 .port_init_devs = ht6560b_port_init_devs,
333 .set_pio_mode = ht6560b_set_pio_mode,
334 .selectproc = ht6560b_selectproc,
335};
336
331static const struct ide_port_info ht6560b_port_info __initdata = { 337static const struct ide_port_info ht6560b_port_info __initdata = {
332 .chipset = ide_ht6560b, 338 .chipset = ide_ht6560b,
339 .port_ops = &ht6560b_port_ops,
333 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */ 340 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */
334 IDE_HFLAG_NO_DMA | 341 IDE_HFLAG_NO_DMA |
335 IDE_HFLAG_NO_AUTOTUNE | 342 IDE_HFLAG_NO_AUTOTUNE |
@@ -368,18 +375,12 @@ static int __init ht6560b_init(void)
368 hwif = ide_find_port(); 375 hwif = ide_find_port();
369 if (hwif) { 376 if (hwif) {
370 ide_init_port_hw(hwif, &hw[0]); 377 ide_init_port_hw(hwif, &hw[0]);
371 hwif->selectproc = ht6560b_selectproc;
372 hwif->set_pio_mode = ht6560b_set_pio_mode;
373 hwif->port_init_devs = ht6560b_port_init_devs;
374 idx[0] = hwif->index; 378 idx[0] = hwif->index;
375 } 379 }
376 380
377 mate = ide_find_port(); 381 mate = ide_find_port();
378 if (mate) { 382 if (mate) {
379 ide_init_port_hw(mate, &hw[1]); 383 ide_init_port_hw(mate, &hw[1]);
380 mate->selectproc = ht6560b_selectproc;
381 mate->set_pio_mode = ht6560b_set_pio_mode;
382 mate->port_init_devs = ht6560b_port_init_devs;
383 idx[1] = mate->index; 384 idx[1] = mate->index;
384 } 385 }
385 386
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index b97b8d51b3eb..c491850e0f7f 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -143,6 +143,10 @@ static void ide_detach(struct pcmcia_device *link)
143 kfree(link->priv); 143 kfree(link->priv);
144} /* ide_detach */ 144} /* ide_detach */
145 145
146static const struct ide_port_ops idecs_port_ops = {
147 .quirkproc = ide_undecoded_slave,
148};
149
146static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) 150static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle)
147{ 151{
148 ide_hwif_t *hwif; 152 ide_hwif_t *hwif;
@@ -168,7 +172,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
168 ide_init_port_data(hwif, i); 172 ide_init_port_data(hwif, i);
169 173
170 ide_init_port_hw(hwif, &hw); 174 ide_init_port_hw(hwif, &hw);
171 hwif->quirkproc = &ide_undecoded_slave; 175 hwif->port_ops = &idecs_port_ops;
172 176
173 idx[0] = i; 177 idx[0] = i;
174 178
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 6e820c7c5c6b..65f098d15154 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -304,6 +304,18 @@ static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
304 hwif->drives[1].drive_data = t2; 304 hwif->drives[1].drive_data = t2;
305} 305}
306 306
307static const struct ide_port_ops qd6500_port_ops = {
308 .port_init_devs = qd6500_port_init_devs,
309 .set_pio_mode = qd6500_set_pio_mode,
310 .selectproc = qd65xx_select,
311};
312
313static const struct ide_port_ops qd6580_port_ops = {
314 .port_init_devs = qd6580_port_init_devs,
315 .set_pio_mode = qd6580_set_pio_mode,
316 .selectproc = qd65xx_select,
317};
318
307static const struct ide_port_info qd65xx_port_info __initdata = { 319static const struct ide_port_info qd65xx_port_info __initdata = {
308 .chipset = ide_qd65xx, 320 .chipset = ide_qd65xx,
309 .host_flags = IDE_HFLAG_IO_32BIT | 321 .host_flags = IDE_HFLAG_IO_32BIT |
@@ -361,6 +373,7 @@ static int __init qd_probe(int base)
361 printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", 373 printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n",
362 config, QD_ID3); 374 config, QD_ID3);
363 375
376 d.port_ops = &qd6500_port_ops;
364 d.host_flags |= IDE_HFLAG_SINGLE; 377 d.host_flags |= IDE_HFLAG_SINGLE;
365 378
366 hwif = ide_find_port_slot(&d); 379 hwif = ide_find_port_slot(&d);
@@ -371,10 +384,6 @@ static int __init qd_probe(int base)
371 384
372 hwif->config_data = (base << 8) | config; 385 hwif->config_data = (base << 8) | config;
373 386
374 hwif->port_init_devs = qd6500_port_init_devs;
375 hwif->set_pio_mode = qd6500_set_pio_mode;
376 hwif->selectproc = qd65xx_select;
377
378 idx[unit] = hwif->index; 387 idx[unit] = hwif->index;
379 388
380 ide_device_add(idx, &d); 389 ide_device_add(idx, &d);
@@ -400,6 +409,8 @@ static int __init qd_probe(int base)
400 409
401 outb(QD_DEF_CONTR, QD_CONTROL_PORT); 410 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
402 411
412 d.port_ops = &qd6580_port_ops;
413
403 if (control & QD_CONTR_SEC_DISABLED) { 414 if (control & QD_CONTR_SEC_DISABLED) {
404 /* secondary disabled */ 415 /* secondary disabled */
405 416
@@ -415,10 +426,6 @@ static int __init qd_probe(int base)
415 426
416 hwif->config_data = (base << 8) | config; 427 hwif->config_data = (base << 8) | config;
417 428
418 hwif->port_init_devs = qd6580_port_init_devs;
419 hwif->set_pio_mode = qd6580_set_pio_mode;
420 hwif->selectproc = qd65xx_select;
421
422 idx[unit] = hwif->index; 429 idx[unit] = hwif->index;
423 430
424 ide_device_add(idx, &d); 431 ide_device_add(idx, &d);
@@ -433,24 +440,16 @@ static int __init qd_probe(int base)
433 hwif = ide_find_port(); 440 hwif = ide_find_port();
434 if (hwif) { 441 if (hwif) {
435 ide_init_port_hw(hwif, &hw[0]); 442 ide_init_port_hw(hwif, &hw[0]);
436 hwif->config_data = (base << 8) | config;
437 hwif->port_init_devs = qd6580_port_init_devs;
438 hwif->set_pio_mode = qd6580_set_pio_mode;
439 hwif->selectproc = qd65xx_select;
440 idx[0] = hwif->index; 443 idx[0] = hwif->index;
441 } 444 }
442 445
443 mate = ide_find_port(); 446 mate = ide_find_port();
444 if (mate) { 447 if (mate) {
445 ide_init_port_hw(mate, &hw[1]); 448 ide_init_port_hw(mate, &hw[1]);
446 mate->config_data = (base << 8) | config;
447 mate->port_init_devs = qd6580_port_init_devs;
448 mate->set_pio_mode = qd6580_set_pio_mode;
449 mate->selectproc = qd65xx_select;
450 idx[1] = mate->index; 449 idx[1] = mate->index;
451 } 450 }
452 451
453 ide_device_add(idx, &qd65xx_port_info); 452 ide_device_add(idx, &d);
454 453
455 return 0; /* no other qd65xx possible */ 454 return 0; /* no other qd65xx possible */
456 } 455 }
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 4d90badd2bda..757156060a6b 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -120,8 +120,13 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
120 spin_unlock_irqrestore(&ide_lock, flags); 120 spin_unlock_irqrestore(&ide_lock, flags);
121} 121}
122 122
123static const struct ide_port_ops umc8672_port_ops = {
124 .set_pio_mode = umc_set_pio_mode,
125};
126
123static const struct ide_port_info umc8672_port_info __initdata = { 127static const struct ide_port_info umc8672_port_info __initdata = {
124 .chipset = ide_umc8672, 128 .chipset = ide_umc8672,
129 .port_ops = &umc8672_port_ops,
125 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, 130 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
126 .pio_mask = ATA_PIO4, 131 .pio_mask = ATA_PIO4,
127}; 132};
@@ -161,14 +166,12 @@ static int __init umc8672_probe(void)
161 hwif = ide_find_port(); 166 hwif = ide_find_port();
162 if (hwif) { 167 if (hwif) {
163 ide_init_port_hw(hwif, &hw[0]); 168 ide_init_port_hw(hwif, &hw[0]);
164 hwif->set_pio_mode = umc_set_pio_mode;
165 idx[0] = hwif->index; 169 idx[0] = hwif->index;
166 } 170 }
167 171
168 mate = ide_find_port(); 172 mate = ide_find_port();
169 if (mate) { 173 if (mate) {
170 ide_init_port_hw(mate, &hw[1]); 174 ide_init_port_hw(mate, &hw[1]);
171 mate->set_pio_mode = umc_set_pio_mode;
172 idx[1] = mate->index; 175 idx[1] = mate->index;
173 } 176 }
174 177