回复: [PATCH v9 2/2] hwrng: starfive: rework clk/reset teardown order for JHB100

From: Lianfeng Ouyang

Date: Wed Oct 21 2026 - 22:30:59 EST




> -----邮件原件-----
> 发件人: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
> 发送时间: 2026年10月22日 0:14
> 收件人: Lianfeng Ouyang <lianfeng.ouyang@xxxxxxxxxxxxxxxx>
> 抄送: Olivia Mackall <olivia@xxxxxxxxxxx>; Herbert Xu
> <herbert@xxxxxxxxxxxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>; Krzysztof
> Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley <conor+dt@xxxxxxxxxx>; Philipp
> Zabel <p.zabel@xxxxxxxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> 主题: Re: [PATCH v9 2/2] hwrng: starfive: rework clk/reset teardown order for
> JHB100
>
> On Wed, Oct 21, 2026 at 04:37:12PM +0800, lianfeng.ouyang wrote:
> > From: Lianfeng Ouyang <lianfeng.ouyang@xxxxxxxxxxxxxxxx>
> >
> > Rework the StarFive TRNG driver to address hardware-specific requirements
> > for JHB100 SoC. To avoid reset-domain crossing glitches, the driver now
> > ensures clocks are gated before asserting reset during teardown for
> > JHB100, while JH7110 retains the original reset-first sequence.
> >
> > Add per-compatible match data (struct starfive_trng_data) describing the
> > clock/reset teardown order, a new "starfive,jhb100-trng" compatible, and
> > select the ordering from it.
> >
> > Fix the runtime-PM get/put balancing across the init/read/reseed/cleanup
> > paths, manage PM and the clk/reset teardown via devm so all error paths
> > unwind correctly, run the SEU-triggered reseed from a workqueue instead
> > of hard IRQ, and serialise the command sequences with a mutex.
>
> This sounds like three commits, with at least the third getting a Fixes:
> line.

Okay, my next submission will be split into multiple submissions according to the requirements

>
> > +#include <linux/bits.h>
> > #include <linux/clk.h>
> > #include <linux/completion.h>
> > -#include <linux/delay.h>
> > +#include <linux/container_of.h>
> > +#include <linux/device.h>
> > +#include <linux/devm-helpers.h>
> > #include <linux/err.h>
> > +#include <linux/errno.h>
> > #include <linux/hw_random.h>
> > #include <linux/interrupt.h>
> > #include <linux/io.h>
> > #include <linux/iopoll.h>
> > -#include <linux/kernel.h>
> > +#include <linux/jiffies.h>
> > +#include <linux/lockdep.h>
> > +#include <linux/minmax.h>
> > +#include <linux/mod_devicetable.h>
>
> Please don't add <linux/mod_devicetable.h>. <linux/platform_device.h>
> already provides of_device_id, so just dropping
> <linux/mod_devicetable.h> should work fine.

Okay, I will reorganize these header files

>
> > #include <linux/module.h>
> > -#include <linux/of.h>
> > +#include <linux/mutex.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_runtime.h>
> > -#include <linux/random.h>
> > +#include <linux/property.h>
> > #include <linux/reset.h>
> > +#include <linux/types.h>
> > +#include <linux/workqueue.h>
>
> All that header rearrangement is worth pointing out in the commit log.

Okay,Thanks for the review.

Best Regards,
Lianfeng Ouyang

>
> Best regards
> Uwe