From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/6] tty: serial: atmel: use atmel_io.h to provide on-chip IO
Date: Thu, 26 Mar 2015 11:45:50 +0000 [thread overview]
Message-ID: <1427370354-21247-3-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1427370354-21247-1-git-send-email-ben.dooks@codethink.co.uk>
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
next prev parent reply other threads:[~2015-03-26 11:45 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Ben Dooks [this message]
2015-03-26 11:45 ` [RFC 3/6] clocksource: tcb_clksrc: use atmel_io.h to provide on-chip IO Ben Dooks
2015-03-26 11:54 ` Hans-Christian Egtvedt
2015-03-26 11:45 ` [RFC 4/6] spi: atmel: " Ben Dooks
2015-03-26 11:55 ` Hans-Christian Egtvedt
2015-03-26 15:38 ` Mark Brown
2015-03-26 15:41 ` Nicolas Ferre
2015-03-26 16:00 ` 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:58 ` Hans-Christian Egtvedt
2015-03-27 17:36 ` [Linux-kernel] [RFC] add avr32/at91 on-chip iO accessors Ben Dooks
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=1427370354-21247-3-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-arm-kernel@lists.infradead.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).