Skip to contentSkip to conversation

i2c: fsi: Fixes for systems with more ports

PATCH Applied Eddie James 3 participants 9 messages Jun 9, 2020 – Jul 24, 2020

Subsystems (2)
lore
Share & tools
lore

Eddie James

author maintainer
#0 lore raw

v2 cover i2c: fsi: Fixes for systems with more ports

This series fixes a register definition for the FSI-attached I2C master to allow all the available ports. In addition, the code to add an adapter for each port is modified to require a device-tree entry for the bus. This is so that systems with lots of busses that have no devices on them don't add lots of unecessary devices.

Changes since v1:
- Remove the check for null device node since that is checked in of_device_is_available

Eddie James (2):
i2c: fsi: Fix the port number field in status register
i2c: fsi: Prevent adding adapters for ports without dts nodes

 drivers/i2c/busses/i2c-fsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.24.0
author maintainer
#1 lore raw

PATCH v2 1/2 i2c: fsi: Fix the port number field in status register

The port number field in the status register was not correct, so fix it.

Fixes d6ffb6300116 ("i2c: Add FSI-attached I2C master algorithm")
---
 drivers/i2c/busses/i2c-fsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
index e0c256922d4f..977d6f524649 100644
@@ -98,7 +98,7 @@
 #define I2C_STAT_DAT_REQ	BIT(25)
 #define I2C_STAT_CMD_COMP	BIT(24)
 #define I2C_STAT_STOP_ERR	BIT(23)
-#define I2C_STAT_MAX_PORT	GENMASK(19, 16)
+#define I2C_STAT_MAX_PORT	GENMASK(22, 16)
 #define I2C_STAT_ANY_INT	BIT(15)
 #define I2C_STAT_SCL_IN		BIT(11)
 #define I2C_STAT_SDA_IN		BIT(10)
Signature · 1 line
2.24.0
author maintainer
#3 lore raw

PATCH v2 2/2 i2c: fsi: Prevent adding adapters for ports without dts nodes

In reply to Eddie James

Ports should be defined in the devicetree if they are to be enabled on the system.

---
Changes since v1:
- Remove the check for null device node since that is checked in of_device_is_available

 drivers/i2c/busses/i2c-fsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
index 977d6f524649..10332693edf0 100644
@@ -703,7 +703,7 @@ static int fsi_i2c_probe(struct device *dev)
 
 	for (port_no = 0; port_no < ports; port_no++) {
 		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
-		if (np && !of_device_is_available(np))
+		if (!of_device_is_available(np))
 			continue;
 
 		port = kzalloc(sizeof(*port), GFP_KERNEL);
Signature · 1 line
2.24.0
Reviewed-by on the v2 series
#8 lore raw
In reply to Eddie James
Quoted 7 lines · Eddie James

This series fixes a register definition for the FSI-attached I2C master to allow all the available ports. In addition, the code to add an adapter for each port is modified to require a device-tree entry for the bus. This is so that systems with lots of busses that have no devices on them don't add lots of unecessary devices.

FWIW,

Quoted 14 lines

Changes since v1:
- Remove the check for null device node since that is checked in of_device_is_available

Eddie James (2):
i2c: fsi: Fix the port number field in status register
i2c: fsi: Prevent adding adapters for ports without dts nodes

 drivers/i2c/busses/i2c-fsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.24.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes

In reply to Eddie James
Quoted 2 lines · Eddie James

Ports should be defined in the devicetree if they are to be enabled on the system.

The patch description does not really fit anymore, does it? There is no change in behaviour, we just remove a redundant check.

Quoted 27 lines

---
Changes since v1:
- Remove the check for null device node since that is checked in of_device_is_available

 drivers/i2c/busses/i2c-fsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
index 977d6f524649..10332693edf0 100644
@@ -703,7 +703,7 @@ static int fsi_i2c_probe(struct device *dev)
 
 	for (port_no = 0; port_no < ports; port_no++) {
 		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
-		if (np && !of_device_is_available(np))
+		if (!of_device_is_available(np))
 			continue;
 
 		port = kzalloc(sizeof(*port), GFP_KERNEL);
Signature · 1 line
2.24.0
author maintainer
#5 lore raw

Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes

Quoted 5 lines · Wolfram Sang
Quoted 2 lines · Eddie James

Ports should be defined in the devicetree if they are to be enabled on the system.

The patch description does not really fit anymore, does it? There is no change in behaviour, we just remove a redundant check.

Hi, it does change the behavior actually. By checking for the device node pointer, it would proceed and create the port for a NULL device node, which is not the desired behavior.

Thanks,

Eddie

Quoted 27 lines
Quoted 27 lines

---
Changes since v1:
- Remove the check for null device node since that is checked in of_device_is_available

  drivers/i2c/busses/i2c-fsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
index 977d6f524649..10332693edf0 100644
@@ -703,7 +703,7 @@ static int fsi_i2c_probe(struct device *dev)
 
  	for (port_no = 0; port_no < ports; port_no++) {
  		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
-		if (np && !of_device_is_available(np))
+		if (!of_device_is_available(np))
  			continue;
 
  		port = kzalloc(sizeof(*port), GFP_KERNEL);
Signature · 1 line
2.24.0
#6 lore raw

Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes

Quoted 4 lines

Hi, it does change the behavior actually. By checking for the device node pointer, it would proceed and create the port for a NULL device node, which is not the desired behavior.

Brown paper bag, please...