diff options
Diffstat (limited to 'drivers/ide/pci/cmd640.c')
-rw-r--r-- | drivers/ide/pci/cmd640.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 3303ffb327a7..fed93417d54a 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -744,18 +744,19 @@ static int __init cmd640x_init(void) | |||
744 | printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" | 744 | printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" |
745 | "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); | 745 | "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); |
746 | 746 | ||
747 | cmd_hwif0 = &ide_hwifs[0]; | 747 | cmd_hwif0 = ide_find_port(); |
748 | cmd_hwif1 = &ide_hwifs[1]; | ||
749 | 748 | ||
750 | /* | 749 | /* |
751 | * Initialize data for primary port | 750 | * Initialize data for primary port |
752 | */ | 751 | */ |
753 | ide_init_port_hw(cmd_hwif0, &hw[0]); | 752 | if (cmd_hwif0) { |
753 | ide_init_port_hw(cmd_hwif0, &hw[0]); | ||
754 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 754 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
755 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; | 755 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; |
756 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 756 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
757 | 757 | ||
758 | idx[0] = cmd_hwif0->index; | 758 | idx[0] = cmd_hwif0->index; |
759 | } | ||
759 | 760 | ||
760 | /* | 761 | /* |
761 | * Ensure compatibility by always using the slowest timings | 762 | * Ensure compatibility by always using the slowest timings |
@@ -767,10 +768,13 @@ static int __init cmd640x_init(void) | |||
767 | put_cmd640_reg(CMDTIM, 0); | 768 | put_cmd640_reg(CMDTIM, 0); |
768 | put_cmd640_reg(BRST, 0x40); | 769 | put_cmd640_reg(BRST, 0x40); |
769 | 770 | ||
771 | cmd_hwif1 = ide_find_port(); | ||
772 | |||
770 | /* | 773 | /* |
771 | * Try to enable the secondary interface, if not already enabled | 774 | * Try to enable the secondary interface, if not already enabled |
772 | */ | 775 | */ |
773 | if (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) { | 776 | if (cmd_hwif1 && |
777 | cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) { | ||
774 | port2 = "not probed"; | 778 | port2 = "not probed"; |
775 | } else { | 779 | } else { |
776 | b = get_cmd640_reg(CNTRL); | 780 | b = get_cmd640_reg(CNTRL); |
@@ -801,7 +805,7 @@ static int __init cmd640x_init(void) | |||
801 | /* | 805 | /* |
802 | * Initialize data for secondary cmd640 port, if enabled | 806 | * Initialize data for secondary cmd640 port, if enabled |
803 | */ | 807 | */ |
804 | if (second_port_cmd640) { | 808 | if (second_port_cmd640 && cmd_hwif1) { |
805 | ide_init_port_hw(cmd_hwif1, &hw[1]); | 809 | ide_init_port_hw(cmd_hwif1, &hw[1]); |
806 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 810 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
807 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; | 811 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; |
@@ -809,7 +813,7 @@ static int __init cmd640x_init(void) | |||
809 | 813 | ||
810 | idx[1] = cmd_hwif1->index; | 814 | idx[1] = cmd_hwif1->index; |
811 | } | 815 | } |
812 | printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, | 816 | printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", |
813 | second_port_cmd640 ? "" : "not ", port2); | 817 | second_port_cmd640 ? "" : "not ", port2); |
814 | 818 | ||
815 | /* | 819 | /* |
@@ -819,10 +823,15 @@ static int __init cmd640x_init(void) | |||
819 | for (index = 0; index < (2 + (second_port_cmd640 << 1)); index++) { | 823 | for (index = 0; index < (2 + (second_port_cmd640 << 1)); index++) { |
820 | ide_drive_t *drive; | 824 | ide_drive_t *drive; |
821 | 825 | ||
822 | if (index > 1) | 826 | if (index > 1) { |
827 | if (cmd_hwif1 == NULL) | ||
828 | continue; | ||
823 | drive = &cmd_hwif1->drives[index & 1]; | 829 | drive = &cmd_hwif1->drives[index & 1]; |
824 | else | 830 | } else { |
831 | if (cmd_hwif0 == NULL) | ||
832 | continue; | ||
825 | drive = &cmd_hwif0->drives[index & 1]; | 833 | drive = &cmd_hwif0->drives[index & 1]; |
834 | } | ||
826 | 835 | ||
827 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 836 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
828 | if (drive->autotune || ((index > 1) && second_port_toggled)) { | 837 | if (drive->autotune || ((index > 1) && second_port_toggled)) { |