Re: [PATCH v2 1/3] i3c: Add helpers to get the maximum transfer size for a device

From: Frank Li

Date: Thu Nov 05 2026 - 17:08:25 EST


On Thu, Nov 05, 2026 at 02:24:23PM +0530, Shubham Patil wrote:
> A target's MRL and MWL, retrieved with GETMRL and GETMWL, describe only
> what that target can accept. They say nothing about the controller
> driving it, which may impose a smaller limit of its own: the DesignWare
> controller, for example, rejects any private SDR transfer that does not
> fit its data buffer. A device driver sizing a transfer from MRL alone
> can therefore build one the controller has to refuse with -EOPNOTSUPP.
>
> Add tx_fifo_bytes and rx_fifo_bytes to struct i3c_master_controller, to
> be set by a controller driver before i3c_master_register() when it has
> such a limit, together with two helpers returning the smaller of the
> target and controller values for each direction.
>
> Both inputs use 0 to mean "no limit reported", so the helpers combine
> them with min_not_zero() and return 0 only when neither side reports
> one, leaving each caller to apply its own default. struct
> i3c_device_info keeps the raw target values untouched.
>
> The returned value applies to a single message. A controller is free to
> budget its buffer across every message in one i3c_device_do_xfers()
> call, so a caller batching several messages in the same direction may
> still be rejected.

can you try rephase commit message to make it shorter and summary most
importnat part.

>
> Signed-off-by: Shubham Patil <shubhamsanjay.patil@xxxxxxx>
> ---
...
> *
> * A &struct i3c_master_controller has to be registered to the I3C subsystem
> - * through i3c_master_register(). None of &struct i3c_master_controller fields
> - * should be set manually, just pass appropriate values to
> - * i3c_master_register().
> + * through i3c_master_register(). Except for @tx_fifo_bytes and
> + * @rx_fifo_bytes, which a controller driver may set before registering, none
> + * of &struct i3c_master_controller fields should be set manually, just pass
> + * appropriate values to i3c_master_register().
> */
> struct i3c_master_controller {
> struct device dev;
> @@ -580,6 +585,8 @@ struct i3c_master_controller {
> struct work_struct hj_work;
> struct work_struct reg_work;
> unsigned int dev_nack_retry_count;
> + u16 tx_fifo_bytes;
> + u16 rx_fifo_bytes;

if support dma, FIFO size become not important.

max_tx_bytes,

Frank

> };
>
> /**
> --
> 2.34.1
>