Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp351983pxb; Fri, 15 Oct 2021 06:51:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGhrtqgPXe350yiLU9SfAT+DbB5yRaMjCbjdW50HRI2ezOV5ig/1NnIJXHiJ2TqM2oHCcN X-Received: by 2002:a17:902:c20c:b0:13a:3f4a:db58 with SMTP id 12-20020a170902c20c00b0013a3f4adb58mr11043222pll.12.1634305871025; Fri, 15 Oct 2021 06:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634305871; cv=none; d=google.com; s=arc-20160816; b=Wk4ZHfbLtzMsUASVdgsIH6GnFqSk/iG9RQspRPRzpZjj7kccpIWwL1GSENrv5DmuZB j18Aozv9+nPGV2UhwztDjlpxJbIPaDv7IDMDyur2q5kmEb6yU5J74KZ6ZjNpsHIANwFk ohG7tbeShr7BY0+sm3w2nmrQtmHS1nDJaXtPDrzljn2lJfHhMyxCm657dWhXSgAqFL4q 3Fa9kBPCLfkQ0g/6j/QeIY96Y/XhIKNIxpN2gQXkoWFG7W1jbJAxJR1lXzptweiOdxX6 jvRwGtunjLWQem9MPmJpmdJxA1cQ26RMy4eN7Upi+Y29fMtYpwr7HVt0Ffxw03OTboEv 2Xfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=3/j+ma54TNPjq/1Aa+/IG2HfyVCPcEEdbnBw2lXIB0k=; b=RSeX7/+sVKXWmothod0Uc5QE4p79vpg/Klely0aEj3WhWFfh2FrhQQX1179I7o7lx/ g3/3tDPNWbXNrCq8LIUrVuOUNuJ88XHVFlW3fIO8jMcmJ4K0qBWpt8MX602TxkyGvU+9 c/v3X/g+CAQBczjUbvNGqMqvEGxB1Y44aDsSVoUuETL77c/Tx4vjj+HS1hZZgWx/M4Kf N3YreektoV2UQirsdb3W5++G9/ECaMBO3eDCKO026mve5DI9pb/UjdXn1xAJPcIsLdYp mYpQKX0tMFH2gD2ypkAJZcAK1mkqQAFi3VZDdYVe5mcoMCk2Lf2xyPlvmVMwmxw0Mbw1 McDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ROLvFbSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w129si6746828pfw.182.2021.10.15.06.50.57; Fri, 15 Oct 2021 06:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ROLvFbSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236410AbhJOHjO (ORCPT + 99 others); Fri, 15 Oct 2021 03:39:14 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:54080 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236211AbhJOHiM (ORCPT ); Fri, 15 Oct 2021 03:38:12 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634283366; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=3/j+ma54TNPjq/1Aa+/IG2HfyVCPcEEdbnBw2lXIB0k=; b=ROLvFbSyl3MrFJK7bWe+Rhl8ufW/UGke3Xkhpm3TNx++GB548ynL0jRs46DvCLIrPC/WMrg4 3EnDqg7wZO6btz0KnziZISknU680jDqF4W+FtX35RjVj1DU3uB4vY3c2htZXhrg1rH3556Dp 5WshKN/ygVcIRdViet0VNaweuvs= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 61692f4cf3e5b80f1f7c8a59 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 15 Oct 2021 07:35:40 GMT Sender: luoj=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B55B5C4361A; Fri, 15 Oct 2021 07:35:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from akronite-sh-dev02.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luoj) by smtp.codeaurora.org (Postfix) with ESMTPSA id EC63BC43618; Fri, 15 Oct 2021 07:35:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org EC63BC43618 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Luo Jie To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sricharan@codeaurora.org, Luo Jie Subject: [PATCH v2 08/13] net: phy: add qca8081 config_aneg Date: Fri, 15 Oct 2021 15:35:00 +0800 Message-Id: <20211015073505.1893-9-luoj@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211015073505.1893-1-luoj@codeaurora.org> References: <20211015073505.1893-1-luoj@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reuse at803x phy driver config_aneg excepting adding 2500M auto-negotiation. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 7aec37593983..b12cad633b98 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1084,7 +1084,30 @@ static int at803x_config_aneg(struct phy_device *phydev) return ret; } - return genphy_config_aneg(phydev); + /* Do not restart auto-negotiation by setting ret to 0 defautly, + * when calling __genphy_config_aneg later. + */ + ret = 0; + + if (phydev->drv->phy_id == QCA8081_PHY_ID) { + int phy_ctrl = 0; + + /* The reg MII_BMCR also needs to be configured for force mode, the + * genphy_config_aneg is also needed. + */ + if (phydev->autoneg == AUTONEG_DISABLE) + genphy_c45_pma_setup_forced(phydev); + + if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->advertising)) + phy_ctrl = MDIO_AN_10GBT_CTRL_ADV2_5G; + + ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_10GBT_CTRL, + MDIO_AN_10GBT_CTRL_ADV2_5G, phy_ctrl); + if (ret < 0) + return ret; + } + + return __genphy_config_aneg(phydev, ret); } static int at803x_get_downshift(struct phy_device *phydev, u8 *d) @@ -1503,6 +1526,7 @@ static struct phy_driver at803x_driver[] = { .set_wol = at803x_set_wol, .get_wol = at803x_get_wol, .get_features = at803x_get_features, + .config_aneg = at803x_config_aneg, .suspend = genphy_suspend, .resume = genphy_resume, .read_status = qca808x_read_status, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project