1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds #ifndef __HD64570_H 31da177e4SLinus Torvalds #define __HD64570_H 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds /* SCA HD64570 register definitions - all addresses for mode 0 (8086 MPU) 61da177e4SLinus Torvalds and 1 (64180 MPU). For modes 2 and 3, XOR the address with 0x01. 71da177e4SLinus Torvalds 81da177e4SLinus Torvalds Source: HD64570 SCA User's Manual 91da177e4SLinus Torvalds */ 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds 121da177e4SLinus Torvalds 131da177e4SLinus Torvalds /* SCA Control Registers */ 141da177e4SLinus Torvalds #define LPR 0x00 /* Low Power */ 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds /* Wait controller registers */ 171da177e4SLinus Torvalds #define PABR0 0x02 /* Physical Address Boundary 0 */ 181da177e4SLinus Torvalds #define PABR1 0x03 /* Physical Address Boundary 1 */ 191da177e4SLinus Torvalds #define WCRL 0x04 /* Wait Control L */ 201da177e4SLinus Torvalds #define WCRM 0x05 /* Wait Control M */ 211da177e4SLinus Torvalds #define WCRH 0x06 /* Wait Control H */ 221da177e4SLinus Torvalds 231da177e4SLinus Torvalds #define PCR 0x08 /* DMA Priority Control */ 241da177e4SLinus Torvalds #define DMER 0x09 /* DMA Master Enable */ 251da177e4SLinus Torvalds 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds /* Interrupt registers */ 281da177e4SLinus Torvalds #define ISR0 0x10 /* Interrupt Status 0 */ 291da177e4SLinus Torvalds #define ISR1 0x11 /* Interrupt Status 1 */ 301da177e4SLinus Torvalds #define ISR2 0x12 /* Interrupt Status 2 */ 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds #define IER0 0x14 /* Interrupt Enable 0 */ 331da177e4SLinus Torvalds #define IER1 0x15 /* Interrupt Enable 1 */ 341da177e4SLinus Torvalds #define IER2 0x16 /* Interrupt Enable 2 */ 351da177e4SLinus Torvalds 361da177e4SLinus Torvalds #define ITCR 0x18 /* Interrupt Control */ 371da177e4SLinus Torvalds #define IVR 0x1A /* Interrupt Vector */ 381da177e4SLinus Torvalds #define IMVR 0x1C /* Interrupt Modified Vector */ 391da177e4SLinus Torvalds 401da177e4SLinus Torvalds 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds /* MSCI channel (port) 0 registers - offset 0x20 431da177e4SLinus Torvalds MSCI channel (port) 1 registers - offset 0x40 */ 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds #define MSCI0_OFFSET 0x20 461da177e4SLinus Torvalds #define MSCI1_OFFSET 0x40 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds #define TRBL 0x00 /* TX/RX buffer L */ 491da177e4SLinus Torvalds #define TRBH 0x01 /* TX/RX buffer H */ 501da177e4SLinus Torvalds #define ST0 0x02 /* Status 0 */ 511da177e4SLinus Torvalds #define ST1 0x03 /* Status 1 */ 521da177e4SLinus Torvalds #define ST2 0x04 /* Status 2 */ 531da177e4SLinus Torvalds #define ST3 0x05 /* Status 3 */ 541da177e4SLinus Torvalds #define FST 0x06 /* Frame Status */ 551da177e4SLinus Torvalds #define IE0 0x08 /* Interrupt Enable 0 */ 561da177e4SLinus Torvalds #define IE1 0x09 /* Interrupt Enable 1 */ 571da177e4SLinus Torvalds #define IE2 0x0A /* Interrupt Enable 2 */ 581da177e4SLinus Torvalds #define FIE 0x0B /* Frame Interrupt Enable */ 591da177e4SLinus Torvalds #define CMD 0x0C /* Command */ 601da177e4SLinus Torvalds #define MD0 0x0E /* Mode 0 */ 611da177e4SLinus Torvalds #define MD1 0x0F /* Mode 1 */ 621da177e4SLinus Torvalds #define MD2 0x10 /* Mode 2 */ 631da177e4SLinus Torvalds #define CTL 0x11 /* Control */ 641da177e4SLinus Torvalds #define SA0 0x12 /* Sync/Address 0 */ 651da177e4SLinus Torvalds #define SA1 0x13 /* Sync/Address 1 */ 661da177e4SLinus Torvalds #define IDL 0x14 /* Idle Pattern */ 671da177e4SLinus Torvalds #define TMC 0x15 /* Time Constant */ 681da177e4SLinus Torvalds #define RXS 0x16 /* RX Clock Source */ 691da177e4SLinus Torvalds #define TXS 0x17 /* TX Clock Source */ 701da177e4SLinus Torvalds #define TRC0 0x18 /* TX Ready Control 0 */ 711da177e4SLinus Torvalds #define TRC1 0x19 /* TX Ready Control 1 */ 721da177e4SLinus Torvalds #define RRC 0x1A /* RX Ready Control */ 731da177e4SLinus Torvalds #define CST0 0x1C /* Current Status 0 */ 741da177e4SLinus Torvalds #define CST1 0x1D /* Current Status 1 */ 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds 771da177e4SLinus Torvalds /* Timer channel 0 (port 0 RX) registers - offset 0x60 781da177e4SLinus Torvalds Timer channel 1 (port 0 TX) registers - offset 0x68 791da177e4SLinus Torvalds Timer channel 2 (port 1 RX) registers - offset 0x70 801da177e4SLinus Torvalds Timer channel 3 (port 1 TX) registers - offset 0x78 811da177e4SLinus Torvalds */ 821da177e4SLinus Torvalds 831da177e4SLinus Torvalds #define TIMER0RX_OFFSET 0x60 841da177e4SLinus Torvalds #define TIMER0TX_OFFSET 0x68 851da177e4SLinus Torvalds #define TIMER1RX_OFFSET 0x70 861da177e4SLinus Torvalds #define TIMER1TX_OFFSET 0x78 871da177e4SLinus Torvalds 881da177e4SLinus Torvalds #define TCNTL 0x00 /* Up-counter L */ 891da177e4SLinus Torvalds #define TCNTH 0x01 /* Up-counter H */ 901da177e4SLinus Torvalds #define TCONRL 0x02 /* Constant L */ 911da177e4SLinus Torvalds #define TCONRH 0x03 /* Constant H */ 921da177e4SLinus Torvalds #define TCSR 0x04 /* Control/Status */ 931da177e4SLinus Torvalds #define TEPR 0x05 /* Expand Prescale */ 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds /* DMA channel 0 (port 0 RX) registers - offset 0x80 981da177e4SLinus Torvalds DMA channel 1 (port 0 TX) registers - offset 0xA0 991da177e4SLinus Torvalds DMA channel 2 (port 1 RX) registers - offset 0xC0 1001da177e4SLinus Torvalds DMA channel 3 (port 1 TX) registers - offset 0xE0 1011da177e4SLinus Torvalds */ 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds #define DMAC0RX_OFFSET 0x80 1041da177e4SLinus Torvalds #define DMAC0TX_OFFSET 0xA0 1051da177e4SLinus Torvalds #define DMAC1RX_OFFSET 0xC0 1061da177e4SLinus Torvalds #define DMAC1TX_OFFSET 0xE0 1071da177e4SLinus Torvalds 1081da177e4SLinus Torvalds #define BARL 0x00 /* Buffer Address L (chained block) */ 1091da177e4SLinus Torvalds #define BARH 0x01 /* Buffer Address H (chained block) */ 1101da177e4SLinus Torvalds #define BARB 0x02 /* Buffer Address B (chained block) */ 1111da177e4SLinus Torvalds 1121da177e4SLinus Torvalds #define DARL 0x00 /* RX Destination Addr L (single block) */ 1131da177e4SLinus Torvalds #define DARH 0x01 /* RX Destination Addr H (single block) */ 1141da177e4SLinus Torvalds #define DARB 0x02 /* RX Destination Addr B (single block) */ 1151da177e4SLinus Torvalds 1161da177e4SLinus Torvalds #define SARL 0x04 /* TX Source Address L (single block) */ 1171da177e4SLinus Torvalds #define SARH 0x05 /* TX Source Address H (single block) */ 1181da177e4SLinus Torvalds #define SARB 0x06 /* TX Source Address B (single block) */ 1191da177e4SLinus Torvalds 1201da177e4SLinus Torvalds #define CPB 0x06 /* Chain Pointer Base (chained block) */ 1211da177e4SLinus Torvalds 1221da177e4SLinus Torvalds #define CDAL 0x08 /* Current Descriptor Addr L (chained block) */ 1231da177e4SLinus Torvalds #define CDAH 0x09 /* Current Descriptor Addr H (chained block) */ 1241da177e4SLinus Torvalds #define EDAL 0x0A /* Error Descriptor Addr L (chained block) */ 1251da177e4SLinus Torvalds #define EDAH 0x0B /* Error Descriptor Addr H (chained block) */ 1261da177e4SLinus Torvalds #define BFLL 0x0C /* RX Receive Buffer Length L (chained block)*/ 1271da177e4SLinus Torvalds #define BFLH 0x0D /* RX Receive Buffer Length H (chained block)*/ 1281da177e4SLinus Torvalds #define BCRL 0x0E /* Byte Count L */ 1291da177e4SLinus Torvalds #define BCRH 0x0F /* Byte Count H */ 1301da177e4SLinus Torvalds #define DSR 0x10 /* DMA Status */ 1311da177e4SLinus Torvalds #define DSR_RX(node) (DSR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)) 1321da177e4SLinus Torvalds #define DSR_TX(node) (DSR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)) 1331da177e4SLinus Torvalds #define DMR 0x11 /* DMA Mode */ 1341da177e4SLinus Torvalds #define DMR_RX(node) (DMR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)) 1351da177e4SLinus Torvalds #define DMR_TX(node) (DMR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)) 1361da177e4SLinus Torvalds #define FCT 0x13 /* Frame End Interrupt Counter */ 1371da177e4SLinus Torvalds #define FCT_RX(node) (FCT + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)) 1381da177e4SLinus Torvalds #define FCT_TX(node) (FCT + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)) 1391da177e4SLinus Torvalds #define DIR 0x14 /* DMA Interrupt Enable */ 1401da177e4SLinus Torvalds #define DIR_RX(node) (DIR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)) 1411da177e4SLinus Torvalds #define DIR_TX(node) (DIR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)) 1421da177e4SLinus Torvalds #define DCR 0x15 /* DMA Command */ 1431da177e4SLinus Torvalds #define DCR_RX(node) (DCR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET)) 1441da177e4SLinus Torvalds #define DCR_TX(node) (DCR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET)) 1451da177e4SLinus Torvalds 1461da177e4SLinus Torvalds 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds 1491da177e4SLinus Torvalds /* Descriptor Structure */ 1501da177e4SLinus Torvalds 1511da177e4SLinus Torvalds typedef struct { 1521da177e4SLinus Torvalds u16 cp; /* Chain Pointer */ 1531da177e4SLinus Torvalds u32 bp; /* Buffer Pointer (24 bits) */ 1541da177e4SLinus Torvalds u16 len; /* Data Length */ 1551da177e4SLinus Torvalds u8 stat; /* Status */ 1561da177e4SLinus Torvalds u8 unused; /* pads to 2-byte boundary */ 157ba2d3587SEric Dumazet }__packed pkt_desc; 1581da177e4SLinus Torvalds 1591da177e4SLinus Torvalds 1601da177e4SLinus Torvalds /* Packet Descriptor Status bits */ 1611da177e4SLinus Torvalds 1621da177e4SLinus Torvalds #define ST_TX_EOM 0x80 /* End of frame */ 16388bfe6eaSGeert Uytterhoeven #define ST_TX_EOT 0x01 /* End of transmission */ 1641da177e4SLinus Torvalds 1651da177e4SLinus Torvalds #define ST_RX_EOM 0x80 /* End of frame */ 1661da177e4SLinus Torvalds #define ST_RX_SHORT 0x40 /* Short frame */ 1671da177e4SLinus Torvalds #define ST_RX_ABORT 0x20 /* Abort */ 1681da177e4SLinus Torvalds #define ST_RX_RESBIT 0x10 /* Residual bit */ 1691da177e4SLinus Torvalds #define ST_RX_OVERRUN 0x08 /* Overrun */ 1701da177e4SLinus Torvalds #define ST_RX_CRC 0x04 /* CRC */ 1711da177e4SLinus Torvalds 1721da177e4SLinus Torvalds #define ST_ERROR_MASK 0x7C 1731da177e4SLinus Torvalds 1741da177e4SLinus Torvalds #define DIR_EOTE 0x80 /* Transfer completed */ 1751da177e4SLinus Torvalds #define DIR_EOME 0x40 /* Frame Transfer Completed (chained-block) */ 1761da177e4SLinus Torvalds #define DIR_BOFE 0x20 /* Buffer Overflow/Underflow (chained-block)*/ 1771da177e4SLinus Torvalds #define DIR_COFE 0x10 /* Counter Overflow (chained-block) */ 1781da177e4SLinus Torvalds 1791da177e4SLinus Torvalds 1801da177e4SLinus Torvalds #define DSR_EOT 0x80 /* Transfer completed */ 1811da177e4SLinus Torvalds #define DSR_EOM 0x40 /* Frame Transfer Completed (chained-block) */ 1821da177e4SLinus Torvalds #define DSR_BOF 0x20 /* Buffer Overflow/Underflow (chained-block)*/ 1831da177e4SLinus Torvalds #define DSR_COF 0x10 /* Counter Overflow (chained-block) */ 1841da177e4SLinus Torvalds #define DSR_DE 0x02 /* DMA Enable */ 1851da177e4SLinus Torvalds #define DSR_DWE 0x01 /* DMA Write Disable */ 1861da177e4SLinus Torvalds 1871da177e4SLinus Torvalds /* DMA Master Enable Register (DMER) bits */ 1881da177e4SLinus Torvalds #define DMER_DME 0x80 /* DMA Master Enable */ 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvalds 1911da177e4SLinus Torvalds #define CMD_RESET 0x21 /* Reset Channel */ 1921da177e4SLinus Torvalds #define CMD_TX_ENABLE 0x02 /* Start transmitter */ 1931da177e4SLinus Torvalds #define CMD_RX_ENABLE 0x12 /* Start receiver */ 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds #define MD0_HDLC 0x80 /* Bit-sync HDLC mode */ 1961da177e4SLinus Torvalds #define MD0_CRC_ENA 0x04 /* Enable CRC code calculation */ 1971da177e4SLinus Torvalds #define MD0_CRC_CCITT 0x02 /* CCITT CRC instead of CRC-16 */ 1981da177e4SLinus Torvalds #define MD0_CRC_PR1 0x01 /* Initial all-ones instead of all-zeros */ 1991da177e4SLinus Torvalds 2001da177e4SLinus Torvalds #define MD0_CRC_NONE 0x00 2011da177e4SLinus Torvalds #define MD0_CRC_16_0 0x04 2021da177e4SLinus Torvalds #define MD0_CRC_16 0x05 2031da177e4SLinus Torvalds #define MD0_CRC_ITU_0 0x06 2041da177e4SLinus Torvalds #define MD0_CRC_ITU 0x07 2051da177e4SLinus Torvalds 2061da177e4SLinus Torvalds #define MD2_NRZ 0x00 2071da177e4SLinus Torvalds #define MD2_NRZI 0x20 2081da177e4SLinus Torvalds #define MD2_MANCHESTER 0x80 2091da177e4SLinus Torvalds #define MD2_FM_MARK 0xA0 2101da177e4SLinus Torvalds #define MD2_FM_SPACE 0xC0 2111da177e4SLinus Torvalds #define MD2_LOOPBACK 0x03 /* Local data Loopback */ 2121da177e4SLinus Torvalds 2131da177e4SLinus Torvalds #define CTL_NORTS 0x01 2141da177e4SLinus Torvalds #define CTL_IDLE 0x10 /* Transmit an idle pattern */ 21588bfe6eaSGeert Uytterhoeven #define CTL_UDRNC 0x20 /* Idle after CRC or FCS+flag transmission */ 2161da177e4SLinus Torvalds 2171da177e4SLinus Torvalds #define ST0_TXRDY 0x02 /* TX ready */ 2181da177e4SLinus Torvalds #define ST0_RXRDY 0x01 /* RX ready */ 2191da177e4SLinus Torvalds 2201da177e4SLinus Torvalds #define ST1_UDRN 0x80 /* MSCI TX underrun */ 2211da177e4SLinus Torvalds #define ST1_CDCD 0x04 /* DCD level changed */ 2221da177e4SLinus Torvalds 2231da177e4SLinus Torvalds #define ST3_CTS 0x08 /* modem input - /CTS */ 2241da177e4SLinus Torvalds #define ST3_DCD 0x04 /* modem input - /DCD */ 2251da177e4SLinus Torvalds 2261da177e4SLinus Torvalds #define IE0_TXINT 0x80 /* TX INT MSCI interrupt enable */ 2271da177e4SLinus Torvalds #define IE0_RXINTA 0x40 /* RX INT A MSCI interrupt enable */ 2281da177e4SLinus Torvalds #define IE1_UDRN 0x80 /* TX underrun MSCI interrupt enable */ 2291da177e4SLinus Torvalds #define IE1_CDCD 0x04 /* DCD level changed */ 2301da177e4SLinus Torvalds 2311da177e4SLinus Torvalds #define DCR_ABORT 0x01 /* Software abort command */ 2321da177e4SLinus Torvalds #define DCR_CLEAR_EOF 0x02 /* Clear EOF interrupt */ 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvalds /* TX and RX Clock Source - RXS and TXS */ 2351da177e4SLinus Torvalds #define CLK_BRG_MASK 0x0F 2361da177e4SLinus Torvalds #define CLK_LINE_RX 0x00 /* TX/RX clock line input */ 2371da177e4SLinus Torvalds #define CLK_LINE_TX 0x00 /* TX/RX line input */ 2381da177e4SLinus Torvalds #define CLK_BRG_RX 0x40 /* internal baud rate generator */ 2391da177e4SLinus Torvalds #define CLK_BRG_TX 0x40 /* internal baud rate generator */ 2401da177e4SLinus Torvalds #define CLK_RXCLK_TX 0x60 /* TX clock from RX clock */ 2411da177e4SLinus Torvalds 2421da177e4SLinus Torvalds #endif 243