All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller driver
Date: Fri, 6 Nov 2020 10:05:39 +0100	[thread overview]
Message-ID: <20201106100539.62fc5249@collabora.com> (raw)
In-Reply-To: <HK0PR06MB2786DAC99A56EA302EE969CAB2ED0@HK0PR06MB2786.apcprd06.prod.outlook.com>

On Fri, 6 Nov 2020 08:58:23 +0000
Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> wrote:

> Hi Boris,
> 
> Thanks for your quick reply.
> 
> > -----Original Message-----
> > From: Boris Brezillon <boris.brezillon@collabora.com>
> > Sent: Thursday, November 5, 2020 11:12 PM
> > To: C?dric Le Goater <clg@kaod.org>; robh+dt at kernel.org
> > Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>; broonie at kernel.org;
> > joel at jms.id.au; andrew at aj.id.au; bbrezillon at kernel.org;
> > devicetree at vger.kernel.org; linux-kernel at vger.kernel.org;
> > linux-aspeed at lists.ozlabs.org; linux-spi at vger.kernel.org; BMC-SW
> > <BMC-SW@aspeedtech.com>
> > Subject: Re: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller
> > driver
> > 
> > Hi,
> > 
> > On Thu, 5 Nov 2020 15:09:11 +0100
> > C?dric Le Goater <clg@kaod.org> wrote:
> >   
> > > Hello Chin-Ting,
> > >
> > > Thanks for this driver. It's much cleaner than the previous and we
> > > should try adding support for the AST2500 SoC also. I guess we can
> > > keep the old driver for the AST2400 which has a different register layout.
> > >
> > > On the patchset, I think we should split this patch in three :
> > >
> > >  - basic support
> > >  - AHB window calculation depending on the flash size
> > >  - read training support  
> > 
> > I didn't look closely at the implementation, but if the read training tries to read
> > a section of the NOR, I'd recommend exposing that feature through spi-mem
> > and letting the SPI-NOR framework trigger the training instead of doing that at
> > dirmap creation time (remember that spi-mem is also used for SPI NANDs
> > which use the dirmap API too, and this training is unlikely to work there).
> > 
> > The SPI-NOR framework could pass a read op template and a reference pattern
> > such that all the spi-mem driver has to do is execute the template op and
> > compare the output to the reference buffer.
> >   
> 
> I agree it. Before, I were not able to find a suitable location to implement read training feature.
> I think that I can add a SPI timing training function in "spi_controller_mem_ops" struct and
> call it by a wrapper function called at the bottom of spi_nor_probe() in spi-nor.c.
> Maybe, SPI-NOR framework does not need to pass reference buffer since calibration
> method depends on each SoC itself and buffer size may be variant.
> The detail calibration method may be implemented in each SoC SPI driver.

That's a real problem IMO. What makes this pattern SoC specific? I can
see why the location in flash could be *board* specific, but the
pattern should be pretty common, right? As for the spi-mem operation to
be executed, it's definitely memory specific (I can imagine some flash
vendors providing a specific command returning a fixed pattern that's
not actually stored on a visible portion of the flash).

> 
> Besides, I am thinking about the possibility for adding a "spi_mem_post_init" function in
> spi-mem framework sine for some SoCs, SPI controller needs to adjust some settings
> after getting SPI flash information.

I don't think that's a good idea. The spi-mem interface should stay
memory-type agnostic and doing that means we somehow pass NOR specific
info. What is it that you need exactly, and why?

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
Cc: "Cédric Le Goater" <clg@kaod.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"andrew@aj.id.au" <andrew@aj.id.au>,
	"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	BMC-SW <BMC-SW@aspeedtech.com>
Subject: Re: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller driver
Date: Fri, 6 Nov 2020 10:05:39 +0100	[thread overview]
Message-ID: <20201106100539.62fc5249@collabora.com> (raw)
In-Reply-To: <HK0PR06MB2786DAC99A56EA302EE969CAB2ED0@HK0PR06MB2786.apcprd06.prod.outlook.com>

On Fri, 6 Nov 2020 08:58:23 +0000
Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> wrote:

