Re: [PATCH v2] hw_random: timeriomem-rng: add configurable read width and data mask
From: Krzysztof Kozlowski
Date: Wed Jun 17 2026 - 04:08:44 EST
On Mon, Jun 15, 2026 at 09:13:39PM +0100, Jad Keskes wrote:
> The TODO for supporting read sizes other than 32 bits and masking has
> been sitting in this driver since 2009. Implement it.
>
> Add width (8, 16, or 32 bits) and mask properties to the platform data
> and device tree bindings. The read loop dispatches on width using
> readb/readw/readl so a configured 8-bit access doesn't trigger a bus
> error on hardware that rejects 32-bit reads to that address. The mask
> is ANDed with the value before storing.
>
> These are platform properties, not runtime policy -- width depends on
> SoC integration, mask reflects which output bits carry entropy.
>
> The alignment check in probe is updated to verify the resource is
> aligned to the configured width instead of hardcoding 4-byte alignment.
>
> Signed-off-by: Jad Keskes <inasj268@xxxxxxxxx>
> ---
>
> v2:
> - Remove old timeriomem_rng.yaml to avoid dt_binding_check conflict
> - Use IS_ALIGNED() instead of modulo for 32-bit PAE safety
>
>
> .../bindings/rng/timeriomem-rng.yaml | 76 ++++++++++++++++++
> .../bindings/rng/timeriomem_rng.yaml | 48 ------------
I don't undetstand this diff... what are you doing exactly? And more
important WHY?
Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.
> drivers/char/hw_random/timeriomem-rng.c | 78 +++++++++++++++----
> include/linux/timeriomem-rng.h | 12 +++
> 4 files changed, 153 insertions(+), 61 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/rng/timeriomem-rng.yaml
> delete mode 100644 Documentation/devicetree/bindings/rng/timeriomem_rng.yaml
Best regards,
Krzysztof