Hello,
I have been trying to create some ‘virtual’ spi ports without success:
I understand that the kernel supports gpio driven spi but I cannot seem to add spi numbering greater than spi1 in my device tree.
This I think is down to the definitions in the am33xx.dtsi file.
Normally it is defined as a hardware reference:
spi1: spi@481a0000 {
But I don’t have a hardware block/spi controller to address so was trying to create a “virtual” spi controller.
I thought that it should be possible to define an spi port that uses just the gpio lines and the kernel driver bit-bangs the pins to create the software controlled spi functionality.
I have been trying to do this:
/********************* PINMUX ************************/
spi4_default: spi4_default {
pinctrl-single,pins = <
/* SPI 4 /
0x90 (PIN_OUTPUT_PULLUP | MUX_MODE7) / gpmc_advn_ale.gpio_sclk /
0x9C (PIN_OUTPUT_PULLUP | MUX_MODE7) / gpmc_be0n_cle.gpio_d1 /
0x3C (PIN_OUTPUT_PULLUP | MUX_MODE7) / spi CS0 */
;
};
spi4_sleep: spi4_sleep {
pinctrl-single,pins = <
/* SPI 4 reset value /
0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x9C (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x3C (PIN_INPUT_PULLDOWN | MUX_MODE7) / spi CS0 */
;
};
/*******************************************************/
spi4:spi4 {
pinctrl-names = “default”, “sleep”;
pinctrl-0 = <&spi4_default>;
pinctrl-1 = <&spi4_sleep>;
compatible = “spi-gpio”;
#address-cells = <0x1>;
ranges;
gpio-mosi = <&gpio2 2 0>;
gpio-sck = <&gpio1 15 0>;
cs-gpios = <&gpio2 5 1>;
num-chipselects = <1>;
status = “okay”;
ioctrl@0 {
compatible = “fairchild,74hc595”;
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <4>;
spi-max-frequency = <100000>;
};
};
This is not being done as an overlay it is part of the main board device tree for the kernel.
I have also tried different combinations of declaring the device:
spi4: spi4@0 {
spi4: spi4 {
spi4{
&spi4{
and none of them are successful
Can anyone please cast some light on how this would be done ?
Thank you in advance.
Marc