exynos_var.h revision 1.1 1 /* $NetBSD: exynos_var.h,v 1.1 2014/04/13 02:26:26 matt Exp $ */
2 /*-
3 * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas of 3am Software Foundry.
8 *
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Reinoud Zandijk.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef _ARM_SAMSUNG_EXYNOS_VAR_H_
35 #define _ARM_SAMSUNG_EXYNOS_VAR_H_
36
37 #include <sys/types.h>
38 #include <sys/bus.h>
39 #include <sys/gpio.h>
40 #include <arm/samsung/exynos_reg.h>
41
42 //#include <dev/gpio/gpiovar.h>
43
44 extern uint32_t exynos_soc_id;
45 extern uint32_t exynos_pop_id;
46
47 #define EXYNOS_PRODUCT_FAMILY(soc) __SHIFTOUT((soc), __BITS(24,31))
48 #define EXYNOS4_PRODUCT_FAMILY 0xe4
49 #define EXYNOS5_PRODUCT_FAMILY 0xe5
50 #define EXYNOS_PRODUCT_ID(soc) __SHIFTOUT((soc), __BITS(12,31))
51 #define EXYNOS_PRODUCT_PACKAGE(soc) __SHIFTOUT((soc), __BITS(8,11))
52 #define EXYNOS_PRODUCT_REV(soc) __SHIFTOUT((soc), __BITS(4,7))
53 #define EXYNOS_PRODUCT_SUBREV(soc) __SHIFTOUT((soc), __BITS(0,3))
54
55
56 #define IS_EXYNOS4410_P() (EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe4410)
57 #define IS_EXYNOS4412_P() (EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe4412)
58 #define IS_EXYNOS4412_R0_P() \
59 ((EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe4412) && \
60 (EXYNOS_PRODUCT_REV(exynos_soc_id) == 0))
61 #define IS_EXYNOS4_P() (IS_EXYNOS4410 || IS_EXYNOS4412)
62
63 #define IS_EXYNOS5410_P() (EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe5410)
64 #define IS_EXYNOS5440_P() (EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe5440)
65
66 #define IS_EXYNOS5_P() (EXYNOS_PRODUCT_FAMILY(exynos_soc_id) == EXYNOS5_PRODUCT_FAMILY)
67
68 struct exyo_locators {
69 const char *loc_name;
70 bus_size_t loc_offset;
71 bus_size_t loc_size;
72 int loc_port;
73 int loc_intr;
74 int loc_flags;
75 };
76
77 #define EXYO_INTR_DEFAULT 0
78
79 #if 0
80 #define EXYO_E4410 __BIT(0)
81 #define EXYO_E4412 __BIT(1)
82 #define EXYO_E5440 __BIT(2)
83 #define EXYO_E5XXX __BIT(3)
84
85 #define EXYO_ONLY __BITS(7,0)
86 #define EXYO_ALL __BITS(7,0)
87 #define EXYO_REQUIRED __BIT(8)
88 #endif
89
90 struct exyo_attach_args {
91 struct exyo_locators exyo_loc;
92 bus_space_tag_t exyo_core_bst;
93 bus_space_tag_t exyo_core_a4x_bst;
94 bus_space_handle_t exyo_core_bsh;
95 bus_dma_tag_t exyo_dmat;
96 bus_dma_tag_t exyo_coherent_dmat;
97 };
98
99
100 extern struct bus_space exynos_bs_tag;
101 extern struct bus_space exynos_a4x_bs_tag;
102 extern bus_space_handle_t exynos_core_bsh;
103
104 void exynos_bootstrap(vaddr_t, vaddr_t);
105 void exynos_device_register(device_t self, void *aux);
106 void exyo_device_register(device_t self, void *aux);
107 void exynos_wdt_reset(void);
108
109 #endif /* _ARM_SAMSUNG_EXYNOS_VAR_H_ */
110