Skip to contentSkip to conversation

i2c: rtl9300: add support for 50 kHz and 2.5 MHz bus speeds

PATCH Applied Jan Kantert 3 participants 3 messages Feb 27 – Apr 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: rtl9300: add support for 50 kHz and 2.5 MHz bus speeds

Some SFP modules on certain switches (for example the ONTi ONT-S508CL-8S and XikeStor SKS8300-8X) exhibit unreliable I2C communication at the currently supported speeds. Add support for 50 kHz and 2.5 MHz I2C bus modes on the RTL9300 to improve compatibility with these devices.

---
 drivers/i2c/busses/i2c-rtl9300.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-rtl9300.c +14 -2
index 672cb978066d..67a5c4228fc9 100644
@@ -11,10 +11,16 @@
 #include <linux/unaligned.h>
 
 enum rtl9300_bus_freq {
-	RTL9300_I2C_STD_FREQ,
-	RTL9300_I2C_FAST_FREQ,
+	RTL9300_I2C_STD_FREQ,			// 100kHz
+	RTL9300_I2C_FAST_FREQ,			// 400kHz
+	RTL9300_I2C_SUPER_FAST_FREQ,		// 2.5MHz
+	RTL9300_I2C_SLOW_FREQ,			// 50kHz
 };
 
+#define RTL9300_I2C_MAX_SUPER_FAST_FREQ		2500000
+#define RTL9300_I2C_MAX_SLOW_FREQ		50000
+
+
 struct rtl9300_i2c;
 
 struct rtl9300_i2c_chan {
@@ -433,6 +439,12 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
 		case I2C_MAX_FAST_MODE_FREQ:
 			chan->bus_freq = RTL9300_I2C_FAST_FREQ;
 			break;
+		case RTL9300_I2C_MAX_SUPER_FAST_FREQ:
+			chan->bus_freq = RTL9300_I2C_SUPER_FAST_FREQ;
+			break;
+		case RTL9300_I2C_MAX_SLOW_FREQ:
+			chan->bus_freq = RTL9300_I2C_SLOW_FREQ;
+			break;
 		default:
 			dev_warn(i2c->dev, "SDA%d clock-frequency %d not supported using default\n",
 				 sda_num, clock_freq);
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Jan,

Quoted 6 lines · Jan Kantert

Some SFP modules on certain switches (for example the ONTi ONT-S508CL-8S and XikeStor SKS8300-8X) exhibit unreliable I2C communication at the currently supported speeds. Add support for 50 kHz and 2.5 MHz I2C bus modes on the RTL9300 to improve compatibility with these devices.

Thanks,

Quoted 40 lines
---
  drivers/i2c/busses/i2c-rtl9300.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-rtl9300.c +14 -2
index 672cb978066d..67a5c4228fc9 100644
@@ -11,10 +11,16 @@
  #include <linux/unaligned.h>
 
  enum rtl9300_bus_freq {
-	RTL9300_I2C_STD_FREQ,
-	RTL9300_I2C_FAST_FREQ,
+	RTL9300_I2C_STD_FREQ,			// 100kHz
+	RTL9300_I2C_FAST_FREQ,			// 400kHz
+	RTL9300_I2C_SUPER_FAST_FREQ,		// 2.5MHz
+	RTL9300_I2C_SLOW_FREQ,			// 50kHz
  };
 
+#define RTL9300_I2C_MAX_SUPER_FAST_FREQ		2500000
+#define RTL9300_I2C_MAX_SLOW_FREQ		50000
+
+
  struct rtl9300_i2c;
 
  struct rtl9300_i2c_chan {
@@ -433,6 +439,12 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
  		case I2C_MAX_FAST_MODE_FREQ:
  			chan->bus_freq = RTL9300_I2C_FAST_FREQ;
  			break;
+		case RTL9300_I2C_MAX_SUPER_FAST_FREQ:
+			chan->bus_freq = RTL9300_I2C_SUPER_FAST_FREQ;
+			break;
+		case RTL9300_I2C_MAX_SLOW_FREQ:
+			chan->bus_freq = RTL9300_I2C_SLOW_FREQ;
+			break;
  		default:
  			dev_warn(i2c->dev, "SDA%d clock-frequency %d not supported using default\n",
  				 sda_num, clock_freq);
maintainer Applied
#2 lore raw
In reply to Jan Kantert

Hi Jan,

Quoted 6 lines · Jan Kantert

Some SFP modules on certain switches (for example the ONTi ONT-S508CL-8S and XikeStor SKS8300-8X) exhibit unreliable I2C communication at the currently supported speeds. Add support for 50 kHz and 2.5 MHz I2C bus modes on the RTL9300 to improve compatibility with these devices.

merged to i2c/i2c-host.

Thanks,
Andi