From patchwork Thu Apr 28 01:38:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David Rivshin (Allworx)" X-Patchwork-Id: 8965101 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 628ACBF29F for ; Thu, 28 Apr 2016 01:39:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B70F2027D for ; Thu, 28 Apr 2016 01:39:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64293201C7 for ; Thu, 28 Apr 2016 01:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbcD1Bix (ORCPT ); Wed, 27 Apr 2016 21:38:53 -0400 Received: from mail-qg0-f68.google.com ([209.85.192.68]:34978 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753730AbcD1Biv (ORCPT ); Wed, 27 Apr 2016 21:38:51 -0400 Received: by mail-qg0-f68.google.com with SMTP id b14so4514036qge.2; Wed, 27 Apr 2016 18:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j6Jr+5XHTejt6yQvRLWb7fVF+1NoCh0YuuV38yPMVuU=; b=kzuwjeVZjmoKhA7fpWVorezbYDUWFyL57n31r/P1tYbpqU3ykUnGZ8iNC7yosjYh/P R307gBp16POvub9SvjOv1jWKDipjzrcEyi02rL5ASVcB0wmq0E9kK/1zZlivzNIA3Wka DTotnSa1hUF7bIUCRglfE7mBJXHL2557gel9njLOH2sSoYpcTwNtFZLku2VLRapmDZAu d8VJCohox37CIRLKbh4/o3A93tdvkKknq6gI8SBLwd0Sq+W9x+IgXbZk6bd57yP6Kx8V /QYRlQ9iLegScDMhPh8cTYwj2pFHeEBslvjV9aWwZCIdSe2RaaK+TxWVTMo1aB2POMr/ tWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j6Jr+5XHTejt6yQvRLWb7fVF+1NoCh0YuuV38yPMVuU=; b=Xy5RHTIxDTSk9jE+7ZMnixpF2X5czf4dpnV3WierEFLaaTkkw2kfNlCCeLJqsUuTjH xy96dcICBnrouyf7TLD45UJtLTHnw0NkM56A5q+pO9+NKah0FIyQcmv9kFX76RPsSVqf pJR+CEYCI3eI1PG4lkZI9xYBCqz5l8LY49vjDfe1GY6rvNznCuY9Z8PXEzdUmT445cR/ 3YMIh3osjvQyljpibxHak4Opaya0kVKFrzn+owveEWMU6sf+9xFgjc4vIYkEC2Nsz/Un NLcYqjtr6vsg5XtAh1HXcrWT+oQRIHyEhiJdt+LGqbHzXoXEuFsQ12SZfOcwCiP0nLnt YFbg== X-Gm-Message-State: AOPr4FVyuGeWd88XZJ3bF5UgyBvqUQyr1sl/JT2dwGKT8NB6uzumP3uVmULkswqTkPaw3w== X-Received: by 10.140.81.51 with SMTP id e48mr11454320qgd.3.1461807529967; Wed, 27 Apr 2016 18:38:49 -0700 (PDT) Received: from drivshin-linux.crosskeys.inscitek.com ([24.213.148.66]) by smtp.gmail.com with ESMTPSA id x63sm2143411qhe.5.2016.04.27.18.38.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Apr 2016 18:38:49 -0700 (PDT) From: "David Rivshin (Allworx)" To: netdev@vger.kernel.org, linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, David Miller , Mugunthan V N , Grygorii Strashko , Andrew Goodbody , Markus Brunner , Nicolas Chauvet Subject: [PATCH net v3 3/5] drivers: net: cpsw: don't ignore phy-mode if phy-handle is used Date: Wed, 27 Apr 2016 21:38:26 -0400 Message-Id: <1461807506-4498-1-git-send-email-drivshin.allworx@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1461805808-4102-1-git-send-email-drivshin.allworx@gmail.com> References: <1461805808-4102-1-git-send-email-drivshin.allworx@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: David Rivshin The phy-mode emac property was only being processed in the phy_id or fixed-link cases. However if phy-handle was specified instead, an error message would complain about the lack of phy_id or fixed-link, and then jump past the of_get_phy_mode(). This would result in the PHY mode defaulting to MII, regardless of what the devicetree specified. Fixes: 9e42f715264f ("drivers: net: cpsw: add phy-handle parsing") Signed-off-by: David Rivshin Tested-by: Nicolas Chauvet Tested-by: Andrew Goodbody Reviewed-by: Mugunthan V N --- I would suggest this for -stable. It should apply cleanly as far back as 4.4. Changes since v2 [1]: - split from previous patch 2 - Added Tested-by from Andrew Goodbody [3] - Added Reviewed-by from Mugunthan V N [4] - rewrote commit log to focus on the functional bug fixed, rather than the bogus error message Changes since v1 [2]: - Rebased (no conflicts) - Added Tested-by from Nicolas Chauvet - Added Acked-by from Rob Herring for the binding change [1] http://patchwork.ozlabs.org/patch/613260/ [2] http://patchwork.ozlabs.org/patch/560324/ [3] https://lkml.org/lkml/2016/4/22/537 [4] https://lkml.org/lkml/2016/4/22/63 drivers/net/ethernet/ti/cpsw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 5903448..712bc6d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2039,15 +2039,19 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, /* This is no slave child node, continue */ if (strcmp(slave_node->name, "slave")) continue; slave_data->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); parp = of_get_property(slave_node, "phy_id", &lenp); - if (of_phy_is_fixed_link(slave_node)) { + if (slave_data->phy_node) { + dev_dbg(&pdev->dev, + "slave[%d] using phy-handle=\"%s\"\n", + i, slave_data->phy_node->full_name); + } else if (of_phy_is_fixed_link(slave_node)) { struct device_node *phy_node; struct phy_device *phy_dev; /* In the case of a fixed PHY, the DT node associated * to the PHY is the Ethernet MAC DT node. */ ret = of_phy_register_fixed_link(slave_node); @@ -2076,15 +2080,17 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, if (!mdio) { dev_err(&pdev->dev, "Missing mdio platform device\n"); return -EINVAL; } snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), PHY_ID_FMT, mdio->name, phyid); } else { - dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); + dev_err(&pdev->dev, + "No slave[%d] phy_id, phy-handle, or fixed-link property\n", + i); goto no_phy_slave; } slave_data->phy_if = of_get_phy_mode(slave_node); if (slave_data->phy_if < 0) { dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", i); return slave_data->phy_if;