All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabrizio.castro@bp.renesas.com (Fabrizio Castro)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y 18/60] soc: renesas: rcar-sysc: Fix power domain control after system resume
Date: Wed, 28 Aug 2019 12:02:49 +0100	[thread overview]
Message-ID: <1566990211-24785-19-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1566990211-24785-1-git-send-email-fabrizio.castro@bp.renesas.com>

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 7fc4650cc2417d7a2907a000f6f88240baa42018 upstream.

To control power to a power domain, the System Controller (SYSC) needs
the corresponding interrupt source to be enabled, but masked, to prevent
the CPU from receiving it.

Currently this is handled in the driver's probe() routine, and set up
for every domain present, even if it will not be controlled directly by
SYSC (CPU domains are powered through the APMU on R-Car Gen2 and later).

On R-Car Gen3, PSCI powers down the SoC during system suspend, thus
losing any configured interrupt state.  Hence after system resume, power
domains not controlled through the APMU (e.g. A3IR, A3VC, A3VP) fail to
power up.

Fix this by replacing the global interrupt setup in the probe() routine
by a domain-specific interrupt setup in rcar_sysc_power(), where the
domain's power is actually controlled.  This brings the code more in
line with the flowchart in the Hardware User's Manual.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/soc/renesas/rcar-sysc.c | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index c3805fc..3fc5937 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -108,6 +108,15 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
 
 	spin_lock_irqsave(&rcar_sysc_lock, flags);
 
+	/*
+	 * The interrupt source needs to be enabled, but masked, to prevent the
+	 * CPU from receiving it.
+	 */
+	iowrite32(ioread32(rcar_sysc_base + SYSCIMR) | isr_mask,
+		  rcar_sysc_base + SYSCIMR);
+	iowrite32(ioread32(rcar_sysc_base + SYSCIER) | isr_mask,
+		  rcar_sysc_base + SYSCIER);
+
 	iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
 
 	/* Submit power shutoff or resume request until it was accepted */
@@ -325,7 +334,6 @@ static int __init rcar_sysc_pd_init(void)
 	const struct of_device_id *match;
 	struct rcar_pm_domains *domains;
 	struct device_node *np;
-	u32 syscier, syscimr;
 	void __iomem *base;
 	unsigned int i;
 	int error;
@@ -364,24 +372,6 @@ static int __init rcar_sysc_pd_init(void)
 	domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains);
 	rcar_sysc_onecell_data = &domains->onecell_data;
 
-	for (i = 0, syscier = 0; i < info->num_areas; i++)
-		syscier |= BIT(info->areas[i].isr_bit);
-
-	/*
-	 * Mask all interrupt sources to prevent the CPU from receiving them.
-	 * Make sure not to clear reserved bits that were set before.
-	 */
-	syscimr = ioread32(base + SYSCIMR);
-	syscimr |= syscier;
-	pr_debug("%pOF: syscimr = 0x%08x\n", np, syscimr);
-	iowrite32(syscimr, base + SYSCIMR);
-
-	/*
-	 * SYSC needs all interrupt sources enabled to control power.
-	 */
-	pr_debug("%pOF: syscier = 0x%08x\n", np, syscier);
-	iowrite32(syscier, base + SYSCIER);
-
 	for (i = 0; i < info->num_areas; i++) {
 		const struct rcar_sysc_area *area = &info->areas[i];
 		struct rcar_sysc_pd *pd;
-- 
2.7.4

  parent reply	other threads:[~2019-08-28 11:02 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 11:02 [cip-dev] [PATCH 4.19.y 00/60] Add basic RZ/G2M SoC support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 01/60] dt-bindings: can: rcar_can: Add r8a774a1 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 02/60] dt-bindings: can: rcar_can: Fix RZ/G2 CAN clocks Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 03/60] dt-bindings: can: rcar_can: Add r8a774c0 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 04/60] dt-bindings: rcar-gen3-phy-usb3: Add r8a774a1 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 05/60] dt-bindings: usb-xhci: " Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 06/60] dt-bindings: usb-xhci: Add r8a774c0 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 07/60] dt-bindings: usb: renesas_usbhs: Add r8a774a1 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 08/60] dt-bindings: thermal: rcar-gen3-thermal: " Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 09/60] dt-bindings: dmaengine: usb-dmac: Add binding for r8a774a1 Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 10/60] thermal: rcar_gen3_thermal: Add r8a774a1 support Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 11/60] gpio: rcar: reference device instead of platform device Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 12/60] gpio: rcar: select General Output Register to set output states Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 13/60] gpio: rcar: Pedantic formatting Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 14/60] clk: renesas: cpg-mssr: Use genpd of_node instead of local copy Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 15/60] clk: renesas: cpg-mssr: Remove error messages on out-of-memory conditions Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 16/60] soc: renesas: rcar-sysc: Remove rcar_sysc_power_{down, up}() helpers Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 17/60] soc: renesas: rcar-sysc: Merge PM Domain registration and linking Fabrizio Castro
