blob: 62185472ef284c901d8a7d374f42eb7a7dc06f41 [file] [log] [blame]
Sergey Ryazanov43cc7392014-10-29 03:18:38 +04001#include <linux/kernel.h>
2#include <linux/init.h>
Sergey Ryazanov1ac91b12014-10-29 03:18:43 +04003#include <linux/serial_8250.h>
Sergey Ryazanov43cc7392014-10-29 03:18:38 +04004#include <asm/bootinfo.h>
5
Sergey Ryazanova7473712014-10-29 03:18:44 +04006#include <ath25_platform.h>
Sergey Ryazanov43cc7392014-10-29 03:18:38 +04007#include "devices.h"
Sergey Ryazanov1ac91b12014-10-29 03:18:43 +04008#include "ar5312.h"
9#include "ar2315.h"
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040010
Sergey Ryazanova7473712014-10-29 03:18:44 +040011struct ar231x_board_config ath25_board;
Sergey Ryazanov16548612014-10-29 03:18:45 +040012enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN;
13
14static const char * const soc_type_strings[] = {
15 [ATH25_SOC_AR5312] = "Atheros AR5312",
16 [ATH25_SOC_AR2312] = "Atheros AR2312",
17 [ATH25_SOC_AR2313] = "Atheros AR2313",
18 [ATH25_SOC_AR2315] = "Atheros AR2315",
19 [ATH25_SOC_AR2316] = "Atheros AR2316",
20 [ATH25_SOC_AR2317] = "Atheros AR2317",
21 [ATH25_SOC_AR2318] = "Atheros AR2318",
22 [ATH25_SOC_UNKNOWN] = "Atheros (unknown)",
23};
Sergey Ryazanova7473712014-10-29 03:18:44 +040024
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040025const char *get_system_type(void)
26{
Sergey Ryazanov16548612014-10-29 03:18:45 +040027 if ((ath25_soc >= ARRAY_SIZE(soc_type_strings)) ||
28 !soc_type_strings[ath25_soc])
29 return soc_type_strings[ATH25_SOC_UNKNOWN];
30 return soc_type_strings[ath25_soc];
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040031}
Sergey Ryazanov1ac91b12014-10-29 03:18:43 +040032
33void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
34{
35 struct uart_port s;
36
37 memset(&s, 0, sizeof(s));
38
39 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
40 s.iotype = UPIO_MEM32;
41 s.irq = irq;
42 s.regshift = 2;
43 s.mapbase = mapbase;
44 s.uartclk = uartclk;
45
46 early_serial_setup(&s);
47}
48
Sergey Ryazanova7473712014-10-29 03:18:44 +040049static int __init ath25_register_devices(void)
50{
51 if (is_ar5312())
52 ar5312_init_devices();
53 else
54 ar2315_init_devices();
55
56 return 0;
57}
58
59device_initcall(ath25_register_devices);
60
Sergey Ryazanov1ac91b12014-10-29 03:18:43 +040061static int __init ath25_arch_init(void)
62{
63 if (is_ar5312())
64 ar5312_arch_init();
65 else
66 ar2315_arch_init();
67
68 return 0;
69}
70
71arch_initcall(ath25_arch_init);