diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2014-10-28 19:18:39 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:26 -0500 |
commit | 3b12308f3337c09b424a2b9cf73c2c06521abe7e (patch) | |
tree | 05c5ac8b34e1036d1d340a7817f92452a5dd3da9 /arch/mips/ath25 | |
parent | 43cc739fd98b8c517ad45756d869f866e746ba04 (diff) |
MIPS: ath25: add basic AR5312 SoC support
Add basic support for Atheros AR5312/AR2312 SoCs: registers definition
file and initial setup code.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/8238/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath25')
-rw-r--r-- | arch/mips/ath25/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/ath25/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/ath25/ar5312.c | 155 | ||||
-rw-r--r-- | arch/mips/ath25/ar5312.h | 16 | ||||
-rw-r--r-- | arch/mips/ath25/ar5312_regs.h | 201 | ||||
-rw-r--r-- | arch/mips/ath25/board.c | 8 |
6 files changed, 386 insertions, 0 deletions
diff --git a/arch/mips/ath25/Kconfig b/arch/mips/ath25/Kconfig new file mode 100644 index 000000000000..cf933ea38044 --- /dev/null +++ b/arch/mips/ath25/Kconfig | |||
@@ -0,0 +1,4 @@ | |||
1 | config SOC_AR5312 | ||
2 | bool "Atheros AR5312/AR2312+ SoC support" | ||
3 | depends on ATH25 | ||
4 | default y | ||
diff --git a/arch/mips/ath25/Makefile b/arch/mips/ath25/Makefile index 9199fa1508d2..3361619caa9b 100644 --- a/arch/mips/ath25/Makefile +++ b/arch/mips/ath25/Makefile | |||
@@ -9,3 +9,5 @@ | |||
9 | # | 9 | # |
10 | 10 | ||
11 | obj-y += board.o prom.o devices.o | 11 | obj-y += board.o prom.o devices.o |
12 | |||
13 | obj-$(CONFIG_SOC_AR5312) += ar5312.o | ||
diff --git a/arch/mips/ath25/ar5312.c b/arch/mips/ath25/ar5312.c new file mode 100644 index 000000000000..c2adaf2cd73a --- /dev/null +++ b/arch/mips/ath25/ar5312.c | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. | ||
7 | * Copyright (C) 2006 FON Technology, SL. | ||
8 | * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> | ||
9 | * Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org> | ||
10 | * Copyright (C) 2012 Alexandros C. Couloumbis <alex@ozo.com> | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * Platform devices for Atheros AR5312 SoCs | ||
15 | */ | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/reboot.h> | ||
20 | #include <asm/bootinfo.h> | ||
21 | #include <asm/reboot.h> | ||
22 | #include <asm/time.h> | ||
23 | |||
24 | #include "devices.h" | ||
25 | #include "ar5312.h" | ||
26 | #include "ar5312_regs.h" | ||
27 | |||
28 | static void __iomem *ar5312_rst_base; | ||
29 | |||
30 | static inline u32 ar5312_rst_reg_read(u32 reg) | ||
31 | { | ||
32 | return __raw_readl(ar5312_rst_base + reg); | ||
33 | } | ||
34 | |||
35 | static inline void ar5312_rst_reg_write(u32 reg, u32 val) | ||
36 | { | ||
37 | __raw_writel(val, ar5312_rst_base + reg); | ||
38 | } | ||
39 | |||
40 | static inline void ar5312_rst_reg_mask(u32 reg, u32 mask, u32 val) | ||
41 | { | ||
42 | u32 ret = ar5312_rst_reg_read(reg); | ||
43 | |||
44 | ret &= ~mask; | ||
45 | ret |= val; | ||
46 | ar5312_rst_reg_write(reg, ret); | ||
47 | } | ||
48 | |||
49 | static void ar5312_restart(char *command) | ||
50 | { | ||
51 | /* reset the system */ | ||
52 | local_irq_disable(); | ||
53 | while (1) | ||
54 | ar5312_rst_reg_write(AR5312_RESET, AR5312_RESET_SYSTEM); | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * This table is indexed by bits 5..4 of the CLOCKCTL1 register | ||
59 | * to determine the predevisor value. | ||
60 | */ | ||
61 | static unsigned clockctl1_predivide_table[4] __initdata = { 1, 2, 4, 5 }; | ||
62 | |||
63 | static unsigned __init ar5312_cpu_frequency(void) | ||
64 | { | ||
65 | u32 scratch, devid, clock_ctl1; | ||
66 | u32 predivide_mask, multiplier_mask, doubler_mask; | ||
67 | unsigned predivide_shift, multiplier_shift; | ||
68 | unsigned predivide_select, predivisor, multiplier; | ||
69 | |||
70 | /* Trust the bootrom's idea of cpu frequency. */ | ||
71 | scratch = ar5312_rst_reg_read(AR5312_SCRATCH); | ||
72 | if (scratch) | ||
73 | return scratch; | ||
74 | |||
75 | devid = ar5312_rst_reg_read(AR5312_REV); | ||
76 | devid = (devid & AR5312_REV_MAJ) >> AR5312_REV_MAJ_S; | ||
77 | if (devid == AR5312_REV_MAJ_AR2313) { | ||
78 | predivide_mask = AR2313_CLOCKCTL1_PREDIVIDE_MASK; | ||
79 | predivide_shift = AR2313_CLOCKCTL1_PREDIVIDE_SHIFT; | ||
80 | multiplier_mask = AR2313_CLOCKCTL1_MULTIPLIER_MASK; | ||
81 | multiplier_shift = AR2313_CLOCKCTL1_MULTIPLIER_SHIFT; | ||
82 | doubler_mask = AR2313_CLOCKCTL1_DOUBLER_MASK; | ||
83 | } else { /* AR5312 and AR2312 */ | ||
84 | predivide_mask = AR5312_CLOCKCTL1_PREDIVIDE_MASK; | ||
85 | predivide_shift = AR5312_CLOCKCTL1_PREDIVIDE_SHIFT; | ||
86 | multiplier_mask = AR5312_CLOCKCTL1_MULTIPLIER_MASK; | ||
87 | multiplier_shift = AR5312_CLOCKCTL1_MULTIPLIER_SHIFT; | ||
88 | doubler_mask = AR5312_CLOCKCTL1_DOUBLER_MASK; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Clocking is derived from a fixed 40MHz input clock. | ||
93 | * | ||
94 | * cpu_freq = input_clock * MULT (where MULT is PLL multiplier) | ||
95 | * sys_freq = cpu_freq / 4 (used for APB clock, serial, | ||
96 | * flash, Timer, Watchdog Timer) | ||
97 | * | ||
98 | * cnt_freq = cpu_freq / 2 (use for CPU count/compare) | ||
99 | * | ||
100 | * So, for example, with a PLL multiplier of 5, we have | ||
101 | * | ||
102 | * cpu_freq = 200MHz | ||
103 | * sys_freq = 50MHz | ||
104 | * cnt_freq = 100MHz | ||
105 | * | ||
106 | * We compute the CPU frequency, based on PLL settings. | ||
107 | */ | ||
108 | |||
109 | clock_ctl1 = ar5312_rst_reg_read(AR5312_CLOCKCTL1); | ||
110 | predivide_select = (clock_ctl1 & predivide_mask) >> predivide_shift; | ||
111 | predivisor = clockctl1_predivide_table[predivide_select]; | ||
112 | multiplier = (clock_ctl1 & multiplier_mask) >> multiplier_shift; | ||
113 | |||
114 | if (clock_ctl1 & doubler_mask) | ||
115 | multiplier <<= 1; | ||
116 | |||
117 | return (40000000 / predivisor) * multiplier; | ||
118 | } | ||
119 | |||
120 | static inline unsigned ar5312_sys_frequency(void) | ||
121 | { | ||
122 | return ar5312_cpu_frequency() / 4; | ||
123 | } | ||
124 | |||
125 | void __init ar5312_plat_time_init(void) | ||
126 | { | ||
127 | mips_hpt_frequency = ar5312_cpu_frequency() / 2; | ||
128 | } | ||
129 | |||
130 | void __init ar5312_plat_mem_setup(void) | ||
131 | { | ||
132 | void __iomem *sdram_base; | ||
133 | u32 memsize, memcfg, bank0_ac, bank1_ac; | ||
134 | |||
135 | /* Detect memory size */ | ||
136 | sdram_base = ioremap_nocache(AR5312_SDRAMCTL_BASE, | ||
137 | AR5312_SDRAMCTL_SIZE); | ||
138 | memcfg = __raw_readl(sdram_base + AR5312_MEM_CFG1); | ||
139 | bank0_ac = ATH25_REG_MS(memcfg, AR5312_MEM_CFG1_AC0); | ||
140 | bank1_ac = ATH25_REG_MS(memcfg, AR5312_MEM_CFG1_AC1); | ||
141 | memsize = (bank0_ac ? (1 << (bank0_ac + 1)) : 0) + | ||
142 | (bank1_ac ? (1 << (bank1_ac + 1)) : 0); | ||
143 | memsize <<= 20; | ||
144 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
145 | iounmap(sdram_base); | ||
146 | |||
147 | ar5312_rst_base = ioremap_nocache(AR5312_RST_BASE, AR5312_RST_SIZE); | ||
148 | |||
149 | /* Clear any lingering AHB errors */ | ||
150 | ar5312_rst_reg_read(AR5312_PROCADDR); | ||
151 | ar5312_rst_reg_read(AR5312_DMAADDR); | ||
152 | ar5312_rst_reg_write(AR5312_WDT_CTRL, AR5312_WDT_CTRL_IGNORE); | ||
153 | |||
154 | _machine_restart = ar5312_restart; | ||
155 | } | ||
diff --git a/arch/mips/ath25/ar5312.h b/arch/mips/ath25/ar5312.h new file mode 100644 index 000000000000..9e1e56e24eed --- /dev/null +++ b/arch/mips/ath25/ar5312.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __AR5312_H | ||
2 | #define __AR5312_H | ||
3 | |||
4 | #ifdef CONFIG_SOC_AR5312 | ||
5 | |||
6 | void ar5312_plat_time_init(void); | ||
7 | void ar5312_plat_mem_setup(void); | ||
8 | |||
9 | #else | ||
10 | |||
11 | static inline void ar5312_plat_time_init(void) {} | ||
12 | static inline void ar5312_plat_mem_setup(void) {} | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #endif /* __AR5312_H */ | ||
diff --git a/arch/mips/ath25/ar5312_regs.h b/arch/mips/ath25/ar5312_regs.h new file mode 100644 index 000000000000..ff1201119be0 --- /dev/null +++ b/arch/mips/ath25/ar5312_regs.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. | ||
7 | * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> | ||
8 | * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_MACH_ATH25_AR5312_REGS_H | ||
12 | #define __ASM_MACH_ATH25_AR5312_REGS_H | ||
13 | |||
14 | /* | ||
15 | * Address Map | ||
16 | * | ||
17 | * The AR5312 supports 2 enet MACS, even though many reference boards only | ||
18 | * actually use 1 of them (i.e. Only MAC 0 is actually connected to an enet | ||
19 | * PHY or PHY switch. The AR2312 supports 1 enet MAC. | ||
20 | */ | ||
21 | #define AR5312_WLAN0_BASE 0x18000000 | ||
22 | #define AR5312_ENET0_BASE 0x18100000 | ||
23 | #define AR5312_ENET1_BASE 0x18200000 | ||
24 | #define AR5312_SDRAMCTL_BASE 0x18300000 | ||
25 | #define AR5312_SDRAMCTL_SIZE 0x00000010 | ||
26 | #define AR5312_FLASHCTL_BASE 0x18400000 | ||
27 | #define AR5312_FLASHCTL_SIZE 0x00000010 | ||
28 | #define AR5312_WLAN1_BASE 0x18500000 | ||
29 | #define AR5312_UART0_BASE 0x1c000000 /* UART MMR */ | ||
30 | #define AR5312_GPIO_BASE 0x1c002000 | ||
31 | #define AR5312_GPIO_SIZE 0x00000010 | ||
32 | #define AR5312_RST_BASE 0x1c003000 | ||
33 | #define AR5312_RST_SIZE 0x00000100 | ||
34 | #define AR5312_FLASH_BASE 0x1e000000 | ||
35 | #define AR5312_FLASH_SIZE 0x00800000 | ||
36 | |||
37 | /* | ||
38 | * Need these defines to determine true number of ethernet MACs | ||
39 | */ | ||
40 | #define AR5312_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */ | ||
41 | #define AR5312_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ | ||
42 | #define AR5312_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */ | ||
43 | |||
44 | /* Reset/Timer Block Address Map */ | ||
45 | #define AR5312_TIMER 0x0000 /* countdown timer */ | ||
46 | #define AR5312_RELOAD 0x0004 /* timer reload value */ | ||
47 | #define AR5312_WDT_CTRL 0x0008 /* watchdog cntrl */ | ||
48 | #define AR5312_WDT_TIMER 0x000c /* watchdog timer */ | ||
49 | #define AR5312_ISR 0x0010 /* Intr Status Reg */ | ||
50 | #define AR5312_IMR 0x0014 /* Intr Mask Reg */ | ||
51 | #define AR5312_RESET 0x0020 | ||
52 | #define AR5312_CLOCKCTL1 0x0064 | ||
53 | #define AR5312_SCRATCH 0x006c | ||
54 | #define AR5312_PROCADDR 0x0070 | ||
55 | #define AR5312_PROC1 0x0074 | ||
56 | #define AR5312_DMAADDR 0x0078 | ||
57 | #define AR5312_DMA1 0x007c | ||
58 | #define AR5312_ENABLE 0x0080 /* interface enb */ | ||
59 | #define AR5312_REV 0x0090 /* revision */ | ||
60 | |||
61 | /* AR5312_WDT_CTRL register bit field definitions */ | ||
62 | #define AR5312_WDT_CTRL_IGNORE 0x00000000 /* ignore expiration */ | ||
63 | #define AR5312_WDT_CTRL_NMI 0x00000001 | ||
64 | #define AR5312_WDT_CTRL_RESET 0x00000002 | ||
65 | |||
66 | /* AR5312_ISR register bit field definitions */ | ||
67 | #define AR5312_ISR_TIMER 0x00000001 | ||
68 | #define AR5312_ISR_AHBPROC 0x00000002 | ||
69 | #define AR5312_ISR_AHBDMA 0x00000004 | ||
70 | #define AR5312_ISR_GPIO 0x00000008 | ||
71 | #define AR5312_ISR_UART0 0x00000010 | ||
72 | #define AR5312_ISR_UART0DMA 0x00000020 | ||
73 | #define AR5312_ISR_WD 0x00000040 | ||
74 | #define AR5312_ISR_LOCAL 0x00000080 | ||
75 | |||
76 | /* AR5312_RESET register bit field definitions */ | ||
77 | #define AR5312_RESET_SYSTEM 0x00000001 /* cold reset full system */ | ||
78 | #define AR5312_RESET_PROC 0x00000002 /* cold reset MIPS core */ | ||
79 | #define AR5312_RESET_WLAN0 0x00000004 /* cold reset WLAN MAC/BB */ | ||
80 | #define AR5312_RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */ | ||
81 | #define AR5312_RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */ | ||
82 | #define AR5312_RESET_ENET0 0x00000020 /* cold reset ENET0 MAC */ | ||
83 | #define AR5312_RESET_ENET1 0x00000040 /* cold reset ENET1 MAC */ | ||
84 | #define AR5312_RESET_UART0 0x00000100 /* cold reset UART0 */ | ||
85 | #define AR5312_RESET_WLAN1 0x00000200 /* cold reset WLAN MAC/BB */ | ||
86 | #define AR5312_RESET_APB 0x00000400 /* cold reset APB ar5312 */ | ||
87 | #define AR5312_RESET_WARM_PROC 0x00001000 /* warm reset MIPS core */ | ||
88 | #define AR5312_RESET_WARM_WLAN0_MAC 0x00002000 /* warm reset WLAN0 MAC */ | ||
89 | #define AR5312_RESET_WARM_WLAN0_BB 0x00004000 /* warm reset WLAN0 BB */ | ||
90 | #define AR5312_RESET_NMI 0x00010000 /* send an NMI to the CPU */ | ||
91 | #define AR5312_RESET_WARM_WLAN1_MAC 0x00020000 /* warm reset WLAN1 MAC */ | ||
92 | #define AR5312_RESET_WARM_WLAN1_BB 0x00040000 /* warm reset WLAN1 BB */ | ||
93 | #define AR5312_RESET_LOCAL_BUS 0x00080000 /* reset local bus */ | ||
94 | #define AR5312_RESET_WDOG 0x00100000 /* last reset was a wdt */ | ||
95 | |||
96 | #define AR5312_RESET_WMAC0_BITS (AR5312_RESET_WLAN0 |\ | ||
97 | AR5312_RESET_WARM_WLAN0_MAC |\ | ||
98 | AR5312_RESET_WARM_WLAN0_BB) | ||
99 | |||
100 | #define AR5312_RESET_WMAC1_BITS (AR5312_RESET_WLAN1 |\ | ||
101 | AR5312_RESET_WARM_WLAN1_MAC |\ | ||
102 | AR5312_RESET_WARM_WLAN1_BB) | ||
103 | |||
104 | /* AR5312_CLOCKCTL1 register bit field definitions */ | ||
105 | #define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 | ||
106 | #define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 | ||
107 | #define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 | ||
108 | #define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 | ||
109 | #define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 | ||
110 | |||
111 | /* Valid for AR5312 and AR2312 */ | ||
112 | #define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 | ||
113 | #define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 | ||
114 | #define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 | ||
115 | #define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 | ||
116 | #define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 | ||
117 | |||
118 | /* Valid for AR2313 */ | ||
119 | #define AR2313_CLOCKCTL1_PREDIVIDE_MASK 0x00003000 | ||
120 | #define AR2313_CLOCKCTL1_PREDIVIDE_SHIFT 12 | ||
121 | #define AR2313_CLOCKCTL1_MULTIPLIER_MASK 0x001f0000 | ||
122 | #define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT 16 | ||
123 | #define AR2313_CLOCKCTL1_DOUBLER_MASK 0x00000000 | ||
124 | |||
125 | /* AR5312_ENABLE register bit field definitions */ | ||
126 | #define AR5312_ENABLE_WLAN0 0x00000001 | ||
127 | #define AR5312_ENABLE_ENET0 0x00000002 | ||
128 | #define AR5312_ENABLE_ENET1 0x00000004 | ||
129 | #define AR5312_ENABLE_UART_AND_WLAN1_PIO 0x00000008/* UART & WLAN1 PIO */ | ||
130 | #define AR5312_ENABLE_WLAN1_DMA 0x00000010/* WLAN1 DMAs */ | ||
131 | #define AR5312_ENABLE_WLAN1 (AR5312_ENABLE_UART_AND_WLAN1_PIO |\ | ||
132 | AR5312_ENABLE_WLAN1_DMA) | ||
133 | |||
134 | /* AR5312_REV register bit field definitions */ | ||
135 | #define AR5312_REV_WMAC_MAJ 0x0000f000 | ||
136 | #define AR5312_REV_WMAC_MAJ_S 12 | ||
137 | #define AR5312_REV_WMAC_MIN 0x00000f00 | ||
138 | #define AR5312_REV_WMAC_MIN_S 8 | ||
139 | #define AR5312_REV_MAJ 0x000000f0 | ||
140 | #define AR5312_REV_MAJ_S 4 | ||
141 | #define AR5312_REV_MIN 0x0000000f | ||
142 | #define AR5312_REV_MIN_S 0 | ||
143 | #define AR5312_REV_CHIP (AR5312_REV_MAJ|AR5312_REV_MIN) | ||
144 | |||
145 | /* Major revision numbers, bits 7..4 of Revision ID register */ | ||
146 | #define AR5312_REV_MAJ_AR5312 0x4 | ||
147 | #define AR5312_REV_MAJ_AR2313 0x5 | ||
148 | |||
149 | /* Minor revision numbers, bits 3..0 of Revision ID register */ | ||
150 | #define AR5312_REV_MIN_DUAL 0x0 /* Dual WLAN version */ | ||
151 | #define AR5312_REV_MIN_SINGLE 0x1 /* Single WLAN version */ | ||
152 | |||
153 | /* | ||
154 | * ARM Flash Controller -- 3 flash banks with either x8 or x16 devices | ||
155 | */ | ||
156 | #define AR5312_FLASHCTL0 0x0000 | ||
157 | #define AR5312_FLASHCTL1 0x0004 | ||
158 | #define AR5312_FLASHCTL2 0x0008 | ||
159 | |||
160 | /* AR5312_FLASHCTL register bit field definitions */ | ||
161 | #define AR5312_FLASHCTL_IDCY 0x0000000f /* Idle cycle turnaround time */ | ||
162 | #define AR5312_FLASHCTL_IDCY_S 0 | ||
163 | #define AR5312_FLASHCTL_WST1 0x000003e0 /* Wait state 1 */ | ||
164 | #define AR5312_FLASHCTL_WST1_S 5 | ||
165 | #define AR5312_FLASHCTL_RBLE 0x00000400 /* Read byte lane enable */ | ||
166 | #define AR5312_FLASHCTL_WST2 0x0000f800 /* Wait state 2 */ | ||
167 | #define AR5312_FLASHCTL_WST2_S 11 | ||
168 | #define AR5312_FLASHCTL_AC 0x00070000 /* Flash addr check (added) */ | ||
169 | #define AR5312_FLASHCTL_AC_S 16 | ||
170 | #define AR5312_FLASHCTL_AC_128K 0x00000000 | ||
171 | #define AR5312_FLASHCTL_AC_256K 0x00010000 | ||
172 | #define AR5312_FLASHCTL_AC_512K 0x00020000 | ||
173 | #define AR5312_FLASHCTL_AC_1M 0x00030000 | ||
174 | #define AR5312_FLASHCTL_AC_2M 0x00040000 | ||
175 | #define AR5312_FLASHCTL_AC_4M 0x00050000 | ||
176 | #define AR5312_FLASHCTL_AC_8M 0x00060000 | ||
177 | #define AR5312_FLASHCTL_AC_RES 0x00070000 /* 16MB is not supported */ | ||
178 | #define AR5312_FLASHCTL_E 0x00080000 /* Flash bank enable (added) */ | ||
179 | #define AR5312_FLASHCTL_BUSERR 0x01000000 /* Bus transfer error flag */ | ||
180 | #define AR5312_FLASHCTL_WPERR 0x02000000 /* Write protect error flag */ | ||
181 | #define AR5312_FLASHCTL_WP 0x04000000 /* Write protect */ | ||
182 | #define AR5312_FLASHCTL_BM 0x08000000 /* Burst mode */ | ||
183 | #define AR5312_FLASHCTL_MW 0x30000000 /* Mem width */ | ||
184 | #define AR5312_FLASHCTL_MW8 0x00000000 /* Mem width x8 */ | ||
185 | #define AR5312_FLASHCTL_MW16 0x10000000 /* Mem width x16 */ | ||
186 | #define AR5312_FLASHCTL_MW32 0x20000000 /* Mem width x32 (not supp) */ | ||
187 | #define AR5312_FLASHCTL_ATNR 0x00000000 /* Access == no retry */ | ||
188 | #define AR5312_FLASHCTL_ATR 0x80000000 /* Access == retry every */ | ||
189 | #define AR5312_FLASHCTL_ATR4 0xc0000000 /* Access == retry every 4 */ | ||
190 | |||
191 | /* | ||
192 | * ARM SDRAM Controller -- just enough to determine memory size | ||
193 | */ | ||
194 | #define AR5312_MEM_CFG1 0x0004 | ||
195 | |||
196 | #define AR5312_MEM_CFG1_AC0_M 0x00000700 /* bank 0: SDRAM addr check */ | ||
197 | #define AR5312_MEM_CFG1_AC0_S 8 | ||
198 | #define AR5312_MEM_CFG1_AC1_M 0x00007000 /* bank 1: SDRAM addr check */ | ||
199 | #define AR5312_MEM_CFG1_AC1_S 12 | ||
200 | |||
201 | #endif /* __ASM_MACH_ATH25_AR5312_REGS_H */ | ||
diff --git a/arch/mips/ath25/board.c b/arch/mips/ath25/board.c index dd70327fd801..03baeceb3e35 100644 --- a/arch/mips/ath25/board.c +++ b/arch/mips/ath25/board.c | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <asm/bootinfo.h> | 16 | #include <asm/bootinfo.h> |
17 | #include <asm/time.h> | 17 | #include <asm/time.h> |
18 | 18 | ||
19 | #include "devices.h" | ||
20 | #include "ar5312.h" | ||
21 | |||
19 | static void ath25_halt(void) | 22 | static void ath25_halt(void) |
20 | { | 23 | { |
21 | local_irq_disable(); | 24 | local_irq_disable(); |
@@ -27,6 +30,9 @@ void __init plat_mem_setup(void) | |||
27 | _machine_halt = ath25_halt; | 30 | _machine_halt = ath25_halt; |
28 | pm_power_off = ath25_halt; | 31 | pm_power_off = ath25_halt; |
29 | 32 | ||
33 | if (is_ar5312()) | ||
34 | ar5312_plat_mem_setup(); | ||
35 | |||
30 | /* Disable data watchpoints */ | 36 | /* Disable data watchpoints */ |
31 | write_c0_watchlo0(0); | 37 | write_c0_watchlo0(0); |
32 | } | 38 | } |
@@ -37,6 +43,8 @@ asmlinkage void plat_irq_dispatch(void) | |||
37 | 43 | ||
38 | void __init plat_time_init(void) | 44 | void __init plat_time_init(void) |
39 | { | 45 | { |
46 | if (is_ar5312()) | ||
47 | ar5312_plat_time_init(); | ||
40 | } | 48 | } |
41 | 49 | ||
42 | unsigned int __cpuinit get_c0_compare_int(void) | 50 | unsigned int __cpuinit get_c0_compare_int(void) |