title: U-Boot 2020.04: Probing SPI flash fails - Invalid bus 0 (err=-19)
body: <p>I'm just compiled <strong>U-Boot 2020.04</strong> for a <strong>PINE64 ROCK64</strong> media board. It compiles fine without errors. But I run into an issue when I try to probe the SPI flash.</p>
  
  <p>The output from U-Boot command line:</p>
  
  <pre><code>=&gt; sf probe
  Invalid bus 0 (err=-19)
  Failed to initialize SPI flash at 0:0 (error -19)
  =&gt;
  </code></pre>
  
  <p>The Device-Tree SPI section from the board:</p>
  
  <pre><code>&amp;spi0 {
      status = "okay";
  
      spiflash@0 {
          compatible = "jedec,spi-nor";
          reg = &lt;0&gt;;
  
          /* maximum speed for Rockchip SPI */
          spi-max-frequency = &lt;50000000&gt;;
      };
  };
  </code></pre>
  
  <p>I also tried different buses and chip selects. But didn't work.
  According to the schematic from the board, the SPI flash device <strong>GD25Q128CS</strong> is used.</p>
  
  <p>How I compiled the sources:</p>
  
  <pre><code>$ make rock64-rk3328_defconfig
  $ make CROSS_COMPILE=/path/to/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf- -j 4
  </code></pre>
  
  <p>I have used the official <strong>GCC</strong> port from the <a href="https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads" rel="nofollow noreferrer">ARM website</a>.</p>
  
  <p>Tried also an older and a newer versions of U-Boot. Same issue. I flashed the microSD card according to the U-Boot documentation:</p>
  
  <pre><code>$ dd if=idbloader.img of=/dev/mmcblk0 seek=64
  $ dd if=u-boot.itb of=/dev/mmcblk0 seek=16384
  </code></pre>
  
  <p>How can I narrow down this issue? Something missing?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Seems U-Boot doesn't load the SPI driver from the board:</p>
  
  <pre><code>=&gt; dm tree    
   [...]
    spi           0  [   ]   rockchip_spi          |-- spi@ff190000                                                        
    spi_flash     0  [   ]   spi_flash_std         |   `-- spiflash@0
   [...]
  =&gt;
  </code></pre>
  
  <p><em>What I have also tried:</em></p>
  
  <p>I have added the following configuration to the board file:</p>
  
  <pre><code>CONFIG_ROCKCHIP_SPI=y
  CONFIG_SPI_FLASH=y
  CONFIG_SPI_FLASH_GIGADEVICE=y
  </code></pre>
  
  <p>In the <a href="https://github.com/u-boot/u-boot/blob/master/drivers/spi/rk_spi.c" rel="nofollow noreferrer">driver file</a> I have tried to put a simple <code>printf()</code> at the beginning of the function <code>rockchip_spi_probe()</code>. I also added a compatible identifier (same string as in the Device-Tree) in the driver. But unfortunately the probe function never get called. </p>
  
  <p>I'm a newbie with U-Boot. Any kind of help is highly appreciated.</p>