It’s a little bit complicated
- You have to configure the channel of the cp2130 by doing something like this:
echo -n 1,2,-1,0,0,1,0,0,0,0,0,spidev > /sys/devices/platform/msm_hsic_host/usb1/1-1/1-1.1/1-1.1:1.0/channel_config
. Please look at theswitch
statement inchannel_config_store()
in the cp2130 driver to understand the meaning of each value in that string. Specifically, you might want to modify the phase, polarity, speed and chip select (aka channel) depending on which CS you are connected to on the rpi header. - In the previous step, we provided “spidev” as the last parameter. That is the modalias of the SPI device to associate with that chip select. spidev is the device that will create
/dev/spidevN.N
files. In the wp85 kernel, spidev is built as a module. Domodprobe spidev
to load it. After doing that you should have a new/dev/spidevN.N
file. - I’m not sure if you’re using the Legato SpiService, but if you are, then there’s another issue. The problem is that right now, SpiService is a sandboxed app and it only does “requires device” on spidev0.0. You will have to modify the app to bring in the spidev device that is created above. Also I would suggest changing the
start
attribute tomanual
so that the app doesn’t fail to start due to your spidev entry not existing at the time legato starts.