linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Marcelo Tosatti <marcelo@conectiva.com.br>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH] ppc32: Fix PowerMac mediabay driver
Date: 03 Aug 2003 16:07:59 +0200	[thread overview]
Message-ID: <1059919678.3519.128.camel@gaston> (raw)

Hi Marcelo !

The mediabay driver for PowerMac (hotswap IDE bay) got broken in 2.4.21
by the switch of ide pmac to mmio, this fixes it along with a longstanding
bug where the timeout waiting for the drive to be ready
was actually infinite.

Please apply. Note that proper operations for this driver requires
the other patch I just sent that fixes proper keeping of the "hold"
flag in hwif during ide_unregister() call.

Ben.

diff -urN linux-2.4/drivers/macintosh/mediabay.c linuxppc_benh_devel/drivers/macintosh/mediabay.c
--- linux-2.4/drivers/macintosh/mediabay.c	2003-07-08 10:50:26.000000000 +0200
+++ linuxppc_benh_devel/drivers/macintosh/mediabay.c	2003-08-03 15:12:31.000000000 +0200
@@ -109,7 +109,7 @@
 #ifdef CONFIG_BLK_DEV_IDE
 /* check the busy bit in the media-bay ide interface
    (assumes the media-bay contains an ide device) */
-#define MB_IDE_READY(i)	((inb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
+#define MB_IDE_READY(i)	((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
 #endif
 
 /* Note: All delays are not in milliseconds and converted to HZ relative
@@ -577,7 +577,8 @@
 				MBDBG("mediabay %d IDE ready\n", i);
 			}
 			break;
-	    	}
+	    	} else if (bay->timer > 0)
+	    		bay->timer--;
 	    	if (bay->timer == 0) {
 			printk("\nIDE Timeout in bay %d !\n", i);
 			MBDBG("mediabay%d: nIDE Timeout !\n", i);
@@ -756,7 +757,7 @@
 		struct media_bay_info* bay = &media_bays[n];
 		if (!np->parent || np->n_addrs == 0 || !request_OF_resource(np, 0, NULL)) {
 			np = np->next;
-			printk(KERN_ERR "media-bay: Can't request IO resource !\n");
+			printk(KERN_ERR "mediabay: Can't request IO resource !\n");
 			continue;
 		}
 		bay->mb_type = mb_ohare;
@@ -771,7 +772,7 @@
 			bay->mb_type = mb_ohare;
 			bay->ops = &ohare_mb_ops;
 		} else {
-			printk(KERN_ERR "mediabay: Unknown bay type !\n");
+			printk(KERN_ERR "media-bay: Unknown bay type !\n");
 			np = np->next;
 			continue;
 		}
@@ -782,7 +783,7 @@
 			MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
 #ifdef MB_USE_INTERRUPTS
 		if (np->n_intrs == 0) {
-			printk(KERN_ERR "media bay %d has no irq\n",n);
+			printk(KERN_ERR "media-bay %d has no irq\n",n);
 			np = np->next;
 			continue;
 		}
@@ -823,8 +824,9 @@
 		pmu_register_sleep_notifier(&mb_sleep_notifier);
 #endif /* CONFIG_PMAC_PBOOK */
 
-		kernel_thread(media_bay_task, NULL,
-			      CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+		if (kernel_thread(media_bay_task, NULL,
+			      CLONE_FS | CLONE_FILES | CLONE_SIGHAND) < 0)
+			printk(KERN_ERR "media-bay: Cannot create polling thread !\n");
 	}
 }
 


                 reply	other threads:[~2003-08-03 14:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1059919678.3519.128.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).