From: "Jonas Mark (BT-FIR/ENG1)" <Mark.Jonas@de.bosch.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Heiko Schocher <hs@denx.de>,
"ZHU Yi (BT-FIR/ENG1-Zhu)" <Yi.Zhu5@cn.bosch.com>,
"Jonas Mark (BT-FIR/ENG1)" <Mark.Jonas@de.bosch.com>
Subject: Re: [PATCH 2/5] spi: implement companion-spi driver
Date: Fri, 8 Jun 2018 06:56:23 +0000 [thread overview]
Message-ID: <bb9540ed90e944c7a8e27287e6df25d5@de.bosch.com> (raw)
Hi Oleksij,
> > > > + if (slave_is_not_busy(priv))
> > > > + return 0;
> > > > +
> > >
> > > > + udelay(READY_POLL_US_GRAN);
> > >
> > > Should it be atomic?
> > > Can it use read_poll_* type of helpers instead?
> >
> > Yes, it shall be atomic because we need to reduce the latency at
> > detecting the de-assertion of the busy signal. We accept that this will
> > cost CPU time.
> >
> > In case the Companion itself is very busy and does not reply quickly we
> > are have second polling loop below which sleeps longer and is non-atomic.
>
> I can confirm, this make huge impact on protocol performance. And this
> protocol is not really the speed runner.
The challenge is that the protocol is synchronous and without back to
back transfers.
> you can send dummy message to set CS.
> + struct spi_transfer t = {
> + .len = 0,
> + .cs_change = 1,
> + };
>
> + /* send dummy to trigger CS */
> + reinit_completion(&priv->fc_complete);
> + spi_sync_locked(spi, &m);
>
> see my ancient unfinished code:
> https://patchwork.kernel.org/patch/9418511/
We will check it out.
> In general, this part of the code, can be provided as separate driver
> which should be called as "SPI 5wire protocol". 3 wires for data, 1 -
> chip select, 1 - busy state. Since, the slave cant fit to normal SPI
> requirements, and can't be ready within predictable time, busy signal is
> needed. Providing this as separate driver or part of SPI framework
> should reduce the code for many different drivers.
>
> The actual datagram on top of your spi companion should go to
> separate driver. There are similar (almost identical designs)
>
> can :+
> char:+
> dw: +
> gpio:+--->some_multi_end_mux_protocol--->spi_5wire_protocol->spi--->
>
> In my knowledge, only data format on top of spi_5wire_protocol is
> different. See my notes for similar topics:
> https://github.com/olerem/icc
> https://github.com/olerem/spi-5wire
With 5-wire protocol you are referencing to CLK, MISO, MOSI, CS (all
standard SPI signals) and an extra BUSY signal. What we implemented is
a 6-wire protocol. There is an additional REQUEST line where the SPI
slave requests a transfer. It is like a level triggered interrupt
request.
Yes, for making it more generic the code in drivers/spi/companion
could be split into a generic 6-wire protocol driver and a multiplexing
protocol on top of it.
How does a slave signal that it has data to be picked up with the
5-wire protocol?
Greetings,
Mark
Building Technologies, Panel Software Fire (BT-FIR/ENG1)
Bosch Sicherheitssysteme GmbH | Postfach 11 11 | 85626 Grasbrunn | GERMANY | www.boschsecurity.com
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart HRB 23118
Aufsichtsratsvorsitzender: Stefan Hartung; Geschäftsführung: Gert van Iperen, Andreas Bartz, Thomas Quante, Bernhard Schuster
next reply other threads:[~2018-06-08 6:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-08 6:56 Jonas Mark (BT-FIR/ENG1) [this message]
2018-06-08 7:05 ` Oleksij Rempel
-- strict thread matches above, loose matches on Subject: below --
2018-06-05 18:43 [PATCH 0/5] can: enable multi-queue for SocketCAN devices Mark Jonas
2018-06-05 18:43 ` [PATCH 2/5] spi: implement companion-spi driver Mark Jonas
2018-06-06 18:47 ` Andy Shevchenko
2018-06-07 14:58 ` AW: " Jonas Mark (BT-FIR/ENG1)
2018-06-08 6:03 ` Oleksij Rempel
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=bb9540ed90e944c7a8e27287e6df25d5@de.bosch.com \
--to=mark.jonas@de.bosch.com \
--cc=Yi.Zhu5@cn.bosch.com \
--cc=andy.shevchenko@gmail.com \
--cc=hs@denx.de \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=wg@grandegger.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
all inboxes | Powered by JetHome®