forked from Sricharanti/sricharan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCSI] ufshcd: UFS Host controller driver
This patch adds support for Universal Flash Storage(UFS) host controllers. The UFS host controller driver includes host controller initialization method. The Initialization process involves following steps: - Initiate UFS Host Controller initialization process by writing to Host controller enable register - Configure UFS Host controller registers with host memory space datastructure offsets. - Unipro link startup procedure - Check for connected device - Configure UFS host controller to process requests - Enable required interrupts - Configure interrupt aggregation [jejb: fix warnings in 32 bit compile] Signed-off-by: Santosh Yaraganavi <[email protected]> Signed-off-by: Vinayak Holikatti <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Reviewed-by: Vishak G <[email protected]> Reviewed-by: Girish K S <[email protected]> Reviewed-by: Namjae Jeon <[email protected]> Signed-off-by: James Bottomley <[email protected]>
- Loading branch information
Showing
9 changed files
with
2,749 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
Universal Flash Storage | ||
======================= | ||
|
||
|
||
Contents | ||
-------- | ||
|
||
1. Overview | ||
2. UFS Architecture Overview | ||
2.1 Application Layer | ||
2.2 UFS Transport Protocol(UTP) layer | ||
2.3 UFS Interconnect(UIC) Layer | ||
3. UFSHCD Overview | ||
3.1 UFS controller initialization | ||
3.2 UTP Transfer requests | ||
3.3 UFS error handling | ||
3.4 SCSI Error handling | ||
|
||
|
||
1. Overview | ||
----------- | ||
|
||
Universal Flash Storage(UFS) is a storage specification for flash devices. | ||
It is aimed to provide a universal storage interface for both | ||
embedded and removable flash memory based storage in mobile | ||
devices such as smart phones and tablet computers. The specification | ||
is defined by JEDEC Solid State Technology Association. UFS is based | ||
on MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the | ||
physical layer and MIPI Unipro as the link layer. | ||
|
||
The main goals of UFS is to provide, | ||
* Optimized performance: | ||
For UFS version 1.0 and 1.1 the target performance is as follows, | ||
Support for Gear1 is mandatory (rate A: 1248Mbps, rate B: 1457.6Mbps) | ||
Support for Gear2 is optional (rate A: 2496Mbps, rate B: 2915.2Mbps) | ||
Future version of the standard, | ||
Gear3 (rate A: 4992Mbps, rate B: 5830.4Mbps) | ||
* Low power consumption | ||
* High random IOPs and low latency | ||
|
||
|
||
2. UFS Architecture Overview | ||
---------------------------- | ||
|
||
UFS has a layered communication architecture which is based on SCSI | ||
SAM-5 architectural model. | ||
|
||
UFS communication architecture consists of following layers, | ||
|
||
2.1 Application Layer | ||
|
||
The Application layer is composed of UFS command set layer(UCS), | ||
Task Manager and Device manager. The UFS interface is designed to be | ||
protocol agnostic, however SCSI has been selected as a baseline | ||
protocol for versions 1.0 and 1.1 of UFS protocol layer. | ||
UFS supports subset of SCSI commands defined by SPC-4 and SBC-3. | ||
* UCS: It handles SCSI commands supported by UFS specification. | ||
* Task manager: It handles task management functions defined by the | ||
UFS which are meant for command queue control. | ||
* Device manager: It handles device level operations and device | ||
configuration operations. Device level operations mainly involve | ||
device power management operations and commands to Interconnect | ||
layers. Device level configurations involve handling of query | ||
requests which are used to modify and retrieve configuration | ||
information of the device. | ||
|
||
2.2 UFS Transport Protocol(UTP) layer | ||
|
||
UTP layer provides services for | ||
the higher layers through Service Access Points. UTP defines 3 | ||
service access points for higher layers. | ||
* UDM_SAP: Device manager service access point is exposed to device | ||
manager for device level operations. These device level operations | ||
are done through query requests. | ||
* UTP_CMD_SAP: Command service access point is exposed to UFS command | ||
set layer(UCS) to transport commands. | ||
* UTP_TM_SAP: Task management service access point is exposed to task | ||
manager to transport task management functions. | ||
UTP transports messages through UFS protocol information unit(UPIU). | ||
|
||
2.3 UFS Interconnect(UIC) Layer | ||
|
||
UIC is the lowest layer of UFS layered architecture. It handles | ||
connection between UFS host and UFS device. UIC consists of | ||
MIPI UniPro and MIPI M-PHY. UIC provides 2 service access points | ||
to upper layer, | ||
* UIC_SAP: To transport UPIU between UFS host and UFS device. | ||
* UIO_SAP: To issue commands to Unipro layers. | ||
|
||
|
||
3. UFSHCD Overview | ||
------------------ | ||
|
||
The UFS host controller driver is based on Linux SCSI Framework. | ||
UFSHCD is a low level device driver which acts as an interface between | ||
SCSI Midlayer and PCIe based UFS host controllers. | ||
|
||
The current UFSHCD implementation supports following functionality, | ||
|
||
3.1 UFS controller initialization | ||
|
||
The initialization module brings UFS host controller to active state | ||
and prepares the controller to transfer commands/response between | ||
UFSHCD and UFS device. | ||
|
||
3.2 UTP Transfer requests | ||
|
||
Transfer request handling module of UFSHCD receives SCSI commands | ||
from SCSI Midlayer, forms UPIUs and issues the UPIUs to UFS Host | ||
controller. Also, the module decodes, responses received from UFS | ||
host controller in the form of UPIUs and intimates the SCSI Midlayer | ||
of the status of the command. | ||
|
||
3.3 UFS error handling | ||
|
||
Error handling module handles Host controller fatal errors, | ||
Device fatal errors and UIC interconnect layer related errors. | ||
|
||
3.4 SCSI Error handling | ||
|
||
This is done through UFSHCD SCSI error handling routines registered | ||
with SCSI Midlayer. Examples of some of the error handling commands | ||
issues by SCSI Midlayer are Abort task, Lun reset and host reset. | ||
UFSHCD Routines to perform these tasks are registered with | ||
SCSI Midlayer through .eh_abort_handler, .eh_device_reset_handler and | ||
.eh_host_reset_handler. | ||
|
||
In this version of UFSHCD Query requests and power management | ||
functionality are not implemented. | ||
|
||
UFS Specifications can be found at, | ||
UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf | ||
UFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# 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 | ||
# | ||
# 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. | ||
|
||
# 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. | ||
|
||
config SCSI_UFSHCD | ||
tristate "Universal Flash Storage host controller driver" | ||
depends on PCI && SCSI | ||
---help--- | ||
This is a generic driver which supports PCIe UFS Host controllers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# UFSHCD makefile | ||
obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o |
Oops, something went wrong.