1 1.5 matt /* $Id: arbusvar.h,v 1.5 2015/06/09 22:50:50 matt Exp $ */ 2 1.1 gdamore /* 3 1.1 gdamore * Copyright (c) 2006 Urbana-Champaign Independent Media Center. 4 1.1 gdamore * Copyright (c) 2006 Garrett D'Amore. 5 1.1 gdamore * All rights reserved. 6 1.1 gdamore * 7 1.1 gdamore * This code was written by Garrett D'Amore for the Champaign-Urbana 8 1.1 gdamore * Community Wireless Network Project. 9 1.1 gdamore * 10 1.1 gdamore * Redistribution and use in source and binary forms, with or 11 1.1 gdamore * without modification, are permitted provided that the following 12 1.1 gdamore * conditions are met: 13 1.1 gdamore * 1. Redistributions of source code must retain the above copyright 14 1.1 gdamore * notice, this list of conditions and the following disclaimer. 15 1.1 gdamore * 2. Redistributions in binary form must reproduce the above 16 1.1 gdamore * copyright notice, this list of conditions and the following 17 1.1 gdamore * disclaimer in the documentation and/or other materials provided 18 1.1 gdamore * with the distribution. 19 1.1 gdamore * 3. All advertising materials mentioning features or use of this 20 1.1 gdamore * software must display the following acknowledgements: 21 1.1 gdamore * This product includes software developed by the Urbana-Champaign 22 1.1 gdamore * Independent Media Center. 23 1.1 gdamore * This product includes software developed by Garrett D'Amore. 24 1.1 gdamore * 4. Urbana-Champaign Independent Media Center's name and Garrett 25 1.1 gdamore * D'Amore's name may not be used to endorse or promote products 26 1.1 gdamore * derived from this software without specific prior written permission. 27 1.1 gdamore * 28 1.1 gdamore * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT 29 1.1 gdamore * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR 30 1.1 gdamore * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 31 1.1 gdamore * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 1.1 gdamore * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT 33 1.1 gdamore * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT, 34 1.1 gdamore * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35 1.1 gdamore * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 1.1 gdamore * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 1.1 gdamore * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 38 1.1 gdamore * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 39 1.1 gdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 40 1.1 gdamore * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 1.1 gdamore */ 42 1.1 gdamore 43 1.1 gdamore #ifndef _MIPS_ATHEROS_ARBUSVAR_H_ 44 1.1 gdamore #define _MIPS_ATHEROS_ARBUSVAR_H_ 45 1.1 gdamore 46 1.3 dyoung #include <sys/bus.h> 47 1.5 matt #include <sys/cpu.h> 48 1.5 matt 49 1.5 matt #include <mips/cpuregs.h> 50 1.1 gdamore 51 1.1 gdamore struct arbus_attach_args { 52 1.1 gdamore const char *aa_name; 53 1.1 gdamore bus_space_tag_t aa_bst; 54 1.4 matt bus_space_tag_t aa_bst_le; 55 1.1 gdamore bus_dma_tag_t aa_dmat; 56 1.1 gdamore 57 1.1 gdamore bus_addr_t aa_addr; 58 1.1 gdamore bus_size_t aa_size; 59 1.2 gdamore int aa_cirq; /* cpu irq */ 60 1.2 gdamore int aa_mirq; /* misc irq */ 61 1.1 gdamore }; 62 1.1 gdamore 63 1.1 gdamore void arbus_init(void); 64 1.4 matt void arbusle_bus_mem_init(bus_space_tag_t, void *); 65 1.1 gdamore bus_space_tag_t arbus_get_bus_space_tag(void); 66 1.1 gdamore bus_dma_tag_t arbus_get_bus_dma_tag(void); 67 1.1 gdamore 68 1.2 gdamore void *arbus_intr_establish(int, int, int (*)(void *), void *); 69 1.1 gdamore void arbus_intr_disestablish(void *); 70 1.1 gdamore 71 1.2 gdamore void com_arbus_cnattach(bus_addr_t, uint32_t); 72 1.1 gdamore 73 1.1 gdamore /* 74 1.1 gdamore * These definitions are "funny". To distinquish between 75 1.1 gdamore * miscellaneous IRQs and global processor interrupts, we encode the 76 1.1 gdamore * IRQ as (cpuirq) | ((miscirq) << 4). 77 1.1 gdamore * 78 1.1 gdamore * Note that these IRQs seem to be general on all AR531X based parts. 79 1.1 gdamore */ 80 1.1 gdamore 81 1.1 gdamore #define ARBUS_IRQ_CPU_M 0xf 82 1.1 gdamore #define ARBUS_IRQ_CPU_S 0 83 1.1 gdamore #define ARBUS_IRQ_MISC_M 0xf0 84 1.1 gdamore #define ARBUS_IRQ_MISC_S 4 85 1.1 gdamore #define ARBUS_IRQ_CPU(x) (((x) & ARBUS_IRQ_CPU_M) >> ARBUS_IRQ_CPU_S) 86 1.1 gdamore #define ARBUS_IRQ_MISC(x) (((x) & ARBUS_IRQ_MISC_M) >> ARBUS_IRQ_MISC_S) 87 1.1 gdamore #define ARBUS_MAKE_IRQ(c,m) \ 88 1.1 gdamore (((c) << ARBUS_IRQ_CPU_S) | ((m) << ARBUS_IRQ_MISC_S)) 89 1.1 gdamore 90 1.1 gdamore #define ARBUS_IRQ_WLAN0 ARBUS_MAKE_IRQ(0,0) 91 1.1 gdamore #define ARBUS_IRQ_ENET0 ARBUS_MAKE_IRQ(1,0) 92 1.1 gdamore #define ARBUS_IRQ_ENET1 ARBUS_MAKE_IRQ(2,0) 93 1.1 gdamore #define ARBUS_IRQ_WLAN1 ARBUS_MAKE_IRQ(3,0) 94 1.1 gdamore #define ARBUS_IRQ_TIMER ARBUS_MAKE_IRQ(4,0) 95 1.1 gdamore #define ARBUS_IRQ_AHBPERR ARBUS_MAKE_IRQ(4,1) 96 1.1 gdamore #define ARBUS_IRQ_AHBDMAE ARBUS_MAKE_IRQ(4,2) 97 1.1 gdamore #define ARBUS_IRQ_GPIO ARBUS_MAKE_IRQ(4,3) 98 1.1 gdamore #define ARBUS_IRQ_UART0 ARBUS_MAKE_IRQ(4,4) 99 1.1 gdamore #define ARBUS_IRQ_UART0_DMA ARBUS_MAKE_IRQ(4,5) 100 1.1 gdamore #define ARBUS_IRQ_WDOG ARBUS_MAKE_IRQ(4,6) 101 1.1 gdamore 102 1.1 gdamore #endif /* _MIPS_ATHEROS_ARBUSVAR_H_ */ 103