License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-block.git] / arch / arm / mach-ep93xx / ts72xx.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
e7736d47 2/*
a09e64fb 3 * arch/arm/mach-ep93xx/include/mach/ts72xx.h
e7736d47
LB
4 */
5
6/*
7 * TS72xx memory map:
8 *
9 * virt phys size
505ed6fd 10 * febff000 22000000 4K model number register (bits 0-2)
e7736d47
LB
11 * febfe000 22400000 4K options register
12 * febfd000 22800000 4K options register #2
e7736d47
LB
13 */
14
15#define TS72XX_MODEL_PHYS_BASE 0x22000000
29fe651f 16#define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000)
e7736d47
LB
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
2a004c68
22#define TS72XX_MODEL_TS7300 0x03
23#define TS72XX_MODEL_TS7400 0x04
505ed6fd 24#define TS72XX_MODEL_MASK 0x07
e7736d47
LB
25
26
27#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
29fe651f 28#define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000)
e7736d47
LB
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
29fe651f 36#define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000)
e7736d47
LB
37#define TS72XX_OPTIONS2_SIZE 0x00001000
38
39#define TS72XX_OPTIONS2_TS9420 0x04
40#define TS72XX_OPTIONS2_TS9420_BOOT 0x02
41
12926dc4
MW
42#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000
43#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000
7ba01f97 44
e7736d47 45#ifndef __ASSEMBLY__
e7736d47 46
505ed6fd
47static inline int ts72xx_model(void)
48{
49 return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
50}
51
e7736d47
LB
52static inline int board_is_ts7200(void)
53{
505ed6fd 54 return ts72xx_model() == TS72XX_MODEL_TS7200;
e7736d47
LB
55}
56
57static inline int board_is_ts7250(void)
58{
505ed6fd 59 return ts72xx_model() == TS72XX_MODEL_TS7250;
e7736d47
LB
60}
61
62static inline int board_is_ts7260(void)
63{
505ed6fd 64 return ts72xx_model() == TS72XX_MODEL_TS7260;
e7736d47
LB
65}
66
2a004c68
67static inline int board_is_ts7300(void)
68{
505ed6fd 69 return ts72xx_model() == TS72XX_MODEL_TS7300;
2a004c68
70}
71
72static inline int board_is_ts7400(void)
73{
505ed6fd 74 return ts72xx_model() == TS72XX_MODEL_TS7400;
2a004c68
75}
76
e7736d47
LB
77static inline int is_max197_installed(void)
78{
79 return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
80 TS72XX_OPTIONS_MAX197);
81}
82
83static inline int is_ts9420_installed(void)
84{
85 return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
86 TS72XX_OPTIONS2_TS9420);
87}
88#endif