From patchwork Tue Apr 12 18:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F684C433EF for ; Tue, 12 Apr 2022 18:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347502AbiDLSV2 (ORCPT ); Tue, 12 Apr 2022 14:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238105AbiDLSVZ (ORCPT ); Tue, 12 Apr 2022 14:21:25 -0400 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 913AB3AF for ; Tue, 12 Apr 2022 11:19:06 -0700 (PDT) Received: by mail-pj1-f54.google.com with SMTP id bx5so19233425pjb.3 for ; Tue, 12 Apr 2022 11:19:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qe0C3WunpAjWztLU0SeIdFoCyB5+szNaPjdtGrw9eHU=; b=pDJw8RxdEXIbiV3ZOeWvjrglW4qHXAPDdss+wEPjJtz7NKpjlZ3gBSctbfG7+RUerB raI3Hyfy3WScAQ5Raf6G+yKLBnEjGjNgJEinvzyP800MEUuNuRfg3SATCd1YvIHU6Fbq e/+Hac59pD8QueYJQw/hS32ftKK9lbD0YkdgnI6prsgIrBTwcav8ybN2PfTjvlEGibg1 C2d+/stmp/2y+hCMTOJ4EZ+hbpzODFmHRlDmRDmfvvUGXVp758Fd3q49UTPJxvZjOOcM vW0f6abKLdAKlZPWBOPt274/4Yb3CRIb224YtADOKL0TdzL2qD6ur+J1IH4DidwbZK89 o+yw== X-Gm-Message-State: AOAM531bKCCdz3oRMB01uNvFiMty1lCMlel/X/yKoGq7/r9rWzCjEsvo mYaKXiYcVeOLRYPaIPcUz1E= X-Google-Smtp-Source: ABdhPJxxmumsSbulQdBxGWi2fPz4U+4TJb60vQBhDGp3OtJCoIcX5IBGajzwaBh68KIcBwix2BWZNw== X-Received: by 2002:a17:903:248:b0:155:ecb7:dfaf with SMTP id j8-20020a170903024800b00155ecb7dfafmr39022109plh.84.1649787545991; Tue, 12 Apr 2022 11:19:05 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:19:05 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Avri Altman Subject: [PATCH v2 01/29] scsi: ufs: Fix a spelling error in a source code comment Date: Tue, 12 Apr 2022 11:18:25 -0700 Message-Id: <20220412181853.3715080-2-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Change one occurrence of "adpater" into "adapter". Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/unipro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index 8e9e486a4f7b..705a6465ba5c 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -103,7 +103,7 @@ #define UNIPRO_CB_OFFSET(x) (0x8000 | x) /* - * PHY Adpater attributes + * PHY Adapter attributes */ #define PA_ACTIVETXDATALANES 0x1560 #define PA_ACTIVERXDATALANES 0x1580 From patchwork Tue Apr 12 18:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70098C433EF for ; Tue, 12 Apr 2022 18:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349427AbiDLSVt (ORCPT ); Tue, 12 Apr 2022 14:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243571AbiDLSVs (ORCPT ); Tue, 12 Apr 2022 14:21:48 -0400 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C53E255A7 for ; Tue, 12 Apr 2022 11:19:28 -0700 (PDT) Received: by mail-pg1-f169.google.com with SMTP id t4so18010734pgc.1 for ; Tue, 12 Apr 2022 11:19:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vAvAdPiV+CMBL3q1ZKpWhCqvgC6GS7287yjxaluRU7M=; b=kwDWRIXAidZWOVo6/v2rRo7rMGivDgGRtKpU53HY8rIUwJLYLG7FAeQRqjfjTZ6GCv NgbD95XGOKbQ7tG/NGngwzQ3GCBPAv3FFB/vsa6eXSRwg1fjsIRYwFEozJ/lFrmQDID2 bGpD/sjsHxM/FwMwvywHEP9seQKHUv5UW6BiP49+6ht9Yt7lEcl/tTaXq53mNCUS7v8D 3XcP8129c9XMCpIuwfX5fA4bxnGvY0kq0znKNRpWAi0sysRBX/EO9B9aSr6Bf6OzDpsu UG3gzY0Ex1bXN5MtNK+3gZvYLX9DWomGMNXiZueHIE/VQ4B2D7C3Py5cmqo6VyiucF0U so3g== X-Gm-Message-State: AOAM5320XjvjdafBj+GUzkVUnWETYiU0gxobAIteMQJ8pWb4oH50XDLz 0XDthBghyif8xJ/jTUhAvVM= X-Google-Smtp-Source: ABdhPJyeH07tUePgKg8Hp21Q0UYisraFxv2z6zYe7ZDIN34AymCMNfScnApC/G7OEblrmvGcYVm2cw== X-Received: by 2002:a05:6a00:1490:b0:4fb:1544:bc60 with SMTP id v16-20020a056a00149000b004fb1544bc60mr5817460pfu.73.1649787568021; Tue, 12 Apr 2022 11:19:28 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.19.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:19:27 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson , Avri Altman , "James E.J. Bottomley" , Bean Huo , ChanWoo Lee , Ye Bin , Peter Wang , Daejun Park Subject: [PATCH v2 03/29] scsi: ufs: Remove superfluous boolean conversions Date: Tue, 12 Apr 2022 11:18:27 -0700 Message-Id: <20220412181853.3715080-4-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove "? true : false" if the preceding expression yields a boolean or if the result of the expression is assigned to a boolean since in these two cases the "? true : false" part is superfluous. Reviewed-by: Bjorn Andersson Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.c | 3 +-- drivers/scsi/ufs/ufshcd.c | 9 ++++----- drivers/scsi/ufs/ufshcd.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 0d2e950d0865..808b677f6083 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -299,8 +299,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) struct ufs_qcom_host *host = ufshcd_get_variant(hba); struct phy *phy = host->generic_phy; int ret = 0; - bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B) - ? true : false; + bool is_rate_B = UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B; /* Reset UFS Host Controller and PHY */ ret = ufs_qcom_host_reset(hba); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dbf50b50870b..983fac14b7cd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -712,8 +712,7 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) */ static inline bool ufshcd_is_device_present(struct ufs_hba *hba) { - return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & - DEVICE_PRESENT) ? true : false; + return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & DEVICE_PRESENT; } /** @@ -840,7 +839,7 @@ ufshcd_get_rsp_upiu_data_seg_len(struct utp_upiu_rsp *ucd_rsp_ptr) static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr) { return be32_to_cpu(ucd_rsp_ptr->header.dword_2) & - MASK_RSP_EXCEPTION_EVENT ? true : false; + MASK_RSP_EXCEPTION_EVENT; } /** @@ -1350,7 +1349,7 @@ static int ufshcd_devfreq_target(struct device *dev, } /* Decide based on the rounded-off frequency and update */ - scale_up = (*freq == clki->max_freq) ? true : false; + scale_up = *freq == clki->max_freq; if (!scale_up) *freq = clki->min_freq; /* Update the frequency */ @@ -2800,7 +2799,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); - lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba) ? true : false; + lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba); ufshcd_prepare_lrbp_crypto(scsi_cmd_to_rq(cmd), lrbp); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 949427714d0e..b2740b51a546 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -985,7 +985,7 @@ static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) { - return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; + return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); } static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) From patchwork Tue Apr 12 18:18:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01B5FC433F5 for ; Tue, 12 Apr 2022 18:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358680AbiDLSWO (ORCPT ); Tue, 12 Apr 2022 14:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358674AbiDLSWN (ORCPT ); Tue, 12 Apr 2022 14:22:13 -0400 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A8A737001 for ; Tue, 12 Apr 2022 11:19:54 -0700 (PDT) Received: by mail-pj1-f53.google.com with SMTP id g12-20020a17090a640c00b001cb59d7a57cso2348159pjj.1 for ; Tue, 12 Apr 2022 11:19:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLPy4g/P6lPqKcu5Q8el2I29IYha8Epe6ejgyk2dfiA=; b=icXpX0ETWmobSheO9Fz+bAZ8CTMRTtibzoLuWaFm8RKNAVW3Z8Y2yvf8nDxrI3t+se y/G3VoVS4fm1+JEpOAqRrsn0F17CXJFMXkq7i/QkgZt/WWxtZQA51eVBYJNrtKCngg0G S8P54GUUe3Fn/kGCaVRG67hesAbL6LNwnbSx83Aa1S/FbTAQOyKqpyIwaZe7XA/iDEZX fIGgkqK6GexJPX9DxVxVl8pE2iRCh6omeYKQmBzavKnBLOCJDfMdayQsX0dBEadtHQGu i4PmGum0UvEl/3uP0Ptp3Jj0kPbQGa334vtAhHPy6YkUHcsI6CG567KJ//mpJt1l1hNt E0MA== X-Gm-Message-State: AOAM533FjRieMsT7pXbs+BpouSnl78ypc0n1HeK58f/Wp18y6kosBBXl Bs+1Tk6w+B1CR1Gkafbtz+k= X-Google-Smtp-Source: ABdhPJxcLN5v0ifN5Hf+HuHdxhCUUvkSZ/pD3s152H+DbFgoTEa7WOgB4AP1WgL4zn1QbWyP68Sq1A== X-Received: by 2002:a17:90b:4b46:b0:1cb:6edf:27f1 with SMTP id mi6-20020a17090b4b4600b001cb6edf27f1mr6385152pjb.173.1649787593653; Tue, 12 Apr 2022 11:19:53 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:19:53 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , Keoseong Park , "James E.J. Bottomley" , Bean Huo , Daejun Park Subject: [PATCH v2 05/29] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Date: Tue, 12 Apr 2022 11:18:29 -0700 Message-Id: <20220412181853.3715080-6-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org ufshcd_lrb.sense_bufflen is set but never read. Hence remove this struct member. Reviewed-by: Avri Altman Reviewed-by: Keoseong Park Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 3 --- drivers/scsi/ufs/ufshcd.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c60519372b3b..e52e86b0b7a3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2789,7 +2789,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_bufflen = UFS_SENSE_SIZE; lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); @@ -2830,7 +2829,6 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) { lrbp->cmd = NULL; - lrbp->sense_bufflen = 0; lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; /* device management cmd is not specific to any LUN */ @@ -6802,7 +6800,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = NULL; - lrbp->sense_bufflen = 0; lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b2740b51a546..b6162b208d99 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -182,7 +182,6 @@ struct ufs_pm_lvl_states { * @ucd_req_dma_addr: UPIU request dma address for debug * @cmd: pointer to SCSI command * @sense_buffer: pointer to sense buffer address of the SCSI command - * @sense_bufflen: Length of the sense buffer * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @task_tag: Task tag of the command @@ -207,7 +206,6 @@ struct ufshcd_lrb { struct scsi_cmnd *cmd; u8 *sense_buffer; - unsigned int sense_bufflen; int scsi_status; int command_type; From patchwork Tue Apr 12 18:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95A86C433EF for ; Tue, 12 Apr 2022 18:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358674AbiDLSWm (ORCPT ); Tue, 12 Apr 2022 14:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243468AbiDLSW1 (ORCPT ); Tue, 12 Apr 2022 14:22:27 -0400 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 389CE3DA48 for ; Tue, 12 Apr 2022 11:20:09 -0700 (PDT) Received: by mail-pj1-f48.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso3782010pjb.5 for ; Tue, 12 Apr 2022 11:20:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n+DEqcxCsHRV+0HiSYhlEtxBoyz+hIoKEkJidAugI08=; b=rU/56lC/wFBECDu9c4YGk3iidHlybYoRXv2bwfWhJigd+BC65XRw03yrfqbX5MZLWg HO4VSS0dZSqw0m2zcg2KIGqqDnmdV2DRXwxquJe+t3AlORlU937c0V3zo9Y232efVGNQ uufskuareeztwVV22aeuzQc9hjrDcbRFBTXZw7aTvfsR36ZBEbMhLpD95uh+D5u8Ljxa PZrQAPycyI2BciAKsfYmcHrfqLqXzOyspbD20sTmPYp7XpJxqzo8ZcuRX19Rms1J30CY oDGAsiibcXF06REkwQI0GzfdPlR4AMLbBEQdwkcNO98UgH96Emwa/iHoLviRaJ5gxndk naPg== X-Gm-Message-State: AOAM531BdALBDKzBM63qltvtAlJ3pQGE7z50RkLfobPP3GK8Y5Vy6pNx Kp+UzqzOPb2ii2zZ0VN+wFA= X-Google-Smtp-Source: ABdhPJx2YmfuhoNEzcaTVFWLFIiQgFiL9osNKuRF3hVuCnWTFAAwL8m5IUv4ZkCOg5dqLvk9Ir3p3w== X-Received: by 2002:a17:90b:3b50:b0:1c7:5d55:3cb8 with SMTP id ot16-20020a17090b3b5000b001c75d553cb8mr6480314pjb.78.1649787608657; Tue, 12 Apr 2022 11:20:08 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:20:08 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bean Huo , "James E.J. Bottomley" , Avri Altman , Daejun Park Subject: [PATCH v2 07/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup() Date: Tue, 12 Apr 2022 11:18:31 -0700 Message-Id: <20220412181853.3715080-8-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use get_unaligned_be16(...) instead of the equivalent but harder to read be16_to_cpup((__be16 *)...). Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d4ef31e1a409..3ec26c9eb1be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7334,7 +7334,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff) u16 unit; for (i = start_scan; i >= 0; i--) { - data = be16_to_cpup((__be16 *)&buff[2 * i]); + data = get_unaligned_be16(&buff[2 * i]); unit = (data & ATTR_ICC_LVL_UNIT_MASK) >> ATTR_ICC_LVL_UNIT_OFFSET; curr_uA = data & ATTR_ICC_LVL_VALUE_MASK; From patchwork Tue Apr 12 18:18:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42CF5C433EF for ; Tue, 12 Apr 2022 18:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358681AbiDLSW7 (ORCPT ); Tue, 12 Apr 2022 14:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345988AbiDLSW5 (ORCPT ); Tue, 12 Apr 2022 14:22:57 -0400 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3A2D49F1F for ; Tue, 12 Apr 2022 11:20:38 -0700 (PDT) Received: by mail-pg1-f179.google.com with SMTP id r66so18010684pgr.3 for ; Tue, 12 Apr 2022 11:20:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+wbkoJU6O11IaEcR5GZXDjnJxvOiYhlZmVn4u8Ccdj0=; b=qX+vZo+oNE7lj4N2kOIzcuQo8W7rwUn3IYIUZqzzpljgF7HLs6bMAPCL6b0x1DJVPZ bBzH+HNau2RynC9YoVRXQHRBqxUi8DylSz6LhMg2FrU/nMiPM01GThNAwabiqcIxqvcR 8EgZ4ZOHu1OpxXvvtT5n7eZziZBn++XK860vYZsBli9ARt6zxtTLpVWqbfvM9F8ZWysd CpfimTZ3pxwELVq0HHXKxqAqeIka5fG7u9c+vRceFpyZUl4AcD60+8s/bH2PKWs801nT GeHc1KlrNSYcvnTXX6POWdCJktSTf1orKCpuwtkLSuzCpbA8xmHvbeC4cqMBBfTcJRGp RaiQ== X-Gm-Message-State: AOAM5333JifWcxW6vhmsOyWws6agUh+TvnPX/raFC7KWakqnOJ01Jkge 4nZK16CyFQ9Rby5ai3iamSg= X-Google-Smtp-Source: ABdhPJwkSlP3O9EWhhS5FYcegH/Mz7oRzGluGJS1c10bl0JKWtkOyF900MnELsqrlEmZgI6UUGZx4A== X-Received: by 2002:a63:cf0b:0:b0:39d:40ee:56b with SMTP id j11-20020a63cf0b000000b0039d40ee056bmr11397272pgg.342.1649787638202; Tue, 12 Apr 2022 11:20:38 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:20:36 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Matthias Brugger , Stanley Chu , Peter Wang , Bean Huo , Daejun Park Subject: [PATCH v2 09/29] scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk Date: Tue, 12 Apr 2022 11:18:33 -0700 Message-Id: <20220412181853.3715080-10-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since struct ufs_dev_fix contains quirk information, rename it into struct ufs_dev_quirk. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 2 +- drivers/scsi/ufs/ufs_quirks.h | 4 ++-- drivers/scsi/ufs/ufshcd.c | 6 +++--- drivers/scsi/ufs/ufshcd.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index b275b440f027..217348dde6a6 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -44,7 +44,7 @@ #define ufs_mtk_device_reset_ctrl(high, res) \ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) -static struct ufs_dev_fix ufs_mtk_dev_fixups[] = { +static struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index e6c535c77527..e38dec5f0351 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -19,11 +19,11 @@ #define UFS_VENDOR_WDC 0x145 /** - * ufs_dev_fix - ufs device quirk info + * ufs_dev_quirk - ufs device quirk info * @card: ufs card details * @quirk: device quirk */ -struct ufs_dev_fix { +struct ufs_dev_quirk { u16 wmanufacturerid; u8 *model; unsigned int quirk; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5fa93be246a5..9df37c80308a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -204,7 +204,7 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state, return UFS_PM_LVL_0; } -static struct ufs_dev_fix ufs_fixups[] = { +static struct ufs_dev_quirk ufs_fixups[] = { /* UFS cards deviations table */ { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, @@ -7624,9 +7624,9 @@ static void ufshcd_temp_notif_probe(struct ufs_hba *hba, u8 *desc_buf) } } -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups) +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups) { - struct ufs_dev_fix *f; + struct ufs_dev_quirk *f; struct ufs_dev_info *dev_info = &hba->dev_info; if (!fixups) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b9f17219ca18..3d18581afc2b 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1180,7 +1180,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, void ufshcd_auto_hibern8_enable(struct ufs_hba *hba); void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups); +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups); #define SD_ASCII_STD true #define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, From patchwork Tue Apr 12 18:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3D0CC433EF for ; Tue, 12 Apr 2022 18:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236948AbiDLSXV (ORCPT ); Tue, 12 Apr 2022 14:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358688AbiDLSXU (ORCPT ); Tue, 12 Apr 2022 14:23:20 -0400 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACAA04DF55 for ; Tue, 12 Apr 2022 11:21:00 -0700 (PDT) Received: by mail-pf1-f178.google.com with SMTP id z16so18227790pfh.3 for ; Tue, 12 Apr 2022 11:21:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=msoxtyUmQMPR1br4wFMJMr/YuaIVdEfrrF3GptbzXVo=; b=fLznWz9Xx2gxmiBQFyofUdxuEZJ7ypzkbAcFabRVwhssL+O4H02AAIc07jJNrW1y4L N5IWgo56woRSFE4xG9aVILpuFtQdki9XQUBawjYhp78hEkjnWPxolVD9MIkOONLqkg0y gy2iUXgCzMRRMOIgzxzayHnCype3YGLBHLLXcFsSAbakt3YoZN3pjvooCPgjJMuGJ+fS JhO2LcWO4ntuYM/23x/OFkK/0ZQ96wLdVyeIT5VPuJWkdN0DcOkqgvXAZRr2KwtqTdpd Io93OKQAkp7j7K5m4RIEzXirIP25Oxg6PpUAthmWtH/8VKYgyztTfMnnOQYN5cdOROn5 mwMw== X-Gm-Message-State: AOAM532PFrTlxTulzGoVN7BTK2FJEmDAzkSQZ/nXk1/jkHmNg1XBRrZT 78QgSKT97HQ96q9E0+TmjCc= X-Google-Smtp-Source: ABdhPJwtXpgTHAjH9u6aORQ4F3Ll/mfH0yT+DKU6v+ciHNbpTALj21oDOUQhSFEvJEP9Y5KO/6rIig== X-Received: by 2002:a05:6a00:218a:b0:505:aa03:ba57 with SMTP id h10-20020a056a00218a00b00505aa03ba57mr15578852pfi.84.1649787660023; Tue, 12 Apr 2022 11:21:00 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:20:59 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Bean Huo , Daejun Park Subject: [PATCH v2 11/29] scsi: ufs: Invert the return value of ufshcd_is_hba_active() Date: Tue, 12 Apr 2022 11:18:35 -0700 Message-Id: <20220412181853.3715080-12-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It is confusing that ufshcd_is_hba_active() returns 'true' if the HBA is not active. Clear up this confusion by inverting the return value of ufshcd_is_hba_active(). This patch does not change any functionality. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a1ebfbb6f1b9..eabc6b6156fd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -917,12 +917,11 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba) * ufshcd_is_hba_active - Get controller state * @hba: per adapter instance * - * Returns false if controller is active, true otherwise + * Returns true if and only if the controller is active. */ static inline bool ufshcd_is_hba_active(struct ufs_hba *hba) { - return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE) - ? false : true; + return ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE; } u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba) @@ -4552,7 +4551,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba) int retry_inner; start: - if (!ufshcd_is_hba_active(hba)) + if (ufshcd_is_hba_active(hba)) /* change controller state to "reset state" */ ufshcd_hba_stop(hba); @@ -4578,7 +4577,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba) /* wait for the host controller to complete initialization */ retry_inner = 50; - while (ufshcd_is_hba_active(hba)) { + while (!ufshcd_is_hba_active(hba)) { if (retry_inner) { retry_inner--; } else { From patchwork Tue Apr 12 18:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 071D0C433F5 for ; Tue, 12 Apr 2022 18:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358683AbiDLSXf (ORCPT ); Tue, 12 Apr 2022 14:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358681AbiDLSXd (ORCPT ); Tue, 12 Apr 2022 14:23:33 -0400 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BFD66006F for ; Tue, 12 Apr 2022 11:21:15 -0700 (PDT) Received: by mail-pg1-f171.google.com with SMTP id z128so18017302pgz.2 for ; Tue, 12 Apr 2022 11:21:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3ggqJd+K00tQFtanOxz0I5riMOWXTnNeexPzEA8SIb8=; b=Ni2QZMTrLIK5B4WdJ87P0iPZAw96b7nh6ehWehOXYuaflRz4Rlqr+PxAWnhS0ySDZS setylVzBEoYk0anvdqQI5O+F+AxCBTa0vLrWKhRNIQgrY/6cHQOBdGHo1d6VsEBYQSyO Ke51Q5NVBtV4naRQX0Ww30gVhQU2AzMAO/+GYbVohweAM9XeRiMyOtiZM2BpTKguoBrr 6o7aZbaDqh8xMD83QSZYmVuTqvvmVfIwFySnIirKooFpn0ltOTAJskMLelcIarnY1JYY rfIonHDjMB6BajRUMEJLppJsuJtMkCvCsVMt9Bqr6nya2ZwXE4uWzgyMWtfpofTKDhVH sSmQ== X-Gm-Message-State: AOAM532A8wbTn/GYq8EX51rGszesc0bmKXhQeqL+rODu+Kh0JTGubpqX rld8Iu+l6daEExJLaFAwW4U= X-Google-Smtp-Source: ABdhPJxW2sGwvKUu/guQAjIWqKMX+hGEBJhR8G2c0l73rFBIqhKVya8rng9UypChBsOyeMIfrSAn0Q== X-Received: by 2002:aa7:943b:0:b0:505:70bd:61ab with SMTP id y27-20020aa7943b000000b0050570bd61abmr5801636pfo.58.1649787675011; Tue, 12 Apr 2022 11:21:15 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:21:14 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Bean Huo , Daejun Park , Sergey Shtylyov , Srinivas Kandagatla , Xiaoke Wang , Krzysztof Kozlowski Subject: [PATCH v2 13/29] scsi: ufs: Switch to aggregate initialization Date: Tue, 12 Apr 2022 11:18:37 -0700 Message-Id: <20220412181853.3715080-14-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it easier to verify for humans that ufshcd_init_pwr_dev_param() initializes all structure members. This patch does not change any functionality. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd-pltfrm.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index cca4b2181a81..9923cbc70653 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -297,18 +297,20 @@ EXPORT_SYMBOL_GPL(ufshcd_get_pwr_dev_param); void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param) { - dev_param->tx_lanes = 2; - dev_param->rx_lanes = 2; - dev_param->hs_rx_gear = UFS_HS_G3; - dev_param->hs_tx_gear = UFS_HS_G3; - dev_param->pwm_rx_gear = UFS_PWM_G4; - dev_param->pwm_tx_gear = UFS_PWM_G4; - dev_param->rx_pwr_pwm = SLOW_MODE; - dev_param->tx_pwr_pwm = SLOW_MODE; - dev_param->rx_pwr_hs = FAST_MODE; - dev_param->tx_pwr_hs = FAST_MODE; - dev_param->hs_rate = PA_HS_MODE_B; - dev_param->desired_working_mode = UFS_HS_MODE; + *dev_param = (struct ufs_dev_params){ + .tx_lanes = 2, + .rx_lanes = 2, + .hs_rx_gear = UFS_HS_G3, + .hs_tx_gear = UFS_HS_G3, + .pwm_rx_gear = UFS_PWM_G4, + .pwm_tx_gear = UFS_PWM_G4, + .rx_pwr_pwm = SLOW_MODE, + .tx_pwr_pwm = SLOW_MODE, + .rx_pwr_hs = FAST_MODE, + .tx_pwr_hs = FAST_MODE, + .hs_rate = PA_HS_MODE_B, + .desired_working_mode = UFS_HS_MODE, + }; } EXPORT_SYMBOL_GPL(ufshcd_init_pwr_dev_param); From patchwork Tue Apr 12 18:18:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71080C433EF for ; Tue, 12 Apr 2022 18:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245485AbiDLSYY (ORCPT ); Tue, 12 Apr 2022 14:24:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358694AbiDLSYB (ORCPT ); Tue, 12 Apr 2022 14:24:01 -0400 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DAAC5D64B for ; Tue, 12 Apr 2022 11:21:43 -0700 (PDT) Received: by mail-pl1-f173.google.com with SMTP id p10so653695plf.9 for ; Tue, 12 Apr 2022 11:21:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u3xoahIYSO9OOaeanh6ld3z8PVf6V1CHNxpRp8Wej3s=; b=y/+4SONzA0YHgaJw3x3Fc4NWVT7j2OlsgbB0W0rFDsNtyTNAlyAC+2ZYQyZAXjPFJu PK0Fda6uM0QtZnMDg0CTYRJJTsC7OgLXnhJslxk7QNulL+cQgBYgEBZoFhBp5yEfn84x VJtuRy0tNKgEC0SJ7GpJEkEMpne2obW1iVQTQIvrrNuFqPTRDp/lprTKm9GyMW0CxsFN 1v6WwvThSnMJOFKJ09Wj8+CgmxCt1OyPk1ZZbZhf8Gl5JM6sX8jzScS0T44qpPUyjxYr BxURU4OdYnamuTjjRhsQcc+n99/rA9ZZCL9rWRfWk2/xkfVoSRbmcHL/GIccNQ/Qoqkh 1Irg== X-Gm-Message-State: AOAM531B4Bo/Tx4ak9Bv5iO6UD6BNUWbfTm0F93sHGM2PV4D8gsXRpoV 4LivLPCFFRWa6HDxhDtRdjc= X-Google-Smtp-Source: ABdhPJyPAU6pqdXZqCqogqQVjloNzTZs6I5NfHEbd2aCEDK+iUwDJa7yexjFBRmUHK6JuD3Z+tHdeA== X-Received: by 2002:a17:902:8ec8:b0:156:847b:a8f8 with SMTP id x8-20020a1709028ec800b00156847ba8f8mr39598715plo.121.1649787703052; Tue, 12 Apr 2022 11:21:43 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:21:42 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bean Huo , Avri Altman , "James E.J. Bottomley" , Sergey Shtylyov , Krzysztof Kozlowski , Srinivas Kandagatla , Xiaoke Wang , Daejun Park Subject: [PATCH v2 15/29] scsi: ufs: Remove the driver version Date: Tue, 12 Apr 2022 11:18:39 -0700 Message-Id: <20220412181853.3715080-16-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The current version number is 0.2. That driver version was assigned more than nine years ago. A version number that is not updated while the driver is updated is not useful. Hence remove the driver version number from the UFS driver. See also commit e0eca63e3421 ("[SCSI] ufs: Separate PCI code into glue driver"). Reviewed-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/cdns-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd.c | 1 - drivers/scsi/ufs/ufshcd.h | 1 - 5 files changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c index 7da8be2f35c4..e91cf9fd5a95 100644 --- a/drivers/scsi/ufs/cdns-pltfrm.c +++ b/drivers/scsi/ufs/cdns-pltfrm.c @@ -340,4 +340,3 @@ module_platform_driver(cdns_ufs_pltfrm_driver); MODULE_AUTHOR("Jan Kotas "); MODULE_DESCRIPTION("Cadence UFS host controller platform driver"); MODULE_LICENSE("GPL v2"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index f76692053ca1..81aa14661072 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -601,4 +601,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("UFS host controller PCI glue driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 9923cbc70653..fc5191101192 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -386,4 +386,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("UFS host controller Platform bus based glue driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 69198e37c976..912c3ecb8d7a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9923,4 +9923,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("Generic UFS host controller driver Core"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index bb2624aabda2..49edbdb5ffd6 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -49,7 +49,6 @@ #include "ufshci.h" #define UFSHCD "ufshcd" -#define UFSHCD_DRIVER_VERSION "0.2" struct ufs_hba; From patchwork Tue Apr 12 18:18:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F12D9C433F5 for ; Tue, 12 Apr 2022 18:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiDLSYQ (ORCPT ); Tue, 12 Apr 2022 14:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231591AbiDLSYQ (ORCPT ); Tue, 12 Apr 2022 14:24:16 -0400 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126256006F for ; Tue, 12 Apr 2022 11:21:58 -0700 (PDT) Received: by mail-pj1-f54.google.com with SMTP id b2-20020a17090a010200b001cb0c78db57so3903684pjb.2 for ; Tue, 12 Apr 2022 11:21:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Aw6YY+9Ojmaf5Vn85bSv35EzCBs6xNM6n5pGVr8SH9w=; b=JUhFDpnfTZB5Yj+3FY/ZT6WhqUcThdimiM5/3V8L6PbcpxZPBWOLzB8w57b8shTvxi 0QSxgmlLNrYo/QyUqMPluJgYqmKfmX0J16cTbJlHWPfTBkRVnzqRX00dXgOEM8Tq48VR UBmd03aYJ4fbkk3mAE2tIRuoSaULObCkcLPdiv5nsVUOviJcP+aP4mNpaGqqxb7Q5X1h N5G9r/SQXAEZudLEyoKtRfjw6DAtaWv1hOuBEgaJJTNd8nQwqbX/b3BQulrwvUeHtIOn lrt9A1Cch5cCozhLUTqY+2XviCld51zfQ6eP83Wa/brW/DPHYmfw52BrvaEqtYB5rd26 yhnA== X-Gm-Message-State: AOAM533lfDXeThopKiZHgjNO3pRjKQgWCYMoEwAu9dlqi0uETts4MB6F I6V4GsXYwdAcF0yhJL1/6MU= X-Google-Smtp-Source: ABdhPJwwlYlydbNFa3U5Sb5l7/45nvho3ePM+T5OLvzIWEyFTJYmT0x9GVDtTdZxbCXzzA7GhRFYgw== X-Received: by 2002:a17:90b:1e44:b0:1ca:9eb8:e1ec with SMTP id pi4-20020a17090b1e4400b001ca9eb8e1ecmr6536058pjb.63.1649787717448; Tue, 12 Apr 2022 11:21:57 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:21:56 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Avri Altman , Bean Huo , Stanley Chu , Geert Uytterhoeven , Krzysztof Kozlowski , Daejun Park Subject: [PATCH v2 17/29] scsi: ufs: Use an SPDX license identifier in the Kconfig file Date: Tue, 12 Apr 2022 11:18:41 -0700 Message-Id: <20220412181853.3715080-18-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org As requested in Documentation/process/license-rules.rst, use an SPDX license identifier. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/Kconfig | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 9fe27b01904e..3ebcd5bbc344 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ # # Kernel configuration file for the UFS Host Controller # @@ -7,30 +8,6 @@ # Authors: # Santosh Yaraganavi # Vinayak Holikatti -# -# 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. -# See the COPYING file in the top-level directory or visit -# -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This program is provided "AS IS" and "WITH ALL FAULTS" and -# without warranty of any kind. You are solely responsible for -# determining the appropriateness of using and distributing -# the program and assume all risks associated with your exercise -# of rights with respect to the program, including but not limited -# to infringement of third party rights, the risks and costs of -# program errors, damage to or loss of data, programs or equipment, -# and unavailability or interruption of operations. Under no -# circumstances will the contributor of this Program be liable for -# any damages of any kind arising from your use or distribution of -# this program. config SCSI_UFSHCD tristate "Universal Flash Storage Controller Driver Core" From patchwork Tue Apr 12 18:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DE46C433EF for ; Tue, 12 Apr 2022 18:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352072AbiDLSYd (ORCPT ); Tue, 12 Apr 2022 14:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349095AbiDLSY2 (ORCPT ); Tue, 12 Apr 2022 14:24:28 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 837076007E for ; Tue, 12 Apr 2022 11:22:10 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id c23so17569571plo.0 for ; Tue, 12 Apr 2022 11:22:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=thpfQVR6KxBSZIzdXb09bWsMzxC6P+h3c+aJ+9cCBrA=; b=3Z+Mk0R8hsQKUZJSltHKAy6vRsSQu7uq1MGO/Ni1t4j08AnmQfwUFIzFtabtU2chnC STQE6RN3QzxJfxWTMNeDqVZXswfuN4iX6W7wNpRlAY8mvJEz6yZbbuS2RJL+2YV0jXqF /TDpfy7F8it5/nL1nADFZpMGgJXyyoggLmBDzBWTjY44RlAufLblXkG6DcQo/jG66ozk oa9osBW/URq4kwW+2uacu4C5D1my6FnpOOogxkPpVUIwS3dk9I4CBR5gW8c9IJGoIk9C KW2biqRhaZKBThJtpra4HFjSu4g30F1EbDuswWwsV6RUlefvmPXhSRTy71oltp9uz0sx IuHw== X-Gm-Message-State: AOAM533JJvw3A9JcJtWifzp2D5luuUhRh9QRZvtTWJPrhFyNgzaOYiDm tLl1kC3A2YuOsQcB+lwcXDk= X-Google-Smtp-Source: ABdhPJw4NnGD/J6VZ3eZ9vIom0rBOj6qH+X624/buqtVfw66oNgPe0MVLBpdolIsw/sJt0bfLk3zWw== X-Received: by 2002:a17:902:7445:b0:158:4bda:a594 with SMTP id e5-20020a170902744500b001584bdaa594mr15359961plt.16.1649787729462; Tue, 12 Apr 2022 11:22:09 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:22:08 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Bean Huo , Geert Uytterhoeven , Krzysztof Kozlowski , Daejun Park Subject: [PATCH v2 18/29] scsi: ufs: Remove paths from source code comments Date: Tue, 12 Apr 2022 11:18:42 -0700 Message-Id: <20220412181853.3715080-19-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since specifying the path in a source file is redundant, remove the paths from source code comments. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/Kconfig | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/unipro.h | 2 -- 3 files changed, 4 deletions(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 3ebcd5bbc344..393b9a01da36 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -2,7 +2,6 @@ # # Kernel configuration file for the UFS Host Controller # -# This code is based on drivers/scsi/ufs/Kconfig # Copyright (C) 2011-2013 Samsung India Software Operations # # Authors: diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 81aa14661072..d36873bc44fe 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -2,7 +2,6 @@ /* * Universal Flash Storage Host controller PCI glue driver * - * This code is based on drivers/scsi/ufs/ufshcd-pci.c * Copyright (C) 2011-2013 Samsung India Software Operations * * Authors: diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index 705a6465ba5c..64647aa5c2e0 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * drivers/scsi/ufs/unipro.h - * * Copyright (C) 2013 Samsung Electronics Co., Ltd. */ From patchwork Tue Apr 12 18:18:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00989C433F5 for ; Tue, 12 Apr 2022 18:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358492AbiDLSYz (ORCPT ); Tue, 12 Apr 2022 14:24:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349095AbiDLSYy (ORCPT ); Tue, 12 Apr 2022 14:24:54 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6532F5D64B for ; Tue, 12 Apr 2022 11:22:36 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so3822670pjb.2 for ; Tue, 12 Apr 2022 11:22:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=suepi4ajJAfM8bieNhK4/XUW0mgtvhHSHvhiWsmr9rE=; b=OQrimYZ4wdODK1rU2iWDGH8WFCYjwBTNw1Z4fXdrOlguyDDiH/p68rtS6qq1t5SM1f t2kdxhrUKss3eX9DdndmeYGUnK0t6TzXN2R6XkoRtcQ+MVR34Hs9BsXx25oNv+cl7iF9 7q3Shjk3BBi9AIRP08w4wJ6+BhGQU5AgWnI5MJw4/BVUFvW367AXqDsiV40QsKMX5cph RIyy/e89pUen2JxezHW10rKE+dZ/GzianzaWzhm0ngQuxrjZFH6aZ3qabHgEh/4fdhiV 6/tBifg2dEWJOqgHSRrH0Roph7TiA9MDJe9h7EhvWhRntPSoz8kH+zeCvsSmIfEJv+wW DO2g== X-Gm-Message-State: AOAM533ycoXJtE9tqHwUaMAy1FB2zyZbvZ4+K5F2UpE8Ao6EVzJQlZdu +EsxGPgl+P8Ayo+juVZ+Dtg= X-Google-Smtp-Source: ABdhPJxB2YDqRHlxmoyyNNR2vH5iBDMpiNuMpaq2p7jlrhn29LhcJxaEjbUVQ7LzVCbAMugJj2Bhsw== X-Received: by 2002:a17:902:f708:b0:153:839f:bf2c with SMTP id h8-20020a170902f70800b00153839fbf2cmr39625371plo.113.1649787755498; Tue, 12 Apr 2022 11:22:35 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:22:34 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Matthias Brugger , Stanley Chu , Peter Wang , Bean Huo , Daejun Park Subject: [PATCH v2 20/29] scsi: ufs: Remove locking from around single register writes Date: Tue, 12 Apr 2022 11:18:44 -0700 Message-Id: <20220412181853.3715080-21-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Single register writes are atomic and hence do not need to be surrounded by locking. Additionally, MMIO writes are typically posted asynchronously. Hence, there is no guarantee that these have finished by the time the spin_unlock*() call has finished. See also the nonposted-mmio property of the Open Firmware tree. See also pci_iomap(). Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 8 -------- drivers/scsi/ufs/ufshcd.c | 4 ---- 2 files changed, 12 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 9a4474210627..2b26acc74efb 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -171,7 +171,6 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status) { struct ufs_mtk_host *host = ufshcd_get_variant(hba); - unsigned long flags; if (status == PRE_CHANGE) { if (host->unipro_lpm) { @@ -185,12 +184,8 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, ufs_mtk_crypto_enable(hba); if (host->caps & UFS_MTK_CAP_DISABLE_AH8) { - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, - flags); - hba->capabilities &= ~MASK_AUTO_HIBERN8_SUPPORT; hba->ahit = 0; } @@ -994,13 +989,10 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba) { - unsigned long flags; int ret; /* disable auto-hibern8 */ - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); /* wait host return to idle state when auto-hibern8 off */ ufs_mtk_wait_idle_state(hba, 5); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 37527865e26b..d1c3f6291538 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4207,14 +4207,10 @@ EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update); void ufshcd_auto_hibern8_enable(struct ufs_hba *hba) { - unsigned long flags; - if (!ufshcd_is_auto_hibern8_supported(hba)) return; - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); } /** From patchwork Tue Apr 12 18:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44B4EC433F5 for ; Tue, 12 Apr 2022 18:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiDLSZS (ORCPT ); Tue, 12 Apr 2022 14:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349095AbiDLSZM (ORCPT ); Tue, 12 Apr 2022 14:25:12 -0400 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567D160075 for ; Tue, 12 Apr 2022 11:22:54 -0700 (PDT) Received: by mail-pj1-f48.google.com with SMTP id z6-20020a17090a398600b001cb9fca3210so3912442pjb.1 for ; Tue, 12 Apr 2022 11:22:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J/MJzNqvlCtUnHD68INLBgpjwK6/TYRS8vbqLhrtU/k=; b=VwZGXxJnyeSDBjmEaaDHy8W1tNIEn4zezU2EV1Oco3uBcz2CQeO7pMcNG0spx30K0f Oaf08Wqq78eFaKWIi6wlZFU1OQetE3BZUtz11vp/sm7S2h++mUwsJFLqhq6B+7j8XJs+ 2xoD4v8k+yZTtjlbehS2+sMvgPGNI8P5/K1bsYHpszclJspiPFOGH5Nwy93weXt3meom HvBDMV4ejpOiwLdX/3IY4dyEfWhi7NdVCD56Gslp7fIZ73FZeoDIxzp8WSQJIsKcvT2c IYDIJHU1vmS7m0nW8+AvXc3WPhQ775QddU7kttnUayQVvaMNbgrStW9s6d2hRiip+GhK kSwg== X-Gm-Message-State: AOAM5330HN7yUOychABBAob/RF24v3kDNwuoxQg/vzpqoFe8enQtxj/X A3EMlRAfywpDowaHYFcQR0Y= X-Google-Smtp-Source: ABdhPJxX+hV0ujRkfZ+7FmY558RtCsMEDbBBE42Y2JU63NmFpvG2Aws/SIA8wH1UEQaXGqjJgRs8Vg== X-Received: by 2002:a17:902:9b92:b0:158:57d8:3a20 with SMTP id y18-20020a1709029b9200b0015857d83a20mr4717901plp.34.1649787773731; Tue, 12 Apr 2022 11:22:53 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:22:53 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson , "James E.J. Bottomley" , Avri Altman , Peter Wang , ChanWoo Lee , Ye Bin , Dov Levenglick Subject: [PATCH v2 22/29] scsi: ufs: qcom: Fix ufs_qcom_resume() Date: Tue, 12 Apr 2022 11:18:46 -0700 Message-Id: <20220412181853.3715080-23-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Clearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That variable must only be cleared if all actions involved in a resume succeed. Hence remove the statement that clears hba->is_sys_suspended from ufs_qcom_resume(). Reviewed-by: Bjorn Andersson Fixes: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms") Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index dded29722880..98ed9e9f7e2e 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -640,12 +640,7 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) return err; } - err = ufs_qcom_ice_resume(host); - if (err) - return err; - - hba->is_sys_suspended = false; - return 0; + return ufs_qcom_ice_resume(host); } static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_host *host, bool enable) From patchwork Tue Apr 12 18:18:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E2FFC433F5 for ; Tue, 12 Apr 2022 18:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358690AbiDLSZb (ORCPT ); Tue, 12 Apr 2022 14:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358683AbiDLSZ3 (ORCPT ); Tue, 12 Apr 2022 14:25:29 -0400 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3798960075 for ; Tue, 12 Apr 2022 11:23:11 -0700 (PDT) Received: by mail-pl1-f172.google.com with SMTP id p10so656920plf.9 for ; Tue, 12 Apr 2022 11:23:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EOUmboiNj5HOTm5MUZWIXZufVp76FS1+C1EDHdcAOvQ=; b=ZOz8LI1Dq8Fs3A83a3nbt66IeS+FuKeJXQ96k+dfSuPg223I36yDTTdqwAOkCG/Ncw 3tU8k7rXnIdhuZJJDYEuSALG5+YMjWn4edA6S8IdylCcaxDd1/HY2hBh1Ulmq48CFVkj fZ/pw+b191v942z4BJQ4qRmjTLloCZRHF0gr6zPST1NzU1W11e8Iwbo8PGsRi/25QWzT O0XKc3angNQ0NeiMMO0MTgRQ0RhdeGevtqOk25K6M0VsWk8O4uOhlzE1rMivWbTR6BeJ WxKEQ1vXUcyd94tP1NK+lshhHrlQxujvB34F0itzMO6l09x2CFDO99oxgiX0fZL3wZj5 YTMw== X-Gm-Message-State: AOAM531dxy+pE2mpfFwt7s2rAr9z/P/ROdah3JiI6Xft6ioXRIjMKUGr 15Z9JXZ94j2PJZsQxA3VEJg= X-Google-Smtp-Source: ABdhPJyUlW2RHjfQ/81miWiHMNwfawzNjUbBmbyKuJDuQK13761xDOsPHMQmksFAL91SkoTbNXVGPQ== X-Received: by 2002:a17:902:ba88:b0:158:5849:5a37 with SMTP id k8-20020a170902ba8800b0015858495a37mr12938755pls.133.1649787790574; Tue, 12 Apr 2022 11:23:10 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:23:09 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Bean Huo , Daejun Park Subject: [PATCH v2 24/29] scsi: ufs: Fix kernel-doc syntax in ufshcd.h Date: Tue, 12 Apr 2022 11:18:48 -0700 Message-Id: <20220412181853.3715080-25-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch fixes all the warnings and errors reported by the following command: scripts/kernel-doc -none drivers/scsi/ufs/ufshcd.h Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.h | 89 ++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 3eb5d2c17e39..412fe43cd763 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -236,6 +236,7 @@ struct ufs_query { * @type: device management command type - Query, NOP OUT * @lock: lock to allow one command at a time * @complete: internal commands completion + * @query: Device management query information */ struct ufs_dev_cmd { enum dev_cmd_type type; @@ -253,7 +254,7 @@ struct ufs_dev_cmd { * @min_freq: min frequency that can be used for clock scaling * @curr_freq: indicates the current frequency that it is set to * @keep_link_active: indicates that the clk should not be disabled if - link is active + * link is active * @enabled: variable to check against multiple enable/disable */ struct ufs_clk_info { @@ -308,11 +309,13 @@ struct ufs_pwr_mode_info { * to set some things * @hibern8_notify: called around hibern8 enter/exit * @apply_dev_quirks: called to apply device specific quirks + * @fixup_dev_quirks: called to modify device specific quirks * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device + * @config_scaling_param: called to configure clock scaling parameters * @program_key: program or evict an inline encryption key * @event_notify: called to notify important events */ @@ -379,6 +382,7 @@ enum clk_gating_state { * @is_initialized: Indicates whether clock gating is initialized or not * @active_reqs: number of requests that are pending and should be waited for * completion before gating clocks. + * @clk_gating_workq: workqueue for clock gating work. */ struct ufs_clk_gating { struct delayed_work gate_work; @@ -415,9 +419,9 @@ struct ufs_saved_pwr_info { * @resume_work: worker to resume devfreq * @min_gear: lowest HS gear to scale down to * @is_enabled: tracks if scaling is currently enabled or not, controlled by - clkscale_enable sysfs node + * clkscale_enable sysfs node * @is_allowed: tracks if scaling is currently allowed or not, used to block - clock scaling which is not invoked from devfreq governor + * clock scaling which is not invoked from devfreq governor * @is_initialized: Indicates whether clock scaling is initialized or not * @is_busy_started: tracks if busy period has started or not * @is_suspended: tracks if devfreq is suspended or not @@ -444,7 +448,7 @@ struct ufs_clk_scaling { /** * struct ufs_event_hist - keeps history of errors * @pos: index to indicate cyclic buffer position - * @reg: cyclic buffer for registers value + * @val: cyclic buffer for registers value * @tstamp: cyclic buffer for time stamp * @cnt: error counter */ @@ -463,6 +467,7 @@ struct ufs_event_hist { * reset this after link-startup. * @last_hibern8_exit_tstamp: Set time after the hibern8 exit. * Clear after the first successful command completion. + * @event: array with event history. */ struct ufs_stats { u32 last_intr_status; @@ -733,6 +738,13 @@ struct ufs_hba_monitor { * @host: Scsi_Host instance of the driver * @dev: device handle * @ufs_device_wlun: WLUN that controls the entire UFS device. + * @hwmon_device: device instance registered with the hwmon core. + * @curr_dev_pwr_mode: active UFS device power mode. + * @uic_link_state: active state of the link to the UFS device. + * @rpm_lvl: desired UFS power management level during runtime PM. + * @spm_lvl: desired UFS power management level during system PM. + * @pm_op_in_progress: whether or not a PM operation is in progress. + * @ahit: value of Auto-Hibernate Idle Timer register. * @lrb: local reference block * @outstanding_tasks: Bits representing outstanding task requests * @outstanding_lock: Protects @outstanding_reqs. @@ -743,17 +755,26 @@ struct ufs_hba_monitor { * @reserved_slot: Used to submit device commands. Protected by @dev_cmd.lock. * @ufs_version: UFS Version to which controller complies * @vops: pointer to variant specific operations + * @vps: pointer to variant specific parameters * @priv: pointer to variant specific private data * @irq: Irq number of the controller - * @active_uic_cmd: handle of active UIC command - * @uic_cmd_mutex: mutex for UIC command + * @is_irq_enabled: whether or not the UFS controller interrupt is enabled. + * @dev_ref_clk_freq: reference clock frequency + * @quirks: bitmask with information about deviations from the UFSHCI standard. + * @dev_quirks: bitmask with information about deviations from the UFS standard. * @tmf_tag_set: TMF tag set. * @tmf_queue: Used to allocate TMF tags. - * @pwr_done: completion for power mode change + * @tmf_rqs: array with pointers to TMF requests while these are in progress. + * @active_uic_cmd: handle of active UIC command + * @uic_cmd_mutex: mutex for UIC command + * @uic_async_done: completion used during UIC processing * @ufshcd_state: UFSHCD state * @eh_flags: Error handling flags * @intr_mask: Interrupt Mask Bits * @ee_ctrl_mask: Exception event control mask + * @ee_drv_mask: Exception event mask for driver + * @ee_usr_mask: Exception event mask for user (set via debugfs) + * @ee_ctrl_mutex: Used to serialize exception event information. * @is_powered: flag to check if HBA is powered * @shutting_down: flag to check if shutdown has been invoked * @host_sem: semaphore used to serialize concurrent contexts @@ -764,26 +785,52 @@ struct ufs_hba_monitor { * @uic_error: UFS interconnect layer error status * @saved_err: sticky error mask * @saved_uic_err: sticky UIC error mask + * @ufs_stats: various error counters * @force_reset: flag to force eh_work perform a full reset * @force_pmc: flag to force a power mode change * @silence_err_logs: flag to silence error logs * @dev_cmd: ufs device management command information * @last_dme_cmd_tstamp: time stamp of the last completed DME command + * @nop_out_timeout: NOP OUT timeout value + * @dev_info: information about the UFS device * @auto_bkops_enabled: to track whether bkops is enabled in device * @vreg_info: UFS device voltage regulator information * @clk_list_head: UFS host controller clocks list node head + * @req_abort_count: number of times ufshcd_abort() has been called + * @lanes_per_direction: number of lanes per data direction between the UFS + * controller and the UFS device. * @pwr_info: holds current power mode * @max_pwr_info: keeps the device max valid pwm - * @clk_scaling_lock: used to serialize device commands and clock scaling - * @desc_size: descriptor sizes reported by device + * @clk_gating: information related to clock gating + * @caps: bitmask with information about UFS controller capabilities + * @devfreq: frequency scaling information owned by the devfreq core + * @clk_scaling: frequency scaling information owned by the UFS driver + * @is_sys_suspended: whether or not the entire system has been suspended * @urgent_bkops_lvl: keeps track of urgent bkops level for device * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for * device is known or not. + * @clk_scaling_lock: used to serialize device commands and clock scaling + * @desc_size: descriptor sizes reported by device * @scsi_block_reqs_cnt: reference counting for scsi block requests + * @bsg_dev: struct device associated with the BSG queue + * @bsg_queue: BSG queue associated with the UFS controller + * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power + * management) after the UFS device has finished a WriteBooster buffer + * flush or auto BKOP. + * @ufshpb_dev: information related to HPB (Host Performance Booster). + * @monitor: statistics about UFS commands * @crypto_capabilities: Content of crypto capabilities register (0x100) * @crypto_cap_array: Array of crypto capabilities * @crypto_cfg_register: Start of the crypto cfg array * @crypto_profile: the crypto profile of this hba (if applicable) + * @debugfs_root: UFS controller debugfs root directory + * @debugfs_ee_work: used to restore ee_ctrl_mask after a delay + * @debugfs_ee_rate_limit_ms: user configurable delay after which to restore + * ee_ctrl_mask + * @luns_avail: number of regular and well known LUNs supported by the UFS + * device + * @complete_put: whether or not to call ufshcd_rpm_put() from inside + * ufshcd_resume_complete() */ struct ufs_hba { void __iomem *mmio_base; @@ -853,9 +900,9 @@ struct ufs_hba { enum ufshcd_state ufshcd_state; u32 eh_flags; u32 intr_mask; - u16 ee_ctrl_mask; /* Exception event mask */ - u16 ee_drv_mask; /* Exception event mask for driver */ - u16 ee_usr_mask; /* Exception event mask for user (via debugfs) */ + u16 ee_ctrl_mask; + u16 ee_drv_mask; + u16 ee_usr_mask; struct mutex ee_ctrl_mutex; bool is_powered; bool shutting_down; @@ -996,11 +1043,11 @@ static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) readl((hba)->mmio_base + (reg)) /** - * ufshcd_rmwl - read modify write into a register - * @hba - per adapter instance - * @mask - mask to apply on read value - * @val - actual value to write - * @reg - register address + * ufshcd_rmwl - perform read/modify/write for a controller register + * @hba: per adapter instance + * @mask: mask to apply on read value + * @val: actual value to write + * @reg: register address */ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) { @@ -1035,8 +1082,8 @@ static inline void check_upiu_size(void) /** * ufshcd_set_variant - set variant specific data to the hba - * @hba - per adapter instance - * @variant - pointer to variant specific data + * @hba: per adapter instance + * @variant: pointer to variant specific data */ static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) { @@ -1046,7 +1093,7 @@ static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) /** * ufshcd_get_variant - get variant specific data from the hba - * @hba - per adapter instance + * @hba: per adapter instance */ static inline void *ufshcd_get_variant(struct ufs_hba *hba) { @@ -1367,7 +1414,7 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; -/* +/** * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN * @scsi_lun: scsi LUN id * From patchwork Tue Apr 12 18:18:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E50BBC433F5 for ; Tue, 12 Apr 2022 18:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiDLS1l (ORCPT ); Tue, 12 Apr 2022 14:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358742AbiDLS1i (ORCPT ); Tue, 12 Apr 2022 14:27:38 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC02827B09 for ; Tue, 12 Apr 2022 11:25:19 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id s14so7928100plk.8 for ; Tue, 12 Apr 2022 11:25:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fOU1/Pepe52OePCJAW6Boa1hD1Yk4gdg7f3FgGlBhdo=; b=r56/csFJ7Qo9xr+BnPR6lFQ2+vQSFRw2zVB43lCp95/Ab57Py0FmkjY2aTmZRF4p0v MVhJW54hSwun+7kJ4FzxCDaTK2/IGY8NND04FfGq2E0LqeyFnsdAfbXAiZmQXbCBh/vG rn7nStFr2hXx7I5ihkTGvLXb5X5iW6PbC4fbzFNcTUR6Cjj0wab1yyfQzvCAXtso0aKD ZT+isUWeoCHGP7s+bjxJqdLDFOcY4hZ0UiVnFqNIDumqHKhqN6RaidcuqIFvDsPiaJzX rtKhr4yCIwrd7szUsWt/T5Uj0sPaHB4PQ9LvaCAqeTbiVisKscvqT2X0lUj8Oxw3sTj5 pXYQ== X-Gm-Message-State: AOAM530eTgE2gthnI69Dib5ScbJ9g2m8l53zj0Vvz1ACtNWzgc/VgO6I K3wnC8k4t0tmnXhloBHevoU= X-Google-Smtp-Source: ABdhPJyzNIjlel/IoZkzxhv0Z3d9ITFnOHZWVH2PXL4myh1aXGIflOj15IbhZkmn0ulGSYNiEfJ4BQ== X-Received: by 2002:a17:90a:4890:b0:1bf:654e:e1a0 with SMTP id b16-20020a17090a489000b001bf654ee1a0mr6486889pjh.113.1649787919228; Tue, 12 Apr 2022 11:25:19 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:25:18 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Avri Altman , Guenter Roeck , Bean Huo , Daejun Park , Keoseong Park , Ulf Hansson , Eric Biggers , Jens Axboe Subject: [PATCH v2 26/29] scsi: ufs: Split the ufshcd.h header file Date: Tue, 12 Apr 2022 11:18:50 -0700 Message-Id: <20220412181853.3715080-27-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Split the ufshcd.h header file into a header file that defines the interface used by UFS drivers and another header file with declarations and data structures only used by the UFS core. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-debugfs.c | 1 + drivers/scsi/ufs/ufs-hwmon.c | 1 + drivers/scsi/ufs/ufs-sysfs.c | 2 +- drivers/scsi/ufs/ufs_bsg.c | 1 + drivers/scsi/ufs/ufshcd-crypto.h | 2 + drivers/scsi/ufs/ufshcd-priv.h | 279 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 222 ------------------------ drivers/scsi/ufs/ufshpb.c | 2 +- 9 files changed, 287 insertions(+), 225 deletions(-) create mode 100644 drivers/scsi/ufs/ufshcd-priv.h diff --git a/drivers/scsi/ufs/ufs-debugfs.c b/drivers/scsi/ufs/ufs-debugfs.c index 4a0bbcf1757a..c10a8f09682b 100644 --- a/drivers/scsi/ufs/ufs-debugfs.c +++ b/drivers/scsi/ufs/ufs-debugfs.c @@ -5,6 +5,7 @@ #include "ufs-debugfs.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static struct dentry *ufs_debugfs_root; diff --git a/drivers/scsi/ufs/ufs-hwmon.c b/drivers/scsi/ufs/ufs-hwmon.c index 74855491dc8f..c38d9d98a86d 100644 --- a/drivers/scsi/ufs/ufs-hwmon.c +++ b/drivers/scsi/ufs/ufs-hwmon.c @@ -8,6 +8,7 @@ #include #include "ufshcd.h" +#include "ufshcd-priv.h" struct ufs_hwmon_data { struct ufs_hba *hba; diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 95a4e64ce401..8a3c6442f291 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -8,7 +8,7 @@ #include "ufs.h" #include "ufs-sysfs.h" -#include "ufshcd.h" +#include "ufshcd-priv.h" static const char *ufshcd_uic_link_state_to_string( enum uic_link_state state) diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index fbcdfb713542..9e9b93867cab 100644 --- a/drivers/scsi/ufs/ufs_bsg.c +++ b/drivers/scsi/ufs/ufs_bsg.c @@ -10,6 +10,7 @@ #include #include "ufs_bsg.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len, struct utp_upiu_query *qr) diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h index 57dd51256b57..9f98f18f9646 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.h +++ b/drivers/scsi/ufs/ufshcd-crypto.h @@ -8,6 +8,8 @@ #include #include "ufshcd.h" +#include "ufshcd-priv.h" +#include "ufshci.h" #ifdef CONFIG_SCSI_UFS_CRYPTO diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h new file mode 100644 index 000000000000..3fa8ab94e4e1 --- /dev/null +++ b/drivers/scsi/ufs/ufshcd-priv.h @@ -0,0 +1,279 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _UFSHCD_PRIV_H_ +#define _UFSHCD_PRIV_H_ + +#include +#include "ufshcd.h" + +static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) +{ + return !hba->shutting_down; +} + +void ufshcd_schedule_eh_work(struct ufs_hba *hba); + +static inline bool ufshcd_keep_autobkops_enabled_except_suspend( + struct ufs_hba *hba) +{ + return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; +} + +static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) +{ + if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) + return hba->dev_info.wb_dedicated_lu; + return 0; +} + +#ifdef CONFIG_SCSI_UFS_HWMON +void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask); +void ufs_hwmon_remove(struct ufs_hba *hba); +void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask); +#else +static inline void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask) {} +static inline void ufs_hwmon_remove(struct ufs_hba *hba) {} +static inline void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask) {} +#endif + +int ufshcd_read_desc_param(struct ufs_hba *hba, + enum desc_idn desc_id, + int desc_index, + u8 param_offset, + u8 *param_read_buf, + u8 param_size); +int ufshcd_query_attr_retry(struct ufs_hba *hba, enum query_opcode opcode, + enum attr_idn idn, u8 index, u8 selector, + u32 *attr_val); +int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode, + enum attr_idn idn, u8 index, u8 selector, u32 *attr_val); +int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, + enum flag_idn idn, u8 index, bool *flag_res); +void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); + +#define SD_ASCII_STD true +#define SD_RAW false +int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, + u8 **buf, bool ascii); + +int ufshcd_hold(struct ufs_hba *hba, bool async); +void ufshcd_release(struct ufs_hba *hba); + +void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, + int *desc_length); + +int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); + +int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, + struct utp_upiu_req *req_upiu, + struct utp_upiu_req *rsp_upiu, + int msgcode, + u8 *desc_buff, int *buff_len, + enum query_opcode desc_op); + +int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable); + +/* Wrapper functions for safely calling variant operations */ +static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) +{ + if (hba->vops) + return hba->vops->name; + return ""; +} + +static inline void ufshcd_vops_exit(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->exit) + return hba->vops->exit(hba); +} + +static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->get_ufs_hci_version) + return hba->vops->get_ufs_hci_version(hba); + + return ufshcd_readl(hba, REG_UFS_VERSION); +} + +static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, + bool up, enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->clk_scale_notify) + return hba->vops->clk_scale_notify(hba, up, status); + return 0; +} + +static inline void ufshcd_vops_event_notify(struct ufs_hba *hba, + enum ufs_event_type evt, + void *data) +{ + if (hba->vops && hba->vops->event_notify) + hba->vops->event_notify(hba, evt, data); +} + +static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->setup_clocks) + return hba->vops->setup_clocks(hba, on, status); + return 0; +} + +static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba, + bool status) +{ + if (hba->vops && hba->vops->hce_enable_notify) + return hba->vops->hce_enable_notify(hba, status); + + return 0; +} +static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba, + bool status) +{ + if (hba->vops && hba->vops->link_startup_notify) + return hba->vops->link_startup_notify(hba, status); + + return 0; +} + +static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, + enum ufs_notify_change_status status, + struct ufs_pa_layer_attr *dev_max_params, + struct ufs_pa_layer_attr *dev_req_params) +{ + if (hba->vops && hba->vops->pwr_change_notify) + return hba->vops->pwr_change_notify(hba, status, + dev_max_params, dev_req_params); + + return -ENOTSUPP; +} + +static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, + int tag, u8 tm_function) +{ + if (hba->vops && hba->vops->setup_task_mgmt) + return hba->vops->setup_task_mgmt(hba, tag, tm_function); +} + +static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba, + enum uic_cmd_dme cmd, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->hibern8_notify) + return hba->vops->hibern8_notify(hba, cmd, status); +} + +static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->apply_dev_quirks) + return hba->vops->apply_dev_quirks(hba); + return 0; +} + +static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->fixup_dev_quirks) + hba->vops->fixup_dev_quirks(hba); +} + +static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->suspend) + return hba->vops->suspend(hba, op, status); + + return 0; +} + +static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op) +{ + if (hba->vops && hba->vops->resume) + return hba->vops->resume(hba, op); + + return 0; +} + +static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->dbg_register_dump) + hba->vops->dbg_register_dump(hba); +} + +static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->device_reset) + return hba->vops->device_reset(hba); + + return -EOPNOTSUPP; +} + +static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, + struct devfreq_dev_profile *p, + struct devfreq_simple_ondemand_data *data) +{ + if (hba->vops && hba->vops->config_scaling_param) + hba->vops->config_scaling_param(hba, p, data); +} + +extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; + +/** + * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN + * @scsi_lun: scsi LUN id + * + * Returns UPIU LUN id + */ +static inline u8 ufshcd_scsi_to_upiu_lun(unsigned int scsi_lun) +{ + if (scsi_is_wlun(scsi_lun)) + return (scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID) + | UFS_UPIU_WLUN_ID; + else + return scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID; +} + +int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask); +int ufshcd_write_ee_control(struct ufs_hba *hba); +int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask, u16 *other_mask, + u16 set, u16 clr); + +static inline int ufshcd_update_ee_drv_mask(struct ufs_hba *hba, + u16 set, u16 clr) +{ + return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, + &hba->ee_usr_mask, set, clr); +} + +static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba, + u16 set, u16 clr) +{ + return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, + &hba->ee_drv_mask, set, clr); +} + +static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) +{ + return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) +{ + return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba) +{ + pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_resume(struct ufs_hba *hba) +{ + return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_put(struct ufs_hba *hba) +{ + return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); +} + +#endif /* _UFSHCD_PRIV_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5308f43bda6e..da8beed2767c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -26,7 +26,7 @@ #include #include #include -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufs_quirks.h" #include "unipro.h" #include "ufs-sysfs.h" diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index ab0c643296c0..16f69ab1b309 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1007,11 +1007,6 @@ static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) return hba->caps & UFSHCD_CAP_WB_EN; } -static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) -{ - return !hba->shutting_down; -} - #define ufshcd_writel(hba, val, reg) \ writel((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \ @@ -1075,28 +1070,6 @@ static inline void *ufshcd_get_variant(struct ufs_hba *hba) BUG_ON(!hba); return hba->priv; } -static inline bool ufshcd_keep_autobkops_enabled_except_suspend( - struct ufs_hba *hba) -{ - return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; -} - -static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) -{ - if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) - return hba->dev_info.wb_dedicated_lu; - return 0; -} - -#ifdef CONFIG_SCSI_UFS_HWMON -void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask); -void ufs_hwmon_remove(struct ufs_hba *hba); -void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask); -#else -static inline void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask) {} -static inline void ufs_hwmon_remove(struct ufs_hba *hba) {} -static inline void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask) {} -#endif #ifdef CONFIG_PM extern int ufshcd_runtime_suspend(struct device *dev); @@ -1230,13 +1203,6 @@ int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm); void ufshcd_resume_complete(struct device *dev); /* Wrapper functions for safely calling variant operations */ -static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) -{ - if (hba->vops) - return hba->vops->name; - return ""; -} - static inline int ufshcd_vops_init(struct ufs_hba *hba) { if (hba->vops && hba->vops->init) @@ -1245,61 +1211,6 @@ static inline int ufshcd_vops_init(struct ufs_hba *hba) return 0; } -static inline void ufshcd_vops_exit(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->exit) - return hba->vops->exit(hba); -} - -static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->get_ufs_hci_version) - return hba->vops->get_ufs_hci_version(hba); - - return ufshcd_readl(hba, REG_UFS_VERSION); -} - -static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, - bool up, enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->clk_scale_notify) - return hba->vops->clk_scale_notify(hba, up, status); - return 0; -} - -static inline void ufshcd_vops_event_notify(struct ufs_hba *hba, - enum ufs_event_type evt, - void *data) -{ - if (hba->vops && hba->vops->event_notify) - hba->vops->event_notify(hba, evt, data); -} - -static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->setup_clocks) - return hba->vops->setup_clocks(hba, on, status); - return 0; -} - -static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba, - bool status) -{ - if (hba->vops && hba->vops->hce_enable_notify) - return hba->vops->hce_enable_notify(hba, status); - - return 0; -} -static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba, - bool status) -{ - if (hba->vops && hba->vops->link_startup_notify) - return hba->vops->link_startup_notify(hba, status); - - return 0; -} - static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) { if (hba->vops && hba->vops->phy_initialization) @@ -1308,102 +1219,8 @@ static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) return 0; } -static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, - enum ufs_notify_change_status status, - struct ufs_pa_layer_attr *dev_max_params, - struct ufs_pa_layer_attr *dev_req_params) -{ - if (hba->vops && hba->vops->pwr_change_notify) - return hba->vops->pwr_change_notify(hba, status, - dev_max_params, dev_req_params); - - return -ENOTSUPP; -} - -static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, - int tag, u8 tm_function) -{ - if (hba->vops && hba->vops->setup_task_mgmt) - return hba->vops->setup_task_mgmt(hba, tag, tm_function); -} - -static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba, - enum uic_cmd_dme cmd, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->hibern8_notify) - return hba->vops->hibern8_notify(hba, cmd, status); -} - -static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->apply_dev_quirks) - return hba->vops->apply_dev_quirks(hba); - return 0; -} - -static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->fixup_dev_quirks) - hba->vops->fixup_dev_quirks(hba); -} - -static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->suspend) - return hba->vops->suspend(hba, op, status); - - return 0; -} - -static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op) -{ - if (hba->vops && hba->vops->resume) - return hba->vops->resume(hba, op); - - return 0; -} - -static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->dbg_register_dump) - hba->vops->dbg_register_dump(hba); -} - -static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->device_reset) - return hba->vops->device_reset(hba); - - return -EOPNOTSUPP; -} - -static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, - struct devfreq_dev_profile *p, - struct devfreq_simple_ondemand_data *data) -{ - if (hba->vops && hba->vops->config_scaling_param) - hba->vops->config_scaling_param(hba, p, data); -} - extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; -/** - * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN - * @scsi_lun: scsi LUN id - * - * Returns UPIU LUN id - */ -static inline u8 ufshcd_scsi_to_upiu_lun(unsigned int scsi_lun) -{ - if (scsi_is_wlun(scsi_lun)) - return (scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID) - | UFS_UPIU_WLUN_ID; - else - return scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID; -} - int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, const char *prefix); @@ -1412,43 +1229,4 @@ int ufshcd_write_ee_control(struct ufs_hba *hba); int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask, u16 *other_mask, u16 set, u16 clr); -static inline int ufshcd_update_ee_drv_mask(struct ufs_hba *hba, - u16 set, u16 clr) -{ - return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, - &hba->ee_usr_mask, set, clr); -} - -static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba, - u16 set, u16 clr) -{ - return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, - &hba->ee_drv_mask, set, clr); -} - -static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) -{ - return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) -{ - return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba) -{ - pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_resume(struct ufs_hba *hba) -{ - return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_put(struct ufs_hba *hba) -{ - return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); -} - #endif /* End of Header */ diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 5a974642779f..5fae0861b488 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -15,7 +15,7 @@ #include #include -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufshpb.h" #include "../sd.h" From patchwork Tue Apr 12 18:18:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E42DFC433EF for ; Tue, 12 Apr 2022 18:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354301AbiDLS17 (ORCPT ); Tue, 12 Apr 2022 14:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233150AbiDLS16 (ORCPT ); Tue, 12 Apr 2022 14:27:58 -0400 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 297CD4E3BC for ; Tue, 12 Apr 2022 11:25:40 -0700 (PDT) Received: by mail-pj1-f42.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so3813546pjn.3 for ; Tue, 12 Apr 2022 11:25:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wL8r/dkKyV4Y/mikFzmlbqWC8R98dUB/Oz42MtzPdL4=; b=IP1xcWq2Kl0swYTPIcO/6CHDbE3dd3UJcG6ZiXtJC4YMaQ3De6UDVzhg1TMrPlFjkc iGZgCJISPVR2zi/82gcxeoURnjSIG2qse9LZ3ccInHVcFalwUtScCicLmsmTmDS51MAR /P7Aw16QmfLmXwCbR+TVhB4lO0b4mmQeL0C0RZ7dYjmgbhLP9ZbO98Nn3r/Fv8/W2eRN 5ovQyb1nl4U9uFQZTIIO6U7832Xki2QURT22qmfaQwBPECo0LQ3lJQC9el+QYuUdNqDh TSSbHyfL8XkZ5KMCO0kdRpIbphA8DWqiUbhBDNyrnFkXc6DEpnno2uKpOzL7Qn9iYTyc ADJg== X-Gm-Message-State: AOAM530vqxsIlcihkAIKvhA3m52NjlEwe85j8ZlfbULuynsoVM/dlSeh Z6V9zpqusZCof2I/xeB2mnQ= X-Google-Smtp-Source: ABdhPJzHccBYK1T3VPziciNPFtBkDaQaJLb5C/l/2TOQtF7APbwP4fKZWiwFOENtaYVBIMidobnHPw== X-Received: by 2002:a17:903:2406:b0:158:72dc:2d73 with SMTP id e6-20020a170903240600b0015872dc2d73mr9023896plo.46.1649787939610; Tue, 12 Apr 2022 11:25:39 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm40367037pfu.76.2022.04.12.11.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:25:39 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Avri Altman , Daejun Park , Bean Huo , Jinyoung Choi Subject: [PATCH v2 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition Date: Tue, 12 Apr 2022 11:18:52 -0700 Message-Id: <20220412181853.3715080-29-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the definition of this function from a public into a private header file since it is only used inside the UFS core. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs.h | 19 ------------------- drivers/scsi/ufs/ufshcd-priv.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index f52173b8ad96..1bba3fead2ce 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -620,23 +620,4 @@ enum ufs_trace_tsf_t { UFS_TSF_CDB, UFS_TSF_OSF, UFS_TSF_TM_INPUT, UFS_TSF_TM_OUTPUT }; -/** - * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor - * @dev_info: pointer of instance of struct ufs_dev_info - * @lun: LU number to check - * @return: true if the lun has a matching unit descriptor, false otherwise - */ -static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, - u8 lun, u8 param_offset) -{ - if (!dev_info || !dev_info->max_lu_supported) { - pr_err("Max General LU supported by UFS isn't initialized\n"); - return false; - } - /* WB is available only for the logical unit from 0 to 7 */ - if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS) - return lun < UFS_UPIU_MAX_WB_LUN_ID; - return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); -} - #endif /* End of Header */ diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h index 3fa8ab94e4e1..38bc77d3dbbd 100644 --- a/drivers/scsi/ufs/ufshcd-priv.h +++ b/drivers/scsi/ufs/ufshcd-priv.h @@ -276,4 +276,23 @@ static inline int ufshcd_rpm_put(struct ufs_hba *hba) return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); } +/** + * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor + * @dev_info: pointer of instance of struct ufs_dev_info + * @lun: LU number to check + * @return: true if the lun has a matching unit descriptor, false otherwise + */ +static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, + u8 lun, u8 param_offset) +{ + if (!dev_info || !dev_info->max_lu_supported) { + pr_err("Max General LU supported by UFS isn't initialized\n"); + return false; + } + /* WB is available only for the logical unit from 0 to 7 */ + if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS) + return lun < UFS_UPIU_MAX_WB_LUN_ID; + return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); +} + #endif /* _UFSHCD_PRIV_H_ */ From patchwork Tue Apr 12 18:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB5C3C433F5 for ; Tue, 12 Apr 2022 18:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244045AbiDLSe4 (ORCPT ); Tue, 12 Apr 2022 14:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbiDLSey (ORCPT ); Tue, 12 Apr 2022 14:34:54 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E7B4EDF5 for ; Tue, 12 Apr 2022 11:32:35 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id q19so18011181pgm.6 for ; Tue, 12 Apr 2022 11:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cP5Vg5bgJ3/TD/53bijOMzVhUUEpAaK5FlL2Lu02NaM=; b=4GJ4356cVerD4YWGG1gDAnRcFBTWGEKq2aPl+Jil4mkS5UZtQ4l+8VYes1eBhWuQxC 6eESMkjuTgPyI4Fed82KsQxtdrFnp28ff5BO96nlshIVTL7Oa3IX1eGO02x1DTvvjpqK lYYfVwonMhtyU38/FxB2/AKf6HK5dbQhAguMuEypFAW1tSdPqVGHLVL9EKDAJZMjCVgG 3XidzbGaPfVbFkn3kSo2UY9ryhaDmjMXmfj8PLIcrUE17ZjtBXwUIm32IHQSux6Sv0h0 AvNzV/0uFz1+ZbyAE8Vs16bbRJjHFp2/1xMs7GYOARCLQeVP4Q2QEfaqJOvBiRk0VzI8 ZdoQ== X-Gm-Message-State: AOAM532bgSRaKTVRWXKz9SdoxDPV9MfIm46gW1rqhxkqF4Tvzi+A+SHq 4FzuaKzlDpMFqi7d6j5DLqY= X-Google-Smtp-Source: ABdhPJwG9URkFnyiK7VrlYrYHWEQveiYU0qtfLDp0guvd6YoJ1F6KexByUb38Caz+VqsHHEJTy888Q== X-Received: by 2002:a63:5907:0:b0:382:2f93:5467 with SMTP id n7-20020a635907000000b003822f935467mr31308583pgb.460.1649788354219; Tue, 12 Apr 2022 11:32:34 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:d4b2:56ee:d001:c159]) by smtp.gmail.com with ESMTPSA id s14-20020a63dc0e000000b0039cc76bda79sm3539523pgg.40.2022.04.12.11.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 11:32:33 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche Subject: [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory Date: Tue, 12 Apr 2022 11:32:28 -0700 Message-Id: <20220412183228.3729720-1-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org> References: <20220412181853.3715080-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Split the drivers/scsi/ufs directory into a ufs-core and a ufs-drivers directory. Move shared header files into the include/scsi directory. This separation makes it clear which header files UFS drivers are allowed to include (include/scsi/*.h) and which header files UFS drivers are not allowed to include (drivers/scsi/ufs-core/*.h). Update the MAINTAINERS file. Add myself as a UFS reviewer. Signed-off-by: Bart Van Assche --- MAINTAINERS | 9 ++- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/scsi/Kconfig | 1 - drivers/scsi/Makefile | 1 - drivers/ufs/Kconfig | 30 ++++++++ drivers/ufs/Makefile | 5 ++ drivers/ufs/core/Kconfig | 60 +++++++++++++++ drivers/ufs/core/Makefile | 10 +++ drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c | 2 +- drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h | 0 .../ufs => ufs/core}/ufs-fault-injection.c | 0 .../ufs => ufs/core}/ufs-fault-injection.h | 0 drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c | 2 +- drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c | 2 +- drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h | 0 drivers/{scsi/ufs => ufs/core}/ufs_bsg.c | 2 +- drivers/{scsi/ufs => ufs/core}/ufs_bsg.h | 0 .../{scsi/ufs => ufs/core}/ufshcd-crypto.c | 2 +- .../{scsi/ufs => ufs/core}/ufshcd-crypto.h | 4 +- drivers/{scsi/ufs => ufs/core}/ufshcd-priv.h | 2 +- drivers/{scsi/ufs => ufs/core}/ufshcd.c | 4 +- drivers/{scsi/ufs => ufs/core}/ufshpb.c | 2 +- drivers/{scsi/ufs => ufs/core}/ufshpb.h | 0 drivers/{scsi/ufs => ufs/host}/Kconfig | 75 +------------------ drivers/{scsi/ufs => ufs/host}/Makefile | 12 --- drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c | 0 .../{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c | 2 +- .../ufs => ufs/host}/tc-dwc-g210-pltfrm.c | 0 drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c | 4 +- drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h | 0 drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c | 0 drivers/{scsi/ufs => ufs/host}/ufs-exynos.c | 6 +- drivers/{scsi/ufs => ufs/host}/ufs-exynos.h | 0 drivers/{scsi/ufs => ufs/host}/ufs-hisi.c | 8 +- drivers/{scsi/ufs => ufs/host}/ufs-hisi.h | 0 .../ufs => ufs/host}/ufs-mediatek-trace.h | 2 +- drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c | 6 +- drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h | 0 drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c | 0 drivers/{scsi/ufs => ufs/host}/ufs-qcom.c | 8 +- drivers/{scsi/ufs => ufs/host}/ufs-qcom.h | 2 +- drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c | 4 +- drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h | 2 +- drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c | 2 +- .../{scsi/ufs => ufs/host}/ufshcd-pltfrm.c | 4 +- .../{scsi/ufs => ufs/host}/ufshcd-pltfrm.h | 2 +- drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h | 0 {drivers/scsi/ufs => include/scsi}/ufs.h | 0 .../scsi/ufs => include/scsi}/ufs_quirks.h | 0 {drivers/scsi/ufs => include/scsi}/ufshcd.h | 8 +- {drivers/scsi/ufs => include/scsi}/ufshci.h | 0 {drivers/scsi/ufs => include/scsi}/unipro.h | 0 53 files changed, 155 insertions(+), 133 deletions(-) create mode 100644 drivers/ufs/Kconfig create mode 100644 drivers/ufs/Makefile create mode 100644 drivers/ufs/core/Kconfig create mode 100644 drivers/ufs/core/Makefile rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h (100%) rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.c (100%) rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.h (100%) rename drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h (100%) rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.h (100%) rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.h (97%) rename drivers/{scsi/ufs => ufs/core}/ufshcd-priv.h (99%) rename drivers/{scsi/ufs => ufs/core}/ufshcd.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufshpb.c (99%) rename drivers/{scsi/ufs => ufs/core}/ufshpb.h (100%) rename drivers/{scsi/ufs => ufs/host}/Kconfig (56%) rename drivers/{scsi/ufs => ufs/host}/Makefile (56%) rename drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c (100%) rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c (99%) rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pltfrm.c (100%) rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c (99%) rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h (100%) rename drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c (100%) rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.h (100%) rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.h (100%) rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek-trace.h (93%) rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h (100%) rename drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c (100%) rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.h (99%) rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c (98%) rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h (95%) rename drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.c (99%) rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.h (98%) rename drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h (100%) rename {drivers/scsi/ufs => include/scsi}/ufs.h (100%) rename {drivers/scsi/ufs => include/scsi}/ufs_quirks.h (100%) rename {drivers/scsi/ufs => include/scsi}/ufshcd.h (99%) rename {drivers/scsi/ufs => include/scsi}/ufshci.h (100%) rename {drivers/scsi/ufs => include/scsi}/unipro.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index fd768d43e048..8da66d6b1470 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2547,7 +2547,7 @@ F: drivers/pci/controller/dwc/pcie-qcom.c F: drivers/phy/qualcomm/ F: drivers/power/*/msm* F: drivers/reset/reset-qcom-* -F: drivers/scsi/ufs/ufs-qcom* +F: drivers/ufs/host/ufs-qcom* F: drivers/spi/spi-geni-qcom.c F: drivers/spi/spi-qcom-qspi.c F: drivers/spi/spi-qup.c @@ -20198,24 +20198,25 @@ F: include/linux/visorbus.h UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER R: Alim Akhtar R: Avri Altman +R: Bart Van Assche L: linux-scsi@vger.kernel.org S: Supported F: Documentation/devicetree/bindings/ufs/ F: Documentation/scsi/ufs.rst -F: drivers/scsi/ufs/ +F: drivers/ufs/core/ UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS M: Pedro Sousa L: linux-scsi@vger.kernel.org S: Supported -F: drivers/scsi/ufs/*dwc* +F: drivers/ufs/host/*dwc* UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER MEDIATEK HOOKS M: Stanley Chu L: linux-scsi@vger.kernel.org L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) S: Maintained -F: drivers/scsi/ufs/ufs-mediatek* +F: drivers/ufs/host/ufs-mediatek* UNSORTED BLOCK IMAGES (UBI) M: Richard Weinberger diff --git a/drivers/Kconfig b/drivers/Kconfig index 8d6cd5d08722..a7ec388e1848 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -107,6 +107,8 @@ source "drivers/usb/Kconfig" source "drivers/mmc/Kconfig" +source "drivers/ufs/Kconfig" + source "drivers/memstick/Kconfig" source "drivers/leds/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 020780b6b4d2..8b4b90202e58 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -128,6 +128,7 @@ obj-$(CONFIG_PM_OPP) += opp/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_IDLE) += cpuidle/ obj-y += mmc/ +obj-y += ufs/ obj-$(CONFIG_MEMSTICK) += memstick/ obj-$(CONFIG_NEW_LEDS) += leds/ obj-$(CONFIG_INFINIBAND) += infiniband/ diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 6e3a04107bb6..a9fe5152addd 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -500,7 +500,6 @@ source "drivers/scsi/megaraid/Kconfig.megaraid" source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/mpi3mr/Kconfig" source "drivers/scsi/smartpqi/Kconfig" -source "drivers/scsi/ufs/Kconfig" config SCSI_HPTIOP tristate "HighPoint RocketRAID 3xxx/4xxx Controller support" diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 19814c26c908..2ad3bc052531 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -101,7 +101,6 @@ obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ obj-$(CONFIG_MEGARAID_SAS) += megaraid/ obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ obj-$(CONFIG_SCSI_MPI3MR) += mpi3mr/ -obj-$(CONFIG_SCSI_UFSHCD) += ufs/ obj-$(CONFIG_SCSI_ACARD) += atp870u.o obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o obj-$(CONFIG_SCSI_INITIO) += initio.o diff --git a/drivers/ufs/Kconfig b/drivers/ufs/Kconfig new file mode 100644 index 000000000000..90226f72c158 --- /dev/null +++ b/drivers/ufs/Kconfig @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# UFS subsystem configuration +# + +menuconfig SCSI_UFSHCD + tristate "Universal Flash Storage Controller" + depends on SCSI && SCSI_DMA + select PM_DEVFREQ + select DEVFREQ_GOV_SIMPLE_ONDEMAND + select NLS + help + Enables support for UFS (Universal Flash Storage) host controllers. + A UFS host controller is an electronic component that is able to + communicate with a UFS card. UFS host controllers occur in + smartphones, laptops, digital cameras and also in cars. + The kernel module will be called ufshcd. + + To compile this driver as a module, choose M here and read + . + However, do not compile this as a module if your root file system + (the one containing the directory /) is located on a UFS device. + +if SCSI_UFSHCD + +source "drivers/ufs/core/Kconfig" + +source "drivers/ufs/host/Kconfig" + +endif diff --git a/drivers/ufs/Makefile b/drivers/ufs/Makefile new file mode 100644 index 000000000000..5a199ef18d4c --- /dev/null +++ b/drivers/ufs/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +# The link order is important here. ufshcd-core must initialize +# before vendor drivers. +obj-$(CONFIG_SCSI_UFSHCD) += core/ host/ diff --git a/drivers/ufs/core/Kconfig b/drivers/ufs/core/Kconfig new file mode 100644 index 000000000000..e11978171403 --- /dev/null +++ b/drivers/ufs/core/Kconfig @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Kernel configuration file for the UFS Host Controller core. +# +# Copyright (C) 2011-2013 Samsung India Software Operations +# +# Authors: +# Santosh Yaraganavi +# Vinayak Holikatti + +config SCSI_UFS_BSG + bool "Universal Flash Storage BSG device node" + select BLK_DEV_BSGLIB + help + Universal Flash Storage (UFS) is SCSI transport specification for + accessing flash storage on digital cameras, mobile phones and + consumer electronic devices. + A UFS controller communicates with a UFS device by exchanging + UFS Protocol Information Units (UPIUs). + UPIUs can not only be used as a transport layer for the SCSI protocol + but are also used by the UFS native command set. + This transport driver supports exchanging UFS protocol information units + with a UFS device. See also the ufshcd driver, which is a SCSI driver + that supports UFS devices. + + Select this if you need a bsg device node for your UFS controller. + If unsure, say N. + +config SCSI_UFS_CRYPTO + bool "UFS Crypto Engine Support" + depends on BLK_INLINE_ENCRYPTION + help + Enable Crypto Engine Support in UFS. + Enabling this makes it possible for the kernel to use the crypto + capabilities of the UFS device (if present) to perform crypto + operations on data being transferred to/from the device. + +config SCSI_UFS_HPB + bool "Support UFS Host Performance Booster" + help + The UFS HPB feature improves random read performance. It caches + L2P (logical to physical) map of UFS to host DRAM. The driver uses HPB + read command by piggybacking physical page number for bypassing FTL (flash + translation layer)'s L2P address translation. + +config SCSI_UFS_FAULT_INJECTION + bool "UFS Fault Injection Support" + depends on FAULT_INJECTION + help + Enable fault injection support in the UFS driver. This makes it easier + to test the UFS error handler and abort handler. + +config SCSI_UFS_HWMON + bool "UFS Temperature Notification" + depends on SCSI_UFSHCD=HWMON || HWMON=y + help + This provides support for UFS hardware monitoring. If enabled, + a hardware monitoring device will be created for the UFS device. + + If unsure, say N. diff --git a/drivers/ufs/core/Makefile b/drivers/ufs/core/Makefile new file mode 100644 index 000000000000..62f38c5bf857 --- /dev/null +++ b/drivers/ufs/core/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o +ufshcd-core-y += ufshcd.o ufs-sysfs.o +ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o +ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o +ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o +ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o +ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o +ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o diff --git a/drivers/scsi/ufs/ufs-debugfs.c b/drivers/ufs/core/ufs-debugfs.c similarity index 99% rename from drivers/scsi/ufs/ufs-debugfs.c rename to drivers/ufs/core/ufs-debugfs.c index c10a8f09682b..e1dce1cad177 100644 --- a/drivers/scsi/ufs/ufs-debugfs.c +++ b/drivers/ufs/core/ufs-debugfs.c @@ -4,7 +4,7 @@ #include #include "ufs-debugfs.h" -#include "ufshcd.h" +#include #include "ufshcd-priv.h" static struct dentry *ufs_debugfs_root; diff --git a/drivers/scsi/ufs/ufs-debugfs.h b/drivers/ufs/core/ufs-debugfs.h similarity index 100% rename from drivers/scsi/ufs/ufs-debugfs.h rename to drivers/ufs/core/ufs-debugfs.h diff --git a/drivers/scsi/ufs/ufs-fault-injection.c b/drivers/ufs/core/ufs-fault-injection.c similarity index 100% rename from drivers/scsi/ufs/ufs-fault-injection.c rename to drivers/ufs/core/ufs-fault-injection.c diff --git a/drivers/scsi/ufs/ufs-fault-injection.h b/drivers/ufs/core/ufs-fault-injection.h similarity index 100% rename from drivers/scsi/ufs/ufs-fault-injection.h rename to drivers/ufs/core/ufs-fault-injection.h diff --git a/drivers/scsi/ufs/ufs-hwmon.c b/drivers/ufs/core/ufs-hwmon.c similarity index 99% rename from drivers/scsi/ufs/ufs-hwmon.c rename to drivers/ufs/core/ufs-hwmon.c index c38d9d98a86d..1f1f5c8ab8da 100644 --- a/drivers/scsi/ufs/ufs-hwmon.c +++ b/drivers/ufs/core/ufs-hwmon.c @@ -7,7 +7,7 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-priv.h" struct ufs_hwmon_data { diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c similarity index 99% rename from drivers/scsi/ufs/ufs-sysfs.c rename to drivers/ufs/core/ufs-sysfs.c index 8a3c6442f291..840d7b79a857 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -6,7 +6,7 @@ #include #include -#include "ufs.h" +#include #include "ufs-sysfs.h" #include "ufshcd-priv.h" diff --git a/drivers/scsi/ufs/ufs-sysfs.h b/drivers/ufs/core/ufs-sysfs.h similarity index 100% rename from drivers/scsi/ufs/ufs-sysfs.h rename to drivers/ufs/core/ufs-sysfs.h diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c similarity index 99% rename from drivers/scsi/ufs/ufs_bsg.c rename to drivers/ufs/core/ufs_bsg.c index 9e9b93867cab..dde7887d261f 100644 --- a/drivers/scsi/ufs/ufs_bsg.c +++ b/drivers/ufs/core/ufs_bsg.c @@ -9,7 +9,7 @@ #include #include #include "ufs_bsg.h" -#include "ufshcd.h" +#include #include "ufshcd-priv.h" static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len, diff --git a/drivers/scsi/ufs/ufs_bsg.h b/drivers/ufs/core/ufs_bsg.h similarity index 100% rename from drivers/scsi/ufs/ufs_bsg.h rename to drivers/ufs/core/ufs_bsg.h diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/ufs/core/ufshcd-crypto.c similarity index 99% rename from drivers/scsi/ufs/ufshcd-crypto.c rename to drivers/ufs/core/ufshcd-crypto.c index 67402baf6fae..f8f19d8cf4d4 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.c +++ b/drivers/ufs/core/ufshcd-crypto.c @@ -3,7 +3,7 @@ * Copyright 2019 Google LLC */ -#include "ufshcd.h" +#include #include "ufshcd-crypto.h" /* Blk-crypto modes supported by UFS crypto */ diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/ufs/core/ufshcd-crypto.h similarity index 97% rename from drivers/scsi/ufs/ufshcd-crypto.h rename to drivers/ufs/core/ufshcd-crypto.h index 9f98f18f9646..cd4ee661ca96 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.h +++ b/drivers/ufs/core/ufshcd-crypto.h @@ -7,9 +7,9 @@ #define _UFSHCD_CRYPTO_H #include -#include "ufshcd.h" +#include #include "ufshcd-priv.h" -#include "ufshci.h" +#include #ifdef CONFIG_SCSI_UFS_CRYPTO diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h similarity index 99% rename from drivers/scsi/ufs/ufshcd-priv.h rename to drivers/ufs/core/ufshcd-priv.h index 38bc77d3dbbd..a6ae5b626752 100644 --- a/drivers/scsi/ufs/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -4,7 +4,7 @@ #define _UFSHCD_PRIV_H_ #include -#include "ufshcd.h" +#include static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) { diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/ufs/core/ufshcd.c similarity index 99% rename from drivers/scsi/ufs/ufshcd.c rename to drivers/ufs/core/ufshcd.c index 198bef3eb4b2..0696dc30ea09 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -27,8 +27,8 @@ #include #include #include "ufshcd-priv.h" -#include "ufs_quirks.h" -#include "unipro.h" +#include +#include #include "ufs-sysfs.h" #include "ufs-debugfs.h" #include "ufs-fault-injection.h" diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/ufs/core/ufshpb.c similarity index 99% rename from drivers/scsi/ufs/ufshpb.c rename to drivers/ufs/core/ufshpb.c index 5fae0861b488..791f0bce11bb 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/ufs/core/ufshpb.c @@ -17,7 +17,7 @@ #include "ufshcd-priv.h" #include "ufshpb.h" -#include "../sd.h" +#include "../../scsi/sd.h" #define ACTIVATION_THRESHOLD 8 /* 8 IOs */ #define READ_TO_MS 1000 diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/ufs/core/ufshpb.h similarity index 100% rename from drivers/scsi/ufs/ufshpb.h rename to drivers/ufs/core/ufshpb.h diff --git a/drivers/scsi/ufs/Kconfig b/drivers/ufs/host/Kconfig similarity index 56% rename from drivers/scsi/ufs/Kconfig rename to drivers/ufs/host/Kconfig index 393b9a01da36..82590224da13 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/ufs/host/Kconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# Kernel configuration file for the UFS Host Controller +# Kernel configuration file for the UFS host controller drivers. # # Copyright (C) 2011-2013 Samsung India Software Operations # @@ -8,26 +8,6 @@ # Santosh Yaraganavi # Vinayak Holikatti -config SCSI_UFSHCD - tristate "Universal Flash Storage Controller Driver Core" - depends on SCSI && SCSI_DMA - select PM_DEVFREQ - select DEVFREQ_GOV_SIMPLE_ONDEMAND - select NLS - help - This selects the support for UFS devices in Linux, say Y and make - sure that you know the name of your UFS host adapter (the card - inside your computer that "speaks" the UFS protocol, also - called UFS Host Controller), because you will be asked for it. - The module will be called ufshcd. - - To compile this driver as a module, choose M here and read - . - However, do not compile this as a module if your root file system - (the one containing the directory /) is located on a UFS device. - -if SCSI_UFSHCD - config SCSI_UFSHCD_PCI tristate "PCI bus based UFS Controller support" depends on PCI @@ -122,24 +102,6 @@ config SCSI_UFS_TI_J721E Selects this if you have TI platform with UFS controller. If unsure, say N. -config SCSI_UFS_BSG - bool "Universal Flash Storage BSG device node" - select BLK_DEV_BSGLIB - help - Universal Flash Storage (UFS) is SCSI transport specification for - accessing flash storage on digital cameras, mobile phones and - consumer electronic devices. - A UFS controller communicates with a UFS device by exchanging - UFS Protocol Information Units (UPIUs). - UPIUs can not only be used as a transport layer for the SCSI protocol - but are also used by the UFS native command set. - This transport driver supports exchanging UFS protocol information units - with a UFS device. See also the ufshcd driver, which is a SCSI driver - that supports UFS devices. - - Select this if you need a bsg device node for your UFS controller. - If unsure, say N. - config SCSI_UFS_EXYNOS tristate "Exynos specific hooks to UFS controller platform driver" depends on SCSI_UFSHCD_PLATFORM && (ARCH_EXYNOS || COMPILE_TEST) @@ -150,38 +112,3 @@ config SCSI_UFS_EXYNOS Select this if you have UFS host controller on Samsung Exynos SoC. If unsure, say N. - -config SCSI_UFS_CRYPTO - bool "UFS Crypto Engine Support" - depends on BLK_INLINE_ENCRYPTION - help - Enable Crypto Engine Support in UFS. - Enabling this makes it possible for the kernel to use the crypto - capabilities of the UFS device (if present) to perform crypto - operations on data being transferred to/from the device. - -config SCSI_UFS_HPB - bool "Support UFS Host Performance Booster" - help - The UFS HPB feature improves random read performance. It caches - L2P (logical to physical) map of UFS to host DRAM. The driver uses HPB - read command by piggybacking physical page number for bypassing FTL (flash - translation layer)'s L2P address translation. - -config SCSI_UFS_FAULT_INJECTION - bool "UFS Fault Injection Support" - depends on FAULT_INJECTION - help - Enable fault injection support in the UFS driver. This makes it easier - to test the UFS error handler and abort handler. - -config SCSI_UFS_HWMON - bool "UFS Temperature Notification" - depends on SCSI_UFSHCD=HWMON || HWMON=y - help - This provides support for UFS hardware monitoring. If enabled, - a hardware monitoring device will be created for the UFS device. - - If unsure, say N. - -endif diff --git a/drivers/scsi/ufs/Makefile b/drivers/ufs/host/Makefile similarity index 56% rename from drivers/scsi/ufs/Makefile rename to drivers/ufs/host/Makefile index 966048875b50..e4be54273c98 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/ufs/host/Makefile @@ -1,16 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -# UFSHCD makefile - -# The link order is important here. ufshcd-core must initialize -# before vendor drivers. -obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o -ufshcd-core-y += ufshcd.o ufs-sysfs.o -ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o -ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o -ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o -ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o -ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o -ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/ufs/host/cdns-pltfrm.c similarity index 100% rename from drivers/scsi/ufs/cdns-pltfrm.c rename to drivers/ufs/host/cdns-pltfrm.c diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/ufs/host/tc-dwc-g210-pci.c similarity index 99% rename from drivers/scsi/ufs/tc-dwc-g210-pci.c rename to drivers/ufs/host/tc-dwc-g210-pci.c index e635c211c783..22f581a71230 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/ufs/host/tc-dwc-g210-pci.c @@ -7,7 +7,7 @@ * Authors: Joao Pinto */ -#include "ufshcd.h" +#include #include "ufshcd-dwc.h" #include "tc-dwc-g210.h" diff --git a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c b/drivers/ufs/host/tc-dwc-g210-pltfrm.c similarity index 100% rename from drivers/scsi/ufs/tc-dwc-g210-pltfrm.c rename to drivers/ufs/host/tc-dwc-g210-pltfrm.c diff --git a/drivers/scsi/ufs/tc-dwc-g210.c b/drivers/ufs/host/tc-dwc-g210.c similarity index 99% rename from drivers/scsi/ufs/tc-dwc-g210.c rename to drivers/ufs/host/tc-dwc-g210.c index 7ef67c9fc5b8..9c89f0accd82 100644 --- a/drivers/scsi/ufs/tc-dwc-g210.c +++ b/drivers/ufs/host/tc-dwc-g210.c @@ -9,8 +9,8 @@ #include -#include "ufshcd.h" -#include "unipro.h" +#include +#include #include "ufshcd-dwc.h" #include "ufshci-dwc.h" diff --git a/drivers/scsi/ufs/tc-dwc-g210.h b/drivers/ufs/host/tc-dwc-g210.h similarity index 100% rename from drivers/scsi/ufs/tc-dwc-g210.h rename to drivers/ufs/host/tc-dwc-g210.h diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/ufs/host/ti-j721e-ufs.c similarity index 100% rename from drivers/scsi/ufs/ti-j721e-ufs.c rename to drivers/ufs/host/ti-j721e-ufs.c diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c similarity index 99% rename from drivers/scsi/ufs/ufs-exynos.c rename to drivers/ufs/host/ufs-exynos.c index ddb2d42605c5..10f9d9ff84da 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -18,10 +18,10 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-pltfrm.h" -#include "ufshci.h" -#include "unipro.h" +#include +#include #include "ufs-exynos.h" diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h similarity index 100% rename from drivers/scsi/ufs/ufs-exynos.h rename to drivers/ufs/host/ufs-exynos.h diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/ufs/host/ufs-hisi.c similarity index 99% rename from drivers/scsi/ufs/ufs-hisi.c rename to drivers/ufs/host/ufs-hisi.c index 7046143063ee..3c7dfdcede26 100644 --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/ufs/host/ufs-hisi.c @@ -15,12 +15,12 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include #include "ufs-hisi.h" -#include "ufshci.h" -#include "ufs_quirks.h" +#include +#include static int ufs_hisi_check_hibern8(struct ufs_hba *hba) { diff --git a/drivers/scsi/ufs/ufs-hisi.h b/drivers/ufs/host/ufs-hisi.h similarity index 100% rename from drivers/scsi/ufs/ufs-hisi.h rename to drivers/ufs/host/ufs-hisi.h diff --git a/drivers/scsi/ufs/ufs-mediatek-trace.h b/drivers/ufs/host/ufs-mediatek-trace.h similarity index 93% rename from drivers/scsi/ufs/ufs-mediatek-trace.h rename to drivers/ufs/host/ufs-mediatek-trace.h index 895e82ea6ece..7e010848dc99 100644 --- a/drivers/scsi/ufs/ufs-mediatek-trace.h +++ b/drivers/ufs/host/ufs-mediatek-trace.h @@ -31,6 +31,6 @@ TRACE_EVENT(ufs_mtk_event, #undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_PATH ../../drivers/scsi/ufs/ +#define TRACE_INCLUDE_PATH ../../drivers/ufs/host #define TRACE_INCLUDE_FILE ufs-mediatek-trace #include diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c similarity index 99% rename from drivers/scsi/ufs/ufs-mediatek.c rename to drivers/ufs/host/ufs-mediatek.c index 083d6bd4d561..06bcf81490bd 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -21,10 +21,10 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-pltfrm.h" -#include "ufs_quirks.h" -#include "unipro.h" +#include +#include #include "ufs-mediatek.h" #define CREATE_TRACE_POINTS diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/ufs/host/ufs-mediatek.h similarity index 100% rename from drivers/scsi/ufs/ufs-mediatek.h rename to drivers/ufs/host/ufs-mediatek.h diff --git a/drivers/scsi/ufs/ufs-qcom-ice.c b/drivers/ufs/host/ufs-qcom-ice.c similarity index 100% rename from drivers/scsi/ufs/ufs-qcom-ice.c rename to drivers/ufs/host/ufs-qcom-ice.c diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c similarity index 99% rename from drivers/scsi/ufs/ufs-qcom.c rename to drivers/ufs/host/ufs-qcom.c index a63844961222..ef12c8a42642 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -15,12 +15,12 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include #include "ufs-qcom.h" -#include "ufshci.h" -#include "ufs_quirks.h" +#include +#include #define UFS_QCOM_DEFAULT_DBG_PRINT_EN \ (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN) diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h similarity index 99% rename from drivers/scsi/ufs/ufs-qcom.h rename to drivers/ufs/host/ufs-qcom.h index 771bc95d02c7..ad70d425c544 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -7,7 +7,7 @@ #include #include -#include "ufshcd.h" +#include #define MAX_UFS_QCOM_HOSTS 1 #define MAX_U32 (~(u32)0) diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/ufs/host/ufshcd-dwc.c similarity index 98% rename from drivers/scsi/ufs/ufshcd-dwc.c rename to drivers/ufs/host/ufshcd-dwc.c index a57973c8d2a1..ccaaae348a37 100644 --- a/drivers/scsi/ufs/ufshcd-dwc.c +++ b/drivers/ufs/host/ufshcd-dwc.c @@ -9,8 +9,8 @@ #include -#include "ufshcd.h" -#include "unipro.h" +#include +#include #include "ufshcd-dwc.h" #include "ufshci-dwc.h" diff --git a/drivers/scsi/ufs/ufshcd-dwc.h b/drivers/ufs/host/ufshcd-dwc.h similarity index 95% rename from drivers/scsi/ufs/ufshcd-dwc.h rename to drivers/ufs/host/ufshcd-dwc.h index 43b70794e24f..3195002f6692 100644 --- a/drivers/scsi/ufs/ufshcd-dwc.h +++ b/drivers/ufs/host/ufshcd-dwc.h @@ -10,7 +10,7 @@ #ifndef _UFSHCD_DWC_H #define _UFSHCD_DWC_H -#include "ufshcd.h" +#include struct ufshcd_dme_attr_val { u32 attr_sel; diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/ufs/host/ufshcd-pci.c similarity index 99% rename from drivers/scsi/ufs/ufshcd-pci.c rename to drivers/ufs/host/ufshcd-pci.c index 5fe30dcf98b4..a9db5fbc2c70 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/ufs/host/ufshcd-pci.c @@ -9,7 +9,7 @@ * Vinayak Holikatti */ -#include "ufshcd.h" +#include #include #include #include diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c similarity index 99% rename from drivers/scsi/ufs/ufshcd-pltfrm.c rename to drivers/ufs/host/ufshcd-pltfrm.c index f5313f407617..81cf0789c8ad 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -13,9 +13,9 @@ #include #include -#include "ufshcd.h" +#include #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include #define UFSHCD_DEFAULT_LANES_PER_DIRECTION 2 diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.h b/drivers/ufs/host/ufshcd-pltfrm.h similarity index 98% rename from drivers/scsi/ufs/ufshcd-pltfrm.h rename to drivers/ufs/host/ufshcd-pltfrm.h index c33e28ac6ef6..63cb306ed0ac 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.h +++ b/drivers/ufs/host/ufshcd-pltfrm.h @@ -5,7 +5,7 @@ #ifndef UFSHCD_PLTFRM_H_ #define UFSHCD_PLTFRM_H_ -#include "ufshcd.h" +#include #define UFS_PWM_MODE 1 #define UFS_HS_MODE 2 diff --git a/drivers/scsi/ufs/ufshci-dwc.h b/drivers/ufs/host/ufshci-dwc.h similarity index 100% rename from drivers/scsi/ufs/ufshci-dwc.h rename to drivers/ufs/host/ufshci-dwc.h diff --git a/drivers/scsi/ufs/ufs.h b/include/scsi/ufs.h similarity index 100% rename from drivers/scsi/ufs/ufs.h rename to include/scsi/ufs.h diff --git a/drivers/scsi/ufs/ufs_quirks.h b/include/scsi/ufs_quirks.h similarity index 100% rename from drivers/scsi/ufs/ufs_quirks.h rename to include/scsi/ufs_quirks.h diff --git a/drivers/scsi/ufs/ufshcd.h b/include/scsi/ufshcd.h similarity index 99% rename from drivers/scsi/ufs/ufshcd.h rename to include/scsi/ufshcd.h index 16f69ab1b309..f7f5fe0a4a9f 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/include/scsi/ufshcd.h @@ -18,10 +18,10 @@ #include #include #include -#include "unipro.h" -#include "ufs.h" -#include "ufs_quirks.h" -#include "ufshci.h" +#include +#include +#include +#include #define UFSHCD "ufshcd" diff --git a/drivers/scsi/ufs/ufshci.h b/include/scsi/ufshci.h similarity index 100% rename from drivers/scsi/ufs/ufshci.h rename to include/scsi/ufshci.h diff --git a/drivers/scsi/ufs/unipro.h b/include/scsi/unipro.h similarity index 100% rename from drivers/scsi/ufs/unipro.h rename to include/scsi/unipro.h