1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/kernel.h>
3 #include <linux/init.h>
4 #include <linux/serial_8250.h>
5 #include <linux/platform_device.h>
6 #include <asm/bootinfo.h>
8 #include <ath25_platform.h>
13 struct ar231x_board_config ath25_board;
14 enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN;
16 static struct resource ath25_wmac0_res[] = {
18 .name = "wmac0_membase",
19 .flags = IORESOURCE_MEM,
23 .flags = IORESOURCE_IRQ,
27 static struct resource ath25_wmac1_res[] = {
29 .name = "wmac1_membase",
30 .flags = IORESOURCE_MEM,
34 .flags = IORESOURCE_IRQ,
38 static struct platform_device ath25_wmac[] = {
41 .name = "ar231x-wmac",
42 .resource = ath25_wmac0_res,
43 .num_resources = ARRAY_SIZE(ath25_wmac0_res),
44 .dev.platform_data = &ath25_board,
48 .name = "ar231x-wmac",
49 .resource = ath25_wmac1_res,
50 .num_resources = ARRAY_SIZE(ath25_wmac1_res),
51 .dev.platform_data = &ath25_board,
55 static const char * const soc_type_strings[] = {
56 [ATH25_SOC_AR5312] = "Atheros AR5312",
57 [ATH25_SOC_AR2312] = "Atheros AR2312",
58 [ATH25_SOC_AR2313] = "Atheros AR2313",
59 [ATH25_SOC_AR2315] = "Atheros AR2315",
60 [ATH25_SOC_AR2316] = "Atheros AR2316",
61 [ATH25_SOC_AR2317] = "Atheros AR2317",
62 [ATH25_SOC_AR2318] = "Atheros AR2318",
63 [ATH25_SOC_UNKNOWN] = "Atheros (unknown)",
66 const char *get_system_type(void)
68 if ((ath25_soc >= ARRAY_SIZE(soc_type_strings)) ||
69 !soc_type_strings[ath25_soc])
70 return soc_type_strings[ATH25_SOC_UNKNOWN];
71 return soc_type_strings[ath25_soc];
74 void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
76 #ifdef CONFIG_SERIAL_8250_CONSOLE
79 memset(&s, 0, sizeof(s));
81 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
82 s.iotype = UPIO_MEM32;
88 early_serial_setup(&s);
89 #endif /* CONFIG_SERIAL_8250_CONSOLE */
92 int __init ath25_add_wmac(int nr, u32 base, int irq)
96 ath25_wmac[nr].dev.platform_data = &ath25_board;
97 res = &ath25_wmac[nr].resource[0];
99 res->end = base + 0x10000 - 1;
103 return platform_device_register(&ath25_wmac[nr]);
106 static int __init ath25_register_devices(void)
109 ar5312_init_devices();
111 ar2315_init_devices();
116 device_initcall(ath25_register_devices);
118 static int __init ath25_arch_init(void)
128 arch_initcall(ath25_arch_init);