Sergey Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 1 | #include <linux/kernel.h> |
| 2 | #include <linux/init.h> |
Sergey Ryazanov | 1ac91b1 | 2014-10-29 03:18:43 +0400 | [diff] [blame] | 3 | #include <linux/serial_8250.h> |
Sergey Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 4 | #include <asm/bootinfo.h> |
| 5 | |
Sergey Ryazanov | a747371 | 2014-10-29 03:18:44 +0400 | [diff] [blame] | 6 | #include <ath25_platform.h> |
Sergey Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 7 | #include "devices.h" |
Sergey Ryazanov | 1ac91b1 | 2014-10-29 03:18:43 +0400 | [diff] [blame] | 8 | #include "ar5312.h" |
| 9 | #include "ar2315.h" |
Sergey Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 10 | |
Sergey Ryazanov | a747371 | 2014-10-29 03:18:44 +0400 | [diff] [blame] | 11 | struct ar231x_board_config ath25_board; |
Sergey Ryazanov | 1654861 | 2014-10-29 03:18:45 +0400 | [diff] [blame^] | 12 | enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN; |
| 13 | |
| 14 | static 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 Ryazanov | a747371 | 2014-10-29 03:18:44 +0400 | [diff] [blame] | 24 | |
Sergey Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 25 | const char *get_system_type(void) |
| 26 | { |
Sergey Ryazanov | 1654861 | 2014-10-29 03:18:45 +0400 | [diff] [blame^] | 27 | 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 Ryazanov | 43cc739 | 2014-10-29 03:18:38 +0400 | [diff] [blame] | 31 | } |
Sergey Ryazanov | 1ac91b1 | 2014-10-29 03:18:43 +0400 | [diff] [blame] | 32 | |
| 33 | void __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 Ryazanov | a747371 | 2014-10-29 03:18:44 +0400 | [diff] [blame] | 49 | static 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 | |
| 59 | device_initcall(ath25_register_devices); |
| 60 | |
Sergey Ryazanov | 1ac91b1 | 2014-10-29 03:18:43 +0400 | [diff] [blame] | 61 | static 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 | |
| 71 | arch_initcall(ath25_arch_init); |