linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Geert Uytterhoeven
	<geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 7/8] spi: rspi: Add support for specifying CPHA/CPOL
Date: Tue, 31 Dec 2013 00:53:03 +0100	[thread overview]
Message-ID: <15602504.DsQsiMiuEH@avalon> (raw)
In-Reply-To: <1387885248-28425-8-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>

Hi Geert,

Thank you for the patch.

On Tuesday 24 December 2013 12:40:47 Geert Uytterhoeven wrote:
> Add support for specifying the SPI clock phase and polarity, based on the
> SDK reference code.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>

Acked-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>

> ---
>  drivers/spi/spi-rspi.c |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
> index 34674fe6df5d..850025278519 100644
> --- a/drivers/spi/spi-rspi.c
> +++ b/drivers/spi/spi-rspi.c
> @@ -181,6 +181,7 @@ struct rspi_data {
>  	u8 spsr;
>  	u8 spdcr;
>  	u8 data_width;
> +	u16 spcmd;
>  	int irq[MAX_NUM_IRQ];
>  	unsigned int numirq;
>  	const struct spi_ops *ops;
> @@ -328,7 +329,7 @@ static int rspi_set_config_register(const struct
> rspi_data *rspi, rspi_write8(rspi, 0x00, RSPI_SPCR2);
> 
>  	/* Sets SPCMD */
> -	rspi_write16(rspi, SPCMD_SPB_8_TO_16(access_size) | SPCMD_SSLKP,
> +	rspi_write16(rspi, SPCMD_SPB_8_TO_16(access_size) | rspi->spcmd,
>  		     RSPI_SPCMD0);
> 
>  	/* Sets RSPI mode */
> @@ -383,7 +384,7 @@ static int qspi_set_config_register(const struct
> rspi_data *rspi, else
>  		spcmd = SPCMD_SPB_32BIT;
> 
> -	spcmd |= SPCMD_SCKDEN | SPCMD_SLNDEN | SPCMD_SSLKP | SPCMD_SPNDEN;
> +	spcmd |= SPCMD_SCKDEN | SPCMD_SLNDEN | rspi->spcmd | SPCMD_SPNDEN;
> 
>  	/* Resets transfer data length */
>  	rspi_write32(rspi, 0, QSPI_SPBMUL0);
> @@ -903,6 +904,12 @@ static int rspi_setup(struct spi_device *spi)
>  		spi->bits_per_word = 8;
>  	rspi->max_speed_hz = spi->max_speed_hz;
> 
> +	rspi->spcmd = SPCMD_SSLKP;
> +	if (spi->mode & SPI_CPOL)
> +		rspi->spcmd |= SPCMD_CPOL;
> +	if (spi->mode & SPI_CPHA)
> +		rspi->spcmd |= SPCMD_CPHA;
> +
>  	set_config_register(rspi, 8);
> 
>  	return 0;
> @@ -1092,6 +1099,7 @@ static int rspi_probe(struct platform_device *pdev)
>  	master->setup = rspi_setup;
>  	master->transfer = rspi_transfer;
>  	master->cleanup = rspi_cleanup;
> +	master->mode_bits = SPI_CPHA | SPI_CPOL;
> 
>  	for (i = 0; i < rspi->numirq; i++) {
>  		ret = devm_request_irq(&pdev->dev, rspi->irq[i], rspi_irq, 0,
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-12-30 23:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24 11:40 [PATCH 0/8] spi: rspi: Add prelimary support for RZ/A1H Geert Uytterhoeven
2013-12-24 11:40 ` [PATCH 2/8] spi: rspi: Add more QSPI register documentation Geert Uytterhoeven
     [not found]   ` <1387885248-28425-3-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:31     ` Laurent Pinchart
2013-12-24 11:40 ` [PATCH 3/8] spi: rspi: Add support for more than one interrupt Geert Uytterhoeven
     [not found]   ` <1387885248-28425-4-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:38     ` Laurent Pinchart
2014-01-02 10:25       ` Geert Uytterhoeven
     [not found] ` <1387885248-28425-1-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-24 11:40   ` [PATCH 1/8] spi: rspi: Add more RSPI register documentation Geert Uytterhoeven
     [not found]     ` <1387885248-28425-2-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:31       ` Laurent Pinchart
2013-12-24 11:40   ` [PATCH 4/8] spi: rspi: Add support for 8-bit Data Register access Geert Uytterhoeven
     [not found]     ` <1387885248-28425-5-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:47       ` Laurent Pinchart
2014-01-02 10:47         ` Geert Uytterhoeven
2013-12-24 11:40 ` [PATCH 5/8] spi: rspi: Add support for no TX only mode Geert Uytterhoeven
2013-12-24 11:40 ` [PATCH 6/8] spi: rspi: Add support for missing SPCR2 register Geert Uytterhoeven
     [not found]   ` <1387885248-28425-7-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:52     ` Laurent Pinchart
2013-12-24 11:40 ` [PATCH 7/8] spi: rspi: Add support for specifying CPHA/CPOL Geert Uytterhoeven
     [not found]   ` <1387885248-28425-8-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-12-30 23:53     ` Laurent Pinchart [this message]
2013-12-24 11:40 ` [PATCH 8/8] spi: rspi: Add support for loopback mode Geert Uytterhoeven
2013-12-27 19:22 ` [PATCH 0/8] spi: rspi: Add prelimary support for RZ/A1H Geert Uytterhoeven

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=15602504.DsQsiMiuEH@avalon \
    --to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
    --cc=geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).