Skip to content

Commit 7148b42

Browse files
committed
Merge tag 'samsung-drivers-6.16-2' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into soc/drivers
Samsung SoC drivers for v6.16, part two Add CPU hotplug support on Google GS101 by toggling respective bits in secondary PMU intr block (Power Management Unit (PMU) Interrupt Generation) from the main PMU driver. * tag 'samsung-drivers-6.16-2' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: soc: samsung: exynos-pmu: enable CPU hotplug support for gs101 MAINTAINERS: Add google,gs101-pmu-intr-gen.yaml binding file dt-bindings: soc: samsung: exynos-pmu: gs101: add google,pmu-intr-gen phandle dt-bindings: soc: google: Add gs101-pmu-intr-gen binding documentation Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents f1706e0 + 5989950 commit 7148b42

File tree

6 files changed

+140
-1
lines changed

6 files changed

+140
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/soc/google/google,gs101-pmu-intr-gen.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Google Power Management Unit (PMU) Interrupt Generation
8+
9+
description: |
10+
PMU interrupt generator for handshaking between PMU through interrupts.
11+
12+
maintainers:
13+
- Peter Griffin <[email protected]>
14+
15+
properties:
16+
compatible:
17+
items:
18+
- const: google,gs101-pmu-intr-gen
19+
- const: syscon
20+
21+
reg:
22+
maxItems: 1
23+
24+
required:
25+
- compatible
26+
- reg
27+
28+
additionalProperties: false
29+
30+
examples:
31+
- |
32+
pmu_intr_gen: syscon@17470000 {
33+
compatible = "google,gs101-pmu-intr-gen", "syscon";
34+
reg = <0x17470000 0x10000>;
35+
};

Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ properties:
129129
description:
130130
Node for reboot method
131131

132+
google,pmu-intr-gen-syscon:
133+
$ref: /schemas/types.yaml#/definitions/phandle
134+
description:
135+
Phandle to PMU interrupt generation interface.
136+
132137
required:
133138
- compatible
134139
- reg
@@ -189,6 +194,16 @@ allOf:
189194
properties:
190195
dp-phy: false
191196

197+
- if:
198+
properties:
199+
compatible:
200+
contains:
201+
enum:
202+
- google,gs101-pmu
203+
then:
204+
required:
205+
- google,pmu-intr-gen-syscon
206+
192207
examples:
193208
- |
194209
#include <dt-bindings/clock/exynos5250.h>

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10085,6 +10085,7 @@ L: [email protected]
1008510085
S: Maintained
1008610086
C: irc://irc.oftc.net/pixel6-kernel-dev
1008710087
F: Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
10088+
F: Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
1008810089
F: arch/arm64/boot/dts/exynos/google/
1008910090
F: drivers/clk/samsung/clk-gs101.c
1009010091
F: drivers/phy/samsung/phy-gs101-ufs.c

drivers/soc/samsung/exynos-pmu.c

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/array_size.h>
99
#include <linux/arm-smccc.h>
10+
#include <linux/cpuhotplug.h>
1011
#include <linux/of.h>
1112
#include <linux/of_address.h>
1213
#include <linux/mfd/core.h>
@@ -33,6 +34,7 @@ struct exynos_pmu_context {
3334
struct device *dev;
3435
const struct exynos_pmu_data *pmu_data;
3536
struct regmap *pmureg;
37+
struct regmap *pmuintrgen;
3638
};
3739

3840
void __iomem *pmu_base_addr;
@@ -222,7 +224,8 @@ static const struct regmap_config regmap_smccfg = {
222224
};
223225

224226
static const struct exynos_pmu_data gs101_pmu_data = {
225-
.pmu_secure = true
227+
.pmu_secure = true,
228+
.pmu_cpuhp = true,
226229
};
227230

