Re: [PATCH 5/9] spi: spi-sun6i: sun6i_spi_drain_fifo(): introduce sun6i_spi_get_rx_fifo_count() and make use of it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 06, 2020 at 09:17:57AM +0200, Marc Kleine-Budde wrote:
> This patch introduces the function sun6i_spi_get_rx_fifo_count(), similar to
> the existing sun6i_spi_get_tx_fifo_count(), to make the sun6i_spi_drain_fifo()
> function a bit easier to read.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> ---
>  drivers/spi/spi-sun6i.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
> index 882492774986..f70d14229483 100644
> --- a/drivers/spi/spi-sun6i.c
> +++ b/drivers/spi/spi-sun6i.c
> @@ -106,6 +106,15 @@ static inline void sun6i_spi_write(struct sun6i_spi *sspi, u32 reg, u32 value)
>  	writel(value, sspi->base_addr + reg);
>  }
>  
> +static inline u32 sun6i_spi_get_rx_fifo_count(struct sun6i_spi *sspi)
> +{
> +	u32 reg = sun6i_spi_read(sspi, SUN6I_FIFO_STA_REG);
> +
> +	reg >>= SUN6I_FIFO_STA_RF_CNT_BITS;
> +
> +	return reg & SUN6I_FIFO_STA_RF_CNT_MASK;
> +}
> +

I guess we could just use FIELD_GET here?

Looks good otherwise, thanks!
Maxime




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux