Skip to contentSkip to conversation

ufs: Adds glue drivers to ufshcd

PATCH RESEND In review Vinayak Holikatti 2 participants 8 messages Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v6 cover ufs: Adds glue drivers to ufshcd

This patch set adds following features
- Seggregate PCI specific code in ufshcd.c and corrected copyright
- Adds PCI glue driver ufshcd-pci.c and ufshcd.c become core module
- Adds Platform glue driver ufshcd-pltfrm.c
- Update correct transfer size in Command UPIU

Vinayak Holikatti (4):
[SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code [SCSI] drivers/scsi/ufs: Separate PCI code into glue driver [SCSI] ufs: Add Platform glue driver for ufshcd [SCSI] ufs: Correct the expected data transfersize

 drivers/scsi/ufs/Kconfig         |   87 +++++---
 drivers/scsi/ufs/Makefile        |    2 +
 drivers/scsi/ufs/ufs.h           |   44 ++---
 drivers/scsi/ufs/ufshcd-pci.c    |  211 +++++++++++++++++++
 drivers/scsi/ufs/ufshcd-pltfrm.c |  217 +++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c        |  425 ++++++++------------------------------
 drivers/scsi/ufs/ufshcd.h        |  202 ++++++++++++++++++
 drivers/scsi/ufs/ufshci.h        |   44 ++---
 8 files changed, 811 insertions(+), 421 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pci.c
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.c
 create mode 100644 drivers/scsi/ufs/ufshcd.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH RESEND v6 1/4 drivers/scsi/ufs: Seggregate PCI Specific Code

This patch seggregates the PCI specific code in ufshcd.c to make it ready for splitting into core ufs driver and PCI glue driver. Also copyright header modification to remove extra warranty disclaim.

---
 drivers/scsi/ufs/Kconfig  |   50 +++----
 drivers/scsi/ufs/ufs.h    |   44 +++----
 drivers/scsi/ufs/ufshcd.c |  348 +++++++++++++++++++++++++++-----------------
 drivers/scsi/ufs/ufshci.h |   44 +++----
 4 files changed, 267 insertions(+), 219 deletions(-)
drivers/scsi/ufs/Kconfig +20 -30
index 8f27f9d..8ee40df 100644
@@ -2,45 +2,35 @@
 # Kernel configuration file for the UFS Host Controller
 #
 # This code is based on drivers/scsi/ufs/Kconfig
-# Copyright (C) 2011  Samsung Samsung India Software Operations
+# Copyright (C) 2011-2013 Samsung India Software Operations
+#
+# Authors:
+#	Santosh Yaraganavi <[email protected]>
+#	Vinayak Holikatti <[email protected]>
 #
-# Santosh Yaraganavi <[email protected]>
-# Vinayak Holikatti <[email protected]>
-
 # 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.
-
-# NO WARRANTY
-# THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
-# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
-# LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
-# solely responsible for determining the appropriateness of using and
-# distributing the Program and assumes all risks associated with its
-# exercise of rights under this Agreement, including but not limited to
-# the risks and costs of program errors, damage to or loss of data,
-# programs or equipment, and unavailability or interruption of operations.
-
-# DISCLAIMER OF LIABILITY
-# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-# USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
-# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-# USA.
+#
+# 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.
 
 config SCSI_UFSHCD
 	tristate "Universal Flash Storage host controller driver"
drivers/scsi/ufs/ufs.h +17 -27

62 lines not on this page · raw message

drivers/scsi/ufs/ufshcd.c +213 -135

655 lines not on this page · raw message

drivers/scsi/ufs/ufshci.h +17 -27

62 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#2 lore raw

PATCH RESEND v6 2/4 drivers/scsi/ufs: Separate PCI code into glue driver

In reply to Vinayak Holikatti

This patch separates PCI code from ufshcd.c and makes it as a core driver module and adds a new file ufshcd-pci.c as PCI glue driver.

---
 drivers/scsi/ufs/Kconfig      |   26 +++-
 drivers/scsi/ufs/Makefile     |    1 +
 drivers/scsi/ufs/ufshcd-pci.c |  211 ++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c     |  327 +----------------------------------------
 drivers/scsi/ufs/ufshcd.h     |  202 +++++++++++++++++++++++++
 5 files changed, 440 insertions(+), 327 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pci.c
 create mode 100644 drivers/scsi/ufs/ufshcd.h
drivers/scsi/ufs/Kconfig +23 -3
index 8ee40df..0371047 100644
@@ -33,7 +33,27 @@
 # this program.
 
 config SCSI_UFSHCD
-	tristate "Universal Flash Storage host controller driver"
-	depends on PCI && SCSI
+	tristate "Universal Flash Storage Controller Driver Core"
+	depends on SCSI
 	---help---
-	This is a generic driver which supports PCIe UFS Host controllers.
+	This selects the support for UFS devices in Linux, say Y and make
+	  sure that you know the name of your UFS host adapter (the card
+	  inside your computer that "speaks" the UFS protocol, also
+	  called UFS Host Controller), because you will be asked for it.
+	  The module will be called ufshcd.
+
+	  To compile this driver as a module, choose M here and read
+	  <file:Documentation/scsi/ufs.txt>.
+	  However, do not compile this as a module if your root file system
+	  (the one containing the directory /) is located on a UFS device.
+
+config SCSI_UFSHCD_PCI
+	tristate "PCI bus based UFS Controller support"
+	depends on SCSI_UFSHCD && PCI
+	---help---
+	This selects the PCI UFS Host Controller Interface. Select this if
+	you have UFS Host Controller with PCI Interface.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
drivers/scsi/ufs/Makefile +1 -0
index adf7895..9eda0df 100644
@@ -1,2 +1,3 @@
 # UFSHCD makefile
 obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o
+obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
drivers/scsi/ufs/ufshcd-pci.c new file +211 -0

211 lines not on this page · raw message

drivers/scsi/ufs/ufshcd.c +3 -324

374 lines not on this page · raw message

drivers/scsi/ufs/ufshcd.h new file +202 -0

202 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#3 lore raw

Re: [PATCH V6 Resend 2/4] [SCSI] drivers/scsi/ufs: Separate PCI code into glue driver

Quoted 3 lines · Vinayak Holikatti

This patch separates PCI code from ufshcd.c and makes it as a core driver module and adds a new file ufshcd-pci.c as PCI glue driver.

You rebased this, but didn't compile it:

CC [M] drivers/scsi/ufs/ufshcd-pci.o
drivers/scsi/ufs/ufshcd-pci.c:131:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ufshcd_pci_probe’ drivers/scsi/ufs/ufshcd-pci.c:196:11: error: ‘ufshcd_pci_probe’ undeclared here (not in a function) drivers/scsi/ufs/ufshcd-pci.c:197:2: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration] drivers/scsi/ufs/ufshcd-pci.c:197:2: error: initializer element is not constant
drivers/scsi/ufs/ufshcd-pci.c:197:2: error: (near initialization for ‘ufshcd_pci_driver.remove’) drivers/scsi/ufs/ufshcd-pci.c:110:12: warning: ‘ufshcd_set_dma_mask’ defined but not used [-Wunused-function]
cc1: some warnings being treated as errors
make[3]: *** [drivers/scsi/ufs/ufshcd-pci.o] Error 1

