Skip to contentSkip to conversation

ufs: add a variety of definitions decribed in UFS spec

PATCH Superseded Kiwoong Kim 2 participants 5 messages Nov 8, 2016 – Nov 10, 2016 SCSI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: add a variety of definitions decribed in UFS spec

These things are defined to be used by some UFS Host controllers.

---
 drivers/scsi/ufs/mphy.h   | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshci.h | 14 +++++++++++---
 drivers/scsi/ufs/unipro.h | 24 ++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 drivers/scsi/ufs/mphy.h
drivers/scsi/ufs/mphy.h new file +38 -0
new file mode 100644
index 0000000..c431f49
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _MPHY_H_
+#define _MPHY_H_
+
+#define TX_HIBERN8TIME_CAP		0x0f
+#define TX_MIN_ACTIVATE_TIME		0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP	0x8b
+#define RX_HS_G1_PREP_LEN_CAP	0x8c
+#define RX_HS_G2_SYNC_LEN_CAP	0x94
+#define RX_HS_G3_SYNC_LEN_CAP	0x95
+#define RX_HS_G2_PREP_LEN_CAP	0x96
+#define RX_HS_G3_PREP_LEN_CAP	0x97
+ #define SYNC_RANGE_FINE	(0 << 6)
+ #define SYNC_RANGE_COARSE	(1 << 6)
+ #define SYNC_LEN(x)		((x) & 0x3f)
+ #define PREP_LEN(x)		((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP		0x98
+ #define RX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP		0x10
+ #define TX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP		0x8f
+#define RX_HIBERN8TIME_CAP		0x92
+#define RX_ADV_HIBERN8TIME_CAP		0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP	0x9a
+
+#endif /* _MPHY_H_ */
+
drivers/scsi/ufs/ufshci.h +11 -3
index 9599741..26dc340 100644
@@ -170,17 +170,25 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED		UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF		UFS_BIT(5)
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT		UFS_BIT(13)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK	0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_NETWORK_BAD_DEVICEID_ENC		BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING	BIT(2)
 
 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR		UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK	0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID		BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX		BIT(2)
+#define UIC_TRANSPORT_BAD_TC			BIT(4)
 
 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR			UFS_BIT(31)
drivers/scsi/ufs/unipro.h +24 -0
index eff8b56..e47e2c2 100644
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTIMEOUT	0x1591
 #define PA_HIBERN8TIME		0x15A7
 #define PA_LOCALVERINFO		0x15A9
+#define PA_GRANULARITY		0x15AA
 #define PA_TACTIVATE		0x15A8
 #define PA_PACPFRAMECOUNT	0x15C0
 #define PA_PACPERRORCOUNT	0x15C1
@@ -170,6 +171,9 @@ enum {
 	UNCHANGED	= 7,
 };
 
