]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/arm/mach-ep93xx/ts72xx.h
Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[mirror_ubuntu-bionic-kernel.git] / arch / arm / mach-ep93xx / ts72xx.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * arch/arm/mach-ep93xx/include/mach/ts72xx.h
4 */
5
6 /*
7 * TS72xx memory map:
8 *
9 * virt phys size
10 * febff000 22000000 4K model number register (bits 0-2)
11 * febfe000 22400000 4K options register
12 * febfd000 22800000 4K options register #2
13 */
14
15 #define TS72XX_MODEL_PHYS_BASE 0x22000000
16 #define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000)
17 #define TS72XX_MODEL_SIZE 0x00001000
18
19 #define TS72XX_MODEL_TS7200 0x00
20 #define TS72XX_MODEL_TS7250 0x01
21 #define TS72XX_MODEL_TS7260 0x02
22 #define TS72XX_MODEL_TS7300 0x03
23 #define TS72XX_MODEL_TS7400 0x04
24 #define TS72XX_MODEL_MASK 0x07
25
26
27 #define TS72XX_OPTIONS_PHYS_BASE 0x22400000
28 #define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000)
29 #define TS72XX_OPTIONS_SIZE 0x00001000
30
31 #define TS72XX_OPTIONS_COM2_RS485 0x02
32 #define TS72XX_OPTIONS_MAX197 0x01
33
34
35 #define TS72XX_OPTIONS2_PHYS_BASE 0x22800000
36 #define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000)
37 #define TS72XX_OPTIONS2_SIZE 0x00001000
38
39 #define TS72XX_OPTIONS2_TS9420 0x04
40 #define TS72XX_OPTIONS2_TS9420_BOOT 0x02
41
42 #ifndef __ASSEMBLY__
43
44 static inline int ts72xx_model(void)
45 {
46 return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
47 }
48
49 static inline int board_is_ts7200(void)
50 {
51 return ts72xx_model() == TS72XX_MODEL_TS7200;
52 }
53
54 static inline int board_is_ts7250(void)
55 {
56 return ts72xx_model() == TS72XX_MODEL_TS7250;
57 }
58
59 static inline int board_is_ts7260(void)
60 {
61 return ts72xx_model() == TS72XX_MODEL_TS7260;
62 }
63
64 static inline int board_is_ts7300(void)
65 {
66 return ts72xx_model() == TS72XX_MODEL_TS7300;
67 }
68
69 static inline int board_is_ts7400(void)
70 {
71 return ts72xx_model() == TS72XX_MODEL_TS7400;
72 }
73
74 static inline int is_max197_installed(void)
75 {
76 return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
77 TS72XX_OPTIONS_MAX197);
78 }
79
80 static inline int is_ts9420_installed(void)
81 {
82 return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
83 TS72XX_OPTIONS2_TS9420);
84 }
85 #endif