linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: chao bi <chao.bi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: jun.d.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	ken.k.mills-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	sylvain.centelles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH] SPI: SSP SPI Controller driver
Date: Thu, 13 Dec 2012 17:09:34 +0800	[thread overview]
Message-ID: <1355389774.3876.67.camel@bichao> (raw)
In-Reply-To: <20121211164658.4DBAD3E0C3E@localhost>


On Tue, 2012-12-11 at 16:36 +0000, Grant Likely wrote:
> > On Tue, 11 Dec 2012 10:00:16 +0800, chao bi <chao.bi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> wrote:
> > > > > +static void dump_trailer(const struct device *dev, char *buf, int len, int sz)
> > > > > +{
> > > > > +	int tlen1 = (len < sz ? len : sz);
> > > > > +	int tlen2 =  ((len - sz) > sz) ? sz : (len - sz);
> > > > > +	unsigned char *p;
> > > > > +	static char msg[MAX_SPI_TRANSFER_SIZE];
> > > > 
> > > > Is this size a limitation of the hardware, of of the driver?
> > > 
> > > I think this size is attributed to the DMA controller's maximum block size. 
> > > On Medfield platform, the DMA controller used by SSP SPI has defined its maximum 
> > > block size and word width, so SPI transfer size should not exceed the maximum size that 
> > > DMA could transfer in one block.
> > 
> > Typically what a driver should do here is to split up the transfer into
> > multiple DMA operations. I won't nack the driver over this issue, but
> > the driver should not have a maximum transfer size limitation in this
> > way.

Yes, agree with you. But I'm not 100% sure it's the only reason to set such limitation here. 
we'll keep tracking this issue, if it's as what we see, we shall implement an enhanced mechanism 
for multi DMA transfer the next step.



On Tue, 2012-12-11 at 16:46 +0000, Grant Likely wrote:
> On Tue, 11 Dec 2012 16:58:31 +0800, chao bi <chao.bi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > On Thu, 2012-12-06 at 12:38 +0000, Grant Likely wrote:
> > > On Wed, 21 Nov 2012 10:16:43 +0800, chao bi <chao.bi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > 
> > > > +	master->mode_bits = SPI_CPOL | SPI_CPHA;
> > > > +	master->bus_num = SSP_CFG_GET_SPI_BUS_NB(ssp_cfg);
> > > > +	master->num_chipselect = 1;
> > > > +	master->cleanup = cleanup;
> > > > +	master->setup = setup;
> > > > +	master->transfer = transfer;
> > > > +	drv_context->dma_wq = create_workqueue("intel_mid_ssp_spi");
> > > > +	INIT_WORK(&drv_context->complete_work, int_transfer_complete_work);
> > > 
> > > Workqueue management is integrated into the core spi infrastructure now.
> > > SPI drivers should no longer be creating their own workqueues.
> > > 
> > > Instead, replace the ->transfer hook with prepare_transfer_hardware(),
> > > unprepare_transfer_hardware() and transfer_one_message(). See
> > > Documentation/spi/spi-summary for details.
> > 
> > Hi Grant,
> > I'd like to talk about my understanding here, please correct me if I was wrong:
> > 
> > 1. I understand the workqueue in spi core is for driving message
> > transfer, so SPI driver should not create new workqueue for this usage.
> > However, the workqueue created here is not for this usage it's to call
> > back to SPI protocol driver (ifx6x60.c) when DMA data transfer is
> > finished, so it seems not conflict with spi core. Am I right?
> 
> It appears to me like all the stuff in int_transfer_complete() can be
> performed at interrupt context, or gets removed in moving to the new
> system. Am I mistaken here?
> 

Yes, we can make use of new SPI core interface to callback to protocol driver
(through spi_finalize_current_message()), but looks like it's better to call
spi_finalize_current_message() inside workqueue than DMA interrupt context, 
because the callback function for protocol driver would cost much time, it's 
better to move this part out of interrupt context. Therefore, I prefer to keep 
the workqueue here if you agree, what's your opinion? 

> > 2. Currently our Medfield Platform SW is based on linux-3.0, transfer_one_message() 
> > is not implemented, so in SPI driver, we're still use ->transfer(), this 
> > is with long-term validation. If we change to ->transfer_one_message() now, 
> > it's hardly to do thorough validation on our platform, so shall we complete 
> > this part by 2 steps, firstly we implement with ->transfer() hoot which can be 
> > validation on our hardware platform, next step, when our internal SW version 
> > is upgraded to latest Linux version, then we raise a patch to adapt new spi core.
> > what's your opinion?
> 
> Has it been tested on current mainline? I won't nak the driver if it
> doesn't use the common workqueue, but it does make it a lot

Agree with you, linux 3.7 SPI CORE interface is much better, we'll keep SSP driver 
align with it and test based on mainline SPI, now we're porting mainline SPI to our 
platform for test, it may takes a few time, after that we'll re-submit for you review.

Thanks,
chao


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d

  reply	other threads:[~2012-12-13  9:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  2:16 [PATCH] SPI: SSP SPI Controller driver chao bi
2012-11-21 12:08 ` Shubhrajyoti Datta
     [not found]   ` <CAM=Q2cvoEMScnCmfrhoAueZ8bfPCX90TxZmsSigfeRbGeXbzMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-22  3:26     ` Bi, Chao
     [not found]       ` <253F3AA5ECB4EC43A2CA0147545F67F2102B5D40-0J0gbvR4kTiiAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-11-22  6:54         ` Shubhrajyoti Datta
     [not found]           ` <CAM=Q2cszn_OoTyYiUVSj3NvpxJq+wSUnMJVcwWOdV2EzDviLVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-22  8:13             ` Bi, Chao
2012-11-21 12:14 ` Shubhrajyoti Datta
     [not found]   ` <CAM=Q2cu6ReS-6sJxdacnw=FYGdoFed9bM1gA6yFEtmVjs8KQTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-21 12:26     ` Alan Cox
     [not found]       ` <20121121122630.13fc2087-Z/y2cZnRghHXmaaqVzeoHQ@public.gmane.org>
2012-11-22  7:01         ` Shubhrajyoti Datta
     [not found]           ` <CAM=Q2cuCZni2DyzDux-E5H4-djgNrUURTYJ+f=_oMBeJE7eGMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-22 11:04             ` Alan Cox
2012-12-06 12:38 ` Grant Likely
2012-12-06 14:19   ` Alan Cox
     [not found]     ` <20121206141938.0100f06f-Z/y2cZnRghHXmaaqVzeoHQ@public.gmane.org>
2012-12-11 14:30       ` Jun Chen
2012-12-11  2:00   ` chao bi
2012-12-11 16:36     ` Grant Likely
2012-12-11  8:58   ` chao bi
2012-12-11 16:46     ` Grant Likely
2012-12-13  9:09       ` chao bi [this message]
2012-12-16 21:32         ` Grant Likely
2012-12-17  8:24           ` chao bi
2012-12-17  8:58     ` Linus Walleij
2012-12-17 11:23 ` Linus Walleij
     [not found]   ` <CACRpkdad3fHxWRpRqD-eP8-sKKexN+s-JZCT6XLggv92Q=5kMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-18  5:47     ` chao bi
2012-12-20 15:32       ` Linus Walleij
2013-01-09  4:25       ` Vinod Koul
     [not found]         ` <20130109042535.GL19691-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-10 11:52           ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2012-11-06  9:11 chao bi

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=1355389774.3876.67.camel@bichao \
    --to=chao.bi-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=jun.d.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=ken.k.mills-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=sylvain.centelles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 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).