[U-Boot] Issue about support spi-nand in u-boot

Jagan Teki jteki at openedev.com
Fri May 29 13:53:08 CEST 2015


On 29 May 2015 at 11:42, Peter Pan 潘栋 (peterpandong)
<peterpandong at micron.com> wrote:
> Hi Jagan
>
> I looked through your code[1] about support Linux spi-nor framework in u-boot.
> It is really great.

I'm bit concern about the spi-flash framework and planning to make generic
thanks for your response on this.

>
> I'm working on spi-nand in u-boot now. And I met some issues. Maybe we
> can have a discussion.
>   1. Currently spi_flash struct is tied with spi nor, as spi nand is also
>      a kind of spi flash. I think we should make spi_flash struct shareable.
>   2. In Linux, we can use parameter .tx_nbits and .rx_nbits in spi_transfer
>      struct to tell controller driver to use 1bit, 2bits or 4bits to transfer
>      data. But I didn't find a way to do it in u-boot. Maybe we can add some
>      transfer flags to do this.

We handle these on flash code it self, by assigning SINGLE, DUAL and
QUAD commands
from the controller flags. See tha drivers/mtd/spi/sf-probe.c if you
still unclear let me know
will discuss more.

>   3. Should we use spi nand via "sf" command set or create another command set?
>

question 1, 3 - Below are my understanding till now about the
implementation, just grab
these probably will discuss more.

I'm also thinking that the spi-flash.h should be common to nor and
nand and from flash
code level there should be a generic code that intern divide the
spi-nor and spi-nand.

Let's say cmd_sf will take nor or nand ops from user and this will
intern call flash code in
drivers/mtd like drivers/mtd/spi/spi-nor-flash.c in my new code. So
spi-nor-flash.c will become
spi-flash.c this have capability to handle spi-nor and spi-nand. Each
spi-nor and spi-nand have
separate in-built cores(spi-nor.c and spi-nand.c).

And then spi-nor.c will again transition to general spi drivers -
drivers/spi/ and few flash specific
spi drivers(not implemented yet) those will be drivers/mtd/spi/nor.
For spi-nand.c will again transition
to general nand drivers - drivers/mtd/nand/ and few flash specific
nand drivers (if they) those will be
drivers/mtd/spi/nand.

common/cmd_sf.c -- handle both spi-nor/nand
include/spi_flash.c -- handle spi-flash stuff both for spi-nor/nand

drivers/mtd/spi/ -- for spi flash code

drivers/mtd/spi/nor -- for spi-nor code
drivers/mtd/spi/nor.c -- for spi-nor core
drivers/mtd/spi/zynq_qspi.c -- zynq spi-nor controller (thought it's
(q)spi controller, but particularly
                             implemented for spi-nor based functionalists)
include/spi-nor.h -- header file for spi-nor core

drivers/mtd/spi/nand -- for spi-nand code
drivers/mtd/spi/nand.c -- for spi-nand core
drivers/mtd/spi/xxx_snand.c -- xxx spi-nand controller (thought it's
nand controller, but particularly implemented for spi-nand based
functionalists)
include/spi-nand.h -- header file for spi-nand core

> Any suggestion is appreciated.
>
> Another question, do you have any schedule about when to merge spi-nor framework?

Probably in the coming release, once this is in few of the driver in
drivers/spi need to write
back to spi-nor layer (those are full flash specific)

>
> [1] http://git.denx.de/?p=u-boot/u-boot-spi.git;a=shortlog;h=refs/heads/spi-nor

thanks!
-- 
Jagan Teki,
Openedev.


More information about the U-Boot mailing list