All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] add avr32/at91 on-chip iO accessors
@ 2015-03-26 11:45 Ben Dooks
  2015-03-26 11:45 ` [RFC 1/6] atmel: add atmel_io.h Ben Dooks
                   ` (6 more replies)
  0 siblings, 7 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

As discussed from Ben Hutchings' suggestion on the original series,
avoid open coding the AVR32/AT91 IO accessors.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 1/6] atmel: add atmel_io.h
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
@ 2015-03-26 11:45 ` Ben Dooks
  2015-03-26 11:51   ` Hans-Christian Egtvedt
  2015-03-26 11:45   ` Ben Dooks
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

The AVR32 and ARM (AT91) architectures share a number of drivers which
need to access the on chip peripherals. The current drivers work with
the default endian configuration, however it is possilbe to run some of
the ATMEL ARM architectures in big endian mode.

If we change the drivers from __raw to _relaxed IO accesors then the ARM
side works but the AVR32 will not. The _relaxed assume the bus is little
endian and the __raw are native. The AVR32 is native big endian so these
are not the right functions.

To sort this out, and avoid a number of drivers having #ifdef for the
AVR32 case we add <linux/atmel_io.h> to provide some AT91/AVR32 independant
IO accessor functions.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Haavard Skinnemoen <hskinnemoen@gmail.com>
CC: Hans-Christian Egtvedt <egtvedt@samfundet.no>
CC: Andrew Victor <linux@maxim.org.za>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: linux-arm-kernel at lists.infradead.org
---
 include/linux/atmel_io.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 include/linux/atmel_io.h

diff --git a/include/linux/atmel_io.h b/include/linux/atmel_io.h
new file mode 100644
index 0000000..1234e88
--- /dev/null
+++ b/include/linux/atmel_io.h
@@ -0,0 +1,25 @@
+/* Atmel AT91/AVR32 independant IO
+ *
+ * Copyright 2015 Codethink Ltd.
+ * Ben Dooks <ben.dooks@codethink.co.uk>
+ *
+ * Provide architecture indendant, endian-safe IO accessor functions
+ */
+
+#ifdef CONFIG_AVR32
+/* For AVR32 the readl and writel relaxed will do an extra byte reverse
+ * as the peripherals are already in the same endian-ness as the CPU and
+ * readl/writel assume little endian where the CPU is big endian
+ */
+#define atmel_oc_readl	__raw_readl
+#define atmel_oc_writel	__raw_writel
+
+#define atmel_oc_readw	__raw_readw
+#define atmel_oc_writew	__raw_writew
+#else
+#define atmel_oc_readl	readl_relaxed
+#define atmel_oc_writel	writel_relaxed
+
+#define atmel_oc_readw	readw_relaxed
+#define atmel_oc_writew	writew_relaxed
+#endif
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 2/6] tty: serial: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
@ 2015-03-26 11:45   ` Ben Dooks
  2015-03-26 11:45   ` Ben Dooks
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, nicolas.ferre, Ben Dooks, linux-serial,
	hskinnemoen, Jiri Slaby, linux, linux-arm-kernel, egtvedt

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Jiri Slaby <jslaby@suse.cz>
CC: linux-serial@vger.kernel.org
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
---
 drivers/tty/serial/atmel_serial.c | 63 +++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 35 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 40ef95f..eed0700 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -38,6 +38,7 @@
 #include <linux/of_gpio.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
+#include <linux/atmel_io.h>
 #include <linux/atmel_pdc.h>
 #include <linux/atmel_serial.h>
 #include <linux/uaccess.h>
@@ -88,44 +89,36 @@ static void atmel_stop_rx(struct uart_port *port);
 
 #define ATMEL_ISR_PASS_LIMIT	256
 
-#ifdef CONFIG_AVR32
-#define __atserial_writel	__raw_writel
-#define __atserial_readl	__raw_readl
-#else
-#define __atserial_writel	writel_relaxed
-#define __atserial_readl	readl_relaxed
-#endif
-
 /* UART registers. CR is write-only, hence no GET macro */
-#define UART_PUT_CR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_CR)
-#define UART_GET_MR(port)	__atserial_readl((port)->membase + ATMEL_US_MR)
-#define UART_PUT_MR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_MR)
-#define UART_PUT_IER(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_IER)
-#define UART_PUT_IDR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_IDR)
-#define UART_GET_IMR(port)	__atserial_readl((port)->membase + ATMEL_US_IMR)
-#define UART_GET_CSR(port)	__atserial_readl((port)->membase + ATMEL_US_CSR)
-#define UART_GET_CHAR(port)	__atserial_readl((port)->membase + ATMEL_US_RHR)
-#define UART_PUT_CHAR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_THR)
-#define UART_GET_BRGR(port)	__atserial_readl((port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_BRGR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_RTOR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_RTOR)
-#define UART_PUT_TTGR(port, v)	__atserial_writel(v, (port)->membase + ATMEL_US_TTGR)
-#define UART_GET_IP_NAME(port)	__atserial_readl((port)->membase + ATMEL_US_NAME)
-#define UART_GET_IP_VERSION(port) __atserial_readl((port)->membase + ATMEL_US_VERSION)
+#define UART_PUT_CR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_CR)
+#define UART_GET_MR(port)	atmel_oc_readl((port)->membase + ATMEL_US_MR)
+#define UART_PUT_MR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_MR)
+#define UART_PUT_IER(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_IER)
+#define UART_PUT_IDR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_IDR)
+#define UART_GET_IMR(port)	atmel_oc_readl((port)->membase + ATMEL_US_IMR)
+#define UART_GET_CSR(port)	atmel_oc_readl((port)->membase + ATMEL_US_CSR)
+#define UART_GET_CHAR(port)	atmel_oc_readl((port)->membase + ATMEL_US_RHR)
+#define UART_PUT_CHAR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_THR)
+#define UART_GET_BRGR(port)	atmel_oc_readl((port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_BRGR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_RTOR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_RTOR)
+#define UART_PUT_TTGR(port, v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_TTGR)
+#define UART_GET_IP_NAME(port)	atmel_oc_readl((port)->membase + ATMEL_US_NAME)
+#define UART_GET_IP_VERSION(port) atmel_oc_readl((port)->membase + ATMEL_US_VERSION)
 
  /* PDC registers */
-#define UART_PUT_PTCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_PTCR)
-#define UART_GET_PTSR(port)	__atserial_readl((port)->membase + ATMEL_PDC_PTSR)
-
-#define UART_PUT_RPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RPR)
-#define UART_GET_RPR(port)	__atserial_readl((port)->membase + ATMEL_PDC_RPR)
-#define UART_PUT_RCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RCR)
-#define UART_PUT_RNPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RNPR)
-#define UART_PUT_RNCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RNCR)
-
-#define UART_PUT_TPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_TPR)
-#define UART_PUT_TCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_TCR)
-#define UART_GET_TCR(port)	__atserial_readl((port)->membase + ATMEL_PDC_TCR)
+#define UART_PUT_PTCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_PTCR)
+#define UART_GET_PTSR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_PTSR)
+
+#define UART_PUT_RPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RPR)
+#define UART_GET_RPR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_RPR)
+#define UART_PUT_RCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RCR)
+#define UART_PUT_RNPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RNPR)
+#define UART_PUT_RNCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RNCR)
+
+#define UART_PUT_TPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_TPR)
+#define UART_PUT_TCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_TCR)
+#define UART_GET_TCR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_TCR)
 
 struct atmel_dma_buffer {
 	unsigned char	*buf;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 2/6] tty: serial: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:45   ` Ben Dooks
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Jiri Slaby <jslaby@suse.cz>
CC: linux-serial at vger.kernel.org
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
---
 drivers/tty/serial/atmel_serial.c | 63 +++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 35 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 40ef95f..eed0700 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -38,6 +38,7 @@
 #include <linux/of_gpio.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