> Hi Boris,
> 
> Thanks for your quick reply.
> 
> > -----Original Message-----
> > From: Boris Brezillon <boris.brezillon@collabora.com>
> > Sent: Thursday, November 5, 2020 11:12 PM
> > To: Cédric Le Goater <clg@kaod.org>; robh+dt@kernel.org
> > Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>; broonie@kernel.org;
> > joel@jms.id.au; andrew@aj.id.au; bbrezillon@kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > linux-aspeed@lists.ozlabs.org; linux-spi@vger.kernel.org; BMC-SW
> > <BMC-SW@aspeedtech.com>
> > Subject: Re: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller
> > driver
> > 
> > Hi,
> > 
> > On Thu, 5 Nov 2020 15:09:11 +0100
> > Cédric Le Goater <clg@kaod.org> wrote:
> >   
> > > Hello Chin-Ting,
> > >
> > > Thanks for this driver. It's much cleaner than the previous and we
> > > should try adding support for the AST2500 SoC also. I guess we can
> > > keep the old driver for the AST2400 which has a different register layout.
> > >
> > > On the patchset, I think we should split this patch in three :
> > >
> > >  - basic support
> > >  - AHB window calculation depending on the flash size
> > >  - read training support  
> > 
> > I didn't look closely at the implementation, but if the read training tries to read
> > a section of the NOR, I'd recommend exposing that feature through spi-mem
> > and letting the SPI-NOR framework trigger the training instead of doing that at
> > dirmap creation time (remember that spi-mem is also used for SPI NANDs
> > which use the dirmap API too, and this training is unlikely to work there).
> > 
> > The SPI-NOR framework could pass a read op template and a reference pattern
> > such that all the spi-mem driver has to do is execute the template op and
> > compare the output to the reference buffer.
> >   
> 
> I agree it. Before, I were not able to find a suitable location to implement read training feature.
> I think that I can add a SPI timing training function in "spi_controller_mem_ops" struct and
> call it by a wrapper function called at the bottom of spi_nor_probe() in spi-nor.c.
> Maybe, SPI-NOR framework does not need to pass reference buffer since calibration
> method depends on each SoC itself and buffer size may be variant.
> The detail calibration method may be implemented in each SoC SPI driver.

That's a real problem IMO. What makes this pattern SoC specific? I can
see why the location in flash could be *board* specific, but the
pattern should be pretty common, right? As for the spi-mem operation to
be executed, it's definitely memory specific (I can imagine some flash
vendors providing a specific command returning a fixed pattern that's
not actually stored on a visible portion of the flash).

> 
> Besides, I am thinking about the possibility for adding a "spi_mem_post_init" function in
> spi-mem framework sine for some SoCs, SPI controller needs to adjust some settings
> after getting SPI flash information.

I don't think that's a good idea. The spi-mem interface should stay
memory-type agnostic and doing that means we somehow pass NOR specific
info. What is it that you need exactly, and why?

  reply	other threads:[~2020-11-06  9:05 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 12:03 [v3 0/4] Porting ASPEED FMC/SPI memory controller driver Chin-Ting Kuo
2020-11-05 12:03 ` Chin-Ting Kuo
2020-11-05 12:03 ` [v3 1/4] dt-bindings: spi: Add binding file for ASPEED FMC/SPI memory controller Chin-Ting Kuo
2020-11-05 12:03   ` Chin-Ting Kuo
2020-11-05 22:39   ` Rob Herring
2020-11-05 22:39     ` Rob Herring
2020-11-06  9:11     ` Chin-Ting Kuo
2020-11-06  9:11       ` Chin-Ting Kuo
2020-11-05 12:03 ` [v3 2/4] ARM: dts: aspeed: ast2600: Update FMC/SPI controller setting for spi-aspeed.c Chin-Ting Kuo
2020-11-05 12:03   ` Chin-Ting Kuo
2020-11-05 12:03 ` [v3 3/4] ARM: dts: aspeed: ast2600-evb: Adjust SPI flash configuration Chin-Ting Kuo
2020-11-05 12:03   ` Chin-Ting Kuo
2020-11-05 12:03 ` [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller driver Chin-Ting Kuo
2020-11-05 12:03   ` Chin-Ting Kuo
2020-11-05 14:09   ` Cédric Le Goater
2020-11-05 14:09     ` Cédric Le Goater
2020-11-05 15:11     ` Boris Brezillon
2020-11-05 15:11       ` Boris Brezillon
2020-11-05 16:43       ` Mark Brown
2020-11-05 16:43         ` Mark Brown
2020-11-06  9:01         ` Chin-Ting Kuo
2020-11-06  9:01           ` Chin-Ting Kuo
2020-11-06  8:58       ` Chin-Ting Kuo
2020-11-06  8:58         ` Chin-Ting Kuo
2020-11-06  9:05         ` Boris Brezillon [this message]
2020-11-06  9:05           ` Boris Brezillon
2020-11-06 10:21           ` Chin-Ting Kuo
2020-11-06 10:21             ` Chin-Ting Kuo
2020-11-06 11:30             ` Boris Brezillon
2020-11-06 11:30               ` Boris Brezillon
2020-11-06 18:27               ` Chin-Ting Kuo
2020-11-06 18:27                 ` Chin-Ting Kuo
2020-11-11  5:44                 ` Vignesh Raghavendra
2020-11-11  5:44                   ` Vignesh Raghavendra
2020-11-13  7:30                   ` Chin-Ting Kuo
2020-11-13  7:30                     ` Chin-Ting Kuo
2020-11-06  7:38     ` Chin-Ting Kuo
2020-11-06  7:38       ` Chin-Ting Kuo
2020-12-01 13:57 ` [v3 0/4] Porting " Mark Brown
2020-12-01 13:57   ` Mark Brown

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=20201106100539.62fc5249@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    /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 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.