Em quinta-feira, 23 de janeiro de 2014 13h59min19s UTC-3, vinic...@gmail.com escreveu: > Em terça-feira, 21 de janeiro de 2014 08h44min19s UTC-3, Tomas Novotny > escreveu: > > > Hi All, > > > > > > > > > > > > I'm trying to use some SPI devices on A10s OLinuXino. It was flawless for > > > > > > simple MCU driven by spidev (everything needed is defined in FEX). Now I'm > > > > > > trying to connect external CAN over SPI (MCP2515). > > > > > > The mcp251x driver needs to pass oscillator frequency through the > > > > > > mcp251x_platform_data structure. Is there any clean way how to do it on 3.4 > > > > > > linux-sunxi? It seems that platform data for SPI board aren't passed by > > sunxi > > > > > > SPI driver. > > > > > > I'm using Debian image with custom built 3.4.61 linux-sunxi. > > > > > > Thanks to all, > > > > > > > > > > > > Tomas > > > > You can change by yourself spi_sunxi.c, something like that: > > > > diff --git a/drivers/spi/spi_sunxi.c b/drivers/spi/spi_sunxi.c > > index a3792fd..2f0ab7c 100644 > > --- a/drivers/spi/spi_sunxi.c > > +++ b/drivers/spi/spi_sunxi.c > > @@ -28,6 +28,7 @@ > > > > #include <linux/spi/spi.h> > > #include <linux/spi/spi_bitbang.h> > > +#include <linux/can/platform/mcp251x.h> > > > > #include <asm/io.h> > > #include <plat/dma.h> > > @@ -134,6 +135,10 @@ struct sunxi_spi { > > int cs_bitmap;/* cs0- 0x1; cs1-0x2, cs0&cs1-0x3. */ > > }; > > > > +static struct mcp251x_platform_data mcp251x_info = { > > + .oscillator_frequency = 8000000, > > +}; > > +
Sorry, something like that: diff --git a/drivers/spi/spi_sunxi.c b/drivers/spi/spi_sunxi.c index a3792fd..2f0ab7c 100644 --- a/drivers/spi/spi_sunxi.c +++ b/drivers/spi/spi_sunxi.c @@ -28,6 +28,7 @@ #include <linux/spi/spi.h> #include <linux/spi/spi_bitbang.h> +#include <linux/can/platform/mcp251x.h> #include <asm/io.h> #include <plat/dma.h> @@ -134,6 +135,10 @@ struct sunxi_spi { int cs_bitmap;/* cs0- 0x1; cs1-0x2, cs0&cs1-0x3. */ }; +static struct mcp251x_platform_data mcp251x_info = { + .oscillator_frequency = 8000000, +}; + /* config chip select */ s32 aw_spi_set_cs(u32 chipselect, void *base_addr) { @@ -1922,6 +1927,7 @@ int __devinit spi_sunxi_register_spidev(void) { board = &spi_boards[i]; sprintf(spi_board_name, "spi_board%d", i); + board->platform_data = &mcp251x_info; ret = script_parser_fetch(spi_board_name, "modalias", (void*)board->modalias, sizeof(char*)); if(ret != SCRIPT_PARSER_OK) { spi_msg("Get spi devices modalias failed\n"); -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.