+#define IS_PWR_MODE_HS(m)        (((m) == FAST_MODE) || ((m) == FASTAUTO_MODE))
+#define IS_PWR_MODE_PWM(m)       (((m) == SLOW_MODE) || ((m) == SLOWAUTO_MODE))
+
 /* PA TX/RX Frequency Series */
 enum {
 	PA_HS_MODE_A	= 1,
@@ -231,6 +235,11 @@ enum ufs_unipro_ver {
 #define DL_PEERTC1PRESENT	0x2066
 #define DL_PEERTC1RXINITCREVAL	0x2067
 
+/* Default value of L2 Timer */
+#define FC0PROTTIMEOUTVAL	8191
+#define TC0REPLAYTIMEOUTVAL	65535
+#define AFC0REQTIMEOUTVAL	32767
+
 /*
  * Network Layer Attributes
  */
@@ -259,6 +268,21 @@ enum ufs_unipro_ver {
 #define T_TC0TXMAXSDUSIZE	0x4060
 #define T_TC1TXMAXSDUSIZE	0x4061
 
+/* CPort setting */
+#define E2EFC_ON	(1 << 0)
+#define E2EFC_OFF	(0 << 0)
+#define CSD_N_ON	(0 << 1)
+#define CSD_N_OFF	(1 << 1)
+#define CSV_N_ON	(0 << 2)
+#define CSV_N_OFF	(1 << 2)
+#define CPORT_DEF_FLAGS	(CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)
+
+/* CPort connection state */
+enum {
+	CPORT_IDLE = 0,
+	CPORT_CONNECTED,
+};
+
 #ifdef FALSE
 #undef FALSE
 #endif
Signature · 1 line
2.1.4
#1 lore raw
Quoted 28 lines · Kiwoong Kim

These things are defined to be used by some UFS Host controllers.

---
 drivers/scsi/ufs/mphy.h   | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshci.h | 14 +++++++++++---
 drivers/scsi/ufs/unipro.h | 24 ++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 drivers/scsi/ufs/mphy.h
drivers/scsi/ufs/mphy.h new file +6 -0
new file mode 100644
index 0000000..c431f49
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or 

modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */

drivers/scsi/ufs/mphy.h line 13

Quoted 3 lines
drivers/scsi/ufs/mphy.h new file +3 -0
+
+#ifndef _MPHY_H_
+#define _MPHY_H_

Do we really need separate file for MPHY? May be we can have these accomodated in unipro.h itself?

Quoted 30 lines
drivers/scsi/ufs/mphy.h new file +25 -0
+
+#define TX_HIBERN8TIME_CAP		0x0f
+#define TX_MIN_ACTIVATE_TIME		0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP	0x8b
+#define RX_HS_G1_PREP_LEN_CAP	0x8c
+#define RX_HS_G2_SYNC_LEN_CAP	0x94
+#define RX_HS_G3_SYNC_LEN_CAP	0x95
+#define RX_HS_G2_PREP_LEN_CAP	0x96
+#define RX_HS_G3_PREP_LEN_CAP	0x97
+ #define SYNC_RANGE_FINE	(0 << 6)
+ #define SYNC_RANGE_COARSE	(1 << 6)
+ #define SYNC_LEN(x)		((x) & 0x3f)
+ #define PREP_LEN(x)		((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP		0x98
+ #define RX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP		0x10
+ #define TX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP		0x8f
+#define RX_HIBERN8TIME_CAP		0x92
+#define RX_ADV_HIBERN8TIME_CAP		0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP	0x9a
+
+#endif /* _MPHY_H_ */
+
drivers/scsi/ufs/ufshci.h +0 -0
index 9599741..26dc340 100644

drivers/scsi/ufs/ufshci.h enum { · line 175

Quoted 9 lines
drivers/scsi/ufs/ufshci.h +3 -3
@@ -170,17 +170,25 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED		UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF		UFS_BIT(5)

why don't we just add macros for all the bits in UECDL ? This makes it easy in future.

Quoted 6 lines
drivers/scsi/ufs/ufshci.h +2 -0
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT		UFS_BIT(13)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK	0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE	BIT(0)

drivers/scsi/ufs/ufshci.h enum { · line 191

Quoted 10 lines
drivers/scsi/ufs/ufshci.h +6 -0
+#define UIC_NETWORK_BAD_DEVICEID_ENC		BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING	BIT(2)
 
 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR		UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK	0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID		BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX		BIT(2)
+#define UIC_TRANSPORT_BAD_TC			BIT(4)

May be add definition for bit-5 and 6 as well.

Quoted 16 lines
drivers/scsi/ufs/ufshci.h +0 -0
 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR			UFS_BIT(31)
drivers/scsi/ufs/unipro.h +1 -0
index eff8b56..e47e2c2 100644
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTIMEOUT	0x1591
 #define PA_HIBERN8TIME		0x15A7
 #define PA_LOCALVERINFO		0x15A9
+#define PA_GRANULARITY		0x15AA
 #define PA_TACTIVATE		0x15A8
 #define PA_PACPFRAMECOUNT	0x15C0
 #define PA_PACPERRORCOUNT	0x15C1

drivers/scsi/ufs/unipro.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/unipro.h +1 -0
@@ -170,6 +171,9 @@ enum {
 	UNCHANGED	= 7,
 };
 
+#define IS_PWR_MODE_HS(m)        (((m) == FAST_MODE) || ((m) == 
 FASTAUTO_MODE))

s/IS_PWR_MODE_HS/IS_HS_PWR_MODE ?

drivers/scsi/ufs/unipro.h enum { · line 177

Quoted 2 lines
drivers/scsi/ufs/unipro.h +1 -0
+#define IS_PWR_MODE_PWM(m)       (((m) == SLOW_MODE) || ((m) == 
 SLOWAUTO_MODE))

s/IS_PWR_MODE_PWM/IS_PWM_PWR_MODE ?

Quoted 17 lines
drivers/scsi/ufs/unipro.h +1 -0
+
 /* PA TX/RX Frequency Series */

enum {

drivers/scsi/ufs/unipro.h +5 -0
 	PA_HS_MODE_A	= 1,
@@ -231,6 +235,11 @@ enum ufs_unipro_ver {
 #define DL_PEERTC1PRESENT	0x2066
 #define DL_PEERTC1RXINITCREVAL	0x2067
 
+/* Default value of L2 Timer */
+#define FC0PROTTIMEOUTVAL	8191
+#define TC0REPLAYTIMEOUTVAL	65535
+#define AFC0REQTIMEOUTVAL	32767
+
 /*
  * Network Layer Attributes
  */

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 277

Quoted 10 lines
drivers/scsi/ufs/unipro.h +7 -0
@@ -259,6 +268,21 @@ enum ufs_unipro_ver {
 #define T_TC0TXMAXSDUSIZE	0x4060
 #define T_TC1TXMAXSDUSIZE	0x4061
 
+/* CPort setting */
+#define E2EFC_ON	(1 << 0)
+#define E2EFC_OFF	(0 << 0)
+#define CSD_N_ON	(0 << 1)
+#define CSD_N_OFF	(1 << 1)
+#define CSV_N_ON	(0 << 2)
+#define CSV_N_OFF	(1 << 2)

Can you please specify where these are coming from? Spec number and section/line number?

Quoted 11 lines
drivers/scsi/ufs/unipro.h +8 -0
+#define CPORT_DEF_FLAGS	(CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)
+
+/* CPort connection state */
+enum {
+	CPORT_IDLE = 0,
+	CPORT_CONNECTED,
+};
+
 #ifdef FALSE
 #undef FALSE
 #endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Projec
#2 lore raw
Quoted 25 lines
Quoted 25 lines

These things are defined to be used by some UFS Host controllers.

---
 drivers/scsi/ufs/mphy.h   | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshci.h | 14 +++++++++++---
drivers/scsi/ufs/unipro.h | 24 ++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 3 deletions(-)  create mode 100644

drivers/scsi/ufs/mphy.h

drivers/scsi/ufs/mphy.h new renamed from drivers/scsi/ufs/mphy.h +0 -0

file mode 100644 index 0000000..c431f49

drivers/scsi/ufs/mphy.h new file +6 -0
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or

modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or

Quoted 8 lines

drivers/scsi/ufs/mphy.h line 13

Quoted 5 lines

+ * (at your option) any later version.
+ */

drivers/scsi/ufs/mphy.h new file +3 -0
+
+#ifndef _MPHY_H_
+#define _MPHY_H_

Do we really need separate file for MPHY? May be we can have these accomodated in unipro.h itself?

I think it's needed. MPHY spec isn't related with Unipro spec directly. Is there any reason why we say that this file is deprecated? Please let me know if you have.

Quoted 35 lines
Quoted 35 lines
drivers/scsi/ufs/mphy.h new file +25 -0
+
+#define TX_HIBERN8TIME_CAP		0x0f
+#define TX_MIN_ACTIVATE_TIME		0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP	0x8b
+#define RX_HS_G1_PREP_LEN_CAP	0x8c
+#define RX_HS_G2_SYNC_LEN_CAP	0x94
+#define RX_HS_G3_SYNC_LEN_CAP	0x95
+#define RX_HS_G2_PREP_LEN_CAP	0x96
+#define RX_HS_G3_PREP_LEN_CAP	0x97
+ #define SYNC_RANGE_FINE	(0 << 6)
+ #define SYNC_RANGE_COARSE	(1 << 6)
+ #define SYNC_LEN(x)		((x) & 0x3f)
+ #define PREP_LEN(x)		((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP		0x98
+ #define RX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP		0x10
+ #define TX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP		0x8f
+#define RX_HIBERN8TIME_CAP		0x92
+#define RX_ADV_HIBERN8TIME_CAP		0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP	0x9a
+
+#endif /* _MPHY_H_ */
+
drivers/scsi/ufs/ufshci.h +0 -1
index 9599741..26dc340 100644
@@ -170,17 +170,25 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
Quoted 8 lines

drivers/scsi/ufs/ufshci.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/ufshci.h +3 -2
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED		UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF		UFS_BIT(5)

why don't we just add macros for all the bits in UECDL ? This makes it easy in future.

Okay. I'll think about it and apply new macros on new version of this patch.

Quoted 10 lines
Quoted 10 lines
drivers/scsi/ufs/ufshci.h +4 -0
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT		UFS_BIT(13)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK	0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_NETWORK_BAD_DEVICEID_ENC		BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING	BIT(2)
 
Quoted 9 lines

drivers/scsi/ufs/ufshci.h enum { · line 191

Quoted 7 lines
drivers/scsi/ufs/ufshci.h +4 -0
 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR		UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK	0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID		BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX		BIT(2)
+#define UIC_TRANSPORT_BAD_TC			BIT(4)

May be add definition for bit-5 and 6 as well.

Okay. I'll add those things on new version of this patch.

Quoted 50 lines
Quoted 17 lines
drivers/scsi/ufs/ufshci.h +0 -0
 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR			UFS_BIT(31)
drivers/scsi/ufs/unipro.h +1 -0
index eff8b56..e47e2c2 100644
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTIMEOUT	0x1591
 #define PA_HIBERN8TIME		0x15A7
 #define PA_LOCALVERINFO		0x15A9
+#define PA_GRANULARITY		0x15AA
 #define PA_TACTIVATE		0x15A8
 #define PA_PACPFRAMECOUNT	0x15C0
 #define PA_PACPERRORCOUNT	0x15C1

drivers/scsi/ufs/unipro.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/unipro.h +1 -0
@@ -170,6 +171,9 @@ enum {
 	UNCHANGED	= 7,
 };
 
+#define IS_PWR_MODE_HS(m)        (((m) == FAST_MODE) || ((m) ==
 FASTAUTO_MODE))

s/IS_PWR_MODE_HS/IS_HS_PWR_MODE ?

drivers/scsi/ufs/unipro.h enum { · line 177

Quoted 2 lines
drivers/scsi/ufs/unipro.h +1 -0
+#define IS_PWR_MODE_PWM(m)       (((m) == SLOW_MODE) || ((m) ==
 SLOWAUTO_MODE))

s/IS_PWR_MODE_PWM/IS_PWM_PWR_MODE ?

Quoted 20 lines
drivers/scsi/ufs/unipro.h +1 -0
+
 /* PA TX/RX Frequency Series */

enum {

drivers/scsi/ufs/unipro.h +5 -0
 	PA_HS_MODE_A	= 1,
@@ -231,6 +235,11 @@ enum ufs_unipro_ver {
 #define DL_PEERTC1PRESENT	0x2066
 #define DL_PEERTC1RXINITCREVAL	0x2067
 
+/* Default value of L2 Timer */
+#define FC0PROTTIMEOUTVAL	8191
+#define TC0REPLAYTIMEOUTVAL	65535
+#define AFC0REQTIMEOUTVAL	32767
+
 /*
  * Network Layer Attributes
  */
@@ -259,6 +268,21 @@ enum ufs_unipro_ver {
 #define T_TC0TXMAXSDUSIZE	0x4060
 #define T_TC1TXMAXSDUSIZE	0x4061
 
Quoted 11 lines

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 277

Quoted 7 lines
drivers/scsi/ufs/unipro.h +7 -0
+/* CPort setting */
+#define E2EFC_ON	(1 << 0)
+#define E2EFC_OFF	(0 << 0)
+#define CSD_N_ON	(0 << 1)
+#define CSD_N_OFF	(1 << 1)
+#define CSV_N_ON	(0 << 2)
+#define CSV_N_OFF	(1 << 2)

Can you please specify where these are coming from? Spec number and section/line number?

These definitions are associated with Unipro attributes 0x4025, that is T_CPortFlags.
I referred version 1.6 - 6 August 2013.
You can find details in Chapter 8.17 and Table 92 in the spec

Quoted 20 lines

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 288

Quoted 12 lines
drivers/scsi/ufs/unipro.h +8 -0
+#define CPORT_DEF_FLAGS	(CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)
+
+/* CPort connection state */
+enum {
+	CPORT_IDLE = 0,
+	CPORT_CONNECTED,
+};
+
 #ifdef FALSE
 #undef FALSE
 #endif

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Projec
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 34 lines · Kiwoong Kim
Quoted 25 lines
Quoted 25 lines

These things are defined to be used by some UFS Host controllers.

---
 drivers/scsi/ufs/mphy.h   | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshci.h | 14 +++++++++++---
drivers/scsi/ufs/unipro.h | 24 ++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 3 deletions(-)  create mode 100644

drivers/scsi/ufs/mphy.h

drivers/scsi/ufs/mphy.h new renamed from drivers/scsi/ufs/mphy.h +0 -0

file mode 100644 index 0000000..c431f49

drivers/scsi/ufs/mphy.h new file +6 -0
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or

modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or

Quoted 8 lines

drivers/scsi/ufs/mphy.h line 13

Quoted 5 lines

+ * (at your option) any later version.
+ */

drivers/scsi/ufs/mphy.h new file +3 -0
+
+#ifndef _MPHY_H_
+#define _MPHY_H_

Do we really need separate file for MPHY? May be we can have these accomodated in unipro.h itself?

Quoted 1 line

I think it's needed. MPHY spec isn't related with Unipro spec directly.

Yes but for UFS host controller, Unipro is the communication channel between host and device, includes M-PHY as well.

Quoted 2 lines

Is there any reason why we say that this file is deprecated? Please let me know if you have.

These are only few declarations and i guess it would be appopriate to put them under UniPro header file. Anyways it is your choice.

Quoted 131 lines
Quoted 36 lines
Quoted 36 lines
drivers/scsi/ufs/mphy.h new file +25 -0
+
+#define TX_HIBERN8TIME_CAP		0x0f
+#define TX_MIN_ACTIVATE_TIME		0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP	0x8b
+#define RX_HS_G1_PREP_LEN_CAP	0x8c
+#define RX_HS_G2_SYNC_LEN_CAP	0x94
+#define RX_HS_G3_SYNC_LEN_CAP	0x95
+#define RX_HS_G2_PREP_LEN_CAP	0x96
+#define RX_HS_G3_PREP_LEN_CAP	0x97
+ #define SYNC_RANGE_FINE	(0 << 6)
+ #define SYNC_RANGE_COARSE	(1 << 6)
+ #define SYNC_LEN(x)		((x) & 0x3f)
+ #define PREP_LEN(x)		((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP		0x98
+ #define RX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP		0x10
+ #define TX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP		0x8f
+#define RX_HIBERN8TIME_CAP		0x92
+#define RX_ADV_HIBERN8TIME_CAP		0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP	0x9a
+
+#endif /* _MPHY_H_ */
+
drivers/scsi/ufs/ufshci.h +0 -1
index 9599741..26dc340 100644
@@ -170,17 +170,25 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
Quoted 8 lines

drivers/scsi/ufs/ufshci.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/ufshci.h +3 -2
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED		UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF		UFS_BIT(5)

why don't we just add macros for all the bits in UECDL ? This makes it easy in future.

Okay. I'll think about it and apply new macros on new version of this patch.

Quoted 10 lines
Quoted 10 lines
drivers/scsi/ufs/ufshci.h +4 -0
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT		UFS_BIT(13)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK	0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_NETWORK_BAD_DEVICEID_ENC		BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING	BIT(2)
 
Quoted 9 lines

drivers/scsi/ufs/ufshci.h enum { · line 191

Quoted 7 lines
drivers/scsi/ufs/ufshci.h +4 -0
 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR		UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK	0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID		BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX		BIT(2)
+#define UIC_TRANSPORT_BAD_TC			BIT(4)

May be add definition for bit-5 and 6 as well.

Okay. I'll add those things on new version of this patch.

Quoted 50 lines
Quoted 17 lines
drivers/scsi/ufs/ufshci.h +0 -0
 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR			UFS_BIT(31)
drivers/scsi/ufs/unipro.h +1 -0
index eff8b56..e47e2c2 100644
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTIMEOUT	0x1591
 #define PA_HIBERN8TIME		0x15A7
 #define PA_LOCALVERINFO		0x15A9
+#define PA_GRANULARITY		0x15AA
 #define PA_TACTIVATE		0x15A8
 #define PA_PACPFRAMECOUNT	0x15C0
 #define PA_PACPERRORCOUNT	0x15C1

drivers/scsi/ufs/unipro.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/unipro.h +1 -0
@@ -170,6 +171,9 @@ enum {
 	UNCHANGED	= 7,
 };
 
+#define IS_PWR_MODE_HS(m)        (((m) == FAST_MODE) || ((m) ==
 FASTAUTO_MODE))

s/IS_PWR_MODE_HS/IS_HS_PWR_MODE ?

drivers/scsi/ufs/unipro.h enum { · line 177

Quoted 2 lines
drivers/scsi/ufs/unipro.h +1 -0
+#define IS_PWR_MODE_PWM(m)       (((m) == SLOW_MODE) || ((m) ==
 SLOWAUTO_MODE))

s/IS_PWR_MODE_PWM/IS_PWM_PWR_MODE ?

Quoted 20 lines
drivers/scsi/ufs/unipro.h +1 -0
+
 /* PA TX/RX Frequency Series */

enum {

drivers/scsi/ufs/unipro.h +5 -0
 	PA_HS_MODE_A	= 1,
@@ -231,6 +235,11 @@ enum ufs_unipro_ver {
 #define DL_PEERTC1PRESENT	0x2066
 #define DL_PEERTC1RXINITCREVAL	0x2067
 
+/* Default value of L2 Timer */
+#define FC0PROTTIMEOUTVAL	8191
+#define TC0REPLAYTIMEOUTVAL	65535
+#define AFC0REQTIMEOUTVAL	32767
+
 /*
  * Network Layer Attributes
  */
@@ -259,6 +268,21 @@ enum ufs_unipro_ver {
 #define T_TC0TXMAXSDUSIZE	0x4060
 #define T_TC1TXMAXSDUSIZE	0x4061
 
Quoted 11 lines

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 277

Quoted 7 lines
drivers/scsi/ufs/unipro.h +7 -0
+/* CPort setting */
+#define E2EFC_ON	(1 << 0)
+#define E2EFC_OFF	(0 << 0)
+#define CSD_N_ON	(0 << 1)
+#define CSD_N_OFF	(1 << 1)
+#define CSV_N_ON	(0 << 2)
+#define CSV_N_OFF	(1 << 2)

Can you please specify where these are coming from? Spec number and section/line number?

Quoted 4 lines

These definitions are associated with Unipro attributes 0x4025, that is T_CPortFlags.
I referred version 1.6 - 6 August 2013.
You can find details in Chapter 8.17 and Table 92 in the spec

Thanks.
Can you please prefix those macro names with Attribute name? For ex: T_CPORTFLAGS_E2EFC_ON ? It makes it more readable.

Quoted 22 lines
Quoted 22 lines
Quoted 4 lines
drivers/scsi/ufs/unipro.h +1 -0
+#define CPORT_DEF_FLAGS	(CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 288

Quoted 10 lines
drivers/scsi/ufs/unipro.h +7 -0
+
+/* CPort connection state */
+enum {
+	CPORT_IDLE = 0,
+	CPORT_CONNECTED,
+};
+
 #ifdef FALSE
 #undef FALSE
 #endif

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Projec
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Hi, Subhash

I'll update this patch referring what you said below except for creating of "mphy.h".

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These things are defined to be used by some UFS Host controllers.

---
 drivers/scsi/ufs/mphy.h   | 38

++++++++++++++++++++++++++++++++++++++

Quoted 33 lines
Quoted 31 lines
Quoted 22 lines
Quoted 22 lines
 drivers/scsi/ufs/ufshci.h | 14 +++++++++++---
drivers/scsi/ufs/unipro.h | 24 ++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 3 deletions(-)  create mode

100644 drivers/scsi/ufs/mphy.h

drivers/scsi/ufs/mphy.h new renamed from drivers/scsi/ufs/mphy.h +0 -0

file mode 100644 index 0000000..c431f49

drivers/scsi/ufs/mphy.h new file +6 -0
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or

modify
+ * it under the terms of the GNU General Public License as
+ published
by
+ * the Free Software Foundation; either version 2 of the License,
+ or

Quoted 8 lines

drivers/scsi/ufs/mphy.h line 13

Quoted 5 lines

+ * (at your option) any later version.
+ */

drivers/scsi/ufs/mphy.h new file +3 -0
+
+#ifndef _MPHY_H_
+#define _MPHY_H_

Do we really need separate file for MPHY? May be we can have these accomodated in unipro.h itself?

Quoted 1 line

I think it's needed. MPHY spec isn't related with Unipro spec directly.

Quoted 8 lines

Yes but for UFS host controller, Unipro is the communication channel between host and device, includes M-PHY as well.

Quoted 2 lines

Is there any reason why we say that this file is deprecated? Please let me know if you have.

These are only few declarations and i guess it would be appopriate to put them under UniPro header file. Anyways it is your choice.

As you said, for now, there are not many declarations of mphy. But I expect adding more in the future.
I think that all other UFS driver including coming new ones, if any, aren't separated from mphy like "ufs-qcom.c", especially Exynos driver.

Anyway, thank you for your opinion.

Quoted 174 lines
Quoted 133 lines
Quoted 37 lines
Quoted 37 lines
drivers/scsi/ufs/mphy.h new file +25 -0
+
+#define TX_HIBERN8TIME_CAP		0x0f
+#define TX_MIN_ACTIVATE_TIME		0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP	0x8b
+#define RX_HS_G1_PREP_LEN_CAP	0x8c
+#define RX_HS_G2_SYNC_LEN_CAP	0x94
+#define RX_HS_G3_SYNC_LEN_CAP	0x95
+#define RX_HS_G2_PREP_LEN_CAP	0x96
+#define RX_HS_G3_PREP_LEN_CAP	0x97
+ #define SYNC_RANGE_FINE	(0 << 6)
+ #define SYNC_RANGE_COARSE	(1 << 6)
+ #define SYNC_LEN(x)		((x) & 0x3f)
+ #define PREP_LEN(x)		((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP		0x98
+ #define RX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP		0x10
+ #define TX_ADV_GRAN_STEP(x)	((((x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP		0x8f
+#define RX_HIBERN8TIME_CAP		0x92
+#define RX_ADV_HIBERN8TIME_CAP		0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP	0x9a
+
+#endif /* _MPHY_H_ */
+
drivers/scsi/ufs/ufshci.h +0 -1
index 9599741..26dc340 100644
@@ -170,17 +170,25 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
Quoted 8 lines

drivers/scsi/ufs/ufshci.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/ufshci.h +3 -2
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED		UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF		UFS_BIT(5)

why don't we just add macros for all the bits in UECDL ? This makes it easy in future.

Okay. I'll think about it and apply new macros on new version of this patch.

Quoted 10 lines
Quoted 10 lines
drivers/scsi/ufs/ufshci.h +4 -0
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT		UFS_BIT(13)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK	0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_NETWORK_BAD_DEVICEID_ENC		BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING	BIT(2)
 
Quoted 9 lines

drivers/scsi/ufs/ufshci.h enum { · line 191

Quoted 7 lines
drivers/scsi/ufs/ufshci.h +4 -0
 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR		UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK	0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE	BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID		BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX		BIT(2)
+#define UIC_TRANSPORT_BAD_TC			BIT(4)

May be add definition for bit-5 and 6 as well.

Okay. I'll add those things on new version of this patch.

Quoted 50 lines
Quoted 17 lines
drivers/scsi/ufs/ufshci.h +0 -0
 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR			UFS_BIT(31)
drivers/scsi/ufs/unipro.h +1 -0
index eff8b56..e47e2c2 100644
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTIMEOUT	0x1591
 #define PA_HIBERN8TIME		0x15A7
 #define PA_LOCALVERINFO		0x15A9
+#define PA_GRANULARITY		0x15AA
 #define PA_TACTIVATE		0x15A8
 #define PA_PACPFRAMECOUNT	0x15C0
 #define PA_PACPERRORCOUNT	0x15C1

drivers/scsi/ufs/unipro.h enum { · line 175

Quoted 5 lines
drivers/scsi/ufs/unipro.h +1 -0
@@ -170,6 +171,9 @@ enum {
 	UNCHANGED	= 7,
 };
 
+#define IS_PWR_MODE_HS(m)        (((m) == FAST_MODE) || ((m) ==
 FASTAUTO_MODE))

s/IS_PWR_MODE_HS/IS_HS_PWR_MODE ?

drivers/scsi/ufs/unipro.h enum { · line 177

Quoted 2 lines
drivers/scsi/ufs/unipro.h +1 -0
+#define IS_PWR_MODE_PWM(m)       (((m) == SLOW_MODE) || ((m) ==
 SLOWAUTO_MODE))

s/IS_PWR_MODE_PWM/IS_PWM_PWR_MODE ?

Quoted 20 lines
drivers/scsi/ufs/unipro.h +1 -0
+
 /* PA TX/RX Frequency Series */

enum {

drivers/scsi/ufs/unipro.h +5 -0
 	PA_HS_MODE_A	= 1,
@@ -231,6 +235,11 @@ enum ufs_unipro_ver {
 #define DL_PEERTC1PRESENT	0x2066
 #define DL_PEERTC1RXINITCREVAL	0x2067
 
+/* Default value of L2 Timer */
+#define FC0PROTTIMEOUTVAL	8191
+#define TC0REPLAYTIMEOUTVAL	65535
+#define AFC0REQTIMEOUTVAL	32767
+
 /*
  * Network Layer Attributes
  */
@@ -259,6 +268,21 @@ enum ufs_unipro_ver {
 #define T_TC0TXMAXSDUSIZE	0x4060
 #define T_TC1TXMAXSDUSIZE	0x4061
 
Quoted 11 lines

drivers/scsi/ufs/unipro.h enum ufs_unipro_ver { · line 277

Quoted 7 lines
drivers/scsi/ufs/unipro.h +7 -0
+/* CPort setting */
+#define E2EFC_ON	(1 << 0)
+#define E2EFC_OFF	(0 << 0)
+#define CSD_N_ON	(0 << 1)
+#define CSD_N_OFF	(1 << 1)
+#define CSV_N_ON	(0 << 2)
+#define CSV_N_OFF	(1 << 2)

Can you please specify where these are coming from? Spec number and section/line number?

Quoted 4 lines

These definitions are associated with Unipro attributes 0x4025, that is T_CPortFlags.
I referred version 1.6 - 6 August 2013.
You can find details in Chapter 8.17 and Table 92 in the spec

Thanks.
Can you please prefix those macro names with Attribute name? For ex:
T_CPORTFLAGS_E2EFC_ON ? It makes it more readable.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
drivers/scsi/ufs/unipro.h +8 -0
+#define CPORT_DEF_FLAGS	(CSV_N_OFF | CSD_N_OFF | E2EFC_OFF)
+
+/* CPort connection state */
+enum {
+	CPORT_IDLE = 0,
+	CPORT_CONNECTED,
+};
+
 #ifdef FALSE
 #undef FALSE
 #endif
Quoted 8 lines
Quoted 8 lines

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Projec
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html