+#include <linux/atmel_io.h>
 #include <linux/atmel_pdc.h>
 #include <linux/atmel_serial.h>
 #include <linux/uaccess.h>
@@ -88,44 +89,36 @@ static void atmel_stop_rx(struct uart_port *port);
 
 #define ATMEL_ISR_PASS_LIMIT	256
 
-#ifdef CONFIG_AVR32
-#define __atserial_writel	__raw_writel
-#define __atserial_readl	__raw_readl
-#else
-#define __atserial_writel	writel_relaxed
-#define __atserial_readl	readl_relaxed
-#endif
-
 /* UART registers. CR is write-only, hence no GET macro */
-#define UART_PUT_CR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_CR)
-#define UART_GET_MR(port)	__atserial_readl((port)->membase + ATMEL_US_MR)
-#define UART_PUT_MR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_MR)
-#define UART_PUT_IER(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_IER)
-#define UART_PUT_IDR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_IDR)
-#define UART_GET_IMR(port)	__atserial_readl((port)->membase + ATMEL_US_IMR)
-#define UART_GET_CSR(port)	__atserial_readl((port)->membase + ATMEL_US_CSR)
-#define UART_GET_CHAR(port)	__atserial_readl((port)->membase + ATMEL_US_RHR)
-#define UART_PUT_CHAR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_THR)
-#define UART_GET_BRGR(port)	__atserial_readl((port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_BRGR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_RTOR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_US_RTOR)
-#define UART_PUT_TTGR(port, v)	__atserial_writel(v, (port)->membase + ATMEL_US_TTGR)
-#define UART_GET_IP_NAME(port)	__atserial_readl((port)->membase + ATMEL_US_NAME)
-#define UART_GET_IP_VERSION(port) __atserial_readl((port)->membase + ATMEL_US_VERSION)
+#define UART_PUT_CR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_CR)
+#define UART_GET_MR(port)	atmel_oc_readl((port)->membase + ATMEL_US_MR)
+#define UART_PUT_MR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_MR)
+#define UART_PUT_IER(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_IER)
+#define UART_PUT_IDR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_IDR)
+#define UART_GET_IMR(port)	atmel_oc_readl((port)->membase + ATMEL_US_IMR)
+#define UART_GET_CSR(port)	atmel_oc_readl((port)->membase + ATMEL_US_CSR)
+#define UART_GET_CHAR(port)	atmel_oc_readl((port)->membase + ATMEL_US_RHR)
+#define UART_PUT_CHAR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_THR)
+#define UART_GET_BRGR(port)	atmel_oc_readl((port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_BRGR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_RTOR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_RTOR)
+#define UART_PUT_TTGR(port, v)	atmel_oc_writel(v, (port)->membase + ATMEL_US_TTGR)
+#define UART_GET_IP_NAME(port)	atmel_oc_readl((port)->membase + ATMEL_US_NAME)
+#define UART_GET_IP_VERSION(port) atmel_oc_readl((port)->membase + ATMEL_US_VERSION)
 
  /* PDC registers */
-#define UART_PUT_PTCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_PTCR)
-#define UART_GET_PTSR(port)	__atserial_readl((port)->membase + ATMEL_PDC_PTSR)
-
-#define UART_PUT_RPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RPR)
-#define UART_GET_RPR(port)	__atserial_readl((port)->membase + ATMEL_PDC_RPR)
-#define UART_PUT_RCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RCR)
-#define UART_PUT_RNPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RNPR)
-#define UART_PUT_RNCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_RNCR)
-
-#define UART_PUT_TPR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_TPR)
-#define UART_PUT_TCR(port,v)	__atserial_writel(v, (port)->membase + ATMEL_PDC_TCR)
-#define UART_GET_TCR(port)	__atserial_readl((port)->membase + ATMEL_PDC_TCR)
+#define UART_PUT_PTCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_PTCR)
+#define UART_GET_PTSR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_PTSR)
+
+#define UART_PUT_RPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RPR)
+#define UART_GET_RPR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_RPR)
+#define UART_PUT_RCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RCR)
+#define UART_PUT_RNPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RNPR)
+#define UART_PUT_RNCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_RNCR)
+
+#define UART_PUT_TPR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_TPR)
+#define UART_PUT_TCR(port,v)	atmel_oc_writel(v, (port)->membase + ATMEL_PDC_TCR)
+#define UART_GET_TCR(port)	atmel_oc_readl((port)->membase + ATMEL_PDC_TCR)
 
 struct atmel_dma_buffer {
 	unsigned char	*buf;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 3/6] clocksource: tcb_clksrc: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
@ 2015-03-26 11:45   ` Ben Dooks
  2015-03-26 11:45   ` Ben Dooks
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: hskinnemoen, egtvedt, linux, nicolas.ferre, linux-arm-kernel,
	Ben Dooks, Daniel Lezcano, Thomas Gleixner, Linux Kernel,
	Jean-Christophe Plagniol-Villard

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Linux Kernel <linux-kernel@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Andrew Victor <linux@maxim.org.za>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/clocksource/tcb_clksrc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 0f819dd3..b25416d 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -9,6 +9,7 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/atmel_io.h>
 #include <linux/atmel_tc.h>
 
 
@@ -41,13 +42,8 @@
 
 static void __iomem *tcaddr;
 
