Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp262290pxb; Fri, 15 Jan 2021 12:22:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXi48IH3ViPid/naZJ14MhavLd69auFT/XFadEAyQZVMHlXINX2Fs1z0WZkeuWETNd9WSy X-Received: by 2002:a17:906:7f11:: with SMTP id d17mr10088588ejr.534.1610742177922; Fri, 15 Jan 2021 12:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610742177; cv=none; d=google.com; s=arc-20160816; b=QUT/if7qMF0JUe2lDphrFTMj/+onsX/KE69/GX6UP4Hk+hMtN6WgDidig0F+6cFKCf FTbZ+BycWJKzXQyasPWkLNszykwe7KwdtORyPEg13hOuDKiKB1rIO3h7Uyeg9owJcwhk YltITnUvRkxwHWm+1Qf6NqeMKi64ePIWlidf+aUjpKiW9o8qP8o96Hq5yWD91EKZc//F z+X6b+PDlEmJlRAzsdVEFyapJqJagShrgVV07PK6yyOFZ5BT9G8OdOkcbp+Fcx7GNAFO IAYRVkwLFsxwCfI4SuyAoN6VxuonsL+r/4tpVkoNOwBvSnHNp2Hq+1JsjrlBS02aPZNs xVtw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3XzHspCX9O1x943fOc9JVbEHt7+srRIHgKjIIe0gcTw=; b=YWPgahwuSY6CdG9oLlUKqqxINp6Q5J7xRZ5GH/QRX5RF8Bfpi+SkmCeN46tBWrrGC+ xEY++FXYaag30d0Q07d5I0X35jBRCT5Mel5eAdFh6NXK1XtiIwZMS3QiK2E+jGQcVSay OQvk9n8q5GASycRcqoOLfoFCDnUqFd0CAIEcN0S3XhiT6vZ6O7blQ+/3IpVmTuZlJmYX tqaIRrus4u359DCbPWHBuy/soyZ7GDWLLfBhaZHuIE4KFtxRQ/klwnG5fxdDHj6X6H1v ydEZt4jf+xzvgQFvqqBJP069E0tepcvWERrg5EoFTNZf310GcedhXdZlFr8+99u0nYUi i7RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NgWS5kVa; 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 a15si2718544eju.226.2021.01.15.12.22.33; Fri, 15 Jan 2021 12:22:57 -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=NgWS5kVa; 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 S2388608AbhAOUUz (ORCPT + 99 others); Fri, 15 Jan 2021 15:20:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388588AbhAOUUw (ORCPT ); Fri, 15 Jan 2021 15:20:52 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A8AEC0613D3; Fri, 15 Jan 2021 12:20:12 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id d81so5430378iof.3; Fri, 15 Jan 2021 12:20:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3XzHspCX9O1x943fOc9JVbEHt7+srRIHgKjIIe0gcTw=; b=NgWS5kVabAPxdHhBiKkubPCMxZN3NZ2xmbF8XalcBWU3OrQ3/tV+zpDt/IDcz+5IkC U3+38yv5icRvZyOmDELIfUuDz2bazw0ZDq+9azXPkIlqimmDJ+H7dLk1zGUcuZbzXw7J 7/95a4q72b7v/RTX2DePIsNQIaentHQ63Vey+hFENcrAIMRia9po4SjMbhemuvPSPOJv CxemdbgEYCzsYDesOub6heMvvjV3px1PPvTCbyYATyauWYmJqjOCdu8YRwROtwKtrJNL 8k41j0IB2qf8fy1A9fyrs/RWrWql4NwyH5z++D5WY0hFQ+cR2fydYUxMVl/rU09uZOB7 p/kg== 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=3XzHspCX9O1x943fOc9JVbEHt7+srRIHgKjIIe0gcTw=; b=Kid3kpYDTx3X69+CKIo+YJrDwH3JzquXxCYhgzVrwsMzsFf4ZJpRXM3mRoU794YyQN oEXxFLZMIdVICVLzd2ICYXXV5GcU4Yu9/oQKgHbVOFWcdQB4YPaIr8bI5rV9Sy6dD4U0 h9uOe4lYRwgi23BxWRjrh1G99S5KzZ/BCJoE9k6VESVuBD2uWZbEHNoZIdV+mDOhcXbM 8gnhs+PKT/Q9RR641ksu3Qw4DZbjEtpI1+Rf30VonbKIx9NZd7jbFdHdzU4vWczbqjWr A5tbWju8c25W2jMyN180fMlxRKRmLTov7zax4pObaNhzCL2hKW3MPHJBhvrOAnAzN3G5 dLHw== X-Gm-Message-State: AOAM530JvDvNi+QkjMK9eqKAT+onVGDnOdUHPjrtEvimdtK3JNrpTeAm dEaWCJ5WW3eGODsxz12HVBOWEwvLAk3LuPC7 X-Received: by 2002:a6b:6f09:: with SMTP id k9mr9923958ioc.30.1610742011324; Fri, 15 Jan 2021 12:20:11 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:475c:c79e:a431:bccb]) by smtp.gmail.com with ESMTPSA id e28sm4194900iov.38.2021.01.15.12.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 12:20:10 -0800 (PST) From: Adam Ford To: linux-renesas-soc@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , Rob Herring , Geert Uytterhoeven , Magnus Damm , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/4] net: ethernet: ravb: Enable optional refclk Date: Fri, 15 Jan 2021 14:19:51 -0600 Message-Id: <20210115201953.443710-4-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210115201953.443710-1-aford173@gmail.com> References: <20210115201953.443710-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For devices that use a programmable clock for the avb reference clock, the driver may need to enable them. Add code to find the optional clock and enable it when available. Signed-off-by: Adam Ford --- drivers/net/ethernet/renesas/ravb.h | 1 + drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ 2 files changed, 9 insertions(+) V2: The previous patch to fetch the fclk was dropped. In its place is code to enable the refclk diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 7453b17a37a2..ff363797bd2b 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 *refclk; 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..739e30f45daa 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2148,6 +2148,14 @@ static int ravb_probe(struct platform_device *pdev) goto out_release; } + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); + if (IS_ERR(priv->refclk)) { + error = PTR_ERR(priv->refclk); + goto out_release; + } else { + (void)clk_prepare_enable(priv->refclk); + } + ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); ndev->min_mtu = ETH_MIN_MTU; -- 2.25.1