From: Frank Li <Frank.li@nxp.com>
To: adrianhoyin.ng@altera.com
Cc: alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/5] i3c: dw: use FIELD_PREP for device address table macros
Date: Tue, 2 Dec 2025 16:16:44 -0500 [thread overview]
Message-ID: <aS9XPPpmYna5kzDd@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <4c4791c018d61beb9ff85ca68c5bf48940d2398e.1764663888.git.adrianhoyin.ng@altera.com>
On Tue, Dec 02, 2025 at 04:26:12PM +0800, adrianhoyin.ng@altera.com wrote:
> From: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
>
> Add DEV_ADDR_TABLE_DYNAMIC_MASK / DEV_ADDR_TABLE_DYNAMIC_ADDR(x) for
> dynamic device addresses and DEV_ADDR_TABLE_STATIC_MASK /
> DEV_ADDR_TABLE_STATIC_ADDR(x) for static device addresses in the I3C
> address table. Replace manual shift-and-mask with FIELD_PREP() for both
> dynamic and static addresses for clarity and maintainability.
>
> Signed-off-by: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/i3c/master/dw-i3c-master.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 8288888be591..1c1418d0a62a 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -205,12 +205,14 @@
> #define SLAVE_CONFIG 0xec
>
> #define DW_I3C_DEV_NACK_RETRY_CNT_MAX 0x3
> +#define DEV_ADDR_TABLE_DYNAMIC_MASK GENMASK(23, 16)
> +#define DEV_ADDR_TABLE_STATIC_MASK GENMASK(6, 0)
> #define DEV_ADDR_TABLE_IBI_MDB BIT(12)
> #define DEV_ADDR_TABLE_SIR_REJECT BIT(13)
> #define DEV_ADDR_TABLE_DEV_NACK_RETRY_CNT(x) (((x) << 29) & GENMASK(30, 29))
> #define DEV_ADDR_TABLE_LEGACY_I2C_DEV BIT(31)
> -#define DEV_ADDR_TABLE_DYNAMIC_ADDR(x) (((x) << 16) & GENMASK(23, 16))
> -#define DEV_ADDR_TABLE_STATIC_ADDR(x) ((x) & GENMASK(6, 0))
> +#define DEV_ADDR_TABLE_DYNAMIC_ADDR(x) FIELD_PREP(DEV_ADDR_TABLE_DYNAMIC_MASK, x)
> +#define DEV_ADDR_TABLE_STATIC_ADDR(x) FIELD_PREP(DEV_ADDR_TABLE_STATIC_MASK, x)
> #define DEV_ADDR_TABLE_LOC(start, idx) ((start) + ((idx) << 2))
>
> #define I3C_BUS_SDR1_SCL_RATE 8000000
> --
> 2.49.GIT
>
next prev parent reply other threads:[~2025-12-02 21:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 8:26 [PATCH v5 0/5] i3c: dw-i3c: Enable support for dw-i3c controller NACK retry sysfs and DAT restore fix adrianhoyin.ng
2025-12-02 8:26 ` [PATCH v5 1/5] i3c: add sysfs entry for Device NACK Retry count adrianhoyin.ng
2025-12-02 8:26 ` [PATCH v5 2/5] i3c: add sysfs attribute for device NACK retry adrianhoyin.ng
2025-12-02 21:12 ` Frank Li
2025-12-02 8:26 ` [PATCH v5 3/5] i3c: dw: Add support for Device NACK Retry configuration adrianhoyin.ng
2025-12-02 21:15 ` Frank Li
2025-12-02 8:26 ` [PATCH v5 4/5] i3c: dw: use FIELD_PREP for device address table macros adrianhoyin.ng
2025-12-02 21:16 ` Frank Li [this message]
2025-12-02 22:49 ` kernel test robot
2025-12-02 23:41 ` kernel test robot
2025-12-02 8:26 ` [PATCH v5 5/5] i3c: dw: Preserve DAT entry bits when restoring addresses adrianhoyin.ng
2025-12-02 21:19 ` Frank Li
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=aS9XPPpmYna5kzDd@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=adrianhoyin.ng@altera.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®