~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/ath25/devices.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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>
  7 
  8 #include <ath25_platform.h>
  9 #include "devices.h"
 10 #include "ar5312.h"
 11 #include "ar2315.h"
 12 
 13 struct ar231x_board_config ath25_board;
 14 enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN;
 15 
 16 static struct resource ath25_wmac0_res[] = {
 17         {
 18                 .name = "wmac0_membase",
 19                 .flags = IORESOURCE_MEM,
 20         },
 21         {
 22                 .name = "wmac0_irq",
 23                 .flags = IORESOURCE_IRQ,
 24         }
 25 };
 26 
 27 static struct resource ath25_wmac1_res[] = {
 28         {
 29                 .name = "wmac1_membase",
 30                 .flags = IORESOURCE_MEM,
 31         },
 32         {
 33                 .name = "wmac1_irq",
 34                 .flags = IORESOURCE_IRQ,
 35         }
 36 };
 37 
 38 static struct platform_device ath25_wmac[] = {
 39         {
 40                 .id = 0,
 41                 .name = "ar231x-wmac",
 42                 .resource = ath25_wmac0_res,
 43                 .num_resources = ARRAY_SIZE(ath25_wmac0_res),
 44                 .dev.platform_data = &ath25_board,
 45         },
 46         {
 47                 .id = 1,
 48                 .name = "ar231x-wmac",
 49                 .resource = ath25_wmac1_res,
 50                 .num_resources = ARRAY_SIZE(ath25_wmac1_res),
 51                 .dev.platform_data = &ath25_board,
 52         },
 53 };
 54 
 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)",
 64 };
 65 
 66 const char *get_system_type(void)
 67 {
 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];
 72 }
 73 
 74 void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
 75 {
 76 #ifdef CONFIG_SERIAL_8250_CONSOLE
 77         struct uart_port s;
 78 
 79         memset(&s, 0, sizeof(s));
 80 
 81         s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
 82         s.iotype = UPIO_MEM32;
 83         s.irq = irq;
 84         s.regshift = 2;
 85         s.mapbase = mapbase;
 86         s.uartclk = uartclk;
 87 
 88         early_serial_setup(&s);
 89 #endif /* CONFIG_SERIAL_8250_CONSOLE */
 90 }
 91 
 92 int __init ath25_add_wmac(int nr, u32 base, int irq)
 93 {
 94         struct resource *res;
 95 
 96         ath25_wmac[nr].dev.platform_data = &ath25_board;
 97         res = &ath25_wmac[nr].resource[0];
 98         res->start = base;
 99         res->end = base + 0x10000 - 1;
100         res++;
101         res->start = irq;
102         res->end = irq;
103         return platform_device_register(&ath25_wmac[nr]);
104 }
105 
106 static int __init ath25_register_devices(void)
107 {
108         if (is_ar5312())
109                 ar5312_init_devices();
110         else
111                 ar2315_init_devices();
112 
113         return 0;
114 }
115 
116 device_initcall(ath25_register_devices);
117 
118 static int __init ath25_arch_init(void)
119 {
120         if (is_ar5312())
121                 ar5312_arch_init();
122         else
123                 ar2315_arch_init();
124 
125         return 0;
126 }
127 
128 arch_initcall(ath25_arch_init);
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php