From patchwork Fri Oct 28 16:27:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 9402293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5AD00601C0 for ; Fri, 28 Oct 2016 16:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DEF52A8A9 for ; Fri, 28 Oct 2016 16:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4037A2A8A1; Fri, 28 Oct 2016 16:30:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 092922A8A1 for ; Fri, 28 Oct 2016 16:30:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c0A16-000762-Gg; Fri, 28 Oct 2016 16:28:28 +0000 Received: from forward10j.cmail.yandex.net ([2a02:6b8:0:1630::185]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c0A0z-00074f-Nd for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2016 16:28:24 +0000 Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:8]) by forward10j.cmail.yandex.net (Yandex) with ESMTP id C25812183F; Fri, 28 Oct 2016 19:27:57 +0300 (MSK) Received: from smtp3p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp3p.mail.yandex.net (Yandex) with ESMTP id AB8D41320060; Fri, 28 Oct 2016 19:27:52 +0300 (MSK) Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id PluC7cGRoS-RhPCTcje; Fri, 28 Oct 2016 19:27:50 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aosc.xyz; s=mail; t=1477672071; bh=V2UrVbuwfxbTc+35f5kZaripAl5ezRT3mTX4RIyuafY=; h=From:To:Cc:Subject:Date:Message-Id; b=TdzxKvpkhiIhmDB8HNzQVFKfZwDjA4dvOdPVXGjY2nozMg4JO7uGBNP1amtwoRg35 Jtsx664lNEbYyM7mBY0pVUU5GONtG6up6ouxTd6sGEcVREx8QdO7jpGAoR/m7VG2In oCLA80QzpLY5Z3qJJOgZ5Uu4SW0kE4VSaRCWbj68= Authentication-Results: smtp3p.mail.yandex.net; dkim=pass header.i=@aosc.xyz X-Yandex-ForeignMX: FR X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 1130000036118848 From: Icenowy Zheng To: Kishon Vijay Abraham I , Maxime Ripard , Chen-Yu Tsai , Hans de Goede Subject: [PATCH v2] phy: sun4i: check PMU presence when poking unknown bit of pmu Date: Sat, 29 Oct 2016 00:27:01 +0800 Message-Id: <20161028162701.4531-1-icenowy@aosc.xyz> X-Mailer: git-send-email 2.10.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161028_092822_824265_1D800F96 X-CRM114-Status: GOOD ( 10.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Allwinner SoC's PHY 0, when used as OTG controller, have no pmu part. The code that poke some unknown bit of PMU for H3/A64 didn't check the PHY, and will cause kernel oops when PHY 0 is used. This patch will check whether the pmu is not NULL before poking. Fixes: b3e0d141ca9f (phy: sun4i: add support for A64 usb phy) Signed-off-by: Icenowy Zheng Acked-by: Maxime Ripard Reviewed-by: Hans de Goede --- drivers/phy/phy-sun4i-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index b9342a2..fec34f5 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c @@ -264,7 +264,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) return ret; } - if (data->cfg->enable_pmu_unk1) { + if (phy->pmu && data->cfg->enable_pmu_unk1) { val = readl(phy->pmu + REG_PMU_UNK1); writel(val & ~2, phy->pmu + REG_PMU_UNK1); }