- Apr 26, 2022
-
-
Bart Van Assche authored
Since struct ufs_dev_fix contains quirk information, rename it into struct ufs_dev_quirk. Link: https://lore.kernel.org/r/20220419225811.4127248-10-bvanassche@acm.org Tested-by:
Bean Huo <beanhuo@micron.com> Reviewed-by:
Avri Altman <avri.altman@wdc.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>
-
Bart Van Assche authored
Since these two macros reduce code readability, remove them. Link: https://lore.kernel.org/r/20220419225811.4127248-9-bvanassche@acm.org Tested-by:
Bean Huo <beanhuo@micron.com> Reviewed-by:
Avri Altman <avri.altman@wdc.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>
-
- Jan 10, 2022
-
-
Miaoqian Lin authored
The function regulator_get() returns an error pointer. Use IS_ERR() to validate the return value. Link: https://lore.kernel.org/r/20211222070930.9449-1-linmq006@gmail.com Fixes: cf137b3e ("scsi: ufs-mediatek: Support VA09 regulator operations") Signed-off-by:
Miaoqian Lin <linmq006@gmail.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Nov 19, 2021
-
-
Ye Guojin authored
This was found by coccicheck: ./drivers/scsi/ufs/ufs-mediatek.c, 211, 1-7, ERROR missing put_device; call of_find_device_by_node on line 1185, but without a corresponding object release within this function. Link: https://lore.kernel.org/r/20211110105133.150171-1-ye.guojin@zte.com.cn Reported-by:
Zeal Robot <zealci@zte.com.cn> Reviewed-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Ye Guojin <ye.guojin@zte.com.cn> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Oct 21, 2021
-
-
Arnd Bergmann authored
sched_clock() is not meant to be used in portable driver code, and assuming a particular clock frequency is not how this is meant to be used. It also causes a build failure because of a missing header inclusion: drivers/scsi/ufs/ufs-mediatek.c:321:12: error: implicit declaration of function 'sched_clock' [-Werror,-Wimplicit-function-declaration] timeout = sched_clock() + retry_ms * 1000000UL; A better interface to use here ktime_get_mono_fast_ns(), which works mostly like ktime_get() but is safe to use inside of a suspend callback. Link: https://lore.kernel.org/r/20211018132022.2281589-1-arnd@kernel.org Fixes: 9561f584 ("scsi: ufs: mediatek: Support vops pre suspend to disable auto-hibern8") Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Arnd Bergmann <arnd@arndb.de> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Oct 19, 2021
-
-
Peter Wang authored
Fix the location of delay for ref-clk gating and ungating in ufs_mtk_setup_ref_clk(). Link: https://lore.kernel.org/r/20211016005802.7729-4-stanley.chu@mediatek.com Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Add proper header for using sched_clock(). Link: https://lore.kernel.org/r/20211016005802.7729-3-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Introduce default delay time for gating or ungating reference clock instead of ambiguous magic numbers. The defined value is suitable for all current MediaTek UFS platforms. Link: https://lore.kernel.org/r/20211016005802.7729-2-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Oct 12, 2021
-
-
Peter Wang authored
Mediatek UFS needs auto-hibern8 disabled before suspend. Introduce a solution to do pre-suspend before SSU (sleep). Link: https://lore.kernel.org/r/20211006054705.21885-1-peter.wang@mediatek.com Reviewed-by:
Bart Van Assche <bvanassche@acm.org> Reviewed-by:
Bean Huo <beanhuo@micron.com> Signed-off-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Sep 15, 2021
-
-
Peter Wang authored
Mediatek UFS dbg select setting is changed in new IP version. Check the IP version before setting dbg select. Link: https://lore.kernel.org/r/1630918387-8333-1-git-send-email-peter.wang@mediatek.com Signed-off-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Aug 03, 2021
-
-
Bart Van Assche authored
Move the dev_get_drvdata() calls into the ufshcd_{system,runtime}_*() functions. Remove ufshcd_runtime_idle() since it is empty. This patch does not change any functionality. Link: https://lore.kernel.org/r/20210722033439.26550-3-bvanassche@acm.org Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Can Guo <cang@codeaurora.org> Cc: Asutosh Das <asutoshd@codeaurora.org> Reviewed-by:
Avri Altman <avri.altman@wdc.com> Reviewed-by:
Bean Huo <beanhuo@micron.com> Reviewed-by:
Daejun Park <daejun7.park@samsung.com> Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Bart Van Assche <bvanassche@acm.org> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jun 19, 2021
-
-
Zou Wei authored
The function is missing a of_node_put() on node. Fix this by adding the call before returning. Link: https://lore.kernel.org/r/1623929522-4389-1-git-send-email-zou_wei@huawei.com Reported-by:
Hulk Robot <hulkci@huawei.com> Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Zou Wei <zou_wei@huawei.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jun 16, 2021
-
-
Peter Wang authored
Mediatek UFS reset function relies on Reset Control provided by reset-ti-syscon. To make Mediatek Reset Control work properly, select reset-ti-syscon to ensure it is being built. In addition, establish device_link to wait until reset-ti-syscon initialization is complete during UFS probing. Link: https://lore.kernel.org/r/1622601720-22466-1-git-send-email-peter.wang@mediatek.com Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jun 02, 2021
-
-
Alice.Chao authored
MediaTek ufshci needs to be disabled before HW reset to avoid potential issues. Link: https://lore.kernel.org/r/20210528033624.12170-3-alice.chao@mediatek.com Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Alice.Chao <alice.chao@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Some MediaTek SoC platforms with UFSHCI version below 3.0 have incorrect UFSHCI versions showed in register map. Fix the version by referring to UniPro version which is always correct. Link: https://lore.kernel.org/r/20210531062642.12642-1-stanley.chu@mediatek.com Reviewed-by:
Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- May 15, 2021
-
-
Peter Wang authored
As per spec, e.g. JESD220E chapter 7.2, while powering off the UFS device, RST_N signal should be between VSS(Ground) and VCCQ/VCCQ2. The power down sequence after fixing: Power down: 1. Assert RST_N low 2. Turn-off VCC 3. Turn-off VCCQ/VCCQ2 Link: https://lore.kernel.org/r/1620813706-25331-1-git-send-email-peter.wang@mediatek.com Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- May 11, 2021
-
-
Asutosh Das authored
During runtime-suspend of ufs host, the SCSI devices are already suspended and so are the queues associated with them. However, the ufs host sends SSU (START_STOP_UNIT) to the wlun during runtime-suspend. During the process blk_queue_enter() checks if the queue is not in suspended state. If so, it waits for the queue to resume, and never comes out of it. Commit 52abca64 ("scsi: block: Do not accept any requests while suspended") adds the check to see if the queue is in suspended state in blk_queue_enter(). Call trace: __switch_to+0x174/0x2c4 __schedule+0x478/0x764 schedule+0x9c/0xe0 blk_queue_enter+0x158/0x228 blk_mq_alloc_request+0x40/0xa4 blk_get_request+0x2c/0x70 __scsi_execute+0x60/0x1c4 ufshcd_set_dev_pwr_mode+0x124/0x1e4 ufshcd_suspend+0x208/0x83c ufshcd_runtime_suspend+0x40/0x154 ufshcd_pltfrm_runtime_suspend+0x14/0x20 pm_generic_runtime_suspend+0x28/0x3c __rpm_callback+0x80/0x2a4 rpm_suspend+0x308/0x614 rpm_idle+0x158/0x228 pm_runtime_work+0x84/0xac process_one_work+0x1f0/0x470 worker_thread+0x26c/0x4c8 kthread+0x13c/0x320 ret_from_fork+0x10/0x18 Fix this by registering ufs device wlun as a SCSI driver and registering it for block runtime-pm. Also make this a supplier for all other LUNs. This way the wlun device suspends after all the consumers and resumes after HBA resumes. This also registers a new SCSI driver for rpmb wlun. This new driver is mostly used to clear rpmb uac. [mkp: resolve merge conflict with 5.13-rc1 and fix doc warning] Fixed smatch warnings: Reported-by:
kernel test robot <lkp@intel.com> Reported-by:
Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/4662c462e79e3e7f541f54f88f8993f421026d83.1619223249.git.asutoshd@codeaurora.org Reviewed-by:
Adrian Hunter <adrian.hunter@intel.com> Co-developed-by:
Can Guo <cang@codeaurora.org> Signed-off-by:
Can Guo <cang@codeaurora.org> Signed-off-by:
Asutosh Das <asutoshd@codeaurora.org> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Mar 17, 2021
-
-
dongjian authored
The "lpm" and "->enabled" are all boolean. We should be using && rather than the bit operator. Link: https://lore.kernel.org/r/1615896915-148864-1-git-send-email-dj0227@163.com Fixes: 488edafb ("scsi: ufs-mediatek: Introduce low-power mode for device power supply") Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
dongjian <dongjian@yulong.com> Signed-off-by:
Yue Hu <huyue2@yulong.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jan 06, 2021
-
-
Stanley Chu authored
Flush during hibern8 is sufficient on MediaTek platforms, thus enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling fWriteBoosterBufferFlush during WriteBooster initialization. Link: https://lore.kernel.org/r/20201222072928.32328-1-stanley.chu@mediatek.com Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Dec 09, 2020
-
-
Stanley Chu authored
For some devices which need extra delay after VCC power down, VCC shall be kept always-on in some MediaTek UFS platforms to ensure the stability of such devices because the extra delay may not be enough in those platforms. Link: https://lore.kernel.org/r/20201207054955.24366-3-stanley.chu@mediatek.com Reviewed-by:
Andy Teng <andy.teng@mediatek.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Dec 07, 2020
-
-
Stanley Chu authored
Introduce event_notify implementation on MediaTek UFS platform. A vendor-specific tracepoint is added that can be used for debugging purposes. Link: https://lore.kernel.org/r/20201205115901.26815-5-stanley.chu@mediatek.com Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Nov 17, 2020
-
-
Stanley Chu authored
Use common ADAPT configuration function to reduce duplicated code in UFS drivers. Link: https://lore.kernel.org/r/20201116065054.7658-9-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>
-
Stanley Chu authored
Use common device parameter initialization function instead of initializing those parameters by vendor driver itself. Link: https://lore.kernel.org/r/20201116065054.7658-4-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>
-
Stanley Chu authored
Refactor performance scaling related functions in MediaTek UFS driver. Link: https://lore.kernel.org/r/20201116065054.7658-2-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>
-
- Nov 11, 2020
-
-
Stanley Chu authored
Provide HS-G4 support in MediaTek UFS platforms. To support HS-G4, introduce mechanism to get the MediaTek UFS controller version. With such information, driver can make right decision to apply different configurations in different controllers. Link: https://lore.kernel.org/r/20201029115750.24391-7-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Support an option to allow users to disable auto-hibern8 feature. Instead, enable hibern8-during-clk-gating feature to keep similar power consumption. Link: https://lore.kernel.org/r/20201029115750.24391-5-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
UFS proprietary features (including features introduced later) in MediaTek UFS platforms have complicated combinations among different platforms. To ease code readability and maintenance, decouple all proprietary features from platform bindings. Each feature would be enabled only if specific property string is defined in device tree node. Link: https://lore.kernel.org/r/20201029115750.24391-4-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Some MediaTek UFS platforms need to control VA09 power specifically. Provide such control according to the device tree binding. Link: https://lore.kernel.org/r/20201029115750.24391-3-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
In ufs_mtk_unipro_set_lpm(), use specific unsigned values as the argument to invoke ufshcd_dme_set(). At the same time, change the name of ufs_mtk_unipro_set_pm() to ufs_mtk_unipro_set_lpm() to align the naming convention in MediaTek UFS driver. Link: https://lore.kernel.org/r/20201029115750.24391-2-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Nov 05, 2020
-
-
Adrian Hunter authored
It is simpler for drivers to provide a ->device_reset() callback irrespective of whether the GPIO, or firmware interface necessary to do the reset, is discovered during probe. Change ->device_reset() to return an error code. Drivers that provide the callback, but do not do the reset operation should return -EOPNOTSUPP. Link: https://lore.kernel.org/r/20201103141403.2142-3-adrian.hunter@intel.com Reviewed-by:
Asutosh Das <asutoshd@codeaurora.org> Reviewed-by:
Stanley Chu <stanley.chu@mediatek.com> Reviewed-by:
Bean huo <beanhuo@micron.com> Reviewed-by:
Can Guo <cang@codeaurora.org> Signed-off-by:
Adrian Hunter <adrian.hunter@intel.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Sep 23, 2020
-
-
Stanley Chu authored
Some MediaTek UFS platforms support high-performance mode that inline encryption engine can be boosted while UFS is not clock-gated. The high-performance mode will be enabled if all below conditions are well-declaired in device tree, - Proper platform-specific compatible string which enables the host capability "UFS_MTK_CAP_BOOST_CRYPT_ENGINE". - "dvfsrc-vcore" node is available in this platform. - Required minimum vcore voltage for high-performance mode. - Clock mux and clock parents of inline encryption engine for both "low-power mode" and "high-performance mode". Link: https://lore.kernel.org/r/20200914050052.3974-2-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Sep 10, 2020
-
-
Stanley Chu authored
Fix build warnings with make W=1 as below, 1. >> drivers/scsi/ufs/ufs-mediatek.c:116:22: warning: format '%d' expects >> argument of type 'int', but argument 4 has type 'long int' 2. CC [M] drivers/scsi/ufs/ufs-mediatek.o ../drivers/scsi/ufs/ufs-mediatek.c:749: error: Cannot parse struct or union! /** is used specifically with kernel-doc tool. As a quick fix by removing dubious /** in the comment block of struct ufs_hba_variant_ops ufs_hba_mtk_vops. Link: https://lore.kernel.org/r/20200910013756.11385-1-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Sep 09, 2020
-
-
Stanley Chu authored
Add host reset mechanism to try to recover host-side errors during recovery flow. Link: https://lore.kernel.org/r/20200908064507.30774-5-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Forcibly leave UniPro low-power mode if UIC commands failed. This makes hba_enable_delay_us as correct (default) value for re-enabling the host. At the same time, change type of parameter "lpm" in function ufs_mtk_unipro_set_pm() to "bool". Link: https://lore.kernel.org/r/20200908064507.30774-4-stanley.chu@mediatek.com Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Simply add HOST_PA_TACTIVATE quirk back since it was incorrectly removed before. Link: https://lore.kernel.org/r/20200908064507.30774-3-stanley.chu@mediatek.com Fixes: 47d05458 ("scsi: ufs-mediatek: fix HOST_PA_TACTIVATE quirk for Samsung UFS Devices") Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
Stanley Chu authored
Some MediaTek platforms does not have to bind MPHY so users shall not see any unnecessary logs. Simply remove logs for this case. Link: https://lore.kernel.org/r/20200908064507.30774-2-stanley.chu@mediatek.com Fixes: fc498301 ("scsi: ufs-mediatek: Allow unbound mphy") Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Aug 18, 2020
-
-
Stanley Chu authored
Fix incorrect calculation of "ms" based waiting time in function ufs_mtk_setup_clocks(). Link: https://lore.kernel.org/r/20200809055702.20140-1-stanley.chu@mediatek.com Fixes: 9006e398 ("scsi: ufs-mediatek: Do not gate clocks if auto-hibern8 is not entered yet") Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jul 31, 2020
-
-
Stanley Chu authored
Micron UFS devices require DELAY_AFTER_LPM device quirk in MediaTek platforms. Link: https://lore.kernel.org/r/20200729051840.31318-3-stanley.chu@mediatek.com Acked-by:
Avri Altman <Avri.Altman@wdc.com> Reviewed-by:
Andy Teng <andy.teng@mediatek.com> Reviewed-by:
Peter Wang <peter.wang@mediatek.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jul 29, 2020
-
-
Stanley Chu authored
In some platforms, VCC regulator may not be declared in device tree to keep itself "always-on". In this case, hba->vreg_info.vcc is NULL and shall not be operated during any flow. Prevent possible NULL hba->vreg_info.vcc access in LPM mode by checking if it is valid first. Link: https://lore.kernel.org/r/20200724141627.20094-1-stanley.chu@mediatek.com Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- Jul 14, 2020
-
-
Stanley Chu authored
Add inline encryption support to ufs-mediatek. 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 MediaTek UFS host requires a vendor-specific hce_enable operation to allow crypto-related registers being accessed normally in kernel. After this step, MediaTek UFS host can work as standard-compliant host for inline-encryption related functions. Link: https://lore.kernel.org/r/20200712003226.7593-1-stanley.chu@mediatek.com Reviewed-by:
Avri Altman <avri.altman@wdc.com> Signed-off-by:
Stanley Chu <stanley.chu@mediatek.com> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-