Add Synopsys MIPI I3C Driver support
Subsystems (2)
v2 cover Add Synopsys MIPI I3C Driver support
From: Dinesh Maniyam <[email protected]>
This patchset add Synopsys MIPI I3C Driver support for Intel Agilex5 devices.
The i3c driver is leveraged from the master/dw-i3c-master.c, i3c/device.c and i3c/master.c Linux version 6.6.37 LTS And few header files included to be
part of the migration; i3c/internals.h, include/linux/i3c/ccc.h, include/linux/i3c/device.h and include/linux/i3c/master.h. Additional i3c uclass driver and command files added to support i3c read and write in U-Boot.
Patch status:
Detail changelog can find in commit message.
v1->v2:
--------
Reorder commits.
Added commits:
- drivers: i3c: Add i3c sandbox simple test.
- test: cmd: Add simple test for i3c
- configs: sandbox_defconfig: Enable configs for sandbox i3c
- configs: agilex5_defconfig: Enable i3c configs for agilex5
History:
--------
[v1]: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
Dinesh Maniyam (13):
drivers: i3c: Add new i3c uclass id
drivers: i3c: Add driver for MIPI DWI3C
drivers: i3c: Add i3c uclass driver.
drivers: Enabled Kconfig and Makefile for i3c support
drivers: i3c: Enabled Kconfig and Makefile for DWI3C
drivers: i3c: Add i3c sandbox simple test.
drivers: i3c: master: Enable probe i3c without slave device
i3c: master: dw-i3c-master: Fix OD_TIMING for spike filter
cmd: Add i3c command support.
cmd: Enabled Kconfig and Makefile for DWI3C cmd support
test: cmd: Add simple test for i3c
configs: sandbox_defconfig: Enable configs for sandbox i3c
configs: agilex5_defconfig: Enable i3c configs for agilex5
arch/sandbox/dts/test.dts | 8 + cmd/Kconfig | 6 + cmd/Makefile | 1 + cmd/i3c.c | 193 +++ configs/sandbox_defconfig | 3 + configs/socfpga_agilex5_defconfig | 3 + doc/usage/cmd/i3c.rst | 98 ++ drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/i3c/Kconfig | 25 + drivers/i3c/Makefile | 5 + drivers/i3c/device.c | 262 ++++ drivers/i3c/i3c-uclass.c | 38 + drivers/i3c/internals.h | 26 + drivers/i3c/master.c | 2072 ++++++++++++++++++++++++++++ drivers/i3c/master/Kconfig | 11 + drivers/i3c/master/Makefile | 3 + drivers/i3c/master/dw-i3c-master.c | 1058 ++++++++++++++ drivers/i3c/sandbox_i3c.c | 58 + include/dm/device.h | 2 + include/dm/uclass-id.h | 1 + include/dw-i3c.h | 252 ++++ include/i3c.h | 67 + include/linux/i3c/ccc.h | 385 ++++++ include/linux/i3c/device.h | 286 ++++ include/linux/i3c/master.h | 698 ++++++++++ test/cmd/Makefile | 1 + test/cmd/i3c.c | 52 + test/dm/Makefile | 1 + test/dm/i3c.c | 34 + 30 files changed, 5652 insertions(+) create mode 100644 cmd/i3c.c create mode 100755 doc/usage/cmd/i3c.rst create mode 100755 drivers/i3c/Kconfig create mode 100755 drivers/i3c/Makefile create mode 100644 drivers/i3c/device.c create mode 100644 drivers/i3c/i3c-uclass.c create mode 100644 drivers/i3c/internals.h create mode 100644 drivers/i3c/master.c create mode 100755 drivers/i3c/master/Kconfig create mode 100755 drivers/i3c/master/Makefile create mode 100644 drivers/i3c/master/dw-i3c-master.c create mode 100755 drivers/i3c/sandbox_i3c.c create mode 100644 include/dw-i3c.h create mode 100644 include/i3c.h create mode 100644 include/linux/i3c/ccc.h create mode 100644 include/linux/i3c/device.h create mode 100644 include/linux/i3c/master.h create mode 100755 test/cmd/i3c.c create mode 100755 test/dm/i3c.c
Signature · 1 line
2.26.2
PATCH RESEND v2 1/13 drivers: i3c: Add new i3c uclass id
From: Dinesh Maniyam <[email protected]>
Add i3c general uclass id.
--- include/dm/uclass-id.h | 1 + 1 file changed, 1 insertion(+)
include/dm/uclass-id.h +1 -0
@@ -78,6 +78,7 @@ enum uclass_id {UCLASS_I2C_GENERIC ,/* Generic I2C device */ UCLASS_I2C_MUX ,/* I2C multiplexer */ UCLASS_I2S ,/* I2S bus */ +UCLASS_I3C ,/* I3C bus */ UCLASS_IDE ,/* IDE device */ UCLASS_IOMMU ,/* IOMMU */ UCLASS_IRQ, /* Interrupt controller */
Signature · 1 line
2.26.2
PATCH RESEND v2 2/13 drivers: i3c: Add driver for MIPI DWI3C
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable driver for Synopsis MIPI DWI3C for the family device agilex5. This driver is migrated from linux version 6.6.37 LTS
--- drivers/i3c/device.c | 262 ++++ drivers/i3c/internals.h | 26 + drivers/i3c/master.c | 2066 ++++++++++++++++++++++++++++ drivers/i3c/master/dw-i3c-master.c | 1002 ++++++++++++++ include/dm/device.h | 2 + include/dw-i3c.h | 248 ++++ include/linux/i3c/ccc.h | 385 ++++++ include/linux/i3c/device.h | 286 ++++ include/linux/i3c/master.h | 697 ++++++++++ 9 files changed, 4974 insertions(+) create mode 100644 drivers/i3c/device.c create mode 100644 drivers/i3c/internals.h create mode 100644 drivers/i3c/master.c create mode 100644 drivers/i3c/master/dw-i3c-master.c create mode 100644 include/dw-i3c.h create mode 100644 include/linux/i3c/ccc.h create mode 100644 include/linux/i3c/device.h create mode 100644 include/linux/i3c/master.h
drivers/i3c/device.c new file +262 -0
@@ -0,0 +1,262 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018 Cadence Design Systems Inc. +* +* Author: Boris Brezillon <[email protected]> +*/ + +#include <linux/bug.h> +#include <linux/completion.h> +#include <dm/device.h> + +#include "internals.h" + +/* i3c */ + +#define I3C_MATCH_DCR 0x1 +#define I3C_MATCH_MANUF 0x2 +#define I3C_MATCH_PART 0x4 +#define I3C_MATCH_EXTRA_INFO 0x8 + +struct i3c_device_id { +__u8 match_flags; +__u8 dcr; +__u16 manuf_id; +__u16 part_id; +__u16 extra_info; + +const void *data; +}; + +/** +* i3c_device_do_priv_xfers() - do I3C SDR private transfers directed to a +* specific device +* +* @dev: device with which the transfers should be done +* @xfers: array of transfers +* @nxfers: number of transfers +* +* Initiate one or several private SDR transfers with @dev. +* +* This function can sleep and thus cannot be called in atomic context. +* +* Return: 0 in case of success, a negative error core otherwise. +*/ +int i3c_device_do_priv_xfers (struct i3c_device *dev, +struct i3c_priv_xfer *xfers, +int nxfers) +{ +int ret, i; + +if (nxfers <1 ) +return 0 ; + +for (i =0 ; i < nxfers; i++) { +if (!xfers[i].len || !xfers[i].data.in) +return -EINVAL ; + } + +i3c_bus_normaluse_lock (dev->bus); + ret =i3c_dev_do_priv_xfers_locked (dev->desc, xfers, nxfers); +i3c_bus_normaluse_unlock (dev->bus); + +return ret; +} +EXPORT_SYMBOL_GPL (i3c_device_do_priv_xfers); + +/** +* i3c_device_get_info() - get I3C device information +* +* @dev: device we want information on +* @info: the information object to fill in +* +* Retrieve I3C dev info. +*/ +void i3c_device_get_info (struct i3c_device *dev, +struct i3c_device_info *info) +{ +if (!info) +return ; + +i3c_bus_normaluse_lock (dev->bus); +if (dev->desc) + *info = dev->desc->info; +i3c_bus_normaluse_unlock (dev->bus); +} +EXPORT_SYMBOL_GPL (i3c_device_get_info); + +/** +* i3c_device_disable_ibi() - Disable IBIs coming from a specific device +* @dev: device on which IBIs should be disabled +* +* This function disable IBIs coming from a specific device and wait for +* all pending IBIs to be processed. +* +* Return: 0 in case of success, a negative error core otherwise. +*/ +int i3c_device_disable_ibi (struct i3c_device *dev) +{ +int ret = -ENOENT ; + +i3c_bus_normaluse_lock (dev->bus); +if (dev->desc) { +mutex_lock (&dev->desc->ibi_lock); + ret =i3c_dev_disable_ibi_locked (dev->desc); +mutex_unlock (&dev->desc->ibi_lock); + } +i3c_bus_normaluse_unlock (dev->bus); + +return ret; +} +EXPORT_SYMBOL_GPL (i3c_device_disable_ibi); + +/** +* i3c_device_enable_ibi() - Enable IBIs coming from a specific device +* @dev: device on which IBIs should be enabled +* +* This function enable IBIs coming from a specific device and wait for +* all pending IBIs to be processed. This should be called on a device +* where i3c_device_request_ibi() has succeeded. +* +* Note that IBIs from this device might be received before this function +* returns to its caller. +* +* Return: 0 in case of success, a negative error core otherwise. +*/ +int i3c_device_enable_ibi (struct i3c_device *dev) +{ +int ret = -ENOENT ; + +i3c_bus_normaluse_lock (dev->bus); +if (dev->desc) { +mutex_lock (&dev->desc->ibi_lock); + ret =i3c_dev_enable_ibi_locked (dev->desc); +mutex_unlock (&dev->desc->ibi_lock); + } +i3c_bus_normaluse_unlock (dev->bus); + +return ret; +} +EXPORT_SYMBOL_GPL (i3c_device_enable_ibi); + +/** +* i3c_device_request_ibi() - Request an IBI +* @dev: device for which we should enable IBIs +* @req: setup requested for this IBI +* +* This function is responsible for pre-allocating all resources needed to +* process IBIs coming from @dev. When this function returns, the IBI is not +* enabled until i3c_device_enable_ibi() is called. +* +* Return: 0 in case of success, a negative error core otherwise. +*/ +int i3c_device_request_ibi (struct i3c_device *dev, +const struct i3c_ibi_setup *req) +{ +int ret = -ENOENT ; + +if (!req->handler || !req->num_slots) +return -EINVAL ; + +i3c_bus_normaluse_lock (dev->bus); +if (dev->desc) { +mutex_lock (&dev->desc->ibi_lock); + ret =i3c_dev_request_ibi_locked (dev->desc, req); +mutex_unlock (&dev->desc->ibi_lock); + } +i3c_bus_normaluse_unlock (dev->bus); + +return ret; +} +EXPORT_SYMBOL_GPL (i3c_device_request_ibi); + +/** +* i3c_device_free_ibi() - Free all resources needed for IBI handling +* @dev: device on which you want to release IBI resources +* +* This function is responsible for de-allocating resources previously +* allocated by i3c_device_request_ibi(). It should be called after disabling +* IBIs with i3c_device_disable_ibi(). +*/ +void i3c_device_free_ibi (struct i3c_device *dev) +{ +i3c_bus_normaluse_lock (dev->bus); +if (dev->desc) { +mutex_lock (&dev->desc->ibi_lock); +i3c_dev_free_ibi_locked (dev->desc); +mutex_unlock (&dev->desc->ibi_lock); + } +i3c_bus_normaluse_unlock (dev->bus); +} +EXPORT_SYMBOL_GPL (i3c_device_free_ibi); + +/** +* i3cdev_to_dev() - Returns the device embedded in @i3cdev +* @i3cdev: I3C device +* +* Return: a pointer to a device object. +*/ +struct udevice *i3cdev_to_dev (struct i3c_device *i3cdev) +{ +return &i3cdev->dev; +} +EXPORT_SYMBOL_GPL (i3cdev_to_dev); + +/** +* dev_to_i3cdev() - Returns the I3C device containing @dev +* @dev: device object +* +* Return: a pointer to an I3C device object. +*/ +struct i3c_device *dev_to_i3cdev (struct udevice *dev) +{ + return container_of(dev, struct i3c_device, dev); +} +EXPORT_SYMBOL_GPL (dev_to_i3cdev); + +/** +* i3c_device_match_id() - Returns the i3c_device_id entry matching @i3cdev +* @i3cdev: I3C device +* @id_table: I3C device match table +* +* Return: a pointer to an i3c_device_id object or NULL if there's no match. +*/ +const struct i3c_device_id * +i3c_device_match_id (struct i3c_device *i3cdev, +const struct i3c_device_id *id_table) +{ +struct i3c_device_info devinfo; +const struct i3c_device_id *id; +u16 manuf, part, ext_info; +bool rndpid; + +i3c_device_get_info (i3cdev, &devinfo); + + manuf =I3C_PID_MANUF_ID (devinfo.pid); + part =I3C_PID_PART_ID (devinfo.pid); + ext_info =I3C_PID_EXTRA_INFO (devinfo.pid); + rndpid =I3C_PID_RND_LOWER_32BITS (devinfo.pid); + +for (id = id_table; id->match_flags !=0 ; id++) { +if ((id->match_flags &I3C_MATCH_DCR ) && + id->dcr != devinfo.dcr) +continue ; + +if ((id->match_flags &I3C_MATCH_MANUF ) && + id->manuf_id != manuf) +continue ; + +if ((id->match_flags &I3C_MATCH_PART ) && + (rndpid || id->part_id != part)) +continue ; + +if ((id->match_flags &I3C_MATCH_EXTRA_INFO ) && + (rndpid || id->extra_info != ext_info)) +continue ; + +return id; + } + +return NULL ; +} +EXPORT_SYMBOL_GPL (i3c_device_match_id);
drivers/i3c/internals.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018 Cadence Design Systems Inc. +* +* Author: Boris Brezillon <[email protected]> +*/ + +#ifndef I3C_INTERNALS_H +#define I3C_INTERNALS_H + +#include <linux/i3c/master.h> + +extern struct bus_type i3c_bus_type; + +void i3c_bus_normaluse_lock (struct i3c_bus *bus); +void i3c_bus_normaluse_unlock (struct i3c_bus *bus); + +int i3c_dev_do_priv_xfers_locked (struct i3c_dev_desc *dev, +struct i3c_priv_xfer *xfers, +int nxfers); +int i3c_dev_disable_ibi_locked (struct i3c_dev_desc *dev); +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); +#endif /* I3C_INTERNAL_H */
drivers/i3c/master.c new file +2066 -0
2,066 lines not on this page · raw message
drivers/i3c/master/dw-i3c-master.c new file +1002 -0
646 lines not on this page · raw message
include/dw-i3c.h new file +248 -0
248 lines not on this page · raw message
include/linux/i3c/ccc.h new file +385 -0
385 lines not on this page · raw message
include/linux/i3c/device.h new file +286 -0
286 lines not on this page · raw message
include/linux/i3c/master.h new file +697 -0
697 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.26.2
Part of the diff is not shown here. View the raw message.
PATCH RESEND v2 3/13 drivers: i3c: Add i3c uclass driver.
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable i3c general uclass driver. This uclass driver will have genaral read and write api to call the specific i3c driver.
--- drivers/i3c/i3c-uclass.c | 38 ++++++++++++++++++++++++ include/dw-i3c.h | 1 + include/i3c.h | 63 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 drivers/i3c/i3c-uclass.c create mode 100644 include/i3c.h
drivers/i3c/i3c-uclass.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2025 Altera Corporation <www.altera.com> +*/ + +#include <dm.h> +#include <i3c.h> +#include <errno.h> +#include <log.h> +#include <dm/device-internal.h> +#include <linux/ctype.h> + +int dm_i3c_read (struct udevice *dev,u8 dev_number, +u8 *buf,int num_bytes) +{ +struct dm_i3c_ops *ops =i3c_get_ops (dev); + +if (!ops->read) +return -ENOSYS ; + +return ops->read (dev, dev_number, buf, num_bytes); +} + +int dm_i3c_write (struct udevice *dev,u8 dev_number, +u8 *buf,int num_bytes) +{ +struct dm_i3c_ops *ops =i3c_get_ops (dev); + +if (!ops->write) +return -ENOSYS ; + +return ops->write (dev, dev_number, buf, num_bytes); +} + +UCLASS_DRIVER (i3c) = { + .id =UCLASS_I3C , + .name ="i3c" , +};
include/dw-i3c.h +1 -0
@@ -7,6 +7,7 @@#define _DW_I3C_H_#include <clk.h> +#include <i3c.h> #include <reset.h> #include <dm/device.h> #include <linux/bitops.h>
include/i3c.h new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH RESEND v2 4/13 drivers: Enabled Kconfig and Makefile for i3c support
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Add new i3c driver to U-Boot drivers.
--- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/i3c/Kconfig | 16 ++++++++++++++++ drivers/i3c/Makefile | 3 +++ 4 files changed, 22 insertions(+) create mode 100755 drivers/i3c/Kconfig create mode 100755 drivers/i3c/Makefile
drivers/Kconfig +2 -0
@@ -56,6 +56,8 @@ source "drivers/hwspinlock/Kconfig" source "drivers/i2c/Kconfig" +source "drivers/i3c/Kconfig" + source "drivers/input/Kconfig" source "drivers/iommu/Kconfig"
drivers/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_$(PHASE_)DRIVERS_MISC) += misc/ obj-$(CONFIG_$(PHASE_)SYSRESET) += sysreset/ obj-$(CONFIG_$(PHASE_)FIRMWARE) +=firmware/ obj-$(CONFIG_$(PHASE_)I2C) += i2c/ +obj-$(CONFIG_$(PHASE_)I3C) += i3c/ obj-$(CONFIG_$(PHASE_)INPUT) += input/ obj-$(CONFIG_$(PHASE_)LED) += led/ obj-$(CONFIG_$(PHASE_)MMC) += mmc/
drivers/i3c/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +menuconfig I3C + tristate "I3C support" + select I2C + help + I3C is a serial protocol standardized by the MIPI alliance. + + It's supposed to be backward compatible with I2C while providing + support for high speed transfers and native interrupt support + without the need for extra pins. + + The I3C protocol also standardizes the slave device types and is + mainly designed to communicate with sensors. + + If you want I3C support, you should say Y here and also to the + specific driver for your bus adapter(s) below. +
drivers/i3c/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y := i3c-uclass.o device.o master.o
Signature · 1 line
2.26.2
Re: [resend v2 04/13] drivers: Enabled Kconfig and Makefile for i3c support
Quoted 5 lines · On Fri, Mar 14, 2025 at 12:08:53PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add new i3c driver to U-Boot drivers.
Signed-off-by Dinesh Maniyam <[email protected]>
Quoted 8 lines
--- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/i3c/Kconfig | 16 ++++++++++++++++ drivers/i3c/Makefile | 3 +++ 4 files changed, 22 insertions(+) create mode 100755 drivers/i3c/Kconfig create mode 100755 drivers/i3c/Makefile
In this patch you should update the top-level MAINTAINERS file and list I3C and list yourself there.
Signature · 1 line
Tom
RE: [resend v2 04/13] drivers: Enabled Kconfig and Makefile for i3c support
Quoted 40 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:53 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 04/13] drivers: EnabledKconfigandMakefilefor i3c supportQuoted 5 lines · On Fri, Mar 14, 2025 at 12:08:53PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add new i3c driver to U-Boot drivers.
Signed-off-by Dinesh Maniyam <[email protected]>Quoted 8 lines
--- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/i3c/Kconfig | 16 ++++++++++++++++ drivers/i3c/Makefile | 3 +++ 4 files changed, 22 insertions(+) create mode 100755 drivers/i3c/Kconfig create mode 100755
drivers/i3c/Makefile
Quoted 5 lines
In this patch you should update the top-level
MAINTAINERSfile and list I3C and list yourself there.--
Tom
Noted.
I will rework to update the MAINTAINER file.
Dinesh
PATCH RESEND v2 5/13 drivers: i3c: Enabled Kconfig and Makefile for DWI3C
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable the Kconfig and Makefile for the MIPI DWI3C driver.
--- drivers/i3c/Kconfig | 3 +++ drivers/i3c/Makefile | 1 + drivers/i3c/master/Kconfig | 11 +++++++++++ drivers/i3c/master/Makefile | 3 +++ 4 files changed, 18 insertions(+) create mode 100755 drivers/i3c/master/Kconfig create mode 100755 drivers/i3c/master/Makefile
drivers/i3c/Kconfig +3 -0
@@ -14,3 +14,6 @@ menuconfig I3C If you want I3C support, you should say Y here and also to the specific driver for your bus adapter(s) below. +if I3C +source "drivers/i3c/master/Kconfig" +endif # I3C
drivers/i3c/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-y := i3c-uclass.o device.o master.o +obj-y += master/
drivers/i3c/master/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +config DW_I3C_MASTER + tristate "Synospsys DesignWare I3C master driver" + depends on I3C + help + Support for Synopsys DesignWare MIPI I3C Controller. + + For details please see + https://www.synopsys.com/dw/ipdir.php?ds=mipi_i3c + + This driver can also be built as a module. If so, the module + will be called dw-i3c-master.
drivers/i3c/master/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
Signature · 1 line
2.26.2
Re: [resend v2 05/13] drivers: i3c: Enabled Kconfig and Makefile for DWI3C
Quoted 19 lines · On Fri, Mar 14, 2025 at 12:08:54PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable the
KconfigandMakefilefor the MIPI DWI3C driver.Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/i3c/Kconfig | 3 +++ drivers/i3c/Makefile | 1 + drivers/i3c/master/Kconfig | 11 +++++++++++ drivers/i3c/master/Makefile | 3 +++ 4 files changed, 18 insertions(+) create mode 100755 drivers/i3c/master/Kconfig create mode 100755 drivers/i3c/master/Makefiledrivers/i3c/Kconfig +0
-0
drivers/i3c/Kconfig menuconfig I3C · line 19
Quoted 6 lines
drivers/i3c/Kconfig +3
-0@@ -14,3 +14,6 @@ menuconfig I3C If you want I3C support, you should say Y here and also to the specific driver for your bus adapter(s) below. +if I3C +source "drivers/i3c/master/Kconfig" +endif # I3C
We should have empty lines around if / endif here.
Signature · 1 line
Tom
RE: [resend v2 05/13] drivers: i3c: Enabled Kconfig and Makefile for DWI3C
Quoted 48 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:53 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 05/13] drivers: i3c: EnabledKconfigandMakefilefor DWI3CQuoted 22 lines · On Fri, Mar 14, 2025 at 12:08:54PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable the
KconfigandMakefilefor the MIPI DWI3C driver.Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/i3c/Kconfig | 3 +++ drivers/i3c/Makefile | 1 + drivers/i3c/master/Kconfig | 11 +++++++++++ drivers/i3c/master/Makefile | 3 +++ 4 files changed, 18 insertions(+) create mode 100755 drivers/i3c/master/Kconfig create mode 100755
drivers/i3c/master/Makefiledrivers/i3c/Kconfig index renamed from drivers/i3c/Kconfig +0
-0
fa68612787b..8140b530bb5100755drivers/i3c/Kconfig +0
-0@@ -14,3 +14,6 @@ menuconfig I3C If you want I3C support, you should say Y here and also to the specific driver for your bus adapter(s) below.
Quoted 8 lines
drivers/i3c/Kconfig menuconfig I3C · line 19
Quoted 3 lines
drivers/i3c/Kconfig +3
-0+if I3C +source "drivers/i3c/master/Kconfig" +endif # I3CWe should have empty lines around if / endif here.
--
Tom
Noted.
I will add the empty lines for if /endif here.
Dinesh
PATCH RESEND v2 6/13 drivers: i3c: Add i3c sandbox simple test.
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Add s simple test for the I3C uclass in sandbox.
--- arch/sandbox/dts/test.dts | 8 ++++++ drivers/i3c/Kconfig | 6 ++++ drivers/i3c/Makefile | 1 + drivers/i3c/sandbox_i3c.c | 58 +++++++++++++++++++++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/i3c.c | 34 +++++++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100755 drivers/i3c/sandbox_i3c.c create mode 100755 test/dm/i3c.c
arch/sandbox/dts/test.dts +8 -0
@@ -935,6 +935,14 @@ }; }; + i3c0 { + compatible = "sandbox,i3c"; + }; + + i3c1 { + compatible = "sandbox,i3c"; + }; + bootcount@0 { compatible = "u-boot,bootcount-rtc"; rtc = <&rtc_1>;
drivers/i3c/Kconfig +6 -0
@@ -14,6 +14,12 @@ menuconfig I3C If you want I3C support, you should say Y here and also to the specific driver for your bus adapter(s) below. +config I3C_SANDBOX + bool "Enable support for the sandbox I3C" + help + This is a sandbox I3C used for testing. It provides 2 interfaces and + records the settings passed into it. + if I3C source "drivers/i3c/master/Kconfig" endif # I3C
drivers/i3c/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-y := i3c-uclass.o device.o master.o obj-y += master/ +obj-$(CONFIG_I3C_SANDBOX) += sandbox_i3c.o
drivers/i3c/sandbox_i3c.c new file +58 -0
58 lines not on this page · raw message
test/dm/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_FWU_MDATA_GPT_BLK) += fwu_mdata.o obj-$(CONFIG_SANDBOX) += host.o obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o obj-$(CONFIG_DM_I2C) += i2c.o +obj-$(CONFIG_I3C) += i3c.o obj-$(CONFIG_SOUND) += i2s.o obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o obj-$(CONFIG_IOMMU) += iommu.o
test/dm/i3c.c new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2025 Altera Corporation <www.altera.com> +*/ + +#include <dm.h> +#include <i3c.h> +#include <dm/test.h> +#include <test/ut.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/* Basic test of the i3c uclass */ +static int dm_test_i3c_base (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_get_device (UCLASS_I3C ,0 , &dev)); +ut_assertok (dm_i3c_read (dev,0 ,NULL ,1 )); +ut_assertok (dm_i3c_read (dev,0 ,NULL ,4 )); +ut_assertok (dm_i3c_write (dev,0 ,"AABB" ,2 )); +ut_assertok (dm_i3c_write (dev,0 ,"AABBCCDD" ,4 )); + +ut_assertok (uclass_get_device (UCLASS_I3C ,1 , &dev)); +ut_assertok (dm_i3c_read (dev,1 ,NULL ,1 )); +ut_assertok (dm_i3c_read (dev,1 ,NULL ,4 )); +ut_assertok (dm_i3c_write (dev,1 ,"AABB" ,2 )); +ut_assertok (dm_i3c_write (dev,1 ,"AABBCCDD" ,4 )); + +ut_asserteq (-ENODEV ,uclass_get_device (UCLASS_I3C ,2 , &dev)); + +return 0 ; +} +DM_TEST (dm_test_i3c_base,UTF_SCAN_PDATA |UTF_SCAN_FDT );
Signature · 1 line
2.26.2
Re: [resend v2 06/13] drivers: i3c: Add i3c sandbox simple test.
Quoted 5 lines · On Fri, Mar 14, 2025 at 12:08:55PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add s simple test for the I3C uclass in sandbox.
Signed-off-by Dinesh Maniyam <[email protected]>
[snip]
Quoted 7 lines
drivers/i3c/sandbox_i3c.c new file +1
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0
drivers/i3c/sandbox_i3c.c line 11
Quoted 10 lines
drivers/i3c/sandbox_i3c.c new file +10
-0+/* +* Copyright (C) 2025 Altera Corporation <www.altera.com> +*/ + +#include <dm.h> +#include <errno.h> +#include <i3c.h> +#include <linux/i3c/master.h> + +DECLARE_GLOBAL_DATA_PTR ;
Here and elsewhere in the series, audit for adding DECLARE_GLOBAL_DATA_PTR without a "gd->" in the code.
Signature · 1 line
Tom
RE: [resend v2 06/13] drivers: i3c: Add i3c sandbox simple test.
Quoted 50 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:53 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 06/13] drivers: i3c: Add i3c sandbox simple test.Quoted 5 lines · On Fri, Mar 14, 2025 at 12:08:55PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add s simple test for the I3C uclass in sandbox.
Signed-off-by Dinesh Maniyam <[email protected]>[snip]
Quoted 5 lines
drivers/i3c/sandbox_i3c.c new renamed from drivers/i3c/sandbox_i3c.c +0
-0file mode 100755 index 00000000000..99ce769988d
drivers/i3c/sandbox_i3c.c line 10
Quoted 10 lines
drivers/i3c/sandbox_i3c.c new file +10
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2025 Altera Corporation <www.altera.com> */ + +#include <dm.h> +#include <errno.h> +#include <i3c.h> +#include <linux/i3c/master.h> + +DECLARE_GLOBAL_DATA_PTR ;Here and elsewhere in the series, audit for adding
DECLARE_GLOBAL_DATA_PTRwithout a "gd->" in the code.
Quoted 2 lines
--
Tom
Apologies. I shall remove the DECLARE_GLOBAL_DATA_PTR because there is no usage of gd-> in the code. Thanks.
Dinesh
PATCH RESEND v2 7/13 drivers: i3c: master: Enable probe i3c without slave device
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Picked linux i3c driver upstraming patch to fix the issue to probe for i3c controller without slave device attached. With this fix, the ret check will be on command error and will success without slave device attached.
--- drivers/i3c/master.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/i3c/master.c +6 -0
@@ -454,6 +454,9 @@ static int i3c_master_rstdaa_locked(struct i3c_master_controller *master,i3c_ccc_cmd_dest_cleanup (&dest); +if (ret) + ret = cmd.err; +return ret; }
@@ -509,6 +512,9 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master, ret =i3c_master_send_ccc_cmd_locked (master, &cmd);i3c_ccc_cmd_dest_cleanup (&dest); +if (ret) + ret = cmd.err; +return ret; }
Signature · 1 line
2.26.2
PATCH RESEND v2 8/13 i3c: master: dw-i3c-master: Fix OD_TIMING for spike filter
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Fix the I3C device with spike filter unable to detect issue by setting tHIGH_INIT to 200ns for first broadcast address.
This is according to MIPI SPEC 1.1.1 for first broadcast address which is already part of linux upstreamed patch.
--- drivers/i3c/master/dw-i3c-master.c | 23 +++++++++++++++++++++++ include/dw-i3c.h | 1 + include/linux/i3c/master.h | 1 + 3 files changed, 25 insertions(+)
drivers/i3c/master/dw-i3c-master.c +23 -0
@@ -330,6 +330,14 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)if (hcnt <SCL_I3C_TIMING_CNT_MIN ) hcnt =SCL_I3C_TIMING_CNT_MIN ; +/* set back to THIGH_MAX_NS, after disable spike filter */ +if (!master->first_broadcast) { + lcnt =SCL_I3C_TIMING_LCNT (readl (master->regs +SCL_I3C_OD_TIMING )); + scl_timing =SCL_I3C_TIMING_HCNT (hcnt) | lcnt; +writel (scl_timing, master->regs +SCL_I3C_OD_TIMING ); +return 0 ; + } + lcnt =DIV_ROUND_UP (core_rate, master->base.bus.scl_rate.i3c) - hcnt;if (lcnt <SCL_I3C_TIMING_CNT_MIN ) lcnt =SCL_I3C_TIMING_CNT_MIN ;
@@ -347,6 +355,9 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master) lcnt =max_t (u8,DIV_ROUND_UP (I3C_BUS_TLOW_OD_MIN_NS , core_period), lcnt); +/* first broadcast thigh to 200ns, to disable spike filter */ + hcnt =DIV_ROUND_UP (I3C_BUS_THIGH_INIT_OD_MIN_NS , core_period); + scl_timing =SCL_I3C_TIMING_HCNT (hcnt) |SCL_I3C_TIMING_LCNT (lcnt);writel (scl_timing, master->regs +SCL_I3C_OD_TIMING );
@@ -402,6 +413,9 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)u32 thld_ctrl;int ret; +/* first broadcast to disable spike filter */ + master->first_broadcast = true; +switch (bus->mode) {case I3C_BUS_MODE_MIXED_FAST :case I3C_BUS_MODE_MIXED_LIMITED :
@@ -481,6 +495,15 @@ static void dw_i3c_master_irq_handler(struct dw_i3c_master *master)if (status &INTR_TRANSFER_ERR_STAT )writel (INTR_TRANSFER_ERR_STAT , master->regs +INTR_STATUS ); +/* set back to THIGH_MAX_NS, after disable spike filter */ +if (master->first_broadcast) { + master->first_broadcast = false; +int ret =dw_i3c_clk_cfg (master); + +if (ret) +pr_err ("Failed to set clk cfg\n" ); + } +spin_unlock (&master->xferqueue.lock); }
include/dw-i3c.h +1 -0
@@ -240,6 +240,7 @@ struct dw_i3c_master {char version[5 ];char type[5 ];u8 addrs[MAX_DEVS ]; +bool first_broadcast; };struct dw_i3c_i2c_dev_data {
include/linux/i3c/master.h +1 -0
@@ -278,6 +278,7 @@ struct i3c_device {#define I3C_BUS_I2C_FM_PLUS_SCL_RATE 1000000#define I3C_BUS_I2C_FM_SCL_RATE 400000#define I3C_BUS_TLOW_OD_MIN_NS 200 +#define I3C_BUS_THIGH_INIT_OD_MIN_NS 200/** * enum i3c_bus_mode - I3C bus mode
Signature · 1 line
2.26.2
PATCH RESEND v2 9/13 cmd: Add i3c command support.
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Add i3c command file to support select, get i3c device target list, read and write operation.
--- cmd/i3c.c | 193 +++++++++++++++++++++++++++++ doc/usage/cmd/i3c.rst | 98 +++++++++++++++ drivers/i3c/master/dw-i3c-master.c | 35 +++++- include/dw-i3c.h | 2 + include/i3c.h | 4 + 5 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 cmd/i3c.c create mode 100755 doc/usage/cmd/i3c.rst
cmd/i3c.c new file +193 -0
@@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright 2023 Intel Coporation. +*/ + +#include <bootretry.h> +#include <cli.h> +#include <command.h> +#include <console.h> +#include <dm.h> +#include <dw-i3c.h> +#include <edid.h> +#include <errno.h> +#include <log.h> +#include <malloc.h> +#include <asm/byteorder.h> +#include <linux/compiler.h> +#include <linux/delay.h> +#include <u-boot/crc.h> +#include <linux/i3c/master.h> + +static struct udevice *currdev; +static struct udevice *prevdev; +static struct dw_i3c_master *master; + +void low_to_high_bytes (void *data,size_t size) +{ +unsigned char *byte_data = (unsigned char *)data; +size_t start =0 ; +size_t end = size -1 ; + +while (start < end) { +unsigned char temp = byte_data[start]; + + byte_data[start] = byte_data[end]; + byte_data[end] = temp; + start++; + end--; + } +} + +/** +* do_i3c() - Handle the "i3c" command-line command +* @cmdtp: Command data struct pointer +* @flag: Command flag +* @argc: Command-line argument count +* @argv: Array of command-line arguments +* +* Returns zero on success, CMD_RET_USAGE in case of misuse and negative +* on error. +*/ +static int do_i3c (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +struct uclass *uc; +int ret; +struct udevice *dev_list; +u32 length, bytes; +u8 *data; +u8 *rdata; +u8 device_num; + +if (argc >1 ) { + ret =uclass_get_device_by_name (UCLASS_I3C , argv[1 ], &currdev); +if (ret) { +if (!strcmp (argv[1 ],"help" )) +return CMD_RET_USAGE ; + + currdev = prevdev; +if (!currdev) { + ret =uclass_get (UCLASS_I3C , &uc); +if (ret) +return CMD_RET_FAILURE ; + + uclass_foreach_dev(dev_list, uc) +printf ("%s (%s)\n" , dev_list->name, dev_list->driver->name); + +printf ("i3c master controller is not initialized: %s\n" , argv[1 ]); +return CMD_RET_FAILURE ; + } + }else { + master =dev_get_priv (currdev); +printf ("current dev: %s\n" , currdev->name); + prevdev = currdev; + } + }else { +if (!currdev) { +printf ("No i3c device set!\n" ); +return CMD_RET_FAILURE ; + } +printf ("dev: %s\n" , currdev->name); + } + +if (!strcmp (argv[1 ],"list" )) { + ret =uclass_get (UCLASS_I3C , &uc); +if (ret) +return CMD_RET_FAILURE ; + + uclass_foreach_dev(dev_list, uc) +printf ("%s (%s)\n" , dev_list->name, dev_list->driver->name); + } + +if (!strcmp (argv[1 ],"current" )) { +if (!currdev) +printf ("no current dev!\n" ); +else +printf ("current dev: %s\n" , currdev->name); + } + +if ((!strcmp (argv[1 ],"write" )) && !(argv[2 ] ==NULL ) && !(argv[3 ] ==NULL ) && + !(argv[4 ] ==NULL )) { + length =hextoul (argv[3 ],NULL ); + + data = (u8 *)malloc (sizeof (u8) * length); +if (!data) { +debug ("Memory allocation for data failed\n" ); +return -ENOMEM ; + } + + device_num =hextoul (argv[4 ],NULL ); + bytes =hextoul (argv[2 ],NULL ); + +for (int i =0 ; i < length; i++) + data[i] = (u8)((bytes >> (8 * i)) &0xFF ); + +low_to_high_bytes (data, length); + ret =dm_i3c_write (currdev, device_num, data, length); +if (ret) { + ret =CMD_RET_FAILURE ; + goto write_out; + } + } + +if (!strcmp (argv[1 ],"read" ) && !(argv[2 ] ==NULL ) && !(argv[3 ] ==NULL )) { + length =hextoul (argv[2 ],NULL ); + + rdata = (u8 *)malloc (sizeof (u8) * length); +if (!rdata) { +debug ("Memory allocation for rdata failed\n" ); +return -ENOMEM ; + } + + device_num =hextoul (argv[3 ],NULL ); + + ret =dm_i3c_read (currdev, device_num, rdata, length); +if (ret) { + ret =CMD_RET_FAILURE ; + }else { +printf ("Read buff: " ); +for (size_t i =0 ; i < length; ++i) +printf ("%02x" , rdata[i]); + +printf ("\n" ); + } + + goto read_out; + } + +if (!strcmp (argv[1 ],"device_list" )) { +if (master) { +for (int i =0 ; i < master->num_i3cdevs; i++) { +printf ("device:%d\n" , i); +printf ("dynamic address:0x%X\n" , master->i3cdev[i]->info.dyn_addr); +printf ("PID:%llx\n" , master->i3cdev[i]->info.pid); +printf ("BCR:%X\n" , master->i3cdev[i]->info.bcr); +printf ("DCR:%X\n" , master->i3cdev[i]->info.dcr); +printf ("Max Read DS:%X\n" , master->i3cdev[i]->info.max_read_ds); +printf ("Max Write DS:%X\n" , master->i3cdev[i]->info.max_write_ds); +printf ("\n" ); + } + } + } + +return CMD_RET_SUCCESS ; + +read_out: +free (rdata); +return ret; + +write_out: +free (data); +return ret; +} + +U_BOOT_CMD ( + i3c,5 ,1 , do_i3c, +"access the system i3c\n" , +"i3c write<data><length><device_number> - write to device.\n" +"i3c read<length><device_number> - read from device.\n" +"i3c device_list - List valid target devices\n" +"i3c <i3c name> - Select i3c controller.\n" +"i3c list - List all the available i3c controller.\n" +"i3c current - print current i3c controller.\n" +);
doc/usage/cmd/i3c.rst new file +98 -0
98 lines not on this page · raw message
drivers/i3c/master/dw-i3c-master.c +34 -1
@@ -670,8 +670,11 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m) newdevs &= ~olddevs;for (pos =0 ; pos < master->maxdevs; pos++) { -if (newdevs &BIT (pos)) +if (newdevs &BIT (pos)) {i3c_master_add_i3c_dev_locked (m, master->addrs[pos]); + master->i3cdev[pos] = m->this; + master->num_i3cdevs++; + } }dw_i3c_master_free_xfer (xfer);
@@ -1006,8 +1009,38 @@ err_assert_rst:return ret; } +static int dw_i3c_master_priv_read (struct udevice *dev,u8 dev_number, +u8 *buf,int buf_size) +{ +struct dw_i3c_master *master =dev_get_priv (dev); +struct i3c_dev_desc *i3cdev = master->i3cdev[dev_number]; +struct i3c_priv_xfer i3c_xfers; + + i3c_xfers.data.in = buf; + i3c_xfers.len = buf_size; + i3c_xfers.rnw =I3C_MSG_READ ; + +return dw_i3c_master_priv_xfers (i3cdev, &i3c_xfers,1 ); +} + +static int dw_i3c_master_priv_write (struct udevice *dev,u8 dev_number, +u8 *buf,int buf_size) +{ +struct dw_i3c_master *master =dev_get_priv (dev); +struct i3c_dev_desc *i3cdev = master->i3cdev[dev_number]; +struct i3c_priv_xfer i3c_xfers; + + i3c_xfers.data.out = buf; + i3c_xfers.len = buf_size; + i3c_xfers.rnw =I3C_MSG_WRITE ; + +return dw_i3c_master_priv_xfers (i3cdev, &i3c_xfers,1 ); +} +static const struct dm_i3c_ops dw_i3c_ops = { .i3c_xfers = dw_i3c_master_priv_xfers, + .read = dw_i3c_master_priv_read, + .write = dw_i3c_master_priv_write, };static const struct udevice_id dw_i3c_ids[] = {
include/dw-i3c.h +2 -0
@@ -241,6 +241,8 @@ struct dw_i3c_master {char type[5 ];u8 addrs[MAX_DEVS ];bool first_broadcast; +struct i3c_dev_desc *i3cdev[I3C_BUS_MAX_DEVS ]; +u16 num_i3cdevs; };struct dw_i3c_i2c_dev_data {
include/i3c.h +4 -0
@@ -28,6 +28,10 @@ struct dm_i3c_ops {int (*i3c_xfers)(struct i3c_dev_desc *dev,struct i3c_priv_xfer *i3c_xfers,int i3c_nxfers); +int (*read)(struct udevice *dev,u8 dev_number, +u8 *buf,int num_bytes); +int (*write)(struct udevice *dev,u8 dev_number, +u8 *buf,int num_bytes); };#define i3c_get_ops (dev) ((struct dm_i3c_ops *)(dev)->driver->ops)
Signature · 1 line
2.26.2
Re: [resend v2 09/13] cmd: Add i3c command support.
Quoted 6 lines · On Fri, Mar 14, 2025 at 12:08:58PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add i3c command file to support select, get i3c device target list, read and write operation.
Signed-off-by Dinesh Maniyam <[email protected]>
Quoted 9 lines
--- cmd/i3c.c | 193 +++++++++++++++++++++++++++++ doc/usage/cmd/i3c.rst | 98 +++++++++++++++ drivers/i3c/master/dw-i3c-master.c | 35 +++++- include/dw-i3c.h | 2 + include/i3c.h | 4 + 5 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 cmd/i3c.c create mode 100755 doc/usage/cmd/i3c.rst
Please put the series through CI as well as checkpatch.pl. As your new document isn't listed in the index, that will fail. I've not checked for other rST issues.
Signature · 1 line
Tom
RE: [resend v2 09/13] cmd: Add i3c command support.
Quoted 40 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:54 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 09/13] cmd: Add i3c command support.Quoted 6 lines · On Fri, Mar 14, 2025 at 12:08:58PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add i3c command file to support select, get i3c device target list, read and write operation.
Signed-off-by Dinesh Maniyam <[email protected]>Quoted 8 lines
--- cmd/i3c.c | 193 +++++++++++++++++++++++++++++ doc/usage/cmd/i3c.rst | 98 +++++++++++++++ drivers/i3c/master/dw-i3c-master.c | 35 +++++- include/dw-i3c.h | 2 + include/i3c.h | 4 + 5 files changed, 331 insertions(+), 1 deletion(-) create mode 100644
cmd/i3c.ccreate mode 100755doc/usage/cmd/i3c.rst
Quoted 5 lines
Please put the series through CI as well as checkpatch.pl. As your new document isn't listed in the index, that will fail. I've not checked for other rST issues.
--
Tom
Noted.
I will check again and correct it.
Thanks.
Dinesh
PATCH RESEND v2 10/13 cmd: Enabled Kconfig and Makefile for DWI3C cmd support
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable the Kconfig and Makefile for the
DWI3C driver cmd support.
--- cmd/Kconfig | 6 ++++++ cmd/Makefile | 1 + 2 files changed, 7 insertions(+)
cmd/Kconfig +6 -0
@@ -1327,6 +1327,12 @@ config CMD_I2C help I2C support. +config CMD_I3C + bool "i3c" + help + Enable command to list i3c devices connected to the i3c controller + and perform read and write on the connected i3c devices. + config CMD_W1 depends on W1 default y if W1
cmd/Makefile +1 -0
@@ -95,6 +95,7 @@ obj-$(CONFIG_CMD_GPIO) += gpio.o obj-$(CONFIG_CMD_HISTORY) += history.o obj-$(CONFIG_CMD_HVC) += smccc.o obj-$(CONFIG_CMD_I2C) += i2c.o +obj-$(CONFIG_CMD_I3C) += i3c.o obj-$(CONFIG_CMD_IOTRACE) += iotrace.o obj-$(CONFIG_CMD_HASH) += hash.o obj-$(CONFIG_CMD_IDE) += ide.o disk.o
Signature · 1 line
2.26.2
Re: [resend v2 10/13] cmd: Enabled Kconfig and Makefile for DWI3C cmd support
Quoted 10 lines · On Fri, Mar 14, 2025 at 12:08:59PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable the
KconfigandMakefilefor the
DWI3C driver cmd support.Signed-off-by Dinesh Maniyam <[email protected]>--- cmd/Kconfig | 6 ++++++ cmd/Makefile | 1 + 2 files changed, 7 insertions(+)
This should be part of the commit that introduces the code. Please check the series for other places where patches should be refactored to not increase the patch count unnecessarily.
Signature · 1 line
Tom
RE: [resend v2 10/13] cmd: Enabled Kconfig and Makefile for DWI3C cmd support
Quoted 36 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:54 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 10/13] cmd: EnabledKconfigandMakefilefor DWI3C cmd supportQuoted 9 lines · On Fri, Mar 14, 2025 at 12:08:59PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable the
KconfigandMakefilefor the DWI3C driver cmd support.Signed-off-by Dinesh Maniyam <[email protected]>--- cmd/Kconfig | 6 ++++++ cmd/Makefile | 1 + 2 files changed, 7 insertions(+)
Quoted 6 lines
This should be part of the commit that introduces the code. Please check the series for other places where patches should be refactored to not increase the patch count unnecessarily.
--
Tom
Agreed. I will note this to make sure
this commit is a part of the code that introduced the code. I will do the rework.
Thanks.
Dinesh
PATCH RESEND v2 11/13 test: cmd: Add simple test for i3c
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Add simple test to check i3c controller defined in sandbox test DT. Basically, this test case will check validity of the i3c controller by probing it and perform basic commands of cmd/i3c.c
--- test/cmd/Makefile | 1 + test/cmd/i3c.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 test/cmd/i3c.c
test/cmd/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_CMD_PWM) += pwm.o obj-$(CONFIG_CMD_READ) += rw.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o +obj-$(CONFIG_CMD_I3C) += i3c.o ifdef CONFIG_NET obj-$(CONFIG_CMD_WGET) += wget.o endif
test/cmd/i3c.c new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH RESEND v2 12/13 configs: sandbox_defconfig: Enable configs for sandbox i3c
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable configs for sandbox i3c.
--- configs/sandbox_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/sandbox_defconfig +3 -0
@@ -364,3 +364,6 @@ CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y +CONFIG_I3C=y +CONFIG_I3C_SANDBOX=y +CONFIG_CMD_I3C=y
Signature · 1 line
2.26.2
Re: [resend v2 12/13] configs: sandbox_defconfig: Enable configs for sandbox i3c
Quoted 14 lines · On Fri, Mar 14, 2025 at 12:09:01PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable configs for sandbox i3c.
Signed-off-by Dinesh Maniyam <[email protected]>--- configs/sandbox_defconfig | 3 +++ 1 file changed, 3 insertions(+)configs/sandbox_defconfig +0
-0
configs/sandbox_defconfig CONFIG_TEST_FDTDEC=y · line 369
Quoted 6 lines
configs/sandbox_defconfig +3
-0@@ -364,3 +364,6 @@ CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y +CONFIG_I3C=y +CONFIG_I3C_SANDBOX=y +CONFIG_CMD_I3C=y
In both config patches, you need to use "savedefconfig" when adding options, not just adding to the end of the file.
Signature · 1 line
Tom
RE: [resend v2 12/13] configs: sandbox_defconfig: Enable configs for sandbox i3c
Quoted 48 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, 15 March 2025 12:54 am
To: Maniyam, Dinesh <[email protected]>
Cc: [email protected]; Marek <[email protected]>; Simon <[email protected]>; Simon Glass <[email protected]>; Dario Binacchi <[email protected]>; Ilias Apalodimas <[email protected]>; Heinrich Schuchardt <[email protected]>; Jerome Forissier <[email protected]>; Mattijs Korpershoek <[email protected]>; Ibai Erkiaga <[email protected]>; Michal Simek <[email protected]>; Dmitry Rokosov <[email protected]>; Jonas Karlman <[email protected]>; Sebastian Reichel <[email protected]>; Meng, Tingting <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>
Subject: Re: [resend v2 12/13] configs:sandbox_defconfig: Enable configs for sandbox i3cQuoted 15 lines · On Fri, Mar 14, 2025 at 12:09:01PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Enable configs for sandbox i3c.
Signed-off-by Dinesh Maniyam <[email protected]>--- configs/sandbox_defconfig | 3 +++ 1 file changed, 3 insertions(+)configs/sandbox_defconfig +0
-0@@ -364,3 +364,6 @@ CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y
CONFIG_UT_TIME=yCONFIG_UT_DM=yconfigs/sandbox_defconfig CONFIG_TEST_FDTDEC=y · line 369
Quoted 3 lines
configs/sandbox_defconfig +3
-0+CONFIG_I3C=y +CONFIG_I3C_SANDBOX=y +CONFIG_CMD_I3C=yIn both config patches, you need to use "savedefconfig" when adding options, not just adding to the end of the file.
Quoted 2 lines
--
Tom
Noted.
I will take note of this and will rework the commit. Thanks.
Dinesh
PATCH RESEND v2 13/13 configs: agilex5_defconfig: Enable i3c configs for agilex5
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable configs for i3c in agilex5.
--- configs/socfpga_agilex5_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/socfpga_agilex5_defconfig +3 -0
@@ -88,3 +88,6 @@ CONFIG_WDT=y # CONFIG_SPL_USE_TINY_PRINTF is not set CONFIG_PANIC_HANG=y CONFIG_SPL_CRC32=y +CONFIG_I3C=y +CONFIG_DW_I3C_MASTER=y +CONFIG_CMD_I3C=y
Signature · 1 line
2.26.2