Board: DM368, DVSDK4.02, kernel 2.6.32
I have following problem, which is illustrated in the waveform below, I am trying to write 16bits address followed by 16bits value.
The CS goes high before the value is written, the value didn't show up on SDO either.
Here's the code in dm365.c
static u64 dm365_spi1_dma_mask = DMA_BIT_MASK(32);
static struct davinci_spi_platform_data dm365_spi1_pdata = {
.version = SPI_VERSION_1,
.num_chipselect = 1,
.clk_internal = 1,
.cs_hold = 1,
.intr_level = 0,
.poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */
.use_dma = 0, /* when 1, value in poll_mode is ignored */
.c2tdelay = 0,
.t2cdelay = 0,
};
static struct resource dm365_spi1_resources[] = {
{
.start = 0x01c66800,
.end = 0x01c66fff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_DM365_SPIINT0_0,
.flags = IORESOURCE_IRQ,
},
{
.start = EDMA_CHANNEL_ANY,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
},
{
.start = EDMA_CHANNEL_ANY,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
},
{
.start = EVENTQ_3,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
},
};
static struct platform_device dm365_spi1_device = {
.name = "spi_davinci",
.id = 1,
.dev = {
.dma_mask = &dm365_spi1_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &dm365_spi1_pdata,
},
.num_resources = ARRAY_SIZE(dm365_spi1_resources),
.resource = dm365_spi1_resources,
};
void __init dm365_init_spi1(unsigned chipselect_mask,
struct spi_board_info *info, unsigned len)
{
davinci_cfg_reg(DM365_SPI1_SCLK);
davinci_cfg_reg(DM365_SPI1_SDI);
davinci_cfg_reg(DM365_SPI1_SDO);
davinci_cfg_reg(DM365_SPI1_SDENA0);
spi_register_board_info(info, len);
platform_device_register(&dm365_spi1_device);
}
Code in board_dm365_evm.c
static struct spi_board_info dm365_evm_spi_info[]={
{
.modalias="spidev",
.max_speed_hz=25*1000*1000,
.bus_num=1,
.chip_select=0,
.mode=SPI_MODE_0,
.bits_per_word=16,
},
};
dm365_init_spi1(1,dm365_evm_spi_info,ARRAY_SIZE(dm365_evm_spi_info));
Please help!