# WP76 Second SPI Chip Select and DMA

**URL:** <https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920>\
**Category:** Uncategorized\
**Created:** [August 4, 2021, 6:44pm UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920 "2021-08-04T18:44:13Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 4, 2021, 6:44pm UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/1 "2021-08-04T18:44:14Z")

</div>

Hi,  
I need a second SPI chip select for our application. Both SPIs should be triggered by an interrupt and the data should be read with DMA.  
I’d prefer to use le\_gpio7 for the second chip select so I can test it on the mangoYellow before the real hardware arrives.

I know that I have to adjust the device tree, but unfortunately I don’t know which files and I don’t know which value.

Thanks in advance,  
Simon

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 12:34am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/2 "2021-08-05T00:34:06Z")

</div>

you can have a look and ask question here:

> **[mangOH Yellow two devices on SPI?](https://forum.mangoh.io/t/mangoh-yellow-two-devices-on-spi/3514/8)**
>
> Both WP SPI drivers spi-qup.c and spi\_qsd.c SUPPORT up to 4 hardware chip selects. But since I do not have the SoC’s PDF and the modules’s schematic I can not tell if the SoC’s SPI support more the one hw chip select and if YES is it exposed to a pad...

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 8:59am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/3 "2021-08-05T08:59:42Z")

</div>

I already read every thread about a second SPI in this forum, but unfortunately nobody mentions which file I have to change. Also nobody added DMA or an IRQ.

1. Which file do I have to modify for the chips selects?
2. what do I have to adjust in this file to get gpio7 or preferably a pin from the outer ring of the module to be set up as a chip select?
3. what do I need to add DMA support in there?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 9:01am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/4 "2021-08-05T09:01:47Z")

</div>

you can ask in that thread as that guy makes it to work.

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 9:07am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/5 "2021-08-05T09:07:16Z")

</div>

This thread is 3 years old, I doubt that the guy is still listening on this.

Maybe you can hand the question over to one of your colleagues?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 9:13am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/6 "2021-08-05T09:13:28Z")

</div>

have you tried to change the state of gpio(which is used as CS) before you trigger the SPI read/write?

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 9:19am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/7 "2021-08-05T09:19:21Z")

</div>

What do you mean? Triggering the chip select with a manual write via sysfs?

I already tried that and it’s way to slow. I need the fastest way to handle this. The fastest way should be a native chip select so I can use it with the IIO interface. Therefore I also need a interrupt pin, which also needs to be setup in the device tree, as far as I’m aware.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 9:28am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/8 "2021-08-05T09:28:32Z")

</div>

did you make it work with the interrupt and native CS pin?

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 9:39am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/9 "2021-08-05T09:39:12Z")

</div>

yes, but it’s way to slow.  
The interrupt latency is jittering between 5us (which would be good) and 2.4ms (which is way to slow).  
Also reading without DMA put a break between every byte that is around 2.2us long, which is also way to slow, because reading 512 bytes then takes around 4.1 ms. So over two thirds of the time is spend in this breaks.

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 9:44am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/10 "2021-08-05T09:44:24Z")

</div>

I need a native second SPI chip select. Otherwise I won’t be able to write 2 IIO drivers for the 2 sensors connected.  
The IIO interface and it’s ringbuffers and triggers should be able to mitigate all other problems regarding latency (as far as I’m aware).

So the question is: Which is the correct dts file to adjust?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 9:47am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/11 "2021-08-05T09:47:50Z")

</div>

no experience on this, but you might try these files:

./kernel/arch/arm/boot/dts/qcom/mdm9607.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-swi-ar-mft.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-cdp.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-swi.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-swi-ar.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-swi-mft.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-wp76xx.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-pinctrl.dtsi  
./kernel/arch/arm/boot/dts/qcom/mdm9607-mtp.dtsi

---

<div class="post-metadata">

**Author:** ![simon.naegele](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@simon.naegele](https://forum.legato.io/u/simon.naegele)\
**Post date:** [August 5, 2021, 9:58am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/12 "2021-08-05T09:58:21Z")

</div>

I don’t want to poke around. I don’t have time to poke around. And as far as I’m aware, it should be a `dts` and not a `dtsi` file.

> [@jyijyi](#):
>
> no experience on this

Can you hand me over to someone who as experience in this?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 5, 2021, 10:03am UTC](https://forum.legato.io/t/wp76-second-spi-chip-select-and-dma/5920/13 "2021-08-05T10:03:16Z")

</div>

Then please contact local distributor and state your business case to speed up the investigation
