From patchwork Fri Jan 23 02:41:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 5690481 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 D09E49F2ED for ; Fri, 23 Jan 2015 02:44:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F8542024D for ; Fri, 23 Jan 2015 02:44:37 +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 3B1C82024C for ; Fri, 23 Jan 2015 02:44:36 +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 1YEUCk-0006EY-7h; Fri, 23 Jan 2015 02:42:38 +0000 Received: from mail-yk0-f180.google.com ([209.85.160.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEUCP-00066I-Ea for linux-arm-kernel@lists.infradead.org; Fri, 23 Jan 2015 02:42:18 +0000 Received: by mail-yk0-f180.google.com with SMTP id 131so2233316ykp.11 for ; Thu, 22 Jan 2015 18:41:55 -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=UCerxtBFvNCvwQX3nIzdZVZlQxjiFgm2RMG2vCT78Zw=; b=Dx6NKKE71986Yi9a+alMtGcj6ydlfuHIz15qjssGKnC+ii/EwFJWak+zL4at60fMBs pSOb7gxyLNpOr9OCMJDXRif6+V5BH0zBOD9T3zXZ9nbZP1bCazWgYOtuIx7uw7uyIx2V llEMjDdXNnYeUnFKeLI9kCjXr8yFc1W5XmptBao2qBqb5e3yd0tLIGDKYt9b/aL9a/7Y toArwjKhr39edfXp+D7e/Xl6g8UyimNY/GNMM8Spw0FZG3LIq6r7kcVV4RAb2fYPVuaI U7L30BDdBpR7mKOfC+fu72LkTHslcoiQny8za3VQKShXWYWEKHvMLokQ77BH7aHtf7p5 H+FA== X-Received: by 10.236.231.197 with SMTP id l65mr2028469yhq.33.1421980915772; Thu, 22 Jan 2015 18:41:55 -0800 (PST) Received: from localhost ([162.213.34.56]) by mx.google.com with ESMTPSA id i50sm179473yhg.41.2015.01.22.18.41.54 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 22 Jan 2015 18:41:55 -0800 (PST) From: Ming Lei To: linux-arm-kernel@lists.infradead.org, "David S. Miller" Subject: [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file Date: Fri, 23 Jan 2015 10:41:33 +0800 Message-Id: <1421980893-14475-3-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1421980893-14475-1-git-send-email-ming.lei@canonical.com> References: <1421980893-14475-1-git-send-email-ming.lei@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150122_184217_608021_6C2497AB X-CRM114-Status: GOOD ( 12.47 ) X-Spam-Score: -0.7 (/) Cc: netdev@vger.kernel.org, Ming Lei , linux-samsung-soc@vger.kernel.org, Byungho An , 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 From: Byungho An This patch adds codes for DT file support, fixed_phy and phy_addr can be set in DT file. Signed-off-by: Byungho An (bypass check for fixed phy) Signed-off-by: Ming Lei --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 2 files changed, 11 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 879e29f..4f11491 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -128,6 +128,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, struct device_node *np = pdev->dev.of_node; struct stmmac_dma_cfg *dma_cfg; const struct of_device_id *device; + u32 phy_addr; if (!np) return -ENODEV; @@ -217,6 +218,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, plat->pmt = 1; } + if (of_find_property(np, "fixed_phy", NULL)) { + plat->phy_bus_name = "fixed"; + of_property_read_u32(np, "phy_addr", &phy_addr); + plat->phy_addr = phy_addr; + } + if (of_device_is_compatible(np, "snps,dwmac-3.610") || of_device_is_compatible(np, "snps,dwmac-3.710")) { plat->enh_desc = 1;