1 From e2201a02b529acc65a5a1b19a52b93f9c2d98088 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 22/27] MIPS: ath79: Add AR933x specific WMAC setup code
6 The wireless MAC of the AR933x SoCs uses different base address, and
7 requires different setup code.
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Cc: Imre Kaloz <kaloz@openwrt.org>
11 Cc: linux-mips@linux-mips.org
12 Patchwork: https://patchwork.linux-mips.org/patch/3030/
13 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
15 arch/mips/ath79/dev-ar913x-wmac.c | 43 ++++++++++++++++++++++-
16 arch/mips/ath79/dev-ar913x-wmac.h | 4 +-
17 arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 4 ++-
18 3 files changed, 46 insertions(+), 5 deletions(-)
20 --- a/arch/mips/ath79/dev-ar913x-wmac.c
21 +++ b/arch/mips/ath79/dev-ar913x-wmac.c
24 - * Atheros AR913X SoC built-in WMAC device support
25 + * Atheros AR913X/AR933X SoC built-in WMAC device support
27 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
28 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
29 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
31 * This program is free software; you can redistribute it and/or modify it
32 @@ -55,10 +55,49 @@ static void __init ar913x_wmac_setup(voi
33 ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
37 +static int ar933x_wmac_reset(void)
39 + ath79_device_reset_clear(AR933X_RESET_WMAC);
40 + ath79_device_reset_set(AR933X_RESET_WMAC);
45 +static int ar933x_r1_get_wmac_revision(void)
47 + return ath79_soc_rev;
50 +static void __init ar933x_wmac_setup(void)
54 + ar933x_wmac_reset();
56 + ath79_wmac_device.name = "ar933x_wmac";
58 + ath79_wmac_resources[0].start = AR933X_WMAC_BASE;
59 + ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1;
61 + t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
62 + if (t & AR933X_BOOTSTRAP_REF_CLK_40)
63 + ath79_wmac_data.is_clk_25mhz = false;
65 + ath79_wmac_data.is_clk_25mhz = true;
67 + if (ath79_soc_rev == 1)
68 + ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
70 + ath79_wmac_data.external_reset = ar933x_wmac_reset;
73 void __init ath79_register_wmac(u8 *cal_data)
77 + if (soc_is_ar933x())
78 + ar933x_wmac_setup();
82 --- a/arch/mips/ath79/dev-ar913x-wmac.h
83 +++ b/arch/mips/ath79/dev-ar913x-wmac.h
86 - * Atheros AR913X SoC built-in WMAC device support
87 + * Atheros AR913X/AR933X SoC built-in WMAC device support
89 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
90 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
91 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
93 * This program is free software; you can redistribute it and/or modify it
94 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
95 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
98 #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
99 #define AR933X_UART_SIZE 0x14
101 +#define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
102 +#define AR933X_WMAC_SIZE 0x20000
103 #define AR933X_EHCI_BASE 0x1b000000
104 #define AR933X_EHCI_SIZE 0x1000
107 #define AR913X_RESET_USB_HOST BIT(5)
108 #define AR913X_RESET_USB_PHY BIT(4)
110 +#define AR933X_RESET_WMAC BIT(11)
111 #define AR933X_RESET_USB_HOST BIT(5)
112 #define AR933X_RESET_USB_PHY BIT(4)
113 #define AR933X_RESET_USBSUS_OVERRIDE BIT(3)