Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1943081pxu; Sun, 13 Dec 2020 08:19:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGr4N4RWkyLur+z4d2fi0mpCmYSj9ZZc8ujkYhkElfxt7NrmWh1ek766Cc9xfOfg91XGuP X-Received: by 2002:a05:6402:1d3b:: with SMTP id dh27mr21646883edb.238.1607876348089; Sun, 13 Dec 2020 08:19:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607876348; cv=none; d=google.com; s=arc-20160816; b=vQFFuxWTfmrMv7lwQ5NN6EP5qBqtPUC68n6Azeg2g+KSajjwmRO5CealNE7EQQ0jMs DsoXHRCYLZpEJh5MhjDfOu6oTZaZDNk5ZtcVj2Dlcwj887RfhiYiJAXX/xDvCiO5URn8 wrDwGHdICZyctcIUcpoq+HjBW8BvGSdUtfQeWRz+xu4nUI7eEEtsGSlw8gqoDuv/iEnx X/c/NyC66VzIX0pjPCItxkvwVx5PkMbW4OgP1jO0fJTa32SzQgj8WKqoqeV0AM1Sj6cB 9ocA1e8H5reLpVseVmwvmbNFegqiBaNSeY6yOVzwTT8qK7HiYsW4rDoogBuQVSVdpd3Z O/Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Jxm7FjWLOK0LeZ5TONPRUQR10b19NPzc0gXLsmUtSk8=; b=k2el5f45WD8ZJVUYvOmSTf2U0ZSKiv6s+KK8FkDjEOL0tjMN2i624nMC8Ezbpr21c/ aJ+VYDIg7UghNm0Om3G8Y68T8Gor+C5o0+U0Fyzqn0fy9jhJWNruHu1lEEg50anJdzMz pE6mPUJSReqliPxG64LYCkfh+6Ob+FQgUqdlUt7ktG58uUmpGrojeBxYZRhH8w8svwEw WqGdurjJkkKxUK6rKnaeqeOmaKILi5Xek2hNsiJvKzOoH2CN6MxVJOLTK0WoTIlx0l7o e6Z+Zyq2xpsvRwlcU+EAPrCeH7T1VzTlQksQdX/5LuWBTGS/UrooxEBsdvPCGy41L/oB kcLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=L7SXmM5a; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si8751944edr.236.2020.12.13.08.18.45; Sun, 13 Dec 2020 08:19:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=L7SXmM5a; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439590AbgLLQ6R (ORCPT + 99 others); Sat, 12 Dec 2020 11:58:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406671AbgLLQ5u (ORCPT ); Sat, 12 Dec 2020 11:57:50 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1BCC0613CF; Sat, 12 Dec 2020 08:57:10 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id k8so11825395ilr.4; Sat, 12 Dec 2020 08:57:10 -0800 (PST) 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=Jxm7FjWLOK0LeZ5TONPRUQR10b19NPzc0gXLsmUtSk8=; b=L7SXmM5aaaq0mgJ+7/5AxBNsryueM9Onmbq14mL+cpuuNK6Fa4QlEwqesRlTLT6yAJ EHKJxfyOQlOFd27qg1+iZavvGPBnc8HkgIGVygzZKR3HLa8blBwnFEam7dXdPMtHVlN7 5GaIAuW1W1njao8C5AMNNW0IisvO3oZtE7xZnRhUZzS0j0qwF57ZYPRQEBXYqcAvKXdL y3ZyuuCTCQ+hhiyVwcgWBSjbJEfQZoIod+ffxsXRgDtHSvIbBxQwT6bne26WGbgiIK4N dYY8dSHCLDfvXtaFfBuzSbzMeAao9sZqkiafR3FTqVZxjh91ufk2meZWopScwERPQFas f4XQ== 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=Jxm7FjWLOK0LeZ5TONPRUQR10b19NPzc0gXLsmUtSk8=; b=iOsIkCz25W7BA0w4WunfIgRfZ4IE2/+vNTkPSY00eo6ZaGqH855Gap8PeaxsUdDXqk P0vCpOrlTBhfMHjUIlG8SztXPRN2gi7GEagzoVDeoNist4ld5PrUcOyQ1bDT6ebgqG2l n5K/nqz4VNJV/r2CIxQHIyLj5HGG2Rp1tdqbx8ybcboBLV2onYuls6uhhy1emBCAOkRz CU9IASy8qQ25dPx/rplsVV6+p+OjUXSGxS8OzHpKFhbqx2bznI3Nq5DHkV28afUjvjmS /rk4qxdvOvJ/3v4tDZy7Z5ICLGdB4Q2TZ5zjwMPQP+ZnJYIOuZ5VJntJDeZZfpcHe1rQ P//Q== X-Gm-Message-State: AOAM533prmRAkKl/DB474ODx0JjnPp1QPWtDD20QX7yrk/xmtxCN6PwE MY08Ez7O652ii/xy+bv0fY7oT6qFVW7IOw== X-Received: by 2002:a92:495b:: with SMTP id w88mr22754631ila.196.1607792229218; Sat, 12 Dec 2020 08:57:09 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:f45d:df49:9a4c:4914]) by smtp.gmail.com with ESMTPSA id p18sm7733201ile.27.2020.12.12.08.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 08:57:08 -0800 (PST) From: Adam Ford To: linux-renesas-soc@vger.kernel.org Cc: aford@beaconembedded.com, charles.stevens@logicpd.com, Adam Ford , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC] ravb: Add support for optional txc_refclk Date: Sat, 12 Dec 2020 10:56:48 -0600 Message-Id: <20201212165648.166220-1-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SoC expects the txv_refclk is provided, but if it is provided by a programmable clock, there needs to be a way to get and enable this clock to operate. It needs to be optional since it's only necessary for those with programmable clocks. Signed-off-by: Adam Ford diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 7453b17a37a2..ddf3bc5164d2 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -994,6 +994,7 @@ struct ravb_private { struct platform_device *pdev; void __iomem *addr; struct clk *clk; + struct clk *ref_clk; struct mdiobb_ctrl mdiobb; u32 num_rx_ring[NUM_RX_QUEUE]; u32 num_tx_ring[NUM_TX_QUEUE]; diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index bd30505fbc57..4c3f95923ef2 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2148,6 +2148,18 @@ static int ravb_probe(struct platform_device *pdev) goto out_release; } + priv->ref_clk = devm_clk_get(&pdev->dev, "txc_refclk"); + if (IS_ERR(priv->ref_clk)) { + if (PTR_ERR(priv->ref_clk) == -EPROBE_DEFER) { + /* for Probe defer return error */ + error = PTR_ERR(priv->ref_clk); + goto out_release; + } + /* Ignore other errors since it's optional */ + } else { + (void)clk_prepare_enable(priv->ref_clk); + } + ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); ndev->min_mtu = ETH_MIN_MTU; -- 2.25.1