diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2014-10-29 02:18:50 +0300 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 09:45:29 +0300 |
commit | d6a4c72ae4dcf5e6824638e57a8088bd1313a744 (patch) | |
tree | 0816ada60e7e6138276a5c6c451201cf52feaa49 /arch/mips/ath25/devices.c | |
parent | 164a974889c03cbc6559923b8c1da8762904c560 (diff) | |
download | linux-d6a4c72ae4dcf5e6824638e57a8088bd1313a744.tar.xz |
MIPS: ath25: add Wireless device support
Atheros AR5312 and AR2315 both have a builtin wireless device, this
patch add helper code and register platform device for all supported
WiSoCs.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/8249/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath25/devices.c')
-rw-r--r-- | arch/mips/ath25/devices.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/mips/ath25/devices.c b/arch/mips/ath25/devices.c index 62185472ef28..7a64567d1ac3 100644 --- a/arch/mips/ath25/devices.c +++ b/arch/mips/ath25/devices.c @@ -1,6 +1,7 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/serial_8250.h> +#include <linux/platform_device.h> #include <asm/bootinfo.h> #include <ath25_platform.h> @@ -11,6 +12,45 @@ struct ar231x_board_config ath25_board; enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN; +static struct resource ath25_wmac0_res[] = { + { + .name = "wmac0_membase", + .flags = IORESOURCE_MEM, + }, + { + .name = "wmac0_irq", + .flags = IORESOURCE_IRQ, + } +}; + +static struct resource ath25_wmac1_res[] = { + { + .name = "wmac1_membase", + .flags = IORESOURCE_MEM, + }, + { + .name = "wmac1_irq", + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device ath25_wmac[] = { + { + .id = 0, + .name = "ar231x-wmac", + .resource = ath25_wmac0_res, + .num_resources = ARRAY_SIZE(ath25_wmac0_res), + .dev.platform_data = &ath25_board, + }, + { + .id = 1, + .name = "ar231x-wmac", + .resource = ath25_wmac1_res, + .num_resources = ARRAY_SIZE(ath25_wmac1_res), + .dev.platform_data = &ath25_board, + }, +}; + static const char * const soc_type_strings[] = { [ATH25_SOC_AR5312] = "Atheros AR5312", [ATH25_SOC_AR2312] = "Atheros AR2312", @@ -46,6 +86,20 @@ void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk) early_serial_setup(&s); } +int __init ath25_add_wmac(int nr, u32 base, int irq) +{ + struct resource *res; + + ath25_wmac[nr].dev.platform_data = &ath25_board; + res = &ath25_wmac[nr].resource[0]; + res->start = base; + res->end = base + 0x10000 - 1; + res++; + res->start = irq; + res->end = irq; + return platform_device_register(&ath25_wmac[nr]); +} + static int __init ath25_register_devices(void) { if (is_ar5312()) |