228231
/*
@@ -326,6 +329,59 @@ struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np,
326329
}
327330
EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle);
328331

332+
/*
333+
* CPU_INFORM register hint values which are used by
334+
* EL3 firmware (el3mon).
335+
*/
336+
#define CPU_INFORM_CLEAR 0
337+
#define CPU_INFORM_C2 1
338+
339+
static int gs101_cpuhp_pmu_online(unsigned int cpu)
340+
{
341+
unsigned int cpuhint = smp_processor_id();
342+
u32 reg, mask;
343+
344+
/* clear cpu inform hint */
345+
regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint),
346+
CPU_INFORM_CLEAR);
347+
348+
mask = BIT(cpu);
349+
350+
regmap_update_bits(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_ENABLE,
351+
mask, (0 << cpu));
352+
353+
regmap_read(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_UPEND, &reg);
354+
355+
regmap_write(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_CLEAR,
356+
reg & mask);
357+
358+
return 0;
359+
}
360+
361+
static int gs101_cpuhp_pmu_offline(unsigned int cpu)
362+
{
363+
u32 reg, mask;
364+
unsigned int cpuhint = smp_processor_id();
365+
366+
/* set cpu inform hint */
367+
regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint),
368+
CPU_INFORM_C2);
369+
370+
mask = BIT(cpu);
371+
regmap_update_bits(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_ENABLE,
372+
mask, BIT(cpu));
373+
374+
regmap_read(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_UPEND, &reg);
375+
regmap_write(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_CLEAR,
376+
reg & mask);
377+
378+
mask = (BIT(cpu + 8));
379+
regmap_read(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_UPEND, &reg);
380+
regmap_write(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_CLEAR,
381+
reg & mask);
382+
return 0;
383+
}
384+
329385
static int exynos_pmu_probe(struct platform_device *pdev)
330386
{
331387
struct device *dev = &pdev->dev;
@@ -378,6 +434,26 @@ static int exynos_pmu_probe(struct platform_device *pdev)
378434
pmu_context->pmureg = regmap;
379435
pmu_context->dev = dev;
380436

437+
if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_cpuhp) {
438+
pmu_context->pmuintrgen = syscon_regmap_lookup_by_phandle(dev->of_node,
439+
"google,pmu-intr-gen-syscon");
440+
if (IS_ERR(pmu_context->pmuintrgen)) {
441+
/*
442+
* To maintain support for older DTs that didn't specify syscon phandle
443+
* just issue a warning rather than fail to probe.
444+
*/
445+
dev_warn(&pdev->dev, "pmu-intr-gen syscon unavailable\n");
446+
} else {
447+
cpuhp_setup_state(CPUHP_BP_PREPARE_DYN,
448+
"soc/exynos-pmu:prepare",
449+
gs101_cpuhp_pmu_online, NULL);
450+
451+
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
452+
"soc/exynos-pmu:online",
453+
NULL, gs101_cpuhp_pmu_offline);
454+
}
455+
}
456+
381457
if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_init)
382458
pmu_context->pmu_data->pmu_init();
383459

drivers/soc/samsung/exynos-pmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct exynos_pmu_data {
2222
const struct exynos_pmu_conf *pmu_config;
2323
const struct exynos_pmu_conf *pmu_config_extra;
2424
bool pmu_secure;
25+
bool pmu_cpuhp;
2526

2627
void (*pmu_init)(void);
2728
void (*powerdown_conf)(enum sys_powerdown);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,20 @@
658658
#define EXYNOS5433_PAD_RETENTION_FSYSGENIO_OPTION (0x32A8)
659659

660660
/* For Tensor GS101 */
661+
/* PMU ALIVE */
661662
#define GS101_SYSIP_DAT0 (0x810)
663+
#define GS101_CPU0_INFORM (0x860)
664+
#define GS101_CPU_INFORM(cpu) \
665+
(GS101_CPU0_INFORM + (cpu*4))
662666
#define GS101_SYSTEM_CONFIGURATION (0x3A00)
663667
#define GS101_PHY_CTRL_USB20 (0x3EB0)
664668
#define GS101_PHY_CTRL_USBDP (0x3EB4)
665669

670+
/* PMU INTR GEN */
671+
#define GS101_GRP1_INTR_BID_UPEND (0x0108)
672+
#define GS101_GRP1_INTR_BID_CLEAR (0x010c)
673+
#define GS101_GRP2_INTR_BID_ENABLE (0x0200)
674+
#define GS101_GRP2_INTR_BID_UPEND (0x0208)
675+
#define GS101_GRP2_INTR_BID_CLEAR (0x020c)
676+
666677
#endif /* __LINUX_SOC_EXYNOS_REGS_PMU_H */

0 commit comments

Comments
 (0)