From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31E40C761A5 for ; Mon, 17 Feb 2020 12:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F296C227BF for ; Mon, 17 Feb 2020 12:20:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="LmttVX4M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbgBQMUK (ORCPT ); Mon, 17 Feb 2020 07:20:10 -0500 Received: from mail27.static.mailgun.info ([104.130.122.27]:35282 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728319AbgBQMUJ (ORCPT ); Mon, 17 Feb 2020 07:20:09 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1581942008; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=Ak3LgBqGOZMnRKzcv+4G1EyGXh9VotBzC+KbdmXq/x0=; b=LmttVX4M3SfV/fKTRfVXKNSK6Hx7sCh8aUxs3h9UwuVG79dFx7mEqETeiuSTolsVF7cpR5X9 xDQo8R5Phq7d775nbMltnSGOQJtpEEApQZ4T0LrZPOCjRnpOTMh6DNaM69JUCaEb9NT2pFTt n7yqNPTbNnjCdFGq1bjY+ncPD5g= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyJlNmU5NiIsICJsaW51eC1zY3NpQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e4a84f7.7faacf1dcb20-smtp-out-n01; Mon, 17 Feb 2020 12:20:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 440FFC447A3; Mon, 17 Feb 2020 12:20:07 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 756CEC43383; Mon, 17 Feb 2020 12:20:05 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Feb 2020 20:20:05 +0800 From: Can Guo To: Stanley Chu Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com, beanhuo@micron.com, asutoshd@codeaurora.org, matthias.bgg@gmail.com, bvanassche@acm.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com, peter.wang@mediatek.com, chun-hung.wu@mediatek.com, andy.teng@mediatek.com Subject: Re: [PATCH v3 1/2] scsi: ufs: pass device information to apply_dev_quirks In-Reply-To: <1578726707-6596-2-git-send-email-stanley.chu@mediatek.com> References: <1578726707-6596-1-git-send-email-stanley.chu@mediatek.com> <1578726707-6596-2-git-send-email-stanley.chu@mediatek.com> Message-ID: <2a8fc44914b7ed8777a4a99ba6b8647a@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On 2020-01-11 15:11, Stanley Chu wrote: > Pass UFS device information to vendor-specific variant callback > "apply_dev_quirks" because some platform vendors need to know such > information to apply special handlings or quirks in specific devices. > > In the same time, modify existed vendor implementations according to > the new interface for those vendor drivers which will be built-in > or built as a module alone with UFS core driver. > > Cc: Alim Akhtar > Cc: Asutosh Das > Cc: Avri Altman > Cc: Bart Van Assche > Cc: Bean Huo > Cc: Can Guo > Cc: Matthias Brugger > Reviewed-by: Avri Altman > Reviewed-by: Bean Huo > Signed-off-by: Stanley Chu > --- > drivers/scsi/ufs/ufs-qcom.c | 3 ++- > drivers/scsi/ufs/ufshcd.c | 8 ++++---- > drivers/scsi/ufs/ufshcd.h | 7 ++++--- > 3 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c > index c69c29a1ceb9..ebb5c66e069f 100644 > --- a/drivers/scsi/ufs/ufs-qcom.c > +++ b/drivers/scsi/ufs/ufs-qcom.c > @@ -949,7 +949,8 @@ static int > ufs_qcom_quirk_host_pa_saveconfigtime(struct ufs_hba *hba) > return err; > } > > -static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba) > +static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba, > + struct ufs_dev_desc *card) > { > int err = 0; > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 1b97f2dc0b63..7c85c890594c 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -6803,7 +6803,8 @@ static int > ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) > return ret; > } > > -static void ufshcd_tune_unipro_params(struct ufs_hba *hba) > +static void ufshcd_tune_unipro_params(struct ufs_hba *hba, > + struct ufs_dev_desc *card) > { > if (ufshcd_is_unipro_pa_params_tuning_req(hba)) { > ufshcd_tune_pa_tactivate(hba); > @@ -6817,7 +6818,7 @@ static void ufshcd_tune_unipro_params(struct > ufs_hba *hba) > if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE) > ufshcd_quirk_tune_host_pa_tactivate(hba); > > - ufshcd_vops_apply_dev_quirks(hba); > + ufshcd_vops_apply_dev_quirks(hba, card); Hi Stanley, Is this series merged? If no, would you mind moving ufshcd_vops_apply_dev_quirks(hba, card); a little bit? Like below. @@ -6852,14 +6852,14 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba) ufshcd_tune_pa_hibern8time(hba); } + ufshcd_vops_apply_dev_quirks(hba, card); + if (hba->dev_quirks & UFS_DEVICE_QUIRK_PA_TACTIVATE) /* set 1ms timeout for PA_TACTIVATE */ ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 10); In this way, vendor codes have a chance to modify the dev_quirks before ufshcd_tune_unipro_params() does the rest of its job. Thanks, Can Guo. > } > > static void ufshcd_clear_dbg_ufs_stats(struct ufs_hba *hba) > @@ -6980,10 +6981,9 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) > } > > ufs_fixup_device_setup(hba, &card); > + ufshcd_tune_unipro_params(hba, &card); > ufs_put_device_desc(&card); > > - ufshcd_tune_unipro_params(hba); > - > /* UFS device is also active now */ > ufshcd_set_ufs_dev_active(hba); > ufshcd_force_reset_auto_bkops(hba); > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index e05cafddc87b..4f3fa71303da 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -320,7 +320,7 @@ struct ufs_hba_variant_ops { > void (*setup_task_mgmt)(struct ufs_hba *, int, u8); > void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme, > enum ufs_notify_change_status); > - int (*apply_dev_quirks)(struct ufs_hba *); > + int (*apply_dev_quirks)(struct ufs_hba *, struct ufs_dev_desc *); > int (*suspend)(struct ufs_hba *, enum ufs_pm_op); > int (*resume)(struct ufs_hba *, enum ufs_pm_op); > void (*dbg_register_dump)(struct ufs_hba *hba); > @@ -1052,10 +1052,11 @@ static inline void > ufshcd_vops_hibern8_notify(struct ufs_hba *hba, > return hba->vops->hibern8_notify(hba, cmd, status); > } > > -static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) > +static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba, > + struct ufs_dev_desc *card) > { > if (hba->vops && hba->vops->apply_dev_quirks) > - return hba->vops->apply_dev_quirks(hba); > + return hba->vops->apply_dev_quirks(hba, card); > return 0; > }