From patchwork Fri Jul 26 10:27:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11060737 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 A65CA1398 for ; Fri, 26 Jul 2019 10:27:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9377D28A7A for ; Fri, 26 Jul 2019 10:27:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8742F28A7E; Fri, 26 Jul 2019 10:27:48 +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 2339A28A7A for ; Fri, 26 Jul 2019 10:27:48 +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: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:In-Reply-To:References: List-Owner; bh=jMI7xdI6XZ8GOPkz6EphTjwyu43sF/vwcOYUBJFFaWg=; b=oIfa6zNI01u8h6 BnXV1EdSBnalaWRXLSsn8m0rRuRIvj/Y+6DTTzAOOf7iealF5dzUdG+dcRlVssqMEh+Vx/5Y/HlpD wwsikeetXaGXMcAofQJrPTSMzGgDrCiwJgO0iQ9yWgk0iOx9/KZy1k2TX+SV+oOg6zQxIy3L4x3oR Q0l4WaKCSXx15hDDFm7vVLHCIS3ZRxYu9RV6gfklM++T1eOKvJZ5mra+8UW0Sioq9hxKBLI688yTd +dxghziURRwvEWCFaYIXqERmaRJwCdTn6nMGCHfqOV9EfQrxJB5Uj3q3LoRWMkEqR50ZsWaNrU9AZ EuclaJNCsTI8NRC91Utg==; 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 1hqxRz-0004Qc-Ps; Fri, 26 Jul 2019 10:27:47 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hqxRw-0004Pm-92 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 10:27:45 +0000 Received: by mail-ed1-x541.google.com with SMTP id w13so52872925eds.4 for ; Fri, 26 Jul 2019 03:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fgttaSu7/U77TvA6+GrlVNqDjBSP1cH/fJcE2FiVPSc=; b=Xq7dFVT2BAh2OKlWZADYRxsgSTDnQyREt3lSe51iX1a4VbZ5tbKueNdrd8Tl55F0fH jE3HFiLoW8gJBQlPDGPk09oV2PXFmSxEwhfiga28IsSjQuAMyh4iZz9h/hztR9xouEnd sqIB7z6gCSaIlN39Lb+vWX3jNLyTJ3SmcVHqvm1x0WsB54H9SOBztWS7rYaON6kYgWk5 bhSswDrnGIsOjLJshXfCPLprUZ4ieqHvqFCwH8muxoHfuCX/cVp+2R3n3jCysfYL+MwC t99y8R7UaVlbRoQhdBAUbmy7gOX+/ySaOLp618i6NcMZT6wRk6d4Z0iX4GpyPt/RNhGW iYZw== 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:mime-version :content-transfer-encoding; bh=fgttaSu7/U77TvA6+GrlVNqDjBSP1cH/fJcE2FiVPSc=; b=NwUgHmfjIeIAK1GtkRYkgrpLZVdHhOcoERUnFkE/gZah0SgGpHc++68isA50LzgzlD 5X+q145Qbd/mhXd+LvBwmcM27thCoY04u9xERe0UhnIx3s3jDAlWssIiHiXD8GWFuI6o Do0O+4+9TxHFiR905kk3WNXQS4McUar3XjOEe4OkWrobkGIY17FFA+l6JPJ9xkwVrfU3 HDr7LoazB0yKH9fvowB7utRSTt2FAAd5+/uqrmyeli8qCGuKQGCH6DYURjBJ1Xhu9UUy 3SrbXfiFr7A7rOqIxnqxKXDHBJ2tHtKLQlC/JQZHAjZMC6aiCkk5951DWTAVxgTtsfBl bhLw== X-Gm-Message-State: APjAAAViK4BUSiw3DLRDPFxQxKaRT3BYJBtBdW2UsbH5b8Jstsu+2GpV Rwf/5gQG/g3G3pKU0/rcQXQ= X-Google-Smtp-Source: APXvYqwQ4adhOOkffJ+ooQljdZOK2+c+FVkKICz8TXR5in66XUj5Vqepfv9d8dlyGCxc9wsvjX1kJA== X-Received: by 2002:a50:b3b8:: with SMTP id s53mr81412876edd.61.1564136862640; Fri, 26 Jul 2019 03:27:42 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id v12sm10210515ejj.52.2019.07.26.03.27.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 03:27:42 -0700 (PDT) From: Thierry Reding To: "David S . Miller" Subject: [PATCH net-next 1/2] net: stmmac: Make MDIO bus reset optional Date: Fri, 26 Jul 2019 12:27:40 +0200 Message-Id: <20190726102741.27872-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190726_032744_322529_8B430000 X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , netdev@vger.kernel.org, Jon Hunter , Jose Abreu , linux-tegra@vger.kernel.org, Giuseppe Cavallaro , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding The Tegra EQOS driver already resets the MDIO bus at probe time via the reset GPIO specified in the phy-reset-gpios device tree property. There is no need to reset the bus again later on. This avoids the need to query the device tree for the snps,reset GPIO, which is not part of the Tegra EQOS device tree bindings. This quiesces an error message from the generic bus reset code if it doesn't find the snps,reset related delays. Signed-off-by: Thierry Reding --- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 3 +++ drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 4 +++- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 +++++++- include/linux/stmmac.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index 3a14cdd01f5f..66933332c68e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -333,6 +333,9 @@ static void *tegra_eqos_probe(struct platform_device *pdev, usleep_range(2000, 4000); gpiod_set_value(eqos->reset, 0); + /* MDIO bus was already reset just above */ + data->mdio_bus_data->needs_reset = false; + eqos->rst = devm_reset_control_get(&pdev->dev, "eqos"); if (IS_ERR(eqos->rst)) { err = PTR_ERR(eqos->rst); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 4304c1abc5d1..40c42637ad75 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -348,7 +348,9 @@ int stmmac_mdio_register(struct net_device *ndev) max_addr = PHY_MAX_ADDR; } - new_bus->reset = &stmmac_mdio_reset; + if (mdio_bus_data->needs_reset) + new_bus->reset = &stmmac_mdio_reset; + snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s-%x", new_bus->name, priv->plat->bus_id); new_bus->priv = ndev; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 86f9c07a38cf..d5d08e11c353 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -63,6 +63,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat) plat->has_gmac = 1; plat->force_sf_dma_mode = 1; + plat->mdio_bus_data->needs_reset = true; plat->mdio_bus_data->phy_mask = 0; /* Set default value for multicast hash bins */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 73fc2524372e..333b09564b88 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -342,10 +342,16 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, mdio = true; } - if (mdio) + if (mdio) { plat->mdio_bus_data = devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data), GFP_KERNEL); + if (!plat->mdio_bus_data) + return -ENOMEM; + + plat->mdio_bus_data->needs_reset = true; + } + return 0; } diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 7d06241582dd..7b3e354bcd3c 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -81,6 +81,7 @@ struct stmmac_mdio_bus_data { unsigned int phy_mask; int *irqs; int probed_phy_irq; + bool needs_reset; }; struct stmmac_dma_cfg { From patchwork Fri Jul 26 10:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11060741 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 916181399 for ; Fri, 26 Jul 2019 10:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B6B428A7A for ; Fri, 26 Jul 2019 10:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CA7528A80; Fri, 26 Jul 2019 10:28:00 +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 0EF4128A7A for ; Fri, 26 Jul 2019 10:28:00 +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=aQA554cnE07zewwS60IguwRH4F/F0ifVUtwmFZgwv7c=; b=X2Dh1I3TujEjI/ vfcTTWdCU1rpeTbEmtlrehNPJN+QmlG/zqLXHsOCLK8/Q1TQKfDQaYGP9iK9ntP6116NZDFL9iCeu Ks4F2T+aJRzWVCEwgao8SY4UFXq4r2kHG4GF36kNLAOZ0+Y1nAHEEi4RrtyjXXXRRWMpI87bcMOHu qI1cyne6geBvf5QOYxD22ithmCt63uIMC3b9yldlsZMWrwYRV2alU0e3i82Ba2FIA873q5JCn7sX6 vuLIyaPElnpvR9kr6Mf2SE6QrpmlqtlLFu2MNOurXlgqQkTZDcvYtcq4rvklnDzu5iZtzvsUM3C5s ooUZiTTXGvGyyufe4d8w==; 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 1hqxSA-0004Zf-H1; Fri, 26 Jul 2019 10:27:58 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hqxRx-0004Q9-NQ for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 10:27:47 +0000 Received: by mail-ed1-x544.google.com with SMTP id k8so52807758edr.11 for ; Fri, 26 Jul 2019 03:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rewoVtfouB0g/nXQoB/RM2R5vzQI4yMuwrUsg0cojFo=; b=g8OSiArKsqZUyCCRvOtz447BXqWLIh9TENdSd8soBDBDjAQP6kBC/Y76w9OQNAN7uz zhThUk4Hz5YWZi1BGjCD9kUPg94uaxS/LiUQtCTuD+W3GO8nyy/AkwTIypOZGrkn/ZKP CoYfUqQARRdDtUaux9UkD8IULax0ircXxFaMu7puylYmpUFF/rIqcRYIgNfZ4Qe3McR7 xvl86H14llCjOu/smTrglGY+lgpx99qiJVKUhau8QuKtBiC+Ey+K/DpjE+8f8vBbMjV3 7twoAb/xQJzOTT90xqWT9/bFfjdLDAIaCEydE3OXhjg1EDtKCLDTf3B6cDa8yB4q8dKB 7fHg== 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=rewoVtfouB0g/nXQoB/RM2R5vzQI4yMuwrUsg0cojFo=; b=DXXWRu3XPrTVdhgt6WLDQUP7vhpSzLxRfXESlYjGtr6YvxoMk/WV96So/ml0vVZYOO wT/v60ylGilVRcIQUeBbpI1muBCNadxZaUFh7tO8mqF4MtJwiB5TdUesL93BL5Tssx/C ji6QszinT25IRmFdfWFPkoSL78x3jaCb+w+8gj55Wj0NW+5N7/p9TrxxCyhDB4hYY0QF hKHTJ5f3TbPhOOwqIiE+5IObuK/MCcC0IB17iv+sJbMJYeMeeJ/r7AGDq8CRy82T0Cvr LKkQnrqHqVnpipQBd9RHk/YRzfP8K5ZufDyt3nwp1x1rbZNLi0Sdhal9jMuTaj4awnLU JUsg== X-Gm-Message-State: APjAAAX5quDLZWv9A89gpidYexYpadyzPBbP/YF3Mtjkqr3V3GBSZJ68 4bTs0GTxhqOh7/CpYAXpwvU= X-Google-Smtp-Source: APXvYqzHJhuMDDE9QF7E9JMSoVtDHfi8t0kysgpga1ZEPI+Hjwzo13gVjk020JOqtEC8/t8S217O2Q== X-Received: by 2002:a17:906:bcd6:: with SMTP id lw22mr72674992ejb.68.1564136863962; Fri, 26 Jul 2019 03:27:43 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id h10sm13307080edn.86.2019.07.26.03.27.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 03:27:43 -0700 (PDT) From: Thierry Reding To: "David S . Miller" Subject: [PATCH net-next 2/2] net: stmmac: Do not request stmmaceth clock Date: Fri, 26 Jul 2019 12:27:41 +0200 Message-Id: <20190726102741.27872-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726102741.27872-1-thierry.reding@gmail.com> References: <20190726102741.27872-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190726_032745_762123_AC42CAB7 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , netdev@vger.kernel.org, Jon Hunter , Jose Abreu , linux-tegra@vger.kernel.org, Giuseppe Cavallaro , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding The stmmaceth clock is specified by the slave_bus and apb_pclk clocks in the device tree bindings for snps,dwc-qos-ethernet-4.10 compatible nodes of this IP. The subdrivers for these bindings will be requesting the stmmac clock correctly at a later point, so there is no need to request it here and cause an error message to be printed to the kernel log. Signed-off-by: Thierry Reding --- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 333b09564b88..7ad2bb90ceb1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -521,13 +521,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) } /* clock setup */ - plat->stmmac_clk = devm_clk_get(&pdev->dev, - STMMAC_RESOURCE_NAME); - if (IS_ERR(plat->stmmac_clk)) { - dev_warn(&pdev->dev, "Cannot get CSR clock\n"); - plat->stmmac_clk = NULL; + if (!of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) { + plat->stmmac_clk = devm_clk_get(&pdev->dev, + STMMAC_RESOURCE_NAME); + if (IS_ERR(plat->stmmac_clk)) { + dev_warn(&pdev->dev, "Cannot get CSR clock\n"); + plat->stmmac_clk = NULL; + } + clk_prepare_enable(plat->stmmac_clk); } - clk_prepare_enable(plat->stmmac_clk); plat->pclk = devm_clk_get(&pdev->dev, "pclk"); if (IS_ERR(plat->pclk)) {