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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 5AAE0C35254 for ; Mon, 17 Feb 2020 12:20:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D41E20578 for ; Mon, 17 Feb 2020 12:20:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G3s/RVu5"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="LmttVX4M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D41E20578 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rVFoxL0Ycp5/pVd/gZIxl7vyEZCVuDmytURIkebPndI=; b=G3s/RVu5usLlrKVzm9iJa2zFL PPHMrhLcMC6M4Zx1ES5sKJo+4uGXlrxu3HLtC/EQl8Rhq8ktYTGGAyNhbdHfVaKPaVw4j3PFzmLC5 8a+f3ieP5+ig4yQkFNS6zG0rFp+V+0hVo+on/G/4Ow12tB8K/X+srQmIqRzPF+e1OoIg+A7yNxG4W doolvn12NpHHZ3j2lrqKe2QBwrOeiUliKbqvykAc0F5TcIBZgNPhgSw5v4FtYqwVD1PMbhZq+Vi/K QhZ723lxET98I1P+hvj7Fd1Jxw14/bO9HyhQFzXipOyqzaCScWVHdl5KIJ8GQmkYPqLPAL79VJ0NR tpS4UGtUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j3fNl-0003gJ-TB; Mon, 17 Feb 2020 12:20:13 +0000 Received: from mail26.static.mailgun.info ([104.130.122.26]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j3fNh-0003WU-O3 for linux-arm-kernel@lists.infradead.org; Mon, 17 Feb 2020 12:20:11 +0000 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.26 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= 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.7efb9121a848-smtp-out-n02; Mon, 17 Feb 2020 12:20:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 29DADC4479C; 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 Date: Mon, 17 Feb 2020 20:20:05 +0800 From: Can Guo To: Stanley Chu 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200217_042009_859233_9ADEA70F X-CRM114-Status: GOOD ( 21.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, andy.teng@mediatek.com, jejb@linux.ibm.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, avri.altman@wdc.com, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, alim.akhtar@samsung.com, matthias.bgg@gmail.com, asutoshd@codeaurora.org, bvanassche@acm.org, linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel