blob: 42c459a9d3fec7bf83aa047e6f3f97054d25bcee [file] [log] [blame]
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +05301/*
2 * Universal Flash Storage Host controller driver
3 *
4 * This code is based on drivers/scsi/ufs/ufs.h
Vinayak Holikatti3b1d0582013-02-25 21:44:32 +05305 * Copyright (C) 2011-2013 Samsung India Software Operations
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +05306 *
Vinayak Holikatti3b1d0582013-02-25 21:44:32 +05307 * Authors:
8 * Santosh Yaraganavi <santosh.sy@samsung.com>
9 * Vinayak Holikatti <h.vinayak@samsung.com>
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053010 *
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.
Vinayak Holikatti3b1d0582013-02-25 21:44:32 +053015 * See the COPYING file in the top-level directory or visit
16 * <http://www.gnu.org/licenses/gpl-2.0.html>
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053017 *
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 *
Vinayak Holikatti3b1d0582013-02-25 21:44:32 +053023 * 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.
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053034 */
35
36#ifndef _UFS_H
37#define _UFS_H
38
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +053039#include <linux/mutex.h>
40#include <linux/types.h>
41
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053042#define MAX_CDB_SIZE 16
Dolev Raviv68078d52013-07-30 00:35:58 +053043#define GENERAL_UPIU_REQUEST_SIZE 32
Dolev Ravivd44a5f92014-06-29 09:40:17 +030044#define QUERY_DESC_MAX_SIZE 255
45#define QUERY_DESC_MIN_SIZE 2
Dolev Raviv68078d52013-07-30 00:35:58 +053046#define QUERY_OSF_SIZE (GENERAL_UPIU_REQUEST_SIZE - \
47 (sizeof(struct utp_upiu_header)))
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053048
49#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +053050 cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053051 (byte1 << 8) | (byte0))
Subhash Jadavani0ce147d2014-09-25 15:32:29 +030052/*
53 * UFS device may have standard LUs and LUN id could be from 0x00 to
54 * 0x7F. Standard LUs use "Peripheral Device Addressing Format".
55 * UFS device may also have the Well Known LUs (also referred as W-LU)
56 * which again could be from 0x00 to 0x7F. For W-LUs, device only use
57 * the "Extended Addressing Format" which means the W-LUNs would be
58 * from 0xc100 (SCSI_W_LUN_BASE) onwards.
59 * This means max. LUN number reported from UFS device could be 0xC17F.
60 */
61#define UFS_UPIU_MAX_UNIT_NUM_ID 0x7F
62#define UFS_MAX_LUNS (SCSI_W_LUN_BASE + UFS_UPIU_MAX_UNIT_NUM_ID)
63#define UFS_UPIU_WLUN_ID (1 << 7)
Subhash Jadavanida461ce2014-09-25 15:32:25 +030064#define UFS_UPIU_MAX_GENERAL_LUN 8
65
Subhash Jadavani0ce147d2014-09-25 15:32:29 +030066/* Well known logical unit id in LUN field of UPIU */
67enum {
68 UFS_UPIU_REPORT_LUNS_WLUN = 0x81,
69 UFS_UPIU_UFS_DEVICE_WLUN = 0xD0,
70 UFS_UPIU_BOOT_WLUN = 0xB0,
71 UFS_UPIU_RPMB_WLUN = 0xC4,
72};
73
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053074/*
75 * UFS Protocol Information Unit related definitions
76 */
77
78/* Task management functions */
79enum {
80 UFS_ABORT_TASK = 0x01,
81 UFS_ABORT_TASK_SET = 0x02,
82 UFS_CLEAR_TASK_SET = 0x04,
83 UFS_LOGICAL_RESET = 0x08,
84 UFS_QUERY_TASK = 0x80,
85 UFS_QUERY_TASK_SET = 0x81,
86};
87
88/* UTP UPIU Transaction Codes Initiator to Target */
89enum {
90 UPIU_TRANSACTION_NOP_OUT = 0x00,
91 UPIU_TRANSACTION_COMMAND = 0x01,
92 UPIU_TRANSACTION_DATA_OUT = 0x02,
93 UPIU_TRANSACTION_TASK_REQ = 0x04,
Dolev Raviv68078d52013-07-30 00:35:58 +053094 UPIU_TRANSACTION_QUERY_REQ = 0x16,
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +053095};
96
97/* UTP UPIU Transaction Codes Target to Initiator */
98enum {
99 UPIU_TRANSACTION_NOP_IN = 0x20,
100 UPIU_TRANSACTION_RESPONSE = 0x21,
101 UPIU_TRANSACTION_DATA_IN = 0x22,
102 UPIU_TRANSACTION_TASK_RSP = 0x24,
103 UPIU_TRANSACTION_READY_XFER = 0x31,
104 UPIU_TRANSACTION_QUERY_RSP = 0x36,
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530105 UPIU_TRANSACTION_REJECT_UPIU = 0x3F,
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530106};
107
108/* UPIU Read/Write flags */
109enum {
110 UPIU_CMD_FLAGS_NONE = 0x00,
111 UPIU_CMD_FLAGS_WRITE = 0x20,
112 UPIU_CMD_FLAGS_READ = 0x40,
113};
114
115/* UPIU Task Attributes */
116enum {
117 UPIU_TASK_ATTR_SIMPLE = 0x00,
118 UPIU_TASK_ATTR_ORDERED = 0x01,
119 UPIU_TASK_ATTR_HEADQ = 0x02,
120 UPIU_TASK_ATTR_ACA = 0x03,
121};
122
Dolev Raviv68078d52013-07-30 00:35:58 +0530123/* UPIU Query request function */
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530124enum {
Dolev Raviv68078d52013-07-30 00:35:58 +0530125 UPIU_QUERY_FUNC_STANDARD_READ_REQUEST = 0x01,
126 UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST = 0x81,
127};
128
129/* Flag idn for Query Requests*/
130enum flag_idn {
131 QUERY_FLAG_IDN_FDEVICEINIT = 0x01,
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300132 QUERY_FLAG_IDN_PWR_ON_WPE = 0x03,
Sujit Reddy Thumma66ec6d52013-07-30 00:35:59 +0530133 QUERY_FLAG_IDN_BKOPS_EN = 0x04,
134};
135
136/* Attribute idn for Query requests */
137enum attr_idn {
Yaniv Gardi3a4bf062014-09-25 15:32:27 +0300138 QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03,
Sujit Reddy Thumma66ec6d52013-07-30 00:35:59 +0530139 QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
140 QUERY_ATTR_IDN_EE_CONTROL = 0x0D,
141 QUERY_ATTR_IDN_EE_STATUS = 0x0E,
142};
143
Dolev Ravivd44a5f92014-06-29 09:40:17 +0300144/* Descriptor idn for Query requests */
145enum desc_idn {
146 QUERY_DESC_IDN_DEVICE = 0x0,
147 QUERY_DESC_IDN_CONFIGURAION = 0x1,
148 QUERY_DESC_IDN_UNIT = 0x2,
149 QUERY_DESC_IDN_RFU_0 = 0x3,
150 QUERY_DESC_IDN_INTERCONNECT = 0x4,
151 QUERY_DESC_IDN_STRING = 0x5,
152 QUERY_DESC_IDN_RFU_1 = 0x6,
153 QUERY_DESC_IDN_GEOMETRY = 0x7,
154 QUERY_DESC_IDN_POWER = 0x8,
Subhash Jadavanida461ce2014-09-25 15:32:25 +0300155 QUERY_DESC_IDN_MAX,
Dolev Ravivd44a5f92014-06-29 09:40:17 +0300156};
157
Subhash Jadavanida461ce2014-09-25 15:32:25 +0300158enum desc_header_offset {
159 QUERY_DESC_LENGTH_OFFSET = 0x00,
160 QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
161};
162
163enum ufs_desc_max_size {
164 QUERY_DESC_DEVICE_MAX_SIZE = 0x1F,
165 QUERY_DESC_CONFIGURAION_MAX_SIZE = 0x90,
166 QUERY_DESC_UNIT_MAX_SIZE = 0x23,
167 QUERY_DESC_INTERCONNECT_MAX_SIZE = 0x06,
168 /*
169 * Max. 126 UNICODE characters (2 bytes per character) plus 2 bytes
170 * of descriptor header.
171 */
172 QUERY_DESC_STRING_MAX_SIZE = 0xFE,
173 QUERY_DESC_GEOMETRY_MAZ_SIZE = 0x44,
174 QUERY_DESC_POWER_MAX_SIZE = 0x62,
175 QUERY_DESC_RFU_MAX_SIZE = 0x00,
176};
177
Dolev Raviv1b3e8952014-06-29 09:40:19 +0300178/* Unit descriptor parameters offsets in bytes*/
179enum unit_desc_param {
180 UNIT_DESC_PARAM_LEN = 0x0,
181 UNIT_DESC_PARAM_TYPE = 0x1,
182 UNIT_DESC_PARAM_UNIT_INDEX = 0x2,
183 UNIT_DESC_PARAM_LU_ENABLE = 0x3,
184 UNIT_DESC_PARAM_BOOT_LUN_ID = 0x4,
185 UNIT_DESC_PARAM_LU_WR_PROTECT = 0x5,
186 UNIT_DESC_PARAM_LU_Q_DEPTH = 0x6,
187 UNIT_DESC_PARAM_MEM_TYPE = 0x8,
188 UNIT_DESC_PARAM_DATA_RELIABILITY = 0x9,
189 UNIT_DESC_PARAM_LOGICAL_BLK_SIZE = 0xA,
190 UNIT_DESC_PARAM_LOGICAL_BLK_COUNT = 0xB,
191 UNIT_DESC_PARAM_ERASE_BLK_SIZE = 0x13,
192 UNIT_DESC_PARAM_PROVISIONING_TYPE = 0x17,
193 UNIT_DESC_PARAM_PHY_MEM_RSRC_CNT = 0x18,
194 UNIT_DESC_PARAM_CTX_CAPABILITIES = 0x20,
195 UNIT_DESC_PARAM_LARGE_UNIT_SIZE_M1 = 0x22,
196};
197
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300198/*
199 * Logical Unit Write Protect
200 * 00h: LU not write protected
201 * 01h: LU write protected when fPowerOnWPEn =1
202 * 02h: LU permanently write protected when fPermanentWPEn =1
203 */
204enum ufs_lu_wp_type {
205 UFS_LU_NO_WP = 0x00,
206 UFS_LU_POWER_ON_WP = 0x01,
207 UFS_LU_PERM_WP = 0x02,
208};
209
Yaniv Gardi3a4bf062014-09-25 15:32:27 +0300210/* bActiveICCLevel parameter current units */
211enum {
212 UFSHCD_NANO_AMP = 0,
213 UFSHCD_MICRO_AMP = 1,
214 UFSHCD_MILI_AMP = 2,
215 UFSHCD_AMP = 3,
216};
217
218#define POWER_DESC_MAX_SIZE 0x62
219#define POWER_DESC_MAX_ACTV_ICC_LVLS 16
220
221/* Attribute bActiveICCLevel parameter bit masks definitions */
222#define ATTR_ICC_LVL_UNIT_OFFSET 14
223#define ATTR_ICC_LVL_UNIT_MASK (0x3 << ATTR_ICC_LVL_UNIT_OFFSET)
224#define ATTR_ICC_LVL_VALUE_MASK 0x3FF
225
226/* Power descriptor parameters offsets in bytes */
227enum power_desc_param_offset {
228 PWR_DESC_LEN = 0x0,
229 PWR_DESC_TYPE = 0x1,
230 PWR_DESC_ACTIVE_LVLS_VCC_0 = 0x2,
231 PWR_DESC_ACTIVE_LVLS_VCCQ_0 = 0x22,
232 PWR_DESC_ACTIVE_LVLS_VCCQ2_0 = 0x42,
233};
234
Sujit Reddy Thumma66ec6d52013-07-30 00:35:59 +0530235/* Exception event mask values */
236enum {
237 MASK_EE_STATUS = 0xFFFF,
238 MASK_EE_URGENT_BKOPS = (1 << 2),
239};
240
241/* Background operation status */
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300242enum bkops_status {
Sujit Reddy Thumma66ec6d52013-07-30 00:35:59 +0530243 BKOPS_STATUS_NO_OP = 0x0,
244 BKOPS_STATUS_NON_CRITICAL = 0x1,
245 BKOPS_STATUS_PERF_IMPACT = 0x2,
246 BKOPS_STATUS_CRITICAL = 0x3,
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300247 BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL,
Dolev Raviv68078d52013-07-30 00:35:58 +0530248};
249
250/* UTP QUERY Transaction Specific Fields OpCode */
251enum query_opcode {
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530252 UPIU_QUERY_OPCODE_NOP = 0x0,
253 UPIU_QUERY_OPCODE_READ_DESC = 0x1,
254 UPIU_QUERY_OPCODE_WRITE_DESC = 0x2,
255 UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
256 UPIU_QUERY_OPCODE_WRITE_ATTR = 0x4,
257 UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
258 UPIU_QUERY_OPCODE_SET_FLAG = 0x6,
259 UPIU_QUERY_OPCODE_CLEAR_FLAG = 0x7,
260 UPIU_QUERY_OPCODE_TOGGLE_FLAG = 0x8,
261};
262
Dolev Raviv68078d52013-07-30 00:35:58 +0530263/* Query response result code */
264enum {
265 QUERY_RESULT_SUCCESS = 0x00,
266 QUERY_RESULT_NOT_READABLE = 0xF6,
267 QUERY_RESULT_NOT_WRITEABLE = 0xF7,
268 QUERY_RESULT_ALREADY_WRITTEN = 0xF8,
269 QUERY_RESULT_INVALID_LENGTH = 0xF9,
270 QUERY_RESULT_INVALID_VALUE = 0xFA,
271 QUERY_RESULT_INVALID_SELECTOR = 0xFB,
272 QUERY_RESULT_INVALID_INDEX = 0xFC,
273 QUERY_RESULT_INVALID_IDN = 0xFD,
274 QUERY_RESULT_INVALID_OPCODE = 0xFE,
275 QUERY_RESULT_GENERAL_FAILURE = 0xFF,
276};
277
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530278/* UTP Transfer Request Command Type (CT) */
279enum {
280 UPIU_COMMAND_SET_TYPE_SCSI = 0x0,
281 UPIU_COMMAND_SET_TYPE_UFS = 0x1,
282 UPIU_COMMAND_SET_TYPE_QUERY = 0x2,
283};
284
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530285/* UTP Transfer Request Command Offset */
286#define UPIU_COMMAND_TYPE_OFFSET 28
287
288/* Offset of the response code in the UPIU header */
289#define UPIU_RSP_CODE_OFFSET 8
290
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530291enum {
Dolev Raviv68078d52013-07-30 00:35:58 +0530292 MASK_SCSI_STATUS = 0xFF,
293 MASK_TASK_RESPONSE = 0xFF00,
294 MASK_RSP_UPIU_RESULT = 0xFFFF,
295 MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
Seungwon Jeon1c2623c2013-08-31 21:40:19 +0530296 MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
Sujit Reddy Thumma66ec6d52013-07-30 00:35:59 +0530297 MASK_RSP_EXCEPTION_EVENT = 0x10000,
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530298};
299
300/* Task management service response */
301enum {
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};
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300308
309/* UFS device power modes */
310enum ufs_dev_pwr_mode {
311 UFS_ACTIVE_PWR_MODE = 1,
312 UFS_SLEEP_PWR_MODE = 2,
313 UFS_POWERDOWN_PWR_MODE = 3,
314};
315
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530316/**
317 * struct utp_upiu_header - UPIU header structure
318 * @dword_0: UPIU header DW-0
319 * @dword_1: UPIU header DW-1
320 * @dword_2: UPIU header DW-2
321 */
322struct utp_upiu_header {
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530323 __be32 dword_0;
324 __be32 dword_1;
325 __be32 dword_2;
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530326};
327
328/**
329 * struct utp_upiu_cmd - Command UPIU structure
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530330 * @data_transfer_len: Data Transfer Length DW-3
331 * @cdb: Command Descriptor Block CDB DW-4 to DW-7
332 */
333struct utp_upiu_cmd {
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530334 __be32 exp_data_transfer_len;
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530335 u8 cdb[MAX_CDB_SIZE];
336};
337
338/**
Dolev Raviv68078d52013-07-30 00:35:58 +0530339 * struct utp_upiu_query - upiu request buffer structure for
340 * query request.
341 * @opcode: command to perform B-0
342 * @idn: a value that indicates the particular type of data B-1
343 * @index: Index to further identify data B-2
344 * @selector: Index to further identify data B-3
345 * @reserved_osf: spec reserved field B-4,5
346 * @length: number of descriptor bytes to read/write B-6,7
347 * @value: Attribute value to be written DW-5
348 * @reserved: spec reserved DW-6,7
349 */
350struct utp_upiu_query {
351 u8 opcode;
352 u8 idn;
353 u8 index;
354 u8 selector;
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530355 __be16 reserved_osf;
356 __be16 length;
357 __be32 value;
358 __be32 reserved[2];
Dolev Raviv68078d52013-07-30 00:35:58 +0530359};
360
361/**
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530362 * struct utp_upiu_req - general upiu request structure
363 * @header:UPIU header structure DW-0 to DW-2
364 * @sc: fields structure for scsi command DW-3 to DW-7
Dolev Raviv68078d52013-07-30 00:35:58 +0530365 * @qr: fields structure for query request DW-3 to DW-7
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530366 */
367struct utp_upiu_req {
368 struct utp_upiu_header header;
Dolev Raviv68078d52013-07-30 00:35:58 +0530369 union {
370 struct utp_upiu_cmd sc;
371 struct utp_upiu_query qr;
372 };
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530373};
374
375/**
376 * struct utp_cmd_rsp - Response UPIU structure
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530377 * @residual_transfer_count: Residual transfer count DW-3
378 * @reserved: Reserved double words DW-4 to DW-7
379 * @sense_data_len: Sense data length DW-8 U16
380 * @sense_data: Sense data field DW-8 to DW-12
381 */
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530382struct utp_cmd_rsp {
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530383 __be32 residual_transfer_count;
384 __be32 reserved[4];
385 __be16 sense_data_len;
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530386 u8 sense_data[18];
387};
388
389/**
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530390 * struct utp_upiu_rsp - general upiu response structure
391 * @header: UPIU header structure DW-0 to DW-2
392 * @sr: fields structure for scsi command DW-3 to DW-12
Dolev Raviv68078d52013-07-30 00:35:58 +0530393 * @qr: fields structure for query request DW-3 to DW-7
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530394 */
395struct utp_upiu_rsp {
396 struct utp_upiu_header header;
Dolev Raviv68078d52013-07-30 00:35:58 +0530397 union {
398 struct utp_cmd_rsp sr;
399 struct utp_upiu_query qr;
400 };
Sujit Reddy Thumma5a0b0cb2013-07-30 00:35:57 +0530401};
402
403/**
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530404 * struct utp_upiu_task_req - Task request UPIU structure
405 * @header - UPIU header structure DW0 to DW-2
406 * @input_param1: Input parameter 1 DW-3
407 * @input_param2: Input parameter 2 DW-4
408 * @input_param3: Input parameter 3 DW-5
409 * @reserved: Reserved double words DW-6 to DW-7
410 */
411struct utp_upiu_task_req {
412 struct utp_upiu_header header;
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530413 __be32 input_param1;
414 __be32 input_param2;
415 __be32 input_param3;
416 __be32 reserved[2];
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530417};
418
419/**
420 * struct utp_upiu_task_rsp - Task Management Response UPIU structure
421 * @header: UPIU header structure DW0-DW-2
422 * @output_param1: Ouput parameter 1 DW3
423 * @output_param2: Output parameter 2 DW4
424 * @reserved: Reserved double words DW-5 to DW-7
425 */
426struct utp_upiu_task_rsp {
427 struct utp_upiu_header header;
Sujit Reddy Thummae8c8e822014-05-26 10:59:10 +0530428 __be32 output_param1;
429 __be32 output_param2;
430 __be32 reserved[3];
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530431};
432
Dolev Raviv68078d52013-07-30 00:35:58 +0530433/**
434 * struct ufs_query_req - parameters for building a query request
435 * @query_func: UPIU header query function
436 * @upiu_req: the query request data
437 */
438struct ufs_query_req {
439 u8 query_func;
440 struct utp_upiu_query upiu_req;
441};
442
443/**
444 * struct ufs_query_resp - UPIU QUERY
445 * @response: device response code
446 * @upiu_res: query response data
447 */
448struct ufs_query_res {
449 u8 response;
450 struct utp_upiu_query upiu_res;
451};
452
Sujit Reddy Thummaaa497612014-09-25 15:32:22 +0300453#define UFS_VREG_VCC_MIN_UV 2700000 /* uV */
454#define UFS_VREG_VCC_MAX_UV 3600000 /* uV */
455#define UFS_VREG_VCC_1P8_MIN_UV 1700000 /* uV */
456#define UFS_VREG_VCC_1P8_MAX_UV 1950000 /* uV */
457#define UFS_VREG_VCCQ_MIN_UV 1100000 /* uV */
458#define UFS_VREG_VCCQ_MAX_UV 1300000 /* uV */
459#define UFS_VREG_VCCQ2_MIN_UV 1650000 /* uV */
460#define UFS_VREG_VCCQ2_MAX_UV 1950000 /* uV */
461
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300462/*
463 * VCCQ & VCCQ2 current requirement when UFS device is in sleep state
464 * and link is in Hibern8 state.
465 */
466#define UFS_VREG_LPM_LOAD_UA 1000 /* uA */
467
Sujit Reddy Thummaaa497612014-09-25 15:32:22 +0300468struct ufs_vreg {
469 struct regulator *reg;
470 const char *name;
471 bool enabled;
472 int min_uV;
473 int max_uV;
474 int min_uA;
475 int max_uA;
476};
477
478struct ufs_vreg_info {
479 struct ufs_vreg *vcc;
480 struct ufs_vreg *vccq;
481 struct ufs_vreg *vccq2;
Raviv Shvili6a771a62014-09-25 15:32:24 +0300482 struct ufs_vreg *vdd_hba;
Sujit Reddy Thummaaa497612014-09-25 15:32:22 +0300483};
484
Subhash Jadavani57d104c2014-09-25 15:32:30 +0300485struct ufs_dev_info {
486 bool f_power_on_wp_en;
487 /* Keeps information if any of the LU is power on write protected */
488 bool is_lu_power_on_wp;
489};
490
Santosh Yaraganavi7a3e97b2012-02-29 12:11:50 +0530491#endif /* End of Header */