Hi Victor,
In general, to adapt a Raspberry Pi overlay to our system, it is worth to first take a look at our existing examples. Here is a converted overlay based on rk3308-spi2-spidev.dts and radxa-s0-ext-antenna.dts:
/dts-v1/;
/plugin/;
// Include headers from radxa-s0-ext-antenna.dts
// so we can use human readable names for GPIOs
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
// metadata block is a Radxa custom standard.
// It is only mandatory for Radxa official overlays.
// Use the same spi2 definition as in rk3308-spi2-spidev.dts
&spi2 {
status = "okay";
pinctrl-names = "default";
// Need to check if you are using the same pin for SPI2
// which was documented in the rk3308-spi2-spidev.dts as metadata.exclusive
// "GPIO1_C6", "GPIO1_C7", "GPIO1_D0", "GPIO1_D1"
pinctrl-0 = <&spi2_clk &spi2_csn0 &spi2_miso &spi2_mosi>;
#address-cells = <1>;
#size-cells = <0>;
// Replace spidev@0 with our own device
sharp_dev: sharp-dev@0{
compatible = "sharp";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&sharp_pins>;
spi-cs-high = <1>;
spi-max-frequency = <2000000>;
buswidth = <8>;
debug = <0>;
};
};
// Keep the rk3308-spi2-spidev.dts disabled devices so SPI2 can work
&uart1 {
status = "disabled";
};
&uart2 {
status = "disabled";
};
// Add Rockchip pinctrl to set pins as GPIO
&pinctrl {
sharp {
sharp_pins: sharp-pins {
// rockchip,pins is an array, so you can define multiple pins here.
// You might need to adjust pcfg_pull_none to some other value
rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>,
<2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
// Since GPIO2_A7 and GPIO2_B1 is not used by other devices, we are done here.
// Otherwise, we will also need to disable them like UART1/2 above.
You can then build this overlay with rsetup
with Install 3rd party overlay option.