Skip to contentSkip to conversation

tty: serial: bcm63xx_uart: do not depend on MIPS

PATCH In review Florian Fainelli 2 participants 7 messages Dec 6, 2013 – Dec 9, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover tty: serial: bcm63xx_uart: do not depend on MIPS

Hi all,

This patchset reduces the dependency of the bcm63xx_uart on the MIPS BCM63XX SoC support code in preparation for being used on different architectures such as ARM.

Due to the MIPS patch which breaks down the register defines, this series should ideally go via the MIPS tree.

Thanks!

Florian Fainelli (5):
tty: serial: bcm63xx_uart: remove unused inclusion
tty: serial: bcm63xx_uart: drop bcm_{readl,writel} macros
MIPS: BCM63XX: move UART register definitions
tty: serial: bcm63xx_uart: use linux/serial_bcm63xx.h
MIPS: BCM63XX: use linux/serial_bcm63xx.h

 arch/mips/bcm63xx/early_printk.c                  |   2 +-
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 120 ----------------------
 drivers/tty/serial/bcm63xx_uart.c                 |   9 +-
 include/linux/serial_bcm63xx.h                    | 119 +++++++++++++++++++++
 4 files changed, 123 insertions(+), 127 deletions(-)
 create mode 100644 include/linux/serial_bcm63xx.h
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/5 tty: serial: bcm63xx_uart: remove unused inclusion

bcm63xx_irqs.h is included but we are not using anything from it, drop that include.

---
 drivers/tty/serial/bcm63xx_uart.c | 1 -
 1 file changed, 1 deletion(-)
drivers/tty/serial/bcm63xx_uart.c +0 -1
index 649d512..2e72752 100644
@@ -30,7 +30,6 @@
 #include <linux/serial.h>
 #include <linux/serial_core.h>
 
-#include <bcm63xx_irq.h>
 #include <bcm63xx_regs.h>
 #include <bcm63xx_io.h>
 
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/5 tty: serial: bcm63xx_uart: drop bcm_{readl,writel} macros

In reply to Florian Fainelli

bcm_{readl,writel} macros expand to __raw_{readl,writel}, use these directly such that we do not rely on the platform to provide these for us. As a result, we no longer use bcm63xx_io.h, so remove that inclusion too.

---
 drivers/tty/serial/bcm63xx_uart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/bcm63xx_uart.c +2 -3
index 2e72752..6d773a3 100644
@@ -31,7 +31,6 @@
 #include <linux/serial_core.h>
 
 #include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
 
 #define BCM63XX_NR_UARTS	2
 
@@ -80,13 +79,13 @@ static struct uart_port ports[BCM63XX_NR_UARTS];
 static inline unsigned int bcm_uart_readl(struct uart_port *port,
 					 unsigned int offset)
 {
-	return bcm_readl(port->membase + offset);
+	return __raw_readl(port->membase + offset);
 }
 
 static inline void bcm_uart_writel(struct uart_port *port,
 				  unsigned int value, unsigned int offset)
 {
-	bcm_writel(value, port->membase + offset);
+	__raw_writel(value, port->membase + offset);
 }
 
 /*
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 3/5 MIPS: BCM63XX: move UART register definitions

In reply to Florian Fainelli

Move the BCM63XX UART driver definitions to include/linux/serial_bcm63xx.h such that we do not rely on the MIPS BCM63XX code to provide these for us.

---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 115 +--------------------
 include/linux/serial_bcm63xx.h                    | 119 ++++++++++++++++++++++
 2 files changed, 120 insertions(+), 114 deletions(-)
 create mode 100644 include/linux/serial_bcm63xx.h
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +1 -114
index 9875db3..96a2d2c 100644
@@ -466,120 +466,7 @@
  * _REG relative to RSET_UARTx
  *************************************************************************/
 
