All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] SPI flash on Altera socfpga
@ 2015-04-20  8:36 Pavel Machek
  2015-04-20  8:41 ` Marek Vasut
  2015-04-20  8:42 ` Stefan Roese
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Machek @ 2015-04-20  8:36 UTC (permalink / raw)
  To: u-boot

Hi!

I see that u-boot 2015.04 has SPI flash configured in the
socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
same SPI flash, right? Should similar dts part be enabled there, too?

I tried to get the support to work on custom board, but was not
successful so far. Does it work for you, or are still some parts
missing?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash on Altera socfpga
  2015-04-20  8:36 [U-Boot] SPI flash on Altera socfpga Pavel Machek
@ 2015-04-20  8:41 ` Marek Vasut
  2015-04-20  9:24   ` Pavel Machek
  2015-04-20  8:42 ` Stefan Roese
  1 sibling, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2015-04-20  8:41 UTC (permalink / raw)
  To: u-boot

On Monday, April 20, 2015 at 10:36:09 AM, Pavel Machek wrote:
> Hi!
> 
> I see that u-boot 2015.04 has SPI flash configured in the
> socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
> same SPI flash, right? Should similar dts part be enabled there, too?
> 
> I tried to get the support to work on custom board, but was not
> successful so far. Does it work for you, or are still some parts
> missing?

Which SPI flash are you talking about -- QSPI one or EPCS/EPCQ one ?

I think Stefan got the QSPI one working. EPCQ is a bit trickier.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash on Altera socfpga
  2015-04-20  8:36 [U-Boot] SPI flash on Altera socfpga Pavel Machek
  2015-04-20  8:41 ` Marek Vasut
@ 2015-04-20  8:42 ` Stefan Roese
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2015-04-20  8:42 UTC (permalink / raw)
  To: u-boot

Hi Pavel,

On 20.04.2015 10:36, Pavel Machek wrote:
> I see that u-boot 2015.04 has SPI flash configured in the
> socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
> same SPI flash, right? Should similar dts part be enabled there, too?

SPI NOR flash is working for me on SoCrates and another similar custom 
SOCFPGA based board just fine.

> I tried to get the support to work on custom board, but was not
> successful so far. Does it work for you, or are still some parts
> missing?

Not that I know of. What are the problems that you experience?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash on Altera socfpga
  2015-04-20  8:41 ` Marek Vasut
@ 2015-04-20  9:24   ` Pavel Machek
  2015-04-20  9:43     ` Stefan Roese
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2015-04-20  9:24 UTC (permalink / raw)
  To: u-boot

Hi!

> > I see that u-boot 2015.04 has SPI flash configured in the
> > socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
> > same SPI flash, right? Should similar dts part be enabled there, too?
> > 
> > I tried to get the support to work on custom board, but was not
> > successful so far. Does it work for you, or are still some parts
> > missing?
> 
> Which SPI flash are you talking about -- QSPI one or EPCS/EPCQ one ?
> 
> I think Stefan got the QSPI one working. EPCQ is a bit trickier.

Datasheet mentions QSPI_IO*/CLK/SS* pins, so I assume it is QSPI.

> On 20.04.2015 10:36, Pavel Machek wrote:
> >I see that u-boot 2015.04 has SPI flash configured in the
> >socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
> >same SPI flash, right? Should similar dts part be enabled there, too?
> 
> SPI NOR flash is working for me on SoCrates and another similar custom
> SOCFPGA based board just fine.

Thanks, that's useful to know.

> >I tried to get the support to work on custom board, but was not
> >successful so far. Does it work for you, or are still some parts
> >missing?
> 
> Not that I know of. What are the problems that you experience?

For tests, I've used config similar to socrates, even through the
board should be more similar to socdk:

U-Boot 2015.04-rc4-00103-gef7e76c-dirty (Apr 20 2015 - 10:24:33)

