18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_SH_SMC37C93X_H 38c2ecf20Sopenharmony_ci#define __ASM_SH_SMC37C93X_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * linux/include/asm-sh/smc37c93x.h 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright (C) 2000 Kazumoto Kojima 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * SMSC 37C93x Super IO Chip support 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* Default base I/O address */ 148c2ecf20Sopenharmony_ci#define FDC_PRIMARY_BASE 0x3f0 158c2ecf20Sopenharmony_ci#define IDE1_PRIMARY_BASE 0x1f0 168c2ecf20Sopenharmony_ci#define IDE1_SECONDARY_BASE 0x170 178c2ecf20Sopenharmony_ci#define PARPORT_PRIMARY_BASE 0x378 188c2ecf20Sopenharmony_ci#define COM1_PRIMARY_BASE 0x2f8 198c2ecf20Sopenharmony_ci#define COM2_PRIMARY_BASE 0x3f8 208c2ecf20Sopenharmony_ci#define RTC_PRIMARY_BASE 0x070 218c2ecf20Sopenharmony_ci#define KBC_PRIMARY_BASE 0x060 228c2ecf20Sopenharmony_ci#define AUXIO_PRIMARY_BASE 0x000 /* XXX */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* Logical device number */ 258c2ecf20Sopenharmony_ci#define LDN_FDC 0 268c2ecf20Sopenharmony_ci#define LDN_IDE1 1 278c2ecf20Sopenharmony_ci#define LDN_IDE2 2 288c2ecf20Sopenharmony_ci#define LDN_PARPORT 3 298c2ecf20Sopenharmony_ci#define LDN_COM1 4 308c2ecf20Sopenharmony_ci#define LDN_COM2 5 318c2ecf20Sopenharmony_ci#define LDN_RTC 6 328c2ecf20Sopenharmony_ci#define LDN_KBC 7 338c2ecf20Sopenharmony_ci#define LDN_AUXIO 8 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* Configuration port and key */ 368c2ecf20Sopenharmony_ci#define CONFIG_PORT 0x3f0 378c2ecf20Sopenharmony_ci#define INDEX_PORT CONFIG_PORT 388c2ecf20Sopenharmony_ci#define DATA_PORT 0x3f1 398c2ecf20Sopenharmony_ci#define CONFIG_ENTER 0x55 408c2ecf20Sopenharmony_ci#define CONFIG_EXIT 0xaa 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* Configuration index */ 438c2ecf20Sopenharmony_ci#define CURRENT_LDN_INDEX 0x07 448c2ecf20Sopenharmony_ci#define POWER_CONTROL_INDEX 0x22 458c2ecf20Sopenharmony_ci#define ACTIVATE_INDEX 0x30 468c2ecf20Sopenharmony_ci#define IO_BASE_HI_INDEX 0x60 478c2ecf20Sopenharmony_ci#define IO_BASE_LO_INDEX 0x61 488c2ecf20Sopenharmony_ci#define IRQ_SELECT_INDEX 0x70 498c2ecf20Sopenharmony_ci#define DMA_SELECT_INDEX 0x74 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define GPIO46_INDEX 0xc6 528c2ecf20Sopenharmony_ci#define GPIO47_INDEX 0xc7 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* UART stuff. Only for debugging. */ 558c2ecf20Sopenharmony_ci/* UART Register */ 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define UART_RBR 0x0 /* Receiver Buffer Register (Read Only) */ 588c2ecf20Sopenharmony_ci#define UART_THR 0x0 /* Transmitter Holding Register (Write Only) */ 598c2ecf20Sopenharmony_ci#define UART_IER 0x2 /* Interrupt Enable Register */ 608c2ecf20Sopenharmony_ci#define UART_IIR 0x4 /* Interrupt Ident Register (Read Only) */ 618c2ecf20Sopenharmony_ci#define UART_FCR 0x4 /* FIFO Control Register (Write Only) */ 628c2ecf20Sopenharmony_ci#define UART_LCR 0x6 /* Line Control Register */ 638c2ecf20Sopenharmony_ci#define UART_MCR 0x8 /* MODEM Control Register */ 648c2ecf20Sopenharmony_ci#define UART_LSR 0xa /* Line Status Register */ 658c2ecf20Sopenharmony_ci#define UART_MSR 0xc /* MODEM Status Register */ 668c2ecf20Sopenharmony_ci#define UART_SCR 0xe /* Scratch Register */ 678c2ecf20Sopenharmony_ci#define UART_DLL 0x0 /* Divisor Latch (LS) */ 688c2ecf20Sopenharmony_ci#define UART_DLM 0x2 /* Divisor Latch (MS) */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 718c2ecf20Sopenharmony_citypedef struct uart_reg { 728c2ecf20Sopenharmony_ci volatile __u16 rbr; 738c2ecf20Sopenharmony_ci volatile __u16 ier; 748c2ecf20Sopenharmony_ci volatile __u16 iir; 758c2ecf20Sopenharmony_ci volatile __u16 lcr; 768c2ecf20Sopenharmony_ci volatile __u16 mcr; 778c2ecf20Sopenharmony_ci volatile __u16 lsr; 788c2ecf20Sopenharmony_ci volatile __u16 msr; 798c2ecf20Sopenharmony_ci volatile __u16 scr; 808c2ecf20Sopenharmony_ci} uart_reg; 818c2ecf20Sopenharmony_ci#endif /* ! __ASSEMBLY__ */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* Alias for Write Only Register */ 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define thr rbr 868c2ecf20Sopenharmony_ci#define tcr iir 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* Alias for Divisor Latch Register */ 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define dll rbr 918c2ecf20Sopenharmony_ci#define dlm ier 928c2ecf20Sopenharmony_ci#define fcr iir 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* Interrupt Enable Register */ 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define IER_ERDAI 0x0100 /* Enable Received Data Available Interrupt */ 978c2ecf20Sopenharmony_ci#define IER_ETHREI 0x0200 /* Enable Transmitter Holding Register Empty Interrupt */ 988c2ecf20Sopenharmony_ci#define IER_ELSI 0x0400 /* Enable Receiver Line Status Interrupt */ 998c2ecf20Sopenharmony_ci#define IER_EMSI 0x0800 /* Enable MODEM Status Interrupt */ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci/* Interrupt Ident Register */ 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define IIR_IP 0x0100 /* "0" if Interrupt Pending */ 1048c2ecf20Sopenharmony_ci#define IIR_IIB0 0x0200 /* Interrupt ID Bit 0 */ 1058c2ecf20Sopenharmony_ci#define IIR_IIB1 0x0400 /* Interrupt ID Bit 1 */ 1068c2ecf20Sopenharmony_ci#define IIR_IIB2 0x0800 /* Interrupt ID Bit 2 */ 1078c2ecf20Sopenharmony_ci#define IIR_FIFO 0xc000 /* FIFOs enabled */ 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* FIFO Control Register */ 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define FCR_FEN 0x0100 /* FIFO enable */ 1128c2ecf20Sopenharmony_ci#define FCR_RFRES 0x0200 /* Receiver FIFO reset */ 1138c2ecf20Sopenharmony_ci#define FCR_TFRES 0x0400 /* Transmitter FIFO reset */ 1148c2ecf20Sopenharmony_ci#define FCR_DMA 0x0800 /* DMA mode select */ 1158c2ecf20Sopenharmony_ci#define FCR_RTL 0x4000 /* Receiver trigger (LSB) */ 1168c2ecf20Sopenharmony_ci#define FCR_RTM 0x8000 /* Receiver trigger (MSB) */ 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* Line Control Register */ 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define LCR_WLS0 0x0100 /* Word Length Select Bit 0 */ 1218c2ecf20Sopenharmony_ci#define LCR_WLS1 0x0200 /* Word Length Select Bit 1 */ 1228c2ecf20Sopenharmony_ci#define LCR_STB 0x0400 /* Number of Stop Bits */ 1238c2ecf20Sopenharmony_ci#define LCR_PEN 0x0800 /* Parity Enable */ 1248c2ecf20Sopenharmony_ci#define LCR_EPS 0x1000 /* Even Parity Select */ 1258c2ecf20Sopenharmony_ci#define LCR_SP 0x2000 /* Stick Parity */ 1268c2ecf20Sopenharmony_ci#define LCR_SB 0x4000 /* Set Break */ 1278c2ecf20Sopenharmony_ci#define LCR_DLAB 0x8000 /* Divisor Latch Access Bit */ 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* MODEM Control Register */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define MCR_DTR 0x0100 /* Data Terminal Ready */ 1328c2ecf20Sopenharmony_ci#define MCR_RTS 0x0200 /* Request to Send */ 1338c2ecf20Sopenharmony_ci#define MCR_OUT1 0x0400 /* Out 1 */ 1348c2ecf20Sopenharmony_ci#define MCR_IRQEN 0x0800 /* IRQ Enable */ 1358c2ecf20Sopenharmony_ci#define MCR_LOOP 0x1000 /* Loop */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci/* Line Status Register */ 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define LSR_DR 0x0100 /* Data Ready */ 1408c2ecf20Sopenharmony_ci#define LSR_OE 0x0200 /* Overrun Error */ 1418c2ecf20Sopenharmony_ci#define LSR_PE 0x0400 /* Parity Error */ 1428c2ecf20Sopenharmony_ci#define LSR_FE 0x0800 /* Framing Error */ 1438c2ecf20Sopenharmony_ci#define LSR_BI 0x1000 /* Break Interrupt */ 1448c2ecf20Sopenharmony_ci#define LSR_THRE 0x2000 /* Transmitter Holding Register Empty */ 1458c2ecf20Sopenharmony_ci#define LSR_TEMT 0x4000 /* Transmitter Empty */ 1468c2ecf20Sopenharmony_ci#define LSR_FIFOE 0x8000 /* Receiver FIFO error */ 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* MODEM Status Register */ 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define MSR_DCTS 0x0100 /* Delta Clear to Send */ 1518c2ecf20Sopenharmony_ci#define MSR_DDSR 0x0200 /* Delta Data Set Ready */ 1528c2ecf20Sopenharmony_ci#define MSR_TERI 0x0400 /* Trailing Edge Ring Indicator */ 1538c2ecf20Sopenharmony_ci#define MSR_DDCD 0x0800 /* Delta Data Carrier Detect */ 1548c2ecf20Sopenharmony_ci#define MSR_CTS 0x1000 /* Clear to Send */ 1558c2ecf20Sopenharmony_ci#define MSR_DSR 0x2000 /* Data Set Ready */ 1568c2ecf20Sopenharmony_ci#define MSR_RI 0x4000 /* Ring Indicator */ 1578c2ecf20Sopenharmony_ci#define MSR_DCD 0x8000 /* Data Carrier Detect */ 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* Baud Rate Divisor */ 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#define UART_CLK (1843200) /* 1.8432 MHz */ 1628c2ecf20Sopenharmony_ci#define UART_BAUD(x) (UART_CLK / (16 * (x))) 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* RTC register definition */ 1658c2ecf20Sopenharmony_ci#define RTC_SECONDS 0 1668c2ecf20Sopenharmony_ci#define RTC_SECONDS_ALARM 1 1678c2ecf20Sopenharmony_ci#define RTC_MINUTES 2 1688c2ecf20Sopenharmony_ci#define RTC_MINUTES_ALARM 3 1698c2ecf20Sopenharmony_ci#define RTC_HOURS 4 1708c2ecf20Sopenharmony_ci#define RTC_HOURS_ALARM 5 1718c2ecf20Sopenharmony_ci#define RTC_DAY_OF_WEEK 6 1728c2ecf20Sopenharmony_ci#define RTC_DAY_OF_MONTH 7 1738c2ecf20Sopenharmony_ci#define RTC_MONTH 8 1748c2ecf20Sopenharmony_ci#define RTC_YEAR 9 1758c2ecf20Sopenharmony_ci#define RTC_FREQ_SELECT 10 1768c2ecf20Sopenharmony_ci# define RTC_UIP 0x80 1778c2ecf20Sopenharmony_ci# define RTC_DIV_CTL 0x70 1788c2ecf20Sopenharmony_ci/* This RTC can work under 32.768KHz clock only. */ 1798c2ecf20Sopenharmony_ci# define RTC_OSC_ENABLE 0x20 1808c2ecf20Sopenharmony_ci# define RTC_OSC_DISABLE 0x00 1818c2ecf20Sopenharmony_ci#define RTC_CONTROL 11 1828c2ecf20Sopenharmony_ci# define RTC_SET 0x80 1838c2ecf20Sopenharmony_ci# define RTC_PIE 0x40 1848c2ecf20Sopenharmony_ci# define RTC_AIE 0x20 1858c2ecf20Sopenharmony_ci# define RTC_UIE 0x10 1868c2ecf20Sopenharmony_ci# define RTC_SQWE 0x08 1878c2ecf20Sopenharmony_ci# define RTC_DM_BINARY 0x04 1888c2ecf20Sopenharmony_ci# define RTC_24H 0x02 1898c2ecf20Sopenharmony_ci# define RTC_DST_EN 0x01 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#endif /* __ASM_SH_SMC37C93X_H */ 192