Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5544867rwl; Wed, 28 Dec 2022 21:59:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVOSkW7zmV2LNLnQnQqzaA8En8Cm6iGcdl7P16vE0skMjKHHiuhjIfAvCba1XKqEc7SjeZ X-Received: by 2002:a05:6402:538f:b0:45c:835c:1ebb with SMTP id ew15-20020a056402538f00b0045c835c1ebbmr30066040edb.9.1672293572037; Wed, 28 Dec 2022 21:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672293572; cv=none; d=google.com; s=arc-20160816; b=IDrHa2audBsmskOzFRs3sJG26tfc+Tfhe6XaxFWeqpwHx0WwH36Cm4Ay+LlV01uHmT F+lvQveY7W/TUSMM8WaGYAO46J+KZLDeyBEUfF09+8eUrFprE7jWK0LfhGu79LQ06IIS 2i0K5s/Cy0qpYDK040cN90a0DyAdsE1631H/rPQbbXPdptsDonxR0Q5dL2AjF1nCY77i xT+5+JFbFA9zvhNyo1/+U6DEfxmAZxgodu6gGiXdhKq3bk+Pg9sNfDyMc3d7b/VzNLQ0 6F401N1IxxkLOdOvoyUMajVOH7HtOEwz31VQGOixnQ8KcwX8ZtFH3G3Ym4uZsV0LqGY9 9lvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=LZQmgbwDcpKr9IztEIOfeJw0O3qCcf74sTNpf+LXgos=; b=Z12tWDz9unq4mKlF36onTdS25GBe/qPDEfk52I+y4wkqaDkH1GvRK7Lnm9Yeb16SpB xgPHgU91AexSIP23TsYVrpVGb0oa09ZC1hEaW2hr9EIOWke/Wcw3vyis3mTsDnkGQfBF kjA0ncSeOhT/D4gJp3iQgU4m9fuEnzRTAptrYO3k/PMkDrD3Adelk4BRhtfY8kgUosDz sg1jVbBu131zyVD5kB6HSA/0DPfMkL20EDBJXg7HDAxexnl8nxE5gcTZNU0BlsA+Qhvd rOJh90lGZda+pMWkE3GbEJG7RPTIX1WygZ+udLOsNuwwn90MKd7piY2refaJMeXwq9C6 1UOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=ZEp9fH6Q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Gp2GOSGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b007c14d35a14asi12250024ejc.910.2022.12.28.21.59.17; Wed, 28 Dec 2022 21:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=ZEp9fH6Q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Gp2GOSGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbiL2FaV (ORCPT + 62 others); Thu, 29 Dec 2022 00:30:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiL2FaS (ORCPT ); Thu, 29 Dec 2022 00:30:18 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0B211C2A; Wed, 28 Dec 2022 21:30:17 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 14FD15C008D; Thu, 29 Dec 2022 00:30:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Dec 2022 00:30:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1672291815; x= 1672378215; bh=LZQmgbwDcpKr9IztEIOfeJw0O3qCcf74sTNpf+LXgos=; b=Z Ep9fH6QEx3q3eh1kAPLaG7WOCUmUSj4djncvkt6t7TzdAA7PI7bBi+j9/Se4Yihg k69nhBofuttI/ccLbplcLL4fBcit6uy3bqgk8gxB9ehDDBzTa8dcUZ8wKXsR6j6G 8z/cwlt+K5ktdSTP3b89OAB7VgINTJTRtlkjfnlg+X5wmuUNxSy9z4+tEqx3gQrZ 1/lWcZpKKRqlb/TU1uEzsxeZs8rWbol3iPQyfJGnl3X7TfP3yhnjwoZBVY81V/Bj /4rtG9BwCdjtl/raYR72vtVu6zXn+IeMc3IvdmkjztajD5CpIqnGH3HWyP8JbpIp ZFgXYibsAZPJG01AMP7/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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=fm2; t=1672291815; x= 1672378215; bh=LZQmgbwDcpKr9IztEIOfeJw0O3qCcf74sTNpf+LXgos=; b=G p2GOSGJs7uMlZYlVicY5yUAHZCwX11Hf22bOCPmXdMFi0TcaNoPu9fNPAowTBy8D u80wu7jKSdw1UQfb874xR5VsBI0ld7Su3lGkf18PDsTlWWjufYivjg5DFJks5aek D1oABkLWRk6rhWiobDyHj8zQ3mUgfEUZiMNe3sSVllaD3rucOvHWYKro5qkCJ1S6 q1ikDodA0eL0AnECP1zepahBk4oq3DwutLxPDR91FkvSBH3XDn9zoAbYOgk1/jKT hNtbtIW1R/Pkyo5UEVApB4BnbJoKB0FXoYB8B30y6WvMB3DXS58PwRa5qCe//6ce UXZudapmiWDtqHT/kaiAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieefgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepgfdtgfelffekveelvdeuteetfefgleelhfejteeiuefhheetueef fefgheefveefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 00:30:14 -0500 (EST) Message-ID: <81ec4472-1aa8-deb4-d060-0b6b340103ab@sholland.org> Date: Wed, 28 Dec 2022 23:30:14 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux ppc64le; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH] clk: sunxi-ng: h3/h5: Model H3 CLK_DRAM as a fixed clock Content-Language: en-US To: Icenowy Zheng , Chen-Yu Tsai , Jernej Skrabec Cc: Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev References: <20221229042230.24532-1-samuel@sholland.org> <58b64e74466a572d472a13515dd481600dd2c63d.camel@icenowy.me> From: Samuel Holland In-Reply-To: <58b64e74466a572d472a13515dd481600dd2c63d.camel@icenowy.me> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/28/22 23:22, Icenowy Zheng wrote: > 在 2022-12-28星期三的 22:22 -0600,Samuel Holland写道: >> The DRAM controller clock is only allowed to change frequency while >> the >> DRAM chips are in self-refresh. To support this, changes to the >> CLK_DRAM >> mux and divider have no effect until acknowledged by the memory >> dynamic >> frequency scaling (MDFS) hardware inside the DRAM controller. (There >> is >> a SDRCLK_UPD bit in DRAM_CFG_REG which should serve a similar >> purpose, >> but this bit actually does nothing.) >> >> However, the MDFS hardware in H3 appears to be broken. Triggering a >> frequency change using the procedure from similar SoCs (A64/H5) hangs >> the hardware. Additionally, the vendor BSP specifically avoids using >> the >> MDFS hardware on H3, instead performing all DRAM PHY parameter >> updates >> and resets in software. >> >> Thus, it is effectively impossible to change the CLK_DRAM >> mux/divider, >> so those features should not be modeled. Add CLK_SET_RATE_PARENT so >> frequency changes apply to PLL_DDR instead. >> >> Signed-off-by: Samuel Holland >> --- >> >>  drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 15 ++++++++++----- >>  1 file changed, 10 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi- >> ng/ccu-sun8i-h3.c >> index d3fcb983c17c..bfebe8dbbe65 100644 >> --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c >> +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c >> @@ -434,8 +434,13 @@ static SUNXI_CCU_GATE(usb_ohci2_clk,       "usb- >> ohci2",    "osc24M", >>  static SUNXI_CCU_GATE(usb_ohci3_clk,   "usb-ohci3",    "osc24M", >>                       0x0cc, BIT(19), 0); >>   >> -static const char * const dram_parents[] = { "pll-ddr", "pll- >> periph0-2x" }; >> -static SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents, >> +/* H3 has broken MDFS hardware, so the mux/divider cannot be >> changed. */ >> +static CLK_FIXED_FACTOR_HW(h3_dram_clk, "dram", >> +                          &pll_ddr_clk.common.hw, >> +                          1, 1, CLK_SET_RATE_PARENT | >> CLK_IS_CRITICAL); > > Should we do some sanity check on the values when probing CCU? It is not necessary, because the register value is ignored. The register is interpreted as if it contains 0x80000000, regardless of what you write to it. So the parent/divider listed here will always be correct. Regards, Samuel