Linux-i2c Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports
@ 2020-06-09 20:15 Eddie James
  2020-06-09 20:15 ` [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register Eddie James
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eddie James @ 2020-06-09 20:15 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.

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


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

* [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register
  2020-06-09 20:15 [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
@ 2020-06-09 20:15 ` Eddie James
  2020-06-25 22:26   ` Wolfram Sang
  2020-06-09 20:15 ` [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
  2020-06-09 22:00 ` [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Andy Shevchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Eddie James @ 2020-06-09 20:15 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	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-09 20:15 [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
  2020-06-09 20:15 ` [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register Eddie James
@ 2020-06-09 20:15 ` Eddie James
  2020-07-04  6:39   ` Wolfram Sang
  2020-07-24 19:32   ` Wolfram Sang
  2020-06-09 22:00 ` [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Andy Shevchenko
  2 siblings, 2 replies; 9+ messages in thread
From: Eddie James @ 2020-06-09 20:15 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>
---
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(-)

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


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

* Re: [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports
  2020-06-09 20:15 [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
  2020-06-09 20:15 ` [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register Eddie James
  2020-06-09 20:15 ` [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
@ 2020-06-09 22:00 ` Andy Shevchenko
  2 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-06-09 22:00 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, Linux Kernel Mailing List, wsa, Joel Stanley

On Tue, Jun 9, 2020 at 11:15 PM Eddie James <eajames@linux.ibm.com> wrote:
>
> 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,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

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


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register
  2020-06-09 20:15 ` [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register Eddie James
@ 2020-06-25 22:26   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2020-06-25 22:26 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, linux-kernel, andy.shevchenko, joel


[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

On Tue, Jun 09, 2020 at 03:15:54PM -0500, Eddie James wrote:
> 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>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-09 20:15 ` [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
@ 2020-07-04  6:39   ` Wolfram Sang
  2020-07-06 13:53     ` Eddie James
  2020-07-24 19:32   ` Wolfram Sang
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2020-07-04  6:39 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, linux-kernel, andy.shevchenko, joel


[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:
> 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.

> 
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> 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(-)
> 
> diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
> index 977d6f524649..10332693edf0 100644
> --- a/drivers/i2c/busses/i2c-fsi.c
> +++ b/drivers/i2c/busses/i2c-fsi.c
> @@ -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);
> -- 
> 2.24.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-07-04  6:39   ` Wolfram Sang
@ 2020-07-06 13:53     ` Eddie James
  2020-07-06 14:01       ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Eddie James @ 2020-07-06 13:53 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, andy.shevchenko, joel


On 7/4/20 1:39 AM, Wolfram Sang wrote:
> On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:
>> 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


>
>> Signed-off-by: Eddie James <eajames@linux.ibm.com>
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>> ---
>> 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(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
>> index 977d6f524649..10332693edf0 100644
>> --- a/drivers/i2c/busses/i2c-fsi.c
>> +++ b/drivers/i2c/busses/i2c-fsi.c
>> @@ -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);
>> -- 
>> 2.24.0
>>

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

* Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-07-06 13:53     ` Eddie James
@ 2020-07-06 14:01       ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2020-07-06 14:01 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, linux-kernel, andy.shevchenko, joel


[-- Attachment #1: Type: text/plain, Size: 215 bytes --]


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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes
  2020-06-09 20:15 ` [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
  2020-07-04  6:39   ` Wolfram Sang
@ 2020-07-24 19:32   ` Wolfram Sang
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2020-07-24 19:32 UTC (permalink / raw)
  To: Eddie James; +Cc: linux-i2c, linux-kernel, andy.shevchenko, joel


[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:
> 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>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 20:15 [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Eddie James
2020-06-09 20:15 ` [PATCH v2 1/2] i2c: fsi: Fix the port number field in status register Eddie James
2020-06-25 22:26   ` Wolfram Sang
2020-06-09 20:15 ` [PATCH v2 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes Eddie James
2020-07-04  6:39   ` Wolfram Sang
2020-07-06 13:53     ` Eddie James
2020-07-06 14:01       ` Wolfram Sang
2020-07-24 19:32   ` Wolfram Sang
2020-06-09 22:00 ` [PATCH v2 0/2] i2c: fsi: Fixes for systems with more ports Andy Shevchenko

Linux-i2c Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-i2c/0 linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ https://lore.kernel.org/linux-i2c \
		linux-i2c@vger.kernel.org
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-i2c


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git