xref: /netbsd/sys/arch/arm/xscale/pxa2x0cpu.h (revision 6550d01e)
1 /*	$NetBSD: pxa2x0cpu.h,v 1.4 2007/02/25 13:46:40 nonaka Exp $ */
2 
3 /*
4  * Copyright (c) 2005  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. The name of Genetec Corporation may not be used to endorse or
16  *    promote products derived from this software without specific prior
17  *    written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 /*
34  * In kernel config file, users can have options
35  *    CPU_XSCALE_PXA250 and/or CPU_XSCALE_PXA270.
36  *
37  * If kernel is configured to support PXA250 and PXA270, CPU type is
38  * determined run-time by reading a co-processor register.
39  */
40 
41 #ifndef	_ARM_XSCALE_PXA2X0CPU_H
42 #define	_ARM_XSCALE_PXA2X0CPU_H
43 
44 #ifdef	_KERNEL_OPT
45 #include	"opt_cputypes.h" /* User's choice of CPU */
46 #endif
47 
48 #if !defined(CPU_XSCALE_PXA250) && !defined(CPU_XSCALE_PXA270)
49 #error neither CPU_XSCALE_PXA250 nor CPU_XSCALE_PXA270 is defined.
50 #endif
51 
52 #if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
53 # define  __CPU_XSCALE_PXA2XX
54 #endif
55 
56 #define	CPU_ID_PXA_MASK	(CPU_ID_IMPLEMETOR_MASK|CPU_ID_VARIANT_MASK|\
57 			 CPU_ID_ARCH_MASK|CPU_ID_XSCALE_COREGEN_MASK)
58 
59 #define	__CPU_IS_PXA250	((cpufunc_id() & CPU_ID_XSCALE_COREGEN_MASK) == 0x2000)
60 #define	__CPU_IS_PXA270	((cpufunc_id() & CPU_ID_XSCALE_COREGEN_MASK) == 0x4000)
61 
62 # if defined(CPU_XSCALE_PXA250) && defined(CPU_XSCALE_PXA270)
63 #define	CPU_IS_PXA250	__CPU_IS_PXA250
64 #define	CPU_IS_PXA270	__CPU_IS_PXA270
65 #elif defined(CPU_XSCALE_PXA250) && !defined(CPU_XSCALE_PXA270)
66 #define	CPU_IS_PXA250	(1)
67 #define	CPU_IS_PXA270	(0)
68 #elif !defined(CPU_XSCALE_PXA250) && defined(CPU_XSCALE_PXA270)
69 #define	CPU_IS_PXA250	(0)
70 #define	CPU_IS_PXA270	(1)
71 #elif !defined(CPU_XSCALE_PXA250) && !defined(CPU_XSCALE_PXA270)
72 #define	CPU_IS_PXA250	(0)
73 #define	CPU_IS_PXA270	(0)
74 #endif
75 
76 #include <arm/xscale/pxa2x0reg.h>
77 
78 #ifdef	CPU_XSCALE_PXA270
79 #define	PXA2X0_GPIO_SIZE	PXA270_GPIO_SIZE
80 #define	GPIO_REG		PXA270_GPIO_REG
81 #define	GPIO_NPINS		PXA270_GPIO_NPINS
82 #define	PXA2X0_MEMCTL_SIZE	PXA270_MEMCTL_SIZE
83 #define	PXA2X0_USBDC_SIZE	PXA270_USBDC_SIZE
84 #define	PXA2X0_RTC_SIZE		PXA270_RTC_SIZE
85 #else
86 #define	PXA2X0_GPIO_SIZE	PXA250_GPIO_SIZE
87 #define	GPIO_REG		PXA250_GPIO_REG
88 #define	GPIO_NPINS		PXA250_GPIO_NPINS
89 #define	PXA2X0_MEMCTL_SIZE	PXA250_MEMCTL_SIZE
90 #define	PXA2X0_USBDC_SIZE	PXA250_USBDC_SIZE
91 #define	PXA2X0_RTC_SIZE		PXA250_RTC_SIZE
92 #endif
93 
94 #endif	/* _ARM_XSCALE_PXA2X0CPU_H */
95