linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Vinayak Holikatti <vinholikatti@gmail.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@infradead.org>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	Subhash Jadavani <subhashj@codeaurora.org>,
	Santosh Yaragnavi <santosh.sy@samsung.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Szymon Mielczarek <szymonx.mielczarek@intel.com>,
	Michal Potomski <michalx.potomski@intel.com>,
	Grzegorz Janca <grzegorz.janca@intel.com>
Subject: [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support
Date: Tue,  6 Jun 2017 14:35:31 +0300	[thread overview]
Message-ID: <1496748931-17162-3-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1496748931-17162-1-git-send-email-adrian.hunter@intel.com>

Add PCI id and variant ops for Intel CNL UFS host controller.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/scsi/ufs/ufshcd-pci.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 0dcff829f8b6..925b0ec7ec54 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -37,6 +37,41 @@
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 
+static int ufs_intel_disable_lcc(struct ufs_hba *hba)
+{
+	u32 attr = UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE);
+	u32 lcc_enable = 0;
+
+	ufshcd_dme_get(hba, attr, &lcc_enable);
+	if (lcc_enable)
+		ufshcd_dme_set(hba, attr, 0);
+
+	return 0;
+}
+
+static int ufs_intel_link_startup_notify(struct ufs_hba *hba,
+					 enum ufs_notify_change_status status)
+{
+	int err = 0;
+
+	switch (status) {
+	case PRE_CHANGE:
+		err = ufs_intel_disable_lcc(hba);
+		break;
+	case POST_CHANGE:
+		break;
+	default:
+		break;
+	}
+
+	return err;
+}
+
+static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = {
+	.name                   = "intel-pci",
+	.link_startup_notify	= ufs_intel_link_startup_notify,
+};
+
 #ifdef CONFIG_PM_SLEEP
 /**
  * ufshcd_pci_suspend - suspend power management function
@@ -139,6 +174,8 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
 		return err;
 	}
 
+	hba->vops = (struct ufs_hba_variant_ops *)id->driver_data;
+
 	err = ufshcd_init(hba, mmio_base, pdev->irq);
 	if (err) {
 		dev_err(&pdev->dev, "Initialization failed\n");
@@ -163,6 +200,7 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
 
 static const struct pci_device_id ufshcd_pci_tbl[] = {
 	{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
 	{ }	/* terminate list */
 };
 
-- 
1.9.1

  parent reply	other threads:[~2017-06-06 11:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 11:35 [PATCH V4 0/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
2017-06-06 11:35 ` [PATCH V4 1/2] scsi: ufshcd-pci: Fix PM config Adrian Hunter
2017-06-07 13:14   ` Christoph Hellwig
2017-06-06 11:35 ` Adrian Hunter [this message]
2017-06-07 13:16   ` [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support Christoph Hellwig
2017-06-08  9:36     ` Joao Pinto
2017-06-13  1:08 ` [PATCH V4 0/2] " Martin K. Petersen

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=1496748931-17162-3-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=grzegorz.janca@intel.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michalx.potomski@intel.com \
    --cc=santosh.sy@samsung.com \
    --cc=subhashj@codeaurora.org \
    --cc=szymonx.mielczarek@intel.com \
    --cc=vinholikatti@gmail.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).