aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd640.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/cmd640.c')
-rw-r--r--drivers/ide/pci/cmd640.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 29fbc5ead03b..a1cfe033a55f 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -409,19 +409,9 @@ static void __init check_prefetch (unsigned int index)
409 */ 409 */
410static void __init setup_device_ptrs (void) 410static void __init setup_device_ptrs (void)
411{ 411{
412 unsigned int i; 412 cmd_hwif0 = &ide_hwifs[0];
413 cmd_hwif1 = &ide_hwifs[1];
413 414
414 cmd_hwif0 = &ide_hwifs[0]; /* default, if not found below */
415 cmd_hwif1 = &ide_hwifs[1]; /* default, if not found below */
416 for (i = 0; i < MAX_HWIFS; i++) {
417 ide_hwif_t *hwif = &ide_hwifs[i];
418 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) {
419 if (hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0)
420 cmd_hwif0 = hwif;
421 else if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170)
422 cmd_hwif1 = hwif;
423 }
424 }
425 cmd_drives[0] = &cmd_hwif0->drives[0]; 415 cmd_drives[0] = &cmd_hwif0->drives[0];
426 cmd_drives[1] = &cmd_hwif0->drives[1]; 416 cmd_drives[1] = &cmd_hwif0->drives[1];
427 cmd_drives[2] = &cmd_hwif1->drives[0]; 417 cmd_drives[2] = &cmd_hwif1->drives[0];
@@ -724,6 +714,7 @@ static int __init cmd640x_init(void)
724 unsigned int index; 714 unsigned int index;
725 u8 b, cfr; 715 u8 b, cfr;
726 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 716 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
717 hw_regs_t hw[2];
727 718
728 if (cmd640_vlb && probe_for_cmd640_vlb()) { 719 if (cmd640_vlb && probe_for_cmd640_vlb()) {
729 bus_type = "VLB"; 720 bus_type = "VLB";
@@ -762,12 +753,23 @@ static int __init cmd640x_init(void)
762 return 0; 753 return 0;
763 } 754 }
764 755
756 memset(&hw, 0, sizeof(hw));
757
758 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
759 hw[0].irq = 14;
760
761 ide_std_init_ports(&hw[1], 0x170, 0x376);
762 hw[1].irq = 15;
763
764 printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x"
765 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr);
766
765 /* 767 /*
766 * Initialize data for primary port 768 * Initialize data for primary port
767 */ 769 */
768 setup_device_ptrs (); 770 setup_device_ptrs ();
769 printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", 771
770 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 772 ide_init_port_hw(cmd_hwif0, &hw[0]);
771#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 773#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
772 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; 774 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;
773#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 775#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
@@ -787,8 +789,7 @@ static int __init cmd640x_init(void)
787 /* 789 /*
788 * Try to enable the secondary interface, if not already enabled 790 * Try to enable the secondary interface, if not already enabled
789 */ 791 */
790 if (cmd_hwif1->noprobe || 792 if (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) {
791 (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe)) {
792 port2 = "not probed"; 793 port2 = "not probed";
793 } else { 794 } else {
794 b = get_cmd640_reg(CNTRL); 795 b = get_cmd640_reg(CNTRL);
@@ -820,6 +821,7 @@ static int __init cmd640x_init(void)
820 * Initialize data for secondary cmd640 port, if enabled 821 * Initialize data for secondary cmd640 port, if enabled
821 */ 822 */
822 if (second_port_cmd640) { 823 if (second_port_cmd640) {
824 ide_init_port_hw(cmd_hwif1, &hw[1]);
823#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 825#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
824 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; 826 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;
825#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 827#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */