Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2302228rwd; Fri, 2 Jun 2023 07:39:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5K40ne12L6hdzshGrn+uCGqboctmWXHJ97IhXIYp4B2Q/vPsQ7c5p9TDC7R6gN7xLHw5ma X-Received: by 2002:a05:6a00:cc5:b0:64f:40bc:74f3 with SMTP id b5-20020a056a000cc500b0064f40bc74f3mr11481347pfv.13.1685716788932; Fri, 02 Jun 2023 07:39:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685716788; cv=pass; d=google.com; s=arc-20160816; b=VxftEUaiC/OWKSh5ymT+7quSJb1yp9TNpe1sdkSbigQoD9qsFA/IBjG1vMY4rx5Hq4 KAw2y4IJzMIXgO9Zlt5177NuGUGGKHey4OKb2UvIQ25L6PRI1kKZgwlOak02Ha+KPOQz cRbrsp7YqEvCy+kcbB6nd9N6GZX4RR5WT2Pf9uo23FxU5YBXo9RCxwJj3bsr0ZKP4hMc k4Ner24Ma/JmA+b1wo27tn743UkZb5gS4fkDamYgRchX55i3WyFgwSqxVVodaVPCeX7R WjImN0lQbkGcw5LIKrDfAwVOkpgEyQK3VIkK8+Sh/r3wckDcmQQQolxqUQ/s884H1kwA Payg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=W2204HHKfHkbHh2LIxaj6+oxlCJzFcyhroNYvoz0d3g=; b=06pW5zOrY6DgB/lATCoDBIyPlkn2PU7+ajYjxm2hDrzI6zlNMuUHZSX8OSv4KA75wA +ewRq4MUwjb7+dhosvcbpV43F7+EM+pA+qmPjJ/yZPZHCuYH5MQdw/g8f1b+brXyh+z2 i8d0Xrw0c4bM8TH3lR9ZD28dHNCOANN3aYPgoTUqMyoWQSZ0Q+kgKXh2u9nA4Y85xhKz +VRPCD48olXGcZ56eKwOsQ2MGr+LxP+tWvDFyvnMKW9YokwsO8VMBQMFPe9ZgSnfXAdg Sfjs4aT6gjMQCnq8IUI5N9VkpsrIvx0myL2KvIZfTA2pa33K9LNat/I8HRwd+FOAokDz M1/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=G11uN2b3; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g19-20020aa796b3000000b00642ea71f6d9si797470pfk.336.2023.06.02.07.39.35; Fri, 02 Jun 2023 07:39:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=G11uN2b3; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235750AbjFBObs (ORCPT + 99 others); Fri, 2 Jun 2023 10:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235248AbjFBObr (ORCPT ); Fri, 2 Jun 2023 10:31:47 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2055.outbound.protection.outlook.com [40.107.20.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D4419B; Fri, 2 Jun 2023 07:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JCEFnWZ/uDYQbfvzhlYbD4MZSo8xdJVNXFDSayy/3Ecf3BwUCbkfdpNDgL3qDTN6w/j/cT60Xg2s/3oGFVO1ai+StDLtYOSz6XYPlfgOIe7XBp7syLZulmTd7AMVO8K/kVmZKPCb+5jrHlGaFiYdMo7aMjp5XG3kHZKfYCmysogqtn0WPbpssC6sMAfFU73Znyq4sXiraNcq39ZPbLKlfLTM0AE9LRBBHk6PQLeaMIsFTVycjWqCi5F9hSN0zwgoTSvrlB9GjRxudP/V0UYNxONyN+wnpYtLBE/upLUO+mf6aAhGLZjbwAgGOS4XtX2Sa+opR+Ic7FlGYi1sa5cDQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W2204HHKfHkbHh2LIxaj6+oxlCJzFcyhroNYvoz0d3g=; b=lrjtrZq+TF7gtTnJLAXCfiCsUNL8OgmeCudcnoBWcuMaFE0LwJHW0gXU/1TAY14zxtKCdtuQvaibcRf1oO61mSJnVEr56vsVel+R7pDr1mmt+RTP0xSd4bANZnEZUE6shms/f4d3Bplcl1gDhEL4iKMcAKtZJtpNh3Vn7RCMIJtX+7jsoZeorHCNmvOdDgmk09RRooknFh5vHfxH5G78l9NfhDM2ewwoYPgCZCEwem4X/nzzQprvoMn94q2FkzSIddE5K4iET03zQGbsSsps/uDbsFri9YOPCpbS2sHcIC9LWTkMMufB7TN86zRwTzJ0L/FuJwCCyl267HgaNH+v6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W2204HHKfHkbHh2LIxaj6+oxlCJzFcyhroNYvoz0d3g=; b=G11uN2b3XxE8NB+ZaMe0d5Exk4+jcVJkzZY/Vn72HLgrACNXupwAF/bp/DLJl7YQoRmiwJPgKEc5TM8nhwlyqEDJTnCs2VU9l7nEGzM/6YngThQa1peiHTm4gzZg4WIJ4M/+aJSjeE3ueQCCjtZ54nQqhoo05MdleP9zwZgAaYc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9070.eurprd04.prod.outlook.com (2603:10a6:150:21::14) by DBBPR04MB7804.eurprd04.prod.outlook.com (2603:10a6:10:1e0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Fri, 2 Jun 2023 14:31:43 +0000 Received: from GV1PR04MB9070.eurprd04.prod.outlook.com ([fe80::bba5:4ebb:2614:a91]) by GV1PR04MB9070.eurprd04.prod.outlook.com ([fe80::bba5:4ebb:2614:a91%7]) with mapi id 15.20.6433.025; Fri, 2 Jun 2023 14:31:42 +0000 Date: Fri, 2 Jun 2023 17:31:38 +0300 From: Ioana Ciornei To: "Russell King (Oracle)" Cc: msmulski2@gmail.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, simon.horman@corigine.com, kabel@kernel.org, Michal Smulski Subject: Re: [PATCH net-next v6 1/1] net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x Message-ID: <20230602143138.aaq22cmwinrrhtrv@LXL00007.wbi.nxp.com> References: <20230602001705.2747-1-msmulski2@gmail.com> <20230602001705.2747-2-msmulski2@gmail.com> <20230602112804.32ffi7mpk5xfzvq4@LXL00007.wbi.nxp.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To GV1PR04MB9070.eurprd04.prod.outlook.com (2603:10a6:150:21::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9070:EE_|DBBPR04MB7804:EE_ X-MS-Office365-Filtering-Correlation-Id: bba3ed3d-2305-4495-dc77-08db637615bc X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uW30QIKBV/cT/FvR0BcolKERcsIYFFu/uORJt8cWXzbujVGAVjN5OGTDZLx9Vp0KJ0PBxBQ0mnISiGgmdvA1pUYoKkAMoUIpV8wHDmOFZJq7AW/LH6YRrOAVt8fmxqVIdXgRj6pup3UoP5e3QhhFhIew6P5lIuSE1BFKdBirSoHIQuh4TJlq6FPWi44TxTnnKifTaOChVOJAeqfouIHIboc7ccR6o8P4IyiMsnz5A1Mji4xzhEYFpTfwt18iUZfbPKbViNw+QH6+c2L7ZDMEOeS+vX8ZlFsnOWf/+/Sn+T3ypUhdSg2/blqA6gOZp48ILg491wH97YnBroTSeRgQRTZnGNwPV+qoODnIQNHwElWTeO9ny4nbwGMsAuTmTnFaidGZWFrq6D0x+A8ZDXgZfoFBs9yP1u6DiYQ0D13n8Fp9CCTXQrWNQ4kQfC4BB058eAcTh7IaxGEdO8vseKkMm/NAfr2PLBvZjfM/heb2CSwBohyldVQMZdHylO4KKFRFtKzCgUBlyqNZMfJIMtYiNk54bQCZrLlq4oBcCIgvik3AvUiMYMivtCx4/E98MUS9adJGfJd7/UJDceuMqUTotPYBnEA4bZQEoTllkvugsicYKuEgFU+c2gUclSTB+q+F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9070.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(366004)(376002)(136003)(396003)(451199021)(38100700002)(86362001)(8676002)(7416002)(5660300002)(6506007)(6512007)(44832011)(1076003)(26005)(41300700001)(66556008)(2906002)(186003)(83380400001)(316002)(19627235002)(66946007)(6666004)(8936002)(66476007)(478600001)(6486002)(6916009)(4326008)(138113003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hKoagwSrrCzN2aychWKUjkRtcZiVaPdddJApHVu9tphv9Ib1O+f2A/3qM4M7?= =?us-ascii?Q?mx2dbQ0Foh9HrizeVEOPRMsumstbPNko6jPYRt+I1gMZrV5UzN1tzJcf6bO6?= =?us-ascii?Q?dCksUYbTzbozS0FvLEkx5DYb2yps/yNj+iBtoj4BmMtpBrDNUWuvisiLJoZd?= =?us-ascii?Q?Ptk0UYg+Zl86kNXf29WOORD2MNUMvMPzeEDI9ONDBgFeD2i09A0XMWoX7dRl?= =?us-ascii?Q?nLBYVqSIozhsGVMqkFOsfX2Jc8JIijP4f6qu2B50g/Nu0iuCR121KJnDA4M6?= =?us-ascii?Q?1Kn53Yr/aWJC0qktMrsAYkAggUqSlp5u/4nK0xZ589QWqpXx0PGi9w1FO5aH?= =?us-ascii?Q?lr7nH8/OS3YX6/Rbeg2PMXSjq+Wnu3keVZqeFroaIaChaiuPhX5hQrhO9Fsr?= =?us-ascii?Q?/3TBb6uWnoa7ZJflA6c1vtUoiR/76jCWzASavck6EpomVKq9VllWDD/9iu5D?= =?us-ascii?Q?Uf0XmcR+/69/B/ThNuxD4rJ0L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?Q?qFCz4ZqspTKRVWdv3wHhTaCThuVsYpdViHbVPU5T5LHt9nC7g6w+OBBwDYXc?= =?us-ascii?Q?wK/0I+wcR7uSNZpn9l7OGPAWlJws2hH33QTRLVgFrmhXGfg9VQpapvLbqkFA?= =?us-ascii?Q?hg0MfS3oEDdXZSS+D7oaEleDpL5w1wRg09cUFFmqrZqg+8Bd10ia6pJUinkp?= =?us-ascii?Q?3BBeKKxTQvFFbJPi+dgOBgN62Pkr1D+rXYmb7Sh9?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bba3ed3d-2305-4495-dc77-08db637615bc X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9070.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 14:31:42.7942 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ujYJmOLPd4qE87oUxtS5DYNdFURipr3omZpjfq8H7M9PsNyj1gqt3l3zk6yQQjFDr21cWQ8Udd1K88vVZKhT1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7804 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 02, 2023 at 02:11:14PM +0100, Russell King (Oracle) wrote: > On Fri, Jun 02, 2023 at 02:28:04PM +0300, Ioana Ciornei wrote: > > On Fri, Jun 02, 2023 at 11:30:36AM +0100, Russell King (Oracle) wrote: > > > On Thu, Jun 01, 2023 at 05:17:04PM -0700, msmulski2@gmail.com wrote: > > > > +/* USXGMII registers for Marvell switch 88e639x are undocumented and this function is based > > > > + * on some educated guesses. It appears that there are no status bits related to > > > > + * autonegotiation complete or flow control. > > > > + */ > > > > +static int mv88e639x_serdes_pcs_get_state_usxgmii(struct mv88e6xxx_chip *chip, > > > > + int port, int lane, > > > > + struct phylink_link_state *state) > > > > +{ > > > > + u16 status, lp_status; > > > > + int err; > > > > + > > > > + err = mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS, > > > > + MV88E6390_USXGMII_PHY_STATUS, &status); > > > > + if (err) { > > > > + dev_err(chip->dev, "can't read Serdes USXGMII PHY status: %d\n", err); > > > > + return err; > > > > + } > > > > + dev_dbg(chip->dev, "USXGMII PHY status: 0x%x\n", status); > > > > + > > > > + state->link = !!(status & MDIO_USXGMII_LINK); > > > > + > > > > + if (state->link) { > > > > + err = mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS, > > > > + MV88E6390_USXGMII_LP_STATUS, &lp_status); > > > > > > What's the difference between these two registers? Specifically, what > > > I'm asking is why the USXGMII partner status seems to be split between > > > two separate registers. > > > > > > Note that I think phylink_decode_usxgmii_word() is probably missing a > > > check for MDIO_USXGMII_LINK, based on how Cisco SGMII works (and > > > USXGMII is pretty similar.) > > > > > > MDIO_USXGMII_LINK indicates whether the attached PHY has link on the > > > media side or not. It's entirely possible for the USXGMII link to be > > > up (thus allowing us to receive the "LPA" from the PHY) but for the > > > PHY to be reporting to us that it has no media side link. > > > > > > So, I think phylink_decode_usxgmii_word() at least needs at the > > > beginning this added: > > > > > > if (!(lpa & MDIO_USXGMII_LINK)) { > > > state->link = false; > > > return; > > > } > > > > > > The only user of this has been the Lynx PCS, so I'll add Ioana to this > > > email as well to see whether there's any objection from Lynx PCS users > > > to adding it. > > > > > > > I just tested this snippet on a LX2160ARDB that has USXGMII on two of > > its lanes which go to Aquantia AQR113C PHYs. > > > > The lpa read is 0x5601 and, with the patch, the interface does not link > > up. I am not sure what is happening, if it's this PHY in particular that > > does not properly set MDIO_USXGMII_LINK. > > Thanks for testing. I wonder if the USXGMII control word that the PHY > transmits can be read from one of its registers? > I had a look into the AQR gen4 datasheet and the only thing that I could find is the "PCS USX0 Auto-Neg Control Register" which has the following field: USX0 Auto-Negotiation Message code [7:0] Configure the message opcode for USXGMII Auto-Negotiation. It sounded promising but it's not making any sense to me because it's just 8 bits long. > If the PHY is correctly setting the link bit, but it's not appearing > in the Lynx PCS registers as set, that would be weird, and suggest the > PCS is handling that itself. Does the Lynx link status bit change > according to the media link status, while the AN complete bit stays > set? > No, the Lynx link status bit is 1 even though the media side is no longer connected, for example. Here I just removed the cable, the link on the PHY is down but the PCS link is up. [ 133.011696] fsl_dpaa2_eth dpni.2 endpmac3: Link is Down [ 133.555343] phylink_decode_usxgmii_word 3331: lpa 0x5601 [ 133.560672] mdio_bus 0x0000000008c0f000:00: mode=usxgmii/10Gbps/Full link=1 an_complete=1 [ 134.579348] phylink_decode_usxgmii_word 3331: lpa 0x5601 Ioana