Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp841270imm; Sun, 2 Sep 2018 00:31:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaYINJIbVBIkgh64iiN6FtiqXQmVCYpN02BS4LLfZKwvYqXHQuCzeiVv1ASGaiTGsK3Z3UC X-Received: by 2002:a17:902:6808:: with SMTP id h8-v6mr23114110plk.27.1535873413530; Sun, 02 Sep 2018 00:30:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535873413; cv=none; d=google.com; s=arc-20160816; b=tEoaXg4O04LJrS/qxGHyaH8Tdr+/mcC+fTzwKrRxYJioOVBDtKPQdVrdylVEV4FucF EuEvyUUlQK1oGv1+2zU2FGpdxmrHiOgzSMr43Wzwow0zs9NqYR46sPq+q3mDNBxQcD+v DLhmm3ps3nTQTPGA2Q/2YUPZpztOQBfYcHJ5ceB9fs3tR2grd2IgoiHj6UYL519uq3CK EykV5tDY+h+I5nGp7O/NfWY8Aq/hobhgQvxSw3sk69e1R1vOlq7qjS4k9HMjnGyKAPJH sVgWcScmiLXcRRysIlEJ98jtvQkThCj4mKymzpcSFoYh1cmO2FfzsArOsWtj/PCIrNCW l/kg== 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=tKDgP1kFYCalcdXkEmB9CGMjcR3Tx29ZbtEcCsmMXH8=; b=XWXjD3b14Tf3Hy/bVlJj1z4fcnVGMY9AVwAgjXvOwIR6Fgjez8Y3NURDsMGDHP2xr+ KCqKtUw5z6Ky6FpD+cFani/05GH8yRJmmr1MnpRKhq6k1fhLHBrk0kUDmd46k3RRldSa JZNCuceMZULvX15fVwNb3T6asFZVEokexqU3jK+GO6lqIldYJkLms9tyGBSyDXPnDxxO QNaYyyfdYmaWvDecJGN+iC7gdRQTn0A4rQv+CHE/gwpp8YNsg8DhY3MLcfwRNEm3KNR+ mGjCAE4g4L+3/IKZquz6USnks+Xd3WhVqjGfls/ybP3Wc50MxJe5oau0RZXRBduADSWq YycA== 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 cb1-v6si15695038plb.128.2018.09.02.00.29.41; Sun, 02 Sep 2018 00:30:13 -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 S1727500AbeIBLm2 (ORCPT + 99 others); Sun, 2 Sep 2018 07:42:28 -0400 Received: from mailoutvs27.siol.net ([185.57.226.218]:54873 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727415AbeIBLm1 (ORCPT ); Sun, 2 Sep 2018 07:42:27 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id CB1F2520C5B; Sun, 2 Sep 2018 09:27:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta10.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta10.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id JZzMr-UtoKfN; Sun, 2 Sep 2018 09:27:37 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 46F89520C96; Sun, 2 Sep 2018 09:27:37 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id B8D7D520C5B; Sun, 2 Sep 2018 09:27:34 +0200 (CEST) From: Jernej Skrabec To: robh+dt@kernel.org, maxime.ripard@bootlin.com, wens@csie.org Cc: mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, airlied@linux.ie, architt@codeaurora.org, a.hajda@samsung.com, jernej.skrabec@siol.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com Subject: [PATCH 15/27] drm/sun4i: Not all DW HDMI controllers has scrambled addresses Date: Sun, 2 Sep 2018 09:26:31 +0200 Message-Id: <20180902072643.4917-16-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180902072643.4917-1-jernej.skrabec@siol.net> References: <20180902072643.4917-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently supported Allwinner SoCs with DW HDMI controller have scrambled addresses and read lock. However, that is not true in general. For example, A80 and H6 have normal addresses and normal read access. Move code for unscrambling addresses and unlocking read access to it's own function and call it from init function. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 82502b351aec..ad4ba1cc83b4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -279,8 +279,21 @@ static const struct dw_hdmi_phy_ops sun8i_hdmi_phy_ops = { .setup_hpd = &dw_hdmi_phy_setup_hpd, }; +static void sun8i_hdmi_phy_unlock(struct sun8i_hdmi_phy *phy) +{ + /* enable read access to HDMI controller */ + regmap_write(phy->regs, SUN8I_HDMI_PHY_READ_EN_REG, + SUN8I_HDMI_PHY_READ_EN_MAGIC); + + /* unscramble register offsets */ + regmap_write(phy->regs, SUN8I_HDMI_PHY_UNSCRAMBLE_REG, + SUN8I_HDMI_PHY_UNSCRAMBLE_MAGIC); +} + static void sun8i_hdmi_phy_init_a83t(struct sun8i_hdmi_phy *phy) { + sun8i_hdmi_phy_unlock(phy); + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK, SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK); @@ -298,6 +311,8 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy) { unsigned int val; + sun8i_hdmi_phy_unlock(phy); + regmap_write(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, 0); regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, SUN8I_HDMI_PHY_ANA_CFG1_ENBI, @@ -372,14 +387,6 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy) void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy) { - /* enable read access to HDMI controller */ - regmap_write(phy->regs, SUN8I_HDMI_PHY_READ_EN_REG, - SUN8I_HDMI_PHY_READ_EN_MAGIC); - - /* unscramble register offsets */ - regmap_write(phy->regs, SUN8I_HDMI_PHY_UNSCRAMBLE_REG, - SUN8I_HDMI_PHY_UNSCRAMBLE_MAGIC); - phy->variant->phy_init(phy); } -- 2.18.0