Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp236528pxu; Fri, 4 Dec 2020 01:53:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9+21UiXWbk/X7iUFJXHkXMkUrScJY4Rp9OqkW5LchPPtegtbG/KzeOFND/9/Uo0KUZSfQ X-Received: by 2002:a50:a444:: with SMTP id v4mr6979947edb.175.1607075632868; Fri, 04 Dec 2020 01:53:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607075632; cv=none; d=google.com; s=arc-20160816; b=XOpN3vtm5BToMoiI5tYRyvH4ul3nC3+BZKRt14ExWEjZZ0rb7mg9M4YnKi03FNVnz6 ZCtrEgW90VOOrNAW7KXJnT65jB53u5VsdzuZ9PlZ91lUuZEca68kbePk+p1Gn91e5N0K 4YbjMfLbuKPXWKTCYv56PxY2Rrb+EaDICGrSkX1XY59L6UFS3efFnHFJuMziWkbFhvBX RiAWq0aMpXigELeB3lw+XPuTnsdAfyWGP5Esld1o3MfYSJi/tNgDA8wis+flUuKAvBr4 ulZxN5QGRbyL9OHlx0uzittJ6mGs4b7mC0tyrlVp07rbIuxEwIDjxciGCgTxVDQNExyz oDEg== 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=zmjzuWDmsHyMjgHQ6Fz+vZw7AKpTsFQFyRsppwwq7EA=; b=PiounOYak7zREqN5mXmjLg3AZReVujYZ8I4qX7iGFW8WgbtnGWF41Khzp6D/ZDWOuC i4TAnww2OtQ/jdmU+i+m00eymOpZGzDmwWGoGZh0e843OmxU7D47I9XToBd5QHh/EtnJ Pzj/wB/s83fB7p8MaPRapvFdNcwxxZemO6ZhQePBFRrERSRc8aTRyUwvJTl0+61hgtjm ubEHqZ6Q/klRLJpwcl6/amLQlW7+BtfJN21zu6XFW6YlrzEy6L1BQGcx7bF8aG5Q9VY1 8cbj8dMK19KrJPmOEJpnG27fDh6y8mlbs74JkStCruKRRUqe9U9DrF8eTmZsPNCrhGIf H7JA== 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 j10si2593218edl.503.2020.12.04.01.53.30; Fri, 04 Dec 2020 01:53:52 -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 S2387804AbgLDJu4 (ORCPT + 99 others); Fri, 4 Dec 2020 04:50:56 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:34563 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726136AbgLDJu4 (ORCPT ); Fri, 4 Dec 2020 04:50:56 -0500 X-UUID: 6bb079f1f1dd46edb44ba9b6d7a7ff1e-20201204 X-UUID: 6bb079f1f1dd46edb44ba9b6d7a7ff1e-20201204 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] 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 375920986; Fri, 04 Dec 2020 17:50:10 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Dec 2020 17:50:07 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 4 Dec 2020 17:50:07 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v3 8/8] scsi: ufs-mediatek: Introduce event_notify implementation Date: Fri, 4 Dec 2020 17:50:07 +0800 Message-ID: <20201204095007.20639-9-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201204095007.20639-1-stanley.chu@mediatek.com> References: <20201204095007.20639-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 implementation on MediaTek UFS platform. A vendor-specific tracepoint is added that could be used for debugging purpose. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek-trace.h | 37 +++++++++++++++++++++++++++ drivers/scsi/ufs/ufs-mediatek.c | 10 ++++++++ 2 files changed, 47 insertions(+) create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h diff --git a/drivers/scsi/ufs/ufs-mediatek-trace.h b/drivers/scsi/ufs/ufs-mediatek-trace.h new file mode 100644 index 000000000000..c36ca6de9636 --- /dev/null +++ b/drivers/scsi/ufs/ufs-mediatek-trace.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2020 MediaTek Inc. + */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ufs_mtk + +#if !defined(_TRACE_EVENT_UFS_MEDIATEK_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_EVENT_UFS_MEDIATEK_H + +#include + +TRACE_EVENT(ufs_mtk_event, + TP_PROTO(unsigned int type, int data), + TP_ARGS(type, data), + + TP_STRUCT__entry( + __field(unsigned int, type) + __field(int, data) + ), + + TP_fast_assign( + __entry->type = type; + __entry->data = data; + ), + + TP_printk("ufs:event=%u data=%u", + __entry->type, __entry->data) + ); +#endif + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE ufs-mediatek-trace +#include + diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 1d3c5cd4592e..b6755aab9a7b 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -24,6 +24,9 @@ #include "unipro.h" #include "ufs-mediatek.h" +#define CREATE_TRACE_POINTS +#include "ufs-mediatek-trace.h" + #define ufs_mtk_smc(cmd, val, res) \ arm_smccc_smc(MTK_SIP_UFS_CONTROL, \ cmd, val, 0, 0, 0, 0, 0, &(res)) @@ -1002,6 +1005,12 @@ static void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba) ufshcd_fixup_dev_quirks(hba, ufs_mtk_dev_fixups); } +static void ufs_mtk_event_notify(struct ufs_hba *hba, + enum ufs_event_type evt, void *data) +{ + trace_ufs_mtk_event(evt, (int)data); +} + /* * struct ufs_hba_mtk_vops - UFS MTK specific variant operations * @@ -1021,6 +1030,7 @@ static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = { .resume = ufs_mtk_resume, .dbg_register_dump = ufs_mtk_dbg_register_dump, .device_reset = ufs_mtk_device_reset, + .event_notify = ufs_mtk_event_notify, }; /** -- 2.18.0