![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* 0003 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. 0004 */ 0005 0006 #ifndef _UFS_QUIRKS_H_ 0007 #define _UFS_QUIRKS_H_ 0008 0009 /* return true if s1 is a prefix of s2 */ 0010 #define STR_PRFX_EQUAL(s1, s2) !strncmp(s1, s2, strlen(s1)) 0011 0012 #define UFS_ANY_VENDOR 0xFFFF 0013 #define UFS_ANY_MODEL "ANY_MODEL" 0014 0015 #define UFS_VENDOR_MICRON 0x12C 0016 #define UFS_VENDOR_SAMSUNG 0x1CE 0017 #define UFS_VENDOR_SKHYNIX 0x1AD 0018 #define UFS_VENDOR_TOSHIBA 0x198 0019 #define UFS_VENDOR_WDC 0x145 0020 0021 /** 0022 * ufs_dev_quirk - ufs device quirk info 0023 * @card: ufs card details 0024 * @quirk: device quirk 0025 */ 0026 struct ufs_dev_quirk { 0027 u16 wmanufacturerid; 0028 const u8 *model; 0029 unsigned int quirk; 0030 }; 0031 0032 /* 0033 * Some vendor's UFS device sends back to back NACs for the DL data frames 0034 * causing the host controller to raise the DFES error status. Sometimes 0035 * such UFS devices send back to back NAC without waiting for new 0036 * retransmitted DL frame from the host and in such cases it might be possible 0037 * the Host UniPro goes into bad state without raising the DFES error 0038 * interrupt. If this happens then all the pending commands would timeout 0039 * only after respective SW command (which is generally too large). 0040 * 0041 * We can workaround such device behaviour like this: 0042 * - As soon as SW sees the DL NAC error, it should schedule the error handler 0043 * - Error handler would sleep for 50ms to see if there are any fatal errors 0044 * raised by UFS controller. 0045 * - If there are fatal errors then SW does normal error recovery. 0046 * - If there are no fatal errors then SW sends the NOP command to device 0047 * to check if link is alive. 0048 * - If NOP command times out, SW does normal error recovery 0049 * - If NOP command succeed, skip the error handling. 0050 * 0051 * If DL NAC error is seen multiple times with some vendor's UFS devices then 0052 * enable this quirk to initiate quick error recovery and also silence related 0053 * error logs to reduce spamming of kernel logs. 0054 */ 0055 #define UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS (1 << 2) 0056 0057 /* 0058 * Few Toshiba UFS device models advertise RX_MIN_ACTIVATETIME_CAPABILITY as 0059 * 600us which may not be enough for reliable hibern8 exit hardware sequence 0060 * from UFS device. 0061 * To workaround this issue, host should set its PA_TACTIVATE time to 1ms even 0062 * if device advertises RX_MIN_ACTIVATETIME_CAPABILITY less than 1ms. 0063 */ 0064 #define UFS_DEVICE_QUIRK_PA_TACTIVATE (1 << 4) 0065 0066 /* 0067 * It seems some UFS devices may keep drawing more than sleep current 0068 * (atleast for 500us) from UFS rails (especially from VCCQ rail). 0069 * To avoid this situation, add 2ms delay before putting these UFS 0070 * rails in LPM mode. 0071 */ 0072 #define UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM (1 << 6) 0073 0074 /* 0075 * Some UFS devices require host PA_TACTIVATE to be lower than device 0076 * PA_TACTIVATE, enabling this quirk ensure this. 0077 */ 0078 #define UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE (1 << 7) 0079 0080 /* 0081 * The max. value PA_SaveConfigTime is 250 (10us) but this is not enough for 0082 * some vendors. 0083 * Gear switch from PWM to HS may fail even with this max. PA_SaveConfigTime. 0084 * Gear switch can be issued by host controller as an error recovery and any 0085 * software delay will not help on this case so we need to increase 0086 * PA_SaveConfigTime to >32us as per vendor recommendation. 0087 */ 0088 #define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME (1 << 8) 0089 0090 /* 0091 * Some UFS devices require VS_DebugSaveConfigTime is 0x10, 0092 * enabling this quirk ensure this. 0093 */ 0094 #define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME (1 << 9) 0095 0096 /* 0097 * Some pre-3.1 UFS devices can support extended features by upgrading 0098 * the firmware. Enable this quirk to make UFS core driver probe and enable 0099 * supported features on such devices. 0100 */ 0101 #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10) 0102 0103 /* 0104 * Some UFS devices require delay after VCC power rail is turned-off. 0105 * Enable this quirk to introduce 5ms delays after VCC power-off during 0106 * suspend flow. 0107 */ 0108 #define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM (1 << 11) 0109 0110 /* 0111 * Some UFS devices require L2P entry should be swapped before being sent to the 0112 * UFS device for HPB READ command. 0113 */ 0114 #define UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ (1 << 12) 0115 0116 #endif /* UFS_QUIRKS_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |