From patchwork Mon Jan 26 02:37:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 5705981 Return-Path: X-Original-To: patchwork-linux-arm@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 86D2B9F333 for ; Mon, 26 Jan 2015 02:40:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA20C2015A for ; Mon, 26 Jan 2015 02:40:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02F0A20154 for ; Mon, 26 Jan 2015 02:40:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFZZb-0003Ov-6w; Mon, 26 Jan 2015 02:38:43 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFZZD-0003IY-ER for linux-arm-kernel@lists.infradead.org; Mon, 26 Jan 2015 02:38:20 +0000 Received: by mail-qa0-f49.google.com with SMTP id v8so5147058qal.8 for ; Sun, 25 Jan 2015 18:37:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bB/iQGEiGrOCla2rQZCQ1Fs593Ct8tu1o5XjuG0YGrk=; b=QdsUGC157pOJ8NzrkKhJuyXExm2+or7HHcIXe/bBWRL27YrqTQTViApm9PzVcxHYQT T5MAL7/Q27/1RwoLbvymaNprPZDpaYeTBvilds9pUzM8RlEfVc+JisP6a+KNvTm9sh5L lntDTTCuQXrccD24ZOXhFvd2nd5E3SbrUm7f5MSdFRZWdczwCxwtaHmDe2eIBISBwm0f MNYRQjuBDG/nSmY2PODAJGvFkYJPjWgMkE98slxAnLcpKpmAYDygtyEwmJHTo4kquXG+ n+Mc8Ujf+qkFC6sBGhgMwi5paLRNj3nl5Jf6NKyNmrXYGNoP6DdHqJURVjZb9W65GdC0 l8Og== X-Received: by 10.140.95.114 with SMTP id h105mr14904647qge.64.1422239877622; Sun, 25 Jan 2015 18:37:57 -0800 (PST) Received: from localhost ([162.213.34.56]) by mx.google.com with ESMTPSA id m2sm8756005qar.16.2015.01.25.18.37.55 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 25 Jan 2015 18:37:56 -0800 (PST) From: Ming Lei To: linux-arm-kernel@lists.infradead.org, "David S. Miller" Subject: [PATCH v1 2/2] net: stmmac: add fixed_phy support via fixed-link DT binding Date: Mon, 26 Jan 2015 10:37:38 +0800 Message-Id: <1422239858-3452-3-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1422239858-3452-1-git-send-email-ming.lei@canonical.com> References: <1422239858-3452-1-git-send-email-ming.lei@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150125_183819_591040_BEE8088F X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -0.5 (/) Cc: Florian Fainelli , Byungho An , netdev@vger.kernel.org, Ming Lei , linux-samsung-soc@vger.kernel.org, Kukjin Kim X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Signed-off-by: Ming Lei --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8c6b7c16..ddb4351 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -847,8 +847,11 @@ static int stmmac_init_phy(struct net_device *dev) * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent * device as well. * Note: phydev->phy_id is the result of reading the UID PHY registers. + * But phy_id returned from fixed phy is always zero, so bypass the + * check for fixed phy. */ - if (phydev->phy_id == 0) { + if (phydev->phy_id == 0 && (!priv->plat->phy_bus_name || + strcmp(priv->plat->phy_bus_name,"fixed"))) { phy_disconnect(phydev); return -ENODEV; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3039de2..73a3ced 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "stmmac.h" #include "stmmac_platform.h" @@ -216,6 +217,15 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, plat->pmt = 1; } + if (of_phy_is_fixed_link(np)) { + int ret = of_phy_register_fixed_link(np); + if (ret) { + dev_err(&pdev->dev, "failed to register fixed PHY\n"); + return ret; + } + plat->phy_bus_name = "fixed"; + } + if (of_device_is_compatible(np, "snps,dwmac-3.610") || of_device_is_compatible(np, "snps,dwmac-3.710")) { plat->enh_desc = 1;