* nor flash board init code
@ 2012-07-25 14:31 christian.buettner
2012-07-27 11:33 ` Franck Jullien
0 siblings, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-07-25 14:31 UTC (permalink / raw)
To: barebox
[-- Attachment #1.1: Type: text/plain, Size: 179 bytes --]
hi all,
is there any example board init code to load the mx25l8005 spi nor-flash
through the imx53 (TX53 from KARO)?
I want to use the m25p80 driver to read and write.
christian
[-- Attachment #1.2: Type: text/html, Size: 378 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: nor flash board init code
2012-07-25 14:31 nor flash board init code christian.buettner
@ 2012-07-27 11:33 ` Franck Jullien
2012-07-30 8:00 ` Antwort: " christian.buettner
0 siblings, 1 reply; 13+ messages in thread
From: Franck Jullien @ 2012-07-27 11:33 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
2012/7/25 <christian.buettner@rafi.de>
>
> hi all,
> is there any example board init code to load the mx25l8005 spi nor-flash through the imx53 (TX53 from KARO)?
> I want to use the m25p80 driver to read and write.
>
> christian
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
Hi Christian,
This is what I use with the Altera SPI controller + an SPI flash device:
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
static struct spi_altera_master altera_spi_0_data = {
.num_chipselect = 1,
.spi_mode = 0, /* SPI mode of the EPCS flash controller */
.databits = 8, /* Data length of the EPCS flash controller */
.speed = 20000000, /* EPCS flash controller speed */
};
static struct flash_platform_data epcs_flash = {
.name = "epcs", /* Cdev name, optional */
.type = "m25p40", /* Device type, required for non JEDEC chips */
};
static struct spi_board_info generic_spi_board_info[] = {
{
.name = "m25p",
.max_speed_hz = 20000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = &epcs_flash,
}
};
static int myboard_devices_init(void) {
...
spi_register_board_info(myboard_spi_board_info,
ARRAY_SIZE(myboard_spi_board_info));
add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
IORESOURCE_MEM, &altera_spi_0_data);
...
Franck.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: nor flash board init code
2012-07-27 11:33 ` Franck Jullien
@ 2012-07-30 8:00 ` christian.buettner
2012-07-30 8:07 ` Franck Jullien
0 siblings, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-07-30 8:00 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 2960 bytes --]
Thanks for the code!
Here is my approach:
const struct flash_platform_data tx53_flash = {
.type = "mx25l8005",
.name = "spi_flash",
};
//MX25L8005MC-15G
static const struct spi_board_info mx53_spi_board_info[] = {
{
.name = "mx25l8005",
.max_speed_hz = 70000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = &tx53_flash,
},
};
static struct spi_imx_master tx53_spi = {
.num_chipselect = 1,
};
init_devices {
...
spi_register_board_info(mx53_spi_board_info,
ARRAY_SIZE(mx53_spi_board_info));
add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
1024,IORESOURCE_MEM,&mx53_spi_board_info);
...
}
When the m25p80.c driver probes i get no spi instance:
static int m25p_probe(struct device_d *dev) {
struct spi_device *spi = (struct spi_device *)dev->type_data;
const struct spi_device_id *id = NULL;
...
}
struct spi_device *spi is always null
Whats wrong here?
christian
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 27.07.2012 13:33
Betreff: Re: nor flash board init code
2012/7/25 <christian.buettner@rafi.de>
>
> hi all,
> is there any example board init code to load the mx25l8005 spi nor-flash
through the imx53 (TX53 from KARO)?
> I want to use the m25p80 driver to read and write.
>
> christian
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
Hi Christian,
This is what I use with the Altera SPI controller + an SPI flash device:
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
static struct spi_altera_master altera_spi_0_data = {
.num_chipselect = 1,
.spi_mode = 0, /* SPI mode of the EPCS flash controller */
.databits = 8, /* Data length of the EPCS flash controller */
.speed = 20000000, /* EPCS flash controller speed */
};
static struct flash_platform_data epcs_flash = {
.name = "epcs", /* Cdev name, optional */
.type = "m25p40", /* Device type, required for non JEDEC chips */
};
static struct spi_board_info generic_spi_board_info[] = {
{
.name = "m25p",
.max_speed_hz = 20000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = &epcs_flash,
}
};
static int myboard_devices_init(void) {
...
spi_register_board_info(myboard_spi_board_info,
ARRAY_SIZE(myboard_spi_board_info));
add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
IORESOURCE_MEM, &altera_spi_0_data);
...
Franck.
[-- Attachment #1.2: Type: text/html, Size: 7509 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: nor flash board init code
2012-07-30 8:00 ` Antwort: " christian.buettner
@ 2012-07-30 8:07 ` Franck Jullien
2012-07-30 8:15 ` Antwort: " christian.buettner
0 siblings, 1 reply; 13+ messages in thread
From: Franck Jullien @ 2012-07-30 8:07 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
Hi,
2012/7/30 <christian.buettner@rafi.de>
>
> Thanks for the code!
>
> Here is my approach:
>
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "mx25l8005",
Here sould be the driver name: .name = "m25p",
>
> .max_speed_hz = 70000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static struct spi_imx_master tx53_spi = {
> .num_chipselect = 1,
> };
>
>
> init_devices {
>
> ...
> spi_register_board_info(mx53_spi_board_info,
> ARRAY_SIZE(mx53_spi_board_info));
>
> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 * 1024,IORESOURCE_MEM,&mx53_spi_board_info);
You have to add the SPI master device here. The m25p device will be
probed automagically (AFAIR).
>
> ...
> }
>
>
> When the m25p80.c driver probes i get no spi instance:
>
> static int m25p_probe(struct device_d *dev) {
> struct spi_device *spi = (struct spi_device *)dev->type_data;
> const struct spi_device_id *id = NULL;
> ...
> }
>
> struct spi_device *spi is always null
>
> Whats wrong here?
>
> christian
>
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 27.07.2012 13:33
> Betreff: Re: nor flash board init code
> ________________________________
>
>
>
> 2012/7/25 <christian.buettner@rafi.de>
> >
> > hi all,
> > is there any example board init code to load the mx25l8005 spi nor-flash through the imx53 (TX53 from KARO)?
> > I want to use the m25p80 driver to read and write.
> >
> > christian
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> Hi Christian,
>
> This is what I use with the Altera SPI controller + an SPI flash device:
>
> http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>
> static struct spi_altera_master altera_spi_0_data = {
> .num_chipselect = 1,
> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
> .databits = 8, /* Data length of the EPCS flash controller */
> .speed = 20000000, /* EPCS flash controller speed */
> };
>
>
> static struct flash_platform_data epcs_flash = {
> .name = "epcs", /* Cdev name, optional */
> .type = "m25p40", /* Device type, required for non JEDEC chips */
> };
>
> static struct spi_board_info generic_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 20000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &epcs_flash,
> }
> };
>
> static int myboard_devices_init(void) {
>
> ...
>
> spi_register_board_info(myboard_spi_board_info,
> ARRAY_SIZE(myboard_spi_board_info));
>
> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
> IORESOURCE_MEM, &altera_spi_0_data);
>
> ...
>
> Franck.
>
Franck.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: Re: nor flash board init code
2012-07-30 8:07 ` Franck Jullien
@ 2012-07-30 8:15 ` christian.buettner
2012-07-30 8:33 ` Franck Jullien
0 siblings, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-07-30 8:15 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 3940 bytes --]
Whooosch and it worked!
devinfo
devices:
...
`---- mem1
`---- 0x00000000-0xfffffffe: /dev/mem
`---- i2c-imx2
`---- imx_spi0
`---- m25p0
`---- fec_imx0
`---- miidev0
...
barebox:/ devinfo m25p0
resources:
driver: none
no parameters available
barebox:/
But why is driver in devinfo = none?
christian
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 30.07.2012 10:07
Betreff: Re: Re: nor flash board init code
Hi,
2012/7/30 <christian.buettner@rafi.de>
>
> Thanks for the code!
>
> Here is my approach:
>
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "mx25l8005",
Here sould be the driver name: .name = "m25p",
>
> .max_speed_hz = 70000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static struct spi_imx_master tx53_spi = {
> .num_chipselect = 1,
> };
>
>
> init_devices {
>
> ...
> spi_register_board_info(mx53_spi_board_info,
> ARRAY_SIZE(mx53_spi_board_info));
>
> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
1024,IORESOURCE_MEM,&mx53_spi_board_info);
You have to add the SPI master device here. The m25p device will be
probed automagically (AFAIR).
>
> ...
> }
>
>
> When the m25p80.c driver probes i get no spi instance:
>
> static int m25p_probe(struct device_d *dev) {
> struct spi_device *spi = (struct spi_device *)dev->type_data;
> const struct spi_device_id *id = NULL;
> ...
> }
>
> struct spi_device *spi is always null
>
> Whats wrong here?
>
> christian
>
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 27.07.2012 13:33
> Betreff: Re: nor flash board init code
> ________________________________
>
>
>
> 2012/7/25 <christian.buettner@rafi.de>
> >
> > hi all,
> > is there any example board init code to load the mx25l8005 spi
nor-flash through the imx53 (TX53 from KARO)?
> > I want to use the m25p80 driver to read and write.
> >
> > christian
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> Hi Christian,
>
> This is what I use with the Altera SPI controller + an SPI flash device:
>
>
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>
> static struct spi_altera_master altera_spi_0_data = {
> .num_chipselect = 1,
> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
> .databits = 8, /* Data length of the EPCS flash controller */
> .speed = 20000000, /* EPCS flash controller speed */
> };
>
>
> static struct flash_platform_data epcs_flash = {
> .name = "epcs", /* Cdev name, optional */
> .type = "m25p40", /* Device type, required for non JEDEC chips */
> };
>
> static struct spi_board_info generic_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 20000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &epcs_flash,
> }
> };
>
> static int myboard_devices_init(void) {
>
> ...
>
> spi_register_board_info(myboard_spi_board_info,
> ARRAY_SIZE(myboard_spi_board_info));
>
> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
> IORESOURCE_MEM, &altera_spi_0_data);
>
> ...
>
> Franck.
>
Franck.
[-- Attachment #1.2: Type: text/html, Size: 7931 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: Re: nor flash board init code
2012-07-30 8:15 ` Antwort: " christian.buettner
@ 2012-07-30 8:33 ` Franck Jullien
2012-07-30 8:44 ` Antwort: " christian.buettner
2012-07-30 13:58 ` christian.buettner
0 siblings, 2 replies; 13+ messages in thread
From: Franck Jullien @ 2012-07-30 8:33 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
2012/7/30 <christian.buettner@rafi.de>:
> Whooosch and it worked!
>
> devinfo
> devices:
> ...
> `---- mem1
> `---- 0x00000000-0xfffffffe: /dev/mem
> `---- i2c-imx2
> `---- imx_spi0
> `---- m25p0
> `---- fec_imx0
> `---- miidev0
> ...
>
> barebox:/ devinfo m25p0
> resources:
> driver: none
>
> no parameters available
> barebox:/
>
> But why is driver in devinfo = none?
>
It used to work. You need to find why it doesn't work anymore ;)
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:07
> Betreff: Re: Re: nor flash board init code
> ________________________________
>
>
>
> Hi,
>
> 2012/7/30 <christian.buettner@rafi.de>
>>
>> Thanks for the code!
>>
>> Here is my approach:
>>
>> const struct flash_platform_data tx53_flash = {
>> .type = "mx25l8005",
>> .name = "spi_flash",
>> };
>>
>>
>> //MX25L8005MC-15G
>> static const struct spi_board_info mx53_spi_board_info[] = {
>> {
>> .name = "mx25l8005",
>
>
> Here sould be the driver name: .name = "m25p",
>
>>
>> .max_speed_hz = 70000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &tx53_flash,
>> },
>> };
>>
>> static struct spi_imx_master tx53_spi = {
>> .num_chipselect = 1,
>> };
>>
>>
>> init_devices {
>>
>> ...
>> spi_register_board_info(mx53_spi_board_info,
>> ARRAY_SIZE(mx53_spi_board_info));
>>
>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>
> You have to add the SPI master device here. The m25p device will be
> probed automagically (AFAIR).
>
>
>>
>> ...
>> }
>>
>>
>> When the m25p80.c driver probes i get no spi instance:
>>
>> static int m25p_probe(struct device_d *dev) {
>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>> const struct spi_device_id *id = NULL;
>> ...
>> }
>>
>> struct spi_device *spi is always null
>>
>> Whats wrong here?
>>
>> christian
>>
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 27.07.2012 13:33
>> Betreff: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> 2012/7/25 <christian.buettner@rafi.de>
>> >
>> > hi all,
>> > is there any example board init code to load the mx25l8005 spi nor-flash
>> > through the imx53 (TX53 from KARO)?
>> > I want to use the m25p80 driver to read and write.
>> >
>> > christian
>> > _______________________________________________
>> > barebox mailing list
>> > barebox@lists.infradead.org
>> > http://lists.infradead.org/mailman/listinfo/barebox
>> >
>>
>> Hi Christian,
>>
>> This is what I use with the Altera SPI controller + an SPI flash device:
>>
>>
>> http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>
>> static struct spi_altera_master altera_spi_0_data = {
>> .num_chipselect = 1,
>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>> .databits = 8, /* Data length of the EPCS flash controller */
>> .speed = 20000000, /* EPCS flash controller speed */
>> };
>>
>>
>> static struct flash_platform_data epcs_flash = {
>> .name = "epcs", /* Cdev name, optional */
>> .type = "m25p40", /* Device type, required for non JEDEC chips */
>> };
>>
>> static struct spi_board_info generic_spi_board_info[] = {
>> {
>> .name = "m25p",
>> .max_speed_hz = 20000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &epcs_flash,
>> }
>> };
>>
>> static int myboard_devices_init(void) {
>>
>> ...
>>
>> spi_register_board_info(myboard_spi_board_info,
>> ARRAY_SIZE(myboard_spi_board_info));
>>
>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>> IORESOURCE_MEM, &altera_spi_0_data);
>>
>> ...
>>
>> Franck.
>>
>
> Franck.
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: Re: Re: nor flash board init code
2012-07-30 8:33 ` Franck Jullien
@ 2012-07-30 8:44 ` christian.buettner
2012-07-30 13:58 ` christian.buettner
1 sibling, 0 replies; 13+ messages in thread
From: christian.buettner @ 2012-07-30 8:44 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 4551 bytes --]
Ok i see.. :)
thanks a lot.
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 30.07.2012 10:33
Betreff: Re: Re: Re: nor flash board init code
2012/7/30 <christian.buettner@rafi.de>:
> Whooosch and it worked!
>
> devinfo
> devices:
> ...
> `---- mem1
> `---- 0x00000000-0xfffffffe: /dev/mem
> `---- i2c-imx2
> `---- imx_spi0
> `---- m25p0
> `---- fec_imx0
> `---- miidev0
> ...
>
> barebox:/ devinfo m25p0
> resources:
> driver: none
>
> no parameters available
> barebox:/
>
> But why is driver in devinfo = none?
>
It used to work. You need to find why it doesn't work anymore ;)
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:07
> Betreff: Re: Re: nor flash board init code
> ________________________________
>
>
>
> Hi,
>
> 2012/7/30 <christian.buettner@rafi.de>
>>
>> Thanks for the code!
>>
>> Here is my approach:
>>
>> const struct flash_platform_data tx53_flash = {
>> .type = "mx25l8005",
>> .name = "spi_flash",
>> };
>>
>>
>> //MX25L8005MC-15G
>> static const struct spi_board_info mx53_spi_board_info[] = {
>> {
>> .name = "mx25l8005",
>
>
> Here sould be the driver name: .name = "m25p",
>
>>
>> .max_speed_hz = 70000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &tx53_flash,
>> },
>> };
>>
>> static struct spi_imx_master tx53_spi = {
>> .num_chipselect = 1,
>> };
>>
>>
>> init_devices {
>>
>> ...
>> spi_register_board_info(mx53_spi_board_info,
>> ARRAY_SIZE(mx53_spi_board_info));
>>
>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>
> You have to add the SPI master device here. The m25p device will be
> probed automagically (AFAIR).
>
>
>>
>> ...
>> }
>>
>>
>> When the m25p80.c driver probes i get no spi instance:
>>
>> static int m25p_probe(struct device_d *dev) {
>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>> const struct spi_device_id *id = NULL;
>> ...
>> }
>>
>> struct spi_device *spi is always null
>>
>> Whats wrong here?
>>
>> christian
>>
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 27.07.2012 13:33
>> Betreff: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> 2012/7/25 <christian.buettner@rafi.de>
>> >
>> > hi all,
>> > is there any example board init code to load the mx25l8005 spi
nor-flash
>> > through the imx53 (TX53 from KARO)?
>> > I want to use the m25p80 driver to read and write.
>> >
>> > christian
>> > _______________________________________________
>> > barebox mailing list
>> > barebox@lists.infradead.org
>> > http://lists.infradead.org/mailman/listinfo/barebox
>> >
>>
>> Hi Christian,
>>
>> This is what I use with the Altera SPI controller + an SPI flash
device:
>>
>>
>>
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>
>> static struct spi_altera_master altera_spi_0_data = {
>> .num_chipselect = 1,
>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>> .databits = 8, /* Data length of the EPCS flash controller */
>> .speed = 20000000, /* EPCS flash controller speed */
>> };
>>
>>
>> static struct flash_platform_data epcs_flash = {
>> .name = "epcs", /* Cdev name, optional */
>> .type = "m25p40", /* Device type, required for non JEDEC chips */
>> };
>>
>> static struct spi_board_info generic_spi_board_info[] = {
>> {
>> .name = "m25p",
>> .max_speed_hz = 20000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &epcs_flash,
>> }
>> };
>>
>> static int myboard_devices_init(void) {
>>
>> ...
>>
>> spi_register_board_info(myboard_spi_board_info,
>> ARRAY_SIZE(myboard_spi_board_info));
>>
>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>> IORESOURCE_MEM, &altera_spi_0_data);
>>
>> ...
>>
>> Franck.
>>
>
> Franck.
>
[-- Attachment #1.2: Type: text/html, Size: 8647 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: Re: Re: nor flash board init code
2012-07-30 8:33 ` Franck Jullien
2012-07-30 8:44 ` Antwort: " christian.buettner
@ 2012-07-30 13:58 ` christian.buettner
2012-07-30 14:28 ` Franck Jullien
1 sibling, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-07-30 13:58 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 5655 bytes --]
i always get the response:
m25p@m25p0: unrecognized JEDEC id ffffff
SPI Flah:MX25L8005MC-15G
CPU: imx53
Here is my board init code:
//SPI + FLASH structs
const struct flash_platform_data tx53_flash = {
.type = "mx25l8005",
.name = "spi_flash",
};
//MX25L8005MC-15G
static const struct spi_board_info mx53_spi_board_info[] = {
{
.name = "m25p",
.max_speed_hz = 30000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = &tx53_flash,
},
};
static struct spi_imx_master tx53_spi = {
.num_chipselect = 1,
};
//PIN MUX:
MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
//device init code:
spi_register_board_info(mx53_spi_board_info,
ARRAY_SIZE(mx53_spi_board_info));
imx53_add_spi0(&tx53_spi);
Any ideas, whats wrong?
christian
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 30.07.2012 10:33
Betreff: Re: Re: Re: nor flash board init code
2012/7/30 <christian.buettner@rafi.de>:
> Whooosch and it worked!
>
> devinfo
> devices:
> ...
> `---- mem1
> `---- 0x00000000-0xfffffffe: /dev/mem
> `---- i2c-imx2
> `---- imx_spi0
> `---- m25p0
> `---- fec_imx0
> `---- miidev0
> ...
>
> barebox:/ devinfo m25p0
> resources:
> driver: none
>
> no parameters available
> barebox:/
>
> But why is driver in devinfo = none?
>
It used to work. You need to find why it doesn't work anymore ;)
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:07
> Betreff: Re: Re: nor flash board init code
> ________________________________
>
>
>
> Hi,
>
> 2012/7/30 <christian.buettner@rafi.de>
>>
>> Thanks for the code!
>>
>> Here is my approach:
>>
>> const struct flash_platform_data tx53_flash = {
>> .type = "mx25l8005",
>> .name = "spi_flash",
>> };
>>
>>
>> //MX25L8005MC-15G
>> static const struct spi_board_info mx53_spi_board_info[] = {
>> {
>> .name = "mx25l8005",
>
>
> Here sould be the driver name: .name = "m25p",
>
>>
>> .max_speed_hz = 70000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &tx53_flash,
>> },
>> };
>>
>> static struct spi_imx_master tx53_spi = {
>> .num_chipselect = 1,
>> };
>>
>>
>> init_devices {
>>
>> ...
>> spi_register_board_info(mx53_spi_board_info,
>> ARRAY_SIZE(mx53_spi_board_info));
>>
>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>
> You have to add the SPI master device here. The m25p device will be
> probed automagically (AFAIR).
>
>
>>
>> ...
>> }
>>
>>
>> When the m25p80.c driver probes i get no spi instance:
>>
>> static int m25p_probe(struct device_d *dev) {
>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>> const struct spi_device_id *id = NULL;
>> ...
>> }
>>
>> struct spi_device *spi is always null
>>
>> Whats wrong here?
>>
>> christian
>>
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 27.07.2012 13:33
>> Betreff: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> 2012/7/25 <christian.buettner@rafi.de>
>> >
>> > hi all,
>> > is there any example board init code to load the mx25l8005 spi
nor-flash
>> > through the imx53 (TX53 from KARO)?
>> > I want to use the m25p80 driver to read and write.
>> >
>> > christian
>> > _______________________________________________
>> > barebox mailing list
>> > barebox@lists.infradead.org
>> > http://lists.infradead.org/mailman/listinfo/barebox
>> >
>>
>> Hi Christian,
>>
>> This is what I use with the Altera SPI controller + an SPI flash
device:
>>
>>
>>
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>
>> static struct spi_altera_master altera_spi_0_data = {
>> .num_chipselect = 1,
>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>> .databits = 8, /* Data length of the EPCS flash controller */
>> .speed = 20000000, /* EPCS flash controller speed */
>> };
>>
>>
>> static struct flash_platform_data epcs_flash = {
>> .name = "epcs", /* Cdev name, optional */
>> .type = "m25p40", /* Device type, required for non JEDEC chips */
>> };
>>
>> static struct spi_board_info generic_spi_board_info[] = {
>> {
>> .name = "m25p",
>> .max_speed_hz = 20000000,
>> .bus_num = 0,
>> .chip_select = 0,
>> .bits_per_word = 8,
>> .mode = SPI_MODE_0,
>> .platform_data = &epcs_flash,
>> }
>> };
>>
>> static int myboard_devices_init(void) {
>>
>> ...
>>
>> spi_register_board_info(myboard_spi_board_info,
>> ARRAY_SIZE(myboard_spi_board_info));
>>
>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>> IORESOURCE_MEM, &altera_spi_0_data);
>>
>> ...
>>
>> Franck.
>>
>
> Franck.
>
[-- Attachment #1.2: Type: text/html, Size: 11877 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: Re: Re: nor flash board init code
2012-07-30 13:58 ` christian.buettner
@ 2012-07-30 14:28 ` Franck Jullien
2012-07-30 14:49 ` Antwort: " christian.buettner
2012-08-02 6:32 ` christian.buettner
0 siblings, 2 replies; 13+ messages in thread
From: Franck Jullien @ 2012-07-30 14:28 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
2012/7/30 <christian.buettner@rafi.de>:
> i always get the response:
>
> m25p@m25p0: unrecognized JEDEC id ffffff
>
> SPI Flah:MX25L8005MC-15G
> CPU: imx53
>
> Here is my board init code:
>
> //SPI + FLASH structs
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 30000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static struct spi_imx_master tx53_spi = {
> .num_chipselect = 1,
> };
>
I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board
file one can read:
static struct spi_imx_master tx51_spi_0_data = {
.chipselect = spi_0_cs,
.num_chipselect = ARRAY_SIZE(spi_0_cs),
};
#define CCXMX51_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
#define CCXMX51_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };
static struct spi_imx_master ecspi_0_data = {
.chipselect = ecspi_0_cs,
.num_chipselect = ARRAY_SIZE(ecspi_0_cs),
};
Don't you need to set .chipselect ?
>
>
> //PIN MUX:
> MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
>
>
> //device init code:
> spi_register_board_info(mx53_spi_board_info,
> ARRAY_SIZE(mx53_spi_board_info));
>
> imx53_add_spi0(&tx53_spi);
>
>
> Any ideas, whats wrong?
>
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:33
> Betreff: Re: Re: Re: nor flash board init code
> ________________________________
>
>
>
> 2012/7/30 <christian.buettner@rafi.de>:
>> Whooosch and it worked!
>>
>> devinfo
>> devices:
>> ...
>> `---- mem1
>> `---- 0x00000000-0xfffffffe: /dev/mem
>> `---- i2c-imx2
>> `---- imx_spi0
>> `---- m25p0
>> `---- fec_imx0
>> `---- miidev0
>> ...
>>
>> barebox:/ devinfo m25p0
>> resources:
>> driver: none
>>
>> no parameters available
>> barebox:/
>>
>> But why is driver in devinfo = none?
>>
>
> It used to work. You need to find why it doesn't work anymore ;)
>
>> christian
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 30.07.2012 10:07
>> Betreff: Re: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> Hi,
>>
>> 2012/7/30 <christian.buettner@rafi.de>
>>>
>>> Thanks for the code!
>>>
>>> Here is my approach:
>>>
>>> const struct flash_platform_data tx53_flash = {
>>> .type = "mx25l8005",
>>> .name = "spi_flash",
>>> };
>>>
>>>
>>> //MX25L8005MC-15G
>>> static const struct spi_board_info mx53_spi_board_info[] = {
>>> {
>>> .name = "mx25l8005",
>>
>>
>> Here sould be the driver name: .name = "m25p",
>>
>>>
>>> .max_speed_hz = 70000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &tx53_flash,
>>> },
>>> };
>>>
>>> static struct spi_imx_master tx53_spi = {
>>> .num_chipselect = 1,
>>> };
>>>
>>>
>>> init_devices {
>>>
>>> ...
>>> spi_register_board_info(mx53_spi_board_info,
>>> ARRAY_SIZE(mx53_spi_board_info));
>>>
>>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>>
>> You have to add the SPI master device here. The m25p device will be
>> probed automagically (AFAIR).
>>
>>
>>>
>>> ...
>>> }
>>>
>>>
>>> When the m25p80.c driver probes i get no spi instance:
>>>
>>> static int m25p_probe(struct device_d *dev) {
>>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>>> const struct spi_device_id *id = NULL;
>>> ...
>>> }
>>>
>>> struct spi_device *spi is always null
>>>
>>> Whats wrong here?
>>>
>>> christian
>>>
>>>
>>>
>>> Von: Franck Jullien <franck.jullien@gmail.com>
>>> An: christian.buettner@rafi.de,
>>> Kopie: barebox@lists.infradead.org
>>> Datum: 27.07.2012 13:33
>>> Betreff: Re: nor flash board init code
>>> ________________________________
>>>
>>>
>>>
>>> 2012/7/25 <christian.buettner@rafi.de>
>>> >
>>> > hi all,
>>> > is there any example board init code to load the mx25l8005 spi
>>> > nor-flash
>>> > through the imx53 (TX53 from KARO)?
>>> > I want to use the m25p80 driver to read and write.
>>> >
>>> > christian
>>> > _______________________________________________
>>> > barebox mailing list
>>> > barebox@lists.infradead.org
>>> > http://lists.infradead.org/mailman/listinfo/barebox
>>> >
>>>
>>> Hi Christian,
>>>
>>> This is what I use with the Altera SPI controller + an SPI flash device:
>>>
>>>
>>>
>>> http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>>
>>> static struct spi_altera_master altera_spi_0_data = {
>>> .num_chipselect = 1,
>>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>>> .databits = 8, /* Data length of the EPCS flash controller */
>>> .speed = 20000000, /* EPCS flash controller speed */
>>> };
>>>
>>>
>>> static struct flash_platform_data epcs_flash = {
>>> .name = "epcs", /* Cdev name, optional */
>>> .type = "m25p40", /* Device type, required for non JEDEC chips */
>>> };
>>>
>>> static struct spi_board_info generic_spi_board_info[] = {
>>> {
>>> .name = "m25p",
>>> .max_speed_hz = 20000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &epcs_flash,
>>> }
>>> };
>>>
>>> static int myboard_devices_init(void) {
>>>
>>> ...
>>>
>>> spi_register_board_info(myboard_spi_board_info,
>>> ARRAY_SIZE(myboard_spi_board_info));
>>>
>>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>>> IORESOURCE_MEM, &altera_spi_0_data);
>>>
>>> ...
>>>
>>> Franck.
>>>
>>
>> Franck.
>>
>
Do you have a scope ? This is the easiest way to debug SPI ;)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: Re: Re: Re: nor flash board init code
2012-07-30 14:28 ` Franck Jullien
@ 2012-07-30 14:49 ` christian.buettner
2012-07-30 17:05 ` Sascha Hauer
2012-08-02 6:32 ` christian.buettner
1 sibling, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-07-30 14:49 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 7934 bytes --]
ok tried it like this:
#define ECUv6_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
#define ECUv6_ECSPI1_CS1 IMX_GPIO_NR(3, 19)
//SPI + NOR FLASH
const struct flash_platform_data tx53_flash = {
.type = "mx25l8005",
.name = "spi_flash",
};
//MX25L8005MC-15G
static const struct spi_board_info mx53_spi_board_info[] = {
{
.name = "m25p",
.max_speed_hz = 30000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = &tx53_flash,
},
};
static int ecspi_0_cs[] = { ECUv6_ECSPI1_CS0,ECUv6_ECSPI1_CS1 };
static struct spi_imx_master tx53_spi = {
.chipselect = ecspi_0_cs,
.num_chipselect = ARRAY_SIZE(ecspi_0_cs),
};
answer from spi eeprom is unknown:
m25p@m25p0: unrecognized JEDEC id ffffff
Hasn't anyone used an SPI Flash with the imx53 yet?
christian
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 30.07.2012 16:28
Betreff: Re: Re: Re: Re: nor flash board init code
2012/7/30 <christian.buettner@rafi.de>:
> i always get the response:
>
> m25p@m25p0: unrecognized JEDEC id ffffff
>
> SPI Flah:MX25L8005MC-15G
> CPU: imx53
>
> Here is my board init code:
>
> //SPI + FLASH structs
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 30000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static struct spi_imx_master tx53_spi = {
> .num_chipselect = 1,
> };
>
I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board
file one can read:
static struct spi_imx_master tx51_spi_0_data = {
.chipselect = spi_0_cs,
.num_chipselect = ARRAY_SIZE(spi_0_cs),
};
#define CCXMX51_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
#define CCXMX51_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };
static struct spi_imx_master ecspi_0_data = {
.chipselect = ecspi_0_cs,
.num_chipselect = ARRAY_SIZE(ecspi_0_cs),
};
Don't you need to set .chipselect ?
>
>
> //PIN MUX:
> MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
>
>
> //device init code:
> spi_register_board_info(mx53_spi_board_info,
> ARRAY_SIZE(mx53_spi_board_info));
>
> imx53_add_spi0(&tx53_spi);
>
>
> Any ideas, whats wrong?
>
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:33
> Betreff: Re: Re: Re: nor flash board init code
> ________________________________
>
>
>
> 2012/7/30 <christian.buettner@rafi.de>:
>> Whooosch and it worked!
>>
>> devinfo
>> devices:
>> ...
>> `---- mem1
>> `---- 0x00000000-0xfffffffe: /dev/mem
>> `---- i2c-imx2
>> `---- imx_spi0
>> `---- m25p0
>> `---- fec_imx0
>> `---- miidev0
>> ...
>>
>> barebox:/ devinfo m25p0
>> resources:
>> driver: none
>>
>> no parameters available
>> barebox:/
>>
>> But why is driver in devinfo = none?
>>
>
> It used to work. You need to find why it doesn't work anymore ;)
>
>> christian
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 30.07.2012 10:07
>> Betreff: Re: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> Hi,
>>
>> 2012/7/30 <christian.buettner@rafi.de>
>>>
>>> Thanks for the code!
>>>
>>> Here is my approach:
>>>
>>> const struct flash_platform_data tx53_flash = {
>>> .type = "mx25l8005",
>>> .name = "spi_flash",
>>> };
>>>
>>>
>>> //MX25L8005MC-15G
>>> static const struct spi_board_info mx53_spi_board_info[] = {
>>> {
>>> .name = "mx25l8005",
>>
>>
>> Here sould be the driver name: .name = "m25p",
>>
>>>
>>> .max_speed_hz = 70000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &tx53_flash,
>>> },
>>> };
>>>
>>> static struct spi_imx_master tx53_spi = {
>>> .num_chipselect = 1,
>>> };
>>>
>>>
>>> init_devices {
>>>
>>> ...
>>> spi_register_board_info(mx53_spi_board_info,
>>> ARRAY_SIZE(mx53_spi_board_info));
>>>
>>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>>
>> You have to add the SPI master device here. The m25p device will be
>> probed automagically (AFAIR).
>>
>>
>>>
>>> ...
>>> }
>>>
>>>
>>> When the m25p80.c driver probes i get no spi instance:
>>>
>>> static int m25p_probe(struct device_d *dev) {
>>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>>> const struct spi_device_id *id = NULL;
>>> ...
>>> }
>>>
>>> struct spi_device *spi is always null
>>>
>>> Whats wrong here?
>>>
>>> christian
>>>
>>>
>>>
>>> Von: Franck Jullien <franck.jullien@gmail.com>
>>> An: christian.buettner@rafi.de,
>>> Kopie: barebox@lists.infradead.org
>>> Datum: 27.07.2012 13:33
>>> Betreff: Re: nor flash board init code
>>> ________________________________
>>>
>>>
>>>
>>> 2012/7/25 <christian.buettner@rafi.de>
>>> >
>>> > hi all,
>>> > is there any example board init code to load the mx25l8005 spi
>>> > nor-flash
>>> > through the imx53 (TX53 from KARO)?
>>> > I want to use the m25p80 driver to read and write.
>>> >
>>> > christian
>>> > _______________________________________________
>>> > barebox mailing list
>>> > barebox@lists.infradead.org
>>> > http://lists.infradead.org/mailman/listinfo/barebox
>>> >
>>>
>>> Hi Christian,
>>>
>>> This is what I use with the Altera SPI controller + an SPI flash
device:
>>>
>>>
>>>
>>>
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>>
>>> static struct spi_altera_master altera_spi_0_data = {
>>> .num_chipselect = 1,
>>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>>> .databits = 8, /* Data length of the EPCS flash controller
*/
>>> .speed = 20000000, /* EPCS flash controller speed */
>>> };
>>>
>>>
>>> static struct flash_platform_data epcs_flash = {
>>> .name = "epcs", /* Cdev name, optional */
>>> .type = "m25p40", /* Device type, required for non JEDEC chips
*/
>>> };
>>>
>>> static struct spi_board_info generic_spi_board_info[] = {
>>> {
>>> .name = "m25p",
>>> .max_speed_hz = 20000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &epcs_flash,
>>> }
>>> };
>>>
>>> static int myboard_devices_init(void) {
>>>
>>> ...
>>>
>>> spi_register_board_info(myboard_spi_board_info,
>>> ARRAY_SIZE(myboard_spi_board_info));
>>>
>>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>>> IORESOURCE_MEM, &altera_spi_0_data);
>>>
>>> ...
>>>
>>> Franck.
>>>
>>
>> Franck.
>>
>
Do you have a scope ? This is the easiest way to debug SPI ;)
[-- Attachment #1.2: Type: text/html, Size: 17486 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Antwort: Re: Re: Re: Re: nor flash board init code
2012-07-30 14:49 ` Antwort: " christian.buettner
@ 2012-07-30 17:05 ` Sascha Hauer
0 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2012-07-30 17:05 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
Hi Christian,
Please stop top-posting on Mailing lists.
Sascha
On Mon, Jul 30, 2012 at 04:49:17PM +0200, christian.buettner@rafi.de wrote:
> ok tried it like this:
>
> #define ECUv6_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
> #define ECUv6_ECSPI1_CS1 IMX_GPIO_NR(3, 19)
>
> //SPI + NOR FLASH
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 30000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static int ecspi_0_cs[] = { ECUv6_ECSPI1_CS0,ECUv6_ECSPI1_CS1 };
>
>
> static struct spi_imx_master tx53_spi = {
> .chipselect = ecspi_0_cs,
> .num_chipselect = ARRAY_SIZE(ecspi_0_cs),
> };
>
>
> answer from spi eeprom is unknown:
> m25p@m25p0: unrecognized JEDEC id ffffff
>
> Hasn't anyone used an SPI Flash with the imx53 yet?
>
> christian
>
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 16:28
> Betreff: Re: Re: Re: Re: nor flash board init code
>
>
>
> 2012/7/30 <christian.buettner@rafi.de>:
> > i always get the response:
> >
> > m25p@m25p0: unrecognized JEDEC id ffffff
> >
> > SPI Flah:MX25L8005MC-15G
> > CPU: imx53
> >
> > Here is my board init code:
> >
> > //SPI + FLASH structs
> > const struct flash_platform_data tx53_flash = {
> > .type = "mx25l8005",
> > .name = "spi_flash",
> > };
> >
> >
> > //MX25L8005MC-15G
> > static const struct spi_board_info mx53_spi_board_info[] = {
> > {
> > .name = "m25p",
> > .max_speed_hz = 30000000,
> > .bus_num = 0,
> > .chip_select = 0,
> > .bits_per_word = 8,
> > .mode = SPI_MODE_0,
> > .platform_data = &tx53_flash,
> > },
> > };
> >
> > static struct spi_imx_master tx53_spi = {
> > .num_chipselect = 1,
> > };
> >
>
> I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board
> file one can read:
>
> static struct spi_imx_master tx51_spi_0_data = {
> .chipselect = spi_0_cs,
> .num_chipselect = ARRAY_SIZE(spi_0_cs),
> };
>
> #define CCXMX51_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
> #define CCXMX51_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
>
> static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };
>
> static struct spi_imx_master ecspi_0_data = {
> .chipselect = ecspi_0_cs,
> .num_chipselect = ARRAY_SIZE(ecspi_0_cs),
> };
>
> Don't you need to set .chipselect ?
>
>
> >
> >
> > //PIN MUX:
> > MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> > MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> > MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> > MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
> >
> >
> > //device init code:
> > spi_register_board_info(mx53_spi_board_info,
> > ARRAY_SIZE(mx53_spi_board_info));
> >
> > imx53_add_spi0(&tx53_spi);
> >
> >
> > Any ideas, whats wrong?
> >
> > christian
> >
> >
> > Von: Franck Jullien <franck.jullien@gmail.com>
> > An: christian.buettner@rafi.de,
> > Kopie: barebox@lists.infradead.org
> > Datum: 30.07.2012 10:33
> > Betreff: Re: Re: Re: nor flash board init code
> > ________________________________
> >
> >
> >
> > 2012/7/30 <christian.buettner@rafi.de>:
> >> Whooosch and it worked!
> >>
> >> devinfo
> >> devices:
> >> ...
> >> `---- mem1
> >> `---- 0x00000000-0xfffffffe: /dev/mem
> >> `---- i2c-imx2
> >> `---- imx_spi0
> >> `---- m25p0
> >> `---- fec_imx0
> >> `---- miidev0
> >> ...
> >>
> >> barebox:/ devinfo m25p0
> >> resources:
> >> driver: none
> >>
> >> no parameters available
> >> barebox:/
> >>
> >> But why is driver in devinfo = none?
> >>
> >
> > It used to work. You need to find why it doesn't work anymore ;)
> >
> >> christian
> >>
> >>
> >> Von: Franck Jullien <franck.jullien@gmail.com>
> >> An: christian.buettner@rafi.de,
> >> Kopie: barebox@lists.infradead.org
> >> Datum: 30.07.2012 10:07
> >> Betreff: Re: Re: nor flash board init code
> >> ________________________________
> >>
> >>
> >>
> >> Hi,
> >>
> >> 2012/7/30 <christian.buettner@rafi.de>
> >>>
> >>> Thanks for the code!
> >>>
> >>> Here is my approach:
> >>>
> >>> const struct flash_platform_data tx53_flash = {
> >>> .type = "mx25l8005",
> >>> .name = "spi_flash",
> >>> };
> >>>
> >>>
> >>> //MX25L8005MC-15G
> >>> static const struct spi_board_info mx53_spi_board_info[] = {
> >>> {
> >>> .name = "mx25l8005",
> >>
> >>
> >> Here sould be the driver name: .name = "m25p",
> >>
> >>>
> >>> .max_speed_hz = 70000000,
> >>> .bus_num = 0,
> >>> .chip_select = 0,
> >>> .bits_per_word = 8,
> >>> .mode = SPI_MODE_0,
> >>> .platform_data = &tx53_flash,
> >>> },
> >>> };
> >>>
> >>> static struct spi_imx_master tx53_spi = {
> >>> .num_chipselect = 1,
> >>> };
> >>>
> >>>
> >>> init_devices {
> >>>
> >>> ...
> >>> spi_register_board_info(mx53_spi_board_info,
> >>> ARRAY_SIZE(mx53_spi_board_info));
> >>>
> >>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
> >>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
> >>
> >> You have to add the SPI master device here. The m25p device will be
> >> probed automagically (AFAIR).
> >>
> >>
> >>>
> >>> ...
> >>> }
> >>>
> >>>
> >>> When the m25p80.c driver probes i get no spi instance:
> >>>
> >>> static int m25p_probe(struct device_d *dev) {
> >>> struct spi_device *spi = (struct spi_device *)dev->type_data;
> >>> const struct spi_device_id *id = NULL;
> >>> ...
> >>> }
> >>>
> >>> struct spi_device *spi is always null
> >>>
> >>> Whats wrong here?
> >>>
> >>> christian
> >>>
> >>>
> >>>
> >>> Von: Franck Jullien <franck.jullien@gmail.com>
> >>> An: christian.buettner@rafi.de,
> >>> Kopie: barebox@lists.infradead.org
> >>> Datum: 27.07.2012 13:33
> >>> Betreff: Re: nor flash board init code
> >>> ________________________________
> >>>
> >>>
> >>>
> >>> 2012/7/25 <christian.buettner@rafi.de>
> >>> >
> >>> > hi all,
> >>> > is there any example board init code to load the mx25l8005 spi
> >>> > nor-flash
> >>> > through the imx53 (TX53 from KARO)?
> >>> > I want to use the m25p80 driver to read and write.
> >>> >
> >>> > christian
> >>> > _______________________________________________
> >>> > barebox mailing list
> >>> > barebox@lists.infradead.org
> >>> > http://lists.infradead.org/mailman/listinfo/barebox
> >>> >
> >>>
> >>> Hi Christian,
> >>>
> >>> This is what I use with the Altera SPI controller + an SPI flash
> device:
> >>>
> >>>
> >>>
> >>>
> http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>
> >>>
> >>> static struct spi_altera_master altera_spi_0_data = {
> >>> .num_chipselect = 1,
> >>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
> >>> .databits = 8, /* Data length of the EPCS flash controller
> */
> >>> .speed = 20000000, /* EPCS flash controller speed */
> >>> };
> >>>
> >>>
> >>> static struct flash_platform_data epcs_flash = {
> >>> .name = "epcs", /* Cdev name, optional */
> >>> .type = "m25p40", /* Device type, required for non JEDEC chips
> */
> >>> };
> >>>
> >>> static struct spi_board_info generic_spi_board_info[] = {
> >>> {
> >>> .name = "m25p",
> >>> .max_speed_hz = 20000000,
> >>> .bus_num = 0,
> >>> .chip_select = 0,
> >>> .bits_per_word = 8,
> >>> .mode = SPI_MODE_0,
> >>> .platform_data = &epcs_flash,
> >>> }
> >>> };
> >>>
> >>> static int myboard_devices_init(void) {
> >>>
> >>> ...
> >>>
> >>> spi_register_board_info(myboard_spi_board_info,
> >>> ARRAY_SIZE(myboard_spi_board_info));
> >>>
> >>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
> >>> IORESOURCE_MEM, &altera_spi_0_data);
> >>>
> >>> ...
> >>>
> >>> Franck.
> >>>
> >>
> >> Franck.
> >>
> >
>
> Do you have a scope ? This is the easiest way to debug SPI ;)
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Antwort: Re: Re: Re: Re: nor flash board init code
2012-07-30 14:28 ` Franck Jullien
2012-07-30 14:49 ` Antwort: " christian.buettner
@ 2012-08-02 6:32 ` christian.buettner
2012-08-02 8:46 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 13+ messages in thread
From: christian.buettner @ 2012-08-02 6:32 UTC (permalink / raw)
To: Franck Jullien; +Cc: barebox
[-- Attachment #1.1: Type: text/plain, Size: 8215 bytes --]
Got the solution!
PINMUX:
/*SPI*/
MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
MX53_PAD_EIM_EB2__GPIO2_30, //SPI SS0 - EEPROM CS
Data Structures:
#define ECUv6_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
//SPI Flash
const struct flash_platform_data tx53_flash = {
.type = "mx25l8005",
.name = "spi_flash",
};
//MX25L8005MC-15G
static const struct spi_board_info mx53_spi_board_info[] = {
{
.name = "m25p",
.max_speed_hz = 30000000,
.bus_num = 0,
.chip_select = 0,
.bits_per_word = 8,
.mode = SPI_MODE_0,
.platform_data = (void*)&tx53_flash,
},
};
static int ecspi_0_cs[] = { ECUv6_ECSPI1_CS0 };
static struct spi_imx_master tx53_spi = {
.chipselect = ecspi_0_cs,
.num_chipselect = ARRAY_SIZE(ecspi_0_cs),
};
Problem was:
The internal chipselect did not work -> Using the GPIO for Chipselect and
the PinMux 'SPI to GPIO' (not 'SPI to SSO')
and a lower hz setting (not the max. 70000000) made the spi flash
working!!
christian
Von: Franck Jullien <franck.jullien@gmail.com>
An: christian.buettner@rafi.de,
Kopie: barebox@lists.infradead.org
Datum: 30.07.2012 16:28
Betreff: Re: Re: Re: Re: nor flash board init code
2012/7/30 <christian.buettner@rafi.de>:
> i always get the response:
>
> m25p@m25p0: unrecognized JEDEC id ffffff
>
> SPI Flah:MX25L8005MC-15G
> CPU: imx53
>
> Here is my board init code:
>
> //SPI + FLASH structs
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 30000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = &tx53_flash,
> },
> };
>
> static struct spi_imx_master tx53_spi = {
> .num_chipselect = 1,
> };
>
I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board
file one can read:
static struct spi_imx_master tx51_spi_0_data = {
.chipselect = spi_0_cs,
.num_chipselect = ARRAY_SIZE(spi_0_cs),
};
#define CCXMX51_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
#define CCXMX51_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };
static struct spi_imx_master ecspi_0_data = {
.chipselect = ecspi_0_cs,
.num_chipselect = ARRAY_SIZE(ecspi_0_cs),
};
Don't you need to set .chipselect ?
>
>
> //PIN MUX:
> MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
>
>
> //device init code:
> spi_register_board_info(mx53_spi_board_info,
> ARRAY_SIZE(mx53_spi_board_info));
>
> imx53_add_spi0(&tx53_spi);
>
>
> Any ideas, whats wrong?
>
> christian
>
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 10:33
> Betreff: Re: Re: Re: nor flash board init code
> ________________________________
>
>
>
> 2012/7/30 <christian.buettner@rafi.de>:
>> Whooosch and it worked!
>>
>> devinfo
>> devices:
>> ...
>> `---- mem1
>> `---- 0x00000000-0xfffffffe: /dev/mem
>> `---- i2c-imx2
>> `---- imx_spi0
>> `---- m25p0
>> `---- fec_imx0
>> `---- miidev0
>> ...
>>
>> barebox:/ devinfo m25p0
>> resources:
>> driver: none
>>
>> no parameters available
>> barebox:/
>>
>> But why is driver in devinfo = none?
>>
>
> It used to work. You need to find why it doesn't work anymore ;)
>
>> christian
>>
>>
>> Von: Franck Jullien <franck.jullien@gmail.com>
>> An: christian.buettner@rafi.de,
>> Kopie: barebox@lists.infradead.org
>> Datum: 30.07.2012 10:07
>> Betreff: Re: Re: nor flash board init code
>> ________________________________
>>
>>
>>
>> Hi,
>>
>> 2012/7/30 <christian.buettner@rafi.de>
>>>
>>> Thanks for the code!
>>>
>>> Here is my approach:
>>>
>>> const struct flash_platform_data tx53_flash = {
>>> .type = "mx25l8005",
>>> .name = "spi_flash",
>>> };
>>>
>>>
>>> //MX25L8005MC-15G
>>> static const struct spi_board_info mx53_spi_board_info[] = {
>>> {
>>> .name = "mx25l8005",
>>
>>
>> Here sould be the driver name: .name = "m25p",
>>
>>>
>>> .max_speed_hz = 70000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &tx53_flash,
>>> },
>>> };
>>>
>>> static struct spi_imx_master tx53_spi = {
>>> .num_chipselect = 1,
>>> };
>>>
>>>
>>> init_devices {
>>>
>>> ...
>>> spi_register_board_info(mx53_spi_board_info,
>>> ARRAY_SIZE(mx53_spi_board_info));
>>>
>>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
>>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
>>
>> You have to add the SPI master device here. The m25p device will be
>> probed automagically (AFAIR).
>>
>>
>>>
>>> ...
>>> }
>>>
>>>
>>> When the m25p80.c driver probes i get no spi instance:
>>>
>>> static int m25p_probe(struct device_d *dev) {
>>> struct spi_device *spi = (struct spi_device *)dev->type_data;
>>> const struct spi_device_id *id = NULL;
>>> ...
>>> }
>>>
>>> struct spi_device *spi is always null
>>>
>>> Whats wrong here?
>>>
>>> christian
>>>
>>>
>>>
>>> Von: Franck Jullien <franck.jullien@gmail.com>
>>> An: christian.buettner@rafi.de,
>>> Kopie: barebox@lists.infradead.org
>>> Datum: 27.07.2012 13:33
>>> Betreff: Re: nor flash board init code
>>> ________________________________
>>>
>>>
>>>
>>> 2012/7/25 <christian.buettner@rafi.de>
>>> >
>>> > hi all,
>>> > is there any example board init code to load the mx25l8005 spi
>>> > nor-flash
>>> > through the imx53 (TX53 from KARO)?
>>> > I want to use the m25p80 driver to read and write.
>>> >
>>> > christian
>>> > _______________________________________________
>>> > barebox mailing list
>>> > barebox@lists.infradead.org
>>> > http://lists.infradead.org/mailman/listinfo/barebox
>>> >
>>>
>>> Hi Christian,
>>>
>>> This is what I use with the Altera SPI controller + an SPI flash
device:
>>>
>>>
>>>
>>>
http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
>>>
>>> static struct spi_altera_master altera_spi_0_data = {
>>> .num_chipselect = 1,
>>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
>>> .databits = 8, /* Data length of the EPCS flash controller
*/
>>> .speed = 20000000, /* EPCS flash controller speed */
>>> };
>>>
>>>
>>> static struct flash_platform_data epcs_flash = {
>>> .name = "epcs", /* Cdev name, optional */
>>> .type = "m25p40", /* Device type, required for non JEDEC chips
*/
>>> };
>>>
>>> static struct spi_board_info generic_spi_board_info[] = {
>>> {
>>> .name = "m25p",
>>> .max_speed_hz = 20000000,
>>> .bus_num = 0,
>>> .chip_select = 0,
>>> .bits_per_word = 8,
>>> .mode = SPI_MODE_0,
>>> .platform_data = &epcs_flash,
>>> }
>>> };
>>>
>>> static int myboard_devices_init(void) {
>>>
>>> ...
>>>
>>> spi_register_board_info(myboard_spi_board_info,
>>> ARRAY_SIZE(myboard_spi_board_info));
>>>
>>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
>>> IORESOURCE_MEM, &altera_spi_0_data);
>>>
>>> ...
>>>
>>> Franck.
>>>
>>
>> Franck.
>>
>
Do you have a scope ? This is the easiest way to debug SPI ;)
[-- Attachment #1.2: Type: text/html, Size: 16551 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Antwort: Re: Re: Re: Re: nor flash board init code
2012-08-02 6:32 ` christian.buettner
@ 2012-08-02 8:46 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-02 8:46 UTC (permalink / raw)
To: christian.buettner; +Cc: barebox
Hi Christian
please do stop to post in HTML this ml is text only and please stop to
top reply
people can not follow what you write
Best Regards,
J.
On 08:32 Thu 02 Aug , christian.buettner@rafi.de wrote:
> Got the solution!
>
> PINMUX:
> /*SPI*/
> MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> MX53_PAD_EIM_EB2__GPIO2_30, //SPI SS0 - EEPROM CS
>
> Data Structures:
> #define ECUv6_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
>
> //SPI Flash
> const struct flash_platform_data tx53_flash = {
> .type = "mx25l8005",
> .name = "spi_flash",
> };
>
> //MX25L8005MC-15G
> static const struct spi_board_info mx53_spi_board_info[] = {
> {
> .name = "m25p",
> .max_speed_hz = 30000000,
> .bus_num = 0,
> .chip_select = 0,
> .bits_per_word = 8,
> .mode = SPI_MODE_0,
> .platform_data = (void*)&tx53_flash,
> },
> };
>
> static int ecspi_0_cs[] = { ECUv6_ECSPI1_CS0 };
>
> static struct spi_imx_master tx53_spi = {
> .chipselect = ecspi_0_cs,
> .num_chipselect = ARRAY_SIZE(ecspi_0_cs),
> };
>
> Problem was:
> The internal chipselect did not work -> Using the GPIO for Chipselect and
> the PinMux 'SPI to GPIO' (not 'SPI to SSO')
> and a lower hz setting (not the max. 70000000) made the spi flash
> working!!
>
> christian
>
> Von: Franck Jullien <franck.jullien@gmail.com>
> An: christian.buettner@rafi.de,
> Kopie: barebox@lists.infradead.org
> Datum: 30.07.2012 16:28
> Betreff: Re: Re: Re: Re: nor flash board init code
>
> ----------------------------------------------------------------------
>
> 2012/7/30 <christian.buettner@rafi.de>:
> > i always get the response:
> >
> > m25p@m25p0: unrecognized JEDEC id ffffff
> >
> > SPI Flah:MX25L8005MC-15G
> > CPU: imx53
> >
> > Here is my board init code:
> >
> > //SPI + FLASH structs
> > const struct flash_platform_data tx53_flash = {
> > .type = "mx25l8005",
> > .name = "spi_flash",
> > };
> >
> >
> > //MX25L8005MC-15G
> > static const struct spi_board_info mx53_spi_board_info[] = {
> > {
> > .name = "m25p",
> > .max_speed_hz = 30000000,
> > .bus_num = 0,
> > .chip_select = 0,
> > .bits_per_word = 8,
> > .mode = SPI_MODE_0,
> > .platform_data = &tx53_flash,
> > },
> > };
> >
> > static struct spi_imx_master tx53_spi = {
> > .num_chipselect = 1,
> > };
> >
>
> I'm not familiar with the IMX spi but in the tx51 or ccxmx51 board
> file one can read:
>
> static struct spi_imx_master tx51_spi_0_data = {
> .chipselect = spi_0_cs,
> .num_chipselect = ARRAY_SIZE(spi_0_cs),
> };
>
> #define CCXMX51_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
> #define CCXMX51_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
>
> static int ecspi_0_cs[] = { CCXMX51_ECSPI1_CS0, CCXMX51_ECSPI1_CS1, };
>
> static struct spi_imx_master ecspi_0_data = {
> .chipselect = ecspi_0_cs,
> .num_chipselect = ARRAY_SIZE(ecspi_0_cs),
> };
>
> Don't you need to set .chipselect ?
>
> >
> >
> > //PIN MUX:
> > MX53_PAD_EIM_D17__ECSPI1_MISO, //SPI MISO - EEPROM SO
> > MX53_PAD_EIM_D18__ECSPI1_MOSI, //SPI MOSI - EEPROM SI
> > MX53_PAD_EIM_D16__ECSPI1_SCLK, //SPI SCLK - EEPROM SCK
> > MX53_PAD_EIM_EB2__ECSPI1_SS0, //SPI SS1 - EEPROM CS
> >
> >
> > //device init code:
> > spi_register_board_info(mx53_spi_board_info,
> > ARRAY_SIZE(mx53_spi_board_info));
> >
> > imx53_add_spi0(&tx53_spi);
> >
> >
> > Any ideas, whats wrong?
> >
> > christian
> >
> >
> > Von: Franck Jullien <franck.jullien@gmail.com>
> > An: christian.buettner@rafi.de,
> > Kopie: barebox@lists.infradead.org
> > Datum: 30.07.2012 10:33
> > Betreff: Re: Re: Re: nor flash board init code
> > ________________________________
> >
> >
> >
> > 2012/7/30 <christian.buettner@rafi.de>:
> >> Whooosch and it worked!
> >>
> >> devinfo
> >> devices:
> >> ...
> >> `---- mem1
> >> `---- 0x00000000-0xfffffffe: /dev/mem
> >> `---- i2c-imx2
> >> `---- imx_spi0
> >> `---- m25p0
> >> `---- fec_imx0
> >> `---- miidev0
> >> ...
> >>
> >> barebox:/ devinfo m25p0
> >> resources:
> >> driver: none
> >>
> >> no parameters available
> >> barebox:/
> >>
> >> But why is driver in devinfo = none?
> >>
> >
> > It used to work. You need to find why it doesn't work anymore ;)
> >
> >> christian
> >>
> >>
> >> Von: Franck Jullien <franck.jullien@gmail.com>
> >> An: christian.buettner@rafi.de,
> >> Kopie: barebox@lists.infradead.org
> >> Datum: 30.07.2012 10:07
> >> Betreff: Re: Re: nor flash board init code
> >> ________________________________
> >>
> >>
> >>
> >> Hi,
> >>
> >> 2012/7/30 <christian.buettner@rafi.de>
> >>>
> >>> Thanks for the code!
> >>>
> >>> Here is my approach:
> >>>
> >>> const struct flash_platform_data tx53_flash = {
> >>> .type = "mx25l8005",
> >>> .name = "spi_flash",
> >>> };
> >>>
> >>>
> >>> //MX25L8005MC-15G
> >>> static const struct spi_board_info mx53_spi_board_info[] = {
> >>> {
> >>> .name = "mx25l8005",
> >>
> >>
> >> Here sould be the driver name: .name = "m25p",
> >>
> >>>
> >>> .max_speed_hz = 70000000,
> >>> .bus_num = 0,
> >>> .chip_select = 0,
> >>> .bits_per_word = 8,
> >>> .mode = SPI_MODE_0,
> >>> .platform_data = &tx53_flash,
> >>> },
> >>> };
> >>>
> >>> static struct spi_imx_master tx53_spi = {
> >>> .num_chipselect = 1,
> >>> };
> >>>
> >>>
> >>> init_devices {
> >>>
> >>> ...
> >>> spi_register_board_info(mx53_spi_board_info,
> >>> ARRAY_SIZE(mx53_spi_board_info));
> >>>
> >>> add_generic_device("m25p",-1,"m25p",MX53_ECSPI1_BASE_ADDR,64 *
> >>> 1024,IORESOURCE_MEM,&mx53_spi_board_info);
> >>
> >> You have to add the SPI master device here. The m25p device will be
> >> probed automagically (AFAIR).
> >>
> >>
> >>>
> >>> ...
> >>> }
> >>>
> >>>
> >>> When the m25p80.c driver probes i get no spi instance:
> >>>
> >>> static int m25p_probe(struct device_d *dev) {
> >>> struct spi_device *spi = (struct spi_device *)dev->type_data;
> >>> const struct spi_device_id *id = NULL;
> >>> ...
> >>> }
> >>>
> >>> struct spi_device *spi is always null
> >>>
> >>> Whats wrong here?
> >>>
> >>> christian
> >>>
> >>>
> >>>
> >>> Von: Franck Jullien <franck.jullien@gmail.com>
> >>> An: christian.buettner@rafi.de,
> >>> Kopie: barebox@lists.infradead.org
> >>> Datum: 27.07.2012 13:33
> >>> Betreff: Re: nor flash board init code
> >>> ________________________________
> >>>
> >>>
> >>>
> >>> 2012/7/25 <christian.buettner@rafi.de>
> >>> >
> >>> > hi all,
> >>> > is there any example board init code to load the mx25l8005 spi
> >>> > nor-flash
> >>> > through the imx53 (TX53 from KARO)?
> >>> > I want to use the m25p80 driver to read and write.
> >>> >
> >>> > christian
> >>> > _______________________________________________
> >>> > barebox mailing list
> >>> > barebox@lists.infradead.org
> >>> > http://lists.infradead.org/mailman/listinfo/barebox
> >>> >
> >>>
> >>> Hi Christian,
> >>>
> >>> This is what I use with the Altera SPI controller + an SPI flash
> device:
> >>>
> >>>
> >>>
> >>>
> http://www.elec4fun.fr/index.php?option=com_content&view=article&id=10&Itemid=153
> >>>
> >>> static struct spi_altera_master altera_spi_0_data = {
> >>> .num_chipselect = 1,
> >>> .spi_mode = 0, /* SPI mode of the EPCS flash controller */
> >>> .databits = 8, /* Data length of the EPCS flash controller
> */
> >>> .speed = 20000000, /* EPCS flash controller speed */
> >>> };
> >>>
> >>>
> >>> static struct flash_platform_data epcs_flash = {
> >>> .name = "epcs", /* Cdev name, optional */
> >>> .type = "m25p40", /* Device type, required for non JEDEC chips
> */
> >>> };
> >>>
> >>> static struct spi_board_info generic_spi_board_info[] = {
> >>> {
> >>> .name = "m25p",
> >>> .max_speed_hz = 20000000,
> >>> .bus_num = 0,
> >>> .chip_select = 0,
> >>> .bits_per_word = 8,
> >>> .mode = SPI_MODE_0,
> >>> .platform_data = &epcs_flash,
> >>> }
> >>> };
> >>>
> >>> static int myboard_devices_init(void) {
> >>>
> >>> ...
> >>>
> >>> spi_register_board_info(myboard_spi_board_info,
> >>> ARRAY_SIZE(myboard_spi_board_info));
> >>>
> >>> add_generic_device("altera_spi", -1, NULL, NIOS_SOPC_EPCS_BASE, 0x18,
> >>> IORESOURCE_MEM, &altera_spi_0_data);
> >>>
> >>> ...
> >>>
> >>> Franck.
> >>>
> >>
> >> Franck.
> >>
> >
>
> Do you have a scope ? This is the easiest way to debug SPI ;)
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-08-02 8:46 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 14:31 nor flash board init code christian.buettner
2012-07-27 11:33 ` Franck Jullien
2012-07-30 8:00 ` Antwort: " christian.buettner
2012-07-30 8:07 ` Franck Jullien
2012-07-30 8:15 ` Antwort: " christian.buettner
2012-07-30 8:33 ` Franck Jullien
2012-07-30 8:44 ` Antwort: " christian.buettner
2012-07-30 13:58 ` christian.buettner
2012-07-30 14:28 ` Franck Jullien
2012-07-30 14:49 ` Antwort: " christian.buettner
2012-07-30 17:05 ` Sascha Hauer
2012-08-02 6:32 ` christian.buettner
2012-08-02 8:46 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox