Re: [PATCH v3 1/8] dt-bindings: misc: Add mikrobus-connector

From: Ayush Singh
Date: Mon Mar 18 2024 - 08:37:59 EST


A new version of the patch is up and can be found here: https://lore.kernel.org/lkml/20240317193714.403132-1-ayushdevel1325@xxxxxxxxx/


On 3/18/24 02:29, Rob Herring wrote:

On Sat, Mar 16, 2024 at 12:18:59AM +0530, Ayush Singh wrote:
Add DT bindings for mikroBUS interface. MikroBUS is an open standard
developed by MikroElektronika for connecting add-on boards to
microcontrollers or microprocessors.

Signed-off-by: Ayush Singh <ayushdevel1325@xxxxxxxxx>
---
.../bindings/misc/mikrobus-connector.yaml | 110 ++++++++++++++++++
MAINTAINERS | 6 +
2 files changed, 116 insertions(+)
create mode 100644 Documentation/devicetree/bindings/misc/mikrobus-connector.yaml

diff --git a/Documentation/devicetree/bindings/misc/mikrobus-connector.yaml b/Documentation/devicetree/bindings/misc/mikrobus-connector.yaml
new file mode 100644
index 000000000000..6eace2c0dddc
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/mikrobus-connector.yaml
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/mikrobus-connector.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: mikroBUS add-on board socket
+
+maintainers:
+ - Ayush Singh <ayushdevel1325@xxxxxxxxx>
+
+properties:
+ compatible:
+ const: mikrobus-connector
+
+ pinctrl-0: true
+ pinctrl-1: true
+ pinctrl-2: true
+ pinctrl-3: true
+ pinctrl-4: true
+ pinctrl-5: true
+ pinctrl-6: true
+ pinctrl-7: true
+ pinctrl-8: true
+
+ pinctrl-names:
+ items:
+ - const: default
+ - const: pwm_default
+ - const: pwm_gpio
+ - const: uart_default
+ - const: uart_gpio
+ - const: i2c_default
+ - const: i2c_gpio
+ - const: spi_default
+ - const: spi_gpio
+
+ mikrobus-gpios:
+ minItems: 11
+ maxItems: 12
What is each GPIO entry?





+
+ i2c-adapter:
We already have i2c-bus and i2c-parent properties. Neither of those work
for you?

I think i2c-bus should work. Although I could only find information about what it is supposed to be in some old kernel i2c.txt so is there a general place for such properties to be discovered?

+ description: i2c adapter attached to the mikrobus socket.
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ spi-controller:
+ description: spi bus number of the spi-master attached to the mikrobus socket.
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ uart:
Nice and consistent. In 3 properties, we have 'adapter', 'controller'
and <null>...

Right. So the names I am currently using are from v2 of the patch and are based on Linux kernel names for this. But yes, they probably need to be changed since dt-bindings are not supposed to be tied to Linux. Not sure if `spi-bus` and `serial-bus` are appropriate though, so maybe `{spi, serial}-controller` is fine?

To explain why these are here in the first place, mikroBUS addon boards are free to only use a few of these buses or multiple of these simultaneously. Also, some of the properties of spi, i2c etc device needs to be changed depending on the mikroBUS board (mostly described by mikroBUS manifest). This means, the driver needs access to i2c adapter, spi controller, serdev-controller, pwm associated with the mikroBUS connector to configure them (or not use them in case of Not Connected) and register the board.

Also, DT generally uses 'serial' rather than 'uart'.
Noted
+ description: uart port attached to the mikrobus socket
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ pwms:
+ description: the pwm-controller corresponding to the mikroBUS PWM pin.
+ maxItems: 1
+
+ spi-cs:
+ description: spi chip-select numbers corresponding to the chip-selects on the mikrobus socket.
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ items:
+ - description: chip select corresponding to CS pin
+ - description: chip select corresponding to RST pin
How would someone handle any of the properties defined in
spi-peripheral-props.yaml?


Rob

After taking a look at `spi-peripheral-props.yaml`, the properties described here will actually be specified by mikroBUS manifest and thus will be set by the driver after parsing the manifest.

If you are referring to keeping `spi-cs` in sync with `reg`, well I'm not quite sure how to do it better than the current implementation.

Ayush Singh