Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4377881ioa; Wed, 27 Apr 2022 02:25:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcdMBPR3ZztnqHhSSXz8muOVkKW60reiFDBsBQd+sOTMuunn8iNOzu3rxGLou/sRyTQExV X-Received: by 2002:a17:902:ccc1:b0:15a:24df:a7cc with SMTP id z1-20020a170902ccc100b0015a24dfa7ccmr27722495ple.42.1651051504038; Wed, 27 Apr 2022 02:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651051504; cv=none; d=google.com; s=arc-20160816; b=E4b7ISHJrzgivlvUoSzGM8xXgNd6+tOudUqqxDNhWlPtHXN61+VkPq/FB9RmBK7U3q P8whThNvfD/2oQT/3bSM3z9h/qSY1+V4h8+UE46DQWg3HyQxzq0UNWVkmJ4fLpDEnpW1 Imyz2SaeNjM1iwG8nVhgmyNqxDNrEFRtme2d3nwYT1P5GXkOoNL2sROLT+iMvecYhi0E V7c7frZ2M+qf6d7uHxJqyflvfOd4fSEP0B7qYas6dIKYu1K0S/MSjN1xP5/HiNGiHr4n Z+2b4uODSQK4hcLgQ9UNeNvKR0f2QZYIHJS+6c+cfRiMoRBWWJN7nwR4zcYVxt4le2xm 7FQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=226dFbtrPQIoFHWbTajhuZZyDWbBc2bREA3l7+aGRpU=; b=X5kx0WkgqxdDqvMEtD42THG4EKrvUPyTp+T/OSMr+Ewz0220fRUnj9jbZOjw3V7ZRw 279oYRAz3zkprAjSh50YBtmnBm87MfXwFj2wCmrLpJmmvCjwRSgImwGr9TbFl57TUFur fhWw15IJUwkn/Y5UGe2EISdqW93+N7x/tFFMpFROsaV9RciXOvaja3zr3LNiWj5h6Ovb pdRYRiwMjRWuuRlXsNSWARw0y+j3EGYMLWbYRLXeZrt1Cdkk+PIRyzxrXtBim/QoK2jd LVnkNd4/FLadq1xoFOGZ2mGDWp1+jkaszb9aZKau75eEuRXhnwM/hWB5iHAH+mVfm8oe oA1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Jyzw4Hux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f26-20020a63555a000000b0039cbfcd3b1dsi962029pgm.830.2022.04.27.02.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:25:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Jyzw4Hux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C4AF24765E; Wed, 27 Apr 2022 02:09:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356275AbiD0AAq (ORCPT + 99 others); Tue, 26 Apr 2022 20:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356358AbiD0AA3 (ORCPT ); Tue, 26 Apr 2022 20:00:29 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA784E3A2; Tue, 26 Apr 2022 16:57:17 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id k23so206393ejd.3; Tue, 26 Apr 2022 16:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=226dFbtrPQIoFHWbTajhuZZyDWbBc2bREA3l7+aGRpU=; b=Jyzw4HuxsKM7Hu+oPvA2i5DvNqRk3iJheUk8PsqA2PIrvnvNCRSR1hzW0XzAc4d3Le r086uigB4IgWOAazr7oCU9tIV0vsFl06lDNlg18LnTCGFDA852D5XoskoSHo8ejGhIWC xi2CzU6rAlrTnAzIs7Zd2LqyjaSpLSL3McpZMconGThl3h091s0deH9lAok66IdeNwmE VbyNguKPd5AiQxpyicpPG5HbyJn2NqXd7lgVhrW/yaDlv4e2kocDGkfPzhMO7McgROyK wyn/6fOfCWxVtCtS/1yoy3m3RTFFc3tFxTZkbbr18tQ4wQCGzNorRBFZQ+qXcWDvgwqr 3bgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=226dFbtrPQIoFHWbTajhuZZyDWbBc2bREA3l7+aGRpU=; b=lC+QzYNemueBQZ4g0jPnSDBFX5rUyw3C1NutDt6lKRKGRWnu/5l/EIf6o8a8qKzdR6 PiBFyEpLR7p0C/LIDtG83clAEqxA2Dsf3nGpgub9HyzLpeePHua5SyUUz0rAdJFlYrze 6eywIgb9D76LkKFII4t02pjkAcjZ8jYq3L6IYLlCK1NJuoaLr9SKdHmTsy/YE16dwKHN 4EzNXYO56Bwy+6v8AdezI9sQgOzjLnNICI+gJYLm8/hS5Wn6UsrGefFB2YGbAs5DsSEu 4Kp8S/Kn/F0EMbDLsvQpvHrULckn+nHUYHN/39c6uybtyjpMEa9lSSCG605oarBoVW9Y 9Cpg== X-Gm-Message-State: AOAM533chH8iRpfUZDuAfmED6poevwKujD1yUwItM2AMksaFok6VV+Rv UnD5wCyY+NZ1vPa4koPpmxE= X-Received: by 2002:a17:906:7c96:b0:6f3:b6c4:7b2 with SMTP id w22-20020a1709067c9600b006f3b6c407b2mr4497132ejo.676.1651017436376; Tue, 26 Apr 2022 16:57:16 -0700 (PDT) Received: from skbuf ([188.25.160.86]) by smtp.gmail.com with ESMTPSA id r13-20020a508d8d000000b00425d3555fc6sm5934416edh.30.2022.04.26.16.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 16:57:15 -0700 (PDT) Date: Wed, 27 Apr 2022 02:57:13 +0300 From: Vladimir Oltean To: Frank Wunderlich Cc: linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, Frank Wunderlich , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Matthias Brugger , Peter Geis , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC v1 1/3] net: dsa: mt753x: make reset optional Message-ID: <20220426235713.engzue7ujwqjdyjc@skbuf> References: <20220426134924.30372-1-linux@fw-web.de> <20220426134924.30372-2-linux@fw-web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426134924.30372-2-linux@fw-web.de> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 26, 2022 at 03:49:22PM +0200, Frank Wunderlich wrote: > From: Frank Wunderlich > > Currently a reset line is required, but on BPI-R2-Pro board > this reset is shared with the gmac and prevents the switch to > be initialized because mdio is not ready fast enough after > the reset. > > So make the reset optional to allow shared reset lines. What does it mean "to allow shared reset lines"? Allow as in "allow them to sit there, unused"? > Signed-off-by: Frank Wunderlich > --- > drivers/net/dsa/mt7530.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 19f0035d4410..ccf4cb944167 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -2134,7 +2134,7 @@ mt7530_setup(struct dsa_switch *ds) > reset_control_assert(priv->rstc); > usleep_range(1000, 1100); > reset_control_deassert(priv->rstc); > - } else { > + } else if (priv->reset) { I don't really understand this patch. gpiod_set_value_cansleep() can tolerate NULL GPIO descriptors. > gpiod_set_value_cansleep(priv->reset, 0); > usleep_range(1000, 1100); > gpiod_set_value_cansleep(priv->reset, 1); > @@ -2276,7 +2276,7 @@ mt7531_setup(struct dsa_switch *ds) > reset_control_assert(priv->rstc); > usleep_range(1000, 1100); > reset_control_deassert(priv->rstc); > - } else { > + } else if (priv->reset) { > gpiod_set_value_cansleep(priv->reset, 0); > usleep_range(1000, 1100); > gpiod_set_value_cansleep(priv->reset, 1); > @@ -3272,8 +3272,7 @@ mt7530_probe(struct mdio_device *mdiodev) > priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset", > GPIOD_OUT_LOW); > if (IS_ERR(priv->reset)) { > - dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); > - return PTR_ERR(priv->reset); > + dev_warn(&mdiodev->dev, "Couldn't get our reset line\n"); I certainly don't understand why you're suppressing the pointer-encoded errors here. The function used is devm_gpiod_get_optional(), which returns NULL for a missing reset-gpios, not IS_ERR(something). The IS_ERR(something) is actually important to not ignore, maybe it's IS_ERR(-EPROBE_DEFER). And this change breaks waiting for the descriptor to become available. > } > } > > -- > 2.25.1 > So what doesn't work without this patch, exactly?