linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, mlord@pobox.com, albertcc@tw.ibm.com,
	alan@lxorguk.ukuu.org.uk, axboe@suse.de, forrest.zhao@intel.com,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 09/13] sata_sil: convert to new probing mechanism and add hotplug support
Date: Sat, 20 May 2006 00:48:27 +0900	[thread overview]
Message-ID: <11480537073457-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11480537063293-git-send-email-htejun@gmail.com>

Convert to new probing mechanism and add hotplug support by enabling
SATA IRQ for SError.N, marking ehi for hotplug and scheduling EH on
SATA IRQs.

Sil3112/3512/3114 family of controllers use COMRESET as TF clearing
point and can reliably wait for FIS34 after COMRESET whether the FIS
is the first FIS34 after POR or in response to the COMRESET.  Thus,
setting ATA_FLAG_HRST_TO_RESUME is enough for device detection after
hotplug.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/sata_sil.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

a5ad0f182f2fb6b60a6ac93a25da973759812594
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 96fbeb6..3a9a949 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -56,7 +56,7 @@ enum {
 	SIL_FLAG_MOD15WRITE	= (1 << 30),
 
 	SIL_DFL_HOST_FLAGS	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-				  ATA_FLAG_MMIO,
+				  ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME,
 
 	/*
 	 * Controller IDs
@@ -186,7 +186,6 @@ static const struct ata_port_operations 
 	.check_status		= ata_check_status,
 	.exec_command		= ata_exec_command,
 	.dev_select		= ata_std_dev_select,
-	.probe_reset		= ata_std_probe_reset,
 	.post_set_mode		= sil_post_set_mode,
 	.bmdma_setup            = ata_bmdma_setup,
 	.bmdma_start            = ata_bmdma_start,
@@ -343,6 +342,11 @@ static void sil_host_intr(struct ata_por
 	struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
 	u8 status;
 
+	if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
+		ata_ehi_hotplugged(&ap->eh_info);
+		goto freeze;
+	}
+
 	if (unlikely(!qc || qc->tf.ctl & ATA_NIEN))
 		goto freeze;
 
@@ -416,7 +420,7 @@ static irqreturn_t sil_interrupt(int irq
 		if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED))
 			continue;
 
-		if (!(bmdma2 & SIL_DMA_COMPLETE))
+		if (!(bmdma2 & (SIL_DMA_COMPLETE | SIL_DMA_SATA_IRQ)))
 			continue;
 
 		sil_host_intr(ap, bmdma2);
@@ -433,6 +437,9 @@ static void sil_freeze(struct ata_port *
 	void __iomem *mmio_base = ap->host_set->mmio_base;
 	u32 tmp;
 
+	/* global IRQ mask doesn't block SATA IRQ, turn off explicitly */
+	writel(0, mmio_base + sil_port[ap->port_no].sien);
+
 	/* plug IRQ */
 	tmp = readl(mmio_base + SIL_SYSCFG);
 	tmp |= SIL_MASK_IDE0_INT << ap->port_no;
@@ -449,6 +456,9 @@ static void sil_thaw(struct ata_port *ap
 	ata_chk_status(ap);
 	ata_bmdma_irq_clear(ap);
 
+	/* turn on SATA IRQ */
+	writel(SIL_SIEN_N, mmio_base + sil_port[ap->port_no].sien);
+
 	/* turn on IRQ */
 	tmp = readl(mmio_base + SIL_SYSCFG);
 	tmp &= ~(SIL_MASK_IDE0_INT << ap->port_no);
@@ -622,11 +632,6 @@ static int sil_init_one (struct pci_dev 
 			       mmio_base + sil_port[2].bmdma);
 	}
 
-	/* mask all SATA phy-related interrupts */
-	/* TODO: unmask bit 6 (SError N bit) for hotplug */
-	for (i = 0; i < probe_ent->n_ports; i++)
-		writel(0, mmio_base + sil_port[i].sien);
-
 	pci_set_master(pdev);
 
 	/* FIXME: check ata_device_add return value */
-- 
1.3.2



  reply	other threads:[~2006-05-19 15:48 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-19 15:48 [PATCHSET 03/03] add hotplug support, take 3 Tejun Heo
2006-05-19 15:48 ` Tejun Heo [this message]
2006-05-19 15:48 ` [PATCH 06/13] libata-hp: implement bootplug Tejun Heo
2006-05-19 16:09   ` Jeff Garzik
2006-05-19 15:48 ` [PATCH 03/13] libata-hp: implement SCSI part of hotplug Tejun Heo
2006-05-19 16:05   ` Jeff Garzik
2006-05-23 14:52     ` Tejun Heo
2006-05-19 15:48 ` [PATCH 01/13] libata-hp: implement ata_eh_detach_dev() Tejun Heo
2006-05-19 15:48 ` [PATCH 07/13] libata-hp: implement unload-unplug Tejun Heo
2006-05-19 16:10   ` Jeff Garzik
2006-05-23 14:53     ` Tejun Heo
2006-05-19 15:48 ` [PATCH 02/13] libata-hp: implement hotplug Tejun Heo
2006-05-19 16:04   ` Jeff Garzik
2006-05-19 15:48 ` [PATCH 05/13] libata-hp: hook warmplug Tejun Heo
2006-05-19 15:48 ` [PATCH 04/13] libata-hp: implement warmplug Tejun Heo
2006-05-19 15:48 ` [PATCH 08/13] ata_piix: convert ata_piix to new probing mechanism Tejun Heo
2006-05-19 15:48 ` [PATCH 13/13] libata-hp: move ata_do_reset() to libata-eh.c Tejun Heo
2006-05-19 16:13   ` Jeff Garzik
2006-05-19 20:13     ` [PATCH 0/7] sata_mv: assorted fixes Mark Lord
2006-05-19 20:21       ` [PATCH 1/7] sata_mv: prevent unnecessary double-resets Mark Lord
2006-05-19 20:24       ` [PATCH 2/7] sata_mv: deal with interrupt coalescing interrupts Mark Lord
2006-05-20  4:32         ` Jeff Garzik
2006-05-20 13:13           ` Mark Lord
2006-05-20 13:24             ` Jeff Garzik
2006-05-20 14:01               ` Mark Lord
2006-05-22  6:35                 ` Jeff Garzik
2006-05-19 20:29       ` [PATCH 3/7] sata_mv: chip initialization fixes Mark Lord
2006-05-19 20:33       ` [PATCH 4/7] sata_mv: spurious interrupt workaround Mark Lord
2006-05-19 20:36       ` [PATCH 5/7] sata_mv: remove local copy of queue indexes Mark Lord
2006-05-19 20:40       ` [PATCH 6/7] sata_mv: endian fix Mark Lord
2006-05-19 20:41       ` [PATCH 7/7] sata_mv: version bump Mark Lord
2006-05-19 15:48 ` [PATCH 11/13] sata_sil24: convert to new probing mechanism and add hotplug support Tejun Heo
2006-05-19 15:48 ` [PATCH 10/13] ahci: " Tejun Heo
2006-05-19 15:48 ` [PATCH 12/13] libata-hp: killl ops->probe_reset Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2006-05-31 11:25 [PATCHSET 03/03] add hotplug support, take 5 Tejun Heo
2006-05-31 11:25 ` [PATCH 09/13] sata_sil: convert to new probing mechanism and add hotplug support Tejun Heo
2006-05-29  6:38 [PATCHSET 03/03] add hotplug support, take 4 Tejun Heo
2006-05-29  6:38 ` [PATCH 09/13] sata_sil: convert to new probing mechanism and add hotplug support Tejun Heo
2006-05-30  4:26   ` Jeff Garzik
2006-05-11 15:32 [PATCHSET 08/11] add hotplug support, take 2 Tejun Heo
2006-05-11 15:32 ` [PATCH 09/13] sata_sil: convert to new probing mechanism and add hotplug support 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=11480537073457-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=forrest.zhao@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mlord@pobox.com \
    /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).