From patchwork Thu Feb 3 02:17:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12733779 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A28B9C433EF for ; Thu, 3 Feb 2022 02:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rpv2KKOoZ1FYzWj2vUZWY64TZw2G9rNfHe/6uS9n6ZM=; b=DV9/x29bgNU0Pc jhJl9TaWlVhp/ktHNw4Z3OwJY9HFmGtoz6vvRbY4O4zSiGWIISgSF4y4wTsRluTW2a6QoOTzLtSDf sbKJyzsOdNG6JpLrOArCib/vdlmUN8qhqpDuZONCnmRk6SKeUOmxTlLbtGRATgG/8gZRQPN0yxJ/0 uKJdrNblaF6qLPPkClmRNhOfTqYmskHMLkFsUkyX/BDW3gHFBVb27+W2orjPKgmT9msxmllfP8bEM UXxAP4ODNZNNyrtTaCjyIaVnMXhgU5n6WLS/N5BZekTn3GHV+t4ST+wRBiNgO8k7qeip/6cIA2lfT ToX3LXsxQH7ueKl3Zi3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFRhb-00HOvA-1i; Thu, 03 Feb 2022 02:18:27 +0000 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFRh5-00HOjl-9Q for linux-arm-kernel@lists.infradead.org; Thu, 03 Feb 2022 02:17:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id AAF1F2B001B1; Wed, 2 Feb 2022 21:17:53 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 02 Feb 2022 21:17:54 -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=fm1; bh=bQzz0YJg4cl1SXyRkVE6RCatDPM1bV hWbX8cgs4xCtk=; b=gHew6L0ZosFtcXtsY0jYitfuVA2WaRrSDcR5yuix5avHbE /scXuMRoMVgcUmI2xl+ivS3OWZOh2qjGYwuc7gV1DBxNItm6olTdAHfwW4Q8Yobm 62N+otLbmilTgvSzGxr7BcKId471q0l/9zrsVQ9GX9X1g3iqzzyq8QPWOZYOSbz2 cainy6yV72W3hpbPiGhh6Sx/b30Cx8hngYYFyngcPmNDfle4qZzW9M6q2BwddcF7 qMwmo7K2jTnAoKVK6QM99MAt16J8SJywdG1wNC3ajXoEJW2EW3P1mXNEBanjbwpx K6tVJ8V4ox+wewk3cKUXVrDSir+OaJMs/1DNP2jA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; 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:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=bQzz0Y Jg4cl1SXyRkVE6RCatDPM1bVhWbX8cgs4xCtk=; b=TXWm+UCasrUBwjxoT4RkwB XuckYJSMt/jl7HbhMMUVkltejxCqrcTFBTh591zDKtRzzlyAEvhcdzGhmZwVnkt4 LHbgoUss0o0XBP4VCv+30J6i9zQPwqJO5aIHzA5IBI+PoRZHsCMmNX3xVO2kF2c/ TfQHdCyEw23Fhb8Gvqkzs398QfbpXoutu0zFsV83J7kHAocXs4Tp0gf1nrSs1jI6 ZSTyyGvV2LL5lgC2OW8rQnm0XcGg+IfmzyUq0Kh4dNx1b1DFUIXd6T5MBPz1NMGH cV/vectphS7nSWgESO43kKe2X4kc59cxssnhPNwTGshP6cKOIaC68D44UhuVay8Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrgeeigdeggecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheejvdfg jeehueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Feb 2022 21:17:52 -0500 (EST) From: Samuel Holland To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , linux-sunxi@lists.linux.dev Cc: Alessandro Zummo , Michael Turquette , Alexandre Belloni , linux-arm-kernel@lists.infradead.org, Rob Herring , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Samuel Holland Subject: [PATCH v3 4/6] clk: sunxi-ng: mux: Allow muxes to have keys Date: Wed, 2 Feb 2022 20:17:34 -0600 Message-Id: <20220203021736.13434-5-samuel@sholland.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220203021736.13434-1-samuel@sholland.org> References: <20220203021736.13434-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220202_181755_372247_E4835B34 X-CRM114-Status: GOOD ( 15.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The muxes in the RTC can only be updated when setting a key field to a specific value. Add a feature flag to denote muxes with this property. Since so far the key value is always the same, it does not need to be provided separately for each mux. Signed-off-by: Samuel Holland --- Changes in v3: - Drop the SUNXI_CCU_MUX_HW_WITH_KEY macro, since it is no longer used. drivers/clk/sunxi-ng/ccu_common.h | 1 + drivers/clk/sunxi-ng/ccu_mux.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h index 98a1834b58bb..fbf16c6b896d 100644 --- a/drivers/clk/sunxi-ng/ccu_common.h +++ b/drivers/clk/sunxi-ng/ccu_common.h @@ -17,6 +17,7 @@ #define CCU_FEATURE_LOCK_REG BIT(5) #define CCU_FEATURE_MMC_TIMING_SWITCH BIT(6) #define CCU_FEATURE_SIGMA_DELTA_MOD BIT(7) +#define CCU_FEATURE_KEY_FIELD BIT(8) /* MMC timing mode switch bit */ #define CCU_MMC_NEW_TIMING_MODE BIT(30) diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c index 2306a1cd83e4..1d557e323169 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.c +++ b/drivers/clk/sunxi-ng/ccu_mux.c @@ -12,6 +12,8 @@ #include "ccu_gate.h" #include "ccu_mux.h" +#define CCU_MUX_KEY_VALUE 0x16aa0000 + static u16 ccu_mux_get_prediv(struct ccu_common *common, struct ccu_mux_internal *cm, int parent_index) @@ -191,6 +193,11 @@ int ccu_mux_helper_set_parent(struct ccu_common *common, spin_lock_irqsave(common->lock, flags); reg = readl(common->base + common->reg); + + /* The key field always reads as zero. */ + if (common->features & CCU_FEATURE_KEY_FIELD) + reg |= CCU_MUX_KEY_VALUE; + reg &= ~GENMASK(cm->width + cm->shift - 1, cm->shift); writel(reg | (index << cm->shift), common->base + common->reg);