blob: 00b4941d29c95000bd851f0e3100455bce9611c1 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Russell Kinga09e64f2008-08-05 16:14:15 +01002/*
3 * arch/arm/mach-ep93xx/include/mach/ts72xx.h
4 */
5
6/*
7 * TS72xx memory map:
8 *
9 * virt phys size
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010010 * febff000 22000000 4K model number register (bits 0-2)
Russell Kinga09e64f2008-08-05 16:14:15 +010011 * febfe000 22400000 4K options register
12 * febfd000 22800000 4K options register #2
Lukasz Majewskic8cee352017-12-12 00:36:25 +010013 * febfc000 23400000 4K CPLD version register
Russell Kinga09e64f2008-08-05 16:14:15 +010014 */
15
Lukasz Majewskia49bf932017-12-12 00:36:22 +010016#ifndef __TS72XX_H_
17#define __TS72XX_H_
18
Russell Kinga09e64f2008-08-05 16:14:15 +010019#define TS72XX_MODEL_PHYS_BASE 0x22000000
Arnd Bergmann29fe6512012-09-14 23:34:32 +020020#define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000)
Russell Kinga09e64f2008-08-05 16:14:15 +010021#define TS72XX_MODEL_SIZE 0x00001000
22
23#define TS72XX_MODEL_TS7200 0x00
24#define TS72XX_MODEL_TS7250 0x01
25#define TS72XX_MODEL_TS7260 0x02
Petr Štetiar2a004c62011-06-17 11:09:07 +010026#define TS72XX_MODEL_TS7300 0x03
27#define TS72XX_MODEL_TS7400 0x04
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010028#define TS72XX_MODEL_MASK 0x07
Russell Kinga09e64f2008-08-05 16:14:15 +010029
30
31#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
Arnd Bergmann29fe6512012-09-14 23:34:32 +020032#define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000)
Russell Kinga09e64f2008-08-05 16:14:15 +010033#define TS72XX_OPTIONS_SIZE 0x00001000
34
35#define TS72XX_OPTIONS_COM2_RS485 0x02
36#define TS72XX_OPTIONS_MAX197 0x01
37
38
39#define TS72XX_OPTIONS2_PHYS_BASE 0x22800000
Arnd Bergmann29fe6512012-09-14 23:34:32 +020040#define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000)
Russell Kinga09e64f2008-08-05 16:14:15 +010041#define TS72XX_OPTIONS2_SIZE 0x00001000
42
43#define TS72XX_OPTIONS2_TS9420 0x04
44#define TS72XX_OPTIONS2_TS9420_BOOT 0x02
45
Lukasz Majewskic8cee352017-12-12 00:36:25 +010046#define TS72XX_CPLDVER_PHYS_BASE 0x23400000
47#define TS72XX_CPLDVER_VIRT_BASE IOMEM(0xfebfc000)
48#define TS72XX_CPLDVER_SIZE 0x00001000
49
Russell Kinga09e64f2008-08-05 16:14:15 +010050#ifndef __ASSEMBLY__
Russell Kinga09e64f2008-08-05 16:14:15 +010051
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010052static inline int ts72xx_model(void)
53{
54 return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
55}
56
Russell Kinga09e64f2008-08-05 16:14:15 +010057static inline int board_is_ts7200(void)
58{
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010059 return ts72xx_model() == TS72XX_MODEL_TS7200;
Russell Kinga09e64f2008-08-05 16:14:15 +010060}
61
62static inline int board_is_ts7250(void)
63{
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010064 return ts72xx_model() == TS72XX_MODEL_TS7250;
Russell Kinga09e64f2008-08-05 16:14:15 +010065}
66
67static inline int board_is_ts7260(void)
68{
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010069 return ts72xx_model() == TS72XX_MODEL_TS7260;
Russell Kinga09e64f2008-08-05 16:14:15 +010070}
71
Petr Štetiar2a004c62011-06-17 11:09:07 +010072static inline int board_is_ts7300(void)
73{
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010074 return ts72xx_model() == TS72XX_MODEL_TS7300;
Petr Štetiar2a004c62011-06-17 11:09:07 +010075}
76
77static inline int board_is_ts7400(void)
78{
Petr Štetiar505ed6fd2011-06-17 11:11:59 +010079 return ts72xx_model() == TS72XX_MODEL_TS7400;
Petr Štetiar2a004c62011-06-17 11:09:07 +010080}
81
Russell Kinga09e64f2008-08-05 16:14:15 +010082static inline int is_max197_installed(void)
83{
84 return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
85 TS72XX_OPTIONS_MAX197);
86}
87
88static inline int is_ts9420_installed(void)
89{
90 return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
91 TS72XX_OPTIONS2_TS9420);
92}
93#endif
Lukasz Majewskia49bf932017-12-12 00:36:22 +010094#endif /* __TS72XX_H_ */