-#ifdef CONFIG_AVR32
-#define tcb_readl	__raw_readl
-#define tcb_writel	__raw_writel
-#else
-#define tcb_readl	readl_relaxed
-#define tcb_writel	writel_relaxed
-#endif
+#define tcb_readl	atmel_oc_readl
+#define tcb_writel	atmel_oc_writel
 
 static cycle_t tc_get_cycles(struct clocksource *cs)
 {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 3/6] clocksource: tcb_clksrc: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:45   ` Ben Dooks
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Linux Kernel <linux-kernel@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Andrew Victor <linux@maxim.org.za>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/clocksource/tcb_clksrc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 0f819dd3..b25416d 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -9,6 +9,7 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/atmel_io.h>
 #include <linux/atmel_tc.h>
 
 
@@ -41,13 +42,8 @@
 
 static void __iomem *tcaddr;
 
-#ifdef CONFIG_AVR32
-#define tcb_readl	__raw_readl
-#define tcb_writel	__raw_writel
-#else
-#define tcb_readl	readl_relaxed
-#define tcb_writel	writel_relaxed
-#endif
+#define tcb_readl	atmel_oc_readl
+#define tcb_writel	atmel_oc_writel
 
 static cycle_t tc_get_cycles(struct clocksource *cs)
 {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
@ 2015-03-26 11:45     ` Ben Dooks
  2015-03-26 11:45   ` Ben Dooks
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO
  Cc: hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
	egtvedt-BrfabpQBY5qlHtIdYg32fQ, linux-PelNFVqkFnVyf+4FbqDuWQ,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Dooks,
	Mark Brown, open list:SPI SUBSYSTEM

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
--
CC: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> (supporter:ATMEL SPI DRIVER)
CC: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> (maintainer:SPI SUBSYSTEM)
CC: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (open list:SPI SUBSYSTEM)
CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
---
 drivers/spi/spi-atmel.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index a2f40b1..f10cc75 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -25,6 +25,7 @@
 
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/atmel_io.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 
@@ -180,17 +181,11 @@
 	  | SPI_BF(name, value))
 
 /* Register access macros */
-#ifdef CONFIG_AVR32
 #define spi_readl(port, reg) \
-	__raw_readl((port)->regs + SPI_##reg)
+	atmel_oc_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
+	atmel_oc_writel((value), (port)->regs + SPI_##reg)
+
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
  * cache operations; better heuristics consider wordsize and bitrate.
  */
-- 
2.1.4

--
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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:45     ` Ben Dooks
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

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 at vger.kernel.org (open list:SPI SUBSYSTEM)
CC: linux-arm-kernel at lists.infradead.org
---
 drivers/spi/spi-atmel.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index a2f40b1..f10cc75 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -25,6 +25,7 @@
 
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/atmel_io.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 
@@ -180,17 +181,11 @@
 	  | SPI_BF(name, value))
 
 /* Register access macros */
-#ifdef CONFIG_AVR32
 #define spi_readl(port, reg) \
-	__raw_readl((port)->regs + SPI_##reg)
+	atmel_oc_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
+	atmel_oc_writel((value), (port)->regs + SPI_##reg)
+
 /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
  * cache operations; better heuristics consider wordsize and bitrate.
  */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
                   ` (3 preceding siblings ...)
       [not found] ` <1427370354-21247-1-git-send-email-ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
@ 2015-03-26 11:45 ` Ben Dooks
  2015-03-26 11:56   ` Hans-Christian Egtvedt
  2015-03-26 11:45   ` Ben Dooks
  2015-03-27 17:36 ` [Linux-kernel] [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
  6 siblings, 1 reply; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Felipe Balbi <balbi@ti.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: linux-usb at vger.kernel.org
---
 drivers/usb/gadget/udc/atmel_usba_udc.c |  1 +
 drivers/usb/gadget/udc/atmel_usba_udc.h | 12 +++---------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index be2f503..6735585 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/atmel_io.h>
 #include <linux/slab.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 92bd486..3d40aa3 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -191,15 +191,9 @@
 	 | USBA_BF(name, value))
 
 /* Register access macros */
-#ifdef CONFIG_AVR32
-#define usba_io_readl	__raw_readl
-#define usba_io_writel	__raw_writel
-#define usba_io_writew	__raw_writew
-#else
-#define usba_io_readl	readl_relaxed
-#define usba_io_writel	writel_relaxed
-#define usba_io_writew	writew_relaxed
-#endif
+#define usba_io_readl	atmel_oc_readl
+#define usba_io_writel	atmel_oc_writel
+#define usba_io_writew	atmel_oc_writew
 
 #define usba_readl(udc, reg)					\
 	usba_io_readl((udc)->regs + USBA_##reg)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 6/6] mmc: atmel-mci: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
@ 2015-03-26 11:45   ` Ben Dooks
  2015-03-26 11:45   ` Ben Dooks
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: hskinnemoen, egtvedt, linux, nicolas.ferre, linux-arm-kernel,
	Ben Dooks, Ludovic Desroches, Chris Ball, Ulf Hansson, linux-mmc

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Ludovic Desroches <ludovic.desroches@atmel.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/atmel-mci-regs.h | 11 ++---------
 drivers/mmc/host/atmel-mci.c      |  1 +
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h
index 711bb53..2293f2c 100644
--- a/drivers/mmc/host/atmel-mci-regs.h
+++ b/drivers/mmc/host/atmel-mci-regs.h
@@ -135,17 +135,10 @@
 #define ATMCI_REGS_SIZE		0x100
 
 /* Register access macros */
-#ifdef CONFIG_AVR32
 #define atmci_readl(port,reg)			\
-	__raw_readl((port)->regs + reg)
+	atmel_oc_readl((port)->regs + reg)
 #define atmci_writel(port,reg,value)			\
-	__raw_writel((value), (port)->regs + reg)
-#else
-#define atmci_readl(port,reg)			\
-	readl_relaxed((port)->regs + reg)
-#define atmci_writel(port,reg,value)			\
-	writel_relaxed((value), (port)->regs + reg)
-#endif
+	atmel_oc_writel((value), (port)->regs + reg)
 
 /* On AVR chips the Peripheral DMA Controller is not connected to MCI. */
 #ifdef CONFIG_AVR32
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 03d7c75..49de0d7 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -37,6 +37,7 @@
 
 #include <linux/atmel-mci.h>
 #include <linux/atmel_pdc.h>
+#include <linux/atmel_io.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/pinctrl/consumer.h>
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 6/6] mmc: atmel-mci: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:45   ` Ben Dooks
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-26 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Use <linux/atmel_io.h> to provide IO accessors which work on both
AVR32 and ARM for on-chip peripherals.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Ludovic Desroches <ludovic.desroches@atmel.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: linux-mmc at vger.kernel.org
---
 drivers/mmc/host/atmel-mci-regs.h | 11 ++---------
 drivers/mmc/host/atmel-mci.c      |  1 +
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h
index 711bb53..2293f2c 100644
--- a/drivers/mmc/host/atmel-mci-regs.h
+++ b/drivers/mmc/host/atmel-mci-regs.h
@@ -135,17 +135,10 @@
 #define ATMCI_REGS_SIZE		0x100
 
 /* Register access macros */
-#ifdef CONFIG_AVR32
 #define atmci_readl(port,reg)			\
-	__raw_readl((port)->regs + reg)
+	atmel_oc_readl((port)->regs + reg)
 #define atmci_writel(port,reg,value)			\
-	__raw_writel((value), (port)->regs + reg)
-#else
-#define atmci_readl(port,reg)			\
-	readl_relaxed((port)->regs + reg)
-#define atmci_writel(port,reg,value)			\
-	writel_relaxed((value), (port)->regs + reg)
-#endif
+	atmel_oc_writel((value), (port)->regs + reg)
 
 /* On AVR chips the Peripheral DMA Controller is not connected to MCI. */
 #ifdef CONFIG_AVR32
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 03d7c75..49de0d7 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -37,6 +37,7 @@
 
 #include <linux/atmel-mci.h>
 #include <linux/atmel_pdc.h>
+#include <linux/atmel_io.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/pinctrl/consumer.h>
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 1/6] atmel: add atmel_io.h
  2015-03-26 11:45 ` [RFC 1/6] atmel: add atmel_io.h Ben Dooks
@ 2015-03-26 11:51   ` Hans-Christian Egtvedt
  2015-03-28 18:20     ` Alexandre Belloni
  0 siblings, 1 reply; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:51 UTC (permalink / raw)
  To: linux-arm-kernel

Around Thu 26 Mar 2015 11:45:49 +0000 or thereabout, Ben Dooks wrote:
> The AVR32 and ARM (AT91) architectures share a number of drivers which
> need to access the on chip peripherals. The current drivers work with
> the default endian configuration, however it is possilbe to run some of
> the ATMEL ARM architectures in big endian mode.
> 
> If we change the drivers from __raw to _relaxed IO accesors then the ARM
> side works but the AVR32 will not. The _relaxed assume the bus is little
> endian and the __raw are native. The AVR32 is native big endian so these
> are not the right functions.
> 
> To sort this out, and avoid a number of drivers having #ifdef for the
> AVR32 case we add <linux/atmel_io.h> to provide some AT91/AVR32 independant
> IO accessor functions.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> --
> CC: Haavard Skinnemoen <hskinnemoen@gmail.com>
> CC: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> CC: linux-arm-kernel at lists.infradead.org
> ---
>  include/linux/atmel_io.h | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>  create mode 100644 include/linux/atmel_io.h
> 
> diff --git a/include/linux/atmel_io.h b/include/linux/atmel_io.h
> new file mode 100644
> index 0000000..1234e88
> --- /dev/null
> +++ b/include/linux/atmel_io.h
> @@ -0,0 +1,25 @@
> +/* Atmel AT91/AVR32 independant IO
> + *
> + * Copyright 2015 Codethink Ltd.
> + * Ben Dooks <ben.dooks@codethink.co.uk>
> + *
> + * Provide architecture indendant, endian-safe IO accessor functions
> + */
> +
> +#ifdef CONFIG_AVR32
> +/* For AVR32 the readl and writel relaxed will do an extra byte reverse
> + * as the peripherals are already in the same endian-ness as the CPU and
> + * readl/writel assume little endian where the CPU is big endian
> + */
> +#define atmel_oc_readl	__raw_readl
> +#define atmel_oc_writel	__raw_writel
> +
> +#define atmel_oc_readw	__raw_readw
> +#define atmel_oc_writew	__raw_writew
> +#else
> +#define atmel_oc_readl	readl_relaxed
> +#define atmel_oc_writel	writel_relaxed
> +
> +#define atmel_oc_readw	readw_relaxed
> +#define atmel_oc_writew	writew_relaxed
> +#endif
-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 3/6] clocksource: tcb_clksrc: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45   ` Ben Dooks
@ 2015-03-26 11:54     ` Hans-Christian Egtvedt
  -1 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:54 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, hskinnemoen, linux, nicolas.ferre,
	linux-arm-kernel, Daniel Lezcano, Thomas Gleixner, Linux Kernel,
	Jean-Christophe Plagniol-Villard

Around Thu 26 Mar 2015 11:45:51 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> --
> CC: Daniel Lezcano <daniel.lezcano@linaro.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Linux Kernel <linux-kernel@vger.kernel.org>
> CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> ---
>  drivers/clocksource/tcb_clksrc.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
> index 0f819dd3..b25416d 100644
> --- a/drivers/clocksource/tcb_clksrc.c
> +++ b/drivers/clocksource/tcb_clksrc.c
> @@ -9,6 +9,7 @@
>  #include <linux/ioport.h>
>  #include <linux/io.h>
>  #include <linux/platform_device.h>
> +#include <linux/atmel_io.h>
>  #include <linux/atmel_tc.h>
>  
>  
> @@ -41,13 +42,8 @@
>  
>  static void __iomem *tcaddr;
>  
> -#ifdef CONFIG_AVR32
> -#define tcb_readl	__raw_readl
> -#define tcb_writel	__raw_writel
> -#else
> -#define tcb_readl	readl_relaxed
> -#define tcb_writel	writel_relaxed
> -#endif
> +#define tcb_readl	atmel_oc_readl
> +#define tcb_writel	atmel_oc_writel

A note here is that we could replace these defines completely, and use the
atmel_oc_{read,write}{l,w} directly in the driver. That would be a nice
follow-up to this patch, first replace the defines to use the common
accessor, then replace the defines all together.

<snipp>

-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 3/6] clocksource: tcb_clksrc: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:54     ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:54 UTC (permalink / raw)
  To: linux-arm-kernel

