aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd640.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
commita52b0d25a722e84da999005b75f972aa4824253c (patch)
tree4a3a48305f744e6bde2e3fd663a4473dd712049c /drivers/ide/pci/cmd640.c
parent539a5fe22620a1665cce504167953a71a43232ad (diff)
parentf37afdaca711838b50ecd89b9c15fc745270d77c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits) ide: constify struct ide_dma_ops ide: add struct ide_dma_ops (take 3) ide: add IDE_HFLAG_SERIALIZE_DMA host flag sl82c105: check bridge revision in sl82c105_init_one() au1xxx-ide: use ->init_dma method palm_bk3710: use ->init_dma method sgiioc4: use ->init_dma method icside: use ->init_dma method ide-pmac: use ->init_dma method ide: do complete DMA setup in ->init_dma method (take 2) au1xxx-ide: fix MWDMA support ide: cleanup ide_setup_dma() ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma() ide: export ide_allocate_dma_engine() ide: move ide_setup_dma() call out from ->init_dma method alim15x3: skip DMA initialization completely on revs < 0x20 pdc202xx_old: remove init_dma_pdc202xx() ide: don't display "BIOS" settings in ide_setup_dma() ide: remove ->cds field from ide_hwif_t (take 2) ide: remove ide_dma_iobase() ...
Diffstat (limited to 'drivers/ide/pci/cmd640.c')
-rw-r--r--drivers/ide/pci/cmd640.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index b076dbfc43a7..25c2f1bd175f 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -109,6 +109,8 @@
109 109
110#include <asm/io.h> 110#include <asm/io.h>
111 111
112#define DRV_NAME "cmd640"
113
112/* 114/*
113 * This flag is set in ide.c by the parameter: ide0=cmd640_vlb 115 * This flag is set in ide.c by the parameter: ide0=cmd640_vlb
114 */ 116 */
@@ -633,6 +635,9 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
633 display_clocks(index); 635 display_clocks(index);
634} 636}
635 637
638static const struct ide_port_ops cmd640_port_ops = {
639 .set_pio_mode = cmd640_set_pio_mode,
640};
636#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 641#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
637 642
638static int pci_conf1(void) 643static int pci_conf1(void)
@@ -678,10 +683,29 @@ static const struct ide_port_info cmd640_port_info __initdata = {
678 IDE_HFLAG_ABUSE_PREFETCH | 683 IDE_HFLAG_ABUSE_PREFETCH |
679 IDE_HFLAG_ABUSE_FAST_DEVSEL, 684 IDE_HFLAG_ABUSE_FAST_DEVSEL,
680#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 685#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
686 .port_ops = &cmd640_port_ops,
681 .pio_mask = ATA_PIO5, 687 .pio_mask = ATA_PIO5,
682#endif 688#endif
683}; 689};
684 690
691static int cmd640x_init_one(unsigned long base, unsigned long ctl)
692{
693 if (!request_region(base, 8, DRV_NAME)) {
694 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
695 DRV_NAME, base, base + 7);
696 return -EBUSY;
697 }
698
699 if (!request_region(ctl, 1, DRV_NAME)) {
700 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
701 DRV_NAME, ctl);
702 release_region(base, 8);
703 return -EBUSY;
704 }
705
706 return 0;
707}
708
685/* 709/*
686 * Probe for a cmd640 chipset, and initialize it if found. 710 * Probe for a cmd640 chipset, and initialize it if found.
687 */ 711 */
@@ -690,7 +714,7 @@ static int __init cmd640x_init(void)
690#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 714#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
691 int second_port_toggled = 0; 715 int second_port_toggled = 0;
692#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 716#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
693 int second_port_cmd640 = 0; 717 int second_port_cmd640 = 0, rc;
694 const char *bus_type, *port2; 718 const char *bus_type, *port2;
695 unsigned int index; 719 unsigned int index;
696 u8 b, cfr; 720 u8 b, cfr;
@@ -734,6 +758,17 @@ static int __init cmd640x_init(void)
734 return 0; 758 return 0;
735 } 759 }
736 760
761 rc = cmd640x_init_one(0x1f0, 0x3f6);
762 if (rc)
763 return rc;
764
765 rc = cmd640x_init_one(0x170, 0x376);
766 if (rc) {
767 release_region(0x3f6, 1);
768 release_region(0x1f0, 8);
769 return rc;
770 }
771
737 memset(&hw, 0, sizeof(hw)); 772 memset(&hw, 0, sizeof(hw));
738 773
739 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); 774 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
@@ -752,10 +787,6 @@ static int __init cmd640x_init(void)
752 */ 787 */
753 if (cmd_hwif0) { 788 if (cmd_hwif0) {
754 ide_init_port_hw(cmd_hwif0, &hw[0]); 789 ide_init_port_hw(cmd_hwif0, &hw[0]);
755#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
756 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;
757#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
758
759 idx[0] = cmd_hwif0->index; 790 idx[0] = cmd_hwif0->index;
760 } 791 }
761 792
@@ -808,10 +839,6 @@ static int __init cmd640x_init(void)
808 */ 839 */
809 if (second_port_cmd640 && cmd_hwif1) { 840 if (second_port_cmd640 && cmd_hwif1) {
810 ide_init_port_hw(cmd_hwif1, &hw[1]); 841 ide_init_port_hw(cmd_hwif1, &hw[1]);
811#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
812 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;
813#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
814
815 idx[1] = cmd_hwif1->index; 842 idx[1] = cmd_hwif1->index;
816 } 843 }
817 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", 844 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n",