linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Ayush Singh <ayush@beagleboard.org>
Cc: Andrew Davis <afd@ti.com>, Mark Brown <broonie@kernel.org>,
	Vaishnav M A <vaishnav@beagleboard.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Derek Kiernan <derek.kiernan@amd.com>,
	Dragan Cvetic <dragan.cvetic@amd.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
	Tero Kristo <kristo@kernel.org>,
	Michael Walle <mwalle@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	jkridner@beagleboard.org, robertcnelson@beagleboard.org,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 7/7] dts: ti: k3-am625-beagleplay: Add mikroBUS
Date: Fri, 28 Jun 2024 11:27:29 -0600	[thread overview]
Message-ID: <20240628172729.GD3143032-robh@kernel.org> (raw)
In-Reply-To: <93cdd5c5-d54c-46c2-9055-5cd9cc79e2da@beagleboard.org>

On Thu, Jun 27, 2024 at 11:46:31PM +0530, Ayush Singh wrote:
> 
> On 6/27/24 23:20, Andrew Davis wrote:
> > On 6/27/24 12:16 PM, Ayush Singh wrote:
> > > 
> > > On 6/27/24 22:37, Andrew Davis wrote:
> > > > On 6/27/24 11:26 AM, Ayush Singh wrote:
> > > > > DONOTMERGE
> > > > > 
> > > > > Add mikroBUS connector and some mikroBUS boards support for
> > > > > Beagleplay.
> > > > > The mikroBUS boards node should probably be moved to a more
> > > > > appropriate
> > > > > location but I am not quite sure where it should go since it is not
> > > > > dependent on specific arch.
> > > > > 
> > > > > Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> > > > > ---
> > > > >   arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts | 94
> > > > > +++++++++++++++++++++++---
> > > > >   1 file changed, 86 insertions(+), 8 deletions(-)
> > > > > 
> > > > > diff --git a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
> > > > > b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
> > > > > index 70de288d728e..3f3cd70345c4 100644
> > > > > --- a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
> > > > > +++ b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
> > > > > @@ -38,6 +38,7 @@ aliases {
> > > > >           serial2 = &main_uart0;
> > > > >           usb0 = &usb0;
> > > > >           usb1 = &usb1;
> > > > > +        mikrobus0 = &mikrobus0;
> > > > >       };
> > > > >         chosen {
> > > > > @@ -227,6 +228,56 @@ simple-audio-card,codec {
> > > > >           };
> > > > >       };
> > > > >   +    mikrobus0: mikrobus-connector {
> > > > > +        compatible = "mikrobus-connector";
> > > > > +        pinctrl-names = "default", "pwm_default", "pwm_gpio",
> > > > > +                "uart_default", "uart_gpio", "i2c_default",
> > > > > +                "i2c_gpio", "spi_default", "spi_gpio";
> > > > > +        pinctrl-0 = <&mikrobus_gpio_pins_default>;
> > > > > +        pinctrl-1 = <&mikrobus_pwm_pins_default>;
> > > > > +        pinctrl-2 = <&mikrobus_pwm_pins_gpio>;
> > > > > +        pinctrl-3 = <&mikrobus_uart_pins_default>;
> > > > > +        pinctrl-4 = <&mikrobus_uart_pins_gpio>;
> > > > > +        pinctrl-5 = <&mikrobus_i2c_pins_default>;
> > > > > +        pinctrl-6 = <&mikrobus_i2c_pins_gpio>;
> > > > > +        pinctrl-7 = <&mikrobus_spi_pins_default>;
> > > > > +        pinctrl-8 = <&mikrobus_spi_pins_gpio>;
> > > > > +
> > > > > +        mikrobus-gpio-names = "pwm", "int", "rx", "tx", "scl", "sda",
> > > > > +                      "mosi", "miso", "sck", "cs", "rst", "an";
> > > > > +        mikrobus-gpios = <&main_gpio1 11 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 9 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 24 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 25 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 22 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 23 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 7 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 8 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 14 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 13 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 12 GPIO_ACTIVE_HIGH>,
> > > > > +                 <&main_gpio1 10 GPIO_ACTIVE_HIGH>;
> > > > > +
> > > > > +        spi-controller = <&main_spi2>;
> > > > > +        spi-cs = <0>;
> > > > > +        spi-cs-names = "default";
> > > > > +
> > > > > +        board = <&lsm6dsl_click>;
> > > > > +    };
> > > > > +
> > > > > +    mikrobus_boards {
> > > > > +        thermo_click: thermo-click {
> > > > > +            compatible = "maxim,max31855k", "mikrobus-spi";
> > > > 
> > > > I might be missing something, but your solution cannot possibly be
> > > > to list every click board that could be connected (all 1500+ of them)
> > > > to every mikroBUS connector on every device's DT file..
> > > 
> > > 
> > > I think you missed something. `mikrobus-boards` is not a child node
> > > of `mikrobus0`. See the `board` property in `mikrobus0`. That is
> > > what selects the board attached to the connector.
> > > 
> > 
> > That seems even worse.. That means the board file needs to know about the
> > attached board, which is not how DT works. It describes hardware in a
> > hierarchical/acyclic graph. For instance, take an I2C device, its node
> > is a child of the I2C bus, and has phandle pointers to the IRQ it uses
> > (or whatever else provider it needs). What you have here is like the
> > I2C bus node phandle pointing to the connected child devices.
> > 
> > > The `mikcrobus-boards` node itself should be moved to some
> > > independent location and included from a system that wants to
> > > support mikrobus boards. The connector will only have a phandle to
> > > the board (or boards in case a single mikroBUS board has 1 i2c and 1
> > > spi sensor or some combination).
> > > 
> > 
> > How about providing the full/final example then (this series should be
> > marked
> > as RFC as it is now has missing parts). Move the click board node into a
> > DTSO
> > file and put that in a common location (click boards are common to all
> > boards
> > right, so lets say in drivers/of/click for now just for the RFC).
> > 
> > > 
> > > > 
> > > > Each click board should have a single DTSO overlay file to describe the
> > > > click board, one per click board total. And then that overlay should
> > > > apply cleanly to any device that has a mikroBUS interface.
> > > 
> > > 
> > > Yes, that is the goal.
> > > 
> > > 
> > > > 
> > > > Which means you have not completely solved the fundamental problem of
> > > > abstracting the mikroBUS connector in DT. Each of these click
> > > > device child
> > > > nodes has to be under the parent connector node. Which means a phandle
> > > > to the parent node, which is not generically named. For instance
> > > > if my board has 2 connectors, I would have mikrobus0 and mikrobus1,
> > > > the click board's overlay would look like this:
> > > > 
> > > > /dts-v1/;
> > > > /plugin/;
> > > > 
> > > > &mikrobus0 {
> > > >     status = "okay";
> > > > 
> > > >     mikrobus_board {
> > > >         thermo-click {
> > > >             compatible = "maxim,max31855k", "mikrobus-spi";
> > > >             spi-max-frequency = <1000000>;
> > > >             pinctrl-apply = "spi_default";
> > > >         };
> > > >     };
> > > > };
> > > 
> > > 
> > > No, it will look as follows:
> > > 
> > > ```
> > > 
> > > &mikrobus0 {
> > 
> >           ^^^
> > So same issue, what if I want to attach this click board
> > to the second mikrobus connector on my board (i.e. mikrobus1),
> > I'd have to modify the overlay.. Or have an overlay for every
> > possible connector instance number.
> 
> 
> The plan is to have a sysfs `new_device` and `delete_device` entry like I2C
> has where the board name is passed. The driver can then create a dt
> changeset apply to live tree. In the current dt, the changeset is to add a
> `board` property with the phandle of a board (if found).
> 
> Can you suggest how something similar will be possible if the board node is
> a child of the connector node? Maybe it is possible to take a generic dt
> overlay and change the name of parent node on it or something?

You need to describe the problem(s) to solve first, and then a solution.
You're just giving us a solution to review.

Let's start with you have an add-on board and an overlay for that board. 
No one wants N overlays for N base board for a single physical board. 
One board, one overlay. Any solution must provide that.

Who knows when a board is connected and what board it is? Each one 
could be the OS or the user. Worst case is nothing is detected and it is 
just the user knows "I've connected board X to connector A" and has to 
tell the OS that. Or the OS can detect a board and figure out what board 
via EEPROM with no user intervention. In between is OS detects a board, 
but needs the user to say which one. The detecting everything case is 
easy. The connector driver knows which connector it is and which 
overlay. You just need to define how you select the overlay file based 
on EEPROM data. The others will need some sort of interface for 
the user to provide the information.

Rob

  parent reply	other threads:[~2024-06-28 17:27 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 16:26 [PATCH v5 0/7] misc: Add mikroBUS driver Ayush Singh
2024-06-27 16:26 ` [PATCH v5 1/7] dt-bindings: connector: Add mikrobus-connector Ayush Singh
2024-06-27 17:12   ` Michael Walle
2024-06-27 17:29     ` Ayush Singh
2024-06-27 17:49       ` Michael Walle
2024-06-27 18:44         ` Andrew Lunn
2024-08-31 18:11         ` Ayush Singh
2024-09-04 14:46           ` Rob Herring
2024-09-04 17:08             ` Ayush Singh
2024-09-04 17:49               ` Rob Herring
2024-09-05 20:24                 ` Ayush Singh
2024-06-28 17:00       ` Rob Herring
2024-06-28 16:28   ` Rob Herring
2024-07-02 15:14     ` Ayush Singh
2024-07-02 15:17       ` Rob Herring
2024-06-27 16:26 ` [PATCH v5 2/7] dt-bindings: mikrobus: Add mikrobus board base Ayush Singh
2024-06-28 16:04   ` Rob Herring
2024-06-27 16:26 ` [PATCH v5 3/7] dt-bindings: mikrobus: Add mikrobus-spi binding Ayush Singh
2024-06-27 19:21   ` Rob Herring (Arm)
2024-06-28 16:48   ` Conor Dooley
2024-07-05  7:44     ` Geert Uytterhoeven
2024-06-27 16:26 ` [PATCH v5 4/7] spi: Make of_find_spi_controller_by_node() available Ayush Singh
2024-06-27 16:26 ` [PATCH v5 5/7] spi: Make of_register_spi_device() available Ayush Singh
2024-06-27 16:26 ` [PATCH v5 6/7] mikrobus: Add mikroBUS driver Ayush Singh
2024-07-04 13:06   ` Greg Kroah-Hartman
2024-07-04 13:11     ` Mark Brown
2024-07-04 13:29     ` Ayush Singh
2024-06-27 16:26 ` [PATCH v5 7/7] dts: ti: k3-am625-beagleplay: Add mikroBUS Ayush Singh
2024-06-27 16:42   ` Nishanth Menon
2024-06-27 17:07     ` Ayush Singh
2024-06-27 17:07   ` Andrew Davis
2024-06-27 17:16     ` Ayush Singh
2024-06-27 17:50       ` Andrew Davis
2024-06-27 18:16         ` Ayush Singh
2024-06-27 18:53           ` Andrew Lunn
2024-06-28 17:27           ` Rob Herring [this message]
2024-06-27 17:21     ` Michael Walle
2024-06-27 17:43       ` Ayush Singh
2024-07-05  8:01       ` Geert Uytterhoeven
2024-07-05  8:19         ` Geert Uytterhoeven
2024-07-05 16:34         ` Andrew Davis
2024-07-05 17:36           ` Geert Uytterhoeven
2024-06-28 15:14   ` Conor Dooley
2024-06-28  6:31 ` [PATCH v5 0/7] misc: Add mikroBUS driver Ayush Singh
2024-06-28 13:52   ` Andrew Lunn
2024-06-28 18:05     ` Ayush Singh
2024-06-28 15:41 ` Rob Herring (Arm)

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=20240628172729.GD3143032-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=afd@ti.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=ayush@beagleboard.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=derek.kiernan@amd.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragan.cvetic@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkridner@beagleboard.org \
    --cc=kristo@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mwalle@kernel.org \
    --cc=nm@ti.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=vaishnav@beagleboard.org \
    --cc=vigneshr@ti.com \
    /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).