Around Thu 26 Mar 2015 11:45:51 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> --
> CC: Daniel Lezcano <daniel.lezcano@linaro.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Linux Kernel <linux-kernel@vger.kernel.org>
> CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> ---
>  drivers/clocksource/tcb_clksrc.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
> index 0f819dd3..b25416d 100644
> --- a/drivers/clocksource/tcb_clksrc.c
> +++ b/drivers/clocksource/tcb_clksrc.c
> @@ -9,6 +9,7 @@
>  #include <linux/ioport.h>
>  #include <linux/io.h>
>  #include <linux/platform_device.h>
> +#include <linux/atmel_io.h>
>  #include <linux/atmel_tc.h>
>  
>  
> @@ -41,13 +42,8 @@
>  
>  static void __iomem *tcaddr;
>  
> -#ifdef CONFIG_AVR32
> -#define tcb_readl	__raw_readl
> -#define tcb_writel	__raw_writel
> -#else
> -#define tcb_readl	readl_relaxed
> -#define tcb_writel	writel_relaxed
> -#endif
> +#define tcb_readl	atmel_oc_readl
> +#define tcb_writel	atmel_oc_writel

A note here is that we could replace these defines completely, and use the
atmel_oc_{read,write}{l,w} directly in the driver. That would be a nice
follow-up to this patch, first replace the defines to use the common
accessor, then replace the defines all together.

<snipp>

-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45     ` Ben Dooks
@ 2015-03-26 11:55         ` Hans-Christian Egtvedt
  -1 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:55 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w, linux-PelNFVqkFnVyf+4FbqDuWQ,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mark Brown,
	open list:SPI SUBSYSTEM

Around Thu 26 Mar 2015 11:45:52 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>

Acked-by: Hans-Christian Egtvedt <egtvedt-BrfabpQBY5qlHtIdYg32fQ@public.gmane.org>

> --
> CC: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> (supporter:ATMEL SPI DRIVER)
> CC: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> (maintainer:SPI SUBSYSTEM)
> CC: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (open list:SPI SUBSYSTEM)
> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> ---
>  drivers/spi/spi-atmel.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

<snipp diff>

-- 
BR, HcE
--
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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:55         ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:55 UTC (permalink / raw)
  To: linux-arm-kernel

Around Thu 26 Mar 2015 11:45:52 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> --
> CC: Nicolas Ferre <nicolas.ferre@atmel.com> (supporter:ATMEL SPI DRIVER)
> CC: Mark Brown <broonie@kernel.org> (maintainer:SPI SUBSYSTEM)
> CC: linux-spi at vger.kernel.org (open list:SPI SUBSYSTEM)
> CC: linux-arm-kernel at lists.infradead.org
> ---
>  drivers/spi/spi-atmel.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

<snipp diff>

