From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Jorge Marques <jorge.marques@analog.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-i3c@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] i3c: master: Add driver for Analog Devices I3C Controller IP
Date: Sat, 7 Jun 2025 02:03:42 +0530 [thread overview]
Message-ID: <11b278ac-20ba-4e75-b307-6608ea8b4522@oracle.com> (raw)
In-Reply-To: <20250606-adi-i3c-master-v2-2-e68b9aad2630@analog.com>
> new file mode 100644
> index 0000000000000000000000000000000000000000..b3799071573f4066eb14123c94ee599cc6331b3d
> --- /dev/null
> +++ b/drivers/i3c/master/adi-i3c-master.c
> @@ -0,0 +1,1037 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * I3C Controller driver
> + * Copyright 2025 Analog Devices Inc.
> + * Author: Jorge Marques <jorge.marques@analog.com>
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/bitfield.h>
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/errno.h>
> +#include <linux/i3c/master.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +#define VERSION_MAJOR(x) ((u32)FIELD_GET(GENMASK(23, 16), (x)))
> +#define VERSION_MINOR(x) ((u32)FIELD_GET(GENMASK(15, 8), (x)))
> +#define VERSION_PATCH(x) ((u32)FIELD_GET(GENMASK(7, 0), (x)))
> +
> +#define MAX_DEVS 16
> +
> +#define REG_VERSION 0x000
> +#define REG_ENABLE 0x040
> +#define REG_IRQ_MASK 0x080
> +#define REG_IRQ_PENDING 0x084
> +#define REG_IRQ_PEDING_CMDR BIT(5)
> +#define REG_IRQ_PEDING_IBI ((u32)BIT(6))
> +#define REG_IRQ_PEDING_DAA BIT(7)
typo PEDING -> PENDING
> +#define REG_CMD_FIFO 0x0d4
> +#define REG_CMD_FIFO_0_IS_CCC BIT(22)
> +#define REG_CMD_FIFO_0_BCAST BIT(21)
> +#define REG_CMD_FIFO_0_SR BIT(20)
> +#define REG_CMD_FIFO_0_LEN(l) FIELD_PREP(GENMASK(19, 8), (l))
> +#define REG_CMD_FIFO_0_LEN_MAX 4095
> +#define REG_CMD_FIFO_0_DEV_ADDR(a) FIELD_PREP(GENMASK(7, 1), a)
> +#define REG_CMD_FIFO_0_RNW BIT(0)
> +#define REG_CMD_FIFO_1_CCC(id) FIELD_PREP(GENMASK(7, 0), (id))
[snip]
> +
> +static int adi_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
> + struct i3c_priv_xfer *xfers,
> + int nxfers)
> +{
> + struct i3c_master_controller *m = i3c_dev_get_master(dev);
> + struct adi_i3c_master *master = to_adi_i3c_master(m);
> + struct adi_i3c_xfer *xfer;
> + int i, ret;
> +
> + for (i = 0; i < nxfers; i++) {
> + if (xfers[i].len > REG_CMD_FIFO_0_LEN_MAX)
> + return -EOPNOTSUPP;
> + }
> +
> + if (!nxfers)
> + return 0;
this can move before for
> +
> + xfer = adi_i3c_master_alloc_xfer(master, nxfers);
> + if (!xfer)
> + return -ENOMEM;
Thanks
alok
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2025-06-24 0:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 13:21 [PATCH v2 0/2] Add ADI I3C Controller Jorge Marques
2025-06-06 13:21 ` [PATCH v2 1/2] dt-bindings: i3c: Add adi-i3c-master Jorge Marques
2025-06-06 16:08 ` Conor Dooley
2025-06-17 14:50 ` Jorge Marques
2025-06-17 15:47 ` Conor Dooley
2025-06-18 7:10 ` Jorge Marques
2025-06-06 13:21 ` [PATCH v2 2/2] i3c: master: Add driver for Analog Devices I3C Controller IP Jorge Marques
2025-06-06 20:33 ` ALOK TIWARI [this message]
2025-06-17 14:54 ` Jorge Marques
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=11b278ac-20ba-4e75-b307-6608ea8b4522@oracle.com \
--to=alok.a.tiwari@oracle.com \
--cc=Frank.Li@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jorge.marques@analog.com \
--cc=krzk+dt@kernel.org \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@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