Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2000826imc; Fri, 22 Feb 2019 15:38:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IYkn7BKxtk292fTi5VC4t7oKoN7UkAEz/qrWb0zvyhl4NcjwNu/AGMR+HBdCpgjWuGpiO0C X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr6736295plp.201.1550878724057; Fri, 22 Feb 2019 15:38:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550878724; cv=none; d=google.com; s=arc-20160816; b=XoMhkd72CiXG5W1JPi0+t1mq66+PAFfapB3su+FwjRuHp9JAWfxuBH9vlWa2vDCqP/ nCCrZSTWcOHAGY7nP2AIAmzLgVNSQtfqRFH/gcvhmfkR0psCfGNnIFzIc3kMi+qg+3ti kB7YySP3nBAt9sBDBanCbwnEOc1C70KAxVpM0l2tBQE+d6Q2xYFJJvy72+Z7U3DISQEs bh9z5WdKvsFMLriNf4zP2QiEjTkl2QcK1xIQuAWBmncX3bSSUuNeQCLrvOw/TJOAL6cI EZVJLgwTOxDQ9xzgJ5qdWbCc0x2fBnantTsQu0ee6ypZMvMtaSlpwlWfiC7pTWse+V3W dSbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QyGmTBMs8r2vUcdU5A+G/F1p+M7cmR9YHqpl8+SmZpg=; b=dumWeIjFePTAOID+T2h36UiONJOYJ6EIi16x4Q9S9oF2ZgFrvfL2PRZktLBGbRNwjp dwUjTIqDITx0IeSj8RZalEsVrbBIOwBsWGxBslLDZkOboQDu/kWqd0Vlw3jCc0/BQDec 5KBf0yzxkvJBE1VDDKTi5JTa5FQKM4Ubnamu3CX5gyiTKVrWMrqkgmC57FQy38zzZzZm IeQ9xlu9o98DcL3SR5QYUkKCdRfGRmtwIOklhTFjE2q5Wiqt6sdEahpgZnEkBP0twYUi SELGdf9AUr673bFcZxW51F1WkQ6q7nbO/Qa4LqjvA4Dg+qAXetvi/ZuGT0486ExQoA2X /aIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si2429912pfi.288.2019.02.22.15.38.28; Fri, 22 Feb 2019 15:38:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727560AbfBVXh7 (ORCPT + 99 others); Fri, 22 Feb 2019 18:37:59 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:59431 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbfBVXh6 (ORCPT ); Fri, 22 Feb 2019 18:37:58 -0500 X-Originating-IP: 86.201.231.99 Received: from mc-bl-xps13.lan (lfbn-tou-1-149-99.w86-201.abo.wanadoo.fr [86.201.231.99]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 1F5606000D; Fri, 22 Feb 2019 23:37:52 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com Subject: [PATCH net-next v2 1/7] net: phy: marvell10g: Use get_features to get the PHY abilities Date: Sat, 23 Feb 2019 00:37:38 +0100 Message-Id: <20190222233744.25735-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190222233744.25735-1-maxime.chevallier@bootlin.com> References: <20190222233744.25735-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Alaska family of 10G PHYs has more abilities than the ones listed in PHY_10GBIT_FULL_FEATURES, the exact list depending on the model. Make use of the newly introduced .get_features call to build this list, using genphy_c45_pma_read_abilities to build the list of supported linkmodes, and adding autoneg ability based on what's reported by the AN MMD. .config_init is still used to validate the interface_mode. Signed-off-by: Maxime Chevallier --- V2: Added missing blank line drivers/net/phy/marvell10g.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 586ae1bc5a50..89920b10d75b 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -233,8 +233,6 @@ static int mv3310_resume(struct phy_device *phydev) static int mv3310_config_init(struct phy_device *phydev) { - int ret, val; - /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && phydev->interface != PHY_INTERFACE_MODE_XAUI && @@ -242,6 +240,13 @@ static int mv3310_config_init(struct phy_device *phydev) phydev->interface != PHY_INTERFACE_MODE_10GKR) return -ENODEV; + return 0; +} + +static int mv3310_get_features(struct phy_device *phydev) +{ + int ret, val; + if (phydev->c45_ids.devices_in_package & MDIO_DEVS_AN) { val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); if (val < 0) @@ -416,7 +421,7 @@ static struct phy_driver mv3310_drivers[] = { .phy_id = 0x002b09aa, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", - .features = PHY_10GBIT_FEATURES, + .get_features = mv3310_get_features, .soft_reset = gen10g_no_soft_reset, .config_init = mv3310_config_init, .probe = mv3310_probe, -- 2.19.2