Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2616380rdb; Mon, 4 Dec 2023 02:42:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVx+y/KyIkoE/dA+Oj91+EU0INVkRwGYwX8HF5VK3xzyY07u+oq3UfAB5t6CWng55IXQTp X-Received: by 2002:a05:6a20:a114:b0:18f:97c:975a with SMTP id q20-20020a056a20a11400b0018f097c975amr5082553pzk.66.1701686544831; Mon, 04 Dec 2023 02:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701686544; cv=none; d=google.com; s=arc-20160816; b=S1qtpKZMljev43AJXutecoYTasePZBAnk8/66fZboJzG9D3ji5PrRai0YT1STIaYv5 V6nkzFxMqxHFSqvf/YXvZ8c3RJJT6WATGaUjn2luChqTFav3EItKKmmxS/HumWxki85J LCkhVwGYViyDE7M4gFl0Jn9kCFgySHaT3Dfv3HJzwLQuzjLV6AQUCAAC70ja/ZqpOAg5 IicrswR9L2j8wCW8XNQ5iSzn6ltwqrlUil8ka/o6AWqrWJZv5kmPYEn33TnVl6WGkeSm C/dbtHEr5Go4sR8vW12av20P6nabLZXIUUUjeK7DIvhH0lfYuK1tTkIOTi0e0lRAIjak 39iQ== 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=1CO+420qJdeNNGerbksc+sszoAuVTlBNN+ZsHEwn8Co=; fh=DNJVuSSgB2G6amXbP+7fIejaD/RGwDj3qwwUFzEyOr4=; b=bs7/R1DKsuAkFQNNgX6NhqeuPed48S07Ar4oWN6x6v+4MGHcNiNS3hwTvxjy5GP+SK xrnGdt0I8YmXSHpEsM78VHIlMmBJmoN8l8AzdQN8Ywhh6XOPyGq1icaGnKb4bqFrLKiH mx8wT4g0EbWf0Au/CAk5feTZ31X+zUT+fGP9IdTLit0rIJ5KmqGS+clpplnEkn12PDqo T/rtG928a1NPXBagyb2LuXGrO9seO4ie/B/FPUtRK8o7g8lpESKAbLwblq9SidH9tD40 welhifn+or0t3udk9GPrqQPanI4lWTJ6rqnk4HvIsrX3q7nNPtRvPNoyn72wsMS7H5fP aOtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id dr1-20020a056a004a8100b006cb4d47e598si7382774pfb.141.2023.12.04.02.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 02:42:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 8AC11807865E; Mon, 4 Dec 2023 02:42:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbjLDKmJ (ORCPT + 99 others); Mon, 4 Dec 2023 05:42:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjLDKmH (ORCPT ); Mon, 4 Dec 2023 05:42:07 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FA3CF0; Mon, 4 Dec 2023 02:42:12 -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 44B581684; Mon, 4 Dec 2023 02:42:59 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B7A03F6C4; Mon, 4 Dec 2023 02:42:10 -0800 (PST) Message-ID: <12a9c5da-4b96-78de-4007-211989bdcfa3@arm.com> Date: Mon, 4 Dec 2023 10:42:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver Content-Language: en-US To: Anshuman Khandual , linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com 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> From: James Clark In-Reply-To: <20231201062053.1268492-6-anshuman.khandual@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 02:42:22 -0800 (PST) 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?