hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/scsi/ufs/unipro.h
....@@ -1,12 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * drivers/scsi/ufs/unipro.h
34 *
45 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117
128 #ifndef _UNIPRO_H_
....@@ -68,8 +64,25 @@
6864 #define CFGRXOVR4 0x00E9
6965 #define RXSQCTRL 0x00B5
7066 #define CFGRXOVR6 0x00BF
67
+#define RX_HS_G1_SYNC_LENGTH_CAP 0x008B
68
+#define RX_HS_G1_PREP_LENGTH_CAP 0x008C
69
+#define RX_HS_G2_SYNC_LENGTH_CAP 0x0094
70
+#define RX_HS_G3_SYNC_LENGTH_CAP 0x0095
71
+#define RX_HS_G2_PREP_LENGTH_CAP 0x0096
72
+#define RX_HS_G3_PREP_LENGTH_CAP 0x0097
73
+#define RX_ADV_GRANULARITY_CAP 0x0098
74
+#define RX_MIN_ACTIVATETIME_CAP 0x008F
75
+#define RX_HIBERN8TIME_CAP 0x0092
76
+#define RX_ADV_HIBERN8TIME_CAP 0x0099
77
+#define RX_ADV_MIN_ACTIVATETIME_CAP 0x009A
78
+
7179
7280 #define is_mphy_tx_attr(attr) (attr < RX_MODE)
81
+#define RX_ADV_FINE_GRAN_STEP(x) ((((x) & 0x3) << 1) | 0x1)
82
+#define SYNC_LEN_FINE(x) ((x) & 0x3F)
83
+#define SYNC_LEN_COARSE(x) ((1 << 6) | ((x) & 0x3F))
84
+#define PREP_LEN(x) ((x) & 0xF)
85
+
7386 #define RX_MIN_ACTIVATETIME_UNIT_US 100
7487 #define HIBERN8TIME_UNIT_US 100
7588
....@@ -128,6 +141,7 @@
128141 #define PA_PACPREQEOBTIMEOUT 0x1591
129142 #define PA_HIBERN8TIME 0x15A7
130143 #define PA_LOCALVERINFO 0x15A9
144
+#define PA_GRANULARITY 0x15AA
131145 #define PA_TACTIVATE 0x15A8
132146 #define PA_PACPFRAMECOUNT 0x15C0
133147 #define PA_PACPERRORCOUNT 0x15C1
....@@ -150,6 +164,12 @@
150164 #define PA_SLEEPNOCONFIGTIME 0x15A2
151165 #define PA_STALLNOCONFIGTIME 0x15A3
152166 #define PA_SAVECONFIGTIME 0x15A4
167
+#define PA_TXHSADAPTTYPE 0x15D4
168
+
169
+/* Adpat type for PA_TXHSADAPTTYPE attribute */
170
+#define PA_REFRESH_ADAPT 0x00
171
+#define PA_INITIAL_ADAPT 0x01
172
+#define PA_NO_ADAPT 0x03
153173
154174 #define PA_TACTIVATE_TIME_UNIT_US 10
155175 #define PA_HIBERN8_TIME_UNIT_US 100
....@@ -165,6 +185,17 @@
165185 /* PHY Adapter Protocol Constants */
166186 #define PA_MAXDATALANES 4
167187
188
+#define DL_FC0ProtectionTimeOutVal_Default 8191
189
+#define DL_TC0ReplayTimeOutVal_Default 65535
190
+#define DL_AFC0ReqTimeOutVal_Default 32767
191
+#define DL_FC1ProtectionTimeOutVal_Default 8191
192
+#define DL_TC1ReplayTimeOutVal_Default 65535
193
+#define DL_AFC1ReqTimeOutVal_Default 32767
194
+
195
+#define DME_LocalFC0ProtectionTimeOutVal 0xD041
196
+#define DME_LocalTC0ReplayTimeOutVal 0xD042
197
+#define DME_LocalAFC0ReqTimeOutVal 0xD043
198
+
168199 /* PA power modes */
169200 enum {
170201 FAST_MODE = 1,
....@@ -173,6 +204,9 @@
173204 SLOWAUTO_MODE = 5,
174205 UNCHANGED = 7,
175206 };
207
+
208
+#define PWRMODE_MASK 0xF
209
+#define PWRMODE_RX_OFFSET 4
176210
177211 /* PA TX/RX Frequency Series */
178212 enum {
....@@ -196,14 +230,17 @@
196230 UFS_HS_G1, /* HS Gear 1 (default for reset) */
197231 UFS_HS_G2, /* HS Gear 2 */
198232 UFS_HS_G3, /* HS Gear 3 */
233
+ UFS_HS_G4, /* HS Gear 4 */
199234 };
200235
201236 enum ufs_unipro_ver {
202237 UFS_UNIPRO_VER_RESERVED = 0,
203238 UFS_UNIPRO_VER_1_40 = 1, /* UniPro version 1.40 */
204239 UFS_UNIPRO_VER_1_41 = 2, /* UniPro version 1.41 */
205
- UFS_UNIPRO_VER_1_6 = 3, /* UniPro version 1.6 */
206
- UFS_UNIPRO_VER_MAX = 4, /* UniPro unsupported version */
240
+ UFS_UNIPRO_VER_1_6 = 3, /* UniPro version 1.6 */
241
+ UFS_UNIPRO_VER_1_61 = 4, /* UniPro version 1.61 */
242
+ UFS_UNIPRO_VER_1_8 = 5, /* UniPro version 1.8 */
243
+ UFS_UNIPRO_VER_MAX = 6, /* UniPro unsupported version */
207244 /* UniPro version field mask in PA_LOCALVERINFO */
208245 UFS_UNIPRO_VER_MASK = 0xF,
209246 };
....@@ -277,4 +314,19 @@
277314 TRUE,
278315 };
279316
317
+/* CPort setting */
318
+#define E2EFC_ON (1 << 0)
319
+#define E2EFC_OFF (0 << 0)
320
+#define CSD_N_ON (0 << 1)
321
+#define CSD_N_OFF (1 << 1)
322
+#define CSV_N_ON (0 << 2)
323
+#define CSV_N_OFF (1 << 2)
324
+#define CPORT_DEF_FLAGS (CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)
325
+
326
+/* CPort connection state */
327
+enum {
328
+ CPORT_IDLE = 0,
329
+ CPORT_CONNECTED,
330
+};
331
+
280332 #endif /* _UNIPRO_H_ */