aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
commitc413b9b94d9a8e7548cc4b2e04b7df0439ce76fd (patch)
tree5d23110a0d1f87ad0c88fb1746194e532808eaab /drivers/ide/legacy
parent1ebf74936b1fccb5b65940f99ccddd74ec4d1fef (diff)
ide: add struct ide_port_info instances to legacy host drivers
* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma(). * Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version. * Add 'const struct ide_port_info *d' argument to ide_device_add[_all](). * Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(), move it to ide-probe.c and call it in in ide_device_add_all() instead of ide_pci_setup_ports(). * Move ->mate setup to ide_device_add_all() from ide_port_init(). * Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable ->autotune currently. * Setup hwif->chipset in ide_init_port() but iff pi->chipset is set (to not override setup done by ide_hwif_configure()). * Add ETRAX host handling to ide_device_add_all(). * cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n. * pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks setup to pmac_ide_setup_device(). * Add 'struct ide_port_info' instances to legacy host drivers, pass them to ide_device_add() calls and then remove open-coded ports initialization. Reviewed-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.c24
-rw-r--r--drivers/ide/legacy/buddha.c2
-rw-r--r--drivers/ide/legacy/dtc2278.c24
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c22
-rw-r--r--drivers/ide/legacy/ide_platform.c2
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/legacy/qd65xx.c23
-rw-r--r--drivers/ide/legacy/umc8672.c24
11 files changed, 57 insertions, 72 deletions
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index e3ea2096804a..d4d1a6bea599 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -191,9 +191,14 @@ static int __init initRegisters (void) {
191 return t; 191 return t;
192} 192}
193 193
194static const struct ide_port_info ali14xx_port_info = {
195 .chipset = ide_ali14xx,
196 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
197 .pio_mask = ATA_PIO4,
198};
199
194static int __init ali14xx_probe(void) 200static int __init ali14xx_probe(void)
195{ 201{
196 ide_hwif_t *hwif, *mate;
197 static u8 idx[4] = { 0, 1, 0xff, 0xff }; 202 static u8 idx[4] = { 0, 1, 0xff, 0xff };
198 203
199 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", 204 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
@@ -205,21 +210,10 @@ static int __init ali14xx_probe(void)
205 return 1; 210 return 1;
206 } 211 }
207 212
208 hwif = &ide_hwifs[0]; 213 ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode;
209 mate = &ide_hwifs[1]; 214 ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode;
210
211 hwif->chipset = ide_ali14xx;
212 hwif->pio_mask = ATA_PIO4;
213 hwif->set_pio_mode = &ali14xx_set_pio_mode;
214 hwif->mate = mate;
215
216 mate->chipset = ide_ali14xx;
217 mate->pio_mask = ATA_PIO4;
218 mate->set_pio_mode = &ali14xx_set_pio_mode;
219 mate->mate = hwif;
220 mate->channel = 1;
221 215
222 ide_device_add(idx); 216 ide_device_add(idx, &ali14xx_port_info);
223 217
224 return 0; 218 return 0;
225} 219}
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index dd3d198ade47..8bdb79da17e8 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -232,7 +232,7 @@ fail_base2:
232 } 232 }
233 } 233 }
234 234
235 ide_device_add(idx); 235 ide_device_add(idx, NULL);
236 } 236 }
237 237
238 return 0; 238 return 0;
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 092c04abbe7a..7cbf2f1f35f9 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -86,6 +86,15 @@ static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
86 } 86 }
87} 87}
88 88
89static const struct ide_port_info dtc2278_port_info __initdata = {
90 .chipset = ide_dtc2278,
91 .host_flags = IDE_HFLAG_SERIALIZE |
92 IDE_HFLAG_IO_32BIT |
93 IDE_HFLAG_NO_DMA |
94 IDE_HFLAG_NO_AUTOTUNE,
95 .pio_mask = ATA_PIO4,
96};
97
89static int __init dtc2278_probe(void) 98static int __init dtc2278_probe(void)
90{ 99{
91 unsigned long flags; 100 unsigned long flags;
@@ -116,29 +125,16 @@ static int __init dtc2278_probe(void)
116#endif 125#endif
117 local_irq_restore(flags); 126 local_irq_restore(flags);
118 127
119 hwif->serialized = 1;
120 hwif->no_io_32bit = 1; /* disallow ->io_32bit changes */ 128 hwif->no_io_32bit = 1; /* disallow ->io_32bit changes */
121 hwif->chipset = ide_dtc2278;
122 hwif->pio_mask = ATA_PIO4;
123 hwif->set_pio_mode = &dtc2278_set_pio_mode; 129 hwif->set_pio_mode = &dtc2278_set_pio_mode;
124 hwif->drives[0].no_unmask = 1; 130 hwif->drives[0].no_unmask = 1;
125 hwif->drives[1].no_unmask = 1; 131 hwif->drives[1].no_unmask = 1;
126 hwif->drives[0].io_32bit = 1;
127 hwif->drives[1].io_32bit = 1;
128 hwif->mate = mate;
129 132
130 mate->serialized = 1;
131 mate->no_io_32bit = 1; 133 mate->no_io_32bit = 1;
132 mate->chipset = ide_dtc2278;
133 mate->pio_mask = ATA_PIO4;
134 mate->drives[0].no_unmask = 1; 134 mate->drives[0].no_unmask = 1;
135 mate->drives[1].no_unmask = 1; 135 mate->drives[1].no_unmask = 1;
136 mate->drives[0].io_32bit = 1;
137 mate->drives[1].io_32bit = 1;
138 mate->mate = hwif;
139 mate->channel = 1;
140 136
141 ide_device_add(idx); 137 ide_device_add(idx, &dtc2278_port_info);
142 138
143 return 0; 139 return 0;
144} 140}
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index c9bd6bfb1f3b..85b69a82825f 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -83,7 +83,7 @@ static int __init falconide_init(void)
83 ide_init_port_data(hwif, index); 83 ide_init_port_data(hwif, index);
84 ide_init_port_hw(hwif, &hw); 84 ide_init_port_hw(hwif, &hw);
85 85
86 ide_device_add(idx); 86 ide_device_add(idx, NULL);
87 } 87 }
88 } 88 }
89 89
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index f67c51a2c84a..fc29ce75aff1 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -186,7 +186,7 @@ found:
186 release_mem_region(res_start, res_n); 186 release_mem_region(res_start, res_n);
187 } 187 }
188 188
189 ide_device_add(idx); 189 ide_device_add(idx, NULL);
190 190
191 return 0; 191 return 0;
192} 192}
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 57bc15cddca0..a89cd80d8124 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -305,6 +305,15 @@ int probe_ht6560b = 0;
305module_param_named(probe, probe_ht6560b, bool, 0); 305module_param_named(probe, probe_ht6560b, bool, 0);
306MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); 306MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
307 307
308static const struct ide_port_info ht6560b_port_info __initdata = {
309 .chipset = ide_ht6560b,
310 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */
311 IDE_HFLAG_NO_DMA |
312 IDE_HFLAG_NO_AUTOTUNE |
313 IDE_HFLAG_ABUSE_PREFETCH,
314 .pio_mask = ATA_PIO5,
315};
316
308static int __init ht6560b_init(void) 317static int __init ht6560b_init(void)
309{ 318{
310 ide_hwif_t *hwif, *mate; 319 ide_hwif_t *hwif, *mate;
@@ -328,22 +337,11 @@ static int __init ht6560b_init(void)
328 goto release_region; 337 goto release_region;
329 } 338 }
330 339
331 hwif->chipset = ide_ht6560b;
332 hwif->selectproc = &ht6560b_selectproc; 340 hwif->selectproc = &ht6560b_selectproc;
333 hwif->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
334 hwif->pio_mask = ATA_PIO5;
335 hwif->set_pio_mode = &ht6560b_set_pio_mode; 341 hwif->set_pio_mode = &ht6560b_set_pio_mode;
336 hwif->serialized = 1; /* is this needed? */
337 hwif->mate = mate;
338 342
339 mate->chipset = ide_ht6560b;
340 mate->selectproc = &ht6560b_selectproc; 343 mate->selectproc = &ht6560b_selectproc;
341 mate->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
342 mate->pio_mask = ATA_PIO5;
343 mate->set_pio_mode = &ht6560b_set_pio_mode; 344 mate->set_pio_mode = &ht6560b_set_pio_mode;
344 mate->serialized = 1; /* is this needed? */
345 mate->mate = hwif;
346 mate->channel = 1;
347 345
348 /* 346 /*
349 * Setting default configurations for drives 347 * Setting default configurations for drives
@@ -357,7 +355,7 @@ static int __init ht6560b_init(void)
357 mate->drives[0].drive_data = t; 355 mate->drives[0].drive_data = t;
358 mate->drives[1].drive_data = t; 356 mate->drives[1].drive_data = t;
359 357
360 ide_device_add(idx); 358 ide_device_add(idx, &ht6560b_port_info);
361 359
362 return 0; 360 return 0;
363 361
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index 7c3231a21d17..7c7f42a1fffa 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -108,7 +108,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
108 108
109 idx[0] = hwif->index; 109 idx[0] = hwif->index;
110 110
111 ide_device_add(idx); 111 ide_device_add(idx, NULL);
112 112
113 platform_set_drvdata(pdev, hwif); 113 platform_set_drvdata(pdev, hwif);
114 114
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 12cd26d0aa20..06df8df857a3 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -125,7 +125,7 @@ static int __init macide_init(void)
125 125
126 hwif->mmio = 1; 126 hwif->mmio = 1;
127 127
128 ide_device_add(idx); 128 ide_device_add(idx, NULL);
129 } 129 }
130 130
131 return 0; 131 return 0;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index a9c6b0609c54..2f0b34d892a1 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -154,7 +154,7 @@ static int __init q40ide_init(void)
154 } 154 }
155 } 155 }
156 156
157 ide_device_add(idx); 157 ide_device_add(idx, NULL);
158 158
159 return 0; 159 return 0;
160} 160}
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 37534bb483a7..60a6ed1088df 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -308,15 +308,10 @@ static int __init qd_testreg(int port)
308static void __init qd_setup(ide_hwif_t *hwif, int base, int config, 308static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
309 unsigned int data0, unsigned int data1) 309 unsigned int data0, unsigned int data1)
310{ 310{
311 hwif->chipset = ide_qd65xx;
312 hwif->channel = hwif->index;
313 hwif->select_data = base; 311 hwif->select_data = base;
314 hwif->config_data = config; 312 hwif->config_data = config;
315 hwif->drives[0].drive_data = data0; 313 hwif->drives[0].drive_data = data0;
316 hwif->drives[1].drive_data = data1; 314 hwif->drives[1].drive_data = data1;
317 hwif->drives[0].io_32bit =
318 hwif->drives[1].io_32bit = 1;
319 hwif->pio_mask = ATA_PIO4;
320} 315}
321 316
322/* 317/*
@@ -356,6 +351,14 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
356} 351}
357*/ 352*/
358 353
354static const struct ide_port_info qd65xx_port_info __initdata = {
355 .chipset = ide_qd65xx,
356 .host_flags = IDE_HFLAG_IO_32BIT |
357 IDE_HFLAG_NO_DMA |
358 IDE_HFLAG_NO_AUTOTUNE,
359 .pio_mask = ATA_PIO4,
360};
361
359/* 362/*
360 * qd_probe: 363 * qd_probe:
361 * 364 *
@@ -397,9 +400,9 @@ static int __init qd_probe(int base)
397 400
398 hwif->set_pio_mode = &qd6500_set_pio_mode; 401 hwif->set_pio_mode = &qd6500_set_pio_mode;
399 402
400 idx[0] = unit; 403 idx[unit] = unit;
401 404
402 ide_device_add(idx); 405 ide_device_add(idx, &qd65xx_port_info);
403 406
404 return 1; 407 return 1;
405 } 408 }
@@ -431,9 +434,9 @@ static int __init qd_probe(int base)
431 434
432 hwif->set_pio_mode = &qd6580_set_pio_mode; 435 hwif->set_pio_mode = &qd6580_set_pio_mode;
433 436
434 idx[0] = unit; 437 idx[unit] = unit;
435 438
436 ide_device_add(idx); 439 ide_device_add(idx, &qd65xx_port_info);
437 440
438 outb(QD_DEF_CONTR, QD_CONTROL_PORT); 441 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
439 442
@@ -460,7 +463,7 @@ static int __init qd_probe(int base)
460 idx[0] = 0; 463 idx[0] = 0;
461 idx[1] = 1; 464 idx[1] = 1;
462 465
463 ide_device_add(idx); 466 ide_device_add(idx, &qd65xx_port_info);
464 467
465 outb(QD_DEF_CONTR, QD_CONTROL_PORT); 468 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
466 469
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 26f38ce58776..5696ba026005 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -120,9 +120,14 @@ 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_info umc8672_port_info __initdata = {
124 .chipset = ide_umc8672,
125 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
126 .pio_mask = ATA_PIO4,
127};
128
123static int __init umc8672_probe(void) 129static int __init umc8672_probe(void)
124{ 130{
125 ide_hwif_t *hwif, *mate;
126 unsigned long flags; 131 unsigned long flags;
127 static u8 idx[4] = { 0, 1, 0xff, 0xff }; 132 static u8 idx[4] = { 0, 1, 0xff, 0xff };
128 133
@@ -143,21 +148,10 @@ static int __init umc8672_probe(void)
143 umc_set_speeds (current_speeds); 148 umc_set_speeds (current_speeds);
144 local_irq_restore(flags); 149 local_irq_restore(flags);
145 150
146 hwif = &ide_hwifs[0]; 151 ide_hwifs[0].set_pio_mode = &umc_set_pio_mode;
147 mate = &ide_hwifs[1]; 152 ide_hwifs[1].set_pio_mode = &umc_set_pio_mode;
148
149 hwif->chipset = ide_umc8672;
150 hwif->pio_mask = ATA_PIO4;
151 hwif->set_pio_mode = &umc_set_pio_mode;
152 hwif->mate = mate;
153
154 mate->chipset = ide_umc8672;
155 mate->pio_mask = ATA_PIO4;
156 mate->set_pio_mode = &umc_set_pio_mode;
157 mate->mate = hwif;
158 mate->channel = 1;
159 153
160 ide_device_add(idx); 154 ide_device_add(idx, &umc8672_port_info);
161 155
162 return 0; 156 return 0;
163} 157}