Skip to contentSkip to conversation

Add I2C busses to P9 device tree

PATCH Superseded Eddie James 2 participants 6 messages Jul 6, 2017 – Jul 7, 2017

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add I2C busses to P9 device tree

From: "Edward A. James" <[email protected]>

This series adds FSI-attached I2C controller and associated busses to the P9 FSI cfam device tree node. It also enables the devices in the P9 machine- specific files, and adds aliases to preserve the expected /dev/ entries. Also does a couple of dt parsing fixes in the driver.

Changes since v2:
- Split adding and enabling busses into two patches.
- Add aliases.
- Add the device node to the I2C adapter dev (needed for alias).

Edward A. James (3):
arm/dts: Add I2C master and ports to FSI cfams
arm/dts: Enable FSI I2C busses for P9
drivers/i2c: Fix devicetree parsing in FSI-attached I2C master algo

 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 150 +++++++++++++++++++++
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 150 +++++++++++++++++++++
 arch/arm/boot/dts/ibm-power9-cfam.dtsi           | 164 +++++++++++++++++++++++
 drivers/i2c/busses/i2c-fsi.c                     |  12 +-
 4 files changed, 471 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v3 1/3 arm/dts: Add I2C master and ports to FSI cfams

From: "Edward A. James" <[email protected]>

FSI I2C master algorithm probes port devices based on dts. Set all devices to disabled.

---
 arch/arm/boot/dts/ibm-power9-cfam.dtsi | 164 +++++++++++++++++++++++++++++++++
 1 file changed, 164 insertions(+)
