18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ep93xx/include/mach/ts72xx.h 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci/* 78c2ecf20Sopenharmony_ci * TS72xx memory map: 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * virt phys size 108c2ecf20Sopenharmony_ci * febff000 22000000 4K model number register (bits 0-2) 118c2ecf20Sopenharmony_ci * febfe000 22400000 4K options register 128c2ecf20Sopenharmony_ci * febfd000 22800000 4K options register #2 138c2ecf20Sopenharmony_ci * febfc000 23400000 4K CPLD version register 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#ifndef __TS72XX_H_ 178c2ecf20Sopenharmony_ci#define __TS72XX_H_ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define TS72XX_MODEL_PHYS_BASE 0x22000000 208c2ecf20Sopenharmony_ci#define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000) 218c2ecf20Sopenharmony_ci#define TS72XX_MODEL_SIZE 0x00001000 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define TS72XX_MODEL_TS7200 0x00 248c2ecf20Sopenharmony_ci#define TS72XX_MODEL_TS7250 0x01 258c2ecf20Sopenharmony_ci#define TS72XX_MODEL_TS7260 0x02 268c2ecf20Sopenharmony_ci#define TS72XX_MODEL_TS7300 0x03 278c2ecf20Sopenharmony_ci#define TS72XX_MODEL_TS7400 0x04 288c2ecf20Sopenharmony_ci#define TS72XX_MODEL_MASK 0x07 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS_PHYS_BASE 0x22400000 328c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000) 338c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS_SIZE 0x00001000 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS_COM2_RS485 0x02 368c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS_MAX197 0x01 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS2_PHYS_BASE 0x22800000 408c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000) 418c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS2_SIZE 0x00001000 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS2_TS9420 0x04 448c2ecf20Sopenharmony_ci#define TS72XX_OPTIONS2_TS9420_BOOT 0x02 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define TS72XX_CPLDVER_PHYS_BASE 0x23400000 478c2ecf20Sopenharmony_ci#define TS72XX_CPLDVER_VIRT_BASE IOMEM(0xfebfc000) 488c2ecf20Sopenharmony_ci#define TS72XX_CPLDVER_SIZE 0x00001000 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistatic inline int ts72xx_model(void) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK; 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistatic inline int board_is_ts7200(void) 588c2ecf20Sopenharmony_ci{ 598c2ecf20Sopenharmony_ci return ts72xx_model() == TS72XX_MODEL_TS7200; 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistatic inline int board_is_ts7250(void) 638c2ecf20Sopenharmony_ci{ 648c2ecf20Sopenharmony_ci return ts72xx_model() == TS72XX_MODEL_TS7250; 658c2ecf20Sopenharmony_ci} 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistatic inline int board_is_ts7260(void) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci return ts72xx_model() == TS72XX_MODEL_TS7260; 708c2ecf20Sopenharmony_ci} 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cistatic inline int board_is_ts7300(void) 738c2ecf20Sopenharmony_ci{ 748c2ecf20Sopenharmony_ci return ts72xx_model() == TS72XX_MODEL_TS7300; 758c2ecf20Sopenharmony_ci} 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_cistatic inline int board_is_ts7400(void) 788c2ecf20Sopenharmony_ci{ 798c2ecf20Sopenharmony_ci return ts72xx_model() == TS72XX_MODEL_TS7400; 808c2ecf20Sopenharmony_ci} 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistatic inline int is_max197_installed(void) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) & 858c2ecf20Sopenharmony_ci TS72XX_OPTIONS_MAX197); 868c2ecf20Sopenharmony_ci} 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic inline int is_ts9420_installed(void) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) & 918c2ecf20Sopenharmony_ci TS72XX_OPTIONS2_TS9420); 928c2ecf20Sopenharmony_ci} 938c2ecf20Sopenharmony_ci#endif 948c2ecf20Sopenharmony_ci#endif /* __TS72XX_H_ */ 95