From patchwork Sun Jun 9 18:06:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10983807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D274A924 for ; Sun, 9 Jun 2019 18:07:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC418287E0 for ; Sun, 9 Jun 2019 18:07:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0922288B5; Sun, 9 Jun 2019 18:07:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79E18287E0 for ; Sun, 9 Jun 2019 18:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iVLnMhd7YquJ1x3YweQSZj22/RSJabCs1X6Wx7wlcJk=; b=ovsBdDxj+7cqHF r41DgMr9NOUcA4Tn/nmrHP1B4KhaQHJbcVngmpWs0VL9EYFM6NU+eGYqZg22QUQMVzyu4xgV7/AoT apGCazEmoVnKzvKIlSELdn36pn/MEFpUNfnVv4LLGA2epn9+fio32/Bf//cRN8m4O9UYioBFAwLjk DDJFMeTOon/DRMv5OoRX3yVNXGzg+6D/WsIS8qj/1s4tPbtl/2ubpa0V/LBFR+IBkqiQxwRr44TGr BOH/9cypEx+5LRr2XdMELcdTXvNVHBlRxysNWzZFITgPscn7I/WaTfP81cQoQX9hYoM1hoggeufan 38WNDv6YWenoZ6aTPUFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ha2Du-0004C8-3U; Sun, 09 Jun 2019 18:07:18 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DK-0003cn-0g; Sun, 09 Jun 2019 18:06:43 +0000 Received: by mail-wr1-x442.google.com with SMTP id x4so4229564wrt.6; Sun, 09 Jun 2019 11:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v1cIgIB/50o1TbuP4h7H+LIZ4pZcg3N52gZnolC5tNY=; b=A3czi1Dd8xVadhyrRlkBaDwSqjW0C9T7e2gfiqTTqXBWnEx1kL4TX8qXuj3Xy3qfM0 5iny+h6uiPG/9QeP7zkvWcBhsfeCKwy8CGTIMEvub+SmrvjgDCwUoDfQaHzyiyIDEa+k tWDKdLgoefImiuL1ZqWnHWTvo5c59Wq6zCHt/Vv6ZRmsU02qdpxTsPPS/lTTUNkBCGtz vdCrDYoSvMO9YuyBmmRGpts6a17UQjzMJAyeAXOZdnpNrhhAGAKW+FZXIi562prgpzQ+ 1QDEdy6DOYRCzaSLxU2HiUEllLqYYxBMD9Ivg3yXp8csBGAoHjwsyF5E/2bbPrtPWCnF +pVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v1cIgIB/50o1TbuP4h7H+LIZ4pZcg3N52gZnolC5tNY=; b=BFb/QOZPzrLoXRn/hOgxjipB3qkuW24vgCFsVNhrCb0mXLoGJ+B2IGzpBZ/isVl+s8 j7ryuPugdsCmUkXrgzacE6w0VJJqTzd6VanYcehTh/heRocM+V4o3e4XDiz6O8LcO+2n HrA/23SPsykOsrkIHGMDax/zkuPxx9ZmULJ5a5TjGCzgcc1rld/fPw2e9hreNbffGXHw 4yUvhDiZILeafn1/W97F5VMjYtj+xT0QBMxBLSaVnigGNfmf/jf5CR9vtOg8SqHGJgbA PJJTXHWDm55thc1uZfoVQtVe6g04G+6zXSdybfheBFaMcbF5lpK8ynRDHRiGnKU2sEpD Z+1Q== X-Gm-Message-State: APjAAAUaXXacP7EJckqrEhIpfOSKmY4QE8GPYyApU5CQzCtUAN+E9ITM FKt262dypETNg+dp+L+rcz2pQvQF X-Google-Smtp-Source: APXvYqy7+SScjAXQjSTLA2olnCPdQUH0aM8+Jocv0daXnj4LKMXvOjzcZLeXAUQkW+23xSiMaGdOPw== X-Received: by 2002:a5d:4311:: with SMTP id h17mr43160091wrq.9.1560103597686; Sun, 09 Jun 2019 11:06:37 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400B42D8EB9D711C35E.dip0.t-ipconnect.de. [2003:f1:33dd:a400:b42d:8eb9:d711:c35e]) by smtp.googlemail.com with ESMTPSA id h14sm2007731wrs.66.2019.06.09.11.06.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 09 Jun 2019 11:06:37 -0700 (PDT) From: Martin Blumenstingl To: netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Subject: [RFC next v1 1/5] net: stmmac: drop redundant check in stmmac_mdio_reset Date: Sun, 9 Jun 2019 20:06:17 +0200 Message-Id: <20190609180621.7607-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190609_110642_055465_674E8710 X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl , khilman@baylibre.com, linux-kernel@vger.kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A simplified version of the existing code looks like this: if (priv->device->of_node) { struct device_node *np = priv->device->of_node; if (!np) return 0; The second "if" never evaluates to true because the first "if" checks for exactly the opposite. Drop the redundant check and early return to make the code easier to understand. No functional changes intended. Signed-off-by: Martin Blumenstingl --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 093a223fe408..cb9aad090cc9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -254,9 +254,6 @@ int stmmac_mdio_reset(struct mii_bus *bus) if (data->reset_gpio < 0) { struct device_node *np = priv->device->of_node; - if (!np) - return 0; - data->reset_gpio = of_get_named_gpio(np, "snps,reset-gpio", 0); if (data->reset_gpio < 0) From patchwork Sun Jun 9 18:06:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10983799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28BF513AD for ; Sun, 9 Jun 2019 18:06:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02D0F287E0 for ; Sun, 9 Jun 2019 18:06:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3298288B5; Sun, 9 Jun 2019 18:06:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D24D287E0 for ; Sun, 9 Jun 2019 18:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3gLPdJerDloMbviS1F032AeHgnEIZb2iqUGzB8yPiYg=; b=exgI3KfbxLQFmj qokfE1GKfc307u+KGmF5NmRJK1CM6pY3cyeLfxKB2U+inFpXPg1kCavyzX1RL33K8dAyN9/Yy+j/4 gZ8HzX/WNPvvg2zWdnDCK0/kVx/iFcP6CopCLEVqXEcrJ6Eei9k/d97eXyBwFCCSgdLpWQatZi+sk Fd0SAorBkQ4kHcLZ4Cnqk1BPMGvwEueiHn19tmTWz7qhMPB5A6ZL8s3fOVyt6El92ogo6llhAIaMg 5r+fxP/gDptHQB08qcHkgnA0bz2IaiBezjEWJk5KCNsv6Uzdu6ANd04+ttHnvSzfqgs8JysZAbCAZ clqFpxSPJMHfhUESMGwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DM-0003eQ-H0; Sun, 09 Jun 2019 18:06:44 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DJ-0003ct-1v; Sun, 09 Jun 2019 18:06:42 +0000 Received: by mail-wr1-x441.google.com with SMTP id r18so6873146wrm.10; Sun, 09 Jun 2019 11:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L+JDC+lw/WChmI4eIlkxJqi4XA35RjFjMXnl1SFE8Zw=; b=rIPNPBN3FxtgYpi973wdZA5hbzAbfgGEA1sFuHADXWrscohB30pZOv4p05jtvcQhLB H5/1lXIiZFfOcpSXtLheGEyypOY4cDSZtvYrpdmBHCTKks5okNEG/VrzsusLIvbaSqGa HKyQpwz/kES5l+WcpB/zj+6/gJRhqYrCB0D0CZbSNC/1NVKM7i73s++/uHpE4kUNW0TG OQkam1yor45+bRDZd+mxuNN5ZYIKCN/EAapXGEDiY0gZbGNDeLYGuRA7n/aPZH2A6Vo7 1Sv2IgXVy9g8XIByrnLu+aoHeFuRwTAXjpqo+QlSXpC/00KmGfPqodT37rKahdX09div tmvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L+JDC+lw/WChmI4eIlkxJqi4XA35RjFjMXnl1SFE8Zw=; b=c6KsVzZ7tLFig5LxSDGEmQrDnbKWbWZW4AQL6i3R6fqAocHMTRnUwWBqYBcQw5QilX L6A2AmkTyxmaD/YaElfmxw/qzVJOWLGGRdRo1Xq7gtTIrDzTp6o6gakPoomne0xsawaw wwr0uPZtzlb4HOKLpS3FJC4UfRrUQ4y7Xol1obggm/DaUwfj4flMoLrNjeBT4fcRSrk0 lyGzpQ/JWz6pd4lIc0v2U7TSE+8wU3OIOl8qlAOAks536W3Nglxtk0KRdEmXX7EBBCG4 mjv6+iUYJKlVhK3qw7NtelWTc1LoVNSTLF437H5KGqv9k9o8oD47IqZuoz4txSi2txUk eH9g== X-Gm-Message-State: APjAAAXZ3Wt+X/lP7qj7euBUxqvKD+Wu9ndfx21KA6GDXlHdO1DWzy9D HWR8KGQ1dcqPVTOj71F4ZTs= X-Google-Smtp-Source: APXvYqxL3wLbt7xnWlgNfBsQLu1vOJsDLKzJ5xLFdJ94Txj4JCWTdM3Pa3jsExSk+j1V9ZUl26XLIw== X-Received: by 2002:a5d:5007:: with SMTP id e7mr14502557wrt.231.1560103598868; Sun, 09 Jun 2019 11:06:38 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400B42D8EB9D711C35E.dip0.t-ipconnect.de. [2003:f1:33dd:a400:b42d:8eb9:d711:c35e]) by smtp.googlemail.com with ESMTPSA id h14sm2007731wrs.66.2019.06.09.11.06.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 09 Jun 2019 11:06:38 -0700 (PDT) From: Martin Blumenstingl To: netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Subject: [RFC next v1 2/5] gpio: of: parse stmmac PHY reset line specific active-low property Date: Sun, 9 Jun 2019 20:06:18 +0200 Message-Id: <20190609180621.7607-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190609_110641_106050_CF185186 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl , khilman@baylibre.com, linux-kernel@vger.kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The stmmac driver currently ignores the GPIO flags which are passed via devicetree because it operates with legacy GPIO numbers instead of GPIO descriptors. stmmac assumes that the GPIO is "active HIGH" by default. This can be overwritten by setting "snps,reset-active-low" to make the reset line "active LOW". Recent Amlogic SoCs (G12A which includes S905X2 and S905D2 as well as G12B which includes S922X) use GPIOZ_14 or GPIOZ_15 for the PHY reset line. These GPIOs are special because they are marked as "3.3V input tolerant open drain" pins which means they can only drive the pin output LOW (to reset the PHY) or to switch to input mode (to take the PHY out of reset). The GPIO subsystem already supports this with the GPIO_OPEN_DRAIN and GPIO_OPEN_SOURCE flags in the devicetree bindings. Add the stmmac PHY reset line specific active low parsing to gpiolib-of so stmmac can be ported to GPIO descriptors while being backwards compatible with device trees which use the "old" way of specifying the polarity. Signed-off-by: Martin Blumenstingl Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index aec7bd86ae7e..2533f2471821 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -158,6 +158,12 @@ static void of_gpio_flags_quirks(struct device_node *np, } } } + + /* Legacy handling of stmmac's active-low PHY reset line */ + if (IS_ENABLED(CONFIG_STMMAC_ETH) && + !strcmp(propname, "snps,reset-gpio") && + of_property_read_bool(np, "snps,reset-active-low")) + *flags |= OF_GPIO_ACTIVE_LOW; } /** From patchwork Sun Jun 9 18:06:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10983815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B20C924 for ; Sun, 9 Jun 2019 18:07:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44A82287E0 for ; Sun, 9 Jun 2019 18:07:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38C40288B5; Sun, 9 Jun 2019 18:07:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 882B7287E0 for ; Sun, 9 Jun 2019 18:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XV++1Nvk+l/PTXiCwmAnC6om7IsTbaqSXynIPKB/JWg=; b=grXfXFwJXUcd5I q6tDTDBaZuB4dKR1q9Og11CcpZb9AQO9hajHw0fBq2/imaGX9tZUcD0qJjNYCcBi551XA9Mjy854G K7VnSJVdQCFxc5Oz3DavMnRT1lECzQrCqx2lQag+IUMfNMPpql932UobkgmSF0hwFfGI+UuoUz0nE Ce/DwQ2jVIbrDPeXVMbub04lH6UrITRTcUY+qJd3kNiLzeuBg+k8QyC/kn8hx/u4WrDzDCHr9C8TK HJhJ/TjVFmrq5pB3Lm6Q++LUu9qYINDMXFDWNxMUcK03/+CZg1SoI4PKK/R0AUAS/86d7o038yhky gRAOYxCvgVZ+M5PbsX9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ha2EU-0004q5-8K; Sun, 09 Jun 2019 18:07:54 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DM-0003cy-A1; Sun, 09 Jun 2019 18:06:45 +0000 Received: by mail-wr1-x430.google.com with SMTP id v14so6885414wrr.4; Sun, 09 Jun 2019 11:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JK2PulRNGQmFo+RP5Op3ozfnTDQeRnONpdvKX0IfeL0=; b=eEMGV64K6Dkp3fWw3ioIkBFOiKweVwTU9WGCM5duGAqykGKN3LM2KtArW0Pcqsihni RbvbNv4Xah8lbvMgyLiLVabwbAp+b6WSEyBGlI6gzOmepc4mLHMKyjlrUk3YEfiFPDAr eW5X3IBGH1BFS6befrawNPAoFYfaUIKiATlEUiB2B3e15NmEMSRe+GOr+1yXhDtw1+of Bqc4aoX1zwxiG0jash5n+hSk7AkWEJXXL896PlcDaftDYIVA18qmWAMG4xwyYkboXO/N G5ZW3oobBaxoIWKHbIpaJJtVXl+AG4EsSbbM303lMrpyueFWrPx93mHsDDv7c2axUtNo E+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JK2PulRNGQmFo+RP5Op3ozfnTDQeRnONpdvKX0IfeL0=; b=Nc24KLbWbN0cArHf0Ze6lm7WM5JaqKtV6TegFEuAGdQWz9H94iXi1Dlmy5UBwigvV5 kxbCbMCuTuDVp0M1jLGbSWUUFKd4sd+uiDMMWYmPfSOGykOFM4ZgD52fVrVWRSLupfsr yS6pszHUM1l1xKlRsb+OczebKw3smu4+7vnEpEK0BGIEpA/JAUNd3Hql8wOhKEEM+zz0 4qWO00wgxAjyAqJSTGg9qK8tzX4ds9PknKvs7TWs8rYAk6Tf6wc4QJdDL9uKJOgooV0u oelcokkXQDhxuUnUezm+yHdsEdA1/E+xkooVjGiqmMwG/TMp6LA0edIPlqSYL+4ElNkO Deog== X-Gm-Message-State: APjAAAXnWkDgocLWtpz3yzYQtOIAKxMJ9TD29LrzQn7C1RM7tYnQMzX4 mpMFbo1SZhNSwWyjVHYo4gk= X-Google-Smtp-Source: APXvYqwR6AUeRy3jJYBszo8W1YC0z7PSrhbXvMQ6iABRsfpGm6KCOpQTGRtKGcOmO7GX0cLUzDix3A== X-Received: by 2002:a5d:5510:: with SMTP id b16mr7107494wrv.267.1560103600015; Sun, 09 Jun 2019 11:06:40 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400B42D8EB9D711C35E.dip0.t-ipconnect.de. [2003:f1:33dd:a400:b42d:8eb9:d711:c35e]) by smtp.googlemail.com with ESMTPSA id h14sm2007731wrs.66.2019.06.09.11.06.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 09 Jun 2019 11:06:39 -0700 (PDT) From: Martin Blumenstingl To: netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Subject: [RFC next v1 3/5] net: stmmac: use GPIO descriptors in stmmac_mdio_reset Date: Sun, 9 Jun 2019 20:06:19 +0200 Message-Id: <20190609180621.7607-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190609_110644_353835_356E8BE0 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl , khilman@baylibre.com, linux-kernel@vger.kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Switch stmmac_mdio_reset to use GPIO descriptors. GPIO core handles the "snps,reset-gpio" for GPIO descriptors so we don't need to take care of it inside the driver anymore. The advantage of this is that we now preserve the GPIO flags which are passed via devicetree. This is required on some newer Amlogic boards which use an Open Drain pin for the reset GPIO. This pin can only output a LOW signal or switch to input mode but it cannot output a HIGH signal. There are already devicetree bindings for these special cases and GPIO core already takes care of them but only if we use GPIO descriptors instead of GPIO numbers. Signed-off-by: Martin Blumenstingl Reviewed-by: Linus Walleij --- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index cb9aad090cc9..21bbe3ba3e8e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -20,11 +20,11 @@ Maintainer: Giuseppe Cavallaro *******************************************************************************/ +#include #include #include #include #include -#include #include #include #include @@ -251,34 +251,33 @@ int stmmac_mdio_reset(struct mii_bus *bus) #ifdef CONFIG_OF if (priv->device->of_node) { + struct gpio_desc *reset_gpio; + if (data->reset_gpio < 0) { struct device_node *np = priv->device->of_node; - data->reset_gpio = of_get_named_gpio(np, - "snps,reset-gpio", 0); - if (data->reset_gpio < 0) - return 0; + reset_gpio = devm_gpiod_get_optional(priv->device, + "snps,reset", + GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) + return PTR_ERR(reset_gpio); - data->active_low = of_property_read_bool(np, - "snps,reset-active-low"); of_property_read_u32_array(np, "snps,reset-delays-us", data->delays, 3); + } else { + reset_gpio = gpio_to_desc(data->reset_gpio); - if (devm_gpio_request(priv->device, data->reset_gpio, - "mdio-reset")) - return 0; + gpiod_direction_output(reset_gpio, 0); } - gpio_direction_output(data->reset_gpio, - data->active_low ? 1 : 0); if (data->delays[0]) msleep(DIV_ROUND_UP(data->delays[0], 1000)); - gpio_set_value(data->reset_gpio, data->active_low ? 0 : 1); + gpiod_set_value_cansleep(reset_gpio, 1); if (data->delays[1]) msleep(DIV_ROUND_UP(data->delays[1], 1000)); - gpio_set_value(data->reset_gpio, data->active_low ? 1 : 0); + gpiod_set_value_cansleep(reset_gpio, 0); if (data->delays[2]) msleep(DIV_ROUND_UP(data->delays[2], 1000)); } From patchwork Sun Jun 9 18:06:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10983809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D02F924 for ; Sun, 9 Jun 2019 18:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36FCD287E0 for ; Sun, 9 Jun 2019 18:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B3D8288B5; Sun, 9 Jun 2019 18:07:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C24ED287E0 for ; Sun, 9 Jun 2019 18:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6EFqtok8T/PfeWnx1VNivOQmxu8ZZOCv3IKqt2zk9cc=; b=SKAwlMt8MCxxxC Feuu7R7sc+nEiLp642hOFXQTM1kDZJGb1TwPaZebYvDz7cCi3ETmS8qRUOER5pQaqhvkDq3AzRd1i +LJSbkzoFrDD+/8MvpXkM6vgK825bW9sOK3tacDDaYj057kEr8DTkGcEsx2u438u9xCltFfuRbjvo qF4+yCGV1F4BDS5TAQaJvppKPoNniyGUHswt//QcM8yYJyd2+yc/azBDldor2zDrYgsL4NRQPGUht ALfM9ORjYbxVgWugkvESzNt8kGpxU6LGFwg0PSllUS/3qAkk+9lhmBD6+ABSPxPHjLeWBsm4Q8jvm ceSoOQ2mGamxkMaxzSDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ha2E2-0004Ju-91; Sun, 09 Jun 2019 18:07:26 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DK-0003dS-EM; Sun, 09 Jun 2019 18:06:43 +0000 Received: by mail-wr1-x441.google.com with SMTP id d18so6885699wrs.5; Sun, 09 Jun 2019 11:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TqXz/MCeI1smMWv/lBknpm+xQVHD8zLca+ZLsE7CsxM=; b=cIHMqIRAANO+YYtVflRdIOjyQQiMyWzgkuArvUa0ZqXdUEqWrZg3+SELonp5CYakHf BJtfzZRheP6EXq3w7YoHV48guAMmSuNCBd5yDk2RB0PBGz8nDE5rP0VBKTcTXyzWKBTH 6vYOaOV1L+zjpdS3SmQAV/uqx+ovVKWNAAM6Tc9ddILTVFboRbYhmcSTtlHMM25fNug8 NkhrSFSp8+5Zf/FfVE5ZoO1byAYom2+3a/fU8uOXg9HhK0x9/kClKI9qWgvcWGHMCngP qSjp1dBKcd4BN5iIKvpBLLouWqZg81JlhCHVqceAo+bHxNLH0sfqhVbG1qeJA0eJPpL1 9wmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TqXz/MCeI1smMWv/lBknpm+xQVHD8zLca+ZLsE7CsxM=; b=BI2sCYILEP/VeLEzEY6D0ZxSaE0M84cOjapajS3eLa0BZEWoU6nMsM40ies6w+m3lN RGvr4MkMipOhU0klPJEGCio1MCFwQdWIWO/nNtb6W3qbYJwY3NpBSu9SX5g9+bfIxKBX PbmEX2RJeHo+uvoj0aCLKDrrXgRBFd6ZBhadL5NCFHmXQ8FqDMAmpyhcW1hEhsFL45pq SfiKdcgDi06DX52/i1pJgC9NNoZRSGo3UMoCDgR265envRti5oMZLEWerd8hdLwMC0TB Q4CprJWb9SC+Q8scrfaeoj0bieSfipuZIFfXeoU5HTpTY4yFnOK7CUHLYA1GNCsWJyml QDnQ== X-Gm-Message-State: APjAAAVEv1oBQCuvUw0JLXFYJ99cjkkJYcrE93DI0g3fpk34bkmElF7r bveB9SujZ19EZIWzZn2NrUI= X-Google-Smtp-Source: APXvYqx/9JrA/M8rWMKnXIIb7nHkPwhbRW1rK3/nUNwz5X/AHp/yd/w5vWfFZrKKVybNXW+yf7lcMQ== X-Received: by 2002:a5d:694a:: with SMTP id r10mr19273919wrw.345.1560103601231; Sun, 09 Jun 2019 11:06:41 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400B42D8EB9D711C35E.dip0.t-ipconnect.de. [2003:f1:33dd:a400:b42d:8eb9:d711:c35e]) by smtp.googlemail.com with ESMTPSA id h14sm2007731wrs.66.2019.06.09.11.06.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 09 Jun 2019 11:06:40 -0700 (PDT) From: Martin Blumenstingl To: netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Subject: [RFC next v1 4/5] net: stmmac: use device_property_read_u32_array to read the reset delays Date: Sun, 9 Jun 2019 20:06:20 +0200 Message-Id: <20190609180621.7607-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190609_110642_480420_734FB38E X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl , khilman@baylibre.com, linux-kernel@vger.kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Change stmmac_mdio_reset() to use device_property_read_u32_array() instead of of_property_read_u32_array(). This is meant as a cleanup because we can drop the struct device_node variable. Also it will make it easier to get rid of struct stmmac_mdio_bus_data (or at least make it private) in the future because non-OF platforms can now pass the reset delays as device properties. No functional changes (neither for OF platforms nor for ones that are not using OF, because the modified code is still contained in an "if (priv->device->of_node)"). Signed-off-by: Martin Blumenstingl --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 21bbe3ba3e8e..4614f1f2bffb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -24,9 +24,9 @@ #include #include #include -#include #include #include +#include #include #include "dwxgmac2.h" @@ -254,16 +254,15 @@ int stmmac_mdio_reset(struct mii_bus *bus) struct gpio_desc *reset_gpio; if (data->reset_gpio < 0) { - struct device_node *np = priv->device->of_node; - reset_gpio = devm_gpiod_get_optional(priv->device, "snps,reset", GPIOD_OUT_LOW); if (IS_ERR(reset_gpio)) return PTR_ERR(reset_gpio); - of_property_read_u32_array(np, - "snps,reset-delays-us", data->delays, 3); + device_property_read_u32_array(priv->device, + "snps,reset-delays-us", + data->delays, 3); } else { reset_gpio = gpio_to_desc(data->reset_gpio); From patchwork Sun Jun 9 18:06:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10983817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CDAA13AD for ; Sun, 9 Jun 2019 18:07:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BE8287E0 for ; Sun, 9 Jun 2019 18:07:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B32C288B5; Sun, 9 Jun 2019 18:07:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A66B3287E0 for ; Sun, 9 Jun 2019 18:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9+k9J45ZjhHLENQG18tyCkJ2l9iFV+AGRCOIObR2egk=; b=rgNDmNneLiMNdS uawuK8uZO42KBJIcBZ2/BYbjNmBsBhFsgFFvDCmTpOpOs6rr7aKXPG+DzBf3HKjoo3F3B1u3vIQwJ Uz57q4XZL/ZreW2thCU9z/oqJwGZsYxkXxhSpmKfj0ohXS32P6FtR2kk/qrhnX6l9585bEepFOKrk o5S1L2CWwl6vNHZTidWGKQY4Rkg20o3yAgFdUzC5+jM4VIAwWVPcrdqt4KWKWa6JOO2dbrsJ8eUy1 wPrK9AeE2oW5DX0q1UWi2b2U5a35lVi2bWAC52nfTwhY6g3Syxb+r4cbAk5woZIIzKmp0s+W8+HGP NRJQy2we8nhDrx9wkJeg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ha2EW-0004sM-70; Sun, 09 Jun 2019 18:07:56 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ha2DM-0003eB-U9; Sun, 09 Jun 2019 18:06:46 +0000 Received: by mail-wr1-x444.google.com with SMTP id x17so6864723wrl.9; Sun, 09 Jun 2019 11:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o6l+94PYyR5Sk//+/Av+qY/UlCTL0ZemTkfdZsKsuI8=; b=SdWX2T5SmsidfZY0juvRr2RV/3P4zrsZFer61k+iFahxhK3NUrLNV7vJqaiiediw4R rcD5gjK4F36aGP9zl93OjqUlTqKa+yOuFb1zRg53a0+wk8GFvnBaH8M8tYUWFnkcMhES z6g3IjTPw7r0iQvIRiH4U10mEqwsFgh48Epr6t8L1JT2H0LP+CQmVdEwJdC9x/2+GFfe ovcWvCt7k9lSwAFW8Ms2DOuzngbf6sdjnjZzkBh4CFHgf+kYTWgHWQ8Lg8qcWOqPJ8R/ CDsDEoFU29qpw66hFva8GSiCmvLelz82KUglM9YxxtwJTYRITd8hm+1Gx2C1LtklqYtl dWIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o6l+94PYyR5Sk//+/Av+qY/UlCTL0ZemTkfdZsKsuI8=; b=gCJNgA6nFRIwLcEE9Yj5sWSEHDtS4htNPwfvRMdfrPXvHOFk+YQ5Cv50HKsnRliB44 mpouV1DNIxJ2OBN4khueh48hjrqlhWXjjD8n/U2VMJ/okFfzbPvhIXUaKSg4t88odanF EETxIiddfYxyEVTdcckUXRamgvxnDQH4LFMHu03ZYNPMj7X2PrahrIKws24BOdfjSNZj K2Nv8xw2IkhIm09ih1iWwnq3QG9MHsgLPcXnGGja8rMhNimu3dRaTf22RM5zdDA2jkCf DknYQF24Upjbb57eVuE24uWsfjhan4HO00759A8+8lxmTTKmf6XNk7DIkxm8YbgHuIZT AfwQ== X-Gm-Message-State: APjAAAUv47ynXp/9uelhlAvdq2x0738l8fL/EvL1ooXLudGL6k3/CA8g +O4DmaxksYkFmSF6uBIf3tQ= X-Google-Smtp-Source: APXvYqwvHItbEUzIdxb67KT8Bn7m2rjiaeTPe7nvO5ksWV2HWlyxwGJBfFo9q42FP5gCm25H0bJ3Yg== X-Received: by 2002:adf:fd8d:: with SMTP id d13mr7811983wrr.8.1560103602460; Sun, 09 Jun 2019 11:06:42 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400B42D8EB9D711C35E.dip0.t-ipconnect.de. [2003:f1:33dd:a400:b42d:8eb9:d711:c35e]) by smtp.googlemail.com with ESMTPSA id h14sm2007731wrs.66.2019.06.09.11.06.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 09 Jun 2019 11:06:41 -0700 (PDT) From: Martin Blumenstingl To: netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Subject: [RFC next v1 5/5] arm64: dts: meson: g12a: x96-max: fix the Ethernet PHY reset line Date: Sun, 9 Jun 2019 20:06:21 +0200 Message-Id: <20190609180621.7607-6-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190609_110644_999334_EEFE2AAA X-CRM114-Status: GOOD ( 13.27 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl , khilman@baylibre.com, linux-kernel@vger.kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The PHY reset line and interrupt line are swapped on the X96 Max compared to the Odroid-N2 schematics. This means: - GPIOZ_14 is the interrupt line (on the Odroid-N2 it's the reset line) - GPIOZ_15 is the reset line (on the Odroid-N2 it's the interrupt line) Also the GPIOZ_14 and GPIOZ_15 pins are special. The datasheet describes that they are "3.3V input tolerant open drain (OD) output pins". This means the GPIO controller can drive the output LOW to reset the PHY. To release the reset it can only switch the pin to input mode. The output cannot be driven HIGH for these pins. This requires configuring the reset line as GPIO_OPEN_SOURCE because otherwise the PHY will be stuck in "reset" state (because driving the pin HIGH seeems to result in the same signal as driving it LOW). Switch to GPIOZ_15 for the reset GPIO with the correct flags and drop the "snps,reset-active-low" property as this is now encoded in the GPIO_OPEN_SOURCE flag. Fixes: 51d116557b2044 ("arm64: dts: meson-g12a-x96-max: Add Gigabit Ethernet Support") Signed-off-by: Martin Blumenstingl Reviewed-by: Linus Walleij --- arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts index 98bc56e650a0..c93b639679c0 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts @@ -186,9 +186,8 @@ phy-mode = "rgmii"; phy-handle = <&external_phy>; amlogic,tx-delay-ns = <2>; - snps,reset-gpio = <&gpio GPIOZ_14 0>; + snps,reset-gpio = <&gpio GPIOZ_15 GPIO_OPEN_SOURCE>; snps,reset-delays-us = <0 10000 1000000>; - snps,reset-active-low; }; &pwm_ef {