1*c62a0ac4Smatt /* $NetBSD: at91spivar.h,v 1.2 2008/07/03 01:15:38 matt Exp $ */ 2*c62a0ac4Smatt 3*c62a0ac4Smatt /*- 4*c62a0ac4Smatt * Copyright (c) 2007 Embedtronics Oy. 5*c62a0ac4Smatt * All rights reserved. 6*c62a0ac4Smatt * 7*c62a0ac4Smatt * Redistribution and use in source and binary forms, with or 8*c62a0ac4Smatt * without modification, are permitted provided that the following 9*c62a0ac4Smatt * conditions are met: 10*c62a0ac4Smatt * 1. Redistributions of source code must retain the above copyright 11*c62a0ac4Smatt * notice, this list of conditions and the following disclaimer. 12*c62a0ac4Smatt * 2. Redistributions in binary form must reproduce the above 13*c62a0ac4Smatt * copyright notice, this list of conditions and the following 14*c62a0ac4Smatt * disclaimer in the documentation and/or other materials provided 15*c62a0ac4Smatt * with the distribution. 16*c62a0ac4Smatt * 3. All advertising materials mentioning features or use of this 17*c62a0ac4Smatt * software must display the following acknowledgements: 18*c62a0ac4Smatt * This product includes software developed by the Urbana-Champaign 19*c62a0ac4Smatt * Independent Media Center. 20*c62a0ac4Smatt * This product includes software developed by Garrett D'Amore. 21*c62a0ac4Smatt * 4. Urbana-Champaign Independent Media Center's name and Garrett 22*c62a0ac4Smatt * D'Amore's name may not be used to endorse or promote products 23*c62a0ac4Smatt * derived from this software without specific prior written permission. 24*c62a0ac4Smatt * 25*c62a0ac4Smatt * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT 26*c62a0ac4Smatt * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR 27*c62a0ac4Smatt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28*c62a0ac4Smatt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29*c62a0ac4Smatt * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT 30*c62a0ac4Smatt * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT, 31*c62a0ac4Smatt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32*c62a0ac4Smatt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33*c62a0ac4Smatt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34*c62a0ac4Smatt * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 35*c62a0ac4Smatt * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36*c62a0ac4Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 37*c62a0ac4Smatt * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38*c62a0ac4Smatt */ 39*c62a0ac4Smatt 40*c62a0ac4Smatt #ifndef _AT91SPIVAR_H_ 41*c62a0ac4Smatt #define _AT91SPIVAR_H_ 42*c62a0ac4Smatt 43*c62a0ac4Smatt #include <dev/spi/spivar.h> 44*c62a0ac4Smatt 45*c62a0ac4Smatt struct at91spi_machdep { 46*c62a0ac4Smatt int (*select_slave)(void *self, int); 47*c62a0ac4Smatt }; 48*c62a0ac4Smatt 49*c62a0ac4Smatt typedef const struct at91spi_machdep *at91spi_machdep_tag_t; 50*c62a0ac4Smatt 51*c62a0ac4Smatt struct at91spi_softc { 52*c62a0ac4Smatt device_t sc_dev; 53*c62a0ac4Smatt bus_space_tag_t sc_iot; 54*c62a0ac4Smatt bus_space_handle_t sc_ioh; 55*c62a0ac4Smatt 56*c62a0ac4Smatt bus_dma_tag_t sc_dmat; 57*c62a0ac4Smatt 58*c62a0ac4Smatt int sc_pid; /* peripheral identifier */ 59*c62a0ac4Smatt struct spi_controller sc_spi; /* SPI implementation ops */ 60*c62a0ac4Smatt at91spi_machdep_tag_t sc_md; /* board-specific support */ 61*c62a0ac4Smatt struct at91spi_job *sc_job; /* current job */ 62*c62a0ac4Smatt struct spi_chunk *sc_wchunk; 63*c62a0ac4Smatt struct spi_chunk *sc_rchunk; 64*c62a0ac4Smatt void *sc_ih; /* interrupt handler (what?) */ 65*c62a0ac4Smatt 66*c62a0ac4Smatt void *sc_dmapage; 67*c62a0ac4Smatt bus_addr_t sc_dmaaddr; 68*c62a0ac4Smatt bus_dmamap_t sc_dmamap; 69*c62a0ac4Smatt int sc_dmaoffs; /* current dma offset */ 70*c62a0ac4Smatt 71*c62a0ac4Smatt struct spi_transfer *sc_transfer; 72*c62a0ac4Smatt bool sc_running; /* is it processing stuff? */ 73*c62a0ac4Smatt 74*c62a0ac4Smatt SIMPLEQ_HEAD(,spi_transfer) sc_q; 75*c62a0ac4Smatt }; 76*c62a0ac4Smatt 77*c62a0ac4Smatt void at91spi_attach_common(device_t parent, device_t self, void *aux, 78*c62a0ac4Smatt at91spi_machdep_tag_t md); 79*c62a0ac4Smatt 80*c62a0ac4Smatt #endif /* _AT91SPIVAR_H_ */ 81