Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1216606pxu; Sat, 5 Dec 2020 07:52:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+JRMFpqMV2pe9OFOWkuejotWnQGtkDVJTh0NENBFLsZscvpJfXr3yEJ3t+QZFqOM0I0pU X-Received: by 2002:a50:eb97:: with SMTP id y23mr12533742edr.29.1607183560862; Sat, 05 Dec 2020 07:52:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607183560; cv=none; d=google.com; s=arc-20160816; b=Wv1SvzQfXKdN9EnapV28oLMXJ9xfkS1IFbaa6Fx6opHp3wLxXMrmt0Gct+AhIcpoo+ tR4hqicBYDuMK+m5r2tGneCXF4JndEa/GvgU9He04dAqI4jlxhgXvbeyrP/2u67ldtG9 WTRwltbT5v9N+Q/Z28U3Ahdpk68Eq941Fs/PSAvYd33tm1qKmcg8+boBgjJKZVsRqMmr rNUL4dAXbiJRHmYuvb/b49vdwAMdYyCLuFIzrq3rM9ZMt/4cqszTDEpljUtaqapqZDPF gZy/w/u1A0uNpIor1HSupOrb+Ijcbq3z7TNwv9OlDotyTnJavunroGPsX0XOs1MDriKm NIAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u48AAhcHUf2aSWhmDQt2AnHDGpeiRUbnTvdQldiXb8Q=; b=FZD42KmQJI5Xqj3cmpc94NqpWGweKkab05XmR6fzEnvUGd23tRixu7BkS1D8higwek vDDTcVLrXwbLas5ZsWmfB5MBz0mp/Lo2NDAWri/qNvyqbHpAipa+WGAliUOGnjuB1S8r NLLiapUPQr8pr4b/IRZ02h+HBT/NjEgPIX8MQFzN654px0ZY6V2QvjhtvkGEOliM+wqm WAs1Y0uMaOOp9MqqqA8cBj1TC85BxBZYwLudm0G/DNJ1cplwzjhW4wbg6smLv1Org/xl OJYJrBnNyyYrVeE1Zr5eQ2XgFwtWZssZmZfCO1d4pmGSHWpZ0xWc6UQ6ALdgAq+c+s8z uFiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=REpuVoaS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce8si3357077ejb.147.2020.12.05.07.52.01; Sat, 05 Dec 2020 07:52:40 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=REpuVoaS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbgLEPjT (ORCPT + 99 others); Sat, 5 Dec 2020 10:39:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbgLEO6X (ORCPT ); Sat, 5 Dec 2020 09:58:23 -0500 Received: from mail-vk1-xa41.google.com (mail-vk1-xa41.google.com [IPv6:2607:f8b0:4864:20::a41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B9D4C02B8F1; Sat, 5 Dec 2020 06:35:23 -0800 (PST) Received: by mail-vk1-xa41.google.com with SMTP id u16so2001423vkb.1; Sat, 05 Dec 2020 06:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u48AAhcHUf2aSWhmDQt2AnHDGpeiRUbnTvdQldiXb8Q=; b=REpuVoaSR0wsKXnhLga++HW1mnG57H2gf0fduOk4jEFCreTDtg3yrRKZvist+TQCLG z1Xl9laRk3I4NqHSZ5khOcmFiLSmUQTqUs6fbMd56nptISbDu80+Y1/WBGIYxh5hD4Xk qEkEGmvVMD1exL2k4X7bieLpSeYAcGeb+a0O+YCQYI5HQ+C7/+sYdHAgzAAN6YSg6udC jd78PBZOWs/z0442MriSUxjIrYbZgZolP7sMji8v9rB/M+iwbzsJh7STRFmr094iu245 aFoGe9tiAyCzxUWpszGlDSOCNphISqLMoh2hTgiX5kYOHhDVCcGL9PxuU8yKgZi60NU6 D0Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u48AAhcHUf2aSWhmDQt2AnHDGpeiRUbnTvdQldiXb8Q=; b=DLFtBGIQXJIQxiZGKMGAKrAodl000Eqxuo4evUiA8AY6STRsKkhy2AiyozBkKlyR1o wcIBiNSwrlt6YtUHN//QVrMpitKfSM+hyz2qJq/fP+w6C6LmZtYfo6O3fcgF9OruzutW KTerch6B1tX2LxC7Pz9bRm3b6bUCXUh+1QlPmY0L7nZ9Z+BZW7tfwZPHPnsRw32K6rDW BJq0ary8NpoosMZ7jWDEnKN6dpy7PFS4YHN5O5AEwoAphEHj5vxYrxRsojdmgjCpkVO3 UEDidkR9C313nTKsHsgnniFtd/1HmiW6F2tMdeh0TXwf/77DfwZZjZ612aNlEjosCnqJ p7pg== X-Gm-Message-State: AOAM5304oJPlJZG0ARiqNjUjM1hkTihq4io/W8nar47D5xc73kjvHkfq Hs5OkTx5McIdfxNQTStlxSXduH+uEVyHggQa7IIUdy4YRLzyXg== X-Received: by 2002:a1f:e7c2:: with SMTP id e185mr8413560vkh.23.1607178921860; Sat, 05 Dec 2020 06:35:21 -0800 (PST) MIME-Version: 1.0 References: <20201203214645.31217-1-TheSven73@gmail.com> <20201204152456.247769b1@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> <20201204234321.GJ2400258@lunn.ch> In-Reply-To: <20201204234321.GJ2400258@lunn.ch> From: Sven Van Asbroeck Date: Sat, 5 Dec 2020 09:35:10 -0500 Message-ID: Subject: Re: [PATCH net v1] net: dsa: ksz8795: use correct number of physical ports To: Andrew Lunn Cc: Jakub Kicinski , Woojung Huh , Vivien Didelot , Florian Fainelli , Vladimir Oltean , David S Miller , Marek Vasut , Tristram Ha , Microchip Linux Driver Support , netdev , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jakub, Andrew, On Fri, Dec 4, 2020 at 6:24 PM Jakub Kicinski wrote: > > All the port counts here are -1 compared to datasheets, so I'm assuming > the are not supposed to include the host facing port or something? > > Can you describe the exact problem you're trying to solve? > The ksz8795 driver refuses to accept my devicetree (see below). It doesn't like the presence of the cpu node. But I really need a cpu node, because phy-mode is crucially important to my application: without phy-mode = "rgmii-id", the ksz8795's ingress bit does not get set, and communication fails. I was already suspicious of my fix: why would such an important chip property be wrong? But changing it was very seductive: after all, the ksz8795's headline is "Integrated 5-Port 10/100-Managed Ethernet Switch", and the driver code says this: .port_cnt = 4, /* total physical port count */ I can see now that this should be fixed more generally. The of parsing code is using the wrong port count variable. I'll submit that shortly. That said, when I look at this driver, I get very confused between port_cnt, num_ports, and whether they include or exclude the cpu port. Until this gets cleaned up, maybe the comment above can be improved, so developers don't get too confused at least? I'll submit a patch for that too. ethernet-switch@0 { compatible = "microchip,ksz8795"; spi-max-frequency = <1000000>; reg = <0>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@3 { reg = <3>; label = "lan4"; }; port@4 { /* driver errors out because * reg >= dev->port_cnt (4) */ reg = <4>; label = "cpu"; ethernet = <&something>; phy-mode = "rgmii-id"; fixed-link { speed = <1000>; full-duplex; }; }; }; };