netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Léger" <clement.leger@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Wolfram Sang <wsa@kernel.org>, Peter Rosin <peda@axentia.se>,
	Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-i2c@vger.kernel.org, netdev@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [RFC 00/10] add support for fwnode in i2c mux system and sfp
Date: Tue, 8 Mar 2022 11:45:24 +0100	[thread overview]
Message-ID: <20220308114524.4cd4b308@fixe.home> (raw)
In-Reply-To: <20220224154040.2633a4e4@fixe.home>

Le Thu, 24 Feb 2022 15:40:40 +0100,
Clément Léger <clement.leger@bootlin.com> a écrit :

> Hi,
> 
> As stated at the beginning of the cover letter, the PCIe card I'm
> working on uses a lan9662 SoC. This card is meant to be used an
> ethernet switch with 2 x RJ45 ports and 2 x 10G SFPs. The lan966x SoCs
> can be used in two different ways:
> 
>  - It can run Linux by itself, on ARM64 cores included in the SoC. This
>    use-case of the lan966x is currently being upstreamed, using a
>    traditional Device Tree representation of the lan996x HW blocks [1]
>    A number of drivers for the different IPs of the SoC have already
>    been merged in upstream Linux.
> 
>  - It can be used as a PCIe endpoint, connected to a separate platform
>    that acts as the PCIe root complex. In this case, all the devices
>    that are embedded on this SoC are exposed through PCIe BARs and the
>    ARM64 cores of the SoC are not used. Since this is a PCIe card, it
>    can be plugged on any platform, of any architecture supporting PCIe.
> 
> The goal of this effort is to enable this second use-case, while
> allowing the re-use of the existing drivers for the different devices
> part of the SoC.
> 
> Following a first round of discussion, here are some clarifications on
> what problem this series is trying to solve and what are the possible
> choices to support this use-case.
> 
> Here is the list of devices that are exposed and needed to make this
> card work as an ethernet switch:
>  - lan966x-switch
>  - reset-microchip-sparx5
>  - lan966x_serdes
>  - reset-microchip-lan966x-phy
>  - mdio-mscc-miim
>  - pinctrl-lan966x
>  - atmel-flexcom
>  - i2c-at91
>  - i2c-mux
>  - i2c-mux-pinctrl
>  - sfp
>  - clk-lan966x
> 
> All the devices on this card are "self-contained" and do not require
> cross-links with devices that are on the host (except to demux IRQ but
> this is something easy to do). These drivers already exists and are
> using of_* API to register controllers, get properties and so on.
> 
> The challenge we're trying to solve is how can the PCI driver for this
> card re-use the existing drivers, and using which hardware
> representation to instantiate all those drivers.
> 
> Although this series only contained the modifications for the I2C
> subsystem all the subsystems that are used or needed by the previously
> listed driver have also been modified to have support for fwnode. This
> includes the following subsystems:
> - reset
> - clk
> - pinctrl
> - syscon
> - gpio
> - pinctrl
> - phy
> - mdio
> - i2c
> 
> The first feedback on this series does not seems to reach a consensus
> (to say the least) on how to do it cleanly so here is a recap of the
> possible solutions, either brought by this series or mentioned by
> contributors:
> 
> 1) Describe the card statically using swnode
> 
> This is the approach that was taken by this series. The devices are
> described using the MFD subsystem with mfd_cells. These cells are
> attached with a swnode which will be used as a primary node in place of
> ACPI or OF description. This means that the device description
> (properties and references) is conveyed entirely in the swnode. In order
> to make these swnode usable with existing OF based subsystems, the
> fwnode API can be used in needed subsystems.
> 
> Pros:
>  - Self-contained in the driver.
>  - Will work on all platforms no matter the firmware description.
>  - Makes the subsystems less OF-centric.
> 
> Cons:
>  - Modifications are required in subsystems to support fwnode
>    (mitigated by the fact it makes to subsystems less OF-centric).
>  - swnode are not meant to be used entirely as primary nodes.
>  - Specifications for both ACPI and OF must be handled if using fwnode
>    API.
> 
> 2) Use SSDT overlays
> 
> Andy mentioned that SSDT overlays could be used. This overlay should
> match the exact configuration that is used (ie correct PCIe bus/port
> etc). It requires the user to write/modify/compile a .asl file and load
> it using either EFI vars, custom initrd or via configfs. The existing
> drivers would also need more modifications to work with ACPI. Some of
> them might even be harder (if not possible) to use since there is no
> ACPI support for the subsystems they are using .
> 
> Pros:
>  - Can't really find any for this one
> 
> Cons:
>  - Not all needed subsystems have appropriate ACPI bindings/support
>    (reset, clk, pinctrl, syscon).
>  - Difficult to setup for the user (modify/compile/load .aml file).
>  - Not portable between machines, as the SSDT overlay need to be
>    different depending on how the PCI device is connected to the
>    platform.
> 
> 3) Use device-tree overlays
> 
> This solution was proposed by Andrew and could potentially allows to
> keep all the existing device-tree infrastructure and helpers. A
> device-tree overlay could be loaded by the driver and applied using
> of_overlay_fdt_apply(). There is some glue to make this work but it
> could potentially be possible. Mark have raised some warnings about
> using such device-tree overlays on an ACPI enabled platform.
> 
> Pros:
>  - Reuse all the existing OF infrastructure, no modifications at all on
>    drivers and subsystems.
>  - Could potentially lead to designing a generic driver for PCI devices
>    that uses a composition of other drivers.
> 
> Cons:
>  - Might not the best idea to mix it with ACPI.
>  - Needs CONFIG_OF, which typically isn't enabled today on most x86
>    platforms.
>  - Loading DT overlays on non-DT platforms is not currently working. It
>    can be addressed, but it's not necessarily immediate.
> 
> My preferred solutions would be swnode or device-tree overlays but
> since there to is no consensus on how to add this support, how
> can we go on with this series ?
> 
> Thanks,
> 
> [1]
> https://lore.kernel.org/linux-arm-kernel/20220210123704.477826-1-michael@walle.cc/
> 

