On 3/18/24 17:52, Michael Walle wrote:
On Sun Mar 17, 2024 at 8:37 PM CET, 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.
mikroBUS is a connector and does not have a controller. Instead the
software is responsible for identification of board and setting up /
registering uart, spi, i2c, pwm and other buses. Thus it needs a way to
get uart, spi, i2c, pwm and gpio controllers / adapters.
A mikroBUS addon board is free to leave some of the pins unused which
are marked as NC or Not Connected.
Some of the pins might need to be configured as GPIOs deviating from their
reserved purposes Eg: SHT15 Click where the SCL and SDA Pins need to be
configured as GPIOs for the driver (drivers/hwmon/sht15.c) to work.
For some add-on boards the driver may not take care of some additional
signals like reset/wake-up/other. Eg: ENC28J60 click where the reset line
(RST pin on the mikrobus port) needs to be pulled high.
Here's the list of pins in mikroBUS connector:
Analog - AN
Reset - RST
SPI Chip Select - CS
SPI Clock - SCK
SPI Master Input Slave Output - MISO
SPI Master Output Slave Input - MOSI
VCC-3.3V power - +3.3V
Reference Ground - GND
PWM - PWM output
INT - Hardware Interrupt
RX - UART Receive
TX - UART Transmit
SCL - I2C Clock
SDA - I2C Data
+5V - VCC-5V power
GND - Reference Ground
Additionally, some new mikroBUS boards contain 1-wire EEPROM that contains
a manifest to describe the addon board to provide plug and play
capabilities.
Link: https://www.mikroe.com/mikrobus
Link:
https://download.mikroe.com/documents/standards/mikrobus/mikrobus-standard-specification-v200.pdf
mikroBUS specification
Link: https://www.mikroe.com/sht1x-click SHT15 Click
Link: https://www.mikroe.com/eth-click ENC28J60 Click
Link: https://www.mikroe.com/clickid ClickID
Co-developed-by: Vaishnav M A <vaishnav@xxxxxxxxxxxxxxx>
Signed-off-by: Vaishnav M A <vaishnav@xxxxxxxxxxxxxxx>
Signed-off-by: Ayush Singh <ayushdevel1325@xxxxxxxxx>
---
.../connector/mikrobus-connector.yaml | 113 ++++++++++++++++++
See also
https://lore.kernel.org/r/YmFo+EntwxIsco%2Ft@xxxxxxxxxxxxxxxxxx/
Looks like this proposal doesn't have the subnodes. How do you
attach a kernel driver to it's spi port for example? Only through
the manifest files?
-michael
So I looked at the Patch, and it seems the approach of fundamentally
different than this PR. So, let me try to explain what this patch set
does for an add-on board using SPI.
The device tree defines the SPI controller associated with mikroBUS SPI
pins. The driver on match queries and takes a reference to the SPI
controller but does nothing with it. Once a mikroBUS add-on board is
detected (by passing manifest using sysfs or reading from 1-wire
EEPROM), the driver parses the manifest, and if it detects an SPI device
in manifest, it registers SPI device along with setting properties such
as `chip_select`, `max_speed_hz`, `mode`, etc., which are defined in the
manifest. On board removal, it unregisters the SPI device and waits for
a new mikroBUS board to be detected again.
It is also possible for SPI not to be used by a device, in which case,
no SPI device is registered to the controller. It is also possible that
the SPI pins will be used as normal GPIOs. Everything is identified from
the manifest.
Ayush Singh