* [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update
@ 2021-11-03 17:31 Lad Prabhakar
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Lad Prabhakar @ 2021-11-03 17:31 UTC (permalink / raw)
To: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel
Cc: linux-serial, devicetree, linux-kernel, linux-renesas-soc,
Prabhakar, Biju Das, Lad Prabhakar
Hi All,
This patch series updates binding doc to support RZ/G2L and
adds support to perform deassert/assert in sh-sci driver.
Cheers,
Prabhakar
Lad Prabhakar (3):
dt-bindings: serial: renesas,scif: Make resets as a required property
dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
serial: sh-sci: Add reset support for RZ/G2L SoC
.../bindings/serial/renesas,sci.yaml | 43 +++++++++++++---
.../bindings/serial/renesas,scif.yaml | 1 +
drivers/tty/serial/sh-sci.c | 50 ++++++++++++++++---
3 files changed, 81 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property
2021-11-03 17:31 [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update Lad Prabhakar
@ 2021-11-03 17:31 ` Lad Prabhakar
2021-11-08 16:29 ` Geert Uytterhoeven
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
2021-11-03 17:31 ` [PATCH 3/3] serial: sh-sci: Add reset support for " Lad Prabhakar
2 siblings, 1 reply; 15+ messages in thread
From: Lad Prabhakar @ 2021-11-03 17:31 UTC (permalink / raw)
To: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel
Cc: linux-serial, devicetree, linux-kernel, linux-renesas-soc,
Prabhakar, Biju Das, Lad Prabhakar
Make "resets" as required property for RZ/G2L. On RZ/G2L the devices
should be explicitly pulled out of reset for this reason make "resets"
as required property.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Documentation/devicetree/bindings/serial/renesas,scif.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/serial/renesas,scif.yaml b/Documentation/devicetree/bindings/serial/renesas,scif.yaml
index 6b8731f7f2fb..df052dec7e63 100644
--- a/Documentation/devicetree/bindings/serial/renesas,scif.yaml
+++ b/Documentation/devicetree/bindings/serial/renesas,scif.yaml
@@ -151,6 +151,7 @@ if:
compatible:
contains:
enum:
+ - renesas,scif-r9a07g044
- renesas,rcar-gen2-scif
- renesas,rcar-gen3-scif
then:
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
2021-11-03 17:31 [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update Lad Prabhakar
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
@ 2021-11-03 17:31 ` Lad Prabhakar
2021-11-08 16:19 ` Geert Uytterhoeven
2021-11-08 16:21 ` Geert Uytterhoeven
2021-11-03 17:31 ` [PATCH 3/3] serial: sh-sci: Add reset support for " Lad Prabhakar
2 siblings, 2 replies; 15+ messages in thread
From: Lad Prabhakar @ 2021-11-03 17:31 UTC (permalink / raw)
To: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel
Cc: linux-serial, devicetree, linux-kernel, linux-renesas-soc,
Prabhakar, Biju Das, Lad Prabhakar
Add SCI binding documentation for Renesas RZ/G2L SoC.
Also update the example node with real world DT node.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../bindings/serial/renesas,sci.yaml | 43 ++++++++++++++++---
1 file changed, 37 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci.yaml b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
index 22ed2f0b1dc3..6fc573406240 100644
--- a/Documentation/devicetree/bindings/serial/renesas,sci.yaml
+++ b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
@@ -14,7 +14,11 @@ allOf:
properties:
compatible:
- const: renesas,sci
+ oneOf:
+ - items:
+ - enum:
+ - renesas,r9a07g044-sci # RZ/G2{L,LC}
+ - const: renesas,sci # generic SCI compatible UART
reg:
maxItems: 1
@@ -54,18 +58,45 @@ required:
- clocks
- clock-names
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - renesas,r9a07g044-sci
+then:
+ properties:
+ resets:
+ maxItems: 1
+
+ power-domains:
+ maxItems: 1
+
+ required:
+ - resets
+ - power-domains
+
unevaluatedProperties: false
examples:
- |
+ #include <dt-bindings/clock/r9a07g044-cpg.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
aliases {
serial0 = &sci0;
};
- sci0: serial@ffff78 {
- compatible = "renesas,sci";
- reg = <0xffff78 8>;
- interrupts = <88 0>, <89 0>, <90 0>, <91 0>;
- clocks = <&fclk>;
+ sci0: serial@1004d000 {
+ compatible = "renesas,r9a07g044-sci", "renesas,sci";
+ reg = <0x1004d000 0x400>;
+ interrupts = <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 407 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 408 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "eri", "rxi", "txi", "tei";
+ clocks = <&cpg CPG_MOD R9A07G044_SCI0_CLKP>;
clock-names = "fck";
+ power-domains = <&cpg>;
+ resets = <&cpg R9A07G044_SCI0_RST>;
};
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
2021-11-03 17:31 [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update Lad Prabhakar
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
@ 2021-11-03 17:31 ` Lad Prabhakar
2021-11-08 16:39 ` Geert Uytterhoeven
2 siblings, 1 reply; 15+ messages in thread
From: Lad Prabhakar @ 2021-11-03 17:31 UTC (permalink / raw)
To: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel
Cc: linux-serial, devicetree, linux-kernel, linux-renesas-soc,
Prabhakar, Biju Das, Lad Prabhakar
On RZ/G2L devices should be explicitly pulled out of reset for it
to work. This patch adds support to read the "resets" property and
performs deassert/assert when required.
Also, propagate the error to the caller of sci_parse_dt() instead of
returning NULL in case of failure.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Hi Geert,
For handling the resets I was in dual mind whether to perform
reset based on compatible strings or soc-id, let me know your
thoughts. Currently no SoC's use "renesas,sci" so using the same
for performing the reset operation for SCI.
---
drivers/tty/serial/sh-sci.c | 50 +++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 89ee43061d3a..a0f68b887e29 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -37,6 +37,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/scatterlist.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
@@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
};
MODULE_DEVICE_TABLE(of, of_sci_match);
+static void sci_reset_control_assert(void *data)
+{
+ reset_control_assert(data);
+}
+
static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
unsigned int *dev_id)
{
struct device_node *np = pdev->dev.of_node;
+ const struct of_device_id *of_id;
struct plat_sci_port *p;
struct sci_port *sp;
const void *data;
int id;
if (!IS_ENABLED(CONFIG_OF) || !np)
- return NULL;
+ return ERR_PTR(-EINVAL);
+
+ of_id = of_match_device(of_sci_match, &pdev->dev);
+ if (!of_id)
+ return ERR_PTR(-EINVAL);
- data = of_device_get_match_data(&pdev->dev);
+ if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
+ !strcmp(of_id->compatible, "renesas,sci")) {
+ struct reset_control *rstc;
+ int ret;
+
+ rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(rstc)) {
+ dev_err(&pdev->dev, "Error: missing reset ctrl\n");
+ return ERR_PTR(PTR_ERR(rstc));
+ }
+
+ ret = reset_control_deassert(rstc);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to deassert %d\n", ret);
+ return ERR_PTR(ret);
+ }
+
+ ret = devm_add_action_or_reset(&pdev->dev, sci_reset_control_assert, rstc);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register assert devm action, %d\n",
+ ret);
+ return ERR_PTR(ret);
+ }
+ }
+
+ data = of_id->data;
p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL);
if (!p)
- return NULL;
+ return ERR_PTR(-ENOMEM);
/* Get the line number from the aliases node. */
id = of_alias_get_id(np, "serial");
@@ -3227,11 +3263,11 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
id = ffz(sci_ports_in_use);
if (id < 0) {
dev_err(&pdev->dev, "failed to get alias id (%d)\n", id);
- return NULL;
+ return ERR_PTR(-EINVAL);
}
if (id >= ARRAY_SIZE(sci_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n", id);
- return NULL;
+ return ERR_PTR(-EINVAL);
}
sp = &sci_ports[id];
@@ -3318,8 +3354,8 @@ static int sci_probe(struct platform_device *dev)
if (dev->dev.of_node) {
p = sci_parse_dt(dev, &dev_id);
- if (p == NULL)
- return -EINVAL;
+ if (IS_ERR(p))
+ return PTR_ERR(p);
} else {
p = dev->dev.platform_data;
if (p == NULL) {
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
@ 2021-11-08 16:19 ` Geert Uytterhoeven
2021-11-09 0:17 ` Lad, Prabhakar
2021-11-08 16:21 ` Geert Uytterhoeven
1 sibling, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2021-11-08 16:19 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Greg Kroah-Hartman, Rob Herring, Jiri Slaby, Philipp Zabel,
open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Prabhakar
Hi Prabhakar,
On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> Add SCI binding documentation for Renesas RZ/G2L SoC.
>
> Also update the example node with real world DT node.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> --- a/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> +++ b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> @@ -14,7 +14,11 @@ allOf:
>
> properties:
> compatible:
> - const: renesas,sci
> + oneOf:
> + - items:
> + - enum:
> + - renesas,r9a07g044-sci # RZ/G2{L,LC}
> + - const: renesas,sci # generic SCI compatible UART
You added a oneOf, but forgot to keep the old single compatible
value as used on H8/300?
>
> reg:
> maxItems: 1
With the above fixed:
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] 15+ messages in thread
* Re: [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
2021-11-08 16:19 ` Geert Uytterhoeven
@ 2021-11-08 16:21 ` Geert Uytterhoeven
2021-11-09 0:19 ` Lad, Prabhakar
1 sibling, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2021-11-08 16:21 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das
On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> Add SCI binding documentation for Renesas RZ/G2L SoC.
>
> Also update the example node with real world DT node.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> --- a/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> +++ b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> @@ -54,18 +58,45 @@ required:
> - clocks
> - clock-names
>
> +if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - renesas,r9a07g044-sci
> +then:
> + properties:
> + resets:
> + maxItems: 1
> +
> + power-domains:
> + maxItems: 1
> +
> + required:
> + - resets
> + - power-domains
We really should make interrupt-names required everywhere, after
fixing the H8/300 DTS files.
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] 15+ messages in thread
* Re: [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
@ 2021-11-08 16:29 ` Geert Uytterhoeven
2021-11-09 0:36 ` Lad, Prabhakar
0 siblings, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2021-11-08 16:29 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Geert Uytterhoeven, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das
On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> Make "resets" as required property for RZ/G2L. On RZ/G2L the devices
> should be explicitly pulled out of reset for this reason make "resets"
> as required property.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> --- a/Documentation/devicetree/bindings/serial/renesas,scif.yaml
> +++ b/Documentation/devicetree/bindings/serial/renesas,scif.yaml
> @@ -151,6 +151,7 @@ if:
> compatible:
> contains:
> enum:
> + - renesas,scif-r9a07g044
> - renesas,rcar-gen2-scif
> - renesas,rcar-gen3-scif
People might prefer alphabetical sort order...
> then:
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] 15+ messages in thread
* Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
2021-11-03 17:31 ` [PATCH 3/3] serial: sh-sci: Add reset support for " Lad Prabhakar
@ 2021-11-08 16:39 ` Geert Uytterhoeven
2021-11-09 0:33 ` Lad, Prabhakar
0 siblings, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2021-11-08 16:39 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Greg Kroah-Hartman, Rob Herring, Jiri Slaby, Philipp Zabel,
open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das
Hi Prabhakar,
On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> On RZ/G2L devices should be explicitly pulled out of reset for it
> to work. This patch adds support to read the "resets" property and
> performs deassert/assert when required.
>
> Also, propagate the error to the caller of sci_parse_dt() instead of
> returning NULL in case of failure.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Thanks for your patch!
> ---
> Hi Geert,
> For handling the resets I was in dual mind whether to perform
> reset based on compatible strings or soc-id, let me know your
> thoughts. Currently no SoC's use "renesas,sci" so using the same
> for performing the reset operation for SCI.
We do, on H8/300.
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
> };
> MODULE_DEVICE_TABLE(of, of_sci_match);
>
> +static void sci_reset_control_assert(void *data)
> +{
> + reset_control_assert(data);
> +}
> +
> static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> unsigned int *dev_id)
> {
> struct device_node *np = pdev->dev.of_node;
> + const struct of_device_id *of_id;
> struct plat_sci_port *p;
> struct sci_port *sp;
> const void *data;
> int id;
>
> if (!IS_ENABLED(CONFIG_OF) || !np)
> - return NULL;
> + return ERR_PTR(-EINVAL);
> +
> + of_id = of_match_device(of_sci_match, &pdev->dev);
> + if (!of_id)
> + return ERR_PTR(-EINVAL);
>
> - data = of_device_get_match_data(&pdev->dev);
> + if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
> + !strcmp(of_id->compatible, "renesas,sci")) {
This will match on H8/300, too, which doesn't have resets.
Please match against "renesas,sci-r9a07g044" instead.
Please don't use explicit strcmp() calls here, but add a flag to
of_sci_match[].data.
> + struct reset_control *rstc;
> + int ret;
> +
> + rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> + if (IS_ERR(rstc)) {
> + dev_err(&pdev->dev, "Error: missing reset ctrl\n");
> + return ERR_PTR(PTR_ERR(rstc));
> + }
> +
> + ret = reset_control_deassert(rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to deassert %d\n", ret);
> + return ERR_PTR(ret);
> + }
> +
> + ret = devm_add_action_or_reset(&pdev->dev, sci_reset_control_assert, rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to register assert devm action, %d\n",
> + ret);
> + return ERR_PTR(ret);
> + }
> + }
> +
> + data = of_id->data;
>
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] 15+ messages in thread
* Re: [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
2021-11-08 16:19 ` Geert Uytterhoeven
@ 2021-11-09 0:17 ` Lad, Prabhakar
0 siblings, 0 replies; 15+ messages in thread
From: Lad, Prabhakar @ 2021-11-09 0:17 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Lad Prabhakar, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas
Hi Geert,
Thank you for the review.
On Mon, Nov 8, 2021 at 4:19 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > Add SCI binding documentation for Renesas RZ/G2L SoC.
> >
> > Also update the example node with real world DT node.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> > --- a/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> > +++ b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> > @@ -14,7 +14,11 @@ allOf:
> >
> > properties:
> > compatible:
> > - const: renesas,sci
> > + oneOf:
> > + - items:
> > + - enum:
> > + - renesas,r9a07g044-sci # RZ/G2{L,LC}
> > + - const: renesas,sci # generic SCI compatible UART
>
> You added a oneOf, but forgot to keep the old single compatible
> value as used on H8/300?
>
Ouch I grepped renesas,sci only in arm{64}, will fix that.
Cheers,
Prabhakar
> >
> > reg:
> > maxItems: 1
>
> With the above fixed:
> 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] 15+ messages in thread
* Re: [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC
2021-11-08 16:21 ` Geert Uytterhoeven
@ 2021-11-09 0:19 ` Lad, Prabhakar
0 siblings, 0 replies; 15+ messages in thread
From: Lad, Prabhakar @ 2021-11-09 0:19 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Lad Prabhakar, Geert Uytterhoeven, Greg Kroah-Hartman,
Rob Herring, Jiri Slaby, Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Biju Das
Hi Geert,
On Mon, Nov 8, 2021 at 4:21 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > Add SCI binding documentation for Renesas RZ/G2L SoC.
> >
> > Also update the example node with real world DT node.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> > --- a/Documentation/devicetree/bindings/serial/renesas,sci.yaml
> > +++ b/Documentation/devicetree/bindings/serial/renesas,sci.yaml
>
> > @@ -54,18 +58,45 @@ required:
> > - clocks
> > - clock-names
> >
> > +if:
> > + properties:
> > + compatible:
> > + contains:
> > + enum:
> > + - renesas,r9a07g044-sci
> > +then:
> > + properties:
> > + resets:
> > + maxItems: 1
> > +
> > + power-domains:
> > + maxItems: 1
> > +
> > + required:
> > + - resets
> > + - power-domains
>
> We really should make interrupt-names required everywhere, after
> fixing the H8/300 DTS files.
>
Agreed, also in other scif*.yaml files this needs fixing.
Cheers,
Prabhakar
> 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] 15+ messages in thread
* Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
2021-11-08 16:39 ` Geert Uytterhoeven
@ 2021-11-09 0:33 ` Lad, Prabhakar
2021-11-09 7:49 ` Geert Uytterhoeven
0 siblings, 1 reply; 15+ messages in thread
From: Lad, Prabhakar @ 2021-11-09 0:33 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Lad Prabhakar, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Biju Das
Hi Geert,
Thank you for the review.
On Mon, Nov 8, 2021 at 4:40 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > On RZ/G2L devices should be explicitly pulled out of reset for it
> > to work. This patch adds support to read the "resets" property and
> > performs deassert/assert when required.
> >
> > Also, propagate the error to the caller of sci_parse_dt() instead of
> > returning NULL in case of failure.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> Thanks for your patch!
>
> > ---
> > Hi Geert,
> > For handling the resets I was in dual mind whether to perform
> > reset based on compatible strings or soc-id, let me know your
> > thoughts. Currently no SoC's use "renesas,sci" so using the same
> > for performing the reset operation for SCI.
>
> We do, on H8/300.
>
Missed that.
> > --- a/drivers/tty/serial/sh-sci.c
> > +++ b/drivers/tty/serial/sh-sci.c
> > @@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
> > };
> > MODULE_DEVICE_TABLE(of, of_sci_match);
> >
> > +static void sci_reset_control_assert(void *data)
> > +{
> > + reset_control_assert(data);
> > +}
> > +
> > static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> > unsigned int *dev_id)
> > {
> > struct device_node *np = pdev->dev.of_node;
> > + const struct of_device_id *of_id;
> > struct plat_sci_port *p;
> > struct sci_port *sp;
> > const void *data;
> > int id;
> >
> > if (!IS_ENABLED(CONFIG_OF) || !np)
> > - return NULL;
> > + return ERR_PTR(-EINVAL);
> > +
> > + of_id = of_match_device(of_sci_match, &pdev->dev);
> > + if (!of_id)
> > + return ERR_PTR(-EINVAL);
> >
> > - data = of_device_get_match_data(&pdev->dev);
> > + if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
> > + !strcmp(of_id->compatible, "renesas,sci")) {
>
> This will match on H8/300, too, which doesn't have resets.
> Please match against "renesas,sci-r9a07g044" instead.
>
> Please don't use explicit strcmp() calls here, but add a flag to
> of_sci_match[].data.
>
Agreed, does the below hunk look good for handling the reset?
-#define SCI_OF_DATA(type, regtype) (void *)((type) << 16 | (regtype))
+#define SCIx_RESET BIT(31)
+#define SCI_OF_DATA(type, regtype, reset) (void *)(reset |
(type) << 16 | (regtype))
#define SCI_OF_TYPE(data) ((unsigned long)(data) >> 16)
#define SCI_OF_REGTYPE(data) ((unsigned long)(data) & 0xffff)
@@ -3169,7 +3170,11 @@ static const struct of_device_id of_sci_match[] = {
},
{
.compatible = "renesas,scif-r9a07g044",
- .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
+ .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE,
SCIx_RESET),
+ },
+ {
+ .compatible = "renesas,sci-r9a07g044",
+ .data = SCI_OF_DATA(PORT_SCI, SCIx_SCI_REGTYPE, SCIx_RESET),
},
Cheers,
Prabhakar
> > + struct reset_control *rstc;
> > + int ret;
> > +
> > + rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> > + if (IS_ERR(rstc)) {
> > + dev_err(&pdev->dev, "Error: missing reset ctrl\n");
> > + return ERR_PTR(PTR_ERR(rstc));
> > + }
> > +
> > + ret = reset_control_deassert(rstc);
> > + if (ret) {
> > + dev_err(&pdev->dev, "failed to deassert %d\n", ret);
> > + return ERR_PTR(ret);
> > + }
> > +
> > + ret = devm_add_action_or_reset(&pdev->dev, sci_reset_control_assert, rstc);
> > + if (ret) {
> > + dev_err(&pdev->dev, "failed to register assert devm action, %d\n",
> > + ret);
> > + return ERR_PTR(ret);
> > + }
> > + }
> > +
> > + data = of_id->data;
> >
>
> 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] 15+ messages in thread
* Re: [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property
2021-11-08 16:29 ` Geert Uytterhoeven
@ 2021-11-09 0:36 ` Lad, Prabhakar
0 siblings, 0 replies; 15+ messages in thread
From: Lad, Prabhakar @ 2021-11-09 0:36 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Lad Prabhakar, Geert Uytterhoeven, Greg Kroah-Hartman,
Rob Herring, Jiri Slaby, Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Biju Das
Hi Geert,
Thank you for the review.
On Mon, Nov 8, 2021 at 4:29 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > Make "resets" as required property for RZ/G2L. On RZ/G2L the devices
> > should be explicitly pulled out of reset for this reason make "resets"
> > as required property.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> > --- a/Documentation/devicetree/bindings/serial/renesas,scif.yaml
> > +++ b/Documentation/devicetree/bindings/serial/renesas,scif.yaml
> > @@ -151,6 +151,7 @@ if:
> > compatible:
> > contains:
> > enum:
> > + - renesas,scif-r9a07g044
> > - renesas,rcar-gen2-scif
> > - renesas,rcar-gen3-scif
>
> People might prefer alphabetical sort order...
>
My intention was to keep the generic ones at the end as we do for
compatible property. Let me know if you still want me to change it.
Cheers,
Prabhakar
> > then:
>
> 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] 15+ messages in thread
* Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
2021-11-09 0:33 ` Lad, Prabhakar
@ 2021-11-09 7:49 ` Geert Uytterhoeven
2021-11-09 9:02 ` Lad, Prabhakar
0 siblings, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2021-11-09 7:49 UTC (permalink / raw)
To: Lad, Prabhakar
Cc: Lad Prabhakar, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Biju Das
Hi Prabhakar,
On Tue, Nov 9, 2021 at 1:34 AM Lad, Prabhakar
<prabhakar.csengg@gmail.com> wrote:
> On Mon, Nov 8, 2021 at 4:40 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> > <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > > On RZ/G2L devices should be explicitly pulled out of reset for it
> > > to work. This patch adds support to read the "resets" property and
> > > performs deassert/assert when required.
> > >
> > > Also, propagate the error to the caller of sci_parse_dt() instead of
> > > returning NULL in case of failure.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Thanks for your patch!
> >
> > > ---
> > > Hi Geert,
> > > For handling the resets I was in dual mind whether to perform
> > > reset based on compatible strings or soc-id, let me know your
> > > thoughts. Currently no SoC's use "renesas,sci" so using the same
> > > for performing the reset operation for SCI.
> >
> > We do, on H8/300.
> >
> Missed that.
>
> > > --- a/drivers/tty/serial/sh-sci.c
> > > +++ b/drivers/tty/serial/sh-sci.c
> > > @@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
> > > };
> > > MODULE_DEVICE_TABLE(of, of_sci_match);
> > >
> > > +static void sci_reset_control_assert(void *data)
> > > +{
> > > + reset_control_assert(data);
> > > +}
> > > +
> > > static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> > > unsigned int *dev_id)
> > > {
> > > struct device_node *np = pdev->dev.of_node;
> > > + const struct of_device_id *of_id;
> > > struct plat_sci_port *p;
> > > struct sci_port *sp;
> > > const void *data;
> > > int id;
> > >
> > > if (!IS_ENABLED(CONFIG_OF) || !np)
> > > - return NULL;
> > > + return ERR_PTR(-EINVAL);
> > > +
> > > + of_id = of_match_device(of_sci_match, &pdev->dev);
> > > + if (!of_id)
> > > + return ERR_PTR(-EINVAL);
> > >
> > > - data = of_device_get_match_data(&pdev->dev);
> > > + if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
> > > + !strcmp(of_id->compatible, "renesas,sci")) {
> >
> > This will match on H8/300, too, which doesn't have resets.
> > Please match against "renesas,sci-r9a07g044" instead.
> >
> > Please don't use explicit strcmp() calls here, but add a flag to
> > of_sci_match[].data.
> >
> Agreed, does the below hunk look good for handling the reset?
>
> -#define SCI_OF_DATA(type, regtype) (void *)((type) << 16 | (regtype))
> +#define SCIx_RESET BIT(31)
> +#define SCI_OF_DATA(type, regtype, reset) (void *)(reset |
> (type) << 16 | (regtype))
> #define SCI_OF_TYPE(data) ((unsigned long)(data) >> 16)
> #define SCI_OF_REGTYPE(data) ((unsigned long)(data) & 0xffff)
>
> @@ -3169,7 +3170,11 @@ static const struct of_device_id of_sci_match[] = {
> },
> {
> .compatible = "renesas,scif-r9a07g044",
> - .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
> + .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE,
> SCIx_RESET),
> + },
> + {
> + .compatible = "renesas,sci-r9a07g044",
> + .data = SCI_OF_DATA(PORT_SCI, SCIx_SCI_REGTYPE, SCIx_RESET),
> },
That's what I had in mind.
But upon second thought, it might be better to just drop the check,
and obtain an optional reset instead?
After all the reset requirement is not a feature of this specific
SCI(F) variant, but an SoC integration feature. And deasserting
the reset on other SoCs that have a reset should be fine.
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] 15+ messages in thread
* Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
2021-11-09 7:49 ` Geert Uytterhoeven
@ 2021-11-09 9:02 ` Lad, Prabhakar
0 siblings, 0 replies; 15+ messages in thread
From: Lad, Prabhakar @ 2021-11-09 9:02 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Lad Prabhakar, Greg Kroah-Hartman, Rob Herring, Jiri Slaby,
Philipp Zabel, open list:SERIAL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Linux-Renesas, Biju Das
Hi Geert,
On Tue, Nov 9, 2021 at 7:50 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Tue, Nov 9, 2021 at 1:34 AM Lad, Prabhakar
> <prabhakar.csengg@gmail.com> wrote:
> > On Mon, Nov 8, 2021 at 4:40 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
> > > <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > > > On RZ/G2L devices should be explicitly pulled out of reset for it
> > > > to work. This patch adds support to read the "resets" property and
> > > > performs deassert/assert when required.
> > > >
> > > > Also, propagate the error to the caller of sci_parse_dt() instead of
> > > > returning NULL in case of failure.
> > > >
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> > >
> > > Thanks for your patch!
> > >
> > > > ---
> > > > Hi Geert,
> > > > For handling the resets I was in dual mind whether to perform
> > > > reset based on compatible strings or soc-id, let me know your
> > > > thoughts. Currently no SoC's use "renesas,sci" so using the same
> > > > for performing the reset operation for SCI.
> > >
> > > We do, on H8/300.
> > >
> > Missed that.
> >
> > > > --- a/drivers/tty/serial/sh-sci.c
> > > > +++ b/drivers/tty/serial/sh-sci.c
> > > > @@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
> > > > };
> > > > MODULE_DEVICE_TABLE(of, of_sci_match);
> > > >
> > > > +static void sci_reset_control_assert(void *data)
> > > > +{
> > > > + reset_control_assert(data);
> > > > +}
> > > > +
> > > > static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> > > > unsigned int *dev_id)
> > > > {
> > > > struct device_node *np = pdev->dev.of_node;
> > > > + const struct of_device_id *of_id;
> > > > struct plat_sci_port *p;
> > > > struct sci_port *sp;
> > > > const void *data;
> > > > int id;
> > > >
> > > > if (!IS_ENABLED(CONFIG_OF) || !np)
> > > > - return NULL;
> > > > + return ERR_PTR(-EINVAL);
> > > > +
> > > > + of_id = of_match_device(of_sci_match, &pdev->dev);
> > > > + if (!of_id)
> > > > + return ERR_PTR(-EINVAL);
> > > >
> > > > - data = of_device_get_match_data(&pdev->dev);
> > > > + if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
> > > > + !strcmp(of_id->compatible, "renesas,sci")) {
> > >
> > > This will match on H8/300, too, which doesn't have resets.
> > > Please match against "renesas,sci-r9a07g044" instead.
> > >
> > > Please don't use explicit strcmp() calls here, but add a flag to
> > > of_sci_match[].data.
> > >
> > Agreed, does the below hunk look good for handling the reset?
> >
> > -#define SCI_OF_DATA(type, regtype) (void *)((type) << 16 | (regtype))
> > +#define SCIx_RESET BIT(31)
> > +#define SCI_OF_DATA(type, regtype, reset) (void *)(reset |
> > (type) << 16 | (regtype))
> > #define SCI_OF_TYPE(data) ((unsigned long)(data) >> 16)
> > #define SCI_OF_REGTYPE(data) ((unsigned long)(data) & 0xffff)
> >
> > @@ -3169,7 +3170,11 @@ static const struct of_device_id of_sci_match[] = {
> > },
> > {
> > .compatible = "renesas,scif-r9a07g044",
> > - .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
> > + .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE,
> > SCIx_RESET),
> > + },
> > + {
> > + .compatible = "renesas,sci-r9a07g044",
> > + .data = SCI_OF_DATA(PORT_SCI, SCIx_SCI_REGTYPE, SCIx_RESET),
> > },
>
> That's what I had in mind.
>
> But upon second thought, it might be better to just drop the check,
> and obtain an optional reset instead?
Agreed, will do that.
> After all the reset requirement is not a feature of this specific
> SCI(F) variant, but an SoC integration feature. And deasserting
> the reset on other SoCs that have a reset should be fine.
>
Indeed.
Cheers,
Prabhakar
> 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] 15+ messages in thread
* Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
@ 2021-11-05 15:04 kernel test robot
0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2021-11-05 15:04 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 18152 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211103173127.13701-4-prabhakar.mahadev-lad.rj@bp.renesas.com>
References: <20211103173127.13701-4-prabhakar.mahadev-lad.rj@bp.renesas.com>
TO: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
TO: Geert Uytterhoeven <geert+renesas@glider.be>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Rob Herring <robh+dt@kernel.org>
TO: Jiri Slaby <jirislaby@kernel.org>
TO: Philipp Zabel <p.zabel@pengutronix.de>
CC: linux-serial(a)vger.kernel.org
CC: devicetree(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-renesas-soc(a)vger.kernel.org
CC: Prabhakar <prabhakar.csengg@gmail.com>
Hi Lad,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on tty/tty-testing usb/usb-testing v5.15 next-20211105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/RZ-G2L-SCI-support-and-sh-sci-driver-update/20211104-013332
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20211104 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/2e72564a41cb943ebc9d60ea46a187591ff2a576
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lad-Prabhakar/RZ-G2L-SCI-support-and-sh-sci-driver-update/20211104-013332
git checkout 2e72564a41cb943ebc9d60ea46a187591ff2a576
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/tty/serial/sh-sci.c:100:2: note: expanded from macro 'for_each_sr'
for ((_sr) = max_sr(_port); (_sr) >= min_sr(_port); (_sr)--) \
^
drivers/tty/serial/sh-sci.c:2230:2: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:101:37: note: expanded from macro 'for_each_sr'
if ((_port)->sampling_rate_mask & SCI_SR((_sr)))
^~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:88:20: note: expanded from macro 'SCI_SR'
#define SCI_SR(x) BIT((x) - 1)
^~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^ ~~~~
drivers/tty/serial/sh-sci.c:2257:2: warning: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:101:37: note: expanded from macro 'for_each_sr'
if ((_port)->sampling_rate_mask & SCI_SR((_sr)))
^~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:88:20: note: expanded from macro 'SCI_SR'
#define SCI_SR(x) BIT((x) - 1)
^~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^ ~~~~
drivers/tty/serial/sh-sci.c:2254:6: note: Assuming field 'type' is equal to PORT_HSCIF
if (s->port.type != PORT_HSCIF)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:2254:2: note: Taking false branch
if (s->port.type != PORT_HSCIF)
^
drivers/tty/serial/sh-sci.c:2257:2: note: Assuming the condition is true
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:100:30: note: expanded from macro 'for_each_sr'
for ((_sr) = max_sr(_port); (_sr) >= min_sr(_port); (_sr)--) \
^~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:2257:2: note: Loop condition is true. Entering loop body
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:100:2: note: expanded from macro 'for_each_sr'
for ((_sr) = max_sr(_port); (_sr) >= min_sr(_port); (_sr)--) \
^
drivers/tty/serial/sh-sci.c:2257:2: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:101:37: note: expanded from macro 'for_each_sr'
if ((_port)->sampling_rate_mask & SCI_SR((_sr)))
^~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:88:20: note: expanded from macro 'SCI_SR'
#define SCI_SR(x) BIT((x) - 1)
^~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^ ~~~~
drivers/tty/serial/sh-sci.c:2305:2: warning: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:101:37: note: expanded from macro 'for_each_sr'
if ((_port)->sampling_rate_mask & SCI_SR((_sr)))
^~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:88:20: note: expanded from macro 'SCI_SR'
#define SCI_SR(x) BIT((x) - 1)
^~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^ ~~~~
drivers/tty/serial/sh-sci.c:2287:6: note: Assuming field 'type' is equal to PORT_HSCIF
if (s->port.type != PORT_HSCIF)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:2287:2: note: Taking false branch
if (s->port.type != PORT_HSCIF)
^
drivers/tty/serial/sh-sci.c:2305:2: note: Assuming the condition is true
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:100:30: note: expanded from macro 'for_each_sr'
for ((_sr) = max_sr(_port); (_sr) >= min_sr(_port); (_sr)--) \
^~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:2305:2: note: Loop condition is true. Entering loop body
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:100:2: note: expanded from macro 'for_each_sr'
for ((_sr) = max_sr(_port); (_sr) >= min_sr(_port); (_sr)--) \
^
drivers/tty/serial/sh-sci.c:2305:2: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
for_each_sr(sr, s) {
^
drivers/tty/serial/sh-sci.c:101:37: note: expanded from macro 'for_each_sr'
if ((_port)->sampling_rate_mask & SCI_SR((_sr)))
^~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:88:20: note: expanded from macro 'SCI_SR'
#define SCI_SR(x) BIT((x) - 1)
^~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^ ~~~~
>> drivers/tty/serial/sh-sci.c:3369:8: warning: Array subscript is undefined [clang-analyzer-core.uninitialized.ArraySubscript]
sp = &sci_ports[dev_id];
^ ~~~~~~
drivers/tty/serial/sh-sci.c:3342:2: note: 'dev_id' declared without an initial value
unsigned int dev_id;
^~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:3355:6: note: Assuming field 'of_node' is non-null
if (dev->dev.of_node) {
^~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:3355:2: note: Taking true branch
if (dev->dev.of_node) {
^
drivers/tty/serial/sh-sci.c:3356:7: note: Calling 'sci_parse_dt'
p = sci_parse_dt(dev, &dev_id);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:3222:6: note: Left side of '||' is false
if (!IS_ENABLED(CONFIG_OF) || !np)
^
drivers/tty/serial/sh-sci.c:3222:33: note: 'np' is non-null
if (!IS_ENABLED(CONFIG_OF) || !np)
^~
drivers/tty/serial/sh-sci.c:3222:2: note: Taking false branch
if (!IS_ENABLED(CONFIG_OF) || !np)
^
drivers/tty/serial/sh-sci.c:3226:6: note: Assuming 'of_id' is non-null
if (!of_id)
^~~~~~
drivers/tty/serial/sh-sci.c:3226:2: note: Taking false branch
if (!of_id)
^
drivers/tty/serial/sh-sci.c:3229:59: note: Left side of '||' is true
if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
^
drivers/tty/serial/sh-sci.c:3235:3: note: Taking false branch
if (IS_ERR(rstc)) {
^
drivers/tty/serial/sh-sci.c:3241:7: note: Assuming 'ret' is not equal to 0
if (ret) {
^~~
drivers/tty/serial/sh-sci.c:3241:3: note: Taking true branch
if (ret) {
^
drivers/tty/serial/sh-sci.c:3242:4: note: Loop condition is false. Exiting loop
dev_err(&pdev->dev, "failed to deassert %d\n", ret);
^
include/linux/dev_printk.h:144:2: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:109:3: note: expanded from macro 'dev_printk_index_wrap'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit'
#define __printk_index_emit(...) do {} while (0)
^
drivers/tty/serial/sh-sci.c:3243:4: note: Returning without writing to '*dev_id'
return ERR_PTR(ret);
^
drivers/tty/serial/sh-sci.c:3356:7: note: Returning from 'sci_parse_dt'
p = sci_parse_dt(dev, &dev_id);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:3357:7: note: Calling 'IS_ERR'
if (IS_ERR(p))
^~~~~~~~~
include/linux/err.h:36:9: note: Assuming the condition is false
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/sh-sci.c:3357:7: note: Returning from 'IS_ERR'
if (IS_ERR(p))
^~~~~~~~~
drivers/tty/serial/sh-sci.c:3357:3: note: Taking false branch
if (IS_ERR(p))
^
drivers/tty/serial/sh-sci.c:3369:8: note: Array subscript is undefined
sp = &sci_ports[dev_id];
^ ~~~~~~
1 warning generated.
include/linux/list.h:73:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
WRITE_ONCE(prev->next, new);
^
include/asm-generic/rwonce.h:61:2: note: expanded from macro 'WRITE_ONCE'
__WRITE_ONCE(x, val); \
^
include/asm-generic/rwonce.h:55:30: note: expanded from macro '__WRITE_ONCE'
*(volatile typeof(x) *)&(x) = (val); \
^
drivers/gpu/drm/arm/display/komeda/komeda_kms.c:205:6: note: Assuming 'err' is 0
vim +3369 drivers/tty/serial/sh-sci.c
7b6fd3bf82c490 drivers/serial/sh-sci.c Magnus Damm 2009-12-14 3354
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3355 if (dev->dev.of_node) {
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3356 p = sci_parse_dt(dev, &dev_id);
2e72564a41cb94 drivers/tty/serial/sh-sci.c Lad Prabhakar 2021-11-03 3357 if (IS_ERR(p))
2e72564a41cb94 drivers/tty/serial/sh-sci.c Lad Prabhakar 2021-11-03 3358 return PTR_ERR(p);
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3359 } else {
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3360 p = dev->dev.platform_data;
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3361 if (p == NULL) {
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3362 dev_err(&dev->dev, "no platform data supplied\n");
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3363 return -EINVAL;
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3364 }
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3365
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3366 dev_id = dev->id;
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3367 }
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3368
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 @3369 sp = &sci_ports[dev_id];
d535a2305facf9 drivers/serial/sh-sci.c Paul Mundt 2011-01-19 3370 platform_set_drvdata(dev, sp);
0ee70712922c15 drivers/serial/sh-sci.c Magnus Damm 2009-01-21 3371
20bdcab8268cb0 drivers/tty/serial/sh-sci.c Bastian Hecht 2013-12-06 3372 ret = sci_probe_single(dev, dev_id, p, sp);
0ee70712922c15 drivers/serial/sh-sci.c Magnus Damm 2009-01-21 3373 if (ret)
6dae14216c85ee drivers/tty/serial/sh-sci.c Laurent Pinchart 2012-06-13 3374 return ret;
d535a2305facf9 drivers/serial/sh-sci.c Paul Mundt 2011-01-19 3375
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3376 if (sp->port.fifosize > 1) {
6aa57f16185cfd drivers/tty/serial/sh-sci.c Greg Kroah-Hartman 2019-07-04 3377 ret = device_create_file(&dev->dev, &dev_attr_rx_fifo_trigger);
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3378 if (ret)
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3379 return ret;
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3380 }
fa2abb03637a55 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-09-29 3381 if (sp->port.type == PORT_SCIFA || sp->port.type == PORT_SCIFB ||
fa2abb03637a55 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-09-29 3382 sp->port.type == PORT_HSCIF) {
6aa57f16185cfd drivers/tty/serial/sh-sci.c Greg Kroah-Hartman 2019-07-04 3383 ret = device_create_file(&dev->dev, &dev_attr_rx_fifo_timeout);
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3384 if (ret) {
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3385 if (sp->port.fifosize > 1) {
6aa57f16185cfd drivers/tty/serial/sh-sci.c Greg Kroah-Hartman 2019-07-04 3386 device_remove_file(&dev->dev,
6aa57f16185cfd drivers/tty/serial/sh-sci.c Greg Kroah-Hartman 2019-07-04 3387 &dev_attr_rx_fifo_trigger);
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3388 }
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3389 return ret;
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3390 }
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3391 }
5d23188a473da0 drivers/tty/serial/sh-sci.c Ulrich Hecht 2017-02-03 3392
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32715 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-11-09 9:03 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 17:31 [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update Lad Prabhakar
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
2021-11-08 16:29 ` Geert Uytterhoeven
2021-11-09 0:36 ` Lad, Prabhakar
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
2021-11-08 16:19 ` Geert Uytterhoeven
2021-11-09 0:17 ` Lad, Prabhakar
2021-11-08 16:21 ` Geert Uytterhoeven
2021-11-09 0:19 ` Lad, Prabhakar
2021-11-03 17:31 ` [PATCH 3/3] serial: sh-sci: Add reset support for " Lad Prabhakar
2021-11-08 16:39 ` Geert Uytterhoeven
2021-11-09 0:33 ` Lad, Prabhakar
2021-11-09 7:49 ` Geert Uytterhoeven
2021-11-09 9:02 ` Lad, Prabhakar
2021-11-05 15:04 kernel test robot
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.