patch-2.3.28 linux/drivers/block/pdc202xx.c

Next file: linux/drivers/block/pdc4030.c
Previous file: linux/drivers/block/ide.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.27/linux/drivers/block/pdc202xx.c linux/drivers/block/pdc202xx.c
@@ -78,6 +78,7 @@
  *  Released under terms of General Public License
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
@@ -220,7 +221,7 @@
 
 	int			err;
 	unsigned int		drive_conf;
-	byte			drive_pci;
+	byte			drive_pci, speed_ok = 0;
 	byte			test1, test2, speed = -1;
 	byte			AP, BP, CP, DP, TB, TC;
 	unsigned short		EP;
@@ -278,16 +279,20 @@
 	switch(drive_number) {
 		case 0:	drive_pci = 0x60;
 			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
+			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4)) {
+				speed_ok = 1;
 				goto chipset_is_set;
+			}
 			pci_read_config_byte(dev, (drive_pci), &test1);
 			if (!(test1 & SYNC_ERRDY_EN))
 				pci_write_config_byte(dev, (drive_pci), test1|SYNC_ERRDY_EN);
 			break;
 		case 1:	drive_pci = 0x64;
 			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
+			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4)) {
+				speed_ok = 1;
 				goto chipset_is_set;
+			}
 			pci_read_config_byte(dev, 0x60, &test1);
 			pci_read_config_byte(dev, (drive_pci), &test2);
 			if ((test1 & SYNC_ERRDY_EN) && !(test2 & SYNC_ERRDY_EN))
@@ -295,16 +300,20 @@
 			break;
 		case 2:	drive_pci = 0x68;
 			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
+			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4)) {
+				speed_ok = 1;
 				goto chipset_is_set;
+			}
 			pci_read_config_byte(dev, (drive_pci), &test1);
 			if (!(test1 & SYNC_ERRDY_EN))
 				pci_write_config_byte(dev, (drive_pci), test1|SYNC_ERRDY_EN);
 			break;
 		case 3:	drive_pci = 0x6c;
 			pci_read_config_dword(dev, drive_pci, &drive_conf);
-			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
+			if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4)) {
+				speed_ok = 1;
 				goto chipset_is_set;
+			}
 			pci_read_config_byte(dev, 0x68, &test1);
 			pci_read_config_byte(dev, (drive_pci), &test2);
 			if ((test1 & SYNC_ERRDY_EN) && !(test2 & SYNC_ERRDY_EN))
@@ -402,7 +411,8 @@
 	decode_registers(REG_D, DP);
 #endif /* PDC202XX_DECODE_REGISTER_INFO */
 
-	err = ide_config_drive_speed(drive, speed);
+	if (!speed_ok)
+		err = ide_config_drive_speed(drive, speed);
 
 #if PDC202XX_DEBUG_DRIVE_INFO
 	printk("%s: %s drive%d 0x%08x ",

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)