How to configure the SPI to J13 pin for i.mx53

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

How to configure the SPI to J13 pin for i.mx53

762 Views
zerget
Contributor I

I have SPI device connect to J13 pin { EIM_D21(cspi sclk), EIM_D22(cspi MISO), EIM_D28(cspi MOSI), EIM_D29(cspi SS0) }.

When i use my driver send SPI data, i can't get the  pulse on the clk PIN.

My driver create a character device use "spi_write_then_read()" function send data, the return value is 0.

I set cspi on mx53_loco.c

static struct mxc_spi_master mxcspi1_data = {

  .maxchipselect = 4,

  .spi_version = 23,

};

static struct spi_board_info touch_device[] __initdata = {

  {

  .modalias = "sis_spi",

  .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */

  .bus_num = 1,

  .chip_select = 1,

  .platform_data = &mxc_spi_flash_data[0],},

};

static void __init mxc_board_init(void)

{

   ...

   mxc_register_device(&mxcspi1_device, &mxcspi1_data);

  

   spi_register_board_info(touch_device,  ARRAY_SIZE(touch_device));

}

devices.c

static struct resource mxcspi1_resources[] = {

  {

  .start = CSPI1_BASE_ADDR,

  .end = CSPI1_BASE_ADDR + SZ_4K - 1,

  .flags = IORESOURCE_MEM,

  },

  {

  .start = MXC_INT_CSPI1,

  .end = MXC_INT_CSPI1,

  .flags = IORESOURCE_IRQ,

  },

  {

  .start = MXC_DMA_CSPI1_TX,

  .end = MXC_DMA_CSPI1_TX,

  .flags = IORESOURCE_DMA,

  },

};

static u64 spi_dma_mask = DMA_BIT_MASK(32);

struct platform_device mxcspi1_device = {

  .name = "mxc_spi",

  .id = 0,

  .num_resources = ARRAY_SIZE(mxcspi1_resources),

  .resource = mxcspi1_resources,

  .dev = {

  .dma_mask = &spi_dma_mask,

  .coherent_dma_mask = DMA_BIT_MASK(32),

  },

};

If i didn't set IOMUX in mx53_loco_pads[] struct, cspi clk keep HIGH.

if i set "MX53_PAD_EIM_D21__CSPI_SCLK, MX53_PAD_EIM_D22__CSPI_MISO, MX53_PAD_EIM_D28__CSPI_MOSI, MX53_PAD_EIM_D29__CSPI_SS0" in mx53_loco_pads[], cspi clk keep LOW.

I check my driver, it probe success. So i can "echo" to device.When use "spi_write_then_read()" function it call "mxc_spi_transfer()"(mxc_spi.c) and return 0, but can't get pulse on the clk PIN.

How can i do for work?

Labels (1)
Tags (2)
0 Kudos
1 Reply

478 Views
AnsonHuang
NXP Employee
NXP Employee

Hi,Zerget

     Can you check the CCM_CCGRx register for this cspi clock, maybe you didn't enable its clock.