Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1348683ybk; Thu, 21 May 2020 04:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCwgIWpUkhgFlBKQ+eCJQO2136+7O97iFesdDDv6vyhy9R61/ZTrFHOAFH5URLX9iOoVyT X-Received: by 2002:a17:907:1106:: with SMTP id qu6mr3003847ejb.321.1590062048805; Thu, 21 May 2020 04:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590062048; cv=none; d=google.com; s=arc-20160816; b=L66m2ZhdOHKZZrvRuv3/g8VWcqXcJkgkCfJ9KoWSOhRKmAwVH5OhTEKM3uuPDMbzij yV98xNYMbrI3Fjlx+1BLFvTWIeFH6T1bsV3ANA+8YDR3IzQv8IUhHlN+bDkKYD9/S+Ul KOzNqoTcEABEZV7iIyQku/raEWtI3fr2n6cw4tFCtaSGHmohOAsamyCThaxogrpYe+Sx 2TiQqKu4QSG+xIIQdfTMjVEaAyMp2SpAuXORZrGlVZanELOuj0Hr8MtLv8+V/FftuKOD rZ/Wo7uFPlBugpwf8Yx2noUpRGAB33pqj/GwiISnDFUUC8ddqPZ6t2CQwkECZKGQHv+1 lUcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=pZRZ5ai+2OEtzq7iw7AMDtLjRGWBjulfH6RpHnKhK00=; b=IU2sqr09VPelIGuFuHw9YMmxkJhxGpjTZ7tIyz9UWMzkbVjrPBmp5yieXrcCxQJCRT rnRKl41nLQQZQZAx57X15QkLIBMkKQKV1D0LZDi1u11pcW20LfOTxb9a2nOxJUKGgea5 jwkfRp5csvX0CuJThttVbOO+l7pvcBiF/bWUvc1POHVwWFvboFP5xe4/r7AOnPQy3bm4 cSDIJYw4kEwZHzbBReDFFbSQN5Hb8Ts2LHBsxO8YcVlEyMAye+/4v7TF/frbpMZ374IJ Q0RQulrRfocwSWOQeEdR0hkl0CeL0y7VjsKpQCS6ffYLpCXDda++z9tMEKChfohpMpbB 8jFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@earth.li header.s=the header.b=r3GMoD4m; 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 w23si2984129edr.260.2020.05.21.04.53.44; Thu, 21 May 2020 04:54:08 -0700 (PDT) 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; dkim=fail header.i=@earth.li header.s=the header.b=r3GMoD4m; 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 S1729180AbgEULtk (ORCPT + 99 others); Thu, 21 May 2020 07:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729002AbgEULtj (ORCPT ); Thu, 21 May 2020 07:49:39 -0400 Received: from the.earth.li (the.earth.li [IPv6:2a00:1098:86:4d:c0ff:ee:15:900d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7350DC061A0E; Thu, 21 May 2020 04:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=earth.li; s=the; h=Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pZRZ5ai+2OEtzq7iw7AMDtLjRGWBjulfH6RpHnKhK00=; b=r3GMoD4mo5KpZ3a33cPalZhIJ6 NqskAuHX1uJmSveg1HMePMVCrybMUeAV+DoH/9HWxOhqbAOBilM3CUIAnePVHdyqaBJ1O9aJGs/Va I+5dUzHGR0BzAu4AKhkQa5780w/72ufkhS9MjcioIj1oijRp8GRO2GZKxk4erk8uNzZJkHyQa3qTA m6e7pG9hQ8gS6L8bl1qz3slRcRdLJDZbjIgpNcOCRYI/rWrs1016CCORlIcHnvvQGIsQTVZPZ0R2z tuNRZxYTWiaL5964qrZNzbCfTCWWN6aoP2X09/GBo6fQcQG6lP6WXhvwSHUNKuNgKKDQ9iDc/FPKY HOW6GVSA==; Received: from noodles by the.earth.li with local (Exim 4.92) (envelope-from ) id 1jbjhe-0007rJ-UX; Thu, 21 May 2020 12:49:34 +0100 Date: Thu, 21 May 2020 12:49:34 +0100 From: Jonathan McDowell To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Sergey Sergeev , Marcel Ziswiler Subject: [PATCH] net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x Message-ID: <20200521114934.GY311@earth.li> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ipq806x_gmac_probe() function enables the PTP clock but not the appropriate interface clocks. This means that if the bootloader hasn't done so attempting to bring up the interface will fail with an error like: [ 59.028131] ipq806x-gmac-dwmac 37600000.ethernet: Failed to reset the dma [ 59.028196] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_hw_setup: DMA engine initialization failed [ 59.034056] ipq806x-gmac-dwmac 37600000.ethernet eth1: stmmac_open: Hw setup failed This patch, a slightly cleaned up version of one posted by Sergey Sergeev in: https://forum.openwrt.org/t/support-for-mikrotik-rb3011uias-rm/4064/257 correctly enables the clock; we have already configured the source just before this. Tested on a MikroTik RB3011. Signed-off-by: Jonathan McDowell --- diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 6ae13dc19510..02102c781a8c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -319,6 +319,19 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) /* Enable PTP clock */ regmap_read(gmac->nss_common, NSS_COMMON_CLK_GATE, &val); val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id); + switch (gmac->phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) | + NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id); + break; + case PHY_INTERFACE_MODE_SGMII: + val |= NSS_COMMON_CLK_GATE_GMII_RX_EN(gmac->id) | + NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id); + break; + default: + /* We don't get here; the switch above will have errored out */ + unreachable(); + } regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val); if (gmac->phy_mode == PHY_INTERFACE_MODE_SGMII) {