Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6789065yba; Tue, 14 May 2019 13:46:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfu72PnrSTUchP/4PZHccM48uJ58xp8+lb8MvvB7PC2mbTjjDAo8knHx8aW/EZ7ABthicR X-Received: by 2002:a17:902:6683:: with SMTP id e3mr32332409plk.291.1557866779093; Tue, 14 May 2019 13:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557866779; cv=none; d=google.com; s=arc-20160816; b=FQeKXyJJT2QWBWfsZCMt/WYnHdsIfdxH+myVwZmiMPsXgjCQXVQU7g4WRkThKLyIUf xEHGf+2K3xatPfuTtPLh5ZBgKTxcsFEGCyRC12GTyhCDws9fCblsgNuLhmcdqalI56ae JmHvYkgHMSrdIUZaadPeqps3MXer5/JyVQba00SpZZhJpAOQTZVDges6DceM+onXYdAF 6NeVuCdk/6jEGFDSw5OCHwYb/Zf8uYxGtiE2jKeSJHjwqE/NZyvxxLBqEIzYqGP7uqKu CEgY32uQSptQAPThp4mbUyOx7Gm4FS4T4ro0fu34MCvXWA8LonaGy0u7WANM+t91Xm5w Wdmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3E8snDbAhz3sT0rz2hGe+sb2w73MBXvT3pnZYA53V5A=; b=rqryQy5xFaggHlHVNX/0IIaqg3TYJfIed9OBTszASHk1E7lL0UoaWavnxM0mDYq305 x1BHI/K4kElY79EYeSKVT7jsXi30a6Qmrh1YL8e5kDiHDMuv+9TErwHzsrNoUIzUFxQr RVlbJ1sctMR3h6EUaQGym3msGxtnDS0nbFLY0xu74iDHdvE3BYBavCNRVmTHlmlHQjng WwfJRnegHaLzlRMbdbSw4r0JeMpJhnHfc18dgktPrGvGHMZZ9B++s59NiDMHwrHXwYY4 N85yk7/AIuntelm8YwahorAlscF6Jz996vaj1VCWG/h2VPl+80ZeMDFOrQl7CqSBpvsX OgEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k19si11069722pls.63.2019.05.14.13.46.04; Tue, 14 May 2019 13:46:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbfENUnv (ORCPT + 99 others); Tue, 14 May 2019 16:43:51 -0400 Received: from mailoutvs17.siol.net ([185.57.226.208]:59406 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726148AbfENUnu (ORCPT ); Tue, 14 May 2019 16:43:50 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 1FCCB521E15; Tue, 14 May 2019 22:43:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta09.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta09.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id P6TEBCYv139H; Tue, 14 May 2019 22:43:47 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 7A8BB521E08; Tue, 14 May 2019 22:43:47 +0200 (CEST) Received: from localhost.localdomain (cpe-86-58-52-202.static.triera.net [86.58.52.202]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id AEE1E521E34; Tue, 14 May 2019 22:43:44 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, stable@vger.kernel.org Subject: [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization Date: Tue, 14 May 2019 22:43:36 +0200 Message-Id: <20190514204337.11068-2-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190514204337.11068-1-jernej.skrabec@siol.net> References: <20190514204337.11068-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current code initializes HDMI PHY clock driver before reset line is deasserted and clocks enabled. Because of that, initial readout of clock divider is incorrect (0 instead of 2). This causes any clock rate with divider 1 (register value 0) to be set incorrectly. Fix this by moving initialization of HDMI PHY clock driver after reset line is deasserted and clocks enabled. Cc: stable@vger.kernel.org # 4.17+ Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant") Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun= 4i/sun8i_hdmi_phy.c index 66ea3a902e36..afc6d4a9c20b 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -672,22 +672,13 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi= , struct device_node *node) goto err_put_clk_pll0; } } - - ret =3D sun8i_phy_clk_create(phy, dev, - phy->variant->has_second_pll); - if (ret) { - dev_err(dev, "Couldn't create the PHY clock\n"); - goto err_put_clk_pll1; - } - - clk_prepare_enable(phy->clk_phy); } =20 phy->rst_phy =3D of_reset_control_get_shared(node, "phy"); if (IS_ERR(phy->rst_phy)) { dev_err(dev, "Could not get phy reset control\n"); ret =3D PTR_ERR(phy->rst_phy); - goto err_disable_clk_phy; + goto err_put_clk_pll1; } =20 ret =3D reset_control_deassert(phy->rst_phy); @@ -708,18 +699,29 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi= , struct device_node *node) goto err_disable_clk_bus; } =20 + if (phy->variant->has_phy_clk) { + ret =3D sun8i_phy_clk_create(phy, dev, + phy->variant->has_second_pll); + if (ret) { + dev_err(dev, "Couldn't create the PHY clock\n"); + goto err_disable_clk_mod; + } + + clk_prepare_enable(phy->clk_phy); + } + hdmi->phy =3D phy; =20 return 0; =20 +err_disable_clk_mod: + clk_disable_unprepare(phy->clk_mod); err_disable_clk_bus: clk_disable_unprepare(phy->clk_bus); err_deassert_rst_phy: reset_control_assert(phy->rst_phy); err_put_rst_phy: reset_control_put(phy->rst_phy); -err_disable_clk_phy: - clk_disable_unprepare(phy->clk_phy); err_put_clk_pll1: clk_put(phy->clk_pll1); err_put_clk_pll0: --=20 2.21.0