diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2011-01-04 15:28:29 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-01-18 13:30:28 -0500 |
commit | f5b35d0b16a08e6c1e7c8a41fa87ad10cf9aefa4 (patch) | |
tree | fd4991f97b52aa714f5aebe955a2b897dbca0ecc /arch/mips/ath79/dev-ar913x-wmac.c | |
parent | aa6695ec8b51da7aaa245310073ddd39a306a77f (diff) |
MIPS: ath79: add common WMAC device for AR913X based boards
Add common platform_device and helper code to make the registration
of the built-in wireless MAC easier on the Atheros AR9130/AR9132
based boards. Also register the WMAC device on the AR81 board.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: Imre Kaloz <kaloz@openwrt.org>,
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Cc: Cliff Holden <Cliff.Holden@Atheros.com>
Cc: Kathy Giori <Kathy.Giori@Atheros.com>
Patchwork: https://patchwork.linux-mips.org/patch/1962/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath79/dev-ar913x-wmac.c')
-rw-r--r-- | arch/mips/ath79/dev-ar913x-wmac.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/mips/ath79/dev-ar913x-wmac.c b/arch/mips/ath79/dev-ar913x-wmac.c new file mode 100644 index 000000000000..48f425a5ba28 --- /dev/null +++ b/arch/mips/ath79/dev-ar913x-wmac.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Atheros AR913X SoC built-in WMAC device support | ||
3 | * | ||
4 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> | ||
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published | ||
9 | * by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/irq.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/ath9k_platform.h> | ||
17 | |||
18 | #include <asm/mach-ath79/ath79.h> | ||
19 | #include <asm/mach-ath79/ar71xx_regs.h> | ||
20 | #include "dev-ar913x-wmac.h" | ||
21 | |||
22 | static struct ath9k_platform_data ar913x_wmac_data; | ||
23 | |||
24 | static struct resource ar913x_wmac_resources[] = { | ||
25 | { | ||
26 | .start = AR913X_WMAC_BASE, | ||
27 | .end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1, | ||
28 | .flags = IORESOURCE_MEM, | ||
29 | }, { | ||
30 | .start = ATH79_CPU_IRQ_IP2, | ||
31 | .end = ATH79_CPU_IRQ_IP2, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | }; | ||
35 | |||
36 | static struct platform_device ar913x_wmac_device = { | ||
37 | .name = "ath9k", | ||
38 | .id = -1, | ||
39 | .resource = ar913x_wmac_resources, | ||
40 | .num_resources = ARRAY_SIZE(ar913x_wmac_resources), | ||
41 | .dev = { | ||
42 | .platform_data = &ar913x_wmac_data, | ||
43 | }, | ||
44 | }; | ||
45 | |||
46 | void __init ath79_register_ar913x_wmac(u8 *cal_data) | ||
47 | { | ||
48 | if (cal_data) | ||
49 | memcpy(ar913x_wmac_data.eeprom_data, cal_data, | ||
50 | sizeof(ar913x_wmac_data.eeprom_data)); | ||
51 | |||
52 | /* reset the WMAC */ | ||
53 | ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); | ||
54 | mdelay(10); | ||
55 | |||
56 | ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); | ||
57 | mdelay(10); | ||
58 | |||
59 | platform_device_register(&ar913x_wmac_device); | ||
60 | } | ||