diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2011-11-17 19:17:53 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-07 17:02:47 -0500 |
commit | 6903bb49da18e0bf3e2909e6b1342ee9a26b78ff (patch) | |
tree | a3774efb110142c3e408e5ead6c80710ba361af6 /arch/mips | |
parent | 67b0f0f1b355df293f92069a0409452c9e24370b (diff) |
MIPS: ath79: Separate AR913x SoC specific WMAC setup code
The device registration code can be shared between the different SoCs, but
the required setup code varies Move AR913x specific setup code into a
separate function in order to make adding support for another SoCs easier.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3029/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/ath79/dev-ar913x-wmac.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/mips/ath79/dev-ar913x-wmac.c b/arch/mips/ath79/dev-ar913x-wmac.c index 2c9ba40be96e..21118fb461ab 100644 --- a/arch/mips/ath79/dev-ar913x-wmac.c +++ b/arch/mips/ath79/dev-ar913x-wmac.c | |||
@@ -23,8 +23,7 @@ static struct ath9k_platform_data ath79_wmac_data; | |||
23 | 23 | ||
24 | static struct resource ath79_wmac_resources[] = { | 24 | static struct resource ath79_wmac_resources[] = { |
25 | { | 25 | { |
26 | .start = AR913X_WMAC_BASE, | 26 | /* .start and .end fields are filled dynamically */ |
27 | .end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1, | ||
28 | .flags = IORESOURCE_MEM, | 27 | .flags = IORESOURCE_MEM, |
29 | }, { | 28 | }, { |
30 | .start = ATH79_CPU_IRQ_IP2, | 29 | .start = ATH79_CPU_IRQ_IP2, |
@@ -43,12 +42,8 @@ static struct platform_device ath79_wmac_device = { | |||
43 | }, | 42 | }, |
44 | }; | 43 | }; |
45 | 44 | ||
46 | void __init ath79_register_wmac(u8 *cal_data) | 45 | static void __init ar913x_wmac_setup(void) |
47 | { | 46 | { |
48 | if (cal_data) | ||
49 | memcpy(ath79_wmac_data.eeprom_data, cal_data, | ||
50 | sizeof(ath79_wmac_data.eeprom_data)); | ||
51 | |||
52 | /* reset the WMAC */ | 47 | /* reset the WMAC */ |
53 | ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); | 48 | ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); |
54 | mdelay(10); | 49 | mdelay(10); |
@@ -56,5 +51,20 @@ void __init ath79_register_wmac(u8 *cal_data) | |||
56 | ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); | 51 | ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); |
57 | mdelay(10); | 52 | mdelay(10); |
58 | 53 | ||
54 | ath79_wmac_resources[0].start = AR913X_WMAC_BASE; | ||
55 | ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; | ||
56 | } | ||
57 | |||
58 | void __init ath79_register_wmac(u8 *cal_data) | ||
59 | { | ||
60 | if (soc_is_ar913x()) | ||
61 | ar913x_wmac_setup(); | ||
62 | else | ||
63 | BUG(); | ||
64 | |||
65 | if (cal_data) | ||
66 | memcpy(ath79_wmac_data.eeprom_data, cal_data, | ||
67 | sizeof(ath79_wmac_data.eeprom_data)); | ||
68 | |||
59 | platform_device_register(&ath79_wmac_device); | 69 | platform_device_register(&ath79_wmac_device); |
60 | } | 70 | } |