All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add RZ/G2L I2C support
@ 2021-06-14 19:32 Biju Das
  2021-06-14 19:32 ` [PATCH v2 1/2] dt-bindings: i2c: renesas,riic: Document RZ/G2L I2C controller Biju Das
  2021-06-14 19:32 ` [PATCH v2 2/2] i2c: riic: Add RZ/G2L support Biju Das
  0 siblings, 2 replies; 6+ messages in thread
From: Biju Das @ 2021-06-14 19:32 UTC (permalink / raw)
  To: Philipp Zabel, Rob Herring
  Cc: Biju Das, Chris Brandt, Wolfram Sang, Arnd Bergmann,
	Jarkko Nikula, Jean Delvare, Khalil Blaiech, Krzysztof Kozlowski,
	Yicong Yang, Bence Csókás, Mike Rapoport,
	Uwe Kleine-König, linux-i2c, Geert Uytterhoeven,
	Chris Paterson, Biju Das, Prabhakar Mahadev Lad,
	linux-renesas-soc

This patch series aims to support I2C on RZ/G2L based platforms.

This patchset is based on master branch [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/

v1->v2:-
  * Removed patch 2,4 and 5 as it is queued for v5.15.
  * Added Geert's Rb tag for binding patch
  * Incorporated philipp and Geert's review comments for driver patch 

v1:-
  https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=499069

Biju Das (2):
  dt-bindings: i2c: renesas,riic: Document RZ/G2L I2C controller
  i2c: riic: Add RZ/G2L support

 .../devicetree/bindings/i2c/renesas,riic.yaml | 19 +++++++++++----
 drivers/i2c/busses/Kconfig                    |  1 +
 drivers/i2c/busses/i2c-riic.c                 | 23 ++++++++++++++++++-
 3 files changed, 38 insertions(+), 5 deletions(-)

-- 
2.17.1


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

* [PATCH v2 1/2] dt-bindings: i2c: renesas,riic: Document RZ/G2L I2C controller
  2021-06-14 19:32 [PATCH v2 0/2] Add RZ/G2L I2C support Biju Das
@ 2021-06-14 19:32 ` Biju Das
  2021-06-14 19:32 ` [PATCH v2 2/2] i2c: riic: Add RZ/G2L support Biju Das
  1 sibling, 0 replies; 6+ messages in thread
From: Biju Das @ 2021-06-14 19:32 UTC (permalink / raw)
  To: Rob Herring
  Cc: Biju Das, Chris Brandt, Wolfram Sang, linux-i2c, devicetree,
	Geert Uytterhoeven, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, linux-renesas-soc

Document RZ/G2L I2C controller bindings.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v1->v2
   * Added Geert's Rb tag 
---
 .../devicetree/bindings/i2c/renesas,riic.yaml | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
index 2d6378164958..52d92ec7ec0b 100644
--- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
+++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/i2c/renesas,riic.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Renesas RZ/A I2C Bus Interface (RIIC)
+title: Renesas RZ/A and RZ/G2L I2C Bus Interface (RIIC)
 
 maintainers:
   - Chris Brandt <chris.brandt@renesas.com>
@@ -17,9 +17,10 @@ properties:
   compatible:
     items:
       - enum:
-          - renesas,riic-r7s72100 # RZ/A1H
-          - renesas,riic-r7s9210  # RZ/A2M
-      - const: renesas,riic-rz    # RZ/A
+          - renesas,riic-r7s72100   # RZ/A1H
+          - renesas,riic-r7s9210    # RZ/A2M
+          - renesas,riic-r9a07g044  # RZ/G2{L,LC}
+      - const: renesas,riic-rz      # RZ/A or RZ/G2L
 
   reg:
     maxItems: 1
@@ -56,6 +57,16 @@ required:
   - '#address-cells'
   - '#size-cells'
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,riic-r9a07g044
+then:
+  required:
+    - resets
+
 unevaluatedProperties: false
 
 examples:
-- 
2.17.1


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

* [PATCH v2 2/2] i2c: riic: Add RZ/G2L support
  2021-06-14 19:32 [PATCH v2 0/2] Add RZ/G2L I2C support Biju Das
  2021-06-14 19:32 ` [PATCH v2 1/2] dt-bindings: i2c: renesas,riic: Document RZ/G2L I2C controller Biju Das
@ 2021-06-14 19:32 ` Biju Das
  2021-06-14 19:43   ` Geert Uytterhoeven
  2021-06-15  7:48   ` Philipp Zabel
  1 sibling, 2 replies; 6+ messages in thread
From: Biju Das @ 2021-06-14 19:32 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: Biju Das, Chris Brandt, Wolfram Sang, Arnd Bergmann,
	Jarkko Nikula, Jean Delvare, Khalil Blaiech, Krzysztof Kozlowski,
	Yicong Yang, Bence Csókás, Mike Rapoport,
	Uwe Kleine-König, linux-i2c, Geert Uytterhoeven,
	Chris Paterson, Biju Das, Prabhakar Mahadev Lad,
	linux-renesas-soc

RZ/G2L i2c controller is compatible with RZ/A i2c controller.
By default IP is in reset state, so need to perform release
reset before accessing any register.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2
  * Changed to devm_reset_control_get_exclusive API for reset_control_get.
  * Updated KCONFIG to enable RESET_CONTROLLER only if it is RZ/G2L SoC.
  * Filled .data for RIIC_RZ_A.
---
 drivers/i2c/busses/Kconfig    |  1 +
 drivers/i2c/busses/i2c-riic.c | 23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 281a65d9b44b..17bd15ad8761 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -941,6 +941,7 @@ config I2C_QUP
 config I2C_RIIC
 	tristate "Renesas RIIC adapter"
 	depends on ARCH_RENESAS || COMPILE_TEST
+	select RESET_CONTROLLER if ARCH_R9A07G044
 	help
 	  If you say yes to this option, support will be included for the
 	  Renesas RIIC I2C interface.
diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index 4eccc0f69861..78b84445ee6a 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -42,8 +42,10 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 
 #define RIIC_ICCR1	0x00
 #define RIIC_ICCR2	0x04
@@ -86,6 +88,11 @@
 
 #define RIIC_INIT_MSG	-1
 
+enum riic_type {
+	RIIC_RZ_A,
+	RIIC_RZ_G2L,
+};
+
 struct riic_dev {
 	void __iomem *base;
 	u8 *buf;
@@ -395,7 +402,9 @@ static int riic_i2c_probe(struct platform_device *pdev)
 	struct i2c_adapter *adap;
 	struct resource *res;
 	struct i2c_timings i2c_t;
+	struct reset_control *rstc;
 	int i, ret;
+	enum riic_type type;
 
 	riic = devm_kzalloc(&pdev->dev, sizeof(*riic), GFP_KERNEL);
 	if (!riic)
@@ -412,6 +421,17 @@ static int riic_i2c_probe(struct platform_device *pdev)
 		return PTR_ERR(riic->clk);
 	}
 
+	type = (enum riic_type)of_device_get_match_data(&pdev->dev);
+	if (type == RIIC_RZ_G2L) {
+		rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+		if (IS_ERR(rstc)) {
+			dev_err(&pdev->dev, "Error: missing reset ctrl\n");
+			return PTR_ERR(rstc);
+		}
+
+		reset_control_deassert(rstc);
+	}
+
 	for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {
 		res = platform_get_resource(pdev, IORESOURCE_IRQ, riic_irqs[i].res_num);
 		if (!res)
@@ -472,7 +492,8 @@ static int riic_i2c_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id riic_i2c_dt_ids[] = {
-	{ .compatible = "renesas,riic-rz" },
+	{ .compatible = "renesas,riic-r9a07g044", .data = (void *)RIIC_RZ_G2L },
+	{ .compatible = "renesas,riic-rz", .data = (void *)RIIC_RZ_A },
 	{ /* Sentinel */ },
 };
 
-- 
2.17.1


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

* Re: [PATCH v2 2/2] i2c: riic: Add RZ/G2L support
  2021-06-14 19:32 ` [PATCH v2 2/2] i2c: riic: Add RZ/G2L support Biju Das
@ 2021-06-14 19:43   ` Geert Uytterhoeven
  2021-06-15  7:48   ` Philipp Zabel
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-06-14 19:43 UTC (permalink / raw)
  To: Biju Das
  Cc: Philipp Zabel, Chris Brandt, Wolfram Sang, Arnd Bergmann,
	Jarkko Nikula, Jean Delvare, Khalil Blaiech, Krzysztof Kozlowski,
	Yicong Yang, Bence Csókás, Mike Rapoport,
	Uwe Kleine-König, Linux I2C, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, Linux-Renesas

On Mon, Jun 14, 2021 at 9:33 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> RZ/G2L i2c controller is compatible with RZ/A i2c controller.
> By default IP is in reset state, so need to perform release
> reset before accessing any register.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2
>   * Changed to devm_reset_control_get_exclusive API for reset_control_get.
>   * Updated KCONFIG to enable RESET_CONTROLLER only if it is RZ/G2L SoC.
>   * Filled .data for RIIC_RZ_A.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v2 2/2] i2c: riic: Add RZ/G2L support
  2021-06-14 19:32 ` [PATCH v2 2/2] i2c: riic: Add RZ/G2L support Biju Das
  2021-06-14 19:43   ` Geert Uytterhoeven
@ 2021-06-15  7:48   ` Philipp Zabel
  2021-06-15  7:55     ` Geert Uytterhoeven
  1 sibling, 1 reply; 6+ messages in thread
From: Philipp Zabel @ 2021-06-15  7:48 UTC (permalink / raw)
  To: Biju Das
  Cc: Chris Brandt, Wolfram Sang, Arnd Bergmann, Jarkko Nikula,
	Jean Delvare, Khalil Blaiech, Krzysztof Kozlowski, Yicong Yang,
	Bence Csókás, Mike Rapoport, Uwe Kleine-König,
	linux-i2c, Geert Uytterhoeven, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, linux-renesas-soc

On Mon, 2021-06-14 at 20:32 +0100, Biju Das wrote:
> RZ/G2L i2c controller is compatible with RZ/A i2c controller.
> By default IP is in reset state, so need to perform release
> reset before accessing any register.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2
>   * Changed to devm_reset_control_get_exclusive API for reset_control_get.
>   * Updated KCONFIG to enable RESET_CONTROLLER only if it is RZ/G2L SoC.
>   * Filled .data for RIIC_RZ_A.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

> ---
>  drivers/i2c/busses/Kconfig    |  1 +
>  drivers/i2c/busses/i2c-riic.c | 23 ++++++++++++++++++++++-
>  2 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 281a65d9b44b..17bd15ad8761 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -941,6 +941,7 @@ config I2C_QUP
>  config I2C_RIIC
>  	tristate "Renesas RIIC adapter"
>  	depends on ARCH_RENESAS || COMPILE_TEST
> +	select RESET_CONTROLLER if ARCH_R9A07G044

I would have expected the select RESET_CONTROLLER to be placed under
config ARCH_R9A07G044. Since this is a pretty architecture specific
driver, I'm ok with this as well.

regards
Philipp

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

* Re: [PATCH v2 2/2] i2c: riic: Add RZ/G2L support
  2021-06-15  7:48   ` Philipp Zabel
@ 2021-06-15  7:55     ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-06-15  7:55 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: Biju Das, Chris Brandt, Wolfram Sang, Arnd Bergmann,
	Jarkko Nikula, Jean Delvare, Khalil Blaiech, Krzysztof Kozlowski,
	Yicong Yang, Bence Csókás, Mike Rapoport,
	Uwe Kleine-König, Linux I2C, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, Linux-Renesas

Hi Phillip,

On Tue, Jun 15, 2021 at 9:49 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
> On Mon, 2021-06-14 at 20:32 +0100, Biju Das wrote:
> > RZ/G2L i2c controller is compatible with RZ/A i2c controller.
> > By default IP is in reset state, so need to perform release
> > reset before accessing any register.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > v1->v2
> >   * Changed to devm_reset_control_get_exclusive API for reset_control_get.
> >   * Updated KCONFIG to enable RESET_CONTROLLER only if it is RZ/G2L SoC.
> >   * Filled .data for RIIC_RZ_A.
>
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
>
> > ---
> >  drivers/i2c/busses/Kconfig    |  1 +
> >  drivers/i2c/busses/i2c-riic.c | 23 ++++++++++++++++++++++-
> >  2 files changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index 281a65d9b44b..17bd15ad8761 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -941,6 +941,7 @@ config I2C_QUP
> >  config I2C_RIIC
> >       tristate "Renesas RIIC adapter"
> >       depends on ARCH_RENESAS || COMPILE_TEST
> > +     select RESET_CONTROLLER if ARCH_R9A07G044
>
> I would have expected the select RESET_CONTROLLER to be placed under
> config ARCH_R9A07G044. Since this is a pretty architecture specific
> driver, I'm ok with this as well.

My first thought was "that would enable it unconditionally on
ARCH_R9A07G044, even when RIIC is not used", but then I realized
there's already a "select RESET_CONTROLLER" for CLK_RZG2L (in
linux-next).  So the select for I2C_RIIC can indeed be dropped.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2021-06-15  7:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 19:32 [PATCH v2 0/2] Add RZ/G2L I2C support Biju Das
2021-06-14 19:32 ` [PATCH v2 1/2] dt-bindings: i2c: renesas,riic: Document RZ/G2L I2C controller Biju Das
2021-06-14 19:32 ` [PATCH v2 2/2] i2c: riic: Add RZ/G2L support Biju Das
2021-06-14 19:43   ` Geert Uytterhoeven
2021-06-15  7:48   ` Philipp Zabel
2021-06-15  7:55     ` Geert Uytterhoeven

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.