Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp250596pxh; Tue, 9 Nov 2021 10:07:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvTyu4KKeez3aliu0lIehhnIDvjGPm87HHhlGqn96WabISN42/NIEKFPa6ga6gE3z8f/x5 X-Received: by 2002:a17:907:7d94:: with SMTP id oz20mr12669097ejc.410.1636481224335; Tue, 09 Nov 2021 10:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636481224; cv=none; d=google.com; s=arc-20160816; b=Ke5l4TRGnnunlBJ9XiKrcutbx8RDM4HY/CE5UBWAwtls0+LTfY4vMEg/VnaHvhWDpK xagmytpVi680hX+GimAtyQkFaF+IVUN1ontaZz6N7XwLXQaI8Oi/FqUiyixYe05Gkm37 60Rc8Y1f7iR6WdefRKZwD4EQvQiOiUhqM7KDJV4i2DPVi++KtHPVrBlWheeoo1DAgAmz HfxuCLJfYpIfdJ1t07oEwvSeZj56Np3ulTays+OKT0YFbJLQhxVCBIWbQXZgay/paT3U heof/G2Is0Sssb2GrYRJPO7mSjCtlHhBI0HHFZE+01y/ucw3+dYK8n7VtFcgUAObVQrx 5TbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fkY1X+XuWwRQxh3Iw6z/z5kHVKdaGmVPBbbJBkq6Smo=; b=HBIgjmINPdFfiKwgS8rxUQAAQ/XN0HEL8pycGKCvOu/HmwxiXx/+yLXBuaNKcN5Dll BJPA2YnRsy1o6Cty63JC0JwJ8HkVZcJtMCXWXSSjC6acYtj6H2IKfURLJ6ik0WPmbrab Rtb459SpDFOtI8/o6VZtDBOH3V0aHkREs8j0JFBgy03Di5vM8/G+LrRxzbQ653U7CGiE uSL5cEM3VQwZrfVBbMJ5hdVfSmEIwRkqmUhRiDPIdGaraZQ6v5QvRztlrpp+xT12NXdi W0GBmn0bMkErGr4Du9JScVtRHNoWImKk9M0RiVUO+75CnDEz4sx3WqQaSjpZBWy9QQfr xIlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=li1eRBz1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn19si37160619ejc.462.2021.11.09.10.06.35; Tue, 09 Nov 2021 10:07:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=li1eRBz1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244668AbhKIJGL (ORCPT + 99 others); Tue, 9 Nov 2021 04:06:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244675AbhKIJFq (ORCPT ); Tue, 9 Nov 2021 04:05:46 -0500 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCF56C061764; Tue, 9 Nov 2021 01:03:00 -0800 (PST) Received: by mail-yb1-xb2e.google.com with SMTP id a129so51148823yba.10; Tue, 09 Nov 2021 01:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fkY1X+XuWwRQxh3Iw6z/z5kHVKdaGmVPBbbJBkq6Smo=; b=li1eRBz1bDvEGo8G5EKrdUxULljEOEdjZG/cI+H0BmdNo9OYe6Oc9GPfLW0hAP6H66 llYYrA6jlK5SFSyVLBC4YpEuBq2G8A3HaS47HK/+mg35x8XEXA02aGT18h1x5IkUgEv5 9oNyv8TQwrhha4DiJNZRT0IgRo3AzOp66gQL6F/cyZweq4RePu5JQG86qmoooJGm9ggZ ANHmv9lenS2snSio63Zdqq7XZ2StaB8lJqKo1PZk+fwwdG5mc/bXRZciQp9OpMTH9RV9 iHD4hjIjcLCq+tzZijhzDt10lpUtHEX6FAejWmPffa3NIiaFgoXub0qws8TfETjIC3lp 4b7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fkY1X+XuWwRQxh3Iw6z/z5kHVKdaGmVPBbbJBkq6Smo=; b=FTA5Jc9X37WvY/u9NTwkbknLnGcPUcvZr76JEPNLEFa74WmncPTGD9CQqVaTEGdXcw Sk+O0eVSVAF32zpXeCh8DqUIawFqtwxfFFenep5LNw52XlRn2Yx/xE53niwVDptOe3Xr OuuwqE7IlwZvMjWsrSZCAfgn5JfLBw9brQwq8nEIeb61qBDdn5TeNLUlCkz3bCfLfK07 nG7nuGrPf9zfTOxCfmFYTJtZ0GDkzobllqp5NFTwgVtjiXCyUTa59SEfs+WVzy6uK+kF yij7jsHxCUcoFfhMhL9o8tu4g60LqztKNV7QqJYQ4NMTVLRZZ9Djj8eU4pN4dF3Tf6YK JbEw== X-Gm-Message-State: AOAM533fU6L1VrJWd/MgAoFrZuEMxPxpwTIO9w9V0yKQUpIZWepw2Xtq LWCMXQDQ9lyetPCqSJss7wBo6FKEcbvRCAf7l9o= X-Received: by 2002:a25:1c02:: with SMTP id c2mr6886720ybc.218.1636448580078; Tue, 09 Nov 2021 01:03:00 -0800 (PST) MIME-Version: 1.0 References: <20211103173127.13701-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20211103173127.13701-4-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Tue, 9 Nov 2021 09:02:34 +0000 Message-ID: Subject: Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On Tue, Nov 9, 2021 at 7:50 AM Geert Uytterhoeven wrote: > > Hi Prabhakar, > > On Tue, Nov 9, 2021 at 1:34 AM Lad, Prabhakar > wrote: > > On Mon, Nov 8, 2021 at 4:40 PM Geert Uytterhoeven wrote: > > > On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar > > > 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 > > > > Reviewed-by: Biju Das > > > > > > 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