Home | History | Annotate | Line # | Download | only in xscale
i80312var.h revision 1.4.4.2
      1  1.4.4.2  nathanw /*	$NetBSD: i80312var.h,v 1.4.4.2 2002/01/08 00:23:19 nathanw Exp $	*/
      2  1.4.4.2  nathanw 
      3  1.4.4.2  nathanw /*
      4  1.4.4.2  nathanw  * Copyright (c) 2001 Wasabi Systems, Inc.
      5  1.4.4.2  nathanw  * All rights reserved.
      6  1.4.4.2  nathanw  *
      7  1.4.4.2  nathanw  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8  1.4.4.2  nathanw  *
      9  1.4.4.2  nathanw  * Redistribution and use in source and binary forms, with or without
     10  1.4.4.2  nathanw  * modification, are permitted provided that the following conditions
     11  1.4.4.2  nathanw  * are met:
     12  1.4.4.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     13  1.4.4.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     14  1.4.4.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.4.4.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     16  1.4.4.2  nathanw  *    documentation and/or other materials provided with the distribution.
     17  1.4.4.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     18  1.4.4.2  nathanw  *    must display the following acknowledgement:
     19  1.4.4.2  nathanw  *	This product includes software developed for the NetBSD Project by
     20  1.4.4.2  nathanw  *	Wasabi Systems, Inc.
     21  1.4.4.2  nathanw  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22  1.4.4.2  nathanw  *    or promote products derived from this software without specific prior
     23  1.4.4.2  nathanw  *    written permission.
     24  1.4.4.2  nathanw  *
     25  1.4.4.2  nathanw  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26  1.4.4.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.4.4.2  nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.4.4.2  nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29  1.4.4.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.4.4.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.4.4.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.4.4.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.4.4.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.4.4.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.4.4.2  nathanw  * POSSIBILITY OF SUCH DAMAGE.
     36  1.4.4.2  nathanw  */
     37  1.4.4.2  nathanw 
     38  1.4.4.2  nathanw #ifndef _ARM_XSCALE_I80312VAR_H_
     39  1.4.4.2  nathanw #define	_ARM_XSCALE_I80312VAR_H_
     40  1.4.4.2  nathanw 
     41  1.4.4.2  nathanw #include <machine/bus.h>
     42  1.4.4.2  nathanw 
     43  1.4.4.2  nathanw #include <dev/pci/pcivar.h>
     44  1.4.4.2  nathanw 
     45  1.4.4.2  nathanw struct i80312_softc {
     46  1.4.4.2  nathanw 	struct device sc_dev;		/* generic device glue */
     47  1.4.4.2  nathanw 
     48  1.4.4.2  nathanw 	int sc_is_host;			/* indicates if we're a host or
     49  1.4.4.2  nathanw 					   plugged into another host */
     50  1.4.4.2  nathanw 
     51  1.4.4.2  nathanw 	/*
     52  1.4.4.2  nathanw 	 * This is the bus_space and handle used to access the
     53  1.4.4.2  nathanw 	 * i80312 itself.  This is filled in by the board-specific
     54  1.4.4.2  nathanw 	 * front-end.
     55  1.4.4.2  nathanw 	 */
     56  1.4.4.2  nathanw 	bus_space_tag_t sc_st;
     57  1.4.4.2  nathanw 	bus_space_handle_t sc_sh;
     58  1.4.4.2  nathanw 
     59  1.4.4.2  nathanw 	/* Handles for the various subregions. */
     60  1.4.4.2  nathanw 	bus_space_handle_t sc_ppb_sh;
     61  1.4.4.2  nathanw 	bus_space_handle_t sc_atu_sh;
     62  1.4.4.2  nathanw 	bus_space_handle_t sc_mem_sh;
     63  1.4.4.2  nathanw 	bus_space_handle_t sc_intc_sh;
     64  1.4.4.2  nathanw 
     65  1.4.4.2  nathanw 	/*
     66  1.4.4.2  nathanw 	 * Secondary IDSEL Select bits for providing a private
     67  1.4.4.2  nathanw 	 * PCI device space.
     68  1.4.4.2  nathanw 	 */
     69  1.4.4.2  nathanw 	uint16_t sc_sisr;
     70  1.4.4.2  nathanw 
     71  1.4.4.2  nathanw 	/*
     72  1.4.4.2  nathanw 	 * We expect the board-specific front-end to have already mapped
     73  1.4.4.2  nathanw 	 * the PCI I/O spaces .. they're only 64K each, and I/O mappings
     74  1.4.4.2  nathanw 	 * tend to be smaller than a page size, so it's generally more
     75  1.4.4.2  nathanw 	 * efficient to map them all into virtual space in one fell swoop.
     76  1.4.4.2  nathanw 	 */
     77  1.4.4.2  nathanw 	vaddr_t	sc_piow_vaddr;		/* primary I/O window vaddr */
     78  1.4.4.2  nathanw 	vaddr_t sc_siow_vaddr;		/* secondary I/O window vaddr */
     79  1.4.4.2  nathanw 
     80  1.4.4.2  nathanw 	/*
     81  1.4.4.2  nathanw 	 * Variables that define the Primary Inbound window.  The base
     82  1.4.4.2  nathanw 	 * address is configured by a host via BAR #0.  The xlate variable
     83  1.4.4.2  nathanw 	 * defines the start of the local address space that it maps to.
     84  1.4.4.2  nathanw 	 * The size variable defines the byte size.
     85  1.4.4.2  nathanw 	 *
     86  1.4.4.2  nathanw 	 * This window is used for incoming PCI memory read/write cycles
     87  1.4.4.2  nathanw 	 * from a host.
     88  1.4.4.2  nathanw 	 *
     89  1.4.4.2  nathanw 	 * ...unless we're a host, in which case we make the Primary
     90  1.4.4.2  nathanw 	 * Inbound window work like the Secondary Inbound window, so
     91  1.4.4.2  nathanw 	 * that PCI devices on that bus can talk to our local RAM.
     92  1.4.4.2  nathanw 	 */
     93  1.4.4.2  nathanw 	uint32_t sc_pin_base;
     94  1.4.4.2  nathanw 	uint32_t sc_pin_xlate;
     95  1.4.4.2  nathanw 	uint32_t sc_pin_size;
     96  1.4.4.2  nathanw 
     97  1.4.4.2  nathanw 	/*
     98  1.4.4.2  nathanw 	 * Variables that define the Secondary Inbound window.  The
     99  1.4.4.2  nathanw 	 * base variable indicates the PCI base address of the window.
    100  1.4.4.2  nathanw 	 * The xlate variable defines the start of the local address
    101  1.4.4.2  nathanw 	 * space that it maps to.  The size variable defines the byte
    102  1.4.4.2  nathanw 	 * size.
    103  1.4.4.2  nathanw 	 *
    104  1.4.4.2  nathanw 	 * This window is used for DMA with devices on the secondary bus.
    105  1.4.4.2  nathanw 	 */
    106  1.4.4.2  nathanw 	uint32_t sc_sin_base;
    107  1.4.4.2  nathanw 	uint32_t sc_sin_xlate;
    108  1.4.4.2  nathanw 	uint32_t sc_sin_size;
    109  1.4.4.2  nathanw 
    110  1.4.4.2  nathanw 	/*
    111  1.4.4.2  nathanw 	 * This is the PCI address that the Primary Outbound Memory
    112  1.4.4.2  nathanw 	 * window maps to.
    113  1.4.4.2  nathanw 	 */
    114  1.4.4.2  nathanw 	uint32_t sc_pmemout_base;
    115  1.4.4.2  nathanw 	uint32_t sc_pmemout_size;
    116  1.4.4.2  nathanw 
    117  1.4.4.2  nathanw 	/*
    118  1.4.4.2  nathanw 	 * This is the PCI address that the Primary Outbound I/O
    119  1.4.4.2  nathanw 	 * window maps to.
    120  1.4.4.2  nathanw 	 */
    121  1.4.4.2  nathanw 	uint32_t sc_pioout_base;
    122  1.4.4.2  nathanw 	uint32_t sc_pioout_size;
    123  1.4.4.2  nathanw 
    124  1.4.4.2  nathanw 	/*
    125  1.4.4.2  nathanw 	 * This is the PCI address that the Secondary Outbound Memory
    126  1.4.4.2  nathanw 	 * window maps to.
    127  1.4.4.2  nathanw 	 */
    128  1.4.4.2  nathanw 	uint32_t sc_smemout_base;
    129  1.4.4.2  nathanw 	uint32_t sc_smemout_size;
    130  1.4.4.2  nathanw 
    131  1.4.4.2  nathanw 	/*
    132  1.4.4.2  nathanw 	 * This is the PCI address that the Secondary Outbound I/O
    133  1.4.4.2  nathanw 	 * window maps to.
    134  1.4.4.2  nathanw 	 */
    135  1.4.4.2  nathanw 	uint32_t sc_sioout_base;
    136  1.4.4.2  nathanw 	uint32_t sc_sioout_size;
    137  1.4.4.2  nathanw 
    138  1.4.4.2  nathanw 	/*
    139  1.4.4.2  nathanw 	 * This defines the private I/O and Memory spaces on the
    140  1.4.4.2  nathanw 	 * Secondary bus.
    141  1.4.4.2  nathanw 	 */
    142  1.4.4.2  nathanw 	uint32_t sc_privio_base;
    143  1.4.4.2  nathanw 	uint32_t sc_privio_size;
    144  1.4.4.2  nathanw 	uint32_t sc_privmem_base;
    145  1.4.4.2  nathanw 	uint32_t sc_privmem_size;
    146  1.4.4.2  nathanw 
    147  1.4.4.2  nathanw 	uint8_t sc_sder;	/* secondary decode enable register */
    148  1.4.4.2  nathanw 
    149  1.4.4.2  nathanw 	/* Bus space, DMA, and PCI tags for the PCI bus (private devices). */
    150  1.4.4.2  nathanw 	struct bus_space sc_pci_iot;
    151  1.4.4.2  nathanw 	struct bus_space sc_pci_memt;
    152  1.4.4.2  nathanw 	struct arm32_bus_dma_tag sc_pci_dmat;
    153  1.4.4.2  nathanw 	struct arm32_pci_chipset sc_pci_chipset;
    154  1.4.4.2  nathanw 
    155  1.4.4.2  nathanw 	/* GPIO state */
    156  1.4.4.2  nathanw 	uint8_t sc_gpio_dir;	/* GPIO pin direction (1 == output) */
    157  1.4.4.2  nathanw 	uint8_t sc_gpio_val;	/* GPIO output pin value */
    158  1.4.4.2  nathanw };
    159  1.4.4.2  nathanw 
    160  1.4.4.2  nathanw extern struct bus_space i80312_bs_tag;
    161  1.4.4.2  nathanw extern struct i80312_softc *i80312_softc;
    162  1.4.4.2  nathanw 
    163  1.4.4.2  nathanw void	i80312_sdram_bounds(bus_space_tag_t, bus_space_handle_t,
    164  1.4.4.2  nathanw 	    paddr_t *, psize_t *);
    165  1.4.4.2  nathanw 
    166  1.4.4.2  nathanw void	i80312_attach(struct i80312_softc *);
    167  1.4.4.2  nathanw 
    168  1.4.4.2  nathanw void	i80312_bs_init(bus_space_tag_t, void *);
    169  1.4.4.2  nathanw void	i80312_io_bs_init(bus_space_tag_t, void *);
    170  1.4.4.2  nathanw void	i80312_mem_bs_init(bus_space_tag_t, void *);
    171  1.4.4.2  nathanw 
    172  1.4.4.2  nathanw void	i80312_gpio_set_direction(uint8_t, uint8_t);
    173  1.4.4.2  nathanw void	i80312_gpio_set_val(uint8_t, uint8_t);
    174  1.4.4.2  nathanw uint8_t	i80312_gpio_get_val(void);
    175  1.4.4.2  nathanw 
    176  1.4.4.2  nathanw void	i80312_pci_dma_init(bus_dma_tag_t, void *);
    177  1.4.4.2  nathanw 
    178  1.4.4.2  nathanw void	i80312_pci_init(pci_chipset_tag_t, void *);
    179  1.4.4.2  nathanw 
    180  1.4.4.2  nathanw #endif /* _ARM_XSCALE_I80312VAR_H_ */
    181