spidev on MX28_EVK L2.6.35_10_12 Testing

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

spidev on MX28_EVK L2.6.35_10_12 Testing

1,150 Views
Royaz
Contributor I

1. I am trying to support spidev device on my evk.

2. I have followed the instructions in the following link.

http://forums.freescale.com/t5/i-MX-Microprocessors/How-to-use-SPI-driver-when-I-use-i-mx28evk/m-p/6... 

a. CONFIG_SPI_MXS in kernel menuconfig

b. adding te following to spi_board_info spi_board_info[] in mx28evk.c file:


static struct mxs_spi_platform_data mx28evk_spi_data =
{
  .hw_pin_init    = mx28evk_spi_pin_init,
  .hw_pin_release = mx28evk_spi_pin_release,
};


#if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)
  {
    .modalias       = "spidev",
    .max_speed_hz   = 2000000,  // 2 MHz
    .bus_num        = 1,
    .chip_select    = 0,
    .platform_data  = &mx28evk_spi_data
  },

c. adding the following declaration in mx28evk.h:
extern int mx28evk_spi_pin_init(void);
extern int mx28evk_spi_pin_release(void);

 d. adding the implementation of these functions in mx28evk_pins.c:
static void mx28evk_release_pin_group(struct pin_desc *pins, unsigned count)
{
  int              i;
  struct pin_desc *pin;
  for(i = 0; i < count; i++)
  {
    pin = &pins[i];
    if(pin->fun == PIN_GPIO)
      gpio_free(MXS_PIN_TO_GPIO(pin->id));
    else
      mxs_release_pin(pin->id, pin->name);
  }
}
int mx28evk_spi_pin_init(void)
{
  #if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)
  mx28evk_init_pin_group(mx28evk_spi_pins, ARRAY_SIZE(mx28evk_spi_pins));
  #endif
  return 0;
}
int mx28evk_spi_pin_release(void)
{
  #if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)
  mx28evk_release_pin_group(mx28evk_spi_pins, ARRAY_SIZE(mx28evk_spi_pins));
  #endif
  return 0;
}


e. when the system is loading the kernel I see in the debug terminal the following + /dev/spidev1.0 is created in the file system.
mxs-spi mxs-spi.0: Max possible speed 24000 = 24000000/2 kHz
mxs-spi mxs-spi.0: at 0x80014000 mapped to 0xF0014000, irq=84, bus 1, DMA ver_major 4


f. I have compiled the spidev_test: and tried to run it on target (noting is connected to J89/U49) see the results below:
#  /home$ ./spidev_test -D /dev/spidev1.0
speed 50000 delay 0 bits 8 mode 0
spi mode: 0
bits per word: 8
max speed: 50000 Hz (50 KHz)
can't send spi message: Invalid argument
Aborted

I do not understand what is the origin of the problem. what argument is invalid ?
can someone direct me what else I need to check/todo software or hardware wise.
how can I enable debug messages for the spidev driver ?
CONFIG_SPI_DEBUG is not supported in this kernel.

Thanks,

Roy 
Labels (1)
0 Kudos
Reply
1 Reply

687 Views
Royaz
Contributor I

found out spidev_test is doing the problem.

I found another small sample that is working fine:

http://hi.baidu.com/gaomanyi/blog/item/ed070c17fb6dde054b90a78b.html

Good Luck!!! 

0 Kudos
Reply