-- 
BR, HcE

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45 ` [RFC 5/6] usb: gadget: atmel_usba: " Ben Dooks
@ 2015-03-26 11:56   ` Hans-Christian Egtvedt
  2015-04-27 20:55     ` Felipe Balbi
  0 siblings, 1 reply; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:56 UTC (permalink / raw)
  To: linux-arm-kernel

Around Thu 26 Mar 2015 11:45:53 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> --
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> CC: Felipe Balbi <balbi@ti.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> CC: linux-usb at vger.kernel.org
> ---
>  drivers/usb/gadget/udc/atmel_usba_udc.c |  1 +
>  drivers/usb/gadget/udc/atmel_usba_udc.h | 12 +++---------
>  2 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index be2f503..6735585 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -13,6 +13,7 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/atmel_io.h>
>  #include <linux/slab.h>
>  #include <linux/device.h>
>  #include <linux/dma-mapping.h>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
> index 92bd486..3d40aa3 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.h
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
> @@ -191,15 +191,9 @@
>  	 | USBA_BF(name, value))
>  
>  /* Register access macros */
> -#ifdef CONFIG_AVR32
> -#define usba_io_readl	__raw_readl
> -#define usba_io_writel	__raw_writel
> -#define usba_io_writew	__raw_writew
> -#else
> -#define usba_io_readl	readl_relaxed
> -#define usba_io_writel	writel_relaxed
> -#define usba_io_writew	writew_relaxed
> -#endif
> +#define usba_io_readl	atmel_oc_readl
> +#define usba_io_writel	atmel_oc_writel
> +#define usba_io_writew	atmel_oc_writew

Same comment as earlier patch, it would be nice to remove the define
usba_io_{read,write}{l,w} defines in a follow-up patch.

<snipp diff>

-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 6/6] mmc: atmel-mci: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45   ` Ben Dooks
@ 2015-03-26 11:58     ` Hans-Christian Egtvedt
  -1 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:58 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, hskinnemoen, linux, nicolas.ferre,
	linux-arm-kernel, Ludovic Desroches, Chris Ball, Ulf Hansson,
	linux-mmc

Around Thu 26 Mar 2015 11:45:54 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> --
> CC: Ludovic Desroches <ludovic.desroches@atmel.com>
> CC: Chris Ball <chris@printf.net>
> CC: Ulf Hansson <ulf.hansson@linaro.org>
> CC: linux-mmc@vger.kernel.org
> ---
>  drivers/mmc/host/atmel-mci-regs.h | 11 ++---------
>  drivers/mmc/host/atmel-mci.c      |  1 +
>  2 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h
> index 711bb53..2293f2c 100644
> --- a/drivers/mmc/host/atmel-mci-regs.h
> +++ b/drivers/mmc/host/atmel-mci-regs.h
> @@ -135,17 +135,10 @@
>  #define ATMCI_REGS_SIZE		0x100
>  
>  /* Register access macros */
> -#ifdef CONFIG_AVR32
>  #define atmci_readl(port,reg)			\
> -	__raw_readl((port)->regs + reg)
> +	atmel_oc_readl((port)->regs + reg)
>  #define atmci_writel(port,reg,value)			\
> -	__raw_writel((value), (port)->regs + reg)
> -#else
> -#define atmci_readl(port,reg)			\
> -	readl_relaxed((port)->regs + reg)
> -#define atmci_writel(port,reg,value)			\
> -	writel_relaxed((value), (port)->regs + reg)
> -#endif
> +	atmel_oc_writel((value), (port)->regs + reg)

Defines are utilized in the header file, but ...

>  
>  /* On AVR chips the Peripheral DMA Controller is not connected to MCI. */
>  #ifdef CONFIG_AVR32
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 03d7c75..49de0d7 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -37,6 +37,7 @@
>  
>  #include <linux/atmel-mci.h>
>  #include <linux/atmel_pdc.h>
> +#include <linux/atmel_io.h>

... you include the required header file in the source file instead.

Also, a follow-up patch could remove the atmci_{read,write}{l,w} defines
completely.

>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/pinctrl/consumer.h>
-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 6/6] mmc: atmel-mci: use atmel_io.h to provide on-chip IO
@ 2015-03-26 11:58     ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 36+ messages in thread
From: Hans-Christian Egtvedt @ 2015-03-26 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Around Thu 26 Mar 2015 11:45:54 +0000 or thereabout, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> --
> CC: Ludovic Desroches <ludovic.desroches@atmel.com>
> CC: Chris Ball <chris@printf.net>
> CC: Ulf Hansson <ulf.hansson@linaro.org>
> CC: linux-mmc at vger.kernel.org
> ---
>  drivers/mmc/host/atmel-mci-regs.h | 11 ++---------
>  drivers/mmc/host/atmel-mci.c      |  1 +
>  2 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h
> index 711bb53..2293f2c 100644
> --- a/drivers/mmc/host/atmel-mci-regs.h
> +++ b/drivers/mmc/host/atmel-mci-regs.h
> @@ -135,17 +135,10 @@
>  #define ATMCI_REGS_SIZE		0x100
>  
>  /* Register access macros */
> -#ifdef CONFIG_AVR32
>  #define atmci_readl(port,reg)			\
> -	__raw_readl((port)->regs + reg)
> +	atmel_oc_readl((port)->regs + reg)
>  #define atmci_writel(port,reg,value)			\
> -	__raw_writel((value), (port)->regs + reg)
> -#else
> -#define atmci_readl(port,reg)			\
> -	readl_relaxed((port)->regs + reg)
> -#define atmci_writel(port,reg,value)			\
> -	writel_relaxed((value), (port)->regs + reg)
> -#endif
> +	atmel_oc_writel((value), (port)->regs + reg)

Defines are utilized in the header file, but ...

>  
>  /* On AVR chips the Peripheral DMA Controller is not connected to MCI. */
>  #ifdef CONFIG_AVR32
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 03d7c75..49de0d7 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -37,6 +37,7 @@
>  
>  #include <linux/atmel-mci.h>
>  #include <linux/atmel_pdc.h>
> +#include <linux/atmel_io.h>

... you include the required header file in the source file instead.

Also, a follow-up patch could remove the atmci_{read,write}{l,w} defines
completely.

>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/pinctrl/consumer.h>
-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45     ` Ben Dooks
@ 2015-03-26 15:38         ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 15:38 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
	egtvedt-BrfabpQBY5qlHtIdYg32fQ, linux-PelNFVqkFnVyf+4FbqDuWQ,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	open list:SPI SUBSYSTEM

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.

To repeat the feedback on your previous big endian fix: I've not been
CCed on the cover letter or any of the other patches so can someone tell
me if there are any dependencies or anything?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 15:38         ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 15:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.

To repeat the feedback on your previous big endian fix: I've not been
CCed on the cover letter or any of the other patches so can someone tell
me if there are any dependencies or anything?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150326/fd3c92b5/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 15:38         ` Mark Brown
@ 2015-03-26 15:41             ` Nicolas Ferre
  -1 siblings, 0 replies; 36+ messages in thread
From: Nicolas Ferre @ 2015-03-26 15:41 UTC (permalink / raw)
  To: Mark Brown, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
	egtvedt-BrfabpQBY5qlHtIdYg32fQ, linux-PelNFVqkFnVyf+4FbqDuWQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, SPI SUBSYSTEM,

