From patchwork Fri Jan 13 20:48:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 43585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp476675wrt; Fri, 13 Jan 2023 12:55:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0YOcB2GJc6eiwH6i0lRpAEGprOU0YLtn2b7NpQCkq9M776tTYBOOJ57KjFDqIKtOlEfPm X-Received: by 2002:a17:906:9141:b0:86c:f643:89cb with SMTP id y1-20020a170906914100b0086cf64389cbmr11329ejw.23.1673643333009; Fri, 13 Jan 2023 12:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673643332; cv=none; d=google.com; s=arc-20160816; b=h24sj/6uo3ItcZNHmbUSDhgW3HItSzSfW/+MLmllrw11xWGJGO9QiAIou+iX8QBoD3 ijgwWe5t4+7JHSk2KcQTjmQ5J4zluyFi+EX36DkF8HAtIh+CE3UrH5nr8mTuAMcZdM/d I6QfWKOIk/wYNO/2WqCmxuuAPp5+k34SWnHTwds0+UgiSS1e3Y7UOj6odvavdF63qDox 0Byk0gHIV7G/nxVvOL8z7wzchL8lys5qs+KIhirjNyu7PXyzfMbU3KX2rhg9sBUb5XKW hIEcIqaF6Ut/PMRQ7j7K9exm1dYnt9Mk9SPVLt8rYm3kWWK4axsxa98UZixaDOu6GS5m 1VXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s4LJfkag43+48DoV8koHmcmMwAFGdXWl0cwTzdMs+Fw=; b=z7ZW5O6sl1UJIYy8dk7WuMpy9y1AJ7M9MxXuFgF0JlmZNDLhjVybv/18A9rjYaZAIN Y1r9miigKDP5FwHyP3mOGax+aWXpI6Pb3dQne28elCGOv09C18q6R21W4ao2V9+T837k Bfhi2grgW6PBxllVobqOtwEp5W3VKKBh0dbaH7Ac9Clhw0X9Rc4AB0gpEZERIJUUDDmc 1TjxzLaVonXalSdDBSzsu4KjNeQ0hmxokXPgcSYRW4YgPKiTIAylIqsF5atITJ4iLMdO INnvJXzxcQKbLDjvWifXagifOwDbWu2wpVpydRYSRey/ZGAZBodObKh2PMfnEUOjb/rB LkKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XVJC3HCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa9-20020a170907868900b007c10a0c6f44si23271076ejc.623.2023.01.13.12.55.09; Fri, 13 Jan 2023 12:55:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XVJC3HCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbjAMUvS (ORCPT + 99 others); Fri, 13 Jan 2023 15:51:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbjAMUvK (ORCPT ); Fri, 13 Jan 2023 15:51:10 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47D2087F26; Fri, 13 Jan 2023 12:51:07 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DKfBCW027718; Fri, 13 Jan 2023 20:50:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=s4LJfkag43+48DoV8koHmcmMwAFGdXWl0cwTzdMs+Fw=; b=XVJC3HCCKeIW9cCNNydJZq2I4Rs8oefaQ4rlOfW6YkB9gQeYpLCQrcl0rOFNAl5roUn5 ZAc55B3bpRBGWFem5Eg1MaKJ3otE8lcE9r9HbzNxAm+UQC8TDubxIibwrP9UqreFSh26 QLBIYq9Ub8XaN6qoPyKPBaJhcJBpvAeUKFevHxsh6sdEYfycgokCEsKHplBSL5UBz/ta Z78lQG+FNP4mt/Hmtexki/8ikN1j+Vvrp+t7xB26BoQJV+Dl/7wKqJM+TgGyQc9Auk3J VwUbIHkJNqzW2ERY3j5fV5xBusJicNrs39Pq+IR0FlRFj7dlGNjvt8wFkmdUuWbNXey9 PQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n2fwpv15c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 20:50:45 +0000 Received: from nasanex01a.na.qualcomm.com ([10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30DKoiTa022822 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 20:50:44 GMT Received: from asutoshd-linux1.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 13 Jan 2023 12:50:44 -0800 From: Asutosh Das To: , , CC: , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Matthias Brugger , Jinyoung Choi , open list , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Subject: [PATCH v13 02/15] ufs: core: Introduce Multi-circular queue capability Date: Fri, 13 Jan 2023 12:48:39 -0800 Message-ID: <72f0a04e4f90b8f15773dd57184193162236c012.1673557949.git.quic_asutoshd@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: OJZdBlOaVqeaUz1nvZoOTGUP4_fAt8c6 X-Proofpoint-ORIG-GUID: OJZdBlOaVqeaUz1nvZoOTGUP4_fAt8c6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130142 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754942231151540227?= X-GMAIL-MSGID: =?utf-8?q?1754942231151540227?= Add support to check for MCQ capability in the UFSHC. Add a module parameter to disable MCQ if needed. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu --- drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++ include/ufs/ufshcd.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 6ba0597..64e0461 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -92,6 +92,28 @@ /* Polling time to wait for fDeviceInit */ #define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */ +/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */ +static bool use_mcq_mode = true; + +static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) +{ + int ret; + + ret = param_set_bool(val, kp); + if (ret) + return ret; + + return 0; +} + +static const struct kernel_param_ops mcq_mode_ops = { + .set = param_set_mcq_mode, + .get = param_get_bool, +}; + +module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644); +MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default"); + #define ufshcd_toggle_vreg(_dev, _vreg, _on) \ ({ \ int _ret; \ @@ -2261,6 +2283,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) if (err) dev_err(hba->dev, "crypto setup failed\n"); + hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities); + if (!hba->mcq_sup) + return err; + hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP); hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT, hba->mcq_capabilities); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 8f2080f..514687d 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -843,6 +843,7 @@ struct ufs_hba_monitor { * @complete_put: whether or not to call ufshcd_rpm_put() from inside * ufshcd_resume_complete() * @ext_iid_sup: is EXT_IID is supported by UFSHC + * @mcq_sup: is mcq supported by UFSHC */ struct ufs_hba { void __iomem *mmio_base; @@ -995,6 +996,7 @@ struct ufs_hba { u32 luns_avail; bool complete_put; bool ext_iid_sup; + bool mcq_sup; }; #ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE