From patchwork Wed Apr 17 10:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 791918 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [195.130.132.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F6D713C3CD for ; Wed, 17 Apr 2024 10:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; cv=none; b=pOnYgYudrgbQpzJ6L5cmZvSSi5XuDlcL/SXkgNM6sk2cUR4kxmeF88IUcqxhMIH6EUZcUjhsBqModRfxjhst4ApUqog19PMEsHoFVC040nMF54w8JRNbHcyFHg0xDFWlrrqBzQAxMTZOAoR0jCdot63u/dtyiXqLAVEsJAIUQZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; c=relaxed/simple; bh=VYGYacanQjsqexakylgPmDCVpmOxfFn9P+P9QCnq0fk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YuRE0Um00rm7viRR1OCbvqGOD7K96+H2mkbeWtpkUf2LhBaYnZ6DiWOP9yemQ/CTt151kJ5lHBQgGLQYU4hSnEGZ/upW2S5DoSJO3ZZT+XwRZ/4VWEX1y0ytrwCacYO3Q9QjASkIBFqqUByC6q0aiHFsN/CxSKtuGxUmXdFPG0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:76d0:2bff:fec8:549]) by xavier.telenet-ops.be with bizsmtp id CAX42C0010SSLxL01AX4DW; Wed, 17 Apr 2024 12:31:04 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rx2Yd-009LEI-Tx; Wed, 17 Apr 2024 12:31:03 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rx2Xe-00FLS0-CU; Wed, 17 Apr 2024 12:29:26 +0200 From: Geert Uytterhoeven To: Ulf Hansson Cc: Kuninori Morimoto , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/4] pmdomain: renesas: rcar-sysc: Absorb rcar_sysc_ch into rcar_sysc_pd Date: Wed, 17 Apr 2024 12:29:22 +0200 Message-Id: <672805a8c52ce63200e342212bbe6f84a445397b.1713348705.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Until commit 7e8a50df26f4e700 ("soc: renesas: rcar-sysc: Drop legacy handling") in v4.19, the rcar_sysc_ch structure was part of the API for legacy board code not yet using DT. Since then, there is no longer a reason to keep it as a separate structure. Moreover, a future quirk handling will need access to the rcar_sysc_pd structure's flags member in rcar_sysc_pwr_on_off(). Hence absorb the rcar_sysc_ch structure into the rcar_sysc_pd structure, and pass around the latter instead of the former. Signed-off-by: Geert Uytterhoeven --- drivers/pmdomain/renesas/rcar-sysc.c | 54 +++++++++++++--------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/drivers/pmdomain/renesas/rcar-sysc.c b/drivers/pmdomain/renesas/rcar-sysc.c index 35d9aa0dfab867fc..a60ce08e7d3b09cb 100644 --- a/drivers/pmdomain/renesas/rcar-sysc.c +++ b/drivers/pmdomain/renesas/rcar-sysc.c @@ -56,17 +56,20 @@ #define RCAR_PD_ALWAYS_ON 32 /* Always-on power area */ -struct rcar_sysc_ch { +struct rcar_sysc_pd { + struct generic_pm_domain genpd; u16 chan_offs; u8 chan_bit; u8 isr_bit; + unsigned int flags; + char name[]; }; static void __iomem *rcar_sysc_base; static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */ static u32 rcar_sysc_extmask_offs, rcar_sysc_extmask_val; -static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on) +static int rcar_sysc_pwr_on_off(const struct rcar_sysc_pd *pd, bool on) { unsigned int sr_bit, reg_offs; u32 val; @@ -88,16 +91,15 @@ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on) return -EAGAIN; /* Submit power shutoff or power resume request */ - iowrite32(BIT(sysc_ch->chan_bit), - rcar_sysc_base + sysc_ch->chan_offs + reg_offs); + iowrite32(BIT(pd->chan_bit), rcar_sysc_base + pd->chan_offs + reg_offs); return 0; } -static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on) +static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on) { - unsigned int isr_mask = BIT(sysc_ch->isr_bit); - unsigned int chan_mask = BIT(sysc_ch->chan_bit); + unsigned int isr_mask = BIT(pd->isr_bit); + unsigned int chan_mask = BIT(pd->chan_bit); unsigned int status, k; unsigned long flags; int ret; @@ -125,12 +127,11 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on) /* Submit power shutoff or resume request until it was accepted */ for (k = 0; k < PWRER_RETRIES; k++) { - ret = rcar_sysc_pwr_on_off(sysc_ch, on); + ret = rcar_sysc_pwr_on_off(pd, on); if (ret) goto out; - status = ioread32(rcar_sysc_base + - sysc_ch->chan_offs + PWRER_OFFS); + status = ioread32(rcar_sysc_base + pd->chan_offs + PWRER_OFFS); if (!(status & chan_mask)) break; @@ -158,28 +159,21 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on) spin_unlock_irqrestore(&rcar_sysc_lock, flags); pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off", - sysc_ch->isr_bit, ioread32(rcar_sysc_base + SYSCISR), ret); + pd->isr_bit, ioread32(rcar_sysc_base + SYSCISR), ret); return ret; } -static bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch) +static bool rcar_sysc_power_is_off(const struct rcar_sysc_pd *pd) { unsigned int st; - st = ioread32(rcar_sysc_base + sysc_ch->chan_offs + PWRSR_OFFS); - if (st & BIT(sysc_ch->chan_bit)) + st = ioread32(rcar_sysc_base + pd->chan_offs + PWRSR_OFFS); + if (st & BIT(pd->chan_bit)) return true; return false; } -struct rcar_sysc_pd { - struct generic_pm_domain genpd; - struct rcar_sysc_ch ch; - unsigned int flags; - char name[]; -}; - static inline struct rcar_sysc_pd *to_rcar_pd(struct generic_pm_domain *d) { return container_of(d, struct rcar_sysc_pd, genpd); @@ -190,7 +184,7 @@ static int rcar_sysc_pd_power_off(struct generic_pm_domain *genpd) struct rcar_sysc_pd *pd = to_rcar_pd(genpd); pr_debug("%s: %s\n", __func__, genpd->name); - return rcar_sysc_power(&pd->ch, false); + return rcar_sysc_power(pd, false); } static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd) @@ -198,7 +192,7 @@ static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd) struct rcar_sysc_pd *pd = to_rcar_pd(genpd); pr_debug("%s: %s\n", __func__, genpd->name); - return rcar_sysc_power(&pd->ch, true); + return rcar_sysc_power(pd, true); } static bool has_cpg_mstp; @@ -252,12 +246,12 @@ static int __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) goto finalize; } - if (!rcar_sysc_power_is_off(&pd->ch)) { + if (!rcar_sysc_power_is_off(pd)) { pr_debug("%s: %s is already powered\n", __func__, genpd->name); goto finalize; } - rcar_sysc_power(&pd->ch, true); + rcar_sysc_power(pd, true); finalize: error = pm_genpd_init(genpd, &simple_qos_governor, false); @@ -412,9 +406,9 @@ static int __init rcar_sysc_pd_init(void) memcpy(pd->name, area->name, n); pd->genpd.name = pd->name; - pd->ch.chan_offs = area->chan_offs; - pd->ch.chan_bit = area->chan_bit; - pd->ch.isr_bit = area->isr_bit; + pd->chan_offs = area->chan_offs; + pd->chan_bit = area->chan_bit; + pd->isr_bit = area->isr_bit; pd->flags = area->flags; error = rcar_sysc_pd_setup(pd); @@ -473,10 +467,10 @@ static int rcar_sysc_power_cpu(unsigned int idx, bool on) continue; pd = to_rcar_pd(genpd); - if (!(pd->flags & PD_CPU) || pd->ch.chan_bit != idx) + if (!(pd->flags & PD_CPU) || pd->chan_bit != idx) continue; - return rcar_sysc_power(&pd->ch, on); + return rcar_sysc_power(pd, on); } return -ENOENT; From patchwork Wed Apr 17 10:29:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 789660 Received: from michel.telenet-ops.be (michel.telenet-ops.be [195.130.137.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3107D136674 for ; Wed, 17 Apr 2024 10:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.88 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; cv=none; b=Cn1xPVgh1AQdsv8lU3a5VowbIlBiIcYMgNZp1p3A9AzT3HzVAoZ3KCrzKL78KYkKklavX6kW8bXeQeslMVqfa5MEanM5vUEgU9RMFj22u0DINehikQH2Biy1H1ROLes12WBWc5tPjQLMRD06fIWUsXd7fHiZ07c4ZgUQiA8E2ok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; c=relaxed/simple; bh=mYXDeWa0is90dtQWkZlkBo5+hUVUrlkI/UDefX6ZN08=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Emr+gOmXKRmyAHx2Y2I8PtJ50rjbgmSBafTCzpOpSpy9AvKhbymfMgUFAUr2pmD0oO2RJ4ZqfSsdj0tnDJ1iFjfJuAtmCzHHiGhqx0lIEWgXl6/juxrECuw8kiefbjF8bmz35xB7gKD4N5/RanALioxs7+Dnhsv/gPrNapRYcNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:76d0:2bff:fec8:549]) by michel.telenet-ops.be with bizsmtp id CAX32C00c0SSLxL06AX3rz; Wed, 17 Apr 2024 12:31:04 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rx2Yd-009LEF-QF; Wed, 17 Apr 2024 12:31:03 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rx2Xe-00FLS5-DY; Wed, 17 Apr 2024 12:29:26 +0200 From: Geert Uytterhoeven To: Ulf Hansson Cc: Kuninori Morimoto , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/4] pmdomain: renesas: rcar-sysc: Split R-Car M3-W and M3-W+ sub-drivers Date: Wed, 17 Apr 2024 12:29:23 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently R-Car M3-W and M3-W+ are handled by a single sub-driver, but using separate Kconfig symbols and separate rcar_sysc_info structures, and fixup code to handle the remaining differences. Prepare for handling more differences by splitting them in two separate sub-drivers. Signed-off-by: Geert Uytterhoeven --- drivers/pmdomain/renesas/Makefile | 4 +-- .../{r8a7796-sysc.c => r8a77960-sysc.c} | 28 +++---------------- .../{r8a7796-sysc.c => r8a77961-sysc.c} | 28 +++---------------- 3 files changed, 10 insertions(+), 50 deletions(-) copy drivers/pmdomain/renesas/{r8a7796-sysc.c => r8a77960-sysc.c} (69%) rename drivers/pmdomain/renesas/{r8a7796-sysc.c => r8a77961-sysc.c} (69%) diff --git a/drivers/pmdomain/renesas/Makefile b/drivers/pmdomain/renesas/Makefile index 89180f19c23be732..0391e6e67440a786 100644 --- a/drivers/pmdomain/renesas/Makefile +++ b/drivers/pmdomain/renesas/Makefile @@ -14,8 +14,8 @@ obj-$(CONFIG_SYSC_R8A7791) += r8a7791-sysc.o obj-$(CONFIG_SYSC_R8A7792) += r8a7792-sysc.o obj-$(CONFIG_SYSC_R8A7794) += r8a7794-sysc.o obj-$(CONFIG_SYSC_R8A7795) += r8a7795-sysc.o -obj-$(CONFIG_SYSC_R8A77960) += r8a7796-sysc.o -obj-$(CONFIG_SYSC_R8A77961) += r8a7796-sysc.o +obj-$(CONFIG_SYSC_R8A77960) += r8a77960-sysc.o +obj-$(CONFIG_SYSC_R8A77961) += r8a77961-sysc.o obj-$(CONFIG_SYSC_R8A77965) += r8a77965-sysc.o obj-$(CONFIG_SYSC_R8A77970) += r8a77970-sysc.o obj-$(CONFIG_SYSC_R8A77980) += r8a77980-sysc.o diff --git a/drivers/pmdomain/renesas/r8a7796-sysc.c b/drivers/pmdomain/renesas/r8a77960-sysc.c similarity index 69% copy from drivers/pmdomain/renesas/r8a7796-sysc.c copy to drivers/pmdomain/renesas/r8a77960-sysc.c index 471bd5b3b6ada18d..e6f2c3f961255f40 100644 --- a/drivers/pmdomain/renesas/r8a7796-sysc.c +++ b/drivers/pmdomain/renesas/r8a77960-sysc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Renesas R-Car M3-W/W+ System Controller + * Renesas R-Car M3-W System Controller * * Copyright (C) 2016 Glider bvba * Copyright (C) 2018-2019 Renesas Electronics Corporation @@ -13,7 +13,7 @@ #include "rcar-sysc.h" -static struct rcar_sysc_area r8a7796_areas[] __initdata = { +static const struct rcar_sysc_area r8a77960_areas[] __initconst = { { "always-on", 0, 0, R8A7796_PD_ALWAYS_ON, -1, PD_ALWAYS_ON }, { "ca57-scu", 0x1c0, 0, R8A7796_PD_CA57_SCU, R8A7796_PD_ALWAYS_ON, PD_SCU }, @@ -41,27 +41,7 @@ static struct rcar_sysc_area r8a7796_areas[] __initdata = { }; -#ifdef CONFIG_SYSC_R8A77960 const struct rcar_sysc_info r8a77960_sysc_info __initconst = { - .areas = r8a7796_areas, - .num_areas = ARRAY_SIZE(r8a7796_areas), + .areas = r8a77960_areas, + .num_areas = ARRAY_SIZE(r8a77960_areas), }; -#endif /* CONFIG_SYSC_R8A77960 */ - -#ifdef CONFIG_SYSC_R8A77961 -static int __init r8a77961_sysc_init(void) -{ - rcar_sysc_nullify(r8a7796_areas, ARRAY_SIZE(r8a7796_areas), - R8A7796_PD_A2VC0); - - return 0; -} - -const struct rcar_sysc_info r8a77961_sysc_info __initconst = { - .init = r8a77961_sysc_init, - .areas = r8a7796_areas, - .num_areas = ARRAY_SIZE(r8a7796_areas), - .extmask_offs = 0x2f8, - .extmask_val = BIT(0), -}; -#endif /* CONFIG_SYSC_R8A77961 */ diff --git a/drivers/pmdomain/renesas/r8a7796-sysc.c b/drivers/pmdomain/renesas/r8a77961-sysc.c similarity index 69% rename from drivers/pmdomain/renesas/r8a7796-sysc.c rename to drivers/pmdomain/renesas/r8a77961-sysc.c index 471bd5b3b6ada18d..a1155068ee7a60b8 100644 --- a/drivers/pmdomain/renesas/r8a7796-sysc.c +++ b/drivers/pmdomain/renesas/r8a77961-sysc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Renesas R-Car M3-W/W+ System Controller + * Renesas R-Car M3-W+ System Controller * * Copyright (C) 2016 Glider bvba * Copyright (C) 2018-2019 Renesas Electronics Corporation @@ -13,7 +13,7 @@ #include "rcar-sysc.h" -static struct rcar_sysc_area r8a7796_areas[] __initdata = { +static const struct rcar_sysc_area r8a77961_areas[] __initconst = { { "always-on", 0, 0, R8A7796_PD_ALWAYS_ON, -1, PD_ALWAYS_ON }, { "ca57-scu", 0x1c0, 0, R8A7796_PD_CA57_SCU, R8A7796_PD_ALWAYS_ON, PD_SCU }, @@ -33,35 +33,15 @@ static struct rcar_sysc_area r8a7796_areas[] __initdata = { PD_CPU_NOCR }, { "cr7", 0x240, 0, R8A7796_PD_CR7, R8A7796_PD_ALWAYS_ON }, { "a3vc", 0x380, 0, R8A7796_PD_A3VC, R8A7796_PD_ALWAYS_ON }, - { "a2vc0", 0x3c0, 0, R8A7796_PD_A2VC0, R8A7796_PD_A3VC }, { "a2vc1", 0x3c0, 1, R8A7796_PD_A2VC1, R8A7796_PD_A3VC }, { "3dg-a", 0x100, 0, R8A7796_PD_3DG_A, R8A7796_PD_ALWAYS_ON }, { "3dg-b", 0x100, 1, R8A7796_PD_3DG_B, R8A7796_PD_3DG_A }, { "a3ir", 0x180, 0, R8A7796_PD_A3IR, R8A7796_PD_ALWAYS_ON }, }; - -#ifdef CONFIG_SYSC_R8A77960 -const struct rcar_sysc_info r8a77960_sysc_info __initconst = { - .areas = r8a7796_areas, - .num_areas = ARRAY_SIZE(r8a7796_areas), -}; -#endif /* CONFIG_SYSC_R8A77960 */ - -#ifdef CONFIG_SYSC_R8A77961 -static int __init r8a77961_sysc_init(void) -{ - rcar_sysc_nullify(r8a7796_areas, ARRAY_SIZE(r8a7796_areas), - R8A7796_PD_A2VC0); - - return 0; -} - const struct rcar_sysc_info r8a77961_sysc_info __initconst = { - .init = r8a77961_sysc_init, - .areas = r8a7796_areas, - .num_areas = ARRAY_SIZE(r8a7796_areas), + .areas = r8a77961_areas, + .num_areas = ARRAY_SIZE(r8a77961_areas), .extmask_offs = 0x2f8, .extmask_val = BIT(0), }; -#endif /* CONFIG_SYSC_R8A77961 */ From patchwork Wed Apr 17 10:29:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 789661 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A8E513BC00 for ; Wed, 17 Apr 2024 10:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.89 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; cv=none; b=mFNGnESX0f2bg6XApFWLzS+82DLaFcq4XjPbmsrOkKhKyE9tcFVTyEw19Gl1vVSJQRnBxLFP+xJIp1fi/kDhIOc8pUK9+Da2mW1UzYFF5jmg+jNuCEjD+T1XQRF2MdYNH5BFRZu5ptXcyRys4zVgqHC9WyLzJ6QPz0tsp2cE6iU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; c=relaxed/simple; bh=oo7aLJcvguP5C6Fr2kTmcD7Omy+Ka45JByP2fpqa2KY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=exxohf9sgnSNRee9ki/ex6rsyS2S/oWyPgDpKmH9B++kuczVbRbHMze/35ANj68oAckPLKU5vmzZYOC0lTzJdqzJ4P6DDp9qvpDUYJcTgGX8pf0MywbUne/FtiPZHNebRZWYhas40UnodATLUyN/ZfL0HQL0ZfjlPf0o5n/JE2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:76d0:2bff:fec8:549]) by laurent.telenet-ops.be with bizsmtp id CAX32C00E0SSLxL01AX3wF; Wed, 17 Apr 2024 12:31:04 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rx2Yd-009LEC-OA; Wed, 17 Apr 2024 12:31:03 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rx2Xe-00FLSA-Eb; Wed, 17 Apr 2024 12:29:26 +0200 From: Geert Uytterhoeven To: Ulf Hansson Cc: Kuninori Morimoto , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 3/4] pmdomain: renesas: rcar-sysc: Remove rcar_sysc_nullify() helper Date: Wed, 17 Apr 2024 12:29:24 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are no more users left of the rcar_sysc_nullify() helper, so it can be removed. Signed-off-by: Geert Uytterhoeven --- drivers/pmdomain/renesas/rcar-sysc.c | 12 ------------ drivers/pmdomain/renesas/rcar-sysc.h | 8 -------- 2 files changed, 20 deletions(-) diff --git a/drivers/pmdomain/renesas/rcar-sysc.c b/drivers/pmdomain/renesas/rcar-sysc.c index a60ce08e7d3b09cb..a9d92e38fcee902c 100644 --- a/drivers/pmdomain/renesas/rcar-sysc.c +++ b/drivers/pmdomain/renesas/rcar-sysc.c @@ -439,18 +439,6 @@ static int __init rcar_sysc_pd_init(void) } early_initcall(rcar_sysc_pd_init); -void __init rcar_sysc_nullify(struct rcar_sysc_area *areas, - unsigned int num_areas, u8 id) -{ - unsigned int i; - - for (i = 0; i < num_areas; i++) - if (areas[i].isr_bit == id) { - areas[i].name = NULL; - return; - } -} - #ifdef CONFIG_ARCH_R8A7779 static int rcar_sysc_power_cpu(unsigned int idx, bool on) { diff --git a/drivers/pmdomain/renesas/rcar-sysc.h b/drivers/pmdomain/renesas/rcar-sysc.h index 266c599a0a9b9198..8c4ec36ed7da2f9d 100644 --- a/drivers/pmdomain/renesas/rcar-sysc.h +++ b/drivers/pmdomain/renesas/rcar-sysc.h @@ -71,12 +71,4 @@ extern const struct rcar_sysc_info r8a77980_sysc_info; extern const struct rcar_sysc_info r8a77990_sysc_info; extern const struct rcar_sysc_info r8a77995_sysc_info; - - /* - * Helpers for fixing up power area tables depending on SoC revision - */ - -extern void rcar_sysc_nullify(struct rcar_sysc_area *areas, - unsigned int num_areas, u8 id); - #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */ From patchwork Wed Apr 17 10:29:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 791919 Received: from albert.telenet-ops.be (albert.telenet-ops.be [195.130.137.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30D483F9F9 for ; Wed, 17 Apr 2024 10:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; cv=none; b=Wk3wCZ953z5TST8y0qYibWOoZ1t9xekXMZVXEVxRmxrZDaQ9eWiQJ4eKM4/qE8GBS0qvP5/JaQNR/lgN9OpXuwwvZQQkwTH1I9TKornFdPwzTgTZ4gpJsGozYdf+cs77oAswJLsiuhFmfWSm8sUP4+AIqJ1HZRxjr+jslRNUpUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349868; c=relaxed/simple; bh=JmN3ov/nWWxkMqZnFvvpCKbxW2JVrc7zlR+YNMFMDVk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=gLxt1CSAmS23AM7f4p+ad/371IchJ15l9ScMZGJSxoveaDeIPmWp3CEXfXxxpGceWwGU96l+8Mfweo5IA3Tikm3iI+N7SNog+AdvYDrplzm4lP91LKeJlRVgAb+oP1bgBTMQtrMIFYNGUnVgidkCDbnCEARSzP6Qt7L+/EuYWXE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:76d0:2bff:fec8:549]) by albert.telenet-ops.be with bizsmtp id CAX32C00P0SSLxL06AX3Va; Wed, 17 Apr 2024 12:31:04 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rx2Yd-009LE9-M6; Wed, 17 Apr 2024 12:31:03 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rx2Xe-00FLSF-Fd; Wed, 17 Apr 2024 12:29:26 +0200 From: Geert Uytterhoeven To: Ulf Hansson Cc: Kuninori Morimoto , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 4/4] pmdomain: renesas: rcar-sysc: Add R-Car M3-W power-off delay quirk Date: Wed, 17 Apr 2024 12:29:25 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 R-Car M3-W needs a delay of 1 µs before powering off the A3IR and A3VC power domains. Add support for this using a new flag, which indicates that a power area is subject to this quirk. Inspired by a patch in the BSP by Dien Pham. Signed-off-by: Geert Uytterhoeven --- Changes compared to the BSP: - Use a new flag in the SoC-specific area description instead of comparing PM Domain names (which applied the quirk to all SoCs), - Support for R-Car H3 ES1.x was dropped in v6.4, so it no longer needs handling. --- drivers/pmdomain/renesas/r8a77960-sysc.c | 6 ++++-- drivers/pmdomain/renesas/rcar-sysc.c | 4 ++++ drivers/pmdomain/renesas/rcar-sysc.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/renesas/r8a77960-sysc.c b/drivers/pmdomain/renesas/r8a77960-sysc.c index e6f2c3f961255f40..2ab3f565d2b0f889 100644 --- a/drivers/pmdomain/renesas/r8a77960-sysc.c +++ b/drivers/pmdomain/renesas/r8a77960-sysc.c @@ -32,12 +32,14 @@ static const struct rcar_sysc_area r8a77960_areas[] __initconst = { { "ca53-cpu3", 0x200, 3, R8A7796_PD_CA53_CPU3, R8A7796_PD_CA53_SCU, PD_CPU_NOCR }, { "cr7", 0x240, 0, R8A7796_PD_CR7, R8A7796_PD_ALWAYS_ON }, - { "a3vc", 0x380, 0, R8A7796_PD_A3VC, R8A7796_PD_ALWAYS_ON }, + { "a3vc", 0x380, 0, R8A7796_PD_A3VC, R8A7796_PD_ALWAYS_ON, + PD_OFF_DELAY }, { "a2vc0", 0x3c0, 0, R8A7796_PD_A2VC0, R8A7796_PD_A3VC }, { "a2vc1", 0x3c0, 1, R8A7796_PD_A2VC1, R8A7796_PD_A3VC }, { "3dg-a", 0x100, 0, R8A7796_PD_3DG_A, R8A7796_PD_ALWAYS_ON }, { "3dg-b", 0x100, 1, R8A7796_PD_3DG_B, R8A7796_PD_3DG_A }, - { "a3ir", 0x180, 0, R8A7796_PD_A3IR, R8A7796_PD_ALWAYS_ON }, + { "a3ir", 0x180, 0, R8A7796_PD_A3IR, R8A7796_PD_ALWAYS_ON, + PD_OFF_DELAY }, }; diff --git a/drivers/pmdomain/renesas/rcar-sysc.c b/drivers/pmdomain/renesas/rcar-sysc.c index a9d92e38fcee902c..b99326917330f5f1 100644 --- a/drivers/pmdomain/renesas/rcar-sysc.c +++ b/drivers/pmdomain/renesas/rcar-sysc.c @@ -90,6 +90,10 @@ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_pd *pd, bool on) if (ret) return -EAGAIN; + /* Power-off delay quirk */ + if (!on && (pd->flags & PD_OFF_DELAY)) + udelay(1); + /* Submit power shutoff or power resume request */ iowrite32(BIT(pd->chan_bit), rcar_sysc_base + pd->chan_offs + reg_offs); diff --git a/drivers/pmdomain/renesas/rcar-sysc.h b/drivers/pmdomain/renesas/rcar-sysc.h index 8c4ec36ed7da2f9d..07ffce310686b2ce 100644 --- a/drivers/pmdomain/renesas/rcar-sysc.h +++ b/drivers/pmdomain/renesas/rcar-sysc.h @@ -16,6 +16,7 @@ #define PD_CPU BIT(0) /* Area contains main CPU core */ #define PD_SCU BIT(1) /* Area contains SCU and L2 cache */ #define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */ +#define PD_OFF_DELAY BIT(3) /* Area is subject to power-off delay quirk */ #define PD_CPU_CR PD_CPU /* CPU area has CR (R-Car H1) */ #define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR (R-Car Gen2/3) */