linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] i2c: bcm2835: Add bcm2711 support
@ 2019-08-27 17:04 Stefan Wahren
  2019-08-27 17:04 ` [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible Stefan Wahren
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stefan Wahren @ 2019-08-27 17:04 UTC (permalink / raw)
  To: Wolfram Sang, Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel, Stefan Wahren

This series has been split out of the recent Raspberry Pi 4 support
series [1]. I hope patch 1 and 2 have a chance to get into Linux 5.4.

Changes since split:
- add Rob's and Eric's Reviewed-by
- address Wolfram's comment regarding of_device_get_match_data
- add patch to distinguish the many interfaces on bcm2711

[1] - https://marc.info/?linux-arm-kernel&m=3D156571347332483

Stefan Wahren (3):
  dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible
  i2c: bcm2835: Avoid clk stretch quirk for BCM2711
  i2c: bcm2835: Add full name of devicetree node to adapter name

 Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt |  4 +++-
 drivers/i2c/busses/i2c-bcm2835.c                           | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible
  2019-08-27 17:04 [PATCH 0/3] i2c: bcm2835: Add bcm2711 support Stefan Wahren
@ 2019-08-27 17:04 ` Stefan Wahren
  2019-08-29 18:52   ` Wolfram Sang
  2019-08-27 17:04 ` [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711 Stefan Wahren
  2019-08-27 17:04 ` [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name Stefan Wahren
  2 siblings, 1 reply; 9+ messages in thread
From: Stefan Wahren @ 2019-08-27 17:04 UTC (permalink / raw)
  To: Wolfram Sang, Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel, Stefan Wahren

Add a new compatible for the BCM2711, which hasn't the clock stretch bug.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt b/Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt
index e9de375..c9a6587 100644
--- a/Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/brcm,bcm2835-i2c.txt
@@ -1,7 +1,9 @@
 Broadcom BCM2835 I2C controller

 Required properties:
-- compatible : Should be "brcm,bcm2835-i2c".
+- compatible : Should be one of:
+	"brcm,bcm2711-i2c"
+	"brcm,bcm2835-i2c"
 - reg: Should contain register location and length.
 - interrupts: Should contain interrupt.
 - clocks : The clock feeding the I2C controller.
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711
  2019-08-27 17:04 [PATCH 0/3] i2c: bcm2835: Add bcm2711 support Stefan Wahren
  2019-08-27 17:04 ` [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible Stefan Wahren
@ 2019-08-27 17:04 ` Stefan Wahren
  2019-08-29 18:52   ` Wolfram Sang
  2019-09-12 17:21   ` Matthias Brugger
  2019-08-27 17:04 ` [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name Stefan Wahren
  2 siblings, 2 replies; 9+ messages in thread
From: Stefan Wahren @ 2019-08-27 17:04 UTC (permalink / raw)
  To: Wolfram Sang, Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel, Stefan Wahren

The I2C block on the BCM2711 isn't affected by the clk stretching bug.
So there is no need to apply the corresponding quirk.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
---
 drivers/i2c/busses/i2c-bcm2835.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 67752f7..ab5502f 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -12,6 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>

@@ -389,7 +390,7 @@ static const struct i2c_algorithm bcm2835_i2c_algo = {
 };

 /*
- * This HW was reported to have problems with clock stretching:
+ * The BCM2835 was reported to have problems with clock stretching:
  * http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html
  * https://www.raspberrypi.org/forums/viewtopic.php?p=146272
  */
@@ -475,7 +476,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 	adap->algo = &bcm2835_i2c_algo;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
-	adap->quirks = &bcm2835_i2c_quirks;
+	adap->quirks = of_device_get_match_data(&pdev->dev);

 	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);

@@ -501,7 +502,8 @@ static int bcm2835_i2c_remove(struct platform_device *pdev)
 }

 static const struct of_device_id bcm2835_i2c_of_match[] = {
-	{ .compatible = "brcm,bcm2835-i2c" },
+	{ .compatible = "brcm,bcm2711-i2c" },
+	{ .compatible = "brcm,bcm2835-i2c", .data = &bcm2835_i2c_quirks },
 	{},
 };
 MODULE_DEVICE_TABLE(of, bcm2835_i2c_of_match);
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name
  2019-08-27 17:04 [PATCH 0/3] i2c: bcm2835: Add bcm2711 support Stefan Wahren
  2019-08-27 17:04 ` [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible Stefan Wahren
  2019-08-27 17:04 ` [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711 Stefan Wahren
@ 2019-08-27 17:04 ` Stefan Wahren
  2019-08-27 21:10   ` Scott Branden
  2019-08-29 18:52   ` Wolfram Sang
  2 siblings, 2 replies; 9+ messages in thread
From: Stefan Wahren @ 2019-08-27 17:04 UTC (permalink / raw)
  To: Wolfram Sang, Eric Anholt, Florian Fainelli, Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel, Stefan Wahren

Inspired by Lori Hikichi's patch for iproc, this adds the full name of
the devicetree node to the adapter name. With the introduction of
BCM2711 it's very difficult to distinguish between the multiple instances.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/i2c/busses/i2c-bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index ab5502f..e01b2b5 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -472,7 +472,8 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 	i2c_set_adapdata(adap, i2c_dev);
 	adap->owner = THIS_MODULE;
 	adap->class = I2C_CLASS_DEPRECATED;
-	strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name));
+	snprintf(adap->name, sizeof(adap->name), "bcm2835 (%s)",
+		 of_node_full_name(pdev->dev.of_node));
 	adap->algo = &bcm2835_i2c_algo;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name
  2019-08-27 17:04 ` [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name Stefan Wahren
@ 2019-08-27 21:10   ` Scott Branden
  2019-08-29 18:52   ` Wolfram Sang
  1 sibling, 0 replies; 9+ messages in thread
From: Scott Branden @ 2019-08-27 21:10 UTC (permalink / raw)
  To: Stefan Wahren, Wolfram Sang, Eric Anholt, Florian Fainelli,
	Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel



On 2019-08-27 10:04 a.m., Stefan Wahren wrote:
> Inspired by Lori Hikichi's patch for iproc, this adds the full name of
> the devicetree node to the adapter name. With the introduction of
> BCM2711 it's very difficult to distinguish between the multiple instances.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Acked-by: Scott Branden <scott.branden@broadcom.com>
> =2D--
>   drivers/i2c/busses/i2c-bcm2835.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm=
> 2835.c
> index ab5502f..e01b2b5 100644
> =2D-- a/drivers/i2c/busses/i2c-bcm2835.c
> +++ b/drivers/i2c/busses/i2c-bcm2835.c
> @@ -472,7 +472,8 @@ static int bcm2835_i2c_probe(struct platform_device *p=
> dev)
>   	i2c_set_adapdata(adap, i2c_dev);
>   	adap->owner =3D THIS_MODULE;
>   	adap->class =3D I2C_CLASS_DEPRECATED;
> -	strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name));
> +	snprintf(adap->name, sizeof(adap->name), "bcm2835 (%s)",
> +		 of_node_full_name(pdev->dev.of_node));
>   	adap->algo =3D &bcm2835_i2c_algo;
>   	adap->dev.parent =3D &pdev->dev;
>   	adap->dev.of_node =3D pdev->dev.of_node;
> =2D-
> 2.7.4
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible
  2019-08-27 17:04 ` [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible Stefan Wahren
@ 2019-08-29 18:52   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-08-29 18:52 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Florian Fainelli, Scott Branden, Ray Jui, Eric Anholt, linux-i2c,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 322 bytes --]

On Tue, Aug 27, 2019 at 07:04:14PM +0200, Stefan Wahren wrote:
> Add a new compatible for the BCM2711, which hasn't the clock stretch bug.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Reviewed-by: Eric Anholt <eric@anholt.net>
> Reviewed-by: Rob Herring <robh@kernel.org>

Applied to for-next, thanks!


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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711
  2019-08-27 17:04 ` [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711 Stefan Wahren
@ 2019-08-29 18:52   ` Wolfram Sang
  2019-09-12 17:21   ` Matthias Brugger
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-08-29 18:52 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Florian Fainelli, Scott Branden, Ray Jui, Eric Anholt, linux-i2c,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 330 bytes --]

On Tue, Aug 27, 2019 at 07:04:15PM +0200, Stefan Wahren wrote:
> The I2C block on the BCM2711 isn't affected by the clk stretching bug.
> So there is no need to apply the corresponding quirk.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Reviewed-by: Eric Anholt <eric@anholt.net>

Applied to for-next, thanks!


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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name
  2019-08-27 17:04 ` [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name Stefan Wahren
  2019-08-27 21:10   ` Scott Branden
@ 2019-08-29 18:52   ` Wolfram Sang
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2019-08-29 18:52 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Florian Fainelli, Scott Branden, Ray Jui, Eric Anholt, linux-i2c,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 374 bytes --]

On Tue, Aug 27, 2019 at 07:04:16PM +0200, Stefan Wahren wrote:
> Inspired by Lori Hikichi's patch for iproc, this adds the full name of
> the devicetree node to the adapter name. With the introduction of
> BCM2711 it's very difficult to distinguish between the multiple instances.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Applied to for-next, thanks!


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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711
  2019-08-27 17:04 ` [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711 Stefan Wahren
  2019-08-29 18:52   ` Wolfram Sang
@ 2019-09-12 17:21   ` Matthias Brugger
  1 sibling, 0 replies; 9+ messages in thread
From: Matthias Brugger @ 2019-09-12 17:21 UTC (permalink / raw)
  To: Stefan Wahren, Wolfram Sang, Eric Anholt, Florian Fainelli,
	Ray Jui, Scott Branden
  Cc: linux-i2c, linux-arm-kernel



On 27/08/2019 19:04, Stefan Wahren wrote:
> The I2C block on the BCM2711 isn't affected by the clk stretching bug.
> So there is no need to apply the corresponding quirk.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Reviewed-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/i2c/busses/i2c-bcm2835.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
> index 67752f7..ab5502f 100644
> --- a/drivers/i2c/busses/i2c-bcm2835.c
> +++ b/drivers/i2c/busses/i2c-bcm2835.c
> @@ -12,6 +12,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> 
> @@ -389,7 +390,7 @@ static const struct i2c_algorithm bcm2835_i2c_algo = {
>  };
> 
>  /*
> - * This HW was reported to have problems with clock stretching:
> + * The BCM2835 was reported to have problems with clock stretching:
>   * http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html
>   * https://www.raspberrypi.org/forums/viewtopic.php?p=146272
>   */
> @@ -475,7 +476,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
>  	adap->algo = &bcm2835_i2c_algo;
>  	adap->dev.parent = &pdev->dev;
>  	adap->dev.of_node = pdev->dev.of_node;
> -	adap->quirks = &bcm2835_i2c_quirks;
> +	adap->quirks = of_device_get_match_data(&pdev->dev);
> 
>  	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);
> 
> @@ -501,7 +502,8 @@ static int bcm2835_i2c_remove(struct platform_device *pdev)
>  }
> 
>  static const struct of_device_id bcm2835_i2c_of_match[] = {
> -	{ .compatible = "brcm,bcm2835-i2c" },
> +	{ .compatible = "brcm,bcm2711-i2c" },
> +	{ .compatible = "brcm,bcm2835-i2c", .data = &bcm2835_i2c_quirks },

RPi4 FW seems to still use bcm2835-i2c as compatible in it's DTB blob. Does this
break the driver or is this something we can improve by changing the FW blob in
the future without breaking the driver now?

Regards,
Matthias

>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, bcm2835_i2c_of_match);
> --
> 2.7.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-09-12 17:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 17:04 [PATCH 0/3] i2c: bcm2835: Add bcm2711 support Stefan Wahren
2019-08-27 17:04 ` [PATCH 1/3] dt-bindings: i2c: bcm2835: Add brcm,bcm2711 compatible Stefan Wahren
2019-08-29 18:52   ` Wolfram Sang
2019-08-27 17:04 ` [PATCH 2/3] i2c: bcm2835: Avoid clk stretch quirk for BCM2711 Stefan Wahren
2019-08-29 18:52   ` Wolfram Sang
2019-09-12 17:21   ` Matthias Brugger
2019-08-27 17:04 ` [PATCH 3/3] i2c: bcm2835: Add full name of devicetree node to adapter name Stefan Wahren
2019-08-27 21:10   ` Scott Branden
2019-08-29 18:52   ` 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).