summaryrefslogtreecommitdiffstats
path: root/arch/mips/ath25
diff options
context:
space:
mode:
authorSergey Ryazanov <ryazanov.s.a@gmail.com>2014-10-29 00:18:43 +0100
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 07:45:27 +0100
commit1ac91b1f686e9d819b16525baf2e8db3c282edba (patch)
tree22175fa726fe35b52f562f114a41a5eb80bcb6b6 /arch/mips/ath25
parentMIPS: ath25: add early printk support (diff)
downloadlinux-1ac91b1f686e9d819b16525baf2e8db3c282edba.tar.xz
linux-1ac91b1f686e9d819b16525baf2e8db3c282edba.zip
MIPS: ath25: add UART support
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> Cc: Linux MIPS <linux-mips@linux-mips.org> Patchwork: https://patchwork.linux-mips.org/patch/8242/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath25')
-rw-r--r--arch/mips/ath25/ar2315.c8
-rw-r--r--arch/mips/ath25/ar2315.h2
-rw-r--r--arch/mips/ath25/ar5312.c8
-rw-r--r--arch/mips/ath25/ar5312.h2
-rw-r--r--arch/mips/ath25/devices.c31
-rw-r--r--arch/mips/ath25/devices.h2
6 files changed, 53 insertions, 0 deletions
diff --git a/arch/mips/ath25/ar2315.c b/arch/mips/ath25/ar2315.c
index d92aa91ae75d..d10eac4cd828 100644
--- a/arch/mips/ath25/ar2315.c
+++ b/arch/mips/ath25/ar2315.c
@@ -267,3 +267,11 @@ void __init ar2315_plat_mem_setup(void)
_machine_restart = ar2315_restart;
}
+
+void __init ar2315_arch_init(void)
+{
+ unsigned irq = irq_create_mapping(ar2315_misc_irq_domain,
+ AR2315_MISC_IRQ_UART0);
+
+ ath25_serial_setup(AR2315_UART0_BASE, irq, ar2315_apb_frequency());
+}
diff --git a/arch/mips/ath25/ar2315.h b/arch/mips/ath25/ar2315.h
index da5b843dd3a6..4af5f4c75f44 100644
--- a/arch/mips/ath25/ar2315.h
+++ b/arch/mips/ath25/ar2315.h
@@ -6,12 +6,14 @@
void ar2315_arch_init_irq(void);
void ar2315_plat_time_init(void);
void ar2315_plat_mem_setup(void);
+void ar2315_arch_init(void);
#else
static inline void ar2315_arch_init_irq(void) {}
static inline void ar2315_plat_time_init(void) {}
static inline void ar2315_plat_mem_setup(void) {}
+static inline void ar2315_arch_init(void) {}
#endif
diff --git a/arch/mips/ath25/ar5312.c b/arch/mips/ath25/ar5312.c
index b99a02a9e20e..398d4fd4dd2d 100644
--- a/arch/mips/ath25/ar5312.c
+++ b/arch/mips/ath25/ar5312.c
@@ -265,3 +265,11 @@ void __init ar5312_plat_mem_setup(void)
_machine_restart = ar5312_restart;
}
+
+void __init ar5312_arch_init(void)
+{
+ unsigned irq = irq_create_mapping(ar5312_misc_irq_domain,
+ AR5312_MISC_IRQ_UART0);
+
+ ath25_serial_setup(AR5312_UART0_BASE, irq, ar5312_sys_frequency());
+}
diff --git a/arch/mips/ath25/ar5312.h b/arch/mips/ath25/ar5312.h
index 254f04f371b5..86dfc6d04a6d 100644
--- a/arch/mips/ath25/ar5312.h
+++ b/arch/mips/ath25/ar5312.h
@@ -6,12 +6,14 @@
void ar5312_arch_init_irq(void);
void ar5312_plat_time_init(void);
void ar5312_plat_mem_setup(void);
+void ar5312_arch_init(void);
#else
static inline void ar5312_arch_init_irq(void) {}
static inline void ar5312_plat_time_init(void) {}
static inline void ar5312_plat_mem_setup(void) {}
+static inline void ar5312_arch_init(void) {}
#endif
diff --git a/arch/mips/ath25/devices.c b/arch/mips/ath25/devices.c
index 049ab4477954..400419d8e7d9 100644
--- a/arch/mips/ath25/devices.c
+++ b/arch/mips/ath25/devices.c
@@ -1,10 +1,41 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/serial_8250.h>
#include <asm/bootinfo.h>
#include "devices.h"
+#include "ar5312.h"
+#include "ar2315.h"
const char *get_system_type(void)
{
return "Atheros (unknown)";
}
+
+void __init ath25_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);
+}
+
+static int __init ath25_arch_init(void)
+{
+ if (is_ar5312())
+ ar5312_arch_init();
+ else
+ ar2315_arch_init();
+
+ return 0;
+}
+
+arch_initcall(ath25_arch_init);
diff --git a/arch/mips/ath25/devices.h b/arch/mips/ath25/devices.h
index 2985586a0f2c..23b53cb71c72 100644
--- a/arch/mips/ath25/devices.h
+++ b/arch/mips/ath25/devices.h
@@ -9,6 +9,8 @@
extern void (*ath25_irq_dispatch)(void);
+void ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
+
static inline bool is_ar2315(void)
{
return (current_cpu_data.cputype == CPU_4KEC);