From: Mark Brown <broonie@kernel.org>
To: "Lh Kuo 郭力豪" <lh.Kuo@sunplus.com>
Cc: "LH.Kuo" <lhjeff911@gmail.com>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"qinjian@cqplus1.com" <qinjian@cqplus1.com>,
"Wells Lu 呂芳騰" <wells.lu@sunplus.com>
Subject: Re: [PATCH 1/2] SPI: Add SPI driver for Sunplus SP7021
Date: Fri, 5 Nov 2021 13:29:57 +0000 [thread overview]
Message-ID: <YYUx1VxyvL5evRA6@sirena.org.uk> (raw)
In-Reply-To: <1c5b8e435d614772a5c0af8d5c633941@sphcmbx02.sunplus.com.tw>
[-- Attachment #1: Type: text/plain, Size: 3353 bytes --]
On Fri, Nov 05, 2021 at 03:12:32AM +0000, Lh Kuo 郭力豪 wrote:
Please delete unneeded context from mails when replying. Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.
> > > +++ b/drivers/spi/spi-sunplus-sp7021.c
> > > @@ -0,0 +1,1356 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * Sunplus SPI controller driver
> > > + *
> > > + * Author: Sunplus Technology Co., Ltd.
> > Please make the entire comment a C++ one so things look more intentional.
> Sorry I don't understand. Is there a explanation?
Make the entire comment block C++ style - //
> > If the device has a GPIO chip select it should use the core support for GPIO
> > chip selects rather than open coding.
> Sorry But I didn't find the core function support to use simply. The core function is too complicated for me.
What did you try and in what way was it complicated? There's lots of
other drivers using this and it's generally resulted in less code in the
drivers so it seems this should be soemthing we can solve.
> > > + if (RW_phase == SPI_SLAVE_WRITE) {
> > > + } else if (RW_phase == SPI_SLAVE_READ) {
> > These two cases share no code, they should probably be separate functions
> > (and what happens if it's an unknown phase?).
> The slave mode of SP7021 is only half duplex.
Not sure that really addresses the concern?
> > > + if (pspim->tx_cur_len < data_len) {
> > > + len_temp = min(pspim->data_unit, data_len);
> > > + sp7021spi_wb(pspim, len_temp);
> > > + }
> > What if there's more data?
> SP7021 only support 16bytes FIFO transfer.
It can transfer more than one FIFO's worth of data though can't it?
> > I find it difficult to convince myself that this isn't going to have any overflow
> > issues, and it'll break operation with anything that does any manipulation of
> > chip select during the message. Given that the device uses GPIO chip selects
> > I'd expect it to just implement transfer_one() and not handle messages at all.
> > This would greatly simplify the code.
> More conditions will be checked in the spi-message function.
> In this case, only rx-date is allocated for each transfer of the message.
Part of the issue with both this and the previous section is code
clarity - it's not just if the code is correct, it's if it's clear that
the code is correct.
> > So we are using transfer_one? In that case I'm very confused why the driver
> > would be walking a transfer list...
> And the spi of SP7021 includes two working modes: spi-master and spi-slave
>
> SP7021 spi-master : full-duplex FIFO-mode only.
> SP7021 spi-slave : helf-duplex DMA-mode
> It seems that linux can contain these two modes in one drive. And this is what I need.
> Because many registers are overlapped, if they are used in different drives,
> they will crash if they are declared.
I think the driver needs to be restructured so it's clear which bits
apply to which mode, it's basically two completely separate code paths.
I have to say that it's really very surprising that the two different
modes use such completely different control mechanisms, normally the
differentiation would be more triggered by performance reasons.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-11-05 13:30 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 6:18 [PATCH 0/2] Add SPI control driver for Sunplus SP7021 SoC LH.Kuo
2021-11-01 6:18 ` [PATCH 1/2] SPI: Add SPI driver for Sunplus SP7021 LH.Kuo
2021-11-01 18:36 ` Mark Brown
[not found] ` <1c5b8e435d614772a5c0af8d5c633941@sphcmbx02.sunplus.com.tw>
2021-11-05 13:29 ` Mark Brown [this message]
2021-11-10 16:46 ` Andy Shevchenko
2021-11-02 14:31 ` Philipp Zabel
2021-11-14 8:02 ` Lukas Wunner
2021-11-01 6:18 ` [PATCH 2/2] devicetree bindings SPI Add bindings doc " LH.Kuo
2021-11-09 9:01 ` [PATCH v2 0/2] Add SPI control driver for Sunplus SP7021 SoC LH.Kuo
2021-11-09 9:01 ` [PATCH v2 1/2] SPI: Add SPI driver for Sunplus SP7021 LH.Kuo
2021-11-09 14:56 ` Mark Brown
[not found] ` <f98b5548cf564093af1d10ba1239507d@sphcmbx02.sunplus.com.tw>
2021-11-10 16:22 ` Mark Brown
[not found] ` <70a9c10ef34e46c2a51f134829abdd08@sphcmbx02.sunplus.com.tw>
2021-11-11 13:41 ` Mark Brown
[not found] ` <083dc70e20964ec8b74f71f6817be55e@sphcmbx02.sunplus.com.tw>
2021-11-18 13:38 ` Mark Brown
[not found] ` <e98c0bc4dc99415099197688a8dd3ef5@sphcmbx02.sunplus.com.tw>
2021-11-19 13:06 ` Mark Brown
2021-11-09 16:55 ` Randy Dunlap
[not found] ` <de7535b134fb4247b5275c04fa21debf@sphcmbx02.sunplus.com.tw>
2021-11-10 5:41 ` Randy Dunlap
2021-11-09 9:01 ` [PATCH v2 2/2] devicetree bindings SPI Add bindings doc " LH.Kuo
2021-11-09 14:57 ` Mark Brown
[not found] ` <2eeae9b780e94ac9810ffffe249098f2@sphcmbx02.sunplus.com.tw>
2021-11-10 14:11 ` Mark Brown
2021-11-22 2:33 ` [PATCH v3 0/2] Add SPI control driver for Sunplus SP7021 SoC LH.Kuo
2021-11-22 2:33 ` [PATCH v3 1/2] SPI: Add SPI driver for Sunplus SP7021 LH.Kuo
2021-11-22 22:09 ` Andy Shevchenko
2021-11-23 14:03 ` Mark Brown
2021-11-23 17:11 ` Andy Shevchenko
[not found] ` <6eb68a8153ba46c48862d00f7aa6e0fe@sphcmbx02.sunplus.com.tw>
2021-11-25 10:06 ` Andy Shevchenko
[not found] ` <33d50e94059b4734939db60b5c531bc9@sphcmbx02.sunplus.com.tw>
2021-11-26 10:33 ` Andy Shevchenko
2021-11-26 10:36 ` Philipp Zabel
2021-11-26 13:03 ` Mark Brown
[not found] ` <d33a3a4f3b8248a78fae572a7f88050a@sphcmbx02.sunplus.com.tw>
2021-11-29 13:10 ` Andy Shevchenko
[not found] ` <3d792085d6fc4be19253f5200c181041@sphcmbx02.sunplus.com.tw>
2021-12-01 19:28 ` Andy Shevchenko
2021-11-23 12:48 ` Lukas Wunner
2021-11-22 2:33 ` [PATCH v3 2/2] devicetree: bindings SPI Add bindings doc " LH.Kuo
2021-11-29 0:35 ` Rob Herring
2021-11-23 14:36 ` [PATCH v3 0/2] Add SPI control driver for Sunplus SP7021 SoC 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=YYUx1VxyvL5evRA6@sirena.org.uk \
--to=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lh.Kuo@sunplus.com \
--cc=lhjeff911@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=qinjian@cqplus1.com \
--cc=robh+dt@kernel.org \
--cc=wells.lu@sunplus.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®