Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2572396pxb; Sat, 23 Oct 2021 02:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlnAfXiSwhMhOOvrD2gOYt+60Dytyg+/07Nm+qCxJ1ThqkBnUc3KqJ41xcWk7wyvbqKvfS X-Received: by 2002:a17:902:d50d:b0:13e:a44e:2d2a with SMTP id b13-20020a170902d50d00b0013ea44e2d2amr4774779plg.89.1634983097960; Sat, 23 Oct 2021 02:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634983097; cv=none; d=google.com; s=arc-20160816; b=mTxIaojsLXYR90yDcAh/7h5VF79w31u8AZBrM6GSG1ake+wkdAtAIUhnpnbA9DTwF2 Enlno5pCmu407Tzr7mL76c9+aR7MgXBRn28ulocpP4k5R0M4x/nADz6AFmqRiT1tFfO6 f8mLJpnZU/+f5Q4yKmCm2+ACwtJX+Q3Arw6zuVscxFZ6D0GzUqRX3dQGCVAM7Ud0yWiw u/Lrl0SSNwZD03E3M607lxZnEeFjNf2XS07a9OEWRboBVe5BwzUMWN9UHpjBgCwVcmjG iNgYDWstznkZ1iXa8KHxf1TdAUaOuzEIsX/OX3fiIezZybTvcKF1BBLNY5EH/rLWxE46 Tipg== 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=oQ0sRSdLv2VcfgCL93KmUdPAyc2Kb4vci3cCal0utVQ=; b=SKMnsD/2IEsuB/SnqVpqJeDsOBa8D3ZNYqX456XP1VD3PEK7HI19sxHGmXsjxZUBMU 18bwmOCa2M4H1MmWYsRQeFxAYv/0y0aKSu1OHNokP0cVhPE8S1NF5NClmRzdK/PEdNi5 WwYcjKKCaaZN81hAvHrujNNMVyiIRHunt3kbdC8SDBTWI8tGUkLfWVAo9u0hPNxbmoQM iJX0eWw53DLbjS8IrEbCzG2dTBYBE9mkYf2ghYf6eD1YN7He8X4nRTGsAU057T0zsNJg 5aE5Tt1XEOiFG+Fi3+gOSZ8vCICkCoXbF5Xfrkk01I97OrBxt+m3mjbnHgqN6hzg1kQt EbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=dBToXR2s; 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 c5si17855845pgw.592.2021.10.23.02.58.03; Sat, 23 Oct 2021 02:58:17 -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=dBToXR2s; 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 S232176AbhJWJ66 (ORCPT + 99 others); Sat, 23 Oct 2021 05:58:58 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:31853 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbhJWJ6I (ORCPT ); Sat, 23 Oct 2021 05:58:08 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634982949; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=oQ0sRSdLv2VcfgCL93KmUdPAyc2Kb4vci3cCal0utVQ=; b=dBToXR2sIclBDISCrRyuHuqNISQN63LLMx+OK1j+wVoYh9ohHaAhovnU6NKTG1JwRdFa30wO qKanSBtW+FC4luzGqlEhcMhqdqSnx5AGjZBPFNsMV5x9V9gKPztHSOClfn6xULoPO7JJneza NRucUXzL848JzHFQGEhRxi6bHVY= X-Mailgun-Sending-Ip: 198.61.254.9 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-n01.prod.us-east-1.postgun.com with SMTP id 6173dc2559612e01009f488f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 23 Oct 2021 09:55:49 GMT Sender: luoj=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2709AC41621; Sat, 23 Oct 2021 09:55:47 +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 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 239E2C1488E; Sat, 23 Oct 2021 09:55:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 239E2C1488E 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 v6 13/14] net: phy: adjust qca8081 master/slave seed value if link down Date: Sat, 23 Oct 2021 17:54:52 +0800 Message-Id: <20211023095453.22615-14-luoj@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211023095453.22615-1-luoj@codeaurora.org> References: <20211023095453.22615-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 1418db4f2091..00733badcda5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1655,6 +1655,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, + * except 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