Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RFC : mikroBUS driver for add-on boards
Attached is a patch for the mikroBUS driver which helps to instantiate an add-on board device on a mikrobus port by fetching the device identifier manifest binary from an EEPROM on-board the device. mikroBUS is an add-on board socket standard by MikroElektronika that can be freely used by anyone following the guidelines, more details and discussions on the status of the driver can be found here in this eLinux wiki: https://elinux.org/Mikrobus In the current state of the driver, more than 80 different add-on boards have been tested on the BeagleBoard.org PocketBeagle and the manifest binary is generated using the same manifesto tool used to generate Greybus manifest binaries, The pull request to manifesto to add new descriptors specific to mikrobus is here : projectara/manifesto#2 The utilization of Greybus manifest binaries here is not entirely coincidental, We are evaluating ways to add mikroBUS sockets and devices via Greybus expansion. The mikroBUS standard includes SPI, I2C, UART, PWM, ADC, GPIO and power (3.3V and 5V) connections to interface common embedded peripherals, There are more than 750 add-on boards ranging from wireless connectivity boards to human-machine interface sensors which conform to the mikroBUS standard, out of which more than 140 boards already have support in the Linux kernel.Today, there is no mainlinesolution for enabling mikroBUS add-on boards at run-time, the most straight forward method for loading drivers is to provide device-tree overlay fragments at boot time, this method suffers from the need to maintain a large out-of-tree database for which there is need to maintain an overlay for every mikroBUS add-on board for every Linux system and for every mikroBUS socket on that system. The mikroBUS driver tries to solve the problem by using extended version of the greybus manifest to describe the add-on board device specific information required by the device driver and uses it along with the fixed port specific information to probe the specific device driver.The manifest binary is now fetched from an I2C EEPROM over the I2C bus on the mikroBUS port(subject to change in mikroBUS v3 specification) and enumerate drivers for the add-on devices.There is also ongoing work to define a mikroBUS v3 standard in which the addon board includes a non-volatile storage to store the device identifier manifest binary, once the mikroBUS v3 standard is released, the mikroBUS can be seen as a probeable bus such that the kernel can discover the device on the bus at boot time. The driver also has a few debug SysFS interfaces for testing on add-on boards without an EEPROM, these can be used in the following manner: (example for mikroBUS port 1 on BeagleBoard.org PocketBeagle): printf "%b" '\x01\x00\x00\x59\x32\x17' > /sys/bus/mikrobus/add_port The bytes in the byte array sequence are (in order): * i2c_adap_nr * spi_master_nr * serdev_ctlr_nr * rst_gpio_nr * pwm_gpio_nr * int_gpio_nr * add_port sysFS entry is purely for debug and in the actual state of the driver, port configuration will be loaded from a suitable device tree overlay fragment. echo 0 > /sys/bus/mikrobus/del_port (to delete the attached port) echo 1 > /sys/class/mikrobus-port/mikrobus-0/rescan (to rescan the EEPROM contents on the I2C bus on the mikroBUS port). cat board_manifest.mnfb > /sys/class/mikrobus-port/mikrobus-0/new_device * debug interface to pass the manifest binary in case an EEPROM is absent echo 0 > /sys/class/mikrobus-port/mikrobus-0/delete_device * to unload the loaded board on the mikrobus port These sysFS interfaces are only implemented for debug purposes and in the actual implementation of the driver these will be removed and the manifest binary will be fetched from the non volatile storage on-board the device. The mikroBUS driver enable the mikroBUS to be a probeable bus such that the kernel can discover the device and automatically load the drivers. There are already several Linux platforms with mikroBUS sockets and the mikroBUS driver helps to reduce the time to develop and debug support for various mikroBUS add-on boards. Further, it opens up the possibility for support under dynamically instantiated buses such as with Greybus. Please let know the feedback you have on this patch or the approach used. Thanks, Vaishnav M A Signed-off-by: Vaishnav M A <[email protected]>
- Loading branch information