Re: [PATCH 2/6] spi: rockchip: Preset cs-high and clk polarity in setup progress

From: Mark Brown
Date: Fri Feb 11 2022 - 06:24:38 EST


On Fri, Feb 11, 2022 at 11:43:38AM +0800, Jon Lin wrote:

> +static int rockchip_spi_setup(struct spi_device *spi)
> +{
> + struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller);
> + u32 cr0;
> +
> + pm_runtime_get_sync(rs->dev);
> +
> + cr0 = readl_relaxed(rs->regs + ROCKCHIP_SPI_CTRLR0);
> +
> + cr0 |= ((spi->mode & 0x3) << CR0_SCPH_OFFSET);
> + if (spi->mode & SPI_CS_HIGH)
> + cr0 |= BIT(spi->chip_select) << CR0_SOI_OFFSET;

What ensures that this read/modify/write doesn't race with a transfer
running on another client device in the case where the controller has
more than one device connected? Similarly with the mode, though it's
not great to have devices with different modes connected to a single
controller.

Attachment: signature.asc
Description: PGP signature