linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 0/2] scsi: ufshcd-pci: Add Intel CNL support
@ 2017-06-06 11:35 Adrian Hunter
  2017-06-06 11:35 ` [PATCH V4 1/2] scsi: ufshcd-pci: Fix PM config Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adrian Hunter @ 2017-06-06 11:35 UTC (permalink / raw)
  To: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi
  Cc: linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca

Hi

Here is V4 of patches to add support for Intel UFS host controllers.


Changes in V4:

	New patch "scsi: ufshcd-pci: Fix PM config"
	Do not use a separate driver for Intel

Changes in V3:

	Remove UFSHCI class code and match on PCI device ID

Changes in V2:

	Change variant name from intel to intel-pci


Adrian Hunter (2):
      scsi: ufshcd-pci: Fix PM config
      scsi: ufshcd-pci: Add Intel CNL support

 drivers/scsi/ufs/ufshcd-pci.c | 60 +++++++++++++++++++++++++++++++++----------
 1 file changed, 47 insertions(+), 13 deletions(-)


Regards
Adrian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V4 1/2] scsi: ufshcd-pci: Fix PM config
  2017-06-06 11:35 [PATCH V4 0/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
@ 2017-06-06 11:35 ` Adrian Hunter
  2017-06-07 13:14   ` Christoph Hellwig
  2017-06-06 11:35 ` [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
  2017-06-13  1:08 ` [PATCH V4 0/2] " Martin K. Petersen
  2 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2017-06-06 11:35 UTC (permalink / raw)
  To: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi
  Cc: linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca

Put PM functions under correct config options and use standard PM macros
to set callbacks.

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

diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 5dd4122cbd85..0dcff829f8b6 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -37,7 +37,7 @@
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /**
  * ufshcd_pci_suspend - suspend power management function
  * @pdev: pointer to PCI device handle
@@ -62,7 +62,9 @@ static int ufshcd_pci_resume(struct device *dev)
 {
 	return ufshcd_system_resume(dev_get_drvdata(dev));
 }
+#endif /* !CONFIG_PM_SLEEP */
 
+#ifdef CONFIG_PM
 static int ufshcd_pci_runtime_suspend(struct device *dev)
 {
 	return ufshcd_runtime_suspend(dev_get_drvdata(dev));
@@ -75,13 +77,7 @@ static int ufshcd_pci_runtime_idle(struct device *dev)
 {
 	return ufshcd_runtime_idle(dev_get_drvdata(dev));
 }
-#else /* !CONFIG_PM */
-#define ufshcd_pci_suspend	NULL
-#define ufshcd_pci_resume	NULL
-#define ufshcd_pci_runtime_suspend	NULL
-#define ufshcd_pci_runtime_resume	NULL
-#define ufshcd_pci_runtime_idle	NULL
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM */
 
 /**
  * ufshcd_pci_shutdown - main function to put the controller in reset state
@@ -158,11 +154,11 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
 }
 
 static const struct dev_pm_ops ufshcd_pci_pm_ops = {
-	.suspend	= ufshcd_pci_suspend,
-	.resume		= ufshcd_pci_resume,
-	.runtime_suspend = ufshcd_pci_runtime_suspend,
-	.runtime_resume  = ufshcd_pci_runtime_resume,
-	.runtime_idle    = ufshcd_pci_runtime_idle,
+	SET_SYSTEM_SLEEP_PM_OPS(ufshcd_pci_suspend,
+				ufshcd_pci_resume)
+	SET_RUNTIME_PM_OPS(ufshcd_pci_runtime_suspend,
+			   ufshcd_pci_runtime_resume,
+			   ufshcd_pci_runtime_idle)
 };
 
 static const struct pci_device_id ufshcd_pci_tbl[] = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support
  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-06 11:35 ` Adrian Hunter
  2017-06-07 13:16   ` Christoph Hellwig
  2017-06-13  1:08 ` [PATCH V4 0/2] " Martin K. Petersen
  2 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2017-06-06 11:35 UTC (permalink / raw)
  To: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi
  Cc: linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 1/2] scsi: ufshcd-pci: Fix PM config
  2017-06-06 11:35 ` [PATCH V4 1/2] scsi: ufshcd-pci: Fix PM config Adrian Hunter
@ 2017-06-07 13:14   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2017-06-07 13:14 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi,
	linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support
  2017-06-06 11:35 ` [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
@ 2017-06-07 13:16   ` Christoph Hellwig
  2017-06-08  9:36     ` Joao Pinto
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2017-06-07 13:16 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi,
	linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca, Joao Pinto

On Tue, Jun 06, 2017 at 02:35:31PM +0300, Adrian Hunter wrote:
> Add PCI id and variant ops for Intel CNL UFS host controller.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

It would be great if we could fold tc-dwc-g210-pci into ufshcd-pci the
same way.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support
  2017-06-07 13:16   ` Christoph Hellwig
@ 2017-06-08  9:36     ` Joao Pinto
  0 siblings, 0 replies; 7+ messages in thread
From: Joao Pinto @ 2017-06-08  9:36 UTC (permalink / raw)
  To: Christoph Hellwig, Adrian Hunter
  Cc: Vinayak Holikatti, Martin K. Petersen, James E.J. Bottomley,
	Subhash Jadavani, Santosh Yaragnavi, linux-scsi, linux-kernel,
	Szymon Mielczarek, Michal Potomski, Grzegorz Janca, Joao Pinto

Hello to all,

Às 2:16 PM de 6/7/2017, Christoph Hellwig escreveu:
> On Tue, Jun 06, 2017 at 02:35:31PM +0300, Adrian Hunter wrote:
>> Add PCI id and variant ops for Intel CNL UFS host controller.
> 
> Looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> It would be great if we could fold tc-dwc-g210-pci into ufshcd-pci the
> same way.
> 

I have forward the suggestion to the person on charge of UFS driver maintenance
at Synopsys. We will definitely have a look at it!

Thanks,
Joao

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 0/2] scsi: ufshcd-pci: Add Intel CNL support
  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-06 11:35 ` [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
@ 2017-06-13  1:08 ` Martin K. Petersen
  2 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2017-06-13  1:08 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Vinayak Holikatti, Martin K. Petersen, Christoph Hellwig,
	James E.J. Bottomley, Subhash Jadavani, Santosh Yaragnavi,
	linux-scsi, linux-kernel, Szymon Mielczarek, Michal Potomski,
	Grzegorz Janca


Adrian,

> Here is V4 of patches to add support for Intel UFS host controllers.

Applied to 4.13/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-13  1:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH V4 2/2] scsi: ufshcd-pci: Add Intel CNL support Adrian Hunter
2017-06-07 13:16   ` Christoph Hellwig
2017-06-08  9:36     ` Joao Pinto
2017-06-13  1:08 ` [PATCH V4 0/2] " Martin K. Petersen

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).