Signed-off-by: Sergey Ryazanov <ryazanov.s.a@xxxxxxxxx> --- Changes since RFC: - register UART during arch initialization arch/mips/ar231x/ar2315.c | 9 +++++++++ arch/mips/ar231x/ar2315.h | 2 ++ arch/mips/ar231x/ar5312.c | 9 +++++++++ arch/mips/ar231x/ar5312.h | 2 ++ arch/mips/ar231x/devices.c | 25 +++++++++++++++++++++++++ arch/mips/ar231x/devices.h | 2 ++ 6 files changed, 49 insertions(+) diff --git a/arch/mips/ar231x/ar2315.c b/arch/mips/ar231x/ar2315.c index 320893a..3d21a25a 100644 --- a/arch/mips/ar231x/ar2315.c +++ b/arch/mips/ar231x/ar2315.c @@ -245,3 +245,12 @@ void __init ar2315_prom_init(void) add_memory_region(0, memsize, BOOT_MEM_RAM); } +void __init ar2315_arch_init(void) +{ + if (!is_2315()) + return; + + ar231x_serial_setup(AR2315_UART0, ar2315_misc_irq_base + + AR2315_MISC_IRQ_UART0, ar2315_apb_frequency()); +} + diff --git a/arch/mips/ar231x/ar2315.h b/arch/mips/ar231x/ar2315.h index 2a57858..9af22db 100644 --- a/arch/mips/ar231x/ar2315.h +++ b/arch/mips/ar231x/ar2315.h @@ -7,6 +7,7 @@ void ar2315_arch_init_irq(void); void ar2315_plat_time_init(void); void ar2315_plat_mem_setup(void); void ar2315_prom_init(void); +void ar2315_arch_init(void); #else @@ -14,6 +15,7 @@ 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_prom_init(void) {} +static inline void ar2315_arch_init(void) {} #endif diff --git a/arch/mips/ar231x/ar5312.c b/arch/mips/ar231x/ar5312.c index 3f81d33..138d7e1 100644 --- a/arch/mips/ar231x/ar5312.c +++ b/arch/mips/ar231x/ar5312.c @@ -247,3 +247,12 @@ void __init ar5312_prom_init(void) add_memory_region(0, memsize, BOOT_MEM_RAM); } +void __init ar5312_arch_init(void) +{ + if (!is_5312()) + return; + + ar231x_serial_setup(AR5312_UART0, ar5312_misc_irq_base + + AR5312_MISC_IRQ_UART0, ar5312_sys_frequency()); +} + diff --git a/arch/mips/ar231x/ar5312.h b/arch/mips/ar231x/ar5312.h index b60ad38..d04a33d 100644 --- a/arch/mips/ar231x/ar5312.h +++ b/arch/mips/ar231x/ar5312.h @@ -7,6 +7,7 @@ void ar5312_arch_init_irq(void); void ar5312_plat_time_init(void); void ar5312_plat_mem_setup(void); void ar5312_prom_init(void); +void ar5312_arch_init(void); #else @@ -14,6 +15,7 @@ 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_prom_init(void) {} +static inline void ar5312_arch_init(void) {} #endif diff --git a/arch/mips/ar231x/devices.c b/arch/mips/ar231x/devices.c index f71a643..85caae4 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,27 @@ 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); +} + +static int __init ar231x_arch_init(void) +{ + ar5312_arch_init(); + ar2315_arch_init(); + return 0; +} + +arch_initcall(ar231x_arch_init); 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.5.5