All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: add 'single-master' property to generic bindings
@ 2020-05-27 11:30 Wolfram Sang
  2020-05-29 22:02 ` Rob Herring
  2020-05-30 21:13 ` Wolfram Sang
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-05-27 11:30 UTC (permalink / raw)
  To: linux-i2c; +Cc: devicetree, Rob Herring, Wolfram Sang, Laine Jaakko EXT

It is useful to know if we are the only master on a given bus. Because
this is a HW description of the bus, add it to the generic bindings.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Laine Jaakko EXT <ext-jaakko.laine@vaisala.com>
---

We added 'multi-master' back then because most busses are single-master
and 'multi-master' was the exception. In hindsight, however, this was a
bad choice because 'multi-master' should be the default, i.e. if you
know nothing, you should assume there could be another master.

So, we can't deduce that a missing 'multi-master' property automatically
means 'single-master'. That's why we need this new property.

I am a bit tempted to mark 'multi-master' as deprecated because the
default should be multi-master. However, it might also be a bit more
descriptive to let "no property" still mean "we don't know". I'd be
thankful for more opinions here.

Thanks and happy hacking,

   Wolfram

 Documentation/devicetree/bindings/i2c/i2c.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index 819436b48fae..438ae123107e 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -70,7 +70,12 @@ wants to support one of the below features, it should adapt these bindings.
 - multi-master
 	states that there is another master active on this bus. The OS can use
 	this information to adapt power management to keep the arbitration awake
-	all the time, for example.
+	all the time, for example. Can not be combined with 'single-master'.
+
+- single-master
+	states that there is no other master active on this bus. The OS can use
+	this information to detect a stalled bus more reliably, for example.
+	Can not be combined with 'multi-master'.
 
 Required properties (per child device)
 --------------------------------------
-- 
2.20.1


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

* Re: [PATCH] i2c: add 'single-master' property to generic bindings
  2020-05-27 11:30 [PATCH] i2c: add 'single-master' property to generic bindings Wolfram Sang
@ 2020-05-29 22:02 ` Rob Herring
  2020-05-29 23:02   ` Wolfram Sang
  2020-05-30 21:13 ` Wolfram Sang
  1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2020-05-29 22:02 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, devicetree, Laine Jaakko EXT

On Wed, May 27, 2020 at 01:30:39PM +0200, Wolfram Sang wrote:
> It is useful to know if we are the only master on a given bus. Because
> this is a HW description of the bus, add it to the generic bindings.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: Laine Jaakko EXT <ext-jaakko.laine@vaisala.com>
> ---
> 
> We added 'multi-master' back then because most busses are single-master
> and 'multi-master' was the exception. In hindsight, however, this was a
> bad choice because 'multi-master' should be the default, i.e. if you
> know nothing, you should assume there could be another master.
> 
> So, we can't deduce that a missing 'multi-master' property automatically
> means 'single-master'. That's why we need this new property.
> 
> I am a bit tempted to mark 'multi-master' as deprecated because the
> default should be multi-master. However, it might also be a bit more
> descriptive to let "no property" still mean "we don't know". I'd be
> thankful for more opinions here.

Could you just have different timeouts for clearing stalled bus. You 
know quickly if 'single-master' is set, but have to wait longer if not?

Note that we need to add a bunch of these properties to dt-schema 
i2c-controller.yaml. I hadn't done that because I want to dual license 
in the process, but lots of folks have touched i2c.txt IIRC.

Reviewed-by: Rob Herring <robh@kernel.org>

> Thanks and happy hacking,
> 
>    Wolfram
> 
>  Documentation/devicetree/bindings/i2c/i2c.txt | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
> index 819436b48fae..438ae123107e 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c.txt
> @@ -70,7 +70,12 @@ wants to support one of the below features, it should adapt these bindings.
>  - multi-master
>  	states that there is another master active on this bus. The OS can use
>  	this information to adapt power management to keep the arbitration awake
> -	all the time, for example.
> +	all the time, for example. Can not be combined with 'single-master'.
> +
> +- single-master
> +	states that there is no other master active on this bus. The OS can use
> +	this information to detect a stalled bus more reliably, for example.
> +	Can not be combined with 'multi-master'.
>  
>  Required properties (per child device)
>  --------------------------------------
> -- 
> 2.20.1
> 

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

* Re: [PATCH] i2c: add 'single-master' property to generic bindings
  2020-05-29 22:02 ` Rob Herring
@ 2020-05-29 23:02   ` Wolfram Sang
  2020-06-03 13:58     ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2020-05-29 23:02 UTC (permalink / raw)
  To: Rob Herring; +Cc: linux-i2c, devicetree, Laine Jaakko EXT

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

Hi Rob,

thanks for the review!

> Could you just have different timeouts for clearing stalled bus. You 
> know quickly if 'single-master' is set, but have to wait longer if not?

Timeouts are a difficult topic with I2C; there is no timeout defined.
However, if you want to start communictaing and don't have a 'bus idle'
condition, then the new property makes a difference. With
"single-master", we know the bus is stalled. With "multi-master" it
could be another master communicating.

> Note that we need to add a bunch of these properties to dt-schema 
> i2c-controller.yaml. I hadn't done that because I want to dual license 
> in the process, but lots of folks have touched i2c.txt IIRC.

What is your motivation for dual licensing?

All the best,

   Wolfram


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

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

* Re: [PATCH] i2c: add 'single-master' property to generic bindings
  2020-05-27 11:30 [PATCH] i2c: add 'single-master' property to generic bindings Wolfram Sang
  2020-05-29 22:02 ` Rob Herring
@ 2020-05-30 21:13 ` Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-05-30 21:13 UTC (permalink / raw)
  To: linux-i2c; +Cc: devicetree, Rob Herring, Laine Jaakko EXT

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

On Wed, May 27, 2020 at 01:30:39PM +0200, Wolfram Sang wrote:
> It is useful to know if we are the only master on a given bus. Because
> this is a HW description of the bus, add it to the generic bindings.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: Laine Jaakko EXT <ext-jaakko.laine@vaisala.com>

Applied to for-next, thanks!


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

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

* Re: [PATCH] i2c: add 'single-master' property to generic bindings
  2020-05-29 23:02   ` Wolfram Sang
@ 2020-06-03 13:58     ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-06-03 13:58 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, devicetree, Laine Jaakko EXT

On Fri, May 29, 2020 at 5:03 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Rob,
>
> thanks for the review!
>
> > Could you just have different timeouts for clearing stalled bus. You
> > know quickly if 'single-master' is set, but have to wait longer if not?
>
> Timeouts are a difficult topic with I2C; there is no timeout defined.
> However, if you want to start communictaing and don't have a 'bus idle'
> condition, then the new property makes a difference. With
> "single-master", we know the bus is stalled. With "multi-master" it
> could be another master communicating.
>
> > Note that we need to add a bunch of these properties to dt-schema
> > i2c-controller.yaml. I hadn't done that because I want to dual license
> > in the process, but lots of folks have touched i2c.txt IIRC.
>
> What is your motivation for dual licensing?

Non-GPL OS's use DT.

Rob

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

end of thread, other threads:[~2020-06-03 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 11:30 [PATCH] i2c: add 'single-master' property to generic bindings Wolfram Sang
2020-05-29 22:02 ` Rob Herring
2020-05-29 23:02   ` Wolfram Sang
2020-06-03 13:58     ` Rob Herring
2020-05-30 21:13 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.