Confused with BB-SPI1-01-00A0.dts example

I am a bit confused with the BB-SPI1-01-00A0.dts example provided in the wiki. In particular, I don’t understand the rationale for the values used in the pin mux configuration:

0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 /
0x194 0x33 /
mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 /
0x198 0x13 /
mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 /
0x19c 0x13 /
mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */

For reference, the register values are decoded as:

0x33:
SLEWCTRL=0 (Fast)
RXACTIVE=1 (Receiver enabled)
PULLTYPESEL=1 (Pullup selected)
PULLUDEN=0 (Pullup/pulldown enabled)
MUXMODE=011b (Mode 3)

0x13:
SLEWCTRL=0 (Fast)
RXACTIVE=0 (Receiver disabled)
PULLTYPESEL=1 (Pullup selected)
PULLUDEN=0 (Pullup/pulldown enabled)
MUXMODE=011b (Mode 3)

Here are my questions:

  1. Why is the spi1_sclk signal configured as an input? I thought that spidev only supports master mode.

  2. Why does spi1_sclk still function properly as an output even though RXACTIVE=1?

  3. Why are pull-ups enabled for the output pins? The TRM advises against it (page 1357):

If a pad is always configured in output mode, it is recommended for user software to disable any internal pull resistor tied to it, to avoid unnecessary consumption.

Cheers,
Emile Cormier

I tried changing it as follows:

  • mcasp0_aclkx.spi1_sclk: RXACTIVE=0 (Receiver disabled)
  • Disabled pullups on mcasp0_aclkx.spi1_sclk, mcasp0_axr0.spi1_d1, and mcasp0_ahclkr.spi1_cs0

So the relevant section in the BB-SPI1-01-00A0.dts file now looks like:

pinctrl-single,pins = <
0x190 0x0b /* mcasp0_aclkx.spi1_sclk, Pull-down disabled | MODE3 /
0x194 0x33 /
mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 /
0x198 0x1b /
mcasp0_axr0.spi1_d1, Pull-up disabled | MODE3 /
0x19c 0x1b /
mcasp0_ahclkr.spi1_cs0, Pull-up disabled | MODE3 */

And everything seems to work fine (note that I’m currently not able to test reading from SPI).

It turns out that reading from D0 doesn’t work unless RXACTIVE=1 for the SCLK signal. This comment from hipstercircuits confirms this. That answers my question #1.

In now have this in my dts file, and both reading and writing seem to work ok:

pinctrl-single,pins = <
0x190 0x2b /* mcasp0_aclkx.spi1_sclk, RXACTIVE | Pull-down disabled | MODE3 /
0x194 0x33 /
mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 /
0x198 0x1b /
mcasp0_axr0.spi1_d1, Pull-up disabled | MODE3 /
0x19c 0x1b /
mcasp0_ahclkr.spi1_cs0, Pull-up disabled | MODE3 */

Hello Emile

It turns out that reading from D0 doesn't work unless RXACTIVE=1 for the SCLK signal. This comment from hipstercircuits confirms this. That answers my question #1.

In now have this in my dts file, and both reading and writing seem to work ok:

pinctrl-single,pins = <

    0x190 0x2b /* mcasp0_aclkx.spi1_sclk, RXACTIVE | Pull-down disabled | MODE3 */
    0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
    0x198 0x1b /* mcasp0_axr0.spi1_d1, Pull-up disabled | MODE3 */
    0x19c 0x1b /* mcasp0_ahclkr.spi1_cs0, Pull-up disabled | MODE3 */

Can you share a complete copy of your DTS file?

Thx.

Here you go. It’s the same as the one here, except for the 4 pinmux register values.

BB-SPI1-01-00A0.txt (1.21 KB)