public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Boris Brezillon <bbrezillon@kernel.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] spi: Add support for the Aspeed ast2500 SPI controllers
Date: Fri, 25 Jan 2019 19:00:31 +0100	[thread overview]
Message-ID: <20190125190002.3754813c@bbrezillon> (raw)
In-Reply-To: <e8ac6058-92b1-6043-3d75-a975ea733a05@kaod.org>

+Vignesh

Hi Cédric,

On Fri, 25 Jan 2019 18:28:02 +0100
Cédric Le Goater <clg@kaod.org> wrote:

> Hello
> 
> On 10/10/18 2:02 PM, Cédric Le Goater wrote:
> > Hello Boris,
> > 
> > On 10/10/18 9:32 AM, Boris Brezillon wrote:  
> >> Hi Cédric,
> >>
> >> On Wed, 10 Oct 2018 11:46:56 +0530
> >> Jagan Teki <jagan@amarulasolutions.com> wrote:
> >>  
> >>> On Mon, Oct 8, 2018 at 11:32 AM Cédric Le Goater <clg@kaod.org> wrote:  
> >>>>
> >>>> On 10/4/18 5:57 PM, Jagan Teki wrote:    
> >>>>> On Fri, Sep 28, 2018 at 5:20 PM Cédric Le Goater <clg@kaod.org> wrote:    
> >>>>>>
> >>>>>> Hello Simon,
> >>>>>>
> >>>>>>
> >>>>>> The Aspeed AST2500 FMC controller can handle SPI flash and NOR flash memory,
> >>>>>> and the Aspeed AST2500 SPI Flash Controllers only SPI. If there is some
> >>>>>> misunderstanding on this driver, it might come from the fact it is closer
> >>>>>> to a SPI-NOR driver like we have in Linux, than a generic SPI driver.
> >>>>>> The stm32 SPI driver is somewhat similar.
> >>>>>>
> >>>>>> Should we move it under drivers/mtd/spi/ maybe ?    
> >>>>>
> >>>>> Seems with new spi-mem in Linux flash memory driver rely on spi-mem
> >>>>> instead of mtd/spi-nor. So I think you can handle this via new
> >>>>> spi-mem. have you send any patches to Linux?    
> >>>>
> >>>> No, not yet. The patchset is sent  :
> >>>>
> >>>>         https://patchwork.ozlabs.org/cover/933293/
> >>>>
> >>>> is not using spimem. I was not aware of that change in the spi-nor layer
> >>>> at the time. I will take a look.    
> >>
> >> Indeed, if you have some time to convert the Linux aspeed driver to
> >> the spi-mem interface that would be appreciated.  
> > 
> > Yes. That's the plan. I have a series on the way but I will see if I can
> > rework a v2 to use spi-mem.   
> 
> I took a look at spi-mem and worked on an initial spi-aspeed-smc driver
> using the new framework in Linux 5.0.x. It looks good but I have a couple
> of questions.

Great!

> 
> 
> The first is about performing direct accesses on the AHB window on which 
> the flash contents is mapped.

We have introduced the dirmap API/interface exactly for this purpose,
and the SPI NOR layer will use it in 5.1 (see [1]).
 
> 
> How do you distinguish a flash read (fast, dual, etc) from a RDSFPD command 
> for instance ?

Why do you need to know the access type?

> Are the drivers expected to check the SPI OP command and 
> depending on the target/command redirect to the appropriate address space ?   

Definitely not, the SPI MEM layer is supposed to be memory-type
agnostic, so you should not guess the operation type based on the
opcode. For direct mapping accesses, just implement the ->dirmap_xxx
hooks at the controller level and you'll be able to use the feature.

> 
> Also, Aspeed SPI controllers have a Read Timing Compensation Register which
> defines different data input delay cycles depending on SPI clock rates. This 
> register is supposed to be tuned when the flash chip characteristics are 
> known, after the first bus scan. Is there a way to know that our SPI slave 
> is alive and well detected before starting hammering successive reads on it 
> to see how it behaves.

Vignesh mentioned that a while back (couldn't find the thread where
this discussion happened) and I suggested adding a new hook to do this
"link training" process where you'd pass a spi_mem_op template + the
expected result so that the controller can test different setups until
it finds a working one.

> 
> 
> I think the U-Boot and Linux driver will be very similar wrt the issues 
> above ? 

I hope so.

Thanks for working on this conversion.

Boris

[1]https://patchwork.kernel.org/patch/10670755/

  reply	other threads:[~2019-01-25 18:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 14:16 [U-Boot] [PATCH 0/3] Support for the Aspeed ast2500 FMC/SPI controllers Cédric Le Goater
2018-09-10 14:16 ` [U-Boot] [PATCH 1/3] aspeed: ast2500: Add AHB clock Cédric Le Goater
2018-09-11  7:35   ` Joel Stanley
2018-09-11 16:42     ` Maxim Sloyko
2018-09-11 17:43       ` Cédric Le Goater
2018-09-11 22:39         ` Joel Stanley
2018-09-27 13:41   ` Simon Glass
2018-09-10 14:16 ` [U-Boot] [PATCH 2/3] spi: Add support for the Aspeed ast2500 SPI controllers Cédric Le Goater
2018-09-11 22:38   ` Joel Stanley
2018-09-12  6:03     ` Cédric Le Goater
2018-09-27 13:41   ` Simon Glass
2018-09-28 11:42     ` Cédric Le Goater
2018-10-02 11:22       ` Simon Glass
2018-10-08  6:29         ` Cédric Le Goater
2018-10-04 15:57       ` Jagan Teki
2018-10-08  6:02         ` Cédric Le Goater
2018-10-10  6:16           ` Jagan Teki
2018-10-10  7:32             ` Boris Brezillon
2018-10-10 12:02               ` Cédric Le Goater
2019-01-25 17:28                 ` Cédric Le Goater
2019-01-25 18:00                   ` Boris Brezillon [this message]
2019-01-26 10:42                     ` Vignesh R
2018-09-10 14:16 ` [U-Boot] [PATCH 3/3] aspeed: Add SPI support to the ast2500 Eval Board Cédric Le Goater
2018-09-12  9:28   ` Joel Stanley
2018-09-20 14:53   ` Jagan Teki
2018-09-20 15:56     ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190125190002.3754813c@bbrezillon \
    --to=bbrezillon@kernel.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox