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 5C794C05027 for ; Fri, 10 Feb 2023 20:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233393AbjBJUCr (ORCPT ); Fri, 10 Feb 2023 15:02:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233051AbjBJUCp (ORCPT ); Fri, 10 Feb 2023 15:02:45 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5718917CED; Fri, 10 Feb 2023 12:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=bhGEaGw9cMMoPachO1bHvi1y2oRU34HBj0zIs129VZM=; b=Mbs8yi8QYZSZ2kwXboDl8eigdl FMPN+HWFVe2bPPROA0msZsNEaQrP12yAutq4eMM9IP0IYIGlhe2SfEdl1OfDhs5qG3sQx5LfiQNyV iHqCwnx9n6ZpDfshwz1JlYkuDxcS/8FHhp1yojovs4coRgVyrXT2adDjt/qsRZJ+cxQY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pQZbT-004dP8-6R; Fri, 10 Feb 2023 21:02:39 +0100 Date: Fri, 10 Feb 2023 21:02:39 +0100 From: Andrew Lunn To: Vladimir Oltean Cc: Maxime Chevallier , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Ioana Ciornei Subject: Re: [PATCH net-next] net: pcs: tse: port to pcs-lynx Message-ID: References: <20230210190949.1115836-1-maxime.chevallier@bootlin.com> <20230210190949.1115836-1-maxime.chevallier@bootlin.com> <20230210193159.qmbtvwtx6kqagvxy@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230210193159.qmbtvwtx6kqagvxy@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 10, 2023 at 09:31:59PM +0200, Vladimir Oltean wrote: > On Fri, Feb 10, 2023 at 08:09:49PM +0100, Maxime Chevallier wrote: > > When submitting the initial driver for the Altera TSE PCS, Russell King > > noted that the register layout for the TSE PCS is very similar to the > > Lynx PCS. The main difference being that TSE PCS's register space is > > memory-mapped, whereas Lynx's is exposed over MDIO. > > > > Convert the TSE PCS to reuse the whole logic from Lynx, by allowing > > the creation of a dummy MDIO bus, and a dummy MDIO device located at > > address 0 on that bus. The MAC driver that uses this PCS must provide > > callbacks to read/write the MMIO. > > > > Also convert the Altera TSE MAC driver to this new way of using the TSE > > PCS. > > > > Signed-off-by: Maxime Chevallier > > --- > > drivers/net/ethernet/altera/altera_tse.h | 2 +- > > drivers/net/ethernet/altera/altera_tse_main.c | 50 ++++- > > drivers/net/pcs/Kconfig | 4 + > > drivers/net/pcs/pcs-altera-tse.c | 194 +++++++----------- > > include/linux/pcs-altera-tse.h | 22 +- > > 5 files changed, 142 insertions(+), 130 deletions(-) > > The glue layer is larger than the duplicated PCS code? :( I was wondering if the glue could actually be made generic. The kernel has a number of reasonably generic MMIO device drivers, which are just given an address range and assume a logical mapping. Could this be made into a generic MDIO MMIO bus driver, which just gets configured with a base address, and maybe a stride between registers? Andrew