Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1903665imd; Sun, 4 Nov 2018 12:07:19 -0800 (PST) X-Google-Smtp-Source: AJdET5eO0t1aRxMIiclg7Aj4gAf7rvfMDTwuFF93jqlLRYM1lCpbyJ4406nMnEbvxQbA3lcDj2qg X-Received: by 2002:a63:396:: with SMTP id 144mr17997974pgd.68.1541362039391; Sun, 04 Nov 2018 12:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541362039; cv=none; d=google.com; s=arc-20160816; b=pImg4A4Jjv9176Prb1uQnJtE2bEpqh09UOhbQ2P/HteUbLuAfCbZwAxYI4mkx3YwLN SXePbQVSxDsMVZZMgtD981EYlMMgwZ8dEZAtknFS+/STDy1ZdZiGfMLIA5Z5eNbw5xK/ +2eU8kBXCO/TvYoMewqLWT1l6xfCId5138ooNTNaIxcHCzGPXXJ903Clc/V9maT+KfI6 WS39noj/EZpTXe887QtyosJp1vaxrwAjMjZ/XHWKSlnLOeJs2kDHWQ4upeeL6BGbHDag EUIcz6C5CQb/BLVLunkNaR227kExfCnm2OWCQNRa+gNTDhSDelobgG9yqSucJoHTYBV/ GBkQ== 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=K3W1M4baproBHyPDTVpXE3n9Vmftkc3kLOt+dgu7BIg=; b=yyUm+OJoWUjt2KJ/DzHAdkyYVLU0rbHRzCPSYA3sSVuewJPQx0W7TeACGRdiNQ7C7w 2gW6Dguz52FVDKmjEWoCoCQX9TacAsPjO5psS3jetL6EmMZp47COgIvzaAWlTImcMLxj OAIurRzT51GmMqUVKtUNNehEGpvpBk0ESQJVSVDcYerWdlRLQ7UL1Fm0KSi98MOl3IYj lKeV6Ed8oh2DQ0+x0Q4MFIalsnb6fSMbuLovRGKEfBRgXy+11lo1odKJVqZH3io3BoTh N+SD6yEjlgOYqyxvsRt1EnV2aMO2R426uUbkfCIx+jiFjKDz0cfHAQ6jHCCWdD/IEdf4 xLGw== 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 b2-v6si43271822plk.356.2018.11.04.12.07.03; Sun, 04 Nov 2018 12:07:19 -0800 (PST) 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 S2387791AbeKEDpb (ORCPT + 99 others); Sun, 4 Nov 2018 22:45:31 -0500 Received: from mailoutvs54.siol.net ([185.57.226.245]:47494 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387509AbeKEDoM (ORCPT ); Sun, 4 Nov 2018 22:44:12 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 25844521292; Sun, 4 Nov 2018 19:28:17 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta11.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta11.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id EXPs8T1TRFIb; Sun, 4 Nov 2018 19:28:16 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 5E8D4521257; Sun, 4 Nov 2018 19:28:13 +0100 (CET) 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 CE49A521270; Sun, 4 Nov 2018 19:28:10 +0100 (CET) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: robh+dt@kernel.org, mturquette@baylibre.com, 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, jernej.skrabec@siol.net Subject: [PATCH v3 15/28] drm/sun4i: Not all DW HDMI controllers has scrambled addresses Date: Sun, 4 Nov 2018 19:26:52 +0100 Message-Id: <20181104182705.18047-16-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181104182705.18047-1-jernej.skrabec@siol.net> References: <20181104182705.18047-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.1