@@ -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 {
@@ -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);
@@ -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);
@@ -12,6 +12,7 @@
struct ccu_reset_map {
u16 reg;
u32 bit;
+ u32 features;
};
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(-)