From patchwork Mon May 4 14:56:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11526413 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F39815E6 for ; Mon, 4 May 2020 14:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46B0020735 for ; Mon, 4 May 2020 14:56:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="FLHRUexH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729085AbgEDO4z (ORCPT ); Mon, 4 May 2020 10:56:55 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:50831 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729256AbgEDO4l (ORCPT ); Mon, 4 May 2020 10:56:41 -0400 X-UUID: 168a9c08d85049fc9be5b4d06bd19a6d-20200504 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=VSWhRTmhmIwUIHei1q+zVhCR5nlcROyoO/faGGqro48=; b=FLHRUexHYu8ysHIWgI1RtORrtzCbaIRSKQPi7cukWqDC6Uz4Ha6wYCADyWrGqfzPGrJB2AaCT90aFbAF22TDb7PCN2ENK8v0urv974s6eWl21/Ozwm2Ta2+qpi2ELIa33ieNQRPzymtDHHRj41JbAxv+mwKImJckVb5dV8wAugE=; X-UUID: 168a9c08d85049fc9be5b4d06bd19a6d-20200504 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2097087888; Mon, 04 May 2020 22:56:37 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 4 May 2020 22:56:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 4 May 2020 22:56:26 +0800 From: Stanley Chu To: , , , , , CC: , , , , , , , , , , , Stanley Chu Subject: [PATCH v6 2/8] scsi: ufs: introduce fixup_dev_quirks vops Date: Mon, 4 May 2020 22:56:16 +0800 Message-ID: <20200504145622.13895-3-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200504145622.13895-1-stanley.chu@mediatek.com> References: <20200504145622.13895-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Some UFS deivces may have required device quirks or have non-standard features which are enabled only on specified UFS hosts or for special customers. To not "pollute" common device quirk list, i.e., ufs_fixups table for those devices mentioned above, introduce "fixup_dev_quirks" vops to allow vendors to fix or modify device quirks accordingly. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 1 + drivers/scsi/ufs/ufshcd.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 31411fd87796..fc1549f829cc 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6896,6 +6896,7 @@ static int ufs_get_device_desc(struct ufs_hba *hba) } ufs_fixup_device_setup(hba); + ufshcd_vops_fixup_dev_quirks(hba); /* * Probe WB only for UFS-3.1 devices or UFS devices with quirk diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 056537e52c19..5fa03e0f3bd1 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -336,6 +336,7 @@ struct ufs_hba_variant_ops { void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme, enum ufs_notify_change_status); int (*apply_dev_quirks)(struct ufs_hba *hba); + void (*fixup_dev_quirks)(struct ufs_hba *hba); 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); @@ -1085,6 +1086,12 @@ static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *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) { if (hba->vops && hba->vops->suspend)