Skip to content

Commit 97c4264

Browse files
petegriffinarndb
authored andcommitted
soc: samsung: exynos-pmu: add support for PMU_ALIVE non atomic registers
Not all registers in PMU_ALIVE block support atomic set/clear operations. GS101_SYSIP_DAT0 and GS101_SYSTEM_CONFIGURATION registers are two regs where attempting atomic access fails. As documentation on exactly which registers support atomic operations is not forthcoming. We default to atomic access, unless the register is explicitly added to the tensor_is_atomic() function. Update the comment to reflect this as well. Reviewed-by: Will McVicker <[email protected]> Tested-by: Will McVicker <[email protected]> Signed-off-by: Peter Griffin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 0b07feb commit 97c4264

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

drivers/soc/samsung/exynos-pmu.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,30 @@ static int tensor_set_bits_atomic(void *ctx, unsigned int offset, u32 val,
129129
return ret;
130130
}
131131

132-
static int tensor_sec_update_bits(void *ctx, unsigned int reg,
133-
unsigned int mask, unsigned int val)
132+
static bool tensor_is_atomic(unsigned int reg)
134133
{
135134
/*
136135
* Use atomic operations for PMU_ALIVE registers (offset 0~0x3FFF)
137-
* as the target registers can be accessed by multiple masters.
136+
* as the target registers can be accessed by multiple masters. SFRs
137+
* that don't support atomic are added to the switch statement below.
138138
*/
139139
if (reg > PMUALIVE_MASK)
140+
return false;
141+
142+
switch (reg) {
143+
case GS101_SYSIP_DAT0:
144+
case GS101_SYSTEM_CONFIGURATION:
145+
return false;
146+
default:
147+
return true;
148+
}
149+
}
150+
151+
static int tensor_sec_update_bits(void *ctx, unsigned int reg,
152+
unsigned int mask, unsigned int val)
153+
{
154+
155+
if (!tensor_is_atomic(reg))
140156
return tensor_sec_reg_rmw(ctx, reg, mask, val);
141157

142158
return tensor_set_bits_atomic(ctx, reg, val, mask);

include/linux/soc/samsung/exynos-regs-pmu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,4 +657,8 @@
657657
#define EXYNOS5433_PAD_RETENTION_UFS_OPTION (0x3268)
658658
#define EXYNOS5433_PAD_RETENTION_FSYSGENIO_OPTION (0x32A8)
659659

660+
/* For Tensor GS101 */
661+
#define GS101_SYSIP_DAT0 (0x810)
662+
#define GS101_SYSTEM_CONFIGURATION (0x3A00)
663+
660664
#endif /* __LINUX_SOC_EXYNOS_REGS_PMU_H */

0 commit comments

Comments
 (0)