xref: /netbsd/sys/arch/arm/xscale/pxa2x0var.h (revision c4a72b64)
1 /* $NetBSD: pxa2x0var.h,v 1.1 2002/10/19 19:31:41 bsh Exp $ */
2 
3 /*
4  * Copyright (c) 2002  Genetec Corporation.  All rights reserved.
5  * Written by Hiroyuki Bessho for Genetec Corporation.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed for the NetBSD Project by
18  *	Genetec Corporation.
19  * 4. The name of Genetec Corporation may not be used to endorse or
20  *    promote products derived from this software without specific prior
21  *    written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 
37 #ifndef _ARM_XSCALE_PXA2X0VAR_H_
38 #define _ARM_XSCALE_PXA2X0VAR_H_
39 
40 #include <arm/sa11x0/sa11x0_var.h>
41 
42 /* PXA2X0's integrated peripheral bus.
43  *
44  * pxaip_softc `inherits' sa11x0_softc.  This is a hack to make OS
45  * timer driver for SA11x0 (arm/sa11x0/sa11x0_ost.c) work on PXA2X0.
46  * PXA2X0 has a same OS timer unit as SA11X0 has.
47  */
48 
49 typedef int (* pxa2x0_irq_handler_t)(void *);
50 
51 struct pxa2x0_softc {
52 	struct sa11x0_softc	saip;
53 
54 	bus_space_handle_t	sc_memctl_ioh; /* Memory controller */
55 	bus_space_handle_t	sc_clkman_ioh; /* Clock manager */
56 	bus_space_handle_t	sc_rtc_ioh; /* real time clock */
57 };
58 
59 extern struct pxa2x0_softc *pxa2x0_softc;
60 
61 struct pxa2x0_attach_args {
62 	struct sa11x0_attach_args  pxa_sa;
63 
64 	int pxa_index;			/* to specify device by index number */
65 
66 #define pxa_sc   	pxa_sa.sa_sc
67 #define pxa_iot 	pxa_sa.sa_iot
68 #define pxa_addr	pxa_sa.sa_addr
69 #define pxa_size	pxa_sa.sa_size
70 #define pxa_intr	pxa_sa.sa_intr
71 #define pxa_gpio	pxa_sa.sa_gpio
72 };
73 
74 
75 extern struct bus_space pxa2x0_bs_tag;
76 extern struct arm32_bus_dma_tag pxa2x0_bus_dma_tag;
77 extern struct bus_space pxa2x0_a4x_bs_tag;
78 
79 void pxa2x0_set_intcbase(vaddr_t);
80 void pxa2x0_intr_init(void);
81 void *pxa2x0_intr_establish(int irqno, int level,
82 			    int (*func)(void *), void *cookie);
83 void pxa2x0_update_intr_masks( int irqno, int level );
84 extern int current_spl_level;
85 
86 /* Integrated UART */
87 enum pxa2x0_uart_id { UART_FFUART, UART_BTUART, UART_STUART };
88 extern void com_pxaip_setup( struct pxa2x0_softc *, enum pxa2x0_uart_id );
89 
90 
91 /* misc. */
92 extern int pxa2x0_measure_cpuclock( struct pxa2x0_softc * );
93 extern void pxa2x0_fcs_init(void);
94 extern void pxa2x0_freq_change(int);
95 extern void pxa2x0_turbo_mode(int);
96 extern int pxa2x0_i2c_master_tx( int, uint8_t *, int );
97 
98 void pxa2x0_irq_handler(struct clockframe *);
99 
100 
101 #endif /* _ARM_XSCALE_PXA2X0VAR_H_ */
102