From: Ayush Singh <ayush@beagleboard.org>
To: 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>,
Michael Walle <mwalle@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 22:46:15 +0530 [thread overview]
Message-ID: <cef08d49-a462-4167-8b9d-bf09e8aac92f@beagleboard.org> (raw)
In-Reply-To: <4e23ec81-b278-4f2b-815d-64ed9390ca55@ti.com>
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.
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).
>
> 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 {
status = "okay";
board = <&thermo-click>;
};
&mikrobus_board {
thermo-click {
compatible = "maxim,max31855k", "mikrobus-spi";
spi-max-frequency = <1000000>;
pinctrl-apply = "spi_default";
};
};
```
>
> 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.
Well, the driver is still needed because some things cannot be done
generically in dt. Eg:
1. SPI chipselect. Each connector will have different chipselect number
mapped to CS pin. In fact a mikrobus board might use other pins like RST
as chipselect as well.
2. Using pins other than their intended purpose like GPIO.
>
> Andrew
>
>> + 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";
>> + };
>> + };
>> };
>> &main_pmx0 {
>> @@ -387,6 +438,18 @@ AM62X_IOPAD(0x01f0, PIN_OUTPUT, 5) /* (A18)
>> EXT_REFCLK1.CLKOUT0 */
>> >;
>> };
>> + mikrobus_pwm_pins_default: mikrobus-pwm-default-pins {
>> + pinctrl-single,pins = <
>> + AM62X_IOPAD(0x01a4, PIN_INPUT, 2) /* (B20)
>> MCASP0_ACLKX.ECAP2_IN_APWM_OUT */
>> + >;
>> + };
>> +
>> + mikrobus_pwm_pins_gpio: mikrobus-pwm-gpio-pins {
>> + pinctrl-single,pins = <
>> + AM62X_IOPAD(0x01a4, PIN_INPUT, 7) /* (B20)
>> MCASP0_ACLKX.GPIO1_11 */
>> + >;
>> + };
>> +
>> mikrobus_i2c_pins_default: mikrobus-i2c-default-pins {
>> pinctrl-single,pins = <
>> AM62X_IOPAD(0x01d0, PIN_INPUT_PULLUP, 2) /* (A15)
>> UART0_CTSn.I2C3_SCL */
>> @@ -394,6 +457,13 @@ AM62X_IOPAD(0x01d4, PIN_INPUT_PULLUP, 2) /*
>> (B15) UART0_RTSn.I2C3_SDA */
>> >;
>> };
>> + mikrobus_i2c_pins_gpio: mikrobus-i2c-gpio-pins {
>> + pinctrl-single,pins = <
>> + AM62X_IOPAD(0x01d0, PIN_INPUT, 7) /* (A15)
>> UART0_CTSn.GPIO1_22 */
>> + AM62X_IOPAD(0x01d4, PIN_INPUT, 7) /* (B15)
>> UART0_RTSn.GPIO1_23 */
>> + >;
>> + };
>> +
>> mikrobus_uart_pins_default: mikrobus-uart-default-pins {
>> pinctrl-single,pins = <
>> AM62X_IOPAD(0x01d8, PIN_INPUT, 1) /* (C15)
>> MCAN0_TX.UART5_RXD */
>> @@ -401,6 +471,13 @@ AM62X_IOPAD(0x01dc, PIN_OUTPUT, 1) /* (E15)
>> MCAN0_RX.UART5_TXD */
>> >;
>> };
>> + mikrobus_uart_pins_gpio: mikrobus-uart-gpio-pins {
>> + pinctrl-single,pins = <
>> + AM62X_IOPAD(0x01d8, PIN_INPUT, 7) /* (C15)
>> MCAN0_TX.GPIO1_24 */
>> + AM62X_IOPAD(0x01dc, PIN_INPUT, 7) /* (E15)
>> MCAN0_RX.GPIO1_25 */
>> + >;
>> + };
>> +
>> mikrobus_spi_pins_default: mikrobus-spi-default-pins {
>> pinctrl-single,pins = <
>> AM62X_IOPAD(0x01b0, PIN_INPUT, 1) /* (A20)
>> MCASP0_ACLKR.SPI2_CLK */
>> @@ -410,6 +487,15 @@ AM62X_IOPAD(0x0198, PIN_INPUT, 1) /* (A19)
>> MCASP0_AXR2.SPI2_D1 */
>> >;
>> };
>> + mikrobus_spi_pins_gpio: mikrobus-spi-gpio-pins {
>> + pinctrl-single,pins = <
>> + AM62X_IOPAD(0x0194, PIN_INPUT, 7) /* (B19)
>> MCASP0_AXR3.GPIO1_7 */
>> + AM62X_IOPAD(0x0198, PIN_INPUT, 7) /* (A19)
>> MCASP0_AXR2.GPIO1_8 */
>> + AM62X_IOPAD(0x01ac, PIN_INPUT, 7) /* (E19)
>> MCASP0_AFSR.GPIO1_13 */
>> + AM62X_IOPAD(0x01b0, PIN_INPUT, 7) /* (A20)
>> MCASP0_ACLKR.GPIO1_14 */
>> + >;
>> + };
>> +
>> mikrobus_gpio_pins_default: mikrobus-gpio-default-pins {
>> bootph-all;
>> pinctrl-single,pins = <
>> @@ -630,8 +716,6 @@ &main_gpio0 {
>> &main_gpio1 {
>> bootph-all;
>> - pinctrl-names = "default";
>> - pinctrl-0 = <&mikrobus_gpio_pins_default>;
>> gpio-line-names = "", "", "", "", "", /* 0-4 */
>> "SPE_RSTN", "SPE_INTN", "MIKROBUS_GPIO1_7", /* 5-7 */
>> "MIKROBUS_GPIO1_8", "MIKROBUS_GPIO1_9", /* 8-9 */
>> @@ -804,15 +888,11 @@ it66121_out: endpoint {
>> };
>> &main_i2c3 {
>> - pinctrl-names = "default";
>> - pinctrl-0 = <&mikrobus_i2c_pins_default>;
>> clock-frequency = <400000>;
>> status = "okay";
>> };
>> &main_spi2 {
>> - pinctrl-names = "default";
>> - pinctrl-0 = <&mikrobus_spi_pins_default>;
>> status = "okay";
>> };
>> @@ -876,8 +956,6 @@ &main_uart1 {
>> };
>> &main_uart5 {
>> - pinctrl-names = "default";
>> - pinctrl-0 = <&mikrobus_uart_pins_default>;
>> status = "okay";
>> };
>>
Ayush Singh
next prev parent reply other threads:[~2024-06-27 17:16 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 [this message]
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
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=cef08d49-a462-4167-8b9d-bf09e8aac92f@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).