This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: am3358/add spi device tree

Part Number: AM3358
Other Parts Discussed in Thread: SYSCONFIG

I follow this user guide and try to test spi function.

3.2.4.12. SPI — Processor SDK Linux for AM335X Documentation

spi device tree is added in file "arch/arm/boot/dts/am335x-boneblack.dts" as shown below.

-------------------------------------------------------------------------------------------------------------------------------------------
&spi1 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_s0>; spidev@1 { spi-max-frequency = <24000000>; reg = <0>; compatible = "rohm,dh2228fv"; }; };
-------------------------------------------------------------------------------------------------------------------------------------------
when i try to compiler dts to dtb, error message as below.

-------------------------------------------------------------------------------------------------------------------------------------------
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am335x-boneblack.dtb
DTC arch/arm/boot/dts/am335x-boneblack.dtb
arch/arm/boot/dts/am33xx-l4.dtsi:1677.16-1690.6: ERROR (phandle_references): /ocp/interconnect@48000000/segment@100000/target-module@a0000/spi@0: Reference to non-existent node or label "spi1_pins_s1"

also defined at arch/arm/boot/dts/am335x-boneblack.dts:34.7-43.3
ERROR: Input tree has errors, aborting (use -f to force output)
scripts/Makefile.lib:290: recipe for target 'arch/arm/boot/dts/am335x-boneblack.dtb' failed
make[1]: *** [arch/arm/boot/dts/am335x-boneblack.dtb] Error 2
Makefile:1270: recipe for target 'am335x-boneblack.dtb' failed
make: *** [am335x-boneblack.dtb] Error 2

-------------------------------------------------------------------------------------------------------------------------------------------
How can I fix this problem 
  • pinctrl-0 = <&spi1_pins_s0>;

    Your build is failing because the device tree snippet you added references another node (called spi1_pins_s0 in this case) that is supposed to contain the SPI-related pinmux definitions and that node is not present. So you need to add this one to your device tree file as well (and I think our SDK documentation example could be more complete in this regard...).

    To do this you can either create a new custom SPI pinmux configuration using our SYSCONFIG tool (https://www.ti.com/tool/SYSCONFIG), or use something already existing from another AM335x device tree files from the Kernel, like this one here:

    arch/arm/boot/dts/am335x-cm-t335.dts:   spi0_pins: pinmux_spi0_pins {
    arch/arm/boot/dts/am335x-cm-t335.dts-           pinctrl-single,pins = <
    arch/arm/boot/dts/am335x-cm-t335.dts:                   AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0)
    arch/arm/boot/dts/am335x-cm-t335.dts:                   AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT_PULLUP, MUX_MODE0)
    arch/arm/boot/dts/am335x-cm-t335.dts:                   AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0)
    arch/arm/boot/dts/am335x-cm-t335.dts:                   AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE0)
    arch/arm/boot/dts/am335x-cm-t335.dts:                   AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_OUTPUT, MUX_MODE0)
    arch/arm/boot/dts/am335x-cm-t335.dts-           >;
    arch/arm/boot/dts/am335x-cm-t335.dts-   };

    Regards, Andreas