From: Andras Szemzo <szemzo.andras@gmail.com>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Linus Walleij <linus.walleij@linaro.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Maxime Ripard <mripard@kernel.org>
Cc: "Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: [PATCH 01/12] clk: sunxi-ng: allow key feature in ccu reset
Date: Fri, 10 Jan 2025 13:39:12 +0100 [thread overview]
Message-ID: <20250110123923.270626-2-szemzo.andras@gmail.com> (raw)
In-Reply-To: <20250110123923.270626-1-szemzo.andras@gmail.com>
Some newer SoCs, like V853 has reset registers, what can be write only
with fixed key value. Move this value from ccu_mux and reuse
in the reset code.
Signed-off-by: Andras Szemzo <szemzo.andras@gmail.com>
---
drivers/clk/sunxi-ng/ccu_common.h | 2 ++
drivers/clk/sunxi-ng/ccu_mux.c | 4 +---
drivers/clk/sunxi-ng/ccu_reset.c | 7 +++++++
drivers/clk/sunxi-ng/ccu_reset.h | 1 +
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h
index dd330426a6e5..36132cb8b920 100644
--- a/drivers/clk/sunxi-ng/ccu_common.h
+++ b/drivers/clk/sunxi-ng/ccu_common.h
@@ -23,6 +23,8 @@
/* MMC timing mode switch bit */
#define CCU_MMC_NEW_TIMING_MODE BIT(30)
+#define CCU_KEY_VALUE 0x16aa0000
+
struct device_node;
struct ccu_common {
diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
index d7ffbdeee9e0..127269ab20ea 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.c
+++ b/drivers/clk/sunxi-ng/ccu_mux.c
@@ -12,8 +12,6 @@
#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)
@@ -196,7 +194,7 @@ int ccu_mux_helper_set_parent(struct ccu_common *common,
/* The key field always reads as zero. */
if (common->features & CCU_FEATURE_KEY_FIELD)
- reg |= CCU_MUX_KEY_VALUE;
+ reg |= CCU_KEY_VALUE;
reg &= ~GENMASK(cm->width + cm->shift - 1, cm->shift);
writel(reg | (index << cm->shift), common->base + common->reg);
diff --git a/drivers/clk/sunxi-ng/ccu_reset.c b/drivers/clk/sunxi-ng/ccu_reset.c
index 55bc7c7cda0f..a9aee35c6617 100644
--- a/drivers/clk/sunxi-ng/ccu_reset.c
+++ b/drivers/clk/sunxi-ng/ccu_reset.c
@@ -9,6 +9,7 @@
#include <linux/reset-controller.h>
#include "ccu_reset.h"
+#include "ccu_common.h"
static int ccu_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
@@ -21,6 +22,9 @@ static int ccu_reset_assert(struct reset_controller_dev *rcdev,
spin_lock_irqsave(ccu->lock, flags);
reg = readl(ccu->base + map->reg);
+ if (map->features & CCU_FEATURE_KEY_FIELD)
+ reg |= CCU_KEY_VALUE;
+
writel(reg & ~map->bit, ccu->base + map->reg);
spin_unlock_irqrestore(ccu->lock, flags);
@@ -39,6 +43,9 @@ static int ccu_reset_deassert(struct reset_controller_dev *rcdev,
spin_lock_irqsave(ccu->lock, flags);
reg = readl(ccu->base + map->reg);
+ if (map->features & CCU_FEATURE_KEY_FIELD)
+ reg |= CCU_KEY_VALUE;
+
writel(reg | map->bit, ccu->base + map->reg);
spin_unlock_irqrestore(ccu->lock, flags);
diff --git a/drivers/clk/sunxi-ng/ccu_reset.h b/drivers/clk/sunxi-ng/ccu_reset.h
index 941276a8ec2e..3fd5d427c26c 100644
--- a/drivers/clk/sunxi-ng/ccu_reset.h
+++ b/drivers/clk/sunxi-ng/ccu_reset.h
@@ -12,6 +12,7 @@
struct ccu_reset_map {
u16 reg;
u32 bit;
+ u32 features;
};
--
2.39.5
next prev parent reply other threads:[~2025-01-10 12:39 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 12:39 [PATCH 00/12] Support for Allwinner V853 SoC Andras Szemzo
2025-01-10 12:39 ` Andras Szemzo [this message]
2025-01-10 12:39 ` [PATCH 02/12] dt-bindings: pinctrl: sunxi: add compatible for V853 Andras Szemzo
2025-01-14 19:52 ` Rob Herring (Arm)
2025-01-16 9:08 ` Linus Walleij
2025-01-10 12:39 ` [PATCH 03/12] pinctrl: sunxi: add driver for Allwinner V853 Andras Szemzo
2025-01-14 14:14 ` Linus Walleij
2025-01-14 14:19 ` Andre Przywara
2025-01-14 14:30 ` Andre Przywara
2025-01-15 10:23 ` Linus Walleij
2025-01-15 15:26 ` Andre Przywara
2025-01-16 9:34 ` Linus Walleij
2025-01-17 7:25 ` András Szemző
2025-01-17 14:52 ` Andre Przywara
2025-01-22 13:30 ` Linus Walleij
2025-01-17 15:43 ` Chen-Yu Tsai
2025-01-10 12:39 ` [PATCH 04/12] dt-bindings: clock: sunxi-ng: add compatibles for V853 Andras Szemzo
2025-01-10 13:55 ` Krzysztof Kozlowski
2025-01-10 12:39 ` [PATCH 05/12] clk: sunxi-ng: add CCU drivers " Andras Szemzo
2025-01-22 23:23 ` Jeff Johnson
2025-01-23 8:58 ` András Szemző
2025-01-28 0:42 ` Andre Przywara
2025-01-28 9:06 ` András Szemző
2025-01-28 11:22 ` Andre Przywara
2025-01-29 7:29 ` András Szemző
2025-01-10 12:39 ` [PATCH 06/12] dt-bindings: clk: sunxi-ng: add V853 CCU clock/reset Andras Szemzo
2025-01-10 13:56 ` Krzysztof Kozlowski
2025-01-13 8:06 ` Chen-Yu Tsai
2025-01-13 8:21 ` Krzysztof Kozlowski
2025-01-13 8:45 ` Chen-Yu Tsai
2025-01-13 10:57 ` Andre Przywara
2025-01-13 11:15 ` Krzysztof Kozlowski
2025-01-11 10:34 ` Krzysztof Kozlowski
2025-01-13 7:02 ` András Szemző
2025-01-10 12:39 ` [PATCH 07/12] devicetree: bindings: power: add v853 ppu Andras Szemzo
2025-01-10 13:54 ` Krzysztof Kozlowski
2025-01-10 12:39 ` [PATCH 08/12] pmdomain: sunxi: add V853 ppu support Andras Szemzo
2025-01-10 12:39 ` [PATCH 09/12] dt-bindings: power: add V853 ppu bindings Andras Szemzo
2025-01-10 13:53 ` Krzysztof Kozlowski
2025-01-10 12:39 ` [PATCH 10/12] dt-bindings: phy: allwinner: add v853 usb phy Andras Szemzo
2025-01-10 13:39 ` Rob Herring (Arm)
2025-01-10 13:53 ` Krzysztof Kozlowski
2025-01-15 7:51 ` Vinod Koul
2025-01-17 7:26 ` András Szemző
2025-01-17 10:39 ` Andre Przywara
2025-01-10 12:39 ` [PATCH 11/12] phy: allwinner: add v853 usb phy compatible Andras Szemzo
2025-01-10 12:39 ` [PATCH 12/12] ARM: dts: sun8i: add DTSI file for V853 Andras Szemzo
2025-01-10 13:58 ` Krzysztof Kozlowski
2025-01-15 9:09 ` Csókás Bence
2025-01-15 9:43 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250110123923.270626-2-szemzo.andras@gmail.com \
--to=szemzo.andras@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=jernej.skrabec@gmail.com \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=ulf.hansson@linaro.org \
--cc=vkoul@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®