public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode
@ 2024-08-26  3:38 Billy Tsai
  2024-08-26  4:02 ` Billy Tsai
  2024-09-06 15:38 ` Alexandre Belloni
  0 siblings, 2 replies; 4+ messages in thread
From: Billy Tsai @ 2024-08-26  3:38 UTC (permalink / raw)
  To: alexandre.belloni, jarkko.nikula, billy_tsai, linux-i3c,
	linux-kernel

Based on the I3C TCRI specification, the rules for determining the I3C
mode are as follows:
I3C SCL rate > 8MHz: use SDR0, with a maximum data rate of 8MHz
I3C SCL rate > 6MHz: use SDR1, with a maximum data rate of 6MHz
I3C SCL rate > 4MHz: use SDR2, with a maximum data rate of 4MHz
I3C SCL rate > 2MHz: use SDR3, with a maximum data rate of 2MHz
Otherwise, use SDR4

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Change-Id: If0e1100ca601c8a2f96ecbcc0f74e6fdb5e273df
---
 drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
index 638b054d6c92..dd636094b07f 100644
--- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
+++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
@@ -123,17 +123,15 @@ static enum hci_cmd_mode get_i3c_mode(struct i3c_hci *hci)
 {
 	struct i3c_bus *bus = i3c_master_get_bus(&hci->master);
 
-	if (bus->scl_rate.i3c >= 12500000)
-		return MODE_I3C_SDR0;
 	if (bus->scl_rate.i3c > 8000000)
-		return MODE_I3C_SDR1;
+		return MODE_I3C_SDR0;
 	if (bus->scl_rate.i3c > 6000000)
-		return MODE_I3C_SDR2;
+		return MODE_I3C_SDR1;
 	if (bus->scl_rate.i3c > 4000000)
-		return MODE_I3C_SDR3;
+		return MODE_I3C_SDR2;
 	if (bus->scl_rate.i3c > 2000000)
-		return MODE_I3C_SDR4;
-	return MODE_I3C_Fm_FmP;
+		return MODE_I3C_SDR3;
+	return MODE_I3C_SDR4;
 }
 
 static enum hci_cmd_mode get_i2c_mode(struct i3c_hci *hci)
-- 
2.25.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode
  2024-08-26  3:38 [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode Billy Tsai
@ 2024-08-26  4:02 ` Billy Tsai
  2024-09-05  5:50   ` Mukesh Kumar Savaliya
  2024-09-06 15:38 ` Alexandre Belloni
  1 sibling, 1 reply; 4+ messages in thread
From: Billy Tsai @ 2024-08-26  4:02 UTC (permalink / raw)
  To: alexandre.belloni@bootlin.com, jarkko.nikula@linux.intel.com,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org

> Based on the I3C TCRI specification, the rules for determining the I3C
> mode are as follows:
> I3C SCL rate > 8MHz: use SDR0, with a maximum data rate of 8MHz
> I3C SCL rate > 6MHz: use SDR1, with a maximum data rate of 6MHz
> I3C SCL rate > 4MHz: use SDR2, with a maximum data rate of 4MHz
> I3C SCL rate > 2MHz: use SDR3, with a maximum data rate of 2MHz
> Otherwise, use SDR4

Sorry, the description of the commit message is wrong.
I will change it to 
I3C SCL rate > 8MHz: use SDR0, as SDR1 has a maximum data rate of 8MHz
I3C SCL rate > 6MHz: use SDR1, as SDR2 has a maximum data rate of 8MHz
I3C SCL rate > 4MHz: use SDR2, as SDR3 has a maximum data rate of 8MHz
I3C SCL rate > 2MHz: use SDR3, as SDR4 has a maximum data rate of 8MHz
I3C SCL rate <= 2MHz: use SDR4
and send the v2 patch
-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode
  2024-08-26  4:02 ` Billy Tsai
@ 2024-09-05  5:50   ` Mukesh Kumar Savaliya
  0 siblings, 0 replies; 4+ messages in thread
From: Mukesh Kumar Savaliya @ 2024-09-05  5:50 UTC (permalink / raw)
  To: Billy Tsai, alexandre.belloni@bootlin.com,
	jarkko.nikula@linux.intel.com, linux-i3c@lists.infradead.org,
	linux-kernel@vger.kernel.org


Hi Billy,

On 8/26/2024 9:32 AM, Billy Tsai wrote:
>> Based on the I3C TCRI specification, the rules for determining the I3C
>> mode are as follows:
>> I3C SCL rate > 8MHz: use SDR0, with a maximum data rate of 8MHz
>> I3C SCL rate > 6MHz: use SDR1, with a maximum data rate of 6MHz
>> I3C SCL rate > 4MHz: use SDR2, with a maximum data rate of 4MHz
>> I3C SCL rate > 2MHz: use SDR3, with a maximum data rate of 2MHz
>> Otherwise, use SDR4
> 
> Sorry, the description of the commit message is wrong.
> I will change it to
> I3C SCL rate > 8MHz: use SDR0, as SDR1 has a maximum data rate of 8MHz
> I3C SCL rate > 6MHz: use SDR1, as SDR2 has a maximum data rate of 8MHz
> I3C SCL rate > 4MHz: use SDR2, as SDR3 has a maximum data rate of 8MHz
> I3C SCL rate > 2MHz: use SDR3, as SDR4 has a maximum data rate of 8MHz
> I3C SCL rate <= 2MHz: use SDR4
> and send the v2 patch
Seems some typo errors, you mentioned all the modes having maximum data 
rate of 8MHz. "has a maximum data rate of 8MHz"

I3C TCRI Specification (in [MIPI06] Section 7.1.1.1) :
MODE 	Listed Speed 	Maximum Sustainable Data Rate
0x0 	I3C SDR0 	12.5 MHz, Standard SDR Speed, fSCL Max
0x1 	I3C SDR1 	8 MHz
0x2 	I3C SDR2 	6 MHz
0x3 	I3C SDR3 	4 MHz
0x4 	I3C SDR4 	2 MHz

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode
  2024-08-26  3:38 [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode Billy Tsai
  2024-08-26  4:02 ` Billy Tsai
@ 2024-09-06 15:38 ` Alexandre Belloni
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2024-09-06 15:38 UTC (permalink / raw)
  To: jarkko.nikula, linux-i3c, linux-kernel, Billy Tsai

On Mon, 26 Aug 2024 11:38:21 +0800, Billy Tsai wrote:
> Based on the I3C TCRI specification, the rules for determining the I3C
> mode are as follows:
> I3C SCL rate > 8MHz: use SDR0, with a maximum data rate of 8MHz
> I3C SCL rate > 6MHz: use SDR1, with a maximum data rate of 6MHz
> I3C SCL rate > 4MHz: use SDR2, with a maximum data rate of 4MHz
> I3C SCL rate > 2MHz: use SDR3, with a maximum data rate of 2MHz
> Otherwise, use SDR4
> 
> [...]

Applied, after fixing the commit log

[1/1] i3c/master: cmd_v1: Fix the rule for getting i3c mode
      https://git.kernel.org/abelloni/c/061dd21ca712

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-06 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  3:38 [PATCH v1] i3c/master: cmd_v1: Fix the rule for getting i3c mode Billy Tsai
2024-08-26  4:02 ` Billy Tsai
2024-09-05  5:50   ` Mukesh Kumar Savaliya
2024-09-06 15:38 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox