Home | History | Annotate | Line # | Download | only in atheros
ar9344.c revision 1.3.12.1
      1  1.3.12.1   tls /* $NetBSD: ar9344.c,v 1.3.12.1 2012/11/20 03:01:32 tls Exp $ */
      2       1.1  matt 
      3       1.1  matt /*
      4       1.1  matt  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
      5       1.1  matt  * Copyright (c) 2006 Garrett D'Amore.
      6       1.1  matt  * All rights reserved.
      7       1.1  matt  *
      8       1.1  matt  * Portions of this code were written by Garrett D'Amore for the
      9       1.1  matt  * Champaign-Urbana Community Wireless Network Project.
     10       1.1  matt  *
     11       1.1  matt  * Redistribution and use in source and binary forms, with or
     12       1.1  matt  * without modification, are permitted provided that the following
     13       1.1  matt  * conditions are met:
     14       1.1  matt  * 1. Redistributions of source code must retain the above copyright
     15       1.1  matt  *    notice, this list of conditions and the following disclaimer.
     16       1.1  matt  * 2. Redistributions in binary form must reproduce the above
     17       1.1  matt  *    copyright notice, this list of conditions and the following
     18       1.1  matt  *    disclaimer in the documentation and/or other materials provided
     19       1.1  matt  *    with the distribution.
     20       1.1  matt  * 3. All advertising materials mentioning features or use of this
     21       1.1  matt  *    software must display the following acknowledgements:
     22       1.1  matt  *      This product includes software developed by the Urbana-Champaign
     23       1.1  matt  *      Independent Media Center.
     24       1.1  matt  *	This product includes software developed by Garrett D'Amore.
     25       1.1  matt  * 4. Urbana-Champaign Independent Media Center's name and Garrett
     26       1.1  matt  *    D'Amore's name may not be used to endorse or promote products
     27       1.1  matt  *    derived from this software without specific prior written permission.
     28       1.1  matt  *
     29       1.1  matt  * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT
     30       1.1  matt  * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR
     31       1.1  matt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     32       1.1  matt  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     33       1.1  matt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
     34       1.1  matt  * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
     35       1.1  matt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     36       1.1  matt  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     37       1.1  matt  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     38       1.1  matt  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.1  matt  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     40       1.1  matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     41       1.1  matt  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     42       1.1  matt  */
     43       1.1  matt 
     44       1.1  matt 
     45       1.1  matt /*
     46       1.1  matt  * This file includes a bunch of implementation specific bits for
     47       1.1  matt  * AR9344, which differs these from other members of the AR9344
     48       1.1  matt  * family.
     49       1.1  matt  */
     50       1.1  matt #include <sys/cdefs.h>
     51  1.3.12.1   tls __KERNEL_RCSID(0, "$NetBSD: ar9344.c,v 1.3.12.1 2012/11/20 03:01:32 tls Exp $");
     52       1.1  matt 
     53       1.1  matt #include "opt_ddb.h"
     54       1.1  matt #include "opt_kgdb.h"
     55       1.1  matt #include "opt_memsize.h"
     56       1.1  matt 
     57       1.1  matt #define __INTR_PRIVATE
     58       1.1  matt 
     59       1.1  matt #include <sys/param.h>
     60       1.1  matt #include <sys/device.h>
     61       1.1  matt #include <sys/kernel.h>
     62       1.1  matt #include <sys/systm.h>
     63       1.1  matt 
     64       1.1  matt #include <mips/locore.h>
     65       1.1  matt 
     66       1.1  matt #include <mips/atheros/include/ar9344reg.h>
     67       1.1  matt #include <mips/atheros/include/platform.h>
     68       1.1  matt #include <mips/atheros/include/arbusvar.h>
     69       1.1  matt 
     70       1.1  matt static uint32_t
     71       1.1  matt ar9344_get_memsize(void)
     72       1.1  matt {
     73       1.1  matt #ifndef	MEMSIZE
     74       1.1  matt 	uint32_t	memsize = 64*1024*1024;
     75       1.1  matt 
     76       1.1  matt 	uint32_t	memcfg = GETDDRREG(AR9344_DDR_RD_DATA_THIS_CYCLE);
     77       1.1  matt 
     78       1.1  matt 	/*
     79       1.1  matt 	 * 32-bit means twice the memory.
     80       1.1  matt 	 */
     81       1.1  matt 	if (memcfg == 0xff)
     82       1.1  matt 		memsize <<= 1;
     83       1.1  matt 
     84       1.1  matt 	return memsize;
     85       1.1  matt #else
     86       1.1  matt 	/* compile time value forced */
     87       1.1  matt 	return MEMSIZE;
     88       1.1  matt #endif
     89       1.1  matt }
     90       1.1  matt 
     91       1.1  matt static void
     92       1.1  matt ar9344_wdog_reload(uint32_t period)
     93       1.1  matt {
     94       1.1  matt 
     95       1.1  matt 	if (period == 0) {
     96       1.1  matt 		PUTRESETREG(ARCHIP_RESET_WDOG_CTL, ARCHIP_WDOG_CTL_IGNORE);
     97       1.1  matt 		PUTRESETREG(ARCHIP_RESET_WDOG_TIMER, 0);
     98       1.1  matt 	} else {
     99       1.1  matt 		PUTRESETREG(ARCHIP_RESET_WDOG_TIMER, period);
    100       1.1  matt 		PUTRESETREG(ARCHIP_RESET_WDOG_CTL, ARCHIP_WDOG_CTL_RESET);
    101       1.1  matt 	}
    102       1.1  matt }
    103       1.1  matt 
    104       1.1  matt static void
    105       1.1  matt ar9344_bus_init(void)
    106       1.1  matt {
    107       1.1  matt #if 0
    108       1.1  matt 	PUTRESET(AR9344_RESET_AHB_ERR0, AR9344_AHB_ERROR_DET);
    109       1.1  matt 	GETRESET(AR9344_RESET_AHB_ERR1);
    110       1.1  matt #endif
    111       1.1  matt }
    112       1.1  matt 
    113       1.1  matt static void
    114       1.1  matt ar9344_reset(void)
    115       1.1  matt {
    116       1.1  matt 	PUTRESETREG(AR9344_RESET_RESETCTL, ARCHIP_RESETCTL_FULL_CHIP_RESET);
    117       1.1  matt }
    118       1.1  matt 
    119       1.1  matt 
    120       1.1  matt static void
    121       1.1  matt ar9344_get_freqs(struct arfreqs *freqs)
    122       1.1  matt {
    123       1.1  matt 	uint32_t out_div, ref_div, nint, nfrac, post_div;
    124       1.1  matt 	uint32_t pll;
    125       1.1  matt 	uint32_t ref_clk;
    126       1.1  matt 
    127       1.1  matt 	if (GETRESETREG(AR9344_RESET_BOOTSTRAP) & AR9344_BOOTSTRAP_REF_CLK_40) {
    128       1.1  matt 		ref_clk = 40 * 1000000;
    129       1.1  matt 	} else {
    130       1.1  matt 		ref_clk = 25 * 1000000;
    131       1.1  matt 	}
    132       1.1  matt 
    133       1.1  matt 	freqs->freq_ref = ref_clk;
    134       1.1  matt 
    135       1.1  matt 	/*
    136       1.1  matt 	 * Let's figure out the CPU PLL frequency.
    137       1.1  matt 	 */
    138       1.1  matt 	pll = GETPLLREG(ARCHIP_PLL_CPU_PLL_CONFIG);
    139       1.1  matt 	out_div = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_OUTDIV);
    140       1.1  matt 	ref_div = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_REFDIV);
    141       1.1  matt 	nint = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_NINT);
    142       1.1  matt 	nfrac = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_NFRAC);
    143       1.1  matt 
    144       1.1  matt 	const uint32_t cpu_pll_freq = (nint * ref_clk / ref_div) >> out_div;
    145       1.1  matt 
    146       1.1  matt 	/*
    147       1.1  matt 	 * Now figure out the DDR PLL frequency.
    148       1.1  matt 	 */
    149       1.1  matt 	pll = GETPLLREG(ARCHIP_PLL_DDR_PLL_CONFIG);
    150       1.1  matt 	out_div = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_OUTDIV);
    151       1.1  matt 	ref_div = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_REFDIV);
    152       1.1  matt 	nint = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_NINT);
    153       1.1  matt 	nfrac = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_NFRAC);
    154       1.1  matt 
    155       1.1  matt 	const uint32_t ddr_pll_freq = (nint * ref_clk / ref_div) >> out_div;
    156       1.1  matt 
    157       1.1  matt 	/*
    158       1.1  matt 	 * Now we find out the various frequencies...
    159       1.1  matt 	 */
    160       1.1  matt 	uint32_t clk_ctl = GETPLLREG(ARCHIP_PLL_CPU_DDR_CLOCK_CONTROL);
    161       1.1  matt 	post_div = __SHIFTOUT(clk_ctl,
    162       1.1  matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV);
    163       1.1  matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL) {
    164       1.1  matt 		freqs->freq_bus = ddr_pll_freq / (post_div + 1);
    165       1.1  matt 	} else {
    166       1.1  matt 		freqs->freq_bus = cpu_pll_freq / (post_div + 1);
    167       1.1  matt 	}
    168       1.1  matt 
    169       1.1  matt 	post_div = __SHIFTOUT(clk_ctl,
    170       1.1  matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV);
    171       1.1  matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_CPUCLK_FROM_CPUPLL) {
    172       1.1  matt 		freqs->freq_cpu = cpu_pll_freq / (post_div + 1);
    173       1.1  matt 		freqs->freq_pll = cpu_pll_freq;
    174       1.1  matt 	} else {
    175       1.1  matt 		freqs->freq_cpu = ddr_pll_freq / (post_div + 1);
    176       1.1  matt 		freqs->freq_pll = ddr_pll_freq;
    177       1.1  matt 	}
    178       1.1  matt 
    179       1.1  matt 	post_div = __SHIFTOUT(clk_ctl,
    180       1.1  matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV);
    181       1.1  matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_DDRCLK_FROM_DDRPLL) {
    182       1.1  matt 		freqs->freq_mem = ddr_pll_freq / (post_div + 1);
    183       1.1  matt 	} else {
    184       1.1  matt 		freqs->freq_mem = cpu_pll_freq / (post_div + 1);
    185       1.1  matt 	}
    186       1.2  matt 
    187       1.2  matt 	/*
    188       1.2  matt 	 * Console is off the reference clock, not the bus clock.
    189       1.2  matt 	 */
    190       1.2  matt 	freqs->freq_uart = freqs->freq_ref;
    191       1.1  matt }
    192       1.1  matt 
    193       1.1  matt #if 0
    194       1.1  matt static void
    195  1.3.12.1   tls addprop_data(device_t dev, const char *name, const uint8_t *data,
    196       1.1  matt     int len)
    197       1.1  matt {
    198       1.1  matt 	prop_data_t	pd;
    199       1.1  matt 	pd = prop_data_create_data(data, len);
    200       1.1  matt 	KASSERT(pd != NULL);
    201       1.1  matt 	if (prop_dictionary_set(device_properties(dev), name, pd) == FALSE) {
    202       1.1  matt 		printf("WARNING: unable to set %s property for %s\n",
    203       1.1  matt 		    name, device_xname(dev));
    204       1.1  matt 	}
    205       1.1  matt 	prop_object_release(pd);
    206       1.1  matt }
    207       1.1  matt #endif
    208       1.1  matt 
    209       1.1  matt static void
    210  1.3.12.1   tls addprop_integer(device_t dev, const char *name, uint32_t val)
    211       1.1  matt {
    212       1.1  matt 	prop_number_t	pn;
    213       1.1  matt 	pn = prop_number_create_integer(val);
    214       1.1  matt 	KASSERT(pn != NULL);
    215       1.1  matt 	if (prop_dictionary_set(device_properties(dev), name, pn) == FALSE) {
    216       1.1  matt 		printf("WARNING: unable to set %s property for %s",
    217       1.1  matt 		    name, device_xname(dev));
    218       1.1  matt 	}
    219       1.1  matt 	prop_object_release(pn);
    220       1.1  matt }
    221       1.1  matt 
    222       1.1  matt static void
    223       1.1  matt ar9344_device_register(device_t dev, void *aux)
    224       1.1  matt {
    225       1.1  matt 
    226       1.1  matt 	if (device_is_a(dev, "com")
    227       1.1  matt 	    && device_is_a(device_parent(dev), "arbus")) {
    228       1.1  matt 		addprop_integer(dev, "frequency", atheros_get_bus_freq());
    229       1.1  matt 		return;
    230       1.1  matt 	}
    231       1.1  matt 
    232       1.1  matt #if 0
    233       1.1  matt 	const struct arbus_attach_args * const aa = aux;
    234       1.1  matt 	const struct ar9344_boarddata *info;
    235       1.1  matt 	info = ar9344_board_info();
    236       1.1  matt 	if (info == NULL) {
    237       1.1  matt 		/* nothing known about this board! */
    238       1.1  matt 		return;
    239       1.1  matt 	}
    240       1.1  matt 
    241       1.1  matt 	/*
    242       1.1  matt 	 * We don't ever know the boot device.  But that's because the
    243       1.1  matt 	 * firmware only loads from the network.
    244       1.1  matt 	 */
    245       1.1  matt 
    246       1.1  matt 	/* Fetch the MAC addresses. */
    247       1.1  matt 	if (device_is_a(dev, "ae")) {
    248       1.1  matt 		uint8_t enaddr[ETHER_ADDR_LEN];
    249       1.1  matt 
    250       1.1  matt 		memcpy(enaddr, info->enet0Mac, ETHER_ADDR_LEN);
    251       1.1  matt 		if (aa->aa_addr == AR9344_GMAC0_BASE) {
    252       1.1  matt 			;
    253       1.1  matt 		} else if (aa->aa_addr == AR9344_GMAC1_BASE) {
    254       1.1  matt 			enaddr[5] ^= 1;
    255       1.1  matt 		} else
    256       1.1  matt 			return;
    257       1.1  matt 
    258       1.1  matt 		addprop_data(dev, "mac-addr", enaddr, ETHER_ADDR_LEN);
    259       1.1  matt 	}
    260       1.1  matt 
    261       1.1  matt #if 0
    262       1.1  matt 	if (device_is_a(dev, "ath")) {
    263       1.1  matt 		const uint8_t *enet;
    264       1.1  matt 
    265       1.1  matt 		if (aa->aa_addr == AR9344_WLAN_BASE)
    266       1.1  matt 			enet = info->wlan0Mac;
    267       1.1  matt 		else
    268       1.1  matt 			return;
    269       1.1  matt 
    270       1.1  matt 		addprop_data(dev, "mac-addr", enet, ETHER_ADDR_LEN);
    271       1.1  matt 
    272       1.1  matt 		addprop_integer(dev, "wmac-rev",
    273       1.1  matt 		    GETRESET(AR9344_RESET_SREV));
    274       1.1  matt 	}
    275       1.1  matt #endif
    276       1.1  matt 
    277       1.1  matt 	if (device_is_a(dev, "argpio")) {
    278       1.1  matt 		if (info->config & BD_RSTFACTORY) {
    279       1.1  matt 			addprop_integer(dev, "reset-pin",
    280       1.1  matt 			    info->resetConfigGpio);
    281       1.1  matt 		}
    282       1.1  matt 		if (info->config & BD_SYSLED) {
    283       1.1  matt 			addprop_integer(dev, "sysled-pin",
    284       1.1  matt 			    info->sysLedGpio);
    285       1.1  matt 		}
    286       1.1  matt 	}
    287       1.1  matt #endif
    288       1.1  matt }
    289       1.1  matt 
    290       1.1  matt static int
    291       1.1  matt ar9344_enable_device(const struct atheros_device *adv)
    292       1.1  matt {
    293       1.2  matt 	if (adv->adv_reset) {
    294       1.2  matt 		/* put device into reset */
    295       1.2  matt 		PUTRESETREG(AR9344_RESET_RESETCTL,
    296       1.2  matt 		    GETRESETREG(AR9344_RESET_RESETCTL) | adv->adv_reset);
    297       1.2  matt 
    298       1.2  matt 		delay(15000);	/* XXX: tsleep? */
    299       1.2  matt 
    300       1.2  matt 		/* take it out of reset */
    301       1.2  matt 		PUTRESETREG(AR9344_RESET_RESETCTL,
    302       1.2  matt 		    GETRESETREG(AR9344_RESET_RESETCTL) & ~adv->adv_reset);
    303       1.2  matt 
    304       1.2  matt 		delay(25);
    305       1.1  matt 	}
    306       1.2  matt 	if (adv->adv_enable)
    307       1.2  matt 		panic("%s: %s: enable not supported!", __func__, adv->adv_name);
    308       1.2  matt 
    309       1.1  matt 	return 0;
    310       1.1  matt }
    311       1.1  matt 
    312       1.1  matt static void
    313       1.1  matt ar9344_intr_init(void)
    314       1.1  matt {
    315       1.1  matt 	atheros_intr_init();
    316       1.1  matt }
    317       1.1  matt 
    318       1.1  matt static const char * const ar9344_cpu_intrnames[] = {
    319       1.1  matt 	[AR9344_CPU_IRQ_PCIERC] =		"irq 0 (pcie rc)",
    320       1.1  matt 	[ARCHIP_CPU_IRQ_USB] =			"irq 1 (usb)",
    321       1.1  matt 	[ARCHIP_CPU_IRQ_GMAC0] =		"irq 2 (gmac0)",
    322       1.1  matt 	[ARCHIP_CPU_IRQ_GMAC1] =		"irq 3 (gmac1)",
    323       1.1  matt 	[ARCHIP_CPU_IRQ_MISC] =			"irq 4 (misc)",
    324       1.1  matt 	[ARCHIP_CPU_IRQ_TIMER] =		"irq 5 (timer)",
    325       1.1  matt #if 0
    326       1.1  matt 	[AR9344_CPU_IRQ_PCIEEP_HSTDMA] =	"irq 6 (pcieep)",
    327       1.1  matt #endif
    328       1.1  matt };
    329       1.1  matt 
    330       1.1  matt static const char * const ar9344_misc_intrnames[] = {
    331       1.1  matt 	[AR9344_MISC_IRQ_TIMER] =		"irq 0 (timer1)",
    332       1.1  matt 	[AR9344_MISC_IRQ_ERROR] =		"irq 1 (error)",
    333       1.1  matt 	[AR9344_MISC_IRQ_GPIO] =		"irq 2 (gpio)",
    334       1.1  matt 	[AR9344_MISC_IRQ_UART0] =		"irq 3 (uart0)",
    335       1.1  matt 	[AR9344_MISC_IRQ_WDOG] =		"irq 4 (wdog)",
    336       1.1  matt 	[AR9344_MISC_IRQ_PC] =	       		"irq 5 (pc)",
    337       1.1  matt 	[AR9344_MISC_IRQ_UART1] =		"irq 6 (uart1)",
    338       1.1  matt 	[AR9344_MISC_IRQ_MBOX] =		"irq 7 (mbox)",
    339       1.1  matt 	[AR9344_MISC_IRQ_TIMER2] =		"irq 8 (timer2)",
    340       1.1  matt 	[AR9344_MISC_IRQ_TIMER3] =		"irq 9 (timer3)",
    341       1.1  matt 	[AR9344_MISC_IRQ_TIMER4] =		"irq 10 (timer4)",
    342       1.1  matt 	[AR9344_MISC_IRQ_DDR_PERF] =		"irq 11 (ddr_perf)",
    343       1.1  matt 	[AR9344_MISC_IRQ_SW_MAC] =		"irq 12 (sw_mac)",
    344       1.1  matt 	[AR9344_MISC_IRQ_LUTS_AGER] =		"irq 13 (lut_ager)",
    345       1.1  matt 	[AR9344_MISC_IRQ_CHKSUM_ACC] =		"irq 15 (chksum_acc)",
    346       1.1  matt 	[AR9344_MISC_IRQ_DDR_SF_ENTRY] =	"irq 16 (ddr_sf_entry)",
    347       1.1  matt 	[AR9344_MISC_IRQ_DDR_SF_EXIT] =		"irq 17 (ddr_sf_exit)",
    348       1.1  matt 	[AR9344_MISC_IRQ_DDR_ACT_IN_SF] =	"irq 18 (ddr_act_in_sf)",
    349       1.1  matt 	[AR9344_MISC_IRQ_SLIC] =		"irq 19 (slic)",
    350       1.1  matt 	[AR9344_MISC_IRQ_WOW] =			"irq 20 (wow)",
    351       1.1  matt 	[AR9344_MISC_IRQ_NANDF] =		"irq 21 (nandf)",
    352       1.1  matt };
    353       1.1  matt 
    354       1.1  matt #if 0
    355       1.1  matt static const char * const ar9344_misc2_intrnames[] = {
    356       1.1  matt 	[AR9344_WMAC_IRQ_WMAC_MISC_INT] =	"irq 0 (wmac misc)",
    357       1.1  matt 	[AR9344_WMAC_IRQ_WMAC_TX_INT] =		"irq 1 (wmac tx)",
    358       1.1  matt 	[AR9344_WMAC_IRQ_WMAC_RXLP_INT] =	"irq 2 (wmac rxlp)",
    359       1.1  matt 	[AR9344_WMAC_IRQ_WMAC_RXHP_INT] =	"irq 3 (wmac rxhp)",
    360       1.1  matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT] =		"irq 4 (pcie rc int)",
    361       1.1  matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT0] =	"irq 5 (pcie rc int 0)",
    362       1.1  matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT1] =	"irq 6 (pcie rc int 1)",
    363       1.1  matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT2] =	"irq 7 (pcie rc int 2)",
    364       1.1  matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT3] =	"irq 8 (pcie rc int 3)",
    365       1.1  matt };
    366       1.1  matt #endif
    367       1.1  matt 
    368       1.1  matt static const struct ipl_sr_map ar9344_ipl_sr_map = {
    369       1.1  matt     .sr_bits = {
    370       1.1  matt 	[IPL_NONE] =		0,
    371       1.1  matt 	[IPL_SOFTCLOCK] = 	MIPS_SOFT_INT_MASK_0,
    372       1.1  matt 	[IPL_SOFTBIO] = 	MIPS_SOFT_INT_MASK_0,
    373       1.1  matt 	[IPL_SOFTNET] = 	MIPS_SOFT_INT_MASK_0,
    374       1.1  matt 	[IPL_SOFTSERIAL] = 	MIPS_SOFT_INT_MASK_0,
    375       1.1  matt 	[IPL_VM] =		MIPS_SOFT_INT_MASK |
    376       1.1  matt 				MIPS_INT_MASK_0 |	/* PCIE RC */
    377       1.1  matt 				MIPS_INT_MASK_1	|	/* USB */
    378       1.1  matt 				MIPS_INT_MASK_2 |	/* GMAC0 */
    379       1.1  matt 				MIPS_INT_MASK_3 |	/* GMAC1 */
    380       1.1  matt 				MIPS_INT_MASK_4,	/* MISC */
    381       1.1  matt 	[IPL_SCHED] =		MIPS_INT_MASK,		/* EVERYTHING */
    382       1.1  matt 	[IPL_DDB] =		MIPS_INT_MASK,		/* EVERYTHING */
    383       1.1  matt 	[IPL_HIGH] =		MIPS_INT_MASK,		/* EVERYTHING */
    384       1.1  matt      },
    385       1.1  matt };
    386       1.1  matt 
    387       1.1  matt static const struct atheros_device ar9344_devices[] = {
    388       1.1  matt 	{
    389       1.1  matt 		.adv_name = "com",
    390       1.1  matt 		.adv_addr = AR9344_UART0_BASE,
    391       1.1  matt 		.adv_size = 0x1000,
    392       1.1  matt 		.adv_cirq = ARCHIP_CPU_IRQ_MISC,
    393       1.1  matt 		.adv_mirq = AR9344_MISC_IRQ_UART0,
    394       1.1  matt 	}, {
    395       1.1  matt 		.adv_name = "ehci",
    396       1.2  matt 		.adv_addr = AR9344_USB_BASE + 0x100,
    397       1.1  matt 		.adv_size = 0x1000,
    398       1.1  matt 		.adv_cirq = ARCHIP_CPU_IRQ_USB,
    399       1.1  matt 		.adv_mirq = -1,
    400       1.2  matt 		.adv_reset = AR9344_RESETCTL_USB_PHY_SUSPEND_OVERRIDE
    401       1.2  matt 		    | ARCHIP_RESETCTL_USB_PHY_RESET
    402       1.2  matt 		    | ARCHIP_RESETCTL_USB_HOST_RESET,
    403       1.1  matt 	}, {
    404       1.1  matt 		.adv_name = "age",
    405       1.1  matt 		.adv_addr = AR9344_GMAC0_BASE,
    406       1.1  matt 		.adv_size = 0x1000,
    407       1.1  matt 		.adv_cirq = ARCHIP_CPU_IRQ_GMAC0,
    408       1.1  matt 		.adv_mirq = -1,
    409       1.1  matt 	}, {
    410       1.1  matt 		.adv_name = "age",
    411       1.1  matt 		.adv_addr = AR9344_GMAC1_BASE,
    412       1.1  matt 		.adv_size = 0x1000,
    413       1.1  matt 		.adv_cirq = ARCHIP_CPU_IRQ_GMAC1,
    414       1.1  matt 		.adv_mirq = -1,
    415       1.1  matt 	}, {
    416       1.3  matt 		.adv_name = "arpcie",
    417       1.1  matt 		.adv_addr = AR9344_PCIE_RC_BASE,
    418       1.1  matt 		.adv_size = 0x1000,
    419       1.1  matt 		.adv_cirq = AR9344_CPU_IRQ_PCIERC,
    420       1.1  matt 		.adv_mirq = -1,
    421       1.1  matt 	},
    422       1.1  matt #if 0
    423       1.1  matt 	{
    424       1.1  matt 		.adv_name = "ath",
    425       1.1  matt 		.adv_addr = AR9344_WLAN_BASE,
    426       1.1  matt 		.adv_size = 0x100000,
    427       1.1  matt 		.adv_cirq = AR9344_CPU_IRQ_WLAN,
    428       1.1  matt 		.adv_mirq = -1,
    429       1.1  matt 	}, {
    430       1.1  matt 		.adv_name = "arspi",
    431       1.1  matt 		.adv_addr = AR9344_SPI_BASE,
    432       1.1  matt 		.adv_size = 0x20,
    433       1.1  matt 		.adv_cirq = AR9344_CPU_IRQ_MISC,
    434       1.1  matt 		.adv_mirq = AR9344_MISC_IRQ_SPI,
    435       1.1  matt 	},
    436       1.1  matt #endif
    437       1.1  matt 	{
    438       1.1  matt 		.adv_name = NULL
    439       1.1  matt 	}
    440       1.1  matt };
    441       1.1  matt 
    442       1.1  matt const struct atheros_platformsw ar9344_platformsw = {
    443       1.1  matt 	.apsw_intrsw = &atheros_intrsw,
    444       1.1  matt 	.apsw_intr_init = ar9344_intr_init,
    445       1.1  matt 	.apsw_cpu_intrnames = ar9344_cpu_intrnames,
    446       1.1  matt 	.apsw_misc_intrnames = ar9344_misc_intrnames,
    447       1.1  matt 	.apsw_cpu_nintrs = __arraycount(ar9344_cpu_intrnames),
    448       1.1  matt 	.apsw_misc_nintrs = __arraycount(ar9344_misc_intrnames),
    449       1.1  matt 	.apsw_cpuirq_misc = ARCHIP_CPU_IRQ_MISC,
    450       1.1  matt 	.apsw_ipl_sr_map = &ar9344_ipl_sr_map,
    451       1.1  matt 
    452       1.1  matt 	.apsw_revision_id_addr = ARCHIP_RESET_BASE + ARCHIP_RESET_REVISION,
    453       1.1  matt 	.apsw_uart0_base = AR9344_UART0_BASE,
    454       1.1  matt 	.apsw_misc_intstat = ARCHIP_RESET_BASE + ARCHIP_RESET_MISC_INTSTAT,
    455       1.1  matt 	.apsw_misc_intmask = ARCHIP_RESET_BASE + ARCHIP_RESET_MISC_INTMASK,
    456       1.1  matt 
    457       1.1  matt 	/*
    458       1.1  matt 	 * CPU specific routines.
    459       1.1  matt 	 */
    460       1.1  matt 	.apsw_get_memsize = ar9344_get_memsize,
    461       1.1  matt 	.apsw_wdog_reload = ar9344_wdog_reload,
    462       1.1  matt 	.apsw_bus_init = ar9344_bus_init,
    463       1.1  matt 	.apsw_reset = ar9344_reset,
    464       1.1  matt 
    465       1.1  matt 	.apsw_get_freqs = ar9344_get_freqs,
    466       1.1  matt 	.apsw_device_register = ar9344_device_register,
    467       1.1  matt 	.apsw_enable_device = ar9344_enable_device,
    468       1.1  matt 	.apsw_devices = ar9344_devices,
    469       1.1  matt };
    470