From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FROM_EXCESS_BASE64,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69DF7C43381 for ; Thu, 28 Feb 2019 16:32:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37032218CD for ; Thu, 28 Feb 2019 16:32:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b="BDU5phED" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731360AbfB1QcF (ORCPT ); Thu, 28 Feb 2019 11:32:05 -0500 Received: from uho.ysoft.cz ([81.19.3.130]:35776 "EHLO uho.ysoft.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730730AbfB1QcF (ORCPT ); Thu, 28 Feb 2019 11:32:05 -0500 Received: from [10.1.8.111] (unknown [10.1.8.111]) by uho.ysoft.cz (Postfix) with ESMTP id 39BB1A303D; Thu, 28 Feb 2019 17:32:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1551371523; bh=rsy8jPJQTNBDRP4dZtW01h4+pNEv4LAtEE2fVD9QfAs=; h=From:Subject:To:Cc:References:Date:In-Reply-To:From; b=BDU5phEDj/Yd76LWRC1O0+C1lkeR6XgvL9EWFSlZc4KLrvkfkSeRQQ2ICWC/yvWGq hwZKEpQhmUBKJQ68BW1QDTVj5gahchOqE9eNgf5P5Ix8+gNJrW3cs4DAOCcgNbCCAf lQ5gA/PYwfyGCQ+zYWJduYvpS5YKKgpRSAjr65zA= From: =?UTF-8?B?TWljaGFsIFZva8OhxI0=?= Subject: Re: [RFC] net: dsa: qca8k: CPU port broken with commit 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status") To: Heiner Kallweit Cc: "David S. Miller" , Florian Fainelli , netdev@vger.kernel.org, Christian Lamparter , Andrew Lunn , Vinod Koul References: <464871d9-777c-9edd-40a1-2653aea1e0e3@gmail.com> Message-ID: <6cf7a03e-dba4-1830-68a3-7232de969d38@ysoft.com> Date: Thu, 28 Feb 2019 17:32:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <464871d9-777c-9edd-40a1-2653aea1e0e3@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Added Christian to the CC list. I see you also work with the QCA833x switch. Your comments are welcome! On 20. 02. 19 19:37, Heiner Kallweit wrote: > On 20.02.2019 16:02, Michal Vokáč wrote: >> Hi, >> >> Another issue in a row with networking on imx6dl-yapp4 platform [1] >> that uses QCA8334 Ethernet switch. >> >> Very recently, with Vinod and Andrew, we solved an issue with >> RGMII_ID mode by patch[2][3]. I tested those with next-20190215 >> and it worked just fine. >> >> The patch[2] was merged into next-20190220 so I tested the latest version. >> Now the cpu port does not work again. I tracked it down to this commit >> 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in >> genphy_read_status") [4] >> >> If I revert the offending commit, cpu port works fine. I suspect the >> problem is on the qca8k driver side but I am not really sure. >> AFAICT autonegotiation is not available on the QCA833x cpu port (MAC0). >> > Patch[4] only affects a code path with AUTONEG_ENABLE == phydev->autoneg. > IMO this shouldn't be the case for the cpu port (like you state). > Seems like somewhere a phydev->autoneg = AUTONEG_DISABLE is missing. > > Not clear to me is where the difference with this patch comes from. > It would be helpful to know (w/o patch[4]): > - which values the register reads in genphy_read_status() return > - which bits are set in phydev->advertising Hello Heiner, just for the record, this is what I noted when debugging the issue and planned to send before the weekend.. next-20190228 does not work because of different issue. I will create another thread for that. next-20190222 works fine even without 0f3b1cf23f0e ("net: phy: fix reading fixed phy status")! next-20190220 does not work. It seems there is some problem with fixed-link handling and/or with how the switch indicates its autonegotiation capability. To make the CPU port work with next-20190220, I can either do: - force genphy_read_status() to go the AUTONEG_ENABLE != phydev->autoneg path, or - prevent the qca8k_adjust_link() from writing into the switch registers. More details below. 1) Linux version next-20190220, with patch[4] - genphy_config_init() reads CPU port MII_BMSR register, value: 0x12c - The bit BMSR_ANEGCAPABLE is set (!?) and so the genphy_read_status() takes the AUTONEG_ENABLE == phydev->autoneg path. - genphy_read_status() returns with phydev->advertising = 0x0 - qca8k_adjust_link() function is called. - I can bring up the cpu port but it DOES NOT work. - genphy_read_status() returns with phydev->advertising = 0x22e0 (bit 13,9,7,6,5 set) - If I remove the qca8k_write() in qca8k_adjust_link(), or remove the qca8k_adjust_link() totaly, the CPU port DOES work. 2) Linux version next-20190220, without patch[4] - genphy_config_init() reads CPU port MII_BMSR register, value: 0x12c - The bit BMSR_ANEGCAPABLE is set (!?) and so the genphy_read_status() takes the AUTONEG_ENABLE path. - genphy_read_status() returns with phydev->advertising = 0x0 - The qca8k_adjust_link() function is called. - I can bring up the cpu port and it DOES work. - genphy_read_status() returns with phydev->advertising = 0x22e0 (bit 13,9,7,6,5 set) Not sure if this will be helpful in any way as it is related to the now outdated versions next-20190220 and next-20190222. Best regards, Michal >> Any ideas what may be the root cause of the problem? >> >> Thank you, >> Michal >> >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=87489ec3a77f3e01bcf0d46e353ae7112ec8c4f0 >> [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=a968b5e9d5879f9535d6099505f9e14abcafb623 >> [3] https://lore.kernel.org/patchwork/patch/1043817/ >> [4] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5502b218e001 >>