Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25155634rwd; Sun, 2 Jul 2023 11:23:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlF3tkX/e7Bv6FKrSFvXavUhWbxvS8hD7RE4TmuwoeQk5XSBEURlUJWbMYLjwF6Fje94lb9H X-Received: by 2002:a17:90b:80b:b0:262:ffc4:be7 with SMTP id bk11-20020a17090b080b00b00262ffc40be7mr9142599pjb.37.1688322205211; Sun, 02 Jul 2023 11:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688322205; cv=none; d=google.com; s=arc-20160816; b=Vgg5Gu0uQnSXhjSU/CI9Nnp1M+qa+3sLNrNOJZszQdjAjOiqQ+ggV6SSMrtFzDe2FX doLYePnxndwtxw0W3z8cHRVZHPtkf4Sb29nHUitBL7Lslvbrf6Gq15SeBQ9eP5ZiVi5a mHU/mFRq3SBkN9oXrPFRNhLHrrk68A1k+gt5S3H+THFH/3lFtKv0B0RxBQ0JF6ilgpCr qOTKNHXnLPWZP419fb6BPtziDmPjMt246i19ewO8Dl+4F+4yh3IvolBVZAsT7uz5ZVLS LDx/8VwxTMglW9Fj/sy4hM48+aOJE54B8VSASfWDamcA1sFx/GlewtnsQio00Pa08etv RePQ== 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=6fwdl+myIVhz4fju8/+Tg66+u2ifTeRnG8yD5hL50NQ=; fh=qochKExQAM0bhcnc+r+ZD43ZS//6TaZetJnkaAgsyOw=; b=BcPgfV5/tUkT+a+geYYfPzWRfszGxn6wtMWVS3JHOslOaZNWX9njnYKSl0+cwm9T6C dkLHjcn5kiuhhpCJ9JgERf4exlWsdbfvsXhEKzaqT5WFd3Mp1xqPzAwewV6GOtqNUsjV K/L1ICm/9PI0fVd1QEajnuPO8tveTiNwHI+JfJGkCyvhGdJcqCkCbTTIpf7FIuOBsPab Ywnkbxa0EFiJc5OzAO91c6ydlp4tNo0TRFbnMe1hPQUxLwnH5TB7TFSsMWeBaqlId9PB t1uMHmHStyFm2/ZrBK8Qz7ii2hLBDOL6mNxzbOOGBoC+iI9Fjt2gJkZZPxziBGxflhof stPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=tYNVri5o; 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 b14-20020a17090a5a0e00b002636ac73ffdsi6352988pjd.63.2023.07.02.11.23.09; Sun, 02 Jul 2023 11:23:25 -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=tYNVri5o; 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 S230039AbjGBR4R (ORCPT + 99 others); Sun, 2 Jul 2023 13:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjGBRz7 (ORCPT ); Sun, 2 Jul 2023 13:55:59 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B43DDE5F; Sun, 2 Jul 2023 10:55:58 -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-201.mailbox.org (Postfix) with ESMTPS id 4QvGv12x10z9skJ; Sun, 2 Jul 2023 19:55:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1688320557; 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=6fwdl+myIVhz4fju8/+Tg66+u2ifTeRnG8yD5hL50NQ=; b=tYNVri5o8GB1Ho/3fLOcVBK6rk4dIp2HluB9fOWZOnXV9Lx7MvaIPJeN73hY8NtpFb9g3F g09cJKXbcfsWLrO3WpqtTK883foyW9M9okqITkVus+8USg640nldFx5wZf00AaAHS2jhjb kSq2eH0p/GXwVlTNnsWdLdodW/1EY1YPptV9ESaXeoN7+N7+va5DQ/Kou3SuGYe/LUAGVr Y/cvJ2uvC1mxEVy/41xaICrmfz1Vj7vUPLMD5FSkPhIeFevRt9yfpLR2IqJ8gLho3i94sx XjWct/gbPhrTRs/L1ttV2cQ0TunG39RUXyrLldHXz4p8UozxrrGXd1d+s8Husg== From: Frank Oltmanns Date: Sun, 02 Jul 2023 19:55:26 +0200 Subject: [PATCH v3 7/8] 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: <20230702-pll-mipi_set_rate_parent-v3-7-46dcb8aa9cbc@oltmanns.dev> References: <20230702-pll-mipi_set_rate_parent-v3-0-46dcb8aa9cbc@oltmanns.dev> In-Reply-To: <20230702-pll-mipi_set_rate_parent-v3-0-46dcb8aa9cbc@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=2074; i=frank@oltmanns.dev; h=from:subject:message-id; bh=QteUt2cYVvavIEwNN/k9PvZ0L1ThFgIn+WnM3eoykB0=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBkobocOMfDMsDUymIH/PyoN0nvjIa6tG2TyObYR gaiaSGEjFuJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZKG6HAAKCRCaaaIIlErT x96rC/9HxzJ9h5ODsSFizRvb4fETeTYNyXNwWX3Y6PuMx4fsp9pFEzSLDwTRnRr6mKeVfBvIr1j vTK+FkuVNn5x9Sy9WiUY92932dcAiDbli0+tXeP7fvd6zQSVDcVVoAbsC4F5dJAoAks85zT3i5M 5abscfvPwDHgNAa1Q8GsgX6YupX145We9rnj0guyw572xf88z5tIVZJ5qYMOcjArB8hKNRKCtm8 9jJv0Y+GvcC6WJdKwX3oLIILPdAfthP/Hj0z07kcTuLdzuh7cGN+Z61VnDlwIC5myXfcKQduOTI 0FX3PxlP42tOc/J8GfWjHGjImK27iObWLvRCiv06d+a61mq4ZnBuP5Alxzzt3svRdDuP91YxEkn vh2Yo7uRPVn3Wc+kXrXHSke6oOWjvpmX92g44Ov7OYOYNT7srg2QXVoFc90GncYAwzyytLlUOiN 6Q4BoFUApwyi5WcYJ3Z17TjG4rdD6OXTFuD4aXZC4F51mnmIJpQzwEkAlFsp+HPNH5qt0= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4QvGv12x10z9skJ X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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. 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