linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Thor Thayer <tthayer@opensource.altera.com>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: spidev: Don't mangle max_speed_hz in underlying spi device
Date: Tue, 11 Nov 2014 17:59:43 +0000	[thread overview]
Message-ID: <20141111175943.GC3815@sirena.org.uk> (raw)
In-Reply-To: <546214F7.1040007@opensource.altera.com>

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

On Tue, Nov 11, 2014 at 07:53:59AM -0600, Thor Thayer wrote:
> Hi Mark,

Please delete irrelevant context from mails, it makes it much easier to
find any new content you've added.

> On 11/08/2014 04:29 AM, Mark Brown wrote:

> >  			if (retval < 0)
> >-				spi->max_speed_hz = save;
> >+				spidev->speed_hz = tmp;
> >  			else
> >  				dev_dbg(&spi->dev, "%d Hz (max)\n", tmp);
> >+			spi->max_speed_hz = save;

> I think the test should be if (retval >= 0) otherwise the value is only
> updated on an error. With this change, I was able to successfully change the
> SPI speed without affecting the max speed. This was tested using
> spidev_test.c on a Altera Cyclone V which includes the DesignWare SPI IP
> (spi-dw.c).

Yup, misleading code.

> >  	if (status == 0)
> >  		spi_set_drvdata(spi, spidev);
> >  	else

> The echo command calls spidev_write() directly. Although the speed can't be
> specified in the echo command, it did prompt me to look at that path.

> In that case I think we'd need to add the .speed_hz element in
> spidev_sync_write() and spidev_sync_read().
> struct spi_transfer    t = {
>             .rx_buf        = spidev->rx_buffer,
>             .len        = len,
>             .speed_hz    = spidev->speed_hz,
>         };

Yup, looks that way.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2014-11-11 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 10:29 [PATCH] spi: spidev: Don't mangle max_speed_hz in underlying spi device Mark Brown
     [not found] ` <1415442589-29434-1-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-11-11 13:53   ` Thor Thayer
2014-11-11 17:59     ` Mark Brown [this message]

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=20141111175943.GC3815@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=tthayer@opensource.altera.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).