summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs/ufs-qcom.h
AgeCommit message (Collapse)Author
2022-05-19scsi: ufs: Split the drivers/scsi/ufs directoryBart Van Assche
Split the drivers/scsi/ufs directory into 'core' and 'host' directories under the drivers/ufs/ directory. Move shared header files into the include/ufs/ directory. This separation makes it clear which header files UFS drivers are allowed to include (include/ufs/*.h) and which header files UFS drivers are not allowed to include (drivers/ufs/core/*.h). Update the MAINTAINERS file. Add myself as a UFS reviewer. Link: https://lore.kernel.org/r/20220511212552.655341-1-bvanassche@acm.org Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Avri Altman <avri.altman@wdc.com> Cc: Bean Huo <beanhuo@micron.com> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Keoseong Park <keosung.park@samsung.com> Tested-by: Bean Huo <beanhuo@micron.com> Tested-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Acked-by: Avri Altman <avri.altman@wdc.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-25scsi: ufs: Remove unnecessary ufshcd-crypto.h include directivesBart Van Assche
ufshcd-crypto.h declares functions that must only be called by the UFS core. Hence remove the #include "ufshcd-crypto.h" directive from UFS drivers. Link: https://lore.kernel.org/r/20220419225811.4127248-24-bvanassche@acm.org Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-25scsi: ufs: Simplify statements that return a booleanBart Van Assche
Convert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'. Link: https://lore.kernel.org/r/20220419225811.4127248-5-bvanassche@acm.org Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Keoseong Park <keosung.park@samsung.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-17scsi: ufs: ufs-qcom: Use device parameter initialization functionStanley Chu
Use common device parameter initialization function instead of initializing those parameters by vendor driver itself. Link: https://lore.kernel.org/r/20201116065054.7658-5-stanley.chu@mediatek.com Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-08-20scsi: ufs-qcom: Remove unused MSM bus scaling APIsSai Prakash Ranjan
MSM bus scaling has moved on to use interconnect framework and downstream bus scaling APIs like msm_bus_scale*() do not exist anymore in the kernel. Currently they are guarded by a config which also does not exist and hence there are no build failures reported. Remove these unused interfaces as they are currently no-ops and the scaling support that may be added in future will use interconnect API. Link: https://lore.kernel.org/r/20200804161033.15586-1-saiprakash.ranjan@codeaurora.org Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-24scsi: ufs-qcom: Add Inline Crypto Engine supportEric Biggers
Add support for Qualcomm Inline Crypto Engine (ICE) to ufs-qcom. The standards-compliant parts, such as querying the crypto capabilities and enabling crypto for individual UFS requests, are already handled by ufshcd-crypto.c, which itself is wired into the blk-crypto framework. However, ICE requires vendor-specific init, enable, and resume logic, and it requires that keys be programmed and evicted by vendor-specific SMC calls. Make the ufs-qcom driver handle these details. I tested this on Dragonboard 845c, which is a publicly available development board that uses the Snapdragon 845 SoC and runs the upstream Linux kernel. This is the same SoC used in the Pixel 3 and Pixel 3 XL phones. This testing included (among other things) verifying that the expected ciphertext was produced, both manually using ext4 encryption and automatically using a block layer self-test I've written. I've also tested that this driver works nearly as-is on the Snapdragon 765 and Snapdragon 865 SoCs. And others have tested it on Snapdragon 850, Snapdragon 855, and Snapdragon 865 (see the Tested-by tags). This is based very loosely on the vendor-provided driver in the kernel source code for the Pixel 3, but I've greatly simplified it. Also, for now I've only included support for major version 3 of ICE, since that's all I have the hardware to test with the mainline kernel. Plus it appears that version 3 is easier to use than older versions of ICE. For now, only allow using AES-256-XTS. The hardware also declares support for AES-128-XTS, AES-{128,256}-ECB, and AES-{128,256}-CBC (BitLocker variant). But none of these others are really useful, and they'd need to be individually tested to be sure they worked properly. This commit also changes the name of the loadable module from "ufs-qcom" to "ufs_qcom", as this is necessary to compile it from multiple source files (unless we were to rename ufs-qcom.c). Link: https://lore.kernel.org/r/20200710072013.177481-6-ebiggers@kernel.org Tested-by: Steev Klimaszewski <steev@kali.org> # Lenovo Yoga C630 Tested-by: Thara Gopinath <thara.gopinath@linaro.org> # db845c, sm8150-mtp, sm8250-mtp Reviewed-by: Avri Altman <avri.altman@wdc.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-11-18scsi: ufs-qcom: Add reset control support for host controllerCan Guo
Add reset control for host controller so that host controller can be reset as required in its power up sequence. Link: https://lore.kernel.org/r/1573798172-20534-3-git-send-email-cang@codeaurora.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-09-07scsi: ufs-qcom: Implement device_reset vopsBjorn Andersson
The UFS_RESET pin on Qualcomm SoCs are controlled by TLMM and exposed through the GPIO framework. Acquire the device-reset GPIO and use this to implement the device_reset vops, to allow resetting the attached memory. Based on downstream support implemented by Subhash Jadavani <subhashj@codeaurora.org>. Link: https://lore.kernel.org/r/20190828191756.24312-3-bjorn.andersson@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Avri Altman <Avri.Altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 and only version 2 as published by the free software foundation 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 294 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-17scsi: ufs: qcom: Expose the reset controller for PHYEvan Green
Expose a reset controller that the phy will later use to control its own PHY reset in the UFS controller. This will enable the combining of PHY init functionality into a single function. Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2018-09-26scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from hostVivek Gautam
The host makes direct calls into phy using ufs_qcom_phy_*() APIs. These APIs are only defined for 20nm qcom-ufs-qmp phy which is not being used by any architecture as yet. Future architectures too are not going to use 20nm ufs phy. So remove these ufs_qcom_phy_*() calls from host to let further change declare the 20nm phy as broken. Also remove couple of stale enum defines for ufs phy. Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2017-10-11scsi: ufs-qcom: Remove uses of UFS_BIT() macroAlim Akhtar
Use actual bit position instead of UFS_BIT() macro. This patch also changes bit-17 to meaningful #define. This change is as per discussion here [1] [1] -> https://lkml.org/lkml/2017/8/28/786 Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> Cc: Subhash Jadavani <subhashj@codeaurora.org> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-02-07scsi: ufs-qcom: dump additional testbus registersVenkat Gopalakrishnan
Change testbus default config, dump additional testbus registers along with other debug vendor specific registers. These additional info are useful in debugging link related failures. Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-12-08scsi: ufs: add quirk to increase host PA_SaveConfigTimeSubhash Jadavani
The maximum value PA_SaveConfigTime is 250 (10us) but this is not enough for some vendors. Gear switch from PWM to HS may fail even with this max. PA_SaveConfigTime. Gear switch can be issued by host controller as an error recovery and any software delay will not help on this case so we need to increase PA_SaveConfigTime to >32us as per vendor recommendation. This change adds a quirk to increase the PA_SaveConfigTime parameter. Reviewed-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-03-14scsi: ufs-qcom: add printouts of testbus debug registersYaniv Gardi
This change adds printouts of testbus and debug registers. Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-09scsi: ufs-qcom: add QUniPro hardware support and power optimizationsYaniv Gardi
New revisions of UFS host controller supports the new UniPro hardware controller (referred as QUniPro). This patch adds the support to enable this new UniPro controller hardware. This change also adds power optimization for bus scaling feature, as well as support for HS-G3 power mode. Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org> Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-09scsi: ufs-qcom: add debug prints for test busYaniv Gardi
Adds support for configuring and reading the test bus and debug registers. This change also adds another vops in order to print the debug registers. Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org> Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-04-10ufs: add support to allow non standard behaviours (quirks)Yaniv Gardi
Some implementation of UFS host controller HW might have some non-standard behaviours (quirks) when compared to behaviour specified by UFSHCI specification. This patch add support to allow specifying all such quirks to standard UFS host controller driver so standard driver takes them into account. In this change a UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS is introduced, where a minimum delay of 1ms is required before DME commands for stability purposes. Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-10ufs-qcom: save controller revision info in internal structureYaniv Gardi
Sometimes, specific information about the UFS controller revision is required in order to determine certain operations or execute controller dependent quirks. In order to avoid reading the controller revision multiple times, we simply read it once and save this information in internal structure. Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-01-20ufs-qcom: add support for Qualcomm Technologies Inc platformsYaniv Gardi
This change adds support for Qualcomm Technologies Inc platforms that use UFS driver. for example, it adds : - PM specific operations during hibern8, suspend, resume, clock setup - qcom-ufs generic phy driver initialization, calibration, power-on/off sequence, etc. - UFS Controller specific configuration - Rate, Gear, Mode negotiation between device and controller Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Reviewed-by: Dov Levenglick <dovl@codeaurora.org> Signed-off-by: Christoph Hellwig <hch@lst.de>