Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp1950300rwb; Sun, 6 Aug 2023 06:41:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSbhUbtFCS+KERTqwyW2k742vqAShIK9tBh2UI1ZCYx/1uzOxm6RArjzWhH2Lrlmjy8NnJ X-Received: by 2002:a17:906:538b:b0:974:771e:6bf0 with SMTP id g11-20020a170906538b00b00974771e6bf0mr5559338ejo.56.1691329284632; Sun, 06 Aug 2023 06:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691329284; cv=none; d=google.com; s=arc-20160816; b=q4UjOrNoMn1WL1uHQPVu0a0PBketZXuSwlTv53TNLBARnNqQY9iUN/jlrrKp0Fpi+Y Ounm1Fr66cpH7OqCwwCtHzaacOKSaYJrWaZJdOGnF4K9GRvjhce0Y+0xHv3e2f0eOulR x4QxTEat9OrVwITbSTzRiQX2l7OKARFPcYbKflDKLcSlEzuaXw4TYuFur4kLwlBEHiW1 2zlkkMepJk8npiRmAEBLm/p6xZdZxkiFW0Q/y3b3oHYN1EbccHNW9y7BVt40IZhsSDsX 7mubOImvSLNh+mC4oB8aaiMyX4u9/IVVmvT1Q83Qpy9J5vs6U6GeQcDu+We0kQJjDQyD RovA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=4/3jUW02TnjdYtDtyTpuIK2UaIeAHqfX2p8U1BU0MxI=; fh=M9yx7jU6gfL0XqpiqAwzTAv2FmAT4GrM9Su5qEJ6kqE=; b=dFoeh6M70WJ3BCTnOmE4ksWM1png25cTqGVGAtUQZCxtlF/Kw7zRpF9pcOd1pVKOR7 5ED+iQsYQLD7hWFZeFWxG3dsWeVPMo8r6eIzuuI4BSWFsd+rX0Bfm4Nxm+phWZcPYF3P J8nDJl+F6PRKGUWVA+tBw3Bi4x8V2wiqz3nNVNNnA4F6ijM5XK9xLrO2NRxUmCc3xRe4 jjaA37em+af0xxdcEAInkl5p0rPwQJvtV6bBiv/0RZLCR9a6PKydRgueF7FVbHnqvXG0 WCITJ2p5Q5bRt80lOmhdIKqljbzogQb9uiFPBZprqMGiDrssK1VxKF5yGvuJmE9+FJLc uKEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=gE7Qe3FR; 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=oltmanns.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170906584e00b0099bd8bf3e32si3560971ejs.233.2023.08.06.06.40.59; Sun, 06 Aug 2023 06:41:24 -0700 (PDT) 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=@oltmanns.dev header.s=MBO0001 header.b=gE7Qe3FR; 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=oltmanns.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbjHFNH6 (ORCPT + 99 others); Sun, 6 Aug 2023 09:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjHFNHu (ORCPT ); Sun, 6 Aug 2023 09:07:50 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D860797; Sun, 6 Aug 2023 06:07:43 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4RJfrD33wsz9sW4; Sun, 6 Aug 2023 15:07:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1691327260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4/3jUW02TnjdYtDtyTpuIK2UaIeAHqfX2p8U1BU0MxI=; b=gE7Qe3FRFfS94coh3aDOD8vptroCe3bBW+0OxrKURdeA3qO5Ju1i3fiatm7ld2i9Cb4pih ZSLBYQsXzfxcKogOwUvKKMk6r73PE0iW+vK1bIUTk7Xq9pivsMGGtRQJxyAigKI4qunryr hz6vbUGlnzBwyD+/hy7jlGkYxhTixrljqUcddK5rANl281G8UlXGSLEMYwjS9c+iWAI+cA lnFJCxZmIrpoSw1kHGw3Eb59hArMs20dh8jea63dNOlMtiFJUmPIuw69VRQYR7hXUGHvaY MP2ywuLMlrJYqfhWvWIb0caXFfxntEqLuJWRuj/lwZLnd6i0zKXe5MNpMxNvFg== From: Frank Oltmanns Date: Sun, 06 Aug 2023 15:06:54 +0200 Subject: [PATCH v5 09/11] clk: sunxi-ng: div: Support finding closest rate MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230806-pll-mipi_set_rate_parent-v5-9-db4f5ca33fc3@oltmanns.dev> References: <20230806-pll-mipi_set_rate_parent-v5-0-db4f5ca33fc3@oltmanns.dev> In-Reply-To: <20230806-pll-mipi_set_rate_parent-v5-0-db4f5ca33fc3@oltmanns.dev> To: Maxime Ripard , Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Roman Beranek Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=2120; i=frank@oltmanns.dev; h=from:subject:message-id; bh=BCjq/TvLd7Vyg2yzlkEqCcyLfH3Gamqs91hzh7NVMYE=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBkz5sIf22ZiEzq9muhL+X98DikF0J5zWcMcfZ/X JEogB868vCJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZM+bCAAKCRCaaaIIlErT x0KHC/9K9WzyLIVvorKsrsgQ0ioaRIfo7CZj7TNN8U43TMKhkP3w8KNLB06KXAc44ncAaVr2VTq rbJjUSPcSOR7JOAl1n4ViT4rTmULgcBXJXuHSHz2uvU1+6JonUqsZQn5i1ug2ikBDXFQXUFuPf5 VK3opMLlzgsVK06LrxsvkznBDULFAyWLfN4SAMnz7IuRsKaXR1lgwrMFiQ+t5kmcI8vwZagiiuC hq0XZNza6EZBAfkGO2RwfCd6116bcbXGs7BtNe1mDKivmc6dov4ePoR58MQb1y977nPJPRpYzR9 zm7PTQFjx9HIyV1ILniEC5xu1/8UWKyOkdZqyeTvPr6HHxUoEmS6TKPOfEJd4c7DnGaioTgzVZj 4/2eOvlbnbfBARSo/vcEXMF/xGwd2BGYNYQxgh8p/v9V0inCm5KPzmGpuka4KloQYjRA/Ak0Hup MfeV1lUJlxgVnek3hus37oxUyXowYFfRfJVIOPhR4Inf+P0K/2nr7CbJR+11cgC/W5kxM= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4RJfrD33wsz9sW4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,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 Add initalization macros for divisor clocks with mux (SUNXI_CCU_M_WITH_MUX) to support finding the closest rate. This clock type requires the appropriate flags to be set in the .common structure (for the mux part of the clock) and the .div part. Acked-by: Maxime Ripard Signed-off-by: Frank Oltmanns --- drivers/clk/sunxi-ng/ccu_div.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_div.h b/drivers/clk/sunxi-ng/ccu_div.h index 948e2b0c0c3b..90d49ee8e0cc 100644 --- a/drivers/clk/sunxi-ng/ccu_div.h +++ b/drivers/clk/sunxi-ng/ccu_div.h @@ -143,6 +143,26 @@ struct ccu_div { }, \ } +#define SUNXI_CCU_M_WITH_MUX_TABLE_GATE_CLOSEST(_struct, _name, \ + _parents, _table, \ + _reg, \ + _mshift, _mwidth, \ + _muxshift, _muxwidth, \ + _gate, _flags) \ + struct ccu_div _struct = { \ + .enable = _gate, \ + .div = _SUNXI_CCU_DIV_FLAGS(_mshift, _mwidth, CLK_DIVIDER_ROUND_CLOSEST), \ + .mux = _SUNXI_CCU_MUX_TABLE(_muxshift, _muxwidth, _table), \ + .common = { \ + .reg = _reg, \ + .hw.init = CLK_HW_INIT_PARENTS(_name, \ + _parents, \ + &ccu_div_ops, \ + _flags), \ + .features = CCU_FEATURE_CLOSEST_RATE, \ + }, \ + } + #define SUNXI_CCU_M_WITH_MUX_GATE(_struct, _name, _parents, _reg, \ _mshift, _mwidth, _muxshift, _muxwidth, \ _gate, _flags) \ @@ -152,6 +172,16 @@ struct ccu_div { _muxshift, _muxwidth, \ _gate, _flags) +#define SUNXI_CCU_M_WITH_MUX_GATE_CLOSEST(_struct, _name, _parents, \ + _reg, _mshift, _mwidth, \ + _muxshift, _muxwidth, \ + _gate, _flags) \ + SUNXI_CCU_M_WITH_MUX_TABLE_GATE_CLOSEST(_struct, _name, \ + _parents, NULL, \ + _reg, _mshift, _mwidth, \ + _muxshift, _muxwidth, \ + _gate, _flags) + #define SUNXI_CCU_M_WITH_MUX(_struct, _name, _parents, _reg, \ _mshift, _mwidth, _muxshift, _muxwidth, \ _flags) \ -- 2.41.0