Le 26/03/2015 16:38, Mark Brown a écrit :
> On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
>> Use <linux/atmel_io.h> to provide IO accessors which work on both
>> AVR32 and ARM for on-chip peripherals.
> 
> To repeat the feedback on your previous big endian fix: I've not been
> CCed on the cover letter or any of the other patches so can someone tell
> me if there are any dependencies or anything?

Yes, there is dependency on a common header file. So I think we should
keep the series grouped or plan a migration path.

Bye,
-- 
Nicolas Ferre
--
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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 15:41             ` Nicolas Ferre
  0 siblings, 0 replies; 36+ messages in thread
From: Nicolas Ferre @ 2015-03-26 15:41 UTC (permalink / raw)
  To: linux-arm-kernel

Le 26/03/2015 16:38, Mark Brown a ?crit :
> On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
>> Use <linux/atmel_io.h> to provide IO accessors which work on both
>> AVR32 and ARM for on-chip peripherals.
> 
> To repeat the feedback on your previous big endian fix: I've not been
> CCed on the cover letter or any of the other patches so can someone tell
> me if there are any dependencies or anything?

Yes, there is dependency on a common header file. So I think we should
keep the series grouped or plan a migration path.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 15:41             ` Nicolas Ferre
@ 2015-03-26 16:00                 ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 16:00 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
	egtvedt-BrfabpQBY5qlHtIdYg32fQ, linux-PelNFVqkFnVyf+4FbqDuWQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, SPI SUBSYSTEM,

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

On Thu, Mar 26, 2015 at 04:41:29PM +0100, Nicolas Ferre wrote:
> Le 26/03/2015 16:38, Mark Brown a écrit :

> > To repeat the feedback on your previous big endian fix: I've not been
> > CCed on the cover letter or any of the other patches so can someone tell
> > me if there are any dependencies or anything?

> Yes, there is dependency on a common header file. So I think we should
> keep the series grouped or plan a migration path.

OK, thanks for letting me know - Ben, if you're working on this stuff
*please* bear dependency issues like this in mind.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 16:00                 ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 16:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 04:41:29PM +0100, Nicolas Ferre wrote:
> Le 26/03/2015 16:38, Mark Brown a ?crit :

> > To repeat the feedback on your previous big endian fix: I've not been
> > CCed on the cover letter or any of the other patches so can someone tell
> > me if there are any dependencies or anything?

> Yes, there is dependency on a common header file. So I think we should
> keep the series grouped or plan a migration path.

OK, thanks for letting me know - Ben, if you're working on this stuff
*please* bear dependency issues like this in mind.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150326/44f78a79/attachment.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
  2015-03-26 11:45     ` Ben Dooks
@ 2015-03-26 16:01         ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 16:01 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w,
	egtvedt-BrfabpQBY5qlHtIdYg32fQ, linux-PelNFVqkFnVyf+4FbqDuWQ,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	open list:SPI SUBSYSTEM

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.

Acked-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 4/6] spi: atmel: use atmel_io.h to provide on-chip IO
@ 2015-03-26 16:01         ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2015-03-26 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 11:45:52AM +0000, Ben Dooks wrote:
> Use <linux/atmel_io.h> to provide IO accessors which work on both
> AVR32 and ARM for on-chip peripherals.

Acked-by: Mark Brown <broonie@kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150326/e6aaa420/attachment.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Linux-kernel] [RFC] add avr32/at91 on-chip iO accessors
  2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
                   ` (5 preceding siblings ...)
  2015-03-26 11:45   ` Ben Dooks
@ 2015-03-27 17:36 ` Ben Dooks
  6 siblings, 0 replies; 36+ messages in thread
From: Ben Dooks @ 2015-03-27 17:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/03/15 11:45, Ben Dooks wrote:
> As discussed from Ben Hutchings' suggestion on the original series,
> avoid open coding the AVR32/AT91 IO accessors.

I think the only thing to discuss is whether to use linux/atmel_io.h
or maybe put it under include/soc/atmel ?

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 1/6] atmel: add atmel_io.h
  2015-03-26 11:51   ` Hans-Christian Egtvedt
@ 2015-03-28 18:20     ` Alexandre Belloni
  2015-03-28 23:12       ` Russell King - ARM Linux
  0 siblings, 1 reply; 36+ messages in thread
From: Alexandre Belloni @ 2015-03-28 18:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 26/03/2015 at 12:51:23 +0100, Hans-Christian Egtvedt wrote :
> Around Thu 26 Mar 2015 11:45:49 +0000 or thereabout, Ben Dooks wrote:
> > The AVR32 and ARM (AT91) architectures share a number of drivers which
> > need to access the on chip peripherals. The current drivers work with
> > the default endian configuration, however it is possilbe to run some of
> > the ATMEL ARM architectures in big endian mode.
> > 
> > If we change the drivers from __raw to _relaxed IO accesors then the ARM
> > side works but the AVR32 will not. The _relaxed assume the bus is little
> > endian and the __raw are native. The AVR32 is native big endian so these
> > are not the right functions.
> > 
> > To sort this out, and avoid a number of drivers having #ifdef for the
> > AVR32 case we add <linux/atmel_io.h> to provide some AT91/AVR32 independant
> > IO accessor functions.
> > 
> > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> 
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> 

Is there any reason why read/write[bwl]_relaxed can't be made to do big
endian accesses on avr32?

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 1/6] atmel: add atmel_io.h
  2015-03-28 18:20     ` Alexandre Belloni
@ 2015-03-28 23:12       ` Russell King - ARM Linux
  0 siblings, 0 replies; 36+ messages in thread
From: Russell King - ARM Linux @ 2015-03-28 23:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 28, 2015 at 07:20:48PM +0100, Alexandre Belloni wrote:
> Hi,
> 
> On 26/03/2015 at 12:51:23 +0100, Hans-Christian Egtvedt wrote :
> > Around Thu 26 Mar 2015 11:45:49 +0000 or thereabout, Ben Dooks wrote:
> > > The AVR32 and ARM (AT91) architectures share a number of drivers which
> > > need to access the on chip peripherals. The current drivers work with
> > > the default endian configuration, however it is possilbe to run some of
> > > the ATMEL ARM architectures in big endian mode.
> > > 
> > > If we change the drivers from __raw to _relaxed IO accesors then the ARM
> > > side works but the AVR32 will not. The _relaxed assume the bus is little
> > > endian and the __raw are native. The AVR32 is native big endian so these
> > > are not the right functions.
> > > 
> > > To sort this out, and avoid a number of drivers having #ifdef for the
> > > AVR32 case we add <linux/atmel_io.h> to provide some AT91/AVR32 independant
> > > IO accessor functions.
> > > 
> > > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> > 
> > Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> > 
> 
> Is there any reason why read/write[bwl]_relaxed can't be made to do big
> endian accesses on avr32?

read/write[bwl]* are defined to be little endian accessors - they have
their roots in PCI.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-03-26 11:56   ` Hans-Christian Egtvedt
@ 2015-04-27 20:55     ` Felipe Balbi
  2015-04-28 15:40       ` Ben Dooks
  0 siblings, 1 reply; 36+ messages in thread
