Skip to contentSkip to conversation

ARM: dts: NSP: Use hardware I2C for BCM958625HR

PATCH Applied Florian Fainelli 2 participants 4 messages Dec 13, 2019 – Dec 17, 2019

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

PATCH 1/1 ARM: dts: NSP: Use hardware I2C for BCM958625HR

Now that the i2c-bcm-iproc driver has been fixed to permit reading more than 63 bytes in a single transaction with commit fd01eecdf959 ("i2c:
iproc: Fix i2c master read more than 63 bytes") we no longer need to bitbang i2c over GPIOs which was necessary before to allow the PHYLINK/SFP subsystems to read SFP modules.

---
 arch/arm/boot/dts/bcm958625hr.dts | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/boot/dts/bcm958625hr.dts +5 -10
index a2c9de35ddfb..536fb24f38bb 100644
@@ -55,18 +55,9 @@
 		priority = <200>;
 	};
 
-	/* Hardware I2C block cannot do more than 63 bytes per transfer,
-	 * which would prevent reading from a SFP's EEPROM (256 byte).
-	 */
-	i2c1: i2c {
-		compatible = "i2c-gpio";
-		sda-gpios = <&gpioa 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-		scl-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-	};
-
 	sfp: sfp {
 		compatible = "sff,sfp";
-		i2c-bus = <&i2c1>;
+		i2c-bus = <&i2c0>;
 		mod-def0-gpios = <&gpioa 28 GPIO_ACTIVE_LOW>;
 		los-gpios = <&gpioa 24 GPIO_ACTIVE_HIGH>;
 		tx-fault-gpios = <&gpioa 30 GPIO_ACTIVE_HIGH>;
@@ -74,6 +65,10 @@
 	};
 };
 
+&i2c0 {
+	status = "okay";
+};
+
 &amac0 {
 	status = "okay";
 };
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Florian Fainelli

Now that the i2c-bcm-iproc driver has been fixed to permit reading more than 63 bytes in a single transaction with commit fd01eecdf959 ("i2c:
iproc: Fix i2c master read more than 63 bytes") we no longer need to bitbang i2c over GPIOs which was necessary before to allow the PHYLINK/SFP subsystems to read SFP modules.

This is good to hear!

Quoted 12 lines
---
  arch/arm/boot/dts/bcm958625hr.dts | 15 +++++----------
  1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/boot/dts/bcm958625hr.dts +0 -0
index a2c9de35ddfb..536fb24f38bb 100644
@@ -55,18 +55,9 @@
  		priority = <200>;
  	};

arch/arm/boot/dts/bcm958625hr.dts line 66

Quoted 10 lines
arch/arm/boot/dts/bcm958625hr.dts +0 -9
 
-	/* Hardware I2C block cannot do more than 63 bytes per transfer,
-	 * which would prevent reading from a SFP's EEPROM (256 byte).
-	 */
-	i2c1: i2c {
-		compatible = "i2c-gpio";
-		sda-gpios = <&gpioa 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-		scl-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-	};
-

So I suppose GPIO 4 and 5 from the 'gpioa' controller are tied to the same SCL/SDA pins from i2c0 and they are internally muxed, right?

Is the mux to GPIO done automatically when pins are configured as GPIO, and therefore you don't require any additional changes to pinmux to make this work, after changing it back to use real I2C0 block below?

Quoted 9 lines
arch/arm/boot/dts/bcm958625hr.dts +1 -1
  	sfp: sfp {
  		compatible = "sff,sfp";
-		i2c-bus = <&i2c1>;
+		i2c-bus = <&i2c0>;
  		mod-def0-gpios = <&gpioa 28 GPIO_ACTIVE_LOW>;
  		los-gpios = <&gpioa 24 GPIO_ACTIVE_HIGH>;
  		tx-fault-gpios = <&gpioa 30 GPIO_ACTIVE_HIGH>;

arch/arm/boot/dts/bcm958625hr.dts line 74

Quoted 10 lines
arch/arm/boot/dts/bcm958625hr.dts +4 -0
@@ -74,6 +65,10 @@
  	};
  };
 
+&i2c0 {
+	status = "okay";
+};
+
  &amac0 {
  	status = "okay";
  };

Change looks good to me.

Thanks,

Ray

#2 lore raw
Quoted 29 lines · Ray Jui
Quoted 6 lines · Florian Fainelli

Now that the i2c-bcm-iproc driver has been fixed to permit reading more than 63 bytes in a single transaction with commit fd01eecdf959 ("i2c:
iproc: Fix i2c master read more than 63 bytes") we no longer need to bitbang i2c over GPIOs which was necessary before to allow the PHYLINK/SFP subsystems to read SFP modules.

This is good to hear!

Quoted 17 lines

---
  arch/arm/boot/dts/bcm958625hr.dts | 15 +++++----------

  1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/boot/dts/bcm958625hr.dts +0 -3
index a2c9de35ddfb..536fb24f38bb 100644
@@ -55,18 +55,9 @@
           priority = <200>;
       };
   -    /* Hardware I2C block cannot do more than 63 bytes per transfer,
-     * which would prevent reading from a SFP's EEPROM (256 byte).
-     */
-    i2c1: i2c {
Quoted 8 lines

arch/arm/boot/dts/bcm958625hr.dts line 66

Quoted 5 lines
arch/arm/boot/dts/bcm958625hr.dts +0 -5
-        compatible = "i2c-gpio";
-        sda-gpios = <&gpioa 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-        scl-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-    };
-

So I suppose GPIO 4 and 5 from the 'gpioa' controller are tied to the same SCL/SDA pins from i2c0 and they are internally muxed, right?

Correct.

Quoted 4 lines

Is the mux to GPIO done automatically when pins are configured as GPIO, and therefore you don't require any additional changes to pinmux to make this work, after changing it back to use real I2C0 block below?

Yes indeed.

Quoted 22 lines
Quoted 10 lines
arch/arm/boot/dts/bcm958625hr.dts +1 -1
       sfp: sfp {
           compatible = "sff,sfp";
-        i2c-bus = <&i2c1>;
+        i2c-bus = <&i2c0>;
           mod-def0-gpios = <&gpioa 28 GPIO_ACTIVE_LOW>;
           los-gpios = <&gpioa 24 GPIO_ACTIVE_HIGH>;
           tx-fault-gpios = <&gpioa 30 GPIO_ACTIVE_HIGH>;

arch/arm/boot/dts/bcm958625hr.dts line 73

Quoted 9 lines
arch/arm/boot/dts/bcm958625hr.dts +3 -0
@@ -74,6 +65,10 @@
       };
   };
   +&i2c0 {
+    status = "okay";
+};
+
   &amac0 {
       status = "okay";
   };

Change looks good to me.

Quoted 1 line

Thanks!

Signature · 1 line
Florian
author Applied
#3 lore raw
In reply to Florian Fainelli
Quoted 8 lines · Florian Fainelli

Now that the i2c-bcm-iproc driver has been fixed to permit reading more than 63 bytes in a single transaction with commit fd01eecdf959 ("i2c:
iproc: Fix i2c master read more than 63 bytes") we no longer need to bitbang i2c over GPIOs which was necessary before to allow the PHYLINK/SFP subsystems to read SFP modules.

---

Applied to devicetree/next, thanks!
--
Florian