Does anybody have some other advices or recommendation regarding
this RFC ? It would be nice to have more feedback on the solution that
might e preferred to support this use-case.

Thanks,


-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

      parent reply	other threads:[~2022-03-08 10:47 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 16:26 [RFC 00/10] add support for fwnode in i2c mux system and sfp Clément Léger
2022-02-21 16:26 ` [RFC 01/10] property: add fwnode_match_node() Clément Léger
2022-02-21 17:44   ` Andy Shevchenko
2022-02-22  8:14     ` Clément Léger
2022-02-21 16:26 ` [RFC 02/10] property: add fwnode_get_match_data() Clément Léger
2022-02-21 17:46   ` Andy Shevchenko
2022-02-22  8:19     ` Clément Léger
2022-02-22  8:33       ` Andy Shevchenko
2022-02-22  8:46         ` Clément Léger
2022-02-22  9:24           ` Andy Shevchenko
2022-02-22  9:47             ` Clément Léger
2022-02-22 10:20               ` Greg Kroah-Hartman
2022-02-22 15:16                 ` Clément Léger
2022-02-21 16:26 ` [RFC 03/10] base: swnode: use fwnode_get_match_data() Clément Léger
2022-02-21 17:48   ` Andy Shevchenko
2022-02-22  8:39     ` Clément Léger
2022-02-23 15:05       ` Sakari Ailus
2022-02-23 15:15         ` Clément Léger
2022-02-23 15:21           ` Sakari Ailus
2022-02-21 16:26 ` [RFC 04/10] property: add a callback parameter to fwnode_property_match_string() Clément Léger
2022-02-21 17:51   ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 05/10] property: add fwnode_property_read_string_index() Clément Léger
2022-02-21 16:26 ` [RFC 06/10] i2c: fwnode: add fwnode_find_i2c_adapter_by_node() Clément Léger
2022-02-21 18:00   ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 07/10] i2c: of: use fwnode_get_i2c_adapter_by_node() Clément Léger
2022-02-21 16:26 ` [RFC 08/10] i2c: mux: pinctrl: remove CONFIG_OF dependency and use fwnode API Clément Léger
2022-02-21 16:26 ` [RFC 09/10] i2c: mux: add support for fwnode Clément Léger
2022-02-21 17:55   ` Andy Shevchenko
2022-02-22  8:53     ` Clément Léger
2022-02-22 10:57       ` Andrew Lunn
2022-02-22 20:31         ` Alexandre Belloni
2022-02-21 16:26 ` [RFC 10/10] net: sfp: " Clément Léger
2022-02-21 16:45   ` Russell King (Oracle)
2022-02-21 17:57   ` Andy Shevchenko
2022-02-22 13:25     ` Clément Léger
2022-02-23 11:22       ` Andy Shevchenko
2022-02-23 12:02         ` Hans de Goede
2022-02-23 12:31           ` Andrew Lunn
2022-02-23 12:41           ` Russell King (Oracle)
2022-02-23 13:39             ` Hans de Goede
2022-02-23 14:14               ` Clément Léger
2022-02-23 15:23                 ` Andrew Lunn
2022-02-23 15:27                   ` Hans de Goede
2022-02-23 15:27                   ` Hans de Goede
2022-02-23 15:36                     ` Andy Shevchenko
2022-02-23 15:38                   ` Clément Léger
2022-02-23 14:37             ` Andy Shevchenko
2022-02-21 17:41 ` [RFC 00/10] add support for fwnode in i2c mux system and sfp Andy Shevchenko
2022-02-22 16:30   ` Clément Léger
2022-02-23 14:46     ` Andy Shevchenko
2022-02-23 15:11       ` Clément Léger
2022-02-23 15:24         ` Andy Shevchenko
2022-02-23 17:41           ` Mark Brown
2022-02-23 17:59             ` Clément Léger
2022-02-23 18:12               ` Mark Brown
2022-02-23 18:19             ` Andy Shevchenko
2022-02-21 21:44 ` Andrew Lunn
2022-02-22  8:26   ` Andy Shevchenko
2022-02-22  8:57     ` Andrew Lunn
2022-02-22  9:20       ` Andy Shevchenko
2022-02-24 14:40 ` Clément Léger
2022-02-24 14:58   ` Hans de Goede
2022-02-24 15:33     ` Mark Brown
2022-02-24 18:14       ` Sakari Ailus
2022-02-24 18:39         ` Alexandre Belloni
2022-02-24 18:43           ` Mark Brown
2022-02-24 18:39         ` Mark Brown
2022-02-24 16:42     ` Clément Léger
2022-02-24 17:26       ` Mark Brown
2022-03-03  8:48         ` Clément Léger
2022-03-03 12:26           ` Mark Brown
2022-03-08 10:45   ` Clément Léger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220308114524.4cd4b308@fixe.home \
    --to=clement.leger@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).