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:48 -0500 |
commit | 34cfcd26bd34884e9bcbbfae4f87b36e42931c30 (patch) | |
tree | 45cf0ceb5001f50a4933b04527d3c42235a27ff8 /arch/mips | |
parent | 6903bb49da18e0bf3e2909e6b1342ee9a26b78ff (diff) |
MIPS: ath79: Add AR933x specific WMAC setup code
The wireless MAC of the AR933x SoCs uses different base address, and
requires different setup code.
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/3030/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/ath79/dev-ar913x-wmac.c | 43 | ||||
-rw-r--r-- | arch/mips/ath79/dev-ar913x-wmac.h | 4 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 4 |
3 files changed, 46 insertions, 5 deletions
diff --git a/arch/mips/ath79/dev-ar913x-wmac.c b/arch/mips/ath79/dev-ar913x-wmac.c index 21118fb461ab..c424e9a2160d 100644 --- a/arch/mips/ath79/dev-ar913x-wmac.c +++ b/arch/mips/ath79/dev-ar913x-wmac.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Atheros AR913X SoC built-in WMAC device support | 2 | * Atheros AR913X/AR933X SoC built-in WMAC device support |
3 | * | 3 | * |
4 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> | 4 | * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> |
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | 5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -55,10 +55,49 @@ static void __init ar913x_wmac_setup(void) | |||
55 | ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; | 55 | ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; |
56 | } | 56 | } |
57 | 57 | ||
58 | |||
59 | static int ar933x_wmac_reset(void) | ||
60 | { | ||
61 | ath79_device_reset_clear(AR933X_RESET_WMAC); | ||
62 | ath79_device_reset_set(AR933X_RESET_WMAC); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int ar933x_r1_get_wmac_revision(void) | ||
68 | { | ||
69 | return ath79_soc_rev; | ||
70 | } | ||
71 | |||
72 | static void __init ar933x_wmac_setup(void) | ||
73 | { | ||
74 | u32 t; | ||
75 | |||
76 | ar933x_wmac_reset(); | ||
77 | |||
78 | ath79_wmac_device.name = "ar933x_wmac"; | ||
79 | |||
80 | ath79_wmac_resources[0].start = AR933X_WMAC_BASE; | ||
81 | ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1; | ||
82 | |||
83 | t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); | ||
84 | if (t & AR933X_BOOTSTRAP_REF_CLK_40) | ||
85 | ath79_wmac_data.is_clk_25mhz = false; | ||
86 | else | ||
87 | ath79_wmac_data.is_clk_25mhz = true; | ||
88 | |||
89 | if (ath79_soc_rev == 1) | ||
90 | ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision; | ||
91 | |||
92 | ath79_wmac_data.external_reset = ar933x_wmac_reset; | ||
93 | } | ||
94 | |||
58 | void __init ath79_register_wmac(u8 *cal_data) | 95 | void __init ath79_register_wmac(u8 *cal_data) |
59 | { | 96 | { |
60 | if (soc_is_ar913x()) | 97 | if (soc_is_ar913x()) |
61 | ar913x_wmac_setup(); | 98 | ar913x_wmac_setup(); |
99 | if (soc_is_ar933x()) | ||
100 | ar933x_wmac_setup(); | ||
62 | else | 101 | else |
63 | BUG(); | 102 | BUG(); |
64 | 103 | ||
diff --git a/arch/mips/ath79/dev-ar913x-wmac.h b/arch/mips/ath79/dev-ar913x-wmac.h index de1d78497fc9..c9cd8709f090 100644 --- a/arch/mips/ath79/dev-ar913x-wmac.h +++ b/arch/mips/ath79/dev-ar913x-wmac.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Atheros AR913X SoC built-in WMAC device support | 2 | * Atheros AR913X/AR933X SoC built-in WMAC device support |
3 | * | 3 | * |
4 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> | 4 | * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> |
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | 5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index 733bacace778..2f0becb4ec8f 100644 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | |||
@@ -55,7 +55,8 @@ | |||
55 | 55 | ||
56 | #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) | 56 | #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) |
57 | #define AR933X_UART_SIZE 0x14 | 57 | #define AR933X_UART_SIZE 0x14 |
58 | 58 | #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) | |
59 | #define AR933X_WMAC_SIZE 0x20000 | ||
59 | #define AR933X_EHCI_BASE 0x1b000000 | 60 | #define AR933X_EHCI_BASE 0x1b000000 |
60 | #define AR933X_EHCI_SIZE 0x1000 | 61 | #define AR933X_EHCI_SIZE 0x1000 |
61 | 62 | ||
@@ -233,6 +234,7 @@ | |||
233 | #define AR913X_RESET_USB_HOST BIT(5) | 234 | #define AR913X_RESET_USB_HOST BIT(5) |
234 | #define AR913X_RESET_USB_PHY BIT(4) | 235 | #define AR913X_RESET_USB_PHY BIT(4) |
235 | 236 | ||
237 | #define AR933X_RESET_WMAC BIT(11) | ||
236 | #define AR933X_RESET_USB_HOST BIT(5) | 238 | #define AR933X_RESET_USB_HOST BIT(5) |
237 | #define AR933X_RESET_USB_PHY BIT(4) | 239 | #define AR933X_RESET_USB_PHY BIT(4) |
238 | #define AR933X_RESET_USBSUS_OVERRIDE BIT(3) | 240 | #define AR933X_RESET_USBSUS_OVERRIDE BIT(3) |