g42xxeb_var.h revision 1.2.2.1       1      1.1       bsh /*-
      2      1.1       bsh  * Copyright (c) 2001, 2002, 2005 Genetec corp.
      3      1.1       bsh  * All rights reserved.
      4      1.1       bsh  *
      5      1.1       bsh  * Written by Hiroyuki Bessho for Genetec corp.
      6      1.1       bsh  *
      7      1.1       bsh  * Redistribution and use in source and binary forms, with or without
      8      1.1       bsh  * modification, are permitted provided that the following conditions
      9      1.1       bsh  * are met:
     10      1.1       bsh  * 1. Redistributions of source code must retain the above copyright
     11      1.1       bsh  *    notice, this list of conditions and the following disclaimer.
     12      1.1       bsh  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1       bsh  *    notice, this list of conditions and the following disclaimer in the
     14      1.1       bsh  *    documentation and/or other materials provided with the distribution.
     15  1.2.2.1  wrstuden  * 3. Neither the name of The NetBSD Foundation nor the names of its
     16  1.2.2.1  wrstuden  *    contributors may be used to endorse or promote products derived
     17  1.2.2.1  wrstuden  *    from this software without specific prior written permission.
     18      1.1       bsh  *
     19      1.1       bsh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20      1.1       bsh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21      1.1       bsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22      1.1       bsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23      1.1       bsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24      1.1       bsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25      1.1       bsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26      1.1       bsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27      1.1       bsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28      1.1       bsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29      1.1       bsh  * POSSIBILITY OF SUCH DAMAGE.
     30      1.1       bsh  */
     31      1.1       bsh 
     32      1.1       bsh #ifndef _EVBARM_G42XXEB_VAR_H
     33      1.1       bsh #define _EVBARM_G42XXEB_VAR_H
     34      1.1       bsh 
     35      1.1       bsh #include <sys/conf.h>
     36      1.1       bsh #include <sys/device.h>
     37      1.1       bsh 
     38      1.1       bsh #include <machine/bus.h>
     39      1.1       bsh #include <evbarm/g42xxeb/g42xxeb_reg.h>
     40      1.1       bsh 
     41      1.1       bsh 
     42      1.1       bsh /*
     43      1.1       bsh  * G42xxeb on-board IO bus
     44      1.1       bsh  */
     45      1.1       bsh struct obio_softc {
     46      1.1       bsh 	struct device sc_dev;
     47      1.1       bsh 	bus_space_tag_t sc_iot;
     48      1.1       bsh 	bus_space_handle_t sc_obioreg_ioh;
     49      1.1       bsh 
     50      1.1       bsh 	/* handle to PXA2x0's memory controller.
     51      1.1       bsh 	   XXX: shouldn't be here. */
     52      1.1       bsh 	bus_space_handle_t sc_memctl_ioh;
     53      1.1       bsh 
     54      1.1       bsh 	void	*sc_ih;		/* interrupt handler for obio on pxaip */
     55      1.1       bsh 	void	*sc_si;		/* software interrupt handler */
     56      1.1       bsh 	int	sc_intr;
     57      1.1       bsh 	uint16_t  sc_intr_mask;
     58      1.1       bsh 	uint16_t  sc_intr_pending;
     59      1.1       bsh 	int	sc_ipl;		/* Max ipl among sub interrupts */
     60      1.1       bsh 	struct obio_handler {
     61      1.1       bsh 		int	(* func)(void *);
     62      1.1       bsh 		void	*arg;
     63      1.1       bsh 		int	level;
     64      1.1       bsh 	} sc_handler[G42XXEB_N_INTS];
     65      1.1       bsh };
     66      1.1       bsh 
     67      1.1       bsh typedef void *obio_chipset_tag_t;
     68      1.1       bsh 
     69      1.1       bsh struct obio_attach_args {
     70      1.1       bsh 	obio_chipset_tag_t	oba_sc;
     71      1.1       bsh 	bus_space_tag_t		oba_iot; 	/* Bus tag */
     72      1.1       bsh 	bus_addr_t		oba_addr;	/* i/o address  */
     73      1.1       bsh 	int			oba_intr;
     74      1.1       bsh };
     75      1.1       bsh 
     76      1.1       bsh /* on-board hex LED */
     77      1.1       bsh void hex_led( uint32_t value );
     78      1.1       bsh 
     79      1.1       bsh /*
     80      1.1       bsh  * IRQ handler
     81      1.1       bsh  */
     82      1.1       bsh void *obio_intr_establish(struct obio_softc *, int, int, int,
     83      1.1       bsh     int (*)(void *), void *);
     84      1.1       bsh void obio_intr_disestablish(struct obio_softc *, int, int (*)(void *));
     85      1.1       bsh void obio_intr_mask(struct obio_softc *, struct obio_handler *);
     86      1.1       bsh void obio_intr_unmask(struct obio_softc *, struct obio_handler *);
     87      1.1       bsh 
     88      1.1       bsh #define obio_update_intrmask(sc) \
     89      1.1       bsh 	bus_space_write_2( (sc)->sc_iot, (sc)->sc_obioreg_ioh, \
     90      1.1       bsh 	    G42XXEB_INTMASK, (sc)->sc_intr_mask | (sc)->sc_intr_pending );
     91      1.1       bsh 
     92      1.1       bsh void obio_peripheral_reset(struct obio_softc *, int, int);
     93      1.1       bsh 
     94      1.1       bsh #endif /* _EVBARM_G42XXEB_VAR_H */
     95