linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Tejun Heo <htejun@gmail.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/5] sil24: add sil24_restart_controller
Date: Wed, 16 Nov 2005 07:20:50 -0500	[thread overview]
Message-ID: <437B2422.6040107@pobox.com> (raw)
In-Reply-To: <20051116080244.GB22807@htj.dyndns.org>

Tejun Heo wrote:
> When an error condition is raised by device via D2H FIS or SDB.  sil24
> controller should be restarted by setting PORT_CS_INIT and waiting
> until PORT_CS_RDY is asserted instead of resetting the controller.
> This patch implements sil24_restart_controller for those cases.  This
> patch also makes sure that PORT_CS_RDY is asserted on
> sil24_reset_controller completion.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> 
> --
> 
> Jeff, the patch named "sil24: add constants" is 1/5 and should be
> applied first.  Sorry.
> 
> Index: work/drivers/scsi/sata_sil24.c
> ===================================================================
> --- work.orig/drivers/scsi/sata_sil24.c	2005-11-16 16:54:10.000000000 +0900
> +++ work/drivers/scsi/sata_sil24.c	2005-11-16 16:58:01.000000000 +0900
> @@ -486,6 +486,31 @@ static void sil24_irq_clear(struct ata_p
>  	/* unused */
>  }
>  
> +static int __sil24_restart_controller(void __iomem *port)
> +{
> +	u32 tmp;
> +	int cnt;
> +
> +	writel(PORT_CS_INIT, port + PORT_CTRL_STAT);
> +
> +	/* Max ~100ms */
> +	for (cnt = 0; cnt < 1000; cnt++) {
> +		tmp = readl(port + PORT_CTRL_STAT);
> +		if (tmp & PORT_CS_RDY)
> +			return 0;
> +		udelay(100);
> +	}
> +
> +	return -1;
> +}

NAK, this potentially soaks up an entire timer tick (~100ms).

It's probably better to schedule_work(), and poll using msleep().  Or 
you could cut the worst case down to 10ms.

FWIW, I have no idea what the max is, I don't see it in the docs :(

	Jeff



  reply	other threads:[~2005-11-16 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-16  8:02 [PATCH 2/5] sil24: add sil24_restart_controller Tejun Heo
2005-11-16 12:20 ` Jeff Garzik [this message]
2005-11-16 13:20   ` Tejun Heo
2005-11-16 13:34     ` Jeff Garzik
2005-11-16 18:26 ` Edward Falk
2005-11-18  3:21   ` Tejun Heo

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=437B2422.6040107@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=htejun@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    /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).