linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pandy Gao <pandy.gao-3arQi8VN3Tc@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Frank Li <frank.li-3arQi8VN3Tc@public.gmane.org>,
	Andy Duan <fugang.duan-3arQi8VN3Tc@public.gmane.org>
Subject: RE: [Patch V3 2/2] spi: imx: add lpspi bus driver
Date: Thu, 24 Nov 2016 01:41:08 +0000	[thread overview]
Message-ID: <AM4PR0401MB178070BEAF1DD6D2EA104A0FF6B60@AM4PR0401MB1780.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20161122191308.uuuiea54oi65jbu4-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

 From: Mark Brown <mailto:broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>  Sent: Wednesday, November 23, 2016 3:13 AM
> To: Pandy Gao <pandy.gao-3arQi8VN3Tc@public.gmane.org>
> Cc: robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Frank Li
> <frank.li-3arQi8VN3Tc@public.gmane.org>; Andy Duan <fugang.duan-3arQi8VN3Tc@public.gmane.org>
> Subject: Re: [Patch V3 2/2] spi: imx: add lpspi bus driver
> 
> On Tue, Nov 22, 2016 at 09:52:17PM +0800, Gao Pan wrote:
> > This patch adds lpspi driver to support new i.MX products which use
> > lpspi instead of ecspi.
> 
> I'll apply this but there's some small issues, can you please fix them up
> with incremental patches:
>
> > +static int fsl_lpspi_prepare_message(struct spi_master *master,
> > +				     struct spi_message *msg)
> > +{
> > +	struct fsl_lpspi_data *fsl_lpspi =
> spi_master_get_devdata(master);
> > +
> > +	return clk_prepare_enable(fsl_lpspi->clk);
> > +}
> 
> Rather than doing this per message it's a bit better to do it in
> prepare_transfer_hardware(), that way if there's a sequence of messages
> queued one after another we don't turn the clock on and off all the time.
> In practice it's likely to make a negligable difference to performance but
> it's just better practice.
> 
> > +static int fsl_lpspi_txfifo_empty(struct fsl_lpspi_data *fsl_lpspi) {
> > +	u32 txcnt;
> > +	unsigned long orig_jiffies = jiffies;
> > +
> > +	do {
> > +		txcnt = readl(fsl_lpspi->base + IMX7ULP_FSR) & 0xff;
> > +
> > +		if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500)))
> {
> > +			dev_dbg(fsl_lpspi->dev, "txfifo empty
> timeout\n");
> > +			return -ETIMEDOUT;
> > +		}
> > +		schedule();
> 
> Call cond_resched() instead, it has the effect you're looking for in a more
> modern way.
 
Thanks, will submit  incremental patches to fix them up.

Best Regards
Gao Pan
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-11-24  1:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 13:52 [Patch V3 1/2] spi: imx: add devicetree binding for lpspi Gao Pan
     [not found] ` <1479822737-8170-1-git-send-email-pandy.gao-3arQi8VN3Tc@public.gmane.org>
2016-11-22 13:52   ` [Patch V3 2/2] spi: imx: add lpspi bus driver Gao Pan
     [not found]     ` <1479822737-8170-2-git-send-email-pandy.gao-3arQi8VN3Tc@public.gmane.org>
2016-11-22 19:13       ` Mark Brown
     [not found]         ` <20161122191308.uuuiea54oi65jbu4-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-11-24  1:41           ` Pandy Gao [this message]
2016-11-22 19:13       ` Applied "spi: imx: add lpspi bus driver" to the spi tree 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=AM4PR0401MB178070BEAF1DD6D2EA104A0FF6B60@AM4PR0401MB1780.eurprd04.prod.outlook.com \
    --to=pandy.gao-3arqi8vn3tc@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=frank.li-3arQi8VN3Tc@public.gmane.org \
    --cc=fugang.duan-3arQi8VN3Tc@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@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).