I'm developing a Linux spi driver to handle communication via SPI port. My SoC offers three spi modules (which I understand it as ports) called ecspi1/ecspi2/ecspi3. I have needs to send two kinds of data using ecspi1 and ecspi2.
I've implemented a driver which registered to spi driver and already successfully handled ecspi1 by add below to dts and driver:
[ dts ]
&ecspi1 {
status = "okay";
fpga1: lfe5u12f6bg256i@0 {
reg = <0>;
compatible = "lattice,lfe5u12f6bg256i";
spi-max-frequency = <10000000>;
};
};
[ driver ]
static const struct of_device_id fpga_spi_of_match[] = {
{ .compatible = "lattice,lfe5u12f6bg256i", },
{},
};
I've tried to add ecspi2 to driver with below modifications. However, driver's probed twice on boot and failed at the second probe period.
[ dts ]
&ecspi1 {
status = "okay";
fpga1: lfe5u12f6bg256i@0 {
reg = <0>;
compatible = "lattice,lfe5u12f6bg256i";
spi-max-frequency = <10000000>;
};
};
+&ecspi2 {
+ status = "okay";
+
+ fpga0: fpga_fw@0 {
+ reg = <0>;
+ compatible = "fpga_fw,lfe5u12f6bg256i";
+ spi-max-frequency = <10000000>;
+ };
+};
[ driver ]
static const struct of_device_id fpga_spi_of_match[] = {
{ .compatible = "fpga_fw,lfe5u12f6bg256i", },
+ { .compatible = "lattice,lfe5u12f6bg256i", },
{},
};
Does anyone know how to handle multiple SPI ports (devices) in single driver?