Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2891710pxb; Sun, 15 Nov 2020 22:56:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0mCc7ORJjbqfhjM6jVDnH/G5TMpUX4zQIEKDcWHpH3Bicemo7A9pYKkUGYOlGEt5AOAoO X-Received: by 2002:a17:906:2708:: with SMTP id z8mr13595461ejc.428.1605509773964; Sun, 15 Nov 2020 22:56:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605509773; cv=none; d=google.com; s=arc-20160816; b=xFW1p+Ys1hjXADU3WE9U/RKNNO5XMr8xAOFkY7kQ+qN/pEh3pgxbDikxueyq2224mN irsQJ1pYutP/YBPbTsUGcG1X43olgRM2kiLbl9K4C1dqTNclVX1p48s+jM93izRckoWG XkP/Ubynft6NYHmLKP6Yr4mecWDv2suqt7lc6JWzg73AQt3OwwCjpr97QT7blMKRzrOM J4DUQJXyIPRLQcm2de9hODMIjrda1ltA/Pr1BLeTkZc/QU0RC8QORyXg5FZjAC5BBX35 yMynUJ/KqwR2upCjkXStetByknya55J8GCa0aCffvQjxIZj7zBC7OVscoWHX2g73lFoT OmEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=cvPV6lvlMWYuezqinxrogGqBfpZnDg1s9aaEkGc1iEk=; b=MNupIRLgIr/y9cbAw5/jYeM/U1FMHs12fi9rkqrOVehdyNAdGrtvo5G2GTckPLSZsc bKUntF8Uefc/ghkB006L/MhG7Jt+MNNkNzpPphTt82T+KG+7OCRHKZwX7P1Mz23Q9PLn MvwLYaM/6SKpc5/W/uBsBKLcgcrykHqbT7szHb4awdVTEAmR2XMOMmtrlVizZuBVUHyb UNwZ1Mj+NJcqwUWNpfV9c9nYcy1zA1VaOdreTOBoPfnZPkFaKqytOhRZe+Vgl0xb2nyc 89D14IXnRdRTisIEH6lHGKWtp65mkI33d0pnVMbpD4cvOeApfFJSN2E3nGrSH1XWGvqP V+GQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ks9si10969451ejb.1.2020.11.15.22.55.51; Sun, 15 Nov 2020 22:56:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbgKPGvT (ORCPT + 99 others); Mon, 16 Nov 2020 01:51:19 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:59517 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727228AbgKPGvE (ORCPT ); Mon, 16 Nov 2020 01:51:04 -0500 X-UUID: a4cd92fc30f746358018a7f03dd0d624-20201116 X-UUID: a4cd92fc30f746358018a7f03dd0d624-20201116 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2073750733; Mon, 16 Nov 2020 14:50:56 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Nov 2020 14:50:55 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 16 Nov 2020 14:50:55 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v1 2/9] scsi: ufs: Introduce device parameter initialization function Date: Mon, 16 Nov 2020 14:50:47 +0800 Message-ID: <20201116065054.7658-3-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201116065054.7658-1-stanley.chu@mediatek.com> References: <20201116065054.7658-1-stanley.chu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nowadays many vendors initialize their device parameters in their own vendor drivers. The initialization code is almost the same as well as the pre-defined definitions. Introduce a common device parameter initialization function which assign the most common initial values. With this function, we could remove those duplicated codes in vendor drivers. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-pltfrm.c | 17 +++++++++++++++++ drivers/scsi/ufs/ufshcd-pltfrm.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 3db0af66c71c..a6f76399b3ae 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -354,6 +354,23 @@ int ufshcd_get_pwr_dev_param(struct ufs_dev_params *pltfrm_param, } 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; +} +EXPORT_SYMBOL_GPL(ufshcd_init_pwr_dev_param); + /** * ufshcd_pltfrm_init - probe routine of the driver * @pdev: pointer to Platform device handle diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.h b/drivers/scsi/ufs/ufshcd-pltfrm.h index b79cdf9129a0..772a8e848098 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.h +++ b/drivers/scsi/ufs/ufshcd-pltfrm.h @@ -28,6 +28,7 @@ struct ufs_dev_params { int ufshcd_get_pwr_dev_param(struct ufs_dev_params *dev_param, struct ufs_pa_layer_attr *dev_max, struct ufs_pa_layer_attr *agreed_pwr); +void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param); int ufshcd_pltfrm_init(struct platform_device *pdev, const struct ufs_hba_variant_ops *vops); void ufshcd_pltfrm_shutdown(struct platform_device *pdev); -- 2.18.0