All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhuyinbo <zhuyinbo@loongson.cn>
To: Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jianmin Lv <lvjianmin@loongson.cn>,
	wanghongliang@loongson.cn, Liu Peibao <liupeibao@loongson.cn>,
	loongson-kernel@lists.loongnix.cn, zhuyinbo@loongson.cn
Subject: Re: [PATCH v2 2/2] spi: loongson: add bus driver for the loongson spi controller
Date: Thu, 23 Mar 2023 20:46:19 +0800	[thread overview]
Message-ID: <2337f45f-c513-1b10-ccfc-766363c5fd02@loongson.cn> (raw)
In-Reply-To: <f7811b40-80a3-4985-b92d-1df3e28a0935@sirena.org.uk>


在 2023/3/21 下午8:08, Mark Brown 写道:
> On Tue, Mar 21, 2023 at 10:54:32AM +0800, zhuyinbo wrote:
>> 在 2023/3/20 下午8:52, Mark Brown 写道:
>>> No, that doesn't help if setup() reconfigures the controller while it's
>>> doing a transfer.  The issue is that the controller might be put into
>>> the wrong mode or run at the wrong speed.
>> sorry, I don't got that why cpu still can call setup's critical region when
>> cpu call transfer_one to  transfer spi data.
>> when I added a spin_lock for setup and transfer_one then setup and
>> transfer_one's critical region cann't be called
>> simultaneously as I know, because the their lock was same lock.
> Think what happens if the two SPI devices have different configurations
> - for example, a different SPI mode.  The register state won't be
> corrupted but the devices will still end up seeing misconfigured SPI
> transfers.

I think add following change and that issue what you said will can be 
fixed,   in addition, the spin_lock

was also not needed.   Do you think so?

@@ -101,8 +101,10 @@ static int loongson_spi_setup(struct spi_device *spi)
         if (spi->chip_select >= spi->master->num_chipselect)
                 return -EINVAL;

+       loongson_spi->hz = 0;
+       loongson_spi->mode &= SPI_NO_CS;
+
         spin_lock(&loongson_spi->lock);
-       loongson_spi_update_state(loongson_spi, spi, NULL);
         loongson_spi_set_cs(spi, 1);



  reply	other threads:[~2023-03-23 12:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  8:29 [PATCH v2 0/2] spi: loongson: add bus driver for the loongson spi Yinbo Zhu
2023-03-17  8:29 ` [PATCH v2 1/2] dt-bindings: spi: add " Yinbo Zhu
2023-03-17  9:15   ` Krzysztof Kozlowski
2023-03-17 10:00     ` zhuyinbo
2023-03-17 15:51       ` Krzysztof Kozlowski
2023-03-17 15:51         ` Krzysztof Kozlowski
2023-03-17 16:14           ` Mark Brown
2023-03-18  1:38             ` zhuyinbo
2023-03-18  1:18         ` zhuyinbo
2023-03-17 14:55   ` Rob Herring
2023-03-18  1:16     ` zhuyinbo
2023-03-17  8:29 ` [PATCH v2 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
2023-03-17 16:26   ` Mark Brown
2023-03-18  6:07     ` zhuyinbo
2023-03-20 12:52       ` Mark Brown
2023-03-21  2:54         ` zhuyinbo
2023-03-21 12:08           ` Mark Brown
2023-03-23 12:46             ` zhuyinbo [this message]
2023-03-23 13:59               ` Mark Brown
2023-03-24  3:32                 ` zhuyinbo
2023-03-17 18:07   ` kernel test robot
2023-03-18  2:51     ` zhuyinbo
2023-03-18  3:21   ` kernel test robot
2023-03-18  7:10     ` zhuyinbo

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=2337f45f-c513-1b10-ccfc-766363c5fd02@loongson.cn \
    --to=zhuyinbo@loongson.cn \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=liupeibao@loongson.cn \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=lvjianmin@loongson.cn \
    --cc=robh+dt@kernel.org \
    --cc=wanghongliang@loongson.cn \
    /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.