Skip to contentSkip to conversation

ufs: Adds glue drivers to ufshcd

PATCH Superseded Vinayak Holikatti 3 participants 11 messages Oct 17, 2012 – Nov 21, 2012

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 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 transfer size

 drivers/scsi/ufs/Kconfig         |   87 +++++---
 drivers/scsi/ufs/Makefile        |    2 +
 drivers/scsi/ufs/ufs.h           |   42 ++---
 drivers/scsi/ufs/ufshcd-pci.c    |  211 ++++++++++++++++++
 drivers/scsi/ufs/ufshcd-pltfrm.c |  205 ++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c        |  433 +++++++------------------------------
 drivers/scsi/ufs/ufshcd.h        |  200 ++++++++++++++++++
 drivers/scsi/ufs/ufshci.h        |   42 ++---
 8 files changed, 786 insertions(+), 436 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 v4 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    |   42 ++----
 drivers/scsi/ufs/ufshcd.c |  358 ++++++++++++++++++++++++++-------------------
 drivers/scsi/ufs/ufshci.h |   42 ++----
 4 files changed, 256 insertions(+), 236 deletions(-)
drivers/scsi/ufs/Kconfig +20 -30
index 8f27f9d..9c84569 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-2012 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 +16 -26

59 lines not on this page · raw message

drivers/scsi/ufs/ufshcd.c +204 -154

650 lines not on this page · raw message

drivers/scsi/ufs/ufshci.h +16 -26

59 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#2 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 8 lines · Vinayak Holikatti

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.

Quoted 7 lines
---
  drivers/scsi/ufs/Kconfig  |   50 +++----
  drivers/scsi/ufs/ufs.h    |   42 ++----
  drivers/scsi/ufs/ufshcd.c |  358 ++++++++++++++++++++++++++-------------------
  drivers/scsi/ufs/ufshci.h |   42 ++----
  4 files changed, 256 insertions(+), 236 deletions(-)

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

#3 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 6 lines · Venkatraman S
Quoted 5 lines · Vinayak Holikatti

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.

Quoted 12 lines
Quoted 4 lines
Quoted 8 lines
---
  drivers/scsi/ufs/Kconfig  |   50 +++----
  drivers/scsi/ufs/ufs.h    |   42 ++----
  drivers/scsi/ufs/ufshcd.c |  358
++++++++++++++++++++++++++-------------------
  drivers/scsi/ufs/ufshci.h |   42 ++----
  4 files changed, 256 insertions(+), 236 deletions(-)

I am Vacation will look into it when i am back to work.

Quoted 1 line

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

Signature · 2 lines
Regards,
Vinayak Holikatti
maintainer
#4 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 2 lines · vinayak holikatti

I am Vacation will look into it when i am back to work.

Quoted 1 line

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

OK, so it doesn't apply for me either:

patching file drivers/scsi/ufs/ufshcd.c
Hunk #11 FAILED at 902.
Hunk #15 succeeded at 1157 with fuzz 1 (offset 2 lines). Hunk #16 succeeded at 1271 (offset 2 lines). Hunk #17 succeeded at 1300 (offset 2 lines). Hunk #18 succeeded at 1364 (offset 2 lines). Hunk #19 succeeded at 1499 (offset 2 lines). Hunk #20 succeeded at 1542 (offset 2 lines). Hunk #21 succeeded at 1678 (offset 2 lines). Hunk #22 succeeded at 1706 (offset 2 lines). Hunk #23 succeeded at 1727 (offset 2 lines). Hunk #24 succeeded at 1775 (offset 2 lines). Hunk #25 succeeded at 1819 (offset 2 lines). Hunk #26 succeeded at 1872 (offset 2 lines). Hunk #27 succeeded at 1898 (offset 2 lines). Hunk #28 FAILED at 2011.
2 out of 28 hunks FAILED -- saving rejects to file drivers/scsi/ufs/ufshcd.c.rej

James

#5 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 16 lines · James Bottomley
Quoted 2 lines · vinayak holikatti

I am Vacation will look into it when i am back to work.

Quoted 1 line

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

OK, so it doesn't apply for me either:

patching file drivers/scsi/ufs/ufshcd.c
Hunk #11 FAILED at 902.
Hunk #15 succeeded at 1157 with fuzz 1 (offset 2 lines). Hunk #16 succeeded at 1271 (offset 2 lines). Hunk #17 succeeded at 1300 (offset 2 lines). Hunk #18 succeeded at 1364 (offset 2 lines). Hunk #19 succeeded at 1499 (offset 2 lines). Hunk #20 succeeded at 1542 (offset 2 lines). Hunk #21 succeeded at 1678 (offset 2 lines). Hunk #22 succeeded at 1706 (offset 2 lines).

Quoted 9 lines

Hunk #23 succeeded at 1727 (offset 2 lines). Hunk #24 succeeded at 1775 (offset 2 lines). Hunk #25 succeeded at 1819 (offset 2 lines). Hunk #26 succeeded at 1872 (offset 2 lines). Hunk #27 succeeded at 1898 (offset 2 lines). Hunk #28 FAILED at 2011.
2 out of 28 hunks FAILED -- saving rejects to file drivers/scsi/ufs/ufshcd.c.rej

I have generated patches based on linux/kernel/git/jejb/scsi.git this tree, Also i have
confirmed that patches get applied successfully on this git tree.

James,
Which tree are you refering to. Let me know, which tree i should use to generate the patches.

Quoted 3 lines

James

maintainer
#6 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 27 lines · vinayak holikatti
Quoted 16 lines · James Bottomley
Quoted 2 lines · vinayak holikatti

I am Vacation will look into it when i am back to work.

Quoted 1 line

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

OK, so it doesn't apply for me either:

patching file drivers/scsi/ufs/ufshcd.c
Hunk #11 FAILED at 902.
Hunk #15 succeeded at 1157 with fuzz 1 (offset 2 lines). Hunk #16 succeeded at 1271 (offset 2 lines). Hunk #17 succeeded at 1300 (offset 2 lines). Hunk #18 succeeded at 1364 (offset 2 lines). Hunk #19 succeeded at 1499 (offset 2 lines). Hunk #20 succeeded at 1542 (offset 2 lines). Hunk #21 succeeded at 1678 (offset 2 lines). Hunk #22 succeeded at 1706 (offset 2 lines).

Quoted 9 lines

Hunk #23 succeeded at 1727 (offset 2 lines). Hunk #24 succeeded at 1775 (offset 2 lines). Hunk #25 succeeded at 1819 (offset 2 lines). Hunk #26 succeeded at 1872 (offset 2 lines). Hunk #27 succeeded at 1898 (offset 2 lines). Hunk #28 FAILED at 2011.
2 out of 28 hunks FAILED -- saving rejects to file drivers/scsi/ufs/ufshcd.c.rej

Quoted 7 lines

I have generated patches based on linux/kernel/git/jejb/scsi.git this tree, Also i have
confirmed that patches get applied successfully on this git tree.

James,
Which tree are you refering to. Let me know, which tree i should use to generate the patches.

All patches for the merge window should be against the misc branch of the scsi.git tree.

James

#7 lore raw

Re: [PATCH V4 1/4] [SCSI] drivers/scsi/ufs: Seggregate PCI Specific Code

Quoted 32 lines · James Bottomley
Quoted 31 lines · vinayak holikatti
Quoted 16 lines · James Bottomley
Quoted 2 lines · vinayak holikatti

I am Vacation will look into it when i am back to work.

Quoted 1 line

This doesn't apply on 3.7-rc1. Am I missing any patches in between ?

OK, so it doesn't apply for me either:

patching file drivers/scsi/ufs/ufshcd.c
Hunk #11 FAILED at 902.
Hunk #15 succeeded at 1157 with fuzz 1 (offset 2 lines). Hunk #16 succeeded at 1271 (offset 2 lines). Hunk #17 succeeded at 1300 (offset 2 lines). Hunk #18 succeeded at 1364 (offset 2 lines). Hunk #19 succeeded at 1499 (offset 2 lines). Hunk #20 succeeded at 1542 (offset 2 lines). Hunk #21 succeeded at 1678 (offset 2 lines). Hunk #22 succeeded at 1706 (offset 2 lines).

Quoted 9 lines

Hunk #23 succeeded at 1727 (offset 2 lines). Hunk #24 succeeded at 1775 (offset 2 lines). Hunk #25 succeeded at 1819 (offset 2 lines). Hunk #26 succeeded at 1872 (offset 2 lines). Hunk #27 succeeded at 1898 (offset 2 lines). Hunk #28 FAILED at 2011.
2 out of 28 hunks FAILED -- saving rejects to file drivers/scsi/ufs/ufshcd.c.rej

I have generated patches based on linux/kernel/git/jejb/scsi.git this tree, Also i have
confirmed that patches get applied successfully on this git tree.

Quoted 9 lines
Quoted 3 lines

James,
Which tree are you refering to. Let me know, which tree i should use to generate the patches.

All patches for the merge window should be against the misc branch of the scsi.git tree.

James

Ok, I will create the patches against misc branch and resend these patches. Thanks
Vinayak Holikatti

#8 lore raw

PATCH v4 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     |  323 +----------------------------------------
 drivers/scsi/ufs/ufshcd.h     |  200 +++++++++++++++++++++++++
 5 files changed, 437 insertions(+), 324 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 9c84569..d77ae97 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.
+	  Most controllers found today are PCI devices.
+
+	  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 +2 -321

366 lines not on this page · raw message

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

200 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#9 lore raw

PATCH v4 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 |  205 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 217 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.c
drivers/scsi/ufs/Kconfig +11 -0
index d77ae97..96e1721 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 based UFS Controller support"
+	depends on SCSI_UFSHCD
+	---help---
+	This selects the UFS host controller support. If you have a
+	   platform with UFS controller, say Y or M here.
+
+	   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 +205 -0

205 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#10 lore raw

PATCH v4 4/4 ufs: Correct the expected data transfer size

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 5d7bd47..57c16ec 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