From: Pavel Machek <pavel@nabladev.com>
To: tommaso.merciai.xr@bp.renesas.com
Cc: cip-dev@lists.cip-project.org,
Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
Biju Das <biju.das.jz@bp.renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
tomm.merciai@gmail.com
Subject: Re: [cip-dev] [PATCH 6.1.y-cip 11/22] i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo()
Date: Fri, 9 Jan 2026 11:26:32 +0100 [thread overview]
Message-ID: <aWDX2GnS1p7FS1NZ@duo.ucw.cz> (raw)
In-Reply-To: <20260108092823.489287-12-tommaso.merciai.xr@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]
Hi!
> From: Jorge Marques <jorge.marques@analog.com>
>
> commit 733b439375b494e8a6950ab47d18a4b615b73cb3 upstream.
>
> The I3C abstraction expects u8 buffers, but some controllers operate with
> a 32-bit bus width FIFO and cannot flag valid bytes individually. To avoid
> reading or writing outside the buffer bounds, use 32-bit accesses where
> possible and apply memcpy for any remaining bytes
> +++ b/drivers/i3c/internals.h
> @@ -24,4 +24,41 @@ int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev);
> int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev,
> const struct i3c_ibi_setup *req);
> void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
> +
> +/**
> + * i3c_writel_fifo - Write data buffer to 32bit FIFO
> + * @addr: FIFO Address to write to
> + * @buf: Pointer to the data bytes to write
> + * @nbytes: Number of bytes to write
> + */
> +static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
> + int nbytes)
> +{
> + writesl(addr, buf, nbytes / 4);
> + if (nbytes & 3) {
> + u32 tmp = 0;
> +
> + memcpy(&tmp, buf + (nbytes & ~3), nbytes & 3);
> + writel(tmp, addr);
> + }
> +}
That's quite an interesting code. Will it work correctly on both endianness?
> +/**
> + * i3c_readl_fifo - Read data buffer from 32bit FIFO
> + * @addr: FIFO Address to read from
> + * @buf: Pointer to the buffer to store read bytes
> + * @nbytes: Number of bytes to read
> + */
> +static inline void i3c_readl_fifo(const void __iomem *addr, void *buf,
> + int nbytes)
> +{
> + readsl(addr, buf, nbytes / 4);
> + if (nbytes & 3) {
> + u32 tmp;
> +
> + tmp = readl(addr);
> + memcpy(buf + (nbytes & ~3), &tmp, nbytes & 3);
> + }
> +}
Same question here.
Best regards,
Pavel
--
In cooperation with Nabla.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2026-01-09 10:26 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 9:28 [PATCH 6.1.y-cip 00/22] Add I3C support for RZ/G3E Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 01/22] bitops: add generic parity calculation for u8 Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 02/22] dt-bindings: i3c: Add Renesas I3C controller Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 03/22] i3c: controllers do not need to depend on I3C Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 04/22] i3c: master: Add basic driver for the Renesas I3C controller Tommaso Merciai
2026-01-09 10:22 ` [cip-dev] " Pavel Machek
2026-01-09 11:58 ` Tommaso Merciai
2026-01-14 11:43 ` Pavel Machek
2026-01-14 11:53 ` Pavel Machek
2026-01-08 9:28 ` [PATCH 6.1.y-cip 05/22] i3c: Document I3C_ADDR_SLOT_EXT_STATUS_MASK Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 06/22] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 07/22] i3c: Standardize defines for specification parameters Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 08/22] i3c: Add more parameters for controllers to the header Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 09/22] i3c: master: Add helpers for DMA mapping and bounce buffer handling Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 10/22] i3c: document i3c_xfers Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 11/22] i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo() Tommaso Merciai
2026-01-09 10:26 ` Pavel Machek [this message]
2026-01-08 9:28 ` [PATCH 6.1.y-cip 12/22] i3c: Correct the macro module_i3c_i2c_driver Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 13/22] i3c: export SETDASA method Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 14/22] clk: renesas: r9a09g047: Add I3C0 clocks and resets Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 15/22] arm64: dts: renesas: r9a09g047: Add I3C node Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 16/22] dt-bindings: hwmon: ti,tmp108: document V+ supply, add short description Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 17/22] dt-bindings: hwmon: ti,tmp108: Add nxp,p3t1085 compatible string Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 18/22] hwmon: (tmp108) Add NXP p3t1085 support Tommaso Merciai
2026-01-09 10:29 ` [cip-dev] " Pavel Machek
2026-01-08 9:28 ` [PATCH 6.1.y-cip 19/22] hwmon: (tmp108) Add helper function tmp108_common_probe() to prepare I3C support Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 20/22] hwmon: (tmp108) Add support for I3C device Tommaso Merciai
2026-01-09 10:32 ` [cip-dev] " Pavel Machek
2026-01-08 9:28 ` [PATCH 6.1.y-cip 21/22] hwmon: (tmp108) Do not fail in I3C probe when I3C regmap is a module Tommaso Merciai
2026-01-08 9:28 ` [PATCH 6.1.y-cip 22/22] hwmon: (tmp108) Add basic regulator support Tommaso Merciai
2026-01-09 10:39 ` [cip-dev] [PATCH 6.1.y-cip 00/22] Add I3C support for RZ/G3E Pavel Machek
2026-01-09 12:08 ` Tommaso Merciai
2026-01-13 5:43 ` nobuhiro.iwamatsu.x90
2026-01-15 8:50 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aWDX2GnS1p7FS1NZ@duo.ucw.cz \
--to=pavel@nabladev.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=cip-dev@lists.cip-project.org \
--cc=nobuhiro1.iwamatsu@toshiba.co.jp \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=tomm.merciai@gmail.com \
--cc=tommaso.merciai.xr@bp.renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox