aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide.c71
-rw-r--r--drivers/ide/legacy/ali14xx.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c2
-rw-r--r--drivers/ide/legacy/qd65xx.c4
-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.c8
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c2
11 files changed, 15 insertions, 86 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8823df1b8716..f65be738b16a 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -86,9 +86,6 @@ static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR,
86 IDE6_MAJOR, IDE7_MAJOR, 86 IDE6_MAJOR, IDE7_MAJOR,
87 IDE8_MAJOR, IDE9_MAJOR }; 87 IDE8_MAJOR, IDE9_MAJOR };
88 88
89static int idebus_parameter; /* holds the "idebus=" parameter */
90static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */
91
92DEFINE_MUTEX(ide_cfg_mtx); 89DEFINE_MUTEX(ide_cfg_mtx);
93 __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); 90 __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
94 91
@@ -189,38 +186,6 @@ static void __init init_ide_data (void)
189 } 186 }
190} 187}
191 188
192/**
193 * ide_system_bus_speed - guess bus speed
194 *
195 * ide_system_bus_speed() returns what we think is the system VESA/PCI
196 * bus speed (in MHz). This is used for calculating interface PIO timings.
197 * The default is 40 for known PCI systems, 50 otherwise.
198 * The "idebus=xx" parameter can be used to override this value.
199 * The actual value to be used is computed/displayed the first time
200 * through. Drivers should only use this as a last resort.
201 *
202 * Returns a guessed speed in MHz.
203 */
204
205static int ide_system_bus_speed(void)
206{
207#ifdef CONFIG_PCI
208 static struct pci_device_id pci_default[] = {
209 { PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
210 { }
211 };
212#else
213#define pci_default 0
214#endif /* CONFIG_PCI */
215
216 /* user supplied value */
217 if (idebus_parameter)
218 return idebus_parameter;
219
220 /* safe default value for PCI or VESA and PCI*/
221 return pci_dev_present(pci_default) ? 33 : 50;
222}
223
224void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) 189void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
225{ 190{
226 ide_hwgroup_t *hwgroup = hwif->hwgroup; 191 ide_hwgroup_t *hwgroup = hwif->hwgroup;
@@ -540,20 +505,6 @@ static int set_unmaskirq(ide_drive_t *drive, int arg)
540 return 0; 505 return 0;
541} 506}
542 507
543/**
544 * system_bus_clock - clock guess
545 *
546 * External version of the bus clock guess used by very old IDE drivers
547 * for things like VLB timings. Should not be used.
548 */
549
550int system_bus_clock (void)
551{
552 return system_bus_speed;
553}
554
555EXPORT_SYMBOL(system_bus_clock);
556
557static int generic_ide_suspend(struct device *dev, pm_message_t mesg) 508static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
558{ 509{
559 ide_drive_t *drive = dev->driver_data; 510 ide_drive_t *drive = dev->driver_data;
@@ -851,7 +802,7 @@ static int __init ide_setup(char *s)
851 if (strncmp(s,"hd",2) == 0 && s[2] == '=') /* hd= is for hd.c */ 802 if (strncmp(s,"hd",2) == 0 && s[2] == '=') /* hd= is for hd.c */
852 return 0; /* driver and not us */ 803 return 0; /* driver and not us */
853 804
854 if (strncmp(s,"ide",3) && strncmp(s,"idebus",6) && strncmp(s,"hd",2)) 805 if (strncmp(s, "ide", 3) && strncmp(s, "hd", 2))
855 return 0; 806 return 0;
856 807
857 printk(KERN_INFO "ide_setup: %s", s); 808 printk(KERN_INFO "ide_setup: %s", s);
@@ -951,21 +902,6 @@ static int __init ide_setup(char *s)
951 } 902 }
952 } 903 }
953 904
954 if (s[0] != 'i' || s[1] != 'd' || s[2] != 'e')
955 goto bad_option;
956 /*
957 * Look for bus speed option: "idebus="
958 */
959 if (s[3] == 'b' && s[4] == 'u' && s[5] == 's') {
960 if (match_parm(&s[6], NULL, vals, 1) != 1)
961 goto bad_option;
962 if (vals[0] >= 20 && vals[0] <= 66) {
963 idebus_parameter = vals[0];
964 } else
965 printk(" -- BAD BUS SPEED! Expected value from 20 to 66");
966 goto obsolete_option;
967 }
968
969bad_option: 905bad_option:
970 printk(" -- BAD OPTION\n"); 906 printk(" -- BAD OPTION\n");
971 return 1; 907 return 1;
@@ -1287,11 +1223,6 @@ static int __init ide_init(void)
1287 int ret; 1223 int ret;
1288 1224
1289 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver\n"); 1225 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver\n");
1290 system_bus_speed = ide_system_bus_speed();
1291
1292 printk(KERN_INFO "ide: Assuming %dMHz system bus speed "
1293 "for PIO modes%s\n", system_bus_speed,
1294 idebus_parameter ? "" : "; override with idebus=xx");
1295 1226
1296 ret = bus_register(&ide_bus_type); 1227 ret = bus_register(&ide_bus_type);
1297 if (ret < 0) { 1228 if (ret < 0) {
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 90c65cf97448..052125fafcfa 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 = ide_vlb_clk ? ide_vlb_clk : system_bus_clock(); 119 int bus_speed = ide_vlb_clk ? ide_vlb_clk : 50;
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 4fe516df9f74..dd6dfb32e853 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -212,7 +212,7 @@ 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 = ide_vlb_clk ? ide_vlb_clk : system_bus_clock(); 215 int bus_speed = ide_vlb_clk ? ide_vlb_clk : 50;
216 216
217 if (pio) { 217 if (pio) {
218 unsigned int cycle_time; 218 unsigned int cycle_time;
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 6424af154325..51dba82f8812 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -110,7 +110,7 @@ static void qd65xx_select(ide_drive_t *drive)
110 110
111static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time) 111static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time)
112{ 112{
113 int clk = ide_vlb_clk ? ide_vlb_clk : system_bus_clock(); 113 int clk = ide_vlb_clk ? ide_vlb_clk : 50;
114 u8 act_cyc, rec_cyc; 114 u8 act_cyc, rec_cyc;
115 115
116 if (clk <= 33) { 116 if (clk <= 33) {
@@ -132,7 +132,7 @@ static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery
132 132
133static u8 qd6580_compute_timing (int active_time, int recovery_time) 133static u8 qd6580_compute_timing (int active_time, int recovery_time)
134{ 134{
135 int clk = ide_vlb_clk ? ide_vlb_clk : system_bus_clock(); 135 int clk = ide_vlb_clk ? ide_vlb_clk : 50;
136 u8 act_cyc, rec_cyc; 136 u8 act_cyc, rec_cyc;
137 137
138 act_cyc = 17 - IDE_IN(active_time * clk / 1000 + 1, 2, 17); 138 act_cyc = 17 - IDE_IN(active_time * clk / 1000 + 1, 2, 17);
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 a373101747b6..ad222206a429 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 = (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/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index e8c2570003ff..3ed9728abd24 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 = (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;