From patchwork Fri Mar 17 03:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 13178463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A7ADC6FD1F for ; Fri, 17 Mar 2023 03:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BmpNgTSJdRovXeEihRrrNo3gOt3f+stUhwwvG8qXqKE=; b=htcoPib2FPP7Qn IIsXz/jQ7UKfh2Cz7EdEuyZ3m+FX1oHRqj3EtAuCGdQ04Oe12Gu6986yOWOQYd1E/r+wDPj/HCTKQ qbHy97iO+nPo62xsza467KyfZyDxFUeT/igyMSaxVMTa4lPLG057q6wqGKFFsoCDEbxILEAf+moxs Qn1X96ZZ+lzP7h4wAUdhCjex9RJZTmcIhtpJn613GAiw8forE5m244eii2skly23/I5GyyZP46u/V JVBGnN/aLa6PJb3aaKLDlHE2lBQCQnIj7ubdJZZ++rkscTg+eFHsIbCB6Y/sHHjFaCGQm9n9ltDZF RfhdOXST537cZh/HCOZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pd0Pw-000j9W-0c; Fri, 17 Mar 2023 03:06:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pd0Pq-000j5w-0V for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2023 03:06:04 +0000 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 826B24B3; Thu, 16 Mar 2023 20:06:43 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C0DE63F64C; Thu, 16 Mar 2023 20:05:53 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] of/platform: Skip coresight etm4x devices from AMBA bus Date: Fri, 17 Mar 2023 08:35:00 +0530 Message-Id: <20230317030501.1811905-7-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230316_200602_277962_39785EED X-CRM114-Status: GOOD ( 15.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow other drivers to claim a device, disregarding the "priority" of "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO (AMBA Bus) or via CPU system instructions. The CoreSight ETM4x platform driver can now handle both types of devices. In order to make sure the driver gets to handle the "MMIO based" devices, which always had the "arm,primecell" compatible, we have two options : 1) Remove the "arm,primecell" from the DTS. But this may be problematic for an older kernel without the support. 2) The other option is to allow OF code to "ignore" the arm,primecell priority for a selected list of compatibles. This would make sure that both older kernels and the new kernels work fine without breaking the functionality. The new DTS could always have the "arm,primecell" removed. This patch implements Option (2). Cc: Rob Herring Cc: Frank Rowand Cc: Russell King (Oracle) Cc: Greg Kroah-Hartman Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Co-developed-by: Suzuki Poulose Signed-off-by: Suzuki Poulose Signed-off-by: Anshuman Khandual --- drivers/of/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b2bd2e783445..59ff1a38ccaa 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l return NULL; } +static const struct of_device_id of_ignore_amba_table[] = { +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X + { .compatible = "arm,coresight-etm4x" }, +#endif + {} /* NULL terminated */ +}; + /** * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, platform_data = auxdata->platform_data; } - if (of_device_is_compatible(bus, "arm,primecell")) { + if (of_device_is_compatible(bus, "arm,primecell") && + unlikely(!of_match_node(of_ignore_amba_table, bus))) { /* * Don't return an error here to keep compatibility with older * device tree files.