How can I add spi slave?

Hi guys,

I bought the hikey board (2GB). I downloaded the android and kernel code.
Compiled and flashed the images into the board and everything working fine.

I am planning to understand the spi, i2s and i2c on the hikey.
To do that I started with spi and found a node in the dts file called “spi_0: spi@f7106000”
How can I add a slave device to spi?

I just added the below code that in that node.
m25p80@1 {
compatible = “st,m25p80”;
reg = <1>;
spi-max-frequency = <12000000>;
spi-cpol;
spi-cpha;
pl022,hierarchy = <0>;
pl022,interface = <0>;
pl022,slave-tx-disable;
pl022,com-mode = <0x2>;
pl022,rx-level-trig = <0>;
pl022,tx-level-trig = <0>;
pl022,ctrl-len = <0x11>;
pl022,wait-state = <0>;
pl022,duplex = <0>;
};
I am getting following error log in the dmesg:
[ 1.557994] ssp-pl022 f7106000.spi: could not find pctldev for node /soc/pinmux@f7010000/spi0_pmx_func, deferring probe
[ 4.786107] ssp-pl022 f7106000.spi: ARM PL022 driver, device ID: 0x00041022
[ 4.793336] ssp-pl022 f7106000.spi: mapped registers from 0x00000000f7106000 to ffffff800994e000
[ 4.803200] ssp-pl022 f7106000.spi: cs1 >= max 1
[ 4.807903] spi_master spi0: spi_device register error /soc/spi@f7106000/m25p80@1
[ 4.815532] spi_master spi0: Failed to create SPI device for /soc/spi@f7106000/m25p80@1

Am I missing anything or it won’t work at all?
I think it comes with the device “m25p80” in it.

I am getting these errors when I changed

	spidev@0 {
		compatible = &quot;linux,spidev&quot;;
		spi-max-frequency = &lt;500000&gt;;
		reg = &lt;0&gt;;
		status = &quot;ok&quot;;
	};

to

	spidev@1 {
		compatible = &quot;linux,spidev&quot;;
		spi-max-frequency = &lt;500000&gt;;
		reg = &lt;1&gt;;
		status = &quot;ok&quot;;
	};

hikey:/ # dmesg | grep -i spi
[    1.557527] ssp-pl022 f7106000.spi: could not find pctldev for node /soc/pinmux@f7010000/spi0_pmx_func, deferring probe
[    4.792638] ssp-pl022 f7106000.spi: ARM PL022 driver, device ID: 0x00041022
[    4.799842] ssp-pl022 f7106000.spi: mapped registers from 0x00000000f7106000 to ffffff800a95a000
[    4.809778] ssp-pl022 f7106000.spi: cs1 &gt;= max 1
[    4.814469] spi_master spi0: spi_device register error /soc/spi@f7106000/spidev@1
[    4.822146] spi_master spi0: Failed to create SPI device for /soc/spi@f7106000/spidev@1

Is that because it has only one chip select line?

Not sure but I think so. Try adding the gpio you want to use as the 2nd chip select line to the cs-gpios property. E.g.

cs-gpios = <&gpio6 2 0>, <&gpio2 0 0>;