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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A65BC43334 for ; Fri, 8 Jul 2022 15:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237856AbiGHPko (ORCPT ); Fri, 8 Jul 2022 11:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbiGHPkn (ORCPT ); Fri, 8 Jul 2022 11:40:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D453F1FCF8 for ; Fri, 8 Jul 2022 08:40:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53190B8255E for ; Fri, 8 Jul 2022 15:40:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77086C341C0; Fri, 8 Jul 2022 15:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657294839; bh=6kpdMMwsJsfME+iMyXa81KBrC41VyaHvmfjcm14ZZjY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ParmWcwfwfpAs6ehbNmmTmtsnAcqSud+P9ebceiWVf+pEuVJC/dba1ApRob5njLrb KrE/hbRRZ+w1o12IVB2gVKqCth1mmOXXiL4obCpzpwFTYsCHZyN9VeFeFCU4jMV32Y ujP4jKIWeD3qbEGYakpjHDiP/tpec7XrSdRZNvIxuPeAOMFfy7fAWKuG/tvwOu39jI 9vOohCwGFopKjpIYrYmaNouS+9v7kN0B6i8+BSVenNQ3sbxwqd9HjG2V7MVSSkTZ8t W2yHTIHxhW+XJn/GVN/OKBNIt3vI7pZ5eNgvHzRsb4GAAtb8jk5AVVhsjfFFuH5Bfn ON0CPSF/K/bWQ== Date: Fri, 8 Jul 2022 17:40:30 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: "Russell King (Oracle)" Cc: Vladimir Oltean , Andrew Lunn , Heiner Kallweit , Alexandre Belloni , Alvin __ipraga , Claudiu Manoil , "David S. Miller" , DENG Qingfang , Eric Dumazet , Florian Fainelli , George McCollister , Hauke Mehrtens , Jakub Kicinski , Kurt Kanzenbach , Landen Chao , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Matthias Brugger , netdev@vger.kernel.org, Paolo Abeni , Sean Wang , UNGLinuxDriver@microchip.com, Vivien Didelot , Woojung Huh Subject: Re: [PATCH RFC net-next 5/5] net: dsa: always use phylink for CPU and DSA ports Message-ID: <20220708174030.700a87f5@thinkpad> In-Reply-To: References: <20220706102621.hfubvn3wa6wlw735@skbuf> <20220707152727.foxrd4gvqg3zb6il@skbuf> <20220707163831.cjj54a6ys5bceb22@skbuf> <20220707193753.2j67ni3or3bfkt6k@skbuf> X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, 8 Jul 2022 16:25:03 +0100 "Russell King (Oracle)" wrote: > Hi, > > On Thu, Jul 07, 2022 at 10:37:53PM +0300, Vladimir Oltean wrote: > > +static int dsa_port_fixup_broken_dt(struct dsa_port *dp) > > As I mentioned, I doubt that Andrew considers this "broken DT" as he's > been promoting this as a standard DSA feature. > > > +{ > > + struct property_entry fixed_link_props[] = { > > + PROPERTY_ENTRY_BOOL("full-duplex"), > > + PROPERTY_ENTRY_U32("speed", 1000), /* TODO determine actual speed */ > > + {}, > > + }; > > + struct property_entry port_props[3] = {}; > > + struct fwnode_handle *fixed_link_fwnode; > > + struct fwnode_handle *new_port_fwnode; > > + struct device_node *dn = dp->dn; > > + phy_interface_t mode; > > + int err; > > + > > + if (of_parse_phandle(dn, "phy-handle", 0) || > > + of_phy_is_fixed_link(dn)) > > + /* Nothing broken, nothing to fix. > > + * TODO: As discussed with Russell, maybe phylink could provide > > + * a more comprehensive helper to determine what constitutes a > > + * valid fwnode binding than this guerilla kludge. > > + */ > > + return 0; > > I think this is sufficient. Yes, phylink accepts "phy" and "phy-device" > because it has to for compatibility with other drivers, but the binding > document for DSA quite clearly states that "phy-handle" is what DSA > accepts, so DT in the kernel will be validated against the yaml file > and enforce correctness here. > > We do need to check for "sfp" being present as well. > > > + > > + err = of_get_phy_mode(dn, &mode); > > + if (err) > > + /* TODO this may be missing too, ask the driver for the > > + * max-speed interface mode for this port > > + */ > > + mode = PHY_INTERFACE_MODE_NA; > > I think it would be easier to omit the phy-mode property in the swnode > if it isn't present in DT, because then we can handle that in > dsa_port_phylink_create() as I've done in my patch series via the > ds->ops->phylink_get_caps() method. > > > + > > + port_props[0] = PROPERTY_ENTRY_U32("reg", dp->index); > > You said in one of your other replies that this node we're constructing > is only for phylink, do we need the "reg" property? phylink doesn't care > about it. We don't. Vladimir wrote: "We don't even need the "reg" u32 property, I just added that for no reason (I wasn't completely sure what the API offers, then I didn't remove it)." Marek