Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2374560imm; Sun, 7 Oct 2018 02:43:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV60/C04qjeepRNC934ArWM7sxC65Cu/tgWkOQ0cQISNLh8YMWn28bdqODhRcUtQTDn3IGlLi X-Received: by 2002:a62:824a:: with SMTP id w71-v6mr19967508pfd.68.1538905403015; Sun, 07 Oct 2018 02:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538905402; cv=none; d=google.com; s=arc-20160816; b=sKdi2YJTP40pYhQFFAHIHIr5mMoXsuFNOU55bTz3hEeZgF3pXmHym80QbgZFVT/w9C pEaXwUpFim2OCPc/XKUB7xPIOIi+hn8KW2mNvfGwAj9PXxjqfNrEBQIC9z/m+Knl5F+j PUCXfug6oOiTygrQjA/0lBlBvmj0LM01gz6Oy5hrt1+26sk1uYwnaEdKRmUbZSCepvH5 5s1TdWKGZxoGqyoY4j1VHZ6HSQ/eWHIHSyRG8woywgep2H6SFxob6xkdXz8TcD02DL5N PnL63Kvc/kT6bSWJ8KD+X7bDWnXp89CYMKHdH1usMWsJnK2yDyP0xd8s+Bxb6vFaXOpe RzLg== 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=fiu6lnPeU4phX9V00ZR2tNYiooZmG+2QFmdM12GsKfE=; b=vFtSMVIEeJlEHmH31HbzSm+pQcCZ9vgJD2LfpCIb4CSHRi4n5va7XM/wbOHQbCCLML hhAgxLSVImL2GBOn13Y8qihzjBeTMxDwRXiUSjw6Rx+XbDKwcJfaqnmXzx9UyGtdU1Oy q5741y0D/BDMwN6qE/Xzw05WqKePSV9lFVQh2k9hmqtXQKd8oJBtflN7bpY5zOxBNVTJ rYmZilgHNg26odibkeliduYztqHr0pHJy6/6qcTv1ddX8HbIhNE85zt45hzvdOBoWhUG 8CBlyXMLcs3nYf6GuAXKoplRgvK9BhOHww2x8LJThFPfZMqg8guKaoiqLEbF0RfzwXs1 ncMw== 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 l30-v6si14644011plg.179.2018.10.07.02.42.38; Sun, 07 Oct 2018 02:43:22 -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 S1728396AbeJGQqo (ORCPT + 99 others); Sun, 7 Oct 2018 12:46:44 -0400 Received: from mailoutvs23.siol.net ([185.57.226.214]:39915 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728142AbeJGQqn (ORCPT ); Sun, 7 Oct 2018 12:46:43 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 14578520CB2; Sun, 7 Oct 2018 11:39:58 +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 Y3e8h4TU4dgE; Sun, 7 Oct 2018 11:39:57 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id B3223520CB3; Sun, 7 Oct 2018 11:39:57 +0200 (CEST) Received: from localhost.localdomain (cpe1-8-82.cable.triera.net [213.161.8.82]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id 587AF520CB2; Sun, 7 Oct 2018 11:39:55 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: robh+dt@kernel.org, sboyd@kernel.org, airlied@linux.ie, architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, 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 v2 16/29] drm/sun4i: Not all DW HDMI controllers has scrambled addresses Date: Sun, 7 Oct 2018 11:38:52 +0200 Message-Id: <20181007093905.11253-17-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181007093905.11253-1-jernej.skrabec@siol.net> References: <20181007093905.11253-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 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. Reviewed-by: Chen-Yu Tsai 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/sun= 4i/sun8i_hdmi_phy.c index 471993097ced..365cb5a9fb77 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_o= ps =3D { .setup_hpd =3D &dw_hdmi_phy_setup_hpd, }; =20 +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; =20 + 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) =20 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); } =20 --=20 2.19.0