From patchwork Fri Feb 2 14:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13542973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8AD3C4828F for ; Fri, 2 Feb 2024 14:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aJ3dzHL1vsARa3W9YnpSH5ylc5hM03xbjvjVSlY2CIg=; b=d5LKiVD9rrSxLn Rk2SVXujuNmIYDNb0L6rTnQwI7gwu5zIPBDug9PzxhxvJ0CiZ+N4vXD9LXpCSAtMZNgjJf+uHQ2xq 3r8zVtaVtPGWFXwcEMZJEpv1l2dGOG4SQIjlGDMlba0RGTb1X0+q93n34Dqdv6reqelcDj2oUuu0k bWFV2c6idfxj9DGwj7hXwWoxaHn/MmWsZfiYOjfBUxbFn9TqKMSoJoV2/LQo4c8VhWHE7hjkKcjx/ tFxu37tX2I4gjyFpaiKO2oaEOrTCSQ5JZvHRNWaHOOrvzKrWaKJDb4rLvY8XcDYCHfMy3lHBap+NJ ZuSxuBpw3jSZH7OW8Yww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuzG-0000000Bs4V-2R4o; Fri, 02 Feb 2024 14:57:50 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuzC-0000000Bs1n-3DJD for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 14:57:48 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a358ec50b7cso157776666b.0 for ; Fri, 02 Feb 2024 06:57:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706885864; x=1707490664; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4vOtWE9SIu2K2cSgBm4FTdm6Wcl9JpeipP+IOKAGQ9o=; b=AGJqbpY9DYLjxCLt7Ytdx8RXy9MHsllA8DS1MHDyyqSAal1oJOUmOMx6hQ9d0Ye93n 2uDhyB3zSf+29h+3QGV/T4BBDcXkhWiVuQmwAbgC+qJa/UNcj1aF5X6HtmpLriDu7rsF 5OPUGhH+A3uV/j2uEZsBocZOfNg69vU7Vb/0cD0ueEKCIPlUXQuoWZCkKia8UY4UjGRu GI6MICaSY7NelIBYWk5oy54W/3rxp24815FHLruufGoIJFZfO8kGVptwh/AGkuaRogW+ PX1GDHbtLlCkvQgy6twhOaOskedZGT6/eovn/o9TIP/pQCkAUCVJb9TsYPXwqmxLCGua c44g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706885864; x=1707490664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4vOtWE9SIu2K2cSgBm4FTdm6Wcl9JpeipP+IOKAGQ9o=; b=nBmjXWcxmVjKsAsFQlnRSY5Hbrq/TXD9J8i806tC5LE+rR8KeArJjYtEn3gHFin7zq t5KfgotpL7zF56uj8SZqXw8Tz1XHfO7W+lZV954G4ZlraMQ7+Hf/KODax/3BPEFiDSZV 9yJPwiORq1S4xu5k3aeSyjzUKP7pkqasqhSgWTMJhR7LImwe+obUtphSEo5i8+QbwDiW xlsObG37oUfJWUwEvEOTKliq1UfZsB15HuOF0l9NFHN7+xu75t850tIF2AxVcTqRVPNv MBtPpoqy2NmtBX1byO2dxLVmz2wbhcl7qvNbxh2v0z3INGWcCf9ULusBJET6G7TFwkZH h4cg== X-Gm-Message-State: AOJu0YwV4JD0WJ5KOqX8znzeec0fCNwF4/gkwzbFOuE+7vVBzHYewVt2 hrBhStxpW9pR30wuJQto0f21wZMNCyI/tccWslDjI9hIlTzOcxmLiGbRA10R3dU= X-Google-Smtp-Source: AGHT+IGuwVUZNxdS2rdDNCTTA9Tcg7aHROJv7MsznuFHClHm6dZeXS3joEl1hI1O20hqiF1WiiGOMg== X-Received: by 2002:a17:907:971a:b0:a37:1778:7d7f with SMTP id jg26-20020a170907971a00b00a3717787d7fmr1431931ejc.29.1706885864097; Fri, 02 Feb 2024 06:57:44 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCX9w+8lHq+Qp/NpEL5X8D4MnB2NetbNCo/2dNc8RwR8ncurIxGR7HMvuEDyaDygDhZSBBDjs//3/1tJiDL+IY4a2Rv1X09aoY6xaAwXw0lAb0BdWz0ePSbsfIVQSf8VcyBFaakm8vxcogv74pOxpdL32kgp+ujsJun3jQv0b3/x6+9cO2FwdDjQ7aNzUHqRBevUeBL5fSTAy4eAzbVv3BVtYN96W8z5q5t74KmmHF+Ngs67T9F0T+It4W4mOBGS4YtYpuSfV2wP91nHp8NZdsVZfmlUjgyi66B26rl/3DKYV938tBzNqIHr7BKaXJ0l1A1JuNeGDbnO8FCrYFGC1Hc8ly/Xm5Zuupe4ab5P8qz2lFoJB5271PuZhRqFy1+ip4OZNn2ZUwKjxaKuFi9S+vOuleU0U2OZy1o0iPP+4B/t8od0uk7YsjQB7nOnlUs6psKZuXbrJmJibpybpDbN62ZtO2Yf5vQbjMR2D5GWMnKtqArnJzRgzpigJX1Dty16mKLFf27i54cspR+VnJ3Kg4HLwwjuusIRV8WjfcCcTrF2Hdhu7pmv3VCEOQtQ8TugXQaHt8YisccLiU0R3SKqGpNnOMhlSMBLvmg0SYg2b+8mSiGIYFOUb0y3DJ5VEP/tj8ON8NSZ6o4PwgSi4cGWHCHWXGjbORQ25zL3szIK/htETV5oiazZ0vOuEzaMl/v96t6GmPkfUhPr0A== Received: from gpeter-l.lan (host-92-21-139-67.as13285.net. [92.21.139.67]) by smtp.gmail.com with ESMTPSA id t8-20020a17090616c800b00a36c60180aesm957200ejd.60.2024.02.02.06.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 06:57:43 -0800 (PST) From: Peter Griffin To: arnd@arndb.de, krzysztof.kozlowski@linaro.org, linux@roeck-us.net, wim@linux-watchdog.org, alim.akhtar@samsung.com, jaewon02.kim@samsung.com, semen.protsenko@linaro.org Cc: kernel-team@android.com, peter.griffin@linaro.org, alexey.klimov@linaro.org, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, linux-fsd@tesla.com, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 1/2] soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs Date: Fri, 2 Feb 2024 14:57:30 +0000 Message-ID: <20240202145731.4082033-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog In-Reply-To: <20240202145731.4082033-1-peter.griffin@linaro.org> References: <20240202145731.4082033-1-peter.griffin@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_065746_854911_4422555B X-CRM114-Status: GOOD ( 37.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some Exynos based SoCs like Tensor gs101 protect the PMU registers for security hardening reasons so that they are only write accessible in el3 via an SMC call. As most Exynos drivers that need to write PMU registers currently obtain a regmap via syscon (phys, pinctrl, watchdog). Support for the above usecase is implemented in this driver using a custom regmap similar to syscon to handle the SMC call. Platforms that don't secure PMU registers, get a mmio regmap like before. As regmaps abstract out the underlying register access changes to the leaf drivers are minimal. A new API exynos_get_pmu_regmap_by_phandle() is provided for leaf drivers that currently use syscon_regmap_lookup_by_phandle(). This also handles deferred probing. Signed-off-by: Peter Griffin --- Changes since v2 - Add select REGMAP to Kconfig - Add constant for SET/CLEAR bits - Replace kerneldoc with one line comment - Fix kerneldoc for EXPORT_SYMBOL_GPL funcs - remove superflous extern keyword - dev_err_probe() on probe error - shorten regmcfg name - no compatibles inside probe, use match data - don't mix declarations with/without initializations - tensor_sec_reg_read() use mmio to avoid access restrictions - Collect up Reviewed-by - const for regmap_config structs --- drivers/soc/samsung/Kconfig | 1 + drivers/soc/samsung/exynos-pmu.c | 233 ++++++++++++++++++++++++- drivers/soc/samsung/exynos-pmu.h | 1 + include/linux/soc/samsung/exynos-pmu.h | 11 +- 4 files changed, 241 insertions(+), 5 deletions(-) diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index 27ec99af77e3..1a5dfdc978dc 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -42,6 +42,7 @@ config EXYNOS_PMU depends on ARCH_EXYNOS || ((ARM || ARM64) && COMPILE_TEST) select EXYNOS_PMU_ARM_DRIVERS if ARM && ARCH_EXYNOS select MFD_CORE + select REGMAP_MMIO # There is no need to enable these drivers for ARMv8 config EXYNOS_PMU_ARM_DRIVERS diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index 250537d7cfd6..adf3549370d6 100644 --- a/drivers/soc/samsung/exynos-pmu.c +++ b/drivers/soc/samsung/exynos-pmu.c @@ -5,6 +5,7 @@ // // Exynos - CPU PMU(Power Management Unit) support +#include #include #include #include @@ -12,19 +13,130 @@ #include #include #include +#include #include #include #include "exynos-pmu.h" +#define PMUALIVE_MASK GENMASK(14, 0) +#define SET_BITS 0xc000 +#define CLEAR_BITS 0x8000 + +#define TENSOR_SMC_PMU_SEC_REG 0x82000504 +#define TENSOR_PMUREG_READ 0 +#define TENSOR_PMUREG_WRITE 1 +#define TENSOR_PMUREG_RMW 2 + struct exynos_pmu_context { struct device *dev; const struct exynos_pmu_data *pmu_data; + struct regmap *pmureg; }; void __iomem *pmu_base_addr; static struct exynos_pmu_context *pmu_context; +static struct platform_driver exynos_pmu_driver; + +/* + * Tensor SoCs are configured so that PMU_ALIVE registers can only be written + * from EL3, but are still read accessible. As Linux needs to write some of + * these registers, the following functions are provided and exposed via + * regmap. + * + * Note: This SMC interface is known to be implemented on gs101 and derivative + * SoCs. + */ + +/* Write to a protected PMU register. */ +static int tensor_sec_reg_write(void *base, unsigned int reg, unsigned int val) +{ + struct arm_smccc_res res; + unsigned long pmu_base = (unsigned long)base; + + arm_smccc_smc(TENSOR_SMC_PMU_SEC_REG, pmu_base + reg, + TENSOR_PMUREG_WRITE, val, 0, 0, 0, 0, &res); + + /* returns -EINVAL if access isn't allowed or 0 */ + if (res.a0) + pr_warn("%s(): SMC failed: %d\n", __func__, (int)res.a0); + + return (int)res.a0; +} + +/* Read/Modify/Write a protected PMU register. */ +static int tensor_sec_reg_rmw(void *base, unsigned int reg, + unsigned int mask, unsigned int val) +{ + struct arm_smccc_res res; + unsigned long pmu_base = (unsigned long)base; + + arm_smccc_smc(TENSOR_SMC_PMU_SEC_REG, pmu_base + reg, + TENSOR_PMUREG_RMW, mask, val, 0, 0, 0, &res); + + /* returns -EINVAL if access isn't allowed or 0*/ + if (res.a0) + pr_warn("%s(): SMC failed: %d\n", __func__, (int)res.a0); + + return (int)res.a0; +} + +/* + * Read a protected PMU register. All PMU registers can be read by Linux. + * Note: The SMC read register is not used, as only registers that can be + * written are readable via SMC. + */ +static int tensor_sec_reg_read(void *base, unsigned int reg, unsigned int *val) +{ + *val = pmu_raw_readl(reg); + return 0; +} + +/* + * For SoCs that have set/clear bit hardware this function can be used when + * the PMU register will be accessed by multiple masters. + * + * For example, to set bits 13:8 in PMU reg offset 0x3e80 + * tensor_set_bit_atomic(0x3e80, 0x3f00, 0x3f00); + * + * To clear bits 13:8 in PMU offset 0x3e80 + * tensor_set_bit_atomic(0x3e80, 0x0, 0x3f00); + */ +static inline int tensor_set_bit_atomic(void *ctx, unsigned int offset, + u32 val, u32 mask) +{ + int ret; + unsigned int i; + + for (i = 0; i < 32; i++) { + if (mask & BIT(i)) { + if (val & BIT(i)) + offset |= SET_BITS; + else + offset |= CLEAR_BITS; + + ret = tensor_sec_reg_write(ctx, offset, i); + if (ret) + goto out; + } + } +out: + return ret; +} + +static int tensor_sec_update_bits(void *ctx, unsigned int reg, + unsigned int mask, unsigned int val) +{ + /* + * Use atomic operations for PMU_ALIVE registers (offset 0~0x3FFF) + * as the target registers can be accessed by multiple masters. + */ + if (reg > PMUALIVE_MASK) + return tensor_sec_reg_rmw(ctx, reg, mask, val); + + return tensor_set_bit_atomic(ctx, reg, val, mask); +} void pmu_raw_writel(u32 val, u32 offset) { @@ -75,11 +187,41 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode) #define exynos_pmu_data_arm_ptr(data) NULL #endif +static const struct regmap_config regmap_smccfg = { + .name = "pmu_regs", + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .fast_io = true, + .use_single_read = true, + .use_single_write = true, + .reg_read = tensor_sec_reg_read, + .reg_write = tensor_sec_reg_write, + .reg_update_bits = tensor_sec_update_bits, +}; + +static const struct regmap_config regmap_mmiocfg = { + .name = "pmu_regs", + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .fast_io = true, + .use_single_read = true, + .use_single_write = true, +}; + +static const struct exynos_pmu_data gs101_pmu_data = { + .pmu_secure = true +}; + /* * PMU platform driver and devicetree bindings. */ static const struct of_device_id exynos_pmu_of_device_ids[] = { { + .compatible = "google,gs101-pmu", + .data = &gs101_pmu_data, + }, { .compatible = "samsung,exynos3250-pmu", .data = exynos_pmu_data_arm_ptr(exynos3250_pmu_data), }, { @@ -113,19 +255,73 @@ static const struct mfd_cell exynos_pmu_devs[] = { { .name = "exynos-clkout", }, }; +/** + * exynos_get_pmu_regmap() - Obtain pmureg regmap + * + * Find the pmureg regmap previously configured in probe() and return regmap + * pointer. + * + * Return: A pointer to regmap if found or ERR_PTR error value. + */ struct regmap *exynos_get_pmu_regmap(void) { struct device_node *np = of_find_matching_node(NULL, exynos_pmu_of_device_ids); if (np) - return syscon_node_to_regmap(np); + return exynos_get_pmu_regmap_by_phandle(np, NULL); return ERR_PTR(-ENODEV); } EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap); +/** + * exynos_get_pmu_regmap_by_phandle() - Obtain pmureg regmap via phandle + * @np: Pointer to device's Device Tree node + * @property: Device Tree property name which references the pmu + * + * Find the pmureg regmap previously configured in probe() and return regmap + * pointer. + * + * Return: A pointer to regmap if found or ERR_PTR error value. + */ +struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np, + const char *property) +{ + struct device *dev; + struct exynos_pmu_context *ctx; + struct device_node *pmu_np; + + if (property) + pmu_np = of_parse_phandle(np, property, 0); + else + pmu_np = np; + + if (!pmu_np) + return ERR_PTR(-ENODEV); + + /* + * Determine if exynos-pmu device has probed and therefore regmap + * has been created and can be returned to the caller. Otherwise we + * return -EPROBE_DEFER. + */ + dev = driver_find_device_by_of_node(&exynos_pmu_driver.driver, + (void *)pmu_np); + + of_node_put(pmu_np); + if (!dev) + return ERR_PTR(-EPROBE_DEFER); + + ctx = dev_get_drvdata(dev); + + return ctx->pmureg; +} +EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle); + static int exynos_pmu_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct regmap_config pmu_regmcfg; + struct regmap *regmap; + struct resource *res; int ret; pmu_base_addr = devm_platform_ioremap_resource(pdev, 0); @@ -133,13 +329,42 @@ static int exynos_pmu_probe(struct platform_device *pdev) return PTR_ERR(pmu_base_addr); pmu_context = devm_kzalloc(&pdev->dev, - sizeof(struct exynos_pmu_context), - GFP_KERNEL); + sizeof(struct exynos_pmu_context), + GFP_KERNEL); if (!pmu_context) return -ENOMEM; - pmu_context->dev = dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + pmu_context->pmu_data = of_device_get_match_data(dev); + /* For SoCs that secure PMU register writes use custom regmap */ + if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_secure) { + pmu_regmcfg = regmap_smccfg; + pmu_regmcfg.max_register = resource_size(res) - + pmu_regmcfg.reg_stride; + /* Need physical address for SMC call */ + regmap = devm_regmap_init(dev, NULL, + (void *)(uintptr_t)res->start, + &pmu_regmcfg); + } else { + /* all other SoCs use a MMIO regmap */ + pmu_regmcfg = regmap_mmiocfg; + pmu_regmcfg.max_register = resource_size(res) - + pmu_regmcfg.reg_stride; + regmap = devm_regmap_init_mmio(dev, pmu_base_addr, + &pmu_regmcfg); + } + + if (IS_ERR(regmap)) + dev_err_probe(&pdev->dev, PTR_ERR(regmap), + "regmap init failed\n"); + + pmu_context->pmureg = regmap; + pmu_context->dev = dev; + if (pmu_context->pmu_data && pmu_context->pmu_data->pmu_init) pmu_context->pmu_data->pmu_init(); diff --git a/drivers/soc/samsung/exynos-pmu.h b/drivers/soc/samsung/exynos-pmu.h index 1c652ffd79b4..0a49a2c9a08e 100644 --- a/drivers/soc/samsung/exynos-pmu.h +++ b/drivers/soc/samsung/exynos-pmu.h @@ -21,6 +21,7 @@ struct exynos_pmu_conf { struct exynos_pmu_data { const struct exynos_pmu_conf *pmu_config; const struct exynos_pmu_conf *pmu_config_extra; + bool pmu_secure; void (*pmu_init)(void); void (*powerdown_conf)(enum sys_powerdown); diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h index a4f5516cc956..406ed73614fd 100644 --- a/include/linux/soc/samsung/exynos-pmu.h +++ b/include/linux/soc/samsung/exynos-pmu.h @@ -20,12 +20,21 @@ enum sys_powerdown { extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); #ifdef CONFIG_EXYNOS_PMU -extern struct regmap *exynos_get_pmu_regmap(void); +struct regmap *exynos_get_pmu_regmap(void); + +struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np, + const char *property); #else static inline struct regmap *exynos_get_pmu_regmap(void) { return ERR_PTR(-ENODEV); } + +static inline struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np, + const char *property) +{ + return ERR_PTR(-ENODEV); +} #endif #endif /* __LINUX_SOC_EXYNOS_PMU_H */ From patchwork Fri Feb 2 14:57:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13542972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31E5BC48291 for ; Fri, 2 Feb 2024 14:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jd+Mb2dr7S97XK60tvAEMZRvPePYWlX7AgEEh+Xan1o=; b=XY4qEovtu8DFAl mFmjS4Ic/eG58zYJXpkcPTOMalpjTkxeTEr9V1Z0Lk2hFN9t5AfxUfNon19utU7UyZaKiJMekqQET jc67W7CxUImJ6pWvR8u0nR9t3fosvwhTR0P5qh3Q+W5EaVcOCrNJPEdwawih2LZo2bbKwCUHr6ixy gBoY7raWEZbU1hjwl4tpfkg7VwiF0+7skMvfWmVMDTZyLuP+FNduJDQRzWbejlBAFNAKGQgVah5Od Hb+wbtzi86YKgzQbI8PuRMEtacVzualUUgAcxzTDhu3jyznuhXr+D6+V192jmmFrsmwKnz+6ndfvG DkNVPQobp3QDvrR+KY9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuzI-0000000Bs5R-2jjm; Fri, 02 Feb 2024 14:57:52 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuzD-0000000Bs2R-2iwI for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 14:57:48 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a359446b57dso281822866b.3 for ; Fri, 02 Feb 2024 06:57:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706885866; x=1707490666; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nxb698xf8QkMydB4z0YB9c3r/9JegaMn6kB+mk5+8LA=; b=lcN+vmY0Idyng2fepswOgF71MeTBqWlhxysMNPXohLmKqeHZZ7OGtdvqBO9h6UWhA4 sK9N3WCpUwnIVriUYHSxPusDPtkMON68pCwaa2McUa+u4L2kfKLjvZEe1VR4fK7v7rEz Wwmm/iA0rlyUHE7J6o24atwvy85WhB1JEfn2nflEKD/cGJG41VDuvWoKzkDQL/P04ts3 VArxe2MKhApaknxB0D+OMfm8fp1T/B2LUYfNXhCPRAktRBc/pOOzhWKvxG66UnVftLgw bGrt0N8wHSecK+v/dRrdjx/xr8bcbWSqRcXcP24dhAUahxXehyKoGriIbgbDkcUEi/hN Q0Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706885866; x=1707490666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nxb698xf8QkMydB4z0YB9c3r/9JegaMn6kB+mk5+8LA=; b=Y+FcfuHjZqEnSGJ/6lVJsYoeB9vhdG/zIqibm8rqzJ+In985kSIgpqhrjQKxRaQ77A Fx1c9REznaESh/vf7oFqd5RMePXKj5EAAik7LceogLSUC2dErvyzDt8AIn5/AwfRelmm pUEUlkhPyo/d/zJkE0wRX/KVQH1U7vI4XfBGizOj3HmTAnEcAU3AMFErKHIMEhsWuGI9 gLqUW9rGch4TN1NEGezfssz+7Lb4el6zcGvvYNvbBDbAhJIQR+0Bw0nmkissfn9jYByq MNG6nxfh7hwIuyfvkfOW3iCC+B2hKo7nRVwfQYUTrR8I8V++yil8S6HlxgNfux+btvcB q/Jw== X-Gm-Message-State: AOJu0YxrGqRbn94E9LnyEoGQ1/cIRJO2I9JYi/0tyI4GXyo/PvzO2Ue2 i2jNNMLY9kEok/dphQSnk7esN2ia0rFLQsY+9UlfDUdR9fapNLX5nirpX5yR4Gc= X-Google-Smtp-Source: AGHT+IEq5+ecus9eptHUpdICSkpu0fVKudtg5PpRU+RWCPogFNs8q/6X9DnhhUg2PfG3cuiVlChiOg== X-Received: by 2002:a17:906:30c3:b0:a37:7fd:9a1e with SMTP id b3-20020a17090630c300b00a3707fd9a1emr1331738ejb.1.1706885866301; Fri, 02 Feb 2024 06:57:46 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXrgol+/K1m0i+gOh3V1PPaImHM0PUK7M2r5Dhk8DlbpenPP7J3oMx0Nu4z1Jcs9BMeM2nQPP9g8rKwaLyJxpSaW8BMRXW9G2cT9pZiqYa2kM2u8/fyuzQUC3HDW+SeAuGR8pyG0ALCT5h3XKnM9HLMfR5cCakEeuHs4glq5BGPJyIkWw23UPoxZFPIomrq0AqPtjjo3zGb4cT/Ooy4sWrfQmnp8+QkqA1eg8pknfWgaPMI+Cku8uOOmxVGY6DwVjxGS5aUsg8cHCsGUjJ6QlN3trlh035+uQK1peWwRYMKfC/719FJwj6ah0p3cWDp7hB+RU1z2wq0zIjCeSyoUc+wtlJ0Egcn+YON3VY/7m5u5m1+LegS6yZ1+/5V5txyyQpwwioOPjwESPuc7rcH+b91kgI7P5Eua1ZqrBuyktP28MUhpYO39r5RMb6kMwvegotd4a9BHVTP1UUgzTFzR/3xIuRtWcEGB6jDdS3F6qqkZz5ikEFLHly7CU2lY+2b7zGdusclQ/jk42rXZ6+jwzzBR9Ao0EhC9b5IozdHuH33wPvM6IRRw7gfCj4UKCQX4UPmOOXXfelfeIDyhR1Yumga9mB5PTE40iL5rRxnsyKVYKhDWIOst2adexrp/clU6H/VPwaIM3E0AUTpSBIXGZmj7x3U6ay4Rd3Li2p4UmlJhnRIQEBSAbRHmgJkw8luLlGRaHc9JVD1OQ== Received: from gpeter-l.lan (host-92-21-139-67.as13285.net. [92.21.139.67]) by smtp.gmail.com with ESMTPSA id t8-20020a17090616c800b00a36c60180aesm957200ejd.60.2024.02.02.06.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 06:57:45 -0800 (PST) From: Peter Griffin To: arnd@arndb.de, krzysztof.kozlowski@linaro.org, linux@roeck-us.net, wim@linux-watchdog.org, alim.akhtar@samsung.com, jaewon02.kim@samsung.com, semen.protsenko@linaro.org Cc: kernel-team@android.com, peter.griffin@linaro.org, alexey.klimov@linaro.org, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, linux-fsd@tesla.com, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 2/2] watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs Date: Fri, 2 Feb 2024 14:57:31 +0000 Message-ID: <20240202145731.4082033-3-peter.griffin@linaro.org> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog In-Reply-To: <20240202145731.4082033-1-peter.griffin@linaro.org> References: <20240202145731.4082033-1-peter.griffin@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_065747_725408_4183DD6A X-CRM114-Status: GOOD ( 16.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Obtain the PMU regmap using the new API added to exynos-pmu driver rather than syscon_regmap_lookup_by_phandle(). As this driver no longer depends on mfd syscon remove that header and Kconfig dependency. Reviewed-by: Sam Protsenko Signed-off-by: Peter Griffin --- drivers/watchdog/Kconfig | 1 - drivers/watchdog/s3c2410_wdt.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 7d22051b15a2..d78fe7137799 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -512,7 +512,6 @@ config S3C2410_WATCHDOG tristate "S3C6410/S5Pv210/Exynos Watchdog" depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST select WATCHDOG_CORE - select MFD_SYSCON if ARCH_EXYNOS help Watchdog timer block in the Samsung S3C64xx, S5Pv210 and Exynos SoCs. This will reboot the system when the timer expires with diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 349d30462c8c..686cf544d0ae 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -24,9 +24,9 @@ #include #include #include -#include #include #include +#include #define S3C2410_WTCON 0x00 #define S3C2410_WTDAT 0x04 @@ -699,11 +699,11 @@ static int s3c2410wdt_probe(struct platform_device *pdev) return ret; if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { - wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, - "samsung,syscon-phandle"); + wdt->pmureg = exynos_get_pmu_regmap_by_phandle(dev->of_node, + "samsung,syscon-phandle"); if (IS_ERR(wdt->pmureg)) return dev_err_probe(dev, PTR_ERR(wdt->pmureg), - "syscon regmap lookup failed.\n"); + "PMU regmap lookup failed.\n"); } wdt_irq = platform_get_irq(pdev, 0);