Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp290021pxu; Wed, 2 Dec 2020 23:29:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQNBa1akZ+gev0FkodKk3uzovHLnAK+dWtHySFUgVg7vzn45C3GrDs77oJC30YthumiWqC X-Received: by 2002:a17:906:1412:: with SMTP id p18mr1383614ejc.480.1606980560272; Wed, 02 Dec 2020 23:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606980560; cv=none; d=google.com; s=arc-20160816; b=qu5Jzcq3FSXEiqvab7LE2VDQZdoYSEwX+24oLXL1lWdBKxkluphC4UwhR5uCV3jDRJ PGh/sykY77pfKJ/7zcMU8pGesvxwwoU9H7YObxH+BNEDAJEnHKbOkbyTTUKYWGe/at71 DvcwSw4uU3FJE++ExIh1Xlt4ocW9QTGSMjwwpz438IWqIZ8TBPTxVv9Ph36LPffDAifZ vQqTb8pNDgx7jYtqfGck1Xo9i//BleGQPMwoQnwxlaOIQzN1xhg5AJM4Xja15TPtzGXY vb1ryNm6xh1afu+7jhzTqNNsvRa4/XExkfldS/tJIO2IqnKeNvNg//1ntYsOtphwZpl1 9hNg== 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=MPZ/nfQA3AD9R6Ot0xBJ69jlhAP7KI2BEDi8BzodN6E=; b=W9ppfrJ8IJmmu8cT2+YKg0yk+fK6pu7nFRdAY/s0vZuf/45xIeGf5aZ6KPbbZKRuNj nw1JYJjcZEkv2KSCSvG3BmYZ6gyELb7k5o14UfKMhiLYN3VdtO0n0BCFjbP5OBBM3CZ/ LZU7j6ztD+7RPDKcBv7m3Zxwh/NgMPL87UEWOxk0G6srmHsYCs5FABPuaZQQiyg8FHhw vSZcuUAHZmG8dNrm9DU1/SC68QdTVJCko6KmcOgjNf7L5j4odb/2BP4RvU1Py6Svu340 MgwYZOk8A102tmErRV/iBUoQTZClc/N0Jxu83X42sw+Lh58gMCPwrGwb6KxmJ+myGQ+6 mbIg== 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 gb31si650025ejc.465.2020.12.02.23.28.57; Wed, 02 Dec 2020 23:29:20 -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 S1729835AbgLCHZc (ORCPT + 99 others); Thu, 3 Dec 2020 02:25:32 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:57183 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725912AbgLCHZb (ORCPT ); Thu, 3 Dec 2020 02:25:31 -0500 X-UUID: 2a14de94598d41ea8f5531c1941eca3e-20201203 X-UUID: 2a14de94598d41ea8f5531c1941eca3e-20201203 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] 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 360608454; Thu, 03 Dec 2020 15:24:48 +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; Thu, 3 Dec 2020 15:24:45 +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; Thu, 3 Dec 2020 15:24:46 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v2 3/3] scsi: ufs: Introduce event_notify variant function Date: Thu, 3 Dec 2020 15:24:43 +0800 Message-ID: <20201203072443.6663-4-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201203072443.6663-1-stanley.chu@mediatek.com> References: <20201203072443.6663-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 Introduce event_notify variant function to allow vendor to get notification of important events and connect to vendor-specific debugging facilities. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f630955141df..308f624b3830 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4480,6 +4480,8 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val) e->val[e->pos] = val; e->tstamp[e->pos] = ktime_get(); e->pos = (e->pos + 1) % UFS_EVENT_HIST_LENGTH; + + ufshcd_vops_event_notify(hba, id, &val); } EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b2eab23a17e8..815993239898 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -320,6 +320,7 @@ struct ufs_pwr_mode_info { * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device * @program_key: program or evict an inline encryption key + * @event_notify: called to notify important events */ struct ufs_hba_variant_ops { const char *name; @@ -355,6 +356,8 @@ struct ufs_hba_variant_ops { void *data); int (*program_key)(struct ufs_hba *hba, const union ufs_crypto_cfg_entry *cfg, int slot); + void (*event_notify)(struct ufs_hba *hba, + enum ufs_event_type evt, void *data); }; /* clock gating state */ @@ -1102,6 +1105,14 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, 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) { -- 2.18.0