1*cbab9cadSchs /* $NetBSD: ar5315.c,v 1.10 2012/10/27 17:18:02 chs Exp $ */
2e653071cSgdamore
3e653071cSgdamore /*
4e653071cSgdamore * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
5e653071cSgdamore * Copyright (c) 2006 Garrett D'Amore.
6e653071cSgdamore * All rights reserved.
7e653071cSgdamore *
8e653071cSgdamore * Portions of this code were written by Garrett D'Amore for the
9e653071cSgdamore * Champaign-Urbana Community Wireless Network Project.
10e653071cSgdamore *
11e653071cSgdamore * Redistribution and use in source and binary forms, with or
12e653071cSgdamore * without modification, are permitted provided that the following
13e653071cSgdamore * conditions are met:
14e653071cSgdamore * 1. Redistributions of source code must retain the above copyright
15e653071cSgdamore * notice, this list of conditions and the following disclaimer.
16e653071cSgdamore * 2. Redistributions in binary form must reproduce the above
17e653071cSgdamore * copyright notice, this list of conditions and the following
18e653071cSgdamore * disclaimer in the documentation and/or other materials provided
19e653071cSgdamore * with the distribution.
20e653071cSgdamore * 3. All advertising materials mentioning features or use of this
21e653071cSgdamore * software must display the following acknowledgements:
22e653071cSgdamore * This product includes software developed by the Urbana-Champaign
23e653071cSgdamore * Independent Media Center.
24e653071cSgdamore * This product includes software developed by Garrett D'Amore.
25e653071cSgdamore * 4. Urbana-Champaign Independent Media Center's name and Garrett
26e653071cSgdamore * D'Amore's name may not be used to endorse or promote products
27e653071cSgdamore * derived from this software without specific prior written permission.
28e653071cSgdamore *
29e653071cSgdamore * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT
30e653071cSgdamore * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR
31e653071cSgdamore * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32e653071cSgdamore * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33e653071cSgdamore * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
34e653071cSgdamore * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
35e653071cSgdamore * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36e653071cSgdamore * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37e653071cSgdamore * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38e653071cSgdamore * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39e653071cSgdamore * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40e653071cSgdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41e653071cSgdamore * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42e653071cSgdamore */
43e653071cSgdamore
44e653071cSgdamore
45e653071cSgdamore /*
46e653071cSgdamore * This file includes a bunch of implementation specific bits for
47e653071cSgdamore * AR5315, which differs these from other members of the AR531X
48e653071cSgdamore * family.
49e653071cSgdamore */
50e653071cSgdamore #include <sys/cdefs.h>
51*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: ar5315.c,v 1.10 2012/10/27 17:18:02 chs Exp $");
52e653071cSgdamore
53e653071cSgdamore #include "opt_ddb.h"
54e653071cSgdamore #include "opt_kgdb.h"
55e653071cSgdamore #include "opt_memsize.h"
5681d18a2fSmatt
5781d18a2fSmatt #define __INTR_PRIVATE
5881d18a2fSmatt
59e653071cSgdamore #include <sys/param.h>
60e653071cSgdamore #include <sys/systm.h>
61e653071cSgdamore #include <sys/kernel.h>
62e653071cSgdamore #include <sys/buf.h>
633a08c4a5Sdyoung #include <sys/device.h>
64e653071cSgdamore
65e653071cSgdamore #include <mips/cache.h>
66e653071cSgdamore #include <mips/locore.h>
67e653071cSgdamore #include <mips/cpuregs.h>
68e653071cSgdamore
69e653071cSgdamore #include <net/if.h>
70e653071cSgdamore #include <net/if_ether.h>
71e653071cSgdamore
723a08c4a5Sdyoung #include <prop/proplib.h>
733a08c4a5Sdyoung
746ce0e276Salc #include <ah_soc.h> /* XXX really doesn't belong in hal */
75e653071cSgdamore
76e653071cSgdamore #include <mips/atheros/include/ar5315reg.h>
7781d18a2fSmatt #include <mips/atheros/include/platform.h>
78e653071cSgdamore #include <mips/atheros/include/arbusvar.h>
79e653071cSgdamore
80fa40faf6Smatt #include <mips/locore.h>
81e653071cSgdamore
82e653071cSgdamore /* helper macro for accessing system registers without bus space */
83e653071cSgdamore #define REGVAL(x) *((volatile uint32_t *)(MIPS_PHYS_TO_KSEG1((x))))
84e653071cSgdamore #define GETSYSREG(x) REGVAL((x) + AR5315_SYSREG_BASE)
85e653071cSgdamore #define PUTSYSREG(x,v) (REGVAL((x) + AR5315_SYSREG_BASE)) = (v)
86e653071cSgdamore #define GETPCIREG(x) REGVAL((x) + AR5315_PCI_BASE)
87e653071cSgdamore #define PUTPCIREG(x,v) (REGVAL((x) + AR5315_PCI_BASE)) = (v)
88179079c7Sgdamore #define GETSDRAMREG(x) REGVAL((x) + AR5315_SDRAMCTL_BASE)
89e653071cSgdamore
9081d18a2fSmatt static uint32_t
ar5315_get_memsize(void)9181d18a2fSmatt ar5315_get_memsize(void)
92e653071cSgdamore {
93179079c7Sgdamore #ifndef MEMSIZE
94179079c7Sgdamore uint32_t memsize = 0;
95179079c7Sgdamore uint32_t memcfg, cw, rw, dw;
96e653071cSgdamore
97e653071cSgdamore /*
98179079c7Sgdamore * Determine the memory size. We query the board info.
99e653071cSgdamore */
100179079c7Sgdamore memcfg = GETSDRAMREG(AR5315_SDRAMCTL_MEM_CFG);
10181d18a2fSmatt cw = __SHIFTOUT(memcfg, AR5315_MEM_CFG_COL_WIDTH);
102179079c7Sgdamore cw += 1;
10381d18a2fSmatt rw = __SHIFTOUT(memcfg, AR5315_MEM_CFG_ROW_WIDTH);
104179079c7Sgdamore rw += 1;
105179079c7Sgdamore
106179079c7Sgdamore /* XXX: according to redboot, this could be wrong if DDR SDRAM */
10781d18a2fSmatt dw = __SHIFTOUT(memcfg, AR5315_MEM_CFG_DATA_WIDTH);
108179079c7Sgdamore dw += 1;
109179079c7Sgdamore dw *= 8; /* bits */
110179079c7Sgdamore
111179079c7Sgdamore /* not too sure about this math, but it _seems_ to add up */
112179079c7Sgdamore memsize = (1 << cw) * (1 << rw) * dw;
113179079c7Sgdamore #if 0
114179079c7Sgdamore printf("SDRAM_MEM_CFG =%x, cw=%d rw=%d dw=%d xmemsize=%d\n", memcfg,
115179079c7Sgdamore cw, rw, dw, memsize);
116e653071cSgdamore #endif
117e653071cSgdamore
118e653071cSgdamore return (memsize);
119179079c7Sgdamore #else
120179079c7Sgdamore /* compile time value forced */
121179079c7Sgdamore return MEMSIZE;
122179079c7Sgdamore #endif
123e653071cSgdamore }
124e653071cSgdamore
12581d18a2fSmatt static void
ar5315_wdog_reload(uint32_t period)12681d18a2fSmatt ar5315_wdog_reload(uint32_t period)
127e653071cSgdamore {
128e653071cSgdamore
129e653071cSgdamore if (period == 0) {
130e653071cSgdamore PUTSYSREG(AR5315_SYSREG_WDOG_CTL, AR5315_WDOG_CTL_IGNORE);
131e653071cSgdamore PUTSYSREG(AR5315_SYSREG_WDOG_TIMER, 0);
132e653071cSgdamore } else {
133e653071cSgdamore PUTSYSREG(AR5315_SYSREG_WDOG_TIMER, period);
134e653071cSgdamore PUTSYSREG(AR5315_SYSREG_WDOG_CTL, AR5315_WDOG_CTL_RESET);
135e653071cSgdamore }
136e653071cSgdamore }
137e653071cSgdamore
13881d18a2fSmatt static void
ar5315_bus_init(void)13981d18a2fSmatt ar5315_bus_init(void)
140e653071cSgdamore {
141e653071cSgdamore /*
14281d18a2fSmatt * Set CCA of KSEG0 access to 3 (actually any value other than
14381d18a2fSmatt * 2 & 7 means that KSEG0 accesses are cached but 3 is standard
14481d18a2fSmatt * value for writeback caching).
145e653071cSgdamore */
14681d18a2fSmatt mips3_cp0_config_write((mips3_cp0_config_read() & -8) | 3);
147e653071cSgdamore
148e653071cSgdamore PUTSYSREG(AR5315_SYSREG_AHB_ERR0, AR5315_AHB_ERROR_DET);
149e653071cSgdamore GETSYSREG(AR5315_SYSREG_AHB_ERR1);
150e653071cSgdamore }
151e653071cSgdamore
15281d18a2fSmatt static void
ar5315_get_freqs(struct arfreqs * freqs)15381d18a2fSmatt ar5315_get_freqs(struct arfreqs *freqs)
154e653071cSgdamore {
15581d18a2fSmatt static const uint8_t pll_divide_table[] = {
156e653071cSgdamore 2, 3, 4, 6, 3,
157e653071cSgdamore /*
158e653071cSgdamore * these entries are bogus, but it avoids a possible
159e653071cSgdamore * bad table dereference
160e653071cSgdamore */
161e653071cSgdamore 1, 1, 1
162e653071cSgdamore };
16381d18a2fSmatt static const uint8_t pre_divide_table[] = {
164e653071cSgdamore 1, 2, 4, 5
165e653071cSgdamore };
166e653071cSgdamore
16781d18a2fSmatt const uint32_t pllc = GETSYSREG(AR5315_SYSREG_PLLC_CTL);
168e653071cSgdamore
16981d18a2fSmatt const uint32_t refdiv = pre_divide_table[AR5315_PLLC_REF_DIV(pllc)];
17081d18a2fSmatt const uint32_t fbdiv = AR5315_PLLC_FB_DIV(pllc);
17181d18a2fSmatt const uint32_t div2 = (AR5315_PLLC_DIV_2(pllc) + 1) * 2; /* results in 2 or 4 */
172e653071cSgdamore
17381d18a2fSmatt freqs->freq_ref = 40000000;
174e653071cSgdamore
175e653071cSgdamore /* 40MHz reference clk, reference and feedback dividers */
17681d18a2fSmatt freqs->freq_pll = (freqs->freq_ref / refdiv) * div2 * fbdiv;
177e653071cSgdamore
17881d18a2fSmatt const uint32_t pllout[4] = {
179e653071cSgdamore /* CLKM select */
18081d18a2fSmatt [0] = freqs->freq_pll / pll_divide_table[AR5315_PLLC_CLKM(pllc)],
18181d18a2fSmatt [1] = freqs->freq_pll / pll_divide_table[AR5315_PLLC_CLKM(pllc)],
18281d18a2fSmatt
183e653071cSgdamore /* CLKC select */
18481d18a2fSmatt [2] = freqs->freq_pll / pll_divide_table[AR5315_PLLC_CLKC(pllc)],
18581d18a2fSmatt
186e653071cSgdamore /* ref_clk select */
18781d18a2fSmatt [3] = freqs->freq_ref, /* use original reference clock */
18881d18a2fSmatt };
189e653071cSgdamore
19081d18a2fSmatt const uint32_t amba_clkctl = GETSYSREG(AR5315_SYSREG_AMBACLK);
19181d18a2fSmatt uint32_t ambadiv = AR5315_CLOCKCTL_DIV(amba_clkctl);
19281d18a2fSmatt ambadiv = ambadiv ? (ambadiv * 2) : 1;
19381d18a2fSmatt freqs->freq_bus = pllout[AR5315_CLOCKCTL_SELECT(amba_clkctl)] / ambadiv;
194e653071cSgdamore
19581d18a2fSmatt const uint32_t cpu_clkctl = GETSYSREG(AR5315_SYSREG_CPUCLK);
19681d18a2fSmatt uint32_t cpudiv = AR5315_CLOCKCTL_DIV(cpu_clkctl);
19781d18a2fSmatt cpudiv = cpudiv ? (cpudiv * 2) : 1;
19881d18a2fSmatt freqs->freq_cpu = pllout[AR5315_CLOCKCTL_SELECT(cpu_clkctl)] / cpudiv;
199e653071cSgdamore
20081d18a2fSmatt freqs->freq_mem = 0;
201e653071cSgdamore }
202e653071cSgdamore
203e653071cSgdamore static void
addprop_data(device_t dev,const char * name,const uint8_t * data,int len)20481d18a2fSmatt addprop_data(device_t dev, const char *name, const uint8_t *data,
205e653071cSgdamore int len)
206e653071cSgdamore {
207e653071cSgdamore prop_data_t pd;
208e653071cSgdamore pd = prop_data_create_data(data, len);
209e653071cSgdamore KASSERT(pd != NULL);
21009c5f9ccSthorpej if (prop_dictionary_set(device_properties(dev), name, pd) == false) {
211e653071cSgdamore printf("WARNING: unable to set %s property for %s\n",
212e653071cSgdamore name, device_xname(dev));
213e653071cSgdamore }
214e653071cSgdamore prop_object_release(pd);
215e653071cSgdamore }
216e653071cSgdamore
217e653071cSgdamore static void
addprop_integer(device_t dev,const char * name,uint32_t val)21881d18a2fSmatt addprop_integer(device_t dev, const char *name, uint32_t val)
219e653071cSgdamore {
220e653071cSgdamore prop_number_t pn;
221e653071cSgdamore pn = prop_number_create_integer(val);
222e653071cSgdamore KASSERT(pn != NULL);
22309c5f9ccSthorpej if (prop_dictionary_set(device_properties(dev), name, pn) == false) {
224e653071cSgdamore printf("WARNING: unable to set %s property for %s",
225e653071cSgdamore name, device_xname(dev));
226e653071cSgdamore }
227e653071cSgdamore prop_object_release(pn);
228e653071cSgdamore }
229e653071cSgdamore
23081d18a2fSmatt static void
ar5315_device_register(device_t dev,void * aux)231*cbab9cadSchs ar5315_device_register(device_t dev, void *aux)
232e653071cSgdamore {
23381d18a2fSmatt const struct arbus_attach_args * const aa = aux;
23481d18a2fSmatt const struct ar531x_boarddata * const info = atheros_get_board_info();
235e653071cSgdamore
23681d18a2fSmatt if (device_is_a(dev, "com")) {
23781d18a2fSmatt addprop_integer(dev, "frequency", atheros_get_bus_freq());
23881d18a2fSmatt }
23981d18a2fSmatt
240e653071cSgdamore if (info == NULL) {
241e653071cSgdamore /* nothing known about this board! */
242e653071cSgdamore return;
243e653071cSgdamore }
244e653071cSgdamore
245e653071cSgdamore /*
246e653071cSgdamore * We don't ever know the boot device. But that's because the
247e653071cSgdamore * firmware only loads from the network.
248e653071cSgdamore */
249e653071cSgdamore
250e653071cSgdamore /* Fetch the MAC addresses. */
251e653071cSgdamore if (device_is_a(dev, "ae")) {
252e653071cSgdamore const uint8_t *enet;
253e653071cSgdamore
254e653071cSgdamore if (aa->aa_addr == AR5315_ENET_BASE)
255e653071cSgdamore enet = info->enet0Mac;
256e653071cSgdamore else
257e653071cSgdamore return;
258e653071cSgdamore
259f9e1815aSmartin addprop_data(dev, "mac-address", enet, ETHER_ADDR_LEN);
260e653071cSgdamore }
261e653071cSgdamore
262e653071cSgdamore if (device_is_a(dev, "ath")) {
263e653071cSgdamore const uint8_t *enet;
264e653071cSgdamore
265e653071cSgdamore if (aa->aa_addr == AR5315_WLAN_BASE)
266e653071cSgdamore enet = info->wlan0Mac;
267e653071cSgdamore else
268e653071cSgdamore return;
269e653071cSgdamore
270f9e1815aSmartin addprop_data(dev, "mac-address", enet, ETHER_ADDR_LEN);
271e653071cSgdamore
272e653071cSgdamore addprop_integer(dev, "wmac-rev",
273e653071cSgdamore GETSYSREG(AR5315_SYSREG_SREV));
274e653071cSgdamore }
275e653071cSgdamore
276e653071cSgdamore if (device_is_a(dev, "argpio")) {
277e653071cSgdamore if (info->config & BD_RSTFACTORY) {
278e653071cSgdamore addprop_integer(dev, "reset-pin",
279e653071cSgdamore info->resetConfigGpio);
280e653071cSgdamore }
281e653071cSgdamore if (info->config & BD_SYSLED) {
282e653071cSgdamore addprop_integer(dev, "sysled-pin",
283e653071cSgdamore info->sysLedGpio);
284e653071cSgdamore }
285e653071cSgdamore }
286e653071cSgdamore }
287e653071cSgdamore
28881d18a2fSmatt static int
ar5315_enable_device(const struct atheros_device * adv)28981d18a2fSmatt ar5315_enable_device(const struct atheros_device *adv)
290e653071cSgdamore {
29181d18a2fSmatt if (adv->adv_addr == AR5315_WLAN_BASE) {
292e653071cSgdamore /* enable arbitration for wlan */
293e653071cSgdamore PUTSYSREG(AR5315_SYSREG_AHB_ARB_CTL,
294e653071cSgdamore GETSYSREG(AR5315_SYSREG_AHB_ARB_CTL) | AR5315_ARB_WLAN);
295e653071cSgdamore
296e653071cSgdamore /* set WLAN for big endian */
297e653071cSgdamore PUTSYSREG(AR5315_SYSREG_ENDIAN,
298e653071cSgdamore GETSYSREG(AR5315_SYSREG_ENDIAN) | AR5315_ENDIAN_WLAN);
299e653071cSgdamore
300e653071cSgdamore /* wake up the mac */
301e653071cSgdamore PUTPCIREG(AR5315_PCI_MAC_SCR,
302e653071cSgdamore (GETPCIREG(AR5315_PCI_MAC_SCR) & ~PCI_MAC_SCR_SLM_MASK) |
303e653071cSgdamore PCI_MAC_SCR_SLM_FWAKE);
304e653071cSgdamore
305e653071cSgdamore /* wait for it to wake up */
306e653071cSgdamore while (GETPCIREG(AR5315_PCI_MAC_PCICFG) &
307e653071cSgdamore PCI_MAC_PCICFG_SPWR_DN);
308e653071cSgdamore }
309e653071cSgdamore return 0;
310e653071cSgdamore }
31181d18a2fSmatt
31281d18a2fSmatt static void
ar5315_intr_init(void)31381d18a2fSmatt ar5315_intr_init(void)
31481d18a2fSmatt {
31581d18a2fSmatt atheros_intr_init();
31681d18a2fSmatt }
31781d18a2fSmatt
31881d18a2fSmatt static void
ar5315_reset(void)31981d18a2fSmatt ar5315_reset(void)
32081d18a2fSmatt {
32181d18a2fSmatt PUTSYSREG(AR5315_SYSREG_COLDRESET,
32281d18a2fSmatt AR5315_COLD_AHB | AR5315_COLD_APB | AR5315_COLD_CPU);
32381d18a2fSmatt }
32481d18a2fSmatt
32581d18a2fSmatt const static struct atheros_device ar5315_devices[] = {
32681d18a2fSmatt {
32781d18a2fSmatt .adv_name = "com",
32881d18a2fSmatt .adv_addr = AR5315_UART_BASE,
32981d18a2fSmatt .adv_size = 0x1000,
33081d18a2fSmatt .adv_cirq = AR5315_CPU_IRQ_MISC,
33181d18a2fSmatt .adv_mirq = AR5315_MISC_IRQ_UART,
33281d18a2fSmatt }, {
33381d18a2fSmatt .adv_name = "ae",
33481d18a2fSmatt .adv_addr = AR5315_ENET_BASE,
33581d18a2fSmatt .adv_size = 0x100000,
33681d18a2fSmatt .adv_cirq = AR5315_CPU_IRQ_ENET,
33781d18a2fSmatt .adv_mirq = -1,
33881d18a2fSmatt }, {
33981d18a2fSmatt .adv_name = "ath",
34081d18a2fSmatt .adv_addr = AR5315_WLAN_BASE,
34181d18a2fSmatt .adv_size = 0x100000,
34281d18a2fSmatt .adv_cirq = AR5315_CPU_IRQ_WLAN,
34381d18a2fSmatt .adv_mirq = -1,
34481d18a2fSmatt }, {
34581d18a2fSmatt .adv_name = "arspi",
34681d18a2fSmatt .adv_addr = AR5315_SPI_BASE,
34781d18a2fSmatt .adv_size = 0x10,
34881d18a2fSmatt .adv_cirq = AR5315_CPU_IRQ_MISC,
34981d18a2fSmatt .adv_mirq = AR5315_MISC_IRQ_SPI,
35081d18a2fSmatt }, {
35181d18a2fSmatt .adv_name = NULL
35281d18a2fSmatt }
35381d18a2fSmatt };
35481d18a2fSmatt
35581d18a2fSmatt static const struct ipl_sr_map ar5315_ipl_sr_map = {
35681d18a2fSmatt .sr_bits = {
35781d18a2fSmatt [IPL_NONE] = 0,
35881d18a2fSmatt [IPL_SOFTCLOCK] = MIPS_SOFT_INT_MASK_0,
35981d18a2fSmatt [IPL_SOFTBIO] = MIPS_SOFT_INT_MASK_0,
36081d18a2fSmatt [IPL_SOFTNET] = MIPS_SOFT_INT_MASK,
36181d18a2fSmatt [IPL_SOFTSERIAL] = MIPS_SOFT_INT_MASK,
36281d18a2fSmatt [IPL_VM] = MIPS_SOFT_INT_MASK | MIPS_INT_MASK_0
36381d18a2fSmatt | MIPS_INT_MASK_1 | MIPS_INT_MASK_2,
36481d18a2fSmatt [IPL_SCHED] = MIPS_INT_MASK,
36581d18a2fSmatt [IPL_DDB] = MIPS_INT_MASK,
36681d18a2fSmatt [IPL_HIGH] = MIPS_INT_MASK,
36781d18a2fSmatt },
36881d18a2fSmatt };
36981d18a2fSmatt
37081d18a2fSmatt static const char * const ar5315_cpu_intrnames[] = {
37181d18a2fSmatt "int 0 (misc)",
37281d18a2fSmatt "int 1 (wlan)",
37381d18a2fSmatt "int 2 (enet)",
37481d18a2fSmatt };
37581d18a2fSmatt
37681d18a2fSmatt static const char * const ar5315_misc_intrnames[] = {
37781d18a2fSmatt "misc 0 (uart)",
37881d18a2fSmatt "misc 1 (i2c)",
37981d18a2fSmatt "misc 2 (spi)",
38081d18a2fSmatt "misc 3 (ahb error)",
38181d18a2fSmatt "misc 4 (apb error)",
38281d18a2fSmatt "misc 5 (timer)",
38381d18a2fSmatt "misc 6 (gpio)",
38481d18a2fSmatt "misc 7 (watchdog)",
38581d18a2fSmatt "misc 8 (ir)"
38681d18a2fSmatt };
38781d18a2fSmatt
38881d18a2fSmatt const struct atheros_platformsw ar5315_platformsw = {
38981d18a2fSmatt .apsw_intrsw = &atheros_intrsw,
39081d18a2fSmatt .apsw_intr_init = ar5315_intr_init,
39181d18a2fSmatt .apsw_cpu_intrnames = ar5315_cpu_intrnames,
39281d18a2fSmatt .apsw_misc_intrnames = ar5315_misc_intrnames,
39381d18a2fSmatt .apsw_cpu_nintrs = __arraycount(ar5315_cpu_intrnames),
39481d18a2fSmatt .apsw_misc_nintrs = __arraycount(ar5315_misc_intrnames),
39581d18a2fSmatt .apsw_cpuirq_misc = AR5315_CPU_IRQ_MISC,
39681d18a2fSmatt .apsw_ipl_sr_map = &ar5315_ipl_sr_map,
39781d18a2fSmatt
39881d18a2fSmatt .apsw_revision_id_addr = AR5315_SYSREG_BASE + AR5315_SYSREG_SREV,
39981d18a2fSmatt .apsw_uart0_base = AR5315_UART_BASE,
40081d18a2fSmatt .apsw_misc_intstat = AR5315_SYSREG_BASE + AR5315_SYSREG_MISC_INTSTAT,
40181d18a2fSmatt .apsw_misc_intmask = AR5315_SYSREG_BASE + AR5315_SYSREG_MISC_INTMASK,
40281d18a2fSmatt
40381d18a2fSmatt /*
40481d18a2fSmatt * CPU specific routines.
40581d18a2fSmatt */
40681d18a2fSmatt .apsw_get_memsize = ar5315_get_memsize,
40781d18a2fSmatt .apsw_wdog_reload = ar5315_wdog_reload,
40881d18a2fSmatt .apsw_bus_init = ar5315_bus_init,
40981d18a2fSmatt .apsw_reset = ar5315_reset,
41081d18a2fSmatt
41181d18a2fSmatt .apsw_get_freqs = ar5315_get_freqs,
41281d18a2fSmatt .apsw_device_register = ar5315_device_register,
41381d18a2fSmatt .apsw_enable_device = ar5315_enable_device,
41481d18a2fSmatt .apsw_devices = ar5315_devices,
41581d18a2fSmatt };
416