Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp347551pxb; Fri, 15 Oct 2021 06:45:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm07A0qa3/xPGOfU7b+3vBKIIBjpbZm/2TrHeNvrR7OGUYKOER/exExpxfFWOoiwVgAdD8 X-Received: by 2002:a17:906:8a98:: with SMTP id mu24mr6868043ejc.438.1634305523784; Fri, 15 Oct 2021 06:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634305523; cv=none; d=google.com; s=arc-20160816; b=l0U8g2FugMeVBYzziN5NA+uX4BgTXps03JVwKymbIHH6rAw6oEIquFFKXfXkeZAJdU gulqQ2W5o7OdWBRNdR5ZfNlW/bK+ptDDr3TqJvTf6reD2OYwJ+c9dTFO7FNnxQmZ028w LeYtKvg5swJ/s72NUvV0eDv7PR3mSkL62QkKY2B2B1ITsA1yoYn/l29mf7WnLKoqTVCo vPjlcz0Q2MH17LQYCoV1KpJLxGiPZiy5ZuGU+hRifp6aBFW2/en112X9gduoveoac0Tn 94B5nRJx6VNNGZNLbJ3MSJfT9/79Wb1TI2S3nudDpGj8Zx1xV+jor1lzxxU/Tt7GiZgg Y14Q== 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=p0N/R4qBm5nWNfCWJWLkAY+u2pxF7YQMM0X3pG5xugM=; b=ELSzzmG++o/xYbnl6EvRVbXY4cmxOAPsoe9wt4HdE4aZ+cu+8bZBmQvkKxFg9McFl5 psryj7Y9yarK86fF7NMArw+bp2MxxoM+Ba3Va/CmYzQWtRNMOmaV25QYUsFUNhp7BKRv ayYXkVefSjDIjf/Og/aVJHozT8XZh6wRFGf9auVGD11HEwg5odSz+6LkHKQHtQTSSYYf gfbdSeHMHDCW+SLIQ1Jm7Joi7MFJqaQWMSupfNU62F9zZ/tQdifatzrnbDWt95r3uuJu a5+KThqSKhvFjswS5JxvtwyHwEGuXZObtmWjvWxSUtFCMfxpdpsudbq/T+FlJ6Mxv/TK o1VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=rbSn9BBv; 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 la20si9591898ejc.685.2021.10.15.06.44.59; Fri, 15 Oct 2021 06:45:23 -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=rbSn9BBv; 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 S233434AbhJOHib (ORCPT + 99 others); Fri, 15 Oct 2021 03:38:31 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:17363 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbhJOHiC (ORCPT ); Fri, 15 Oct 2021 03:38:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634283356; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=p0N/R4qBm5nWNfCWJWLkAY+u2pxF7YQMM0X3pG5xugM=; b=rbSn9BBvZecExTJXacvu5yLzAbEU4nqDXRmn0VA+llw9KjhXJSqwns9gQwP6VMvdwDJCJV5Y IfFiCE669iXbEQnL+FPA+G4fTX3BHihScdRFnGJ2SawZHRU9bMV/tUA+DhZ/voAM/lU/BdSo otmvHDSsrDk0MNU2IYrwopBn38M= 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-n03.prod.us-west-2.postgun.com with SMTP id 61692f56f3e5b80f1f7ca696 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 15 Oct 2021 07:35:50 GMT Sender: luoj=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 95313C4361C; Fri, 15 Oct 2021 07:35:50 +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 A1F50C43618; Fri, 15 Oct 2021 07:35:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org A1F50C43618 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 12/13] net: phy: adjust qca8081 master/slave seed value if link down Date: Fri, 15 Oct 2021 15:35:04 +0800 Message-Id: <20211015073505.1893-13-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 1. The master/slave seed needs to be updated when the link can't be created. 2. The case where two qca8081 PHYs are connected each other and master/slave seed is generated as the same value also needs to be considered, so adding this code change into read_status instead of link_change_notify. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 4d283c0c828c..6c5dc4eed752 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1556,6 +1556,22 @@ static int qca808x_read_status(struct phy_device *phydev) else phydev->interface = PHY_INTERFACE_MODE_SMII; + /* generate seed as a lower random value to make PHY linked as SLAVE easily, + * excpet for master/slave configuration fault detected. + * the reason for not putting this code into the function link_change_notify is + * the corner case where the link partner is also the qca8081 PHY and the seed + * value is configured as the same value, the link can't be up and no link change + * occurs. + */ + if (!phydev->link) { + if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { + qca808x_phy_ms_seed_enable(phydev, false); + } else { + qca808x_phy_ms_random_seed_set(phydev); + qca808x_phy_ms_seed_enable(phydev, true); + } + } + return 0; } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project