From: Felipe Balbi @ 2015-04-27 20:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 26, 2015 at 12:56:47PM +0100, Hans-Christian Egtvedt wrote:
> Around Thu 26 Mar 2015 11:45:53 +0000 or thereabout, Ben Dooks wrote:
> > Use <linux/atmel_io.h> to provide IO accessors which work on both
> > AVR32 and ARM for on-chip peripherals.
> > 
> > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> 
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> 
> > --
> > CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> > CC: Felipe Balbi <balbi@ti.com>
> > CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > CC: linux-usb at vger.kernel.org
> > ---
> >  drivers/usb/gadget/udc/atmel_usba_udc.c |  1 +
> >  drivers/usb/gadget/udc/atmel_usba_udc.h | 12 +++---------
> >  2 files changed, 4 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> > index be2f503..6735585 100644
> > --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> > +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> > @@ -13,6 +13,7 @@
> >  #include <linux/init.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/io.h>
> > +#include <linux/atmel_io.h>
> >  #include <linux/slab.h>
> >  #include <linux/device.h>
> >  #include <linux/dma-mapping.h>
> > diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
> > index 92bd486..3d40aa3 100644
> > --- a/drivers/usb/gadget/udc/atmel_usba_udc.h
> > +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
> > @@ -191,15 +191,9 @@
> >  	 | USBA_BF(name, value))
> >  
> >  /* Register access macros */
> > -#ifdef CONFIG_AVR32
> > -#define usba_io_readl	__raw_readl
> > -#define usba_io_writel	__raw_writel
> > -#define usba_io_writew	__raw_writew
> > -#else
> > -#define usba_io_readl	readl_relaxed
> > -#define usba_io_writel	writel_relaxed
> > -#define usba_io_writew	writew_relaxed
> > -#endif
> > +#define usba_io_readl	atmel_oc_readl
> > +#define usba_io_writel	atmel_oc_writel
> > +#define usba_io_writew	atmel_oc_writew
> 
> Same comment as earlier patch, it would be nice to remove the define
> usba_io_{read,write}{l,w} defines in a follow-up patch.

I'm fine with this too. Is this targetted at v4.2 ?

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150427/3e26756e/attachment.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-04-27 20:55     ` Felipe Balbi
@ 2015-04-28 15:40       ` Ben Dooks
  2015-04-28 16:22         ` Nicolas Ferre
  2015-04-28 16:30         ` Felipe Balbi
  0 siblings, 2 replies; 36+ messages in thread
From: Ben Dooks @ 2015-04-28 15:40 UTC (permalink / raw)
  To: linux-arm-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


>>> 
>>> /* Register access macros */ -#ifdef CONFIG_AVR32 -#define
>>> usba_io_readl	__raw_readl -#define usba_io_writel	__raw_writel 
>>> -#define usba_io_writew	__raw_writew -#else -#define
>>> usba_io_readl	readl_relaxed -#define usba_io_writel
>>> writel_relaxed -#define usba_io_writew	writew_relaxed -#endif 
>>> +#define usba_io_readl	atmel_oc_readl +#define usba_io_writel
>>> atmel_oc_writel +#define usba_io_writew	atmel_oc_writew
>> 
>> Same comment as earlier patch, it would be nice to remove the
>> define usba_io_{read,write}{l,w} defines in a follow-up patch.
> 
> I'm fine with this too. Is this targetted at v4.2 ?

Yes, although we may move it to the soc specific include directories
to avoid adding more to linux/

I will be sorting this out next week.

- -- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVP6neAAoJEMuhVOkVU3uz6tQH/jmZ0MszsoDjiKWdTnG+etoy
WUhAEdnmaqPEfJSaBy2OPCcmj9T1O07wg1L/2rHQHBrVuR9bW0gWY/TyJQahnn3A
YG81fgfIvOTAwmxIkaF10mG1/haG1LgPQ4P6j7AaKz09Zowath0rsga17AhYuUyh
bps4Go7yHF/OpjuwB9VxSttMAbVAIHqXbuc5kufN89JAxDT6x5tV/BrqkqEoHpSV
kW7VvGb/V4Aeax1h9klfdUEBlL2czkVuYYtTnicc9lFN3T9+6XJ+SNwKLtSklEr3
SLM78DoIQQoKYWCf8vsg0FR0E9LeR1ytgZXPfOpdAoId+iZt39tBk9bMi/XOiBo=
=ceej
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-04-28 15:40       ` Ben Dooks
@ 2015-04-28 16:22         ` Nicolas Ferre
  2015-04-28 16:30         ` Felipe Balbi
  1 sibling, 0 replies; 36+ messages in thread
From: Nicolas Ferre @ 2015-04-28 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

Le 28/04/2015 17:40, Ben Dooks a ?crit :
> 
>>>>
>>>> /* Register access macros */ -#ifdef CONFIG_AVR32 -#define
>>>> usba_io_readl	__raw_readl -#define usba_io_writel	__raw_writel 
>>>> -#define usba_io_writew	__raw_writew -#else -#define
>>>> usba_io_readl	readl_relaxed -#define usba_io_writel
>>>> writel_relaxed -#define usba_io_writew	writew_relaxed -#endif 
>>>> +#define usba_io_readl	atmel_oc_readl +#define usba_io_writel
>>>> atmel_oc_writel +#define usba_io_writew	atmel_oc_writew
>>>
>>> Same comment as earlier patch, it would be nice to remove the
>>> define usba_io_{read,write}{l,w} defines in a follow-up patch.
> 
>> I'm fine with this too. Is this targetted at v4.2 ?
> 
> Yes, although we may move it to the soc specific include directories
> to avoid adding more to linux/

BTW, Ben, what _oc_ stands for in the new macro name?

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-04-28 15:40       ` Ben Dooks
  2015-04-28 16:22         ` Nicolas Ferre
@ 2015-04-28 16:30         ` Felipe Balbi
  2015-04-28 16:34           ` Ben Dooks
  1 sibling, 1 reply; 36+ messages in thread
From: Felipe Balbi @ 2015-04-28 16:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Apr 28, 2015 at 04:40:14PM +0100, Ben Dooks wrote:
> >>> /* Register access macros */ -#ifdef CONFIG_AVR32 -#define
> >>> usba_io_readl	__raw_readl -#define usba_io_writel	__raw_writel 
> >>> -#define usba_io_writew	__raw_writew -#else -#define
> >>> usba_io_readl	readl_relaxed -#define usba_io_writel
> >>> writel_relaxed -#define usba_io_writew	writew_relaxed -#endif 
> >>> +#define usba_io_readl	atmel_oc_readl +#define usba_io_writel
> >>> atmel_oc_writel +#define usba_io_writew	atmel_oc_writew
> >> 
> >> Same comment as earlier patch, it would be nice to remove the
> >> define usba_io_{read,write}{l,w} defines in a follow-up patch.
> > 
> > I'm fine with this too. Is this targetted at v4.2 ?
> 
> Yes, although we may move it to the soc specific include directories
> to avoid adding more to linux/
> 
> I will be sorting this out next week.

I would rather not see drivers including anything from asm or mach-*
(unless strictly necessary), otherwise it's a pain to build-test
anything

cheers

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150428/736c6cb1/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-04-28 16:30         ` Felipe Balbi
@ 2015-04-28 16:34           ` Ben Dooks
  2015-04-28 16:34             ` Felipe Balbi
  0 siblings, 1 reply; 36+ messages in thread
