<font size=2 face="sans-serif">ok tried it like this:</font>
<br>
<br><font size=2 color=#820040 face="Sans"><b>#define</b></font><font size=2 face="Sans">
ECUv6_ECSPI1_CS0 IMX_GPIO_NR(2, 30)</font>
<br><font size=2 color=#820040 face="Sans"><b>#define</b></font><font size=2 face="Sans">
ECUv6_ECSPI1_CS1 IMX_GPIO_NR(3, 19)</font>
<br>
<br><font size=2 color=#3f8080 face="Sans">//SPI + NOR FLASH</font>
<br><font size=2 color=#820040 face="Sans"><b>const</b></font><font size=2 face="Sans">
</font><font size=2 color=#820040 face="Sans"><b>struct</b></font><font size=2 face="Sans">
flash_platform_data tx53_flash = {</font>
<br><font size=2 face="Sans"> .</font><font size=2 color=#0021bf face="Sans">type</font><font size=2 face="Sans">
= </font><font size=2 color=#4200ff face="Sans">"mx25l8005"</font><font size=2 face="Sans">,</font>
<br><font size=2 face="Sans"> .</font><font size=2 color=#0021bf face="Sans">name</font><font size=2 face="Sans">
= </font><font size=2 color=#4200ff face="Sans">"spi_flash"</font><font size=2 face="Sans">,</font>
<br><font size=2 face="Sans">};</font>
<br>
<br>
<br><font size=2 color=#3f8080 face="Sans">//MX25L8005MC-15G</font>
<br><font size=2 color=#820040 face="Sans"><b>static</b></font><font size=2 face="Sans">
</font><font size=2 color=#820040 face="Sans"><b>const</b></font><font size=2 face="Sans">
</font><font size=2 color=#820040 face="Sans"><b>struct</b></font><font size=2 face="Sans">
spi_board_info mx53_spi_board_info[] = {</font>
<br><font size=2 face="Sans"> {</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">name</font><font size=2 face="Sans">
= </font><font size=2 color=#4200ff face="Sans">"m25p"</font><font size=2 face="Sans">,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">max_speed_hz</font><font size=2 face="Sans">
= 30000000,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">bus_num</font><font size=2 face="Sans">
= 0,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">chip_select</font><font size=2 face="Sans">
= 0,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">bits_per_word</font><font size=2 face="Sans">
= 8,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">mode</font><font size=2 face="Sans">
= SPI_MODE_0,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">platform_data</font><font size=2 face="Sans">
= &tx53_flash,</font>
<br><font size=2 face="Sans"> },</font>
<br><font size=2 face="Sans">};</font>
<br>
<br><font size=2 color=#820040 face="Sans"><b>static</b></font><font size=2 face="Sans">
</font><font size=2 color=#820040 face="Sans"><b>int</b></font><font size=2 face="Sans">
ecspi_0_cs[] = { ECUv6_ECSPI1_CS0,ECUv6_ECSPI1_CS1 };</font>
<br>
<br>
<br><font size=2 color=#820040 face="Sans"><b>static</b></font><font size=2 face="Sans">
</font><font size=2 color=#820040 face="Sans"><b>struct</b></font><font size=2 face="Sans">
spi_imx_master tx53_spi = {</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">chipselect</font><font size=2 face="Sans">
= ecspi_0_cs,</font>
<br><font size=2 face="Sans">
.</font><font size=2 color=#0021bf face="Sans">num_chipselect</font><font size=2 face="Sans">
= ARRAY_SIZE(ecspi_0_cs),</font>
<br><font size=2 face="Sans">};</font>
<br>
<br>
<br><font size=2 face="sans-serif">answer from spi eeprom is unknown: </font>
<br><font size=2 face="sans-serif">m25p@m25p0: unrecognized JEDEC id ffffff</font>
<br>
<br><font size=2 face="sans-serif">Hasn't anyone used an SPI Flash with
the imx53 yet?</font>
<br>
<br><font size=2 face="sans-serif">christian</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">Von:
</font><font size=1 face="sans-serif">Franck Jullien <franck.jullien@gmail.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">An:
</font><font size=1 face="sans-serif">christian.buettner@rafi.de,
</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Kopie:
</font><font size=1 face="sans-serif">barebox@lists.infradead.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Datum:
</font><font size=1 face="sans-serif">30.07.2012 16:28</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Betreff:
</font><font size=1 face="sans-serif">Re: Re: Re:
Re: nor flash board init code</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>2012/7/30 <christian.buettner@rafi.de>:<br>
> i always get the response:<br>
><br>
> m25p@m25p0: unrecognized JEDEC id ffffff<br>
><br>
> SPI Flah:MX25L8005MC-15G<br>
> CPU: imx53<br>
><br>
> Here is my board init code:<br>
><br>
> //SPI + FLASH structs<br>
> const struct flash_platform_data tx53_flash = {<br>
> .type = "mx25l8005",<br>
> .name = "spi_flash",<br>
> };<br>
><br>
><br>
> //MX25L8005MC-15G<br>
> static const struct spi_board_info mx53_spi_board_info[] = {<br>
> {<br>
> .name = "m25p",<br>
> .max_speed_hz
= 30000000,<br>
> .bus_num =
0,<br>
> .chip_select
= 0,<br>
> .bits_per_word
= 8,<br>
> .mode = SPI_MODE_0,<br>
> .platform_data
= &tx53_flash,<br>
> },<br>
> };<br>
><br>
> static struct spi_imx_master tx53_spi = {<br>
> .num_chipselect
= 1,<br>
> };<br>
><br>
<br>
I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board<br>
file one can read:<br>
<br>
static struct spi_imx_master tx51_spi_0_data = {<br>
.chipselect = spi_0_cs,<br>
.num_chipselect = ARRAY_SIZE(spi_0_cs),<br>
};<br>
<br>
#define CCXMX51_ECSPI1_CS0
IMX_GPIO_NR(4, 24)<br>
#define CCXMX51_ECSPI1_CS1
IMX_GPIO_NR(4, 25)<br>
<br>
static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };<br>
<br>
static struct spi_imx_master ecspi_0_data = {<br>
.chipselect
= ecspi_0_cs,<br>
.num_chipselect
= ARRAY_SIZE(ecspi_0_cs),<br>
};<br>
<br>
Don't you need to set .chipselect ?<br>
<br>
<br>
><br>
><br>
> //PIN MUX:<br>
> MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO<br>
> MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI<br>
> MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK<br>
> MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS<br>
><br>
><br>
> //device init code:<br>
> spi_register_board_info(mx53_spi_board_info,<br>
>
ARRAY_SIZE(mx53_spi_board_info));<br>
><br>
> imx53_add_spi0(&tx53_spi);<br>
><br>
><br>
> Any ideas, whats wrong?<br>
><br>
> christian<br>
><br>
><br>
> Von: Franck Jullien <franck.jullien@gmail.com><br>
> An: christian.buettner@rafi.de,<br>
> Kopie: barebox@lists.infradead.org<br>
> Datum: 30.07.2012 10:33<br>
> Betreff: Re: Re: Re: nor flash board init
code<br>
> ________________________________<br>
><br>
><br>
><br>
> 2012/7/30 <christian.buettner@rafi.de>:<br>
>> Whooosch and it worked!<br>
>><br>
>> devinfo<br>
>> devices:<br>
>> ...<br>
>> `---- mem1<br>
>> `---- 0x00000000-0xfffffffe: /dev/mem<br>
>> `---- i2c-imx2<br>
>> `---- imx_spi0<br>
>> `---- m25p0<br>
>> `---- fec_imx0<br>
>> `---- miidev0<br>
>> ...<br>
>><br>
>> barebox:/ devinfo m25p0<br>
>> resources:<br>
>> driver: none<br>
>><br>
>> no parameters available<br>
>> barebox:/<br>
>><br>
>> But why is driver in devinfo = none?<br>
>><br>
><br>
> It used to work. You need to find why it doesn't work anymore ;)<br>
><br>
>> christian<br>
>><br>
>><br>
>> Von: Franck Jullien <franck.jullien@gmail.com><br>
>> An: christian.buettner@rafi.de,<br>
>> Kopie: barebox@lists.infradead.org<br>
>> Datum: 30.07.2012 10:07<br>
>> Betreff: Re: Re: nor flash board init
code<br>
>> ________________________________<br>
>><br>
>><br>
>><br>
>> Hi,<br>
>><br>
>> 2012/7/30 <christian.buettner@rafi.de><br>
>>><br>
>>> Thanks for the code!<br>
>>><br>
>>> Here is my approach:<br>
>>><br>
>>> const struct flash_platform_data tx53_flash = {<br>
>>> .type = "mx25l8005",<br>
>>> .name = "spi_flash",<br>
>>> };<br>
>>><br>
>>><br>
>>> //MX25L8005MC-15G<br>
>>> static const struct spi_board_info mx53_spi_board_info[] =
{<br>
>>> {<br>
>>> .name
= "mx25l8005",<br>
>><br>
>><br>
>> Here sould be the driver name: .name = "m25p",<br>
>><br>
>>><br>
>>> .max_speed_hz
= 70000000,<br>
>>> .bus_num
= 0,<br>
>>> .chip_select
= 0,<br>
>>> .bits_per_word
= 8,<br>
>>> .mode
= SPI_MODE_0,<br>
>>> .platform_data
= &tx53_flash,<br>
>>> },<br>
>>> };<br>
>>><br>
>>> static struct spi_imx_master tx53_spi = {<br>
>>> .num_chipselect
= 1,<br>
>>> };<br>
>>><br>
>>><br>
>>> init_devices {<br>
>>><br>
>>> ...<br>
>>> spi_register_board_info(mx53_spi_board_info,<br>
>>>
ARRAY_SIZE(mx53_spi_board_info));<br>
>>><br>
>>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64
*<br>
>>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);<br>
>><br>
>> You have to add the SPI master device here. The m25p device will
be<br>
>> probed automagically (AFAIR).<br>
>><br>
>><br>
>>><br>
>>> ...<br>
>>> }<br>
>>><br>
>>><br>
>>> When the m25p80.c driver probes i get no spi instance:<br>
>>><br>
>>> static int m25p_probe(struct device_d *dev) {<br>
>>> struct spi_device *spi = (struct
spi_device *)dev->type_data;<br>
>>> const struct spi_device_id
*id = NULL;<br>
>>> ...<br>
>>> }<br>
>>><br>
>>> struct spi_device *spi is always null<br>
>>><br>
>>> Whats wrong here?<br>
>>><br>
>>> christian<br>
>>><br>
>>><br>
>>><br>
>>> Von: Franck Jullien <franck.jullien@gmail.com><br>
>>> An: christian.buettner@rafi.de,<br>
>>> Kopie: barebox@lists.infradead.org<br>
>>> Datum: 27.07.2012 13:33<br>
>>> Betreff: Re: nor flash board init
code<br>
>>> ________________________________<br>
>>><br>
>>><br>
>>><br>
>>> 2012/7/25 <christian.buettner@rafi.de><br>
>>> ><br>
>>> > hi all,<br>
>>> > is there any example board init code to load the mx25l8005
spi<br>
>>> > nor-flash<br>
>>> > through the imx53 (TX53 from KARO)?<br>
>>> > I want to use the m25p80 driver to read and write.<br>
>>> ><br>
>>> > christian<br>
>>> > _______________________________________________<br>
>>> > barebox mailing list<br>
>>> > barebox@lists.infradead.org<br>
>>> > </font></tt><a href=http://lists.infradead.org/mailman/listinfo/barebox><tt><font size=2>http://lists.infradead.org/mailman/listinfo/barebox</font></tt></a><tt><font size=2><br>
>>> ><br>
>>><br>
>>> Hi Christian,<br>
>>><br>
>>> This is what I use with the Altera SPI controller + an SPI
flash device:<br>
>>><br>
>>><br>
>>><br>
>>> </font></tt><a href="http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153"><tt><font size=2>http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153</font></tt></a><tt><font size=2><br>
>>><br>
>>> static struct spi_altera_master altera_spi_0_data = {<br>
>>> .num_chipselect = 1,<br>
>>> .spi_mode = 0, /*
SPI mode of the EPCS flash controller */<br>
>>> .databits = 8, /*
Data length of the EPCS flash controller */<br>
>>> .speed = 20000000, /* EPCS flash
controller speed */<br>
>>> };<br>
>>><br>
>>><br>
>>> static struct flash_platform_data epcs_flash = {<br>
>>> .name = "epcs", /*
Cdev name, optional */<br>
>>> .type = "m25p40", /* Device
type, required for non JEDEC chips */<br>
>>> };<br>
>>><br>
>>> static struct spi_board_info generic_spi_board_info[] = {<br>
>>> {<br>
>>> .name = "m25p",<br>
>>> .max_speed_hz = 20000000,<br>
>>> .bus_num = 0,<br>
>>> .chip_select = 0,<br>
>>> .bits_per_word =
8,<br>
>>> .mode = SPI_MODE_0,<br>
>>> .platform_data =
&epcs_flash,<br>
>>> }<br>
>>> };<br>
>>><br>
>>> static int myboard_devices_init(void) {<br>
>>><br>
>>> ...<br>
>>><br>
>>> spi_register_board_info(myboard_spi_board_info,<br>
>>> ARRAY_SIZE(myboard_spi_board_info));<br>
>>><br>
>>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE,
0x18,<br>
>>>
IORESOURCE_MEM, &altera_spi_0_data);<br>
>>><br>
>>> ...<br>
>>><br>
>>> Franck.<br>
>>><br>
>><br>
>> Franck.<br>
>><br>
><br>
<br>
Do you have a scope ? This is the easiest way to debug SPI ;)<br>
</font></tt>
<br>