linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Brandt <Chris.Brandt@renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Mason Yang <masonccyang@mxic.com.tw>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Subject: RE: [PATCH 4/6] spi: Add SPIBSC driver
Date: Wed, 4 Dec 2019 22:12:57 +0000	[thread overview]
Message-ID: <TY1PR01MB1562B1CBD17676A559EBA5718A5D0@TY1PR01MB1562.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdVAZOa7OmT0s=RsVJsny9NujDzpdg4T+QoUXGe0kJjOTw@mail.gmail.com>

Hi Geert,

Thank you for your review and suggestions!

On Tue, Dec 3, 2019, Geert Uytterhoeven wrote:
> > +static int spibsc_wait_trans_completion(struct spibsc_priv *sbsc) {
> > +       int t = 256 * 100000;
> > +
> > +       while (t--) {
> > +               if (spibsc_read(sbsc, CMNSR) & CMNSR_TEND)
> > +                       return 0;
> > +               ndelay(1);
> > +       }
> 
> So this may busy loop for up to 25.6 ms? Oops...
> 
> Can you use the interrupt (SPIHF) instead, signalling a completion?

RZ/A1 doesn't have any interrupts. And I think the interrupts in RZ/A2 
only work for HyperFlash (not QSPI).

But, 25.6ms is way too long!
I'll assume the slowest clock to be 1MHz and the max FIFO transfer of 4 bytes.
That's 32us, so that's what I'll use.


> > +               if (t->cs_change) {
> > +                       dev_err(sbsc->dev, "cs_change not supported");
> > +                       return -EIO;
> > +               }
> > +       }
> 
> If you would do the checks above in .prepare_message() (like e.g. rspi
> does)...

OK, Thanks. :)

> > +       case 6:
> > +               dropr |= DROPR_OPD0(tx_data[5]);
> > +               opde |= (1 << 0);
> 
> Both checkpatch and gcc tell you to add fallthrough coments.

OK, fixed.


> ... can't you just use .transfer_one(), instead of duplicating the logic from
> spi_transfer_one_message()?
> Or is there some special detail that's not obvious to the casual reviewer?

I guess .transfer_one() could be used if I kept shoving more stuff into 
.prepare_message().

But, the screwy thing about this controller is that messages that are 
'Tx only' are processed differently then 'Tx then Rx' messages and not 
like a traditional SPI controller.
By implementing both conditions in .spi_transfer_one_message(), it makes
that more clear for the next person in my opinion because you can see 
that sometimes we have to work with the entire message as a whole, not 
just individual pieces.


> > +static const struct of_device_id of_spibsc_match[] = {
> > +       { .compatible = "renesas,spibsc"},
> > +       { .compatible = "renesas,r7s72100-spibsc", .data = (void
> *)HAS_SPBCR},
> > +       { .compatible = "renesas,r7s9210-spibsc"},
> 
> Do you need to match against all 3 in the driver?
> Does SPIBSC work on RZ/A1 when not setting HAS_SPBCR?
> If not, the fallback to "renesas,spibsc" is not valid for RZ/A1.

OK, I dropped "renesas,spibsc".
I like having individual SoC names anyway.

Chris

  parent reply	other threads:[~2019-12-04 22:13 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03  3:45 [PATCH 0/6] spi: Add Renesas SPIBSC controller Chris Brandt
2019-12-03  3:45 ` [PATCH 1/6] clk: renesas: mstp: Add critical clock from device tree support Chris Brandt
2019-12-03 18:32   ` Geert Uytterhoeven
2019-12-03 18:46     ` Chris Brandt
2019-12-03 18:51       ` Geert Uytterhoeven
2019-12-03  3:45 ` [PATCH 2/6] ARM: dts: r7s72100: Add SPIBSC clocks Chris Brandt
2019-12-03 18:42   ` Geert Uytterhoeven
2019-12-03 18:57     ` Chris Brandt
2019-12-03 19:12       ` Geert Uytterhoeven
2019-12-04  8:38         ` Lee Jones
2019-12-04  9:03           ` Geert Uytterhoeven
2019-12-04  9:47             ` Lee Jones
2019-12-04 11:00               ` Chris Brandt
2019-12-03  3:45 ` [PATCH 3/6] clk: renesas: r7s9210: Add SPIBSC clock Chris Brandt
2019-12-03 18:49   ` Geert Uytterhoeven
2019-12-03 19:09     ` Chris Brandt
2019-12-03 20:40       ` Geert Uytterhoeven
2019-12-04  3:09         ` Chris Brandt
2019-12-03  3:45 ` [PATCH 4/6] spi: Add SPIBSC driver Chris Brandt
2019-12-03 14:19   ` Mark Brown
2019-12-03 15:00     ` Chris Brandt
2019-12-03 18:29     ` Geert Uytterhoeven
2019-12-04 11:25       ` Mark Brown
2019-12-04 12:14         ` Geert Uytterhoeven
2019-12-04 15:51     ` Chris Brandt
2019-12-04 16:49       ` Mark Brown
2019-12-03 18:28   ` Geert Uytterhoeven
2019-12-04 11:18     ` Mark Brown
2019-12-04 22:12     ` Chris Brandt [this message]
2019-12-03  3:45 ` [PATCH 5/6] ARM: dts: r7s9210: Add SPIBSC Device support Chris Brandt
2019-12-03 18:59   ` Geert Uytterhoeven
2019-12-03 22:38     ` Chris Brandt
2019-12-04  7:57       ` Geert Uytterhoeven
2019-12-04 11:04         ` Chris Brandt
2019-12-03  3:45 ` [PATCH 6/6] dt-bindings: spi: Document Renesas SPIBSC bindings Chris Brandt
2019-12-03  9:14   ` Sergei Shtylyov
2019-12-03 13:27     ` Chris Brandt
2019-12-03 16:04       ` Sergei Shtylyov
2019-12-03 16:35         ` Chris Brandt
2019-12-03 18:57   ` Geert Uytterhoeven
2019-12-03 20:39     ` Geert Uytterhoeven
2019-12-04  2:54       ` Chris Brandt
2019-12-04  8:56         ` Geert Uytterhoeven
2019-12-04 13:31           ` Chris Brandt
2019-12-05 15:48             ` Geert Uytterhoeven
2019-12-05 16:00               ` Chris Brandt
2019-12-04  8:40       ` Geert Uytterhoeven
2019-12-03 22:33     ` Chris Brandt
2019-12-04  8:43       ` Geert Uytterhoeven
2019-12-04 11:19         ` Chris Brandt

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=TY1PR01MB1562B1CBD17676A559EBA5718A5D0@TY1PR01MB1562.jpnprd01.prod.outlook.com \
    --to=chris.brandt@renesas.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=masonccyang@mxic.com.tw \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sergei.shtylyov@cogentembedded.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).