aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/ath25
diff options
context:
space:
mode:
authorSergey Ryazanov <ryazanov.s.a@gmail.com>2014-10-28 19:18:43 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 01:45:27 -0500
commit1ac91b1f686e9d819b16525baf2e8db3c282edba (patch)
tree22175fa726fe35b52f562f114a41a5eb80bcb6b6 /arch/mips/ath25
parent8aaa7278c0c98a77ec36e1fed7d9bede58164a26 (diff)
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)
267 267
268 _machine_restart = ar2315_restart; 268 _machine_restart = ar2315_restart;
269} 269}
270
271void __init ar2315_arch_init(void)
272{
273 unsigned irq = irq_create_mapping(ar2315_misc_irq_domain,
274 AR2315_MISC_IRQ_UART0);
275
276 ath25_serial_setup(AR2315_UART0_BASE, irq, ar2315_apb_frequency());
277}
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 @@
6void ar2315_arch_init_irq(void); 6void ar2315_arch_init_irq(void);
7void ar2315_plat_time_init(void); 7void ar2315_plat_time_init(void);
8void ar2315_plat_mem_setup(void); 8void ar2315_plat_mem_setup(void);
9void ar2315_arch_init(void);
9 10
10#else 11#else
11 12
12static inline void ar2315_arch_init_irq(void) {} 13static inline void ar2315_arch_init_irq(void) {}
13static inline void ar2315_plat_time_init(void) {} 14static inline void ar2315_plat_time_init(void) {}
14static inline void ar2315_plat_mem_setup(void) {} 15static inline void ar2315_plat_mem_setup(void) {}
16static inline void ar2315_arch_init(void) {}
15 17
16#endif 18#endif
17 19
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)
265 265
266 _machine_restart = ar5312_restart; 266 _machine_restart = ar5312_restart;
267} 267}
268
269void __init ar5312_arch_init(void)
270{
271 unsigned irq = irq_create_mapping(ar5312_misc_irq_domain,
272 AR5312_MISC_IRQ_UART0);
273
274 ath25_serial_setup(AR5312_UART0_BASE, irq, ar5312_sys_frequency());
275}
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 @@
6void ar5312_arch_init_irq(void); 6void ar5312_arch_init_irq(void);
7void ar5312_plat_time_init(void); 7void ar5312_plat_time_init(void);
8void ar5312_plat_mem_setup(void); 8void ar5312_plat_mem_setup(void);
9void ar5312_arch_init(void);
9 10
10#else 11#else
11 12
12static inline void ar5312_arch_init_irq(void) {} 13static inline void ar5312_arch_init_irq(void) {}
13static inline void ar5312_plat_time_init(void) {} 14static inline void ar5312_plat_time_init(void) {}
14static inline void ar5312_plat_mem_setup(void) {} 15static inline void ar5312_plat_mem_setup(void) {}
16static inline void ar5312_arch_init(void) {}
15 17
16#endif 18#endif
17 19
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 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/init.h> 2#include <linux/init.h>
3#include <linux/serial_8250.h>
3#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
4 5
5#include "devices.h" 6#include "devices.h"
7#include "ar5312.h"
8#include "ar2315.h"
6 9
7const char *get_system_type(void) 10const char *get_system_type(void)
8{ 11{
9 return "Atheros (unknown)"; 12 return "Atheros (unknown)";
10} 13}
14
15void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
16{
17 struct uart_port s;
18
19 memset(&s, 0, sizeof(s));
20
21 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
22 s.iotype = UPIO_MEM32;
23 s.irq = irq;
24 s.regshift = 2;
25 s.mapbase = mapbase;
26 s.uartclk = uartclk;
27
28 early_serial_setup(&s);
29}
30
31static int __init ath25_arch_init(void)
32{
33 if (is_ar5312())
34 ar5312_arch_init();
35 else
36 ar2315_arch_init();
37
38 return 0;
39}
40
41arch_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 @@
9 9
10extern void (*ath25_irq_dispatch)(void); 10extern void (*ath25_irq_dispatch)(void);
11 11
12void ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
13
12static inline bool is_ar2315(void) 14static inline bool is_ar2315(void)
13{ 15{
14 return (current_cpu_data.cputype == CPU_4KEC); 16 return (current_cpu_data.cputype == CPU_4KEC);