From patchwork Tue Nov 3 21:09:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Brunner X-Patchwork-Id: 7547191 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 7E9F89F2F7 for ; Tue, 3 Nov 2015 21:13:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADC1C20788 for ; Tue, 3 Nov 2015 21:13:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C46F22074A for ; Tue, 3 Nov 2015 21:13:56 +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 1Ztiry-0008BO-V5; Tue, 03 Nov 2015 21:11:54 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ztirv-0008Ah-8i for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2015 21:11:52 +0000 Received: by wmeg8 with SMTP id g8so25711294wme.1 for ; Tue, 03 Nov 2015 13:11:29 -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:user-agent:mime-version :content-transfer-encoding:content-type; bh=TJKug703GB7hj1yxQU3XFEizifORaXL9T8Ve7ggfUSs=; b=OMGfasLQhRcKaT+/nwAvjTZ2KtXJFFKiR7pHsYDRC2aJUfHg/8akrgWhOG8YM9soo0 TYra+o6m/y8+XkuKa4+aeifsV0vQt/2OJSv9RYLMYVdX9uiTHq68i2+DnTXctfSC29nX HmV+9W4iDS5ck1XIpioE5CgQRUVIfWFVE/jkUN3grCqmkAZtbOp3DlFj7um8OhNoY7lY JBeiwdzO+z7KnAtjsiVB8aOPyNobztRFALw45NBYgcw1QSsSqUoiAnwbJMWHp6pHH0aT gc4ukYYk3m1IkY7uoxG7dPm+jUglinzWD1lF/Yipi3w1eGojkVirSCvIvn0/ZI8W5XSE PN8Q== X-Received: by 10.28.141.136 with SMTP id p130mr23119945wmd.56.1446585089447; Tue, 03 Nov 2015 13:11:29 -0800 (PST) Received: from localhost.localnet ([213.185.142.42]) by smtp.googlemail.com with ESMTPSA id c1sm29447170wjf.19.2015.11.03.13.11.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2015 13:11:28 -0800 (PST) From: Markus Brunner To: davem@davemloft.net Subject: [PATCH] drivers: net: cpsw: Add support for fixed-link PHY Date: Tue, 03 Nov 2015 22:09:51 +0100 Message-ID: <2251323.UEGYDRRlj7@localhost> User-Agent: KMail/4.14.10 (Linux/4.3.0-rc6; KDE/4.14.13; x86_64; ; ) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151103_131151_461094_C170F546 X-CRM114-Status: GOOD ( 12.36 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 Add support for a fixed-link devicetree sub-node in case the the cpsw MAC is directly connected to a non-mdio PHY/device. Signed-off-by: Markus Brunner Acked-by: Mugunthan V N --- Documentation/devicetree/bindings/net/cpsw.txt | 5 +++++ drivers/net/ethernet/ti/cpsw.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff -upNr linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt --- linux-4.3.orig/Documentation/devicetree/bindings/net/cpsw.txt 2015-11-03 17:21:40.000000000 +0100 +++ linux-4.3/Documentation/devicetree/bindings/net/cpsw.txt 2015-11-02 16:53:43.000000000 +0100 @@ -41,6 +41,11 @@ Optional properties: - mac-address : See ethernet.txt file in the same directory - phy-handle : See ethernet.txt file in the same directory +Slave sub-nodes: +- fixed-link : See fixed-link.txt file in the same directory + Either the properties phy_id and phy-mode, + or the sub-node fixed-link can be specified + Note: "ti,hwmods" field is used to fetch the base address and irq resources from TI, omap hwmod data base during device registration. Future plan is to migrate hwmod data base contents into device tree diff -upNr linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c linux-4.3/drivers/net/ethernet/ti/cpsw.c --- linux-4.3.orig/drivers/net/ethernet/ti/cpsw.c 2015-11-03 17:18:00.000000000 +0100 +++ linux-4.3/drivers/net/ethernet/ti/cpsw.c 2015-11-03 17:04:08.000000000 +0100 @@ -2037,6 +2037,19 @@ static int cpsw_probe_dt(struct cpsw_pri continue; priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); + if (of_phy_is_fixed_link(slave_node)) { + struct phy_device *pd; + + ret = of_phy_register_fixed_link(slave_node); + if (ret) + return ret; + pd = of_phy_find_device(slave_node); + if (!pd) + return -ENODEV; + snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), + PHY_ID_FMT, pd->bus->id, pd->phy_id); + goto no_phy_slave; + } parp = of_get_property(slave_node, "phy_id", &lenp); if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);