@@ -30,10 +30,12 @@ ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp, u32 *dword_0,
u32 *dword_1, u32 *dword_3)
{
if (lrbp->crypto_key_slot >= 0) {
- *dword_0 |= UTP_REQ_DESC_CRYPTO_ENABLE_CMD;
- *dword_0 |= lrbp->crypto_key_slot;
- *dword_1 = lower_32_bits(lrbp->data_unit_num);
- *dword_3 = upper_32_bits(lrbp->data_unit_num);
+ if ((*dword_0 & UTRD_DIRECTION) != UTP_NO_DATA_TRANSFER) {
+ *dword_0 |= UTP_REQ_DESC_CRYPTO_ENABLE_CMD;
+ *dword_0 |= lrbp->crypto_key_slot;
+ *dword_1 = lower_32_bits(lrbp->data_unit_num);
+ *dword_3 = upper_32_bits(lrbp->data_unit_num);
+ }
}
}
@@ -387,6 +387,8 @@ enum {
UTP_DEVICE_TO_HOST = 0x04000000,
};
+#define UTRD_DIRECTION 0x6000000
+
/* Overall command status values */
enum utp_ocs {
OCS_SUCCESS = 0x0,