CPU:   Altera SoCFPGA Platform
       Watchdog enabled
       I2C:   ready
       DRAM:  256 MiB
       MMC:   SOCFPGA DWMMC: 0
       Using default environment

In:    serial
Out:   serial
Err:   serial
Model: EBV SOCrates
Net:   dwmac.ff702000
Hit any key to stop autoboot:  0
=> sf probe
Invalid chip select 0:0 (err=-19)
SF: Failed to set up slave
Failed to initialize SPI flash at 0:0
=>

One thing that puzzles me:

./arch/arm/dts/socfpga_cyclone5_socrates.dts:	flash0: n25q00 at 0 {
./arch/arm/dts/socfpga_cyclone5_socrates.dts:		compatible = "n25q00";

..but I see no mention of that compatible string anywhere
else. 2013-altera u-boot used ./drivers/mtd/spi/stmicro.c to handle
it...

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash on Altera socfpga
  2015-04-20  9:24   ` Pavel Machek
@ 2015-04-20  9:43     ` Stefan Roese
  2015-04-20 11:58       ` [U-Boot] SPI flash only works after sspi command (was Re: SPI flash on Altera socfpga) Pavel Machek
  2015-04-22  9:19       ` [U-Boot] SPI flash on Altera socfpga Stefan Roese
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Roese @ 2015-04-20  9:43 UTC (permalink / raw)
  To: u-boot

On 20.04.2015 11:24, Pavel Machek wrote:
>> Which SPI flash are you talking about -- QSPI one or EPCS/EPCQ one ?
>>
>> I think Stefan got the QSPI one working. EPCQ is a bit trickier.
>
> Datasheet mentions QSPI_IO*/CLK/SS* pins, so I assume it is QSPI.

Yes, QSPI handles the SPI NOR flash chips on SoCFPGA.

>> On 20.04.2015 10:36, Pavel Machek wrote:
>>> I see that u-boot 2015.04 has SPI flash configured in the
>>> socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
>>> same SPI flash, right? Should similar dts part be enabled there, too?
>>
>> SPI NOR flash is working for me on SoCrates and another similar custom
>> SOCFPGA based board just fine.
>
> Thanks, that's useful to know.
>
>>> I tried to get the support to work on custom board, but was not
>>> successful so far. Does it work for you, or are still some parts
>>> missing?
>>
>> Not that I know of. What are the problems that you experience?
>
> For tests, I've used config similar to socrates, even through the
> board should be more similar to socdk:
>
> U-Boot 2015.04-rc4-00103-gef7e76c-dirty (Apr 20 2015 - 10:24:33)
>
> CPU:   Altera SoCFPGA Platform
>         Watchdog enabled
>         I2C:   ready
>         DRAM:  256 MiB
>         MMC:   SOCFPGA DWMMC: 0
>         Using default environment
>
> In:    serial
> Out:   serial
> Err:   serial
> Model: EBV SOCrates
> Net:   dwmac.ff702000
> Hit any key to stop autoboot:  0
> => sf probe
> Invalid chip select 0:0 (err=-19)
> SF: Failed to set up slave
> Failed to initialize SPI flash at 0:0
> =>

IIRC, then the aliases in the dts are very important for this:

  	aliases {
		spi0 = "/spi at ff705000";		/* QSPI */
		...

Did you add those to your dts as well?

> One thing that puzzles me:
>
> ./arch/arm/dts/socfpga_cyclone5_socrates.dts:	flash0: n25q00 at 0 {
> ./arch/arm/dts/socfpga_cyclone5_socrates.dts:		compatible = "n25q00";
>
> ..but I see no mention of that compatible string anywhere
> else. 2013-altera u-boot used ./drivers/mtd/spi/stmicro.c to handle
> it...

IIRC, the flash detection is done via autodetection by reading the 
parameters from the chip itself.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash only works after sspi command (was Re: SPI flash on Altera socfpga)
  2015-04-20  9:43     ` Stefan Roese
@ 2015-04-20 11:58       ` Pavel Machek
  2015-04-22  9:19       ` [U-Boot] SPI flash on Altera socfpga Stefan Roese
  1 sibling, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2015-04-20 11:58 UTC (permalink / raw)
  To: u-boot

Hi!


> IIRC, then the aliases in the dts are very important for this:
> 
>  	aliases {
> 		spi0 = "/spi at ff705000";		/* QSPI */
> 		...
> 
> Did you add those to your dts as well?

I was using socrates dts for the moment, to keep diffs small. Suddenly
it started working.. and stopped working after reset. Now I realized
what is going on:

=> sf probe
Invalid chip select 0:0 (err=-19)
SF: Failed to set up slave
Failed to initialize SPI flash at 0:0
=> sf probe 0 0 0
Invalid chip select 0:0 (err=-19)
SF: Failed to set up slave
Failed to initialize SPI flash at 0:0
=> sspi
QSPI: Error, command is empty.
Error -1 during SPI transaction
=> sf probe 0 0 0
raise: Signal # 8 caught
raise: Signal # 8 caught
raise: Signal # 8 caught
SF: Detected N25Q512 with page size 256 Bytes, erase size 4 KiB, total
64 MiB
SF: Warning - Only lower 16MiB accessible, Full access #define
CONFIG_SPI_FLASH_BAR
=>

(u-boot 2015.04 final)

Is there missing initialization somewhere...?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] SPI flash on Altera socfpga
  2015-04-20  9:43     ` Stefan Roese
  2015-04-20 11:58       ` [U-Boot] SPI flash only works after sspi command (was Re: SPI flash on Altera socfpga) Pavel Machek
@ 2015-04-22  9:19       ` Stefan Roese
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2015-04-22  9:19 UTC (permalink / raw)
  To: u-boot

Hi Pavel,

On 20.04.2015 11:43, Stefan Roese wrote:
> On 20.04.2015 11:24, Pavel Machek wrote:
>>> Which SPI flash are you talking about -- QSPI one or EPCS/EPCQ one ?
>>>
>>> I think Stefan got the QSPI one working. EPCQ is a bit trickier.
>>
>> Datasheet mentions QSPI_IO*/CLK/SS* pins, so I assume it is QSPI.
>
> Yes, QSPI handles the SPI NOR flash chips on SoCFPGA.
>
>>> On 20.04.2015 10:36, Pavel Machek wrote:
>>>> I see that u-boot 2015.04 has SPI flash configured in the
>>>> socfpga_cyclone5_socrates.dts. But as far as I know, socdk should have
>>>> same SPI flash, right? Should similar dts part be enabled there, too?
>>>
>>> SPI NOR flash is working for me on SoCrates and another similar custom
>>> SOCFPGA based board just fine.

I just re-tested SPI NOR on SoCratres. And it also is broken starting 
with this commit:

$ git bisect good
0f36f957f4108d2d1d935e3076b7ae91f4e65a7d is the first bad commit
commit 0f36f957f4108d2d1d935e3076b7ae91f4e65a7d
Author: Simon Glass <sjg@chromium.org>

Even the v2015.04 release has non-working SPI NOR I'm afraid. In current 
master its fixed again. This patch here fixes this bug:

b3d023b4058acc83d211555e62068f84e322bcac
"dm: spi_flash: fix wrong dependency"

I'll resend another mail to Tom, asking him to queue this patch for a 
potential v2015.04 stable release.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-04-22  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20  8:36 [U-Boot] SPI flash on Altera socfpga Pavel Machek
2015-04-20  8:41 ` Marek Vasut
2015-04-20  9:24   ` Pavel Machek
2015-04-20  9:43     ` Stefan Roese
2015-04-20 11:58       ` [U-Boot] SPI flash only works after sspi command (was Re: SPI flash on Altera socfpga) Pavel Machek
2015-04-22  9:19       ` [U-Boot] SPI flash on Altera socfpga Stefan Roese
2015-04-20  8:42 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.