From nobody Tue Dec 16 22:31:30 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BEDD2D877B for ; Wed, 3 Dec 2025 09:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764752505; cv=none; b=ZbPR9p27F07ChGubYPi4yYPNoSyX8RlZEraT8+UDA8ejPDw/UN56/ldGWA3WW2Gx4bqrUESCYlXhTBwi7jzurAAKFx4lYv40j4Go/xVxOqA3qCZC1Qr5jRHv0fyPd3NtBGKwY0jHJCw6DrOajtE62Qm9/oXzau5xfuFt7M0heko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764752505; c=relaxed/simple; bh=/wB8K03Qe+c4rlberk6ek5Ojzv4VCmDj9foHAXM7V9w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M8LvvN+2CX2jnJICXCO1Mo/K97pIKyhY7dlpdxto4EHXe9I6VcBkb9xpCetZmrgV7hJeIIm8YNzi9L5t5uq3WryC2Ov0o4sqzis5zYL2xrdV8zchE3lnWWp0KTeC83J4Xyl8goY5AZmTfzxcfoADiFaPIEuVj/yrVGpMoL5aA+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=IDkTHQ4E; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bz9a6HOZ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="IDkTHQ4E"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bz9a6HOZ" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B34OL7f385647 for ; Wed, 3 Dec 2025 09:01:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=YcpW6FT5Ml5 cqNh4K+ZAcJVN/SL/nqamGuWANGIsHQ8=; b=IDkTHQ4EeCZUvX3Q/Dn1kCvB9yP GXOAXbZ4oG2DSNSasGeydwHopMVeGaMI7c4b7Sj+qDUCoQEGGGMe88ZsV+biXo1w dv3CTMOP5qersqGJY00iKodSAn/EeTOGLFNMEd1nZlIxH6IOVUjBsiMoAudfNhXh NJzOS8pTsWou7HbTGXoCYCWCdcIJSB3aP+sniU0ijGsmteLM3VYL46OXLvTw//x9 1m5MiOIfMJFgantvj2EAcTvvJkdG0MXkQMYw5OedxW8RwBTqavzoHsqWqfhv/+06 Wem12B6tYI//9T7ibC2p9hc3VFNwYx1eoESNbHS4Eh5GMRn2UM+CVsNZIHw== Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4at5db29u0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 03 Dec 2025 09:01:42 +0000 (GMT) Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-11ddcc9f85eso1120505c88.0 for ; Wed, 03 Dec 2025 01:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764752501; x=1765357301; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YcpW6FT5Ml5cqNh4K+ZAcJVN/SL/nqamGuWANGIsHQ8=; b=bz9a6HOZJthXMckxQBjhCHhFpEYuDwV8dxVzvP2YHna//PAzNE6wfy3fcZjUJKOa9d Qu91EWxK5o2oGMcxyDGBOIBB0VtbPg926Ld/asSDg7szE0Dx9yJCNiCfWCnItF68gmi1 Bz7MM08fK8AvRT3AetVhCpqCG0SAAMFW6Jm2iEHnX2ZpaSSt3XwLAMhBOR307sAYmOi3 lA8MnsiHvsDmFZVMjezRmGNaBi0BxP4tfUypwqKuzCgApEDCZI+1y4p3ufHq3WpbM8Ct nzvEdE8/zz93OThoDdWxR0b9GC7KguMA6WfrVYyu89pR2HRAkRAS9/qQqlKd+6Fe5sIw g/MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764752501; x=1765357301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YcpW6FT5Ml5cqNh4K+ZAcJVN/SL/nqamGuWANGIsHQ8=; b=iwHwRqnaKTf0WQ0eUIi9l95hZgPUV8tYtxVDcYWtXllSPnqyIgfCVFDH1j6ivREHSL MoGPi0bObuzvod3qhaa55u9W51BttC9R2d0a4DaYRiits7d3FIzLW4XMZSs6R2b4zFup Rx9bT4hjkUGYxN2TXbIjHkTuWbNtZ1dNJzTB+R/nZhUtQ5Hzv5W718pqDy+jSbtRgdt+ tGc25NlbK2DSu/a7DQYI737mM0Sbt7IQYY3IOzFAn5Tg1KqteJV8VbXKVzRKaMB4+AY3 eO/M3Qrk3CW1nwAUcFpwjcfv22p3Yc+aOWuRA2S930OeVDLwelOUWH0tmX3Eva3U0BV1 89Rw== X-Forwarded-Encrypted: i=1; AJvYcCVmy4KcxmDxmOF/VrX+FLnM4lo6bR/lbcLtsGmUWhRPi1bGQcKKvgx0EMrxjsokedtpTSeqXeIav13B5bg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3R9PWYf9L5Jk5Ds6A6kl+zMHoMvOigPENpiwMv3gQbHLyEfi2 RQbcHGXtPieSjPEK0nBj39vDc7zDeDeC2qrZhE8eIb0UANDW6p/KLv7DGL4Np/z1m+gcGDRgCuc GFoAQEr5/2YaFKHbvtnJSnZaPZS1ooUDdP2cNq20+T1GiqeI1jx/hp8ygVowQCCJbYtE= X-Gm-Gg: ASbGncvCseLd/LjuKOha+22dKFstafTbFDVg1e2E0M8OhanAi+y+1Z1xAe+c4XSlvKh NRkvovn01PFoZKf0fCSgQJ73iLVVl0nu8JOsSlarfAhMFf7kGf7Cwvpy7sGblHo+ZVG1hjNppOV bT3BuGmgzUTCZP4aEAOpw/lOL7c4+lGKNDYpTz2tw+est3E+7bU63vXz1dka+e+gITcvcm4B7Rg Ihux5jpym3kiv6w3xZ7gEgPKoHSKRgRuw4vws6bZf+JehOial+Zlfd7d87pOLVTTefhFd5K2mAJ t/VPUo46+g5xOIFVet4ZmNVGW2wSeHJ5uT7CD2jDbzt6tg8ZvX+SN00t6/Z0lbNiY33fqE1fHO3 rck00m7mk2DwPbRxa/OGodVUFSfh1K76EezG2ARuO98iXUyxKtvukmoMXKbdpp9F4 X-Received: by 2002:a05:7022:3844:b0:119:e569:f875 with SMTP id a92af1059eb24-11df0c51742mr1342268c88.18.1764752500964; Wed, 03 Dec 2025 01:01:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGczBS18cVnxW4Bd6f5klSTSp0HnIu7NJ00x9oYdzJHtAvarBMpszrTSCdZO4jtjV255/JWBQ== X-Received: by 2002:a05:7022:3844:b0:119:e569:f875 with SMTP id a92af1059eb24-11df0c51742mr1342242c88.18.1764752500343; Wed, 03 Dec 2025 01:01:40 -0800 (PST) Received: from hu-songchai-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcb057cb0sm100001866c88.9.2025.12.03.01.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Dec 2025 01:01:39 -0800 (PST) From: Songwei Chai To: andersson@kernel.org, alexander.shishkin@linux.intel.com, kernel@oss.qualcomm.com, mike.leach@linaro.org, suzuki.poulose@arm.com, james.clark@arm.com, krzk+dt@kernel.org, conor+dt@kernel.org Cc: Songwei Chai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, coresight@lists.linaro.org, devicetree@vger.kernel.org Subject: [PATCH v8 2/7] qcom-tgu: Add TGU driver Date: Wed, 3 Dec 2025 01:00:50 -0800 Message-Id: <20251203090055.2432719-3-songwei.chai@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251203090055.2432719-1-songwei.chai@oss.qualcomm.com> References: <20251203090055.2432719-1-songwei.chai@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: K-lQJmGZwn7zYbuH4-ha8tJcovU5fjOg X-Proofpoint-GUID: K-lQJmGZwn7zYbuH4-ha8tJcovU5fjOg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAzMDA3MCBTYWx0ZWRfX3Xaj7LLUWqfW TnH92xJ4wFok3nnnYYSH93S8aKhPftLxXRP7xwWaXcOeNS1sjSmnvWaPhX4KpL0YTg9pYSX+Flh j4XIDlRi1Ushn3qrIOIwFMMi4efOFFjWmuCYEudr9PYtBoi4MrGpJfYMD0uGAaNA6lnGPuV+wlF guHx+YFvNLtHUMUW6j6xMWQrEN4DDoOTG0ZzK32p3m2ovCIThTkpWfLej2vwUVFc5o7Ck/tFJKc lyU0xDRZD5RGHCUfBIsJnPdTva1ipJfuBQAhr0xcnDKNM24uwfMUxT3wc9IyO5QriSiM5coTEkY ZoK21cX0H5QhX5HSVVwo78vs7Wv3UV7MxUO9Xt4+RHsJ2k7Y9/C1zrqb5izW+qc/u7R8UKgG9yf BMwLP3+tdnv+kLKYXyzh/ZaZQ1cWUw== X-Authority-Analysis: v=2.4 cv=VoMuwu2n c=1 sm=1 tr=0 ts=692ffc76 cx=c_pps a=JYo30EpNSr/tUYqK9jHPoA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=h99DN6MNysFgGb7_OMAA:9 a=Fk4IpSoW4aLDllm1B1p-:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-02_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512030070 Content-Type: text/plain; charset="utf-8" Add driver to support device TGU (Trigger Generation Unit). TGU is a Data Engine which can be utilized to sense a plurality of signals and create a trigger into the CTI or generate interrupts to processors. Add probe/enable/disable functions for tgu. Signed-off-by: Songwei Chai --- .../testing/sysfs-bus-coresight-devices-tgu | 9 + drivers/Makefile | 1 + drivers/hwtracing/Kconfig | 2 + drivers/hwtracing/qcom/Kconfig | 18 ++ drivers/hwtracing/qcom/Makefile | 3 + drivers/hwtracing/qcom/tgu.c | 210 ++++++++++++++++++ drivers/hwtracing/qcom/tgu.h | 33 +++ 7 files changed, 276 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-t= gu create mode 100644 drivers/hwtracing/qcom/Kconfig create mode 100644 drivers/hwtracing/qcom/Makefile create mode 100644 drivers/hwtracing/qcom/tgu.c create mode 100644 drivers/hwtracing/qcom/tgu.h diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu b/Do= cumentation/ABI/testing/sysfs-bus-coresight-devices-tgu new file mode 100644 index 000000000000..ccc2bc92edcd --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu @@ -0,0 +1,9 @@ +What: /sys/bus/coresight/devices//enable_tgu +Date: December 2025 +KernelVersion 6.18 +Contact: Jinlong Mao , Songwei Chai +Description: + (RW) Set/Get the enable/disable status of TGU + Accepts only one of the 2 values - 0 or 1. + 0 : disable TGU. + 1 : enable TGU. diff --git a/drivers/Makefile b/drivers/Makefile index 20eb17596b89..46cd62aabfe8 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -176,6 +176,7 @@ obj-$(CONFIG_RAS) +=3D ras/ obj-$(CONFIG_USB4) +=3D thunderbolt/ obj-$(CONFIG_CORESIGHT) +=3D hwtracing/coresight/ obj-y +=3D hwtracing/intel_th/ +obj-y +=3D hwtracing/qcom/ obj-$(CONFIG_STM) +=3D hwtracing/stm/ obj-$(CONFIG_HISI_PTT) +=3D hwtracing/ptt/ obj-y +=3D android/ diff --git a/drivers/hwtracing/Kconfig b/drivers/hwtracing/Kconfig index 911ee977103c..8a640218eed8 100644 --- a/drivers/hwtracing/Kconfig +++ b/drivers/hwtracing/Kconfig @@ -7,4 +7,6 @@ source "drivers/hwtracing/intel_th/Kconfig" =20 source "drivers/hwtracing/ptt/Kconfig" =20 +source "drivers/hwtracing/qcom/Kconfig" + endmenu diff --git a/drivers/hwtracing/qcom/Kconfig b/drivers/hwtracing/qcom/Kconfig new file mode 100644 index 000000000000..d6f6d4b0f28e --- /dev/null +++ b/drivers/hwtracing/qcom/Kconfig @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# QCOM specific hwtracing drivers +# +menu "Qualcomm specific hwtracing drivers" + +config QCOM_TGU + tristate "QCOM Trigger Generation Unit driver" + help + This driver provides support for Trigger Generation Unit that is + used to detect patterns or sequences on a given set of signals. + TGU is used to monitor a particular bus within a given region to + detect illegal transaction sequences or slave responses. It is also + used to monitor a data stream to detect protocol violations and to + provide a trigger point for centering data around a specific event + within the trace data buffer. + +endmenu diff --git a/drivers/hwtracing/qcom/Makefile b/drivers/hwtracing/qcom/Makef= ile new file mode 100644 index 000000000000..5a0a868c1ea0 --- /dev/null +++ b/drivers/hwtracing/qcom/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_QCOM_TGU) +=3D tgu.o diff --git a/drivers/hwtracing/qcom/tgu.c b/drivers/hwtracing/qcom/tgu.c new file mode 100644 index 000000000000..368bb196b984 --- /dev/null +++ b/drivers/hwtracing/qcom/tgu.c @@ -0,0 +1,210 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../coresight/coresight-priv.h" +#include "tgu.h" + +DEFINE_CORESIGHT_DEVLIST(tgu_devs, "tgu"); + +static void tgu_write_all_hw_regs(struct tgu_drvdata *drvdata) +{ + CS_UNLOCK(drvdata->base); + /* Enable TGU to program the triggers */ + writel(1, drvdata->base + TGU_CONTROL); + CS_LOCK(drvdata->base); +} + +static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode, + void *data) +{ + struct tgu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + + guard(spinlock)(&drvdata->lock); + if (drvdata->enable) + return -EBUSY; + + tgu_write_all_hw_regs(drvdata); + drvdata->enable =3D true; + + return 0; +} + +static int tgu_disable(struct coresight_device *csdev, void *data) +{ + struct tgu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); + + spin_lock(&drvdata->lock); + if (drvdata->enable) { + CS_UNLOCK(drvdata->base); + writel(0, drvdata->base + TGU_CONTROL); + CS_LOCK(drvdata->base); + + drvdata->enable =3D false; + } + spin_unlock(&drvdata->lock); + return 0; +} + +static ssize_t enable_tgu_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + bool enabled; + struct tgu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + + spin_lock(&drvdata->lock); + enabled =3D drvdata->enable; + spin_unlock(&drvdata->lock); + + return sysfs_emit(buf, "%d\n", enabled); +} + +/* enable_tgu_store - Configure Trace and Gating Unit (TGU) triggers. */ +static ssize_t enable_tgu_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t size) +{ + int ret =3D 0; + unsigned long val; + struct tgu_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + + ret =3D kstrtoul(buf, 0, &val); + if (ret) + return ret; + + if (val) { + ret =3D pm_runtime_resume_and_get(dev->parent); + if (ret) + return ret; + ret =3D tgu_enable(drvdata->csdev, CS_MODE_SYSFS, NULL); + if (ret) + pm_runtime_put(dev->parent); + } else { + ret =3D tgu_disable(drvdata->csdev, NULL); + pm_runtime_put(dev->parent); + } + + if (ret) + return ret; + return size; +} +static DEVICE_ATTR_RW(enable_tgu); + +static const struct coresight_ops_helper tgu_helper_ops =3D { + .enable =3D tgu_enable, + .disable =3D tgu_disable, +}; + +static const struct coresight_ops tgu_ops =3D { + .helper_ops =3D &tgu_helper_ops, +}; + +static struct attribute *tgu_common_attrs[] =3D { + &dev_attr_enable_tgu.attr, + NULL, +}; + +static const struct attribute_group tgu_common_grp =3D { + .attrs =3D tgu_common_attrs, + NULL, +}; + +static const struct attribute_group *tgu_attr_groups[] =3D { + &tgu_common_grp, + NULL, +}; + +static int tgu_probe(struct amba_device *adev, const struct amba_id *id) +{ + int ret =3D 0; + struct device *dev =3D &adev->dev; + struct coresight_desc desc =3D { 0 }; + struct coresight_platform_data *pdata; + struct tgu_drvdata *drvdata; + + desc.name =3D coresight_alloc_device_name(&tgu_devs, dev); + if (!desc.name) + return -ENOMEM; + + pdata =3D coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + + adev->dev.platform_data =3D pdata; + + drvdata =3D devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + drvdata->dev =3D &adev->dev; + dev_set_drvdata(dev, drvdata); + + drvdata->base =3D devm_ioremap_resource(dev, &adev->res); + if (!drvdata->base) + return -ENOMEM; + + spin_lock_init(&drvdata->lock); + + drvdata->enable =3D false; + desc.type =3D CORESIGHT_DEV_TYPE_HELPER; + desc.pdata =3D adev->dev.platform_data; + desc.dev =3D &adev->dev; + desc.ops =3D &tgu_ops; + desc.groups =3D tgu_attr_groups; + + drvdata->csdev =3D coresight_register(&desc); + if (IS_ERR(drvdata->csdev)) { + ret =3D PTR_ERR(drvdata->csdev); + goto err; + } + + pm_runtime_put(&adev->dev); + return 0; +err: + pm_runtime_put(&adev->dev); + return ret; +} + +static void tgu_remove(struct amba_device *adev) +{ + struct tgu_drvdata *drvdata =3D dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); +} + +static const struct amba_id tgu_ids[] =3D { + { + .id =3D 0x000f0e00, + .mask =3D 0x000fffff, + .data =3D "TGU", + }, + { 0, 0, NULL }, +}; + +MODULE_DEVICE_TABLE(amba, tgu_ids); + +static struct amba_driver tgu_driver =3D { + .drv =3D { + .name =3D "qcom-tgu", + .suppress_bind_attrs =3D true, + }, + .probe =3D tgu_probe, + .remove =3D tgu_remove, + .id_table =3D tgu_ids, +}; + +module_amba_driver(tgu_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Qualcomm TGU driver"); diff --git a/drivers/hwtracing/qcom/tgu.h b/drivers/hwtracing/qcom/tgu.h new file mode 100644 index 000000000000..1a55da90f521 --- /dev/null +++ b/drivers/hwtracing/qcom/tgu.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#ifndef _QCOM_TGU_H +#define _QCOM_TGU_H + +/* Register addresses */ +#define TGU_CONTROL 0x0000 + +/** + * struct tgu_drvdata - Data structure for a TGU (Trigger Generator Unit) + * @base: Memory-mapped base address of the TGU device + * @dev: Pointer to the associated device structure + * @csdev: Pointer to the associated coresight device + * @lock: Spinlock for handling concurrent access + * @enable: Flag indicating whether the TGU device is enabled + * + * This structure defines the data associated with a TGU device, + * including its base address, device pointers, clock, spinlock for + * synchronization, trigger data pointers, maximum limits for various + * trigger-related parameters, and enable status. + */ +struct tgu_drvdata { + void __iomem *base; + struct device *dev; + struct coresight_device *csdev; + spinlock_t lock; + bool enable; +}; + +#endif --=20 2.34.1