Wanted to reply that I have this working locally. A cape I have designed (using most of the PRU lines) leverages SPI0 for a 2.8" TFT as well as a microSD card (via SPI, not SDIO). Both work, though the Linux kernel will preempt TFT access for uSD data transfer.
The device used for testing is the Adafruit 2.8" TFT device with capactive touch and microSD slot, part #2090. My cape uses the EYESPI connector, which provides the standard SPI signals MISO / MOSI / SCK and separate CS signals for the TFT and microSD slot, but does not provide the microSD card detect pin.
As the AM3358 SPI core only has 2 lines brought out to pads, and SPI0.CS1 is allocated for the on-board microSD card detect line (MMC0_CD), any additional SPI0 CD lines must be specified as GPIOs.
This excerpt of our overlay worked for me:
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/board/am335x-bone-pins.h>
#include <dt-bindings/interrupt-controller/irq.h>
/* ... */
&am33xx_pinmux {
/* ... */
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0) /* P9_22 (A17) spi0_sclk.spi0_sclk */
AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT, MUX_MODE0) /* P9_21 (B17) spi0_d0.spi0_d0 */
AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0) /* P9_18 (B16) spi0_d1.spi0_d1 */
AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE0) /* P9_17 (A16) spi0_cs0.spi0_cs0 */
AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_OUTPUT, MUX_MODE7) /* P9_23 (V14) gpmc_a1.gpio1_17 */
AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE7) /* P8_09 (T6) gpmc_ben0_cle */
>;
};
};
/* ... */
&ocp {
P8_09_pinmux { status = "disabled"; }; /* P8_09 (ZCZ ball T6) gpmc_be0n_cle (gpio2_5) */
P9_17_pinmux { status = "disabled"; }; /* P9_17 (A16 spi0_cs0.spi0_cs0) */
P9_18_pinmux { status = "disabled"; }; /* P9_18 (B16 spi0_d1.spi0_d1) */
P9_21_pinmux { status = "disabled"; }; /* P9_21 (B17 spi0_d0.spi0_d0) */
P9_22_pinmux { status = "disabled"; }; /* P9_22 (A17 spi0_sclk.spi0_sclk) */
P9_23_pinmux { status = "disabled"; }; /* P9_23 (V14) */
};
/* ... */
&spi0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;
/* spi0.1: TFTCS gpio2 5 is P8.9 */
/* spi0.2: SDCS gpio1 17 is P9_23 */
cs-gpios = <0>, <&gpio2 5 0>, <&gpio1 17 GPIO_ACTIVE_LOW>;
channel@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "rohm,dh2228fv";
symlink = "bone/spi/0.1";
reg = <1>;
spi-max-frequency = <48000000>;
};
sdhc2: sdhc@2 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "mmc-spi-slot";
label="SDHC2";
reg = <2>;
voltage-ranges = <3100 3500>;
spi-max-frequency = <20000000>;
};
};
After running sudo modprobe spidev && sudo modprobe mmc_spi
I now have /dev/spidev0.1
and, with a microSD card in the display’s card slot, /dev/mmcblk3
and /dev/mmcblk3p1
.
Note the conservative 20MHz clock speed for the microSD slot, which seemed necessary for the cabling involved, and the use of GPIO_ACTIVE_LOW
for the cs-gpio
. The <0>
in the first slot means do not override the value provided in the default am335x device tree:
[ 1130.178929] mmc_spi spi0.2: SD/MMC host mmc3, no WP, no poweroff, cd polling
[ 1130.233512] mmc3: host does not support reading read-only switch, assuming write-enable
[ 1130.233568] mmc3: new SDXC card on SPI
[ 1130.239620] mmcblk3: mmc3:0000 SD64G 58.2 GiB
[ 1130.252663] mmcblk3: p1
TFT performance is suitable, I can achieve 10fps video from Python using the spidev
driver (!), but the SD card is really only suitable for slow-speed file backup and restore (~4 minute transfer of a 275MB file via cp
).
Hope this helps someone in the future.