On Fri, 21 Mar 2025 21:05:54 +0100 Marek Vasut <ma...@denx.de> wrote:
> The instance of the GPU populated in Freescale i.MX95 does require > release from reset by writing into a single GPUMIX block controller > GPURESET register bit 0. Implement support for one optional reset. > > Signed-off-by: Marek Vasut <ma...@denx.de> > --- > Cc: Boris Brezillon <boris.brezil...@collabora.com> > Cc: Conor Dooley <conor...@kernel.org> > Cc: David Airlie <airl...@gmail.com> > Cc: Fabio Estevam <feste...@gmail.com> > Cc: Krzysztof Kozlowski <krzk...@kernel.org> > Cc: Liviu Dudau <liviu.du...@arm.com> > Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com> > Cc: Maxime Ripard <mrip...@kernel.org> > Cc: Pengutronix Kernel Team <ker...@pengutronix.de> > Cc: Philipp Zabel <p.za...@pengutronix.de> > Cc: Rob Herring <r...@kernel.org> > Cc: Sascha Hauer <s.ha...@pengutronix.de> > Cc: Sebastian Reichel <s...@kernel.org> > Cc: Shawn Guo <shawn...@kernel.org> > Cc: Simona Vetter <sim...@ffwll.ch> > Cc: Steven Price <steven.pr...@arm.com> > Cc: Thomas Zimmermann <tzimmerm...@suse.de> > Cc: devicet...@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Cc: i...@lists.linux.dev > Cc: linux-arm-ker...@lists.infradead.org > --- > V2: Drop the select RESET_SIMPLE from Kconfig > --- > drivers/gpu/drm/panthor/panthor_device.c | 23 +++++++++++++++++++++++ > drivers/gpu/drm/panthor/panthor_device.h | 3 +++ > 2 files changed, 26 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_device.c > b/drivers/gpu/drm/panthor/panthor_device.c > index a9da1d1eeb707..51ee9cae94504 100644 > --- a/drivers/gpu/drm/panthor/panthor_device.c > +++ b/drivers/gpu/drm/panthor/panthor_device.c > @@ -64,6 +64,17 @@ static int panthor_clk_init(struct panthor_device *ptdev) > return 0; > } > > +static int panthor_reset_init(struct panthor_device *ptdev) > +{ > + ptdev->resets = > devm_reset_control_get_optional_exclusive_deasserted(ptdev->base.dev, NULL); > + if (IS_ERR(ptdev->resets)) > + return dev_err_probe(ptdev->base.dev, > + PTR_ERR(ptdev->resets), > + "get reset failed"); > + > + return 0; > +} > + > void panthor_device_unplug(struct panthor_device *ptdev) > { > /* This function can be called from two different path: the reset work > @@ -217,6 +228,10 @@ int panthor_device_init(struct panthor_device *ptdev) > if (ret) > return ret; > > + ret = panthor_reset_init(ptdev); > + if (ret) > + return ret; > + > ret = panthor_devfreq_init(ptdev); > if (ret) > return ret; > @@ -470,6 +485,10 @@ int panthor_device_resume(struct device *dev) > if (ret) > goto err_disable_stacks_clk; > > + ret = reset_control_deassert(ptdev->resets); > + if (ret) > + goto err_disable_coregroup_clk; > + > panthor_devfreq_resume(ptdev); > > if (panthor_device_is_initialized(ptdev) && > @@ -512,6 +531,9 @@ int panthor_device_resume(struct device *dev) > > err_suspend_devfreq: > panthor_devfreq_suspend(ptdev); > + reset_control_assert(ptdev->resets); > + > +err_disable_coregroup_clk: > clk_disable_unprepare(ptdev->clks.coregroup); > > err_disable_stacks_clk: > @@ -563,6 +585,7 @@ int panthor_device_suspend(struct device *dev) > > panthor_devfreq_suspend(ptdev); > > + reset_control_assert(ptdev->resets); Hm, that might be the cause of the fast reset issue (which is a fast resume more than a fast reset BTW): if you re-assert the reset line on runtime suspend, I guess this causes a full GPU reset, and the MCU ends up in a state where it needs a slow reset (all data sections reset to their initial state). Can you try to move the reset_control_[de]assert to the unplug/init functions? > clk_disable_unprepare(ptdev->clks.coregroup); > clk_disable_unprepare(ptdev->clks.stacks); > clk_disable_unprepare(ptdev->clks.core); > diff --git a/drivers/gpu/drm/panthor/panthor_device.h > b/drivers/gpu/drm/panthor/panthor_device.h > index da6574021664b..fea3a05778e2e 100644 > --- a/drivers/gpu/drm/panthor/panthor_device.h > +++ b/drivers/gpu/drm/panthor/panthor_device.h > @@ -111,6 +111,9 @@ struct panthor_device { > struct clk *coregroup; > } clks; > > + /** @resets: GPU reset. */ > + struct reset_control *resets; > + > /** @coherent: True if the CPU/GPU are memory coherent. */ > bool coherent; >