i2c: fsi: Fixes for systems with more ports
Subsystems (2)
Eddie James
maintainercover i2c: fsi: Fixes for systems with more ports
Fix two things that cause issues on systems with lots of ports off the FSI I2C master.
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
Eddie James
maintainerPATCH 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.
--- drivers/i2c/busses/i2c-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
@@ -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
Eddie James
maintainerPATCH 2/2 i2c: fsi: Prevent adding adapters for ports without dts nodes
In reply to Eddie JamesPorts should be defined in the devicetree if they are to be enabled on the system.
--- drivers/i2c/busses/i2c-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-fsi.c +1 -1
@@ -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 (!np || !of_device_is_available (np))continue ; port =kzalloc (sizeof (*port),GFP_KERNEL );
Signature · 1 line
2.24.0
Joel Stanley
AppliedRe: [PATCH linux dev-5.4 1/2] i2c: fsi: Fix the port number field in status register
In reply to Eddie JamesQuoted 4 lines · Eddie James
The port number field in the status register was not correct, so fix it.
Signed-off-by Eddie James <[email protected]>
Merged into dev-5.4.
Can you please send this upstream with a fixes tag?
Cheers,
Joel
Quoted 20 lines
--- drivers/i2c/busses/i2c-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-fsi.c +1
-2@@ -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) --2.24.0
Re: [PATCH linux dev-5.4 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
In reply to Eddie JamesQuoted 14 lines · Eddie James
Ports should be defined in the devicetree if they are to be enabled on the system.
Signed-off-by Eddie James <[email protected]>--- drivers/i2c/busses/i2c-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-fsi.c +0
-0
drivers/i2c/busses/i2c-fsi.c static int fsi_i2c_probe(struct device *dev) · line 706
Quoted 5 lines
drivers/i2c/busses/i2c-fsi.c +1
-1@@ -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 (!np || !of_device_is_available (np))
I thought this was wrong, but the important part is that of_device_is_available() returns true if it can't find the status property (ie np is null), so we need to check for np being NULL, and if that's false we can check if it's "available".
We could write it like this if you agree it's clearer:
if (!np)
/* Port not defined in device tree */
continue;
if (of_device_is_available())
continue;
Or I can take your patch as-is. Let me know.
Cheers,
Joel
Quoted 6 lines
drivers/i2c/busses/i2c-fsi.c +0
-1continue ; port =kzalloc (sizeof (*port),GFP_KERNEL ); --2.24.0