ufs.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. /*
  2. * Universal Flash Storage Host controller driver
  3. *
  4. * This code is based on drivers/scsi/ufs/ufs.h
  5. * Copyright (C) 2011-2013 Samsung India Software Operations
  6. *
  7. * Authors:
  8. * Santosh Yaraganavi <santosh.sy@samsung.com>
  9. * Vinayak Holikatti <h.vinayak@samsung.com>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. * See the COPYING file in the top-level directory or visit
  16. * <http://www.gnu.org/licenses/gpl-2.0.html>
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * This program is provided "AS IS" and "WITH ALL FAULTS" and
  24. * without warranty of any kind. You are solely responsible for
  25. * determining the appropriateness of using and distributing
  26. * the program and assume all risks associated with your exercise
  27. * of rights with respect to the program, including but not limited
  28. * to infringement of third party rights, the risks and costs of
  29. * program errors, damage to or loss of data, programs or equipment,
  30. * and unavailability or interruption of operations. Under no
  31. * circumstances will the contributor of this Program be liable for
  32. * any damages of any kind arising from your use or distribution of
  33. * this program.
  34. */
  35. #ifndef _UFS_H
  36. #define _UFS_H
  37. #include <linux/mutex.h>
  38. #include <linux/types.h>
  39. #define MAX_CDB_SIZE 16
  40. #define GENERAL_UPIU_REQUEST_SIZE 32
  41. #define QUERY_DESC_MAX_SIZE 255
  42. #define QUERY_DESC_MIN_SIZE 2
  43. #define QUERY_DESC_HDR_SIZE 2
  44. #define QUERY_OSF_SIZE (GENERAL_UPIU_REQUEST_SIZE - \
  45. (sizeof(struct utp_upiu_header)))
  46. #define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
  47. cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
  48. (byte1 << 8) | (byte0))
  49. /*
  50. * UFS device may have standard LUs and LUN id could be from 0x00 to
  51. * 0x7F. Standard LUs use "Peripheral Device Addressing Format".
  52. * UFS device may also have the Well Known LUs (also referred as W-LU)
  53. * which again could be from 0x00 to 0x7F. For W-LUs, device only use
  54. * the "Extended Addressing Format" which means the W-LUNs would be
  55. * from 0xc100 (SCSI_W_LUN_BASE) onwards.
  56. * This means max. LUN number reported from UFS device could be 0xC17F.
  57. */
  58. #define UFS_UPIU_MAX_UNIT_NUM_ID 0x7F
  59. #define UFS_MAX_LUNS (SCSI_W_LUN_BASE + UFS_UPIU_MAX_UNIT_NUM_ID)
  60. #define UFS_UPIU_WLUN_ID (1 << 7)
  61. #define UFS_UPIU_MAX_GENERAL_LUN 8
  62. /* Well known logical unit id in LUN field of UPIU */
  63. enum {
  64. UFS_UPIU_REPORT_LUNS_WLUN = 0x81,
  65. UFS_UPIU_UFS_DEVICE_WLUN = 0xD0,
  66. UFS_UPIU_BOOT_WLUN = 0xB0,
  67. UFS_UPIU_RPMB_WLUN = 0xC4,
  68. };
  69. /*
  70. * UFS Protocol Information Unit related definitions
  71. */
  72. /* Task management functions */
  73. enum {
  74. UFS_ABORT_TASK = 0x01,
  75. UFS_ABORT_TASK_SET = 0x02,
  76. UFS_CLEAR_TASK_SET = 0x04,
  77. UFS_LOGICAL_RESET = 0x08,
  78. UFS_QUERY_TASK = 0x80,
  79. UFS_QUERY_TASK_SET = 0x81,
  80. };
  81. /* UTP UPIU Transaction Codes Initiator to Target */
  82. enum {
  83. UPIU_TRANSACTION_NOP_OUT = 0x00,
  84. UPIU_TRANSACTION_COMMAND = 0x01,
  85. UPIU_TRANSACTION_DATA_OUT = 0x02,
  86. UPIU_TRANSACTION_TASK_REQ = 0x04,
  87. UPIU_TRANSACTION_QUERY_REQ = 0x16,
  88. };
  89. /* UTP UPIU Transaction Codes Target to Initiator */
  90. enum {
  91. UPIU_TRANSACTION_NOP_IN = 0x20,
  92. UPIU_TRANSACTION_RESPONSE = 0x21,
  93. UPIU_TRANSACTION_DATA_IN = 0x22,
  94. UPIU_TRANSACTION_TASK_RSP = 0x24,
  95. UPIU_TRANSACTION_READY_XFER = 0x31,
  96. UPIU_TRANSACTION_QUERY_RSP = 0x36,
  97. UPIU_TRANSACTION_REJECT_UPIU = 0x3F,
  98. };
  99. /* UPIU Read/Write flags */
  100. enum {
  101. UPIU_CMD_FLAGS_NONE = 0x00,
  102. UPIU_CMD_FLAGS_WRITE = 0x20,
  103. UPIU_CMD_FLAGS_READ = 0x40,
  104. };
  105. /* UPIU Task Attributes */
  106. enum {
  107. UPIU_TASK_ATTR_SIMPLE = 0x00,
  108. UPIU_TASK_ATTR_ORDERED = 0x01,
  109. UPIU_TASK_ATTR_HEADQ = 0x02,
  110. UPIU_TASK_ATTR_ACA = 0x03,
  111. };
  112. /* UPIU Query request function */
  113. enum {
  114. UPIU_QUERY_FUNC_STANDARD_READ_REQUEST = 0x01,
  115. UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST = 0x81,
  116. };
  117. /* Flag idn for Query Requests*/
  118. enum flag_idn {
  119. QUERY_FLAG_IDN_FDEVICEINIT = 0x01,
  120. QUERY_FLAG_IDN_PWR_ON_WPE = 0x03,
  121. QUERY_FLAG_IDN_BKOPS_EN = 0x04,
  122. };
  123. /* Attribute idn for Query requests */
  124. enum attr_idn {
  125. QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03,
  126. QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
  127. QUERY_ATTR_IDN_EE_CONTROL = 0x0D,
  128. QUERY_ATTR_IDN_EE_STATUS = 0x0E,
  129. };
  130. /* Descriptor idn for Query requests */
  131. enum desc_idn {
  132. QUERY_DESC_IDN_DEVICE = 0x0,
  133. QUERY_DESC_IDN_CONFIGURAION = 0x1,
  134. QUERY_DESC_IDN_UNIT = 0x2,
  135. QUERY_DESC_IDN_RFU_0 = 0x3,
  136. QUERY_DESC_IDN_INTERCONNECT = 0x4,
  137. QUERY_DESC_IDN_STRING = 0x5,
  138. QUERY_DESC_IDN_RFU_1 = 0x6,
  139. QUERY_DESC_IDN_GEOMETRY = 0x7,
  140. QUERY_DESC_IDN_POWER = 0x8,
  141. QUERY_DESC_IDN_MAX,
  142. };
  143. enum desc_header_offset {
  144. QUERY_DESC_LENGTH_OFFSET = 0x00,
  145. QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
  146. };
  147. enum ufs_desc_max_size {
  148. QUERY_DESC_DEVICE_MAX_SIZE = 0x1F,
  149. QUERY_DESC_CONFIGURAION_MAX_SIZE = 0x90,
  150. QUERY_DESC_UNIT_MAX_SIZE = 0x23,
  151. QUERY_DESC_INTERCONNECT_MAX_SIZE = 0x06,
  152. /*
  153. * Max. 126 UNICODE characters (2 bytes per character) plus 2 bytes
  154. * of descriptor header.
  155. */
  156. QUERY_DESC_STRING_MAX_SIZE = 0xFE,
  157. QUERY_DESC_GEOMETRY_MAX_SIZE = 0x44,
  158. QUERY_DESC_POWER_MAX_SIZE = 0x62,
  159. QUERY_DESC_RFU_MAX_SIZE = 0x00,
  160. };
  161. /* Unit descriptor parameters offsets in bytes*/
  162. enum unit_desc_param {
  163. UNIT_DESC_PARAM_LEN = 0x0,
  164. UNIT_DESC_PARAM_TYPE = 0x1,
  165. UNIT_DESC_PARAM_UNIT_INDEX = 0x2,
  166. UNIT_DESC_PARAM_LU_ENABLE = 0x3,
  167. UNIT_DESC_PARAM_BOOT_LUN_ID = 0x4,
  168. UNIT_DESC_PARAM_LU_WR_PROTECT = 0x5,
  169. UNIT_DESC_PARAM_LU_Q_DEPTH = 0x6,
  170. UNIT_DESC_PARAM_MEM_TYPE = 0x8,
  171. UNIT_DESC_PARAM_DATA_RELIABILITY = 0x9,
  172. UNIT_DESC_PARAM_LOGICAL_BLK_SIZE = 0xA,
  173. UNIT_DESC_PARAM_LOGICAL_BLK_COUNT = 0xB,
  174. UNIT_DESC_PARAM_ERASE_BLK_SIZE = 0x13,
  175. UNIT_DESC_PARAM_PROVISIONING_TYPE = 0x17,
  176. UNIT_DESC_PARAM_PHY_MEM_RSRC_CNT = 0x18,
  177. UNIT_DESC_PARAM_CTX_CAPABILITIES = 0x20,
  178. UNIT_DESC_PARAM_LARGE_UNIT_SIZE_M1 = 0x22,
  179. };
  180. /* Device descriptor parameters offsets in bytes*/
  181. enum device_desc_param {
  182. DEVICE_DESC_PARAM_LEN = 0x0,
  183. DEVICE_DESC_PARAM_TYPE = 0x1,
  184. DEVICE_DESC_PARAM_DEVICE_TYPE = 0x2,
  185. DEVICE_DESC_PARAM_DEVICE_CLASS = 0x3,
  186. DEVICE_DESC_PARAM_DEVICE_SUB_CLASS = 0x4,
  187. DEVICE_DESC_PARAM_PRTCL = 0x5,
  188. DEVICE_DESC_PARAM_NUM_LU = 0x6,
  189. DEVICE_DESC_PARAM_NUM_WLU = 0x7,
  190. DEVICE_DESC_PARAM_BOOT_ENBL = 0x8,
  191. DEVICE_DESC_PARAM_DESC_ACCSS_ENBL = 0x9,
  192. DEVICE_DESC_PARAM_INIT_PWR_MODE = 0xA,
  193. DEVICE_DESC_PARAM_HIGH_PR_LUN = 0xB,
  194. DEVICE_DESC_PARAM_SEC_RMV_TYPE = 0xC,
  195. DEVICE_DESC_PARAM_SEC_LU = 0xD,
  196. DEVICE_DESC_PARAM_BKOP_TERM_LT = 0xE,
  197. DEVICE_DESC_PARAM_ACTVE_ICC_LVL = 0xF,
  198. DEVICE_DESC_PARAM_SPEC_VER = 0x10,
  199. DEVICE_DESC_PARAM_MANF_DATE = 0x12,
  200. DEVICE_DESC_PARAM_MANF_NAME = 0x14,
  201. DEVICE_DESC_PARAM_PRDCT_NAME = 0x15,
  202. DEVICE_DESC_PARAM_SN = 0x16,
  203. DEVICE_DESC_PARAM_OEM_ID = 0x17,
  204. DEVICE_DESC_PARAM_MANF_ID = 0x18,
  205. DEVICE_DESC_PARAM_UD_OFFSET = 0x1A,
  206. DEVICE_DESC_PARAM_UD_LEN = 0x1B,
  207. DEVICE_DESC_PARAM_RTT_CAP = 0x1C,
  208. DEVICE_DESC_PARAM_FRQ_RTC = 0x1D,
  209. };
  210. /*
  211. * Logical Unit Write Protect
  212. * 00h: LU not write protected
  213. * 01h: LU write protected when fPowerOnWPEn =1
  214. * 02h: LU permanently write protected when fPermanentWPEn =1
  215. */
  216. enum ufs_lu_wp_type {
  217. UFS_LU_NO_WP = 0x00,
  218. UFS_LU_POWER_ON_WP = 0x01,
  219. UFS_LU_PERM_WP = 0x02,
  220. };
  221. /* bActiveICCLevel parameter current units */
  222. enum {
  223. UFSHCD_NANO_AMP = 0,
  224. UFSHCD_MICRO_AMP = 1,
  225. UFSHCD_MILI_AMP = 2,
  226. UFSHCD_AMP = 3,
  227. };
  228. #define POWER_DESC_MAX_SIZE 0x62
  229. #define POWER_DESC_MAX_ACTV_ICC_LVLS 16
  230. /* Attribute bActiveICCLevel parameter bit masks definitions */
  231. #define ATTR_ICC_LVL_UNIT_OFFSET 14
  232. #define ATTR_ICC_LVL_UNIT_MASK (0x3 << ATTR_ICC_LVL_UNIT_OFFSET)
  233. #define ATTR_ICC_LVL_VALUE_MASK 0x3FF
  234. /* Power descriptor parameters offsets in bytes */
  235. enum power_desc_param_offset {
  236. PWR_DESC_LEN = 0x0,
  237. PWR_DESC_TYPE = 0x1,
  238. PWR_DESC_ACTIVE_LVLS_VCC_0 = 0x2,
  239. PWR_DESC_ACTIVE_LVLS_VCCQ_0 = 0x22,
  240. PWR_DESC_ACTIVE_LVLS_VCCQ2_0 = 0x42,
  241. };
  242. /* Exception event mask values */
  243. enum {
  244. MASK_EE_STATUS = 0xFFFF,
  245. MASK_EE_URGENT_BKOPS = (1 << 2),
  246. };
  247. /* Background operation status */
  248. enum bkops_status {
  249. BKOPS_STATUS_NO_OP = 0x0,
  250. BKOPS_STATUS_NON_CRITICAL = 0x1,
  251. BKOPS_STATUS_PERF_IMPACT = 0x2,
  252. BKOPS_STATUS_CRITICAL = 0x3,
  253. BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL,
  254. };
  255. /* UTP QUERY Transaction Specific Fields OpCode */
  256. enum query_opcode {
  257. UPIU_QUERY_OPCODE_NOP = 0x0,
  258. UPIU_QUERY_OPCODE_READ_DESC = 0x1,
  259. UPIU_QUERY_OPCODE_WRITE_DESC = 0x2,
  260. UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
  261. UPIU_QUERY_OPCODE_WRITE_ATTR = 0x4,
  262. UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
  263. UPIU_QUERY_OPCODE_SET_FLAG = 0x6,
  264. UPIU_QUERY_OPCODE_CLEAR_FLAG = 0x7,
  265. UPIU_QUERY_OPCODE_TOGGLE_FLAG = 0x8,
  266. };
  267. /* Query response result code */
  268. enum {
  269. QUERY_RESULT_SUCCESS = 0x00,
  270. QUERY_RESULT_NOT_READABLE = 0xF6,
  271. QUERY_RESULT_NOT_WRITEABLE = 0xF7,
  272. QUERY_RESULT_ALREADY_WRITTEN = 0xF8,
  273. QUERY_RESULT_INVALID_LENGTH = 0xF9,
  274. QUERY_RESULT_INVALID_VALUE = 0xFA,
  275. QUERY_RESULT_INVALID_SELECTOR = 0xFB,
  276. QUERY_RESULT_INVALID_INDEX = 0xFC,
  277. QUERY_RESULT_INVALID_IDN = 0xFD,
  278. QUERY_RESULT_INVALID_OPCODE = 0xFE,
  279. QUERY_RESULT_GENERAL_FAILURE = 0xFF,
  280. };
  281. /* UTP Transfer Request Command Type (CT) */
  282. enum {
  283. UPIU_COMMAND_SET_TYPE_SCSI = 0x0,
  284. UPIU_COMMAND_SET_TYPE_UFS = 0x1,
  285. UPIU_COMMAND_SET_TYPE_QUERY = 0x2,
  286. };
  287. /* UTP Transfer Request Command Offset */
  288. #define UPIU_COMMAND_TYPE_OFFSET 28
  289. /* Offset of the response code in the UPIU header */
  290. #define UPIU_RSP_CODE_OFFSET 8
  291. enum {
  292. MASK_SCSI_STATUS = 0xFF,
  293. MASK_TASK_RESPONSE = 0xFF00,
  294. MASK_RSP_UPIU_RESULT = 0xFFFF,
  295. MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
  296. MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
  297. MASK_RSP_EXCEPTION_EVENT = 0x10000,
  298. MASK_TM_SERVICE_RESP = 0xFF,
  299. };
  300. /* Task management service response */
  301. enum {
  302. UPIU_TASK_MANAGEMENT_FUNC_COMPL = 0x00,
  303. UPIU_TASK_MANAGEMENT_FUNC_NOT_SUPPORTED = 0x04,
  304. UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED = 0x08,
  305. UPIU_TASK_MANAGEMENT_FUNC_FAILED = 0x05,
  306. UPIU_INCORRECT_LOGICAL_UNIT_NO = 0x09,
  307. };
  308. /* UFS device power modes */
  309. enum ufs_dev_pwr_mode {
  310. UFS_ACTIVE_PWR_MODE = 1,
  311. UFS_SLEEP_PWR_MODE = 2,
  312. UFS_POWERDOWN_PWR_MODE = 3,
  313. };
  314. /**
  315. * struct utp_upiu_header - UPIU header structure
  316. * @dword_0: UPIU header DW-0
  317. * @dword_1: UPIU header DW-1
  318. * @dword_2: UPIU header DW-2
  319. */
  320. struct utp_upiu_header {
  321. __be32 dword_0;
  322. __be32 dword_1;
  323. __be32 dword_2;
  324. };
  325. /**
  326. * struct utp_upiu_cmd - Command UPIU structure
  327. * @data_transfer_len: Data Transfer Length DW-3
  328. * @cdb: Command Descriptor Block CDB DW-4 to DW-7
  329. */
  330. struct utp_upiu_cmd {
  331. __be32 exp_data_transfer_len;
  332. u8 cdb[MAX_CDB_SIZE];
  333. };
  334. /**
  335. * struct utp_upiu_query - upiu request buffer structure for
  336. * query request.
  337. * @opcode: command to perform B-0
  338. * @idn: a value that indicates the particular type of data B-1
  339. * @index: Index to further identify data B-2
  340. * @selector: Index to further identify data B-3
  341. * @reserved_osf: spec reserved field B-4,5
  342. * @length: number of descriptor bytes to read/write B-6,7
  343. * @value: Attribute value to be written DW-5
  344. * @reserved: spec reserved DW-6,7
  345. */
  346. struct utp_upiu_query {
  347. u8 opcode;
  348. u8 idn;
  349. u8 index;
  350. u8 selector;
  351. __be16 reserved_osf;
  352. __be16 length;
  353. __be32 value;
  354. __be32 reserved[2];
  355. };
  356. /**
  357. * struct utp_upiu_req - general upiu request structure
  358. * @header:UPIU header structure DW-0 to DW-2
  359. * @sc: fields structure for scsi command DW-3 to DW-7
  360. * @qr: fields structure for query request DW-3 to DW-7
  361. */
  362. struct utp_upiu_req {
  363. struct utp_upiu_header header;
  364. union {
  365. struct utp_upiu_cmd sc;
  366. struct utp_upiu_query qr;
  367. };
  368. };
  369. /**
  370. * struct utp_cmd_rsp - Response UPIU structure
  371. * @residual_transfer_count: Residual transfer count DW-3
  372. * @reserved: Reserved double words DW-4 to DW-7
  373. * @sense_data_len: Sense data length DW-8 U16
  374. * @sense_data: Sense data field DW-8 to DW-12
  375. */
  376. struct utp_cmd_rsp {
  377. __be32 residual_transfer_count;
  378. __be32 reserved[4];
  379. __be16 sense_data_len;
  380. u8 sense_data[18];
  381. };
  382. /**
  383. * struct utp_upiu_rsp - general upiu response structure
  384. * @header: UPIU header structure DW-0 to DW-2
  385. * @sr: fields structure for scsi command DW-3 to DW-12
  386. * @qr: fields structure for query request DW-3 to DW-7
  387. */
  388. struct utp_upiu_rsp {
  389. struct utp_upiu_header header;
  390. union {
  391. struct utp_cmd_rsp sr;
  392. struct utp_upiu_query qr;
  393. };
  394. };
  395. /**
  396. * struct utp_upiu_task_req - Task request UPIU structure
  397. * @header - UPIU header structure DW0 to DW-2
  398. * @input_param1: Input parameter 1 DW-3
  399. * @input_param2: Input parameter 2 DW-4
  400. * @input_param3: Input parameter 3 DW-5
  401. * @reserved: Reserved double words DW-6 to DW-7
  402. */
  403. struct utp_upiu_task_req {
  404. struct utp_upiu_header header;
  405. __be32 input_param1;
  406. __be32 input_param2;
  407. __be32 input_param3;
  408. __be32 reserved[2];
  409. };
  410. /**
  411. * struct utp_upiu_task_rsp - Task Management Response UPIU structure
  412. * @header: UPIU header structure DW0-DW-2
  413. * @output_param1: Ouput parameter 1 DW3
  414. * @output_param2: Output parameter 2 DW4
  415. * @reserved: Reserved double words DW-5 to DW-7
  416. */
  417. struct utp_upiu_task_rsp {
  418. struct utp_upiu_header header;
  419. __be32 output_param1;
  420. __be32 output_param2;
  421. __be32 reserved[3];
  422. };
  423. /**
  424. * struct ufs_query_req - parameters for building a query request
  425. * @query_func: UPIU header query function
  426. * @upiu_req: the query request data
  427. */
  428. struct ufs_query_req {
  429. u8 query_func;
  430. struct utp_upiu_query upiu_req;
  431. };
  432. /**
  433. * struct ufs_query_resp - UPIU QUERY
  434. * @response: device response code
  435. * @upiu_res: query response data
  436. */
  437. struct ufs_query_res {
  438. u8 response;
  439. struct utp_upiu_query upiu_res;
  440. };
  441. #define UFS_VREG_VCC_MIN_UV 2700000 /* uV */
  442. #define UFS_VREG_VCC_MAX_UV 3600000 /* uV */
  443. #define UFS_VREG_VCC_1P8_MIN_UV 1700000 /* uV */
  444. #define UFS_VREG_VCC_1P8_MAX_UV 1950000 /* uV */
  445. #define UFS_VREG_VCCQ_MIN_UV 1100000 /* uV */
  446. #define UFS_VREG_VCCQ_MAX_UV 1300000 /* uV */
  447. #define UFS_VREG_VCCQ2_MIN_UV 1650000 /* uV */
  448. #define UFS_VREG_VCCQ2_MAX_UV 1950000 /* uV */
  449. /*
  450. * VCCQ & VCCQ2 current requirement when UFS device is in sleep state
  451. * and link is in Hibern8 state.
  452. */
  453. #define UFS_VREG_LPM_LOAD_UA 1000 /* uA */
  454. struct ufs_vreg {
  455. struct regulator *reg;
  456. const char *name;
  457. bool enabled;
  458. bool unused;
  459. int min_uV;
  460. int max_uV;
  461. int min_uA;
  462. int max_uA;
  463. };
  464. struct ufs_vreg_info {
  465. struct ufs_vreg *vcc;
  466. struct ufs_vreg *vccq;
  467. struct ufs_vreg *vccq2;
  468. struct ufs_vreg *vdd_hba;
  469. };
  470. struct ufs_dev_info {
  471. bool f_power_on_wp_en;
  472. /* Keeps information if any of the LU is power on write protected */
  473. bool is_lu_power_on_wp;
  474. };
  475. #endif /* End of Header */