Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3817763pxf; Tue, 6 Apr 2021 00:35:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj/J4w1AFTAlDK8jH5CcRDkwpeNd6DqPUibRi7eZfSpwcv+RD3v0k/CTZO/bq4WjdL6cBC X-Received: by 2002:a17:907:7684:: with SMTP id jv4mr33496516ejc.231.1617694504922; Tue, 06 Apr 2021 00:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617694504; cv=none; d=google.com; s=arc-20160816; b=tZp8GG11ZHTWkn1nrBwu++HOwe2gxWsMlm9uigj7gLoWRb76wuJvlP3ne5N7/KCk3k y5yeVZ0RcaXsre86ByniJJGgsU6zKEi727fzIxn1/wI14tr0GrAer1HwAqKTjaRrCDZy pZtn44+L7fbek+g/YXeSgmq18b8d77pI64n2yw8/RAQgTdqzJt+BsuEZMBp4De1fuTGD N8UGRM9NAMLW8Nsg1xceBC3nunMn2wiznj8WL8WmzvEve/R7vZhmxlUruG3qYUW5Kc12 3ZW2BqWRC2b93CRtCzqonC1F/cGSDrHtLB+SW++guaGr8qA9JktC2iHG7pa9CuXSXeZm 9lSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=DPPgYZ9WGWR/2v1WLGYmwPI0bYbiaSkKfENowqBTlqI=; b=VsyX1DOTZjFexVtxJoNjHDoKi0bU/rWcXxiKf/cloPzdR1EoexY/mlZuVVpyw/uacd TZ2zLrUg7as35/PhraNstIv1Kof16hIHbUiPc5HIj88TEFeJKtMFm4yn6Kna1J4rDGjy KwEgYmddSFpErdyzNnyVP4CBbNJmMM1QJoKYF3FrAuUM70yjWhHl1mUng1JrQCIkkZUn jwFDHv4eViRSHPZh0KOguHr4isUevuQxOQiCwgoB7LC4iVWvw3OPa68GQn/r5dLfmN1e lH66qOxswEcl1ddvVAiN4QNDTFAE7TLeNzOdVYGw3jAaZfxSOYeCqnQ6P6a0vNFwhDf4 zVmg== 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 r20si2488331edm.292.2021.04.06.00.34.40; Tue, 06 Apr 2021 00:35:04 -0700 (PDT) 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 S235130AbhDES6l (ORCPT + 99 others); Mon, 5 Apr 2021 14:58:41 -0400 Received: from hs01.dk-develop.de ([173.249.23.66]:48088 "EHLO hs01.dk-develop.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234913AbhDES6i (ORCPT ); Mon, 5 Apr 2021 14:58:38 -0400 Date: Mon, 5 Apr 2021 20:58:07 +0200 From: Danilo Krummrich To: Andrew Lunn Cc: Russell King - ARM Linux admin , davem@davemloft.net, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jeremy.linton@arm.com Subject: Re: [PATCH 2/2] net: mdio: support c45 peripherals on c22 busses Message-ID: References: <20210331141755.126178-3-danilokrummrich@dk-develop.de> <6f1dfc28368d098ace9564e53ed92041@dk-develop.de> <20210331183524.GV1463@shell.armlinux.org.uk> <2f0ea3c3076466e197ca2977753b07f3@dk-develop.de> <20210401084857.GW1463@shell.armlinux.org.uk> <20210402125858.GB1463@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 05, 2021 at 03:33:55PM +0200, Andrew Lunn wrote: > On Sun, Apr 04, 2021 at 09:23:55PM +0200, Danilo Krummrich wrote: > > So currently every driver should check for the flag MII_ADDR_C45 and report an > > error in case it's unsupported. > > > > What do you think about checking the bus' capabilities instead in > > mdiobus_c45_*()? This way the check if C45 is supported can even happen before > > calling the driver at all. I think that would be a little cleaner than having > > two places where information of the bus' capabilities are stored (return value > > of read/write functions and the capabilities field). > > > > I think there are not too many drivers setting their capabilities though, but > > it should be easy to derive this information from how and if they handle the > > MII_ADDR_C45 flag. > > I actually don't think anything needs to change. The Marvell PHY > probably probes due to its C22 IDs. The driver will then requests C45 > access which automagically get converted into C45 over C22 for your > hardware, but remain C45 access for bus drivers which support C45. > Thanks Andrew - I agree, for the Marvell PHY to work I likly don't need any change, since I also expect that it will probe with the C22 IDs. I'll try this soon. However, this was about something else - Russell wrote: > > > We have established that MDIO drivers need to reject accesses for > > > reads/writes that they do not support [..] The MDIO drivers do this by checking the MII_ADDR_C45 flag if it's a C45 bus request. In case they don't support it they return -EOPNOTSUPP. So basically, the bus drivers read/write functions (should) encode the capability of doing C45 transfers. I just noted that this is redundant to the bus' capabilities field of struct mii_bus which also encodes the bus' capabilities of doing C22 and/or C45 transfers. Now, instead of encoding this information of the bus' capabilities at both places, I'd propose just checking the mii_bus->capabilities field in the mdiobus_c45_*() functions. IMHO this would be a little cleaner, than having two places where this information is stored. What do you think about that? > Andrew