All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Chen-Yu Tsai <wens@csie.org>, Mark Brown <broonie@kernel.org>,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH 5/9] spi: spi-sun6i: sun6i_spi_drain_fifo(): introduce sun6i_spi_get_rx_fifo_count() and make use of it
Date: Mon, 6 Jul 2020 14:37:23 +0200	[thread overview]
Message-ID: <af79612a-b555-92f3-06d1-0548a075058e@pengutronix.de> (raw)
In-Reply-To: <20200706123621.lm4htzmwg4zn6xzv@gilmour.lan>

On 7/6/20 2:36 PM, Maxime Ripard wrote:
> 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@pengutronix.de>
>> ---
>>  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!

Will change in v2.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

WARNING: multiple messages have this Message-ID (diff)
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Chen-Yu Tsai <wens@csie.org>, Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH 5/9] spi: spi-sun6i: sun6i_spi_drain_fifo(): introduce sun6i_spi_get_rx_fifo_count() and make use of it
Date: Mon, 6 Jul 2020 14:37:23 +0200	[thread overview]
Message-ID: <af79612a-b555-92f3-06d1-0548a075058e@pengutronix.de> (raw)
In-Reply-To: <20200706123621.lm4htzmwg4zn6xzv@gilmour.lan>

On 7/6/20 2:36 PM, Maxime Ripard wrote:
> 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@pengutronix.de>
>> ---
>>  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!

Will change in v2.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-06 12:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  7:17 [PATCH 0/9] spi: spi-sun6i: One fix and some improvements Marc Kleine-Budde
2020-07-06  7:17 ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 1/9] spi: spi-sun6i: sun6i_spi_transfer_one(): fix setting of clock rate Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 2/9] spi: spi-sun6i: sun6i_spi_transfer_one(): report effectivly used speed_hz of transfer Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 3/9] spi: spi-sun6i: sun6i_spi_transfer_one(): remove useless goto Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 4/9] spi: spi-sun6i: sun6i_spi_transfer_one(): remove not needed masking of transfer length Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 5/9] spi: spi-sun6i: sun6i_spi_drain_fifo(): introduce sun6i_spi_get_rx_fifo_count() and make use of it Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06 12:36   ` Maxime Ripard
2020-07-06 12:36     ` Maxime Ripard
2020-07-06 12:37     ` Marc Kleine-Budde [this message]
2020-07-06 12:37       ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 6/9] spi: spi-sun6i: sun6i_spi_drain_fifo(): remove not needed length argument Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:17 ` [PATCH 7/9] spi: spi-sun6i: sun6i_spi_fill_fifo(): " Marc Kleine-Budde
2020-07-06  7:17   ` Marc Kleine-Budde
2020-07-06  7:18 ` [PATCH 8/9] spi: spi-sun6i: sun6i_spi_transfer_one(): collate write to Interrupt Control Register Marc Kleine-Budde
2020-07-06  7:18   ` Marc Kleine-Budde
2020-07-06  7:18 ` [PATCH 9/9] spi: spi-sun6i: sun6i_spi_transfer_one(): enable RF_RDY interrupt only if needed Marc Kleine-Budde
2020-07-06  7:18   ` Marc Kleine-Budde
2020-07-06 12:43 ` [PATCH 0/9] spi: spi-sun6i: One fix and some improvements Maxime Ripard
2020-07-06 12:43   ` Maxime Ripard

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=af79612a-b555-92f3-06d1-0548a075058e@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=wens@csie.org \
    /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.