1/*	$NetBSD$	*/
2
3/*
4 * Copyright (c) 2010  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 *
16 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30
31#ifndef _EVBARM_NETWALKER_REG_H
32#define _EVBARM_NETWALKER_REG_H
33
34#include <arm/imx/imx51reg.h>
35
36/* map UART1 and IOMUXC for bootstrap */
37#define	NETWALKER_IO_VBASE0	0xfd000000
38#define	NETWALKER_IO_PBASE0	0x73f00000	/* GPIO, IOMUXC, UART */
39
40#define	NETWALKER_UART1_VBASE	\
41	(IMX51_UART1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
42#define	NETWALKER_IOMUXC_VBASE	\
43	(IOMUXC_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
44
45/* GPIO[1..4] */
46#define	NETWALKER_GPIO1_VBASE	\
47	(GPIO1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
48#define	NETWALKER_GPIO_VBASE(n)	\
49	(NETWALKER_GPIO1_VBASE+((n)-1)*0x4000)
50#define	NETWALKER_WDOG_VBASE	\
51	(WDOG1_BASE-NETWALKER_IO_PBASE0+NETWALKER_IO_VBASE0)
52
53
54#define ioreg_read(a)		(*(volatile uint32_t *)(a))
55#define ioreg_write(a,v)	(*(volatile uint32_t *)(a)=(v))
56
57#define	ioreg32_read	ioreg_read
58#define	ioreg32_write	ioreg_write
59
60#define	ioreg16_read(a) 	(*(volatile uint16_t *)(a))
61#define	ioreg16_write(a,v)	(*(volatile uint16_t *)(a) = (v))
62
63#define	ioreg8_read(a)  	(*(volatile uint8_t *)(a))
64#define	ioreg8_write(a,v)	(*(volatile uint8_t *)(a) = (v))
65
66#endif /* _EVBARM_NETWALKER_REG_H */
67