devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ayush Singh <ayush@beagleboard.org>
To: Michael Walle <mwalle@kernel.org>, Andrew Davis <afd@ti.com>,
	Mark Brown <broonie@kernel.org>,
	Vaishnav M A <vaishnav@beagleboard.org>,
	Rob Herring <robh@kernel.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>, Andrew Lunn <andrew@lunn.ch>,
	jkridner@beagleboard.org, robertcnelson@beagleboard.org
Cc: 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: Thu, 27 Jun 2024 23:13:54 +0530	[thread overview]
Message-ID: <583334ad-2f87-479c-a4c6-bd4da11bae31@beagleboard.org> (raw)
In-Reply-To: <D2AZ0QKTPY3B.1I48GLI90XD0P@kernel.org>


On 6/27/24 22:51, Michael Walle wrote:
> On Thu Jun 27, 2024 at 7:07 PM CEST, Andrew Davis wrote:
>>> +	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..
>>
>> 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.
>>
>> 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";
>> 		};
>> 	};
>> };
> If there should only be one DT overlay per click board, how would
> you apply that to to different connectors?


See my other two replies for more context:

https://lore.kernel.org/linux-arm-kernel/cef08d49-a462-4167-8b9d-bf09e8aac92f@beagleboard.org/

https://lore.kernel.org/linux-arm-kernel/e0f9754e-4d84-4ab4-82a4-34cb12800927@beagleboard.org/


My ideal design is that most mikroBUS board configs will be defined in a 
`dtsi` file which can be included by any system with mikroBUS support. 
This file might look as follows:

```

/dts-v1/;
/plugin/;

/ {
	mikrobus_boards {
		thermo_click: thermo-click {
			compatible = "maxim,max31855k", "mikrobus-spi";
			spi-max-frequency = <1000000>;
			pinctrl-apply = "spi_default";
		};

		lsm6dsl_click: lsm6dsl-click {
			compatible = "st,lsm6ds3", "mikrobus-spi";
			spi-max-frequency = <1000000>;
			pinctrl-apply = "spi_default";
		};
	};
};

```


And the board overlay will look as follows:

```

&conector {

     board = <&lsm6dsl_click>;

};

```


I do have an experimental configfs entry that passes the mikroBUS board 
id(s) and creates and applies the dt changeset to the connector dynamically.


>
>> I think this solution is almost there, but once you solve the above
>> issue, we could just apply the right overlay for our attached click
>> board ahead of time and not need the mikroBUS bus driver at all.
> The bus driver would still be needed to do the enumeration of the
> children, no? And it could make the chip select translations etc. So
> you can use the normal bindings of these devices.
>
> -michael


If static dt was the only method to detect the board, then it would be 
fine. But boards with 1-wire-eeprom can allow for for dynamic detection 
if the overlay can be system agnostic.


To make the dt system agnostic, it should be possible for the board to 
specify the following information:

1. If a pin is supposed to perform its normal function (UART TX should 
actually do UART TX), or if it should work as say GPIO (Eg, using RST 
pin as SPI chipselect).

2. Which pin(s) are the SPI chipselect.

3. If a particular pin needs to be pulled high or low for the board to 
function, etc.


So while most of the normal properties of SPI devices can be reused, 
there is a need to introduce new properties for additional information. 
In the previous patches, MikroBUS manifest was being used for this 
purpose, but for a full dt driver, the device tree needs to be extended 
to specify these extra properties that are not relevant to the 
non-mikrobus variant of the device.


Ayush Singh


  reply	other threads:[~2024-06-27 17:44 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
2024-06-27 17:21     ` Michael Walle
2024-06-27 17:43       ` Ayush Singh [this message]
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=583334ad-2f87-479c-a4c6-bd4da11bae31@beagleboard.org \
    --to=ayush@beagleboard.org \
    --cc=afd@ti.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --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=robh@kernel.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).