From patchwork Wed Mar 8 23:09:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 660935 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D6DEC74A44 for ; Wed, 8 Mar 2023 23:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbjCHXJh (ORCPT ); Wed, 8 Mar 2023 18:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbjCHXJg (ORCPT ); Wed, 8 Mar 2023 18:09:36 -0500 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D5264218 for ; Wed, 8 Mar 2023 15:09:34 -0800 (PST) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-17638494edbso455324fac.10 for ; Wed, 08 Mar 2023 15:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316973; 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=+EZCn0NdbTVrvM23U+e5p/n9AtAvNh9rjheRTu832dQ=; b=U2CVKkl/ZZuBfeI0jW1ZRVsvfuNzbJ2tfTxcMSf7yfLuNGGUEAos2v9A5+76sjUOMn bLfP0R9A21kYBAMAsP2q5NrLkd1Nk0j12aoP0R8SNFbxCSz2Xhn/4q2Iqw6Bq0eczdXq CFlHSvrKbNpb6us/ow+CgWfcjNJ8+osRuuUCUQOq+LPXVOmIsJDEjREmDvyYRk2eIKVO 7pE0gWM/6/bcO2dUaBKUPejJWb3RX2lVSmHa2S4pTQ0apLSnx+xNghPARTX4sp2f+utz D98WBVxCB5evOgVqd/CvsrirOv7krNr2sCtPZGzZjXhWUQrYY4tOESrS4yFHpCr/86H4 psaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316973; 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=+EZCn0NdbTVrvM23U+e5p/n9AtAvNh9rjheRTu832dQ=; b=2Uzz+BySAZiGMIhSlO/aQlsQjXKY9QQdyIIvJRdMZ8zLpprH0cSbK8S+oXUlrfYFjC i5qMiOD/WinXAMUvyCrS8vTv4321/ugzRueW9PBMqY1NFJLiWt0ZhgL7u2sEWuoQkLUZ s2cAlqzTQ86m7aExkbUCcPbFmL4ZMKI5GE9DPcsMdLX9z89gScdtfj5Iep9ulk6U58Lj TE3bpHFYazUI9O/BkHiNe7MxLP/VkfwniDqcKXDfIL9xhAoAsajPOO9rTQC8Z4wCJtxI 76KqSRXmA3ZUr9M+XL55NSNWSYB9hsIhKaz3jLR9gPVcdPgKfTO1CWVvBRCGX/Mm/yam ftoQ== X-Gm-Message-State: AO0yUKUbWZ7f1N+EFjgDsP+hlkKcclghCNHSQHMD4yi2hzPbV+CuhFwy 7gIJmmI17W4ViQwqGDzoacAtYQ== X-Google-Smtp-Source: AK7set8WrlFPXvBp65SgkmLYgtk/hwpjy3GwLMvFVTawJ5bKZVU6MMUVfwzfFfbn6b215ppGtxMHFw== X-Received: by 2002:a05:6870:a786:b0:172:9ad0:8d5 with SMTP id x6-20020a056870a78600b001729ad008d5mr11331196oao.35.1678316973745; Wed, 08 Mar 2023 15:09:33 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id w16-20020a056870431000b00172428894e0sm6633286oah.28.2023.03.08.15.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:33 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] dt-bindings: power: pd-samsung: Add Exynos850 support Date: Wed, 8 Mar 2023 17:09:26 -0600 Message-Id: <20230308230931.27261-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Document the compatible string for Exynos850 power domains controller. Also add power domain indices which can be used in "samsung,pd-index" property to specify a particular power domain in the device tree. Signed-off-by: Sam Protsenko --- .../devicetree/bindings/power/pd-samsung.yaml | 1 + MAINTAINERS | 1 + .../dt-bindings/power/samsung,exynos850-power.h | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 include/dt-bindings/power/samsung,exynos850-power.h diff --git a/Documentation/devicetree/bindings/power/pd-samsung.yaml b/Documentation/devicetree/bindings/power/pd-samsung.yaml index 9c2c51133457..a353a705292c 100644 --- a/Documentation/devicetree/bindings/power/pd-samsung.yaml +++ b/Documentation/devicetree/bindings/power/pd-samsung.yaml @@ -21,6 +21,7 @@ properties: enum: - samsung,exynos4210-pd - samsung,exynos5433-pd + - samsung,exynos850-pd reg: maxItems: 1 diff --git a/MAINTAINERS b/MAINTAINERS index 8d5bc223f305..53e11e48639c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2720,6 +2720,7 @@ F: drivers/pwm/pwm-samsung.c F: drivers/soc/samsung/ F: drivers/tty/serial/samsung* F: include/clocksource/samsung_pwm.h +F: include/dt-bindings/power/samsung,* F: include/linux/platform_data/*s3c* F: include/linux/serial_s3c.h F: include/linux/soc/samsung/ diff --git a/include/dt-bindings/power/samsung,exynos850-power.h b/include/dt-bindings/power/samsung,exynos850-power.h new file mode 100644 index 000000000000..a8d877b5515a --- /dev/null +++ b/include/dt-bindings/power/samsung,exynos850-power.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2023 Linaro Ltd. + * Author: Sam Protsenko + */ + +#ifndef _DT_BINDINGS_POWER_EXYNOS850_POWER_H +#define _DT_BINDINGS_POWER_EXYNOS850_POWER_H + +#define EXYNOS850_PD_HSI 0 +#define EXYNOS850_PD_G3D 1 +#define EXYNOS850_PD_MFCMSCL 2 +#define EXYNOS850_PD_DPU 3 +#define EXYNOS850_PD_AUD 4 +#define EXYNOS850_PD_IS 5 + +#endif /* _DT_BINDINGS_POWER_EXYNOS850_POWER_H */ From patchwork Wed Mar 8 23:09:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 660934 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85B54C678D5 for ; Wed, 8 Mar 2023 23:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjCHXJj (ORCPT ); Wed, 8 Mar 2023 18:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjCHXJg (ORCPT ); Wed, 8 Mar 2023 18:09:36 -0500 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE0A62B43 for ; Wed, 8 Mar 2023 15:09:35 -0800 (PST) Received: by mail-ot1-x329.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso97153oti.8 for ; Wed, 08 Mar 2023 15:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316975; 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=J5PJqs5BsEDG1wdBjWwvXsmxEV4UYqM9XMe4BPKxtuE=; b=ZU2X+gAAyNbrZY+ccoI8srKvzJyr8um35igO3wIc7sMBIwllqYYzfzRU6hDuVGzBr0 Z1nYOwbnWSEU2h/QgERS5S+ydFsTvlH6nNRE6m/j2Ky9GxN0Ci41a7LPYHEiiTVxReeS 5/rsNyudWq6Ka5nqw1VCHvBgAFvmaBpkSChwE6nZBj4I59II15cjF9FSygL2ikudqtxw qHohzOZJtqX/gh0emEUgvxEyOY7gXKgDlB3fses6xEISy921rs9AcR/5Pl2Aa9G8erh1 ykGcKppFLstx1j6aEsp4/FwxKopraCwUk/BgBZrvZbWjl35uDJagPNrJBvQ8ucaq8GfB 0JTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316975; 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=J5PJqs5BsEDG1wdBjWwvXsmxEV4UYqM9XMe4BPKxtuE=; b=xMELbmNpFnhyu39KwMBKPqneQXP3afQBFXNgOkPrK++sSg7l8qI6bossFVIVt+1mEA tdJsM0XKh5FbSTgaKWz0y5I7X33mM4X4iAC8xcY4DG88oosAPYHhhxVsSWbAhcL8Yr6r EWy45/YTz++Km6MeBbG6Md0+yiu3k/GpFC12yycbn6QyxjSvnIi16MtAKkmgjd/vkF/d aTVWqF378bLnx/GEmlRCL3uerflSn7hfjJNFnYZ8wBza/DsbP4NG7UPWdZzY/se8UVS0 +78Q5CLrlhx4khBK3FzQAy3RdLMzD9LlcJTRwWU9WtiW3pKVI4SUbEIK1nJ+hQmhEVqq IV/Q== X-Gm-Message-State: AO0yUKV6F8u8mJl5OuetoLc4WbNK7VNRFxYWzGjt7OmL0MyJv+68t/6M vtcfB3MDPY/MSb6g5QTo5XG7kA== X-Google-Smtp-Source: AK7set9Bws1cMOebllDwvv/UMswljCg2/saQYhCNiwvbJgz55DbPlRXex9ohzIAXXIZMreMO0qAwgA== X-Received: by 2002:a05:6830:1f42:b0:68d:41b2:5b75 with SMTP id u2-20020a0568301f4200b0068d41b25b75mr9166479oth.11.1678316975008; Wed, 08 Mar 2023 15:09:35 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id q24-20020a05683031b800b0068bc48c61a5sm6976067ots.19.2023.03.08.15.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:34 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] dt-bindings: power: pd-samsung: Allow pd nodes to be children of PMU Date: Wed, 8 Mar 2023 17:09:27 -0600 Message-Id: <20230308230931.27261-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Introduce a new "samsung,pd-index" property to choose a specific power domain. This way it would be possible to avoid specifying any addresses in power domain nodes, relying solely on syscon regmap from the parent node (which should be a PMU system controller). Therefore the "reg" property is deprecated now, as it's more logical to describe power domains as children of PMU node, because PD registers reside in the PMU area. Signed-off-by: Sam Protsenko --- .../devicetree/bindings/power/pd-samsung.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/power/pd-samsung.yaml b/Documentation/devicetree/bindings/power/pd-samsung.yaml index a353a705292c..73178b1a56ea 100644 --- a/Documentation/devicetree/bindings/power/pd-samsung.yaml +++ b/Documentation/devicetree/bindings/power/pd-samsung.yaml @@ -25,6 +25,10 @@ properties: reg: maxItems: 1 + deprecated: true + description: + Physical base address and length of Power Domains area (if not a child of + PMU). clocks: deprecated: true @@ -45,10 +49,15 @@ properties: power-domains: maxItems: 1 + samsung,pd-index: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Power domain index (if a child of PMU). Valid values are defined in:: + "include/dt-bindings/power/samsung,exynos850-power.h" - for Exynos850 + required: - compatible - "#power-domain-cells" - - reg unevaluatedProperties: false From patchwork Wed Mar 8 23:09:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 661448 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3C0C64EC4 for ; Wed, 8 Mar 2023 23:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbjCHXJk (ORCPT ); Wed, 8 Mar 2023 18:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjCHXJh (ORCPT ); Wed, 8 Mar 2023 18:09:37 -0500 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9592562860 for ; Wed, 8 Mar 2023 15:09:36 -0800 (PST) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-176d93cd0daso494349fac.4 for ; Wed, 08 Mar 2023 15:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316976; 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=oCgoAAph+CJJQ/HXPDLlsZa6JDKmYlP9bMJP4xpZGTc=; b=ipb8NHtUtwLc9dxs8eFwm36R1+cjKR4a1WtnYtAuOVzgQSe1pUwRVCLF5dRVhyzMic N+DH+iurQ3clHBolZUJCOTWhArA9ZgJ6lhDZYHNPEO0XUA2Dc+fJBo/9+3q7VmWvz81j ymAC45KTfTfanXJoe4JPZJxHTxdIMrlpefmtXPUi2x9Sex1XSfgQt3qj7LX8dWY0fY/c wmzEMM2hs6LYkG9F6i7CfSkX7ZKUs7HtDkhTH1WQR6sPxUy/F5WATBSaq26d1bYVIUYH T1e+NZK1694QqTLm/oKJSC9zWPZ6F2rzYqNr4DJMfbpmT0fbEmh5j8RPKOHDxYG/DYN2 qD1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316976; 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=oCgoAAph+CJJQ/HXPDLlsZa6JDKmYlP9bMJP4xpZGTc=; b=pWe5uXNz1GuvjIXSL7m+ugLV3HN/k1+T6pWLyRGLLrvhPrMVtvWYVuSUsXCnmtwgex vlLDZg00aoyO9XF++LMX1lTE+F6nb86hfRVYrBum/8hylhX8q3xxcVRqHueNNVkSVEen p35WuGodIXS2D0cokazStL+SMmHbP1cHL2r8v88rsHbzkATc1vO7PHn1HP3KVxkxG8WK Kwz4w+qbmIyGvX/7lqMUWR+sA3W31vGHN58JbRWoS7k8h4rv7/aWatT6YkSmT+f3zLGm /+xCUePRCfbEUkRbT0KD8Do03qwGFg8iNnn+xvb6PY60ZvVniTKum5U3ui6zHTh9EvMO MqYw== X-Gm-Message-State: AO0yUKWjvZ5O8djfCb+4g76xYNmGgVQ0+uKE7iWKe0kISQKIxvbEMllN ZXfZ+VPZ/5+PIPreJKfNOdz9yg== X-Google-Smtp-Source: AK7set9SbpiNCtT5Bu/YFGwhpd/OImP2SC1fW1w2Pjpy8utXilwnFH7Qw//TyEQfQYfv5mXgwr/czA== X-Received: by 2002:a05:6870:20e:b0:163:595e:3655 with SMTP id j14-20020a056870020e00b00163595e3655mr12008494oad.12.1678316976311; Wed, 08 Mar 2023 15:09:36 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id s6-20020a056870ea8600b0016e49af5815sm6716829oap.51.2023.03.08.15.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:36 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] soc: samsung: pm_domains: Extract DT handling into a separate function Date: Wed, 8 Mar 2023 17:09:28 -0600 Message-Id: <20230308230931.27261-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org As DT parsing code tends to grow with time, make it a separate routine. While at it, replace kstrdup_const() with devm_kstrdup_const() in order to avoid manual memory management and simplify the error path. Signed-off-by: Sam Protsenko --- drivers/soc/samsung/pm_domains.c | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index d07f3c9d6903..522a43005a5a 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -27,6 +27,7 @@ struct exynos_pm_domain_config { * Exynos specific wrapper around the generic power domain */ struct exynos_pm_domain { + struct device *dev; void __iomem *base; struct generic_pm_domain pd; u32 local_pwr_cfg; @@ -91,42 +92,48 @@ static const struct of_device_id exynos_pm_domain_of_match[] = { { }, }; -static const char *exynos_get_domain_name(struct device_node *node) +static int exynos_pd_parse_dt(struct exynos_pm_domain *pd) { + const struct exynos_pm_domain_config *variant; + struct device *dev = pd->dev; + struct device_node *np = dev->of_node; const char *name; - if (of_property_read_string(node, "label", &name) < 0) - name = kbasename(node->full_name); - return kstrdup_const(name, GFP_KERNEL); + variant = of_device_get_match_data(dev); + pd->local_pwr_cfg = variant->local_pwr_cfg; + + if (of_property_read_string(np, "label", &name) < 0) + name = kbasename(np->full_name); + pd->pd.name = devm_kstrdup_const(dev, name, GFP_KERNEL); + if (!pd->pd.name) + return -ENOMEM; + + pd->base = of_iomap(np, 0); + if (!pd->base) + return -ENODEV; + + return 0; } static int exynos_pd_probe(struct platform_device *pdev) { - const struct exynos_pm_domain_config *pm_domain_cfg; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct of_phandle_args child, parent; struct exynos_pm_domain *pd; int on, ret; - pm_domain_cfg = of_device_get_match_data(dev); pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); if (!pd) return -ENOMEM; - pd->pd.name = exynos_get_domain_name(np); - if (!pd->pd.name) - return -ENOMEM; - - pd->base = of_iomap(np, 0); - if (!pd->base) { - kfree_const(pd->pd.name); - return -ENODEV; - } + pd->dev = dev; + ret = exynos_pd_parse_dt(pd); + if (ret) + return ret; pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; - pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg; on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg; From patchwork Wed Mar 8 23:09:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 660932 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15FB5C74A44 for ; Wed, 8 Mar 2023 23:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbjCHXKU (ORCPT ); Wed, 8 Mar 2023 18:10:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjCHXJn (ORCPT ); Wed, 8 Mar 2023 18:09:43 -0500 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D82F773032 for ; Wed, 8 Mar 2023 15:09:39 -0800 (PST) Received: by mail-oi1-x22b.google.com with SMTP id bk32so304640oib.10 for ; Wed, 08 Mar 2023 15:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316979; 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=PcyN6J8psmsD0AipK3PVomDiouRZnU8VIxAcqRxXEto=; b=q3IlJ0PtdTA2WKmAG1d3tU8qg7pF582NBzTvvAggce9S3FSEvf8Gz1eSbYK8GaLQnn 6L2l9Sf3hNlSlEip7YSk0h/xcJl+Ed7vho0cOw6r7pTJBDMwPj18FOSbZDbSMGgx6VGu RfpZTkv8DVSB82/Own1gEy/I1RlVGgYO6k9+mn+kdO5UJMSgL7tSBwUsfV+9OI+WMrEy mRfk0RAD/el8kQzsmmsXmjXPj3YV5Iy7eE+rEN3xqqqKeRL9XgsSHMn8wooKY7iXKRbY XSLksVHSnubrHoKQmQO/yhDHgAuLvhlUBANYUW53lOO+bskC5Op3QxwZY4WFty3woN9C IQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316979; 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=PcyN6J8psmsD0AipK3PVomDiouRZnU8VIxAcqRxXEto=; b=e1U1WHhJ6hsQHlpO4l402XbcPOC9vEbnGPOnmEnj7J6C0BAvDT9fxVV6W4agR6TW9T R6nSZLC3Q5r3Mw4ZU/lgZxtyJdZX5jWlhqZFRIW47OC+dqOvoH44RWZNlRQkh4zG/egL O+t3lgI9v1tWoYS4luENSQxCX8qQWTbdIqAy1P2b51W9gQCsC/DjsKo+upmiKO8lZtRo ntQ0d6wg4SvMmAuAJRA4tS7DF00HgKIQE/wFzQhnqB5kUMtvHDSeO9lEGXN+F2l6EMIQ 21FERUVVhv6uprvFQnSYvUQ5k3EXualacK2tj+Qv7ibuzgW1ruZVuqOqa8WmnsqM7PVQ YPNw== X-Gm-Message-State: AO0yUKVDQS76v7Alev+iD69xb9zPOfpTzbxRawrjPkGgx5tnkEgXmtfq CrVyj/WNhbpjKYdWyXf2pE9k5Q== X-Google-Smtp-Source: AK7set96vUGZQ9x3seGiIj9aPGfeXEqlsBW10Gzyw7TR94eZbEmXWAiaUl8btBnUMn29SmszXEwL6g== X-Received: by 2002:aca:240c:0:b0:384:349a:15ef with SMTP id n12-20020aca240c000000b00384349a15efmr9062265oic.36.1678316977577; Wed, 08 Mar 2023 15:09:37 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id g10-20020a9d618a000000b006864c8043e0sm6969520otk.61.2023.03.08.15.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:37 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] soc: samsung: pm_domains: Implement proper I/O operations Date: Wed, 8 Mar 2023 17:09:29 -0600 Message-Id: <20230308230931.27261-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Instead of doing in-place readl()/writel() calls fed with magic numbers, provide dedicated read/write functions which implement proper register accesses: - Get rid of magic numbers by introducing actual constants for PD registers - Rework the write function to perform a RMW operation, as PD registers have some bits markes as "Reserved" in TRM, which shouldn't be changed - Add helper functions for reading the STATUS reg and writing CONFIGURATION reg, to make user code more neat and clean New functions are designed in such a way that it's easy to rework those further on top of regmap API. Signed-off-by: Sam Protsenko --- drivers/soc/samsung/pm_domains.c | 42 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index 522a43005a5a..dd1ec3541e11 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -18,6 +18,10 @@ #include #include +/* Register offsets inside Power Domain area in PMU */ +#define EXYNOS_PD_CONF 0x0 +#define EXYNOS_PD_STATUS 0x4 + struct exynos_pm_domain_config { /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */ u32 local_pwr_cfg; @@ -33,6 +37,37 @@ struct exynos_pm_domain { u32 local_pwr_cfg; }; +static void exynos_pd_write(struct exynos_pm_domain *pd, unsigned int reg, + unsigned int mask, unsigned int val) +{ + u32 v; + + v = readl_relaxed(pd->base + reg); + v = (v & ~mask) | val; + writel_relaxed(v, pd->base + reg); +} + +static void exynos_pd_read(struct exynos_pm_domain *pd, unsigned int reg, + unsigned int *val) +{ + *val = readl_relaxed(pd->base + reg); +} + +static unsigned int exynos_pd_read_status(struct exynos_pm_domain *pd) +{ + unsigned int val; + + exynos_pd_read(pd, EXYNOS_PD_STATUS, &val); + val &= pd->local_pwr_cfg; + + return val; +} + +static void exynos_pd_write_conf(struct exynos_pm_domain *pd, u32 val) +{ + exynos_pd_write(pd, EXYNOS_PD_CONF, pd->local_pwr_cfg, val); +} + static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) { struct exynos_pm_domain *pd; @@ -44,12 +79,12 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) base = pd->base; pwr = power_on ? pd->local_pwr_cfg : 0; - writel_relaxed(pwr, base); + exynos_pd_write_conf(pd, pwr); /* Wait max 1ms */ timeout = 10; - while ((readl_relaxed(base + 0x4) & pd->local_pwr_cfg) != pwr) { + while (exynos_pd_read_status(pd) != pwr) { if (!timeout) { op = (power_on) ? "enable" : "disable"; pr_err("Power domain %s %s failed\n", domain->name, op); @@ -135,8 +170,7 @@ static int exynos_pd_probe(struct platform_device *pdev) pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; - on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg; - + on = exynos_pd_read_status(pd); pm_genpd_init(&pd->pd, NULL, !on); ret = of_genpd_add_provider_simple(np, &pd->pd); From patchwork Wed Mar 8 23:09:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 660933 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD6D4C678D5 for ; Wed, 8 Mar 2023 23:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbjCHXJo (ORCPT ); Wed, 8 Mar 2023 18:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjCHXJl (ORCPT ); Wed, 8 Mar 2023 18:09:41 -0500 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6BFA6F60D for ; Wed, 8 Mar 2023 15:09:39 -0800 (PST) Received: by mail-oo1-xc33.google.com with SMTP id o19-20020a056820041300b005259de79accso22771oou.9 for ; Wed, 08 Mar 2023 15:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316979; 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=vEY2uA2o2oPbWjPX8guKf4jPFyrDqDNeEX5TBL2/D90=; b=j6kAa0wPCPa7yN1ZIU3m6I1acUcTN9xge5yJvWmt5R58739PeZyQDvykgJ2PNvk5oE Ca3l8dybpeMnDf11qoqQEH0L5uHd0PVAQOjKKbnPrdBVUjaPayhpl9ni3ZkuwvWPZRt9 VTxJjn3jd0L9M/R/rI7ML0V7h9TLwvDIEvxs4jevQK+0d0WvBy4OIyRggInkDeRJ/uq8 mmSxX1UQKKxKmVnDHwq+uRzykwyy4fl0uOiMFutoyDxemoL/eSmmn1+uxLbG+7A1Ey4E 9lQqBddbKl96/521JETtnFyEDRt04svDU4akF3CI16xjwSR498CqRevfaxRmlJ5WZEku liXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316979; 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=vEY2uA2o2oPbWjPX8guKf4jPFyrDqDNeEX5TBL2/D90=; b=BbFIeyEqNRghRQ/oUgs+ywIT/z+Bz7IHacwZSKLLpk3MrFUaO7P9loou5cZ+0/CRfA dB7M/2h5jigk7NAkBJz42SljWszuNULsBjimaxaXGK9sC05RDqbGjynWNRagAGkbN/OG UpUeo9mNqmVa+zADOSPPJFfBqViN+VYR3aHu02ftCk9b2A/UlfckZSzr4MTtbpNkg57s S5VYxMJreN2eF0TqcSMa1mO3EfBg/GrOUNPfdZWFZxUZAoGZsq3sDxzzXd/nJBe/Bamm a987aOUjTMC82bftrKCamuLLASYdWVycNME0QQtVgSkGGuZV+f6SL4Ey3JKOVYB0w5QN rZUg== X-Gm-Message-State: AO0yUKVKIJxJeFQibmMCPW6jwveL2rwVcRxC6s06feULA+EQDZQybV/w ObD+6jilNYJbYlyEjNs91JGKMw== X-Google-Smtp-Source: AK7set88QmQlJhM0W50tNT2+6aJVp6JPQ62Z1IozArM9BOkPuX7PtZUWUiN/ybmikpNvxg2vWqeETQ== X-Received: by 2002:a4a:8007:0:b0:525:25f1:af68 with SMTP id x7-20020a4a8007000000b0052525f1af68mr7533432oof.3.1678316978837; Wed, 08 Mar 2023 15:09:38 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id x8-20020a9d4588000000b00690e21a46e1sm6952404ote.56.2023.03.08.15.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:38 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] soc: samsung: pm_domains: Allow PD to be a child of PMU syscon Date: Wed, 8 Mar 2023 17:09:30 -0600 Message-Id: <20230308230931.27261-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Power Domains registers are a part of the PMU area in Exynos SoCs. The PMU area is shared between multiple users (like WDT driver, reset driver, PD driver, etc), and it's usually already implemented as a system controller in the SoC device tree. Make it possible for a PD node to be a child of that PMU syscon and utilize its shared regmap instance in PD driver to access the PMU area registers. When a PD node is a child of PMU, the "samsung,pd-index" DT property is used to specify the particular power domain (instead of providing base address in "reg" property). Implement the support for that index property, so that the driver can look up corresponding register offsets by that index, if the property is present. But also keep the compatibility with existing device trees where the index property is not defined in PD nodes and which rely on raw read/write access to the PMU registers. Signed-off-by: Sam Protsenko --- drivers/soc/samsung/Kconfig | 1 + drivers/soc/samsung/pm_domains.c | 49 ++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index 7a8f291e7704..dfe7a973b272 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -51,6 +51,7 @@ config EXYNOS_PMU_ARM_DRIVERS config EXYNOS_PM_DOMAINS bool "Exynos PM domains" if COMPILE_TEST depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST + select MFD_SYSCON config SAMSUNG_PM_CHECK bool "S3C2410 PM Suspend Memory CRC" diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index dd1ec3541e11..ec630a151247 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include /* Register offsets inside Power Domain area in PMU */ #define EXYNOS_PD_CONF 0x0 @@ -25,6 +27,10 @@ struct exynos_pm_domain_config { /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */ u32 local_pwr_cfg; + + /* Power domain offsets in PMU area, for each power domain index */ + const unsigned int *pd_offsets; + size_t pd_offsets_num; }; /* @@ -35,22 +41,32 @@ struct exynos_pm_domain { void __iomem *base; struct generic_pm_domain pd; u32 local_pwr_cfg; + + unsigned int offset; + struct regmap *pmureg; }; static void exynos_pd_write(struct exynos_pm_domain *pd, unsigned int reg, unsigned int mask, unsigned int val) { - u32 v; - - v = readl_relaxed(pd->base + reg); - v = (v & ~mask) | val; - writel_relaxed(v, pd->base + reg); + if (pd->pmureg) { + regmap_update_bits(pd->pmureg, pd->offset + reg, mask, val); + } else { + u32 v; + + v = readl_relaxed(pd->base + reg); + v = (v & ~mask) | val; + writel_relaxed(v, pd->base + reg); + } } static void exynos_pd_read(struct exynos_pm_domain *pd, unsigned int reg, unsigned int *val) { - *val = readl_relaxed(pd->base + reg); + if (pd->pmureg) + regmap_read(pd->pmureg, pd->offset + reg, val); + else + *val = readl_relaxed(pd->base + reg); } static unsigned int exynos_pd_read_status(struct exynos_pm_domain *pd) @@ -133,6 +149,8 @@ static int exynos_pd_parse_dt(struct exynos_pm_domain *pd) struct device *dev = pd->dev; struct device_node *np = dev->of_node; const char *name; + u32 index; + int ret; variant = of_device_get_match_data(dev); pd->local_pwr_cfg = variant->local_pwr_cfg; @@ -143,9 +161,22 @@ static int exynos_pd_parse_dt(struct exynos_pm_domain *pd) if (!pd->pd.name) return -ENOMEM; - pd->base = of_iomap(np, 0); - if (!pd->base) - return -ENODEV; + ret = of_property_read_u32(np, "samsung,pd-index", &index); + if (!ret) { + if (index >= variant->pd_offsets_num) + return -EINVAL; + if (!dev->parent) + return -ENODEV; + + pd->offset = variant->pd_offsets[index]; + pd->pmureg = syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(pd->pmureg)) + return PTR_ERR(pd->pmureg); + } else { + pd->base = of_iomap(np, 0); + if (!pd->base) + return -ENODEV; + } return 0; } From patchwork Wed Mar 8 23:09:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 661447 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3A7FC6FD19 for ; Wed, 8 Mar 2023 23:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbjCHXKU (ORCPT ); Wed, 8 Mar 2023 18:10:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbjCHXJn (ORCPT ); Wed, 8 Mar 2023 18:09:43 -0500 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4E564218 for ; Wed, 8 Mar 2023 15:09:40 -0800 (PST) Received: by mail-ot1-x329.google.com with SMTP id o4-20020a9d6d04000000b00694127788f4so102329otp.6 for ; Wed, 08 Mar 2023 15:09:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678316980; 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=LqP7runz9fYVY1TUY6ik+MRNc/PM8+/25wcHDRNrCqg=; b=pMeJTUMMw8Ia7l1IPPUUsdvR7xspLZEDohgXXQH/vDj7exFL9MWOAAnxhMUHw9xEi9 q+EoBXK+9I748gNWpHzqG0R6Ara+yLGh1qbSF6lHBdxZT96b3l8MUa242OxPTQMV7xLg hQAO9hP8fvXLArgDEj6X/R7pw+WSgtBmchw/srR0PH0Ft+wypT5hIfZV9XqBF0c+KCLh kgInsvI7lf7pAiTiq8Fq0MFNkk+c2PfgzSbLju3iffONoUCZBqJWLlkBW1OlXYT+64/b JKK/cmWqYLctN66VueXT93bhwZC4VpTjIzoAhyRuG897cU84E4eWNfSe6pHN6KJ7ISLg nPwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678316980; 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=LqP7runz9fYVY1TUY6ik+MRNc/PM8+/25wcHDRNrCqg=; b=ZXUC3Qrn953/g5IB5TQy9wkrlS43151hLVqVawGxNJm7yjzQMoGVnxi4N4UzBzusNq 2EGUx72bF1c79Rqj2fqF8eQREEnhRiSaCCmjF+mV0tY4XXlFRMdZhOXPQEsvxqoUmZU4 oHy4Z6irefJpII/+WN7ud1ubqSO9ufESOoVvgitLiohB5ozL4bjumUKdmzLUqeh3j9xp bsCuNWKCxTcDYX9JSK1nUd1ShZPKKNgIWYDR3wyv/3j8tYJE0EY+9z6MduLz2w2UOAOR s3BCoOTwNmaOMHDHuAA0RU+YhMCdBs9LZrQAKWjaOQ4OFlDXn79pq5+/RsBAs2h2TmnV gNpQ== X-Gm-Message-State: AO0yUKVmM88jxRKemOLkKikBtQRxrflh/BQQTDsMQGiuxhH4Yd+pcmWb BnW77bRuZOVV42ZeWprl6uTJRg== X-Google-Smtp-Source: AK7set/tBJXhTZUXyy437vmJNBgUKb2EX1mJ5MLUT6s+oNNf/7TzTYa0XXmwK2tWKREM5hmGZM2/cQ== X-Received: by 2002:a05:6830:3142:b0:68b:e4e6:cc9c with SMTP id c2-20020a056830314200b0068be4e6cc9cmr11426374ots.33.1678316980169; Wed, 08 Mar 2023 15:09:40 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id z25-20020a056830129900b00686574e98d6sm6919220otp.72.2023.03.08.15.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 15:09:39 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Alim Akhtar , Marek Szyprowski , Chanwoo Choi , Chanho Park , David Virag , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] soc: samsung: pm_domains: Add Exynos850 support Date: Wed, 8 Mar 2023 17:09:31 -0600 Message-Id: <20230308230931.27261-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308230931.27261-1-semen.protsenko@linaro.org> References: <20230308230931.27261-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add a new compatible string for Exynos850, providing all HW specific data, which enables Exynos PD support for this chip. Signed-off-by: Sam Protsenko --- drivers/soc/samsung/pm_domains.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index ec630a151247..795d8a9cd4b5 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -20,6 +20,8 @@ #include #include +#include + /* Register offsets inside Power Domain area in PMU */ #define EXYNOS_PD_CONF 0x0 #define EXYNOS_PD_STATUS 0x4 @@ -132,6 +134,21 @@ static const struct exynos_pm_domain_config exynos5433_cfg = { .local_pwr_cfg = 0xf, }; +static const unsigned int exynos850_pd_offsets[] = { + [EXYNOS850_PD_HSI] = 0x1c80, + [EXYNOS850_PD_G3D] = 0x1d00, + [EXYNOS850_PD_MFCMSCL] = 0x1d80, + [EXYNOS850_PD_DPU] = 0x2000, + [EXYNOS850_PD_AUD] = 0x2080, + [EXYNOS850_PD_IS] = 0x2100, +}; + +static const struct exynos_pm_domain_config exynos850_cfg = { + .local_pwr_cfg = 0x1, + .pd_offsets = exynos850_pd_offsets, + .pd_offsets_num = ARRAY_SIZE(exynos850_pd_offsets), +}; + static const struct of_device_id exynos_pm_domain_of_match[] = { { .compatible = "samsung,exynos4210-pd", @@ -139,6 +156,9 @@ static const struct of_device_id exynos_pm_domain_of_match[] = { }, { .compatible = "samsung,exynos5433-pd", .data = &exynos5433_cfg, + }, { + .compatible = "samsung,exynos850-pd", + .data = &exynos850_cfg, }, { }, };