arch/arm/boot/dts/ibm-power9-cfam.dtsi +164 -0
index f29c6e3..ede778d 100644
@@ -4,6 +4,88 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 
+		i2c@1800 {
+			compatible = "ibm,fsi-i2c-master";
+			reg = <0x1800 0x400>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			cfam0_i2c0: i2c-bus@0 {
+				status = "disabled";
+				reg = <0>;
+			};
+
+			cfam0_i2c1: i2c-bus@1 {
+				status = "disabled";
+				reg = <1>;
+			};
+
+			cfam0_i2c2: i2c-bus@2 {
+				status = "disabled";
+				reg = <2>;
+			};
+
+			cfam0_i2c3: i2c-bus@3 {
+				status = "disabled";
+				reg = <3>;
+			};
+
+			cfam0_i2c4: i2c-bus@4 {
+				status = "disabled";
+				reg = <4>;
+			};
+
+			cfam0_i2c5: i2c-bus@5 {
+				status = "disabled";
+				reg = <5>;
+			};
+
+			cfam0_i2c6: i2c-bus@6 {
+				status = "disabled";
+				reg = <6>;
+			};
+
+			cfam0_i2c7: i2c-bus@7 {
+				status = "disabled";
+				reg = <7>;
+			};
+
+			cfam0_i2c8: i2c-bus@8 {
+				status = "disabled";
+				reg = <8>;
+			};
+
+			cfam0_i2c9: i2c-bus@9 {
+				status = "disabled";
+				reg = <9>;
+			};
+
+			cfam0_i2c10: i2c-bus@10 {
+				status = "disabled";
+				reg = <10>;
+			};
+
+			cfam0_i2c11: i2c-bus@11 {
+				status = "disabled";
+				reg = <11>;
+			};
+
+			cfam0_i2c12: i2c-bus@12 {
+				status = "disabled";
+				reg = <12>;
+			};
+
+			cfam0_i2c13: i2c-bus@13 {
+				status = "disabled";
+				reg = <13>;
+			};
+
+			cfam0_i2c14: i2c-bus@14 {
+				status = "disabled";
+				reg = <14>;
+			};
+		};
+
 		sbefifo@2400 {
 			compatible = "ibm,p9-sbefifo";
 			reg = <0x2400 0x400>;
@@ -31,6 +113,88 @@
 				#address-cells = <1>;
 				#size-cells = <1>;
 
+				i2c@1800 {
+					compatible = "ibm,fsi-i2c-master";
+					reg = <0x1800 0x400>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					cfam1_i2c0: i2c-bus@0 {
+						status = "disabled";
+						reg = <0>;
+					};
+
+					cfam1_i2c1: i2c-bus@1 {
+						status = "disabled";
+						reg = <1>;
+					};
+
+					cfam1_i2c2: i2c-bus@2 {
+						status = "disabled";
+						reg = <2>;
+					};
+
+					cfam1_i2c3: i2c-bus@3 {
+						status = "disabled";
+						reg = <3>;
+					};
+
+					cfam1_i2c4: i2c-bus@4 {
+						status = "disabled";
+						reg = <4>;
+					};
+
+					cfam1_i2c5: i2c-bus@5 {
+						status = "disabled";
+						reg = <5>;
+					};
+
+					cfam1_i2c6: i2c-bus@6 {
+						status = "disabled";
+						reg = <6>;
+					};
+
+					cfam1_i2c7: i2c-bus@7 {
+						status = "disabled";
+						reg = <7>;
+					};
+
+					cfam1_i2c8: i2c-bus@8 {
+						status = "disabled";
+						reg = <8>;
+					};
+
+					cfam1_i2c9: i2c-bus@9 {
+						status = "disabled";
+						reg = <9>;
+					};
+
+					cfam1_i2c10: i2c-bus@10 {
+						status = "disabled";
+						reg = <10>;
+					};
+
+					cfam1_i2c11: i2c-bus@11 {
+						status = "disabled";
+						reg = <11>;
+					};
+
+					cfam1_i2c12: i2c-bus@12 {
+						status = "disabled";
+						reg = <12>;
+					};
+
+					cfam1_i2c13: i2c-bus@13 {
+						status = "disabled";
+						reg = <13>;
+					};
+
+					cfam1_i2c14: i2c-bus@14 {
+						status = "disabled";
+						reg = <14>;
+					};
+				};
+
 				sbefifo@2400 {
 					compatible = "ibm,p9-sbefifo";
 					reg = <0x2400 0x400>;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v3 2/3 arm/dts: Enable FSI I2C busses for P9

In reply to Eddie James

From: "Edward A. James" <[email protected]>

Enable all the ports for witherspoon and romulus. Also add aliases so that users can easily access the /dev/ entries.

---
 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 150 +++++++++++++++++++++++
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 150 +++++++++++++++++++++++
 2 files changed, 300 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts +150 -0
index d53dc59..4d52cbc 100644
@@ -9,6 +9,36 @@
 
 	aliases {
 		serial4 = &uart5;
+		i2c100 = &cfam0_i2c0;
+		i2c101 = &cfam0_i2c1;
+		i2c102 = &cfam0_i2c2;
+		i2c103 = &cfam0_i2c3;
+		i2c104 = &cfam0_i2c4;
+		i2c105 = &cfam0_i2c5;
+		i2c106 = &cfam0_i2c6;
+		i2c107 = &cfam0_i2c7;
+		i2c108 = &cfam0_i2c8;
+		i2c109 = &cfam0_i2c9;
+		i2c110 = &cfam0_i2c10;
+		i2c111 = &cfam0_i2c11;
+		i2c112 = &cfam0_i2c12;
+		i2c113 = &cfam0_i2c13;
+		i2c114 = &cfam0_i2c14;
+		i2c200 = &cfam1_i2c0;
+		i2c201 = &cfam1_i2c1;
+		i2c202 = &cfam1_i2c2;
+		i2c203 = &cfam1_i2c3;
+		i2c204 = &cfam1_i2c4;
+		i2c205 = &cfam1_i2c5;
+		i2c206 = &cfam1_i2c6;
+		i2c207 = &cfam1_i2c7;
+		i2c208 = &cfam1_i2c8;
+		i2c209 = &cfam1_i2c9;
+		i2c210 = &cfam1_i2c10;
+		i2c211 = &cfam1_i2c11;
+		i2c212 = &cfam1_i2c12;
+		i2c213 = &cfam1_i2c13;
+		i2c214 = &cfam1_i2c14;
 	};
 
 	chosen {
@@ -72,6 +102,126 @@
 
 #include "ibm-power9-cfam.dtsi"
 
+&cfam0_i2c0 {
+	status = "okay";
+};
+
+&cfam0_i2c1 {
+	status = "okay";
+};
+
+&cfam0_i2c2 {
+	status = "okay";
+};
+
+&cfam0_i2c3 {
+	status = "okay";
+};
+
+&cfam0_i2c4 {
+	status = "okay";
+};
+
+&cfam0_i2c5 {
+	status = "okay";
+};
+
+&cfam0_i2c6 {
+	status = "okay";
+};
+
+&cfam0_i2c7 {
+	status = "okay";
+};
+
+&cfam0_i2c8 {
+	status = "okay";
+};
+
+&cfam0_i2c9 {
+	status = "okay";
+};
+
+&cfam0_i2c10 {
+	status = "okay";
+};
+
+&cfam0_i2c11 {
+	status = "okay";
+};
+
+&cfam0_i2c12 {
+	status = "okay";
+};
+
+&cfam0_i2c13 {
+	status = "okay";
+};
+
+&cfam0_i2c14 {
+	status = "okay";
+};
+
+&cfam1_i2c0 {
+	status = "okay";
+};
+
+&cfam1_i2c1 {
+	status = "okay";
+};
+
+&cfam1_i2c2 {
+	status = "okay";
+};
+
+&cfam1_i2c3 {
+	status = "okay";
+};
+
+&cfam1_i2c4 {
+	status = "okay";
+};
+
+&cfam1_i2c5 {
+	status = "okay";
+};
+
+&cfam1_i2c6 {
+	status = "okay";
+};
+
+&cfam1_i2c7 {
+	status = "okay";
+};
+
+&cfam1_i2c8 {
+	status = "okay";
+};
+
+&cfam1_i2c9 {
+	status = "okay";
+};
+
+&cfam1_i2c10 {
+	status = "okay";
+};
+
+&cfam1_i2c11 {
+	status = "okay";
+};
+
+&cfam1_i2c12 {
+	status = "okay";
+};
+
+&cfam1_i2c13 {
+	status = "okay";
+};
+
+&cfam1_i2c14 {
+	status = "okay";
+};
+
 &fmc {
 	status = "okay";
 	flash@0 {
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +150 -0

162 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v3 3/3 drivers/i2c: Fix devicetree parsing in FSI-attached I2C master algo

In reply to Eddie James

From: "Edward A. James" <[email protected]>

Add compatible check for the master device node. Change "port" to "reg" for the port number property. Check that the port node is available. Add the device node to the adapter device.

---
 drivers/i2c/busses/i2c-fsi.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-fsi.c +7 -5
index b4eb102..79a6985 100644
@@ -568,10 +568,11 @@ static int fsi_i2c_probe(struct device *dev)
 	ida_init(&i2c->ida);
 	INIT_LIST_HEAD(&i2c->ports);
 
-	if (dev->of_node) {
+	if (dev->of_node &&
+	    of_device_is_compatible(dev->of_node, "ibm,fsi-i2c-master")) {
 		/* add adapter for each i2c port of the master */
-		for_each_child_of_node(dev->of_node, np) {
-			rc = of_property_read_u32(np, "port", &port_no);
+		for_each_available_child_of_node(dev->of_node, np) {
+			rc = of_property_read_u32(np, "reg", &port_no);
 			if (rc || port_no > 0xFFFF)
 				continue;
 
@@ -589,6 +590,7 @@ static int fsi_i2c_probe(struct device *dev)
 			port->port = (u16)port_no;
 
 			port->adapter.owner = THIS_MODULE;
+			port->adapter.dev.of_node = np;
 			port->adapter.dev.parent = dev;
 			port->adapter.algo = &fsi_i2c_algorithm;
 			port->adapter.bus_recovery_info =
@@ -600,7 +602,7 @@ static int fsi_i2c_probe(struct device *dev)
 
 			snprintf(port->adapter.name,
 				 sizeof(port->adapter.name),
-				 "fsi_i2c-%u", port_no);
+				 "fsi%d_i2c%u", i2c->idx, port_no);
 
 			rc = i2c_add_numbered_adapter(&port->adapter);
 			if (rc < 0)
@@ -643,7 +645,7 @@ static int fsi_i2c_remove(struct device *dev)
 static struct fsi_driver fsi_i2c_driver = {
 	.id_table = fsi_i2c_ids,
 	.drv = {
-		.name = "i2c_master_fsi",
+		.name = "fsi_i2c_master",
 		.bus = &fsi_bus_type,
 		.probe = fsi_i2c_probe,
 		.remove = fsi_i2c_remove,
Signature · 1 line
1.8.3.1
maintainer
#4 lore raw
In reply to Eddie James
Quoted 6 lines · Eddie James

From: "Edward A. James" <[email protected]>

This series adds FSI-attached I2C controller and associated busses to the P9 FSI cfam device tree node. It also enables the devices in the P9 machine- specific files, and adds aliases to preserve the expected /dev/ entries. Also does a couple of dt parsing fixes in the driver.

The code changes conflict with the fixes I posted. Please review the fixes I posted, and rebase your patches on them.

Cheers,

Joel

Quoted 20 lines

Changes since v2:
- Split adding and enabling busses into two patches.
- Add aliases.
- Add the device node to the I2C adapter dev (needed for alias).

Edward A. James (3):
arm/dts: Add I2C master and ports to FSI cfams
arm/dts: Enable FSI I2C busses for P9
drivers/i2c: Fix devicetree parsing in FSI-attached I2C master algo

 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 150 +++++++++++++++++++++
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 150 +++++++++++++++++++++
 arch/arm/boot/dts/ibm-power9-cfam.dtsi           | 164 +++++++++++++++++++++++
 drivers/i2c/busses/i2c-fsi.c                     |  12 +-
 4 files changed, 471 insertions(+), 5 deletions(-)

--
1.8.3.1

#5 lore raw
Quoted 9 lines · Joel Stanley
Quoted 6 lines · Eddie James

From: "Edward A. James" <[email protected]>

This series adds FSI-attached I2C controller and associated busses to the P9 FSI cfam device tree node. It also enables the devices in the P9 machine- specific files, and adds aliases to preserve the expected /dev/ entries. Also does a couple of dt parsing fixes in the driver.

The code changes conflict with the fixes I posted. Please review the fixes I posted, and rebase your patches on them.

OK, I had thought yours were based on my v2 changes... I'll have to send up your patches I'm basing my v4 on.

Thanks,
Eddie

Quoted 24 lines

Cheers,

Joel

Quoted 19 lines

Changes since v2:
- Split adding and enabling busses into two patches.
- Add aliases.
- Add the device node to the I2C adapter dev (needed for alias).

Edward A. James (3):
arm/dts: Add I2C master and ports to FSI cfams
arm/dts: Enable FSI I2C busses for P9
drivers/i2c: Fix devicetree parsing in FSI-attached I2C master algo

  arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 150 +++++++++++++++++++++
  arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 150 +++++++++++++++++++++
  arch/arm/boot/dts/ibm-power9-cfam.dtsi           | 164 +++++++++++++++++++++++
  drivers/i2c/busses/i2c-fsi.c                     |  12 +-
  4 files changed, 471 insertions(+), 5 deletions(-)

--
1.8.3.1