Skip to contentSkip to conversation

Add I2C busses to P9 device tree

PATCH New Eddie James 1 participant 4 messages Jul 7, 2017

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

v4 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 v3:
* just rebase

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                     |  10 +-
 4 files changed, 470 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v4 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 v4 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 v4 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 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-fsi.c +6 -4
index adcd8cd..ce493a3 100644
@@ -562,10 +562,11 @@ static int fsi_i2c_probe(struct device *dev)
 	i2c->fsi = to_fsi_dev(dev);
 	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;
 
@@ -577,6 +578,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 =
@@ -624,7 +626,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