patch-2.3.10 linux/drivers/block/ide.c

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

diff -u --recursive --new-file v2.3.9/linux/drivers/block/ide.c linux/drivers/block/ide.c
@@ -297,7 +297,8 @@
 		if (!strncmp(id->model, "KODAK ATA_FLASH", 15)	/* Kodak */
 		 || !strncmp(id->model, "Hitachi CV", 10)	/* Hitachi */
 		 || !strncmp(id->model, "SunDisk SDCFB", 13)	/* SunDisk */
-		 || !strncmp(id->model, "HAGIWARA HPC", 12))	/* Hagiwara */
+		 || !strncmp(id->model, "HAGIWARA HPC", 12)	/* Hagiwara */
+		 || !strncmp(id->model, "ATA_FLASH", 9))	/* Simple Tech */
 		{
 			return 1;	/* yes, it is a flash memory card */
 		}
@@ -1353,7 +1354,7 @@
 			(void) hwgroup->hwif->dmaproc(ide_dma_end, drive);
 			printk("%s: timeout waiting for DMA\n", drive->name);
 	/*
-	 *  need something here for HX PIIX3 UDMA and HPT343.......AMH
+	 *  need something here for HPT34X.......AMH
 	 *  irq timeout: status=0x58 { DriveReady SeekComplete DataRequest }
 	 */
 		}
@@ -1898,6 +1899,7 @@
 	hwif->irq = old_hwif.irq;
 	hwif->major = old_hwif.major;
 	hwif->proc = old_hwif.proc;
+	hwif->udma_four = old_hwif.udma_four;
 	hwif->chipset = old_hwif.chipset;
 	hwif->pci_dev = old_hwif.pci_dev;
 	hwif->pci_devid = old_hwif.pci_devid;
@@ -2235,6 +2237,27 @@
 	while (0 < (signed long)(timeout - jiffies));
 }
 
+int ide_config_drive_speed (ide_drive_t *drive, byte speed)
+{
+	int err;
+
+	/*
+	 * Don't use ide_wait_cmd here - it will
+	 * attempt to set_geometry and recalibrate,
+	 * but for some reason these don't work at
+	 * this point (lost interrupt).
+	 */
+	SELECT_DRIVE(HWIF(drive), drive);
+	OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
+	OUT_BYTE(speed, IDE_NSECTOR_REG);
+	OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
+	OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
+
+	err = ide_wait_stat(drive, DRIVE_READY, BUSY_STAT|DRQ_STAT|ERR_STAT, WAIT_CMD);
+
+	return(err);
+}
+
 static int ide_ioctl (struct inode *inode, struct file *file,
 			unsigned int cmd, unsigned long arg)
 {
@@ -2317,10 +2340,15 @@
 			}
 			if ((((byte *)arg)[0] == WIN_SETFEATURES) &&
 			    (((byte *)arg)[1] > 66) &&
-			    (((byte *)arg)[2] == 3) &&
-			    ((drive->id->word93 & 0x2000) == 0)) {
-				printk("%s: Speed warnings UDMA 3/4 is not functional.\n", drive->name);
-				goto abort;
+			    (((byte *)arg)[2] == 3)) {
+				if (!HWIF(drive)->udma_four) {
+					printk("%s: Speed warnings UDMA 3/4 is not functional.\n", HWIF(drive)->name);
+					goto abort;
+				}
+				if ((drive->id->word93 & 0x2000) == 0) {
+					printk("%s: Speed warnings UDMA 3/4 is not functional.\n", drive->name);
+					goto abort;
+				}
 			}
 			err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf);
 			if (!err &&
@@ -2581,6 +2609,9 @@
  *
  * "hdx=swapdata"	: when the drive is a disk, byte swap all data
  * "hdx=bswap"		: same as above..........
+ * "hdx=flash"		: allows for more than one ata_flash disk to be
+ *				registered. In most cases, only one device
+ *				will be present.
  *
  * "idebus=xx"		: inform IDE driver of VESA/PCI bus speed in MHz,
  *				where "xx" is between 20 and 66 inclusive,
@@ -2667,7 +2698,7 @@
 	if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) {
 		const char *hd_words[] = {"none", "noprobe", "nowerr", "cdrom",
 				"serialize", "autotune", "noautotune",
-				"slow", "swapdata", "bswap", NULL};
+				"slow", "swapdata", "bswap", "flash", NULL};
 		unit = s[2] - 'a';
 		hw   = unit / MAX_DRIVES;
 		unit = unit % MAX_DRIVES;
@@ -2708,6 +2739,9 @@
 			case -10:
 				drive->bswap = 1;
 				goto done;
+			case -11:
+				drive->ata_flash = 1;
+				goto done;
 			case 3: /* cyl,head,sect */
 				drive->media	= ide_disk;
 				drive->cyl	= drive->bios_cyl  = vals[0];
@@ -3416,6 +3450,7 @@
 EXPORT_SYMBOL(ide_cmd);
 EXPORT_SYMBOL(ide_wait_cmd);
 EXPORT_SYMBOL(ide_delay_50ms);
+EXPORT_SYMBOL(ide_config_drive_speed);
 EXPORT_SYMBOL(ide_stall_queue);
 #ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(ide_add_proc_entries);

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