[PATCH V6 Resend 3/4] [SCSI] ufs: Add Platform glue driver for ufshcd

2013-02-25 Thread Vinayak Holikatti
This patch adds Platform glue driver for ufshcd.

Reviewed-by: Arnd Bergmann a...@arndb.de
Reviewed-by: Namjae Jeon linkinj...@gmail.com
Reviewed-by: Subhash Jadavani subha...@codeaurora.org
Reviewed-by: Sujit Reddy Thumma sthu...@codeaurora.org
Tested-by: Maya Erez me...@codeaurora.org
Signed-off-by: Vinayak Holikatti vinholika...@gmail.com
Signed-off-by: Santosh Yaraganavi santos...@gmail.com
---
 drivers/scsi/ufs/Kconfig |   11 ++
 drivers/scsi/ufs/Makefile|1 +
 drivers/scsi/ufs/ufshcd-pltfrm.c |  217 ++
 3 files changed, 229 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.c

diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
index 0371047..35faf24 100644
--- a/drivers/scsi/ufs/Kconfig
+++ b/drivers/scsi/ufs/Kconfig
@@ -57,3 +57,14 @@ config SCSI_UFSHCD_PCI
  If you have a controller with this interface, say Y or M here.
 
  If unsure, say N.
+
+config SCSI_UFSHCD_PLATFORM
+   tristate Platform bus based UFS Controller support
+   depends on SCSI_UFSHCD
+   ---help---
+   This selects the UFS host controller support. Select this if
+   you have an UFS controller on Platform bus.
+
+   If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
index 9eda0df..1e5bd48 100644
--- a/drivers/scsi/ufs/Makefile
+++ b/drivers/scsi/ufs/Makefile
@@ -1,3 +1,4 @@
 # UFSHCD makefile
 obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o
 obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
+obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
new file mode 100644
index 000..a661b31
--- /dev/null
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -0,0 +1,217 @@
+/*
+ * Universal Flash Storage Host controller Platform bus based glue driver
+ *
+ * This code is based on drivers/scsi/ufs/ufshcd-pltfrm.c
+ * Copyright (C) 2011-2013 Samsung India Software Operations
+ *
+ * Authors:
+ * Santosh Yaraganavi santosh...@samsung.com
+ * Vinayak Holikatti h.vina...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * See the COPYING file in the top-level directory or visit
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This program is provided AS IS and WITH ALL FAULTS and
+ * without warranty of any kind. You are solely responsible for
+ * determining the appropriateness of using and distributing
+ * the program and assume all risks associated with your exercise
+ * of rights with respect to the program, including but not limited
+ * to infringement of third party rights, the risks and costs of
+ * program errors, damage to or loss of data, programs or equipment,
+ * and unavailability or interruption of operations. Under no
+ * circumstances will the contributor of this Program be liable for
+ * any damages of any kind arising from your use or distribution of
+ * this program.
+ */
+
+#include ufshcd.h
+#include linux/platform_device.h
+
+#ifdef CONFIG_PM
+/**
+ * ufshcd_pltfrm_suspend - suspend power management function
+ * @pdev: pointer to Platform device handle
+ * @mesg: power state
+ *
+ * Returns 0
+ */
+static int ufshcd_pltfrm_suspend(struct platform_device *pdev,
+pm_message_t mesg)
+{
+   struct ufs_hba *hba =  platform_get_drvdata(pdev);
+
+   /*
+* TODO:
+* 1. Call ufshcd_suspend
+* 2. Do bus specific power management
+*/
+
+   disable_irq(hba-irq);
+
+   return 0;
+}
+
+/**
+ * ufshcd_pltfrm_resume - resume power management function
+ * @pdev: pointer to Platform device handle
+ *
+ * Returns 0
+ */
+static int ufshcd_pltfrm_resume(struct platform_device *pdev)
+{
+   struct ufs_hba *hba =  platform_get_drvdata(pdev);
+
+   /*
+* TODO:
+* 1. Call ufshcd_resume.
+* 2. Do bus specific wake up
+*/
+
+   enable_irq(hba-irq);
+
+   return 0;
+}
+#else
+#define ufshcd_pltfrm_suspend  NULL
+#define ufshcd_pltfrm_resume   NULL
+#endif
+
+/**
+ * ufshcd_pltfrm_probe - probe routine of the driver
+ * @pdev: pointer to Platform device handle
+ *
+ * Returns 0 on success, non-zero value on failure
+ */
+static int __devinit
+ufshcd_pltfrm_probe(struct platform_device *pdev)
+{
+   struct ufs_hba *hba;
+   void __iomem *mmio_base;
+   struct resource *mem_res;
+   struct resource *irq_res;
+   

Re: [PATCH V6 Resend 3/4] [SCSI] ufs: Add Platform glue driver for ufshcd

2013-02-25 Thread James Bottomley
On Mon, 2013-02-25 at 21:44 +0530, Vinayak Holikatti wrote:
 This patch adds Platform glue driver for ufshcd.

Even after fixing the __devXX issues, I still get this:

rivers/scsi/ufs/ufshcd-pltfrm.c:196:2: warning: initialization from
incompatible pointer type [enabled by default]
drivers/scsi/ufs/ufshcd-pltfrm.c:196:2: warning: (near initialization
for ‘ufshcd_dev_pm_ops.suspend’) [enabled by default]
drivers/scsi/ufs/ufshcd-pltfrm.c:197:2: warning: initialization from
incompatible pointer type [enabled by default]
drivers/scsi/ufs/ufshcd-pltfrm.c:197:2: warning: (near initialization
for ‘ufshcd_dev_pm_ops.resume’) [enabled by default]

That's apparently because the function protoypes are wrong.  I'm not
sure why this is, but I stopped applying here, please fix.

Thanks,

James


--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html