From patchwork Tue Sep 20 12:50:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12982100 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 41857C54EE9 for ; Tue, 20 Sep 2022 12:56:33 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SVVybx1Ttl5AreH6QiMJVczWlytTi+QVhxjIHl9M/14=; b=NC6ioMwma277SF 5zOplfQx/2tCqHMQUVdmz9d8adFNDW4QDSeb79MxZar7Zv0T35BoIrpncd3jlKZdDDqB8szz8XMpo gjYrPC6cKeeHqG6VZPQUc2Zs+MfVuSkthfedK1xfmUn/Sdu6Oj6Ey0SVHArtYS9e228LeJmS1cpvc v184QJPupwnsiOTGqbFIkUrJcgvtfDXpiADdax5yyUOYNI+pivIrggm7mr4iZhYgjvBn1HEn4Sgck 9w53Z86r+8Tip+V+0U0IQwAgn2KdHK7qOQW0l5HotBtEM3xRnBnzcmvOTueFct2KgKvIVTQMhKZgD fCjCQUZZM3bfE2NpM40A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oacmX-003rAy-NS; Tue, 20 Sep 2022 12:55:22 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oackk-003q20-7G; Tue, 20 Sep 2022 12:53:33 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 42659320096D; Tue, 20 Sep 2022 08:53:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 20 Sep 2022 08:53:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1663678407; x= 1663764807; bh=bznVlAm7CcwW9vUQI8XUe6+ILjJSwqZMClSNEtYWnA0=; b=A sKMnczh+2BDL5xM7Pns5gd6SDZYEktsEDc/vVkS4rEjfxNoDnlh54KLAqZoj+RUC 5e0LP628Bcs6VyT54Kry52Ve8eIA3Bf4KE4PrsrnDHBzWm3cnORgNIVHr2bT2PO6 4EmG4R3iqwawCgeyJOyYhJuz1B3r0Y3eOfwJHBkuO73t+Ja7KYJD7TNJzwOYpLVS xpmIGyixS3vjMzevFdRQWST1uci5Ct/exPmw6MgHQK/qLXa/YYqdCYK3Q7iiAN3a fqgfB8YqkFh4yJmzHL6SFjPnvwIUgpiOsU4owhRrqbjsYrU9xs28w6D6KWBGyodd po53ovDXB6sJmwrMg0qqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663678407; x= 1663764807; bh=bznVlAm7CcwW9vUQI8XUe6+ILjJSwqZMClSNEtYWnA0=; b=X sOjUiFRSJbBFqt7qfe9eyPPr/XCQIHIOAKYEMuQi2fdOPzzz8aafL6iJ0csi85EU NeLlCVajKAFgCsKioZt19cgvn+0i3SmuUkPYJUaUxYhFJ4oXUFshnUO4he09djAJ 85q8mM3oEjJo/hbTlsMNmRELyVHCtzPpKT56yahoJ+h3w63DyldkbVTaRSX1RMhE T+sTCJ56+uJAMhlC0+5s5/6qLDEzXdiJDCYqblMhK9wFIQqaOv1t4XpVWt9odgOS ZZi1IGFxKvk6loq0bXG1CUb21QyPxgW2BwWrNG1GNQpUYMLtntgD6ptlBnI1rO1e /ZqoJIR+oVd1B3RSRmXuA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvledgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepudduudfhveejteefgedvffdvvedvjedugedukeejhedtlefhffevtefh jeeltdevnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Sep 2022 08:53:27 -0400 (EDT) From: Maxime Ripard Date: Tue, 20 Sep 2022 14:50:20 +0200 Subject: [PATCH v2 1/7] firmware: raspberrypi: Introduce rpi_firmware_find_node() MIME-Version: 1.0 Message-Id: <20220815-rpi-fix-4k-60-v2-1-983276b83f62@cerno.tech> References: <20220815-rpi-fix-4k-60-v2-0-983276b83f62@cerno.tech> In-Reply-To: <20220815-rpi-fix-4k-60-v2-0-983276b83f62@cerno.tech> To: Daniel Vetter , Florian Fainelli , David Airlie , Broadcom internal kernel review list , Michael Turquette , Scott Branden , Stephen Boyd , Emma Anholt , Ray Jui , Maxime Ripard Cc: linux-rpi-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Dom Cobley , dri-devel@lists.freedesktop.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2058; i=maxime@cerno.tech; h=from:subject:message-id; bh=sPYmav9OfSnKW2AKxDc1YspDgs/8ZuYriYV4H73zKeE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMma2/nUStbW2dvqKh7+InZYRUJb3HGb4tu1zj1sN6e/jttj aZreUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIlk3mBkmFAcxfuX74pIYrZNyaWkn4 VhvfInT0/x0D20Zu6Zm/MFBBj+B+7pM/pjtPlmbfz90J/bzUrmn15gNf+5XLnHlzutVVuYWAE= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_055331_007453_779BB1FC X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. 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 A significant number of RaspberryPi drivers using the firmware don't have a phandle to it, so end up scanning the device tree to find a node with the firmware compatible. That code is duplicated everywhere, so let's introduce a helper instead. Signed-off-by: Maxime Ripard diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 4b8978b254f9..b916e1e171f8 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -311,6 +311,13 @@ static int rpi_firmware_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id rpi_firmware_of_match[]; +struct device_node *rpi_firmware_find_node(void) +{ + return of_find_matching_node(NULL, rpi_firmware_of_match); +} +EXPORT_SYMBOL_GPL(rpi_firmware_find_node); + /** * rpi_firmware_get - Get pointer to rpi_firmware structure. * @firmware_node: Pointer to the firmware Device Tree node. diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h index 811ea668c4a1..63426082bcb9 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -142,6 +142,7 @@ int rpi_firmware_property(struct rpi_firmware *fw, int rpi_firmware_property_list(struct rpi_firmware *fw, void *data, size_t tag_size); void rpi_firmware_put(struct rpi_firmware *fw); +struct device_node *rpi_firmware_find_node(void); struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); struct rpi_firmware *devm_rpi_firmware_get(struct device *dev, struct device_node *firmware_node); @@ -159,6 +160,12 @@ static inline int rpi_firmware_property_list(struct rpi_firmware *fw, } static inline void rpi_firmware_put(struct rpi_firmware *fw) { } + +static inline struct device_node *rpi_firmware_find_node(void) +{ + return NULL; +} + static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) { return NULL;