From: Ben Dooks @ 2015-04-28 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 28/04/15 17:30, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Apr 28, 2015 at 04:40:14PM +0100, Ben Dooks wrote:
>>>>> /* Register access macros */ -#ifdef CONFIG_AVR32 -#define 
>>>>> usba_io_readl	__raw_readl -#define usba_io_writel
>>>>> __raw_writel -#define usba_io_writew	__raw_writew -#else
>>>>> -#define usba_io_readl	readl_relaxed -#define
>>>>> usba_io_writel writel_relaxed -#define usba_io_writew
>>>>> writew_relaxed -#endif +#define usba_io_readl
>>>>> atmel_oc_readl +#define usba_io_writel atmel_oc_writel
>>>>> +#define usba_io_writew	atmel_oc_writew
>>>> 
>>>> Same comment as earlier patch, it would be nice to remove
>>>> the define usba_io_{read,write}{l,w} defines in a follow-up
>>>> patch.
>>> 
>>> I'm fine with this too. Is this targetted at v4.2 ?
>> 
>> Yes, although we may move it to the soc specific include
>> directories to avoid adding more to linux/
>> 
>> I will be sorting this out next week.
> 
> I would rather not see drivers including anything from asm or
> mach-* (unless strictly necessary), otherwise it's a pain to
> build-test anything


Thanks. I think the soc/ include is available for all. I will check this
tomorrow.


- -- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVP7aBAAoJEMuhVOkVU3uzId4H/3ZsZ4Vogng63I04OpLtt5Qs
VopvttCvaLczye/wOWQKptXJuKIBmrs66BcV4ZsVi1SZjfbju9X1blzc0+6fxU9X
xE2rw3kDPZmtKm6v1GCRrE/uzhKeKgAnfp7Yf7pkdn98Lx2D9gy/s7GRN6Bkql28
pz/QIqr/H6Hp2frbubakKx/F7SFV88ZUNZXLkw8+vkn7gKGRX7ODcPFldjbjooIa
zyDdrZWiqhTHdWzQ813vNgKJfP1GiYNZuht+EhAh0ngLy0YnqnSXF0eZiOy/uF0Z
cCMlXZo1Q/2LkqVKEgywJDxGhCruT3RpPDWLk6eA9trlHF62j3WSn65nDxKtBwA=
=cqtq
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
  2015-04-28 16:34           ` Ben Dooks
@ 2015-04-28 16:34             ` Felipe Balbi
  0 siblings, 0 replies; 36+ messages in thread
From: Felipe Balbi @ 2015-04-28 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 28, 2015 at 05:34:09PM +0100, Ben Dooks wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 28/04/15 17:30, Felipe Balbi wrote:
> > Hi,
> > 
> > On Tue, Apr 28, 2015 at 04:40:14PM +0100, Ben Dooks wrote:
> >>>>> /* Register access macros */ -#ifdef CONFIG_AVR32 -#define 
> >>>>> usba_io_readl	__raw_readl -#define usba_io_writel
> >>>>> __raw_writel -#define usba_io_writew	__raw_writew -#else
> >>>>> -#define usba_io_readl	readl_relaxed -#define
> >>>>> usba_io_writel writel_relaxed -#define usba_io_writew
> >>>>> writew_relaxed -#endif +#define usba_io_readl
> >>>>> atmel_oc_readl +#define usba_io_writel atmel_oc_writel
> >>>>> +#define usba_io_writew	atmel_oc_writew
> >>>> 
> >>>> Same comment as earlier patch, it would be nice to remove
> >>>> the define usba_io_{read,write}{l,w} defines in a follow-up
> >>>> patch.
> >>> 
> >>> I'm fine with this too. Is this targetted at v4.2 ?
> >> 
> >> Yes, although we may move it to the soc specific include
> >> directories to avoid adding more to linux/
> >> 
> >> I will be sorting this out next week.
> > 
> > I would rather not see drivers including anything from asm or
> > mach-* (unless strictly necessary), otherwise it's a pain to
> > build-test anything
> 
> 
> Thanks. I think the soc/ include is available for all. I will check this
> tomorrow.

if that's the case, no issues from my side :-)

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150428/27cfa000/attachment.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2015-04-28 16:34 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 11:45 [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
2015-03-26 11:45 ` [RFC 1/6] atmel: add atmel_io.h Ben Dooks
2015-03-26 11:51   ` Hans-Christian Egtvedt
2015-03-28 18:20     ` Alexandre Belloni
2015-03-28 23:12       ` Russell King - ARM Linux
2015-03-26 11:45 ` [RFC 2/6] tty: serial: atmel: use atmel_io.h to provide on-chip IO Ben Dooks
2015-03-26 11:45   ` Ben Dooks
2015-03-26 11:45 ` [RFC 3/6] clocksource: tcb_clksrc: " Ben Dooks
2015-03-26 11:45   ` Ben Dooks
2015-03-26 11:54   ` Hans-Christian Egtvedt
2015-03-26 11:54     ` Hans-Christian Egtvedt
     [not found] ` <1427370354-21247-1-git-send-email-ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2015-03-26 11:45   ` [RFC 4/6] spi: atmel: " Ben Dooks
2015-03-26 11:45     ` Ben Dooks
     [not found]     ` <1427370354-21247-5-git-send-email-ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2015-03-26 11:55       ` Hans-Christian Egtvedt
2015-03-26 11:55         ` Hans-Christian Egtvedt
2015-03-26 15:38       ` Mark Brown
2015-03-26 15:38         ` Mark Brown
     [not found]         ` <20150326153855.GP3572-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-03-26 15:41           ` Nicolas Ferre
2015-03-26 15:41             ` Nicolas Ferre
     [not found]             ` <551428A9.9090604-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2015-03-26 16:00               ` Mark Brown
2015-03-26 16:00                 ` Mark Brown
2015-03-26 16:01       ` Mark Brown
2015-03-26 16:01         ` Mark Brown
2015-03-26 11:45 ` [RFC 5/6] usb: gadget: atmel_usba: " Ben Dooks
2015-03-26 11:56   ` Hans-Christian Egtvedt
2015-04-27 20:55     ` Felipe Balbi
2015-04-28 15:40       ` Ben Dooks
2015-04-28 16:22         ` Nicolas Ferre
2015-04-28 16:30         ` Felipe Balbi
2015-04-28 16:34           ` Ben Dooks
2015-04-28 16:34             ` Felipe Balbi
2015-03-26 11:45 ` [RFC 6/6] mmc: atmel-mci: " Ben Dooks
2015-03-26 11:45   ` Ben Dooks
2015-03-26 11:58   ` Hans-Christian Egtvedt
2015-03-26 11:58     ` Hans-Christian Egtvedt
2015-03-27 17:36 ` [Linux-kernel] [RFC] add avr32/at91 on-chip iO accessors Ben Dooks

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.