Skip to contentSkip to conversation

i3c: master: support to adjust first broadcast address speed

PATCH Superseded [email protected] 3 participants 6 messages Aug 26, 2024 – Sep 5, 2024

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 i3c: master: support to adjust first broadcast address speed

From: Carlos Song <[email protected]>

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

---
 drivers/i3c/master.c       | 12 ++++++++++++
 include/linux/i3c/master.h | 16 ++++++++++++++++
 2 files changed, 28 insertions(+)
drivers/i3c/master.c +12 -0
index 7028f03c2c42..6f3eb710a75d 100644
@@ -1868,6 +1868,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 		goto err_bus_cleanup;
 	}
 
+	if (master->ops->set_speed) {
+		ret = master->ops->set_speed(master, I3C_OPEN_DRAIN_SLOW_SPEED);
+		if (ret)
+			goto err_bus_cleanup;
+	}
+
 	/*
 	 * Reset all dynamic address that may have been assigned before
 	 * (assigned by the bootloader for example).
@@ -1876,6 +1882,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 	if (ret && ret != I3C_ERROR_M2)
 		goto err_bus_cleanup;
 
+	if (master->ops->set_speed) {
+		master->ops->set_speed(master, I3C_OPEN_DRAIN_NORMAL_SPEED);
+		if (ret)
+			goto err_bus_cleanup;
+	}
+
 	/* Disable all slave events before starting DAA. */
 	ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR,
 				      I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
include/linux/i3c/master.h +16 -0
index 074f632868d9..2a1ed05d5782 100644
@@ -277,6 +277,20 @@ enum i3c_bus_mode {
 	I3C_BUS_MODE_MIXED_SLOW,
 };
 
+/**
+ * enum i3c_open_drain_speed - I3C open-drain speed
+ * @I3C_OPEN_DRAIN_SLOW_SPEED: Slow open-drain speed for sending the first
+ *				broadcast address. The first broadcast address at this speed
+ *				will be visible to all devices on the I3C bus. I3C devices
+ *				working in I2C mode will turn off their spike filter when
+ *				switching into I3C mode.
+ * @I3C_OPEN_DRAIN_NORMAL_SPEED: Normal open-drain speed in I3C bus mode.
+ */
+enum i3c_open_drain_speed {
+	I3C_OPEN_DRAIN_SLOW_SPEED,
+	I3C_OPEN_DRAIN_NORMAL_SPEED,
+};
+
 /**
  * enum i3c_addr_slot_status - I3C address slot status
  * @I3C_ADDR_SLOT_FREE: address is free
@@ -436,6 +450,7 @@ struct i3c_bus {
  *		      NULL.
  * @enable_hotjoin: enable hot join event detect.
  * @disable_hotjoin: disable hot join event detect.
+ * @set_speed: adjust I3C open drain mode timing.
  */
 struct i3c_master_controller_ops {
 	int (*bus_init)(struct i3c_master_controller *master);
@@ -464,6 +479,7 @@ struct i3c_master_controller_ops {
 				 struct i3c_ibi_slot *slot);
 	int (*enable_hotjoin)(struct i3c_master_controller *master);
 	int (*disable_hotjoin)(struct i3c_master_controller *master);
+	int (*set_speed)(struct i3c_master_controller *master, enum i3c_open_drain_speed speed);
 };
 
 /**
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw

Hi Carlos,

[email protected] wrote on Mon, 26 Aug 2024 13:09:57 +0800:

Quoted 10 lines

From: Carlos Song <[email protected]>

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

Frank, did you test it with eg. the Silvaco master?

Thanks,
Miquèl

maintainer
#2 lore raw
Quoted 12 lines · Miquel Raynal

Hi Carlos,

[email protected] wrote on Mon, 26 Aug 2024 13:09:57 +0800:

Quoted 8 lines

From: Carlos Song <[email protected]>

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

Quoted 6 lines
Quoted 2 lines

Frank, did you test it with eg. the Silvaco master?

This problem only existed on one board with specific i2c devices. I have not such boards in hand. Carlos work closely with me and tested by our test team.

Frank

Quoted 3 lines

Thanks,
Miquèl

#3 lore raw

Hi Frank,

[email protected] wrote on Mon, 26 Aug 2024 12:04:44 -0400:

Quoted 16 lines · Miquel Raynal
Quoted 15 lines

Hi Carlos,

[email protected] wrote on Mon, 26 Aug 2024 13:09:57 +0800:

Quoted 10 lines

From: Carlos Song <[email protected]>

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

Quoted 7 lines
Quoted 3 lines

Frank, did you test it with eg. the Silvaco master?

This problem only existed on one board with specific i2c devices. I have not such boards in hand. Carlos work closely with me and tested by our test team.

I understand you may not experience the problem, but the solution must not disturb setups without the problem either. That's why I was asking.

Thanks,
Miquèl

maintainer
#4 lore raw
In reply to Miquel Raynal
Quoted 6 lines · Miquel Raynal

Hi Carlos,

[email protected] wrote on Mon, 26 Aug 2024 13:09:57 +0800:

Quoted 2 lines

From: Carlos Song <[email protected]>

carlos:

I just realize you missed sent out svc implement.

https://lore.kernel.org/linux-i3c/[email protected]/T/#u

Suppose both patches should send out together.

Frank

Quoted 20 lines
Quoted 8 lines

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

Frank, did you test it with eg. the Silvaco master?

Thanks,
Miquèl

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

#5 lore raw
Quoted 22 lines

-----Original Message-----
From: Frank Li <[email protected]>
Sent: Thursday, September 5, 2024 3:08 AM
To: Miquel Raynal <[email protected]>
Cc: Carlos Song <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3] i3c: master: support to adjust first broadcast address speed

Quoted 6 lines · Miquel Raynal

Hi Carlos,

[email protected] wrote on Mon, 26 Aug 2024 13:09:57 +0800:

Quoted 2 lines

From: Carlos Song <[email protected]>

carlos:

Quoted 9 lines

I just realize you missed sent out svc implement.

https://lore.kernel.org/linux-i3c/20240807061306.3143528-2-carlos.song@nxp.
com/T/#u

Suppose both patches should send out together.

Frank

Sorry for this. I will send both again together.

Quoted 20 lines
Quoted 20 lines
Quoted 8 lines

According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back.

Frank, did you test it with eg. the Silvaco master?

Thanks,
Miquèl

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c