18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* apollohw.h : some structures to access apollo HW */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef _ASMm68k_APOLLOHW_H_ 58c2ecf20Sopenharmony_ci#define _ASMm68k_APOLLOHW_H_ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/types.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <asm/bootinfo-apollo.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciextern u_long apollo_model; 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* 168c2ecf20Sopenharmony_ci see scn2681 data sheet for more info. 178c2ecf20Sopenharmony_ci member names are read_write. 188c2ecf20Sopenharmony_ci*/ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define DECLARE_2681_FIELD(x) unsigned char x; unsigned char dummy##x 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistruct SCN2681 { 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(mra); 258c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(sra_csra); 268c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(BRGtest_cra); 278c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(rhra_thra); 288c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(ipcr_acr); 298c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(isr_imr); 308c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(ctu_ctur); 318c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(ctl_ctlr); 328c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(mrb); 338c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(srb_csrb); 348c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(tst_crb); 358c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(rhrb_thrb); 368c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(reserved); 378c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(ip_opcr); 388c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(startCnt_setOutBit); 398c2ecf20Sopenharmony_ci DECLARE_2681_FIELD(stopCnt_resetOutBit); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistruct mc146818 { 448c2ecf20Sopenharmony_ci unsigned char second, alarm_second; 458c2ecf20Sopenharmony_ci unsigned char minute, alarm_minute; 468c2ecf20Sopenharmony_ci unsigned char hours, alarm_hours; 478c2ecf20Sopenharmony_ci unsigned char day_of_week, day_of_month; 488c2ecf20Sopenharmony_ci unsigned char month, year; 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define IO_BASE 0x80000000 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciextern u_long sio01_physaddr; 558c2ecf20Sopenharmony_ciextern u_long sio23_physaddr; 568c2ecf20Sopenharmony_ciextern u_long rtc_physaddr; 578c2ecf20Sopenharmony_ciextern u_long pica_physaddr; 588c2ecf20Sopenharmony_ciextern u_long picb_physaddr; 598c2ecf20Sopenharmony_ciextern u_long cpuctrl_physaddr; 608c2ecf20Sopenharmony_ciextern u_long timer_physaddr; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define SAU7_SIO01_PHYSADDR 0x10400 638c2ecf20Sopenharmony_ci#define SAU7_SIO23_PHYSADDR 0x10500 648c2ecf20Sopenharmony_ci#define SAU7_RTC_PHYSADDR 0x10900 658c2ecf20Sopenharmony_ci#define SAU7_PICA 0x11000 668c2ecf20Sopenharmony_ci#define SAU7_PICB 0x11100 678c2ecf20Sopenharmony_ci#define SAU7_CPUCTRL 0x10100 688c2ecf20Sopenharmony_ci#define SAU7_TIMER 0x010800 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define SAU8_SIO01_PHYSADDR 0x8400 718c2ecf20Sopenharmony_ci#define SAU8_RTC_PHYSADDR 0x8900 728c2ecf20Sopenharmony_ci#define SAU8_PICA 0x9400 738c2ecf20Sopenharmony_ci#define SAU8_PICB 0x9500 748c2ecf20Sopenharmony_ci#define SAU8_CPUCTRL 0x8100 758c2ecf20Sopenharmony_ci#define SAU8_TIMER 0x8800 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + sio01_physaddr))) 788c2ecf20Sopenharmony_ci#define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + sio23_physaddr))) 798c2ecf20Sopenharmony_ci#define rtc (((volatile struct mc146818 *)(IO_BASE + rtc_physaddr))) 808c2ecf20Sopenharmony_ci#define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr)) 818c2ecf20Sopenharmony_ci#define pica (IO_BASE + pica_physaddr) 828c2ecf20Sopenharmony_ci#define picb (IO_BASE + picb_physaddr) 838c2ecf20Sopenharmony_ci#define apollo_timer (IO_BASE + timer_physaddr) 848c2ecf20Sopenharmony_ci#define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000)) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define IRQ_APOLLO IRQ_USER 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#endif 91