From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 47D5B369963 for ; Thu, 16 Oct 2025 15:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760630336; cv=none; b=PlDxh9CQwbBs89GeWo8Q139dzur9WFCpI7SVWsLfCweG6RFYr5FEhwEXyIyHuo1Ms81DvTkauNcqwNI9c1X6Iq1bhdMmjAVh0rlFV+rHb/kUWocTJyprUpc8dGC0GEe5RL1XnQAwbKbKr0DjWDDAfrpXWLuBYZ4s9O+EBnUdab4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760630336; c=relaxed/simple; bh=/ffMxuodyntRU0TJwCLIfgdiy8tvJ3D6CLikLFYkO/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oMMOOY9CG3yTHO5Et2sGFpmmiY7ZnKo4yYWoZgIeZUAuN3Nk4Atep9eHGpymXZK7U1v+jmQoqWZaCnwg3g9yB0nKjJ108wMEcgNaDZHDdrgfiG1L8xUvXkwR5gHEevmc9RPqUPSCQou1cxXUVUG7YHE7LQOH76l5PTlgjTCOBnk= 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=iFtD4zJB; arc=none smtp.client-ip=209.85.208.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iFtD4zJB" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-63bad3cd668so1714326a12.3 for ; Thu, 16 Oct 2025 08:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760630332; x=1761235132; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4DqQ6MoGys1zapyNUJpLRuxdOB+fSzbQVKEkSbvrKC4=; b=iFtD4zJBDE4EjW+2cTWPAgc02LwhOH+o7DOSuK2VA0Xggja7MlzamKSyHLdTYKpzOO aP2Bn9LyadytRRPJuF4A4V4H0ZGWvBejqumysnUmiS2HzzlCHmK+sESOT6Vnp3rXu1Uz IZcjFY488xnl1pnlk0l8catogL2GurjI54+npd4BGqA5KFiNNDLSCpeZzSFPFXm5GSPB AkdXjmpWl1POriJb7nVQXJbHL7Tg/+HSqaTdjhyV8hJ6MFZRIJKFph+wrMByzWTGTAQa hqeraFg3D29mwI14enlQwRaD0BU2phbKKTSfvfzqPv3M9NPtzcJLVPz6bkbmvCgl2e18 w/5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760630332; x=1761235132; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4DqQ6MoGys1zapyNUJpLRuxdOB+fSzbQVKEkSbvrKC4=; b=a/NzNpCnS1XbOyESSREWIwdynlpdsiLmVUIEJCVsvT6k0hvsDLcgSxPH7V549n1LGY q9/Eh06smzDazoQKB2VK2H9yAK5L2JCP2gU5wrQKtPan6bM9BOEJnkijDrNaIMK5D35I 68ZnJHnw7pe1Z0lMQ77l5Afbeff+QUKNz150ihaYEWslJ8qV7cBTG+rp24jZosENo6ez ji3InMrd56AT74+eZ9KJvRQpY7HfCnM/GC9xcsPgIwpLZ9VG+aglNZceREeYpj2G9a0W a3E1K5AAZbNT338OkdYP93PJShe6vjk/r35SMvpXC6gNt9U69yH350yf8FRpn0tJO3Nx +8ww== X-Forwarded-Encrypted: i=1; AJvYcCVDQtoDm89suDb3/ezSKOwJBjQ0YerudR7keJbvOW7ZRSjmOkPEvBM/NkcYwhZpb+WSIZ+B1nCvJUF/@vger.kernel.org X-Gm-Message-State: AOJu0YxxRVLFAV5eML2kv+61eRj/eYYJGGM/iNjJZDWKNi3Tsx8AX9nY NlO87Zd7xHyCH8UKs6huiZH6J+mO0DiVcnhXTNE1nzTi0K30CCKLT9QoOZBh/DvLWiA= X-Gm-Gg: ASbGnctcLcV/DcCvsaQxCWxt178LcTNZP1Pc54exmPyv54Zr2qgfkUc2duO3AKg8SIO hyJyNb7AAhj8n43nro5OgyX1LAH6m2hHODwZBcEbiMXJ6Fo67uZFPxhUd3WcILURoeLrzwsgCW3 DWHamphRyzyo23MkMxMi+QeJxvd05o81Aa8XtU8WCn41n/hglnZtfVHRwYO87TID0N9ZivzVCMe UWEmCeRJ/XOlWTk5CxS2MDxoTMFIXCROTURPb1kyaaHF8DoJL794ZnUUadystLk67DciEE4FbtV OYDu2TW8OPPbofiHp5gPmj+USAi6FLMvQ9NqC+5Kd3naKGcdvC0ZLJA8WchxUwca7uD46Imx7su 1F7ufdmus66O3UbNaTyHJtthLpMeq5aq2ZyBRQQ65T4HNER8ySD79FbtTN5GwUwQH1KI2DXE/F5 RNC/LW3Tmh/74vryNRMfCwD8IOcDWzhr4DA0T2gJf6IuunkBDW1n7alMpd3DJmU97h1FZ26Ks3d UlSaT/yqg== X-Google-Smtp-Source: AGHT+IGbtiixleiqyswoz3qLTql2jI01A11bbfMUkIlJUu938gTSGbLcf+e3VcOx41cjcQhTYXkCpw== X-Received: by 2002:a17:907:3daa:b0:b5c:6a00:f8da with SMTP id a640c23a62f3a-b6472d5bbf5mr53175666b.1.1760630331578; Thu, 16 Oct 2025 08:58:51 -0700 (PDT) Received: from puffmais2.c.googlers.com (254.48.34.34.bc.googleusercontent.com. [34.34.48.254]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b5ccccb4811sm549021666b.56.2025.10.16.08.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Oct 2025 08:58:51 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 16 Oct 2025 16:58:42 +0100 Subject: [PATCH v3 09/10] pmdomain: samsung: add support for google,gs101-pd Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20251016-gs101-pd-v3-9-7b30797396e7@linaro.org> References: <20251016-gs101-pd-v3-0-7b30797396e7@linaro.org> In-Reply-To: <20251016-gs101-pd-v3-0-7b30797396e7@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Ulf Hansson , Marek Szyprowski Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 On Google gs101, direct mmio register access to the PMU registers doesn't work and access must happen via a (syscon) regmap created by the PMU driver instead. Try to obtain this regmap using the parent node in DT in case this PD is a child of the PMU and fall back to the traditional direct mmio regmap otherwise. Additionally, the status is just one bit on gs101. Signed-off-by: AndrĂ© Draszik --- drivers/pmdomain/samsung/exynos-pm-domains.c | 65 +++++++++++++++++++--------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c index 15a1582aa92103a07335eb681600d9415369fefd..a7e55624728a62545eac049c9a51012a229f44c2 100644 --- a/drivers/pmdomain/samsung/exynos-pm-domains.c +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -78,8 +79,15 @@ static const struct exynos_pm_domain_config exynos5433_cfg = { .need_early_sync_state = true, }; +static const struct exynos_pm_domain_config gs101_cfg = { + .local_pwr_cfg = BIT(0), +}; + static const struct of_device_id exynos_pm_domain_of_match[] = { { + .compatible = "google,gs101-pd", + .data = &gs101_cfg, + }, { .compatible = "samsung,exynos4210-pd", .data = &exynos4210_cfg, }, { @@ -107,17 +115,9 @@ static int exynos_pd_probe(struct platform_device *pdev) struct of_phandle_args child, parent; struct exynos_pm_domain *pd; struct resource *res; - void __iomem *base; unsigned int val; int on, ret; - struct regmap_config reg_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - .use_relaxed_mmio = true, - }; - pm_domain_cfg = of_device_get_match_data(dev); pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); if (!pd) @@ -128,25 +128,50 @@ static int exynos_pd_probe(struct platform_device *pdev) return -ENOMEM; /* - * The resource typically points into the address space of the PMU. + * The resource typically points into the address space of the PMU and + * we have to consider two cases: + * 1) some implementations require a custom syscon regmap + * 2) this driver might map the same addresses as the PMU driver * Therefore, avoid using devm_platform_get_and_ioremap_resource() and - * instead use platform_get_resource() and devm_ioremap() to avoid + * instead use platform_get_resource() here, and below for case 1) use + * syscon_node_to_regmap() while for case 2) use devm_ioremap() to avoid * conflicts due to address space overlap. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return dev_err_probe(dev, -ENXIO, "missing IO resources"); - base = devm_ioremap(dev, res->start, resource_size(res)); - if (!base) - return dev_err_probe(dev, -ENOMEM, - "failed to ioremap PMU registers"); - - reg_config.max_register = resource_size(res) - reg_config.reg_stride; - pd->regmap = devm_regmap_init_mmio(dev, base, ®_config); - if (IS_ERR(pd->regmap)) - return dev_err_probe(dev, PTR_ERR(base), - "failed to init regmap"); + if (dev->parent && + of_device_is_compatible(dev->parent->of_node, "syscon")) { + pd->regmap = syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(pd->regmap)) + return dev_err_probe(dev, PTR_ERR(pd->regmap), + "failed to acquire PMU regmap"); + + pd->configuration_reg = res->start; + pd->status_reg = res->start; + } else { + void __iomem *base; + + const struct regmap_config reg_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .use_relaxed_mmio = true, + .max_register = (resource_size(res) + - reg_config.reg_stride), + }; + + base = devm_ioremap(dev, res->start, resource_size(res)); + if (!base) + return dev_err_probe(dev, -ENOMEM, + "failed to ioremap PMU registers"); + + pd->regmap = devm_regmap_init_mmio(dev, base, ®_config); + if (IS_ERR(pd->regmap)) + return dev_err_probe(dev, PTR_ERR(base), + "failed to init regmap"); + } pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; -- 2.51.0.788.g6d19910ace-goog