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/dm388: How to enable SPI interface from device tree

Part Number: dm388


Tool/software: Linux

Hi

I want to control SPI serial flash that connected to spi0(cs0).

I try any possible method, and I referenced link(https://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/p/598118/2212223?tisearch=e2e-sitesearch&keymatch=dm38x%20spi0#pi317334=1


[ti81xx.dtsi]

aliases {
 serial0 = &uart1;
 ....................
 spi0 = &mcspi1;(or mcspi0 = &mcspi1;)
 spi0 = &mcspi2;(or mcspi0 = &mcspi2;)
}


 mcspi1: mcspi@30000 {
  compatible = "ti,omap4-mcspi";
  #address-cells = <1>;
  #size-cells = <0>;
  ti,hwmods = "mcspi1";
  ti,spi-num-cs = <4>;
  reg = <0x30000 0x1000>;
  interrupts = <65>;
  dmas = <&edma 16 &edma 17
   &edma 18 &edma 19
   &edma 20 &edma 21
   &edma 22 &edma 23>;
  dma-names = "tx0", "rx0", "tx1", "rx1",
   "tx2", "rx2", "tx3", "rx3";
  status = "disabled";
 };

 mcspi2: mcspi@1A0000 {
  compatible = "ti,omap4-mcspi";
  #address-cells = <1>;
  #size-cells = <0>;
  ti,hwmods = "mcspi2";
  ti,spi-num-cs = <2>;
  reg = <0x1A0000 0x1000>;
  interrupts = <125>;
  dmas = <&edma 42 &edma 43
   &edma 44 &edma 45>;
  dma-names = "tx0", "rx0",
   "tx1", "rx1";
  status = "disabled";
 };


[dm38x-csk.dts]

&mcspi1 {
 status = "okay";
 pinctrl-names = "default";
 pinctrl-0 = <&spi0_pins>;
 
 flash: m25p80@0 {
  #address-cells = <1>;
  #size-cells = <1>;
  compatible = "spansion,m25p80";
  spi-max-frequency = <48000000>;
  reg = <0>;

  partition@0 {
   label = "NOR.env1";
   reg = <0x0A0000 0x010000>;
  };

  partition@1 {
   label = "NOR.env2";
   reg = <0x0B0000 0x010000>;
  };
 };
};

&mcspi2 { /* 180117 cavo */
 pinctrl-names = "default";
 pinctrl-0 = <&spi1_pins>;
 status = "okay";
};

Thanks.