Home | History | Annotate | Line # | Download | only in atheros
      1  1.5  skrll /* $NetBSD: ar9344.c,v 1.5 2014/05/29 14:41:26 skrll 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.5  skrll __KERNEL_RCSID(0, "$NetBSD: ar9344.c,v 1.5 2014/05/29 14:41:26 skrll 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.5  skrll 	uint32_t out_div, ref_div, nint, post_div;
    124  1.1   matt 	uint32_t pll;
    125  1.1   matt 	uint32_t ref_clk;
    126  1.5  skrll 	//uint32_t nfrac;
    127  1.1   matt 
    128  1.1   matt 	if (GETRESETREG(AR9344_RESET_BOOTSTRAP) & AR9344_BOOTSTRAP_REF_CLK_40) {
    129  1.1   matt 		ref_clk = 40 * 1000000;
    130  1.1   matt 	} else {
    131  1.1   matt 		ref_clk = 25 * 1000000;
    132  1.1   matt 	}
    133  1.1   matt 
    134  1.1   matt 	freqs->freq_ref = ref_clk;
    135  1.1   matt 
    136  1.1   matt 	/*
    137  1.1   matt 	 * Let's figure out the CPU PLL frequency.
    138  1.1   matt 	 */
    139  1.1   matt 	pll = GETPLLREG(ARCHIP_PLL_CPU_PLL_CONFIG);
    140  1.1   matt 	out_div = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_OUTDIV);
    141  1.1   matt 	ref_div = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_REFDIV);
    142  1.1   matt 	nint = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_NINT);
    143  1.5  skrll 	//nfrac = __SHIFTOUT(pll, AR9344_CPU_PLL_CONFIG_NFRAC);
    144  1.1   matt 
    145  1.1   matt 	const uint32_t cpu_pll_freq = (nint * ref_clk / ref_div) >> out_div;
    146  1.1   matt 
    147  1.1   matt 	/*
    148  1.1   matt 	 * Now figure out the DDR PLL frequency.
    149  1.1   matt 	 */
    150  1.1   matt 	pll = GETPLLREG(ARCHIP_PLL_DDR_PLL_CONFIG);
    151  1.1   matt 	out_div = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_OUTDIV);
    152  1.1   matt 	ref_div = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_REFDIV);
    153  1.1   matt 	nint = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_NINT);
    154  1.5  skrll 	//nfrac = __SHIFTOUT(pll, AR9344_DDR_PLL_CONFIG_NFRAC);
    155  1.1   matt 
    156  1.1   matt 	const uint32_t ddr_pll_freq = (nint * ref_clk / ref_div) >> out_div;
    157  1.1   matt 
    158  1.1   matt 	/*
    159  1.1   matt 	 * Now we find out the various frequencies...
    160  1.1   matt 	 */
    161  1.1   matt 	uint32_t clk_ctl = GETPLLREG(ARCHIP_PLL_CPU_DDR_CLOCK_CONTROL);
    162  1.1   matt 	post_div = __SHIFTOUT(clk_ctl,
    163  1.1   matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV);
    164  1.1   matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL) {
    165  1.1   matt 		freqs->freq_bus = ddr_pll_freq / (post_div + 1);
    166  1.1   matt 	} else {
    167  1.1   matt 		freqs->freq_bus = cpu_pll_freq / (post_div + 1);
    168  1.1   matt 	}
    169  1.1   matt 
    170  1.1   matt 	post_div = __SHIFTOUT(clk_ctl,
    171  1.1   matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV);
    172  1.1   matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_CPUCLK_FROM_CPUPLL) {
    173  1.1   matt 		freqs->freq_cpu = cpu_pll_freq / (post_div + 1);
    174  1.1   matt 		freqs->freq_pll = cpu_pll_freq;
    175  1.1   matt 	} else {
    176  1.1   matt 		freqs->freq_cpu = ddr_pll_freq / (post_div + 1);
    177  1.1   matt 		freqs->freq_pll = ddr_pll_freq;
    178  1.1   matt 	}
    179  1.1   matt 
    180  1.1   matt 	post_div = __SHIFTOUT(clk_ctl,
    181  1.1   matt 	    AR9344_CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV);
    182  1.1   matt 	if (clk_ctl & AR9344_CPU_DDR_CLOCK_CONTROL_DDRCLK_FROM_DDRPLL) {
    183  1.1   matt 		freqs->freq_mem = ddr_pll_freq / (post_div + 1);
    184  1.1   matt 	} else {
    185  1.1   matt 		freqs->freq_mem = cpu_pll_freq / (post_div + 1);
    186  1.1   matt 	}
    187  1.2   matt 
    188  1.2   matt 	/*
    189  1.2   matt 	 * Console is off the reference clock, not the bus clock.
    190  1.2   matt 	 */
    191  1.2   matt 	freqs->freq_uart = freqs->freq_ref;
    192  1.1   matt }
    193  1.1   matt 
    194  1.1   matt #if 0
    195  1.1   matt static void
    196  1.4    chs addprop_data(device_t dev, const char *name, const uint8_t *data,
    197  1.1   matt     int len)
    198  1.1   matt {
    199  1.1   matt 	prop_data_t	pd;
    200  1.1   matt 	pd = prop_data_create_data(data, len);
    201  1.1   matt 	KASSERT(pd != NULL);
    202  1.1   matt 	if (prop_dictionary_set(device_properties(dev), name, pd) == FALSE) {
    203  1.1   matt 		printf("WARNING: unable to set %s property for %s\n",
    204  1.1   matt 		    name, device_xname(dev));
    205  1.1   matt 	}
    206  1.1   matt 	prop_object_release(pd);
    207  1.1   matt }
    208  1.1   matt #endif
    209  1.1   matt 
    210  1.1   matt static void
    211  1.4    chs addprop_integer(device_t dev, const char *name, uint32_t val)
    212  1.1   matt {
    213  1.1   matt 	prop_number_t	pn;
    214  1.1   matt 	pn = prop_number_create_integer(val);
    215  1.1   matt 	KASSERT(pn != NULL);
    216  1.1   matt 	if (prop_dictionary_set(device_properties(dev), name, pn) == FALSE) {
    217  1.1   matt 		printf("WARNING: unable to set %s property for %s",
    218  1.1   matt 		    name, device_xname(dev));
    219  1.1   matt 	}
    220  1.1   matt 	prop_object_release(pn);
    221  1.1   matt }
    222  1.1   matt 
    223  1.1   matt static void
    224  1.1   matt ar9344_device_register(device_t dev, void *aux)
    225  1.1   matt {
    226  1.1   matt 
    227  1.1   matt 	if (device_is_a(dev, "com")
    228  1.1   matt 	    && device_is_a(device_parent(dev), "arbus")) {
    229  1.1   matt 		addprop_integer(dev, "frequency", atheros_get_bus_freq());
    230  1.1   matt 		return;
    231  1.1   matt 	}
    232  1.1   matt 
    233  1.1   matt #if 0
    234  1.1   matt 	const struct arbus_attach_args * const aa = aux;
    235  1.1   matt 	const struct ar9344_boarddata *info;
    236  1.1   matt 	info = ar9344_board_info();
    237  1.1   matt 	if (info == NULL) {
    238  1.1   matt 		/* nothing known about this board! */
    239  1.1   matt 		return;
    240  1.1   matt 	}
    241  1.1   matt 
    242  1.1   matt 	/*
    243  1.1   matt 	 * We don't ever know the boot device.  But that's because the
    244  1.1   matt 	 * firmware only loads from the network.
    245  1.1   matt 	 */
    246  1.1   matt 
    247  1.1   matt 	/* Fetch the MAC addresses. */
    248  1.1   matt 	if (device_is_a(dev, "ae")) {
    249  1.1   matt 		uint8_t enaddr[ETHER_ADDR_LEN];
    250  1.1   matt 
    251  1.1   matt 		memcpy(enaddr, info->enet0Mac, ETHER_ADDR_LEN);
    252  1.1   matt 		if (aa->aa_addr == AR9344_GMAC0_BASE) {
    253  1.1   matt 			;
    254  1.1   matt 		} else if (aa->aa_addr == AR9344_GMAC1_BASE) {
    255  1.1   matt 			enaddr[5] ^= 1;
    256  1.1   matt 		} else
    257  1.1   matt 			return;
    258  1.1   matt 
    259  1.1   matt 		addprop_data(dev, "mac-addr", enaddr, ETHER_ADDR_LEN);
    260  1.1   matt 	}
    261  1.1   matt 
    262  1.1   matt #if 0
    263  1.1   matt 	if (device_is_a(dev, "ath")) {
    264  1.1   matt 		const uint8_t *enet;
    265  1.1   matt 
    266  1.1   matt 		if (aa->aa_addr == AR9344_WLAN_BASE)
    267  1.1   matt 			enet = info->wlan0Mac;
    268  1.1   matt 		else
    269  1.1   matt 			return;
    270  1.1   matt 
    271  1.1   matt 		addprop_data(dev, "mac-addr", enet, ETHER_ADDR_LEN);
    272  1.1   matt 
    273  1.1   matt 		addprop_integer(dev, "wmac-rev",
    274  1.1   matt 		    GETRESET(AR9344_RESET_SREV));
    275  1.1   matt 	}
    276  1.1   matt #endif
    277  1.1   matt 
    278  1.1   matt 	if (device_is_a(dev, "argpio")) {
    279  1.1   matt 		if (info->config & BD_RSTFACTORY) {
    280  1.1   matt 			addprop_integer(dev, "reset-pin",
    281  1.1   matt 			    info->resetConfigGpio);
    282  1.1   matt 		}
    283  1.1   matt 		if (info->config & BD_SYSLED) {
    284  1.1   matt 			addprop_integer(dev, "sysled-pin",
    285  1.1   matt 			    info->sysLedGpio);
    286  1.1   matt 		}
    287  1.1   matt 	}
    288  1.1   matt #endif
    289  1.1   matt }
    290  1.1   matt 
    291  1.1   matt static int
    292  1.1   matt ar9344_enable_device(const struct atheros_device *adv)
    293  1.1   matt {
    294  1.2   matt 	if (adv->adv_reset) {
    295  1.2   matt 		/* put device into reset */
    296  1.2   matt 		PUTRESETREG(AR9344_RESET_RESETCTL,
    297  1.2   matt 		    GETRESETREG(AR9344_RESET_RESETCTL) | adv->adv_reset);
    298  1.2   matt 
    299  1.2   matt 		delay(15000);	/* XXX: tsleep? */
    300  1.2   matt 
    301  1.2   matt 		/* take it out of reset */
    302  1.2   matt 		PUTRESETREG(AR9344_RESET_RESETCTL,
    303  1.2   matt 		    GETRESETREG(AR9344_RESET_RESETCTL) & ~adv->adv_reset);
    304  1.2   matt 
    305  1.2   matt 		delay(25);
    306  1.1   matt 	}
    307  1.2   matt 	if (adv->adv_enable)
    308  1.2   matt 		panic("%s: %s: enable not supported!", __func__, adv->adv_name);
    309  1.2   matt 
    310  1.1   matt 	return 0;
    311  1.1   matt }
    312  1.1   matt 
    313  1.1   matt static void
    314  1.1   matt ar9344_intr_init(void)
    315  1.1   matt {
    316  1.1   matt 	atheros_intr_init();
    317  1.1   matt }
    318  1.1   matt 
    319  1.1   matt static const char * const ar9344_cpu_intrnames[] = {
    320  1.1   matt 	[AR9344_CPU_IRQ_PCIERC] =		"irq 0 (pcie rc)",
    321  1.1   matt 	[ARCHIP_CPU_IRQ_USB] =			"irq 1 (usb)",
    322  1.1   matt 	[ARCHIP_CPU_IRQ_GMAC0] =		"irq 2 (gmac0)",
    323  1.1   matt 	[ARCHIP_CPU_IRQ_GMAC1] =		"irq 3 (gmac1)",
    324  1.1   matt 	[ARCHIP_CPU_IRQ_MISC] =			"irq 4 (misc)",
    325  1.1   matt 	[ARCHIP_CPU_IRQ_TIMER] =		"irq 5 (timer)",
    326  1.1   matt #if 0
    327  1.1   matt 	[AR9344_CPU_IRQ_PCIEEP_HSTDMA] =	"irq 6 (pcieep)",
    328  1.1   matt #endif
    329  1.1   matt };
    330  1.1   matt 
    331  1.1   matt static const char * const ar9344_misc_intrnames[] = {
    332  1.1   matt 	[AR9344_MISC_IRQ_TIMER] =		"irq 0 (timer1)",
    333  1.1   matt 	[AR9344_MISC_IRQ_ERROR] =		"irq 1 (error)",
    334  1.1   matt 	[AR9344_MISC_IRQ_GPIO] =		"irq 2 (gpio)",
    335  1.1   matt 	[AR9344_MISC_IRQ_UART0] =		"irq 3 (uart0)",
    336  1.1   matt 	[AR9344_MISC_IRQ_WDOG] =		"irq 4 (wdog)",
    337  1.1   matt 	[AR9344_MISC_IRQ_PC] =	       		"irq 5 (pc)",
    338  1.1   matt 	[AR9344_MISC_IRQ_UART1] =		"irq 6 (uart1)",
    339  1.1   matt 	[AR9344_MISC_IRQ_MBOX] =		"irq 7 (mbox)",
    340  1.1   matt 	[AR9344_MISC_IRQ_TIMER2] =		"irq 8 (timer2)",
    341  1.1   matt 	[AR9344_MISC_IRQ_TIMER3] =		"irq 9 (timer3)",
    342  1.1   matt 	[AR9344_MISC_IRQ_TIMER4] =		"irq 10 (timer4)",
    343  1.1   matt 	[AR9344_MISC_IRQ_DDR_PERF] =		"irq 11 (ddr_perf)",
    344  1.1   matt 	[AR9344_MISC_IRQ_SW_MAC] =		"irq 12 (sw_mac)",
    345  1.1   matt 	[AR9344_MISC_IRQ_LUTS_AGER] =		"irq 13 (lut_ager)",
    346  1.1   matt 	[AR9344_MISC_IRQ_CHKSUM_ACC] =		"irq 15 (chksum_acc)",
    347  1.1   matt 	[AR9344_MISC_IRQ_DDR_SF_ENTRY] =	"irq 16 (ddr_sf_entry)",
    348  1.1   matt 	[AR9344_MISC_IRQ_DDR_SF_EXIT] =		"irq 17 (ddr_sf_exit)",
    349  1.1   matt 	[AR9344_MISC_IRQ_DDR_ACT_IN_SF] =	"irq 18 (ddr_act_in_sf)",
    350  1.1   matt 	[AR9344_MISC_IRQ_SLIC] =		"irq 19 (slic)",
    351  1.1   matt 	[AR9344_MISC_IRQ_WOW] =			"irq 20 (wow)",
    352  1.1   matt 	[AR9344_MISC_IRQ_NANDF] =		"irq 21 (nandf)",
    353  1.1   matt };
    354  1.1   matt 
    355  1.1   matt #if 0
    356  1.1   matt static const char * const ar9344_misc2_intrnames[] = {
    357  1.1   matt 	[AR9344_WMAC_IRQ_WMAC_MISC_INT] =	"irq 0 (wmac misc)",
    358  1.1   matt 	[AR9344_WMAC_IRQ_WMAC_TX_INT] =		"irq 1 (wmac tx)",
    359  1.1   matt 	[AR9344_WMAC_IRQ_WMAC_RXLP_INT] =	"irq 2 (wmac rxlp)",
    360  1.1   matt 	[AR9344_WMAC_IRQ_WMAC_RXHP_INT] =	"irq 3 (wmac rxhp)",
    361  1.1   matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT] =		"irq 4 (pcie rc int)",
    362  1.1   matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT0] =	"irq 5 (pcie rc int 0)",
    363  1.1   matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT1] =	"irq 6 (pcie rc int 1)",
    364  1.1   matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT2] =	"irq 7 (pcie rc int 2)",
    365  1.1   matt 	[AR9344_WMAC_IRQ_PCIE_RC_INT3] =	"irq 8 (pcie rc int 3)",
    366  1.1   matt };
    367  1.1   matt #endif
    368  1.1   matt 
    369  1.1   matt static const struct ipl_sr_map ar9344_ipl_sr_map = {
    370  1.1   matt     .sr_bits = {
    371  1.1   matt 	[IPL_NONE] =		0,
    372  1.1   matt 	[IPL_SOFTCLOCK] = 	MIPS_SOFT_INT_MASK_0,
    373  1.1   matt 	[IPL_SOFTBIO] = 	MIPS_SOFT_INT_MASK_0,
    374  1.1   matt 	[IPL_SOFTNET] = 	MIPS_SOFT_INT_MASK_0,
    375  1.1   matt 	[IPL_SOFTSERIAL] = 	MIPS_SOFT_INT_MASK_0,
    376  1.1   matt 	[IPL_VM] =		MIPS_SOFT_INT_MASK |
    377  1.1   matt 				MIPS_INT_MASK_0 |	/* PCIE RC */
    378  1.1   matt 				MIPS_INT_MASK_1	|	/* USB */
    379  1.1   matt 				MIPS_INT_MASK_2 |	/* GMAC0 */
    380  1.1   matt 				MIPS_INT_MASK_3 |	/* GMAC1 */
    381  1.1   matt 				MIPS_INT_MASK_4,	/* MISC */
    382  1.1   matt 	[IPL_SCHED] =		MIPS_INT_MASK,		/* EVERYTHING */
    383  1.1   matt 	[IPL_DDB] =		MIPS_INT_MASK,		/* EVERYTHING */
    384  1.1   matt 	[IPL_HIGH] =		MIPS_INT_MASK,		/* EVERYTHING */
    385  1.1   matt      },
    386  1.1   matt };
    387  1.1   matt 
    388  1.1   matt static const struct atheros_device ar9344_devices[] = {
    389  1.1   matt 	{
    390  1.1   matt 		.adv_name = "com",
    391  1.1   matt 		.adv_addr = AR9344_UART0_BASE,
    392  1.1   matt 		.adv_size = 0x1000,
    393  1.1   matt 		.adv_cirq = ARCHIP_CPU_IRQ_MISC,
    394  1.1   matt 		.adv_mirq = AR9344_MISC_IRQ_UART0,
    395  1.1   matt 	}, {
    396  1.1   matt 		.adv_name = "ehci",
    397  1.2   matt 		.adv_addr = AR9344_USB_BASE + 0x100,
    398  1.1   matt 		.adv_size = 0x1000,
    399  1.1   matt 		.adv_cirq = ARCHIP_CPU_IRQ_USB,
    400  1.1   matt 		.adv_mirq = -1,
    401  1.2   matt 		.adv_reset = AR9344_RESETCTL_USB_PHY_SUSPEND_OVERRIDE
    402  1.2   matt 		    | ARCHIP_RESETCTL_USB_PHY_RESET
    403  1.2   matt 		    | ARCHIP_RESETCTL_USB_HOST_RESET,
    404  1.1   matt 	}, {
    405  1.1   matt 		.adv_name = "age",
    406  1.1   matt 		.adv_addr = AR9344_GMAC0_BASE,
    407  1.1   matt 		.adv_size = 0x1000,
    408  1.1   matt 		.adv_cirq = ARCHIP_CPU_IRQ_GMAC0,
    409  1.1   matt 		.adv_mirq = -1,
    410  1.1   matt 	}, {
    411  1.1   matt 		.adv_name = "age",
    412  1.1   matt 		.adv_addr = AR9344_GMAC1_BASE,
    413  1.1   matt 		.adv_size = 0x1000,
    414  1.1   matt 		.adv_cirq = ARCHIP_CPU_IRQ_GMAC1,
    415  1.1   matt 		.adv_mirq = -1,
    416  1.1   matt 	}, {
    417  1.3   matt 		.adv_name = "arpcie",
    418  1.1   matt 		.adv_addr = AR9344_PCIE_RC_BASE,
    419  1.1   matt 		.adv_size = 0x1000,
    420  1.1   matt 		.adv_cirq = AR9344_CPU_IRQ_PCIERC,
    421  1.1   matt 		.adv_mirq = -1,
    422  1.1   matt 	},
    423  1.1   matt #if 0
    424  1.1   matt 	{
    425  1.1   matt 		.adv_name = "ath",
    426  1.1   matt 		.adv_addr = AR9344_WLAN_BASE,
    427  1.1   matt 		.adv_size = 0x100000,
    428  1.1   matt 		.adv_cirq = AR9344_CPU_IRQ_WLAN,
    429  1.1   matt 		.adv_mirq = -1,
    430  1.1   matt 	}, {
    431  1.1   matt 		.adv_name = "arspi",
    432  1.1   matt 		.adv_addr = AR9344_SPI_BASE,
    433  1.1   matt 		.adv_size = 0x20,
    434  1.1   matt 		.adv_cirq = AR9344_CPU_IRQ_MISC,
    435  1.1   matt 		.adv_mirq = AR9344_MISC_IRQ_SPI,
    436  1.1   matt 	},
    437  1.1   matt #endif
    438  1.1   matt 	{
    439  1.1   matt 		.adv_name = NULL
    440  1.1   matt 	}
    441  1.1   matt };
    442  1.1   matt 
    443  1.1   matt const struct atheros_platformsw ar9344_platformsw = {
    444  1.1   matt 	.apsw_intrsw = &atheros_intrsw,
    445  1.1   matt 	.apsw_intr_init = ar9344_intr_init,
    446  1.1   matt 	.apsw_cpu_intrnames = ar9344_cpu_intrnames,
    447  1.1   matt 	.apsw_misc_intrnames = ar9344_misc_intrnames,
    448  1.1   matt 	.apsw_cpu_nintrs = __arraycount(ar9344_cpu_intrnames),
    449  1.1   matt 	.apsw_misc_nintrs = __arraycount(ar9344_misc_intrnames),
    450  1.1   matt 	.apsw_cpuirq_misc = ARCHIP_CPU_IRQ_MISC,
    451  1.1   matt 	.apsw_ipl_sr_map = &ar9344_ipl_sr_map,
    452  1.1   matt 
    453  1.1   matt 	.apsw_revision_id_addr = ARCHIP_RESET_BASE + ARCHIP_RESET_REVISION,
    454  1.1   matt 	.apsw_uart0_base = AR9344_UART0_BASE,
    455  1.1   matt 	.apsw_misc_intstat = ARCHIP_RESET_BASE + ARCHIP_RESET_MISC_INTSTAT,
    456  1.1   matt 	.apsw_misc_intmask = ARCHIP_RESET_BASE + ARCHIP_RESET_MISC_INTMASK,
    457  1.1   matt 
    458  1.1   matt 	/*
    459  1.1   matt 	 * CPU specific routines.
    460  1.1   matt 	 */
    461  1.1   matt 	.apsw_get_memsize = ar9344_get_memsize,
    462  1.1   matt 	.apsw_wdog_reload = ar9344_wdog_reload,
    463  1.1   matt 	.apsw_bus_init = ar9344_bus_init,
    464  1.1   matt 	.apsw_reset = ar9344_reset,
    465  1.1   matt 
    466  1.1   matt 	.apsw_get_freqs = ar9344_get_freqs,
    467  1.1   matt 	.apsw_device_register = ar9344_device_register,
    468  1.1   matt 	.apsw_enable_device = ar9344_enable_device,
    469  1.1   matt 	.apsw_devices = ar9344_devices,
    470  1.1   matt };
    471