From patchwork Sun Jul 7 23:08:14 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: 13726095 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 6B860C3DA41 for ; Sun, 7 Jul 2024 23:09:23 +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=rHQsHXPo5ANfTRvxba5Xnn2aInYxUPu4/gZAELBFVNY=; b=QFs01M943mG5Z/zQhYbS48e8nm 1QgjwvAv0NEMyjiJbVnVYtzZzUXxFKbvM4Z4j4SbCunoH6DFfY1WLqoOaF3bQSZb2dz37FTSejyrY 2YxUR82Wf76wMGWLPkXFXedvuduFdz5WrGziy5wdHYExQP7SI7norUT034CV8tZnB+31g+bDONCJL riFOIAZj98PDQsPDqNnyRnl2SJ2N0ved//lA55E7NiEfDlgSIZ5+pgRbaSSdTUS6V9fBU5eZ0nHrB DQhECJU2a//SIUpVR2ueIRYT1D6fikmJliT7qJrViqjvup0DVt7Y4qxNZlPG42TTg6smYZ5Ij8xXC d+Bzgaxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQb0L-00000002OzP-23Nn; Sun, 07 Jul 2024 23:09:13 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQaze-00000002OmM-0Ola; Sun, 07 Jul 2024 23:08:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1720393702; x=1720998502; i=j.neuschaefer@gmx.net; bh=rHQsHXPo5ANfTRvxba5Xnn2aInYxUPu4/gZAELBFVNY=; 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=feB7IUdGRjt2DZ0jG4+VTIb55v1i/+l86ceVrjO7DNz4+XyWyI+uUeEEcr6FPu0w /zS5nOvwAprkwRuAUxyCrMZLc9vslU/PL95S92JgIuSh3FHYA7VhkpYKKk86H1hRP lqR3rMWWqehFzy3JsGE+Oj930lQzbfE/LJ1yrPuSDulWHLpEXEnaZE3sUO3CqWgiP rkzoGRQZmtOhL3cLoDKpWGy5MyvVJVBl1c9vcXttM7i8v7ragM/gQaZivM5L8U7H0 0thyu/zMxpMvpQhs4xEfshK0imbmE6srq+f9BMS76WE7xtRmFh31n0eipEFO1s2nU jtHGm61J1uYEiI4IHw== 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 1Mjj87-1rxKdp2pGF-00f1Gp; Mon, 08 Jul 2024 01:08:22 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= Date: Mon, 08 Jul 2024 01:08:14 +0200 Subject: [PATCH 1/2] dt-bindings: arm: bcm2835: Specify /system/linux,revision property MIME-Version: 1.0 Message-Id: <20240708-raspi-revision-v1-1-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=1326; i=j.neuschaefer@gmx.net; s=20240329; h=from:subject:message-id; bh=CH0h/rMYcfWtKxJDlLMxtCMqdP5QD4SXR1lZ4bdD/N4=; b=5w0uVFOyLApniryuo2OANod7N+IYoxonjc/9jFBoitiEG4F8yT9e0YPOvxVvf7vAJV4RdYCO3 2XOSXiPI6FCAkMq6eqgAnoNryUSwcF/KbKMH+sOWTYw7G+7lToyv8Xr X-Developer-Key: i=j.neuschaefer@gmx.net; a=ed25519; pk=NIe0bK42wNaX/C4bi6ezm7NJK0IQE+8MKBm7igFMIS4= X-Provags-ID: V03:K1:tMOB8xxsjl5P+9YdnZBzT+rdJLsFSmqcM52OrGP7uNTMid6d7ER 7s6V+12GQX25jX3J75km10eENPjab/nEUZq7OdwRFBaYfbSZUkIUJuBWiljNNZNQ/VoxzW1 XtFI+PvH6y4hYN2qFgtmv9VkssypOiVh4JcVnzus1H65EHmM52ePaSH9XlGXoVjldApA9PH pMRCF6l1yLTYNBRVl30Ng== UI-OutboundReport: notjunk:1;M01:P0:E+c6H4qH2C4=;kNUsWqstbTIJw2UiOrbAfg5jJGL b6IEVwOwH/orB/CH//tBNq+1KLysu6X1DzlCvJXoM5z9R0Rii0Mfnl4y3uSRO3HmB3f3aA/AK 4qE6Pmj1+pMCkj/63jvhe9TcsgsuLg4e8fiZQL0JxwsJTUuW93cTwMBi4RJ7FRWpimII+2XTP tqKfnb+JCmDW6BrBhWjaz9GqhzEsRTUBas0F/SzHvuMVN7N0aMgKtRTG6RyhM6UsGYo1dxxtU O8yJ3fLR4psaB8vkDdNPb53lrT5jNNna45FzAbAZMn4EXkStt71gZ1iWdHe5HOJemRI4MfMof oEFXFdik5cDqLLfVACCC2Q3ZBlvpvAIDd79MeU3JLgMCpYXDAWhHFxN1te0d/eF3yA02/A1QZ BNZHmXiTngRitLuoXqf0F6lmWCBY888E9GRl8YWl+QbNvlCuHYJhw0W7L8wWnmzq3ssK6989v 65LqzC4J6K/HjA/M6ULz2hWWlvF2ewcj3s3Ro99vwN6dWOXAO+KKZgv/HyZHynUh7rH0EVI/z 4t6KS6Qa1x6K4Np93JqsD2+VL2Dw2IZ5W3Kx8Ss3evfzTTsx+WILPnqYoHHht2IXicJvDV5pB w+tSPfVPLO+vBh+FKUNw9uJgRcNnSoE+EhjyTcCFCPV2G6H+ZqhtRh78kRTQQSb/nb8yGFsnb 3wIePraHNqgsnmG/umSVjCyQvbCINiA6nl7EZ9qi21t3mGYKH/D3fzbdulu/+bUsOS6nVrS6v 93toDU84G0T1Bfo9oDOvDfry8AGRdi+LVM9yfcsHNKw+tZvDNGNaudJT2FV90HYEM8RRJT0nl 5LZyaWw8uZHlnJCV0KXY7jahr79/iei/lgkN57AGeIZnU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240707_160830_456392_CD77E341 X-CRM114-Status: UNSURE ( 9.63 ) 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 The Raspberry Pi bootloader provides a revision code[0] in the devicetree, at /system/linux,revision. This patch adds /system/linux,revision to the schema to allow it to be used in mainline Linux. [0]: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes Signed-off-by: Jonathan Neuschäfer --- Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.43.0 diff --git a/Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml b/Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml index 162a39dab21823..c6abf818b5ea57 100644 --- a/Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml +++ b/Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml @@ -54,6 +54,18 @@ properties: - raspberrypi,model-zero-2-w - const: brcm,bcm2837 + system: + type: object + additionalProperties: true + properties: + + linux,revision: + $ref: /schemas/types.yaml#/definitions/string-array + description: + The "system revision" number, as determined by the bootloader. + https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes + + additionalProperties: true ... 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/C4bi6ez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JH9JiZwj59mqLF6kI1pjsmRXMQsHWKlrQUudvVF3qtoXhB 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