1ec4081c1SIan Lepore /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni *
4ec4081c1SIan Lepore * Copyright (c) 2013 Ian Lepore <ian@freebsd.org>
5ec4081c1SIan Lepore * All rights reserved.
6ec4081c1SIan Lepore *
7ec4081c1SIan Lepore * Redistribution and use in source and binary forms, with or without
8ec4081c1SIan Lepore * modification, are permitted provided that the following conditions
9ec4081c1SIan Lepore * are met:
10ec4081c1SIan Lepore * 1. Redistributions of source code must retain the above copyright
11ec4081c1SIan Lepore * notice, this list of conditions and the following disclaimer.
12ec4081c1SIan Lepore * 2. Redistributions in binary form must reproduce the above copyright
13ec4081c1SIan Lepore * notice, this list of conditions and the following disclaimer in the
14ec4081c1SIan Lepore * documentation and/or other materials provided with the distribution.
15ec4081c1SIan Lepore *
16ec4081c1SIan Lepore * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17ec4081c1SIan Lepore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18ec4081c1SIan Lepore * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ec4081c1SIan Lepore * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20ec4081c1SIan Lepore * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21ec4081c1SIan Lepore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22ec4081c1SIan Lepore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23ec4081c1SIan Lepore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24ec4081c1SIan Lepore * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25ec4081c1SIan Lepore * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26ec4081c1SIan Lepore * SUCH DAMAGE.
27ec4081c1SIan Lepore */
28ec4081c1SIan Lepore
29ec4081c1SIan Lepore #ifndef IMX_MACHDEP_H
30ec4081c1SIan Lepore #define IMX_MACHDEP_H
31ec4081c1SIan Lepore
32ec4081c1SIan Lepore #include <sys/types.h>
33bd6b2f9bSIan Lepore #include <sys/sysctl.h>
34bd6b2f9bSIan Lepore
35bd6b2f9bSIan Lepore SYSCTL_DECL(_hw_imx);
36ec4081c1SIan Lepore
37ec4081c1SIan Lepore /* Common functions, implemented in imx_machdep.c. */
38ec4081c1SIan Lepore
39ec4081c1SIan Lepore void imx_wdog_cpu_reset(vm_offset_t _wdcr_phys) __attribute__((__noreturn__));
40bd6b2f9bSIan Lepore void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys);
41ec4081c1SIan Lepore
42f955880fSIan Lepore /* From here down, routines are implemented in imxNN_machdep.c. */
43f955880fSIan Lepore
44ec4081c1SIan Lepore /*
45ec4081c1SIan Lepore * SoC identity.
46f955880fSIan Lepore * According to the documentation, there is such a thing as an i.MX6 Dual
47f955880fSIan Lepore * (non-lite flavor). However, Freescale doesn't seem to have assigned it a
48f955880fSIan Lepore * number in their code for determining the SoC type in u-boot.
49f955880fSIan Lepore *
50f955880fSIan Lepore * To-do: put silicon revision numbers into the low-order bits somewhere.
51ec4081c1SIan Lepore */
52f955880fSIan Lepore #define IMXSOC_51 0x51000000
53f955880fSIan Lepore #define IMXSOC_53 0x53000000
54f955880fSIan Lepore #define IMXSOC_6SL 0x60000000
55f955880fSIan Lepore #define IMXSOC_6DL 0x61000000
56f955880fSIan Lepore #define IMXSOC_6S 0x62000000
57f955880fSIan Lepore #define IMXSOC_6Q 0x63000000
58c1411a76SIan Lepore #define IMXSOC_6UL 0x64000000
59f955880fSIan Lepore #define IMXSOC_FAMSHIFT 28
60ec4081c1SIan Lepore
61ec4081c1SIan Lepore u_int imx_soc_type(void);
621f23f8b0SIan Lepore
631f23f8b0SIan Lepore static inline u_int
imx_soc_family(void)641f23f8b0SIan Lepore imx_soc_family(void)
651f23f8b0SIan Lepore {
661f23f8b0SIan Lepore return (imx_soc_type() >> IMXSOC_FAMSHIFT);
671f23f8b0SIan Lepore }
68ec4081c1SIan Lepore
69ec4081c1SIan Lepore #endif
70