aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/aec62xx.c2
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/amd74xx.c16
-rw-r--r--drivers/ide/pci/cmd640.c8
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/hpt366.c3
-rw-r--r--drivers/ide/pci/ns87415.c4
-rw-r--r--drivers/ide/pci/scc_pata.c12
-rw-r--r--drivers/ide/pci/sgiioc4.c7
-rw-r--r--drivers/ide/pci/siimage.c25
-rw-r--r--drivers/ide/pci/via82cxxx.c16
12 files changed, 46 insertions, 55 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 7f46c224b7c4..ae7a4329a581 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -140,7 +140,7 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
140 140
141static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 141static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
142{ 142{
143 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock(); 143 int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
144 144
145 if (bus_speed <= 33) 145 if (bus_speed <= 33)
146 pci_set_drvdata(dev, (void *) aec6xxx_33_base); 146 pci_set_drvdata(dev, (void *) aec6xxx_33_base);
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index f2129d5e07f2..f2de00adf147 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -72,7 +72,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
72 int s_time, a_time, c_time; 72 int s_time, a_time, c_time;
73 u8 s_clc, a_clc, r_clc; 73 u8 s_clc, a_clc, r_clc;
74 unsigned long flags; 74 unsigned long flags;
75 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock(); 75 int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
76 int port = hwif->channel ? 0x5c : 0x58; 76 int port = hwif->channel ? 0x5c : 0x58;
77 int portFIFO = hwif->channel ? 0x55 : 0x54; 77 int portFIFO = hwif->channel ? 0x55 : 0x54;
78 u8 cd_dma_fifo = 0; 78 u8 cd_dma_fifo = 0;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index efcf54338be7..ad222206a429 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -53,20 +53,20 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
53 u8 t = 0, offset = amd_offset(dev); 53 u8 t = 0, offset = amd_offset(dev);
54 54
55 pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t); 55 pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t);
56 t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); 56 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
57 pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t); 57 pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t);
58 58
59 pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)), 59 pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)),
60 ((FIT(timing->act8b, 1, 16) - 1) << 4) | (FIT(timing->rec8b, 1, 16) - 1)); 60 ((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1));
61 61
62 pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn), 62 pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn),
63 ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); 63 ((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1));
64 64
65 switch (udma_mask) { 65 switch (udma_mask) {
66 case ATA_UDMA2: t = timing->udma ? (0xc0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; 66 case ATA_UDMA2: t = timing->udma ? (0xc0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break;
67 case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 2, 10)]) : 0x03; break; 67 case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 2, 10)]) : 0x03; break;
68 case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 10)]) : 0x03; break; 68 case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 10)]) : 0x03; break;
69 case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 15)]) : 0x03; break; 69 case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 15)]) : 0x03; break;
70 default: return; 70 default: return;
71 } 71 }
72 72
@@ -179,7 +179,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev,
179 * Determine the system bus clock. 179 * Determine the system bus clock.
180 */ 180 */
181 181
182 amd_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 1000; 182 amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
183 183
184 switch (amd_clock) { 184 switch (amd_clock) {
185 case 33000: amd_clock = 33333; break; 185 case 33000: amd_clock = 33333; break;
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index b38a1980dcd5..cd1ba14984ab 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -525,12 +525,10 @@ static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
525 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count; 525 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count;
526 int bus_speed; 526 int bus_speed;
527 527
528 if (cmd640_vlb && ide_vlb_clk) 528 if (cmd640_vlb)
529 bus_speed = ide_vlb_clk; 529 bus_speed = ide_vlb_clk ? ide_vlb_clk : 50;
530 else if (!cmd640_vlb && ide_pci_clk)
531 bus_speed = ide_pci_clk;
532 else 530 else
533 bus_speed = system_bus_clock(); 531 bus_speed = ide_pci_clk ? ide_pci_clk : 33;
534 532
535 if (pio_mode > 5) 533 if (pio_mode > 5)
536 pio_mode = 5; 534 pio_mode = 5;
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 08674711d089..ca4774aa27ee 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -69,7 +69,7 @@ static u8 quantize_timing(int timing, int quant)
69static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time) 69static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time)
70{ 70{
71 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 71 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
72 int clock_time = 1000 / (ide_pci_clk ? ide_pci_clk : system_bus_clock()); 72 int clock_time = 1000 / (ide_pci_clk ? ide_pci_clk : 33);
73 u8 cycle_count, active_count, recovery_count, drwtim; 73 u8 cycle_count, active_count, recovery_count, drwtim;
74 static const u8 recovery_values[] = 74 static const u8 recovery_values[] =
75 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0}; 75 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0};
@@ -128,7 +128,7 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
128 ide_pio_timings[pio].active_time); 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(ide_pio_timings[pio].setup_time,
131 1000 / (ide_pci_clk ? ide_pci_clk : system_bus_clock())); 131 1000 / (ide_pci_clk ? ide_pci_clk : 33));
132 132
133 /* 133 /*
134 * The primary channel has individual address setup timing registers 134 * The primary channel has individual address setup timing registers
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 77cc22c2ad45..8c534afcb6c8 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -134,7 +134,7 @@ static int calc_clk(int time, int bus_speed)
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 int clk1, clk2; 136 int clk1, clk2;
137 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock(); 137 int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
138 138
139 /* we don't check against CY82C693's min and max speed, 139 /* we don't check against CY82C693's min and max speed,
140 * so you can play with the idebus=xx parameter 140 * so you can play with the idebus=xx parameter
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index c929dadaaaff..397c6cbe953c 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -759,8 +759,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
759 enable_irq (hwif->irq); 759 enable_irq (hwif->irq);
760 } 760 }
761 } else 761 } else
762 outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), 762 outb(ATA_DEVCTL_OBS | (mask ? 2 : 0), hwif->io_ports.ctl_addr);
763 hwif->io_ports.ctl_addr);
764} 763}
765 764
766/* 765/*
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index a7a41bb82778..45ba71a7182f 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -76,7 +76,7 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
76 } 76 }
77 77
78 /* be sure we're looking at the low order bits */ 78 /* be sure we're looking at the low order bits */
79 outb(drive->ctl & ~0x80, io_ports->ctl_addr); 79 outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr);
80 80
81 if (task->tf_flags & IDE_TFLAG_IN_NSECT) 81 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
82 tf->nsect = inb(io_ports->nsect_addr); 82 tf->nsect = inb(io_ports->nsect_addr);
@@ -90,7 +90,7 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
90 tf->device = superio_ide_inb(io_ports->device_addr); 90 tf->device = superio_ide_inb(io_ports->device_addr);
91 91
92 if (task->tf_flags & IDE_TFLAG_LBA48) { 92 if (task->tf_flags & IDE_TFLAG_LBA48) {
93 outb(drive->ctl | 0x80, io_ports->ctl_addr); 93 outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr);
94 94
95 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 95 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
96 tf->hob_feature = inb(io_ports->feature_addr); 96 tf->hob_feature = inb(io_ports->feature_addr);
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 910fb00deb71..1584ebb6a185 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -148,11 +148,8 @@ static void scc_ide_outb(u8 addr, unsigned long port)
148 out_be32((void*)port, addr); 148 out_be32((void*)port, addr);
149} 149}
150 150
151static void 151static void scc_ide_outbsync(ide_hwif_t *hwif, u8 addr, unsigned long port)
152scc_ide_outbsync(ide_drive_t * drive, u8 addr, unsigned long port)
153{ 152{
154 ide_hwif_t *hwif = HWIF(drive);
155
156 out_be32((void*)port, addr); 153 out_be32((void*)port, addr);
157 eieio(); 154 eieio();
158 in_be32((void*)(hwif->dma_base + 0x01c)); 155 in_be32((void*)(hwif->dma_base + 0x01c));
@@ -662,8 +659,6 @@ static void scc_tf_load(ide_drive_t *drive, ide_task_t *task)
662 if (task->tf_flags & IDE_TFLAG_FLAGGED) 659 if (task->tf_flags & IDE_TFLAG_FLAGGED)
663 HIHI = 0xFF; 660 HIHI = 0xFF;
664 661
665 ide_set_irq(drive, 1);
666
667 if (task->tf_flags & IDE_TFLAG_OUT_DATA) 662 if (task->tf_flags & IDE_TFLAG_OUT_DATA)
668 out_be32((void *)io_ports->data_addr, 663 out_be32((void *)io_ports->data_addr,
669 (tf->hob_data << 8) | tf->data); 664 (tf->hob_data << 8) | tf->data);
@@ -708,7 +703,7 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task)
708 } 703 }
709 704
710 /* be sure we're looking at the low order bits */ 705 /* be sure we're looking at the low order bits */
711 scc_ide_outb(drive->ctl & ~0x80, io_ports->ctl_addr); 706 scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr);
712 707
713 if (task->tf_flags & IDE_TFLAG_IN_NSECT) 708 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
714 tf->nsect = scc_ide_inb(io_ports->nsect_addr); 709 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
@@ -722,7 +717,7 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task)
722 tf->device = scc_ide_inb(io_ports->device_addr); 717 tf->device = scc_ide_inb(io_ports->device_addr);
723 718
724 if (task->tf_flags & IDE_TFLAG_LBA48) { 719 if (task->tf_flags & IDE_TFLAG_LBA48) {
725 scc_ide_outb(drive->ctl | 0x80, io_ports->ctl_addr); 720 scc_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr);
726 721
727 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 722 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
728 tf->hob_feature = scc_ide_inb(io_ports->feature_addr); 723 tf->hob_feature = scc_ide_inb(io_ports->feature_addr);
@@ -795,7 +790,6 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
795 790
796 hwif->dma_base = dma_base; 791 hwif->dma_base = dma_base;
797 hwif->config_data = ports->ctl; 792 hwif->config_data = ports->ctl;
798 hwif->mmio = 1;
799} 793}
800 794
801/** 795/**
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 16a0bce17d69..24513e3dcd6b 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -111,7 +111,7 @@ sgiioc4_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
111static void 111static void
112sgiioc4_maskproc(ide_drive_t * drive, int mask) 112sgiioc4_maskproc(ide_drive_t * drive, int mask)
113{ 113{
114 writeb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), 114 writeb(ATA_DEVCTL_OBS | (mask ? 2 : 0),
115 (void __iomem *)drive->hwif->io_ports.ctl_addr); 115 (void __iomem *)drive->hwif->io_ports.ctl_addr);
116} 116}
117 117
@@ -369,8 +369,7 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
369 hwif->sg_max_nents = IOC4_PRD_ENTRIES; 369 hwif->sg_max_nents = IOC4_PRD_ENTRIES;
370 370
371 pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, 371 pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE,
372 (dma_addr_t *) &(hwif->dma_status)); 372 (dma_addr_t *)&hwif->extra_base);
373
374 if (pad) { 373 if (pad) {
375 ide_set_hwifdata(hwif, pad); 374 ide_set_hwifdata(hwif, pad);
376 return 0; 375 return 0;
@@ -439,7 +438,7 @@ sgiioc4_configure_for_dma(int dma_direction, ide_drive_t * drive)
439 438
440 /* Address of the Ending DMA */ 439 /* Address of the Ending DMA */
441 memset(ide_get_hwifdata(hwif), 0, IOC4_IDE_CACHELINE_SIZE); 440 memset(ide_get_hwifdata(hwif), 0, IOC4_IDE_CACHELINE_SIZE);
442 ending_dma_addr = cpu_to_le32(hwif->dma_status); 441 ending_dma_addr = cpu_to_le32(hwif->extra_base);
443 writel(ending_dma_addr, (void __iomem *)(dma_base + IOC4_DMA_END_ADDR * 4)); 442 writel(ending_dma_addr, (void __iomem *)(dma_base + IOC4_DMA_END_ADDR * 4));
444 443
445 writel(dma_direction, (void __iomem *)ioc4_dma_addr); 444 writel(dma_direction, (void __iomem *)ioc4_dma_addr);
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 0006b9e58567..b75e9bb390a7 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -94,7 +94,7 @@ static unsigned long siimage_selreg(ide_hwif_t *hwif, int r)
94 unsigned long base = (unsigned long)hwif->hwif_data; 94 unsigned long base = (unsigned long)hwif->hwif_data;
95 95
96 base += 0xA0 + r; 96 base += 0xA0 + r;
97 if (hwif->mmio) 97 if (hwif->host_flags & IDE_HFLAG_MMIO)
98 base += hwif->channel << 6; 98 base += hwif->channel << 6;
99 else 99 else
100 base += hwif->channel << 4; 100 base += hwif->channel << 4;
@@ -117,7 +117,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
117 unsigned long base = (unsigned long)hwif->hwif_data; 117 unsigned long base = (unsigned long)hwif->hwif_data;
118 118
119 base += 0xA0 + r; 119 base += 0xA0 + r;
120 if (hwif->mmio) 120 if (hwif->host_flags & IDE_HFLAG_MMIO)
121 base += hwif->channel << 6; 121 base += hwif->channel << 6;
122 else 122 else
123 base += hwif->channel << 4; 123 base += hwif->channel << 4;
@@ -190,7 +190,9 @@ static u8 sil_pata_udma_filter(ide_drive_t *drive)
190 unsigned long base = (unsigned long)hwif->hwif_data; 190 unsigned long base = (unsigned long)hwif->hwif_data;
191 u8 scsc, mask = 0; 191 u8 scsc, mask = 0;
192 192
193 scsc = sil_ioread8(dev, base + (hwif->mmio ? 0x4A : 0x8A)); 193 base += (hwif->host_flags & IDE_HFLAG_MMIO) ? 0x4A : 0x8A;
194
195 scsc = sil_ioread8(dev, base);
194 196
195 switch (scsc & 0x30) { 197 switch (scsc & 0x30) {
196 case 0x10: /* 133 */ 198 case 0x10: /* 133 */
@@ -238,8 +240,9 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
238 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 240 unsigned long tfaddr = siimage_selreg(hwif, 0x02);
239 unsigned long base = (unsigned long)hwif->hwif_data; 241 unsigned long base = (unsigned long)hwif->hwif_data;
240 u8 tf_pio = pio; 242 u8 tf_pio = pio;
241 u8 addr_mask = hwif->channel ? (hwif->mmio ? 0xF4 : 0x84) 243 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
242 : (hwif->mmio ? 0xB4 : 0x80); 244 u8 addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84)
245 : (mmio ? 0xB4 : 0x80);
243 u8 mode = 0; 246 u8 mode = 0;
244 u8 unit = drive->select.b.unit; 247 u8 unit = drive->select.b.unit;
245 248
@@ -290,13 +293,13 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
290 u16 ultra = 0, multi = 0; 293 u16 ultra = 0, multi = 0;
291 u8 mode = 0, unit = drive->select.b.unit; 294 u8 mode = 0, unit = drive->select.b.unit;
292 unsigned long base = (unsigned long)hwif->hwif_data; 295 unsigned long base = (unsigned long)hwif->hwif_data;
293 u8 scsc = 0, addr_mask = hwif->channel ? 296 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
294 (hwif->mmio ? 0xF4 : 0x84) : 297 u8 scsc = 0, addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84)
295 (hwif->mmio ? 0xB4 : 0x80); 298 : (mmio ? 0xB4 : 0x80);
296 unsigned long ma = siimage_seldev(drive, 0x08); 299 unsigned long ma = siimage_seldev(drive, 0x08);
297 unsigned long ua = siimage_seldev(drive, 0x0C); 300 unsigned long ua = siimage_seldev(drive, 0x0C);
298 301
299 scsc = sil_ioread8 (dev, base + (hwif->mmio ? 0x4A : 0x8A)); 302 scsc = sil_ioread8 (dev, base + (mmio ? 0x4A : 0x8A));
300 mode = sil_ioread8 (dev, base + addr_mask); 303 mode = sil_ioread8 (dev, base + addr_mask);
301 multi = sil_ioread16(dev, ma); 304 multi = sil_ioread16(dev, ma);
302 ultra = sil_ioread16(dev, ua); 305 ultra = sil_ioread16(dev, ua);
@@ -391,7 +394,7 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive)
391 394
392static int siimage_dma_test_irq(ide_drive_t *drive) 395static int siimage_dma_test_irq(ide_drive_t *drive)
393{ 396{
394 if (drive->hwif->mmio) 397 if (drive->hwif->host_flags & IDE_HFLAG_MMIO)
395 return siimage_mmio_dma_test_irq(drive); 398 return siimage_mmio_dma_test_irq(drive);
396 else 399 else
397 return siimage_io_dma_test_irq(drive); 400 return siimage_io_dma_test_irq(drive);
@@ -640,8 +643,6 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
640 hwif->irq = dev->irq; 643 hwif->irq = dev->irq;
641 644
642 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00); 645 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
643
644 hwif->mmio = 1;
645} 646}
646 647
647static int is_dev_seagate_sata(ide_drive_t *drive) 648static int is_dev_seagate_sata(ide_drive_t *drive)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 566e0ecb8db1..3ed9728abd24 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -120,21 +120,21 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing)
120 120
121 if (~vdev->via_config->flags & VIA_BAD_AST) { 121 if (~vdev->via_config->flags & VIA_BAD_AST) {
122 pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); 122 pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t);
123 t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); 123 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
124 pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); 124 pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t);
125 } 125 }
126 126
127 pci_write_config_byte(dev, VIA_8BIT_TIMING + (1 - (dn >> 1)), 127 pci_write_config_byte(dev, VIA_8BIT_TIMING + (1 - (dn >> 1)),
128 ((FIT(timing->act8b, 1, 16) - 1) << 4) | (FIT(timing->rec8b, 1, 16) - 1)); 128 ((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1));
129 129
130 pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), 130 pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn),
131 ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); 131 ((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1));
132 132
133 switch (vdev->via_config->udma_mask) { 133 switch (vdev->via_config->udma_mask) {
134 case ATA_UDMA2: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; 134 case ATA_UDMA2: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break;
135 case ATA_UDMA4: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; 135 case ATA_UDMA4: t = timing->udma ? (0xe8 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x0f; break;
136 case ATA_UDMA5: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; 136 case ATA_UDMA5: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x07; break;
137 case ATA_UDMA6: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; 137 case ATA_UDMA6: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x07; break;
138 default: return; 138 default: return;
139 } 139 }
140 140
@@ -340,7 +340,7 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
340 * Determine system bus clock. 340 * Determine system bus clock.
341 */ 341 */
342 342
343 via_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 1000; 343 via_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
344 344
345 switch (via_clock) { 345 switch (via_clock) {
346 case 33000: via_clock = 33333; break; 346 case 33000: via_clock = 33333; break;