From patchwork Wed Feb 21 15:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "A. Sverdlin" X-Patchwork-Id: 13565771 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 9D8B8C48BC3 for ; Wed, 21 Feb 2024 15:48:42 +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: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:In-Reply-To:References: List-Owner; bh=5TsvGgzWAUKiCsqwtd04zQTdmAHjaeWEw2mz0Ty3ZZM=; b=3ZMZQntfnAP8mC zlaE0GgZ2xUukNlPgvwY6FAw24nFAim2P3KjD/+ZMbGePoHGdjw5AG8AhIqh7Z8bZ9IBAZ4pIq3eB vt06asJlKpaboUegYrsP/0IQ0lPNZze28XBoPaCCsP6Hq3pXWaEat2dHlaZWU93M/2AI+SS5W46hb App/To/5M7Ho++RrEwVS15Roedj+37ZpHtFWULpcS1+Z/Wnf5I0DLuBgKuH/AksNzll8YlCmXFgMC i4hw4GUIsx75CZ23kSls08vlS/GnZtQ+MplYcgcAWc7hHD30acrIDIucPa2MJvMJo2KM4LSNISC9U MtSsfTn0EQLWqgnuIZmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcopd-00000001YLD-4BnE; Wed, 21 Feb 2024 15:48:26 +0000 Received: from mta-65-228.siemens.flowmailer.net ([185.136.65.228]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcopa-00000001YKl-1IbQ for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 15:48:24 +0000 Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 2024022115461805882a2b494ad25012 for ; Wed, 21 Feb 2024 16:46:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=J5Se4IlAntLxF9W2J1JJEFb+S1gXQPsA5HMQVz5Mt4s=; b=gjxJhHjJLaWuTG1jOsXVpqc7PIT1sGY1NGhviNe9TwLJcpduQOqBPOhiHohOKTyQP8+j4r Zx7O8J0pmoIHHFTnmxRiLGRL+AIyh4QVO7zIPmej9bvWvwexJd7HaD6H41211IBeabCH7Bqk 1NHUw6K8vVwFMNS9220DZLN9kgBoM=; From: "A. Sverdlin" To: linux-omap@vger.kernel.org Cc: Alexander Sverdlin , Paul Walmsley , Tony Lindgren , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ARM: AM33xx: PRM: Remove redundand defines Date: Wed, 21 Feb 2024 16:45:50 +0100 Message-ID: <20240221154614.3549951-1-alexander.sverdlin@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_074822_888446_EA2232C5 X-CRM114-Status: UNSURE ( 7.91 ) 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 From: Alexander Sverdlin AM33XX_PRM_RSTCTRL_OFFSET is already defined in prm33xx.h and AM33XX_RST_GLOBAL_WARM_SW_MASK in prm-regbits-33xx.h. Signed-off-by: Alexander Sverdlin --- arch/arm/mach-omap2/prm33xx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c index 4b65a0f9cf7d9..4a462310a4b09 100644 --- a/arch/arm/mach-omap2/prm33xx.c +++ b/arch/arm/mach-omap2/prm33xx.c @@ -15,10 +15,6 @@ #include "prm33xx.h" #include "prm-regbits-33xx.h" -#define AM33XX_PRM_RSTCTRL_OFFSET 0x0000 - -#define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0) - /* Read a register in a PRM instance */ static u32 am33xx_prm_read_reg(s16 inst, u16 idx) { From patchwork Wed Feb 21 15:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "A. Sverdlin" X-Patchwork-Id: 13565812 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 86E26C48BC3 for ; Wed, 21 Feb 2024 15:58:47 +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=H7XtUh90DROgQ5AgUWASAJSBf+RH1XEcp2swr/VQpsA=; b=m2Z2PZtsJIdQ0w gi8geoaNgkEGmgIZ3d55Q8P+Mw54pEjobQG/B7nWcMMMbKjPm1IVfv9Yv1cgrO5cqWdKLot4woDhH 7UOvPmrqzcyKeRPj3eVEMcuHHCAGYctvzP9r7wGmhUyQcsMHlwELgDcD9a/nGTNA3IAKqxfm3VU9g RAPBSQXxCjUO4hFEVRj43Ocz5Xvhbm2byPVJQcpXhUSh+oh5oSH8RC5Y0521B+jlINSynz2ZJkGnk Pc6D874AwFqONppC8mZ5rkIJqourwQiwUYEUvk0iDdGkYeJ3LAVQaNwZIC57Etdxn3QKnftPg5SBW vt7oL3PjeOpd4reg/UpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcozO-00000001bTM-12Do; Wed, 21 Feb 2024 15:58:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcozM-00000001bRp-1Qs9 for linux-arm-kernel@bombadil.infradead.org; Wed, 21 Feb 2024 15:58:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=66R2TQTJzmhGRQe2/ph0wKSL4VXGP/nSxWvviYDEaGk=; b=HoDdUAurEbxSiT0FI9DciH0AdR P9xjHRE/gkZnQ5N/FjksazwNPriXa0PxnD946NkdF4S5LoFZXLRBZdgAPqD4DpR19DAt1kd8dG+/a XYKY4SX0NsStPcipt1AhHwYUBWZDhD2LVbSLawgkGV3UgqsjDheNSKZWDNR/8FXZ+/wC5zmpG4f62 2mzWUiBeDLZXXTFHJzgnlAXZkMrZqeinIONi+yr3ESvL2SNvWkYoU5uOo2qQUr7OYiVV9vc0R/n9Y nllDpzukSrnV2U+NJ88hbCj3tQ4hZcX1rZtkVwL0ATOk43+bYdhdY68ugBqL9+aS0PQKPkABCL7+N 7IqyB4/w==; Received: from mta-64-228.siemens.flowmailer.net ([185.136.64.228]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcozH-00000002D0m-3V23 for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 15:58:25 +0000 Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202402211546193bff8c58459aadeb91 for ; Wed, 21 Feb 2024 16:46:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=66R2TQTJzmhGRQe2/ph0wKSL4VXGP/nSxWvviYDEaGk=; b=ioXZiOfN1cdfJhj+7xo6z/x4hEwVeW9uBWlVU6fs9zH4J6kRreYRgtR1PxIL/gaAD3RGyE JU45GGP0bndeS7fnmaKA/AMn9Tby3unat/I9pzIJ2OHbjlXuuaUmJvS6Z6P77Uvocf2q7hET Fwq7F4+GAPh+Gk5c0WuH1rvJd7JUA=; From: "A. Sverdlin" To: linux-omap@vger.kernel.org Cc: Alexander Sverdlin , Paul Walmsley , Tony Lindgren , Russell King , linux-arm-kernel@lists.infradead.org, Matthias Michel Subject: [PATCH 2/2] ARM: AM33xx: PRM: Implement REBOOT_COLD Date: Wed, 21 Feb 2024 16:45:51 +0100 Message-ID: <20240221154614.3549951-2-alexander.sverdlin@siemens.com> In-Reply-To: <20240221154614.3549951-1-alexander.sverdlin@siemens.com> References: <20240221154614.3549951-1-alexander.sverdlin@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_155824_160930_4D62949F X-CRM114-Status: GOOD ( 14.72 ) 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 From: Alexander Sverdlin Historically AM33xx performed warm software reset even though requested (and default) was REBOOT_COLD. Reflect the de-facto default mode in /sys/kernel/reboot/mode correctly and implement the real REBOOT_COLD (if configured explicitly). Tested-by: Matthias Michel Signed-off-by: Alexander Sverdlin --- arch/arm/mach-omap2/am33xx-restart.c | 3 ++- arch/arm/mach-omap2/board-generic.c | 6 ++++++ arch/arm/mach-omap2/prm-regbits-33xx.h | 1 + arch/arm/mach-omap2/prm.h | 1 + arch/arm/mach-omap2/prm33xx.c | 18 ++++++++++++++---- arch/arm/mach-omap2/prm_common.c | 6 ++++++ 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/am33xx-restart.c b/arch/arm/mach-omap2/am33xx-restart.c index ef2f18a56b658..199845f4b12e4 100644 --- a/arch/arm/mach-omap2/am33xx-restart.c +++ b/arch/arm/mach-omap2/am33xx-restart.c @@ -18,7 +18,8 @@ */ void am33xx_restart(enum reboot_mode mode, const char *cmd) { - /* TODO: Handle mode and cmd if necessary */ + /* TODO: Handle cmd if necessary */ + prm_reboot_mode = mode; omap_prm_reset_system(); } diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index fde6ccb3df6eb..68e0baad2bbf6 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -246,6 +246,12 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)") .init_time = omap_init_time_of, .dt_compat = am33xx_boards_compat, .restart = am33xx_restart, + /* + * Historically am33xx supported only REBOOT_WARM even though default + * reboot_mode was REBOOT_COLD. Reflect legacy de-facto behaviour in + * SYSFS. + */ + .reboot_mode = REBOOT_WARM, MACHINE_END #endif diff --git a/arch/arm/mach-omap2/prm-regbits-33xx.h b/arch/arm/mach-omap2/prm-regbits-33xx.h index 3748c5266ae12..9b97f8c76cd17 100644 --- a/arch/arm/mach-omap2/prm-regbits-33xx.h +++ b/arch/arm/mach-omap2/prm-regbits-33xx.h @@ -15,6 +15,7 @@ #define AM33XX_GFX_MEM_STATEST_MASK (0x3 << 4) #define AM33XX_GLOBAL_WARM_SW_RST_MASK (1 << 1) #define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0) +#define AM33XX_RST_GLOBAL_COLD_SW_MASK (1 << 1) #define AM33XX_PRUSS_MEM_ONSTATE_MASK (0x3 << 5) #define AM33XX_PRUSS_MEM_RETSTATE_MASK (1 << 7) #define AM33XX_PRUSS_MEM_STATEST_MASK (0x3 << 23) diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h index fc45a7ed09bb3..fc53a27eed013 100644 --- a/arch/arm/mach-omap2/prm.h +++ b/arch/arm/mach-omap2/prm.h @@ -15,6 +15,7 @@ # ifndef __ASSEMBLER__ extern struct omap_domain_base prm_base; extern u16 prm_features; +extern enum reboot_mode prm_reboot_mode; int omap_prcm_init(void); int omap2_prcm_base_init(void); # endif diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c index 4a462310a4b09..505d685d6792e 100644 --- a/arch/arm/mach-omap2/prm33xx.c +++ b/arch/arm/mach-omap2/prm33xx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "powerdomain.h" #include "prm33xx.h" @@ -318,10 +319,19 @@ static int am33xx_check_vcvp(void) * * Immediately reboots the device through warm reset. */ -static void am33xx_prm_global_warm_sw_reset(void) +static void am33xx_prm_global_sw_reset(void) { - am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK, - AM33XX_RST_GLOBAL_WARM_SW_MASK, + /* + * Historically AM33xx performed warm reset for all requested reboot_mode. + * Keep this behaviour unchanged for all except newly added REBOOT_COLD. + */ + u32 mask = AM33XX_RST_GLOBAL_WARM_SW_MASK; + + if (prm_reboot_mode == REBOOT_COLD) + mask = AM33XX_RST_GLOBAL_COLD_SW_MASK; + + am33xx_prm_rmw_reg_bits(mask, + mask, AM33XX_PRM_DEVICE_MOD, AM33XX_PRM_RSTCTRL_OFFSET); @@ -382,7 +392,7 @@ static struct prm_ll_data am33xx_prm_ll_data = { .assert_hardreset = am33xx_prm_assert_hardreset, .deassert_hardreset = am33xx_prm_deassert_hardreset, .is_hardreset_asserted = am33xx_prm_is_hardreset_asserted, - .reset_system = am33xx_prm_global_warm_sw_reset, + .reset_system = am33xx_prm_global_sw_reset, }; int __init am33xx_prm_init(const struct omap_prcm_init_data *data) diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index fd896f2295a11..f8771bdb5f068 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c @@ -66,6 +66,12 @@ struct omap_domain_base prm_base; u16 prm_features; +/* + * Platforms that implement different reboot modes can store the requested + * mode here. + */ +enum reboot_mode prm_reboot_mode; + /* * prm_ll_data: function pointers to SoC-specific implementations of * common PRM functions