Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1294947ybt; Thu, 9 Jul 2020 03:37:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzV49e10MFWkkqwKShs08sMLYGA8UGnNllw423ESrnFgwXMsQVz2c17BDJTo+I93vmbO5t X-Received: by 2002:aa7:dd8e:: with SMTP id g14mr73436894edv.208.1594291049388; Thu, 09 Jul 2020 03:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594291049; cv=none; d=google.com; s=arc-20160816; b=dMhIfq/DwWdO+xHc0e5fgp1a+SqTVRrKLjjYxi9r4zKq9w4eCJhVZ0jSegrMnCrm1Y DbUsF9OUOMUEzkyCsCIubAj+EzAC/9LLGn8rqN9kl14+70JrMjVUluCpM+JP2QcJXRwx A6vOMczVcQMIaRNySv+gSiFyycaLfX1xmiBgelDLzfDohgmtwo+YG6D9QiQIObaKct7h FPjXbSbQgkdnjO/wipKkfHkpv4S+hY2ij8e8Ydj3CmuYJ3qXxXTbqmpFzGOeiUQCNtt5 L/l1K60hxdzBfCSC46ZsZBscd0xGjKBrqwnSccximqjzSfTozEshiTdqmw7TKCn4k7Ws 6oGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=zktrMvcYLs5/6jACJL5XBlQkQxdMtnaHNF0eFCENuGs=; b=xERQnS/7HwNXnQ1urGoCLZKoEuvpjuhItt2ytENmt8BsA/zOJ3mo+bQKJjsJY59agF A2qnLOorFcycY685O6JlhhpZoctA9HaJLT43C/8C4Sns6g1OnxRVu/RoLh0U1DLuIVbG QTCkbkpPItGc+U56RFWOodGadwWMwViY3WqNZY5AxssxxhUdyClg1BbUzJLh2eZkr5QG kGXkVDgtZW/tfDq0yjpJ3Ld0l5pS/3nDWbmz9boxsBpZkVxhE0eP+Cl1Q3cFOK95y2zG HXxE9Ok9X7GbThhrMtFTzAnY1ypeqD+WkJg2gfkmvh6nHxkpRR/vnkZ5lowdfT/DBbIv CW0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si1596253ejd.356.2020.07.09.03.37.06; Thu, 09 Jul 2020 03:37:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726523AbgGIKg3 (ORCPT + 99 others); Thu, 9 Jul 2020 06:36:29 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:2222 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726510AbgGIKg2 (ORCPT ); Thu, 9 Jul 2020 06:36:28 -0400 X-IronPort-AV: E=Sophos;i="5.75,331,1589209200"; d="scan'208";a="51715516" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 09 Jul 2020 19:36:26 +0900 Received: from localhost.localdomain (unknown [10.166.252.89]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 5CA88422A5A9; Thu, 9 Jul 2020 19:36:26 +0900 (JST) From: Yoshihiro Shimoda To: kishon@ti.com, vkoul@kernel.org Cc: wsa+renesas@sang-engineering.com, geert+renesas@glider.be, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH] phy: renesas: rcar-gen3-usb2: fix SError happen if DEBUG_SHIRQ is enabled Date: Thu, 9 Jul 2020 19:36:18 +0900 Message-Id: <1594290978-8205-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_DEBUG_SHIRQ was enabled, r8a77951-salvator-xs could boot correctly. If we appended "earlycon keep_bootcon" to the kernel command like, we could get kernel log like below. SError Interrupt on CPU0, code 0xbf000002 -- SError CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc3-salvator-x-00505-g6c843129e6faaf01 #785 Hardware name: Renesas Salvator-X 2nd version board based on r8a77951 (DT) pstate: 60400085 (nZCv daIf +PAN -UAO BTYPE=--) pc : rcar_gen3_phy_usb2_irq+0x14/0x54 lr : free_irq+0xf4/0x27c This means free_irq() calls the interrupt handler while PM runtime is not getting if DEBUG_SHIRQ is enabled and rcar_gen3_phy_usb2_probe() failed. To fix the issue, add a condition into the interrupt handler to avoid register access if any phys are not initialized. Note that rcar_gen3_is_any_rphy_initialized() was introduced on v5.2. So, if we backports this patch to v5.1 or less, we need to make other way. Reported-by: Wolfram Sang Reported-by: Geert Uytterhoeven Fixes: 9f391c574efc ("phy: rcar-gen3-usb2: add runtime ID/VBUS pin detection") Signed-off-by: Yoshihiro Shimoda --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index bfb22f8..91c732d 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -507,9 +507,13 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) { struct rcar_gen3_chan *ch = _ch; void __iomem *usb2_base = ch->base; - u32 status = readl(usb2_base + USB2_OBINTSTA); + u32 status; irqreturn_t ret = IRQ_NONE; + if (!rcar_gen3_is_any_rphy_initialized(ch)) + return ret; + + status = readl(usb2_base + USB2_OBINTSTA); if (status & USB2_OBINT_BITS) { dev_vdbg(ch->dev, "%s: %08x\n", __func__, status); writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); -- 2.7.4