Enabling SPI for MPC8377E ( DTS / mpc837x.c configuration )

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling SPI for MPC8377E ( DTS / mpc837x.c configuration )

1,003 Views
amesen
Contributor I

My company has been using the MPC8377E freescale boards for a couple years now as the brains for one of our products.

Recently, we decided to consolidate part of the manufacturing process by writing to a spi NOR flash (AT25DF041A-SSHF-B) directly from the 8377.

This wasn't unexpected, and our boards have been built all along with the spi CLK/MOSI/MISO/SS pins tied directly to the spi NOR flash. This flash is the only slave on the net, i.e. Single Master - Single Slave.

I've spent a couple weeks modifying the DTS and board file with some luck, but I have yet to successfully communicate with the flash. At best, I can get a device to show up at /dev/spidev32766.

Driver-wise, I have

     CONFIG_SPI=y

     CONFIG_SPI_DEBUG=y

     CONFIG_SPI_MASTER=y

     CONFIG_SPI_FSL_LIB=y

     CONFIG_SPI_FSL_SPI=y

     CONFIGI_SPIDEV=y

I do have the documentation for the flash, and I've been using the proper spi_mode (0 or 3) and opcodes, so that's not the issue.

Below is the DTS- this is the current configuration, though I've tried a few others.

DTS, relevant section:

     spi@7000 {

         #address-cells= <1>;

         size-cells=<0>;

         cell-index = <0>;

         compatible = "fsl,spi";

         reg = <0x7000 0x1000>;

         interrupts = <16 0x8>;

         interrupt-parent = <&ipic>;

         mode = "cpu";

         eth_spi@0{

             compatible = "spidev";

             reg = <0>;

             spi-max-frequency = <10000000>;

         };   

};

Current Board file, though I've tried a few other varieties:

===================================

static struct spi_board_info mpc8377hbm_spi_devices[] = {

  {

  .modalias = "spidev"

  ,.max_speed_hz = 10 * 1000 * 1000 //10 Mbps

  ,.bus_num = 0 //I've also tried 1 and 0x7000

  ,.chip_select = 0

  ,.mode = SPI_MODE_0

  },

};

static int spi_board_init( void )

{

  int spi_board_array_size = 1;//ARRAY_SIZE( mpc8377hbm_spi_devices );

  int final_spi_value = spi_register_board_info( mpc8377hbm_spi_devices , spi_board_array_size );

  printk( "____NOTICE: Number of SPI devices to register: %d , Spi register board value: %d" , spi_board_array_size , final_spi_value );

  return final_spi_value;

}

machine_device_initcall( mpc837x_rdb , spi_board_init );

=======================================

I've included full versions of both files if anyone's curious.

Any help at this point would be greatly appreciated, I'm getting tired of rebuilding the kernel over and over again.

Thanks much!

Tags (3)
0 Kudos
0 Replies