title: SPI device access using SPIDEV
body: <p>I want to access an SPI device (an optical mouse device from Avago Tech) on an embedded Linux system using the SPIDEV driver. The device is connected to SPI0.</p>
  
  <p>I enabled SPI and "User mode SPI device driver support" in menuconfig > "Device Drivers" > "SPI".</p>
  
  <p>I added the code to the board.c file</p>
  
  <pre><code>static struct spi_board_info spidev_board_info[] {
      {
          .modalias = "spidev",
          .max_speed_hz = 1000000,
          .bus_num = 1,
          .chips_select = 0,
          .mode = SPI_MODE_3,
      },
      {
          .modalias = "spidev",
          .max_speed_hz = 1000000,
          .bus_num = 1,
          .chips_select = 1,
          .mode = SPI_MODE_3,
      },
  };
  spi_register_board_info(spidev_board_info, ARRAY_SIZE(spidev_board_info));
  </code></pre>
  
  <p>I tried both 500000 and 1000000 as max_speed_hz (1Mhz being the highest allowed by the sensor). SPI_MODE_3 is correct, checked on the datasheet. bus_num = 1 should correct as it refers to SPI0 (I also tried = 0 out of curiosity).</p>
  
  <p>I checked the electrical connections and are all working.</p>
  
  <p>The kernel compiles and the image starts correctly, but I cannot find any device in /sys/class/spidev/ (neither in /sys/bus/spi/...). No reference to SPI appears during system boot either.</p>
  
  <p>Any idea on where the problem can be? </p>