Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1188199

[PATCH] tty/serial: atmel: use proper accessors

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH] tty/serial: atmel: use proper accessors
Date 2015-07-20 16:00 +0200
Message-ID <pOjLQ-30h-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


On ARM, it is necessary to use the _relaxed versions of read[bl] and
write[bl] to ensure we do the correct endianness conversion when running in
big endian.
Keep using avr32 __raw version on avr32 to avoid breakage.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---

This patch applies after [PATCH v4 0/5] tty/serial: at91: add support to FIFOs
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/353704.html

 drivers/tty/serial/atmel_serial.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index e91b3b2f0590..451acf054281 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -194,6 +194,7 @@ to_atmel_uart_port(struct uart_port *uart)
 	return container_of(uart, struct atmel_uart_port, uart);
 }
 
+#ifdef CONFIG_AVR32
 static inline u32 atmel_uart_readl(struct uart_port *port, u32 reg)
 {
 	return __raw_readl(port->membase + reg);
@@ -213,6 +214,27 @@ static inline void atmel_uart_writeb(struct uart_port *port, u32 reg, u8 value)
 {
 	__raw_writeb(value, port->membase + reg);
 }
+#else
+static inline u32 atmel_uart_readl(struct uart_port *port, u32 reg)
+{
+	return readl_relaxed(port->membase + reg);
+}
+
+static inline void atmel_uart_writel(struct uart_port *port, u32 reg, u32 value)
+{
+	writel_relaxed(value, port->membase + reg);
+}
+
+static inline u8 atmel_uart_readb(struct uart_port *port, u32 reg)
+{
+	return readb_relaxed(port->membase + reg);
+}
+
+static inline void atmel_uart_writeb(struct uart_port *port, u32 reg, u8 value)
+{
+	writeb_relaxed(value, port->membase + reg);
+}
+#endif
 
 #ifdef CONFIG_SERIAL_ATMEL_PDC
 static bool atmel_use_pdc_rx(struct uart_port *port)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] tty/serial: atmel: use proper accessors Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2015-07-20 16:00 +0200

csiph-web