Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

OMAP-L137/da830 ,How to use spi0 for spidev

$
0
0

I want to use the spi0 for spidev, but when i modify /arch/arm//mach-da8xx. I can find /dev/spi0.0  ,it can not use  

what i do is this ,but it is wrong ? who can help me and tell me why? thank you

static struct davinci_spi_platform_data da8xx_spi_pdata0 = {
.version = DAVINCI_SPI_VERSION_2,
.num_chipselect = 1,
.clk_name = "SPI0CLK",
//.chip_sel = da8xx_spi0_chip_sel,
};

static struct resource da8xx_spi_resources0[] = {
[0] = {
.start = DA8XX_SPI0_BASE,
.end = DA8XX_SPI0_BASE + 0xfff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_DA8XX_SPINT0,
.end = IRQ_DA8XX_SPINT0,
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = DA8XX_DMACH_SPI0_RX,
.end = DA8XX_DMACH_SPI0_RX,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
},
[3] = {
.start = DA8XX_DMACH_SPI0_TX,
.end = DA8XX_DMACH_SPI0_TX,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
},
[4] = {
.start = EVENTQ_1,
.end = EVENTQ_1,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
},
};

static struct platform_device da8xx_spi_pdev0 = {
.name = "dm_spi",
.id = 0,
.resource = da8xx_spi_resources0,
.num_resources = ARRAY_SIZE(da8xx_spi_resources0),
.dev = {
.platform_data = &da8xx_spi_pdata0,
},
};

static struct spi_board_info da8xx_spi_board_info0[] = {
[0] = {
.modalias = "spidev",
//.platform_data = &w25x64_spi_flash,
//.controller_data = &w25x64_spi_cfg,
.mode = SPI_MODE_0,
.max_speed_hz = 30000000, /* max sample rate at 3V */
.bus_num = 0,
.chip_select = 0,
},

};
/*
* This function registers the SPI master platform device and the SPI slave
* devices with the SPI bus.
*/
static int __init da8xx_spi_register(struct platform_device *pdev,
struct spi_board_info *bi,
unsigned int bi_size)
{
int ret = platform_device_register(pdev);

if (ret)
return ret;

return spi_register_board_info(bi, bi_size);

}

static int __init da8xx_spi_board_init(void)
{

int ret = da8xx_spi_register(&da8xx_spi_pdev0, da8xx_spi_board_info0,
ARRAY_SIZE(da8xx_spi_board_info0));

if (ret)
return ret;
}

static void __exit da8xx_spi_board_exit(void)
{
/* nothing to be done */
}

module_init(da8xx_spi_board_init);
module_exit(da8xx_spi_board_exit);


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>