Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2619613rdb; Mon, 4 Dec 2023 02:51:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IF513LTWwYQnP/DIE21TcmRv9g7O3jbMwzutV6Sdyi1o/XeuELV9x5E/WpwkUJX59Vfy4i9 X-Received: by 2002:a92:cc4f:0:b0:35d:59a2:3334 with SMTP id t15-20020a92cc4f000000b0035d59a23334mr4366924ilq.56.1701687070026; Mon, 04 Dec 2023 02:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701687069; cv=none; d=google.com; s=arc-20160816; b=MyfxyUbFJCOTIL9m/6fnjlvsCyfZhI8B1CMnPHbtzJRkGXQ8pfCgsYh5zpxW6gZIY3 Kh8MvPZKQTRuz+vaGBXHiEXSQsCE2Zw6NsIvNUXWVs0RogHgG7VN2TqP0yNQMgHpTs3e VHqYG4VigTPHFLlWw9zvdhJxCNBT8Ymlb+iLQsnlgMrfy+9dZzN3cobjOWfWIixmsvPD 0FTxOSSZFPoGTi0EAnWndLdXXVK0L4aFihIe60CBOBrSiwFv55YF6ptrGs95vO+gDk0a ltGTc8hs4QEjL65yWSYLRbiDWu+qob5zdKGrl4Ti0iMid1CzyiY6srv4fgvM7OyAtyz8 VzOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=3tcCiep0+S8o6l47CypYfcB8XE+K9uEmKFeX8Wue/e4=; fh=J/YEZtqMMawSum8iINyq9rMnFLp3qIC5tC/K6nPyKx8=; b=mNo+gWkftJkZq0f+8z5Ho/jLuqLfb1cZ4YP4vLImeoEDhQL2pz2947ATPgjUUXQdVO a/PfeXGPNb0SonAWIMePieBdAXy9bOvqIc3VHhQJJDQa/3iBLLkQzq2eu/vK7zkI0cvQ dLlI+v6Zqsu4+u3adpwqeu0v3njEHvKehesolPVYriI4gIrmoih97MG8y++PUeUxGBa5 uSgj8fvgTSnBW2m6NoEUzqoOZy4IcK1J+mKOTqT6OQWKD/8uOoDQDvhPVtCZkfG5Xtsm OoD6xPN5peXMUwKWAU8bo4NgGoyJIQfgf0g2AN2FjZTLYrafDT9apk7KXTgczOv3FSdu vxEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 189-20020a6300c6000000b005c66cf231d7si3025525pga.336.2023.12.04.02.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 02:51:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C3561807DE0B; Mon, 4 Dec 2023 02:51:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235317AbjLDKur (ORCPT + 99 others); Mon, 4 Dec 2023 05:50:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343887AbjLDKul (ORCPT ); Mon, 4 Dec 2023 05:50:41 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50013C3; Mon, 4 Dec 2023 02:50:47 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47520139F; Mon, 4 Dec 2023 02:51:34 -0800 (PST) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D08A3F6C4; Mon, 4 Dec 2023 02:50:43 -0800 (PST) Message-ID: Date: Mon, 4 Dec 2023 10:50:42 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver Content-Language: en-US To: James Clark , Anshuman Khandual , linux-arm-kernel@lists.infradead.org Cc: Lorenzo Pieralisi , Sudeep Holla , Mike Leach , Maxime Coquelin , Alexandre Torgue , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-stm32@st-md-mailman.stormreply.com References: <20231201062053.1268492-1-anshuman.khandual@arm.com> <20231201062053.1268492-6-anshuman.khandual@arm.com> <12a9c5da-4b96-78de-4007-211989bdcfa3@arm.com> From: Suzuki K Poulose In-Reply-To: <12a9c5da-4b96-78de-4007-211989bdcfa3@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 02:51:06 -0800 (PST) On 04/12/2023 10:42, James Clark wrote: > > > On 01/12/2023 06:20, Anshuman Khandual wrote: >> Add support for the tmc devices in the platform driver, which can then be >> used on ACPI based platforms. This change would now allow runtime power >> management for ACPI based systems. The driver would try to enable the APB >> clock if available. >> >> Cc: Lorenzo Pieralisi >> Cc: Sudeep Holla >> Cc: Suzuki K Poulose >> Cc: Mike Leach >> Cc: James Clark >> Cc: linux-acpi@vger.kernel.org >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Cc: coresight@lists.linaro.org >> Signed-off-by: Anshuman Khandual >> --- >> drivers/acpi/arm64/amba.c | 2 - >> .../hwtracing/coresight/coresight-tmc-core.c | 130 +++++++++++++++--- >> drivers/hwtracing/coresight/coresight-tmc.h | 1 + >> 3 files changed, 115 insertions(+), 18 deletions(-) >> > [...] >> -static int tmc_probe(struct amba_device *adev, const struct amba_id *id) >> +static int __tmc_probe(struct device *dev, struct resource *res, void *dev_caps) >> { >> int ret = 0; >> u32 devid; >> void __iomem *base; >> - struct device *dev = &adev->dev; >> struct coresight_platform_data *pdata = NULL; >> - struct tmc_drvdata *drvdata; >> - struct resource *res = &adev->res; >> + struct tmc_drvdata *drvdata = dev_get_drvdata(dev); >> struct coresight_desc desc = { 0 }; >> struct coresight_dev_list *dev_list = NULL; >> >> ret = -ENOMEM; >> - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); >> - if (!drvdata) >> - goto out; >> - >> - dev_set_drvdata(dev, drvdata); >> >> /* Validity for the resource is already checked by the AMBA core */ >> base = devm_ioremap_resource(dev, res); >> @@ -487,8 +482,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) >> desc.type = CORESIGHT_DEV_TYPE_SINK; >> desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM; >> desc.ops = &tmc_etr_cs_ops; >> - ret = tmc_etr_setup_caps(dev, devid, >> - coresight_get_uci_data(id)); >> + ret = tmc_etr_setup_caps(dev, devid, dev_caps); >> if (ret) >> goto out; > [...] >> -module_amba_driver(tmc_driver); >> +static int tmc_platform_probe(struct platform_device *pdev) >> +{ >> + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> + struct tmc_drvdata *drvdata; >> + int ret = 0; >> + >> + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); >> + if (!drvdata) >> + return -ENOMEM; >> + >> + drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev); >> + if (IS_ERR(drvdata->pclk)) >> + return -ENODEV; >> + >> + dev_set_drvdata(&pdev->dev, drvdata); >> + pm_runtime_get_noresume(&pdev->dev); >> + pm_runtime_set_active(&pdev->dev); >> + pm_runtime_enable(&pdev->dev); >> + >> + ret = __tmc_probe(&pdev->dev, res, NULL); > > What effect does passing NULL here have? It seems like the dev_caps did > something useful when it's set to CORESIGHT_SOC_600_ETR_CAPS. Maybe > Suzuki knows as he added it? That was supposed to initialise the capabilities of the TMC-ETR, which are not discoverable by ID registers. (e.g., SAVE restore of RRP/RWP). I guess, we could get rid of that cap and use the "PID" register match to figure out the capabilities. Suzuki