linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770
@ 2020-09-04 13:11 Paul Cercueil
  2020-09-04 13:11 ` [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC Paul Cercueil
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Paul Cercueil @ 2020-09-04 13:11 UTC (permalink / raw)
  To: Rob Herring; +Cc: od, linux-i2c, devicetree, linux-kernel, Paul Cercueil

The I2C controller in the JZ4770 SoC seems to work the exact same as in
the JZ4780 SoC.

We could use "ingenic,jz4780-i2c" as a fallback string in the Device
Tree, but that would be awkward, since the JZ4780 is newer. Instead,
add a "ingenic,jz4770-i2c" string and use it as fallback for the
"ingenic,jz4780-i2c" string.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 .../devicetree/bindings/i2c/ingenic,i2c.yaml         | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/ingenic,i2c.yaml b/Documentation/devicetree/bindings/i2c/ingenic,i2c.yaml
index 682ed1bbf5c6..0e7b4b8a7e48 100644
--- a/Documentation/devicetree/bindings/i2c/ingenic,i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/ingenic,i2c.yaml
@@ -17,9 +17,13 @@ properties:
     pattern: "^i2c@[0-9a-f]+$"
 
   compatible:
-    enum:
-      - ingenic,jz4780-i2c
-      - ingenic,x1000-i2c
+    oneOf:
+      - enum:
+        - ingenic,jz4770-i2c
+        - ingenic,x1000-i2c
+      - items:
+        - const: ingenic,jz4780-i2c
+        - const: ingenic,jz4770-i2c
 
   reg:
     maxItems: 1
@@ -60,7 +64,7 @@ examples:
     #include <dt-bindings/dma/jz4780-dma.h>
     #include <dt-bindings/interrupt-controller/irq.h>
     i2c@10054000 {
-      compatible = "ingenic,jz4780-i2c";
+      compatible = "ingenic,jz4780-i2c", "ingenic,jz4770-i2c";
       #address-cells = <1>;
       #size-cells = <0>;
       reg = <0x10054000 0x1000>;
-- 
2.28.0


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

* [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC
  2020-09-04 13:11 [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Paul Cercueil
@ 2020-09-04 13:11 ` Paul Cercueil
  2020-09-21  9:47   ` Wolfram Sang
  2020-09-04 13:11 ` [PATCH 3/3] i2c: jz4780: Remove of_match_ptr() Paul Cercueil
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Paul Cercueil @ 2020-09-04 13:11 UTC (permalink / raw)
  To: Rob Herring; +Cc: od, linux-i2c, devicetree, linux-kernel, Paul Cercueil