-/* UART Control Register */
-#define UART_CTL_REG			0x0
-#define UART_CTL_RXTMOUTCNT_SHIFT	0
-#define UART_CTL_RXTMOUTCNT_MASK	(0x1f << UART_CTL_RXTMOUTCNT_SHIFT)
-#define UART_CTL_RSTTXDN_SHIFT		5
-#define UART_CTL_RSTTXDN_MASK		(1 << UART_CTL_RSTTXDN_SHIFT)
-#define UART_CTL_RSTRXFIFO_SHIFT		6
-#define UART_CTL_RSTRXFIFO_MASK		(1 << UART_CTL_RSTRXFIFO_SHIFT)
-#define UART_CTL_RSTTXFIFO_SHIFT		7
-#define UART_CTL_RSTTXFIFO_MASK		(1 << UART_CTL_RSTTXFIFO_SHIFT)
-#define UART_CTL_STOPBITS_SHIFT		8
-#define UART_CTL_STOPBITS_MASK		(0xf << UART_CTL_STOPBITS_SHIFT)
-#define UART_CTL_STOPBITS_1		(0x7 << UART_CTL_STOPBITS_SHIFT)
-#define UART_CTL_STOPBITS_2		(0xf << UART_CTL_STOPBITS_SHIFT)
-#define UART_CTL_BITSPERSYM_SHIFT	12
-#define UART_CTL_BITSPERSYM_MASK	(0x3 << UART_CTL_BITSPERSYM_SHIFT)
-#define UART_CTL_XMITBRK_SHIFT		14
-#define UART_CTL_XMITBRK_MASK		(1 << UART_CTL_XMITBRK_SHIFT)
-#define UART_CTL_RSVD_SHIFT		15
-#define UART_CTL_RSVD_MASK		(1 << UART_CTL_RSVD_SHIFT)
-#define UART_CTL_RXPAREVEN_SHIFT		16
-#define UART_CTL_RXPAREVEN_MASK		(1 << UART_CTL_RXPAREVEN_SHIFT)
-#define UART_CTL_RXPAREN_SHIFT		17
-#define UART_CTL_RXPAREN_MASK		(1 << UART_CTL_RXPAREN_SHIFT)
-#define UART_CTL_TXPAREVEN_SHIFT		18
-#define UART_CTL_TXPAREVEN_MASK		(1 << UART_CTL_TXPAREVEN_SHIFT)
-#define UART_CTL_TXPAREN_SHIFT		18
-#define UART_CTL_TXPAREN_MASK		(1 << UART_CTL_TXPAREN_SHIFT)
-#define UART_CTL_LOOPBACK_SHIFT		20
-#define UART_CTL_LOOPBACK_MASK		(1 << UART_CTL_LOOPBACK_SHIFT)
-#define UART_CTL_RXEN_SHIFT		21
-#define UART_CTL_RXEN_MASK		(1 << UART_CTL_RXEN_SHIFT)
-#define UART_CTL_TXEN_SHIFT		22
-#define UART_CTL_TXEN_MASK		(1 << UART_CTL_TXEN_SHIFT)
-#define UART_CTL_BRGEN_SHIFT		23
-#define UART_CTL_BRGEN_MASK		(1 << UART_CTL_BRGEN_SHIFT)
-
-/* UART Baudword register */
-#define UART_BAUD_REG			0x4
-
-/* UART Misc Control register */
-#define UART_MCTL_REG			0x8
-#define UART_MCTL_DTR_SHIFT		0
-#define UART_MCTL_DTR_MASK		(1 << UART_MCTL_DTR_SHIFT)
-#define UART_MCTL_RTS_SHIFT		1
-#define UART_MCTL_RTS_MASK		(1 << UART_MCTL_RTS_SHIFT)
-#define UART_MCTL_RXFIFOTHRESH_SHIFT	8
-#define UART_MCTL_RXFIFOTHRESH_MASK	(0xf << UART_MCTL_RXFIFOTHRESH_SHIFT)
-#define UART_MCTL_TXFIFOTHRESH_SHIFT	12
-#define UART_MCTL_TXFIFOTHRESH_MASK	(0xf << UART_MCTL_TXFIFOTHRESH_SHIFT)
-#define UART_MCTL_RXFIFOFILL_SHIFT	16
-#define UART_MCTL_RXFIFOFILL_MASK	(0x1f << UART_MCTL_RXFIFOFILL_SHIFT)
-#define UART_MCTL_TXFIFOFILL_SHIFT	24
-#define UART_MCTL_TXFIFOFILL_MASK	(0x1f << UART_MCTL_TXFIFOFILL_SHIFT)
-
-/* UART External Input Configuration register */
-#define UART_EXTINP_REG			0xc
-#define UART_EXTINP_RI_SHIFT		0
-#define UART_EXTINP_RI_MASK		(1 << UART_EXTINP_RI_SHIFT)
-#define UART_EXTINP_CTS_SHIFT		1
-#define UART_EXTINP_CTS_MASK		(1 << UART_EXTINP_CTS_SHIFT)
-#define UART_EXTINP_DCD_SHIFT		2
-#define UART_EXTINP_DCD_MASK		(1 << UART_EXTINP_DCD_SHIFT)
-#define UART_EXTINP_DSR_SHIFT		3
-#define UART_EXTINP_DSR_MASK		(1 << UART_EXTINP_DSR_SHIFT)
-#define UART_EXTINP_IRSTAT(x)		(1 << (x + 4))
-#define UART_EXTINP_IRMASK(x)		(1 << (x + 8))
-#define UART_EXTINP_IR_RI		0
-#define UART_EXTINP_IR_CTS		1
-#define UART_EXTINP_IR_DCD		2
-#define UART_EXTINP_IR_DSR		3
-#define UART_EXTINP_RI_NOSENSE_SHIFT	16
-#define UART_EXTINP_RI_NOSENSE_MASK	(1 << UART_EXTINP_RI_NOSENSE_SHIFT)
-#define UART_EXTINP_CTS_NOSENSE_SHIFT	17
-#define UART_EXTINP_CTS_NOSENSE_MASK	(1 << UART_EXTINP_CTS_NOSENSE_SHIFT)
-#define UART_EXTINP_DCD_NOSENSE_SHIFT	18
-#define UART_EXTINP_DCD_NOSENSE_MASK	(1 << UART_EXTINP_DCD_NOSENSE_SHIFT)
-#define UART_EXTINP_DSR_NOSENSE_SHIFT	19
-#define UART_EXTINP_DSR_NOSENSE_MASK	(1 << UART_EXTINP_DSR_NOSENSE_SHIFT)
-
-/* UART Interrupt register */
-#define UART_IR_REG			0x10
-#define UART_IR_MASK(x)			(1 << (x + 16))
-#define UART_IR_STAT(x)			(1 << (x))
-#define UART_IR_EXTIP			0
-#define UART_IR_TXUNDER			1
-#define UART_IR_TXOVER			2
-#define UART_IR_TXTRESH			3
-#define UART_IR_TXRDLATCH		4
-#define UART_IR_TXEMPTY			5
-#define UART_IR_RXUNDER			6
-#define UART_IR_RXOVER			7
-#define UART_IR_RXTIMEOUT		8
-#define UART_IR_RXFULL			9
-#define UART_IR_RXTHRESH		10
-#define UART_IR_RXNOTEMPTY		11
-#define UART_IR_RXFRAMEERR		12
-#define UART_IR_RXPARERR		13
-#define UART_IR_RXBRK			14
-#define UART_IR_TXDONE			15
-
-/* UART Fifo register */
-#define UART_FIFO_REG			0x14
-#define UART_FIFO_VALID_SHIFT		0
-#define UART_FIFO_VALID_MASK		0xff
-#define UART_FIFO_FRAMEERR_SHIFT	8
-#define UART_FIFO_FRAMEERR_MASK		(1 << UART_FIFO_FRAMEERR_SHIFT)
-#define UART_FIFO_PARERR_SHIFT		9
-#define UART_FIFO_PARERR_MASK		(1 << UART_FIFO_PARERR_SHIFT)
-#define UART_FIFO_BRKDET_SHIFT		10
-#define UART_FIFO_BRKDET_MASK		(1 << UART_FIFO_BRKDET_SHIFT)
-#define UART_FIFO_ANYERR_MASK		(UART_FIFO_FRAMEERR_MASK |	\
-					UART_FIFO_PARERR_MASK |		\
-					UART_FIFO_BRKDET_MASK)
+#include <linux/serial_bcm63xx.h>
 
 
 /*************************************************************************
include/linux/serial_bcm63xx.h new file +119 -0

119 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 4/5 tty: serial: bcm63xx_uart: use linux/serial_bcm63xx.h

In reply to Florian Fainelli

Now that the UART block defines have been moved to a separate file, include that one and do not longer rely on the MIPS-specific bcm63xx_regs.h header file.

---
 drivers/tty/serial/bcm63xx_uart.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/bcm63xx_uart.c +1 -2
index 6d773a3..78e82b0 100644
@@ -29,8 +29,7 @@
 #include <linux/sysrq.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
-
-#include <bcm63xx_regs.h>
+#include <linux/serial_bcm63xx.h>
 
 #define BCM63XX_NR_UARTS	2
 
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH 5/5 MIPS: BCM63XX: use linux/serial_bcm63xx.h

In reply to Florian Fainelli

Update the early_printk code to include linux/serial_bcm63xx.h which provides the definitions for the UART block registers. While at it, remove the inclusion of serial_bcm63xx.h which was just there to allow smooth transition.

---
 arch/mips/bcm63xx/early_printk.c                  | 2 +-
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 7 -------
 2 files changed, 1 insertion(+), 8 deletions(-)
arch/mips/bcm63xx/early_printk.c +1 -1
index aa8f7f9..f92f1a2 100644
@@ -8,7 +8,7 @@
 
 #include <linux/init.h>
 #include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
+#include <linux/serial_bcm63xx.h>
 
 static void wait_xfered(void)
 {
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +0 -7
index 96a2d2c..ab427f8 100644
@@ -463,13 +463,6 @@
 #define WDT_SOFTRESET_REG		0xc
 
 /*************************************************************************
- * _REG relative to RSET_UARTx
- *************************************************************************/
-
-#include <linux/serial_bcm63xx.h>
-
-
-/*************************************************************************
  * _REG relative to RSET_GPIO
  *************************************************************************/
 
Signature · 1 line
1.8.3.2
maintainer Acked-by on the v1 series
#6 lore raw
In reply to Florian Fainelli
Quoted 8 lines · Florian Fainelli

Hi all,

This patchset reduces the dependency of the bcm63xx_uart on the MIPS BCM63XX SoC support code in preparation for being used on different architectures such as ARM.

Due to the MIPS patch which breaks down the register defines, this series should ideally go via the MIPS tree.

That's fine with me: