[tools] autoconf: another relocatability fix for autom4te, substitute hardcoded prefi...
[openwrt.git] / target / linux / ar71xx / patches-3.2 / 022-MIPS-ath79-Add-AR933x-specific-WMAC-setup-code.patch
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
5
6 The wireless MAC of the AR933x SoCs uses different base address, and
7 requires different setup code.
8
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>
14 ---
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(-)
19
20 --- a/arch/mips/ath79/dev-ar913x-wmac.c
21 +++ b/arch/mips/ath79/dev-ar913x-wmac.c
22 @@ -1,7 +1,7 @@
23 /*
24 - * Atheros AR913X SoC built-in WMAC device support
25 + * Atheros AR913X/AR933X SoC built-in WMAC device support
26 *
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>
30 *
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;
34 }
35
36 +
37 +static int ar933x_wmac_reset(void)
38 +{
39 + ath79_device_reset_clear(AR933X_RESET_WMAC);
40 + ath79_device_reset_set(AR933X_RESET_WMAC);
41 +
42 + return 0;
43 +}
44 +
45 +static int ar933x_r1_get_wmac_revision(void)
46 +{
47 + return ath79_soc_rev;
48 +}
49 +
50 +static void __init ar933x_wmac_setup(void)
51 +{
52 + u32 t;
53 +
54 + ar933x_wmac_reset();
55 +
56 + ath79_wmac_device.name = "ar933x_wmac";
57 +
58 + ath79_wmac_resources[0].start = AR933X_WMAC_BASE;
59 + ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1;
60 +
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;
64 + else
65 + ath79_wmac_data.is_clk_25mhz = true;
66 +
67 + if (ath79_soc_rev == 1)
68 + ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
69 +
70 + ath79_wmac_data.external_reset = ar933x_wmac_reset;
71 +}
72 +
73 void __init ath79_register_wmac(u8 *cal_data)
74 {
75 if (soc_is_ar913x())
76 ar913x_wmac_setup();
77 + if (soc_is_ar933x())
78 + ar933x_wmac_setup();
79 else
80 BUG();
81
82 --- a/arch/mips/ath79/dev-ar913x-wmac.h
83 +++ b/arch/mips/ath79/dev-ar913x-wmac.h
84 @@ -1,7 +1,7 @@
85 /*
86 - * Atheros AR913X SoC built-in WMAC device support
87 + * Atheros AR913X/AR933X SoC built-in WMAC device support
88 *
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>
92 *
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
96 @@ -55,7 +55,8 @@
97
98 #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
99 #define AR933X_UART_SIZE 0x14
100 -
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
105
106 @@ -233,6 +234,7 @@
107 #define AR913X_RESET_USB_HOST BIT(5)
108 #define AR913X_RESET_USB_PHY BIT(4)
109
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)
This page took 0.045262 seconds and 5 git commands to generate.