aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/pci/via82cxxx.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index a8c050b462bc..bc1675da37d1 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -270,22 +270,11 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
270{ 270{
271 struct ide_host *host = pci_get_drvdata(dev); 271 struct ide_host *host = pci_get_drvdata(dev);
272 struct via82cxxx_dev *vdev = host->host_priv; 272 struct via82cxxx_dev *vdev = host->host_priv;
273 struct pci_dev *isa = NULL; 273 struct via_isa_bridge *via_config = vdev->via_config;
274 struct via_isa_bridge *via_config;
275 u8 t, v; 274 u8 t, v;
276 u32 u; 275 u32 u;
277 276
278 /* 277 /*
279 * Find the ISA bridge to see how good the IDE is.
280 */
281 vdev->via_config = via_config = via_config_find(&isa);
282
283 /* We checked this earlier so if it fails here deeep badness
284 is involved */
285
286 BUG_ON(!via_config->id);
287
288 /*
289 * Detect cable and configure Clk66 278 * Detect cable and configure Clk66
290 */ 279 */
291 pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); 280 pci_read_config_dword(dev, VIA_UDMA_TIMING, &u);
@@ -330,39 +319,6 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
330 319
331 pci_write_config_byte(dev, VIA_FIFO_CONFIG, t); 320 pci_write_config_byte(dev, VIA_FIFO_CONFIG, t);
332 321
333 /*
334 * Determine system bus clock.
335 */
336
337 via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
338
339 switch (via_clock) {
340 case 33000: via_clock = 33333; break;
341 case 37000: via_clock = 37500; break;
342 case 41000: via_clock = 41666; break;
343 }
344
345 if (via_clock < 20000 || via_clock > 50000) {
346 printk(KERN_WARNING "VP_IDE: User given PCI clock speed "
347 "impossible (%d), using 33 MHz instead.\n", via_clock);
348 printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want "
349 "to assume 80-wire cable.\n");
350 via_clock = 33333;
351 }
352
353 /*
354 * Print the boot message.
355 */
356
357 printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s "
358 "controller on pci%s\n",
359 via_config->name, isa->revision,
360 via_config->udma_mask ? "U" : "MW",
361 via_dma[via_config->udma_mask ?
362 (fls(via_config->udma_mask) - 1) : 0],
363 pci_name(dev));
364
365 pci_dev_put(isa);
366 return 0; 322 return 0;
367} 323}
368 324
@@ -444,12 +400,43 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
444 * Find the ISA bridge and check we know what it is. 400 * Find the ISA bridge and check we know what it is.
445 */ 401 */
446 via_config = via_config_find(&isa); 402 via_config = via_config_find(&isa);
447 pci_dev_put(isa);
448 if (!via_config->id) { 403 if (!via_config->id) {
449 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 404 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
450 return -ENODEV; 405 return -ENODEV;
451 } 406 }
452 407
408 /*
409 * Print the boot message.
410 */
411 printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s "
412 "controller on pci%s\n",
413 via_config->name, isa->revision,
414 via_config->udma_mask ? "U" : "MW",
415 via_dma[via_config->udma_mask ?
416 (fls(via_config->udma_mask) - 1) : 0],
417 pci_name(dev));
418
419 pci_dev_put(isa);
420
421 /*
422 * Determine system bus clock.
423 */
424 via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
425
426 switch (via_clock) {
427 case 33000: via_clock = 33333; break;
428 case 37000: via_clock = 37500; break;
429 case 41000: via_clock = 41666; break;
430 }
431
432 if (via_clock < 20000 || via_clock > 50000) {
433 printk(KERN_WARNING "VP_IDE: User given PCI clock speed "
434 "impossible (%d), using 33 MHz instead.\n", via_clock);
435 printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want "
436 "to assume 80-wire cable.\n");
437 via_clock = 33333;
438 }
439
453 if (idx == 0) 440 if (idx == 0)
454 d.host_flags |= IDE_HFLAG_NO_AUTODMA; 441 d.host_flags |= IDE_HFLAG_NO_AUTODMA;
455 else 442 else
@@ -471,6 +458,8 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
471 return -ENOMEM; 458 return -ENOMEM;
472 } 459 }
473 460
461 vdev->via_config = via_config;
462
474 rc = ide_pci_init_one(dev, &d, vdev); 463 rc = ide_pci_init_one(dev, &d, vdev);
475 if (rc) 464 if (rc)
476 kfree(vdev); 465 kfree(vdev);