Re: [PATCH v1 2/2] spi: loongson: add bus driver for the loongson spi controller

From: Mark Brown
Date: Fri Mar 10 2023 - 07:56:33 EST


On Fri, Mar 10, 2023 at 06:01:23PM +0800, zhuyinbo wrote:
> 在 2023/3/8 下午11:03, Mark Brown 写道:
> > On Wed, Mar 08, 2023 at 10:59:08AM +0800, Yinbo Zhu wrote:

> > > + hz = t ? t->speed_hz : spi->max_speed_hz;

> > Please write normal conditional statements so that things are legible,
> > though in this case the core will ensure that there's a speed_hz in
> > every transfer so there's no need for any of the logic around ensuring
> > it's set.

> Do you mean to achieve the following ?  and drop spi->max_speed_hz.

> if (t)
>
>       hz = t->speed_hz;

Yes.

> > > + loongson_spi_update_state(loongson_spi, spi, NULL);
> > > + loongson_spi_set_cs(loongson_spi, spi, 1);

> > Note that setup() needs to be able to run for one device while there are
> > transfers for other devices on the same controller active.

> okay, I will add a spin_lock for it.

We also need to take care not to change the hardware
configuration for the currently running transfer (can't
remember if that's an issue here or not, but it's a common
one).

Attachment: signature.asc
Description: PGP signature