diff mbox

[09/13] spi: atmel: use endian agnostic IO

Message ID 1426693992-31163-10-git-send-email-ben.dooks@codethink.co.uk (mailing list archive)
State Accepted
Commit ea467326e36b496a92c677cbbed1dfd03b707aaf
Headers show

Commit Message

Ben Dooks March 18, 2015, 3:53 p.m. UTC
Use the endian agnositc IO functions instead of the __raw ones for when
the driver is in use on big-endian systems.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Nicolas Ferre <nicolas.ferre@atmel.com> (supporter:ATMEL SPI DRIVER)
CC: Mark Brown <broonie@kernel.org> (maintainer:SPI SUBSYSTEM)
CC: linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM)
---
 drivers/spi/spi-atmel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Mark Brown March 19, 2015, 12:56 a.m. UTC | #1
On Wed, Mar 18, 2015 at 03:53:08PM +0000, Ben Dooks wrote:
> Use the endian agnositc IO functions instead of the __raw ones for when
> the driver is in use on big-endian systems.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

I'm not CCed on either the cover letter or the rest of the series: are
there any dependencies here or is it safe to apply this by itself?
Nicolas Ferre March 19, 2015, 8:53 a.m. UTC | #2
Le 18/03/2015 16:53, Ben Dooks a écrit :
> Use the endian agnositc IO functions instead of the __raw ones for when
> the driver is in use on big-endian systems.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Looks good to me:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Mark,
There is no dependency on the series, so you can take this one right now.

Bye.

> --
> CC: Nicolas Ferre <nicolas.ferre@atmel.com> (supporter:ATMEL SPI DRIVER)
> CC: Mark Brown <broonie@kernel.org> (maintainer:SPI SUBSYSTEM)
> CC: linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM)
> ---
>  drivers/spi/spi-atmel.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 06de340..a2f40b1 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -180,11 +180,17 @@
>  	  | SPI_BF(name, value))
>  
>  /* Register access macros */
> +#ifdef CONFIG_AVR32
>  #define spi_readl(port, reg) \
>  	__raw_readl((port)->regs + SPI_##reg)
>  #define spi_writel(port, reg, value) \
>  	__raw_writel((value), (port)->regs + SPI_##reg)
> -
> +#else
> +#define spi_readl(port, reg) \
> +	readl_relaxed((port)->regs + SPI_##reg)
> +#define spi_writel(port, reg, value) \
> +	writel_relaxed((value), (port)->regs + SPI_##reg)
> +#endif
>  /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
>   * cache operations; better heuristics consider wordsize and bitrate.
>   */
>
Mark Brown March 22, 2015, 6:01 p.m. UTC | #3
On Wed, Mar 18, 2015 at 03:53:08PM +0000, Ben Dooks wrote:
> Use the endian agnositc IO functions instead of the __raw ones for when
> the driver is in use on big-endian systems.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> --
> CC: Nicolas Ferre <nicolas.ferre@atmel.com> (supporter:ATMEL SPI DRIVER)
> CC: Mark Brown <broonie@kernel.org> (maintainer:SPI SUBSYSTEM)
> CC: linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM)

Applied, thanks.  If you don't want things to go into the message then
they should be after --- not --.
diff mbox

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 06de340..a2f40b1 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -180,11 +180,17 @@ 
 	  | SPI_BF(name, value))
 
 /* Register access macros */
+#ifdef CONFIG_AVR32
 #define spi_readl(port, reg) \
 	__raw_readl((port)->regs + SPI_##reg)
 #define spi_writel(port, reg, value) \
 	__raw_writel((value), (port)->regs + SPI_##reg)
-
+#else
+#define spi_readl(port, reg) \
+	readl_relaxed((port)->regs + SPI_##reg)
+#define spi_writel(port, reg, value) \
+	writel_relaxed((value), (port)->regs + SPI_##reg)
+#endif
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
  * cache operations; better heuristics consider wordsize and bitrate.
  */