Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5772215imm; Tue, 12 Jun 2018 13:05:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK8TuPKs0e5bQ1HtdqZrgTDRO0fiOTc+xRPTTauUdDssR6l9zJr2hIZspVYN0od2+aulGm2 X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr1491163pgn.394.1528833929918; Tue, 12 Jun 2018 13:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528833929; cv=none; d=google.com; s=arc-20160816; b=zLtltxdJSIAQipIArNFJFhv1msGjh2MDNGhwJxcjqAmyOv98BwdzlJjWd1uZw8BbI0 cCbrh6hRufEHoACArNpAiMo4Hl3EXtKnAS9fOnmaB7Qt66ScvRHtcTslkWtLxmyukyue 7B4lvrxq320N7wy828d2+UdTn1KIweUu4Zn5UAm2LwljqujdKQ+JS85/qh8ovtPkdl57 X+0esDNKcKtmPZn5YuouZm1i3+U5fz0gY7p3wpPPlH+MjyJl6qHUyk+wS1Pmr7s69tgj ffVDD2tBMNSGBWZtKXPXCVwZylEy4p7SjG1DxJsO2Gwb/fDj4IcN3ZMwdTJzzTWueSQV 5j5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5N3+EaptIUnjxIyj9ia2w56MXZPa+g1mopbyk6P3sXY=; b=a1kuHg3AnQmlYqyEsXJcKRtgpnnMSo7xiogBEFsj1vQnTJVH0lC5j8mJV0bgINlOih S+6OQTFQRor8rjQQuRnyJNGJshCtdR+9DvH8Y/5r0zRL9rIetSxsD0nt6wkkYBJlbIkR i4k4KPJU41pRbaS92FbNH5IuRRLuBC8b6ZEGZ9hoLPC88ixsY89qpqkWYORMkOJchMlP ttajwSzri7OHUyzBintsRKYXadErDNUyUv66IoJ1zv+alPxfEuthbAPbf9CXbHwYv/JK 1X8MafUjhMEve4CeBo1KWhMYzOWHtG+y+wvatxd1HfdyyCyDQFhobY3SGeUe4LnSCWEi qyEA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3-v6si877164pld.87.2018.06.12.13.05.15; Tue, 12 Jun 2018 13:05:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934542AbeFLUCp (ORCPT + 99 others); Tue, 12 Jun 2018 16:02:45 -0400 Received: from mailoutvs60.siol.net ([185.57.226.251]:38716 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934398AbeFLUCl (ORCPT ); Tue, 12 Jun 2018 16:02:41 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id A8D05522148; Tue, 12 Jun 2018 22:02:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rt3bZRLfIuhT; Tue, 12 Jun 2018 22:02:39 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 1FB9B522020; Tue, 12 Jun 2018 22:02:39 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 95410522148; Tue, 12 Jun 2018 22:02:36 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Cc: airlied@linux.ie, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, seanpaul@chromium.org, mark.rutland@arm.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v2 20/27] drm/sun4i: Don't change clock bits in DW HDMI PHY driver Date: Tue, 12 Jun 2018 22:00:29 +0200 Message-Id: <20180612200036.21483-21-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612200036.21483-1-jernej.skrabec@siol.net> References: <20180612200036.21483-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DW HDMI PHY driver and PHY clock driver share same registers. Make sure that DW HDMI PHY setup code doesn't change any clock related bits and set them to 0 during initialization. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 79154f0f674a..3ba71aff92fc 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -98,7 +98,7 @@ #define SUN8I_HDMI_PHY_PLL_CFG1_LDO2_EN BIT(29) #define SUN8I_HDMI_PHY_PLL_CFG1_LDO1_EN BIT(28) #define SUN8I_HDMI_PHY_PLL_CFG1_HV_IS_33 BIT(27) -#define SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL BIT(26) +#define SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK BIT(26) #define SUN8I_HDMI_PHY_PLL_CFG1_PLLEN BIT(25) #define SUN8I_HDMI_PHY_PLL_CFG1_LDO_VSET(x) ((x) << 22) #define SUN8I_HDMI_PHY_PLL_CFG1_UNKNOWN(x) ((x) << 20) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 966688f04741..cd07ceb71601 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -183,7 +183,13 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi, regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, SUN8I_HDMI_PHY_ANA_CFG1_TXEN_MASK, 0); - regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, pll_cfg1_init); + /* + * NOTE: We have to be careful not to overwrite PHY parent + * clock selection bit and clock divider. + */ + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, + (u32)~SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK, + pll_cfg1_init); regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG2_REG, (u32)~SUN8I_HDMI_PHY_PLL_CFG2_PREDIV_MSK, pll_cfg2_init); @@ -352,6 +358,10 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy) SUN8I_HDMI_PHY_ANA_CFG3_SCLEN | SUN8I_HDMI_PHY_ANA_CFG3_SDAEN); + /* reset PLL clock configuration */ + regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, 0); + regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG2_REG, 0); + /* set HW control of CEC pins */ regmap_write(phy->regs, SUN8I_HDMI_PHY_CEC_REG, 0); -- 2.17.1