linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] i2c: fsi: Fixes for systems with more ports
@ 2020-06-08 16:05 Eddie James
  2020-06-08 16:05 ` [PATCH 1/2] i2c: fsi: Fix the port number field in status register Eddie James
  2020-06-08 16:05 ` [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
  0 siblings, 2 replies; 5+ messages in thread
From: Eddie James @ 2020-06-08 16:05 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, andy.shevchenko, wsa, joel, eajames

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.

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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.24.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] i2c: fsi: Fix the port number field in status register
  2020-06-08 16:05 [PATCH 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
@ 2020-06-08 16:05 ` Eddie James
  2020-06-08 16:05 ` [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
  1 sibling, 0 replies; 5+ messages in thread
From: Eddie James @ 2020-06-08 16:05 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, andy.shevchenko, wsa, joel, eajames

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

Fixes: d6ffb6300116 ("i2c: Add FSI-attached I2C master algorithm")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/i2c/busses/i2c-fsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index e0c256922d4f..977d6f524649 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-08 16:05 [PATCH 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
  2020-06-08 16:05 ` [PATCH 1/2] i2c: fsi: Fix the port number field in status register Eddie James
@ 2020-06-08 16:05 ` Eddie James
  2020-06-08 16:31   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Eddie James @ 2020-06-08 16:05 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, andy.shevchenko, wsa, joel, eajames

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

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/i2c/busses/i2c-fsi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index 977d6f524649..95b6b6bc1d78 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -703,7 +703,12 @@ 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))
+		/* Do not add port if it is not described in the device tree */
+		if (!np)
+			continue;
+
+		/* Do not add port if it is described as disabled */
+		if (!of_device_is_available(np))
 			continue;
 
 		port = kzalloc(sizeof(*port), GFP_KERNEL);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-08 16:05 ` [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
@ 2020-06-08 16:31   ` Andy Shevchenko
  2020-06-08 18:12     ` Eddie James
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2020-06-08 16:31 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, Linux Kernel Mailing List, wsa, Joel Stanley

On Mon, Jun 8, 2020 at 7:05 PM Eddie James <eajames@linux.ibm.com> wrote:
>
> Ports should be defined in the devicetree if they are to be enabled on
> the system.

...

>         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))

> +               /* Do not add port if it is not described in the device tree */
> +               if (!np)
> +                       continue;

I believe this is redundant, since below will do the same second time.

> +               /* Do not add port if it is described as disabled */
> +               if (!of_device_is_available(np))
>                         continue;

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-08 16:31   ` Andy Shevchenko
@ 2020-06-08 18:12     ` Eddie James
  0 siblings, 0 replies; 5+ messages in thread
From: Eddie James @ 2020-06-08 18:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-i2c, Linux Kernel Mailing List, wsa, Joel Stanley


On 6/8/20 11:31 AM, Andy Shevchenko wrote:
> On Mon, Jun 8, 2020 at 7:05 PM Eddie James <eajames@linux.ibm.com> wrote:
>> Ports should be defined in the devicetree if they are to be enabled on
>> the system.
> ...
>
>>          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))
>> +               /* Do not add port if it is not described in the device tree */
>> +               if (!np)
>> +                       continue;
> I believe this is redundant, since below will do the same second time.


Good point, thanks, I'll update that.


>
>> +               /* Do not add port if it is described as disabled */
>> +               if (!of_device_is_available(np))
>>                          continue;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-08 18:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 16:05 [PATCH 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
2020-06-08 16:05 ` [PATCH 1/2] i2c: fsi: Fix the port number field in status register Eddie James
2020-06-08 16:05 ` [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
2020-06-08 16:31   ` Andy Shevchenko
2020-06-08 18:12     ` Eddie James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).