Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp94438pxh; Tue, 9 Nov 2021 07:49:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGE/VZ74CPpw+pNxcGE6mpfX4mipL+MO3So4D8y5Oc9vpWxaY4sMbATxb3G6kw/inNUR7X X-Received: by 2002:a17:907:1b1f:: with SMTP id mp31mr10533139ejc.319.1636472956950; Tue, 09 Nov 2021 07:49:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636472956; cv=none; d=google.com; s=arc-20160816; b=i7pvNUhzlWwYqgro5GqOxpLWKee/qhn3+MgX/33uBuIOkrk+8jJqL5k+H8Fh/3igNB LUUISkMn4T4ZIG+ryazXYIaO9pvSayPCo+WwCBUB/H7BajDbTmzw6uRybDgxrd13UrX4 d2PoDfjY94i1duiEcgdafFit7gFDlu88qtmK6SZ59H18jfc38YBuWGGIeGe4MEpyr1wJ B2LPDigWm5sqr9sQSlD1fwat/6m8jn84GkDzQmDwrh0v+LLIw6kpy0V0svR70eRiuIVw RlC/kt9HgOaVPcY0fNRhhfSt1A6axIv8TlCiys6OOWS5IyXwamKpWZXhrpiP1wEesUvu jjig== 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; bh=+gKUIeTzZdG0q4VnImlywybxzshRShcdtNnJL+SbWZQ=; b=S3Mz4glio/VMfU5wF0srDXkvNPFIkKJAoxTa7a7Ljsj3y1KYRZSDJYz9I8onKBz4gG f1BtL2hyRjWECiXS6AmQ1ioPC2AOkO93oXizahnKKpLqwBsVgDMwAKnA4rcpUTbI78P8 XN2zqE0/EecrWdACPNmXr5xfyarSLtRfnpbuOYSzpLJXVIhX52m9nVakD00okluLMZ/c 5fy1JBVTluy07qJb9co1pOInYLyK/sqxzJM7tJwLS9W5+BMMsRx5+ueze0545gyf1dje 8r4mA47xhWA68wkObC6rHHlkxLSoW4zYjGiaGBU4YPulX50lgK51kwIoS0mvUKC1R0e5 nAwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si29673339ejq.52.2021.11.09.07.48.53; Tue, 09 Nov 2021 07:49:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241416AbhKIHwz (ORCPT + 99 others); Tue, 9 Nov 2021 02:52:55 -0500 Received: from mail-ua1-f45.google.com ([209.85.222.45]:36517 "EHLO mail-ua1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234870AbhKIHwy (ORCPT ); Tue, 9 Nov 2021 02:52:54 -0500 Received: by mail-ua1-f45.google.com with SMTP id e10so36880379uab.3; Mon, 08 Nov 2021 23:50:09 -0800 (PST) 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=+gKUIeTzZdG0q4VnImlywybxzshRShcdtNnJL+SbWZQ=; b=l7gW4akxxTz5F1AwmPOWpKRBuxKrJRtOr3Qm9ka3V34iNeKKV3w7Jmkdvu9/xptNOn bMuSBrCoNjxntZKXQp9tWL5WP0b5UpImu2kbjFuqXtM61e8bHtPQFW9Ys4/9578hpSIN g/XsOZcPvqoztg1fCrfG2UeWf1PoLVdYRYN0oAYtUR1QC8fslTQp23yVH26a43ma9hzv I5S+bPVqm7PEDhxq+IL7f/zDHozMonOt1BEpg9Lot0gZ6RHn775nJVQ4QsT3FGFfaKEc C4tgJZZ5wh7zxP5E1M1pre8/oxbWsQT/FbfnGjrE/UC+rxtd5uCMuMfO/8UcnBLkTS9y AX0w== X-Gm-Message-State: AOAM5313LR6a+vKhUzDkq+eVjFN5GUwuY/VyNNiMz2LoXxcRcsYH7RHX 0XK8K9MRlky29lkl6O0fWck7ZNbIjG4/3Hxt X-Received: by 2002:a67:ec8f:: with SMTP id h15mr9257885vsp.53.1636444208380; Mon, 08 Nov 2021 23:50:08 -0800 (PST) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com. [209.85.222.49]) by smtp.gmail.com with ESMTPSA id u16sm3243589uad.2.2021.11.08.23.50.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 23:50:08 -0800 (PST) Received: by mail-ua1-f49.google.com with SMTP id i6so36778195uae.6; Mon, 08 Nov 2021 23:50:07 -0800 (PST) X-Received: by 2002:ab0:5552:: with SMTP id u18mr7277925uaa.78.1636444207640; Mon, 08 Nov 2021 23:50:07 -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: Geert Uytterhoeven Date: Tue, 9 Nov 2021 08:49:56 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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