xref: /netbsd-src/sys/arch/evbarm/netwalker/netwalker_reg.h (revision 5e60bdb17cf197c88b1cd07bd7f71c91b3da0cec)
1*5e60bdb1Sbsh /*	$NetBSD: netwalker_reg.h,v 1.1 2010/11/13 07:31:32 bsh Exp $	*/
2*5e60bdb1Sbsh 
3*5e60bdb1Sbsh /*
4*5e60bdb1Sbsh  * Copyright (c) 2010  Genetec Corporation.  All rights reserved.
5*5e60bdb1Sbsh  * Written by Hiroyuki Bessho for Genetec Corporation.
6*5e60bdb1Sbsh  *
7*5e60bdb1Sbsh  * Redistribution and use in source and binary forms, with or without
8*5e60bdb1Sbsh  * modification, are permitted provided that the following conditions
9*5e60bdb1Sbsh  * are met:
10*5e60bdb1Sbsh  * 1. Redistributions of source code must retain the above copyright
11*5e60bdb1Sbsh  *    notice, this list of conditions and the following disclaimer.
12*5e60bdb1Sbsh  * 2. Redistributions in binary form must reproduce the above copyright
13*5e60bdb1Sbsh  *    notice, this list of conditions and the following disclaimer in the
14*5e60bdb1Sbsh  *    documentation and/or other materials provided with the distribution.
15*5e60bdb1Sbsh  *
16*5e60bdb1Sbsh  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
17*5e60bdb1Sbsh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*5e60bdb1Sbsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*5e60bdb1Sbsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
20*5e60bdb1Sbsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*5e60bdb1Sbsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*5e60bdb1Sbsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*5e60bdb1Sbsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*5e60bdb1Sbsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*5e60bdb1Sbsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*5e60bdb1Sbsh  * POSSIBILITY OF SUCH DAMAGE.
27*5e60bdb1Sbsh  *
28*5e60bdb1Sbsh  */
29*5e60bdb1Sbsh 
30*5e60bdb1Sbsh 
31*5e60bdb1Sbsh #ifndef _EVBARM_NETWALKER_REG_H
32*5e60bdb1Sbsh #define _EVBARM_NETWALKER_REG_H
33*5e60bdb1Sbsh 
34*5e60bdb1Sbsh #include <arm/imx/imx51reg.h>
35*5e60bdb1Sbsh 
36*5e60bdb1Sbsh /* map UART1 and IOMUXC for bootstrap */
37*5e60bdb1Sbsh #define	NETWALKER_IO_VBASE0	0xfd000000
38*5e60bdb1Sbsh #define	NETWALKER_IO_PBASE0	0x73f00000	/* GPIO, IOMUXC, UART */
39*5e60bdb1Sbsh 
40*5e60bdb1Sbsh #define	NETWALKER_UART1_VBASE	\
41*5e60bdb1Sbsh 	(IMX51_UART1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
42*5e60bdb1Sbsh #define	NETWALKER_IOMUXC_VBASE	\
43*5e60bdb1Sbsh 	(IOMUXC_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
44*5e60bdb1Sbsh 
45*5e60bdb1Sbsh /* GPIO[1..4] */
46*5e60bdb1Sbsh #define	NETWALKER_GPIO1_VBASE	\
47*5e60bdb1Sbsh 	(GPIO1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
48*5e60bdb1Sbsh #define	NETWALKER_GPIO_VBASE(n)	\
49*5e60bdb1Sbsh 	(NETWALKER_GPIO1_VBASE+((n)-1)*0x4000)
50*5e60bdb1Sbsh #define	NETWALKER_WDOG_VBASE	\
51*5e60bdb1Sbsh 	(WDOG1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
52*5e60bdb1Sbsh 
53*5e60bdb1Sbsh 
54*5e60bdb1Sbsh #define ioreg_read(a)		(*(volatile uint32_t *)(a))
55*5e60bdb1Sbsh #define ioreg_write(a,v)	(*(volatile uint32_t *)(a)=(v))
56*5e60bdb1Sbsh 
57*5e60bdb1Sbsh #define	ioreg32_read	ioreg_read
58*5e60bdb1Sbsh #define	ioreg32_write	ioreg_write
59*5e60bdb1Sbsh 
60*5e60bdb1Sbsh #define	ioreg16_read(a) 	(*(volatile uint16_t *)(a))
61*5e60bdb1Sbsh #define	ioreg16_write(a,v)	(*(volatile uint16_t *)(a) = (v))
62*5e60bdb1Sbsh 
63*5e60bdb1Sbsh #define	ioreg8_read(a)  	(*(volatile uint8_t *)(a))
64*5e60bdb1Sbsh #define	ioreg8_write(a,v)	(*(volatile uint8_t *)(a) = (v))
65*5e60bdb1Sbsh 
66*5e60bdb1Sbsh #endif /* _EVBARM_NETWALKER_REG_H */
67