[PATCH 4/7] serial: ns16550: add compatible entry for "ingenic, jz4740-uart"

Antony Pavlov antonynpavlov at gmail.com
Sat Mar 22 07:29:54 EDT 2014


Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/serial/serial_ns16550.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index aa0992f..7130871 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -257,6 +257,30 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 	.linux_console_name = "ttyO",
 };
 
+#define JZ_UART_SHIFT	2
+
+static void jz_serial_reg_write(unsigned int val, unsigned long base,
+	unsigned char reg_offset)
+{
+	switch (reg_offset) {
+	case (fcr << JZ_UART_SHIFT):
+		val |= 0x10; /* Enable uart module */
+		break;
+	case (ier << JZ_UART_SHIFT):
+		val |= (val & 0x4) << 2;
+		break;
+	default:
+		break;
+	}
+
+	writeb(val & 0xff, (void *)(base + reg_offset));
+}
+
+static __maybe_unused struct ns16550_drvdata jz_drvdata = {
+	.init_port = ns16550_serial_init_port,
+	.reg_write = jz_serial_reg_write,
+};
+
 /**
  * @brief Probe entry point -called on the first match for device
  *
@@ -351,6 +375,12 @@ static struct of_device_id ns16550_serial_dt_ids[] = {
 		.data = (unsigned long)&omap_drvdata,
 	},
 #endif
+#if IS_ENABLED(CONFIG_MACH_MIPS_XBURST)
+	{
+		.compatible = "ingenic,jz4740-uart",
+		.data = (unsigned long)&jz_drvdata,
+	},
+#endif
 	{
 		/* sentinel */
 	},
-- 
1.9.0




More information about the barebox mailing list