aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/alim15x3.c6
-rw-r--r--drivers/ide/pci/amd74xx.c2
-rw-r--r--drivers/ide/pci/cmd640.c131
-rw-r--r--drivers/ide/pci/cmd64x.c6
-rw-r--r--drivers/ide/pci/cs5535.c6
-rw-r--r--drivers/ide/pci/cy82c693.c9
-rw-r--r--drivers/ide/pci/delkin_cb.c1
-rw-r--r--drivers/ide/pci/it821x.c6
-rw-r--r--drivers/ide/pci/scc_pata.c8
-rw-r--r--drivers/ide/pci/sgiioc4.c23
-rw-r--r--drivers/ide/pci/siimage.c3
-rw-r--r--drivers/ide/pci/sis5513.c3
-rw-r--r--drivers/ide/pci/sl82c105.c3
-rw-r--r--drivers/ide/pci/via82cxxx.c2
14 files changed, 90 insertions, 119 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index f2de00adf147..80d19c0eb780 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -69,7 +69,8 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
69{ 69{
70 ide_hwif_t *hwif = HWIF(drive); 70 ide_hwif_t *hwif = HWIF(drive);
71 struct pci_dev *dev = to_pci_dev(hwif->dev); 71 struct pci_dev *dev = to_pci_dev(hwif->dev);
72 int s_time, a_time, c_time; 72 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
73 int s_time = t->setup, a_time = t->active, c_time = t->cycle;
73 u8 s_clc, a_clc, r_clc; 74 u8 s_clc, a_clc, r_clc;
74 unsigned long flags; 75 unsigned long flags;
75 int bus_speed = ide_pci_clk ? ide_pci_clk : 33; 76 int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
@@ -78,13 +79,10 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
78 u8 cd_dma_fifo = 0; 79 u8 cd_dma_fifo = 0;
79 int unit = drive->select.b.unit & 1; 80 int unit = drive->select.b.unit & 1;
80 81
81 s_time = ide_pio_timings[pio].setup_time;
82 a_time = ide_pio_timings[pio].active_time;
83 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) 82 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8)
84 s_clc = 0; 83 s_clc = 0;
85 if ((a_clc = (a_time * bus_speed + 999) / 1000) >= 8) 84 if ((a_clc = (a_time * bus_speed + 999) / 1000) >= 8)
86 a_clc = 0; 85 a_clc = 0;
87 c_time = ide_pio_timings[pio].cycle_time;
88 86
89 if (!(r_clc = (c_time * bus_speed + 999) / 1000 - a_clc - s_clc)) { 87 if (!(r_clc = (c_time * bus_speed + 999) / 1000 - a_clc - s_clc)) {
90 r_clc = 1; 88 r_clc = 1;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index ad222206a429..0bfcdd0e77b3 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -21,8 +21,6 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/ide.h> 22#include <linux/ide.h>
23 23
24#include "ide-timing.h"
25
26enum { 24enum {
27 AMD_IDE_CONFIG = 0x41, 25 AMD_IDE_CONFIG = 0x41,
28 AMD_CABLE_DETECT = 0x42, 26 AMD_CABLE_DETECT = 0x42,
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index cd1ba14984ab..1ad1e23e3105 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -521,6 +521,7 @@ static void program_drive_counts(ide_drive_t *drive, unsigned int index)
521static void cmd640_set_mode(ide_drive_t *drive, unsigned int index, 521static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
522 u8 pio_mode, unsigned int cycle_time) 522 u8 pio_mode, unsigned int cycle_time)
523{ 523{
524 struct ide_timing *t;
524 int setup_time, active_time, recovery_time, clock_time; 525 int setup_time, active_time, recovery_time, clock_time;
525 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count; 526 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count;
526 int bus_speed; 527 int bus_speed;
@@ -532,8 +533,11 @@ static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
532 533
533 if (pio_mode > 5) 534 if (pio_mode > 5)
534 pio_mode = 5; 535 pio_mode = 5;
535 setup_time = ide_pio_timings[pio_mode].setup_time; 536
536 active_time = ide_pio_timings[pio_mode].active_time; 537 t = ide_timing_find_mode(XFER_PIO_0 + pio_mode);
538 setup_time = t->setup;
539 active_time = t->active;
540
537 recovery_time = cycle_time - (setup_time + active_time); 541 recovery_time = cycle_time - (setup_time + active_time);
538 clock_time = 1000 / bus_speed; 542 clock_time = 1000 / bus_speed;
539 cycle_count = DIV_ROUND_UP(cycle_time, clock_time); 543 cycle_count = DIV_ROUND_UP(cycle_time, clock_time);
@@ -607,11 +611,40 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
607 611
608 display_clocks(index); 612 display_clocks(index);
609} 613}
614#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
615
616static void cmd640_init_dev(ide_drive_t *drive)
617{
618 unsigned int i = drive->hwif->channel * 2 + drive->select.b.unit;
619
620#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
621 /*
622 * Reset timing to the slowest speed and turn off prefetch.
623 * This way, the drive identify code has a better chance.
624 */
625 setup_counts[i] = 4; /* max possible */
626 active_counts[i] = 16; /* max possible */
627 recovery_counts[i] = 16; /* max possible */
628 program_drive_counts(drive, i);
629 set_prefetch_mode(drive, i, 0);
630 printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch cleared\n", i);
631#else
632 /*
633 * Set the drive unmask flags to match the prefetch setting.
634 */
635 check_prefetch(drive, i);
636 printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n",
637 i, drive->no_io_32bit ? "off" : "on");
638#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
639}
640
610 641
611static const struct ide_port_ops cmd640_port_ops = { 642static const struct ide_port_ops cmd640_port_ops = {
643 .init_dev = cmd640_init_dev,
644#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
612 .set_pio_mode = cmd640_set_pio_mode, 645 .set_pio_mode = cmd640_set_pio_mode,
646#endif
613}; 647};
614#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
615 648
616static int pci_conf1(void) 649static int pci_conf1(void)
617{ 650{
@@ -654,10 +687,8 @@ static const struct ide_port_info cmd640_port_info __initdata = {
654 IDE_HFLAG_NO_DMA | 687 IDE_HFLAG_NO_DMA |
655 IDE_HFLAG_ABUSE_PREFETCH | 688 IDE_HFLAG_ABUSE_PREFETCH |
656 IDE_HFLAG_ABUSE_FAST_DEVSEL, 689 IDE_HFLAG_ABUSE_FAST_DEVSEL,
657#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
658 .port_ops = &cmd640_port_ops, 690 .port_ops = &cmd640_port_ops,
659 .pio_mask = ATA_PIO5, 691 .pio_mask = ATA_PIO5,
660#endif
661}; 692};
662 693
663static int cmd640x_init_one(unsigned long base, unsigned long ctl) 694static int cmd640x_init_one(unsigned long base, unsigned long ctl)
@@ -683,12 +714,8 @@ static int cmd640x_init_one(unsigned long base, unsigned long ctl)
683 */ 714 */
684static int __init cmd640x_init(void) 715static int __init cmd640x_init(void)
685{ 716{
686#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
687 int second_port_toggled = 0;
688#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
689 int second_port_cmd640 = 0, rc; 717 int second_port_cmd640 = 0, rc;
690 const char *bus_type, *port2; 718 const char *bus_type, *port2;
691 unsigned int index;
692 u8 b, cfr; 719 u8 b, cfr;
693 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 720 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
694 hw_regs_t hw[2]; 721 hw_regs_t hw[2];
@@ -774,88 +801,44 @@ static int __init cmd640x_init(void)
774 put_cmd640_reg(CMDTIM, 0); 801 put_cmd640_reg(CMDTIM, 0);
775 put_cmd640_reg(BRST, 0x40); 802 put_cmd640_reg(BRST, 0x40);
776 803
777 cmd_hwif1 = ide_find_port(); 804 b = get_cmd640_reg(CNTRL);
778 805
779 /* 806 /*
780 * Try to enable the secondary interface, if not already enabled 807 * Try to enable the secondary interface, if not already enabled
781 */ 808 */
782 if (cmd_hwif1 && 809 if (secondary_port_responding()) {
783 cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) { 810 if ((b & CNTRL_ENA_2ND)) {
784 port2 = "not probed"; 811 second_port_cmd640 = 1;
812 port2 = "okay";
813 } else if (cmd640_vlb) {
814 second_port_cmd640 = 1;
815 port2 = "alive";
816 } else
817 port2 = "not cmd640";
785 } else { 818 } else {
786 b = get_cmd640_reg(CNTRL); 819 put_cmd640_reg(CNTRL, b ^ CNTRL_ENA_2ND); /* toggle the bit */
787 if (secondary_port_responding()) { 820 if (secondary_port_responding()) {
788 if ((b & CNTRL_ENA_2ND)) { 821 second_port_cmd640 = 1;
789 second_port_cmd640 = 1; 822 port2 = "enabled";
790 port2 = "okay";
791 } else if (cmd640_vlb) {
792 second_port_cmd640 = 1;
793 port2 = "alive";
794 } else
795 port2 = "not cmd640";
796 } else { 823 } else {
797 put_cmd640_reg(CNTRL, b ^ CNTRL_ENA_2ND); /* toggle the bit */ 824 put_cmd640_reg(CNTRL, b); /* restore original setting */
798 if (secondary_port_responding()) { 825 port2 = "not responding";
799 second_port_cmd640 = 1;
800#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
801 second_port_toggled = 1;
802#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
803 port2 = "enabled";
804 } else {
805 put_cmd640_reg(CNTRL, b); /* restore original setting */
806 port2 = "not responding";
807 }
808 } 826 }
809 } 827 }
810 828
811 /* 829 /*
812 * Initialize data for secondary cmd640 port, if enabled 830 * Initialize data for secondary cmd640 port, if enabled
813 */ 831 */
814 if (second_port_cmd640 && cmd_hwif1) { 832 if (second_port_cmd640) {
815 ide_init_port_hw(cmd_hwif1, &hw[1]); 833 cmd_hwif1 = ide_find_port();
816 idx[1] = cmd_hwif1->index; 834 if (cmd_hwif1) {
835 ide_init_port_hw(cmd_hwif1, &hw[1]);
836 idx[1] = cmd_hwif1->index;
837 }
817 } 838 }
818 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n", 839 printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n",
819 second_port_cmd640 ? "" : "not ", port2); 840 second_port_cmd640 ? "" : "not ", port2);
820 841
821 /*
822 * Establish initial timings/prefetch for all drives.
823 * Do not unnecessarily disturb any prior BIOS setup of these.
824 */
825 for (index = 0; index < (2 + (second_port_cmd640 << 1)); index++) {
826 ide_drive_t *drive;
827
828 if (index > 1) {
829 if (cmd_hwif1 == NULL)
830 continue;
831 drive = &cmd_hwif1->drives[index & 1];
832 } else {
833 if (cmd_hwif0 == NULL)
834 continue;
835 drive = &cmd_hwif0->drives[index & 1];
836 }
837
838#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
839 /*
840 * Reset timing to the slowest speed and turn off prefetch.
841 * This way, the drive identify code has a better chance.
842 */
843 setup_counts [index] = 4; /* max possible */
844 active_counts [index] = 16; /* max possible */
845 recovery_counts [index] = 16; /* max possible */
846 program_drive_counts(drive, index);
847 set_prefetch_mode(drive, index, 0);
848 printk("cmd640: drive%d timings/prefetch cleared\n", index);
849#else
850 /*
851 * Set the drive unmask flags to match the prefetch setting
852 */
853 check_prefetch(drive, index);
854 printk("cmd640: drive%d timings/prefetch(%s) preserved\n",
855 index, drive->no_io_32bit ? "off" : "on");
856#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
857 }
858
859#ifdef CMD640_DUMP_REGS 842#ifdef CMD640_DUMP_REGS
860 cmd640_dump_regs(); 843 cmd640_dump_regs();
861#endif 844#endif
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index ca4774aa27ee..cfa784bacf48 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -116,6 +116,7 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
116{ 116{
117 ide_hwif_t *hwif = HWIF(drive); 117 ide_hwif_t *hwif = HWIF(drive);
118 struct pci_dev *dev = to_pci_dev(hwif->dev); 118 struct pci_dev *dev = to_pci_dev(hwif->dev);
119 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
119 unsigned int cycle_time; 120 unsigned int cycle_time;
120 u8 setup_count, arttim = 0; 121 u8 setup_count, arttim = 0;
121 122
@@ -124,10 +125,9 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
124 125
125 cycle_time = ide_pio_cycle_time(drive, pio); 126 cycle_time = ide_pio_cycle_time(drive, pio);
126 127
127 program_cycle_times(drive, cycle_time, 128 program_cycle_times(drive, cycle_time, t->active);
128 ide_pio_timings[pio].active_time);
129 129
130 setup_count = quantize_timing(ide_pio_timings[pio].setup_time, 130 setup_count = quantize_timing(t->setup,
131 1000 / (ide_pci_clk ? ide_pci_clk : 33)); 131 1000 / (ide_pci_clk ? ide_pci_clk : 33));
132 132
133 /* 133 /*
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 99fe91a191b8..dc97c48623f3 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -26,8 +26,6 @@
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/ide.h> 27#include <linux/ide.h>
28 28
29#include "ide-timing.h"
30
31#define MSR_ATAC_BASE 0x51300000 29#define MSR_ATAC_BASE 0x51300000
32#define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0) 30#define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0)
33#define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01) 31#define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01)
@@ -75,13 +73,11 @@ static unsigned int cs5535_udma_timings[5] =
75 */ 73 */
76static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) 74static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
77{ 75{
78
79 u32 reg = 0, dummy; 76 u32 reg = 0, dummy;
80 int unit = drive->select.b.unit; 77 int unit = drive->select.b.unit;
81 78
82
83 /* Set the PIO timings */ 79 /* Set the PIO timings */
84 if ((speed & XFER_MODE) == XFER_PIO) { 80 if (speed < XFER_SW_DMA_0) {
85 ide_drive_t *pair = ide_get_paired_drive(drive); 81 ide_drive_t *pair = ide_get_paired_drive(drive);
86 u8 cmd, pioa; 82 u8 cmd, pioa;
87 83
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 8c534afcb6c8..e14ad5530fa4 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -133,6 +133,7 @@ static int calc_clk(int time, int bus_speed)
133 */ 133 */
134static void compute_clocks(u8 pio, pio_clocks_t *p_pclk) 134static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
135{ 135{
136 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
136 int clk1, clk2; 137 int clk1, clk2;
137 int bus_speed = ide_pci_clk ? ide_pci_clk : 33; 138 int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
138 139
@@ -141,15 +142,13 @@ static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
141 */ 142 */
142 143
143 /* let's calc the address setup time clocks */ 144 /* let's calc the address setup time clocks */
144 p_pclk->address_time = (u8)calc_clk(ide_pio_timings[pio].setup_time, bus_speed); 145 p_pclk->address_time = (u8)calc_clk(t->setup, bus_speed);
145 146
146 /* let's calc the active and recovery time clocks */ 147 /* let's calc the active and recovery time clocks */
147 clk1 = calc_clk(ide_pio_timings[pio].active_time, bus_speed); 148 clk1 = calc_clk(t->active, bus_speed);
148 149
149 /* calc recovery timing */ 150 /* calc recovery timing */
150 clk2 = ide_pio_timings[pio].cycle_time - 151 clk2 = t->cycle - t->active - t->setup;
151 ide_pio_timings[pio].active_time -
152 ide_pio_timings[pio].setup_time;
153 152
154 clk2 = calc_clk(clk2, bus_speed); 153 clk2 = calc_clk(clk2, bus_speed);
155 154
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index af0f30051d5a..0106e2a2df77 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -93,7 +93,6 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
93 93
94 i = hwif->index; 94 i = hwif->index;
95 95
96 ide_init_port_data(hwif, i);
97 ide_init_port_hw(hwif, &hw); 96 ide_init_port_hw(hwif, &hw);
98 97
99 idx[0] = i; 98 idx[0] = i;
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 6ab04115286b..cbf647202994 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -512,8 +512,14 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive)
512} 512}
513 513
514static struct ide_dma_ops it821x_pass_through_dma_ops = { 514static struct ide_dma_ops it821x_pass_through_dma_ops = {
515 .dma_host_set = ide_dma_host_set,
516 .dma_setup = ide_dma_setup,
517 .dma_exec_cmd = ide_dma_exec_cmd,
515 .dma_start = it821x_dma_start, 518 .dma_start = it821x_dma_start,
516 .dma_end = it821x_dma_end, 519 .dma_end = it821x_dma_end,
520 .dma_test_irq = ide_dma_test_irq,
521 .dma_timeout = ide_dma_timeout,
522 .dma_lost_irq = ide_dma_lost_irq,
517}; 523};
518 524
519/** 525/**
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 1584ebb6a185..789c66dfbde5 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -558,12 +558,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
558 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 558 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
559 int i; 559 int i;
560 560
561 hwif = ide_find_port(); 561 hwif = ide_find_port_slot(d);
562 if (hwif == NULL) { 562 if (hwif == NULL)
563 printk(KERN_ERR "%s: too many IDE interfaces, "
564 "no room in table\n", SCC_PATA_NAME);
565 return -ENOMEM; 563 return -ENOMEM;
566 }
567 564
568 memset(&hw, 0, sizeof(hw)); 565 memset(&hw, 0, sizeof(hw));
569 for (i = 0; i <= 8; i++) 566 for (i = 0; i <= 8; i++)
@@ -572,7 +569,6 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
572 hw.dev = &dev->dev; 569 hw.dev = &dev->dev;
573 hw.chipset = ide_pci; 570 hw.chipset = ide_pci;
574 ide_init_port_hw(hwif, &hw); 571 ide_init_port_hw(hwif, &hw);
575 hwif->dev = &dev->dev;
576 572
577 idx[0] = hwif->index; 573 idx[0] = hwif->index;
578 574
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 24513e3dcd6b..c79ff5b41088 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -568,6 +568,7 @@ static const struct ide_dma_ops sgiioc4_dma_ops = {
568}; 568};
569 569
570static const struct ide_port_info sgiioc4_port_info __devinitdata = { 570static const struct ide_port_info sgiioc4_port_info __devinitdata = {
571 .name = DRV_NAME,
571 .chipset = ide_pci, 572 .chipset = ide_pci,
572 .init_dma = ide_dma_sgiioc4, 573 .init_dma = ide_dma_sgiioc4,
573 .port_ops = &sgiioc4_port_ops, 574 .port_ops = &sgiioc4_port_ops,
@@ -587,13 +588,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
587 hw_regs_t hw; 588 hw_regs_t hw;
588 struct ide_port_info d = sgiioc4_port_info; 589 struct ide_port_info d = sgiioc4_port_info;
589 590
590 hwif = ide_find_port();
591 if (hwif == NULL) {
592 printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n",
593 DRV_NAME);
594 return -ENOMEM;
595 }
596
597 /* Get the CmdBlk and CtrlBlk Base Registers */ 591 /* Get the CmdBlk and CtrlBlk Base Registers */
598 bar0 = pci_resource_start(dev, 0); 592 bar0 = pci_resource_start(dev, 0);
599 virt_base = ioremap(bar0, pci_resource_len(dev, 0)); 593 virt_base = ioremap(bar0, pci_resource_len(dev, 0));
@@ -608,11 +602,11 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
608 602
609 cmd_phys_base = bar0 + IOC4_CMD_OFFSET; 603 cmd_phys_base = bar0 + IOC4_CMD_OFFSET;
610 if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, 604 if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE,
611 hwif->name)) { 605 DRV_NAME)) {
612 printk(KERN_ERR 606 printk(KERN_ERR
613 "%s : %s -- ERROR, Addresses " 607 "%s : %s -- ERROR, Addresses "
614 "0x%p to 0x%p ALREADY in use\n", 608 "0x%p to 0x%p ALREADY in use\n",
615 __func__, hwif->name, (void *) cmd_phys_base, 609 __func__, DRV_NAME, (void *) cmd_phys_base,
616 (void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE); 610 (void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE);
617 return -ENOMEM; 611 return -ENOMEM;
618 } 612 }
@@ -623,9 +617,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
623 hw.irq = dev->irq; 617 hw.irq = dev->irq;
624 hw.chipset = ide_pci; 618 hw.chipset = ide_pci;
625 hw.dev = &dev->dev; 619 hw.dev = &dev->dev;
626 ide_init_port_hw(hwif, &hw);
627 620
628 hwif->dev = &dev->dev; 621 hwif = ide_find_port_slot(&d);
622 if (hwif == NULL)
623 goto err;
624
625 ide_init_port_hw(hwif, &hw);
629 626
630 /* The IOC4 uses MMIO rather than Port IO. */ 627 /* The IOC4 uses MMIO rather than Port IO. */
631 default_hwif_mmiops(hwif); 628 default_hwif_mmiops(hwif);
@@ -641,6 +638,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
641 return -EIO; 638 return -EIO;
642 639
643 return 0; 640 return 0;
641err:
642 release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE);
643 iounmap(virt_base);
644 return -ENOMEM;
644} 645}
645 646
646static unsigned int __devinit 647static unsigned int __devinit
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index b75e9bb390a7..6e9d7655d89c 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -421,8 +421,7 @@ static int sil_sata_reset_poll(ide_drive_t *drive)
421 if ((sata_stat & 0x03) != 0x03) { 421 if ((sata_stat & 0x03) != 0x03) {
422 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", 422 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
423 hwif->name, sata_stat); 423 hwif->name, sata_stat);
424 HWGROUP(drive)->polling = 0; 424 return -ENXIO;
425 return ide_started;
426 } 425 }
427 } 426 }
428 427
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index e127eb25ab63..2389945ca95d 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -52,8 +52,6 @@
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/ide.h> 53#include <linux/ide.h>
54 54
55#include "ide-timing.h"
56
57/* registers layout and init values are chipset family dependant */ 55/* registers layout and init values are chipset family dependant */
58 56
59#define ATA_16 0x01 57#define ATA_16 0x01
@@ -616,7 +614,6 @@ MODULE_LICENSE("GPL");
616/* 614/*
617 * TODO: 615 * TODO:
618 * - CLEANUP 616 * - CLEANUP
619 * - Use drivers/ide/ide-timing.h !
620 * - More checks in the config registers (force values instead of 617 * - More checks in the config registers (force values instead of
621 * relying on the BIOS setting them correctly). 618 * relying on the BIOS setting them correctly).
622 * - Further optimisations ? 619 * - Further optimisations ?
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index ce84fa045d39..6efbde297174 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -47,10 +47,11 @@
47 */ 47 */
48static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) 48static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio)
49{ 49{
50 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
50 unsigned int cmd_on, cmd_off; 51 unsigned int cmd_on, cmd_off;
51 u8 iordy = 0; 52 u8 iordy = 0;
52 53
53 cmd_on = (ide_pio_timings[pio].active_time + 29) / 30; 54 cmd_on = (t->active + 29) / 30;
54 cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; 55 cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30;
55 56
56 if (cmd_on == 0) 57 if (cmd_on == 0)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 3ed9728abd24..e47384c70c40 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -35,8 +35,6 @@
35#include <asm/processor.h> 35#include <asm/processor.h>
36#endif 36#endif
37 37
38#include "ide-timing.h"
39
40#define VIA_IDE_ENABLE 0x40 38#define VIA_IDE_ENABLE 0x40
41#define VIA_IDE_CONFIG 0x41 39#define VIA_IDE_CONFIG 0x41
42#define VIA_FIFO_CONFIG 0x43 40#define VIA_FIFO_CONFIG 0x43