Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp2422760lfu; Fri, 25 Mar 2022 00:34:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3eu6/Y8ndxgxH+6mlCwgYr5yY6RWyFQq1HTto+VRXaIriysfry8W7QDOyUobjKANlwR5i X-Received: by 2002:a63:f4e:0:b0:382:1e31:79e8 with SMTP id 14-20020a630f4e000000b003821e3179e8mr7068815pgp.167.1648193694375; Fri, 25 Mar 2022 00:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648193694; cv=none; d=google.com; s=arc-20160816; b=WsIY85hWP7xv2DhL7TA3+4hs9PzeWheajDoK0ByOh4lDTwEmtl/OyRQq9WJnfiiT49 CEZ5/+5N9C8/pHdiBgKwi+Sb5T5IbZQmjMqwdxUbaSMrshvhkGaSJKaEnoM9x1cp5GtB qJvQ+51r5BnhzJWSo/jyJ94du1TpDCKDWHoShDIWzJK6z6Accy9Az5y5UUeICQ07dvVX Zz23ADpVT3SO9NqFAtGOaNHT3WnD9bwugkOKgzhYkfOBX4yp0/aOxVu54afXaJC7eeaJ goHTXDGOvA58iS62S1lz3GjzyELVwmAPS3CLxXDyiTR9PZPZD9142aFFLxUHMXsqvcnm 58Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=mrbZnCx5ImFtI+d/9SJ/+v1bhmyj3qBx9rMgcrWC17Q=; b=xnAC4WgjE4t9aiCerk4CLQ4335TCqPBFOOD4cKp8570Ihz9BdmJ1wH12/R2zExH8K5 rppssRucS+XIwEuEfqz19JQtCyCNi2SOcJGdp+a7SZg0v+jsJoS61tP/+6IHPl1UQj0U V8EzUlpgjzwaJbCrngI/cZ8yKmZx64saiAGczb15N2eseGqoL+tCSJ3novtVGQJ0qi0b xMWm6hEXR+RIx7B9gmvTsWObgTPAaqPpkWrWmdZawEBBpVjZtChrFIhXwRT93JbDu0Us C1YVfcZ5czikdWhceNdtUg/kGyiSuJnAnDjMy5KB0Vl5PLe9kaEX/deF44VvIRNBHgqE 6kwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=Rs87I7ub; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a170903110c00b00153b2d1651asi1756585plh.290.2022.03.25.00.34.35; Fri, 25 Mar 2022 00:34:54 -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=@walle.cc header.s=mail2016061301 header.b=Rs87I7ub; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239492AbiCWXDN (ORCPT + 99 others); Wed, 23 Mar 2022 19:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345421AbiCWXDM (ORCPT ); Wed, 23 Mar 2022 19:03:12 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712A02CC8C; Wed, 23 Mar 2022 16:01:42 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 644F5221D4; Thu, 24 Mar 2022 00:01:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648076500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mrbZnCx5ImFtI+d/9SJ/+v1bhmyj3qBx9rMgcrWC17Q=; b=Rs87I7ubuG5FwsuqBEU0Wbdrk44gkKESedjD6nAYcoxcQ3F8Y8Fcd2DiHKlYL/vVP31iMX jWcQPJrtcj6ULwLw6oXsrfaQWByIlQFUy7MJuNSXhF/PcDb0SpDJueH4k9EIX530VU4K8N ELSDV6o0AMdR9Gxg/AzbhsbbDyniDRQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 24 Mar 2022 00:01:40 +0100 From: Michael Walle To: Andrew Lunn Cc: Heiner Kallweit , Russell King , Jakub Kicinski , Paolo Abeni , "David S . Miller" , Xu Liang , Alexandre Belloni , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 0/5] net: phy: C45-over-C22 access In-Reply-To: References: <20220323183419.2278676-1-michael@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Am 2022-03-23 21:30, schrieb Andrew Lunn: > On Wed, Mar 23, 2022 at 07:34:14PM +0100, Michael Walle wrote: >> Hi, >> >> This is the result of this discussion: >> https://lore.kernel.org/netdev/240354b0a54b37e8b5764773711b8aa3@walle.cc/ >> >> The goal here is to get the GYP215 and LAN8814 running on the >> Microchip >> LAN9668 SoC. The LAN9668 suppports one external bus and unfortunately, >> the >> LAN8814 has a bug which makes it impossible to use C45 on that bus. >> Fortunately, it was the intention of the GPY215 driver to be used on a >> C22 >> bus. But I think this could have never really worked, because the >> phy_get_c45_ids() will always do c45 accesses and thus on MDIO bus >> drivers >> which will correctly check for the MII_ADDR_C45 flag and return >> -EOPNOTSUPP >> the function call will fail and thus gpy_probe() will fail. This >> series >> tries to fix that and will lay the foundation to add a workaround for >> the >> LAN8814 bug by forcing an MDIO bus to be c22-only. >> >> At the moment, the probe_capabilities is taken into account to decide >> if >> we have to use C45-over-C22. What is still missing from this series is >> the >> handling of a device tree property to restrict the probe_capabilities >> to >> c22-only. > > We have a problem here with phydev->is_c45. > > In phy-core.c, functions __phy_read_mmd() and __phy_write_mmd() it > means perform c45 transactions over the bus. We know we want to access > a register in c45 space because we are using an _mmd() function. > > In phy.c, it means does this PHY have c45 registers and we should > access that register space, or should we use the c22 register > space. So far example phy_restart_aneg() decides to either call > genphy_c45_restart_aneg() or genphy_restart_aneg() depending on > is_c45. Yes, that is probably the reason why the gpy215 has explicitly set .aneg_done to genphy_c45_aneg_done() for example. > So a PHY with C45 register space but only accessible by C45 over C22 > is probably going to do the wrong thing with the current code. Oh my, yes. Looks like the whole phy_get_c45_ids() isn't working at all for the gpy at the moment (or maybe it will work because it supports AN via the c22 registers, too). I'll have to dig deeper into that tomorrow. I know that _something_ worked at least ;) > For this patchset to work, we need to cleanly separate the concepts of > what sort of transactions to do over the bus, from what register > spaces the PHY has. We probably want something like phydev->has_c45 to > indicate the register space is implemented, and phydev->c45_over_c22 > to indicate what sort of transaction should be used in the _mmd() > functions. > > Your patches start in that direction, but i don't think it goes far > enough. Thanks for the review! -michael