linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Vignesh R <vigneshr@ti.com>
Cc: "David Woodhouse" <dwmw2@infradead.org>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"Boris Brezillon" <boris.brezillon@free-electrons.com>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Cyrille Pitchen" <cyrille.pitchen@wedev4u.fr>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"Mark Brown" <broonie@kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"Peter Pan" <peterpansjtu@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@exceet.de>,
	"Yogesh Gaur" <yogeshnarayan.gaur@nxp.com>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"Kamal Dasu" <kdasu.kdev@gmail.com>
Subject: Re: [RFC PATCH 4/6] spi: ti-qspi: Implement the spi_mem interface
Date: Wed, 14 Feb 2018 20:09:52 +0100	[thread overview]
Message-ID: <20180214200952.6a8578dc@bbrezillon> (raw)
In-Reply-To: <0944fefa-6ef8-a93a-dad6-660044b8ec8e@ti.com>

On Wed, 14 Feb 2018 21:55:10 +0530
Vignesh R <vigneshr@ti.com> wrote:

> On 12-Feb-18 9:38 PM, Boris Brezillon wrote:
> > On Mon, 12 Feb 2018 21:30:09 +0530
> > Vignesh R <vigneshr@ti.com> wrote:
> >   
> >> On 12-Feb-18 6:01 PM, Boris Brezillon wrote:  
> >>> On Mon, 12 Feb 2018 17:13:55 +0530
> >>> Vignesh R <vigneshr@ti.com> wrote:
> >>>     
> >>>> On Tuesday 06 February 2018 04:51 AM, Boris Brezillon wrote:    
> >>>>> From: Boris Brezillon <boris.brezillon@free-electrons.com>
> >>>>>
> >>>>> The spi_mem interface is meant to replace the spi_flash_read() one.
> >>>>> Implement the ->exec_op() method so that we can smoothly get rid of the
> >>>>> old interface.
> >>>>>
> >>>>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >>>>> ---
> >>>>>   drivers/spi/spi-ti-qspi.c | 85 +++++++++++++++++++++++++++++++++++++++--------
> >>>>>   1 file changed, 72 insertions(+), 13 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
> >>>>> index c24d9b45a27c..40cac3ef6cc9 100644
> >>>>> --- a/drivers/spi/spi-ti-qspi.c
> >>>>> +++ b/drivers/spi/spi-ti-qspi.c      
> >>>>
> >>>> [...]
> >>>>     
> >>>>> +static const struct spi_controller_mem_ops ti_qspi_mem_ops = {
> >>>>> +   .exec_op = ti_qspi_exec_mem_op,      
> >>>>
> >>>>         .supports_op = ti_qspi_supports_mem_op,
> >>>>
> >>>> Its required as per spi_controller_check_ops() in Patch 1/6    
> >>>     
> >>> ->supports_op() is optional, and if it's missing, the core will do the    
> >>> regular QuadSPI/DualSPI/SingleSPI check (see spi_mem_supports_op()
> >>> implementation).     
> >>
> >> You might have overlooked spi_controller_check_ops() from Patch 1/6:
> >> +static int spi_controller_check_ops(struct spi_controller *ctlr)
> >> +{
> >> +	/*
> >> +	 * The controller can implement only the high-level SPI-memory
> >> +	 * operations if it does not support regular SPI transfers.
> >> +	 */
> >> +	if (ctlr->mem_ops) {
> >> +		if (!ctlr->mem_ops->supports_op ||
> >> +		    !ctlr->mem_ops->exec_op)
> >> +			return -EINVAL;
> >> +	} else if (!ctlr->transfer && !ctlr->transfer_one &&
> >> +		   !ctlr->transfer_one_message) {
> >> +		return -EINVAL;
> >> +	}
> >> +
> >> +	return 0;
> >> +}
> >> +
> >>
> >> So if ->supports_op() is not populated by SPI controller driver, then
> >> driver probe fails with -EINVAL. This is what I observed on my TI
> >> hardware when testing this patch series.  
> > 
> > Correct. Then I should fix spi_controller_check_ops() to allow empty
> > ctlr->mem_ops->supports_op.
> >   
> >>  
> >>> This being said, if you think a custom ->supports_op()
> >>> implementation is needed for this controller I can add one.
> >>>     
> >>
> >> spi_mem_supports_op() should suffice for now if above issue is fixed.  
> > 
> > Cool. IIUC, you tested the series on a TI SoC. Does it work as
> > expected? Do you see any perf regressions?
> >   
> 
> I am planning to collect throughput numbers with this series for TI
> QSPI. I don't think there would be noticeable degradation.

Ok.

> But, it would be interesting to test for a driver thats now under
> drivers/mtd/spi-nor moved to drivers/spi and see if added overhead of
> m25p80 layer + spi core has any impact.

I'm working with Frieder on the fsl-qspi rework, so we should have
numbers soon.

-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-02-14 19:10 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 23:21 [RFC PATCH 0/6] spi: Extend the framework to generically support memory devices Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 1/6] spi: Extend the core to ease integration of SPI memory controllers Boris Brezillon
2018-02-06  9:43   ` Maxime Chevallier
2018-02-06 10:25     ` Boris Brezillon
2018-02-06 12:06     ` Mark Brown
2018-02-09 12:52   ` Miquel Raynal
2018-02-11 16:00     ` Boris Brezillon
2018-02-12 11:50   ` Vignesh R
2018-02-12 12:28     ` Boris Brezillon
2018-02-19 13:53   ` Mark Brown
2018-02-19 14:20     ` Boris Brezillon
2018-02-19 14:00   ` Mark Brown
2018-02-19 14:32     ` Boris Brezillon
2018-02-28  7:51   ` Peter Pan
2018-02-28 12:25     ` Boris Brezillon
2018-03-04 21:15   ` Cyrille Pitchen
2018-03-05  9:00     ` Boris Brezillon
2018-03-05 13:01       ` Cyrille Pitchen
2018-03-05 13:47         ` Boris Brezillon
2018-03-08 14:07           ` Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 2/6] spi: bcm-qspi: Implement the spi_mem interface Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 3/6] spi: bcm53xx: " Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 4/6] spi: ti-qspi: " Boris Brezillon
2018-02-11 15:17   ` Miquel Raynal
2018-02-11 17:18     ` Boris Brezillon
2018-02-12  7:54       ` Miquel Raynal
2018-02-12 11:43   ` Vignesh R
2018-02-12 12:31     ` Boris Brezillon
2018-02-12 16:00       ` Vignesh R
2018-02-12 16:08         ` Boris Brezillon
2018-02-14 16:25           ` Vignesh R
2018-02-14 19:09             ` Boris Brezillon [this message]
2018-02-14 20:44               ` Schrempf Frieder
2018-02-14 21:00                 ` Boris Brezillon
2018-02-15 16:38                   ` Schrempf Frieder
2018-02-17 11:01               ` Vignesh R
2018-02-17 21:52                 ` Boris Brezillon
2018-02-16 10:25   ` Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 5/6] mtd: spi-nor: Use the spi_mem_xx() API Boris Brezillon
2018-02-12 11:44   ` Vignesh R
2018-02-12 12:32     ` Boris Brezillon
2018-06-11  6:25   ` Yogesh Narayan Gaur
2018-06-11  7:35     ` Boris Brezillon
2018-02-05 23:21 ` [RFC PATCH 6/6] spi: Get rid of the spi_flash_read() API Boris Brezillon
2018-02-16 10:21   ` Vignesh R
2018-02-16 10:24     ` Boris Brezillon
2018-02-19 16:25 ` [RFC PATCH 0/6] spi: Extend the framework to generically support memory devices Mark Brown
2018-02-19 16:51   ` Boris Brezillon
2018-03-04 21:40   ` Cyrille Pitchen

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=20180214200952.6a8578dc@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@exceet.de \
    --cc=kdasu.kdev@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marek.vasut@gmail.com \
    --cc=peterpansjtu@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yogeshnarayan.gaur@nxp.com \
    /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;
as well as URLs for NNTP newsgroup(s).