Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp288189pxb; Mon, 8 Nov 2021 13:41:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTJP7CAi81lRctl1uY2YM3F0zmi9GeF7+RCKKgAnTTSjarSm8TRRZ8ydwXq09MMRuEGoUP X-Received: by 2002:a92:ad0c:: with SMTP id w12mr1663575ilh.20.1636407682557; Mon, 08 Nov 2021 13:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636407682; cv=none; d=google.com; s=arc-20160816; b=T3BZRR2Q7kJhCqJRJgeHmu27sT3GRSa9/RuUuaIjlJAYLrjM2h8VYGz9sVy+NPc5Q0 IwbIhxFhI/5KmqkhWTMSmzAEyfcajXkm4zzujlWoa/8RLIQ5Z6Wy7E4oWieK988/1dvC 6IWrdZPP2G3k4dnLI8GV1c+9tKmhOoXTFWqoRXhs9CPf1LPddVhmRE5YY+hn6XDhwFqd 01izwdvo6JRd8MGKv4XQyRSCCz1L0y0ZE+nzSH/jrkQLzbTaNMnApcL0/wV10SmtlmPV Wr9WhLhYVwSD9xyy8SJF75UoVRqrZ2rBrQqiQLAxJA+7U9Zwi18VUSHHTavHuUrGfZmz 89iw== 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=35vjIg1mcgYM3GxZvYXmrSJn5EeE32/H7G52/qXH9NU=; b=Kblq29PqwtXiEwqxxSEggKvQuqZPIJHL45pq3af0X5z1DP1Ts4v9KspW/Wsrn5PheI tSfYFHcwxRmv6w2b3IhhsKRfDT4gdYkurOa2a7hp3XvOKmNYPGUSsYpA+JOlHar6konF 96PAWHLXESxLRwt4+JmC7yvEUL/MGOjfiwCB96ZoWYi/3ScM/jDUtXyR0bxpLZMlSi3/ vA5M4ygOUcjU4M5mg2++ZDVDG978Wj1YCayqGlWmWiPH1ukiIsvDkv0K2Zlx3hJ5xWld d0X+pN0OOjOLQ0ZS9GTyYOvOdsZ0iu+u/qqRSZP6kt415ZDBHKzL2Op2DanqZmJ4LLf/ IIjA== 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 h5si26831190ilq.93.2021.11.08.13.41.09; Mon, 08 Nov 2021 13:41:22 -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 S237865AbhKHQmy (ORCPT + 99 others); Mon, 8 Nov 2021 11:42:54 -0500 Received: from mail-ua1-f41.google.com ([209.85.222.41]:37747 "EHLO mail-ua1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236528AbhKHQmt (ORCPT ); Mon, 8 Nov 2021 11:42:49 -0500 Received: by mail-ua1-f41.google.com with SMTP id l43so32697295uad.4; Mon, 08 Nov 2021 08:40:05 -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=35vjIg1mcgYM3GxZvYXmrSJn5EeE32/H7G52/qXH9NU=; b=YsSpXEH31wEVfYDIK1IB8WRpSq6hhCnSFYILejpBTgSwdRJkZdT3lteNnpJeCK7PQ1 yIgHRhK0gkh+ty9jf0OLeHCEVa3xqrzm4taAICXAAvLvykE4gnvPPonLsEI8TLeiQ84A PKmxzQeGCXzVOeAVrKLXmHyY4rszg/v89lblDlWZ/tzGLZvS8g0CjaYq3dwoXS5iXKEU Cg4zaMKfYaDWVGmdJ8EHJYHu6wOdRlyMf1V+d5g8fNJUasEQX7UYsbtZUQFBGAFkUsq3 U38jwCwxKJRrXLV/KxsOXrMo6EncikGqMiGv6+45mSydKQCpqfte9GEuE/U05qQKJkm5 l5wA== X-Gm-Message-State: AOAM532vPZ9owux/PE4qTZcIVxKMbewcNspfPymX1Ow3sGnKwH9S56oj ijDbZCqMH8ILVvHBt76n0KFHa4z4QEImJu4g X-Received: by 2002:a05:6102:b14:: with SMTP id b20mr6609990vst.17.1636389604377; Mon, 08 Nov 2021 08:40:04 -0800 (PST) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com. [209.85.222.46]) by smtp.gmail.com with ESMTPSA id y24sm2986511uaq.17.2021.11.08.08.40.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 08:40:04 -0800 (PST) Received: by mail-ua1-f46.google.com with SMTP id az37so32694947uab.13; Mon, 08 Nov 2021 08:40:04 -0800 (PST) X-Received: by 2002:a05:6102:e82:: with SMTP id l2mr991282vst.37.1636389603858; Mon, 08 Nov 2021 08:40:03 -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: <20211103173127.13701-4-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Geert Uytterhoeven Date: Mon, 8 Nov 2021 17:39:52 +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: 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prabhakar, 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. > --- 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