aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide.c12
-rw-r--r--drivers/ide/legacy/ali14xx.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c4
-rw-r--r--drivers/ide/legacy/qd65xx.c24
-rw-r--r--drivers/ide/pci/aec62xx.c2
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/amd74xx.c2
-rw-r--r--drivers/ide/pci/cmd640.c9
-rw-r--r--drivers/ide/pci/cmd64x.c6
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c2
12 files changed, 46 insertions, 23 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8eb7f83b0dda..3d1fc5fdc2b2 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1116,6 +1116,18 @@ static void ide_port_class_release(struct device *portdev)
1116 put_device(&hwif->gendev); 1116 put_device(&hwif->gendev);
1117} 1117}
1118 1118
1119int ide_vlb_clk;
1120EXPORT_SYMBOL_GPL(ide_vlb_clk);
1121
1122module_param_named(vlb_clock, ide_vlb_clk, int, 0);
1123MODULE_PARM_DESC(vlb_clock, "VLB clock frequency (in MHz)");
1124
1125int ide_pci_clk;
1126EXPORT_SYMBOL_GPL(ide_pci_clk);
1127
1128module_param_named(pci_clock, ide_pci_clk, int, 0);
1129MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
1130
1119static unsigned int ide_ignore_cable; 1131static unsigned int ide_ignore_cable;
1120 1132
1121static int ide_set_ignore_cable(const char *s, struct kernel_param *kp) 1133static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index c6898639b799..d2756c9962e3 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -116,7 +116,7 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
116 int time1, time2; 116 int time1, time2;
117 u8 param1, param2, param3, param4; 117 u8 param1, param2, param3, param4;
118 unsigned long flags; 118 unsigned long flags;
119 int bus_speed = system_bus_clock(); 119 int bus_speed = ide_vlb_clk ? ide_vlb_clk : system_bus_clock();
120 120
121 /* calculate timing, according to PIO mode */ 121 /* calculate timing, according to PIO mode */
122 time1 = ide_pio_cycle_time(drive, pio); 122 time1 = ide_pio_cycle_time(drive, pio);
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 8b2a5b484d9f..d626c760bce8 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -212,8 +212,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
212{ 212{
213 int active_time, recovery_time; 213 int active_time, recovery_time;
214 int active_cycles, recovery_cycles; 214 int active_cycles, recovery_cycles;
215 int bus_speed = system_bus_clock(); 215 int bus_speed = ide_vlb_clk ? ide_vlb_clk : system_bus_clock();
216 216
217 if (pio) { 217 if (pio) {
218 unsigned int cycle_time; 218 unsigned int cycle_time;
219 219
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 61d5889834e4..5621963f755f 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -114,17 +114,18 @@ static void qd65xx_select(ide_drive_t *drive)
114 114
115static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time) 115static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time)
116{ 116{
117 u8 active_cycle,recovery_cycle; 117 int clk = ide_vlb_clk ? ide_vlb_clk : system_bus_clock();
118 u8 act_cyc, rec_cyc;
118 119
119 if (system_bus_clock()<=33) { 120 if (clk <= 33) {
120 active_cycle = 9 - IDE_IN(active_time * system_bus_clock() / 1000 + 1, 2, 9); 121 act_cyc = 9 - IDE_IN(active_time * clk / 1000 + 1, 2, 9);
121 recovery_cycle = 15 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 0, 15); 122 rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 0, 15);
122 } else { 123 } else {
123 active_cycle = 8 - IDE_IN(active_time * system_bus_clock() / 1000 + 1, 1, 8); 124 act_cyc = 8 - IDE_IN(active_time * clk / 1000 + 1, 1, 8);
124 recovery_cycle = 18 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 3, 18); 125 rec_cyc = 18 - IDE_IN(recovery_time * clk / 1000 + 1, 3, 18);
125 } 126 }
126 127
127 return((recovery_cycle<<4) | 0x08 | active_cycle); 128 return (rec_cyc << 4) | 0x08 | act_cyc;
128} 129}
129 130
130/* 131/*
@@ -135,10 +136,13 @@ static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery
135 136
136static u8 qd6580_compute_timing (int active_time, int recovery_time) 137static u8 qd6580_compute_timing (int active_time, int recovery_time)
137{ 138{
138 u8 active_cycle = 17 - IDE_IN(active_time * system_bus_clock() / 1000 + 1, 2, 17); 139 int clk = ide_vlb_clk ? ide_vlb_clk : system_bus_clock();
139 u8 recovery_cycle = 15 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 2, 15); 140 u8 act_cyc, rec_cyc;
140 141
141 return((recovery_cycle<<4) | active_cycle); 142 act_cyc = 17 - IDE_IN(active_time * clk / 1000 + 1, 2, 17);
143 rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 2, 15);
144
145 return (rec_cyc << 4) | act_cyc;
142} 146}
143 147
144/* 148/*
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index ca16f37f9486..7f46c224b7c4 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 = system_bus_clock(); 143 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock();
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 b5a3bc33e167..075dcf9802f0 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -294,7 +294,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
294 int s_time, a_time, c_time; 294 int s_time, a_time, c_time;
295 u8 s_clc, a_clc, r_clc; 295 u8 s_clc, a_clc, r_clc;
296 unsigned long flags; 296 unsigned long flags;
297 int bus_speed = system_bus_clock(); 297 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock();
298 int port = hwif->channel ? 0x5c : 0x58; 298 int port = hwif->channel ? 0x5c : 0x58;
299 int portFIFO = hwif->channel ? 0x55 : 0x54; 299 int portFIFO = hwif->channel ? 0x55 : 0x54;
300 u8 cd_dma_fifo = 0; 300 u8 cd_dma_fifo = 0;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index f7c883808b02..efcf54338be7 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -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 = system_bus_clock() * 1000; 182 amd_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 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 0f6f11e69807..6e7a6faa480e 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -552,7 +552,14 @@ static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
552{ 552{
553 int setup_time, active_time, recovery_time, clock_time; 553 int setup_time, active_time, recovery_time, clock_time;
554 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count; 554 u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count;
555 int bus_speed = system_bus_clock(); 555 int bus_speed;
556
557 if (cmd640_vlb && ide_vlb_clk)
558 bus_speed = ide_vlb_clk;
559 else if (!cmd640_vlb && ide_pci_clk)
560 bus_speed = ide_pci_clk;
561 else
562 bus_speed = system_bus_clock();
556 563
557 if (pio_mode > 5) 564 if (pio_mode > 5)
558 pio_mode = 5; 565 pio_mode = 5;
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 006fb62656bc..08674711d089 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -68,8 +68,8 @@ static u8 quantize_timing(int timing, int quant)
68 */ 68 */
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 / system_bus_clock(); 72 int clock_time = 1000 / (ide_pci_clk ? ide_pci_clk : system_bus_clock());
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 / system_bus_clock()); 131 1000 / (ide_pci_clk ? ide_pci_clk : system_bus_clock()));
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 e30eae5a01b6..8ef551ab9571 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -136,7 +136,7 @@ static int calc_clk(int time, int bus_speed)
136static void compute_clocks(u8 pio, pio_clocks_t *p_pclk) 136static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
137{ 137{
138 int clk1, clk2; 138 int clk1, clk2;
139 int bus_speed = system_bus_clock(); /* get speed of PCI bus */ 139 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock();
140 140
141 /* we don't check against CY82C693's min and max speed, 141 /* we don't check against CY82C693's min and max speed,
142 * so you can play with the idebus=xx parameter 142 * so you can play with the idebus=xx parameter
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 9edacba20ffb..f766be9afaf9 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -210,7 +210,7 @@ static void compute_clocks(int pio, pio_clocks_t *clks)
210{ 210{
211 if (pio != PIO_NOT_EXIST) { 211 if (pio != PIO_NOT_EXIST) {
212 int adr_setup, data_pls; 212 int adr_setup, data_pls;
213 int bus_speed = system_bus_clock(); 213 int bus_speed = ide_pci_clk ? ide_pci_clk : system_bus_clock();
214 214
215 adr_setup = ide_pio_timings[pio].setup_time; 215 adr_setup = ide_pio_timings[pio].setup_time;
216 data_pls = ide_pio_timings[pio].active_time; 216 data_pls = ide_pio_timings[pio].active_time;
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index bbd17bec6ffe..566e0ecb8db1 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -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 = system_bus_clock() * 1000; 343 via_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 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;