On Thu, 23 Jan 2014 19:11:32 +0100, Gustavo Zamboni
<gustavozamb...@gmail.com> wrote:

Hi Gustavo,

> Why dont you just add the device to the fex file ??
>
> activate your spix_para parameters
> 
> and add something like:
> 
> 
> |[spi_devices]|
> spi_dev_num=1
> 
> |[spi_board0]|
> |modalias| |= ||"|mcp251x|"|||
> |max_speed_hz| |= ||12000000|
> |bus_num| |= ||1|
> |chip_select| |= ||0|
> |mode| |= ||3|
> |full_duplex| |= ||0|
> |manual_cs| |= ||0|
> 
> 
> With spidev it works well with modalias "spidev".

yes, this is exactly what I did. I was trying both spidev and mcp251x. There
is no problem with spidev (it is currently working) but for mcp251x I need to
pass (very simple) platform data with oscillator frequency. The mcp251x is
being initialized during boot but it fails because of missing platform data.
        I don't know if there is some "clean" way how to pass platform data
of the mcp251x driver. I think that FEX is not able to do that (there is no
handling in sunxi spi).
Thanks for you answer,

Tomas

> Gustavo Zamboni
> 
> 
> 
> 
> Le 23/01/2014 18:03, vinicius...@gmail.com a écrit :
> > 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.

Reply via email to