i want to access 3 spi slave(ad7799),i config dts like this
&ecspi3 {
fsl,spi-num-chipselects = <3>;
cs-gpio = <
&gpio1 20 GPIO_ACTIVE_LOW
&gpio2 30 GPIO_ACTIVE_HIGH
&gpio3 19 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
status = "okay";
spidev: ad7799@0 {
compatible = "ad7799";
spi-max-frequency = <8000000>;
reg = <0>;
};
spidev: ad7799@1 {
compatible = "ad7799";
spi-max-frequency = <8000000>;
reg = <0>;
};
spidev: ad7799@3 {
compatible = "ad7799";
spi-max-frequency = <8000000>;
reg = <0>;
};
i write a driver like this
static const struct of_device_id ad7799_of_match[] = {
{ .compatible = "ad7799" },
{ /* Sentinel */ }
};
static struct spi_driver ad7799_driver = {
.probe = ad7799_probe,
.remove = ad7799_remove,
.driver = {
.owner = THIS_MODULE,
.name = "ad7799",
.of_match_table = ad7799_of_match,
},
.id_table = ad7799_id,
};
i write app to access spi slave like this
fd1=open("/dev/ad7799@0", O_RDWR);//error No such file or directory
fd2=open("/dev/ad7799@1", O_RDWR);//error No such file or directory
fd3=open("/dev/ad7799@2", O_RDWR);//error No such file or directory
but how i access three chip use same driver,
Hi Johnmxq
one can look at unit test ecspi example:
https://source.codeaurora.org/external/imx/imx-test/tree/test/mxc_spi_test?h=lf-5.10.52_2.1.0
Best regards
igor