Usphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget/translations/zh_CN/scsi/ufsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/zh_TW/scsi/ufsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/it_IT/scsi/ufsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ja_JP/scsi/ufsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ko_KR/scsi/ufsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/sp_SP/scsi/ufsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh6/var/lib/git/docbuild/linux/Documentation/scsi/ufs.rsthKubhsection)}(hhh](htitle)}(hUniversal Flash Storageh]hUniversal Flash Storage}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hXZContents 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 4. BSG Support 5. UFS Reference Clock Frequency configurationh]hXZContents 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 4. BSG Support 5. UFS Reference Clock Frequency configuration}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(hhh](h)}(h 1. Overviewh]h 1. Overview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXUniversal Flash Storage (UFS) is a storage specification for flash devices. It aims 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 the MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the physical layer and MIPI Unipro as the link layer.h]hXUniversal Flash Storage (UFS) is a storage specification for flash devices. It aims 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 the MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the physical layer and MIPI Unipro as the link layer.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h%The main goals of UFS are to provide:h]h%The main goals of UFS are to provide:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhhhubh block_quote)}(hX* 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 h]h bullet_list)}(hhh](h list_item)}(hX;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) h](h)}(hOptimized performance:h]hOptimized performance:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjubh)}(hAFor UFS version 1.0 and 1.1 the target performance is as follows:h]hAFor UFS version 1.0 and 1.1 the target performance is as follows:}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubj )}(hhh](j)}(hESupport for Gear1 is mandatory (rate A: 1248Mbps, rate B: 1457.6Mbps)h]h)}(hj8h]hESupport for Gear1 is mandatory (rate A: 1248Mbps, rate B: 1457.6Mbps)}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hj6ubah}(h]h ]h"]h$]h&]uh1jhj3ubj)}(hESupport for Gear2 is optional (rate A: 2496Mbps, rate B: 2915.2Mbps) h]h)}(hDSupport for Gear2 is optional (rate A: 2496Mbps, rate B: 2915.2Mbps)h]hDSupport for Gear2 is optional (rate A: 2496Mbps, rate B: 2915.2Mbps)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjMubah}(h]h ]h"]h$]h&]uh1jhj3ubeh}(h]h ]h"]h$]h&]bullet-uh1j hhhK)hjubh)}(hFuture version of the standard,h]hFuture version of the standard,}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjubj )}(hhh]j)}(h-Gear3 (rate A: 4992Mbps, rate B: 5830.4Mbps) h]h)}(h,Gear3 (rate A: 4992Mbps, rate B: 5830.4Mbps)h]h,Gear3 (rate A: 4992Mbps, rate B: 5830.4Mbps)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hj~ubah}(h]h ]h"]h$]h&]uh1jhj{ubah}(h]h ]h"]h$]h&]jkjluh1j hhhK.hjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hLow power consumptionh]h)}(hjh]hLow power consumption}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h"High random IOPs and low latency h]h)}(h High random IOPs and low latencyh]h High random IOPs and low latency}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jk*uh1j hhhK%hjubah}(h]h ]h"]h$]h&]uh1jhhhK%hhhhubeh}(h]overviewah ]h"] 1. overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h2. UFS Architecture Overviewh]h2. UFS Architecture Overview}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK5ubh)}(h^UFS has a layered communication architecture which is based on SCSI SAM-5 architectural model.h]h^UFS has a layered communication architecture which is based on SCSI SAM-5 architectural model.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hjhhubh)}(h@UFS communication architecture consists of the following layers.h]h@UFS communication architecture consists of the following layers.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjhhubh)}(hhh](h)}(h2.1 Application Layerh]h2.1 Application Layer}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK=ubj)}(hXrThe Application layer is composed of the 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 the UFS protocol layer. UFS supports a 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. h](h)}(hXThe Application layer is composed of the 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 the UFS protocol layer.h]hXThe Application layer is composed of the 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 the UFS protocol layer.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hj$ubh)}(hBUFS supports a subset of SCSI commands defined by SPC-4 and SBC-3.h]hBUFS supports a subset of SCSI commands defined by SPC-4 and SBC-3.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhj$ubj )}(hhh](j)}(h>UCS: It handles SCSI commands supported by UFS specification.h]hdefinition_list)}(hhh]hdefinition_list_item)}(h=UCS: It handles SCSI commands supported by UFS specification.h](hterm)}(hUCS:h]hUCS:}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1jVhhhKFhjRubh definition)}(hhh]h)}(h8It handles SCSI commands supported by UFS specification.h]h8It handles SCSI commands supported by UFS specification.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjhubah}(h]h ]h"]h$]h&]uh1jfhjRubeh}(h]h ]h"]h$]h&]uh1jPhhhKFhjMubah}(h]h ]h"]h$]h&]uh1jKhjGubah}(h]h ]h"]h$]h&]uh1jhjDubj)}(hrTask manager: It handles task management functions defined by the UFS which are meant for command queue control.h]jL)}(hhh]jQ)}(hpTask manager: It handles task management functions defined by the UFS which are meant for command queue control.h](jW)}(h Task manager:h]h Task manager:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jVhhhKIhjubjg)}(hhh]h)}(hbIt handles task management functions defined by the UFS which are meant for command queue control.h]hbIt handles task management functions defined by the UFS which are meant for command queue control.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjubah}(h]h ]h"]h$]h&]uh1jfhjubeh}(h]h ]h"]h$]h&]uh1jPhhhKIhjubah}(h]h ]h"]h$]h&]uh1jKhjubah}(h]h ]h"]h$]h&]uh1jhjDubj)}(hX[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. h]jL)}(hhh]jQ)}(hXUDevice 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. h](jW)}(hDevice manager:h]hDevice manager:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jVhhhKQhjubjg)}(hhh]h)}(hXDIt 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.h]hXDIt 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1jfhjubeh}(h]h ]h"]h$]h&]uh1jPhhhKQhjubah}(h]h ]h"]h$]h&]uh1jKhjubah}(h]h ]h"]h$]h&]uh1jhjDubeh}(h]h ]h"]h$]h&]jkjuh1j hhhKFhj$ubeh}(h]h ]h"]h$]h&]uh1jhhhK?hjhhubeh}(h]application-layerah ]h"]2.1 application layerah$]h&]uh1hhjhhhhhK=ubh)}(hhh](h)}(h&2.2 UFS Transport Protocol (UTP) layerh]h&2.2 UFS Transport Protocol (UTP) layer}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hhhhhKTubj)}(hXgThe 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). h](h)}(hThe UTP layer provides services for the higher layers through Service Access Points. UTP defines 3 service access points for higher layers.h]hThe UTP layer provides services for the higher layers through Service Access Points. UTP defines 3 service access points for higher layers.}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhj:ubj )}(hhh](j)}(hUDM_SAP: Device manager service access point is exposed to device manager for device level operations. These device level operations are done through query requests.h]h)}(hUDM_SAP: Device manager service access point is exposed to device manager for device level operations. These device level operations are done through query requests.h]hUDM_SAP: Device manager service access point is exposed to device manager for device level operations. These device level operations are done through query requests.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjOubah}(h]h ]h"]h$]h&]uh1jhjLubj)}(hjUTP_CMD_SAP: Command service access point is exposed to UFS command set layer (UCS) to transport commands.h]h)}(hjUTP_CMD_SAP: Command service access point is exposed to UFS command set layer (UCS) to transport commands.h]hjUTP_CMD_SAP: Command service access point is exposed to UFS command set layer (UCS) to transport commands.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjgubah}(h]h ]h"]h$]h&]uh1jhjLubj)}(htUTP_TM_SAP: Task management service access point is exposed to task manager to transport task management functions. h]h)}(hsUTP_TM_SAP: Task management service access point is exposed to task manager to transport task management functions.h]hsUTP_TM_SAP: Task management service access point is exposed to task manager to transport task management functions.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjubah}(h]h ]h"]h$]h&]uh1jhjLubeh}(h]h ]h"]h$]h&]jkjuh1j hhhKZhj:ubh)}(hEUTP transports messages through UFS protocol information unit (UPIU).h]hEUTP transports messages through UFS protocol information unit (UPIU).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhj:ubeh}(h]h ]h"]h$]h&]uh1jhhhKVhj)hhubeh}(h] ufs-transport-protocol-utp-layerah ]h"]&2.2 ufs transport protocol (utp) layerah$]h&]uh1hhjhhhhhKTubh)}(hhh](h)}(h 2.3 UFS Interconnect (UIC) Layerh]h 2.3 UFS Interconnect (UIC) Layer}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKeubj)}(hXDUIC is the lowest layer of the UFS layered architecture. It handles the 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. h](h)}(hUIC is the lowest layer of the UFS layered architecture. It handles the 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:h]hUIC is the lowest layer of the UFS layered architecture. It handles the 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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghjubj )}(hhh](j)}(h;UIC_SAP: To transport UPIU between UFS host and UFS device.h]h)}(hjh]h;UIC_SAP: To transport UPIU between UFS host and UFS device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h.UIO_SAP: To issue commands to Unipro layers. h]h)}(h,UIO_SAP: To issue commands to Unipro layers.h]h,UIO_SAP: To issue commands to Unipro layers.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKmhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jkjuh1j hhhKlhjubeh}(h]h ]h"]h$]h&]uh1jhhhKghjhhubeh}(h]ufs-interconnect-uic-layerah ]h"] 2.3 ufs interconnect (uic) layerah$]h&]uh1hhjhhhhhKeubeh}(h]ufs-architecture-overviewah ]h"]2. ufs architecture overviewah$]h&]uh1hhhhhhhhK5ubh)}(hhh](h)}(h3. UFSHCD Overviewh]h3. UFSHCD Overview}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhKqubh)}(hThe UFS host controller driver is based on the Linux SCSI Framework. UFSHCD is a low-level device driver which acts as an interface between the SCSI Midlayer and PCIe-based UFS host controllers.h]hThe UFS host controller driver is based on the Linux SCSI Framework. UFSHCD is a low-level device driver which acts as an interface between the SCSI Midlayer and PCIe-based UFS host controllers.}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshj*hhubh)}(hGThe current UFSHCD implementation supports the following functionality:h]hGThe current UFSHCD implementation supports the following functionality:}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhj*hhubh)}(hhh](h)}(h!3.1 UFS controller initializationh]h!3.1 UFS controller initialization}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjWhhhhhKzubj)}(hThe initialization module brings the UFS host controller to active state and prepares the controller to transfer commands/responses between UFSHCD and UFS device. h]h)}(hThe initialization module brings the UFS host controller to active state and prepares the controller to transfer commands/responses between UFSHCD and UFS device.h]hThe initialization module brings the UFS host controller to active state and prepares the controller to transfer commands/responses between UFSHCD and UFS device.}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK|hjhubah}(h]h ]h"]h$]h&]uh1jhhhK|hjWhhubeh}(h]ufs-controller-initializationah ]h"]!3.1 ufs controller initializationah$]h&]uh1hhj*hhhhhKzubh)}(hhh](h)}(h3.2 UTP Transfer requestsh]h3.2 UTP Transfer requests}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(hX3Transfer request handling module of UFSHCD receives SCSI commands from the SCSI Midlayer, forms UPIUs and issues the UPIUs to the UFS Host controller. Also, the module decodes responses received from the UFS host controller in the form of UPIUs and intimates the SCSI Midlayer of the status of the command. h]h)}(hX2Transfer request handling module of UFSHCD receives SCSI commands from the SCSI Midlayer, forms UPIUs and issues the UPIUs to the UFS Host controller. Also, the module decodes responses received from the UFS host controller in the form of UPIUs and intimates the SCSI Midlayer of the status of the command.h]hX2Transfer request handling module of UFSHCD receives SCSI commands from the SCSI Midlayer, forms UPIUs and issues the UPIUs to the UFS Host controller. Also, the module decodes responses received from the UFS host controller in the form of UPIUs and intimates the SCSI Midlayer of the status of the command.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]utp-transfer-requestsah ]h"]3.2 utp transfer requestsah$]h&]uh1hhj*hhhhhKubh)}(hhh](h)}(h3.3 UFS error handlingh]h3.3 UFS error handling}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(h{Error handling module handles Host controller fatal errors, Device fatal errors and UIC interconnect layer-related errors. h]h)}(hzError handling module handles Host controller fatal errors, Device fatal errors and UIC interconnect layer-related errors.h]hzError handling module handles Host controller fatal errors, Device fatal errors and UIC interconnect layer-related errors.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]ufs-error-handlingah ]h"]3.3 ufs error handlingah$]h&]uh1hhj*hhhhhKubh)}(hhh](h)}(h3.4 SCSI Error handlingh]h3.4 SCSI Error handling}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(hXkThis is done through UFSHCD SCSI error handling routines registered with the SCSI Midlayer. Examples of some of the error handling commands issues by the 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. h]h)}(hXjThis is done through UFSHCD SCSI error handling routines registered with the SCSI Midlayer. Examples of some of the error handling commands issues by the 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.h]hXjThis is done through UFSHCD SCSI error handling routines registered with the SCSI Midlayer. Examples of some of the error handling commands issues by the 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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubh)}(haIn this version of UFSHCD, Query requests and power management functionality are not implemented.h]haIn this version of UFSHCD, Query requests and power management functionality are not implemented.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]scsi-error-handlingah ]h"]3.4 scsi error handlingah$]h&]uh1hhj*hhhhhKubeh}(h]ufshcd-overviewah ]h"]3. ufshcd overviewah$]h&]uh1hhhhhhhhKqubh)}(hhh](h)}(h4. BSG Supporth]h4. BSG Support}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj1hhhhhKubh)}(hX This transport driver supports exchanging UFS protocol information units (UPIUs) with a UFS device. Typically, user space will allocate struct ufs_bsg_request and struct ufs_bsg_reply (see ufs_bsg.h) as request_upiu and reply_upiu respectively. Filling those UPIUs should be done in accordance with JEDEC spec UFS2.1 paragraph 10.7. *Caveat emptor*: The driver makes no further input validations and sends the UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and send SG_IO with the applicable sg_io_v4::h](hXNThis transport driver supports exchanging UFS protocol information units (UPIUs) with a UFS device. Typically, user space will allocate struct ufs_bsg_request and struct ufs_bsg_reply (see ufs_bsg.h) as request_upiu and reply_upiu respectively. Filling those UPIUs should be done in accordance with JEDEC spec UFS2.1 paragraph 10.7. }(hjBhhhNhNubhemphasis)}(h*Caveat emptor*h]h Caveat emptor}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1jJhjBubh: The driver makes no further input validations and sends the UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and send SG_IO with the applicable sg_io_v4:}(hjBhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubh literal_block)}(hXio_hdr_v4.guard = 'Q'; io_hdr_v4.protocol = BSG_PROTOCOL_SCSI; io_hdr_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT; io_hdr_v4.response = (__u64)reply_upiu; io_hdr_v4.max_response_len = reply_len; io_hdr_v4.request_len = request_len; io_hdr_v4.request = (__u64)request_upiu; if (dir == SG_DXFER_TO_DEV) { io_hdr_v4.dout_xfer_len = (uint32_t)byte_cnt; io_hdr_v4.dout_xferp = (uintptr_t)(__u64)buff; } else { io_hdr_v4.din_xfer_len = (uint32_t)byte_cnt; io_hdr_v4.din_xferp = (uintptr_t)(__u64)buff; }h]hXio_hdr_v4.guard = 'Q'; io_hdr_v4.protocol = BSG_PROTOCOL_SCSI; io_hdr_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT; io_hdr_v4.response = (__u64)reply_upiu; io_hdr_v4.max_response_len = reply_len; io_hdr_v4.request_len = request_len; io_hdr_v4.request = (__u64)request_upiu; if (dir == SG_DXFER_TO_DEV) { io_hdr_v4.dout_xfer_len = (uint32_t)byte_cnt; io_hdr_v4.dout_xferp = (uintptr_t)(__u64)buff; } else { io_hdr_v4.din_xfer_len = (uint32_t)byte_cnt; io_hdr_v4.din_xferp = (uintptr_t)(__u64)buff; }}hjfsbah}(h]h ]h"]h$]h&]hhuh1jdhhhKhj1hhubh)}(hQIf you wish to read or write a descriptor, use the appropriate xferp of sg_io_v4.h]hQIf you wish to read or write a descriptor, use the appropriate xferp of sg_io_v4.}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubh)}(hmThe userspace tool that interacts with the ufs-bsg endpoint and uses its UPIU-based protocol is available at:h]hmThe userspace tool that interacts with the ufs-bsg endpoint and uses its UPIU-based protocol is available at:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubj)}(h6https://github.com/westerndigitalcorporation/ufs-tool h]h)}(h5https://github.com/westerndigitalcorporation/ufs-toolh]h reference)}(hjh]h5https://github.com/westerndigitalcorporation/ufs-tool}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhj1hhubh)}(hfFor more detailed information about the tool and its supported features, please see the tool's README.h]hhFor more detailed information about the tool and its supported features, please see the tool’s README.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubh)}(h#UFS specifications can be found at:h]h#UFS specifications can be found at:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubj )}(hhh](j)}(h?UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdfh]h)}(hjh](hUFS - }(hjhhhNhNubj)}(h9http://www.jedec.org/sites/default/files/docs/JESD220.pdfh]h9http://www.jedec.org/sites/default/files/docs/JESD220.pdf}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCUFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf h]h)}(hBUFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdfh](h UFSHCI - }(hjhhhNhNubj)}(h9http://www.jedec.org/sites/default/files/docs/JESD223.pdfh]h9http://www.jedec.org/sites/default/files/docs/JESD223.pdf}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jkjluh1j hhhKhj1hhubeh}(h] bsg-supportah ]h"]4. bsg supportah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h.5. UFS Reference Clock Frequency configurationh]h.5. UFS Reference Clock Frequency configuration}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj.hhhhhKubh)}(hXDevicetree can define a clock named "ref_clk" under the UFS controller node to specify the intended reference clock frequency for the UFS storage parts. ACPI-based system can specify the frequency using ACPI Device-Specific Data property named "ref-clk-freq". In both ways the value is interpreted as frequency in Hz and must match one of the values given in the UFS specification. UFS subsystem will attempt to read the value when executing common controller initialization. If the value is available, UFS subsystem will ensure the bRefClkFreq attribute of the UFS storage device is set accordingly and will modify it if there is a mismatch.h]hXDevicetree can define a clock named “ref_clk” under the UFS controller node to specify the intended reference clock frequency for the UFS storage parts. ACPI-based system can specify the frequency using ACPI Device-Specific Data property named “ref-clk-freq”. In both ways the value is interpreted as frequency in Hz and must match one of the values given in the UFS specification. UFS subsystem will attempt to read the value when executing common controller initialization. If the value is available, UFS subsystem will ensure the bRefClkFreq attribute of the UFS storage device is set accordingly and will modify it if there is a mismatch.}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj.hhubeh}(h]+ufs-reference-clock-frequency-configurationah ]h"].5. ufs reference clock frequency configurationah$]h&]uh1hhhhhhhhKubeh}(h]universal-flash-storageah ]h"]universal flash storageah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jZjWjjj'j$j&j#jjjjj.j+jjjjjjj&j#j+j(jRjOu nametypes}(jZjj'j&jjj.jjjj&j+jRuh}(jWhjhj$jj#jjj)jjj+j*jjWjjjjj#jj(j1jOj.u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.