2019-08-28 11:02 ` Fabrizio Castro [this message]
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 19/60] serial: sh-sci: Fix TX DMA buffer flushing and workqueue races Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 20/60] serial: sh-sci: Terminate TX DMA during buffer flushing Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 21/60] serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 22/60] serial: sh-sci: Extract sci_dma_rx_chan_invalidate() Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 23/60] serial: sh-sci: Extract sci_dma_rx_reenable_irq() Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 24/60] serial: sh-sci: Fix fallback to PIO in sci_dma_rx_complete() Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 25/60] dmaengine: rcar-dmac: set scatter/gather max segment size Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 26/60] dmaengine: rcar-dmac: Update copyright information Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 27/60] dmaengine: rcar-dmac: Reject zero-length slave DMA requests Fabrizio Castro
2019-08-28 11:02 ` [cip-dev] [PATCH 4.19.y 28/60] spi: sh-msiof: fix deferred probing Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 29/60] ravb: remove tx buffer addr 4byte alilgnment restriction for R-Car Gen3 Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 30/60] ravb: Avoid unsupported internal delay mode for R-Car E3/D3 Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 31/60] mmc: renesas_sdhi_internal_dmac: set scatter/gather max segment size Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 32/60] arm64: dts: renesas: Initial r8a774a1 SoC device tree Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 33/60] arm64: dts: renesas: r8a774a1: Add SYS-DMAC controller nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 34/60] arm64: dts: renesas: r8a774a1: Add SCIF and HSCIF nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 35/60] arm64: dts: renesas: r8a774a1: Add INTC-EX device node Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 36/60] arm64: dts: renesas: r8a774a1: Add Ethernet AVB node Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 37/60] arm64: dts: renesas: r8a774a1: Add RWDT node Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 38/60] arm64: dts: renesas: r8a774a1: Add pinctrl device node Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 39/60] arm64: dts: renesas: r8a774a1: Add GPIO device nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 40/60] arm64: dts: renesas: r8a774a1: Add SDHI nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 41/60] arm64: dts: renesas: r8a774a1: Add I2C and IIC-DVFS support Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 42/60] arm64: dts: renesas: r8a774a1: Add RZ/G2M thermal support Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 43/60] arm64: dts: renesas: r8a774a1: Add IPMMU device nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 44/60] arm64: dts: renesas: r8a774a1: Add all MSIOF nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 45/60] arm64: dts: renesas: r8a774a1: Add Cortex-A53 CPU cores Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 46/60] arm64: dts: renesas: r8a774a1: Add PWM device nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 47/60] arm64: dts: renesas: r8a774a1: Add audio support Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 48/60] arm64: dts: renesas: r8a774a1: Add FCPF and FCPV instances Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 49/60] arm64: dts: renesas: r8a774a1: Add USB2.0 phy and host(EHCI/OHCI) device nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 50/60] arm64: dts: renesas: r8a774a1: Add USB-DMAC and HSUSB " Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 51/60] arm64: dts: renesas: r8a774a1: Add USB3.0 " Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 52/60] arm64: dts: renesas: Fix whitespace around assignments Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 53/60] arm64: dts: renesas: Remove unneeded status from thermal nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 54/60] arm64: dts: renesas: r8a774a1: Add CAN nodes Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 55/60] arm64: dts: renesas: r8a774a1: Replace power magic numbers Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 56/60] arm64: dts: renesas: r8a774a1: Replace clock " Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 57/60] arm64: dts: renesas: r8a774a1: Enable DMA for SCIF2 Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 58/60] arm64: dts: renesas: r8a774a1: Fix hsusb reg size Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 59/60] arm64: dts: Remove inconsistent use of 'arm, armv8' compatible string Fabrizio Castro
2019-08-28 11:03 ` [cip-dev] [PATCH 4.19.y 60/60] arm64: dts: renesas: r8a774a1: Add clkp2 clock to CAN nodes Fabrizio Castro
2019-08-28 13:29 ` [cip-dev] [PATCH 4.19.y 00/60] Add basic RZ/G2M SoC support Fabrizio Castro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1566990211-24785-19-git-send-email-fabrizio.castro@bp.renesas.com \
    --to=fabrizio.castro@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.