From patchwork Sun Jul 7 23:08:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 13726094 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 A049EC38150 for ; Sun, 7 Jul 2024 23:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type: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=77XSkvlQIr28+bKyNg6oFQCBJgUK3izqWxxyk+Vakb4=; b=y2IieMfAvvAByQDcmw3AnL4p89 Ll7ekQO3i45BSOraDv2JhDpg8PpFmYsxGB8VOL1JplbkEd0V/yIaQ+LwlaqemE3b2bU90uTw83Owh yA9cUmEjBg+M00o7GJFx0SQq4JVKd3voTYTzJYzgOzQgm0x0WEcZwuKiOZbD2bLp7FhUvzyufuTIX BAlMKImB9/dR4CTGthJfR7A9QYsGg7oFTyzYAE/ZK42tff9fBjBYMSJyGNzsecZv0yChVU/QoH2/0 KzQy/mMhq27xP9AumkV2dCkPLWYr5Jm8OIxWaTiT4OPysZxRmSU2gjMXYtOEbEZN9g6y4z5jVB71P mmJq/a2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQb09-00000002Oto-22bg; Sun, 07 Jul 2024 23:09:01 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQaze-00000002OmN-0eWy; Sun, 07 Jul 2024 23:08:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1720393703; x=1720998503; i=j.neuschaefer@gmx.net; bh=77XSkvlQIr28+bKyNg6oFQCBJgUK3izqWxxyk+Vakb4=; h=X-UI-Sender-Class:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Z49rSOr1B3bbxAQFbdCqiLsg8WVOSsFyL9TaaXRTBZWKsYgTnHJoLsOGPxm90CyX svy2WVMPT9K85rpZiEaOOdbOSNtCAeFldZrcsbsk/Elqz1xIrweySrAt8imvuXJPe rezJLps44tBqabfAbGz0V5H51hEhuKISV0tOc6hCTJPn1uv4EVUDq1kFH7ikrw9Dt 8tl4fkcIyxstlpyDBzbbjcNVxaELBctwxQh2vlBp8mrWRI8bfWOUJX09hqN7b4ifu hjBrNzaY8PqmWWzGVN6xMBZencEf4uOhkG8pZifg4eadFVWZvHIZYhlimfjVSY7ww bu8iNDtMOHV5FbI22Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([89.0.46.161]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MTABT-1sp9iK21Md-00MWRb; Mon, 08 Jul 2024 01:08:23 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= Date: Mon, 08 Jul 2024 01:08:15 +0200 Subject: [PATCH 2/2] ARM: bcm2835: Detect system revision MIME-Version: 1.0 Message-Id: <20240708-raspi-revision-v1-2-66e7e403e0b5@gmx.net> References: <20240708-raspi-revision-v1-0-66e7e403e0b5@gmx.net> In-Reply-To: <20240708-raspi-revision-v1-0-66e7e403e0b5@gmx.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Eric Anholt , Stefan Wahren , Russell King Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Jonathan_Neusch=C3=A4fer?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720393700; l=1606; i=j.neuschaefer@gmx.net; s=20240329; h=from:subject:message-id; bh=dVk42FInQTKZB02x3CBBX1O/q0YT85Unj6HDWJIP/u8=; b=9xw8+iBqU5IyUvOOiey/jc5QdiOiw3lfDwft94j4hoBEbfz+uNyrKlLXtoIBsx3amHlox2XT1 hLl/WTCRtm2BZnejJfVV4GjZhV+V7ea1saNWTpPVrQ2kN7pyU0UkzpU X-Developer-Key: i=j.neuschaefer@gmx.net; a=ed25519; pk=NIe0bK42wNaX/C4bi6ezm7NJK0IQE+8MKBm7igFMIS4= X-Provags-ID: V03:K1:QRzrRDyeZVlzHXj/u2aw51EEVrFDtw9L3XKpSWa/lm1xhphvYjf yVfiD/rFDcrDNsJ+V4Iu94TxdkxCKk+c6m7O1iQETmX0V32xACl72NjGST9XDhPdmnfouqd xstHHHPAc77TrE/64Z8NdPV6lwAYcgIa6HupB5G6SEjl0EE4nDr9mI8ENfLv8mtiRAReUEN kBFquEubheDHxtNu3oMFQ== UI-OutboundReport: notjunk:1;M01:P0:O8/6BaM/afY=;a7Gn5BPXgcQ23VLE19RmiArYlvj UGWAGrIkdGFZgGTz5dbGhz1//7QnEzTUKw8YVkucReZlNU9FcrBIdOawW7T6APmCfqaK9snPH U/y/ZxyYeWHz1vbDzHpqKKXMKOFb3yivE1M79+bnXl8liCgyQsCreBkwgrL0nTFIH4w+ofWNP B3+jkqFj6zR44QcCfR9HKJfRoMF6vFgojrT9ZCXwFOjw98+K+Vy7myLomSfUs1B3H/kGbW4VZ wQ96hTQRZzXlkTvFCY4XfF5iPRLVBAg4Ppw9Yh7kek+KFVTpJSEw/3B6i5/IihC+AQKheV8FR ztX1sxsAzmoNV/+MXDDfkOIqQyR7gas1N4GPPVuU3/O/78ysiFvlAkrJq520mA8lasxBsNEXj jgdA0n1+kmkiFS3dtWR9i5pf1DziafEdvqN4W447Cn8La5KYFeT5w26z0SonUzTXn4bHgF/aR iWaLWxH2vRXxe5pGJtJ/fhNvqbAsAmEhHQ4gQG5VEUjH9PNx04A2GP2StpqrEQoRVhyrRZgV3 n5IIlIGKhx5yEBnYFkltgf7ckKe28/HOOpoFg2xmB+O+fVgwGbT8h96SDcVCAlBWIekswATKF NcXcmIj+VgNhmQybZRTFWZPXIt+ExY3WRxJzgs6ywDlFtvXTOzo+0sIKPU/0aH7QpuWLkmGsj Bwc0Q9byICieP3SyeazTzsW3j5AWfDHgQyoU1AN/KG0i4YGbS4UKC1IykY7iKCp3//pS7Y8YU CPqIpRfvXFLU9M3n774DnT+jRG0JH9JiZwj59mqLF6kI1pjsmRXMQsHWKlrQUudvVF3qtoXhB j8n6G3uOqIB7s+OZBrnkZeZpUtCfQflVT9FcFGtRPNHko= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240707_160830_513617_5FF2CD67 X-CRM114-Status: GOOD ( 10.75 ) 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 The Raspberry Pi bootloader provides a revision code[0] in the devicetree, at /system/linux,revision. The downstream kernel then uses this DT property to fill the system_rev variable, which is exposed to userspace via the "Revision" field in /proc/cpuinfo. Some software[1] relies on this in order to determine the Raspberry Pi model. This patch ports the revision detection from the downstream Raspberry Pi kernel. [0]: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes [1]: https://github.com/hzeller/rpi-rgb-led-matrix/blob/a3eea997a9254b83ab2de97ae80d83588f696387/lib/gpio.cc#L247 Signed-off-by: Jonathan Neuschäfer --- arch/arm/mach-bcm/board_bcm2835.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.43.0 diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c index bfc556f7672039..2a7b7ba3cd6c73 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -9,6 +9,7 @@ #include #include +#include #include "platsmp.h" @@ -23,7 +24,17 @@ static const char * const bcm2835_compat[] = { NULL }; +static void __init bcm2835_init(void) +{ + struct device_node *np = of_find_node_by_path("/system"); + u32 val; + + if (!of_property_read_u32(np, "linux,revision", &val)) + system_rev = val; +} + DT_MACHINE_START(BCM2835, "BCM2835") .dt_compat = bcm2835_compat, .smp = smp_ops(bcm2836_smp_ops), + .init_machine = bcm2835_init, MACHINE_END