1 From 6e3f244874b8ae660136531b696ad05abe549607 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Fri, 18 Nov 2011 00:17:53 +0000
4 Subject: [PATCH 21/27] MIPS: ath79: Separate AR913x SoC specific WMAC setup code
6 The device registration code can be shared between the different SoCs, but
7 the required setup code varies Move AR913x specific setup code into a
8 separate function in order to make adding support for another SoCs easier.
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 Cc: Imre Kaloz <kaloz@openwrt.org>
12 Cc: linux-mips@linux-mips.org
13 Patchwork: https://patchwork.linux-mips.org/patch/3029/
14 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
16 arch/mips/ath79/dev-ar913x-wmac.c | 24 +++++++++++++++++-------
17 1 files changed, 17 insertions(+), 7 deletions(-)
19 --- a/arch/mips/ath79/dev-ar913x-wmac.c
20 +++ b/arch/mips/ath79/dev-ar913x-wmac.c
21 @@ -23,8 +23,7 @@ static struct ath9k_platform_data ath79_
23 static struct resource ath79_wmac_resources[] = {
25 - .start = AR913X_WMAC_BASE,
26 - .end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1,
27 + /* .start and .end fields are filled dynamically */
28 .flags = IORESOURCE_MEM,
30 .start = ATH79_CPU_IRQ_IP2,
31 @@ -43,12 +42,8 @@ static struct platform_device ath79_wmac
35 -void __init ath79_register_wmac(u8 *cal_data)
36 +static void __init ar913x_wmac_setup(void)
39 - memcpy(ath79_wmac_data.eeprom_data, cal_data,
40 - sizeof(ath79_wmac_data.eeprom_data));
43 ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
45 @@ -56,5 +51,20 @@ void __init ath79_register_wmac(u8 *cal_
46 ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
49 + ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
50 + ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
53 +void __init ath79_register_wmac(u8 *cal_data)
55 + if (soc_is_ar913x())
56 + ar913x_wmac_setup();
61 + memcpy(ath79_wmac_data.eeprom_data, cal_data,
62 + sizeof(ath79_wmac_data.eeprom_data));
64 platform_device_register(&ath79_wmac_device);