From nobody Thu Oct 9 08:51:58 2025 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C491295D90 for ; Wed, 18 Jun 2025 10:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242151; cv=none; b=ptZxh/v/57j/r9AUwRZh9TRtSWQUBteMaDV8Wyp/AWH0GVjgi8BQuwqgjKLHeWG94MAwXjhoBKGz+16f3pY5mbefUArGt9irG6wziQZGCmXiT0IJ7/LmbtjQhfvJWEwP7CAS/Rb/UMleOaDEG0OpZ39F/IvHvmknTn1I0IKr7NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242151; c=relaxed/simple; bh=fYNXlCNwyuEbQScQsevuxONnVgNTSbpGFdxOc7K6chA=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=IUD34ptOG/JM5gzljaW3ECigeJBhbObumwXiKdESFIcNRV1+etlaBCaLikFcqvvjPFcc/b2zUrf5yc3cdHB6a+0d1RUTH1QpSGBmW85iipN3Zx1wiEfujlYMa+JNnh6ay4Utcr+eBlgEK5i8UcwlM+9ZAolSswO8HIPTEBL13t8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=NHiRQYL4; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="NHiRQYL4" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102226euoutp016f7bbacdc74bbac6c62b04b9f8e21f9e~KG-WfN5lv1751217512euoutp01T for ; Wed, 18 Jun 2025 10:22:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20250618102226euoutp016f7bbacdc74bbac6c62b04b9f8e21f9e~KG-WfN5lv1751217512euoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242146; bh=/67mCK0ZSXmBOeW8Mw1yKpyFad/acxv6px4aOh27e+Q=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=NHiRQYL4ryJm4IZhvqgK7h+Kat6C/Ek980MM8SSJ0lw38FVJ21iKpAoZjQ+WtZyqW NMo9Ot4S5zF19scoKZdUyiOjg/vbyeSb+NtK3azkCCyi+GVR7/WKkTZ6Spi6z4l/51 BHaA5361l5OLznnpcHKdVYPW8ou30HRmClTErRZc= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250618102226eucas1p112dacf9670f68b4a8581aa1a8b5ced9d~KG-V4i4TB2808928089eucas1p1p; Wed, 18 Jun 2025 10:22:26 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102225eusmtip1192586a6509e599e9452f2079923d4e3~KG-U6t27r1353913539eusmtip1Z; Wed, 18 Jun 2025 10:22:25 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:07 +0200 Subject: [PATCH v5 1/8] power: sequencing: Add T-HEAD TH1520 GPU power sequencer driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-1-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102226eucas1p112dacf9670f68b4a8581aa1a8b5ced9d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102226eucas1p112dacf9670f68b4a8581aa1a8b5ced9d X-EPHeader: CA X-CMS-RootMailID: 20250618102226eucas1p112dacf9670f68b4a8581aa1a8b5ced9d References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Introduce the pwrseq-thead-gpu driver, a power sequencer provider for the Imagination BXM-4-64 GPU on the T-HEAD TH1520 SoC. This driver controls an auxiliary device instantiated by the AON power domain. The TH1520 GPU requires a specific sequence to correctly initialize and power down its resources: - Enable GPU clocks (core and sys). - De-assert the GPU clock generator reset (clkgen_reset). - Introduce a short hardware-required delay. - De-assert the GPU core reset. The power-down sequence performs these steps in reverse. Implement this sequence via the pwrseq_power_on and pwrseq_power_off callbacks. Crucially, the driver's match function is called when a consumer (the Imagination GPU driver) requests the "gpu-power" target. During this match, the sequencer uses clk_bulk_get() and reset_control_get_exclusive() on the consumer's device to obtain handles to the GPU's "core" and "sys" clocks, and the GPU core reset. These, along with clkgen_reset obtained from parent aon node, allow it to perform the complete sequence. Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski --- MAINTAINERS | 1 + drivers/power/sequencing/Kconfig | 8 + drivers/power/sequencing/Makefile | 1 + drivers/power/sequencing/pwrseq-thead-gpu.c | 231 ++++++++++++++++++++++++= ++++ 4 files changed, 241 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0183c028fa18c397d30ec82fd419894f1f50a448..3283ff592215249bcf702dbb4ab= 710477243477e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21395,6 +21395,7 @@ F: drivers/mailbox/mailbox-th1520.c F: drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c F: drivers/pinctrl/pinctrl-th1520.c F: drivers/pmdomain/thead/ +F: drivers/power/sequencing/pwrseq-thead-gpu.c F: drivers/reset/reset-th1520.c F: include/dt-bindings/clock/thead,th1520-clk-ap.h F: include/dt-bindings/power/thead,th1520-power.h diff --git a/drivers/power/sequencing/Kconfig b/drivers/power/sequencing/Kc= onfig index ddcc42a984921c55667c46ac586d259625e1f1a7..7fa912c9af2479cdce909467c29= fe335788f0bd7 100644 --- a/drivers/power/sequencing/Kconfig +++ b/drivers/power/sequencing/Kconfig @@ -27,4 +27,12 @@ config POWER_SEQUENCING_QCOM_WCN this driver is needed for correct power control or else we'd risk not respecting the required delays between enabling Bluetooth and WLAN. =20 +config POWER_SEQUENCING_THEAD_GPU + tristate "T-HEAD TH1520 GPU power sequencing driver" + depends on ARCH_THEAD && AUXILIARY_BUS + help + Say Y here to enable the power sequencing driver for the TH1520 SoC + GPU. This driver handles the complex clock and reset sequence + required to power on the Imagination BXM GPU on this platform. + endif diff --git a/drivers/power/sequencing/Makefile b/drivers/power/sequencing/M= akefile index 2eec2df7912d11827f9ba914177dd2c882e44bce..647f81f4013ab825630f069d2e0= f6d22159f1f56 100644 --- a/drivers/power/sequencing/Makefile +++ b/drivers/power/sequencing/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_POWER_SEQUENCING) +=3D pwrseq-core.o pwrseq-core-y :=3D core.o =20 obj-$(CONFIG_POWER_SEQUENCING_QCOM_WCN) +=3D pwrseq-qcom-wcn.o +obj-$(CONFIG_POWER_SEQUENCING_THEAD_GPU) +=3D pwrseq-thead-gpu.o diff --git a/drivers/power/sequencing/pwrseq-thead-gpu.c b/drivers/power/se= quencing/pwrseq-thead-gpu.c new file mode 100644 index 0000000000000000000000000000000000000000..31283d23d8bdec2e0ee3b5c573e= 8921b98ee0adb --- /dev/null +++ b/drivers/power/sequencing/pwrseq-thead-gpu.c @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * T-HEAD TH1520 GPU Power Sequencer Driver + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd. + * Author: Michal Wilczynski + * + * This driver implements the power sequence for the Imagination BXM-4-64 + * GPU on the T-HEAD TH1520 SoC. The sequence requires coordinating resour= ces + * from both the sequencer's parent device node (clkgen_reset) and the GPU= 's + * device node (clocks and core reset). + * + * The `match` function is used to acquire the GPU's resources when the + * GPU driver requests the "gpu-power" sequence target. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct pwrseq_thead_gpu_ctx { + struct pwrseq_device *pwrseq; + struct reset_control *clkgen_reset; + struct device_node *aon_node; + + /* Consumer resources */ + struct clk_bulk_data *clks; + int num_clks; + struct reset_control *gpu_reset; +}; + +static int pwrseq_thead_gpu_enable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_thead_gpu_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + int ret; + + if (!ctx->clks || !ctx->gpu_reset) + return -ENODEV; + + ret =3D clk_bulk_prepare_enable(ctx->num_clks, ctx->clks); + if (ret) + return ret; + + ret =3D reset_control_deassert(ctx->clkgen_reset); + if (ret) + goto err_disable_clks; + + /* + * According to the hardware manual, a delay of at least 32 clock + * cycles is required between de-asserting the clkgen reset and + * de-asserting the GPU reset. Assuming a worst-case scenario with + * a very high GPU clock frequency, a delay of 1 microsecond is + * sufficient to ensure this requirement is met across all + * feasible GPU clock speeds. + */ + udelay(1); + + ret =3D reset_control_deassert(ctx->gpu_reset); + if (ret) + goto err_assert_clkgen; + + return 0; + +err_assert_clkgen: + reset_control_assert(ctx->clkgen_reset); +err_disable_clks: + clk_bulk_disable_unprepare(ctx->num_clks, ctx->clks); + return ret; +} + +static int pwrseq_thead_gpu_disable(struct pwrseq_device *pwrseq) +{ + struct pwrseq_thead_gpu_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + + if (!ctx->clks || !ctx->gpu_reset) + return -ENODEV; + + reset_control_assert(ctx->gpu_reset); + reset_control_assert(ctx->clkgen_reset); + clk_bulk_disable_unprepare(ctx->num_clks, ctx->clks); + + return 0; +} + +static const struct pwrseq_unit_data pwrseq_thead_gpu_unit =3D { + .name =3D "gpu-power-sequence", + .enable =3D pwrseq_thead_gpu_enable, + .disable =3D pwrseq_thead_gpu_disable, +}; + +static const struct pwrseq_target_data pwrseq_thead_gpu_target =3D { + .name =3D "gpu-power", + .unit =3D &pwrseq_thead_gpu_unit, +}; + +static const struct pwrseq_target_data *pwrseq_thead_gpu_targets[] =3D { + &pwrseq_thead_gpu_target, + NULL +}; + +static int pwrseq_thead_gpu_match(struct pwrseq_device *pwrseq, + struct device *dev) +{ + struct pwrseq_thead_gpu_ctx *ctx =3D pwrseq_device_get_drvdata(pwrseq); + static const char *const clk_names[] =3D { "core", "sys" }; + struct of_phandle_args pwr_spec; + int i, ret; + + /* We only match the specific T-HEAD TH1520 GPU compatible */ + if (!of_device_is_compatible(dev->of_node, "thead,th1520-gpu")) + return 0; + + ret =3D of_parse_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells", 0, &pwr_spec); + if (ret) + return 0; + + /* Additionally verify consumer device has AON as power-domain */ + if (pwr_spec.np !=3D ctx->aon_node || pwr_spec.args[0] !=3D TH1520_GPU_PD= ) { + of_node_put(pwr_spec.np); + return 0; + } + + of_node_put(pwr_spec.np); + + if (ctx->gpu_reset || ctx->clks) + return 1; + + ctx->num_clks =3D ARRAY_SIZE(clk_names); + ctx->clks =3D kcalloc(ctx->num_clks, sizeof(*ctx->clks), GFP_KERNEL); + if (!ctx->clks) + return -ENOMEM; + + for (i =3D 0; i < ctx->num_clks; i++) + ctx->clks[i].id =3D clk_names[i]; + + ret =3D clk_bulk_get(dev, ctx->num_clks, ctx->clks); + if (ret) + goto err_free_clks; + + ctx->gpu_reset =3D reset_control_get_shared(dev, NULL); + if (IS_ERR(ctx->gpu_reset)) { + ret =3D PTR_ERR(ctx->gpu_reset); + goto err_put_clks; + } + + return 1; + +err_put_clks: + clk_bulk_put(ctx->num_clks, ctx->clks); +err_free_clks: + kfree(ctx->clks); + ctx->clks =3D NULL; + + return ret; +} + +static int pwrseq_thead_gpu_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct device *dev =3D &adev->dev; + struct device *parent_dev =3D dev->parent; + struct pwrseq_thead_gpu_ctx *ctx; + struct pwrseq_config config =3D {}; + + ctx =3D devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->aon_node =3D parent_dev->of_node; + + ctx->clkgen_reset =3D + devm_reset_control_get_exclusive(parent_dev, "gpu-clkgen"); + if (IS_ERR(ctx->clkgen_reset)) + return dev_err_probe( + dev, PTR_ERR(ctx->clkgen_reset), + "Failed to get GPU clkgen reset from parent\n"); + + config.parent =3D dev; + config.owner =3D THIS_MODULE; + config.drvdata =3D ctx; + config.match =3D pwrseq_thead_gpu_match; + config.targets =3D pwrseq_thead_gpu_targets; + + ctx->pwrseq =3D devm_pwrseq_device_register(dev, &config); + if (IS_ERR(ctx->pwrseq)) + return dev_err_probe(dev, PTR_ERR(ctx->pwrseq), + "Failed to register power sequencer\n"); + + auxiliary_set_drvdata(adev, ctx); + + return 0; +} + +static void pwrseq_thead_gpu_remove(struct auxiliary_device *adev) +{ + struct pwrseq_thead_gpu_ctx *ctx =3D auxiliary_get_drvdata(adev); + + if (ctx->gpu_reset) + reset_control_put(ctx->gpu_reset); + if (ctx->clks) { + clk_bulk_put(ctx->num_clks, ctx->clks); + kfree(ctx->clks); + } +} + +static const struct auxiliary_device_id pwrseq_thead_gpu_id_table[] =3D { + { .name =3D "th1520_pm_domains.pwrseq-gpu" }, + {}, +}; +MODULE_DEVICE_TABLE(auxiliary, pwrseq_thead_gpu_id_table); + +static struct auxiliary_driver pwrseq_thead_gpu_driver =3D { + .driver =3D { + .name =3D "pwrseq-thead-gpu", + }, + .probe =3D pwrseq_thead_gpu_probe, + .remove =3D pwrseq_thead_gpu_remove, + .id_table =3D pwrseq_thead_gpu_id_table, +}; +module_auxiliary_driver(pwrseq_thead_gpu_driver); + +MODULE_AUTHOR("Michal Wilczynski "); +MODULE_DESCRIPTION("T-HEAD TH1520 GPU power sequencer driver"); +MODULE_LICENSE("GPL"); --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03505296166 for ; Wed, 18 Jun 2025 10:22:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242151; cv=none; b=YPu5rSWCDnpWHM0tqCP+5z41AHo+mqpOJ+8I9T1eQ5bSMZgRII3sdhOOVAEv7K/cR82LIaQCPbcSnpRoO+qG6+/xkhmVR0k8PJQBeE12ZUt1HCHlFcaJE5lmytlaE3cZ/stGEbdBrHY/rzQ0GjaoX8x2aeRzkbbP6lTbTFRFXEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242151; c=relaxed/simple; bh=WRlTrsWOi/i85ebZasssiJ4ZtiiHBTtd9LezuNSNDfQ=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=dTTItHhcJJUAeHOiIw0taBXOrAz2ObvwPo1lLItMAotjXTmbwGhHeuYkDUZji3OKJ9pdAgGqUkWVIO1P6vLZetw32ZWndmUuL/YDgRKuNCWQBxJhOdowZFq07Z7QzFF619YvF3joYD6WuhMOKJjDQ3bQF+OWNF2Z96JhetxHXOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=hpYusI0q; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="hpYusI0q" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102227euoutp01d278240f6d55205e6b385bced700e76e~KG-XcIPOz1794717947euoutp01K for ; Wed, 18 Jun 2025 10:22:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20250618102227euoutp01d278240f6d55205e6b385bced700e76e~KG-XcIPOz1794717947euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242148; bh=63b01qSumkcLmIEY0xdhZ+QcRoYutlUuGjICSf4+AW0=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=hpYusI0qCOndIuRLvKCeZBjC0dnxXjV80+FYxNTKDN6s5FU3G34pYQWlP50+2A9J3 LXO+LAXkmmnEoslHpaGTdoZU3CoTg12HvhlXYMQ20mlmKKWp1+zTK8l3fe2a+/m84R 3CW94IW9i3XodpoKjEDROtKk4EPDpdxb+LryZGNU= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20250618102227eucas1p26e8968805092c3ce0ecbe84e9724a6e2~KG-W6T4lR2901029010eucas1p2W; Wed, 18 Jun 2025 10:22:27 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102226eusmtip130e43c3ee9d13c7c00906f7347907b07~KG-V8arCD1490514905eusmtip1H; Wed, 18 Jun 2025 10:22:26 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:08 +0200 Subject: [PATCH v5 2/8] dt-bindings: firmware: thead,th1520: Add resets for GPU clkgen Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-2-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102227eucas1p26e8968805092c3ce0ecbe84e9724a6e2 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102227eucas1p26e8968805092c3ce0ecbe84e9724a6e2 X-EPHeader: CA X-CMS-RootMailID: 20250618102227eucas1p26e8968805092c3ce0ecbe84e9724a6e2 References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Extend the TH1520 AON to describe the GPU clkgen reset line, required for proper GPU clock and reset sequencing. The T-HEAD TH1520 GPU requires coordinated management of two clocks (core and sys) and two resets (GPU core reset and GPU clkgen reset). Only the clkgen reset is exposed at the AON level, to support SoC specific initialization handled through a dedicated auxiliary power sequencing driver. The GPU core reset remains described in the GPU device node, as from the GPU driver's perspective, there is only a single reset line [1]. This follows upstream maintainers' recommendations [2] to abstract SoC specific details into the PM domain layer rather than exposing them to drivers directly. Link: https://lore.kernel.org/all/816db99d-7088-4c1a-af03-b9a825ac09dc@imgt= ec.com/ - [1] Link: https://lore.kernel.org/all/38d9650fc11a674c8b689d6bab937acf@kernel.o= rg/ - [2] Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski Reviewed-by: Drew Fustini Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml | 7 +++++= ++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/firmware/thead,th1520-aon.ya= ml b/Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml index bbc183200400de7aadbb21fea21911f6f4227b09..3365124c7fd4736922717bd31ca= a13272f4a4ea6 100644 --- a/Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml +++ b/Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml @@ -32,6 +32,13 @@ properties: items: - const: aon =20 + resets: + maxItems: 1 + + reset-names: + items: + - const: gpu-clkgen + "#power-domain-cells": const: 1 =20 --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8AD729ACEA for ; Wed, 18 Jun 2025 10:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242154; cv=none; b=m18hHj6NGsPvQdcN73ReFA7DlQtazRQXrmYRCszj/eQ0CrWed3OlMc28zg+FDfs68VxVd0piLtnH/x/Ky1kvsjtjk1yFywvZ7/OEtSlnREqH6KCoS+cl2vWrj97Ap83o7hpcVk0tAE/b7iY0mM3YVZjQjBqnSbAymXWqgD5eVF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242154; c=relaxed/simple; bh=OlOKEb1016tChtzQe/1JM0xl1h+O48eXY4P93Z5L2TY=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=h2UVYM7GeaaTZrPpVQ83Ae5Sse5YDcVtdTPtmO52w8yngWBWlWMuPcGYvzWDFqRaswt0dt+SccAozUoWk4lNn9tLxfmO4LnpgkXzCMWegx1yzBU9+mA70NlRctLieP/mt8Hc4XZX8ZQlCBovTKRhH20aSl1lYKgai3FAYlx8O4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=MGmjqVSP; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="MGmjqVSP" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102229euoutp02408d329c4cb0e63d599dfe381e2af76e~KG-Yb5DzM2423024230euoutp02g for ; Wed, 18 Jun 2025 10:22:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250618102229euoutp02408d329c4cb0e63d599dfe381e2af76e~KG-Yb5DzM2423024230euoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242149; bh=tFyef9Zk5foTthqWHu/oFmYdMYhqggHXZgBAaGBnWFU=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=MGmjqVSP4FIayvMOMwTgyV2A8OHTlORbdxEeX56KWV4ihe630Tjpq1LMgZxE2z6oD eoR44u8VIwHSTdHmaWI1EPIPbt2kfDF/ZDjwDjcUbCDISbrk+hTKBm3PXPcgFk6S1p u//DZJGksCAG52PKB0kHjkhyhXINMvcQxkdHCJvo= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250618102228eucas1p1906803f73cc004e68f281b2bdf871da3~KG-X8Syqe1595015950eucas1p1U; Wed, 18 Jun 2025 10:22:28 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102227eusmtip11305416c6f5b7e92a8f4c4b15a74c1b9~KG-W_GGjU1000610006eusmtip1F; Wed, 18 Jun 2025 10:22:27 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:09 +0200 Subject: [PATCH v5 3/8] pmdomain: thead: Instantiate GPU power sequencer via auxiliary bus Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-3-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102228eucas1p1906803f73cc004e68f281b2bdf871da3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102228eucas1p1906803f73cc004e68f281b2bdf871da3 X-EPHeader: CA X-CMS-RootMailID: 20250618102228eucas1p1906803f73cc004e68f281b2bdf871da3 References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> In order to support the complex power sequencing required by the TH1520 GPU, the AON power domain driver must be responsible for initiating the corresponding sequencer driver. This functionality is specific to platforms where the GPU power sequencing hardware is controlled by the AON block. Extend the AON power domain driver to check for the presence of the "gpu-clkgen" reset in its own device tree node. If the property is found, create and register a new auxiliary device. This device acts as a proxy that allows the dedicated `pwrseq-thead-gpu` auxiliary driver to bind and take control of the sequencing logic. Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski Reviewed-by: Ulf Hansson --- drivers/pmdomain/thead/Kconfig | 1 + drivers/pmdomain/thead/th1520-pm-domains.c | 51 ++++++++++++++++++++++++++= ++++ 2 files changed, 52 insertions(+) diff --git a/drivers/pmdomain/thead/Kconfig b/drivers/pmdomain/thead/Kconfig index 7d52f8374b074167d508a80fd807929c53faef12..208828e0fa0dc91256bf808b905= bea32bb84250d 100644 --- a/drivers/pmdomain/thead/Kconfig +++ b/drivers/pmdomain/thead/Kconfig @@ -4,6 +4,7 @@ config TH1520_PM_DOMAINS tristate "Support TH1520 Power Domains" depends on TH1520_AON_PROTOCOL select REGMAP_MMIO + select AUXILIARY_BUS help This driver enables power domain management for the T-HEAD TH-1520 SoC. On this SoC there are number of power domains, diff --git a/drivers/pmdomain/thead/th1520-pm-domains.c b/drivers/pmdomain/= thead/th1520-pm-domains.c index f702e20306f469aeb0ed15e54bd4f8309f28018c..9040b698e7f7f2400163841530f= ecacfb0f917bc 100644 --- a/drivers/pmdomain/thead/th1520-pm-domains.c +++ b/drivers/pmdomain/thead/th1520-pm-domains.c @@ -5,6 +5,7 @@ * Author: Michal Wilczynski */ =20 +#include #include #include #include @@ -128,6 +129,50 @@ static void th1520_pd_init_all_off(struct generic_pm_d= omain **domains, } } =20 +static void th1520_pd_pwrseq_unregister_adev(void *adev) +{ + auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); +} + +static int th1520_pd_pwrseq_gpu_init(struct device *dev) +{ + struct auxiliary_device *adev; + int ret; + + /* + * Correctly check only for the property's existence in the DT node. + * We don't need to get/claim the reset here; that is the job of + * the auxiliary driver that we are about to spawn. + */ + if (device_property_match_string(dev, "reset-names", "gpu-clkgen") < 0) + /* + * This is not an error. It simply means the optional sequencer + * is not described in the device tree. + */ + return 0; + + adev =3D devm_kzalloc(dev, sizeof(*adev), GFP_KERNEL); + if (!adev) + return -ENOMEM; + + adev->name =3D "pwrseq-gpu"; + adev->dev.parent =3D dev; + + ret =3D auxiliary_device_init(adev); + if (ret) + return ret; + + ret =3D auxiliary_device_add(adev); + if (ret) { + auxiliary_device_uninit(adev); + return ret; + } + + return devm_add_action_or_reset(dev, th1520_pd_pwrseq_unregister_adev, + adev); +} + static int th1520_pd_probe(struct platform_device *pdev) { struct generic_pm_domain **domains; @@ -186,8 +231,14 @@ static int th1520_pd_probe(struct platform_device *pde= v) if (ret) goto err_clean_genpd; =20 + ret =3D th1520_pd_pwrseq_gpu_init(dev); + if (ret) + goto err_clean_provider; + return 0; =20 +err_clean_provider: + of_genpd_del_provider(dev->of_node); err_clean_genpd: for (i--; i >=3D 0; i--) pm_genpd_remove(domains[i]); --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B937729DB64 for ; Wed, 18 Jun 2025 10:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242155; cv=none; b=Rkq7DEHefYQ/fiUZ6QNr6SsctSR18eAR/DlwLwQx6ANdMxo2Z16DUC1Y4dgjflMOJWFV+c1Hb56GEqn2wZFS3c3IRNM6wFO89DAz/fFFpusylGJxVPRdk6IfDzixlnatgMVgXwMiJoCfUsVXMumyyRwcnvzFiPFRAtTH1rdolOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242155; c=relaxed/simple; bh=nY8QLvFp3Ij0BV7LuPvaD1wVpZhZ3ZlZqNG90N8VrxM=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=YUglT3SXUsVE81u8Mjpb5szySYBndLwI5c1+Z4UvXTtG7JEDXGL7AOdV9KmOA+wHzbTDDXrHMXDEEC21V4Sx4Oz9kRnGAs/U5lSlZfhrwaDKZo7GqjNfagUAzrNTMikba9n6HciRo34zFKaX4VTFB2+kLx2guaP8aQkpiIQ9tFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=QImpgKRO; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="QImpgKRO" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102230euoutp02471bef0ba7435b26f8fff8b90c68b905~KG-ZqP2_M2860828608euoutp02D for ; Wed, 18 Jun 2025 10:22:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250618102230euoutp02471bef0ba7435b26f8fff8b90c68b905~KG-ZqP2_M2860828608euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242150; bh=0gVgt9U0jeu9CI/25XjajgSAqO26NEtCITyXqrTUvrM=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=QImpgKRO0BJZIqB5RIaAKucUUvRHi8b7wdFQSjArVMAFS8A2YlUh10z17s7U8N5Fn 6HYCRAKudi9O2kiU+ZwHInJT9oXwPkCF+2qAYOg/V7CZGFP6QS3Wtk0QjrxiuYE6t3 ZrtrvSURnYfBB0CTfSIYuXBFyjIrvPd4CHQKaI+0= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20250618102229eucas1p2a5d38013ee52a8a4a10d43449073e79e~KG-Y_rFUj2048420484eucas1p23; Wed, 18 Jun 2025 10:22:29 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102228eusmtip1c212780be6184f2330e068ae4287d310~KG-YAb6D11210412104eusmtip1q; Wed, 18 Jun 2025 10:22:28 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:10 +0200 Subject: [PATCH v5 4/8] drm/imagination: Use pwrseq for TH1520 GPU power management Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-4-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102229eucas1p2a5d38013ee52a8a4a10d43449073e79e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102229eucas1p2a5d38013ee52a8a4a10d43449073e79e X-EPHeader: CA X-CMS-RootMailID: 20250618102229eucas1p2a5d38013ee52a8a4a10d43449073e79e References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Update the Imagination PVR DRM driver to leverage the pwrseq framework for managing the power sequence of the GPU on the T-HEAD TH1520 SoC. To cleanly handle the TH1520's specific power requirements in the generic driver, this patch implements the "driver match data" pattern. The pvr_soc_data struct, associated with a compatible string in the of_device_id table, now holds pointers to platform-specific power_on and power_off functions. At probe time, the driver inspects the assigned power_on function pointer. If it points to the pwrseq variant, the driver calls devm_pwrseq_get("gpu-power"), requiring a valid sequencer and deferring probe on failure. Otherwise, it falls back to its standard manual reset initialization. The runtime PM callbacks, pvr_power_device_resume() and pvr_power_device_suspend(), call the power_on and power_off function pointers. Helper functions for both manual and pwrseq-based sequences are introduced to support this. Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski --- drivers/gpu/drm/imagination/Kconfig | 1 + drivers/gpu/drm/imagination/pvr_device.c | 31 +++++++-- drivers/gpu/drm/imagination/pvr_device.h | 19 ++++++ drivers/gpu/drm/imagination/pvr_drv.c | 30 ++++++++- drivers/gpu/drm/imagination/pvr_power.c | 112 ++++++++++++++++++++-------= ---- drivers/gpu/drm/imagination/pvr_power.h | 6 ++ 6 files changed, 152 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/imagination/Kconfig b/drivers/gpu/drm/imaginat= ion/Kconfig index 3bfa2ac212dccb73c53bdc2bc259bcba636e7cfc..5f9fff43d6baadc42ebf48d9172= 9bfbf27e06caa 100644 --- a/drivers/gpu/drm/imagination/Kconfig +++ b/drivers/gpu/drm/imagination/Kconfig @@ -11,6 +11,7 @@ config DRM_POWERVR select DRM_SCHED select DRM_GPUVM select FW_LOADER + select POWER_SEQUENCING help Choose this option if you have a system that has an Imagination Technologies PowerVR (Series 6 or later) or IMG GPU. diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/ima= gination/pvr_device.c index 8b9ba4983c4cb5bc40342fcafc4259078bc70547..c1c24c441c821ccce59f7cd3f14= 544a91ef54ea9 100644 --- a/drivers/gpu/drm/imagination/pvr_device.c +++ b/drivers/gpu/drm/imagination/pvr_device.c @@ -23,8 +23,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -618,6 +620,9 @@ pvr_device_init(struct pvr_device *pvr_dev) struct device *dev =3D drm_dev->dev; int err; =20 + /* Get the platform-specific data based on the compatible string. */ + pvr_dev->soc_data =3D of_device_get_match_data(dev); + /* * Setup device parameters. We do this first in case other steps * depend on them. @@ -631,10 +636,28 @@ pvr_device_init(struct pvr_device *pvr_dev) if (err) return err; =20 - /* Get the reset line for the GPU */ - err =3D pvr_device_reset_init(pvr_dev); - if (err) - return err; + /* + * For platforms that require it, get the power sequencer. + * For all others, perform manual reset initialization. + */ + if (pvr_dev->soc_data->power_on =3D=3D pvr_power_on_sequence_pwrseq) { + pvr_dev->pwrseq =3D devm_pwrseq_get(dev, "gpu-power"); + if (IS_ERR(pvr_dev->pwrseq)) { + /* + * This platform requires a sequencer. If we can't get + * it, we must return the error (including -EPROBE_DEFER + * to wait for the provider to appear) + */ + return dev_err_probe( + dev, PTR_ERR(pvr_dev->pwrseq), + "Failed to get required power sequencer\n"); + } + } else { + /* This platform does not use a sequencer, init reset manually. */ + err =3D pvr_device_reset_init(pvr_dev); + if (err) + return err; + } =20 /* Explicitly power the GPU so we can access control registers before the= FW is booted. */ err =3D pm_runtime_resume_and_get(dev); diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/ima= gination/pvr_device.h index 7cb01c38d2a9c3fc71effe789d4dfe54eddd93ee..3f35025e84efac031d3261c849e= f9fe105466423 100644 --- a/drivers/gpu/drm/imagination/pvr_device.h +++ b/drivers/gpu/drm/imagination/pvr_device.h @@ -37,6 +37,9 @@ struct clk; /* Forward declaration from . */ struct firmware; =20 +/* Forward declaration from #include #include +#include #include #include #include @@ -234,6 +235,71 @@ pvr_watchdog_init(struct pvr_device *pvr_dev) return 0; } =20 +int pvr_power_on_sequence_pwrseq(struct pvr_device *pvr_dev) +{ + return pwrseq_power_on(pvr_dev->pwrseq); +} + +int pvr_power_off_sequence_pwrseq(struct pvr_device *pvr_dev) +{ + return pwrseq_power_off(pvr_dev->pwrseq); +} + +int pvr_power_on_sequence_manual(struct pvr_device *pvr_dev) +{ + int err; + + err =3D clk_prepare_enable(pvr_dev->core_clk); + if (err) + return err; + + err =3D clk_prepare_enable(pvr_dev->sys_clk); + if (err) + goto err_core_clk_disable; + + err =3D clk_prepare_enable(pvr_dev->mem_clk); + if (err) + goto err_sys_clk_disable; + + /* + * According to the hardware manual, a delay of at least 32 clock + * cycles is required between de-asserting the clkgen reset and + * de-asserting the GPU reset. Assuming a worst-case scenario with + * a very high GPU clock frequency, a delay of 1 microsecond is + * sufficient to ensure this requirement is met across all + * feasible GPU clock speeds. + */ + udelay(1); + + err =3D reset_control_deassert(pvr_dev->reset); + if (err) + goto err_mem_clk_disable; + + return 0; + +err_mem_clk_disable: + clk_disable_unprepare(pvr_dev->mem_clk); +err_sys_clk_disable: + clk_disable_unprepare(pvr_dev->sys_clk); +err_core_clk_disable: + clk_disable_unprepare(pvr_dev->core_clk); + + return err; +} + +int pvr_power_off_sequence_manual(struct pvr_device *pvr_dev) +{ + int err; + + err =3D reset_control_assert(pvr_dev->reset); + + clk_disable_unprepare(pvr_dev->mem_clk); + clk_disable_unprepare(pvr_dev->sys_clk); + clk_disable_unprepare(pvr_dev->core_clk); + + return err; +} + int pvr_power_device_suspend(struct device *dev) { @@ -252,11 +318,7 @@ pvr_power_device_suspend(struct device *dev) goto err_drm_dev_exit; } =20 - clk_disable_unprepare(pvr_dev->mem_clk); - clk_disable_unprepare(pvr_dev->sys_clk); - clk_disable_unprepare(pvr_dev->core_clk); - - err =3D reset_control_assert(pvr_dev->reset); + err =3D pvr_dev->soc_data->power_off(pvr_dev); =20 err_drm_dev_exit: drm_dev_exit(idx); @@ -276,54 +338,22 @@ pvr_power_device_resume(struct device *dev) if (!drm_dev_enter(drm_dev, &idx)) return -EIO; =20 - err =3D clk_prepare_enable(pvr_dev->core_clk); + err =3D pvr_dev->soc_data->power_on(pvr_dev); if (err) goto err_drm_dev_exit; =20 - err =3D clk_prepare_enable(pvr_dev->sys_clk); - if (err) - goto err_core_clk_disable; - - err =3D clk_prepare_enable(pvr_dev->mem_clk); - if (err) - goto err_sys_clk_disable; - - /* - * According to the hardware manual, a delay of at least 32 clock - * cycles is required between de-asserting the clkgen reset and - * de-asserting the GPU reset. Assuming a worst-case scenario with - * a very high GPU clock frequency, a delay of 1 microsecond is - * sufficient to ensure this requirement is met across all - * feasible GPU clock speeds. - */ - udelay(1); - - err =3D reset_control_deassert(pvr_dev->reset); - if (err) - goto err_mem_clk_disable; - if (pvr_dev->fw_dev.booted) { err =3D pvr_power_fw_enable(pvr_dev); if (err) - goto err_reset_assert; + goto err_power_off; } =20 drm_dev_exit(idx); =20 return 0; =20 -err_reset_assert: - reset_control_assert(pvr_dev->reset); - -err_mem_clk_disable: - clk_disable_unprepare(pvr_dev->mem_clk); - -err_sys_clk_disable: - clk_disable_unprepare(pvr_dev->sys_clk); - -err_core_clk_disable: - clk_disable_unprepare(pvr_dev->core_clk); - +err_power_off: + pvr_dev->soc_data->power_off(pvr_dev); err_drm_dev_exit: drm_dev_exit(idx); =20 diff --git a/drivers/gpu/drm/imagination/pvr_power.h b/drivers/gpu/drm/imag= ination/pvr_power.h index ada85674a7ca762dcf92df40424230e1c3910342..d91d5f3f39b61f81121357f4187= b1a6e09b3dec0 100644 --- a/drivers/gpu/drm/imagination/pvr_power.h +++ b/drivers/gpu/drm/imagination/pvr_power.h @@ -41,4 +41,10 @@ pvr_power_put(struct pvr_device *pvr_dev) int pvr_power_domains_init(struct pvr_device *pvr_dev); void pvr_power_domains_fini(struct pvr_device *pvr_dev); =20 +/* Power sequence functions */ +int pvr_power_on_sequence_manual(struct pvr_device *pvr_dev); +int pvr_power_off_sequence_manual(struct pvr_device *pvr_dev); +int pvr_power_on_sequence_pwrseq(struct pvr_device *pvr_dev); +int pvr_power_off_sequence_pwrseq(struct pvr_device *pvr_dev); + #endif /* PVR_POWER_H */ --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DE652BD5A7 for ; Wed, 18 Jun 2025 10:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242155; cv=none; b=jtHuMVQPJ3TRRbDRe3LJysZgFTXghvtLnoSIt8rVbtGlWfdv0F0CopnyyLEGzetKFQZ0+7FmA9+p7wXghw3He8AzXza0CZKGV4gIAWkVJUHd6DNTIX3KlovNQXqdeAww9l/uXsEAtYE8foNVwZoJGGZ5CA7poMEBLb/wAkzeRik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242155; c=relaxed/simple; bh=eR9cdrCin/2WwM2JFOAyF853o0XIv/Jp7dJICn3jmFA=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=NerYAqK/N9jc4FFcyFZd+f9YvK4E82UDtCOD/7dUz4V39nt0pO2ZwrcM2XDli6tOngPYYpsbmnAdcVIErabj1BGFFT/9p5wDgRlqJeB5WqoCiV4TpDMgnfB6/buxdPtt4gJMu1e6/NOEYOJObB2EGhi+UqrLSH9saIrqbkBkyLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=VO0BF2Bn; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="VO0BF2Bn" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102231euoutp02451c4a5ac253ebb6a683cd121c486d95~KG-apxO2u2860828608euoutp02I for ; Wed, 18 Jun 2025 10:22:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250618102231euoutp02451c4a5ac253ebb6a683cd121c486d95~KG-apxO2u2860828608euoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242151; bh=4SD9BrnW26vlYTv5xxgtljWZoRvQzpufshnL3EiSwm8=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=VO0BF2BnvZ6uKfjXzvjt5cjA01QcqVHTCEYqmHPHfB1VWytIKBci7OAdR8W3Bqdc2 ABIowxMHjmZ5o2QHYpE9RE1p3IxhNrHb59C1KTXrSOEXasbuRdKuyCcQ/w0K9jxAvc IkQx78D56Fy5IT0U0KOX/3GazEd+7sbW9ilW7K8o= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20250618102230eucas1p2573610db9d4a9f3543d0048c30b2df9e~KG-aEi6uN1803418034eucas1p24; Wed, 18 Jun 2025 10:22:30 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102229eusmtip132bf2e8d5ca6d3dcb5878ee5cd672b4c~KG-ZDGa291490514905eusmtip1I; Wed, 18 Jun 2025 10:22:29 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:11 +0200 Subject: [PATCH v5 5/8] dt-bindings: gpu: img,powervr-rogue: Add TH1520 GPU compatible Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-5-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org, Krzysztof Kozlowski X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102230eucas1p2573610db9d4a9f3543d0048c30b2df9e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102230eucas1p2573610db9d4a9f3543d0048c30b2df9e X-EPHeader: CA X-CMS-RootMailID: 20250618102230eucas1p2573610db9d4a9f3543d0048c30b2df9e References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Update the img,powervr-rogue.yaml to include the T-HEAD TH1520 SoC's specific GPU compatible string. The thead,th1520-gpu compatible, along with its full chain img,img-bxm-4-64, and img,img-rogue, is added to the list of recognized GPU types. The power-domains property requirement for img,img-bxm-4-64 is also ensured by adding it to the relevant allOf condition. Acked-by: Krzysztof Kozlowski Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski --- Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b= /Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml index 4450e2e73b3ccf74d29f0e31e2e6687d7cbe5d65..9b241a0c1f5941dc58a1e23970f= 6d3773d427c22 100644 --- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml @@ -21,6 +21,11 @@ properties: # work with newer dts. - const: img,img-axe - const: img,img-rogue + - items: + - enum: + - thead,th1520-gpu + - const: img,img-bxm-4-64 + - const: img,img-rogue - items: - enum: - ti,j721s2-gpu @@ -93,7 +98,9 @@ allOf: properties: compatible: contains: - const: img,img-axe-1-16m + enum: + - img,img-axe-1-16m + - img,img-bxm-4-64 then: properties: power-domains: --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0983A2BE7D1 for ; Wed, 18 Jun 2025 10:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242156; cv=none; b=ZyxxWYPPIrrysqjpDWkc1RUkecrbtX4u4SA0xAJNcl5QSiV9QO7i0azH5MVpg4zmNmzlD6w6immhbglnMCoNT9h+2+dloC5R8vU4QHNe3m5kyCYkwhxCe2ch6yUtsLf0MkQAxOnDQDWqGunUVRRZB3tndvZJEaLFp2Cmc57dXU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242156; c=relaxed/simple; bh=7AzkJzyMtlyRZ3L8jj0gHiRqZpAYGhtMYEoeo/ElVyM=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=cB418jIU4tQDLWMUI3eS+ADu7RH30L6xk/EV1bP9/dG1HhtMn6WQj0FgYgSIleZOHVSSWB4CECtL8ikufMqg48Slp/5fmZz/y7UCw1pFmvlTiHwrWi9ZMmgtHC94d1KAJVMM2qj0N9/z2jiiCDnVcH8tzT+zAxsuqhfQrod73ow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=ApxDq+q7; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ApxDq+q7" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102232euoutp013bb3010312640c6b6f7c33eac2b27f1d~KG-bpTtNV1750617506euoutp01i for ; Wed, 18 Jun 2025 10:22:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20250618102232euoutp013bb3010312640c6b6f7c33eac2b27f1d~KG-bpTtNV1750617506euoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242152; bh=03clYuLUe6lZViLZ7J3QsFCYeiK6qNUgF531eyi5Uj4=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=ApxDq+q7YQ8RwciF1FUJBLaE/9u/BOkQbAR48Dk6iJzTtmqFEpHk4O7CXjpIUtjJB tQXuBxNbHQLPsjJog0QeABHnGwJ1rw8WWFBUvfi/KfppVTg7BtjSRW5Ux9ecCRHGZu +TxZ4x5c1tw4hzyTQJ3ec16qiSYMYz5sdgSDWwpo= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250618102231eucas1p1ec99058179825cb1250a1f189313b3eb~KG-bGe0in2809028090eucas1p1_; Wed, 18 Jun 2025 10:22:31 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102230eusmtip198543fedf6efd80d3c0af56b4c5c4765~KG-aIXtgN1490914909eusmtip1I; Wed, 18 Jun 2025 10:22:30 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:12 +0200 Subject: [PATCH v5 6/8] riscv: dts: thead: th1520: Add GPU clkgen reset to AON node Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-6-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102231eucas1p1ec99058179825cb1250a1f189313b3eb X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102231eucas1p1ec99058179825cb1250a1f189313b3eb X-EPHeader: CA X-CMS-RootMailID: 20250618102231eucas1p1ec99058179825cb1250a1f189313b3eb References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Add the "gpu-clkgen" reset property to the AON device tree node. This allows the AON power domain driver to detect the capability to power sequence the GPU and spawn the necessary pwrseq-thead-gpu auxiliary driver for managing the GPU's complex power sequence. This commit also adds the prerequisite dt-bindings/reset/thead,th1520-reset.h include to make the TH1520_RESET_ID_GPU_CLKGEN available. This include was previously dropped during a conflict resolution [1]. Link: https://lore.kernel.org/all/aAvfn2mq0Ksi8DF2@x1/ [1] Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski Reviewed-by: Drew Fustini --- arch/riscv/boot/dts/thead/th1520.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/th= ead/th1520.dtsi index 1db0054c4e093400e9dbebcee5fcfa5b5cae6e32..f3f5db0201ab8c0306d4d63072a= 1573431e51893 100644 --- a/arch/riscv/boot/dts/thead/th1520.dtsi +++ b/arch/riscv/boot/dts/thead/th1520.dtsi @@ -7,6 +7,7 @@ #include #include #include +#include =20 / { compatible =3D "thead,th1520"; @@ -234,6 +235,8 @@ aon: aon { compatible =3D "thead,th1520-aon"; mboxes =3D <&mbox_910t 1>; mbox-names =3D "aon"; + resets =3D <&rst TH1520_RESET_ID_GPU_CLKGEN>; + reset-names =3D "gpu-clkgen"; #power-domain-cells =3D <1>; }; =20 --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 263BB2C08D5 for ; Wed, 18 Jun 2025 10:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242157; cv=none; b=Ea0uZSLPQbWJjO9SzcNUjJmNKkfHF0oFDG79XUObmHo/OU3uJ80u1OIX4R3dX0/NLBecUXUshFgB/d48Vlb6mVjDbuhm++JKzcC7JFiddj9jZLNB1fw4uBeHgEx7uL3eXgbNCpnk4VDdp+Bs1mpy8jjCXaG6a0S9ZLuNRGiTil8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242157; c=relaxed/simple; bh=J0fI0Q5uBrXyX/k/5BKmG0ahWyv6dU99b2qbEr5mSUg=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=I86/ejWBby6/i/0qHsfx+3Gxu++SJlyJibUFsCYvLEUWNUv8Wx6zykuIdky8ITRzVw0lgIQ7hNnt3Irr7hCNZk5PCIbX4QU5d3Z8kg8N2g1oVkNzcD4Dqz6bLo14C7jc+irfhBoUwVPeG/6gE6/g78p49hFbUGfDeVvv1Kr1Asw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=Of61iESO; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Of61iESO" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102233euoutp02f062b87dcaa3cdedf2fccddcd3da46e9~KG-cwtC7G2863528635euoutp02D for ; Wed, 18 Jun 2025 10:22:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250618102233euoutp02f062b87dcaa3cdedf2fccddcd3da46e9~KG-cwtC7G2863528635euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242153; bh=nmPS0sPAt4qb3c3Er5l8jv2713zfbZ8xRAVya1nW258=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=Of61iESOhOos5QzheH28TL/TstjgtE3zZrx5CyUYTTAcpD50W2zWmCUB6/esEwGau kFwbscRoFTb8VyIQnWhk1e3nIBjJWOGaiaqFeLkL2z+ow6Kii4xDfQGsVfj1zzM4vj vNMGzpqnTktwtn639b3K1d7vS2ofmoVJKXmX4TQI= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20250618102233eucas1p228b24f58e4cb3d15b0f273530b582cea~KG-cJzWOs2901029010eucas1p2a; Wed, 18 Jun 2025 10:22:33 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102231eusmtip19437912ce6303d292ed0cfee0bb4b2e8~KG-bKfN4o0930209302eusmtip1V; Wed, 18 Jun 2025 10:22:31 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:13 +0200 Subject: [PATCH v5 7/8] riscv: dts: thead: th1520: Add IMG BXM-4-64 GPU node Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-7-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102233eucas1p228b24f58e4cb3d15b0f273530b582cea X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102233eucas1p228b24f58e4cb3d15b0f273530b582cea X-EPHeader: CA X-CMS-RootMailID: 20250618102233eucas1p228b24f58e4cb3d15b0f273530b582cea References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Add a device tree node for the IMG BXM-4-64 GPU present in the T-HEAD TH1520 SoC used by the Lichee Pi 4A board. This node enables support for the GPU using the drm/imagination driver. By adding this node, the kernel can recognize and initialize the GPU, providing graphics acceleration capabilities on the Lichee Pi 4A and other boards based on the TH1520 SoC. Add fixed clock gpu_mem_clk, as the MEM clock on the T-HEAD SoC can't be controlled programatically. Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski Reviewed-by: Drew Fustini --- arch/riscv/boot/dts/thead/th1520.dtsi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/th= ead/th1520.dtsi index f3f5db0201ab8c0306d4d63072a1573431e51893..c8447eef36c3a6e92d768658b6b= 19dfeb59a47c4 100644 --- a/arch/riscv/boot/dts/thead/th1520.dtsi +++ b/arch/riscv/boot/dts/thead/th1520.dtsi @@ -225,6 +225,13 @@ aonsys_clk: clock-73728000 { #clock-cells =3D <0>; }; =20 + gpu_mem_clk: mem-clk { + compatible =3D "fixed-clock"; + clock-frequency =3D <0>; + clock-output-names =3D "gpu_mem_clk"; + #clock-cells =3D <0>; + }; + stmmac_axi_config: stmmac-axi-config { snps,wr_osr_lmt =3D <15>; snps,rd_osr_lmt =3D <15>; @@ -500,6 +507,21 @@ clk: clock-controller@ffef010000 { #clock-cells =3D <1>; }; =20 + gpu: gpu@ffef400000 { + compatible =3D "thead,th1520-gpu", "img,img-bxm-4-64", + "img,img-rogue"; + reg =3D <0xff 0xef400000 0x0 0x100000>; + interrupt-parent =3D <&plic>; + interrupts =3D <102 IRQ_TYPE_LEVEL_HIGH>; + clocks =3D <&clk_vo CLK_GPU_CORE>, + <&gpu_mem_clk>, + <&clk_vo CLK_GPU_CFG_ACLK>; + clock-names =3D "core", "mem", "sys"; + power-domains =3D <&aon TH1520_GPU_PD>; + power-domain-names =3D "a"; + resets =3D <&rst TH1520_RESET_ID_GPU>; + }; + rst: reset-controller@ffef528000 { compatible =3D "thead,th1520-reset"; reg =3D <0xff 0xef528000 0x0 0x4f>; --=20 2.34.1 From nobody Thu Oct 9 08:51:58 2025 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A35032E7622 for ; Wed, 18 Jun 2025 10:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242161; cv=none; b=D3yngqrHVzX2BK/h/61JecTGVgeakaI1ygX2PLvwHtt2xmkCi3/aSirFi0hu7rExYPm1AxMEENva9qI4kW1Kp38pA5dqqhGu/V7U/IzP+RHwnpGLeFhxq5LSGFdvTejDs5bQ3i2Lrm5k7vxbDSCjGgDAR9qZpGnGbKlEmCCb8Bc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750242161; c=relaxed/simple; bh=Z1eQ/GUQiN4jxjZCX7Yswa1y9CgWC5cTrf8WNnn9IMo=; h=From:Date:Subject:MIME-Version:Message-Id:In-Reply-To:To:Cc: Content-Type:References; b=H939mOso9YM/Ui2O2zKWirEDTcHiMZmUtHl9QaGRFKIeOs854myWoGz1FbTTMLW1eUrz/PGdSFZjkJ+hv6G9WnXybaeFNVewkEetmBdAwm/tY3zwqj+L9GzfaF6zbCeMdx4/NoCDSrHkldtsX0GO1p5jfU/D7RLSz1RuX1Oc5rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=j04e/btX; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="j04e/btX" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20250618102234euoutp01b3e60f89d0ed1d17fe95b578f37ed3fe~KG-d86h0R1794717947euoutp01a for ; Wed, 18 Jun 2025 10:22:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20250618102234euoutp01b3e60f89d0ed1d17fe95b578f37ed3fe~KG-d86h0R1794717947euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1750242154; bh=JYJBKhF2v7bBNigZ2HXUlSgsH/gCPb2a5CyAJ0JNsB8=; h=From:Date:Subject:In-Reply-To:To:Cc:References:From; b=j04e/btXNi8Ji11HKhAS3wDGDW2yMiQE3HS7ZLUxpDVg5hVvQN9wkd4/wWEorSbxl rA/GiV25041t5K01iNJtY4ydFGIgybKrCkXxMCYn1Y7/3bL6DjfqHHQAJu2JHuZQ8h IODlOfwZlZ14IPkkB++wkUUAEzNhhKefh9KJL6xw= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20250618102234eucas1p2a1899b494c5ed75e0f39ea517d81c81d~KG-dMKK5z1803418034eucas1p25; Wed, 18 Jun 2025 10:22:34 +0000 (GMT) Received: from AMDC4942.eu.corp.samsungelectronics.net (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250618102233eusmtip19348d4038a9799137d47f88522c45772~KG-cMZhq41210412104eusmtip1r; Wed, 18 Jun 2025 10:22:33 +0000 (GMT) From: Michal Wilczynski Date: Wed, 18 Jun 2025 12:22:14 +0200 Subject: [PATCH v5 8/8] drm/imagination: Enable PowerVR driver for RISC-V Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20250618-apr_14_for_sending-v5-8-27ed33ea5c6f@samsung.com> In-Reply-To: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> To: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Wilczynski , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailer: b4 0.15-dev X-CMS-MailID: 20250618102234eucas1p2a1899b494c5ed75e0f39ea517d81c81d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250618102234eucas1p2a1899b494c5ed75e0f39ea517d81c81d X-EPHeader: CA X-CMS-RootMailID: 20250618102234eucas1p2a1899b494c5ed75e0f39ea517d81c81d References: <20250618-apr_14_for_sending-v5-0-27ed33ea5c6f@samsung.com> Several RISC-V boards feature Imagination GPUs that are compatible with the PowerVR driver. An example is the IMG BXM-4-64 GPU on the Lichee Pi 4A board. This commit adjusts the driver's Kconfig dependencies to allow the PowerVR driver to be compiled on the RISC-V architecture. By enabling compilation on RISC-V, we expand support for these GPUs, providing graphics acceleration capabilities and enhancing hardware compatibility on RISC-V platforms. Add a dependency on MMU to fix a build warning on RISC-V configurations without an MMU and enable COMPILE_TEST to improve build coverage. Reviewed-by: Ulf Hansson Signed-off-by: Michal Wilczynski Reviewed-by: Bartosz Golaszewski --- drivers/gpu/drm/imagination/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imagination/Kconfig b/drivers/gpu/drm/imaginat= ion/Kconfig index 5f9fff43d6baadc42ebf48d91729bfbf27e06caa..48fd31c031628c70b1e0952271b= accf7f4694810 100644 --- a/drivers/gpu/drm/imagination/Kconfig +++ b/drivers/gpu/drm/imagination/Kconfig @@ -3,9 +3,10 @@ =20 config DRM_POWERVR tristate "Imagination Technologies PowerVR (Series 6 and later) & IMG Gra= phics" - depends on ARM64 + depends on (ARM64 || RISCV) || COMPILE_TEST depends on DRM depends on PM + depends on MMU select DRM_EXEC select DRM_GEM_SHMEM_HELPER select DRM_SCHED --=20 2.34.1