The I2C controller in the JZ4770 SoC seems to work the exact same as in
the JZ4780 SoC.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/i2c/busses/i2c-jz4780.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index ba831df6661e..ed2ec86f6f1a 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -752,6 +752,7 @@ static const struct ingenic_i2c_config x1000_i2c_config = {
 };
 
 static const struct of_device_id jz4780_i2c_of_matches[] = {
+	{ .compatible = "ingenic,jz4770-i2c", .data = &jz4780_i2c_config },
 	{ .compatible = "ingenic,jz4780-i2c", .data = &jz4780_i2c_config },
 	{ .compatible = "ingenic,x1000-i2c", .data = &x1000_i2c_config },
 	{ /* sentinel */ }
-- 
2.28.0


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

* [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-04 13:11 [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Paul Cercueil
  2020-09-04 13:11 ` [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC Paul Cercueil
@ 2020-09-04 13:11 ` Paul Cercueil
  2020-09-14 22:12   ` Rob Herring
  2020-09-21  9:47   ` Wolfram Sang
  2020-09-14 22:13 ` [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Rob Herring
  2020-09-21  9:47 ` Wolfram Sang
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Cercueil @ 2020-09-04 13:11 UTC (permalink / raw)
  To: Rob Herring; +Cc: od, linux-i2c, devicetree, linux-kernel, Paul Cercueil

CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't need to
handle the case where Device Tree is not supported.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/i2c/busses/i2c-jz4780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
index ed2ec86f6f1a..cb4a25ebb890 100644
--- a/drivers/i2c/busses/i2c-jz4780.c
+++ b/drivers/i2c/busses/i2c-jz4780.c
@@ -857,7 +857,7 @@ static struct platform_driver jz4780_i2c_driver = {
 	.remove		= jz4780_i2c_remove,
 	.driver		= {
 		.name	= "jz4780-i2c",
-		.of_match_table = of_match_ptr(jz4780_i2c_of_matches),
+		.of_match_table = jz4780_i2c_of_matches,
 	},
 };
 
-- 
2.28.0


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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-04 13:11 ` [PATCH 3/3] i2c: jz4780: Remove of_match_ptr() Paul Cercueil
@ 2020-09-14 22:12   ` Rob Herring
  2020-09-15 10:07     ` Paul Cercueil
  2020-09-21  9:47   ` Wolfram Sang
  1 sibling, 1 reply; 13+ messages in thread
From: Rob Herring @ 2020-09-14 22:12 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: od, linux-i2c, devicetree, linux-kernel

On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
> CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't need to
> handle the case where Device Tree is not supported.

What about COMPILE_TEST? If not supported, why not?

> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/i2c/busses/i2c-jz4780.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
> index ed2ec86f6f1a..cb4a25ebb890 100644
> --- a/drivers/i2c/busses/i2c-jz4780.c
> +++ b/drivers/i2c/busses/i2c-jz4780.c
> @@ -857,7 +857,7 @@ static struct platform_driver jz4780_i2c_driver = {
>  	.remove		= jz4780_i2c_remove,
>  	.driver		= {
>  		.name	= "jz4780-i2c",
> -		.of_match_table = of_match_ptr(jz4780_i2c_of_matches),
> +		.of_match_table = jz4780_i2c_of_matches,
>  	},
>  };
>  
> -- 
> 2.28.0
> 

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

* Re: [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770
  2020-09-04 13:11 [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Paul Cercueil
  2020-09-04 13:11 ` [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC Paul Cercueil
  2020-09-04 13:11 ` [PATCH 3/3] i2c: jz4780: Remove of_match_ptr() Paul Cercueil
@ 2020-09-14 22:13 ` Rob Herring
  2020-09-21  9:47 ` Wolfram Sang
  3 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2020-09-14 22:13 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: linux-i2c, Rob Herring, linux-kernel, devicetree, od

On Fri, 04 Sep 2020 15:11:50 +0200, Paul Cercueil wrote:
> The I2C controller in the JZ4770 SoC seems to work the exact same as in
> the JZ4780 SoC.
> 
> We could use "ingenic,jz4780-i2c" as a fallback string in the Device
> Tree, but that would be awkward, since the JZ4780 is newer. Instead,
> add a "ingenic,jz4770-i2c" string and use it as fallback for the
> "ingenic,jz4780-i2c" string.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  .../devicetree/bindings/i2c/ingenic,i2c.yaml         | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 

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

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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-14 22:12   ` Rob Herring
@ 2020-09-15 10:07     ` Paul Cercueil
  2020-09-15 16:03       ` Rob Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Cercueil @ 2020-09-15 10:07 UTC (permalink / raw)
  To: Rob Herring; +Cc: od, linux-i2c, devicetree, linux-kernel

Hi Rob,

Le lun. 14 sept. 2020 à 16:12, Rob Herring <robh@kernel.org> a écrit :
> On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
>>  CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't 
>> need to
>>  handle the case where Device Tree is not supported.
> 
> What about COMPILE_TEST? If not supported, why not?

What about it? It will still compile fine with COMPILE_TEST.

-Paul

>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   drivers/i2c/busses/i2c-jz4780.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>>  diff --git a/drivers/i2c/busses/i2c-jz4780.c 
>> b/drivers/i2c/busses/i2c-jz4780.c
>>  index ed2ec86f6f1a..cb4a25ebb890 100644
>>  --- a/drivers/i2c/busses/i2c-jz4780.c
>>  +++ b/drivers/i2c/busses/i2c-jz4780.c
>>  @@ -857,7 +857,7 @@ static struct platform_driver jz4780_i2c_driver 
>> = {
>>   	.remove		= jz4780_i2c_remove,
>>   	.driver		= {
>>   		.name	= "jz4780-i2c",
>>  -		.of_match_table = of_match_ptr(jz4780_i2c_of_matches),
>>  +		.of_match_table = jz4780_i2c_of_matches,
>>   	},
>>   };
>> 
>>  --
>>  2.28.0
>> 



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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-15 10:07     ` Paul Cercueil
@ 2020-09-15 16:03       ` Rob Herring
  2020-09-15 16:07         ` Paul Cercueil
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2020-09-15 16:03 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: od, Linux I2C, devicetree, linux-kernel

On Tue, Sep 15, 2020 at 4:07 AM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Hi Rob,
>
> Le lun. 14 sept. 2020 à 16:12, Rob Herring <robh@kernel.org> a écrit :
> > On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
> >>  CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't
> >> need to
> >>  handle the case where Device Tree is not supported.
> >
> > What about COMPILE_TEST? If not supported, why not?
>
> What about it? It will still compile fine with COMPILE_TEST.

CONFIG_OF could be disabled in that case, so the above reasoning doesn't hold.

Rob

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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-15 16:03       ` Rob Herring
@ 2020-09-15 16:07         ` Paul Cercueil
  2020-09-15 18:58           ` Rob Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Cercueil @ 2020-09-15 16:07 UTC (permalink / raw)
  To: Rob Herring; +Cc: od, Linux I2C, devicetree, linux-kernel



Le mar. 15 sept. 2020 à 10:03, Rob Herring <robh@kernel.org> a écrit :
> On Tue, Sep 15, 2020 at 4:07 AM Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Hi Rob,
>> 
>>  Le lun. 14 sept. 2020 à 16:12, Rob Herring <robh@kernel.org> a 
>> écrit :
>>  > On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
>>  >>  CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't
>>  >> need to
>>  >>  handle the case where Device Tree is not supported.
>>  >
>>  > What about COMPILE_TEST? If not supported, why not?
>> 
>>  What about it? It will still compile fine with COMPILE_TEST.
> 
> CONFIG_OF could be disabled in that case, so the above reasoning 
> doesn't hold.
> 

CONFIG_OF can be disabled in that case, correct, but why should we 
care? The driver will still compile fine.

-Paul



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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-15 16:07         ` Paul Cercueil
@ 2020-09-15 18:58           ` Rob Herring
  2020-09-21  9:42             ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2020-09-15 18:58 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: od, Linux I2C, devicetree, linux-kernel

On Tue, Sep 15, 2020 at 10:07 AM Paul Cercueil <paul@crapouillou.net> wrote:
>
>
>
> Le mar. 15 sept. 2020 à 10:03, Rob Herring <robh@kernel.org> a écrit :
> > On Tue, Sep 15, 2020 at 4:07 AM Paul Cercueil <paul@crapouillou.net>
> > wrote:
> >>
> >>  Hi Rob,
> >>
> >>  Le lun. 14 sept. 2020 à 16:12, Rob Herring <robh@kernel.org> a
> >> écrit :
> >>  > On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
> >>  >>  CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't
> >>  >> need to
> >>  >>  handle the case where Device Tree is not supported.
> >>  >
> >>  > What about COMPILE_TEST? If not supported, why not?
> >>
> >>  What about it? It will still compile fine with COMPILE_TEST.
> >
> > CONFIG_OF could be disabled in that case, so the above reasoning
> > doesn't hold.
> >
>
> CONFIG_OF can be disabled in that case, correct, but why should we
> care? The driver will still compile fine.

Indeed, because jz4780_i2c_of_matches isn't within a CONFIG_OF ifdef
as is sometimes done and is when you need of_match_ptr(). IMO, the
commit msg should have something like "The driver is only used with
CONFIG_OF enabled, so of_match_ptr() is not necessary.
jz4780_i2c_of_matches is always defined."

Rob

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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-15 18:58           ` Rob Herring
@ 2020-09-21  9:42             ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2020-09-21  9:42 UTC (permalink / raw)
  To: Rob Herring; +Cc: Paul Cercueil, od, Linux I2C, devicetree, linux-kernel

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


> Indeed, because jz4780_i2c_of_matches isn't within a CONFIG_OF ifdef
> as is sometimes done and is when you need of_match_ptr(). IMO, the
> commit msg should have something like "The driver is only used with
> CONFIG_OF enabled, so of_match_ptr() is not necessary.
> jz4780_i2c_of_matches is always defined."

I think the commit message says that good enough.


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

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

* Re: [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770
  2020-09-04 13:11 [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Paul Cercueil
                   ` (2 preceding siblings ...)
  2020-09-14 22:13 ` [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Rob Herring
@ 2020-09-21  9:47 ` Wolfram Sang
  3 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2020-09-21  9:47 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Rob Herring, od, linux-i2c, devicetree, linux-kernel

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

On Fri, Sep 04, 2020 at 03:11:50PM +0200, Paul Cercueil wrote:
> The I2C controller in the JZ4770 SoC seems to work the exact same as in
> the JZ4780 SoC.
> 
> We could use "ingenic,jz4780-i2c" as a fallback string in the Device
> Tree, but that would be awkward, since the JZ4780 is newer. Instead,
> add a "ingenic,jz4770-i2c" string and use it as fallback for the
> "ingenic,jz4780-i2c" string.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied to for-next, thanks!


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

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

* Re: [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC
  2020-09-04 13:11 ` [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC Paul Cercueil
@ 2020-09-21  9:47   ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2020-09-21  9:47 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Rob Herring, od, linux-i2c, devicetree, linux-kernel

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

On Fri, Sep 04, 2020 at 03:11:51PM +0200, Paul Cercueil wrote:
> The I2C controller in the JZ4770 SoC seems to work the exact same as in
> the JZ4780 SoC.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied to for-next, thanks!


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

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

* Re: [PATCH 3/3] i2c: jz4780: Remove of_match_ptr()
  2020-09-04 13:11 ` [PATCH 3/3] i2c: jz4780: Remove of_match_ptr() Paul Cercueil
  2020-09-14 22:12   ` Rob Herring
@ 2020-09-21  9:47   ` Wolfram Sang
  1 sibling, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2020-09-21  9:47 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Rob Herring, od, linux-i2c, devicetree, linux-kernel

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

On Fri, Sep 04, 2020 at 03:11:52PM +0200, Paul Cercueil wrote:
> CONFIG_OF is selected by CONFIG_MACH_INGENIC, therefore we don't need to
> handle the case where Device Tree is not supported.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied to for-next, thanks!


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

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

end of thread, other threads:[~2020-09-21  9:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 13:11 [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Paul Cercueil
2020-09-04 13:11 ` [PATCH 2/3] i2c: jz4780: Add compatible string for JZ4770 SoC Paul Cercueil
2020-09-21  9:47   ` Wolfram Sang
2020-09-04 13:11 ` [PATCH 3/3] i2c: jz4780: Remove of_match_ptr() Paul Cercueil
2020-09-14 22:12   ` Rob Herring
2020-09-15 10:07     ` Paul Cercueil
2020-09-15 16:03       ` Rob Herring
2020-09-15 16:07         ` Paul Cercueil
2020-09-15 18:58           ` Rob Herring
2020-09-21  9:42             ` Wolfram Sang
2020-09-21  9:47   ` Wolfram Sang
2020-09-14 22:13 ` [PATCH 1/3] dt-bindings: i2c: ingenic: Add compatible string for the JZ4770 Rob Herring
2020-09-21  9:47 ` Wolfram Sang

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