From patchwork Mon Nov 28 07:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1709576 X-Patchwork-Delegate: andre.przywara@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm2 header.b=XlnjOLJP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=E5HmqqT6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLGf20lphz23nB for ; Mon, 28 Nov 2022 18:03:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 305DF8523B; Mon, 28 Nov 2022 08:02:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="XlnjOLJP"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="E5HmqqT6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9EC9A8521A; Mon, 28 Nov 2022 08:02:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2C7F84C36 for ; Mon, 28 Nov 2022 08:02:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E9DF25C008B; Mon, 28 Nov 2022 02:02:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 28 Nov 2022 02:02:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1669618954; x=1669705354; bh=cR ADXFm9MnOf9XusC00n7eLV8jG4lHni3/nOyL+L4Wc=; b=XlnjOLJPYluSssRlH7 8eTnLc+hMpzfovN+t4+h3EVwPaDVMWtLhEkkjA/pv6QktIjBp5eNA4if2X6zwWnU l1x9N0rPeYcZ9xktmdeyeHjmQsqJvaq60fNJFVtiqMBzhiZ4B/EVShJMOYyIW9Du 78Vw3NtONl4Lu1ad39y8IQ06N+XVSVlYjPZU6eT54kkvfiIVXG22ZHXE6Bgtuph/ oHWusTmNHJ5idXWu6fkdqDdmoVhqIJOFrArUwiYTNTEqFRb41y8oSdlbQy1Xx9FS WKHAvwERwr03u62fjs+Bpt8xoXTo3tHCpSH9FxUWKfLbEMc4FotvPqCeeUwnMdlD 20yA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1669618954; x=1669705354; bh=cRADXFm9MnOf9 XusC00n7eLV8jG4lHni3/nOyL+L4Wc=; b=E5HmqqT6bQVtQpgcNEayv+UwcvdmB wmJSvVFsKlN7ykpJ+CEgRaY0y//jgwOyTN4aqKBzlNjTro2CtPTqYyPayfzp6koT kpkdKUEkPsXMD/Boe3PtB8XNf696vFQlqdRa/1GmhExvPAohseps3uIjUvN8kSjT cERCi8+KthZCMnY6CwLyQf8p+LTwU2VjyK9bryYAdvwz4jlE4uXMVbs8D723bhWj 2JT4WxGe/uBXFDsqWn9nYvadUbG4THNx5yyIhiBQ7hsv1SP584gR2nJ4DEQNafFJ h5X5YHyaRq8Fk/F+LpDfqMBe+hAiflJKZNfysjUqo8aMRaf+3gG+ZEOjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrjedugddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Nov 2022 02:02:34 -0500 (EST) From: Samuel Holland To: Andre Przywara , Jernej Skrabec , Anatolij Gustschin Cc: Samuel Holland , Jagan Teki , Lukasz Majewski , Sean Anderson , u-boot@lists.denx.de Subject: [PATCH 4/5] video: sunxi: dw-hdmi: Use DM for clock gates and resets Date: Mon, 28 Nov 2022 01:02:27 -0600 Message-Id: <20221128070229.4394-5-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221128070229.4394-1-samuel@sholland.org> References: <20221128070229.4394-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean This abstracts away the CCU register layout, which is necessary for supporting new SoCs like H6 with a reorganized CCU. One of the resets is referenced from the PHY node instead of the controller node, so it will have to wait until the PHY code is factored out to a separate driver. Signed-off-by: Samuel Holland --- drivers/video/sunxi/sunxi_dw_hdmi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c index 4f5d0989286..04588b570fd 100644 --- a/drivers/video/sunxi/sunxi_dw_hdmi.c +++ b/drivers/video/sunxi/sunxi_dw_hdmi.c @@ -5,12 +5,14 @@ * (C) Copyright 2017 Jernej Skrabec */ +#include #include #include #include #include #include #include +#include #include #include #include @@ -327,6 +329,8 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev) struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev); struct sunxi_ccm_reg * const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; + struct reset_ctl_bulk resets; + struct clk_bulk clocks; int ret; /* Set pll3 to 297 MHz */ @@ -336,14 +340,24 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev) clrsetbits_le32(&ccm->hdmi_clk_cfg, CCM_HDMI_CTRL_PLL_MASK, CCM_HDMI_CTRL_PLL3); - /* Set ahb gating to pass */ - setbits_le32(&ccm->ahb_reset1_cfg, 1 << AHB_RESET_OFFSET_HDMI); + /* This reset is referenced from the PHY devicetree node. */ setbits_le32(&ccm->ahb_reset1_cfg, 1 << AHB_RESET_OFFSET_HDMI2); - setbits_le32(&ccm->ahb_gate1, 1 << AHB_GATE_OFFSET_HDMI); - setbits_le32(&ccm->hdmi_slow_clk_cfg, CCM_HDMI_SLOW_CTRL_DDC_GATE); - /* Clock on */ - setbits_le32(&ccm->hdmi_clk_cfg, CCM_HDMI_CTRL_GATE); + ret = reset_get_bulk(dev, &resets); + if (ret) + return ret; + + ret = clk_get_bulk(dev, &clocks); + if (ret) + return ret; + + ret = reset_deassert_bulk(&resets); + if (ret) + return ret; + + ret = clk_enable_bulk(&clocks); + if (ret) + return ret; sunxi_dw_hdmi_phy_init(&priv->hdmi);