Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2217066pxb; Sat, 14 Nov 2020 18:31:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQM6xIvAhHccER9om3Zq+zg7/TVn8uKfPK6oDsZnzHetvpwoz0Wu26zy6LGsqnnDZ6uoof X-Received: by 2002:a17:906:1317:: with SMTP id w23mr8580360ejb.120.1605407475089; Sat, 14 Nov 2020 18:31:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605407475; cv=none; d=google.com; s=arc-20160816; b=0qQYCEkH83RQxchsbvu1x0fCHQTiho3SAb1nVXm3f4p9r1j3yAXeC6E2ZrrKGNvt9y uwzSNcAdnuvpkthcgM4UrX4JcCA9uepBm39JJMP9mJxIoxhaBfsG6A5fsFxMl8wYKy1v ewNs8Vd0DQC1ui/9Fe3PGy10TBFt17wb/O48ZGIUa1eBRsvW9Ij2PKuHFxWF8btvIt4T YeMJ1PIT/Wcc+OcadsHrofQwgZznjCdgXoKi5FS+6fc+EgWD9Xubun++AqfTS8bnRp39 e4IYFtqlC8hgrgbdNFt4l8Bgafaiwy0arQKbf9ZpYLpUMArqplNqmoBgazUOdt5EDR6Z L1Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=smHSXDCB80mRtkoZkTc7mnl7ZJ5JgX6Fa4JzH0MLp7Y=; b=ifIctEMULqjDzXM0QUo8NnhNl1qOja7jUwvyMbPCrVmGEJ/hE5LOazeYgJi2OuFzA7 sfKUTPc7pdTEgMMAccgiFA3uoXbGl7NnBvCJpvTRWklym6L+a3c2P9KxhqD+UVDieJZP 8ZkifhffUEPbvcPi2otqDHYeXW7jFcbfWCdgR+UAM0fNb3+6vMUBucvE6EbbPVUeAZ4O yBD4KuWd5mNbZxJKNo6rmENTjQUex/2X0vxJcHRsj3VB58GQYLqMP3u3J9qJor7hf7jR UIosyZIS69rVyS+ECoIjzfjZF+tkIZQNCnWdtnqeTiZk2pJgsXyUwZzn+lcqjKuyzSTw WNvw== ARC-Authentication-Results: i=1; mx.google.com; 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 bl4si10266585ejb.642.2020.11.14.18.30.39; Sat, 14 Nov 2020 18:31:15 -0800 (PST) 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; 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 S1726537AbgKOC0E (ORCPT + 99 others); Sat, 14 Nov 2020 21:26:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:53324 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbgKOC0E (ORCPT ); Sat, 14 Nov 2020 21:26:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F3D10AC2D; Sun, 15 Nov 2020 02:26:02 +0000 (UTC) Subject: Re: [PATCH net-next] net: mvneta: Fix validation of 2.5G HSGMII without comphy To: Russell King - ARM Linux admin Cc: "David S . Miller" , Thomas Petazzoni , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Michal Hrusecki , Sascha Hauer , =?UTF-8?Q?Marek_Beh=c3=ban?= , Andrew Lunn , Jason Cooper , Gregory CLEMENT , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring References: <20201115004151.12899-1-afaerber@suse.de> <20201115010241.GF1551@shell.armlinux.org.uk> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Organization: SUSE Software Solutions Germany GmbH Message-ID: <4bf5376c-a7d1-17bf-1034-b793113b101e@suse.de> Date: Sun, 15 Nov 2020 03:26:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201115010241.GF1551@shell.armlinux.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russell, On 15.11.20 02:02, Russell King - ARM Linux admin wrote: > On Sun, Nov 15, 2020 at 01:41:51AM +0100, Andreas Färber wrote: >> Commit 1a642ca7f38992b086101fe204a1ae3c90ed8016 (net: ethernet: mvneta: >> Add 2500BaseX support for SoCs without comphy) added support for 2500BaseX. >> >> In case a comphy is not provided, mvneta_validate()'s check >> state->interface == PHY_INTERFACE_MODE_2500BASEX >> could never be true (it would've returned with empty bitmask before), >> so that 2500baseT_Full and 2500baseX_Full do net get added to the mask. > > This makes me nervous. It was intentional that if there is no comphy > configured in DT for SoCs such as Armada 388, then there is no support > to switch between 1G and 2.5G speed. Unfortunately, the configuration > of the comphy is up to the board to do, not the SoC .dtsi, so we can't > rely on there being a comphy on Armada 388 systems. Please note that the if clause at the beginning of the validate function does not check for comphy at all. So even with comphy, if there is a code path that attempts to validate state 2500BASEX, it is broken, too. Do you consider the modification of both ifs (validate and power_up) as correct? Should they be split off from my main _NA change you discuss? > So, one of the side effects of this patch is it incorrectly opens up > the possibility of allowing 2.5G support on Armada 388 without a comphy > configured. > > We really need a better way to solve this; just relying on the lack of > comphy and poking at a register that has no effect on Armada 388 to > select 2.5G speed while allowing 1G and 2.5G to be arbitarily chosen > doesn't sound like a good idea to me. [snip] May I add that the comphy needs better documentation? Marek and I independently came up with <&comphy5 2> in the end, but the DT binding doesn't explain what the index is supposed to be and how I might figure it out. It cost me days of reading U-Boot and kernel sources and playing around with values until I had the working one. Might be helpful to have a symbolic dt-bindings #define for this 2. U-Boot v2020.10 on Turris Omnia dumps this table: | Lane # | Speed | Type | -------------------------------- | 0 | 6 | SATA0 | | 1 | 5 | USB3 HOST0 | | 2 | 5 | PCIe1 | | 3 | 5 | USB3 HOST1 | | 4 | 5 | PCIe2 | | 5 | 0 | SGMII2 | -------------------------------- But IIUC the Linux comphy driver doesn't take any type ID as argument but rather an index into a table of "ports" which specifies another index to apply or look up? Terribly indirect and magic to non-experts. As a DT contributor I would need the binding to tell me that it's an enum with 2 meaning SGMII2. Not even the max of 2 is documented. The Linux driver talks of ports, but I don't see that term used in U-Boot, and U-Boot APIs appeared to pass very different args in the board code. The binding also still needs to be converted to YAML before we can extend it with any better explanations. (And before you suggest it: Since I obviously don't fully understand that hardware, I'm the wrong person to attempt documenting it. The 38x comphy seems not mentioned in MAINTAINERS, only the 3700 one.) Regards, Andreas -- SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer HRB 36809 (AG Nürnberg)