From patchwork Tue Dec 15 10:44:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 7853291 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D7C509F349 for ; Tue, 15 Dec 2015 10:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F22C920222 for ; Tue, 15 Dec 2015 10:44:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6AC2201F5 for ; Tue, 15 Dec 2015 10:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964902AbbLOKoh (ORCPT ); Tue, 15 Dec 2015 05:44:37 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33922 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964895AbbLOKog (ORCPT ); Tue, 15 Dec 2015 05:44:36 -0500 Received: by mail-pa0-f49.google.com with SMTP id wq6so2931355pac.1; Tue, 15 Dec 2015 02:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=B4UcDgOqL9rHRZ6NlfZRqGj0q7dJHIgu3+8lUBH8PB0=; b=tmDNpMrLB1huFIhsmXgsx4xLfDpSfB2TsEFpKK65ObTvSJLd+HHv+8iXXWBJb+jkUh 6TmvXoBY7MuNQvQkfF1COaT6vlu19CgDYAZ8A2p0gnVtt8tZszO9ykCphCm0+u5jBaYg ivH6t22PeYjAOXNKgz6x2pjAAmgwQXLcpBYbWzM3tjaPqVV92O+rV7FqWfmg1kCGt2f4 AEk6iauW17NG3C0uM0km9ShoEHOaN50Ow0vWk0yii8LGHtjWxXfH8eunSAr6tyXtREH7 kPorZwl1uCfUIp1WqLCzDtmPct8+9gfJ8zWmxVrpgED6dSlCHbSb9P8CLqCab4I28anf Q/LA== X-Received: by 10.66.159.226 with SMTP id xf2mr53213315pab.23.1450176276092; Tue, 15 Dec 2015 02:44:36 -0800 (PST) Received: from macc.flets-east.jp (p3469131-ipngn19901marunouchi.tokyo.ocn.ne.jp. [153.229.6.131]) by smtp.gmail.com with ESMTPSA id ah10sm1450076pad.23.2015.12.15.02.44.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Dec 2015 02:44:35 -0800 (PST) From: Yoshihiro Kaneko To: netdev@vger.kernel.org Cc: "David S. Miller" , Sergei Shtylyov , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org Subject: [PATCH v2 net-next] ravb: Add fixed-link support Date: Tue, 15 Dec 2015 19:44:13 +0900 Message-Id: <1450176253-24131-1-git-send-email-ykaneko0929@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kazuya Mizuguchi This patch adds support of the fixed PHY. This patch is based on commit 87009814cdbb ("ucc_geth: use the new fixed PHY helpers"). Signed-off-by: Kazuya Mizuguchi Signed-off-by: Yoshihiro Kaneko --- This patch is based on the master branch of David Miller's next networking tree. v2 [Yoshihiro Kaneko] * compile tested only * As suggested by Sergei Shtylyov - use of_node_get() to increment refcount. drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 120cc25..3448eb0 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -882,6 +882,7 @@ static int ravb_phy_init(struct net_device *ndev) struct ravb_private *priv = netdev_priv(ndev); struct phy_device *phydev; struct device_node *pn; + int err; priv->link = 0; priv->speed = 0; @@ -889,6 +890,17 @@ static int ravb_phy_init(struct net_device *ndev) /* Try connecting to PHY */ pn = of_parse_phandle(np, "phy-handle", 0); + if (!pn) { + /* In the case of a fixed PHY, the DT node associated + * to the PHY is the Ethernet MAC DT node. + */ + if (of_phy_is_fixed_link(np)) { + err = of_phy_register_fixed_link(np); + if (err) + return err; + } + pn = of_node_get(np); + } phydev = of_phy_connect(ndev, pn, ravb_adjust_link, 0, priv->phy_interface); if (!phydev) {