Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * arch/arm/mach-ep93xx/include/mach/ts72xx.h
0004  */
0005 
0006 /*
0007  * TS72xx memory map:
0008  *
0009  * virt     phys        size
0010  * febff000 22000000    4K  model number register (bits 0-2)
0011  * febfe000 22400000    4K  options register
0012  * febfd000 22800000    4K  options register #2
0013  * febfc000     23400000        4K      CPLD version register
0014  */
0015 
0016 #ifndef __TS72XX_H_
0017 #define __TS72XX_H_
0018 
0019 #define TS72XX_MODEL_PHYS_BASE      0x22000000
0020 #define TS72XX_MODEL_VIRT_BASE      IOMEM(0xfebff000)
0021 #define TS72XX_MODEL_SIZE       0x00001000
0022 
0023 #define TS72XX_MODEL_TS7200     0x00
0024 #define TS72XX_MODEL_TS7250     0x01
0025 #define TS72XX_MODEL_TS7260     0x02
0026 #define TS72XX_MODEL_TS7300     0x03
0027 #define TS72XX_MODEL_TS7400     0x04
0028 #define TS72XX_MODEL_MASK       0x07
0029 
0030 
0031 #define TS72XX_OPTIONS_PHYS_BASE    0x22400000
0032 #define TS72XX_OPTIONS_VIRT_BASE    IOMEM(0xfebfe000)
0033 #define TS72XX_OPTIONS_SIZE     0x00001000
0034 
0035 #define TS72XX_OPTIONS_COM2_RS485   0x02
0036 #define TS72XX_OPTIONS_MAX197       0x01
0037 
0038 
0039 #define TS72XX_OPTIONS2_PHYS_BASE   0x22800000
0040 #define TS72XX_OPTIONS2_VIRT_BASE   IOMEM(0xfebfd000)
0041 #define TS72XX_OPTIONS2_SIZE        0x00001000
0042 
0043 #define TS72XX_OPTIONS2_TS9420      0x04
0044 #define TS72XX_OPTIONS2_TS9420_BOOT 0x02
0045 
0046 #define TS72XX_CPLDVER_PHYS_BASE    0x23400000
0047 #define TS72XX_CPLDVER_VIRT_BASE    IOMEM(0xfebfc000)
0048 #define TS72XX_CPLDVER_SIZE     0x00001000
0049 
0050 #ifndef __ASSEMBLY__
0051 
0052 static inline int ts72xx_model(void)
0053 {
0054     return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
0055 }
0056 
0057 static inline int board_is_ts7200(void)
0058 {
0059     return ts72xx_model() == TS72XX_MODEL_TS7200;
0060 }
0061 
0062 static inline int board_is_ts7250(void)
0063 {
0064     return ts72xx_model() == TS72XX_MODEL_TS7250;
0065 }
0066 
0067 static inline int board_is_ts7260(void)
0068 {
0069     return ts72xx_model() == TS72XX_MODEL_TS7260;
0070 }
0071 
0072 static inline int board_is_ts7300(void)
0073 {
0074     return ts72xx_model()  == TS72XX_MODEL_TS7300;
0075 }
0076 
0077 static inline int board_is_ts7400(void)
0078 {
0079     return ts72xx_model() == TS72XX_MODEL_TS7400;
0080 }
0081 
0082 static inline int is_max197_installed(void)
0083 {
0084     return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
0085                     TS72XX_OPTIONS_MAX197);
0086 }
0087 
0088 static inline int is_ts9420_installed(void)
0089 {
0090     return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
0091                     TS72XX_OPTIONS2_TS9420);
0092 }
0093 #endif
0094 #endif /* __TS72XX_H_ */