From patchwork Sun Feb 28 15:04:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8446901 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 394569F314 for ; Sun, 28 Feb 2016 15:04:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 341CC2035E for ; Sun, 28 Feb 2016 15:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 182F820265 for ; Sun, 28 Feb 2016 15:04:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757608AbcB1PEs (ORCPT ); Sun, 28 Feb 2016 10:04:48 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:42471 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757489AbcB1PEo (ORCPT ); Sun, 28 Feb 2016 10:04:44 -0500 Received: from avalon.localnet (85-23-193-79.bb.dnainternet.fi [85.23.193.79]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id B8CA52005A; Sun, 28 Feb 2016 16:02:30 +0100 (CET) From: Laurent Pinchart To: Geert Uytterhoeven Cc: Geert Uytterhoeven , Simon Horman , Magnus Damm , linux-renesas-soc@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" , Linux PM list , "devicetree@vger.kernel.org" Subject: Re: [PATCH/RFC v2 00/11] ARM/arm64: renesas: Add SYSC PM Domain DT Support Date: Sun, 28 Feb 2016 17:04:47 +0200 Message-ID: <2939018.LGDkKsjeJ3@avalon> User-Agent: KMail/4.14.8 (Linux/4.1.15-gentoo-r1; KDE/4.14.8; x86_64; ; ) In-Reply-To: References: <1455571020-18968-1-git-send-email-geert+renesas@glider.be> <8723964.uvbBYGm8Wz@avalon> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY, UPPERCASE_50_75 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Geert, On Sunday 28 February 2016 09:55:32 Geert Uytterhoeven wrote: > On Sat, Feb 27, 2016 at 2:53 AM, Laurent Pinchart wrote: > > After rebasing this series on top of Simon's latest devel branch, I'm > > experiencing hard system freezes when using the VSP. > > Is this due to the rebasing? Did it work in > renesas-drivers-2016-02-16-v4.5-rc4 or renesas-drivers-2016-02-23-v4.5-rc5? I thought it was, but after further investigations I've been unable to get it working at all even on my older branches, so I think the problem has always been there. > > What makes the problem curious is that PM runtime works fine when the VSP > > instances are probed, the A3VP power domain is turned on and off correctly > > for each instance. However, after booting the system, if I try to RPM > > resume the device, the system hangs. > > > > I've traced this (using printk debugging) down to the SYSCISCR write in > > rcar_sysc_power(). The value written is 0x00000200, which corresponds to > > the A3VP power domain, and the resume request completion wait loop > > doesn't time out. > > So the second write to SYSCISCR in that function locks up the system? Correct, and only after the kernel has booted, there's a bunch of calls to rcar_sysc_power() to enable/disable the A3VP power domain at boot time when the vsp devices are probed, and those don't cause any issue. > > Does this ring any bell ? Do you have a more recent version of this patch > > series that I could try ? > > No clue, and no more recent version available yet. > > What do I need to reproduce this? Compile git://linuxtv.org/pinchartl/media.git drm/du/vsp1-kms/boards (.config attached), boot it, and run # cat /dev/video0 You can apply the following patch to see what's going on. On my system it prints the following messages during boot when probing the vsp instances. [ 0.528433] rcar_sysc_power(A3VP, off) [ 0.535317] rcar_sysc_power: will write to SYSISCR [ 0.547713] rcar_sysc_power: wrote to SYSISCR [ 0.549910] rcar_sysc_power(A3VP, on) [ 0.556759] rcar_sysc_power: will write to SYSISCR [ 0.569155] rcar_sysc_power: wrote to SYSISCR [ 0.571386] rcar_sysc_power(A3VP, off) [ 0.578270] rcar_sysc_power: will write to SYSISCR [ 0.590665] rcar_sysc_power: wrote to SYSISCR [ 0.592857] rcar_sysc_power(A3VP, on) [ 0.599698] rcar_sysc_power: will write to SYSISCR [ 0.612094] rcar_sysc_power: wrote to SYSISCR [ 0.614310] rcar_sysc_power(A3VP, off) [ 0.621197] rcar_sysc_power: will write to SYSISCR [ 0.633592] rcar_sysc_power: wrote to SYSISCR [ 0.635783] rcar_sysc_power(A3VP, on) [ 0.642625] rcar_sysc_power: will write to SYSISCR [ 0.655020] rcar_sysc_power: wrote to SYSISCR [ 0.657237] rcar_sysc_power(A3VP, off) [ 0.664120] rcar_sysc_power: will write to SYSISCR [ 0.676515] rcar_sysc_power: wrote to SYSISCR [ 0.678706] rcar_sysc_power(A3VP, on) [ 0.685550] rcar_sysc_power: will write to SYSISCR [ 0.697945] rcar_sysc_power: wrote to SYSISCR [ 0.700133] rcar_sysc_power(A3VP, off) [ 0.707015] rcar_sysc_power: will write to SYSISCR [ 0.719410] rcar_sysc_power: wrote to SYSISCR [ 0.721736] rcar_sysc_power(A3VP, on) [ 0.728583] rcar_sysc_power: will write to SYSISCR [ 0.740978] rcar_sysc_power: wrote to SYSISCR [ 0.743213] rcar_sysc_power(A3VP, off) [ 0.750099] rcar_sysc_power: will write to SYSISCR [ 0.762495] rcar_sysc_power: wrote to SYSISCR [ 0.765445] rcar_sysc_power(A3VP, on) [ 0.772294] rcar_sysc_power: will write to SYSISCR [ 0.784689] rcar_sysc_power: wrote to SYSISCR [ 0.786897] rcar_sysc_power(A3VP, off) [ 0.793783] rcar_sysc_power: will write to SYSISCR [ 0.806178] rcar_sysc_power: wrote to SYSISCR [ 0.808369] rcar_sysc_power(A3VP, on) [ 0.815211] rcar_sysc_power: will write to SYSISCR [ 0.827606] rcar_sysc_power: wrote to SYSISCR [ 0.829845] rcar_sysc_power(A3VP, off) [ 0.836733] rcar_sysc_power: will write to SYSISCR [ 0.849128] rcar_sysc_power: wrote to SYSISCR [ 0.851985] rcar_sysc_power(A3VP, on) [ 0.858829] rcar_sysc_power: will write to SYSISCR [ 0.871224] rcar_sysc_power: wrote to SYSISCR [ 0.873435] rcar_sysc_power(A3VP, off) [ 0.880323] rcar_sysc_power: will write to SYSISCR [ 0.892719] rcar_sysc_power: wrote to SYSISCR [ 0.894911] rcar_sysc_power(A3VP, on) [ 0.901772] rcar_sysc_power: will write to SYSISCR [ 0.914168] rcar_sysc_power: wrote to SYSISCR [ 0.916395] rcar_sysc_power(A3VP, off) [ 0.923278] rcar_sysc_power: will write to SYSISCR [ 0.935673] rcar_sysc_power: wrote to SYSISCR [ 0.938275] rcar_sysc_power(A3VP, on) [ 0.945129] rcar_sysc_power: will write to SYSISCR [ 0.957525] rcar_sysc_power: wrote to SYSISCR [ 0.959729] rcar_sysc_power(A3VP, off) [ 0.966612] rcar_sysc_power: will write to SYSISCR [ 0.979008] rcar_sysc_power: wrote to SYSISCR [ 0.981204] rcar_sysc_power(A3VP, on) [ 0.988044] rcar_sysc_power: will write to SYSISCR [ 1.000440] rcar_sysc_power: wrote to SYSISCR [ 1.002660] rcar_sysc_power(A3VP, off) [ 1.009546] rcar_sysc_power: will write to SYSISCR [ 1.021941] rcar_sysc_power: wrote to SYSISCR [ 1.024540] rcar_sysc_power(A3VP, on) [ 1.031383] rcar_sysc_power: will write to SYSISCR [ 1.043778] rcar_sysc_power: wrote to SYSISCR [ 1.045980] rcar_sysc_power(A3VP, off) [ 1.052865] rcar_sysc_power: will write to SYSISCR [ 1.065261] rcar_sysc_power: wrote to SYSISCR [ 1.067450] rcar_sysc_power(A3VP, on) [ 1.074292] rcar_sysc_power: will write to SYSISCR [ 1.086687] rcar_sysc_power: wrote to SYSISCR [ 1.088910] rcar_sysc_power(A3VP, off) [ 1.095792] rcar_sysc_power: will write to SYSISCR [ 1.108187] rcar_sysc_power: wrote to SYSISCR [ 1.110781] rcar_sysc_power(A3VP, on) [ 1.117628] rcar_sysc_power: will write to SYSISCR [ 1.130023] rcar_sysc_power: wrote to SYSISCR [ 1.132224] rcar_sysc_power(A3VP, off) [ 1.139106] rcar_sysc_power: will write to SYSISCR [ 1.151501] rcar_sysc_power: wrote to SYSISCR When I cat /dev/video0 I get the following messages in the kernel log / # cat /dev/video0 [ 4.673226] rcar_sysc_power(A3VP, on) [ 4.680816] rcar_sysc_power: will write to SYSISCR and the system then freezes. diff --git a/drivers/soc/renesas/pm-rcar.c b/drivers/soc/renesas/pm-rcar.c index d1bf8c231540..4a5f00d7f84d 100644 --- a/drivers/soc/renesas/pm-rcar.c +++ b/drivers/soc/renesas/pm-rcar.c @@ -139,6 +139,9 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on) int ret = 0; int k; + if (sysc_ch->isr_bit == 9) + printk(KERN_INFO "%s(A3VP, %s)\n", __func__, on ? "on" : "off"); + spin_lock_irqsave(&rcar_sysc_lock, flags); iowrite32(isr_mask, rcar_sysc_base + SYSCISCR); @@ -172,7 +175,16 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on) if (k == SYSCISR_RETRIES) ret = -EIO; + if (sysc_ch->isr_bit == 9) { + udelay(5000); + printk(KERN_INFO "%s: will write to SYSISCR\n", __func__); + udelay(5000); + } iowrite32(isr_mask, rcar_sysc_base + SYSCISCR); + if (sysc_ch->isr_bit == 9) { + udelay(5000); + printk(KERN_INFO "%s: wrote to SYSISCR\n", __func__); + } out: spin_unlock_irqrestore(&rcar_sysc_lock, flags);