From patchwork Fri Nov 19 04:35:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12628165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11651C433EF for ; Fri, 19 Nov 2021 04:36:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDD8E6139F for ; Fri, 19 Nov 2021 04:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234073AbhKSEjD (ORCPT ); Thu, 18 Nov 2021 23:39:03 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:48587 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233731AbhKSEjA (ORCPT ); Thu, 18 Nov 2021 23:39:00 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id AD4702B0116A; Thu, 18 Nov 2021 23:35:58 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 18 Nov 2021 23:35:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=BMpnUeRyh0/dK tU3aOduYGSgk1k3D8qrcKn/13C1j/4=; b=lA9Ytq+iQKfAdpvjOX5m4oA4aZEVE QZxV27szXbgssG8GloFsCF754bGGsuR3LupVbjkyHfJ71xJ+52omcFg0mmd+AueV fuBF+cc7S1/d880jrFc9/7SSafBu1rkVM5TiQqzRjjdX2b/y4OCgY0kuv/GX+HCs SRywiSzaGwJYS4eSKdq+H+Tb+R56H/2hD4tPPZ5Px7Xxsl4rn/ZZIZTvZBi9dsbg t7IV0RsBDuiRo+OkRJtG3jTwhBYjsF7JFYGkVyhuuAey6oG2nVkEX2u6cndFEvU2 8Afn3JmIk9w87rKdJMy/36im5z2Dws8TF21TspvoYMEvvLfa5trM0ZB/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=BMpnUeRyh0/dKtU3aOduYGSgk1k3D8qrcKn/13C1j/4=; b=KKiHSMNh 6UT/cleWbA05MZPLgkGnyMn6S0wzRLBfDX1NLyD8E0dK8Kw+UdEqvFcwKDyTd7GA aBWPgxjR4NFlEQdFxM82PNdFmc1AwvddlEq/+TYgZk5dOZCWUh40vLY2EBrTdkTL QimJlxOl8FXB6O3aPTvkQEFH8lrmOomPpzYwAdt75zLzFMS7WWfNvhDQcjsVFQn6 5ZZvhA3fdNEJ+2Hmd1160HLmcX4OERY0XSmL5qgBTfRnmxoiyQWZntz1cUbPdAZU ocP3LThNq3jps8H95mxaYK8zsOatfQWUCrfan4D93nB4f0dMqvdPCfs4owbZF12X 9AmSPWfJ0D/SKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfeejgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Nov 2021 23:35:57 -0500 (EST) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , linux-sunxi@lists.linux.dev Cc: Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stephen Boyd , Samuel Holland , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v1 4/6] clk: sunxi-ng: mux: Add macros using clk_parent_data and clk_hw Date: Thu, 18 Nov 2021 22:35:42 -0600 Message-Id: <20211119043545.4010-5-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211119043545.4010-1-samuel@sholland.org> References: <20211119043545.4010-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Referencing parents with clk_hw pointers is more efficient and removes the dependency on global clock names. clk_parent_data is needed when some parent clocks are provided from another driver. Add macros for declaring muxes that take advantage of these. Signed-off-by: Samuel Holland --- drivers/clk/sunxi-ng/ccu_mux.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h index e31efc509b3d..2c1811a445b0 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.h +++ b/drivers/clk/sunxi-ng/ccu_mux.h @@ -72,6 +72,39 @@ struct ccu_mux { SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, NULL, \ _reg, _shift, _width, 0, _flags) +#define SUNXI_CCU_MUX_DATA_WITH_GATE(_struct, _name, _parents, _reg, \ + _shift, _width, _gate, _flags) \ + struct ccu_mux _struct = { \ + .enable = _gate, \ + .mux = _SUNXI_CCU_MUX(_shift, _width), \ + .common = { \ + .reg = _reg, \ + .hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \ + _parents, \ + &ccu_mux_ops, \ + _flags), \ + } \ + } + +#define SUNXI_CCU_MUX_DATA(_struct, _name, _parents, _reg, \ + _shift, _width, _flags) \ + SUNXI_CCU_MUX_DATA_WITH_GATE(_struct, _name, _parents, _reg, \ + _shift, _width, 0, _flags) + +#define SUNXI_CCU_MUX_HW_WITH_GATE(_struct, _name, _parents, _reg, \ + _shift, _width, _gate, _flags) \ + struct ccu_mux _struct = { \ + .enable = _gate, \ + .mux = _SUNXI_CCU_MUX(_shift, _width), \ + .common = { \ + .reg = _reg, \ + .hw.init = CLK_HW_INIT_PARENTS_HW(_name, \ + _parents, \ + &ccu_mux_ops, \ + _flags), \ + } \ + } + static inline struct ccu_mux *hw_to_ccu_mux(struct clk_hw *hw) { struct ccu_common *common = hw_to_ccu_common(hw);