All of lore.kernel.org
 help / color / mirror / Atom feed
From: "zhao, forrest" <forrest.zhao@intel.com>
To: jeff@garzik.org, hare@suse.de, axboe@suse.de, htejun@gmail.com,
	jeremy@goop.org, lkml@rtr.ca
Cc: linux-ide@vger.kernel.org
Subject: [PATCH 4/6] The definition of ahci_port_suspend()
Date: Fri, 02 Jun 2006 15:45:43 +0800	[thread overview]
Message-ID: <1149234343.13451.57.camel@forrest26.sh.intel.com> (raw)

Add the definition of ahci_port_suspend(), which will be used to suspend a
port.


Signed-off-by: Forrest Zhao <forrest.zhao@intel.com>

---

 drivers/scsi/ahci.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

753c1cc8b4138938187e773a05255478a737bbe9
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 12eed7e..1d9c158 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -216,6 +216,7 @@ static int ahci_port_start(struct ata_po
 static void ahci_port_stop(struct ata_port *ap);
 static int ahci_port_standby(void __iomem *port_mmio, u32 cap);
 static int ahci_port_spinup(void __iomem *port_mmio, u32 cap);
+static int ahci_port_suspend(struct ata_port *ap, pm_message_t state);
 static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
 static u8 ahci_check_status(struct ata_port *ap);
@@ -434,7 +435,6 @@ static int ahci_port_start(struct ata_po
 	return 0;
 }
 
-
 static void ahci_port_stop(struct ata_port *ap)
 {
 	struct device *dev = ap->host_set->dev;
@@ -460,6 +460,39 @@ static void ahci_port_stop(struct ata_po
 	kfree(pp);
 }
 
+static int ahci_port_suspend(struct ata_port *ap, pm_message_t state)
+{
+	void __iomem *mmio = ap->host_set->mmio_base;
+	void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
+	struct ahci_host_priv *hpriv = ap->host_set->private_data;
+	int rc;
+
+	/*
+	 * Disable DMA
+	 */
+	rc = ahci_stop_engine(port_mmio);
+	if (rc) {
+		ata_port_printk(ap, KERN_WARNING, "DMA engine busy\n");
+		return rc;
+	}
+
+	/*
+	 * Disable FIS reception
+	 */
+	rc = ahci_stop_fis_rx(port_mmio);
+	if (rc)
+		ata_port_printk(ap, KERN_WARNING, "FIS RX still running"
+				" (%d)\n", rc);
+
+	/*
+	 * Put device into slumber mode
+	 */
+	if (!rc && state.event != PM_EVENT_FREEZE)
+		ahci_port_standby(port_mmio, hpriv->cap);
+
+	return rc;
+}
+
 static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in)
 {
 	unsigned int sc_reg;
-- 
1.2.6

             reply	other threads:[~2006-06-02  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-02  7:45 zhao, forrest [this message]
2006-06-02  8:15 ` [PATCH 4/6] The definition of ahci_port_suspend() Hannes Reinecke
2006-06-02  9:16   ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2006-06-06 10:17 zhao, forrest
2006-06-29  8:19 zhao, forrest
2006-07-10  3:35 zhao, forrest
2006-07-11  6:39 zhao, forrest
2006-07-13  5:39 zhao, forrest

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=1149234343.13451.57.camel@forrest26.sh.intel.com \
    --to=forrest.zhao@intel.com \
    --cc=axboe@suse.de \
    --cc=hare@suse.de \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=jeremy@goop.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=lkml@rtr.ca \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.