bced4a8e16efb6c2779d2fa24813c8e9298d9d29
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-ux500 / include / mach / hardware.h
1 /*
2  * Copyright (C) 2009 ST-Ericsson.
3  *
4  * U8500 hardware definitions
5  *
6  * This file is licensed under  the terms of the GNU General Public
7  * License version 2. This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10 #ifndef __MACH_HARDWARE_H
11 #define __MACH_HARDWARE_H
12
13 /* macros to get at IO space when running virtually
14  * We dont map all the peripherals, let ioremap do
15  * this for us. We map only very basic peripherals here.
16  */
17 #define U8500_IO_VIRTUAL        0xf0000000
18 #define U8500_IO_PHYSICAL       0xa0000000
19
20 /* this macro is used in assembly, so no cast */
21 #define IO_ADDRESS(x)           \
22         (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL)
23
24 /* typesafe io address */
25 #define __io_address(n)         __io(IO_ADDRESS(n))
26 /* used by some plat-nomadik code */
27 #define io_p2v(n)               __io_address(n)
28
29 #include <mach/db8500-regs.h>
30 #include <mach/db5500-regs.h>
31
32 /* ST-Ericsson modified pl022 id */
33 #define SSP_PER_ID              0x01080022
34
35 #ifndef __ASSEMBLY__
36
37 #include <asm/cputype.h>
38
39 static inline bool cpu_is_u8500(void)
40 {
41 #ifdef CONFIG_UX500_SOC_DB8500
42         return 1;
43 #else
44         return 0;
45 #endif
46 }
47
48 #define CPUID_DB8500ED  0x410fc090
49 #define CPUID_DB8500V1  0x411fc091
50 #define CPUID_DB8500V2  0x412fc091
51
52 static inline bool cpu_is_u8500ed(void)
53 {
54         return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500ED);
55 }
56
57 static inline bool cpu_is_u8500v1(void)
58 {
59         return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500V1);
60 }
61
62 static inline bool cpu_is_u8500v2(void)
63 {
64         return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500V2);
65 }
66
67 #ifdef CONFIG_UX500_SOC_DB8500
68 bool cpu_is_u8500v10(void);
69 bool cpu_is_u8500v11(void);
70 bool cpu_is_u8500v20(void);
71 #else
72 static inline bool cpu_is_u8500v10(void) { return false; }
73 static inline bool cpu_is_u8500v11(void) { return false; }
74 static inline bool cpu_is_u8500v20(void) { return false; }
75 #endif
76
77 static inline bool cpu_is_u5500(void)
78 {
79 #ifdef CONFIG_UX500_SOC_DB5500
80         return 1;
81 #else
82         return 0;
83 #endif
84 }
85
86 #define ARRAY_AND_SIZE(x)       (x), ARRAY_SIZE(x)
87 #define ux500_unknown_soc()     BUG()
88
89 #endif
90
91 #endif                          /* __MACH_HARDWARE_H */