That's because of a stray __devinit and devexit_p() which no-longer exist in the kernel. I've fixed this up.
James

#4 lore raw

PATCH RESEND v6 3/4 ufs: Add Platform glue driver for ufshcd

In reply to Vinayak Holikatti

This patch adds Platform glue driver for ufshcd.

---
 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
drivers/scsi/ufs/Kconfig +11 -0
index 0371047..35faf24 100644
@@ -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.
drivers/scsi/ufs/Makefile +1 -0
index 9eda0df..1e5bd48 100644
@@ -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
drivers/scsi/ufs/ufshcd-pltfrm.c new file +217 -0

217 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#5 lore raw

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

Quoted 1 line · Vinayak Holikatti

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

#6 lore raw

PATCH RESEND v6 4/4 ufs: Correct the expected data transfersize

In reply to Vinayak Holikatti

This patch corrects the expected data transfer size of the command UPIU. The current implementation of cmd->transfersize is wrong as it probably equal to sector size. With this implementation the transfer size is updated correctly

---
 drivers/scsi/ufs/ufshcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index 60fd40c..c32a478 100644
@@ -478,7 +478,7 @@ static void ufshcd_compose_upiu(struct ufshcd_lrb *lrbp)
 		ucd_cmd_ptr->header.dword_2 = 0;
 
 		ucd_cmd_ptr->exp_data_transfer_len =
-			cpu_to_be32(lrbp->cmd->transfersize);
+			cpu_to_be32(lrbp->cmd->sdb.length);
 
 		memcpy(ucd_cmd_ptr->cdb,
 		       lrbp->cmd->cmnd,
Signature · 1 line
1.7.5.4
#7 lore raw
In reply to Vinayak Holikatti

James,

I have rebased these patches with top scsi-misc tree.

Quoted 28 lines · Vinayak Holikatti

This patch set adds following features
- Seggregate PCI specific code in ufshcd.c and corrected copyright
- Adds PCI glue driver ufshcd-pci.c and ufshcd.c become core module
- Adds Platform glue driver ufshcd-pltfrm.c
- Update correct transfer size in Command UPIU

Vinayak Holikatti (4):
[SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code [SCSI] drivers/scsi/ufs: Separate PCI code into glue driver [SCSI] ufs: Add Platform glue driver for ufshcd [SCSI] ufs: Correct the expected data transfersize

 drivers/scsi/ufs/Kconfig         |   87 +++++---
 drivers/scsi/ufs/Makefile        |    2 +
 drivers/scsi/ufs/ufs.h           |   44 ++---
 drivers/scsi/ufs/ufshcd-pci.c    |  211 +++++++++++++++++++
 drivers/scsi/ufs/ufshcd-pltfrm.c |  217 +++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c        |  425 ++++++++------------------------------
 drivers/scsi/ufs/ufshcd.h        |  202 ++++++++++++++++++
 drivers/scsi/ufs/ufshci.h        |   44 ++---
 8 files changed, 811 insertions(+), 421 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pci.c
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.c
 create mode 100644 drivers/scsi/ufs/ufshcd.h

--
1.7.5.4