~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/ufs/ufs_quirks.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
  4  */
  5 
  6 #ifndef _UFS_QUIRKS_H_
  7 #define _UFS_QUIRKS_H_
  8 
  9 /* return true if s1 is a prefix of s2 */
 10 #define STR_PRFX_EQUAL(s1, s2) !strncmp(s1, s2, strlen(s1))
 11 
 12 #define UFS_ANY_VENDOR 0xFFFF
 13 #define UFS_ANY_MODEL  "ANY_MODEL"
 14 
 15 #define UFS_VENDOR_MICRON      0x12C
 16 #define UFS_VENDOR_SAMSUNG     0x1CE
 17 #define UFS_VENDOR_SKHYNIX     0x1AD
 18 #define UFS_VENDOR_TOSHIBA     0x198
 19 #define UFS_VENDOR_WDC         0x145
 20 
 21 /**
 22  * ufs_dev_quirk - ufs device quirk info
 23  * @card: ufs card details
 24  * @quirk: device quirk
 25  */
 26 struct ufs_dev_quirk {
 27         u16 wmanufacturerid;
 28         const u8 *model;
 29         unsigned int quirk;
 30 };
 31 
 32 /*
 33  * Some vendor's UFS device sends back to back NACs for the DL data frames
 34  * causing the host controller to raise the DFES error status. Sometimes
 35  * such UFS devices send back to back NAC without waiting for new
 36  * retransmitted DL frame from the host and in such cases it might be possible
 37  * the Host UniPro goes into bad state without raising the DFES error
 38  * interrupt. If this happens then all the pending commands would timeout
 39  * only after respective SW command (which is generally too large).
 40  *
 41  * We can workaround such device behaviour like this:
 42  * - As soon as SW sees the DL NAC error, it should schedule the error handler
 43  * - Error handler would sleep for 50ms to see if there are any fatal errors
 44  *   raised by UFS controller.
 45  *    - If there are fatal errors then SW does normal error recovery.
 46  *    - If there are no fatal errors then SW sends the NOP command to device
 47  *      to check if link is alive.
 48  *        - If NOP command times out, SW does normal error recovery
 49  *        - If NOP command succeed, skip the error handling.
 50  *
 51  * If DL NAC error is seen multiple times with some vendor's UFS devices then
 52  * enable this quirk to initiate quick error recovery and also silence related
 53  * error logs to reduce spamming of kernel logs.
 54  */
 55 #define UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS (1 << 2)
 56 
 57 /*
 58  * Few Toshiba UFS device models advertise RX_MIN_ACTIVATETIME_CAPABILITY as
 59  * 600us which may not be enough for reliable hibern8 exit hardware sequence
 60  * from UFS device.
 61  * To workaround this issue, host should set its PA_TACTIVATE time to 1ms even
 62  * if device advertises RX_MIN_ACTIVATETIME_CAPABILITY less than 1ms.
 63  */
 64 #define UFS_DEVICE_QUIRK_PA_TACTIVATE   (1 << 4)
 65 
 66 /*
 67  * It seems some UFS devices may keep drawing more than sleep current
 68  * (atleast for 500us) from UFS rails (especially from VCCQ rail).
 69  * To avoid this situation, add 2ms delay before putting these UFS
 70  * rails in LPM mode.
 71  */
 72 #define UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM       (1 << 6)
 73 
 74 /*
 75  * Some UFS devices require host PA_TACTIVATE to be lower than device
 76  * PA_TACTIVATE, enabling this quirk ensure this.
 77  */
 78 #define UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE      (1 << 7)
 79 
 80 /*
 81  * The max. value PA_SaveConfigTime is 250 (10us) but this is not enough for
 82  * some vendors.
 83  * Gear switch from PWM to HS may fail even with this max. PA_SaveConfigTime.
 84  * Gear switch can be issued by host controller as an error recovery and any
 85  * software delay will not help on this case so we need to increase
 86  * PA_SaveConfigTime to >32us as per vendor recommendation.
 87  */
 88 #define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME (1 << 8)
 89 
 90 /*
 91  * Some UFS devices require VS_DebugSaveConfigTime is 0x10,
 92  * enabling this quirk ensure this.
 93  */
 94 #define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME    (1 << 9)
 95 
 96 /*
 97  * Some pre-3.1 UFS devices can support extended features by upgrading
 98  * the firmware. Enable this quirk to make UFS core driver probe and enable
 99  * supported features on such devices.
100  */
101 #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10)
102 
103 /*
104  * Some UFS devices require delay after VCC power rail is turned-off.
105  * Enable this quirk to introduce 5ms delays after VCC power-off during
106  * suspend flow.
107  */
108 #define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM        (1 << 11)
109 
110 #endif /* UFS_QUIRKS_H_ */
111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php