All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: "dianders@chromium.org" <dianders@chromium.org>,
	"dkota@codeaurora.org" <dkota@codeaurora.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"swboyd@chromium.org" <swboyd@chromium.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"sdharia@codeaurora.org" <sdharia@codeaurora.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"kramasub@codeaurora.org" <kramasub@codeaurora.org>,
	"girishm@codeaurora.org" <girishm@codeaurora.org>
Subject: Re: [PATCH] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP
Date: Thu, 9 Aug 2018 18:24:03 +0000	[thread overview]
Message-ID: <1533839042.2283.305.camel@impinj.com> (raw)
In-Reply-To: <CAD=FV=X-fGukBpSOYCO=rv94_3gorL=9qmttsvZk21=m6mwUgA@mail.gmail.com>

On Thu, 2018-08-09 at 11:03 -0700, Doug Anderson wrote:
> On Fri, Aug 3, 2018 at 5:18 AM,  <dkota@codeaurora.org> wrote:
> > > > +       if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
> > > > +                               &spi->max_speed_hz)) {
> > 
> > 
> > > Why does this need to come from DT?
> > 
> > 
> > This is required to set the SPI controller max frequency.
> > As it is specific to the controller, so looks meaningful to specify it in
> > dtsi.
> > Also, spi core framework will set the transfer speed to controller max
> > frequency
> > if transfer frequency is greater than controller max frequency.
> > Please mention if you have a other opinion.
> 
> Here are my thoughts:
> 
> 1. It sure seems like the clock framework could be enforcing the max
> speed here.  SPI can just ask for the speed and the clock framework
> will pick the highest speed it can if you ask for one too high.  Isn't
> that the whole point of the "struct freq_tbl" in the clock driver?
> 
> 
> 2. The device tree writer already provides a max clock speed for each
> SPI slave in the device tree.  ...shouldn't the device tree writer
> already be taking into account the max of the SPI port when setting
> this value?

No, the way it works is the actual speed is the lesser of the master's
max and the slave device's max.

But usually the master's max is determined by:

1. The input clock the SPI master device, as provided by the clock
framework.  Usually the max SPI clock will be this clock /2 or
something like that.

2. The master has some maximum clock as part of its specifications, in
which case the driver basically hard codes it.  Maybe it is different
based on model and the driver has a table.

The device tree isn't really meant to be a way to remove all data from
the device driver just because it can be, or shift work from the driver
author to the device tree author.

So, one shouldn't specify the master max in the DT if the driver could
figure it out.

Sometimes you see a field in the DT and I think the thought process
that put it there was, "I don't understand how to set this register,
I'll just stick in the device tree and then it's Someone Else's Problem
to find the correct value."

The max speed that some board can talk to a SPI slave might be from the
specs of the slave device or maybe it's due to the traces on the board
itself that is the limiting factor.  In the latter case the convention
is to consider this part of the slave's max speed and put into the DT
in the slave's DT node max speed property.

So the same spi eeprom chip might have have a max in the DT of 20 MHz
on one board, copied out of the eeprom's datasheet.  But on another
board it has a max of 10 MHz because on that board's layout it only
works up to 10.

  reply	other threads:[~2018-08-09 18:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 21:34 [PATCH] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP Girish Mahadevan
2018-05-03 23:38 ` Mark Brown
2018-05-07 21:40   ` Mahadevan, Girish
     [not found]   ` <0c26e96c-85ad-c2a2-9abd-33096d76008b@codeaurora.org>
2018-05-17  7:21     ` Mark Brown
2018-05-21 21:45       ` Mahadevan, Girish
2018-05-22 17:32         ` Mark Brown
2018-05-11 22:30 ` Stephen Boyd
2018-05-11 22:30   ` Stephen Boyd
2018-05-21 15:52   ` Mahadevan, Girish
2018-05-22 16:46     ` Stephen Boyd
2018-05-22 17:30       ` Mark Brown
2018-05-24 16:25         ` Mahadevan, Girish
2018-05-24 16:29           ` Mark Brown
     [not found]             ` <28d8ab5fdeb34e52eba7ca771a17bc06@codeaurora.org>
2018-08-03 12:18               ` dkota
2018-08-09 18:03                 ` Doug Anderson
2018-08-09 18:24                   ` Trent Piepho [this message]
2018-08-09 19:37                     ` Doug Anderson
2018-08-10 18:43                       ` Trent Piepho
2018-08-10 10:52                   ` Mark Brown
2018-08-10 15:40                     ` Doug Anderson
2018-08-10 16:13                       ` Mark Brown
2018-08-10 16:27                         ` Doug Anderson
2018-08-10 16:43                           ` Mark Brown
2018-08-10 16:47                             ` Doug Anderson
2018-08-10 16:29                         ` dkota
2018-08-10 16:46                           ` Mark Brown
2018-08-14  9:00                             ` dkota
2018-08-14 15:03                               ` Mark Brown
2018-08-17 10:36                                 ` dkota
2018-08-17 14:59                                   ` Mark Brown
2018-08-24 11:00                                     ` dkota
2018-08-10 16:49                           ` Doug Anderson
2018-08-10 17:55                           ` Trent Piepho
2018-06-08 23:34 ` Matthias Kaehlcke

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=1533839042.2283.305.camel@impinj.com \
    --to=tpiepho@impinj.com \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=dkota@codeaurora.org \
    --cc=girishm@codeaurora.org \
    --cc=kramasub@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=sdharia@codeaurora.org \
    --cc=swboyd@chromium.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.