[RFC 06/18] MIPS: ar231x: add UART support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sergey Ryazanov <ryazanov.s.a@xxxxxxxxx>
---
 arch/mips/ar231x/ar2315.c  |  4 ++++
 arch/mips/ar231x/ar5312.c  |  4 ++++
 arch/mips/ar231x/devices.c | 17 +++++++++++++++++
 arch/mips/ar231x/devices.h |  2 ++
 4 files changed, 27 insertions(+)

diff --git a/arch/mips/ar231x/ar2315.c b/arch/mips/ar231x/ar2315.c
index e64aa16..94bab76 100644
--- a/arch/mips/ar231x/ar2315.c
+++ b/arch/mips/ar231x/ar2315.c
@@ -53,6 +53,8 @@ static void ar2315_misc_irq_handler(unsigned irq, struct irq_desc *desc)
 		generic_handle_irq(AR2315_MISC_IRQ_TIMER);
 	else if (pending & AR2315_ISR_AHB)
 		generic_handle_irq(AR2315_MISC_IRQ_AHB);
+	else if (pending & AR2315_ISR_UART0)
+		generic_handle_irq(AR2315_MISC_IRQ_UART0);
 	else
 		spurious_interrupt();
 }
@@ -207,6 +209,8 @@ void __init ar2315_plat_mem_setup(void)
 	ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION);
 
 	_machine_restart = ar2315_restart;
+	ar231x_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0,
+			    ar2315_apb_frequency());
 }
 
 void __init ar2315_prom_init(void)
diff --git a/arch/mips/ar231x/ar5312.c b/arch/mips/ar231x/ar5312.c
index c3abb13..35f7c71 100644
--- a/arch/mips/ar231x/ar5312.c
+++ b/arch/mips/ar231x/ar5312.c
@@ -55,6 +55,8 @@ static void ar5312_misc_irq_handler(unsigned irq, struct irq_desc *desc)
 		(void)ar231x_read_reg(AR5312_TIMER);
 	} else if (pending & AR5312_ISR_AHBPROC)
 		generic_handle_irq(AR5312_MISC_IRQ_AHB_PROC);
+	else if ((pending & AR5312_ISR_UART0))
+		generic_handle_irq(AR5312_MISC_IRQ_UART0);
 	else if (pending & AR5312_ISR_WD)
 		generic_handle_irq(AR5312_MISC_IRQ_WATCHDOG);
 	else
@@ -211,6 +213,8 @@ void __init ar5312_plat_mem_setup(void)
 	ar231x_write_reg(AR5312_WD_CTRL, AR5312_WD_CTRL_IGNORE_EXPIRATION);
 
 	_machine_restart = ar5312_restart;
+	ar231x_serial_setup(AR5312_UART0, AR5312_MISC_IRQ_UART0,
+			    ar5312_sys_frequency());
 }
 
 void __init ar5312_prom_init(void)
diff --git a/arch/mips/ar231x/devices.c b/arch/mips/ar231x/devices.c
index f71a643..3d650bb 100644
--- a/arch/mips/ar231x/devices.c
+++ b/arch/mips/ar231x/devices.c
@@ -1,5 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/serial_8250.h>
 #include <asm/bootinfo.h>
 
 #include "devices.h"
@@ -18,3 +19,19 @@ const char *get_system_type(void)
 	return devtype_strings[ar231x_devtype];
 }
 
+void __init ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
+{
+	struct uart_port s;
+
+	memset(&s, 0, sizeof(s));
+
+	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
+	s.iotype = UPIO_MEM32;
+	s.irq = irq;
+	s.regshift = 2;
+	s.mapbase = mapbase;
+	s.uartclk = uartclk;
+
+	early_serial_setup(&s);
+}
+
diff --git a/arch/mips/ar231x/devices.h b/arch/mips/ar231x/devices.h
index 82fa6fb..9f83150 100644
--- a/arch/mips/ar231x/devices.h
+++ b/arch/mips/ar231x/devices.h
@@ -10,6 +10,8 @@ enum {
 extern int ar231x_devtype;
 extern void (*ar231x_irq_dispatch)(void);
 
+void ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
+
 static inline bool is_2315(void)
 {
 	return (current_cpu_data.cputype == CPU_4KEC);
-- 
1.8.1.5



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux