From patchwork Mon Jan 29 21:19:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 193708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp838585dyb; Mon, 29 Jan 2024 13:19:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IExfRm4bIxQLWXUfdGWp/uoD3u0VsIy7PBCyxA0BHikaCJqzn2bq3lWk9e0IxwM865gcEfQ X-Received: by 2002:a05:6402:358b:b0:55d:2ecf:7ba7 with SMTP id y11-20020a056402358b00b0055d2ecf7ba7mr5602223edc.2.1706563194895; Mon, 29 Jan 2024 13:19:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706563194; cv=pass; d=google.com; s=arc-20160816; b=D/ruZ6UctfkRRa6cXUrIDsA7p+8XR7QRtsYXTfWZ68Z7EEGJSSC4TD7YkC4vZJIEIu eErAWH0IgHjUZLzVCFUgJZbAh+QBN9Ut0fjo9AZ1a6vZBFqnDvs1Gz9tMyyqPQ/n9j0J bf0/oMqXodukllKmWryoICY+4ihE1hk74zTX0LcOGaJWHTjrGzDYq5OLm07Ui2GXjre+ +ftKspOdhhW5T1y1TTJnZos2y9S/DN8jKCcX5NlWjsqtFSYir3JrILeLpjcej3tKUOqR /HKA/FWx8VgGqTPz0i3qs8Yt+45P/Cd6iOtFVxTAku19zBk5ta8SbNG/91Vo1BVPPcIa 9Y5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZpbxmGmuZYrvIhn48LubQTFMeBUE52UDQ+rws3cLcIw=; fh=CnxxRiqpIWaqV9QPpTBUX7f6pZJMdF4OYQI0H/q83DY=; b=OuJzFV+5pg+gCXkC46ZTK9izh0pGzRCR3ehIa2W+8wbyuk6lTIDiDob8HlEGFt1SND hd5qZ1Adtn5rh2G8Mu7rCbAHF4qvb5ueVene+0Ax4QOV8M2t3+vr4oWacfFyNc79z7cQ 98PFXrTbNaR/CH00UFZcPIbz8EbuNE/elTsXoPiMRvlz2y+aq9y1Vxzd0uY3bv7nTzRo AFPmKGFZjxosGyTDM27iNpYEJzZ47R7G3PtSmSizucpoYLjNN4F3zegl4XMR6/e9OqHK 5xw5TLNx3CNkXdxDbPHkIg8R54hVqfOr8S16fdQfqUbCBukA5BbgEcoMcJXcxDVTpSwq mZIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pDLhRJIf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-43516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43516-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m16-20020aa7d350000000b0055ced89681csi3724696edr.587.2024.01.29.13.19.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:19:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pDLhRJIf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-43516-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43516-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5D2901F25B42 for ; Mon, 29 Jan 2024 21:19:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 660BF159597; Mon, 29 Jan 2024 21:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pDLhRJIf" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B2E1158D64 for ; Mon, 29 Jan 2024 21:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706563164; cv=none; b=gt9Z//jXY5ye/+i8GGtNHngXiYNunq1Ixi4BlK+n6FzZnrQKCkSL18SMNvCX3tWr8actIWdS1Wi5KcYfp2051xy93qPmkYRRj8FMGe67EDPwDXW6QGcw5M4am60OgdKhB1YKYz4lziUiMs/Kxq32whbS8o1mEs5z2fX2/475w+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706563164; c=relaxed/simple; bh=/ugR5s+M8bY3zdX2bhDZ4xqGChDvsokzBXYol4bVq3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hBm/n9J+5PBP5SGphqmeEbgZuZC+DJNYXOUafu8Kx/ogKz3gM9zGeCbPLPQjiqI5QROIj05QaY6GwScTLTU6+IScg4jEP7NtJkkGQk1kCxlwacAopchwNgKUz4Dn8BurCbxg/PE7zi4wAlVgiFCtRLWqMKuRNBDfnosrzHP8j3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pDLhRJIf; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40ef6c471d5so12120955e9.0 for ; Mon, 29 Jan 2024 13:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706563160; x=1707167960; darn=vger.kernel.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=ZpbxmGmuZYrvIhn48LubQTFMeBUE52UDQ+rws3cLcIw=; b=pDLhRJIfVbfMoKNsYhR+M15kpzdQa1g774VlTyQyp5UW3BDXj0CpxnID+ZH7avZWaC db5AZ0h810CYc3JAxIsyzde0wim3yaCj9SmG2YVRrBrNP/Zal2EQ6GtUz+56sPlvUu21 WTAnZyWhZtodpDZrTzC0sTO2Lyl9kibMJbLVYnWLhTHD/0h7einL5rq712wmAjbshMjV RlQs9VRYZ0bcgQ+bosfqG28Md/GxhUtqpmxXOKWdvFHkbiR/oeMTUHYhDoujnOoyYbn4 LYacx13jlez8Askbexhgy2UZ0YRcfuhTHYJCluaaU43agD8qHUk9BALoFJAwl6S9W/Lc Kxbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706563160; x=1707167960; 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=ZpbxmGmuZYrvIhn48LubQTFMeBUE52UDQ+rws3cLcIw=; b=WB5LzP69wCVrfM2YQwDBB4eXuHrmwATQDSJuJgzw1l27zXmzEvi5qeA+NHsRYe9oPE lwWUHm9fiZKZbCEyK42ObLICxrFc8TghlMGVvXLAl+SHeItOTycdYwEI5hs47+Le+zLO D31IhmBLH0wjb+Aw/hy1p2ra3N9D6m93aBXxZvFBOfJzxnxdzYiKbZ3vyZmyZI7mSbit rIgX2FUxjY/7y3tv6t/Mwr7rfvyKS+nvVQ+ZGMMVlstzNd4c0Kj3bV4CeKfTXUY+08vc ELkjc3JYTrtPhAnoYoUk7qnmRmQQ0d3BkcZyxDz4UshFCKQf4BIlYz48rf0OYdWjJg4T wLtQ== X-Gm-Message-State: AOJu0YzAlK+SqgCIF23bXpOhIFmkprmpHAI+QinKOFbcEUcGRe5mNNhZ qfOYpwxjHHZO9d7FTPmLJB5PyEZD00FUfyVSEMX0q83U+Dextli6yx3tTyxOh0Y= X-Received: by 2002:a05:600c:3b0e:b0:40e:f56e:712c with SMTP id m14-20020a05600c3b0e00b0040ef56e712cmr3775905wms.37.1706563160295; Mon, 29 Jan 2024 13:19:20 -0800 (PST) Received: from gpeter-l.lan (host-92-21-139-67.as13285.net. [92.21.139.67]) by smtp.gmail.com with ESMTPSA id iv16-20020a05600c549000b0040e3635ca65sm15126928wmb.2.2024.01.29.13.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:19:19 -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, 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 v2 1/2] soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs Date: Mon, 29 Jan 2024 21:19:11 +0000 Message-ID: <20240129211912.3068411-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240129211912.3068411-1-peter.griffin@linaro.org> References: <20240129211912.3068411-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789461208687811730 X-GMAIL-MSGID: 1789461208687811730 Some Exynos based SoCs like Tensor gs101 protect the PMU registers for security hardening reasons so that they are only 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 --- drivers/soc/samsung/exynos-pmu.c | 227 ++++++++++++++++++++++++- include/linux/soc/samsung/exynos-pmu.h | 10 ++ 2 files changed, 236 insertions(+), 1 deletion(-) diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index 250537d7cfd6..7bcc144e53a2 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,20 +13,159 @@ #include #include #include +#include #include #include #include "exynos-pmu.h" +static struct platform_driver exynos_pmu_driver; + +#define PMUALIVE_MASK GENMASK(14, 0) + 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; +/* + * Tensor SoCs are configured so that PMU_ALIVE registers can only be written + * from el3. As Linux needs to write some of these registers, the following + * SMC register read/write/read,write,modify interface is used. + * + * Note: This SMC interface is known to be implemented on gs101 and derivative + * SoCs. + */ +#define TENSOR_SMC_PMU_SEC_REG (0x82000504) +#define TENSOR_PMUREG_READ 0 +#define TENSOR_PMUREG_WRITE 1 +#define TENSOR_PMUREG_RMW 2 + +/** + * tensor_sec_reg_write + * Write to a protected SMC register. + * @base: Base address of PMU + * @reg: Address offset of register + * @val: Value to write + * Return: (0) on success + * + */ +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); + + if (res.a0) + pr_warn("%s(): SMC failed: %lu\n", __func__, res.a0); + + return (int)res.a0; +} + +/** + * tensor_sec_reg_rmw + * Read/Modify/Write to a protected SMC register. + * @base: Base address of PMU + * @reg: Address offset of register + * @val: Value to write + * Return: (0) on success + * + */ +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); + + if (res.a0) + pr_warn("%s(): SMC failed: %lu\n", __func__, res.a0); + + return (int)res.a0; +} + +/** + * tensor_sec_reg_read + * Read a protected SMC register. + * @base: Base address of PMU + * @reg: Address offset of register + * @val: Value read + * Return: (0) on success + */ +static int tensor_sec_reg_read(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_READ, + 0, 0, 0, 0, 0, &res); + + *val = (unsigned int)res.a0; + + 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 void tensor_set_bit_atomic(void *ctx, unsigned int offset, + u32 val, u32 mask) +{ + unsigned int i; + + for (i = 0; i < 32; i++) { + if (mask & BIT(i)) { + if (val & BIT(i)) { + offset |= 0xc000; + tensor_sec_reg_write(ctx, offset, i); + } else { + offset |= 0x8000; + tensor_sec_reg_write(ctx, offset, i); + } + } + } +} + +int tensor_sec_update_bits(void *ctx, unsigned int reg, unsigned int mask, unsigned int val) +{ + int ret = 0; + + /* + * 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); + + tensor_set_bit_atomic(ctx, reg, val, mask); + + return ret; +} + void pmu_raw_writel(u32 val, u32 offset) { writel_relaxed(val, pmu_base_addr + offset); @@ -80,6 +220,8 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode) */ static const struct of_device_id exynos_pmu_of_device_ids[] = { { + .compatible = "google,gs101-pmu", + }, { .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 + * Find the pmureg previously configured in probe() and return regmap property. + * Return: regmap if found or error if not found. + */ 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 + * Find the pmureg previously configured in probe() and return regmap property. + * Return: regmap if found or error if not found. + * + * @np: Pointer to device's Device Tree node + * @property: Device Tree property name which references the pmu + */ +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); + + 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 struct regmap_config pmu_regs_regmap_cfg = { + .name = "pmu_regs", + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .fast_io = true, + .use_single_read = true, + .use_single_write = true, +}; + static int exynos_pmu_probe(struct platform_device *pdev) { + struct resource *res; + struct regmap *regmap; + struct regmap_config pmuregmap_config = pmu_regs_regmap_cfg; struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; int ret; pmu_base_addr = devm_platform_ioremap_resource(pdev, 0); @@ -137,6 +333,35 @@ static int exynos_pmu_probe(struct platform_device *pdev) GFP_KERNEL); if (!pmu_context) return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + pmuregmap_config.max_register = resource_size(res) - + pmuregmap_config.reg_stride; + + if (of_device_is_compatible(np, "google,gs101-pmu")) { + pmuregmap_config.reg_read = tensor_sec_reg_read; + pmuregmap_config.reg_write = tensor_sec_reg_write; + pmuregmap_config.reg_update_bits = tensor_sec_update_bits; + + /* Need physical address for SMC call */ + regmap = devm_regmap_init(dev, NULL, + (void *)(uintptr_t)res->start, + &pmuregmap_config); + } else { + pmuregmap_config.max_register = resource_size(res) - 4; + regmap = devm_regmap_init_mmio(dev, pmu_base_addr, + &pmuregmap_config); + } + + if (IS_ERR(regmap)) { + pr_err("regmap init failed\n"); + return PTR_ERR(regmap); + } + + pmu_context->pmureg = regmap; pmu_context->dev = dev; pmu_context->pmu_data = of_device_get_match_data(dev); diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h index a4f5516cc956..68fb01ba6bef 100644 --- a/include/linux/soc/samsung/exynos-pmu.h +++ b/include/linux/soc/samsung/exynos-pmu.h @@ -21,11 +21,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); + +extern 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 Mon Jan 29 21:19:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 193709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp839054dyb; Mon, 29 Jan 2024 13:20:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDEKdkatyH5S/h80jQT1vM9zJksF+x/YSawXEDmzxPA/Eq1M46/81U2lfTTO/68ABloOtB X-Received: by 2002:a05:622a:f:b0:42a:b3ef:916e with SMTP id x15-20020a05622a000f00b0042ab3ef916emr299979qtw.95.1706563249756; Mon, 29 Jan 2024 13:20:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706563249; cv=pass; d=google.com; s=arc-20160816; b=01WBReP+XGXN/61OikBqNIn7m3hUsL4fQO3U3r164rWScMk3+h3OgntqWapBlhB3AM +fOiVXQWKLa3zAt44p+8SFBnfSqqv5j1AyfF0o9TYAoAs2ePmS3LO0ao9VfUUFiAK/iE RRw5/y5r+Bz6tB+lW9QD3G8HvXEh06K5RLJTaH7YCwt0KP4yTffFUO9YWwQ7Bnr5cck4 1m+p66Bn0xWG96xZwlgALbZh+QzkQ54X5Niowse9zKrBX1Sin1GP3FrLQF9c8zMmo4pC +mR4+rvRIdLSwAmqr+StCiPFZLhEAi+G39FYQW5ebkQYwcMLGvVvsCr/9NCooLiPxEEf 2GYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=z9S0cbpz+w0Ro+UeWqvavBY4QIBfmENEBk/Ib6o78C0=; fh=CnxxRiqpIWaqV9QPpTBUX7f6pZJMdF4OYQI0H/q83DY=; b=kGfA5VRXtSD9djjfWM9acmnSGRQ3t6EEwGUsIwddA0qN6/JZnCtvMgRhbGramgePdE jtbqMGkvh+n5QBPfRYZh1N7RhGMF22HCWGRhfZzhnGEjqfFSc9fnVi/oE9XzhWR3W2eI hbXUPcsuIKdw97v+uwzdCbhQC8pmt5+wmbEFRX3uyun2MCIZHr/5UfIQakUKeeWLmWYa 0HRhxYPsI3UvCSvOggV1FXx6VMVo38b7OFOVGsNlDFSa+/Ao95Gehlx2oU1Hv0NigCC4 rPooxoZgEi2iCAiIb+1r5fFVc1S3eCqkWsba8H8qmkoQKdxPUGuRsAztHAbjBDkR9qGm OcLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WZc/IIkI"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-43517-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a5-20020ac85b85000000b0042a5bd82617si8560576qta.321.2024.01.29.13.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43517-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WZc/IIkI"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-43517-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E41361C22B4F for ; Mon, 29 Jan 2024 21:20:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCFBE15A489; Mon, 29 Jan 2024 21:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WZc/IIkI" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53F76159583 for ; Mon, 29 Jan 2024 21:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706563168; cv=none; b=KH29ZXpcOZxZeScs13LXEiQvUwjylxeE1Irtka7rIlSPyt901PQgEnTN2i8TAh98hqab/57Ic6LWsvS1/3hCTr4syJBTf/acXZCFTO37qoQNZV6oEdXqDKDasr67NvO7DX4Kl1B7YY+2GrPG/w5lcYxthXLSORrtbQhBFFEA0+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706563168; c=relaxed/simple; bh=N/dTvAXukJJ3gcdpKEbrdzFSZE0mfVmJtWEBs7Wr1pM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a+K3T8rspJzOsQ9EeST7BENu5oVV/dwUYPJAIMUCWEdVqlqMqqF1AkAkwcLMTD5vjfmptlqFSfJUUXFKVgKN+xsiOEpb9RM3yLnnN6/YJFTTIQsfIwQybQgmEaei2dxsYNXCNeZX0lSxK4qDmjv9OCyulkkwbdmBuDoS4wjN7ps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WZc/IIkI; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40e913e3f03so38420945e9.3 for ; Mon, 29 Jan 2024 13:19:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706563164; x=1707167964; darn=vger.kernel.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=z9S0cbpz+w0Ro+UeWqvavBY4QIBfmENEBk/Ib6o78C0=; b=WZc/IIkIqjwgtKKvlgBXT/Bft6YF1xHxevLo1ti3rMzyHyFXm1wC4bR/T2Ye6GR2IH Klk93wXU6xu/HMHdluV36naKQMvpU5ZkgCptO39ibAFlpDN8GX1ogc/hEU3si6w2K1Jt wCVzQk+cuC8mSBbBNhp8WjPxEL5YtU0H7szvpkWBdLQDru5RTZI35m+4Ie02LFaPteoh lyd+ew1w/aAJKugFxtVstVBNC7vp/Q+fBZhlRqTdqMugN33v/iFHMwiaD/Bmr/Gm05RW 1OpoyA0FVVAZ4hqsSqjGkMcNbLV5o3mJWVM5Ko5wuAVVh+luOxugRpkdgd500gmMOR7n VC/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706563164; x=1707167964; 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=z9S0cbpz+w0Ro+UeWqvavBY4QIBfmENEBk/Ib6o78C0=; b=oDKfh3hyJMo5v3iDXWDpj0kgLqQdyKyGPtnmzyAWDVxHwCn3B97i4hZnKrO+iiz61+ 0XE4z+f905DLKOSuZ49py2Y2At5abTZV+MdgpBnd0yvrU8RoeHkSmgPmjMF0FwzfPL+9 QhW5s+83HpDN25I80MVOVAT1TOuXSb3GGPY98kRbfhneYJ1B1rt+oiJ15sWjWBdmWP8T Mt8pUHtd2VQi3L7QexQNh3mwTroBLBXmQDIqye0k0Ku1H68EURtteixoVCJyHLUFPLgq Y8ntXiJHJqumzZFsZTNck7WcrS4SnSnMQqaOXTzl9WDGqsX2fx95S3F8w4leMJ2qa1Em iNPQ== X-Gm-Message-State: AOJu0YyIGZPMd+0MKTgoa0WOPtpK0s7wPT6UP7A2PQ5I3ydDWJ3PICsn yNmMr8W1XElMcqJYZbAA9V2aC+sfkOBU593cfxiEitaq93zl8oYUgjft+72au/k= X-Received: by 2002:a05:600c:ad0:b0:40e:779f:416 with SMTP id c16-20020a05600c0ad000b0040e779f0416mr6409689wmr.2.1706563164594; Mon, 29 Jan 2024 13:19:24 -0800 (PST) Received: from gpeter-l.lan (host-92-21-139-67.as13285.net. [92.21.139.67]) by smtp.gmail.com with ESMTPSA id iv16-20020a05600c549000b0040e3635ca65sm15126928wmb.2.2024.01.29.13.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:19:24 -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, 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 v2 2/2] watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs Date: Mon, 29 Jan 2024 21:19:12 +0000 Message-ID: <20240129211912.3068411-3-peter.griffin@linaro.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240129211912.3068411-1-peter.griffin@linaro.org> References: <20240129211912.3068411-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789461266417330276 X-GMAIL-MSGID: 1789461266417330276 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. Signed-off-by: Peter Griffin Reviewed-by: Sam Protsenko --- drivers/watchdog/Kconfig | 1 - drivers/watchdog/s3c2410_wdt.c | 9 +++++---- 2 files changed, 5 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..a1e2682c7e57 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,12 @@ 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);