<font size=2 face="sans-serif">Thanks for the code!</font>
<br>
<br><font size=2 face="sans-serif">Here is my approach:</font>
<br>
<br><font size=2 face="sans-serif">const struct flash_platform_data tx53_flash
= {</font>
<br><font size=2 face="sans-serif"> .type
= "mx25l8005",</font>
<br><font size=2 face="sans-serif"> .name
= "spi_flash",</font>
<br><font size=2 face="sans-serif">};</font>
<br>
<br>
<br><font size=2 face="sans-serif">//MX25L8005MC-15G</font>
<br><font size=2 face="sans-serif">static const struct spi_board_info mx53_spi_board_info[]
= {</font>
<br><font size=2 face="sans-serif"> {</font>
<br><font size=2 face="sans-serif">
.name = "mx25l8005",</font>
<br><font size=2 face="sans-serif">
.max_speed_hz = 70000000,</font>
<br><font size=2 face="sans-serif">
.bus_num = 0,</font>
<br><font size=2 face="sans-serif">
.chip_select = 0,</font>
<br><font size=2 face="sans-serif">
.bits_per_word = 8,</font>
<br><font size=2 face="sans-serif">
.mode = SPI_MODE_0,</font>
<br><font size=2 face="sans-serif">
.platform_data = &tx53_flash,</font>
<br><font size=2 face="sans-serif"> },</font>
<br><font size=2 face="sans-serif">};</font>
<br>
<br><font size=2 face="sans-serif">static struct spi_imx_master tx53_spi
= {</font>
<br><font size=2 face="sans-serif">
.num_chipselect = 1,</font>
<br><font size=2 face="sans-serif">};</font>
<br>
<br>
<br><font size=2 face="sans-serif">init_devices {</font>
<br>
<br><font size=2 face="sans-serif">...</font>
<br><font size=2 face="sans-serif"> spi_register_board_info(mx53_spi_board_info,</font>
<br><font size=2 face="sans-serif">
ARRAY_SIZE(mx53_spi_board_info));</font>
<br>
<br><font size=2 face="sans-serif"> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64
* 1024,IORESOURCE_MEM,&mx53_spi_board_info);</font>
<br>
<br><font size=2 face="sans-serif">...</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br>
<br><font size=2 face="sans-serif">When the m25p80.c driver probes i get
no spi instance:</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">
<b>m25p_probe</b>(</font><font size=2 color=#820040 face="Sans"><b>struct</b></font><font size=2 face="Sans">
device_d *dev) {</font>
<br><font size=2 color=#820040 face="Sans"><b>
struct</b></font><font size=2 face="Sans"> spi_device *spi = (</font><font size=2 color=#820040 face="Sans"><b>struct</b></font><font size=2 face="Sans">
spi_device *)dev-></font><font size=2 color=#0021bf face="Sans">type_data</font><font size=2 face="Sans">;</font>
<br><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_device_id *id = NULL;</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>struct</b></font><font size=2 face="Sans">
spi_device *spi is always null</font>
<br>
<br><font size=2 face="Sans">Whats wrong here?</font>
<br>
<br><font size=2 face="Sans">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">27.07.2012 13:33</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Betreff:
</font><font size=1 face="sans-serif">Re: nor flash
board init code</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>2012/7/25 <christian.buettner@rafi.de><br>
><br>
> hi all,<br>
> is there any example board init code to load the mx25l8005 spi nor-flash
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>
</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>
</font></tt>
<br>