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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmgm9QsQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD15dgD/4oYhj8BVQP/cpb912oeBiLF3Gu1bKtv/mi
 rpPPmAirDH+xgwBwPGYH6TitUTv4ah+NKHguLMJCHv3IkYeBBZoT+6RWflDz2lZU
 lK/n1vcj0X5iWomH5d355xyNqR7SLbqWSHRadCavN9oKk9X46IZyuABnHtLwnaeI
 evKf+rIbXgyXd1Sa4eDPpepzrOatcWy9mb++gAjLVaCof1EAUcRmUH52rvIjC7eP
 mv/VKVi4fyEyC3aCss7Lz0P+S9ba1rZ5Sx6iyv/EtT/V7LNpLit1ewDr/uV3LaFi
 vkoPVovRby5Dc/18HUJBDOJppF35iM34Uto0kZvFZKtrHo8srPbczUQVekTgYr5F
 W2H0JFB32K02tgWJBSOg1sPPHqnMaUYu8fbX5jax5Tnz3oqnDqSlSJzHnTq/aDNN
 lhJHxzqb+DTNKZxkXIBhbnQtTBmOI5Mk2L0kt3WwNZuryT5UClSP9jEkvTrqSrym
 uQwpV4LuNQNHQ7ctvbZKY3/nWRXsU/VEH6oNMIouoUt+5Cok4wMZ9Gx95/by4wLL
 51K0773lLrZM3jXP0cHhL+JH0nBS+Bc5w7XViMZSgmXH9W94bi+WzmJYvCBFwqUp
 BT3BLPL7t2D1+Gya/W0ZkMSxcvQaeuCPkrF4AtpDdFrC756eIJLJOCppfcmVyyLp
 fhN2H0tdmA==
 =5fbP
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmguQcQACgkQmmx57+YA
 GNn0LQ/9G0OZmOouvCPTjOmgB3k3ecBKGQUFtoLerLa5caRQstZT7z8xb1CUzh31
 +P1KcRO/2PhkKEhUj7zoIDm2k2kLYq0HeIRKv2mZhcUnQ1Iac11Z++OWcchPUOtV
 WX/bbp9uX9QcuL0DEfsfoBgdPwXwo04Tg5u/uPluDgvlopbtp8Xq5mXP/TZmaiKY
 OC6UVIqZBB2l4um+B85L+FUJUqL7jtOiOwKUJs8RUh6GCdPM4r4f/QAFj8oca7Eg
 pkcjTkIur+dIPFbtuIggy+1pIVE8FIZ0NMr8kJkCfg39ohpdrRZuowu44jBKHP3x
 azyRM/rTpkOajowpZvNW6Kuxfll/amJRDtpX5/nJYPnfvF/f1ildRSfJxS9Ao4MN
 FKI7vtnOvjCZ33Z7PVug4zmY8Bj4y93M5jkPxIdUetj6drBDMgmRVDVusdvmlpLj
 +WcLOkOj+x8rPV/HZ9LVT0I+IhTQqf4KwkorzB6JLb/2i3/F8g2zLCgGPLxIrxPE
 0tHUpJe8B6woneenfMw8dbOI5W5eH9HT3P89bTgdkYLqJUTgpErOTvfCjgAdsRDI
 eigo1X37lCToIYIZ+RJmbS6F5Wvms8SH9n96WaRxMuA4MGx2/o5zjIdvuAgaKa8Y
 ne6n0rJmUste7T6yKD0Vad+f0B0uuSo1g2H59lJQdq6B67p3vtQ=
 =u6x7
 -----END PGP SIGNATURE-----

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/20250516082037.7248-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2025-05-21 23:12:35 +02:00
commit 7148b42e85
6 changed files with 140 additions and 1 deletions

View File

@ -0,0 +1,35 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/soc/google/google,gs101-pmu-intr-gen.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Google Power Management Unit (PMU) Interrupt Generation
description: |
PMU interrupt generator for handshaking between PMU through interrupts.
maintainers:
- Peter Griffin <peter.griffin@linaro.org>
properties:
compatible:
items:
- const: google,gs101-pmu-intr-gen
- const: syscon
reg:
maxItems: 1
required:
- compatible
- reg
additionalProperties: false
examples:
- |
pmu_intr_gen: syscon@17470000 {
compatible = "google,gs101-pmu-intr-gen", "syscon";
reg = <0x17470000 0x10000>;
};

View File

@ -129,6 +129,11 @@ properties:
description:
Node for reboot method
google,pmu-intr-gen-syscon:
$ref: /schemas/types.yaml#/definitions/phandle
description:
Phandle to PMU interrupt generation interface.
required:
- compatible
- reg
@ -189,6 +194,16 @@ allOf:
properties:
dp-phy: false
- if:
properties:
compatible:
contains:
enum:
- google,gs101-pmu
then:
required:
- google,pmu-intr-gen-syscon
examples:
- |
#include <dt-bindings/clock/exynos5250.h>

View File

@ -10085,6 +10085,7 @@ L: linux-samsung-soc@vger.kernel.org
S: Maintained
C: irc://irc.oftc.net/pixel6-kernel-dev
F: Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
F: Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
F: arch/arm64/boot/dts/exynos/google/
F: drivers/clk/samsung/clk-gs101.c
F: drivers/phy/samsung/phy-gs101-ufs.c

View File

@ -7,6 +7,7 @@
#include <linux/array_size.h>
#include <linux/arm-smccc.h>
#include <linux/cpuhotplug.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/mfd/core.h>
@ -33,6 +34,7 @@ struct exynos_pmu_context {
struct device *dev;
const struct exynos_pmu_data *pmu_data;
struct regmap *pmureg;
struct regmap *pmuintrgen;
};
void __iomem *pmu_base_addr;
@ -222,7 +224,8 @@ static const struct regmap_config regmap_smccfg = {
};
static const struct exynos_pmu_data gs101_pmu_data = {
.pmu_secure = true
.pmu_secure = true,
.pmu_cpuhp = true,
};
/*
@ -326,6 +329,59 @@ struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np,
}
EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle);
/*
* CPU_INFORM register hint values which are used by
* EL3 firmware (el3mon).
*/
#define CPU_INFORM_CLEAR 0
#define CPU_INFORM_C2 1
static int gs101_cpuhp_pmu_online(unsigned int cpu)
{
unsigned int cpuhint = smp_processor_id();
u32 reg, mask;
/* clear cpu inform hint */
regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint),
CPU_INFORM_CLEAR);
mask = BIT(cpu);
regmap_update_bits(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_ENABLE,
mask, (0 << cpu));
regmap_read(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_UPEND, &reg);
regmap_write(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_CLEAR,
reg & mask);
return 0;
}
static int gs101_cpuhp_pmu_offline(unsigned int cpu)
{
u32 reg, mask;
unsigned int cpuhint = smp_processor_id();
/* set cpu inform hint */
regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint),
CPU_INFORM_C2);
mask = BIT(cpu);
regmap_update_bits(pmu_context->pmuintrgen, GS101_GRP2_INTR_BID_ENABLE,
mask, BIT(cpu));
regmap_read(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_UPEND, &reg);
regmap_write(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_CLEAR,
reg & mask);
mask = (BIT(cpu + 8));
regmap_read(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_UPEND, &reg);
regmap_write(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_CLEAR,
reg & mask);
return 0;
}
static int exynos_pmu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@ -378,6 +434,26 @@ static int exynos_pmu_probe(struct platform_device *pdev)
pmu_context->pmureg = regmap;
pmu_context->dev = dev;
if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_cpuhp) {
pmu_context->pmuintrgen = syscon_regmap_lookup_by_phandle(dev->of_node,
"google,pmu-intr-gen-syscon");
if (IS_ERR(pmu_context->pmuintrgen)) {
/*
* To maintain support for older DTs that didn't specify syscon phandle
* just issue a warning rather than fail to probe.
*/
dev_warn(&pdev->dev, "pmu-intr-gen syscon unavailable\n");
} else {
cpuhp_setup_state(CPUHP_BP_PREPARE_DYN,
"soc/exynos-pmu:prepare",
gs101_cpuhp_pmu_online, NULL);
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
"soc/exynos-pmu:online",
NULL, gs101_cpuhp_pmu_offline);
}
}
if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_init)
pmu_context->pmu_data->pmu_init();

View File

@ -22,6 +22,7 @@ struct exynos_pmu_data {
const struct exynos_pmu_conf *pmu_config;
const struct exynos_pmu_conf *pmu_config_extra;
bool pmu_secure;
bool pmu_cpuhp;
void (*pmu_init)(void);
void (*powerdown_conf)(enum sys_powerdown);

View File

@ -658,9 +658,20 @@
#define EXYNOS5433_PAD_RETENTION_FSYSGENIO_OPTION (0x32A8)
/* For Tensor GS101 */
/* PMU ALIVE */
#define GS101_SYSIP_DAT0 (0x810)
#define GS101_CPU0_INFORM (0x860)
#define GS101_CPU_INFORM(cpu) \
(GS101_CPU0_INFORM + (cpu*4))
#define GS101_SYSTEM_CONFIGURATION (0x3A00)
#define GS101_PHY_CTRL_USB20 (0x3EB0)
#define GS101_PHY_CTRL_USBDP (0x3EB4)
/* PMU INTR GEN */
#define GS101_GRP1_INTR_BID_UPEND (0x0108)
#define GS101_GRP1_INTR_BID_CLEAR (0x010c)
#define GS101_GRP2_INTR_BID_ENABLE (0x0200)
#define GS101_GRP2_INTR_BID_UPEND (0x0208)
#define GS101_GRP2_INTR_BID_CLEAR (0x020c)
#endif /* __LINUX_SOC_EXYNOS_REGS_PMU_H */