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.

Linux/BEAGLEBOARD-X15: SPI flash not detected

Part Number: BEAGLEBOARD-X15
Other Parts Discussed in Thread: AM5728, DRA742

Tool/software: Linux

Hi,

I’m trying to communicate with a SPI flash by SPI4 bus on BeagleBoard X15 with embedded am5728.

SPI flash is plugged on these pins:

SPI4_CLK -> P16.09

SPI4_CS0 -> P16.44

SPI4_D0 -> P16.37

SPI4_D1 -> P16.14

I edited Linux device tree located in ti-processor-sdk-linux-am57xx-evm-05.01.00.11/board-support/linux-4.14.67/arch/arm/boot/dts and then I re-built Linux kernel.

Unfortunately, flash module isn’t visible by Linux. What’s the procedure to follow? Is there another file to edit?

Furthermore, I would like to boot on this SPI flash from u-boot. Any idea?

Thank you very much,

  • Hi,

    Please post your pinmux and device tree settings.
  • Here is my am57xx-beagle-x15.dts file.

    spi4_pins: pinmux_spi4_pins {
    pinctrl-single,pins = <
    0x1460 (PIN_OUTPUT | MANUAL_MODE | MUX_MODE8)
    0x1464 (PIN_INPUT | MANUAL_MODE | MUX_MODE8)
    0x1468 (PIN_OUTPUT | MANUAL_MODE | MUX_MODE8)
    0x146C (PIN_OUTPUT | MANUAL_MODE | MUX_MODE8)
    >;
    };

    &spi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi4_pins>;
    status = "okay";
    spidev@4 {
    spi-max-frequency = <24000000>;
    reg = <0>;
    compatible = "spidev";
    };
    };
  • Mathias,

    AM57x SPI pinmux should be done in SPL, refer to the below e2e threads for details:

    e2e.ti.com/.../771905
    e2e.ti.com/.../661048

    Regards,
    Pavel
  • Biser and Pavel,

    Thank you for your answers.
    So if I understand, I have to edit mux_data.h and board.c from u-boot/board/ti/am57xx ?
    Then, re-build u-boot and I will be able to write data on SPI flash from u-boot (sf probe 4:0) ?

    Regards,
    Mathias
  • Mathias,

    To access SPI flash from u-boot, you need to make the pinmux in mux_data.h file and describe the SPI flash in DTS file (i.e. am57xx-beagle-x15.common.dtsi).

    For example you need to check below DTS files:

    am57xx-idk-common.dtsi - check how QSPI flash is described

    am335x-rut.dts and da850-evm.dts - check how SPI flash is described

    Regards,
    Pavel
  • Hi,

    I have an other question about the "sf probe" command in u-boot.

    I configured mux_data.h and am57xx-beagle-x15.common.dtsi as you told me.

    When I try to init a SPI com using sf probe 4:0 (mcspi4 and CS 0), u-boot returns the error : invalid bus 4 (-19).

    How can I configure the right SPI bus number ? Is it in am57xx-beagle-x15.common.dtsi ?

    Regards,

    Mathias
  • Mathias,

    Yes, you need to add mcspi4 in u-boot-2018.01/arch/arm/dts/am57xx-beagle-x15-common.dtsi file

    Regards,
    Pavel

  • Pavel,

    I did it but sf probe 4:0 always fails. Have you got any other idea ?

    Thank you.

    Regards,

    Mathias

  • Here is my definition :

    mcspi4_pins: pinmux_mcspi4_pins {
        pinctrl-single,pins = <
          0x1460 (PIN_INPUT_PULLDOWN | MUX_MODE8)    /* spi0_sclk.spi0_sclk */
          0x1468 (PIN_INPUT_PULLUP | MUX_MODE8)    /* spi0_d0.spi0_d0 */
          0x1464 (PIN_INPUT_PULLDOWN | MUX_MODE8)    /* spi0_d1.spi0_d1 */
          0x146C (PIN_INPUT_PULLUP | MUX_MODE8)    /* spi0_CS0.spi0_CS0 */
        >;
      };

    &mcspi4 {
      pinctrl-names = "default";
      pinctrl-0 = <&mcspi4_pins>;
      status = "okay";
      spidev@4 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "ti,am572x-beagle-x15", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7";
        reg = <0>; /* Chip select 0 */
        spi-max-frequency = <24000000>;
      };
    };

  • Mathias Hanna said:
    mcspi4_pins: pinmux_mcspi4_pins {
        pinctrl-single,pins = <
          0x1460 (PIN_INPUT_PULLDOWN | MUX_MODE8)    /* spi0_sclk.spi0_sclk */
          0x1468 (PIN_INPUT_PULLUP | MUX_MODE8)    /* spi0_d0.spi0_d0 */
          0x1464 (PIN_INPUT_PULLDOWN | MUX_MODE8)    /* spi0_d1.spi0_d1 */
          0x146C (PIN_INPUT_PULLUP | MUX_MODE8)    /* spi0_CS0.spi0_CS0 */
        >;

    McSPI4 pinmux should be done in mux_data.h file, not in DTS file

    Mathias Hanna said:
    &mcspi4 {
      pinctrl-names = "default";
      pinctrl-0 = <&mcspi4_pins>;
      status = "okay";
      spidev@4 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "ti,am572x-beagle-x15", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7";
        reg = <0>; /* Chip select 0 */
        spi-max-frequency = <24000000>;
      };
    };

    This doesn't look correct for SPI flash. For SPI flash example you need to check below DTS files and align to these:



    am57xx-idk-common.dtsi - check how QSPI flash is described

    am335x-rut.dts and da850-evm.dts - check how SPI flash is described

    Regards,
    Pavel