diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:41 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:41 -0400 |
commit | a698400a1556cf9f0376d1a41e536973dd5c4747 (patch) | |
tree | af63ee32fac09ce32476044eecd0ab7f1770153c /drivers/ide | |
parent | ba1d0de70d64e68f0e035f00dbb041c1e05b49c9 (diff) |
cmd640: fix warm-plug support for the secondary interface
Register secondary interface also when user requested not to probe devices.
While at it:
- remove write-only second_port_toggled variable
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/pci/cmd640.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index baa26a26709a..ab7d7274d8b1 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -687,9 +687,6 @@ static int cmd640x_init_one(unsigned long base, unsigned long ctl) | |||
687 | */ | 687 | */ |
688 | static int __init cmd640x_init(void) | 688 | static int __init cmd640x_init(void) |
689 | { | 689 | { |
690 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | ||
691 | int second_port_toggled = 0; | ||
692 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | ||
693 | int second_port_cmd640 = 0, rc; | 690 | int second_port_cmd640 = 0, rc; |
694 | const char *bus_type, *port2; | 691 | const char *bus_type, *port2; |
695 | unsigned int index; | 692 | unsigned int index; |
@@ -778,46 +775,40 @@ static int __init cmd640x_init(void) | |||
778 | put_cmd640_reg(CMDTIM, 0); | 775 | put_cmd640_reg(CMDTIM, 0); |
779 | put_cmd640_reg(BRST, 0x40); | 776 | put_cmd640_reg(BRST, 0x40); |
780 | 777 | ||
781 | cmd_hwif1 = ide_find_port(); | 778 | b = get_cmd640_reg(CNTRL); |
782 | 779 | ||
783 | /* | 780 | /* |
784 | * Try to enable the secondary interface, if not already enabled | 781 | * Try to enable the secondary interface, if not already enabled |
785 | */ | 782 | */ |
786 | if (cmd_hwif1 && | 783 | if (secondary_port_responding()) { |
787 | cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) { | 784 | if ((b & CNTRL_ENA_2ND)) { |
788 | port2 = "not probed"; | 785 | second_port_cmd640 = 1; |
786 | port2 = "okay"; | ||
787 | } else if (cmd640_vlb) { | ||
788 | second_port_cmd640 = 1; | ||
789 | port2 = "alive"; | ||
790 | } else | ||
791 | port2 = "not cmd640"; | ||
789 | } else { | 792 | } else { |
790 | b = get_cmd640_reg(CNTRL); | 793 | put_cmd640_reg(CNTRL, b ^ CNTRL_ENA_2ND); /* toggle the bit */ |
791 | if (secondary_port_responding()) { | 794 | if (secondary_port_responding()) { |
792 | if ((b & CNTRL_ENA_2ND)) { | 795 | second_port_cmd640 = 1; |
793 | second_port_cmd640 = 1; | 796 | port2 = "enabled"; |
794 | port2 = "okay"; | ||
795 | } else if (cmd640_vlb) { | ||
796 | second_port_cmd640 = 1; | ||
797 | port2 = "alive"; | ||
798 | } else | ||
799 | port2 = "not cmd640"; | ||
800 | } else { | 797 | } else { |
801 | put_cmd640_reg(CNTRL, b ^ CNTRL_ENA_2ND); /* toggle the bit */ | 798 | put_cmd640_reg(CNTRL, b); /* restore original setting */ |
802 | if (secondary_port_responding()) { | 799 | port2 = "not responding"; |
803 | second_port_cmd640 = 1; | ||
804 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | ||
805 | second_port_toggled = 1; | ||
806 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | ||
807 | port2 = "enabled"; | ||
808 | } else { | ||
809 | put_cmd640_reg(CNTRL, b); /* restore original setting */ | ||
810 | port2 = "not responding"; | ||
811 | } | ||
812 | } | 800 | } |
813 | } | 801 | } |
814 | 802 | ||
815 | /* | 803 | /* |
816 | * Initialize data for secondary cmd640 port, if enabled | 804 | * Initialize data for secondary cmd640 port, if enabled |
817 | */ | 805 | */ |
818 | if (second_port_cmd640 && cmd_hwif1) { | 806 | if (second_port_cmd640) { |
819 | ide_init_port_hw(cmd_hwif1, &hw[1]); | 807 | cmd_hwif1 = ide_find_port(); |
820 | idx[1] = cmd_hwif1->index; | 808 | if (cmd_hwif1) { |
809 | ide_init_port_hw(cmd_hwif1, &hw[1]); | ||
810 | idx[1] = cmd_hwif1->index; | ||
811 | } | ||
821 | } | 812 | } |
822 | printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", | 813 | printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", |
823 | second_port_cmd640 ? "" : "not ", port2); | 814 | second_port_cmd640 ? "" : "not ", port2); |