Subject: Re(4): sl82c105.c weirdness

From: Benjamin Herrenschmidt <[email-masked]>
Date: Mon, 26 Jul 1999 16:38:43 +0200

More potential problems:

When the ATA device is reset via the IDE control reg, the Winbond doc.
says that the controller is also reset to 8 bits fixed-timing i/os. 

I've added some "hackish" code to the do_reset1 function in
drivers/block/ide.c that looks like this:

#if OK_TO_RESET_CONTROLLER
	if (!IDE_CONTROL_REG) {
		__restore_flags(flags);
		return;
	}
	/*
	 * Note that we also set nIEN while resetting the device,
	 * to mask unwanted interrupts from the interface during the reset.
	 * However, due to the design of PC hardware, this will cause an
	 * immediate interrupt due to the edge transition it produces.
	 * This single interrupt gives us a "fast poll" for drives that
	 * recover from reset very quickly, saving us the first 50ms wait time.
	 */
	OUT_BYTE(drive->ctl|6,IDE_CONTROL_REG);	/* set SRST and nIEN */
	udelay(10);			/* more than enough time */
	OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG);	/* clear SRST, leave nIEN */
	udelay(10);			/* more than enough time */
	hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
	ide_set_handler (drive, &reset_pollfunc, HZ/20);
+#ifdef CONFIG_BLK_DEV_SL82C105
+	/* Winbond need a reset of the controller or secondary port will be
+	   set to 8 bits i/o which is definitely not what we want !
+	 */
+	if (hwif->pci_devid == DEVID_W82C105)
+		ide_init_sl82c105(hwif);
+#endif	
#endif	/* OK_TO_RESET_CONTROLLER */

	__restore_flags (flags);	/* local CPU only */
}

The ide_init_sl82c105() must be previously declared extern, and this
works since ide_init_sl82c105 currently does the magic of writing 0x33 in
the config register at 0x40.

I'm still having problems with a disk which is very slow to power up and
doesn't show up at all if I don't wait around 20-30secs before letting
the bios scan the IDE (a caviar). I'm trying to figure out a way to
detect that there's indeed a disk which is not ready.

-- 
           E-Mail: <mailto:[email-masked]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]